Image Component Library (ICL)
|
Wrapper class for OpenGL lights. More...
#include <SceneLight.h>
Public Member Functions | |
~SceneLight () | |
Destructor. More... | |
SceneLightObject * | getLightObject () |
returns the associated light object More... | |
const SceneLightObject * | getLightObject () const |
returns the associated light object (const) More... | |
void | setObjectSize (float size) |
sets the light objects scaling (default is 1) More... | |
void | setOn (bool on=true) |
globally switches the light on or off More... | |
void | setAnchorToWorld () |
sets that this camera's position is given relatively to the world More... | |
void | setAnchor (SceneObject *sceneObject) |
sets an object, the light is liked to More... | |
void | setCameraAnchor (int cameraIndex=-1) |
sets that this light's position is given relatively to a camera in the scene More... | |
void | setPosition (const Vec &position) |
sets the light's position More... | |
void | setAmbient (const GeomColor &color) |
sets the light's ambient color More... | |
void | setDiffuse (const GeomColor &color) |
sets the light's diffuse color More... | |
void | setSpecular (const GeomColor &color) |
sets the light's specular color More... | |
void | setAmbientEnabled (bool on=true) |
sets whether the light's ambient component is enabled More... | |
void | setDiffuseEnabled (bool on=true) |
sets whether the light's diffuse component is enabled More... | |
void | setSpecularEnabled (bool on=true) |
sets whether the light's specular component is enabled More... | |
void | setSpotDirection (const Vec &vec=Vec(0, 0,-1, 1)) |
sets the spot direction of this light More... | |
void | setSpotExponent (float value=0) |
sets the spot exponent of this light More... | |
void | setSpotCutoff (float value=180) |
sets the spot cutoff of this light More... | |
void | setAttenuation (float constant=1, float linear=0, float quadratic=0) |
sets the attenuation factors of this light More... | |
void | setShadowEnabled (bool on=true) |
sets whether the light casts shadows or not More... | |
void | setProjectionEnabled (bool on=true) |
sets whether the light projects a texture or not More... | |
void | setTwoSidedEnabled (bool on=true) |
sets whether the light casts two-sided light or not More... | |
bool | isOn () const |
returns whether the light is activated More... | |
bool | getShadowEnabled () const |
returns whether the light casts shadows or not More... | |
bool | getProjectionEnabled () const |
returns whether the light casts shadows or not More... | |
bool | getTwoSidedEnabled () const |
returns whether the light casts two-sided light or not More... | |
const Camera * | getShadowCam () const |
returns the camera used for casting the shadows More... | |
Camera * | getShadowCam () |
returns the camera used for casting the shadows More... | |
void | setShadowCam (Camera *cam) |
changes the shadowcam to the provided camera More... | |
void | setProjectionImage (qt::GLImg *img) |
set the projection image More... | |
qt::GLImg * | getProjectionImage () const |
get the projection image More... | |
void | reset () |
sets all paramters to OpenGL's default values More... | |
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 More... | |
void | updatePositions (const Scene &scene, const Camera &cam) const |
SceneLight (Scene *parent, int index) | |
private constructor -> only Scene's can create lights More... | |
SceneLight (const SceneLight &other) | |
copies everything (overwrites uncopyable) More... | |
Private Attributes | |
const int | index |
wrapped opengl light index More... | |
bool | on |
flag that is used to swith off/on the light entirely More... | |
Vec | position |
the light's position More... | |
bool | ambientOn |
flag whether ambient light component is enabled More... | |
bool | diffuseOn |
flag whether diffuse light component is enabled More... | |
bool | specularOn |
flag whether specular light component is enabled More... | |
bool | shadowOn |
bool | projectionOn |
bool | twoSidedOn |
GeomColor | ambient |
ambient light color More... | |
GeomColor | diffuse |
diffuse light color More... | |
GeomColor | specular |
specular light color More... | |
Vec | spotDirection |
direction vector for directed light (0,0,-1) at default More... | |
float | spotExponent |
defines the intensity distribution of the light More... | |
float | spotCutoff |
defines the cutoff for spot-lights More... | |
Vec | attenuation |
special factor for light attenuation More... | |
enum icl::geom::SceneLight::Anchor | anchor |
current anchor mode More... | |
int | camAnchor |
for camera anchor-mode More... | |
Camera * | shadowCam |
Shadow Camera for rendering ShadowMaps. More... | |
qt::GLImg * | projectionImage |
SceneObject * | objectAnchor |
for the object anchor mode More... | |
SceneLightObject * | lightObject |
associated scene light Object More... | |
Friends | |
class | Scene |
for tight integration with the Scene class More... | |
Additional Inherited Members | |
Protected Member Functions inherited from icl::utils::Uncopyable | |
Uncopyable () | |
Empty base constructor. More... | |
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.
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.
|
private |
|
private |
private constructor -> only Scene's can create lights
|
private |
copies everything (overwrites uncopyable)
Only accessible by friends, object anchor must be tackled manually
icl::geom::SceneLight::~SceneLight | ( | ) |
Destructor.
|
inline |
returns the associated light object
|
inline |
returns the associated light object (const)
bool icl::geom::SceneLight::getProjectionEnabled | ( | ) | const |
returns whether the light casts shadows or not
qt::GLImg* icl::geom::SceneLight::getProjectionImage | ( | ) | const |
get the projection image
const Camera* icl::geom::SceneLight::getShadowCam | ( | ) | const |
returns the camera used for casting the shadows
Camera* icl::geom::SceneLight::getShadowCam | ( | ) |
returns the camera used for casting the shadows
bool icl::geom::SceneLight::getShadowEnabled | ( | ) | const |
returns whether the light casts shadows or not
bool icl::geom::SceneLight::getTwoSidedEnabled | ( | ) | const |
returns whether the light casts two-sided light or not
bool icl::geom::SceneLight::isOn | ( | ) | const |
returns whether the light is activated
void icl::geom::SceneLight::reset | ( | ) |
sets all paramters to OpenGL's default values
void icl::geom::SceneLight::setAmbient | ( | const GeomColor & | color | ) |
sets the light's ambient color
void icl::geom::SceneLight::setAmbientEnabled | ( | bool | on = true | ) |
sets whether the light's ambient component is enabled
void icl::geom::SceneLight::setAnchor | ( | SceneObject * | sceneObject | ) |
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.
void icl::geom::SceneLight::setAnchorToWorld | ( | ) |
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.
void icl::geom::SceneLight::setDiffuse | ( | const GeomColor & | color | ) |
sets the light's diffuse color
void icl::geom::SceneLight::setDiffuseEnabled | ( | bool | on = true | ) |
sets whether the light's diffuse component is enabled
void icl::geom::SceneLight::setObjectSize | ( | float | size | ) |
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
void icl::geom::SceneLight::setProjectionEnabled | ( | bool | on = true | ) |
sets whether the light projects a texture or not
void icl::geom::SceneLight::setProjectionImage | ( | qt::GLImg * | img | ) |
set the projection image
void icl::geom::SceneLight::setShadowCam | ( | Camera * | cam | ) |
changes the shadowcam to the provided camera
void icl::geom::SceneLight::setShadowEnabled | ( | bool | on = true | ) |
sets whether the light casts shadows or not
void icl::geom::SceneLight::setSpecular | ( | const GeomColor & | color | ) |
sets the light's specular color
void icl::geom::SceneLight::setSpecularEnabled | ( | bool | on = true | ) |
sets whether the light's specular component is enabled
void icl::geom::SceneLight::setSpotCutoff | ( | float | value = 180 | ) |
sets the spot cutoff of this light
sets the spot direction of this light
void icl::geom::SceneLight::setSpotExponent | ( | float | value = 0 | ) |
sets the spot exponent of this light
void icl::geom::SceneLight::setTwoSidedEnabled | ( | bool | on = true | ) |
sets whether the light casts two-sided light or not
called by the scene
This method is called by the scene and sets up the light in OpenGL by using the instances parameters
|
private |
|
private |
ambient light color
|
private |
flag whether ambient light component is enabled
|
private |
current anchor mode
|
private |
special factor for light attenuation
only positive values are allowed
|
private |
for camera anchor-mode
|
private |
diffuse light color
|
private |
flag whether diffuse light component is enabled
|
private |
wrapped opengl light index
|
private |
associated scene light Object
|
private |
for the object anchor mode
|
private |
flag that is used to swith off/on the light entirely
|
private |
the light's position
|
private |
|
private |
|
private |
|
private |
specular light color
|
private |
flag whether specular light component is enabled
|
private |
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
|
private |
direction vector for directed light (0,0,-1) at default
|
private |
defines the intensity distribution of the light
possible values are 0-128
|
private |