Developer Documentation

Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
ACG::DrawMeshT< Mesh > Class Template Reference

Mesh Drawing Class. More...

`#include <OpenFlipper/libs_required/ACG/GL/DrawMesh.hh>`

Inheritance diagram for ACG::DrawMeshT< Mesh >:

## Classes
struct | Subset
struct | VertexProperty

## Public Types
enum | PropertySource { PROPERTY_SOURCE_VERTEX = 0, PROPERTY_SOURCE_HALFEDGE, PROPERTY_SOURCE_FACE }

## Public Member Functions
| DrawMeshT (Mesh &_mesh)
void | disableColors ()
void | usePerVertexColors ()
void | usePerFaceColors ()
void | setFlatShading ()
void | setSmoothShading ()
void | usePerVertexTexcoords ()
void | usePerHalfedgeTexcoords ()
void | usePerVertexNormals ()
void | usePerHalfedgeNormals ()
void | bindBuffers ()
| eventually rebuilds buffers used for rendering and binds index and vertex buffer
GLuint | getVBO ()
| get opengl vertex buffer id
GLuint | getIBO ()
| get opengl index buffer id
GLuint | getHEVBO ()
| getHEVBO get VBO which stores Halfedges with offset More...
VertexDeclaration * | getVertexDeclaration ()
| get vertex declaration of the current vbo layout
unsigned int | mapVertexToVBOIndex (unsigned int _v)
| map from vertex index of the original mesh point buffer to the corresponding vertex index inside the VBO. More...
void | bindBuffersToRenderObject (RenderObject *_obj)
| eventually rebuilds buffers used for rendering and binds index and vertex buffer
void | unbindBuffers ()
| disables vertex, normal, texcoord and color pointers in OpenGL
void | draw (std::map< int, GLuint > *_textureMap, bool _nonindexed=false)
| binds index and vertex buffer and executes draw calls More...
void | addTriRenderObjects (IRenderer *_renderer, const RenderObject *_baseObj, std::map< int, GLuint > *_textureMap, bool _nonindexed=false)
| adds RenderObjects to a deferred draw call renderer More...
void | drawLines ()
| render the mesh in wireframe mode
void | addLineRenderObjects (IRenderer *_renderer, const RenderObject *_baseObj)
| render the mesh in wireframe mode, deferred draw call
void | drawVertices ()
| render vertices only
void | addPointRenderObjects (IRenderer *_renderer, const RenderObject *_baseObj)
| render vertices only, deferred draw call
unsigned int | getMemoryUsage (bool _printReport=false)
| measures the size in bytes of allocated memory. eventually prints a report to std::cout
void | updateTopology ()
| request an update for the mesh topology
void | updateGeometry ()
| request an update for the mesh vertices
void | updateTextures ()
| request an update for the textures
void | updateFull ()
| request a full rebuild of the mesh More...
unsigned int | getNumTextures ()
| returns the number of used textured of this mesh More...
void | setTextureIndexPropertyName (std::string _indexPropertyName)
| set the name of the property used for texture index specification More...
const std::string & | getTextureIndexPropertyName () const
| get the name of the texture index property More...
void | setPerFaceTextureCoordinatePropertyName (std::string _perFaceTextureCoordinatePropertyName)
| set the name of the property used for texture coordinate More...
int | perFaceTextureCoordinateAvailable ()
| Check if per Face Texture coordinates are available. More...
int | perFaceTextureIndexAvailable ()
| Check if texture indices are available. More...
void | addVertexElement (const std::string &_propertyName, PropertySource _source=PROPERTY_SOURCE_VERTEX)
| Add custom elements to the vertex layout. More...
bool | scanVertexShaderForInput (const std::string &_vertexShaderFile)
| Scan vertex layout from vertex shader. More...
void | updatePickingVertices (ACG::GLState &_state, uint _offset=0)
ACG::Vec4uc * | pickVertexColorBuffer ()
| get a pointer to the per vertex picking color buffer More...
ACG::Vec3f * | pickVertexBuffer ()
| get a pointer to the per vertex picking vertex buffer More...
void | drawPickingVertices_opt (const GLMatrixf &_mvp, size_t _pickOffset)
| Optimized rendering of vertex picking ids with a shader. More...
bool | supportsPickingVertices_opt ()
| Check if optimized vertex picking is supported. More...
void | updatePickingVertices_opt (ACG::GLState &_state)
| Update color picking array for the shader implementation. More...
TextureBuffer * | pickVertexMap_opt ()
void | updatePickingEdges (ACG::GLState &_state, uint _offset=0)
| Update color picking array for edges. More...
ACG::Vec4uc * | pickEdgeColorBuffer ()
| get a pointer to the per edge picking color buffer More...
void | drawPickingEdges_opt (const GLMatrixf &_mvp, size_t _pickOffset)
| Optimized rendering of edge picking ids with a shader. More...
bool | supportsPickingEdges_opt ()
| Check if optimized face picking is supported. More...
void | updatePickingEdges_opt (ACG::GLState &_state)
| Update color picking array for the shader implementation. More...
void | updatePickingFaces (ACG::GLState &_state)
| Update color picking array for faces. More...
ACG::Vec4uc * | pickFaceColorBuffer ()
| get a pointer to the per face picking color buffer More...
ACG::Vec3f * | pickFaceVertexBuffer ()
| get a pointer to the per vertex picking color buffer More...
void | drawPickingFaces_opt (const GLMatrixf &_mvp, size_t _pickOffset)
| Optimized rendering of face picking ids with a shader. More...
bool | supportsPickingFaces_opt ()
| Check if optimized face picking is supported. More...
void | updatePickingFaces_opt (ACG::GLState &_state)
| Update color picking array for the shader implementation. More...
TextureBuffer * | pickFaceTriangleMap_opt ()
void | updatePickingAny (ACG::GLState &_state)
| Call this function to update the color picking array. More...
ACG::Vec4uc * | pickAnyFaceColorBuffer ()
| get a pointer to the any picking color buffer More...
ACG::Vec4uc * | pickAnyEdgeColorBuffer ()
| get a pointer to the any picking color buffer More...
ACG::Vec4uc * | pickAnyVertexColorBuffer ()
| get a pointer to the any picking color buffer More...
void | drawPickingAny_opt (const GLMatrixf &_mvp, size_t _pickOffset)
| Optimized rendering of any picking ids with a shader. More...
bool | supportsPickingAny_opt ()
| Check if optimized any picking is supported. More...
void | updatePickingAny_opt (ACG::GLState &_state)
| Update color picking array for the shader implementation. More...
void | dumpObj (const char *_filename) const
| dump current vertex/index buffer to wavefront obj More...
void | invalidateFullVBO ()
| the mesh has been changed More...
void | updateFullVBO ()
| update the full mesh vbo More...
void | invalidatePerEdgeBuffers ()
| Update of the buffers. More...
void | updatePerEdgeBuffers ()
| Update all per edge drawing buffers. More...
ACG::Vec3f * | perEdgeVertexBuffer ()
| get a pointer to the per edge vertex buffer More...
ACG::Vec4f * | perEdgeColorBuffer ()
| get a pointer to the per edge color buffer More...
void | invalidatePerHalfedgeBuffers ()
| Update of the buffers. More...
template<typename Mesh::Normal(DrawMeshT::*)(typename Mesh::FaceHandle) NormalLookup>
void | updatePerHalfedgeBuffers ()
| Update all per edge drawing buffer n The updated buffers are: per edge vertex buffer ( 2 vertices per edge )
ACG::Vec3f * | perHalfedgeVertexBuffer ()
| get a pointer to the per edge vertex buffer More...
ACG::Vec4f * | perHalfedgeColorBuffer ()
| get a pointer to the per edge color buffer More...
void | updateEdgeHalfedgeVertexDeclarations ()
| updates per edge and halfedge vertex declarations
const VertexDeclaration * | getEdgeColoredVertexDeclaration () const
| getter for vertex declarations
const VertexDeclaration * | getHalfedgeVertexDeclaration () const
| getter for vertex declarations
const VertexDeclaration * | getHalfedgeColoredVertexDeclaration () const
| getter for vertex declarations
Public Member Functions inherited from ACG::DrawMeshBase
size_t | getNumTris () const
size_t | getNumVerts () const
MeshCompiler * | getMeshCompiler ()
| get mesh compiler used to create the draw mesh
unsigned int | getNumSubsets () const
GLenum | getIndexType () const
| get index type of index buffer
GLuint | pickVertexIBO_opt ()
| get an index buffer mapping from openmesh vertices to drawmesh vbo vertices More...

## Private Types
enum | REBUILD_TYPE { REBUILD_NONE = 0, REBUILD_FULL = 1, REBUILD_GEOMETRY = 2, REBUILD_TOPOLOGY = 4, REBUILD_TEXTURES = 8 }

## Private Member Functions
void | rebuild ()
| draw_mesh updater More...
void | readVertex (size_t _vertex, const typename Mesh::VertexHandle &_vh, const typename Mesh::HalfedgeHandle &_hh, const typename Mesh::FaceHandle &_fh)
| reads a vertex from mesh_ and write it to vertex buffer More...
unsigned int | getVertexColor (const typename Mesh::VertexHandle &_vh)
| return a vertex color from mesh More...
unsigned int | getFaceColor (const typename Mesh::FaceHandle &_fh)
| return a face color from mesh More...
void | updateGPUBuffers ()
| eventually update vertex and index buffers More...
void | createVBO ()
| stores the vertex buffer on the gpu More...
void | createIBO ()
| stores the index buffer on the gpu More...
void | createVertexDeclaration ()
| creates all vertex declarations needed for deferred draw call renderer More...
unsigned int | countTris (unsigned int *_pOutMaxPolyVerts=0, unsigned int *_pOutNumIndices=0)
| Number of triangles after triangulation of the mesh. More...
int | getTextureIDofTri (unsigned int _tri)
| get the texture index of a triangle More...
int | getTextureIDofFace (unsigned int _face)
| get the texture index of a face More...
const void * | getMeshPropertyType (OpenMesh::BaseProperty *_prop, GLuint *_outType, unsigned int *_outSize) const
| get the data type of a mesh property More...
template<class T >
const void * | testMeshPropertyTypeT (const OpenMesh::BaseProperty *_prop, unsigned int *_outSize) const
| test mesh property for type T More...
void | writeVertexElement (void *_dstBuf, size_t _vertex, size_t _stride, size_t _elementOffset, size_t _elementSize, const void *_elementData)
void | writePosition (size_t _vertex, const ACG::Vec3d &_p)
void | writeNormal (size_t _vertex, const ACG::Vec3d &_n)
void | writeTexcoord (size_t _vertex, const ACG::Vec2f &_uv)
void | writeColor (size_t _vertex, unsigned int _color)
void | writeVertexProperty (size_t _vertex, const VertexElement *_elementDesc, const ACG::Vec4f &_propf)
void | writeVertexProperty (size_t _vertex, const VertexElement *_elementDesc, const ACG::Vec4d &_propd)
void | readVertexFromVBO (unsigned int _vertex, void *_dst)
| Read one vertex from the rendering vbo. More...
template<typename Mesh::Normal(DrawMeshT::*)(typename Mesh::FaceHandle) NormalLookup>
Mesh::Point | halfedge_point (const typename Mesh::HalfedgeHandle _heh)
| compute halfedge point compute visualization point for halfedge (shifted to interior of face) More...
Mesh::Normal | cachedNormalLookup (typename Mesh::FaceHandle fh)
Mesh::Normal | computedTriMeshNormal (typename Mesh::FaceHandle fh)
Mesh::Normal | computedNormal (typename Mesh::FaceHandle fh)
Mesh::HalfedgeHandle | mapToHalfedgeHandle (size_t _vertexId)

## Private Attributes
std::vector< ACG::Vec3f > | pickVertBuf_
| The vertex buffer used for vertex picking.
std::vector< ACG::Vec4uc > | pickVertColBuf_
| The color buffer used for vertex picking.
TextureBuffer | pickVertexMapTBO_
GLSL::Program * | pickVertexShader_
int | pickVertexMethod_
std::vector< ACG::Vec4uc > | pickEdgeBuf_
GLSL::Program * | pickEdgeShader_
std::vector< ACG::Vec3f > | pickFaceVertexBuf_
std::vector< ACG::Vec4uc > | pickFaceColBuf_
TextureBuffer | pickFaceTriToFaceMapTBO_
GLSL::Program * | pickFaceShader_
| optimized face picking shader
std::vector< ACG::Vec4uc > | pickAnyFaceColBuf_
std::vector< ACG::Vec4uc > | pickAnyEdgeColBuf_
std::vector< ACG::Vec4uc > | pickAnyVertexColBuf_
Mesh & | mesh_
| OpenMesh object to be rendered.
unsigned int * | indices_
| final index buffer used for rendering
unsigned int | rebuild_
| hint on what to rebuild
size_t | prevNumFaces_
size_t | prevNumVerts_
int | colorMode_
| Color Mode: 0: none, 1: per vertex, else: per face.
int | curVBOColorMode_
| Color Mode of vbo.
int | flatMode_
| flat / smooth shade mode toggle
int | bVBOinFlatMode_
| normals in VBO currently in flat / smooth mode
int | textureMode_
| per vertex / halfedge texture mode toggle: 0: per vertex, 1: per halfedge
int | bVBOinHalfedgeTexMode_
| texcoords in VBO currently in per vertex / halfedge mode toggle
int | halfedgeNormalMode_
| per vertex / halfedge normals mode toggle: 0: per vertex, 1: per halfedge
int | bVBOinHalfedgeNormalMode_
| normals in VBO currently in per vertex / halfedge mode toggle
unsigned int * | invVertexMap_
const size_t | offsetPos_
| fixed vertex elements:
const size_t | offsetNormal_
const size_t | offsetTexc_
const size_t | offsetColor_
std::vector< VertexProperty > | additionalElements_
| additional optional elements
std::string | textureIndexPropertyName_
| Property for the per face texture index. More...
std::string | perFaceTextureCoordinatePropertyName_
| Property for the per face texture coordinates. More...
GeometryBuffer | vboFull_
bool | updateFullVBO_
int | updatePerEdgeBuffers_
std::vector< ACG::Vec3f > | perEdgeVertexBuf_
std::vector< ACG::Vec4f > | perEdgeColorBuf_
int | updatePerHalfedgeBuffers_
std::vector< ACG::Vec3f > | perHalfedgeVertexBuf_
std::vector< ACG::Vec4f > | perHalfedgeColorBuf_

## Additional Inherited Members
Protected Member Functions inherited from ACG::DrawMeshBase
void | deleteIbo ()
void | bindVbo ()
void | bindIbo ()
void | bindLineIbo ()
void | bindHEVbo ()
void | unbindHEVbo ()
void | bindPickVertexIbo ()
void | createIndexBuffer ()
void | fillLineBuffer (size_t n_edges, void *data)
void | fillHEVBO (size_t numberOfElements_, size_t sizeOfElements_, void *data_)
void | fillVertexBuffer ()
void | fillInvVertexMap (size_t n_vertices, void *data)
Protected Attributes inherited from ACG::DrawMeshBase
GLuint | vbo_
GLuint | ibo_
size_t | numTris_
size_t | numVerts_
MeshCompiler * | meshComp_
GLuint | lineIBO_
| index buffer used in Wireframe / Hiddenline mode
GLuint | heVBO_
| vbo for halfedge rendering, as they are offset
GLint | prevVBO_
GLenum | indexType_
| support for 2 and 4 byte unsigned integers
std::vector< char > | vertices_
VertexDeclaration * | vertexDecl_
| vertex buffer layout declaration with per vertex colors
VertexDeclaration * | vertexDeclEdgeCol_
| vertex buffer layout declaration with per edge colors
VertexDeclaration * | vertexDeclHalfedgeCol_
| vertex buffer layout declaration with per halfedge colors
VertexDeclaration * | vertexDeclHalfedgePos_
| vertex buffer layout declaration with halfedge positions only
GLuint | pickVertexIBO_
| map from openmesh vertex to vbo vertex id

## Detailed Description

### template<class Mesh>
class ACG::DrawMeshT< Mesh >

Mesh Drawing Class.

This class creates a new mesh for efficient rendering based on an OpenMesh object. DrawMesh also supports optimized picking and toggling between vertex/halfedge/face normals and vertex/halfedge texcoords.

It is not recommended to use this class if the input mesh does not implement an OpenMesh kernel. Instead, MeshCompiler can be used directly to build the vertex and index buffer.

Definition at line 173 of file DrawMesh.hh.

## Member Function Documentation

## ◆ addTriRenderObjects()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::addTriRenderObjects | ( | IRenderer * | _renderer,
|  | const RenderObject * | _baseObj,
|  | std::map< int, GLuint > * | _textureMap,
|  | bool | _nonindexed = `false`
| ) |  |

adds RenderObjects to a deferred draw call renderer

Parameters

  _renderer | renderobjects are added to this renderer
  _baseObj | address of the base renderobject with information about shader generation, gl states, matrices ..
  _textureMap | maps from internally texture-id to OpenGL texture id
  _nonindexed | use non-indexed vbo instead of optimized indexed vbo (should be avoided if possible) may be null to disable textured rendering

Definition at line 1408 of file DrawMeshT_impl.hh.

## ◆ addVertexElement()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::addVertexElement | ( | const std::string & | _propertyName,
|  | PropertySource | _source = `PROPERTY_SOURCE_VERTEX`
| ) |  |

Add custom elements to the vertex layout.

Parameters

  _propertyName | name id of property in OpenMesh
  _source | source of property, ie per vertex, per face or per halfedge

Definition at line 2531 of file DrawMeshT_impl.hh.

## ◆ countTris()

template<class Mesh >

unsigned int ACG::DrawMeshT< Mesh >::countTris | ( | unsigned int * | _pOutMaxPolyVerts = `0`,
|  | unsigned int * | _pOutNumIndices = `0`
| ) |  |
| private

Number of triangles after triangulation of the mesh.

returns the number of tris after triangulation of this mesh if needed, also returns the highest number of vertices of a face

Parameters

  _pOutMaxPolyVerts | max face size
  _pOutNumIndices | total number of indices

Returns
  number of triangles

Definition at line 1539 of file DrawMeshT_impl.hh.

## ◆ createIBO()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::createIBO | ( |  | ) |
| private

stores the index buffer on the gpu

Definition at line 1103 of file DrawMeshT_impl.hh.

## ◆ createVBO()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::createVBO | ( |  | ) |
| private

stores the vertex buffer on the gpu

Definition at line 896 of file DrawMeshT_impl.hh.

## ◆ createVertexDeclaration()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::createVertexDeclaration | ( |  | ) |
| private

creates all vertex declarations needed for deferred draw call renderer

Definition at line 2368 of file DrawMeshT_impl.hh.

## ◆ draw()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::draw | ( | std::map< int, GLuint > * | _textureMap,
|  | bool | _nonindexed = `false`
| ) |  |

binds index and vertex buffer and executes draw calls

Parameters

  _textureMap | maps from internally texture-id to OpenGL texture id, may be null to disable textured rendering
  _nonindexed | use unoptimized non-indexed vbo for rendering, not as efficient in terms of memory usage and performance as an indexed draw call.

Definition at line 1355 of file DrawMeshT_impl.hh.

## ◆ drawPickingAny_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::drawPickingAny_opt | ( | const GLMatrixf & | _mvp,
|  | size_t | _pickOffset
| ) |  |

Optimized rendering of any picking ids with a shader.

Parameters

  _mvp | model view projection transformation
  _pickOffset | base picking id of the first element

Definition at line 2254 of file DrawMeshT_impl.hh.

## ◆ drawPickingEdges_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::drawPickingEdges_opt | ( | const GLMatrixf & | _mvp,
|  | size_t | _pickOffset
| ) |  |

Optimized rendering of edge picking ids with a shader.

Parameters

  _mvp | model view projection transformation
  _pickOffset | base picking id of the first edge

Definition at line 1960 of file DrawMeshT_impl.hh.

## ◆ drawPickingFaces_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::drawPickingFaces_opt | ( | const GLMatrixf & | _mvp,
|  | size_t | _pickOffset
| ) |  |

Optimized rendering of face picking ids with a shader.

Parameters

  _mvp | model view projection transformation
  _pickOffset | base picking id of the first face

Definition at line 2092 of file DrawMeshT_impl.hh.

## ◆ drawPickingVertices_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::drawPickingVertices_opt | ( | const GLMatrixf & | _mvp,
|  | size_t | _pickOffset
| ) |  |

Optimized rendering of vertex picking ids with a shader.

Parameters

  _mvp | model view projection transformation
  _pickOffset | base picking id of the first vertex

Definition at line 1679 of file DrawMeshT_impl.hh.

## ◆ dumpObj()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::dumpObj | ( | const char * | _filename | ) | const

dump current vertex/index buffer to wavefront obj

Parameters

  _filename | file name of obj file

Definition at line 2675 of file DrawMeshT_impl.hh.

## ◆ getFaceColor()

template<class Mesh>

unsigned int ACG::DrawMeshT< Mesh >::getFaceColor | ( | const typename Mesh::FaceHandle & | _fh | ) |
| private

return a face color from mesh

Parameters

  _fh | mesh face handle

Definition at line 852 of file DrawMeshT_impl.hh.

## ◆ getHEVBO()

template<class Mesh>

GLuint ACG::DrawMeshT< Mesh >::getHEVBO | ( |  | ) |
| inline

getHEVBO get VBO which stores Halfedges with offset

Returns
  GLuint the VBO

Definition at line 220 of file DrawMesh.hh.

## ◆ getMeshPropertyType()

template<class Mesh >

const void * ACG::DrawMeshT< Mesh >::getMeshPropertyType | ( | OpenMesh::BaseProperty * | _prop,
|  | GLuint * | _outType,
|  | unsigned int * | _outSize
| ) |  | const
| private

get the data type of a mesh property

Parameters

  _prop | mesh property
  _outType | [out] data type i.e. GL_FLOAT, GL_DOUBLE
  _outSize | [out] number of atoms in range 1..4

Returns
  address of property data

Definition at line 158 of file DrawMeshT_impl.hh.

## ◆ getNumTextures()

template<class Mesh >

unsigned int ACG::DrawMeshT< Mesh >::getNumTextures | ( |  | ) |

returns the number of used textured of this mesh

Returns
  Number of different textures used in the mesh

Definition at line 2322 of file DrawMeshT_impl.hh.

## ◆ getTextureIDofFace()

template<class Mesh >

int ACG::DrawMeshT< Mesh >::getTextureIDofFace | ( | unsigned int | _face | ) |
| private

get the texture index of a face

Parameters

  _face | Face index

Returns
  Face Texture id of face

Definition at line 874 of file DrawMeshT_impl.hh.

## ◆ getTextureIDofTri()

template<class Mesh >

int ACG::DrawMeshT< Mesh >::getTextureIDofTri | ( | unsigned int | _tri | ) |
| private

get the texture index of a triangle

Parameters

  _tri | Triangle index (-1 if not available)

Returns
  Texture index of a triangle

Definition at line 888 of file DrawMeshT_impl.hh.

## ◆ getTextureIndexPropertyName()

template<class Mesh>

const std::string& ACG::DrawMeshT< Mesh >::getTextureIndexPropertyName | ( |  | ) | const
| inline

get the name of the texture index property

Returns
  name of the texture index property

Definition at line 322 of file DrawMesh.hh.

## ◆ getVertexColor()

template<class Mesh>

unsigned int ACG::DrawMeshT< Mesh >::getVertexColor | ( | const typename Mesh::VertexHandle & | _vh | ) |
| private

return a vertex color from mesh

Parameters

  _vh | mesh vertex handle

Definition at line 830 of file DrawMeshT_impl.hh.

## ◆ halfedge_point()

template<class Mesh>
template<typename Mesh::Normal(DrawMeshT< Mesh >::*)(typename Mesh::FaceHandle) NormalLookup>

Mesh::Point ACG::DrawMeshT< Mesh >::halfedge_point | ( | const typename Mesh::HalfedgeHandle | _heh | ) |
| private

compute halfedge point compute visualization point for halfedge (shifted to interior of face)

Parameters

  _heh |

Returns

Definition at line 1845 of file DrawMeshT_impl.hh.

## ◆ invalidateFullVBO()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::invalidateFullVBO | ( |  | ) |

the mesh has been changed

call this function if you changed anything of the mesh.

Definition at line 2738 of file DrawMeshT_impl.hh.

## ◆ invalidatePerEdgeBuffers()

template<class Mesh>

void ACG::DrawMeshT< Mesh >::invalidatePerEdgeBuffers | ( |  | ) |
| inline

Update of the buffers.

This function will set all per edge buffers to invalid and will force an update whe they are requested

Definition at line 994 of file DrawMesh.hh.

## ◆ invalidatePerHalfedgeBuffers()

template<class Mesh>

void ACG::DrawMeshT< Mesh >::invalidatePerHalfedgeBuffers | ( |  | ) |
| inline

Update of the buffers.

This function will set all per edge buffers to invalid and will force an update whe they are requested

Definition at line 1019 of file DrawMesh.hh.

## ◆ mapVertexToVBOIndex()

template<class Mesh >

unsigned int ACG::DrawMeshT< Mesh >::mapVertexToVBOIndex | ( | unsigned int | _v | ) |

map from vertex index of the original mesh point buffer to the corresponding vertex index inside the VBO.

Parameters

  _v | vertex index into mesh points

Returns
  vertex index into VBO

Definition at line 1283 of file DrawMeshT_impl.hh.

## ◆ perEdgeColorBuffer()

template<class Mesh >

ACG::Vec4f * ACG::DrawMeshT< Mesh >::perEdgeColorBuffer | ( |  | ) |

get a pointer to the per edge color buffer

This function will return a pointer to the first element of the color buffer.

Definition at line 1581 of file DrawMeshT_impl.hh.

## ◆ perEdgeVertexBuffer()

template<class Mesh >

ACG::Vec3f * ACG::DrawMeshT< Mesh >::perEdgeVertexBuffer | ( |  | ) |

get a pointer to the per edge vertex buffer

This function will return a pointer to the first element of the vertex buffer.

Definition at line 1572 of file DrawMeshT_impl.hh.

## ◆ perFaceTextureCoordinateAvailable()

template<class Mesh >

int ACG::DrawMeshT< Mesh >::perFaceTextureCoordinateAvailable | ( |  | ) |

Check if per Face Texture coordinates are available.

If this function returns true, a per face per vertex texture array is available

Returns
  zero if not available, nonzero otherwise

Definition at line 2334 of file DrawMeshT_impl.hh.

## ◆ perFaceTextureIndexAvailable()

template<class Mesh >

int ACG::DrawMeshT< Mesh >::perFaceTextureIndexAvailable | ( |  | ) |

Check if texture indices are available.

If this function returns true, the strip processor will respect textures during strip generation. Each returned strip has than an index that has to be used as a texture index during strip rendering.

Returns
  zero if not available, nonzero otherwise

Definition at line 2350 of file DrawMeshT_impl.hh.

## ◆ perHalfedgeColorBuffer()

template<class Mesh >

ACG::Vec4f * ACG::DrawMeshT< Mesh >::perHalfedgeColorBuffer | ( |  | ) |

get a pointer to the per edge color buffer

This function will return a pointer to the first element of the color buffer.

Definition at line 1889 of file DrawMeshT_impl.hh.

## ◆ perHalfedgeVertexBuffer()

template<class Mesh >

ACG::Vec3f * ACG::DrawMeshT< Mesh >::perHalfedgeVertexBuffer | ( |  | ) |

get a pointer to the per edge vertex buffer

This function will return a pointer to the first element of the vertex buffer.

Definition at line 1874 of file DrawMeshT_impl.hh.

## ◆ pickAnyEdgeColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickAnyEdgeColorBuffer | ( |  | ) |
| inline

get a pointer to the any picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingAny to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  Pointer to the first element of the picking buffer

Definition at line 704 of file DrawMesh.hh.

## ◆ pickAnyFaceColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickAnyFaceColorBuffer | ( |  | ) |
| inline

get a pointer to the any picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingAny to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  Pointer to the first element of the picking buffer

Definition at line 687 of file DrawMesh.hh.

## ◆ pickAnyVertexColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickAnyVertexColorBuffer | ( |  | ) |
| inline

get a pointer to the any picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingAny to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  Pointer to the first element of the picking buffer

Definition at line 721 of file DrawMesh.hh.

## ◆ pickEdgeColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickEdgeColorBuffer | ( |  | ) |
| inline

get a pointer to the per edge picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingEdges to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  pointer to the first element of the picking buffer

Definition at line 549 of file DrawMesh.hh.

## ◆ pickFaceColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickFaceColorBuffer | ( |  | ) |
| inline

get a pointer to the per face picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingFaces to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  pointer to the per face picking color buffer

Definition at line 602 of file DrawMesh.hh.

## ◆ pickFaceVertexBuffer()

template<class Mesh>

ACG::Vec3f* ACG::DrawMeshT< Mesh >::pickFaceVertexBuffer | ( |  | ) |
| inline

get a pointer to the per vertex picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingFaces to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  pointer to the first element of the picking buffer

Definition at line 619 of file DrawMesh.hh.

## ◆ pickVertexBuffer()

template<class Mesh>

ACG::Vec3f* ACG::DrawMeshT< Mesh >::pickVertexBuffer | ( |  | ) |
| inline

get a pointer to the per vertex picking vertex buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingVertices to update the buffer before you render it via ACG::GLState::vertexPointer.

Returns
  pointer to the first element of the picking buffer

Definition at line 468 of file DrawMesh.hh.

## ◆ pickVertexColorBuffer()

template<class Mesh>

ACG::Vec4uc* ACG::DrawMeshT< Mesh >::pickVertexColorBuffer | ( |  | ) |
| inline

get a pointer to the per vertex picking color buffer

This function will return a pointer to the first element of the picking buffer. Use updatePickingVertices to update the buffer before you render it via ACG::GLState::colorPointer.

Returns
  pointer to the first element of the picking buffer

Definition at line 451 of file DrawMesh.hh.

## ◆ readVertex()

template<class Mesh>

void ACG::DrawMeshT< Mesh >::readVertex | ( | size_t | _vertex,
|  | const typename Mesh::VertexHandle & | _vh,
|  | const typename Mesh::HalfedgeHandle & | _hh,
|  | const typename Mesh::FaceHandle & | _fh
| ) |  |
| private

reads a vertex from mesh_ and write it to vertex buffer

Parameters

  _vertex | target vertex id in vbo
  _vh | mesh vertex handle to read from
  _hh | corresponding halfedge handle of this vertex
  _fh | corresponding face handle of this vertex

Definition at line 751 of file DrawMeshT_impl.hh.

## ◆ readVertexFromVBO()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::readVertexFromVBO | ( | unsigned int | _vertex,
|  | void * | _dst
| ) |  |
| private

Read one vertex from the rendering vbo.

Parameters

  _vertex | vertex id from the rendering vbo (not the original input id from openmesh!)
  _dst | [out] pointer to address that will store the vertex. Must have enough space allocated, see vertex declaration stride to get the number of bytes

Definition at line 2720 of file DrawMeshT_impl.hh.

## ◆ rebuild()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::rebuild | ( |  | ) |
| private

draw_mesh updater

Definition at line 403 of file DrawMeshT_impl.hh.

## ◆ scanVertexShaderForInput()

template<class Mesh >

bool ACG::DrawMeshT< Mesh >::scanVertexShaderForInput | ( | const std::string & | _vertexShaderFile | ) |

Scan vertex layout from vertex shader.

Scans a vertex shader for inputs and tries to get the matching properties from OpenMesh. The name of the input attribute in the shader has to match the property name in OpenMesh. Per halfedge properties are preferred over per vertex properties when available. Per face properties are used if the attribute is qualified as "flat" in the shader.

Parameters

  _vertexShaderFile | filename of vertex shader (or vertex shader template)

Returns
  true if all requested properties are available, false otherwise

Definition at line 2561 of file DrawMeshT_impl.hh.

## ◆ setPerFaceTextureCoordinatePropertyName()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::setPerFaceTextureCoordinatePropertyName | ( | std::string | _perFaceTextureCoordinatePropertyName | ) |

set the name of the property used for texture coordinate

The given property name will define per face Texture coordinates. This property has to be a halfedge property. The coordinate on each edge is the texture coordinate of the to vertex. If this property is not available, textures will not be processed by the strip processor.

Parameters

  _perFaceTextureCoordinatePropertyName |

Definition at line 2302 of file DrawMeshT_impl.hh.

## ◆ setTextureIndexPropertyName()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::setTextureIndexPropertyName | ( | std::string | _indexPropertyName | ) |

set the name of the property used for texture index specification

The given property name will define a texture index. The strip processor checks this property and generates strips which contain only the same index. If the property is not found, strips will be independent of this property

Parameters

  _indexPropertyName |

Definition at line 2278 of file DrawMeshT_impl.hh.

## ◆ supportsPickingAny_opt()

template<class Mesh >

bool ACG::DrawMeshT< Mesh >::supportsPickingAny_opt | ( |  | ) |

Check if optimized any picking is supported.

Definition at line 2247 of file DrawMeshT_impl.hh.

## ◆ supportsPickingEdges_opt()

template<class Mesh >

bool ACG::DrawMeshT< Mesh >::supportsPickingEdges_opt | ( |  | ) |

Check if optimized face picking is supported.

Definition at line 1946 of file DrawMeshT_impl.hh.

## ◆ supportsPickingFaces_opt()

template<class Mesh >

bool ACG::DrawMeshT< Mesh >::supportsPickingFaces_opt | ( |  | ) |

Check if optimized face picking is supported.

Definition at line 2075 of file DrawMeshT_impl.hh.

## ◆ supportsPickingVertices_opt()

template<class Mesh >

bool ACG::DrawMeshT< Mesh >::supportsPickingVertices_opt | ( |  | ) |

Check if optimized vertex picking is supported.

Definition at line 1655 of file DrawMeshT_impl.hh.

## ◆ testMeshPropertyTypeT()

template<class Mesh >
template<class T >

const void * ACG::DrawMeshT< Mesh >::testMeshPropertyTypeT | ( | const OpenMesh::BaseProperty * | _prop,
|  | unsigned int * | _outSize
| ) |  | const
| private

test mesh property for type T

Test whether property is of type T (eg float) or is a vector of type T. Property vectors up to size 4 are supported (native vertex properties).

Parameters

  _prop | mesh property
  _outSize | [out] number of atoms in range 1..4, set to 0 if test failed

Returns
  address of property data, 0 if test failed

Definition at line 106 of file DrawMeshT_impl.hh.

## ◆ updateFull()

template<class Mesh>

void ACG::DrawMeshT< Mesh >::updateFull | ( |  | ) |
| inline

request a full rebuild of the mesh

Definition at line 300 of file DrawMesh.hh.

## ◆ updateFullVBO()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updateFullVBO | ( |  | ) |

update the full mesh vbo

the full vbo is the non-indexed version for drawing. it's not optimized for rendering at all and it uses lots of memory, so should only be used as last resort.

Definition at line 2745 of file DrawMeshT_impl.hh.

## ◆ updateGPUBuffers()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updateGPUBuffers | ( |  | ) |
| private

eventually update vertex and index buffers

Definition at line 1244 of file DrawMeshT_impl.hh.

## ◆ updatePerEdgeBuffers()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePerEdgeBuffers | ( |  | ) |

Update all per edge drawing buffers.

The updated buffers are: vertex buffer ( 2 vertices per edge ), color buffer

Definition at line 1749 of file DrawMeshT_impl.hh.

## ◆ updatePickingAny()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingAny | ( | ACG::GLState & | _state | ) |

Call this function to update the color picking array.

This function calls the updatePickingVertices, updatePickingEdges, updatePickingVertices functions with an appropriate offset so that the standard arrays will be updated.

Parameters

  _state | OpenGL state

Definition at line 2161 of file DrawMeshT_impl.hh.

## ◆ updatePickingAny_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingAny_opt | ( | ACG::GLState & | _state | ) |

Update color picking array for the shader implementation.

Parameters

  _state |

Definition at line 2237 of file DrawMeshT_impl.hh.

## ◆ updatePickingEdges()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingEdges | ( | ACG::GLState & | _state,
|  | uint | _offset = `0`
| ) |  |

Update color picking array for edges.

Call this function to update the color picking array The _offsett value can be used to shift the color in the resulting arrays. pick Any uses the offset to generate arrays for picking everything.

Parameters

  _state |
  _offset |

Definition at line 1907 of file DrawMeshT_impl.hh.

## ◆ updatePickingEdges_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingEdges_opt | ( | ACG::GLState & | _state | ) |

Update color picking array for the shader implementation.

Parameters

  _state |

Definition at line 1932 of file DrawMeshT_impl.hh.

## ◆ updatePickingFaces()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingFaces | ( | ACG::GLState & | _state | ) |

Update color picking array for faces.

Parameters

  _state |

Definition at line 2011 of file DrawMeshT_impl.hh.

## ◆ updatePickingFaces_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingFaces_opt | ( | ACG::GLState & | _state | ) |

Update color picking array for the shader implementation.

Parameters

  _state |

Definition at line 2056 of file DrawMeshT_impl.hh.

## ◆ updatePickingVertices()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingVertices | ( | ACG::GLState & | _state,
|  | uint | _offset = `0`
| ) |  |

Call this function to update the color picking array The _offsett value can be used to shift the color in the resulting arrays. pick Any uses the offset to generate arrays for picking everything.

Parameters

  _state |
  _offset |

Definition at line 1591 of file DrawMeshT_impl.hh.

## ◆ updatePickingVertices_opt()

template<class Mesh >

void ACG::DrawMeshT< Mesh >::updatePickingVertices_opt | ( | ACG::GLState & | _state | ) |

Update color picking array for the shader implementation.

Parameters

  _state |

Definition at line 1611 of file DrawMeshT_impl.hh.

## Member Data Documentation

## ◆ invVertexMap_

template<class Mesh>

unsigned int* ACG::DrawMeshT< Mesh >::invVertexMap_
| private

inverse vertex map: original OpenMesh vertex index -> one vertex index in vbo this map is ambiguous and only useful for per vertex attributes rendering i.e. lines!

Definition at line 863 of file DrawMesh.hh.

## ◆ perFaceTextureCoordinatePropertyName_

template<class Mesh>

std::string ACG::DrawMeshT< Mesh >::perFaceTextureCoordinatePropertyName_
| private

Property for the per face texture coordinates.

This property is used by the mesh for texture coordinate specification. If this is invalid, then the strip processor will ignore per face textures during processing.

Definition at line 923 of file DrawMesh.hh.

## ◆ prevNumFaces_

template<class Mesh>

size_t ACG::DrawMeshT< Mesh >::prevNumFaces_
| private

used to track mesh changes, that require a full rebuild values directly taken from Mesh template

Definition at line 832 of file DrawMesh.hh.

## ◆ textureIndexPropertyName_

template<class Mesh>

std::string ACG::DrawMeshT< Mesh >::textureIndexPropertyName_
| private

Property for the per face texture index.

This property is used by the mesh for texture index specification. If this is invalid, then it is assumed that there is one or no active texture. This means that the generated strips will be independent of texture information.

Definition at line 916 of file DrawMesh.hh.

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

- OpenFlipper/libs_required/ACG/GL/DrawMesh.hh
- OpenFlipper/libs_required/ACG/GL/DrawMeshT_impl.hh