Table of Contents

Struct VertexElement

Namespace
Stride.Graphics
Assembly
Stride.Graphics.dll

A description of a single element for the input-assembler stage. This structure is related to Direct3D11.InputElement.

[DataContract]
[DataSerializer(typeof(VertexElement.Serializer))]
public struct VertexElement : IEquatable<VertexElement>
Implements

Remarks

Because Direct3D11.InputElement requires to have the same VertexBufferLayout.SlotIndex, VertexBufferLayout.VertexClassification and VertexBufferLayout.instanceDataStepRate, the VertexBufferLayout structure encapsulates a set of VertexElement for a particular slot, classification and instance data step rate. Unlike the default Direct3D11.InputElement, this structure accepts a semantic name with a postfix number that will be automatically extracted to the semantic index.

Constructors

VertexElement(string, PixelFormat)

Initializes a new instance of the VertexElement struct.

public VertexElement(string semanticName, PixelFormat format)

Parameters

semanticName string

Name of the semantic.

format PixelFormat

The format.

Remarks

If the semantic name contains a postfix number, this number will be used as a semantic index.

VertexElement(string, int, PixelFormat, int)

Initializes a new instance of the VertexElement struct.

public VertexElement(string semanticName, int semanticIndex, PixelFormat format, int alignedByteOffset = -1)

Parameters

semanticName string

Name of the semantic.

semanticIndex int

Index of the semantic.

format PixelFormat

The format.

alignedByteOffset int

The aligned byte offset.

Fields

AppendAligned

Returns a value that can be used for the offset parameter of an InputElement to indicate that the element should be aligned directly after the previous element, including any packing if neccessary.

public const int AppendAligned = -1

Field Value

int

A value used to align input elements.

Properties

AlignedByteOffset

Optional. Offset (in bytes) between each element. Use D3D11_APPEND_ALIGNED_ELEMENT for convenience to define the current element directly after the previous one, including any packing if necessary.

public int AlignedByteOffset { get; }

Property Value

int

Format

The data type of the element data. See SharpDX.DXGI.Format.

public PixelFormat Format { get; }

Property Value

PixelFormat

SemanticAsText

The HLSL semantic associated with this element in a shader input-signature.

public string SemanticAsText { get; }

Property Value

string

SemanticIndex

The semantic index for the element. A semantic index modifies a semantic, with an integer index number. A semantic index is only needed in a case where there is more than one element with the same semantic. For example, a 4x4 matrix would have four components each with the semantic name

matrix

, however each of the four component would have different semantic indices (0, 1, 2, and 3).

public int SemanticIndex { get; }

Property Value

int

SemanticName

The HLSL semantic associated with this element in a shader input-signature.

public string SemanticName { get; }

Property Value

string

Methods

BiTangent(PixelFormat, int)

Declares a VertexElement with the semantic "BITANGENT".

public static VertexElement BiTangent(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

BiTangent(int, PixelFormat, int)

Declares a VertexElement with the semantic "BITANGENT".

public static VertexElement BiTangent(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

BiTangent<T>(int, int)

Declares a VertexElement with the semantic "BITANGENT".

public static VertexElement BiTangent<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the BiTangent semantic.

Color(PixelFormat, int)

Declares a VertexElement with the semantic "COLOR".

public static VertexElement Color(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Color(int, PixelFormat, int)

Declares a VertexElement with the semantic "COLOR".

public static VertexElement Color(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Color<T>(int, int)

Declares a VertexElement with the semantic "COLOR".

public static VertexElement Color<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the Color semantic.

ConvertTypeToFormat<T>()

public static PixelFormat ConvertTypeToFormat<T>() where T : struct

Returns

PixelFormat

Type Parameters

T

Equals(VertexElement)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(VertexElement other)

Parameters

other VertexElement

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Normal(PixelFormat, int)

Declares a VertexElement with the semantic "NORMAL".

public static VertexElement Normal(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Normal(int, PixelFormat, int)

Declares a VertexElement with the semantic "NORMAL".

public static VertexElement Normal(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Normal<T>(int, int)

Declares a VertexElement with the semantic "NORMAL".

public static VertexElement Normal<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the Normal semantic.

Position(PixelFormat, int)

Declares a VertexElement with the semantic "POSITION".

public static VertexElement Position(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Position(int, PixelFormat, int)

Declares a VertexElement with the semantic "POSITION".

public static VertexElement Position(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

PositionTransformed(PixelFormat, int)

Declares a VertexElement with the semantic "SV_POSITION".

public static VertexElement PositionTransformed(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

PositionTransformed(int, PixelFormat, int)

Declares a VertexElement with the semantic "SV_POSITION".

public static VertexElement PositionTransformed(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

PositionTransformed<T>(int, int)

Declares a VertexElement with the semantic "SV_POSITION".

public static VertexElement PositionTransformed<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the PositionTransformed semantic.

Position<T>(int, int)

Declares a VertexElement with the semantic "POSITION".

public static VertexElement Position<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the Position semantic.

Tangent(PixelFormat, int)

Declares a VertexElement with the semantic "TANGENT".

public static VertexElement Tangent(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Tangent(int, PixelFormat, int)

Declares a VertexElement with the semantic "TANGENT".

public static VertexElement Tangent(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Tangent<T>(int, int)

Declares a VertexElement with the semantic "TANGENT".

public static VertexElement Tangent<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the Tangent semantic.

TextureCoordinate(PixelFormat, int)

Declares a VertexElement with the semantic "TEXCOORD".

public static VertexElement TextureCoordinate(PixelFormat format, int offsetInBytes = -1)

Parameters

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

TextureCoordinate(int, PixelFormat, int)

Declares a VertexElement with the semantic "TEXCOORD".

public static VertexElement TextureCoordinate(int semanticIndex, PixelFormat format, int offsetInBytes = -1)

Parameters

semanticIndex int

The semantic index.

format PixelFormat

Format of this element.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

TextureCoordinate<T>(int, int)

Declares a VertexElement with the semantic "TEXCOORD".

public static VertexElement TextureCoordinate<T>(int semanticIndex = 0, int offsetInBytes = -1) where T : struct

Parameters

semanticIndex int

The semantic index.

offsetInBytes int

The offset in bytes of this element. Use AppendAligned to compute automatically the offset from previous elements.

Returns

VertexElement

A new instance of VertexElement that represents this semantic.

Type Parameters

T

Type of the TextureCoordinate semantic.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Operators

operator ==(VertexElement, VertexElement)

public static bool operator ==(VertexElement left, VertexElement right)

Parameters

left VertexElement
right VertexElement

Returns

bool

operator !=(VertexElement, VertexElement)

public static bool operator !=(VertexElement left, VertexElement right)

Parameters

left VertexElement
right VertexElement

Returns

bool