CGFLib - A library for Computer Graphics @ FEUP
 All Classes Files Functions Variables Pages
Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
CGFlight Class Reference

The light class is used to initialise, store information and generally handle an OpenGL GLlight. It may also draw a sphere to represent the light on the 3D scene. More...

#include <CGFlight.h>

Inheritance diagram for CGFlight:
CGFobject

Public Member Functions

 CGFlight (unsigned int lightid, float *pos, float *dir=NULL)
 Constructor. Receives an OpenGL light id GL_LIGHT_n, a position in 4-float vector and an optional direction, both as defined in OpenGL's glLightfv() documentation.
 
virtual ~CGFlight ()
 Base destructor.
 
void draw ()
 Draws a visible representation of the light (a sphere). It forces an update() of the light.
 
void update ()
 Updates the position and direction of the corresponding OpenGL's light. Has to be called after any camera transformations, so that the light is transformed in the proper referential.
 
void enable ()
 Enables the light.
 
void disable ()
 Disables the light.
 
void setAmbient (float *)
 Sets the Ambient component of the light (4-float vector)
 
void setDiffuse (float *)
 Sets the Diffuse component of the light (4-float vector)
 
void setSpecular (float *)
 Sets the Specular component of the light (4-float vector)
 
void setKc (float f)
 Sets the constant attenuation factor.
 
void setKl (float f)
 Sets the linear attenuation factor.
 
void setKq (float f)
 Sets the quadratic attenuation factor.
 
void setAngle (float a)
 Sets the angle of the spotlight's cone.
 
- Public Member Functions inherited from CGFobject
 CGFobject ()
 Base contructor.
 
virtual ~CGFobject ()
 Base destructor.
 

Static Public Attributes

static float background_ambient [4] = {CG_GLIGHT_DEFAULT_BACKGROUND_AMBIENT}
 

Protected Attributes

unsigned int id
 
float ambient [4]
 
float diffuse [4]
 
float specular [4]
 
float kc
 
float kl
 
float kq
 
float angle
 
bool enabled
 
GLUquadric * glu_quadric
 
float position [4]
 
float direction [3]
 
CGFappearancematerial
 

Static Protected Attributes

static CGFappearancedefault_light_material = new CGFappearance(__tmp_0)
 

Detailed Description

The light class is used to initialise, store information and generally handle an OpenGL GLlight. It may also draw a sphere to represent the light on the 3D scene.