Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
kinsi55 committed Oct 10, 2024
2 parents 92c841d + a58f9c6 commit 6d2e8c4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Behaviours/Cam.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ internal void ShowWorldCamIfNecessary() {

internal void UpdateDepthTextureActive() {
if(UCamera != null)
UCamera.depthTextureMode = InitOnMainAvailable.useDepthTexture || settings?.PostProcessing.forceDepthTexture == true ? DepthTextureMode.Depth : DepthTextureMode.None;
UCamera.depthTextureMode = HookSettingsManager.useDepthTexture || settings?.PostProcessing.forceDepthTexture == true ? DepthTextureMode.Depth : DepthTextureMode.None;
}

static readonly HashSet<string> CameraBehavioursToDestroy = new HashSet<string>() {
Expand Down
13 changes: 13 additions & 0 deletions HarmonyPatches/HookSettingsManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using HarmonyLib;

namespace Camera2.HarmonyPatches {
[HarmonyPatch(typeof(DepthTextureController), nameof(DepthTextureController.Init))]
static class HookSettingsManager {
public static SettingsManager settingsManager { get; private set; }
public static bool useDepthTexture { get; private set; }
static void Postfix(SettingsManager settingsManager) {
HookSettingsManager.settingsManager = settingsManager;
useDepthTexture = settingsManager.settings.quality.smokeGraphics;
}
}
}
4 changes: 0 additions & 4 deletions HarmonyPatches/InitOnMainAvailable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ namespace Camera2.HarmonyPatches {
[HarmonyPatch(typeof(SmoothCameraController), nameof(SmoothCameraController.ActivateSmoothCameraIfNeeded))]
static class InitOnMainAvailable {
static bool isInited = false;
public static bool useDepthTexture { get; private set; }
static void Postfix(SmoothCameraController __instance) {
if(!isInited) {
// IDK
useDepthTexture = SceneUtil.GetMainCameraButReally().GetComponent<DepthTextureController>()._settingsManager.settings.quality.smokeGraphics;

if(CamManager.baseCullingMask == 0)
CamManager.baseCullingMask = Camera.main.cullingMask;

Expand Down

0 comments on commit 6d2e8c4

Please sign in to comment.