summaryrefslogtreecommitdiff
path: root/src/rendering.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/rendering.h')
-rw-r--r--src/rendering.h53
1 files changed, 48 insertions, 5 deletions
diff --git a/src/rendering.h b/src/rendering.h
index b7d4a2a..7803040 100644
--- a/src/rendering.h
+++ b/src/rendering.h
@@ -3,14 +3,57 @@
#include <cglm/cglm.h>
#include "cglm/types.h"
+#include "glad.h"
#include "utils.h"
struct uv_s {
- vec2 uv0;
- vec2 uv1;
+ ivec2 uv0;
+ ivec2 uv1;
};
-typedef u32 atlas_t;
+enum image_type_e {
+ IMAGE_TYPE_2D = GL_TEXTURE_2D,
+};
+
+enum image_format_e {
+ IMAGE_FORMAT_RGBA = GL_RGBA,
+};
+
+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, image_type_e type, 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);
+
+typedef texture_t atlas_t;
-bool atlas_init(atlas_t* atlas, u32 width, u32 height);
-void atlas_deinit(atlas_t* atlas);
+bool wayc_atlas_init(atlas_t* atlas, image_format_e format, u32 width,
+ u32 height);
+void wayc_atlas_deinit(atlas_t* atlas);