Ray Tracer  2020
Public Member Functions | Private Attributes | List of all members
DirectionalLightSource Class Reference

Light emitted from afar in a particular Direction. More...

#include <DirectionalLightSource.h>

Inheritance diagram for DirectionalLightSource:
LightSource

Public Member Functions

 DirectionalLightSource (const Colour &colour, const Direction &direction)
 DirectionalLightSource constructor. More...
 
 DirectionalLightSource (const DirectionalLightSource &lightSource)
 DirectionalLightSource copy constructor. More...
 
 ~DirectionalLightSource ()
 DirectionalLightSource destructor. More...
 
DirectionalLightSourceoperator= (const DirectionalLightSource &lightSource)
 DirectionalLightSource assignment operator. More...
 
Colour getIlluminationAt (const Point &point) const
 Determine how much light reaches a Point from this DirectionalLightSource. More...
 
double getDistanceToLight (const Point &point) const
 Determine how far away the light source is from a given Point. More...
 
Direction getLightDirection (const Point &point) const
 Direction from light source to a point. More...
 

Private Attributes

Direction direction_
 The Direction that this light source sheds light in. More...
 

Additional Inherited Members

- Protected Member Functions inherited from LightSource
 LightSource (const Colour &colour)
 LightSource constructor. More...
 
 LightSource (const LightSource &lightSource)
 LightSource copy constructor. More...
 
virtual ~LightSource ()
 LightSource destructor. More...
 
LightSourceoperator= (const LightSource &lightSource)
 LightSource assignment operator. More...
 
- Protected Attributes inherited from LightSource
Colour colour_
 The Colour of this LightSource's illumination. More...
 

Detailed Description

Light emitted from afar in a particular Direction.

A DirectionaLightSource represents parallel light rays from a given Direction. This is often used to represent a 'Sun' light source - a strong light source at a very large (practically infinite) distance.

Constructor & Destructor Documentation

◆ DirectionalLightSource() [1/2]

DirectionalLightSource::DirectionalLightSource ( const Colour colour,
const Direction direction 
)

DirectionalLightSource constructor.

This creates a LightSource with a specified Colour coming from a particular Direction

Parameters
colourThe Colour of the DirectionalLightSource
directionThe Direction of the DirectionalLightSource

◆ DirectionalLightSource() [2/2]

DirectionalLightSource::DirectionalLightSource ( const DirectionalLightSource lightSource)

DirectionalLightSource copy constructor.

Parameters
lightSourceThe DirectionalLightSource to copy to this.

◆ ~DirectionalLightSource()

DirectionalLightSource::~DirectionalLightSource ( )

Member Function Documentation

◆ getDistanceToLight()

double DirectionalLightSource::getDistanceToLight ( const Point point) const
virtual

Determine how far away the light source is from a given Point.

Since DirectionalLightSources have no real location, they are essentially at infinity.

Returns
infinity
See also
getDirectionToLight()

Implements LightSource.

◆ getIlluminationAt()

Colour DirectionalLightSource::getIlluminationAt ( const Point point) const
virtual

Determine how much light reaches a Point from this DirectionalLightSource.

The illumination from a DirectionalLightSource doesn't decay with distance.

Parameters
pointThe Point at which light is measured.
Returns
The illumination that reaches the Point from this DirectionalLightSource.

Implements LightSource.

◆ getLightDirection()

Direction DirectionalLightSource::getLightDirection ( const Point point) const
virtual

Direction from light source to a point.

Return a Direction pointing from the given point towards the light source.

Parameters
pointThe point where the ray is being computed.
Returns
The Direction from the point towards the light.
See also
getDistanceToLight()

Implements LightSource.

◆ operator=()

DirectionalLightSource & DirectionalLightSource::operator= ( const DirectionalLightSource lightSource)

DirectionalLightSource assignment operator.

Parameters
lightSourceThe DirectionalLightSource to copy to this.
Returns
A reference to this to allow for chaining of assignment.

Member Data Documentation

◆ direction_

Direction DirectionalLightSource::direction_
private

The Direction that this light source sheds light in.


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