rendering.c: non-square rotating sprites
This commit is contained in:
@ -241,7 +241,15 @@ static void render_sprites(const struct primitive_2d primitives[],
|
||||
} else {
|
||||
/* rotated non-square case*/
|
||||
|
||||
CRY("Rotation", "Unimplemented");
|
||||
const t_fvec2 c = frect_center(sprite.rect);
|
||||
const t_fvec2 t = fast_cossine(sprite.rotation);
|
||||
|
||||
const t_fvec2 h = { sprite.rect.w / 2, sprite.rect.h / 2 };
|
||||
|
||||
v0 = (t_fvec2){ c.x + t.x * -h.x - t.y * -h.y, c.y + t.y * -h.x + t.x * -h.y };
|
||||
v1 = (t_fvec2){ c.x + t.x * -h.x - t.y * +h.y, c.y + t.y * -h.x + t.x * +h.y };
|
||||
v2 = (t_fvec2){ c.x + t.x * +h.x - t.y * +h.y, c.y + t.y * +h.x + t.x * +h.y };
|
||||
v3 = (t_fvec2){ c.x + t.x * +h.x - t.y * -h.y, c.y + t.y * +h.x + t.x * -h.y };
|
||||
}
|
||||
|
||||
if (!batch.constant_colored)
|
||||
|
Reference in New Issue
Block a user