Change the light in LightSource from a generic osg::StateAttribute to

a osg::Light.
This commit is contained in:
Robert Osfield
2004-07-02 14:46:24 +00:00
parent 4ba3f7cad3
commit 2ce192f0ae
3 changed files with 12 additions and 15 deletions

View File

@@ -36,7 +36,7 @@ void LightSource::setReferenceFrame(ReferenceFrame rf)
setCullingActive(_referenceFrame==RELATIVE_TO_PARENTS);
}
void LightSource::setLight(StateAttribute* light)
void LightSource::setLight(Light* light)
{
_light = light;
setLocalStateSetModes(_value);
@@ -64,15 +64,11 @@ bool LightSource::computeBound() const
if (_light.valid() && _referenceFrame==RELATIVE_TO_PARENTS)
{
const Light* light = dynamic_cast<const Light*>(_light.get());
if (light)
const Vec4& pos = _light->getPosition();
if (pos[3]!=0.0f)
{
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));
}
float div = 1.0f/pos[3];
_bsphere.expandBy(Vec3(pos[0]*div,pos[1]*div,pos[2]*div));
}
}