Appearance
@bendyline/molen-worldgen/kernel
Molen worldgen capability: data-driven buildings from outlines and prop placement in labeled polygons (kernel) with three.js uploads (client).
ts
import { /* … */ } from '@bendyline/molen-worldgen/kernel';Classes
MeshBufferBuilder
Constructors
Constructor
ts
new MeshBufferBuilder(): MeshBufferBuilder;Returns
Methods
addCap()
ts
addCap(
slot,
ref,
outer,
holes,
heightOf,
n,
uvOf,
color
): boolean;Triangulated cap over a ring with holes. heightOf gives each 2D vertex its y so caps can lie on sloped planes; n is the shared face normal. Returns false when triangulation fails.
Parameters
slot
ref
string
outer
readonly Vec2[]
holes
readonly readonly Vec2[][]
heightOf
(p) => number
n
uvOf
(p) => Vec2
color
Returns
boolean
addConvexPolygon()
ts
addConvexPolygon(
slot,
ref,
points,
n,
uvOf,
color
): void;Fan-triangulate a convex polygon (used for gable pentagons).
Parameters
slot
ref
string
points
readonly Vec3[]
n
uvOf
(p) => Vec2
color
Returns
void
addFlatMesh()
ts
addFlatMesh(
slot,
ref,
positions,
indices,
origin,
n,
color
): void;A flat indexed mesh (glyph outlines: x, y, 0 triples) laid in the plane z = origin[2] at origin's x, y. Vertices are shared as the source shares them, so each is emitted once rather than once per triangle; each triangle is wound to face n.
Parameters
slot
ref
string
positions
ArrayLike<number>
indices
ArrayLike<number>
origin
n
color
Returns
void
addQuad()
ts
addQuad(
slot,
ref,
p,
n,
uv,
color
): void;Parameters
slot
ref
string
p
readonly [Vec3, Vec3, Vec3, Vec3]
n
uv
readonly [Vec2, Vec2, Vec2, Vec2]
color
Returns
void
addTriangle()
ts
addTriangle(
slot,
ref,
p,
n,
uv,
color
): void;Parameters
slot
ref
string
p
n
uv
color
Returns
void
append()
ts
append(source): void;Merge already generated geometry, preserving per-building UVs and vertex colors.
Parameters
source
Returns
void
bytes()
ts
bytes(): number;Approximate GPU bytes for the current content.
Returns
number
finalize()
ts
finalize(): MeshBuffers;Returns
groupCount()
ts
groupCount(): number;Returns
number
isEmpty()
ts
isEmpty(): boolean;Returns
boolean
mark()
ts
mark(): BuilderMark;Returns
materialKeys()
ts
materialKeys(): string[];Returns
string[]
maxYSince()
ts
maxYSince(mark): number;Highest vertex emitted since a mark, without inspecting earlier buildings.
Parameters
mark
Returns
number
rollback()
ts
rollback(mark): void;Parameters
mark
Returns
void
setUvScale()
ts
setUvScale(
slot,
ref,
scale
): void;Meters per texture repeat applied to every UV emitted for (slot, ref) from now on; set it before emitting a building's faces so each texture repeats at its authored scale.
Parameters
slot
ref
string
scale
[number, number] | undefined
Returns
void
transformYSince()
ts
transformYSince(
mark,
origin,
target,
scale
): void;Fit recently emitted geometry vertically; normals use the inverse scale.
Parameters
mark
origin
number
target
number
scale
number
Returns
void
triangleCount()
ts
triangleCount(): number;Returns
number
vertexCount()
ts
vertexCount(): number;Returns
number
Interfaces
ArchApplicability
Properties
areaMax?
ts
optional areaMax?: number;areaMin?
ts
optional areaMin?: number;classes
ts
classes: string[];contextClasses?
ts
optional contextClasses?: string[];notes?
ts
optional notes?: string;ArchFacade
Properties
bands
ts
bands: object;base
ts
base: object;base.height
ts
height: NumberRange;cornice?
ts
optional cornice?: object;cornice.height
ts
height: number;floorLines
ts
floorLines: boolean;bays
ts
bays: object;cornerMargin
ts
cornerMargin: number;width
ts
width: NumberRange;details?
ts
optional details?: ArchFacadeDetails;windows
ts
windows: object;groundFloor
ts
groundFloor: "none" | "same" | "storefront";height
ts
height: NumberRange;probabilityPerBay
ts
probabilityPerBay: number;sill
ts
sill: NumberRange;style
ts
style: "punched" | "ribbon" | "grid" | "none";width
ts
width: NumberRange;ArchFacadeDetails
Metric facade ornament, fitted to actual bays and omitted when facade-bands is dropped.
Properties
awnings?
ts
optional awnings?: object;depth
ts
depth: number;balconies?
ts
optional balconies?: object;depth
ts
depth: number;every
ts
every: number;railing
ts
railing: "open" | "solid";cornerBoards?
ts
optional cornerBoards?: boolean;Trim boards up each outside wall corner.
entrance?
ts
optional entrance?: object;Visual ground entrance when no structural interior opening already supplies one.
height
ts
height: number;style
ts
style: "single" | "double" | "service";width
ts
width: number;framing?
ts
optional framing?: object;style
ts
style: "timber" | "pilasters";width
ts
width: number;paint?
ts
optional paint?: string[];Colors shutters and the door leaf are painted, one per building; default the trim darkened.
porch?
ts
optional porch?: object;A step in front of the entrance under a small canopy, on a seeded share of buildings.
canopy
ts
canopy: "flat" | "none" | "pitched";depth
ts
depth: number;probability
ts
probability: number;shutters?
ts
optional shutters?: boolean;veranda?
ts
optional veranda?: object;columns
ts
columns: boolean;depth
ts
depth: number;ArchHeightRule
Properties
height?
ts
optional height?: NumberRange;levels?
ts
optional levels?: NumberRange;when?
ts
optional when?: SelectionWhen;ArchLodTier
Properties
keep
ts
keep: ArchLodFeature[];minTier
ts
minTier: number;ArchMassing
Properties
floorHeight
ts
floorHeight: NumberRange;foundation
ts
foundation: object;exposeOnSlope
ts
exposeOnSlope: boolean;height
ts
height: NumberRange;groundFit
ts
groundFit: "platform-average" | "platform-max" | "platform-min";groundFloorHeight?
ts
optional groundFloorHeight?: NumberRange;heightFallback
ts
heightFallback: ArchHeightRule[];Used only when a request has neither height nor levels; ordered; last rule is a catch-all.
respectMinHeight
ts
respectMinHeight: boolean;setbacks
ts
setbacks: object[];aboveHeight
ts
aboveHeight: number;inset
ts
inset: number;wings
ts
wings: object;maxWingSpan
ts
maxWingSpan: number;minWingArea
ts
minWingArea: number;secondaryHeightScale
ts
secondaryHeightScale: NumberRange;split
ts
split: "none" | "rectangles";ArchMaterialChoice
Properties
palette?
ts
optional palette?: string;Key of palettes that tints this choice instead of the part palette.
ref
ts
ref: string;uvScale?
ts
optional uvScale?: [number, number];Meters per texture repeat [u, v] for this choice instead of the part scale.
weight
ts
weight: number;ArchMaterialSpec
Properties
choices
ts
choices: ArchMaterialChoice[];palette?
ts
optional palette?: string;Key of palettes used to tint this part.
tint
ts
tint: "none" | "multiply";uv
ts
uv: "meters" | "cell";uvMirror
ts
uvMirror: boolean;uvOffset
ts
uvOffset: "none" | "meters" | "cell";uvScale?
ts
optional uvScale?: [number, number];Meters per texture repeat [u, v] when uv is meters.
ArchPalette
Properties
entries
ts
entries: ArchPaletteEntry[];jitter
ts
jitter: object;hue
ts
hue: number;lightness
ts
lightness: number;saturation
ts
saturation: number;ArchPaletteEntry
Properties
color
ts
color: string;name?
ts
optional name?: string;weight
ts
weight: number;ArchProp
Properties
anchor
ts
anchor: ArchPropAnchor;count
ts
count: NumberRange;id
ts
id: string;lodTier
ts
lodTier: number;margin
ts
margin: number;model
ts
model: string;perAreaM2?
ts
optional perAreaM2?: number;probability
ts
probability: number;roof?
ts
optional roof?: ArchRoofType[];scale
ts
scale: NumberRange;spacing
ts
spacing: number;tintPalette?
ts
optional tintPalette?: string;when?
ts
optional when?: SelectionWhen;yaw
ts
yaw: "align-wall" | "random" | "fixed";ArchRoof
Properties
choices
ts
choices: ArchRoofChoice[];complexFootprint
ts
complexFootprint: "flat" | "wings";fallback
ts
fallback: "flat" | "hipped";Roof for footprints the chosen pitched form cannot cover: flat, or slopes up to a deck.
features?
ts
optional features?: ArchRoofFeatures;overhang
ts
overhang: NumberRange;partyRidge?
ts
optional partyRidge?: "between" | "along";Ridge of a building with party walls: across the row (between) or gable to the street.
perWing
ts
perWing: boolean;ridge
ts
ridge: "long-axis" | "short-axis";ArchRoofChoice
Properties
lowerPitchDeg?
ts
optional lowerPitchDeg?: NumberRange;overhang?
ts
optional overhang?: NumberRange;parapet?
ts
optional parapet?: object;height
ts
height: NumberRange;thickness
ts
thickness: number;pitchDeg?
ts
optional pitchDeg?: NumberRange;ridge?
ts
optional ridge?: "long-axis" | "short-axis";shedDirection?
ts
optional shedDirection?: "random" | "long-axis" | "downhill";type
ts
type: ArchRoofType;weight
ts
weight: number;when?
ts
optional when?: SelectionWhen;ArchRoofFeatures
Properties
dormers?
ts
optional dormers?: object;perRidgeMeters
ts
perRidgeMeters: number;probability
ts
probability: number;style
ts
style: "gable" | "shed";when?
ts
optional when?: SelectionWhen;ArchStyleDoc
Properties
applicability
ts
applicability: ArchApplicability;doc?
ts
optional doc?: string;facade
ts
facade: ArchFacade;format
ts
format: "molen/archstyle@1";id
ts
id: string;lod
ts
lod: object;tiers
ts
tiers: ArchLodTier[];lotFences?
ts
optional lotFences?: object[];Weighted boundary treatments for inferred residential lots; none leaves a yard open.
kind
ts
kind: "none" | "timber" | "masonry" | "rail";weight
ts
weight: number;lotPlans?
ts
optional lotPlans?: LotPlanChoice[];Weighted resizable plans for vacant lots; never alters a supplied mapped outline.
lots?
ts
optional lots?: ArchLots;How invented lots are laid out along a street; see ArchLots.
massing
ts
massing: ArchMassing;materials
ts
materials: object;flatRoof?
ts
optional flatRoof?: ArchMaterialSpec;foundation
ts
foundation: ArchMaterialSpec;roof
ts
roof: ArchMaterialSpec;trim
ts
trim: ArchMaterialSpec;wall
ts
wall: ArchMaterialSpec;window?
ts
optional window?: ArchMaterialSpec;palettes
ts
palettes: Record<string, ArchPalette>;props
ts
props: ArchProp[];roof
ts
roof: ArchRoof;title
ts
title: string;version
ts
version: number;Bump to re-roll every building using this style.
AtlasTextLayout
Properties
capHeight
ts
capHeight: number;Cap height in output units: what decides when the letters are worth drawing.
face
ts
face: string;The face the text was set in: the first candidate holding every character.
height
ts
height: number;lines
ts
lines: string[];quads
ts
quads: Float32Array;Per glyph x0, y0, x1, y1, u0, v0, u1, v1: the quad's lower-left and upper-right corners in output units, Y up and centered on the fitted block, and the combined texture's coordinates at those same corners.
scale
ts
scale: number;Output units per em.
width
ts
width: number;Fitted ink extent, output units.
BoxLandmarkDoc
Extends
LandmarkBase
Properties
format
ts
format: "molen/landmark@1";Inherited from
ts
LandmarkBase.formatgenerator
ts
generator: "boxes";id
ts
id: string;Inherited from
ts
LandmarkBase.idparts
ts
parts: LandmarkBoxPart[];title
ts
title: string;Inherited from
ts
LandmarkBase.titleversion
ts
version: number;Inherited from
ts
LandmarkBase.versionBoxPlacement
Properties
color
ts
color: RGB;roof?
ts
optional roof?: "gable";gable: a pitched building's stand-in, the builtin:box.gable model (walls to GABLE_BOX_EAVE of its height, then a roof ridged along local x, the longer side).
sx
ts
sx: number;sy
ts
sy: number;sz
ts
sz: number;x
ts
x: number;y
ts
y: number;yaw
ts
yaw: number;three.js rotation about +y.
z
ts
z: number;BuilderMark
Properties
lengths
ts
lengths: Map<string, [number, number]>;BuildingAppearance
Properties
trim?
ts
optional trim?: string;wall?
ts
optional wall?: string;BuildingApproach
Properties
from
ts
from: Vec2;lift?
ts
optional lift?: number;Paving lift above sampled terrain, in meters (default 0.045); clears ground overlays.
to
ts
to: Vec2;width
ts
width: number;BuildingGenerateInput
Properties
analysis?
ts
optional analysis?: FootprintAnalysis;Precomputed analysis (the batch generator analyzes once for sorting).
collapseMaterials?
ts
optional collapseMaterials?: boolean;Render textured materials as vertex colors only (fewer mesh groups).
footprintOptions?
ts
optional footprintOptions?: FootprintOptions;ground
ts
ground: HeightSampler;interiors?
ts
optional interiors?: InteriorCatalogDoc;Generate real openings and storey metadata for lazy interiors laid out by this catalog.
namedSigns?
ts
optional namedSigns?: boolean;Return storefronts that carry a sign name as BuildingResult.signs, for a batch with a glyph atlas, instead of as sign model props.
pack
ts
pack: PackIdentity;request
ts
request: BuildingRequest;simplified?
ts
optional simplified?: boolean;Budget fallback: retain roof shape and bounded facades; collapseMaterials defaults true.
style
ts
style: ArchStyleDoc;tier
ts
tier: number;0 = full detail; higher tiers drop detail; beyond the style tiers a box is emitted.
BuildingHit
Properties
distance
ts
distance: number;Distance from the query point to the record centroid.
record
ts
record: BuildingRecord;BuildingMetrics
What rules evaluate against.
Properties
areaM2
ts
areaM2: number;context?
ts
optional context?: string;elongation
ts
elongation: number;hasHoles
ts
hasHoles: boolean;height?
ts
optional height?: number;labels
ts
labels: string[];levels?
ts
optional levels?: number;perimeterM
ts
perimeterM: number;rectangularity
ts
rectangularity: number;vertexCount
ts
vertexCount: number;wings?
ts
optional wings?: number;BuildingOpening
Distances along one canonical ring edge and absolute heights.
Properties
bottom
ts
bottom: number;edge
ts
edge: number;end
ts
end: number;kind
ts
kind: "window" | "door" | "open";open is an unglazed aperture, such as the gap in a car park's perimeter wall.
start
ts
start: number;top
ts
top: number;BuildingRecipe
Properties
bayWidth
ts
bayWidth: number;box
ts
box: boolean;Beyond the last declared tier: render as a tinted box.
cornerMargin
ts
cornerMargin: number;exposeFoundation
ts
exposeFoundation: boolean;facade
ts
facade: object;bands
ts
bands: FacadeBands | undefined;details?
ts
optional details?: ArchFacadeDetails;paint?
ts
optional paint?: RGB;windows
ts
windows: FacadeWindows | undefined;floorHeight
ts
floorHeight: number;floors
ts
floors: number;foundationHeight
ts
foundationHeight: number;groundFit
ts
groundFit: "platform-average" | "platform-max" | "platform-min";groundFloorHeight
ts
groundFloorHeight: number;heightSource
ts
heightSource: "height" | "levels" | "fallback";lodKeep
ts
lodKeep: ArchLodFeature[];maxWingSpan
ts
maxWingSpan: number;minHeight
ts
minHeight: number;minWingArea
ts
minWingArea: number;parts
ts
parts: object;foundation
ts
foundation: RecipePart;roof
ts
roof: RecipePart;trim
ts
trim: RecipePart;wall
ts
wall: RecipePart;window
ts
window: RecipePart;props
ts
props: RecipeProp[];roof
ts
roof: RecipeRoof;secondaryHeightScale
ts
secondaryHeightScale: number;seed
ts
seed: string;styleId
ts
styleId: string;styleVersion
ts
styleVersion: number;totalHeight
ts
totalHeight: number;Wall height above the platform, meters.
wingSplit
ts
wingSplit: boolean;BuildingRecord
Properties
area
ts
area: number;base
ts
base: number;bounds
ts
bounds: [number, number, number, number];centroid
ts
centroid: Vec2;footprintKind
ts
footprintKind: string;height
ts
height: number;identity
ts
identity: string;interior?
ts
optional interior?: InteriorSite;Structural access metadata only; plans and furnishings are generated on demand.
roof
ts
roof: string;styleId
ts
styleId: string;tier
ts
tier: number;BuildingRequest
Properties
access?
ts
optional access?: BuildingApproach & object;Reserved approach from a public boundary to an entrance, in local meters.
Type Declaration
garage?
ts
optional garage?: boolean;appearance?
ts
optional appearance?: BuildingAppearance;Optional identity palette; explicit structural measurements still win.
clipped?
ts
optional clipped?: boolean;The outline is a cut piece of a larger shape: flat roof, seam walls, no ownership choices.
context?
ts
optional context?: string;Opaque surrounding label (e.g. the land class the outline sits in).
crown?
ts
optional crown?: BuildingCrown[];Towers and domes the building carries (a place of worship's, say), in the style's materials.
fallbackLevelsMax?
ts
optional fallbackLevelsMax?: number;The most storeys the style may guess where neither height nor levels is supplied: what the buildings around it justify. A use says what a building is for, not how tall it is.
groundOutline?
ts
optional groundOutline?: Vec2[];Shared ground-fitting footprint for related parts, in local meters.
height?
ts
optional height?: number;Known total height above the base, in meters.
holes?
ts
optional holes?: Vec2[][];identity
ts
identity: string;Caller-owned stable identity, e.g. f:123456 or room:hall-1; seeds every look choice.
interiorLabels?
ts
optional interiorLabels?: string[];Confirmed ground-floor use, independent of the exterior building classification.
labels
ts
labels: string[];Opaque category labels, most specific first (e.g. ['house', 'building']).
levels?
ts
optional levels?: number;Known floor count.
minHeight?
ts
optional minHeight?: number;Height of the lowest floor above the base (skyways, cantilevers).
outline
ts
outline: Vec2[];Local meters, any orientation; the analysis canonicalizes it.
parking?
ts
optional parking?: BuildingParkingRequest;Model decks, ramps and bays instead of rooms.
partyEdges?
ts
optional partyEdges?: number[];Outline edge indices shared with a neighbouring building: party walls. The wall is still built, since neighbours differ in height, but it takes no windows, doors, trim or storefronts, and a pitched roof turns its ridge to the row (the style's roof.partyRidge).
priority?
ts
optional priority?: number;Admission/detail priority before footprint area (default 0); inferred scenery can use -1.
seamEdges?
ts
optional seamEdges?: number[];Outline edge indices that lie on a cut boundary.
storefronts?
ts
optional storefronts?: StorefrontRequest[];style?
ts
optional style?: string;Bypass style rules with an explicit style id.
yard?
ts
optional yard?: BuildingYard;Optional lot decoration, owned once by the main house rather than by each building part.
BuildingResult
Properties
analysis
ts
analysis: FootprintAnalysis;box?
ts
optional box?: BoxPlacement;facade?
ts
optional facade?: FacadeStats;props?
ts
optional props?: PropPlacement[];Prop instances attached to the building (roof props); empty for boxes.
recipe?
ts
optional recipe?: BuildingRecipe;record?
ts
optional record?: BuildingRecord;signs?
ts
optional signs?: SignPlacement[];Named storefront signs, with namedSigns.
skipped?
ts
optional skipped?: "degenerate" | "roof";BuildingYard
Properties
driveway?
ts
optional driveway?: BuildingApproach;Separate parking approach for a home without an attached garage.
fence?
ts
optional fence?: object;Open segments: the caller reserves gaps at paths, driveways and public corridors.
height
ts
height: number;kind
ts
kind: YardFenceKind;segments
ts
segments: [Vec2, Vec2][];FacadeBands
Properties
baseHeight
ts
baseHeight: number;Base band height in meters; 0 disables.
corniceHeight
ts
corniceHeight: number;Cornice height in meters; 0 disables.
floorLines
ts
floorLines: boolean;FacadeStats
Properties
bands
ts
bands: number;storefronts
ts
storefronts: number;windows
ts
windows: number;FacadeWindows
Properties
groundFloor
ts
groundFloor: "none" | "same" | "storefront";height
ts
height: number;Window height in meters (clamped to the floor).
probabilityPerBay
ts
probabilityPerBay: number;sill
ts
sill: number;Sill height above the floor in meters.
style
ts
style: "punched" | "ribbon" | "grid" | "none";width
ts
width: number;Window width in meters (clamped to the bay).
FootprintAnalysis
Properties
area
ts
area: number;axisStrength
ts
axisStrength: number;bounds
ts
bounds: Bounds2;centroid
ts
centroid: Vec2;depth
ts
depth: number;elongation
ts
elongation: number;width / depth, always >= 1.
frame
ts
frame: Frame;holeNotices?
ts
optional holeNotices?: string[];One message per input hole that was dropped as unusable (outside the outline, crossing it, or overlapping a hole already kept). Absent when every hole was kept. A broken ring is dropped rather than thrown on: one bad inner ring must not cost the whole building.
holes
ts
holes: Vec2[][];kind
ts
kind: FootprintKind;localHoles
ts
localHoles: Vec2[][];localOutline
ts
localOutline: Vec2[];Outline in the frame; snapped when rectilinear.
outline
ts
outline: Vec2[];Cleaned outline in the caller coordinates (positive orientation).
perimeter
ts
perimeter: number;rectangularity
ts
rectangularity: number;area / (width * depth) in 0..1.
rectilinear
ts
rectilinear: boolean;reflexCount
ts
reflexCount: number;vertexCount
ts
vertexCount: number;width
ts
width: number;wings
ts
wings: Wing[];FootprintOptions
Properties
angleTolerance
ts
angleTolerance: number;tan of the maximum edge angle from an axis that still snaps (default tan 10°).
maxVertices
ts
maxVertices: number;maxWings
ts
maxWings: number;minArea
ts
minArea: number;Outlines below this area (m²) are degenerate.
minAxisStrength
ts
minAxisStrength: number;Below this axis strength (0..1) an outline has no dominant orientation.
snapTolerance
ts
snapTolerance: number;Absolute off-axis tolerance in meters (absorbs source quantization).
Frame
Rigid frame: local = R(world - origin) with R = [[c, s], [-s, c]].
Properties
c
ts
c: number;ox
ts
ox: number;oz
ts
oz: number;s
ts
s: number;GlbMaterialMeta
Properties
alphaCutoff?
ts
optional alphaCutoff?: number;Cutoff for MASK materials, default glTF value 0.5.
alphaMode?
ts
optional alphaMode?: "OPAQUE" | "MASK" | "BLEND";Standard glTF alpha handling; defaults to OPAQUE for existing generated assets.
baseColorFactor?
ts
optional baseColorFactor?: [number, number, number, number];Base color factor multiplied by COLOR_0; default white.
doubleSided?
ts
optional doubleSided?: boolean;Thin glass panels may need both sides; defaults to false.
metallic?
ts
optional metallic?: number;name
ts
name: string;roughness?
ts
optional roughness?: number;sharedSurface?
ts
optional sharedSurface?: GlbSharedSurface;GlbSharedSurface
Opt-in shared surface. UVs must already be in texture repeats; fallback PBR stays portable.
Properties
ref
ts
ref: string;slot
ts
slot: MaterialSlot;uv
ts
uv: "repeats";GlyphAtlasDoc
Properties
defaultFace
ts
defaultFace: string;distanceRange
ts
distanceRange: number;Texels of signed distance across the byte range: 128 is the outline, 255 that far inside.
emSize
ts
emSize: number;Texels per em at which the glyphs were rasterized.
faces
ts
faces: Record<string, GlyphAtlasFace>;format
ts
format: "molen/glyph-atlas@1";id
ts
id: string;padding
ts
padding: number;Texels of distance field kept around each glyph's ink.
pages
ts
pages: GlyphAtlasPage[];roles?
ts
optional roles?: Record<string, string>;Semantic names (sans, bold, serif) for face ids.
GlyphAtlasSet
Properties
distanceRange
ts
readonly distanceRange: number;docs
ts
readonly docs: readonly GlyphAtlasDoc[];hash
ts
readonly hash: string;Content hash of the documents, for cache keys.
height
ts
readonly height: number;pages
ts
readonly pages: readonly GlyphAtlasSetPage[];width
ts
readonly width: number;Combined texture size: the widest page, and every page's height stacked.
Methods
faceFor()
ts
faceFor(text, font?): string | undefined;The face that would set text, or undefined when no face holds every character.
Parameters
text
string
font?
string
Returns
string | undefined
layout()
ts
layout(text, options): AtlasTextLayout | undefined;Lay out text; undefined when no face holds every character.
Parameters
text
string
options
AtlasTextOptions
Returns
AtlasTextLayout | undefined
HeightGrid
Properties
cols
ts
cols: number;heights
ts
heights: Float32Array;Row-major heights in meters, cols * rows entries.
originX
ts
originX: number;Local coordinate of sample (0, 0).
originZ
ts
originZ: number;rows
ts
rows: number;sizeX
ts
sizeX: number;Extent covered by the grid, meters.
sizeZ
ts
sizeZ: number;HeightSampler
Ground queries in local meters. A terrain Heightfield satisfies it structurally.
Methods
normalAt()
ts
normalAt(x, z): Vec3;Parameters
x
number
z
number
Returns
sampleHeight()
ts
sampleHeight(x, z): number;Parameters
x
number
z
number
Returns
number
slopeAt()
ts
slopeAt(x, z): number;Slope 0..1 (0 = flat, 1 = vertical).
Parameters
x
number
z
number
Returns
number
InteriorCatalogDoc
Properties
fallback
ts
fallback: string;format
ts
format: "molen/interior-catalog@1";profiles
ts
profiles: InteriorProfile[];InteriorDoor
A door that closes a site's entrance. Data only: a host draws its leaves, swings them, and decides when it opens. Leaves are drawn closed. Turning leaf i about a vertical axis through its hinge by swing[i] radians (right-handed about +Y, as three.js's rotation.y) opens it into the building, and by -swing[i] out of it.
Properties
along
ts
along: Vec2;Unit horizontal direction along the wall, from the opening's start to its end.
center
ts
center: Vec3;Middle of the threshold at floor height, in the site frame.
color
ts
color: string;Paint of a panel door, or the frame of a glazed one.
hardware
ts
hardware: string;Knob or pull.
height
ts
height: number;Height of the leaves above the threshold; a fixed transom fills any opening above.
id
ts
id: string;<site identity>#door<n>, n counting the site's doors. Stable across regeneration.
inward
ts
inward: Vec2;Unit horizontal direction from the doorway into the building.
leaves
ts
leaves: InteriorDoorLeaf[];light
ts
light: boolean;A panel door with a glass light in its upper half.
look
ts
look: "panel" | "glazed";panel: a painted house door. glazed: a framed glass door, for shops and offices.
opening
ts
opening: number;Index of the doorway in site.openings.
swing
ts
swing: number[];Per leaf, the signed angle about +Y that opens it into the building.
top
ts
top: number;Top of the opening, absolute.
width
ts
width: number;Clear width between the jambs.
InteriorDoorLeaf
One hinged leaf of a door, closed.
Properties
along
ts
along: Vec2;Unit horizontal direction across the closed leaf, from the hinge to the latch edge.
hinge
ts
hinge: Vec3;Foot of the hinge axis, in the site frame, midway through the leaf's thickness.
width
ts
width: number;InteriorFixture
Properties
bounds
ts
bounds: Bounds2;Interior frame: X runs along the entrance, Z runs inward.
id
ts
id: string;kind
ts
kind: InteriorFurniture;level?
ts
optional level?: number;variant?
ts
optional variant?: number;InteriorGenerateOptions
Extended by
Properties
catalog
ts
catalog: InteriorCatalogDoc;The interior catalog, usually the style pack's interiors.
focus?
ts
optional focus?: number;The storey a viewer is on, for a building too tall to build at once: a tower plan covers only the ground floor and the floors around this one (default 0).
maxCandidates?
ts
optional maxCandidates?: number;maxFixtures?
ts
optional maxFixtures?: number;maxParkedCars?
ts
optional maxParkedCars?: number;Parked cars across all storeys of one car park (default 1,500; hard ceiling 3,000).
InteriorGeometry
Properties
bytes
ts
bytes: number;collision
ts
collision: MeshBuffers;furniture
ts
furniture: MeshBuffers;glass
ts
glass: MeshBuffers;steps
ts
steps: MeshBuffers;Visible step geometry is decorative; use this smooth solid proxy for character collision.
structure
ts
structure: MeshBuffers;InteriorPlan
Properties
atrium?
ts
optional atrium?: InteriorAtriumPlan;Walkways, shops and voids of a mall.
circulation
ts
circulation: Bounds2[];Reserved routes in the entrance frame; furniture cannot occupy these cells.
fixtures
ts
fixtures: InteriorFixture[];identity
ts
identity: string;parking?
ts
optional parking?: ParkingPlan;Stalls, columns and parked cars of a car park.
profile
ts
profile: string;rooms
ts
rooms: InteriorRoom[];seed
ts
seed: string;site
ts
site: InteriorSite;stairs
ts
stairs: InteriorStair[];stats
ts
stats: object;candidates
ts
candidates: number;rejected
ts
rejected: number;truncated
ts
truncated: boolean;storeys
ts
storeys: InteriorStorey[];tower?
ts
optional tower?: InteriorTowerPlan;Floor plates and lifts of a multi-storey building.
InteriorProfile
JSON authoring surface. Labels are opaque; geographic adapters supply their vocabulary.
Properties
aisleWidth
ts
aisleWidth: number;algorithm
ts
algorithm: InteriorAlgorithm;density
ts
density: number;furnishing
ts
furnishing: InteriorFurniture;id
ts
id: string;labels
ts
labels: string[];moduleDepth
ts
moduleDepth: number;moduleWidth
ts
moduleWidth: number;palette
ts
palette: object;accent
ts
accent: string;floor
ts
floor: string;wall
ts
wall: string;wood
ts
wood: string;residential?
ts
optional residential?: object;Residential topology; upper floors are generated only when both envelope and stairs fit.
minRoomWidth
ts
minRoomWidth: number;runPerRise
ts
runPerRise: number;stairWidth
ts
stairWidth: number;upstairs
ts
upstairs: boolean;tower?
ts
optional tower?: InteriorTowerProgram;Multi-storey floor plates around a lift core.
version
ts
version: number;InteriorRoom
Properties
bounds
ts
bounds: Bounds2;door?
ts
optional door?: object;Side facing the shared hallway; distance along Z to the center of its open doorway.
at
ts
at: number;side
ts
side: "left" | "right";id
ts
id: string;level?
ts
optional level?: number;program?
ts
optional program?: InteriorRoomUse;use
ts
use: InteriorFurniture;InteriorSite
Cheap structural descriptor; contains no generated floor plan or furniture.
Properties
access
ts
access: Vec3[];Four ramp corners: threshold left/right, outside right/left.
bounds
ts
bounds: Bounds2;ceiling
ts
ceiling: number;covers?
ts
optional covers?: Vec3[][];Extra opaque quads standing in until the interior loads, such as a roof ramp opening.
entrance
ts
entrance: Vec2;floor
ts
floor: number;holes
ts
holes: Vec2[][];identity
ts
identity: string;inward
ts
inward: Vec2;labels
ts
labels: string[];openings
ts
openings: BuildingOpening[];outline
ts
outline: Vec2[];parking?
ts
optional parking?: ParkingLayout;Car park drive layout; its presence selects the multi-storey generator.
storeys?
ts
optional storeys?: InteriorStorey[];Available storeys inferred from the exterior envelope; layouts may use fewer.
InteriorStair
Properties
bounds
ts
bounds: Bounds2;Local rectangle, ascending along +Z. The whole run is a slab opening above.
lower
ts
lower: number;steps
ts
steps: number;upper
ts
upper: number;InteriorStorey
Properties
ceiling
ts
ceiling: number;floor
ts
floor: number;open?
ts
optional open?: boolean;Open to the sky: a car park's roof deck, whose surface is the building's own roof.
LandmarkBoxPart
Properties
center
ts
center: Vec3;color
ts
color: string;size
ts
size: Vec3;tiers?
ts
optional tiers?: (0 | 1 | 2)[];yaw?
ts
optional yaw?: number;LandmarkDocs
Landmark documents as loaded: the catalog and its model documents by catalog key.
Properties
catalog
ts
catalog: unknown;models
ts
models: Readonly<Record<string, unknown>>;LandmarkLibrary
Properties
catalog
ts
readonly catalog: LandmarkCatalogDoc;definitions
ts
readonly definitions: LandmarkDefinitions;hash
ts
readonly hash: string;Hash over the catalog and every model document; a cache key for generated models.
signDesigns
ts
readonly signDesigns: Readonly<Record<string, SignDesign>>;Sign designs by short name (sign.grocery is grocery).
version
ts
readonly version: number;The catalog's version; model caches key on it.
Methods
get()
ts
get(id): LandmarkDoc | undefined;Parameters
id
string
Returns
LandmarkDoc | undefined
LotBuildingPlan
Properties
entrance
ts
entrance: Vec2;garage?
ts
optional garage?: object;entrance
ts
entrance: Vec2;outline
ts
outline: Vec2[];outline
ts
outline: Vec2[];LotPlanChoice
Properties
shape
ts
shape: LotPlanKind;weight
ts
weight: number;MeshBuffers
Properties
bytes
ts
bytes: number;colors
ts
colors: Uint8Array;8-bit linear RGB triplets.
groups
ts
groups: MeshGroup[];indices
ts
indices: Uint32Array;normals
ts
normals: Float32Array;positions
ts
positions: Float32Array;triangleCount
ts
triangleCount: number;uvs
ts
uvs: Float32Array;Per-slot UV convention: walls in meters or (bay, floor) cells, roofs in meters.
vertexCount
ts
vertexCount: number;MeshGroup
Properties
count
ts
count: number;Number of indices in the group.
materialRef
ts
materialRef: string;materialRef string (palette:#rrggbb, matgraph:<id>, pixelgrid:<id>).
slot
ts
slot: MaterialSlot;start
ts
start: number;Offset into indices of the group's first index.
ModelPlacementRequest
Properties
at
ts
at: Vec2;color?
ts
optional color?: Vec3;Instance tint as sRGB-encoded red, green and blue in 0..1; default white (the model's own).
identity
ts
identity: string;model
ts
model: string;scale?
ts
optional scale?: Vec3;yaw?
ts
optional yaw?: number;NumberRange
Properties
max
ts
max: number;min
ts
min: number;PackIdentity
Properties
name
ts
name: string;version
ts
version: string;ParkingSitePlan
Structural decisions made before the roof is built, since the top ramp passes through it.
Properties
doors
ts
doors: Door[];layout
ts
layout: ParkingLayout;roofOpening
ts
roofOpening: Vec2[] | undefined;Opening the top ramp cuts in the roof, as a ring in site coordinates.
PlacementSet
Properties
count
ts
count: number;data
ts
data: Float32Array;PLACEMENT_STRIDE floats per instance; x/z local meters, y absolute, yaw in radians.
modelRef
ts
modelRef: string;Asset id or builtin:<name>.
setId
ts
setId: string;PlantPreset
Properties
bark
ts
bark: string;bloom?
ts
optional bloom?: string;Blossom color of a flowering shrub, thicket, forb, vine, mat or hedge, and the plume of a grass patch. Drawn as part of the plant's own mesh; omitted means no visible flowers.
climber?
ts
optional climber?: string;Foliage on bounded vines supported by this broadleaf tree's own trunk and branches.
cropKind?
ts
optional cropKind?:
| "broadleaf"
| "maize"
| "cereal"
| "rice"
| "cotton"
| "cane"
| "sunflower"
| "roots";cropStage?
ts
optional cropStage?: "sown" | "growing" | "mature" | "ripe" | "stubble";crownBase
ts
crownBase: number;Fraction of height below the main canopy (ignored by ground cover and succulents).
family
ts
family:
| "broadleaf"
| "conifer"
| "palm"
| "cactus"
| "succulent"
| "bamboo"
| "banana"
| "grass"
| "fern"
| "reed"
| "mangrove"
| "deadwood"
| "shrub"
| "thicket"
| "forb"
| "vine"
| "mat"
| "fallenwood"
| "hedge"
| "rock"
| "crop";foliage
ts
foliage: string;form
ts
form:
| "round"
| "columnar"
| "umbrella"
| "feather"
| "fan"
| "branching"
| "paddle";height
ts
height: number;Mature silhouette bounds in meters; scatter supplies modest individual variation.
id
ts
id: string;leafless?
ts
optional leafless?: boolean;Derived dormant geometry. Hosts normally obtain it through seasonalPlantPresets.
leafType?
ts
optional leafType?: "broadleaved" | "needleleaved";Botanical leaf category when it differs from the procedural silhouette family.
lean
ts
lean: number;Horizontal trunk displacement as a fraction of height.
patch?
ts
optional patch?: boolean;Low vegetation assembled as a patch rather than one isolated stem.
phenology?
ts
optional phenology?: object;Temperate deciduous cycle only; omitted means no inferred seasonal leaf change.
autumn
ts
autumn: string;spring
ts
spring: string;shapeSeed?
ts
optional shapeSeed?: number;Stable branching/frond variation. Omitted or zero preserves the original shape.
stemRadius
ts
stemRadius: number;taxa?
ts
optional taxa?: string[];Source species/genus names represented by this silhouette; exact case-insensitive matches.
title
ts
title: string;version
ts
version: number;width
ts
width: number;PreparedBuildingCell
Properties
bounds
ts
bounds: [number, number, number, number, number, number];center
ts
center: [number, number, number];Cell center in the batch's coordinates.
colors
ts
colors: Uint8Array;Normalized linear RGB, (r, g, b, pad) per vertex, decoded from the sRGB-encoded buffers.
groups
ts
groups: MeshGroup[];indices
ts
indices: Uint32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>;key
ts
key: string;normals
ts
normals: Int8Array;Unit normals as normalized signed bytes, (x, y, z, pad) per vertex.
positions
ts
positions: Int16Array;Normalized offsets from center, (x, y, z, pad) per vertex, in units of positionScale.
positionScale
ts
positionScale: number;Meters per normalized unit (uniform on every axis): the object scale a renderer applies.
structuralIndices
ts
structuralIndices: Uint32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>;uvs
ts
uvs: Float32Array;PropHit
Properties
distance
ts
distance: number;index
ts
index: number;modelRef
ts
modelRef: string;scale
ts
scale: number;setId
ts
setId: string;x
ts
x: number;y
ts
y: number;yaw
ts
yaw: number;z
ts
z: number;PropPlacement
Properties
color
ts
color: RGB;model
ts
model: string;scale
ts
scale: number;x
ts
x: number;y
ts
y: number;yaw
ts
yaw: number;three.js rotation about +y.
z
ts
z: number;QueuedBuilding
Properties
analysis
ts
analysis: FootprintAnalysis;near?
ts
optional near?: number;Distance from the batch's focus to the footprint, when within the focus radius.
order
ts
order: number;request
ts
request: BuildingRequest;styleId
ts
styleId: string;RecipePart
Properties
color
ts
color: RGB;mirror
ts
mirror: boolean;offsetU
ts
offsetU: number;offsetV
ts
offsetV: number;ref
ts
ref: string;Material reference; palette refs are baked into color and become WHITE_REF.
tint
ts
tint: "none" | "multiply";uv
ts
uv: "meters" | "cell";uvScale
ts
uvScale: [number, number] | undefined;RecipeProp
Properties
anchor
ts
anchor: ArchPropAnchor;color
ts
color: RGB;Instance tint from tintPalette; white without one.
count
ts
count: number;id
ts
id: string;lodTier
ts
lodTier: number;margin
ts
margin: number;model
ts
model: string;roof?
ts
optional roof?: ArchRoofType[];scale
ts
scale: number;spacing
ts
spacing: number;yaw
ts
yaw: "align-wall" | "random" | "fixed";RecipeRoof
Properties
complexFootprint
ts
complexFootprint: "flat" | "wings";dormers?
ts
optional dormers?: object;perRidgeMeters
ts
perRidgeMeters: number;style
ts
style: "gable" | "shed";fallback
ts
fallback: "flat" | "hipped";What covers a footprint the pitched form cannot: a flat roof, or slopes up to a deck.
lowerRise
ts
lowerRise: number;overhang
ts
overhang: number;parapet?
ts
optional parapet?: object;height
ts
height: number;thickness
ts
thickness: number;partyRidge?
ts
optional partyRidge?: "between" | "along";Ridge direction for a building with party walls; see the archstyle's roof.partyRidge.
perWing
ts
perWing: boolean;ridge
ts
ridge: "long-axis" | "short-axis";rise
ts
rise: number;Rise per meter of run.
shedDirection
ts
shedDirection: -1 | 1;shedDownhill
ts
shedDownhill: boolean;type
ts
type: ArchRoofType;wide
ts
wide: boolean;The footprint is wider than a ridge spans (massing.wings.maxWingSpan).
ResolvedStylePack
Properties
archstyles
ts
archstyles: Readonly<Record<string, ArchStyleDoc>>;assets
ts
assets: Readonly<Record<string, string>>;Asset id to pack-relative sidecar path.
hash
ts
hash: string;Content hash over every document; part of cache keys.
id
ts
id: string;interiors?
ts
optional interiors?: InteriorCatalogDoc;Layouts for enterable buildings; undefined when the pack has none.
materials
ts
materials: Readonly<Record<string, "matgraph" | "pixelgrid">>;Material id to document kind.
root
ts
root: StylePackDoc;scatters
ts
scatters: Readonly<Record<string, ScatterDoc>>;version
ts
version: string;warnings
ts
warnings: string[];ScatterAltitude
Properties
max?
ts
optional max?: number;min?
ts
optional min?: number;ScatterAvoid
Properties
buildings
ts
buildings: number;roads
ts
roads: number;water
ts
water: number;ScatterBudget
Properties
maxAgricultureInstances?
ts
optional maxAgricultureInstances?: number;maxAgricultureModels?
ts
optional maxAgricultureModels?: number;maxGardenInstances?
ts
optional maxGardenInstances?: number;Instances and model varieties for garden rules: planted yards, parks and verges.
maxGardenModels?
ts
optional maxGardenModels?: number;maxGroundCoverInstances?
ts
optional maxGroundCoverInstances?: number;Instances and model varieties for groundcover rules, separate from the canopy's.
maxGroundCoverModels?
ts
optional maxGroundCoverModels?: number;maxInstances
ts
maxInstances: number;Instances the whole batch may emit, thinned uniformly across rules; 0 disables scatter.
maxInstancesPerRule
ts
maxInstancesPerRule: number;Instances one rule may emit.
maxPropModels
ts
maxPropModels: number;maxUnderstoryInstances?
ts
optional maxUnderstoryInstances?: number;maxUnderstoryModels?
ts
optional maxUnderstoryModels?: number;ScatterClustering
Properties
contrast
ts
contrast: number;Steepness of the density ramp above the threshold.
detailScale?
ts
optional detailScale?: number;Smaller wavelength for clumps inside the broad density patches, meters.
scale
ts
scale: number;Noise wavelength in meters.
seedOffset
ts
seedOffset: number;sharedSeed?
ts
optional sharedSeed?: number;Optional common density field across layers of this document. Placement seeds stay independent.
threshold
ts
threshold: number;Noise value below which density is zero.
ScatterDoc
Properties
defaults
ts
defaults: object;avoid
ts
avoid: ScatterAvoid;lod
ts
lod: ScatterLod;slopeMax
ts
slopeMax: number;doc?
ts
optional doc?: string;format
ts
format: "molen/scatter@1";id
ts
id: string;rules
ts
rules: ScatterRule[];surface
ts
surface: object;colors
ts
colors: Record<string, string>;default
ts
default: string;detail?
ts
optional detail?: Record<string, [number, number]>;title
ts
title: string;version
ts
version: number;Bump to re-roll every placement of this rule set.
ScatterExclusion
Properties
holes?
ts
optional holes?: Vec2[][];kind?
ts
optional kind?: "roads" | "buildings" | "water";Which avoidance radius from the scatter rules applies (roads, buildings, water).
label?
ts
optional label?: string;Source category, used by habitat proximity rules (e.g. river, lake, ocean).
polyline?
ts
optional polyline?: Vec2[];radius
ts
radius: number;Extra clearance in meters around the ring or polyline.
ring?
ts
optional ring?: Vec2[];width?
ts
optional width?: number;Polyline width in meters (the exclusion covers width / 2 + radius on each side).
ScatterFrame
Properties
originX
ts
originX: number;Local coordinate of the global anchor origin; cells are laid out relative to it.
originZ
ts
originZ: number;unitsPerMeter
ts
unitsPerMeter: number;Frame units per meter (1 for metric frames).
ScatterGroundCrowns
The shrub crowns a host's ground material paints, for crowns rules: one candidate crown per pattern cell, in request-local meters.
Methods
cells()
ts
cells(bounds): [number, number, number, number];Pattern cells whose crowns may fall in this request-local rectangle: [i0, j0, i1, j1].
Parameters
bounds
Returns
[number, number, number, number]
crown()
ts
crown(i, j): object;Cell (i, j)'s crown: center, radius, and the least brush (0..1) at which it is painted.
Parameters
i
number
j
number
Returns
object
brush
ts
brush: number;radius
ts
radius: number;x
ts
x: number;z
ts
z: number;open()?
ts
optional open(
x,
z,
appearance
): number;Share of an appearance class's brush the ground keeps at (x, z), where built-up ground paves over it; omitted means all of it.
Parameters
x
number
z
number
appearance
string
Returns
number
ScatterLod
Properties
coverGrowth?
ts
optional coverGrowth?: number;Largest crown widening (at least 1) that holds canopy and understory cover while a coarser tier or an instance budget thins the instances: kept ones widen by 1/sqrt(the kept share) up to this factor, and grow by its square root in height. Omitted means 1, no growth.
keepByTier
ts
keepByTier: number[];Keep fraction per detail tier (index 0 = full detail); non-increasing.
maxInstancesPerBatch
ts
maxInstancesPerBatch: number;ScatterPolygon
Properties
appearance?
ts
optional appearance?: string;The ground's appearance class here: the key a crowns rule (and surface.detail) looks its brush up by. Defaults to label.
density?
ts
optional density?: number;Density multiplier for this polygon (default 1).
ground?
ts
optional ground?: boolean;False for a polygon scatter alone sees and the ground does not draw (an inferred yard): crowns rules look through it to the polygon beneath, whose crowns the ground paints.
holes?
ts
optional holes?: Vec2[][];label
ts
label: string;ring
ts
ring: Vec2[];seed?
ts
optional seed?: number;Optional owner seed for acceptance and appearance; the shared placement grid stays fixed.
ScatterPopulation
Properties
align
ts
align: "up" | "normal";altitude?
ts
optional altitude?: ScatterAltitude;model
ts
model: string;Asset id (pack or imported namespace) or builtin:<name>.
scale
ts
scale: NumberRange;slopeMax?
ts
optional slopeMax?: number;tint?
ts
optional tint?: ScatterTint;variants?
ts
optional variants?: object[];Interchangeable forms, sampled independently of species and placement. Under the model budget, unretained variants use model. All forms must suit the same habitat/scale bounds.
model
ts
model: string;weight
ts
weight: number;weight
ts
weight: number;width?
ts
optional width?: number;Crown width in meters of the model at scale 1. A crowns rule fits the plant to the width of the crown it stands on with it; scale then varies its height alone.
widthScale?
ts
optional widthScale?: NumberRange;Independent multiplier of X/Z scale (crown width/bushiness); defaults to 1.
yaw
ts
yaw: "none" | "random" | "rows";ScatterRequest
Properties
emitBounds
ts
emitBounds: [number, number, number, number];Only candidates inside this local rectangle are emitted.
exclusions
ts
exclusions: ScatterExclusion[];frame
ts
frame: ScatterFrame;keep
ts
keep: number;Detail keep fraction in (0, 1]; smaller values yield nested subsets.
polygons
ts
polygons: ScatterPolygon[];ScatterRule
Properties
altitude?
ts
optional altitude?: ScatterAltitude;avoid?
ts
optional avoid?: Partial<ScatterAvoid>;classes
ts
classes: string[];clustering?
ts
optional clustering?: ScatterClustering;crowns?
ts
optional crowns?: Record<string, number>;Stand one plant on each shrub crown the ground material paints (see surface.detail), at its center and fitted to its width, instead of sampling densityPerHectare. Maps a ground appearance class to the brush (0..1) the ground paints it with, normally the class's surface.detail brush; other classes get no crowns. Up close the painted crown gives way to the plant, so the shrub seen from the air is the one walked up to. Crowns are kept whole: keepByTier only switches the rule off, and they stand outside their layer's instance cap (the rule's own cap bounds them). Places nothing unless the host supplies the ground's crowns (ScatterSampleInput.crowns).
densityPerHectare
ts
densityPerHectare: number;id
ts
id: string;layer?
ts
optional layer?: "canopy" | "understory" | "groundcover" | "agriculture" | "garden";Trees, shoulder-height brush, and low ground detail have independent budget pools. garden is planted ornamental vegetation (yards, parks, verges): its own pool, so a wood in the same batch cannot thin a neighborhood's planting, nor the planting the wood's brush.
lod?
ts
optional lod?: Partial<ScatterLod>;minSpacing
ts
minSpacing: number;nearWater?
ts
optional nearWater?: object;Require mapped water within this horizontal distance; never invent an oasis from climate.
classes?
ts
optional classes?: string[];maxDistance
ts
maxDistance: number;notClasses?
ts
optional notClasses?: string[];populations
ts
populations: ScatterPopulation[];rows?
ts
optional rows?: object;Regular cultivation grid, anchored in the same global frame as natural scatter.
angle
ts
angle: number;headland?
ts
optional headland?: number;interval
ts
interval: number;jitter
ts
jitter: number;spacing
ts
spacing: number;slopeMax?
ts
optional slopeMax?: number;ScatterSampleInput
Properties
acceptsRule?
ts
optional acceptsRule?: (rule, x, z) => boolean;Optional spatial rule gate in request-local meters (e.g. ecological boundaries).
Parameters
rule
x
number
z
number
Returns
boolean
budget
ts
budget: ScatterBudget;crowns?
ts
optional crowns?: ScatterGroundCrowns;The ground's painted shrub crowns; crowns rules place nothing without them.
doc
ts
doc: ScatterDoc;ground
ts
ground: HeightSampler;modelAt?
ts
optional modelAt?: (model, x, z) => string;Appearance variant only (e.g. season); candidate seeds and positions remain unchanged.
Parameters
model
string
x
number
z
number
Returns
string
pack
ts
pack: PackIdentity;request
ts
request: ScatterRequest;tier
ts
tier: number;Detail tier (0 = full); selects keepByTier.
treeline?
ts
optional treeline?: (x, z) => number | undefined;Tree line in request-local meters: the world height above which trees and brush (the canopy and understory layers) do not grow. Stands thin out over the TREELINE_FADE meters below it. Ground cover and crops are unaffected; undefined anywhere means no limit there.
Parameters
x
number
z
number
Returns
number | undefined
ScatterTint
Properties
hue
ts
hue: number;lightness
ts
lightness: number;saturation
ts
saturation: number;SelectionWhen
Properties
areaMax?
ts
optional areaMax?: number;areaMin?
ts
optional areaMin?: number;Footprint area bounds in m².
class?
ts
optional class?: string[];Match when any label equals or contains one of these words.
contextClass?
ts
optional contextClass?: string[];Match the surrounding label; the word none matches an absent context.
elongationMax?
ts
optional elongationMax?: number;elongationMin?
ts
optional elongationMin?: number;Long/short axis ratio of the oriented bounding box, >= 1.
hasHeight?
ts
optional hasHeight?: boolean;Require (true) or forbid (false) a known height.
heightMax?
ts
optional heightMax?: number;heightMin?
ts
optional heightMin?: number;Known-height bounds in meters; a rule with height bounds never matches an unknown height.
holes?
ts
optional holes?: boolean;levelsMax?
ts
optional levelsMax?: number;levelsMin?
ts
optional levelsMin?: number;notClass?
ts
optional notClass?: string[];notContextClass?
ts
optional notContextClass?: string[];rectangularityMax?
ts
optional rectangularityMax?: number;rectangularityMin?
ts
optional rectangularityMin?: number;area / (width * depth), 0..1.
verticesMax?
ts
optional verticesMax?: number;wingsMax?
ts
optional wingsMax?: number;wingsMin?
ts
optional wingsMin?: number;Roof wing count after decomposition (archstyle rules only).
SignDesign
Properties
background
ts
background: string;font?
ts
optional font?: string;Font id or semantic role from the host's font library.
foreground
ts
foreground: string;letters?
ts
optional letters?: string;letterSpacing?
ts
optional letterSpacing?: number;Additional letter spacing in em units.
mark
ts
mark: string;symbol
ts
symbol:
| "arches"
| "spark"
| "disc"
| "target"
| "cross"
| "letters"
| "cup"
| "tag"
| "roofline"
| "star"
| "burger"
| "bell"
| "bucket"
| "domino";text
ts
text: string;SignLandmarkDoc
Extends
LandmarkBase
Properties
appearance
ts
appearance: object;accent
ts
accent: string;wall
ts
wall: string;format
ts
format: "molen/landmark@1";Inherited from
ts
LandmarkBase.formatgenerator
ts
generator: "sign";id
ts
id: string;Inherited from
ts
LandmarkBase.idsign
ts
sign: SignDesign;storefront
ts
storefront: object;sharedWidth
ts
sharedWidth: number;style?
ts
optional style?: string;width
ts
width: number;title
ts
title: string;Inherited from
ts
LandmarkBase.titleversion
ts
version: number;Inherited from
ts
LandmarkBase.versionSignMeshBuffers
A batch's named signs as one mesh (see the module comment).
Properties
bounds
ts
bounds: [number, number, number, number, number, number];capHeight
ts
capHeight: number;Smallest cap height among the names, meters: when letters stop being worth drawing.
count
ts
count: number;Signs in the mesh.
indices
ts
indices: Uint32Array<ArrayBufferLike> | Uint16Array<ArrayBufferLike>;ink
ts
ink: Uint8Array;normals
ts
normals: Int8Array;Unit normals as normalized signed bytes, (x, y, z, pad) per vertex.
plate
ts
plate: Uint8Array;Normalized linear RGB plate and letter colors, (r, g, b, pad) per vertex.
plateHeight
ts
plateHeight: number;Smallest plate height, meters.
plateIndexCount
ts
plateIndexCount: number;Leading indices that draw plates and bands; the letters follow.
positions
ts
positions: Float32Array;Batch meters, (x, y, z) per vertex.
uvs
ts
uvs: Float32Array;Atlas texture coordinates, (u, v) per vertex.
SignPlacement
A named sign's place on a facade (from buildStorefronts), before its name is laid out.
Properties
fallback
ts
fallback: PropPlacement;The descriptor model to place instead when the atlas cannot set the name.
height
ts
height: number;identity
ts
identity: string;Identity of the storefront, for ordering.
maxWidth
ts
maxWidth: number;Widest plate the bay takes, and the plate's height, meters.
sign
ts
sign: StorefrontSign;x
ts
x: number;The bay's center on the wall line, at the fascia band's mid-height, batch meters.
y
ts
y: number;yaw
ts
yaw: number;Rotation about +Y of the wall's outward normal (+Z at 0).
z
ts
z: number;StorefrontRequest
Properties
accent
ts
accent: string;at
ts
at: Vec2;Desired frontage anchor in local meters, projected onto an exterior edge.
identity
ts
identity: string;sign?
ts
optional sign?: StorefrontSign;signModel
ts
signModel: string;signSize?
ts
optional signSize?: Vec2;Native sign width/height; default 4 x 1.35 meters, base Y=0, front +Z.
width?
ts
optional width?: number;StorefrontSign
A name set on a storefront's sign from a glyph atlas, in place of its sign model's own text. Used only when the batch has a glyph atlas set (WorldgenBatchInput.glyphs) that holds every character; otherwise the storefront shows signModel as before.
Properties
font?
ts
optional font?: string;Glyph atlas role or face id; default the set's default face.
ink
ts
ink: string;letterSpacing?
ts
optional letterSpacing?: number;Extra advance between letters, em.
plate
ts
plate: string;Plate and letter colors, #rrggbb.
stripe?
ts
optional stripe?: string;Accent band along the plate's lower edge.
text
ts
text: string;The name as shown; the layout may break it over two lines.
StylePackAttribution
Properties
license
ts
license: string;licenseUrl?
ts
optional licenseUrl?: string;sourceUrl?
ts
optional sourceUrl?: string;text
ts
text: string;StylePackDefaults
Properties
rules
ts
rules: StyleRule[];Ordered style rules evaluated after any world binding rules.
scatter?
ts
optional scatter?: string;Scatter rule set used when a binding does not name one.
style
ts
style: string;Archstyle used when no rule matches.
StylePackDoc
Properties
assets
ts
assets: Record<string, string>;Asset id to pack-relative molen/asset@1 sidecar path.
attribution
ts
attribution: StylePackAttribution[];defaults
ts
defaults: StylePackDefaults;doc?
ts
optional doc?: string;format
ts
format: "molen/stylepack@1";imports
ts
imports: StylePackImport[];interiors?
ts
optional interiors?: string;Pack-relative molen/interior-catalog@1 path; without one the pack has no interiors.
materials
ts
materials: Record<string, string>;Material id to pack-relative matgraph/pixelgrid document path.
name
ts
name: string;namespace
ts
namespace: string;Every style, scatter, material, and asset id must live under this namespace.
scatter
ts
scatter: Record<string, string>;Scatter id to pack-relative document path.
styles
ts
styles: Record<string, string>;Archstyle id to pack-relative document path.
title?
ts
optional title?: string;version
ts
version: string;Participates in every seed; bump to re-roll the world.
StylePackImport
Properties
namespace
ts
namespace: string;External asset namespace the pack may reference, e.g. molen.entities.
note?
ts
optional note?: string;package?
ts
optional package?: string;StyleRule
Properties
style
ts
style: string;Archstyle id to use when the rule matches.
variants?
ts
optional variants?: object[];Stable identity selects one weighted regional variant; style is the identity-free fallback.
style
ts
style: string;weight
ts
weight: number;when?
ts
optional when?: SelectionWhen;StyleSelection
Properties
ruleIndex
ts
ruleIndex: number;Index of the matching rule, or -1 when the fallback was used.
style
ts
style: string;VersionedId
Properties
id
ts
id: string;version
ts
version: number;Wing
Properties
endOnOutline
ts
endOnOutline: [boolean, boolean];Whether the start and end of the long axis reach the outline (gable ends visible).
longAxis
ts
longAxis: "u" | "v";priority
ts
priority: number;0 = dominant wing (highest ridge).
u0
ts
u0: number;u1
ts
u1: number;v0
ts
v0: number;v1
ts
v1: number;WorldgenBatchDoc
Properties
buildings
ts
buildings: BuildingRequest[];fallbackStyle?
ts
optional fallbackStyle?: string;format
ts
format: "molen/worldgen-batch@1";ground
ts
ground: WorldgenBatchGround;interiors?
ts
optional interiors?: boolean;name
ts
name: string;props?
ts
optional props?: ModelPlacementRequest[];rules?
ts
optional rules?: StyleRule[];scatter?
ts
optional scatter?: ScatterRequest;scatterId?
ts
optional scatterId?: string;tier
ts
tier: number;Detail tier to generate at (0 = full).
WorldgenBatchGround
Properties
dx
ts
dx: number;Rise per meter along +x and +z (slope only).
dz
ts
dz: number;height
ts
height: number;Ground height at the origin, meters.
kind
ts
kind: "flat" | "slope";WorldgenBatchInput
Properties
budgets?
ts
optional budgets?: Partial<WorldgenBudgets>;buildings
ts
buildings: BuildingRequest[];fallbackStyle?
ts
optional fallbackStyle?: string;focus?
ts
optional focus?: object;Where a viewer stands, in the buildings' own frame. Buildings within radius of it are queued nearest first, ahead of every other, so the batch's detail budget (and with it real entrances and interiors) goes to what the viewer can walk up to instead of to the largest footprints. Omitted, the queue is by priority and area alone.
radius
ts
radius: number;x
ts
x: number;z
ts
z: number;glyphs?
ts
optional glyphs?: GlyphAtlasSet;Glyph atlas metrics for storefront names (StorefrontRequest.sign): with it, named storefronts build WorldgenBatchOutput.signs; without it they show their sign models.
ground?
ts
optional ground?: HeightSampler;hashOutput?
ts
optional hashOutput?: boolean;Hash the output (WorldgenBatchOutput.hash, default true). Streaming skips it, leaving the hash empty: SHA-256 over every array was a fifth of a batch's generation, and nothing reads it there. Compare outputs with hashWorldgenOutput instead.
interiors?
ts
optional interiors?: boolean;Real ground-floor openings and lazy interior descriptors; needs the pack's interiors.
pack
ts
pack: ResolvedStylePack;props?
ts
optional props?: ModelPlacementRequest[];Authored point placements, admitted before procedural scatter.
rules?
ts
optional rules?: StyleRule[];Rules evaluated before the pack defaults (e.g. from a world binding).
scatter?
ts
optional scatter?: ScatterRequest;scatterEnvironment?
ts
optional scatterEnvironment?: Pick<ScatterSampleInput, "doc" | "pack" | "acceptsRule" | "modelAt" | "treeline" | "crowns">;A composed scatter channel with its own identity and optional spatial rule gate.
scatterId?
ts
optional scatterId?: string;tier?
ts
optional tier?: number;Detail tier for the batch (0 = full).
WorldgenBatchOutput
Properties
buildings?
ts
optional buildings?: MeshBuffers;hash
ts
hash: string;sha256 over every output array; equal hashes mean byte-identical output. Empty when the input set hashOutput: false.
placements
ts
placements: PlacementSet[];records
ts
records: BuildingRecord[];signs?
ts
optional signs?: SignMeshBuffers;Named storefront signs as one mesh; drawn with the glyph atlas's texture.
stats
ts
stats: WorldgenStats;WorldgenBudgets
Properties
detailedCount
ts
detailedCount: number;Buildings eligible for extra detail after reserving simplified roofs and facades for the batch.
maxAgricultureInstances?
ts
optional maxAgricultureInstances?: number;maxAgricultureModels?
ts
optional maxAgricultureModels?: number;maxBuildings
ts
maxBuildings: number;maxBuildingVertices
ts
maxBuildingVertices: number;maxGardenInstances?
ts
optional maxGardenInstances?: number;Planted ornamental vegetation (the garden layer); omitted or zero disables it.
maxGardenModels?
ts
optional maxGardenModels?: number;maxGroundCoverInstances
ts
maxGroundCoverInstances: number;Instances scatter rules on the groundcover layer may emit per batch: knee-high near detail with its own budget, so it never thins the canopy. 0 disables ground cover.
maxGroundCoverModels
ts
maxGroundCoverModels: number;Model varieties admitted for ground cover, on top of maxPropModels.
maxInstances
ts
maxInstances: number;Non-building instances per batch: signs, mapped props, roof props, then scatter; 0 disables them.
maxInstancesPerRule
ts
maxInstancesPerRule: number;Instances one scatter rule may emit per batch.
maxMaterialGroups
ts
maxMaterialGroups: number;maxPropModels
ts
maxPropModels: number;Model varieties admitted by procedural scatter (authored identity models are separate).
maxSigns?
ts
optional maxSigns?: number;Named storefront signs per batch (see StorefrontRequest.sign); default 1,000. They count against maxInstances first, as sign models do.
maxUnderstoryInstances?
ts
optional maxUnderstoryInstances?: number;Separate shoulder-height brush pool; omitted or zero disables it.
maxUnderstoryModels?
ts
optional maxUnderstoryModels?: number;WorldgenBuildingData
Properties
appearance?
ts
optional appearance?: BuildingAppearance;height?
ts
optional height?: number;holes?
ts
optional holes?: Vec2[][];labels?
ts
optional labels?: string[];Labels the style's rules and props may look at (default: ['building']).
levels?
ts
optional levels?: number;outline
ts
outline: Vec2[];Outline in entity-local meters (+x right, +z toward the viewer), no closing point.
seed?
ts
optional seed?: string;Stable identity for the seed (default: the entity id).
storefronts?
ts
optional storefronts?: StorefrontRequest[];style
ts
style: string;Style id in the loaded pack, e.g. 'molen.worldgen.fantasy.hall'.
tier?
ts
optional tier?: number;Detail tier (default 0).
WorldgenHandle
Properties
index
ts
readonly index: WorldgenIndex;Methods
buildingAt()
ts
buildingAt(x, z): BuildingRecord | undefined;Parameters
x
number
z
number
Returns
BuildingRecord | undefined
buildingsNear()
ts
buildingsNear(
x,
z,
radius
): BuildingHit[];Parameters
x
number
z
number
radius
number
Returns
propsNear()
ts
propsNear(
x,
z,
radius
): PropHit[];Parameters
x
number
z
number
radius
number
Returns
PropHit[]
WorldgenIndex
Properties
buildingCount
ts
readonly buildingCount: number;cellSize
ts
readonly cellSize: number;propCount
ts
readonly propCount: number;Methods
add()
ts
add(records, placements): void;Merge another batch into this index (e.g. a neighbouring batch).
Parameters
records
readonly BuildingRecord[]
placements
readonly PlacementSet[]
Returns
void
buildingAt()
ts
buildingAt(x, z): BuildingRecord | undefined;The building whose bounds contain the point and whose outline (when known) contains it.
Parameters
x
number
z
number
Returns
BuildingRecord | undefined
buildingsNear()
ts
buildingsNear(
x,
z,
radius
): BuildingHit[];Buildings whose centroid lies within radius, nearest first.
Parameters
x
number
z
number
radius
number
Returns
propsNear()
ts
propsNear(
x,
z,
radius
): PropHit[];Prop and scatter instances within radius, nearest first.
Parameters
x
number
z
number
radius
number
Returns
PropHit[]
WorldgenIndexOptions
Properties
cellSize?
ts
optional cellSize?: number;Bucket size in meters (default 64).
outlines?
ts
optional outlines?: ReadonlyMap<string, readonly Vec2[]>;Outlines by identity so buildingAt can test the footprint, not only the bounds.
WorldgenProgress
Properties
done
ts
done: number;total
ts
total: number;WorldgenStats
Properties
buildingsBoxed
ts
buildingsBoxed: number;buildingsDropped
ts
buildingsDropped: number;buildingsIn
ts
buildingsIn: number;buildingsRendered
ts
buildingsRendered: number;buildingsSkipped
ts
buildingsSkipped: number;capFailures
ts
capFailures: number;footprintKinds
ts
footprintKinds: Record<string, number>;instanceBytes
ts
instanceBytes: number;materialsCollapsed
ts
materialsCollapsed: number;Buildings using vertex colors to satisfy geometry or material budgets.
meshBytes
ts
meshBytes: number;placementsByModel
ts
placementsByModel: Record<string, number>;roofs
ts
roofs: Record<string, number>;styles
ts
styles: Record<string, number>;triangles
ts
triangles: number;vertices
ts
vertices: number;Type Aliases
ArchLodFeature
ts
type ArchLodFeature =
| "roof-shape"
| "roof-features"
| "facade-texture"
| "facade-bands"
| "props";ArchPropAnchor
ts
type ArchPropAnchor = "roof-ridge" | "roof-flat" | "roof-edge" | "wall-any" | "ground-any";ArchRoofType
ts
type ArchRoofType = "flat" | "gable" | "hip" | "pyramid" | "shed" | "mansard" | "gambrel";Bounds2
ts
type Bounds2 = [number, number, number, number];BuildingCrown
ts
type BuildingCrown = "spire" | "belfry" | "dome" | "minaret" | "shikhara";A tall feature a building is known by from a distance, built in the style's own wall and roof materials: a square tower under a spire (spire) or a low cap (belfry), a dome on a drum, a slender round tower with a gallery (minaret), or a stepped, tapering tower (shikhara).
FootprintKind
ts
type FootprintKind =
| "box"
| "L"
| "T"
| "U"
| "Z"
| "stair"
| "H"
| "plus"
| "courtyard"
| "complex"
| "irregular"
| "degenerate";InteriorAlgorithm
ts
type InteriorAlgorithm =
| "aisles"
| "dining"
| "rooms"
| "workplace"
| "storage"
| "hall"
| "residential"
| "parking"
| "tower"
| "atrium"
| "auditorium"
| "court"
| "concourse"
| "gallery"
| "apparatus";InteriorFurniture
ts
type InteriorFurniture =
| "shelf"
| "checkout"
| "table"
| "counter"
| "bed"
| "sofa"
| "desk"
| "rack"
| "bench"
| "wardrobe"
| "kitchen"
| "vanity"
| "toilet"
| "shower"
| "rug"
| "coffee-table"
| "bookcase"
| "plant"
| "dresser"
| "reception"
| "seat-row"
| "pew"
| "altar"
| "screen"
| "plinth"
| "painting"
| "court-lines"
| "hoop"
| "bleacher"
| "ticket-gate"
| "fire-engine"
| "planter";InteriorRoomUse
ts
type InteriorRoomUse = "living" | "kitchen" | "bedroom" | "bathroom" | "stairwell";LandmarkDefinitions
ts
type LandmarkDefinitions = Readonly<Record<string, LandmarkDoc>>;LandmarkDoc
ts
type LandmarkDoc =
| SignLandmarkDoc
| BoxLandmarkDoc;LotPlanKind
ts
type LotPlanKind =
| "cottage"
| "ranch"
| "front-garage"
| "side-garage"
| "courtyard"
| "compact"
| "shopfront";MaterialSlot
ts
type MaterialSlot = "wall" | "roof" | "trim" | "foundation" | "window" | "door";PlantSeason
ts
type PlantSeason = "summer" | "spring" | "autumn" | "winter";RGB
ts
type RGB = [number, number, number];Linear RGB, each channel 0..1.
StylePackDocumentReader
ts
type StylePackDocumentReader = (relativePath) => Promise<unknown>;Parameters
relativePath
string
Returns
Promise<unknown>
Vec2
ts
type Vec2 = [number, number];Vec3
ts
type Vec3 = [number, number, number];YardFenceKind
ts
type YardFenceKind = "timber" | "masonry" | "rail";Variables
BUILDING_CROWNS
ts
const BUILDING_CROWNS: readonly BuildingCrown[];DEFAULT_FOOTPRINT_OPTIONS
ts
const DEFAULT_FOOTPRINT_OPTIONS: FootprintOptions;DEFAULT_WORLDGEN_BUDGETS
ts
const DEFAULT_WORLDGEN_BUDGETS: WorldgenBudgets;Generic per-batch caps; world bindings scale these by quality and detail level.
DOTTED_ID_RE
ts
const DOTTED_ID_RE: RegExp;Namespaced dotted id, e.g. molen.worldgen.pnw.house.
FLAT_GROUND
ts
const FLAT_GROUND: HeightSampler;A perfectly flat ground plane at y = 0.
GABLE_BOX_EAVE
ts
const GABLE_BOX_EAVE: 0.62 = .62;Eave of the unit builtin:box.gable model, as a fraction of its height.
INTERIOR_DOOR_OPEN_ANGLE
ts
const INTERIOR_DOOR_OPEN_ANGLE: number;How far a leaf turns when fully open: just short of square, clear of the jamb.
INTERIOR_DOOR_THICKNESS
ts
const INTERIOR_DOOR_THICKNESS: 0.045 = .045;Thickness of a leaf, and how far its outer face stands back from the wall plane.
LOT_PLAN_KINDS
ts
const LOT_PLAN_KINDS: readonly LotPlanKind[];MAX_PARAPET_HEIGHT
ts
const MAX_PARAPET_HEIGHT: number;Tallest parapet drawn, meters, whatever the style asks for: low enough that a walker who lands on a flat roof (bailing out of an aircraft, say) can jump onto it and over. The walk controller's jump clears about 1.1 m; this keeps a margin below that, and examples/world-explorer/src/walk-parapets.test.ts checks the two still agree.
PLACEMENT_STRIDE
ts
const PLACEMENT_STRIDE: number;Floats per instance in PlacementSet.data: x, y, z, yaw, sx, sy, sz, r, g, b.
plantPresetSchema
ts
const plantPresetSchema: z.ZodType<PlantPreset>;scatterSchema
ts
const scatterSchema: z.ZodType<ScatterDoc>;styleRuleSchema
ts
const styleRuleSchema: z.ZodType<StyleRule>;whenSchema
ts
const whenSchema: z.ZodType<SelectionWhen>;WORLDGEN_BUILDING_COMPONENT
ts
const WORLDGEN_BUILDING_COMPONENT: string;WORLDGEN_SEED_SCHEME
ts
const WORLDGEN_SEED_SCHEME: "wg1";WorldgenBuilding
ts
const WorldgenBuilding: object;Bare component handle (structurally a kernel ComponentType) without pulling the kernel.
Type Declaration
__type?
ts
readonly optional __type?: WorldgenBuildingData;name
ts
readonly name: string;Functions
analyzeFootprint()
ts
function analyzeFootprint(
outline,
holes?,
options?
): FootprintAnalysis;Parameters
outline
readonly Vec2[]
holes?
readonly readonly Vec2[][]
options?
Returns
aspectSeed()
ts
function aspectSeed(buildingSeed, aspect): number;Seed of one named aspect (massing, roof, palette:<name>, ...) of a building.
Parameters
buildingSeed
string
aspect
string
Returns
number
buildingCellTransferables()
ts
function buildingCellTransferables(cells): ArrayBuffer[];Parameters
cells
readonly PreparedBuildingCell[]
Returns
ArrayBuffer[]
buildingMetrics()
ts
function buildingMetrics(request, analysis): BuildingMetrics;Metrics a rule engine evaluates for one request + analysis.
Parameters
request
analysis
Returns
buildingSeedString()
ts
function buildingSeedString(
pack,
style,
identity
): string;Parameters
pack
style
identity
string
Returns
string
buildInteriorDoorFrame()
ts
function buildInteriorDoorFrame(door, out): void;The fixed parts round door's leaves: a head rail and a glazed transom over them where the opening is taller than the door. Adds nothing when the leaves fill the opening.
Parameters
door
out
Returns
void
buildInteriorDoorLeaf()
ts
function buildInteriorDoorLeaf(
door,
leafIndex,
out
): void;One leaf of door, closed, into out (slot trim, material palette:#ffffff). Panels, glass and hardware are on both faces. A host that swings the leaf rotates exactly the vertices this call adds about the leaf's hinge.
Parameters
door
leafIndex
number
out
Returns
void
buildSignMesh()
ts
function buildSignMesh(
placements,
glyphs,
maxSigns
): object;Lay out every placement's name and build the batch's sign mesh. A placement whose name the atlas cannot set returns its fallback model; past maxSigns, placements are dropped.
Parameters
placements
readonly SignPlacement[]
glyphs
maxSigns
number
Returns
object
fallbacks
ts
fallbacks: PropPlacement[];mesh?
ts
optional mesh?: SignMeshBuffers;clipRingToRect()
ts
function clipRingToRect(ring, rect): Vec2[];Sutherland-Hodgman clip of a ring against an axis-aligned rectangle.
Parameters
ring
readonly Vec2[]
rect
Returns
Vec2[]
createGlyphAtlasSet()
ts
function createGlyphAtlasSet(input): GlyphAtlasSet;Combine glyph atlas documents (metrics only; pixels stay with the renderer). Every document must share one distance range, so a single material reads them all. Later documents add faces; the first document's default face is the set's default.
Parameters
input
readonly unknown[]
Returns
createHeightSampler()
ts
function createHeightSampler(grid): HeightSampler;Parameters
grid
Returns
createLandmarkLibrary()
ts
function createLandmarkLibrary(docs): LandmarkLibrary;Validate landmark documents and derive what the generators read from them.
Parameters
docs
Returns
createLotBuildingPlan()
ts
function createLotBuildingPlan(
shape,
width,
depth
): LotBuildingPlan;Plans stay inside the supplied envelope, with an open approach to every entrance.
Parameters
shape
width
number
depth
number
Returns
createParkingSite()
ts
function createParkingSite(
request,
plan,
floor,
storeys,
ground,
seams?
): InteriorSite;The structural site of a car park whose exterior height is now final.
Parameters
request
plan
floor
number
storeys
ground
seams?
ReadonlySet<number>
Returns
createWorldgenIndex()
ts
function createWorldgenIndex(
records?,
placements?,
options?
): WorldgenIndex;Parameters
records?
readonly BuildingRecord[]
placements?
readonly PlacementSet[]
options?
Returns
directionToWorld()
ts
function directionToWorld(frame, local): Vec2;Rotate a local direction into world space (no translation).
Parameters
frame
local
Returns
emptyWorldgenStats()
ts
function emptyWorldgenStats(): WorldgenStats;Returns
encodeGlb()
ts
function encodeGlb(
buffers,
materials?,
generator?
): Uint8Array;Parameters
buffers
materials?
readonly GlbMaterialMeta[]
generator?
string
Returns
Uint8Array
generateBuilding()
ts
function generateBuilding(input, out): BuildingResult;Parameters
input
out
Returns
generateInteriorGeometry()
ts
function generateInteriorGeometry(plan, catalog): InteriorGeometry;Parameters
plan
catalog
Returns
generateInteriorGeometrySteps()
ts
function generateInteriorGeometrySteps(plan, catalog): Generator<void, InteriorGeometry, void>;Structured low-poly furniture, baked into one shared vertex-color batch per interior.
Parameters
plan
catalog
Returns
Generator<void, InteriorGeometry, void>
generateInteriorPlan()
ts
function generateInteriorPlan(site, options): InteriorPlan;Parameters
site
options
Returns
generateInteriorPlanSteps()
ts
function generateInteriorPlanSteps(site, options): Generator<void, InteriorPlan, void>;Cooperative pure layout pass. Named coordinate draws keep retained modules stable under caps.
Parameters
site
options
Returns
Generator<void, InteriorPlan, void>
generateLandmarkModel()
ts
function generateLandmarkModel(
name,
definitions,
detail?,
fonts?
): MeshBuffers | undefined;Generate a landmark's sign or metric box recipe from the loaded definitions (a landmark library's definitions); undefined when name is not among them. Detail 2 retains the main silhouette.
Parameters
name
string
definitions
detail?
0 | 2 | 1
fonts?
FontLibrary
Returns
MeshBuffers | undefined
generateSignModel()
ts
function generateSignModel(
design,
detail?,
fonts?
): MeshBuffers;Parameters
design
detail?
0 | 2 | 1
fonts?
FontLibrary
Returns
generateWorldgenBatch()
ts
function generateWorldgenBatch(input): WorldgenBatchOutput;Run the stepwise generator to completion.
Parameters
input
Returns
generateWorldgenBatchSteps()
ts
function generateWorldgenBatchSteps(input, step?): Generator<WorldgenProgress, WorldgenBatchOutput, void>;Parameters
input
step?
number
Returns
Generator<WorldgenProgress, WorldgenBatchOutput, void>
groundSamplerForBatch()
ts
function groundSamplerForBatch(ground): HeightSampler;Ground sampler for a batch document.
Parameters
ground
Returns
hashCoord()
ts
function hashCoord(
a,
b,
salt
): number;Hash two integer coordinates and a salt into a uint32 using integer multiplies only.
Parameters
a
number
b
number
salt
number
Returns
number
hashString()
ts
function hashString(value): number;FNV-1a of a string (bit-compatible with the kernel seedToInt).
Parameters
value
string
Returns
number
hashWorldgenOutput()
ts
function hashWorldgenOutput(
buildings,
placements,
signs?
): string;Hash every typed array of an output (positions, normals, uvs, colors, indices, placements, and named signs when there are any).
Parameters
buildings
MeshBuffers | undefined
placements
readonly PlacementSet[]
signs?
Returns
string
heightGridFromSampler()
ts
function heightGridFromSampler(
sampler,
originX,
originZ,
sizeX,
sizeZ,
cols,
rows
): HeightGrid;Sample any ground into a grid (fixtures, worker payloads, tests).
Parameters
sampler
originX
number
originZ
number
sizeX
number
sizeZ
number
cols
number
rows
number
Returns
installWorldgen()
ts
function installWorldgen(world, index): WorldgenHandle;Register a worldgen index on a world and get the query handle. Generated geometry never enters world state; scripts and systems query the index through the handle.
Parameters
world
World
index
Returns
interiorDoors()
ts
function interiorDoors(site, catalog): InteriorDoor[];The doors that close a site's entrances. A car park's openings stay open for cars. Houses (the residential layout) get painted panel doors, everything else framed glass; doorways 1.8 m or wider take a pair of leaves.
Parameters
site
catalog
Returns
interiorToLocal()
ts
function interiorToLocal(site, p): Vec2;Parameters
site
Pick<InteriorSite, "entrance" | "inward">
p
Returns
interiorToWorld()
ts
function interiorToWorld(site, p): Vec2;Parameters
site
Pick<InteriorSite, "entrance" | "inward">
p
Returns
matchesWhen()
ts
function matchesWhen(when, m): boolean;Parameters
when
SelectionWhen | undefined
m
Returns
boolean
normalizeBudgets()
ts
function normalizeBudgets(partial): WorldgenBudgets;Parameters
partial
Partial<WorldgenBudgets> | undefined
Returns
packIdentity()
ts
function packIdentity(pack): PackIdentity;Parameters
pack
Returns
planParkingSite()
ts
function planParkingSite(
request,
catalog,
outline,
holes,
floor,
rise,
ground,
seams?
): ParkingSitePlan | undefined;Choose doors and a drive layout. Pure and cheap: it tests a few dozen rectangles, leaving stalls to the lazy plan. Returns undefined when the footprint cannot hold even one aisle of stalls.
Parameters
request
catalog
outline
Vec2[]
holes
Vec2[][]
floor
number
rise
number
ground
seams?
ReadonlySet<number>
Returns
ParkingSitePlan | undefined
pointInRing()
ts
function pointInRing(point, ring): boolean;Even-odd containment test.
Parameters
point
ring
readonly Vec2[]
Returns
boolean
prepareBuildingCells()
ts
function prepareBuildingCells(buffers, cellSize?): PreparedBuildingCell[];Parameters
buffers
cellSize?
number
Returns
propSalt()
ts
function propSalt(
pack,
scatter,
ruleId
): number;Salt shared by every placement cell of one scatter rule.
Parameters
pack
scatter
ruleId
string
Returns
number
quantizedIdentity()
ts
function quantizedIdentity(
x,
z,
quantum?
): string;Fallback identity from a quantized centroid (c:<qx>,<qz>); prefer a real id when one exists.
Parameters
x
number
z
number
quantum?
number
Returns
string
queueBuildings()
ts
function queueBuildings(input, stats): QueuedBuilding[];Buildings sorted by explicit priority, area descending, then identity hash, with styles chosen.
Parameters
input
stats
Returns
registerWorldgenComponents()
ts
function registerWorldgenComponents(): void;Register the worldgen components in the shared vocabulary (idempotent).
Returns
void
registerWorldgenSchemas()
ts
function registerWorldgenSchemas(): void;Register every worldgen format into the shared registry (idempotent).
Returns
void
resolveInteriorProfile()
ts
function resolveInteriorProfile(labels, catalog): InteriorProfile;The first profile whose labels match, in catalog order; the fallback profile otherwise.
Parameters
labels
readonly string[]
catalog
Returns
resolveLandmarkCatalogDocuments()
ts
function resolveLandmarkCatalogDocuments(data, readDocument): Promise<Readonly<Record<string, LandmarkDoc>>>;Parameters
data
unknown
readDocument
(path) => Promise<unknown>
Returns
Promise<Readonly<Record<string, LandmarkDoc>>>
resolveStylePackDocuments()
ts
function resolveStylePackDocuments(rootDoc, readDoc): Promise<ResolvedStylePack>;Load and validate every document a manifest references; throws on any blocking issue.
Parameters
rootDoc
unknown
readDoc
Returns
Promise<ResolvedStylePack>
ringArea()
ts
function ringArea(ring): number;Parameters
ring
readonly Vec2[]
Returns
number
ringCentroid()
ts
function ringCentroid(ring): Vec2;Parameters
ring
readonly Vec2[]
Returns
samplePlacements()
ts
function samplePlacements(input): PlacementSet[];Run the stepwise sampler to completion.
Parameters
input
Returns
samplePlacementsSteps()
ts
function samplePlacementsSteps(input): Generator<WorldgenProgress, PlacementSet[], void>;Sample every rule of a scatter document over one request, yielding between cell chunks.
Parameters
input
Returns
Generator<WorldgenProgress, PlacementSet[], void>
seasonalPlantId()
ts
function seasonalPlantId(plant, season): string;Parameters
plant
season
Returns
string
seasonalPlantPresets()
ts
function seasonalPlantPresets(plants): Readonly<Record<string, PlantPreset>>;Derived recipes share dimensions and identity roots; no downloads or placement rerolls.
Parameters
plants
Readonly<Record<string, PlantPreset>>
Returns
Readonly<Record<string, PlantPreset>>
selectStyle()
ts
function selectStyle(
rules,
metrics,
fallback,
identity?
): StyleSelection;First matching rule wins; fallback closes the chain.
Parameters
rules
readonly StyleRule[]
metrics
fallback
string
identity?
string
Returns
signMeshTransferables()
ts
function signMeshTransferables(mesh): ArrayBuffer[];The sign mesh's ArrayBuffers, for posting across a worker boundary.
Parameters
mesh
SignMeshBuffers | undefined
Returns
ArrayBuffer[]
stylePackAssetIndex()
ts
function stylePackAssetIndex(pack, baseUrl): Record<string, string>;Asset index for a pack served from baseUrl: material ids map to their document URLs (so a matgraph:<id> reference loads through the client asset provider) and asset ids map to their GLB URLs (sidecar directory + model.glb).
Parameters
pack
baseUrl
string
Returns
Record<string, string>
stylePackMaterialRefs()
ts
function stylePackMaterialRefs(pack): string[];Distinct doc-backed material references (matgraph, pixelgrid) any style part may use.
Parameters
pack
Returns
string[]
toLocal()
ts
function toLocal(frame, point): Vec2;Parameters
frame
point
Returns
toWorld()
ts
function toWorld(frame, local): Vec2;Parameters
frame
local
Returns
unit01()
ts
function unit01(seed, stream): number;Independent stateless draw in [0, 1) for a (seed, stream) pair.
Parameters
seed
number
stream
number
Returns
number
unreachableRuleIssues()
ts
function unreachableRuleIssues(rules, path): ValidationIssue[];Rules after a catch-all can never run.
Parameters
rules
readonly object[]
path
string
Returns
ValidationIssue[]
validateArchStyle()
ts
function validateArchStyle(data): ValidationIssue[];Cross-field checks: ranges, pitches, weights, catch-alls, palette refs, UV scales, tiers.
Parameters
data
unknown
Returns
ValidationIssue[]
validateInteriorCatalog()
ts
function validateInteriorCatalog(data): InteriorCatalogDoc;Parameters
data
unknown
Returns
validateScatter()
ts
function validateScatter(data): ValidationIssue[];Parameters
data
unknown
Returns
ValidationIssue[]
validateStylePack()
ts
function validateStylePack(data): ValidationIssue[];Parameters
data
unknown
Returns
ValidationIssue[]
validateStylePackBundle()
ts
function validateStylePackBundle(pack): ValidationIssue[];Cross-document checks over a resolved pack.
Parameters
pack
Returns
ValidationIssue[]
validateWorldgenBatch()
ts
function validateWorldgenBatch(data): ValidationIssue[];Parameters
data
unknown
Returns
ValidationIssue[]
whenIssues()
ts
function whenIssues(
when,
path,
options?
): ValidationIssue[];Cross-field checks for one when clause (Zod cannot compare two fields).
Parameters
when
SelectionWhen | undefined
path
string
options?
wingsSupported
boolean
Returns
ValidationIssue[]
worldgenIndexOf()
ts
function worldgenIndexOf(world): WorldgenIndex | undefined;The worldgen index registered on a world (by installWorldgen), if any.
Parameters
world
World
Returns
WorldgenIndex | undefined
worldgenScriptApi()
ts
function worldgenScriptApi(handle): object;Script-facing namespace: molen.worldgen.buildingAt(x, z) and friends.
Parameters
handle
Returns
object
worldgenTransferables()
ts
function worldgenTransferables(output): ArrayBuffer[];ArrayBuffers to transfer when posting an output across a worker boundary.
Parameters
output
Returns
ArrayBuffer[]