Fix zoom rendering error (issue #5)

This commit is contained in:
Ryan Baldwin 2022-07-01 22:20:12 -07:00
parent b989a18aca
commit b80bf2a51b
6 changed files with 12 additions and 12 deletions

Binary file not shown.

Binary file not shown.

View file

@ -735,6 +735,8 @@ void CL_Init (void)
Cvar_RegisterVariable (&cl_name);
Cvar_RegisterVariable (&cl_color);
Cvar_RegisterVariable (&cl_upspeed);
Cvar_RegisterVariable (&cl_backspeed);
Cvar_RegisterVariable (&cl_forwardspeed);
Cvar_RegisterVariable (&cl_movespeedkey);
Cvar_RegisterVariable (&cl_yawspeed);
Cvar_RegisterVariable (&cl_pitchspeed);

View file

@ -780,14 +780,16 @@ void R_SetFrustum (void)
}
else
{
// naievil -- hi, this is floored because any basically non integer(? i think short precision float) value made the rendering all fucked up
// so hope this helps (it does). This reduces some accuracy but it is not as important
// rotate VPN right by FOV_X/2 degrees
RotatePointAroundVector( frustum[0].normal, vup, vpn, -(90-r_refdef.fov_x / 2 ) );
RotatePointAroundVector( frustum[0].normal, vup, vpn, floor(-(90-r_refdef.fov_x / 2 )) );
// rotate VPN left by FOV_X/2 degrees
RotatePointAroundVector( frustum[1].normal, vup, vpn, 90-r_refdef.fov_x / 2 );
RotatePointAroundVector( frustum[1].normal, vup, vpn, floor(90-r_refdef.fov_x / 2) );
// rotate VPN up by FOV_X/2 degrees
RotatePointAroundVector( frustum[2].normal, vright, vpn, 90-r_refdef.fov_y / 2 );
RotatePointAroundVector( frustum[2].normal, vright, vpn, floor(90-r_refdef.fov_y / 2) );
// rotate VPN down by FOV_X/2 degrees
RotatePointAroundVector( frustum[3].normal, vright, vpn, -( 90 - r_refdef.fov_y / 2 ) );
RotatePointAroundVector( frustum[3].normal, vright, vpn, floor(-( 90 - r_refdef.fov_y / 2 )) );
}
for (i=0 ; i<4 ; i++)

View file

@ -1263,10 +1263,6 @@ void SCR_UpdateScreen (void)
}
}
// naievil -- FIXME: the scr_fov is really bugged and only works with integer values
// this should have a weird workaround
//Con_Printf("Original fov: %d\tscr_fov: %f\tzoom: %d\n", original_fov, scr_fov.value, cl.stats[STAT_ZOOM]);
if (oldfov != scr_fov.value)
{
oldfov = scr_fov.value;

View file

@ -131,10 +131,10 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
memset( zrot, 0, sizeof( zrot ) );
zrot[0][0] = zrot[1][1] = zrot[2][2] = 1.0F;
zrot[0][0] = cos( DEG2RAD( degrees ) );
zrot[0][1] = sin( DEG2RAD( degrees ) );
zrot[1][0] = -sin( DEG2RAD( degrees ) );
zrot[1][1] = cos( DEG2RAD( degrees ) );
zrot[0][0] = cosf( DEG2RAD( degrees ) );
zrot[0][1] = sinf( DEG2RAD( degrees ) );
zrot[1][0] = -sinf( DEG2RAD( degrees ) );
zrot[1][1] = cosf( DEG2RAD( degrees ) );
R_ConcatRotations( m, zrot, tmpmat );
R_ConcatRotations( tmpmat, im, rot );