ACG::SceneGraph::MeshNodeT< Mesh > Class Template Reference

#include <ACG/Scenegraph/MeshNodeT.hh>

Inheritance diagram for ACG::SceneGraph::MeshNodeT< Mesh >:
Inheritance graph
[legend]
Collaboration diagram for ACG::SceneGraph::MeshNodeT< Mesh >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 MeshNodeT (const Mesh &_mesh, BaseNode *_parent=0, std::string _name="<MeshNode>")
virtual ~MeshNodeT ()
 Destructor.
 ACG_CLASSNAME (MeshNode)
unsigned int availableDrawModes () const
 return available draw modes
void boundingBox (Vec3f &_bbMin, Vec3f &_bbMax)
 update bounding box
void draw (GLState &_state, unsigned int _drawMode)
 drawing
void pick (GLState &_state, PickTarget _target)
 picking
const Mesh & mesh () const
 get mesh
void update_geometry ()
 update geometry buffers (vertex buffer objects)
virtual void update_topology ()
void set_texture_map (std::map< int, GLuint > *_map)
 Setup a mapping between internal texture ids on the mesh and the ids for the loaded textures in opengl.
void set_property_map (std::map< int, std::string > *_map)
 Setup a mapping between internal texture ids on the mesh and the properties containing texture coordinates.
void set_default_halfedge_textcoord_property (std::string _default_halfedge_textcoord_property)
 Set default property name to get texture coordinates for per face texcoords.
void set_index_property_name (std::string _index_property_name)
 Property to use when switching between multiple textures.

Protected Types

enum  FaceMode {
  FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS,
  FACE_HALFEDGE_TEXTURED
}
enum  ArrayType {
  NONE = 0, VERTEX_ARRAY = 1, NORMAL_ARRAY = 2, COLOR_ARRAY = 4,
  TEXTURE_COORD_1D_ARRAY = 8, TEXTURE_COORD_2D_ARRAY = 16, TEXTURE_COORD_3D_ARRAY = 32
}

Protected Member Functions

void draw_vertices ()
virtual void draw_faces (FaceMode _mode)
void pick_vertices (GLState &_state, bool _front=false)
void pick_faces (GLState &_state)
void pick_edges (GLState &_state, bool _front=false)
void pick_any (GLState &_state)
void update_pick_buffers ()
void enable_arrays (unsigned int _arrays)

Protected Attributes

const Mesh & mesh_
unsigned int enabled_arrays_
unsigned int face_index_buffer_
unsigned int vertex_buffer_
unsigned int normal_buffer_
std::vector< unsigned int > indices_

Private Attributes

bool vertexBufferInitialized_
bool normalBufferInitialized_
bool faceIndexBufferInitialized_
std::vector< ACG::Vec3f > vertices_
std::vector< ACG::Vec3f > normals_
std::map< int, GLuint > * textureMap_
std::map< int, std::string > * propertyMap_
std::string default_halfedge_textcoord_property_
std::string indexPropertyName_
GLuint faceList_
GLuint vertexList_
GLuint edgeList_
GLuint anyList_
bool updateFaceList_
bool updateVertexList_
bool updateEdgeList_
bool updateAnyList_
unsigned int faceBaseIndex_
unsigned int vertexBaseIndex_
unsigned int edgeBaseIndex_
unsigned int anyBaseIndex_
std::vector< ACG::Vec3f > pickVertexBuf_
std::vector< ACG::Vec4uc > pickColorBuf_
Vec3f bbMin_
Vec3f bbMax_

Detailed Description

template<class Mesh>
class ACG::SceneGraph::MeshNodeT< Mesh >

This node is used to draw an ACG mesh.

It uses compile-time-tags for recognizing whether the mesh is a TriMeshT or a PolyMeshT.

The available draw modes are collected based on these mesh properties like normal or color for faces or vertices.

Definition at line 85 of file MeshNodeT.hh.


Constructor & Destructor Documentation

template<class Mesh>
ACG::SceneGraph::MeshNodeT< Mesh >::MeshNodeT ( const Mesh &  _mesh,
BaseNode _parent = 0,
std::string  _name = "<MeshNode>" 
) [inline]

Default constructor.

Parameters:
_textureMap if the mesh has a face_texture_index and a map is provided textures are switched based on the given ids

Definition at line 78 of file MeshNodeT.cc.


Member Function Documentation

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw_faces ( FaceMode  _mode  )  [inline, protected, virtual]

TODO dont skip the face, draw without texture instead

Definition at line 906 of file MeshNodeT.cc.

Referenced by ACG::SceneGraph::MeshNodeT< Mesh >::draw().

template<class Mesh>
void ACG::SceneGraph::MeshNodeT< Mesh >::set_default_halfedge_textcoord_property ( std::string  _default_halfedge_textcoord_property  )  [inline]

Set default property name to get texture coordinates for per face texcoords.

Property has to be Mesh::TexCoord2D as a halfedge property describing vertex coordinates for to Vertex per face. Defaults to h:texcoords2D

Definition at line 145 of file MeshNodeT.hh.

template<class Mesh>
void ACG::SceneGraph::MeshNodeT< Mesh >::set_index_property_name ( std::string  _index_property_name  )  [inline]

Property to use when switching between multiple textures.

The given mesh property has to contain an int index of textures to use per face. If it is not given, the default face_texture_index property of OpenMesh will be used. If there is no texture map given via set_texture_map, texture switching will be disabled and only the currently bound texture will be used.

Definition at line 155 of file MeshNodeT.hh.

template<class Mesh>
void ACG::SceneGraph::MeshNodeT< Mesh >::set_property_map ( std::map< int, std::string > *  _map  )  [inline]

Setup a mapping between internal texture ids on the mesh and the properties containing texture coordinates.

Parameters:
_map maps between an int index stored in the Mesh describing which texture to use and a property name giving 2D Texture coordinates for halfedges ( texcoords for to vertex )

Definition at line 138 of file MeshNodeT.hh.

template<class Mesh>
void ACG::SceneGraph::MeshNodeT< Mesh >::set_texture_map ( std::map< int, GLuint > *  _map  )  [inline]

Setup a mapping between internal texture ids on the mesh and the ids for the loaded textures in opengl.

Parameters:
_map maps between an int index stored in the Mesh describing which texture to use for a face, and the GluInt name of the texture bound by the TextureNode.
If such a map is not available ( =0 ), assume TextureNode has already bound a texture And render without switching textures

Definition at line 131 of file MeshNodeT.hh.

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::update_topology (  )  [inline, virtual]

update face indices (only for triangle meshes). will be overridden by TriStripNodeT.

Reimplemented in ACG::SceneGraph::TriStripNodeT< Mesh >, and ACG::SceneGraph::TriStripNodeT< MeshT >.

Definition at line 498 of file MeshNodeT.cc.

Referenced by ACG::SceneGraph::TriStripNodeT< MeshT >::update_topology().


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

acg pic Project OpenFlipper, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .