A TileProducer to generate terrain normals from terrain elevations on GPU. More...
#include <NormalProducer.h>
Public Member Functions | |
NormalProducer (ptr< TileCache > cache, ptr< TileProducer > elevationTiles, ptr< Texture2D > normalTexture, ptr< Program > normals, int gridMeshSize, bool deform=false) | |
Creates a new NormalProducer. | |
virtual | ~NormalProducer () |
Deletes this NormalProducer. | |
Protected Member Functions | |
NormalProducer () | |
Creates an uninitialized NormalProducer. | |
void | init (ptr< TileCache > cache, ptr< TileProducer > elevationTiles, ptr< Texture2D > normalTexture, ptr< Program > normals, int gridMeshSize, bool deform=false) |
Initializes this NormalProducer. | |
Protected Attributes | |
ptr< Program > | normals |
The Program to compute normals from elevations on GPU. | |
Private Attributes | |
ptr< TileProducer > | elevationTiles |
The producer producing the elevation tiles on GPU. | |
ptr< Texture2D > | normalTexture |
A texture used to produce the tiles. | |
bool | deform |
true if the produced elevations will be mapped on a spherical terrain. | |
int | gridMeshSize |
The size of the grid that will be used to render each tile. |
A TileProducer to generate terrain normals from terrain elevations on GPU.
proland::NormalProducer::NormalProducer | ( | ptr< TileCache > | cache, | |
ptr< TileProducer > | elevationTiles, | |||
ptr< Texture2D > | normalTexture, | |||
ptr< Program > | normals, | |||
int | gridMeshSize, | |||
bool | deform = false | |||
) |
Creates a new NormalProducer.
cache | the cache to store the produced tiles. The underlying storage must be a GPUTileStorage with textures of two or four components per pixel. If two components are used only one normal is stored per pixel (n.x and n.y are stored, n.z is implicit). If four components are used a coarse normal is also stored, to provide smooth interpolation of normals between quadtree levels. If floating point textures are used normals components vary between -1 and 1. If non floating point textures are used, this range is scaled to 0-1 to fit in the texture format. | |
elevationTiles | the producer producing the elevation tiles on GPU. The underlying storage must be a GPUTileStorage with floating point textures with at least 3 components per pixel (4 if 'deform' is true). The elevation tile size, without borders, must be equal to the normal tile size, minus 1. | |
normalTexture | a texture used to produce the tiles. Its size must be equal to the normal tile size. Its format must be the same as the format used for the tile storage of this producer. | |
normals | the Program to compute normals from elevations on GPU. | |
gridMeshSize | the size of the grid that will be used to render each tile. Must be the tile size (minus 1) divided by a power of two. | |
deform | true if the produced normals will be mapped on a spherical terrain. |
virtual proland::NormalProducer::~NormalProducer | ( | ) | [virtual] |
Deletes this NormalProducer.
proland::NormalProducer::NormalProducer | ( | ) | [protected] |
Creates an uninitialized NormalProducer.
void proland::NormalProducer::init | ( | ptr< TileCache > | cache, | |
ptr< TileProducer > | elevationTiles, | |||
ptr< Texture2D > | normalTexture, | |||
ptr< Program > | normals, | |||
int | gridMeshSize, | |||
bool | deform = false | |||
) | [protected] |
Initializes this NormalProducer.
See NormalProducer.
bool proland::NormalProducer::deform [private] |
true if the produced elevations will be mapped on a spherical terrain.
ptr<TileProducer> proland::NormalProducer::elevationTiles [private] |
The producer producing the elevation tiles on GPU.
The underlying storage must be a GPUTileStorage with floating point textures with at least 3 components per pixel (4 if 'deform' is true). The elevation tile size, without borders, must be equal to the normal tile size, minus 1.
int proland::NormalProducer::gridMeshSize [private] |
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<Program> proland::NormalProducer::normals [protected] |
The Program to compute normals from elevations on GPU.
ptr<Texture2D> proland::NormalProducer::normalTexture [private] |
A texture used to produce the tiles.
Its size must be equal to the normal tile size. Its format must be the same as the format used for the tile storage of this producer.