17 #ifndef AGXOSG_LIGHTSOURCE_H 18 #define AGXOSG_LIGHTSOURCE_H 20 #include <agx/config.h> 26 #include <osg/LightSource> 39 m_light = lightSource->getLight();
43 int getLightNum()
const {
if (m_light)
return m_light->getLightNum();
else return -1; }
76 inline void setConstantAttenuation(
float constant_attenuation ) {
if (m_light) m_light->setConstantAttenuation(constant_attenuation);}
79 inline float getConstantAttenuation()
const {
if (m_light)
return m_light->getConstantAttenuation();
else return 0; }
82 inline void setLinearAttenuation (
float linear_attenuation ) {
if (m_light) m_light->setLinearAttenuation( linear_attenuation ); }
85 inline float getLinearAttenuation ()
const {
if (m_light)
return m_light->getLinearAttenuation();
else return 0; }
88 inline void setQuadraticAttenuation (
float quadratic_attenuation ) {
if (m_light) m_light->setQuadraticAttenuation(quadratic_attenuation); }
94 inline void setSpotExponent(
float spot_exponent ) {
if (m_light) m_light->setSpotExponent(spot_exponent); }
97 inline float getSpotExponent()
const {
if (m_light)
return m_light->getSpotExponent();
else return 0; }
100 inline void setSpotCutoff(
float spot_cutoff ) {
if (m_light) m_light->setSpotCutoff(spot_cutoff); }
103 inline float getSpotCutoff()
const {
if (m_light)
return m_light->getSpotCutoff();
return 0; }
void setPosition(const agx::Vec4 &position)
Set the position of the light.
void setQuadraticAttenuation(float quadratic_attenuation)
Set the quadratic attenuation of the light.
void setDirection(const agx::Vec3 &direction)
Set the direction of the light.
Vec3T< Real > Vec3
The object holding 3 dimensional vectors and providing basic arithmetic.
float getConstantAttenuation() const
Get the constant attenuation of the light.
void setLinearAttenuation(float linear_attenuation)
Set the linear attenuation of the light.
int getLightNum() const
Get which OpenGL light this osg::Light operates on.
A class holding 4 dimensional vectors and providing basic arithmetic.
#define OSG_VEC3_TO_AGX(X)
float getQuadraticAttenuation() const
Get the quadratic attenuation of the light.
agx::Vec4 getPosition() const
Get the position of the light.
#define OSG_VEC4F_TO_AGX(X)
#define OSG_VEC4_TO_AGX(X)
agx::Vec4f getDiffuse() const
Get the diffuse component of the light.
float getSpotCutoff() const
Get the spot cutoff of the light.
The agxOSG namespace provides functionality for visualizing AGX simulations with OpenSceneGraph.
agx::Vec4f getAmbient() const
Get the ambient component of the light.
float getSpotExponent() const
Get the spot exponent of the light.
agx::Vec4f getSpecular() const
Get the specular component of the light.
void setDiffuse(const agx::Vec4f &diffuse)
Set the diffuse component of the light.
#define AGX_VEC3_TO_OSG(X)
osg::ref_ptr< osg::Light > m_light
agx::Vec3 getDirection() const
Get the direction of the light.
#define AGX_VEC4_TO_OSG(X)
LightSource(osg::LightSource *lightSource)
void setSpecular(const agx::Vec4f &specular)
Set the specular component of the light.
void setAmbient(const agx::Vec4f &ambient)
Set the ambient component of the light.
void setSpotCutoff(float spot_cutoff)
Set the spot cutoff of the light.
void setConstantAttenuation(float constant_attenuation)
Set the constant attenuation of the light.
void setSpotExponent(float spot_exponent)
Set the spot exponent of the light.
float getLinearAttenuation() const
Get the linear attenuation of the light.