Skip to content

MaterialKind beta ​

Interface of @v12-engine/render

ts
export interface MaterialKind

A kind of material: the WGSL its draws run, what of a geometry's vertices and of a copy they read, and what its group of bindings holds. The renderer gives every kind the frame's group (0: Frame, the three cascades and their sampler in the view's pass; Cascade alone in a cascade's) and asks the kind for group 1. flags is a material's variant of the kind, a string the kind reads (cutout, tinted): a shader is made once for each that is used.

Members ​

cascade ​

ts
cascade(flags: string): string | undefined;

A cascade's pass, depth alone; nothing where the kind never casts

copyFloats ​

ts
copyFloats(flags: string): number;

Floats a copy carries after its matrix, a multiple of 4

layer ​

ts
layer?(flags: string, layer: LayerName): string | {
        source: string;
        reads: readonly number[];
        at?: number;
    } | undefined;

A layer's pass (layers.ts), where the kind's batches can be in it: its WGSL beginning with LAYER_VELOCITY, LAYER_OUTLINE or LAYER_GLOW, its vertex stage placing a vertex as the view's does (by layer.viewProjection). The velocity's reads a copy's matrix of the frame before in the four locations after the copy's own record and gives both places to velocityOut; the outline's reads a copy's mark in the one location after its record and returns outlineOut(mark); the glow's returns glow.colour where it shines. Nothing for a layer the kind is never in. With reads, the locations of the view's vertex input the layer's shader reads (a kind with many: a pipeline takes 16 attributes, the velocity's four among them), and with at the first location of what the layer adds, among those it does not read (a location is under 16: a copy's record that reaches the 13th leaves the velocity's four no room after it)

name ​

ts
name: string;

What it is called, in its shaders' and pipelines' labels

streams ​

ts
streams: readonly VertexStream[];

The streams of a vertex it reads after the position, at the locations from 1 on in their order

view ​

ts
view(flags: string): string;

The view's pass: vertexMain, fragmentMain