コード例 #1
0
        /// <summary>
        /// Describes a new vertex from a set of bindings.
        /// </summary>
        /// <param name="bindings">The bindings describing the vertex.</param>
        public VertexDescription(params VertexBinding[] bindings)
        {
            if (bindings.Length == 0)
            {
                throw new ArgumentException("Cannot create a vertex description with zero bindings.");
            }
            var binds = new VertexBinding[bindings.Length];
            var ec    = 0;

            bindings.ForEach((b, idx) => {
                binds[idx] = new VertexBinding(b.Stride, b.PerInstance, b.Elements);
                ec        += b.Elements.Length;
            });
            Bindings     = binds;
            ElementCount = (uint)ec;
        }
コード例 #2
0
ファイル: VertexBuffer.cs プロジェクト: SpectrumLib/Spectrum
 /// <summary>
 /// Creates a new vertex buffer to hold the given vertex type.
 /// </summary>
 /// <param name="binding">The layout of the vertex type held in the buffer.</param>
 /// <param name="count">The number of vertices in the buffer.</param>
 public VertexBuffer(VertexBinding binding, uint count) :
     base(binding.Stride * count, BufferType.Vertex, Vk.BufferUsages.VertexBuffer)
 {
     Binding     = binding.Copy();
     VertexCount = count;
 }