Lines Matching refs:stack
103 static void matrix_frustum(struct gl_matrix_stack* stack,
121 _math_matrix_frustum(stack->Top,
125 ctx->NewState |= stack->DirtyFlag;
142 * the top matrix of the current matrix stack and sets
166 struct gl_matrix_stack *stack = get_named_matrix_stack(ctx, matrixMode,
168 if (!stack)
171 matrix_frustum(stack,
180 matrix_ortho(struct gl_matrix_stack* stack,
202 _math_matrix_ortho( stack->Top,
206 ctx->NewState |= stack->DirtyFlag;
223 * the top matrix of the current matrix stack and sets
247 struct gl_matrix_stack *stack = get_named_matrix_stack(ctx, matrixMode,
249 if (!stack)
252 matrix_ortho(stack,
261 * Set the current matrix stack.
263 * \param mode matrix stack.
269 * with the specified matrix stack.
274 struct gl_matrix_stack * stack;
281 stack = NULL;
283 stack = get_named_matrix_stack(ctx, mode, "glMatrixMode");
286 if (stack) {
287 ctx->CurrentStack = stack;
295 push_matrix(struct gl_context *ctx, struct gl_matrix_stack *stack,
298 if (stack->Depth + 1 >= stack->MaxDepth) {
309 if (stack->Depth + 1 >= stack->StackSize) {
310 unsigned new_stack_size = stack->StackSize * 2;
312 GLmatrix *new_stack = realloc(stack->Stack,
320 for (i = stack->StackSize; i < new_stack_size; i++)
323 stack->Stack = new_stack;
324 stack->StackSize = new_stack_size;
327 _math_matrix_push_copy(&stack->Stack[stack->Depth + 1],
328 &stack->Stack[stack->Depth]);
329 stack->Depth++;
330 stack->Top = &(stack->Stack[stack->Depth]);
335 * Push the current matrix stack.
339 * Verifies the current matrix stack is not full, and duplicates the top-most
340 * matrix in the stack.
341 * Marks __struct gl_contextRec::NewState with the stack dirty flag.
347 struct gl_matrix_stack *stack = ctx->CurrentStack;
353 push_matrix(ctx, stack, ctx->Transform.MatrixMode, "glPushMatrix");
361 struct gl_matrix_stack *stack = get_named_matrix_stack(ctx, matrixMode,
364 if (stack)
365 push_matrix(ctx, stack, matrixMode, "glMatrixPushEXT");
370 pop_matrix( struct gl_context *ctx, struct gl_matrix_stack *stack )
372 if (stack->Depth == 0)
375 stack->Depth--;
380 if (memcmp(stack->Top, &stack->Stack[stack->Depth],
383 ctx->NewState |= stack->DirtyFlag;
386 stack->Top = &(stack->Stack[stack->Depth]);
392 * Pop the current matrix stack.
396 * Flushes the vertices, verifies the current matrix stack is not empty, and
397 * moves the stack head down.
398 * Marks __struct gl_contextRec::NewState with the dirty stack flag.
404 struct gl_matrix_stack *stack = ctx->CurrentStack;
410 if (!pop_matrix(ctx, stack)) {
428 struct gl_matrix_stack *stack = get_named_matrix_stack(ctx, matrixMode,
430 if (!stack)
433 if (!pop_matrix(ctx, stack)) {
448 _mesa_load_identity_matrix(struct gl_context *ctx, struct gl_matrix_stack *stack)
452 _math_matrix_set_identity(stack->Top);
453 ctx->NewState |= stack->DirtyFlag;
463 * top-most matrix in the current stack.
464 * Marks __struct gl_contextRec::NewState with the stack dirty flag.
481 struct gl_matrix_stack *stack;
483 stack = get_named_matrix_stack(ctx, matrixMode, "glMatrixLoadIdentityEXT");
484 if (!stack)
487 _mesa_load_identity_matrix(ctx, stack);
492 _mesa_load_matrix(struct gl_context *ctx, struct gl_matrix_stack *stack,
495 if (memcmp(m, stack->Top->m, 16 * sizeof(GLfloat)) != 0) {
497 _math_matrix_loadf(stack->Top, m);
498 ctx->NewState |= stack->DirtyFlag;
504 matrix_load(struct gl_context *ctx, struct gl_matrix_stack *stack,
517 _mesa_load_matrix(ctx, stack, m);
529 * matrix in the current stack and the given matrix.
530 * Marks __struct gl_contextRec::NewState with the dirty stack flag.
552 struct gl_matrix_stack * stack =
554 if (!stack)
557 matrix_load(ctx, stack, m, "glMatrixLoadfEXT");
562 matrix_mult(struct gl_matrix_stack *stack, const GLfloat *m, const char* caller)
581 _math_matrix_mul_floats(stack->Top, m);
582 ctx->NewState |= stack->DirtyFlag;
594 * matrix in the current stack and the given matrix. Marks
595 * __struct gl_contextRec::NewState with the dirty stack flag.
609 struct gl_matrix_stack * stack =
611 if (!stack)
614 matrix_mult(stack, m, "glMultMatrix");
619 matrix_rotate(struct gl_matrix_stack *stack, GLfloat angle,
626 _math_matrix_rotate(stack->Top, angle, x, y, z);
627 ctx->NewState |=stack->DirtyFlag;
643 * matrix in the current stack and the given parameters. Marks
644 * __struct gl_contextRec::NewState with the dirty stack flag.
658 struct gl_matrix_stack *stack =
660 if (!stack)
663 matrix_rotate(stack, angle, x, y, z, "glMatrixRotatefEXT");
677 * matrix in the current stack and the given parameters. Marks
678 * __struct gl_contextRec::NewState with the dirty stack flag.
694 struct gl_matrix_stack *stack;
697 stack = get_named_matrix_stack(ctx, matrixMode, "glMatrixScalefEXT");
698 if (!stack)
702 _math_matrix_scale(stack->Top, x, y, z);
703 ctx->NewState |= stack->DirtyFlag;
717 * matrix in the current stack and the given parameters. Marks
718 * __struct gl_contextRec::NewState with the dirty stack flag.
735 struct gl_matrix_stack *stack =
737 if (!stack)
741 _math_matrix_translate(stack->Top, x, y, z);
742 ctx->NewState |= stack->DirtyFlag;
914 * Update the projection matrix stack.
977 /** Matrix stack initialization */
982 * Initialize a matrix stack.
984 * \param stack matrix stack.
985 * \param maxDepth maximum stack depth.
988 * Allocates an array of \p maxDepth elements for the matrix stack and calls
992 init_matrix_stack(struct gl_matrix_stack *stack,
995 stack->Depth = 0;
996 stack->MaxDepth = maxDepth;
997 stack->DirtyFlag = dirtyFlag;
998 /* The stack will be dynamically resized at glPushMatrix() time */
999 stack->Stack = calloc(1, sizeof(GLmatrix));
1000 stack->StackSize = 1;
1001 _math_matrix_ctr(&stack->Stack[0]);
1002 stack->Top = stack->Stack;
1006 * Free matrix stack.
1008 * \param stack matrix stack.
1011 free_matrix_stack( struct gl_matrix_stack *stack )
1013 free(stack->Stack);
1014 stack->Stack = stack->Top = NULL;
1015 stack->StackSize = 0;