proland::ElevationProducer Class Reference
[dem]

A TileProducer to create elevation tiles on GPU from CPU residual tiles. More...

#include <ElevationProducer.h>

List of all members.

Public Member Functions

 ElevationProducer (ptr< TileCache > cache, ptr< TileProducer > residualTiles, ptr< Texture2D > demTexture, ptr< Texture2D > layerTexture, ptr< Texture2D > residualTexture, ptr< Program > upsample, ptr< Program > blend, int gridMeshSize, vector< float > &noiseAmp, bool flipDiagonals=false)
 Creates a new ElevationProducer.
virtual ~ElevationProducer ()
 Deletes this ElevationProducer.

Protected Member Functions

 ElevationProducer ()
 Creates an uninitialized ElevationProducer.
void init (ptr< TileCache > cache, ptr< TileProducer > residualTiles, ptr< Texture2D > demTexture, ptr< Texture2D > layerTexture, ptr< Texture2D > residualTexture, ptr< Program > upsample, ptr< Program > blend, int gridMeshSize, vector< float > &noiseAmp, bool flipDiagonals=false)
 Initializes this ElevationProducer.
void init (ptr< ResourceManager > manager, Resource *r, const string &name, ptr< ResourceDescriptor > desc, const TiXmlElement *e=NULL)
 Initializes this ElevationProducer from a Resource.

Protected Attributes

ptr< Program > upsample
 The Program to perform the upsampling and add procedure on GPU.
ptr< Program > blend
 The Program to blend the layers of this producer with the raw terrain elevations.
ptr< TileProducer > residualTiles
 The producer producing the residual tiles.
ptr< Texture2D > demTexture
 A texture used to produce the tiles.
ptr< Texture2D > residualTexture
 A texture used to produce the tiles.
ptr< Texture2D > layerTexture
 A texture used to combine the layers of this producer with the raw terrain (maybe NULL if there are no layers; otherwise its size must be equal to the elevation tile size, including borders.
int face
 Cube face ID for producers targeting spherical terrains.

Private Attributes

vector< float > noiseAmp
 The amplitude of the noise to be added for each level (one amplitude per level).
float * residualTile
 A buffer to convert a residual tile produced by residualTiles to the appropriate size.
int gridMeshSize
 The size of the grid that will be used to render each tile.
bool flipDiagonals
 true if the grid used to render each tile will use diagonal flipping to reduce geometric aliasing.

Detailed Description

A TileProducer to create elevation tiles on GPU from CPU residual tiles.

This producer is intended to be used with a ResidualProducer, but any other producer creating floating point CPU tiles can be used instead. This producer can create additional details with noise whose amplitude and frequency and be specified for each level (and the upsampling shader can further modify this noise to make it vary with the slope, curvature, altitude, etc). In fact the residual producer is optional. When no residuals are specified, a fully random fractal terrain is created from noise amplitudes. See Elevation producer.

Authors:
Eric Bruneton, Antoine Begault

Constructor & Destructor Documentation

proland::ElevationProducer::ElevationProducer ( ptr< TileCache >  cache,
ptr< TileProducer >  residualTiles,
ptr< Texture2D >  demTexture,
ptr< Texture2D >  layerTexture,
ptr< Texture2D >  residualTexture,
ptr< Program >  upsample,
ptr< Program >  blend,
int  gridMeshSize,
vector< float > &  noiseAmp,
bool  flipDiagonals = false 
)

Creates a new ElevationProducer.

Parameters:
cache the cache to store the produced tiles. The underlying storage must be a GPUTileStorage with floating point textures of at least two components per pixel.
residualTiles the producer producing the residual tiles. This producer should produce its tiles in a CPUTileStorage of float type. Maybe NULL to create a fully random fractal terrain. The size of the residual tiles (without borders) must be a multiple of the size of the elevation tiles (without borders).
demTexture a texture used to produce the tiles. Its size must be equal to the elevation tile size (including borders). Its format must be RGBA32F.
layerTexture a texture used to combine the layers of this producer with the raw terrain (maybe NULL if there are no layers; otherwise its size must be equal to the elevation tile size, including borders. Its format must be RGBA32F).
residualTexture a texture used to produce the tiles. Its size must be equal to the elevation tile size (including borders). Its format must be I32F.
upsample the Program to perform the upsampling and add procedure on GPU. See Elevation producer.
blend the Program to blend the layers of this producer with the raw terrain elevations.
gridMeshSize the size of the grid that will be used to render each tile. Must be the tile size (without borders) divided by a power of two.
noiseAmp the amplitude of the noise to be added for each level (one amplitude per level).
flipDiagonals true if the grid used to render each tile will use diagonal flipping to reduce geometric aliasing.
virtual proland::ElevationProducer::~ElevationProducer (  )  [virtual]

Deletes this ElevationProducer.

proland::ElevationProducer::ElevationProducer (  )  [protected]

Creates an uninitialized ElevationProducer.


Member Function Documentation

void proland::ElevationProducer::init ( ptr< ResourceManager >  manager,
Resource *  r,
const string &  name,
ptr< ResourceDescriptor >  desc,
const TiXmlElement *  e = NULL 
) [protected]

Initializes this ElevationProducer from a Resource.

Parameters:
manager the manager that will manage the created resource.
r the resource.
name the resource name.
desc the resource descriptor.
e an optional XML element providing contextual information (such as the XML element in which the resource descriptor was found).
void proland::ElevationProducer::init ( ptr< TileCache >  cache,
ptr< TileProducer >  residualTiles,
ptr< Texture2D >  demTexture,
ptr< Texture2D >  layerTexture,
ptr< Texture2D >  residualTexture,
ptr< Program >  upsample,
ptr< Program >  blend,
int  gridMeshSize,
vector< float > &  noiseAmp,
bool  flipDiagonals = false 
) [protected]

Initializes this ElevationProducer.

See ElevationProducer.


Member Data Documentation

ptr<Program> proland::ElevationProducer::blend [protected]

The Program to blend the layers of this producer with the raw terrain elevations.

ptr<Texture2D> proland::ElevationProducer::demTexture [protected]

A texture used to produce the tiles.

Its size must be equal to the elevation tile size (including borders). Its format must be RGBA32F.

Cube face ID for producers targeting spherical terrains.

true if the grid used to render each tile will use diagonal flipping to reduce geometric aliasing.

The size of the grid that will be used to render each tile.

Must be the tile size (without borders) divided by a power of two.

ptr<Texture2D> proland::ElevationProducer::layerTexture [protected]

A texture used to combine the layers of this producer with the raw terrain (maybe NULL if there are no layers; otherwise its size must be equal to the elevation tile size, including borders.

Its format must be RGBA32F).

vector<float> proland::ElevationProducer::noiseAmp [private]

The amplitude of the noise to be added for each level (one amplitude per level).

ptr<Texture2D> proland::ElevationProducer::residualTexture [protected]

A texture used to produce the tiles.

Its size must be equal to the elevation tile size (including borders). Its format must be I32F.

A buffer to convert a residual tile produced by residualTiles to the appropriate size.

ptr<TileProducer> proland::ElevationProducer::residualTiles [protected]

The producer producing the residual tiles.

This producer should produce its tiles in a CPUTileStorage of float type. Maybe NULL to create a fully random fractal terrain. The size of the residual tiles (without borders) must be a multiple of the size of the elevation tiles (without borders).

ptr<Program> proland::ElevationProducer::upsample [protected]

The Program to perform the upsampling and add procedure on GPU.

See Elevation producer.


Generated on Sat May 12 09:42:13 2012 for proland by  doxygen 1.6.1