Device.SetStreamSource(Int32,VertexBuffer,Int32)
SetStreamSource メソッド
使用例
- シーンの生成
頂点バッファをデバイスのデータ ストリームにバインドする。
定義
Visual Basic | Public Sub SetStreamSource( _ ByVal streamNumber As Integer, _ ByVal streamData As VertexBuffer, _ ByVal offsetInBytes As Integer _ ) |
C# | public void SetStreamSource( int streamNumber, VertexBuffer streamData, int offsetInBytes ); |
Managed C++ | public: void SetStreamSource( int streamNumber, VertexBuffer* streamData, int offsetInBytes ); |
JScript | public function SetStreamSource( streamNumber : int, streamData : VertexBuffer, offsetInBytes : int ) : void; |
パラメータ
streamNumber | System.Int32. |
streamData | Microsoft.DirectX.Direct3D.VertexBuffer. |
offsetInBytes | System.Int32. |
使用例
シーンの生成
この例では、シーンの生成を開始して、プリミティブを描画する方法を示す。
SetStreamSource メソッドは、頂点バッファをデバイス データ ストリームにバインドし、頂点データと、プリミティブ処理関数にデータを供給するデータ ストリーム ポートの 1 つとを関連付ける。このメソッドの引数は、データ ストリームの数、VertexBuffer オブジェクトの名前、ストリームの頂点ストライドである。
この例では、DrawPrimitives は、PrimitiveType 列挙の TriangleList 定数または TriangleStrip 定数のいずれかを使って、プリミティブをレンダリングできる。
using Microsoft.DirectX.Direct3D;
// Define custom vertex format
private struct customVertex
{
// Define structure
}
Device device = null; // Create rendering device
VertexBuffer vBuffer = null; // Create vertex buffer
// Begin the scene
device.BeginScene();
device.SetStreamSource( 0, vBuffer, 0);
// Assign custom vertex type, in this case a transformed, lit, and colored format
device.VertexFormat = CustomVertex.TransformedLitColored.Format;
device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);
// Alternative primitive rendering using TriangleStrip
// device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, (4*25)-2);
対象
© 2002 Microsoft Corporation. All rights reserved. Terms of use.