Assignments Assignments

Public Member Functions | Protected Attributes | Private Member Functions | List of all members
Ray::Light Class Referenceabstract

`#include <light.h>`

Inheritance diagram for Ray::Light:

## Public Member Functions
virtual | ~Light (void)
virtual std::string | name (void) const =0
virtual Util::Point3D | getAmbient (Util::Ray3D ray, const class RayShapeIntersectionInfo &iInfo, const Material &material) const =0
virtual Util::Point3D | getDiffuse (Util::Ray3D ray, const class RayShapeIntersectionInfo &iInfo, const Material &material) const =0
virtual Util::Point3D | getSpecular (Util::Ray3D ray, const class RayShapeIntersectionInfo &iInfo, const Material &material) const =0
virtual bool | isInShadow (const class RayShapeIntersectionInfo &iInfo, const class Shape &shape, unsigned int tIdx) const =0
virtual Util::Point3D | transparency (const class RayShapeIntersectionInfo &iInfo, const class Shape &shape, Util::Point3D cLimit, unsigned int samples, unsigned int tIdx) const =0
virtual void | drawOpenGL (int index, GLSLProgram *glslProgram) const =0

## Protected Attributes
Util::Point3D | _ambient
Util::Point3D | _diffuse
Util::Point3D | _specular

## Private Member Functions
virtual void | _write (std::ostream &stream) const =0
virtual void | _read (std::istream &stream)=0

## Detailed Description

This abstract class represents a light source in the scene.

## Constructor & Destructor Documentation

## ◆ ~Light()

virtual Ray::Light::~Light | ( | void |  | ) |
| inline virtual

The destructor

## Member Function Documentation

## ◆ _read()

virtual void Ray::Light::_read | ( | std::istream & | stream | ) |
| private pure virtual

This method reads the Light from the stream (excluding the starting directive)

Implemented in Ray::DirectionalLight, Ray::PointLight, Ray::SphereLight, and Ray::SpotLight.

## ◆ _write()

virtual void Ray::Light::_write | ( | std::ostream & | stream | ) | const
| private pure virtual

This method writes the Light into the stream (including the starting directive)

Implemented in Ray::DirectionalLight, Ray::PointLight, Ray::SphereLight, and Ray::SpotLight.

## ◆ drawOpenGL()

virtual void Ray::Light::drawOpenGL | ( | int | index,
|  | GLSLProgram * | glslProgram ) const
| pure virtual

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

Implemented in Ray::DirectionalLight, Ray::PointLight, and Ray::SpotLight.

## ◆ getAmbient()

virtual Util::Point3D Ray::Light::getAmbient | ( | Util::Ray3D | ray,
|  | const class RayShapeIntersectionInfo & | iInfo,
|  | const Material & | material ) const
| pure virtual

This method returns the ambient contribution of the light source to the specified hit location.

Implemented in Ray::DirectionalLight, Ray::PointLight, and Ray::SpotLight.

## ◆ getDiffuse()

virtual Util::Point3D Ray::Light::getDiffuse | ( | Util::Ray3D | ray,
|  | const class RayShapeIntersectionInfo & | iInfo,
|  | const Material & | material ) const
| pure virtual

This method returns the diffuse contribution of the light source to the specified hit location.

Implemented in Ray::DirectionalLight, Ray::PointLight, and Ray::SpotLight.

## ◆ getSpecular()

virtual Util::Point3D Ray::Light::getSpecular | ( | Util::Ray3D | ray,
|  | const class RayShapeIntersectionInfo & | iInfo,
|  | const Material & | material ) const
| pure virtual

This method returns the specular contribution of the light source to the specified hit location.

Implemented in Ray::DirectionalLight, Ray::PointLight, and Ray::SpotLight.

## ◆ isInShadow()

virtual bool Ray::Light::isInShadow | ( | const class RayShapeIntersectionInfo & | iInfo,
|  | const class Shape & | shape,
|  | unsigned int | tIdx ) const
| pure virtual

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

Implemented in Ray::DirectionalLight, and Ray::PointLight.

## ◆ name()

virtual std::string Ray::Light::name | ( | void |  | ) | const
| pure virtual

This method returns the name of the shape

Implemented in Ray::DirectionalLight, Ray::PointLight, Ray::SphereLight, and Ray::SpotLight.

## ◆ transparency()

virtual Util::Point3D Ray::Light::transparency | ( | const class RayShapeIntersectionInfo & | iInfo,
|  | const class Shape & | shape,
|  | Util::Point3D | cLimit,
|  | unsigned int | samples,
|  | unsigned int | tIdx ) const
| pure virtual

This 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 light source is an area light source, multiple rays area cast to (uniformly randomly chosen positions on the area light sources and the transparency is set to the average of the transparency values over the samples. If the transparency value falls below cLimit, the testing terminates.

Implemented in Ray::DirectionalLight, Ray::PointLight, Ray::SphereLight, and Ray::SpotLight.

## Member Data Documentation

## ◆ _ambient

Util::Point3D Ray::Light::_ambient
| protected

The ambient color of the light source

## ◆ _diffuse

Util::Point3D Ray::Light::_diffuse
| protected

The diffuse color of the light source

## ◆ _specular

Util::Point3D Ray::Light::_specular
| protected

The specular color of the light source

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

- Assignments/Ray/light.h