From eda8ad35f3aeef51975cd990c43128f96030beca Mon Sep 17 00:00:00 2001 From: BromBrom <190221485+brombrom-hani@users.noreply.github.com> Date: Thu, 28 Aug 2025 22:32:53 +0200 Subject: [PATCH] fix: Y origin in prepare_chipmunk_shader Convert surface_area from top-left pixels to bottom-left UVs so `bot_left`/`top_right` align with `tex_coord` and the clip box is correct. --- src/sprite.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sprite.c b/src/sprite.c index 7b28bde..52ef3da 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -109,8 +109,9 @@ static void prepare_chipmunk_shader(struct gfx_render_job *job, void *data) r = (Rectangle) { 0, 0, sp->rect.w, sp->rect.h }; } - glUniform2f(s->bot_left, r.x, r.y); - glUniform2f(s->top_right, r.x + r.w, r.y + r.h); + int sy_bottom = sp->rect.h - (r.y + r.h); + glUniform2f(s->bot_left, r.x, sy_bottom); + glUniform2f(s->top_right, r.x + r.w, sy_bottom + r.h); } void sprite_init_sact(void)