README, Makefile, and license headers
[gph-cmath] / src / cgmath.h
index 12d9795..33b0717 100644 (file)
@@ -1,4 +1,4 @@
-/* C version of the graphene math library
+/* gph-cmath - C graphics math library
  * Copyright (C) 2018 John Tsiombikas <nuclear@member.fsf.org>
  *
  * This program is free software. Feel free to use, modify, and/or redistribute
@@ -18,7 +18,7 @@
  *
  * NOTE: matrices are treated by all operations as column-major, to match OpenGL
  * conventions, so everything is pretty much transposed.
- */
+*/
 #ifndef CGMATH_H_
 #define CGMATH_H_
 
@@ -134,9 +134,9 @@ static inline void cgm_mmul(float *a, const float *b);
 
 static inline void cgm_msubmatrix(float *m, int row, int col);
 static inline void cgm_mupper3(float *m);
-static inline float cgm_msubdet(float *m, int row, int col);
-static inline float cgm_mcofactor(float *m, int row, int col);
-static inline float cgm_mdet(float *m);
+static inline float cgm_msubdet(const float *m, int row, int col);
+static inline float cgm_mcofactor(const float *m, int row, int col);
+static inline float cgm_mdet(const float *m);
 static inline void cgm_mtranspose(float *m);
 static inline void cgm_mcofmatrix(float *m);
 static inline int cgm_minverse(float *m);      /* returns 0 on success, -1 for singular */
@@ -168,6 +168,24 @@ static inline void cgm_mprerotate_axis(float *m, int idx, float angle);
 static inline void cgm_mprerotate(float *m, float angle, float x, float y, float z);
 static inline void cgm_mprerotate_euler(float *m, float a, float b, float c, int mode);
 
+static inline void cgm_mget_translation(const float *m, cgm_vec3 *res);
+static inline void cgm_mget_rotation(const float *m, cgm_quat *res);
+static inline void cgm_mget_scaling(const float *m, cgm_vec3 *res);
+static inline void cgm_mget_frustum_plane(const float *m, int p, cgm_vec4 *res);
+
+static inline void cgm_mlookat(float *m, const cgm_vec3 *pos, const cgm_vec3 *targ,
+               const cgm_vec3 *up);
+static inline void cgm_minv_lookat(float *m, const cgm_vec3 *pos, const cgm_vec3 *targ,
+               const cgm_vec3 *up);
+static inline void cgm_mortho(float *m, float left, float right, float bot, float top,
+               float znear, float zfar);
+static inline void cgm_mfrustum(float *m, float left, float right, float bot, float top,
+               float znear, float zfar);
+static inline void cgm_mperspective(float *m, float vfov, float aspect, float znear, float zfar);
+
+static inline void cgm_mmirror(float *m, float a, float b, float c, float d);
+
+
 #include "cgmvec3.inl"
 #include "cgmvec4.inl"
 #include "cgmquat.inl"