Added code into osg::LightSource so it correctly computes its bounding
sphere, taking into account any subgraph below, and the light itself if it is not a infinite light.
This commit is contained in:
parent
e8185b37f0
commit
f2b6f8c873
@ -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<const Light*>(_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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user