An implementation of an indexed triangle mesh. More...
#include <TriangleMesh.hpp>
Public Member Functions | |
TriangleMesh () | |
Constructor. | |
TriangleMesh (const TriangleMesh &other) | |
Copy ctor. | |
virtual void | addTriangle (uint v0, uint v1, uint v2) |
Adds a triangle consisting of the given vertices (by by their index) into the mesh. | |
virtual void | addVertex (VertexT v) |
Adds a new vertex into the mesh. | |
virtual void | addNormal (NormalT n) |
Adds a new normal into the mesh. Vertices and normals should always by corresponding wrt. their indices. | |
virtual | ~TriangleMesh () |
Dtor. | |
VertexT | getVertex (uint index) |
Returns the vertex at the given index. | |
VertexT | getNormal (uint index) |
Returns the normal at the given index. | |
virtual void | finalize () |
Finalizes the mesh. | |
virtual void | save (string filename) |
Save the mesh to the given file. | |
Protected Attributes | |
float * | m_normalBuffer |
An interlaced buffer for vertex normals. | |
vector< VertexT > | m_normals |
The vertex normals. | |
vector< VertexT > | m_vertices |
The vertices. | |
list< uint > | m_triangles |
The index list. | |
bool | m_finalized |
True if mesh is finalized. | |
float * | m_vertexBuffer |
The mesh's vertex buffer. | |
float * | m_colorBuffer |
The vertex colors. | |
uint * | m_indexBuffer |
The mesh's index buffer. | |
uint | m_nVertices |
The number of vertices in the mesh. | |
uint | m_nFaces |
The number of face in the mesh. |
An implementation of an indexed triangle mesh.
Definition at line 25 of file TriangleMesh.hpp.
lssr::TriangleMesh< VertexT, NormalT >::TriangleMesh | ( | ) |
Constructor.
lssr::TriangleMesh< VertexT, NormalT >::TriangleMesh | ( | const TriangleMesh< VertexT, NormalT > & | other | ) |
Copy ctor.
virtual lssr::TriangleMesh< VertexT, NormalT >::~TriangleMesh | ( | ) | [virtual] |
Dtor.
virtual void lssr::TriangleMesh< VertexT, NormalT >::addNormal | ( | NormalT | n | ) | [inline, virtual] |
Adds a new normal into the mesh. Vertices and normals should always by corresponding wrt. their indices.
n | The new normal |
Implements lssr::BaseMesh< VertexT, NormalT >.
Definition at line 61 of file TriangleMesh.hpp.
virtual void lssr::TriangleMesh< VertexT, NormalT >::addTriangle | ( | uint | v0, | |
uint | v1, | |||
uint | v2 | |||
) | [virtual] |
Adds a triangle consisting of the given vertices (by by their index) into the mesh.
v0 | The first vertex index | |
v1 | The second vertex index | |
v2 | The third vertex index |
Implements lssr::BaseMesh< VertexT, NormalT >.
virtual void lssr::TriangleMesh< VertexT, NormalT >::addVertex | ( | VertexT | v | ) | [inline, virtual] |
Adds a new vertex into the mesh.
v | The new vertex |
Implements lssr::BaseMesh< VertexT, NormalT >.
Definition at line 53 of file TriangleMesh.hpp.
virtual void lssr::TriangleMesh< VertexT, NormalT >::finalize | ( | ) | [virtual] |
Finalizes the mesh.
Implements lssr::BaseMesh< VertexT, NormalT >.
VertexT lssr::TriangleMesh< VertexT, NormalT >::getNormal | ( | uint | index | ) |
Returns the normal at the given index.
VertexT lssr::TriangleMesh< VertexT, NormalT >::getVertex | ( | uint | index | ) |
Returns the vertex at the given index.
virtual void lssr::BaseMesh< VertexT, NormalT >::save | ( | string | filename | ) | [virtual, inherited] |
Save the mesh to the given file.
float* lssr::BaseMesh< VertexT, NormalT >::m_colorBuffer [protected, inherited] |
The vertex colors.
Definition at line 75 of file BaseMesh.hpp.
bool lssr::BaseMesh< VertexT, NormalT >::m_finalized [protected, inherited] |
True if mesh is finalized.
Definition at line 66 of file BaseMesh.hpp.
uint* lssr::BaseMesh< VertexT, NormalT >::m_indexBuffer [protected, inherited] |
The mesh's index buffer.
Definition at line 78 of file BaseMesh.hpp.
uint lssr::BaseMesh< VertexT, NormalT >::m_nFaces [protected, inherited] |
The number of face in the mesh.
Definition at line 84 of file BaseMesh.hpp.
float* lssr::TriangleMesh< VertexT, NormalT >::m_normalBuffer [protected] |
An interlaced buffer for vertex normals.
Reimplemented from lssr::BaseMesh< VertexT, NormalT >.
Definition at line 87 of file TriangleMesh.hpp.
vector<VertexT> lssr::TriangleMesh< VertexT, NormalT >::m_normals [protected] |
The vertex normals.
Definition at line 90 of file TriangleMesh.hpp.
uint lssr::BaseMesh< VertexT, NormalT >::m_nVertices [protected, inherited] |
The number of vertices in the mesh.
Definition at line 81 of file BaseMesh.hpp.
list<uint> lssr::TriangleMesh< VertexT, NormalT >::m_triangles [protected] |
The index list.
Definition at line 96 of file TriangleMesh.hpp.
float* lssr::BaseMesh< VertexT, NormalT >::m_vertexBuffer [protected, inherited] |
The mesh's vertex buffer.
Definition at line 69 of file BaseMesh.hpp.
vector<VertexT> lssr::TriangleMesh< VertexT, NormalT >::m_vertices [protected] |
The vertices.
Definition at line 93 of file TriangleMesh.hpp.