Don't use projection abstraction in GL.
Makes no sense anymore as it's calculated with gfx/math/ ... Keep abstraction for XBox.
This commit is contained in:
parent
9b5ea744ac
commit
a1999af4a7
|
@ -603,23 +603,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
|
||||||
*input_data = linuxinput;
|
*input_data = linuxinput;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
|
|
||||||
{
|
|
||||||
// Calculate projection.
|
|
||||||
math_matrix proj;
|
|
||||||
matrix_ortho(&proj, ortho->left, ortho->right,
|
|
||||||
ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
|
|
||||||
|
|
||||||
if (allow_rotate)
|
|
||||||
{
|
|
||||||
math_matrix rot;
|
|
||||||
matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f);
|
|
||||||
matrix_multiply(&proj, &rot, &proj);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->mvp = proj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gfx_ctx_window_has_focus(void)
|
bool gfx_ctx_window_has_focus(void)
|
||||||
{
|
{
|
||||||
return g_inited;
|
return g_inited;
|
||||||
|
|
|
@ -292,23 +292,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENGL
|
#ifdef HAVE_OPENGL
|
||||||
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
|
|
||||||
{
|
|
||||||
// Calculate projection.
|
|
||||||
math_matrix proj;
|
|
||||||
matrix_ortho(&proj, ortho->left, ortho->right,
|
|
||||||
ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
|
|
||||||
|
|
||||||
if (allow_rotate)
|
|
||||||
{
|
|
||||||
math_matrix rot;
|
|
||||||
matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f);
|
|
||||||
matrix_multiply(&proj, &rot, &proj);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->mvp = proj;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enforce void (*)(void) as it's not really legal to cast void* to fn-pointer.
|
// Enforce void (*)(void) as it's not really legal to cast void* to fn-pointer.
|
||||||
// POSIX allows this, but strict C99 doesn't.
|
// POSIX allows this, but strict C99 doesn't.
|
||||||
gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
|
gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *symbol)
|
||||||
|
|
|
@ -224,7 +224,11 @@ bool gfx_ctx_init(void)
|
||||||
EGL_GREEN_SIZE, 1,
|
EGL_GREEN_SIZE, 1,
|
||||||
EGL_BLUE_SIZE, 1,
|
EGL_BLUE_SIZE, 1,
|
||||||
EGL_DEPTH_SIZE, 1,
|
EGL_DEPTH_SIZE, 1,
|
||||||
|
#ifdef HAVE_OPENGLES2
|
||||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||||
|
#else
|
||||||
|
EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
|
||||||
|
#endif
|
||||||
EGL_NONE,
|
EGL_NONE,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -389,23 +393,6 @@ void gfx_ctx_input_driver(const input_driver_t **input, void **input_data)
|
||||||
x_input_set_disp_win((x11_input_t*)xinput, g_dpy, g_win);
|
x_input_set_disp_win((x11_input_t*)xinput, g_dpy, g_win);
|
||||||
}
|
}
|
||||||
|
|
||||||
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate)
|
|
||||||
{
|
|
||||||
// Calculate projection.
|
|
||||||
math_matrix proj;
|
|
||||||
matrix_ortho(&proj, ortho->left, ortho->right,
|
|
||||||
ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
|
|
||||||
|
|
||||||
if (allow_rotate)
|
|
||||||
{
|
|
||||||
math_matrix rot;
|
|
||||||
matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f);
|
|
||||||
matrix_multiply(&proj, &rot, &proj);
|
|
||||||
}
|
|
||||||
|
|
||||||
gl->mvp = proj;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool gfx_ctx_window_has_focus(void)
|
bool gfx_ctx_window_has_focus(void)
|
||||||
{
|
{
|
||||||
if (!g_inited)
|
if (!g_inited)
|
||||||
|
|
|
@ -29,10 +29,6 @@
|
||||||
#define VID_HANDLE gl_t
|
#define VID_HANDLE gl_t
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_D3D8) || defined(HAVE_D3D9)
|
|
||||||
#define VID_HANDLE xdk_d3d_video_t
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(HAVE_SDL) && !defined(__APPLE__)
|
#if defined(HAVE_SDL) && !defined(__APPLE__)
|
||||||
#include "SDL_syswm.h"
|
#include "SDL_syswm.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -75,10 +71,11 @@ void gfx_ctx_get_available_resolutions(void);
|
||||||
int gfx_ctx_check_resolution(unsigned resolution_id);
|
int gfx_ctx_check_resolution(unsigned resolution_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_OPENGL) || defined(HAVE_D3D9) || defined(HAVE_D3D8)
|
|
||||||
typedef void (*gfx_ctx_proc_t)(void);
|
typedef void (*gfx_ctx_proc_t)(void);
|
||||||
void gfx_ctx_set_projection(VID_HANDLE *gl, const struct gl_ortho *ortho, bool allow_rotate);
|
|
||||||
gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *sym);
|
gfx_ctx_proc_t gfx_ctx_get_proc_address(const char *sym);
|
||||||
|
|
||||||
|
#if defined(HAVE_D3D9) || defined(HAVE_D3D8)
|
||||||
|
void gfx_ctx_set_projection(xdk_d3d_video_t *vid, const struct gl_ortho *ortho, bool allow_rotate);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
14
gfx/gl.c
14
gfx/gl.c
|
@ -589,7 +589,19 @@ void gl_set_projection(gl_t *gl, struct gl_ortho *ortho, bool allow_rotate)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gfx_ctx_set_projection(gl, ortho, allow_rotate);
|
// Calculate projection.
|
||||||
|
math_matrix proj;
|
||||||
|
matrix_ortho(&proj, ortho->left, ortho->right,
|
||||||
|
ortho->bottom, ortho->top, ortho->znear, ortho->zfar);
|
||||||
|
|
||||||
|
if (allow_rotate)
|
||||||
|
{
|
||||||
|
math_matrix rot;
|
||||||
|
matrix_rotate_z(&rot, M_PI * gl->rotation / 180.0f);
|
||||||
|
matrix_multiply(&proj, &rot, &proj);
|
||||||
|
}
|
||||||
|
|
||||||
|
gl->mvp = proj;
|
||||||
gl_shader_set_coords(&gl->coords, &gl->mvp);
|
gl_shader_set_coords(&gl->coords, &gl->mvp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue