diff -r 5b91bbab1ac0 -r e5f8c99b0987 src/ascension/mesh.h --- a/src/ascension/mesh.h Sat May 10 15:42:56 2025 +0200 +++ b/src/ascension/mesh.h Sat May 10 18:51:45 2025 +0200 @@ -28,12 +28,61 @@ #ifndef ASCENSION_MESH_H #define ASCENSION_MESH_H +#include "datatypes.h" + +enum AscMeshType { + ASC_MESH_2D, + ASC_MESH_2D_COLORED, + ASC_MESH_3D, + ASC_MESH_3D_COLORED, +}; + typedef struct AscMesh { + // TODO: for batched rendering, VAO and VBO must not be part of the mesh unsigned vbo; unsigned vao; - unsigned vertices; + enum AscMeshType type; + unsigned vtx_count; + float *vtx_data; } AscMesh; +typedef struct AscMeshVertex2d { + asc_vec2f pos; + asc_vec2f uv; +} AscMeshVertex2d; + +typedef struct AscMeshVertex2dColored { + asc_vec2f pos; + asc_vec2f uv; + asc_col4f color; +} AscMeshVertex2dColored; + +typedef struct AscMeshVertex3d { + asc_vec3f pos; + asc_vec2f uv; +} AscMeshVertex3d; + +typedef struct AscMeshVertex3dColored { + asc_vec3f pos; + asc_vec2f uv; + asc_col4f color; +} AscMeshVertex3dColored; + + +void asc_mesh_destroy(AscMesh *mesh); + + +/** + * Creates a 2D plane. + * + * @param mesh the mesh to initialize + */ +void asc_mesh_plane_2d(AscMesh *mesh); + + + +// TODO: replace below functions with a batched rendering implementation + /** * Allocates VBO and VAO for one or more meshes. * @@ -55,6 +104,6 @@ * * @param mesh the mesh to draw */ -void asc_mesh_draw_triangle_strip(AscMesh *mesh); +void asc_mesh_draw_triangle_strip(const AscMesh *mesh); #endif //ASCENSION_MESH_H