My Project
Public Member Functions | Public Attributes | List of all members
RayPointLight Class Reference

#include <rayPointLight.h>

Inheritance diagram for RayPointLight:
RayLight

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, class RayShape *shape)
 
Point3D transparency (struct RayIntersectionInfo &iInfo, class RayShape *shape, Point3D cLimit)
 
void drawOpenGL (int index)
 

Public Attributes

Point3D location
 
double constAtten
 
double linearAtten
 
double quadAtten
 
- Public Attributes inherited from RayLight
Point3D color
 

Detailed Description

This class describes a point-light light-source. This light has a fixed position and the light attenuates as function of the distance from the light-source.

Member Function Documentation

void RayPointLight::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 RayPointLight::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 RayPointLight::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 RayPointLight::isInShadow ( struct RayIntersectionInfo iInfo,
class RayShape shape 
)
virtual

This virtual method tests if the intersection point represented by iInfo is in shadow from the light source. The returned value is either 0 if the intersection point is not in shadow or 1 if it is.

Implements RayLight.

int RayPointLight::read ( FILE *  fp)
virtual

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

Implements RayLight.

Point3D RayPointLight::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. The returned value is a 3D point whose coefficients should all be in the range [0,1].

Implements RayLight.

void RayPointLight::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 RayPointLight::constAtten

The constant term of the attenuation equation

double RayPointLight::linearAtten

The linear term of the attenuation equation

Point3D RayPointLight::location

The position of the spot-light

double RayPointLight::quadAtten

The quadratic term of the attenuation equation


The documentation for this class was generated from the following files: