1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-03-03 17:19:39 +00:00

Lighting fix for LightListCallbacks attached to a Transform node

This commit is contained in:
scrawl 2016-01-06 23:14:32 +01:00
parent 7f967153ef
commit 93cc08a09c

View file

@ -309,8 +309,15 @@ namespace SceneUtil
const osg::RefMatrix* viewMatrix = cv->getCurrentRenderStage()->getInitialViewMatrix(); const osg::RefMatrix* viewMatrix = cv->getCurrentRenderStage()->getInitialViewMatrix();
const std::vector<LightManager::LightSourceViewBound>& lights = mLightManager->getLightsInViewSpace(cv->getCurrentCamera(), viewMatrix); const std::vector<LightManager::LightSourceViewBound>& lights = mLightManager->getLightsInViewSpace(cv->getCurrentCamera(), viewMatrix);
// we do the intersections in view space // get the node bounds in view space
osg::BoundingSphere nodeBound = node->getBound(); // NB do not node->getBound() * modelView, that would apply the node's transformation twice
osg::BoundingSphere nodeBound;
osg::Group* group = node->asGroup();
if (group)
{
for (unsigned int i=0; i<group->getNumChildren(); ++i)
nodeBound.expandBy(group->getChild(i)->getBound());
}
osg::Matrixf mat = *cv->getModelViewMatrix(); osg::Matrixf mat = *cv->getModelViewMatrix();
transformBoundingSphere(mat, nodeBound); transformBoundingSphere(mat, nodeBound);