My Project
|
A TextureSet is a pool of Texture objects that are used by a Terrain to do detail texture rendering. More...
#include <TextureSet.h>
Public Member Functions | |
TextureSet () | |
Constructs a new TextureSet. More... | |
int | AddTexture (Texture *pTexture) |
Adds a Texture to the TextureSet. More... | |
Texture * | GetTexture (int index) |
Gets a Texture by its shared index. More... | |
bool | ReplaceTexture (int nIndex, ParaEngine::TextureEntity *TextureAsset) |
replace the texture at the given index. More... | |
int | FindTexture (ParaEngine::TextureEntity *pTexture) |
find the index of the given texture entity in the set, if not found returned -1 | |
int | UnbindAllTextures () |
unbind and delete all device texture objects. More... | |
int | GetNumTextures () |
Indicates how many Texture objects are in the TextureSet. | |
void | WriteMask (CParaFile &file, Terrain *pTerrain) |
void | ReadMask (CParaFile &file, Terrain *pTerrain) |
void | GarbageCollect (Terrain *pTerrain) |
remove unused textures | |
void | RemoveTexture (int nIndex, Terrain *pTerrain, bool bNormalizeOthers=true) |
remove the given texture More... | |
A TextureSet is a pool of Texture objects that are used by a Terrain to do detail texture rendering.
You use TextureSet when your application needs to do detail painting (or "splats.") You can get a Terrain's TextureSet by calling Terrain::GetTextureSet(). Then you may add Texture objects to it by calling TextureSet::AddTexture() as many times as needed to fill it with all of the Texture objects you want to do detail painting with. Each of these Texture objects now has a unique index that you can get by calling Texture::GetSharedIndex(). Use this index to call the Terrain::Paint() method or any method that requires a shared index of a Texture.
TextureSet::TextureSet | ( | ) |
Constructs a new TextureSet.
Since Terrain automatically creates one of these for you, you should rarely need to create new instances of this class manually. You might do so if you are making several instances of Terrain share a single TextureSet.
int TextureSet::AddTexture | ( | Texture * | pTexture | ) |
Adds a Texture to the TextureSet.
This gives the Texture a shared index which can be used to identify the Texture as a part of the Terrain's pool of shared Textures.
Texture * TextureSet::GetTexture | ( | int | index | ) |
void ParaTerrain::TextureSet::RemoveTexture | ( | int | nIndex, |
Terrain * | pTerrain, | ||
bool | bNormalizeOthers = true |
||
) |
remove the given texture
bNormalizeOthers | if true(default), all other texture layers of pTerrain will be normalized to one. |
bool TextureSet::ReplaceTexture | ( | int | nIndex, |
ParaEngine::TextureEntity * | TextureAsset | ||
) |
replace the texture at the given index.
nIndex | if there is no texture at the given index, the new texture will be appended. |
TextureAsset | the texture the replace with |
int TextureSet::UnbindAllTextures | ( | ) |
unbind and delete all device texture objects.