]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/SGLightAnimation.cxx
Work around apparent OSG 3.2.0 normal binding bug.
[simgear.git] / simgear / scene / model / SGLightAnimation.cxx
index a198d4498b234147090ecc481c25342e4b153029..b049c15d2a13e8f925a5d741f8158a4b272effe4 100644 (file)
 #include <simgear/scene/material/Pass.hxx>
 #include <simgear/scene/util/CopyOp.hxx>
 #include <simgear/scene/util/OsgMath.hxx>
+#include <simgear/scene/util/SGReaderWriterOptions.hxx>
 #include <boost/scoped_array.hpp>
 #include <boost/foreach.hpp>
 
-typedef std::map<string, osg::observer_ptr<simgear::Effect> > EffectMap;
+typedef std::map<std::string, osg::observer_ptr<simgear::Effect> > EffectMap;
 static EffectMap lightEffectMap;
 
 #define GET_COLOR_VALUE(n) \
@@ -94,8 +95,10 @@ public:
 
 SGLightAnimation::SGLightAnimation(const SGPropertyNode* configNode,
                                    SGPropertyNode* modelRoot,
-                                   const string &path, int i) :
-    SGAnimation(configNode, modelRoot)
+                                   const osgDB::Options* options,
+                                   const std::string &path, int i) :
+    SGAnimation(configNode, modelRoot),
+    _options(options)
 {
     _light_type = getConfig()->getStringValue("light-type");
     _position = SGVec3d( getConfig()->getDoubleValue("position/x"), getConfig()->getDoubleValue("position/y"), getConfig()->getDoubleValue("position/z") );
@@ -110,7 +113,7 @@ SGLightAnimation::SGLightAnimation(const SGPropertyNode* configNode,
     _cutoff = getConfig()->getDoubleValue("cutoff");
     _near = getConfig()->getDoubleValue("near-m");
     _far = getConfig()->getDoubleValue("far-m");
-    _key = path + ";" + boost::lexical_cast<string>( i );
+    _key = path + ";" + boost::lexical_cast<std::string>( i );
 
     SGConstPropertyNode_ptr dim_factor = configNode->getChild("dim-factor");
     if (dim_factor.valid()) {
@@ -182,7 +185,7 @@ SGLightAnimation::install(osg::Node& node)
             return;
         }
 
-        effect = simgear::makeEffect(effectProp, true);
+        effect = simgear::makeEffect(effectProp, true, dynamic_cast<const simgear::SGReaderWriterOptions*>(_options.get()));
         if (iter == lightEffectMap.end() && cacheEffect)
             lightEffectMap.insert(EffectMap::value_type(_key, effect));
         else if (cacheEffect)