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]); }
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); }
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(); }
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(); }
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) { }
public override CircularBuffer CreateCircularBuffer(ShaderWithFormat shader, BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles) { return(new XnaCircularBuffer(this, shader, blendMode, drawMode)); }
private static PrimitiveType Convert(VerticesMode mode) { switch (mode) { case VerticesMode.Lines: return PrimitiveType.LineList; default: return PrimitiveType.TriangleList; } }
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); }
private void DoDraw(VerticesMode mode, int verticesCount) { var primitiveMode = Convert(mode); var primitiveCount = GetPrimitiveCount(verticesCount, primitiveMode); device.NativeDevice.DrawPrimitives(primitiveMode, 0, primitiveCount); }
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; }
public MockCircularBuffer(Device device, ShaderWithFormat shader, BlendMode blendMode, VerticesMode drawMode) : base(device, shader, blendMode, drawMode) { }
public abstract void DrawVertices(VerticesMode mode, VertexPositionColor[] vertices);
public abstract CircularBuffer CreateCircularBuffer(ShaderWithFormat shader, BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles);
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); }
public override CircularBuffer CreateCircularBuffer(ShaderWithFormat shader, BlendMode blendMode, VerticesMode drawMode = VerticesMode.Triangles) { return new MockCircularBuffer(this, shader, blendMode, drawMode); }
private void DoDraw(VerticesMode mode, int vertexCount) { var primitiveMode = Convert(mode); var context = device.Context; context.InputAssembler.PrimitiveTopology = primitiveMode; context.Draw(vertexCount, 0); }