Sdílet prostřednictvím


VertexBufferContent.Write Generic Method (Int32, Int32, Generic IEnumerable)

Writes additional data into the vertex buffer. Writing begins at the specified byte offset, and each value is spaced according to the specified stride value (in bytes).

Namespace: Microsoft.Xna.Framework.Content.Pipeline.Processors
Assembly: Microsoft.Xna.Framework.Content.Pipeline (in microsoft.xna.framework.content.pipeline.dll)

Syntax

public void Write<T> (
         int offset,
         int stride,
         IEnumerable<T> data
)

Type Parameters

  • T
    Type being written.

Parameters

  • offset
    Offset to begin writing at.
  • stride
    Stride of the data being written, in bytes.
  • data
    Enumerated collection of data.

Remarks

This method automatically grows the vertex buffer if an attempt is made to write past the buffer end. Write throws NotSupportedException if the specified data type cannot be packed into a vertex buffer. For example, if data is not a valid value type.

Use this method to interleave vertex data channels into a single buffer. This can be done by passing the total vertex size as the stride and suitable smaller offsets for each channel. You can also concatenate entire vertex buffers by passing the length of the vertex as the offset, 1 as the stride, and the vertex data as the data parameter.

See Also

Reference

VertexBufferContent Class
VertexBufferContent Members
Microsoft.Xna.Framework.Content.Pipeline.Processors Namespace

Platforms

Windows XP SP2, Windows Vista