summaryrefslogtreecommitdiff
path: root/maths.h
diff options
context:
space:
mode:
Diffstat (limited to 'maths.h')
-rw-r--r--maths.h37
1 files changed, 31 insertions, 6 deletions
diff --git a/maths.h b/maths.h
index 92861ba..e63878c 100644
--- a/maths.h
+++ b/maths.h
@@ -6,12 +6,37 @@
#define clamp(v_, min_, max_) (maxi(min_, mini(max_, v_)))
#define fbits 9
+#define f1 (1 << fbits)
-int absolute(int x);
-int fsin(int t);
-int fcos(int t);
-int ftan(int t);
-int flerp(int a, int b, int t);
-int fsqrt(int v);
+#define sin_table_count 0x100
+#define sin_table_mask 0x0ff
+#define sqrt_table_count 0x800
+#define sqrt_table_mask 0x07f
+
+extern int sin_table[sin_table_count];
+extern int cos_table[sin_table_count];
+extern int sqrt_table[sqrt_table_count];
+
+void init_maths(void);
+
+int* mtx_iden(int* m);
+int* mtx_cpy(int* d, const int* s);
+int* mtx_mul(int* d, const int* a, const int* b);
+void mtx_push(const int* m);
+void mtx_push_trans(int* v);
+void mtx_push_rot_x(int a);
+void mtx_push_rot_y(int a);
+void mtx_push_rot_z(int a);
+int* mtx_pop(void);
+int* mtx_popn(int n);
+int* mtx_peek(void);
+int* mtx_trans(int* d, int* v);
+int* mtx_rot_x(int* d, int a);
+int* mtx_rot_y(int* d, int a);
+int* mtx_rot_z(int* d, int a);
+int* mtx_apply(const int* m, int* v);
+int* vec_cpy(int* d, const int* s, int c);
+void persp(int* v, int asp);
+void ndc2clip(int* c, int* p);
#endif