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

#include <metal.h>

Inheritance diagram for raytracer::raytracer::Metal:
Collaboration diagram for raytracer::raytracer::Metal:

Public Member Functions

 Metal (const common::Vec3 &_albedo, double _fuzz)
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
common::Vec3 get_albedo () const
double get_fuzz () 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 reflective material, which reflects rays like a mirror, optionally perturbed by a fuzz factor.

Constructor & Destructor Documentation

◆ Metal()

raytracer::raytracer::Metal::Metal ( const common::Vec3 & _albedo,
double _fuzz )

Creates a metal material with the given properties.

Parameters
_albedoThe color of the material.
_fuzzHow much the reflected rays are randomly perturbed. Zero means a perfect mirror.

Member Function Documentation

◆ get_albedo()

common::Vec3 raytracer::raytracer::Metal::get_albedo ( ) const
nodiscard

Getter for the albedo of the material.

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

◆ get_color()

common::Vec3 raytracer::raytracer::Metal::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_fuzz()

double raytracer::raytracer::Metal::get_fuzz ( ) const
nodiscard

Getter for the fuzz factor of the material.

Returns
The fuzz factor of the material.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_scattered()

Ray raytracer::raytracer::Metal::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::Metal::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:
  • raytracer/include/raytracer/materials/metal.h
  • raytracer/src/materials/metal.cpp