BloomEditor.cs 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. using System.Linq;
  2. using UnityEngine.Rendering;
  3. using UnityEngine.Rendering.Universal;
  4. namespace UnityEditor.Rendering.Universal
  5. {
  6. [VolumeComponentEditor(typeof(Bloom))]
  7. sealed class BloomEditor : VolumeComponentEditor
  8. {
  9. SerializedDataParameter m_Threshold;
  10. SerializedDataParameter m_Intensity;
  11. SerializedDataParameter m_Scatter;
  12. SerializedDataParameter m_Clamp;
  13. SerializedDataParameter m_Tint;
  14. SerializedDataParameter m_HighQualityFiltering;
  15. SerializedDataParameter m_DirtTexture;
  16. SerializedDataParameter m_DirtIntensity;
  17. public override void OnEnable()
  18. {
  19. var o = new PropertyFetcher<Bloom>(serializedObject);
  20. m_Threshold = Unpack(o.Find(x => x.threshold));
  21. m_Intensity = Unpack(o.Find(x => x.intensity));
  22. m_Scatter = Unpack(o.Find(x => x.scatter));
  23. m_Clamp = Unpack(o.Find(x => x.clamp));
  24. m_Tint = Unpack(o.Find(x => x.tint));
  25. m_HighQualityFiltering = Unpack(o.Find(x => x.highQualityFiltering));
  26. m_DirtTexture = Unpack(o.Find(x => x.dirtTexture));
  27. m_DirtIntensity = Unpack(o.Find(x => x.dirtIntensity));
  28. }
  29. public override void OnInspectorGUI()
  30. {
  31. if (UniversalRenderPipeline.asset?.postProcessingFeatureSet == PostProcessingFeatureSet.PostProcessingV2)
  32. {
  33. EditorGUILayout.HelpBox(UniversalRenderPipelineAssetEditor.Styles.postProcessingGlobalWarning, MessageType.Warning);
  34. return;
  35. }
  36. EditorGUILayout.LabelField("Bloom", EditorStyles.miniLabel);
  37. PropertyField(m_Threshold);
  38. PropertyField(m_Intensity);
  39. PropertyField(m_Scatter);
  40. PropertyField(m_Tint);
  41. PropertyField(m_Clamp);
  42. PropertyField(m_HighQualityFiltering);
  43. if (m_HighQualityFiltering.overrideState.boolValue && m_HighQualityFiltering.value.boolValue && CoreEditorUtils.buildTargets.Contains(GraphicsDeviceType.OpenGLES2))
  44. EditorGUILayout.HelpBox("High Quality Bloom isn't supported on GLES2 platforms.", MessageType.Warning);
  45. EditorGUILayout.LabelField("Lens Dirt", EditorStyles.miniLabel);
  46. PropertyField(m_DirtTexture);
  47. PropertyField(m_DirtIntensity);
  48. }
  49. }
  50. }