raytracer
Parallel Ray Tracer written from scratch (no graphics API).
Loading...
Searching...
No Matches
raytracer::raytracer::Dielectric Class Reference

#include <dielectric.h>

Inheritance diagram for raytracer::raytracer::Dielectric:
Collaboration diagram for raytracer::raytracer::Dielectric:

Public Member Functions

 Dielectric (double eta)
Ray get_scattered (const Ray &ray_in, const common::Vec3 &intersection, const common::Vec3 &normal) const override
common::Vec3 get_color (const Ray &ray_in, const common::Vec3 &intersection, const common::Vec3 &normal) const override
double get_refractive_index () const
MaterialType get_type () const override
Public Member Functions inherited from raytracer::raytracer::Material
virtual ~Material ()=default

Additional Inherited Members

Static Public Member Functions inherited from raytracer::raytracer::Material
static common::Vec3 reflect (const common::Vec3 &dir_in, const common::Vec3 &normal)
static common::Vec3 refract (const common::Vec3 &dir_in, const common::Vec3 &normal, double refractive_index)

Detailed Description

A transparent material, like glass or water, which refracts rays passing through it (or reflects them when refraction is impossible).

Constructor & Destructor Documentation

◆ Dielectric()

raytracer::raytracer::Dielectric::Dielectric ( double eta)
explicit

Creates a dielectric material with the given refractive index.

Parameters
etaThe refractive index of the material, relative to air.

Member Function Documentation

◆ get_color()

common::Vec3 raytracer::raytracer::Dielectric::get_color ( const Ray & ray_in,
const common::Vec3 & intersection,
const common::Vec3 & normal ) const
nodiscardoverridevirtual

Computes the color the surface contributes to a ray that hits it, which is multiplied with the color of the scattered ray.

Parameters
ray_inThe incoming ray.
intersectionThe point where the incoming ray hits the surface.
normalThe normal to the surface at the intersection point.
Returns
The color of the surface at the intersection point.

Implements raytracer::raytracer::Material.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_refractive_index()

double raytracer::raytracer::Dielectric::get_refractive_index ( ) const
nodiscard

Getter for the refractive index of the material.

Returns
The refractive index of the material.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_scattered()

Ray raytracer::raytracer::Dielectric::get_scattered ( const Ray & ray_in,
const common::Vec3 & intersection,
const common::Vec3 & normal ) const
nodiscardoverridevirtual

Computes the ray that leaves the surface after an incoming ray hits it.

Parameters
ray_inThe incoming ray.
intersectionThe point where the incoming ray hits the surface.
normalThe normal to the surface at the intersection point.
Returns
The scattered ray, starting at the intersection point.

Implements raytracer::raytracer::Material.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_type()

MaterialType raytracer::raytracer::Dielectric::get_type ( ) const
inlinenodiscardoverridevirtual

Returns the type of the material, used to identify the concrete class.

Returns
The type of the material.

Implements raytracer::raytracer::Material.


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