]> git.mxchange.org Git - simgear.git/blobdiff - simgear/scene/model/SGPagedLOD.cxx
Merge branch 'next' of git.gitorious.org:fg/simgear into next
[simgear.git] / simgear / scene / model / SGPagedLOD.cxx
index 531b45b0b74efc9e012b81ef4867dcd9138f1083..b44019b7ec5ada7b3168f8cee6b6af4ce48d3508 100644 (file)
@@ -35,6 +35,8 @@
 using namespace osg;
 using namespace simgear;
 
+bool SGPagedLOD::_cache = true;
+
 SGPagedLOD::SGPagedLOD()
         : PagedLOD()
 {
@@ -46,9 +48,25 @@ SGPagedLOD::~SGPagedLOD()
 }
 
 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
+{
+}
+
+void
+SGPagedLOD::setReaderWriterOptions(osgDB::ReaderWriter::Options *options)
 {
+    if (_cache)
+        options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_ALL);
+    else
+        options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE);
+#if SG_PAGEDLOD_HAS_OPTIONS
+    setDatabaseOptions(options);
+#else
+    _readerWriterOptions = options;
+#endif
 }
 
 bool SGPagedLOD::addChild(osg::Node *child)
@@ -84,7 +102,7 @@ void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp, FrameStamp* framestamp,
     dbp->requestNodeFile(getFileName(childNum), NodePathProxy(path),
                          priority, framestamp,
                          getDatabaseRequest(childNum),
-                         _readerWriterOptions.get());
+                         getReaderWriterOptions());
 }
 
 bool SGPagedLOD_writeLocalData(const Object& obj, osgDB::Output& fw)