let "fovchange" work in software
This commit is contained in:
1 parent
0ffff2751e
commit
178db4baae
8 files changed
+63
-42
No files matched your search
+1
-2
@@ -549,9 +549,8 @@ typedef struct player_s
|
||||
UINT8 hitemvictim;
|
||||
|
||||
UINT8 splitscreenindex;
|
||||
#ifdef HWRENDER
|
||||
|
||||
fixed_t fovadd; // adjust FOV for hw rendering
|
||||
#endif
|
||||
} player_t;
|
||||
|
||||
#endif
|
||||
@@ -228,8 +228,6 @@ consvar_t cv_glrenderdistance = {"gr_renderdistance", "Max", CV_SAVE, glrenderdi
|
||||
consvar_t cv_glhorizonlines = {"gr_horizonlines", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_glportals = {"gr_portals", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glfovchange = {"gr_fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_glpaletterendering = {"gr_paletteshader", "Off", CV_CALL|CV_SAVE, CV_OnOff, CV_glpaletterendering_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_glpalettedepth = {"gr_palettedepth", "16 bits", CV_SAVE|CV_CALL, glpalettedepth_cons_t, CV_glpalettedepth_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_glflashpal = {"gr_flashpal", "On", CV_CALL|CV_SAVE, CV_OnOff, CV_glpaletterendering_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -5409,7 +5407,7 @@ void HWR_RenderViewpoint(gl_portal_t *rootportal, const float fpov, player_t *pl
|
||||
// ==========================================================================
|
||||
static void HWR_RenderFrame(INT32 viewnumber, player_t *player, boolean skybox)
|
||||
{
|
||||
const float fpov = FIXED_TO_FLOAT(cv_fov.value+player->fovadd);
|
||||
const float fpov = FixedToFloat(R_GetPlayerFov(player));
|
||||
|
||||
// set window position
|
||||
gl_viewwindowx = gl_baseviewwindowx;
|
||||
@@ -5639,8 +5637,6 @@ void HWR_AddCommands(void)
|
||||
CV_RegisterVar(&cv_glhorizonlines);
|
||||
CV_RegisterVar(&cv_glportals);
|
||||
|
||||
CV_RegisterVar(&cv_glfovchange);
|
||||
|
||||
CV_RegisterVar(&cv_glpaletterendering);
|
||||
CV_RegisterVar(&cv_glpalettedepth);
|
||||
CV_RegisterVar(&cv_glflashpal);
|
||||
|
||||
@@ -186,8 +186,6 @@ extern consvar_t cv_glrenderdistance;
|
||||
extern consvar_t cv_glhorizonlines;
|
||||
extern consvar_t cv_glportals;
|
||||
|
||||
extern consvar_t cv_glfovchange;
|
||||
|
||||
extern consvar_t cv_glpaletterendering;
|
||||
extern consvar_t cv_glpalettedepth;
|
||||
extern consvar_t cv_glflashpal;
|
||||
|
||||
+2
-3
@@ -157,9 +157,8 @@ static const udata_field_t player_fields[] = {
|
||||
FIELD(player_t, grieftime, udatalib_getter_tic, udatalib_setter_tic),
|
||||
FIELD(player_t, griefstrikes, udatalib_getter_uint8, udatalib_setter_uint8),
|
||||
FIELD(player_t, splitscreenindex, udatalib_getter_uint8, player_splitscreenindex_noset),
|
||||
#ifdef HWRENDER
|
||||
FIELD(player_t, fovadd, udatalib_getter_fixed, udatalib_setter_fixed), // Mmm yeah thats definitely synch safe
|
||||
#endif
|
||||
|
||||
// Same as player.name
|
||||
{ "sliproll", 0, player_sliproll_getter, player_sliproll_noset },
|
||||
{ "viewrollangle", 0, player_viewrollangle_getter, player_viewrollangle_noset },
|
||||
@@ -882,4 +881,4 @@ int LUA_PlayerLib(lua_State *L)
|
||||
lua_setglobal(L, "displayplayers");
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
+1
-3
@@ -2495,8 +2495,7 @@ static void P_MovePlayer(player_t *player)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl && cv_glfovchange.value)
|
||||
if (cv_fovchange.value)
|
||||
{
|
||||
fixed_t speed;
|
||||
const fixed_t runnyspeed = 20*FRACUNIT;
|
||||
@@ -2516,7 +2515,6 @@ static void P_MovePlayer(player_t *player)
|
||||
}
|
||||
else
|
||||
player->fovadd = 0;
|
||||
#endif
|
||||
|
||||
#ifdef FLOORSPLATS
|
||||
if (cv_shadow.value && rendermode == render_soft)
|
||||
|
||||
+52
-24
@@ -143,12 +143,14 @@ static CV_PossibleValue_t maxinterpdist_cons_t[] = {
|
||||
{3072, "3072"}, {4096, "4096"}, {6144, "6144"},
|
||||
{8192, "8192"}, {0, "Infinite"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t fov_cons_t[] = {{5*FRACUNIT, "MIN"}, {178*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t fov_cons_t[] = {{MINFOV*FRACUNIT, "MIN"}, {MAXFOV*FRACUNIT, "MAX"}, {0, NULL}};
|
||||
|
||||
static CV_PossibleValue_t translucenthud_cons_t[] = {{0, "MIN"}, {10, "MAX"}, {0, NULL}};
|
||||
static CV_PossibleValue_t maxportals_cons_t[] = {{0, "MIN"}, {12, "MAX"}, {0, NULL}}; // lmao rendering 32 portals, you're a card
|
||||
static CV_PossibleValue_t homremoval_cons_t[] = {{0, "No"}, {1, "Yes"}, {2, "Flash"}, {0, NULL}};
|
||||
|
||||
static void R_SetFov(fixed_t playerfov);
|
||||
|
||||
static void Fov_OnChange(void);
|
||||
static void FlipCam_OnChange(void);
|
||||
static void FlipCam2_OnChange(void);
|
||||
@@ -202,6 +204,7 @@ consvar_t cv_ripplewater = {"waterripples", "On", CV_SAVE, CV_OnOff, NULL, 0, NU
|
||||
|
||||
// cap fov, fov too high tears software apart.
|
||||
consvar_t cv_fov = {"fov", "90", CV_FLOAT|CV_CALL|CV_SAVE, fov_cons_t, Fov_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fovchange = {"fovchange", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// Okay, whoever said homremoval causes a performance hit should be shot.
|
||||
consvar_t cv_homremoval = {"homremoval", "Yes", CV_SAVE, homremoval_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -921,12 +924,10 @@ void R_SetViewSize(void)
|
||||
//
|
||||
void R_ExecuteSetViewSize(void)
|
||||
{
|
||||
fixed_t dy;
|
||||
INT32 i;
|
||||
INT32 j;
|
||||
INT32 level;
|
||||
INT32 startmapl;
|
||||
angle_t fov;
|
||||
|
||||
setsizeneeded = false;
|
||||
|
||||
@@ -955,17 +956,10 @@ void R_ExecuteSetViewSize(void)
|
||||
centerxfrac = centerx<<FRACBITS;
|
||||
centeryfrac = centery<<FRACBITS;
|
||||
|
||||
fov = FixedAngle(cv_fov.value/2) + ANGLE_90;
|
||||
fovtan = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph.zoomneeded);
|
||||
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
|
||||
fovtan = 17*fovtan/10;
|
||||
|
||||
projection = projectiony = FixedDiv(centerxfrac, fovtan);
|
||||
R_SetFov(cv_fov.value);
|
||||
|
||||
R_InitViewBuffer(scaledviewwidth, viewheight);
|
||||
|
||||
R_InitTextureMapping();
|
||||
|
||||
// why did we calc all the software crap?
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
@@ -980,19 +974,6 @@ void R_ExecuteSetViewSize(void)
|
||||
for (i = 0; i < viewwidth; i++)
|
||||
screenheightarray[i] = (INT16)viewheight;
|
||||
|
||||
// setup sky scaling
|
||||
R_SetSkyScale();
|
||||
|
||||
// planes
|
||||
// this is only used for planes rendering in software mode
|
||||
j = viewheight*16;
|
||||
for (i = 0; i < j; i++)
|
||||
{
|
||||
dy = (i - viewheight*8)<<FRACBITS;
|
||||
dy = FixedMul(abs(dy), fovtan);
|
||||
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||
}
|
||||
|
||||
if (ds_su)
|
||||
Z_Free(ds_su);
|
||||
if (ds_sv)
|
||||
@@ -1026,6 +1007,37 @@ void R_ExecuteSetViewSize(void)
|
||||
am_recalc = true;
|
||||
}
|
||||
|
||||
fixed_t R_GetPlayerFov(player_t *player)
|
||||
{
|
||||
fixed_t fov = cv_fov.value + player->fovadd;
|
||||
return max(MINFOV*FRACUNIT, min(fov, MAXFOV*FRACUNIT));
|
||||
}
|
||||
|
||||
static void R_SetFov(fixed_t playerfov)
|
||||
{
|
||||
angle_t fov = FixedAngle(playerfov/2) + ANGLE_90;
|
||||
fovtan = FixedMul(FINETANGENT(fov >> ANGLETOFINESHIFT), viewmorph.zoomneeded);
|
||||
if (splitscreen == 1) // Splitscreen FOV should be adjusted to maintain expected vertical view
|
||||
fovtan = 17*fovtan/10;
|
||||
|
||||
// this is only used for planes rendering in software mode
|
||||
INT32 j = viewheight*16;
|
||||
for (INT32 i = 0; i < j; i++)
|
||||
{
|
||||
fixed_t dy = (i - viewheight*8)<<FRACBITS;
|
||||
dy = FixedMul(abs(dy), fovtan);
|
||||
yslopetab[i] = FixedDiv(centerx*FRACUNIT, dy);
|
||||
}
|
||||
|
||||
projection = projectiony = FixedDiv(centerxfrac, fovtan);
|
||||
|
||||
R_InitTextureMapping();
|
||||
|
||||
// setup sky scaling
|
||||
R_SetSkyScale();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// R_Init
|
||||
//
|
||||
@@ -1324,6 +1336,8 @@ static void R_PortalFrame(portal_t *portal)
|
||||
// I mean, there is a win16lock() or something that lasts all the rendering,
|
||||
// so maybe we should release screen lock before each netupdate below..?
|
||||
|
||||
static fixed_t viewfov[MAXSPLITSCREENPLAYERS];
|
||||
|
||||
void R_RenderPlayerView(player_t *player)
|
||||
{
|
||||
const boolean skybox = (skyboxmo[0] && cv_skybox.value);
|
||||
@@ -1362,6 +1376,18 @@ void R_RenderPlayerView(player_t *player)
|
||||
break;
|
||||
}
|
||||
|
||||
fixed_t fov = R_GetPlayerFov(player);
|
||||
|
||||
for (UINT8 j = 0; j <= splitscreen; j++)
|
||||
{
|
||||
if (player == &players[displayplayers[i]]
|
||||
&& viewfov[i] != fov)
|
||||
{
|
||||
viewfov[i] = fov;
|
||||
R_SetFov(fov);
|
||||
}
|
||||
}
|
||||
|
||||
Portal_InitList();
|
||||
|
||||
PS_START_TIMING(ps_skyboxtime);
|
||||
@@ -1515,6 +1541,8 @@ void R_RegisterEngineStuff(void)
|
||||
CV_RegisterVar(&cv_drawdist_precip);
|
||||
CV_RegisterVar(&cv_lessprecip);
|
||||
CV_RegisterVar(&cv_mobjscaleprecip);
|
||||
|
||||
CV_RegisterVar(&cv_fovchange);
|
||||
CV_RegisterVar(&cv_fov);
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
|
||||
+5
-1
@@ -29,6 +29,9 @@ extern fixed_t centerxfrac, centeryfrac;
|
||||
extern fixed_t projection, projectiony;
|
||||
extern fixed_t fovtan; // field of view
|
||||
|
||||
#define MINFOV 5
|
||||
#define MAXFOV 179
|
||||
|
||||
extern size_t validcount, linecount, loopcount, framecount;
|
||||
|
||||
// The fraction of a tic being drawn (for interpolation between two tics)
|
||||
@@ -203,7 +206,7 @@ extern consvar_t cv_shadow, cv_shadowoffs;
|
||||
extern consvar_t cv_ffloorclip, cv_spriteclip;
|
||||
extern consvar_t cv_translucency;
|
||||
extern consvar_t cv_drawdist, cv_drawdist_precip, cv_lessprecip, cv_mobjscaleprecip;
|
||||
extern consvar_t cv_fov;
|
||||
extern consvar_t cv_fov, cv_fovchange;
|
||||
extern consvar_t cv_skybox;
|
||||
extern consvar_t cv_tailspickup;
|
||||
extern consvar_t cv_maxinterpdist;
|
||||
@@ -225,6 +228,7 @@ void R_SetViewSize(void);
|
||||
// do it (sometimes explicitly called)
|
||||
void R_ExecuteSetViewSize(void);
|
||||
|
||||
fixed_t R_GetPlayerFov(player_t *player);
|
||||
void R_SkyboxFrame(int s);
|
||||
void R_SetupFrame(int s, boolean skybox);
|
||||
|
||||
|
||||
+1
-2
@@ -79,6 +79,5 @@ void R_SetupSkyDraw(void)
|
||||
*/
|
||||
void R_SetSkyScale(void)
|
||||
{
|
||||
fixed_t difference = vid.fdupx-(vid.dupx<<FRACBITS);
|
||||
skyscale = FixedDiv(fovtan, vid.fdupx+difference);
|
||||
skyscale = FixedDiv(fovtan, FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT));
|
||||
}
|
||||
Reference in new issue
Block a user