1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-02-12 09:39:58 +00:00

Fix handling in LightListCallback when the node is not a Group

This commit is contained in:
scrawl 2017-03-03 18:20:47 +01:00
parent b78a9f89af
commit 34130fc5cc

View File

@ -417,12 +417,14 @@ namespace SceneUtil
// get the node bounds in view space // get the node bounds in view space
// NB do not node->getBound() * modelView, that would apply the node's transformation twice // NB do not node->getBound() * modelView, that would apply the node's transformation twice
osg::BoundingSphere nodeBound; osg::BoundingSphere nodeBound;
osg::Group* group = node->asGroup(); osg::Transform* transform = node->asTransform();
if (group) if (transform)
{ {
for (unsigned int i=0; i<group->getNumChildren(); ++i) for (unsigned int i=0; i<transform->getNumChildren(); ++i)
nodeBound.expandBy(group->getChild(i)->getBound()); nodeBound.expandBy(transform->getChild(i)->getBound());
} }
else
nodeBound = node->getBound();
osg::Matrixf mat = *cv->getModelViewMatrix(); osg::Matrixf mat = *cv->getModelViewMatrix();
transformBoundingSphere(mat, nodeBound); transformBoundingSphere(mat, nodeBound);