My Project
Public Member Functions | Public Attributes | List of all members
RayLight Class Referenceabstract

#include <rayLight.h>

Inheritance diagram for RayLight:
RayDirectionalLight RayPointLight RaySpotLight

Public Member Functions

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

Public Attributes

Point3D color
 

Detailed Description

This abstract class represents a light source in the scene.

Member Function Documentation

virtual void RayLight::drawOpenGL ( int  index)
pure virtual

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

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual Point3D RayLight::getDiffuse ( Point3D  cameraPosition,
struct RayIntersectionInfo iInfo 
)
pure 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].

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual Point3D RayLight::getSpecular ( Point3D  cameraPosition,
struct RayIntersectionInfo iInfo 
)
pure 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].

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual int RayLight::isInShadow ( struct RayIntersectionInfo iInfo,
class RayShape shape 
)
pure 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.

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual int RayLight::read ( FILE *  fp)
pure virtual

This virtual method is responsible for reading in the light from a .ray file.

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual Point3D RayLight::transparency ( struct RayIntersectionInfo iInfo,
class RayShape shape,
Point3D  cLimit 
)
pure 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].

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

virtual void RayLight::write ( FILE *  fp = stdout)
pure 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.

Implemented in RaySpotLight, RayPointLight, and RayDirectionalLight.

Member Data Documentation

Point3D RayLight::color

The color that the light source emits


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