dtTerrain::TerrainDataRenderer Class Reference

This class is the interface for a terrain renderer. More...

#include <terraindatarenderer.h>

Inheritance diagram for dtTerrain::TerrainDataRenderer:

dtCore::Base dtTerrain::SoarXTerrainRenderer

List of all members.

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.
TerrainGetParentTerrain ()
 Gets the terrain object that currently owns this reader.
const TerrainGetParentTerrain () 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.


Detailed Description

This class is the interface for a terrain renderer.

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.


Constructor & Destructor Documentation

dtTerrain::TerrainDataRenderer::TerrainDataRenderer ( const std::string &  name = "TerrainRenderer"  ) 

Constructs the terrain renderer.

dtTerrain::TerrainDataRenderer::~TerrainDataRenderer (  )  [protected, virtual]

Empty destructor...


Member Function Documentation

virtual void dtTerrain::TerrainDataRenderer::OnLoadTerrainTile ( PagedTerrainTile tile  )  [pure virtual]

This method is called when the parent terrain needs to load a tile.

Parameters:
tile The new tile. The loader should populate the fields of the tile as appropriate.
Note:
Should throw an exception if any errors occur.

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.

See also:
Terrain

PagedTerrainTile

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.

Parameters:
tile The tile being unloaded.
Note:
Should throw an exception if any errors occur.

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.

See also:
Terrain

PagedTerrainTile

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.

Returns:
The height of the terrain at the specified point.

Implemented in dtTerrain::SoarXTerrainRenderer.

virtual osg::Vec3 dtTerrain::TerrainDataRenderer::GetNormal ( float  x,
float  y 
) [pure virtual]

Gets the normal vector at the specified point.

Returns:
A vector perpendicular to terrain at the given 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.

Returns:
An OpenSceneGraph group node containing the renderer's scene graph.
Note:
It is OK to return a group node with no children. This is most likely the case since this method is called before any tiles are inserted in the terrain's load queue.

Implemented in dtTerrain::SoarXTerrainRenderer.

Terrain* dtTerrain::TerrainDataRenderer::GetParentTerrain (  )  [inline]

Gets the terrain object that currently owns this reader.

Returns:
A pointer to the parent terrain.

const Terrain* dtTerrain::TerrainDataRenderer::GetParentTerrain (  )  const [inline]

Gets a read-only terrain object that currently owns this reader.

Returns:
A const pointer to the parent terrain.


Friends And Related Function Documentation

friend class Terrain [friend]

Allow the terrain to have access to this class.


http://www.delta3d.org
2.0.0 generated 14 Feb 2008