Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csPolyTexture Class Reference

This class represents a lighted texture for a polygon. More...

#include <polytext.h>

Inheritance diagram for csPolyTexture:

iPolygonTexture iBase List of all members.

Public Methods

 csPolyTexture ()
virtual ~csPolyTexture ()
void SetPolygon (csPolygon3D *p)
 Set the corresponding polygon for this polytexture.

csPolygon3DGetCSPolygon ()
 Return the polygon corresponding to this texture.

void SetLightMap (csLightMap *lightmap)
 Set the lightmap for this polytexture (and call IncRef() on the lightmap). More...

csLightMapGetCSLightMap ()
 Get the cslightmap, for engine internal use (users see GetLightMap below).

void SetMaterialHandle (iMaterialHandle *th)
 Set the material to be used for this polytexture.

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

void InitLightMaps ()
 Initialize the lightmaps.

void FillLightMap (csFrustumView *lview, bool vis, csPolygon3D *subpoly)
 Update the lightmap for the given light. More...

void UpdateFromShadowBitmap (csLight *light, const csVector3 &lightpos, const csColor &lightcolor)
 Update the lightmap of this polygon using the current shadow-bitmap and the light information below.

void MakeDirtyDynamicLights ()
 set the dirty flag for our lightmap.

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

virtual iMaterialHandleGetMaterialHandle ()
 Get the material handle associated with this polygon.

virtual float GetFDU ()
 Get the u-value of the textures bounding box' lower left corner.

virtual float GetFDV ()
 Get the v-value of the textures bounding box' lower left corner.

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

virtual int GetHeight ()
 Get height of lighted texture.

virtual int GetShiftU ()
 Get the power of the lowest power of 2 that is not smaller than the texture bounding box' width that is: 2^shift_u >= texbbox-width > 2^(shift_u-1).

virtual int GetIMinU ()
 Get the rounded u-value of the textures bounding box' lower left corner.

virtual int GetIMinV ()
 Get the rounded v-value of the textures bounding box' lower left corner.

virtual void GetTextureBox (float &fMinU, float &fMinV, float &fMaxU, float &fMaxV)
 Get texture box.

virtual int GetOriginalWidth ()
 Get original width.

virtual iPolygon3DGetPolygon ()
 Get polygon.

virtual bool DynamicLightsDirty ()
 Check if dynamic lighting information should be recalculated.

virtual bool RecalculateDynamicLights ()
 Recalculate all pseudo and real dynamic lights if the texture is dirty. More...

virtual iLightMapGetLightMap ()
 Get light map.

virtual int GetLightCellSize ()
 Query the size of one light cell.

virtual int GetLightCellShift ()
 Query log2 (cell size).

virtual void* GetCacheData (int idx)
 Get data used internally by texture cache.

virtual void SetCacheData (int idx, void *d)
 Set data used internally by texture cache.


Public Attributes

 SCF_DECLARE_IBASE

Static Public Attributes

float cfg_cosinus_factor
 Option variable: control how much the angle of the light with the polygon it hits affects the final light value. More...


Friends

class  csPolygon3D
class  csPolygon2D

Detailed Description

This class represents a lighted texture for a polygon.


Member Function Documentation

void csPolyTexture::FillLightMap ( csFrustumView * lview,
bool vis,
csPolygon3D * subpoly )
 

Update the lightmap for the given light.

'vis' will be false if the polygon is totally shadowed. In this case we should use 'subpoly' to see where the shadow must go and not the base polygon which this csPolyTexture points too.

bool csPolyTexture::RecalculateDynamicLights ( ) [virtual]
 

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).

Reimplemented from iPolygonTexture.

void csPolyTexture::SetLightMap ( csLightMap * lightmap )
 

Set the lightmap for this polytexture (and call IncRef() on the lightmap).

Can also be used to clear the reference to the lightmap if 'lightmap' is NULL.


Member Data Documentation

float csPolyTexture::cfg_cosinus_factor [static]
 

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.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.5 written by Dimitri van Heesch, ©1997-2000