Visualization Library 2.1.0
A 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. More... | |
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. More... | |
const fvec4 & | position () const |
The position or direction of a light. More... | |
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. More... | |
float | spotCutoff () const |
Valid values are from 0.0f to 90.0f plus the special value 180.0f (default) which disables the spot lighting. More... | |
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. More... | |
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. More... | |
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. More... | |
float | constantAttenuation () const |
void | bindTransform (Transform *transform) |
If NULL follows the camera otherwise the given transformation node. More... | |
Transform * | boundTransform () |
const Transform * | boundTransform () const |
virtual ref< RenderState > | clone () const |
void | setEnabled (bool enabled) |
bool | enabled () const |
Public Member Functions inherited from vl::RenderStateIndexed | |
RenderStateIndexed () | |
Public Member Functions inherited from vl::RenderState | |
RenderState () | |
Public Member Functions inherited from vl::Object | |
Object () | |
Constructor. More... | |
Object (const Object &other) | |
Copy constructor: copies the name, ref count mutex and user data. More... | |
Object & | operator= (const Object &other) |
Copy operator: copies the object's name, ref count mutex and user data. More... | |
const std::string & | objectName () const |
The name of the object, by default set to the object's class name. More... | |
void | setObjectName (const char *name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setObjectName (const std::string &name) |
The name of the object, by default set to the object's class name in debug builds. More... | |
void | setRefCountMutex (IMutex *mutex) |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
IMutex * | refCountMutex () |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
const IMutex * | refCountMutex () const |
The mutex used to protect the reference counting of an Object across multiple threads. More... | |
int | referenceCount () const |
Returns the number of references of an object. More... | |
void | incReference () const |
Increments the reference count of an object. More... | |
void | decReference () |
Decrements the reference count of an object and deletes it if both automaticDelete() is true the count reaches 0. More... | |
void | setAutomaticDelete (bool autodel_on) |
If set to true the Object is deleted when its reference count reaches 0. More... | |
bool | automaticDelete () const |
If set to true the Object is deleted when its reference count reaches 0. More... | |
template<class T > | |
T * | as () |
Casts an Object to the specified class. More... | |
template<class T > | |
const T * | as () const |
Casts an Object to the specified class. More... | |
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 |
Protected Attributes inherited from vl::Object | |
std::string | mObjectName |
IMutex * | mRefCountMutex |
int | mReferenceCount |
bool | mAutomaticDelete |
Additional Inherited Members | |
Protected Member Functions inherited from vl::Object | |
virtual | ~Object () |
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.
Light::Light | ( | ) |
Definition at line 44 of file Light.cpp.
References mAmbient, mBoundTransform, mConstantAttenuation, mDiffuse, mEnabled, mLinearAttenuation, mPosition, mQuadraticAttenuation, mSpecular, mSpotCutoff, mSpotDirection, mSpotExponent, and NULL.
|
inline |
Definition at line 63 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight(), vl::DaeLoader::setupLights(), and vl::RaycastVolume::updateUniforms().
|
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 61 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 Light::bindTransform | ( | Transform * | transform | ) |
If NULL follows the camera otherwise the given transformation node.
Definition at line 115 of file Light.cpp.
References mBoundTransform.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
Transform * Light::boundTransform | ( | ) |
Definition at line 120 of file Light.cpp.
References mBoundTransform.
Referenced by apply(), vlX::VLXClassWrapper_Light::exportLight(), vl::RaycastVolume::updateUniforms(), and vl::SlicedVolume::updateUniforms().
const Transform * Light::boundTransform | ( | ) | const |
Definition at line 125 of file Light.cpp.
References mBoundTransform.
|
inlinevirtual |
Implements vl::RenderState.
|
inline |
Definition at line 108 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight().
|
inline |
Definition at line 66 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight(), and vl::RaycastVolume::updateUniforms().
|
inline |
|
inline |
Definition at line 96 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight().
|
inline |
The position or direction of a light.
Definition at line 79 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight(), vl::DaeLoader::setupLights(), vl::RaycastVolume::updateUniforms(), and vl::SlicedVolume::updateUniforms().
|
inline |
Definition at line 102 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight().
|
inline |
Definition at line 62 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
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 vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
inline |
Definition at line 65 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
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 vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
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 vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
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 vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
inline |
Definition at line 68 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
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 vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
inline |
Definition at line 81 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
inline |
Definition at line 84 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::importLight(), and vl::DaeLoader::parseLight().
|
inline |
Definition at line 69 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight(), and vl::RaycastVolume::updateUniforms().
|
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 vlX::VLXClassWrapper_Light::exportLight(), and vl::DaeLoader::setupLights().
|
inline |
Definition at line 82 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight().
|
inline |
Definition at line 85 of file Light.hpp.
Referenced by vlX::VLXClassWrapper_Light::exportLight().
|
inlinevirtual |
Reimplemented from vl::RenderState.
Definition at line 58 of file Light.hpp.
References vl::RS_Light.
|
protected |
Definition at line 139 of file Light.hpp.
Referenced by bindTransform(), boundTransform(), and Light().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Visualization Library 2.1.0 Reference Documentation
Updated on Wed Mar 10 2021 16:02:51.
© Copyright Michele Bosi. All rights reserved.