better audio queuing
[fishladder.git] / vg / vg_m.h
index 27481ae995db9b3aca8694ffea139671e9f27438..cb98db2d1a5a64f060a5c150b9bdc9d663a6b3d3 100644 (file)
--- a/vg/vg_m.h
+++ b/vg/vg_m.h
@@ -17,6 +17,10 @@ static inline float vg_maxf( float a, float b )
        return a > b? a: b;
 }
 
+#define VG_MIN( A, B ) ((A)<(B)?(A):(B))
+#define VG_MAX( A, B ) ((A)>(B)?(A):(B))
+
+// Hopefully deprecate this!!
 static inline int vg_min( int a, int b )
 {
        return a < b? a: b;
@@ -226,6 +230,40 @@ static inline void v4_zero( v4f a )
        a[0] = 0.f; a[1] = 0.f; a[2] = 0.f; a[3] = 0.f;
 }
 
+// Matrix 2x2
+// ===========================================================================================================
+
+#define M2X2_INDENTIY  {{1.0f, 0.0f, }, \
+                                                               { 0.0f, 1.0f, }}
+                                                               
+#define M2X2_ZERO                      {{0.0f, 0.0f, }, \
+                                                               { 0.0f, 0.0f, }}
+
+static inline void m2x2_copy( m2x2f a, m2x2f b )
+{
+       v2_copy( a[0], b[0] );
+       v2_copy( a[1], b[1] );
+}
+
+static inline void m2x2_identity( m2x2f a )
+{
+       m2x2f id = M2X2_INDENTIY;
+       m2x2_copy( id, a );
+}
+
+static inline void m2x2_create_rotation( m2x2f a, float theta )
+{
+       float s, c;
+       
+       s = sinf( theta );
+       c = cosf( theta );
+       
+       a[0][0] =  c;
+       a[0][1] = -s;
+       a[1][0] =  s;
+       a[1][1] =  c;
+}
+
 // Matrix 3x3
 //======================================================================================================