Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics
[Home] [Tutorials] [All Classes] [Grouped Classes]

vl::Light Class Reference

Wraps the OpenGL function glLight(). More...

#include <Light.hpp>

Inheritance diagram for vl::Light:

vl::RenderState vl::Object

List of all members.

Public Member Functions

 Light (int light_index)
virtual const char * className ()
 Returns the name of the class.
virtual ERenderState type () const
virtual void apply (const Camera *) const
virtual void disable () const
virtual void enable () const
void setAmbient (const fvec4 &ambientcolor)
const fvec4ambient () const
void setDiffuse (const fvec4 &diffusecolor)
const fvec4diffuse () const
void setSpecular (const fvec4 &specularcolor)
const fvec4specular () const
void setPosition (const fvec4 &position)
 The position or direction of a light.
const fvec4position () const
 The position or direction of a light.
void setSpotDirection (const fvec3 &spotdirection)
const fvec3spotDirection () const
void setSpotExponent (float spotexponent)
float spotExponent () const
void setSpotCutoff (float spotcutoff)
 Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot lighting.
float spotCutoff () const
 Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot lighting.
void setLinearAttenuation (float linearattenuation)
 If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.
float linearAttenuation () const
void setQuadraticAttentuation (float quadraticattenuation)
 If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.
float quadraticAttenuation () const
void setConstantAttenuation (float constantattenuation)
 If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.
float constantAttenuation () const
void setLightIndex (int light_index)
int lightIndex () const
void followTransform (Transform *transform)
 If NULL follows the camera otherwise the given transformation node.
TransformfollowedTransform ()
const TransformfollowedTransform () const

Protected Attributes

fvec4 mAmbient
fvec4 mDiffuse
fvec4 mSpecular
fvec4 mPosition
fvec3 mSpotDirection
float mSpotExponent
float mSpotCutoff
float mConstantAttenuation
float mLinearAttentuation
float mQuadraticAttentuation
ref< TransformmFollowedTransform
int mLightIndex


Detailed Description

Wraps the OpenGL function glLight().

See also http://www.opengl.org/sdk/docs/man/xhtml/glLight.xml for more information.

See also the Lights Tutorial for a practical example of how to use OpenGL lights.

See also:
Shader, Effect, Actor, vl::EN_LIGHTING

Constructor & Destructor Documentation

Light::Light ( int  light_index  ) 


Member Function Documentation

virtual const char* vl::Light::className (  )  [inline, virtual]

Returns the name of the class.

Reimplemented from vl::RenderState.

virtual ERenderState vl::Light::type (  )  const [inline, virtual]

Reimplemented from vl::RenderState.

void Light::apply ( const Camera camera  )  const [virtual]

Implements vl::RenderState.

virtual void vl::Light::disable (  )  const [inline, virtual]

Reimplemented from vl::RenderState.

virtual void vl::Light::enable (  )  const [inline, virtual]

Reimplemented from vl::RenderState.

void vl::Light::setAmbient ( const fvec4 ambientcolor  )  [inline]

const fvec4& vl::Light::ambient (  )  const [inline]

void vl::Light::setDiffuse ( const fvec4 diffusecolor  )  [inline]

const fvec4& vl::Light::diffuse (  )  const [inline]

void vl::Light::setSpecular ( const fvec4 specularcolor  )  [inline]

const fvec4& vl::Light::specular (  )  const [inline]

void vl::Light::setPosition ( const fvec4 position  )  [inline]

The position or direction of a light.

  • If the fourth component of position equals 0.0f then the light is considered a directional light and position points in the direction of the light.
  • If the fourth component of position equals 1.0f then the light is considered a positional light and position contains the position of the light.

Note. The position or direction of a light is relative to the followed Transform or to the camera if the light does not follow any transform.

const fvec4& vl::Light::position (  )  const [inline]

The position or direction of a light.

void vl::Light::setSpotDirection ( const fvec3 spotdirection  )  [inline]

const fvec3& vl::Light::spotDirection (  )  const [inline]

void vl::Light::setSpotExponent ( float  spotexponent  )  [inline]

float vl::Light::spotExponent (  )  const [inline]

void vl::Light::setSpotCutoff ( float  spotcutoff  )  [inline]

Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot lighting.

float vl::Light::spotCutoff (  )  const [inline]

Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot lighting.

void vl::Light::setLinearAttenuation ( float  linearattenuation  )  [inline]

If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.

float vl::Light::linearAttenuation (  )  const [inline]

void vl::Light::setQuadraticAttentuation ( float  quadraticattenuation  )  [inline]

If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.

float vl::Light::quadraticAttenuation (  )  const [inline]

void vl::Light::setConstantAttenuation ( float  constantattenuation  )  [inline]

If the light is positional, rather than directional, its intensity is attenuated by the reciprocal of the sum of the constant attenuation, the linear attenuation times the distance between the light and the vertex being lighted, and the quadratic attenuation times the square of the same distance.

float vl::Light::constantAttenuation (  )  const [inline]

void Light::setLightIndex ( int  light_index  ) 

int vl::Light::lightIndex (  )  const [inline]

void Light::followTransform ( Transform transform  ) 

If NULL follows the camera otherwise the given transformation node.

Transform * Light::followedTransform (  ) 

const Transform * Light::followedTransform (  )  const


Member Data Documentation

float vl::Light::mSpotExponent [protected]

float vl::Light::mSpotCutoff [protected]

float vl::Light::mLinearAttentuation [protected]

int vl::Light::mLightIndex [protected]


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

Visualization Library v2009.07 Reference Documentation
Copyright 2005-2009 Michele Bosi. All rights reserved.
Updated on Mon Aug 10 21:41:36 2009.
Permission is granted to use this page to write and publish articles regarding Visualization Library.