forked from teamnwah/openmw-tes3coop
Lighting fix for LightListCallbacks attached to a Transform node
This commit is contained in:
parent
7f967153ef
commit
93cc08a09c
1 changed files with 9 additions and 2 deletions
|
@ -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);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue