using System; namespace UnityEngine.PostProcessing { [Serializable] public class BloomModel : PostProcessingModel { public BloomModel.Settings settings { get { return this.m_Settings; } set { this.m_Settings = value; } } public override void Reset() { this.m_Settings = BloomModel.Settings.defaultSettings; } [SerializeField] private BloomModel.Settings m_Settings = BloomModel.Settings.defaultSettings; [Serializable] public struct BloomSettings { public float thresholdLinear { get { return Mathf.GammaToLinearSpace(this.threshold); } set { this.threshold = Mathf.LinearToGammaSpace(value); } } public static BloomModel.BloomSettings defaultSettings { get { return new BloomModel.BloomSettings { intensity = 0.5f, threshold = 1.1f, softKnee = 0.5f, radius = 4f, antiFlicker = false }; } } [Min(0f)] [Tooltip("Strength of the bloom filter.")] public float intensity; [Min(0f)] [Tooltip("Filters out pixels under this level of brightness.")] public float threshold; [Range(0f, 1f)] [Tooltip("Makes transition between under/over-threshold gradual (0 = hard threshold, 1 = soft threshold).")] public float softKnee; [Range(1f, 7f)] [Tooltip("Changes extent of veiling effects in a screen resolution-independent fashion.")] public float radius; [Tooltip("Reduces flashing noise with an additional filter.")] public bool antiFlicker; } [Serializable] public struct LensDirtSettings { public static BloomModel.LensDirtSettings defaultSettings { get { return new BloomModel.LensDirtSettings { texture = null, intensity = 3f }; } } [Tooltip("Dirtiness texture to add smudges or dust to the lens.")] public Texture texture; [Min(0f)] [Tooltip("Amount of lens dirtiness.")] public float intensity; } [Serializable] public struct Settings { public static BloomModel.Settings defaultSettings { get { return new BloomModel.Settings { bloom = BloomModel.BloomSettings.defaultSettings, lensDirt = BloomModel.LensDirtSettings.defaultSettings }; } } public BloomModel.BloomSettings bloom; public BloomModel.LensDirtSettings lensDirt; } } }