A implementation of a half edge triangle mesh. More...
#include <HalfEdgeMesh.hpp>
Public Types | |
typedef HalfEdgeFace< VertexT, NormalT > | HFace |
typedef HalfEdgeVertex < VertexT, NormalT > | HVertex |
typedef HalfEdge< HVertex, HFace > | HEdge |
Public Member Functions | |
HalfEdgeMesh () | |
Ctor. | |
virtual | ~HalfEdgeMesh () |
Dtor. | |
virtual void | addVertex (VertexT v) |
This method should be called every time a new vertex is created. | |
virtual void | addNormal (NormalT n) |
This method should be called every time a new vertex is created to ensure that vertex and normal buffer always have the same size. | |
virtual void | addTriangle (uint a, uint b, uint c) |
Insert a new triangle into the mesh. | |
virtual void | finalize () |
Finalizes a mesh, i.e. converts the template based buffers to OpenGL compatible buffers. | |
virtual void | save (string filename) |
Save the mesh to the given file. | |
Protected Attributes | |
bool | m_finalized |
True if mesh is finalized. | |
float * | m_vertexBuffer |
The mesh's vertex buffer. | |
float * | m_normalBuffer |
The vertex normals. | |
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. | |
Private Member Functions | |
void | printStats () |
HEdge * | halfEdgeToVertex (HVertex *v, HVertex *next) |
Returns an edge that point to the edge defined by the given vertices. | |
Private Attributes | |
vector< HalfEdgeFace< VertexT, NormalT > * > | m_faces |
The faces in the half edge mesh. | |
vector< HalfEdgeVertex < VertexT, NormalT > * > | m_vertices |
The vertices of the mesh. | |
int | m_globalIndex |
The indexed of the newest inserted vertex. |
A implementation of a half edge triangle mesh.
Definition at line 49 of file HalfEdgeMesh.hpp.
typedef HalfEdge<HVertex, HFace> lssr::HalfEdgeMesh< VertexT, NormalT >::HEdge |
Definition at line 54 of file HalfEdgeMesh.hpp.
typedef HalfEdgeFace<VertexT, NormalT> lssr::HalfEdgeMesh< VertexT, NormalT >::HFace |
Definition at line 52 of file HalfEdgeMesh.hpp.
typedef HalfEdgeVertex<VertexT, NormalT> lssr::HalfEdgeMesh< VertexT, NormalT >::HVertex |
Definition at line 53 of file HalfEdgeMesh.hpp.
lssr::HalfEdgeMesh< VertexT, NormalT >::HalfEdgeMesh | ( | ) |
Ctor.
virtual lssr::HalfEdgeMesh< VertexT, NormalT >::~HalfEdgeMesh | ( | ) | [inline, virtual] |
Dtor.
Definition at line 64 of file HalfEdgeMesh.hpp.
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::addNormal | ( | NormalT | n | ) | [virtual] |
This method should be called every time a new vertex is created to ensure that vertex and normal buffer always have the same size.
n | A supported vertex type. All used vertex types must support []-access. |
Implements lssr::BaseMesh< VertexT, NormalT >.
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::addTriangle | ( | uint | a, | |
uint | b, | |||
uint | c | |||
) | [virtual] |
Insert a new triangle into the mesh.
a | The first vertex of the triangle | |
b | The second vertex of the triangle | |
c | The third vertex of the triangle |
Implements lssr::BaseMesh< VertexT, NormalT >.
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::addVertex | ( | VertexT | v | ) | [virtual] |
This method should be called every time a new vertex is created.
v | A supported vertex type. All used vertex types must support []-access. |
Implements lssr::BaseMesh< VertexT, NormalT >.
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::finalize | ( | ) | [virtual] |
Finalizes a mesh, i.e. converts the template based buffers to OpenGL compatible buffers.
Implements lssr::BaseMesh< VertexT, NormalT >.
HEdge* lssr::HalfEdgeMesh< VertexT, NormalT >::halfEdgeToVertex | ( | HVertex * | v, | |
HVertex * | next | |||
) | [private] |
Returns an edge that point to the edge defined by the given vertices.
v | The start vertex of an edge | |
next | The end vertex of an edge |
void lssr::HalfEdgeMesh< VertexT, NormalT >::printStats | ( | ) | [private] |
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.
vector<HalfEdgeFace<VertexT, NormalT>*> lssr::HalfEdgeMesh< VertexT, NormalT >::m_faces [private] |
The faces in the half edge mesh.
Definition at line 104 of file HalfEdgeMesh.hpp.
bool lssr::BaseMesh< VertexT, NormalT >::m_finalized [protected, inherited] |
True if mesh is finalized.
Definition at line 66 of file BaseMesh.hpp.
int lssr::HalfEdgeMesh< VertexT, NormalT >::m_globalIndex [private] |
The indexed of the newest inserted vertex.
Definition at line 110 of file HalfEdgeMesh.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::BaseMesh< VertexT, NormalT >::m_normalBuffer [protected, inherited] |
The vertex normals.
Reimplemented in lssr::TriangleMesh< VertexT, NormalT >.
Definition at line 72 of file BaseMesh.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.
float* lssr::BaseMesh< VertexT, NormalT >::m_vertexBuffer [protected, inherited] |
The mesh's vertex buffer.
Definition at line 69 of file BaseMesh.hpp.
vector<HalfEdgeVertex<VertexT, NormalT>*> lssr::HalfEdgeMesh< VertexT, NormalT >::m_vertices [private] |
The vertices of the mesh.
Definition at line 107 of file HalfEdgeMesh.hpp.