## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# iLight Struct Reference
[Lighting]

The iLight interface is the SCF interface for the csLight class. More...

`#include <iengine/light.h>`

Inheritance diagram for iLight:

[legend]
List of all members.

## Public Member Functions

virtual void | AddAffectedLightingInfo (iLightingInfo *li)=0
| Add a mesh to this light.
virtual iCrossHalo * | CreateCrossHalo (float intensity, float cross)=0
| Create a cross halo for this light.
virtual iFlareHalo * | CreateFlareHalo ()=0
| Create a flare halo for this light.
virtual iNovaHalo * | CreateNovaHalo (int seed, int num_spokes, float roundness)=0
| Create a nova halo for this light.
virtual const csVector3 & | GetAttenuationConstants () const =0
| Get attenuation constants.
virtual csLightAttenuationMode | GetAttenuationMode () const =0
| Return current attenuation mode.
virtual float | GetBrightnessAtDistance (float d) const =0
| Get the brightness of a light at a given distance.
virtual const csVector3 & | GetCenter () const =0
| Get the position of this light (local transformation relative to whatever parent it has).
virtual const csColor & | GetColor () const =0
| Get the diffuse color of this light.
virtual float | GetCutoffDistance () const =0
| Get the the maximum distance at which the light is guranteed to shine.
virtual float | GetDirectionalCutoffRadius () const =0
| Get radial cutoff distance for directional lights.
virtual csLightDynamicType | GetDynamicType () const =0
| Get the dynamic type of this light.
virtual csFlags & | GetFlags ()=0
| Get flags for this light.
virtual const csVector3 | GetFullCenter () const =0
| Get the position of this light.
virtual iBaseHalo * | GetHalo () const =0
| Return the associated halo.
virtual iLightCallback * | GetLightCallback (int idx) const =0
| Get the specified light callback.
virtual int | GetLightCallbackCount () const =0
| Get the number of light callbacks.
virtual const char * | GetLightID ()=0
| Get the id of this light. This is a 16-byte MD5.
virtual uint32 | GetLightNumber () const =0
| Return a number that changes when the light changes (color, or position).
virtual iMovable * | GetMovable ()=0
| Get the movable for this light.
virtual iSector * | GetSector ()=0
| Get the sector for this light.
virtual const csColor & | GetSpecularColor () const =0
| Get the specular color of this light.
virtual void | GetSpotLightFalloff (float &inner, float &outer) const =0
| Get spot light falloff angles.
virtual csLightType | GetType () const =0
| Get the light type of this light.
virtual iObject * | QueryObject ()=0
| Get the iObject for this light.
virtual iSceneNode * | QuerySceneNode ()=0
| Get the scene node that this object represents.
virtual void | RemoveAffectedLightingInfo (iLightingInfo *li)=0
| Remove a mesh from this light.
virtual void | RemoveLightCallback (iLightCallback *cb)=0
| Remove a light callback.
virtual void | SetAttenuationConstants (const csVector3 &constants)=0
| Set attenuation constants.
virtual void | SetAttenuationMode (csLightAttenuationMode a)=0
| Set attenuation mode.
virtual void | SetCenter (const csVector3 &pos)=0
| Set the position of this light.
virtual void | SetColor (const csColor &col)=0
| Set the diffuse color of this light.
virtual void | SetCutoffDistance (float distance)=0
| Set the the maximum distance at which the light is guranteed to shine.
virtual void | SetDirectionalCutoffRadius (float radius)=0
| Set radial cutoff distance for directional lights.
virtual void | SetLightCallback (iLightCallback *cb)=0
| Set the light callback.
virtual void | SetSpecularColor (const csColor &col)=0
| Set the specular color of this light.
virtual void | SetSpotLightFalloff (float inner, float outer)=0
| Set spot light falloff angles.
virtual void | SetType (csLightType type)=0
| Set the light type of this light.
virtual void | Setup ()=0
| For a dynamic light you need to call this to do the actual lighting calculations.

## Detailed Description

The iLight interface is the SCF interface for the csLight class.

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

Main creators of instances implementing this interface:

- iEngine::CreateLight()

Main ways to get pointers to this interface:

- iEngine::FindLight()
- iEngine::FindLightID()
- iEngine::GetLightIterator()
- iEngine::GetNearbyLights()
- iLightList::Get()
- iLightList::FindByName()
- iLoaderContext::FindLight()

Main users of this interface:

- iEngine

Definition at line 233 of file light.h.

## Member Function Documentation

virtual void iLight::AddAffectedLightingInfo | ( | iLightingInfo * | li | ) | `[pure virtual]`

| Add a mesh to this light. This is usually called during Setup() by meshes that are hit by the light.

virtual iCrossHalo* iLight::CreateCrossHalo | ( | float | intensity,
|  | float | cross
| ) | `[pure virtual]`

| Create a cross halo for this light.

virtual iFlareHalo* iLight::CreateFlareHalo | ( |  | ) | `[pure virtual]`

| Create a flare halo for this light.

virtual iNovaHalo* iLight::CreateNovaHalo | ( | int | seed,
|  | int | num_spokes,
|  | float | roundness
| ) | `[pure virtual]`

| Create a nova halo for this light.

virtual const csVector3& iLight::GetAttenuationConstants | ( |  | ) | const`[pure virtual]`

Get attenuation constants.

See also:
  csLightAttenuationMode

virtual csLightAttenuationMode iLight::GetAttenuationMode | ( |  | ) | const`[pure virtual]`

Return current attenuation mode.

See also:
  csLightAttenuationMode

virtual float iLight::GetBrightnessAtDistance | ( | float | d | ) | const`[pure virtual]`

| Get the brightness of a light at a given distance.

virtual const csVector3& iLight::GetCenter | ( |  | ) | const`[pure virtual]`

| Get the position of this light (local transformation relative to whatever parent it has).

virtual const csColor& iLight::GetColor | ( |  | ) | const`[pure virtual]`

| Get the diffuse color of this light.

virtual float iLight::GetCutoffDistance | ( |  | ) | const`[pure virtual]`

| Get the the maximum distance at which the light is guranteed to shine. Can be seen as the distance at which we turn the light of. Used for culling and selection of meshes to light, but not for the lighting itself.

virtual float iLight::GetDirectionalCutoffRadius | ( |  | ) | const`[pure virtual]`

| Get radial cutoff distance for directional lights. The directional light can be viewed as a cylinder with radius equal to DirectionalCutoffRadius and length CutoffDistance

virtual csLightDynamicType iLight::GetDynamicType | ( |  | ) | const`[pure virtual]`

Get the dynamic type of this light.

Supported types:

- CS_LIGHT_DYNAMICTYPE_STATIC
- CS_LIGHT_DYNAMICTYPE_PSEUDO
- CS_LIGHT_DYNAMICTYPE_DYNAMIC

virtual csFlags& iLight::GetFlags | ( |  | ) | `[pure virtual]`

Get flags for this light.

Supported flags:

- CS_LIGHT_ACTIVEHALO

virtual const csVector3 iLight::GetFullCenter | ( |  | ) | const`[pure virtual]`

| Get the position of this light. This function correctly takes care of the optional parents of this light.

virtual iBaseHalo* iLight::GetHalo | ( |  | ) | const`[pure virtual]`

| Return the associated halo.

virtual iLightCallback* iLight::GetLightCallback | ( | int | idx | ) | const`[pure virtual]`

| Get the specified light callback.

virtual int iLight::GetLightCallbackCount | ( |  | ) | const`[pure virtual]`

| Get the number of light callbacks.

virtual const char* iLight::GetLightID | ( |  | ) | `[pure virtual]`

| Get the id of this light. This is a 16-byte MD5.

virtual uint32 iLight::GetLightNumber | ( |  | ) | const`[pure virtual]`

| Return a number that changes when the light changes (color, or position).

virtual iMovable* iLight::GetMovable | ( |  | ) | `[pure virtual]`

| Get the movable for this light.

virtual iSector* iLight::GetSector | ( |  | ) | `[pure virtual]`

| Get the sector for this light.

virtual const csColor& iLight::GetSpecularColor | ( |  | ) | const`[pure virtual]`

| Get the specular color of this light.

virtual void iLight::GetSpotLightFalloff | ( | float & | inner,
|  | float & | outer
| ) | const`[pure virtual]`

| Get spot light falloff angles. Get in cosine of the angle.

virtual csLightType iLight::GetType | ( |  | ) | const`[pure virtual]`

| Get the light type of this light.

virtual iObject* iLight::QueryObject | ( |  | ) | `[pure virtual]`

| Get the iObject for this light.

virtual iSceneNode* iLight::QuerySceneNode | ( |  | ) | `[pure virtual]`

| Get the scene node that this object represents.

virtual void iLight::RemoveAffectedLightingInfo | ( | iLightingInfo * | li | ) | `[pure virtual]`

| Remove a mesh from this light.

virtual void iLight::RemoveLightCallback | ( | iLightCallback * | cb | ) | `[pure virtual]`

| Remove a light callback.

virtual void iLight::SetAttenuationConstants | ( | const csVector3 & | constants | ) | `[pure virtual]`

Set attenuation constants.

See also:
  csLightAttenuationMode

virtual void iLight::SetAttenuationMode | ( | csLightAttenuationMode | a | ) | `[pure virtual]`

Set attenuation mode.

See also:
  csLightAttenuationMode

virtual void iLight::SetCenter | ( | const csVector3 & | pos | ) | `[pure virtual]`

| Set the position of this light.

virtual void iLight::SetColor | ( | const csColor & | col | ) | `[pure virtual]`

| Set the diffuse color of this light.

virtual void iLight::SetCutoffDistance | ( | float | distance | ) | `[pure virtual]`

| Set the the maximum distance at which the light is guranteed to shine. Can be seen as the distance at which we turn the light of. Used for culling and selection of meshes to light, but not for the lighting itself.

virtual void iLight::SetDirectionalCutoffRadius | ( | float | radius | ) | `[pure virtual]`

| Set radial cutoff distance for directional lights. The directional light can be viewed as a cylinder with radius equal to DirectionalCutoffRadius and length CutoffDistance

virtual void iLight::SetLightCallback | ( | iLightCallback * | cb | ) | `[pure virtual]`

| Set the light callback. This will call IncRef() on the callback So make sure you call DecRef() to release your own reference.

virtual void iLight::SetSpecularColor | ( | const csColor & | col | ) | `[pure virtual]`

| Set the specular color of this light.

virtual void iLight::SetSpotLightFalloff | ( | float | inner,
|  | float | outer
| ) | `[pure virtual]`

| Set spot light falloff angles. Set in cosine of the angle.

virtual void iLight::SetType | ( | csLightType | type | ) | `[pure virtual]`

| Set the light type of this light.

virtual void iLight::Setup | ( |  | ) | `[pure virtual]`

| For a dynamic light you need to call this to do the actual lighting calculations.

The documentation for this struct was generated from the following file:

- iengine/light.h