After discussing this, it was decided that I would rewrite it in C++, and that it needs to be lean, and that I do not need to spend a lot of time documenting the code and explaining how everything works in comments and docs. As part of it being lean, I chose to leave everything in one admittedly long file, (an honored C/C++ tradition).
This program requires libpng to compile. To run the ray tracer, just compile and link the library, then execute it. If you wish to alter the scene, the scene description is at the bottom of the file in the main function.
This ray tracer is almost a complete port of my previous Java ray tracer. See that project for more information on how my specific ray tracer works. For more general information on how ray tracing works, Wikipedia has a fairly user-friendly description.
- Since I wrote this with as little documentation as possible, I was certain to name everything very clearly.
- All parameters are designated at the bottom of the file in the main function. The choice not to have file input or command-line parameters was out of concern for bloating the already long file.
- I initially had issues with memory leakage, using up several gigabytes of space and rising while tracing. This was solved quickly. The tracing is stable, and I made sure that even the program completion is free of leaks.