BloomSettings.cs 2.9 KB

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