VertexHelper Class
Namespace: Stride.GraphicsAssembly: Stride.Graphics.dll
An helper class for manipulating vertex buffers on CPU (Generate new vertex attributes...etc.)
public static class VertexHelper
| Name | Description | |
|---|---|---|
| Methods | ||
| GenerateMultiTextureCoordinates(VertexDeclaration, Byte[], Int32, Int32) | Generates multi texture coordinates for an existing vertex buffer. See remarks. |
|
| GenerateMultiTextureCoordinates(VertexDeclaration, IntPtr, Int32, Int32, Int32, Int32) | Generates multi texture coordinates for an existing vertex buffer. See remarks. |
|
| GenerateMultiTextureCoordinates(VertexHelper.VertexTransformResult, Int32, Int32) | Generates multi texture coordinates for an existing vertex buffer. See remarks. |
|
| GenerateMultiTextureCoordinates<T>(VertexDeclaration, T[], Int32) | Generates multi texture coordinates for an existing vertex buffer. See remarks. |
|
| GenerateTangentBinormal(VertexDeclaration, IntPtr, Int32, Int32, Int32, IntPtr, Boolean, Int32) | Generate Tangent BiNormal from an existing vertex/index buffer. |
|
| GenerateTangentBinormal<T>(VertexDeclaration, T[], Int32[]) | Generates the tangent binormal for an existing vertex buffer. |
|
Methods
GenerateMultiTextureCoordinates(VertexDeclaration, Byte[], Int32, Int32)
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
| Type | Name | Description |
|---|---|---|
| VertexDeclaration | vertexDeclaration | The vertex declaration. |
| System.Byte[] | vertexBufferData | The vertex buffer data. |
| System.Int32 | vertexStride | The vertex stride. |
| System.Int32 | maxTexcoord | The maximum texcoord. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Condition |
|---|---|
| System.ArgumentNullException | vertexDeclaration or vertexBufferData |
GenerateMultiTextureCoordinates(VertexDeclaration, IntPtr, Int32, Int32, Int32, Int32)
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
| Type | Name | Description |
|---|---|---|
| VertexDeclaration | vertexDeclaration | The vertex declaration. |
| System.IntPtr | vertexBufferData | The vertex buffer data. |
| System.Int32 | vertexCount | The vertex count. |
| System.Int32 | vertexOffset | The vertex offset. |
| System.Int32 | vertexStride | The vertex stride. |
| System.Int32 | maxTexcoord | The maximum texcoord. |
Returns
| Type | Description |
|---|---|
| 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
| Type | Condition |
|---|---|
| System.ArgumentNullException | vertexDeclaration or vertexBufferData |
| System.ArgumentOutOfRangeException | vertexCount;vertexCount must be > 0 or vertexStride;vertexStride must be >= 0 or maxTexcoord;maxTexcoord must be >= 0 |
| System.InvalidOperationException | The vertex buffer must contain at least the TEXCOORD |
GenerateMultiTextureCoordinates(VertexHelper.VertexTransformResult, Int32, Int32)
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
| Type | Name | Description |
|---|---|---|
| VertexHelper.VertexTransformResult | transform | The result of a previous transform. |
| System.Int32 | vertexStride | The vertex stride. |
| System.Int32 | maxTexcoord | The maximum texcoord. |
Returns
| Type | Description |
|---|---|
| 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[], Int32)
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 : struct
Parameters
| Type | Name | Description |
|---|---|---|
| VertexDeclaration | vertexDeclaration | The vertex declaration. |
| T[] | vertexBufferData | The vertex buffer data. |
| System.Int32 | maxTexcoord | The maximum texcoord. |
Returns
| Type | Description |
|---|---|
| VertexHelper.VertexTransformResult | A new vertex buffer with additional texture coordinates. |
Type Parameters
| Name | Description |
|---|---|
| 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
| Type | Condition |
|---|---|
| System.ArgumentNullException | vertexDeclaration or vertexBufferData |
GenerateTangentBinormal(VertexDeclaration, IntPtr, Int32, Int32, Int32, IntPtr, Boolean, Int32)
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
| Type | Name | Description |
|---|---|---|
| VertexDeclaration | vertexDeclaration | The vertex declaration of the vertex buffer passed by parameters. |
| System.IntPtr | vertexBufferData | The vertex buffer. |
| System.Int32 | vertexCount | The vertex count. |
| System.Int32 | vertexOffset | The vertex offset. |
| System.Int32 | vertexStride | The vertex stride. If 0, It takes the stride from the vertex declaration |
| System.IntPtr | indexData | The index data. |
| System.Boolean | is32BitIndex | if set to |
| System.Int32 | indexCountArg | The index count argument. |
Returns
| Type | Description |
|---|---|
| VertexHelper.VertexTransformResult | A new vertex buffer with its new layout. |
GenerateTangentBinormal<T>(VertexDeclaration, T[], Int32[])
Generates the tangent binormal for an existing vertex buffer.
public static VertexHelper.VertexTransformResult GenerateTangentBinormal<T>(VertexDeclaration vertexDeclaration, T[] vertexBufferData, int[] indexBuffer)
where T : struct
Parameters
| Type | Name | Description |
|---|---|---|
| VertexDeclaration | vertexDeclaration | The vertex declaration. |
| T[] | vertexBufferData | The vertex buffer data. |
| System.Int32[] | indexBuffer | The index buffer. |
Returns
| Type | Description |
|---|---|
| VertexHelper.VertexTransformResult | A new vertex buffer with its new layout. |
Type Parameters
| Name | Description |
|---|---|
| T |