StoneCatalog: the single definition of every stone in stoneMaterials.
`C.build(ranges?)` writes materials/<id>.material/mat.yaml for each stone and the
collection's collection.yaml (tags, roughness measured from the baked maps,
textureKB measured from the textures the material binds). Re-runnable: it
overwrites the same files every time. Tool code (it writes files), so call it
from a tool, a test or an execute call, never from a component.
photo(what: string, cm: number) → string
| arg | type | description |
|---|
| what | string | |
| cm | number | |
get(id: string) → Stone
The definition of one stone, or nil.
| arg | type | description |
|---|
| id | string | |
ids( ) → void
Every stone id, in catalog order.
textureOwner(id: string) → string
The stone whose textures a stone draws (itself, or the stone a triplanar version shares).
| arg | type | description |
|---|
| id | string | |
texRef(name: string) → string
| arg | type | description |
|---|
| name | string | |
hasTexture(name: string) → boolean
| arg | type | description |
|---|
| name | string | |
stonesLayout(list: { any }, minSize: number) → void
The gallery page size and page that show every stone, and nothing else, on one ring of materialLibraryKit's "all" view, for `list` = Materials.list(). Mirrors the core Gallery's pagination (pages of at most PAGE_SIZE bays; a category starts a fresh page when the current one is over half full and the category fits on a page of its own). Whatever comes before the stones in the library, it returns the smallest size from `minSize` up at which the stones share one page and no other category shares it with them.
| arg | type | description |
|---|
| list | { any } | |
| minSize | number | |
stonesPageAt(size: number) → number
| arg | type | description |
|---|
| size | number | |
materialDoc(s: Stone) → void
The mat.yaml document for one stone, from the maps its recipe baked.
writeMaterial(s: Stone) → void
Write materials/<id>.material/mat.yaml for one stone (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 word a stone is tagged with: 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(rough: { number }) → string
The finish word a stone is tagged with from its roughness range: glossy (max under 0.25), satin (max under 0.6) or rough.
| arg | type | description |
|---|
| rough | { number } | |
measureRoughness(owner: string) → void
The roughness range (2nd and 98th percentile of the mask's G channel) of a stone's baked <owner>_rm texture, or nil when it has none.
| arg | type | description |
|---|
| owner | string | |
at(p: number) → number
| arg | type | description |
|---|
| p | number | |
build(ranges: { [string]: any }?) → void
Write every material and the collection.yaml. Roughness ranges are measured from each stone's baked mask (or its fixed `props.roughness` when it has no mask); `ranges` (id -> { roughness = {min,max} }) overrides them.
| arg | type | description |
|---|
| ranges | { [string]: any }? | |
writeBoards( ) → number
Write boards/<id>.material (an unlit board showing the stone's reference picture) for every stone, plus the dark board frame. Caps each reference picture at 512 px.
write(name: string, doc: { [string]: any }) → void
| arg | type | description |
|---|
| name | string | |
| doc | { [string]: any } | |