ClipMap Class Reference#include <clipMap.h>
List of all members.
Detailed Description
A clipmap texturing helper.
This class is responsible for allocating and updating all of the textures & state information for a clipmap.
A clipmap is a virtualized texture resource, which allows very large textures to be efficiently rendered using only a subset of the required texture memory.
- See also:
- http://www.cs.virginia.edu/~gfx/Courses/2002/BigData/papers/Texturing/Clipmap.pdf for the canonical SGI clipmap paper.
|
Public Member Functions |
BaseMatInstance * | getClipmapMat (const U32 id) |
void | clipAgainstGrid (const S32 gridSpacing, const RectI &rect, S32 *outCount, RectI *outBuffer) |
| Clip a rectangle of size <= gridSpacing against grid lines spaced every gridSpacing units, starting at the origin.
|
| ClipMap () |
| ~ClipMap () |
void | initClipStack () |
| Generate the clipstack and intermediate values, given valid mClipMapSize and mTextureSize.
|
void | fillWithTestPattern () |
| Fill all the texture levels with a brightly colored test pattern.
|
bool | fillWithTextureData () |
| Fill all the textures levels with data from the cache for the current center.
|
void | recenter (Point2F center) |
| Recenter all levels of the clipstack to point center, and do any reuploads required.
|
void | calculateModuloDeltaBounds (const RectI &oldData, const RectI &newData, RectI *outRects, S32 *outRectCount) |
| Calculate one or more rectangles that need to be updated based on the observed delta.
|
void | calculateClipMapLevels (const F32 near, const F32 far, const RectF &texBounds, S32 &outStartLevel, S32 &outEndLevel) |
| Given some information about a piece of geometry, return what clipmap levels are most appropriate to use on it.
|
void | setCache (IClipMapImageCache *cache) |
| Set the cache we're currently using to service image data requests.
|
BaseMatInstance * | getMaterialAndTextures (U32 layer1, U32 layer2, U32 layer3=-1, U32 layer4=-1, bool doTerrainRenderHack=true) |
| Get material and bind appropriate textures for the specified levels of the clipmap.
|
BaseMatInstance * | bindTexturesFF (U32 curLevel, Point4F &pt, bool firstLayer, bool doTerrainRenderHack=true) |
void | refreshCache () |
| Reinitialize the cache with our current settings.
|
Public Attributes |
Vector< ClipStackEntry > | mLevels |
| Each layer of the clip stack is stored here.
|
U32 | mClipMapSize |
| Dimensions of the textures we're working with.
|
U32 | mTextureSize |
| How big of a virtual texture are we working with?
|
U32 | mClipStackDepth |
| How deep of a clipstack are we working with?
|
S32 | mMaxTexelUploadPerRecenter |
| How many texels, max, will we upload before we call it quits for this recenter operation?
|
bool | mTile |
| If set, then this clipmap tiles and we should interpret coordinates outside the unit square as being in repeats.
|
Static Public Attributes |
static bool | smDebugTextures |
| Indicates we want to use debug visualization to make selection of clip layers more obvious.
|
static const String | smMorphT |
| Shader constants used by clipmap shaders.
|
static const String | smMapInfo |
static const String | smBrightnessScale |
static const String | smDetData |
Private Member Functions |
U32 | getMipLevel (F32 scale) |
Static Private Member Functions |
static void | texCB (GFXTexCallbackCode code, void *userData) |
Private Attributes |
S32 | mTexCallbackHandle |
bool | mForceClipmapPurge |
bool | mNeedRefill |
BaseMatInstance * | mClipmapMat [MAX_LEVELS] |
AlignedArray< Point4F > | mMapInfoConst |
MaterialParameterHandle * | mMorphTSC [MAX_LEVELS] |
MaterialParameterHandle * | mMapInfoTC [MAX_LEVELS] |
MaterialParameterHandle * | mDiffuseMap0TC [MAX_LEVELS] |
MaterialParameterHandle * | mDiffuseMap1TC [MAX_LEVELS] |
MaterialParameterHandle * | mDiffuseMap2TC [MAX_LEVELS] |
MaterialParameterHandle * | mDiffuseMap3TC [MAX_LEVELS] |
BaseMatInstance * | mClipmapMatBasePassFF |
BaseMatInstance * | mClipmapMatAddPassFF |
IClipMapImageCache * | mImageCache |
S32 | mTexelsUpdated |
| How many texels have we replaced with new data in the course of operation?
|
S32 | mTotalUpdates |
| How many update operations have we performed?
|
Static Private Attributes |
static const U32 | MAX_LEVELS = 4 |
| We have a separate shader for each number of clipmap levels.
|
Classes |
struct | ClipStackEntry |
Constructor & Destructor Documentation
Member Function Documentation
U32 ClipMap::getMipLevel |
( |
F32 |
scale |
) |
[private] |
void ClipMap::clipAgainstGrid |
( |
const S32 |
gridSpacing, |
|
|
const RectI & |
rect, |
|
|
S32 * |
outCount, |
|
|
RectI * |
outBuffer | |
|
) |
| | |
Clip a rectangle of size <= gridSpacing against grid lines spaced every gridSpacing units, starting at the origin.
void ClipMap::initClipStack |
( |
|
) |
|
Generate the clipstack and intermediate values, given valid mClipMapSize and mTextureSize.
Call me once everything (ie, caches) is initialized.
void ClipMap::fillWithTestPattern |
( |
|
) |
|
Fill all the texture levels with a brightly colored test pattern.
bool ClipMap::fillWithTextureData |
( |
|
) |
|
Fill all the textures levels with data from the cache for the current center.
- Returns:
- False if not all requests could be fulfilled.
Recenter all levels of the clipstack to point center, and do any reuploads required.
void ClipMap::calculateModuloDeltaBounds |
( |
const RectI & |
oldData, |
|
|
const RectI & |
newData, |
|
|
RectI * |
outRects, |
|
|
S32 * |
outRectCount | |
|
) |
| | |
Calculate one or more rectangles that need to be updated based on the observed delta.
void ClipMap::calculateClipMapLevels |
( |
const F32 |
near, |
|
|
const F32 |
far, |
|
|
const RectF & |
texBounds, |
|
|
S32 & |
outStartLevel, |
|
|
S32 & |
outEndLevel | |
|
) |
| | |
Given some information about a piece of geometry, return what clipmap levels are most appropriate to use on it.
It will give a max of 4 levels, and always return levels such that the geometry will not exceed the currently loaded data for the specified clipmap levels.
Set the cache we're currently using to service image data requests.
Get material and bind appropriate textures for the specified levels of the clipmap.
Note use of default values to specify number of layers we want bound.
void ClipMap::refreshCache |
( |
|
) |
|
Reinitialize the cache with our current settings.
Member Data Documentation
Each layer of the clip stack is stored here.
Dimensions of the textures we're working with.
How big of a virtual texture are we working with?
How deep of a clipstack are we working with?
- Note:
- this is redundant with mLevels.size()... mostly.
How many texels, max, will we upload before we call it quits for this recenter operation?
If set, then this clipmap tiles and we should interpret coordinates outside the unit square as being in repeats.
Indicates we want to use debug visualization to make selection of clip layers more obvious.
Shader constants used by clipmap shaders.
We have a separate shader for each number of clipmap levels.
This is 2,3, or 4 currently.
How many texels have we replaced with new data in the course of operation?
How many update operations have we performed?
|