Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::Light Class Reference

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

Inheritance diagram for osg::Light:

Inheritance graph
[legend]
List of all members.

Public Methods

 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,(Type)(LIGHT_0+_lightnum))
virtual int compare (const StateAttribute &sa) const
 return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.

virtual void getAssociatedModes (std::vector< GLMode > &modes) const
 return the modes associated with this StateSet

void setLightNum (const int num)
 Set which OpenGL light to operate on.

const 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 Vec4getAmbient () const
 Get the ambient component of the light.

void setDiffuse (const Vec4 &diffuse)
 Set the diffuse component of the light.

const Vec4getDiffuse () const
 Get the diffuse component of the light.

void setSpecular (const Vec4 &specular)
 Set the specular component of the light.

const Vec4getSpecular () const
 Get the specular component of the light.

void setPosition (const Vec4 &position)
 Set the position of the light.

const Vec4getPosition () const
 Get the position of the light.

void setDirection (const Vec3 &direction)
 Set the direction of the light.

const Vec3getDirection () const
 Get the direction of the light.

void setConstantAttenuation (const float constant_attenuation)
 Set the constant attenuation of the light.

const float getConstantAttenuation () const
 Get the constant attenuation of the light.

void setLinearAttenuation (const float linear_attenuation)
 Set the linear attenuation of the light.

const float getLinearAttenuation () const
 Get the linear attenuation of the light.

void setQuadraticAttenuation (const float quadratic_attenuation)
 Set the quadratic attenuation of the light.

const float getQuadraticAttenuation () const
 Get the quadratic attenuation of the light.

void setSpotExponent (const float spot_exponent)
 Set the spot exponent of the light.

const float getSpotExponent () const
 Get the spot exponent of the light.

void setSpotCutoff (const float spot_cutoff)
 Set the spot cutoff of the light.

const 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 Methods

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

osg::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.

virtual osg::Light::~Light   [protected, virtual]
 


Member Function Documentation

virtual void osg::Light::apply State   state const [virtual]
 

Apply the light's state to the OpenGL state machine.

Implements osg::StateAttribute.

void osg::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.

virtual void osg::Light::getAssociatedModes std::vector< GLMode > &    modes const [inline, virtual]
 

return the modes associated with this StateSet

Reimplemented from osg::StateAttribute.

const 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.

const int osg::Light::getLightNum   const [inline]
 

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

const float osg::Light::getLinearAttenuation   const [inline]
 

Get the linear attenuation of the light.

const Vec4& osg::Light::getPosition   const [inline]
 

Get the position of the light.

const 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.

const float osg::Light::getSpotCutoff   const [inline]
 

Get the spot cutoff of the light.

const float osg::Light::getSpotExponent   const [inline]
 

Get the spot exponent of the light.

void osg::Light::init   [protected]
 

Initialize the light's settings with some decent defaults.

osg::Light::META_StateAttribute osg   ,
Light   ,
(Type   )(LIGHT_0+_lightnum)
 

void osg::Light::setAmbient const Vec4   ambient [inline]
 

Set the ambient component of the light.

void osg::Light::setConstantAttenuation const 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 const int    num [inline]
 

Set which OpenGL light to operate on.

void osg::Light::setLinearAttenuation const 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 const 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 const float    spot_cutoff [inline]
 

Set the spot cutoff of the light.

void osg::Light::setSpotExponent const 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 file:
Generated at Wed Sep 18 13:55:32 2002 for the Open Scene Graph by doxygen 1.2.16.