From 93cc08a09cd5f132e7e79ad28737c33df7852d9d Mon Sep 17 00:00:00 2001 From: scrawl Date: Wed, 6 Jan 2016 23:14:32 +0100 Subject: [PATCH] Lighting fix for LightListCallbacks attached to a Transform node --- components/sceneutil/lightmanager.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index f9182c1d2..64448e73e 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -309,8 +309,15 @@ namespace SceneUtil const osg::RefMatrix* viewMatrix = cv->getCurrentRenderStage()->getInitialViewMatrix(); const std::vector& lights = mLightManager->getLightsInViewSpace(cv->getCurrentCamera(), viewMatrix); - // we do the intersections in view space - osg::BoundingSphere nodeBound = node->getBound(); + // get the node bounds in view space + // 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; igetNumChildren(); ++i) + nodeBound.expandBy(group->getChild(i)->getBound()); + } osg::Matrixf mat = *cv->getModelViewMatrix(); transformBoundingSphere(mat, nodeBound);