CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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

void SetChildNode (csKDTreeChild *childnode)
 Set the kdtree child node used by this light (in the kdtree that is maintained by the sector light list). More...

csKDTreeChildGetChildNode () const
 Get the kdtree child node. More...

const char * GetLightID ()
 Get the ID of this light. More...

virtual bool IsDynamic () const
 Return true if the light is pseudo-dynamic. More...

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

iSectorGetSector () const
 Get the current sector for this light. More...

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

const csVector3GetCenter ()
 Get the center position. More...

csColorGetColor ()
 Get the light color. More...

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

csHaloGetHalo ()
 Return the associated halo. More...

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

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

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

void SetAttenuationVector (const csVector3 &pattenv)
 Set attenuation vector csVector3(constant, linear, quadric). More...

const csVector3GetAttenuationVector ()
 Get attenuation vector csVector3(constant, linear, quadric). More...

float GetInfluenceRadius ()
 Get the influence radius of the light. More...

float GetInfluenceRadiusSq ()
 Get the squared influence radius of the light. More...

void SetInfluenceRadius (float radius)
 Override the influence radius. More...

void CalculateAttenuationVector (int atttype, float radius=1.0f, float brightness=1.0f)
 Calculate the attenuation vector for a given attenuation type. More...

bool GetDistanceForBrightness (float brightness, float &distance)
 Get the distance for a given light brightness. More...

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


Public Attributes

csFlags flags
 Set of flags. More...

csLight::Light scfiLight
 iLight implementation. More...


Static Public Attributes

int ambient_red
 Config value: ambient red value. More...

int ambient_green
 Config value: ambient green value. More...

int ambient_blue
 Config value: ambient blue value. More...


Protected Methods

const char * GenerateUniqueID ()
 Get a unique ID for this light. Generate it if needed. More...

void CalculateInfluenceRadius ()
 Calculate the influenceradius from the attenuation vector. More...


Protected Attributes

iSectorsector
 Home sector of the light. More...

csVector3 center
 Position of the light. More...

csColor color
 Color. More...

csHalohalo
 The associated halo (if not 0). More...

int attenuation
 Attenuation type. More...

csVector3 attenuationvec
 Attenuation vector in the format x=kc, y=kl, z=kq. More...

float influenceRadius
 The radius where the light have any effect at all. More...

float influenceRadiusSq
 Squared influence radius. More...

float inv_dist
 Inverse radius of light. More...

bool influenceValid
 Is the influence radius valid? More...

uint32 lightnr
 Light number. Changes when the light changes in some way (color/pos). More...

csRefArray< iLightCallbacklight_cb_vector
 List of light callbacks. More...


Static Protected Attributes

float influenceIntensityFraction
 Config value: The intensity at the influenceRadius in parts of the main light intensity. More...


Detailed Description

Superclass of all positional lights.

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

Definition at line 49 of file csengine/light.h.


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.

virtual 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::CalculateAttenuationVector int    atttype,
float    radius = 1.0f,
float    brightness = 1.0f
 

Calculate the attenuation vector for a given attenuation type.

Parameters:
atttype  Attenuation type constant - CS_ATTN_NONE, CS_ATTN_INVERSE, CS_ATTN_REALISTIC
radius  Radius where the light is brightness bright
brightness  Brightness of the light at radius

void csLight::CalculateInfluenceRadius   [protected]
 

Calculate the influenceradius from the attenuation vector.

const char* csLight::GenerateUniqueID   [protected]
 

Get a unique ID for this light. Generate it if needed.

Referenced by GetLightID.

int csLight::GetAttenuation   [inline]
 

Get the light's attenuation type.

Definition at line 207 of file csengine/light.h.

References attenuation.

const csVector3& csLight::GetAttenuationVector  
 

Get attenuation vector csVector3(constant, linear, quadric).

float csLight::GetBrightnessAtDistance float    d
 

Get the brightness of a light at a given distance.

const csVector3& csLight::GetCenter   [inline]
 

Get the center position.

Definition at line 178 of file csengine/light.h.

csKDTreeChild* csLight::GetChildNode   const [inline]
 

Get the kdtree child node.

Definition at line 152 of file csengine/light.h.

csColor& csLight::GetColor   [inline]
 

Get the light color.

Definition at line 183 of file csengine/light.h.

bool csLight::GetDistanceForBrightness float    brightness,
float &    distance
 

Get the distance for a given light brightness.

Returns:
Returns whether the distance could be calculated. E.g. when attenuation vector only has a constant part.
Remarks:
  • Might fail when brightness <= 0.

csHalo* csLight::GetHalo   [inline]
 

Return the associated halo.

Definition at line 197 of file csengine/light.h.

float csLight::GetInfluenceRadius  
 

Get the influence radius of the light.

float csLight::GetInfluenceRadiusSq  
 

Get the squared influence radius of the light.

const char* csLight::GetLightID   [inline]
 

Get the ID of this light.

Definition at line 155 of file csengine/light.h.

References GenerateUniqueID.

iSector* csLight::GetSector   const [inline]
 

Get the current sector for this light.

Definition at line 168 of file csengine/light.h.

virtual bool csLight::IsDynamic   const [inline, virtual]
 

Return true if the light is pseudo-dynamic.

Reimplemented in csStatLight.

Definition at line 158 of file csengine/light.h.

void csLight::SetAttenuation int    a
 

Change the light's attenuation type.

void csLight::SetAttenuationVector const csVector3   pattenv
 

Set attenuation vector csVector3(constant, linear, quadric).

void csLight::SetCenter const csVector3   v
 

Set the center position.

void csLight::SetChildNode csKDTreeChild   childnode [inline]
 

Set the kdtree child node used by this light (in the kdtree that is maintained by the sector light list).

Definition at line 144 of file csengine/light.h.

virtual void csLight::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.

Reimplemented in csStatLight.

void csLight::SetHalo csHalo   Halo
 

Set the halo associated with this light.

void csLight::SetInfluenceRadius float    radius
 

Override the influence radius.

virtual void csLight::SetSector iSector   sector [virtual]
 

Set the current sector for this light.


Member Data Documentation

int csLight::ambient_blue [static]
 

Config value: ambient blue value.

Definition at line 121 of file csengine/light.h.

int csLight::ambient_green [static]
 

Config value: ambient green value.

Definition at line 117 of file csengine/light.h.

int csLight::ambient_red [static]
 

Config value: ambient red value.

Definition at line 113 of file csengine/light.h.

int csLight::attenuation [protected]
 

Attenuation type.

Definition at line 69 of file csengine/light.h.

Referenced by GetAttenuation.

csVector3 csLight::attenuationvec [protected]
 

Attenuation vector in the format x=kc, y=kl, z=kq.

Definition at line 71 of file csengine/light.h.

csVector3 csLight::center [protected]
 

Position of the light.

Definition at line 62 of file csengine/light.h.

csColor csLight::color [protected]
 

Color.

Definition at line 64 of file csengine/light.h.

csFlags csLight::flags
 

Set of flags.

Definition at line 107 of file csengine/light.h.

csHalo* csLight::halo [protected]
 

The associated halo (if not 0).

Definition at line 66 of file csengine/light.h.

float csLight::influenceIntensityFraction [static, protected]
 

Config value: The intensity at the influenceRadius in parts of the main light intensity.

Definition at line 87 of file csengine/light.h.

float csLight::influenceRadius [protected]
 

The radius where the light have any effect at all.

Definition at line 74 of file csengine/light.h.

float csLight::influenceRadiusSq [protected]
 

Squared influence radius.

Definition at line 76 of file csengine/light.h.

bool csLight::influenceValid [protected]
 

Is the influence radius valid?

Definition at line 81 of file csengine/light.h.

float csLight::inv_dist [protected]
 

Inverse radius of light.

Definition at line 78 of file csengine/light.h.

csRefArray<iLightCallback> csLight::light_cb_vector [protected]
 

List of light callbacks.

Definition at line 95 of file csengine/light.h.

uint32 csLight::lightnr [protected]
 

Light number. Changes when the light changes in some way (color/pos).

Definition at line 90 of file csengine/light.h.

csLight::Light csLight::scfiLight
 

iLight implementation.

Referenced by csLightingProcessInfo::GetLight.

iSector* csLight::sector [protected]
 

Home sector of the light.

Definition at line 60 of file csengine/light.h.


The documentation for this class was generated from the following file:
Generated for Crystal Space by doxygen 1.2.14