]> git.mxchange.org Git - simgear.git/commitdiff
scenery: Make sure makeEffects has reader writer options.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Wed, 3 Oct 2012 18:23:05 +0000 (20:23 +0200)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Wed, 3 Oct 2012 19:59:09 +0000 (21:59 +0200)
simgear/scene/model/SGLightAnimation.cxx
simgear/scene/model/animation.cxx
simgear/scene/model/animation.hxx
simgear/scene/sky/dome.cxx
simgear/scene/sky/dome.hxx
simgear/scene/sky/sky.cxx
simgear/scene/sky/sky.hxx

index a198d4498b234147090ecc481c25342e4b153029..5806c3232ad0df958016dfcf7727055a0a6c2375 100644 (file)
@@ -32,6 +32,7 @@
 #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>
 
@@ -94,8 +95,10 @@ public:
 
 SGLightAnimation::SGLightAnimation(const SGPropertyNode* configNode,
                                    SGPropertyNode* modelRoot,
+                                   const osgDB::Options* options,
                                    const string &path, int i) :
-    SGAnimation(configNode, modelRoot)
+    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") );
@@ -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)
index 7e94e5e6ff3baf1f5238c1b60d81a0f21d589037..9647c66cd75be35152630cb9915048fa2602b86c 100644 (file)
@@ -424,7 +424,7 @@ SGAnimation::animate(osg::Node* node, const SGPropertyNode* configNode,
     SGTranslateAnimation animInst(configNode, modelRoot);
     animInst.apply(node);
   } else if (type == "light") {
-    SGLightAnimation animInst(configNode, modelRoot, path, i);
+    SGLightAnimation animInst(configNode, modelRoot, options, path, i);
     animInst.apply(node);
   } else if (type == "null" || type == "none" || type.empty()) {
     SGGroupAnimation animInst(configNode, modelRoot);
index 197ddd531bc91963e57c5498995ce9129453849f..920ed5e1de5eef8aeba98c5a35ce1a404058aadf 100644 (file)
@@ -350,6 +350,7 @@ class SGLightAnimation : public SGAnimation {
 public:
   SGLightAnimation(const SGPropertyNode* configNode,
                    SGPropertyNode* modelRoot,
+                   const osgDB::Options* options,
                    const string &path, int i);
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
   virtual void install(osg::Node& node);
@@ -369,6 +370,7 @@ private:
   class UpdateCallback;
   friend class UpdateCallback;
   SGSharedPtr<SGExpressiond> _animationValue;
+  osg::ref_ptr<const osgDB::Options> _options;
 };
 
 #endif // _SG_ANIMATION_HXX
index 913712cb6bd45c8fa64af3827a279e87af6b06b3..50dbe33bfc2b18fb7545976ffa3baff78f76a5a0 100644 (file)
 #include <osg/ShadeModel>
 #include <osg/PrimitiveSet>
 #include <osg/CullFace>
+#include <osgDB/Registry>
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/scene/util/OsgMath.hxx>
+#include <simgear/scene/util/SGReaderWriterOptions.hxx>
 #include <simgear/scene/util/VectorArrayAdapter.hxx>
 #include <simgear/scene/material/Effect.hxx>
 #include <simgear/scene/material/EffectGeode.hxx>
@@ -159,14 +161,14 @@ void SGSkyDome::makeDome(int rings, int bands, DrawElementsUShort& elements)
 
 // initialize the sky object and connect it into our scene graph
 osg::Node*
-SGSkyDome::build( double hscale, double vscale ) {
+SGSkyDome::build( double hscale, double vscale, simgear::SGReaderWriterOptions *options ) {
 
     EffectGeode* geode = new EffectGeode;
 //    Geode* geode = new Geode;
     geode->setName("Skydome");
     geode->setCullingActive(false); // Prevent skydome from being culled away
 
-    Effect *effect = makeEffect("Effects/skydome", true);
+    Effect *effect = makeEffect("Effects/skydome", true, options);
     if(effect)
       geode->setEffect(effect);
 
index 13fcf24366f7edd30bd138556886b76048f76b3c..8ff8e3e44e7793c1096fca9187ac935ceb134757 100644 (file)
@@ -39,6 +39,10 @@ namespace osg
 class DrawElementsUShort;
 }
 
+namespace simgear {
+class SGReaderWriterOptions;
+}
+
 class SGSkyDome : public SGReferenced {
     osg::ref_ptr<osg::MatrixTransform> dome_transform;
     double asl;
@@ -55,7 +59,7 @@ public:
 
     // initialize the sky object and connect it into our scene graph
     // root
-    osg::Node *build( double hscale = 80000.0, double vscale = 80000.0 );
+    osg::Node *build( double hscale = 80000.0, double vscale = 80000.0, simgear::SGReaderWriterOptions *options = 0 );
 
     // repaint the sky colors based on current value of sun_angle,
     // sky, and fog colors.  This updates the color arrays for
index 9c8d83b996b2ecffed96e56eec4eed38c406611a..a096facb5d9c21ab01d6849c4b75b5b165e99834 100644 (file)
@@ -81,10 +81,11 @@ SGSky::~SGSky( void )
 // the provided branch
 void SGSky::build( double h_radius_m, double v_radius_m,
                    double sun_size, double moon_size,
-                   const SGEphemeris& eph, SGPropertyNode *property_tree_node )
+                   const SGEphemeris& eph, SGPropertyNode *property_tree_node,
+                   simgear::SGReaderWriterOptions* options )
 {
     dome = new SGSkyDome;
-    pre_transform->addChild( dome->build( h_radius_m, v_radius_m ) );
+    pre_transform->addChild( dome->build( h_radius_m, v_radius_m, options ) );
 
     pre_transform->addChild(_ephTransform.get());
     planets = new SGStars;
index 091698289904686e2d1a40ac8c64bbb5fd2c63f2..6c603f3c9c339da628618295495393d0e14eeb89 100644 (file)
 #include <simgear/scene/sky/oursun.hxx>
 #include <simgear/scene/sky/stars.hxx>
 
+namespace simgear {
+class SGReaderWriterOptions;
+}
+
 typedef struct {
     SGVec3d pos;
     SGGeod pos_geod;
@@ -272,7 +276,8 @@ public:
      */
     void build( double h_radius_m, double v_radius_m,
                 double sun_size, double moon_size,
-                const SGEphemeris& eph, SGPropertyNode *property_tree_node );
+                const SGEphemeris& eph, SGPropertyNode *property_tree_node,
+                simgear::SGReaderWriterOptions* options = 0);
 
     /**
      * Repaint the sky components based on current value of sun_angle,