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