PageRenderTime 153ms CodeModel.GetById 90ms app.highlight 4ms RepoModel.GetById 57ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/ShaderConstants.cs

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