Skip to content

Commit 38cc536

Browse files
committed
Put reflection probe common code into shared function
1 parent ed34eba commit 38cc536

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

DeferredKSP/EditorLighting.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private void FixReflections()
122122

123123
var probe = probeGo.AddComponent<ReflectionProbe>();
124124

125-
probe.resolution = Mathf.Max(1024, 128 * (int)Mathf.Pow(2, GameSettings.REFLECTION_PROBE_TEXTURE_RESOLUTION));
125+
probe.resolution = KSCReflectionProbe.GetStockReflectionProbeResolution();
126126
probe.size = new Vector3(1000000f, 1000000f, 1000000f);
127127
probe.cullingMask = 1 << 15;
128128
probe.shadowDistance = 0.0f;

DeferredKSP/Utils/KSCReflectionProbe.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ private void Awake()
1717
probe.refreshMode = UnityEngine.Rendering.ReflectionProbeRefreshMode.EveryFrame;
1818
probe.timeSlicingMode = UnityEngine.Rendering.ReflectionProbeTimeSlicingMode.IndividualFaces;
1919

20-
probe.resolution = 128 * (int)Mathf.Pow(2, GameSettings.REFLECTION_PROBE_TEXTURE_RESOLUTION);
20+
probe.resolution = GetStockReflectionProbeResolution();
2121

2222
// Make the reflection probe light up objects in this range
2323
probe.size = new Vector3(1000000f, 1000000f, 1000000f);
@@ -42,5 +42,10 @@ private void OnDestroy()
4242
{
4343
go.DestroyGameObject();
4444
}
45+
46+
public static int GetStockReflectionProbeResolution()
47+
{
48+
return 128 * (int)Mathf.Pow(2, GameSettings.REFLECTION_PROBE_TEXTURE_RESOLUTION);
49+
}
4550
}
4651
}

0 commit comments

Comments
 (0)