NGL
6.5
The NCCA Graphics Library
|
used to load in an alias wave front obj format file and draw using open gl has been completly re-written to use boost::spirit parser, most of this code is a modified version of the OBJReader class from the cortex-vfx lib framework here http://code.google.com/p/cortex-vfx/ More...
#include <Obj.h>
Public Member Functions | |
Obj () noexcept | |
default constructor More... | |
Obj (const std::string &_fname, bool _calcBB=true) noexcept | |
constructor to load an objfile as a parameter More... | |
Obj (const std::string &_fname, const std::string &_texName, bool _calcBB=true) noexcept | |
constructor to load an objfile as a parameter More... | |
Obj (const char *_fname, const char *_texName, bool _calcBB=true) noexcept | |
bool | load (const std::string &_fname, bool _calcBB=true) noexcept |
Method to load the file in. More... | |
void | save (const std::string &_fname) const noexcept |
method to save the obj More... | |
Public Member Functions inherited from ngl::AbstractMesh | |
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 Member Functions | |
virtual void | parseVertex (const char *_begin) noexcept |
parser function to parse the vertex used by boost::spirit parser More... | |
virtual void | parseNormal (const char *_begin) noexcept |
parser function to parse the Norma used by boost::spirit parser More... | |
virtual void | parseTextureCoordinate (const char *_begin) noexcept |
parser function to parse the text cord used by boost::spirit parser More... | |
virtual void | parseFace (const char *_begin) noexcept |
parser function to parse the Face data used by boost::spirit parser More... | |
Additional Inherited Members | |
Protected Attributes inherited from ngl::AbstractMesh | |
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... | |
used to load in an alias wave front obj format file and draw using open gl has been completly re-written to use boost::spirit parser, most of this code is a modified version of the OBJReader class from the cortex-vfx lib framework here http://code.google.com/p/cortex-vfx/
|
explicitnoexcept |
|
explicitnoexcept |
|
explicitnoexcept |
|
virtualnoexcept |
Method to load the file in.
[in] | _fname | the name of the obj file to load |
[in] | _calcBB | if we only want to load data and not use GL then set this to false |
our tex rule and binding of the parse function
Implements ngl::AbstractMesh.
Definition at line 177 of file Obj.cpp.
References parseFace(), parseNormal(), parseTextureCoordinate(), and parseVertex().
|
protectedvirtualnoexcept |
parser function to parse the Face data used by boost::spirit parser
[in] | _begin | the start of the string to parse |
Definition at line 94 of file Obj.cpp.
References ngl::Face::m_norm, ngl::Face::m_normals, ngl::Face::m_numVerts, ngl::Face::m_tex, ngl::Face::m_textureCoord, and ngl::Face::m_vert.
|
protectedvirtualnoexcept |
parser function to parse the Norma used by boost::spirit parser
[in] | _begin | the start of the string to parse |
Definition at line 78 of file Obj.cpp.
References NGL_UNUSED.
|
protectedvirtualnoexcept |
parser function to parse the text cord used by boost::spirit parser
[in] | _begin | the start of the string to parse |
Definition at line 58 of file Obj.cpp.
References NGL_UNUSED.
|
protectedvirtualnoexcept |
parser function to parse the vertex used by boost::spirit parser
[in] | _begin | the start of the string to parse |
Definition at line 40 of file Obj.cpp.
References NGL_UNUSED.
|
noexcept |