Browse Source

Use a const ref for the bone AABB in rendering code

Aaron Franke 3 years ago
parent
commit
f91934872d

+ 2 - 2
drivers/gles3/storage/mesh_storage.cpp

@@ -255,9 +255,9 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
 			mesh->bone_aabbs.resize(p_surface.bone_aabbs.size());
 		}
 		for (int i = 0; i < p_surface.bone_aabbs.size(); i++) {
-			AABB bone = p_surface.bone_aabbs[i];
+			const AABB &bone = p_surface.bone_aabbs[i];
 			if (!bone.has_no_volume()) {
-				mesh->bone_aabbs.write[i].merge_with(p_surface.bone_aabbs[i]);
+				mesh->bone_aabbs.write[i].merge_with(bone);
 			}
 		}
 		mesh->aabb.merge_with(p_surface.aabb);

+ 2 - 2
servers/rendering/renderer_rd/storage_rd/mesh_storage.cpp

@@ -416,9 +416,9 @@ void MeshStorage::mesh_add_surface(RID p_mesh, const RS::SurfaceData &p_surface)
 			mesh->bone_aabbs.resize(p_surface.bone_aabbs.size());
 		}
 		for (int i = 0; i < p_surface.bone_aabbs.size(); i++) {
-			AABB bone = p_surface.bone_aabbs[i];
+			const AABB &bone = p_surface.bone_aabbs[i];
 			if (!bone.has_no_volume()) {
-				mesh->bone_aabbs.write[i].merge_with(p_surface.bone_aabbs[i]);
+				mesh->bone_aabbs.write[i].merge_with(bone);
 			}
 		}
 		mesh->aabb.merge_with(p_surface.aabb);