#include <terrain.h>

Public Member Functions | |
| Terrain (const std::string &name="Terrain") | |
| Default Constructor - Sets the name and performs some routine registration. | |
| void | AddResourcePath (const std::string &path) |
| Adds a search path to the list of file paths to search for when loading terrain data or other resources. | |
| void | RemoveResourcePath (const std::string &path) |
| Removes a resource path from the list of known resource paths. | |
| const std::list< std::string > & | GetResourcePathList () const |
| Gets the terrain's current list of resource search paths. | |
| const std::string | FindResource (const std::string &path) |
| Searches the terrains resource path list for the specified resource. | |
| void | FindAllResources (const std::string &path, std::vector< std::string > &resourcePaths) |
| Searches the terrain resources path list for all resources matching the specified path. | |
| float | GetHeight (float x, float y) |
| Gets the height of the terrain at the given (x,y) coordinates. | |
| bool | IsClearLineOfSight (const osg::Vec3 &pointOne, const osg::Vec3 &pointTwo) |
| Given pointOne and pointTwo, both in world space and with all coordinates in Cartesian space (essentially in meters along X, Y and Z), returns true if there is a clear line of sight and false if the view is blocked. | |
| void | SetLineOfSightSpacing (float spacing) |
| float | GetLineOfSightSpacing () const |
| virtual void | LoadTerrainTile (PagedTerrainTile &newTile) |
| virtual void | UnloadTerrainTile (PagedTerrainTile &toRemove) |
| virtual void | UnloadAllTerrainTiles () |
| virtual PagedTerrainTile * | CreateTerrainTile (const GeoCoordinates &coords) |
| virtual bool | IsTerrainTileResident (const GeoCoordinates &coords) |
| virtual void | EnsureTileVisibility (const std::set< GeoCoordinates > &coordList) |
| bool | SetCachePath (const std::string &path) |
| Sets the path of the terrain cache. | |
| const std::string & | GetCachePath () const |
| Gets the current terrain cache. | |
| void | SetLoadDistance (float value) |
| float | GetLoadDistance () const |
| void | SetDataReader (TerrainDataReader *reader) |
| Sets the terrain data reader. | |
| TerrainDataReader * | GetDataReader () |
| Gets the current terrain data reader. | |
| const TerrainDataReader * | GetDataReader () const |
| Gets the current terrain data reader. | |
| void | SetDataRenderer (TerrainDataRenderer *renderer) |
| Sets the terrain data renderer. | |
| TerrainDataRenderer * | GetDataRenderer () |
| Gets the current terrain data renderer. | |
| const TerrainDataRenderer * | GetDataRenderer () const |
| Gets the current terrain data renderer. | |
| void | AddDecorationLayer (TerrainDecorationLayer *newLayer) |
| Adds a new decoration layer to this terrain. | |
| void | RemoveDecorationLayer (TerrainDecorationLayer *toRemove) |
| Removes the specified decoration layer from this terrain. | |
| void | RemoveDecorationLayer (const std::string &name) |
| Removes a decoration layer matching the specified name. | |
| TerrainDecorationLayer * | GetDecorationLayer (const std::string &name) |
| Gets the decoration layer whos name matches the specified parameter. | |
| const TerrainDecorationLayer * | GetDecorationLayer (const std::string &name) const |
| Gets the decoration layer who's name matches the specified parameter. | |
| unsigned int | GetNumDecorationLayers () const |
| Gets the number of decorator layers currently overlaid on this terrain. | |
| void | ClearDecorationLayers () |
| Removes all the decorator layers from this terrain. | |
| void | HideDecorationLayer (const std::string &name) |
| Hides the decoration layer that matches the specified name. | |
| void | HideDecorationLayer (TerrainDecorationLayer *toHide) |
| Hides the specified decoration layer. | |
| void | ShowDecorationLayer (const std::string &name) |
| Makes the decoration layer matching the specified name visible. | |
| void | ShowDecorationLayer (TerrainDecorationLayer *toShow) |
| Makes the specified decoration layer visible in the scene. | |
| void | GetDecorationLayers (std::vector< dtCore::RefPtr< TerrainDecorationLayer > > &layers) |
| Fills a vector with the decoration layers currently attached to this terrain. | |
| void | SetTerrainTileFactory (PagedTerrainTileFactory &factory) |
| PagedTerrainTileFactory * | GetTerrainTileFactory () |
| virtual void | OnMessage (dtCore::Base::MessageData *data) |
| Override to receive messages. | |
Protected Member Functions | |
| virtual | ~Terrain () |
| Cleans up the terrain and its components. | |
| virtual void | PreFrame (double frameTime) |
| virtual void | PostFrame (double frameTime) |
Protected Attributes | |
| std::queue< dtCore::RefPtr < PagedTerrainTile > > | mTilesToLoadQ |
| List of terrain tiles currently queued up for loading. | |
| TerrainTileMap | mResidentTiles |
| List of terrain tiles which are currently loaded into memory. | |
| std::queue< dtCore::RefPtr < PagedTerrainTile > > | mTilesToUnloadQ |
| Queue of terrain tiles that need to be cached or destroyed. | |
This class uses a component or aggregate based design philosophy by utilizing terrain data readers and terrain data renderers. Each reader loads a specific type of terrain data and the renderer implements a particular terrain rendering algorithm. Each of these components can be dynamically changed on each instance of this terrain class.
| dtTerrain::Terrain::Terrain | ( | const std::string & | name = "Terrain" |
) |
Default Constructor - Sets the name and performs some routine registration.
| name | The name of this terrain object. |
| dtTerrain::Terrain::~Terrain | ( | ) | [protected, virtual] |
Cleans up the terrain and its components.
| void dtTerrain::Terrain::AddResourcePath | ( | const std::string & | path | ) |
Adds a search path to the list of file paths to search for when loading terrain data or other resources.
This path must be relative to a path in the Delta3D data path list.
| The | new search path. |
| void dtTerrain::Terrain::RemoveResourcePath | ( | const std::string & | path | ) |
Removes a resource path from the list of known resource paths.
| path | The path to remove. If it is not currently in the list this method does nothing. |
| const std::list<std::string>& dtTerrain::Terrain::GetResourcePathList | ( | ) | const [inline] |
Gets the terrain's current list of resource search paths.
| const std::string dtTerrain::Terrain::FindResource | ( | const std::string & | path | ) |
Searches the terrains resource path list for the specified resource.
The first resource matching the specified path is returned.
| The | path to the resource to load. This should be either a filename or a path relative to the resource paths registered with the terrain. |
| void dtTerrain::Terrain::FindAllResources | ( | const std::string & | path, | |
| std::vector< std::string > & | resourcePaths | |||
| ) |
Searches the terrain resources path list for all resources matching the specified path.
The path to the resource to load. This should be either a filename or a path relative to the resource paths registered with the terrain. The result list filled with absolute paths to all resources matching the specified path.
| float dtTerrain::Terrain::GetHeight | ( | float | x, | |
| float | y | |||
| ) |
Gets the height of the terrain at the given (x,y) coordinates.
| bool dtTerrain::Terrain::IsClearLineOfSight | ( | const osg::Vec3 & | pointOne, | |
| const osg::Vec3 & | pointTwo | |||
| ) |
Given pointOne and pointTwo, both in world space and with all coordinates in Cartesian space (essentially in meters along X, Y and Z), returns true if there is a clear line of sight and false if the view is blocked.
| pointOne | The start point. | |
| pointTwo | The end point. |
| void dtTerrain::Terrain::SetLineOfSightSpacing | ( | float | spacing | ) | [inline] |
| float dtTerrain::Terrain::GetLineOfSightSpacing | ( | ) | const [inline] |
| void dtTerrain::Terrain::LoadTerrainTile | ( | PagedTerrainTile & | newTile | ) | [virtual] |
| void dtTerrain::Terrain::UnloadTerrainTile | ( | PagedTerrainTile & | toRemove | ) | [virtual] |
| void dtTerrain::Terrain::UnloadAllTerrainTiles | ( | ) | [virtual] |
| PagedTerrainTile * dtTerrain::Terrain::CreateTerrainTile | ( | const GeoCoordinates & | coords | ) | [virtual] |
| bool dtTerrain::Terrain::IsTerrainTileResident | ( | const GeoCoordinates & | coords | ) | [virtual] |
| void dtTerrain::Terrain::EnsureTileVisibility | ( | const std::set< GeoCoordinates > & | coordList | ) | [virtual] |
| bool dtTerrain::Terrain::SetCachePath | ( | const std::string & | path | ) |
Sets the path of the terrain cache.
The terrain cache is a directory somewhere on the hard drive which is used to store on the fly data calculations which can then be reused on successive runs. If this path is not set, no data caching will occur.
This path will be the root cache path for any terrain tiles that need to have their data cached. Each tile's cache path is a subdirectory of this one.
This path should only be used directly when data needs to be cached that is independant of a particular terrain tile. Tile specific data should be cached in the tile's cache directory.
| path | The path to use for the terrain cache. |
| Exception | if the path does not exist and cannot be created. |
| const std::string& dtTerrain::Terrain::GetCachePath | ( | ) | const [inline] |
Gets the current terrain cache.
| void dtTerrain::Terrain::SetLoadDistance | ( | float | value | ) | [inline] |
| float dtTerrain::Terrain::GetLoadDistance | ( | ) | const [inline] |
| void dtTerrain::Terrain::SetDataReader | ( | TerrainDataReader * | reader | ) |
Sets the terrain data reader.
This must be set before any terrain can be loaded.
| TerrainDataReader* dtTerrain::Terrain::GetDataReader | ( | ) | [inline] |
Gets the current terrain data reader.
| const TerrainDataReader* dtTerrain::Terrain::GetDataReader | ( | ) | const [inline] |
Gets the current terrain data reader.
| void dtTerrain::Terrain::SetDataRenderer | ( | TerrainDataRenderer * | renderer | ) |
Sets the terrain data renderer.
This must be set before any terrain can be loaded and rendered.
| TerrainDataRenderer* dtTerrain::Terrain::GetDataRenderer | ( | ) | [inline] |
Gets the current terrain data renderer.
| const TerrainDataRenderer* dtTerrain::Terrain::GetDataRenderer | ( | ) | const [inline] |
Gets the current terrain data renderer.
| void dtTerrain::Terrain::AddDecorationLayer | ( | TerrainDecorationLayer * | newLayer | ) |
Adds a new decoration layer to this terrain.
| newLayer | The new layer to add. |
If the new layer's name is not unique, the name is appended with a unique identifier and a warning is logged.
| void dtTerrain::Terrain::RemoveDecorationLayer | ( | TerrainDecorationLayer * | toRemove | ) |
Removes the specified decoration layer from this terrain.
| toRemove | The layer to remove. |
| void dtTerrain::Terrain::RemoveDecorationLayer | ( | const std::string & | name | ) |
Removes a decoration layer matching the specified name.
| name | The name of the terrain layer to remove. |
| TerrainDecorationLayer * dtTerrain::Terrain::GetDecorationLayer | ( | const std::string & | name | ) |
Gets the decoration layer whos name matches the specified parameter.
| name | The name of the layer to retrieve. |
| const TerrainDecorationLayer * dtTerrain::Terrain::GetDecorationLayer | ( | const std::string & | name | ) | const |
Gets the decoration layer who's name matches the specified parameter.
| name | The name of the layer to retrieve. |
| unsigned int dtTerrain::Terrain::GetNumDecorationLayers | ( | ) | const [inline] |
Gets the number of decorator layers currently overlaid on this terrain.
| void dtTerrain::Terrain::ClearDecorationLayers | ( | ) |
Removes all the decorator layers from this terrain.
| void dtTerrain::Terrain::HideDecorationLayer | ( | const std::string & | name | ) |
Hides the decoration layer that matches the specified name.
| name | The name of the layer to hide. |
| void dtTerrain::Terrain::HideDecorationLayer | ( | TerrainDecorationLayer * | toHide | ) |
Hides the specified decoration layer.
| toHide | The layer to hide. |
| void dtTerrain::Terrain::ShowDecorationLayer | ( | const std::string & | name | ) |
Makes the decoration layer matching the specified name visible.
| name | The name of the layer to show. |
| void dtTerrain::Terrain::ShowDecorationLayer | ( | TerrainDecorationLayer * | toShow | ) |
Makes the specified decoration layer visible in the scene.
| The | layer to make visible. |
| void dtTerrain::Terrain::GetDecorationLayers | ( | std::vector< dtCore::RefPtr< TerrainDecorationLayer > > & | layers | ) |
Fills a vector with the decoration layers currently attached to this terrain.
| layers | The vector to be filled. |
| void dtTerrain::Terrain::SetTerrainTileFactory | ( | PagedTerrainTileFactory & | factory | ) | [inline] |
| PagedTerrainTileFactory* dtTerrain::Terrain::GetTerrainTileFactory | ( | ) | [inline] |
| void dtTerrain::Terrain::OnMessage | ( | dtCore::Base::MessageData * | data | ) | [virtual] |
| void dtTerrain::Terrain::PreFrame | ( | double | frameTime | ) | [protected, virtual] |
| void dtTerrain::Terrain::PostFrame | ( | double | frameTime | ) | [protected, virtual] |
std::queue<dtCore::RefPtr<PagedTerrainTile> > dtTerrain::Terrain::mTilesToLoadQ [protected] |
List of terrain tiles currently queued up for loading.
TerrainTileMap dtTerrain::Terrain::mResidentTiles [protected] |
List of terrain tiles which are currently loaded into memory.
std::queue<dtCore::RefPtr<PagedTerrainTile> > dtTerrain::Terrain::mTilesToUnloadQ [protected] |
Queue of terrain tiles that need to be cached or destroyed.