Ejemplo n.º 1
0
 public override void DrawVertices(VerticesMode mode, VertexPositionColor[] vertices)
 {
     SetColor(vertices[0].Color);
     if (mode == VerticesMode.Lines)
         for (int num = 0; num + 1 < vertices.Length; num += 2)
             DrawLines(vertices[num], vertices[num + 1]);
     else
         for (int num = 0; num + 3 < vertices.Length; num += 4)
             DrawRectangles(vertices[num], vertices[num + 2]);
 }
Ejemplo n.º 2
0
 public override void DrawVertices(VerticesMode mode, VertexPositionColor[] vertices)
 {
     CheckCreatePositionColorBuffer();
     device.NativeDevice.SetVertexBuffers(null);
     positionColorVertexBuffer.SetData(vertices);
     BindVertexBuffer(positionColorVertexBuffer);
     ApplyEffect(true);
     if (lastIndicesCount == -1)
         DoDraw(mode, vertices.Length);
     else
         DoDrawIndexed(mode, vertices.Length, lastIndicesCount);
 }
Ejemplo n.º 3
0
 public override void DrawVertices(VerticesMode mode, VertexPositionColorTextured[] vertices)
 {
     CheckCreatePositionColorTextureBuffer();
     device.SetData(positionColorUvVertexBuffer, vertices, vertices.Length);
     drawShader.Apply();
     BindVertexBuffer(positionColorUvVertexBuffer, VertexPositionColorTextured.SizeInBytes);
     if (lastIndicesCount == -1)
         DoDraw(mode, vertices.Length);
     else
         DoDrawIndexed(mode, lastIndicesCount);
     AfterDraw();
 }
Ejemplo n.º 4
0
 protected CircularBuffer(Device device, ShaderWithFormat shader, BlendMode blendMode,
                          VerticesMode drawMode)
 {
     this.device         = device;
     this.shader         = shader;
     this.blendMode      = blendMode;
     this.drawMode       = drawMode;
     vertexSize          = shader.Format.Stride;
     indexSize           = sizeof(short);
     maxNumberOfVertices = DefaultMaxNumberOfVertices;
     maxNumberOfIndices  = DefaultMaxNumberOfIndices;
     Initialize();
 }
Ejemplo n.º 5
0
 public override void DrawVertices(VerticesMode mode, VertexPositionColorTextured[] vertices)
 {
     CheckCreatePositionColorTextureBuffer();
     positionColorUvVertexBuffer.SetData(vertices, 0, vertices.Length, SetDataOptions.Discard);
     BindVertexBuffer(positionColorUvVertexBuffer);
     if (lastTexture != device.NativeDevice.Textures[0])
     {
         ApplyEffect(true);
         lastTexture = device.NativeDevice.Textures[0];
     }
     if (lastIndicesCount == -1)
         DoDraw(mode, vertices.Length);
     else
         DoDrawIndexed(mode, vertices.Length, lastIndicesCount);
 }
 public SharpDXCircularBuffer(Device device, ShaderWithFormat shader, BlendMode blendMode,
                              VerticesMode drawMode = VerticesMode.Triangles)
     : base(device, shader, blendMode, drawMode)
 {
 }
Ejemplo n.º 7
0
 public override CircularBuffer CreateCircularBuffer(ShaderWithFormat shader,
                                                     BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles)
 {
     return(new XnaCircularBuffer(this, shader, blendMode, drawMode));
 }
Ejemplo n.º 8
0
 private static PrimitiveType Convert(VerticesMode mode)
 {
     switch (mode)
     {
     case VerticesMode.Lines:
         return PrimitiveType.LineList;
     default:
         return PrimitiveType.TriangleList;
     }
 }
Ejemplo n.º 9
0
 private void DoDrawIndexed(VerticesMode mode, int indexCount)
 {
     var primitiveMode = Convert(mode);
     var context = device.Context;
     context.InputAssembler.PrimitiveTopology = primitiveMode;
     device.Context.InputAssembler.SetIndexBuffer(indexBuffer, Format.R16_UInt, 0);
     context.DrawIndexed(indexCount, 0, 0);
 }
Ejemplo n.º 10
0
 private void DoDraw(VerticesMode mode, int verticesCount)
 {
     var primitiveMode = Convert(mode);
     var primitiveCount = GetPrimitiveCount(verticesCount, primitiveMode);
     device.NativeDevice.DrawPrimitives(primitiveMode, 0, primitiveCount);
 }
Ejemplo n.º 11
0
 public abstract CircularBuffer CreateCircularBuffer(ShaderWithFormat shader,
                                                     BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles);
 public SlimDXCircularBuffer(Device device, ShaderWithFormat shader, BlendMode blendMode,
                             VerticesMode drawMode = VerticesMode.Triangles)
     : base(device, shader, blendMode, drawMode)
 {
     (device as SlimDXDevice).DisposeNativeBuffers += DisposeNative;
 }
Ejemplo n.º 13
0
 public MockCircularBuffer(Device device, ShaderWithFormat shader, BlendMode blendMode,
                           VerticesMode drawMode)
     : base(device, shader, blendMode, drawMode)
 {
 }
Ejemplo n.º 14
0
 public abstract void DrawVertices(VerticesMode mode, VertexPositionColor[] vertices);
Ejemplo n.º 15
0
		public abstract CircularBuffer CreateCircularBuffer(ShaderWithFormat shader,
			BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles);
Ejemplo n.º 16
0
 private void DoDrawIndexed(VerticesMode mode, int verticesCount, int indicesCount)
 {
     var primitiveMode = Convert(mode);
     var primitiveCount = GetPrimitiveCount(indicesCount, primitiveMode);
     device.NativeDevice.DrawIndexedPrimitives(primitiveMode, 0, 0, verticesCount, 0,
         primitiveCount);
 }
Ejemplo n.º 17
0
		public override CircularBuffer CreateCircularBuffer(ShaderWithFormat shader,
			BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles)
		{
			return new MockCircularBuffer(this, shader, blendMode, drawMode);
		}
Ejemplo n.º 18
0
 private void DoDraw(VerticesMode mode, int vertexCount)
 {
     var primitiveMode = Convert(mode);
     var context = device.Context;
     context.InputAssembler.PrimitiveTopology = primitiveMode;
     context.Draw(vertexCount, 0);
 }