/Utilities/Graphics/ShaderFeatures/SpecularMappingShaderFeature.cs
C# | 100 lines | 59 code | 8 blank | 33 comment | 0 complexity | de051a233d1b10dbb62dc8d96ab452e8 MD5 | raw file
Possible License(s): Apache-2.0
1using System.Collections.Generic; 2using System.IO; 3 4namespace Delta.Utilities.Graphics.ShaderFeatures 5{ 6 /// <summary> 7 /// Specular mapping shader feature 8 /// </summary> 9 public class SpecularMapShaderFeature : IShaderFeature 10 { 11 #region SpecularMap (Public) 12 /// <summary> 13 /// SpecularMap, 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 SpecularMap = ""; 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.SpecularMap; 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.Specular; 44 } 45 } 46 #endregion 47 48 #region Parameters (Public) 49 /// <summary> 50 /// Parameters as a dictionary, willl 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("SpecularMap", SpecularMap); 59 return ret; 60 } 61 } 62 #endregion 63 64 #region Constructors 65 /// <summary> 66 /// Create specular mapping shader feature 67 /// </summary> 68 public SpecularMapShaderFeature() 69 { 70 } 71 72 /// <summary> 73 /// Create specular mapping shader feature and load automatically 74 /// the ShaderFeatures from a binary data stream. 75 /// </summary> 76 public SpecularMapShaderFeature(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 SpecularMap = 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(SpecularMap); 97 } 98 #endregion 99 } 100}