mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
Simplify gfx_display_rotate_z
This commit is contained in:
parent
91c8541e20
commit
50873f7c38
@ -959,30 +959,43 @@ void gfx_display_draw_texture_slice(
|
|||||||
void gfx_display_rotate_z(gfx_display_t *p_disp,
|
void gfx_display_rotate_z(gfx_display_t *p_disp,
|
||||||
gfx_display_ctx_rotate_draw_t *draw, void *data)
|
gfx_display_ctx_rotate_draw_t *draw, void *data)
|
||||||
{
|
{
|
||||||
math_matrix_4x4 matrix_rotated, matrix_scaled;
|
float cosine, sine, radians;
|
||||||
math_matrix_4x4 *b = NULL;
|
math_matrix_4x4 matrix_rotated = {
|
||||||
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
{ 0.0f, 0.0f, 0.0f, 0.0f ,
|
||||||
|
0.0f, 0.0f, 0.0f, 0.0f ,
|
||||||
|
0.0f, 0.0f, 1.0f, 0.0f ,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f }
|
||||||
|
};
|
||||||
|
math_matrix_4x4 *b = NULL;
|
||||||
|
gfx_display_ctx_driver_t *dispctx = p_disp->dispctx;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!draw ||
|
dispctx->handles_transform
|
||||||
!dispctx ||
|
|| !dispctx->get_default_mvp
|
||||||
!dispctx->get_default_mvp ||
|
|| !(b = (math_matrix_4x4*)dispctx->get_default_mvp(data))
|
||||||
dispctx->handles_transform
|
|
||||||
)
|
)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(b = (math_matrix_4x4*)dispctx->get_default_mvp(data)))
|
radians = draw->rotation;
|
||||||
return;
|
cosine = cosf(radians);
|
||||||
|
sine = sinf(radians);
|
||||||
|
MAT_ELEM_4X4(matrix_rotated, 0, 0) = cosine;
|
||||||
|
MAT_ELEM_4X4(matrix_rotated, 0, 1) = -sine;
|
||||||
|
MAT_ELEM_4X4(matrix_rotated, 1, 0) = sine;
|
||||||
|
MAT_ELEM_4X4(matrix_rotated, 1, 1) = cosine;
|
||||||
|
|
||||||
matrix_4x4_rotate_z(matrix_rotated, draw->rotation);
|
|
||||||
matrix_4x4_multiply(*draw->matrix, matrix_rotated, *b);
|
matrix_4x4_multiply(*draw->matrix, matrix_rotated, *b);
|
||||||
|
|
||||||
if (!draw->scale_enable)
|
if (draw->scale_enable)
|
||||||
return;
|
{
|
||||||
|
math_matrix_4x4 matrix_scaled = {
|
||||||
matrix_4x4_scale(matrix_scaled,
|
{ draw->scale_x, 0.0f, 0.0f, 0.0f ,
|
||||||
draw->scale_x, draw->scale_y, draw->scale_z);
|
0.0f, draw->scale_y, 0.0f, 0.0f ,
|
||||||
matrix_4x4_multiply(*draw->matrix, matrix_scaled, *draw->matrix);
|
0.0f, 0.0f, draw->scale_z, 0.0f ,
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f }
|
||||||
|
};
|
||||||
|
matrix_4x4_multiply(*draw->matrix, matrix_scaled, *draw->matrix);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user