Class EffectTechnique
Represents a technique used in a shader effect.
public class EffectTechnique
- Inheritance
-
EffectTechnique
- Inherited Members
Examples
- Create a EffectTechnique for each technique in your Effect.
public EffectTechnique texture;
public EffectTechnique shadows;
public EffectTechnique shadowMap;
- Assign an Effect technique to your EffectTechnique.
texture = effect.Techniques["TextureRender"];
shadowMap = effect.Techniques["ShadowMapRender"];
shadows = effect.Techniques["ShadowRender"];
- Assign your EffectTechnique to the CurrentTechnique of your Effect 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();
}
}
}
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; }