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/hair-gathers.js
CHANGED
|
@@ -13,11 +13,18 @@ function through(rings, k, t) {
|
|
|
13
13
|
const last = rings.length - 1,
|
|
14
14
|
i = Math.min(last - 1, Math.floor(t)),
|
|
15
15
|
f = t - i,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return
|
|
16
|
+
previousValue = rings[Math.max(0, i - 1)][k],
|
|
17
|
+
startValue = rings[i][k],
|
|
18
|
+
endValue = rings[i + 1][k],
|
|
19
|
+
nextValue = rings[Math.min(last, i + 2)][k];
|
|
20
|
+
return (
|
|
21
|
+
startValue +
|
|
22
|
+
0.5 *
|
|
23
|
+
f *
|
|
24
|
+
(endValue -
|
|
25
|
+
previousValue +
|
|
26
|
+
f * (2 * previousValue - 5 * startValue + 4 * endValue - nextValue + f * (3 * (startValue - endValue) + nextValue - previousValue)))
|
|
27
|
+
);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
// The ring a rope begins with, above its first: drawn in to a point.
|
|
@@ -29,12 +36,12 @@ const shut = ring => [ring[0] + ring[1] * 0.8, ring[1] * SHUT, ring[2] * SHUT, r
|
|
|
29
36
|
// y) (its thickness there, of the rings'), hem(a) (how much lower its end hangs there, metres), lean (how far its strands slant:
|
|
30
37
|
// the way across them goes so much round for each metre down), from (the strand its first side lies at), root (how dark it is
|
|
31
38
|
// where it begins, if not as dark as hair that is gathered).
|
|
32
|
-
function hang(patch, rings,
|
|
33
|
-
const open =
|
|
39
|
+
function hang(patch, rings, options) {
|
|
40
|
+
const open = options.a1 !== undefined;
|
|
34
41
|
if (!open) rings = [shut(rings[0]), ...rings];
|
|
35
|
-
const { rows, sides, colour } =
|
|
36
|
-
a0 =
|
|
37
|
-
a1 =
|
|
42
|
+
const { rows, sides, colour } = options,
|
|
43
|
+
a0 = options.a0 ?? 0,
|
|
44
|
+
a1 = options.a1 ?? TAU,
|
|
38
45
|
first = patch.points.length / POINT,
|
|
39
46
|
spans = rings.length - 1,
|
|
40
47
|
at = (i, j) => first + i * (sides + 1) + j,
|
|
@@ -48,13 +55,13 @@ function hang(patch, rings, o) {
|
|
|
48
55
|
const v = i / rows,
|
|
49
56
|
t = v * spans;
|
|
50
57
|
for (let j = 0; j <= sides; j++) {
|
|
51
|
-
const
|
|
52
|
-
y = through(rings, 0, t) - (
|
|
53
|
-
k =
|
|
58
|
+
const angle = a0 + ((a1 - a0) * j) / sides,
|
|
59
|
+
y = through(rings, 0, t) - (options.hem ? options.hem(angle) * v * v : 0),
|
|
60
|
+
k = options.swell ? options.swell(v, angle, y) : 1;
|
|
54
61
|
place.push(
|
|
55
|
-
through(rings, 3, t) + Math.cos(
|
|
62
|
+
through(rings, 3, t) + Math.cos(angle) * through(rings, 1, t) * k,
|
|
56
63
|
y,
|
|
57
|
-
through(rings, 4, t) + Math.sin(
|
|
64
|
+
through(rings, 4, t) + Math.sin(angle) * through(rings, 2, t) * k,
|
|
58
65
|
);
|
|
59
66
|
}
|
|
60
67
|
}
|
|
@@ -66,8 +73,8 @@ function hang(patch, rings, o) {
|
|
|
66
73
|
r = (i * (sides + 1) + wrap(j + 1)) * 3,
|
|
67
74
|
up = (Math.max(0, i - 1) * (sides + 1) + j) * 3,
|
|
68
75
|
down = (Math.min(rows, i + 1) * (sides + 1) + j) * 3,
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
vertexOffset = (i * (sides + 1) + j) * 3,
|
|
77
|
+
angle = a0 + ((a1 - a0) * j) / sides,
|
|
71
78
|
v = i / rows,
|
|
72
79
|
tx = place[r] - place[l],
|
|
73
80
|
ty = place[r + 1] - place[l + 1],
|
|
@@ -79,22 +86,22 @@ function hang(patch, rings, o) {
|
|
|
79
86
|
ny = tz * ux - tx * uz,
|
|
80
87
|
nz = tx * uy - ty * ux;
|
|
81
88
|
const length = Math.hypot(nx, ny, nz) || 1,
|
|
82
|
-
out = nx * Math.cos(
|
|
83
|
-
tone = (
|
|
89
|
+
out = nx * Math.cos(angle) + nz * Math.sin(angle) < 0 ? -1 : 1,
|
|
90
|
+
tone = (options.tone ? options.tone(v, angle) : 1) * lerp(options.root ?? ROOT_SHADE, 1, sstep(0, 0.35, v));
|
|
84
91
|
nx *= out / length;
|
|
85
92
|
ny *= out / length;
|
|
86
93
|
nz *= out / length;
|
|
87
94
|
patch.points.push(
|
|
88
|
-
place[
|
|
89
|
-
place[
|
|
90
|
-
place[
|
|
95
|
+
place[vertexOffset],
|
|
96
|
+
place[vertexOffset + 1],
|
|
97
|
+
place[vertexOffset + 2],
|
|
91
98
|
nx,
|
|
92
99
|
ny,
|
|
93
100
|
nz,
|
|
94
101
|
colour[0] * tone,
|
|
95
102
|
colour[1] * tone,
|
|
96
103
|
colour[2] * tone,
|
|
97
|
-
(
|
|
104
|
+
(options.from || 0) + (round * j) / sides + (options.lean || 0) * (rings[0][0] - place[vertexOffset + 1]),
|
|
98
105
|
);
|
|
99
106
|
if (i < rows && j < sides) patch.triangles.push(at(i, j), at(i + 1, j), at(i + 1, j + 1), at(i, j), at(i + 1, j + 1), at(i, j + 1));
|
|
100
107
|
}
|
|
@@ -103,21 +110,22 @@ function hang(patch, rings, o) {
|
|
|
103
110
|
// A plait hanging: two halves side by side, their strands slanting in to the line between them, each turn of the plait
|
|
104
111
|
// standing out on one side and then the other. turn: the height of one turn (metres); side: which way it faces (the angle of
|
|
105
112
|
// the line between its halves, as a loft counts angles).
|
|
106
|
-
function plait(patch, rings,
|
|
113
|
+
function plait(patch, rings, options) {
|
|
107
114
|
rings = [shut(rings[0]), ...rings];
|
|
108
|
-
const turns = Math.max(1, Math.round((rings[0][0] - rings[rings.length - 1][0]) /
|
|
115
|
+
const turns = Math.max(1, Math.round((rings[0][0] - rings[rings.length - 1][0]) / options.turn)),
|
|
109
116
|
rows = turns * PLAIT_ROWS;
|
|
110
117
|
for (const half of [-1, 1])
|
|
111
118
|
hang(patch, rings, {
|
|
112
|
-
...
|
|
119
|
+
...options,
|
|
113
120
|
rows,
|
|
114
|
-
sides:
|
|
115
|
-
a0:
|
|
116
|
-
a1:
|
|
121
|
+
sides: options.sides >> 1,
|
|
122
|
+
a0: options.side + (half < 0 ? -Math.PI : 0),
|
|
123
|
+
a1: options.side + (half < 0 ? 0 : Math.PI),
|
|
117
124
|
lean: (half * PLAIT_LEAN) / STRANDS.span,
|
|
118
|
-
from: (
|
|
119
|
-
swell: (v,
|
|
120
|
-
|
|
125
|
+
from: (options.from || 0) + half,
|
|
126
|
+
swell: (v, angle) =>
|
|
127
|
+
1 + PLAIT_SWELL * half * Math.cos(v * turns * TAU) * Math.sin(Math.abs(angle - options.side)) * sstep(0, 0.06, v),
|
|
128
|
+
tone: (v, angle) => 0.72 + 0.28 * Math.sin(Math.abs(angle - options.side)),
|
|
121
129
|
});
|
|
122
130
|
}
|
|
123
131
|
|
|
@@ -129,10 +137,10 @@ function knot(patch, place, at, size, colour, rows, sides) {
|
|
|
129
137
|
for (let i = 0; i <= rows; i++)
|
|
130
138
|
for (let j = 0; j <= sides; j++) {
|
|
131
139
|
const polar = (i / rows) * Math.PI,
|
|
132
|
-
|
|
133
|
-
nx = Math.sin(polar) * Math.cos(
|
|
140
|
+
angle = (j / sides) * TAU,
|
|
141
|
+
nx = Math.sin(polar) * Math.cos(angle),
|
|
134
142
|
ny = Math.cos(polar),
|
|
135
|
-
nz = Math.sin(polar) * Math.sin(
|
|
143
|
+
nz = Math.sin(polar) * Math.sin(angle),
|
|
136
144
|
tone = 0.8 + 0.2 * ny,
|
|
137
145
|
v = place([at[0] + nx * size[0], at[1] + ny * size[1], at[2] + nz * size[2], nx / size[0], ny / size[1], nz / size[2]]);
|
|
138
146
|
patch.points.push(
|
|
@@ -148,13 +156,20 @@ function knot(patch, place, at, size, colour, rows, sides) {
|
|
|
148
156
|
(round * j) / sides + 0.35 * (i / rows),
|
|
149
157
|
);
|
|
150
158
|
if (i < rows && j < sides) {
|
|
151
|
-
const
|
|
152
|
-
patch.triangles.push(
|
|
159
|
+
const vertexIndex = first + i * (sides + 1) + j;
|
|
160
|
+
patch.triangles.push(
|
|
161
|
+
vertexIndex,
|
|
162
|
+
vertexIndex + sides + 1,
|
|
163
|
+
vertexIndex + sides + 2,
|
|
164
|
+
vertexIndex,
|
|
165
|
+
vertexIndex + sides + 2,
|
|
166
|
+
vertexIndex + 1,
|
|
167
|
+
);
|
|
153
168
|
}
|
|
154
169
|
}
|
|
155
170
|
}
|
|
156
171
|
|
|
157
|
-
// The fall of long hair down the back as a near head wears it: the
|
|
172
|
+
// The fall of long hair down the back as a near head wears it: the distant fall's rings (fallShape: [height, half-
|
|
158
173
|
// width, half-depth, middle]), but beginning on the mass of the hair itself, where the long locks leave the head, instead of
|
|
159
174
|
// standing off it. crown: the ring of the mass there. Returns the rings, and at(y): the fall's half-width, half-depth and
|
|
160
175
|
// middle at a height.
|
|
@@ -163,10 +178,10 @@ function nearFallRings(rings, crown) {
|
|
|
163
178
|
at = y => {
|
|
164
179
|
let i = 0;
|
|
165
180
|
while (i < fallen.length - 2 && y < fallen[i + 1][0]) i++;
|
|
166
|
-
const
|
|
167
|
-
|
|
168
|
-
t = Math.min(1, Math.max(0, (y -
|
|
169
|
-
return [lerp(
|
|
181
|
+
const upperRing = fallen[i],
|
|
182
|
+
lowerRing = fallen[i + 1],
|
|
183
|
+
t = Math.min(1, Math.max(0, (y - upperRing[0]) / (lowerRing[0] - upperRing[0])));
|
|
184
|
+
return [lerp(upperRing[1], lowerRing[1], t), lerp(upperRing[2], lowerRing[2], t), lerp(upperRing[3], lowerRing[3], t)];
|
|
170
185
|
};
|
|
171
186
|
return { rings: fallen, at };
|
|
172
187
|
}
|
package/geometry/hair-locks.js
CHANGED
|
@@ -4,7 +4,7 @@ import { STRANDS } from './hair-tags.js';
|
|
|
4
4
|
import { POINT } from './hair-patch.js';
|
|
5
5
|
|
|
6
6
|
// ════════════════════════════════════════════════════════════════════════
|
|
7
|
-
// Locks of a near head's hair. A lock is a narrow strip that lies on the
|
|
7
|
+
// Locks of a near head's hair. A lock is a narrow strip that lies on the base hair mass along the lie of the
|
|
8
8
|
// cut and curves with it, each a little over the one below as hair lies in layers, lifting only toward its tip; a lock of
|
|
9
9
|
// long hair is combed over the head and hangs over the fall behind. It is drawn as a ribbon that comes to a point, rounded by
|
|
10
10
|
// its normals, its strands running on to its edge. Lengths are metres from the head's middle.
|
|
@@ -28,17 +28,17 @@ const _p = new THREE.Vector3(),
|
|
|
28
28
|
_dir = new THREE.Vector3();
|
|
29
29
|
|
|
30
30
|
// Moves a point off the neck and the shoulders (o.neck: how far from the neck's axis; o.shoulder: half the shoulders' breadth).
|
|
31
|
-
function clearNeck(
|
|
32
|
-
if (
|
|
33
|
-
if (
|
|
34
|
-
const low = sstep(-0.14, -0.215,
|
|
35
|
-
rx = lerp(
|
|
36
|
-
rz = lerp(
|
|
37
|
-
z =
|
|
38
|
-
q = Math.hypot(
|
|
31
|
+
function clearNeck(point, options) {
|
|
32
|
+
if (point.y < HAIRLINE && point.z > FACE_EDGE) point.z = FACE_EDGE;
|
|
33
|
+
if (point.y >= -0.075) return;
|
|
34
|
+
const low = sstep(-0.14, -0.215, point.y),
|
|
35
|
+
rx = lerp(options.neck, options.shoulder + 0.035, low),
|
|
36
|
+
rz = lerp(options.neck, SHOULDER_DEEP, low),
|
|
37
|
+
z = point.z + 0.012,
|
|
38
|
+
q = Math.hypot(point.x / rx, z / rz);
|
|
39
39
|
if (q < 1) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
point.x /= q;
|
|
41
|
+
point.z = z / q - 0.012;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
@@ -47,22 +47,22 @@ function clearNeck(p, o) {
|
|
|
47
47
|
// segs, base, rise and tip (its lift off the mass at the root, how much more by its end, and how far its tip stands up besides,
|
|
48
48
|
// metres), wave and coil (how far it winds from side to side and how fast), curl (how far it turns at each step, one way),
|
|
49
49
|
// phase, neck and shoulder.
|
|
50
|
-
function layLock(mass, root,
|
|
50
|
+
function layLock(mass, root, options) {
|
|
51
51
|
const points = [],
|
|
52
|
-
step =
|
|
52
|
+
step = options.length / options.segs;
|
|
53
53
|
_dir.copy(root);
|
|
54
|
-
for (let i = 0; i <=
|
|
55
|
-
const u = i /
|
|
56
|
-
lift =
|
|
54
|
+
for (let i = 0; i <= options.segs; i++) {
|
|
55
|
+
const u = i / options.segs,
|
|
56
|
+
lift = options.base + options.rise * u + options.tip * u * u * u;
|
|
57
57
|
mass.at(_dir, lift, _p, _n);
|
|
58
|
-
clearNeck(_p,
|
|
58
|
+
clearNeck(_p, options);
|
|
59
59
|
points.push([_p.x, _p.y, _p.z, _n.x, _n.y, _n.z, lift]);
|
|
60
|
-
if (i ===
|
|
61
|
-
|
|
62
|
-
_f.x +=
|
|
63
|
-
_f.z +=
|
|
60
|
+
if (i === options.segs) break;
|
|
61
|
+
options.flow(_dir, _f);
|
|
62
|
+
_f.x += options.aside[0];
|
|
63
|
+
_f.z += options.aside[1];
|
|
64
64
|
_f.addScaledVector(_n, -_f.dot(_n)).normalize();
|
|
65
|
-
const turn = (
|
|
65
|
+
const turn = (options.wave || 0) * Math.sin(options.phase + i * options.coil) + (options.curl || 0) * (i + 0.5);
|
|
66
66
|
if (turn) _f.applyAxisAngle(_n, turn);
|
|
67
67
|
mass.at(_dir, 0, _q).addScaledVector(_f, step);
|
|
68
68
|
mass.skull.under(_q.x, _q.y, _q.z, _dir);
|
|
@@ -74,16 +74,16 @@ function layLock(mass, root, o) {
|
|
|
74
74
|
// nape, then hanging over the fall of hair down the back. o: round (where round the fall it hangs, as the fall counts angles),
|
|
75
75
|
// shape(y) (the fall's half-width, half-depth and middle at a height), from (the height at which it leaves the head, as a
|
|
76
76
|
// share of the head's), end (how low it hangs), combed and segs (its lengths over the head and hanging), lift (metres off the mass), sway and phase (how it wavers as it hangs).
|
|
77
|
-
function hangLock(mass, root,
|
|
77
|
+
function hangLock(mass, root, options) {
|
|
78
78
|
const points = [];
|
|
79
|
-
_d.set(Math.cos(
|
|
80
|
-
_d.y =
|
|
81
|
-
for (let i = 0; i <=
|
|
82
|
-
const lift = 0.001 +
|
|
79
|
+
_d.set(Math.cos(options.round), 0, Math.sin(options.round)).multiplyScalar(Math.sqrt(1 - options.from * options.from));
|
|
80
|
+
_d.y = options.from;
|
|
81
|
+
for (let i = 0; i <= options.combed; i++) {
|
|
82
|
+
const lift = 0.001 + options.lift * Math.sin((i / options.combed) * Math.PI * 0.5);
|
|
83
83
|
mass.at(
|
|
84
84
|
_s
|
|
85
85
|
.copy(root)
|
|
86
|
-
.lerp(_d, i /
|
|
86
|
+
.lerp(_d, i / options.combed)
|
|
87
87
|
.normalize(),
|
|
88
88
|
lift,
|
|
89
89
|
_p,
|
|
@@ -92,14 +92,14 @@ function hangLock(mass, root, o) {
|
|
|
92
92
|
points.push([_p.x, _p.y, _p.z, _n.x, _n.y, _n.z, lift]);
|
|
93
93
|
}
|
|
94
94
|
const top = _p.y;
|
|
95
|
-
for (let j = 1; j <=
|
|
96
|
-
const t = j /
|
|
97
|
-
y = lerp(top,
|
|
98
|
-
[rx, rz, cz] =
|
|
99
|
-
|
|
95
|
+
for (let j = 1; j <= options.segs; j++) {
|
|
96
|
+
const t = j / options.segs,
|
|
97
|
+
y = lerp(top, options.end, t),
|
|
98
|
+
[rx, rz, cz] = options.shape(y),
|
|
99
|
+
angle = options.round + options.sway * Math.sin(options.phase + j * 1.3) * t,
|
|
100
100
|
out = 0.004 + 0.006 * t;
|
|
101
|
-
_n.set(Math.cos(
|
|
102
|
-
points.push([Math.cos(
|
|
101
|
+
_n.set(Math.cos(angle) / rx, 0.6, Math.sin(angle) / rz).normalize();
|
|
102
|
+
points.push([Math.cos(angle) * (rx + out), y, cz + Math.sin(angle) * (rz + out), _n.x, _n.y, _n.z, FREE]);
|
|
103
103
|
}
|
|
104
104
|
return points;
|
|
105
105
|
}
|
|
@@ -111,18 +111,18 @@ function drawLock(patch, place, mass, points, half, colour, tone, strand) {
|
|
|
111
111
|
const last = points.length - 1,
|
|
112
112
|
first = patch.points.length / POINT;
|
|
113
113
|
for (let i = 0; i <= last; i++) {
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
|
|
114
|
+
const point = points[i],
|
|
115
|
+
previousPoint = points[Math.max(0, i - 1)],
|
|
116
|
+
nextPoint = points[Math.min(last, i + 1)],
|
|
117
117
|
u = i / last,
|
|
118
118
|
wide = half * (0.4 + 0.6 * Math.sin(Math.min(1, u * 3) * Math.PI * 0.5)) * lerp(1, TIP, Math.pow(u, 1.4)),
|
|
119
119
|
shade = tone * lerp(ROOT_SHADE, TIP_SHADE, u);
|
|
120
|
-
_d.set(
|
|
121
|
-
_n.set(
|
|
120
|
+
_d.set(nextPoint[0] - previousPoint[0], nextPoint[1] - previousPoint[1], nextPoint[2] - previousPoint[2]);
|
|
121
|
+
_n.set(point[3], point[4], point[5]);
|
|
122
122
|
_s.crossVectors(_d, _n).normalize();
|
|
123
123
|
for (const k of [-1, 1]) {
|
|
124
|
-
_p.set(
|
|
125
|
-
if (
|
|
124
|
+
_p.set(point[0] + _s.x * wide * k, point[1] + _s.y * wide * k, point[2] + _s.z * wide * k);
|
|
125
|
+
if (point[6] !== FREE) mass.at(mass.skull.under(_p.x, _p.y, _p.z, _dir), point[6], _p, _q);
|
|
126
126
|
else _q.copy(_n);
|
|
127
127
|
const v = place([
|
|
128
128
|
_p.x,
|
package/geometry/hair-patch.js
CHANGED
|
@@ -7,32 +7,36 @@ const POINT = 10, // numbers to a point: its place, its normal, its colour, and
|
|
|
7
7
|
|
|
8
8
|
// Emit each shared vertex once per strand band, correcting the winding from the supplied normals.
|
|
9
9
|
function packHairPatch(points, triangles, emitVertex) {
|
|
10
|
-
const bands = new Map(),
|
|
10
|
+
const bands = new Map(),
|
|
11
|
+
corners = [];
|
|
11
12
|
let vertexCount = 0;
|
|
12
13
|
for (let t = 0; t < triangles.length; t += 3) {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
band = Math.floor((points[
|
|
17
|
-
ux = points[
|
|
18
|
-
uy = points[
|
|
19
|
-
uz = points[
|
|
20
|
-
vx = points[
|
|
21
|
-
vy = points[
|
|
22
|
-
vz = points[
|
|
14
|
+
const firstOffset = triangles[t] * POINT,
|
|
15
|
+
secondOffset = triangles[t + 1] * POINT,
|
|
16
|
+
thirdOffset = triangles[t + 2] * POINT,
|
|
17
|
+
band = Math.floor((points[firstOffset + 9] + points[secondOffset + 9] + points[thirdOffset + 9]) / 3 / BAND),
|
|
18
|
+
ux = points[secondOffset] - points[firstOffset],
|
|
19
|
+
uy = points[secondOffset + 1] - points[firstOffset + 1],
|
|
20
|
+
uz = points[secondOffset + 2] - points[firstOffset + 2],
|
|
21
|
+
vx = points[thirdOffset] - points[firstOffset],
|
|
22
|
+
vy = points[thirdOffset + 1] - points[firstOffset + 1],
|
|
23
|
+
vz = points[thirdOffset + 2] - points[firstOffset + 2],
|
|
23
24
|
faces =
|
|
24
|
-
(uy * vz - uz * vy) * (points[
|
|
25
|
-
(uz * vx - ux * vz) * (points[
|
|
26
|
-
(ux * vy - uy * vx) * (points[
|
|
25
|
+
(uy * vz - uz * vy) * (points[firstOffset + 3] + points[secondOffset + 3] + points[thirdOffset + 3]) +
|
|
26
|
+
(uz * vx - ux * vz) * (points[firstOffset + 4] + points[secondOffset + 4] + points[thirdOffset + 4]) +
|
|
27
|
+
(ux * vy - uy * vx) * (points[firstOffset + 5] + points[secondOffset + 5] + points[thirdOffset + 5]);
|
|
27
28
|
let put = bands.get(band);
|
|
28
|
-
if (!put) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
if (!put) {
|
|
30
|
+
put = new Map();
|
|
31
|
+
bands.set(band, put);
|
|
32
|
+
}
|
|
33
|
+
for (const pointOffset of faces < 0 ? [firstOffset, thirdOffset, secondOffset] : [firstOffset, secondOffset, thirdOffset]) {
|
|
34
|
+
let v = put.get(pointOffset);
|
|
31
35
|
if (v === undefined) {
|
|
32
36
|
v = vertexCount++;
|
|
33
|
-
put.set(
|
|
34
|
-
const tag = HAIR_NEAR + Math.min(MOST, Math.max(0, points[
|
|
35
|
-
emitVertex(
|
|
37
|
+
put.set(pointOffset, v);
|
|
38
|
+
const tag = HAIR_NEAR + Math.min(MOST, Math.max(0, points[pointOffset + 9] - band * BAND + MARGIN));
|
|
39
|
+
emitVertex(pointOffset, tag);
|
|
36
40
|
}
|
|
37
41
|
corners.push(v);
|
|
38
42
|
}
|
package/geometry/hair-shell.js
CHANGED
|
@@ -20,23 +20,24 @@ const _o = new THREE.Vector3(),
|
|
|
20
20
|
|
|
21
21
|
// The mass of a cut. scale: how far out from the skull its fullest stands (across, up, fore and aft, as shares of the skull);
|
|
22
22
|
// inHair(x, y, z): how far inside the hairline a direction lies; drop: how far it hangs below the ears; lumps: how deep its
|
|
23
|
-
// lumps are (a share of the skull) and lumpy: how many there are round the head; tucked(
|
|
23
|
+
// lumps are (a share of the skull) and lumpy: how many there are round the head; tucked(direction): where it lies under a fall of long
|
|
24
24
|
// hair and is drawn in to the skull, 0 to 1.
|
|
25
|
-
// Returns at(
|
|
26
|
-
// (metres), and the way out there; and full(
|
|
25
|
+
// Returns at(direction, lift, out, outward): the point of the mass at a direction from the head's middle, raised off it by lift
|
|
26
|
+
// (metres), and the way out there; and full(direction): how much of its fullness the mass has at a direction, 0 to 1.
|
|
27
27
|
function massOf({ skull, scale, inHair, drop = 0, lumps = 0, lumpy = 5, tucked = null }) {
|
|
28
|
-
const full =
|
|
29
|
-
|
|
28
|
+
const full = direction =>
|
|
29
|
+
(EDGE + (1 - EDGE) * sstep(-0.01, RISE, inHair(direction.x, direction.y, direction.z))) * (tucked ? 1 - TUCK * tucked(direction) : 1),
|
|
30
|
+
swell = direction =>
|
|
30
31
|
lumps *
|
|
31
|
-
(Math.sin(
|
|
32
|
-
0.6 * Math.sin(
|
|
33
|
-
at = (
|
|
34
|
-
const k = full(
|
|
35
|
-
more = lumps ? swell(
|
|
36
|
-
skull.skull(
|
|
32
|
+
(Math.sin(direction.x * lumpy * 2.3 + direction.y * lumpy * 1.3) * Math.sin(direction.z * lumpy * 2.1 - direction.y * lumpy * 1.7) +
|
|
33
|
+
0.6 * Math.sin(direction.y * lumpy * 2.9 + direction.x * lumpy * 1.1 - direction.z * lumpy * 1.9)),
|
|
34
|
+
at = (direction, lift, out, outward = _n) => {
|
|
35
|
+
const k = full(direction),
|
|
36
|
+
more = lumps ? swell(direction) * k : 0;
|
|
37
|
+
skull.skull(direction, out);
|
|
37
38
|
out.set(
|
|
38
39
|
out.x * (1 + (scale[0] - 1) * k + more),
|
|
39
|
-
out.y * (1 + (scale[1] - 1) * k + more) * (
|
|
40
|
+
out.y * (1 + (scale[1] - 1) * k + more) * (direction.y < 0 ? 1 + drop : 1),
|
|
40
41
|
out.z * (1 + (scale[2] - 1) * k + more),
|
|
41
42
|
);
|
|
42
43
|
outward.copy(out).sub(MIDDLE).normalize();
|
|
@@ -52,7 +53,7 @@ function roundPole(pole) {
|
|
|
52
53
|
e1 = new THREE.Vector3(1, 0, 0).addScaledVector(axis, -axis.x).normalize(),
|
|
53
54
|
e2 = new THREE.Vector3().crossVectors(axis, e1),
|
|
54
55
|
turn = TURNS * STRANDS.period;
|
|
55
|
-
const across =
|
|
56
|
+
const across = direction => (Math.atan2(direction.dot(e2), direction.dot(e1)) / TAU) * turn;
|
|
56
57
|
across.turn = turn;
|
|
57
58
|
across.axis = axis;
|
|
58
59
|
return across;
|
|
@@ -65,8 +66,8 @@ function createHairShells(sculptMesh) {
|
|
|
65
66
|
return function shellOf(key, mass, across) {
|
|
66
67
|
let shell = shells.get(key);
|
|
67
68
|
if (shell) return shell;
|
|
68
|
-
const soup = sculptMesh('mass:' + key, DETAIL, (
|
|
69
|
-
{ P, N, D } = soup,
|
|
69
|
+
const soup = sculptMesh('mass:' + key, DETAIL, (direction, o) => mass.at(direction, 0, o)),
|
|
70
|
+
{ P: positions, N: normals, D: directions } = soup,
|
|
70
71
|
points = [], // x, y, z, the normal, the direction
|
|
71
72
|
inside = [],
|
|
72
73
|
known = new Map(),
|
|
@@ -79,10 +80,21 @@ function createHairShells(sculptMesh) {
|
|
|
79
80
|
// Shared sphere directions have identical positions along the hairline.
|
|
80
81
|
for (let i = 0; i < soup.n; i++) {
|
|
81
82
|
const q = i * 3,
|
|
82
|
-
at = Math.round(
|
|
83
|
+
at = Math.round(directions[q] * 2e4) + ',' + Math.round(directions[q + 1] * 2e4) + ',' + Math.round(directions[q + 2] * 2e4);
|
|
83
84
|
let v = known.get(at);
|
|
84
85
|
if (v === undefined) {
|
|
85
|
-
v = add(
|
|
86
|
+
v = add(
|
|
87
|
+
positions[q],
|
|
88
|
+
positions[q + 1],
|
|
89
|
+
positions[q + 2],
|
|
90
|
+
normals[q],
|
|
91
|
+
normals[q + 1],
|
|
92
|
+
normals[q + 2],
|
|
93
|
+
directions[q],
|
|
94
|
+
directions[q + 1],
|
|
95
|
+
directions[q + 2],
|
|
96
|
+
mass.inHair(directions[q], directions[q + 1], directions[q + 2]),
|
|
97
|
+
);
|
|
86
98
|
known.set(at, v);
|
|
87
99
|
}
|
|
88
100
|
numbered[i] = v;
|
|
@@ -95,23 +107,23 @@ function createHairShells(sculptMesh) {
|
|
|
95
107
|
if (v !== undefined) return v;
|
|
96
108
|
let low = 0,
|
|
97
109
|
high = 1;
|
|
98
|
-
const
|
|
99
|
-
|
|
110
|
+
const firstOffset = i * 9,
|
|
111
|
+
secondOffset = j * 9;
|
|
100
112
|
for (let s = 0; s < SEAM_STEPS; s++) {
|
|
101
113
|
const t = (low + high) / 2;
|
|
102
|
-
_d.set(points[
|
|
103
|
-
.lerp(_e1.set(points[
|
|
114
|
+
_d.set(points[firstOffset + 6], points[firstOffset + 7], points[firstOffset + 8])
|
|
115
|
+
.lerp(_e1.set(points[secondOffset + 6], points[secondOffset + 7], points[secondOffset + 8]), t)
|
|
104
116
|
.normalize();
|
|
105
117
|
if (mass.inHair(_d.x, _d.y, _d.z) > 0) low = t;
|
|
106
118
|
else high = t;
|
|
107
119
|
}
|
|
108
|
-
_d.set(points[
|
|
109
|
-
.lerp(_e1.set(points[
|
|
120
|
+
_d.set(points[firstOffset + 6], points[firstOffset + 7], points[firstOffset + 8])
|
|
121
|
+
.lerp(_e1.set(points[secondOffset + 6], points[secondOffset + 7], points[secondOffset + 8]), low)
|
|
110
122
|
.normalize();
|
|
111
123
|
mass.at(_d, 0, _o);
|
|
112
124
|
_e2
|
|
113
|
-
.set(points[
|
|
114
|
-
.lerp(_e1.set(points[
|
|
125
|
+
.set(points[firstOffset + 3], points[firstOffset + 4], points[firstOffset + 5])
|
|
126
|
+
.lerp(_e1.set(points[secondOffset + 3], points[secondOffset + 4], points[secondOffset + 5]), low)
|
|
115
127
|
.normalize();
|
|
116
128
|
v = add(_o.x, _o.y, _o.z, _e2.x, _e2.y, _e2.z, _d.x, _d.y, _d.z, 0);
|
|
117
129
|
crossings.set(side, v);
|
|
@@ -134,8 +146,8 @@ function createHairShells(sculptMesh) {
|
|
|
134
146
|
for (let t = 0; t < triangles.length; t += 3) {
|
|
135
147
|
let most = 0;
|
|
136
148
|
for (let e = 0; e < 3; e++) {
|
|
137
|
-
const
|
|
138
|
-
let q = across(_d.set(points[
|
|
149
|
+
const vertexOffset = triangles[t + e] * 9;
|
|
150
|
+
let q = across(_d.set(points[vertexOffset + 6], points[vertexOffset + 7], points[vertexOffset + 8]));
|
|
139
151
|
if (e) {
|
|
140
152
|
q += across.turn * Math.round((strands[t] - q) / across.turn);
|
|
141
153
|
most = Math.max(most, Math.abs(q - strands[t]));
|
|
@@ -161,17 +173,17 @@ function placeHairShell(shell, place, colour) {
|
|
|
161
173
|
const same = new Map();
|
|
162
174
|
let count = 0;
|
|
163
175
|
for (let t = 0; t < triangles.length; t++) {
|
|
164
|
-
const
|
|
165
|
-
key =
|
|
176
|
+
const vertexIndex = triangles[t],
|
|
177
|
+
key = vertexIndex * 8192 + Math.round(strands[t] * 1024) + 4096;
|
|
166
178
|
let at = same.get(key);
|
|
167
179
|
if (at === undefined) {
|
|
168
180
|
at = count++;
|
|
169
181
|
same.set(key, at);
|
|
170
|
-
const q =
|
|
182
|
+
const q = vertexIndex * 9,
|
|
171
183
|
k = at * POINT;
|
|
172
184
|
for (let i = 0; i < 6; i++) v[i] = points[q + i];
|
|
173
185
|
place(v);
|
|
174
|
-
colour(inside[
|
|
186
|
+
colour(inside[vertexIndex], points[q + 6], points[q + 7], points[q + 8], tint);
|
|
175
187
|
for (let i = 0; i < 6; i++) placed[k + i] = v[i];
|
|
176
188
|
placed[k + 6] = tint[0];
|
|
177
189
|
placed[k + 7] = tint[1];
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds of human head a figure's face is varied from (`HEAD_PRESETS`: man, woman, heavy, skull), and the skull that caps,
|
|
3
|
+
* helmets, hoods and hair lie over (`SKULL`). A world adds heads of its own peoples beside these (figure-body.js, `heads`).
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
import { headFn } from './head-shape.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Kinds of head, as how strongly each feature is drawn; a figure's own face is one of these varied by its seed and look.
|
|
10
|
+
* jaw 0..1 the breadth at the jaw's angle; chin, chinW its jut and breadth; nose its reach, noseW, noseL, bridge (a hump, or a
|
|
11
|
+
* dip below 0); brow the ridge; socket how deep the eyes sit; cheek the cheekbones; hollow the cheeks under them; lips their
|
|
12
|
+
* fullness; mouthW; eye how far the lids open; tilt the outer corners raised; slope the forehead leaning back; fold the crease
|
|
13
|
+
* from nose to mouth; wide and tall: the whole head's breadth and height; age and fat 0..1; scar: a seam from [x, y] to [x, y]
|
|
14
|
+
* (millimetres from the head's middle, x to the person's left), then its width and how far its middle bows down; dead: a dried
|
|
15
|
+
* face, with pits for eyes; oneEye: the two eyes healed over and one large faceted eye in the middle of the brow, under a
|
|
16
|
+
* jutting ridge. The shape itself is head-shape.js's `headFn`.
|
|
17
|
+
* @type {Record<string, object>}
|
|
18
|
+
*/
|
|
19
|
+
const HEAD_PRESETS = {
|
|
20
|
+
man: {
|
|
21
|
+
jaw: 0.55,
|
|
22
|
+
chin: 1,
|
|
23
|
+
chinW: 1,
|
|
24
|
+
nose: 1,
|
|
25
|
+
noseW: 1,
|
|
26
|
+
noseL: 1,
|
|
27
|
+
bridge: 0.25,
|
|
28
|
+
brow: 1,
|
|
29
|
+
socket: 1,
|
|
30
|
+
cheek: 1,
|
|
31
|
+
hollow: 0.35,
|
|
32
|
+
lips: 0.88,
|
|
33
|
+
mouthW: 1,
|
|
34
|
+
eye: 0.94,
|
|
35
|
+
tilt: 0,
|
|
36
|
+
slope: 1,
|
|
37
|
+
fold: 1,
|
|
38
|
+
},
|
|
39
|
+
woman: {
|
|
40
|
+
jaw: 0.2,
|
|
41
|
+
chin: 0.7,
|
|
42
|
+
chinW: 0.84,
|
|
43
|
+
nose: 0.86,
|
|
44
|
+
noseW: 0.88,
|
|
45
|
+
noseL: 0.96,
|
|
46
|
+
bridge: -0.25,
|
|
47
|
+
brow: 0.3,
|
|
48
|
+
socket: 0.8,
|
|
49
|
+
cheek: 1.12,
|
|
50
|
+
hollow: 0.1,
|
|
51
|
+
lips: 1.22,
|
|
52
|
+
mouthW: 0.93,
|
|
53
|
+
eye: 1.06,
|
|
54
|
+
tilt: 0.35,
|
|
55
|
+
slope: 0.3,
|
|
56
|
+
fold: 0.6,
|
|
57
|
+
},
|
|
58
|
+
heavy: {
|
|
59
|
+
jaw: 1,
|
|
60
|
+
chin: 1.35,
|
|
61
|
+
chinW: 1.25,
|
|
62
|
+
nose: 1.05,
|
|
63
|
+
noseW: 1.3,
|
|
64
|
+
noseL: 1,
|
|
65
|
+
bridge: 0.5,
|
|
66
|
+
brow: 1.8,
|
|
67
|
+
socket: 1.3,
|
|
68
|
+
cheek: 1.3,
|
|
69
|
+
hollow: 0.4,
|
|
70
|
+
lips: 0.8,
|
|
71
|
+
mouthW: 1.1,
|
|
72
|
+
eye: 0.88,
|
|
73
|
+
tilt: 0,
|
|
74
|
+
slope: 1.6,
|
|
75
|
+
fold: 1.4,
|
|
76
|
+
},
|
|
77
|
+
skull: {
|
|
78
|
+
dead: 1,
|
|
79
|
+
jaw: 0.45,
|
|
80
|
+
chin: 0.9,
|
|
81
|
+
chinW: 0.9,
|
|
82
|
+
nose: 0.2,
|
|
83
|
+
noseW: 0.9,
|
|
84
|
+
noseL: 0.8,
|
|
85
|
+
bridge: 0,
|
|
86
|
+
brow: 1.7,
|
|
87
|
+
socket: 2.1,
|
|
88
|
+
cheek: 1.7,
|
|
89
|
+
hollow: 2.6,
|
|
90
|
+
lips: 0,
|
|
91
|
+
mouthW: 1.05,
|
|
92
|
+
eye: 1.3,
|
|
93
|
+
tilt: 0,
|
|
94
|
+
slope: 1.2,
|
|
95
|
+
fold: 0,
|
|
96
|
+
age: 1,
|
|
97
|
+
},
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
/** The skull caps and hair are laid over: a man's head with its forehead leaning back less. */
|
|
101
|
+
const SKULL = headFn({ ...HEAD_PRESETS.man, slope: 0.65 });
|
|
102
|
+
|
|
103
|
+
export { HEAD_PRESETS, SKULL };
|