Introduce NodeVisitor::className and libraryName()
This commit is contained in:
@@ -31,6 +31,8 @@ class OSG_EXPORT CollectOccludersVisitor : public osg::NodeVisitor, public osg::
|
||||
CollectOccludersVisitor();
|
||||
virtual ~CollectOccludersVisitor();
|
||||
|
||||
META_NodeVisitor("osg","CollectOccludersVisitor")
|
||||
|
||||
virtual CollectOccludersVisitor* cloneType() const { return new CollectOccludersVisitor(); }
|
||||
|
||||
virtual void reset();
|
||||
|
||||
@@ -26,6 +26,8 @@ public:
|
||||
|
||||
ComputeBoundsVisitor(TraversalMode traversalMode = TRAVERSE_ALL_CHILDREN);
|
||||
|
||||
META_NodeVisitor("osg","ComputeBoundsVisitor")
|
||||
|
||||
virtual void reset();
|
||||
|
||||
osg::BoundingBox& getBoundingBox() { return _bb; }
|
||||
|
||||
@@ -175,6 +175,8 @@ class OSG_EXPORT KdTreeBuilder : public osg::NodeVisitor
|
||||
|
||||
KdTreeBuilder(const KdTreeBuilder& rhs);
|
||||
|
||||
META_NodeVisitor("osg","KdTreeBuilder")
|
||||
|
||||
virtual KdTreeBuilder* clone() { return new KdTreeBuilder(*this); }
|
||||
|
||||
void apply(osg::Geode& geode);
|
||||
|
||||
@@ -42,6 +42,10 @@ class Transform;
|
||||
class Camera;
|
||||
class CameraView;
|
||||
|
||||
#define META_NodeVisitor(library,name) \
|
||||
virtual const char* libraryName() const { return #library; }\
|
||||
virtual const char* className() const { return #name; }
|
||||
|
||||
/** 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
|
||||
@@ -82,6 +86,12 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
|
||||
NodeVisitor(VisitorType type,TraversalMode tm=TRAVERSE_NONE);
|
||||
|
||||
virtual ~NodeVisitor();
|
||||
|
||||
/** return the library name/namespapce of the visitor's. Should be defined by derived classes.*/
|
||||
virtual const char* libraryName() const { return "osg"; }
|
||||
|
||||
/** return the name of the visitor's class type. Should be defined by derived classes.*/
|
||||
virtual const char* className() const { return "NodeVisitor"; }
|
||||
|
||||
/** Method to call to reset visitor. Useful if your visitor accumulates
|
||||
state during a traversal, and you plan to reuse the visitor.
|
||||
|
||||
Reference in New Issue
Block a user