OrganicCatalog: the single definition of every material in organicMaterials.
`C.build()` writes materials/<id>.material/mat.yaml for each material and the
collection's collection.yaml (tags; roughness and metalness measured from the
baked masks; textureKB measured from the textures each material binds).
Re-runnable: it overwrites the same files every time. Tool code (it writes
files): call it from a tool, a test or an execute call, never from a component.
After fabricsMaterials' FabricCatalog (Warp and Weft, MIT).
Real sizes (1 unit = 1 m). A tiled surface covers `tileSize` metres per repeat;
a cut-out card is `tileSize` metres along its longer side (the card is drawn
once per face, UV 0..1, and is transparent outside the shape).
surface(what: string, across: string) → string
| arg | type | description |
|---|
| what | string | |
| across | string | |
card(what: string, long: string) → string
| arg | type | description |
|---|
| what | string | |
| long | string | |
painted(what: string) → string
| arg | type | description |
|---|
| what | string | |
toon(what: string) → string
| arg | type | description |
|---|
| what | string | |
get(id: string) → Entry
The definition of one material, or nil.
| arg | type | description |
|---|
| id | string | |
ids( ) → void
Every material id, in catalog order.
groups( ) → void
The groups in catalog order, each with its ids: { { name, ids } }.
texRef(name: string) → string
| arg | type | description |
|---|
| name | string | |
hasTexture(name: string) → boolean
| arg | type | description |
|---|
| name | string | |
galleryLayout(list: { any }, minSize: number) → void
The gallery page size and page that show every organic material, and nothing else, on one ring of materialLibraryKit's "all" view, for `list` = Materials.list(). Mirrors the core Gallery's pagination (a category starts a fresh page when the current one is over half full and the category fits on a page of its own). After fabricsMaterials' FabricCatalog.galleryLayout (MIT).
| arg | type | description |
|---|
| list | { any } | |
| minSize | number | |
pageAt(size: number) → number
| arg | type | description |
|---|
| size | number | |
materialDoc(s: Entry) → void
The mat.yaml document for one material. Cards and translucent surfaces are two-sided (cull none, double_sided); a tiled surface repeats once per UV unit (the materialLibraryKit convention: `tileSize` says how many metres that is).
writeMaterial(s: Entry) → void
Write materials/<id>.material/mat.yaml for one material (creating the asset the first time).
round(x: number, d: number) → number
| arg | type | description |
|---|
| x | number | |
| d | number | |
costWord(kb: number) → string
The texture-cost tag: textures-tiny (under 128 KB), textures-light (under 1.5 MB), textures-medium (under 2.5 MB) or textures-heavy.
| arg | type | description |
|---|
| kb | number | |
finishWord(median: number) → string
The finish tag from the median roughness: glossy (under 0.3), satin (under 0.6) or rough.
| arg | type | description |
|---|
| median | number | |
metalWord(maxMetal: number) → string
The metalness tag from the largest metallic value: non-metallic (0), partly-metallic (under 1) or metallic.
| arg | type | description |
|---|
| maxMetal | number | |
measureMask(id: string) → void
The roughness range (2nd and 98th percentile of the mask's G channel over the opaque part), its median, and the metallic range (B channel), of a material's baked <id>_rm texture; nil when it has none.
| arg | type | description |
|---|
| id | string | |
at(v: { number }, p: number) → number
| arg | type | description |
|---|
| v | { number } | |
| p | number | |
tileWord(t: number) → string
The `tile-<metres>m` tag for a tile size (three decimals at most).
| arg | type | description |
|---|
| t | number | |
lobeWords(s: Entry) → void
The lobes a material's shading turns on, as tags (subsurface, sheen, iridescent, clearcoat, fibre highlights, anisotropic, cel-shaded, two-layer shell).
mipBytes(size: number) → number
GPU bytes of one square block-compressed texture (1 byte per pixel, BC7 / ASTC 4x4) with its full mip chain.
| arg | type | description |
|---|
| size | number | |
tagsFor(s: Entry, median: number, maxMetal: number, kb: number) → void
The tags every entry carries, in order: category, kind, style, search words, lobes, then the fixed facets (finish, metalness, light-through, card, sidedness, texture cost, tile size, animation).
| arg | type | description |
|---|
| s | Entry | |
| median | number | |
| maxMetal | number | |
| kb | number | |
add(t: string) → void
| arg | type | description |
|---|
| t | string | |
measureKB(s: Entry) → number
Texture memory of one material in KB (GPU, mipmaps included, the ORM mask counted once though it fills two slots).
build( ) → void
Write every material and the collection.yaml, measuring roughness and metalness from each baked mask and texture memory from what each material binds. Returns { count, path, totalKB }.
writeBoards( ) → number
Write boards/<id>.material for every material: its reference picture on the engine's unlit shader, which the showcase hangs beside the material. Returns the count.