No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

LightExplorer.cs 4.3KB

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