PageRenderTime 40ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/LightMapShaderFeature.cs

#
C# | 100 lines | 59 code | 8 blank | 33 comment | 0 complexity | dc2cb756143d59156c0fcc733fec3daa 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. /// Light map shader feature
  7. /// </summary>
  8. public class LightMapShaderFeature : IShaderFeature
  9. {
  10. #region LightMap (Public)
  11. /// <summary>
  12. /// LightMap, is always set except when ShaderFeatureFlags.NoTexturing is
  13. /// set (then we don't want a diffuse map and this setting is ignored).
  14. /// </summary>
  15. public string LightMap = "";
  16. #endregion
  17. #region ShaderFeature (Public)
  18. /// <summary>
  19. /// Which shader feature flag is this ShaderFeature class using?
  20. /// Important for loading this file via ShaderData.LoadShaderFeature.
  21. /// Each flag should obviously only have one class for it!
  22. /// </summary>
  23. public ShaderFeatureFlags ShaderFeature
  24. {
  25. get
  26. {
  27. return ShaderFeatureFlags.LightMap;
  28. }
  29. }
  30. #endregion
  31. #region RequiredShaderFeatures (Public)
  32. /// <summary>
  33. /// Which shader feature flags are required for this ShaderFeature.
  34. /// Very important for creating of a new ShaderFeature.
  35. /// </summary>
  36. public ShaderFeatureFlags RequiredShaderFeatures
  37. {
  38. get
  39. {
  40. return ShaderFeatureFlags.Basic;
  41. }
  42. }
  43. #endregion
  44. #region Parameters (Public)
  45. /// <summary>
  46. /// Parameters as a dictionary, will be generated on the fly when
  47. /// requested.
  48. /// </summary>
  49. public Dictionary<string, object> Parameters
  50. {
  51. get
  52. {
  53. Dictionary<string, object> ret = new Dictionary<string, object>();
  54. ret.Add("LightMap", LightMap);
  55. return ret;
  56. }
  57. }
  58. #endregion
  59. #region Constructors
  60. /// <summary>
  61. /// Create light map shader feature
  62. /// </summary>
  63. public LightMapShaderFeature()
  64. {
  65. }
  66. /// <summary>
  67. /// Create light map shader feature and load automatically
  68. /// the ShaderFeatures from a binary data stream.
  69. /// </summary>
  70. public LightMapShaderFeature(BinaryReader reader)
  71. {
  72. Load(reader);
  73. }
  74. #endregion
  75. #region ISaveLoadBinary Members
  76. /// <summary>
  77. /// Load this ShaderFeature from a binary data stream.
  78. /// </summary>
  79. public void Load(BinaryReader reader)
  80. {
  81. LightMap = reader.ReadString();
  82. }
  83. /// <summary>
  84. /// Save this ShaderFeature to a binary data stream.
  85. /// </summary>
  86. public void Save(BinaryWriter writer)
  87. {
  88. writer.Write(LightMap);
  89. }
  90. #endregion
  91. }
  92. }