summaryrefslogtreecommitdiff
path: root/include/dolphin/vec.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/dolphin/vec.h')
-rw-r--r--include/dolphin/vec.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/dolphin/vec.h b/include/dolphin/vec.h
new file mode 100644
index 0000000..27a0037
--- /dev/null
+++ b/include/dolphin/vec.h
@@ -0,0 +1,36 @@
+#ifndef _DOLPHIN_VEC_H
+#define _DOLPHIN_VEC_H
+
+#include "types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif // ifdef __cplusplus
+
+typedef struct Vec {
+ f32 x;
+ f32 y;
+ f32 z;
+} Vec;
+
+void PSVECAdd(const Vec*, const Vec*, Vec*);
+void PSVECSubtract(const Vec*, const Vec*, Vec*);
+void PSVECNormalize(const Vec*, Vec*);
+f32 PSVECMag(const Vec*);
+void PSVECCrossProduct(const Vec*, const Vec*, Vec*);
+
+#ifdef __cplusplus
+}
+#endif
+
+// lfs f1,0(r3)
+// lfs f0,4(r3)
+// fmuls f1,f1,f1
+// lfs f2,8(r3)
+// fmuls f0,f0,f0
+// fmuls f2,f2,f2
+// fadds f0,f1,f0
+// fadds f1,f2,f0
+// blr
+
+#endif