]> git.mxchange.org Git - simgear.git/commitdiff
Fix effects code to work with OSG 2.8.2-rc4
authorTim Moore <moore@blackbox.bricoworks.com>
Thu, 16 Jul 2009 16:25:36 +0000 (18:25 +0200)
committerTim Moore <timoore@redhat.com>
Thu, 16 Jul 2009 16:33:27 +0000 (18:33 +0200)
simgear/scene/material/Effect.cxx
simgear/scene/material/makeEffect.cxx
simgear/scene/material/mat.cxx
simgear/scene/material/mat.hxx
simgear/scene/material/matlib.cxx

index ca04ae78f0be12759a82aec41eea230d861a27a2..eca354100c71e6ddc7d17a37623533d0b91e2ae8 100644 (file)
@@ -669,9 +669,7 @@ void ShaderProgramBuilder::buildAttribute(Effect* effect, Pass* pass,
                 if (sitr != shaderMap.end()) {
                     program->addShader(sitr->second.get());
                 } else {
-                    string fileName = osgDB::Registry::instance()
-                        ->findDataFile(shaderName, options,
-                                       osgDB::CASE_SENSITIVE);
+                    string fileName = osgDB::findDataFile(shaderName, options);
                     if (!fileName.empty()) {
                         ref_ptr<Shader> shader = new Shader(stype);
                         if (shader->loadShaderSourceFromFile(fileName)) {
index 7745cd976cc9a716bd1722b410b0dc71b0a2d516..f437c460544455f7ff269aaa375154d84e1f304e 100644 (file)
@@ -128,8 +128,7 @@ Effect* makeEffect(const string& name,
     string effectFileName(name);
     effectFileName += ".eff";
     string absFileName
-        = osgDB::Registry::instance()->findDataFile(effectFileName, options,
-                                                    osgDB::CASE_SENSITIVE);
+        = osgDB::findDataFile(effectFileName, options);
     if (absFileName.empty())
         return 0;
     SGPropertyNode_ptr effectProps = new SGPropertyNode();
index 63b8aebd06239632a1266d9acc1a5b67f31516b8..3a9e96738bebe338f0d6e51a3bb8ee72a15888cb 100644 (file)
@@ -41,7 +41,7 @@
 #include <osg/StateSet>
 #include <osg/TexEnv>
 #include <osg/Texture2D>
-#include <osgDB/Options>
+#include <osgDB/ReaderWriter>
 #include <osgDB/ReadFile>
 #include <osgDB/Registry>
 #include <osgDB/FileUtils>
@@ -68,12 +68,12 @@ using namespace simgear;
 ////////////////////////////////////////////////////////////////////////
 
 SGMaterial::_internal_state::_internal_state(Effect *e, const string &t, bool l,
-                                             const osgDB::Options* o ) :
+                                             const osgDB::ReaderWriter::Options* o ) :
   effect(e), texture_path(t), effect_realized(l), options(o)
 {
 }
 
-SGMaterial::SGMaterial( const osgDB::Options* options,
+SGMaterial::SGMaterial( const osgDB::ReaderWriter::Options* options,
                         const SGPropertyNode *props )
 {
     init();
@@ -91,7 +91,7 @@ SGMaterial::~SGMaterial (void)
 ////////////////////////////////////////////////////////////////////////
 
 void
-SGMaterial::read_properties(const osgDB::Options* options,
+SGMaterial::read_properties(const osgDB::ReaderWriter::Options* options,
                             const SGPropertyNode *props)
 {
                                // Gather the path(s) to the texture(s)
@@ -104,14 +104,11 @@ SGMaterial::read_properties(const osgDB::Options* options,
     }
     SGPath tpath("Textures.high");
     tpath.append(tname);
-    osgDB::Registry* reg = osgDB::Registry::instance();
-    string fullTexPath = reg->findDataFile(tpath.str(), options,
-                                           osgDB::CASE_SENSITIVE);
+    string fullTexPath = osgDB::findDataFile(tpath.str(), options);
     if (fullTexPath.empty()) {
       tpath = SGPath("Textures");
       tpath.append(tname);
-      fullTexPath = reg->findDataFile(tpath.str(), options,
-                                      osgDB::CASE_SENSITIVE);
+      fullTexPath = osgDB::findDataFile(tpath.str(), options);
     }
 
     if (!fullTexPath.empty() ) {
@@ -142,8 +139,7 @@ SGMaterial::read_properties(const osgDB::Options* options,
   const SGPropertyNode* treeTexNode = props->getChild("tree-texture");
   if (treeTexNode) {
     string treeTexPath = props->getStringValue("tree-texture");
-    tree_texture = osgDB::Registry::instance()
-      ->findDataFile(treeTexPath, options, osgDB::CASE_SENSITIVE);
+    tree_texture = osgDB::findDataFile(treeTexPath, options);
   }
 
   // surface values for use with ground reactions
@@ -246,7 +242,8 @@ Effect* SGMaterial::get_effect(int n)
     return _status[i].effect.get();
 }
 
-void SGMaterial::buildEffectProperties(const osgDB::Options* options)
+void SGMaterial::buildEffectProperties(const osgDB::ReaderWriter::Options*
+                                       options)
 {
     using namespace osg;
     SGPropertyNode_ptr propRoot = new SGPropertyNode();
index ae246ad57e943ed0ca7b5e41890d22c3a93ab448..5b74412cfb7f95c20ddb995f4c1b8f3f90cd9d6d 100644 (file)
 #include <simgear/math/SGMath.hxx>
 
 #include <osg/ref_ptr>
+#include <osgDB/ReaderWriter>
 
 namespace osg
 {
 class StateSet;
 }
 
-namespace osgDB
-{
-class Options;
-}
-
 #include <simgear/props/props.hxx>
 #include <simgear/structure/SGSharedPtr.hxx>
 #include <simgear/scene/util/SGSceneFeatures.hxx>
@@ -88,7 +84,7 @@ public:
    * state information for the material.  This node is usually
    * loaded from the $FG_ROOT/materials.xml file.
    */
-  SGMaterial( const osgDB::Options*, const SGPropertyNode *props);
+  SGMaterial( const osgDB::ReaderWriter::Options*, const SGPropertyNode *props);
 
   /**
    * Destructor.
@@ -260,11 +256,11 @@ protected:
 
   struct _internal_state {
       _internal_state(simgear::Effect *e, const std::string &t, bool l,
-                      const osgDB::Options *o);
+                      const osgDB::ReaderWriter::Options *o);
       osg::ref_ptr<simgear::Effect> effect;
       std::string texture_path;
       bool effect_realized;
-      osg::ref_ptr<const osgDB::Options> options;
+      osg::ref_ptr<const osgDB::ReaderWriter::Options> options;
   };
 
 private:
@@ -344,9 +340,9 @@ private:
   // Internal constructors and methods.
   ////////////////////////////////////////////////////////////////////
 
-  void read_properties(const osgDB::Options* options,
+  void read_properties(const osgDB::ReaderWriter::Options* options,
                         const SGPropertyNode *props);
-  void buildEffectProperties(const osgDB::Options* options);
+  void buildEffectProperties(const osgDB::ReaderWriter::Options* options);
 };
 
 
index c4aa8a8fb89bfbc6e28242e4e7e7498336cb2a36..6a40426f475d59864012c9c163737e53a702daa0 100644 (file)
@@ -36,7 +36,7 @@
 #include <string.h>
 #include <string>
 
-#include <osgDB/Options>
+#include <osgDB/ReaderWriter>
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/misc/sg_path.hxx>
@@ -71,8 +71,9 @@ bool SGMaterialLib::load( const string &fg_root, const string& mpath,
                 << ex.getMessage() );
         throw;
     }
-    osg::ref_ptr<osgDB::Options> options = new osgDB::Options;
-    options->setObjectCacheHint(osgDB::Options::CACHE_ALL);
+    osg::ref_ptr<osgDB::ReaderWriter::Options> options
+        = new osgDB::ReaderWriter::Options;
+    options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
     options->setDatabasePath(fg_root);
     int nMaterials = materials.nChildren();
     for (int i = 0; i < nMaterials; i++) {