/* * Sweet is a small library for basic math and small matrix operations. * Copyright 2014 Luc Girod. * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation, either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #ifndef SWEET_MATRIX_STACK #define SWEET_MATRIX_STACK #include "sweet_types.h" #include "sweet_matrix.h" #define SWEET_MATRIX_STACK_SIZE 128 typedef struct matrix_stack2 { mat2 matrix[SWEET_MATRIX_STACK_SIZE]; unsigned int position; }matrix_stack2; typedef struct matrix_stack3 { mat3 matrix[SWEET_MATRIX_STACK_SIZE]; unsigned int position; }matrix_stack3; typedef struct matrix_stack4 { mat4 matrix[SWEET_MATRIX_STACK_SIZE]; unsigned int position; }matrix_stack4; matrix_stack2 sweet_matrix_stack2_new (); matrix_stack3 sweet_matrix_stack3_new (); matrix_stack4 sweet_matrix_stack4_new (); int sweet_matrix_stack2_push (matrix_stack2 * ms); int sweet_matrix_stack3_push (matrix_stack3 * ms); int sweet_matrix_stack4_push (matrix_stack4 * ms); int sweet_matrix_stack2_pop (matrix_stack2 * ms); int sweet_matrix_stack3_pop (matrix_stack3 * ms); int sweet_matrix_stack4_pop (matrix_stack4 * ms); void sweet_matrix_stack2_mult (matrix_stack2 * ms, mat2 * m); void sweet_matrix_stack3_mult (matrix_stack3 * ms, mat3 * m); void sweet_matrix_stack4_mult (matrix_stack4 * ms, mat4 * m); void sweet_matrix_stack2_set (matrix_stack2 * ms, mat2 * m); void sweet_matrix_stack3_set (matrix_stack3 * ms, mat3 * m); void sweet_matrix_stack4_set (matrix_stack4 * ms, mat4 * m); mat2 * sweet_matrix_stack2_get_matrix_pointer (matrix_stack2 * m); mat3 * sweet_matrix_stack3_get_matrix_pointer (matrix_stack3 * m); mat4 * sweet_matrix_stack4_get_matrix_pointer (matrix_stack4 * m); mat2 sweet_matrix_stack2_get_matrix (matrix_stack2 * m); mat3 sweet_matrix_stack3_get_matrix (matrix_stack3 * m); mat4 sweet_matrix_stack4_get_matrix (matrix_stack4 * m); #endif