I've just finished libmymath v2.0.0. I switched to GLSL syntax, functions etc. So why?
Recently I did a lot of work on the GLSL side, and when I got back to libmymath I was wondering why do I need to keep in mind 2 syntaxes. Then came the idea that I should implement GLSL syntax, well, because I can't do the other way round.
Everything went fine, and because now I have way more experience with programming I believe I did quite a good job ( or you'll tell me I didn't ). This is true for the math side of things as well. Now I could clearly see the how matrices, vectors work, and also I could get a great insight into how GLSL works while implementing the GLSL specs.
The result? Math code that is copy-pasteable between GLSL and C++. So why is this good for you? Well, because you can test your algorithms BEFORE even touching the GPU, and you can numerically verify them working. This is especially important when working with complex equations. So I encourage you to copy paste code (of course you'll have to do texturing by hand).
I implemented swizzling as well, which means that this code is valid:
vec2 a(1, 2); vec4 b *= a.xyxy;I didn't use neither functions or macros to achieve this, so I believe this is a one-of-a-kind implementation that *exactly* follows the syntax and style of GLSL.
Most of the functions are tested, but I need you to test them, tell your opinion about what's wrong or missing. I also need so swizzles as well, because I couldn't get them all by hand. (see the includes folder). I tried to follow the GLSL specs as much as possible, but if I missed something please tell me.
So where can you grab it? On github of course: