Microsoft DirectX 8.0 (Visual Basic)

三角形ファン

三角形ファンとは、次の図に示すように、すべての三角形が 1 つの頂点を共有するという点を除いては、三角形ストリップに類似したものである。

システムでは、頂点 v2、v3、v1 を使用して最初の三角形を、v3、v4、v1 を使用して 2 番目の三角形を、v4、v5、v1 を使用して 3 番目の三角形を、という手順で描画していく。フラット シェーディングが有効な場合、三角形は最初の頂点の色でシェーディングされる。

次の図は、レンダリングされる三角形ファンを示している。

次のコードは、三角形ファンに対して頂点を作成する方法を示している。

Private Type CUSTOMVERTEX
    x As Single
    y As Single
    z As Single
End Type

Dim Vertices(5) As CUSTOMVERTEX
With Vertices(0): .x =  0.0: .y =  0.0: .z = 0.0: End With
With Vertices(1): .x = -5.0: .y = -5.0: .z = 0.0: End With
With Vertices(2): .x = -3.0: .y =  7.0: .z = 0.0: End With
With Vertices(3): .x =  0.0: .y = 10.0: .z = 0.0: End With
With Vertices(4): .x =  3.0: .y =  7.0: .z = 0.0: End With
With Vertices(5): .x =  5.0: .y =  5.0: .z = 0.0: End With