VLight Class Reference

#include <VLight.h>

Inherits TLMDataIF.

Collaboration diagram for VLight:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 VLight (GLenum lightNum)
virtual ~VLight ()
bool initFromXML (const wxXmlNode &lightNode)
virtual void getAvailableData (map< TLMDataIF::Key, TLMDataIF::DataInfo > &data) const
virtual bool getDataValue (const TLMDataIF::Key &key, string &data) const
virtual bool setDataValue (const TLMDataIF::Key &key, const string &data)
void setPosition (const double x, const double y, const double z)
void getPosition (double &x, double &y, double &z) const
void setDirection (const double x, const double y, const double z)
void getDirection (double &x, double &y, double &z) const
void setColor (GLenum mode, const double red, const double green, const double blue, const double alpha)
void getColor (GLenum mode, double &red, double &green, double &blue, double &alpha) const
void setSpotDirection (const double x, const double y, const double z)
void getSpotDirection (double &x, double &y, double &z) const
void setSpotExponent (const double exp)
void getSpotExponent (double &exp) const
void setSpotCutoff (const double cutoff)
void getSpotCutoff (double &cutoff) const
void setConstantAttenuation (const double att)
void getConstantAttenuation (double &att) const
void setLinearAttenuation (const double att)
void getLinearAttenuation (double &att) const
void setQuadraticAttenuation (const double att)
void getQuadraticAttenuation (double &att) const
void draw () const
string name () const
GLenum lightNum () const

Protected Member Functions

void cleanup ()
void drawBox (double x, double y, double z, double width, double depth, double height) const

Protected Attributes

GLenum myLightNum
 The light number GL_LIGHT0 - GL_LIGHT7.
GLuint myCallList
GLfloat myPosition [4]

Detailed Description

This class models a light in the Viewer. A light can have a position, color and intensity. A light can also be drawn as a box in the world (mostly for debugging).
Author:
Chad Weisshaar
Date:
2005

Definition at line 20 of file VLight.h.


Constructor & Destructor Documentation

VLight::VLight GLenum  lightNum  ) 
 

Construct a new light.

Parameters:
lightNum OpenGL provides enumerated lights. The light number is the OpenGL identification of this light. Must be GL_LIGHT0 through GL_LIGHT7.

Definition at line 8 of file VLight.cpp.

References memTraceMsg, myLightNum, and myPosition.

VLight::~VLight  )  [virtual]
 

Definition at line 15 of file VLight.cpp.

References cleanup(), and memTraceMsg.

Here is the call graph for this function:


Member Function Documentation

void VLight::cleanup  )  [protected]
 

Definition at line 547 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

Referenced by ~VLight().

void VLight::draw  )  const
 

Draw the light. This draws a non-textured, light-colored 1/2 width box at the location of the light

Definition at line 519 of file VLight.cpp.

References drawBox(), myCallList, myLightNum, myPosition, and traceId.

Here is the call graph for this function:

void VLight::drawBox double  x,
double  y,
double  z,
double  width,
double  depth,
double  height
const [protected]
 

Definition at line 555 of file VLight.cpp.

References traceId.

Referenced by draw().

void VLight::getAvailableData map< TLMDataIF::Key, TLMDataIF::DataInfo > &  data  )  const [virtual]
 

Get all the available data/telemetry elements that this class can provide. Each of the returned keys can be passed to the get/set functions to get/set that member data.

Definition at line 98 of file VLight.cpp.

References TLMDataIF::DOUBLE, TLMDataIF::getAvailableData(), and traceId.

Here is the call graph for this function:

void VLight::getColor GLenum  mode,
double &  red,
double &  green,
double &  blue,
double &  alpha
const
 

Definition at line 418 of file VLight.cpp.

References myLightNum, and traceId.

Referenced by getDataValue(), and setDataValue().

void VLight::getConstantAttenuation double &  att  )  const
 

Definition at line 481 of file VLight.cpp.

References myLightNum, and traceId.

Referenced by getDataValue().

bool VLight::getDataValue const TLMDataIF::Key key,
string &  data
const [virtual]
 

Get the value of a particular data/telemetry element.

Parameters:
key A valid key as returned by the getAvailableData function
data The returned data. All data is returned as a string regardless of the actual type.
Returns:
true if the data was found in this class and the data parameter was set to its value. false otherwise

Reimplemented from TLMDataIF.

Definition at line 149 of file VLight.cpp.

References getColor(), getConstantAttenuation(), TLMDataIF::getDataValue(), getDirection(), getLinearAttenuation(), getPosition(), getQuadraticAttenuation(), and traceId.

Here is the call graph for this function:

void VLight::getDirection double &  x,
double &  y,
double &  z
const
 

Definition at line 395 of file VLight.cpp.

References myCallList, myPosition, and traceId.

Referenced by getDataValue(), and setDataValue().

void VLight::getLinearAttenuation double &  att  )  const
 

Definition at line 496 of file VLight.cpp.

References myLightNum, and traceId.

Referenced by getDataValue().

void VLight::getPosition double &  x,
double &  y,
double &  z
const
 

Definition at line 375 of file VLight.cpp.

References myPosition, and traceId.

Referenced by getDataValue(), and setDataValue().

void VLight::getQuadraticAttenuation double &  att  )  const
 

Definition at line 511 of file VLight.cpp.

References myLightNum, and traceId.

Referenced by getDataValue().

void VLight::getSpotCutoff double &  cutoff  )  const
 

Definition at line 466 of file VLight.cpp.

References myLightNum, and traceId.

void VLight::getSpotDirection double &  x,
double &  y,
double &  z
const
 

Definition at line 436 of file VLight.cpp.

References myLightNum, and traceId.

void VLight::getSpotExponent double &  exp  )  const
 

Definition at line 451 of file VLight.cpp.

References myLightNum, and traceId.

bool VLight::initFromXML const wxXmlNode &  lightNode  ) 
 

Initialize the light from an XML node. This creates the light.

Definition at line 21 of file VLight.cpp.

References XMLUtil::findChildWithName(), XMLUtil::findPropertyWithName(), setColor(), setDirection(), setPosition(), traceId, and warnMsg.

Here is the call graph for this function:

GLenum VLight::lightNum  )  const [inline]
 

Definition at line 162 of file VLight.h.

References myLightNum.

Referenced by name().

string VLight::name  )  const
 

Get a text name for this light.

Definition at line 604 of file VLight.cpp.

References lightNum().

Here is the call graph for this function:

void VLight::setColor GLenum  mode,
const double  red,
const double  green,
const double  blue,
const double  alpha
 

set the color of the light.

Parameters:
mode There are three 'modes' for a light: GL_AMBIENT, GL_DIFFUSE or GL_SPECULAR. Ambient is non-directional light which is scattered equally when it hits a surface. Diffuse light is directional light that is scattered equally after hitting a surface. Specular light is directionaly light that bounces off a surface in a prefered direction Defaults: ambient(0,0,0,1), diffuse or specular(1,1,1,1) for GL_LIGHT0 diffuse or specular(0,0,0,1) for all others

Definition at line 410 of file VLight.cpp.

References myLightNum, and traceId.

Referenced by initFromXML(), and setDataValue().

void VLight::setConstantAttenuation const double  att  ) 
 

set the constant attenuation. All components of a light are attenuated. Setting this can slow down the lighting model This is only available for a positional light (see setPosition) Defaults are constant=1, linear=0, quadratic=0

Definition at line 474 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

Referenced by setDataValue().

bool VLight::setDataValue const TLMDataIF::Key key,
const string &  data
[virtual]
 

Set the value of a particular data/telemetry element.

Parameters:
key A valid key as returned by the getAvailableData function
data The data to set. All data is provided as a string regardless of the actual type.
Returns:
true if the data was found in this class and the data parameter was set to its value. false otherwise

Reimplemented from TLMDataIF.

Definition at line 258 of file VLight.cpp.

References getColor(), getDirection(), getPosition(), setColor(), setConstantAttenuation(), TLMDataIF::setDataValue(), setDirection(), setLinearAttenuation(), setPosition(), setQuadraticAttenuation(), and traceId.

Here is the call graph for this function:

void VLight::setDirection const double  x,
const double  y,
const double  z
 

Set the direction of the light. This is mutually exclusive with the setPosition function. A directional light is considered to be coming from a point infinitly far away in the given direction

Definition at line 388 of file VLight.cpp.

References myCallList, myPosition, and traceId.

Referenced by initFromXML(), and setDataValue().

void VLight::setLinearAttenuation const double  att  ) 
 

set the linear attenuation. All components of a light are attenuated. Setting this can slow down the lighting model This is only available for a positional light (see setPosition) Defaults are constant=1, linear=0, quadratic=0

Definition at line 489 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

Referenced by setDataValue().

void VLight::setPosition const double  x,
const double  y,
const double  z
 

Set the position of the light. This is mutually exclusive with the setDirection function. A light can have a position in the world. This sets that position. This only matters for the specular and diffuse components of the light.

Definition at line 368 of file VLight.cpp.

References myCallList, myPosition, and traceId.

Referenced by initFromXML(), and setDataValue().

void VLight::setQuadraticAttenuation const double  att  ) 
 

set the quadratic attenuation. All components of a light are attenuated. Setting this can slow down the lighting model This is only available for a positional light (see setPosition) Defaults are constant=1, linear=0, quadratic=0

Definition at line 504 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

Referenced by setDataValue().

void VLight::setSpotCutoff const double  cutoff  ) 
 

set the cuttoff attribute for a spotlight This is only available for a positional light (see setPosition) Default is cutoff=180

Definition at line 459 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

void VLight::setSpotDirection const double  x,
const double  y,
const double  z
 

set the direction attributes for a spotlight This is only available for a positional light (see setPosition) Defaults are direction=(0,0,-1)

Definition at line 428 of file VLight.cpp.

References myCallList, myLightNum, and traceId.

void VLight::setSpotExponent const double  exp  ) 
 

set the exponent attribute for a spotlight This is only available for a positional light (see setPosition) Default is exponent=0

Definition at line 444 of file VLight.cpp.

References myCallList, myLightNum, and traceId.


Member Data Documentation

GLuint VLight::myCallList [mutable, protected]
 

A call list used to speed up drawing

Definition at line 169 of file VLight.h.

Referenced by cleanup(), draw(), getDirection(), setConstantAttenuation(), setDirection(), setLinearAttenuation(), setPosition(), setQuadraticAttenuation(), setSpotCutoff(), setSpotDirection(), and setSpotExponent().

GLenum VLight::myLightNum [protected]
 

The light number GL_LIGHT0 - GL_LIGHT7.

Definition at line 168 of file VLight.h.

Referenced by cleanup(), draw(), getColor(), getConstantAttenuation(), getLinearAttenuation(), getQuadraticAttenuation(), getSpotCutoff(), getSpotDirection(), getSpotExponent(), lightNum(), setColor(), setConstantAttenuation(), setLinearAttenuation(), setQuadraticAttenuation(), setSpotCutoff(), setSpotDirection(), setSpotExponent(), and VLight().

GLfloat VLight::myPosition[4] [protected]
 

The position of this light. The position has to be stored because of how we light the scene as the camera moves. The light position is set every frame after the camera matrix has been set. This way the light doesn't move with the camera. However, this moves the light so we have to keep the original position around

Definition at line 176 of file VLight.h.

Referenced by draw(), getDirection(), getPosition(), setDirection(), setPosition(), and VLight().


The documentation for this class was generated from the following files:
Generated on Sat Dec 3 10:48:30 2005 for Robotics by  doxygen 1.4.5