#ifndef SCUFENG_SHAPE_H_ #define SCUFENG_SHAPE_H_ #include #include #include "cglm/types.h" typedef enum { SE_TRIANGLES, SE_TRIANGLE_STRIP, SE_TRIANGLE_FAN, SE_LINES, SE_LINE_STRIP } SEDrawMode; typedef struct { vec3 pos; vec3 scale; vec3 rotation; } SETransform; typedef struct { float pos[3]; float tex_coords[2]; } SEVertex; typedef enum { SE_MESH_COLOR, SE_MESH_TEXTURE } SEMeshType; typedef struct { unsigned int id; float w; float h; } SEMeshTexture; typedef struct { unsigned int vao; unsigned int vbo; size_t verts_n; int draw_mode; SETransform transform; SEMeshType type; union { SEMeshTexture texture; vec4 color; }; } SEMesh; void SEMesh_free(SEMesh *const mesh); void SEMesh_set_draw_mode(SEMesh *mesh, const SEDrawMode mode); void SEMesh_render(const SEMesh *const mesh); void SEMesh_color_set(SEMesh *const mesh, const vec4 color); void SEMesh_line_segment_coords_set(SEMesh *const mesh, const vec2 a, const vec2 b); SEMesh SEMesh_line_segment_color_alloc(const vec2 a, const vec2 b, const vec4 color); void SEMesh_bbox_render_2d(const SEMesh *const mesh); void SEMesh_bbox_get_2d( const SEMesh *const mesh, float *left, float *right, float *top, float *bottom ); bool SEMesh_rect_is_pos_inside(const SEMesh *const mesh, const float x, const float y); SEMesh SEMesh_rect_color_alloc(vec4 color); SEMesh SEMesh_string_alloc( const char *text, const float scale, const vec3 color ); void SEMesh_render_multiple_2d(SEMesh *const *const meshes, const size_t meshes_n); // void SEShape_transform_apply(SEShape *const shape); #endif // SCUFENG_SHAPE_H_