summaryrefslogtreecommitdiffhomepage
path: root/src/raycast.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/raycast.hpp')
-rw-r--r--src/raycast.hpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/raycast.hpp b/src/raycast.hpp
new file mode 100644
index 00000000..acdddd33
--- /dev/null
+++ b/src/raycast.hpp
@@ -0,0 +1,34 @@
+#pragma once
+#include "src/object-id.hpp"
+#include "src/collision.hpp"
+#include "src/point.hpp"
+
+namespace floormat {
+
+class world;
+
+} // namespace floormat
+
+namespace floormat::rc {
+
+struct raycast_diag_s;
+
+struct raycast_result_s
+{
+ point from, to, collision;
+ collision_data collider;
+ bool has_result : 1 = false,
+ success : 1 = false;
+};
+
+[[nodiscard]] raycast_result_s raycast(world& w, point from, point to, object_id self);
+[[nodiscard]] raycast_result_s raycast_with_diag(raycast_diag_s& diag, world& w, point from, point to, object_id self);
+
+} // namespace floormat::rc
+
+namespace floormat {
+
+using floormat::rc::raycast;
+using floormat::rc::raycast_with_diag;
+
+} // namespace floormat