4 * An object oriented GL/GLES Abstraction/Utility Layer
6 * Copyright (C) 2009,2010 Intel Corporation.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library. If not, see
20 * <http://www.gnu.org/licenses/>.
25 * Havoc Pennington <hp@pobox.com> for litl
26 * Robert Bragg <robert@linux.intel.com>
29 #ifndef __COGL_MATRIX_STACK_H
30 #define __COGL_MATRIX_STACK_H
32 #include "cogl-matrix.h"
33 #include "cogl-context.h"
35 typedef struct _CoglMatrixStack CoglMatrixStack;
39 CoglMatrixStack *stack;
41 gboolean flushed_identity;
43 } CoglMatrixStackCache;
46 COGL_MATRIX_MODELVIEW,
47 COGL_MATRIX_PROJECTION,
51 typedef void (* CoglMatrixStackFlushFunc) (CoglContext *context,
53 const CoglMatrix *matrix,
57 _cogl_matrix_stack_new (void);
60 _cogl_matrix_stack_push (CoglMatrixStack *stack);
63 _cogl_matrix_stack_pop (CoglMatrixStack *stack);
66 _cogl_matrix_stack_load_identity (CoglMatrixStack *stack);
69 _cogl_matrix_stack_scale (CoglMatrixStack *stack,
74 _cogl_matrix_stack_translate (CoglMatrixStack *stack,
79 _cogl_matrix_stack_rotate (CoglMatrixStack *stack,
85 _cogl_matrix_stack_multiply (CoglMatrixStack *stack,
86 const CoglMatrix *matrix);
88 _cogl_matrix_stack_frustum (CoglMatrixStack *stack,
96 _cogl_matrix_stack_perspective (CoglMatrixStack *stack,
102 _cogl_matrix_stack_ortho (CoglMatrixStack *stack,
110 _cogl_matrix_stack_get_inverse (CoglMatrixStack *stack,
111 CoglMatrix *inverse);
113 _cogl_matrix_stack_get (CoglMatrixStack *stack,
116 _cogl_matrix_stack_set (CoglMatrixStack *stack,
117 const CoglMatrix *matrix);
120 _cogl_matrix_stack_flush_to_gl_builtins (CoglContext *ctx,
121 CoglMatrixStack *stack,
123 gboolean disable_flip);
126 _cogl_matrix_stack_get_age (CoglMatrixStack *stack);
128 /* If this returns TRUE then the top of the matrix is definitely the
129 identity matrix. If it returns FALSE it may or may not be the
130 identity matrix but no expensive comparison is performed to verify
133 _cogl_matrix_stack_has_identity_flag (CoglMatrixStack *stack);
136 _cogl_matrix_stack_equal (CoglMatrixStack *stack0,
137 CoglMatrixStack *stack1);
140 _cogl_matrix_stack_init_cache (CoglMatrixStackCache *cache);
143 _cogl_matrix_stack_check_and_update_cache (CoglMatrixStack *stack,
144 CoglMatrixStackCache *cache,
148 _cogl_matrix_stack_destroy_cache (CoglMatrixStackCache *cache);
151 _cogl_is_matrix_stack (void *object);
153 #endif /* __COGL_MATRIX_STACK_H */