class SG_EXPORT osg::Light

Light state class which encapsulates OpenGL glLight() functionality

Inheritance:


Public Methods

[more] Light()
[more] META_StateAttribute(Light, (Type)(LIGHT_0+_lightnum))
[more]virtual int compare(const StateAttribute& sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs
[more]inline void on()
Turn the light on.
[more]inline void off()
Turn the light off.
[more]virtual void apply(State& state) const
Apply the light's state to the OpenGL state machine.
[more]inline void setAmbient( const Vec4& ambient )
Set the ambient component of the light.
[more]inline const Vec4& getAmbient() const
Get the ambient component of the light.
[more]inline void setDiffuse( const Vec4& diffuse )
Set the diffuse component of the light.
[more]inline const Vec4& getDiffuse() const
Get the diffuse component of the light.
[more]inline void setSpecular( const Vec4& specular )
Set the specular component of the light.
[more]inline const Vec4& getSpecular() const
Get the specular component of the light.
[more]inline void setPosition( const Vec4& position )
Set the position of the light.
[more]inline const Vec4& getPosition() const
Get the position of the light.
[more]inline void setDirection( const Vec3& direction )
Set the direction of the light.
[more]inline const Vec3& getDirection() const
Get the direction of the light.
[more]inline void setConstantAttenuation( const float constant_attenuation )
Set the constant attenuation of the light.
[more]inline const float getConstantAttenuation() const
Get the constant attenuation of the light.
[more]inline void setLinearAttenuation( const float linear_attenuation )
Set the linear attenuation of the light.
[more]inline const float getLinearAttenuation() const
Get the linear attenuation of the light.
[more]inline void setQuadraticAttenuation( const float quadratic_attenuation )
Set the quadratic attenuation of the light.
[more]inline const float getQuadraticAttenuation() const
Get the quadratic attenuation of the light.
[more]inline void setSpotExponent( const float spot_exponent )
Set the spot exponent of the light.
[more]inline const float getSpotExponent() const
Get the spot exponent of the light.
[more]inline void setSpotCutoff( const float spot_cutoff )
Set the spot cutoff of the light.
[more]inline const float getSpotCutoff() const
Get the spot cutoff of the light.
[more]void captureLightState()
Capture the lighting settings of the current OpenGL state and store them in this object

Protected Fields

[more]int _lightnum
[more]bool _on
[more]Vec4 _ambient
[more]Vec4 _diffuse
[more]Vec4 _specular
[more]Vec4 _position
[more]Vec3 _direction
[more]float _constant_attenuation
[more]float _linear_attenuation
[more]float _quadratic_attenuation
[more]float _spot_exponent
[more]float _spot_cutoff
[more]static int _currentLightNum

Protected Methods

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


Inherited from StateAttribute:

Public Methods

ovirtual Object* clone() const
ovirtual bool isSameKindAs(const Object* obj) const
ovirtual const char* className() const
ovirtual const Type getType() const
obool operator < (const StateAttribute& rhs) const
obool operator == (const StateAttribute& rhs) const
obool operator != (const StateAttribute& rhs) const
ovirtual void setStateSetModes(StateSet&, const GLModeValue) const
ovirtual void compile(State&) const

Public Members

otypedef GLenum GLMode
otypedef unsigned int GLModeValue
otypedef unsigned int OverrideValue
oenum Values
otypedef unsigned int Type
oenum Types


Inherited from Object:


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (Referenced&)
oinline void ref() const
oinline void unref() const
oinline const int referenceCount() const

Protected Fields

omutable int _refCount


Documentation

Light state class which encapsulates OpenGL glLight() functionality
o Light()

o META_StateAttribute(Light, (Type)(LIGHT_0+_lightnum))

ovirtual int compare(const StateAttribute& sa) const
return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs

oinline void on()
Turn the light on. Calling this method doesn't directly affect OpenGL's lighting mode.

oinline void off()
Turn the light off. Calling this method doesn't directly affect OpenGL's lighting mode.

ovirtual void apply(State& state) const
Apply the light's state to the OpenGL state machine.

oinline void setAmbient( const Vec4& ambient )
Set the ambient component of the light.

oinline const Vec4& getAmbient() const
Get the ambient component of the light.

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

oinline const Vec4& getDiffuse() const
Get the diffuse component of the light.

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

oinline const Vec4& getSpecular() const
Get the specular component of the light.

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

oinline const Vec4& getPosition() const
Get the position of the light.

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

oinline const Vec3& getDirection() const
Get the direction of the light.

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

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

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

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

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

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

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

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

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

oinline const float getSpotCutoff() const
Get the spot cutoff of the light.

ovoid captureLightState()
Capture the lighting settings of the current OpenGL state and store them in this object

ovirtual ~Light()

ovoid init()
Initialize the light's settings with some decent defaults.

oint _lightnum

obool _on

oVec4 _ambient

oVec4 _diffuse

oVec4 _specular

oVec4 _position

oVec3 _direction

ofloat _constant_attenuation

ofloat _linear_attenuation

ofloat _quadratic_attenuation

ofloat _spot_exponent

ofloat _spot_cutoff

ostatic int _currentLightNum


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.