Share via


Device.TextureState

TextureState プロパティ

使用例

  • テクスチャと頂点色のブレンド

割り当てられているテクスチャのステート値を取得する。

定義

Visual Basic Public ReadOnly Property TextureState As TextureStates
C# public TextureStates TextureState { get; }
Managed C++ public: __property TextureStates* get_TextureState();
JScript public function get TextureState() : TextureStates

プロパティ値

Microsoft.DirectX.Direct3D.TextureStates.

これは読み取り専用プロパティである。 

使用例

テクスチャと頂点色のブレンド

この例では、色のブレンドとアルファの設定によって、ステージ 0 のテクスチャ ステートを作成する方法を示す。

このコードでは、TextureState プロパティの 0 番目のステージのみが更新される。出力カラーは、テクスチャ カラーとディフューズ カラーを、赤、緑、青チャンネルごとに乗算したもので、アルファ値は乗算しない。次のプロパティは、アプリケーション定義の myRender メソッドで設定される。

  1. ColorOperation カラー処理プロパティは Modulate に設定する。これは、ColorArgument1ColorArgument2 の ARGB 成分をそれぞれに乗算する。赤は、ColorArgument1 の赤の値と ColorArgument2 の赤の値の積になる。他の色も同様である。
  2. 1 番目のカラー引数 ColorArgument1 は、テクスチャ カラーの TextureColor に設定する。
  3. 2 番目のカラー引数 ColorArgument2 は、ディフューズ色の Diffuse に設定する。
  4. AlphaOperation アルファ処理プロパティは Disable に設定する。これは、このテクスチャ ステージからの出力、およびより高いインデックスを持つステージからの出力をすべて無効にする。
using Microsoft.DirectX.Direct3D;

public class myTextures : System.Windows.Forms.Form
{
    // Global variables for this project
    Device device = null;   // Rendering device
    Texture texture = null; // Texture object
    
    private void myRender()
    {
        .
        .
        .
        // Set up texture.
        device.SetTexture(0,texture);
    
        device.TextureState[0].ColorOperation = TextureOperation.Modulate;
        device.TextureState[0].ColorArgument1 = TextureArgument.TextureColor;
        device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
        device.TextureState[0].AlphaOperation = TextureOperation.Disable;
        .
        .
        .
    }
    .
    .
    .
}

対象

Device

© 2002 Microsoft Corporation. All rights reserved. Terms of use.