BloomSettings.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // BloomSettings.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. namespace BloomPostprocess
  10. {
  11. /// <summary>
  12. /// Class holds all the settings used to tweak the bloom effect.
  13. /// </summary>
  14. public class BloomSettings
  15. {
  16. #region Fields
  17. // Name of a preset bloom setting, for display to the user.
  18. public readonly string Name;
  19. // Controls how bright a pixel needs to be before it will bloom.
  20. // Zero makes everything bloom equally, while higher values select
  21. // only brighter colors. Somewhere between 0.25 and 0.5 is good.
  22. public readonly float BloomThreshold;
  23. // Controls how much blurring is applied to the bloom image.
  24. // The typical range is from 1 up to 10 or so.
  25. public readonly float BlurAmount;
  26. // Controls the amount of the bloom and base images that
  27. // will be mixed into the final scene. Range 0 to 1.
  28. public readonly float BloomIntensity;
  29. public readonly float BaseIntensity;
  30. // Independently control the color saturation of the bloom and
  31. // base images. Zero is totally desaturated, 1.0 leaves saturation
  32. // unchanged, while higher values increase the saturation level.
  33. public readonly float BloomSaturation;
  34. public readonly float BaseSaturation;
  35. #endregion
  36. /// <summary>
  37. /// Constructs a new bloom settings descriptor.
  38. /// </summary>
  39. public BloomSettings(string name, float bloomThreshold, float blurAmount,
  40. float bloomIntensity, float baseIntensity,
  41. float bloomSaturation, float baseSaturation)
  42. {
  43. Name = name;
  44. BloomThreshold = bloomThreshold;
  45. BlurAmount = blurAmount;
  46. BloomIntensity = bloomIntensity;
  47. BaseIntensity = baseIntensity;
  48. BloomSaturation = bloomSaturation;
  49. BaseSaturation = baseSaturation;
  50. }
  51. /// <summary>
  52. /// Table of preset bloom settings, used by the sample program.
  53. /// </summary>
  54. public static BloomSettings[] PresetSettings =
  55. {
  56. // Name Thresh Blur Bloom Base BloomSat BaseSat
  57. new BloomSettings("Default", 0.25f, 4, 1.25f, 1, 1, 1),
  58. new BloomSettings("Soft", 0, 3, 1, 1, 1, 1),
  59. new BloomSettings("Desaturated", 0.5f, 8, 2, 1, 0, 1),
  60. new BloomSettings("Saturated", 0.25f, 4, 2, 1, 2, 0),
  61. new BloomSettings("Blurry", 0, 2, 1, 0.1f, 1, 1),
  62. new BloomSettings("Subtle", 0.5f, 2, 1, 1, 1, 1),
  63. };
  64. }
  65. }