FieldType

Different types for Buffer fields. These are scalar, vector, or matrix types, usually packed into small amounts of space to reduce the amount of memory they occupy.

The names are encoded as follows:

ValueDescription
i8x4Four 8-bit signed integers.
u8x4Four 8-bit unsigned integers.
sn8x4Four 8-bit signed normalized values.
un8x4Four 8-bit unsigned normalized values (aka `color`).
un10x3Three 10-bit unsigned normalized values, and 2 padding bits (aka `normal`).
i16One 16-bit signed integer.
i16x2Two 16-bit signed integers.
i16x4Four 16-bit signed integers.
u16One 16-bit unsigned integer.
u16x2Two 16-bit unsigned integers.
u16x4Four 16-bit unsigned integers.
sn16x2Two 16-bit signed normalized values.
sn16x4Four 16-bit signed normalized values.
un16x2Two 16-bit unsigned normalized values.
un16x4Four 16-bit unsigned normalized values.
i32One 32-bit signed integer (aka `int`).
i32x2Two 32-bit signed integers.
i32x2Two 32-bit signed integers.
i32x3Three 32-bit signed integers.
i32x4Four 32-bit signed integers.
u32One 32-bit unsigned integer (aka `uint`).
u32x2Two 32-bit unsigned integers.
u32x3Three 32-bit unsigned integers.
u32x4Four 32-bit unsigned integers.
f16x2Two 16-bit floating point numbers.
f16x4Four 16-bit floating point numbers.
f32One 32-bit floating point number (aka `float`).
f32x2Two 32-bit floating point numbers (aka `vec2`).
f32x3Three 32-bit floating point numbers (aka `vec3`).
f32x4Four 32-bit floating point numbers (aka `vec4`).
mat2A 2x2 matrix containing four 32-bit floats.
mat3A 3x3 matrix containing nine 32-bit floats.
mat4A 4x4 matrix containing sixteen 32-bit floats.

Notes

In addition to these values, the following aliases can be used:

Alias Maps to
vec2 f32x2
vec3 f32x3
vec4 f32x4
int i32
uint u32
float f32
color un8x4

Additionally, the following convenience rules apply:

So you can write, e.g. lovr.graphics.newBuffer(4, 'floats'), which is cute!

See also