Added: Integrated new BoundingBox class implentation with mesh_frame boundingbox calculations.
This commit is contained in:
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <tamtypes.h>
|
#include <tamtypes.h>
|
||||||
|
#include "bounding_box.hpp"
|
||||||
#include "math/point.hpp"
|
#include "math/point.hpp"
|
||||||
#include "math/vector3.hpp"
|
#include "math/vector3.hpp"
|
||||||
#include "./mesh_material.hpp"
|
#include "./mesh_material.hpp"
|
||||||
@@ -139,7 +140,9 @@ public:
|
|||||||
void calculateBoundingBoxes();
|
void calculateBoundingBoxes();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
/** Deprecated. It is advised to use BoundingBox class instead. */
|
||||||
Vector3 boundingBox[8];
|
Vector3 boundingBox[8];
|
||||||
|
BoundingBox *boundingBoxObj;
|
||||||
u8 _areSTsAllocated,
|
u8 _areSTsAllocated,
|
||||||
_areVerticesAllocated,
|
_areVerticesAllocated,
|
||||||
_areNormalsAllocated,
|
_areNormalsAllocated,
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ MeshFrame::~MeshFrame()
|
|||||||
delete[] normals;
|
delete[] normals;
|
||||||
if (_areMaterialsAllocated)
|
if (_areMaterialsAllocated)
|
||||||
delete[] materials;
|
delete[] materials;
|
||||||
|
delete boundingBoxObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----
|
// ----
|
||||||
@@ -121,6 +122,7 @@ void MeshFrame::calculateBoundingBoxes()
|
|||||||
if (hiZ < vertices[i].z)
|
if (hiZ < vertices[i].z)
|
||||||
hiZ = vertices[i].z;
|
hiZ = vertices[i].z;
|
||||||
}
|
}
|
||||||
|
|
||||||
boundingBox[0].set(lowX, lowY, lowZ);
|
boundingBox[0].set(lowX, lowY, lowZ);
|
||||||
boundingBox[1].set(lowX, lowY, hiZ);
|
boundingBox[1].set(lowX, lowY, hiZ);
|
||||||
boundingBox[2].set(lowX, hiY, lowZ);
|
boundingBox[2].set(lowX, hiY, lowZ);
|
||||||
@@ -131,4 +133,12 @@ void MeshFrame::calculateBoundingBoxes()
|
|||||||
boundingBox[6].set(hiX, hiY, lowZ);
|
boundingBox[6].set(hiX, hiY, lowZ);
|
||||||
boundingBox[7].set(hiX, hiY, hiZ);
|
boundingBox[7].set(hiX, hiY, hiZ);
|
||||||
_isBoundingBoxCalculated = true;
|
_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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user