roamwright 0.4.0 → 0.54.0
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/.prettierrc.yaml +12 -0
- package/CONTRIBUTING.md +21 -14
- package/README.md +38 -42
- package/examples/animals.html +49 -0
- package/examples/animals.js +209 -0
- package/examples/crowds.html +50 -0
- package/examples/crowds.js +268 -0
- package/examples/effects.html +53 -0
- package/examples/effects.js +343 -0
- package/examples/figure-motion.html +55 -0
- package/examples/figure-motion.js +265 -0
- package/examples/figure.html +49 -0
- package/examples/figure.js +238 -0
- package/examples/fliers.html +53 -0
- package/examples/fliers.js +292 -0
- package/examples/fortification.html +54 -0
- package/examples/fortification.js +288 -0
- package/examples/house-kit.html +48 -0
- package/examples/house-kit.js +175 -0
- package/examples/index.html +26 -16
- package/examples/island.html +48 -0
- package/examples/island.js +134 -52
- package/examples/land.html +54 -0
- package/examples/land.js +392 -0
- package/examples/props-and-plants.html +53 -0
- package/examples/props-and-plants.js +275 -0
- package/examples/rooms.html +48 -0
- package/examples/rooms.js +242 -0
- package/examples/ships.html +51 -0
- package/examples/ships.js +235 -0
- package/examples/showcase.css +320 -0
- package/examples/small-world-land.js +151 -0
- package/examples/small-world-life.js +160 -0
- package/examples/small-world-town.js +127 -0
- package/examples/small-world.html +57 -0
- package/examples/small-world.js +226 -0
- package/examples/soundscape.html +138 -0
- package/examples/soundscape.js +467 -0
- package/examples/stage-kits.js +300 -0
- package/examples/stage.js +374 -0
- package/examples/towns.html +50 -0
- package/examples/towns.js +325 -0
- package/examples/viaduct-camera.js +8 -4
- package/examples/viaduct-landscape.js +28 -17
- package/examples/viaduct.html +45 -43
- package/examples/viaduct.js +68 -92
- package/geometry/animal-camel-body.js +410 -0
- package/geometry/animal-camel-head.js +118 -0
- package/geometry/animal-canine-body.js +361 -0
- package/geometry/animal-canine-breeds.js +316 -0
- package/geometry/animal-canine-head.js +337 -0
- package/geometry/animal-cattle-body.js +391 -0
- package/geometry/animal-cattle-coat.js +42 -0
- package/geometry/animal-cattle-head.js +152 -0
- package/geometry/animal-hen.js +248 -0
- package/geometry/animal-horse-body.js +446 -0
- package/geometry/animal-horse-bridle.js +171 -0
- package/geometry/animal-horse-coat.js +68 -0
- package/geometry/animal-horse-face.js +162 -0
- package/geometry/animal-horse-hair.js +304 -0
- package/geometry/animal-horse-head.js +133 -0
- package/geometry/animal-horse-tack.js +157 -0
- package/geometry/animal-options.js +59 -0
- package/geometry/animal-shapes.js +21 -0
- package/geometry/animal-skin.js +390 -0
- package/geometry/bedding.js +141 -0
- package/geometry/builder-cells.js +50 -0
- package/geometry/builder-frame.js +48 -0
- package/geometry/builder.js +200 -177
- package/geometry/card-emblem.js +437 -0
- package/geometry/catenary-canvas.js +396 -0
- package/geometry/cell-mask.js +25 -0
- package/geometry/cloth-folds.js +143 -0
- package/geometry/crawl-shapes.js +71 -0
- package/geometry/creased-sheet.js +40 -35
- package/geometry/crowd-dress.js +315 -0
- package/geometry/crowd-far.js +174 -0
- package/geometry/crowd-look.js +42 -0
- package/geometry/crowd-weld.js +218 -0
- package/geometry/ear.js +44 -39
- package/geometry/erosion.js +71 -45
- package/geometry/face-grid.js +85 -65
- package/geometry/field-map.js +59 -0
- package/geometry/figure-arms.js +339 -0
- package/geometry/figure-beard.js +250 -0
- package/geometry/figure-body.js +297 -0
- package/geometry/figure-bow.js +105 -0
- package/geometry/figure-cloak.js +189 -0
- package/geometry/figure-clothes.js +337 -0
- package/geometry/figure-face-grids.js +75 -0
- package/geometry/figure-gear.js +446 -0
- package/geometry/figure-hair-far.js +151 -0
- package/geometry/figure-hair-hangs.js +108 -0
- package/geometry/figure-hair-patch.js +66 -0
- package/geometry/figure-hair.js +320 -0
- package/geometry/figure-hands.js +321 -0
- package/geometry/figure-head-features.js +280 -0
- package/geometry/figure-head.js +375 -0
- package/geometry/figure-headwear.js +223 -0
- package/geometry/figure-legs.js +231 -0
- package/geometry/figure-limbs.js +39 -0
- package/geometry/figure-sculpt.js +82 -0
- package/geometry/figure-skin.js +97 -0
- package/geometry/figure-skirts.js +303 -0
- package/geometry/figure-trunk.js +411 -0
- package/geometry/flier-corvid-body.js +322 -0
- package/geometry/flier-corvid-wings.js +154 -0
- package/geometry/flier-long-body.js +195 -0
- package/geometry/flier-shapes.js +219 -0
- package/geometry/flier-soaring-bird.js +84 -0
- package/geometry/foliage.js +187 -14
- package/geometry/fort-city-walls.js +479 -0
- package/geometry/fort-gate-approach.js +233 -0
- package/geometry/fort-great-walls.js +280 -0
- package/geometry/fort-keep.js +297 -0
- package/geometry/fort-parts.js +261 -0
- package/geometry/fort-polyline.js +261 -0
- package/geometry/fort-portal.js +96 -0
- package/geometry/fort-ring-wall.js +267 -0
- package/geometry/fort-seawall.js +104 -0
- package/geometry/fort-terrace-gates.js +323 -0
- package/geometry/fort-terrace-plan.js +250 -0
- package/geometry/fort-terrace-wall.js +345 -0
- package/geometry/garment-tags.js +11 -3
- package/geometry/grid-gather.js +69 -0
- package/geometry/grid-sample.js +185 -0
- package/geometry/hair-gathers.js +57 -42
- package/geometry/hair-locks.js +42 -42
- package/geometry/hair-patch.js +24 -20
- package/geometry/hair-shell.js +43 -31
- package/geometry/head-presets.js +103 -0
- package/geometry/head-profile.js +26 -15
- package/geometry/head-shape.js +123 -95
- package/geometry/heightfield.js +50 -24
- package/geometry/horizon-angles.js +166 -0
- package/geometry/house-kit-body.js +195 -0
- package/geometry/house-kit-courtyard-parts.js +340 -0
- package/geometry/house-kit-courtyard-roof.js +223 -0
- package/geometry/house-kit-courtyard.js +409 -0
- package/geometry/house-kit-cut.js +29 -0
- package/geometry/house-kit-extras.js +192 -0
- package/geometry/house-kit-forms.js +298 -0
- package/geometry/house-kit-frame.js +74 -0
- package/geometry/house-kit-marks.js +93 -0
- package/geometry/house-kit-openings.js +193 -0
- package/geometry/house-kit-palette.js +54 -0
- package/geometry/house-kit-pool.js +71 -0
- package/geometry/house-kit-roofs.js +151 -0
- package/geometry/house-kit.js +202 -0
- package/geometry/index-parts.js +2 -2
- package/geometry/instance-visibility.js +12 -12
- package/geometry/instances.js +17 -17
- package/geometry/lamp-wash.js +65 -0
- package/geometry/land-clearings.js +83 -0
- package/geometry/land-ditches.js +290 -0
- package/geometry/land-dry-basin.js +327 -0
- package/geometry/land-dunes.js +150 -0
- package/geometry/land-earthworks.js +432 -0
- package/geometry/land-edge.js +292 -0
- package/geometry/land-mound-faces.js +349 -0
- package/geometry/land-near-relief.js +102 -0
- package/geometry/land-sheet.js +220 -0
- package/geometry/land-town-ground.js +256 -0
- package/geometry/land-waters.js +228 -0
- package/geometry/land-wildness.js +123 -0
- package/geometry/lathed-vessel.js +293 -0
- package/geometry/outline-grid.js +11 -10
- package/geometry/outline-segments.js +74 -0
- package/geometry/part-ranges.js +38 -3
- package/geometry/path-field.js +98 -34
- package/geometry/placement.js +52 -52
- package/geometry/planked-floor.js +149 -0
- package/geometry/plant-broadleaf.js +268 -0
- package/geometry/plant-shrub.js +198 -0
- package/geometry/plant-tints.js +80 -0
- package/geometry/plant-trees.js +453 -0
- package/geometry/plant-tussock.js +107 -0
- package/geometry/point-buckets.js +50 -0
- package/geometry/primitives.js +117 -59
- package/geometry/prop-battlefield.js +69 -0
- package/geometry/prop-camp.js +175 -0
- package/geometry/prop-door.js +26 -0
- package/geometry/prop-harbour.js +105 -0
- package/geometry/prop-haycock.js +60 -0
- package/geometry/prop-sacks.js +74 -0
- package/geometry/prop-sheaf.js +68 -0
- package/geometry/prop-street.js +69 -0
- package/geometry/prop-tents.js +396 -0
- package/geometry/prop-tombs.js +80 -0
- package/geometry/prop-trade.js +393 -0
- package/geometry/prop-vehicles.js +218 -0
- package/geometry/props.js +58 -0
- package/geometry/room-arcade.js +134 -0
- package/geometry/room-dome.js +188 -0
- package/geometry/room-flames.js +138 -0
- package/geometry/room-frame.js +106 -0
- package/geometry/room-furniture.js +260 -0
- package/geometry/room-hearth.js +98 -0
- package/geometry/room-kit.js +59 -0
- package/geometry/room-openings.js +142 -0
- package/geometry/room-stairs.js +180 -0
- package/geometry/room-surfaces.js +272 -0
- package/geometry/sagging-tube.js +27 -27
- package/geometry/sampled-surface.js +123 -77
- package/geometry/scatter-grid.js +49 -6
- package/geometry/sculpt.js +97 -93
- package/geometry/ship-fittings.js +350 -0
- package/geometry/ship-hull.js +460 -0
- package/geometry/ship-kit.js +208 -0
- package/geometry/ship-lines.js +69 -0
- package/geometry/ship-oars.js +150 -0
- package/geometry/ship-presets.js +131 -0
- package/geometry/ship-rig.js +374 -0
- package/geometry/ship-sails.js +148 -0
- package/geometry/shore-grid.js +81 -34
- package/geometry/strata-field.js +131 -98
- package/geometry/strata-tiles.js +108 -94
- package/geometry/stream.js +96 -59
- package/geometry/swept-tube.js +124 -0
- package/geometry/terrain-chunks.js +216 -123
- package/geometry/terrain-extension.js +29 -13
- package/geometry/town-courtyard-inn.js +272 -0
- package/geometry/town-ground.js +76 -0
- package/geometry/town-houses.js +343 -0
- package/geometry/town-lights.js +254 -0
- package/geometry/town-lots.js +172 -0
- package/geometry/town-plan.js +370 -0
- package/geometry/town-works.js +465 -0
- package/geometry/village-layout.js +181 -0
- package/geometry/village-yards.js +167 -0
- package/geometry/wall-runs.js +64 -0
- package/index.js +138 -2
- package/math/cell-edge.js +16 -16
- package/math/cell-key.js +6 -0
- package/math/circle-clearances.js +19 -0
- package/math/cloth-textures.js +6 -6
- package/math/cloud-textures.js +22 -26
- package/math/color.js +14 -14
- package/math/curve.js +26 -22
- package/math/lamp-texels.js +43 -0
- package/math/lit-share.js +22 -0
- package/math/mountain-ranges.js +379 -205
- package/math/noise.js +101 -49
- package/math/particle-noise.js +28 -28
- package/math/periodic.js +11 -5
- package/math/random.js +24 -15
- package/math/rectangles.js +58 -0
- package/math/rock-texture.js +22 -17
- package/math/scalar.js +5 -5
- package/math/surface-textures.js +74 -59
- package/math/wandering-path.js +40 -0
- package/math/ways.js +120 -0
- package/motion/action-dynamics.js +398 -0
- package/motion/animal-bearing.js +247 -0
- package/motion/animal-canine-bearing.js +178 -0
- package/motion/animal-canine-cast.js +131 -0
- package/motion/animal-cattle-cast.js +64 -0
- package/motion/animal-herd-cast.js +154 -0
- package/motion/animal-horse-still.js +161 -0
- package/motion/animal-troop-cast.js +43 -0
- package/motion/arm-reach.js +27 -26
- package/motion/ballistic-arc.js +191 -0
- package/motion/biped-cycle.js +46 -0
- package/motion/biped-leg.js +40 -0
- package/motion/biped-posture.js +459 -0
- package/motion/biped-stride.js +226 -140
- package/motion/boat-sailing.js +214 -0
- package/motion/contact-transition.js +32 -0
- package/motion/crowd-alarms.js +72 -42
- package/motion/crowd-attention.js +108 -0
- package/motion/crowd-beasts.js +203 -0
- package/motion/crowd-camp.js +295 -0
- package/motion/crowd-figure.js +100 -0
- package/motion/crowd-herd.js +86 -0
- package/motion/crowd-hold.js +130 -0
- package/motion/crowd-pose.js +296 -0
- package/motion/crowd-poses.js +481 -0
- package/motion/crowd-routine.js +126 -67
- package/motion/crowd-town.js +166 -0
- package/motion/crowd-water.js +143 -0
- package/motion/daily-clock.js +9 -9
- package/motion/deck-surface.js +40 -0
- package/motion/figure-acts.js +411 -0
- package/motion/figure-arms.js +437 -0
- package/motion/figure-blade-slide.js +149 -0
- package/motion/figure-body-place.js +180 -0
- package/motion/figure-bones.js +118 -0
- package/motion/figure-bow-draw.js +70 -0
- package/motion/figure-fingers.js +215 -0
- package/motion/figure-gaze.js +205 -0
- package/motion/figure-gestures.js +452 -0
- package/motion/figure-grip.js +134 -0
- package/motion/figure-head.js +287 -0
- package/motion/figure-legs.js +264 -0
- package/motion/figure-links.js +293 -0
- package/motion/figure-locomotion.js +391 -0
- package/motion/figure-mount-up.js +180 -0
- package/motion/figure-mount.js +201 -0
- package/motion/figure-pose-frame.js +375 -0
- package/motion/figure-pose-table.js +156 -0
- package/motion/figure-pose.js +343 -0
- package/motion/figure-seat.js +267 -0
- package/motion/figure-sway.js +125 -0
- package/motion/flier-corvid-pose.js +74 -0
- package/motion/flier-flight-air.js +122 -0
- package/motion/flier-flight-echelon.js +164 -0
- package/motion/flier-flight-roost.js +131 -0
- package/motion/flier-swarm-flight.js +252 -0
- package/motion/formation.js +193 -0
- package/motion/ground-lookahead.js +5 -5
- package/motion/instance-sight.js +15 -8
- package/motion/melee-contact.js +143 -0
- package/motion/moorings.js +48 -0
- package/motion/path-steering.js +358 -0
- package/motion/player.js +41 -32
- package/motion/quadruped.js +244 -168
- package/motion/spaces.js +90 -38
- package/motion/speech-cadence.js +304 -0
- package/motion/vessel-motion.js +57 -0
- package/motion/walk-grid.js +235 -0
- package/motion/weather.js +133 -26
- package/motion/wind.js +58 -13
- package/package.json +33 -6
- package/rendering/alpha-mips.js +340 -0
- package/rendering/animal-camel-figure.js +29 -0
- package/rendering/animal-canine-figure.js +59 -0
- package/rendering/animal-cattle-figure.js +36 -0
- package/rendering/animal-horse-figure.js +49 -0
- package/rendering/atmosphere.js +86 -0
- package/rendering/camera-track.js +156 -0
- package/rendering/cart-track.js +92 -0
- package/rendering/caster-motion.js +6 -5
- package/rendering/cell-lod-options.js +46 -0
- package/rendering/cell-lod.js +754 -113
- package/rendering/cloth-material.js +140 -0
- package/rendering/cloud-dome.js +30 -30
- package/rendering/cloud-field.js +2 -2
- package/rendering/compilation-schedule.js +79 -14
- package/rendering/contact-shadows.js +7 -4
- package/rendering/context.js +57 -6
- package/rendering/crowd-batches.js +420 -0
- package/rendering/crowd-herd.js +198 -0
- package/rendering/crowd-rig.js +132 -0
- package/rendering/crowd-skinning.js +62 -19
- package/rendering/crowd-update.js +419 -0
- package/rendering/crowd-visibility.js +107 -0
- package/rendering/crust.js +18 -12
- package/rendering/day-cycle-defaults.js +200 -0
- package/rendering/day-cycle.js +487 -0
- package/rendering/daylight.js +4 -6
- package/rendering/detail-range.js +29 -0
- package/rendering/dispose-meshes.js +18 -0
- package/rendering/dof.js +20 -13
- package/rendering/effects-frame.js +149 -0
- package/rendering/effects-water-rises.js +221 -0
- package/rendering/energy-stream.js +128 -0
- package/rendering/eye-adapt.js +14 -14
- package/rendering/facade-glass-material.js +105 -0
- package/rendering/far-shadow.js +89 -62
- package/rendering/field-surface.js +138 -0
- package/rendering/figure-shield.js +105 -0
- package/rendering/figure-skeleton.js +329 -0
- package/rendering/fire-light-watch.js +197 -0
- package/rendering/fire-pools.js +148 -0
- package/rendering/flame-sources.js +86 -0
- package/rendering/flier-bird-looks.js +97 -0
- package/rendering/flier-corvid-figure.js +67 -0
- package/rendering/flier-long-body-company.js +169 -0
- package/rendering/flier-swarm.js +186 -0
- package/rendering/flocks.js +82 -78
- package/rendering/garment-material.js +147 -51
- package/rendering/glow-lines.js +13 -13
- package/rendering/glsl-literal.js +19 -0
- package/rendering/ground-marks.js +316 -0
- package/rendering/hair-strands.js +45 -31
- package/rendering/height-haze.js +80 -33
- package/rendering/height-probe.js +164 -22
- package/rendering/house-kit-meshes.js +124 -0
- package/rendering/interior-bake.js +807 -0
- package/rendering/label-layout.js +56 -0
- package/rendering/label-range.js +41 -0
- package/rendering/lamp-light-map.js +159 -0
- package/rendering/lamp-maps.js +62 -0
- package/rendering/lamp-wash.js +51 -0
- package/rendering/light-budget.js +71 -55
- package/rendering/light-points.js +21 -5
- package/rendering/local-lights.js +39 -8
- package/rendering/material-lod.js +49 -50
- package/rendering/memory-estimate.js +84 -0
- package/rendering/moored-fleet.js +186 -0
- package/rendering/part-costs.js +104 -0
- package/rendering/particle-bursts.js +386 -0
- package/rendering/particle-emitters.js +135 -99
- package/rendering/particle-light-bursts.js +189 -0
- package/rendering/particles.js +212 -101
- package/rendering/pen-flocks.js +118 -0
- package/rendering/piece-batch.js +298 -11
- package/rendering/planar-reflection-options.js +159 -0
- package/rendering/planar-reflection.js +806 -103
- package/rendering/plant-cells.js +122 -0
- package/rendering/plant-reeds.js +113 -0
- package/rendering/plant-shade-trees.js +239 -0
- package/rendering/plant-tuft-patch.js +122 -0
- package/rendering/post-shaders.js +98 -31
- package/rendering/post.js +107 -87
- package/rendering/pressed-cover.js +135 -0
- package/rendering/prop-dig.js +136 -0
- package/rendering/rain-streaks.js +67 -0
- package/rendering/room-light.js +250 -0
- package/rendering/room-materials.js +78 -0
- package/rendering/room-space.js +111 -0
- package/rendering/scene-lights.js +106 -0
- package/rendering/sea-shaders.js +94 -37
- package/rendering/settlement-approach.js +226 -0
- package/rendering/settlement-dissolve.js +89 -0
- package/rendering/settlement-quarter-warm.js +55 -0
- package/rendering/settlement-quarter.js +477 -0
- package/rendering/settlement-switch.js +42 -0
- package/rendering/settlement-town.js +110 -0
- package/rendering/shader-warmup.js +101 -44
- package/rendering/shadow-alignment.js +4 -4
- package/rendering/shadow-depth.js +47 -25
- package/rendering/ship-meshes.js +150 -0
- package/rendering/shot-cuts.js +68 -0
- package/rendering/sky-occlusion.js +56 -29
- package/rendering/sky-pmrem.js +216 -0
- package/rendering/sky.js +126 -54
- package/rendering/smoke-shadows.js +201 -0
- package/rendering/stage-framing.js +182 -0
- package/rendering/stage-lights.js +46 -39
- package/rendering/stain-material.js +74 -0
- package/rendering/static-point-shadow.js +65 -26
- package/rendering/still-casters.js +77 -27
- package/rendering/strata-material.js +12 -12
- package/rendering/stream-flow.js +10 -10
- package/rendering/street-lamps.js +166 -0
- package/rendering/sunbeam-motes.js +670 -0
- package/rendering/surface-light.js +65 -6
- package/rendering/surface-material.js +306 -0
- package/rendering/surface-projection.js +32 -0
- package/rendering/surface-snippets.js +314 -0
- package/rendering/taa.js +75 -44
- package/rendering/talus.js +15 -15
- package/rendering/terrain-rock.js +7 -7
- package/rendering/texture-fills.js +8 -8
- package/rendering/textures.js +28 -28
- package/rendering/tree-impostor.js +929 -0
- package/rendering/vehicle-train.js +92 -0
- package/rendering/viewport.js +67 -4
- package/rendering/wakes.js +24 -24
- package/rendering/water-material.js +304 -103
- package/rendering/waypoint-beacons.js +191 -0
- package/rendering/world-matrices.js +38 -40
- package/ruff.toml +20 -0
- package/runtime/cue-cursor.js +21 -0
- package/runtime/device-quality.js +13 -2
- package/runtime/device.js +73 -0
- package/runtime/diagnostic-log.js +12 -4
- package/runtime/effect-sites.js +85 -0
- package/runtime/figure-orders.js +59 -0
- package/runtime/first-use.js +36 -28
- package/runtime/foley-script.js +124 -0
- package/runtime/foley-strides.js +333 -0
- package/runtime/frame-pacing.js +47 -0
- package/runtime/frame-yield.js +18 -0
- package/runtime/gpu-timing.js +15 -11
- package/runtime/grid-cache.js +16 -6
- package/runtime/grid-rows.js +44 -5
- package/runtime/hand-over.js +47 -24
- package/runtime/land-bake.js +78 -0
- package/runtime/lazy-sets.js +105 -0
- package/runtime/pool.js +73 -17
- package/runtime/quality-fit.js +60 -28
- package/runtime/region-pass-lay.js +40 -0
- package/runtime/region-pass.js +78 -0
- package/runtime/search.js +26 -22
- package/runtime/settlement-reach.js +42 -0
- package/runtime/sound-calls.js +113 -0
- package/runtime/sound-impacts.js +297 -0
- package/runtime/sound-voices.js +194 -0
- package/runtime/soundscape.js +282 -0
- package/runtime/spatial-audio.js +79 -30
- package/runtime/steady-frames.js +221 -0
- package/runtime/withdrawable-task.js +46 -0
- package/runtime/worker.js +7 -0
- package/scripts/app-parts.mjs +118 -0
- package/scripts/bake-revisions.mjs +81 -0
- package/scripts/browser-scripts.mjs +64 -0
- package/scripts/bundle.mjs +192 -0
- package/scripts/check-app.sh +26 -0
- package/scripts/eslint-config.mjs +119 -0
- package/scripts/format.sh +92 -0
- package/scripts/keep-builds.mjs +158 -0
- package/scripts/layers.mjs +112 -0
- package/scripts/lint.sh +49 -0
- package/scripts/module-graph.mjs +123 -0
- package/scripts/pre-commit.sh +38 -0
- package/scripts/serve.py +5 -3
- package/scripts/site.mjs +358 -0
- package/scripts/test-runner.sh +42 -0
- package/scripts/vendor.mjs +221 -0
- package/scripts/verify-publish.mjs +175 -0
- package/scripts/world.mk +59 -0
- package/tools/README.md +73 -0
- package/tools/contact-sheet.cjs +137 -0
- package/tools/cpu-profile.cjs +275 -0
- package/tools/cpu-profile.test.cjs +98 -0
- package/tools/first-draws.cjs +395 -0
- package/tools/flight-guard.cjs +482 -0
- package/tools/flight-guard.test.cjs +153 -0
- package/tools/flight-profile.cjs +145 -0
- package/tools/frame-bench.cjs +336 -0
- package/tools/frame-parts.cjs +365 -0
- package/tools/ios-sim.sh +145 -0
- package/tools/load-audit.cjs +201 -0
- package/tools/look-compare.cjs +304 -0
- package/tools/look-guard.cjs +407 -0
- package/tools/look-guard.test.cjs +93 -0
- package/tools/look-stats.cjs +185 -0
- package/tools/look-stats.test.cjs +71 -0
- package/tools/memory-audit.cjs +323 -0
- package/tools/page-driver.cjs +320 -0
- package/tools/page-driver.test.cjs +219 -0
- package/tools/program-census-report.cjs +191 -0
- package/tools/program-census.cjs +465 -0
- package/tools/program-census.test.cjs +332 -0
- package/tools/remote-runner.sh +265 -0
- package/tools/runners.test.cjs +59 -0
- package/tools/scene-audit-beat.cjs +344 -0
- package/tools/scene-audit-sheet.cjs +282 -0
- package/tools/scene-audit.cjs +471 -0
- package/tools/scene-audit.test.cjs +201 -0
- package/tools/scene-batch.cjs +219 -0
- package/tools/scene-bench.cjs +149 -0
- package/tools/scene-bench.test.cjs +33 -0
- package/tools/scene-run.cjs +443 -0
- package/tools/scene-run.test.cjs +94 -0
- package/tools/servers.sh +59 -0
- package/tools/shader-arrival.cjs +316 -0
- package/tools/shader-renewal.cjs +53 -0
- package/tools/shader-renewal.test.cjs +115 -0
- package/tools/speed-guard.cjs +258 -0
- package/tools/stills.cjs +492 -0
- package/tools/stills.test.cjs +49 -0
- package/tools/turns.sh +7 -0
- package/tools/yaml.cjs +158 -0
- package/examples/viaduct.css +0 -75
- package/rendering/light-shafts.js +0 -131
- package/rendering/road-surface.js +0 -63
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cliffside and coastal fortress architecture: a flagged curtain wall-walk with pierced and weathered merlons over a
|
|
3
|
+
* corbel table, a buttressed keep citadel with an arched iron-strapped oak doorway and roof tower, and flared cylindrical
|
|
4
|
+
* flanking towers with corbel rings, multi-level slits, and optional conical roofs. Worker-safe.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as THREE from 'three';
|
|
9
|
+
import { dim } from '../math/color.js';
|
|
10
|
+
import { TAU } from '../math/scalar.js';
|
|
11
|
+
import { C as defaultColor, TRS as defaultTransform } from './primitives.js';
|
|
12
|
+
|
|
13
|
+
const OPENING = [0.012, 0.011, 0.01]; // recessed dark interior of arrow slits and doorways
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Adds a recessed arrow slit or narrow window surrounded by dressed jambs, lintel and sill facing local `+z` (rotated by `ry`).
|
|
17
|
+
* @param {object} target - Builders and masonry palette `{ stone, masonry }`.
|
|
18
|
+
* @param {number} x - Centre X in metres.
|
|
19
|
+
* @param {number} y - Sill Y in metres.
|
|
20
|
+
* @param {number} z - Wall face Z in metres.
|
|
21
|
+
* @param {number} w - Opening width in metres.
|
|
22
|
+
* @param {number} h - Opening height in metres.
|
|
23
|
+
* @param {number} ry - Outward facing yaw in radians.
|
|
24
|
+
* @param {number} [deep=0.06] - Surround projection depth in metres.
|
|
25
|
+
* @returns {void}
|
|
26
|
+
*/
|
|
27
|
+
export function addDressedSlit(target, x, y, z, w, h, ry, deep = 0.06) {
|
|
28
|
+
const { stone, masonry } = target;
|
|
29
|
+
const cs = Math.cos(ry);
|
|
30
|
+
const sn = Math.sin(ry);
|
|
31
|
+
const point = (lx, lz) => [x + lx * cs + lz * sn, z - lx * sn + lz * cs];
|
|
32
|
+
let p = point(0, 0.012);
|
|
33
|
+
stone.box(p[0], y, p[1], w, h, 0.03, OPENING, ry);
|
|
34
|
+
for (const sg of [-1, 1]) {
|
|
35
|
+
p = point(sg * (w / 2 + 0.1), deep / 2);
|
|
36
|
+
stone.box(p[0], y - 0.1, p[1], 0.2, h + 0.2, deep, masonry(1.12), ry);
|
|
37
|
+
}
|
|
38
|
+
p = point(0, deep / 2);
|
|
39
|
+
stone.box(p[0], y + h, p[1], w + 0.5, 0.2, deep + 0.02, masonry(1.15), ry);
|
|
40
|
+
stone.box(p[0], y - 0.2, p[1], w + 0.56, 0.14, deep + 0.05, masonry(1.1), ry);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Adds a parapet and crenellated merlon run along one cardinal edge (`axis = 0` along X at `offset` Z; `axis = 1` along
|
|
45
|
+
* Z at `offset` X), with occasional weathered lower merlons drawn from `rng`.
|
|
46
|
+
* @param {object} target - Builders and RNG `{ stone, rng, masonry }`.
|
|
47
|
+
* @param {number} start - Start coordinate along the run axis in metres.
|
|
48
|
+
* @param {number} end - End coordinate along the run axis in metres.
|
|
49
|
+
* @param {number} y - Base Y of the parapet in metres.
|
|
50
|
+
* @param {number} offset - Perpendicular coordinate of the parapet centreline in metres.
|
|
51
|
+
* @param {0 | 1} axis - Run axis (`0` along X, `1` along Z).
|
|
52
|
+
* @returns {void}
|
|
53
|
+
*/
|
|
54
|
+
export function addCrenelRun(target, start, end, y, offset, axis) {
|
|
55
|
+
const { stone, rng, masonry } = target;
|
|
56
|
+
const n = Math.round((end - start) / 2.5);
|
|
57
|
+
const point = (u, v) => (axis ? [offset + v, u] : [u, offset + v]);
|
|
58
|
+
const size = (a, b) => (axis ? [b, a] : [a, b]);
|
|
59
|
+
let p = point((start + end) / 2, 0);
|
|
60
|
+
let s = size(end - start, 0.8);
|
|
61
|
+
stone.box(p[0], y, p[1], s[0], 0.95, s[1], masonry(0.97));
|
|
62
|
+
for (let i = 0; i < n; i++) {
|
|
63
|
+
const u = start + ((i + 0.5) * (end - start)) / n;
|
|
64
|
+
p = point(u, 0);
|
|
65
|
+
s = size(1.5, 0.8);
|
|
66
|
+
stone.box(p[0], y + 0.95, p[1], s[0], rng() < 0.07 ? 0.4 : 1.0, s[1], masonry());
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Builds a fortress curtain wall and flagged wall-walk: coursed flagstones, breast wall with coping, loop-pierced
|
|
72
|
+
* merlons (some broken with fallen rock), and a double-tiered corbel table below the parapet.
|
|
73
|
+
* @param {object} target - Fortress context `{ walkY, stone, flags, rng, masonry }`.
|
|
74
|
+
* @param {object} [options] - Unit shapes, transform and colour helper.
|
|
75
|
+
* @param {object} options.shapes - Unit shapes (`{ rock }`).
|
|
76
|
+
* @param {(hex: number, jitter?: number, rng?: () => number) => number[]} [options.color] - Linear RGB colour helper.
|
|
77
|
+
* @param {Function} [options.transform] - Transform matrix helper (`TRS`).
|
|
78
|
+
* @returns {void}
|
|
79
|
+
*/
|
|
80
|
+
export function buildFlaggedWallWalk(target, { shapes, color = defaultColor, transform = defaultTransform }) {
|
|
81
|
+
const { walkY, stone, flags, rng, masonry } = target;
|
|
82
|
+
stone.box(0, 57, -0.4, 67, 12.93, 10.6, masonry(0.82));
|
|
83
|
+
for (let r = 0; r < 8; r++) {
|
|
84
|
+
const z0 = -4.9 + r * 1.125;
|
|
85
|
+
let x = -33.5 - rng() * 0.7;
|
|
86
|
+
while (x < 33.5) {
|
|
87
|
+
const l = Math.min(0.85 + rng() * 1.1, 33.5 - x);
|
|
88
|
+
flags.box(
|
|
89
|
+
x + l / 2,
|
|
90
|
+
69.93 + (rng() - 0.5) * 0.014,
|
|
91
|
+
z0 + 0.5625,
|
|
92
|
+
l - 0.028,
|
|
93
|
+
0.07,
|
|
94
|
+
1.097,
|
|
95
|
+
dim(color(0x6e695f, 0.12, rng), rng() < 0.08 ? 0.7 : 1),
|
|
96
|
+
);
|
|
97
|
+
x += l;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
stone.box(0, walkY, 4.5, 67, 1.02, 0.8, masonry(0.95));
|
|
101
|
+
stone.box(0, walkY + 1.02, 4.5, 67, 0.075, 0.95, masonry(1.1));
|
|
102
|
+
for (let k = -13; k <= 12; k++) {
|
|
103
|
+
const x = k * 2.5 + 1.25;
|
|
104
|
+
const broken = rng() < 0.1 && (k < 0 || k > 4);
|
|
105
|
+
const h = broken ? 0.35 + rng() * 0.25 : 0.88;
|
|
106
|
+
const y0 = walkY + 1.095;
|
|
107
|
+
if (k % 2 === 0 && !broken) {
|
|
108
|
+
for (const sg of [-1, 1]) stone.box(x + sg * 0.375, y0, 4.5, 0.55, h, 0.8, masonry());
|
|
109
|
+
stone.box(x, y0 + h - 0.2, 4.5, 0.2, 0.2, 0.8, masonry(0.9));
|
|
110
|
+
stone.box(x, y0, 4.5, 0.2, 0.16, 0.8, masonry(0.9));
|
|
111
|
+
stone.box(x, y0 + 0.16, 4.62, 0.2, h - 0.36, 0.5, OPENING);
|
|
112
|
+
} else stone.box(x, y0, 4.5, 1.3, h, 0.8, masonry());
|
|
113
|
+
if (!broken) stone.box(x, y0 + h, 4.5, 1.42, 0.09, 0.94, masonry(1.12));
|
|
114
|
+
else stone.add(shapes.rock, masonry(0.9), transform(x + 0.3, y0 + h - 0.05, 4.45, 0.5, 0.3, 0.45, rng() * 3));
|
|
115
|
+
}
|
|
116
|
+
for (let x = -32.5; x <= 32.5; x += 1.25) {
|
|
117
|
+
stone.box(x, walkY - 0.62, 5.06, 0.42, 0.62, 0.42, masonry(0.8));
|
|
118
|
+
stone.box(x, walkY - 1.0, 4.98, 0.42, 0.4, 0.24, masonry(0.74));
|
|
119
|
+
}
|
|
120
|
+
stone.box(0, walkY - 0.02, 5.05, 67, 0.1, 0.46, masonry(0.9));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Adds a recessed planked oak doorway under a voussoir round arch with iron hinge straps, ring handle, jambs, and two
|
|
125
|
+
* threshold steps.
|
|
126
|
+
* @param {object} target - Fortress context `{ walkY, stone, wood, iron, rng, masonry }`.
|
|
127
|
+
* @param {object} options - Placement and unit shapes.
|
|
128
|
+
* @param {object} options.shapes - Unit shapes (`{ cyl6 }`).
|
|
129
|
+
* @param {number} [options.x=-10.375] - Door centre X in metres.
|
|
130
|
+
* @param {number} [options.z=-4.9] - Wall face Z in metres.
|
|
131
|
+
* @param {(hex: number, jitter?: number, rng?: () => number) => number[]} [options.color] - Linear RGB colour helper.
|
|
132
|
+
* @param {Function} [options.transform] - Transform matrix helper (`TRS`).
|
|
133
|
+
* @returns {void}
|
|
134
|
+
*/
|
|
135
|
+
export function buildArchedKeepDoor(target, { shapes, x = -10.375, z = -4.9, color = defaultColor, transform = defaultTransform }) {
|
|
136
|
+
const { walkY, stone, wood, iron, rng, masonry } = target;
|
|
137
|
+
const y = walkY;
|
|
138
|
+
stone.box(x, y, z + 0.02, 1.7, 2.3, 0.04, OPENING);
|
|
139
|
+
stone.box(x, y + 2.3, z + 0.03, 1.7, 0.86, 0.06, masonry(0.6));
|
|
140
|
+
wood.box(x, y + 0.3, z + 0.08, 1.56, 2.02, 0.1, color(0x241a12));
|
|
141
|
+
for (let i = 0; i < 6; i++) wood.box(x - 0.65 + i * 0.26, y + 0.3, z + 0.14, 0.235, 2.0, 0.03, color(0x2c2016, 0.2, rng));
|
|
142
|
+
for (const yy of [0.62, 1.3, 1.98]) iron.box(x, y + yy, z + 0.16, 1.5, 0.09, 0.025, [0.03, 0.03, 0.032]);
|
|
143
|
+
iron.add(shapes.cyl6, [0.04, 0.04, 0.042], transform(x + 0.52, y + 1.3, z + 0.2, 0.16, 0.03, 0.16, 0, Math.PI / 2));
|
|
144
|
+
for (const sg of [-1, 1]) stone.box(x + sg * 1.03, y, z + 0.14, 0.38, 2.3, 0.3, masonry(1.1));
|
|
145
|
+
for (let i = 0; i <= 8; i++) {
|
|
146
|
+
const a = (i / 8) * Math.PI;
|
|
147
|
+
stone.box(
|
|
148
|
+
x + Math.cos(a) * 0.86,
|
|
149
|
+
y + 2.3 + Math.sin(a) * 0.86,
|
|
150
|
+
z + 0.14,
|
|
151
|
+
0.36,
|
|
152
|
+
0.36,
|
|
153
|
+
0.3,
|
|
154
|
+
masonry(i === 4 ? 1.2 : 1.08),
|
|
155
|
+
0,
|
|
156
|
+
0,
|
|
157
|
+
a - Math.PI / 2,
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
stone.box(x, y, z + 0.42, 2.7, 0.3, 0.6, masonry(0.88));
|
|
161
|
+
stone.box(x, y, z + 0.9, 3.1, 0.15, 0.5, masonry(0.9));
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Builds the buttressed citadel block rising behind a wall-walk, its arched doorway, corbelled crenellations, square
|
|
166
|
+
* roof keep tower, and yard-enclosing return walls.
|
|
167
|
+
* @param {object} target - Fortress context `{ walkY, stone, wood, iron, rng, masonry }`.
|
|
168
|
+
* @param {object} options - Unit shapes, colour and transform helpers.
|
|
169
|
+
* @param {object} options.shapes - Unit shapes (`{ cyl6 }`).
|
|
170
|
+
* @param {(hex: number, jitter?: number, rng?: () => number) => number[]} [options.color] - Linear RGB colour helper.
|
|
171
|
+
* @param {Function} [options.transform] - Transform matrix helper (`TRS`).
|
|
172
|
+
* @returns {void}
|
|
173
|
+
*/
|
|
174
|
+
export function buildKeepCitadel(target, { shapes, color = defaultColor, transform = defaultTransform }) {
|
|
175
|
+
const { walkY, stone, masonry } = target;
|
|
176
|
+
stone.box(-5.75, 57, -17.45, 55.5, 28, 25.1, masonry(0.9));
|
|
177
|
+
stone.box(27.75, 57, -6.6, 11.5, 25, 3.4, masonry(0.9));
|
|
178
|
+
stone.box(-5.75, walkY, -4.72, 55.5, 1.1, 0.36, masonry(0.78));
|
|
179
|
+
stone.box(-5.75, walkY + 1.1, -4.81, 55.5, 0.14, 0.18, masonry(0.95));
|
|
180
|
+
stone.box(27.75, walkY, -4.76, 11.5, 0.9, 0.28, masonry(0.78));
|
|
181
|
+
stone.box(-5.75, walkY + 10, -4.8, 55.5, 0.3, 0.2, masonry(1.05));
|
|
182
|
+
for (let i = 0; i < 7; i++) {
|
|
183
|
+
const x = -31 + i * 8.25;
|
|
184
|
+
stone.box(x, walkY, -4.62, 1.3, 9.2, 0.56, masonry(0.96));
|
|
185
|
+
stone.box(x, walkY + 9.2, -4.71, 1.3, 0.45, 0.38, masonry(1.04));
|
|
186
|
+
stone.box(x, walkY + 9.65, -4.8, 1.3, 0.4, 0.2, masonry(1.04));
|
|
187
|
+
if (i < 6 && i !== 2) {
|
|
188
|
+
addDressedSlit(target, x + 4.125, walkY + 3.0, -4.9, 0.2, 1.7, 0);
|
|
189
|
+
addDressedSlit(target, x + 4.125, walkY + 11.0, -4.9, 0.5, 1.1, 0, 0.08);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
addDressedSlit(target, 26, walkY + 3.0, -4.9, 0.2, 1.7, 0);
|
|
193
|
+
addDressedSlit(target, 30, walkY + 3.0, -4.9, 0.2, 1.7, 0);
|
|
194
|
+
buildArchedKeepDoor(target, { shapes, color, transform });
|
|
195
|
+
for (let x = -33; x <= 21.5; x += 1.25) {
|
|
196
|
+
stone.box(x, walkY + 14.1, -4.64, 0.45, 0.9, 0.52, masonry(0.8));
|
|
197
|
+
stone.box(x, walkY + 13.6, -4.76, 0.45, 0.5, 0.28, masonry(0.75));
|
|
198
|
+
}
|
|
199
|
+
addCrenelRun(target, -33.5, 22, walkY + 15, -4.8, 0);
|
|
200
|
+
addCrenelRun(target, 22, 33.5, walkY + 12, -5.3, 0);
|
|
201
|
+
addCrenelRun(target, -30, -5, walkY + 15, 21.6, 1);
|
|
202
|
+
addCrenelRun(target, -33.5, 22, walkY + 15, -30.1, 0);
|
|
203
|
+
stone.box(-2, walkY + 15, -19, 11, 16, 11, masonry(0.94));
|
|
204
|
+
stone.box(-2, walkY + 30.2, -19, 12.2, 0.8, 12.2, masonry(0.86));
|
|
205
|
+
addCrenelRun(target, -8.1, 4.1, walkY + 31, -13.3, 0);
|
|
206
|
+
addCrenelRun(target, -8.1, 4.1, walkY + 31, -24.7, 0);
|
|
207
|
+
addCrenelRun(target, -24.7, -13.3, walkY + 31, -7.7, 1);
|
|
208
|
+
addCrenelRun(target, -24.7, -13.3, walkY + 31, 3.7, 1);
|
|
209
|
+
for (const yy of [19, 25]) {
|
|
210
|
+
addDressedSlit(target, -2, walkY + yy, -13.5, 0.22, 1.6, 0);
|
|
211
|
+
addDressedSlit(target, 3.5, walkY + yy, -19, 0.22, 1.6, Math.PI / 2);
|
|
212
|
+
addDressedSlit(target, -7.5, walkY + yy, -19, 0.22, 1.6, -Math.PI / 2);
|
|
213
|
+
}
|
|
214
|
+
stone.box(-37, 57, -40, 3.2, 22, 62, masonry(0.86));
|
|
215
|
+
stone.box(38, 57, -38, 3.2, 20, 60, masonry(0.86));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Adds a tall flared cylindrical tower with a 28-corbel ring, crenellated parapet, multi-level arrow slits, and an
|
|
220
|
+
* optional conical slate roof with iron finial and eaves windows.
|
|
221
|
+
* @param {object} target - Fortress context `{ stone, iron, masonry }`.
|
|
222
|
+
* @param {object} towerShapes - 28-sided unit geometries `{ cyl28, cyl28Flared, cone28 }`.
|
|
223
|
+
* @param {object} spec - Tower dimensions and placement in metres.
|
|
224
|
+
* @param {number} spec.x - Centre X in metres.
|
|
225
|
+
* @param {number} spec.z - Centre Z in metres.
|
|
226
|
+
* @param {number} spec.radius - Shaft top radius in metres.
|
|
227
|
+
* @param {number} spec.y0 - Foundation bottom Y in metres.
|
|
228
|
+
* @param {number} spec.y1 - Parapet base Y in metres.
|
|
229
|
+
* @param {boolean} [spec.roof=false] - Add conical roof, finial and eaves windows.
|
|
230
|
+
* @param {object} options - Unit shapes and transform helper.
|
|
231
|
+
* @param {object} options.shapes - Unit shapes (`{ cyl6 }`).
|
|
232
|
+
* @param {Function} [options.transform] - Transform matrix helper (`TRS`).
|
|
233
|
+
* @returns {void}
|
|
234
|
+
*/
|
|
235
|
+
export function buildFlaredRoundTower(
|
|
236
|
+
target,
|
|
237
|
+
towerShapes,
|
|
238
|
+
{ x: cx, z: cz, radius, y0, y1, roof = false },
|
|
239
|
+
{ shapes, transform = defaultTransform },
|
|
240
|
+
) {
|
|
241
|
+
const { stone, iron, masonry } = target;
|
|
242
|
+
const { cyl28, cyl28Flared, cone28 } = towerShapes;
|
|
243
|
+
stone.add(cyl28Flared, masonry(0.92), transform(cx, y0, cz, radius * 2, y1 - y0, radius * 2));
|
|
244
|
+
for (let i = 0; i < 28; i++) {
|
|
245
|
+
const a = (i / 28) * TAU;
|
|
246
|
+
stone.box(cx + Math.sin(a) * (radius + 0.2), y1 - 1.5, cz + Math.cos(a) * (radius + 0.2), 0.6, 1.5, 0.75, masonry(0.8), a);
|
|
247
|
+
}
|
|
248
|
+
stone.add(cyl28, masonry(0.97), transform(cx, y1, cz, radius * 2 + 1.5, 1.0, radius * 2 + 1.5));
|
|
249
|
+
const nm = Math.round(radius * 2.1);
|
|
250
|
+
for (let i = 0; i < nm; i++) {
|
|
251
|
+
const a = ((i + 0.5) / nm) * TAU;
|
|
252
|
+
stone.box(cx + Math.sin(a) * (radius + 0.42), y1 + 1.0, cz + Math.cos(a) * (radius + 0.42), 1.45, 1.05, 0.6, masonry(), a);
|
|
253
|
+
}
|
|
254
|
+
for (let lv = 0; lv < Math.floor((y1 - 76) / 8); lv++)
|
|
255
|
+
for (let i = 0; i < 5; i++) {
|
|
256
|
+
const a = ((i + (lv % 2) * 0.5) / 5) * TAU + 0.4;
|
|
257
|
+
const rr = radius * (1 + 0.1 * (1 - (76 + lv * 8 - y0) / (y1 - y0))) + 0.01;
|
|
258
|
+
addDressedSlit(target, cx + Math.sin(a) * rr, 74 + lv * 8, cz + Math.cos(a) * rr, 0.2, 1.7, a);
|
|
259
|
+
}
|
|
260
|
+
if (roof) {
|
|
261
|
+
stone.add(cyl28, masonry(0.9), transform(cx, y1 + 1.0, cz, radius * 2 - 1.6, 1.6, radius * 2 - 1.6));
|
|
262
|
+
stone.add(cone28, [0.085, 0.095, 0.115], transform(cx, y1 + 2.6, cz, radius * 2 - 0.6, radius * 1.65, radius * 2 - 0.6));
|
|
263
|
+
iron.add(shapes.cyl6, [0.03, 0.03, 0.032], transform(cx, y1 + 2.4 + radius * 1.65, cz, 0.12, 1.6, 0.12));
|
|
264
|
+
for (let i = 0; i < 6; i++) {
|
|
265
|
+
const a = (i / 6) * TAU + 0.2;
|
|
266
|
+
stone.box(
|
|
267
|
+
cx + Math.sin(a) * (radius + 0.03),
|
|
268
|
+
y1 - 5.2,
|
|
269
|
+
cz + Math.cos(a) * (radius + 0.03),
|
|
270
|
+
0.55,
|
|
271
|
+
0.85,
|
|
272
|
+
0.05,
|
|
273
|
+
[0.05, 0.065, 0.075],
|
|
274
|
+
a,
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Builds one or more flared cylindrical fortress towers from a list of tower specs using shared 28-sided unit cylinders
|
|
282
|
+
* and cones.
|
|
283
|
+
* @param {object} target - Fortress context `{ stone, iron, masonry }`.
|
|
284
|
+
* @param {Array<{ x: number, z: number, radius: number, y0: number, y1: number, roof?: boolean }>} specs - Tower list.
|
|
285
|
+
* @param {object} options - Unit shapes and transform helper.
|
|
286
|
+
* @param {object} options.shapes - Unit shapes (`{ cyl6 }`).
|
|
287
|
+
* @param {Function} [options.transform] - Transform matrix helper (`TRS`).
|
|
288
|
+
* @returns {void}
|
|
289
|
+
*/
|
|
290
|
+
export function buildKeepTowers(target, specs, { shapes, transform = defaultTransform }) {
|
|
291
|
+
const towerShapes = {
|
|
292
|
+
cyl28: new THREE.CylinderGeometry(0.5, 0.5, 1, 28).translate(0, 0.5, 0),
|
|
293
|
+
cyl28Flared: new THREE.CylinderGeometry(0.5, 0.55, 1, 28).translate(0, 0.5, 0),
|
|
294
|
+
cone28: new THREE.ConeGeometry(0.5, 1, 28).translate(0, 0.5, 0),
|
|
295
|
+
};
|
|
296
|
+
for (const spec of specs) buildFlaredRoundTower(target, towerShapes, spec, { shapes, transform });
|
|
297
|
+
}
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared procedural fortification building blocks: radial and linear merlon rows, round towers with battered bases and
|
|
3
|
+
* corbelled heads, town-frame battlements, iron portcullis lattices, sloped walkable ramp decks, and polyline gate framing.
|
|
4
|
+
* Worker-safe: uses only geometry builders and unit transforms, with no DOM or WebGL globals.
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { dim } from '../math/color.js';
|
|
9
|
+
import { TAU } from '../math/scalar.js';
|
|
10
|
+
import { TRS } from './primitives.js';
|
|
11
|
+
|
|
12
|
+
const DEFAULT_LOOP_COLOR = [0.03, 0.028, 0.025];
|
|
13
|
+
const DEFAULT_IRON_COLOR = [0.05, 0.048, 0.045];
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Adds a ring of radial merlons around a circular tower top.
|
|
17
|
+
* @param {object} builder - Target geometry builder (`GeometryBuilder`).
|
|
18
|
+
* @param {number} x - Tower centre X in metres.
|
|
19
|
+
* @param {number} y - Base Y of the merlons in metres.
|
|
20
|
+
* @param {number} z - Tower centre Z in metres.
|
|
21
|
+
* @param {number} radius - Radial distance from centre to each merlon's middle in metres.
|
|
22
|
+
* @param {number} count - Number of merlons evenly spaced around the circle.
|
|
23
|
+
* @param {number} width - Merlon width tangent to the circle in metres.
|
|
24
|
+
* @param {number} height - Merlon height in metres.
|
|
25
|
+
* @param {number} depth - Merlon radial thickness in metres.
|
|
26
|
+
* @param {number[]} color - Linear RGB colour `[r, g, b]`.
|
|
27
|
+
* @param {object} [options] - Optional angle calculation mode.
|
|
28
|
+
* @param {boolean} [options.scaleFirst=false] - Compute `(k * TAU) / count` instead of `(k / count) * TAU`.
|
|
29
|
+
* @returns {void}
|
|
30
|
+
*/
|
|
31
|
+
export function addRadialMerlons(builder, x, y, z, radius, count, width, height, depth, color, { scaleFirst = false } = {}) {
|
|
32
|
+
for (let k = 0; k < count; k++) {
|
|
33
|
+
const angle = scaleFirst ? (k * TAU) / count : (k / count) * TAU;
|
|
34
|
+
builder.box(x + Math.cos(angle) * radius, y, z + Math.sin(angle) * radius, width, height, depth, color, Math.PI / 2 - angle);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Adds a straight row of evenly spaced merlons centred along the local X axis.
|
|
40
|
+
* @param {object} builder - Target geometry builder (`GeometryBuilder`).
|
|
41
|
+
* @param {number} length - Total span length in metres.
|
|
42
|
+
* @param {number} y - Base Y of the merlons in metres.
|
|
43
|
+
* @param {number} z - Local Z coordinate of the merlon line in metres.
|
|
44
|
+
* @param {number} color - Linear RGB colour `[r, g, b]`.
|
|
45
|
+
* @param {object} [options] - Merlon dimensions in metres.
|
|
46
|
+
* @param {number} [options.width=1.5] - Individual merlon width in metres.
|
|
47
|
+
* @param {number} [options.height=0.9] - Individual merlon height in metres.
|
|
48
|
+
* @param {number} [options.depth=0.6] - Individual merlon thickness in metres.
|
|
49
|
+
* @param {number} [options.step] - Centre-to-centre spacing in metres (defaults to `width * 2`).
|
|
50
|
+
* @returns {void}
|
|
51
|
+
*/
|
|
52
|
+
export function addMerlonRow(builder, length, y, z, color, { width = 1.5, height = 0.9, depth = 0.6, step = width * 2 } = {}) {
|
|
53
|
+
for (let x = -length / 2 + width / 2; x < length / 2; x += step) builder.box(x, y, z, width, height, depth, color);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Adds a cylindrical masonry tower with a battered plinth, shaft, corbelled parapet ring, radial merlons, and optional
|
|
58
|
+
* arrow loops.
|
|
59
|
+
* @param {object} builder - Target geometry builder (`GeometryBuilder`).
|
|
60
|
+
* @param {object} options - Tower placement, dimensions (in metres), shapes and shading.
|
|
61
|
+
* @param {number} options.x - Centre X in metres.
|
|
62
|
+
* @param {number} [options.y=0] - Ground height Y in metres.
|
|
63
|
+
* @param {number} options.z - Centre Z in metres.
|
|
64
|
+
* @param {number} options.diameter - Shaft diameter in metres.
|
|
65
|
+
* @param {number} options.height - Shaft height above `y` in metres.
|
|
66
|
+
* @param {number} [options.deep=3] - Foundation depth below `y` in metres.
|
|
67
|
+
* @param {number[]} options.color - Base linear RGB stone colour `[r, g, b]`.
|
|
68
|
+
* @param {object} options.cylinder - Unit cylinder geometry (e.g. `shapes.cyl16`).
|
|
69
|
+
* @param {Function} [options.transform=TRS] - Matrix builder `TRS(x, y, z, sx, sy, sz, ry)`.
|
|
70
|
+
* @param {number} [options.footTint=0.9] - Brightness multiplier on the battered foot.
|
|
71
|
+
* @param {number} [options.footOver=1] - Extra diameter of the battered foot in metres.
|
|
72
|
+
* @param {number} [options.footRise=1.4] - Height of the battered foot above `y` in metres.
|
|
73
|
+
* @param {number} [options.shaftTint=0.96] - Brightness multiplier on the tower shaft (`1` uses `color` verbatim).
|
|
74
|
+
* @param {number} [options.headOver=0.8] - Extra diameter of the corbelled head ring in metres.
|
|
75
|
+
* @param {number} [options.headHeight=0.6] - Thickness of the corbelled head ring in metres.
|
|
76
|
+
* @param {number} [options.headDrop=0.3] - Vertical drop of the head ring below `y + height` in metres.
|
|
77
|
+
* @param {number} [options.merlonPitch=2.3] - Circumferential pitch between merlons in metres.
|
|
78
|
+
* @param {boolean} [options.merlonFromShaft=false] - Compute merlon count from shaft diameter rather than head diameter.
|
|
79
|
+
* @param {number} [options.merlonInset=0.3] - Inward offset of merlons from ring outer radius in metres.
|
|
80
|
+
* @param {number} [options.merlonWidth=1.2] - Merlon width in metres.
|
|
81
|
+
* @param {number} [options.merlonHeight=1.1] - Merlon height in metres.
|
|
82
|
+
* @param {number} [options.merlonDepth=0.6] - Merlon depth in metres.
|
|
83
|
+
* @param {number} [options.merlonRise=0.3] - Height of merlon bases above `y + height` in metres.
|
|
84
|
+
* @param {number} [options.loops=0] - Number of arrow loops placed around the waist (`0` for none).
|
|
85
|
+
* @param {number} [options.loopPhase=0.4] - Starting azimuth offset of the arrow loops in radians.
|
|
86
|
+
* @param {number[]} [options.loopColor] - Linear RGB colour of arrow loop openings.
|
|
87
|
+
* @returns {void}
|
|
88
|
+
*/
|
|
89
|
+
export function addRoundTower(
|
|
90
|
+
builder,
|
|
91
|
+
{
|
|
92
|
+
x,
|
|
93
|
+
y = 0,
|
|
94
|
+
z,
|
|
95
|
+
diameter,
|
|
96
|
+
height,
|
|
97
|
+
deep = 3,
|
|
98
|
+
color,
|
|
99
|
+
cylinder,
|
|
100
|
+
transform = TRS,
|
|
101
|
+
footTint = 0.9,
|
|
102
|
+
footOver = 1,
|
|
103
|
+
footRise = 1.4,
|
|
104
|
+
shaftTint = 0.96,
|
|
105
|
+
headTint = 1.06,
|
|
106
|
+
headOver = 0.8,
|
|
107
|
+
headHeight = 0.6,
|
|
108
|
+
headDrop = 0.3,
|
|
109
|
+
merlonPitch = 2.3,
|
|
110
|
+
merlonFromShaft = false,
|
|
111
|
+
merlonInset = 0.3,
|
|
112
|
+
merlonWidth = 1.2,
|
|
113
|
+
merlonHeight = 1.1,
|
|
114
|
+
merlonDepth = 0.6,
|
|
115
|
+
merlonRise = 0.3,
|
|
116
|
+
loops = 0,
|
|
117
|
+
loopPhase = 0.4,
|
|
118
|
+
loopColor = DEFAULT_LOOP_COLOR,
|
|
119
|
+
},
|
|
120
|
+
) {
|
|
121
|
+
const head = diameter + headOver;
|
|
122
|
+
const ringDiameter = merlonFromShaft ? diameter : head;
|
|
123
|
+
const merlonCount = Math.round((Math.PI * ringDiameter) / merlonPitch);
|
|
124
|
+
builder.add(cylinder, dim(color, footTint), transform(x, y - deep, z, diameter + footOver, deep + footRise, diameter + footOver));
|
|
125
|
+
builder.add(cylinder, shaftTint === 1 ? color : dim(color, shaftTint), transform(x, y, z, diameter, height, diameter));
|
|
126
|
+
builder.add(cylinder, dim(color, headTint), transform(x, y + height - headDrop, z, head, headHeight, head));
|
|
127
|
+
addRadialMerlons(
|
|
128
|
+
builder,
|
|
129
|
+
x,
|
|
130
|
+
y + height + merlonRise,
|
|
131
|
+
z,
|
|
132
|
+
ringDiameter / 2 - merlonInset,
|
|
133
|
+
merlonCount,
|
|
134
|
+
merlonWidth,
|
|
135
|
+
merlonHeight,
|
|
136
|
+
merlonDepth,
|
|
137
|
+
color,
|
|
138
|
+
);
|
|
139
|
+
for (let k = 0; k < loops; k++) {
|
|
140
|
+
const angle = (k / loops) * Math.PI * 2 + loopPhase;
|
|
141
|
+
builder.box(
|
|
142
|
+
x + Math.cos(angle) * (diameter / 2),
|
|
143
|
+
y + height * 0.62,
|
|
144
|
+
z + Math.sin(angle) * (diameter / 2),
|
|
145
|
+
0.5,
|
|
146
|
+
1.5,
|
|
147
|
+
0.12,
|
|
148
|
+
loopColor,
|
|
149
|
+
Math.PI / 2 - angle,
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Adds a battlement (breast-high parapet plus capped merlons with alternating stone shades) along a segment from
|
|
156
|
+
* `(u0, v0)` to `(u1, v1)` in a town frame where local Z equals `-v`.
|
|
157
|
+
* @param {object} builder - Target stone geometry builder (`GeometryBuilder`).
|
|
158
|
+
* @param {number} u0 - Start U coordinate in metres.
|
|
159
|
+
* @param {number} v0 - Start V coordinate in metres.
|
|
160
|
+
* @param {number} u1 - End U coordinate in metres.
|
|
161
|
+
* @param {number} v1 - End V coordinate in metres.
|
|
162
|
+
* @param {number} y - Base Y of the parapet in metres.
|
|
163
|
+
* @param {number[]} color - Base linear RGB stone colour `[r, g, b]`.
|
|
164
|
+
* @param {object} [options] - Optional parapet and merlon proportions in metres.
|
|
165
|
+
* @param {number} [options.parapet=1.05] - Height of the continuous breast wall in metres.
|
|
166
|
+
* @param {number} [options.merlon=0.95] - Height of each merlon above the breast wall in metres.
|
|
167
|
+
* @param {number} [options.pitch=2.4] - Target centre-to-centre merlon pitch in metres.
|
|
168
|
+
* @param {number} [options.thick=0.62] - Thickness of parapet and merlons in metres.
|
|
169
|
+
* @returns {void}
|
|
170
|
+
*/
|
|
171
|
+
export function addBattlement(builder, u0, v0, u1, v1, y, color, { parapet = 1.05, merlon = 0.95, pitch = 2.4, thick = 0.62 } = {}) {
|
|
172
|
+
const len = Math.hypot(u1 - u0, v1 - v0);
|
|
173
|
+
const ang = Math.atan2(v1 - v0, u1 - u0);
|
|
174
|
+
const count = Math.max(1, Math.round(len / pitch));
|
|
175
|
+
builder.box((u0 + u1) / 2, y, -(v0 + v1) / 2, len, parapet, thick, dim(color, 1.02), ang);
|
|
176
|
+
for (let i = 0; i < count; i++) {
|
|
177
|
+
const t = (i + 0.5) / count;
|
|
178
|
+
const u = u0 + (u1 - u0) * t;
|
|
179
|
+
const v = v0 + (v1 - v0) * t;
|
|
180
|
+
builder.box(u, y + parapet, -v, (len / count) * 0.58, merlon, thick, dim(color, 0.97 + 0.06 * (i % 2)), ang);
|
|
181
|
+
builder.box(u, y + parapet + merlon, -v, (len / count) * 0.58 + 0.12, 0.12, thick + 0.12, dim(color, 1.08), ang);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Adds an iron portcullis lattice across a gate passage.
|
|
187
|
+
* @param {object} builder - Target geometry builder (`GeometryBuilder`).
|
|
188
|
+
* @param {object} options - Placement and lattice dimensions in metres.
|
|
189
|
+
* @param {(along: number, out: number) => [number, number]} options.at - Maps `(along, out)` to `(u, v)` in a town frame (`z = -v`).
|
|
190
|
+
* @param {number} options.along - Centre coordinate along the wall in metres.
|
|
191
|
+
* @param {number} options.out - Offset perpendicular to the wall in metres.
|
|
192
|
+
* @param {number} options.angle - Yaw rotation in radians.
|
|
193
|
+
* @param {number} options.y - Passage floor height in metres.
|
|
194
|
+
* @param {number} options.width - Clear passage width in metres.
|
|
195
|
+
* @param {number} options.height - Passage ceiling height above `y` in metres.
|
|
196
|
+
* @param {number} options.grille - Bottom clearance of the raised portcullis above `y` in metres.
|
|
197
|
+
* @param {number[]} [options.color] - Linear RGB iron colour.
|
|
198
|
+
* @returns {void}
|
|
199
|
+
*/
|
|
200
|
+
export function addPortcullis(builder, { at, along, out, angle, y, width, height, grille, color = DEFAULT_IRON_COLOR }) {
|
|
201
|
+
const bars = Math.round(width / 0.52);
|
|
202
|
+
for (let i = 0; i <= bars; i++) {
|
|
203
|
+
const [bu, bv] = at(along - width / 2 + 0.2 + ((width - 0.4) * i) / bars, out);
|
|
204
|
+
builder.box(bu, y + grille - 0.3, -bv, 0.11, height - grille + 0.5, 0.11, color, angle);
|
|
205
|
+
}
|
|
206
|
+
const [bu, bv] = at(along, out);
|
|
207
|
+
for (let hy = y + grille + 0.1; hy < y + height; hy += 0.52) builder.box(bu, hy, -bv, width - 0.4, 0.1, 0.13, color, angle);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Appends a sloped walkable deck from `(u0, v0)` at height `y0` to `(u1, v1)` at height `y1` in a town frame.
|
|
212
|
+
* @param {object[]} decks - Space deck array to push into.
|
|
213
|
+
* @param {(u: number, v: number) => [number, number]} world - Maps town `(u, v)` to world `[x, z]`.
|
|
214
|
+
* @param {number} u0 - Start U in metres.
|
|
215
|
+
* @param {number} v0 - Start V in metres.
|
|
216
|
+
* @param {number} u1 - End U in metres.
|
|
217
|
+
* @param {number} v1 - End V in metres.
|
|
218
|
+
* @param {number} y0 - Start elevation in metres.
|
|
219
|
+
* @param {number} y1 - End elevation in metres.
|
|
220
|
+
* @param {number} width - Walkable deck width in metres.
|
|
221
|
+
* @returns {void}
|
|
222
|
+
*/
|
|
223
|
+
export function addRampDeck(decks, world, u0, v0, u1, v1, y0, y1, width) {
|
|
224
|
+
const [x0, z0] = world(u0, v0);
|
|
225
|
+
const [x1, z1] = world(u1, v1);
|
|
226
|
+
const run = Math.hypot(x1 - x0, z1 - z0);
|
|
227
|
+
decks.push({
|
|
228
|
+
x: (x0 + x1) / 2,
|
|
229
|
+
z: (z0 + z1) / 2,
|
|
230
|
+
hx: width / 2,
|
|
231
|
+
hz: run / 2,
|
|
232
|
+
c: (z1 - z0) / run, // local Z runs up the slope
|
|
233
|
+
s: (x1 - x0) / run,
|
|
234
|
+
y: (y0 + y1) / 2,
|
|
235
|
+
k: (y1 - y0) / run,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Projects each gate specification onto the nearest segment of a polyline curtain wall, returning each gate's snapped
|
|
241
|
+
* position, segment index, distance along that segment, tangent `(ux, uz)` and outward normal `(nx, nz)`.
|
|
242
|
+
* @param {Array<[number, number]>} wall - Ordered wall vertices `[x, z]` in metres.
|
|
243
|
+
* @param {Array<{ x: number, z: number } & Record<string, any>>} gates - Gate descriptors with approximate world `(x, z)`.
|
|
244
|
+
* @returns {Array<object>} Gate frames with `{ ...gate, d, leg, t, x, z, ux, uz, nx, nz }`.
|
|
245
|
+
*/
|
|
246
|
+
export function wallGateFrames(wall, gates) {
|
|
247
|
+
return gates.map(gate => {
|
|
248
|
+
let best = null;
|
|
249
|
+
for (let i = 0; i < wall.length - 1; i++) {
|
|
250
|
+
const [ax, az] = wall[i];
|
|
251
|
+
const [bx, bz] = wall[i + 1];
|
|
252
|
+
const length = Math.hypot(bx - ax, bz - az);
|
|
253
|
+
const ux = (bx - ax) / length;
|
|
254
|
+
const uz = (bz - az) / length;
|
|
255
|
+
const t = Math.max(0, Math.min(length, (gate.x - ax) * ux + (gate.z - az) * uz));
|
|
256
|
+
const d = Math.hypot(ax + ux * t - gate.x, az + uz * t - gate.z);
|
|
257
|
+
if (!best || d < best.d) best = { d, leg: i, t, x: ax + ux * t, z: az + uz * t, ux, uz, nx: uz, nz: -ux };
|
|
258
|
+
}
|
|
259
|
+
return { ...gate, ...best };
|
|
260
|
+
});
|
|
261
|
+
}
|