roamwright 0.20.1 → 0.55.1
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 +19 -14
- package/README.md +35 -16
- 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/builder-cells.js +10 -2
- package/geometry/builder-frame.js +2 -1
- package/geometry/builder.js +15 -4
- package/geometry/card-emblem.js +437 -0
- package/geometry/catenary-canvas.js +396 -0
- package/geometry/cloth-folds.js +143 -0
- package/geometry/crawl-shapes.js +71 -0
- package/geometry/creased-sheet.js +7 -2
- 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 +9 -4
- package/geometry/erosion.js +7 -4
- package/geometry/face-grid.js +26 -6
- 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 +177 -4
- 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 +19 -4
- package/geometry/hair-locks.js +1 -1
- package/geometry/hair-patch.js +6 -2
- package/geometry/hair-shell.js +14 -2
- package/geometry/head-presets.js +103 -0
- package/geometry/head-profile.js +13 -2
- package/geometry/head-shape.js +51 -23
- package/geometry/heightfield.js +26 -9
- 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/instances.js +4 -4
- 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 +5 -4
- package/geometry/outline-segments.js +74 -0
- package/geometry/part-ranges.js +35 -0
- package/geometry/path-field.js +35 -1
- 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/primitives.js +65 -23
- 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/sampled-surface.js +24 -10
- package/geometry/scatter-grid.js +6 -3
- package/geometry/sculpt.js +5 -1
- 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 +5 -1
- package/geometry/strata-field.js +44 -11
- package/geometry/strata-tiles.js +20 -6
- package/geometry/stream.js +32 -17
- package/geometry/swept-tube.js +124 -0
- package/geometry/terrain-chunks.js +139 -51
- package/geometry/terrain-extension.js +24 -8
- 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 +139 -3
- package/math/cloud-textures.js +3 -7
- package/math/curve.js +5 -1
- package/math/lamp-texels.js +43 -0
- package/math/lit-share.js +22 -0
- package/math/mountain-ranges.js +177 -54
- package/math/periodic.js +6 -0
- package/math/rectangles.js +8 -2
- package/math/rock-texture.js +17 -12
- package/math/surface-textures.js +24 -9
- 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 +3 -2
- package/motion/ballistic-arc.js +182 -2
- package/motion/biped-cycle.js +4 -2
- package/motion/biped-leg.js +4 -1
- package/motion/biped-posture.js +459 -0
- package/motion/biped-stride.js +142 -32
- package/motion/boat-sailing.js +214 -0
- package/motion/cast-actors.js +379 -0
- package/motion/cast-manager.js +321 -0
- package/motion/contact-transition.js +5 -6
- package/motion/crowd-alarms.js +36 -6
- 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 +44 -14
- package/motion/crowd-town.js +166 -0
- package/motion/crowd-water.js +143 -0
- package/motion/deck-surface.js +4 -2
- 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/instance-sight.js +8 -1
- package/motion/melee-contact.js +143 -0
- package/motion/moorings.js +48 -0
- package/motion/path-steering.js +358 -0
- package/motion/player.js +7 -6
- package/motion/quadruped.js +109 -33
- package/motion/spaces.js +58 -6
- 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 +70 -12
- package/motion/wind.js +27 -1
- package/package.json +46 -4
- 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/{road-surface.js → cart-track.js} +40 -11
- package/rendering/cast-stage.js +299 -0
- package/rendering/caster-motion.js +2 -1
- package/rendering/cell-lod-options.js +46 -0
- package/rendering/cell-lod.js +665 -80
- package/rendering/cloth-material.js +140 -0
- package/rendering/cloud-dome.js +2 -2
- package/rendering/compilation-schedule.js +18 -10
- package/rendering/contact-shadows.js +5 -2
- package/rendering/context.js +47 -8
- 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 +52 -9
- package/rendering/crowd-update.js +419 -0
- package/rendering/crowd-visibility.js +107 -0
- package/rendering/day-cycle-defaults.js +200 -0
- package/rendering/day-cycle.js +487 -0
- package/rendering/daylight.js +1 -3
- package/rendering/detail-range.js +6 -5
- package/rendering/dof.js +11 -4
- package/rendering/effects-frame.js +149 -0
- package/rendering/effects-water-rises.js +221 -0
- package/rendering/energy-stream.js +128 -0
- package/rendering/facade-glass-material.js +105 -0
- package/rendering/far-shadow.js +81 -54
- 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 +6 -2
- package/rendering/garment-material.js +145 -49
- package/rendering/glsl-literal.js +19 -0
- package/rendering/ground-marks.js +316 -0
- package/rendering/hair-strands.js +38 -24
- package/rendering/height-haze.js +80 -33
- package/rendering/height-probe.js +15 -3
- package/rendering/house-kit-meshes.js +124 -0
- package/rendering/interior-bake.js +807 -0
- package/rendering/label-layout.js +13 -3
- package/rendering/label-range.js +5 -2
- 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 +19 -3
- package/rendering/light-points.js +21 -5
- package/rendering/local-lights.js +27 -7
- package/rendering/material-lod.js +5 -6
- package/rendering/memory-estimate.js +84 -0
- package/rendering/moored-fleet.js +186 -0
- package/rendering/nameplate-groups.js +84 -0
- package/rendering/nameplates.js +386 -0
- package/rendering/part-costs.js +104 -0
- package/rendering/particle-bursts.js +386 -0
- package/rendering/particle-emitters.js +61 -25
- package/rendering/particle-light-bursts.js +189 -0
- package/rendering/particles.js +134 -34
- package/rendering/pen-flocks.js +118 -0
- package/rendering/piece-batch.js +282 -6
- package/rendering/planar-reflection-options.js +159 -0
- package/rendering/planar-reflection.js +780 -77
- 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 +84 -21
- package/rendering/post.js +39 -19
- package/rendering/pressed-cover.js +135 -0
- package/rendering/prop-dig.js +136 -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 +83 -26
- 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 +80 -36
- package/rendering/shadow-depth.js +40 -18
- package/rendering/ship-meshes.js +150 -0
- package/rendering/shot-cuts.js +68 -0
- package/rendering/sky-occlusion.js +42 -15
- package/rendering/sky-pmrem.js +216 -0
- package/rendering/sky.js +112 -50
- 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 +62 -23
- package/rendering/still-casters.js +77 -27
- package/rendering/strata-material.js +2 -2
- 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 +49 -18
- package/rendering/tree-impostor.js +929 -0
- package/rendering/vehicle-train.js +92 -0
- package/rendering/viewport.js +67 -4
- package/rendering/water-material.js +270 -82
- package/rendering/waypoint-beacons.js +191 -0
- package/rendering/world-matrices.js +0 -2
- 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 +11 -3
- package/runtime/effect-sites.js +85 -0
- package/runtime/figure-orders.js +59 -0
- package/runtime/first-use.js +8 -5
- package/runtime/foley-script.js +124 -0
- package/runtime/foley-strides.js +333 -0
- package/runtime/frame-pacing.js +18 -4
- package/runtime/frame-yield.js +18 -0
- package/runtime/gpu-timing.js +8 -4
- package/runtime/grid-cache.js +16 -6
- package/runtime/grid-rows.js +5 -5
- package/runtime/hand-over.js +7 -2
- package/runtime/land-bake.js +78 -0
- package/runtime/lazy-sets.js +105 -0
- package/runtime/pool.js +17 -3
- package/runtime/quality-fit.js +59 -27
- package/runtime/region-pass-lay.js +40 -0
- package/runtime/region-pass.js +78 -0
- package/runtime/search.js +6 -2
- 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 +69 -20
- package/runtime/steady-frames.js +221 -0
- package/runtime/withdrawable-task.js +19 -8
- 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
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { createHouseKit, createShipKit, createShipMeshes, GeometryBuilder, SHIP_PRESETS } from 'roamwright';
|
|
3
|
+
import { sstep } from 'roamwright/math/scalar.js';
|
|
4
|
+
import { C, TRS } from 'roamwright/geometry/primitives.js';
|
|
5
|
+
import { oneOf } from 'roamwright/geometry/ship-kit.js';
|
|
6
|
+
import { YARD_STOWED } from 'roamwright/geometry/ship-rig.js';
|
|
7
|
+
import { createBoatSailing, openWaterCourse } from 'roamwright/motion/boat-sailing.js';
|
|
8
|
+
import { createProps } from 'roamwright/geometry/props.js';
|
|
9
|
+
import { createOrbitRig, initExample, makeRollingGround, makeSky, makeWaterMesh, setupSun } from './stage.js';
|
|
10
|
+
import { buildKitGroup, createShowcaseHouseMaterials, scatterTrees } from './stage-kits.js';
|
|
11
|
+
|
|
12
|
+
const { canvas, renderer, camera, scene, worldGroup, seed, random, noise, hash, shapes } = initExample({
|
|
13
|
+
fallbackSeed: 42,
|
|
14
|
+
fov: 40,
|
|
15
|
+
});
|
|
16
|
+
const kit = createShipKit({ hash });
|
|
17
|
+
const { buildShip } = createShipMeshes({ kit });
|
|
18
|
+
|
|
19
|
+
// Coastal headland behind the harbour quay (z > 24 rises above the water; bay lies toward -z).
|
|
20
|
+
function groundAt(x, z) {
|
|
21
|
+
const cove = z - 24 + 10 * Math.sin(x * 0.018);
|
|
22
|
+
if (cove < 0) return Math.max(-7, cove * 0.16);
|
|
23
|
+
const apron = 1.6 * sstep(0, 8, cove);
|
|
24
|
+
const hills = sstep(18, 120, cove) * (24 * noise.fbm(x * 0.009, z * 0.009, 4, 29) + 12 * noise.ridged(x * 0.006, z * 0.006, 3, 13));
|
|
25
|
+
return apron + hills;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const grassCol = new THREE.Color(0x6d7d4d),
|
|
29
|
+
rockCol = new THREE.Color(0x888175),
|
|
30
|
+
sandCol = new THREE.Color(0xcab993),
|
|
31
|
+
plazaCol = new THREE.Color(0xb2a58c);
|
|
32
|
+
const coast = makeRollingGround({
|
|
33
|
+
size: 1200,
|
|
34
|
+
segs: 160,
|
|
35
|
+
heightAt: groundAt,
|
|
36
|
+
colorAt: (x, y, z, up, out) => {
|
|
37
|
+
const g = noise.fbm(x * 0.025, z * 0.025, 3, 11);
|
|
38
|
+
const onQuay = (1 - sstep(46, 62, Math.abs(x))) * sstep(18, 28, z) * (1 - sstep(42, 54, z));
|
|
39
|
+
out.copy(grassCol).lerp(sandCol, 1 - sstep(0.5, 4.5, y));
|
|
40
|
+
out.lerp(rockCol, (1 - sstep(0.65, 0.9, up)) * 0.85);
|
|
41
|
+
out.lerp(plazaCol, onQuay * 0.85);
|
|
42
|
+
out.multiplyScalar(0.86 + 0.22 * g);
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
worldGroup.add(coast);
|
|
46
|
+
|
|
47
|
+
// Shimmering harbour water grading from turquoise coastal shallows to deep sea blue.
|
|
48
|
+
const { mesh: water, timeUniform: waterTime } = makeWaterMesh({
|
|
49
|
+
width: 1600,
|
|
50
|
+
depth: 1600,
|
|
51
|
+
segs: 128,
|
|
52
|
+
level: 0,
|
|
53
|
+
depthAt: (x, z) => Math.max(0, -groundAt(x, z)),
|
|
54
|
+
shallowColor: 0x629f9d,
|
|
55
|
+
deepColor: 0x1e5367,
|
|
56
|
+
opacity: 0.92,
|
|
57
|
+
});
|
|
58
|
+
worldGroup.add(water);
|
|
59
|
+
|
|
60
|
+
// Dressed stone quay with timber rubbing strakes, mooring bollards and coastal rocks.
|
|
61
|
+
const masonry = new GeometryBuilder();
|
|
62
|
+
masonry.box(0, -1.6, 25.5, 116, 3.25, 11, C(0x9b9282, 0.04, random));
|
|
63
|
+
masonry.box(0, 1.62, 20.3, 116.4, 0.34, 0.9, C(0xb4aa97, 0.04, random));
|
|
64
|
+
for (let bx = -54; bx <= 54; bx += 7.2) {
|
|
65
|
+
masonry.box(bx, -0.6, 19.9, 0.35, 2.3, 0.28, C(0x4c3a2a, 0.08, random));
|
|
66
|
+
masonry.box(bx, 1.9, 21.1, 0.36, 0.55, 0.36, C(0x404244, 0.08, random));
|
|
67
|
+
}
|
|
68
|
+
for (let i = 0; i < 28; i++) {
|
|
69
|
+
const side = i % 2 ? 1 : -1;
|
|
70
|
+
const rx = side * (62 + random() * 65),
|
|
71
|
+
rz = 14 + random() * 24;
|
|
72
|
+
const s = 0.9 + random() * 2.2;
|
|
73
|
+
masonry.add(shapes.rock, C(0x827d73, 0.16, random), TRS(rx, groundAt(rx, rz) - 0.15, rz, s * 1.4, s * 0.85, s, random() * Math.PI));
|
|
74
|
+
}
|
|
75
|
+
const quayMesh = masonry.mesh(new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.9 }), worldGroup);
|
|
76
|
+
quayMesh.castShadow = quayMesh.receiveShadow = true;
|
|
77
|
+
|
|
78
|
+
// Waterfront warehouses, harbourmaster's tower and stacked cargo along the stone quay.
|
|
79
|
+
const styles = {
|
|
80
|
+
port: {
|
|
81
|
+
material: 'wall',
|
|
82
|
+
storey: 3.1,
|
|
83
|
+
timber: 0.3,
|
|
84
|
+
shutters: 0.55,
|
|
85
|
+
windowW: 0.85,
|
|
86
|
+
windowH: 1.35,
|
|
87
|
+
frame: 0x453526,
|
|
88
|
+
door: 0x342419,
|
|
89
|
+
trim: 0xc8bba2,
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
const houseKit = createHouseKit({ shapes, styles });
|
|
93
|
+
const props = createProps({ houseKit, shapes, vnoise: noise.vnoise, hash, horse: () => {} });
|
|
94
|
+
const linear = hex => new THREE.Color(hex).toArray();
|
|
95
|
+
const quayHouses = [
|
|
96
|
+
{ x: -38, z: 36, w: 12, d: 9, h: 6.5, form: 'gable', rot: Math.PI, col: 0xdccbb0, rc: 0x894e38 },
|
|
97
|
+
{ x: -22, z: 37, w: 10, d: 8.5, h: 7.2, form: 'hip', rot: Math.PI, col: 0xd0be9e, rc: 0x6f4a3c },
|
|
98
|
+
{ x: -7, z: 38, w: 9, d: 8, h: 9.5, form: 'tower', rot: Math.PI, col: 0xe0d5be, rc: 0x7a4b39 },
|
|
99
|
+
{ x: 9, z: 37, w: 12, d: 9, h: 6.2, form: 'gable', rot: Math.PI, col: 0xcab694, rc: 0x8d573a },
|
|
100
|
+
{ x: 26, z: 36, w: 11, d: 9, h: 6.8, form: 'dome', rot: Math.PI, col: 0xdfd3bc, rc: 0x5c686a },
|
|
101
|
+
{ x: 42, z: 37, w: 10, d: 8, h: 6.0, form: 'flat', rot: Math.PI, col: 0xd5c4a3, rc: 0x76503c },
|
|
102
|
+
].map((h, i) => ({
|
|
103
|
+
...h,
|
|
104
|
+
y: groundAt(h.x, h.z) - 0.4,
|
|
105
|
+
n: 2,
|
|
106
|
+
rise: 2.8,
|
|
107
|
+
style: 'port',
|
|
108
|
+
col: linear(h.col),
|
|
109
|
+
rc: linear(h.rc),
|
|
110
|
+
brick: linear(0xa07557),
|
|
111
|
+
party: [0, 0, 0],
|
|
112
|
+
seed: seed * 19 + i,
|
|
113
|
+
}));
|
|
114
|
+
const houseMats = createShowcaseHouseMaterials(houseKit.KIT_KEYS, { doubleSide: true, roughness: 0.9 });
|
|
115
|
+
const portGroup = buildKitGroup({ kits: houseKit.housesFromSpecs(quayHouses).kits, materials: houseMats, parent: worldGroup });
|
|
116
|
+
const propKit = houseKit.kitNew();
|
|
117
|
+
for (const [px, pz, ry, fn] of [
|
|
118
|
+
[-28, 25, 0.2, props.propCrates],
|
|
119
|
+
[-12, 24.5, -0.3, props.propCart],
|
|
120
|
+
[4, 25, 0.1, props.propStall],
|
|
121
|
+
[19, 25.5, -0.5, props.propCrates],
|
|
122
|
+
[33, 25, 0.4, props.propWoodpile],
|
|
123
|
+
]) {
|
|
124
|
+
houseKit.kitAt(propKit, px, 1.65, pz, ry, false, fn, random);
|
|
125
|
+
}
|
|
126
|
+
buildKitGroup({ kitKeys: houseKit.KIT_KEYS, kit: propKit, materials: houseMats, parent: portGroup });
|
|
127
|
+
|
|
128
|
+
// Coastal pines and cedars along the headland behind the warehouses.
|
|
129
|
+
scatterTrees({
|
|
130
|
+
worldGroup,
|
|
131
|
+
noise,
|
|
132
|
+
hash,
|
|
133
|
+
seed,
|
|
134
|
+
random,
|
|
135
|
+
groundAt,
|
|
136
|
+
attempts: 120,
|
|
137
|
+
maxPerSpecies: 45,
|
|
138
|
+
species: ['cedar', 'conifer'],
|
|
139
|
+
scaleRange: [1.0, 0.8],
|
|
140
|
+
sink: 0.15,
|
|
141
|
+
sample: () => [(random() - 0.5) * 260, 44 + random() * 95],
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// All four presets moored stern-on to the stone quay.
|
|
145
|
+
let x = -38;
|
|
146
|
+
for (const spec of [SHIP_PRESETS.rowingBoat, SHIP_PRESETS.cog, SHIP_PRESETS.threeMaster, SHIP_PRESETS.galley]) {
|
|
147
|
+
const ship = buildShip(oneOf({ ...spec, lateenYard: YARD_STOWED }, random), { riding: true });
|
|
148
|
+
x += spec.beam * 2 + 4.5;
|
|
149
|
+
ship.group.position.set(x, 0, 2.5);
|
|
150
|
+
if (ship.set && ship.furl) ship.set.visible = !(ship.furl.visible = true);
|
|
151
|
+
ship.group.traverse(o => {
|
|
152
|
+
if (o.isMesh) {
|
|
153
|
+
o.castShadow = true;
|
|
154
|
+
o.receiveShadow = true;
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
worldGroup.add(ship.group);
|
|
158
|
+
x += spec.beam * 2 + 4.5;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Two boats sailing a visible loop just offshore across the bay.
|
|
162
|
+
const sailing = createBoatSailing({
|
|
163
|
+
isOut: () => true,
|
|
164
|
+
wayOut: () => null,
|
|
165
|
+
wayHome: () => null,
|
|
166
|
+
wind: { x: 0.8, z: 0.6, speed: 6 },
|
|
167
|
+
waterLevel: () => 0,
|
|
168
|
+
hoursPerSecond: 0,
|
|
169
|
+
});
|
|
170
|
+
for (const [i, spec, top] of [
|
|
171
|
+
[0, SHIP_PRESETS.cog, 2.6],
|
|
172
|
+
[1, SHIP_PRESETS.rowingBoat, 2],
|
|
173
|
+
]) {
|
|
174
|
+
const tinted = oneOf(spec, random),
|
|
175
|
+
c = openWaterCourse(random, -15 + i * 38, -56 - i * 14, 48, 22, { afloat: (_px, pz) => pz < -24, middle: [4, -62] }),
|
|
176
|
+
near = buildShip(tinted, { tacks: true, yardApart: !!spec.open }),
|
|
177
|
+
far = buildShip(tinted, { far: true, yardApart: !!spec.open }),
|
|
178
|
+
g = new THREE.Group();
|
|
179
|
+
near.group.traverse(o => {
|
|
180
|
+
if (o.isMesh) o.castShadow = true;
|
|
181
|
+
});
|
|
182
|
+
g.add(near.group, far.group);
|
|
183
|
+
worldGroup.add(g);
|
|
184
|
+
const boat = { g, near, far, c, i, s: random() * c.length, v: top, top, dir: 1, hold: 0, yaw: null, at: {}, trader: true };
|
|
185
|
+
sailing.add(Object.assign(boat, sailing.keeping(null, c, top, random)));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
scene.background = makeSky(noise, {
|
|
189
|
+
zenith: [0.24, 0.48, 0.72],
|
|
190
|
+
horizon: [0.85, 0.88, 0.86],
|
|
191
|
+
sunDir: [-0.72, 0.34, -0.6],
|
|
192
|
+
});
|
|
193
|
+
scene.fog = new THREE.FogExp2(0xcfdcd9, 0.0014);
|
|
194
|
+
setupSun(scene, renderer, {
|
|
195
|
+
sunPosition: [-75, 48, -62],
|
|
196
|
+
shadowRadius: 85,
|
|
197
|
+
shadowFar: 260,
|
|
198
|
+
normalBias: 0.05,
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
const views = {
|
|
202
|
+
harbour: { eye: [-44, 15.5, -42], target: [8, 5.2, 8] },
|
|
203
|
+
quayside: { eye: [52, 8.5, 16], target: [-6, 5.5, 4] },
|
|
204
|
+
sailing: { eye: [36, 12, -16], target: [-8, 4, -56] },
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
const rig = createOrbitRig({
|
|
208
|
+
camera,
|
|
209
|
+
canvas,
|
|
210
|
+
renderer,
|
|
211
|
+
scene,
|
|
212
|
+
views,
|
|
213
|
+
initialView: 'harbour',
|
|
214
|
+
groundAt: (px, pz) => Math.max(0, groundAt(px, pz)),
|
|
215
|
+
minClearance: 2,
|
|
216
|
+
minDistance: 10,
|
|
217
|
+
maxDistance: 240,
|
|
218
|
+
onDraw: () => {},
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
const clock = new THREE.Timer();
|
|
222
|
+
// Step once so both sailing boats sit on their courses on frame 1.
|
|
223
|
+
sailing.update(0.05, 0.5, camera.position.x, camera.position.z, 1);
|
|
224
|
+
|
|
225
|
+
function draw() {
|
|
226
|
+
clock.update();
|
|
227
|
+
const dt = Math.min(clock.getDelta(), 0.1);
|
|
228
|
+
const t = clock.getElapsed();
|
|
229
|
+
waterTime.value = t;
|
|
230
|
+
sailing.update(dt, t, camera.position.x, camera.position.z, 1);
|
|
231
|
+
rig.clampCamera();
|
|
232
|
+
renderer.render(scene, camera);
|
|
233
|
+
requestAnimationFrame(draw);
|
|
234
|
+
}
|
|
235
|
+
draw();
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
color-scheme: dark;
|
|
3
|
+
font:
|
|
4
|
+
15px/1.4 'Avenir Next',
|
|
5
|
+
'Segoe UI',
|
|
6
|
+
system-ui,
|
|
7
|
+
sans-serif;
|
|
8
|
+
color: #fff6df;
|
|
9
|
+
background: #23383b;
|
|
10
|
+
}
|
|
11
|
+
.sr-only {
|
|
12
|
+
position: absolute;
|
|
13
|
+
width: 1px;
|
|
14
|
+
height: 1px;
|
|
15
|
+
overflow: hidden;
|
|
16
|
+
clip-path: inset(50%);
|
|
17
|
+
}
|
|
18
|
+
* {
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
body {
|
|
22
|
+
margin: 0;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
}
|
|
25
|
+
canvas {
|
|
26
|
+
display: block;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100vh;
|
|
29
|
+
height: 100dvh;
|
|
30
|
+
touch-action: none;
|
|
31
|
+
}
|
|
32
|
+
header,
|
|
33
|
+
footer {
|
|
34
|
+
position: absolute;
|
|
35
|
+
left: 0;
|
|
36
|
+
right: 0;
|
|
37
|
+
display: flex;
|
|
38
|
+
align-items: center;
|
|
39
|
+
justify-content: space-between;
|
|
40
|
+
padding: clamp(10px, 1.8vw, 22px);
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
z-index: 2;
|
|
43
|
+
}
|
|
44
|
+
header {
|
|
45
|
+
top: 0;
|
|
46
|
+
gap: 0.35rem;
|
|
47
|
+
flex-wrap: wrap;
|
|
48
|
+
background: linear-gradient(#12242566, transparent);
|
|
49
|
+
}
|
|
50
|
+
footer {
|
|
51
|
+
bottom: 0;
|
|
52
|
+
align-items: flex-end;
|
|
53
|
+
gap: 0.65rem;
|
|
54
|
+
padding-top: 3rem;
|
|
55
|
+
background: linear-gradient(transparent, #0f2224c8);
|
|
56
|
+
}
|
|
57
|
+
a,
|
|
58
|
+
button,
|
|
59
|
+
input {
|
|
60
|
+
font: inherit;
|
|
61
|
+
color: inherit;
|
|
62
|
+
}
|
|
63
|
+
button {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
a:focus-visible,
|
|
67
|
+
button:focus-visible,
|
|
68
|
+
input:focus-visible,
|
|
69
|
+
canvas:focus-visible {
|
|
70
|
+
outline: 2px solid #ffd577;
|
|
71
|
+
outline-offset: 2px;
|
|
72
|
+
}
|
|
73
|
+
.meta,
|
|
74
|
+
form,
|
|
75
|
+
.views,
|
|
76
|
+
.tools,
|
|
77
|
+
.action {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
}
|
|
81
|
+
.meta {
|
|
82
|
+
gap: 0.3rem;
|
|
83
|
+
flex-wrap: wrap;
|
|
84
|
+
}
|
|
85
|
+
.back,
|
|
86
|
+
.source,
|
|
87
|
+
form,
|
|
88
|
+
.views,
|
|
89
|
+
.action {
|
|
90
|
+
pointer-events: auto;
|
|
91
|
+
border: 1px solid #f7edcf5c;
|
|
92
|
+
border-radius: 0.38rem;
|
|
93
|
+
background: #132c2de8;
|
|
94
|
+
}
|
|
95
|
+
.back,
|
|
96
|
+
.source,
|
|
97
|
+
form button,
|
|
98
|
+
.views button,
|
|
99
|
+
.action {
|
|
100
|
+
position: relative;
|
|
101
|
+
}
|
|
102
|
+
/* Invisible touch margin keeps compact buttons easy to tap without enlarging their drawn size. */
|
|
103
|
+
.back::after,
|
|
104
|
+
.source::after,
|
|
105
|
+
.action::after {
|
|
106
|
+
content: '';
|
|
107
|
+
position: absolute;
|
|
108
|
+
inset: -7px -3px;
|
|
109
|
+
}
|
|
110
|
+
.views button::after,
|
|
111
|
+
form button::after {
|
|
112
|
+
content: '';
|
|
113
|
+
position: absolute;
|
|
114
|
+
inset: -7px 0;
|
|
115
|
+
}
|
|
116
|
+
.back,
|
|
117
|
+
.source {
|
|
118
|
+
display: inline-flex;
|
|
119
|
+
align-items: center;
|
|
120
|
+
min-height: 30px;
|
|
121
|
+
padding: 0 0.6rem;
|
|
122
|
+
font-size: 13px;
|
|
123
|
+
line-height: 1;
|
|
124
|
+
font-weight: 600;
|
|
125
|
+
text-decoration: none;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
.back span {
|
|
129
|
+
margin-right: 0.28rem;
|
|
130
|
+
}
|
|
131
|
+
.source {
|
|
132
|
+
font-weight: 500;
|
|
133
|
+
color: #e9e4cf;
|
|
134
|
+
}
|
|
135
|
+
form {
|
|
136
|
+
padding-left: 0.5rem;
|
|
137
|
+
}
|
|
138
|
+
form label {
|
|
139
|
+
color: #d7dcc8;
|
|
140
|
+
font-size: 12px;
|
|
141
|
+
line-height: 1;
|
|
142
|
+
}
|
|
143
|
+
form input[type='number'] {
|
|
144
|
+
background: transparent;
|
|
145
|
+
border: 0;
|
|
146
|
+
width: 5.5ch;
|
|
147
|
+
height: 28px;
|
|
148
|
+
padding: 0 0.2rem;
|
|
149
|
+
font-size: 13px;
|
|
150
|
+
line-height: 1;
|
|
151
|
+
text-align: center;
|
|
152
|
+
appearance: textfield;
|
|
153
|
+
font-variant-numeric: tabular-nums;
|
|
154
|
+
}
|
|
155
|
+
form input[type='number']:focus {
|
|
156
|
+
width: 10ch;
|
|
157
|
+
}
|
|
158
|
+
form input::-webkit-inner-spin-button {
|
|
159
|
+
-webkit-appearance: none;
|
|
160
|
+
}
|
|
161
|
+
button {
|
|
162
|
+
min-height: 28px;
|
|
163
|
+
border: 0;
|
|
164
|
+
background: transparent;
|
|
165
|
+
font-size: 12.5px;
|
|
166
|
+
line-height: 1;
|
|
167
|
+
font-weight: 550;
|
|
168
|
+
}
|
|
169
|
+
form button {
|
|
170
|
+
width: 28px;
|
|
171
|
+
min-height: 28px;
|
|
172
|
+
border-left: 1px solid #f7edcf38;
|
|
173
|
+
}
|
|
174
|
+
.caption {
|
|
175
|
+
min-width: 0;
|
|
176
|
+
max-width: 40rem;
|
|
177
|
+
}
|
|
178
|
+
h1 {
|
|
179
|
+
margin: 0;
|
|
180
|
+
font:
|
|
181
|
+
500 clamp(1.65rem, 3.6vw, 3.2rem) / 1.04 'Iowan Old Style',
|
|
182
|
+
'Palatino Linotype',
|
|
183
|
+
Georgia,
|
|
184
|
+
serif;
|
|
185
|
+
letter-spacing: -0.03em;
|
|
186
|
+
text-shadow: 0 2px 10px #09171899;
|
|
187
|
+
}
|
|
188
|
+
.caption p {
|
|
189
|
+
margin: 0.3rem 0 0;
|
|
190
|
+
font-size: 0.88rem;
|
|
191
|
+
line-height: 1.38;
|
|
192
|
+
color: #f4eedc;
|
|
193
|
+
text-shadow: 0 1px 6px #091718b5;
|
|
194
|
+
}
|
|
195
|
+
.tools {
|
|
196
|
+
gap: 0.3rem;
|
|
197
|
+
flex-wrap: wrap;
|
|
198
|
+
justify-content: flex-end;
|
|
199
|
+
}
|
|
200
|
+
.views {
|
|
201
|
+
padding: 2px;
|
|
202
|
+
flex-wrap: wrap;
|
|
203
|
+
}
|
|
204
|
+
.views button {
|
|
205
|
+
min-height: 24px;
|
|
206
|
+
border-radius: 0.24rem;
|
|
207
|
+
padding: 0 0.55rem;
|
|
208
|
+
white-space: nowrap;
|
|
209
|
+
}
|
|
210
|
+
.views button[aria-pressed='true'] {
|
|
211
|
+
background: #f4e8cb;
|
|
212
|
+
color: #1f3430;
|
|
213
|
+
}
|
|
214
|
+
.action {
|
|
215
|
+
gap: 0.3rem;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
padding: 0 0.65rem;
|
|
218
|
+
min-height: 30px;
|
|
219
|
+
white-space: nowrap;
|
|
220
|
+
}
|
|
221
|
+
.action[aria-pressed='true'] {
|
|
222
|
+
background: #f4e8cb;
|
|
223
|
+
color: #1f3430;
|
|
224
|
+
}
|
|
225
|
+
button:hover,
|
|
226
|
+
.back:hover,
|
|
227
|
+
.source:hover {
|
|
228
|
+
background-color: #3e5b55;
|
|
229
|
+
}
|
|
230
|
+
.views button[aria-pressed='true']:hover,
|
|
231
|
+
.action[aria-pressed='true']:hover {
|
|
232
|
+
background-color: #fff3d6;
|
|
233
|
+
}
|
|
234
|
+
.status-pill {
|
|
235
|
+
display: inline-block;
|
|
236
|
+
margin-top: 0.3rem;
|
|
237
|
+
padding: 0.14rem 0.55rem;
|
|
238
|
+
border-radius: 999px;
|
|
239
|
+
background: #132c2de8;
|
|
240
|
+
border: 1px solid #f7edcf48;
|
|
241
|
+
font-size: 12px;
|
|
242
|
+
font-variant-numeric: tabular-nums;
|
|
243
|
+
}
|
|
244
|
+
@media (max-width: 780px) {
|
|
245
|
+
header {
|
|
246
|
+
padding: 8px 10px;
|
|
247
|
+
gap: 0.25rem;
|
|
248
|
+
}
|
|
249
|
+
.meta {
|
|
250
|
+
gap: 0.25rem;
|
|
251
|
+
}
|
|
252
|
+
.back,
|
|
253
|
+
.source {
|
|
254
|
+
min-height: 28px;
|
|
255
|
+
padding: 0 0.5rem;
|
|
256
|
+
font-size: 12px;
|
|
257
|
+
}
|
|
258
|
+
form {
|
|
259
|
+
padding-left: 0.45rem;
|
|
260
|
+
}
|
|
261
|
+
form label {
|
|
262
|
+
font-size: 11.5px;
|
|
263
|
+
}
|
|
264
|
+
form input[type='number'] {
|
|
265
|
+
width: 4.5ch;
|
|
266
|
+
height: 26px;
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
}
|
|
269
|
+
form button {
|
|
270
|
+
width: 26px;
|
|
271
|
+
min-height: 26px;
|
|
272
|
+
font-size: 12px;
|
|
273
|
+
}
|
|
274
|
+
footer {
|
|
275
|
+
align-items: flex-start;
|
|
276
|
+
flex-direction: column;
|
|
277
|
+
padding: 1.5rem 10px 10px;
|
|
278
|
+
gap: 0.35rem;
|
|
279
|
+
}
|
|
280
|
+
h1 {
|
|
281
|
+
font-size: clamp(1.45rem, 6.2vw, 1.95rem);
|
|
282
|
+
}
|
|
283
|
+
.caption p {
|
|
284
|
+
margin-top: 0.2rem;
|
|
285
|
+
font-size: 0.8rem;
|
|
286
|
+
}
|
|
287
|
+
.tools {
|
|
288
|
+
width: 100%;
|
|
289
|
+
gap: 0.25rem;
|
|
290
|
+
justify-content: flex-start;
|
|
291
|
+
}
|
|
292
|
+
.views button {
|
|
293
|
+
min-height: 22px;
|
|
294
|
+
padding: 0 0.46rem;
|
|
295
|
+
font-size: 12px;
|
|
296
|
+
}
|
|
297
|
+
.action {
|
|
298
|
+
min-height: 28px;
|
|
299
|
+
padding: 0 0.52rem;
|
|
300
|
+
font-size: 12px;
|
|
301
|
+
}
|
|
302
|
+
.status-pill {
|
|
303
|
+
margin-top: 0.22rem;
|
|
304
|
+
padding: 0.1rem 0.48rem;
|
|
305
|
+
font-size: 11.5px;
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
@media (max-height: 480px) {
|
|
309
|
+
footer {
|
|
310
|
+
flex-direction: row;
|
|
311
|
+
align-items: flex-end;
|
|
312
|
+
padding-top: 0.75rem;
|
|
313
|
+
}
|
|
314
|
+
h1 {
|
|
315
|
+
font-size: 1.5rem;
|
|
316
|
+
}
|
|
317
|
+
.caption p {
|
|
318
|
+
display: none;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import { GeometryBuilder, mulberry32 } from 'roamwright';
|
|
3
|
+
import { sstep } from 'roamwright/math/scalar.js';
|
|
4
|
+
import { C, TRS } from 'roamwright/geometry/primitives.js';
|
|
5
|
+
import { createReeds } from 'roamwright/rendering/plant-reeds.js';
|
|
6
|
+
import { makeRollingGround, makeWaterMesh } from './stage.js';
|
|
7
|
+
import { buildCircularFence, scatterTrees, scatterTussocks } from './stage-kits.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Builds the coastal valley terrain, river mouth, bay water, stone harbour quay,
|
|
11
|
+
* pasture fence, coastal rocks, woodland, tussocks and reeds for the Small World showcase.
|
|
12
|
+
*/
|
|
13
|
+
export function buildSmallWorldLand({ world, worldGroup, seed, rng, noise, hash, shapes }) {
|
|
14
|
+
function groundAt(x, z) {
|
|
15
|
+
const shore = world.coastZ - z + 8 * Math.sin(x * 0.014 + seed * 0.2);
|
|
16
|
+
const inTown = (1 - sstep(46, 62, Math.abs(x))) * (1 - sstep(36, 52, Math.abs(z + 23)));
|
|
17
|
+
const riverDist = Math.abs(x - world.riverX(z));
|
|
18
|
+
const riverCut = (1 - sstep(6, 18, riverDist)) * sstep(-22, 16, shore) * -2.6;
|
|
19
|
+
if (shore < 0) return Math.max(-7.5, shore * 0.14);
|
|
20
|
+
const apron = 1.8 * sstep(0, 14, shore);
|
|
21
|
+
const inland = sstep(35, 165, shore) * (1 - inTown * 0.92);
|
|
22
|
+
const hills = inland * (36 * noise.fbm(x * 0.0052, z * 0.0052, 4, 17) + 22 * noise.ridged(x * 0.0038, z * 0.0038, 4, 29));
|
|
23
|
+
const gentle = 0.55 * Math.sin(x * 0.02) * Math.cos(z * 0.018) * (1 - inTown);
|
|
24
|
+
return apron + hills + gentle + riverCut;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const sandCol = new THREE.Color(0xd5c49a),
|
|
28
|
+
grassCol = new THREE.Color(0x6b7f4b),
|
|
29
|
+
meadowCol = new THREE.Color(0x88935b),
|
|
30
|
+
rockCol = new THREE.Color(0x7c7970),
|
|
31
|
+
plazaCol = new THREE.Color(0xc2b599),
|
|
32
|
+
bedCol = new THREE.Color(0x5c6d64);
|
|
33
|
+
const terrain = makeRollingGround({
|
|
34
|
+
size: 960,
|
|
35
|
+
segs: 200,
|
|
36
|
+
heightAt: groundAt,
|
|
37
|
+
colorAt: (x, y, z, up, out) => {
|
|
38
|
+
const g = noise.fbm(x * 0.022, z * 0.022, 3, 7);
|
|
39
|
+
const inTown = (1 - sstep(46, 54, Math.abs(x))) * (1 - sstep(36, 44, Math.abs(z + 23)));
|
|
40
|
+
const riverBank = 1 - sstep(7, 15, Math.abs(x - world.riverX(z)));
|
|
41
|
+
out.copy(grassCol).lerp(meadowCol, g);
|
|
42
|
+
out.lerp(sandCol, 1 - sstep(0.6, 4.2, y));
|
|
43
|
+
out.lerp(rockCol, Math.max(1 - sstep(0.64, 0.88, up), sstep(22, 36, y) * 0.65));
|
|
44
|
+
out.lerp(bedCol, Math.max(1 - sstep(-1.2, 0.4, y), riverBank * (1 - sstep(-0.3, 1.4, y))));
|
|
45
|
+
out.lerp(plazaCol, inTown * 0.85);
|
|
46
|
+
out.multiplyScalar(0.86 + 0.24 * noise.vnoise(x * 0.1, z * 0.1, 13));
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
worldGroup.add(terrain);
|
|
50
|
+
|
|
51
|
+
const { mesh: seaMesh, timeUniform: waterTime } = makeWaterMesh({
|
|
52
|
+
width: 1400,
|
|
53
|
+
depth: 1400,
|
|
54
|
+
segs: 140,
|
|
55
|
+
level: world.sea,
|
|
56
|
+
depthAt: (x, z) => Math.max(0, world.sea - groundAt(x, z)),
|
|
57
|
+
shallowColor: 0x62a19d,
|
|
58
|
+
deepColor: 0x1d5266,
|
|
59
|
+
opacity: 0.92,
|
|
60
|
+
});
|
|
61
|
+
worldGroup.add(seaMesh);
|
|
62
|
+
|
|
63
|
+
// Stone harbour quay and coastal rocks.
|
|
64
|
+
const stoneBuild = new GeometryBuilder();
|
|
65
|
+
stoneBuild.box(0, -1.6, 21.5, 108, 3.55, 11, C(0xa39886, 0.04, rng));
|
|
66
|
+
stoneBuild.box(0, 1.9, 26.7, 108.4, 0.34, 0.85, C(0xbab09b, 0.04, rng));
|
|
67
|
+
for (let bx = -50; bx <= 50; bx += 8) {
|
|
68
|
+
stoneBuild.box(bx, -0.5, 27.1, 0.32, 2.4, 0.28, C(0x4b3a2b, 0.08, rng));
|
|
69
|
+
stoneBuild.box(bx, 2.15, 26.0, 0.34, 0.5, 0.34, C(0x424446, 0.08, rng));
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < 42; i++) {
|
|
72
|
+
const rx = -140 + rng() * 280,
|
|
73
|
+
rz = 8 + rng() * 34;
|
|
74
|
+
if (Math.abs(rx) < 58 && rz < 30) continue;
|
|
75
|
+
const ry = groundAt(rx, rz);
|
|
76
|
+
if (ry < -0.5 || ry > 6) continue;
|
|
77
|
+
const s = 0.7 + rng() * 1.9;
|
|
78
|
+
stoneBuild.add(shapes.rock, C(0x827d73, 0.16, rng), TRS(rx, ry - 0.15, rz, s * 1.4, s * 0.8, s, rng() * Math.PI));
|
|
79
|
+
}
|
|
80
|
+
const quayMesh = stoneBuild.mesh(new THREE.MeshStandardMaterial({ vertexColors: true, roughness: 0.92 }), worldGroup);
|
|
81
|
+
quayMesh.castShadow = quayMesh.receiveShadow = true;
|
|
82
|
+
|
|
83
|
+
// Timber paddock fence enclosing the grazing pasture east of the town.
|
|
84
|
+
buildCircularFence({
|
|
85
|
+
worldGroup,
|
|
86
|
+
groundAt,
|
|
87
|
+
cx: world.pasture.x,
|
|
88
|
+
cz: world.pasture.z,
|
|
89
|
+
radius: world.pasture.r,
|
|
90
|
+
posts: 26,
|
|
91
|
+
random: rng,
|
|
92
|
+
postHeight: 1.3,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Woodland, meadow tussocks and swaying river reeds.
|
|
96
|
+
const { material: leafMat } = scatterTrees({
|
|
97
|
+
worldGroup,
|
|
98
|
+
noise,
|
|
99
|
+
hash,
|
|
100
|
+
seed,
|
|
101
|
+
random: rng,
|
|
102
|
+
groundAt,
|
|
103
|
+
attempts: 420,
|
|
104
|
+
maxPerSpecies: 95,
|
|
105
|
+
scaleRange: [1.0, 0.85],
|
|
106
|
+
sink: 0.18,
|
|
107
|
+
sample: () => {
|
|
108
|
+
const tx = (rng() - 0.5) * 460;
|
|
109
|
+
const tz = -210 + rng() * 235;
|
|
110
|
+
const ty = groundAt(tx, tz);
|
|
111
|
+
if (ty < 1.8) return null;
|
|
112
|
+
if (Math.abs(tx) < 62 && tz > -72 && tz < 30) return null;
|
|
113
|
+
if (Math.hypot(tx - world.pasture.x, tz - world.pasture.z) < world.pasture.r + 6) return null;
|
|
114
|
+
if (Math.abs(tx - world.riverX(tz)) < 14) return null;
|
|
115
|
+
return [tx, tz];
|
|
116
|
+
},
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
scatterTussocks({
|
|
120
|
+
worldGroup,
|
|
121
|
+
seed: seed * 13,
|
|
122
|
+
random: rng,
|
|
123
|
+
groundAt,
|
|
124
|
+
count: 120,
|
|
125
|
+
attempts: 200,
|
|
126
|
+
scaleRange: [0.9, 0.65],
|
|
127
|
+
material: leafMat,
|
|
128
|
+
sample: () => {
|
|
129
|
+
const tx = (rng() - 0.5) * 260;
|
|
130
|
+
const tz = -95 + rng() * 115;
|
|
131
|
+
const ty = groundAt(tx, tz);
|
|
132
|
+
return ty < 1.2 || (Math.abs(tx) < 54 && tz > -66 && tz < 26) ? null : [tx, tz];
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const reedTime = new THREE.Uniform(0);
|
|
137
|
+
const reedWind = new THREE.Uniform(new THREE.Vector3(1.0, 0, 0.4));
|
|
138
|
+
const { reedModels, meshReedBeds } = createReeds({ uTime: reedTime, uWind: reedWind });
|
|
139
|
+
const reedBed = [];
|
|
140
|
+
for (let i = 0; i < 65; i++) {
|
|
141
|
+
const rz = -95 + rng() * 120;
|
|
142
|
+
const side = i % 2 ? 1 : -1;
|
|
143
|
+
const rx = world.riverX(rz) + side * (7 + rng() * 4);
|
|
144
|
+
const ry = groundAt(rx, rz);
|
|
145
|
+
if (ry > 1.8) continue;
|
|
146
|
+
reedBed.push([rx, Math.max(-0.2, ry), rz, 0.9 + rng() * 0.55, rng() * 6.28, 0.8 + rng() * 0.2]);
|
|
147
|
+
}
|
|
148
|
+
meshReedBeds(worldGroup, [reedBed], reedModels(mulberry32(seed)));
|
|
149
|
+
|
|
150
|
+
return { groundAt, waterTime, reedTime };
|
|
151
|
+
}
|