Skip to content

Commit 299ceb4

Browse files
committed
Fix warpy look on Quest 2
1 parent d015ba9 commit 299ceb4

File tree

15 files changed

+46
-28
lines changed

15 files changed

+46
-28
lines changed

Projects/Android/AndroidManifest.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="com.drbeef.questzdoom"
4-
android:versionCode="20"
5-
android:versionName="1.1.2" android:installLocation="auto" >
4+
android:versionCode="21"
5+
android:versionName="1.1.3" android:installLocation="auto" >
66

77
<!-- Tell the system this app requires OpenGL ES 3.1. -->
88
<uses-feature android:glEsVersion="0x00030001" android:required="true"/>

Projects/Android/jni/QzDoom/QzDoom_SurfaceView.c

+12-1
Original file line numberDiff line numberDiff line change
@@ -698,13 +698,14 @@ void ovrRenderer_Clear( ovrRenderer * renderer )
698698
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
699699
}
700700

701+
float QzDoom_GetFOV();
701702

702703
void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ovrJava * java )
703704
{
704705
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
705706

706707
//Now using a symmetrical render target, based on the horizontal FOV
707-
vrFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
708+
QzDoom_GetFOV();
708709

709710
// Create the render Textures.
710711
for ( int eye = 0; eye < VRAPI_FRAME_LAYER_EYE_MAX; eye++ )
@@ -1306,6 +1307,16 @@ static ovrApp gAppState;
13061307
static ovrJava java;
13071308
static bool destroyed = false;
13081309

1310+
1311+
float QzDoom_GetFOV()
1312+
{
1313+
if (vrFOV == 0.0f) {
1314+
vrFOV = vrapi_GetSystemPropertyInt(&gAppState.Java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
1315+
}
1316+
1317+
return vrFOV;
1318+
}
1319+
13091320
void QzDoom_prepareEyeBuffer(int eye )
13101321
{
13111322
ovrRenderer *renderer = QzDoom_useScreenLayer() ? &gAppState.Scene.CylinderRenderer : &gAppState.Renderer;

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/d_main.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ CVAR(Bool, vid_activeinbackground, false, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
679679
//
680680
//==========================================================================
681681

682+
extern "C" float QzDoom_GetFOV();
683+
682684
void D_Display ()
683685
{
684686
bool wipe;
@@ -707,7 +709,7 @@ void D_Display ()
707709

708710
if (viewactive)
709711
{
710-
DAngle fov = 104.f;
712+
DAngle fov = QzDoom_GetFOV();
711713
AActor *cam = players[consoleplayer].camera;
712714
if (cam)
713715
{

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/gl/scene/gl_scene.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ void FGLRenderer::RenderView (player_t* player)
995995
mLightCount = !!level.lights;
996996

997997
mShadowMap.Update();
998-
sector_t * viewsector = drawer.RenderViewpoint(player->camera, NULL, r_viewpoint.FieldOfView.Degrees, ratio, fovratio, true, true);
998+
sector_t * viewsector = drawer.RenderViewpoint(player->camera, NULL, r_viewpoint.FieldOfView().Degrees, ratio, fovratio, true, true);
999999

10001000
All.Unclock();
10011001
}
@@ -1026,7 +1026,7 @@ void GLSceneDrawer::WriteSavePic (player_t *player, FileWriter *file, int width,
10261026
GLRenderer->mLightCount = !!level.lights;
10271027

10281028
sector_t *viewsector = RenderViewpoint(players[consoleplayer].camera, &bounds,
1029-
r_viewpoint.FieldOfView.Degrees, 1.6f, 1.6f, true, false);
1029+
r_viewpoint.FieldOfView().Degrees, 1.6f, 1.6f, true, false);
10301030
glDisable(GL_STENCIL_TEST);
10311031
gl_RenderState.SetFixedColormap(CM_DEFAULT);
10321032
gl_RenderState.SetSoftLightLevel(-1);

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/p_mobj.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -4926,7 +4926,8 @@ DEFINE_ACTION_FUNCTION(AActor, AdjustFloorClip)
49264926
//
49274927
EXTERN_CVAR (Bool, chasedemo)
49284928
EXTERN_CVAR(Bool, sv_singleplayerrespawn)
4929-
EXTERN_CVAR(Float, fov)
4929+
4930+
extern "C" float QzDoom_GetFOV();
49304931

49314932
extern bool demonew;
49324933

@@ -5068,7 +5069,7 @@ AActor *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags)
50685069
mobj->sprite = Skins[p->userinfo.GetSkin()].sprite;
50695070
}
50705071

5071-
p->DesiredFOV = p->FOV = fov;
5072+
p->DesiredFOV = p->FOV = QzDoom_GetFOV();
50725073
p->camera = p->mo;
50735074
p->playerstate = PST_LIVE;
50745075
p->refire = 0;

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/p_user.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -125,13 +125,6 @@ CUSTOM_CVAR(Float, cl_predict_lerpthreshold, 2.00f, CVAR_ARCHIVE | CVAR_GLOBALCO
125125
ColorSetList ColorSets;
126126
PainFlashList PainFlashes;
127127

128-
// [Nash] FOV cvar setting
129-
CUSTOM_CVAR(Float, fov, 104.f, CVAR_ARCHIVE | CVAR_USERINFO | CVAR_NOINITCALL)
130-
{
131-
player_t *p = &players[consoleplayer];
132-
p->SetFOV(fov);
133-
}
134-
135128
struct PredictPos
136129
{
137130
int gametic;

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/polyrenderer/poly_renderer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ PolyPortalViewpoint PolyRenderer::SetupPerspectiveMatrix(bool mirror)
236236
float ratio = Viewwindow.WidescreenRatio;
237237
float fovratio = (Viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
238238

239-
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
239+
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView().Radians() / 2) / fovratio)).Degrees);
240240

241241
PolyPortalViewpoint portalViewpoint;
242242

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/polyrenderer/scene/poly_cull.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ void PolyCull::MarkViewFrustum()
365365
if (tilt > 46.0) // If the pitch is larger than this you can look all around
366366
return;
367367

368-
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*viewpoint.FieldOfView.Degrees*48.0 / AspectMultiplier(viewwindow.WidescreenRatio) / 90.0;
368+
double floatangle = 2.0 + (45.0 + ((tilt / 1.9)))*viewpoint.FieldOfView().Degrees*48.0 / AspectMultiplier(viewwindow.WidescreenRatio) / 90.0;
369369
angle_t a1 = DAngle(floatangle).BAMs();
370370
if (a1 < ANGLE_180)
371371
{

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/r_sky.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ void R_InitSkyMap ()
140140
skyiscale = float(r_Yaspect / freelookviewheight);
141141
skyscale = freelookviewheight / r_Yaspect;
142142

143-
skyiscale *= float(r_viewpoint.FieldOfView.Degrees / 90.);
144-
skyscale *= float(90. / r_viewpoint.FieldOfView.Degrees);
143+
skyiscale *= float(r_viewpoint.FieldOfView().Degrees / 90.);
144+
skyscale *= float(90. / r_viewpoint.FieldOfView().Degrees);
145145
}
146146

147147
if (skystretch)

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/r_utility.cpp

+13-3
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ int viewwindowy;
111111
int viewwidth;
112112
int viewheight;
113113

114+
extern "C" float QzDoom_GetFOV();
115+
114116
FRenderViewpoint::FRenderViewpoint()
115117
{
116118
player = nullptr;
@@ -125,13 +127,20 @@ FRenderViewpoint::FRenderViewpoint()
125127
TanSin = 0.0;
126128
camera = nullptr;
127129
sector = nullptr;
128-
FieldOfView = 104.; // Angles in the SCREENWIDTH wide window
129130
TicFrac = 0.0;
130131
FrameTime = 0;
131132
extralight = 0;
132133
showviewer = false;
133134
}
134135

136+
DAngle FRenderViewpoint::FieldOfView() const
137+
{
138+
//Get for VR
139+
DAngle fov = QzDoom_GetFOV();
140+
return fov;
141+
}
142+
143+
135144
FRenderViewpoint r_viewpoint;
136145
FViewWindow r_viewwindow;
137146

@@ -166,13 +175,14 @@ DEFINE_GLOBAL(LocalViewPitch);
166175
void R_SetFOV (FRenderViewpoint &viewpoint, DAngle fov)
167176
{
168177

169-
if (fov < 5.) fov = 5.;
178+
/* if (fov < 5.) fov = 5.;
170179
else if (fov > 170.) fov = 170.;
171180
if (fov != viewpoint.FieldOfView)
172181
{
173182
viewpoint.FieldOfView = fov;
174183
setsizeneeded = true;
175184
}
185+
*/
176186
}
177187

178188
//==========================================================================
@@ -242,7 +252,7 @@ void R_SetWindow (FRenderViewpoint &viewpoint, FViewWindow &viewwindow, int wind
242252
}
243253

244254

245-
DAngle fov = viewpoint.FieldOfView;
255+
DAngle fov = viewpoint.FieldOfView();
246256

247257
// For widescreen displays, increase the FOV so that the middle part of the
248258
// screen that would be visible on a 4:3 display has the requested FOV.

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/r_utility.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ struct FRenderViewpoint
1616
{
1717
FRenderViewpoint();
1818

19-
player_t *player; // For which player is this viewpoint being renderered? (can be null for camera textures)
19+
DAngle FieldOfView() const; // current field of view
20+
21+
player_t *player; // For which player is this viewpoint being renderered? (can be null for camera textures)
2022
DVector3 Pos; // Camera position
2123
DVector3 CenterEyePos; // Camera position without view shift
2224
DVector3 ActorPos; // Camera actor's position
@@ -29,7 +31,6 @@ struct FRenderViewpoint
2931

3032
AActor *camera; // camera actor
3133
sector_t *sector; // [RH] keep track of sector viewing from
32-
DAngle FieldOfView; // current field of view
3334

3435
double TicFrac; // fraction of tic for interpolation
3536
uint32_t FrameTime; // current frame's time in tics.

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/swrenderer/r_swrenderer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ void FSoftwareRenderer::RenderTextureView (FCanvasTexture *tex, AActor *viewpoin
288288
// 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.
289289
CameraLight savedCameraLight = *CameraLight::Instance();
290290

291-
DAngle savedfov = cameraViewpoint.FieldOfView;
291+
DAngle savedfov = cameraViewpoint.FieldOfView();
292292
R_SetFOV (cameraViewpoint, fov);
293293

294294
if (r_polyrenderer)

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/swrenderer/things/r_model.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ namespace swrenderer
291291
float adjustedViewAngle = (float)(Viewpoint.Angles.Yaw - 90).Radians();
292292
float ratio = Viewwindow.WidescreenRatio;
293293
float fovratio = (Viewwindow.WidescreenRatio >= 1.3f) ? 1.333333f : ratio;
294-
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView.Radians() / 2) / fovratio)).Degrees);
294+
float fovy = (float)(2 * DAngle::ToDegrees(atan(tan(Viewpoint.FieldOfView().Radians() / 2) / fovratio)).Degrees);
295295
Mat4f altWorldToView =
296296
Mat4f::Rotate(adjustedPitch, 1.0f, 0.0f, 0.0f) *
297297
Mat4f::Rotate(adjustedViewAngle, 0.0f, -1.0f, 0.0f) *

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/swrenderer/viewport/r_viewport.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ namespace swrenderer
199199
FocalLengthY = FocalLengthX * YaspectMul;
200200

201201
// This is 1/FocalTangent before the widescreen extension of FOV.
202-
viewingrangerecip = FLOAT2FIXED(1. / tan(viewpoint.FieldOfView.Radians() / 2));
202+
viewingrangerecip = FLOAT2FIXED(1. / tan(viewpoint.FieldOfView().Radians() / 2));
203203

204204
// Now generate xtoviewangle for sky texture mapping.
205205
// [RH] Do not generate viewangletox, because texture mapping is no

Projects/Android/jni/gzdoom-g3.3mgw_mobile/src/version.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const char *GetVersionString();
4141

4242
/** Lots of different version numbers **/
4343

44-
#define VERSIONSTR "DrBeef's QuestZDoom-1.1.2 (LZDoom 3.85)"
44+
#define VERSIONSTR "DrBeef's QuestZDoom-1.1.3 (LZDoom 3.85)"
4545

4646
// The version as seen in the Windows resource
4747
#define RC_FILEVERSION 3,85,0

0 commit comments

Comments
 (0)