@adatechnology/game-urban-three 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/dist/{chunk-JTXGLKOL.js → chunk-QS2K4DEO.js} +315 -11
- package/dist/chunk-QS2K4DEO.js.map +1 -0
- package/dist/index.d.ts +35 -2
- package/dist/index.global.js +479 -42
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/testing.js +1 -1
- package/package.json +6 -6
- package/dist/chunk-JTXGLKOL.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/test-area/module.ts","../src/draw.ts","../src/lamp-light.ts","../src/rounded-box.ts","../src/text.ts","../src/networks/draw-networks.ts","../src/networks/draw-pieces.ts","../src/networks/catenary.ts","../src/networks/pole-frames.ts","../src/networks/wire-runs.ts","../src/networks/draw-wires.ts","../src/networks/pieces.ts","../src/networks/draw-buried.ts","../src/networks/draw-lid.ts","../src/networks/surface-parts.ts","../src/networks/draw-surface.ts","../src/resolvers.ts","../src/test-area/scenarios.ts","../src/test-area/text.ts"],"sourcesContent":["import type * as THREE_NS from 'three'\nimport { isLightBudget } from '@adatechnology/game-render-three'\nimport type { LightBudget } from '@adatechnology/game-render-three'\nimport { discardObject3D } from '@adatechnology/game-shapes-three'\nimport type { BenchChange, ModuleArea, ModuleControl, ModuleHost, ModuleLayer, ModuleMetric, ModuleScenario, TestableItem, TestableModule, Vec3 } from '@adatechnology/game-contracts'\nimport { createPlantProvider, createUrban, createVehicleProvider, SAMPLE_CELLS } from '@adatechnology/game-urban'\nimport type { Locale, Providers, TerrainOptions, UrbanBuilder, UrbanKit, UrbanOptions } from '@adatechnology/game-urban'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\n\nimport { createUrbanThree } from '../draw'\nimport type { DrawnUrban } from '../draw'\nimport { createPlantResolver, createVehicleResolver } from '../resolvers'\nimport type { PlacementResolver } from '../resolvers'\nimport { createScenarios } from './scenarios'\nimport { fill, TEXT } from './text'\nimport type { UrbanContext, UrbanTestOptions } from './types'\nimport type { CanvasFactory } from '../text'\n\nexport const URBAN_AREA_ID = 'urban'\n\n/** The default terrain patch of the area: a rolling plain 96 m wide with a river across it and a round lake. A game passes its own through `terrain`. */\nexport const DEFAULT_TEST_TERRAIN: TerrainOptions = {\n world: { size: 96, scale: 1, origin: -48, segments: 48 },\n base: {\n level: 1.2,\n waves: [\n { kind: 'product', x: ['sin', 0.09], y: ['cos', 0.07], amplitude: 1.1 },\n { kind: 'diagonal', kx: 0.05, ky: 0.04, amplitude: 0.5 },\n ],\n },\n layers: [],\n flatten: [],\n rivers: [{ id: 'river', points: [[-48, -30], [-20, -24], [10, -30], [48, -22]], width: [3, 9], bed: { fixed: -1.2 } }],\n lakes: [{ id: 'lake', center: [24, 24], radius: [12, 12], level: -0.9, edge: [0.55, 1], reach: 1.4 }],\n forest: { zones: [{ mask: [{ axis: 'x', from: -48, to: -20, fullUntil: -40 }] }] },\n colors: [\n { kind: 'below', height: 0.1, color: 0x6b7a5a },\n { kind: 'forest', above: 0.5, color: 0x3e5a35 },\n ],\n fields: { colors: [0x7a8c55, 0x8a9a5e, 0x6f8450], cell: [8, 8] },\n water: { level: -0.35, color: 0x2b4452, roughness: 0.3, metalness: 0.25 },\n}\n\nconst FLOOR_Y = 0\nconst POLE_ROW_Z = -26\nconst POLE_GAP = 6\nconst SHEET_SHIFT_Z = -200\nconst VIEW_FAR = 600\nconst GRID = { block: 36, count: 2, width: 10 }\nconst LAMP_SHARES: Record<string, number | undefined> = { pattern: undefined, all: 1, half: 0.5, none: 0 }\n\ntype Three = typeof THREE_NS\ntype Placed = { root: THREE_NS.Object3D; drawn: DrawnUrban }\n/** A mesh, as three marks one (`isMesh`). */\nconst isMesh = (o: THREE_NS.Object3D): o is THREE_NS.Mesh => (o as THREE_NS.Mesh).isMesh === true\n\n/**\n * The urban test area as a `TestableModule`: the five poles of the Galeria in a row, a street grid with a filled block, a patch of terrain and the ten neighbourhoods of the\n * sample sheet in its cells, each drawn by the kit and `game-urban-three` (so a game that patches the catalogues sees its own). The bench draws any neighbourhood in front of the player with\n * a seed, a share of lamps on, a light budget and, when asked, the vehicles of the fleet and the species of the region; its layers show the reach of the real lights and the box of each sample.\n */\nexport function createUrbanTestModule(options: UrbanTestOptions = {}): TestableModule<UrbanContext> & { readonly placed: ReadonlyMap<string, unknown>; tick(t: number): void; readonly itemIds: readonly string[] } {\n const locale: Locale = (options.locale ?? 'pt-BR').toLowerCase().startsWith('en') ? 'en' : 'pt-BR'\n const text = TEXT[locale] as (typeof TEXT)[string]\n const terrain = options.terrain ?? DEFAULT_TEST_TERRAIN\n const seed = options.seed ?? 7\n const benchOrigin = options.benchOrigin ?? [0, -60]\n const settings = { pattern: 'downtown', seed, lamps: 'pattern', budget: 16, providers: 'none' }\n let host: ModuleHost | null = null\n let three: Three | null = null\n let clock = 0\n let helpersShown = ''\n let bench: (Placed & { plan: ReturnType<ReturnType<UrbanKit['neighbourhoods']['get']>['compose']> }) | null = null\n const placed = new Map<string, Placed>()\n let helpers: THREE_NS.Object3D[] = []\n const resolvers: { plant?: PlacementResolver; vehicle?: PlacementResolver } = {}\n\n const baseKit = createUrban(options.urban)\n const poleIds = baseKit.poles.ids()\n const patternIds = baseKit.neighbourhoods.ids()\n const itemIds = [...poleIds.map((id) => `pole_${id}`), 'street_grid', 'terrain_patch', ...patternIds]\n\n const kitWith = (overrides: { lamps?: string; budget?: number } = {}): UrbanKit => {\n const share = LAMP_SHARES[overrides.lamps ?? 'pattern']\n const urban: UrbanOptions = options.urban ?? {}\n const patch = share === undefined ? urban.patch : { ...urban.patch, neighbourhoods: { ...urban.patch?.neighbourhoods, ...Object.fromEntries(patternIds.map((id) => [id, { ...(urban.patch?.neighbourhoods?.[id] ?? {}), lit: share }])) } }\n return createUrban({ ...urban, ...(patch ? { patch } : {}), lights: { budget: overrides.budget ?? urban.lights?.budget } })\n }\n\n const resolversFor = (THREE: Three): { plant?: PlacementResolver; vehicle?: PlacementResolver } => {\n if (!resolvers.plant) resolvers.plant = createPlantResolver(THREE, { lod: 1, ...(options.plantSpec ? { toSpec: options.plantSpec } : {}) })\n if (!resolvers.vehicle && options.vehicles) resolvers.vehicle = createVehicleResolver(options.vehicles(THREE), { quality: 'lite' })\n return resolvers\n }\n const providersOf = (choice: string): Providers => {\n const providers: Providers = {}\n if (choice === 'plants' || choice === 'both') providers.plant = options.providers?.plant ?? createPlantProvider()\n if ((choice === 'vehicles' || choice === 'both') && options.vehicles) providers.vehicle = options.providers?.vehicle ?? createVehicleProvider()\n return providers\n }\n\n /** The room's light budget, when it lends one: the lights of what is drawn become its sources. */\n const lightsOption = (): { lights?: LightBudget } => (isLightBudget(host?.lights) ? { lights: host.lights } : {})\n\n const draw = (THREE: Three, build: (b: UrbanBuilder, kit: UrbanKit) => void, kit: UrbanKit, buildSeed: number): Placed => {\n const b = kit.builder({ seed: buildSeed })\n build(b, kit)\n const document = options.document ?? (globalThis as unknown as { document?: CanvasFactory }).document\n const drawn = createUrbanThree(THREE, { ...(document ? { document } : {}), resolvers: resolversFor(THREE), ...lightsOption() }).draw(b.scene())\n return { root: drawn.root, drawn }\n }\n\n const sample = (THREE: Three, key: string): Placed => {\n const kit = kitWith()\n if (key.startsWith('pole_')) return draw(THREE, (b, k) => k.poles.get(key.slice(5)).build(b, { x: 0, z: 0 }), kit, seed)\n if (key === 'street_grid') {\n return draw(THREE, (b, k) => {\n k.streets.grid(b, GRID)\n const inner = GRID.block - GRID.width\n k.block.fill(b, { cx: GRID.block / 2, cz: GRID.block / 2, size: inner - 4, minHeight: 10, maxHeight: 40, k: 3 })\n }, kit, seed)\n }\n if (key === 'terrain_patch') return draw(THREE, (b, k) => k.drawTerrain(b, k.terrain(terrain)), kit, seed)\n return draw(THREE, (b, k) => { k.neighbourhoods.get(key).compose(b, { x: 0, z: 0 }, { locale }) }, kit, seed)\n }\n\n const item = (id: string): TestableItem => ({\n id,\n name: text.items[id] ?? id,\n movable: false,\n build: (THREE: unknown) => {\n three = THREE as Three // the room hands its three.js namespace\n const made = sample(three, id)\n made.root.userData.urbanItem = id\n placed.set(made.root.uuid, made)\n return made.root\n },\n spec: (root: unknown) => {\n // an urban sample is scenery: one anchored slab of concrete as large as the sample, so the room has a body to put it on and a box to aim at\n const THREE_ = three as Three // build() ran before spec()\n const box = new THREE_.Box3().setFromObject(root as never)\n const size = box.getSize(new THREE_.Vector3())\n const centre = box.getCenter(new THREE_.Vector3())\n return { name: id, tags: ['structure'], parts: [{ id: 'ground', material: 'concrete', shape: { kind: 'box', size: [Math.max(size.x, 0.1), Math.max(size.y, 0.1), Math.max(size.z, 0.1)] }, position: [centre.x, centre.y, centre.z], anchored: true }] }\n },\n })\n\n // ---- the bench ----------------------------------------------------------------------------------------------------------------------------\n const clearBench = (): void => {\n if (!bench) return\n bench.drawn.dispose()\n bench = null\n }\n const countObjects = (root: THREE_NS.Object3D): number => {\n let n = 0\n root.traverse(() => n++)\n return n\n }\n const composeBench = (): void => {\n if (!host || !three) return\n clearBench()\n const kit = kitWith({ lamps: settings.lamps, budget: settings.budget })\n if ((settings.providers === 'vehicles' || settings.providers === 'both') && !options.vehicles) host.log(text.log.no_vehicles)\n const b = kit.builder({ seed: settings.seed })\n const made = kit.neighbourhoods.get(settings.pattern).compose(b, { x: 0, z: 0 }, { locale, providers: providersOf(settings.providers) })\n const document = options.document ?? (globalThis as unknown as { document?: CanvasFactory }).document\n const drawn = createUrbanThree(three, { ...(document ? { document } : {}), resolvers: resolversFor(three), ...lightsOption() }).draw(b.scene())\n drawn.root.position.set(benchOrigin[0], FLOOR_Y, benchOrigin[1])\n ;(host.scene as THREE_NS.Object3D).add(drawn.root) // the host's three.js scene\n bench = { root: drawn.root, drawn, plan: made }\n lightsLeft = b.lights.left\n host.log(fill(text.log.composed, settings.pattern, settings.seed, countObjects(drawn.root), drawn.lights.length), { pattern: settings.pattern, seed: settings.seed })\n helpersShown = ''\n }\n let lightsLeft = settings.budget\n const onChange = (change: BenchChange): void => {\n if (change.kind === 'layer') return refreshLayers()\n if (change.kind === 'action') {\n if (change.id === 'compose') composeBench()\n else if (change.id === 'clear') {\n clearBench()\n host?.log(text.log.cleared)\n }\n return\n }\n switch (change.id) {\n case 'pattern': settings.pattern = String(change.value); if (bench) composeBench(); break\n case 'seed': settings.seed = Number(change.value); if (bench) composeBench(); break\n case 'lamps': settings.lamps = String(change.value); if (bench) composeBench(); break\n case 'budget': settings.budget = Number(change.value); if (bench) composeBench(); break\n case 'providers': settings.providers = String(change.value); if (bench) composeBench(); break\n default: break\n }\n }\n\n // ---- the layers -----------------------------------------------------------------------------------------------------------------------------\n // the throwaway builds of the host's contract checks are never added to a scene and do not count\n const roots = (): Placed[] => [...[...placed.values()].filter((entry) => entry.root.parent), ...(bench ? [bench] : [])]\n const clearHelpers = (): void => {\n discardObject3D(helpers)\n helpers = []\n helpersShown = ''\n }\n const boxKey = (): string => `${host?.bench?.layer('light_radius')}|${host?.bench?.layer('bounds')}|${roots().length}|${bench ? bench.root.uuid : ''}`\n const refreshLayers = (): void => {\n if (!host?.bench || !three) return\n clearHelpers()\n const mark = (parent: THREE_NS.Object3D, helper: THREE_NS.Object3D): void => {\n helper.userData.helper = true\n parent.add(helper)\n helpers.push(helper)\n }\n for (const entry of roots()) {\n if (!entry.root.parent) continue\n entry.root.updateMatrixWorld(true)\n if (host.bench.layer('bounds')) {\n const box = new three.Box3().setFromObject(entry.root)\n const inverse = new three.Matrix4().copy(entry.root.matrixWorld).invert()\n box.applyMatrix4(inverse)\n mark(entry.root, new three.Box3Helper(box, 0x66ccff))\n }\n if (host.bench.layer('light_radius')) {\n for (const lamp of entry.drawn.lights) {\n // a lamp drawn through the budget is its bulb; one drawn as a real light is the light\n const light = 'bulb' in lamp ? { node: lamp.bulb, distance: lamp.part.distance, color: lamp.part.color } : lamp.isLight ? { node: lamp, distance: lamp.distance, color: lamp.color } : null\n if (!light) continue\n const reach = new three.Mesh(new (shapeGeometries(three)).SphereGeometry(Math.min(light.distance || 10, 60), 14, 8), new three.MeshBasicMaterial({ color: light.color ?? 0xffcc66, wireframe: true, transparent: true, opacity: 0.25 }))\n reach.position.copy(light.node.position)\n mark(light.node.parent ?? entry.root, reach)\n }\n }\n }\n helpersShown = boxKey()\n }\n\n const frame = (dt: number): void => {\n clock += dt\n for (const entry of roots()) entry.drawn.animate(clock)\n for (const [id, entry] of placed) {\n if (entry.root.parent) continue\n // the budget follows each lamp's bulb: a source left behind keeps the whole scene (signs, canvases) alive\n for (const lamp of entry.drawn.lights) if ('source' in lamp) lamp.source.remove()\n placed.delete(id)\n }\n if (host?.bench && boxKey() !== helpersShown && (host.bench.layer('light_radius') || host.bench.layer('bounds') || helpersShown !== '')) refreshLayers()\n }\n\n const count = (): { drawCalls: number; triangles: number; lights: number; instances: number } => {\n let drawCalls = 0\n let triangles = 0\n let lights = 0\n let instances = 0\n for (const entry of roots()) {\n entry.root.traverse((o) => {\n if ((o as THREE_NS.Light).isLight) lights += 1\n if (!isMesh(o) || o.userData.helper) return\n for (let p: THREE_NS.Object3D | null = o; p; p = p.parent) if (p.visible === false) return\n drawCalls += 1\n const instanced = (o as THREE_NS.InstancedMesh).isInstancedMesh === true\n if (instanced) instances += (o as THREE_NS.InstancedMesh).count\n const g = o.geometry\n const perInstance = (g.index ? g.index.count : g.attributes.position.count) / 3\n triangles += perInstance * (instanced ? (o as THREE_NS.InstancedMesh).count : 1)\n })\n // lamps drawn through the budget are no lights of the scene: they count as the lights they stand for\n lights += entry.drawn.lights.filter((lamp) => 'source' in lamp).length\n }\n return { drawCalls, triangles: Math.round(triangles), lights, instances }\n }\n\n // ---- the area ------------------------------------------------------------------------------------------------------------------------------\n const area = (): ModuleArea => {\n const placements: ModuleArea['placements'] = []\n poleIds.forEach((id, index) => placements.push({ item: `pole_${id}`, position: [(index - (poleIds.length - 1) / 2) * POLE_GAP, 0, POLE_ROW_Z] as Vec3, rotationY: 0 }))\n placements.push({ item: 'street_grid', position: [-230, 0, -200], rotationY: 0 })\n placements.push({ item: 'terrain_patch', position: [270, 0, -150], rotationY: 0 })\n for (const id of patternIds) {\n const cell = SAMPLE_CELLS[id]\n if (cell) placements.push({ item: id, position: [cell.x, 0, cell.z + SHEET_SHIFT_Z] as Vec3, rotationY: 0 })\n }\n const extra = patternIds.filter((id) => !SAMPLE_CELLS[id])\n extra.forEach((id, index) => placements.push({ item: id, position: [-80 + index * 80, 0, SHEET_SHIFT_Z - 112] as Vec3, rotationY: 0 }))\n return { placements, view: { eye: [20, 190, -20] as Vec3, target: [20, 0, -190] as Vec3 } }\n }\n\n return {\n id: URBAN_AREA_ID,\n name: text.name,\n ground: { surface: 'road' },\n group: text.group,\n get placed() {\n return placed\n },\n itemIds,\n tick: (t: number) => {\n for (const entry of roots()) entry.drawn.animate(t)\n },\n items: () => itemIds.map(item),\n scenarios: (): ModuleScenario<UrbanContext>[] => createScenarios({ text: TEXT[locale] as typeof text, urban: options.urban, terrain }),\n area,\n controls: (): ModuleControl[] => [\n { kind: 'choice', id: 'pattern', name: text.controls.pattern, hint: text.hints.pattern, options: patternIds.map((id) => ({ id, name: text.items[id] ?? id })), default: patternIds.includes('downtown') ? 'downtown' : (patternIds[0] as string) },\n { kind: 'number', id: 'seed', name: text.controls.seed, hint: text.hints.seed, min: 0, max: 99999, step: 1, default: seed },\n { kind: 'choice', id: 'lamps', name: text.controls.lamps, hint: text.hints.lamps, options: Object.keys(LAMP_SHARES).map((id) => ({ id, name: text.options.lamps[id] as string })), default: 'pattern' },\n { kind: 'number', id: 'budget', name: text.controls.budget, hint: text.hints.budget, min: 0, max: 64, step: 1, default: 16 },\n { kind: 'choice', id: 'providers', name: text.controls.providers, hint: text.hints.providers, options: (['none', 'plants', 'vehicles', 'both'] as const).map((id) => ({ id, name: text.options.providers[id] as string })), default: 'none' },\n { kind: 'action', id: 'compose', name: text.actions.compose },\n { kind: 'action', id: 'clear', name: text.actions.clear },\n ],\n layers: (): ModuleLayer[] => (['light_radius', 'bounds'] as const).map((id) => ({ id, name: text.layers[id], default: false })),\n metrics: (): ModuleMetric[] => [\n { id: 'samples', name: text.metrics.samples, read: () => [...placed.values()].filter((entry) => entry.root.parent).length },\n { id: 'draw_calls', name: text.metrics.draw_calls, read: () => count().drawCalls },\n { id: 'triangles', name: text.metrics.triangles, read: () => count().triangles },\n { id: 'real_lights', name: text.metrics.real_lights, read: () => count().lights },\n { id: 'instances', name: text.metrics.instances, read: () => count().instances },\n { id: 'bench_objects', name: text.metrics.bench_objects, read: () => (bench ? countObjects(bench.root) : 0) },\n { id: 'light_budget_left', name: text.metrics.light_budget_left, read: () => (bench ? lightsLeft : settings.budget) },\n ],\n attach(lent) {\n host = lent\n three = lent.THREE as Three\n // the sample sheet is 240 m wide: the room's camera sees 140 m, so the module lends it a longer view while it is loaded\n const camera = lent.camera as { far: number; updateProjectionMatrix(): void } | undefined\n const farBefore = camera?.far\n if (camera && camera.far < VIEW_FAR) {\n camera.far = VIEW_FAR\n camera.updateProjectionMatrix()\n }\n const stopChange = lent.bench?.onChange(onChange)\n const stopFrame = lent.onFrame(frame)\n return () => {\n stopChange?.()\n stopFrame()\n clearHelpers()\n clearBench()\n if (camera && farBefore !== undefined) {\n camera.far = farBefore\n camera.updateProjectionMatrix()\n }\n resolvers.plant?.dispose?.()\n resolvers.vehicle?.dispose?.()\n for (const entry of placed.values()) for (const lamp of entry.drawn.lights) if ('source' in lamp) lamp.source.remove()\n placed.clear()\n host = null\n }\n },\n }\n}\n\n/** What `loadUrbanTestModule` needs of a room: `TestRoom.loadModule` has it. */\nexport type ModuleRoomLike = { loadModule(module: never): unknown }\n\n/** Loads the urban module into a room. */\nexport function loadUrbanTestModule<Room extends ModuleRoomLike>(room: Room, options: UrbanTestOptions = {}): ReturnType<Room['loadModule']> {\n return room.loadModule(createUrbanTestModule(options) as never) as ReturnType<Room['loadModule']>\n}\n","import { markKitOrigin } from '@adatechnology/game-contracts'\nimport { LIGHT_PRIORITY } from '@adatechnology/game-render-three'\nimport type { LightBudget, SourceHandle } from '@adatechnology/game-render-three'\nimport type { ItemBox, LightPart, PartStyle, SilhouetteWindow, UrbanPart, UrbanScene } from '@adatechnology/game-urban'\nimport type { SurfacePiece, SurfacePiecesOptions, UtilityNetworks } from '@adatechnology/game-urban/networks'\nimport { shapeGeometries, standOutCoincident } from '@adatechnology/game-shapes-three'\nimport type * as THREE_NS from 'three'\n\nimport { flickerGroupOf, flickerGroupPhase, flickerLevel, physicalIntensityOf } from './lamp-light'\nimport { createPrism, createRoundedBox } from './rounded-box'\nimport { createTextTexture } from './text'\nimport type { CanvasFactory } from './text'\nimport type { PlacementResolver } from './resolvers'\nimport { drawNetworks } from './networks/draw-networks'\nimport type { DrawnNetworks, NetworkDrawOptions } from './networks/draw-networks'\nimport { drawBuried } from './networks/draw-buried'\nimport type { DrawnBuried } from './networks/draw-buried'\nimport { drawLid } from './networks/draw-lid'\nimport type { DrawnLid } from './networks/draw-lid'\nimport { drawSurface } from './networks/draw-surface'\nimport type { DrawnSurface } from './networks/draw-surface'\n\ntype Three = typeof THREE_NS\ntype Obj = THREE_NS.Object3D\n/** The lights a scene draws: street lamps and searchlights. */\nexport type UrbanLight = THREE_NS.PointLight | THREE_NS.SpotLight\n\nconst DEFAULT_ROUGHNESS = 0.9\nconst DEFAULT_METALNESS = 0\nconst ITEM_ROUNDNESS = 0.12\nconst LIT_WINDOW = 0xffb45e\nconst DARK_WINDOW = { color: 0x0d1217, roughness: 0.3, metalness: 0.5 }\nconst SIGN_FONT = '700 56px \"Arial Narrow\", Arial, sans-serif'\nconst SIGN_CANVAS = { width: 512, height: 128 }\nconst PLANE_LAYER_GAP = 0.002\n\nexport type UrbanThreeOptions = {\n /** Where canvases come from (the page's `document`). Needed only for signs and labels. */\n document?: CanvasFactory\n /** Who makes the objects of the vehicles and plants a scene places. A kind without a resolver is left empty. */\n resolvers?: { vehicle?: PlacementResolver; plant?: PlacementResolver }\n /**\n * The host's light budget: each `light` part becomes a source of it (it competes for a slot by distance; a flickering lamp and a sweeping searchlight update their source) instead of a real\n * light of the scene. `DrawnUrban.lights` then lists the sources. Without it the lights are created here (deprecated, removed in the next major).\n */\n lights?: LightBudget\n /**\n * With `lights`: give each source the intensity that lights its ground as the team's r128 page did under today's physically correct lights (`physicalIntensityOf`): a lamp at the foot\n * of its pole, a searchlight where its beam lands. Default false: the sources keep the page's numbers, as before (they light almost nothing under r155+).\n */\n physicalLights?: boolean\n /**\n * A failing lamp (`flickerPhase` on its parts) blinks its head with its light: the lens gets one material per colour and flicker group (`LAMP_FLICKER.groups`) and both follow\n * `flickerLevel` on the group's phase. Default false: the lens stays lit and the light keeps the page formula (`sin(23t + x)`...), as before.\n */\n flickerLenses?: boolean\n /** Move the parts that share a plane with another apart by 2 mm (CLAUDE.md §13, `standOutCoincident`). Flat pieces at one height are layered 2 mm apart unless this is `false`; the full mesh pass (`standOutCoincident`) runs only when it is `true`, since it costs more than the draw. */\n standOut?: boolean\n}\n\n/** What a drawn scene gives back: the group to add to a scene, the per-frame animation and the cleanup. */\nexport type DrawnUrban = {\n root: Obj\n /** Moves the animated parts to time `t` (seconds): flickering lamps and sweeping searchlights. */\n animate(t: number): void\n /** Lights drawn, for a budget meter: the lights of the scene, or (with `UrbanThreeOptions.lights`) a `BudgetedLamp` for each: its bulb in the scene and its source of the budget. */\n readonly lights: DrawnLight[]\n dispose(): void\n}\n\n/** A light part drawn through the budget: the node it hangs from, the part that describes it (distance, colour...) and the source that competes for a slot. */\nexport type BudgetedLamp = { readonly bulb: Obj; readonly part: LightPart; readonly source: SourceHandle }\n\n/** A light of `DrawnUrban.lights`: a light of the scene, or a lamp drawn through the budget. */\nexport type DrawnLight = UrbanLight | BudgetedLamp\n\nexport type DrawOptions = {\n /** Group the parts go into. Default a new `THREE.Group`. */\n root?: Obj\n}\n\n/**\n * Draws urban scenes with three.js the way the team's page does: a mesh per part in the order they were added (boxes with the\n * rounded edge, cylinders, flat-shaded cones and prisms, planes that only receive shadows, canvas signs), then one instanced mesh for\n * the small boxes and one for each kind of window. Materials are shared by colour. The instance matrices are the page's.\n */\nexport function createUrbanThree(THREE: Three, options: UrbanThreeOptions = {}) {\n // three with its primitive geometries made by game-shapes (bit-identical on r128 and r160, cached by parameters)\n const T = shapeGeometries(THREE)\n const geometries = new Map<string, THREE_NS.BufferGeometry>()\n const materials = new Map<string, THREE_NS.Material>()\n const disposables: Array<{ dispose(): void }> = []\n\n const standard = (color: number, style?: PartStyle, flat = false): THREE_NS.Material => {\n const roughness = style?.roughness ?? DEFAULT_ROUGHNESS\n const metalness = style?.metalness ?? DEFAULT_METALNESS\n const key = `s|${color}|${roughness}|${metalness}|${flat ? 1 : 0}`\n let material = materials.get(key)\n if (!material) {\n material = new THREE.MeshStandardMaterial({ color, roughness, metalness, flatShading: flat })\n materials.set(key, material)\n }\n return material\n }\n /** Lens materials of failing lamps already animated by the scene being drawn (one per colour and flicker group). */\n let animatedLenses = new Set<string>()\n /** The lens of a failing lamp: a glowing material of its own flicker group, dimmed with the group's light by the draw's animation. */\n const flickeringLens = (color: number, phase: number, animators: ((t: number) => void)[]): THREE_NS.Material => {\n const group = flickerGroupOf(phase)\n const key = `f|${color}|${group}`\n let material = materials.get(key) as THREE_NS.MeshBasicMaterial | undefined\n if (!material) {\n material = new THREE.MeshBasicMaterial({ color })\n materials.set(key, material)\n }\n if (!animatedLenses.has(key)) {\n animatedLenses.add(key)\n const lens = material\n const groupPhase = flickerGroupPhase(group)\n animators.push((t) => lens.color.setHex(color).multiplyScalar(flickerLevel(t, groupPhase)))\n }\n return material\n }\n const glowing = (color: number): THREE_NS.Material => {\n const key = `b|${color}`\n let material = materials.get(key)\n if (!material) {\n material = new THREE.MeshBasicMaterial({ color })\n materials.set(key, material)\n }\n return material\n }\n const roundedBox = (width: number, height: number, depth: number, radius: number): THREE_NS.BufferGeometry => {\n const key = [width, height, depth, radius].map((value) => value.toFixed(3)).join('|')\n let geometry = geometries.get(key)\n if (!geometry) {\n geometry = createRoundedBox(THREE, width, height, depth, radius)\n geometries.set(key, geometry)\n }\n return geometry\n }\n const shadows = (mesh: Obj, style: PartStyle | undefined, cast: boolean, receive: boolean): void => {\n mesh.castShadow = style?.castShadow ?? cast\n mesh.receiveShadow = style?.receiveShadow ?? receive\n }\n const texture = (lines: readonly string[], width: number, height: number, background: string, foreground: string, font: string): THREE_NS.Texture => {\n if (!options.document) throw new Error('createUrbanThree needs a document (option) to draw signs and labels')\n const map = createTextTexture(THREE, options.document, lines, { width, height, background, foreground, font })\n disposables.push(map)\n return map\n }\n const textPlane = (part: { x: number; y: number; z: number; width: number; height: number; ry: number }, map: THREE_NS.Texture): THREE_NS.Mesh => {\n const mesh = new THREE.Mesh(new T.PlaneGeometry(part.width, part.height), new THREE.MeshBasicMaterial({ map, transparent: true }))\n mesh.userData.own = true\n mesh.position.set(part.x, part.y, part.z)\n if (part.ry) mesh.rotation.y = part.ry\n disposables.push(mesh.geometry, mesh.material)\n return mesh\n }\n\n const forward = new THREE.Vector3(0, 0, -1)\n const aimAt = (node: Obj, from: { x: number; y: number; z: number }, to: { x: number; y: number; z: number }): void => {\n node.quaternion.setFromUnitVectors(forward, new THREE.Vector3(to.x - from.x, to.y - from.y, to.z - from.z).normalize())\n }\n\n /** The bulb of a light part as a node of the scene, and its source of the budget. */\n const sourceOf = (part: LightPart, bulb: Obj, extra: Record<string, unknown>): SourceHandle =>\n options.lights!.addSource({ owner: 'urban.light', priority: LIGHT_PRIORITY.street, color: part.color, intensity: part.intensity, distance: part.distance, decay: part.decay, position: [0, 0, 0], follow: bulb, ...extra })\n\n /** The page's flicker of a failing lamp, `I · (sin(23t + x) > 0.3 || sin(3.1t) > 0.85 ? 0.15 : 1)`. */\n const pageFlicker = (t: number, x: number): number => (Math.sin(t * 23 + x) > 0.3 || Math.sin(t * 3.1) > 0.85 ? 0.15 : 1)\n /** With `flickerLenses`, the phase of the group a failing lamp blinks in (shared with its lens); otherwise none, and the page formula runs. */\n const groupedPhaseOf = (part: LightPart): number | undefined =>\n options.flickerLenses && part.kind === 'point' && part.flickerPhase !== undefined ? flickerGroupPhase(flickerGroupOf(part.flickerPhase)) : undefined\n\n const drawBudgetedLight = (part: LightPart, animators: ((t: number) => void)[], lights: DrawnLight[]): Obj[] => {\n const bulb = new THREE.Object3D()\n bulb.position.set(part.x, part.y, part.z)\n if (part.kind === 'point') {\n const intensity = options.physicalLights ? physicalIntensityOf(part) : part.intensity\n const source = sourceOf(part, bulb, { intensity })\n lights.push({ bulb, part, source } satisfies BudgetedLamp)\n if (part.flicker) {\n const phase = groupedPhaseOf(part)\n animators.push((t) => source.update({ intensity: intensity * (phase === undefined ? pageFlicker(t, part.x) : flickerLevel(t, phase)) }))\n }\n return [bulb]\n }\n aimAt(bulb, part, part.target)\n const beam = Math.hypot(part.target.x - part.x, part.target.y - part.y, part.target.z - part.z)\n const intensity = options.physicalLights ? physicalIntensityOf(part, beam) : part.intensity\n const source = sourceOf(part, bulb, { kind: 'spot', angle: part.angle, penumbra: part.penumbra, intensity })\n lights.push({ bulb, part, source } satisfies BudgetedLamp)\n const { sweep } = part\n if (sweep) animators.push((t) => aimAt(bulb, part, { x: part.x + Math.sin(t * sweep.speed + part.x) * sweep.radius, y: 0, z: part.z + Math.cos(t * sweep.speed + part.x) * sweep.radius }))\n return [bulb]\n }\n\n const drawPart = (part: UrbanPart, animators: ((t: number) => void)[], lights: DrawnLight[]): Obj[] => {\n switch (part.shape) {\n case 'group': {\n const group = new THREE.Group()\n group.position.set(part.x, part.y, part.z)\n if (part.ry) group.rotation.y = part.ry\n return [group]\n }\n case 'box': {\n const lens = options.flickerLenses && part.emissive && part.flickerPhase !== undefined ? flickeringLens(part.color, part.flickerPhase, animators) : undefined\n const mesh = new THREE.Mesh(roundedBox(part.width, part.height, part.depth, part.radius), lens ?? (part.emissive ? glowing(part.color) : standard(part.color, part.style)))\n mesh.position.set(part.x, part.y, part.z)\n if (part.ry) mesh.rotation.y = part.ry\n if (part.rz) mesh.rotation.z = part.rz\n shadows(mesh, part.style, true, true)\n return [mesh]\n }\n case 'prism': {\n const geometry = createPrism(THREE, part.width, part.height, part.depth)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style, true))\n mesh.position.set(part.x, part.y, part.z)\n if (part.ry) mesh.rotation.y = part.ry\n shadows(mesh, part.style, true, true)\n return [mesh]\n }\n case 'cylinder': {\n const geometry = new T.CylinderGeometry(part.radiusTop, part.radiusBottom, part.height, part.segments)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style))\n mesh.position.set(part.x, part.y, part.z)\n shadows(mesh, part.style, true, true)\n return [mesh]\n }\n case 'cone': {\n const geometry = new T.ConeGeometry(part.radius, part.height, part.segments)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style, true))\n mesh.position.set(part.x, part.y, part.z)\n shadows(mesh, part.style, true, true)\n return [mesh]\n }\n case 'crown': {\n const geometry = new THREE.DodecahedronGeometry(part.radius, 0)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style))\n mesh.position.set(part.x, part.y, part.z)\n shadows(mesh, part.style, true, false)\n return [mesh]\n }\n case 'terrain': {\n const { grid } = part\n const geometry = new T.PlaneGeometry(grid.size, grid.size, grid.segments, grid.segments)\n geometry.rotateX(-Math.PI / 2)\n const position = geometry.attributes.position\n const colors = new Float32Array(position.count * 3)\n const color = new THREE.Color()\n for (let index = 0; index < position.count; index++) {\n position.setXYZ(index, grid.x[index], grid.heights[index], grid.z[index])\n color.setHex(grid.colors[index] as number)\n colors[index * 3] = color.r\n colors[index * 3 + 1] = color.g\n colors[index * 3 + 2] = color.b\n }\n geometry.setAttribute('color', new THREE.BufferAttribute(colors, 3))\n geometry.computeVertexNormals()\n disposables.push(geometry)\n const material = new THREE.MeshStandardMaterial({ vertexColors: true, flatShading: true, roughness: 1 })\n disposables.push(material)\n const mesh = new THREE.Mesh(geometry, material)\n mesh.userData.own = true\n shadows(mesh, part.style, true, true)\n return [mesh]\n }\n case 'vault': {\n const geometry = new T.CylinderGeometry(part.radius, part.radius, part.length, part.segments, 1, false, 0, part.arc)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style))\n mesh.rotation.set(part.rotation.x, part.rotation.y, part.rotation.z)\n mesh.position.set(part.x, part.y, part.z)\n mesh.scale.set(part.scale.x, part.scale.y, part.scale.z)\n shadows(mesh, part.style, true, false)\n return [mesh]\n }\n case 'plane': {\n const geometry = new T.PlaneGeometry(part.width, part.depth).rotateX(-Math.PI / 2)\n disposables.push(geometry)\n const mesh = new THREE.Mesh(geometry, standard(part.color, part.style))\n mesh.position.set(part.x, part.y, part.z)\n shadows(mesh, part.style, false, true)\n return [mesh]\n }\n case 'line': {\n const geometry = new THREE.BufferGeometry().setFromPoints(part.points.map(([x, y, z]) => new THREE.Vector3(x, y, z)))\n const mesh = new THREE.Line(geometry, new THREE.LineBasicMaterial({ color: part.color }))\n mesh.userData.own = true\n disposables.push(geometry, mesh.material)\n return [mesh]\n }\n case 'sign':\n return [textPlane(part, texture([part.text], SIGN_CANVAS.width, SIGN_CANVAS.height, part.background, part.foreground, SIGN_FONT))]\n case 'label':\n return [textPlane(part, texture(part.lines, part.canvas.width, part.canvas.height, part.background, part.foreground, part.font))]\n case 'placement': {\n const holder = new THREE.Group()\n holder.position.set(part.x, part.y, part.z)\n if (part.ry) holder.rotation.y = part.ry\n if (part.scale !== 1) holder.scale.setScalar(part.scale)\n const object = options.resolvers?.[part.kind]?.(part)\n if (object) holder.add(object)\n holder.userData.placement = { kind: part.kind, id: part.id }\n return [holder]\n }\n case 'light': {\n if (options.lights) return drawBudgetedLight(part, animators, lights)\n if (part.kind === 'point') {\n // eslint-disable-next-line no-restricted-syntax -- D2: legacy path without LightBudget, removed in the next major\n const light = new THREE.PointLight(part.color, part.intensity, part.distance, part.decay)\n light.position.set(part.x, part.y, part.z)\n lights.push(light)\n if (part.flicker) {\n const phase = groupedPhaseOf(part)\n animators.push((t) => {\n light.intensity = part.intensity * (phase === undefined ? pageFlicker(t, part.x) : flickerLevel(t, phase))\n })\n }\n return [light]\n }\n // eslint-disable-next-line no-restricted-syntax -- D2: legacy path without LightBudget, removed in the next major\n const light = new THREE.SpotLight(part.color, part.intensity, part.distance, part.angle, part.penumbra, part.decay)\n light.position.set(part.x, part.y, part.z)\n const target = new THREE.Object3D()\n target.position.set(part.target.x, part.target.y, part.target.z)\n light.target = target\n lights.push(light)\n const { sweep } = part\n if (sweep) {\n animators.push((t) => {\n target.position.set(part.x + Math.sin(t * sweep.speed + part.x) * sweep.radius, 0, part.z + Math.cos(t * sweep.speed + part.x) * sweep.radius)\n })\n }\n return [light, target]\n }\n }\n }\n\n /** Upright boxes whose tops lie on one height and overlap (road marks crossing) are layered 2 mm apart in list order: the later one rises (CLAUDE.md §13). */\n const layerItems = (list: readonly ItemBox[]): ItemBox[] => {\n const placed: Array<{ top: number; x0: number; x1: number; z0: number; z1: number }> = []\n return list.map((entry) => {\n const quarterTurn = Math.abs(Math.sin(entry.ry * 2)) < 1e-6\n if (entry.rx || entry.rz || !quarterTurn) return entry\n const turned = Math.abs(Math.cos(entry.ry)) < 0.5\n const [halfX, halfZ] = turned ? [entry.depth / 2, entry.width / 2] : [entry.width / 2, entry.depth / 2]\n const rect = { x0: entry.x - halfX, x1: entry.x + halfX, z0: entry.z - halfZ, z1: entry.z + halfZ }\n let lift = 0\n while (placed.some((other) => Math.abs(other.top - (entry.y + entry.height + lift)) < PLANE_LAYER_GAP / 2 && other.x0 < rect.x1 && rect.x0 < other.x1 && other.z0 < rect.z1 && rect.z0 < other.z1)) lift += PLANE_LAYER_GAP\n placed.push({ top: entry.y + entry.height + lift, ...rect })\n return lift ? { ...entry, y: entry.y + lift } : entry\n })\n }\n\n const instancedItems = (items: readonly ItemBox[]): THREE_NS.InstancedMesh => {\n const list = options.standOut === false ? items : layerItems(items)\n const mesh = new THREE.InstancedMesh(roundedBox(1, 1, 1, ITEM_ROUNDNESS), standard(0xffffff), list.length)\n const matrix = new THREE.Matrix4()\n const quaternion = new THREE.Quaternion()\n const euler = new THREE.Euler()\n const position = new THREE.Vector3()\n const scale = new THREE.Vector3()\n const color = new THREE.Color()\n list.forEach((entry, index) => {\n euler.set(entry.rx, entry.ry, entry.rz)\n quaternion.setFromEuler(euler)\n matrix.compose(position.set(entry.x, entry.y + entry.height / 2, entry.z), quaternion, scale.set(entry.width, entry.height, entry.depth))\n mesh.setMatrixAt(index, matrix)\n mesh.setColorAt(index, color.set(entry.color))\n })\n mesh.castShadow = true\n mesh.receiveShadow = true\n return mesh\n }\n\n const instancedWindows = (list: readonly SilhouetteWindow[], material: THREE_NS.Material): THREE_NS.InstancedMesh => {\n const geometry = new T.PlaneGeometry(1, 1)\n disposables.push(geometry)\n const mesh = new THREE.InstancedMesh(geometry, material, list.length)\n const matrix = new THREE.Matrix4()\n const quaternion = new THREE.Quaternion()\n const axis = new THREE.Vector3(0, 1, 0)\n const scale = new THREE.Vector3()\n list.forEach((entry, index) => {\n quaternion.setFromAxisAngle(axis, entry.ry)\n matrix.compose(new THREE.Vector3(entry.x, entry.y, entry.z), quaternion, scale.set(entry.width, entry.height, 1))\n mesh.setMatrixAt(index, matrix)\n })\n return mesh\n }\n\n /** Planes lying on the same height and overlapping are layered 2 mm apart in the order they are drawn: the later one lies on top (CLAUDE.md §13). */\n const layerPlanes = (parts: readonly UrbanPart[]): ((part: UrbanPart, made: Obj[]) => void) => {\n const placed: Array<{ y: number; x0: number; x1: number; z0: number; z1: number }> = []\n return (part, made) => {\n if (part.shape !== 'plane') return\n const origin = { x: part.x, y: part.y, z: part.z }\n for (let parent = part.parent; parent >= 0; parent = parts[parent]!.parent) {\n const group = parts[parent]!\n if (group.shape !== 'group' || group.ry) return\n origin.x += group.x\n origin.y += group.y\n origin.z += group.z\n }\n const rect = { x0: origin.x - part.width / 2, x1: origin.x + part.width / 2, z0: origin.z - part.depth / 2, z1: origin.z + part.depth / 2 }\n let lift = 0\n while (placed.some((other) => Math.abs(other.y - (origin.y + lift)) < PLANE_LAYER_GAP / 2 && other.x0 < rect.x1 && rect.x0 < other.x1 && other.z0 < rect.z1 && rect.z0 < other.z1)) lift += PLANE_LAYER_GAP\n placed.push({ y: origin.y + lift, ...rect })\n made[0]!.position.y += lift\n }\n }\n\n /** Draws a scene: its parts in order, then the instanced boxes, the lit windows and the dark windows. */\n function draw(scene: UrbanScene, drawOptions: DrawOptions = {}): DrawnUrban {\n const root = markKitOrigin(drawOptions.root ?? new THREE.Group(), { owner: 'game-urban-three', kind: 'urban' })\n const animators: ((t: number) => void)[] = []\n const lights: DrawnLight[] = []\n animatedLenses = new Set()\n const objects: Obj[][] = []\n const layer = options.standOut === false ? () => undefined : layerPlanes(scene.parts)\n for (const part of scene.parts) {\n const made = drawPart(part, animators, lights)\n layer(part, made)\n objects.push(made)\n const parent = part.parent < 0 ? root : (objects[part.parent] as Obj[])[0]\n parent.add(...made)\n }\n // a second pass moves the piece that the first one pushed onto another's plane (two trunks both sunk 2 mm)\n if (options.standOut === true) {\n let passes = 0\n while (passes++ < 3 && standOutCoincident(root).left > 0);\n }\n if (scene.items.length) root.add(instancedItems(scene.items))\n if (scene.windows.lit.length) root.add(instancedWindows(scene.windows.lit, glowing(LIT_WINDOW)))\n if (scene.windows.dark.length) root.add(instancedWindows(scene.windows.dark, standard(DARK_WINDOW.color, DARK_WINDOW)))\n return {\n root,\n lights,\n animate: (t) => animators.forEach((step) => step(t)),\n dispose: () => {\n if (options.lights) for (const lamp of lights) if ('source' in lamp) lamp.source.remove()\n root.parent?.remove(root)\n for (const item of disposables.splice(0)) item.dispose?.()\n for (const geometry of geometries.values()) geometry.dispose()\n for (const material of materials.values()) material.dispose()\n geometries.clear()\n materials.clear()\n },\n }\n }\n\n /** Draws the aerial utility networks of `game-urban/networks` (`drawNetworks`), lit through this drawer's light budget. */\n const networks = (data: UtilityNetworks, drawOptions: NetworkDrawOptions = {}): DrawnNetworks =>\n drawNetworks(THREE, { networks: data, options: drawOptions, ...(options.lights ? { budget: options.lights } : {}), ...(options.physicalLights ? { physicalLights: true } : {}) })\n\n /** Draws what shows of the buried networks (covers, grates, hydrants, wing walls, the boxes of each lot): two draw calls. */\n const networkSurface = (data: Pick<UtilityNetworks, 'nodes' | 'edges'>, surfaceOptions?: SurfacePiecesOptions): DrawnSurface => drawSurface(THREE, { networks: data, ...(surfaceOptions ? { options: surfaceOptions } : {}) })\n\n /** Draws the pipes and pits under the street at their depths, for a crater to show: three draw calls. */\n const buriedNetworks = (data: Pick<UtilityNetworks, 'nodes' | 'edges'>, surfaceOptions?: SurfacePiecesOptions): DrawnBuried => drawBuried(THREE, { networks: data, ...(surfaceOptions ? { options: surfaceOptions } : {}) })\n\n /** Draws the lid of a cover that a blast threw off as a body of its own (`coverBodyOf` is its plate in the destruction world). */\n const coverLid = (piece: SurfacePiece): DrawnLid => drawLid(THREE, piece)\n\n return { THREE, draw, drawNetworks: networks, drawNetworkSurface: networkSurface, drawBuriedNetworks: buriedNetworks, drawCoverLid: coverLid }\n}\n\nexport type UrbanThree = ReturnType<typeof createUrbanThree>\n","import type { LightPart } from '@adatechnology/game-urban'\n\n/**\n * The beat of a failing lamp, the page's formula: dim to `dim` while `sin(t·fast + phase) > fastAbove` or `sin(t·slow + phase) > slowAbove`. The phase comes from the part\n * (`flickerPhase`), rounded to one of `groups` steps so the lenses of a scene share `groups` materials per colour.\n */\nexport const LAMP_FLICKER = { dim: 0.15, fast: 23, slow: 3.1, fastAbove: 0.3, slowAbove: 0.85, groups: 4 } as const\n\nconst TURN = 2 * Math.PI\n\n/** The step of `LAMP_FLICKER.groups` a phase falls in, 0 to groups - 1. */\nexport const flickerGroupOf = (phase: number): number => Math.floor((((phase % TURN) + TURN) % TURN) / TURN * LAMP_FLICKER.groups) % LAMP_FLICKER.groups\n\n/** The phase of a group: what the lens and the light of every lamp of that group flicker on. */\nexport const flickerGroupPhase = (group: number): number => (group / LAMP_FLICKER.groups) * TURN\n\n/** How bright a failing lamp is at time `t` (seconds of the frame's present time), 1 or `LAMP_FLICKER.dim`. */\nexport const flickerLevel = (t: number, phase: number): number =>\n Math.sin(t * LAMP_FLICKER.fast + phase) > LAMP_FLICKER.fastAbove || Math.sin(t * LAMP_FLICKER.slow + phase) > LAMP_FLICKER.slowAbove ? LAMP_FLICKER.dim : 1\n\n/**\n * The team's lamps were tuned on three.js r128 without physically correct lights: the light reached the ground as `intensity · (1 − d / distance)^decay`, with no inverse square and a\n * diffuse term without the 1/π. Today's renderer (r155+) lights by `intensity / d^decay · (1 − (d / distance)^4)^2` and a Lambert of albedo/π, so the same numbers light almost nothing\n * (a 1.3 sodium lamp 7 m up gave the street ~0.5 and now gives ~0.01). This is the intensity that lights the ground at `reference` metres exactly as the page did (default the foot of the lamp, d = its height `y`; a searchlight passes the length of its beam to where it lands);\n * nearer it is brighter and farther it falls off faster than the page, as a real lamp does.\n */\nexport function physicalIntensityOf(part: Pick<LightPart, 'intensity' | 'distance' | 'decay' | 'y'>, reference: number = part.y): number {\n const foot = Math.max(reference, 0.5)\n const legacyFalloff = part.distance > 0 ? Math.max(0, 1 - foot / part.distance) ** part.decay : 1\n const window = part.distance > 0 ? Math.max(1e-6, 1 - (foot / part.distance) ** 4) ** 2 : 1\n return (part.intensity * Math.PI * legacyFalloff * foot ** part.decay) / window\n}\n","import { shapeGeometries } from '@adatechnology/game-shapes-three'\n\nimport type * as THREE_NS from 'three'\n\ntype Three = typeof THREE_NS\n\n/** The team's rounded box: a 4x4x4 grid per face with the edge vertices pushed onto an arc of the given radius (smooth normals). A radius of 0 is a plain box. */\nexport function createRoundedBox(THREE: Three, width: number, height: number, depth: number, radius: number): THREE_NS.BufferGeometry {\n const T = shapeGeometries(THREE) as Three\n if (radius === 0) return new T.BoxGeometry(width, height, depth)\n const geometry = new T.BoxGeometry(2, 2, 2, 4, 4, 4)\n const position = geometry.attributes.position\n const normal = geometry.attributes.normal\n const half = [width / 2, height / 2, depth / 2]\n const p = [0, 0, 0]\n const q = [0, 0, 0]\n const map = (value: number, halfSize: number): number => {\n const a = Math.abs(value)\n return Math.sign(value) * (a <= 0.5 ? a * 2 * (halfSize - radius) : halfSize - radius + (a - 0.5) * 2 * radius)\n }\n for (let index = 0; index < position.count; index++) {\n const source = [position.getX(index), position.getY(index), position.getZ(index)]\n let length = 0\n for (let axis = 0; axis < 3; axis++) {\n p[axis] = map(source[axis] as number, half[axis] as number)\n const clamped = Math.max(-((half[axis] as number) - radius), Math.min((half[axis] as number) - radius, p[axis] as number))\n q[axis] = (p[axis] as number) - clamped\n p[axis] = clamped\n length += (q[axis] as number) ** 2\n }\n length = Math.sqrt(length)\n if (length < 1e-6) {\n q[0] = normal.getX(index)\n q[1] = normal.getY(index)\n q[2] = normal.getZ(index)\n } else for (let axis = 0; axis < 3; axis++) q[axis] = (q[axis] as number) / length\n position.setXYZ(index, (p[0] as number) + (q[0] as number) * radius, (p[1] as number) + (q[1] as number) * radius, (p[2] as number) + (q[2] as number) * radius)\n normal.setXYZ(index, q[0] as number, q[1] as number, q[2] as number)\n }\n return geometry\n}\n\n/** Triangle prism: the triangle `width` wide and `height` high, extruded `depth` long and centred on z. Base at y = 0. */\nexport function createPrism(THREE: Three, width: number, height: number, depth: number): THREE_NS.BufferGeometry {\n const shape = new THREE.Shape()\n shape.moveTo(-width / 2, 0)\n shape.lineTo(width / 2, 0)\n shape.lineTo(0, height)\n shape.lineTo(-width / 2, 0)\n const geometry = new (shapeGeometries(THREE) as Three).ExtrudeGeometry(shape, { depth, bevelEnabled: false })\n geometry.translate(0, 0, -depth / 2)\n return geometry\n}\n","import type * as THREE_NS from 'three'\n\ntype Three = typeof THREE_NS\n\n/** What `document.createElement('canvas')` needs; a fake works in Node. */\nexport type CanvasFactory = { createElement(tag: 'canvas'): HTMLCanvasElement }\n\nexport type TextTextureOptions = { width: number; height: number; background: string; foreground: string; font: string }\n\nconst FIT = 0.92\n\n/** Canvas texture with centred lines of text, shrunk to fit 92 % of the width, on a filled background. */\nexport function createTextTexture(THREE: Three, document: CanvasFactory, lines: readonly string[], o: TextTextureOptions): THREE_NS.CanvasTexture {\n const canvas = document.createElement('canvas')\n canvas.width = o.width\n canvas.height = o.height\n const g = canvas.getContext('2d')\n if (!g) throw new Error('game-urban-three: the canvas has no 2D context')\n g.fillStyle = o.background\n g.fillRect(0, 0, o.width, o.height)\n g.fillStyle = o.foreground\n g.font = o.font\n g.textAlign = 'center'\n g.textBaseline = 'middle'\n const base = g.font\n lines.forEach((text, index) => {\n g.font = base\n const measured = g.measureText(text).width\n if (measured > o.width * FIT) g.font = base.replace(/(\\d+(?:\\.\\d+)?)px/, (_match: string, size: string) => ((Number(size) * o.width * FIT) / measured).toFixed(1) + 'px')\n g.fillText(text, o.width / 2, o.height / 2 + (index - (lines.length - 1) / 2) * (o.height / lines.length))\n })\n const texture = new THREE.CanvasTexture(canvas)\n texture.anisotropy = 4\n return texture\n}\n","import type * as THREE_NS from 'three'\n\nimport { markKitOrigin } from '@adatechnology/game-contracts'\nimport { LIGHT_PRIORITY } from '@adatechnology/game-render-three'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\nimport type { LightBudget, SourceHandle } from '@adatechnology/game-render-three'\nimport { DEFAULT_POLES } from '@adatechnology/game-urban'\nimport type { DistributionSpec, LampShares, PoleDef } from '@adatechnology/game-urban'\nimport { networkLampsOf, slotsOfPole } from '@adatechnology/game-urban/networks'\nimport type { NetworkLamp, NetworkSurface, UtilityNetworks } from '@adatechnology/game-urban/networks'\n\nimport { flickerGroupOf, flickerGroupPhase, flickerLevel, physicalIntensityOf } from '../lamp-light'\nimport { drawPieces } from './draw-pieces'\nimport { drawWires } from './draw-wires'\nimport type { SpanRange } from './draw-wires'\nimport { piecesOf } from './pieces'\nimport { indexOf, poleFramesOf, worldOf } from './pole-frames'\nimport { guysOf, wireRunsOf } from './wire-runs'\n\ntype Three = typeof THREE_NS\n\n/** Every lamp works unless the host says otherwise. */\nconst ALL_LAMPS_WORK: LampShares = { lit: 1, flicker: 0 }\n/** Spans farther than this from the focus are drawn as lines. */\nconst NEAR_DISTANCE = 90\n\nexport type NetworkDrawOptions = {\n /** Night lights the lamps whose state is on. Default false. */\n readonly isNight?: boolean\n /** At night, the share of lamps that work and the share that flicker (`lampStateOf`). Default every lamp works. */\n readonly lamps?: LampShares\n /** Road, sidewalk or lot under a point (`GeneratedNetworks.surfaceAt`): a guy anchors on the sidewalk only. */\n readonly surfaceAt?: (x: number, z: number) => NetworkSurface\n /** The pole registry the nodes' `spec` ids are read from (`urban.poles`). Default the kit's `DEFAULT_POLES`. */\n readonly poles?: { get(id: string): { readonly def: PoleDef } }\n /** Spans within this of the focus (`setFocus`) are tubes, the others lines. Default 90 m. */\n readonly nearDistance?: number\n readonly root?: THREE_NS.Object3D\n}\n\n/** A lit lamp of the network drawn through the host's light budget. */\nexport type NetworkLight = { readonly bulb: THREE_NS.Object3D; readonly lamp: NetworkLamp; readonly source: SourceHandle }\n\nexport type DrawnNetworks = {\n readonly root: THREE_NS.Object3D\n /** Every light node with its lamp's state. */\n readonly lamps: readonly NetworkLamp[]\n readonly lights: readonly NetworkLight[]\n /** Each span's index ranges in its class's merged mesh and in the far lines (R8): what a torn span hides. */\n readonly spans: ReadonlyMap<string, SpanRange>\n /** Draw calls of the near level (tubes and instanced hardware) and of the far lines, as they stand. */\n drawCalls(): { readonly near: number; readonly far: number }\n /** Moves the near level of detail to around a point (the camera), at most one index upload per mesh when a span changes side. */\n setFocus(x: number, z: number): void\n /** Blinks the failing lamps (lens and light on their flicker group). */\n animate(t: number): void\n dispose(): void\n}\n\nconst specResolver = (poles: NetworkDrawOptions['poles']): ((id: string) => DistributionSpec) => {\n return (id) => {\n const def = poles ? poles.get(id).def : DEFAULT_POLES.find((pole) => pole.id === id)\n if (!def || !slotsOfPole({ id, shape: 'distribution', spec: def.spec })) throw new Error(`the pole \"${id}\" a network stands on has no slots (a distribution pole)`)\n return def.spec as DistributionSpec\n }\n}\n\n/**\n * Draws the aerial networks of `game-urban/networks`: the distribution poles (masts instanced per spec, hardware and cylinders instanced), the\n * conductors merged per class with the sag the network was laid with, guys at the corner and end poles, the lamps lit by their state\n * (`networkLampsOf`) through the host's light budget. About ten draw calls near whatever the size of the district, one far.\n */\nexport function drawNetworks(THREE: Three, { networks, options, budget, physicalLights }: { readonly networks: UtilityNetworks; readonly options: NetworkDrawOptions; readonly budget?: LightBudget; readonly physicalLights?: boolean }): DrawnNetworks {\n const root = markKitOrigin(options.root ?? new THREE.Group(), { owner: 'game-urban-three', kind: 'networks' })\n const specOf = specResolver(options.poles)\n const index = indexOf(networks)\n const frames = new Map(poleFramesOf({ networks, index, specOf }).map((frame) => [frame.id, frame]))\n const guys = guysOf({ index, frames, ...(options.surfaceAt ? { surfaceAt: options.surfaceAt } : {}) })\n const wires = drawWires(THREE, { runs: wireRunsOf({ frames, index }, networks.edges), guys })\n const pieces = piecesOf({ frames, index, guys })\n const drawn = drawPieces(THREE, { masts: pieces.masts, boxes: pieces.boxes, cylinders: pieces.cylinders, specOf })\n const lamps = networkLampsOf({ networks, shares: options.lamps ?? ALL_LAMPS_WORK, isNight: options.isNight ?? false })\n const byPole = new Map(lamps.map((lamp) => [lamp.pole, lamp]))\n const lensMaterial = new THREE.MeshBasicMaterial({ color: 0xffffff })\n const lenses = new THREE.InstancedMesh(new (shapeGeometries(THREE).BoxGeometry)(1, 1, 1), lensMaterial, Math.max(pieces.lenses.length, 1))\n lenses.name = 'network:lenses'\n lenses.count = pieces.lenses.length\n const matrix = new THREE.Matrix4()\n const color = new THREE.Color()\n const flickering: Array<{ index: number; lit: number; phase: number }> = []\n pieces.lenses.forEach((lens, slot) => {\n const { box } = lens\n lenses.setMatrixAt(slot, matrix.compose(new THREE.Vector3(box.x, box.y, box.z), new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 1, 0), box.ry), new THREE.Vector3(box.width, box.height, box.depth)))\n const lamp = byPole.get(lens.pole)\n const spec = frames.get(lens.pole)!.spec\n lenses.setColorAt(slot, color.set(lamp?.on ? spec.lens.lit : spec.lens.unlit))\n if (lamp?.flicker && lamp.flickerPhase !== undefined) flickering.push({ index: slot, lit: spec.lens.lit, phase: flickerGroupPhase(flickerGroupOf(lamp.flickerPhase)) })\n })\n const lights: NetworkLight[] = []\n const animators: Array<(t: number) => void> = []\n for (const lamp of lamps) {\n const frame = frames.get(lamp.pole)\n if (!lamp.on || !frame || !budget) continue\n const { light } = frame.spec\n const bulb = new THREE.Object3D()\n bulb.position.set(...worldOf(frame, [light.reach ?? frame.spec.lamp.reach, light.y, light.z ?? 0]))\n root.add(bulb)\n const intensity = physicalLights ? physicalIntensityOf({ intensity: light.intensity, distance: light.distance, decay: 2, y: light.y }) : light.intensity\n const source = budget.addSource({ owner: 'urban.light', priority: LIGHT_PRIORITY.street, color: light.color, intensity, distance: light.distance, decay: 2, position: [0, 0, 0], follow: bulb })\n lights.push({ bulb, lamp, source })\n if (lamp.flicker && lamp.flickerPhase !== undefined) {\n const phase = flickerGroupPhase(flickerGroupOf(lamp.flickerPhase))\n animators.push((t) => source.update({ intensity: intensity * flickerLevel(t, phase) }))\n }\n }\n root.add(...drawn.meshes, ...wires.near, wires.far, lenses)\n const nearDistance = options.nearDistance ?? NEAR_DISTANCE\n return {\n root,\n lamps,\n lights,\n spans: wires.spans,\n drawCalls: () => ({ near: [...drawn.meshes, ...wires.near, lenses].filter((mesh) => mesh.visible && (!(mesh instanceof THREE.InstancedMesh) || mesh.count > 0)).length, far: wires.far.visible ? 1 : 0 }),\n setFocus: (x, z) => wires.setFocus(x, z, nearDistance),\n animate(t) {\n for (const step of animators) step(t)\n if (flickering.length === 0) return\n for (const item of flickering) lenses.setColorAt(item.index, color.set(item.lit).multiplyScalar(flickerLevel(t, item.phase)))\n lenses.instanceColor!.needsUpdate = true\n },\n dispose() {\n for (const light of lights) light.source.remove()\n root.parent?.remove(root)\n wires.dispose()\n drawn.dispose()\n lenses.dispose()\n lenses.geometry.dispose()\n lensMaterial.dispose()\n },\n }\n}\n","import type * as THREE_NS from 'three'\n\nimport type { DistributionSpec } from '@adatechnology/game-urban'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\n\nimport type { WorldBox, WorldCylinder, WorldMast } from './pieces'\n\ntype Three = typeof THREE_NS\n\n/** Sides of the cylinders: the transformer tank and the reserve coil. */\nconst CYLINDER_SEGMENTS = 10\n\nexport type DrawnPieces = { readonly meshes: readonly THREE_NS.InstancedMesh[]; dispose(): void }\n\n/** The masts of each spec (one instanced mesh per spec), the hardware boxes, and the cylinders, each instanced with its colour. */\nexport function drawPieces(THREE: Three, { masts, boxes, cylinders, specOf }: { readonly masts: readonly WorldMast[]; readonly boxes: readonly WorldBox[]; readonly cylinders: readonly WorldCylinder[]; readonly specOf: (id: string) => DistributionSpec }): DrawnPieces {\n const T = shapeGeometries(THREE)\n const owned: Array<{ dispose(): void }> = []\n const meshes: THREE_NS.InstancedMesh[] = []\n const matrix = new THREE.Matrix4()\n const quaternion = new THREE.Quaternion()\n const position = new THREE.Vector3()\n const scale = new THREE.Vector3()\n const up = new THREE.Vector3(0, 1, 0)\n const axis = new THREE.Vector3()\n const color = new THREE.Color()\n const instanced = (geometry: THREE_NS.BufferGeometry, material: THREE_NS.Material, count: number, name: string): THREE_NS.InstancedMesh => {\n owned.push(geometry, material)\n const mesh = new THREE.InstancedMesh(geometry, material, count)\n mesh.name = name\n mesh.castShadow = true\n mesh.receiveShadow = true\n meshes.push(mesh)\n return mesh\n }\n for (const specId of new Set(masts.map((mast) => mast.specId))) {\n const { mast } = specOf(specId)\n // a tapered square post with its faces to the road and along the line (a 4-sided cylinder turned 45°), its foot on the ground\n const geometry = new T.CylinderGeometry(mast.radiusTop, mast.radiusBottom, mast.height, mast.segments ?? 4).rotateY(Math.PI / 4).translate(0, mast.height / 2, 0)\n const own = masts.filter((item) => item.specId === specId)\n const mesh = instanced(geometry, new THREE.MeshStandardMaterial({ color: mast.color, roughness: 0.9 }), own.length, `network:masts:${specId}`)\n own.forEach((item, index) => mesh.setMatrixAt(index, matrix.compose(position.set(item.x, item.y, item.z), quaternion.setFromAxisAngle(up, item.ry), scale.set(1, 1, 1))))\n }\n if (boxes.length > 0) {\n const mesh = instanced(new T.BoxGeometry(1, 1, 1), new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.75 }), boxes.length, 'network:hardware')\n boxes.forEach((box, index) => {\n mesh.setMatrixAt(index, matrix.compose(position.set(box.x, box.y, box.z), quaternion.setFromAxisAngle(up, box.ry), scale.set(box.width, box.height, box.depth)))\n mesh.setColorAt(index, color.set(box.color))\n })\n }\n if (cylinders.length > 0) {\n const mesh = instanced(new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS), new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.6, metalness: 0.3 }), cylinders.length, 'network:cylinders')\n cylinders.forEach((cylinder, index) => {\n quaternion.setFromUnitVectors(up, axis.set(cylinder.axis[0], cylinder.axis[1], cylinder.axis[2]).normalize())\n mesh.setMatrixAt(index, matrix.compose(position.set(cylinder.x, cylinder.y, cylinder.z), quaternion, scale.set(cylinder.radius, cylinder.height, cylinder.radius)))\n mesh.setColorAt(index, color.set(cylinder.color))\n })\n }\n return {\n meshes,\n dispose() {\n for (const mesh of meshes) mesh.dispose()\n for (const item of owned.splice(0)) item.dispose()\n },\n }\n}\n","/** A point in the world, metres. */\nexport type Vec3 = readonly [number, number, number]\n\n/** Segments of a drawn span: the catenary sampled in 8 stretches (design-redes §7, R13). */\nexport const SPAN_SEGMENTS = 8\n/** Sides of a conductor's tube. */\nexport const TUBE_SIDES = 4\n\n/**\n * The points of a conductor hung from `from` to `to` with `sag` metres at mid span: the parabola the network's clearance rules read\n * (`y − 4·sag·t·(1 − t)`), sampled at `segments + 1` points.\n */\nexport function catenaryPoints({ from, to, sag, segments = SPAN_SEGMENTS }: { readonly from: Vec3; readonly to: Vec3; readonly sag: number; readonly segments?: number }): Vec3[] {\n return Array.from({ length: segments + 1 }, (_, index): Vec3 => {\n const t = index / segments\n return [from[0] + (to[0] - from[0]) * t, from[1] + (to[1] - from[1]) * t - 4 * sag * t * (1 - t), from[2] + (to[2] - from[2]) * t]\n })\n}\n\n/** A geometry being merged: positions and normals (3 per vertex) and triangle indices. */\nexport type MeshData = { readonly positions: number[]; readonly normals: number[]; readonly indices: number[] }\n\nexport const emptyMesh = (): MeshData => ({ positions: [], normals: [], indices: [] })\n\nconst normalize = (v: readonly [number, number, number]): [number, number, number] => {\n const length = Math.hypot(v[0], v[1], v[2]) || 1\n return [v[0] / length, v[1] / length, v[2] / length]\n}\nconst cross = (a: readonly number[], b: readonly number[]): [number, number, number] => [a[1]! * b[2]! - a[2]! * b[1]!, a[2]! * b[0]! - a[0]! * b[2]!, a[0]! * b[1]! - a[1]! * b[0]!]\n\n/** The two axes across a conductor going along `tangent`: one level (never coplanar with a horizontal face), one up; a vertical run takes x. */\nfunction sectionAxes(tangent: readonly number[]): [readonly number[], readonly number[]] {\n const level = cross(tangent, [0, 1, 0])\n const side = Math.hypot(...level) < 1e-6 ? [1, 0, 0] : normalize(level)\n return [side, normalize(cross(side, tangent))]\n}\n\n/**\n * Appends a tube of `TUBE_SIDES` sides along `points` to `mesh` and returns the range of indices it took (`[start, count]`). The section is turned\n * 45° so no side of the tube lies flat (a wire is never coplanar with anything, CLAUDE.md §13).\n */\nexport function appendTube({ mesh, points, radius }: { readonly mesh: MeshData; readonly points: readonly Vec3[]; readonly radius: number }): readonly [number, number] {\n const base = mesh.positions.length / 3\n const start = mesh.indices.length\n points.forEach((point, index) => {\n const previous = points[Math.max(index - 1, 0)]!\n const next = points[Math.min(index + 1, points.length - 1)]!\n const [side, up] = sectionAxes(normalize([next[0] - previous[0], next[1] - previous[1], next[2] - previous[2]]))\n for (let k = 0; k < TUBE_SIDES; k++) {\n const angle = ((k + 0.5) / TUBE_SIDES) * 2 * Math.PI\n const normal = [0, 1, 2].map((axis) => Math.cos(angle) * side[axis]! + Math.sin(angle) * up[axis]!)\n mesh.normals.push(normal[0]!, normal[1]!, normal[2]!)\n mesh.positions.push(point[0] + normal[0]! * radius, point[1] + normal[1]! * radius, point[2] + normal[2]! * radius)\n }\n })\n for (let ring = 0; ring + 1 < points.length; ring++) {\n for (let k = 0; k < TUBE_SIDES; k++) {\n const a = base + ring * TUBE_SIDES + k\n const b = base + ring * TUBE_SIDES + ((k + 1) % TUBE_SIDES)\n const c = a + TUBE_SIDES\n const d = b + TUBE_SIDES\n mesh.indices.push(a, c, b, b, c, d)\n }\n }\n return [start, mesh.indices.length - start]\n}\n\n/** A polyline as line segments (the far level of detail): its points as vertices and a pair of indices per stretch. */\nexport type LineData = { readonly positions: number[]; readonly colors: number[]; readonly indices: number[] }\n\nexport const emptyLines = (): LineData => ({ positions: [], colors: [], indices: [] })\n\nexport function appendLine({ lines, points, color }: { readonly lines: LineData; readonly points: readonly Vec3[]; readonly color: readonly [number, number, number] }): readonly [number, number] {\n const base = lines.positions.length / 3\n const start = lines.indices.length\n for (const point of points) {\n lines.positions.push(point[0], point[1], point[2])\n lines.colors.push(color[0], color[1], color[2])\n }\n for (let index = 0; index + 1 < points.length; index++) lines.indices.push(base + index, base + index + 1)\n return [start, lines.indices.length - start]\n}\n","import type { DistributionSpec } from '@adatechnology/game-urban'\nimport { distributionHardwareOf } from '@adatechnology/game-urban/networks'\nimport type { NetworkEdge, NetworkNode, PoleHardware, PolePoint, UtilityNetworks } from '@adatechnology/game-urban/networks'\n\nimport type { Vec3 } from './catenary'\n\n/** A drawn pole: where it stands, how it is turned (`road` its +x toward the road, `line` its +z), its spec and its hardware. */\nexport type PoleFrame = {\n readonly id: string\n readonly specId: string\n readonly spec: DistributionSpec\n readonly x: number\n /** The ground at its foot. */\n readonly y: number\n readonly z: number\n /** As three.js turns an object about y: the frame's +x goes to `road`. */\n readonly ry: number\n readonly road: readonly [number, number]\n readonly line: readonly [number, number]\n readonly hardware: PoleHardware\n readonly guyed: boolean\n}\n\n/** The edges of the conductors that run pole to pole: their directions turn a pole and pull its guys. */\nexport const LINE_EDGES: ReadonlySet<NetworkEdge['kind']> = new Set(['mv_span', 'lv_span', 'telecom_span'])\n\n/** A point of a frame (`local`, metres in the pole's frame) in the world. */\nexport function worldOf(frame: Pick<PoleFrame, 'x' | 'y' | 'z' | 'road' | 'line'>, local: PolePoint): Vec3 {\n return [frame.x + local[0] * frame.road[0] + local[2] * frame.line[0], frame.y + local[1], frame.z + local[0] * frame.road[1] + local[2] * frame.line[1]]\n}\n\nconst unit = (x: number, z: number): [number, number] => {\n const length = Math.hypot(x, z)\n return length < 1e-9 ? [1, 0] : [x / length, z / length]\n}\n\n/** The nodes an edge links to a node, by edge kind. */\nexport type NetworkIndex = {\n readonly nodes: ReadonlyMap<string, NetworkNode>\n /** The edges at each node (as `from` or `to`). */\n readonly at: ReadonlyMap<string, readonly NetworkEdge[]>\n}\n\nexport function indexOf(networks: UtilityNetworks): NetworkIndex {\n const at = new Map<string, NetworkEdge[]>()\n for (const edge of networks.edges) {\n for (const end of [edge.from, edge.to]) at.set(end, [...(at.get(end) ?? []), edge])\n }\n return { nodes: new Map(networks.nodes.map((node) => [node.id, node])), at }\n}\n\n/** The directions (unit, plan) from a pole to the other ends of its line spans, a splice standing for the pole beyond it. */\nexport function lineDirectionsOf(index: NetworkIndex, pole: NetworkNode): Array<readonly [number, number]> {\n const out: Array<readonly [number, number]> = []\n for (const edge of index.at.get(pole.id) ?? []) {\n if (!LINE_EDGES.has(edge.kind)) continue\n const other = index.nodes.get(edge.from === pole.id ? edge.to : edge.from)\n if (!other || other.kind === 'transformer') continue\n const far = other.kind === 'splice' ? farEndOf(index, other, pole.id) : other\n const direction = unit(far.at[0] - pole.at[0], far.at[2] - pole.at[2])\n if (!out.some((seen) => seen[0] * direction[0] + seen[1] * direction[1] > 0.94)) out.push(direction)\n }\n return out\n}\n\n/** The node past a splice, seen from `from`. */\nfunction farEndOf(index: NetworkIndex, splice: NetworkNode, from: string): NetworkNode {\n const next = (index.at.get(splice.id) ?? []).map((edge) => (edge.from === splice.id ? edge.to : edge.from)).find((id) => id !== from)\n return (next && index.nodes.get(next)) || splice\n}\n\n/** Toward the road: to its lamp; a pole with no lamp turns across its line, away from the lots it feeds. */\nfunction roadOf(index: NetworkIndex, pole: NetworkNode): [number, number] {\n const lamp = index.nodes.get(`light:${pole.id}`)\n if (lamp) return unit(lamp.at[0] - pole.at[0], lamp.at[2] - pole.at[2])\n const along = lineDirectionsOf(index, pole)[0] ?? [1, 0]\n const across: [number, number] = [-along[1], along[0]]\n const lot = (index.at.get(pole.id) ?? []).filter((edge) => edge.kind === 'service_drop' && edge.from === pole.id).map((edge) => index.nodes.get(edge.to))[0]\n if (!lot) return across\n const toward = (lot.at[0] - pole.at[0]) * across[0] + (lot.at[2] - pole.at[2]) * across[1]\n return toward > 0 ? [-across[0], -across[1]] : across\n}\n\n/** How many telecom cables reach a pole: the most any of its telecom spans carries. */\nfunction cablesAt(index: NetworkIndex, pole: NetworkNode): number {\n return Math.max(0, ...(index.at.get(pole.id) ?? []).filter((edge) => edge.kind === 'telecom_span').map((edge) => edge.conductors ?? 1))\n}\n\nexport type PoleSpecOf = (id: string) => DistributionSpec\n\n/** The frame and the hardware of every pole of the networks. */\nexport function poleFramesOf({ networks, index, specOf }: { readonly networks: UtilityNetworks; readonly index: NetworkIndex; readonly specOf: PoleSpecOf }): PoleFrame[] {\n return networks.nodes\n .filter((node) => node.kind === 'pole')\n .map((node): PoleFrame => {\n const specId = node.spec ?? 'concrete_distribution'\n const spec = specOf(specId)\n const road = roadOf(index, node)\n const hardware = distributionHardwareOf(spec, {\n mv: node.carries.includes('power_mv'),\n transformer: index.nodes.has(`transformer:${node.id}`),\n lamp: index.nodes.has(`light:${node.id}`),\n cables: cablesAt(index, node),\n cableGap: networks.rules.layout.telecom.cableGap,\n })\n return { id: node.id, specId, spec, x: node.at[0], y: node.at[1], z: node.at[2], ry: Math.atan2(-road[1], road[0]), road, line: [-road[1], road[0]], hardware, guyed: node.guyed === true }\n })\n}\n","import type { NetworkEdge, NetworkNode, NetworkSurface, PolePoint } from '@adatechnology/game-urban/networks'\n\nimport { catenaryPoints } from './catenary'\nimport type { Vec3 } from './catenary'\nimport { lineDirectionsOf, worldOf } from './pole-frames'\nimport type { NetworkIndex, PoleFrame } from './pole-frames'\n\n/** The merged mesh a conductor goes into (design-redes §7, R13: one mesh per conductor class). */\nexport type WireClass = 'mv' | 'lv' | 'telecom' | 'drops' | 'guys'\nexport const WIRE_CLASSES: readonly WireClass[] = ['mv', 'lv', 'telecom', 'drops', 'guys']\n\n/** The conductors of one edge (or one guy wire), each a polyline of the catenary, in one class. */\nexport type WireRun = { readonly id: string; readonly wireClass: WireClass; readonly conductors: readonly (readonly Vec3[])[] }\n\n/** Shorter conductors than this (metres) are not drawn. */\nconst MIN_LENGTH = 0.05\n\nconst CLASS_OF: Partial<Record<NetworkEdge['kind'], WireClass>> = { mv_span: 'mv', lv_span: 'lv', telecom_span: 'telecom', service_drop: 'drops', telecom_drop: 'drops' }\n\ntype Ends = { readonly frames: ReadonlyMap<string, PoleFrame>; readonly index: NetworkIndex }\n\n/** The fixing points of a class on a pole, in its frame. */\nfunction pointsOn(frame: PoleFrame, kind: NetworkEdge['kind'], conductors: number): readonly PolePoint[] {\n const { attachments } = frame.hardware\n if (kind === 'mv_span') return attachments.mv\n if (kind === 'telecom_span') return attachments.telecom.slice(0, conductors)\n if (kind === 'telecom_drop') return attachments.telecom.slice(0, 1)\n return [attachments.lv]\n}\n\n/** The pole a node that is not one borrows its frame from (a feed, a splice): the pole at the other end of the edge, or the splice's neighbour. */\nfunction frameNear({ frames, index }: Ends, node: NetworkNode, other: string): PoleFrame | undefined {\n const own = frames.get(other)\n if (own) return own\n const near = (index.at.get(node.id) ?? []).map((edge) => (edge.from === node.id ? edge.to : edge.from)).find((id) => frames.has(id))\n return near === undefined ? undefined : frames.get(near)\n}\n\n/** Where the conductors of `edge` are fixed at one end: on a pole, on its transformer, at a lot's anchor, or a feed and a splice placed as the next pole's hardware. */\nfunction endOf(ends: Ends, edge: NetworkEdge, id: string, other: string): Vec3[] {\n const node = ends.index.nodes.get(id)\n if (!node) return []\n const conductors = edge.kind === 'telecom_span' ? edge.conductors ?? 1 : edge.kind === 'mv_span' ? 3 : 1\n const pole = ends.frames.get(id)\n if (pole) return pointsOn(pole, edge.kind, conductors).map((point) => worldOf(pole, point))\n if (node.kind === 'transformer') {\n const host = ends.frames.get(id.slice('transformer:'.length))\n const points = host?.hardware.attachments.transformer\n if (!host || !points) return []\n return (edge.kind === 'mv_span' ? points.mv : [points.lv]).map((point) => worldOf(host, point))\n }\n if (node.kind === 'connection') return [node.at]\n const near = frameNear(ends, node, other)\n if (!near) return [node.at]\n const placed = { ...near, x: node.at[0], z: node.at[2], y: 0 }\n return pointsOn(near, edge.kind, conductors).map((point) => worldOf(placed, point))\n}\n\n/** The conductors of every aerial edge the drawing shows (the light feed is inside the pole's arm), each hung with the edge's own sag. */\nexport function wireRunsOf(ends: Ends, edges: readonly NetworkEdge[]): WireRun[] {\n const runs: WireRun[] = []\n for (const edge of edges) {\n const wireClass = CLASS_OF[edge.kind]\n if (!wireClass) continue\n const from = endOf(ends, edge, edge.from, edge.to)\n const to = endOf(ends, edge, edge.to, edge.from)\n const count = Math.min(from.length, to.length)\n if (count === 0) continue\n const conductors = Array.from({ length: count }, (_, k) => catenaryPoints({ from: from[k]!, to: to[k]!, sag: edge.sag ?? 0 }))\n // a feed standing at its first pole links them with no length to draw\n if (Math.hypot(from[0]![0] - to[0]![0], from[0]![1] - to[0]![1], from[0]![2] - to[0]![2]) < MIN_LENGTH) continue\n runs.push({ id: edge.id, wireClass, conductors })\n }\n return runs\n}\n\n/** Shorter guys a pole tries when the full reach would anchor off the sidewalk. */\nconst GUY_SHARES = [1, 0.75, 0.5, 0.35] as const\n\nexport type GuyAnchor = { readonly id: string; readonly pole: string; readonly at: Vec3; readonly from: Vec3 }\n\n/**\n * A guy wire against each pull of a corner or end pole: from its eye under the crossarm back along the line, anchored on the ground `guy.reach`\n * away, shortened until the anchor lies on the sidewalk (`surfaceAt`); a pull with no sidewalk behind it gets none.\n */\nexport function guysOf({ index, frames, surfaceAt }: Ends & { readonly surfaceAt?: (x: number, z: number) => NetworkSurface }): GuyAnchor[] {\n const out: GuyAnchor[] = []\n for (const frame of frames.values()) {\n const node = index.nodes.get(frame.id)\n if (!frame.guyed || !node) continue\n lineDirectionsOf(index, node).forEach((pull, k) => {\n const share = GUY_SHARES.find((s) => {\n const [x, z] = [frame.x - pull[0] * frame.spec.guy.reach * s, frame.z - pull[1] * frame.spec.guy.reach * s]\n return surfaceAt === undefined || surfaceAt(x, z) === 'sidewalk'\n })\n if (share === undefined) return\n const reach = frame.spec.guy.reach * share\n out.push({ id: `guy:${frame.id}:${k}`, pole: frame.id, from: worldOf(frame, frame.hardware.attachments.guy), at: [frame.x - pull[0] * reach, frame.y, frame.z - pull[1] * reach] })\n })\n }\n return out\n}\n","import type * as THREE_NS from 'three'\n\nimport { appendLine, appendTube, emptyLines, emptyMesh } from './catenary'\nimport type { LineData, MeshData, Vec3 } from './catenary'\nimport { WIRE_CLASSES } from './wire-runs'\nimport type { GuyAnchor, WireClass, WireRun } from './wire-runs'\n\ntype Three = typeof THREE_NS\n\n/** How each class of conductor looks: the radius of its tube and its colour (bare aluminium medium voltage, black insulated cables, steel guys). */\nexport const WIRE_STYLE: Readonly<Record<WireClass, { readonly radius: number; readonly color: number; readonly metalness: number; readonly roughness: number }>> = {\n mv: { radius: 0.007, color: 0x8e9297, metalness: 0.5, roughness: 0.5 },\n lv: { radius: 0.016, color: 0x1b1c1e, metalness: 0, roughness: 0.8 },\n telecom: { radius: 0.008, color: 0x141516, metalness: 0, roughness: 0.85 },\n drops: { radius: 0.007, color: 0x1c1c1e, metalness: 0, roughness: 0.8 },\n guys: { radius: 0.005, color: 0x7a7c7e, metalness: 0.6, roughness: 0.5 },\n}\n\n/** Where a span's conductors lie in the merged meshes (R8): its range of indices in its class's tube mesh (`near`) and in the far lines. */\nexport type SpanRange = { readonly wireClass: WireClass; readonly near: readonly [number, number]; readonly far: readonly [number, number] }\n\nexport type DrawnWires = {\n /** One tube mesh per class with conductors, near (LOD 0). */\n readonly near: readonly THREE_NS.Mesh[]\n /** Every conductor as line segments, far (no hardware). */\n readonly far: THREE_NS.LineSegments\n readonly spans: ReadonlyMap<string, SpanRange>\n /** Spans within `distance` of the point are tubes, the others lines: an upload of each index buffer only when a span changes side. */\n setFocus(x: number, z: number, distance: number): void\n dispose(): void\n}\n\nconst rgb = (THREE: Three, hex: number): readonly [number, number, number] => {\n const color = new THREE.Color(hex)\n return [color.r, color.g, color.b]\n}\n\nconst distanceToSegment = (x: number, z: number, a: Vec3, b: Vec3): number => {\n const [dx, dz] = [b[0] - a[0], b[2] - a[2]]\n const t = Math.max(0, Math.min(1, ((x - a[0]) * dx + (z - a[2]) * dz) / (dx * dx + dz * dz || 1)))\n return Math.hypot(a[0] + dx * t - x, a[2] + dz * t - z)\n}\n\n/** Sets the range of each span in `index` to its original indices (shown) or to zeros (degenerate triangles or lines: hidden). */\nconst apply = (attribute: THREE_NS.BufferAttribute, original: Uint32Array, ranges: ReadonlyArray<readonly [number, number] | undefined>, shown: readonly boolean[]): void => {\n const array = attribute.array as Uint32Array\n ranges.forEach((range, span) => {\n if (!range) return\n const [start, count] = range\n if (shown[span]) array.set(original.subarray(start, start + count), start)\n else array.fill(0, start, start + count)\n })\n attribute.needsUpdate = true\n}\n\n/** The conductors merged into one tube mesh per class and one set of far lines, with each span's index ranges (R8). */\nexport function drawWires(THREE: Three, { runs, guys }: { readonly runs: readonly WireRun[]; readonly guys: readonly GuyAnchor[] }): DrawnWires {\n const all: WireRun[] = [...runs, ...guys.map((guy): WireRun => ({ id: guy.id, wireClass: 'guys', conductors: [[guy.from, guy.at]] }))]\n const meshes = new Map<WireClass, MeshData>(WIRE_CLASSES.map((wireClass) => [wireClass, emptyMesh()]))\n const lines: LineData = emptyLines()\n const spans = new Map<string, SpanRange>()\n for (const run of all) {\n const mesh = meshes.get(run.wireClass)!\n const { radius, color } = WIRE_STYLE[run.wireClass]\n const nearRanges = run.conductors.map((points) => appendTube({ mesh, points, radius }))\n const farRanges = run.conductors.map((points) => appendLine({ lines, points, color: rgb(THREE, color) }))\n const span = (ranges: ReadonlyArray<readonly [number, number]>): readonly [number, number] => [ranges[0]![0], ranges.reduce((sum, range) => sum + range[1], 0)]\n spans.set(run.id, { wireClass: run.wireClass, near: span(nearRanges), far: span(farRanges) })\n }\n const owned: Array<{ dispose(): void }> = []\n const near = WIRE_CLASSES.filter((wireClass) => meshes.get(wireClass)!.indices.length > 0).map((wireClass) => {\n const data = meshes.get(wireClass)!\n const geometry = new THREE.BufferGeometry()\n geometry.setAttribute('position', new THREE.Float32BufferAttribute(data.positions, 3))\n geometry.setAttribute('normal', new THREE.Float32BufferAttribute(data.normals, 3))\n geometry.setIndex(new THREE.BufferAttribute(new Uint32Array(data.indices), 1))\n const style = WIRE_STYLE[wireClass]\n const material = new THREE.MeshStandardMaterial({ color: style.color, metalness: style.metalness, roughness: style.roughness })\n owned.push(geometry, material)\n const mesh = new THREE.Mesh(geometry, material)\n mesh.name = `network:${wireClass}`\n mesh.castShadow = true\n return mesh\n })\n const lineGeometry = new THREE.BufferGeometry()\n lineGeometry.setAttribute('position', new THREE.Float32BufferAttribute(lines.positions, 3))\n lineGeometry.setAttribute('color', new THREE.Float32BufferAttribute(lines.colors, 3))\n lineGeometry.setIndex(new THREE.BufferAttribute(new Uint32Array(lines.indices), 1))\n const lineMaterial = new THREE.LineBasicMaterial({ vertexColors: true })\n owned.push(lineGeometry, lineMaterial)\n const far = new THREE.LineSegments(lineGeometry, lineMaterial)\n far.name = 'network:far'\n far.visible = false\n\n const ids = [...spans.keys()]\n const ends = all.map((run) => [run.conductors[0]![0]!, run.conductors[0]![run.conductors[0]!.length - 1]!] as const)\n const originals = new Map(near.map((mesh) => [mesh, (mesh.geometry.index!.array as Uint32Array).slice()]))\n const farOriginal = (lineGeometry.index!.array as Uint32Array).slice()\n let shown = ids.map(() => true)\n return {\n near,\n far,\n spans,\n setFocus(x, z, distance) {\n const next = ends.map(([a, b]) => distanceToSegment(x, z, a, b) <= distance)\n if (next.every((value, span) => value === shown[span])) return\n shown = next\n for (const mesh of near) {\n const wireClass = mesh.name.slice('network:'.length)\n apply(mesh.geometry.index!, originals.get(mesh)!, ids.map((id) => (spans.get(id)!.wireClass === wireClass ? spans.get(id)!.near : undefined)), shown)\n mesh.visible = ids.some((id, span) => shown[span] && spans.get(id)!.wireClass === wireClass)\n }\n apply(lineGeometry.index!, farOriginal, ids.map((id) => spans.get(id)!.far), shown.map((value) => !value))\n far.visible = shown.some((value) => !value)\n },\n dispose() {\n for (const item of owned.splice(0)) item.dispose()\n },\n }\n}\n","import type { HardwareBox } from '@adatechnology/game-urban/networks'\n\nimport type { Vec3 } from './catenary'\nimport { worldOf } from './pole-frames'\nimport type { NetworkIndex, PoleFrame } from './pole-frames'\nimport type { GuyAnchor } from './wire-runs'\n\n/** A box of the drawing in the world: `y` is its centre, turned `ry` about y. */\nexport type WorldBox = { readonly x: number; readonly y: number; readonly z: number; readonly ry: number; readonly width: number; readonly height: number; readonly depth: number; readonly color: number }\n/** A cylinder in the world: its centre and the direction of its axis (a transformer stands, a reserve coil hangs across the line). */\nexport type WorldCylinder = { readonly x: number; readonly y: number; readonly z: number; readonly axis: Vec3; readonly radius: number; readonly height: number; readonly color: number }\n/** A mast in the world: its foot. */\nexport type WorldMast = { readonly specId: string; readonly x: number; readonly y: number; readonly z: number; readonly ry: number }\n/** The lens of a pole's lamp. */\nexport type WorldLens = { readonly pole: string; readonly box: WorldBox }\n\n/** The splice box and its reserve coil, and the guy's anchor rod, as the poles' hardware. */\nconst SPLICE = { width: 0.16, height: 0.3, depth: 0.42, drop: 0.28, color: 0x2a2c2e } as const\nconst COIL = { radius: 0.32, thickness: 0.07, along: 0.75, drop: 0.5, color: 0x1e1f21 } as const\nconst ANCHOR = { width: 0.08, height: 0.3, depth: 0.08, sunk: 0.1 } as const\n\nconst boxIn = (frame: PoleFrame, box: HardwareBox): WorldBox => {\n const [x, y, z] = worldOf(frame, [box.x, box.y + box.height / 2, box.z])\n return { x, y, z, ry: frame.ry, width: box.width, height: box.height, depth: box.depth, color: box.color }\n}\n\nexport type NetworkPieces = { readonly masts: WorldMast[]; readonly boxes: WorldBox[]; readonly cylinders: WorldCylinder[]; readonly lenses: WorldLens[] }\n\n/** Every instanced piece of the drawing: the masts, the hardware boxes, the transformer cylinders and reserve coils, the lenses. */\nexport function piecesOf({ frames, index, guys }: { readonly frames: ReadonlyMap<string, PoleFrame>; readonly index: NetworkIndex; readonly guys: readonly GuyAnchor[] }): NetworkPieces {\n const out: NetworkPieces = { masts: [], boxes: [], cylinders: [], lenses: [] }\n for (const frame of frames.values()) {\n out.masts.push({ specId: frame.specId, x: frame.x, y: frame.y, z: frame.z, ry: frame.ry })\n for (const box of frame.hardware.boxes) out.boxes.push(boxIn(frame, box))\n for (const cylinder of frame.hardware.cylinders) {\n const [x, y, z] = worldOf(frame, [cylinder.x, cylinder.y + cylinder.height / 2, cylinder.z])\n out.cylinders.push({ x, y, z, axis: [0, 1, 0], radius: cylinder.radius, height: cylinder.height, color: cylinder.color })\n }\n if (frame.hardware.lens) out.lenses.push({ pole: frame.id, box: boxIn(frame, frame.hardware.lens) })\n }\n for (const guy of guys) {\n const frame = frames.get(guy.pole)\n if (frame) out.boxes.push({ x: guy.at[0], y: guy.at[1] + ANCHOR.height / 2 - ANCHOR.sunk, z: guy.at[2], ry: frame.ry, width: ANCHOR.width, height: ANCHOR.height, depth: ANCHOR.depth, color: frame.spec.guy.color })\n }\n for (const node of index.nodes.values()) {\n if (node.kind !== 'splice') continue\n const pole = (index.at.get(node.id) ?? []).map((edge) => (edge.from === node.id ? edge.to : edge.from)).map((id) => frames.get(id)).find((frame) => frame !== undefined)\n if (!pole) continue\n const at = { ...pole, x: node.at[0], z: node.at[2], y: 0 }\n const ox = pole.hardware.attachments.telecom[0]?.[0] ?? 0\n const [x, , z] = worldOf(at, [ox, 0, 0])\n out.boxes.push({ x, y: node.at[1] - SPLICE.drop, z, ry: pole.ry, width: SPLICE.width, height: SPLICE.height, depth: SPLICE.depth, color: SPLICE.color })\n const coil = worldOf(at, [ox, node.at[1] - COIL.drop, COIL.along])\n out.cylinders.push({ x: coil[0], y: coil[1], z: coil[2], axis: [pole.road[0], 0, pole.road[1]], radius: COIL.radius, height: COIL.thickness, color: COIL.color })\n }\n return out\n}\n","import type * as THREE_NS from 'three'\n\nimport { markKitOrigin } from '@adatechnology/game-contracts'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\nimport { pipePiecesOf, surfacePiecesOf } from '@adatechnology/game-urban/networks'\nimport type { PipeContent, PipePiece, Shaft, SurfacePiecesOptions, UtilityNetworks } from '@adatechnology/game-urban/networks'\n\ntype Three = typeof THREE_NS\n\n/** The paint of each pipe: sewer PVC in its ochre, water PVC in blue, drainage in concrete rings. */\nconst PIPE_COLOR: Readonly<Record<PipeContent, number>> = { sewage: 0xb87b4a, water: 0x2f6cae, stormwater: 0x8e8d87 }\nconst SHAFT_COLOR: Readonly<Record<Shaft['material'], number>> = { concrete: 0x8e8d87, plastic: 0xb87b4a, cast_iron: 0x3b3e42 }\nconst PIPE_SEGMENTS = 8\nconst SHAFT_SEGMENTS = 14\n/** A severed pipe loses this much of its length around the break, metres. */\nconst BREAK_GAP = 1.2\n/** Metres the shaft's wall goes under the bottom of its pipe (the pit's floor). */\nconst FLOOR = 0.1\n/** Metres the lid of a square pit lies under the ground: the terrain covers it, so its top is never in the plane of the asphalt (CLAUDE.md §13). */\nconst ROOF_DEPTH = 0.004\n\nexport type DrawnBuried = {\n readonly root: THREE_NS.Object3D\n readonly pipes: readonly PipePiece[]\n /** Draw calls: the pipes, the round shafts, the square ones. */\n drawCalls(): number\n /** Breaks a pipe at a share of its length: the two halves stop short of the break, `BREAK_GAP` apart. */\n sever(id: string, share: number): void\n /** Joins the two halves of a broken pipe again (the world is reset). */\n mend(id: string): void\n dispose(): void\n}\n\n/**\n * Draws the pipes and pits under the street as bodies in the ground (`pipePiecesOf`, the shafts of `surfacePiecesOf`): each pipe two halves of\n * an instanced cylinder laid at its depth, each pit an open tube or a box from its cover down to its pipe. The terrain hides them; a crater\n * deeper than their cover shows them. Three draw calls whatever the district.\n */\nexport function drawBuried(THREE: Three, { networks, root, options }: { readonly networks: Pick<UtilityNetworks, 'nodes' | 'edges'>; readonly root?: THREE_NS.Object3D; readonly options?: SurfacePiecesOptions }): DrawnBuried {\n const T = shapeGeometries(THREE)\n const group = markKitOrigin(root ?? new THREE.Group(), { owner: 'game-urban-three', kind: 'network-buried' })\n const pipes = pipePiecesOf(networks)\n const shafts = surfacePiecesOf(networks, options).flatMap((piece) => (piece.shaft === undefined ? [] : [{ piece, shaft: piece.shaft }]))\n const round = shafts.filter(({ shaft }) => shaft.shape === 'round')\n const square = shafts.filter(({ shaft }) => shaft.shape === 'square')\n const material = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.85 })\n const openMaterial = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.85, side: THREE.DoubleSide })\n const geometries = [new T.CylinderGeometry(1, 1, 1, PIPE_SEGMENTS), new T.CylinderGeometry(1, 1, 1, SHAFT_SEGMENTS, 1, true), new T.BoxGeometry(1, 1, 1)] as const\n const make = (geometry: THREE_NS.BufferGeometry, count: number, name: string, using: THREE_NS.Material): THREE_NS.InstancedMesh => {\n const mesh = new THREE.InstancedMesh(geometry, using, Math.max(count, 1))\n mesh.name = name\n mesh.count = count\n mesh.frustumCulled = false\n return mesh\n }\n const pipeMesh = make(geometries[0], pipes.length * 2, 'network:buried:pipes', material)\n const roundMesh = make(geometries[1], round.length, 'network:buried:shafts', openMaterial)\n const squareMesh = make(geometries[2], square.length, 'network:buried:boxes', material)\n const up = new THREE.Vector3(0, 1, 0)\n const matrix = new THREE.Matrix4()\n const color = new THREE.Color()\n const place = (mesh: THREE_NS.InstancedMesh, slot: number, from: readonly [number, number, number], to: readonly [number, number, number], radius: number): void => {\n const axis = new THREE.Vector3(to[0] - from[0], to[1] - from[1], to[2] - from[2])\n const length = axis.length()\n const quaternion = new THREE.Quaternion().setFromUnitVectors(up, length === 0 ? up : axis.clone().normalize())\n mesh.setMatrixAt(slot, matrix.compose(new THREE.Vector3((from[0] + to[0]) / 2, (from[1] + to[1]) / 2, (from[2] + to[2]) / 2), quaternion, new THREE.Vector3(radius, length, radius)))\n }\n const along = (pipe: PipePiece, share: number): [number, number, number] => [pipe.from[0] + (pipe.to[0] - pipe.from[0]) * share, pipe.from[1] + (pipe.to[1] - pipe.from[1]) * share, pipe.from[2] + (pipe.to[2] - pipe.from[2]) * share]\n /** The ends of a pipe pulled in by a few millimetres, a different amount for each: two pipes that start on one line (two services from neighbouring tees) never have their end caps in one plane (CLAUDE.md §13). */\n const trimmed = (pipe: PipePiece, index: number): PipePiece => {\n const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2])\n if (length < 0.1) return pipe\n const [start, end] = [((index % 7) + 1) * 0.003, ((index % 5) + 1) * 0.004]\n const at = (share: number): [number, number, number] => along(pipe, share)\n return { ...pipe, from: at(start / length), to: at(1 - end / length) }\n }\n const halves = (whole: PipePiece, index: number, gap: readonly [number, number]): void => {\n const pipe = trimmed(whole, index)\n // whole until it breaks: the second half is empty, so no two caps meet in one plane\n if (gap[0] === gap[1]) {\n place(pipeMesh, index * 2, pipe.from, pipe.to, pipe.diameter / 2)\n pipeMesh.setMatrixAt(index * 2 + 1, matrix.makeScale(0, 0, 0))\n return\n }\n place(pipeMesh, index * 2, pipe.from, along(pipe, gap[0]), pipe.diameter / 2)\n place(pipeMesh, index * 2 + 1, along(pipe, gap[1]), pipe.to, pipe.diameter / 2)\n }\n const slotOf = new Map(pipes.map((pipe, index) => [pipe.id, index]))\n pipes.forEach((pipe, index) => {\n halves(pipe, index, [0.5, 0.5])\n for (const slot of [index * 2, index * 2 + 1]) pipeMesh.setColorAt(slot, color.set(PIPE_COLOR[pipe.content]))\n })\n round.forEach(({ piece, shaft }, slot) => {\n const [x, , z] = piece.at\n place(roundMesh, slot, [x, shaft.bottom - FLOOR, z], [x, shaft.top, z], shaft.width / 2)\n roundMesh.setColorAt(slot, color.set(SHAFT_COLOR[shaft.material]))\n })\n square.forEach(({ piece, shaft }, slot) => {\n const height = shaft.top - ROOF_DEPTH - shaft.bottom + FLOOR\n squareMesh.setMatrixAt(slot, matrix.compose(new THREE.Vector3(piece.at[0], shaft.top - ROOF_DEPTH - height / 2, piece.at[2]), new THREE.Quaternion().setFromAxisAngle(up, piece.ry), new THREE.Vector3(shaft.width, height, shaft.depth)))\n squareMesh.setColorAt(slot, color.set(SHAFT_COLOR[shaft.material]))\n })\n group.add(pipeMesh, roundMesh, squareMesh)\n return {\n root: group,\n pipes,\n drawCalls: () => [pipeMesh, roundMesh, squareMesh].filter((mesh) => mesh.count > 0).length,\n sever(id, share) {\n const index = slotOf.get(id)\n const pipe = index === undefined ? undefined : pipes[index]\n if (index === undefined || pipe === undefined) return\n const length = Math.hypot(pipe.to[0] - pipe.from[0], pipe.to[1] - pipe.from[1], pipe.to[2] - pipe.from[2])\n const half = Math.min(0.5, BREAK_GAP / 2 / Math.max(length, 1e-6))\n halves(pipe, index, [Math.max(0, share - half), Math.min(1, share + half)])\n pipeMesh.instanceMatrix.needsUpdate = true\n },\n mend(id) {\n const index = slotOf.get(id)\n const pipe = index === undefined ? undefined : pipes[index]\n if (index === undefined || pipe === undefined) return\n halves(pipe, index, [0.5, 0.5])\n pipeMesh.instanceMatrix.needsUpdate = true\n },\n dispose() {\n group.parent?.remove(group)\n for (const mesh of [pipeMesh, roundMesh, squareMesh]) mesh.dispose()\n for (const item of [...geometries, material, openMaterial]) item.dispose()\n },\n }\n}\n","import type * as THREE_NS from 'three'\n\nimport { markKitOrigin } from '@adatechnology/game-contracts'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\nimport { COVER_PLATE_PART } from '@adatechnology/game-urban/networks'\nimport type { SurfacePiece } from '@adatechnology/game-urban/networks'\n\nimport { partsOf } from './surface-parts'\n\ntype Three = typeof THREE_NS\n\n/** Sides of a round lid. */\nconst CYLINDER_SEGMENTS = 14\n\nexport type DrawnLid = {\n readonly root: THREE_NS.Object3D\n dispose(): void\n}\n\n/**\n * The lid of a cover as a body of its own: the plate and its ribs from the piece's own parts (the frame of a cover stays in the ground; a grate goes whole), with the plate's foot at the origin of the\n * group, so the group sits where the destruction world's plate of `coverBodyOf` does (its part centred half its height up). A thrown lid is drawn this way and moves as a piece.\n */\nexport function drawLid(THREE: Three, piece: SurfacePiece): DrawnLid {\n const T = shapeGeometries(THREE)\n // a grate goes whole, its frame the plate and the bars on it (the dark slot under them is the hole it leaves, not a part of the lid); a cover leaves its frame in the ground: the lid is the parts over it\n const [frame, second, ...over] = partsOf(piece)\n const [lid, ...ribs] = piece.kind === 'inlet_grate' ? [frame, ...over] : second === undefined ? [] : [second, ...over]\n if (lid === undefined) throw new Error(`game-urban-three: \"${piece.id}\" has no lid to draw`)\n const lift = lid.size[1] / 2 - lid.centre[1]\n const group = markKitOrigin(new THREE.Group(), { owner: 'game-urban-three', kind: 'network-lid' })\n group.name = `network:lid:${piece.id}`\n const geometries = { box: new T.BoxGeometry(1, 1, 1), cylinder: new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS) }\n const materials = new Map<number, THREE_NS.MeshStandardMaterial>()\n const axisTurn: Record<'x' | 'y' | 'z', readonly [number, number, number]> = { x: [0, 0, Math.PI / 2], y: [0, 0, 0], z: [Math.PI / 2, 0, 0] }\n for (const part of [lid, ...ribs]) {\n let material = materials.get(part.color)\n if (material === undefined) materials.set(part.color, (material = new THREE.MeshStandardMaterial({ color: part.color, roughness: 0.7, metalness: 0.2 })))\n const mesh = new THREE.Mesh(geometries[part.shape], material)\n mesh.position.set(part.centre[0], part.centre[1] + lift, part.centre[2])\n mesh.scale.set(part.size[0], part.size[1], part.size[2])\n const [turnX, turnY, turnZ] = axisTurn[part.axis ?? 'y']\n mesh.rotation.set(turnX, turnY, turnZ)\n mesh.userData.destructionPart = COVER_PLATE_PART\n mesh.castShadow = true\n mesh.receiveShadow = true\n group.add(mesh)\n }\n return {\n root: group,\n dispose() {\n group.parent?.remove(group)\n for (const geometry of Object.values(geometries)) geometry.dispose()\n for (const material of materials.values()) material.dispose()\n },\n }\n}\n","import type { SurfacePiece } from '@adatechnology/game-urban/networks'\n\n/** A solid of a surface piece in the piece's frame (x along the street, z across, y up from the ground): a box, or a cylinder of its axis. */\nexport type SurfacePart = {\n readonly shape: 'box' | 'cylinder'\n readonly centre: readonly [number, number, number]\n /** Box: its sides. Cylinder: radius, length, radius. */\n readonly size: readonly [number, number, number]\n /** Cylinder only: the axis it lies along. Default y. */\n readonly axis?: 'x' | 'y' | 'z'\n readonly color: number\n}\n\nconst IRON = 0x3b3e42\nconst IRON_WORN = 0x55595e\nconst CONCRETE = 0x9b9a94\nconst CONCRETE_LID = 0xa8a7a0\nconst VOID = 0x0b0b0c\nconst HYDRANT_RED = 0xb02a22\n\n/** Flat covers lie at the ground: the frame 2 mm over it, the lid 2 mm over the frame, the ribs another 2 mm and 4 mm (CLAUDE.md §13: nothing in the plane of another). */\nconst FRAME_TOP = 0.002\nconst LID_TOP = 0.004\nconst RIB_TOP = 0.009\nconst CROSS_RIB_TOP = 0.011\nconst THICK = 0.03\n\nconst flat = (shape: 'box' | 'cylinder', top: number, size: readonly [number, number], color: number): SurfacePart =>\n shape === 'box' ? { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[1]], color } : { shape, centre: [0, top - THICK / 2, 0], size: [size[0], THICK, size[0]], color }\n\nconst rib = (size: readonly [number, number, number], top: number, at: readonly [number, number]): SurfacePart => ({ shape: 'box', centre: [at[0], top - size[1] / 2, at[1]], size, color: IRON_WORN })\n\nfunction cover(piece: SurfacePiece): SurfacePart[] {\n const [width, , depth] = piece.size\n const shape = piece.shape === 'round' ? 'cylinder' : 'box'\n const [frame, lid] = piece.shape === 'round' ? [(width + 0.12) / 2, width / 2] : [width + 0.12, width]\n const colors = piece.material === 'concrete' ? [IRON, CONCRETE_LID] : [IRON, IRON_WORN]\n const parts = [flat(shape, FRAME_TOP, [frame, piece.shape === 'round' ? frame : depth + 0.12], colors[0] as number), flat(shape, LID_TOP, [lid, piece.shape === 'round' ? lid : depth], colors[1] as number)]\n if (piece.kind === 'inspection_cover') return [...parts, rib([0.14, 0.006, 0.03], RIB_TOP, [0, 0])]\n if (piece.shape === 'round') return [...parts, rib([lid * 1.7, 0.005, 0.04], RIB_TOP, [0, 0]), rib([0.04, 0.005, lid * 1.7], CROSS_RIB_TOP, [0, 0])]\n return [...parts, ...[-0.15, 0, 0.15].map((z) => rib([lid * 0.85, 0.005, 0.03], RIB_TOP, [0, z]))]\n}\n\n/** A grate at the kerb: the iron frame, the open slot dark under it, five bars along the kerb and a brace across them. */\nfunction grate(): SurfacePart[] {\n const bars = [-0.2, -0.1, 0, 0.1, 0.2].map((z): SurfacePart => ({ shape: 'box', centre: [0, RIB_TOP - 0.006, z], size: [0.9, 0.012, 0.025], color: IRON_WORN }))\n const brace: SurfacePart = { shape: 'box', centre: [0, 0.0055, 0], size: [0.03, 0.003, 0.5], color: IRON }\n return [\n { shape: 'box', centre: [0, FRAME_TOP - THICK / 2, 0], size: [1, THICK, 0.6], color: IRON },\n { shape: 'box', centre: [0, 0.0025, 0], size: [0.9, 0.001, 0.5], color: VOID },\n ...bars,\n brace,\n ]\n}\n\n/** A pillar hydrant: flange, barrel, bonnet, two side nozzles and the pumper's nozzle in front. */\nfunction hydrant(): SurfacePart[] {\n const part = (y: number, radius: number, length: number, axis: 'x' | 'y' | 'z', at: readonly [number, number] = [0, 0]): SurfacePart => ({ shape: 'cylinder', centre: [at[0], y, at[1]], size: [radius, length, radius], axis, color: HYDRANT_RED })\n return [part(0.02, 0.1, 0.04, 'y'), part(0.38, 0.065, 0.68, 'y'), part(0.74, 0.085, 0.06, 'y'), part(0.55, 0.032, 0.26, 'x'), part(0.5, 0.045, 0.14, 'z', [0, 0.1])]\n}\n\n/** An outfall's wing wall: the headwall the gallery comes through, a wing on each side toward the river and the apron between. */\nfunction wingWall(piece: SurfacePiece): SurfacePart[] {\n const [width, height, depth] = piece.size\n return [\n { shape: 'box', centre: [0, (height - 0.4) / 2, 0], size: [width, height + 0.4, 0.25], color: CONCRETE },\n ...[-1, 1].map((side): SurfacePart => ({ shape: 'box', centre: [side * (width / 2 - 0.135), (height - 0.2 - 0.4) / 2 + 0.01, depth / 2], size: [0.25, height - 0.2 + 0.4 - 0.02, depth], color: CONCRETE })),\n { shape: 'box', centre: [0, 0.01 - 0.075, depth / 2], size: [width - 0.6, 0.15, depth - 0.1], color: CONCRETE_LID },\n ]\n}\n\n/** The water meter's box beside the gate: the concrete box and its iron lid. */\nfunction meterBox(piece: SurfacePiece): SurfacePart[] {\n const [width, height, depth] = piece.size\n return [\n { shape: 'box', centre: [0, height / 2, 0], size: [width, height, depth], color: CONCRETE },\n { shape: 'box', centre: [0, height, 0], size: [width - 0.06, 0.008, depth - 0.06], color: IRON },\n ]\n}\n\n/** The mouth of a downspout at the kerb: a concrete lip with its slot. */\nfunction mouth(): SurfacePart[] {\n return [\n { shape: 'box', centre: [0, FRAME_TOP - 0.01, 0], size: [0.3, 0.02, 0.2], color: CONCRETE },\n { shape: 'box', centre: [0, 0.0025, 0], size: [0.2, 0.001, 0.08], color: VOID },\n ]\n}\n\n/** The solids of a piece, by its kind. */\nexport function partsOf(piece: SurfacePiece): SurfacePart[] {\n switch (piece.kind) {\n case 'inlet_grate':\n return grate()\n case 'hydrant':\n return hydrant()\n case 'wing_wall':\n return wingWall(piece)\n case 'meter_box':\n return meterBox(piece)\n case 'downspout_mouth':\n return mouth()\n default:\n return cover(piece)\n }\n}\n","import type * as THREE_NS from 'three'\n\nimport { markKitOrigin } from '@adatechnology/game-contracts'\nimport { shapeGeometries } from '@adatechnology/game-shapes-three'\nimport { surfacePiecesOf } from '@adatechnology/game-urban/networks'\nimport type { SurfacePiece, SurfacePiecesOptions, UtilityNetworks } from '@adatechnology/game-urban/networks'\n\nimport { partsOf } from './surface-parts'\nimport type { SurfacePart } from './surface-parts'\n\ntype Three = typeof THREE_NS\n\n/** Sides of a round cover. */\nconst CYLINDER_SEGMENTS = 14\n\nexport type DrawnSurface = {\n readonly root: THREE_NS.Object3D\n /** The pieces drawn (`surfacePiecesOf`): where each cover, grate, hydrant and wall stands. */\n readonly pieces: readonly SurfacePiece[]\n /** Draw calls: one for the boxes, one for the cylinders. */\n drawCalls(): number\n /** Takes a piece off the ground (a cover thrown by a blast): its parts are hidden, nothing else moves. */\n remove(id: string): void\n /** Puts a piece taken off back where it was (the world is reset). */\n restore(id: string): void\n dispose(): void\n}\n\ntype Range = { readonly box: readonly [number, number]; readonly cylinder: readonly [number, number] }\n\n/**\n * Draws what shows of the buried networks (`surfacePiecesOf`): covers flush with the road, grates at the kerb, hydrants, wing walls, the\n * boxes of each lot. Every part of every piece is an instance of one of two meshes, with its colour: two draw calls whatever the district.\n */\nexport function drawSurface(THREE: Three, { networks, pieces, root, options }: { readonly networks?: Pick<UtilityNetworks, 'nodes' | 'edges'>; readonly pieces?: readonly SurfacePiece[]; readonly root?: THREE_NS.Object3D; readonly options?: SurfacePiecesOptions }): DrawnSurface {\n const list = pieces ?? surfacePiecesOf(networks ?? { nodes: [], edges: [] }, options)\n const T = shapeGeometries(THREE)\n const group = markKitOrigin(root ?? new THREE.Group(), { owner: 'game-urban-three', kind: 'network-surface' })\n const boxes: Array<{ readonly piece: SurfacePiece; readonly part: SurfacePart }> = []\n const cylinders: Array<{ readonly piece: SurfacePiece; readonly part: SurfacePart }> = []\n const ranges = new Map<string, Range>()\n for (const piece of list) {\n const parts = partsOf(piece)\n const range = { box: [boxes.length, 0] as [number, number], cylinder: [cylinders.length, 0] as [number, number] }\n for (const part of parts) (part.shape === 'box' ? boxes : cylinders).push({ piece, part })\n range.box[1] = boxes.length - range.box[0]\n range.cylinder[1] = cylinders.length - range.cylinder[0]\n ranges.set(piece.id, range)\n }\n const material = new THREE.MeshStandardMaterial({ color: 0xffffff, roughness: 0.7, metalness: 0.2 })\n const boxGeometry = new T.BoxGeometry(1, 1, 1)\n const cylinderGeometry = new T.CylinderGeometry(1, 1, 1, CYLINDER_SEGMENTS)\n const matrix = new THREE.Matrix4()\n const turn = new THREE.Quaternion()\n const spin = new THREE.Quaternion()\n const local = new THREE.Matrix4()\n const color = new THREE.Color()\n const axisTurn: Record<'x' | 'y' | 'z', THREE_NS.Quaternion> = { x: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0, 0, 1), Math.PI / 2), y: new THREE.Quaternion(), z: new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI / 2) }\n const fill = (mesh: THREE_NS.InstancedMesh, items: typeof boxes, [start, count]: readonly [number, number] = [0, items.length]): void => {\n for (let slot = start; slot < start + count; slot++) {\n const { piece, part } = items[slot] as (typeof boxes)[number]\n turn.setFromAxisAngle(new THREE.Vector3(0, 1, 0), piece.ry)\n matrix.compose(new THREE.Vector3(piece.at[0], piece.at[1], piece.at[2]), turn, new THREE.Vector3(1, 1, 1))\n spin.copy(axisTurn[part.axis ?? 'y'])\n local.compose(new THREE.Vector3(...part.centre), spin, new THREE.Vector3(...part.size))\n mesh.setMatrixAt(slot, matrix.multiply(local))\n mesh.setColorAt(slot, color.set(part.color))\n }\n }\n const make = (geometry: THREE_NS.BufferGeometry, items: typeof boxes, name: string): THREE_NS.InstancedMesh => {\n const mesh = new THREE.InstancedMesh(geometry, material, Math.max(items.length, 1))\n mesh.name = name\n mesh.count = items.length\n mesh.receiveShadow = true\n fill(mesh, items)\n return mesh\n }\n const boxMesh = make(boxGeometry, boxes, 'network:surface:boxes')\n const cylinderMesh = make(cylinderGeometry, cylinders, 'network:surface:cylinders')\n group.add(boxMesh, cylinderMesh)\n const hide = (mesh: THREE_NS.InstancedMesh, [start, count]: readonly [number, number]): void => {\n matrix.makeScale(0, 0, 0)\n for (let slot = start; slot < start + count; slot++) mesh.setMatrixAt(slot, matrix)\n mesh.instanceMatrix.needsUpdate = true\n }\n return {\n root: group,\n pieces: list,\n drawCalls: () => [boxMesh, cylinderMesh].filter((mesh) => mesh.count > 0).length,\n remove(id) {\n const range = ranges.get(id)\n if (range === undefined) return\n hide(boxMesh, range.box)\n hide(cylinderMesh, range.cylinder)\n },\n restore(id) {\n const range = ranges.get(id)\n if (range === undefined) return\n fill(boxMesh, boxes, range.box)\n fill(cylinderMesh, cylinders, range.cylinder)\n boxMesh.instanceMatrix.needsUpdate = true\n cylinderMesh.instanceMatrix.needsUpdate = true\n },\n dispose() {\n group.parent?.remove(group)\n for (const mesh of [boxMesh, cylinderMesh]) mesh.dispose()\n for (const item of [boxGeometry, cylinderGeometry, material]) item.dispose()\n },\n }\n}\n","import { generate } from '@adatechnology/game-vegetation'\nimport type { Condition, Lod, Season } from '@adatechnology/game-vegetation'\nimport { createPlantObject, createVegetationMaterials } from '@adatechnology/game-vegetation/three'\nimport { toSpec as defaultToSpec } from '@adatechnology/game-vegetation-species'\nimport type { PlacementPart } from '@adatechnology/game-urban'\n\nimport type * as THREE_NS from 'three'\n\ntype Three = typeof THREE_NS\n\n/** Makes the object of a placement; null when it cannot (an unknown id). The drawer clones it for each spot. */\nexport type PlacementResolver = ((part: PlacementPart) => THREE_NS.Object3D | null) & { dispose?: () => void }\n\nconst cssColor = (value: number): string => `#${value.toString(16).padStart(6, '0')}`\n\n/** The options of `createVehiclesThree().build` that the resolver passes (structural, so this package does not import game-vehicles-three). */\nexport type VehicleBuildOptions = { quality?: 'high' | 'lite'; color?: string; seed?: number | string }\n\nexport type VehicleResolverOptions = {\n /** `lite` fuses a vehicle into six meshes, the right cost for a street of parked cars. Default `lite`. */\n quality?: VehicleBuildOptions['quality']\n}\n\n/** What the vehicle resolver needs of `createVehiclesThree`. */\nexport type VehicleBuilder = { build(key: string, options?: VehicleBuildOptions): { group: THREE_NS.Object3D; dispose(): void } }\n\n/**\n * Resolves vehicle placements with the vehicles of `game-vehicles-three`. A vehicle is built once for each id and paint and cloned\n * (clones share geometry and materials) for each spot.\n */\nexport function createVehicleResolver(vehicles: VehicleBuilder, options: VehicleResolverOptions = {}): PlacementResolver {\n const quality = options.quality ?? 'lite'\n const built = new Map<string, { group: THREE_NS.Object3D; dispose(): void } | null>()\n const resolve: PlacementResolver = (part) => {\n const key = `${part.id}|${part.color ?? ''}|${part.seed}`\n if (!built.has(key)) {\n try {\n built.set(key, vehicles.build(part.id, { quality, ...(part.color === undefined ? { seed: part.seed } : { color: cssColor(part.color) }) }))\n } catch {\n built.set(key, null)\n }\n }\n return built.get(key)?.group.clone() ?? null\n }\n resolve.dispose = () => {\n for (const entry of built.values()) entry?.dispose()\n built.clear()\n }\n return resolve\n}\n\nexport type PlantResolverOptions = {\n /**\n * The generator spec of a species id (`defaultPlantSpec` of `game-kit-defaults`, or the game's own). Default `toSpec` of `game-vegetation-species`.\n * @deprecated pass `toSpec`; the default is removed in the next major.\n */\n toSpec?: (id: string) => Parameters<typeof generate>[0]\n /** Level of detail of the plants of a street. Default 1. */\n lod?: Lod\n condition?: Condition\n season?: Season\n /** Materials of the plants (wind included); default new ones. */\n materials?: ReturnType<typeof createVegetationMaterials>\n}\n\n/** Resolves plant placements with the species `toSpec` knows, built with `game-vegetation`. One plant for each species and seed, cloned for each spot. */\nexport function createPlantResolver(THREE: Three, options: PlantResolverOptions = {}): PlacementResolver {\n const materials = options.materials ?? createVegetationMaterials(THREE)\n const made = new Map<string, THREE_NS.Object3D | null>()\n const resolve: PlacementResolver = (part) => {\n const key = `${part.id}|${part.seed}`\n if (!made.has(key)) {\n try {\n const mesh = generate((options.toSpec ?? defaultToSpec)(part.id), { seed: part.seed, lod: options.lod ?? 1, condition: options.condition ?? 'healthy', season: options.season ?? 'spring', species: part.id })\n made.set(key, createPlantObject(THREE, mesh, materials))\n } catch {\n made.set(key, null)\n }\n }\n return made.get(key)?.clone() ?? null\n }\n resolve.dispose = () => {\n for (const object of made.values()) {\n object?.traverse((o) => (o as THREE_NS.Mesh).geometry?.dispose?.())\n }\n made.clear()\n }\n return resolve\n}\n","import { createPlantProvider, createUrban, createVehicleProvider } from '@adatechnology/game-urban'\nimport type { PlacementPart, TerrainOptions, UrbanOptions, UrbanPart } from '@adatechnology/game-urban'\nimport type { ModuleScenario } from '@adatechnology/game-contracts'\n\nimport { fill } from './text'\nimport type { UrbanText } from './text'\nimport type { UrbanContext } from './types'\n\n/** The heights of the five poles of the Galeria (m), the tops measured on the page's scenes. A game's own poles are not checked. */\nexport const POLE_TOPS: Readonly<Record<string, number>> = { led_double: 9, concrete_arm: 8, cast_iron: 4.8, wood_crossarm: 7, flood_tower: 12.55 }\n\n// the scenario checks the mechanics of the providers, so it hands them its own small fleet and species instead of a content pack\nconst STAND_IN_VEHICLE_IDS: readonly string[] = ['stand_in_car_a', 'stand_in_car_b', 'stand_in_van']\nconst standInSpecies = (context: string, key: string): string => `stand_in_${context}_${key.length % 3}`\n\nexport type ScenarioDeps = {\n readonly text: UrbanText\n readonly urban: UrbanOptions | undefined\n readonly terrain: TerrainOptions\n}\n\nconst topOf = (parts: readonly UrbanPart[]): number => Math.max(...parts.map((part) => ('height' in part && 'y' in part ? part.y + part.height / 2 : 0)))\nconst placements = (parts: readonly UrbanPart[], kind: PlacementPart['kind']): PlacementPart[] => parts.filter((part): part is PlacementPart => part.shape === 'placement' && part.kind === kind)\nconst round = (value: number, digits = 3): number => Math.round(value * 10 ** digits) / 10 ** digits\n\n/**\n * The scenarios of the urban area: checks on the numbers the kit promises (the poles' heights, the light budget, the dashes of a road,\n * the heights of a block, the determinism of a neighbourhood, burnt-out lamps, the terrain, the providers). They need no object of the\n * room, so a game that patches the catalogues sees at once what it changed.\n */\nexport const createScenarios = (deps: ScenarioDeps): ModuleScenario<UrbanContext>[] => {\n const { text } = deps\n const say = (id: string, ...values: unknown[]): string => fill(text.checks[id] as string, ...values)\n const scenario = (id: string, run: ModuleScenario<UrbanContext>['run']): ModuleScenario<UrbanContext> => ({ id, name: text.scenarios[id] ?? id, run })\n const kit = () => createUrban(deps.urban)\n\n return [\n scenario('urban_pole_heights', ({ expect }) => {\n const urban = kit()\n for (const id of urban.poles.ids()) {\n const expected = POLE_TOPS[id]\n if (expected === undefined) continue\n const b = urban.builder()\n urban.poles.get(id).build(b, { x: 0, z: 0 })\n const top = topOf(b.parts)\n expect(Math.abs(top - expected) < 1e-6, say('pole_top', id, round(top)), { pole: id, top })\n }\n }),\n scenario('urban_light_budget', ({ expect }) => {\n const urban = kit()\n const budget = 4\n const b = urban.builder({ budget })\n for (let index = 0; index < 8; index++) urban.poles.get('led_double').build(b, { x: index * 8, z: 0 })\n const real = b.parts.filter((part) => part.shape === 'light').length\n expect(real === budget, say('budget_real', 8, real, budget), { real, budget })\n expect(b.lights.left < 0, say('budget_left', b.lights.left), { left: b.lights.left })\n }),\n scenario('urban_road_dashes', ({ expect }) => {\n const urban = kit()\n const b = urban.builder()\n urban.streets.road(b, 0, 0, 7, 60, 'x')\n expect(b.items.length === 12 && b.items[0]?.x === -28 && b.items[1]?.x === -23, say('dashes', b.items.length, b.items[0]?.x), { dashes: b.items.length })\n }),\n scenario('urban_block_heights', ({ expect }) => {\n const urban = kit()\n const b = urban.builder({ seed: 3 })\n const placed = urban.block.fill(b, { cx: 0, cz: 0, size: 200, minHeight: 10, maxHeight: 50, k: 20, gap: 0.01 })\n const heights = placed.map((building) => building.height).sort((a, c) => a - c)\n const median = heights[Math.floor(heights.length / 2)] as number\n expect(heights.length > 0 && (heights[0] as number) >= 10 && (heights[heights.length - 1] as number) <= 50, say('heights_in_range', 10, 50), { count: heights.length })\n expect(median < 30, say('heights_median', round(median, 1), 30), { median })\n }),\n scenario('urban_neighbourhood_seed', ({ expect }) => {\n const urban = kit()\n const draw = (seed: number): string => {\n const b = urban.builder({ seed })\n urban.neighbourhoods.get(urban.neighbourhoods.ids()[1] as string).compose(b, { x: 0, z: 0 })\n return JSON.stringify(b.scene())\n }\n expect(draw(7) === draw(7), say('same_seed', 7))\n expect(draw(7) !== draw(8), say('other_seed', 8))\n }),\n scenario('urban_lamps_burnt', ({ expect }) => {\n const dark = createUrban({ ...deps.urban, patch: { ...deps.urban?.patch, neighbourhoods: { ...deps.urban?.patch?.neighbourhoods, suburb: { lit: 0 } } } })\n const suburb = dark.neighbourhoods.get('suburb').compose(dark.builder(), { x: 0, z: 0 })\n expect(suburb.poles.length > 0 && !suburb.poles.some((pole) => pole.on), say('lamps_none', suburb.poles.length), { poles: suburb.poles.length })\n const lit = kit()\n const downtown = lit.neighbourhoods.get('downtown').compose(lit.builder(), { x: 0, z: 0 })\n expect(downtown.poles.length > 0 && downtown.poles.every((pole) => pole.on), say('lamps_all', downtown.poles.length), { poles: downtown.poles.length })\n }),\n scenario('urban_terrain', ({ expect }) => {\n const urban = kit()\n const terrain = urban.terrain(deps.terrain)\n const grid = terrain.grid()\n const mid = (grid.segments / 2) * (grid.segments + 1) + grid.segments / 2\n const world = terrain.fromWorld(grid.x[mid] as number, grid.z[mid] as number)\n const height = terrain.heightAt(world[0], world[1])\n expect(Math.abs(height - (grid.heights[mid] as number)) < 1e-3, say('vertex_height', round(height), round(grid.heights[mid] as number)), { height })\n for (const river of deps.terrain.rivers) {\n if (!('fixed' in river.bed)) continue\n const point = river.points[Math.floor(river.points.length / 2)] as readonly [number, number]\n const bed = terrain.heightAt(point[0], point[1])\n expect(Math.abs(bed - river.bed.fixed) < 1e-6, say('river_bed', round(river.bed.fixed < 0 ? -river.bed.fixed : river.bed.fixed)), { river: river.id, bed })\n }\n for (const lake of deps.terrain.lakes) {\n const level = terrain.heightAt(lake.center[0], lake.center[1])\n expect(Math.abs(level - lake.level) < 1e-6, say('lake_level', round(level)), { lake: lake.id, level })\n }\n }),\n scenario('urban_providers', ({ expect }) => {\n const urban = kit()\n const cars = urban.builder()\n const downtown = urban.neighbourhoods.get('downtown').compose(cars, { x: 0, z: 0 }, { providers: { vehicle: createVehicleProvider({ ids: STAND_IN_VEHICLE_IDS }) } })\n const spots = placements(cars.parts, 'vehicle')\n expect(spots.length === downtown.vehicles.length && spots.length > 0, say('vehicles_placed', downtown.vehicles.length, spots.length))\n expect(spots.every((spot) => STAND_IN_VEHICLE_IDS.includes(spot.id)), say('vehicle_ids', [...new Set(spots.map((spot) => spot.id))].join(', ')))\n const trees = urban.builder()\n const mountain = urban.neighbourhoods.get('mountain_resort').compose(trees, { x: 0, z: 0 }, { providers: { plant: createPlantProvider({ pickSpecies: standInSpecies }) } })\n const planted = placements(trees.parts, 'plant')\n expect(planted.length === mountain.plants.length && planted.length > 0, say('plants_placed', mountain.plants.length, planted.length))\n }),\n ]\n}\n","/** Words and sentences of the urban area, by locale. `{0}`, `{1}`... are filled in order. */\nexport type UrbanText = {\n group: string\n name: string\n items: Record<string, string>\n controls: Record<'pattern' | 'seed' | 'lamps' | 'budget' | 'providers', string>\n hints: Record<'pattern' | 'seed' | 'lamps' | 'budget' | 'providers', string>\n options: { lamps: Record<string, string>; providers: Record<string, string> }\n actions: Record<'compose' | 'clear', string>\n layers: Record<'light_radius' | 'bounds', string>\n metrics: Record<'samples' | 'draw_calls' | 'triangles' | 'real_lights' | 'instances' | 'bench_objects' | 'light_budget_left', string>\n log: Record<'composed' | 'cleared' | 'no_vehicles', string>\n scenarios: Record<string, string>\n checks: Record<string, string>\n}\n\nconst ptBR: UrbanText = {\n group: 'Cidade',\n name: 'Área urbana',\n items: {\n pole_led_double: 'Poste LED de braço duplo',\n pole_concrete_arm: 'Poste de concreto com braço',\n pole_cast_iron: 'Lampião de ferro fundido',\n pole_wood_crossarm: 'Poste de madeira com cruzeta',\n pole_flood_tower: 'Torre de refletores',\n street_grid: 'Grade de ruas com quarteirão',\n terrain_patch: 'Trecho de terreno',\n downtown: 'Bairro: centro',\n suburb: 'Bairro: subúrbio',\n working_class: 'Bairro: popular',\n historic_street: 'Bairro: rua histórica',\n industrial_port: 'Bairro: industrial e porto',\n railway_village: 'Bairro: vila ferroviária',\n mountain_resort: 'Bairro: serra',\n stilt_village: 'Bairro: palafitas',\n military: 'Bairro: militar',\n rural: 'Bairro: rural',\n },\n controls: { pattern: 'Bairro da bancada', seed: 'Semente', lamps: 'Lampiões', budget: 'Luzes reais da cena', providers: 'Veículos e plantas' },\n hints: {\n pattern: 'Padrão que as ações desenham na frente do jogador',\n seed: 'A mesma semente desenha a mesma rua',\n lamps: 'Quantos lampiões ficam acesos; o resto queima',\n budget: 'Cada lampião aceso gasta uma; passando disso fica só a lente brilhando',\n providers: 'Pede ao game-vehicles-fleet e ao game-vegetation-species os carros e as árvores',\n },\n options: {\n lamps: { pattern: 'Os do padrão', all: 'Todos acesos', half: 'Metade', none: 'Nenhum' },\n providers: { none: 'Nenhum (padrão)', plants: 'Plantas das espécies', vehicles: 'Veículos da frota', both: 'Os dois' },\n },\n actions: { compose: 'Desenhar o bairro', clear: 'Tirar o bairro' },\n layers: { light_radius: 'Alcance das luzes', bounds: 'Caixas das amostras' },\n metrics: { samples: 'Amostras na sala', draw_calls: 'Chamadas de desenho', triangles: 'Triângulos', real_lights: 'Luzes reais', instances: 'Instâncias', bench_objects: 'Objetos da bancada', light_budget_left: 'Orçamento de luzes que sobra' },\n log: { composed: 'Bairro {0} desenhado com a semente {1}: {2} objetos, {3} luzes reais', cleared: 'Bairro tirado', no_vehicles: 'A sala não recebeu um construtor de veículos: os carros ficam de fora' },\n scenarios: {\n urban_pole_heights: 'Os cinco postes têm a altura da tabela',\n urban_light_budget: 'O orçamento de luzes: as primeiras acesas ganham luz real e o contador passa de zero',\n urban_road_dashes: 'A rua tem uma faixa a cada 5 m',\n urban_block_heights: 'Os prédios altos são mais raros',\n urban_neighbourhood_seed: 'A mesma semente desenha o mesmo bairro',\n urban_lamps_burnt: 'Um bairro com a fração zero de lampiões acesos não tem nenhum aceso',\n urban_terrain: 'O terreno tem a altura do vértice, o leito do rio e o nível do lago',\n urban_providers: 'Os provedores pedem veículos da frota e espécies da região onde o bairro estaciona e planta',\n },\n checks: {\n pole_top: 'o poste {0} chega a {1} m',\n budget_real: '{0} lâmpadas acesas, {1} luzes reais (o orçamento é {2})',\n budget_left: 'o contador chegou a {0}',\n dashes: 'uma rua de 60 m tem {0} faixas, a primeira em x = {1}',\n heights_in_range: 'os prédios ficam entre {0} e {1} m',\n heights_median: 'a mediana dos prédios é {0} m, abaixo do meio {1} m',\n same_seed: 'a mesma semente repete as partes: {0}',\n other_seed: 'outra semente muda o bairro: {0}',\n lamps_none: 'com a fração 0 nenhum dos {0} postes está aceso',\n lamps_all: 'o centro mantém os {0} postes acesos',\n vertex_height: 'a altura do vértice central é {0} m e a da malha {1} m',\n river_bed: 'o leito do rio está {0} m abaixo do chão ao lado',\n lake_level: 'o centro do lago está a {0} m',\n vehicles_placed: '{0} veículos pedidos, {1} vagas de veículo na cena',\n vehicle_ids: 'os veículos são da frota: {0}',\n plants_placed: '{0} plantas pedidas, {1} vagas de planta na cena',\n },\n}\n\nconst en: UrbanText = {\n group: 'City',\n name: 'Urban area',\n items: {\n pole_led_double: 'Double-arm LED pole',\n pole_concrete_arm: 'Concrete pole with an arm',\n pole_cast_iron: 'Cast-iron lantern',\n pole_wood_crossarm: 'Wooden pole with a crossarm',\n pole_flood_tower: 'Floodlight tower',\n street_grid: 'Street grid with a block',\n terrain_patch: 'Terrain patch',\n downtown: 'Neighbourhood: downtown',\n suburb: 'Neighbourhood: suburb',\n working_class: 'Neighbourhood: working class',\n historic_street: 'Neighbourhood: historic street',\n industrial_port: 'Neighbourhood: industrial and port',\n railway_village: 'Neighbourhood: railway village',\n mountain_resort: 'Neighbourhood: mountain resort',\n stilt_village: 'Neighbourhood: stilt village',\n military: 'Neighbourhood: military',\n rural: 'Neighbourhood: rural',\n },\n controls: { pattern: 'Bench neighbourhood', seed: 'Seed', lamps: 'Street lamps', budget: 'Real lights of the scene', providers: 'Vehicles and plants' },\n hints: {\n pattern: 'The pattern the actions draw in front of the player',\n seed: 'The same seed draws the same street',\n lamps: 'How many lamps are on; the rest are burnt out',\n budget: 'Every lamp that is on spends one; past that it keeps only its glowing lens',\n providers: 'Asks game-vehicles-fleet and game-vegetation-species for the cars and trees',\n },\n options: {\n lamps: { pattern: \"The pattern's own\", all: 'All on', half: 'Half', none: 'None' },\n providers: { none: 'None (default)', plants: 'Plants of the species pack', vehicles: 'Vehicles of the fleet', both: 'Both' },\n },\n actions: { compose: 'Draw the neighbourhood', clear: 'Take the neighbourhood away' },\n layers: { light_radius: 'Light reach', bounds: 'Sample boxes' },\n metrics: { samples: 'Samples in the room', draw_calls: 'Draw calls', triangles: 'Triangles', real_lights: 'Real lights', instances: 'Instances', bench_objects: 'Bench objects', light_budget_left: 'Light budget left' },\n log: { composed: 'Neighbourhood {0} drawn with seed {1}: {2} objects, {3} real lights', cleared: 'Neighbourhood taken away', no_vehicles: 'The room got no vehicle builder: the cars are left out' },\n scenarios: {\n urban_pole_heights: 'The five poles stand at the height of the table',\n urban_light_budget: 'The light budget: the first lamps get real lights and the counter goes below zero',\n urban_road_dashes: 'A road has a dash every 5 m',\n urban_block_heights: 'Tall buildings are rarer',\n urban_neighbourhood_seed: 'The same seed draws the same neighbourhood',\n urban_lamps_burnt: 'A neighbourhood with no lamps lit has none on',\n urban_terrain: 'The terrain has the vertex height, the river bed and the lake level',\n urban_providers: 'The providers ask for fleet vehicles and species of the region where the neighbourhood parks and plants',\n },\n checks: {\n pole_top: 'pole {0} reaches {1} m',\n budget_real: '{0} lamps on, {1} real lights (the budget is {2})',\n budget_left: 'the counter reached {0}',\n dashes: 'a 60 m road has {0} dashes, the first at x = {1}',\n heights_in_range: 'the buildings stand between {0} and {1} m',\n heights_median: 'the median building is {0} m, under the middle {1} m',\n same_seed: 'the same seed repeats the parts: {0}',\n other_seed: 'another seed changes the neighbourhood: {0}',\n lamps_none: 'with the share 0 none of the {0} poles is on',\n lamps_all: 'downtown keeps its {0} poles on',\n vertex_height: 'the height of the central vertex is {0} m and the mesh has {1} m',\n river_bed: 'the river bed is {0} m below the land beside it',\n lake_level: 'the centre of the lake is at {0} m',\n vehicles_placed: '{0} vehicles asked, {1} vehicle spots in the scene',\n vehicle_ids: 'the vehicles are of the fleet: {0}',\n plants_placed: '{0} plants asked, {1} plant spots in the scene',\n },\n}\n\nexport const TEXT: Record<string, UrbanText> = { 'pt-BR': ptBR, en }\n\n/** Fills `{0}`, `{1}`... in order. */\nexport const fill = (template: string, ...values: unknown[]): string => template.replace(/\\{(\\d+)\\}/g, (_match, index: string) => String(values[Number(index)] ?? ''))\n"],"mappings":";AACA,SAAS,qBAAqB;AAE9B,SAAS,uBAAuB;AAEhC,SAAS,uBAAAA,sBAAqB,eAAAC,cAAa,yBAAAC,wBAAuB,oBAAoB;AAEtF,SAAS,mBAAAC,wBAAuB;;;ACPhC,SAAS,iBAAAC,sBAAqB;AAC9B,SAAS,kBAAAC,uBAAsB;AAI/B,SAAS,mBAAAC,kBAAiB,0BAA0B;;;ACC7C,IAAM,eAAe,EAAE,KAAK,MAAM,MAAM,IAAI,MAAM,KAAK,WAAW,KAAK,WAAW,MAAM,QAAQ,EAAE;AAEzG,IAAM,OAAO,IAAI,KAAK;AAGf,IAAM,iBAAiB,CAAC,UAA0B,KAAK,OAAS,QAAQ,OAAQ,QAAQ,OAAQ,OAAO,aAAa,MAAM,IAAI,aAAa;AAG3I,IAAM,oBAAoB,CAAC,UAA2B,QAAQ,aAAa,SAAU;AAGrF,IAAM,eAAe,CAAC,GAAW,UACtC,KAAK,IAAI,IAAI,aAAa,OAAO,KAAK,IAAI,aAAa,aAAa,KAAK,IAAI,IAAI,aAAa,OAAO,KAAK,IAAI,aAAa,YAAY,aAAa,MAAM;AAQrJ,SAAS,oBAAoB,MAAiE,YAAoB,KAAK,GAAW;AACvI,QAAM,OAAO,KAAK,IAAI,WAAW,GAAG;AACpC,QAAM,gBAAgB,KAAK,WAAW,IAAI,KAAK,IAAI,GAAG,IAAI,OAAO,KAAK,QAAQ,KAAK,KAAK,QAAQ;AAChG,QAAM,SAAS,KAAK,WAAW,IAAI,KAAK,IAAI,MAAM,KAAK,OAAO,KAAK,aAAa,CAAC,KAAK,IAAI;AAC1F,SAAQ,KAAK,YAAY,KAA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AAM,KAAK,QAAQ,mBAAmB,MAAM,MAAO,QAAQ,aAAa,SAAS,OAAQ;AAAA,IACtH;AAAA,IACA,OAAO,MAAM;AACX,aAAO;AACP,cAAQ,KAAK;AAEb,YAAM,SAAS,KAAK;AACpB,YAAM,YAAY,QAAQ;AAC1B,UAAI,UAAU,OAAO,MAAM,UAAU;AACnC,eAAO,MAAM;AACb,eAAO,uBAAuB;AAAA,MAChC;AACA,YAAM,aAAa,KAAK,OAAO,SAAS,QAAQ;AAChD,YAAM,YAAY,KAAK,QAAQ,KAAK;AACpC,aAAO,MAAM;AACX,qBAAa;AACb,kBAAU;AACV,qBAAa;AACb,mBAAW;AACX,YAAI,UAAU,cAAc,QAAW;AACrC,iBAAO,MAAM;AACb,iBAAO,uBAAuB;AAAA,QAChC;AACA,kBAAU,OAAO,UAAU;AAC3B,kBAAU,SAAS,UAAU;AAC7B,mBAAW,SAAS,OAAO,OAAO,EAAG,YAAW,QAAQ,MAAM,MAAM,OAAQ,KAAI,YAAY,KAAM,MAAK,OAAO,OAAO;AACrH,eAAO,MAAM;AACb,eAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF;AACF;AAMO,SAAS,oBAAiD,MAAY,UAA4B,CAAC,GAAmC;AAC3I,SAAO,KAAK,WAAW,sBAAsB,OAAO,CAAU;AAChE;","names":["createPlantProvider","createUrban","createVehicleProvider","shapeGeometries","markKitOrigin","LIGHT_PRIORITY","shapeGeometries","shapeGeometries","shapeGeometries","shapeGeometries","markKitOrigin","shapeGeometries","round","markKitOrigin","shapeGeometries","CYLINDER_SEGMENTS","shapeGeometries","markKitOrigin","markKitOrigin","shapeGeometries","surfacePiecesOf","CYLINDER_SEGMENTS","surfacePiecesOf","shapeGeometries","markKitOrigin","fill","shapeGeometries","flat","LIGHT_PRIORITY","intensity","source","light","markKitOrigin","createUrban","createPlantProvider","createVehicleProvider","shapeGeometries","placements"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SourceHandle, LightBudget } from '@adatechnology/game-render-three';
|
|
2
2
|
import { LampShares, PoleDef, LightPart, UrbanScene } from '@adatechnology/game-urban';
|
|
3
|
-
import { NetworkLamp, NetworkSurface, UtilityNetworks } from '@adatechnology/game-urban/networks';
|
|
3
|
+
import { NetworkLamp, NetworkSurface, PipePiece, SurfacePiece, UtilityNetworks, SurfacePiecesOptions } from '@adatechnology/game-urban/networks';
|
|
4
4
|
import * as THREE_NS from 'three';
|
|
5
5
|
import { C as CanvasFactory, P as PlacementResolver } from './testing-ZS5dhCJM.js';
|
|
6
6
|
export { D as DEFAULT_TEST_TERRAIN, M as ModuleRoomLike, a as POLE_TOPS, b as PlantResolverOptions, T as TEXT, c as TextTextureOptions, U as URBAN_AREA_ID, d as UrbanContext, e as UrbanTestOptions, f as UrbanText, V as VehicleBuildOptions, g as VehicleBuilder, h as VehicleResolverOptions, i as createPlantResolver, j as createScenarios, k as createTextTexture, l as createUrbanTestModule, m as createVehicleResolver, n as loadUrbanTestModule } from './testing-ZS5dhCJM.js';
|
|
@@ -67,6 +67,36 @@ type DrawnNetworks = {
|
|
|
67
67
|
dispose(): void;
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
+
type DrawnBuried = {
|
|
71
|
+
readonly root: THREE_NS.Object3D;
|
|
72
|
+
readonly pipes: readonly PipePiece[];
|
|
73
|
+
/** Draw calls: the pipes, the round shafts, the square ones. */
|
|
74
|
+
drawCalls(): number;
|
|
75
|
+
/** Breaks a pipe at a share of its length: the two halves stop short of the break, `BREAK_GAP` apart. */
|
|
76
|
+
sever(id: string, share: number): void;
|
|
77
|
+
/** Joins the two halves of a broken pipe again (the world is reset). */
|
|
78
|
+
mend(id: string): void;
|
|
79
|
+
dispose(): void;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
type DrawnLid = {
|
|
83
|
+
readonly root: THREE_NS.Object3D;
|
|
84
|
+
dispose(): void;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
type DrawnSurface = {
|
|
88
|
+
readonly root: THREE_NS.Object3D;
|
|
89
|
+
/** The pieces drawn (`surfacePiecesOf`): where each cover, grate, hydrant and wall stands. */
|
|
90
|
+
readonly pieces: readonly SurfacePiece[];
|
|
91
|
+
/** Draw calls: one for the boxes, one for the cylinders. */
|
|
92
|
+
drawCalls(): number;
|
|
93
|
+
/** Takes a piece off the ground (a cover thrown by a blast): its parts are hidden, nothing else moves. */
|
|
94
|
+
remove(id: string): void;
|
|
95
|
+
/** Puts a piece taken off back where it was (the world is reset). */
|
|
96
|
+
restore(id: string): void;
|
|
97
|
+
dispose(): void;
|
|
98
|
+
};
|
|
99
|
+
|
|
70
100
|
type Three$1 = typeof THREE_NS;
|
|
71
101
|
type Obj = THREE_NS.Object3D;
|
|
72
102
|
/** The lights a scene draws: street lamps and searchlights. */
|
|
@@ -127,6 +157,9 @@ declare function createUrbanThree(THREE: Three$1, options?: UrbanThreeOptions):
|
|
|
127
157
|
THREE: typeof THREE_NS;
|
|
128
158
|
draw: (scene: UrbanScene, drawOptions?: DrawOptions) => DrawnUrban;
|
|
129
159
|
drawNetworks: (data: UtilityNetworks, drawOptions?: NetworkDrawOptions) => DrawnNetworks;
|
|
160
|
+
drawNetworkSurface: (data: Pick<UtilityNetworks, "nodes" | "edges">, surfaceOptions?: SurfacePiecesOptions) => DrawnSurface;
|
|
161
|
+
drawBuriedNetworks: (data: Pick<UtilityNetworks, "nodes" | "edges">, surfaceOptions?: SurfacePiecesOptions) => DrawnBuried;
|
|
162
|
+
drawCoverLid: (piece: SurfacePiece) => DrawnLid;
|
|
130
163
|
};
|
|
131
164
|
type UrbanThree = ReturnType<typeof createUrbanThree>;
|
|
132
165
|
|
|
@@ -162,4 +195,4 @@ declare function createRoundedBox(THREE: Three, width: number, height: number, d
|
|
|
162
195
|
/** Triangle prism: the triangle `width` wide and `height` high, extruded `depth` long and centred on z. Base at y = 0. */
|
|
163
196
|
declare function createPrism(THREE: Three, width: number, height: number, depth: number): THREE_NS.BufferGeometry;
|
|
164
197
|
|
|
165
|
-
export { type BudgetedLamp, CanvasFactory, type DrawOptions, type DrawnLight, type DrawnNetworks, type DrawnUrban, LAMP_FLICKER, type NetworkDrawOptions, type NetworkLight, PlacementResolver, type SpanRange, type UrbanLight, type UrbanThree, type UrbanThreeOptions, WIRE_STYLE, createPrism, createRoundedBox, createUrbanThree, flickerGroupOf, flickerGroupPhase, flickerLevel, physicalIntensityOf };
|
|
198
|
+
export { type BudgetedLamp, CanvasFactory, type DrawOptions, type DrawnBuried, type DrawnLid, type DrawnLight, type DrawnNetworks, type DrawnSurface, type DrawnUrban, LAMP_FLICKER, type NetworkDrawOptions, type NetworkLight, PlacementResolver, type SpanRange, type UrbanLight, type UrbanThree, type UrbanThreeOptions, WIRE_STYLE, createPrism, createRoundedBox, createUrbanThree, flickerGroupOf, flickerGroupPhase, flickerLevel, physicalIntensityOf };
|