A C99 implementation of the ray tracer from Peter Shirley’s Ray Tracing in One Weekend. It follows the book’s progression step by step, in plain, portable C instead of C++, and writes the result to a PNG.
Features
- Pure C99: no C++ features to lean on, so vectors, materials and the camera are all plain structs and functions
- Cross-platform: builds on Linux, macOS and Windows, with CI on GitHub Actions
- Runs on a PSP 3000
Tech
- C99
- CMake 3.26+ with CPM.cmake for dependencies
What I learned
- Translating the book’s C++ class hierarchy into C99 structs and function tables.
- Where a CPU ray tracer spends its time, and what that means on constrained hardware.
Links