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

#include <object.h>

Inheritance diagram for raytracer::raytracer::Object:

Public Member Functions

virtual ~Object ()=default
 Object (std::unique_ptr< const Material > _mat)
const Material * get_material () const
virtual double ray_intersection (const Ray &r) const =0
virtual common::Vec3 get_normal (const common::Vec3 &point) const =0
virtual ObjectType get_type () const =0

Detailed Description

A shape in the scene that rays can hit, made of a single material.

Constructor & Destructor Documentation

◆ ~Object()

virtual raytracer::raytracer::Object::~Object ( )
virtualdefault

◆ Object()

raytracer::raytracer::Object::Object ( std::unique_ptr< const Material > _mat)
inlineexplicit

Creates an object with the given material.

Parameters
_matThe material of the object, owned by the object.
Here is the caller graph for this function:

Member Function Documentation

◆ get_material()

const Material * raytracer::raytracer::Object::get_material ( ) const
inlinenodiscard

Returns a non-owning pointer to the material of the object.

Returns
A non-owning pointer to the material of the object.

◆ get_normal()

virtual common::Vec3 raytracer::raytracer::Object::get_normal ( const common::Vec3 & point) const
nodiscardpure virtual

Returns the normal to the surface of the object at a given point.

Parameters
pointA point on the surface of the object.
Returns
The normal to the surface at that point.

Implemented in raytracer::raytracer::Floor, and raytracer::raytracer::Sphere.

◆ get_type()

virtual ObjectType raytracer::raytracer::Object::get_type ( ) const
nodiscardpure virtual

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

Returns
The type of the object.

Implemented in raytracer::raytracer::Floor, and raytracer::raytracer::Sphere.

◆ ray_intersection()

virtual double raytracer::raytracer::Object::ray_intersection ( const Ray & r) const
nodiscardpure virtual

Computes the distance along a ray at which it first hits the object.

Parameters
rThe ray to intersect with the object.
Returns
The value t such that r.origin + r.direction * t is the intersection point, or a negative value if the ray does not hit the object.

Implemented in raytracer::raytracer::Floor, and raytracer::raytracer::Sphere.


The documentation for this class was generated from the following file:
  • raytracer/include/raytracer/shapes/object.h