Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
icl::geom::SceneLight Class Reference

Wrapper class for OpenGL lights. More...

#include <SceneLight.h>

Inheritance diagram for icl::geom::SceneLight:
icl::utils::Uncopyable

List of all members.

Public Member Functions

 ~SceneLight ()
 Destructor.
SceneLightObjectgetLightObject ()
 returns the associated light object
const SceneLightObjectgetLightObject () const
 returns the associated light object (const)
void setObjectSize (float size)
 sets the light objects scaling (default is 1)
void setOn (bool on=true)
 globally switches the light on or off
void setAnchorToWorld ()
 sets that this camera's position is given relatively to the world
void setAnchor (SceneObject *sceneObject)
 sets an object, the light is liked to
void setCameraAnchor (int cameraIndex=-1)
 sets that this light's position is given relatively to a camera in the scene
void setPosition (const Vec &position)
 sets the light's position
void setAmbient (const GeomColor &color)
 sets the light's ambient color
void setDiffuse (const GeomColor &color)
 sets the light's diffuse color
void setSpecular (const GeomColor &color)
 sets the light's specular color
void setAmbientEnabled (bool on=true)
 sets whether the light's ambient component is enabled
void setDiffuseEnabled (bool on=true)
 sets whether the light's diffuse component is enabled
void setSpecularEnabled (bool on=true)
 sets whether the light's specular component is enabled
void setSpotDirection (const Vec &vec=Vec(0, 0,-1, 1))
 sets the spot direction of this light
void setSpotExponent (float value=0)
 sets the spot exponent of this light
void setSpotCutoff (float value=180)
 sets the spot cutoff of this light
void setAttenuation (float constant=1, float linear=0, float quadratic=0)
 sets the attenuation factors of this light
void setShadowEnabled (bool on=true)
 sets whether the light casts shadows or not
void setTwoSidedEnabled (bool on=true)
 sets whether the light casts two-sided light or not
bool isOn () const
 returns whether the light is activated
bool getShadowEnabled () const
 returns whether the light casts shadows or not
bool getTwoSidedEnabled () const
 returns whether the light casts two-sided light or not
const CameragetShadowCam () const
 returns the camera used for casting the shadows
CameragetShadowCam ()
 returns the camera used for casting the shadows
void setShadowCam (Camera *cam)
 changes the shadowcam to the provided camera
void reset ()
 sets all paramters to OpenGL's default values

Private Types

enum  Anchor { WorldAnchor, CamAnchor, ObjectAnchor }
 internally used anchor mode More...

Private Member Functions

void setupGL (const Scene &scene, const Camera &cam) const
 called by the scene
void updatePositions (const Scene &scene, const Camera &cam) const
 SceneLight (Scene *parent, int index)
 private constructor -> only Scene's can create lights
 SceneLight (const SceneLight &other)
 copies everything (overwrites uncopyable)

Private Attributes

const int index
 wrapped opengl light index
bool on
 flag that is used to swith off/on the light entirely
Vec position
 the light's position
bool ambientOn
 flag whether ambient light component is enabled
bool diffuseOn
 flag whether diffuse light component is enabled
bool specularOn
 flag whether specular light component is enabled
bool shadowOn
bool twoSidedOn
GeomColor ambient
 ambient light color
GeomColor diffuse
 diffuse light color
GeomColor specular
 specular light color
Vec spotDirection
 direction vector for directed light (0,0,-1) at default
float spotExponent
 defines the intensity distribution of the light
float spotCutoff
 defines the cutoff for spot-lights
Vec attenuation
 special factor for light attenuation
enum icl::geom::SceneLight::Anchor anchor
 current anchor mode
int camAnchor
 for camera anchor-mode
CamerashadowCam
 Shadow Camera for rendering ShadowMaps.
SceneObjectobjectAnchor
 for the object anchor mode
SceneLightObjectlightObject
 associated scene light Object

Friends

class Scene
 for tight integration with the Scene class

Detailed Description

Wrapper class for OpenGL lights.

The light is integrated with the scene and is used to define lights in scenes. Each light is associated with one of the eight lights provided by OpenGL.

Shadows

The class allows casting shadows, which can be enabled by using setShadowEnabled(). To change the direction of the shadow use getShadowCam() to get the shadow camera. Do not change the position of the camera since it will be back changed to the lights position every frame.


Member Enumeration Documentation

internally used anchor mode

Enumerator:
WorldAnchor 

light's position is relative to the world

CamAnchor 

light's position is relative to a camera

ObjectAnchor 

light's position is relative to an object


Constructor & Destructor Documentation

icl::geom::SceneLight::SceneLight ( Scene parent,
int  index 
) [private]

private constructor -> only Scene's can create lights

icl::geom::SceneLight::SceneLight ( const SceneLight other) [private]

copies everything (overwrites uncopyable)

Only accessible by friends, object anchor must be tackled manually

Destructor.


Member Function Documentation

returns the associated light object

returns the associated light object (const)

returns the camera used for casting the shadows

returns the camera used for casting the shadows

returns whether the light casts shadows or not

returns whether the light casts two-sided light or not

returns whether the light is activated

sets all paramters to OpenGL's default values

sets the light's ambient color

void icl::geom::SceneLight::setAmbientEnabled ( bool  on = true)

sets whether the light's ambient component is enabled

sets an object, the light is liked to

In this case, the light's position and spot- direction is given relatively to the given object.

sets that this camera's position is given relatively to the world

void icl::geom::SceneLight::setAttenuation ( float  constant = 1,
float  linear = 0,
float  quadratic = 0 
)

sets the attenuation factors of this light

void icl::geom::SceneLight::setCameraAnchor ( int  cameraIndex = -1)

sets that this light's position is given relatively to a camera in the scene

If the given cameraIndex is < 0, then the light is positioned relatively to the current rendering camera. This is default.

sets the light's diffuse color

void icl::geom::SceneLight::setDiffuseEnabled ( bool  on = true)

sets whether the light's diffuse component is enabled

sets the light objects scaling (default is 1)

void icl::geom::SceneLight::setOn ( bool  on = true)

globally switches the light on or off

At default: only light 0 is on

void icl::geom::SceneLight::setPosition ( const Vec position)

sets the light's position

How the position is interpreted depends on the current internal anchor mode. Please note, that the internal anchor mode cannot be set explicitly using a setAnchorMode method. Instead, the AnchorMode is always implicitly adapted when one of the methods

changes the shadowcam to the provided camera

void icl::geom::SceneLight::setShadowEnabled ( bool  on = true)

sets whether the light casts shadows or not

sets the light's specular color

sets whether the light's specular component is enabled

void icl::geom::SceneLight::setSpotCutoff ( float  value = 180)

sets the spot cutoff of this light

void icl::geom::SceneLight::setSpotDirection ( const Vec vec = Vec(0, 0,-1, 1))

sets the spot direction of this light

void icl::geom::SceneLight::setSpotExponent ( float  value = 0)

sets the spot exponent of this light

sets whether the light casts two-sided light or not

void icl::geom::SceneLight::setupGL ( const Scene scene,
const Camera cam 
) const [private]

called by the scene

This method is called by the scene and sets up the light in OpenGL by using the instances parameters

void icl::geom::SceneLight::updatePositions ( const Scene scene,
const Camera cam 
) const [private]

Friends And Related Function Documentation

friend class Scene [friend]

for tight integration with the Scene class


Member Data Documentation

ambient light color

flag whether ambient light component is enabled

current anchor mode

special factor for light attenuation

only positive values are allowed

for camera anchor-mode

diffuse light color

flag whether diffuse light component is enabled

const int icl::geom::SceneLight::index [private]

wrapped opengl light index

associated scene light Object

for the object anchor mode

bool icl::geom::SceneLight::on [private]

flag that is used to swith off/on the light entirely

the light's position

Shadow Camera for rendering ShadowMaps.

specular light color

flag whether specular light component is enabled

defines the cutoff for spot-lights

possible values are 0-90 and one special value 180 which is default and defines a uniform light distribution

direction vector for directed light (0,0,-1) at default

defines the intensity distribution of the light

possible values are 0-128


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