OSG
3.4.0
|
#include <NodeVisitor.h>
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, INTERSECTION_VISITOR } |
![]() | |
enum | DataVariance { DYNAMIC, STATIC, UNSPECIFIED } |
Protected Attributes | |
VisitorType | _visitorType |
unsigned int | _traversalNumber |
ref_ptr< FrameStamp > | _frameStamp |
TraversalMode | _traversalMode |
Node::NodeMask | _traversalMask |
Node::NodeMask | _nodeMaskOverride |
NodePath | _nodePath |
ref_ptr< DatabaseRequestHandler > | _databaseRequestHandler |
ref_ptr< ImageRequestHandler > | _imageRequestHandler |
![]() | |
std::string | _name |
DataVariance | _dataVariance |
osg::UserDataContainer * | _userDataContainer |
![]() | |
OpenThreads::AtomicPtr | _observerSet |
OpenThreads::Atomic | _refCount |
Additional Inherited Members | |
![]() | |
static OpenThreads::Mutex * | getGlobalReferencedMutex () |
static void | setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting) |
static bool | getThreadSafeReferenceCounting () |
static void | setDeleteHandler (DeleteHandler *handler) |
static DeleteHandler * | getDeleteHandler () |
![]() | |
virtual | ~Object () |
![]() | |
virtual | ~Referenced () |
void | signalObserversAndDelete (bool signalDelete, bool doDelete) const |
void | deleteUsingDeleteHandler () const |
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.
Definition at line 67 of file NodeVisitor.h.
Enumerator | |
---|---|
TRAVERSE_NONE | |
TRAVERSE_PARENTS | |
TRAVERSE_ALL_CHILDREN | |
TRAVERSE_ACTIVE_CHILDREN |
Definition at line 71 of file NodeVisitor.h.
Enumerator | |
---|---|
NODE_VISITOR | |
UPDATE_VISITOR | |
EVENT_VISITOR | |
COLLECT_OCCLUDER_VISITOR | |
CULL_VISITOR | |
INTERSECTION_VISITOR |
Definition at line 79 of file NodeVisitor.h.
osg::NodeVisitor::NodeVisitor | ( | TraversalMode | tm = TRAVERSE_NONE | ) |
osg::NodeVisitor::NodeVisitor | ( | VisitorType | type, |
TraversalMode | tm = TRAVERSE_NONE |
||
) |
osg::NodeVisitor::NodeVisitor | ( | const NodeVisitor & | nv, |
const osg::CopyOp & | copyop = osg::CopyOp::SHALLOW_COPY |
||
) |
|
virtual |
Reimplemented in osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgUtil::GLObjectsVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::UpdateVisitor, osgUtil::StateToCompile, and osg::ComputeBoundsVisitor.
Reimplemented in osg::KdTreeBuilder.
Reimplemented in osgUtil::Optimizer::StaticObjectDetectionVisitor, osgUtil::Optimizer::TextureAtlasVisitor, osgUtil::Optimizer::TextureVisitor, osgUtil::Optimizer::CopySharedSubgraphsVisitor, osgUtil::Optimizer::StateVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgUtil::GLObjectsVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::ShaderGenVisitor, osgDB::SharedStateManager, osgUtil::DisplayRequirementsVisitor, osgUtil::UpdateVisitor, osgUtil::StateToCompile, osg::CollectOccludersVisitor, osgSim::InsertImpostorsVisitor, osgAnimation::LinkVisitor, osgAnimation::BoneMapVisitor, and osgUtil::PrintVisitor.
Reimplemented in osgUtil::Optimizer::StaticObjectDetectionVisitor, osgUtil::Optimizer::TextureAtlasVisitor, osgUtil::Optimizer::TextureVisitor, osgUtil::Optimizer::SpatializeGroupsVisitor, osgUtil::Optimizer::MergeGeometryVisitor, osgUtil::Optimizer::MakeFastGeometryVisitor, osgUtil::Optimizer::CheckGeometryVisitor, osgUtil::Optimizer::StateVisitor, osgUtil::Optimizer::TessellateVisitor, osgUtil::Optimizer::RemoveEmptyNodesVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgUtil::GLObjectsVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::Simplifier, osgUtil::VertexCacheMissVisitor, osgUtil::ShaderGenVisitor, osgUtil::UpdateVisitor, osgDB::SharedStateManager, osgUtil::TriStripVisitor, osgUtil::DisplayRequirementsVisitor, osgUtil::SmoothingVisitor, osgUtil::DrawElementTypeSimplifierVisitor, osgAnimation::LinkVisitor, and osgUtil::GeometryCollector.
Reimplemented in osgUtil::Optimizer::FlattenBillboardVisitor, osgUtil::Optimizer::MergeGeometryVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, and osgUtil::UpdateVisitor.
Reimplemented in osgUtil::Optimizer::SpatializeGroupsVisitor, osgUtil::Optimizer::MergeGeodesVisitor, osgUtil::Optimizer::RemoveRedundantNodesVisitor, osgUtil::Optimizer::RemoveEmptyNodesVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::UpdateVisitor, and osgSim::InsertImpostorsVisitor.
|
virtual |
|
virtual |
Reimplemented in osgUtil::CullVisitor.
|
virtual |
Reimplemented in osgUtil::CullVisitor.
|
virtual |
Reimplemented in osgUtil::CullVisitor, osgGA::EventVisitor, and osgUtil::UpdateVisitor.
Reimplemented in osgUtil::Optimizer::RemoveRedundantNodesVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::Optimizer::FlattenStaticTransformsVisitor, osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgAnimation::RigGeometry::FindNearestParentSkeleton, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::UpdateVisitor, osg::CollectOccludersVisitor, osg::ComputeBoundsVisitor, and osgAnimation::BoneMapVisitor.
Reimplemented in osgUtil::IntersectionVisitor, osgUtil::PickVisitor, and osgUtil::CullVisitor.
|
virtual |
|
virtual |
Reimplemented in osgUtil::Optimizer::CombineStaticTransformsVisitor.
|
virtual |
Reimplemented in osgUtil::Optimizer::CombineLODsVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::IntersectionVisitor, osgUtil::StatsVisitor, osgUtil::IntersectVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::UpdateVisitor, osg::CollectOccludersVisitor, and osgSim::InsertImpostorsVisitor.
Reimplemented in osgUtil::Optimizer::FlattenStaticTransformsVisitor, and osgUtil::IntersectionVisitor.
Reimplemented in osgUtil::CullVisitor.
|
virtual |
Reimplemented in osgUtil::CullVisitor, osgGA::EventVisitor, osgUtil::UpdateVisitor, and osg::CollectOccludersVisitor.
|
virtual |
Reimplemented in osgUtil::CullVisitor.
|
inlinevirtual |
convert 'const this' into a const NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0. Equivalent to dynamic_cast<const NodeVisitor*>(this).
Reimplemented from osg::Object.
Definition at line 105 of file NodeVisitor.h.
|
inline |
Get the handler for database requests.
Definition at line 290 of file NodeVisitor.h.
|
inline |
Get the const handler for database requests.
Definition at line 293 of file NodeVisitor.h.
|
inlinevirtual |
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.
Reimplemented in osgUtil::CullVisitor, and osg::CollectOccludersVisitor.
Definition at line 230 of file NodeVisitor.h.
|
inlinevirtual |
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, osgUtil::IntersectVisitor, osgUtil::CullVisitor, and osg::CollectOccludersVisitor.
Definition at line 225 of file NodeVisitor.h.
|
inlinevirtual |
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.
Reimplemented in osgUtil::CullVisitor, and osg::CollectOccludersVisitor.
Definition at line 235 of file NodeVisitor.h.
|
inlinevirtual |
Get the eye point in local coordinates. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.
Reimplemented in osgUtil::IntersectionVisitor, osgUtil::IntersectVisitor, and osgUtil::CullVisitor.
Definition at line 216 of file NodeVisitor.h.
|
inline |
Get the FrameStamp that this traversal is associated with.
Definition at line 133 of file NodeVisitor.h.
|
inline |
Get the handler for image requests.
Definition at line 318 of file NodeVisitor.h.
|
inline |
Get the const handler for image requests.
Definition at line 321 of file NodeVisitor.h.
|
inline |
Get the NodeMaskOverride mask.
Definition at line 158 of file NodeVisitor.h.
|
inline |
Get the non const NodePath from the top most node applied down to the current Node being visited.
Definition at line 208 of file NodeVisitor.h.
|
inline |
Get the const NodePath from the top most node applied down to the current Node being visited.
Definition at line 212 of file NodeVisitor.h.
|
inline |
Get the TraversalMask.
Definition at line 148 of file NodeVisitor.h.
|
inline |
Get the traversal mode.
Definition at line 179 of file NodeVisitor.h.
|
inline |
Get the traversal number. Typically used to denote the frame count.
Definition at line 127 of file NodeVisitor.h.
|
inlinevirtual |
Get the view point in local coordinates. Note, not all NodeVisitor implement this method, it is mainly cull visitors which will implement.
Reimplemented in osgUtil::CullVisitor.
Definition at line 220 of file NodeVisitor.h.
|
inline |
Get the VisitorType.
Definition at line 121 of file NodeVisitor.h.
|
inline |
Convert 'this' into a NodeVisitor pointer if Object is a NodeVisitor, otherwise return 0. Equivalent to dynamic_cast<NodeVisitor*>(this).
Definition at line 97 of file NodeVisitor.h.
|
inline |
Method called by osg::Node::accept() method after a call to NodeVisitor::apply(..). Note, the user does not typically call popFromNodePath() as it will be called automatically by the Node::accept() method.
Definition at line 204 of file NodeVisitor.h.
Method called by osg::Node::accept() method before a call to the NodeVisitor::apply(..). The back of the list will, therefore, be the current node being visited inside the apply(..), and the rest of the list will be the parental sequence of nodes from the top most node applied down the graph to the current node. Note, the user does not typically call pushNodeOnPath() as it will be called automatically by the Node::accept() method.
Definition at line 198 of file NodeVisitor.h.
|
inlinevirtual |
Method to call to reset visitor. Useful if your visitor accumulates state during a traversal, and you plan to reuse the visitor. To flush that state for the next traversal: call reset() prior to each traversal.
Reimplemented in osgUtil::Optimizer::TextureAtlasVisitor, osgUtil::Optimizer::FlattenBillboardVisitor, osgUtil::Optimizer::StateVisitor, osgUtil::Optimizer::FlattenStaticTransformsDuplicatingSharedSubgraphsVisitor, osgUtil::VertexCacheMissVisitor, osgUtil::ShaderGenVisitor, osgUtil::CullVisitor, osgGA::EventVisitor, osgSim::InsertImpostorsVisitor, osgAnimation::LinkVisitor, osg::CollectOccludersVisitor, and osgUtil::GeometryCollector.
Definition at line 112 of file NodeVisitor.h.
|
inline |
Set the handler for database requests.
Definition at line 287 of file NodeVisitor.h.
|
inline |
Set the FrameStamp that this traversal is associated with.
Definition at line 130 of file NodeVisitor.h.
|
inline |
Set the handler for image requests.
Definition at line 315 of file NodeVisitor.h.
|
inline |
Set the NodeMaskOverride mask. Used in validNodeMask() to determine whether to operate on a node or its subgraph, by OR'ing NodeVisitor::_nodeMaskOverride with the Node's own Node::_nodeMask. Typically used to force on nodes which may have been switched off by their own Node::_nodeMask.
Definition at line 155 of file NodeVisitor.h.
|
inline |
Set the TraversalMask of this NodeVisitor. The TraversalMask is used by the NodeVisitor::validNodeMask() method to determine whether to operate on a node and its subgraph. validNodeMask() is called automatically in the Node::accept() method before any call to NodeVisitor::apply(), apply() is only ever called if validNodeMask returns true. Note, if NodeVisitor::_traversalMask is 0 then all operations will be switched off for all nodes. Whereas setting both _traversalMask and _nodeMaskOverride to 0xffffffff will allow a visitor to work on all nodes regardless of their own Node::_nodeMask state.
Definition at line 145 of file NodeVisitor.h.
|
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.
Definition at line 176 of file NodeVisitor.h.
|
inline |
Set the traversal number. Typically used to denote the frame count.
Definition at line 124 of file NodeVisitor.h.
|
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.
Definition at line 118 of file NodeVisitor.h.
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.
Definition at line 185 of file NodeVisitor.h.
|
inline |
Method to called by Node and its subclass' Node::accept() method, if the result is true it is used to cull operations of nodes and their subgraphs. Return true if the result of a bit wise and of the NodeVisitor::_traversalMask with the bit or between NodeVistor::_nodeMaskOverride and the Node::_nodeMask. default values for _traversalMask is 0xffffffff, _nodeMaskOverride is 0x0, and osg::Node::_nodeMask is 0xffffffff.
Definition at line 166 of file NodeVisitor.h.
|
protected |
Definition at line 338 of file NodeVisitor.h.
|
protected |
Definition at line 330 of file NodeVisitor.h.
|
protected |
Definition at line 339 of file NodeVisitor.h.
|
protected |
Definition at line 334 of file NodeVisitor.h.
|
protected |
Definition at line 336 of file NodeVisitor.h.
|
protected |
Definition at line 333 of file NodeVisitor.h.
|
protected |
Definition at line 332 of file NodeVisitor.h.
|
protected |
Definition at line 328 of file NodeVisitor.h.
|
protected |
Definition at line 327 of file NodeVisitor.h.