summaryrefslogtreecommitdiff
path: root/libs/pwyazh/mesh.h
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-01-23 19:39:54 +0500
committerpryazha <pryadeiniv@mail.ru>2025-01-23 19:39:54 +0500
commitbf1c59565096ac9774493846cfb15e259d3b0e66 (patch)
tree82e8182af128580b6f38437feccba8c0f48abdc1 /libs/pwyazh/mesh.h
parent1ee094199af9c169e1ccaa53c7b0c186c4a3639e (diff)
restructure
Diffstat (limited to 'libs/pwyazh/mesh.h')
-rw-r--r--libs/pwyazh/mesh.h19
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 */