VignetteModel.cs 1.9 KB

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