1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-03-03 22:09:40 +00:00

Replace a dynamic cast with string comarison

This commit is contained in:
AnyOldName3 2018-03-01 14:37:11 +00:00
parent bc4b4c66e4
commit fc41902798
2 changed files with 12 additions and 3 deletions

View file

@ -301,6 +301,8 @@ MWShadowTechnique::ComputeLightSpaceBounds::ComputeLightSpaceBounds(osg::Viewpor
pushViewport(viewport); pushViewport(viewport);
pushProjectionMatrix(new osg::RefMatrix(projectionMatrix)); pushProjectionMatrix(new osg::RefMatrix(projectionMatrix));
pushModelViewMatrix(new osg::RefMatrix(viewMatrix), osg::Transform::ABSOLUTE_RF); pushModelViewMatrix(new osg::RefMatrix(viewMatrix), osg::Transform::ABSOLUTE_RF);
setName("SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds,AcceptedByComponentsTerrainQuadTreeWorld");
} }
void MWShadowTechnique::ComputeLightSpaceBounds::apply(osg::Node& node) void MWShadowTechnique::ComputeLightSpaceBounds::apply(osg::Node& node)

View file

@ -347,9 +347,16 @@ void QuadTreeWorld::accept(osg::NodeVisitor &nv)
{ {
if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR && nv.getVisitorType() != osg::NodeVisitor::INTERSECTION_VISITOR) if (nv.getVisitorType() != osg::NodeVisitor::CULL_VISITOR && nv.getVisitorType() != osg::NodeVisitor::INTERSECTION_VISITOR)
{ {
SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds* shadowBoundsVisitor = dynamic_cast<SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds *>(&nv); if (nv.getName().find("AcceptedByComponentsTerrainQuadTreeWorld") != std::string::npos)
if (shadowBoundsVisitor) {
shadowBoundsVisitor->apply(*this); if (nv.getName().find("SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds") != std::string::npos)
{
SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds* clsb = static_cast<SceneUtil::MWShadowTechnique::ComputeLightSpaceBounds*>(&nv);
clsb->apply(*this);
}
else
nv.apply(*mRootNode);
}
return; return;
} }