proland::TileSamplerZ Class Reference
[terrain]

A TileSampler to be used with a proland::ElevationProducer. More...

#include <TileSamplerZ.h>

Inheritance diagram for proland::TileSamplerZ:
proland::TileSampler

List of all members.

Classes

class  State
 A state object to share the readback managers between all TileSamplerZ instances with the same tile storage. More...
class  TileCallback
 A ork::ReadbackManager::Callback to readback an elevation tile and to update the zmin and zmax fields of a TerrainQuad. More...
class  TreeZ
 An internal quadtree to store the texture tile associated with each terrain quad, and to keep track of tiles that need to be read back. More...
struct  TreeZSort
 A sort operator to sort TreeZ elements. More...

Public Member Functions

 TileSamplerZ (const string &name, ptr< TileProducer > producer=NULL)
 Creates a new TileSamplerZ.
virtual ~TileSamplerZ ()
 Deletes this TileSamplerZ.
virtual ptr< Task > update (ptr< SceneManager > scene, ptr< TerrainQuad > root)
 Returns the task graph necessary to create new texture tiles for newly created quads in the given terrain quadtree (and to release tiles for destroyed quads).

Protected Member Functions

 TileSamplerZ ()
 Creates an uninitialized TileSamplerZ.
virtual void init (const string &name, ptr< TileProducer > producer=NULL)
 Initializes this TileSamplerZ.
virtual bool needTile (ptr< TerrainQuad > q)
 Returns true if a tile is needed for the given terrain quad.
virtual void getTiles (Tree *parent, Tree **t, ptr< TerrainQuad > q, ptr< TaskGraph > result)
 Updates the internal quadtree to make it identical to the given terrain quadtree.

Static Private Member Functions

static ptr< StatenewState (ptr< GPUTileStorage > storage)
 Creates a new State for elevation tiles of the given size.

Private Attributes

ptr< Factory< ptr
< GPUTileStorage >, ptr< State > > > 
factory
 The ork::Factory to create shared State objects for a given tile storage.
ptr< Statestate
 The State object for this TileSamplerZ (may be shared with other TileSamplerZ with the same tile storage).
TreeZcameraQuad
 The terrain quad directly below the current viewer position.
vec2f cameraQuadCoords
 The relative viewer position in the cameraQuad quad.
vec3d oldLocalCamera
 Last camera position used to perform a readback of the camera elevation above the ground.

Static Private Attributes

static static_ptr< Factory
< ptr< GPUTileStorage >, ptr
< State > > > 
stateFactory
 The ork::Factory to create shared State objects for a given elevation tile size.

Detailed Description

A TileSampler to be used with a proland::ElevationProducer.

This class reads back the elevation data of newly created elevation tiles in order to update the TerrainQuad::zmin and TerrainQuad::zmax fields. It also reads back the elevation value below the current viewer position to update the TerrainNode::groundHeightAtCamera static field.

Authors:
Eric Bruneton, Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::TileSamplerZ::TileSamplerZ ( const string &  name,
ptr< TileProducer producer = NULL 
)

Creates a new TileSamplerZ.

Parameters:
name the GLSL name of this uniform.
producer the producer to be used to create new tiles in update. Maybe NULL if this producer is used to update a tileMap (see setTileMap). If not NULL, must have a proland::GPUTileStorage.
virtual proland::TileSamplerZ::~TileSamplerZ (  )  [virtual]

Deletes this TileSamplerZ.

proland::TileSamplerZ::TileSamplerZ (  )  [protected]

Creates an uninitialized TileSamplerZ.


Member Function Documentation

virtual void proland::TileSamplerZ::getTiles ( Tree parent,
Tree **  t,
ptr< TerrainQuad q,
ptr< TaskGraph >  result 
) [protected, virtual]

Updates the internal quadtree to make it identical to the given terrain quadtree.

Collects the tasks necessary to create the missing texture tiles, corresponding to newly created quads, in the given task graph.

Parameters:
t the internal quadtree node corresponding to q.
q a quadtree node.
result the task graph to collect the tile producer tasks.

Reimplemented from proland::TileSampler.

virtual void proland::TileSamplerZ::init ( const string &  name,
ptr< TileProducer producer = NULL 
) [protected, virtual]

Initializes this TileSamplerZ.

Parameters:
name the GLSL name of this uniform.
producer the producer to be used to create new tiles in update. Maybe NULL if this producer is used to update a tileMap (see setTileMap). If not NULL, must have a proland::GPUTileStorage.

Reimplemented from proland::TileSampler.

virtual bool proland::TileSamplerZ::needTile ( ptr< TerrainQuad q  )  [protected, virtual]

Returns true if a tile is needed for the given terrain quad.

Parameters:
q a quadtree node.

Reimplemented from proland::TileSampler.

static ptr<State> proland::TileSamplerZ::newState ( ptr< GPUTileStorage storage  )  [static, private]

Creates a new State for elevation tiles of the given size.

Parameters:
tileSize an elevation tile size.
virtual ptr<Task> proland::TileSamplerZ::update ( ptr< SceneManager >  scene,
ptr< TerrainQuad root 
) [virtual]

Returns the task graph necessary to create new texture tiles for newly created quads in the given terrain quadtree (and to release tiles for destroyed quads).

This method returns an empty task graph if terrains have been associated with this uniform (uniform intended to be used with setTileMap).

Parameters:
scene the scene manager.
root the root of a terrain quadtree.

Reimplemented from proland::TileSampler.


Member Data Documentation

The terrain quad directly below the current viewer position.

The relative viewer position in the cameraQuad quad.

ptr< Factory< ptr<GPUTileStorage>, ptr<State> > > proland::TileSamplerZ::factory [private]

The ork::Factory to create shared State objects for a given tile storage.

Last camera position used to perform a readback of the camera elevation above the ground.

This is used to avoid reading back this value at each frame when the camera does not move.

The State object for this TileSamplerZ (may be shared with other TileSamplerZ with the same tile storage).

static_ptr< Factory< ptr<GPUTileStorage>, ptr<State> > > proland::TileSamplerZ::stateFactory [static, private]

The ork::Factory to create shared State objects for a given elevation tile size.


Generated on Sat May 12 09:41:39 2012 for proland by  doxygen 1.6.1