Example #1
0
    public void DrawRectangleWithMaterial(Span <Vertex2d> corners, IMdfRenderMaterial material)
    {
        MdfRenderOverrides overrides = new MdfRenderOverrides();

        overrides.ignoreLighting = true;
        overrides.uiProjection   = true;
        material?.Bind((WorldCamera)null, _device, Array.Empty <Light3d>(), overrides);

        _device.SetDepthStencilState(noDepthState);

        foreach (ref var vertex in corners)
        {
            vertex.normal = new Vector4(0, 0, -1, 0);
        }

        // Copy the vertices
        _device.UpdateBuffer <Vertex2d>(vertexBuffer, corners);

        mdfBufferBinding.Bind();

        _device.SetIndexBuffer(indexBuffer);

        _device.DrawIndexed(PrimitiveType.TriangleList, 4, 6);
    }
 public void Update <T>(ReadOnlySpan <T> data) where T : struct
 {
     _device.UpdateBuffer(this, data);
 }
 public void Update(ReadOnlySpan <ushort> indices)
 {
     Trace.Assert(indices.Length == Count);
     _device.UpdateBuffer(this, indices);
 }