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
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";framing?
ts
optional framing?: object;style
ts
style: "timber" | "pilasters";width
ts
width: 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
ref
ts
ref: string;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";features?
ts
optional features?: ArchRoofFeatures;overhang
ts
overhang: NumberRange;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[];massing
ts
massing: ArchMassing;materials
ts
materials: object;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.
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;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.
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";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;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
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).
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.
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.
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;skipped?
ts
optional skipped?: "degenerate" | "roof";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";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[];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.
maxCandidates?
ts
optional maxCandidates?: number;maxFixtures?
ts
optional maxFixtures?: number;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
circulation
ts
circulation: Bounds2[];Reserved routes in the entrance frame; furniture cannot occupy these cells.
fixtures
ts
fixtures: InteriorFixture[];identity
ts
identity: string;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[];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;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;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[];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;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
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;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;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;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 RGB, (r, g, b, pad) per vertex.
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;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";lowerRise
ts
lowerRise: number;overhang
ts
overhang: number;parapet?
ts
optional parapet?: object;height
ts
height: number;thickness
ts
thickness: number;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;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;ScatterClustering
Properties
contrast
ts
contrast: number;Steepness of the density ramp above the threshold.
scale
ts
scale: number;Noise wavelength in meters.
seedOffset
ts
seedOffset: number;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;title
ts
title: string;version
ts
version: number;Bump to re-roll every placement of this rule set.
ScatterExclusion
Properties
kind?
ts
optional kind?: "roads" | "buildings" | "water";Which avoidance radius from the scatter rules applies (roads, buildings, water).
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).
ScatterLod
Properties
keepByTier
ts
keepByTier: number[];Keep fraction per detail tier (index 0 = full detail); non-increasing.
maxInstancesPerBatch
ts
maxInstancesPerBatch: number;ScatterPolygon
Properties
density?
ts
optional density?: number;Density multiplier for this polygon (default 1).
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;weight
ts
weight: number;widthScale?
ts
optional widthScale?: NumberRange;Independent multiplier of X/Z scale (crown width/bushiness); defaults to 1.
yaw
ts
yaw: "none" | "random";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;densityPerHectare
ts
densityPerHectare: number;id
ts
id: string;lod?
ts
optional lod?: Partial<ScatterLod>;minSpacing
ts
minSpacing: number;notClasses?
ts
optional notClasses?: string[];populations
ts
populations: ScatterPopulation[];slopeMax?
ts
optional slopeMax?: number;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;foreground
ts
foreground: string;letters?
ts
optional letters?: string;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.versionStorefrontRequest
Properties
accent
ts
accent: string;at
ts
at: Vec2;Desired frontage anchor in local meters, projected onto an exterior edge.
identity
ts
identity: string;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;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;ground?
ts
optional ground?: HeightSampler;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;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.
placements
ts
placements: PlacementSet[];records
ts
records: BuildingRecord[];stats
ts
stats: WorldgenStats;WorldgenBudgets
Properties
detailedCount
ts
detailedCount: number;Buildings eligible for extra detail after reserving simplified roofs and facades for the batch.
maxBuildings
ts
maxBuildings: number;maxBuildingVertices
ts
maxBuildingVertices: number;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).
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];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";InteriorFurniture
ts
type InteriorFurniture =
| "shelf"
| "checkout"
| "table"
| "counter"
| "bed"
| "sofa"
| "desk"
| "rack"
| "bench"
| "wardrobe"
| "kitchen"
| "vanity"
| "toilet"
| "shower"
| "rug"
| "coffee-table"
| "bookcase"
| "plant"
| "dresser";InteriorRoomUse
ts
type InteriorRoomUse = "living" | "kitchen" | "bedroom" | "bathroom" | "stairwell";LandmarkDefinitions
ts
type LandmarkDefinitions = Readonly<Record<string, LandmarkDoc>>;LandmarkDoc
ts
type LandmarkDoc =
| SignLandmarkDoc
| BoxLandmarkDoc;MaterialSlot
ts
type MaterialSlot = "wall" | "roof" | "trim" | "foundation" | "window" | "door";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];Variables
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.
PLACEMENT_STRIDE
ts
const PLACEMENT_STRIDE: number;Floats per instance in PlacementSet.data: x, y, z, yaw, sx, sy, sz, r, g, b.
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
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[]
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
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?
): 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
Returns
MeshBuffers | undefined
generateSignModel()
ts
function generateSignModel(design, detail?): MeshBuffers;Parameters
design
detail?
0 | 2 | 1
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
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
interiorToLocal()
ts
function interiorToLocal(site, p): Vec2;Parameters
site
p
Returns
interiorToWorld()
ts
function interiorToWorld(site, p): Vec2;Parameters
site
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
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[];The buildings, sorted by 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
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
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[]