BloomSettings.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. //-----------------------------------------------------------------------------
  2. // BloomSettings.cs
  3. //
  4. // Microsoft XNA Community Game Platform
  5. // Copyright (C) Microsoft Corporation. All rights reserved.
  6. //-----------------------------------------------------------------------------
  7. using System;
  8. namespace NetRumble
  9. {
  10. /// <summary>
  11. /// Class holds all the settings used to tweak the bloom effect.
  12. /// </summary>
  13. /// <remarks>
  14. /// This public class is similar to one in the Bloom sample.
  15. /// </remarks>
  16. public class BloomSettings
  17. {
  18. // Name of a preset bloom setting, for display to the user.
  19. public readonly string Name;
  20. // Controls how bright a pixel needs to be before it will bloom.
  21. // Zero makes everything bloom equally, while higher values select
  22. // only brighter colors. Somewhere between 0.25 and 0.5 is good.
  23. public readonly float BloomThreshold;
  24. // Controls how much blurring is applied to the bloom image.
  25. // The typical range is from 1 up to 10 or so.
  26. public readonly float BlurAmount;
  27. // Controls the amount of the bloom and base images that
  28. // will be mixed into the final scene. Range 0 to 1.
  29. public readonly float BloomIntensity;
  30. public readonly float BaseIntensity;
  31. // Independently control the color saturation of the bloom and
  32. // base images. Zero is totally desaturated, 1.0 leaves saturation
  33. // unchanged, while higher values increase the saturation level.
  34. public readonly float BloomSaturation;
  35. public readonly float BaseSaturation;
  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("NetRumble", 0.25f, 4, 1.25f, 1, 1, 1),
  58. new BloomSettings("VectorRumble", 0f, 2, 3f, 1, 2, 1),
  59. };
  60. }
  61. }