Table of Contents

Struct VertexAttribute

Namespace
ReFuel.Graphics
Assembly
ReFuel.dll

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 AttributeClass

The attribute clas..

index int

The attribute index for that class.

type AttributeType

The attribute value type.

dimensions int

The number of dimensions in the attribute. Must be in the range [1,4].

offset int

The offset pointer in bytes.

stride int

The row stride in bytes. Zero for the default stride.

divisor int

The instance divisor. Zero for none.

value object

The attribute value.

normalize bool

True 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

AttributeClass

Dimensions

Number of elements in the attribute vector. Must be [1,4].

public int Dimensions { get; }

Property Value

int

Divisor

The instance divisor. 0 for per-vertex, positive value for per instance incrementation.

public int Divisor { get; }

Property Value

int

Index

Attribute priority for this attribute.

public int Index { get; }

Property Value

int

IsFloat

True if this is a float attribute.

public bool IsFloat { get; }

Property Value

bool

IsInteger

True if this is an integer attribute.

public bool IsInteger { get; }

Property Value

bool

IsPerVertex

True if this is a per-vertex attribute.

public bool IsPerVertex { get; }

Property Value

bool

Normalize

Set true to normalize integer values into float ranges.

public bool Normalize { get; }

Property Value

bool

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

int

Stride

Stride of the vector in bytes.

public int Stride { get; }

Property Value

int

Type

The number type of attribute.

public AttributeType Type { get; }

Property Value

AttributeType

Value

The attribute value to set when there is no vertex buffer.

public object? Value { get; }

Property Value

object

Remarks

Optional, will use API defaults when unset.