mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Dreamcast: WIP on split screen support
This commit is contained in:
parent
b478c486a0
commit
6f5500d4e8
@ -559,6 +559,12 @@ void Gfx_OnWindowResize(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Gfx_SetViewport(int x, int y, int w, int h) {
|
void Gfx_SetViewport(int x, int y, int w, int h) {
|
||||||
|
if (x == 0 && y == 0 && w == Game.Width && h == Game.Height) {
|
||||||
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
} else {
|
||||||
|
glEnable(GL_SCISSOR_TEST);
|
||||||
|
}
|
||||||
|
|
||||||
glViewport(x, y, w, h);
|
glViewport(x, y, w, h);
|
||||||
glScissor (x, y, w, h);
|
glScissor (x, y, w, h);
|
||||||
}
|
}
|
||||||
|
4
third_party/gldc/src/sh4.c
vendored
4
third_party/gldc/src/sh4.c
vendored
@ -45,8 +45,8 @@ GL_FORCE_INLINE void _glPerspectiveDivideVertex(Vertex* vertex) {
|
|||||||
const float f = _glFastInvert(vertex->w);
|
const float f = _glFastInvert(vertex->w);
|
||||||
|
|
||||||
/* Convert to NDC and apply viewport */
|
/* Convert to NDC and apply viewport */
|
||||||
vertex->xyz[0] = (vertex->xyz[0] * f * 320) + 320;
|
vertex->xyz[0] = (vertex->xyz[0] * f * VIEWPORT.hwidth) + VIEWPORT.x_plus_hwidth;
|
||||||
vertex->xyz[1] = (vertex->xyz[1] * f * -240) + 240;
|
vertex->xyz[1] = (vertex->xyz[1] * f * VIEWPORT.hheight) + VIEWPORT.y_plus_hheight;
|
||||||
|
|
||||||
/* Orthographic projections need to use invZ otherwise we lose
|
/* Orthographic projections need to use invZ otherwise we lose
|
||||||
the depth information. As w == 1, and clip-space range is -w to +w
|
the depth information. As w == 1, and clip-space range is -w to +w
|
||||||
|
16
third_party/gldc/src/state.c
vendored
16
third_party/gldc/src/state.c
vendored
@ -253,20 +253,14 @@ void APIENTRY glGetIntegerv(GLenum pname, GLint *params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Viewport VIEWPORT = {
|
Viewport VIEWPORT;
|
||||||
0, 0, 640, 480, 320.0f, 240.0f, 320.0f, 240.0f
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Set the GL viewport */
|
/* Set the GL viewport */
|
||||||
void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
void APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) {
|
||||||
VIEWPORT.x = x;
|
VIEWPORT.hwidth = ((GLfloat)width) * 0.5f;
|
||||||
VIEWPORT.y = y;
|
VIEWPORT.hheight = ((GLfloat)height) * -0.5f;
|
||||||
VIEWPORT.width = width;
|
VIEWPORT.x_plus_hwidth = x + VIEWPORT.hwidth;
|
||||||
VIEWPORT.height = height;
|
VIEWPORT.y_plus_hheight = y + VIEWPORT.hheight;
|
||||||
VIEWPORT.hwidth = ((GLfloat) VIEWPORT.width) * 0.5f;
|
|
||||||
VIEWPORT.hheight = ((GLfloat) VIEWPORT.height) * 0.5f;
|
|
||||||
VIEWPORT.x_plus_hwidth = VIEWPORT.x + VIEWPORT.hwidth;
|
|
||||||
VIEWPORT.y_plus_hheight = VIEWPORT.y + VIEWPORT.hheight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user