Main Page | Class Hierarchy | Class List | Class Members

RaySpotLight Class Reference

Inheritance diagram for RaySpotLight:

RayLight List of all members.

Public Member Functions

int read (FILE *fp)
void write (FILE *fp=stdout)
Point3D getDiffuse (Point3D cameraPosition, struct RayIntersectionInfo &iInfo)
Point3D getSpecular (Point3D cameraPosition, struct RayIntersectionInfo &iInfo)
int isInShadow (struct RayIntersectionInfo &iInfo, RayShape *shape, int &isectCount)
Point3D transparency (struct RayIntersectionInfo &iInfo, class RayShape *shape, Point3D cLimit)
void drawOpenGL (int index)

Public Attributes

Point3D location
Point3D direction
double constAtten
double linearAtten
double quadAtten
double cutOffAngle
double dropOffRate

Detailed Description

This class describes a spot-light light-source. This light has a fixed position in space and a fixed direction. The light attenuates both as a function of the distance from the light-source and the angle between the line from the light to the point and the light direction. The cutOffAngle specifies the angle beyond which the light has no contribution.


Member Function Documentation

void RaySpotLight::drawOpenGL int  index  )  [virtual]
 

This method calls the necessary OpenGL commands to render the light. index specifices the index of the light that is to be drawn.

Implements RayLight.

Point3D RaySpotLight::getDiffuse Point3D  cameraPosition,
struct RayIntersectionInfo iInfo
[virtual]
 

This virtual method returns the diffuse contribution of the light source to the specified hit location. It computes the amount of diffuse light reaching the hit location and scales that using the material properties of the hit location. The returned value is a 3D point whose coefficients should all be in the range [0,1].

Implements RayLight.

Point3D RaySpotLight::getSpecular Point3D  cameraPosition,
struct RayIntersectionInfo iInfo
[virtual]
 

This virtual method returns the specular contribution of the light source to the specified hit location. It computes the amount of diffuse light reaching the hit location, using the normal direction at the hit location (in iInfo), and scales that using the material properties of the hit location. The returned value is a 3D point whose coefficients should all be in the range [0,1].

Implements RayLight.

int RaySpotLight::isInShadow struct RayIntersectionInfo iInfo,
RayShape shape,
int &  isectCount
[virtual]
 

This virtual method tests if the intersection point represented by iInfo is in shadow from the light source. The value of isectCount is incremented according to the number of intersection tests performed in order to detemine if the point of intersection is in shadow. The returned value is either 0 if the the intersection point is not in shadow or 1 if it is.

Implements RayLight.

int RaySpotLight::read FILE *  fp  )  [virtual]
 

This method reads in the spot light from a .ray file.

Implements RayLight.

Point3D RaySpotLight::transparency struct RayIntersectionInfo iInfo,
class RayShape shape,
Point3D  cLimit
[virtual]
 

This virtual method tests if the intersection point represented by iInfo is in partial shadow from the light source. A ray is cast from the hit location to the light source, and the transparency values are accumulated. If the transparency value falls below cLimit, the testing terminates. In computing the transparency value, isectCount is incremented according to the number of intersection tests performed and rayCount is incremented according to the number of rays that need to be cast. The returned value is a 3D point whose coefficients should all be in the range [0,1].

Implements RayLight.

void RaySpotLight::write FILE *  fp = stdout  )  [virtual]
 

This virtual method is responsible for writing out the light source to a .ray file. If no file is specified, the light source is written out stdout.

Implements RayLight.


Member Data Documentation

double RaySpotLight::constAtten
 

The constant term of the attenuation equation

double RaySpotLight::cutOffAngle
 

The cut-off angle for the spot light (should be in the range [0,Pi/2])

Point3D RaySpotLight::direction
 

The preferred direction the outgoing light rays

double RaySpotLight::dropOffRate
 

The rate at which the intensity falls off as light travels in the non-preferred direction (should be in the range [0,128])

double RaySpotLight::linearAtten
 

The linear term of the attenuation equation

Point3D RaySpotLight::location
 

The position of the spot-light

double RaySpotLight::quadAtten
 

The quadratic term of the attenuation equation


Generated on Wed Feb 22 15:44:23 2006 for Assignment 2 by  doxygen 1.4.1