Thu, 29 May 2025 11:20:49 +0200
remove unused context variable
/* * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * Copyright 2023 Mike Becker. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #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; enum AscMeshType type; unsigned vtx_count; unsigned vtx_data_size; 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); struct asc_mesh_init_plane_2d_args { asc_vec2f size; asc_vec2f uv_offset; asc_vec2f uv_scale; }; /** * Write a 2D plane to the specified mesh data. * * @param mesh the mesh to initialize * @param ... the initialization parameters */ #define asc_mesh_plane_2d(mesh, ...) asc_mesh_init_plane_2d(mesh, (struct asc_mesh_init_plane_2d_args){__VA_ARGS__}) void asc_mesh_init_plane_2d(AscMesh *mesh, struct asc_mesh_init_plane_2d_args args); // TODO: replace below functions with a batched rendering implementation /** * Allocates VBO and VAO for one or more meshes. * * @param mesh pointer to a mesh or an array of meshes * @param count the number of meshes (maximum 32) */ void asc_mesh_allocate_buffers(AscMesh *mesh, unsigned count); /** * Frees VBO and VAO for one or more meshes. * * @param mesh pointer to a mesh or an array of meshes * @param count the number of meshes (maximum 32) */ void asc_mesh_free_buffers(AscMesh *mesh, unsigned count); /** * Draws the mesh as a triangle strip. * * @param mesh the mesh to draw */ void asc_mesh_draw_triangle_strip(const AscMesh *mesh); #endif //ASCENSION_MESH_H