Google

Main Page   Class Hierarchy   Compound List   File List   Compound Members  

csLight Class Reference

Superclass of all positional lights. More...

#include <light.h>

Inheritance diagram for csLight:

csObject iObject iBase csDynLight csStatLight List of all members.

Public Methods

 csLight (float x, float y, float z, float dist, float red, float green, float blue)
 Construct a light at a given position. More...

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

unsigned long GetLightID ()
 Get the ID of this light.

virtual void SetSector (csSector *sector)
 Set the current sector for this light.

csSectorGetSector () const
 Get the current sector for this light.

void SetCenter (const csVector3 &v)
 Set the center position.

const csVector3GetCenter ()
 Get the center position.

float GetRadius () const
 Get the radius.

float GetSquaredRadius () const
 Get the squared radius.

float GetInverseRadius () const
 Get the inverse radius.

void SetRadius (float radius)
 Set the radius.

csColorGetColor ()
 Get the light color.

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

csHaloGetHalo ()
 Return the associated halo.

void SetHalo (csHalo *Halo)
 Set the halo associated with this light.

int GetAttenuation ()
 Get the light's attenuation type.

void SetAttenuation (int a)
 Change the light's attenuation type.

float GetBrightnessAtDistance (float d)
 Get the brightness of a light at a given distance.

 SCF_DECLARE_IBASE_EXT (csObject)

Public Attributes

csFlags flags
 Set of flags.

csLight::Light  scfiLight

Static Public Attributes

int ambient_red
 Config value: ambient red value.

int ambient_green
 Config value: ambient green value.

int ambient_blue
 Config value: ambient blue value.


Protected Attributes

csSectorsector
 Home sector of the light.

csVector3 center
 Position of the light.

float dist
 Radius of light.

float sqdist
 Squared radius of light.

float inv_dist
 Inverse radius of light.

csColor color
 Color.

csHalohalo
 The associated halo (if not NULL).

int attenuation
 Attenuation type.


Detailed Description

Superclass of all positional lights.

A light subclassing from this has a color, a position and a radius.

First some terminology about all the several types of lights that Crystal Space supports:

  • Static light. This is a normal static light that cannot move and cannot change intensity/color. All lighting information from all static lights is collected in one static lightmap.
  • Pseudo-dynamic light. This is a static light that still cannot move but the intensity/color can change. The shadow information from every pseudo-dynamic light is kept in a seperate shadow-map. Shadowing is very accurate with pseudo-dynamic lights since they use the same algorithm as static lights.
  • Dynamic light. This is a light that can move and change intensity/color. These lights are the most flexible. All lighting information from all dynamic lights is collected in one dynamic lightmap (seperate from the pseudo-dynamic shadow-maps). Shadows for dynamic lights will be less accurate because things will not cast accurate shadows (due to computation speed limitations).
Note that static and pseudo-dynamic lights are represented by the same csStatLight class.


Constructor & Destructor Documentation

csLight::csLight ( float x,
float y,
float z,
float dist,
float red,
float green,
float blue )
 

Construct a light at a given position.

With a given radius, a given color, a given name and type. The light will not have a halo by default.

csLight::~csLight ( ) [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 csLight::SetColor ( const csColor & col ) [inline, 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.

Reimplemented in csStatLight, and csDynLight.


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