diff --git a/simgear/constants.h b/simgear/constants.h index 316fa7f5..42ec8d39 100644 --- a/simgear/constants.h +++ b/simgear/constants.h @@ -218,6 +218,9 @@ const float SG_RADIANS_TO_DEGREES = 180.0f / SG_PI; #define SG_OBJECT_RANGE_ROUGH 9000.0 #define SG_OBJECT_RANGE_DETAILED 1500.0 +/** Minimum expiry time of PagedLOD within the Tile. Overridden by /sim/rendering/plod-minimum-expiry-time-secs **/ +#define SG_TILE_MIN_EXPIRY 180.0 + /** Radius of scenery tiles in m **/ #define SG_TILE_RADIUS 14000.0 diff --git a/simgear/scene/tgdb/ReaderWriterSTG.cxx b/simgear/scene/tgdb/ReaderWriterSTG.cxx index ec373fea..273a3232 100644 --- a/simgear/scene/tgdb/ReaderWriterSTG.cxx +++ b/simgear/scene/tgdb/ReaderWriterSTG.cxx @@ -219,7 +219,8 @@ struct ReaderWriterSTG::_ModelBin { STGObjectsQuadtree quadtree((GetModelLODCoord()), (AddModelLOD())); quadtree.buildQuadTree(_objectStaticList.begin(), _objectStaticList.end()); osg::ref_ptr group = quadtree.getRoot(); - group->setName("STG-group-A"); + string group_name = string("STG-group-A ").append(_bucket.gen_index_str()); + group->setName(group_name); group->setDataVariance(osg::Object::STATIC); simgear::AirportSignBuilder signBuilder(_options->getMaterialLib(), _bucket.get_center()); @@ -640,10 +641,12 @@ struct ReaderWriterSTG::_ModelBin { { osg::ref_ptr options; options = SGReaderWriterOptions::copyOrCreate(opt); + float pagedLODExpiry = atoi(options->getPluginStringData("SimGear::PAGED_LOD_EXPIRY").c_str()); osg::ref_ptr terrainGroup = new osg::Group; terrainGroup->setDataVariance(osg::Object::STATIC); - terrainGroup->setName("terrain"); + std::string terrain_name = string("terrain ").append(bucket.gen_index_str()); + terrainGroup->setName(terrain_name); bool vpb_active = SGSceneFeatures::instance()->getVPBActive(); if (vpb_active) { @@ -702,11 +705,13 @@ struct ReaderWriterSTG::_ModelBin { } else { osg::PagedLOD* pagedLOD = new osg::PagedLOD; pagedLOD->setCenterMode(osg::PagedLOD::USE_BOUNDING_SPHERE_CENTER); - pagedLOD->setName("pagedObjectLOD"); + std::string name = string("pagedObjectLOD ").append(bucket.gen_index_str()); + pagedLOD->setName(name); // This should be visible in any case. // If this is replaced by some lower level of detail, the parent LOD node handles this. pagedLOD->addChild(terrainGroup, 0, std::numeric_limits::max()); + pagedLOD->setMinimumExpiryTime(0, pagedLODExpiry); // we just need to know about the read file callback that itself holds the data osg::ref_ptr readFileCallback = new DelayLoadReadFileCallback; @@ -724,10 +729,11 @@ struct ReaderWriterSTG::_ModelBin { // Objects may end up displayed up to 2x the object range. pagedLOD->setRange(pagedLOD->getNumChildren(), 0, 2.0 * _object_range_rough); + pagedLOD->setMinimumExpiryTime(pagedLOD->getNumChildren(), pagedLODExpiry); pagedLOD->setRadius(SG_TILE_RADIUS); - SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile PagedLOD Center: " << pagedLOD->getCenter().x() << "," << pagedLOD->getCenter().y() << "," << pagedLOD->getCenter().z() ); - SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile PagedLOD Range: " << (2.0 * _object_range_rough)); - SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile PagedLOD Radius: " << SG_TILE_RADIUS); + SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile " << bucket.gen_index_str() << " PagedLOD Center: " << pagedLOD->getCenter().x() << "," << pagedLOD->getCenter().y() << "," << pagedLOD->getCenter().z() ); + SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile " << bucket.gen_index_str() << " PagedLOD Range: " << (2.0 * _object_range_rough)); + SG_LOG( SG_TERRAIN, SG_DEBUG, "Tile " << bucket.gen_index_str() << " PagedLOD Radius: " << SG_TILE_RADIUS); return pagedLOD; } }