sweet/exemple/exemple_stack.c
2014-04-17 01:24:35 +02:00

39 lines
988 B
C

#include <stdio.h>
#include <stdlib.h>
#include "sweet.h"
void
print4 (mat4 * m)
{
printf ("%f %f %f %f\n", m->v[0], m->v[4], m->v[8], m->v[12]);
printf ("%f %f %f %f\n", m->v[1], m->v[5], m->v[9], m->v[13]);
printf ("%f %f %f %f\n", m->v[2], m->v[6], m->v[10], m->v[14]);
printf ("%f %f %f %f\n", m->v[3], m->v[7], m->v[11], m->v[15]);
printf ("\n");
}
int
main ()
{
matrix_stack4 ms = sweet_matrix_stack4_new ();
print4 (sweet_matrix_stack4_get_matrix_pointer (&ms));
mat4 m = sweet_matrix_rotation3h (SWEET_PI_OVER_2, 1.0, 1.0, 1.0);
sweet_matrix_stack4_mult (&ms, &m);
print4 (sweet_matrix_stack4_get_matrix_pointer (&ms));
sweet_matrix_stack4_push (&ms);
print4 (sweet_matrix_stack4_get_matrix_pointer (&ms));
sweet_matrix_stack4_mult (&ms, &m);
print4 (sweet_matrix_stack4_get_matrix_pointer (&ms));
sweet_matrix_stack4_pop (&ms);
print4 (sweet_matrix_stack4_get_matrix_pointer (&ms));
return 0;
}