NGL
6.5
The NCCA Graphics Library
|
an abstract base mesh used to build specific meshes such as Obj More...
#include <AbstractMesh.h>
Public Member Functions | |
virtual bool | load (const std::string &_fname, bool _calcBB=true) noexcept=0 |
Method to load the file in. More... | |
AbstractMesh () noexcept | |
default ctor must be called from the child class so our dtor is called More... | |
virtual | ~AbstractMesh () noexcept |
destructor this will clear out all the vert data and the vbo if created More... | |
void | drawBBox () const noexcept |
method to draw the bounding box More... | |
void | draw () const noexcept |
draw method to draw the obj as a VBO. The VBO first needs to be created using the CreateVBO method More... | |
void | loadTexture (const std::string &_fname) noexcept |
load int a texture and set it as the active texture of the Obj More... | |
void | scale (Real _sx, Real _sy, Real _sz) noexcept |
scale the obj by multiplying the actual vertex values by sx,sy and sz More... | |
void | calcDimensions () noexcept |
a method to set the BBox and center More... | |
void | calcBoundingSphere () noexcept |
a method to caluculate the bounding Sphere will set m_sphereCenter and m_sphereRadius More... | |
void | writeToRibSubdiv (RibExport &_ribFile) const noexcept |
virtual void | createVAO () noexcept |
unsigned int | getTextureID () const noexcept |
get the texture id More... | |
Real * | mapVAOVerts () noexcept |
map the VBO vertex data More... | |
void | unMapVAO () noexcept |
unmap the VBO based More... | |
const std::vector< IndexRef > & | getIndices () noexcept |
get a pointer to the indices used to represent the VBO data, this is used in the clip class when re-ordering the clip data values More... | |
void | saveNCCABinaryMesh (const std::string &_fname) noexcept |
save the mesh as NCCA Binary VBO format basically this format is the processed binary vbo mesh data as as packed by the CreateVBO() method is called. More... | |
BBox & | getBBox () noexcept |
a method to get the current bounding box of the mesh More... | |
std::vector< Vec3 > | getVertexList () noexcept |
accessor for the vertex data More... | |
Vec3 | getVertexAtIndex (uint32_t _i) const noexcept |
accessor for the vertex data More... | |
std::vector< Vec3 > | getNormalList () noexcept |
accessor for the normals data More... | |
std::vector< Vec3 > | getTextureCordList () noexcept |
accessor for the texture co-ordinates data More... | |
std::vector< Face > | getFaceList () noexcept |
accessor for the Face data More... | |
unsigned int | getNumVerts () const noexcept |
accessor to get the number of vertices in the object More... | |
unsigned int | getNumNormals () const noexcept |
accessor to get the number of normals in the object More... | |
unsigned int | getNumTexCords () const noexcept |
accessor to get the number of texture co-ordinates in the object More... | |
unsigned int | getNumFaces () const noexcept |
accessor to get the number of faces in the object More... | |
unsigned int | getMeshSize () const noexcept |
Vec3 | getSphereCenter () const noexcept |
accesor to get the bounding sphere center More... | |
Real | getSphereRadius () const noexcept |
accesor to get the bounding sphere center More... | |
Vec3 | getCenter () const noexcept |
accesor to get the center More... | |
bool | isTriangular () noexcept |
check to see if obj is triangulated as we only support tri or quad objs at the moment More... | |
Protected Attributes | |
unsigned int | m_nVerts |
The number of vertices in the object. More... | |
unsigned int | m_nNorm |
The number of normals in the object. More... | |
unsigned int | m_nTex |
the number of texture co-ordinates in the object More... | |
unsigned int | m_nFaces |
the number of faces in the object More... | |
std::vector< Vec3 > | m_verts |
Pointer to the Vertex list. More... | |
std::vector< Vec3 > | m_norm |
Pointer to the Normal List. More... | |
std::vector< Vec3 > | m_tex |
Pointer to the Texture co-ord list (note that only x and y are used) More... | |
std::vector< Face > | m_face |
Pointer to the Face list. More... | |
Vec3 | m_center |
Center of the object. More... | |
std::vector< IndexRef > | m_indices |
a vector of indices used to pass the index into the Data arrays to the VBO More... | |
std::vector< GLuint > | m_outIndices |
a vectr of indices without duplicates which are actually passed to the VBO when creating More... | |
size_t | m_indexSize |
the size of the index array More... | |
size_t | m_meshSize |
GLuint | m_vboBuffers |
buffers for the VBO in order Vert, Tex, Norm More... | |
std::unique_ptr< AbstractVAO > | m_vaoMesh |
id for our vertexArray object More... | |
bool | m_vbo |
flag to indicate if a VBO has been created More... | |
bool | m_vao |
flag to indicate if a VBO has been created More... | |
bool | m_vboMapped |
flag to indicate if the VBO vertex data has been mapped More... | |
bool | m_texture |
flag to indicate if texture assigned More... | |
GLuint | m_textureID |
The openGL id of the texture for the texture generation. More... | |
Real | m_maxX |
The Maximum X value in the obj file used to calculate the extents bbox. More... | |
Real | m_minX |
The Min X value in the obj file used to calculate the extents bbox. More... | |
Real | m_maxY |
The Max Y value in the obj file used to calculate the extents bbox. More... | |
Real | m_minY |
The Min Y value in the obj file used to calculate the extents bbox. More... | |
Real | m_maxZ |
The Max Z value in the obj file used to calculate the extents bbox. More... | |
Real | m_minZ |
The Min Z value in the obj file used to calculate the extents bbox. More... | |
std::unique_ptr< BBox > | m_ext |
Create a bounding box of the object to store it's extents. More... | |
GLuint | m_dataPackType |
determines if the data is Packed as either TRI or QUAD More... | |
unsigned int | m_bufferPackSize |
the size of the buffer pack we use this for the saving of bin vbo but it actually holds the size of the data (3 for just verts 5 verts norms etc) More... | |
GLenum | m_vboDrawType |
which type of VBO are we going to draw More... | |
bool | m_loaded |
flag to indicate if anything loaded for dtor More... | |
Vec3 | m_sphereCenter |
the center of the bounding sphere More... | |
Real | m_sphereRadius |
the radius of the bounding sphere More... | |
Friends | |
class | NCCAPointBake |
an abstract base mesh used to build specific meshes such as Obj
Definition at line 105 of file AbstractMesh.h.
|
inlinenoexcept |
default ctor must be called from the child class so our dtor is called
Definition at line 118 of file AbstractMesh.h.
|
virtualnoexcept |
destructor this will clear out all the vert data and the vbo if created
Definition at line 60 of file AbstractMesh.cpp.
References glDeleteBuffers, m_face, m_indices, m_loaded, m_norm, m_outIndices, m_tex, m_vbo, m_vboBuffers, and m_verts.
|
noexcept |
a method to caluculate the bounding Sphere will set m_sphereCenter and m_sphereRadius
modified from example in Rick Parent book Computer Animation Algorithms and Techniques Morgan Korfman Appendix B
Definition at line 501 of file AbstractMesh.cpp.
References m_sphereCenter, m_sphereRadius, m_verts, ngl::Vec3::m_x, ngl::Vec3::m_y, and ngl::Vec3::m_z.
|
noexcept |
a method to set the BBox and center
Definition at line 387 of file AbstractMesh.cpp.
References m_center, m_ext, m_maxX, m_maxY, m_maxZ, m_minX, m_minY, m_minZ, m_nVerts, m_verts, ngl::Vec3::m_x, ngl::Vec3::m_y, and ngl::Vec3::m_z.
|
virtualnoexcept |
Definition at line 214 of file AbstractMesh.cpp.
References ngl::VAOFactory::createVAO(), GL_FLOAT, GL_TRIANGLES, isTriangular(), m_dataPackType, m_face, m_meshSize, m_nFaces, m_nNorm, m_norm, m_nTex, m_tex, m_vao, m_vaoMesh, m_verts, ngl::VertData::nx, ngl::VertData::ny, ngl::VertData::nz, ngl::VertData::u, ngl::VertData::v, ngl::VertData::x, ngl::VertData::y, and ngl::VertData::z.
|
noexcept |
draw method to draw the obj as a VBO. The VBO first needs to be created using the CreateVBO method
Definition at line 336 of file AbstractMesh.cpp.
References GL_TEXTURE_2D, glBindTexture(), m_texture, m_textureID, m_vao, and m_vaoMesh.
|
noexcept |
|
inlinenoexcept |
a method to get the current bounding box of the mesh
Definition at line 195 of file AbstractMesh.h.
|
inlinenoexcept |
accesor to get the center
Definition at line 254 of file AbstractMesh.h.
|
inlinenoexcept |
accessor for the Face data
Definition at line 225 of file AbstractMesh.h.
|
inlinenoexcept |
get a pointer to the indices used to represent the VBO data, this is used in the clip class when re-ordering the clip data values
Definition at line 183 of file AbstractMesh.h.
|
inlinenoexcept |
Definition at line 242 of file AbstractMesh.h.
|
inlinenoexcept |
accessor for the normals data
Definition at line 215 of file AbstractMesh.h.
References ngl::Face::m_norm.
|
inlinenoexcept |
accessor to get the number of faces in the object
Definition at line 241 of file AbstractMesh.h.
|
inlinenoexcept |
accessor to get the number of normals in the object
Definition at line 233 of file AbstractMesh.h.
|
inlinenoexcept |
accessor to get the number of texture co-ordinates in the object
Definition at line 237 of file AbstractMesh.h.
|
inlinenoexcept |
accessor to get the number of vertices in the object
Definition at line 229 of file AbstractMesh.h.
|
inlinenoexcept |
accesor to get the bounding sphere center
Definition at line 246 of file AbstractMesh.h.
|
inlinenoexcept |
accesor to get the bounding sphere center
Definition at line 250 of file AbstractMesh.h.
|
inlinenoexcept |
accessor for the texture co-ordinates data
Definition at line 220 of file AbstractMesh.h.
References ngl::Face::m_tex.
|
inlinenoexcept |
accessor for the vertex data
Definition at line 205 of file AbstractMesh.h.
|
inlinenoexcept |
accessor for the vertex data
Definition at line 200 of file AbstractMesh.h.
|
noexcept |
check to see if obj is triangulated as we only support tri or quad objs at the moment
Definition at line 186 of file AbstractMesh.cpp.
References m_face.
|
pure virtualnoexcept |
Method to load the file in.
[in] | &_fname | the name of the obj file to load |
Implemented in ngl::HoudiniGeo, ngl::Obj, and ngl::NCCABinMesh.
|
noexcept |
load int a texture and set it as the active texture of the Obj
[in] | &_fname | the name of the file to load |
Definition at line 80 of file AbstractMesh.cpp.
References m_texture, m_textureID, and ngl::Texture::setTextureGL().
|
noexcept |
map the VBO vertex data
Definition at line 353 of file AbstractMesh.cpp.
References GL_ARRAY_BUFFER, GL_READ_WRITE, glBindBuffer, glMapBuffer, m_vaoMesh, and m_vboMapped.
|
noexcept |
save the mesh as NCCA Binary VBO format basically this format is the processed binary vbo mesh data as as packed by the CreateVBO() method is called.
The number of vertices in the object
The number of normals in the object
the number of texture co-ordinates in the object
the number of faces in the object
now we can dump the data from the vbo
Definition at line 431 of file AbstractMesh.cpp.
References m_bufferPackSize, m_center, m_dataPackType, m_indexSize, m_maxX, m_maxY, m_maxZ, m_minX, m_minY, m_minZ, m_nFaces, m_nNorm, m_nTex, m_nVerts, m_outIndices, m_texture, ngl::Vec3::m_x, ngl::Vec3::m_y, ngl::Vec3::m_z, mapVAOVerts(), and unMapVAO().
scale the obj by multiplying the actual vertex values by sx,sy and sz
[in] | _sx | the scale value in x |
[in] | _sy | the scale value in y |
[in] | _sz | the scale value in z |
Definition at line 41 of file AbstractMesh.cpp.
References calcDimensions(), m_center, m_nVerts, m_verts, and ngl::Vec3::m_x.
|
noexcept |
unmap the VBO based
Definition at line 375 of file AbstractMesh.cpp.
References GL_ARRAY_BUFFER, glUnmapBuffer, m_vaoMesh, and m_vboMapped.
method to write out the obj mesh to a renderman sub div
[in] | _ribFile | the instance of the RibExport class |
/// The following code is adapted from an MSc project by /// Authors: Elaine Kieran, Gavin Harrison, Luke Openshaw /// Write the obj as a SubdivisionMesh package to the rib file /// Renderman specification: SubdivisionMesh scheme nverts vertids tags nargs intargs floatargs parameterlist ///
Definition at line 98 of file AbstractMesh.cpp.
|
friend |
Definition at line 262 of file AbstractMesh.h.
|
protected |
the size of the buffer pack we use this for the saving of bin vbo but it actually holds the size of the data (3 for just verts 5 verts norms etc)
Definition at line 375 of file AbstractMesh.h.
|
protected |
Center of the object.
Definition at line 297 of file AbstractMesh.h.
|
protected |
determines if the data is Packed as either TRI or QUAD
Definition at line 370 of file AbstractMesh.h.
|
protected |
Create a bounding box of the object to store it's extents.
Definition at line 366 of file AbstractMesh.h.
|
protected |
Pointer to the Face list.
Definition at line 293 of file AbstractMesh.h.
|
protected |
the size of the index array
Definition at line 309 of file AbstractMesh.h.
|
protected |
a vector of indices used to pass the index into the Data arrays to the VBO
Definition at line 301 of file AbstractMesh.h.
|
protected |
flag to indicate if anything loaded for dtor
Definition at line 384 of file AbstractMesh.h.
|
protected |
The Maximum X value in the obj file used to calculate the extents bbox.
Definition at line 342 of file AbstractMesh.h.
|
protected |
The Max Y value in the obj file used to calculate the extents bbox.
Definition at line 350 of file AbstractMesh.h.
|
protected |
The Max Z value in the obj file used to calculate the extents bbox.
Definition at line 358 of file AbstractMesh.h.
|
protected |
Definition at line 310 of file AbstractMesh.h.
|
protected |
The Min X value in the obj file used to calculate the extents bbox.
Definition at line 346 of file AbstractMesh.h.
|
protected |
The Min Y value in the obj file used to calculate the extents bbox.
Definition at line 354 of file AbstractMesh.h.
|
protected |
The Min Z value in the obj file used to calculate the extents bbox.
Definition at line 362 of file AbstractMesh.h.
|
protected |
the number of faces in the object
Definition at line 277 of file AbstractMesh.h.
|
protected |
The number of normals in the object.
Definition at line 269 of file AbstractMesh.h.
|
protected |
Pointer to the Normal List.
Definition at line 285 of file AbstractMesh.h.
|
protected |
the number of texture co-ordinates in the object
Definition at line 273 of file AbstractMesh.h.
|
protected |
The number of vertices in the object.
Definition at line 265 of file AbstractMesh.h.
|
protected |
a vectr of indices without duplicates which are actually passed to the VBO when creating
Definition at line 305 of file AbstractMesh.h.
|
protected |
the center of the bounding sphere
Definition at line 388 of file AbstractMesh.h.
|
protected |
the radius of the bounding sphere
Definition at line 392 of file AbstractMesh.h.
|
protected |
Pointer to the Texture co-ord list (note that only x and y are used)
Definition at line 289 of file AbstractMesh.h.
|
protected |
flag to indicate if texture assigned
Definition at line 334 of file AbstractMesh.h.
|
protected |
The openGL id of the texture for the texture generation.
Definition at line 338 of file AbstractMesh.h.
|
protected |
flag to indicate if a VBO has been created
Definition at line 326 of file AbstractMesh.h.
|
protected |
id for our vertexArray object
Definition at line 318 of file AbstractMesh.h.
|
protected |
flag to indicate if a VBO has been created
Definition at line 322 of file AbstractMesh.h.
|
protected |
buffers for the VBO in order Vert, Tex, Norm
Definition at line 314 of file AbstractMesh.h.
|
protected |
which type of VBO are we going to draw
Definition at line 379 of file AbstractMesh.h.
|
protected |
flag to indicate if the VBO vertex data has been mapped
Definition at line 330 of file AbstractMesh.h.
|
protected |
Pointer to the Vertex list.
Definition at line 281 of file AbstractMesh.h.