OpenXR - Make VR camera parameters floating numbers

This commit is contained in:
Lubos 2022-10-28 14:59:12 +02:00
parent 0bfab4cd81
commit f4f7dc570f
5 changed files with 13 additions and 13 deletions

View file

@ -319,9 +319,9 @@ bool StartVRRender() {
// Set customizations
VR_SetConfig(VR_CONFIG_6DOF_ENABLED, g_Config.bEnable6DoF);
VR_SetConfig(VR_CONFIG_CAMERA_DISTANCE, g_Config.iCameraDistance);
VR_SetConfig(VR_CONFIG_CANVAS_DISTANCE, g_Config.iCanvasDistance);
VR_SetConfig(VR_CONFIG_FOV_SCALE, g_Config.iFieldOfViewPercentage);
VR_SetConfig(VR_CONFIG_CAMERA_DISTANCE, g_Config.fCameraDistance * 1000);
VR_SetConfig(VR_CONFIG_CANVAS_DISTANCE, g_Config.fCanvasDistance);
VR_SetConfig(VR_CONFIG_FOV_SCALE, g_Config.fFieldOfViewPercentage);
VR_SetConfig(VR_CONFIG_MIRROR_UPDATED, false);
return true;
}

View file

@ -339,7 +339,7 @@ bool VR_InitFrame( engine_t* engine ) {
vrMatrix[matrix].M[2][3] -= hmdposition.z * (vrConfig[VR_CONFIG_MIRROR_AXIS_Z] ? -1.0f : 1.0f) * scale;
}
if (abs(vrConfig[VR_CONFIG_CAMERA_DISTANCE]) > 0) {
XrVector3f forward = {0.0f, 0.0f, (float)vrConfig[VR_CONFIG_CAMERA_DISTANCE] * scale};
XrVector3f forward = {0.0f, 0.0f, (float)vrConfig[VR_CONFIG_CAMERA_DISTANCE] * 0.001f * scale};
forward = XrQuaternionf_Rotate(invView.orientation, forward);
forward = XrVector3f_ScalarMultiply(forward, vrConfig[VR_CONFIG_MIRROR_AXIS_Z] ? -1.0f : 1.0f);
vrMatrix[matrix].M[0][3] += forward.x;

View file

@ -1208,9 +1208,9 @@ static ConfigSetting vrSettings[] = {
ConfigSetting("VREnable", &g_Config.bEnableVR, true),
ConfigSetting("VREnable6DoF", &g_Config.bEnable6DoF, true),
ConfigSetting("VREnableStereo", &g_Config.bEnableStereo, false),
ConfigSetting("VRCameraDistance", &g_Config.iCameraDistance, 0),
ConfigSetting("VRCanvasDistance", &g_Config.iCanvasDistance, 6),
ConfigSetting("VRFieldOfView", &g_Config.iFieldOfViewPercentage, 100),
ConfigSetting("VRCameraDistance", &g_Config.fCameraDistance, 0.0f),
ConfigSetting("VRCanvasDistance", &g_Config.fCanvasDistance, 6.0f),
ConfigSetting("VRFieldOfView", &g_Config.fFieldOfViewPercentage, 100.0f),
ConfigSetting(false),
};

View file

@ -463,9 +463,9 @@ public:
bool bEnableVR;
bool bEnable6DoF;
bool bEnableStereo;
int iCameraDistance;
int iCanvasDistance;
int iFieldOfViewPercentage;
float fCameraDistance;
float fCanvasDistance;
float fFieldOfViewPercentage;
// Debugger
int iDisasmWindowX;

View file

@ -1165,9 +1165,9 @@ void GameSettingsScreen::CreateViews() {
vrStereo->SetEnabledPtr(&g_Config.bEnableVR);
vrSettings->Add(new ItemHeader(vr->T("VR camera")));
vrSettings->Add(new PopupSliderChoice(&g_Config.iCameraDistance, -10, 10, vr->T("Camera distance adjust", "Camera distance adjust"), 1, screenManager(), ""));
vrSettings->Add(new PopupSliderChoice(&g_Config.iCanvasDistance, 1, 10, vr->T("Distance to 2D menus and scenes", "Distance to 2D menus and scenes"), 1, screenManager(), ""));
vrSettings->Add(new PopupSliderChoice(&g_Config.iFieldOfViewPercentage, 100, 200, vr->T("Field of view scale", "Headset's field of view scale"), 10, screenManager(), vr->T("% of native FoV")));
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCameraDistance, -10.0f, 10.0f, vr->T("Camera distance adjust", "Camera distance adjust"), 1.0f, screenManager(), ""));
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCanvasDistance, 1.0f, 10.0f, vr->T("Distance to 2D menus and scenes", "Distance to 2D menus and scenes"), 1.0f, screenManager(), ""));
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fFieldOfViewPercentage, 100.0f, 200.0f, vr->T("Field of view scale", "Headset's field of view scale"), 10.0f, screenManager(), vr->T("% of native FoV")));
}
}