diff options
Diffstat (limited to 'libs/pwyazh/mesh.h')
-rw-r--r-- | libs/pwyazh/mesh.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/libs/pwyazh/mesh.h b/libs/pwyazh/mesh.h index 9443a13..c703beb 100644 --- a/libs/pwyazh/mesh.h +++ b/libs/pwyazh/mesh.h @@ -1,6 +1,20 @@ #ifndef MESH_H #define MESH_H +typedef struct { + V3F pos; + V3F normal; + V2F tex_coords; +} Vertex; + +typedef struct { + U32 vao; + Vertex *vertices; + U32 vertex_count; + U32 *indices; + U32 index_count; +} Mesh; + Vertex vertex(V3F pos, V3F normal, V2F tex_coords) { @@ -68,9 +82,12 @@ mesh_init(Arena *arena, void mesh_draw(Mesh *mesh) { + if (!mesh) + return; + glBindVertexArray(mesh->vao); glDrawElements(GL_TRIANGLES, mesh->index_count, GL_UNSIGNED_INT, 0); glBindVertexArray(0); } -#endif /* MESH_H */
\ No newline at end of file +#endif /* MESH_H */ |