# osg::Light Class Reference

Light state class which encapsulates OpenGL glLight() functionality. More...

Inheritance diagram for osg::Light:

[legend]
List of all members.

## Public Member Functions

| Light ()
| Light (const Light &light, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
| Copy constructor using CopyOp to manage deep vs shallow copy.
| META_StateAttribute (osg, Light, LIGHT)
virtual int | compare (const StateAttribute &sa) const
| Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.
virtual unsigned int | getMember ()
virtual bool | getModeUsage (ModeUsage &usage) const
| Return the modes associated with this StateAttribute.
void | setLightNum (int num)
| Set which OpenGL light to operate on.
int | getLightNum () const
| Get which OpenGL light this osg::Light operates on.
void | setAmbient (const Vec4 &ambient)
| Set the ambient component of the light.
const Vec4 & | getAmbient () const
| Get the ambient component of the light.
void | setDiffuse (const Vec4 &diffuse)
| Set the diffuse component of the light.
const Vec4 & | getDiffuse () const
| Get the diffuse component of the light.
void | setSpecular (const Vec4 &specular)
| Set the specular component of the light.
const Vec4 & | getSpecular () const
| Get the specular component of the light.
void | setPosition (const Vec4 &position)
| Set the position of the light.
const Vec4 & | getPosition () const
| Get the position of the light.
void | setDirection (const Vec3 &direction)
| Set the direction of the light.
const Vec3 & | getDirection () const
| Get the direction of the light.
void | setConstantAttenuation (float constant_attenuation)
| Set the constant attenuation of the light.
float | getConstantAttenuation () const
| Get the constant attenuation of the light.
void | setLinearAttenuation (float linear_attenuation)
| Set the linear attenuation of the light.
float | getLinearAttenuation () const
| Get the linear attenuation of the light.
void | setQuadraticAttenuation (float quadratic_attenuation)
| Set the quadratic attenuation of the light.
float | getQuadraticAttenuation () const
| Get the quadratic attenuation of the light.
void | setSpotExponent (float spot_exponent)
| Set the spot exponent of the light.
float | getSpotExponent () const
| Get the spot exponent of the light.
void | setSpotCutoff (float spot_cutoff)
| Set the spot cutoff of the light.
float | getSpotCutoff () const
| Get the spot cutoff of the light.
void | captureLightState ()
| Capture the lighting settings of the current OpenGL state and store them in this object.
virtual void | apply (State &state) const
| Apply the light's state to the OpenGL state machine.

## Protected Member Functions

virtual | ~Light ()
void | init ()
| Initialize the light's settings with some decent defaults.

## Protected Attributes

int | _lightnum
Vec4 | _ambient
Vec4 | _diffuse
Vec4 | _specular
Vec4 | _position
Vec3 | _direction
float | _constant_attenuation
float | _linear_attenuation
float | _quadratic_attenuation
float | _spot_exponent
float | _spot_cutoff

## Detailed Description

Light state class which encapsulates OpenGL glLight() functionality.

## Constructor & Destructor Documentation

Light::Light | ( |  | ) |

osg::Light::Light | ( | const Light & | light,
|  | const CopyOp & | copyop = `CopyOp::SHALLOW_COPY`
| ) | `[inline]`

| Copy constructor using CopyOp to manage deep vs shallow copy.

Light::~Light | ( |  | ) | `[protected, virtual]`

## Member Function Documentation

void Light::apply | ( | State & | state | ) | const`[virtual]`

| Apply the light's state to the OpenGL state machine. Implements osg::StateAttribute.

void Light::captureLightState | ( |  | ) |

| Capture the lighting settings of the current OpenGL state and store them in this object.

virtual int osg::Light::compare | ( | const StateAttribute & | sa | ) | const`[inline, virtual]`

| Return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs. Implements osg::StateAttribute.

const Vec4& osg::Light::getAmbient | ( |  | ) | const`[inline]`

| Get the ambient component of the light.

float osg::Light::getConstantAttenuation | ( |  | ) | const`[inline]`

| Get the constant attenuation of the light.

const Vec4& osg::Light::getDiffuse | ( |  | ) | const`[inline]`

| Get the diffuse component of the light.

const Vec3& osg::Light::getDirection | ( |  | ) | const`[inline]`

| Get the direction of the light.

int osg::Light::getLightNum | ( |  | ) | const`[inline]`

| Get which OpenGL light this osg::Light operates on.

float osg::Light::getLinearAttenuation | ( |  | ) | const`[inline]`

| Get the linear attenuation of the light.

virtual unsigned int osg::Light::getMember | ( |  | ) | `[inline, virtual]`

virtual bool osg::Light::getModeUsage | ( | ModeUsage & | usage | ) | const`[inline, virtual]`

| Return the modes associated with this StateAttribute. Reimplemented from osg::StateAttribute.

const Vec4& osg::Light::getPosition | ( |  | ) | const`[inline]`

| Get the position of the light.

float osg::Light::getQuadraticAttenuation | ( |  | ) | const`[inline]`

| Get the quadratic attenuation of the light.

const Vec4& osg::Light::getSpecular | ( |  | ) | const`[inline]`

| Get the specular component of the light.

float osg::Light::getSpotCutoff | ( |  | ) | const`[inline]`

| Get the spot cutoff of the light.

float osg::Light::getSpotExponent | ( |  | ) | const`[inline]`

| Get the spot exponent of the light.

void Light::init | ( |  | ) | `[protected]`

| Initialize the light's settings with some decent defaults.

osg::Light::META_StateAttribute | ( | osg | ,
|  | Light | ,
|  | LIGHT |
| ) |

void osg::Light::setAmbient | ( | const Vec4 & | ambient | ) | `[inline]`

| Set the ambient component of the light.

void osg::Light::setConstantAttenuation | ( | float | constant_attenuation | ) | `[inline]`

| Set the constant attenuation of the light.

void osg::Light::setDiffuse | ( | const Vec4 & | diffuse | ) | `[inline]`

| Set the diffuse component of the light.

void osg::Light::setDirection | ( | const Vec3 & | direction | ) | `[inline]`

| Set the direction of the light.

void osg::Light::setLightNum | ( | int | num | ) | `[inline]`

| Set which OpenGL light to operate on.

void osg::Light::setLinearAttenuation | ( | float | linear_attenuation | ) | `[inline]`

| Set the linear attenuation of the light.

void osg::Light::setPosition | ( | const Vec4 & | position | ) | `[inline]`

| Set the position of the light.

void osg::Light::setQuadraticAttenuation | ( | float | quadratic_attenuation | ) | `[inline]`

| Set the quadratic attenuation of the light.

void osg::Light::setSpecular | ( | const Vec4 & | specular | ) | `[inline]`

| Set the specular component of the light.

void osg::Light::setSpotCutoff | ( | float | spot_cutoff | ) | `[inline]`

| Set the spot cutoff of the light.

void osg::Light::setSpotExponent | ( | float | spot_exponent | ) | `[inline]`

| Set the spot exponent of the light.

## Member Data Documentation

Vec4 osg::Light::_ambient `[protected]`

float osg::Light::_constant_attenuation `[protected]`

Vec4 osg::Light::_diffuse `[protected]`

Vec3 osg::Light::_direction `[protected]`

int osg::Light::_lightnum `[protected]`

float osg::Light::_linear_attenuation `[protected]`

Vec4 osg::Light::_position `[protected]`

float osg::Light::_quadratic_attenuation `[protected]`

Vec4 osg::Light::_specular `[protected]`

float osg::Light::_spot_cutoff `[protected]`

float osg::Light::_spot_exponent `[protected]`

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

- Light
- Light.cpp