Raytracer on the back of a business card. (AKA: You suck at C++, pwnt edition) via @AngryMoose
There is a challenge to write a raytracer that fits on a business card. Wow. Read this wonderful dissection of how to do magic: http://fabiensanglard.net/rayTracing_back_of_business_card/index.php
I wrote one already, but it was in whitespace and the printer used a strange font with non-standard tab lengths... So, uh, yeah.
P.S. I think my favorite thing is the minimal for loops. I was like, wait, why is he decrementing in the chec- Ooooohhhhhh. Dayum.
I wrote one already, but it was in whitespace and the printer used a strange font with non-standard tab lengths... So, uh, yeah.
P.S. I think my favorite thing is the minimal for loops. I was like, wait, why is he decrementing in the chec- Ooooohhhhhh. Dayum.
Thanked by 1Merrik
Comments
Isn't it stuff like this that makes people say building their own engines are cool? :P
For one thing, this is a constraint-based thing, not a years-long epic crusade to completely waste your own time ;)
These were my steps for compiling and running with g++:
1] g++ -O3 -o ray ray.cpp
2] ./ray > ray.ppm
3] xdg-open ray.ppm
[Edit] ray.cpp is where I copy-and-pasted the code. The last step is opening the file ray.ppm in an image viewer.