Added: BoundingBoxFaces assignments, calculations and doxygen comments.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
*/
|
||||
struct BoundingBoxFace
|
||||
{
|
||||
BoundingBoxFace(Vector3 t_minCorner, Vector3 t_maxCorner, float t_axisPos)
|
||||
BoundingBoxFace(const Vector3 &t_minCorner, const Vector3 &t_maxCorner, float t_axisPos)
|
||||
{
|
||||
minCorner = t_minCorner;
|
||||
maxCorner = t_maxCorner;
|
||||
@@ -51,18 +51,34 @@ public:
|
||||
const float &getWidth() { return _width; };
|
||||
/** Return the vector directly in middle of the bounding box. */
|
||||
const Vector3 &getCenter() { return _centerVector; };
|
||||
/** Return the front face (furhter on z-axis) */
|
||||
/** Return the front face (further on z-axis) */
|
||||
const BoundingBoxFace &getFrontFace() { return _frontFace; };
|
||||
/** Return the back face (nearer on z-axis) */
|
||||
const BoundingBoxFace &getBackFace() { return _backFace; };
|
||||
/** Return the left face (further on x-axis) */
|
||||
const BoundingBoxFace &getLeftFace() { return _leftFace; };
|
||||
/** Return the right face (nearer on x-axis) */
|
||||
const BoundingBoxFace &getRightFace() { return _rightFace; };
|
||||
/** Return the top face (further on y-axis) */
|
||||
const BoundingBoxFace &getTopFace() { return _frontFace; };
|
||||
/** Return the bottom face (nearer on y-axis) */
|
||||
const BoundingBoxFace &getBottomFace() { return _bottomFace; };
|
||||
|
||||
private:
|
||||
Vector3 _vertices[8];
|
||||
float _height, _depth, _width;
|
||||
Vector3 _centerVector;
|
||||
/** Front face (further on z-axis) */
|
||||
BoundingBoxFace _frontFace;
|
||||
/** Back face (nearer on z-axis) */
|
||||
BoundingBoxFace _backFace;
|
||||
/** Left face (nearer on x-axis) */
|
||||
BoundingBoxFace _leftFace;
|
||||
/** Right face (further on x-axis) */
|
||||
BoundingBoxFace _rightFace;
|
||||
/** Top face (further on y-axis) */
|
||||
BoundingBoxFace _topFace;
|
||||
/** Bottom face (nearer on y-axis) */
|
||||
BoundingBoxFace _bottomFace;
|
||||
};
|
||||
|
||||
|
||||
@@ -30,4 +30,14 @@ BoundingBox::BoundingBox(Vector3 *t_vectorArray)
|
||||
_centerVector.x += (_width / 2);
|
||||
_centerVector.y += (_height / 2);
|
||||
_centerVector.z += (_depth / 2);
|
||||
|
||||
//Z-Axis faces
|
||||
_frontFace = BoundingBoxFace(_vertices[1], _vertices[7], _vertices[1].z);
|
||||
_backFace = BoundingBoxFace(_vertices[0], _vertices[6], _vertices[0].z);
|
||||
//X-Axis faces
|
||||
_leftFace = BoundingBoxFace(_vertices[0], _vertices[3], _vertices[0].x);
|
||||
_rightFace = BoundingBoxFace(_vertices[4], _vertices[7], _vertices[4].x);
|
||||
//Y-Axis faces
|
||||
_topFace = BoundingBoxFace(_vertices[2], _vertices[7], _vertices[2].y);
|
||||
_bottomFace = BoundingBoxFace(_vertices[0], _vertices[5], _vertices[0].y);
|
||||
}
|
||||
Reference in New Issue
Block a user