mirror of
https://github.com/DrBeef/RTCWQuest.git
synced 2025-04-22 23:11:02 +00:00
Configurable refresh rate
This commit is contained in:
parent
7d9be84f1c
commit
f974c1d581
7 changed files with 65 additions and 18 deletions
|
@ -1508,6 +1508,7 @@ void RTCWVR_Init()
|
|||
vr_irl_crouch_to_stand_ratio = Cvar_Get ("vr_irl_crouch_to_stand_ratio", "0.65", CVAR_ARCHIVE);
|
||||
vr_haptic_intensity = Cvar_Get ("vr_haptic_intensity", "1.0", CVAR_ARCHIVE);
|
||||
vr_menu_item_touched = Cvar_Get ("vr_menu_item_touched", "0", CVAR_TEMP);
|
||||
vr_refresh = Cvar_Get ("vr_refresh", "72", CVAR_ARCHIVE);
|
||||
|
||||
//Defaults
|
||||
vr_control_scheme = Cvar_Get( "vr_control_scheme", "0", CVAR_ARCHIVE);
|
||||
|
@ -1649,6 +1650,14 @@ int GetRefresh()
|
|||
return vrapi_GetSystemPropertyInt(&java, VRAPI_SYS_PROP_DISPLAY_REFRESH_RATE);
|
||||
}
|
||||
|
||||
int GetRequestedRefresh() {
|
||||
float refresh = Cvar_VariableValue("vr_refresh");
|
||||
if (!refresh) {
|
||||
refresh = REFRESH;
|
||||
}
|
||||
return refresh;
|
||||
}
|
||||
|
||||
void * AppThreadFunction(void * parm ) {
|
||||
gAppThread = (ovrAppThread *) parm;
|
||||
|
||||
|
@ -1783,7 +1792,7 @@ void RTCWVR_FrameSetup()
|
|||
vrapi_SetTrackingSpace(gAppState.Ovr, VRAPI_TRACKING_SPACE_LOCAL_FLOOR);
|
||||
|
||||
//Set framerate so VrApi doesn't change it on us..
|
||||
vrapi_SetDisplayRefreshRate(gAppState.Ovr, REFRESH);
|
||||
vrapi_SetDisplayRefreshRate(gAppState.Ovr, GetRequestedRefresh());
|
||||
|
||||
vrapi_SetExtraLatencyMode(gAppState.Ovr, VRAPI_EXTRA_LATENCY_MODE_ON);
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ void QuatToYawPitchRoll(ovrQuatf q, vec3_t rotation, vec3_t out);
|
|||
void handleTrackedControllerButton(ovrInputStateTrackedRemote * trackedRemoteState, ovrInputStateTrackedRemote * prevTrackedRemoteState, uint32_t button, int key);
|
||||
void interactWithTouchScreen(float menuYaw, vec3_t controllerAngles);
|
||||
int GetRefresh();
|
||||
int GetRequestedRefresh();
|
||||
|
||||
//Called from engine code
|
||||
qboolean RTCWVR_useScreenLayer();
|
||||
|
|
|
@ -20,3 +20,4 @@ cvar_t *vr_irl_crouch_enabled;
|
|||
cvar_t *vr_irl_crouch_to_stand_ratio;
|
||||
cvar_t *vr_haptic_intensity;
|
||||
cvar_t *vr_menu_item_touched;
|
||||
cvar_t *vr_refresh;
|
||||
|
|
|
@ -538,12 +538,13 @@ void HandleInput_Default( ovrInputStateGamepad *pFootTrackingNew, ovrInputStateG
|
|||
//Positional movement speed correction for when we are not hitting target framerate
|
||||
static double lastframetime = 0;
|
||||
int refresh = GetRefresh();
|
||||
int requestedRefresh = GetRequestedRefresh();
|
||||
double newframetime = GetTimeInMilliSeconds();
|
||||
float multiplier = (float)((1000.0 / refresh) / (newframetime - lastframetime));
|
||||
lastframetime = newframetime;
|
||||
|
||||
vec2_t v;
|
||||
float factor = (refresh / 72.0F) * vr_positional_factor->value; // adjust positional factor based on refresh rate
|
||||
float factor = (refresh / requestedRefresh) * vr_positional_factor->value; // adjust positional factor based on refresh rate
|
||||
rotateAboutOrigin(-vr.hmdposition_delta[0] * factor * multiplier,
|
||||
vr.hmdposition_delta[2] * factor * multiplier, - vr.hmdorientation[YAW], v);
|
||||
positional_movementSideways = v[0];
|
||||
|
|
|
@ -2275,6 +2275,7 @@ Com_Frame
|
|||
=================
|
||||
*/
|
||||
int GetRefresh();
|
||||
int GetRequestedRefresh();
|
||||
void Com_Frame( void ) {
|
||||
|
||||
int msec, minMsec;
|
||||
|
|
|
@ -69,6 +69,23 @@ itemDef {
|
|||
mouseExit { setitemcolor ctr_graphics backcolor .37 .1 .1 1 }
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name graphics
|
||||
group grpSystem
|
||||
type ITEM_TYPE_MULTI
|
||||
text "Refresh Rate:"
|
||||
cvar "vr_refresh"
|
||||
cvarFloatList { "72" 72 "80" 80 "90" 90 "120" 120 }
|
||||
rect 82 30 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .22
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name graphics
|
||||
|
@ -77,7 +94,7 @@ itemDef {
|
|||
text "Anisotropic Filter Level:"
|
||||
cvar "r_ext_texture_filter_anisotropic"
|
||||
cvarFloatList { "1" 1 "2" 2 "4" 4 "8" 8 "16" 16 }
|
||||
rect 82 30 290 12
|
||||
rect 82 60 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -96,7 +113,7 @@ itemDef {
|
|||
text "Lighting:"
|
||||
cvar "r_vertexlight"
|
||||
cvarFloatList { "Light Map (high)" 0 "Vertex (low)" 1 }
|
||||
rect 82 45 290 12
|
||||
rect 82 75 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -115,7 +132,7 @@ itemDef {
|
|||
text "Geometric Detail:"
|
||||
cvar "r_lodbias"
|
||||
cvarFloatList { "High" 0 "Medium" 1 "Low" 2 }
|
||||
rect 82 60 290 12
|
||||
rect 82 90 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -134,7 +151,7 @@ itemDef {
|
|||
text "General Textures:"
|
||||
cvar "r_picmip"
|
||||
cvarFloatList { "Low" 2 "Normal" 1 "High" 0 }
|
||||
rect 82 75 290 12
|
||||
rect 82 105 290 12
|
||||
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
|
@ -154,7 +171,7 @@ itemDef {
|
|||
text "Character Textures:"
|
||||
cvar "r_picmip2"
|
||||
cvarFloatList { "Low" 3 "Normal" 2 "High" 1 "Extra" 0 }
|
||||
rect 82 90 290 12
|
||||
rect 82 120 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -173,7 +190,7 @@ itemDef {
|
|||
text "Texture Filter:"
|
||||
cvar "r_textureMode"
|
||||
cvarStrList { "No filter", "GL_NEAREST", "Bilinear (no mipmap)", "GL_LINEAR", "Bilinear", "GL_LINEAR_MIPMAP_NEAREST", "Trilinear", "GL_LINEAR_MIPMAP_LINEAR" }
|
||||
rect 82 105 290 12
|
||||
rect 82 135 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -191,7 +208,7 @@ itemDef {
|
|||
type ITEM_TYPE_YESNO
|
||||
text "Compress Textures:"
|
||||
cvar "r_ext_compressed_textures"
|
||||
rect 82 120 290 12
|
||||
rect 82 150 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -212,7 +229,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "Brightness:"
|
||||
cvarfloat "r_gamma" 1 0.5 3
|
||||
rect 82 135 290 12
|
||||
rect 82 165 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
|
|
@ -87,6 +87,23 @@ itemDef {
|
|||
decoration
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name graphics
|
||||
group grpSystem
|
||||
type ITEM_TYPE_MULTI
|
||||
text "Refresh Rate:"
|
||||
cvar "vr_refresh"
|
||||
cvarFloatList { "72" 72 "80" 80 "90" 90 "120" 120 }
|
||||
rect 82 30 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
textscale .22
|
||||
style WINDOW_STYLE_FILLED
|
||||
backcolor 1 1 1 .07
|
||||
forecolor 1 1 1 1
|
||||
visible 0
|
||||
}
|
||||
|
||||
itemDef {
|
||||
name graphics
|
||||
|
@ -95,7 +112,7 @@ itemDef {
|
|||
text "Anisotropic Filter Level:"
|
||||
cvar "r_ext_texture_filter_anisotropic"
|
||||
cvarFloatList { "1" 1 "2" 2 "4" 4 "8" 8 "16" 16 }
|
||||
rect 82 30 290 12
|
||||
rect 82 60 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -114,7 +131,7 @@ itemDef {
|
|||
text "Lighting:"
|
||||
cvar "r_vertexlight"
|
||||
cvarFloatList { "Light Map (high)" 0 "Vertex (low)" 1 }
|
||||
rect 82 45 290 12
|
||||
rect 82 75 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -133,7 +150,7 @@ itemDef {
|
|||
text "Geometric Detail:"
|
||||
cvar "r_lodbias"
|
||||
cvarFloatList { "High" 0 "Medium" 1 "Low" 2 }
|
||||
rect 82 60 290 12
|
||||
rect 82 90 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -152,7 +169,7 @@ itemDef {
|
|||
text "Character Textures:"
|
||||
cvar "r_picmip2"
|
||||
cvarFloatList { "Low" 3 "Normal" 2 "High" 1 "Extra" 0 }
|
||||
rect 82 75 290 12
|
||||
rect 82 105 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -171,7 +188,7 @@ itemDef {
|
|||
text "General Textures:"
|
||||
cvar "r_picmip"
|
||||
cvarFloatList { "Low" 2 "Normal" 1 "High" 0 }
|
||||
rect 82 90 290 12
|
||||
rect 82 120 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -190,7 +207,7 @@ itemDef {
|
|||
text "Texture Filter:"
|
||||
cvar "r_textureMode"
|
||||
cvarStrList { "No filter", "GL_NEAREST", "Bilinear (no mipmap)", "GL_LINEAR", "Bilinear", "GL_LINEAR_MIPMAP_NEAREST", "Trilinear", "GL_LINEAR_MIPMAP_LINEAR" }
|
||||
rect 82 105 290 12
|
||||
rect 82 135 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -208,7 +225,7 @@ itemDef {
|
|||
type ITEM_TYPE_YESNO
|
||||
text "Compress Textures:"
|
||||
cvar "r_ext_compressed_textures"
|
||||
rect 82 120 290 12
|
||||
rect 82 150 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
@ -226,7 +243,7 @@ itemDef {
|
|||
type ITEM_TYPE_SLIDER
|
||||
text "Brightness:"
|
||||
cvarfloat "r_gamma" 1 0.5 3
|
||||
rect 82 135 290 12
|
||||
rect 82 165 290 12
|
||||
textalign ITEM_ALIGN_RIGHT
|
||||
textalignx 142
|
||||
textaligny 10
|
||||
|
|
Loading…
Reference in a new issue