List of all members.
Classes |
class | DatabaseRequestHandler |
class | ImageRequestHandler |
Public Types |
enum | TraversalMode { TRAVERSE_NONE,
TRAVERSE_PARENTS,
TRAVERSE_ALL_CHILDREN,
TRAVERSE_ACTIVE_CHILDREN
} |
enum | VisitorType {
NODE_VISITOR = 0,
UPDATE_VISITOR,
EVENT_VISITOR,
COLLECT_OCCLUDER_VISITOR,
CULL_VISITOR
} |
Public Member Functions |
| NodeVisitor (TraversalMode tm=TRAVERSE_NONE) |
| NodeVisitor (VisitorType type, TraversalMode tm=TRAVERSE_NONE) |
virtual | ~NodeVisitor () |
virtual const char * | libraryName () const |
virtual const char * | className () const |
virtual void | reset () |
void | setVisitorType (VisitorType type) |
VisitorType | getVisitorType () const |
void | setTraversalNumber (int fn) |
int | getTraversalNumber () const |
void | setFrameStamp (FrameStamp *fs) |
const FrameStamp * | getFrameStamp () const |
void | setTraversalMask (Node::NodeMask mask) |
Node::NodeMask | getTraversalMask () const |
void | setNodeMaskOverride (Node::NodeMask mask) |
Node::NodeMask | getNodeMaskOverride () const |
bool | validNodeMask (const osg::Node &node) const |
void | setTraversalMode (TraversalMode mode) |
TraversalMode | getTraversalMode () const |
void | setUserData (Referenced *obj) |
Referenced * | getUserData () |
const Referenced * | getUserData () const |
void | traverse (Node &node) |
void | pushOntoNodePath (Node *node) |
void | popFromNodePath () |
NodePath & | getNodePath () |
const NodePath & | getNodePath () const |
virtual osg::Vec3 | getEyePoint () const |
virtual osg::Vec3 | getViewPoint () const |
virtual float | getDistanceToEyePoint (const Vec3 &, bool) const |
virtual float | getDistanceFromEyePoint (const Vec3 &, bool) const |
virtual float | getDistanceToViewPoint (const Vec3 &, bool) const |
virtual void | apply (Node &node) |
virtual void | apply (Geode &node) |
virtual void | apply (Billboard &node) |
virtual void | apply (Group &node) |
virtual void | apply (ProxyNode &node) |
virtual void | apply (Projection &node) |
virtual void | apply (CoordinateSystemNode &node) |
virtual void | apply (ClipNode &node) |
virtual void | apply (TexGenNode &node) |
virtual void | apply (LightSource &node) |
virtual void | apply (Transform &node) |
virtual void | apply (Camera &node) |
virtual void | apply (CameraView &node) |
virtual void | apply (MatrixTransform &node) |
virtual void | apply (PositionAttitudeTransform &node) |
virtual void | apply (Switch &node) |
virtual void | apply (Sequence &node) |
virtual void | apply (LOD &node) |
virtual void | apply (PagedLOD &node) |
virtual void | apply (ClearNode &node) |
virtual void | apply (OccluderNode &node) |
virtual void | apply (OcclusionQueryNode &node) |
void | setDatabaseRequestHandler (DatabaseRequestHandler *handler) |
DatabaseRequestHandler * | getDatabaseRequestHandler () |
const DatabaseRequestHandler * | getDatabaseRequestHandler () const |
void | setImageRequestHandler (ImageRequestHandler *handler) |
ImageRequestHandler * | getImageRequestHandler () |
const ImageRequestHandler * | getImageRequestHandler () const |
Protected Attributes |
VisitorType | _visitorType |
int | _traversalNumber |
ref_ptr< FrameStamp > | _frameStamp |
TraversalMode | _traversalMode |
Node::NodeMask | _traversalMask |
Node::NodeMask | _nodeMaskOverride |
NodePath | _nodePath |
ref_ptr< Referenced > | _userData |
ref_ptr< DatabaseRequestHandler > | _databaseRequestHandler |
ref_ptr< ImageRequestHandler > | _imageRequestHandler |
Detailed Description
Visitor for type safe operations on osg::Nodes. Based on GOF's Visitor pattern. The NodeVisitor is useful for developing type safe operations to nodes in the scene graph (as per Visitor pattern), and adds to this support for optional scene graph traversal to allow operations to be applied to whole scenes at once. The Visitor pattern uses a technique of double dispatch as a mechanism to call the appropriate apply(..) method of the NodeVisitor. To use this feature one must use the Node::accept(NodeVisitor) which is extended in each Node subclass, rather than the NodeVisitor apply directly. So use root->accept(myVisitor); instead of myVisitor.apply(*root). The later method will bypass the double dispatch and the appropriate NodeVisitor::apply(..) method will not be called.
Member Enumeration Documentation
- Enumerator:
TRAVERSE_NONE |
|
TRAVERSE_PARENTS |
|
TRAVERSE_ALL_CHILDREN |
|
TRAVERSE_ACTIVE_CHILDREN |
|
- Enumerator:
NODE_VISITOR |
|
UPDATE_VISITOR |
|
EVENT_VISITOR |
|
COLLECT_OCCLUDER_VISITOR |
|
CULL_VISITOR |
|
Constructor & Destructor Documentation
osg::NodeVisitor::NodeVisitor |
( |
TraversalMode |
tm = TRAVERSE_NONE |
) |
|
virtual osg::NodeVisitor::~NodeVisitor |
( |
|
) |
[virtual] |
Member Function Documentation
virtual void osg::NodeVisitor::apply |
( |
Node & |
node |
) |
[virtual] |
Reimplemented in osg::ComputeBoundsVisitor, osgAnimation::BoneMapVisitor, osgAnimation::LinkVisitor, osgDB::SharedStateManager, osgGA::EventVisitor, osgSim::InsertImpostorsVisitor, osgUtil::DisplayRequirementsVisitor, osgUtil::GLObjectsVisitor, osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::Optimizer::StateVisitor, osgUtil::Optimizer::CopySharedSubgraphsVisitor, osgUtil::Optimizer::TextureVisitor, osgUtil::Optimizer::TextureAtlasVisitor, osgUtil::Optimizer::StaticObjectDetectionVisitor, osgUtil::StatsVisitor, and osgUtil::UpdateVisitor.
Referenced by osgParticle::Program::accept(), osgParticle::PrecipitationEffect::accept(), osgParticle::ParticleProcessor::accept(), osgParticle::ParticleEffect::accept(), and osgParticle::Emitter::accept().
virtual void osg::NodeVisitor::apply |
( |
Billboard & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Group & |
node |
) |
[virtual] |
Reimplemented in osgGA::EventVisitor, osgSim::InsertImpostorsVisitor, osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::RemoveEmptyNodesVisitor, osgUtil::Optimizer::RemoveRedundantNodesVisitor, osgUtil::Optimizer::MergeGeodesVisitor, osgUtil::Optimizer::SpatializeGroupsVisitor, osgUtil::StatsVisitor, and osgUtil::UpdateVisitor.
virtual void osg::NodeVisitor::apply |
( |
ProxyNode & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Projection & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
ClipNode & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
TexGenNode & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
LightSource & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Transform & |
node |
) |
[virtual] |
Reimplemented in osg::ComputeBoundsVisitor, osgAnimation::BoneMapVisitor, osgAnimation::RigGeometry::FindNearestParentSkeleton, osgGA::EventVisitor, osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::RemoveRedundantNodesVisitor, osgUtil::StatsVisitor, and osgUtil::UpdateVisitor.
virtual void osg::NodeVisitor::apply |
( |
LOD & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Camera & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
CameraView & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Switch & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Sequence & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
Geode & |
node |
) |
[virtual] |
Reimplemented in osg::ComputeBoundsVisitor, osg::KdTreeBuilder, osgAnimation::LinkVisitor, osgDB::SharedStateManager, osgGA::EventVisitor, osgUtil::DisplayRequirementsVisitor, osgUtil::DrawElementTypeSimplifierVisitor, osgUtil::GLObjectsVisitor, osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::RemoveEmptyNodesVisitor, osgUtil::Optimizer::TessellateVisitor, osgUtil::Optimizer::StateVisitor, osgUtil::Optimizer::CheckGeometryVisitor, osgUtil::Optimizer::MergeGeometryVisitor, osgUtil::Optimizer::SpatializeGroupsVisitor, osgUtil::Optimizer::TextureVisitor, osgUtil::Optimizer::TextureAtlasVisitor, osgUtil::Optimizer::StaticObjectDetectionVisitor, osgUtil::Simplifier, osgUtil::SmoothingVisitor, osgUtil::StatsVisitor, osgUtil::TriStripVisitor, and osgUtil::UpdateVisitor.
virtual void osg::NodeVisitor::apply |
( |
PagedLOD & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
ClearNode & |
node |
) |
[virtual] |
virtual void osg::NodeVisitor::apply |
( |
OccluderNode & |
node |
) |
[virtual] |
virtual const char* osg::NodeVisitor::className |
( |
|
) |
const [inline, virtual] |
return the name of the visitor's class type. Should be defined by derived classes.
Get the handler for database requests.
Get the const handler for database requests.
virtual float osg::NodeVisitor::getDistanceFromEyePoint |
( |
const Vec3 & |
, |
|
|
bool |
| |
|
) |
| | const [inline, virtual] |
Get the distance of a point from the eye point, distance value in the eye coordinate system. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceFromEyePoint(pos) is not implemented than a default value of 0.0 is returned.
virtual float osg::NodeVisitor::getDistanceToEyePoint |
( |
const Vec3 & |
, |
|
|
bool |
| |
|
) |
| | const [inline, virtual] |
Get the distance from a point to the eye point, distance value in local coordinate system. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceFromEyePoint(pos) is not implemented then a default value of 0.0 is returned.
Reimplemented in osgUtil::IntersectionVisitor, and osgUtil::IntersectVisitor.
virtual float osg::NodeVisitor::getDistanceToViewPoint |
( |
const Vec3 & |
, |
|
|
bool |
| |
|
) |
| | const [inline, virtual] |
Get the distance from a point to the view point, distance value in local coordinate system. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement. If the getDistanceToViewPoint(pos) is not implemented then a default value of 0.0 is returned.
virtual osg::Vec3 osg::NodeVisitor::getEyePoint |
( |
|
) |
const [inline, virtual] |
const FrameStamp* osg::NodeVisitor::getFrameStamp |
( |
|
) |
const [inline] |
Get the FrameStamp that this traversal is associated with.
Get the const handler for image requests.
Get the handler for image requests.
Node::NodeMask osg::NodeVisitor::getNodeMaskOverride |
( |
|
) |
const [inline] |
Get the NodeMaskOverride mask.
NodePath& osg::NodeVisitor::getNodePath |
( |
|
) |
[inline] |
const NodePath& osg::NodeVisitor::getNodePath |
( |
|
) |
const [inline] |
Get the const NodePath from the top most node applied down to the current Node being visited.
TraversalMode osg::NodeVisitor::getTraversalMode |
( |
|
) |
const [inline] |
int osg::NodeVisitor::getTraversalNumber |
( |
|
) |
const [inline] |
Get the traversal number. Typically used to denote the frame count.
Referenced* osg::NodeVisitor::getUserData |
( |
|
) |
[inline] |
const Referenced* osg::NodeVisitor::getUserData |
( |
|
) |
const [inline] |
virtual osg::Vec3 osg::NodeVisitor::getViewPoint |
( |
|
) |
const [inline, virtual] |
Get the view point in local coordinates. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.
VisitorType osg::NodeVisitor::getVisitorType |
( |
|
) |
const [inline] |
virtual const char* osg::NodeVisitor::libraryName |
( |
|
) |
const [inline, virtual] |
return the library name/namespapce of the visitor's. Should be defined by derived classes.
void osg::NodeVisitor::popFromNodePath |
( |
|
) |
[inline] |
void osg::NodeVisitor::pushOntoNodePath |
( |
Node * |
node |
) |
[inline] |
virtual void osg::NodeVisitor::reset |
( |
|
) |
[inline, virtual] |
Set the handler for database requests.
void osg::NodeVisitor::setFrameStamp |
( |
FrameStamp * |
fs |
) |
[inline] |
Set the FrameStamp that this traversal is associated with.
Set the handler for image requests.
void osg::NodeVisitor::setNodeMaskOverride |
( |
Node::NodeMask |
mask |
) |
[inline] |
void osg::NodeVisitor::setTraversalMask |
( |
Node::NodeMask |
mask |
) |
[inline] |
void osg::NodeVisitor::setTraversalMode |
( |
TraversalMode |
mode |
) |
[inline] |
Set the traversal mode for Node::traverse() to use when deciding which children of a node to traverse. If a NodeVisitor has been attached via setTraverseVisitor() and the new mode is not TRAVERSE_VISITOR then the attached visitor is detached. Default mode is TRAVERSE_NONE.
void osg::NodeVisitor::setTraversalNumber |
( |
int |
fn |
) |
[inline] |
Set the traversal number. Typically used to denote the frame count.
void osg::NodeVisitor::setUserData |
( |
Referenced * |
obj |
) |
[inline] |
Set user data, data must be subclassed from Referenced to allow automatic memory handling. If your own data isn't directly subclassed from Referenced then create an adapter object which points to your own objects and handles the memory addressing.
void osg::NodeVisitor::setVisitorType |
( |
VisitorType |
type |
) |
[inline] |
Set the VisitorType, used to distinguish different visitors during traversal of the scene, typically used in the Node::traverse() method to select which behaviour to use for different types of traversal/visitors.
void osg::NodeVisitor::traverse |
( |
Node & |
node |
) |
[inline] |
Method for handling traversal of a nodes. If you intend to use the visitor for actively traversing the scene graph then make sure the accept() methods call this method unless they handle traversal directly.
References osg::Node::ascend(), and osg::Node::traverse().
bool osg::NodeVisitor::validNodeMask |
( |
const osg::Node & |
node |
) |
const [inline] |
Member Data Documentation
The documentation for this class was generated from the following file: