- I have no idea why a fov of exactly 90° does not work.

Changing this by one in either direction makes the problem go away.
This commit is contained in:
Christoph Oelckers 2020-01-25 11:56:13 +01:00
parent f8a807e3bb
commit e8231f904f
4 changed files with 10 additions and 4 deletions

View file

@ -3103,7 +3103,10 @@ void viewDrawScreen(bool sceneonly)
newaspect_enable = 1;
videoSetCorrectedAspect();
}
renderSetAspect(Blrintf(float(viewingrange) * tanf(r_fov * (PI / 360.f))), yxaspect);
int v1 = Blrintf(double(viewingrange) * tan(r_fov * (PI / 360.)));
renderSetAspect(v1, yxaspect);
int cX = gView->pSprite->x;
int cY = gView->pSprite->y;
int cZ = gView->zView;

View file

@ -11,6 +11,8 @@
# include "windows_inc.h"
#endif
#include "xs_Float.h"
////////// Compiler detection //////////
#ifdef __GNUC__
@ -499,9 +501,9 @@ static inline int32_t atoi_safe(const char *str) { return (int32_t)strtoll(str,
#define Batoi(x) atoi_safe(x)
#define Batol(str) (strtol(str, NULL, 10))
static constexpr inline int Blrintf(const double x)
static inline int Blrintf(const double x)
{
return int(x);
return xs_CRoundToInt(x);
}
#if defined(__arm__)

View file

@ -10062,6 +10062,7 @@ void videoSetViewableArea(int32_t x1, int32_t y1, int32_t x2, int32_t y2)
//
void renderSetAspect(int32_t daxrange, int32_t daaspect)
{
if (daxrange == 65536) daxrange--; // This doesn't work correctly with 65536. All other values are fine. No idea where this is evaluated wrong.
viewingrange = daxrange;
viewingrangerecip = divscale32(1,daxrange);
#ifdef USE_OPENGL

View file

@ -755,7 +755,7 @@ void G_DrawRooms(int32_t playerNum, int32_t smoothRatio)
#endif
)));
vr = Blrintf(float(vr) * tanf(r_fov * (fPI/360.f)));
vr = Blrintf(double(vr) * tan(r_fov * (PI/360.)));
if (!r_usenewaspect)
renderSetAspect(vr, yxaspect);