matrix-stack: make CoglMatrixStack public

We have found several times now when writing code using Cogl that it
would really help if Cogl's matrix stack api was public as a utility
api. In Rig for example we want to avoid redundant arithmetic when
deriving the matrices of entities used to render and we aren't able
to simply use the framebuffer's matrix stack to achieve this. Also when
implementing cairo-cogl we found that it would be really useful if we
could have a matrix stack utility api.

(cherry picked from commit d17a01fd935d88fab96fe6cc0b906c84026c0067)
This commit is contained in:
Robert Bragg
2012-11-20 17:08:43 +00:00
parent 3e33c00c84
commit cab4622eb3
18 changed files with 979 additions and 436 deletions

View File

@@ -60,7 +60,9 @@
static void
texture_unit_init (CoglTextureUnit *unit, int index_)
texture_unit_init (CoglContext *ctx,
CoglTextureUnit *unit,
int index_)
{
unit->index = index_;
unit->enabled_gl_target = 0;
@@ -68,7 +70,7 @@ texture_unit_init (CoglTextureUnit *unit, int index_)
unit->gl_target = 0;
unit->is_foreign = FALSE;
unit->dirty_gl_texture = FALSE;
unit->matrix_stack = _cogl_matrix_stack_new ();
unit->matrix_stack = cogl_matrix_stack_new (ctx);
unit->layer = NULL;
unit->layer_changes_since_flush = 0;
@@ -98,7 +100,7 @@ _cogl_get_texture_unit (int index_)
CoglTextureUnit *unit =
&g_array_index (ctx->texture_units, CoglTextureUnit, i);
texture_unit_init (unit, i);
texture_unit_init (ctx, unit, i);
}
}