- Add GUI
- Output to PNG or similar format instead of PPM
This project was made using the help of the Ray Tracing in One Weekend Book Series. While much of the code is provided in the afore-linked github repository, I typed everything by hand and have implemented features of my own, as is hopefully demonstrated by the commit history.
Defines class for storing 3D vectors. Can be used for locations, colours, directions, offsets, etc.
Describes relevant operators for operations between both scalars and other vector operands.e.g. +=, *=, +, -, etc.
Stores each value as a double
Has alias point3
Takes a pixel and writes its rgb values in PPM format, converting from linear to gamma 2.
Defines ray class that stores information about the ray and has an at(t) function to give the position along that ray at a given time/offset.
- Origin
- Direction
Position along the ray at a given time/offset can be given as:
Position(time) = origin + (time * direction)
Where origin is a 3D vector representing position, direction is a 3D unit vector, and time is a real value.
Defines a class that contains information about the camera all the functionality of the camera.
It should be constructed with no arguments, then the owning code will modify the camera's public variables through simple assignment, then the owning code should call the render function, passing in a world.
This pattern is chosen instead of the owner calling a constructor with a ton of parameters or by defining and calling a bunch of setter methods. Instead, the owning code only needs to set what it explicitly cares about.
- Aspect ratio
- Image width
- Samples per pixel
- Max depth of ray bounces
- Vertical view angle (vertical field of view)
- Point camera is looking from
- Point camera is looking at
- Camera-relative "up" direction
- Image height
- Color scale factor for a sum of pixels (pixel_samples_scale - To facilitate multiple samples, we add the full color from each sample, and then divide by the number of samples)
- Camera center
- Location of pixel (0, 0)
- Offset to pixel to the right (delta u)
- Offset to pixel below (delta v)
- Camera frame basis vectors (u, v, w)
- Defocus disk horizontal radius
- Defocus disk vertical radius
- Render
- Initialize (run at the beginning of every render)
- Get ray (Construct a camera ray originating from the defocus disk and directed at randomly sampled point around the pixel location i, j.)
- Sample square (Returns the vector to a random point in the [-.5,-.5]-[+.5,+.5] unit square.)
- Defocus disk sample (Returns a random point in the camera defocus disk.)
- Ray color (Returns color of a ray)
Defines abstract class for all objects which should be hittable to inherit from.
- Point
- Normal
- t (time/offset at which ray intersects object)
- Whether it is a front face
Stores a list of hittable objects. Uses shared_ptr to allow for instances and easier memory management.
- Add (an object)
- Hit (whether a ray hits anything)
Defines sphere class that inherets from hittable.h
Defines interval class that stores information about a real-valued interval and has procedures to get information about that data.
- Min point
- Max point
- Size
- Contains
- Surrounds