diff --git a/engine/inc/renderer/3d/bbox/bbox.hpp b/engine/inc/renderer/3d/bbox/bbox.hpp index 06feaeb..57777d1 100644 --- a/engine/inc/renderer/3d/bbox/bbox.hpp +++ b/engine/inc/renderer/3d/bbox/bbox.hpp @@ -42,20 +42,19 @@ class BBox : public CoreBBox { const BBoxFace& getBottomFace() { return _bottomFace; } /** @returns the lower (x, y, z) boundary of the box. */ - const Vec4 min(); + Vec4 min(); /** @returns the upper (x, y, z) boundary of the box. */ - const Vec4 max(); + Vec4 max(); /** - * @returns void; * @param res_min Vec4 to store the min result * @param res_max Vec4 to store the min result * @brief Calc and stores the min and max points of box at a single loop * */ - void calcMinMax(Vec4& res_min, Vec4& res_max); + void getMinMax(Vec4* res_min, Vec4* res_max); protected: float _height, _depth, _width; - Vec4 _centerVector, _min; + Vec4 _centerVector; /** Front face (further on z-axis) */ BBoxFace _frontFace; /** Back face (nearer on z-axis) */ diff --git a/engine/src/renderer/3d/bbox/bbox.cpp b/engine/src/renderer/3d/bbox/bbox.cpp index 07a0219..db8b4ad 100644 --- a/engine/src/renderer/3d/bbox/bbox.cpp +++ b/engine/src/renderer/3d/bbox/bbox.cpp @@ -50,7 +50,7 @@ void BBox::setData() { _bottomFace = BBoxFace(_vertices[0], _vertices[5], _vertices[0].y); } -const Vec4 BBox::min() { +Vec4 BBox::min() { Vec4 temp, _min; u8 isInitialized = 0; @@ -70,7 +70,7 @@ const Vec4 BBox::min() { return _min; } -const Vec4 BBox::max() { +Vec4 BBox::max() { Vec4 temp, _max; u8 isInitialized = 0; @@ -90,7 +90,7 @@ const Vec4 BBox::max() { return _max; } -void BBox::calcMinMax(Vec4& res_min, Vec4& res_max) { +void BBox::getMinMax(Vec4* res_min, Vec4* res_max) { Vec4 temp = Vec4(); u8 isInitialized = 0; @@ -99,18 +99,18 @@ void BBox::calcMinMax(Vec4& res_min, Vec4& res_max) { temp.set(vertices[i].x, vertices[i].y, vertices[i].z, 1.0F); if (isInitialized == 0) { isInitialized = 1; - res_min.set(temp); - res_max.set(temp); + res_min->set(temp); + res_max->set(temp); } - if (res_min.x > temp.x) res_min.x = temp.x; - if (temp.x > res_max.x) res_max.x = temp.x; + if (res_min->x > temp.x) res_min->x = temp.x; + if (temp.x > res_max->x) res_max->x = temp.x; - if (res_min.y > temp.y) res_min.y = temp.y; - if (temp.y > res_max.y) res_max.y = temp.y; + if (res_min->y > temp.y) res_min->y = temp.y; + if (temp.y > res_max->y) res_max->y = temp.y; - if (res_min.z > temp.z) res_min.z = temp.z; - if (temp.z > res_max.z) res_max.z = temp.z; + if (res_min->z > temp.z) res_min->z = temp.z; + if (temp.z > res_max->z) res_max->z = temp.z; } }