Skip to content

Commit

Permalink
Merge pull request #70091 from clayjohn/bone-aabbs
Browse files Browse the repository at this point in the history
Remove mesh bone_aabbs as they are not used anywhere and calculating them is a pain
  • Loading branch information
akien-mga committed Dec 17, 2022
2 parents 7972107 + ef246d9 commit 2b05611
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 42 deletions.
19 changes: 0 additions & 19 deletions drivers/gles3/storage/mesh_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,27 +323,8 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
}

if (mesh->surface_count == 0) {
mesh->bone_aabbs = p_surface.bone_aabbs;
mesh->aabb = p_surface.aabb;
} else {
if (mesh->bone_aabbs.size() < p_surface.bone_aabbs.size()) {
// ArrayMesh::_surface_set_data only allocates bone_aabbs up to max_bone
// Each surface may affect different numbers of bones.
mesh->bone_aabbs.resize(p_surface.bone_aabbs.size());
}
for (int i = 0; i < p_surface.bone_aabbs.size(); i++) {
const AABB &bone = p_surface.bone_aabbs[i];
if (bone.has_volume()) {
AABB &mesh_bone = mesh->bone_aabbs.write[i];
if (mesh_bone != AABB()) {
// Already initialized, merge AABBs.
mesh_bone.merge_with(bone);
} else {
// Not yet initialized, copy the bone AABB.
mesh_bone = bone;
}
}
}
mesh->aabb.merge_with(p_surface.aabb);
}

Expand Down
2 changes: 0 additions & 2 deletions drivers/gles3/storage/mesh_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ struct Mesh {
Surface **surfaces = nullptr;
uint32_t surface_count = 0;

Vector<AABB> bone_aabbs;

bool has_bone_weights = false;

AABB aabb;
Expand Down
19 changes: 0 additions & 19 deletions servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -434,27 +434,8 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
}

if (mesh->surface_count == 0) {
mesh->bone_aabbs = p_surface.bone_aabbs;
mesh->aabb = p_surface.aabb;
} else {
if (mesh->bone_aabbs.size() < p_surface.bone_aabbs.size()) {
// ArrayMesh::_surface_set_data only allocates bone_aabbs up to max_bone
// Each surface may affect different numbers of bones.
mesh->bone_aabbs.resize(p_surface.bone_aabbs.size());
}
for (int i = 0; i < p_surface.bone_aabbs.size(); i++) {
const AABB &bone = p_surface.bone_aabbs[i];
if (bone.has_volume()) {
AABB &mesh_bone = mesh->bone_aabbs.write[i];
if (mesh_bone != AABB()) {
// Already initialized, merge AABBs.
mesh_bone.merge_with(bone);
} else {
// Not yet initialized, copy the bone AABB.
mesh_bone = bone;
}
}
}
mesh->aabb.merge_with(p_surface.aabb);
}

Expand Down
2 changes: 0 additions & 2 deletions servers/rendering/renderer_rd/storage_rd/mesh_storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,6 @@ class MeshStorage : public RendererMeshStorage {
Surface **surfaces = nullptr;
uint32_t surface_count = 0;

Vector<AABB> bone_aabbs;

bool has_bone_weights = false;

AABB aabb;
Expand Down

0 comments on commit 2b05611

Please sign in to comment.