DrawIndexedPrimitive()


HRESULT DrawIndexedPrimitive(  
  
     D3DPRIMITIVETYPE Type,                 //   
  
     INT BaseVertexIndex,                   //   
  
     UINT MinIndex,                         // BaseVertexIndex   
  
     UINT NumVertices,                      // ,   
  
     UINT StartIndex,                       //   
  
  
  
     UINT PrimitiveCount                   //   
    );  

Parameters
Type
[in] Member of the D3DPRIMITIVETYPE enumerated type, describing the type of primitive to render.
D3DPT_POINTLIST is not supported with this method. See Remarks.
BaseVertexIndex
[in] Offset from the start of the vertex buffer to the first vertex index. An index of 0 in the index buffer refers to this location in the vertex buffer.
MinIndex
[in] Minimum vertex index for vertices used during this call. This is a zero based index relative to
BaseVertexIndex.
NumVertices
[in] Number of vertices used during this call. The first vertex is located at index:
BaseVertexIndex +
MinIndex.
StartIndex
[in] Index of the first index to use when accesssing the vertex buffer. Beginning at
StartIndex to index vertices from the vertex buffer.
PrimitiveCount
[in] Number of primitives to render. The number of vertices used is a function of the primitive count and the primitive type. The maximum number of primitives allowed is determined by checking the
MaxPrimitiveCount member of the D3DCAPS9 structure.
 
Type--あまり説明しないパラメータは、線分や三角形など、シンボルタイプです.
BaseVertexIndex--これはオフセット量として使用されます.たとえば、インデックスバッファの頂点がVx=10(Vxは頂点配列の下付き文字を表し、以下同じ)である場合、Vxが実際にグラフィックスカードに渡されるのはVx+BaseVertexIndexですが、なぜこのパラメータを追加するのでしょうか.彼の利点は、もし私が一度に1つの頂点バッファに他のいくつかの頂点バッファを加えたら、私はもう1つのインデックスバッファで頂点を位置決めすると問題があります.例えば、元のバッファAがあり、そのうちの1つの頂点Vx=10だったので、今私はこのバッファをあるバッファBの後ろに添付しました.この時、頂点のインデックスは依然としてVx=10でしたが、下の10という頂点はもう元のものではありません.前にバッファBが付いているからです.従来のDX 8では,インデックスバッファを修正することで対応する効果を得ることができたが,この操作の時間的複雑さはO(n)であり,DXに任せて自分で処理するだけでは使えない.
MinVertexIndex-頂点の最小下付き文字は、その名の通り、今回の描画で使用される頂点の最小下付き文字です.(D 3 Dを最適化用に見積もって、次のパラメータの説明を参照)
NumVertices--これはおそらく最も穴のお父さんのパラメータで、ネット上で与えられた言い方はすべて:使った頂点数ですが、実際には?使用した頂点数でパラメータを作成しようとすると、PIXでプログラムをデバッグすると、Index Out Of Range(インデックスが境界を超えている)のような様々なエラーが発生し、PIXが深刻にクラッシュします.大量の資料を調べて、やっとこのパラメータの意味が分かった:一度の描画で頂点バッファのスパン(すなわちVmax-Vmin+1)は、スパンだけで頂点数とは限らない、つまり使われていない頂点を含むことができる......そういえば、最適化として使うのは理にかなっている.MinVertexIndexを知ってから、D 3 DでMinVertexIndex---(MinVertexIndex+NumVertices-1)のデータを抽出してレンダリングし、不要なメモリオーバーヘッドを省くことができます......、ポイントバッファの3,4,6,8,23を使用すると、MinVertexIndex=3、NumVertices=21、
StartIndex-この関数は簡単で、インデックスバッファの最初の下付き文字を表します.
PrimitiveCount--StartIndexとD 3 DPTを組み合わせてインデックスバッファを位置決めするために描画されたエンティティの数