mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
Have one default vertex coord array in menu_display.c
This commit is contained in:
parent
b90c78251d
commit
8e5a2fdc77
@ -102,12 +102,6 @@ typedef struct materialui_handle
|
||||
gfx_font_raster_block_t list_block;
|
||||
} materialui_handle_t;
|
||||
|
||||
static const GRfloat materialui_vertexes[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const GRfloat materialui_tex_coords[] = {
|
||||
0, 1,
|
||||
@ -186,7 +180,7 @@ static void materialui_draw_icon(materialui_handle_t *materialui,
|
||||
menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = materialui_vertexes;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = materialui_tex_coords;
|
||||
coords.lut_tex_coord = materialui_tex_coords;
|
||||
coords.color = (const float*)color;
|
||||
@ -241,7 +235,7 @@ static void materialui_render_quad(int x, int y, int w, int h,
|
||||
materialui_handle_t *materialui = (materialui_handle_t*)menu->userdata;
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = materialui_vertexes;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = materialui_tex_coords;
|
||||
coords.lut_tex_coord = materialui_tex_coords;
|
||||
coords.color = coord_color;
|
||||
@ -574,7 +568,7 @@ static void materialui_draw_cursor(materialui_handle_t *materialui,
|
||||
struct gfx_coords coords;
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = materialui_vertexes;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = materialui_tex_coords;
|
||||
coords.lut_tex_coord = materialui_tex_coords;
|
||||
coords.color = (const float*)color;
|
||||
@ -707,7 +701,7 @@ static void materialui_frame(void)
|
||||
width, height,
|
||||
materialui->textures.white, 0.75f, false,
|
||||
&white_transp_bg[0], &white_bg[0],
|
||||
&materialui_vertexes[0], &materialui_tex_coords[0], 4,
|
||||
NULL, &materialui_tex_coords[0], 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
}
|
||||
else
|
||||
@ -729,7 +723,7 @@ static void materialui_frame(void)
|
||||
width, height,
|
||||
materialui->textures.bg.id, 0.75f, true,
|
||||
&white_transp_bg[0], &white_bg[0],
|
||||
&materialui_vertexes[0], &materialui_tex_coords[0], 4,
|
||||
NULL, &materialui_tex_coords[0], 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
|
||||
/* Restore opacity of transposed white background */
|
||||
|
@ -223,13 +223,6 @@ typedef struct xmb_handle
|
||||
gfx_font_raster_block_t raster_block;
|
||||
} xmb_handle_t;
|
||||
|
||||
static const GRfloat rmb_vertex[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1,
|
||||
};
|
||||
|
||||
static const GRfloat rmb_tex_coord[] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
@ -363,7 +356,7 @@ static void xmb_draw_icon(xmb_handle_t *xmb,
|
||||
menu_display_matrix_4x4_rotate_z(&mymat, rotation, scale_factor, scale_factor, 1, true);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = rmb_tex_coord;
|
||||
coords.lut_tex_coord = rmb_tex_coord;
|
||||
coords.color = (const float*)color;
|
||||
@ -395,7 +388,7 @@ static void xmb_draw_icon_predone(xmb_handle_t *xmb,
|
||||
return;
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = rmb_tex_coord;
|
||||
coords.lut_tex_coord = rmb_tex_coord;
|
||||
coords.color = color;
|
||||
@ -420,7 +413,7 @@ static void xmb_draw_boxart(xmb_handle_t *xmb, GRfloat *color, unsigned width, u
|
||||
menu_display_matrix_4x4_rotate_z(&mymat, 0, 1, 1, 1, true);
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = rmb_tex_coord;
|
||||
coords.lut_tex_coord = rmb_tex_coord;
|
||||
coords.color = (const float*)color;
|
||||
@ -1409,7 +1402,7 @@ static void xmb_draw_cursor(xmb_handle_t *xmb,
|
||||
struct gfx_coords coords;
|
||||
|
||||
coords.vertices = 4;
|
||||
coords.vertex = rmb_vertex;
|
||||
coords.vertex = NULL;
|
||||
coords.tex_coord = rmb_tex_coord;
|
||||
coords.lut_tex_coord = rmb_tex_coord;
|
||||
coords.color = (const float*)color;
|
||||
@ -1571,7 +1564,7 @@ static void xmb_frame(void)
|
||||
|
||||
menu_display_frame_background(
|
||||
width, height, xmb->textures.bg.id, xmb->alpha, false, &coord_color[0],
|
||||
&coord_color2[0], &rmb_vertex[0], &rmb_tex_coord[0], 4,
|
||||
&coord_color2[0], NULL, &rmb_tex_coord[0], 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
|
||||
xmb_draw_text(menu, xmb,
|
||||
@ -1677,7 +1670,7 @@ static void xmb_frame(void)
|
||||
width, height,
|
||||
xmb->textures.bg.id, xmb->alpha, true,
|
||||
&coord_color[0], &coord_color2[0],
|
||||
&rmb_vertex[0], &rmb_tex_coord[0], 4,
|
||||
NULL, &rmb_tex_coord[0], 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
xmb_frame_messagebox(msg);
|
||||
}
|
||||
|
@ -198,13 +198,6 @@ static enum
|
||||
LAY_SETTINGS
|
||||
} layout = LAY_HOME;
|
||||
|
||||
static const GRfloat zarch_vertexes[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static const GRfloat zarch_tex_coords[] = {
|
||||
0, 1,
|
||||
1, 1,
|
||||
@ -1068,7 +1061,7 @@ static void zarch_frame(void)
|
||||
zui->width, zui->height,
|
||||
zui->textures.bg.id, 0.75f, false,
|
||||
&coord_color[0], &coord_color2[0],
|
||||
&zarch_vertexes[0], &zarch_tex_coords[0], 4,
|
||||
NULL, &zarch_tex_coords[0], 4,
|
||||
MENU_DISPLAY_PRIM_TRIANGLESTRIP);
|
||||
|
||||
menu_display_font_flush_block(zui->menu, driver->font_osd_driver);
|
||||
|
@ -488,23 +488,6 @@ void menu_display_msg_queue_push(const char *msg, unsigned prio, unsigned durati
|
||||
rarch_main_msg_queue_push(msg, prio, duration, flush);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type)
|
||||
{
|
||||
switch (prim_type)
|
||||
{
|
||||
case MENU_DISPLAY_PRIM_TRIANGLESTRIP:
|
||||
return GL_TRIANGLE_STRIP;
|
||||
case MENU_DISPLAY_PRIM_TRIANGLES:
|
||||
return GL_TRIANGLES;
|
||||
case MENU_DISPLAY_PRIM_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
|
||||
float scale_x, float scale_y, float scale_z, bool scale_enable)
|
||||
{
|
||||
@ -533,6 +516,30 @@ void menu_display_matrix_4x4_rotate_z(void *data, float rotation,
|
||||
matrix_4x4_multiply(matrix, &matrix_scaled, matrix);
|
||||
}
|
||||
|
||||
#ifdef HAVE_OPENGL
|
||||
static const GRfloat gl_vertexes[] = {
|
||||
0, 0,
|
||||
1, 0,
|
||||
0, 1,
|
||||
1, 1
|
||||
};
|
||||
|
||||
static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type)
|
||||
{
|
||||
switch (prim_type)
|
||||
{
|
||||
case MENU_DISPLAY_PRIM_TRIANGLESTRIP:
|
||||
return GL_TRIANGLE_STRIP;
|
||||
case MENU_DISPLAY_PRIM_TRIANGLES:
|
||||
return GL_TRIANGLES;
|
||||
case MENU_DISPLAY_PRIM_NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void menu_display_blend_begin(void)
|
||||
{
|
||||
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
||||
@ -574,6 +581,8 @@ void menu_display_draw_frame(
|
||||
|
||||
if (!mat)
|
||||
mat = &gl->mvp_no_rot;
|
||||
if (!coords->vertex)
|
||||
coords->vertex = &gl_vertexes[0];
|
||||
|
||||
glViewport(x, y, width, height);
|
||||
glBindTexture(GL_TEXTURE_2D, texture);
|
||||
@ -599,6 +608,7 @@ void menu_display_frame_background(
|
||||
size_t vertex_count,
|
||||
enum menu_display_prim_type prim_type)
|
||||
{
|
||||
const GRfloat *new_vertex;
|
||||
struct gfx_coords coords;
|
||||
global_t *global = global_get_ptr();
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -607,8 +617,13 @@ void menu_display_frame_background(
|
||||
if (!gl)
|
||||
return;
|
||||
|
||||
new_vertex = vertex;
|
||||
|
||||
if (!new_vertex)
|
||||
new_vertex = &gl_vertexes[0];
|
||||
|
||||
coords.vertices = vertex_count;
|
||||
coords.vertex = vertex;
|
||||
coords.vertex = new_vertex;
|
||||
coords.tex_coord = tex_coord;
|
||||
coords.lut_tex_coord = tex_coord;
|
||||
coords.color = (const float*)coord_color;
|
||||
|
Loading…
x
Reference in New Issue
Block a user