Jamis Buck's Raytracer Challenge implemented in Ada.
- Chapter 1: Tuples, Points and Vectors
- Chapter 2: Canvas and PPM serialization
- Chapter 3: Matrices
- Chapter 4: Matrix Transformations
- Chapter 5: Ray-Sphere Intersections
- Chapter 6: Point Lights and Phong Shading
- Chapter 7: World and Camera (aka "Making a Scene")
- Chapter 8: Shadows
- Chapter 9: Planes
- Chapter 10: Patterns
- Chapter 11: Reflection and Refraction
- Chapter 12: Cubes
- Chapter 13: Cylinders and Cones
- Chapter 14: Groups
- Chapter 15: Triangles and OBJ format parsing
- Chapter 16: Constructive Solid Geometry
- YAML scene loader
- Render the cover of the book
- Area Lights, aka Soft Shadows
- Texture Mapping
- Final Boss: Render bust of Date Masamune
- Cache inverted transformation matrices
- Buffered implementation of Print_PPM
- Bounding Boxes and Hierarchies
- Concurrent Rendering with Tasking
- Reach a comfy development flow in Ada
- Debug with
gdb
- Profile with
gprof
- TDD with AUnit
- Grok GPRBuild and Alire
- Grok Spec/Body code division and layout
- Grok Buffered IO
- Grok Contracts (Pre, Post, Invariant, Predicate aspects)
- Grok Access Types, including heap allocation and deallocation
- Grok Containers
- Grok OOP
- Grok Tasking and Concurrency
- Set Up Dockerized Continuous Integration
- Set Up Code Coverage as part of CI/CD
- Build
gnatprove
for FSF GNAT - Grok SPARK 2014
- Set Up "Continuous Proving" as part of CI/CD
- Restrict as many language features as feasible like libFFA does
- Go completely off the heap (may be next to impossible)
The meat of the ray tracer is written as standalone Ada packages that are bundled in a static library named libradatracer.a
.
Each package maps roughly to one chapter of the book (some packages are iterated upon on subsequent chapters).
The library can be built with a GNAT toolchain and GPRBuild: gprbuild radatracer.gpr
This will produce out/libradatacer.a
A collection of "driver programs" that are linked to libradatracer.a
and use its functionality in several ways.
Each program maps roughly to the capstone exercises of each chapter (again, some programs are iterated upon).
To build the executables you also need Alire as well as GNAT and GPRBuild: alr build
The executables appear under out/
.
Altenatively you can use Alire to just download the only dependency of the project (AUnit) with alr clean
.
After the alire/
directory is created you can build the driver programs with GPRBuild, too: gprbuild executables.gpr
The test packages of an AUnit test suite that exercises libradatracer.a
The driver program for the test suite is one of the main executables mentioned above, bin/aunit_harness.adb
, so
it builds as part of the "driver program" collection.
A Gitlab pipeline builds the project and passes the tests with FSF GNAT 10.2 and 9.3 in a dockerized Ubuntu environment.
The 1maa/fsf-gnat
image used in the pipeline is generated from this Dockerfile.