terrain

Real-time terrain generation using marching cubes
git clone git://git.christianermann.dev/terrain
Log | Files | Refs | README | LICENSE

mesh.h (570B)


      1 #ifndef MESH_H
      2 #define MESH_H
      3 
      4 #include "types.h"
      5 #include "vec.h"
      6 
      7 #include "glad/glad.h"
      8 
      9 typedef struct {
     10     Vec3 position;
     11     Vec3 normal;
     12 } Vertex;
     13 
     14 typedef struct {
     15     u32 vertex_capacity;
     16     u32 vertex_count;
     17     Vertex *vertices;
     18 
     19     u32 index_capacity;
     20     u32 index_count;
     21     u32 *indices;
     22 
     23     u32 vao;
     24     u32 vbo;
     25     u32 ebo;
     26 
     27     b8 buffers_mapped;
     28 } Mesh;
     29 
     30 void Mesh_init(Mesh *m, u32 vertex_count, u32 index_count);
     31 
     32 void Mesh_free(Mesh *m);
     33 
     34 void Mesh_mapBuffers(Mesh *m);
     35 void Mesh_unmapBuffers(Mesh *m);
     36 
     37 void Mesh_draw(const Mesh *m);
     38 
     39 #endif