#include <ACG/Scenegraph/MeshNodeT.hh>


Public Member Functions | |
| ACG_CLASSNAME (MeshNode) | |
| MeshNodeT (Mesh &_mesh, BaseNode *_parent=0, std::string _name="<MeshNode>") | |
| Default constructor. | |
| virtual | ~MeshNodeT () |
| Destructor. | |
| void | update_geometry () |
| the geometry of the mesh has changed | |
| void | update_topology () |
| the topology of the mesh has changed | |
| void | update_color () |
| the colors of the mesh have changed | |
| void | set_property_map (std::map< int, std::string > *_map) |
| MeshNodeT (const Mesh &_mesh, BaseNode *_parent=0, std::string _name="<MeshNode>") | |
| virtual | ~MeshNodeT () |
| Destructor. | |
| ACG_CLASSNAME (MeshNode) | |
| 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. | |
| MeshNodeT (const Mesh &_mesh, BaseNode *_parent=0, std::string _name="<MeshNode>") | |
| virtual | ~MeshNodeT () |
| Destructor. | |
| ACG_CLASSNAME (MeshNode) | |
| DrawModes::DrawMode | availableDrawModes () const |
| return available draw modes | |
| void | boundingBox (Vec3d &_bbMin, Vec3d &_bbMax) |
| update bounding box | |
| void | draw (GLState &_state, DrawModes::DrawMode _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 | setTextureMap (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 | setHalfedgeTextcoordPropertyName (std::string _default_halfedge_textcoord_property) |
| Set default property name to get texture coordinates for per face texcoords. | |
| void | setIndexPropertyName (std::string _index_property_name) |
| Property to use when switching between multiple textures. | |
general picking functions | |
| void | pick (GLState &_state, PickTarget _target) |
| Draws the object in picking mode. | |
Protected Types | |
| enum | FaceMode { PER_VERTEX, PER_FACE, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED } |
| enum | ArrayType { NONE = 0, VERTEX_ARRAY = 1, NORMAL_VERTEX_ARRAY = 2, COLOR_VERTEX_ARRAY = 4, TEXCOORD_VERTEX_ARRAY = 8, LINE_INDEX_ARRAY = 16, PER_EDGE_VERTEX_ARRAY = 32, PER_EDGE_COLOR_ARRAY = 64, PER_FACE_VERTEX_ARRAY = 128, PER_FACE_NORMAL_ARRAY = 256, PER_FACE_COLOR_ARRAY = 512, PER_FACE_TEXCOORD_ARRAY = 1024, NONE = 0, TEXTURE_COORD_1D_ARRAY = 8, TEXTURE_COORD_2D_ARRAY = 16, TEXTURE_COORD_3D_ARRAY = 32, 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 } |
| enum | FaceMode { PER_VERTEX, PER_FACE, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED } |
| enum | ArrayType { NONE = 0, VERTEX_ARRAY = 1, NORMAL_VERTEX_ARRAY = 2, COLOR_VERTEX_ARRAY = 4, TEXCOORD_VERTEX_ARRAY = 8, LINE_INDEX_ARRAY = 16, PER_EDGE_VERTEX_ARRAY = 32, PER_EDGE_COLOR_ARRAY = 64, PER_FACE_VERTEX_ARRAY = 128, PER_FACE_NORMAL_ARRAY = 256, PER_FACE_COLOR_ARRAY = 512, PER_FACE_TEXCOORD_ARRAY = 1024, NONE = 0, TEXTURE_COORD_1D_ARRAY = 8, TEXTURE_COORD_2D_ARRAY = 16, TEXTURE_COORD_3D_ARRAY = 32, 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 | |
| virtual void | draw_faces (FaceMode _mode) |
| void | update_pick_buffers () |
| 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 | |
| unsigned int | face_index_buffer_ |
| std::vector< unsigned int > | indices_ |
| const Mesh & | mesh_ |
| unsigned int | vertex_buffer_ |
| unsigned int | normal_buffer_ |
Private Types | |
| typedef Mesh::Point | Point |
| typedef Point::value_type | PointScalar |
| typedef Mesh::Normal | Normal |
| typedef Normal::value_type | NormalScalar |
| typedef Mesh::Color | Color |
| typedef Color::value_type | ColorScalar |
Private Attributes | |
| bool | faceIndexBufferInitialized_ |
| std::map< int, std::string > * | propertyMap_ |
| std::string | default_halfedge_textcoord_property_ |
| GLuint | faceList_ |
| GLuint | anyList_ |
| bool | updateFaceList_ |
| bool | updateEdgeList_ |
| bool | updateAnyList_ |
| unsigned int | faceBaseIndex_ |
| unsigned int | edgeBaseIndex_ |
| unsigned int | anyBaseIndex_ |
| bool | normalBufferInitialized_ |
| std::string | indexPropertyName_ |
| GLuint | vertexList_ |
| GLuint | edgeList_ |
| bool | updateVertexList_ |
| unsigned int | vertexBaseIndex_ |
| std::vector< ACG::Vec3f > | pickVertexBuf_ |
| std::vector< ACG::Vec4uc > | pickColorBuf_ |
Strip generation and handling | |
| StripProcessorT< Mesh > | stripProcessor_ |
Vertex Buffer | |
| GLuint | vertexBuffer_ |
| Vertex buffer. | |
| bool | vertexBufferInitialized_ |
| Vertex buffer initialization flag. | |
| std::vector< ACG::Vec3f > | vertices_ |
| Internal buffer used when rendering non float vertex coordinates. | |
Line buffer | |
| std::vector< unsigned int > | lineIndices_ |
| Vector storing vertices for rendering all edges in the mesh. | |
| GLuint | lineIndexBuffer_ |
| Index buffer for lines. | |
| bool | lineIndexBufferInitialized_ |
| lineIndexBuffer initialization flag | |
Array control functions | |
|
| |
| enum | ArrayType { NONE = 0, VERTEX_ARRAY = 1, NORMAL_VERTEX_ARRAY = 2, COLOR_VERTEX_ARRAY = 4, TEXCOORD_VERTEX_ARRAY = 8, LINE_INDEX_ARRAY = 16, PER_EDGE_VERTEX_ARRAY = 32, PER_EDGE_COLOR_ARRAY = 64, PER_FACE_VERTEX_ARRAY = 128, PER_FACE_NORMAL_ARRAY = 256, PER_FACE_COLOR_ARRAY = 512, PER_FACE_TEXCOORD_ARRAY = 1024, NONE = 0, TEXTURE_COORD_1D_ARRAY = 8, TEXTURE_COORD_2D_ARRAY = 16, TEXTURE_COORD_3D_ARRAY = 32, 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 } |
Enum controlling which array should be used for rendering. | |
| unsigned int | enabled_arrays_ |
| which arrays are currently enabled? | |
| void | enable_arrays (unsigned int _arrays) |
| enable/disable vertex arrays according to the bits in _arrays | |
Rendering functions | |
|
| |
| enum | FaceMode { PER_VERTEX, PER_FACE, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED, FACE_NORMALS, FACE_COLORS, PER_VERTEX, FACE_NORMALS_COLORS, FACE_HALFEDGE_TEXTURED } |
| void | draw (GLState &_state, DrawModes::DrawMode _drawMode) |
| Draws the object. | |
| void | draw_vertices () |
| draws all vertices of the mesh | |
| void | draw_lines () |
| draws all edges of the mesh | |
| void | draw_faces (FaceMode _mode) |
| draws all faces of the mesh | |
| ACG::SceneGraph::DrawModes::DrawMode | availableDrawModes () const |
| return available draw modes | |
Mesh Handling | |
|
| |
| Mesh & | mesh_ |
| The mesh this node works on. | |
| const Mesh & | mesh () const |
| get the internal mesh | |
Bounding Box | |
|
| |
| Vec3d | bbMin_ |
| bounding box lower left corner | |
| Vec3d | bbMax_ |
| bounding box upper right corner | |
| void | boundingBox (Vec3d &_bbMin, Vec3d &_bbMax) |
| Current bounding box. | |
Normal Buffer | |
|
| |
| bool | enableNormals_ |
| Flag if normals should be used. | |
| GLuint | normalVertexBuffer_ |
| Normal buffer. | |
| bool | normalVertexBufferInitialized_ |
| normal buffer initialization flag | |
| std::vector< ACG::Vec3f > | normals_ |
| Internal buffer used when rendering non float normals. | |
| bool | normalsEnabled () |
| Returns if the normal array is currently activated. | |
| void | enableNormals (bool _enable) |
| Enable or disable the use of the normal array. | |
Color buffer | |
|
| |
| bool | enableColors_ |
| GLuint | colorVertexbuffer_ |
| color buffer | |
| bool | colorVertexBufferInitialized_ |
| normal buffer initialization flag | |
| std::vector< ACG::Vec4f > | colors_ |
| Internal buffer used when rendering non Vec4f colors. | |
| bool | colorsEnabled () |
| Returns if the color array is currently activated. | |
| void | enableColors (bool _enable) |
| Enable or disable the use of color array. | |
Texcoord buffer | |
|
| |
| bool | enableTexCoords_ |
| bool | texCoordEnabled () |
| Returns if the per vertex Texture coordinates array is currently activated. | |
| void | enableTexCoords (bool _enable) |
| Enable or disable the use of the per vertex Texture coordinates array. | |
vertex picking functions | |
|
| |
| bool | updateVertexPickingList_ |
| Flag indicating if the vertex picking display list has to be updates. | |
| unsigned int | vertexPickingBaseIndex_ |
| Index of the first vertex in vertexpicking. | |
| GLuint | vertexPickingList_ |
| Dispplay list for rendering vertex picking. | |
| void | pick_vertices (GLState &_state, bool _front=false) |
| Renders picking for vertices. | |
edge picking functions | |
|
| |
| bool | updateEdgePickingList_ |
| Flag indicating if the edge picking display list has to be updates. | |
| unsigned int | edgePickingBaseIndex_ |
| Index of the first edge in edgepicking. | |
| GLuint | edgePickingList_ |
| Dispplay list for rendering edge picking. | |
| void | pick_edges (GLState &_state, bool _front=false) |
| Renders picking for edges. | |
face picking functions | |
|
| |
| bool | updateFacePickingList_ |
| Flag indicating if the edge picking display list has to be updates. | |
| unsigned int | facePickingBaseIndex_ |
| Index of the first face in facepicking. | |
| GLuint | facePickingList_ |
| Dispplay list for rendering edge picking. | |
| void | pick_faces (GLState &_state) |
| Renders picking for faces. | |
anything picking functions | |
|
| |
| bool | updateAnyPickingList_ |
| Flag indicating if the any picking display list has to be updates. | |
| unsigned int | anyPickingBaseIndex_ |
| Index of the first face in anypicking. | |
| GLuint | anyPickingList_ |
| Dispplay list for rendering general picking. | |
| void | pick_any (GLState &_state) |
| Renders picking for all primitives. | |
Texture handling | |
|
| |
| bool | perFaceTextureIndexAvailable_ |
| This flag indicates if we have a per Face texture index property. | |
| bool | perFaceTextureCoordsAvailable_ |
| This flag indicates if we have a per Face texture coordinate property. | |
| std::map< int, GLuint > * | textureMap_ |
| Mapping of mesh face texture indices to gltexture id ( has to be provided externally ). | |
| void | setIndexPropertyName (std::string _indexPropertyName) |
| set the name of the property used for texture index specification | |
| void | setHalfedgeTextcoordPropertyName (std::string _halfedgeTextcoordPropertyName) |
| Set the name of the per face texture coordinate property. | |
| void | setTextureMap (std::map< int, GLuint > *_map) |
| Setup a mapping between internal texture ids on the mesh and the ids for the loaded textures in opengl. | |
This node draws a mesh using triangle strips.
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 82 of file MeshNode2T.hh.
typedef Mesh::Point ACG::SceneGraph::MeshNodeT< Mesh >::Point [private] |
Typedefs of the mesh representation
These typedefs are used to specifiy and convert all input to float for rendering
Definition at line 130 of file MeshNode2T.hh.
| ACG::SceneGraph::MeshNodeT< Mesh >::MeshNodeT | ( | Mesh & | _mesh, | |
| BaseNode * | _parent = 0, |
|||
| std::string | _name = "<MeshNode>" | |||
| ) |
Default constructor.
The constructor needs a mesh on which this node will work.
| ACG::SceneGraph::MeshNodeT< Mesh >::MeshNodeT | ( | const Mesh & | _mesh, | |
| BaseNode * | _parent = 0, |
|||
| std::string | _name = "<MeshNode>" | |||
| ) |
Default constructor.
| _textureMap | if the mesh has a face_texture_index and a map is provided textures are switched based on the given ids |
| ACG::SceneGraph::MeshNodeT< Mesh >::MeshNodeT | ( | const Mesh & | _mesh, | |
| BaseNode * | _parent = 0, |
|||
| std::string | _name = "<MeshNode>" | |||
| ) |
Default constructor.
| _textureMap | if the mesh has a face_texture_index and a map is provided textures are switched based on the given ids |
| ACG::SceneGraph::DrawModes::DrawMode ACG::SceneGraph::MeshNodeT< Mesh >::availableDrawModes | ( | ) | const [private, virtual] |
return available draw modes
The drawmodes are constructed based on the mesh properties and the hardware capabilities of the system.
Reimplemented from ACG::SceneGraph::ACG::SceneGraph::BaseNode.
| void ACG::SceneGraph::MeshNodeT< Mesh >::boundingBox | ( | Vec3d & | _bbMin, | |
| Vec3d & | _bbMax | |||
| ) | [virtual] |
Current bounding box.
This function returns the bounding box of the node.
Reimplemented from ACG::SceneGraph::ACG::SceneGraph::BaseNode.
Referenced by MeshObject< MeshT >::boundingBox().
| void ACG::SceneGraph::MeshNodeT< Mesh >::draw | ( | GLState & | _state, | |
| DrawModes::DrawMode | _drawMode | |||
| ) |
Draws the object.
| void ACG::SceneGraph::MeshNodeT< Mesh >::draw_faces | ( | FaceMode | _mode | ) | [private] |
draws all faces of the mesh
Referenced by ACG::SceneGraph::TriStripNodeT< Mesh >::draw_faces().
| void ACG::SceneGraph::MeshNodeT< Mesh >::draw_lines | ( | ) | [inline, private] |
draws all edges of the mesh
| void ACG::SceneGraph::MeshNodeT< Mesh >::draw_vertices | ( | ) | [inline, private] |
draws all vertices of the mesh
| void ACG::SceneGraph::MeshNodeT< Mesh >::enable_arrays | ( | unsigned int | _arrays | ) |
enable/disable vertex arrays according to the bits in _arrays
Use this function to enable or disable the appropriate array for rendering. Currently the arrays in ArrayType are supported
| void ACG::SceneGraph::MeshNodeT< Mesh >::pick | ( | GLState & | _state, | |
| PickTarget | _target | |||
| ) |
Draws the object in picking mode.
| void ACG::SceneGraph::MeshNodeT< Mesh >::pick_any | ( | GLState & | _state | ) | [private] |
Renders picking for all primitives.
| void ACG::SceneGraph::MeshNodeT< Mesh >::pick_edges | ( | GLState & | _state, | |
| bool | _front = false | |||
| ) | [private] |
Renders picking for edges.
| void ACG::SceneGraph::MeshNodeT< Mesh >::pick_faces | ( | GLState & | _state | ) | [private] |
Renders picking for faces.
| void ACG::SceneGraph::MeshNodeT< Mesh >::pick_vertices | ( | GLState & | _state, | |
| bool | _front = false | |||
| ) | [private] |
Renders picking for vertices.
| 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 116 of file MeshNodeOldT.hh.
| 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.
| _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.
| 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.
| _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 109 of file MeshNodeOldT.hh.
| void ACG::SceneGraph::MeshNodeT< Mesh >::set_property_map | ( | std::map< int, std::string > * | _map | ) | [inline] |
Definition at line 532 of file MeshNode2T.hh.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setHalfedgeTextcoordPropertyName | ( | 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.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setHalfedgeTextcoordPropertyName | ( | std::string | _halfedgeTextcoordPropertyName | ) |
Set the name of the per face texture coordinate property.
Set this property for per face per vertex texture coordinates. Additionally you have to set the IndexPropertyName to make texturing with multiple textures work.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setIndexPropertyName | ( | 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.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setIndexPropertyName | ( | std::string | _indexPropertyName | ) |
set the name of the property used for texture index specification
The given property name will define a texture index. This index is used to make a lookup in the texture correspondence map containing for each index the gluint for the texture to be used. A zero in the property means, that no texture will be bound for the face. If you define a non existing name here, texture switching will be disabled and it is assumed that a texture is bound already.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setTextureMap | ( | 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.
| _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.
| void ACG::SceneGraph::MeshNodeT< Mesh >::setTextureMap | ( | 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.
| _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 514 of file MeshNode2T.hh.
| void ACG::SceneGraph::MeshNodeT< Mesh >::update_color | ( | ) |
the colors of the mesh have changed
call this function if you changed the colors of the mesh. All buffers related to the color will be updated.
if you also updated the topology, the color is updated automatically
Referenced by MeshObject< MeshT >::updateColor().
| void ACG::SceneGraph::MeshNodeT< Mesh >::update_geometry | ( | ) |
the geometry of the mesh has changed
call this function if you changed the geometry of the mesh. All buffers related to the geometry will be updated.
Referenced by MeshObject< MeshT >::updateGeometry().
| virtual void ACG::SceneGraph::MeshNodeT< Mesh >::update_topology | ( | ) | [virtual] |
update face indices (only for triangle meshes). will be overridden by TriStripNodeT.
| void ACG::SceneGraph::MeshNodeT< Mesh >::update_topology | ( | ) |
the topology of the mesh has changed
call this function if you changed the topology of the mesh. All buffers related to the topology will be updated.
this also triggers an update for the colors
Referenced by ACG::SceneGraph::TriStripNodeT< Mesh >::update_topology(), and MeshObject< MeshT >::updateTopology().