Keos::CLight Class Reference

Representation of a dynamic light source in the scene. More...

#include <KeosLight.h>

List of all members.

Public Types

enum  TLightType { LT_POINT, LT_DIRECTIONAL, LT_SPOT }
 Defines the type of light. More...

Public Member Functions

 CLight ()
 Default constructor.
 ~CLight ()
 Standard destructor.
void SetType (TLightType nType)
 Sets the type of light.
TLightType GetType (void) const
 Returns the light type.
void SetDiffuseColor (float fRed, float fGreen, float fBlue)
 Sets the colour of the diffuse light given off by this source.
void SetDiffuseColor (const CColor &Color)
 Sets the colour of the diffuse light given off by this source.
const CColorGetDiffuseColor (void) const
 Returns the colour of the diffuse light given off by this light source (see setDiffuseColour for more info).
void SetSpecularColor (float fRed, float fGreen, float fBlue)
 Sets the colour of the specular light given off by this source.
void SetSpecularColor (const CColor &Color)
 Sets the colour of the specular light given off by this source.
const CColorGetSpecularColor (void) const
 Returns the colour of specular light given off by this light source.
void SetAttenuation (Real range, Real constant, Real linear, Real quadratic)
 Sets the attenuation parameters of the light source ie how it diminishes with distance.
Real GetAttenuationRange (void) const
 Returns the absolute upper range of the light.
Real GetAttenuationConstant (void) const
 Returns the constant factor in the attenuation formula.
Real GetAttenuationLinear (void) const
 Returns the linear factor in the attenuation formula.
Real GetAttenuationQuadric (void) const
 Returns the quadric factor in the attenuation formula.
void SetSpotRange (const CRadian &innerAngle, const CRadian &outerAngle, Real falloff=1.0)
 Sets the range of a spotlight, i.e.
const CRadianGetSpotInnerAngle (void) const
 Returns the angle covered by the spotlights inner cone.
const CRadianGetSpotOuterAngle (void) const
 Returns the angle covered by the spotlights outer cone.
Real GetSpotFalloff (void) const
 Returns the falloff between the inner and outer cones of the spotlight.
void SetSpotInnerAngle (const CRadian &val)
 Sets the angle covered by the spotlights inner cone.
void SetSpotOuterAngle (const CRadian &val)
 Sets the angle covered by the spotlights outer cone.
void SetSpotFalloff (Real val)
 Sets the falloff between the inner and outer cones of the spotlight.
void SetPosition (float x, float y, float z)
 Sets the position of the light.
void SetPosition (const TVector3F &Vec)
 Sets the position of the light.
const TVector3FGetPosition (void) const
 Returns the position of the light.
void SetDirection (float x, float y, float z)
 Sets the direction in which a light points.
void SetDirection (const TVector3F &Vec)
 Sets the direction in which a light points.
const TVector3FGetDirection (void) const
 Returns the light's direction.


Detailed Description

Representation of a dynamic light source in the scene.

Definition at line 34 of file KeosLight.h.


Member Enumeration Documentation

enum Keos::CLight::TLightType

Defines the type of light.

Enumerator:
LT_POINT  Point light sources give off light equally in all directions, so require only position not direction.
LT_DIRECTIONAL  Directional lights simulate parallel light beams from a distant source, hence have direction but no position.
LT_SPOT  Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff.

Definition at line 39 of file KeosLight.h.


Constructor & Destructor Documentation

Keos::CLight::CLight (  ) 

Default constructor.

Definition at line 32 of file KeosLight.cpp.

References Keos::CColor::Black, LT_POINT, and Keos::CColor::White.

Keos::CLight::~CLight (  ) 

Standard destructor.

Definition at line 54 of file KeosLight.cpp.


Member Function Documentation

void Keos::CLight::SetType ( TLightType  nType  ) 

Sets the type of light.

Definition at line 58 of file KeosLight.cpp.

CLight::TLightType Keos::CLight::GetType ( void   )  const

Returns the light type.

Definition at line 64 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetDiffuseColor ( float  fRed,
float  fGreen,
float  fBlue 
)

Sets the colour of the diffuse light given off by this source.

Definition at line 110 of file KeosLight.cpp.

References Keos::CColor::SetFloats().

void Keos::CLight::SetDiffuseColor ( const CColor Color  ) 

Sets the colour of the diffuse light given off by this source.

Definition at line 116 of file KeosLight.cpp.

const CColor & Keos::CLight::GetDiffuseColor ( void   )  const

Returns the colour of the diffuse light given off by this light source (see setDiffuseColour for more info).

Definition at line 122 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetSpecularColor ( float  fRed,
float  fGreen,
float  fBlue 
)

Sets the colour of the specular light given off by this source.

Definition at line 128 of file KeosLight.cpp.

References Keos::CColor::SetFloats().

void Keos::CLight::SetSpecularColor ( const CColor Color  ) 

Sets the colour of the specular light given off by this source.

Definition at line 134 of file KeosLight.cpp.

const CColor & Keos::CLight::GetSpecularColor ( void   )  const

Returns the colour of specular light given off by this light source.

Definition at line 140 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetAttenuation ( Real  range,
Real  constant,
Real  linear,
Real  quadratic 
)

Sets the attenuation parameters of the light source ie how it diminishes with distance.

Parameters:
range The absolute upper range of the light in world units
constant The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation
linear The linear factor in the attenuation formula: 1 means attenuate evenly over the distance
quadratic The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula.

Definition at line 146 of file KeosLight.cpp.

Real Keos::CLight::GetAttenuationRange ( void   )  const

Returns the absolute upper range of the light.

Definition at line 156 of file KeosLight.cpp.

Referenced by Keos::CD3D9RenderSystem::SetLight().

Real Keos::CLight::GetAttenuationConstant ( void   )  const

Returns the constant factor in the attenuation formula.

Definition at line 162 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

Real Keos::CLight::GetAttenuationLinear ( void   )  const

Returns the linear factor in the attenuation formula.

Definition at line 168 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

Real Keos::CLight::GetAttenuationQuadric ( void   )  const

Returns the quadric factor in the attenuation formula.

Definition at line 174 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetSpotRange ( const CRadian innerAngle,
const CRadian outerAngle,
Real  falloff = 1.0 
)

Sets the range of a spotlight, i.e.

the angle of the inner and outer cones and the rate of falloff between them.

Parameters:
innerAngle Angle covered by the bright inner cone The inner cone applicable only to Direct3D, it'll always treat as zero in OpenGL.
outerAngle Angle covered by the outer cone
falloff The rate of falloff between the inner and outer cones. 1.0 means a linear falloff, less means slower falloff, higher means faster falloff.

Definition at line 180 of file KeosLight.cpp.

const CRadian & Keos::CLight::GetSpotInnerAngle ( void   )  const

Returns the angle covered by the spotlights inner cone.

Definition at line 206 of file KeosLight.cpp.

Referenced by Keos::CD3D9RenderSystem::SetLight().

const CRadian & Keos::CLight::GetSpotOuterAngle ( void   )  const

Returns the angle covered by the spotlights outer cone.

Definition at line 212 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

Real Keos::CLight::GetSpotFalloff ( void   )  const

Returns the falloff between the inner and outer cones of the spotlight.

Definition at line 218 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetSpotInnerAngle ( const CRadian val  ) 

Sets the angle covered by the spotlights inner cone.

Definition at line 188 of file KeosLight.cpp.

void Keos::CLight::SetSpotOuterAngle ( const CRadian val  ) 

Sets the angle covered by the spotlights outer cone.

Definition at line 194 of file KeosLight.cpp.

void Keos::CLight::SetSpotFalloff ( Real  val  ) 

Sets the falloff between the inner and outer cones of the spotlight.

Definition at line 200 of file KeosLight.cpp.

void Keos::CLight::SetPosition ( float  x,
float  y,
float  z 
)

Sets the position of the light.

Remarks:
Applicable to point lights and spotlights only.

Definition at line 70 of file KeosLight.cpp.

References Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

void Keos::CLight::SetPosition ( const TVector3F Vec  ) 

Sets the position of the light.

Remarks:
Applicable to point lights and spotlights only.

Definition at line 78 of file KeosLight.cpp.

const TVector3F & Keos::CLight::GetPosition ( void   )  const

Returns the position of the light.

Definition at line 84 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().

void Keos::CLight::SetDirection ( float  x,
float  y,
float  z 
)

Sets the direction in which a light points.

Remarks:
Applicable only to the spotlight and directional light types.

Definition at line 90 of file KeosLight.cpp.

References Keos::CVector3< T >::x, Keos::CVector3< T >::y, and Keos::CVector3< T >::z.

void Keos::CLight::SetDirection ( const TVector3F Vec  ) 

Sets the direction in which a light points.

Remarks:
Applicable only to the spotlight and directional light types.

Definition at line 98 of file KeosLight.cpp.

const TVector3F & Keos::CLight::GetDirection ( void   )  const

Returns the light's direction.

Definition at line 104 of file KeosLight.cpp.

Referenced by Keos::COGLRenderSystem::SetLight(), and Keos::CD3D9RenderSystem::SetLight().


The documentation for this class was generated from the following files:
Generated on Fri Mar 9 14:29:24 2007 for Keos by  doxygen 1.5.1-p1