Ray Tracer  2020
Public Member Functions | List of all members
AmbientLightSource Class Reference

Ambient light in a scene. More...

#include <AmbientLightSource.h>

Inheritance diagram for AmbientLightSource:
LightSource

Public Member Functions

 AmbientLightSource (const Colour &colour)
 AmbientLightSource constructor. More...
 
 AmbientLightSource (const AmbientLightSource &lightSource)
 AmbientLightSource copy constructor. More...
 
 ~AmbientLightSource ()
 AmbientLightSource destructor. More...
 
AmbientLightSourceoperator= (const AmbientLightSource &lightSource)
 AmbientLightSource assignment operator. More...
 
Colour getIlluminationAt (const Point &point) const
 Determine how much light reaches a Point from this AmbientLightSource. More...
 
double getDistanceToLight (const Point &point) const
 Distance factor for shadows from this light source. More...
 
Direction getLightDirection (const Point &point) const
 Direction from light source to a point. 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

Ambient light in a scene.

An AmbientLightSource represents background illumination in a scene. This is essentially a hack to avoid purely black shadows without having to model indirect lighting, which can be expensive.

Constructor & Destructor Documentation

◆ AmbientLightSource() [1/2]

AmbientLightSource::AmbientLightSource ( const Colour colour)

AmbientLightSource constructor.

Parameters
colourThe Colour of light emitted by the AmbientLightSource.

◆ AmbientLightSource() [2/2]

AmbientLightSource::AmbientLightSource ( const AmbientLightSource lightSource)

AmbientLightSource copy constructor.

Parameters
lightSourceThe AmbientLightSource to copy to this.

◆ ~AmbientLightSource()

AmbientLightSource::~AmbientLightSource ( )

AmbientLightSource destructor.

Member Function Documentation

◆ getDistanceToLight()

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

Distance factor for shadows from this light source.

Ambient light sources cast no shadows, so this returns -1 as a flag.

Returns
-1
See also
getDirectionToLight()

Implements LightSource.

◆ getIlluminationAt()

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

Determine how much light reaches a Point from this AmbientLightSource.

For an AmbientLightSource this is just the Colour of the light.

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

Implements LightSource.

◆ getLightDirection()

Direction AmbientLightSource::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. We can return any value for AmbientLightSource, since it will never be used.

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

Implements LightSource.

◆ operator=()

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

AmbientLightSource assignment operator.

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

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