summaryrefslogtreecommitdiff
path: root/src/physics
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-05-12 15:07:57 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-05-12 15:07:57 +1000
commit634f22e2b6d538fc5a45da2b1b23af631f6f8703 (patch)
treeeee6cb6dab16408bd6b44f93996204cd7fbd5c2e /src/physics
parentd52d39d7843ed2203b001a822efe6d4b692c2642 (diff)
more restructuring
Diffstat (limited to 'src/physics')
-rw-r--r--src/physics/broadphase.h10
-rw-r--r--src/physics/collision.h30
-rw-r--r--src/physics/narrowphase.h10
-rw-r--r--src/physics/physics.c1
-rw-r--r--src/physics/physics.h23
5 files changed, 74 insertions, 0 deletions
diff --git a/src/physics/broadphase.h b/src/physics/broadphase.h
new file mode 100644
index 0000000..43b57f6
--- /dev/null
+++ b/src/physics/broadphase.h
@@ -0,0 +1,10 @@
+/**
+ * @file broadphase.h
+ * @author your name (you@domain.com)
+ * @brief
+ * @version 0.1
+ * @date 2024-05-12
+ *
+ * @copyright Copyright (c) 2024
+ *
+ */ \ No newline at end of file
diff --git a/src/physics/collision.h b/src/physics/collision.h
new file mode 100644
index 0000000..3b65b1b
--- /dev/null
+++ b/src/physics/collision.h
@@ -0,0 +1,30 @@
+/**
+ * @file collision.h
+ * @author your name (you@domain.com)
+ * @brief
+ * @version 0.1
+ * @date 2024-05-12
+ *
+ * @copyright Copyright (c) 2024
+ *
+ */
+#pragma once
+#include "geometry.h"
+
+ enum collider_type {
+ cuboid_collider,
+ sphere_collider,
+};
+
+/** @brief generic collider structure */
+typedef struct physics_collider {
+ u64 id; // ? Replace with handle?
+ enum collider_type shape;
+ union collider_data {
+ cuboid cuboid;
+ sphere sphere;
+ } geometry;
+ transform transform;
+ u8 layer;
+ bool on_ground;
+} physics_collider; \ No newline at end of file
diff --git a/src/physics/narrowphase.h b/src/physics/narrowphase.h
new file mode 100644
index 0000000..501c690
--- /dev/null
+++ b/src/physics/narrowphase.h
@@ -0,0 +1,10 @@
+/**
+ * @file narrowphase.h
+ * @author your name (you@domain.com)
+ * @brief
+ * @version 0.1
+ * @date 2024-05-12
+ *
+ * @copyright Copyright (c) 2024
+ *
+ */ \ No newline at end of file
diff --git a/src/physics/physics.c b/src/physics/physics.c
new file mode 100644
index 0000000..299c0c1
--- /dev/null
+++ b/src/physics/physics.c
@@ -0,0 +1 @@
+#include "physics.h" \ No newline at end of file
diff --git a/src/physics/physics.h b/src/physics/physics.h
new file mode 100644
index 0000000..e0e3b89
--- /dev/null
+++ b/src/physics/physics.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "geometry.h"
+#include "maths_types.h"
+
+// 'system' means that it gets called per frame
+
+typedef struct physics_settings {
+ f32 gravity_strength;
+} physics_settings;
+
+// What else do I need?
+// intersection methods
+
+typedef struct physics_world {
+ physics_settings settings;
+} physics_world;
+
+physics_world physics_init(physics_settings settings);
+void physics_shutdown(physics_world* phys_world);
+
+/** @brief perform one or more simulation steps */
+void physics_system_update(physics_world* phys_world, f64 deltatime); \ No newline at end of file