diff options
Diffstat (limited to 'src/systems/terrain.h')
-rw-r--r-- | src/systems/terrain.h | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/systems/terrain.h b/src/systems/terrain.h index 2d6ff4a..a38e45e 100644 --- a/src/systems/terrain.h +++ b/src/systems/terrain.h @@ -15,17 +15,29 @@ Future: #include "maths_types.h" #include "mem.h" #include "ral.h" +#include "ral_types.h" #include "render.h" #include "str.h" typedef struct Heightmap { Str8 filepath; - u32x2 size; + u32x2 pixel_dimensions; void* image_data; bool is_uploaded; } Heightmap; -typedef struct Terrain_Storage Terrain_Storage; + typedef struct Terrain_Storage { + // arena terrain_allocator; + u32x2 grid_dimensions; + u32 num_vertices; + Heightmap heightmap; // NULL = no heightmap + GPU_Renderpass* hmap_renderpass; + GPU_Pipeline* hmap_pipeline; + + bool hmap_loaded; + BufferHandle vertex_buffer; + BufferHandle index_buffer; +} Terrain_Storage; // --- Public API PUB bool Terrain_Init(Terrain_Storage* storage); @@ -34,7 +46,7 @@ PUB void Terrain_Draw( Terrain_Storage* storage); // NOTE: For now it renders directly to main framebuffer /** @brief Sets the active heightmap to be rendered and collided against. */ -PUB void Terrain_LoadHeightmap(Heightmap hmap, bool free_on_upload); +PUB void Terrain_LoadHeightmap(Terrain_Storage* storage, Heightmap hmap, bool free_on_upload); PUB Heightmap Heightmap_FromImage(Str8 filepath); PUB Heightmap Heightmap_FromPerlin(/* TODO: perlin noise generation parameters */); @@ -51,5 +63,7 @@ f32 Heightmap_HeightXZ(Heightmap* hmap, f32 x, f32 z); /** @brief Calculate the normal vector of a vertex at a particular coordinate in the heightmap */ Vec3 Heightmap_NormalXZ(Heightmap* hmap, f32 x, f32 z); -/** @brief Generate the `geometry_data` for a heightmap ready to be uploaded to the GPU */ -Geometry geo_heightmap(arena* a, Heightmap heightmap); +// /** @brief Generate the `geometry_data` for a heightmap ready to be uploaded to the GPU */ +// Geometry geo_heightmap(arena* a, Heightmap heightmap); + +ShaderDataLayout TerrainUniforms_GetLayout(void* data);
\ No newline at end of file |