VR-Forces 4.2 Class Documentation
List of all members | Public Member Functions | Protected Member Functions | Protected Attributes
DtOsgEarthTerrainSourcePager Class Reference

DtOsgEarthTerrainSourcePager is a derived terrainSourcePager that handles a streaming terrain source. More...

Inheritance diagram for DtOsgEarthTerrainSourcePager:
Inheritance graph
[legend]

Public Member Functions

 DtOsgEarthTerrainSourcePager (DtVantageTerrainEngine *terrainEngine, osgEarth::MapNode *mapNode)
virtual ~DtOsgEarthTerrainSourcePager ()
virtual DtTerrainSourceTrackercreateTerrainSourceTracker ()
 Creates and returns a DtOsgEarthTerrainSourceTracker.
virtual bool pageInTiles (DtTileKeyList &tileIds, const unsigned int intersectId=0)
 Iterates over tileIds and calls pageInTile on each one.
virtual bool pageOutTiles (const DtTileKeyList &tilesToRemove)
 Pages out the requested tiles, removes the corresponding collision objects from the collision world, decrements the terrainEngine's triangle count, and decrements the terrainEngine's pending removal command count.
virtual void updatePageTracker (const unsigned int intersectId=0)
 Updates the DtOsgEarthTerrainSourceTracker.
- Public Member Functions inherited from DtTerrainSourcePager
 DtTerrainSourcePager (DtVantageTerrainEngine *terrainEngine)
 Constructor.
virtual ~DtTerrainSourcePager ()
 Destructor. Deletes all pending commands and myTerrainSourceTracker.
virtual void tick ()
 Processes commands from the priority-sorted command map.
virtual DtTerrainSourceTrackerterrainSourceTracker ()
 Accessor for myTerrainSourceTracker.
virtual int highestPriorityPendingWork ()
 Calls processCommandQueue to add new commands into the priority-sorted command map.
virtual void processCommandQueue ()
 Takes incoming commands off the command queue and adds them to the priority-sorted command map.
virtual void setCurrentTime (const double &currentTime)
 Sets myCurrentTime for purposes of expiring old page-in commands.

Protected Member Functions

virtual bool addCollisionObject (osg::ref_ptr< osg::Node > node, unsigned int &numTrianglesOut)
 Creates a collision object from the given terrain tile and adds it to the collision world.
virtual bool pageInTile (const osgEarth::TileKey &tileKey, const unsigned int intersectId=0)
 Creates the requested osg heightfield, adds the heightfield as a collision shape to the bullet collision world, and adds the record of the tile to the pager's terrainSourceTracker for tracking and paging out purposes.
virtual bool pageOutTile (const osgEarth::TileKey &tileKey)
 Removes the heightfield and the corresponding collision object from the collision world.
virtual DtTileDatacreateTileData (const osgEarth::TileKey &tileKey, const unsigned int &numTriangles, const unsigned int intersectId=0) const
 Sets up and returns a new DtTileData object.
virtual const unsigned int determineTrackerLod ()
 Called by createTerrainSourceTracker.
virtual DtNodeId osgNodeId (osg::Node *node)
virtual osg::Node * nodeFromId (DtNodeId nodeId)
virtual void createEmptyTile (const osgEarth::TileKey &tileKey, const unsigned int intersectId=0)
 Used when a tile cannot be created by osgEarth's tileBuilder.

Protected Attributes

osgEarth::MapNode * myMapNode
 Map node which is used to generate heightfields.
DtTerrainTileMap myPagedInTilesMap
 Map of tileIds to terrainTiles.
osg::ref_ptr< osgTerrain::Terrain > myOsgTerrain
 Used when a heightfield cannot be created to.
- Protected Attributes inherited from DtTerrainSourcePager
tbb::spin_rw_mutex myMutex
DtVantageTerrainEnginemyTerrainEngine
 Pointer to the terrain implementation's terrain engine.
DtTerrainSourceTrackermyTerrainSourceTracker
 The terrain source tracker that is updated by this pager.
double myCurrentTime
 Time to compare a command's expire time to before executing the command.
DtPagerCommandQueue myCommandQueue
 Thread-safe queue to put commands on.
DtCommandPriorityMultimap myPriorityCommandMultimap
 Multimap of priorities to paging commands.

Detailed Description

DtOsgEarthTerrainSourcePager is a derived terrainSourcePager that handles a streaming terrain source.

Constructor & Destructor Documentation

DtOsgEarthTerrainSourcePager::DtOsgEarthTerrainSourcePager ( DtVantageTerrainEngine terrainEngine,
osgEarth::MapNode *  mapNode 
)
virtual DtOsgEarthTerrainSourcePager::~DtOsgEarthTerrainSourcePager ( )
virtual

Member Function Documentation

virtual DtTerrainSourceTracker* DtOsgEarthTerrainSourcePager::createTerrainSourceTracker ( )
virtual

Creates and returns a DtOsgEarthTerrainSourceTracker.

Implements DtTerrainSourcePager.

virtual bool DtOsgEarthTerrainSourcePager::pageInTiles ( DtTileKeyList tileIds,
const unsigned int  intersectId = 0 
)
virtual

Iterates over tileIds and calls pageInTile on each one.

Parameters
tileIdsList of tileIds to page in. When a tile is successfuly paged in, it is removed from this list.
intersectIdOptional intersectId to seed new tiles with.
Returns
True if all tiles are paged in.
virtual bool DtOsgEarthTerrainSourcePager::pageOutTiles ( const DtTileKeyList tilesToRemove)
virtual

Pages out the requested tiles, removes the corresponding collision objects from the collision world, decrements the terrainEngine's triangle count, and decrements the terrainEngine's pending removal command count.

Parameters
tilesToRemoveList of tileIds to page out.
Returns
True if all tiles are removed successfully.
virtual void DtOsgEarthTerrainSourcePager::updatePageTracker ( const unsigned int  intersectId = 0)
virtual
virtual bool DtOsgEarthTerrainSourcePager::addCollisionObject ( osg::ref_ptr< osg::Node >  node,
unsigned int &  numTrianglesOut 
)
protectedvirtual

Creates a collision object from the given terrain tile and adds it to the collision world.

Parameters
terrainTileThe terrain tile to create a collision object for.
numTrianglesOutThe number of triangles that were added to the collision world by this terrainTile.
Returns
True if the collision object was created successfully and added to the collision world.
virtual bool DtOsgEarthTerrainSourcePager::pageInTile ( const osgEarth::TileKey &  tileKey,
const unsigned int  intersectId = 0 
)
protectedvirtual

Creates the requested osg heightfield, adds the heightfield as a collision shape to the bullet collision world, and adds the record of the tile to the pager's terrainSourceTracker for tracking and paging out purposes.

Parameters
tileIdsThe tileKey to create heightfield for.
intersectIdOptional parameter to create the tiles with a starting "lastUsed" value of intersectId.
Returns
True if the heightfield is created, the collision object is created and added to the collision world, and the tracking info is added to the terrainSourceTracker.
virtual bool DtOsgEarthTerrainSourcePager::pageOutTile ( const osgEarth::TileKey &  tileKey)
protectedvirtual

Removes the heightfield and the corresponding collision object from the collision world.

Also removes the tracker's reference to this tile, decrements the terrainEngine's number of triangles, and number of pending page out commands.

Returns
True if all data is successfully removed.
virtual DtTileData* DtOsgEarthTerrainSourcePager::createTileData ( const osgEarth::TileKey &  tileKey,
const unsigned int &  numTriangles,
const unsigned int  intersectId = 0 
) const
protectedvirtual

Sets up and returns a new DtTileData object.

Parameters
tileKeyThe tile key of the terrain to create tile data for.
heightFieldThe heightfield, used to get the corner heights.
numTrianglesThe number of triangles contained in this patch of data.
intersectIdOptional intersectId to seed the tileData with for page-out priority.
Returns
Newly created DtTileData.
virtual const unsigned int DtOsgEarthTerrainSourcePager::determineTrackerLod ( )
protectedvirtual

Called by createTerrainSourceTracker.

Determines lod to use for terrrain source tracker, based on myMapNode.

virtual DtNodeId DtOsgEarthTerrainSourcePager::osgNodeId ( osg::Node *  node)
protectedvirtual
virtual osg::Node* DtOsgEarthTerrainSourcePager::nodeFromId ( DtNodeId  nodeId)
protectedvirtual
virtual void DtOsgEarthTerrainSourcePager::createEmptyTile ( const osgEarth::TileKey &  tileKey,
const unsigned int  intersectId = 0 
)
protectedvirtual

Used when a tile cannot be created by osgEarth's tileBuilder.

Creates a Terrain Tile with all heights at 0.

Member Data Documentation

osgEarth::MapNode* DtOsgEarthTerrainSourcePager::myMapNode
protected

Map node which is used to generate heightfields.

osg::ref_ptr<osgTerrain::Terrain> DtOsgEarthTerrainSourcePager::myOsgTerrain
protected

Used when a heightfield cannot be created to.

DtTerrainTileMap DtOsgEarthTerrainSourcePager::myPagedInTilesMap
protected

Map of tileIds to terrainTiles.


The documentation for this class was generated from the following file:

Document ID: Generated on Sun Nov 24 19:49:21 EST 2013 from SVN revision 133924
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)