A ResidualProducer whose tiles can be edited at runtime. More...
#include <EditResidualProducer.h>
Public Member Functions | |
EditResidualProducer (ptr< TileCache > cache, const char *name, int deltaLevel=0, float zscale=1.0) | |
Creates a new EditResidualProducer. | |
virtual | ~EditResidualProducer () |
Deletes this EditResidualProducer. | |
void | editedTile (int level, int tx, int ty, float *deltaElevation) |
Notifies this producer that a tile has been edited. | |
void | updateResiduals () |
Updates the residual tiles produced by this producer to take into account all the edited tiles since the last call to this method. | |
void | reset () |
Cancels all editing operations performed on this producer. | |
Protected Member Functions | |
EditResidualProducer () | |
Creates an uninitialized EditResidualProducer. | |
void | init () |
Initializes this EditResidualProducer. | |
Private Member Functions | |
float | getDeltaElevation (int level, int w, int n, int tx, int ty, int x, int y) |
Returns the elevation delta at the given location. | |
Private Attributes | |
int | tWidth |
The size of the residual tiles, including borders. | |
int | tSize |
The size of the residual tiles, without borders. | |
TileCache::Tile::Id | curId |
The id of the last elevation delta tile that was used in getDeltaElevation. | |
float * | curDeltaElevation |
The last elevation delta tile that was used in getDeltaElevation. | |
map< TileCache::Tile::Id, float * > | modifiedTiles |
The residual tiles that have been modified. | |
map< TileCache::Tile::Id, float * > | deltaElevations |
The elevation deltas from which to recompute the residual tiles. |
A ResidualProducer whose tiles can be edited at runtime.
Intended to be used with an EditElevationProducer.
proland::EditResidualProducer::EditResidualProducer | ( | ptr< TileCache > | cache, | |
const char * | name, | |||
int | deltaLevel = 0 , |
|||
float | zscale = 1.0 | |||
) |
Creates a new EditResidualProducer.
See ResidualProducer.
virtual proland::EditResidualProducer::~EditResidualProducer | ( | ) | [virtual] |
Deletes this EditResidualProducer.
proland::EditResidualProducer::EditResidualProducer | ( | ) | [protected] |
Creates an uninitialized EditResidualProducer.
void proland::EditResidualProducer::editedTile | ( | int | level, | |
int | tx, | |||
int | ty, | |||
float * | deltaElevation | |||
) |
Notifies this producer that a tile has been edited.
level | the level of the edited tile. | |
tx | the logical x coordinate of the edited tile. | |
ty | the logical y coordinate of the edited tile. | |
deltaElevation | the difference between the new and the previous elevation values of the edited tile. Does not include borders |
float proland::EditResidualProducer::getDeltaElevation | ( | int | level, | |
int | w, | |||
int | n, | |||
int | tx, | |||
int | ty, | |||
int | x, | |||
int | y | |||
) | [private] |
Returns the elevation delta at the given location.
level | a quadtree level. | |
w | the actual tile size at this level (without borders; can be different than tSize for level less than minLevel). | |
n | the numbers of tiles per row or column in the quadtree at this level (not simply 1 << level if minLevel != 0). | |
tx | a logical tile x coordinate. | |
ty | a logical tile y coordinate. | |
x | a pixel coordinate relatively to the lower left corner of the (level,tx,ty) tile (without borders). Can be outside the tile itself (then the value will be looked up in an adjacent tile). | |
y | a pixel coordinate relatively to the lower left corner of the (level,tx,ty) tile (without borders). Can be outside the tile itself (then the value will be looked up in an adjacent tile). |
void proland::EditResidualProducer::init | ( | ) | [protected] |
Initializes this EditResidualProducer.
void proland::EditResidualProducer::reset | ( | ) |
Cancels all editing operations performed on this producer.
void proland::EditResidualProducer::updateResiduals | ( | ) |
Updates the residual tiles produced by this producer to take into account all the edited tiles since the last call to this method.
float* proland::EditResidualProducer::curDeltaElevation [private] |
The last elevation delta tile that was used in getDeltaElevation.
Optimization to avoid too many lookups in the deltaElevations map.
TileCache::Tile::Id proland::EditResidualProducer::curId [private] |
The id of the last elevation delta tile that was used in getDeltaElevation.
Optimization to avoid too many lookups in the deltaElevations map.
map<TileCache::Tile::Id, float*> proland::EditResidualProducer::deltaElevations [private] |
The elevation deltas from which to recompute the residual tiles.
map<TileCache::Tile::Id, float*> proland::EditResidualProducer::modifiedTiles [private] |
The residual tiles that have been modified.
int proland::EditResidualProducer::tSize [private] |
The size of the residual tiles, without borders.
int proland::EditResidualProducer::tWidth [private] |
The size of the residual tiles, including borders.