Ray Tracer
2020
|
Abstract base class for Objects. More...
#include <Object.h>
Public Member Functions | |
virtual std::vector< RayIntersection > | intersect (const Ray &ray) const =0 |
Object-Ray intersection computation. More... | |
Public Attributes | |
Transform | transform |
A 3D transformation to apply to this Object. More... | |
Material | material |
The colour and reflectance properties of the Object. More... | |
Protected Member Functions | |
Object () | |
Object default constructor. More... | |
Object (const Object &object) | |
Object copy constructor. More... | |
virtual | ~Object () |
Object destructor. More... | |
Object & | operator= (const Object &object) |
Object assignment operator. More... | |
Abstract base class for Objects.
An Object is a geometric entity that can be seen in a camera, such as a Sphere. The term 'Object' is commonly used, but creates a bit of tension with the 'object' in 'object-oriented programming'. For this documentation a 'big-O' Object is a thing that can be seen by a camera, and a 'little-o' object is a data structure with members and methods etc. Hopefully this will be clear from context anyway.
Different types of Object are distinguished primarily by their intersect() functions, which determine how a given Ray intersects the surface of the Object. An Object is usually created at the origin with some standard dimensions. They can then me moved, rotated, and resized through their transform member.
As an abstract base class, you cannot create an Object directly. Instead one of its concrete subclasses must be created.
|
protected |
Object default constructor.
|
protected |
|
protectedvirtual |
Object destructor.
|
pure virtual |
Object-Ray intersection computation.
Given a Ray in space, this finds the point(s) of intersection with the surface of the Object. Note that there may be 0, 1, or more intersection points, and so a std::vector of RayIntersections is returned.
The details of this depend on the geometry of the particular Object, so this is a pure virtual method.