From b5e9618d8158ab759c248c03a8b7b5d89f6c9d07 Mon Sep 17 00:00:00 2001 From: Simon Date: Sun, 15 Jan 2023 15:44:20 +0000 Subject: [PATCH] Several Fixes - Allow super sampling - Fixes to haptic feedback - Default brightness on Pico to 1.4 --- .../jni/QuakeQuestSrc/OpenXrInput_MetaQuest.c | 17 ++++++++--------- .../jni/QuakeQuestSrc/OpenXrInput_PicoXR.c | 10 ++++------ .../jni/QuakeQuestSrc/QuakeQuest_OpenXR.c | 9 +++------ .../Android/jni/QuakeQuestSrc/TBXR_Common.c | 10 +++++----- .../Android/jni/QuakeQuestSrc/TBXR_Common.h | 3 +++ Projects/Android/jni/darkplaces/gl_rmain.c | 7 ++++++- 6 files changed, 29 insertions(+), 27 deletions(-) diff --git a/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_MetaQuest.c b/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_MetaQuest.c index 39b8c51..2d2bdfc 100644 --- a/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_MetaQuest.c +++ b/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_MetaQuest.c @@ -137,10 +137,6 @@ bool inputInitialized = false; bool useSimpleProfile = false; -//0 = left, 1 = right -float vibration_channel_duration[2] = {0.0f, 0.0f}; -float vibration_channel_intensity[2] = {0.0f, 0.0f}; - void TBXR_InitActions( void ) { // Actions @@ -440,21 +436,24 @@ void TBXR_UpdateControllers( ) rightTrackedRemoteState_new.Joystick.y = moveJoystickState.currentState.y; } +//0 = left, 1 = right +float vibration_channel_duration[2] = {0.0f, 0.0f}; +float vibration_channel_intensity[2] = {0.0f, 0.0f}; + void TBXR_Vibrate( int duration, int chan, float intensity ) { for (int i = 0; i < 2; ++i) { - int channel = 1-i; if ((i + 1) & chan) { - if (vibration_channel_duration[channel] > 0.0f) + if (vibration_channel_duration[i] > 0.0f) return; - if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f) + if (vibration_channel_duration[i] == -1.0f && duration != 0.0f) return; - vibration_channel_duration[channel] = duration; - vibration_channel_intensity[channel] = intensity; + vibration_channel_duration[i] = duration; + vibration_channel_intensity[i] = intensity; } } } diff --git a/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_PicoXR.c b/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_PicoXR.c index 667b3a8..2bca32b 100644 --- a/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_PicoXR.c +++ b/Projects/Android/jni/QuakeQuestSrc/OpenXrInput_PicoXR.c @@ -570,7 +570,6 @@ void TBXR_UpdateControllers( ) rightTrackedRemoteState_new.Joystick.y = moveJoystickState.currentState.y; } - //0 = left, 1 = right float vibration_channel_duration[2] = {0.0f, 0.0f}; float vibration_channel_intensity[2] = {0.0f, 0.0f}; @@ -579,17 +578,16 @@ void TBXR_Vibrate( int duration, int chan, float intensity ) { for (int i = 0; i < 2; ++i) { - int channel = 1-i; if ((i + 1) & chan) { - if (vibration_channel_duration[channel] > 0.0f) + if (vibration_channel_duration[i] > 0.0f) return; - if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f) + if (vibration_channel_duration[i] == -1.0f && duration != 0.0f) return; - vibration_channel_duration[channel] = duration; - vibration_channel_intensity[channel] = intensity; + vibration_channel_duration[i] = duration; + vibration_channel_intensity[i] = intensity; } } } diff --git a/Projects/Android/jni/QuakeQuestSrc/QuakeQuest_OpenXR.c b/Projects/Android/jni/QuakeQuestSrc/QuakeQuest_OpenXR.c index 132bde3..c862e61 100644 --- a/Projects/Android/jni/QuakeQuestSrc/QuakeQuest_OpenXR.c +++ b/Projects/Android/jni/QuakeQuestSrc/QuakeQuest_OpenXR.c @@ -451,11 +451,8 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f if ((timeNow - timeLastHaptic) > hapticInterval) { timeLastHaptic = timeNow; - TBXR_Vibrate(hapticLength, cl_righthanded.integer ? 1 : 0, hapticLevel); - if (weapon_stabilised) - { - TBXR_Vibrate(hapticLength, cl_righthanded.integer ? 0 : 1, hapticLevel); - } + int channel = weapon_stabilised ? 3 : (cl_righthanded.integer ? 2 : 1); + TBXR_Vibrate(hapticLength, channel, hapticLevel); } } } @@ -965,7 +962,7 @@ static void HandleInput_Default( ) //Vibrate to let user know they successfully saved SCR_CenterPrint("Quick Saved"); - TBXR_Vibrate(500, cl_righthanded.integer ? 0 : 1, 1.0); + TBXR_Vibrate(500, cl_righthanded.integer ? 1 : 2, 1.0); } if ((leftTrackedRemoteState_new.Buttons & xrButton_Y) && diff --git a/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.c b/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.c index 1bc809d..b68c196 100644 --- a/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.c +++ b/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.c @@ -50,7 +50,7 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR; //Let's go to the maximum! int NUM_MULTI_SAMPLES = 1; int REFRESH = 0; -float SS_MULTIPLIER = 0.0f; +float SS_MULTIPLIER = 1.5f; GLboolean stageSupported = GL_FALSE; @@ -1341,8 +1341,8 @@ void TBXR_InitialiseResolution() free(viewportConfigurationTypes); //Shortcut to width and height - gAppState.Width = gAppState.ViewConfigurationView[0].recommendedImageRectWidth; - gAppState.Height = gAppState.ViewConfigurationView[0].recommendedImageRectHeight; + gAppState.Width = gAppState.ViewConfigurationView[0].recommendedImageRectWidth * SS_MULTIPLIER; + gAppState.Height = gAppState.ViewConfigurationView[0].recommendedImageRectHeight * SS_MULTIPLIER; } void TBXR_EnterVR( ) { @@ -1533,8 +1533,8 @@ void TBXR_InitRenderer( ) { ovrRenderer_Create( gAppState.Session, &gAppState.Renderer, - gAppState.ViewConfigurationView[0].recommendedImageRectWidth, - gAppState.ViewConfigurationView[0].recommendedImageRectHeight); + gAppState.Width, + gAppState.Height); } void VR_DestroyRenderer( ) diff --git a/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.h b/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.h index 3074418..36f5add 100644 --- a/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.h +++ b/Projects/Android/jni/QuakeQuestSrc/TBXR_Common.h @@ -283,6 +283,9 @@ void * AppThreadFunction(void * parm ); void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject, jclass activityClass ); void ovrAppThread_Destroy( ovrAppThread * appThread, JNIEnv * env ); + +void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out); + /* * Surface Lifecycle Message Queue */ diff --git a/Projects/Android/jni/darkplaces/gl_rmain.c b/Projects/Android/jni/darkplaces/gl_rmain.c index 0d44fce..47607ca 100644 --- a/Projects/Android/jni/darkplaces/gl_rmain.c +++ b/Projects/Android/jni/darkplaces/gl_rmain.c @@ -126,7 +126,7 @@ cvar_t r_fakelight = {0, "r_fakelight","0", "render 'fake' lighting instead of r cvar_t r_fakelight_intensity = {0, "r_fakelight_intensity","0.75", "fakelight intensity modifier"}; #define FAKELIGHT_ENABLED (r_fakelight.integer >= 2 || (r_fakelight.integer && r_refdef.scene.worldmodel && !r_refdef.scene.worldmodel->lit)) -cvar_t r_lasersight = {CVAR_SAVE, "r_lasersight", "0","Whether laser sight aim is used"}; +cvar_t r_lasersight = {CVAR_SAVE, "r_lasersight", "2","Whether laser sight aim is used"}; cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","0.7", "opacity of water polygons"}; cvar_t r_dynamic = {CVAR_SAVE, "r_dynamic","1", "enables dynamic lights (rocket glow and such)"}; @@ -226,7 +226,12 @@ cvar_t r_bloom_colorexponent = {CVAR_SAVE, "r_bloom_colorexponent", "1", "how ex cvar_t r_bloom_colorsubtract = {CVAR_SAVE, "r_bloom_colorsubtract", "0.125", "reduces bloom colors by a certain amount"}; cvar_t r_bloom_scenebrightness = {CVAR_SAVE, "r_bloom_scenebrightness", "1", "global rendering brightness when bloom is enabled"}; +#ifdef META_QUEST cvar_t r_hdr_scenebrightness = {CVAR_SAVE, "r_hdr_scenebrightness", "1", "global rendering brightness"}; +#endif +#ifdef PICO_XR +cvar_t r_hdr_scenebrightness = {CVAR_SAVE, "r_hdr_scenebrightness", "1.4", "global rendering brightness"}; +#endif cvar_t r_hdr_glowintensity = {CVAR_SAVE, "r_hdr_glowintensity", "1", "how bright light emitting textures should appear"}; cvar_t r_hdr_irisadaptation = {CVAR_SAVE, "r_hdr_irisadaptation", "0", "adjust scene brightness according to light intensity at player location"}; cvar_t r_hdr_irisadaptation_multiplier = {CVAR_SAVE, "r_hdr_irisadaptation_multiplier", "2", "brightness at which value will be 1.0"};