art-library
Import
Section titled “Import”import * as api from "@fungi.computer/art-library";Exports
Section titled “Exports”| 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.
ArtPacktype alias
Section titled “ArtPack”type ArtPack = (typeof artPacks)[number];The id of a shipped art pack.
artPacksconstant
Section titled “artPacks”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/.
packFile()function
Section titled “packFile()”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.
Parameters
Section titled “Parameters”| 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 |
Returns
Section titled “Returns”URL
Throws
Section titled “Throws”RangeError when path leaves the pack.