-
Notifications
You must be signed in to change notification settings - Fork 25
Coding guide maths
Péter Kardos edited this page Jan 28, 2018
·
11 revisions
Handedness | X | Y | Z | |
---|---|---|---|---|
World | Right | Right | Forward | Up |
Camera | Left | Right | Up | Forward |
NDC | Left | Right [-1; 1] | Up [-1; 1] | Forward [0; 1] |
SSE: row-major
Packed: row-major
Shader: row-major
Never explicitly specify layout in shaders!
Do not index matrices in a way that depends on layout (i.e. vector of first 4 elements in memory, m[0].x is forbidden)!
The vector is followed by the matrix:
vector' = vector*MATRIX1*MATRIX2*MATRIX3
Mathematical quaternion multiplication is used, thus q = q2*q1 denotes the rotation q1 followed by the rotation q2.
Do not explicitly assign matrix elements if you want to create a matrix that rotates or translates or similar. All these have handy functions in the math library. Something is missing? -> Open an issue on https://github.com/petiaccja/Mathter and contact Péter.