summaryrefslogtreecommitdiffhomepage
path: root/include/rodeo
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-06-15 15:02:11 -0400
committerrealtradam <[email protected]>2023-06-15 15:02:11 -0400
commit024067ccbf80de1beccbcf2d3a641566c7c45c17 (patch)
tree3317cf61aed4a8786ee8af410ead69a7c62137c9 /include/rodeo
parent425516a9c53183179c43517f1b6501a790378a05 (diff)
downloadRodeoKit-024067ccbf80de1beccbcf2d3a641566c7c45c17.tar.gz
RodeoKit-024067ccbf80de1beccbcf2d3a641566c7c45c17.zip
some non working progress
Diffstat (limited to 'include/rodeo')
-rw-r--r--include/rodeo/math.h16
-rw-r--r--include/rodeo/math/mat4.h38
-rw-r--r--include/rodeo/math/mat4_t.h20
-rw-r--r--include/rodeo/math/vec2.h53
-rw-r--r--include/rodeo/math/vec2_t.h9
-rw-r--r--include/rodeo/math/vec3.h53
-rw-r--r--include/rodeo/math/vec3_t.h10
-rw-r--r--include/rodeo/math_t.h5
8 files changed, 204 insertions, 0 deletions
diff --git a/include/rodeo/math.h b/include/rodeo/math.h
new file mode 100644
index 0000000..39e9c26
--- /dev/null
+++ b/include/rodeo/math.h
@@ -0,0 +1,16 @@
+#pragma once
+
+// --- internal ---
+// public
+#include "rodeo/math_t.h"
+#include "rodeo/math/vec2.h"
+#include "rodeo/math/vec3.h"
+#include "rodeo/math/mat4.h"
+
+#define mrodeo_math_pi 3.1415927410125732421875f
+
+float
+rodeo_math_radians_to_turns(float radians);
+
+float
+rodeo_math_turns_to_radians(float turns);
diff --git a/include/rodeo/math/mat4.h b/include/rodeo/math/mat4.h
new file mode 100644
index 0000000..5dbc872
--- /dev/null
+++ b/include/rodeo/math/mat4.h
@@ -0,0 +1,38 @@
+#pragma once
+
+// -- internal --
+// public
+#include "rodeo/math/mat4_t.h"
+#include "rodeo/math.h"
+
+rodeo_math_mat4_t
+rodeo_math_mat4_identity(void);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_zero(void);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_transpose(rodeo_math_mat4_t m);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_translate(rodeo_math_mat4_t m, rodeo_math_vec3_t v);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_scale(rodeo_math_mat4_t m, rodeo_math_vec3_t v);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_rotate(rodeo_math_mat4_t m, float turns, rodeo_math_vec3_t v);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_multiply(rodeo_math_mat4_t a, rodeo_math_mat4_t b);
+
+rodeo_math_mat4_t
+rodeo_math_mat4_orthographic(
+ float left,
+ float right,
+ float bottom,
+ float top,
+ float near,
+ float far
+);
+
diff --git a/include/rodeo/math/mat4_t.h b/include/rodeo/math/mat4_t.h
new file mode 100644
index 0000000..2893444
--- /dev/null
+++ b/include/rodeo/math/mat4_t.h
@@ -0,0 +1,20 @@
+#pragma once
+
+
+typedef
+struct
+{
+ float m00, m01, m02, m03;
+ float m10, m11, m12, m13;
+ float m20, m21, m22, m23;
+ float m30, m31, m32, m33;
+}
+rodeo_math_mat4_val_t;
+
+typedef
+union
+{
+ rodeo_math_mat4_val_t val;
+ float raw[4][4];
+}
+rodeo_math_mat4_t;
diff --git a/include/rodeo/math/vec2.h b/include/rodeo/math/vec2.h
new file mode 100644
index 0000000..88d524f
--- /dev/null
+++ b/include/rodeo/math/vec2.h
@@ -0,0 +1,53 @@
+#pragma once
+
+// -- internal --
+// public
+#include "rodeo/math/vec2_t.h"
+
+rodeo_math_vec2_t
+rodeo_math_vec2_zero(void);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_one(void);
+
+float
+rodeo_math_vec2_dot(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+float
+rodeo_math_vec2_cross(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_add(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_subtract(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_multiply(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_scale(rodeo_math_vec2_t a, float b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_divide(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_negate(rodeo_math_vec2_t a);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_normalize(rodeo_math_vec2_t a);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_rotate(rodeo_math_vec2_t a, float turns);
+
+float
+rodeo_math_vec2_distance(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+float
+rodeo_math_vec2_distanceSq(rodeo_math_vec2_t a, rodeo_math_vec2_t b);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_clamp(rodeo_math_vec2_t a, float minimum, float maximum);
+
+rodeo_math_vec2_t
+rodeo_math_vec2_lerp(rodeo_math_vec2_t from, rodeo_math_vec2_t to, float t);
diff --git a/include/rodeo/math/vec2_t.h b/include/rodeo/math/vec2_t.h
new file mode 100644
index 0000000..61b941e
--- /dev/null
+++ b/include/rodeo/math/vec2_t.h
@@ -0,0 +1,9 @@
+#pragma once
+
+typedef
+struct
+{
+ float x;
+ float y;
+}
+rodeo_math_vec2_t;
diff --git a/include/rodeo/math/vec3.h b/include/rodeo/math/vec3.h
new file mode 100644
index 0000000..1b9cd31
--- /dev/null
+++ b/include/rodeo/math/vec3.h
@@ -0,0 +1,53 @@
+#pragma once
+
+// -- internal --
+// public
+#include "rodeo/math/vec3_t.h"
+
+rodeo_math_vec3_t
+rodeo_math_vec3_zero(void);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_one(void);
+
+float
+rodeo_math_vec3_dot(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+float
+rodeo_math_vec3_cross(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_add(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_subtract(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_multiply(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_scale(rodeo_math_vec3_t a, float b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_divide(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_negate(rodeo_math_vec3_t a);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_normalize(rodeo_math_vec3_t a);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_rotate(rodeo_math_vec3_t a, float turns, rodeo_math_vec3_t axis);
+
+float
+rodeo_math_vec3_distance(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+float
+rodeo_math_vec3_distanceSq(rodeo_math_vec3_t a, rodeo_math_vec3_t b);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_clamp(rodeo_math_vec3_t a, float minimum, float maximum);
+
+rodeo_math_vec3_t
+rodeo_math_vec3_lerp(rodeo_math_vec3_t from, rodeo_math_vec3_t to, float t);
diff --git a/include/rodeo/math/vec3_t.h b/include/rodeo/math/vec3_t.h
new file mode 100644
index 0000000..711ad98
--- /dev/null
+++ b/include/rodeo/math/vec3_t.h
@@ -0,0 +1,10 @@
+#pragma once
+
+typedef
+struct
+{
+ float x;
+ float y;
+ float z;
+}
+rodeo_math_vec3_t;
diff --git a/include/rodeo/math_t.h b/include/rodeo/math_t.h
new file mode 100644
index 0000000..9374c2a
--- /dev/null
+++ b/include/rodeo/math_t.h
@@ -0,0 +1,5 @@
+#pragma once
+
+// --- internal ---
+// public
+#include "rodeo/math/vec2_t.h"