Microsoft DirectX 8.0 (C++)

エフェクト ファイルのサンプル

次に示すのは、標準的なエフェクト ファイルの基本構文およびレイアウトである。

//
// サンプル エフェクト。
// このエフェクトは、シングル パス手法またはマルチパス手法を使用して、2 つのテクスチャを追加する。
//

texture tex0;
texture tex1;


// シングル パス。

technique t0
{
    pass p0
    {
        Texture[0] = <tex0>;
        Texture[1] = <tex1>;
        
        ColorOp[0] = SelectArg1;
        ColorArg1[0] = Texture;
        
        ColorOp[1] = Add;
        ColorArg1[0] = Texture;
        ColorArg2[0] = Current;
        
        ColorOp[2] = Disable;
    }
}

// マルチパス。

technique t1
{
    pass p0
    {
        Texture[0] = <tex0>;
        
        ColorOp[0] = SelectArg1;
        ColorArg1[0] = Texture;
        ColorOp[1] = Disable;  
    }
    
    pass p1
    {
        AlphaBlendEnable = True;        
        SrcBlend = One;
        DestBlend = One;
 
        Texture[1] = <tex1>;
               
        ColorOp[1] = SelectArg1;
        ColorArg1[1] = Texture;
        ColorOp[1] = Disable;  
    }
}