mirror of
https://github.com/NotAKidoS/NAK_CVR_Mods.git
synced 2025-09-03 06:49:22 +00:00
[DesktopVRSwitch] Handle CVRWorld- Post Processing & FOV settings.
This commit is contained in:
parent
70ae268149
commit
900c6646af
17 changed files with 62 additions and 48 deletions
|
@ -1,5 +1,4 @@
|
|||
using ABI_RC.Core.Savior;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
|
51
DesktopVRSwitch/VRModeTrackers/CVRWorldTracker.cs
Normal file
51
DesktopVRSwitch/VRModeTrackers/CVRWorldTracker.cs
Normal file
|
@ -0,0 +1,51 @@
|
|||
using ABI.CCK.Components;
|
||||
using ABI_RC.Core.InteractionSystem;
|
||||
using ABI_RC.Core.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CVRWorldTracker : VRModeTracker
|
||||
{
|
||||
public override void TrackerInit()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
public override void TrackerDestroy()
|
||||
{
|
||||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
||||
private void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
CVRWorld _cvrWorld = CVRWorld.Instance;
|
||||
if (_cvrWorld == null)
|
||||
{
|
||||
DesktopVRSwitch.Logger.Error("Error while getting CVRWorld!");
|
||||
return;
|
||||
}
|
||||
DesktopVRSwitch.Logger.Msg("Configuring CVRWorld. Updating PostProcessing & DesktopCameraController FOV settings.");
|
||||
|
||||
// some post processing settings aren't used in VR
|
||||
_cvrWorld.UpdatePostProcessing();
|
||||
UpdateCVRDesktopCameraController(_cvrWorld);
|
||||
}
|
||||
|
||||
private void UpdateCVRDesktopCameraController(CVRWorld _cvrWorld)
|
||||
{
|
||||
// Just making sure- Starting in VR will not call Start() as rig is disabled
|
||||
if (CVR_DesktopCameraController._cam == null)
|
||||
CVR_DesktopCameraController._cam = PlayerSetup.Instance.desktopCamera.GetComponent<Camera>();
|
||||
|
||||
CVR_DesktopCameraController.defaultFov = Mathf.Clamp(_cvrWorld.fov, 60f, 120f);
|
||||
CVR_DesktopCameraController.zoomFov = CVR_DesktopCameraController.defaultFov * 0.5f;
|
||||
CVR_DesktopCameraController.enableZoom = _cvrWorld.enableZoom;
|
||||
CVR_DesktopCameraController.UpdateFov(); // must happen after PlayerSetupTracker
|
||||
CVR_MenuManager.Instance.coreData.instance.current_game_rule_no_zoom = !_cvrWorld.enableZoom;
|
||||
|
||||
// UICamera has a script that copies the FOV from the desktop cam.
|
||||
// Toggling the cameras on/off resets the aspect ratio,
|
||||
// so when rigs switch, that is already handled.
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CVR_InteractableManagerTracker : VRModeTracker
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CVR_MenuManagerTracker : VRModeTracker
|
||||
|
|
|
@ -5,10 +5,11 @@ namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
|||
|
||||
public class CameraFacingObjectTracker : MonoBehaviour
|
||||
{
|
||||
internal CameraFacingObject _cameraFacingObject;
|
||||
CameraFacingObject _cameraFacingObject;
|
||||
|
||||
void Start()
|
||||
{
|
||||
_cameraFacingObject = GetComponent<CameraFacingObject>();
|
||||
VRModeSwitchManager.OnPostVRModeSwitch += OnPostSwitch;
|
||||
}
|
||||
|
||||
|
@ -19,6 +20,7 @@ public class CameraFacingObjectTracker : MonoBehaviour
|
|||
|
||||
public void OnPostSwitch(bool intoVR)
|
||||
{
|
||||
// TODO: cache camera
|
||||
_cameraFacingObject.m_Camera = Utils.GetPlayerCameraObject(intoVR).GetComponent<Camera>();
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.Savior;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class CheckVRTracker : VRModeTracker
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core;
|
||||
using ABI_RC.Core.UI;
|
||||
|
||||
using UnityEngine;
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.Player;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class HudOperationsTracker : VRModeTracker
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using ABI_RC.Systems.IK.SubSystems;
|
||||
using ABI_RC.Systems.IK.TrackingModules;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class IKSystemTracker : VRModeTracker
|
||||
|
|
|
@ -57,14 +57,12 @@ public class MetaPortTracker : VRModeTracker
|
|||
if (intoVR)
|
||||
{
|
||||
// Testing
|
||||
XRSettings.eyeTextureResolutionScale = 1;
|
||||
XRSettings.gameViewRenderMode = DesktopVRSwitch.EntryRenderVRGameView.Value ? GameViewRenderMode.LeftEye : GameViewRenderMode.None;
|
||||
//XRSettings.gameViewRenderMode = DesktopVRSwitch.EntryRenderVRGameView.Value ? GameViewRenderMode.LeftEye : GameViewRenderMode.None;
|
||||
XRSettings.eyeTextureResolutionScale = 1; // unsure if will cause issues with FSR?
|
||||
SteamVR_Settings.instance.pauseGameWhenDashboardVisible = false;
|
||||
|
||||
if (MetaPort.Instance.settings.GetSettingsBool("InteractionTobiiEyeTracking", false))
|
||||
{
|
||||
MetaPort.Instance.TobiiXrInitializer.Initialize();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@ public class MovementSystemTracker : VRModeTracker
|
|||
VRModeSwitchManager.OnPostVRModeSwitch -= OnPostSwitch;
|
||||
}
|
||||
|
||||
// why do i do this
|
||||
private MovementSystem GetMovementSystemInstance()
|
||||
{
|
||||
MovementSystem _movementSystem = MovementSystem.Instance;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.Player;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class PlayerSetupTracker : VRModeTracker
|
||||
|
@ -27,16 +26,5 @@ public class PlayerSetupTracker : VRModeTracker
|
|||
|
||||
_playerSetup.desktopCameraRig.SetActive(!intoVR);
|
||||
_playerSetup.vrCameraRig.SetActive(intoVR);
|
||||
|
||||
// This might error if we started in VR.
|
||||
// '_cam' is not set until Start().
|
||||
if (CVR_DesktopCameraController._cam == null)
|
||||
CVR_DesktopCameraController._cam = _playerSetup.desktopCamera.GetComponent<UnityEngine.Camera>();
|
||||
|
||||
CVR_DesktopCameraController.UpdateFov();
|
||||
|
||||
// UICamera has a script that copies the FOV from the desktop cam.
|
||||
// Toggling the cameras on/off resets the aspect ratio,
|
||||
// so when rigs switch, that is already handled.
|
||||
}
|
||||
}
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Systems.Camera;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class PortableCameraTracker : VRModeTracker
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.Player;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class VRTrackerManagerTracker : VRModeTracker
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
using ABI_RC.Core.InteractionSystem;
|
||||
|
||||
|
||||
namespace NAK.DesktopVRSwitch.VRModeTrackers;
|
||||
|
||||
public class ViewManagerTracker : VRModeTracker
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue