mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 19:51:33 +00:00
Fixed lifecycle so headset can go to sleep and app will resume without issue
This commit is contained in:
parent
3d6af564c8
commit
6e61785dcd
2 changed files with 37 additions and 24 deletions
|
@ -2025,14 +2025,12 @@ void VR_UpdateStageBounds() {
|
|||
OXR(result = xrGetReferenceSpaceBoundsRect(
|
||||
gAppState.Session, XR_REFERENCE_SPACE_TYPE_STAGE, &stageBounds));
|
||||
if (result != XR_SUCCESS) {
|
||||
ALOGV("Stage bounds query failed: using small defaults");
|
||||
ALOGE("Stage bounds query failed: using small defaults");
|
||||
stageBounds.width = 1.0f;
|
||||
stageBounds.height = 1.0f;
|
||||
|
||||
gAppState.CurrentSpace = gAppState.FakeStageSpace;
|
||||
}
|
||||
|
||||
ALOGV("Stage bounds: width = %f, depth %f", stageBounds.width, stageBounds.height);
|
||||
}
|
||||
|
||||
//All the stuff we want to do each frame
|
||||
|
@ -2043,18 +2041,34 @@ void JKVR_FrameSetup()
|
|||
return;
|
||||
}
|
||||
|
||||
GLboolean stageBoundsDirty = GL_TRUE;
|
||||
if (ovrApp_HandleXrEvents(&gAppState)) {
|
||||
VR_Recenter();
|
||||
}
|
||||
if (gAppState.SessionActive == GL_FALSE) {
|
||||
return;
|
||||
}
|
||||
while (!destroyed)
|
||||
{
|
||||
JKVR_processMessageQueue();
|
||||
|
||||
if (stageBoundsDirty) {
|
||||
VR_UpdateStageBounds();
|
||||
stageBoundsDirty = GL_FALSE;
|
||||
}
|
||||
GLboolean stageBoundsDirty = GL_TRUE;
|
||||
if (ovrApp_HandleXrEvents(&gAppState))
|
||||
{
|
||||
VR_Recenter();
|
||||
}
|
||||
|
||||
if (gAppState.SessionActive == GL_FALSE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stageBoundsDirty)
|
||||
{
|
||||
VR_UpdateStageBounds();
|
||||
stageBoundsDirty = GL_FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (destroyed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// NOTE: OpenXR does not use the concept of frame indices. Instead,
|
||||
|
@ -2085,8 +2099,6 @@ void JKVR_FrameSetup()
|
|||
//get any cvar values required here
|
||||
vr.immersive_cinematics = (vr_immersive_cinematics->value != 0.0f);
|
||||
|
||||
JKVR_processMessageQueue();
|
||||
|
||||
//Get controller state here
|
||||
JKVR_getHMDOrientation();
|
||||
JKVR_getTrackedRemotesOrientation();
|
||||
|
|
|
@ -346,19 +346,20 @@ void JKVR_InitActions( void )
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Attach to session
|
||||
XrSessionActionSetsAttachInfo attachInfo = {};
|
||||
attachInfo.type = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO;
|
||||
attachInfo.next = NULL;
|
||||
attachInfo.countActionSets = 1;
|
||||
attachInfo.actionSets = &runningActionSet;
|
||||
OXR(xrAttachSessionActionSets(gAppState.Session, &attachInfo));
|
||||
|
||||
inputInitialized = qtrue;
|
||||
}
|
||||
|
||||
void JKVR_SyncActions( void )
|
||||
{
|
||||
// Attach to session
|
||||
XrSessionActionSetsAttachInfo attachInfo = {};
|
||||
attachInfo.type = XR_TYPE_SESSION_ACTION_SETS_ATTACH_INFO;
|
||||
attachInfo.next = NULL;
|
||||
attachInfo.countActionSets = 1;
|
||||
attachInfo.actionSets = &runningActionSet;
|
||||
OXR(xrAttachSessionActionSets(gAppState.Session, &attachInfo));
|
||||
|
||||
// sync action data
|
||||
XrActiveActionSet activeActionSet = {};
|
||||
activeActionSet.actionSet = runningActionSet;
|
||||
|
|
Loading…
Reference in a new issue