From bf1c59565096ac9774493846cfb15e259d3b0e66 Mon Sep 17 00:00:00 2001
From: pryazha <pryadeiniv@mail.ru>
Date: Thu, 23 Jan 2025 19:39:54 +0500
Subject: restructure

---
 libs/pwyazh/mesh.h | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

(limited to 'libs/pwyazh/mesh.h')

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 */
-- 
cgit v1.2.3