NGL  6.5
The NCCA Graphics Library
ngl::NCCABinMesh Class Reference

basically this class Loads the contents of the current VBO to file, this is basically the AbstractMesh packed Vert, Texture cord and Normal data Which are stored in contiguous blocks from the Parent Save method. this will then create a VBO which can be mapped and drawn etc. More...

#include <NCCABinMesh.h>

+ Inheritance diagram for ngl::NCCABinMesh:
+ Collaboration diagram for ngl::NCCABinMesh:

Public Member Functions

 NCCABinMesh () noexcept
 default constructor More...
 
 NCCABinMesh (const std::string &_fname) noexcept
 constructor to load an objfile as a parameter More...
 
 NCCABinMesh (const std::string &_fname, const std::string &_texName) noexcept
 constructor to load an objfile as a parameter More...
 
bool load (const std::string &_fname, bool _calcBB=true) noexcept
 Method to load the file in. More...
 
void save (const std::string &_fname) 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...
 
RealmapVAOVerts () 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...
 
BBoxgetBBox () noexcept
 a method to get the current bounding box of the mesh More...
 
std::vector< Vec3getVertexList () noexcept
 accessor for the vertex data More...
 
Vec3 getVertexAtIndex (uint32_t _i) const noexcept
 accessor for the vertex data More...
 
std::vector< Vec3getNormalList () noexcept
 accessor for the normals data More...
 
std::vector< Vec3getTextureCordList () noexcept
 accessor for the texture co-ordinates data More...
 
std::vector< FacegetFaceList () 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...
 

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< Vec3m_verts
 Pointer to the Vertex list. More...
 
std::vector< Vec3m_norm
 Pointer to the Normal List. More...
 
std::vector< Vec3m_tex
 Pointer to the Texture co-ord list (note that only x and y are used) More...
 
std::vector< Facem_face
 Pointer to the Face list. More...
 
Vec3 m_center
 Center of the object. More...
 
std::vector< IndexRefm_indices
 a vector of indices used to pass the index into the Data arrays to the VBO More...
 
std::vector< GLuintm_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< AbstractVAOm_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< BBoxm_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...
 

Detailed Description

basically this class Loads the contents of the current VBO to file, this is basically the AbstractMesh packed Vert, Texture cord and Normal data Which are stored in contiguous blocks from the Parent Save method. this will then create a VBO which can be mapped and drawn etc.

Author
Jonathan Macey
Version
1.0
Date
6/05/10 initial development

Definition at line 46 of file NCCABinMesh.h.

Constructor & Destructor Documentation

ngl::NCCABinMesh::NCCABinMesh ( )
inlinenoexcept

default constructor

Definition at line 54 of file NCCABinMesh.h.

ngl::NCCABinMesh::NCCABinMesh ( const std::string _fname)
noexcept

constructor to load an objfile as a parameter

Parameters
[in]&_fnamethe name of the obj file to load

Definition at line 117 of file NCCABinMesh.cpp.

ngl::NCCABinMesh::NCCABinMesh ( const std::string _fname,
const std::string _texName 
)
noexcept

constructor to load an objfile as a parameter

Parameters
[in]&_fnamethe name of the obj file to load
[in]&_texNamethe name of the texture file

Definition at line 126 of file NCCABinMesh.cpp.

Member Function Documentation

bool ngl::NCCABinMesh::load ( const std::string _fname,
bool  _calcBB = true 
)
virtualnoexcept

Method to load the file in.

Parameters
[in]_fnamethe name of the obj file to load

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 read how big the actual vbo data is

Implements ngl::AbstractMesh.

Definition at line 30 of file NCCABinMesh.cpp.

References GL_ARRAY_BUFFER, GL_DYNAMIC_DRAW, glBindBuffer, glBufferData, and glGenBuffers.

void ngl::NCCABinMesh::save ( const std::string _fname)
noexcept

method to save the obj

Parameters
[in]_fnamethe name of the file to save

Definition at line 138 of file NCCABinMesh.cpp.

References ngl::AbstractMesh::saveNCCABinaryMesh().

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: