diff --git a/simgear/bucket/newbucket.hxx b/simgear/bucket/newbucket.hxx index 92b0297d..6243b146 100644 --- a/simgear/bucket/newbucket.hxx +++ b/simgear/bucket/newbucket.hxx @@ -182,6 +182,20 @@ public: return ((lon + 180) << 14) + ((lat + 90) << 6) + static_cast(y << 3) + x; } + /** + * Generate a tile index for this bucket shared with all other buckets with the same lat/lon. + * Used as an index for VPB tiles, which are 1x1 in size. + * + * The index is constructed as follows: + * + * 9 bits - to represent 360 degrees of longitude (-180 to 179) + * 8 bits - to represent 180 degrees of latitude (-90 to 89) + * @return tile index + */ + inline long int gen_vpb_index() const { + return ((lon + 180) << 8) + (lat + 90); + } + /** * Generate the unique scenery tile index for this bucket in ascii * string form. diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index 75ca6a30..3bab4097 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -765,7 +765,6 @@ struct ReaderWriterSTG::_ModelBin { osg::Node* load(const SGBucket& bucket, const osgDB::Options* opt) { osg::ref_ptr options; - osg::ref_ptr vpb_node; options = SGReaderWriterOptions::copyOrCreate(opt); float pagedLODExpiry = atoi(options->getPluginStringData("SimGear::PAGED_LOD_EXPIRY").c_str()); @@ -819,27 +818,6 @@ struct ReaderWriterSTG::_ModelBin { VPBTechnique::addCoastlineList(bucket, coastFeatures); } - std::string filename = "vpb/" + bucket.gen_vpb_base() + ".osgb"; - - // Lock for this scope - { - const std::lock_guard lock(ReaderWriterSTG::_tileMapMutex); - - if (_tileMap.count(filename) == 0) { - vpb_node = osgDB::readRefNodeFile(filename, options); - if (!vpb_node.valid()) { - SG_LOG(SG_TERRAIN, SG_WARN, "Failure to load: " <addChild(vpb_node); - _tileMap[filename] = vpb_node; - SG_LOG(SG_TERRAIN, SG_INFO, "Loading: " << filename); - } - } else { - vpb_node = _tileMap[filename]; - } - } - // OBJECTs include airports for (auto stgObject : _objectList) { osg::ref_ptr node; diff --git a/simgear/scene/tgdb/ReaderWriterSTG.hxx b/simgear/scene/tgdb/ReaderWriterSTG.hxx index 9fa1354d..bbf3ebbb 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.hxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.hxx @@ -50,10 +50,6 @@ public: static void removeSTGObjectHandler(const std::string &token, STGObjectCallback callback); private: struct _ModelBin; - - inline static std::map > _tileMap; - inline static std::mutex _tileMapMutex; // protects the _lineFeatureLists; - }; }