Make DebugDrawer a Node

fix-osga-rotate-wildly
Alexei Kotov 11 months ago
parent 9531b6983a
commit 6a96cdaa31

@ -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)

@ -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);

Loading…
Cancel
Save