Get FOV from VrApi for Quest 1 & 2 support

This commit is contained in:
Simon 2020-10-14 19:14:31 +01:00
parent d50c947e37
commit 01b67f3b35
8 changed files with 24 additions and 7 deletions

View file

@ -48,7 +48,7 @@ Copyright : Copyright 2015 Oculus VR, LLC. All Rights reserved.
//Define all variables here that were externs in the VrCommon.h
bool Doom3Quest_initialised;
float playerYaw;
float vrFOV;
float vrFOV = 0.0f;
bool vr_moveuseoffhand;
float vr_snapturn_angle;
bool vr_switchsticks;
@ -783,13 +783,14 @@ void ovrRenderer_Clear( ovrRenderer * renderer )
renderer->NumBuffers = VRAPI_FRAME_LAYER_EYE_MAX;
}
float Doom3Quest_GetFOV();
void ovrRenderer_Create( int width, int height, ovrRenderer * renderer, const ovrJava * java )
{
renderer->NumBuffers = 1; // Multiview
//Now using a symmetrical render target, based on the horizontal FOV
vrFOV = vrapi_GetSystemPropertyInt( java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
Doom3Quest_GetFOV();
// Create the multi view frame buffer
ovrFramebuffer_Create( &renderer->FrameBuffer,
@ -1048,6 +1049,15 @@ static ovrApp gAppState;
static ovrJava java;
static bool destroyed = false;
float Doom3Quest_GetFOV()
{
if (vrFOV == 0.0f) {
vrFOV = vrapi_GetSystemPropertyInt(&gAppState.Java, VRAPI_SYS_PROP_SUGGESTED_EYE_FOV_DEGREES_X);
}
return vrFOV;
}
static void ovrApp_HandleVrModeChanges( ovrApp * app )
{
if ( app->Resumed != false && app->NativeWindow != NULL )

View file

@ -19,7 +19,7 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the addres Doom3s below.
If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.

View file

@ -7226,7 +7226,7 @@ Returns the base FOV
float idPlayer::DefaultFov( void ) const {
float fov;
fov = g_fov.GetFloat();
fov = renderSystem->GetFOV();
if ( gameLocal.isMultiplayer ) {
if ( fov < 90.0f ) {
return 90.0f;

View file

@ -280,7 +280,6 @@ idCVar g_gun_y( "g_gunY", "0", CVAR_GAME | CVAR_FLOAT, "" );
idCVar g_gun_z( "g_gunZ", "0", CVAR_GAME | CVAR_FLOAT, "" );
idCVar g_viewNodalX( "g_viewNodalX", "0", CVAR_GAME | CVAR_FLOAT, "" );
idCVar g_viewNodalZ( "g_viewNodalZ", "0", CVAR_GAME | CVAR_FLOAT, "" );
idCVar g_fov( "g_fov", "104", CVAR_GAME | CVAR_INTEGER | CVAR_NOCHEAT, "" );
idCVar g_skipViewEffects( "g_skipViewEffects", "0", CVAR_GAME | CVAR_BOOL, "skip damage and other view effects" );
idCVar g_mpWeaponAngleScale( "g_mpWeaponAngleScale", "0", CVAR_GAME | CVAR_FLOAT, "Control the weapon sway in MP" );

View file

@ -209,7 +209,6 @@ extern idCVar g_gun_y;
extern idCVar g_gun_z;
extern idCVar g_viewNodalX;
extern idCVar g_viewNodalZ;
extern idCVar g_fov;
extern idCVar g_testDeath;
extern idCVar g_skipViewEffects;
extern idCVar g_mpWeaponAngleScale;

View file

@ -152,6 +152,7 @@ public:
virtual bool IsFullScreen( void ) const = 0;
virtual int GetScreenWidth( void ) const = 0;
virtual int GetScreenHeight( void ) const = 0;
virtual float GetFOV() const = 0;
// allocate a renderWorld to be used for drawing
virtual idRenderWorld * AllocRenderWorld( void ) = 0;

View file

@ -1791,4 +1791,10 @@ idRenderSystemLocal::GetScreenHeight
*/
int idRenderSystemLocal::GetScreenHeight( void ) const {
return glConfig.vidHeight;
}
}
extern "C" Doom3Quest_GetFOV();
float idRenderSystemLocal::GetFOV() const
{
return Doom3Quest_GetFOV();
}

View file

@ -686,6 +686,8 @@ public:
virtual bool IsFullScreen( void ) const;
virtual int GetScreenWidth( void ) const;
virtual int GetScreenHeight( void ) const;
virtual float GetFOV() const;
virtual idRenderWorld * AllocRenderWorld( void );
virtual void FreeRenderWorld( idRenderWorld *rw );
virtual void BeginLevelLoad( void );