My Project
Public Member Functions | List of all members
ParaTerrain::TextureSet Class Reference

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...
 
TextureGetTexture (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...
 

Detailed Description

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.

Constructor & Destructor Documentation

§ TextureSet()

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.

Member Function Documentation

§ AddTexture()

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.

§ GetTexture()

Texture * TextureSet::GetTexture ( int  index)

Gets a Texture by its shared index.

Parameters
indexThe index of the Texture to fetch from the pool. This is the value returned by Texture::GetSharedIndex().

§ RemoveTexture()

void ParaTerrain::TextureSet::RemoveTexture ( int  nIndex,
Terrain pTerrain,
bool  bNormalizeOthers = true 
)

remove the given texture

Parameters
bNormalizeOthersif true(default), all other texture layers of pTerrain will be normalized to one.

§ ReplaceTexture()

bool TextureSet::ReplaceTexture ( int  nIndex,
ParaEngine::TextureEntity TextureAsset 
)

replace the texture at the given index.

Parameters
nIndexif there is no texture at the given index, the new texture will be appended.
TextureAssetthe texture the replace with

§ UnbindAllTextures()

int TextureSet::UnbindAllTextures ( )

unbind and delete all device texture objects.


The documentation for this class was generated from the following files: