Model loading · function
isOutlineWorthWriting
Whether a built level is worth writing into a file as an outline.
Explained in Importing models.
function isOutlineWorthWriting(level: MeshData, meshes: readonly MeshData[]): booleanimport { isOutlineWorthWriting } from '@driftengine/assets';Parameters
| Parameter | Type | Description |
|---|---|---|
level | MeshData | |
meshes | readonly MeshData[] |
In depth
A level of detail that is bigger than the model is not one. The grid is a fixed number of cells across whatever it is given, so its cost follows the shape rather than the detail: four hand-written triangles come back as a 9,840-triangle shell, which is 308 KB of outline arriving ahead of a model measured in bytes. Everything an outline is for, being on screen before the geometry at a fraction of the download, is inverted.
Found the day the default flipped from off to on, by a fixture. While an outline was asked for per asset by somebody who had looked, the case could not arise. A default has to hold for the assets nobody looks at, which is what makes it a default.
Separate from buildCoarseLevel, which stays a geometry function. This is a budget, and a
caller that wants the hull of a small mesh for some other purpose is entitled to it. It lives
here rather than in the two callers because the baker and the browser's converter have to agree
about what a file carries, and a rule stated twice is a rule until somebody edits one copy.
Half rather than merely smaller: an outline that saves a few per cent is a chunk, an upload and a swap for no visible gain.