/Utilities/Graphics/ShaderFeatures/NormalMappingShaderFeature.cs
C# | 101 lines | 59 code | 8 blank | 34 comment | 0 complexity | 2c361a680cb3da185a047ecd1a048585 MD5 | raw file
Possible License(s): Apache-2.0
- using System.Collections.Generic;
- using System.IO;
-
- namespace Delta.Utilities.Graphics.ShaderFeatures
- {
- /// <summary>
- /// Normal mapping shader feature
- /// Note: Make sure that the normal map required also the PointLight.
- /// </summary>
- public class NormalMapShaderFeature : IShaderFeature
- {
- #region NormalMap (Public)
- /// <summary>
- /// NormalMap, is always set except when ShaderFeatureFlags.NoTexturing is
- /// set (then we don't want a diffuse map and this setting is ignored).
- /// </summary>
- public string NormalMap = "";
- #endregion
-
- #region ShaderFeature (Public)
- /// <summary>
- /// Which shader feature flag is this ShaderFeature class using?
- /// Important for loading this file via ShaderData.LoadShaderFeature.
- /// Each flag should obviously only have one class for it!
- /// </summary>
- public ShaderFeatureFlags ShaderFeature
- {
- get
- {
- return ShaderFeatureFlags.NormalMap;
- }
- }
- #endregion
-
- #region RequiredShaderFeatures (Public)
- /// <summary>
- /// Which shader feature flags are required for this ShaderFeature.
- /// Very important for creating of a new ShaderFeature.
- /// </summary>
- public ShaderFeatureFlags RequiredShaderFeatures
- {
- get
- {
- return ShaderFeatureFlags.DynamicDirectionalLighting;
- }
- }
- #endregion
-
- #region Parameters (Public)
- /// <summary>
- /// Parameters as a dictionary, willl be generated on the fly when
- /// requested.
- /// </summary>
- public Dictionary<string, object> Parameters
- {
- get
- {
- Dictionary<string, object> ret = new Dictionary<string, object>();
- ret.Add("NormalMap", NormalMap);
- return ret;
- }
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create normal mapping shader feature
- /// </summary>
- public NormalMapShaderFeature()
- {
- }
-
- /// <summary>
- /// Create normal mapping shader feature and load automatically
- /// the ShaderFeatures from a binary data stream.
- /// </summary>
- public NormalMapShaderFeature(BinaryReader reader)
- {
- Load(reader);
- }
- #endregion
-
- #region ISaveLoadBinary Members
- /// <summary>
- /// Load this ShaderFeature from a binary data stream.
- /// </summary>
- public void Load(BinaryReader reader)
- {
- NormalMap = reader.ReadString();
- }
-
- /// <summary>
- /// Save this ShaderFeature to a binary data stream.
- /// </summary>
- public void Save(BinaryWriter writer)
- {
- writer.Write(NormalMap);
- }
- #endregion
- }
- }