ClipMapImageCache_Debug Class Reference

#include <clipMapDebugCache.h>

Inheritance diagram for ClipMapImageCache_Debug:

Inheritance graph
[legend]
List of all members.

Detailed Description

A clipmap "cache" that produces a variety of debug patterns on the fly.

This is very useful for debugging the clipmap shaders as well as visualizing various parts of the clipmap process (LOD selection, cache centering behavior, etc.).


Public Types

 LOD
 Render flat colors based on the clipmaplevel.
 UVGradient
 Render a UV gradient based on position in the clipmap level.
 Checkers
 Render a checkerboard pattern, sized so that it's 1px on the highest clipmap level.
enum  DebugModes {
  LOD,
  UVGradient,
  Checkers
}

Public Member Functions

 ClipMapImageCache_Debug ()
virtual ~ClipMapImageCache_Debug ()
void setDebugMode (DebugModes dm, bool doSquares)
void initialize (ClipMap *)
 Initialize the image cache that can hold at least clipMapSize*clipMapSize pixels of data.
virtual void initialize (U32 clipMapSize, U32 clipMapDepth)
virtual void setInterestCenter (const Point2I &origin)
 Indicate our interest area center.
virtual bool isDataAvailable (U32 mipLevel, const RectI &region) const
 Is cached data available for a given region?
virtual bool beginRectUpdates (ClipMap::ClipStackEntry &cse)
 Indicate that we are going to be updating a series of rectangles on specified level of the clipstack.
virtual void doRectUpdate (U32 mipLevel, ClipMap::ClipStackEntry &cse, const RectI &srcRegion, const RectI &dstRegion)
 This is the only place that does any real work - it copies the debug pattern.
virtual void finishRectUpdates (ClipMap::ClipStackEntry &cse)
 And finally, give the cache a chance to finish processing for a specified clipstack level.
virtual bool isRenderToTargetCache ()
 If true, we'll allocate render targets rather than normal diffuse maps.

Private Attributes

U32 mCurDebugMode
 One of DebugModes.
bool mDoSquares
 Render alternating 4px squares on top of the debug mode.


Member Enumeration Documentation

Enumerator:
LOD  Render flat colors based on the clipmaplevel.
UVGradient  Render a UV gradient based on position in the clipmap level.
Checkers  Render a checkerboard pattern, sized so that it's 1px on the highest clipmap level.


Constructor & Destructor Documentation

ClipMapImageCache_Debug::ClipMapImageCache_Debug (  ) 

virtual ClipMapImageCache_Debug::~ClipMapImageCache_Debug (  )  [inline, virtual]


Member Function Documentation

void ClipMapImageCache_Debug::setDebugMode ( DebugModes  dm,
bool  doSquares 
) [inline]

void ClipMapImageCache_Debug::initialize ( ClipMap  )  [inline, virtual]

Initialize the image cache that can hold at least clipMapSize*clipMapSize pixels of data.

In general the image cache will allocate a bit more than that so it can be efficient in pre-empting requests.

The image cache will also store mipmap data for the interest point, at least clipMapSize px at each miplevel. e.g., for a parameter of 512, we would have available in the cache at all times 512*512*clipMapDepth pixels. Ideally, we would ensure at least one page quanta's worth of extra data is present at all levels so we can fulfill new data requests quickly.

For instance, if we have 128px paged tiles, we'd want to have at least 512/128 = 4 base tiles and 2 border tiles on each axis, so 36 loaded tiles at all times at the source level of detail. This is about two and a quarter megabytes of data per clipmap level, so a cache of about 7 levels * 2.25mb = 15.75mb in system memory for a 32k px source texture. We don't need any "mip" levels - just pure source data for every cliplevel greater than or equal to the clipmap size.

As we may need to regenerate the full clipmap in the case of zombification, we can't discard the top level of data, even though it is never needed in the course of normal clipmap operation.

Implements IClipMapImageCache.

virtual void ClipMapImageCache_Debug::initialize ( U32  clipMapSize,
U32  clipMapDepth 
) [inline, virtual]

virtual void ClipMapImageCache_Debug::setInterestCenter ( const Point2I origin  )  [inline, virtual]

Indicate our interest area center.

The cache is for a fixed size area, so we disallow changing that area size.

Implements IClipMapImageCache.

virtual bool ClipMapImageCache_Debug::isDataAvailable ( U32  mipLevel,
const RectI region 
) const [virtual]

Is cached data available for a given region?

Implements IClipMapImageCache.

virtual bool ClipMapImageCache_Debug::beginRectUpdates ( ClipMap::ClipStackEntry cse  )  [inline, virtual]

Indicate that we are going to be updating a series of rectangles on specified level of the clipstack.

Implements IClipMapImageCache.

virtual void ClipMapImageCache_Debug::doRectUpdate ( U32  mipLevel,
ClipMap::ClipStackEntry cse,
const RectI srcRegion,
const RectI dstRegion 
) [virtual]

This is the only place that does any real work - it copies the debug pattern.

Implements IClipMapImageCache.

virtual void ClipMapImageCache_Debug::finishRectUpdates ( ClipMap::ClipStackEntry cse  )  [inline, virtual]

And finally, give the cache a chance to finish processing for a specified clipstack level.

Implements IClipMapImageCache.

virtual bool ClipMapImageCache_Debug::isRenderToTargetCache (  )  [inline, virtual]

If true, we'll allocate render targets rather than normal diffuse maps.

Implements IClipMapImageCache.


Member Data Documentation

One of DebugModes.

Render alternating 4px squares on top of the debug mode.