diff --git a/components/debug/debugdraw.cpp b/components/debug/debugdraw.cpp index c757d4c364..bbbf2c238e 100644 --- a/components/debug/debugdraw.cpp +++ b/components/debug/debugdraw.cpp @@ -322,7 +322,7 @@ namespace Debug } Debug::DebugDrawer::DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop) - : Drawable(copy, copyop) + : Node(copy, copyop) , mCurrentFrame(copy.mCurrentFrame) , mCustomDebugDrawer(copy.mCustomDebugDrawer) { @@ -371,17 +371,10 @@ Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager) } } -void Debug::DebugDrawer::accept(osg::NodeVisitor& nv) +void Debug::DebugDrawer::traverse(osg::NodeVisitor& nv) { - if (!nv.validNodeMask(*this)) - return; - mCurrentFrame = nv.getTraversalNumber(); - int indexRead = getIndexBufferReadFromFrame(mCurrentFrame); - - nv.pushOntoNodePath(this); - mCustomDebugDrawer[indexRead]->accept(nv); - nv.popFromNodePath(); + mCustomDebugDrawer[getIndexBufferReadFromFrame(mCurrentFrame)]->accept(nv); } void Debug::DebugDrawer::drawCube(osg::Vec3f mPosition, osg::Vec3f mDims, osg::Vec3f mColor) diff --git a/components/debug/debugdraw.hpp b/components/debug/debugdraw.hpp index 610c89d656..7d7c975749 100644 --- a/components/debug/debugdraw.hpp +++ b/components/debug/debugdraw.hpp @@ -84,15 +84,15 @@ namespace Debug virtual void drawImplementation(osg::RenderInfo&) const override; }; - struct DebugDrawer : public osg::Drawable + struct DebugDrawer : public osg::Node { DebugDrawer() = default; DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop); DebugDrawer(Shader::ShaderManager& shaderManager); - META_Object(Debug, DebugDrawer) + META_Node(Debug, DebugDrawer) - void accept(osg::NodeVisitor& nv) override; + void traverse(osg::NodeVisitor& nv) override; void drawCube( osg::Vec3f mPosition, osg::Vec3f mDims = osg::Vec3(50., 50., 50.), osg::Vec3f mColor = colorWhite);