VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
osgEarthTerrainSourcePager.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2024 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 #pragma once
6 
9 
12 
17 
19 
20 #include <osgEarth/MapNode>
21 #include <osgEarth/GeoData>
22 #include <osgEarth/LandCoverLayer>
23 #include <osgEarth/TerrainConstraintLayer>
24 #include <osgEarthProcedural/LifeMapLayer>
25 
26 #include <osgTerrain/Terrain>
27 
28 #include <tbb/task_arena.h>
29 
30 namespace osgEarth
31 {
32  class TerrainTileModel;
33  class Map;
34 };
35 
36 extern std::ostream theNullOutputStream;
37 
41 DT_DLL_vantageTerrainImplementation int maxSetLodForMap(const osgEarth::Map* map, int defValue, std::ostream& infoOutputStream = theNullOutputStream);
42 
47 {
48 public:
49 
50  DtOsgEarthTerrainSourcePager(DtVantageTerrainEngine* terrainEngine, osgEarth::MapNode* mapNode);
51 
52  virtual ~DtOsgEarthTerrainSourcePager() override;
53 
56 
57  virtual DtString type() const override;
58 
60 
61  virtual DtTerrainIntersectOptions::Fidelity intersectFidelity() const;
62  virtual void setIntersectFidelity(DtTerrainIntersectOptions::Fidelity);
64 
67  virtual bool init() override;
68 
72  virtual void tick() override;
73 
79  virtual bool pageInTiles(DtTileKeyList& tileIds,
80  DtTerrainIntersectIDType intersectId = 0,
81  bool forcePageInAllData = false);
82 
88  virtual bool pageOutTiles(const DtTileKeyList& tilesToRemove);
89 
91  virtual void updatePageTracker(DtTerrainIntersectIDType intersectId = 0) override;
92 
94  virtual int highestPriorityPendingWork() override;
95 
98  virtual const unsigned int determineTrackerLod();
99 
101  virtual osgEarth::TerrainOptionsAPI osgEarthTerrainOptions() const;
102 
104  virtual void findMissingTiles(const DtTerrainPagingGeometryPtr& geometry, DtTileKeyList& tiles) const;
105 
106 
109  unsigned reloadQueuedPages();
110 
111 
112  virtual unsigned queuePageReloadsWithinExtent(
113  const osgEarth::GeoExtent& extent, const DtUUID& dynamicUuid, bool isRemoval = false) override;
114 
116  static osgTerrain::Locator* createLocatorForKey( const osgEarth::TileKey& key, const osgEarth::Util::MapNode& mapInfo);
117 
119  virtual void setTerrainSourcePagerName(const std::string& name);
120 
122  virtual std::string terrainSourcePagerName();
123 
125  virtual TerrainConstraintQuery* getTerrainConstraintQuery() { return &myTerrainConstraintQuery; };
126 
127 protected:
128 
130  virtual unsigned queuePagesToReloadNotAlreadyLoaded(const osgEarth::GeoExtent & extent);
131 
137  virtual bool reloadTile(const osgEarth::TileKey & tileKey, bool isRemoval = false);
138 
143  virtual bool findFirstParent(osgEarth::TileKey & firstParentTileKey, const osgEarth::TileKey & tileKey);
144 
149  virtual bool modifyMaskExtentsForFirstParent(const std::shared_ptr<DtTileData> tileData, bool isRemoval = false);
150 
161  virtual bool pageInTile(const osgEarth::TileKey& tileKey,
162  DtTerrainIntersectIDType intersectId = 0,
163  bool forcePageInAllData = false);
164 
171  virtual bool pageOutTile(const osgEarth::TileKey& tileKey, bool pageOutSubtiles);
172 
178  virtual std::shared_ptr<DtTileData> createTileDataFromTileModel(
179  const osgEarth::TileKey& tilekey,
180  DtTerrainIntersectIDType intersectId,
181  bool createIfAlreadyLoaded = false) const;
182 
187  virtual std::shared_ptr<DtTileData> createTileDataFromHeightfield(
188  const osgEarth::TileKey& tilekey,
189  DtTerrainIntersectIDType intersectId,
190  const osg::ref_ptr<const osg::HeightField>& heightfield) const;
191 
196  virtual std::shared_ptr<DtTileData> createTileDataFromGeometry(
197  const osgEarth::TileKey& tilekey,
198  DtTerrainIntersectIDType intersectId,
199  const osg::ref_ptr<osg::Node>& geometry) const;
200 
211  virtual void addTile(const osgEarth::TileKey& tilekey, const std::shared_ptr<DtTileData>& tile);
212 
215  virtual void addEmptyTile(const osgEarth::TileKey& tilekey, DtTerrainIntersectIDType intersectId = 0);
216 
218  virtual void addMasks(const osgEarth::TileKey& tilekey, const std::shared_ptr<DtTileData>& tile);
219 
220  virtual bool hasConstraintsOrDynamicTerrain(const TileKey& key);
221 
224 
227 
230 
232  tbb::task_arena myArena;
233 
235  std::string myTerrainPagerName;
236 
240 
242  osg::observer_ptr <osgEarth::Procedural::LifeMapLayer> myLifeMapLayer;
243 
245  TerrainConstraintQuery myTerrainConstraintQuery;
246 
248  osgEarth::Procedural::LandCoverSample::Factory::Ptr myFactory;
249 
251  osgEarth::Procedural::LandCoverSample::Factory::Ptr myDynamicTerrainFactory;
252 
254  osgEarth::CoverageLayer* myDynamicCoverageLayer;
255 };
256 
UUID is a unique ID wrapper class.
Definition: uuid.h:59
virtual unsigned queuePageReloadsWithinExtent(const osgEarth::GeoExtent &extent, const DtUUID &dynamicUuid, bool isRemoval=false)
std::list< osgEarth::TileKey > DtTileKeyList
Definition: tileSpatialIndex.h:32
virtual bool init()
Called after pager is configured.
osg::observer_ptr< osgEarth::Procedural::LifeMapLayer > myLifeMapLayer
life map layer in the map node
Definition: osgEarthTerrainSourcePager.h:242
std::string myTerrainPagerName
terrain pager name
Definition: osgEarthTerrainSourcePager.h:235
DtTerrainSourcePager is the base class for terrain pagers. There will be one terrainSourcePager per t...
Definition: terrainSourcePager.h:56
DtOsgEarthTerrainSourceTracker * myOsgTracker
Associated Tracker.
Definition: osgEarthTerrainSourcePager.h:223
DtOsgEarthTerrainSourcePager is a derived terrainSourcePager that handles a streaming terrain source...
Definition: osgEarthTerrainSourcePager.h:45
Definition: featureContext.h:36
bool myUseLegacyFindIntersection
If you set the environment variable &quot;UseLegacyFindIntersection=true&quot; it will use the old recursive Fi...
Definition: osgEarthTerrainSourcePager.h:239
unsigned long long DtTerrainIntersectIDType
Definition: terrainInterfaceDefines.h:28
virtual DtString type() const =0
virtual DtTerrainSourceTracker * createTerrainSourceTracker(DtVantageTerrainEngine *)=0
Creates and returns a DtTerrainSourceTracker.
osg::ref_ptr< osgTerrain::Terrain > myOsgTerrain
Used when a heightfield cannot be created.
Definition: osgEarthTerrainSourcePager.h:226
tbb::task_arena myArena
Tbb arena to limit number of threads.
Definition: osgEarthTerrainSourcePager.h:232
Definition: osgEarthTerrainSourceTracker.h:66
osgEarth::Procedural::LandCoverSample::Factory::Ptr myDynamicTerrainFactory
Dynamic terrain Life map coverage layer factory.
Definition: osgEarthTerrainSourcePager.h:251
std::ostream theNullOutputStream
std::shared_ptr< DtTerrainPagingGeometry > DtTerrainPagingGeometryPtr
Definition: terrainPagingGeometry.h:46
Base class for Terrain Source trackers. Determines if the necessary data To perform an intersection i...
Definition: terrainSourceTracker.h:75
virtual TerrainConstraintQuery * getTerrainConstraintQuery()
get the TerrainConstraintQuery
Definition: osgEarthTerrainSourcePager.h:125
TerrainConstraintQuery myTerrainConstraintQuery
Terrain constrain that also contain FeatureMask.
Definition: osgEarthTerrainSourcePager.h:245
osgEarth::CoverageLayer * myDynamicCoverageLayer
Dynamic terrain coverage layer.
Definition: osgEarthTerrainSourcePager.h:254
virtual void updatePageTracker(DtTerrainIntersectIDType intersectId=0)=0
Fidelity
Allows the system to use differently fidelity data for intersecting against. Currently only implement...
Definition: terrainIntersectOptions.h:102
osgEarth::Procedural::LandCoverSample::Factory::Ptr myFactory
Life map coverage layer factory.
Definition: osgEarthTerrainSourcePager.h:248
#define DT_DLL_vantageTerrainImplementation
This file is used to determine how to build.
Definition: vantageTerrainImplementationDefines.h:28
virtual void tick()
Processes commands from the priority-sorted command map. Executes the first command and returns...
virtual int highestPriorityPendingWork()
Calls processCommandQueue to add new commands into the priority-sorted command map. Then returns the priority of the highest-priority pending command.
DT_DLL_vantageTerrainImplementation int maxSetLodForMap(const osgEarth::Map *map, int defValue, std::ostream &infoOutputStream=theNullOutputStream)
Returns the maximum max_level or max_data_level of all elevation layers in the specified map...
DtTerrainIntersectOptions::Fidelity myFidelity
Which intersection fidelity this pager is setup for.
Definition: osgEarthTerrainSourcePager.h:229
This class wraps the VR-Vantage Display Engine, and uses as a terrain loader and intersector. This is the terrain engine that powers the DtVantageTerrainImplementation. The DtVantageTerrainEngine runs the DtDe it its own thread, and processes commands thought the command queue.
Definition: vantageTerrainEngine.h:112

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)