public void WriteAttribDescriptions(Span <VertexAttribDescription> descriptions)
 {
     descriptions[0] = new VertexAttribDescription(AttributeType.FloatVec3);
     descriptions[1] = new VertexAttribDescription(AttributeType.FloatVec3);
     descriptions[2] = new VertexAttribDescription(AttributeType.FloatVec4, true, AttributeBaseType.UnsignedByte);
     descriptions[3] = new VertexAttribDescription(AttributeType.FloatVec2);
 }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a <see cref="VertexAttribSource"/> that represents padding. This means that the created
        /// <see cref="VertexAttribSource"/> will not indicate a buffer to read data from or use a vertex
        /// attribute index, it will just leave an ignored space between other attributes.
        /// </summary>
        /// <param name="bufferSubset">The <see cref="BufferObjectSubset"/> where the padding will be added.</param>
        /// <param name="paddingBytes">The amount of space to leave empty, measured in bytes.</param>
        public VertexAttribSource(DataBufferSubset bufferSubset, uint paddingBytes)
        {
            if (bufferSubset == null)
            {
                throw new ArgumentNullException(nameof(bufferSubset));
            }

            if (bufferSubset.BufferTarget != BufferTargetARB.ArrayBuffer)
            {
                throw new ArgumentException("The specified BufferObjectSubset must be usable as vertex attrib data. Try using a VertexDataBufferSubset", nameof(bufferSubset));
            }

            BufferSubset      = bufferSubset;
            AttribDescription = new VertexAttribDescription(paddingBytes);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a <see cref="VertexAttribSource"/> with a given <see cref="BufferObjectSubset"/>
        /// and the given <see cref="VertexAttribDescription"/>.
        /// </summary>
        /// <param name="bufferSubset">The <see cref="BufferObjectSubset"/> where the vertex attrib data is located. Must be a subset usable for vertex data.</param>
        /// <param name="attribDesc">The <see cref="VertexAttribDescription"/> describing the vertex attribute.</param>
        public VertexAttribSource(DataBufferSubset bufferSubset, VertexAttribDescription attribDesc)
        {
            if (bufferSubset == null)
            {
                throw new ArgumentNullException(nameof(bufferSubset));
            }

            if (bufferSubset.BufferTarget != BufferTarget.ArrayBuffer)
            {
                throw new ArgumentException("The specified " + nameof(BufferObjectSubset) + " must be usable as vertex attrib data. Try using a VertexDataBufferSubset", nameof(bufferSubset));
            }

            BufferSubset      = bufferSubset;
            AttribDescription = attribDesc;
        }
Exemplo n.º 4
0
 public void WriteAttribDescriptions(Span <VertexAttribDescription> descriptions)
 {
     descriptions[0] = new VertexAttribDescription(AttributeType.FloatVec3);
     descriptions[1] = new VertexAttribDescription(AttributeType.FloatVec3);
 }
Exemplo n.º 5
0
 /// <summary>
 /// Creates a <see cref="VertexAttribSource"/> that specifies padding for the amount
 /// of bytes used by a specified <see cref="AttributeType"/>.
 /// </summary>
 /// <param name="bufferSubset">The buffer subset in which the padding will be applied.</param>
 /// <param name="attribType">The type of the attribute, for calculating paddign.</param>
 /// <remarks>
 /// Padding indicators ignore padding based on type that occurs when using compensation
 /// for struct padding (which is the default behavior in <see cref="VertexArray"/>).
 /// </remarks>
 public static VertexAttribSource CreatePadding(DataBufferSubset bufferSubset, AttributeType attribType)
 {
     return(new VertexAttribSource(bufferSubset, VertexAttribDescription.CreatePadding(attribType)));
 }
Exemplo n.º 6
0
 /// <summary>
 /// Creates a <see cref="VertexAttribSource"/> that specifies padding for an
 /// amount of bytes calculated based on the baseType and size parameters.
 /// </summary>
 /// <param name="bufferSubset">The buffer subset in which the padding will be applied.</param>
 /// <param name="baseType">The base type of the attribute.</param>
 /// <param name="size">The size of the attribute.</param>
 public static VertexAttribSource CreatePadding(DataBufferSubset bufferSubset, VertexAttribPointerType baseType, uint size)
 {
     return(new VertexAttribSource(bufferSubset, VertexAttribDescription.CreatePadding(baseType, size)));
 }