Most of the changes in this patch are cosmetic (such as looping by
columns first.) HMM_Translate was incorrectly producing row-major
matrices, which should now be fixed.
Fixes#22
- Scalar multiplication of vectors and matrices
- This was present for only vec2's and vec3's using operator
overloading. In addition, there was only operator overloading for
[structure] * float, not float * [structure].
- Additionally, the two operators that were already defined were
updated to use the new C-style functions that were defined.
- Scalar division of vectors and matrices
- Matrix subtraction
- += operator for matrices
This is very useful for applications using homogeneous coordinates, since I can
take a vec3 representing a position or normal, and construct the appropriate
vec4 in homogeneous coordinates.
Some build environments build each source file individually to .o files
and then link after the fact. With inlined functions, this tends to
just produce empty .o files, undefined symbol errors, and grumpy
programmers like me.
This change simply adds the option to disable inlining of functions so
Handmade Math can function properly as a library unto itself.
Hlkpf3 on Mārtiņš Možeiko's comment:
i don't really want to be that guy here.. but it's the internet
and i have no free will: the new built-ins are using 'the function',
so they are not faster than 'the function' - they're just quicker at it.
also, many instruction sets don't offer that functionality yet.
and for some it doesn't make any sense. playstations and the nintendo wii,
for instance, were using powerpc - no. the nintendo wii u also doesn't
have it. the "new 3ds" should in theory be the first nintendo-device with
this intrinsic thanks to ARM11 NEON. can someone confirm that? heck,
some MPUs still don't even have floating-point units. i have heard of
a case where the energy-consumption of a sensor-network for
indoor-localisation could be halved by replacing the sqrt they used
for Pythagoras with this neat buddy here.