refactor: replace raw object pointers with SmartPointer in ObjectsContext and update dependent codebases
This commit is contained in:
@@ -89,8 +89,8 @@ void Assembly::ComputeBoundingBox() {
|
||||
m_BBoxMin = Vector3f(inf, inf, inf);
|
||||
m_BBoxMax = Vector3f(-inf, -inf, -inf);
|
||||
|
||||
for (Object *obj : objects) {
|
||||
if (auto *box = dynamic_cast<ContainerBox *>(obj)) {
|
||||
for (const auto& obj : objects) {
|
||||
if (auto *box = dynamic_cast<ContainerBox *>(obj.get())) {
|
||||
// ContainerBox: wm is matrix from unit cube [0,1] to local space
|
||||
// Since it is parented to 'this', GetMatrix() is sufficient.
|
||||
Matrix4f m = box->GetMatrix();
|
||||
@@ -104,7 +104,7 @@ void Assembly::ComputeBoundingBox() {
|
||||
m_BBoxMax(a) = std::max(m_BBoxMax(a), corner(a));
|
||||
}
|
||||
}
|
||||
} else if (auto *cyl = dynamic_cast<Cylinder *>(obj)) {
|
||||
} else if (auto *cyl = dynamic_cast<Cylinder *>(obj.get())) {
|
||||
// Cylinder: centered [-1, 1] radial, [-0.5, 0.5] height
|
||||
Matrix4f m = cyl->GetMatrix();
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
@@ -117,7 +117,7 @@ void Assembly::ComputeBoundingBox() {
|
||||
m_BBoxMax(a) = std::max(m_BBoxMax(a), corner(a));
|
||||
}
|
||||
}
|
||||
} else if (auto *subAsm = dynamic_cast<Assembly *>(obj)) {
|
||||
} else if (auto *subAsm = dynamic_cast<Assembly *>(obj.get())) {
|
||||
// Recursive AABB for nested assemblies
|
||||
subAsm->ComputeBoundingBox();
|
||||
Vector3f subMin, subMax;
|
||||
|
||||
Reference in New Issue
Block a user