CrystalSpace

Public API Reference

Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

light.h File Reference

#include "csutil/scf.h"
#include "iengine/fview.h"

Go to the source code of this file.

Classes

struct  iLight
 The iLight interface is the SCF interface for the csLight class. More...
struct  iLightCallback
 Set a callback which is called when this light color is changed. More...
struct  iLightingProcessData
 The iLightingProcessData interface can be implemented by a mesh object so that it can attach additional information for the lighting process. More...
struct  iLightingProcessInfo
 The iLightingProcessInfo interface holds information for the lighting system. More...
struct  iLightIterator
 Iterator to iterate over all static lights in the engine. More...
struct  iLightList
 This structure represents a list of lights. More...

Light flags

#define CS_LIGHT_ACTIVEHALO   0x80000000
 If this flag is set, the halo for this light is active and is in the engine's queue of active halos.
#define CS_LIGHT_THINGSHADOWS   0x00000001
 If CS_LIGHT_THINGSHADOWS is set for a light then things will also cast shadows.

Attenuation modes

Attenuation controls how the brightness of a light fades with distance. Apart from the attenuation mode there are one to tree constants, which change meaning depending on attenuation mode. There are five attenuation formulas: (distance is distance between point for which lighting is computed and the light)
  • no attenuation = light * 1
  • linear attenuation = light * (1 - distance / constant1)
  • inverse attenuation = light / distance
  • realistic attenuation = light / distance^2
  • CLQ, Constant Linear Quadratic = light / (constant1 + constant2*distance + constant3*distance^2)


enum  csLightAttenuationMode {
  CS_ATTN_NONE = 0, CS_ATTN_LINEAR = 1, CS_ATTN_INVERSE = 2, CS_ATTN_REALISTIC = 3,
  CS_ATTN_CLQ = 4
}

Light Dynamic Types

enum  csLightDynamicType { CS_LIGHT_DYNAMICTYPE_STATIC = 1, CS_LIGHT_DYNAMICTYPE_PSEUDO = 2, CS_LIGHT_DYNAMICTYPE_DYNAMIC = 3 }

Defines

#define CS_DEFAULT_LIGHT_LEVEL   20
 Light level that is used when there is no light on the texture.
#define CS_NORMAL_LIGHT_LEVEL   128
 Light level that corresponds to a normally lit texture.

Enumerations

enum  csLightType { CS_LIGHT_POINTLIGHT, CS_LIGHT_DIRECTIONAL, CS_LIGHT_SPOTLIGHT }
 Type of lightsource. More...


Detailed Description

Definition in file light.h.


Define Documentation

#define CS_DEFAULT_LIGHT_LEVEL   20
 

Light level that is used when there is no light on the texture.

Definition at line 94 of file light.h.

#define CS_LIGHT_ACTIVEHALO   0x80000000
 

If this flag is set, the halo for this light is active and is in the engine's queue of active halos.

When halo become inactive, this flag is reset.

Definition at line 62 of file light.h.

#define CS_LIGHT_THINGSHADOWS   0x00000001
 

If CS_LIGHT_THINGSHADOWS is set for a light then things will also cast shadows.

This flag is set by default for static lights and unset for dynamic lights.

Definition at line 55 of file light.h.

#define CS_NORMAL_LIGHT_LEVEL   128
 

Light level that corresponds to a normally lit texture.

Definition at line 96 of file light.h.


Enumeration Type Documentation

enum csLightAttenuationMode
 

Enumerator:
CS_ATTN_NONE  no attenuation: light * 1
CS_ATTN_LINEAR  linear attenuation: light * (1 - distance / constant1)
CS_ATTN_INVERSE  inverse attenuation: light / distance
CS_ATTN_REALISTIC  realistic attenuation: light / distance^2
CS_ATTN_CLQ  CLQ, Constant Linear Quadratic: light / (constant1 + constant2*distance + constant3*distance^2).

Definition at line 113 of file light.h.

enum csLightDynamicType
 

Enumerator:
CS_LIGHT_DYNAMICTYPE_STATIC  A fully static light.

Unless you are using shaders/renderloop that treat all lights as dynamic this light cannot move and cannot change color. Shadows are accurate and precalculated (if you use lightmaps).

CS_LIGHT_DYNAMICTYPE_PSEUDO  A pseudo-dynamic light.

Unless you are using shaders/renderloop that treat all lights as dynamic this light cannot move but it can change color. Shadows are accurate and precalculated (if you use lightmaps).

CS_LIGHT_DYNAMICTYPE_DYNAMIC  A fully dynamic light.

No shadows are calculated unless you use a shader/renderloop that does that in hardware.

Definition at line 68 of file light.h.

enum csLightType
 

Type of lightsource.

There are currently three types of lightsources:

  • Point lights - have a position. Shines in all directions.
  • Directional lights - have a direction and radius. Shines along it's major axis.
  • Spot lights - have both position and direction. Shines with full strength along major axis and out to the hotspot angle. Between hotspot and outer angle it will falloff, outside outer angle there shines no light.
Enumerator:
CS_LIGHT_POINTLIGHT  Point light.
CS_LIGHT_DIRECTIONAL  Directional light.
CS_LIGHT_SPOTLIGHT  Spot light.

Definition at line 144 of file light.h.


Generated for Crystal Space by doxygen 1.4.4