Added: Integrated new BoundingBox class implentation with mesh_frame boundingbox calculations.

This commit is contained in:
Foxar
2020-12-20 13:38:26 +01:00
parent 9b2d39505b
commit 53c134b0d5
2 changed files with 13 additions and 0 deletions
+10
View File
@@ -37,6 +37,7 @@ MeshFrame::~MeshFrame()
delete[] normals;
if (_areMaterialsAllocated)
delete[] materials;
delete boundingBoxObj;
}
// ----
@@ -121,6 +122,7 @@ void MeshFrame::calculateBoundingBoxes()
if (hiZ < vertices[i].z)
hiZ = vertices[i].z;
}
boundingBox[0].set(lowX, lowY, lowZ);
boundingBox[1].set(lowX, lowY, hiZ);
boundingBox[2].set(lowX, hiY, lowZ);
@@ -131,4 +133,12 @@ void MeshFrame::calculateBoundingBoxes()
boundingBox[6].set(hiX, hiY, lowZ);
boundingBox[7].set(hiX, hiY, hiZ);
_isBoundingBoxCalculated = true;
//Function temporarily is a hybrid between old Vector3[8] boundingbox and
//the new class implementation. Upon confirmation that new implementation
//works correctly, delete the old code.
//BoundingBox is declared on the heap to prevent any ill-formed default
//constructor instantiated BoundingBox objects.
boundingBoxObj = new BoundingBox(boundingBox);
}