diff options
author | sanine-a <sanine.not@pm.me> | 2020-10-19 05:35:06 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2020-10-19 05:35:06 -0500 |
commit | 41fa908dc15b522e53946a716f4f6c00520bd46f (patch) | |
tree | bc8176462000b2c77c00d3227037c1acbb13e0ee /src/mesh/mesh.h | |
parent | 2d046ffd16d8ff3a06f92ca438ca6b2d6842ce6a (diff) |
add honey libraries back and reorganize directories
Diffstat (limited to 'src/mesh/mesh.h')
-rw-r--r-- | src/mesh/mesh.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/mesh/mesh.h b/src/mesh/mesh.h new file mode 100644 index 0000000..a3e1e2a --- /dev/null +++ b/src/mesh/mesh.h @@ -0,0 +1,57 @@ +#ifndef HONEY_MESH_H +#define HONEY_MESH_H + +/** @file mesh.h + * + * @brief Defines the honey_mesh struct and related basic mesh functions. +*/ + + + +#include "../common.h" +#include "../shader/shader.h" + +typedef struct { + float* vertices; + unsigned int n_vertices; + unsigned int* indices; + unsigned int n_indices; + unsigned int vertex_array, vertex_buffer, element_buffer; +} honey_mesh; + +/** @brief Create a new mesh from vertex and index arrays. + * + * Note that this function creates copies of the vertex and index arrays, + * so you can deallocate those immediately. + * + * @param[out] mesh Pointer to the destination honey_mesh struct + * @param[in] vertices Array of floats representing the vertices + * @param[in] n_attributes The number of attributes per vertex + * @param[in] attribute_sizes An array containing for each attribute how many floats it contains + * @param[in] n_vertices The number of vertices (NOT the number of floats in the vertex array) + * @param[in] indices Array of vertex indices + * @param[in] n_indices The number of elements in the index array + */ +honey_result honey_mesh_new(honey_mesh* mesh, + float* vertices, + unsigned int n_vertices, + unsigned int n_attributes, + unsigned int* attribute_sizes, + unsigned int* indices, + unsigned int n_indices); + +/** @brief Draw a mesh on screen. + * + * @param[in] mesh The mesh to draw + * @param[in] shader The shader to use when drawing the mesh + */ +void honey_mesh_draw(honey_mesh mesh, + honey_shader shader); + +/** @brief Delete a mesh. + * + * @param[in] mesh The mesh to delete + */ +void honey_mesh_delete(honey_mesh mesh); + +#endif |