polyadvent

A game engine from scratch in C
git clone git://jb55.com/polyadvent
Log | Files | Refs | README

mat4.h (1079B)


      1 
      2 #ifndef MAT4_H
      3 #define MAT4_H
      4 
      5 
      6 
      7 typedef float mat4;
      8 
      9 #define M_X 12
     10 #define M_Y 13
     11 #define M_Z 14
     12 
     13 
     14 /* mat4 *mat4_create_transform(mat4 *a, float *pos, float *scale, float *rot); */
     15 mat4 *mat4_scale(mat4 *a, float v[3], mat4 *out);
     16 mat4 *mat4_frustum (float left, float right, float bottom,
     17                     float top, float near, float far, mat4 *dest);
     18 
     19 mat4 *mat4_perspective(float fov, float aspect, float near,
     20                        float far, mat4 *dest);
     21 
     22 mat4 *mat4_ortho(float left, float right, float bottom, float top, float near,
     23                  float far, mat4 *dest);
     24 
     25 mat4 *mat4_translate (mat4 *mat, float *vec3, mat4 *dest);
     26 mat4 *mat4_transpose(mat4 *src, mat4 *dest);
     27 mat4 *mat4_inverse(mat4 *src, mat4 *dest);
     28 mat4 *mat4_copy(const mat4 *src, mat4 *dst);
     29 mat4 *mat4_id(mat4 *dest);
     30 mat4 *mat4_multiply(const mat4 *a, const mat4 *b, mat4 *dest);
     31 void mat4_print(const mat4 *a);
     32 
     33 mat4 *mat4_rotate(const mat4 *mat, const float angle,
     34                   const float *v3_axis, mat4 *dest);
     35 
     36 
     37 mat4 *mat4_remove_translations(mat4 *mat);
     38 
     39 
     40 #endif /* MAT4_H */