contains light preferences like color,position,shadow... More...
#include <light.h>
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 |
contains light preferences like color,position,shadow...
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.
lights | light index | |
amb | ambient light color | |
diff | diffuse light color | |
spec | specular light color | |
lpos | vector with light position | |
radius | light attenuation radius |
void TLight::ChangeColor | ( | GLint | component, | |
TVector | color | |||
) |
Change light's component color.
component | light color component (can be AMBIENT,DIFFUSE,SPECULAR) | |
color | color (as RGB TVector) |
void TLight::DrawLight | ( | TMatrix & | transformMatrix | ) |
Draws current light position.
transformMatrix | current camera transformation matrix |
string TLight::GetShadowCache | ( | ) |
Get shadow cache.
void TLight::SetShadow | ( | GLint | _shadow_size, | |
GLfloat | _shadow_intensity, | |||
bool | _shadow | |||
) |
Set light shadow.
_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