In file include/csengine/polytext.h:

## class csPolyTexture

> This class represents a lighted texture for a polygon

### Public Fields

static float cfg_cosinus_factor
  Option variable: control how much the angle of the light with the polygon it hits affects the final light value
static bool do_accurate_things
  Option variable: do accurate lighting of things. This is much slower however.
float Fmin_u
  fp bounding box (0..1 texture space)
static bool subtex_dynlight
  If the sub-texture optimization is enabled (subtex_size != 0) then this option gives an additional optimization
static int subtex_size
  The size of the sub-textures

### Public Methods

int CountCleanSubtextures()
  Return the number of clean sub-textures
int CountDirtySubtextures()
  Return the number of dirty sub-textures
void CreateBoundingTextureBox()
  Calculate the bounding box in (u,v) space for the lighted texture
void CreateDirtyMatrix()
  Create the dirty matrix if needed
csPolyTexture()
void FillLightMap(csLightView& lview)
  Update the lightmap for the given light
int GetAndU()
int GetDu()
int GetDv()
float GetFdu()
float GetFdv()
int GetHeight()
  Get height of lighted texture.
csLightMap* GetLightMap()
int GetMipmapLevel()
int GetMipmapSize()
  Get the mipmap size used for this texture.
int GetOrigWidth()
int GetShiftU()
ITextureHandle* GetTextureHandle()
int GetWidth()
  Get width of lighted texture (power of 2).
void InitLightMaps()
  Initialize the lightmaps
void MakeAllDirty()
  Make the dirty matrix completely dirty
void MakeDirtyDynamicLights()
bool RecalcDynamicLights()
  Recalculate all pseudo and real dynamic lights if the texture is dirty
void SetMipmapLevel(int mm)
void SetMipmapSize(int mm)
  Set the mipmap size used for this texture.
void SetPolygon(csPolygon3D* p)
  Set the corresponding polygon for this polytexture
void SetTextureHandle(ITextureHandle* th)
  Set the texture to be used for this polytexture.
void ShineDynLightMap(csLightPatch* lp)
  Update the real lightmap for a given csLightPatch (used for a dynamic light)
virtual ~csPolyTexture()

### Private Fields

int and_u
int dirty_cnt
  Number of dirty sub-textures (if 0 whole texture is clean and in the cache
int dirty_h
  Height of dirty matrix.
UByte* dirty_matrix
  Dirty matrix used in combination with the sub-texture optimization
int dirty_size
  Size of dirty matrix (dirty_w*dirty_h).
int dirty_w
  Width of dirty matrix.
int du
int dv
bool dyn_dirty
  If true, dynamic lighting needs to be recalculated.
float fdu
float fdv
int h
  Height of lighted texture.
int Imin_u
  Bounding box of corresponding polygon in 2D texture space
csLightMap* lm
  LightMap.
int mipmap_level
  The mipmap level (0..3) that this PolyTexture is used for.
int mipmap_shift
  Mipmap shift corresponding to the mipmap_size above.
int mipmap_size
  Mipmap size to use for lightmap boxes: 16, 8, 4, or 2.
csPolygon3D* polygon
  The corresponding polygon.
int shf_u
int size
  Size including vertical margins (note: size is in pixels, multiply this value by the real number of bytes for every pixel to get the real size)
void* tcache_data
  Private texture cache data.
ITextureHandle* txt_handle
  The corresponding unlighted texture.
int w
  Width of lighted texture ('w' is a power of 2).
int w_orig
  Original width (not a power of 2) (w_orig <= w).

## Documentation

> This class represents a lighted texture for a polygon. A polygon generally has four of these (one for every mipmap level).

`void* tcache_data`
  Private texture cache data.

`UByte* dirty_matrix`
  Dirty matrix used in combination with the sub-texture optimization

`int dirty_w`
  Width of dirty matrix.

`int dirty_h`
  Height of dirty matrix.

`int dirty_size`
  Size of dirty matrix (dirty_w*dirty_h).

`int dirty_cnt`
  Number of dirty sub-textures (if 0 whole texture is clean and in the cache

`csPolygon3D* polygon`
  The corresponding polygon.

`ITextureHandle* txt_handle`
  The corresponding unlighted texture.

`int Imin_u`
  Bounding box of corresponding polygon in 2D texture space. Note that the u-axis of this bounding box is made a power of 2 for efficiency reasons.

`int shf_u`

`int and_u`

`int w`
  Width of lighted texture ('w' is a power of 2).

`int h`
  Height of lighted texture.

`int w_orig`
  Original width (not a power of 2) (w_orig <= w).

`int size`
  Size including vertical margins (note: size is in pixels, multiply this value by the real number of bytes for every pixel to get the real size)

`int du`

`int dv`

`float fdu`

`float fdv`

`csLightMap* lm`
  LightMap.

`int mipmap_level`
  The mipmap level (0..3) that this PolyTexture is used for.

`int mipmap_size`
  Mipmap size to use for lightmap boxes: 16, 8, 4, or 2.

`int mipmap_shift`
  Mipmap shift corresponding to the mipmap_size above.

`bool dyn_dirty`
  If true, dynamic lighting needs to be recalculated.

`static bool do_accurate_things`
  Option variable: do accurate lighting of things. This is much slower however.

`static float cfg_cosinus_factor`
  Option variable: control how much the angle of the light with the polygon it hits affects the final light value. Values ranges from -1 to 1. With -1 the polygons will get no light at all. With 0 it will be perfect cosine rule. With 1 the cosine is ignored and it will be like Crystal Space was in the past. Note that changing this value at runtime only has an effect on dynamic lights.

`static int subtex_size`
  The size of the sub-textures. Calculations of the textures in the texture cache are done on parts of the textures (sub-textures). This number defines the horizontal and vertical dimensions of such sub-textures. If this value is set to 0 then this sub-texture optimization is not used.
  Must be a power of 2 and larger or equal than the largest lightmap box-size that is used.

`static bool subtex_dynlight`
  If the sub-texture optimization is enabled (subtex_size != 0) then this option gives an additional optimization. With this option enabled dynamic lights will only cause updating of the really touched sub-textures. This results in even more efficient behaviour.

`csPolyTexture()`

`virtual ~csPolyTexture()`

`int GetMipmapSize()`
  Get the mipmap size used for this texture.

`void SetMipmapSize(int mm)`
  Set the mipmap size used for this texture.

`csLightMap* GetLightMap()`

`int GetWidth()`
  Get width of lighted texture (power of 2).

`int GetHeight()`
  Get height of lighted texture.

`int GetDu()`

`int GetDv()`

`float GetFdu()`

`float GetFdv()`

`int GetShiftU()`

`int GetAndU()`

`int GetOrigWidth()`

`void SetPolygon(csPolygon3D* p)`
  Set the corresponding polygon for this polytexture

`void SetMipmapLevel(int mm)`

`int GetMipmapLevel()`

`void SetTextureHandle(ITextureHandle* th)`
  Set the texture to be used for this polytexture.

`ITextureHandle* GetTextureHandle()`

`void CreateBoundingTextureBox()`
  Calculate the bounding box in (u,v) space for the lighted texture

`void InitLightMaps()`
  Initialize the lightmaps

`void FillLightMap(csLightView& lview)`
  Update the lightmap for the given light

`void ShineDynLightMap(csLightPatch* lp)`
  Update the real lightmap for a given csLightPatch (used for a dynamic light)

`void MakeDirtyDynamicLights()`

`float Fmin_u`
  fp bounding box (0..1 texture space)

`bool RecalcDynamicLights()`
  Recalculate all pseudo and real dynamic lights if the texture is dirty. The function returns true if there was a recalculation (then the texture needs to be removed from the texture cache).

`void CreateDirtyMatrix()`
  Create the dirty matrix if needed. This function will also check if the dirty matrix has the right size. If not it will recreate it. The dirty matrix is used in combination with the sub-texture optimization. If recreation of the dirty matrix was needed it will be made all dirty.

`void MakeAllDirty()`
  Make the dirty matrix completely dirty

`int CountDirtySubtextures()`
  Return the number of dirty sub-textures

`int CountCleanSubtextures()`
  Return the number of clean sub-textures

This class has no child classes.

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