Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Member Functions | Protected Attributes

vl::Light Class Reference

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

#include <Light.hpp>

Inheritance diagram for vl::Light:
vl::RenderStateIndexed vl::RenderState vl::Object

List of all members.

Public Member Functions

 Light ()
virtual ERenderState type () const
virtual void apply (int index, const Camera *, OpenGLContext *ctx) const
 The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.
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 setQuadraticAttenuation (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 bindTransform (Transform *transform)
 If NULL follows the camera otherwise the given transformation node.
TransformboundTransform ()
const TransformboundTransform () const
virtual ref< RenderStateclone () const
void setEnabled (bool enabled)
bool enabled () const

Protected Attributes

fvec4 mAmbient
fvec4 mDiffuse
fvec4 mSpecular
fvec4 mPosition
fvec3 mSpotDirection
float mSpotExponent
float mSpotCutoff
float mConstantAttenuation
float mLinearAttenuation
float mQuadraticAttenuation
ref< TransformmBoundTransform
bool mEnabled

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

Definition at line 51 of file Light.hpp.


Constructor & Destructor Documentation

Light::Light (  )

Member Function Documentation

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

Reimplemented from vl::RenderState.

Definition at line 58 of file Light.hpp.

References vl::RS_Light.

void Light::apply ( int  index,
const Camera camera,
OpenGLContext ctx 
) const [virtual]
void vl::Light::setAmbient ( const fvec4 ambientcolor ) [inline]

Definition at line 62 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 63 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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

Definition at line 65 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 66 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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

Definition at line 68 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 69 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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.

Definition at line 77 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

The position or direction of a light.

Definition at line 79 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight(), vl::SlicedVolume::updateUniforms(), and vl::RaycastVolume::updateUniforms().

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

Definition at line 81 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 82 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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

Definition at line 84 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 85 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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.

Definition at line 88 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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.

Definition at line 90 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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.

Definition at line 95 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 96 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

void vl::Light::setQuadraticAttenuation ( 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.

Definition at line 101 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 102 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

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.

Definition at line 107 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::importLight().

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

Definition at line 108 of file Light.hpp.

Referenced by vl::VLXClassWrapper_Light::exportLight().

void Light::bindTransform ( Transform transform )

If NULL follows the camera otherwise the given transformation node.

Definition at line 114 of file Light.cpp.

References mBoundTransform.

Referenced by vl::VLXClassWrapper_Light::importLight().

Transform * Light::boundTransform (  )
const Transform * Light::boundTransform (  ) const

Definition at line 124 of file Light.cpp.

References vl::ref< T >::get(), and mBoundTransform.

virtual ref<RenderState> vl::Light::clone (  ) const [inline, virtual]

Implements vl::RenderState.

Definition at line 117 of file Light.hpp.

void vl::Light::setEnabled ( bool  enabled ) [inline]

Definition at line 124 of file Light.hpp.

bool vl::Light::enabled (  ) const [inline]

Definition at line 126 of file Light.hpp.

Referenced by apply().


Member Data Documentation

Definition at line 129 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 130 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 131 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 132 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 133 of file Light.hpp.

Referenced by apply(), and Light().

float vl::Light::mSpotExponent [protected]

Definition at line 134 of file Light.hpp.

Referenced by apply(), and Light().

float vl::Light::mSpotCutoff [protected]

Definition at line 135 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 136 of file Light.hpp.

Referenced by apply(), and Light().

float vl::Light::mLinearAttenuation [protected]

Definition at line 137 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 138 of file Light.hpp.

Referenced by apply(), and Light().

Definition at line 139 of file Light.hpp.

Referenced by bindTransform(), boundTransform(), and Light().

bool vl::Light::mEnabled [protected]

Definition at line 140 of file Light.hpp.

Referenced by Light().


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

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:10.
Permission is granted to use this page to write and publish articles regarding Visualization Library.