Dim Tick As Integer |
Private Sub SetPointSprites(ByVal vs() As CustomVertex.PositionColored, ByVal vxbf As VertexBuffer, ByVal D9 As Device) Dim N As Single = 1.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 * Convert.ToSingle(Math.Cos(Tick / 75)), -N * Convert.ToSingle(Math.Sin(Tick / 75)), 1.0F, &HFFFFFFFF) vs(1) = New CustomVertex.PositionColored(-N * Convert.ToSingle(Math.Sin(Tick / 75)), N * Convert.ToSingle(Math.Cos(Tick / 75)), 1.0F, &HFFFFFFFF) vs(2) = New CustomVertex.PositionColored(N * Convert.ToSingle(Math.Sin(Tick / 75)), -N * Convert.ToSingle(Math.Cos(Tick / 75)), 1.0F, &HFFFFFFFF) vs(3) = New CustomVertex.PositionColored(N * Convert.ToSingle(Math.Cos(Tick / 75)), N * Convert.ToSingle(Math.Sin(Tick / 75)), 1.0F, &HFFFFFFFF) vxbf.Unlock() End Sub |
D9.RenderState.ZBufferWriteEnable = False D9.RenderState.PointSpriteEnable = True Me.SetPointSprites(Spots, PsB, D9) 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 |
PsTx = TextureLoader.FromFile(D9, Application.StartupPath & "\coridras2.bmp", 64, 64, 0, 0, Format.A8B8G8R8, Pool.Managed, Filter.Linear, Filter.None, &HFF00FF00) |
'Enable alphablending, which is transparency. D9.RenderState.AlphaBlendEnable = True 'When drawing something with X transparency, all of the transparency from the source is made transparent. D9.RenderState.SourceBlend = Blend.SourceAlpha 'And then, when transparency is drawn onto something else, the destination color is attenuated (interpolated) 'to the source color by the transparency amount D9.RenderState.DestinationBlend = Blend.InvSourceAlpha |