PageRenderTime 203ms CodeModel.GetById 121ms app.highlight 3ms RepoModel.GetById 77ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/DetailMappingShaderFeature.cs

#
C# | 103 lines | 59 code | 8 blank | 36 comment | 0 complexity | 04be485a1a866ef8d39976eaf584ea17 MD5 | raw file
  1using System.Collections.Generic;
  2using System.IO;
  3
  4namespace Delta.Utilities.Graphics.ShaderFeatures
  5{
  6	/// <summary>
  7	/// Detail mapping shader feature
  8	/// </summary>
  9	public class DetailMappingShaderFeature : IShaderFeature
 10	{
 11		#region DetailMap (Public)
 12		/// <summary>
 13		/// The Detail map is a tiled texture that is added to improve the sharpness
 14		/// especially in highly scaled textures. There is a texture on which a 
 15		/// fine pattern is shown (usually this is a "noise" effect used). 
 16		/// The Detail map is tiled over the terrain and this combined with a 
 17		/// diffuse mal or color map.
 18		/// </summary>
 19		public string DetailMap = "";
 20		#endregion
 21
 22		#region ShaderFeature (Public)
 23		/// <summary>
 24		/// Which shader feature flag is this ShaderFeature class using?
 25		/// Important for loading this file via ShaderData.LoadShaderFeature.
 26		/// Each flag should obviously only have one class for it!
 27		/// </summary>
 28		public ShaderFeatureFlags ShaderFeature
 29		{
 30			get
 31			{
 32				return ShaderFeatureFlags.DetailMapping;
 33			}
 34		}
 35		#endregion
 36
 37		#region RequiredShaderFeatures (Public)
 38		/// <summary>
 39		/// Which shader feature flags are required for this ShaderFeature.
 40		/// Very important for creating of a new ShaderFeature.
 41		/// </summary>
 42		public ShaderFeatureFlags RequiredShaderFeatures
 43		{
 44			get
 45			{
 46				return ShaderFeatureFlags.Basic;
 47			}
 48		}
 49		#endregion
 50
 51		#region Parameters (Public)
 52		/// <summary>
 53		/// Parameters as a dictionary, will be generated on the fly when
 54		/// requested.
 55		/// </summary>
 56		public Dictionary<string, object> Parameters
 57		{
 58			get
 59			{
 60				Dictionary<string, object> ret = new Dictionary<string, object>();
 61				ret.Add("DetailMap", DetailMap);
 62				return ret;
 63			}
 64		}
 65		#endregion
 66
 67		#region Constructors
 68		/// <summary>
 69		/// Create detail map shader feature
 70		/// </summary>
 71		public DetailMappingShaderFeature()
 72		{
 73		}
 74
 75		/// <summary>
 76		/// Create detail map shader feature and load automatically
 77		/// the ShaderFeatures from a binary data stream.
 78		/// </summary>
 79		public DetailMappingShaderFeature(BinaryReader reader)
 80		{
 81			Load(reader);
 82		}
 83		#endregion
 84
 85		#region ISaveLoadBinary Members
 86		/// <summary>
 87		/// Load this ShaderFeature from a binary data stream.
 88		/// </summary>
 89		public void Load(BinaryReader reader)
 90		{
 91			DetailMap = reader.ReadString();
 92		}
 93
 94		/// <summary>
 95		/// Save this ShaderFeature to a binary data stream.
 96		/// </summary>
 97		public void Save(BinaryWriter writer)
 98		{
 99			writer.Write(DetailMap);
100		}
101		#endregion
102	}
103}