-
Notifications
You must be signed in to change notification settings - Fork 25
Coding guide maths
Péter Kardos edited this page Jul 7, 2017
·
11 revisions
Coordinate spaces:
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] |
Matrix layout:
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)!
Multiplication order:
The vector is followed by the matrix:
vector' = vector*MATRIX1*MATRIX2*MATRIX3
Quaternions:
Mathematical quaternion multiplication is used, thus *q = q2\*q1* denotes the rotation q1 followed by the rotation q2.
Our matrices look like...
<math>\alpha</math>