OpenXR - Enhancements of cinema-style screen
This commit is contained in:
parent
f3d95a2cef
commit
dd00dfefab
6 changed files with 25 additions and 14 deletions
|
@ -387,9 +387,15 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
|
|||
g_Config.fCameraHeight = clampFloat(g_Config.fCameraHeight, -150.0f, 150.0f);
|
||||
break;
|
||||
case JOYSTICK_AXIS_Z:
|
||||
if (g_Config.bEnableVR) {
|
||||
if (axis.second < -0.75f) g_Config.fHeadUpDisplayScale -= 0.01f;
|
||||
if (axis.second > 0.75f) g_Config.fHeadUpDisplayScale += 0.01f;
|
||||
g_Config.fHeadUpDisplayScale = clampFloat(g_Config.fHeadUpDisplayScale, 0.0f, 1.5f);
|
||||
} else {
|
||||
if (axis.second < -0.75f) g_Config.fCanvas3DDistance += 0.1f;
|
||||
if (axis.second > 0.75f) g_Config.fCanvas3DDistance -= 0.1f;
|
||||
g_Config.fCanvas3DDistance = clampFloat(g_Config.fCanvas3DDistance, 1.0f, 15.0f);
|
||||
}
|
||||
break;
|
||||
case JOYSTICK_AXIS_RZ:
|
||||
if (axis.second > 0.75f) g_Config.fCameraDistance -= 0.1f;
|
||||
|
@ -432,6 +438,7 @@ void UpdateVRInput(bool haptics, float dp_xscale, float dp_yscale) {
|
|||
VR_SetConfig(VR_CONFIG_MOUSE_X, (int)x);
|
||||
VR_SetConfig(VR_CONFIG_MOUSE_Y, (int)y);
|
||||
VR_SetConfig(VR_CONFIG_MOUSE_SIZE, 6 * (int)pow(VR_GetConfigFloat(VR_CONFIG_CANVAS_DISTANCE), 0.25f));
|
||||
VR_SetConfig(VR_CONFIG_CANVAS_6DOF, g_Config.bEnable6DoF);
|
||||
|
||||
//inform engine about the status
|
||||
TouchInput touch;
|
||||
|
@ -526,6 +533,7 @@ bool UpdateVRKeys(const KeyInput &key) {
|
|||
|
||||
// Reset camera adjust
|
||||
if (pspKeys[VIRTKEY_VR_CAMERA_ADJUST] && pspKeys[VIRTKEY_VR_CAMERA_RESET]) {
|
||||
g_Config.fCanvas3DDistance = 3.0f;
|
||||
g_Config.fCameraHeight = 0;
|
||||
g_Config.fCameraSide = 0;
|
||||
g_Config.fCameraDistance = 0;
|
||||
|
@ -672,7 +680,7 @@ bool StartVRRender() {
|
|||
|
||||
// Set customizations
|
||||
__DisplaySetFramerate(g_Config.bForce72Hz ? 72 : 60);
|
||||
VR_SetConfigFloat(VR_CONFIG_CANVAS_DISTANCE, g_Config.fCanvasDistance);
|
||||
VR_SetConfigFloat(VR_CONFIG_CANVAS_DISTANCE, vrScene && (appMode == VR_GAME_MODE) ? g_Config.fCanvas3DDistance : g_Config.fCanvasDistance);
|
||||
VR_SetConfig(VR_CONFIG_PASSTHROUGH, g_Config.bPassthrough);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -428,14 +428,15 @@ void VR_FinishFrame( engine_t* engine ) {
|
|||
} else if ((vrMode == VR_MODE_MONO_SCREEN) || (vrMode == VR_MODE_STEREO_SCREEN)) {
|
||||
|
||||
// Flat screen pose
|
||||
float distance = VR_GetConfigFloat(VR_CONFIG_CANVAS_DISTANCE);
|
||||
float distance = VR_GetConfigFloat(VR_CONFIG_CANVAS_DISTANCE) / 4.0f - 1.0f;
|
||||
float menuPitch = ToRadians(VR_GetConfigFloat(VR_CONFIG_MENU_PITCH));
|
||||
float menuYaw = ToRadians(VR_GetConfigFloat(VR_CONFIG_MENU_YAW));
|
||||
XrVector3f pos = {
|
||||
invViewTransform[0].position.x - sinf(menuYaw) * distance,
|
||||
invViewTransform[0].position.y,
|
||||
invViewTransform[0].position.z - cosf(menuYaw) * distance
|
||||
};
|
||||
XrVector3f pos = {-sinf(menuYaw) * distance, 0, -cosf(menuYaw) * distance};
|
||||
if (!VR_GetConfig(VR_CONFIG_CANVAS_6DOF)) {
|
||||
pos.x += invViewTransform[0].position.x;
|
||||
pos.y += invViewTransform[0].position.y;
|
||||
pos.z += invViewTransform[0].position.z;
|
||||
}
|
||||
XrQuaternionf pitch = XrQuaternionf_CreateFromVectorAngle({1, 0, 0}, -menuPitch);
|
||||
XrQuaternionf yaw = XrQuaternionf_CreateFromVectorAngle({0, 1, 0}, menuYaw);
|
||||
|
||||
|
@ -453,7 +454,7 @@ void VR_FinishFrame( engine_t* engine ) {
|
|||
cylinder_layer.subImage.imageArrayIndex = 0;
|
||||
cylinder_layer.pose.orientation = XrQuaternionf_Multiply(pitch, yaw);
|
||||
cylinder_layer.pose.position = pos;
|
||||
cylinder_layer.radius = 12.0f;
|
||||
cylinder_layer.radius = 2.0f;
|
||||
cylinder_layer.centralAngle = (float)(M_PI * 0.5);
|
||||
cylinder_layer.aspectRatio = VR_GetConfigFloat(VR_CONFIG_CANVAS_ASPECT);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
enum VRConfig {
|
||||
//switching between mode
|
||||
VR_CONFIG_MODE, VR_CONFIG_PASSTHROUGH,
|
||||
VR_CONFIG_MODE, VR_CONFIG_PASSTHROUGH, VR_CONFIG_CANVAS_6DOF,
|
||||
//mouse cursor
|
||||
VR_CONFIG_MOUSE_SIZE, VR_CONFIG_MOUSE_X, VR_CONFIG_MOUSE_Y,
|
||||
//viewport setup
|
||||
|
|
|
@ -886,6 +886,7 @@ static const ConfigSetting vrSettings[] = {
|
|||
ConfigSetting("VRCameraSide", &g_Config.fCameraSide, 0.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("VRCameraPitch", &g_Config.iCameraPitch, 0, CfgFlag::PER_GAME),
|
||||
ConfigSetting("VRCanvasDistance", &g_Config.fCanvasDistance, 12.0f, CfgFlag::DEFAULT),
|
||||
ConfigSetting("VRCanvas3DDistance", &g_Config.fCanvas3DDistance, 3.0f, CfgFlag::DEFAULT),
|
||||
ConfigSetting("VRFieldOfView", &g_Config.fFieldOfViewPercentage, 100.0f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("VRHeadUpDisplayScale", &g_Config.fHeadUpDisplayScale, 0.3f, CfgFlag::PER_GAME),
|
||||
ConfigSetting("VRMotionLength", &g_Config.fMotionLength, 0.5f, CfgFlag::DEFAULT),
|
||||
|
|
|
@ -446,6 +446,7 @@ public:
|
|||
float fCameraHeight;
|
||||
float fCameraSide;
|
||||
float fCanvasDistance;
|
||||
float fCanvas3DDistance;
|
||||
float fFieldOfViewPercentage;
|
||||
float fHeadUpDisplayScale;
|
||||
float fMotionLength;
|
||||
|
|
|
@ -1085,8 +1085,7 @@ void GameSettingsScreen::CreateVRSettings(UI::ViewGroup *vrSettings) {
|
|||
|
||||
vrSettings->Add(new ItemHeader(vr->T("Virtual reality")));
|
||||
vrSettings->Add(new CheckBox(&g_Config.bEnableVR, vr->T("Virtual reality")));
|
||||
CheckBox *vr6DoF = vrSettings->Add(new CheckBox(&g_Config.bEnable6DoF, vr->T("6DoF movement")));
|
||||
vr6DoF->SetEnabledPtr(&g_Config.bEnableVR);
|
||||
vrSettings->Add(new CheckBox(&g_Config.bEnable6DoF, vr->T("6DoF movement")));
|
||||
vrSettings->Add(new CheckBox(&g_Config.bEnableStereo, vr->T("Stereoscopic vision (Experimental)")));
|
||||
vrSettings->Add(new CheckBox(&g_Config.bForce72Hz, vr->T("Force 72Hz update")));
|
||||
if (IsPassthroughSupported()) {
|
||||
|
@ -1095,6 +1094,7 @@ void GameSettingsScreen::CreateVRSettings(UI::ViewGroup *vrSettings) {
|
|||
|
||||
vrSettings->Add(new ItemHeader(vr->T("VR camera")));
|
||||
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCanvasDistance, 1.0f, 15.0f, 12.0f, vr->T("Distance to 2D menus and scenes"), 1.0f, screenManager(), ""));
|
||||
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fCanvas3DDistance, 1.0f, 15.0f, 3.0f, vr->T("Distance to 3D scenes when VR disabled"), 1.0f, screenManager(), ""));
|
||||
vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fFieldOfViewPercentage, 100.0f, 200.0f, 100.0f, vr->T("Field of view scale"), 10.0f, screenManager(), vr->T("% of native FoV")));
|
||||
vrSettings->Add(new CheckBox(&g_Config.bRescaleHUD, vr->T("Heads-up display detection")));
|
||||
PopupSliderChoiceFloat* vrHudScale = vrSettings->Add(new PopupSliderChoiceFloat(&g_Config.fHeadUpDisplayScale, 0.0f, 1.5f, 0.3f, vr->T("Heads-up display scale"), 0.1f, screenManager(), ""));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue