In file include/csengine/light.h:

## class csStatLight : public csLight

> Class for a static light

## Inheritance:

### Public Methods

void CalculateLighting(csThing* th)
  Shine this light on all polygons of the csThing
void CalculateLighting()
  Shine this light on all polygons visible from the light
csStatLight(float x, float y, float z, float dist, float red, float green, float blue, bool dynamic)
  Construct a static light at a given position
bool IsDynamic()
  Return true if this light is pseudo-dynamic
void LightingFunc(csLightingFunc* callback, void* callback_data = NULL)
  This function is similar to CalculateLighting
void RegisterPolygon(csPolygon3D* poly)
  Register a polygon for a pseudo-dynamic light
virtual void SetColor(const csColor& col)
  Set the light color
virtual ~csStatLight()
  Destroy the light

### Private Fields

bool dynamic
  The following three variables are used if the light intensity can vary
int num_polygon
  Number of polygons affected by this dynamic light.
csPolygon3D** polygons
  List of polygons that are affected by this dynamic light.

### Inherited from csLight:

### Public Fields

static int ambient_blue
static int ambient_green
static int ambient_red
static int ambient_white

### Public Methods

void AddReference()
bool CheckFlags(ULong to_check)
static void CorrectForNocolor(float* rp, float* gp, float* bp)
static void CorrectForNocolor(unsigned char* rp, unsigned char* gp, unsigned char* bp)
csVector3& GetCenter()
csColor& GetColor()
ULong GetFlags()
bool GetHaloInQueue()
float GetHaloIntensity()
float GetHaloMaxIntensity()
float GetRadius()
int GetReferenceCount()
csSector* GetSector()
float GetSquaredRadius()
void RemoveReference()
void SetFlags(ULong mask, ULong value)
void SetHaloInQueue(bool bNew)
void SetHaloIntensity(float newI)
virtual void SetSector(csSector* sector)

### Protected Fields

csVector3 center
csColor color
float dist
ULong flags
float halo_intensity
float halo_max_intensity
int halo_ref_count
bool in_halo_queue
csSector* sector
float sqdist

### Inherited from csObject:

### Public Methods

CS_ID GetID()
csObject* GetObj(const csIdType& objtype)
virtual csObject* GetObjectParent()
void ObjAdd(csObject* obj)
csObjIterator ObjGet(const csIdType& objtype)
void ObjRelease(csObject* obj)
void ObjRemove(csObject* obj)

### Private Fields

CS_ID csid_value
csObjTree* objtree

### Private Methods

virtual void SetObjectParent(csObject* parent)

### Inherited from csBase:

## Documentation

> Class for a static light. These lights cast shadows (against sector boundaries and with things), they support three different colors (R,G,B). They cannot move and they can only vary in intensity with some memory trade-offs (in which case we call it a pseudo-dynamic light).

`bool dynamic`
  The following three variables are used if the light intensity can vary. 'dynamic' is set to true in that case. 'num_polygon' and 'polygons' indicate all polygons that are possibly lit by this light.

`int num_polygon`
  Number of polygons affected by this dynamic light.

`csPolygon3D** polygons`
  List of polygons that are affected by this dynamic light.

`csStatLight(float x, float y, float z, float dist, float red, float green, float blue, bool dynamic)`
  Construct a static light at a given position. With a given radius and a given color. If 'dynamic' is true we have a pseudo-dynamic light which can change intensity and color (but not move). The light will not have a halo by default.

`virtual ~csStatLight()`
  Destroy the light. Note that destroying a light may not have the expected effect. Static lights result in changes in the lightmaps. Removing them will not automatically update those lightmaps as that is a time-consuming process.

`bool IsDynamic()`
  Return true if this light is pseudo-dynamic

`virtual void SetColor(const csColor& col)`
  Set the light color. Note that setting the color of a light may not always have an immediate visible effect. Static lights are precalculated into the lightmaps and those lightmaps are not automatically updated when calling this function as that is a time consuming process. However, this function works as expected for pseudo-dynamic lights. In this case the lightmaps will be correctly updated the next time they become visible.

`void RegisterPolygon(csPolygon3D* poly)`
  Register a polygon for a pseudo-dynamic light. Every polygon which is interested in updating its lightmaps as this light changes should register itself to the light.

`void CalculateLighting()`
  Shine this light on all polygons visible from the light. This routine will update the lightmaps of all polygons or update the vertex colors if gouraud shading is used. It correctly takes pseudo-dynamic lights into account and will then update the corresponding shadow map.

`void CalculateLighting(csThing* th)`
  Shine this light on all polygons of the csThing. Only backface culling is used. The light is assumed to be in the same sector as the csThing.

`void LightingFunc(csLightingFunc* callback, void* callback_data = NULL)`
  This function is similar to CalculateLighting. It will do all the stuff that CalculateLighting would do except for one important thing: it will not actually light the polygons. Instead it will call a callback function for every entity that it was planning to light. This allows you to show or draw debugging information.

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