Add scaling steps to menu_display_matrix4x4_rotate_z too

This commit is contained in:
twinaphex 2015-11-02 19:47:25 +01:00
parent d970f16106
commit b34fb9e081
4 changed files with 23 additions and 32 deletions

View File

@ -181,14 +181,11 @@ static void glui_draw_icon(gl_t *gl, glui_handle_t *glui,
GRfloat *color)
{
struct gfx_coords coords;
math_matrix_4x4 mymat, mscal;
math_matrix_4x4 mymat;
menu_display_blend_begin();
menu_display_matrix_4x4_rotate_z(&mymat, rotation);
matrix_4x4_scale(&mscal, scale_factor, scale_factor, 1);
matrix_4x4_multiply(&mymat, &mscal, &mymat);
menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true);
coords.vertices = 4;
coords.vertex = glui_vertexes;

View File

@ -352,7 +352,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
GRfloat *color)
{
struct gfx_coords coords;
math_matrix_4x4 mymat, mscal;
math_matrix_4x4 mymat;
if (
x < -xmb->icon.size/2 ||
@ -361,10 +361,7 @@ static void xmb_draw_icon(gl_t *gl, xmb_handle_t *xmb,
y > height + xmb->icon.size)
return;
menu_display_matrix_4x4_rotate_z(&mymat, rotation);
matrix_4x4_scale(&mscal, scale_factor, scale_factor, 1);
matrix_4x4_multiply(&mymat, &mscal, &mymat);
menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true);
coords.vertices = 4;
coords.vertex = rmb_vertex;
@ -416,18 +413,12 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
static void xmb_draw_boxart(gl_t *gl, xmb_handle_t *xmb, GRfloat *color, unsigned width, unsigned height)
{
struct gfx_coords coords;
float x, y;
math_matrix_4x4 mymat, mscal;
y = xmb->margins.screen.top + xmb->icon.size + xmb->boxart_size;
x = xmb->margins.screen.left + xmb->icon.spacing.horizontal +
math_matrix_4x4 mymat;
float y = xmb->margins.screen.top + xmb->icon.size + xmb->boxart_size;
float x = xmb->margins.screen.left + xmb->icon.spacing.horizontal +
xmb->icon.spacing.horizontal*4 - xmb->icon.size / 4;
menu_display_matrix_4x4_rotate_z(&mymat, 0);
matrix_4x4_scale(&mscal, 1, 1, 1);
matrix_4x4_multiply(&mymat, &mscal, &mymat);
menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true);
coords.vertices = 4;
coords.vertex = rmb_vertex;
@ -1190,7 +1181,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
unsigned width, unsigned height)
{
unsigned i, ticker_limit;
math_matrix_4x4 mymat, mscal;
math_matrix_4x4 mymat;
xmb_node_t *core_node = NULL;
size_t end = 0;
uint64_t *frame_count = video_driver_get_frame_count();
@ -1205,10 +1196,7 @@ static void xmb_draw_items(xmb_handle_t *xmb, gl_t *gl,
end = file_list_get_size(list);
menu_display_matrix_4x4_rotate_z(&mymat, 0 /* rotation */);
matrix_4x4_scale(&mscal, 1 /* scale_factor */, 1 /* scale_factor */, 1);
matrix_4x4_multiply(&mymat, &mscal, &mymat);
menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true);
i = menu_entries_get_start();
@ -1534,7 +1522,7 @@ static void xmb_frame_horizontal_list(xmb_handle_t *xmb,
static void xmb_frame(void)
{
size_t selection;
math_matrix_4x4 mymat, mscal;
math_matrix_4x4 mymat;
unsigned depth, i, width, height;
char msg[PATH_MAX_LENGTH];
char title_msg[PATH_MAX_LENGTH];
@ -1630,10 +1618,7 @@ static void xmb_frame(void)
xmb->categories.selection_ptr,
&item_color[0], width, height);
menu_display_matrix_4x4_rotate_z(&mymat, 0 /* rotation */);
matrix_4x4_scale(&mscal, 1 /* scale_factor */, 1 /* scale_factor */, 1);
matrix_4x4_multiply(&mymat, &mscal, &mymat);
menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true);
menu_display_blend_begin();

View File

@ -503,9 +503,11 @@ static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type
return 0;
}
void menu_display_matrix_4x4_rotate_z(void *data, float rotation)
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable)
{
math_matrix_4x4 matrix_rotated;
math_matrix_4x4 matrix_scaled;
math_matrix_4x4 *b = NULL;
math_matrix_4x4 *matrix = (math_matrix_4x4*)data;
#ifdef HAVE_OPENGL
@ -521,6 +523,12 @@ void menu_display_matrix_4x4_rotate_z(void *data, float rotation)
matrix_4x4_rotate_z(&matrix_rotated, rotation);
matrix_4x4_multiply(matrix, &matrix_rotated, b);
if (!scale_enable)
return;
matrix_4x4_scale(&matrix_scaled, scale_x, scale_y, scale_z);
matrix_4x4_multiply(matrix, &matrix_scaled, matrix);
}
void menu_display_blend_begin(void)

View File

@ -127,7 +127,8 @@ void menu_display_clear_color(void *data, float r, float g, float b, float a);
#endif
void menu_display_matrix_4x4_rotate_z(void *data, float rotation);
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
float scale_x, float scale_y, float scale_z, bool scale_enable);
const char *menu_video_get_ident(void);