BuiltinDebugViewsModel.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class BuiltinDebugViewsModel : PostProcessingModel
  6. {
  7. public BuiltinDebugViewsModel.Settings settings
  8. {
  9. get
  10. {
  11. return this.m_Settings;
  12. }
  13. set
  14. {
  15. this.m_Settings = value;
  16. }
  17. }
  18. public bool willInterrupt
  19. {
  20. get
  21. {
  22. return !this.IsModeActive(BuiltinDebugViewsModel.Mode.None) && !this.IsModeActive(BuiltinDebugViewsModel.Mode.EyeAdaptation) && !this.IsModeActive(BuiltinDebugViewsModel.Mode.PreGradingLog) && !this.IsModeActive(BuiltinDebugViewsModel.Mode.LogLut) && !this.IsModeActive(BuiltinDebugViewsModel.Mode.UserLut);
  23. }
  24. }
  25. public override void Reset()
  26. {
  27. this.settings = BuiltinDebugViewsModel.Settings.defaultSettings;
  28. }
  29. public bool IsModeActive(BuiltinDebugViewsModel.Mode mode)
  30. {
  31. return this.m_Settings.mode == mode;
  32. }
  33. [SerializeField]
  34. private BuiltinDebugViewsModel.Settings m_Settings = BuiltinDebugViewsModel.Settings.defaultSettings;
  35. [Serializable]
  36. public struct DepthSettings
  37. {
  38. public static BuiltinDebugViewsModel.DepthSettings defaultSettings
  39. {
  40. get
  41. {
  42. return new BuiltinDebugViewsModel.DepthSettings
  43. {
  44. scale = 1f
  45. };
  46. }
  47. }
  48. [Range(0f, 1f)]
  49. [Tooltip("Scales the camera far plane before displaying the depth map.")]
  50. public float scale;
  51. }
  52. [Serializable]
  53. public struct MotionVectorsSettings
  54. {
  55. public static BuiltinDebugViewsModel.MotionVectorsSettings defaultSettings
  56. {
  57. get
  58. {
  59. return new BuiltinDebugViewsModel.MotionVectorsSettings
  60. {
  61. sourceOpacity = 1f,
  62. motionImageOpacity = 0f,
  63. motionImageAmplitude = 16f,
  64. motionVectorsOpacity = 1f,
  65. motionVectorsResolution = 24,
  66. motionVectorsAmplitude = 64f
  67. };
  68. }
  69. }
  70. [Range(0f, 1f)]
  71. [Tooltip("Opacity of the source render.")]
  72. public float sourceOpacity;
  73. [Range(0f, 1f)]
  74. [Tooltip("Opacity of the per-pixel motion vector colors.")]
  75. public float motionImageOpacity;
  76. [Min(0f)]
  77. [Tooltip("Because motion vectors are mainly very small vectors, you can use this setting to make them more visible.")]
  78. public float motionImageAmplitude;
  79. [Range(0f, 1f)]
  80. [Tooltip("Opacity for the motion vector arrows.")]
  81. public float motionVectorsOpacity;
  82. [Range(8f, 64f)]
  83. [Tooltip("The arrow density on screen.")]
  84. public int motionVectorsResolution;
  85. [Min(0f)]
  86. [Tooltip("Tweaks the arrows length.")]
  87. public float motionVectorsAmplitude;
  88. }
  89. public enum Mode
  90. {
  91. None,
  92. Depth,
  93. Normals,
  94. MotionVectors,
  95. AmbientOcclusion,
  96. EyeAdaptation,
  97. FocusPlane,
  98. PreGradingLog,
  99. LogLut,
  100. UserLut
  101. }
  102. [Serializable]
  103. public struct Settings
  104. {
  105. public static BuiltinDebugViewsModel.Settings defaultSettings
  106. {
  107. get
  108. {
  109. return new BuiltinDebugViewsModel.Settings
  110. {
  111. mode = BuiltinDebugViewsModel.Mode.None,
  112. depth = BuiltinDebugViewsModel.DepthSettings.defaultSettings,
  113. motionVectors = BuiltinDebugViewsModel.MotionVectorsSettings.defaultSettings
  114. };
  115. }
  116. }
  117. public BuiltinDebugViewsModel.Mode mode;
  118. public BuiltinDebugViewsModel.DepthSettings depth;
  119. public BuiltinDebugViewsModel.MotionVectorsSettings motionVectors;
  120. }
  121. }
  122. }