Polycode::SceneLight Class Reference
3D light source.
More...
Inherits Polycode::SceneEntity.
List of all members.
Public Member Functions |
| SceneLight (int type, Scene *parentScene, Number intensity, Number constantAttenuation=1, Number linearAttenuation=1, Number quadraticAttenuation=1) |
| Constructs a light with parameters.
|
void | setIntensity (Number newIntensity) |
| Sets the light's intensity.
|
void | setAttenuation (Number constantAttenuation, Number linearAttenuation, Number quadraticAttenuation) |
| Sets the attenuation values for the light.
|
void | Render () |
| Main render method.
|
void | setSpecularLightColor (Number r, Number g, Number b, Number a) |
| Sets the light color.
|
void | setDiffuseLightColor (Number r, Number g, Number b) |
| Sets the light color.
|
void | setLightColor (Number r, Number g, Number b, Number a=1.0) |
| Sets both the specular and diffust light colors.
|
void | setSpotlightProperties (Number spotlightCutoff, Number spotlightExponent) |
| Sets the spotlight properties.
|
void | enableShadows (bool val, Number resolution=256) |
| If this is called with 'true', the light will generate a shadow map.
|
void | setShadowMapFOV (Number fov) |
| This sets the shadow map field of view.
|
bool | areShadowsEnabled () const |
| Returns true if shadows are enabled.
|
int | getLightType () const |
| Returns the light type.
|
void | enableDebugDraw (bool val) |
| If set to true, draws a wireframe primitive visualizing the light.
|
Public Attributes |
Color | specularLightColor |
| Color of the light.
|
Color | lightColor |
| Color of the light.
|
Detailed Description
3D light source.
Lights can be area or spot lights and can be set to different colors.
Constructor & Destructor Documentation
SceneLight::SceneLight |
( |
int |
type, |
|
|
Scene * |
parentScene, |
|
|
Number |
intensity, |
|
|
Number |
constantAttenuation = 1 , |
|
|
Number |
linearAttenuation = 1 , |
|
|
Number |
quadraticAttenuation = 1 | |
|
) |
| | |
Constructs a light with parameters.
- Parameters:
-
| type | Type of light to create. Can be SceneLight::AREA_LIGHT or SceneLight::SPOT_LIGHT |
| parentScene | Scene to light. |
| intensity | Light color intensity |
| constantAttenuation | Constant falloff attenuation value |
| linearAttenuation | Linear falloff attenuation value |
| quadraticAttenuation | Quadratic falloff attenuation value |
Member Function Documentation
void SceneLight::enableShadows |
( |
bool |
val, |
|
|
Number |
resolution = 256 | |
|
) |
| | |
If this is called with 'true', the light will generate a shadow map.
- Parameters:
-
| val | If set to true, enables this light to cast shadows. |
| resolution | Resolution of the shadow map. (defaults to 256x256). |
void SceneLight::Render |
( |
|
) |
[virtual] |
Main render method.
Override this to do your own drawing.
Reimplemented from Polycode::Entity.
void SceneLight::setAttenuation |
( |
Number |
constantAttenuation, |
|
|
Number |
linearAttenuation, |
|
|
Number |
quadraticAttenuation | |
|
) |
| | |
Sets the attenuation values for the light.
- Parameters:
-
| constantAttenuation | Constant falloff attenuation value |
| linearAttenuation | Linear falloff attenuation value |
| quadraticAttenuation | Quadratic falloff attenuation value |
void Polycode::SceneLight::setDiffuseLightColor |
( |
Number |
r, |
|
|
Number |
g, |
|
|
Number |
b | |
|
) |
| | [inline] |
Sets the light color.
- Parameters:
-
| r | Red value 0-1. |
| g | Green value 0-1 |
| b | Blue value 0-1 |
| a | Alpha value 0-1 |
void SceneLight::setIntensity |
( |
Number |
newIntensity |
) |
|
Sets the light's intensity.
- Parameters:
-
| newIntensity | New intensity value. |
void Polycode::SceneLight::setLightColor |
( |
Number |
r, |
|
|
Number |
g, |
|
|
Number |
b, |
|
|
Number |
a = 1.0 | |
|
) |
| | [inline] |
Sets both the specular and diffust light colors.
Use setDiffuseLightColor and setSpecularLightColor to set the individual light colors.
- Parameters:
-
| r | Red value 0-1. |
| g | Green value 0-1 |
| b | Blue value 0-1 |
| a | Alpha value 0-1 |
void SceneLight::setShadowMapFOV |
( |
Number |
fov |
) |
|
This sets the shadow map field of view.
The larger the field of view, the more of the scene it encompasses, but the more quality it loses.
- Parameters:
-
| fov | New field of view value. |
void Polycode::SceneLight::setSpecularLightColor |
( |
Number |
r, |
|
|
Number |
g, |
|
|
Number |
b, |
|
|
Number |
a | |
|
) |
| | [inline] |
Sets the light color.
- Parameters:
-
| r | Red value 0-1. |
| g | Green value 0-1 |
| b | Blue value 0-1 |
| a | Alpha value 0-1 |
void Polycode::SceneLight::setSpotlightProperties |
( |
Number |
spotlightCutoff, |
|
|
Number |
spotlightExponent | |
|
) |
| | [inline] |
Sets the spotlight properties.
These control the shape of the spotlight beam.
- Parameters:
-
| spotlightExponent | Spotlight exponent size |
| spotlightCutoff | Spotlight furstrum cutoff. |