public void Render(CommandList cl, ITextArray textArray) { cl.SetVertexBuffer(0, _vertexBuffer); cl.SetIndexBuffer(_indexBuffer, IndexFormat.UInt16); cl.SetPipeline(_pipeline); cl.SetGraphicsResourceSet(0, _projectionTextureResourceSet); // draw characters for (uint row = 0; row < textArray.Height; ++row) { for (uint col = 0; col < textArray.Width; ++col) { var c = textArray[col, row]; if (c == null || c.Char <= ' ') { continue; } cl.UpdateBuffer(_worldBuffer, 0, Matrix4x4.CreateTranslation( col, row, 0)); cl.UpdateBuffer(_colorBuffer, 0, c.ForeColor); cl.DrawIndexed( indexCount: 4, instanceCount: 1, indexStart: 0, vertexOffset: c.Char * 4, instanceStart: 0); } } }
public BufferWindow(ITextArray sourceBuffer, uint windowWidth, uint windowHeight) { _sourceBuffer = sourceBuffer; Width = windowWidth; Height = windowHeight; }