mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
(Menu) Add get_default_mvp function pointer
This commit is contained in:
parent
f8247d6f0e
commit
ab7b7b538f
@ -17,7 +17,6 @@
|
||||
|
||||
#include <queues/message_queue.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../gfx/font_renderer_driver.h"
|
||||
@ -42,14 +41,14 @@ static const GLfloat gl_tex_coords[] = {
|
||||
1, 0
|
||||
};
|
||||
|
||||
static math_matrix_4x4 *menu_display_get_default_mvp(void)
|
||||
static void *menu_display_gl_get_default_mvp(void)
|
||||
{
|
||||
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
||||
gl_t *gl = (gl_t*)video_driver_get_ptr(NULL);
|
||||
|
||||
if (!gl)
|
||||
return NULL;
|
||||
|
||||
return (math_matrix_4x4*)&gl->mvp_no_rot;
|
||||
return &gl->mvp_no_rot;
|
||||
}
|
||||
|
||||
static GLenum menu_display_prim_to_gl_enum(enum menu_display_prim_type prim_type)
|
||||
@ -194,26 +193,6 @@ static void menu_display_gl_clear_color(float r, float g, float b, float a)
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
|
||||
static void menu_display_gl_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 *matrix = (math_matrix_4x4*)data;
|
||||
math_matrix_4x4 *b = menu_display_get_default_mvp();
|
||||
if (!matrix)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static unsigned menu_display_gl_texture_load(void *data, enum texture_filter_type type)
|
||||
{
|
||||
return video_texture_load(data, TEXTURE_BACKEND_OPENGL, type);
|
||||
@ -238,7 +217,7 @@ menu_display_ctx_driver_t menu_display_ctx_gl = {
|
||||
menu_display_gl_blend_end,
|
||||
menu_display_gl_restore_clear_color,
|
||||
menu_display_gl_clear_color,
|
||||
menu_display_gl_matrix_4x4_rotate_z,
|
||||
menu_display_gl_get_default_mvp,
|
||||
menu_display_gl_get_tex_coords,
|
||||
menu_display_gl_texture_load,
|
||||
menu_display_gl_texture_unload,
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
#include <queues/message_queue.h>
|
||||
#include <retro_miscellaneous.h>
|
||||
#include <gfx/math/matrix_4x4.h>
|
||||
|
||||
#include "../../config.def.h"
|
||||
#include "../../gfx/font_renderer_driver.h"
|
||||
@ -27,6 +26,11 @@
|
||||
|
||||
#include "../menu_display.h"
|
||||
|
||||
static void *menu_display_null_get_default_mvp(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void menu_display_null_blend_begin(void)
|
||||
{
|
||||
}
|
||||
@ -69,11 +73,6 @@ static void menu_display_null_clear_color(float r, float g, float b, float a)
|
||||
{
|
||||
}
|
||||
|
||||
static void menu_display_null_matrix_4x4_rotate_z(void *data, float rotation,
|
||||
float scale_x, float scale_y, float scale_z, bool scale_enable)
|
||||
{
|
||||
}
|
||||
|
||||
static unsigned menu_display_null_texture_load(void *data, enum texture_filter_type type)
|
||||
{
|
||||
return 0;
|
||||
@ -96,7 +95,7 @@ menu_display_ctx_driver_t menu_display_ctx_null = {
|
||||
menu_display_null_blend_end,
|
||||
menu_display_null_restore_clear_color,
|
||||
menu_display_null_clear_color,
|
||||
menu_display_null_matrix_4x4_rotate_z,
|
||||
menu_display_null_get_default_mvp,
|
||||
menu_display_null_get_tex_coords,
|
||||
menu_display_null_texture_load,
|
||||
menu_display_null_texture_unload,
|
||||
|
@ -581,11 +581,26 @@ void menu_display_blend_end(void)
|
||||
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, *b;
|
||||
math_matrix_4x4 matrix_rotated;
|
||||
math_matrix_4x4 matrix_scaled;
|
||||
menu_display_ctx_driver_t *menu_disp = menu_display_context_get_ptr();
|
||||
if (!menu_disp)
|
||||
if (!menu_disp || !menu_disp->get_default_mvp)
|
||||
return;
|
||||
|
||||
menu_disp->matrix_4x4_rotate_z(data, rotation, scale_x, scale_y, scale_z, scale_enable);
|
||||
matrix = (math_matrix_4x4*)data;
|
||||
b = (math_matrix_4x4*)menu_disp->get_default_mvp();
|
||||
if (!matrix)
|
||||
return;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
unsigned menu_display_texture_load(void *data,
|
||||
|
@ -103,8 +103,7 @@ typedef struct menu_display_ctx_driver
|
||||
|
||||
void (*clear_color)(float r, float g, float b, float a);
|
||||
|
||||
void (*matrix_4x4_rotate_z)(void *data, float rotation,
|
||||
float scale_x, float scale_y, float scale_z, bool scale_enable);
|
||||
void *(*get_default_mvp)(void);
|
||||
const float *(*get_tex_coords)(void);
|
||||
unsigned (*texture_load)(void *data, enum texture_filter_type type);
|
||||
void (*texture_unload)(uintptr_t *id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user