[pkg-fgfs-crew] r128 - in /simgear/trunk/simgear/scene: model/CheckSceneryVisitor.cxx model/SGPagedLOD.cxx model/SGPagedLOD.hxx tgdb/SGReaderWriterBTGOptions.hxx

ovek at users.alioth.debian.org ovek at users.alioth.debian.org
Thu Jul 21 01:04:12 UTC 2011


Author: ovek
Date: Thu Jul 21 01:04:12 2011
New Revision: 128

URL: http://svn.debian.org/wsvn/pkg-fgfs/?sc=1&rev=128
Log:
Backported upstream commits
9a96018 "Compilation fix: add missing #include to SGPagedLod.cxx, needed by OSG 2.9.11"
7308486 "Temporary warning when compiling against OSG 2.9.11."
df6badf "accomodate changes to osgDB::DatabasePager interface"
956b440 "fix SGPagedLOD change for 2.8.3"

Modified:
    simgear/trunk/simgear/scene/model/CheckSceneryVisitor.cxx
    simgear/trunk/simgear/scene/model/SGPagedLOD.cxx
    simgear/trunk/simgear/scene/model/SGPagedLOD.hxx
    simgear/trunk/simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx

Modified: simgear/trunk/simgear/scene/model/CheckSceneryVisitor.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/scene/model/CheckSceneryVisitor.cxx?rev=128&op=diff
==============================================================================
--- simgear/trunk/simgear/scene/model/CheckSceneryVisitor.cxx (original)
+++ simgear/trunk/simgear/scene/model/CheckSceneryVisitor.cxx Thu Jul 21 01:04:12 2011
@@ -53,7 +53,7 @@
                 // if the DatabasePager would load LODs while the splashscreen
                 // is there, we could just wait for the models to be loaded
                 // by only setting setLoaded(false) here
-                sgplod->forceLoad(_dbp);
+                sgplod->forceLoad(_dbp, getNodePath());
                 setLoaded(false);
             }
         }

Modified: simgear/trunk/simgear/scene/model/SGPagedLOD.cxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/scene/model/SGPagedLOD.cxx?rev=128&op=diff
==============================================================================
--- simgear/trunk/simgear/scene/model/SGPagedLOD.cxx (original)
+++ simgear/trunk/simgear/scene/model/SGPagedLOD.cxx Thu Jul 21 01:04:12 2011
@@ -21,6 +21,7 @@
 #include <osgDB/ReadFile>
 #include <osgDB/Input>
 #include <osgDB/ParameterOutput>
+#include <osgDB/DatabasePager>
 
 #include <simgear/debug/logstream.hxx>
 #include <simgear/structure/OSGVersion.hxx>
@@ -45,8 +46,10 @@
 }
 
 SGPagedLOD::SGPagedLOD(const SGPagedLOD& plod,const CopyOp& copyop)
-        : osg::PagedLOD(plod, copyop),
-        _readerWriterOptions(plod._readerWriterOptions)
+        : osg::PagedLOD(plod, copyop)
+#if !SG_PAGEDLOD_HAS_OPTIONS
+        ,  _readerWriterOptions(plod._readerWriterOptions)
+#endif
 {
 }
 
@@ -60,16 +63,30 @@
     return true;
 }
 
-void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp)
+// Work around interface change in osgDB::DatabasePager::requestNodeFile
+struct NodePathProxy
+{
+    NodePathProxy(NodePath& nodePath)
+        : _nodePath(nodePath)
+    {
+    }
+    operator Group* () { return static_cast<Group*>(_nodePath.back()); }
+    operator NodePath& () { return _nodePath; }
+    NodePath& _nodePath;
+};
+
+void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp,
+                           NodePath& path)
 {
     //SG_LOG(SG_GENERAL, SG_ALERT, "SGPagedLOD::forceLoad(" <<
     //getFileName(getNumChildren()) << ")");
     unsigned childNum = getNumChildren();
     setTimeStamp(childNum, 0);
     double priority=1.0;
-    dbp->requestNodeFile(getFileName(childNum),this,priority,0,
+    dbp->requestNodeFile(getFileName(childNum), NodePathProxy(path),
+                         priority, 0,
                          getDatabaseRequest(childNum),
-                         _readerWriterOptions.get());
+                         getReaderWriterOptions());
 }
 
 bool SGPagedLOD_writeLocalData(const Object& obj, osgDB::Output& fw)

Modified: simgear/trunk/simgear/scene/model/SGPagedLOD.hxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/scene/model/SGPagedLOD.hxx?rev=128&op=diff
==============================================================================
--- simgear/trunk/simgear/scene/model/SGPagedLOD.hxx (original)
+++ simgear/trunk/simgear/scene/model/SGPagedLOD.hxx Thu Jul 21 01:04:12 2011
@@ -18,10 +18,13 @@
 #define SGPAGEDLOD_HXX 1
 
 #include <simgear/structure/OSGVersion.hxx>
+
+#define SG_PAGEDLOD_HAS_OPTIONS \
+    (SG_OSG_VERSION >= 29005 \
+     || (SG_OSG_VERSION < 29000 && SG_OSG_VERSION >= 28003))
+
 #include <osg/PagedLOD>
-#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
-#include <osgDB/Options>
-#endif
+#include <osgDB/Registry>
 #include <osgDB/ReaderWriter>
 #include <simgear/props/props.hxx>
 
@@ -43,26 +46,34 @@
     META_Node(simgear, SGPagedLOD);
 
     // virtual void traverse(osg::NodeVisitor& nv);
-    virtual void forceLoad(osgDB::DatabasePager* dbp);
+    virtual void forceLoad(osgDB::DatabasePager* dbp,
+                           osg::NodePath& path);
 
     // reimplemented to notify the loading through ModelData
     bool addChild(osg::Node *child);
 
     void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) {
+        options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
+#if SG_PAGEDLOD_HAS_OPTIONS
+        setDatabaseOptions(options);
+#else
         _readerWriterOptions = options;
-        options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
-#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5)
-        setDatabaseOptions(options);
 #endif
     }
 
     osgDB::ReaderWriter::Options* getReaderWriterOptions() {
+#if SG_PAGEDLOD_HAS_OPTIONS
+        return static_cast<osgDB::ReaderWriter::Options*>(getDatabaseOptions());
+#else
         return _readerWriterOptions.get();
+#endif
     }
 
 protected:
     virtual ~SGPagedLOD();
+#if !SG_PAGEDLOD_HAS_OPTIONS
     osg::ref_ptr<osgDB::ReaderWriter::Options> _readerWriterOptions;
+#endif
 };
 }
 #endif

Modified: simgear/trunk/simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx
URL: http://svn.debian.org/wsvn/pkg-fgfs/simgear/trunk/simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx?rev=128&op=diff
==============================================================================
--- simgear/trunk/simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx (original)
+++ simgear/trunk/simgear/scene/tgdb/SGReaderWriterBTGOptions.hxx Thu Jul 21 01:04:12 2011
@@ -21,6 +21,7 @@
 #include <simgear/scene/tgdb/obj.hxx>
 class SGReaderWriterBTGOptions : public osgDB::ReaderWriter::Options {
 public:
+    META_Object(simgear,SGReaderWriterBTGOptions);
     SGReaderWriterBTGOptions(const std::string& str = std::string()) :
         osgDB::ReaderWriter::Options(str),
         _matlib(0), _calcLights(true),




More information about the pkg-fgfs-crew mailing list