diff --git a/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp b/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp index db59138..dc8c67b 100644 --- a/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp +++ b/Projects/Android/jni/JKVR/JKVR_SurfaceView.cpp @@ -13,37 +13,13 @@ #include "VrInput.h" #include "VrCvars.h" -#include -#include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include - extern "C" { #include "src/gl/loader.h" } #include -#include "VrInput.h" -#if !defined( EGL_OPENGL_ES3_BIT_KHR ) -#define EGL_OPENGL_ES3_BIT_KHR 0x0040 -#endif - -// EXT_texture_border_clamp -#ifndef GL_CLAMP_TO_BORDER -#define GL_CLAMP_TO_BORDER 0x812D -#endif - -#ifndef GL_TEXTURE_BORDER_COLOR -#define GL_TEXTURE_BORDER_COLOR 0x1004 -#endif - -#ifndef GLAPI -#define GLAPI extern -#endif //#define ENABLE_GL_DEBUG #define ENABLE_GL_DEBUG_VERBOSE 1 @@ -255,6 +231,7 @@ void VR_GetMove(float *forward, float *side, float *pos_forward, float *pos_side *pos_forward = positional_movementForward; *up = remote_movementUp; *side = remote_movementSideways; + *pos_side = positional_movementSideways; *yaw = vr.hmdorientation[YAW] + vr.snapTurn; *pitch = vr.hmdorientation[PITCH]; diff --git a/Projects/Android/jni/JKVR/OpenXrInput_MetaQuest.cpp b/Projects/Android/jni/JKVR/OpenXrInput_MetaQuest.cpp index 8f7a438..2d0bcea 100644 --- a/Projects/Android/jni/JKVR/OpenXrInput_MetaQuest.cpp +++ b/Projects/Android/jni/JKVR/OpenXrInput_MetaQuest.cpp @@ -394,7 +394,7 @@ void TBXR_UpdateControllers( ) XrSpaceLocation loc = {}; loc.type = XR_TYPE_SPACE_LOCATION; loc.next = &vel; - OXR(xrLocateSpace(controllerSpace[i], gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc)); + OXR(xrLocateSpace(controllerSpace[i], gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc)); gAppState.TrackedController[i].Active = (loc.locationFlags & XR_SPACE_LOCATION_POSITION_VALID_BIT) != 0; gAppState.TrackedController[i].Pose = loc.pose; diff --git a/Projects/Android/jni/JKVR/OpenXrInput_PicoXR.cpp b/Projects/Android/jni/JKVR/OpenXrInput_PicoXR.cpp index 0441f0e..6d0ac1a 100644 --- a/Projects/Android/jni/JKVR/OpenXrInput_PicoXR.cpp +++ b/Projects/Android/jni/JKVR/OpenXrInput_PicoXR.cpp @@ -528,7 +528,7 @@ void TBXR_UpdateControllers( ) XrSpaceLocation loc = {}; loc.type = XR_TYPE_SPACE_LOCATION; loc.next = &vel; - XrResult res = xrLocateSpace(aimSpace[i], gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc); + XrResult res = xrLocateSpace(aimSpace[i], gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc); if (res != XR_SUCCESS) { Com_Printf("xrLocateSpace error: %d", (int)res); } diff --git a/Projects/Android/jni/JKVR/TBXR_Common.cpp b/Projects/Android/jni/JKVR/TBXR_Common.cpp index 295650f..cc29f58 100644 --- a/Projects/Android/jni/JKVR/TBXR_Common.cpp +++ b/Projects/Android/jni/JKVR/TBXR_Common.cpp @@ -1701,7 +1701,7 @@ void TBXR_Recenter() { vec3_t rotation = {0, 0, 0}; XrSpaceLocation loc = {}; loc.type = XR_TYPE_SPACE_LOCATION; - OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc)); + OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc)); QuatToYawPitchRoll(loc.pose.orientation, rotation, vr.hmdorientation); spaceCreateInfo.poseInReferenceSpace.orientation.x = 0; @@ -1762,7 +1762,7 @@ void TBXR_WaitForSessionActive() static void TBXR_GetHMDOrientation() { - if (gAppState.PredictedDisplayTime == 0) + if (gAppState.FrameState.predictedDisplayTime == 0) { return; } @@ -1773,7 +1773,7 @@ static void TBXR_GetHMDOrientation() { // The better the prediction, the less black will be pulled in at the edges. XrSpaceLocation loc = {}; loc.type = XR_TYPE_SPACE_LOCATION; - OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.PredictedDisplayTime, &loc)); + OXR(xrLocateSpace(gAppState.HeadSpace, gAppState.CurrentSpace, gAppState.FrameState.predictedDisplayTime, &loc)); gAppState.xfStageFromHead = loc.pose; const XrQuaternionf quatHmd = gAppState.xfStageFromHead.orientation; @@ -1831,19 +1831,13 @@ void TBXR_FrameSetup() // NOTE: OpenXR does not use the concept of frame indices. Instead, // XrWaitFrame returns the predicted display time. - XrFrameWaitInfo waitFrameInfo = {}; - waitFrameInfo.type = XR_TYPE_FRAME_WAIT_INFO; - waitFrameInfo.next = NULL; + //XrFrameWaitInfo waitFrameInfo = {}; + //waitFrameInfo.type = XR_TYPE_FRAME_WAIT_INFO; + //waitFrameInfo.next = NULL; - XrFrameState frameState = {}; - frameState.type = XR_TYPE_FRAME_STATE; - frameState.next = NULL; - - OXR(xrWaitFrame(gAppState.Session, &waitFrameInfo, &frameState)); - gAppState.PredictedDisplayTime = frameState.predictedDisplayTime; - if (!frameState.shouldRender) { - return; - } + memset(&gAppState.FrameState, 0, sizeof(XrFrameState)); + gAppState.FrameState.type = XR_TYPE_FRAME_STATE; + OXR(xrWaitFrame(gAppState.Session, NULL, &gAppState.FrameState)); // Get the HMD pose, predicted for the middle of the time period during which // the new eye images will be displayed. The number of frames predicted ahead @@ -1923,7 +1917,7 @@ void TBXR_updateProjections() XrViewLocateInfo projectionInfo = {}; projectionInfo.type = XR_TYPE_VIEW_LOCATE_INFO; projectionInfo.viewConfigurationType = gAppState.ViewportConfig.viewConfigurationType; - projectionInfo.displayTime = gAppState.PredictedDisplayTime; + projectionInfo.displayTime = gAppState.FrameState.predictedDisplayTime; projectionInfo.space = gAppState.HeadSpace; XrViewState viewState = {XR_TYPE_VIEW_STATE, NULL}; @@ -2044,7 +2038,7 @@ void TBXR_submitFrame() XrFrameEndInfo endFrameInfo = {}; endFrameInfo.type = XR_TYPE_FRAME_END_INFO; - endFrameInfo.displayTime = gAppState.PredictedDisplayTime; + endFrameInfo.displayTime = gAppState.FrameState.predictedDisplayTime; endFrameInfo.environmentBlendMode = XR_ENVIRONMENT_BLEND_MODE_OPAQUE; endFrameInfo.layerCount = gAppState.LayerCount; endFrameInfo.layers = layers; diff --git a/Projects/Android/jni/JKVR/TBXR_Common.h b/Projects/Android/jni/JKVR/TBXR_Common.h index eb41788..f659fc9 100644 --- a/Projects/Android/jni/JKVR/TBXR_Common.h +++ b/Projects/Android/jni/JKVR/TBXR_Common.h @@ -245,7 +245,7 @@ typedef struct PFN_xrGetDisplayRefreshRateFB pfnGetDisplayRefreshRate; PFN_xrRequestDisplayRefreshRateFB pfnRequestDisplayRefreshRate; - XrTime PredictedDisplayTime; + XrFrameState FrameState; int SwapInterval; int MainThreadTid; int RenderThreadTid;