mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Allow overriding far clip plane (#377)
## Minor features - Can override the far clip plane for a system from the star system config (you're welcome Jammer)
This commit is contained in:
commit
6600c1c4c1
@ -14,6 +14,11 @@ namespace NewHorizons.External.Configs
|
||||
[JsonObject]
|
||||
public class StarSystemConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// An override value for the far clip plane. Allows you to see farther.
|
||||
/// </summary>
|
||||
public float farClipPlaneOverride;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this system can be warped to via the warp drive. If you set factRequiredForWarp, this will be true.
|
||||
/// </summary>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace NewHorizons.Patches
|
||||
@ -10,11 +11,11 @@ namespace NewHorizons.Patches
|
||||
[HarmonyPatch(typeof(MapController), nameof(MapController.Awake))]
|
||||
public static void MapController_Awake(MapController __instance)
|
||||
{
|
||||
__instance._maxPanDistance = Main.FurthestOrbit * 1.5f;
|
||||
__instance._maxPanDistance = Mathf.Max(__instance._maxPanDistance, Main.FurthestOrbit * 1.5f);
|
||||
__instance._maxZoomDistance *= 6f;
|
||||
__instance._minPitchAngle = -90f;
|
||||
__instance._zoomSpeed *= 4f;
|
||||
__instance._mapCamera.farClipPlane = Main.FurthestOrbit * 10f;
|
||||
__instance._mapCamera.farClipPlane = Mathf.Max(__instance._mapCamera.farClipPlane, Main.FurthestOrbit * 10f);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
using HarmonyLib;
|
||||
using HarmonyLib;
|
||||
namespace NewHorizons.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
@ -8,25 +8,12 @@ namespace NewHorizons.Patches
|
||||
[HarmonyPatch(typeof(OWCamera), nameof(OWCamera.Awake))]
|
||||
public static void OnOWCameraAwake(OWCamera __instance)
|
||||
{
|
||||
// var oldDist = __instance.farClipPlane;
|
||||
// var newDist = __instance.farClipPlane * 10f;
|
||||
// if (__instance.useFarCamera) Mathf.Clamp(newDist, oldDist, 50000f);
|
||||
// else newDist = Mathf.Clamp(newDist, oldDist, 10000000f);
|
||||
// __instance.farClipPlane = newDist;
|
||||
// __instance.farCameraDistance = newDist;
|
||||
// __instance.mainCamera.farClipPlane = newDist;
|
||||
if (Main.SystemDict.TryGetValue(Main.Instance.CurrentStarSystem, out var system) && system?.Config?.farClipPlaneOverride != 0f)
|
||||
{
|
||||
__instance.farClipPlane = system.Config.farClipPlaneOverride;
|
||||
__instance.farCameraDistance = system.Config.farClipPlaneOverride;
|
||||
__instance.mainCamera.farClipPlane = system.Config.farClipPlaneOverride;
|
||||
}
|
||||
}
|
||||
|
||||
// [HarmonyPrefix]
|
||||
// [HarmonyPatch(typeof(OWCamera), nameof(OWCamera.RebuildSkybox))]
|
||||
// public static bool OnOWCameraRebuildSkybox(OWCamera __instance)
|
||||
// {
|
||||
// __instance._skyboxCommandBuffer = new CommandBuffer();
|
||||
// __instance._skyboxCommandBuffer.name = "Skybox";
|
||||
// var camera = __instance._useFarCamera && !SystemInfo.usesReversedZBuffer ? __instance._farCamera : __instance._mainCamera;
|
||||
// CameraEvent evt = CameraEvent.BeforeSkybox;
|
||||
// camera.AddCommandBuffer(evt, __instance._skyboxCommandBuffer);
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,11 @@
|
||||
"description": "Configuration for a specific star system",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"farClipPlaneOverride": {
|
||||
"type": "number",
|
||||
"description": "An override value for the far clip plane. Allows you to see farther.",
|
||||
"format": "float"
|
||||
},
|
||||
"canEnterViaWarpDrive": {
|
||||
"type": "boolean",
|
||||
"description": "Whether this system can be warped to via the warp drive. If you set factRequiredForWarp, this will be true.",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user