52 m_vert[0].m_x=_center.m_x-(_width/2.0f); m_vert[0].m_y=_center.m_y+(_height/2.0f); m_vert[0].m_z=_center.m_z-(_depth/2.0f);
54 m_vert[1].m_x=_center.m_x+(_width/2.0f); m_vert[1].m_y=_center.m_y+(_height/2.0f); m_vert[1].m_z=_center.m_z-(_depth/2.0f);
55 m_vert[2].m_x=_center.m_x+(_width/2.0f); m_vert[2].m_y=_center.m_y+(_height/2.0f); m_vert[2].m_z=_center.m_z+(_depth/2.0f);
56 m_vert[3].m_x=_center.m_x-(_width/2.0f); m_vert[3].m_y=_center.m_y+(_height/2.0f); m_vert[3].m_z=_center.m_z+(_depth/2.0f);
57 m_vert[4].m_x=_center.m_x-(_width/2.0f); m_vert[4].m_y=_center.m_y-(_height/2.0f); m_vert[4].m_z=_center.m_z-(_depth/2.0f);
58 m_vert[5].m_x=_center.m_x+(_width/2.0f); m_vert[5].m_y=_center.m_y-(_height/2.0f); m_vert[5].m_z=_center.m_z-(_depth/2.0f);
59 m_vert[6].m_x=_center.m_x+(_width/2.0f); m_vert[6].m_y=_center.m_y-(_height/2.0f); m_vert[6].m_z=_center.m_z+(_depth/2.0f);
60 m_vert[7].m_x=_center.m_x-(_width/2.0f); m_vert[7].m_y=_center.m_y-(_height/2.0f); m_vert[7].m_z=_center.m_z+(_depth/2.0f);
65 m_norm[0].set(0.0
f,1.0
f,0.0
f);
66 m_norm[1].set(0.0
f,-1.0
f,0.0
f);
67 m_norm[2].set(1.0
f,0.0
f,0.0
f);
68 m_norm[3].set(-1.0
f,0.0
f,0.0
f);
69 m_norm[4].set(0.0
f,0.0
f,1.0
f);
70 m_norm[5].set(0.0
f,0.0
f,-1.0
f);
202 m_vao->setNumIndices(
sizeof(indices));
219 m_vao->setNumIndices(
sizeof(lindices));
constexpr GLubyte lindices[]
Vec3 m_center
This is the center of the BBox stored for caluculations in other classes s.
Real depth() const noexcept
Depth of the BBox.
Vec3 m_vert[8]
Contains the 8 vertices for the BBox aranged from v[0] = Left-top-Max Z and then rotating clock wise ...
static AbstractVAO * createVAO(const std::string &_type, GLenum _mode=GL_TRIANGLES)
Real m_maxX
the max x value of the bbox
void setDrawMode(GLenum _mode) noexcept
reset the draw mode for the BBox
#define GL_FRONT_AND_BACK
Real m_minZ
the min z value of the bbox
Real m_width
Width of the BBox.
~BBox() noexcept
dtor no dynamic memory so empty
Real m_height
Height of the BBox.
simple Vec3 encapsulates a 3 float object like glsl vec3 but not maths use the Vec3 class for maths a...
Real m_depth
Depth of the BBox.
implementation files for RibExport class
Real width() const noexcept
accessor for the width of the BBox
PRECISION Real
create a variable called Real which is the main data type we use (GLfloat for most cases) ...
GLuint GLuint GLsizei GLenum const void * indices
BBox() noexcept
Default constructor will create a BBox centered at point 0,0,0 With Unit length width and height (== ...
Real m_minX
the min x value of the bbox
void set(Real _x, Real _y, Real _z) noexcept
sets the Vec3 component from 3 values
Real m_maxY
the max y value of the bbox
std::unique_ptr< AbstractVAO > m_vao
a pointer to the VAO buffer used for drawing the bbox
Real height() const noexcept
Height of the BBox.
void recalculate() noexcept
recalculate the bbox values once things have been changed this will also re-do the VAO ...
GLuint m_drawMode
sets the draw mode for the BBox Faces, set to GL_LINE for line faces and GL_FILL for filled ...
Real m_maxZ
the max z value of the bbox
void draw() const noexcept
Draw Method draws the BBox using OpenGL.
GLAPI void GLAPIENTRY glPolygonMode(GLenum face, GLenum mode)
Simple Bounding box class used in various parts of ngl and other example programs.
a simple bounding box class
Real m_minY
the min y value of the bbox
void setVAO()
method used to set the vao
void setCenter(const Vec3 &_center, bool _recalc=true) noexcept
set the center of the BBox and re-calculate the extents
BBox & operator=(const BBox &_other)