Polycode
|
3D light source. More...
Inherits Polycode::SceneEntity.
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. |
3D light source.
Lights can be area or spot lights and can be set to different colors.
SceneLight::SceneLight | ( | int | type, |
Scene * | parentScene, | ||
Number | intensity, | ||
Number | constantAttenuation = 1 , |
||
Number | linearAttenuation = 1 , |
||
Number | quadraticAttenuation = 1 |
||
) |
Constructs a light with 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 |
void SceneLight::enableShadows | ( | bool | val, |
Number | resolution = 256 |
||
) |
If this is called with 'true', the light will generate a shadow map.
val | If set to true, enables this light to cast shadows. |
resolution | Resolution of the shadow map. (defaults to 256x256). |
void SceneLight::Render | ( | ) | [virtual] |
void SceneLight::setAttenuation | ( | Number | constantAttenuation, |
Number | linearAttenuation, | ||
Number | quadraticAttenuation | ||
) |
Sets the attenuation values for the light.
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.
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.
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.
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.
fov | New field of view value. |
void Polycode::SceneLight::setSpecularLightColor | ( | Number | r, |
Number | g, | ||
Number | b, | ||
Number | a | ||
) | [inline] |
Sets the light color.
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.
spotlightExponent | Spotlight exponent size |
spotlightCutoff | Spotlight furstrum cutoff. |