3 ms·
How does one go about making stuff like this?
by john2x 15y ago
How does one go about making stuff like this?
- JonnieCache 15y agoI imagine it requires an absolute mastery of, but also a certain profound contempt for the C language. If preprocessors were people, the organisers of the IOCCC would be up before the hague.
- a1k0n 15y agoIt's really not that hard, once you have some idea of the kind of program you're writing. Write it out normally, and start eliminating everything that can be eliminated (in particular, whitespace, braces, if statements that can be conditionals, subroutines, variables, etc). Takes some ingenuity with loops but it's mostly straightforward. In this particular example the only really odd thing about it is the lighting calculation, which is an algebraically simplified dot product of the light direction (0, 1, -1) IIRC with the surface normal of a torus (gradient of the equation defining the shape). The derivation of that is long gone but it wasn't hard math.