summaryrefslogtreecommitdiff
path: root/UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs
diff options
context:
space:
mode:
authorchai <215380520@qq.com>2024-03-13 11:00:58 +0800
committerchai <215380520@qq.com>2024-03-13 11:00:58 +0800
commit6ce8b9e22fc13be34b442c7b6af48b42cd44275a (patch)
treeb38119d2acf0a982cb67e381f146924b9bfc3b3f /UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs
+init
Diffstat (limited to 'UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs')
-rw-r--r--UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs131
1 files changed, 131 insertions, 0 deletions
diff --git a/UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs b/UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs
new file mode 100644
index 0000000..7a6f53c
--- /dev/null
+++ b/UnityEngine.PostProcessing/BuiltinDebugViewsModel.cs
@@ -0,0 +1,131 @@
+using System;
+
+namespace UnityEngine.PostProcessing;
+
+[Serializable]
+public class BuiltinDebugViewsModel : PostProcessingModel
+{
+ [Serializable]
+ public struct DepthSettings
+ {
+ [Range(0f, 1f)]
+ [Tooltip("Scales the camera far plane before displaying the depth map.")]
+ public float scale;
+
+ public static DepthSettings defaultSettings
+ {
+ get
+ {
+ DepthSettings result = default(DepthSettings);
+ result.scale = 1f;
+ return result;
+ }
+ }
+ }
+
+ [Serializable]
+ public struct MotionVectorsSettings
+ {
+ [Range(0f, 1f)]
+ [Tooltip("Opacity of the source render.")]
+ public float sourceOpacity;
+
+ [Range(0f, 1f)]
+ [Tooltip("Opacity of the per-pixel motion vector colors.")]
+ public float motionImageOpacity;
+
+ [Min(0f)]
+ [Tooltip("Because motion vectors are mainly very small vectors, you can use this setting to make them more visible.")]
+ public float motionImageAmplitude;
+
+ [Range(0f, 1f)]
+ [Tooltip("Opacity for the motion vector arrows.")]
+ public float motionVectorsOpacity;
+
+ [Range(8f, 64f)]
+ [Tooltip("The arrow density on screen.")]
+ public int motionVectorsResolution;
+
+ [Min(0f)]
+ [Tooltip("Tweaks the arrows length.")]
+ public float motionVectorsAmplitude;
+
+ public static MotionVectorsSettings defaultSettings
+ {
+ get
+ {
+ MotionVectorsSettings result = default(MotionVectorsSettings);
+ result.sourceOpacity = 1f;
+ result.motionImageOpacity = 0f;
+ result.motionImageAmplitude = 16f;
+ result.motionVectorsOpacity = 1f;
+ result.motionVectorsResolution = 24;
+ result.motionVectorsAmplitude = 64f;
+ return result;
+ }
+ }
+ }
+
+ public enum Mode
+ {
+ None,
+ Depth,
+ Normals,
+ MotionVectors,
+ AmbientOcclusion,
+ EyeAdaptation,
+ FocusPlane,
+ PreGradingLog,
+ LogLut,
+ UserLut
+ }
+
+ [Serializable]
+ public struct Settings
+ {
+ public Mode mode;
+
+ public DepthSettings depth;
+
+ public MotionVectorsSettings motionVectors;
+
+ public static Settings defaultSettings
+ {
+ get
+ {
+ Settings result = default(Settings);
+ result.mode = Mode.None;
+ result.depth = DepthSettings.defaultSettings;
+ result.motionVectors = MotionVectorsSettings.defaultSettings;
+ return result;
+ }
+ }
+ }
+
+ [SerializeField]
+ private Settings m_Settings = Settings.defaultSettings;
+
+ public Settings settings
+ {
+ get
+ {
+ return m_Settings;
+ }
+ set
+ {
+ m_Settings = value;
+ }
+ }
+
+ public bool willInterrupt => !IsModeActive(Mode.None) && !IsModeActive(Mode.EyeAdaptation) && !IsModeActive(Mode.PreGradingLog) && !IsModeActive(Mode.LogLut) && !IsModeActive(Mode.UserLut);
+
+ public override void Reset()
+ {
+ settings = Settings.defaultSettings;
+ }
+
+ public bool IsModeActive(Mode mode)
+ {
+ return m_Settings.mode == mode;
+ }
+}