TLight Class Reference

contains light preferences like color,position,shadow... More...

#include <light.h>

List of all members.

Public Member Functions

 TLight ()
 Make empty light: zero index, position at 0,0,0, without shadow.
 ~TLight ()
 Delete dynamic data.
 TLight (GLint lights, TVector amb, TVector diff, TVector spec, TVector lpos, float radius)
 Main constructor, directly create light from parameters.
void Move (TVector w)
 Move light to new absolute position.
void KeepPos ()
 Keep light position after camera transform.
void DrawLight (TMatrix &transformMatrix)
 Draws current light position.
void ChangeColor (GLint component, TVector color)
 Change light's component color.
void Set (GLint lights, TVector amb, TVector diff, TVector spec, TVector lpos, float radius)
 Set all light parameters.
void SetShadow (GLint shadow_size, GLfloat _shadow_intensity, bool shadow)
 Set light shadow.
void SetRadius (float value)
 set light radius
bool HasShadow ()
 Returns light shadow.
GLint ShadowSize ()
 return shadow map size
GLfloat ShadowIntensity ()
 return shadow intensity
string GetShadowCache ()
 Get shadow cache.
TVector GetPos ()
 Return light position.
GLint GetOrd ()
 Get light number.
float GetRadius ()
 Get light radius.

Public Attributes

GLuint fbo
 to calculate shadows, we need framebuffer for shadow map
TMatrix lightProjectionMatrix
 light projection matrix
TMatrix lightViewMatrix
 light view matrix
TMatrix cameraProjectionMatrix
 camera projection matrix
TMatrix cameraViewMatrix
 camer aview matrix
TMatrix biasMatrix
 shadow bias matrix
TMatrix textureMatrix
 shadow texture matrix

Detailed Description

contains light preferences like color,position,shadow...


Constructor & Destructor Documentation

TLight::~TLight (  ) 

Delete dynamic data.

delete framebuffer

TLight::TLight ( GLint  lights,
TVector  amb,
TVector  diff,
TVector  spec,
TVector  lpos,
float  radius 
) [inline]

Main constructor, directly create light from parameters.

Parameters:
lights light index
amb ambient light color
diff diffuse light color
spec specular light color
lpos vector with light position
radius light attenuation radius

Member Function Documentation

void TLight::ChangeColor ( GLint  component,
TVector  color 
)

Change light's component color.

Parameters:
component light color component (can be AMBIENT,DIFFUSE,SPECULAR)
color color (as RGB TVector)
void TLight::DrawLight ( TMatrix transformMatrix  ) 

Draws current light position.

Parameters:
transformMatrix current camera transformation matrix
string TLight::GetShadowCache (  ) 

Get shadow cache.

Returns:
unique shadow cache name for future use
void TLight::Set ( GLint  lights,
TVector  amb,
TVector  diff,
TVector  spec,
TVector  lpos,
float  _radius 
)

Set all light parameters.

Parameters:
lights light index in OpenGL
amb ambient color (RGB TVector)
diff diffuse color (RGB TVector)
spec specular color (RGB TVector)
lpos light position (XYZ TVector)
_radius light attenuation radius
void TLight::SetShadow ( GLint  _shadow_size,
GLfloat  _shadow_intensity,
bool  _shadow 
)

Set light shadow.

Parameters:
_shadow_size shadow map size (must be power of two)
_shadow_intensity mixing intensity (0 - transparent, 1 - opaque)
_shadow shadows on/off

Use bias matrix to normalize texture coords for shadow map


The documentation for this class was generated from the following files:

Generated by  doxygen 1.6.2