Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

nvsg::SpotLight Class Reference

Class representing a spot light. More...

#include <SpotLight.h>

Inheritance diagram for nvsg::SpotLight:

Inheritance graph
[legend]
Collaboration diagram for nvsg::SpotLight:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual NVSG_API const SpotLightclone (void) const
 Get a clone of this SpotLight.
virtual NVSG_API bool isDataShared (void) const
 Determine whether the data of this object is shared.
virtual NVSG_API DataID getDataID (void) const
 Get the DataID of the data of this object.
NVSG_API const nvmath::Vec3fgetAttenuation (void) const
 Get attenuation.
NVSG_API bool isAttenuated (void) const
 Ask if this light source is attenuated.
NVSG_API void getAttenuation (float &c, float &l, float &q) const
 Get the attenuation factors for this light.
NVSG_API void setAttenuation (float c, float l, float q)
 Set the attenuation factors for this light.
NVSG_API float getCutoffAngle (void) const
 Get the cutoff angle.
NVSG_API void setCutoffAngle (float ca)
 Set the cutoff angle.
NVSG_API float getFalloffExponent (void) const
 Get the falloff exponent.
NVSG_API void setFalloffExponent (float fe)
 Set the falloff exponent.

Static Public Member Functions

static NVSG_API const SpotLightcreate (void)
 Create a SpotLight.
static NVSG_API const SpotLightcreateFromBase (const LightSource &rhs)
 Create a SpotLight by copying from a LightSource.

Protected Member Functions

NVSG_API SpotLight (void)
 Constructor.
NVSG_API SpotLight (const LightSource &rhs)
 Partial Constructor.
NVSG_API SpotLight (const SpotLight &rhs)
 Copy Constructor.
virtual NVSG_API ~SpotLight (void)
 Protected destructor to prevent explicit creation on stack.

Detailed Description

Class representing a spot light.

A SpotLight restricts the shape of the emitted light to a cone. To specify the angle between the axis of the cone and a ray along the edge of the cone, use setCutoffAngle() with the angle in degrees. The angle of the cone at the apex is then twice this value. No light is emitted beyond the edges of the cone.

In addition, there are two ways to control the intensity distribution of the light within the cone. First, you can set the attenuation factors with setAttenuation(). You can also set a falloff exponent using setFalloffExponent(), which by default is zero, to control how concentrated the light is. The light's intensity is highest in the center of the cone. It is attenuated toward the edges of the cone by the cosine of the angle between the direction of the light and the direction from the light to the vertex being lit, raised to the power of the falloff exponent. Thus, higher falloff exponents result in a more focused light source.
Note:
The default light direction is (0,0,-1)


Constructor & Destructor Documentation

NVSG_API nvsg::SpotLight::SpotLight void   )  [protected]
 

Constructor.

NVSG_API nvsg::SpotLight::SpotLight const LightSource rhs  )  [protected]
 

Partial Constructor.

NVSG_API nvsg::SpotLight::SpotLight const SpotLight rhs  )  [protected]
 

Copy Constructor.

virtual NVSG_API nvsg::SpotLight::~SpotLight void   )  [protected, virtual]
 

Protected destructor to prevent explicit creation on stack.


Member Function Documentation

static NVSG_API const SpotLight* nvsg::SpotLight::create void   )  [static]
 

Create a SpotLight.

Returns:
a constant pointer to a SpotLight.

static NVSG_API const SpotLight* nvsg::SpotLight::createFromBase const LightSource rhs  )  [static]
 

Create a SpotLight by copying from a LightSource.

Returns:
a constant pointer to a SpotLight.
Parameters:
rhs  LightSource to copy from

virtual NVSG_API const SpotLight* nvsg::SpotLight::clone void   )  const [virtual]
 

Get a clone of this SpotLight.

Returns:
A constant pointer to the new created clone.

Implements nvsg::Node.

virtual NVSG_API bool nvsg::SpotLight::isDataShared void   )  const [virtual]
 

Determine whether the data of this object is shared.

Returns:
true if the object's data is shared, otherwise false.

Reimplemented from nvsg::LightSource.

virtual NVSG_API DataID nvsg::SpotLight::getDataID void   )  const [virtual]
 

Get the DataID of the data of this object.

Returns:
DataID of the object's data.

Reimplemented from nvsg::LightSource.

const nvmath::Vec3f & nvsg::SpotLight::getAttenuation void   )  const [inline]
 

Get attenuation.

Returns:
Attenuation factors in a Vec3f.

bool nvsg::SpotLight::isAttenuated void   )  const [inline]
 

Ask if this light source is attenuated.

A light source is attenuated if the constant attenuation factor is different from one, or if the linear or quadratic attenuation factor is different from zero.

Returns:
true if this light source is attenuated, otherwise false

void nvsg::SpotLight::getAttenuation float &  c,
float &  l,
float &  q
const [inline]
 

Get the attenuation factors for this light.

The attenuation factors are used to calculate the attenuation of this light at a lit point by the equation atten = 1 / ( c + l * d + q * d * d ) where d is the distance between the light and the vertex.

Parameters:
c  constant attenuation factor
l  linear attenuation factor
q  quadratic attenuation factor

void nvsg::SpotLight::setAttenuation float  c,
float  l,
float  q
[inline]
 

Set the attenuation factors for this light.

The attenuation factors are used to calculate the attenuation of this light at a lit point by the equation atten = 1 / ( c + l * d + q * d * d ) where d is the distance between the light and the vertex.

Parameters:
c  constant attenuation factor
l  linear attenuation factor
q  quadratic attenuation factor

float nvsg::SpotLight::getCutoffAngle void   )  const [inline]
 

Get the cutoff angle.

The light's cone is cut off at this angle (in degree). Points beyond this cone are not lit. The default is 45.0.

Returns:
The cutoff angle

void nvsg::SpotLight::setCutoffAngle float  ca  )  [inline]
 

Set the cutoff angle.

The light's cone is cut off at this angle (in degrees). Points beyond this cone are not lit. The default is 45.0.

Parameters:
ca  cutoff angle (in degrees)

float nvsg::SpotLight::getFalloffExponent void   )  const [inline]
 

Get the falloff exponent.

The falloff exponent controls the sharpness of the spot light. The higher the exponent, the more focused the light source. The default is 0.0

Returns:
The falloff exponent

void nvsg::SpotLight::setFalloffExponent float  fe  )  [inline]
 

Set the falloff exponent.

The falloff exponent controls the sharpness of the spot light. The higher the exponent, the more focused the light source. The default is 0.0.

Parameters:
fe  falloff exponent


The documentation for this class was generated from the following file:
Generated on Tue Mar 1 13:20:56 2005 for NVSGSDK by NVIDIA