PageRenderTime 30ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/ShaderConstants.cs

#
C# | 133 lines | 33 code | 18 blank | 82 comment | 0 complexity | 6a7057bceb81668eb038227a59318e29 MD5 | raw file
Possible License(s): Apache-2.0
  1. using Delta.Utilities.Datatypes;
  2. namespace Delta.Utilities.Graphics.ShaderFeatures
  3. {
  4. /// <summary>
  5. /// Shader constants, not only needed for the Content and as default values
  6. /// for the shader classes in Graphics, but also for the default fallback
  7. /// values for many of the shader feature classes in this namespace.
  8. /// </summary>
  9. public class ShaderConstants
  10. {
  11. #region Constants
  12. /// <summary>
  13. /// Default colors are 0.15 for ambient and 1.0 for diffuse and specular.
  14. /// </summary>
  15. public static readonly Color DefaultAmbientColor =
  16. new Color(0.15f, 0.15f, 0.15f);
  17. /// <summary>
  18. /// Default diffuse color is almost white (90%)
  19. /// </summary>
  20. public static readonly Color DefaultDiffuseColor =
  21. new Color(0.9f, 0.9f, 0.9f);
  22. /// <summary>
  23. /// Default specular color is always white
  24. /// </summary>
  25. public static readonly Color DefaultSpecularColor = Color.White;
  26. /// <summary>
  27. /// Default specular power (4 now for better fresnel, was 24 before)
  28. /// </summary>
  29. public const float DefaultSpecularPower = 10.0f; //13.0f;//16.0f;//24.0f;
  30. /// <summary>
  31. /// Default fresnel power if the shader for this material does fresnel,
  32. /// fresnel bias is 0 (or bias in the shader) and the factor is 1.0 too.
  33. /// Note: Now in a pre-calculated lut texture, not longer a parameter!
  34. /// </summary>
  35. public const float DefaultFresnelPower = 4.0f; //7.0f;//4.0f;
  36. /// <summary>
  37. /// Default fresnel factor. Fresnel * FresnelFactor.
  38. /// Note: Now in a pre-calculated lut texture, not longer a parameter!
  39. /// </summary>
  40. public const float DefaultFresnelFactor = 2.0f; //8.0f;
  41. /// <summary>
  42. /// Default parallax offset amount in pixels for a 1024x1024 texture.
  43. /// 16 means that we will offset -16 to +16 pixels in the texture (which
  44. /// is a lot, you really need smooth transitions to make this look ok).
  45. /// Note: For a 2048x2048 texture it would be -32 to +32 pixels, for
  46. /// a 512x512 texture it would be -8 to +8 because the formula is always
  47. /// the same: 1024.0 / ParallaxAmount. Note: Increased a bit to 27.0f
  48. /// because now it is only used on floors, old value: 16.0f.
  49. /// </summary>
  50. public const float DefaultParallaxAmount = 27.0f; //20.0f;//16.0f;
  51. /// <summary>
  52. /// Minimum ambient value.
  53. /// </summary>
  54. public const float DefaultMinAmbientValue = 0.25f; //0.15f;
  55. /// <summary>
  56. /// Value for alpha test.
  57. /// The default value is normally 0.66.
  58. /// </summary>
  59. public const float DefaultAlphaTestValue = 0.33f;
  60. /// <summary>
  61. /// Default fog color. 133, 37, 12 + 0.075 brightness
  62. /// </summary>
  63. public static readonly Color DefaultFogColor = new Color(
  64. // Mix the old fog color with white to make fog not so strong,
  65. // mipmap fog is not very great ..
  66. (0.52f + 0.15f + 1.0f) / 2.0f,
  67. (0.145f + 0.15f + 1.0f) / 2.0f,
  68. (0.047f + 0.15f + 1.0f) / 2.0f, 1.0f);
  69. /// <summary>
  70. /// Default fog start.
  71. /// </summary>
  72. public const float DefaultFogStart = 20.0f;
  73. /// <summary>
  74. /// Fog end.
  75. /// </summary>
  76. public const float DefaultFogEnd = 90.0f;
  77. /// <summary>
  78. /// Maximum fog value.
  79. /// </summary>
  80. public const float DefaultMaxFogValue = 0.9f;
  81. /// <summary>
  82. /// Minimum fog value.
  83. /// </summary>
  84. public const float DefaultMinFogValue = 0.15f;
  85. /// <summary>
  86. /// Maximal bones count that we can support currently = 36.
  87. /// But you can change that value dynamically via the Content Settings :)
  88. /// </summary>
  89. public const int MaxBonesCount = 36;
  90. /*currently unused, should be in the shadow classes anyway!
  91. /// <summary>
  92. /// Default shadow that will generates in shader generator.
  93. /// Currently set to the fastest version: Projection shadows, but
  94. /// can be changed before generating content to different values.
  95. /// </summary>
  96. public static ShadowType DefaultShadowType = ShadowType.Projection;
  97. */
  98. /// <summary>
  99. /// Default shadow size. Normally 512x512. The size is useful to get
  100. /// the pixel size in shader (1.0 / 512.0).
  101. /// </summary>
  102. public static readonly Size DefaultShadowSize =
  103. //could be too much for the Tegra:
  104. new Size(512, 512);
  105. //new Size(256, 256);
  106. /// <summary>
  107. /// Default shadow color. Using for the shadow map generation.
  108. /// 0.33 is pretty dark (0.5 is too weak however), 0.0 is black and
  109. /// will usually not look very well for bright scenes (only in Doom3 ^^)
  110. /// </summary>
  111. public static readonly Color DefaultShadowColor =
  112. new Color(0.33f, 0.33f, 0.33f, 1.0f);
  113. #endregion
  114. }
  115. }