Closed BlackDoomer closed 4 years ago
Hmm, I've to give this some thought. Column major makes more sense, you need the columns more often than the rows for geometrical computations (they form the base of the local coordinate system). Also on many architectures it's more cache friendly, memory locations running with different stride will prevent matrix rows from competing for the same cache lines as vectors when doing the dot products of matrix-matrix multiplication.
Yes, you're right – and that's the reason why row-major mode is optional and non-default. But it's more convenient in some cases and more traditional - from point of view of linear algebra. So, I see no reason to reject this additional functionality. :)
BTW, I've made commit history more clear.
This PR adds ability to set row major computations order for matrices by definition of
MAT4X4_ROW_MAJOR
before inclusion of the library. It also fixes some implicit typecasts (includes PRs #8 and #10 as well) and adds two functions:mat4x4_set_row()
andmat4x4_set_col()
that were necessary for row major support. See commits for details.