Class Buffer.Vertex
Helper methods for creating Vertex Buffers.
public static class Buffer.Vertex
- Inheritance
-
objectBuffer.Vertex
Remarks
A Vertex Buffer is a Buffer that is used as input to the vertex shader stage. They store vertex data for 3D models (positions, normals, UVs, etc.).
Methods
New(GraphicsDevice, DataPointer, GraphicsResourceUsage)
Creates a new Vertex Buffer with initial data.
[Obsolete("This method is obsolete. Use the span-based methods instead")]
public static Buffer New(GraphicsDevice device, DataPointer dataPointer, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataPointerDataPointerThe data pointer to the data to initialize the Vertex buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Immutable.
Returns
New(GraphicsDevice, int, GraphicsResourceUsage, BufferFlags)
Creates a new Vertex Buffer of a given size.
public static Buffer New(GraphicsDevice device, int bufferSize, GraphicsResourceUsage usage = GraphicsResourceUsage.Default, BufferFlags additionalFlags = BufferFlags.None)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
bufferSizeintSize of the Buffer in bytes.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
additionalFlagsBufferFlagsAdditional Buffer flags. For example, you can specify StreamOutput to use the Buffer as a Stream Output target.
Returns
New(GraphicsDevice, ReadOnlySpan<byte>, GraphicsResourceUsage)
Creates a new Vertex Buffer with initial data.
public static Buffer New(GraphicsDevice device, ReadOnlySpan<byte> data, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable)
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataReadOnlySpan<byte>The data to initialize the Vertex buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Immutable.
Returns
New<T>(GraphicsDevice, GraphicsResourceUsage)
Creates a new Vertex Buffer.
public static Buffer<T> New<T>(GraphicsDevice device, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, int, GraphicsResourceUsage)
Creates a new Vertex Buffer.
public static Buffer<T> New<T>(GraphicsDevice device, int vertexCount, GraphicsResourceUsage usage = GraphicsResourceUsage.Default) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
vertexCountintThe number of vertices in this Buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Default.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, ref readonly T, GraphicsResourceUsage)
Creates a new Vertex Buffer with initial data.
public static Buffer<T> New<T>(GraphicsDevice device, ref readonly T value, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
valueTThe value to initialize the Vertex buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Immutable.
Returns
Type Parameters
TType of the data stored in the Buffer.
New<T>(GraphicsDevice, T[], GraphicsResourceUsage)
Creates a new Vertex Buffer with initial data.
public static Buffer<T> New<T>(GraphicsDevice device, T[] data, GraphicsResourceUsage usage = GraphicsResourceUsage.Immutable) where T : unmanaged
Parameters
deviceGraphicsDeviceThe GraphicsDevice.
dataT[]The data to initialize the Vertex buffer.
usageGraphicsResourceUsageThe usage for the Buffer, which determines who can read/write data. By default, it is Immutable.
Returns
Type Parameters
TType of the data stored in the Buffer.