Table of Contents

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
object
BufferUtils

Methods

CreateIndexBuffer(Device, short[])

Creates an SlimDX.Direct3D9.IndexBuffer and fills it with data.

public static IndexBuffer CreateIndexBuffer(this Device device, short[] data)

Parameters

device Device

The device to create the buffer on.

data short[]

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

device Device

The device to create the buffer on.

data int[]

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

device Device

The device to create the buffer on.

data T[]

The vertexes to fill the buffer with.

format VertexFormat

The fixed-function vertex format.

Returns

VertexBuffer

The newly created and filled SlimDX.Direct3D9.VertexBuffer.

Type Parameters

T

The 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

mesh Mesh

The 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

mesh Mesh

The SlimDX.Direct3D9.Mesh to get points from.

subset int

The 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

buffer VertexBuffer

The SlimDX.Direct3D9.VertexBuffer to get points from.

vertexCount int

The 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

buffer IndexBuffer

The 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

buffer IndexBuffer

The 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

mesh Mesh

The 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

mesh Mesh

The 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

mesh Mesh

The SlimDX.Direct3D9.Mesh containing the buffer to read from.

Returns

T[]

The content of the buffer in mesh.

Type Parameters

T

The 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

buffer VertexBuffer

The buffer to read from.

Returns

T[]

The content of the buffer.

Type Parameters

T

The 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

buffer IndexBuffer

The buffer to write to.

data short[]

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

buffer IndexBuffer

The buffer to write to.

data int[]

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

mesh Mesh

The SlimDX.Direct3D9.Mesh containing the buffer to write to.

data int[]

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

mesh Mesh

The SlimDX.Direct3D9.Mesh containing the buffer to write to.

data short[]

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

mesh Mesh

The SlimDX.Direct3D9.Mesh containing the buffer to write to.

data int[]

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

mesh Mesh

The SlimDX.Direct3D9.Mesh containing the buffer to write to.

data T[]

The vertexes to fill the buffer with.

Type Parameters

T

The 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

buffer VertexBuffer

The buffer to write to.

data T[]

The vertexes to fill the buffer with.

Type Parameters

T

The vertex format used in the buffer.