-
Notifications
You must be signed in to change notification settings - Fork 867
Expand file tree
/
Copy pathURPReflectionProbeSettings.cs
More file actions
54 lines (50 loc) · 2.14 KB
/
URPReflectionProbeSettings.cs
File metadata and controls
54 lines (50 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
using System;
#if UNITY_EDITOR
using UnityEditor;
using UnityEditor.Rendering.Universal;
#endif
using UnityEngine.Rendering.Universal;
namespace UnityEngine.Rendering
{
/// <summary>
/// ReflectionProbe global settings class.
/// </summary>
[Serializable]
[SupportedOnRenderPipeline(typeof(UniversalRenderPipelineAsset))]
[Categorization.CategoryInfo(Name = "Lighting", Order = 21)]
public class URPReflectionProbeSettings : IRenderPipelineGraphicsSettings
{
[SerializeField, HideInInspector] private int version = 1;
int IRenderPipelineGraphicsSettings.version => version;
bool IRenderPipelineGraphicsSettings.isAvailableInPlayerBuild => true;
[SerializeField, Tooltip("Use ReflectionProbe rotation. Enabling this will improve the appearance of reflections when the ReflectionProbe isn't axis aligned, but may worsen performance on lower end platforms.")]
private bool useReflectionProbeRotation = true;
/// <summary>
/// Whether to take ReflectionProbe rotation into account when rendering.
/// </summary>
public bool UseReflectionProbeRotation
{
get
{
#if UNITY_EDITOR
var mode = useReflectionProbeRotation ? SupportedRenderingFeatures.ReflectionProbeModes.Rotation : SupportedRenderingFeatures.ReflectionProbeModes.None;
if (mode != SupportedRenderingFeatures.active.reflectionProbeModes)
{
SupportedRenderingFeatures.active.reflectionProbeModes = mode;
}
#endif
return useReflectionProbeRotation;
}
#if UNITY_EDITOR
internal set
{
this.SetValueAndNotify(ref useReflectionProbeRotation, value, nameof(useReflectionProbeRotation));
if (QualitySettings.renderPipeline is UniversalRenderPipelineAsset urpAsset)
{
SupportedRenderingFeatures.active.reflectionProbeModes = value ? SupportedRenderingFeatures.ReflectionProbeModes.Rotation : SupportedRenderingFeatures.ReflectionProbeModes.None;
}
}
#endif
}
}
}