mirror of
https://github.com/OpenMW/openmw.git
synced 2025-07-06 02:11:35 +00:00
Small changes
This commit is contained in:
parent
e811f7ed00
commit
943198e325
2 changed files with 6 additions and 10 deletions
|
@ -330,7 +330,7 @@ namespace Debug
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_ptr<osg::Group> parentNode)
|
Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_ptr<osg::Group> parentNode) : mParentNode(parentNode)
|
||||||
{
|
{
|
||||||
mCurrentFrame = 0;
|
mCurrentFrame = 0;
|
||||||
auto vertexShader = shaderManager.getShader("debug_vertex.glsl", Shader::ShaderManager::DefineMap(), osg::Shader::Type::VERTEX);
|
auto vertexShader = shaderManager.getShader("debug_vertex.glsl", Shader::ShaderManager::DefineMap(), osg::Shader::Type::VERTEX);
|
||||||
|
@ -376,17 +376,12 @@ Debug::DebugDrawer::DebugDrawer(Shader::ShaderManager& shaderManager, osg::ref_p
|
||||||
}
|
}
|
||||||
mDebugDrawSceneObjects->addCullCallback(new DebugDrawCallback(*this));
|
mDebugDrawSceneObjects->addCullCallback(new DebugDrawCallback(*this));
|
||||||
|
|
||||||
parentNode->addChild(mDebugDrawSceneObjects);
|
mParentNode->addChild(mDebugDrawSceneObjects);
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::DebugDrawer::~DebugDrawer()
|
Debug::DebugDrawer::~DebugDrawer()
|
||||||
{
|
{
|
||||||
auto parentsList = mDebugDrawSceneObjects->getParents();
|
mParentNode->removeChild(mDebugDrawSceneObjects);
|
||||||
|
|
||||||
for (auto parent : parentsList)
|
|
||||||
{
|
|
||||||
parent->removeChild(mDebugDrawSceneObjects);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
@ -409,7 +404,7 @@ void Debug::DebugDrawer::addDrawCall(const DrawCall& draw)
|
||||||
void Debug::DebugDrawer::addLine(const osg::Vec3& start, const osg::Vec3& end, const osg::Vec3 color)
|
void Debug::DebugDrawer::addLine(const osg::Vec3& start, const osg::Vec3& end, const osg::Vec3 color)
|
||||||
{
|
{
|
||||||
const int indexWrite = getIdexBufferWriteFromFrame(mCurrentFrame);
|
const int indexWrite = getIdexBufferWriteFromFrame(mCurrentFrame);
|
||||||
auto lines = mCustomDebugDrawer[indexWrite]->mLinesToDraw;
|
const auto& lines = mCustomDebugDrawer[indexWrite]->mLinesToDraw;
|
||||||
auto vertices = static_cast<osg::Vec3Array*>(lines->getVertexArray());
|
auto vertices = static_cast<osg::Vec3Array*>(lines->getVertexArray());
|
||||||
auto colors = static_cast<osg::Vec3Array*>(lines->getNormalArray());
|
auto colors = static_cast<osg::Vec3Array*>(lines->getNormalArray());
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace Debug
|
||||||
osg::ref_ptr<osg::Geometry> mCylinderGeometry;
|
osg::ref_ptr<osg::Geometry> mCylinderGeometry;
|
||||||
osg::ref_ptr<osg::Geometry> mWireCubeGeometry;
|
osg::ref_ptr<osg::Geometry> mWireCubeGeometry;
|
||||||
|
|
||||||
virtual void drawImplementation(osg::RenderInfo&) const;
|
virtual void drawImplementation(osg::RenderInfo&) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DebugDrawer
|
struct DebugDrawer
|
||||||
|
@ -87,6 +87,7 @@ namespace Debug
|
||||||
|
|
||||||
std::array<osg::ref_ptr<DebugCustomDraw>, 2> mCustomDebugDrawer;
|
std::array<osg::ref_ptr<DebugCustomDraw>, 2> mCustomDebugDrawer;
|
||||||
osg::ref_ptr<osg::Group> mDebugDrawSceneObjects;
|
osg::ref_ptr<osg::Group> mDebugDrawSceneObjects;
|
||||||
|
osg::ref_ptr<osg::Group> mParentNode;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // !
|
#endif // !
|
||||||
|
|
Loading…
Reference in a new issue