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

sglDirectionalLight Class Reference

#include <sglDirectionalLight.hpp>

Inheritance diagram for sglDirectionalLight::

sglLight sglNode sglObject List of all members.

Public Methods

 sglDirectionalLight ()
virtual ~sglDirectionalLight ()
void setDirection (const sglVec3f &dir)
void getDirection (sglVec3f &dir) const
virtual void setup (GLenum gl_light_number) const
virtual sglNodeclone (unsigned int mode) const
virtual void printInfo (ostream &ostrm, const char *indent_string) const

Protected Methods

virtual void computeBound ()
void copyTo (sglDirectionalLight *dst, unsigned int mode) const

Protected Attributes

sglVec4f m_direction

Detailed Description

sglDirectionalLight is a subclass of sglLight, and defines light that comes from an infinite distance away in a specified direction. The direction can be set by the user by calling sglDirectionalLight::setDirection(..) with a vector in the direction that the light comes from. This direction will be defined relative to this node's coordinate system, so that any rotations that occur in the scene graph above this node will affect this direction.

The bounding sphere for this light is set to infinite by default.

Example:

   sglDirectionalLight *dlite = new sglDirectionalLight;
   dlite->setDiffuse(1.0f, 0.5f, 0.5f, 1.0f);    // reddish light
   dlite->setDirection(sglVec3f(0., 0., 1.));    // shines along -Z axis

Definition at line 55 of file sglDirectionalLight.hpp.


Constructor & Destructor Documentation

sglDirectionalLight::sglDirectionalLight ( )
 

default constructor.

sglDirectionalLight::~sglDirectionalLight ( ) [virtual]
 

virtual destructor.


Member Function Documentation

void sglDirectionalLight::setDirection ( const sglVec3f & dir )
 

Set the direction of the light. The default value is (0,0,1).

Parameters:
dir   Direction vector (does not need to be normalized).

void sglDirectionalLight::getDirection ( sglVec3f & dir ) const
 

Get the current direction vector.

Parameters:
dir   Reference to vector that will be set to the current direction.

virtual void sglDirectionalLight::setup ( GLenum gl_light_number ) const [virtual]
 

This function is called during sglCull::draw() function to issue the OpenGL light commands needed to activate this light before rendering.

Parameters:
gl_light_number   One of GL_LIGHT0 .. GL_LIGHT<sgl::s_max_lights-1>

Reimplemented from sglLight.

virtual sglNode* sglDirectionalLight::clone ( unsigned int mode ) const [virtual]
 

Make a copy of the scenegraph rooted at this node.

Parameters:
mode   Bit masks to control the behaviour of the clone. These are OR-ed together from the mode values in sglObject::CloneModeEnum.
Returns:
Pointer to root of cloned scene graph.

Reimplemented from sglNode.

virtual void sglDirectionalLight::printInfo ( ostream & ostrm,
const char * indent_string ) const [virtual]
 

Output the state of this node to the specified ostream.

Parameters:
ostrm   the ostream to which the output is sent
indent_string   the string (usually spaces) that is output at the beginning of every line of output

Reimplemented from sglLight.


The documentation for this class was generated from the following file:
Generated at Mon Jul 1 18:00:07 2002 for SGL by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001