Model loading · function
dtexFromEncoded
encoded as a DtexMaterial, with channels saying what each of its outputs is.
Explained in Importing models.
function dtexFromEncoded(encoded: EncodedMaterial, channels: readonly ChannelSpec[], tileSize?: number): DtexMaterialimport { dtexFromEncoded } from '@driftengine/assets';Parameters
| Parameter | Type | Description |
|---|---|---|
encoded | EncodedMaterial | |
channels | readonly ChannelSpec[] | |
tileSize? | number |
In depth
A channel is packed as (semanticIndex << 4) | component, which is what the decode interpreter
unpacks and what the chunk stores. A semantic this build does not know is refused rather than
written as something else: the index is the format's, and a wrong one is a channel that decodes
as another channel, which reads as a shading fault in a scene nobody has changed.