LightExplorer.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using UnityEngine.Rendering;
  3. using UnityEngine.Rendering.Universal;
  4. using UnityEngine.Scripting.APIUpdating;
  5. namespace UnityEditor
  6. {
  7. [LightingExplorerExtensionAttribute(typeof(UniversalRenderPipelineAsset))]
  8. [MovedFrom("UnityEditor.Rendering.LWRP")] public class LightExplorer : DefaultLightingExplorerExtension
  9. {
  10. private static class Styles
  11. {
  12. public static readonly GUIContent Enabled = EditorGUIUtility.TrTextContent("Enabled");
  13. public static readonly GUIContent Name = EditorGUIUtility.TrTextContent("Name");
  14. public static readonly GUIContent Mode = EditorGUIUtility.TrTextContent("Mode");
  15. public static readonly GUIContent HDR = EditorGUIUtility.TrTextContent("HDR");
  16. public static readonly GUIContent ShadowDistance = EditorGUIUtility.TrTextContent("Shadow Distance");
  17. public static readonly GUIContent NearPlane = EditorGUIUtility.TrTextContent("Near Plane");
  18. public static readonly GUIContent FarPlane = EditorGUIUtility.TrTextContent("Far Plane");
  19. public static readonly GUIContent Resolution = EditorGUIUtility.TrTextContent("Resolution");
  20. public static readonly GUIContent[] ReflectionProbeModeTitles = { EditorGUIUtility.TrTextContent("Baked"), EditorGUIUtility.TrTextContent("Realtime"), EditorGUIUtility.TrTextContent("Custom") };
  21. public static readonly int[] ReflectionProbeModeValues = { (int)ReflectionProbeMode.Baked, (int)ReflectionProbeMode.Realtime, (int)ReflectionProbeMode.Custom };
  22. public static readonly GUIContent[] ReflectionProbeSizeTitles = { EditorGUIUtility.TrTextContent("16"),
  23. EditorGUIUtility.TrTextContent("32"),
  24. EditorGUIUtility.TrTextContent("64"),
  25. EditorGUIUtility.TrTextContent("128"),
  26. EditorGUIUtility.TrTextContent("256"),
  27. EditorGUIUtility.TrTextContent("512"),
  28. EditorGUIUtility.TrTextContent("1024"),
  29. EditorGUIUtility.TrTextContent("2048") };
  30. public static readonly int[] ReflectionProbeSizeValues = { 16, 32, 64, 128, 256, 512, 1024, 2048 };
  31. }
  32. protected override LightingExplorerTableColumn[] GetReflectionProbeColumns()
  33. {
  34. return new[]
  35. {
  36. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, Styles.Enabled, "m_Enabled", 50), // 0: Enabled
  37. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Name, Styles.Name, null, 200), // 1: Name
  38. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Int, Styles.Mode, "m_Mode", 70, (r, prop, dep) =>
  39. {
  40. EditorGUI.IntPopup(r, prop, Styles.ReflectionProbeModeTitles, Styles.ReflectionProbeModeValues, GUIContent.none);
  41. }), // 2: Mode
  42. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Checkbox, Styles.HDR, "m_HDR", 35), // 3: HDR
  43. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Enum, Styles.Resolution, "m_Resolution", 100, (r, prop, dep) =>
  44. {
  45. EditorGUI.IntPopup(r, prop, Styles.ReflectionProbeSizeTitles, Styles.ReflectionProbeSizeValues, GUIContent.none);
  46. }), // 4: Probe Resolution
  47. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, Styles.ShadowDistance, "m_ShadowDistance", 100), // 5: Shadow Distance
  48. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, Styles.NearPlane, "m_NearClip", 70), // 6: Near Plane
  49. new LightingExplorerTableColumn(LightingExplorerTableColumn.DataType.Float, Styles.FarPlane, "m_FarClip", 70), // 7: Far Plane
  50. };
  51. }
  52. }
  53. }