Skip to content
API reference

art-library

Import
import * as api from "@fungi.computer/art-library";
Kind Export Description
type alias ArtPack The id of a shipped art pack.
constant artPacks The art packs this package ships, one folder each under packs/.
function packFile() The location of a file inside a shipped pack, for example packFile("food-a", "models/apple.glb"). The URL follows wherever this package is installed: a Node reader gets a file: URL and a development server gets the URL it serves the package from. Bundlers that emit assets import the same files through the package’s ./packs/* export instead.

Pack locations from @fungi.computer/art-library and bundled asset URLs through @fungi.computer/art-library/packs/*.

Start browser-side discovery at @fungi.computer/art-library/models with models, searchModels and requireModel; use /catalog for Node-side receipt and model inspection. Load the selected asset with modelLoader() from /three, which configures the decoder for compressed models.

packFile() locates installed pack files. A browser build should import the selected asset through the packs export, for example the default URL from @fungi.computer/art-library/packs/animated-animals/urls/alpaca.glb.js. Use that URL’s href with the loader. A whole-pack urls.js table is also available, but imports every asset it names when a bundler emits the pack.

Signature
type ArtPack = (typeof artPacks)[number];

The id of a shipped art pack.

artPacksconstant

Section titled “artPacks”
Signature
const artPacks: readonly [
"animated-animals",
"buildings",
"cell-keys",
"characters",
"farm-animals",
"food-a",
"furnishings-b",
"interiors",
"inventory",
"medieval-village",
"modular-ar3",
"modular-guns",
"plain-bat",
"rifle",
"storage-a",
"storage-b",
"street-a",
"survival-loot",
"town-props-b",
"upper-floor-a",
"vehicles",
];

The art packs this package ships, one folder each under packs/.

Signature
function packFile(pack, path): URL;

The location of a file inside a shipped pack, for example packFile("food-a", "models/apple.glb"). The URL follows wherever this package is installed: a Node reader gets a file: URL and a development server gets the URL it serves the package from. Bundlers that emit assets import the same files through the package’s ./packs/* export instead.

Parameter Type
pack | "animated-animals" | "buildings" | "cell-keys" | "characters" | "farm-animals" | "food-a" | "furnishings-b" | "interiors" | "inventory" | "medieval-village" | "modular-ar3" | "modular-guns" | "plain-bat" | "rifle" | "storage-a" | "storage-b" | "street-a" | "survival-loot" | "town-props-b" | "upper-floor-a" | "vehicles"
path string

URL

RangeError when path leaves the pack.