Developer Documentation

Public Member Functions | Protected Attributes | Friends | List of all members
ACG::SceneGraph::LightSource Class Reference

Structure to hold options for one LightSource. More...

`#include <Type-Light/ObjectTypes/Light/LightNode.hh>`

## Public Member Functions
| LightSource ()
| Default Constructor.
void | position (Vec3d _pos)
| Set position for LightSource. More...
Vec3d | position () const
| Get the position of the LightSource. More...
bool | directional () const
| Check if the light source is a directional light source. More...
Vec3d | direction () const
| Get direction of the light source. More...
void | direction (Vec3d _pos)
| Set the direction of the light source. More...
void | enable ()
| enable LightSource
void | disable ()
| disable LightSource
bool | enabled () const
| Get light source status.
void | spotDirection (Vec3d _pos)
| Set spot direction. More...
Vec3d | spotDirection () const
| get spot direction More...
void | ambientColor (Vec4f _color)
| set Ambient color for LightSource
Vec4f | ambientColor () const
| get Ambient color for LightSource
void | diffuseColor (Vec4f _color)
| set Diffuse color for LightSource
Vec4f | diffuseColor () const
| get Diffuse color for LightSource
void | specularColor (Vec4f _color)
| set Specular color for LightSource
Vec4f | specularColor () const
| get Specular color for LightSource
void | setColor (const Vec4f &_ambient, const Vec4f &_diffuse, const Vec4f &_specular)
void | fixedPosition (bool _state)
| make LightSource fixed or moveable with ModelViewMatrix
bool | fixedPosition () const
void | spotExponent (float _exponent)
float | spotExponent () const
void | spotCutoff (float _cutoff)
float | spotCutoff () const
void | constantAttenuation (float _constantAttenuation)
float | constantAttenuation () const
void | linearAttenuation (float _linearAttenuation)
float | linearAttenuation () const
void | quadraticAttenuation (float _quadraticAttenuation)
float | quadraticAttenuation () const
void | brightness (const float _brightness)
float | brightness () const
float | radius () const
| Get light source radius. More...
void | radius (const float _radius)
| Set light source radius. More...

## Protected Attributes
Vec4f | position_
Vec4f | realPosition_
bool | enabled_
bool | fixedPosition_
Vec4f | ambientColor_
Vec4f | diffuseColor_
Vec4f | specularColor_
Vec3d | spotDirection_
Vec3d | realSpotDirection_
Vec4f | initialPosition_
Vec3d | initialSpotDirection_
bool | initialPositionInit_
float | spotExponent_
float | spotCutoff_
float | constantAttenuation_
float | linearAttenuation_
float | quadraticAttenuation_
float | brightness_
float | radius_

## Friends
class | LightNode
| Simple Name for PlaneNode.

## Detailed Description

Structure to hold options for one LightSource.

Definition at line 85 of file LightNode.hh.

## Member Function Documentation

## ◆ direction() [1/2]

Vec3d ACG::SceneGraph::LightSource::direction | ( |  | ) | const

Get direction of the light source.

Get direction of light.

Definition at line 123 of file LightNode.cc.

## ◆ direction() [2/2]

void ACG::SceneGraph::LightSource::direction | ( | Vec3d | _pos | ) |

Set the direction of the light source.

This function creates a directional light source. The position is not used by OpenGL. Internally the positions homogeneous coordinate is set to 0.0.

Definition at line 117 of file LightNode.cc.

## ◆ directional()

bool ACG::SceneGraph::LightSource::directional | ( |  | ) | const

Check if the light source is a directional light source.

If this light Source is a directional light source the function will return true. Otherwise false as the light source has a position.

Definition at line 127 of file LightNode.cc.

## ◆ position() [1/2]

void ACG::SceneGraph::LightSource::position | ( | Vec3d | _pos | ) |

Set position for LightSource.

This function sets the position of a light source. OpenGL handles a position for a light source if the homogeneous coordinate is 1.0. If it is 0.0 the light source will be directional. So a 1.0 is set in this function to get a positioned light source.

Definition at line 108 of file LightNode.cc.

## ◆ position() [2/2]

Vec3d ACG::SceneGraph::LightSource::position | ( |  | ) | const

Get the position of the LightSource.

Be careful with this function. Check if the light source is not directional with the directional() function

Definition at line 113 of file LightNode.cc.

## ◆ radius() [1/2]

float ACG::SceneGraph::LightSource::radius | ( |  | ) | const
| inline

Get light source radius.

The light radius is the size of the lightsource. In OpenGL rendering this value is ignored. You can use it for example in raytracers to implement soft shadows.

Definition at line 206 of file LightNode.hh.

## ◆ radius() [2/2]

void ACG::SceneGraph::LightSource::radius | ( | const float | _radius | ) |
| inline

Set light source radius.

The light radius is the size of the lightsource. In OpenGL rendering this value is ignored. You can use it for example in raytracers to implement soft shadows.

Definition at line 213 of file LightNode.hh.

## ◆ spotDirection() [1/2]

void ACG::SceneGraph::LightSource::spotDirection | ( | Vec3d | _pos | ) |

Set spot direction.

Todo:
  Improve documentation

Definition at line 141 of file LightNode.cc.

## ◆ spotDirection() [2/2]

Vec3d ACG::SceneGraph::LightSource::spotDirection | ( |  | ) | const

get spot direction

Todo:
  Improve documentation

Definition at line 144 of file LightNode.cc.

## Member Data Documentation

## ◆ radius_

float ACG::SceneGraph::LightSource::radius_
| protected

When using ray tracing, light sources can have extent. We simplify to spherical light sources with radius radius_.

Definition at line 245 of file LightNode.hh.

The documentation for this class was generated from the following files:

- Type-Light/ObjectTypes/Light/LightNode.hh
- Type-Light/ObjectTypes/Light/LightNode.cc