mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 13:10:34 +00:00
[renderer] Clean up viewport setting
Software is still a mess, and vulkan never supported viewsize, but otherwise everything seems fine.
This commit is contained in:
parent
f2bc5b560f
commit
77a797d04b
6 changed files with 13 additions and 31 deletions
|
@ -255,24 +255,10 @@ static void
|
|||
R_SetupGL_Viewport_and_Perspective (void)
|
||||
{
|
||||
float screenaspect;
|
||||
int x, y2, w, h;
|
||||
|
||||
// set up viewpoint
|
||||
qfglMatrixMode (GL_PROJECTION);
|
||||
qfglLoadIdentity ();
|
||||
|
||||
if (gl_envmap) {
|
||||
x = y2 = 0;
|
||||
w = h = 256;
|
||||
} else {
|
||||
x = r_refdef.vrect.x;
|
||||
y2 = (vid.height - (r_refdef.vrect.y + r_refdef.vrect.height));
|
||||
|
||||
w = r_refdef.vrect.width;
|
||||
h = r_refdef.vrect.height;
|
||||
}
|
||||
// printf ("glViewport(%d, %d, %d, %d)\n", glx + x, gly + y2, w, h);
|
||||
qfglViewport (x, y2, w, h);
|
||||
screenaspect = r_refdef.vrect.width / (float) r_refdef.vrect.height;
|
||||
MYgluPerspective (r_refdef.fov_y, screenaspect, r_nearclip->value,
|
||||
r_farclip->value);
|
||||
|
|
|
@ -98,7 +98,6 @@ glsl_R_ViewChanged (void)
|
|||
static void
|
||||
R_SetupView (void)
|
||||
{
|
||||
float x, y, w, h;
|
||||
static mat4f_t z_up = {
|
||||
{ 0, 0, 1, 0},
|
||||
{-1, 0, 0, 0},
|
||||
|
@ -106,12 +105,6 @@ R_SetupView (void)
|
|||
{ 0, 0, 0, 1},
|
||||
};
|
||||
|
||||
x = r_refdef.vrect.x;
|
||||
y = (vid.height - (r_refdef.vrect.y + r_refdef.vrect.height));
|
||||
w = r_refdef.vrect.width;
|
||||
h = r_refdef.vrect.height;
|
||||
qfeglViewport (x, y, w, h);
|
||||
|
||||
mmulf (glsl_view, z_up, r_refdef.camera_inverse);
|
||||
|
||||
qfeglEnable (GL_CULL_FACE);
|
||||
|
|
|
@ -289,6 +289,9 @@ SCR_UpdateScreen (transform_t *camera, double realtime, SCR_Func *scr_funcs)
|
|||
r_funcs->bind_framebuffer (warp_buffer);
|
||||
}
|
||||
if (scr_fisheye->int_val) {
|
||||
int side = fisheye_cube_map->width;
|
||||
vrect_t feye = { 0, 0, side, side };
|
||||
r_funcs->set_viewport (&feye);
|
||||
switch (scr_fviews->int_val) {
|
||||
case 6: render_side (BOX_BEHIND);
|
||||
case 5: render_side (BOX_BOTTOM);
|
||||
|
@ -301,6 +304,7 @@ SCR_UpdateScreen (transform_t *camera, double realtime, SCR_Func *scr_funcs)
|
|||
r_funcs->set_viewport (&r_refdef.vrect);
|
||||
r_funcs->post_process (fisheye_cube_map);
|
||||
} else {
|
||||
r_funcs->set_viewport (&r_refdef.vrect);
|
||||
render_scene ();
|
||||
if (r_dowarp) {
|
||||
r_funcs->bind_framebuffer (0);
|
||||
|
|
|
@ -325,6 +325,11 @@ gl_bind_framebuffer (framebuffer_t *framebuffer)
|
|||
static void
|
||||
gl_set_viewport (const vrect_t *view)
|
||||
{
|
||||
int x = r_refdef.vrect.x;
|
||||
int y2 = (vid.height - (r_refdef.vrect.y + r_refdef.vrect.height));
|
||||
int w = r_refdef.vrect.width;
|
||||
int h = r_refdef.vrect.height;
|
||||
qfglViewport (x, y2, w, h);
|
||||
}
|
||||
|
||||
vid_render_funcs_t gl_vid_render_funcs = {
|
||||
|
|
|
@ -375,10 +375,10 @@ glsl_bind_framebuffer (framebuffer_t *framebuffer)
|
|||
static void
|
||||
glsl_set_viewport (const vrect_t *view)
|
||||
{
|
||||
float x = view->x;
|
||||
float y = vid.height - (view->y + view->height);
|
||||
float w = view->width;
|
||||
float h = view->height;
|
||||
int x = view->x;
|
||||
int y = vid.height - (view->y + view->height);
|
||||
int w = view->width;
|
||||
int h = view->height;
|
||||
qfeglViewport (x, y, w, h);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,12 +73,6 @@ setup_view (vulkan_ctx_t *ctx)
|
|||
{ 0, 0, 0, 1},
|
||||
};
|
||||
|
||||
/*x = r_refdef.vrect.x;
|
||||
y = (vid.height - (r_refdef.vrect.y + r_refdef.vrect.height));
|
||||
w = r_refdef.vrect.width;
|
||||
h = r_refdef.vrect.height;
|
||||
qfeglViewport (x, y, w, h);*/
|
||||
|
||||
mmulf (view, z_up, r_refdef.camera_inverse);
|
||||
Vulkan_SetViewMatrix (ctx, view);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue