Changed the osg::LightSource so its Light attribute is now generalised to

be a StateAttribute.  This allows alternative implementations of Lights
other than the standard osg::Light.
This commit is contained in:
Robert Osfield
2002-06-19 08:34:19 +00:00
parent 5e85cd59ab
commit b3c26d5634
4 changed files with 9 additions and 11 deletions

View File

@@ -18,7 +18,7 @@ LightSource::~LightSource()
}
void LightSource::setLight(Light* light)
void LightSource::setLight(StateAttribute* light)
{
_light = light;
setLocalStateSetModes(_value);

View File

@@ -27,9 +27,7 @@ bool LightSource_readLocalData(Object& obj, Input& fr)
LightSource& lightsource = static_cast<LightSource&>(obj);
static ref_ptr<Light> s_light = osgNew osg::Light;
Light* light = static_cast<Light*>(fr.readObjectOfType(*s_light));
StateAttribute* light=fr.readStateAttribute();
if (light)
{
lightsource.setLight(light);

View File

@@ -383,7 +383,7 @@ void CullVisitor::apply(LightSource& node)
if (node_state) pushStateSet(node_state);
Matrix& matrix = getModelViewMatrix();
Light* light = node.getLight();
StateAttribute* light = node.getLight();
if (light)
{
addPositionedAttribute(&matrix,light);