PageRenderTime 272ms CodeModel.GetById 111ms app.highlight 3ms RepoModel.GetById 118ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/BasicShaderFeature.cs

#
C# | 100 lines | 59 code | 8 blank | 33 comment | 0 complexity | 9db2b7d279fe2f5200fb86cf342316bc MD5 | raw file
  1using System.Collections.Generic;
  2using System.IO;
  3
  4namespace Delta.Utilities.Graphics.ShaderFeatures
  5{
  6	/// <summary>
  7	/// Basic shader feature
  8	/// </summary>
  9	public class BasicShaderFeature : IShaderFeature
 10	{
 11		#region DiffuseMap (Public)
 12		/// <summary>
 13		/// Diffuse map, is always set except when ShaderFeatureFlags.NoTexturing
 14		/// is set (then we don't want a diffuse map and this setting is ignored).
 15		/// </summary>
 16		public string DiffuseMap = "";
 17		#endregion
 18
 19		#region ShaderFeature (Public)
 20		/// <summary>
 21		/// Which shader feature flag is this ShaderFeature class using?
 22		/// Important for loading this file via ShaderData.LoadShaderFeature.
 23		/// Each flag should obviously only have one class for it!
 24		/// </summary>
 25		public ShaderFeatureFlags ShaderFeature
 26		{
 27			get
 28			{
 29				return ShaderFeatureFlags.Basic;
 30			}
 31		}
 32		#endregion
 33
 34		#region RequiredShaderFeatures (Public)
 35		/// <summary>
 36		/// Which shader feature flags are required for this ShaderFeature.
 37		/// Very important for creating of a new ShaderFeature.
 38		/// </summary>
 39		public ShaderFeatureFlags RequiredShaderFeatures
 40		{
 41			get
 42			{
 43				return ShaderFeatureFlags.Basic;
 44			}
 45		}
 46		#endregion
 47
 48		#region Parameters (Public)
 49		/// <summary>
 50		/// Parameters as a dictionary, will be generated on the fly when
 51		/// requested.
 52		/// </summary>
 53		public Dictionary<string, object> Parameters
 54		{
 55			get
 56			{
 57				Dictionary<string, object> ret = new Dictionary<string, object>();
 58				ret.Add("DiffuseMap", DiffuseMap);
 59				return ret;
 60			}
 61		}
 62		#endregion
 63
 64		#region Constructors
 65		/// <summary>
 66		/// Create basic shader feature
 67		/// </summary>
 68		public BasicShaderFeature()
 69		{
 70		}
 71
 72		/// <summary>
 73		/// Create basic shader feature and load automatically
 74		/// the ShaderFeatures from a binary data stream.
 75		/// </summary>
 76		public BasicShaderFeature(BinaryReader reader)
 77		{
 78			Load(reader);
 79		}
 80		#endregion
 81
 82		#region ISaveLoadBinary Members
 83		/// <summary>
 84		/// Load this ShaderFeature from a binary data stream.
 85		/// </summary>
 86		public void Load(BinaryReader reader)
 87		{
 88			DiffuseMap = reader.ReadString();
 89		}
 90
 91		/// <summary>
 92		/// Save this ShaderFeature to a binary data stream.
 93		/// </summary>
 94		public void Save(BinaryWriter writer)
 95		{
 96			writer.Write(DiffuseMap);
 97		}
 98		#endregion
 99	}
100}