Follow the book The Ray Tracer Challenge to build a 3D renderer
1.cmake && make
The executables are placed in bin
.
Projectile cannon test: src/cannon_test
I implemented a simple char canvas, in OOP style.
src/canvas/canvas.h
Tried ncurses
, maybe later for more sophisticated usage.
Currently using Apple's simd
library.
src/geometry/transform.h
- Scaling
- Translate
- Shearing
src/geometry/sphere.h
and src/ray/
src/lights/
: Light struct andlignting
functionsrc/colors/
: RGB to Luma conversionsrc/canvas/
:writeLumaPixels
write char according to converted Luma index.src/ray_test.c
: Light rendering on the sphere.
Implemented shadow rendering.
Add ascii true color output in src/canvas/canvas.h
- Refactor
src/geometry
to support OOP-style shape data struct. - Implemented Plane type.
src/geometry/pattern
stripe, gradient, ring and checkboard.- Use EPSILON to avoid
acne
. (From float point error)
- Adjust previous code to support reflection calculations and reflection color determination.
- Avoid infinite recursion.