Moved the apply(&) default implementations from the header into the NodeVisitor.cpp,

and changed the casts to use static_cast<>.
This commit is contained in:
Robert Osfield 2008-06-27 12:35:56 +00:00
parent 46931464ef
commit 34f58482e6
2 changed files with 153 additions and 22 deletions

View File

@ -228,36 +228,36 @@ class OSG_EXPORT NodeVisitor : public virtual Referenced
virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; } virtual float getDistanceToViewPoint(const Vec3& /*pos*/, bool /*useLODScale*/) const { return 0.0f; }
virtual void apply(Node& node) { traverse(node);} virtual void apply(Node& node);
virtual void apply(Geode& node) { apply((Node&)node); } virtual void apply(Geode& node);
virtual void apply(Billboard& node) { apply((Geode&)node); } virtual void apply(Billboard& node);
virtual void apply(Group& node) { apply((Node&)node); } virtual void apply(Group& node);
virtual void apply(ProxyNode& node) { apply((Group&)node); } virtual void apply(ProxyNode& node);
virtual void apply(Projection& node) { apply((Group&)node); } virtual void apply(Projection& node);
virtual void apply(CoordinateSystemNode& node) { apply((Group&)node); } virtual void apply(CoordinateSystemNode& node);
virtual void apply(ClipNode& node) { apply((Group&)node); } virtual void apply(ClipNode& node);
virtual void apply(TexGenNode& node) { apply((Group&)node); } virtual void apply(TexGenNode& node);
virtual void apply(LightSource& node) { apply((Group&)node); } virtual void apply(LightSource& node);
virtual void apply(Transform& node) { apply((Group&)node); } virtual void apply(Transform& node);
virtual void apply(Camera& node) { apply((Transform&)node); } virtual void apply(Camera& node);
virtual void apply(CameraView& node) { apply((Transform&)node); } virtual void apply(CameraView& node);
virtual void apply(MatrixTransform& node) { apply((Transform&)node); } virtual void apply(MatrixTransform& node);
virtual void apply(PositionAttitudeTransform& node) { apply((Transform&)node); } virtual void apply(PositionAttitudeTransform& node);
virtual void apply(Switch& node) { apply((Group&)node); } virtual void apply(Switch& node);
virtual void apply(Sequence& node) { apply((Group&)node); } virtual void apply(Sequence& node);
virtual void apply(LOD& node) { apply((Group&)node); } virtual void apply(LOD& node);
virtual void apply(PagedLOD& node) { apply((LOD&)node); } virtual void apply(PagedLOD& node);
virtual void apply(ClearNode& node) { apply((Group&)node); } virtual void apply(ClearNode& node);
virtual void apply(OccluderNode& node) { apply((Group&)node); } virtual void apply(OccluderNode& node);
virtual void apply(OcclusionQueryNode& node) { apply((Group&)node); } virtual void apply(OcclusionQueryNode& node);
/** Callback for managing database paging, such as generated by PagedLOD nodes.*/ /** Callback for managing database paging, such as generated by PagedLOD nodes.*/

View File

@ -11,7 +11,29 @@
* OpenSceneGraph Public License for more details. * OpenSceneGraph Public License for more details.
*/ */
#include <osg/NodeVisitor> #include <osg/NodeVisitor>
#include <osg/Billboard>
#include <osg/ClearNode>
#include <osg/ClipNode>
#include <osg/CoordinateSystemNode>
#include <osg/Geode>
#include <osg/Group>
#include <osg/LightSource>
#include <osg/LOD>
#include <osg/MatrixTransform>
#include <osg/OccluderNode>
#include <osg/OcclusionQueryNode>
#include <osg/PagedLOD>
#include <osg/PositionAttitudeTransform>
#include <osg/Projection>
#include <osg/ProxyNode>
#include <osg/Sequence>
#include <osg/Switch>
#include <osg/TexGenNode>
#include <osg/Transform> #include <osg/Transform>
#include <osg/Camera>
#include <osg/CameraView>
#include <stdlib.h> #include <stdlib.h>
using namespace osg; using namespace osg;
@ -44,3 +66,112 @@ NodeVisitor::~NodeVisitor()
// if (_traversalVisitor) detach from _traversalVisitor; // if (_traversalVisitor) detach from _traversalVisitor;
} }
void NodeVisitor::apply(Node& node)
{
traverse(node);
}
void NodeVisitor::apply(Geode& node)
{
apply(static_cast<Node&>(node));
}
void NodeVisitor::apply(Billboard& node)
{
apply(static_cast<Geode&>(node));
}
void NodeVisitor::apply(Group& node)
{
apply(static_cast<Node&>(node));
}
void NodeVisitor::apply(ProxyNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(Projection& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(CoordinateSystemNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(ClipNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(TexGenNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(LightSource& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(Transform& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(Camera& node)
{
apply(static_cast<Transform&>(node));
}
void NodeVisitor::apply(CameraView& node)
{
apply(static_cast<Transform&>(node));
}
void NodeVisitor::apply(MatrixTransform& node)
{
apply(static_cast<Transform&>(node));
}
void NodeVisitor::apply(PositionAttitudeTransform& node)
{
apply(static_cast<Transform&>(node));
}
void NodeVisitor::apply(Switch& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(Sequence& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(LOD& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(PagedLOD& node)
{
apply(static_cast<LOD&>(node));
}
void NodeVisitor::apply(ClearNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(OccluderNode& node)
{
apply(static_cast<Group&>(node));
}
void NodeVisitor::apply(OcclusionQueryNode& node)
{
apply(static_cast<Group&>(node));
}