#include <terraindatarenderer.h>

Public Member Functions | |
| TerrainDataRenderer (const std::string &name="TerrainRenderer") | |
| Constructs the terrain renderer. | |
| virtual void | OnLoadTerrainTile (PagedTerrainTile &tile)=0 |
| This method is called when the parent terrain needs to load a tile. | |
| virtual void | OnUnloadTerrainTile (PagedTerrainTile &tile) |
| This method is called when the parent terrain wishes to unload a terrain tile from its list of resident tiles. | |
| virtual float | GetHeight (float x, float y)=0 |
| Gets the height of the terrain at the specified (x,y) coordinates. | |
| virtual osg::Vec3 | GetNormal (float x, float y)=0 |
| Gets the normal vector at the specified point. | |
| virtual osg::Group * | GetRootDrawable ()=0 |
| Returns a scene node that encapsulates the renderable terrain. | |
| Terrain * | GetParentTerrain () |
| Gets the terrain object that currently owns this reader. | |
| const Terrain * | GetParentTerrain () const |
| Gets a read-only terrain object that currently owns this reader. | |
Protected Member Functions | |
| virtual | ~TerrainDataRenderer () |
| Empty destructor... | |
Friends | |
| class | Terrain |
| Allow the terrain to have access to this class. | |
A terrain renderer handles rendering of the terrain. It can access the terrain reader through its parent terrain handle if data paging and such is required. This class enables different terrain rendering algorithms to operate transparently and independent of the underlying terrain data so they can be interchanged when needed.
| dtTerrain::TerrainDataRenderer::TerrainDataRenderer | ( | const std::string & | name = "TerrainRenderer" |
) |
Constructs the terrain renderer.
| dtTerrain::TerrainDataRenderer::~TerrainDataRenderer | ( | ) | [protected, virtual] |
Empty destructor...
| virtual void dtTerrain::TerrainDataRenderer::OnLoadTerrainTile | ( | PagedTerrainTile & | tile | ) | [pure virtual] |
This method is called when the parent terrain needs to load a tile.
| tile | The new tile. The loader should populate the fields of the tile as appropriate. |
At this point, the terrain tiles have had a chance to load data from their cache. Therefore, readers implementing this method may want to check the status of a tile's data before loading since it may have been retrieved from the cache.
Resources may be looked up using the parent terrain's resource path list. In most cases, the terrain will be made aware of any resource locations its readers may need.
Implemented in dtTerrain::SoarXTerrainRenderer.
| virtual void dtTerrain::TerrainDataRenderer::OnUnloadTerrainTile | ( | PagedTerrainTile & | tile | ) | [inline, virtual] |
This method is called when the parent terrain wishes to unload a terrain tile from its list of resident tiles.
| tile | The tile being unloaded. |
The default implementation does nothing as most renderers will probably only process data and have no need to respond to this method, however, it is available if needed. Also note, that the tile itself is responsible for caching its data, however, any data a renderer wishes to control may be cached in this method.
Reimplemented in dtTerrain::SoarXTerrainRenderer.
| virtual float dtTerrain::TerrainDataRenderer::GetHeight | ( | float | x, | |
| float | y | |||
| ) | [pure virtual] |
Gets the height of the terrain at the specified (x,y) coordinates.
Implemented in dtTerrain::SoarXTerrainRenderer.
| virtual osg::Vec3 dtTerrain::TerrainDataRenderer::GetNormal | ( | float | x, | |
| float | y | |||
| ) | [pure virtual] |
Gets the normal vector at the specified point.
Implemented in dtTerrain::SoarXTerrainRenderer.
| virtual osg::Group* dtTerrain::TerrainDataRenderer::GetRootDrawable | ( | ) | [pure virtual] |
Returns a scene node that encapsulates the renderable terrain.
This is the entry point by which the terrain is added to the scene.
Implemented in dtTerrain::SoarXTerrainRenderer.
| Terrain* dtTerrain::TerrainDataRenderer::GetParentTerrain | ( | ) | [inline] |
Gets the terrain object that currently owns this reader.
| const Terrain* dtTerrain::TerrainDataRenderer::GetParentTerrain | ( | ) | const [inline] |
Gets a read-only terrain object that currently owns this reader.
friend class Terrain [friend] |
Allow the terrain to have access to this class.