diff options
author | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-04-27 17:07:03 +1000 |
---|---|---|
committer | omniscient <17525998+omnisci3nce@users.noreply.github.com> | 2024-04-27 17:07:03 +1000 |
commit | 93c8d40b39fe55a626e66d412450fb4cca1f993b (patch) | |
tree | c064a1729404100ea6bfa62c0960442a17791fdb /src/systems | |
parent | fc35df8e999521b8be7c44800f4ff4665df3254a (diff) |
scene thoughts
Diffstat (limited to 'src/systems')
-rw-r--r-- | src/systems/physics.h | 8 | ||||
-rw-r--r-- | src/systems/terrain.h | 18 |
2 files changed, 21 insertions, 5 deletions
diff --git a/src/systems/physics.h b/src/systems/physics.h index 61d2008..7239ab5 100644 --- a/src/systems/physics.h +++ b/src/systems/physics.h @@ -1,5 +1,6 @@ #pragma once +#include "geometry.h" #include "maths_types.h" // 'system' means that it gets called per frame @@ -17,11 +18,18 @@ enum collider_type { 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; +// What else do I need? +// intersection methods + typedef struct physics_world { physics_settings settings; } physics_world; diff --git a/src/systems/terrain.h b/src/systems/terrain.h index 6558202..3d6f1c1 100644 --- a/src/systems/terrain.h +++ b/src/systems/terrain.h @@ -20,19 +20,23 @@ Future: #include "maths_types.h" #include "mem.h" -typedef struct terrain_state { -} terrain_state; - typedef struct heightmap { + str8 filepath; u32x2 size; void* image_data; + bool is_uploaded; } heightmap; +typedef struct terrain_state { + arena terrain_allocator; + heightmap* heightmap; // NULL = no heightmap +} terrain_state; + bool terrain_system_init(terrain_state* state); 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_image(str8 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 @@ -43,4 +47,8 @@ f32 heightmap_height_at_xz(heightmap* hmap, f32 x, f32 z); 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 +geometry_data geo_heightmap(arena* a, heightmap heightmap); + +// somewhere there will be an easy way to add a heightmap + +// scene_add_heightmap
\ No newline at end of file |