rendering.c: sprite texture flipping

This commit is contained in:
veclav talica 2024-07-27 15:44:34 +03:00
parent c529e6ee4e
commit 687e42ddfd

View File

@ -99,7 +99,6 @@ static struct sprite_batch {
}
/* TODO: texture flipping */
/* assumes that orthogonal matrix setup is done already */
static void render_sprites(const struct primitive_2d primitives[],
const size_t len,
@ -142,32 +141,32 @@ static void render_sprites(const struct primitive_2d primitives[],
sprite.rect.x,
sprite.rect.y },
.uv0 = {
xr,
yr, },
xr + wr * sprite.flip_x,
yr + hr * sprite.flip_y, },
/* bottom-left */
.v1 = {
(sprite.rect.x),
(sprite.rect.y + sprite.rect.h) },
.uv1 = {
xr,
yr + hr, },
xr + wr * sprite.flip_x,
yr + hr * !sprite.flip_y, },
/* bottom-right */
.v2 = {
(sprite.rect.x + sprite.rect.w),
(sprite.rect.y + sprite.rect.h) },
.uv2 = {
xr + wr,
yr + hr, },
xr + wr * !sprite.flip_x,
yr + hr * !sprite.flip_y, },
/* upper-right */
.v3 = {
(sprite.rect.x + sprite.rect.w),
(sprite.rect.y) },
.uv3 = {
xr + wr,
yr, },
xr + wr * !sprite.flip_x,
yr + hr * sprite.flip_y, },
/* equal for all (flat shaded) */
.c0 = sprite.color,