Class EffectTechnique
Represents a technique used in a shader effect.
public class EffectTechnique
- Inheritance
-
EffectTechnique
- Inherited Members
Examples
1) Create a <b>EffectTechnique</b> for each technique in your Effect.
public EffectTechnique texture;
public EffectTechnique shadows;
public EffectTechnique shadowMap;
2) Assign an <xref href="Microsoft.Xna.Framework.Graphics.Effect" data-throw-if-not-resolved="false"></xref> technique to your <b>EffectTechnique</b>.
texture = effect.Techniques["TextureRender"];
shadowMap = effect.Techniques["ShadowMapRender"];
shadows = effect.Techniques["ShadowRender"];
3) Assign your <b>EffectTechnique</b> to the
<xref href="Microsoft.Xna.Framework.Graphics.Effect.CurrentTechnique" data-throw-if-not-resolved="false"></xref> of your <xref href="Microsoft.Xna.Framework.Graphics.Effect" data-throw-if-not-resolved="false"></xref> before drawing.
<pre><code class="lang-csharp">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(); } } }
Remarks
Creating and assigning a EffectTechnique instance for each technique in your Effect is significantly faster than using the Techniques indexed property on Effect.
Properties
Annotations
Gets the EffectAnnotation objects associated with this technique.
public EffectAnnotationCollection Annotations { get; }
Property Value
Name
Gets the name of this technique.
public string Name { get; }
Property Value
Passes
Gets the collection of EffectPass objects this rendering technique requires.
public EffectPassCollection Passes { get; }