Public Types | Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes

lssr::HalfEdgeMesh< VertexT, NormalT > Class Template Reference

A implementation of a half edge triangle mesh. More...

#include <HalfEdgeMesh.hpp>

Inheritance diagram for lssr::HalfEdgeMesh< VertexT, NormalT >:
Inheritance graph
[legend]
Collaboration diagram for lssr::HalfEdgeMesh< VertexT, NormalT >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef HalfEdgeFace< VertexT,
NormalT > 
HFace
typedef HalfEdgeVertex
< VertexT, NormalT > 
HVertex
typedef HalfEdge< HVertex, HFaceHEdge

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 ()
HEdgehalfEdgeToVertex (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.

Detailed Description

template<typename VertexT, typename NormalT>
class lssr::HalfEdgeMesh< VertexT, NormalT >

A implementation of a half edge triangle mesh.

Definition at line 49 of file HalfEdgeMesh.hpp.


Member Typedef Documentation

template<typename VertexT , typename NormalT >
typedef HalfEdge<HVertex, HFace> lssr::HalfEdgeMesh< VertexT, NormalT >::HEdge

Definition at line 54 of file HalfEdgeMesh.hpp.

template<typename VertexT , typename NormalT >
typedef HalfEdgeFace<VertexT, NormalT> lssr::HalfEdgeMesh< VertexT, NormalT >::HFace

Definition at line 52 of file HalfEdgeMesh.hpp.

template<typename VertexT , typename NormalT >
typedef HalfEdgeVertex<VertexT, NormalT> lssr::HalfEdgeMesh< VertexT, NormalT >::HVertex

Definition at line 53 of file HalfEdgeMesh.hpp.


Constructor & Destructor Documentation

template<typename VertexT , typename NormalT >
lssr::HalfEdgeMesh< VertexT, NormalT >::HalfEdgeMesh (  ) 

Ctor.

template<typename VertexT , typename NormalT >
virtual lssr::HalfEdgeMesh< VertexT, NormalT >::~HalfEdgeMesh (  )  [inline, virtual]

Dtor.

Definition at line 64 of file HalfEdgeMesh.hpp.


Member Function Documentation

template<typename VertexT , typename NormalT >
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.

Parameters:
n A supported vertex type. All used vertex types must support []-access.

Implements lssr::BaseMesh< VertexT, NormalT >.

template<typename VertexT , typename NormalT >
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::addTriangle ( uint  a,
uint  b,
uint  c 
) [virtual]

Insert a new triangle into the mesh.

Parameters:
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 >.

template<typename VertexT , typename NormalT >
virtual void lssr::HalfEdgeMesh< VertexT, NormalT >::addVertex ( VertexT  v  )  [virtual]

This method should be called every time a new vertex is created.

Parameters:
v A supported vertex type. All used vertex types must support []-access.

Implements lssr::BaseMesh< VertexT, NormalT >.

template<typename VertexT , typename 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 >.

template<typename VertexT , typename 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.

Parameters:
v The start vertex of an edge
next The end vertex of an edge
Returns:
A pointer to an existing edge, or null if no suitable edge was found.
template<typename VertexT , typename NormalT >
void lssr::HalfEdgeMesh< VertexT, NormalT >::printStats (  )  [private]
template<typename VertexT, typename NormalT>
virtual void lssr::BaseMesh< VertexT, NormalT >::save ( string  filename  )  [virtual, inherited]

Save the mesh to the given file.


Member Data Documentation

template<typename VertexT, typename NormalT>
float* lssr::BaseMesh< VertexT, NormalT >::m_colorBuffer [protected, inherited]

The vertex colors.

Definition at line 75 of file BaseMesh.hpp.

template<typename VertexT , typename NormalT >
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.

template<typename VertexT, typename NormalT>
bool lssr::BaseMesh< VertexT, NormalT >::m_finalized [protected, inherited]

True if mesh is finalized.

Definition at line 66 of file BaseMesh.hpp.

template<typename VertexT , typename NormalT >
int lssr::HalfEdgeMesh< VertexT, NormalT >::m_globalIndex [private]

The indexed of the newest inserted vertex.

Definition at line 110 of file HalfEdgeMesh.hpp.

template<typename VertexT, typename NormalT>
uint* lssr::BaseMesh< VertexT, NormalT >::m_indexBuffer [protected, inherited]

The mesh's index buffer.

Definition at line 78 of file BaseMesh.hpp.

template<typename VertexT, typename NormalT>
uint lssr::BaseMesh< VertexT, NormalT >::m_nFaces [protected, inherited]

The number of face in the mesh.

Definition at line 84 of file BaseMesh.hpp.

template<typename VertexT, typename NormalT>
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.

template<typename VertexT, typename NormalT>
uint lssr::BaseMesh< VertexT, NormalT >::m_nVertices [protected, inherited]

The number of vertices in the mesh.

Definition at line 81 of file BaseMesh.hpp.

template<typename VertexT, typename NormalT>
float* lssr::BaseMesh< VertexT, NormalT >::m_vertexBuffer [protected, inherited]

The mesh's vertex buffer.

Definition at line 69 of file BaseMesh.hpp.

template<typename VertexT , typename NormalT >
vector<HalfEdgeVertex<VertexT, NormalT>*> lssr::HalfEdgeMesh< VertexT, NormalT >::m_vertices [private]

The vertices of the mesh.

Definition at line 107 of file HalfEdgeMesh.hpp.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Defines