diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-01-10 15:40:18 +0200 |
---|---|---|
committer | Pekka Paalanen <ppaalanen@gmail.com> | 2012-01-27 10:44:22 +0200 |
commit | daaf01b3e104047326d072e8bd8c849537129530 (patch) | |
tree | 3a8cd68a52eaa078d18de8ae42b03931c6565592 /src | |
parent | c61eca6002854b81ad8a418ae82a074423cea80b (diff) |
util: document matrices
Add comments explaining the matrix storage and multiplication, so that
no-one else needs to decipher them again.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -27,6 +27,14 @@ #include "compositor.h" +/* + * Matrices are stored in column-major order, that is the array indices are: + * 0 4 8 12 + * 1 5 9 13 + * 2 6 10 14 + * 3 7 11 15 + */ + WL_EXPORT void weston_matrix_init(struct weston_matrix *matrix) { @@ -37,6 +45,7 @@ weston_matrix_init(struct weston_matrix *matrix) memcpy(matrix, &identity, sizeof identity); } +/* m <- n * m, that is, m is multiplied on the LEFT. */ WL_EXPORT void weston_matrix_multiply(struct weston_matrix *m, const struct weston_matrix *n) { @@ -76,6 +85,7 @@ weston_matrix_scale(struct weston_matrix *matrix, GLfloat x, GLfloat y, GLfloat weston_matrix_multiply(matrix, &scale); } +/* v <- m * v */ WL_EXPORT void weston_matrix_transform(struct weston_matrix *matrix, struct weston_vector *v) { |