mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-12 14:06:44 +00:00
Make DebugDrawer a Node
This commit is contained in:
parent
9531b6983a
commit
6a96cdaa31
2 changed files with 6 additions and 13 deletions
|
@ -322,7 +322,7 @@ namespace Debug
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::DebugDrawer::DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop)
|
Debug::DebugDrawer::DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop)
|
||||||
: Drawable(copy, copyop)
|
: Node(copy, copyop)
|
||||||
, mCurrentFrame(copy.mCurrentFrame)
|
, mCurrentFrame(copy.mCurrentFrame)
|
||||||
, mCustomDebugDrawer(copy.mCustomDebugDrawer)
|
, 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();
|
mCurrentFrame = nv.getTraversalNumber();
|
||||||
int indexRead = getIndexBufferReadFromFrame(mCurrentFrame);
|
mCustomDebugDrawer[getIndexBufferReadFromFrame(mCurrentFrame)]->accept(nv);
|
||||||
|
|
||||||
nv.pushOntoNodePath(this);
|
|
||||||
mCustomDebugDrawer[indexRead]->accept(nv);
|
|
||||||
nv.popFromNodePath();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Debug::DebugDrawer::drawCube(osg::Vec3f mPosition, osg::Vec3f mDims, osg::Vec3f mColor)
|
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;
|
virtual void drawImplementation(osg::RenderInfo&) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DebugDrawer : public osg::Drawable
|
struct DebugDrawer : public osg::Node
|
||||||
{
|
{
|
||||||
DebugDrawer() = default;
|
DebugDrawer() = default;
|
||||||
DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop);
|
DebugDrawer(const DebugDrawer& copy, const osg::CopyOp& copyop);
|
||||||
DebugDrawer(Shader::ShaderManager& shaderManager);
|
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(
|
void drawCube(
|
||||||
osg::Vec3f mPosition, osg::Vec3f mDims = osg::Vec3(50., 50., 50.), osg::Vec3f mColor = colorWhite);
|
osg::Vec3f mPosition, osg::Vec3f mDims = osg::Vec3(50., 50., 50.), osg::Vec3f mColor = colorWhite);
|
||||||
|
|
Loading…
Reference in a new issue