proland::GPUTileStorage Class Reference
[producer]

A TileStorage that stores tiles in 2D array textures. More...

#include <GPUTileStorage.h>

Inheritance diagram for proland::GPUTileStorage:
proland::TileStorage

List of all members.

Classes

class  GPUSlot
 A slot managed by a GPUTileStorage. More...

Public Member Functions

 GPUTileStorage (int tileSize, int nTiles, TextureInternalFormat internalf, TextureFormat f, PixelType t, const Texture::Parameters &params, bool useTileMap=false)
 Creates a new GPUTileStorage.
virtual ~GPUTileStorage ()
 Deletes this GPUTileStorage.
int getTextureCount ()
 Returns the number of textures used to store the tiles.
ptr< Texture2DArray > getTexture (int index)
 Returns the texture storage whose index is given.
ptr< Texture2D > getTileMap ()
 Returns the tile map that stores the mapping between logical tile coordinates (level,tx,ty) and storage tile coordinates in this storage.
void notifyChange (GPUSlot *s)
 Notifies this manager that the content of the given slot has changed.
void generateMipMap ()
 Generates the mipmap levels of the storage textures.

Protected Member Functions

 GPUTileStorage ()
 Creates an uninitialized GPUTileStorage.
void init (int tileSize, int nTiles, TextureInternalFormat internalf, TextureFormat f, PixelType t, const Texture::Parameters &params, bool useTileMap=false)
 Initializes this GPUTileStorage.

Private Attributes

vector< ptr< Texture2DArray > > textures
 The storage textures used to store the tiles.
bool needMipmaps
 True if the storage texture format needs mipmaping.
bool changes
 True if a least one storage texture has changed since the last call to generateMipMap.
set< GPUSlot * > * dirtySlots
 The slots whose mipmap levels are not up to date (one set per texture).
ptr< FrameBuffer > fbo
 Framebuffer used to generate mipmaps.
ptr< Program > mipmapProg
 Program used to generate mipmaps.
ptr< Uniform4i > mipmapParams
 Parameters used to generate a mipmap level.
ptr< Texture2D > tileMap
 The tile map that stores the mapping between logical tile coordinates (level,tx,ty) and storage tile coordinates (u,v) in this storage.

Detailed Description

A TileStorage that stores tiles in 2D array textures.

Each tile is stored in its own layer of the array.

Authors:
Eric Bruneton, Antoine Begault, Guillaume Piolat

Constructor & Destructor Documentation

proland::GPUTileStorage::GPUTileStorage ( int  tileSize,
int  nTiles,
TextureInternalFormat  internalf,
TextureFormat  f,
PixelType  t,
const Texture::Parameters &  params,
bool  useTileMap = false 
)

Creates a new GPUTileStorage.

See init.

virtual proland::GPUTileStorage::~GPUTileStorage (  )  [virtual]

Deletes this GPUTileStorage.

proland::GPUTileStorage::GPUTileStorage (  )  [protected]

Creates an uninitialized GPUTileStorage.


Member Function Documentation

void proland::GPUTileStorage::generateMipMap (  ) 

Generates the mipmap levels of the storage textures.

This method only updates the textures whose content has changed since the last call to this method. Changes must be notified with notifyChange.

ptr<Texture2DArray> proland::GPUTileStorage::getTexture ( int  index  ) 

Returns the texture storage whose index is given.

Parameters:
index an index between 0 and getTextureCount (excluded).
int proland::GPUTileStorage::getTextureCount (  ) 

Returns the number of textures used to store the tiles.

ptr<Texture2D> proland::GPUTileStorage::getTileMap (  ) 

Returns the tile map that stores the mapping between logical tile coordinates (level,tx,ty) and storage tile coordinates in this storage.

This mapping texture can be used as an indirection texture on GPU to find the content of a tile from its logical coordinates. May be NULL.

void proland::GPUTileStorage::init ( int  tileSize,
int  nTiles,
TextureInternalFormat  internalf,
TextureFormat  f,
PixelType  t,
const Texture::Parameters &  params,
bool  useTileMap = false 
) [protected]

Initializes this GPUTileStorage.

Parameters:
tileSize the size in pixel of each (square) tile.
nTiles the number of slots in this storage.
tf the texture storage data format on GPU.
f the texture components in the storage textures.
t the type of each component in the storage textures.
params the texture parameters.
useTileMap the to associate with this tile storage a texture representing the mapping between logical tile coordinates (level,tx,ty) and storage tile coordinates (u,v) in this storage. This mapping texture can be used as an indirection texture on GPU to find the content of a tile from its logical coordinates. This option can only be used if nTextures is equal to one.
void proland::GPUTileStorage::notifyChange ( GPUSlot s  ) 

Notifies this manager that the content of the given slot has changed.

Parameters:
s a slot whose content has changed.

Member Data Documentation

True if a least one storage texture has changed since the last call to generateMipMap.

The slots whose mipmap levels are not up to date (one set per texture).

ptr<FrameBuffer> proland::GPUTileStorage::fbo [private]

Framebuffer used to generate mipmaps.

ptr<Uniform4i> proland::GPUTileStorage::mipmapParams [private]

Parameters used to generate a mipmap level.

ptr<Program> proland::GPUTileStorage::mipmapProg [private]

Program used to generate mipmaps.

True if the storage texture format needs mipmaping.

vector< ptr<Texture2DArray> > proland::GPUTileStorage::textures [private]

The storage textures used to store the tiles.

ptr<Texture2D> proland::GPUTileStorage::tileMap [private]

The tile map that stores the mapping between logical tile coordinates (level,tx,ty) and storage tile coordinates (u,v) in this storage.

May be NULL.


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