1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Sub Render(ByVal Min As Vector3, ByVal Max As Vector3, ByVal Color As System.Drawing.Color)
Dim indices As Integer() = New Integer() {0, 1, 1, 2, 2, 3, 3, 0, 0, 4, 1, 5, 2, 6, 3, 7, 4, 5, 5, 6, 6, 7, 7, 4}
Dim vert(7) As Microsoft.DirectX.Direct3D.CustomVertex.PositionColored
vert(0).Position = Min
vert(1).Position = New Vector3(max.X, Min.Y, Min.Z)
vert(2).Position = New Vector3(max.X, Min.Y, Max.Z)
vert(3).Position = New Vector3(Min.X, Min.Y, Max.Z)
vert(4).Position = New Vector3(Min.X, Max.Y, Min.Z)
vert(5).Position = New Vector3(Max.X, Max.Y, Min.Z)
vert(6).Position = New Vector3(Max.X, Max.Y, Max.Z)
vert(7).Position = New Vector3(Min.X, Max.Y, Max.Z)
For i As Integer = 0 To 7
vert(i).Color = Color.ToArgb
Next
Device.Transform.World = MatriceDeTonObjet
Device.VertexFormat = CustomVertex.PositionColored.Format
'8 = vertexindices , 12 = primitivecount
Device.DrawIndexedUserPrimitives(PrimitiveType.LineList, 0, 8, 12, indices, False, vert)
End Sub |
Partager