Handles the quadtree of textures. More...
#include <TerrainViz/SbTVizTextureList.h>
Public Member Functions | |
SbTVizTextureList () | |
SbTVizTextureList (const SbTVizTextureList &texList) | |
virtual | ~SbTVizTextureList () |
void | addTexture (SbTVizTexture *tex) |
void | addTexture (const char *fileName, int level, const SbVec2s &position, const SbVec2s &borders=SbVec2s(0, 0)) |
const SbTVizTexture * | removeTexture (const char *fileName) |
const SbTVizTexture * | removeTexture (int level, const SbVec2s &position) |
const SbTVizTexture * | getTexture (const char *fileName) const |
const SbTVizTexture * | getTexture (int level, const SbVec2s &position) const |
void | deleteAllTextures () |
The class handles a list of textures sorted to fit a quadtree. These textures are mapped on the mesh. The textures displayed are chosen according to the point of view. The textures are SbTVizTexture objects. The list of textures is to be used with an SoTVizRender node.
Textures are organized in a quadtree. The level of the texture is the depth level in the texture quadtree. Level n has 2^(2n) textures. By default the texture tree depth is null.
The position is specified as a pair of indices ( i , j ), where i is the row and and j is the column of the texture in a particular texture level. i and j range from 0 to 2^(n-1). See figure above.
It is not necessary to provide all textures. Some patches can be empty.
SbTVizData, SbTVizRegularGridData, SbTVizTexture, SoTViz, SoTVizRender
SbTVizTextureList::SbTVizTextureList | ( | ) |
Constructor.
SbTVizTextureList::SbTVizTextureList | ( | const SbTVizTextureList & | texList | ) |
Constructor by copy.
virtual SbTVizTextureList::~SbTVizTextureList | ( | ) | [virtual] |
Destructor.
Be aware that the destructor does not delete the SbTVizTexture objects referenced. See deleteAllTextures() to perform this operation
void SbTVizTextureList::addTexture | ( | const char * | fileName, | |
int | level, | |||
const SbVec2s & | position, | |||
const SbVec2s & | borders = SbVec2s(0, 0) | |||
) |
Adds a texture to the list.
Textures are organized in a quadtree. The level of the texture is the depth level in the texture quadtree. Level n has 2^(2n) textures. The position is specified as a pair of indices ( i , j ), where i is the row and and j is the column of the texture in a particular texture level. i and j range from 0 to 2^n-1. See figure above. Borders are the number of pixels used for texture continuity (overlapping) along X and Y.
void SbTVizTextureList::addTexture | ( | SbTVizTexture * | tex | ) |
Adds a texture to the list.
void SbTVizTextureList::deleteAllTextures | ( | ) |
Deletes all the SbTVizTexture objects referenced in the list.
Empties the list.
const SbTVizTexture* SbTVizTextureList::getTexture | ( | int | level, | |
const SbVec2s & | position | |||
) | const |
Returns the texture identified by level and position.
const SbTVizTexture* SbTVizTextureList::getTexture | ( | const char * | fileName | ) | const |
Returns the texture identified by filename.
const SbTVizTexture* SbTVizTextureList::removeTexture | ( | int | level, | |
const SbVec2s & | position | |||
) |
Removes a texture (identified by level and position) from the list.
Returns the SbTVizTexture instance, or NULL if not found. Does not delete the SbTVizTexture object.
const SbTVizTexture* SbTVizTextureList::removeTexture | ( | const char * | fileName | ) |
Removes a texture (identified by filename) from the list.
Returns the SbTVizTexture instance, or NULL if not found. Does not delete the SbTVizTexture object.