Path Tracer
Public Member Functions | List of all members
Material Class Referenceabstract

Abstrat class that models a material. More...

#include <Material.h>

Inheritance diagram for Material:
[legend]

Public Member Functions

 Material (DoubleVec3D emittance=0)
 Default and main constructor. More...
 
 Material (const Material &material)
 Copy constructor. More...
 
DoubleVec3D getEmittance () const
 Getter for the emittance attribute. More...
 
void setEmittance (DoubleVec3D emittance)
 Setter for the emittance attribute. More...
 
virtual MaterialdeepCopy () const =0
 Makes a deep copy of this material. More...
 
virtual DoubleUnitVec3D getNewDirection (const Ray &previousRay, const DoubleUnitVec3D &normal) const =0
 Computes the new ray direction. More...
 
virtual DoubleVec3D computeCurrentRadiance (const DoubleVec3D &recursiveRadiance, double cosAngleNewDirectionNormal, bool nextEventEstimation=false) const =0
 Computes the new radiance. More...
 
virtual bool worksWithNextEventEstimation () const =0
 Returns whether this material works with next event estimation. More...
 
virtual std::ostream & getDescription (std::ostream &stream) const =0
 Returns this material's description. More...
 
virtual std::string getType () const =0
 Returns this material type. More...
 
virtual json getSpecificParametersJson () const =0
 Converts this material's specific parameters to json. More...
 
virtual void setSpecificParametersJson (const json &j)=0
 Sets this material's specific parameters according to json. More...
 

Detailed Description

Abstrat class that models a material.

Constructor & Destructor Documentation

◆ Material() [1/2]

Material::Material ( DoubleVec3D  emittance = 0)

Default and main constructor.

Parameters
emittanceThe radiance this material emits.

◆ Material() [2/2]

Material::Material ( const Material material)

Copy constructor.

Parameters
materialThe material that will be copied.

Member Function Documentation

◆ computeCurrentRadiance()

DoubleVec3D Material::computeCurrentRadiance ( const DoubleVec3D recursiveRadiance,
double  cosAngleNewDirectionNormal,
bool  nextEventEstimation = false 
) const
pure virtual

Computes the new radiance.

Parameters
recursiveRadianceThe radiance recursively obtained.
cosAngleNewDirectionNormalThe cosine of the angle between the direction of the next ray and the normal at the intersection.
nextEventEstimationWhether the radiance is obtained using the next event estimation algorithm.
Returns
The new radiance.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ deepCopy()

Material * Material::deepCopy ( ) const
pure virtual

Makes a deep copy of this material.

Returns
A pointer to a deeply copied version of this material.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ getDescription()

std::ostream & Material::getDescription ( std::ostream &  stream) const
pure virtual

Returns this material's description.

Parameters
streamThe current stream.
Returns
The stream with the description.
See also
operator<<(std::ostream& stream, const Material& material)

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ getEmittance()

DoubleVec3D Material::getEmittance ( ) const

Getter for the emittance attribute.

Returns
The emittance of this material.

◆ getNewDirection()

DoubleUnitVec3D Material::getNewDirection ( const Ray previousRay,
const DoubleUnitVec3D normal 
) const
pure virtual

Computes the new ray direction.

Parameters
previousRayThe ray that hits this material.
normalThe normal at the intersection.
Returns
The new ray direction.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ getSpecificParametersJson()

json Material::getSpecificParametersJson ( ) const
pure virtual

Converts this material's specific parameters to json.

Returns
This material's specific parameters converted to json.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ getType()

std::string Material::getType ( ) const
pure virtual

Returns this material type.

Returns
"Diffuse", "Refractive" or "Specular", depending on the material instance.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ setEmittance()

void Material::setEmittance ( DoubleVec3D  emittance)

Setter for the emittance attribute.

Parameters
emittanceThe new emittance of this material.

◆ setSpecificParametersJson()

void Material::setSpecificParametersJson ( const json j)
pure virtual

Sets this material's specific parameters according to json.

Parameters
jThe json input.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.

◆ worksWithNextEventEstimation()

bool Material::worksWithNextEventEstimation ( ) const
pure virtual

Returns whether this material works with next event estimation.

Returns
True if this material works with the next event estimation algorithm, false else.

Implemented in SpecularMaterial, RefractiveMaterial, and DiffuseMaterial.


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