/** * Backend-neutral vertex attribute formats. * * A vertex format names a component type and a component count in one token: * `"float32x3"` is three 32-bit floats, `"unorm8x4"` is four unsigned bytes * normalized to `[0, 1]`. That is everything a backend needs to interpret a * slice of an interleaved vertex buffer, which is why it replaces the * `size` + `type` + `normalized` triple the WebGL API works in. * * Naming follows the GPU vocabulary rather than the GL one, because the * translation only runs one way: `"unorm8x4"` gives you `4` + * `UNSIGNED_BYTE` + `normalized`, whereas `UNSIGNED_BYTE` alone cannot tell * you the component count or whether it is normalized. Declaring the format * also means a layout no longer needs a live rendering context to be written * down — the GL enums are only resolved when a backend consumes it. * * This module holds no GL references at all, so a non-WebGL backend can * import it without pulling in the WebGL layer. * @see {@link Batcher#addAttribute} */ /** * A vertex attribute format: component type and count. * * The set is deliberately narrower than the full GPU vocabulary — see the * module notes for what is excluded and why. Layouts that cannot be spelled * here (three-component 8- and 16-bit types, for instance) remain expressible * with the {@link Batcher#addAttribute} GL-enum form, which is supported * indefinitely. */ export type VertexFormat = "float32" | "float32x2" | "float32x3" | "float32x4" | "uint8" | "uint8x2" | "uint8x4" | "sint8" | "sint8x2" | "sint8x4" | "unorm8" | "unorm8x2" | "unorm8x4" | "snorm8" | "snorm8x2" | "snorm8x4" | "uint16" | "uint16x2" | "uint16x4" | "sint16" | "sint16x2" | "sint16x4" | "unorm16" | "unorm16x2" | "unorm16x4" | "snorm16" | "snorm16x2" | "snorm16x4" | "uint32" | "uint32x2" | "uint32x3" | "uint32x4" | "sint32" | "sint32x2" | "sint32x3" | "sint32x4"; /** * Whether a value is a supported vertex format name. * @param value - the value to test * @returns `true` when `value` names a format in {@link VERTEX_FORMATS} */ export declare function isVertexFormat(value: unknown): value is VertexFormat; /** * Resolve a vertex format to its component count, size and normalization. * @param format - the format to resolve * @returns the resolved description * @throws {Error} when `format` is not a supported format name */ export declare function resolveVertexFormat(format: VertexFormat): VertexFormatInfo; //# sourceMappingURL=vertexformat.d.ts.map