Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Materials::Light Class Reference

Lightsource. More...

#include <Light.h>

Inheritance diagram for Teddy::Materials::Light:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Materials::Light:

Collaboration graph
[legend]
List of all members.

Public Methods

 Light (const std::string &name)
 Default constructor for light with name only. More...

void setType (const unsigned long type)
void setAmbient (const Teddy::Graphics::Color &a)
void setDiffuse (const Teddy::Graphics::Color &d)
void setSpecular (const Teddy::Graphics::Color &s)
void setAttenuation (const float constant, const float linear, const float quadratic)
void setSpotCutOff (const float cutoff_angle)
void setSpotExponent (const float exponent)
void setSpotDirection (Teddy::Maths::Vector spot_direction)
void enable ()
 Enable individual light. More...

void disable ()
 Disable individual light. More...

virtual void applyLight (Teddy::PhysicalComponents::Projection *p)
 Apply light. More...

void orbit (float radius, float speed, int axis)

Static Public Attributes

const unsigned long TYPE_DIRECTIONAL = 0
const unsigned long TYPE_POSITIONAL = 1

Protected Attributes

unsigned long type
int id
Teddy::Graphics::Color ambient
Teddy::Graphics::Color diffuse
Teddy::Graphics::Color specular
unsigned int flags
float constant_attenuation
float linear_attenuation
float quadratic_attenuation
float spot_cutoff_angle
float spot_exponent
Teddy::Maths::TVector< float > spot_direction
bool orbit_active
float orbit_radius
float orbit_speed
int orbit_axis

Static Protected Attributes

unsigned int light_id [8] = { GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7 }
 Reservation status for OpenGL lights. More...

int light_status [8] = { 0, 0, 0, 0, 0, 0, 0, 0 }

Detailed Description

Lightsource.

Warning:
Very incomplete
Bug:
Poor id and enable/disable management

Todo:
Destructors

Lights are used to lit objects in Scene. At the moment this class implements a simple OpenGL light wrapper with minimum featurs.

Light is positional by default unless set to directional by setType

Definition at line 58 of file Light.h.


Constructor & Destructor Documentation

Teddy::Materials::Light::Light const std::string &    name
 

Default constructor for light with name only.

Definition at line 60 of file Light.cpp.

References ambient, diffuse, id, light_id, light_status, orbit_active, specular, and type.


Member Function Documentation

void Teddy::Materials::Light::applyLight Teddy::PhysicalComponents::Projection   p [virtual]
 

Apply light.

Definition at line 165 of file Light.cpp.

References ambient, diffuse, Teddy::Models::Model::getAttitude, Teddy::Models::Model::getPosition, Teddy::Maths::Quaternion::getViewAxis, id, light_id, Teddy::Graphics::Color::rgba, specular, spot_direction, type, and Vector.

void Teddy::Materials::Light::disable  
 

Disable individual light.

Definition at line 157 of file Light.cpp.

References id, and light_id.

void Teddy::Materials::Light::enable  
 

Enable individual light.

Definition at line 149 of file Light.cpp.

References id, and light_id.

Referenced by Teddy::Imports::LWLight::genLight.

void Teddy::Materials::Light::orbit float    radius,
float    speed,
int    axis
 

Definition at line 121 of file Light.cpp.

References orbit_active, orbit_axis, orbit_radius, and orbit_speed.

void Teddy::Materials::Light::setAmbient const Teddy::Graphics::Color   a
 

Referenced by Teddy::Imports::LWLight::genLight.

void Teddy::Materials::Light::setAttenuation const float    constant,
const float    linear,
const float    quadratic
 

Definition at line 92 of file Light.cpp.

References constant_attenuation, id, light_id, linear_attenuation, and quadratic_attenuation.

void Teddy::Materials::Light::setDiffuse const Teddy::Graphics::Color   d
 

Referenced by Teddy::Imports::LWLight::genLight.

void Teddy::Materials::Light::setSpecular const Teddy::Graphics::Color   s
 

Referenced by Teddy::Imports::LWLight::genLight.

void Teddy::Materials::Light::setSpotCutOff const float    cutoff_angle
 

Definition at line 104 of file Light.cpp.

References id, light_id, and spot_cutoff_angle.

void Teddy::Materials::Light::setSpotDirection Teddy::Maths::Vector    spot_direction
 

Definition at line 116 of file Light.cpp.

References spot_direction, and Vector.

void Teddy::Materials::Light::setSpotExponent const float    exponent
 

Definition at line 111 of file Light.cpp.

References id, light_id, and spot_exponent.

void Teddy::Materials::Light::setType const unsigned long    type
 

Definition at line 55 of file Light.cpp.

References type.

Referenced by Teddy::Imports::LWLight::genLight.


Member Data Documentation

Teddy::Graphics::Color Teddy::Materials::Light::ambient [protected]
 

Definition at line 83 of file Light.h.

Referenced by applyLight, and Light.

float Teddy::Materials::Light::constant_attenuation [protected]
 

Definition at line 88 of file Light.h.

Referenced by setAttenuation.

Teddy::Graphics::Color Teddy::Materials::Light::diffuse [protected]
 

Definition at line 84 of file Light.h.

Referenced by applyLight, and Light.

unsigned int Teddy::Materials::Light::flags [protected]
 

Definition at line 86 of file Light.h.

int Teddy::Materials::Light::id [protected]
 

Definition at line 82 of file Light.h.

Referenced by applyLight, disable, enable, Light, setAttenuation, setSpotCutOff, and setSpotExponent.

unsigned int Teddy::Materials::Light::light_id = { GL_LIGHT0, GL_LIGHT1, GL_LIGHT2, GL_LIGHT3, GL_LIGHT4, GL_LIGHT5, GL_LIGHT6, GL_LIGHT7 } [static, protected]
 

Reservation status for OpenGL lights.

Bug:
This really needs a lot of fixing.

Definition at line 48 of file Light.cpp.

Referenced by applyLight, disable, enable, Light, setAttenuation, setSpotCutOff, and setSpotExponent.

int Teddy::Materials::Light::light_status = { 0, 0, 0, 0, 0, 0, 0, 0 } [static, protected]
 

Definition at line 49 of file Light.cpp.

Referenced by Light.

float Teddy::Materials::Light::linear_attenuation [protected]
 

Definition at line 89 of file Light.h.

Referenced by setAttenuation.

bool Teddy::Materials::Light::orbit_active [protected]
 

Definition at line 95 of file Light.h.

Referenced by Light, and orbit.

int Teddy::Materials::Light::orbit_axis [protected]
 

Definition at line 98 of file Light.h.

Referenced by orbit.

float Teddy::Materials::Light::orbit_radius [protected]
 

Definition at line 96 of file Light.h.

Referenced by orbit.

float Teddy::Materials::Light::orbit_speed [protected]
 

Definition at line 97 of file Light.h.

Referenced by orbit.

float Teddy::Materials::Light::quadratic_attenuation [protected]
 

Definition at line 90 of file Light.h.

Referenced by setAttenuation.

Teddy::Graphics::Color Teddy::Materials::Light::specular [protected]
 

Definition at line 85 of file Light.h.

Referenced by applyLight, and Light.

float Teddy::Materials::Light::spot_cutoff_angle [protected]
 

Definition at line 91 of file Light.h.

Referenced by setSpotCutOff.

Teddy::Maths::TVector<float> Teddy::Materials::Light::spot_direction [protected]
 

Definition at line 93 of file Light.h.

Referenced by applyLight, and setSpotDirection.

float Teddy::Materials::Light::spot_exponent [protected]
 

Definition at line 92 of file Light.h.

Referenced by setSpotExponent.

unsigned long Teddy::Materials::Light::type [protected]
 

Definition at line 81 of file Light.h.

Referenced by applyLight, Light, and setType.

const unsigned long Teddy::Materials::Light::TYPE_DIRECTIONAL = 0 [static]
 

Definition at line 51 of file Light.cpp.

const unsigned long Teddy::Materials::Light::TYPE_POSITIONAL = 1 [static]
 

Definition at line 52 of file Light.cpp.


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