Kohi Game Engine
kheightmap_terrain.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "defines.h"
4 #include "math/math_types.h"
5 
6 #define HEIGHTMAP_TERRAIN_MAX_MATERIAL_COUNT
7 
9 typedef struct kheightmap_terrain_vertex {
23 
43 
44 typedef struct heightmap_terrain_chunk {
49 
50  // The vertex data.
52  // The offset in bytes into the vertex buffer.
54 
56 
61 
63  // NOTE: While it's possible to have this live at the terrain level, it's
64  // more flexible to have it here, as it then theoretically makes the limit
65  // of materials to HEIGHTMAP_TERRAIN_MAX_MATERIAL_COUNT per _chunk_ instead of
66  // for the _entire heightmap terrain_. While the implementation may not currently
67  // support this, keeping this here makes this easier to work toward in the future.
68  struct material* material;
This file contains global type definitions which are used throughout the entire engine and applicatio...
unsigned int u32
Unsigned 32-bit integer.
Definition: defines.h:25
float f32
32-bit floating point number
Definition: defines.h:47
unsigned short u16
Unsigned 16-bit integer.
Definition: defines.h:22
unsigned long long u64
Unsigned 64-bit integer.
Definition: defines.h:28
unsigned char u8
Unsigned 8-bit integer.
Definition: defines.h:19
struct kheightmap_terrain_vertex kheightmap_terrain_vertex
Represents a single vertex of a heightmap terrain.
struct heightmap_terrain_chunk heightmap_terrain_chunk
#define HEIGHTMAP_TERRAIN_MAX_MATERIAL_COUNT
Definition: kheightmap_terrain.h:6
struct heightmap_terrain_chunk_lod heightmap_terrain_chunk_lod
Represents a Level Of Detail for a single heightmap terrain chunk.
Contains various math types required for the engine.
Represents the extents of a 3d object.
Definition: math_types.h:213
Represents a Level Of Detail for a single heightmap terrain chunk.
Definition: kheightmap_terrain.h:33
u32 * indices
The index data.
Definition: kheightmap_terrain.h:39
u32 total_index_count
The total index count, including those for side skirts.
Definition: kheightmap_terrain.h:37
u32 surface_index_count
The index count for the chunk surface.
Definition: kheightmap_terrain.h:35
u64 index_buffer_offset
The offset from the beginning of the index buffer.
Definition: kheightmap_terrain.h:41
Definition: kheightmap_terrain.h:44
vec3 center
The center of the geometry in local coordinates.
Definition: kheightmap_terrain.h:58
u32 total_vertex_count
Definition: kheightmap_terrain.h:48
u8 current_lod
The current level of detail for this chunk.
Definition: kheightmap_terrain.h:70
u64 vertex_buffer_offset
Definition: kheightmap_terrain.h:53
struct material * material
A pointer to the material associated with this geometry.
Definition: kheightmap_terrain.h:68
u32 surface_vertex_count
Definition: kheightmap_terrain.h:47
extents_3d extents
The extents of the geometry in local coordinates.
Definition: kheightmap_terrain.h:60
u16 generation
The chunk generation. Incremented every time the geometry changes.
Definition: kheightmap_terrain.h:46
heightmap_terrain_chunk_lod * lods
Definition: kheightmap_terrain.h:55
kheightmap_terrain_vertex * vertices
Definition: kheightmap_terrain.h:51
Represents a single vertex of a heightmap terrain.
Definition: kheightmap_terrain.h:9
vec3 position
The position of the vertex.
Definition: kheightmap_terrain.h:11
vec3 normal
The normal of the vertex.
Definition: kheightmap_terrain.h:13
vec2 texcoord
The texture coordinate of the vertex.
Definition: kheightmap_terrain.h:15
vec4 tangent
The tangent of the vertex.
Definition: kheightmap_terrain.h:19
vec4 colour
The colour of the vertex.
Definition: kheightmap_terrain.h:17
f32 material_weights[HEIGHTMAP_TERRAIN_MAX_MATERIAL_COUNT]
A collection of material weights for this vertex.
Definition: kheightmap_terrain.h:21
A 2-element vector.
Definition: math_types.h:19
A 3-element vector.
Definition: math_types.h:49
A 4-element vector.
Definition: math_types.h:89