PageRenderTime 63ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/Utilities/Graphics/ShaderFeatures/DynamicDirectionalLightingShaderFeature.cs

#
C# | 100 lines | 60 code | 8 blank | 32 comment | 0 complexity | d7bf2bc63a73deb7a94db5589e655732 MD5 | raw file
Possible License(s): Apache-2.0
  1. using System.Collections.Generic;
  2. using System.IO;
  3. using Delta.Utilities.Datatypes;
  4. namespace Delta.Utilities.Graphics.ShaderFeatures
  5. {
  6. /// <summary>
  7. /// Dynamic directional lighting shader feature
  8. /// </summary>
  9. public class DynamicDirectionalLightingShaderFeature : IShaderFeature
  10. {
  11. #region DirectionalLightDirection (Public)
  12. /// <summary>
  13. /// Direction of the directional light.
  14. /// </summary>
  15. public Vector DirectionalLightDirection;
  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.DynamicDirectionalLighting;
  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("DirectionalLightDirection", DirectionalLightDirection);
  55. return ret;
  56. }
  57. }
  58. #endregion
  59. #region Constructors
  60. /// <summary>
  61. /// Create basic shader feature
  62. /// </summary>
  63. public DynamicDirectionalLightingShaderFeature()
  64. {
  65. }
  66. /// <summary>
  67. /// Create basic shader feature and load automatically
  68. /// the ShaderFeatures from a binary data stream.
  69. /// </summary>
  70. public DynamicDirectionalLightingShaderFeature(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. DirectionalLightDirection.Load(reader);
  82. }
  83. /// <summary>
  84. /// Save this ShaderFeature to a binary data stream.
  85. /// </summary>
  86. public void Save(BinaryWriter writer)
  87. {
  88. DirectionalLightDirection.Save(writer);
  89. }
  90. #endregion
  91. }
  92. }