mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-29 20:20:43 +00:00
serious cleanup of refdef calculations.
This commit is contained in:
parent
f6cac11478
commit
8ea7690530
11 changed files with 89 additions and 334 deletions
|
@ -147,8 +147,8 @@ void R_Init_Cvars (void);
|
||||||
void R_InitEfrags (void);
|
void R_InitEfrags (void);
|
||||||
void R_InitSky (struct texture_s *mt); // called at level load
|
void R_InitSky (struct texture_s *mt); // called at level load
|
||||||
void R_Textures_Init (void);
|
void R_Textures_Init (void);
|
||||||
void R_RenderView (void); // must set r_refdef first
|
void R_RenderView (void); // must set r_refdef first
|
||||||
void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect);
|
void R_ViewChanged (float aspect); // must set r_refdef first
|
||||||
// called whenever r_refdef or vid change
|
// called whenever r_refdef or vid change
|
||||||
|
|
||||||
void R_AddEfrags (entity_t *ent);
|
void R_AddEfrags (entity_t *ent);
|
||||||
|
|
|
@ -44,6 +44,7 @@ void SCR_SizeUp (void);
|
||||||
void SCR_SizeDown (void);
|
void SCR_SizeDown (void);
|
||||||
void SCR_BringDownConsole (void);
|
void SCR_BringDownConsole (void);
|
||||||
void SCR_CenterPrint (const char *str);
|
void SCR_CenterPrint (const char *str);
|
||||||
|
void SCR_CalcRefdef (void);
|
||||||
|
|
||||||
void SCR_BeginLoadingPlaque (void);
|
void SCR_BeginLoadingPlaque (void);
|
||||||
void SCR_EndLoadingPlaque (void);
|
void SCR_EndLoadingPlaque (void);
|
||||||
|
|
|
@ -211,6 +211,11 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
||||||
R_LoadSkys ("none");
|
R_LoadSkys ("none");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
R_ViewChanged (float aspect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_TimeRefresh_f
|
R_TimeRefresh_f
|
||||||
|
|
||||||
|
|
|
@ -66,67 +66,6 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
|
|
||||||
int glx, gly, glwidth, glheight;
|
int glx, gly, glwidth, glheight;
|
||||||
|
|
||||||
/*
|
|
||||||
SCR_CalcRefdef
|
|
||||||
|
|
||||||
Must be called whenever vid changes
|
|
||||||
Internal use only
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
SCR_CalcRefdef (void)
|
|
||||||
{
|
|
||||||
float size;
|
|
||||||
int h, lines;
|
|
||||||
qboolean full = false;
|
|
||||||
|
|
||||||
scr_fullupdate = 0; // force a background redraw
|
|
||||||
vid.recalc_refdef = 0;
|
|
||||||
|
|
||||||
// force the status bar to redraw
|
|
||||||
Sbar_Changed ();
|
|
||||||
|
|
||||||
// bound field of view
|
|
||||||
Cvar_SetValue (scr_fov, bound (1, scr_fov->value, 170));
|
|
||||||
|
|
||||||
if (r_viewsize >= 100) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
} else {
|
|
||||||
size = r_viewsize;
|
|
||||||
}
|
|
||||||
// intermission is always full screen
|
|
||||||
lines = r_lineadj;
|
|
||||||
if (r_force_fullscreen /* FIXME: better test */) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
lines = 0;
|
|
||||||
}
|
|
||||||
size /= 100.0;
|
|
||||||
|
|
||||||
h = vid.height - lines;
|
|
||||||
|
|
||||||
r_refdef.vrect.width = vid.width * size + 0.5;
|
|
||||||
if (r_refdef.vrect.width < 96) {
|
|
||||||
size = 96.0 / r_refdef.vrect.width;
|
|
||||||
r_refdef.vrect.width = 96; // min for icons
|
|
||||||
}
|
|
||||||
|
|
||||||
r_refdef.vrect.height = vid.height * size + 0.5;
|
|
||||||
if (r_refdef.vrect.height > h)
|
|
||||||
r_refdef.vrect.height = h;
|
|
||||||
r_refdef.vrect.x = (vid.width - r_refdef.vrect.width) / 2;
|
|
||||||
if (full)
|
|
||||||
r_refdef.vrect.y = 0;
|
|
||||||
else
|
|
||||||
r_refdef.vrect.y = (h - r_refdef.vrect.height) / 2;
|
|
||||||
|
|
||||||
r_refdef.fov_x = scr_fov->value;
|
|
||||||
r_refdef.fov_y =
|
|
||||||
CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
|
|
||||||
|
|
||||||
scr_vrect = r_refdef.vrect;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* SCREEN SHOTS */
|
/* SCREEN SHOTS */
|
||||||
|
|
||||||
tex_t *
|
tex_t *
|
||||||
|
|
|
@ -130,6 +130,69 @@ int scr_center_lines;
|
||||||
int scr_erase_lines;
|
int scr_erase_lines;
|
||||||
int scr_erase_center;
|
int scr_erase_center;
|
||||||
|
|
||||||
|
void
|
||||||
|
R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
|
||||||
|
{
|
||||||
|
float size;
|
||||||
|
int h;
|
||||||
|
|
||||||
|
// intermission is always full screen
|
||||||
|
if (r_viewsize >= 100 || r_force_fullscreen /* FIXME: better test */) {
|
||||||
|
size = 100.0;
|
||||||
|
lineadj = 0;
|
||||||
|
} else {
|
||||||
|
size = r_viewsize;
|
||||||
|
}
|
||||||
|
size /= 100.0;
|
||||||
|
|
||||||
|
h = pvrectin->height - lineadj;
|
||||||
|
|
||||||
|
pvrect->width = pvrectin->width * size + 0.5;
|
||||||
|
if (pvrect->width < 96) {
|
||||||
|
size = 96.0 / pvrectin->width;
|
||||||
|
pvrect->width = 96; // min for icons
|
||||||
|
}
|
||||||
|
pvrect->width &= ~7;
|
||||||
|
|
||||||
|
pvrect->height = pvrectin->height * size + 0.5;
|
||||||
|
if (pvrect->height > h)
|
||||||
|
pvrect->height = h;
|
||||||
|
pvrect->height &= ~1;
|
||||||
|
|
||||||
|
pvrect->x = (pvrectin->width - pvrect->width) / 2;
|
||||||
|
pvrect->y = (h - pvrect->height) / 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
SCR_CalcRefdef (void)
|
||||||
|
{
|
||||||
|
vrect_t vrect;
|
||||||
|
|
||||||
|
// force a background redraw
|
||||||
|
scr_fullupdate = 0;
|
||||||
|
vid.recalc_refdef = 0;
|
||||||
|
|
||||||
|
// force the status bar to redraw
|
||||||
|
Sbar_Changed ();
|
||||||
|
|
||||||
|
// bound field of view
|
||||||
|
Cvar_SetValue (scr_fov, bound (1, scr_fov->value, 170));
|
||||||
|
|
||||||
|
r_refdef.fov_x = scr_fov->value;
|
||||||
|
r_refdef.fov_y =
|
||||||
|
CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
|
||||||
|
|
||||||
|
vrect.x = 0;
|
||||||
|
vrect.y = 0;
|
||||||
|
vrect.width = vid.width;
|
||||||
|
vrect.height = vid.height;
|
||||||
|
|
||||||
|
R_SetVrect (&vrect, &scr_vrect, r_lineadj);
|
||||||
|
r_refdef.vrect = scr_vrect;
|
||||||
|
|
||||||
|
// notify the refresh of the change
|
||||||
|
R_ViewChanged (vid.aspect);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
SCR_CenterPrint
|
SCR_CenterPrint
|
||||||
|
|
|
@ -59,81 +59,6 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
/*
|
|
||||||
SCR_CalcRefdef
|
|
||||||
|
|
||||||
Must be called whenever vid changes
|
|
||||||
Internal use only
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
SCR_CalcRefdef (void)
|
|
||||||
{
|
|
||||||
vrect_t vrect;
|
|
||||||
float size;
|
|
||||||
int h, lines;
|
|
||||||
qboolean full = false;
|
|
||||||
|
|
||||||
scr_fullupdate = 0; // force a background redraw
|
|
||||||
vid.recalc_refdef = 0;
|
|
||||||
|
|
||||||
// force the status bar to redraw
|
|
||||||
Sbar_Changed ();
|
|
||||||
|
|
||||||
// bound field of view
|
|
||||||
Cvar_SetValue (scr_fov, bound (1, scr_fov->value, 170));
|
|
||||||
|
|
||||||
if (r_viewsize >= 100) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
} else {
|
|
||||||
size = r_viewsize;
|
|
||||||
}
|
|
||||||
// intermission is always full screen
|
|
||||||
lines = r_lineadj;
|
|
||||||
if (r_force_fullscreen /* FIXME: better test */) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
lines = 0;
|
|
||||||
}
|
|
||||||
size /= 100.0;
|
|
||||||
|
|
||||||
h = vid.height - lines;
|
|
||||||
|
|
||||||
r_refdef.vrect.width = vid.width * size + 0.5;
|
|
||||||
if (r_refdef.vrect.width < 96) {
|
|
||||||
size = 96.0 / r_refdef.vrect.width;
|
|
||||||
r_refdef.vrect.width = 96; // min for icons
|
|
||||||
}
|
|
||||||
|
|
||||||
r_refdef.vrect.height = vid.height * size + 0.5;
|
|
||||||
if (r_refdef.vrect.height > h)
|
|
||||||
r_refdef.vrect.height = h;
|
|
||||||
r_refdef.vrect.x = (vid.width - r_refdef.vrect.width) / 2;
|
|
||||||
if (full)
|
|
||||||
r_refdef.vrect.y = 0;
|
|
||||||
else
|
|
||||||
r_refdef.vrect.y = (h - r_refdef.vrect.height) / 2;
|
|
||||||
|
|
||||||
r_refdef.fov_x = scr_fov->value;
|
|
||||||
r_refdef.fov_y =
|
|
||||||
CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
|
|
||||||
|
|
||||||
scr_vrect = r_refdef.vrect;
|
|
||||||
|
|
||||||
// these calculations mirror those in R_Init() for r_refdef, but take no
|
|
||||||
// account of water warping
|
|
||||||
vrect.x = 0;
|
|
||||||
vrect.y = 0;
|
|
||||||
vrect.width = vid.width;
|
|
||||||
vrect.height = vid.height;
|
|
||||||
|
|
||||||
R_SetVrect (&vrect, &scr_vrect, r_lineadj);
|
|
||||||
|
|
||||||
// notify the refresh of the change
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SCR_ApplyBlend (void) // Used to be V_UpdatePalette
|
SCR_ApplyBlend (void) // Used to be V_UpdatePalette
|
||||||
{
|
{
|
||||||
|
|
|
@ -238,55 +238,6 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
||||||
r_viewchanged = false;
|
r_viewchanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
|
|
||||||
{
|
|
||||||
int h;
|
|
||||||
float size;
|
|
||||||
qboolean full = false;
|
|
||||||
|
|
||||||
if (scr_viewsize->int_val >= 100) {
|
|
||||||
size = 100.0;
|
|
||||||
full = true;
|
|
||||||
lineadj = 0;
|
|
||||||
} else {
|
|
||||||
size = scr_viewsize->int_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r_force_fullscreen) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
lineadj = 0;
|
|
||||||
}
|
|
||||||
size /= 100.0;
|
|
||||||
|
|
||||||
h = pvrectin->height - lineadj;
|
|
||||||
|
|
||||||
if (full) {
|
|
||||||
pvrect->width = pvrectin->width;
|
|
||||||
} else {
|
|
||||||
pvrect->width = pvrectin->width * size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pvrect->width < 96) {
|
|
||||||
size = 96.0 / pvrectin->width;
|
|
||||||
pvrect->width = 96; // min for icons
|
|
||||||
}
|
|
||||||
pvrect->width &= ~7;
|
|
||||||
pvrect->height = pvrectin->height * size;
|
|
||||||
|
|
||||||
if (pvrect->height > h)
|
|
||||||
pvrect->height = h;
|
|
||||||
|
|
||||||
pvrect->height &= ~1;
|
|
||||||
|
|
||||||
pvrect->x = (pvrectin->width - pvrect->width) / 2;
|
|
||||||
if (full)
|
|
||||||
pvrect->y = 0;
|
|
||||||
else
|
|
||||||
pvrect->y = (h - pvrect->height) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_ViewChanged
|
R_ViewChanged
|
||||||
|
|
||||||
|
@ -294,15 +245,13 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
|
||||||
Guaranteed to be called before the first refresh
|
Guaranteed to be called before the first refresh
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
|
R_ViewChanged (float aspect)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float res_scale;
|
float res_scale;
|
||||||
|
|
||||||
r_viewchanged = true;
|
r_viewchanged = true;
|
||||||
|
|
||||||
R_SetVrect (pvrect, &r_refdef.vrect, lineadj);
|
|
||||||
|
|
||||||
r_refdef.horizontalFieldOfView = 2.0 * tan (r_refdef.fov_x / 360 * M_PI);
|
r_refdef.horizontalFieldOfView = 2.0 * tan (r_refdef.fov_x / 360 * M_PI);
|
||||||
r_refdef.fvrectx = (float) r_refdef.vrect.x;
|
r_refdef.fvrectx = (float) r_refdef.vrect.x;
|
||||||
r_refdef.fvrectx_adj = (float) r_refdef.vrect.x - 0.5;
|
r_refdef.fvrectx_adj = (float) r_refdef.vrect.x - 0.5;
|
||||||
|
|
|
@ -283,7 +283,8 @@ R_SetupFrame (void)
|
||||||
vrect.width = vid.width;
|
vrect.width = vid.width;
|
||||||
vrect.height = vid.height;
|
vrect.height = vid.height;
|
||||||
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
R_SetVrect (&vrect, &r_refdef.vrect, r_lineadj);
|
||||||
|
R_ViewChanged (vid.aspect);
|
||||||
} else {
|
} else {
|
||||||
w = vid.width;
|
w = vid.width;
|
||||||
h = vid.height;
|
h = vid.height;
|
||||||
|
@ -303,19 +304,15 @@ R_SetupFrame (void)
|
||||||
vrect.width = (int) w;
|
vrect.width = (int) w;
|
||||||
vrect.height = (int) h;
|
vrect.height = (int) h;
|
||||||
|
|
||||||
R_ViewChanged (&vrect,
|
R_SetVrect (&vrect, &r_refdef.vrect,
|
||||||
(int) ((float) r_lineadj *
|
(int) ((float) r_lineadj *
|
||||||
(h / (float) vid.height)),
|
(h / (float) vid.height)));
|
||||||
vid.aspect * (h / w) * ((float) vid.width /
|
R_ViewChanged (vid.aspect * (h / w) * ((float) vid.width /
|
||||||
(float) vid.height));
|
(float) vid.height));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vrect.x = 0;
|
r_refdef.vrect = scr_vrect;
|
||||||
vrect.y = 0;
|
R_ViewChanged (vid.aspect);
|
||||||
vrect.width = vid.width;
|
|
||||||
vrect.height = vid.height;
|
|
||||||
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
r_viewchanged = false;
|
r_viewchanged = false;
|
||||||
|
|
|
@ -60,81 +60,6 @@ static __attribute__ ((unused)) const char rcsid[] =
|
||||||
#include "sbar.h"
|
#include "sbar.h"
|
||||||
#include "view.h"
|
#include "view.h"
|
||||||
|
|
||||||
/*
|
|
||||||
SCR_CalcRefdef
|
|
||||||
|
|
||||||
Must be called whenever vid changes
|
|
||||||
Internal use only
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
SCR_CalcRefdef (void)
|
|
||||||
{
|
|
||||||
vrect_t vrect;
|
|
||||||
float size;
|
|
||||||
int h, lines;
|
|
||||||
qboolean full = false;
|
|
||||||
|
|
||||||
scr_fullupdate = 0; // force a background redraw
|
|
||||||
vid.recalc_refdef = 0;
|
|
||||||
|
|
||||||
// force the status bar to redraw
|
|
||||||
Sbar_Changed ();
|
|
||||||
|
|
||||||
// bound field of view
|
|
||||||
Cvar_SetValue (scr_fov, bound (1, scr_fov->value, 170));
|
|
||||||
|
|
||||||
if (r_viewsize >= 100) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
} else {
|
|
||||||
size = r_viewsize;
|
|
||||||
}
|
|
||||||
// intermission is always full screen
|
|
||||||
lines = r_lineadj;
|
|
||||||
if (r_force_fullscreen /* FIXME: better test */) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
lines = 0;
|
|
||||||
}
|
|
||||||
size /= 100.0;
|
|
||||||
|
|
||||||
h = vid.height - lines;
|
|
||||||
|
|
||||||
r_refdef.vrect.width = vid.width * size + 0.5;
|
|
||||||
if (r_refdef.vrect.width < 96) {
|
|
||||||
size = 96.0 / r_refdef.vrect.width;
|
|
||||||
r_refdef.vrect.width = 96; // min for icons
|
|
||||||
}
|
|
||||||
|
|
||||||
r_refdef.vrect.height = vid.height * size + 0.5;
|
|
||||||
if (r_refdef.vrect.height > h)
|
|
||||||
r_refdef.vrect.height = h;
|
|
||||||
r_refdef.vrect.x = (vid.width - r_refdef.vrect.width) / 2;
|
|
||||||
if (full)
|
|
||||||
r_refdef.vrect.y = 0;
|
|
||||||
else
|
|
||||||
r_refdef.vrect.y = (h - r_refdef.vrect.height) / 2;
|
|
||||||
|
|
||||||
r_refdef.fov_x = scr_fov->value;
|
|
||||||
r_refdef.fov_y =
|
|
||||||
CalcFov (r_refdef.fov_x, r_refdef.vrect.width, r_refdef.vrect.height);
|
|
||||||
|
|
||||||
scr_vrect = r_refdef.vrect;
|
|
||||||
|
|
||||||
// these calculations mirror those in R_Init() for r_refdef, but take no
|
|
||||||
// account of water warping
|
|
||||||
vrect.x = 0;
|
|
||||||
vrect.y = 0;
|
|
||||||
vrect.width = vid.width;
|
|
||||||
vrect.height = vid.height;
|
|
||||||
|
|
||||||
R_SetVrect (&vrect, &scr_vrect, r_lineadj);
|
|
||||||
|
|
||||||
// notify the refresh of the change
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
SCR_ApplyBlend (void) // Used to be V_UpdatePalette
|
SCR_ApplyBlend (void) // Used to be V_UpdatePalette
|
||||||
{
|
{
|
||||||
|
|
|
@ -266,55 +266,6 @@ R_NewMap (model_t *worldmodel, struct model_s **models, int num_models)
|
||||||
r_viewchanged = false;
|
r_viewchanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
|
|
||||||
{
|
|
||||||
int h;
|
|
||||||
float size;
|
|
||||||
qboolean full = false;
|
|
||||||
|
|
||||||
if (scr_viewsize->int_val >= 100) {
|
|
||||||
size = 100.0;
|
|
||||||
full = true;
|
|
||||||
lineadj = 0;
|
|
||||||
} else {
|
|
||||||
size = scr_viewsize->int_val;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (r_force_fullscreen) {
|
|
||||||
full = true;
|
|
||||||
size = 100.0;
|
|
||||||
lineadj = 0;
|
|
||||||
}
|
|
||||||
size /= 100.0;
|
|
||||||
|
|
||||||
h = pvrectin->height - lineadj;
|
|
||||||
|
|
||||||
if (full) {
|
|
||||||
pvrect->width = pvrectin->width;
|
|
||||||
} else {
|
|
||||||
pvrect->width = pvrectin->width * size;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pvrect->width < 96) {
|
|
||||||
size = 96.0 / pvrectin->width;
|
|
||||||
pvrect->width = 96; // min for icons
|
|
||||||
}
|
|
||||||
pvrect->width &= ~7;
|
|
||||||
pvrect->height = pvrectin->height * size;
|
|
||||||
|
|
||||||
if (pvrect->height > h)
|
|
||||||
pvrect->height = h;
|
|
||||||
|
|
||||||
pvrect->height &= ~1;
|
|
||||||
|
|
||||||
pvrect->x = (pvrectin->width - pvrect->width) / 2;
|
|
||||||
if (full)
|
|
||||||
pvrect->y = 0;
|
|
||||||
else
|
|
||||||
pvrect->y = (h - pvrect->height) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
R_ViewChanged
|
R_ViewChanged
|
||||||
|
|
||||||
|
@ -322,15 +273,13 @@ R_SetVrect (vrect_t *pvrectin, vrect_t *pvrect, int lineadj)
|
||||||
Guaranteed to be called before the first refresh
|
Guaranteed to be called before the first refresh
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect)
|
R_ViewChanged (float aspect)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float res_scale;
|
float res_scale;
|
||||||
|
|
||||||
r_viewchanged = true;
|
r_viewchanged = true;
|
||||||
|
|
||||||
R_SetVrect (pvrect, &r_refdef.vrect, lineadj);
|
|
||||||
|
|
||||||
r_refdef.horizontalFieldOfView = 2.0 * tan (r_refdef.fov_x / 360 * M_PI);
|
r_refdef.horizontalFieldOfView = 2.0 * tan (r_refdef.fov_x / 360 * M_PI);
|
||||||
r_refdef.fvrectx = (float) r_refdef.vrect.x;
|
r_refdef.fvrectx = (float) r_refdef.vrect.x;
|
||||||
r_refdef.fvrectx_adj = (float) r_refdef.vrect.x - 0.5;
|
r_refdef.fvrectx_adj = (float) r_refdef.vrect.x - 0.5;
|
||||||
|
|
|
@ -279,7 +279,8 @@ R_SetupFrame (void)
|
||||||
vrect.width = vid.width;
|
vrect.width = vid.width;
|
||||||
vrect.height = vid.height;
|
vrect.height = vid.height;
|
||||||
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
R_SetVrect (&vrect, &r_refdef.vrect, r_lineadj);
|
||||||
|
R_ViewChanged (vid.aspect);
|
||||||
} else {
|
} else {
|
||||||
w = vid.width;
|
w = vid.width;
|
||||||
h = vid.height;
|
h = vid.height;
|
||||||
|
@ -299,10 +300,10 @@ R_SetupFrame (void)
|
||||||
vrect.width = (int) w;
|
vrect.width = (int) w;
|
||||||
vrect.height = (int) h;
|
vrect.height = (int) h;
|
||||||
|
|
||||||
R_ViewChanged (&vrect,
|
R_SetVrect (&vrect, &r_refdef.vrect,
|
||||||
(int) ((float) r_lineadj *
|
(int) ((float) r_lineadj *
|
||||||
(h / (float) vid.height)),
|
(h / (float) vid.height)));
|
||||||
vid.aspect * (h / w) * ((float) vid.width /
|
R_ViewChanged (vid.aspect * (h / w) * ((float) vid.width /
|
||||||
(float) vid.height));
|
(float) vid.height));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -311,7 +312,8 @@ R_SetupFrame (void)
|
||||||
vrect.width = vid.width;
|
vrect.width = vid.width;
|
||||||
vrect.height = vid.height;
|
vrect.height = vid.height;
|
||||||
|
|
||||||
R_ViewChanged (&vrect, r_lineadj, vid.aspect);
|
r_refdef.vrect = scr_vrect;
|
||||||
|
R_ViewChanged (vid.aspect);
|
||||||
}
|
}
|
||||||
|
|
||||||
r_viewchanged = false;
|
r_viewchanged = false;
|
||||||
|
|
Loading…
Reference in a new issue