BaseMesh.DrawSubset(Int32)

DrawSubset メソッド

使用例

  • メッシュのマテリアルとテクスチャのレンダリング

メッシュのサブセットを描画する。

定義

Visual Basic Public Sub DrawSubset( _
    ByVal attributeID As Integer _
)
C# public void DrawSubset(
    int attributeID
);
Managed C++ public: void DrawSubset(
    int attributeID
);
JScript public function DrawSubset(
    attributeID : int
) : void;

パラメータ

attributeID System.Int32.

使用例

メッシュのマテリアルとテクスチャのレンダリング

この例では、メッシュ オブジェクトにマテリアルとテクスチャのプロパティを適用する方法を示す。

プロパティが適用されたメッシュは、Mesh.DrawSubset メソッドを呼び出せばディスプレイにレンダリングされる。

using Microsoft.DirectX.Direct3D;

public class Meshes : System.Windows.Forms.Form
{
    // Global variables for this project
    Device device = null;     // Rendering device
    Mesh mesh = null;         // Mesh object
    Material[] meshMaterials; // Materials for mesh
    Texture[] meshTextures;   // Textures for mesh
    
    private void Render()
    {
        // Meshes are divided into subsets, one for each material.
        // Render them in a loop.
        for( int i=0; i<meshMaterials.Length; i++ )
        {
            // Set the material and texture for this subset\
            device.Material = meshMaterials[i];
            device.SetTexture(0, meshTextures[i]);
            
            // Draw the mesh subset
            mesh.DrawSubset(i);
            .
            .
            .
        }
    .
    .
}

対象

BaseMesh, Mesh, ProgressiveMesh

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