#pragma once #include #include "cglm/types.h" #include "glad.h" #include "utils.h" enum image_type_e { IMAGE_TYPE_2D = GL_TEXTURE_2D, }; enum image_format_e { IMAGE_FORMAT_RGBA = GL_RGBA, IMAGE_FORMAT_RED = GL_RED, }; enum image_data_type_e { IMAGE_DATA_TYPE_UNSIGNED_BYTE = GL_UNSIGNED_BYTE, }; typedef u32 texture_t; bool wayc_image_init(texture_t* texture, image_type_e type, image_format_e format, u32 width, u32 height); bool wayc_image_upload(texture_t texture, ivec2 offset, u32 width, u32 height, image_type_e type, image_format_e format, image_data_type_e data_type, const u8* data); void wayc_image_use(texture_t texture, u32 slot); void wayc_image_deinit(texture_t* texture); enum sample_filter_e { SAMPLE_FILTER_NEAREST = GL_NEAREST, SAMPLE_FILTER_LINEAR = GL_LINEAR, }; enum sample_wrap_e { SAMPLE_WRAP_CLAMP_TO_EDGE = GL_CLAMP_TO_EDGE, SAMPLE_WRAP_REPEAT = GL_REPEAT, }; typedef u32 sampler_t; bool wayc_sampler_init(sampler_t* sampler, sample_filter_e filter, sample_wrap_e wrap); void wayc_sampler_use(sampler_t sampler, u32 slot); void wayc_sampler_deinit(sampler_t* sampler); struct atlas_s { texture_t texture; sampler_t sampler; u32 width, height; image_format_e format; }; bool wayc_atlas_init(atlas_s* atlas, image_format_e format, u32 width, u32 height); void wayc_atlas_use(atlas_s* atlas, u32 slot); void wayc_atlas_set(atlas_s* atlas, image_data_type_e data_type, ivec2 offset, u32 width, u32 height, const u8* data); void wayc_atlas_deinit(atlas_s* atlas);