次の方法で共有


Effect.Techniques Property

Gets a collection of techniques that are defined for this effect.

Namespace: Microsoft.Xna.Framework.Graphics
Assembly: Microsoft.Xna.Framework (in microsoft.xna.framework.dll)

Syntax

public EffectTechniqueCollection Techniques { get; }

Property Value

A collection of techniques that are defined for this effect.

Remarks

Note

The BasicEffect class, which is derived from Effect and inherits the Techniques collection, contains only one available technique which will apply the settings which have been set as the properties of the BasicEffect.

Example

In this example, an effect file is shown that defines a single technique called TransformTechnique.

uniform extern float4x4 WorldViewProj : WORLDVIEWPROJECTION;

struct VS_OUTPUT
{
    float4 position : POSITION;
    float4 color : COLOR0;
};

VS_OUTPUT Transform(
    float4 Pos  : POSITION, 
    float4 Color : COLOR0 )
{
    VS_OUTPUT Out = (VS_OUTPUT)0;

    Out.position = mul(Pos, WorldViewProj);
    Out.color = Color;

    return Out;
}

float4 PixelShader( VS_OUTPUT vsout ) : COLOR
{
    return vsout.color;
}

technique TransformTechnique
{
    pass P0
    {
        vertexShader = compile vs_2_0 Transform();
        pixelShader = compile ps_1_1 PixelShader();
    }
}

When this effect file is loaded as an Effect by the ContentManager, this technique may be set as the active technique by setting CurrentTechnique to effect.Techniques["TransformTechnique"].

See Also

Tasks

How to: Create and Apply Custom Effects

Reference

Effect.CurrentTechnique Property
Effect Class
Effect Members
Microsoft.Xna.Framework.Graphics Namespace

Platforms

Xbox 360, Windows XP SP2, Windows Vista