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
package/geometry/primitives.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit meshes, transforms and colour helpers for assembling models with a geometry builder.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
|
|
1
6
|
import * as THREE from 'three';
|
|
2
7
|
import { TAU } from '../math/scalar.js';
|
|
3
8
|
import { createNoise } from '../math/noise.js';
|
|
@@ -7,58 +12,83 @@ import { createNoise } from '../math/noise.js';
|
|
|
7
12
|
// between two points (stick)
|
|
8
13
|
// ════════════════════════════════════════════════════════════════════════
|
|
9
14
|
const _m4 = new THREE.Matrix4(),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
rotationScratch = new THREE.Quaternion(),
|
|
16
|
+
eulerScratch = new THREE.Euler(),
|
|
17
|
+
scaleScratch = new THREE.Vector3(),
|
|
18
|
+
positionScratch = new THREE.Vector3(),
|
|
19
|
+
colorScratch = new THREE.Color();
|
|
15
20
|
function TRS(x, y, z, sx = 1, sy = 1, sz = 1, ry = 0, rx = 0, rz = 0) {
|
|
16
21
|
// returns a shared matrix: use it immediately
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return _m4.compose(
|
|
22
|
+
eulerScratch.set(rx, ry, rz, 'YXZ');
|
|
23
|
+
rotationScratch.setFromEuler(eulerScratch);
|
|
24
|
+
return _m4.compose(positionScratch.set(x, y, z), rotationScratch, scaleScratch.set(sx, sy, sz));
|
|
20
25
|
}
|
|
21
26
|
// A unit triangular prism, the shape of a gable roof.
|
|
22
27
|
function prismGeometry() {
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
const backLeft = [-0.5, 0, -0.5],
|
|
29
|
+
backRight = [0.5, 0, -0.5],
|
|
30
|
+
frontRight = [0.5, 0, 0.5],
|
|
31
|
+
frontLeft = [-0.5, 0, 0.5],
|
|
32
|
+
backRidge = [0, 1, -0.5],
|
|
33
|
+
frontRidge = [0, 1, 0.5];
|
|
34
|
+
const geometry = new THREE.BufferGeometry();
|
|
35
|
+
geometry.setAttribute(
|
|
36
|
+
'position',
|
|
37
|
+
new THREE.Float32BufferAttribute(
|
|
38
|
+
[
|
|
39
|
+
backLeft,
|
|
40
|
+
frontLeft,
|
|
41
|
+
frontRidge,
|
|
42
|
+
backLeft,
|
|
43
|
+
frontRidge,
|
|
44
|
+
backRidge,
|
|
45
|
+
backRight,
|
|
46
|
+
backRidge,
|
|
47
|
+
frontRidge,
|
|
48
|
+
backRight,
|
|
49
|
+
frontRidge,
|
|
50
|
+
frontRight,
|
|
51
|
+
frontLeft,
|
|
52
|
+
frontRight,
|
|
53
|
+
frontRidge,
|
|
54
|
+
backRight,
|
|
55
|
+
backLeft,
|
|
56
|
+
backRidge,
|
|
57
|
+
].flat(),
|
|
58
|
+
3,
|
|
59
|
+
),
|
|
60
|
+
);
|
|
61
|
+
geometry.computeVertexNormals();
|
|
62
|
+
return geometry;
|
|
33
63
|
}
|
|
34
64
|
// The two triangular ends of that prism alone: a gable's wall, under a roof drawn without them.
|
|
35
65
|
function gableGeometry() {
|
|
36
|
-
const
|
|
37
|
-
|
|
66
|
+
const geometry = new THREE.BufferGeometry();
|
|
67
|
+
geometry.setAttribute(
|
|
38
68
|
'position',
|
|
39
69
|
new THREE.Float32BufferAttribute([-0.5, 0, 0.5, 0.5, 0, 0.5, 0, 1, 0.5, 0.5, 0, -0.5, -0.5, 0, -0.5, 0, 1, -0.5], 3),
|
|
40
70
|
);
|
|
41
|
-
|
|
42
|
-
return
|
|
71
|
+
geometry.computeVertexNormals();
|
|
72
|
+
return geometry;
|
|
43
73
|
}
|
|
44
74
|
// The ways a face can look, as [axis, sign]
|
|
45
75
|
const WAYS = { '+x': [0, 1], '-x': [0, -1], '+y': [1, 1], '-y': [1, -1], '+z': [2, 1], '-z': [2, -1] };
|
|
46
76
|
// A unit shape without its flat faces that look the ways named ('+x', '-y', ...), the rest in their order: for a part whose faces
|
|
47
77
|
// lie against something, where no one can see them (the back of a box fixed to a wall, the foot of a rod set in one)
|
|
48
78
|
function without(shape, ...ways) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
n =
|
|
79
|
+
const sourceGeometry = shape.index ? shape.toNonIndexed() : shape,
|
|
80
|
+
positions = sourceGeometry.attributes.position.array,
|
|
81
|
+
n = sourceGeometry.attributes.normal.array,
|
|
52
82
|
away = t => ways.some(w => [0, 3, 6].every(k => n[t + k + WAYS[w][0]] * WAYS[w][1] > 0.99)),
|
|
53
83
|
kept = [];
|
|
54
|
-
for (let t = 0; t <
|
|
55
|
-
const pick =
|
|
84
|
+
for (let t = 0; t < positions.length; t += 9) if (!away(t)) kept.push(t);
|
|
85
|
+
const pick = attribute => {
|
|
56
86
|
const out = new Float32Array(kept.length * 9);
|
|
57
|
-
kept.forEach((t, i) => out.set(
|
|
87
|
+
kept.forEach((t, i) => out.set(attribute.subarray(t, t + 9), i * 9));
|
|
58
88
|
return new THREE.BufferAttribute(out, 3);
|
|
59
89
|
},
|
|
60
90
|
q = new THREE.BufferGeometry();
|
|
61
|
-
q.setAttribute('position', pick(
|
|
91
|
+
q.setAttribute('position', pick(positions));
|
|
62
92
|
q.setAttribute('normal', pick(n));
|
|
63
93
|
return q;
|
|
64
94
|
}
|
|
@@ -72,9 +102,9 @@ const _dir = new THREE.Vector3(),
|
|
|
72
102
|
_a = new THREE.Vector3(),
|
|
73
103
|
_b = new THREE.Vector3();
|
|
74
104
|
function lump(fineness, shape) {
|
|
75
|
-
const
|
|
76
|
-
position =
|
|
77
|
-
normal =
|
|
105
|
+
const geometry = new THREE.IcosahedronGeometry(1, fineness),
|
|
106
|
+
position = geometry.attributes.position.array,
|
|
107
|
+
normal = geometry.attributes.normal.array,
|
|
78
108
|
near = 0.03; // how far round the sphere the shape is sampled to find which way it faces
|
|
79
109
|
for (let i = 0; i < position.length; i += 3) {
|
|
80
110
|
_dir.set(position[i], position[i + 1], position[i + 2]).normalize();
|
|
@@ -90,32 +120,49 @@ function lump(fineness, shape) {
|
|
|
90
120
|
position.set([_here.x, _here.y, _here.z], i);
|
|
91
121
|
normal.set([_a.x, _a.y, _a.z], i);
|
|
92
122
|
}
|
|
93
|
-
return
|
|
123
|
+
return geometry;
|
|
94
124
|
}
|
|
95
125
|
// A stone broken from the rock, about a metre across and a little lower than it is wide: worn round by the weather, with three
|
|
96
126
|
// faces where it split along its joints, and flat where it lies; shaded round where it is worn and flat on its broken faces
|
|
97
127
|
// (80 triangles). Its colours are white, for the builder's colour to tint.
|
|
98
|
-
const
|
|
99
|
-
[
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
128
|
+
const normalizeJoints = joints =>
|
|
129
|
+
joints.map(([x, y, z, planeDistance]) => {
|
|
130
|
+
const len = Math.hypot(x, y, z) || 1;
|
|
131
|
+
return [x / len, y / len, z / len, planeDistance];
|
|
132
|
+
});
|
|
133
|
+
/**
|
|
134
|
+
* Default fracture-plane definitions for the unit broken stone mesh: each entry is `[nx, ny, nz, distance]`,
|
|
135
|
+
* giving the unit normal of a split face and its perpendicular distance from the centre in unit-stone radii.
|
|
136
|
+
*/
|
|
137
|
+
export const DEFAULT_STONE_JOINTS = Object.freeze(
|
|
138
|
+
normalizeJoints([
|
|
139
|
+
[0.62, 0.5, 0.6, 0.37],
|
|
140
|
+
[-0.74, 0.18, 0.64, 0.39],
|
|
141
|
+
[0.12, 0.3, -0.95, 0.4],
|
|
142
|
+
]),
|
|
143
|
+
);
|
|
103
144
|
const box = new THREE.BoxGeometry(1, 1, 1).translate(0, 0.5, 0),
|
|
104
145
|
cyl6 = new THREE.CylinderGeometry(0.5, 0.5, 1, 6).translate(0, 0.5, 0);
|
|
105
|
-
|
|
146
|
+
/**
|
|
147
|
+
* Build a library of reusable unit geometries for scenery and roofs.
|
|
148
|
+
* @param fbm - Fractal noise sampler used to shape the rock. Pass the world’s seeded sampler to reproduce it.
|
|
149
|
+
* @param {{ stoneSeed?: number, stoneJoints?: Array<[number, number, number, number]> }} [options] - Optional rock noise seed and fracture-plane definitions `[nx, ny, nz, distance]`.
|
|
150
|
+
*/
|
|
151
|
+
export function createUnitShapes(fbm = createNoise().fbm, { stoneSeed = 0, stoneJoints = DEFAULT_STONE_JOINTS } = {}) {
|
|
152
|
+
const joints = stoneJoints === DEFAULT_STONE_JOINTS ? DEFAULT_STONE_JOINTS : normalizeJoints(stoneJoints);
|
|
106
153
|
function stonePoint(dir, out) {
|
|
107
|
-
let r = 0.5 * (0.8 + 0.4 * fbm(dir.x * 1.7 + 3, dir.z * 1.7 + dir.y * 1.3, 2,
|
|
108
|
-
for (const [nx, ny, nz,
|
|
154
|
+
let r = 0.5 * (0.8 + 0.4 * fbm(dir.x * 1.7 + 3, dir.z * 1.7 + dir.y * 1.3, 2, stoneSeed));
|
|
155
|
+
for (const [nx, ny, nz, planeDistance] of joints) {
|
|
109
156
|
const towards = dir.x * nx + dir.y * ny + dir.z * nz;
|
|
110
|
-
if (towards > 0.05) r = Math.min(r,
|
|
157
|
+
if (towards > 0.05) r = Math.min(r, planeDistance / towards);
|
|
111
158
|
}
|
|
112
159
|
return out.set(dir.x * r, Math.max(dir.y * r * 0.82, -0.3), dir.z * r);
|
|
113
160
|
}
|
|
114
161
|
function brokenStone() {
|
|
115
|
-
const
|
|
162
|
+
const geometry = lump(1, stonePoint);
|
|
116
163
|
// white vertex colours: an instanced rock on a material that reads vertex colours would otherwise be drawn black
|
|
117
|
-
|
|
118
|
-
return
|
|
164
|
+
geometry.setAttribute('color', new THREE.Float32BufferAttribute(new Float32Array(geometry.attributes.position.count * 3).fill(1), 3));
|
|
165
|
+
return geometry;
|
|
119
166
|
}
|
|
120
167
|
return {
|
|
121
168
|
box,
|
|
@@ -131,28 +178,39 @@ export function createUnitShapes(fbm = createNoise().fbm) {
|
|
|
131
178
|
prism: prismGeometry(),
|
|
132
179
|
eaves: without(prismGeometry(), '+z', '-z'), // a gable roof's two slopes, its ends left open for its gables
|
|
133
180
|
gable: gableGeometry(),
|
|
134
|
-
torso: new THREE.CylinderGeometry(0.5, 0.4, 1, 12).translate(0, 0.5, 0),
|
|
135
|
-
skirt: new THREE.CylinderGeometry(0.32, 0.5, 1, 12).translate(0, 0.5, 0),
|
|
136
|
-
head: new THREE.IcosahedronGeometry(0.5, 2),
|
|
137
|
-
limb: new THREE.CylinderGeometry(0.5, 0.38, 1, 8).translate(0, -0.5, 0),
|
|
138
|
-
cloak: new THREE.CylinderGeometry(0.5, 0.64, 1, 10, 3, true, Math.PI * 0.5, Math.PI).translate(0, -0.5, 0),
|
|
139
181
|
quad: new THREE.PlaneGeometry(1, 1).translate(0, 0.5, 0),
|
|
140
182
|
boxF: without(box, '-z'), // a box without its back face, for parts fixed to a wall
|
|
141
183
|
boxFootless: without(box, '-y'), // a box without its foot, for parts that stand on something or go into a wall at their foot
|
|
142
184
|
cyl16: new THREE.CylinderGeometry(0.5, 0.5, 1, 16).translate(0, 0.5, 0),
|
|
143
|
-
fing: new THREE.CylinderGeometry(0.5, 0.4, 1, 5).translate(0, -0.5, 0),
|
|
144
185
|
cone16: new THREE.ConeGeometry(0.5, 1, 16).translate(0, 0.5, 0),
|
|
145
186
|
dome16: new THREE.SphereGeometry(0.5, 20, 8, 0, TAU, 0, Math.PI / 2),
|
|
146
187
|
};
|
|
147
188
|
}
|
|
148
|
-
|
|
189
|
+
let plain = null;
|
|
190
|
+
/**
|
|
191
|
+
* The unit shapes that need no noise (box, cylinders, cones, sphere), made once and shared by every caller:
|
|
192
|
+
* without a world's rock sampler. Each is the same geometry `createUnitShapes` makes under the same name.
|
|
193
|
+
* @returns {{box: THREE.BufferGeometry, cyl: THREE.BufferGeometry, cyl6: THREE.BufferGeometry, cyl16: THREE.BufferGeometry, cone6: THREE.BufferGeometry, sph: THREE.BufferGeometry}}
|
|
194
|
+
*/
|
|
195
|
+
export function plainUnitShapes() {
|
|
196
|
+
plain ??= {
|
|
197
|
+
box,
|
|
198
|
+
cyl: new THREE.CylinderGeometry(0.5, 0.5, 1, 10).translate(0, 0.5, 0),
|
|
199
|
+
cyl6,
|
|
200
|
+
cyl16: new THREE.CylinderGeometry(0.5, 0.5, 1, 16).translate(0, 0.5, 0),
|
|
201
|
+
cone6: new THREE.ConeGeometry(0.5, 1, 6).translate(0, 0.5, 0),
|
|
202
|
+
sph: new THREE.IcosahedronGeometry(0.5, 1),
|
|
203
|
+
};
|
|
204
|
+
return plain;
|
|
205
|
+
}
|
|
206
|
+
function C(hex, jitter = 0, random) {
|
|
149
207
|
// sRGB hex -> linear [r,g,b], optionally brightness-jittered
|
|
150
|
-
|
|
151
|
-
const k = jitter &&
|
|
152
|
-
return [
|
|
208
|
+
colorScratch.setHex(hex);
|
|
209
|
+
const k = jitter && random ? 1 + (random() - 0.5) * 2 * jitter : 1;
|
|
210
|
+
return [colorScratch.r * k, colorScratch.g * k, colorScratch.b * k];
|
|
153
211
|
}
|
|
154
212
|
|
|
155
|
-
//
|
|
213
|
+
// Append a rod of the given radius between the start and end points, both [x, y, z].
|
|
156
214
|
const _rod = {
|
|
157
215
|
m: new THREE.Matrix4(),
|
|
158
216
|
at: new THREE.Vector3(),
|
|
@@ -161,12 +219,12 @@ const _rod = {
|
|
|
161
219
|
way: new THREE.Vector3(),
|
|
162
220
|
},
|
|
163
221
|
UP = new THREE.Vector3(0, 1, 0);
|
|
164
|
-
function stick(
|
|
222
|
+
function stick(builder, start, end, radius, color, geometry = cyl6) {
|
|
165
223
|
const { m, at, turn, size, way } = _rod;
|
|
166
|
-
way.set(
|
|
224
|
+
way.set(end[0] - start[0], end[1] - start[1], end[2] - start[2]);
|
|
167
225
|
const len = way.length();
|
|
168
226
|
turn.setFromUnitVectors(UP, way.divideScalar(len));
|
|
169
|
-
|
|
227
|
+
builder.add(geometry, color, m.compose(at.set(start[0], start[1], start[2]), turn, size.set(radius, len, radius)));
|
|
170
228
|
}
|
|
171
229
|
|
|
172
230
|
export { box, C, TRS, lump, stick, without };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The dead of a battlefield: a horse on its side and a soldier on the ground, as lofted bodies rather than blocks. Worker-safe.
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { dim } from '../math/color.js';
|
|
4
|
+
import { C, TRS, stick } from './primitives.js';
|
|
5
|
+
import { createSculptor } from './sculpt.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* The battlefield props, bound to a world's shapes, sculptor and horse.
|
|
9
|
+
* @param {object} o
|
|
10
|
+
* @param {object} o.shapes - The unit shapes (`createUnitShapes`).
|
|
11
|
+
* @param {Function} [o.loft] - The sculptor's loft (`createSculptor`); a plain sculptor's if not given.
|
|
12
|
+
* @param {Function} [o.horse] - A still horse cast into a builder, (builder, x, y, z, yaw, colour, R, graze, lying);
|
|
13
|
+
* `propHorse` needs it.
|
|
14
|
+
* @returns {object} `propHorse(builder, x, y, z, yaw, colour, R)`, a dead horse on its side, and `propFallen(builder, x, y, z,
|
|
15
|
+
* yaw, colour, R)`, a fallen soldier, face up or down.
|
|
16
|
+
*/
|
|
17
|
+
export function createBattlefieldProps({ shapes: U, loft = createSculptor().loft, horse: stillHorse }) {
|
|
18
|
+
const _mA = new THREE.Matrix4();
|
|
19
|
+
function propHorse(into, x, y, z, yaw, col, R) {
|
|
20
|
+
stillHorse(into, x, y, z, yaw, col, R, false, true);
|
|
21
|
+
}
|
|
22
|
+
function propFallen(gb, x, y, z, yaw, col, R) {
|
|
23
|
+
const M0 = gb.M,
|
|
24
|
+
face = R() < 0.5,
|
|
25
|
+
M = new THREE.Matrix4()
|
|
26
|
+
.makeTranslation(x, y + 0.13, z)
|
|
27
|
+
.multiply(_mA.makeRotationY(yaw))
|
|
28
|
+
.multiply(_mA.makeRotationX(face ? Math.PI / 2 : -Math.PI / 2))
|
|
29
|
+
.multiply(_mA.makeTranslation(0, -0.95, 0));
|
|
30
|
+
const skin = C(0xb98e6e, 0.2, R),
|
|
31
|
+
steel = C(0x8a8d92),
|
|
32
|
+
dk = dim(col, 0.5),
|
|
33
|
+
boot = C(0x2a221c);
|
|
34
|
+
gb.M = M;
|
|
35
|
+
loft(
|
|
36
|
+
gb,
|
|
37
|
+
0,
|
|
38
|
+
0,
|
|
39
|
+
0,
|
|
40
|
+
[
|
|
41
|
+
[0.86, 0.13, 0.09, 0, 0, dk, 0],
|
|
42
|
+
[0.98, 0.17, 0.11, 0, 0, col, 0],
|
|
43
|
+
[1.2, 0.165, 0.1, 0, 0, col, 0],
|
|
44
|
+
[1.4, 0.2, 0.105, 0, 0, col, 0],
|
|
45
|
+
[1.5, 0.11, 0.08, 0, 0, col, 0],
|
|
46
|
+
[1.56, 0.055, 0.055, 0, 0, skin, 0],
|
|
47
|
+
],
|
|
48
|
+
8,
|
|
49
|
+
);
|
|
50
|
+
gb.add(U.sph, skin, TRS(0, 1.66, 0.01, 0.17, 0.22, 0.19));
|
|
51
|
+
gb.add(U.dome, steel, TRS(0, 1.66, 0, 0.2, 0.26, 0.22));
|
|
52
|
+
for (const s of [-1, 1]) {
|
|
53
|
+
const a = (R() - 0.3) * 1.6,
|
|
54
|
+
el = [s * (0.24 + Math.abs(Math.sin(a)) * 0.26), 1.42 - Math.cos(a) * 0.3, 0.02],
|
|
55
|
+
ha = [el[0] + s * R() * 0.2, el[1] - Math.cos(a * 0.6) * 0.28, 0.05];
|
|
56
|
+
stick(gb, [s * 0.2, 1.42, 0], el, 0.1, col);
|
|
57
|
+
stick(gb, el, ha, 0.085, col);
|
|
58
|
+
gb.add(U.sph, skin, TRS(ha[0], ha[1], ha[2], 0.09, 0.1, 0.07));
|
|
59
|
+
const b = (R() - 0.5) * 0.5,
|
|
60
|
+
kn = [s * 0.1 + b * 0.3, 0.5, 0.03],
|
|
61
|
+
ft = [kn[0] + b * 0.4, 0.06, 0];
|
|
62
|
+
stick(gb, [s * 0.09, 0.92, 0], kn, 0.15, dk);
|
|
63
|
+
stick(gb, kn, ft, 0.12, boot);
|
|
64
|
+
gb.add(U.sph, boot, TRS(ft[0], ft[1], ft[2] + 0.07, 0.11, 0.1, 0.24));
|
|
65
|
+
}
|
|
66
|
+
gb.M = M0;
|
|
67
|
+
}
|
|
68
|
+
return { propFallen, propHorse };
|
|
69
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// The furniture of an army's camp or a siege line besides its tents: fodder stacks, a weapon rack, a cookfire, a well and a
|
|
2
|
+
// trough, a woodpile, a watch brazier, a picketed horse and a raven. Each is built into a house kit's builders round the kit
|
|
3
|
+
// frame's origin, its front to +z. Worker-safe.
|
|
4
|
+
import * as THREE from 'three';
|
|
5
|
+
import { dim } from '../math/color.js';
|
|
6
|
+
import { TAU } from '../math/scalar.js';
|
|
7
|
+
import { pickR } from '../math/random.js';
|
|
8
|
+
import { C, TRS, stick } from './primitives.js';
|
|
9
|
+
import { HOUSE_PALETTE } from './house-kit-palette.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The camp props, bound to a world's shapes, palette, haycock and horse.
|
|
13
|
+
* @param {object} o
|
|
14
|
+
* @param {object} o.shapes - The unit shapes (`createUnitShapes`).
|
|
15
|
+
* @param {object} [o.palette] - The house palette (`hemp` for rope, `cloths` and `awnings`, sRGB hex choices); a house kit's
|
|
16
|
+
* `palette`, or the kit's default (`HOUSE_PALETTE`).
|
|
17
|
+
* @param {Function} o.haycock - The haycock (`createHaycock`), the fodder stacks' hay.
|
|
18
|
+
* @param {Function} [o.horse] - A still horse cast into a builder, (builder, x, y, z, yaw, colour, R, graze); `propHorseUp`
|
|
19
|
+
* needs it.
|
|
20
|
+
* @returns {object} Builders, each (B, R, ...) into a kit's builders: `fodderStack(B, R, far)`, `propRack`, `propCookfire`,
|
|
21
|
+
* `propDesertWell`, `propPlankTrough`, `propWoodpile(B, R, n)`, `propBrazier`; and, into one builder at a point and bearing,
|
|
22
|
+
* `propHorseUp(builder, x, y, z, yaw, colour, R, graze)` and `propRaven(builder, x, y, z, yaw, scale)`.
|
|
23
|
+
*/
|
|
24
|
+
export function createCampProps({ shapes: U, palette = HOUSE_PALETTE, haycock, horse: stillHorse }) {
|
|
25
|
+
const { hemp: HEMP } = palette;
|
|
26
|
+
const _mA = new THREE.Matrix4();
|
|
27
|
+
|
|
28
|
+
// The main rick and the loose forkful pulled from its foot share the same hay as the mown fields.
|
|
29
|
+
function fodderStack(B, R, far = false) {
|
|
30
|
+
const straw = C(0xb49e65, 0.07, R),
|
|
31
|
+
gb = B.cloth,
|
|
32
|
+
frame = gb.M;
|
|
33
|
+
gb.M = _mA.multiplyMatrices(frame, TRS(0, -0.02, 0, 1.56, 1 + R() * 0.24, 1.37, R() * TAU));
|
|
34
|
+
haycock(gb, far, straw);
|
|
35
|
+
gb.M = _mA.multiplyMatrices(frame, TRS(1.28, -0.025, 0.76, 0.95, 0.31, 0.76, R() * TAU));
|
|
36
|
+
haycock(gb, far, dim(straw, 0.89));
|
|
37
|
+
gb.M = frame;
|
|
38
|
+
}
|
|
39
|
+
function propRack(B, R) {
|
|
40
|
+
// spears stacked on a rack, shields leaning at its foot
|
|
41
|
+
const w = C(0x4a3a2a),
|
|
42
|
+
st = [0.5, 0.52, 0.56];
|
|
43
|
+
for (const sx of [-1, 1]) {
|
|
44
|
+
stick(B.wood, [sx * 0.9, 0, -0.35], [sx * 0.9, 1.5, 0], 0.035, w);
|
|
45
|
+
stick(B.wood, [sx * 0.9, 0, 0.35], [sx * 0.9, 1.5, 0], 0.035, w);
|
|
46
|
+
}
|
|
47
|
+
B.wood.box(0, 1.45, 0, 2.0, 0.06, 0.06, w);
|
|
48
|
+
for (let q = 0; q < 6; q++) {
|
|
49
|
+
const x = -0.75 + q * 0.3;
|
|
50
|
+
stick(B.wood, [x, 0, 0.5], [x, 2.3, -0.12], 0.02, C(0x6a5540, 0.15, R));
|
|
51
|
+
B.cloth.add(U.cone6, st, TRS(x, 2.3, -0.12, 0.06, 0.24, 0.06, 0, -0.26));
|
|
52
|
+
}
|
|
53
|
+
for (let q = 0; q < 2; q++)
|
|
54
|
+
B.cloth.add(U.cyl16, C(q ? 0x6a2a26 : 0x4a4640), TRS(-0.4 + q * 0.9, 0.42, -0.5, 0.8, 0.06, 0.8, 0, Math.PI / 2 - 0.35));
|
|
55
|
+
}
|
|
56
|
+
function propCookfire(B, R) {
|
|
57
|
+
// an iron pot hung from a tripod, logs to sit on
|
|
58
|
+
const w = C(0x3a2e22);
|
|
59
|
+
for (let k = 0; k < 3; k++) stick(B.wood, [Math.cos(k * 2.094) * 0.95, 0, Math.sin(k * 2.094) * 0.95], [0, 1.9, 0], 0.03, w);
|
|
60
|
+
stick(B.cloth, [0, 1.85, 0], [0, 0.95, 0], 0.012, [0.02, 0.02, 0.02]);
|
|
61
|
+
B.cloth.add(U.sph, [0.025, 0.024, 0.023], TRS(0, 0.75, 0, 0.5, 0.42, 0.5));
|
|
62
|
+
for (let k = 0; k < 3; k++) {
|
|
63
|
+
const a = k * 2.1 + 0.6;
|
|
64
|
+
B.wood.add(U.cyl, C(0x5a4632, 0.15, R), TRS(Math.cos(a) * 1.9, 0.2, Math.sin(a) * 1.9, 0.38, 1.3, 0.38, -a, 0, Math.PI / 2));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function propDesertWell(B, R) {
|
|
69
|
+
// a camp's well: a curb of rough fieldstones laid dry in two courses round a dark shaft, two forked posts carrying a beam with a
|
|
70
|
+
// wooden pulley, the rope down it, a leather bucket left on the curb, and the trodden, splashed ground round it
|
|
71
|
+
const st = C(0x9a8a70, 0.06, R),
|
|
72
|
+
tim = C(0x4a3826, 0.1, R);
|
|
73
|
+
for (let course = 0; course < 2; course++)
|
|
74
|
+
for (let k = 0; k < 13; k++) {
|
|
75
|
+
const a = ((k + course * 0.5) / 13) * Math.PI * 2 + (R() - 0.5) * 0.08,
|
|
76
|
+
r = 1.05 + (R() - 0.5) * 0.06;
|
|
77
|
+
B.stone.add(
|
|
78
|
+
U.box,
|
|
79
|
+
dim(st, 0.85 + R() * 0.3),
|
|
80
|
+
TRS(Math.cos(a) * r, course * 0.34, Math.sin(a) * r, 0.5 + R() * 0.12, 0.36, 0.42, -a, (R() - 0.5) * 0.1),
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
B.cloth.add(U.cyl16, [0.008, 0.009, 0.01], TRS(0, 0.3, 0, 1.7, 0.06, 1.7)); // the shaft, dark
|
|
84
|
+
B.stone.add(U.cyl16, [0.11, 0.1, 0.085], TRS(0, -0.02, 0, 4.6, 0.04, 4.2)); // the wet, trodden ground round the curb
|
|
85
|
+
for (const sx of [-1, 1]) {
|
|
86
|
+
stick(B.wood, [sx * 1.45, -0.3, 0], [sx * 1.4, 2.25, 0], 0.075, tim); // a forked post
|
|
87
|
+
stick(B.wood, [sx * 1.4, 2.0, 0], [sx * 1.6, 2.4, 0.04], 0.035, tim);
|
|
88
|
+
}
|
|
89
|
+
stick(B.wood, [-1.6, 2.28, 0], [1.6, 2.28, 0], 0.06, tim); // the beam
|
|
90
|
+
B.wood.add(U.cyl, dim(tim, 0.8), TRS(0.2, 2.18, -0.09, 0.32, 0.06, 0.32, 0, Math.PI / 2)); // the pulley wheel
|
|
91
|
+
stick(B.cloth, [0.2, 2.06, 0], [0.2, 0.3, 0], 0.012, HEMP); // the rope into the shaft
|
|
92
|
+
stick(B.cloth, [0.2, 2.06, 0], [1.5, 0.4, 0.7], 0.012, HEMP); // and its end to the bucket
|
|
93
|
+
B.cloth.add(U.taper, C(0x5a3a24, 0.1, R), TRS(1.5, 0.38, 0.7, 0.42, 0.38, 0.42, 0, Math.PI)); // the bucket, wide mouth up
|
|
94
|
+
B.cloth.add(U.cyl16, [0.03, 0.035, 0.04], TRS(1.5, 0.34, 0.7, 0.36, 0.01, 0.36));
|
|
95
|
+
}
|
|
96
|
+
function propPlankTrough(B, R) {
|
|
97
|
+
// a plank trough on two stones, its water dark in it, and the wet ground before it where the beasts stand; front is +z
|
|
98
|
+
const wood = C(0x6a5034, 0.1, R);
|
|
99
|
+
B.wood.box(0, 0.12, 0, 2.4, 0.06, 0.56, dim(wood, 0.85));
|
|
100
|
+
for (const sz of [-1, 1]) B.wood.box(0, 0.12, sz * 0.26, 2.4, 0.34, 0.05, wood, 0, sz * 0.08);
|
|
101
|
+
for (const sx of [-1, 1]) B.wood.box(sx * 1.18, 0.12, 0, 0.05, 0.34, 0.5, dim(wood, 0.9));
|
|
102
|
+
B.cloth.box(0, 0.38, 0, 2.3, 0.02, 0.44, [0.04, 0.05, 0.055]); // the water, nearly to the brim
|
|
103
|
+
for (const sx of [-1, 1]) B.stone.add(U.rock, C(0x8a7a62, 0.1, R), TRS(sx * 0.95, -0.08, 0, 0.45, 0.28, 0.6, R() * 3));
|
|
104
|
+
B.stone.add(U.cyl16, [0.1, 0.09, 0.075], TRS(0, -0.02, 0.7, 3.2, 0.03, 1.2));
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function propWoodpile(B, R, n = 9) {
|
|
108
|
+
// split cordwood stacked between stakes, a chopping block and its axe
|
|
109
|
+
const wd = [0x6a5540, 0x5a4632, 0x77614a];
|
|
110
|
+
for (let j = 0; j < 5; j++)
|
|
111
|
+
for (let i = 0; i < n - (j > 2 ? j - 2 : 0); i++) {
|
|
112
|
+
const c = C(pickR(R, wd), 0.18, R);
|
|
113
|
+
B.wood.add(
|
|
114
|
+
U.cyl6,
|
|
115
|
+
c,
|
|
116
|
+
TRS(
|
|
117
|
+
(i - n / 2 + 0.5 + (j % 2) * 0.5) * 0.3,
|
|
118
|
+
0.14 + j * 0.25,
|
|
119
|
+
-0.55 + (R() - 0.5) * 0.08,
|
|
120
|
+
0.27 + R() * 0.05,
|
|
121
|
+
1.1,
|
|
122
|
+
0.26,
|
|
123
|
+
0,
|
|
124
|
+
Math.PI / 2,
|
|
125
|
+
),
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
for (const sx of [-1, 1]) B.wood.box(sx * (n * 0.15 + 0.12), -0.2, 0, 0.08, 1.6, 0.08, C(0x4a3a2a));
|
|
129
|
+
B.wood.add(U.cyl, C(0x5a4632), TRS(n * 0.15 + 1.2, -0.1, 0.5, 0.6, 0.6, 0.6));
|
|
130
|
+
stick(B.wood, [n * 0.15 + 1.2, 0.5, 0.5], [n * 0.15 + 1.75, 0.95, 0.42], 0.035, C(0x6a5540), U.box);
|
|
131
|
+
B.cloth.box(n * 0.15 + 1.2, 0.5, 0.5, 0.06, 0.2, 0.26, [0.3, 0.31, 0.33], 0.2);
|
|
132
|
+
for (let q = 0; q < 5; q++)
|
|
133
|
+
B.wood.add(
|
|
134
|
+
U.cyl6,
|
|
135
|
+
C(pickR(R, wd), 0.2, R),
|
|
136
|
+
TRS(n * 0.15 + 0.6 + R() * 1.4, 0.02, 0.9 + R() * 0.8, 0.22, 0.5, 0.2, R() * 6, Math.PI / 2),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
function propBrazier(B, R) {
|
|
140
|
+
// a watch brazier: an iron basket on three legs, dung coals banked in it
|
|
141
|
+
const iron = [0.03, 0.03, 0.032];
|
|
142
|
+
for (let k = 0; k < 3; k++)
|
|
143
|
+
stick(
|
|
144
|
+
B.cloth,
|
|
145
|
+
[Math.cos(k * 2.094) * 0.42, 0, Math.sin(k * 2.094) * 0.42],
|
|
146
|
+
[Math.cos(k * 2.094) * 0.22, 0.8, Math.sin(k * 2.094) * 0.22],
|
|
147
|
+
0.035,
|
|
148
|
+
iron,
|
|
149
|
+
U.box,
|
|
150
|
+
);
|
|
151
|
+
B.cloth.add(U.cyl6, iron, TRS(0, 0.74, 0, 0.62, 0.3, 0.62));
|
|
152
|
+
B.cloth.add(U.cyl6, iron, TRS(0, 0.62, 0, 0.4, 0.14, 0.4));
|
|
153
|
+
B.cloth.add(U.sph, [0.2, 0.05, 0.02], TRS(0, 0.96, 0, 0.5, 0.22, 0.5));
|
|
154
|
+
B.cloth.add(U.sph, [0.05, 0.04, 0.035], TRS(0.08, 1.0, 0.05, 0.3, 0.16, 0.34));
|
|
155
|
+
}
|
|
156
|
+
// A horse standing at a picket line, head up or down at its fodder: the horse a rider sits, cast where it stands.
|
|
157
|
+
function propHorseUp(into, x, y, z, yaw, col, R, graze) {
|
|
158
|
+
stillHorse(into, x, y, z, yaw, col, R, graze);
|
|
159
|
+
}
|
|
160
|
+
function propRaven(gb, x, y, z, yaw, s) {
|
|
161
|
+
// a raven on the ground or a perch
|
|
162
|
+
const k = [0.016, 0.016, 0.02],
|
|
163
|
+
sn = Math.sin(yaw),
|
|
164
|
+
cs = Math.cos(yaw);
|
|
165
|
+
gb.add(U.sph, k, TRS(x, y + 0.08 * s, z, 0.3 * s, 0.32 * s, 0.6 * s, yaw, -0.5));
|
|
166
|
+
gb.add(U.sph, k, TRS(x + sn * 0.25 * s, y + 0.4 * s, z + cs * 0.25 * s, 0.2 * s, 0.2 * s, 0.22 * s));
|
|
167
|
+
gb.add(
|
|
168
|
+
U.cone6,
|
|
169
|
+
[0.05, 0.05, 0.05],
|
|
170
|
+
TRS(x + sn * 0.33 * s, y + 0.49 * s, z + cs * 0.33 * s, 0.07 * s, 0.24 * s, 0.07 * s, yaw, Math.PI / 2 + 0.25),
|
|
171
|
+
);
|
|
172
|
+
gb.box(x - sn * 0.36 * s, y + 0.02 * s, z - cs * 0.36 * s, 0.17 * s, 0.03 * s, 0.4 * s, k, yaw, 0.5);
|
|
173
|
+
}
|
|
174
|
+
return { fodderStack, propBrazier, propCookfire, propDesertWell, propHorseUp, propPlankTrough, propRack, propRaven, propWoodpile };
|
|
175
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// A door's leaf of planks bound with black iron, hung in a doorway a world builds. Worker-safe.
|
|
2
|
+
import { dim } from '../math/color.js';
|
|
3
|
+
import { C, TRS } from './primitives.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The door props, bound to a world's shapes and hash.
|
|
7
|
+
* @param {object} o
|
|
8
|
+
* @param {object} o.shapes - The unit shapes (`createUnitShapes`).
|
|
9
|
+
* @param {Function} o.hash - The world's hash (`createHash`), which shades each plank.
|
|
10
|
+
* @returns {{strappedDoor: Function}} `strappedDoor(builder, R, x, z, width, height)`: the leaf into one builder, its hinge at
|
|
11
|
+
* (x, z) of the builder's frame (the west jamb), metres.
|
|
12
|
+
*/
|
|
13
|
+
export function createDoorProps({ shapes: U, hash: hash2 }) {
|
|
14
|
+
// The door's leaf into builder b, its hinge at (x, z) of b's frame (the west jamb): planks bound with black iron.
|
|
15
|
+
function strappedDoor(b, rng, x, z, w, h) {
|
|
16
|
+
const oak = C(0x2e241c, 0.06, rng),
|
|
17
|
+
iron = [0.03, 0.03, 0.034];
|
|
18
|
+
for (let p = 0; p < 5; p++) b.box(x + (p + 0.5) * (w / 5), 0, z, w / 5 - 0.012, h, 0.12, dim(oak, 0.8 + 0.3 * hash2(p, 5, 974)));
|
|
19
|
+
for (const y of [0.35, h / 2, h - 0.35]) b.box(x + w / 2, y, z + 0.07, w - 0.06, 0.12, 0.03, iron);
|
|
20
|
+
const latchX = x + w - 0.22,
|
|
21
|
+
wornIron = [0.16, 0.15, 0.13];
|
|
22
|
+
b.add(U.cyl6, iron, TRS(latchX, 1.15, z + 0.1, 0.16, 0.05, 0.16, 0, Math.PI / 2));
|
|
23
|
+
b.box(latchX - 0.07, 1.15, z + 0.15, 0.21, 0.035, 0.055, wornIron);
|
|
24
|
+
}
|
|
25
|
+
return { strappedDoor };
|
|
26
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
// The furniture of a quay: sheer-legs with their windlass, and nets hung to dry on a rack. Each is built into a house kit's
|
|
2
|
+
// builders round the kit frame's origin, the water to +z. Worker-safe.
|
|
3
|
+
import { dim } from '../math/color.js';
|
|
4
|
+
import { pickR } from '../math/random.js';
|
|
5
|
+
import { C, TRS, stick } from './primitives.js';
|
|
6
|
+
import { HOUSE_PALETTE } from './house-kit-palette.js';
|
|
7
|
+
import { sackLying } from './prop-sacks.js';
|
|
8
|
+
import { sampleSurface as surf } from './sampled-surface.js';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The harbour props, bound to a world's shapes and palette.
|
|
12
|
+
* @param {object} o
|
|
13
|
+
* @param {object} o.shapes - The unit shapes (`createUnitShapes`).
|
|
14
|
+
* @param {object} [o.palette] - The house palette (`hemp` for rope, `cloths` and `awnings`, sRGB hex choices); a house kit's
|
|
15
|
+
* `palette`, or the kit's default (`HOUSE_PALETTE`).
|
|
16
|
+
* @returns {object} `propCrane(B, R, quarry)` (a quarry's lifts stone, not sacks) and `propNetRack(B, R)`.
|
|
17
|
+
*/
|
|
18
|
+
export function createHarbourProps({ shapes: U, palette = HOUSE_PALETTE }) {
|
|
19
|
+
const { hemp: HEMP } = palette;
|
|
20
|
+
// Sheer-legs on the quay, +z the water: two tapering poles of weathered timber standing in stone shoes, leaning out over the
|
|
21
|
+
// edge and lashed where they cross; two guys back to rings in the paving; a block hung from the lashing, its fall down to the
|
|
22
|
+
// hook and a sling of sacks, and the hauling part back to a windlass on its trestles, worked by handspikes.
|
|
23
|
+
const CRANE = { head: [0, 6.9, 2.5], feet: 1.5, guyBack: 6.2, guySpread: 2.4, load: 2.1 }; // metres
|
|
24
|
+
function propCrane(B, R, quarry = false) {
|
|
25
|
+
const tim = C(0x7a6a56, 0.1, R),
|
|
26
|
+
iron = [0.05, 0.05, 0.055],
|
|
27
|
+
[hx, hy, hz] = CRANE.head;
|
|
28
|
+
for (const sx of [-1, 1]) {
|
|
29
|
+
stick(B.wood, [sx * CRANE.feet, 0.1, 0], [sx * 0.12, hy + 0.35, hz + 0.05], 0.32, dim(tim, 0.95 + sx * 0.05), U.taper);
|
|
30
|
+
B.stone.box(sx * CRANE.feet, -0.1, 0, 0.7, 0.34, 0.7, C(0x6a645a, 0.05, R)); // its shoe
|
|
31
|
+
B.trim.add(U.cyl6, iron, TRS(sx * CRANE.feet, 0.18, 0, 0.36, 0.08, 0.36)); // the iron band at its foot
|
|
32
|
+
const ring = [sx * CRANE.guySpread, 0.02, -CRANE.guyBack];
|
|
33
|
+
stick(B.trim, [hx, hy + 0.15, hz - 0.1], ring, 0.03, HEMP, U.box); // a guy
|
|
34
|
+
B.trim.add(U.cyl6, iron, TRS(ring[0], -0.02, ring[2], 0.24, 0.06, 0.24));
|
|
35
|
+
}
|
|
36
|
+
for (let k = 0; k < 5; k++) B.trim.add(U.cyl6, HEMP, TRS(hx, hy - 0.05 + k * 0.07, hz, 0.42, 0.06, 0.42, 0, 0.35, 0)); // the lashing
|
|
37
|
+
// the block: its wooden shell in an iron strop, the sheave showing at its sides
|
|
38
|
+
B.trim.box(hx, hy - 0.55, hz, 0.05, 0.5, 0.05, iron);
|
|
39
|
+
B.wood.box(hx, hy - 1.05, hz, 0.2, 0.5, 0.32, dim(tim, 0.8));
|
|
40
|
+
B.trim.add(U.cyl16, dim(tim, 0.6), TRS(hx - 0.11, hy - 0.8, hz, 0.26, 0.02, 0.26, 0, 0, Math.PI / 2));
|
|
41
|
+
// the fall to the hook, the sling and its two sacks
|
|
42
|
+
const hook = [hx, CRANE.load + 1.0, hz];
|
|
43
|
+
stick(B.trim, [hx, hy - 1.05, hz + 0.08], hook, 0.03, HEMP, U.box);
|
|
44
|
+
B.trim.add(U.cone6, iron, TRS(hook[0], hook[1] - 0.22, hook[2], 0.12, 0.22, 0.12, 0, Math.PI, 0));
|
|
45
|
+
B.trim.add(U.cyl6, iron, TRS(hook[0], hook[1] - 0.3, hook[2], 0.14, 0.04, 0.14, 0, Math.PI / 2, 0));
|
|
46
|
+
for (const sx of [-0.32, 0.32]) {
|
|
47
|
+
stick(B.trim, [hook[0], hook[1] - 0.28, hook[2]], [sx, CRANE.load + (quarry ? 0.5 : 0.3), hz + 0.05], 0.025, HEMP, U.box);
|
|
48
|
+
stick(B.trim, [sx, CRANE.load + (quarry ? 0.5 : 0.3), hz + 0.05], [sx, CRANE.load - 0.02, hz + 0.05], 0.025, HEMP, U.box);
|
|
49
|
+
}
|
|
50
|
+
if (quarry) B.stone.box(hx, CRANE.load - 0.02, hz, 0.76, 0.52, 0.68, C(0xa49a84, 0.07, R));
|
|
51
|
+
else
|
|
52
|
+
for (let k = 0; k < 2; k++)
|
|
53
|
+
sackLying(
|
|
54
|
+
B.cloth,
|
|
55
|
+
C(0x8a7a5a, 0.12, R),
|
|
56
|
+
0,
|
|
57
|
+
CRANE.load + k * 0.3,
|
|
58
|
+
hz + (k - 0.5) * 0.08,
|
|
59
|
+
Math.PI / 2 + (k - 0.5) * 0.2,
|
|
60
|
+
0.85,
|
|
61
|
+
0.48,
|
|
62
|
+
0.32,
|
|
63
|
+
);
|
|
64
|
+
// the hauling part from the block back to the windlass: a drum on two trestles, the rope wound on it, handspikes in its head
|
|
65
|
+
const wz = -1.6,
|
|
66
|
+
wy = 1.0;
|
|
67
|
+
stick(B.trim, [hx, hy - 0.85, hz - 0.1], [-0.2, wy + 0.18, wz], 0.03, HEMP, U.box);
|
|
68
|
+
for (const sx of [-0.75, 0.75]) {
|
|
69
|
+
stick(B.wood, [sx, 0, wz - 0.45], [sx, wy + 0.05, wz], 0.12, tim, U.box);
|
|
70
|
+
stick(B.wood, [sx, 0, wz + 0.45], [sx, wy + 0.05, wz], 0.12, tim, U.box);
|
|
71
|
+
B.wood.box(sx, 0, wz, 0.12, 0.1, 1.0, dim(tim, 0.85));
|
|
72
|
+
}
|
|
73
|
+
B.wood.add(U.cyl, dim(tim, 1.1), TRS(-0.85, wy, wz, 0.32, 1.7, 0.32, 0, 0, -Math.PI / 2));
|
|
74
|
+
const coil = dim(HEMP, 0.72); // rope wound on, darkened by handling and tar
|
|
75
|
+
B.cloth.add(U.cyl16, coil, TRS(-0.45, wy, wz, 0.4, 0.75, 0.4, 0, 0, -Math.PI / 2));
|
|
76
|
+
for (let k = 0; k < 6; k++)
|
|
77
|
+
B.cloth.add(U.cyl16, dim(coil, 0.85 + (k % 2) * 0.2), TRS(-0.42 + k * 0.13, wy, wz, 0.43, 0.06, 0.43, 0, 0, -Math.PI / 2)); // its turns
|
|
78
|
+
for (const x of [-0.51, 0.3]) B.wood.add(U.cyl16, dim(tim, 0.9), TRS(x, wy, wz, 0.56, 0.06, 0.56, 0, 0, -Math.PI / 2)); // the drum's flanges
|
|
79
|
+
for (let k = 0; k < 4; k++) {
|
|
80
|
+
const a = k * (Math.PI / 2) + 0.3;
|
|
81
|
+
stick(B.wood, [0.82, wy, wz], [0.82, wy + Math.sin(a) * 0.75, wz + Math.cos(a) * 0.75], 0.05, dim(tim, 1.15));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function propNetRack(B, R) {
|
|
85
|
+
// nets hung to dry over a pole between two posts, cork floats along their head-ropes
|
|
86
|
+
const tim = C(0x4a3a2a, 0.15, R),
|
|
87
|
+
net = C(pickR(R, [0x4a4436, 0x3e3a30, 0x55503e]), 0.1, R);
|
|
88
|
+
for (const sx of [-1.6, 1.6]) B.wood.box(sx, -0.2, 0, 0.14, 2.2, 0.14, tim);
|
|
89
|
+
B.wood.add(U.cyl6, tim, TRS(-1.75, 1.95, 0, 0.1, 3.5, 0.1, 0, 0, -Math.PI / 2));
|
|
90
|
+
for (const sg of [-1, 1])
|
|
91
|
+
surf(
|
|
92
|
+
B.cloth,
|
|
93
|
+
6,
|
|
94
|
+
3,
|
|
95
|
+
(u, v) => [(u - 0.5) * 3.1, 1.95 - v * (1.6 + 0.2 * Math.sin(u * 9)), sg * (0.04 + v * 0.35) + Math.sin(u * 7 + v * 3) * 0.06],
|
|
96
|
+
net,
|
|
97
|
+
{ flip: sg > 0, back: dim(net, 0.7) },
|
|
98
|
+
);
|
|
99
|
+
for (let k = 0; k < 7; k++) B.cloth.add(U.sph, C(0xb09a6a, 0.1, R), TRS(-1.35 + k * 0.45, 1.92, 0.08, 0.12, 0.09, 0.12));
|
|
100
|
+
B.cloth.add(U.cyl16, net, TRS(1.2, 0, 1.0, 1.4, 0.35, 1.2, R() * 3));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// A boat of the harbours and shores from the ship kit, `len` metres long, of the kind a harbour has at that length (boatSpec);
|
|
104
|
+
return { propCrane, propNetRack };
|
|
105
|
+
}
|