/Utilities/Graphics/ShaderFeatures/DetailMappingShaderFeature.cs
C# | 103 lines | 59 code | 8 blank | 36 comment | 0 complexity | 04be485a1a866ef8d39976eaf584ea17 MD5 | raw file
Possible License(s): Apache-2.0
- using System.Collections.Generic;
- using System.IO;
-
- namespace Delta.Utilities.Graphics.ShaderFeatures
- {
- /// <summary>
- /// Detail mapping shader feature
- /// </summary>
- public class DetailMappingShaderFeature : IShaderFeature
- {
- #region DetailMap (Public)
- /// <summary>
- /// The Detail map is a tiled texture that is added to improve the sharpness
- /// especially in highly scaled textures. There is a texture on which a
- /// fine pattern is shown (usually this is a "noise" effect used).
- /// The Detail map is tiled over the terrain and this combined with a
- /// diffuse mal or color map.
- /// </summary>
- public string DetailMap = "";
- #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.DetailMapping;
- }
- }
- #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.Basic;
- }
- }
- #endregion
-
- #region Parameters (Public)
- /// <summary>
- /// Parameters as a dictionary, will be generated on the fly when
- /// requested.
- /// </summary>
- public Dictionary<string, object> Parameters
- {
- get
- {
- Dictionary<string, object> ret = new Dictionary<string, object>();
- ret.Add("DetailMap", DetailMap);
- return ret;
- }
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create detail map shader feature
- /// </summary>
- public DetailMappingShaderFeature()
- {
- }
-
- /// <summary>
- /// Create detail map shader feature and load automatically
- /// the ShaderFeatures from a binary data stream.
- /// </summary>
- public DetailMappingShaderFeature(BinaryReader reader)
- {
- Load(reader);
- }
- #endregion
-
- #region ISaveLoadBinary Members
- /// <summary>
- /// Load this ShaderFeature from a binary data stream.
- /// </summary>
- public void Load(BinaryReader reader)
- {
- DetailMap = reader.ReadString();
- }
-
- /// <summary>
- /// Save this ShaderFeature to a binary data stream.
- /// </summary>
- public void Save(BinaryWriter writer)
- {
- writer.Write(DetailMap);
- }
- #endregion
- }
- }