diff pytouhou/utils/matrix.pxd @ 523:6e3b3d5d4691

Make matrix a struct.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 18 Dec 2013 17:53:29 +0100
parents 878273a984c4
children db28538cd399
line wrap: on
line diff
--- a/pytouhou/utils/matrix.pxd
+++ b/pytouhou/utils/matrix.pxd
@@ -1,10 +1,18 @@
-cdef class Matrix:
-    cdef float data[16]
+ctypedef struct Matrix:
+    float a, b, c, d
+    float e, f, g, h
+    float i, j, k, l
+    float m, n, o, p
+
+cdef Matrix *new_matrix(Matrix *data) nogil
+cdef Matrix *new_identity() nogil
 
-    cdef void flip(self) nogil
-    cdef void scale(self, float x, float y, float z) nogil
-    cdef void scale2d(self, float x, float y) nogil
-    cdef void translate(self, float x, float y, float z) nogil
-    cdef void rotate_x(self, float angle) nogil
-    cdef void rotate_y(self, float angle) nogil
-    cdef void rotate_z(self, float angle) nogil
+cdef void mul(Matrix *mat1, Matrix *mat2) nogil
+cdef void flip(Matrix *mat) nogil
+cdef void scale(Matrix *mat, float x, float y, float z) nogil
+cdef void scale2d(Matrix *mat, float x, float y) nogil
+cdef void translate(Matrix *mat, float x, float y, float z) nogil
+cdef void translate2d(Matrix *mat, float x, float y) nogil
+cdef void rotate_x(Matrix *mat, float angle) nogil
+cdef void rotate_y(Matrix *mat, float angle) nogil
+cdef void rotate_z(Matrix *mat, float angle) nogil