Added: New BoundingBox infrastructure into mesh_material, analogous to mesh_frame.
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#define _TYRA_MESH_MATERIAL_
|
||||
|
||||
#include <tamtypes.h>
|
||||
#include "bounding_box.hpp"
|
||||
#include "./math/vector3.hpp"
|
||||
#include "./math/plane.hpp"
|
||||
|
||||
@@ -65,13 +66,20 @@ public:
|
||||
* Returns bounding box (AABB).
|
||||
* Total length: 8
|
||||
*/
|
||||
Vector3 *getBoundingBox() { return boundingBox; };
|
||||
//Vector3 *getBoundingBox() { return boundingBox; };
|
||||
Vector3 *getBoundingBox() { return boundingBoxObj->getVertices(); };
|
||||
|
||||
/**
|
||||
* Returns bounding box (AABB) vertex.
|
||||
* Total length: 8
|
||||
*/
|
||||
Vector3 &getBoundingBoxVertex(const u8 &i) { return boundingBox[i]; };
|
||||
//Vector3 &getBoundingBoxVertex(const u8 &i) { return boundingBox[i]; };
|
||||
Vector3 &getBoundingBoxVertex(const u8 &i) { return boundingBoxObj->getVertex(i); };
|
||||
|
||||
/**
|
||||
* Returns bounding box (AABB) object pointer.
|
||||
*/
|
||||
BoundingBox *getBoundingBoxP() { return boundingBoxObj; };
|
||||
|
||||
// ----
|
||||
// Setters
|
||||
@@ -120,6 +128,7 @@ public:
|
||||
|
||||
private:
|
||||
Vector3 boundingBox[8];
|
||||
BoundingBox *boundingBoxObj;
|
||||
u32 facesCount, id;
|
||||
u32 *vertexFaces, *stFaces, *normalFaces;
|
||||
u8 _isNameSet, _areFacesAllocated, _isBoundingBoxCalculated;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "../include/models/mesh_material.hpp"
|
||||
#include "../include/models/bounding_box.hpp"
|
||||
#include "../include/utils/debug.hpp"
|
||||
#include "../include/utils/string.hpp"
|
||||
#include <cstdlib>
|
||||
@@ -132,4 +133,5 @@ void MeshMaterial::calculateBoundingBox(Vector3 *t_vertices, u32 t_vertCount)
|
||||
boundingBox[6].set(hiX, hiY, lowZ);
|
||||
boundingBox[7].set(hiX, hiY, hiZ);
|
||||
_isBoundingBoxCalculated = true;
|
||||
boundingBoxObj = new BoundingBox(boundingBox);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user