mirror of
https://github.com/DrBeef/JKXR.git
synced 2024-11-21 11:41:05 +00:00
Configurable super sampling for PCVR (untested\!)
This commit is contained in:
parent
b0ceacda6f
commit
0e58a043ac
6 changed files with 39 additions and 12 deletions
|
@ -280,6 +280,7 @@ void VR_Init()
|
|||
vr_use_gesture_boundary = Cvar_Get ("vr_use_gesture_boundary", "0.35", CVAR_ARCHIVE);
|
||||
vr_align_weapons = Cvar_Get ("vr_align_weapons", "0", CVAR_ARCHIVE);
|
||||
vr_refresh = Cvar_Get ("vr_refresh", "72", CVAR_ARCHIVE);
|
||||
vr_super_sampling = Cvar_Get ("vr_super_sampling", "1.0", CVAR_ARCHIVE);
|
||||
|
||||
cvar_t *expanded_menu_enabled = Cvar_Get ("expanded_menu_enabled", "0", CVAR_ARCHIVE);
|
||||
if (FS_FileExists("expanded_menu.pk3") || FS_BaseFileExists("expanded_menu.pk3")) {
|
||||
|
|
|
@ -17,6 +17,10 @@
|
|||
|
||||
const float ZOOM_FOV_ADJUST = 1.1f;
|
||||
|
||||
float superSampling = 1.0f;
|
||||
qboolean usingScreenLayer = qtrue;
|
||||
qboolean resetScreenLayerRenderer = qfalse;
|
||||
|
||||
const char* const requiredExtensionNames[] = {
|
||||
XR_KHR_OPENGL_ENABLE_EXTENSION_NAME};
|
||||
|
||||
|
@ -671,8 +675,15 @@ bool destroyed = qfalse;
|
|||
|
||||
void TBXR_GetScreenRes(int *width, int *height)
|
||||
{
|
||||
*width = gAppState.Width;
|
||||
*height = gAppState.Height;
|
||||
float configuredSuperSampling = Cvar_VariableValue("vr_super_sampling");
|
||||
if (configuredSuperSampling != 0.0f && configuredSuperSampling != superSampling) {
|
||||
superSampling = configuredSuperSampling;
|
||||
resetScreenLayerRenderer = qtrue;
|
||||
Cbuf_AddText( "vid_restart\n" );
|
||||
}
|
||||
|
||||
*width = gAppState.Width * superSampling;
|
||||
*height = gAppState.Height * superSampling;
|
||||
}
|
||||
|
||||
XrInstance TBXR_GetXrInstance() {
|
||||
|
@ -831,11 +842,14 @@ void TBXR_InitRenderer( ) {
|
|||
gAppState.Views[eye].type = XR_TYPE_VIEW;
|
||||
}
|
||||
|
||||
int eyeW, eyeH;
|
||||
TBXR_GetScreenRes(&eyeW, &eyeH);
|
||||
|
||||
ovrRenderer_Create(
|
||||
gAppState.Session,
|
||||
&gAppState.Renderer,
|
||||
gAppState.ViewConfigurationView[0].recommendedImageRectWidth,
|
||||
gAppState.ViewConfigurationView[0].recommendedImageRectHeight);
|
||||
eyeW,
|
||||
eyeH);
|
||||
}
|
||||
|
||||
void VR_DestroyRenderer( )
|
||||
|
@ -844,6 +858,13 @@ void VR_DestroyRenderer( )
|
|||
free(gAppState.Views);
|
||||
}
|
||||
|
||||
void VR_ResetRenderer()
|
||||
{
|
||||
VR_DestroyRenderer();
|
||||
TBXR_InitialiseResolution();
|
||||
TBXR_InitRenderer();
|
||||
}
|
||||
|
||||
void TBXR_InitialiseOpenXR()
|
||||
{
|
||||
// Create the OpenXR instance.
|
||||
|
@ -1170,6 +1191,12 @@ void TBXR_submitFrame()
|
|||
|
||||
if (!VR_UseScreenLayer())
|
||||
{
|
||||
|
||||
if (usingScreenLayer) {
|
||||
usingScreenLayer = qfalse;
|
||||
VR_ResetRenderer();
|
||||
}
|
||||
|
||||
memset(&projection_layer, 0, sizeof(XrCompositionLayerProjection));
|
||||
projection_layer.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION;
|
||||
projection_layer.layerFlags = XR_COMPOSITION_LAYER_BLEND_TEXTURE_SOURCE_ALPHA_BIT;
|
||||
|
@ -1203,6 +1230,13 @@ void TBXR_submitFrame()
|
|||
}
|
||||
else
|
||||
{
|
||||
|
||||
usingScreenLayer = qtrue;
|
||||
if (resetScreenLayerRenderer) {
|
||||
resetScreenLayerRenderer = qfalse;
|
||||
VR_ResetRenderer();
|
||||
}
|
||||
|
||||
//Empty black projection for now
|
||||
memset(&projection_layer, 0, sizeof(XrCompositionLayerProjection));
|
||||
projection_layer.type = XR_TYPE_COMPOSITION_LAYER_PROJECTION;
|
||||
|
|
|
@ -1089,8 +1089,6 @@
|
|||
cvarFloatList { "0.8" 0.8 "0.9" 0.9 "1.0" 1.0 "1.1" 1.1 "1.2" 1.2 "1.3" 1.3 }
|
||||
descText @MENUS_VR_SUPER_SAMPLING_DESC
|
||||
cvar "vr_super_sampling"
|
||||
cvarTest openXRHMD
|
||||
showCvar { meta }
|
||||
|
||||
visible 0
|
||||
|
||||
|
|
|
@ -1096,8 +1096,6 @@
|
|||
cvarFloatList { "0.8" 0.8 "0.9" 0.9 "1.0" 1.0 "1.1" 1.1 "1.2" 1.2 "1.3" 1.3 }
|
||||
descText @MENUS_VR_SUPER_SAMPLING_DESC
|
||||
cvar "vr_super_sampling"
|
||||
cvarTest openXRHMD
|
||||
showCvar { meta }
|
||||
|
||||
visible 0
|
||||
|
||||
|
|
|
@ -1293,8 +1293,6 @@
|
|||
cvarFloatList { "0.8" 0.8 "0.9" 0.9 "1.0" 1.0 "1.1" 1.1 "1.2" 1.2 "1.3" 1.3 }
|
||||
descText @MENUS_VR_SUPER_SAMPLING_DESC
|
||||
cvar "vr_super_sampling"
|
||||
cvarTest openXRHMD
|
||||
showCvar { meta }
|
||||
|
||||
visible 0
|
||||
|
||||
|
|
|
@ -1392,8 +1392,6 @@
|
|||
cvarFloatList { "0.8" 0.8 "0.9" 0.9 "1.0" 1.0 "1.1" 1.1 "1.2" 1.2 "1.3" 1.3 }
|
||||
descText @MENUS_VR_SUPER_SAMPLING_DESC
|
||||
cvar "vr_super_sampling"
|
||||
cvarTest openXRHMD
|
||||
showCvar { meta }
|
||||
|
||||
visible 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue