Assignments
Assignments
Ray::SpotLight Class Reference

#include <spotLight.h>

Inheritance diagram for Ray::SpotLight:
Ray::Light

Public Member Functions

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

Static Public Member Functions

static std::string Directive (void)
 

Private Member Functions

void _write (std::ostream &stream) const
 
void _read (std::istream &stream)
 

Private Attributes

Util::Point3D _location
 
Util::Point3D _direction
 
double _constAtten
 
double _linearAtten
 
double _quadAtten
 
double _cutOffAngle
 
double _dropOffRate
 

Additional Inherited Members

- Protected Attributes inherited from Ray::Light
Util::Point3D _ambient
 
Util::Point3D _diffuse
 
Util::Point3D _specular
 

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

◆ _read()

void SpotLight::_read ( std::istream &  stream)
privatevirtual

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

Implements Ray::Light.

◆ _write()

void SpotLight::_write ( std::ostream &  stream) const
privatevirtual

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

Implements Ray::Light.

◆ Directive()

static std::string Ray::SpotLight::Directive ( void  )
inlinestatic

This static method returns the directive describing the Light.

◆ drawOpenGL()

void SpotLight::drawOpenGL ( int  index,
GLSLProgram glslProgram 
) const
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.

Implements Ray::Light.

◆ getAmbient()

Point3D SpotLight::getAmbient ( Util::Ray3D  ray,
const class RayShapeIntersectionInfo iInfo,
const Material material 
) const
virtual

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

Implements Ray::Light.

◆ getDiffuse()

Point3D SpotLight::getDiffuse ( Util::Ray3D  ray,
const class RayShapeIntersectionInfo iInfo,
const Material material 
) const
virtual

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

Implements Ray::Light.

◆ getSpecular()

Point3D SpotLight::getSpecular ( Util::Ray3D  ray,
const class RayShapeIntersectionInfo iInfo,
const Material material 
) const
virtual

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

Implements Ray::Light.

◆ isInShadow()

bool SpotLight::isInShadow ( const class RayShapeIntersectionInfo iInfo,
const Shape shape,
unsigned int  tIdx 
) const

◆ name()

std::string Ray::SpotLight::name ( void  ) const
inlinevirtual

This method returns the name of the shape

Implements Ray::Light.

◆ transparency()

Point3D SpotLight::transparency ( const class RayShapeIntersectionInfo iInfo,
const class Shape shape,
Util::Point3D  cLimit,
unsigned int  samples,
unsigned int  tIdx 
) const
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.

Implements Ray::Light.

Member Data Documentation

◆ _constAtten

double Ray::SpotLight::_constAtten
private

The constant term of the attenuation equation

◆ _cutOffAngle

double Ray::SpotLight::_cutOffAngle
private

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

◆ _direction

Util::Point3D Ray::SpotLight::_direction
private

The preferred direction the outgoing light rays

◆ _dropOffRate

double Ray::SpotLight::_dropOffRate
private

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

◆ _linearAtten

double Ray::SpotLight::_linearAtten
private

The linear term of the attenuation equation

◆ _location

Util::Point3D Ray::SpotLight::_location
private

The position of the spot-light

◆ _quadAtten

double Ray::SpotLight::_quadAtten
private

The quadratic term of the attenuation equation


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