summaryrefslogtreecommitdiff
path: root/include/engine/fov.h
diff options
context:
space:
mode:
author0scar <qgt268@alumni.ku.dk>2020-09-29 06:51:02 +0000
committer0scar <qgt268@alumni.ku.dk>2023-07-28 09:48:17 +0000
commit6c16f339224a4736f4ed57d15bb3e5f968a635ab (patch)
treeab13afea4b6f9acfb4a139a3125f265c90bc9d80 /include/engine/fov.h
Initial independent commit
Diffstat (limited to 'include/engine/fov.h')
-rw-r--r--include/engine/fov.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/engine/fov.h b/include/engine/fov.h
new file mode 100644
index 0000000..3af421e
--- /dev/null
+++ b/include/engine/fov.h
@@ -0,0 +1,26 @@
+#ifndef ENGINE_FOV_H
+#define ENGINE_FOV_H
+
+#include <stdbool.h>
+#include "types.h"
+#include "vector.h"
+
+/* `fov_shadowcast`: */
+/* map: your 2D enum tile grid
+ * mapsize: x: width, y: height of the map
+ * visblocking: pointer to a function that returns `true` when receiving a
+ * pointer to a LOS blocking tile
+ * lightmap: [out] 2D lightmap, this is simply overwritten with the distance to
+ * the source.
+ * range: visibility range/radius.
+ * src: 2D point to calculate FOV from
+ * */
+void fov_shadowcast(
+ const void *map,
+ const v2_i32 mapsize,
+ bool (*visblocking)(const void*),
+ i32 *lightmap,
+ const i32 range,
+ v2_i32 src);
+
+#endif