]> git.mxchange.org Git - flightgear.git/commitdiff
Use deferred models for scenery tile models.
authorMathias Froehlich <Mathias.Froehlich@web.de>
Tue, 8 Nov 2011 20:25:10 +0000 (21:25 +0100)
committerMathias Froehlich <Mathias.Froehlich@web.de>
Tue, 8 Nov 2011 20:25:10 +0000 (21:25 +0100)
Instead of PagedLOD nodes use ProxyNodes for models in
scenery tiles. This should lower the amount of PagedLOD nodes
in the active scene. Since the models are part of the to level
tiles they are then paged out once the tile is paged out.

src/Scenery/SceneryPager.cxx
src/Scenery/SceneryPager.hxx
src/Scenery/tilemgr.cxx

index 9328973ef4c6162deb3c5e1ca60d690a41269106..7d76ba727c36d63d6461c9dbe36cb54456d09deb 100644 (file)
@@ -20,7 +20,6 @@
 #  include <config.h>
 #endif
 
-#include <simgear/scene/model/SGPagedLOD.hxx>
 #include <simgear/math/SGMath.hxx>
 #include "SceneryPager.hxx"
 #include <algorithm>
@@ -44,25 +43,6 @@ SceneryPager::~SceneryPager()
 {
 }
 
-#if SG_PAGEDLOD_HAS_OPTIONS
-#else
-void SceneryPager::requestNodeFile(const std::string& fileName, Group* group,
-                                   float priority, const FrameStamp* framestamp,
-                                   ref_ptr<Referenced>& databaseRequest,
-                                   osgDB::ReaderWriter::Options* options)
-{
-    simgear::SGPagedLOD *sgplod = dynamic_cast<simgear::SGPagedLOD*>(group);
-    if(sgplod)
-        DatabasePager::requestNodeFile(fileName, group, priority, framestamp,
-                                       databaseRequest,
-                                       sgplod->getReaderWriterOptions());
-    else
-        DatabasePager::requestNodeFile(fileName, group, priority, framestamp,
-                                       databaseRequest,
-                                       options);
-}
-#endif
-
 void SceneryPager::queueRequest(const std::string& fileName, Group* group,
                                 float priority, FrameStamp* frameStamp,
                                 ref_ptr<Referenced>& databaseRequest,
index 04e6ef5c499e016cf13108363baa3a7ceb57a80b..d8f519a1bc3960255701c0ea058240060efddcb7 100644 (file)
@@ -28,7 +28,6 @@
 #include <osgDB/DatabasePager>
 
 #include <simgear/structure/OSGVersion.hxx>
-#include <simgear/scene/model/SGPagedLOD.hxx>
 
 namespace flightgear
 {
@@ -39,15 +38,6 @@ public:
     SceneryPager(const SceneryPager& rhs);
     // Unhide DatabasePager::requestNodeFile
     using osgDB::DatabasePager::requestNodeFile;
-    // reimplement to add readerWriterOptions from SGPagedLOD
-#if SG_PAGEDLOD_HAS_OPTIONS
-#else
-    virtual void requestNodeFile(const std::string& fileName, osg::Group* group,
-                                 float priority,
-                                 const osg::FrameStamp* framestamp,
-                                 osg::ref_ptr<osg::Referenced>& databaseRequest,
-                                 osgDB::ReaderWriter::Options* options);
-#endif
     void queueRequest(const std::string& fileName, osg::Group* node,
                       float priority, osg::FrameStamp* frameStamp,
                       osg::ref_ptr<osg::Referenced>& databaseRequest,
index 5d7821307587f6aeb03019837d4ab1276cf8b669..e511213f8de75dec3dbc394d199197b0be09a8a8 100644 (file)
@@ -29,6 +29,7 @@
 #include <functional>
 
 #include <osgViewer/Viewer>
+#include <osgDB/Registry>
 
 #include <simgear/constants.h>
 #include <simgear/debug/logstream.hxx>
@@ -275,8 +276,8 @@ FGTileMgr::loadTileModel(const string& modelPath, bool cacheModel)
                                       new FGNasalModelData);
         else
             result=
-                SGModelLib::loadPagedModel(fullPath.str(), globals->get_props(),
-                                           new FGNasalModelData);
+                SGModelLib::loadDeferedModel(fullPath.str(), globals->get_props(),
+                                             new FGNasalModelData);
     } catch (const sg_io_exception& exc) {
         string m(exc.getMessage());
         m += " ";