mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:57:45 +00:00
LibGfx: Make Matrix class consistently row-major
Matrix elements were interpreted in different ways. This makes it definitely row-major, allowing initialization via initializer list in a standard scientific order. Also matrix multiplication now happens in the correct order and accessing elements happens as m_elements[row][column].
This commit is contained in:
parent
a5194274af
commit
0833db0874
4 changed files with 49 additions and 31 deletions
|
@ -37,11 +37,14 @@ void glPopMatrix()
|
|||
|
||||
void glLoadMatrixf(const GLfloat* matrix)
|
||||
{
|
||||
// Transpose the matrix here because glLoadMatrix expects elements
|
||||
// in column major order but out Matrix class stores elements in
|
||||
// row major order.
|
||||
FloatMatrix4x4 mat(
|
||||
matrix[0], matrix[1], matrix[2], matrix[3],
|
||||
matrix[4], matrix[5], matrix[6], matrix[7],
|
||||
matrix[8], matrix[9], matrix[10], matrix[11],
|
||||
matrix[12], matrix[13], matrix[14], matrix[15]);
|
||||
matrix[0], matrix[4], matrix[8], matrix[12],
|
||||
matrix[1], matrix[5], matrix[9], matrix[13],
|
||||
matrix[2], matrix[6], matrix[10], matrix[14],
|
||||
matrix[3], matrix[7], matrix[11], matrix[15]);
|
||||
|
||||
g_gl_context->gl_load_matrix(mat);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue