X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fscene%2Fmodel%2FModelRegistry.hxx;h=8c8e7467386cd6c7bda347f6678cdb89147f9445;hb=32a6bd78d8bf143f40922f1a0bc7a88ea7706a7d;hp=0096315156c6cbdbd3e9c21033539aa82f874a03;hpb=6a7c2000027cd22eea603e936ddbad1a5bfc8b04;p=simgear.git diff --git a/simgear/scene/model/ModelRegistry.hxx b/simgear/scene/model/ModelRegistry.hxx index 00963151..8c8e7467 100644 --- a/simgear/scene/model/ModelRegistry.hxx +++ b/simgear/scene/model/ModelRegistry.hxx @@ -19,8 +19,6 @@ #ifndef _SG_MODELREGISTRY_HXX #define _SG_MODELREGISTRY_HXX 1 -#include - #include #include #include @@ -29,7 +27,7 @@ #include #include -#include +#include #include #include @@ -72,7 +70,7 @@ public: } virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt) + const osgDB::Options* opt) { using namespace osg; using namespace osgDB; @@ -97,15 +95,16 @@ public: optimizedNode = _optimizePolicy.optimize(processedNode.get(), fileName, opt); } - _bvhPolicy.buildBVH(fileName, optimizedNode.get()); + if (opt->getPluginStringData("SimGear::BOUNDINGVOLUMES") != "OFF") + _bvhPolicy.buildBVH(fileName, optimizedNode.get()); _cachePolicy.addToCache(fileName, optimizedNode.get()); } - return ReaderWriter::ReadResult(optimizedNode); + return ReaderWriter::ReadResult(optimizedNode.get()); } protected: static osgDB::ReaderWriter::ReadResult loadUsingReaderWriter(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt) + const osgDB::Options* opt) { using namespace osgDB; ReaderWriter* rw = Registry::instance() @@ -128,20 +127,20 @@ protected: struct DefaultProcessPolicy { DefaultProcessPolicy(const std::string& extension) {} osg::Node* process(osg::Node* node, const std::string& filename, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); }; struct DefaultCachePolicy { DefaultCachePolicy(const std::string& extension) {} osg::Node* find(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); void addToCache(const std::string& filename, osg::Node* node); }; struct NoCachePolicy { NoCachePolicy(const std::string& extension) {} osg::Node* find(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt) + const osgDB::Options* opt) { return 0; } @@ -152,7 +151,7 @@ class OptimizeModelPolicy { public: OptimizeModelPolicy(const std::string& extension); osg::Node* optimize(osg::Node* node, const std::string& fileName, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); protected: unsigned _osgOptions; }; @@ -160,7 +159,7 @@ protected: struct NoOptimizePolicy { NoOptimizePolicy(const std::string& extension) {} osg::Node* optimize(osg::Node* node, const std::string& fileName, - const osgDB::ReaderWriter::Options* opt) + const osgDB::Options* opt) { return node; } @@ -169,13 +168,13 @@ struct NoOptimizePolicy { struct OSGSubstitutePolicy { OSGSubstitutePolicy(const std::string& extension) {} std::string substitute(const std::string& name, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); }; struct NoSubstitutePolicy { NoSubstitutePolicy(const std::string& extension) {} std::string substitute(const std::string& name, - const osgDB::ReaderWriter::Options* opt) + const osgDB::Options* opt) { return std::string(); } @@ -208,10 +207,10 @@ public: ModelRegistry(); virtual osgDB::ReaderWriter::ReadResult readImage(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); virtual osgDB::ReaderWriter::ReadResult readNode(const std::string& fileName, - const osgDB::ReaderWriter::Options* opt); + const osgDB::Options* opt); void addImageCallbackForExtension(const std::string& extension, osgDB::Registry::ReadFileCallback* callback); @@ -225,9 +224,6 @@ protected: CallbackMap imageCallbackMap; CallbackMap nodeCallbackMap; osg::ref_ptr _defaultCallback; - // Protect against simultaneous calls from main thread (MP models) - // and pager thread. - OpenThreads::ReentrantMutex readerMutex; }; // Callback that only loads the file without any caching or