Developer Documentation
ACG::SceneGraph::MeshNodeT< Mesh > Class Template Reference
Inheritance diagram for ACG::SceneGraph::MeshNodeT< Mesh >:
ACG::SceneGraph::MeshNodeBase ACG::SceneGraph::BaseNode

Public Member Functions

 ACG_CLASSNAME (MeshNode)
 
 MeshNodeT (Mesh &_mesh, BaseNode *_parent=0, const std::string &_name="<MeshNode>")
 Default constructor. More...
 
virtual ~MeshNodeT ()
 Destructor.
 
void update_geometry ()
 the geometry of the mesh has changed More...
 
void update_topology ()
 the topology of the mesh has changed More...
 
void update_color ()
 the colors of the mesh have changed More...
 
void update_textures ()
 force an texture update More...
 
void set_property_map (std::map< int, std::string > *_map)
 
unsigned int getMemoryUsage ()
 measures the size in bytes of allocated memory
 
void set_offset (bool enable)
 
general picking functions
void pick (GLState &_state, PickTarget _target) override
 Draws the object in picking mode. More...
 
- Public Member Functions inherited from ACG::SceneGraph::MeshNodeBase
void updatePolyEdgeBuf ()
 
- Public Member Functions inherited from ACG::SceneGraph::BaseNode
 BaseNode (BaseNode *_parent=0, std::string _name="<unknown>")
 Default constructor.
 
 BaseNode (BaseNode *_parent, BaseNode *_child, std::string _name="<unknown>")
 Put this node between _parent and _child.
 
virtual ~BaseNode ()
 Destructor.
 
void delete_subtree ()
 Delete the whole subtree of this node. More...
 
virtual const std::string & className () const =0
 Return class name (implemented by the ACG_CLASSNAME macro)
 
virtual void enter (GLState &, const DrawModes::DrawMode &)
 
virtual void enter (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void leave (GLState &, const DrawModes::DrawMode &)
 
virtual void leave (IRenderer *, GLState &_state, const DrawModes::DrawMode &_drawMode)
 
virtual void enterPick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
virtual void leavePick (GLState &_state, PickTarget _target, const DrawModes::DrawMode &_drawMode)
 
void enablePicking (bool _enable)
 
bool pickingEnabled ()
 
virtual void mouseEvent (GLState &, QMouseEvent *)
 Handle mouse event (some interaction, e.g. modeling)
 
void setDirty (bool _dirty=true)
 mark node for redrawn
 
bool isDirty () const
 Check if node should be redrawn.
 
ChildIter childrenBegin ()
 Returns: begin-iterator of children.
 
ConstChildIter childrenBegin () const
 Same but cont.
 
ChildIter childrenEnd ()
 Returns: end-iterator of children.
 
ConstChildIter childrenEnd () const
 Same but const.
 
ChildRIter childrenRBegin ()
 Returns: reverse begin-iterator of children.
 
ConstChildRIter childrenRBegin () const
 Same but const.
 
ChildRIter childrenREnd ()
 Returns: reverse end-iterator of children.
 
ConstChildRIter childrenREnd () const
 Same but const.
 
void push_back (BaseNode *_node)
 Insert _node at the end of the list of children.
 
void remove (ChildIter _pos)
 
size_t nChildren () const
 number of children
 
ChildIter find (BaseNode *_node)
 
BaseNodefind (const std::string &_name)
 
BaseNodeparent ()
 Get the nodes parent node.
 
const BaseNodeparent () const
 Get the nodes parent node.
 
void set_parent (BaseNode *_parent)
 Set the parent of this node. More...
 
StatusMode status () const
 Get node's status.
 
void set_status (StatusMode _s)
 Set the status of this node.
 
void hide ()
 Hide Node: set status to HideNode.
 
void show ()
 Show node: set status to Active.
 
bool visible ()
 Is node visible (status == Active)?
 
bool hidden ()
 Is node not visible (status != Active)?
 
std::string name () const
 Returns: name of node (needs not be unique)
 
void name (const std::string &_name)
 rename a node
 
unsigned int id () const
 
DrawModes::DrawMode drawMode () const
 Return the own draw modes of this node.
 
void drawMode (DrawModes::DrawMode _drawMode)
 
unsigned int traverseMode () const
 Return how the node should be traversed.
 
void setTraverseMode (unsigned int _mode)
 Set traverse mode for node.
 
MultipassBitMask multipassStatus () const
 Get the current multipass settings for the nodes status functions. More...
 
void setMultipassStatus (const MultipassBitMask _passStatus)
 Set multipass settings for the nodes status functions. More...
 
void multipassStatusSetActive (const unsigned int _i, bool _active)
 Set multipass status to traverse in a specific pass. More...
 
bool multipassStatusActive (const unsigned int _i) const
 Get multipass status to traverse in a specific pass. More...
 
MultipassBitMask multipassNode () const
 Get the current multipass settings for the node. More...
 
void setMultipassNode (const MultipassBitMask _passNode)
 Set multipass settings for the node. More...
 
void multipassNodeSetActive (const unsigned int _i, bool _active)
 Set Node status to traverse in a specific pass. More...
 
bool multipassNodeActive (const unsigned int _i) const
 Get Node status to traverse in a specific pass. More...
 
void setRenderObjectShaders (const std::string &_vertexShaderFile, const std::string &_geometryShaderFile, const std::string &_fragmentShaderFile, bool _relativePaths=true, DrawModes::DrawModePrimitive _primitiveType=DrawModes::PRIMITIVE_POLYGON)
 Set custom shaders. More...
 
void setRenderObjectShaders (const std::string &_vertexShaderFile, const std::string &_tessControlShaderFile, const std::string &_tessEvalShaderFile, const std::string &_geometryShaderFile, const std::string &_fragmentShaderFile, bool _relativePaths=true, DrawModes::DrawModePrimitive _primitiveType=DrawModes::PRIMITIVE_POLYGON)
 Set custom shaders. More...
 
void setRenderObjectUniformPool (const GLSL::UniformPool *_pool)
 Set uniforms for shader based rendering. More...
 
const GLSL::UniformPoolgetRenderObjectUniformPool ()
 Get uniforms for shader based rendering. More...
 
void setRenderObjectTexture (int _samplerSlot, GLuint _texId, GLenum _texType=GL_TEXTURE_2D)
 Set textures for shader based rendering. More...
 
void setRenderObjectModifier (RenderObjectModifier *_modifier)
 Set modifier for render objects. More...
 
RenderObjectModifiergetRenderObjectModifier ()
 Get render-object modifier. More...
 
void applyRenderObjectSettings (DrawModes::DrawModePrimitive _primitive, RenderObject *_obj) const
 Set shaders, textures and uniforms as provided by user to a render-object. More...
 

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 draw_with_offset_
 
Draw-mesh handling
DrawMeshT< Mesh > * drawMesh_
 

Mesh Handling

Meshmesh_
 The mesh this node works on.
 
const Meshmesh () 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) override
 Current bounding box. More...
 

Normal Buffer

bool enableNormals_
 Flag if normals should be used.
 
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_
 Returns if the color array is currently activated.
 
bool colorsEnabled ()
 Returns if the color array is currently activated.
 
void enableColors (bool _enable)
 Enable or disable the use of color array.
 

Array control functions

enum  ArrayType {
  NONE = 0, PER_EDGE_VERTEX_ARRAY = 1, PER_EDGE_COLOR_ARRAY = 2, PER_HALFEDGE_VERTEX_ARRAY = 4,
  PER_HALFEDGE_COLOR_ARRAY = 8
}
 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 More...
 

Rendering functions

VertexDeclaration halfedgeDecl
 Draws the object. More...
 
void draw (GLState &_state, const DrawModes::DrawMode &_drawMode) override
 Draws the object. More...
 
void getRenderObjects (IRenderer *_renderer, GLState &_state, const DrawModes::DrawMode &_drawMode, const Material *_mat) override
 Draws the object deferred. More...
 
DrawMeshT< Mesh > * getDrawMesh ()
 Get DrawMesh instance.
 
ACG::SceneGraph::DrawModes::DrawMode availableDrawModes () const override
 return available draw modes More...
 
void draw_vertices ()
 draws all vertices of the mesh More...
 
void add_point_RenderObjects (IRenderer *_renderer, const RenderObject *_baseObj)
 Draws the object. More...
 
void draw_lines ()
 draws all edges of the mesh More...
 
void draw_halfedges ()
 draws all halfedges of the mesh More...
 
void draw_faces ()
 draws all faces of the mesh More...
 
void add_face_RenderObjects (IRenderer *_renderer, const RenderObject *_baseObj, bool _nonindexed=false)
 Draws the object. More...
 

vertex picking functions

bool updateVertexPicking_
 Flag indicating if the vertex picking has to be updated.
 
size_t vertexPickingBaseIndex_
 Index of the first vertex in vertexpicking.
 
void pick_vertices (GLState &_state, bool _front=false)
 Renders picking for vertices _front: Only render front vertices (not occluded by geometry)
 

edge picking functions

bool updateEdgePicking_
 Flag indicating if the edge picking has to be updated.
 
size_t edgePickingBaseIndex_
 Index of the first edge in edgepicking.
 
void pick_edges (GLState &_state, bool _front=false)
 Renders picking for edges _front: Only render front edges (not occluded by geometry)
 

face picking functions

bool updateFacePicking_
 Flag indicating if the edge picking has to be updated.
 
size_t facePickingBaseIndex_
 Index of the first face in facepicking.
 
void pick_faces (GLState &_state)
 Renders picking for faces _front: Only render front faces (not occluded by geometry)
 

anything picking functions

bool updateAnyPicking_
 Flag indicating if the any picking has to be updated.
 
size_t anyPickingBaseIndex_
 Index of the first face in anypicking.
 
void pick_any (GLState &_state)
 Renders picking for all primitives. More...
 

Texture handling

bool perFaceTextureIndexAvailable_
 This flag indicates if we have a per Face texture index 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 More...
 
const std::string & indexPropertyName () const
 Get current texture index property name.
 
void setHalfedgeTextcoordPropertyName (std::string _halfedgeTextcoordPropertyName)
 Set the name of the per face texture coordinate property. More...
 
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. More...
 

Additional Inherited Members

- Public Types inherited from ACG::SceneGraph::BaseNode
enum  StatusMode { Active = 0x1, HideNode = 0x2, HideChildren = 0x4, HideSubtree = 0x8 }
 Status modi. More...
 
enum  TraverseMode { NodeFirst = 0x1, ChildrenFirst = 0x2, SecondPass = 0x4 }
 Node traverse types. More...
 
typedef std::vector< BaseNode * >::const_iterator ConstChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::iterator ChildIter
 allows to iterate over children
 
typedef std::vector< BaseNode * >::const_reverse_iterator ConstChildRIter
 allows to reverse iterate over children
 
typedef std::vector< BaseNode * >::reverse_iterator ChildRIter
 allows to reverse iterate over children
 
enum  PASSES {
  NOPASS = 0, ALLPASSES = 1 << 0, PASS_1 = 1 << 1, PASS_2 = 1 << 2,
  PASS_3 = 1 << 3, PASS_4 = 1 << 4, PASS_5 = 1 << 5, PASS_6 = 1 << 6,
  PASS_7 = 1 << 7, PASS_8 = 1 << 8
}
 This enum should be used to enable rendering of a node in different.
 
typedef unsigned int MultipassBitMask
 Multipass pass bit mask type.
 
- Protected Member Functions inherited from ACG::SceneGraph::MeshNodeBase
 MeshNodeBase (BaseNode *_parent, std::string _name)
 
void supplyDrawMesh (DrawMeshBase *drawMeshBase)
 
- Protected Attributes inherited from ACG::SceneGraph::MeshNodeBase
DrawMeshBasedrawMeshBase_
 
GLuint polyEdgeBuf_
 
int polyEdgeBufSize_
 
GLuint polyEdgeBufTex_
 

Detailed Description

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

This node draws a mesh using triangle strips.

Definition at line 104 of file MeshNode2T.hh.

Member Typedef Documentation

◆ Point

template<class Mesh>
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 158 of file MeshNode2T.hh.

Constructor & Destructor Documentation

◆ MeshNodeT()

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

Default constructor.

The constructor needs a mesh on which this node will work.

Todo:
: Handle vbo not supported

Definition at line 76 of file MeshNode2T_impl.hh.

Member Function Documentation

◆ add_face_RenderObjects()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::add_face_RenderObjects ( IRenderer _renderer,
const RenderObject _baseObj,
bool  _nonindexed = false 
)
private

Draws the object.

get bound texture buffer and target

Todo:
We can render also wireframe shaded and with vertex colors
Todo:
Integrate shader here!

Definition at line 993 of file MeshNode2T_impl.hh.

◆ add_point_RenderObjects()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::add_point_RenderObjects ( IRenderer _renderer,
const RenderObject _baseObj 
)
inlineprivate

Draws the object.

get bound texture buffer and target

Todo:
We can render also wireframe shaded and with vertex colors
Todo:
Integrate shader here!

Definition at line 946 of file MeshNode2T_impl.hh.

◆ availableDrawModes()

template<class Mesh >
DrawModes::DrawMode ACG::SceneGraph::MeshNodeT< Mesh >::availableDrawModes ( ) const
overridevirtual

return available draw modes

The drawmodes are constructed based on the mesh properties and the hardware capabilities of the system.

Reimplemented from ACG::SceneGraph::BaseNode.

Definition at line 117 of file MeshNode2T_impl.hh.

◆ boundingBox()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::boundingBox ( Vec3d _bbMin,
Vec3d _bbMax 
)
overridevirtual

Current bounding box.

This function returns the bounding box of the node.

Reimplemented from ACG::SceneGraph::BaseNode.

Definition at line 194 of file MeshNode2T_impl.hh.

◆ draw()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw ( GLState _state,
const DrawModes::DrawMode _drawMode 
)
overridevirtual

Draws the object.

get bound texture buffer and target

Todo:
We can render also wireframe shaded and with vertex colors
Todo:
Integrate shader here!

Reimplemented from ACG::SceneGraph::BaseNode.

Definition at line 202 of file MeshNode2T_impl.hh.

◆ draw_faces()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw_faces ( )
private

draws all faces of the mesh

Definition at line 986 of file MeshNode2T_impl.hh.

◆ draw_halfedges()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw_halfedges ( )
inlineprivate

draws all halfedges of the mesh

Definition at line 974 of file MeshNode2T_impl.hh.

◆ draw_lines()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw_lines ( )
inlineprivate

draws all edges of the mesh

Definition at line 960 of file MeshNode2T_impl.hh.

◆ draw_vertices()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::draw_vertices ( )
inlineprivate

draws all vertices of the mesh

Definition at line 953 of file MeshNode2T_impl.hh.

◆ enable_arrays()

template<class 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

Definition at line 1000 of file MeshNode2T_impl.hh.

◆ getRenderObjects()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::getRenderObjects ( IRenderer _renderer,
GLState _state,
const DrawModes::DrawMode _drawMode,
const Material _mat 
)
overridevirtual

Draws the object deferred.

Reimplemented from ACG::SceneGraph::BaseNode.

Definition at line 672 of file MeshNode2T_impl.hh.

◆ pick()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::pick ( GLState _state,
PickTarget  _target 
)
overridevirtual

Draws the object in picking mode.

Reimplemented from ACG::SceneGraph::BaseNode.

Definition at line 1112 of file MeshNode2T_impl.hh.

◆ pick_any()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::pick_any ( GLState _state)
private

Renders picking for all primitives.

Definition at line 1456 of file MeshNode2T_impl.hh.

◆ set_property_map()

template<class Mesh>
void ACG::SceneGraph::MeshNodeT< Mesh >::set_property_map ( std::map< int, std::string > *  _map)
inline
Todo:
Remove all these functions afterwards!

Definition at line 493 of file MeshNode2T.hh.

◆ setHalfedgeTextcoordPropertyName()

template<class Mesh >
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.

Definition at line 1655 of file MeshNode2T_impl.hh.

◆ setIndexPropertyName()

template<class Mesh >
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.

Todo:
Remove the external texture loading and do it here.

Definition at line 1638 of file MeshNode2T_impl.hh.

◆ setTextureMap()

template<class Mesh>
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.

Parameters
_mapmaps 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 478 of file MeshNode2T.hh.

◆ update_color()

template<class Mesh >
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

Definition at line 1624 of file MeshNode2T_impl.hh.

◆ update_geometry()

template<class Mesh >
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.

Todo:
check the following statements. If only geometry changed, the normals,vertices have to be updated nothing else!

Definition at line 1559 of file MeshNode2T_impl.hh.

◆ update_textures()

template<class Mesh >
void ACG::SceneGraph::MeshNodeT< Mesh >::update_textures ( )

force an texture update

This function has to be called, when the textures have changed

Definition at line 1611 of file MeshNode2T_impl.hh.

◆ update_topology()

template<class Mesh >
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

Definition at line 1596 of file MeshNode2T_impl.hh.

Member Data Documentation

◆ halfedgeDecl

template<class Mesh>
VertexDeclaration ACG::SceneGraph::MeshNodeT< Mesh >::halfedgeDecl
private

Draws the object.

get bound texture buffer and target

Todo:
We can render also wireframe shaded and with vertex colors
Todo:
Integrate shader here!

Definition at line 340 of file MeshNode2T.hh.


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