In file libs/cs3d/software/tcache.h:

## class TextureCache

> This class implements the software texture cache for 8-bit modes (16-bit mode overrides this class)

## Inheritance:

### Public Methods

void clear()
  Clear the texture cache completely.
virtual void create_lighted_texture(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)
  Create a texture in the texture cache
void dump()
  Do a debugging dump
void init_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr)
  Load a texture in the texture cache but do not do any calculations yet
void set_cache_size(long size)
  Set the size of the texture cache
static void set_default_cache_size(long size)
  Set the default size of the texture cache.
TextureCache(csPixelFormat* pfmt)
void use_sub_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr, int u, int v)
  Check if the given sub-texture is in the cache and possibly add it if not
void use_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr)
  Check if the given texture is in the cache and possibly add it if not
virtual ~TextureCache()

### Protected Fields

int gi_pixelbytes
  The number of bytes per pixel.

### Protected Methods

void* alloc_pool(int size)
  Allocate memory from the pool
virtual void create_lighted_texture_lightmaps(TCacheData& tcd, TCacheLightedTexture* tclt, csTextureManagerSoftware* txtmgr)
  For debugging: don't add the texture but only the lightmap data
void free_pool(void* mem, int size)
  Delete memory from the pool
void init_cache_filler(TCacheData& tcd, IPolygonTexture* pt, csTextureManagerSoftware* txtmgr, int u = -1, int v = -1)
  Initialize the TCacheData structure for create_lighted_
virtual void show_lightmap_grid(TCacheData& tcd, TCacheLightedTexture* tclt, csTextureManagerSoftware* txtmgr)
  For debugging: overlay the lightmap grid on the lighted texture

### Private Fields

static int cache_size
  Total size of the cache (expressed in pixels).
TCacheLightedTexture* first
  This is the first texture in the cache.
TCacheLightedTexture* last
  This is the last texture in the cache.
MemoryHeap* memory
  The cache itself
int real_cache_size
  The size that we finally used.
long total_size
  Total size of all textures in the cache.
int total_textures
  Total number of textures in the cache.

### Private Methods

void create_lighted_fast_wxx(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)
  Create a texture in the texture cache (fast_wxx version).
void create_lighted_nocolor(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)
  Create a texture in the texture cache (nocolor version).
void create_lighted_true_rgb(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)
  Create a texture in the texture cache (true_rgb version).
void create_lighted_true_rgb_priv(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)
  Create a texture in the texture cache (true_rgb version and for 'private' colormap textures)
void destroy_pool()
  Destroy the memory pool
void init_pool()
  Initialize the memory pool

### Private

  Pointer to first free entry in pool

## Documentation

> This class implements the software texture cache for 8-bit modes (16-bit mode overrides this class)

`static int cache_size`
  Total size of the cache (expressed in pixels).

`int real_cache_size`
  The size that we finally used.

`TCacheLightedTexture* first`
  This is the first texture in the cache.

`TCacheLightedTexture* last`
  This is the last texture in the cache.

`long total_size`
  Total size of all textures in the cache.

`int total_textures`
  Total number of textures in the cache.

`MemoryHeap* memory`
  The cache itself. This is a private pool of memory used only for lighted textures.

``
  Pointer to first free entry in pool

`virtual void create_lighted_texture(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)`
  Create a texture in the texture cache. This routine will automatically select the right create_lighted_??? depending on the mode Crystal Space is in.

`void create_lighted_nocolor(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)`
  Create a texture in the texture cache (nocolor version).

`void create_lighted_true_rgb(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)`
  Create a texture in the texture cache (true_rgb version).

`void create_lighted_fast_wxx(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)`
  Create a texture in the texture cache (fast_wxx version).

`void create_lighted_true_rgb_priv(TCacheData& tcd, TCacheLightedTexture* pt, csTextureManagerSoftware* txtmgr)`
  Create a texture in the texture cache (true_rgb version and for 'private' colormap textures)

`void init_pool()`
  Initialize the memory pool

`void destroy_pool()`
  Destroy the memory pool

`int gi_pixelbytes`
  The number of bytes per pixel.

`void* alloc_pool(int size)`
  Allocate memory from the pool. Returns NULL if no memory available.

`void free_pool(void* mem, int size)`
  Delete memory from the pool

`void init_cache_filler(TCacheData& tcd, IPolygonTexture* pt, csTextureManagerSoftware* txtmgr, int u = -1, int v = -1)`
  Initialize the TCacheData structure for create_lighted_... If u and v are given (not equal to -1) then the cache filler will only update the texture in the texture cache for the given sub-texture containing that (u,v) coordinate. (u and v are in sub-texture space: blocks of subtex_size*subtex_size)

`virtual void show_lightmap_grid(TCacheData& tcd, TCacheLightedTexture* tclt, csTextureManagerSoftware* txtmgr)`
  For debugging: overlay the lightmap grid on the lighted texture. This function should be called after calling create_lighted_texture ().

`virtual void create_lighted_texture_lightmaps(TCacheData& tcd, TCacheLightedTexture* tclt, csTextureManagerSoftware* txtmgr)`
  For debugging: don't add the texture but only the lightmap data

`TextureCache(csPixelFormat* pfmt)`

`virtual ~TextureCache()`

`void clear()`
  Clear the texture cache completely.

`void set_cache_size(long size)`
  Set the size of the texture cache. If -1 this will simply initialize the texture cache. Note that you should call 'set_cache_size' at least once.

`static void set_default_cache_size(long size)`
  Set the default size of the texture cache.

`void use_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr)`
  Check if the given texture is in the cache and possibly add it if not

`void use_sub_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr, int u, int v)`
  Check if the given sub-texture is in the cache and possibly add it if not. WARNING! This function assumes that the texture is already in the cache (put there with init_texture possibly).

`void init_texture(IPolygonTexture* pt, csTextureManagerSoftware* txtmgr)`
  Load a texture in the texture cache but do not do any calculations yet. This is meant to be used in combination with use_sub_texture. This function will also make sure that the dirty matrix is allocated and has the right size. If changes need to be made here it will set the dirty matrix to all dirty.

`void dump()`
  Do a debugging dump

Direct child classes:
  TextureCache32
  TextureCache16

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de