Model loading · function

fbxToMeshes

Geometry out of a parsed tree, one MeshData per Geometry record.

Explained in Importing models.

function fbxToMeshes(buffer: ArrayBuffer, inflate: Inflate):
import { fbxToMeshes } from '@driftengine/assets';

Parameters

ParameterTypeDescription
bufferArrayBuffer
inflateInflate

In depth

FBX stores polygons of any size as a flat index list where a negative index marks the last corner of a polygon, encoded as its bitwise complement. Triangulating as a fan is correct for the convex polygons these files contain and is what every other reader does.

Normals and UVs arrive as layer elements with their own mapping and reference modes, and the combination decides how to look a value up. Getting that wrong does not fail — it shades the model wrongly — so each supported combination is handled explicitly and an unsupported one is named rather than approximated.