Table of Contents

Class VertexHelper

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

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 VertexDeclaration

The vertex declaration.

vertexBufferData byte[]

The vertex buffer data.

vertexStride int

The vertex stride.

maxTexcoord int

The 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, nint, int, int, int, int)

Generates multi texture coordinates for an existing vertex buffer. See remarks.

public static VertexHelper.VertexTransformResult GenerateMultiTextureCoordinates(VertexDeclaration vertexDeclaration, nint vertexBufferData, int vertexCount, int vertexOffset, int vertexStride, int maxTexcoord = 9)

Parameters

vertexDeclaration VertexDeclaration

The vertex declaration.

vertexBufferData nint

The vertex buffer data.

vertexCount int

The vertex count.

vertexOffset int

The vertex offset.

vertexStride int

The vertex stride.

maxTexcoord int

The 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.VertexTransformResult

The result of a previous transform.

vertexStride int

The vertex stride.

maxTexcoord int

The 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 VertexDeclaration

The vertex declaration.

vertexBufferData T[]

The vertex buffer data.

maxTexcoord int

The 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, nint, int, int, int, nint, bool, int)

Generate Tangent BiNormal from an existing vertex/index buffer.

public static VertexHelper.VertexTransformResult GenerateTangentBinormal(VertexDeclaration vertexDeclaration, nint vertexBufferData, int vertexCount, int vertexOffset, int vertexStride, nint indexData, bool is32BitIndex, int indexCountArg)

Parameters

vertexDeclaration VertexDeclaration

The vertex declaration of the vertex buffer passed by parameters.

vertexBufferData nint

The vertex buffer.

vertexCount int

The vertex count.

vertexOffset int

The vertex offset.

vertexStride int

The vertex stride. If 0, It takes the stride from the vertex declaration

indexData nint

The index data.

is32BitIndex bool

if set to true [is32 bit index].

indexCountArg int

The 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 VertexDeclaration

The 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