From 9c9bfc1a98fcf7af8e60fa3d2e1bbd03971cf384 Mon Sep 17 00:00:00 2001 From: Mathias Froehlich Date: Wed, 3 Oct 2012 20:23:05 +0200 Subject: [PATCH] scenery: Make sure makeEffects has reader writer options. --- simgear/scene/model/SGLightAnimation.cxx | 7 +++++-- simgear/scene/model/animation.cxx | 2 +- simgear/scene/model/animation.hxx | 2 ++ simgear/scene/sky/dome.cxx | 6 ++++-- simgear/scene/sky/dome.hxx | 6 +++++- simgear/scene/sky/sky.cxx | 5 +++-- simgear/scene/sky/sky.hxx | 7 ++++++- 7 files changed, 26 insertions(+), 9 deletions(-) diff --git a/simgear/scene/model/SGLightAnimation.cxx b/simgear/scene/model/SGLightAnimation.cxx index a198d449..5806c323 100644 --- a/simgear/scene/model/SGLightAnimation.cxx +++ b/simgear/scene/model/SGLightAnimation.cxx @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -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(_options.get())); if (iter == lightEffectMap.end() && cacheEffect) lightEffectMap.insert(EffectMap::value_type(_key, effect)); else if (cacheEffect) diff --git a/simgear/scene/model/animation.cxx b/simgear/scene/model/animation.cxx index 7e94e5e6..9647c66c 100644 --- a/simgear/scene/model/animation.cxx +++ b/simgear/scene/model/animation.cxx @@ -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); diff --git a/simgear/scene/model/animation.hxx b/simgear/scene/model/animation.hxx index 197ddd53..920ed5e1 100644 --- a/simgear/scene/model/animation.hxx +++ b/simgear/scene/model/animation.hxx @@ -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 _animationValue; + osg::ref_ptr _options; }; #endif // _SG_ANIMATION_HXX diff --git a/simgear/scene/sky/dome.cxx b/simgear/scene/sky/dome.cxx index 913712cb..50dbe33b 100644 --- a/simgear/scene/sky/dome.cxx +++ b/simgear/scene/sky/dome.cxx @@ -38,9 +38,11 @@ #include #include #include +#include #include #include +#include #include #include #include @@ -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); diff --git a/simgear/scene/sky/dome.hxx b/simgear/scene/sky/dome.hxx index 13fcf243..8ff8e3e4 100644 --- a/simgear/scene/sky/dome.hxx +++ b/simgear/scene/sky/dome.hxx @@ -39,6 +39,10 @@ namespace osg class DrawElementsUShort; } +namespace simgear { +class SGReaderWriterOptions; +} + class SGSkyDome : public SGReferenced { osg::ref_ptr 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 diff --git a/simgear/scene/sky/sky.cxx b/simgear/scene/sky/sky.cxx index 9c8d83b9..a096facb 100644 --- a/simgear/scene/sky/sky.cxx +++ b/simgear/scene/sky/sky.cxx @@ -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; diff --git a/simgear/scene/sky/sky.hxx b/simgear/scene/sky/sky.hxx index 09169828..6c603f3c 100644 --- a/simgear/scene/sky/sky.hxx +++ b/simgear/scene/sky/sky.hxx @@ -53,6 +53,10 @@ #include #include +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, -- 2.39.5