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

nvsg::LightSource Class Reference

Base class for representing all light sources. More...

#include <LightSource.h>

Inheritance diagram for nvsg::LightSource:

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

Collaboration graph
[legend]
List of all members.

Public Methods

NVSG_API const nvmath::Vec3fgetAmbientColor (void) const
 Get the ambient color of this light source. More...

NVSG_API void setAmbientColor (const nvmath::Vec3f &c)
 Set the ambient color of this light source. More...

NVSG_API const nvmath::Vec3fgetDiffuseColor (void) const
 Get the diffuse color of this light source. More...

NVSG_API void setDiffuseColor (const nvmath::Vec3f &c)
 Set the diffuse color of this light source. More...

NVSG_API const nvmath::Vec3fgetSpecularColor (void) const
 Get the specular color of this light source. More...

NVSG_API void setSpecularColor (const nvmath::Vec3f &c)
 Set the specular color of this light source. More...

NVSG_API float getIntensity (void) const
 Get the intensity of this light source. More...

NVSG_API void setIntensity (float i)
 Set the intensity of this light source. More...

NVSG_API const Animation<
nvmath::Trafo > * 
getAnimation (void) const
 Get the animation of this light. More...

NVSG_API void setAnimation (const Animation< nvmath::Trafo > *pAnimation)
 Set an animation for this light. More...

NVSG_API void setAnimationFrame (size_t frame)
 Set the animation frame. More...

virtual NVSG_API size_t getNumberOfFrames (void) const
 Get the number of animation frames that are part of this LightSource. More...

NVSG_API void setPosition (const nvmath::Vec3f &position)
 Set the position of the light source. More...

NVSG_API const nvmath::Vec3fgetPosition (void) const
 Set the position of the light source. More...

NVSG_API nvmath::Vec3f getDirection (void) const
 Get the direction. More...

NVSG_API void setDirection (const nvmath::Vec3f &direction)
 Get the direction. More...

NVSG_API const nvmath::QuatfgetOrientation (void) const
 Get the current rotational transformation. More...

NVSG_API void setOrientation (const nvmath::Quatf &orientation)
 Set the rotational part of the light transformation. More...

NVSG_API nvmath::Mat44f getTransformationMatrix (void) const
 Get the current transformation. More...

NVSG_API nvmath::Mat44f getInverse (void) const
 Get the inverse of the current transformation. More...

virtual NVSG_API bool isDataShared (void) const
 Determine whether the data of this object is shared. More...

virtual NVSG_API DataID getDataID (void) const
 Get the DataID of the data of this object. More...

virtual NVSG_API bool containsLight (void) const
 Ask if this LightSource is a LightSource. More...


Protected Methods

NVSG_API LightSource (void)
 Constructor. More...

NVSG_API LightSource (const LightSource &rhs)
 Copy constructor. More...

virtual NVSG_API ~LightSource (void)
 Protected destructor to prevent explicit creation on stack. More...

virtual NVSG_API bool calcBoundingSphere (void) const
 Calculate the bounding sphere of this light source. More...


Detailed Description

Base class for representing all light sources.

A LightSource contains data and functionality common to all light sources (DirectedLight, SpotLight, ...).

Note:
NVSG LightSources do not have a method to turn them on or off. The concept is slightly different to other scene graph APIs. Since we have a Switch node that allows to turn multiple Nodes on / off light sources should be handeled via this switch.
Note:
Light sources only influence objects under the same Switch/Group or in a subtree under the same Switch/Group.
Here a short example:
                        |
     -----------------------------------------
     |                  |                    |
     Ls0               Sw                    NB
                        |
            -----------------------
            |      |       |      |
            Ls1    NA      Ls2    Gr
                                  |
                                 ...
Light source Ls0 lits Switch Sw and in turn all active children of Sw and of course Node NB.
Light source Ls1 lits Node NA and Group Gr and in turn all children of Gr.
And at least light source Ls2 lits Group Gr and in turn all children of Gr.


Constructor & Destructor Documentation

NVSG_API nvsg::LightSource::LightSource void    [protected]
 

Constructor.

NVSG_API nvsg::LightSource::LightSource const LightSource &    rhs [protected]
 

Copy constructor.

virtual NVSG_API nvsg::LightSource::~LightSource void    [protected, virtual]
 

Protected destructor to prevent explicit creation on stack.


Member Function Documentation

const nvmath::Vec3f & nvsg::LightSource::getAmbientColor void    const [inline]
 

Get the ambient color of this light source.

The ambient color of a light simply contributes to the global ambient term. It is not dependent on any other lighting factors such as vertex normals, light direction, light position, range, or attenuation. The default is (0.0,0.0,0.0).

Returns:
The ambient color of this light source

void nvsg::LightSource::setAmbientColor const nvmath::Vec3f   c [inline]
 

Set the ambient color of this light source.

The ambient color of a light simply contributes to the global ambient term. It is not dependent on any other lighting factors such as vertex normals, light direction, light position, range, or attenuation. The default is (0.0,0.0,0.0).

Parameters:
c  ambient color for this light source

const nvmath::Vec3f & nvsg::LightSource::getDiffuseColor void    const [inline]
 

Get the diffuse color of this light source.

The diffuse color of a light is used to calculate lighting contribution that might depend on vertex normals, light direction, light position, range, or attenutation, depending on the type of light source. The default is (1.0,1.0,1.0).

Returns:
The diffuse color of this light source

void nvsg::LightSource::setDiffuseColor const nvmath::Vec3f   c [inline]
 

Set the diffuse color of this light source.

The diffuse color of a light is used to calculate lighting contribution from vertex normals, light direction, light position, range, or attenutation, depending on the type of light source. The default is (1.0,1.0,1.0).

Parameters:
c  diffuse color for this light source

const nvmath::Vec3f & nvsg::LightSource::getSpecularColor void    const [inline]
 

Get the specular color of this light source.

The specular color of a light is used to calculate any lighting contribution from vertex normals, vertex position, light direction, light position, range, or attenuation, depending on the type of light source. The default is (1.0,1.0,1.0).

Returns:
The specular color of this light source

void nvsg::LightSource::setSpecularColor const nvmath::Vec3f   c [inline]
 

Set the specular color of this light source.

The specular color of a light is used to calculate lighting contribution from vertex normals, vertex position, light direction, light position, range, or attenuation, depending on the type of light source. The default is (1.0,1.0,1.0).

Parameters:
c  specular color for this light source

float nvsg::LightSource::getIntensity void    const [inline]
 

Get the intensity of this light source.

The intensity of a light is a multiplier for all three color types of this light.

Returns:
color intensity of this light source

void nvsg::LightSource::setIntensity float    i [inline]
 

Set the intensity of this light source.

The intensity of a light is a multiplier for all three color types of this light.

Parameters:
i  color intensity for this light source

const Animation< nvmath::Trafo > * nvsg::LightSource::getAnimation void    const [inline]
 

Get the animation of this light.

Returns:
The constant pointer to the animation of this light, or NULL if there isn't any.

NVSG_API void nvsg::LightSource::setAnimation const Animation< nvmath::Trafo > *    pAnimation
 

Set an animation for this light.

Parameters:
pAnimation  animation to add

NVSG_API void nvsg::LightSource::setAnimationFrame size_t    frame
 

Set the animation frame.

The transformation for animation step frame is calculated and used as the current.

Parameters:
frame  current animation step

size_t nvsg::LightSource::getNumberOfFrames void    const [inline, virtual]
 

Get the number of animation frames that are part of this LightSource.

Returns:
The number of animation frames if there is an animation attached, otherwise zero.

Reimplemented from nvsg::Node.

void nvsg::LightSource::setPosition const nvmath::Vec3f   position [inline]
 

Set the position of the light source.

Parameters:
position  The position of the light source.

const nvmath::Vec3f & nvsg::LightSource::getPosition void    const [inline]
 

Set the position of the light source.

Returns:
The position of the light source.

nvmath::Vec3f nvsg::LightSource::getDirection void    const [inline]
 

Get the direction.

The direction is the main direction of the light's cone - Default direction: (0, 0, -1).

Returns:
The vector pointing into the direction of the light source.

NVSG_API void nvsg::LightSource::setDirection const nvmath::Vec3f   direction
 

Get the direction.

The direction is the main direction of the light's cone - Default direction: (0, 0, -1)

Note:
The direction is expected to be normalized.
Parameters:
direction  lighting direction

const nvmath::Quatf & nvsg::LightSource::getOrientation void    const [inline]
 

Get the current rotational transformation.

Returns:
The quaternion that describes the rotational part

void nvsg::LightSource::setOrientation const nvmath::Quatf   orientation [inline]
 

Set the rotational part of the light transformation.

Parameters:
orientation  rotational part of transformation

nvmath::Mat44f nvsg::LightSource::getTransformationMatrix void    const [inline]
 

Get the current transformation.

Returns:
The transformation as a Mat44f

nvmath::Mat44f nvsg::LightSource::getInverse void    const [inline]
 

Get the inverse of the current transformation.

Returns:
The inverse transformation as a Mat44f

virtual NVSG_API bool nvsg::LightSource::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::Node.

Reimplemented in nvsg::DirectedLight, nvsg::PointLight, and nvsg::SpotLight.

virtual NVSG_API DataID nvsg::LightSource::getDataID void    const [virtual]
 

Get the DataID of the data of this object.

Returns:
DataID of the object's data.

Reimplemented from nvsg::Node.

Reimplemented in nvsg::DirectedLight, nvsg::PointLight, and nvsg::SpotLight.

virtual NVSG_API bool nvsg::LightSource::containsLight void    const [virtual]
 

Ask if this LightSource is a LightSource.

Returns:
true

Reimplemented from nvsg::Node.

bool nvsg::LightSource::calcBoundingSphere void    const [inline, protected, virtual]
 

Calculate the bounding sphere of this light source.

LightSource doesn't have a valid bounding sphere.

Returns:
false.

Implements nvsg::Node.


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