Several Fixes

- Allow super sampling
- Fixes to haptic feedback
- Default brightness on Pico to 1.4
This commit is contained in:
Simon 2023-01-15 15:44:20 +00:00
parent 44cd598e2b
commit b5e9618d81
6 changed files with 29 additions and 27 deletions

View file

@ -137,10 +137,6 @@ bool inputInitialized = false;
bool useSimpleProfile = 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 ) void TBXR_InitActions( void )
{ {
// Actions // Actions
@ -440,21 +436,24 @@ void TBXR_UpdateControllers( )
rightTrackedRemoteState_new.Joystick.y = moveJoystickState.currentState.y; 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 ) void TBXR_Vibrate( int duration, int chan, float intensity )
{ {
for (int i = 0; i < 2; ++i) for (int i = 0; i < 2; ++i)
{ {
int channel = 1-i;
if ((i + 1) & chan) if ((i + 1) & chan)
{ {
if (vibration_channel_duration[channel] > 0.0f) if (vibration_channel_duration[i] > 0.0f)
return; return;
if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f) if (vibration_channel_duration[i] == -1.0f && duration != 0.0f)
return; return;
vibration_channel_duration[channel] = duration; vibration_channel_duration[i] = duration;
vibration_channel_intensity[channel] = intensity; vibration_channel_intensity[i] = intensity;
} }
} }
} }

View file

@ -570,7 +570,6 @@ void TBXR_UpdateControllers( )
rightTrackedRemoteState_new.Joystick.y = moveJoystickState.currentState.y; rightTrackedRemoteState_new.Joystick.y = moveJoystickState.currentState.y;
} }
//0 = left, 1 = right //0 = left, 1 = right
float vibration_channel_duration[2] = {0.0f, 0.0f}; float vibration_channel_duration[2] = {0.0f, 0.0f};
float vibration_channel_intensity[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) for (int i = 0; i < 2; ++i)
{ {
int channel = 1-i;
if ((i + 1) & chan) if ((i + 1) & chan)
{ {
if (vibration_channel_duration[channel] > 0.0f) if (vibration_channel_duration[i] > 0.0f)
return; return;
if (vibration_channel_duration[channel] == -1.0f && duration != 0.0f) if (vibration_channel_duration[i] == -1.0f && duration != 0.0f)
return; return;
vibration_channel_duration[channel] = duration; vibration_channel_duration[i] = duration;
vibration_channel_intensity[channel] = intensity; vibration_channel_intensity[i] = intensity;
} }
} }
} }

View file

@ -451,11 +451,8 @@ void VR_HapticEvent(const char* event, int position, int flags, int intensity, f
if ((timeNow - timeLastHaptic) > hapticInterval) if ((timeNow - timeLastHaptic) > hapticInterval)
{ {
timeLastHaptic = timeNow; timeLastHaptic = timeNow;
TBXR_Vibrate(hapticLength, cl_righthanded.integer ? 1 : 0, hapticLevel); int channel = weapon_stabilised ? 3 : (cl_righthanded.integer ? 2 : 1);
if (weapon_stabilised) TBXR_Vibrate(hapticLength, channel, hapticLevel);
{
TBXR_Vibrate(hapticLength, cl_righthanded.integer ? 0 : 1, hapticLevel);
}
} }
} }
} }
@ -965,7 +962,7 @@ static void HandleInput_Default( )
//Vibrate to let user know they successfully saved //Vibrate to let user know they successfully saved
SCR_CenterPrint("Quick 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) && if ((leftTrackedRemoteState_new.Buttons & xrButton_Y) &&

View file

@ -50,7 +50,7 @@ PFNEGLGETSYNCATTRIBKHRPROC eglGetSyncAttribKHR;
//Let's go to the maximum! //Let's go to the maximum!
int NUM_MULTI_SAMPLES = 1; int NUM_MULTI_SAMPLES = 1;
int REFRESH = 0; int REFRESH = 0;
float SS_MULTIPLIER = 0.0f; float SS_MULTIPLIER = 1.5f;
GLboolean stageSupported = GL_FALSE; GLboolean stageSupported = GL_FALSE;
@ -1341,8 +1341,8 @@ void TBXR_InitialiseResolution()
free(viewportConfigurationTypes); free(viewportConfigurationTypes);
//Shortcut to width and height //Shortcut to width and height
gAppState.Width = gAppState.ViewConfigurationView[0].recommendedImageRectWidth; gAppState.Width = gAppState.ViewConfigurationView[0].recommendedImageRectWidth * SS_MULTIPLIER;
gAppState.Height = gAppState.ViewConfigurationView[0].recommendedImageRectHeight; gAppState.Height = gAppState.ViewConfigurationView[0].recommendedImageRectHeight * SS_MULTIPLIER;
} }
void TBXR_EnterVR( ) { void TBXR_EnterVR( ) {
@ -1533,8 +1533,8 @@ void TBXR_InitRenderer( ) {
ovrRenderer_Create( ovrRenderer_Create(
gAppState.Session, gAppState.Session,
&gAppState.Renderer, &gAppState.Renderer,
gAppState.ViewConfigurationView[0].recommendedImageRectWidth, gAppState.Width,
gAppState.ViewConfigurationView[0].recommendedImageRectHeight); gAppState.Height);
} }
void VR_DestroyRenderer( ) void VR_DestroyRenderer( )

View file

@ -283,6 +283,9 @@ void * AppThreadFunction(void * parm );
void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject, jclass activityClass ); void ovrAppThread_Create( ovrAppThread * appThread, JNIEnv * env, jobject activityObject, jclass activityClass );
void ovrAppThread_Destroy( ovrAppThread * appThread, JNIEnv * env ); void ovrAppThread_Destroy( ovrAppThread * appThread, JNIEnv * env );
void QuatToYawPitchRoll(XrQuaternionf q, vec3_t rotation, vec3_t out);
/* /*
* Surface Lifecycle Message Queue * Surface Lifecycle Message Queue
*/ */

View file

@ -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"}; 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)) #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_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)"}; 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_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"}; 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"}; 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_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 = {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"}; cvar_t r_hdr_irisadaptation_multiplier = {CVAR_SAVE, "r_hdr_irisadaptation_multiplier", "2", "brightness at which value will be 1.0"};