DepthOfFieldModel.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class DepthOfFieldModel : PostProcessingModel
  6. {
  7. public enum KernelSize
  8. {
  9. Small,
  10. Medium,
  11. Large,
  12. VeryLarge
  13. }
  14. [Serializable]
  15. public struct Settings
  16. {
  17. [Min(0.1f), Tooltip("Distance to the point of focus.")]
  18. public float focusDistance;
  19. [Range(0.05f, 32f), Tooltip("Ratio of aperture (known as f-stop or f-number). The smaller the value is, the shallower the depth of field is.")]
  20. public float aperture;
  21. [Range(1f, 300f), Tooltip("Distance between the lens and the film. The larger the value is, the shallower the depth of field is.")]
  22. public float focalLength;
  23. [Tooltip("Calculate the focal length automatically from the field-of-view value set on the camera. Using this setting isn't recommended.")]
  24. public bool useCameraFov;
  25. [Tooltip("Convolution kernel size of the bokeh filter, which determines the maximum radius of bokeh. It also affects the performance (the larger the kernel is, the longer the GPU time is required).")]
  26. public KernelSize kernelSize;
  27. public static Settings defaultSettings
  28. {
  29. get
  30. {
  31. return new Settings
  32. {
  33. focusDistance = 10f,
  34. aperture = 5.6f,
  35. focalLength = 50f,
  36. useCameraFov = false,
  37. kernelSize = KernelSize.Medium
  38. };
  39. }
  40. }
  41. }
  42. [SerializeField]
  43. Settings m_Settings = Settings.defaultSettings;
  44. public Settings settings
  45. {
  46. get { return m_Settings; }
  47. set { m_Settings = value; }
  48. }
  49. public override void Reset()
  50. {
  51. m_Settings = Settings.defaultSettings;
  52. }
  53. }
  54. }