Fix warpy look on Quest 2

This commit is contained in:
Simon 2020-10-13 22:58:43 +01:00
parent d015ba9f9d
commit 299ceb4e2f
15 changed files with 46 additions and 28 deletions

View file

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.drbeef.questzdoom"
android:versionCode="20"
android:versionName="1.1.2" android:installLocation="auto" >
android:versionCode="21"
android:versionName="1.1.3" android:installLocation="auto" >
<!-- Tell the system this app requires OpenGL ES 3.1. -->
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

View file

@ -698,13 +698,14 @@ void ovrRenderer_Clear( ovrRenderer * renderer )
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
}
float QzDoom_GetFOV();
void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ovrJava * java )
{
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
//Now using a symmetrical render target, based on the horizontal FOV
vrFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
QzDoom_GetFOV();
// Create the render Textures.
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
@ -1306,6 +1307,16 @@ static ovrApp gAppState;
static ovrJava java;
static bool destroyed = false;
float QzDoom_GetFOV()
{
if (vrFOV == 0.0f) {
vrFOV = vrapi_GetSystemPropertyInt(&gAppState.Java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
}
return vrFOV;
}
void QzDoom_prepareEyeBuffer(int eye )
{
ovrRenderer *renderer = QzDoom_useScreenLayer() ? &gAppState.Scene.CylinderRenderer : &gAppState.Renderer;

View file

@ -679,6 +679,8 @@ CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
//
//==========================================================================
extern "C" float QzDoom_GetFOV();
void D_Display ()
{
bool wipe;
@ -707,7 +709,7 @@ void D_Display ()
if (viewactive)
{
DAngle fov = 104.f;
DAngle fov = QzDoom_GetFOV();
AActor *cam = players[consoleplayer].camera;
if (cam)
{

View file

@ -995,7 +995,7 @@ void FGLRenderer::RenderView (player_t* player)
mLightCount = !!level.lights;
mShadowMap.Update();
sector_t * viewsector = drawer.RenderViewpoint(player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
sector_t * viewsector = drawer.RenderViewpoint(player->camera, NULL, r_viewpoint.FieldOfView().Degrees, ratio, fovratio, true, true);
All.Unclock();
}
@ -1026,7 +1026,7 @@ void GLSceneDrawer::WriteSavePic (player_t *player, FileWriter *file, int width,
GLRenderer->mLightCount = !!level.lights;
sector_t *viewsector = RenderViewpoint(players[consoleplayer].camera, &bounds,
r_viewpoint.FieldOfView.Degrees, 1.6f, 1.6f, true, false);
r_viewpoint.FieldOfView().Degrees, 1.6f, 1.6f, true, false);
glDisable(GL_STENCIL_TEST);
gl_RenderState.SetFixedColormap(CM_DEFAULT);
gl_RenderState.SetSoftLightLevel(-1);

View file

@ -4926,7 +4926,8 @@ DEFINE_ACTION_FUNCTION(AActor, AdjustFloorClip)
//
EXTERN_CVAR (Bool, chasedemo)
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
EXTERN_CVAR(Float, fov)
extern "C" float QzDoom_GetFOV();
extern bool demonew;
@ -5068,7 +5069,7 @@ AActor *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
mobj->sprite = Skins[p->userinfo.GetSkin()].sprite;
}
p->DesiredFOV = p->FOV = fov;
p->DesiredFOV = p->FOV = QzDoom_GetFOV();
p->camera = p->mo;
p->playerstate = PST_LIVE;
p->refire = 0;

View file

@ -125,13 +125,6 @@ CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCO
ColorSetList ColorSets;
PainFlashList PainFlashes;
// [Nash] FOV cvar setting
CUSTOM_CVAR(Float, fov, 104.f, CVAR_ARCHIVE | CVAR_USERINFO | CVAR_NOINITCALL)
{
player_t *p = &players[consoleplayer];
p->SetFOV(fov);
}
struct PredictPos
{
int gametic;

View file

@ -236,7 +236,7 @@ PolyPortalViewpoint PolyRenderer::SetupPerspectiveMatrix(bool mirror)
float ratio = Viewwindow.WidescreenRatio;
float fovratio = (Viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView().Radians() / 2) / fovratio)).Degrees);
PolyPortalViewpoint portalViewpoint;

View file

@ -365,7 +365,7 @@ void PolyCull::MarkViewFrustum()
if (tilt > 46.0) // If the pitch is larger than this you can look all around
return;
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*viewpoint.FieldOfView.Degrees*48.0 / AspectMultiplier(viewwindow.WidescreenRatio) / 90.0;
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*viewpoint.FieldOfView().Degrees*48.0 / AspectMultiplier(viewwindow.WidescreenRatio) / 90.0;
angle_t a1 = DAngle(floatangle).BAMs();
if (a1 < ANGLE_180)
{

View file

@ -140,8 +140,8 @@ void R_InitSkyMap ()
skyiscale = float(r_Yaspect / freelookviewheight);
skyscale = freelookviewheight / r_Yaspect;
skyiscale *= float(r_viewpoint.FieldOfView.Degrees / 90.);
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
skyiscale *= float(r_viewpoint.FieldOfView().Degrees / 90.);
skyscale *= float(90. / r_viewpoint.FieldOfView().Degrees);
}
if (skystretch)

View file

@ -111,6 +111,8 @@ int viewwindowy;
int viewwidth;
int viewheight;
extern "C" float QzDoom_GetFOV();
FRenderViewpoint::FRenderViewpoint()
{
player = nullptr;
@ -125,13 +127,20 @@ FRenderViewpoint::FRenderViewpoint()
TanSin = 0.0;
camera = nullptr;
sector = nullptr;
FieldOfView = 104.; // Angles in the SCREENWIDTH wide window
TicFrac = 0.0;
FrameTime = 0;
extralight = 0;
showviewer = false;
}
DAngle FRenderViewpoint::FieldOfView() const
{
//Get for VR
DAngle fov = QzDoom_GetFOV();
return fov;
}
FRenderViewpoint r_viewpoint;
FViewWindow r_viewwindow;
@ -166,13 +175,14 @@ DEFINE_GLOBAL(LocalViewPitch);
void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov)
{
if (fov < 5.) fov = 5.;
/* if (fov < 5.) fov = 5.;
else if (fov > 170.) fov = 170.;
if (fov != viewpoint.FieldOfView)
{
viewpoint.FieldOfView = fov;
setsizeneeded = true;
}
*/
}
//==========================================================================
@ -242,7 +252,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
}
DAngle fov = viewpoint.FieldOfView;
DAngle fov = viewpoint.FieldOfView();
// For widescreen displays, increase the FOV so that the middle part of the
// screen that would be visible on a 4:3 display has the requested FOV.

View file

@ -16,7 +16,9 @@ struct FRenderViewpoint
{
FRenderViewpoint();
player_t *player; // For which player is this viewpoint being renderered? (can be null for camera textures)
DAngle FieldOfView() const; // current field of view
player_t *player; // For which player is this viewpoint being renderered? (can be null for camera textures)
DVector3 Pos; // Camera position
DVector3 CenterEyePos; // Camera position without view shift
DVector3 ActorPos; // Camera actor's position
@ -29,7 +31,6 @@ struct FRenderViewpoint
AActor *camera; // camera actor
sector_t *sector; // [RH] keep track of sector viewing from
DAngle FieldOfView; // current field of view
double TicFrac; // fraction of tic for interpolation
uint32_t FrameTime; // current frame's time in tics.

View file

@ -288,7 +288,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
// These get clobbered by rendering to a camera texture but they need to be preserved so the final rendering can be done with the correct palette.
CameraLight savedCameraLight = *CameraLight::Instance();
DAngle savedfov = cameraViewpoint.FieldOfView;
DAngle savedfov = cameraViewpoint.FieldOfView();
R_SetFOV (cameraViewpoint, fov);
if (r_polyrenderer)

View file

@ -291,7 +291,7 @@ namespace swrenderer
float adjustedViewAngle = (float)(Viewpoint.Angles.Yaw - 90).Radians();
float ratio = Viewwindow.WidescreenRatio;
float fovratio = (Viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView().Radians() / 2) / fovratio)).Degrees);
Mat4f altWorldToView =
Mat4f::Rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
Mat4f::Rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *

View file

@ -199,7 +199,7 @@ namespace swrenderer
FocalLengthY = FocalLengthX * YaspectMul;
// This is 1/FocalTangent before the widescreen extension of FOV.
viewingrangerecip = FLOAT2FIXED(1. / tan(viewpoint.FieldOfView.Radians() / 2));
viewingrangerecip = FLOAT2FIXED(1. / tan(viewpoint.FieldOfView().Radians() / 2));
// Now generate xtoviewangle for sky texture mapping.
// [RH] Do not generate viewangletox, because texture mapping is no

View file

@ -41,7 +41,7 @@ const char *GetVersionString();
/** Lots of different version numbers **/
#define VERSIONSTR "DrBeef's QuestZDoom-1.1.2 (LZDoom 3.85)"
#define VERSIONSTR "DrBeef's QuestZDoom-1.1.3 (LZDoom 3.85)"
// The version as seen in the Windows resource
#define RC_FILEVERSION 3,85,0