A VertexBufferAttribute holds geometry data to be sent to the vertex shader. Most common geometry attributes are 'position' and 'uv'.

interface VertexBufferAttribute {
    vertexBuffer?: VertexBuffer;
    name: string;
    array: Float32Array;
    type: string;
    bufferFormat: GPUVertexFormat;
    bufferLength: number;
    size: number;
    offset: number;
    bufferOffset: number;
    verticesStride: number;
}

Hierarchy (view full)

Properties

vertexBuffer?: VertexBuffer
name: string

The name of the VertexBufferAttribute

array: Float32Array

VertexBufferAttribute array that will be used by the VertexBuffer

type: string

The WGSL type of the VertexBufferAttribute, i.e. "f32", "vec2f", "vec3f", etc.

bufferFormat: GPUVertexFormat

The buffer format of the VertexBufferAttribute, i.e. "float32", "float32x2", "float32x3", etc.

bufferLength: number

The length of the array

size: number

The size of the VertexBufferAttribute. A "f32" is of size 1, a "vec2f" of size 2, a "vec3f" of size 3, etc.

offset: number

Offset of the array inside the VertexBuffer array

bufferOffset: number

Bytes offset of the array inside the VertexBuffer array

verticesStride: number

Use this VertexBufferAttribute for every X vertices. Useful for vertex/face color, etc.