diff options
author | Damien Lespiau <damien.lespiau@intel.com> | 2012-05-03 12:26:11 +0100 |
---|---|---|
committer | Robert Bragg <robert@linux.intel.com> | 2012-08-06 14:27:41 +0100 |
commit | 7ff0b52d7895ec80e493201feb1aee87362898c8 (patch) | |
tree | d3844dfa693473bef6573293fb65a6fe93624f1f /cogl/cogl-matrix.h | |
parent | 68a6e828280d8abb95ce3311f9d24d21946bb842 (diff) |
matrix: Add a init_translation() constructor
This allows people to initialize a matrix with a translation
transformation. The options to do it at the moment were:
* init_from_array() but it give cogl no information about the type of
matrix.
* init_indentity() and then translate() but it means doing a lot of
computations for no reason.
Reviewed-by: Robert Bragg <robert@linux.intel.com>
(cherry picked from commit 068b3b59221e405dc288d434b0008464684a7c12)
Diffstat (limited to 'cogl/cogl-matrix.h')
-rw-r--r-- | cogl/cogl-matrix.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cogl/cogl-matrix.h b/cogl/cogl-matrix.h index b5b5fc3b..3f0709a7 100644 --- a/cogl/cogl-matrix.h +++ b/cogl/cogl-matrix.h @@ -127,6 +127,30 @@ void cogl_matrix_init_identity (CoglMatrix *matrix); /** + * cogl_matrix_init_translation: + * @matrix: A 4x4 transformation matrix + * @tx x coordinate of the translation vector + * @ty y coordinate of the translation vector + * @tz z coordinate of the translation vector + * + * Resets matrix to the (tx, ty, tz) translation matrix: + * + * |[ + * .xx=1; .xy=0; .xz=0; .xw=tx; + * .yx=0; .yy=1; .yz=0; .yw=ty; + * .zx=0; .zy=0; .zz=1; .zw=tz; + * .wx=0; .wy=0; .wz=0; .ww=1; + * ]| + * + * Since: 2.0 + */ +void +cogl_matrix_init_translation (CoglMatrix *matrix, + float tx, + float ty, + float tz); + +/** * cogl_matrix_multiply: * @result: The address of a 4x4 matrix to store the result in * @a: A 4x4 transformation matrix |