VertexBuffer Class Reference

Class representing the vertex buffer. More...

List of all members.

Public Member Functions

 VertexBuffer (int vertexCount, params VertexFormat[] formats)
 Creates the vertex buffer.
 VertexBuffer (int vertexCount, int indexCount, params VertexFormat[] formats)
 Creates a vertex buffer (with an index array)
 VertexBuffer (int vertexCount, int indexCount, int instDivisor, params VertexFormat[] formats)
 Creates a vertex buffer (with an index array, with an instance divisor)
virtual Object ShallowClone ()
 Creates a copy of the vertex buffer.
void Dispose ()
 Frees the unmanaged resources of the vertex buffer.
void SetVertices (Array vertices)
 Sets vertex data.
void SetVertices (Array vertices, int to, int from, int count)
 Sets vertex data (with range)
void SetVertices (int stream, Array vertices)
 Sets vertex data (for single stream)
void SetVertices (int stream, Array vertices, int to, int from, int count)
 Sets vertex data (for single stream, with range)
void SetVertices (int stream, Array vertices, int offset, int stride)
 Sets vertex data (for single stream, with byte offset)
void SetVertices (int stream, Array vertices, VertexFormat format, Vector4 trans, Vector4 scale)
 Sets vertex data (for single stream, with format conversion)
void SetVertices (int stream, Array vertices, VertexFormat format, Vector4 trans, Vector4 scale, int offset, int stride, int to, int from, int count)
 Sets vertex data (for single stream, with format conversion, with byte offset, with range)
void SetIndices (ushort[] indices)
 Sets index data.
void SetIndices (ushort[] indices, int to, int from, int count)
 Sets index data (with range)

Protected Member Functions

 VertexBuffer (VertexBuffer buffer)
 Creates a copy of the vertex buffer.

Properties

VertexFormat[] Formats [get]
 Vertex format.
int VertexCount [get]
 Number of vertices.
int IndexCount [get]
 Number of indices.
int StreamCount [get]
 Number of streams.
int InstanceDivisor [get]
 Instance divisor.

Detailed Description

Class representing the vertex buffer.


Constructor & Destructor Documentation

VertexBuffer ( int  vertexCount,
params VertexFormat[]  formats 
)

Creates the vertex buffer.

Parameters:
vertexCountNumber of vertices (no vertex array if 0)
formatsVertex format

Creates a vertex buffer. Specify the datatype for each vertex stream for the vertex format.

VertexBuffer ( int  vertexCount,
int  indexCount,
params VertexFormat[]  formats 
)

Creates a vertex buffer (with an index array)

Parameters:
vertexCountNumber of vertices (no vertex array if 0)
indexCountNumber of indices (no index array if 0)
formatsVertex format

Creates a vertex buffer. Index arrays can be used by specifying the number of indices. Specify the datatype for each vertex stream for the vertex format.

VertexBuffer ( int  vertexCount,
int  indexCount,
int  instDivisor,
params VertexFormat[]  formats 
)

Creates a vertex buffer (with an index array, with an instance divisor)

Parameters:
vertexCountNumber of vertices (no vertex array if 0)
indexCountNumber of indices (no index array if 0)
instDivisorInstance divisor (0 or 1)
formatsVertex format

Creates a vertex buffer. Index arrays can be used by specifying the number of indices. Specify the datatype for each vertex stream for the vertex format.

The instance divisor will be used to render the instance. For details, refer to GraphicsContext.DrawArraysInstanced().

VertexBuffer ( VertexBuffer  buffer) [protected]

Creates a copy of the vertex buffer.

Parameters:
bufferVertex buffer

Creates a copy of the vertex buffer. The 2 vertex buffers will then share unmanaged resources. When Dispose() is called for all copies, the shared unmanaged resources will be freed.


Member Function Documentation

void SetIndices ( ushort[]  indices)

Sets index data.

Parameters:
indicesIndex data

Sets index data.

This overload sets data to all indices. When the size of the array differs from the required size, an exception is thrown. When the array size is bigger than the required size, please use a different overload.

void SetIndices ( ushort[]  indices,
int  to,
int  from,
int  count 
)

Sets index data (with range)

Parameters:
indicesIndex data
toTransfer destination index number
fromTransfer source index number
countNumber of indices to be transferred

Sets index data.

void SetVertices ( int  stream,
Array  vertices,
VertexFormat  format,
Vector4  trans,
Vector4  scale 
)

Sets vertex data (for single stream, with format conversion)

Parameters:
streamStream number (0 to StreamCount-1)
verticesVertex data
formatVertex format
transTranslation value
scaleScale value

Sets the vertex data to a specified stream. The same format as the vertex buffer or the float vector format of the same dimensionality can be specified to the vertex format. When specifying the float vector format to the vertex format, the vertex data can be converted using the (vertex-trans)/scale formula.

void SetVertices ( Array  vertices,
int  to,
int  from,
int  count 
)

Sets vertex data (with range)

Parameters:
verticesVertex data
toTransfer destination vertex number
fromTransfer source vertex number
countNumber of vertices to be transferred

Sets vertex data. Specify the vertex data in interleaved format.

void SetVertices ( int  stream,
Array  vertices,
int  to,
int  from,
int  count 
)

Sets vertex data (for single stream, with range)

Parameters:
streamStream number (0 to StreamCount-1)
verticesVertex data
toTransfer destination vertex number
fromTransfer source vertex number
countNumber of vertices to be transferred

Sets the vertex data to a specified stream.

void SetVertices ( int  stream,
Array  vertices 
)

Sets vertex data (for single stream)

Parameters:
streamStream number (0 to StreamCount-1)
verticesVertex data

Sets the vertex data to a specified stream.

This overload sets data to all vertices. When the size of the array differs from the required size, an exception is thrown. When the array size is bigger than the required size, please use a different overload.

void SetVertices ( Array  vertices)

Sets vertex data.

Parameters:
verticesVertex data

Sets vertex data. Specify the vertex data in interleaved format.

This overload sets data to all vertices. When the size of the array differs from the required size, an exception is thrown. When the array size is bigger than the required size, please use a different overload.

void SetVertices ( int  stream,
Array  vertices,
int  offset,
int  stride 
)

Sets vertex data (for single stream, with byte offset)

Parameters:
streamStream number (0 to StreamCount-1)
verticesVertex data
offsetByte offset of vertex data
strideByte stride of vertex data

Sets the vertex data to a specified stream.

void SetVertices ( int  stream,
Array  vertices,
VertexFormat  format,
Vector4  trans,
Vector4  scale,
int  offset,
int  stride,
int  to,
int  from,
int  count 
)

Sets vertex data (for single stream, with format conversion, with byte offset, with range)

Parameters:
streamStream number (0 to StreamCount-1)
verticesVertex data
formatVertex format
transTranslation value
scaleScale value
offsetByte offset of vertex data
strideByte stride of vertex data
toTransfer destination vertex number
fromTransfer source vertex number
countNumber of vertices to be transferred

Sets the vertex data to a specified stream. The same format as the vertex buffer or the float vector format of the same dimensionality can be specified to the vertex format. When specifying the float vector format to the vertex format, the vertex data can be converted using the (vertex-trans)/scale formula.

virtual Object ShallowClone ( ) [virtual]

Creates a copy of the vertex buffer.

Returns:
Clones the vertex buffer

Creates a copy of the vertex buffer. The 2 vertex buffers will then share unmanaged resources. When Dispose() is called for all copies, the shared unmanaged resources will be freed.