diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp index e15618e14..5e9aeb8bb 100644 --- a/src/osg/LightSource.cpp +++ b/src/osg/LightSource.cpp @@ -42,9 +42,21 @@ void LightSource::setLocalStateSetModes(const StateAttribute::GLModeValue value) const bool LightSource::computeBound() const { - // note, don't do anything right now as the light itself is not - // visualised, just having an effect on the lighting of geodes. - _bsphere.init(); + Group::computeBound(); + + if (_light.valid()) + { + const Light* light = dynamic_cast(_light.get()); + if (light) + { + const Vec4& pos = light->getPosition(); + if (pos[3]!=0.0f) + { + float div = 1.0f/pos[3]; + _bsphere.expandBy(Vec3(pos[0]*div,pos[1]*div,pos[2]*div)); + } + } + } _bsphere_computed = true;