Class BufferUtils
- Namespace
- OmegaEngine.Graphics
- Assembly
- OmegaEngine.dll
Helper methods for creating, reading from and writing to SlimDX.Direct3D9.VertexBuffers, SlimDX.Direct3D9.IndexBuffers and attribute buffers.
public static class BufferUtils
- Inheritance
-
objectBufferUtils
Methods
CreateIndexBuffer(Device, short[])
Creates an SlimDX.Direct3D9.IndexBuffer and fills it with data.
public static IndexBuffer CreateIndexBuffer(this Device device, short[] data)
Parameters
deviceDeviceThe device to create the buffer on.
datashort[]The values to fill the buffer with.
Returns
- IndexBuffer
The newly created and filled SlimDX.Direct3D9.IndexBuffer.
CreateIndexBuffer(Device, int[])
Creates an SlimDX.Direct3D9.IndexBuffer and fills it with data.
public static IndexBuffer CreateIndexBuffer(this Device device, int[] data)
Parameters
deviceDeviceThe device to create the buffer on.
dataint[]The values to fill the buffer with.
Returns
- IndexBuffer
The newly created and filled SlimDX.Direct3D9.IndexBuffer.
CreateVertexBuffer<T>(Device, T[], VertexFormat)
Creates a SlimDX.Direct3D9.VertexBuffer and fills it with data.
public static VertexBuffer CreateVertexBuffer<T>(this Device device, T[] data, VertexFormat format) where T : struct
Parameters
deviceDeviceThe device to create the buffer on.
dataT[]The vertexes to fill the buffer with.
formatVertexFormatThe fixed-function vertex format.
Returns
- VertexBuffer
The newly created and filled SlimDX.Direct3D9.VertexBuffer.
Type Parameters
TThe vertex format used in the buffer.
GetPoints(Mesh)
Gets all points contained within a SlimDX.Direct3D9.Mesh.
public static Vector3[] GetPoints(this Mesh mesh)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh to get points from.
Returns
- Vector3[]
An array of points defined by the object.
GetPoints(Mesh, int)
Gets all points contained within a specific subset of a SlimDX.Direct3D9.Mesh.
public static Vector3[] GetPoints(this Mesh mesh, int subset)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh to get points from.
subsetintThe subset to get points for.
Returns
- Vector3[]
An array of points defined by the subset. Returns an empty array if the subset has no faces.
GetPoints(VertexBuffer, int)
Gets all points contained within a SlimDX.Direct3D9.VertexBuffer.
public static Vector3[] GetPoints(this VertexBuffer buffer, int vertexCount)
Parameters
bufferVertexBufferThe SlimDX.Direct3D9.VertexBuffer to get points from.
vertexCountintThe total number of vertex contained within
buffer.
Returns
- Vector3[]
An array of points defined by the object.
Read16Bit(IndexBuffer)
Copies the content of an SlimDX.Direct3D9.IndexBuffer to an array of 16-bit values.
public static short[] Read16Bit(this IndexBuffer buffer)
Parameters
bufferIndexBufferThe buffer to read from.
Returns
- short[]
Remarks
Warning! No check is performed to ensure the buffer actually uses 16-bit values.
Read32Bit(IndexBuffer)
Copies the content of an SlimDX.Direct3D9.IndexBuffer to an array of 32-bit values.
public static int[] Read32Bit(this IndexBuffer buffer)
Parameters
bufferIndexBufferThe buffer to read from.
Returns
- int[]
Remarks
Warning! No check is performed to ensure the buffer actually uses 32-bit values.
ReadAttributeBuffer(Mesh)
Copies the content of the attribute buffer of a SlimDX.Direct3D9.Mesh to an array of 32-bit values.
public static int[] ReadAttributeBuffer(this Mesh mesh)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to read from.
Returns
- int[]
ReadIndexBuffer(Mesh)
Copies the content of the SlimDX.Direct3D9.IndexBuffer of a SlimDX.Direct3D9.Mesh to an array of 32-bit values (16-bit values are automatically converted).
public static int[] ReadIndexBuffer(this Mesh mesh)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to read from.
Returns
- int[]
ReadVertexBuffer<T>(Mesh)
Copies the content of the SlimDX.Direct3D9.VertexBuffer of a SlimDX.Direct3D9.Mesh to an array of structs.
public static T[] ReadVertexBuffer<T>(this Mesh mesh) where T : struct
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to read from.
Returns
- T[]
The content of the buffer in
mesh.
Type Parameters
TThe vertex format used in the buffer.
Read<T>(VertexBuffer)
Copies the content of a SlimDX.Direct3D9.VertexBuffer to an array of structs.
public static T[] Read<T>(this VertexBuffer buffer) where T : struct
Parameters
bufferVertexBufferThe buffer to read from.
Returns
- T[]
The content of the
buffer.
Type Parameters
TThe vertex format used in the buffer.
Write(IndexBuffer, short[])
Fills an SlimDX.Direct3D9.IndexBuffer with 16-bit values.
public static void Write(this IndexBuffer buffer, short[] data)
Parameters
bufferIndexBufferThe buffer to write to.
datashort[]The values to fill the buffer with.
Remarks
Warning! No check is performed to ensure the buffer actually uses 16-bit values.
Write(IndexBuffer, int[])
Fills an SlimDX.Direct3D9.IndexBuffer with 32-bit values.
public static void Write(this IndexBuffer buffer, int[] data)
Parameters
bufferIndexBufferThe buffer to write to.
dataint[]The values to fill the buffer with.
Remarks
Warning! No check is performed to ensure the buffer actually uses 32-bit values.
WriteAttributeBuffer(Mesh, int[])
Fills the attribute buffer of a SlimDX.Direct3D9.Mesh with 32-bit values.
public static void WriteAttributeBuffer(this Mesh mesh, int[] data)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to write to.
dataint[]The values to fill the buffer with.
WriteIndexBuffer(Mesh, short[])
Fills the SlimDX.Direct3D9.IndexBuffer of a SlimDX.Direct3D9.Mesh with 16-bit values.
public static void WriteIndexBuffer(this Mesh mesh, short[] data)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to write to.
datashort[]The values to fill the buffer with.
WriteIndexBuffer(Mesh, int[])
Fills the SlimDX.Direct3D9.IndexBuffer of a SlimDX.Direct3D9.Mesh with 32-bit values.
public static void WriteIndexBuffer(this Mesh mesh, int[] data)
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to write to.
dataint[]The values to fill the buffer with.
WriteVertexBuffer<T>(Mesh, T[])
Fills the SlimDX.Direct3D9.VertexBuffer of a SlimDX.Direct3D9.Mesh with data.
public static void WriteVertexBuffer<T>(this Mesh mesh, T[] data) where T : struct
Parameters
meshMeshThe SlimDX.Direct3D9.Mesh containing the buffer to write to.
dataT[]The vertexes to fill the buffer with.
Type Parameters
TThe vertex format used in the buffer.
Write<T>(VertexBuffer, T[])
Fills a SlimDX.Direct3D9.VertexBuffer with data.
public static void Write<T>(this VertexBuffer buffer, T[] data) where T : struct
Parameters
bufferVertexBufferThe buffer to write to.
dataT[]The vertexes to fill the buffer with.
Type Parameters
TThe vertex format used in the buffer.