D9.RenderState.PointSize = 2.0F D9.RenderState.PointSizeMin = 1.0F D9.RenderState.PointSizeMax = 64.0F D9.RenderState.PointScaleC = 16.0F |
Dim Spots() As CustomVertex.PositionColored 'For the point sprites, we need vertices. |
Dim PsB As VertexBuffer |
'That is a LOT of non-trivial parameters. PsB = New VertexBuffer(GetType(CustomVertex.PositionColored), 4, D9, Usage.WriteOnly, CustomVertex.PositionColored.Format, Pool.Managed) |
Private Sub SetPointSprites(ByVal vs() As CustomVertex.PositionColored, ByVal vxbf As VertexBuffer, ByVal D9 As Device) Dim N As Single = 5.0F Dim A As Array = vxbf.Lock(0, LockFlags.None) 'It returns a vanilla array... vs = DirectCast(A, CustomVertex.PositionColored()) vs(0) = New CustomVertex.PositionColored(-N, -N, N, &HFFFF0000) vs(1) = New CustomVertex.PositionColored(-N, N, N, &HFF00FF00) vs(2) = New CustomVertex.PositionColored(N, -N, N, &HFFFFFF00) vs(3) = New CustomVertex.PositionColored(N, N, N, &HFF00FFFF) vxbf.Unlock() End Sub |
SetVertexBufferData(Vertices, VxB, D9) SetPointSprites(Spots, PsB, D9) |
D9.RenderState.ZBufferWriteEnable = False D9.RenderState.PointSpriteEnable = True D9.RenderState.PointScaleEnable = True D9.SetStreamSource(0, PsB, 0) D9.VertexFormat = CustomVertex.PositionColored.Format D9.SetTexture(0, PsTx) 'Sets the active texture. The 0 is up for discussion. D9.DrawPrimitives(PrimitiveType.PointList, 0, 4) D9.RenderState.ZBufferWriteEnable = True D9.RenderState.PointSpriteEnable = False D9.RenderState.PointScaleEnable = False |
Dim Tx, PsTx As Texture |