refactor: apply review changes
This commit is contained in:
@@ -42,20 +42,19 @@ class BBox : public CoreBBox {
|
|||||||
const BBoxFace& getBottomFace() { return _bottomFace; }
|
const BBoxFace& getBottomFace() { return _bottomFace; }
|
||||||
|
|
||||||
/** @returns the lower (x, y, z) boundary of the box. */
|
/** @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. */
|
/** @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_min Vec4 to store the min result
|
||||||
* @param res_max 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
|
* @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:
|
protected:
|
||||||
float _height, _depth, _width;
|
float _height, _depth, _width;
|
||||||
Vec4 _centerVector, _min;
|
Vec4 _centerVector;
|
||||||
/** Front face (further on z-axis) */
|
/** Front face (further on z-axis) */
|
||||||
BBoxFace _frontFace;
|
BBoxFace _frontFace;
|
||||||
/** Back face (nearer on z-axis) */
|
/** Back face (nearer on z-axis) */
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ void BBox::setData() {
|
|||||||
_bottomFace = BBoxFace(_vertices[0], _vertices[5], _vertices[0].y);
|
_bottomFace = BBoxFace(_vertices[0], _vertices[5], _vertices[0].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vec4 BBox::min() {
|
Vec4 BBox::min() {
|
||||||
Vec4 temp, _min;
|
Vec4 temp, _min;
|
||||||
u8 isInitialized = 0;
|
u8 isInitialized = 0;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ const Vec4 BBox::min() {
|
|||||||
return _min;
|
return _min;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vec4 BBox::max() {
|
Vec4 BBox::max() {
|
||||||
Vec4 temp, _max;
|
Vec4 temp, _max;
|
||||||
u8 isInitialized = 0;
|
u8 isInitialized = 0;
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ const Vec4 BBox::max() {
|
|||||||
return _max;
|
return _max;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BBox::calcMinMax(Vec4& res_min, Vec4& res_max) {
|
void BBox::getMinMax(Vec4* res_min, Vec4* res_max) {
|
||||||
Vec4 temp = Vec4();
|
Vec4 temp = Vec4();
|
||||||
|
|
||||||
u8 isInitialized = 0;
|
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);
|
temp.set(vertices[i].x, vertices[i].y, vertices[i].z, 1.0F);
|
||||||
if (isInitialized == 0) {
|
if (isInitialized == 0) {
|
||||||
isInitialized = 1;
|
isInitialized = 1;
|
||||||
res_min.set(temp);
|
res_min->set(temp);
|
||||||
res_max.set(temp);
|
res_max->set(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res_min.x > temp.x) res_min.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 (temp.x > res_max->x) res_max->x = temp.x;
|
||||||
|
|
||||||
if (res_min.y > temp.y) res_min.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 (temp.y > res_max->y) res_max->y = temp.y;
|
||||||
|
|
||||||
if (res_min.z > temp.z) res_min.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;
|
if (temp.z > res_max->z) res_max->z = temp.z;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user