|
raytracer
Parallel Ray Tracer written from scratch (no graphics API).
|
#include <material.h>

Public Member Functions | |
| virtual | ~Material ()=default |
| virtual Ray | get_scattered (const Ray &ray_in, const common::Vec3 &intersection, const common::Vec3 &normal) const =0 |
| virtual common::Vec3 | get_color (const Ray &ray_in, const common::Vec3 &intersection, const common::Vec3 &normal) const =0 |
| virtual MaterialType | get_type () const =0 |
Static Public Member Functions | |
| 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) |
The surface of an object, which determines how rays bounce off of it and which color they pick up.
|
virtualdefault |
|
nodiscardpure virtual |
Computes the color the surface contributes to a ray that hits it, which is multiplied with the color of the scattered ray.
| ray_in | The incoming ray. |
| intersection | The point where the incoming ray hits the surface. |
| normal | The normal to the surface at the intersection point. |
Implemented in raytracer::raytracer::Dielectric, raytracer::raytracer::Lambertian, raytracer::raytracer::LambertianTexture, and raytracer::raytracer::Metal.
|
nodiscardpure virtual |
Computes the ray that leaves the surface after an incoming ray hits it.
| ray_in | The incoming ray. |
| intersection | The point where the incoming ray hits the surface. |
| normal | The normal to the surface at the intersection point. |
Implemented in raytracer::raytracer::Dielectric, raytracer::raytracer::Lambertian, and raytracer::raytracer::Metal.
|
nodiscardpure virtual |
Returns the type of the material, used to identify the concrete class.
Implemented in raytracer::raytracer::Dielectric, raytracer::raytracer::Lambertian, raytracer::raytracer::LambertianTexture, and raytracer::raytracer::Metal.
|
static |
Reflects a direction vector about a surface normal, like a mirror.
| dir_in | The direction of the incoming ray. |
| normal | The normal to the surface at the point of reflection. |


|
static |
Refracts a direction vector through a surface, according to Snell's law.
| dir_in | The direction of the incoming ray. |
| normal | The normal to the surface at the point of refraction. |
| refractive_index | The ratio between the refractive index of the medium the ray leaves and that of the medium it enters. |

