DriftTexture · function

assignLayer

Give this material a layer. Returns it, or -1 when the array is full.

Explained in DriftTexture.

function assignLayer(array: MaterialArray, materialId: number, contentHash: string): number
import { assignLayer } from '@driftengine/texture';

Parameters

ParameterTypeDescription
arrayMaterialArray
materialIdnumber
contentHashstring

In depth

Full reports failure rather than evicting. An eviction here would silently repoint a material that is still being drawn, which is a texture swap nobody asked for in the middle of a frame; a caller that runs out needs to know.