summaryrefslogtreecommitdiff
path: root/src/systems
diff options
context:
space:
mode:
authoromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-04-27 16:35:11 +1000
committeromniscient <17525998+omnisci3nce@users.noreply.github.com>2024-04-27 16:35:11 +1000
commitfc35df8e999521b8be7c44800f4ff4665df3254a (patch)
tree2acc67b9830e712bef78270c6478c61e184f2047 /src/systems
parent55bb30899899d1e6f34e85d87909d5108d085adb (diff)
heightmap function signatures
Diffstat (limited to 'src/systems')
-rw-r--r--src/systems/physics.h2
-rw-r--r--src/systems/terrain.h37
-rw-r--r--src/systems/text.h2
3 files changed, 34 insertions, 7 deletions
diff --git a/src/systems/physics.h b/src/systems/physics.h
index 5c96c6e..61d2008 100644
--- a/src/systems/physics.h
+++ b/src/systems/physics.h
@@ -15,7 +15,7 @@ enum collider_type {
/** @brief generic collider structure */
typedef struct physics_collider {
- u64 id; // ? Replace with handle?
+ u64 id; // ? Replace with handle?
enum collider_type shape;
transform transform;
u8 layer;
diff --git a/src/systems/terrain.h b/src/systems/terrain.h
index 96875d9..6558202 100644
--- a/src/systems/terrain.h
+++ b/src/systems/terrain.h
@@ -1,19 +1,46 @@
/**
* @file terrain.h
* @author your name (you@domain.com)
- * @brief
+ * @brief
* @version 0.1
* @date 2024-04-27
- *
+ *
* @copyright Copyright (c) 2024
- *
+ *
*/
+/*
+Future:
+ - Chunked terrain
+ - Dynamic LOD
+*/
+
+#include "cleanroom/types.h"
#include "defines.h"
+#include "maths_types.h"
+#include "mem.h"
typedef struct terrain_state {
-
} terrain_state;
+typedef struct heightmap {
+ u32x2 size;
+ void* image_data;
+} heightmap;
+
bool terrain_system_init(terrain_state* state);
-void terrain_system_shutdown(terrain_state* state); \ No newline at end of file
+void terrain_system_shutdown(terrain_state* state);
+void terrain_system_render_hmap(renderer* rend, terrain_state* state);
+
+heightmap heightmap_from_image(const char* filepath);
+heightmap heightmap_from_perlin(/* TODO: perlin noise generation parameters */);
+
+/** @brief Get the height (the Y component) for a vertex at a particular coordinate in the heightmap
+ */
+f32 heightmap_height_at_xz(heightmap* hmap, f32 x, f32 z);
+
+/** @brief Calculate the normal vector of a vertex at a particular coordinate in the heightmap */
+vec3 heightmap_normal_at_xz(heightmap* hmap, f32 x, f32 z);
+
+/** @brief Generate the `geometry_data` for a heightmap ready to be uploaded to the GPU */
+geometry_data geo_heightmap(arena* a, heightmap heightmap); \ No newline at end of file
diff --git a/src/systems/text.h b/src/systems/text.h
index 4fac0b8..dc396f0 100644
--- a/src/systems/text.h
+++ b/src/systems/text.h
@@ -8,8 +8,8 @@
#include "cleanroom/types.h"
#include "darray.h"
#include "defines.h"
-#include "render_types.h"
#include "ral.h"
+#include "render_types.h"
struct core;