version 3.3

VRS::SceneNodeVisitor Class Reference

Visitor for Scene Graphs and Behavior Graphs. More...

#include <vrs/scenenodevisitor.h>

Inheritance diagram for VRS::SceneNodeVisitor:

VRS::SharedObj VRS::Visitable VRS::CalcTangentsAndBinormals VRS::ClearTextureCoordinates VRS::FindParentsVisitor VRS::FindTexturedMeshes

List of all members.

Public Types

enum  TraversalFlag { Stop, Continue }

Public Member Functions

 SceneNodeVisitor ()
 VRS_SERIALIZABLE_CLASS_ENUM (TraversalFlag)
virtual TraversalFlag visitBehavior (SharedObj *obj)
virtual TraversalFlag visitScene (SharedObj *obj, bool pushHint)
virtual void pathPush (SharedObj *object)
virtual void pathPop ()
unsigned int pathLength () const
SharedObjpathObject (unsigned int index) const
 VRS_TYPEINFO (SceneNodeVisitor, SharedObj)


Detailed Description

Visitor for Scene Graphs and Behavior Graphs.

Member Enumeration Documentation

Enumerator:
Stop 
Continue 


Constructor & Destructor Documentation

VRS::SceneNodeVisitor::SceneNodeVisitor (  ) 

A visitor object is usually passed as parameter to the SceneNode::traverse methode of scene graphs. The scene graph nodes pass the visitor object through the graph, and call for each encountered node the visit method. Subclasses of the Visitor class overload the visit method to implement the visitor's concrete functionality.


Member Function Documentation

VRS::SceneNodeVisitor::VRS_SERIALIZABLE_CLASS_ENUM ( TraversalFlag   ) 

virtual TraversalFlag VRS::SceneNodeVisitor::visitBehavior ( SharedObj obj  )  [virtual]

virtual TraversalFlag VRS::SceneNodeVisitor::visitScene ( SharedObj obj,
bool  pushHint 
) [virtual]

Overloaded by subclasses to implement the visiting functionality. The method returns a traversal flag which indicates whether to stop or to continue the traversal. The visitScene method is called twice for each object in a SceneGraph:

  • The first call with pushHint=true is done when the object is reached the first time in the traversal. This means when it is pushed to the engine (for attributes and transforms), when it is evaluated (for shapes), or when its subgraph traversal starts (for nodes).
    • The second call with pushHint=false is done when the object is reached the second time in the traversal. This mean when it is popped from the engine or when its subgraph traversal ends. We distinguish two visit methods: one for scene graphs, and one for behavior graphs. A specialized visitor class may only overloaded one of them.

Reimplemented in VRS::FindParentsVisitor.

virtual void VRS::SceneNodeVisitor::pathPush ( SharedObj object  )  [virtual]

virtual void VRS::SceneNodeVisitor::pathPop (  )  [virtual]

unsigned int VRS::SceneNodeVisitor::pathLength (  )  const

SharedObj* VRS::SceneNodeVisitor::pathObject ( unsigned int  index  )  const

While traversing a graph, `pathLength' returns the current depth of the traversal; the level at the root node is zero, and the path length is one. If the path is recorded, pathElement returns parent node at the i-th level. pathPush is called, if the traversal proceeds from a parent node to child nodes. popPath is called, if the traversal returns from child nodes to the parent node.

VRS::SceneNodeVisitor::VRS_TYPEINFO ( SceneNodeVisitor  ,
SharedObj   
)


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

Generated on Tue May 22 06:00:27 2012 by Doxygen 1.5.6
© 2001-2010 Hasso-Plattner-Institut | Impressum | Contact