VignetteModel.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System;
  2. namespace UnityEngine.PostProcessing
  3. {
  4. [Serializable]
  5. public class VignetteModel : PostProcessingModel
  6. {
  7. public enum Mode
  8. {
  9. Classic,
  10. Masked
  11. }
  12. [Serializable]
  13. public struct Settings
  14. {
  15. [Tooltip("Use the \"Classic\" mode for parametric controls. Use the \"Masked\" mode to use your own texture mask.")]
  16. public Mode mode;
  17. [ColorUsage(false)]
  18. [Tooltip("Vignette color. Use the alpha channel for transparency.")]
  19. public Color color;
  20. [Tooltip("Sets the vignette center point (screen center is [0.5,0.5]).")]
  21. public Vector2 center;
  22. [Range(0f, 1f), Tooltip("Amount of vignetting on screen.")]
  23. public float intensity;
  24. [Range(0.01f, 1f), Tooltip("Smoothness of the vignette borders.")]
  25. public float smoothness;
  26. [Range(0f, 1f), Tooltip("Lower values will make a square-ish vignette.")]
  27. public float roundness;
  28. [Tooltip("A black and white mask to use as a vignette.")]
  29. public Texture mask;
  30. [Range(0f, 1f), Tooltip("Mask opacity.")]
  31. public float opacity;
  32. [Tooltip("Should the vignette be perfectly round or be dependent on the current aspect ratio?")]
  33. public bool rounded;
  34. public static Settings defaultSettings
  35. {
  36. get
  37. {
  38. return new Settings
  39. {
  40. mode = Mode.Classic,
  41. color = new Color(0f, 0f, 0f, 1f),
  42. center = new Vector2(0.5f, 0.5f),
  43. intensity = 0.45f,
  44. smoothness = 0.2f,
  45. roundness = 1f,
  46. mask = null,
  47. opacity = 1f,
  48. rounded = false
  49. };
  50. }
  51. }
  52. }
  53. [SerializeField]
  54. Settings m_Settings = Settings.defaultSettings;
  55. public Settings settings
  56. {
  57. get { return m_Settings; }
  58. set { m_Settings = value; }
  59. }
  60. public override void Reset()
  61. {
  62. m_Settings = Settings.defaultSettings;
  63. }
  64. }
  65. }