/Utilities/Graphics/ShaderFeatures/AmbientDiffuseShaderFeature.cs
C# | 114 lines | 66 code | 9 blank | 39 comment | 0 complexity | fe02904597ff3b28aeeb44bedbd73782 MD5 | raw file
Possible License(s): Apache-2.0
- using System.Collections.Generic;
- using System.IO;
- using Delta.Utilities.Datatypes;
-
- namespace Delta.Utilities.Graphics.ShaderFeatures
- {
- /// <summary>
- /// Ambient diffuse shader feature
- /// </summary>
- public class AmbientDiffuseShaderFeature : IShaderFeature
- {
- #region AmbientColor (Public)
- /// <summary>
- /// Default ambient color, usually not used, but can be set here in the
- /// BasicShaderFeature. When used, mostly affected by lighting
- /// calculations.
- /// </summary>
- public Color AmbientColor = ShaderConstants.DefaultAmbientColor;
- #endregion
-
- #region DiffuseColor (Public)
- /// <summary>
- /// Default diffuse color, usually not used, but can be set here in the
- /// BasicShaderFeature. When used, mostly affected by lighting
- /// calculations.
- /// </summary>
- public Color DiffuseColor = ShaderConstants.DefaultDiffuseColor;
- #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.AmbientDiffuse;
- }
- }
- #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("AmbientColor", AmbientColor);
- ret.Add("DiffuseColor", DiffuseColor);
- return ret;
- }
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create ambient diffuse shader feature
- /// </summary>
- public AmbientDiffuseShaderFeature()
- {
- }
-
- /// <summary>
- /// Create ambient diffuse shader feature and load automatically
- /// the ShaderFeatures from a binary data stream.
- /// </summary>
- public AmbientDiffuseShaderFeature(BinaryReader reader)
- {
- Load(reader);
- }
- #endregion
-
- #region ISaveLoadBinary Members
- /// <summary>
- /// Load this ShaderFeature from a binary data stream.
- /// </summary>
- public void Load(BinaryReader reader)
- {
- AmbientColor.Load(reader);
- DiffuseColor.Load(reader);
- }
-
- /// <summary>
- /// Save this ShaderFeature to a binary data stream.
- /// </summary>
- public void Save(BinaryWriter writer)
- {
- AmbientColor.Save(writer);
- DiffuseColor.Save(writer);
- }
- #endregion
- }
- }