roamwright 0.20.1 → 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 +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 +134 -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/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 +27 -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/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/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,198 @@
|
|
|
1
|
+
// A shrub grown from one root, from a form of plain numbers: woody stems that bend and fork, leaves at nodes along every twig,
|
|
2
|
+
// upright shoots and dry stalks, and a far version of a few lobes of leaf over the same outline. Also the small stem helpers the
|
|
3
|
+
// kit's trees share. Worker-safe.
|
|
4
|
+
import { clamp, lerp, TAU } from '../math/scalar.js';
|
|
5
|
+
import { C, TRS } from './primitives.js';
|
|
6
|
+
import { addLeafSpray, addShape, addLimb, shapeParts } from './foliage.js';
|
|
7
|
+
|
|
8
|
+
/** A point moved from `at` along `way` by `distance` metres. */
|
|
9
|
+
export const moved = (at, way, distance) => at.map((value, i) => value + way[i] * distance),
|
|
10
|
+
/** The point `part` (0..1) of the way from `from` to `to`. */
|
|
11
|
+
between = (from, to, part) => from.map((value, i) => value + (to[i] - value) * part),
|
|
12
|
+
/** The unit direction of `heading` round the upright and `tilt` from it, both in radians. */
|
|
13
|
+
direction = (heading, tilt) => [Math.sin(heading) * Math.sin(tilt), Math.cos(tilt), Math.cos(heading) * Math.sin(tilt)],
|
|
14
|
+
/** A twig's line `way`, turned a little towards the sky by `lift`. */
|
|
15
|
+
lifted = (way, lift) => [way[0], way[1] + lift, way[2]];
|
|
16
|
+
const dimmed = (tint, share) => (x, y, z, out) => {
|
|
17
|
+
tint(x, y, z, out);
|
|
18
|
+
out[0] *= share;
|
|
19
|
+
out[1] *= share;
|
|
20
|
+
out[2] *= share;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* The shrub grower bound to a world's hash and the kit's tints.
|
|
25
|
+
* @param {object} o
|
|
26
|
+
* @param {Function} o.hash - A seeded integer hash (`createHash`), which picks and shades each leaf's green.
|
|
27
|
+
* @param {Function} o.barkTint - The kit's bark tint (`createPlantTints`).
|
|
28
|
+
* @param {Function} o.crownBlob - The kit's crown lump (`createPlantTints`).
|
|
29
|
+
* @returns {{shrubParts: Function}} `shrubParts(form, random)`: a shrub of `form` grown from the stream `random`, as
|
|
30
|
+
* `{ near, far }` sets of parts for `partsGeometry` (the form's fields are listed above the function).
|
|
31
|
+
*/
|
|
32
|
+
export function createShrubs({ hash: hash2, barkTint, crownBlob }) {
|
|
33
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
34
|
+
// A shrub grown from one root: what the brush of a cover, a thorn bush of dry hills and a ruin's scrub are made of. Its stems
|
|
35
|
+
// rise out of one root crown, bend and fork three times over from low down, and upright shoots leave them towards the light.
|
|
36
|
+
// Every twig carries a few leaves at each of several nodes along its outer length, standing out from it as a shoot's leaves
|
|
37
|
+
// do, so that near at hand it is woody below and leafy from a third of the way up, every leaf on a twig and none radiating
|
|
38
|
+
// from a bare point; its far version is the same outline in a few lobes of leaf.
|
|
39
|
+
// ════════════════════════════════════════════════════════════════════════
|
|
40
|
+
const ROOT_UNDER = 0.04, // metres the root crown stands under the ground, so that a slope never shows its foot
|
|
41
|
+
ROOT_TOP = 0.05, // how high the root crown rises before its stems part
|
|
42
|
+
STEM_BENDS_AT = 0.55, // how far along its length a stem bends
|
|
43
|
+
LOW_FORK_LEAVES_AT = 0.6, // how far up a stem's lower length its first fork leaves it
|
|
44
|
+
HIGH_FORK_LEAVES_AT = 0.45, // and how far up its upper length its third fork leaves it
|
|
45
|
+
UPRIGHT = 1.45, // the most a stem or fork may lean from upright, in radians
|
|
46
|
+
SHOOT_LEAN = 0.55, // the most one of the upright shoots leans from upright, in radians
|
|
47
|
+
FAR_LOBE_SPANS = 2.6, // a far shrub's lobe of leaf, as a multiple of the leaf: it stands for a spray's leaves spread in depth
|
|
48
|
+
FAR_LOBE_GROWS = 1.14, // and this much larger still, so that the shrub's outline holds where one version gives way to the other
|
|
49
|
+
FAR_LOBE_BRIGHTENS = 1.2; // and this much brighter: a spray's leaves turn their faces to the light, where a lobe is shaded round
|
|
50
|
+
|
|
51
|
+
// The stems of a shrub grown from a count rather than laid out for it: [heading, length in metres, lean from upright in radians],
|
|
52
|
+
// each to its own side of the root, a golden angle (2.399) from the last, and of its own length and lean.
|
|
53
|
+
function stemPlan(count, random, lengths, leans) {
|
|
54
|
+
const stems = [];
|
|
55
|
+
for (let i = 0; i < count; i++)
|
|
56
|
+
stems.push([i * 2.399 + random() * 0.4, lerp(lengths[0], lengths[1], random()), lerp(leans[0], leans[1], random())]);
|
|
57
|
+
return stems;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// The colour of a leaf by where it stands on a shrub: one of its `greens`, a different one from spray to spray; darker low down
|
|
61
|
+
// and within the crown than at its sunlit tips and its outer edge. `height` is how high the shrub rises and `reach` how far its
|
|
62
|
+
// crown spreads from its middle, in metres.
|
|
63
|
+
function shrubLeafTint(greens, height, reach) {
|
|
64
|
+
const palette = greens.map(hex => C(hex));
|
|
65
|
+
return (x, y, z, out) => {
|
|
66
|
+
const green = palette[(hash2(Math.round(x * 23), Math.round(z * 29) + Math.round(y * 19), 64) * palette.length) | 0],
|
|
67
|
+
up = clamp(y / height, 0, 1),
|
|
68
|
+
edge = clamp(Math.hypot(x, z) / reach, 0, 1),
|
|
69
|
+
shade = (0.72 + 0.4 * up) * (0.84 + 0.2 * edge) * (0.9 + 0.2 * hash2(Math.round(x * 41), Math.round(z * 43), 65));
|
|
70
|
+
out[0] = green[0] * shade;
|
|
71
|
+
out[1] = green[1] * shade;
|
|
72
|
+
out[2] = green[2] * shade;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// A shrub of `form` grown from the stream `random`: { near, far }, each a set of parts for partsGeometry. The form says:
|
|
77
|
+
// stems the stems as [heading, length, lean] (a clump every copy of a cover shares), or a count to
|
|
78
|
+
// grow them from `lengths` and `leans` (each [least, most])
|
|
79
|
+
// root the root crown's radius in metres; wood the sides of a stem (3 or 4)
|
|
80
|
+
// leaf the long leaf of a node, in metres; leaves the leaves at a node of a twig; splay the narrowest angle a
|
|
81
|
+
// leaf makes with its twig, in radians (a right angle: a flat fan square to the twig; about 1: leaves standing out
|
|
82
|
+
// from it, as a shoot's do)
|
|
83
|
+
// cluster further nodes of leaf gathered round each fork's end, where a shoot's leaves grow thickest
|
|
84
|
+
// crown upright shoots rising from the stems towards the light, leaf at two nodes along each
|
|
85
|
+
// heart nodes of leaf in shade low on the stems, which the upper ones part to show
|
|
86
|
+
// bark, greens, straw the wood, the leaves, and the dead wood and dry stalks (all sRGB)
|
|
87
|
+
// dead how many of the last stems stand bare and bleached; stalks dry stalks rising from the root
|
|
88
|
+
// far the lobes of its far version
|
|
89
|
+
function shrubParts(form, random) {
|
|
90
|
+
const near = shapeParts(),
|
|
91
|
+
far = shapeParts(),
|
|
92
|
+
stems = Array.isArray(form.stems) ? form.stems : stemPlan(form.stems, random, form.lengths, form.leans),
|
|
93
|
+
rise = Math.max(...stems.map(([, length, lean]) => length * Math.cos(lean))),
|
|
94
|
+
reach = Math.max(...stems.map(([, length, lean]) => length * Math.sin(lean))) + form.leaf * 1.6,
|
|
95
|
+
leaf = shrubLeafTint(form.greens, rise, reach),
|
|
96
|
+
strawLeaf = shrubLeafTint(form.strawLeaves ?? form.greens, rise, reach),
|
|
97
|
+
bark = barkTint(form.bark),
|
|
98
|
+
deadWood = barkTint(form.straw ?? form.bark),
|
|
99
|
+
tips = [];
|
|
100
|
+
// a node of leaf: the form's `leaves` leaves leaving a twig together at `at` and standing out round its line `way`, each a
|
|
101
|
+
// little its own way about it
|
|
102
|
+
const leafNode = (at, way, size, tint = leaf) =>
|
|
103
|
+
addLeafSpray(near, {
|
|
104
|
+
at,
|
|
105
|
+
facing: [way[0] + (random() - 0.5) * 0.5, way[1] + (random() - 0.5) * 0.4, way[2] + (random() - 0.5) * 0.5],
|
|
106
|
+
length: form.leaf * size,
|
|
107
|
+
leaves: form.leaves,
|
|
108
|
+
tint,
|
|
109
|
+
random,
|
|
110
|
+
splay: form.splay,
|
|
111
|
+
});
|
|
112
|
+
// leaf at nodes along a twig from `from` to `end`, further out the larger, as a shoot's leaves grow towards its tip
|
|
113
|
+
const leafNodes = (from, end, way, parts) => parts.forEach(part => leafNode(between(from, end, part), way, 0.75 + 0.25 * part));
|
|
114
|
+
// a short upright shoot from `from` on a stem, leaf at two nodes along it
|
|
115
|
+
const shoot = from => {
|
|
116
|
+
const way = direction(random() * TAU, random() * SHOOT_LEAN),
|
|
117
|
+
end = moved(from, way, rise * (0.22 + 0.3 * random()));
|
|
118
|
+
addLimb(near, from, end, form.root * 0.3, form.root * 0.12, 3, bark);
|
|
119
|
+
leafNodes(from, end, way, [0.55, 1]);
|
|
120
|
+
};
|
|
121
|
+
addLimb(near, [0, -ROOT_UNDER, 0], [0, ROOT_TOP, 0], form.root, form.root * 0.8, 5, bark); // the root crown
|
|
122
|
+
stems.forEach(([heading, length, lean], i) => {
|
|
123
|
+
const dead = i >= stems.length - (form.dead ?? 0), // the last stems stand dead: bare, and bleached by the sun
|
|
124
|
+
wood = dead ? deadWood : bark,
|
|
125
|
+
kink = moved([0, 0.01, 0], direction(heading, lean), length * STEM_BENDS_AT),
|
|
126
|
+
on = direction(heading + (random() - 0.5) * 0.8, Math.min(lean + 0.1 + random() * 0.45, UPRIGHT)),
|
|
127
|
+
tip = moved(kink, on, length * (1 - STEM_BENDS_AT)), // a stem bends on as it rises, a little aside and further from upright
|
|
128
|
+
thick = (0.012 + 0.01 * random()) * Math.sqrt(length / 0.8);
|
|
129
|
+
addLimb(near, [0, 0.01, 0], kink, thick, thick * 0.7, form.wood, wood);
|
|
130
|
+
addLimb(near, kink, tip, thick * 0.7, thick * 0.4, 3, wood);
|
|
131
|
+
tips.push(tip);
|
|
132
|
+
// three forks to alternating sides, the first low on the stem and the second from the bend, so that the leaves reach from
|
|
133
|
+
// a third of the way up it to beyond its tip and the shrub is a dome of leaf and not an umbrella of bare stems
|
|
134
|
+
for (const [from, side] of [
|
|
135
|
+
[between([0, 0.01, 0], kink, LOW_FORK_LEAVES_AT), -1],
|
|
136
|
+
[kink, 1],
|
|
137
|
+
[between(kink, tip, HIGH_FORK_LEAVES_AT), -1],
|
|
138
|
+
]) {
|
|
139
|
+
const fork = direction(heading + side * (0.5 + 0.45 * random()), Math.min(lean + (random() - 0.25) * 0.5, UPRIGHT)),
|
|
140
|
+
end = moved(from, fork, length * (0.36 + 0.22 * random()));
|
|
141
|
+
addLimb(near, from, end, thick * 0.42, thick * 0.16, 3, wood);
|
|
142
|
+
if (dead) continue;
|
|
143
|
+
// leaf at three nodes along the fork's outer length, as a shoot's leaves stand, and the cluster's further nodes at its end
|
|
144
|
+
leafNodes(from, end, fork, [0.4, 0.7, 1]);
|
|
145
|
+
for (let n = 0; n < form.cluster; n++)
|
|
146
|
+
leafNode(moved(end, [random() - 0.5, random() * 0.5, random() - 0.5], form.leaf * 1.2), fork, 0.9);
|
|
147
|
+
}
|
|
148
|
+
if (!dead) {
|
|
149
|
+
leafNodes(kink, tip, on, [0.35, 1]);
|
|
150
|
+
for (let n = 0; n < form.heart; n++)
|
|
151
|
+
leafNode(between([0, 0.01, 0], kink, 0.7 + 0.25 * random()), lifted(direction(heading, lean), 0.7), 0.85, dimmed(leaf, 0.6));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
// the upright shoots, spread over the stems' upper lengths
|
|
155
|
+
for (let n = 0; n < form.crown; n++) {
|
|
156
|
+
const [heading, length, lean] = stems[n % stems.length],
|
|
157
|
+
kink = moved([0, 0.01, 0], direction(heading, lean), length * STEM_BENDS_AT);
|
|
158
|
+
shoot(between(kink, tips[n % stems.length], random() * 0.8));
|
|
159
|
+
}
|
|
160
|
+
for (let n = 0; n < (form.stalks ?? 0); n++) {
|
|
161
|
+
// a dry stalk: a thin straw-coloured stem near upright, and three dry leaves at its top
|
|
162
|
+
const way = direction(random() * TAU, 0.12 + random() * 0.3),
|
|
163
|
+
top = moved([0, 0.02, 0], way, rise * (0.7 + 0.5 * random()));
|
|
164
|
+
addLimb(near, [0, 0.02, 0], top, 0.004, 0.002, 3, deadWood);
|
|
165
|
+
addLeafSpray(near, {
|
|
166
|
+
at: top,
|
|
167
|
+
facing: lifted(way, 0.5),
|
|
168
|
+
length: form.leaf * 0.55,
|
|
169
|
+
leaves: 3,
|
|
170
|
+
tint: strawLeaf,
|
|
171
|
+
random,
|
|
172
|
+
splay: form.splay,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
// far off, where a leaf is thinner than a pixel, the shrub is a lobe of leaf over its crown and one over every other stem's
|
|
176
|
+
// tip, each a little larger than the spray it stands for
|
|
177
|
+
const over = form.far - 1,
|
|
178
|
+
stride = Math.max(1, Math.ceil((tips.length - 1) / over)),
|
|
179
|
+
wide = form.leaf * FAR_LOBE_SPANS * FAR_LOBE_GROWS,
|
|
180
|
+
lobe = (at, seed) =>
|
|
181
|
+
addShape(
|
|
182
|
+
far,
|
|
183
|
+
crownBlob(seed, 0),
|
|
184
|
+
TRS(at[0], at[1], at[2], wide, wide * 0.62, wide),
|
|
185
|
+
(x, y, z, out) => {
|
|
186
|
+
leaf(x * wide + at[0], y * wide * 0.62 + at[1], z * wide + at[2], out);
|
|
187
|
+
out[0] *= FAR_LOBE_BRIGHTENS;
|
|
188
|
+
out[1] *= FAR_LOBE_BRIGHTENS;
|
|
189
|
+
out[2] *= FAR_LOBE_BRIGHTENS;
|
|
190
|
+
},
|
|
191
|
+
1,
|
|
192
|
+
);
|
|
193
|
+
lobe([0, rise * 0.6, 0], 390);
|
|
194
|
+
for (let n = 0; n < over; n++) lobe(tips[Math.min(n * stride, tips.length - 1)], 391 + n);
|
|
195
|
+
return { near, far };
|
|
196
|
+
}
|
|
197
|
+
return { shrubParts };
|
|
198
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
// The colours and crown lumps every plant of the kit is made of: bark or stone mottled from place to place, an irregular crown
|
|
2
|
+
// lump, foliage darker underneath and inside, and the drift of a stand's colour from grove to grove. Worker-safe.
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
import { clamp, lerp } from '../math/scalar.js';
|
|
5
|
+
import { C } from './primitives.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The plant kit's tints bound to a world's noise and hash.
|
|
9
|
+
* @param {object} o
|
|
10
|
+
* @param {Function} o.fbm - Seeded fractal noise (`createNoise`), which shapes a crown lump.
|
|
11
|
+
* @param {Function} o.vnoise - Seeded value noise (`createNoise`), which drifts a stand's colour.
|
|
12
|
+
* @param {Function} o.hash - A seeded integer hash (`createHash`), which mottles bark and leaves.
|
|
13
|
+
* @returns {{barkTint: Function, crownBlob: Function, crownTint: Function, standColourDrift: Function}}
|
|
14
|
+
* `barkTint(hex)` and `crownTint(hex)`: a tint `(x, y, z, out)` writing a linear [r, g, b] for a vertex of a shape, the
|
|
15
|
+
* colour sRGB hex; `crownBlob(seed, detail = 1)`: a displaced icosahedron of radius about 0.5 m with smooth normals;
|
|
16
|
+
* `standColourDrift(x, z, brightnessShare, out, chromaStrength = 1)`: the warm and cool drift of a stand at world point
|
|
17
|
+
* (x, z) in metres and a tree's brightness (0..1 to 0.82..1.16), written into `out` as an [r, g, b] multiplier.
|
|
18
|
+
*/
|
|
19
|
+
export function createPlantTints({ fbm, vnoise, hash: hash2 }) {
|
|
20
|
+
const STAND_BROAD_SCALE = 256, // metres across hillside moisture and aspect shifts
|
|
21
|
+
STAND_GROVE_SCALE = 64, // metres across individual grove patches
|
|
22
|
+
TREE_BRIGHT_MIN = 0.82,
|
|
23
|
+
TREE_BRIGHT_MAX = 1.16;
|
|
24
|
+
|
|
25
|
+
// Bark or stone: a colour mottled a little from place to place.
|
|
26
|
+
function barkTint(hex) {
|
|
27
|
+
const c = C(hex);
|
|
28
|
+
return (x, y, z, o) => {
|
|
29
|
+
const k = 0.8 + 0.4 * hash2(Math.round(x * 9), Math.round(y * 5), 61);
|
|
30
|
+
o[0] = c[0] * k;
|
|
31
|
+
o[1] = c[1] * k;
|
|
32
|
+
o[2] = c[2] * k;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
// An irregular crown lump: a displaced sphere with smooth normals.
|
|
36
|
+
function crownBlob(seed, detail = 1) {
|
|
37
|
+
const g = new THREE.IcosahedronGeometry(0.5, detail),
|
|
38
|
+
a = g.attributes.position.array,
|
|
39
|
+
nn = g.attributes.normal.array;
|
|
40
|
+
for (let i = 0; i < a.length; i += 3) {
|
|
41
|
+
const l = Math.hypot(a[i], a[i + 1], a[i + 2]),
|
|
42
|
+
dx = a[i] / l,
|
|
43
|
+
dy = a[i + 1] / l,
|
|
44
|
+
dz = a[i + 2] / l,
|
|
45
|
+
r = 0.5 * (0.7 + 0.6 * fbm(dx * 1.8 + seed * 3.1, dz * 1.8 + dy * 1.4 + seed, 2, 210));
|
|
46
|
+
a[i] = dx * r;
|
|
47
|
+
a[i + 1] = dy * r;
|
|
48
|
+
a[i + 2] = dz * r;
|
|
49
|
+
nn[i] = dx;
|
|
50
|
+
nn[i + 1] = dy;
|
|
51
|
+
nn[i + 2] = dz;
|
|
52
|
+
}
|
|
53
|
+
return g;
|
|
54
|
+
}
|
|
55
|
+
// Foliage: darker underneath and inside, lighter on top, mottled leaf by leaf.
|
|
56
|
+
function crownTint(hex) {
|
|
57
|
+
const c = C(hex);
|
|
58
|
+
return (x, y, z, o) => {
|
|
59
|
+
const l = Math.hypot(x, y, z) || 1,
|
|
60
|
+
k = (0.48 + 0.66 * ((y / l) * 0.5 + 0.5)) * (0.86 + 0.28 * hash2(Math.round(x * 20), Math.round(z * 20), 62));
|
|
61
|
+
o[0] = c[0] * k;
|
|
62
|
+
o[1] = c[1] * k;
|
|
63
|
+
o[2] = c[2] * k;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Writes natural stand-wide warm/cool green-gold drift (256 m and 64 m world-space noise) and per-tree brightness (0.82-1.16)
|
|
68
|
+
// into `out` ([r, g, b]) without drawing from placement RNG streams, so seeded tree layouts never move.
|
|
69
|
+
function standColourDrift(x, z, brightnessShare, out, chromaStrength = 1) {
|
|
70
|
+
const broad = vnoise(x / STAND_BROAD_SCALE, z / STAND_BROAD_SCALE, 419) * 2 - 1,
|
|
71
|
+
grove = vnoise(x / STAND_GROVE_SCALE, z / STAND_GROVE_SCALE, 421) * 2 - 1,
|
|
72
|
+
warmShift = (0.62 * broad + 0.38 * grove) * chromaStrength,
|
|
73
|
+
brightness = lerp(TREE_BRIGHT_MIN, TREE_BRIGHT_MAX, clamp(brightnessShare, 0, 1)) * (1 + 0.05 * grove);
|
|
74
|
+
out[0] = brightness * (1 + 0.14 * warmShift);
|
|
75
|
+
out[1] = brightness * (1 + 0.03 * warmShift);
|
|
76
|
+
out[2] = brightness * (1 - 0.11 * warmShift);
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
return { barkTint, crownBlob, crownTint, standColourDrift };
|
|
80
|
+
}
|