Class VertexHelper
An helper class for manipulating vertex buffers on CPU (Generate new vertex attributes...etc.)
public static class VertexHelper
- Inheritance
-
VertexHelper
Methods
GenerateMultiTextureCoordinates(VertexDeclaration, byte[], int, int)
Generates multi texture coordinates for an existing vertex buffer. See remarks.
public static VertexHelper.VertexTransformResult GenerateMultiTextureCoordinates(VertexDeclaration vertexDeclaration, byte[] vertexBufferData, int vertexStride = 0, int maxTexcoord = 9)
Parameters
vertexDeclaration
VertexDeclarationThe vertex declaration.
vertexBufferData
byte[]The vertex buffer data.
vertexStride
intThe vertex stride.
maxTexcoord
intThe maximum texcoord.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with additional texture coordinates.
Remarks
The original vertex buffer must contain at least a TEXCOORD[0-9] attribute in order for this method to work. This method will copy the value of the first existing TEXCOORD found in the vertex buffer to the newly created TEXCOORDS.
Exceptions
- ArgumentNullException
vertexDeclaration or vertexBufferData
GenerateMultiTextureCoordinates(VertexDeclaration, IntPtr, int, int, int, int)
Generates multi texture coordinates for an existing vertex buffer. See remarks.
public static VertexHelper.VertexTransformResult GenerateMultiTextureCoordinates(VertexDeclaration vertexDeclaration, IntPtr vertexBufferData, int vertexCount, int vertexOffset, int vertexStride, int maxTexcoord = 9)
Parameters
vertexDeclaration
VertexDeclarationThe vertex declaration.
vertexBufferData
IntPtrThe vertex buffer data.
vertexCount
intThe vertex count.
vertexOffset
intThe vertex offset.
vertexStride
intThe vertex stride.
maxTexcoord
intThe maximum texcoord.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with additional texture coordinates.
Remarks
The original vertex buffer must contain at least a TEXCOORD[0-9] attribute in order for this method to work. This method will copy the value of the first existing TEXCOORD found in the vertex buffer to the newly created TEXCOORDS.
Exceptions
- ArgumentNullException
vertexDeclaration or vertexBufferData
- ArgumentOutOfRangeException
vertexCount;vertexCount must be > 0 or vertexStride;vertexStride must be >= 0 or maxTexcoord;maxTexcoord must be >= 0
- InvalidOperationException
The vertex buffer must contain at least the TEXCOORD
GenerateMultiTextureCoordinates(VertexTransformResult, int, int)
Generates multi texture coordinates for an existing vertex buffer. See remarks.
public static VertexHelper.VertexTransformResult GenerateMultiTextureCoordinates(VertexHelper.VertexTransformResult transform, int vertexStride = 0, int maxTexcoord = 9)
Parameters
transform
VertexHelper.VertexTransformResultThe result of a previous transform.
vertexStride
intThe vertex stride.
maxTexcoord
intThe maximum texcoord.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with additional texture coordinates.
Remarks
The original vertex buffer must contain at least a TEXCOORD[0-9] attribute in order for this method to work. This method will copy the value of the first existing TEXCOORD found in the vertex buffer to the newly created TEXCOORDS.
GenerateMultiTextureCoordinates<T>(VertexDeclaration, T[], int)
Generates multi texture coordinates for an existing vertex buffer. See remarks.
public static VertexHelper.VertexTransformResult GenerateMultiTextureCoordinates<T>(VertexDeclaration vertexDeclaration, T[] vertexBufferData, int maxTexcoord = 9) where T : unmanaged
Parameters
vertexDeclaration
VertexDeclarationThe vertex declaration.
vertexBufferData
T[]The vertex buffer data.
maxTexcoord
intThe maximum texcoord.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with additional texture coordinates.
Type Parameters
T
Remarks
The original vertex buffer must contain at least a TEXCOORD[0-9] attribute in order for this method to work. This method will copy the value of the first existing TEXCOORD found in the vertex buffer to the newly created TEXCOORDS.
Exceptions
- ArgumentNullException
vertexDeclaration or vertexBufferData
GenerateTangentBinormal(VertexDeclaration, IntPtr, int, int, int, IntPtr, bool, int)
Generate Tangent BiNormal from an existing vertex/index buffer.
public static VertexHelper.VertexTransformResult GenerateTangentBinormal(VertexDeclaration vertexDeclaration, IntPtr vertexBufferData, int vertexCount, int vertexOffset, int vertexStride, IntPtr indexData, bool is32BitIndex, int indexCountArg)
Parameters
vertexDeclaration
VertexDeclarationThe vertex declaration of the vertex buffer passed by parameters.
vertexBufferData
IntPtrThe vertex buffer.
vertexCount
intThe vertex count.
vertexOffset
intThe vertex offset.
vertexStride
intThe vertex stride. If 0, It takes the stride from the vertex declaration
indexData
IntPtrThe index data.
is32BitIndex
boolif set to
true
[is32 bit index].indexCountArg
intThe index count argument.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with its new layout.
GenerateTangentBinormal<T>(VertexDeclaration, T[], int[])
Generates the tangent binormal for an existing vertex buffer.
public static VertexHelper.VertexTransformResult GenerateTangentBinormal<T>(VertexDeclaration vertexDeclaration, T[] vertexBufferData, int[] indexBuffer) where T : unmanaged
Parameters
vertexDeclaration
VertexDeclarationThe vertex declaration.
vertexBufferData
T[]The vertex buffer data.
indexBuffer
int[]The index buffer.
Returns
- VertexHelper.VertexTransformResult
A new vertex buffer with its new layout.
Type Parameters
T