scenery: Make sure makeEffects has reader writer options.
This commit is contained in:
@@ -32,6 +32,7 @@
|
|||||||
#include <simgear/scene/material/Pass.hxx>
|
#include <simgear/scene/material/Pass.hxx>
|
||||||
#include <simgear/scene/util/CopyOp.hxx>
|
#include <simgear/scene/util/CopyOp.hxx>
|
||||||
#include <simgear/scene/util/OsgMath.hxx>
|
#include <simgear/scene/util/OsgMath.hxx>
|
||||||
|
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||||
#include <boost/scoped_array.hpp>
|
#include <boost/scoped_array.hpp>
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
@@ -94,8 +95,10 @@ public:
|
|||||||
|
|
||||||
SGLightAnimation::SGLightAnimation(const SGPropertyNode* configNode,
|
SGLightAnimation::SGLightAnimation(const SGPropertyNode* configNode,
|
||||||
SGPropertyNode* modelRoot,
|
SGPropertyNode* modelRoot,
|
||||||
|
const osgDB::Options* options,
|
||||||
const string &path, int i) :
|
const string &path, int i) :
|
||||||
SGAnimation(configNode, modelRoot)
|
SGAnimation(configNode, modelRoot),
|
||||||
|
_options(options)
|
||||||
{
|
{
|
||||||
_light_type = getConfig()->getStringValue("light-type");
|
_light_type = getConfig()->getStringValue("light-type");
|
||||||
_position = SGVec3d( getConfig()->getDoubleValue("position/x"), getConfig()->getDoubleValue("position/y"), getConfig()->getDoubleValue("position/z") );
|
_position = SGVec3d( getConfig()->getDoubleValue("position/x"), getConfig()->getDoubleValue("position/y"), getConfig()->getDoubleValue("position/z") );
|
||||||
@@ -182,7 +185,7 @@ SGLightAnimation::install(osg::Node& node)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
effect = simgear::makeEffect(effectProp, true);
|
effect = simgear::makeEffect(effectProp, true, dynamic_cast<const simgear::SGReaderWriterOptions*>(_options.get()));
|
||||||
if (iter == lightEffectMap.end() && cacheEffect)
|
if (iter == lightEffectMap.end() && cacheEffect)
|
||||||
lightEffectMap.insert(EffectMap::value_type(_key, effect));
|
lightEffectMap.insert(EffectMap::value_type(_key, effect));
|
||||||
else if (cacheEffect)
|
else if (cacheEffect)
|
||||||
|
|||||||
@@ -424,7 +424,7 @@ SGAnimation::animate(osg::Node* node, const SGPropertyNode* configNode,
|
|||||||
SGTranslateAnimation animInst(configNode, modelRoot);
|
SGTranslateAnimation animInst(configNode, modelRoot);
|
||||||
animInst.apply(node);
|
animInst.apply(node);
|
||||||
} else if (type == "light") {
|
} else if (type == "light") {
|
||||||
SGLightAnimation animInst(configNode, modelRoot, path, i);
|
SGLightAnimation animInst(configNode, modelRoot, options, path, i);
|
||||||
animInst.apply(node);
|
animInst.apply(node);
|
||||||
} else if (type == "null" || type == "none" || type.empty()) {
|
} else if (type == "null" || type == "none" || type.empty()) {
|
||||||
SGGroupAnimation animInst(configNode, modelRoot);
|
SGGroupAnimation animInst(configNode, modelRoot);
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ class SGLightAnimation : public SGAnimation {
|
|||||||
public:
|
public:
|
||||||
SGLightAnimation(const SGPropertyNode* configNode,
|
SGLightAnimation(const SGPropertyNode* configNode,
|
||||||
SGPropertyNode* modelRoot,
|
SGPropertyNode* modelRoot,
|
||||||
|
const osgDB::Options* options,
|
||||||
const string &path, int i);
|
const string &path, int i);
|
||||||
virtual osg::Group* createAnimationGroup(osg::Group& parent);
|
virtual osg::Group* createAnimationGroup(osg::Group& parent);
|
||||||
virtual void install(osg::Node& node);
|
virtual void install(osg::Node& node);
|
||||||
@@ -369,6 +370,7 @@ private:
|
|||||||
class UpdateCallback;
|
class UpdateCallback;
|
||||||
friend class UpdateCallback;
|
friend class UpdateCallback;
|
||||||
SGSharedPtr<SGExpressiond> _animationValue;
|
SGSharedPtr<SGExpressiond> _animationValue;
|
||||||
|
osg::ref_ptr<const osgDB::Options> _options;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SG_ANIMATION_HXX
|
#endif // _SG_ANIMATION_HXX
|
||||||
|
|||||||
@@ -38,9 +38,11 @@
|
|||||||
#include <osg/ShadeModel>
|
#include <osg/ShadeModel>
|
||||||
#include <osg/PrimitiveSet>
|
#include <osg/PrimitiveSet>
|
||||||
#include <osg/CullFace>
|
#include <osg/CullFace>
|
||||||
|
#include <osgDB/Registry>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/scene/util/OsgMath.hxx>
|
#include <simgear/scene/util/OsgMath.hxx>
|
||||||
|
#include <simgear/scene/util/SGReaderWriterOptions.hxx>
|
||||||
#include <simgear/scene/util/VectorArrayAdapter.hxx>
|
#include <simgear/scene/util/VectorArrayAdapter.hxx>
|
||||||
#include <simgear/scene/material/Effect.hxx>
|
#include <simgear/scene/material/Effect.hxx>
|
||||||
#include <simgear/scene/material/EffectGeode.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
|
// initialize the sky object and connect it into our scene graph
|
||||||
osg::Node*
|
osg::Node*
|
||||||
SGSkyDome::build( double hscale, double vscale ) {
|
SGSkyDome::build( double hscale, double vscale, simgear::SGReaderWriterOptions *options ) {
|
||||||
|
|
||||||
EffectGeode* geode = new EffectGeode;
|
EffectGeode* geode = new EffectGeode;
|
||||||
// Geode* geode = new Geode;
|
// Geode* geode = new Geode;
|
||||||
geode->setName("Skydome");
|
geode->setName("Skydome");
|
||||||
geode->setCullingActive(false); // Prevent skydome from being culled away
|
geode->setCullingActive(false); // Prevent skydome from being culled away
|
||||||
|
|
||||||
Effect *effect = makeEffect("Effects/skydome", true);
|
Effect *effect = makeEffect("Effects/skydome", true, options);
|
||||||
if(effect)
|
if(effect)
|
||||||
geode->setEffect(effect);
|
geode->setEffect(effect);
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ namespace osg
|
|||||||
class DrawElementsUShort;
|
class DrawElementsUShort;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
class SGReaderWriterOptions;
|
||||||
|
}
|
||||||
|
|
||||||
class SGSkyDome : public SGReferenced {
|
class SGSkyDome : public SGReferenced {
|
||||||
osg::ref_ptr<osg::MatrixTransform> dome_transform;
|
osg::ref_ptr<osg::MatrixTransform> dome_transform;
|
||||||
double asl;
|
double asl;
|
||||||
@@ -55,7 +59,7 @@ public:
|
|||||||
|
|
||||||
// initialize the sky object and connect it into our scene graph
|
// initialize the sky object and connect it into our scene graph
|
||||||
// root
|
// 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,
|
// repaint the sky colors based on current value of sun_angle,
|
||||||
// sky, and fog colors. This updates the color arrays for
|
// sky, and fog colors. This updates the color arrays for
|
||||||
|
|||||||
@@ -81,10 +81,11 @@ SGSky::~SGSky( void )
|
|||||||
// the provided branch
|
// the provided branch
|
||||||
void SGSky::build( double h_radius_m, double v_radius_m,
|
void SGSky::build( double h_radius_m, double v_radius_m,
|
||||||
double sun_size, double moon_size,
|
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;
|
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());
|
pre_transform->addChild(_ephTransform.get());
|
||||||
planets = new SGStars;
|
planets = new SGStars;
|
||||||
|
|||||||
@@ -53,6 +53,10 @@
|
|||||||
#include <simgear/scene/sky/oursun.hxx>
|
#include <simgear/scene/sky/oursun.hxx>
|
||||||
#include <simgear/scene/sky/stars.hxx>
|
#include <simgear/scene/sky/stars.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
class SGReaderWriterOptions;
|
||||||
|
}
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SGVec3d pos;
|
SGVec3d pos;
|
||||||
SGGeod pos_geod;
|
SGGeod pos_geod;
|
||||||
@@ -272,7 +276,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void build( double h_radius_m, double v_radius_m,
|
void build( double h_radius_m, double v_radius_m,
|
||||||
double sun_size, double moon_size,
|
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,
|
* Repaint the sky components based on current value of sun_angle,
|
||||||
|
|||||||
Reference in New Issue
Block a user