NGL
6.5
The NCCA Graphics Library
|
Simple Bounding box class used in various parts of ngl and other example programs. More...
#include <BBox.h>
Public Member Functions | |
BBox (const Vec3 &_center, Real _width, Real _height, Real _depth) noexcept | |
Bounding Box ctor using a Center and the 3 dimensions of the BBox. More... | |
BBox (Real _minX, Real _maxX, Real _minY, Real _maxY, Real _minZ, Real _maxZ) noexcept | |
ctor using +/- x,y,z dimensions More... | |
BBox () noexcept | |
Default constructor will create a BBox centered at point 0,0,0 With Unit length width and height (== 1) More... | |
BBox (const BBox &_b) noexcept | |
copy ctor More... | |
BBox & | operator= (const BBox &_other) |
void | draw () const noexcept |
Draw Method draws the BBox using OpenGL. More... | |
void | setDrawMode (GLenum _mode) noexcept |
reset the draw mode for the BBox More... | |
~BBox () noexcept | |
dtor no dynamic memory so empty More... | |
Real | minX () const noexcept |
the min x value of the bbox More... | |
Real | maxX () const noexcept |
the max x value of the bbox More... | |
Real | minY () const noexcept |
the min y value of the bbox More... | |
Real | maxY () const noexcept |
the max y value of the bbox More... | |
Real | minZ () const noexcept |
the min z value of the bbox More... | |
Real | maxZ () const noexcept |
the max z value of the bbox More... | |
Vec3 | center () const noexcept |
This is the center of the BBox stored for caluculations in other classes s. More... | |
Real | width () const noexcept |
accessor for the width of the BBox More... | |
void | width (Real _w, bool _recalc=true) noexcept |
set the width More... | |
Real | height () const noexcept |
Height of the BBox. More... | |
void | height (Real _h, bool _recalc=true) noexcept |
set the height More... | |
Real | depth () const noexcept |
Depth of the BBox. More... | |
void | depth (Real _d, bool _recalc=true) noexcept |
set the depth More... | |
Vec3 * | getNormalArray () noexcept |
the array of normals for the BBox More... | |
Vec3 * | getVertexArray () noexcept |
the array of verts for the BBox More... | |
void | setCenter (const Vec3 &_center, bool _recalc=true) noexcept |
set the center of the BBox and re-calculate the extents More... | |
void | recalculate () noexcept |
recalculate the bbox values once things have been changed this will also re-do the VAO More... | |
Protected Member Functions | |
void | setVAO () |
method used to set the vao More... | |
Protected Attributes | |
Vec3 | m_vert [8] |
Contains the 8 vertices for the BBox aranged from v[0] = Left-top-Max Z and then rotating clock wise for the top of the BBox The Bottom Square is a mirror of the 1st verts with the Y value changed See constructor code for caluculations. More... | |
Real | m_minX |
the min x value of the bbox More... | |
Real | m_maxX |
the max x value of the bbox More... | |
Real | m_minY |
the min y value of the bbox More... | |
Real | m_maxY |
the max y value of the bbox More... | |
Real | m_minZ |
the min z value of the bbox More... | |
Real | m_maxZ |
the max z value of the bbox More... | |
Vec3 | m_center |
This is the center of the BBox stored for caluculations in other classes s. More... | |
Vec3 | m_norm [6] |
used to store the 6 Normal faces for the BBox used for calculating BBox collisions if needed More... | |
Real | m_width |
Width of the BBox. More... | |
Real | m_height |
Height of the BBox. More... | |
Real | m_depth |
Depth of the BBox. More... | |
std::unique_ptr< AbstractVAO > | m_vao |
a pointer to the VAO buffer used for drawing the bbox More... | |
GLuint | m_drawMode |
sets the draw mode for the BBox Faces, set to GL_LINE for line faces and GL_FILL for filled More... | |
Simple Bounding box class used in various parts of ngl and other example programs.
Bounding Box ctor using a Center and the 3 dimensions of the BBox.
[in] | _center | the center of the BBox. |
[in] | _width | the width of the BBox (== X coord). |
[in] | _height | the height of the BBox (== Y coord). |
[in] | _depth | the Depth of the BBox (== Z coord). |
Definition at line 46 of file BBox.cpp.
References GL_LINE, and GL_LINE_LOOP.
ctor using +/- x,y,z dimensions
[in] | _minX | the x position of the min x extent |
[in] | _maxX | the x position of the max x extent |
[in] | _minY | the y position of the min y extent |
[in] | _maxY | the y position of the max y extent |
[in] | _minZ | the z position of the min z extent |
[in] | _maxZ | the z position of the max z extent |
Definition at line 141 of file BBox.cpp.
References GL_LINE, GL_LINE_LOOP, m_center, m_depth, m_drawMode, m_height, m_maxX, m_maxY, m_maxZ, m_minX, m_minY, m_minZ, m_vao, m_vert, m_width, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, ngl::Vec3::set(), and setVAO().
|
noexcept |
Default constructor will create a BBox centered at point 0,0,0 With Unit length width and height (== 1)
Definition at line 88 of file BBox.cpp.
References GL_LINE, GL_LINE_LOOP, m_center, m_depth, m_drawMode, m_height, m_vao, m_width, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, and setVAO().
|
noexcept |
|
noexcept |
|
inlinenoexcept |
|
inlinenoexcept |
set the depth
[in] | _d | the depth to set will re-calculate bbox and VAO |
[in] | _recalc | flag to indicate if we need to recalc the vao defauts to true |
Definition at line 284 of file BBox.cpp.
References m_depth, and recalculate().
|
noexcept |
Draw Method draws the BBox using OpenGL.
Definition at line 229 of file BBox.cpp.
References GL_FILL, GL_FRONT_AND_BACK, glPolygonMode(), m_drawMode, and m_vao.
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
set the height
[in] | _h | the height to set will re-calculate bbox and VAO |
[in] | _recalc | flag to indicate if we need to recalc the vao defauts to true |
Definition at line 275 of file BBox.cpp.
References m_height, and recalculate().
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
noexcept |
recalculate the bbox values once things have been changed this will also re-do the VAO
Definition at line 293 of file BBox.cpp.
References m_center, m_depth, m_height, m_vert, m_width, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, and setVAO().
set the center of the BBox and re-calculate the extents
_center | the new center of the BBox |
Definition at line 245 of file BBox.cpp.
References m_center, m_depth, m_height, m_vert, m_width, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, and recalculate().
reset the draw mode for the BBox
[in] | _mode | the mode to draw |
Definition at line 177 of file BBox.cpp.
References m_drawMode, and setVAO().
|
protected |
method used to set the vao
Definition at line 183 of file BBox.cpp.
References ngl::VAOFactory::createVAO(), GL_FLOAT, GL_LINE, GL_LINE_LOOP, GL_STATIC_DRAW, GL_TRIANGLES, GL_UNSIGNED_BYTE, m_drawMode, m_vao, and m_vert.
|
inlinenoexcept |
set the width
[in] | _w | the width to set will re-calculate bbox and VAO |
[in] | _recalc | flag to indicate if we need to recalc the vao defauts to true |
Definition at line 266 of file BBox.cpp.
References m_width, and recalculate().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |