Software ray-tracer written in C. Inspired by, The Ray Tracer Challenge by Jamis Buck.
To build run meson setup build
, then meson compile -C build
.
To run the tests, run meson test -C build
.
- Criterion 2.4.2 (Optional, only required for the tests)
The project roughly follows the structure laid out by the book, deviating where deemed necessary.
Directory | Use |
---|---|
src |
Source code and header files |
test |
Test source code |
subprojects |
Meson subprojects (dependencies, e.g. Criterion) |
LSAN-suppresions.txt |
Clang LeakSanitizer suppressions file |
Module | Files | Notes |
---|---|---|
Tuples | tuples.c , tuples.h |
Chapter 1; Unused, merged into Vectors |
Canvas | canvas.c , canvas.h |
Chapter 2 |
Matrices | matrices.c , matrices.h |
Chapter 3; Unused, merged into Vectors |
Vectors | vectors.c , vectors.h |
Chapter 1, 3, 4 |
Rays | rays.c , rays.h |
Chapter 5, 6, 7, 8, 9; Demo sphere , lighting , camera , shadows , planes |
Source code for this demo is located in test/sphere.c
.
It shows two spheres in 3D space rendeded by casting rays on a canvas.
No shading or light simulation is done, thus the lack of "depth".
Source code for this demo is located in test/lighting.c
.
It shows a sphere that is lit by a point light.
Source code for this demo is located in test/camera.c
(dd88842).
It shows three spheres surrounded by two "walls" and a "floor".
Source code for this demo is located in test/shadows.c
.
It shows three spheres surrounded by two "walls" and a "floor", illuminated by two light sources.
Source code for this demo is located in test/planes.c
.
It shows three spheres, sitting on a plane, illuminated by three colored lights.