RenderTextureDepthBufferDrawer.cs 1.0 KB

123456789101112131415161718192021222324252627
  1. #if UNITY_EDITOR
  2. using UnityEngine;
  3. using UnityEditor;
  4. namespace Unity.RenderStreaming.Editor
  5. {
  6. [CustomPropertyDrawer(typeof(RenderTextureDepthBufferAttribute))]
  7. public class RenderTextureDepthBufferDrawer : PropertyDrawer
  8. {
  9. readonly GUIContent[] renderTextureDepthBuffer = new GUIContent[3]
  10. {
  11. EditorGUIUtility.TrTextContent("No depth buffer"),
  12. EditorGUIUtility.TrTextContent("At least 16 bits depth (no stencil)"),
  13. EditorGUIUtility.TrTextContent("At least 24 bits depth (with stencil)")
  14. };
  15. readonly int[] renderTextureDepthBufferValues = new int[3] { 0, 16, 24 };
  16. readonly GUIContent depthBuffer = EditorGUIUtility.TrTextContent("Depth Buffer", "Format of the depth buffer.");
  17. public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
  18. {
  19. EditorGUI.IntPopup(position, property, renderTextureDepthBuffer, renderTextureDepthBufferValues, depthBuffer);
  20. }
  21. }
  22. }
  23. #endif