diff --git a/include/osg/LightSource b/include/osg/LightSource index ea930a950..9c25813ea 100644 --- a/include/osg/LightSource +++ b/include/osg/LightSource @@ -15,7 +15,7 @@ namespace osg { class SG_EXPORT LightSource : public Group { public: - + LightSource(); LightSource(const LightSource& ls, const CopyOp& copyop=CopyOp::SHALLOW_COPY): @@ -26,13 +26,13 @@ class SG_EXPORT LightSource : public Group META_Node(osg, LightSource); /** Set the attached light.*/ - void setLight(Light* light); + void setLight(StateAttribute* light); /** Get the attached light.*/ - inline Light* getLight() { return _light.get(); } + inline StateAttribute* getLight() { return _light.get(); } /** Get the const attached light.*/ - inline const Light* getLight() const { return _light.get(); } + inline const StateAttribute* getLight() const { return _light.get(); } /** Set the GLModes on StateSet associated with the LightSource.*/ void setStateSetModes(StateSet&,const StateAttribute::GLModeValue) const; @@ -46,8 +46,8 @@ class SG_EXPORT LightSource : public Group virtual const bool computeBound() const; - StateAttribute::GLModeValue _value; - ref_ptr _light; + StateAttribute::GLModeValue _value; + ref_ptr _light; }; } diff --git a/src/osg/LightSource.cpp b/src/osg/LightSource.cpp index cb1e81fbb..762291175 100644 --- a/src/osg/LightSource.cpp +++ b/src/osg/LightSource.cpp @@ -18,7 +18,7 @@ LightSource::~LightSource() } -void LightSource::setLight(Light* light) +void LightSource::setLight(StateAttribute* light) { _light = light; setLocalStateSetModes(_value); diff --git a/src/osgPlugins/osg/LightSource.cpp b/src/osgPlugins/osg/LightSource.cpp index de312deb7..6eaf1ad31 100644 --- a/src/osgPlugins/osg/LightSource.cpp +++ b/src/osgPlugins/osg/LightSource.cpp @@ -27,9 +27,7 @@ bool LightSource_readLocalData(Object& obj, Input& fr) LightSource& lightsource = static_cast(obj); - static ref_ptr s_light = osgNew osg::Light; - - Light* light = static_cast(fr.readObjectOfType(*s_light)); + StateAttribute* light=fr.readStateAttribute(); if (light) { lightsource.setLight(light); diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index bca00c142..1d1c32beb 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -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);