summaryrefslogtreecommitdiff
path: root/src/rendering.h
diff options
context:
space:
mode:
authorFabrice <fabrice@schaub-dev.xyz>2026-02-12 12:44:44 +0100
committerFabrice <fabrice@schaub-dev.xyz>2026-02-12 12:44:44 +0100
commit716cccb220a9e2337320ac591d575a2f68b4ed2c (patch)
tree5d5151ff0c1dda0b847e1e0bf6ab8d6f2ac61c2c /src/rendering.h
parentc8e3a40dfcc09a051a6bafd06c7591b82bf17710 (diff)
ohj
Diffstat (limited to 'src/rendering.h')
-rw-r--r--src/rendering.h138
1 files changed, 0 insertions, 138 deletions
diff --git a/src/rendering.h b/src/rendering.h
deleted file mode 100644
index 45a65c4..0000000
--- a/src/rendering.h
+++ /dev/null
@@ -1,138 +0,0 @@
-#pragma once
-
-#include <cglm/cglm.h>
-
-#include "cglm/types.h"
-#include "glad.h"
-#include "utils.h"
-
-struct quad_s {
- vec2 vertices[WAYC_QUAD_NVERTS];
- u32 indices[WAYC_QUAD_NINDICES];
-};
-
-static inline void wayc_quad_init(quad_s* quad, f32 left, f32 top, f32 right,
- f32 bottom) {
- wayc_notnull(quad);
-
- /*
- 0 ---- 1
- | |
- | |
- 3 ---- 2
- */
-
- // Vertices (CCW order)
- WAYC_X(quad->vertices[0]) = left;
- WAYC_Y(quad->vertices[0]) = top;
-
- WAYC_X(quad->vertices[1]) = right;
- WAYC_Y(quad->vertices[1]) = top;
-
- WAYC_X(quad->vertices[2]) = right;
- WAYC_Y(quad->vertices[2]) = bottom;
-
- WAYC_X(quad->vertices[3]) = left;
- WAYC_Y(quad->vertices[3]) = bottom;
-
- /*
- Triangles (CCW):
- 0 1 2
- 0 2 3
- */
-
- quad->indices[0] = 0;
- quad->indices[1] = 1;
- quad->indices[2] = 2;
- quad->indices[3] = 0;
- quad->indices[4] = 2;
- quad->indices[5] = 3;
-}
-
-// TODO: review all structs and use types
-
-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,
-};
-
-enum {
- IMAGE_FORMAT_RGBA_ALIGNMENT = 4,
- IMAGE_FORMAT_RED_ALIGNMENT = 1,
-};
-
-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, i32 alignment,
- 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);
-bool wayc_atlas_set(atlas_s* atlas, image_data_type_e data_type, ivec2 offset,
- u32 width, u32 height, i32 alignment, const u8* data);
-void wayc_atlas_deinit(atlas_s* atlas);
-
-struct atlas_packer_s {
- struct atlas_s* atlas;
- u32 row_height;
- ivec2 cursor;
-};
-
-#define WAYC_ATLAS_PACKER_INIT(atlas) \
- atlas_packer_s { atlas, 0, {0, 0} }
-
-bool wayc_atlas_packer_allocate(struct atlas_packer_s* packer, u32 width,
- u32 height, ivec2 out);
-
-enum buffer_type_e {
- BUFFER_TYPE_VERTEX = GL_ARRAY_BUFFER,
- BUFFER_TYPE_INDEX = GL_ELEMENT_ARRAY_BUFFER,
-};
-
-typedef u32 buffer_t;
-
-bool wayc_buffer_init(buffer_t* buffer, usize size);
-bool wayc_buffer_set(buffer_t buffer, usize offset, usize size, const u8* data);
-void wayc_buffer_use(buffer_t buffer, buffer_type_e type);
-void wayc_buffer_deinit(buffer_t* buffer);