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:
parent
1f715ad153
commit
6c8c0714f6
@ -937,6 +937,14 @@ cogl_rotate (float angle, float x, float y, float z)
|
|||||||
_cogl_matrix_stack_rotate (modelview_stack, angle, x, y, 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
|
void
|
||||||
cogl_perspective (float fov_y,
|
cogl_perspective (float fov_y,
|
||||||
float aspect,
|
float aspect,
|
||||||
|
11
cogl/cogl.h
11
cogl/cogl.h
@ -347,6 +347,17 @@ cogl_rotate (float angle,
|
|||||||
float y,
|
float y,
|
||||||
float z);
|
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:
|
* cogl_get_modelview_matrix:
|
||||||
* @matrix: (out): return location for the model-view matrix
|
* @matrix: (out): return location for the model-view matrix
|
||||||
|
Loading…
Reference in New Issue
Block a user