PageRenderTime 383ms CodeModel.GetById 99ms app.highlight 4ms RepoModel.GetById 147ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/DynamicDirectionalLightingShaderFeature.cs

#
C# | 100 lines | 60 code | 8 blank | 32 comment | 0 complexity | d7bf2bc63a73deb7a94db5589e655732 MD5 | raw file
  1using System.Collections.Generic;
  2using System.IO;
  3using Delta.Utilities.Datatypes;
  4
  5namespace Delta.Utilities.Graphics.ShaderFeatures
  6{
  7	/// <summary>
  8	/// Dynamic directional lighting shader feature
  9	/// </summary>
 10	public class DynamicDirectionalLightingShaderFeature : IShaderFeature
 11	{
 12		#region DirectionalLightDirection (Public)
 13		/// <summary>
 14		/// Direction of the directional light.
 15		/// </summary>
 16		public Vector DirectionalLightDirection;
 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.DynamicDirectionalLighting;
 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("DirectionalLightDirection", DirectionalLightDirection);
 59				return ret;
 60			}
 61		}
 62		#endregion
 63
 64		#region Constructors
 65		/// <summary>
 66		/// Create basic shader feature
 67		/// </summary>
 68		public DynamicDirectionalLightingShaderFeature()
 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 DynamicDirectionalLightingShaderFeature(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			DirectionalLightDirection.Load(reader);
 89		}
 90
 91		/// <summary>
 92		/// Save this ShaderFeature to a binary data stream.
 93		/// </summary>
 94		public void Save(BinaryWriter writer)
 95		{
 96			DirectionalLightDirection.Save(writer);
 97		}
 98		#endregion
 99	}
100}