Support VR mode disable on Oculus device
This commit is contained in:
parent
31b64d4689
commit
9d6d68f00a
1 changed files with 13 additions and 3 deletions
16
src/rlgl.c
16
src/rlgl.c
|
@ -2671,7 +2671,17 @@ bool IsVrDeviceReady(void)
|
||||||
// Enable/Disable VR experience (device or simulator)
|
// Enable/Disable VR experience (device or simulator)
|
||||||
void ToggleVrMode(void)
|
void ToggleVrMode(void)
|
||||||
{
|
{
|
||||||
vrEnabled = !vrEnabled;
|
if (vrDeviceReady || vrSimulator) vrEnabled = !vrEnabled;
|
||||||
|
else vrEnabled = false;
|
||||||
|
|
||||||
|
if (!vrEnabled)
|
||||||
|
{
|
||||||
|
// Reset viewport and default projection-modelview matrices
|
||||||
|
rlViewport(0, 0, GetScreenWidth(), GetScreenHeight());
|
||||||
|
projection = MatrixOrtho(0, GetScreenWidth(), GetScreenHeight(), 0, 0.0f, 1.0f);
|
||||||
|
MatrixTranspose(&projection);
|
||||||
|
modelview = MatrixIdentity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update VR tracking (position and orientation)
|
// Update VR tracking (position and orientation)
|
||||||
|
@ -3745,12 +3755,12 @@ static void SetStereoConfig(VrDeviceInfo hmd)
|
||||||
|
|
||||||
// Set internal projection and modelview matrix depending on eyes tracking data
|
// Set internal projection and modelview matrix depending on eyes tracking data
|
||||||
static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView)
|
static void SetStereoView(int eye, Matrix matProjection, Matrix matModelView)
|
||||||
{
|
{
|
||||||
if (vrEnabled)
|
if (vrEnabled)
|
||||||
{
|
{
|
||||||
Matrix eyeProjection = matProjection;
|
Matrix eyeProjection = matProjection;
|
||||||
Matrix eyeModelView = matModelView;
|
Matrix eyeModelView = matModelView;
|
||||||
|
|
||||||
#if defined(RLGL_OCULUS_SUPPORT)
|
#if defined(RLGL_OCULUS_SUPPORT)
|
||||||
if (vrDeviceReady)
|
if (vrDeviceReady)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue