#include <spSceneLight.hpp>
Public Member Functions | |
Light (const ELightModels Type=LIGHT_DIRECTIONAL) | |
virtual | ~Light () |
void | setLightingColor (const video::color &Diffuse, const video::color &Ambient=255, const video::color &Specular=0) |
void | getLightingColor (video::color &Diffuse, video::color &Ambient, video::color &Specular) const |
void | setSpotCone (const f32 InnerConeAngle, const f32 OuterConeAngle) |
void | getSpotCone (f32 &InnerConeAngle, f32 &OuterConeAngle) const |
void | setSpotConeInner (f32 Angle) |
void | setSpotConeOuter (f32 Angle) |
bool | getSpotFrustum (scene::ViewFrustum &Frustum, dim::vector3df &GlobalPosition) const |
void | setVolumetric (bool isVolumetric) |
void | setVolumetricRadius (f32 Radius) |
f32 | getVolumetricRadius () const |
void | setVolumetricRange (f32 Constant, f32 Linear, f32 Quadratic) |
void | getVolumetricRange (f32 &Constant, f32 &Linear, f32 &Quadratic) const |
void | setDirection (const dim::vector3df &Direction) |
Sets the light's direction. Only usable for Directional or Spot lights. | |
void | setDirection (const dim::matrix4f &Matrix) |
void | setVisible (bool isVisible) |
Enables or disables the light. | |
Light * | copy () const |
Copies the light objects and returns the pointer to the new instance. Don't forget to delete this object! | |
virtual void | render () |
void | setLightModel (const ELightModels Type) |
Sets the light shading model. | |
ELightModels | getLightModel () const |
Returns the light shading model. | |
void | setDiffuseColor (const video::color &Color) |
Sets the diffuse light color. | |
video::color | getDiffuseColor () const |
Returns the diffuse light color. | |
void | setAmbientColor (const video::color &Color) |
Sets the ambient light color. | |
video::color | getAmbientColor () const |
Returns the ambient light color. | |
void | setSpecularColor (const video::color &Color) |
Sets the specular light color. | |
video::color | getSpecularColor () const |
Returns the specular light color. | |
f32 | getSpotConeInner () const |
Returns the inner spot cone angle (in degrees). | |
f32 | getSpotConeOuter () const |
Returns the outer spot cone angle (in degrees). | |
bool | getVolumetric () const |
void | setShadow (bool Enable) |
bool | getShadow () const |
dim::vector3df | getDirection () const |
Returns the light's direction. This is only used for spot- and directional lights (LIGHT_SPOT, LIGHT_DIRECTIONAL). | |
dim::matrix4f | getProjectionMatrix () const |
Returns the projection matrix. This is only used for spot-lights (LIGHT_SPOT). | |
Static Public Member Functions | |
static void | setRCUsage (bool UseAllRCs) |
Protected Attributes | |
u32 | LightID_ |
Renderer ID number for this light. | |
ELightModels | LightModel_ |
Lighting model: Directional, Point, Spot. | |
dim::vector3df | Direction_ |
Spot- and directional light direction. | |
f32 | SpotInnerConeAngle_ |
Inner cone angle for spot lights. | |
f32 | SpotOuterConeAngle_ |
Outer cone angle for spot lights. | |
dim::matrix4f | ProjectionMatrix_ |
bool | isVolumetric_ |
bool | hasShadow_ |
f32 | AttenuationConstant_ |
f32 | AttenuationLinear_ |
f32 | AttenuationQuadratic_ |
video::color | DiffuseColor_ |
video::color | AmbientColor_ |
video::color | SpecularColor_ |
Static Protected Attributes | |
static const f32 | DEF_SPOTANGLE_INNER = 30.0f |
static const f32 | DEF_SPOTANGLE_OUTER = 60.0f |
Friends | |
class | SceneGraph |
Lights can be created for dynamic lighting and shading technics. But you will only see a maximum of 8 lights because more are not supported by the current graphics cards! But you can create much more then 8. But be aware of that you will only see 8 of them ;-). The engine is able to manage the lighting system good enough that these ones who are near by the camera will be visible. Directional lights (scene::LIGHT_DIRECTIONAL) have a priority in this sort process because they are never volumetric but endless visible.
sp::scene::Light::Light | ( | const ELightModels | Type = LIGHT_DIRECTIONAL |
) |
sp::scene::Light::~Light | ( | ) | [virtual] |
Light * sp::scene::Light::copy | ( | ) | const |
Copies the light objects and returns the pointer to the new instance. Don't forget to delete this object!
Reimplemented from sp::scene::SceneNode.
video::color sp::scene::Light::getAmbientColor | ( | ) | const [inline] |
Returns the ambient light color.
video::color sp::scene::Light::getDiffuseColor | ( | ) | const [inline] |
Returns the diffuse light color.
dim::vector3df sp::scene::Light::getDirection | ( | ) | const [inline] |
Returns the light's direction. This is only used for spot- and directional lights (LIGHT_SPOT, LIGHT_DIRECTIONAL).
void sp::scene::Light::getLightingColor | ( | video::color & | Diffuse, | |
video::color & | Ambient, | |||
video::color & | Specular | |||
) | const |
ELightModels sp::scene::Light::getLightModel | ( | ) | const [inline] |
Returns the light shading model.
dim::matrix4f sp::scene::Light::getProjectionMatrix | ( | ) | const [inline] |
Returns the projection matrix. This is only used for spot-lights (LIGHT_SPOT).
bool sp::scene::Light::getShadow | ( | ) | const [inline] |
Returns true if shadow mapping is enabled.
video::color sp::scene::Light::getSpecularColor | ( | ) | const [inline] |
Returns the specular light color.
f32 sp::scene::Light::getSpotConeInner | ( | ) | const [inline] |
Returns the inner spot cone angle (in degrees).
f32 sp::scene::Light::getSpotConeOuter | ( | ) | const [inline] |
Returns the outer spot cone angle (in degrees).
bool sp::scene::Light::getSpotFrustum | ( | scene::ViewFrustum & | Frustum, | |
dim::vector3df & | GlobalPosition | |||
) | const |
Returns a view frustum if this is a spot light.
[out] | Frustum | Specifies the resulting view frustum. Although the spot light is actual a cone, the resulting model is a frustum which can be used to render a shadow map from the light's point of view. |
[out] | GlobalPosition | Specifies the global position which can be computed on the fly. This can be used for frustum/frustum culling tests. |
bool sp::scene::Light::getVolumetric | ( | ) | const [inline] |
f32 sp::scene::Light::getVolumetricRadius | ( | ) | const |
void sp::scene::Light::render | ( | ) | [virtual] |
Updates the light. This function is called in the "renderScene" function of the SceneManager class. You do not have to call this function.
void sp::scene::Light::setAmbientColor | ( | const video::color & | Color | ) | [inline] |
Sets the ambient light color.
void sp::scene::Light::setDiffuseColor | ( | const video::color & | Color | ) | [inline] |
Sets the diffuse light color.
void sp::scene::Light::setDirection | ( | const dim::matrix4f & | Matrix | ) |
void sp::scene::Light::setDirection | ( | const dim::vector3df & | Direction | ) |
Sets the light's direction. Only usable for Directional or Spot lights.
void sp::scene::Light::setLightingColor | ( | const video::color & | Diffuse, | |
const video::color & | Ambient = 255 , |
|||
const video::color & | Specular = 0 | |||
) |
Sets the light's colors.
Diffuse,: | Diffuse color. This is the 'main' lighting color which is multiplied by each vertex's color. | |
Ambient,: | Ambient color. This is the darkest color. Also if the color is full bright it will not let the object be complete white. | |
Specular,: | Specular color. If this color is not bright enough each shininess value for the Entity objects will not cause any shine. |
void sp::scene::Light::setLightModel | ( | const ELightModels | Type | ) | [inline] |
Sets the light shading model.
void sp::scene::Light::setRCUsage | ( | bool | UseAllRCs | ) | [static] |
Sets the render-context usage for fixed-function light sources.
[in] | UseAllRCs | Specifies whether all render-contexts are to be used or only the active one. By default all render contexts are affected. |
void sp::scene::Light::setShadow | ( | bool | Enable | ) | [inline] |
Enables or disables shadow mapping.
Enable,: | Specifies if shadow mapping is to be enabled or disabled. By default false. |
void sp::scene::Light::setSpecularColor | ( | const video::color & | Color | ) | [inline] |
Sets the specular light color.
Sets the spot light cone ranges. A spot light is formed like a cone or better two cones where the inner coner angle has to be smaller then the outer.
InnterConeAngle,: | Angle of the inner spot-light's cone. | |
OutterConeAngle,: | Angle of the outer spot-light's cone. |
void sp::scene::Light::setSpotConeInner | ( | f32 | Angle | ) |
void sp::scene::Light::setSpotConeOuter | ( | f32 | Angle | ) |
void sp::scene::Light::setVisible | ( | bool | isVisible | ) | [virtual] |
Enables or disables the light.
Reimplemented from sp::Node.
void sp::scene::Light::setVolumetric | ( | bool | isVolumetric | ) |
Enables or disables the volumetric technic for lighting. This technic is only usable when the light is a Point or a Spot light. Three parameters called "Attenuation" are used for this computation.
void sp::scene::Light::setVolumetricRadius | ( | f32 | Radius | ) |
Sets the volumetric radius. This function computes the threee attenuation parameters automatically by only one value: the Radius.
Sets the volumetric range or the three attenuation values. Here you have to compute your own attenuations.
friend class SceneGraph [friend] |
video::color sp::scene::Light::AmbientColor_ [protected] |
f32 sp::scene::Light::AttenuationConstant_ [protected] |
f32 sp::scene::Light::AttenuationLinear_ [protected] |
f32 sp::scene::Light::AttenuationQuadratic_ [protected] |
const f32 sp::scene::Light::DEF_SPOTANGLE_INNER = 30.0f [static, protected] |
const f32 sp::scene::Light::DEF_SPOTANGLE_OUTER = 60.0f [static, protected] |
video::color sp::scene::Light::DiffuseColor_ [protected] |
dim::vector3df sp::scene::Light::Direction_ [protected] |
Spot- and directional light direction.
bool sp::scene::Light::hasShadow_ [protected] |
bool sp::scene::Light::isVolumetric_ [protected] |
u32 sp::scene::Light::LightID_ [protected] |
Renderer ID number for this light.
ELightModels sp::scene::Light::LightModel_ [protected] |
Lighting model: Directional, Point, Spot.
dim::matrix4f sp::scene::Light::ProjectionMatrix_ [protected] |
video::color sp::scene::Light::SpecularColor_ [protected] |
f32 sp::scene::Light::SpotInnerConeAngle_ [protected] |
Inner cone angle for spot lights.
f32 sp::scene::Light::SpotOuterConeAngle_ [protected] |
Outer cone angle for spot lights.