mirror of
https://github.com/DrBeef/ioq3quest.git
synced 2024-11-25 21:41:35 +00:00
OpenXR sync input actions from renderer
This commit is contained in:
parent
ed96160ffc
commit
be158b4ad9
3 changed files with 33 additions and 29 deletions
|
@ -1326,35 +1326,6 @@ void IN_VRInputFrame( void )
|
||||||
rightControllerAimSpace = CreateActionSpace(handPoseRightAction, rightHandPath);
|
rightControllerAimSpace = CreateActionSpace(handPoseRightAction, rightHandPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// OpenXR input
|
|
||||||
{
|
|
||||||
// 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(engine->appState.Session, &attachInfo));
|
|
||||||
|
|
||||||
// sync action data
|
|
||||||
XrActiveActionSet activeActionSet = {};
|
|
||||||
activeActionSet.actionSet = runningActionSet;
|
|
||||||
activeActionSet.subactionPath = XR_NULL_PATH;
|
|
||||||
|
|
||||||
XrActionsSyncInfo syncInfo = {};
|
|
||||||
syncInfo.type = XR_TYPE_ACTIONS_SYNC_INFO;
|
|
||||||
syncInfo.next = NULL;
|
|
||||||
syncInfo.countActiveActionSets = 1;
|
|
||||||
syncInfo.activeActionSets = &activeActionSet;
|
|
||||||
OXR(xrSyncActions(engine->appState.Session, &syncInfo));
|
|
||||||
|
|
||||||
// query input action states
|
|
||||||
XrActionStateGetInfo getInfo = {};
|
|
||||||
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
|
||||||
getInfo.next = NULL;
|
|
||||||
getInfo.subactionPath = XR_NULL_PATH;
|
|
||||||
}
|
|
||||||
|
|
||||||
//button mapping
|
//button mapping
|
||||||
uint32_t lButtons = 0;
|
uint32_t lButtons = 0;
|
||||||
if (GetActionStateBoolean(menuAction).currentState) lButtons |= ovrButton_Enter;
|
if (GetActionStateBoolean(menuAction).currentState) lButtons |= ovrButton_Enter;
|
||||||
|
@ -1388,6 +1359,37 @@ void IN_VRInputFrame( void )
|
||||||
in_vrEventTime = Sys_Milliseconds( );
|
in_vrEventTime = Sys_Milliseconds( );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void IN_VRSyncActions( void )
|
||||||
|
{
|
||||||
|
engine_t* engine = VR_GetEngine();
|
||||||
|
|
||||||
|
// 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(engine->appState.Session, &attachInfo));
|
||||||
|
|
||||||
|
// sync action data
|
||||||
|
XrActiveActionSet activeActionSet = {};
|
||||||
|
activeActionSet.actionSet = runningActionSet;
|
||||||
|
activeActionSet.subactionPath = XR_NULL_PATH;
|
||||||
|
|
||||||
|
XrActionsSyncInfo syncInfo = {};
|
||||||
|
syncInfo.type = XR_TYPE_ACTIONS_SYNC_INFO;
|
||||||
|
syncInfo.next = NULL;
|
||||||
|
syncInfo.countActiveActionSets = 1;
|
||||||
|
syncInfo.activeActionSets = &activeActionSet;
|
||||||
|
OXR(xrSyncActions(engine->appState.Session, &syncInfo));
|
||||||
|
|
||||||
|
// query input action states
|
||||||
|
XrActionStateGetInfo getInfo = {};
|
||||||
|
getInfo.type = XR_TYPE_ACTION_STATE_GET_INFO;
|
||||||
|
getInfo.next = NULL;
|
||||||
|
getInfo.subactionPath = XR_NULL_PATH;
|
||||||
|
}
|
||||||
|
|
||||||
void IN_VRUpdateControllers( float predictedDisplayTime )
|
void IN_VRUpdateControllers( float predictedDisplayTime )
|
||||||
{
|
{
|
||||||
engine_t* engine = VR_GetEngine();
|
engine_t* engine = VR_GetEngine();
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
void IN_VRInputFrame( void );
|
void IN_VRInputFrame( void );
|
||||||
void IN_VRInit( void );
|
void IN_VRInit( void );
|
||||||
|
void IN_VRSyncActions( void );
|
||||||
void IN_VRUpdateControllers( float predictedDisplayTime );
|
void IN_VRUpdateControllers( float predictedDisplayTime );
|
||||||
|
|
||||||
void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out);
|
void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out);
|
||||||
|
|
|
@ -414,6 +414,7 @@ void VR_DrawFrame( engine_t* engine ) {
|
||||||
vr.clientview_yaw_last = clientview_yaw;
|
vr.clientview_yaw_last = clientview_yaw;
|
||||||
|
|
||||||
// Update controllers
|
// Update controllers
|
||||||
|
IN_VRSyncActions();
|
||||||
IN_VRUpdateControllers( frameState.predictedDisplayTime );
|
IN_VRUpdateControllers( frameState.predictedDisplayTime );
|
||||||
|
|
||||||
XrViewLocateInfo projectionInfo = {};
|
XrViewLocateInfo projectionInfo = {};
|
||||||
|
|
Loading…
Reference in a new issue