Пример #1
0
        /// <summary>
        /// Draw indexed vertices using the bound vertex buffer(s) and index buffer.
        /// </summary>
        /// <param name="indexCount">The number of indexed vertices to draw.</param>
        /// <param name="firstIndex">The index of the first index to draw with.</param>
        /// <param name="vertexOffset">A global offset applied to all index values before vertex lookup.</param>
        public void DrawIndexed(uint indexCount, uint firstIndex = 0, int vertexOffset = 0)
        {
            // Validate
            if (!IsRecording)
            {
                throw new InvalidOperationException("Cannot draw in a non-recording command recorder");
            }
            if (_vertexBufferCount != BoundPipeline !.VertexBindingCount)
            {
                throw new InvalidOperationException("Vertex buffers not fully bound in command recorder");
            }
            if (!_boundIndexBuffer)
            {
                throw new InvalidCastException("Cannot perform indexed drawing without a bound index buffer");
            }

            updateBindings();

            // Record
            _cmd !.Cmd.CmdDrawIndexed(indexCount, 1, firstIndex, vertexOffset, 0);
        }