Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Friends

sp::scene::Light Class Reference

#include <spSceneLight.hpp>

Inheritance diagram for sp::scene::Light:
sp::scene::SceneNode sp::Node sp::BaseObject

List of all members.

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.
Lightcopy () 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

Detailed Description

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.


Constructor & Destructor Documentation

sp::scene::Light::Light ( const ELightModels  Type = LIGHT_DIRECTIONAL  ) 
sp::scene::Light::~Light (  )  [virtual]

Member Function Documentation

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.

Note:
This can only be used in combination with the integrated deferred-renderer.
See also:
video::DeferredRenderer
video::color sp::scene::Light::getSpecularColor (  )  const [inline]

Returns the specular light color.

void sp::scene::Light::getSpotCone ( f32 InnerConeAngle,
f32 OuterConeAngle 
) const
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.

Parameters:
[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.
Returns:
True if the frustum could be computed. This requires that this light is a spot light. Otherwise false.
bool sp::scene::Light::getVolumetric (  )  const [inline]
f32 sp::scene::Light::getVolumetricRadius (  )  const
void sp::scene::Light::getVolumetricRange ( f32 Constant,
f32 Linear,
f32 Quadratic 
) 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.

Parameters:
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.

Parameters:
[in] UseAllRCs Specifies whether all render-contexts are to be used or only the active one. By default all render contexts are affected.
Note:
Disable this state when you change light states (color, visiblity etc.) every frame and you have several render contexts!
void sp::scene::Light::setShadow ( bool  Enable  )  [inline]

Enables or disables shadow mapping.

Parameters:
Enable,: Specifies if shadow mapping is to be enabled or disabled. By default false.
Note:
This can only be used in combination with the integrated deferred-renderer.
See also:
video::DeferredRenderer
void sp::scene::Light::setSpecularColor ( const video::color Color  )  [inline]

Sets the specular light color.

void sp::scene::Light::setSpotCone ( const f32  InnerConeAngle,
const f32  OuterConeAngle 
)

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.

Parameters:
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.

void sp::scene::Light::setVolumetricRange ( f32  Constant,
f32  Linear,
f32  Quadratic 
)

Sets the volumetric range or the three attenuation values. Here you have to compute your own attenuations.


Friends And Related Function Documentation

friend class SceneGraph [friend]

Member Data Documentation

const f32 sp::scene::Light::DEF_SPOTANGLE_INNER = 30.0f [static, protected]
const f32 sp::scene::Light::DEF_SPOTANGLE_OUTER = 60.0f [static, protected]

Spot- and directional light direction.

bool sp::scene::Light::hasShadow_ [protected]

Renderer ID number for this light.

Lighting model: Directional, Point, Spot.

Inner cone angle for spot lights.

Outer cone angle for spot lights.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines