Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
Wraps the OpenGL function glLight(). More...
#include <Light.hpp>
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 fvec4 & | ambient () const |
void | setDiffuse (const fvec4 &diffusecolor) |
const fvec4 & | diffuse () const |
void | setSpecular (const fvec4 &specularcolor) |
const fvec4 & | specular () const |
void | setPosition (const fvec4 &position) |
The position or direction of a light. | |
const fvec4 & | position () const |
The position or direction of a light. | |
void | setSpotDirection (const fvec3 &spotdirection) |
const fvec3 & | spotDirection () 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. | |
Transform * | boundTransform () |
const Transform * | boundTransform () const |
virtual ref< RenderState > | clone () 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< Transform > | mBoundTransform |
bool | mEnabled |
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.
Definition at line 51 of file Light.hpp.
Light::Light | ( | ) |
Definition at line 43 of file Light.cpp.
References mAmbient, mBoundTransform, mConstantAttenuation, mDiffuse, mEnabled, mLinearAttenuation, mPosition, mQuadraticAttenuation, mSpecular, mSpotCutoff, mSpotDirection, mSpotExponent, NULL, and VL_DEBUG_SET_OBJECT_NAME.
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] |
The parameter cameara is NULL if we are disabling the state, non-NULL if we are enabling it.
Implements vl::RenderState.
Definition at line 60 of file Light.cpp.
References vl::Camera::applyModelViewMatrix(), boundTransform(), enabled(), mAmbient, mConstantAttenuation, mDiffuse, mLinearAttenuation, mPosition, mQuadraticAttenuation, mSpecular, mSpotCutoff, mSpotDirection, mSpotExponent, vl::Vector3< T_Scalar >::ptr(), vl::Vector4< T_Scalar >::ptr(), VL_CHECK, VL_CHECK_OGL, and vl::Vector4< T_Scalar >::w().
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.
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 | ( | ) |
Definition at line 119 of file Light.cpp.
References vl::ref< T >::get(), and mBoundTransform.
Referenced by apply(), vl::VLXClassWrapper_Light::exportLight(), vl::SlicedVolume::updateUniforms(), and vl::RaycastVolume::updateUniforms().
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.
bool vl::Light::enabled | ( | ) | const [inline] |
fvec4 vl::Light::mAmbient [protected] |
fvec4 vl::Light::mDiffuse [protected] |
fvec4 vl::Light::mSpecular [protected] |
fvec4 vl::Light::mPosition [protected] |
fvec3 vl::Light::mSpotDirection [protected] |
float vl::Light::mSpotExponent [protected] |
float vl::Light::mSpotCutoff [protected] |
float vl::Light::mConstantAttenuation [protected] |
float vl::Light::mLinearAttenuation [protected] |
float vl::Light::mQuadraticAttenuation [protected] |
ref<Transform> vl::Light::mBoundTransform [protected] |
Definition at line 139 of file Light.hpp.
Referenced by bindTransform(), boundTransform(), and Light().
bool vl::Light::mEnabled [protected] |