models
Import
Section titled “Import”import * as api from "@fungi.computer/art-library/models";Exports
Section titled “Exports”| Kind | Export | Description |
|---|---|---|
| constant | models | Every model of the library, for a browser or any reader that cannot read the
packs from disk. model-data.ts is generated from the pack receipts and model
files by pnpm run generate, and the compiler checks it against ModelRow.
This package’s own test fails while it is stale, so the browser does not decode
it again. The Node modelCatalog() from ./catalog is the generator and that
test’s oracle. |
Browser-safe discovery from @fungi.computer/art-library/models: models,
searchModels and requireModel.
Search the generated rows, inspect the candidates, then pin an exact id. This
entrypoint reads no files and imports no Node modules. Use
@fungi.computer/art-library/catalog instead when a Node tool needs to derive
rows from the shipped receipts and model bytes.
A row’s file is a package-relative asset path, not a deployed browser URL.
Import the selected model’s URL module through
@fungi.computer/art-library/packs/*, then pass its href to modelLoader()
from @fungi.computer/art-library/three. The /three API shows that loading
step; do not fetch an invented filename or use a bare loader for compressed
models.
Example
Section titled “Example”import { models, requireModel, searchModels,} from "@fungi.computer/art-library/models";
const candidates = searchModels(models, "alpaca", { kind: "animal", limit: 3,});const mascot = requireModel(models, "animated-animals/alpaca");console.log(candidates, mascot.file);modelsconstant
Section titled “models”const models: readonly ModelRow[];Every model of the library, for a browser or any reader that cannot read the
packs from disk. model-data.ts is generated from the pack receipts and model
files by pnpm run generate, and the compiler checks it against ModelRow.
This package’s own test fails while it is stale, so the browser does not decode
it again. The Node modelCatalog() from ./catalog is the generator and that
test’s oracle.
References
Section titled “References”ModelKind
Section titled “ModelKind”Re-exports ModelKind
ModelRow
Section titled “ModelRow”Re-exports ModelRow
UnknownModelError
Section titled “UnknownModelError”Re-exports UnknownModelError
requireModel
Section titled “requireModel”Re-exports requireModel
searchModels
Section titled “searchModels”Re-exports searchModels