Struct VertexAttribute
Defines the memory layout properties of an attribute in the rendering vertex stream.
public readonly struct VertexAttribute
- Inherited Members
Constructors
VertexAttribute(AttributeClass, int, AttributeType, int, int, int, int, object?, bool)
Create a vertex attribute.
public VertexAttribute(AttributeClass @class, int index, AttributeType type, int dimensions, int offset = 0, int stride = 0, int divisor = 0, object? value = null, bool normalize = false)
Parameters
class
AttributeClassThe attribute clas..
index
intThe attribute index for that class.
type
AttributeTypeThe attribute value type.
dimensions
intThe number of dimensions in the attribute. Must be in the range [1,4].
offset
intThe offset pointer in bytes.
stride
intThe row stride in bytes. Zero for the default stride.
divisor
intThe instance divisor. Zero for none.
value
objectThe attribute value.
normalize
boolTrue to normalize integer values into the primary floating point range.
Exceptions
- ArgumentOutOfRangeException
dimensions
is less than 1 or greater than 4.offset
is negative.stride
is negative.index
is negative.divisor
is negative.
Properties
Class
Attribute class specifies the attribute usage.
public AttributeClass Class { get; }
Property Value
Dimensions
Number of elements in the attribute vector. Must be [1,4].
public int Dimensions { get; }
Property Value
Divisor
The instance divisor. 0 for per-vertex, positive value for per instance incrementation.
public int Divisor { get; }
Property Value
Index
Attribute priority for this attribute.
public int Index { get; }
Property Value
IsFloat
True if this is a float attribute.
public bool IsFloat { get; }
Property Value
IsInteger
True if this is an integer attribute.
public bool IsInteger { get; }
Property Value
IsPerVertex
True if this is a per-vertex attribute.
public bool IsPerVertex { get; }
Property Value
Normalize
Set true to normalize integer values into float ranges.
public bool Normalize { get; }
Property Value
Remarks
The range is [0, 1] for unsigned, and [-1, +1] for signed integers.
Offset
Offset in bytes into attribute buffer.
public int Offset { get; }
Property Value
Stride
Stride of the vector in bytes.
public int Stride { get; }
Property Value
Type
The number type of attribute.
public AttributeType Type { get; }
Property Value
Value
The attribute value to set when there is no vertex buffer.
public object? Value { get; }
Property Value
Remarks
Optional, will use API defaults when unset.