diff options
author | Mitya Selivanov <automainint@guattari.tech> | 2025-04-25 09:06:27 +0200 |
---|---|---|
committer | Mitya Selivanov <automainint@guattari.tech> | 2025-04-25 09:06:27 +0200 |
commit | 3f37db0647cb31955c8ad271f747c8e1ee5d2124 (patch) | |
tree | afcf171fc145f9cfe0f13c3e8f22348015c522da /graphics.c | |
parent | 27291f388b02c6ba88efb79b9728b65f158589ef (diff) | |
download | reduced_system_layer-3f37db0647cb31955c8ad271f747c8e1ee5d2124.zip |
Global gamma is disabled by default
Diffstat (limited to 'graphics.c')
-rw-r--r-- | graphics.c | 61 |
1 files changed, 8 insertions, 53 deletions
@@ -166,7 +166,7 @@ typedef struct { Box font_text_area_dispatch(i32 font, vec2 scale, i64 num_chars, c32 *text); -void font_render_to_buffer_dispatch(Pixel_Buffer dst, i32 font, vec4_f32 color, vec2 position, vec2 scale, i64 num_chars, c32 *text); +void font_render_to_stencil_dispatch(Stencil_Buffer dst, i32 font, vec2 position, vec2 scale, i64 num_chars, c32 *text); // ================================================================ @@ -256,56 +256,6 @@ enum { CHAR_NUM_BITS_ = CHAR_NUM_BITS_X_ * CHAR_NUM_BITS_Y_, }; -static i64 min2_i64_(i64 x, i64 y) { - return x < y ? x : y; -} - -static f32 max2_f32_(f32 a, f32 b) { - return a < b ? b : a; -} - -static f64 min3_(f64 a, f64 b, f64 c) { - if (a < b && a < c) - return a; - if (b < c) - return b; - return c; -} - -static f64 max3_(f64 a, f64 b, f64 c) { - if (a > b && a > c) - return a; - if (b > c) - return b; - return c; -} - -static f64 min4_(f64 a, f64 b, f64 c, f64 d) { - if (a < b && a < c && a < d) - return a; - if (b < c && b < d) - return b; - if (c < d) - return c; - return d; -} - -static f64 max4_(f64 a, f64 b, f64 c, f64 d) { - if (a > b && a > c && a > d) - return a; - if (b > c && b > d) - return b; - if (c > d) - return c; - return d; -} - -static b8 same_sign_(f64 a, f64 b) { - if (a >= EPSILON && b <= -EPSILON) return 0; - if (a <= -EPSILON && b >= EPSILON) return 0; - return 1; -} - static void put_pixel_(vec4_f32 *dst, vec4_f32 color) { if (color.w == 1.f) *dst = color; @@ -826,12 +776,11 @@ Box font_text_area_dispatch(i32 font, vec2 scale, i64 num_chars, c32 *text) { return (Box) {0}; } -void font_render_to_buffer_dispatch(Pixel_Buffer dst, i32 font, vec4_f32 color, vec2 position, vec2 scale, i64 num_chars, c32 *text) { +void font_render_to_stencil_dispatch(Stencil_Buffer dst, i32 font, vec2 position, vec2 scale, i64 num_chars, c32 *text) { // TODO (void) dst; (void) font; - (void) color; (void) position; (void) scale; (void) num_chars; @@ -1199,6 +1148,12 @@ b8 hit_rectangle(Box area, vec2 point) { return point.x >= area.x && point.x < area.x + area.width && point.y >= area.y && point.y < area.y + area.height; } +static b8 same_sign_(f64 a, f64 b) { + if (a >= EPSILON && b <= -EPSILON) return 0; + if (a <= -EPSILON && b >= EPSILON) return 0; + return 1; +} + b8 hit_triangle(vec2 vertices[3], vec2 point) { f64 x0 = vertices[0].x; f64 y0 = vertices[0].y; |