diff --git a/MonoGame.Framework/Graphics/Effect/Effect.cs b/MonoGame.Framework/Graphics/Effect/Effect.cs
index 457a944383a..091ada2c5a4 100644
--- a/MonoGame.Framework/Graphics/Effect/Effect.cs
+++ b/MonoGame.Framework/Graphics/Effect/Effect.cs
@@ -9,6 +9,9 @@
namespace Microsoft.Xna.Framework.Graphics
{
+ ///
+ /// Used to set and query shader effects, and to choose techniques.
+ ///
public class Effect : GraphicsResource
{
struct MGFXHeader
@@ -35,10 +38,23 @@ struct MGFXHeader
public int HeaderSize;
}
+ ///
+ /// Gets a collection of shader parameters used for this effect.
+ ///
public EffectParameterCollection Parameters { get; private set; }
+ ///
+ /// Gets a collection of shader techniques that are defined for this effect.
+ ///
public EffectTechniqueCollection Techniques { get; private set; }
+ ///
+ /// Gets or sets the active technique.
+ ///
+ ///
+ /// If there are multiple techiques in an effect and you want to use a new technique in the next pass,
+ /// you must set CurrentTechnique to the new technique before making the rendering pass.
+ ///
public EffectTechnique CurrentTechnique { get; set; }
internal ConstantBuffer[] ConstantBuffers { get; private set; }
@@ -55,7 +71,11 @@ internal Effect(GraphicsDevice graphicsDevice)
}
this.GraphicsDevice = graphicsDevice;
}
-
+
+ ///
+ /// Creates a clone of the .
+ ///
+ /// to clone.
protected Effect(Effect cloneSource)
: this(cloneSource.GraphicsDevice)
{
@@ -63,12 +83,20 @@ protected Effect(Effect cloneSource)
Clone(cloneSource);
}
+ ///
public Effect(GraphicsDevice graphicsDevice, byte[] effectCode)
: this(graphicsDevice, effectCode, 0, effectCode.Length)
{
}
-
+ ///
+ /// Creates a new instance of .
+ ///
+ /// Graphics device
+ /// The effect code.
+ ///
+ ///
+ /// This is invalid.
public Effect (GraphicsDevice graphicsDevice, byte[] effectCode, int index, int count)
: this(graphicsDevice)
{
@@ -192,10 +220,14 @@ public virtual Effect Clone()
return new Effect(this);
}
+ ///
+ /// Applies the effect state just prior to rendering the effect.
+ ///
protected internal virtual void OnApply()
{
}
+ ///
protected override void Dispose(bool disposing)
{
if (!IsDisposed)
@@ -224,6 +256,9 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}
+ ///
+ /// The GraphicsDevice is resetting, so GPU resources must be recreated.
+ ///
internal protected override void GraphicsDeviceResetting()
{
for (var i = 0; i < ConstantBuffers.Length; i++)
@@ -451,4 +486,4 @@ private static EffectParameterCollection ReadParameters(BinaryReader reader)
#endregion // Effect File Reader
}
-}
+}
\ No newline at end of file
diff --git a/MonoGame.Framework/Graphics/Effect/EffectAnnotation.cs b/MonoGame.Framework/Graphics/Effect/EffectAnnotation.cs
index 9e41595fa40..cd1e4c5526c 100644
--- a/MonoGame.Framework/Graphics/Effect/EffectAnnotation.cs
+++ b/MonoGame.Framework/Graphics/Effect/EffectAnnotation.cs
@@ -4,6 +4,9 @@ namespace Microsoft.Xna.Framework.Graphics
{
// TODO: This class needs to be finished!
+ ///
+ /// Represents an annotation to an .
+ ///
public class EffectAnnotation
{
internal EffectAnnotation (
@@ -33,12 +36,29 @@ internal EffectAnnotation (EffectParameter parameter)
Semantic = parameter.Semantic;
}
+ ///
+ /// Gets the parameter class of this effect annotation.
+ ///
public EffectParameterClass ParameterClass {get; private set;}
+ ///
+ /// Gets the parameter type of this effect annotation.
+ ///
public EffectParameterType ParameterType {get; private set;}
+ ///
+ /// Gets the name of the effect annotation.
+ ///
public string Name {get; private set;}
+ ///
+ /// Gets the row count of this effect annotation.
+ ///
public int RowCount {get; private set;}
+ ///
+ /// Gets the number of columns in this effect annotation.
+ ///
public int ColumnCount {get; private set;}
+ ///
+ /// Gets the semantic of this effect annotation.
+ ///
public string Semantic {get; private set;}
}
-}
-
+}
\ No newline at end of file
diff --git a/MonoGame.Framework/Graphics/Effect/EffectMaterial.cs b/MonoGame.Framework/Graphics/Effect/EffectMaterial.cs
index b83024d0a95..cd376badc9b 100644
--- a/MonoGame.Framework/Graphics/Effect/EffectMaterial.cs
+++ b/MonoGame.Framework/Graphics/Effect/EffectMaterial.cs
@@ -5,11 +5,23 @@
using System;
namespace Microsoft.Xna.Framework.Graphics
{
+ ///
+ /// Contains an effect subclass which is used to load data for an EffectMaterialContent type.
+ ///
+ ///
+ /// For most purposes, this type can be ignored, and treated exactly like a regular effect.
+ /// When an EffectMaterial type is loaded from .xnb format, its parameter values and textures
+ /// are also loaded and automatically set on the effect, in addition to the HLSL shader code.
+ /// Use this class to write a content pipeline extension to store materials inside a custom data type.
+ ///
public class EffectMaterial : Effect
{
+ ///
+ /// Creates a new instance of .
+ ///
+ /// An instance of an object to copy initialization data from.
public EffectMaterial (Effect cloneSource) : base(cloneSource)
{
}
}
-}
-
+}
\ No newline at end of file
diff --git a/MonoGame.Framework/Graphics/Effect/EffectParameter.cs b/MonoGame.Framework/Graphics/Effect/EffectParameter.cs
index f4abab0337d..12ea69d13a4 100644
--- a/MonoGame.Framework/Graphics/Effect/EffectParameter.cs
+++ b/MonoGame.Framework/Graphics/Effect/EffectParameter.cs
@@ -5,6 +5,31 @@
namespace Microsoft.Xna.Framework.Graphics
{
+ ///
+ /// Represents an parameter.
+ ///
+ ///
+ /// Creating and assigning a EffectParameter instance for each technique in your is
+ /// significantly faster than using the indexed property on .
+ ///
+ ///
+ /// 1) Create a EffectParameter for each parameter in your
+ /// that you will be setting in or .
+ ///
+ /// public EffectParameter mWorld;
+ /// public EffectParameter mCameraView;
+ /// public EffectParameter CameraPos;
+ /// public EffectParameter mCameraProj;
+ ///
+ /// 2) Assign an parameter to your EffectParameter.
+ ///
+ /// mWorld = effect.Parameters["g_mWorld"];
+ /// mCameraView = effect.Parameters["g_mCameraView"];
+ /// CameraPos = effect.Parameters["g_CameraPos"];
+ /// mCameraProj = effect.Parameters["g_mCameraProj"];
+ ///
+ /// 3) Call SetValue() on your EffectParameter to change the parameter value.
+ ///
[DebuggerDisplay("{DebugDisplayString}")]
public class EffectParameter
{
@@ -64,22 +89,49 @@ internal EffectParameter(EffectParameter cloneSource)
StateKey = unchecked(NextStateKey++);
}
+ ///
+ /// Gets the name of the parameter.
+ ///
public string Name { get; private set; }
+ ///
+ /// Gets the semantic meaning, or usage, of the parameter.
+ ///
public string Semantic { get; private set; }
+ ///
+ /// Gets the class of the parameter.
+ ///
public EffectParameterClass ParameterClass { get; private set; }
+ ///
+ /// Gets the type of the parameter.
+ ///
public EffectParameterType ParameterType { get; private set; }
+ ///
+ /// Gets the number of rows in the parameter description.
+ ///
public int RowCount { get; private set; }
+ ///
+ /// Gets the number of columns in the parameter description.
+ ///
public int ColumnCount { get; private set; }
+ ///
+ /// Gets the collection of effect parameters.
+ ///
public EffectParameterCollection Elements { get; private set; }
+ ///
+ /// Gets the collection of structure members.
+ ///
public EffectParameterCollection StructureMembers { get; private set; }
+ ///
+ /// Gets the collection of objects for this parameter.
+ ///
public EffectAnnotationCollection Annotations { get; private set; }
@@ -168,6 +220,12 @@ private string GetDataValueString()
return string.Concat("{", valueStr, "}");
}
+ ///
+ /// Gets the value of the as a .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
public bool GetValueBoolean ()
{
if (ParameterClass != EffectParameterClass.Scalar || ParameterType != EffectParameterType.Bool)
@@ -180,15 +238,24 @@ public bool GetValueBoolean ()
return ((int[])Data)[0] != 0;
#endif
}
-
+
/*
+ ///
+ /// Gets the value of the as an array of .
+ ///
public bool[] GetValueBooleanArray ()
{
throw new NotImplementedException();
}
*/
- public int GetValueInt32 ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public int GetValueInt32 ()
{
if (ParameterClass != EffectParameterClass.Scalar || ParameterType != EffectParameterType.Int32)
throw new InvalidCastException();
@@ -201,6 +268,9 @@ public int GetValueInt32 ()
#endif
}
+ ///
+ /// Gets the value of the as an array of .
+ ///
public int[] GetValueInt32Array()
{
if (Elements != null && Elements.Count > 0)
@@ -224,6 +294,12 @@ public int[] GetValueInt32Array()
}
}
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
public Matrix GetValueMatrix ()
{
if (ParameterClass != EffectParameterClass.Matrix || ParameterType != EffectParameterType.Single)
@@ -239,7 +315,11 @@ public Matrix GetValueMatrix ()
floatData[2], floatData[6], floatData[10], floatData[14],
floatData[3], floatData[7], floatData[11], floatData[15]);
}
-
+
+ ///
+ /// Gets the value of the as an array of .
+ ///
+ /// The number of elements in the array.
public Matrix[] GetValueMatrixArray (int count)
{
if (ParameterClass != EffectParameterClass.Matrix || ParameterType != EffectParameterType.Single)
@@ -252,7 +332,13 @@ public Matrix[] GetValueMatrixArray (int count)
return ret;
}
- public Quaternion GetValueQuaternion ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Quaternion GetValueQuaternion ()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -262,13 +348,22 @@ public Quaternion GetValueQuaternion ()
}
/*
+ ///
+ /// Gets the value of the as an array of .
+ ///
public Quaternion[] GetValueQuaternionArray ()
{
throw new NotImplementedException();
}
*/
- public Single GetValueSingle ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Single GetValueSingle ()
{
// TODO: Should this fetch int and bool as a float?
if (ParameterClass != EffectParameterClass.Scalar || ParameterType != EffectParameterType.Single)
@@ -277,7 +372,10 @@ public Single GetValueSingle ()
return ((float[])Data)[0];
}
- public Single[] GetValueSingleArray ()
+ ///
+ /// Gets the value of the as an array of .
+ ///
+ public Single[] GetValueSingleArray ()
{
if (Elements != null && Elements.Count > 0)
{
@@ -306,7 +404,13 @@ public Single[] GetValueSingleArray ()
}
}
- public string GetValueString ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public string GetValueString ()
{
if (ParameterClass != EffectParameterClass.Object || ParameterType != EffectParameterType.String)
throw new InvalidCastException();
@@ -314,7 +418,13 @@ public string GetValueString ()
return ((string[])Data)[0];
}
- public Texture2D GetValueTexture2D ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Texture2D GetValueTexture2D ()
{
if (ParameterClass != EffectParameterClass.Object || ParameterType != EffectParameterType.Texture2D)
throw new InvalidCastException();
@@ -323,7 +433,13 @@ public Texture2D GetValueTexture2D ()
}
#if !GLES
- public Texture3D GetValueTexture3D ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Texture3D GetValueTexture3D ()
{
if (ParameterClass != EffectParameterClass.Object || ParameterType != EffectParameterType.Texture3D)
throw new InvalidCastException();
@@ -331,7 +447,12 @@ public Texture3D GetValueTexture3D ()
return (Texture3D)Data;
}
#endif
-
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
public TextureCube GetValueTextureCube ()
{
if (ParameterClass != EffectParameterClass.Object || ParameterType != EffectParameterType.TextureCube)
@@ -340,7 +461,13 @@ public TextureCube GetValueTextureCube ()
return (TextureCube)Data;
}
- public Vector2 GetValueVector2 ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Vector2 GetValueVector2 ()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -349,6 +476,12 @@ public Vector2 GetValueVector2 ()
return new Vector2(vecInfo[0],vecInfo[1]);
}
+ ///
+ /// Gets the value of the as an array of .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
public Vector2[] GetValueVector2Array()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
@@ -367,7 +500,13 @@ public Vector2[] GetValueVector2Array()
return null;
}
- public Vector3 GetValueVector3 ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Vector3 GetValueVector3 ()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -376,7 +515,13 @@ public Vector3 GetValueVector3 ()
return new Vector3(vecInfo[0],vecInfo[1],vecInfo[2]);
}
- public Vector3[] GetValueVector3Array()
+ ///
+ /// Gets the value of the as an array of .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Vector3[] GetValueVector3Array()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -394,8 +539,13 @@ public Vector3[] GetValueVector3Array()
return null;
}
-
- public Vector4 GetValueVector4 ()
+ ///
+ /// Gets the value of the as an .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Vector4 GetValueVector4 ()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -403,8 +553,14 @@ public Vector4 GetValueVector4 ()
var vecInfo = (float[])Data;
return new Vector4(vecInfo[0],vecInfo[1],vecInfo[2],vecInfo[3]);
}
-
- public Vector4[] GetValueVector4Array()
+
+ ///
+ /// Gets the value of the as an array of .
+ ///
+ ///
+ /// Unable to cast this to type .
+ ///
+ public Vector4[] GetValueVector4Array()
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -422,6 +578,16 @@ public Vector4[] GetValueVector4Array()
return null;
}
+ ///
+ /// Sets the value of the .
+ ///
+ ///
+ /// Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.
+ ///
+ /// The value to assign to the .
+ ///
+ /// Unable to cast this to target type.
+ ///
public void SetValue (bool value)
{
if (ParameterClass != EffectParameterClass.Scalar || ParameterType != EffectParameterType.Bool)
@@ -438,12 +604,14 @@ public void SetValue (bool value)
}
/*
+ ///
public void SetValue (bool[] value)
{
throw new NotImplementedException();
}
*/
+ ///
public void SetValue (int value)
{
if (ParameterType == EffectParameterType.Single)
@@ -464,6 +632,7 @@ public void SetValue (int value)
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue(int[] value)
{
for (var i = 0; i < value.Length; i++)
@@ -472,6 +641,7 @@ public void SetValue(int[] value)
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue(Matrix value)
{
if (ParameterClass != EffectParameterClass.Matrix || ParameterType != EffectParameterType.Single)
@@ -588,6 +758,16 @@ public void SetValue(Matrix value)
StateKey = unchecked(NextStateKey++);
}
+ ///
+ /// Sets the value of the to the transpose of a .
+ ///
+ ///
+ /// Setting the value of an effect parameter is a slow operation. Avoid high-frequency calls.
+ ///
+ /// The value to assign to the .
+ ///
+ /// Unable to cast this to target type.
+ ///
public void SetValueTranspose(Matrix value)
{
if (ParameterClass != EffectParameterClass.Matrix || ParameterType != EffectParameterType.Single)
@@ -704,7 +884,8 @@ public void SetValueTranspose(Matrix value)
StateKey = unchecked(NextStateKey++);
}
- public void SetValue (Matrix[] value)
+ ///
+ public void SetValue (Matrix[] value)
{
if (ParameterClass != EffectParameterClass.Matrix || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -836,7 +1017,8 @@ public void SetValue (Matrix[] value)
StateKey = unchecked(NextStateKey++);
}
- public void SetValue (Quaternion value)
+ ///
+ public void SetValue (Quaternion value)
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -850,13 +1032,15 @@ public void SetValue (Quaternion value)
}
/*
+ ///
public void SetValue (Quaternion[] value)
{
throw new NotImplementedException();
}
*/
- public void SetValue (Single value)
+ ///
+ public void SetValue (Single value)
{
if (ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -864,22 +1048,25 @@ public void SetValue (Single value)
StateKey = unchecked(NextStateKey++);
}
- public void SetValue (Single[] value)
+ ///
+ public void SetValue (Single[] value)
{
for (var i=0; i
public void SetValue (string value)
{
throw new NotImplementedException();
}
*/
- public void SetValue (Texture value)
+ ///
+ public void SetValue (Texture value)
{
if (this.ParameterType != EffectParameterType.Texture &&
this.ParameterType != EffectParameterType.Texture1D &&
@@ -894,7 +1081,8 @@ public void SetValue (Texture value)
StateKey = unchecked(NextStateKey++);
}
- public void SetValue (Vector2 value)
+ ///
+ public void SetValue (Vector2 value)
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
throw new InvalidCastException();
@@ -905,13 +1093,15 @@ public void SetValue (Vector2 value)
StateKey = unchecked(NextStateKey++);
}
- public void SetValue (Vector2[] value)
+ ///
+ public void SetValue (Vector2[] value)
{
for (var i = 0; i < value.Length; i++)
Elements[i].SetValue (value[i]);
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue (Vector3 value)
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
@@ -924,6 +1114,7 @@ public void SetValue (Vector3 value)
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue (Vector3[] value)
{
for (var i = 0; i < value.Length; i++)
@@ -931,6 +1122,7 @@ public void SetValue (Vector3[] value)
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue (Vector4 value)
{
if (ParameterClass != EffectParameterClass.Vector || ParameterType != EffectParameterType.Single)
@@ -944,6 +1136,7 @@ public void SetValue (Vector4 value)
StateKey = unchecked(NextStateKey++);
}
+ ///
public void SetValue (Vector4[] value)
{
for (var i = 0; i < value.Length; i++)
@@ -951,4 +1144,4 @@ public void SetValue (Vector4[] value)
StateKey = unchecked(NextStateKey++);
}
}
-}
+}
\ No newline at end of file
diff --git a/MonoGame.Framework/Graphics/Effect/EffectPass.cs b/MonoGame.Framework/Graphics/Effect/EffectPass.cs
index a2798ff15d5..82a0161e3b2 100644
--- a/MonoGame.Framework/Graphics/Effect/EffectPass.cs
+++ b/MonoGame.Framework/Graphics/Effect/EffectPass.cs
@@ -2,6 +2,10 @@
namespace Microsoft.Xna.Framework.Graphics
{
+ ///
+ /// Contains the rendering state for drawing with an effect.
+ /// An effect can contain one or more passes.
+ ///
public class EffectPass
{
private readonly Effect _effect;
@@ -13,8 +17,14 @@ public class EffectPass
private readonly DepthStencilState _depthStencilState;
private readonly RasterizerState _rasterizerState;
+ ///
+ /// Gets the name of this pass.
+ ///
public string Name { get; private set; }
+ ///
+ /// Gets the collection of objects for this .
+ ///
public EffectAnnotationCollection Annotations { get; private set; }
internal EffectPass( Effect effect,
@@ -55,11 +65,14 @@ internal EffectPass(Effect effect, EffectPass cloneSource)
_blendState = cloneSource._blendState;
_depthStencilState = cloneSource._depthStencilState;
_rasterizerState = cloneSource._rasterizerState;
- Annotations = cloneSource.Annotations;
+ Annotations = cloneSource.Annotations;
_vertexShader = cloneSource._vertexShader;
_pixelShader = cloneSource._pixelShader;
}
+ ///
+ /// Begins this pass.
+ ///
public void Apply()
{
// Set/get the correct shader handle/cleanups.
diff --git a/MonoGame.Framework/Graphics/Effect/EffectTechnique.cs b/MonoGame.Framework/Graphics/Effect/EffectTechnique.cs
index c3a58813d04..007d844379f 100644
--- a/MonoGame.Framework/Graphics/Effect/EffectTechnique.cs
+++ b/MonoGame.Framework/Graphics/Effect/EffectTechnique.cs
@@ -1,32 +1,76 @@
using System;
namespace Microsoft.Xna.Framework.Graphics
{
- public class EffectTechnique
- {
- public EffectPassCollection Passes { get; private set; }
-
- public EffectAnnotationCollection Annotations { get; private set; }
-
- public string Name { get; private set; }
-
- internal EffectTechnique(Effect effect, EffectTechnique cloneSource)
- {
- // Share all the immutable types.
- Name = cloneSource.Name;
- Annotations = cloneSource.Annotations;
-
- // Clone the mutable types.
- Passes = cloneSource.Passes.Clone(effect);
- }
-
- internal EffectTechnique(Effect effect, string name, EffectPassCollection passes, EffectAnnotationCollection annotations)
- {
- Name = name;
- Passes = passes;
- Annotations = annotations;
- }
- }
+ ///
+ /// Represents a technique used in a shader effect.
+ ///
+ ///
+ /// Creating and assigning a EffectTechnique instance for each technique in your
+ /// is significantly faster than using the indexed property on .
+ ///
+ ///
+ /// 1) Create a EffectTechnique for each technique in your Effect.
+ ///
+ /// public EffectTechnique texture;
+ /// public EffectTechnique shadows;
+ /// public EffectTechnique shadowMap;
+ ///
+ /// 2) Assign an technique to your EffectTechnique.
+ ///
+ /// texture = effect.Techniques["TextureRender"];
+ /// shadowMap = effect.Techniques["ShadowMapRender"];
+ /// shadows = effect.Techniques["ShadowRender"];
+ ///
+ /// 3) Assign your EffectTechnique to the
+ /// of your before drawing.
+ ///
+ /// private void DrawScene(EffectTechnique technique)
+ /// {
+ /// MyEffect.mWorld.SetValue(terrainWorld);
+ /// MyEffect.MeshTexture.SetValue(terrainTex);
+ /// foreach (ModelMesh mesh in terrain.Meshes)
+ /// {
+ /// foreach (Effect effect in mesh.Effects)
+ /// {
+ /// effect.CurrentTechnique = technique;
+ /// mesh.Draw();
+ /// }
+ /// }
+ /// }
+ ///
+ ///
+ public class EffectTechnique
+ {
+ ///
+ /// Gets the collection of objects this rendering technique requires.
+ ///
+ public EffectPassCollection Passes { get; private set; }
+
+ ///
+ /// Gets the objects associated with this technique.
+ ///
+ public EffectAnnotationCollection Annotations { get; private set; }
+ ///
+ /// Gets the name of this technique.
+ ///
+ public string Name { get; private set; }
-}
+ internal EffectTechnique(Effect effect, EffectTechnique cloneSource)
+ {
+ // Share all the immutable types.
+ Name = cloneSource.Name;
+ Annotations = cloneSource.Annotations;
+ // Clone the mutable types.
+ Passes = cloneSource.Passes.Clone(effect);
+ }
+
+ internal EffectTechnique(Effect effect, string name, EffectPassCollection passes, EffectAnnotationCollection annotations)
+ {
+ Name = name;
+ Passes = passes;
+ Annotations = annotations;
+ }
+ }
+}
\ No newline at end of file
diff --git a/MonoGame.Framework/Graphics/Effect/IEffectMatrices.cs b/MonoGame.Framework/Graphics/Effect/IEffectMatrices.cs
index fc34eaf90cf..ca6255ad6ab 100644
--- a/MonoGame.Framework/Graphics/Effect/IEffectMatrices.cs
+++ b/MonoGame.Framework/Graphics/Effect/IEffectMatrices.cs
@@ -5,11 +5,22 @@
namespace Microsoft.Xna.Framework.Graphics
{
+ ///
+ /// Gets or sets transformation matrix parameters for the current effect.
+ ///
public interface IEffectMatrices
{
+ ///
+ /// Gets or sets the projection matrix in the current effect.
+ ///
Matrix Projection { get; set; }
+ ///
+ /// Gets or sets the view matrix in the current effect.
+ ///
Matrix View { get; set; }
+ ///
+ /// Gets or sets the world matrix in the current effect.
+ ///
Matrix World { get; set; }
}
-}
-
+}
\ No newline at end of file