cogl: adds convenience cogl_multiply_matrix function

Quite often it's desirable to be able to multiply the current modelview
matrix by an arbitrary matrix. Currently though you have to first
explicitly call cogl_get_modelview_matrix to get the current modelview
into a temporary variable, then you need to multiply it with your matrix
using cogl_matrix_multiply and finally use cogl_set_modelview_matrix to
make the result be the new modelview. This new convenience function lets
more efficiently skip the first get and last set steps.
This commit is contained in:
Robert Bragg 2010-03-19 09:30:59 +00:00
parent 1dd70aff73
commit a678e9f627
2 changed files with 19 additions and 0 deletions

View File

@ -937,6 +937,14 @@ cogl_rotate (float angle, float x, float y, float z)
_cogl_matrix_stack_rotate (modelview_stack, angle, x, y, z);
}
void
cogl_multiply_matrix (const CoglMatrix *matrix)
{
CoglMatrixStack *modelview_stack =
_cogl_framebuffer_get_modelview_stack (_cogl_get_framebuffer ());
_cogl_matrix_stack_multiply (modelview_stack, matrix);
}
void
cogl_perspective (float fov_y,
float aspect,

View File

@ -347,6 +347,17 @@ cogl_rotate (float angle,
float y,
float z);
/**
* cogl_multiply_matrix:
* @matrix: the matrix to multiply with the current model-view
*
* Multiplies the current model-view matrix by the given matrix.
*
* Since: 1.4
*/
void
cogl_multiply_matrix (const CoglMatrix *matrix);
/**
* cogl_get_modelview_matrix:
* @matrix: (out): return location for the model-view matrix