229 points · by bwidlar · 7y ago · 51 comments
https://github.com/glouw/gel/blob/master/main.c
But you are right. It does take some ingenuity to make it clean.
Can anyone clarify?
*not exactly, there’s a couple of features that map differently. But there's a 1:1 TS to JS conversion.
What you type is usually considered what it's implemented in, not what it's compiled/transpiled to. The later is the target language, which there may be many.
This differentiation is required if you want to modify/read the code. You would almost certainly modify/read it in the language it was implemented in, and make it clear which language this is when sharing.
Maybe "...implemented in TS, targeting JS" or at least something more obvious like "...implemented in JS using TS".
As someone with very little knowledge of computer graphics, are there any resources anyone would recommend in order to learn how to build something like this?
Note that when you're building test cases, matrix multiplication is not commutative.
My high school teacher literally just pointed me at the Wikipedia article and said go:
https://en.wikipedia.org/wiki/Matrix_multiplication
The next step up from that is to then render meshes using some form of projection (isometric or perspective). You'll need to figure out how to actually map the drawing to the screen at that point. (In high school we just used the built-in 2D methods in Java. Some of my classmates then went on to shading and textures, but I didn't quite get that far.)
https://en.wikipedia.org/wiki/Ray_casting
Of course it has more to do with raytracing than with 3D projections (which is most often used for real time 3D rendering). If you want to learn about 3D projections, first you should understand what linear algebra has to do with projecting a 3D model on a 2D screen. This is probably a good start.
https://en.wikipedia.org/wiki/3D_projection
And then, learning about matrix multiplications makes sense.
For rendering at rates measured in seconds per frame, consider the "Physically Based Rendering Textbook", currently on its 3rd edition. https://www.pbrt.org/
Also nice to see a Douglas Crockford book (who is not a fan of TS BTW) ...
Anyways I star'd this repo ... very impressive +1
This project is awesome though.