Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csStatLight Class Reference

Class for a static light. More...

#include <light.h>

Inheritance diagram for csStatLight:

csLight csObject iObject iBase List of all members.

Public Methods

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

virtual ~csStatLight ()
 Destroy the light. More...

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

virtual void SetColor (const csColor &col)
 Set the light color. More...

void RegisterLightMap (csLightMap *lmap)
 Register a lightmap for a pseudo-dynamic light. More...

void CalculateLighting ()
 Shine this light on all polygons visible from the light. More...

void CalculateLighting (iMeshWrapper *mesh)
 Shine this light on all polygons of the mesh. More...

 SCF_DECLARE_IBASE_EXT (csLight)

Public Attributes

csStatLight::eiStaticLight  scfiStatLight

Friends

class  eiStaticLight

Detailed Description

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


Constructor & Destructor Documentation

csStatLight::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.

csStatLight::~csStatLight ( ) [virtual]
 

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.


Member Function Documentation

void csStatLight::CalculateLighting ( iMeshWrapper * mesh )
 

Shine this light on all polygons of the mesh.

Only backface culling is used. The light is assumed to be in the same sector as the mesh. Currently only works on thing meshes.

void csStatLight::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 csStatLight::RegisterLightMap ( csLightMap * lmap )
 

Register a lightmap for a pseudo-dynamic light.

Every lightmap which is interested in updating itself as this light changes should register itself to the light.

void csStatLight::SetColor ( const csColor & col ) [virtual]
 

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.

Reimplemented from csLight.


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