]> git.mxchange.org Git - simgear.git/commitdiff
Pass ReaderWriter options to SGMaterialAnimation
authortimoore <timoore>
Sun, 23 Dec 2007 23:33:04 +0000 (23:33 +0000)
committertimoore <timoore>
Sun, 23 Dec 2007 23:33:04 +0000 (23:33 +0000)
It needs to grab the path list from options in order to support the texture
change animation.

simgear/scene/model/SGMaterialAnimation.cxx
simgear/scene/model/SGMaterialAnimation.hxx
simgear/scene/model/animation.cxx

index ed5431486ae876f04e3e61e3f7982f9e77797966..8702b44caaebce93ddcaec2763c212bf6b510774 100644 (file)
@@ -354,8 +354,11 @@ private:
 
 
 SGMaterialAnimation::SGMaterialAnimation(const SGPropertyNode* configNode,
-                                         SGPropertyNode* modelRoot) :
-  SGAnimation(configNode, modelRoot)
+                                         SGPropertyNode* modelRoot,
+                                         const osgDB::ReaderWriter::Options*
+                                         options) :
+  SGAnimation(configNode, modelRoot),
+  texturePathList(options->getDatabasePathList())
 {
   if (configNode->hasChild("global"))
     SG_LOG(SG_IO, SG_ALERT, "Use of <global> in material animation is "
@@ -373,9 +376,6 @@ SGMaterialAnimation::createAnimationGroup(osg::Group& parent)
   if (node)
     inputRoot = getModelRoot()->getRootNode()->getNode(node->getStringValue(),
                                                        true);
-
-  osgDB::FilePathList texturePathList = osgDB::getDataFilePathList();
-
   if (getConfig()->hasChild("texture-prop"))
       osg::StateSet* stateSet = group->getOrCreateStateSet();
   if (getConfig()->hasChild("texture")) {
index 0bae0084712a1632b9dd54edc3ce01aa2d455d8b..ada24557a5aa1ba5ec6fb7b0deb3bc0497ff4fc6 100644 (file)
@@ -12,6 +12,7 @@
 #endif
 
 #include <osg/Material>
+#include <osgDB/ReaderWriter>
 #include "animation.hxx"
 
 //////////////////////////////////////////////////////////////////////
 class SGMaterialAnimation : public SGAnimation {
 public:
   SGMaterialAnimation(const SGPropertyNode* configNode,
-                      SGPropertyNode* modelRoot);
+                      SGPropertyNode* modelRoot,
+                      const osgDB::ReaderWriter::Options* options);
   virtual osg::Group* createAnimationGroup(osg::Group& parent);
   virtual void install(osg::Node& node);
 private:
   osg::ref_ptr<osg::Material> defaultMaterial;
   osg::Vec4 defaultAmbientDiffuse;
+  osgDB::FilePathList texturePathList;
 };
 
 #endif // _SG_MATERIALANIMATION_HXX
index d32308c2c13f53ac4832696e266cfd6490fc52e6..5966b5ab46670bdda52148b529e943bc57fb23e0 100644 (file)
@@ -521,7 +521,7 @@ SGAnimation::animate(osg::Node* node, const SGPropertyNode* configNode,
     SGFlashAnimation animInst(configNode, modelRoot);
     animInst.apply(node);
   } else if (type == "material") {
-    SGMaterialAnimation animInst(configNode, modelRoot);
+    SGMaterialAnimation animInst(configNode, modelRoot, options);
     animInst.apply(node);
   } else if (type == "noshadow") {
     SGShadowAnimation animInst(configNode, modelRoot);