class SG_EXPORT osg::Light

Light state class which encapsulates OpenGL glLight() functionality

Inheritance:


Public Methods

[more] Light()
[more] Light(const Light& light, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy
[more] META_StateAttribute(osg, 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]virtual void getAssociatedModes(std::vector<GLMode>& modes) const
[more]void setLightNum(int num)
Set which OpenGL light to operate on
[more]int getLightNum() const
Get which OpenGL light this osg::Light operates on
[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( float constant_attenuation )
Set the constant attenuation of the light.
[more]inline float getConstantAttenuation() const
Get the constant attenuation of the light.
[more]inline void setLinearAttenuation( float linear_attenuation )
Set the linear attenuation of the light.
[more]inline float getLinearAttenuation() const
Get the linear attenuation of the light.
[more]inline void setQuadraticAttenuation( float quadratic_attenuation )
Set the quadratic attenuation of the light.
[more]inline float getQuadraticAttenuation() const
Get the quadratic attenuation of the light.
[more]inline void setSpotExponent( float spot_exponent )
Set the spot exponent of the light.
[more]inline float getSpotExponent() const
Get the spot exponent of the light.
[more]inline void setSpotCutoff( float spot_cutoff )
Set the spot cutoff of the light.
[more]inline 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
[more]virtual void apply(State& state) const
Apply the light's state to the OpenGL state machine.

Protected Fields

[more]int _lightnum
[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

Protected Methods

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


Inherited from StateAttribute:

Public Methods

ovirtual Object* cloneType() const
ovirtual Object* clone(const CopyOp&) const
ovirtual bool isSameKindAs(const Object* obj) const
ovirtual const char* libraryName() const
ovirtual const char* className() const
ovirtual Type getType() const
ovirtual bool isTextureAttribute() const
obool operator < (const StateAttribute& rhs) const
obool operator == (const StateAttribute& rhs) const
obool operator != (const StateAttribute& rhs) 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:

Public Methods

oinline void setDataVariance(DataVariance dv)
oinline DataVariance getDataVariance() const
oinline void setUserData(Referenced* obj)
oinline Referenced* getUserData()
oinline const Referenced* getUserData() const

Public Members

oenum DataVariance

Protected Fields

oDataVariance _dataVariance
oref_ptr<Referenced> _userData


Inherited from Referenced:

Public Methods

oinline Referenced& operator = (Referenced&)
oinline void ref() const
oinline void unref() const
oinline void unref_nodelete() const
oinline int referenceCount() const
oinline static int createdCount()
oinline static int deletedCount()

Protected Fields

omutable int _refCount
ostatic int _createdCount
ostatic int _deletedCount


Documentation

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

o Light(const Light& light, const CopyOp& copyop=CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy

o META_StateAttribute(osg, 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

ovirtual void getAssociatedModes(std::vector<GLMode>& modes) const

ovoid setLightNum(int num)
Set which OpenGL light to operate on

oint getLightNum() const
Get which OpenGL light this osg::Light operates on

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( float constant_attenuation )
Set the constant attenuation of the light.

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

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

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

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

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

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

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

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

oinline 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 void apply(State& state) const
Apply the light's state to the OpenGL state machine.

ovirtual ~Light()

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

oint _lightnum

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


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



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