From 8d1ec31b66697579e02ac5bf892138e4bf6a7d47 Mon Sep 17 00:00:00 2001 From: Kai Salmon Date: Fri, 20 Sep 2024 15:58:05 +0100 Subject: [PATCH 1/2] Introduced a near clip plane setting --- FreeCam/MainClass.cs | 10 +++++++--- FreeCam/default-config.json | 9 +++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/FreeCam/MainClass.cs b/FreeCam/MainClass.cs index dc33922..29b54e6 100644 --- a/FreeCam/MainClass.cs +++ b/FreeCam/MainClass.cs @@ -20,7 +20,8 @@ class MainClass : ModBehaviour private InputMode _storedMode; private int _fov; - private ICommonCameraAPI _commonCameraAPI; + private int _nearClipPlane; + private ICommonCameraAPI _commonCameraAPI; private GameObject _hud; private static MainClass _instance; @@ -62,14 +63,17 @@ void OnDestroy() public override void Configure(IModConfig config) { _fov = config.GetSettingsValue("FOV"); - ShowPrompts = !config.GetSettingsValue("Hide Prompts"); + _nearClipPlane = config.GetSettingsValue("Near Clip Plane Distance"); + ShowPrompts = !config.GetSettingsValue("Hide Prompts"); // If the mod is currently active we can set these immediately if (_camera != null) { _camera.fieldOfView = _fov; _owCamera.fieldOfView = _fov; - } + _camera.nearClipPlane = _nearClipPlane; + _owCamera.nearClipPlane = _nearClipPlane; + } } private void OnSceneLoaded(Scene scene, LoadSceneMode _) diff --git a/FreeCam/default-config.json b/FreeCam/default-config.json index d62c9be..ead6aab 100644 --- a/FreeCam/default-config.json +++ b/FreeCam/default-config.json @@ -1,7 +1,8 @@ { "enabled": true, - "settings": { - "FOV": 90, - "Hide Prompts": false - } + "settings": { + "FOV": 90, + "Near Clip Plane Distance": 0.1, + "Hide Prompts": false + } } \ No newline at end of file From f95d09178662c1a12d5931dc63597c1950933193 Mon Sep 17 00:00:00 2001 From: Kai Salmon Date: Fri, 20 Sep 2024 16:12:22 +0100 Subject: [PATCH 2/2] Tweaked config to avoid crashes when nearClipPlane is set below 1 --- FreeCam/default-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FreeCam/default-config.json b/FreeCam/default-config.json index ead6aab..0a3addb 100644 --- a/FreeCam/default-config.json +++ b/FreeCam/default-config.json @@ -2,7 +2,7 @@ "enabled": true, "settings": { "FOV": 90, - "Near Clip Plane Distance": 0.1, + "Near Clip Plane Distance": 1, "Hide Prompts": false } } \ No newline at end of file