PageRenderTime 26ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/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
  1. using System.Collections.Generic;
  2. using System.IO;
  3. namespace Delta.Utilities.Graphics.ShaderFeatures
  4. {
  5. /// <summary>
  6. /// Detail mapping shader feature
  7. /// </summary>
  8. public class DetailMappingShaderFeature : IShaderFeature
  9. {
  10. #region DetailMap (Public)
  11. /// <summary>
  12. /// The Detail map is a tiled texture that is added to improve the sharpness
  13. /// especially in highly scaled textures. There is a texture on which a
  14. /// fine pattern is shown (usually this is a "noise" effect used).
  15. /// The Detail map is tiled over the terrain and this combined with a
  16. /// diffuse mal or color map.
  17. /// </summary>
  18. public string DetailMap = "";
  19. #endregion
  20. #region ShaderFeature (Public)
  21. /// <summary>
  22. /// Which shader feature flag is this ShaderFeature class using?
  23. /// Important for loading this file via ShaderData.LoadShaderFeature.
  24. /// Each flag should obviously only have one class for it!
  25. /// </summary>
  26. public ShaderFeatureFlags ShaderFeature
  27. {
  28. get
  29. {
  30. return ShaderFeatureFlags.DetailMapping;
  31. }
  32. }
  33. #endregion
  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. #region Parameters (Public)
  48. /// <summary>
  49. /// Parameters as a dictionary, will be generated on the fly when
  50. /// requested.
  51. /// </summary>
  52. public Dictionary<string, object> Parameters
  53. {
  54. get
  55. {
  56. Dictionary<string, object> ret = new Dictionary<string, object>();
  57. ret.Add("DetailMap", DetailMap);
  58. return ret;
  59. }
  60. }
  61. #endregion
  62. #region Constructors
  63. /// <summary>
  64. /// Create detail map shader feature
  65. /// </summary>
  66. public DetailMappingShaderFeature()
  67. {
  68. }
  69. /// <summary>
  70. /// Create detail map shader feature and load automatically
  71. /// the ShaderFeatures from a binary data stream.
  72. /// </summary>
  73. public DetailMappingShaderFeature(BinaryReader reader)
  74. {
  75. Load(reader);
  76. }
  77. #endregion
  78. #region ISaveLoadBinary Members
  79. /// <summary>
  80. /// Load this ShaderFeature from a binary data stream.
  81. /// </summary>
  82. public void Load(BinaryReader reader)
  83. {
  84. DetailMap = reader.ReadString();
  85. }
  86. /// <summary>
  87. /// Save this ShaderFeature to a binary data stream.
  88. /// </summary>
  89. public void Save(BinaryWriter writer)
  90. {
  91. writer.Write(DetailMap);
  92. }
  93. #endregion
  94. }
  95. }