#include <sglPositionalLight.hpp>
Inheritance diagram for sglPositionalLight::
Public Methods | |
sglPositionalLight () | |
virtual | ~sglPositionalLight () |
void | setPosition (const sglVec3f &pos) |
void | getPosition (sglVec3f &pos) const |
void | setAttenuation (float constant, float linear, float quadratic) |
void | getAttenuation (float &constant, float &linear, float &quadratic) const |
void | setFalloff (float falloff) |
float | getFalloff () const |
virtual void | setup (GLenum gl_light_number) const |
virtual sglNode* | clone (unsigned int mode) const |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Protected Methods | |
virtual void | computeBound () |
void | copyTo (sglPositionalLight *dst, unsigned int mode) const |
Protected Attributes | |
sglVec4f | m_position |
float | m_attenuation_constant |
float | m_attenuation_linear |
float | m_attenuation_quadratic |
float | m_falloff_inverse |
Associated with a positional light are a set of attenuation parameters that cause the light to falloff with distance (controled using the sglPositionalLight::setAttenuation(..) function). The size of the bounding sphere for the light is computed with a radius that equals the distance to a certain amount of falloff in the light. The percentage of falloff to use in this calculation is configurable by the user using the setFalloff() function.
Example:
sglPositionalLight *plite = new sglPositionalLight; plite->setPosition(sglVec3f(0., 0., 8.0f)); plite->setDiffuse(0.f, 1.f, 0.f, 1.f); // green light plite->setAmbient(0.25f, 0.25f, 0.25f, 1.f); // gray ambient // enable automatic bounding sphere computation to 20% of light plite->setFalloff(0.2f); plite->setAttenuation(1.0f, 0.0f, 0.01f);
Definition at line 64 of file sglPositionalLight.hpp.
|
default constructor.
|
|
virtual destructor.
|
|
Set the light position. Default is (0, 0, 0)
|
|
Get the current light position.
|
|
Set the OpenGL attenuation parameters where the attenuation factor is equal to 1/(constant + linear*distance + quadratic*distance*distance). Only non-negative values will be accepted.
|
|
Query the current attenuation factors.
|
|
Set the falloff threshold for computing a dynamic bounding sphere for this light. The radius of the sphere will equal the distance to where the light falls off to the value specified here. This will only go into effect if eDYNAMIC bounding sphere computation is selected.
|
|
Query the current falloff percentage.
Definition at line 114 of file sglPositionalLight.hpp. |
|
This function is called during sglCull::draw() function to issue the OpenGL light commands needed to activate this light before rendering.
Reimplemented from sglLight. Reimplemented in sglSpotLight. |
|
Make a copy of the scenegraph rooted at this node.
Reimplemented from sglNode. Reimplemented in sglSpotLight. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglLight. Reimplemented in sglSpotLight. |