roamwright 0.4.0 → 0.54.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.prettierrc.yaml +12 -0
- package/CONTRIBUTING.md +21 -14
- package/README.md +38 -42
- package/examples/animals.html +49 -0
- package/examples/animals.js +209 -0
- package/examples/crowds.html +50 -0
- package/examples/crowds.js +268 -0
- package/examples/effects.html +53 -0
- package/examples/effects.js +343 -0
- package/examples/figure-motion.html +55 -0
- package/examples/figure-motion.js +265 -0
- package/examples/figure.html +49 -0
- package/examples/figure.js +238 -0
- package/examples/fliers.html +53 -0
- package/examples/fliers.js +292 -0
- package/examples/fortification.html +54 -0
- package/examples/fortification.js +288 -0
- package/examples/house-kit.html +48 -0
- package/examples/house-kit.js +175 -0
- package/examples/index.html +26 -16
- package/examples/island.html +48 -0
- package/examples/island.js +134 -52
- package/examples/land.html +54 -0
- package/examples/land.js +392 -0
- package/examples/props-and-plants.html +53 -0
- package/examples/props-and-plants.js +275 -0
- package/examples/rooms.html +48 -0
- package/examples/rooms.js +242 -0
- package/examples/ships.html +51 -0
- package/examples/ships.js +235 -0
- package/examples/showcase.css +320 -0
- package/examples/small-world-land.js +151 -0
- package/examples/small-world-life.js +160 -0
- package/examples/small-world-town.js +127 -0
- package/examples/small-world.html +57 -0
- package/examples/small-world.js +226 -0
- package/examples/soundscape.html +138 -0
- package/examples/soundscape.js +467 -0
- package/examples/stage-kits.js +300 -0
- package/examples/stage.js +374 -0
- package/examples/towns.html +50 -0
- package/examples/towns.js +325 -0
- package/examples/viaduct-camera.js +8 -4
- package/examples/viaduct-landscape.js +28 -17
- package/examples/viaduct.html +45 -43
- package/examples/viaduct.js +68 -92
- package/geometry/animal-camel-body.js +410 -0
- package/geometry/animal-camel-head.js +118 -0
- package/geometry/animal-canine-body.js +361 -0
- package/geometry/animal-canine-breeds.js +316 -0
- package/geometry/animal-canine-head.js +337 -0
- package/geometry/animal-cattle-body.js +391 -0
- package/geometry/animal-cattle-coat.js +42 -0
- package/geometry/animal-cattle-head.js +152 -0
- package/geometry/animal-hen.js +248 -0
- package/geometry/animal-horse-body.js +446 -0
- package/geometry/animal-horse-bridle.js +171 -0
- package/geometry/animal-horse-coat.js +68 -0
- package/geometry/animal-horse-face.js +162 -0
- package/geometry/animal-horse-hair.js +304 -0
- package/geometry/animal-horse-head.js +133 -0
- package/geometry/animal-horse-tack.js +157 -0
- package/geometry/animal-options.js +59 -0
- package/geometry/animal-shapes.js +21 -0
- package/geometry/animal-skin.js +390 -0
- package/geometry/bedding.js +141 -0
- package/geometry/builder-cells.js +50 -0
- package/geometry/builder-frame.js +48 -0
- package/geometry/builder.js +200 -177
- package/geometry/card-emblem.js +437 -0
- package/geometry/catenary-canvas.js +396 -0
- package/geometry/cell-mask.js +25 -0
- package/geometry/cloth-folds.js +143 -0
- package/geometry/crawl-shapes.js +71 -0
- package/geometry/creased-sheet.js +40 -35
- package/geometry/crowd-dress.js +315 -0
- package/geometry/crowd-far.js +174 -0
- package/geometry/crowd-look.js +42 -0
- package/geometry/crowd-weld.js +218 -0
- package/geometry/ear.js +44 -39
- package/geometry/erosion.js +71 -45
- package/geometry/face-grid.js +85 -65
- package/geometry/field-map.js +59 -0
- package/geometry/figure-arms.js +339 -0
- package/geometry/figure-beard.js +250 -0
- package/geometry/figure-body.js +297 -0
- package/geometry/figure-bow.js +105 -0
- package/geometry/figure-cloak.js +189 -0
- package/geometry/figure-clothes.js +337 -0
- package/geometry/figure-face-grids.js +75 -0
- package/geometry/figure-gear.js +446 -0
- package/geometry/figure-hair-far.js +151 -0
- package/geometry/figure-hair-hangs.js +108 -0
- package/geometry/figure-hair-patch.js +66 -0
- package/geometry/figure-hair.js +320 -0
- package/geometry/figure-hands.js +321 -0
- package/geometry/figure-head-features.js +280 -0
- package/geometry/figure-head.js +375 -0
- package/geometry/figure-headwear.js +223 -0
- package/geometry/figure-legs.js +231 -0
- package/geometry/figure-limbs.js +39 -0
- package/geometry/figure-sculpt.js +82 -0
- package/geometry/figure-skin.js +97 -0
- package/geometry/figure-skirts.js +303 -0
- package/geometry/figure-trunk.js +411 -0
- package/geometry/flier-corvid-body.js +322 -0
- package/geometry/flier-corvid-wings.js +154 -0
- package/geometry/flier-long-body.js +195 -0
- package/geometry/flier-shapes.js +219 -0
- package/geometry/flier-soaring-bird.js +84 -0
- package/geometry/foliage.js +187 -14
- package/geometry/fort-city-walls.js +479 -0
- package/geometry/fort-gate-approach.js +233 -0
- package/geometry/fort-great-walls.js +280 -0
- package/geometry/fort-keep.js +297 -0
- package/geometry/fort-parts.js +261 -0
- package/geometry/fort-polyline.js +261 -0
- package/geometry/fort-portal.js +96 -0
- package/geometry/fort-ring-wall.js +267 -0
- package/geometry/fort-seawall.js +104 -0
- package/geometry/fort-terrace-gates.js +323 -0
- package/geometry/fort-terrace-plan.js +250 -0
- package/geometry/fort-terrace-wall.js +345 -0
- package/geometry/garment-tags.js +11 -3
- package/geometry/grid-gather.js +69 -0
- package/geometry/grid-sample.js +185 -0
- package/geometry/hair-gathers.js +57 -42
- package/geometry/hair-locks.js +42 -42
- package/geometry/hair-patch.js +24 -20
- package/geometry/hair-shell.js +43 -31
- package/geometry/head-presets.js +103 -0
- package/geometry/head-profile.js +26 -15
- package/geometry/head-shape.js +123 -95
- package/geometry/heightfield.js +50 -24
- package/geometry/horizon-angles.js +166 -0
- package/geometry/house-kit-body.js +195 -0
- package/geometry/house-kit-courtyard-parts.js +340 -0
- package/geometry/house-kit-courtyard-roof.js +223 -0
- package/geometry/house-kit-courtyard.js +409 -0
- package/geometry/house-kit-cut.js +29 -0
- package/geometry/house-kit-extras.js +192 -0
- package/geometry/house-kit-forms.js +298 -0
- package/geometry/house-kit-frame.js +74 -0
- package/geometry/house-kit-marks.js +93 -0
- package/geometry/house-kit-openings.js +193 -0
- package/geometry/house-kit-palette.js +54 -0
- package/geometry/house-kit-pool.js +71 -0
- package/geometry/house-kit-roofs.js +151 -0
- package/geometry/house-kit.js +202 -0
- package/geometry/index-parts.js +2 -2
- package/geometry/instance-visibility.js +12 -12
- package/geometry/instances.js +17 -17
- package/geometry/lamp-wash.js +65 -0
- package/geometry/land-clearings.js +83 -0
- package/geometry/land-ditches.js +290 -0
- package/geometry/land-dry-basin.js +327 -0
- package/geometry/land-dunes.js +150 -0
- package/geometry/land-earthworks.js +432 -0
- package/geometry/land-edge.js +292 -0
- package/geometry/land-mound-faces.js +349 -0
- package/geometry/land-near-relief.js +102 -0
- package/geometry/land-sheet.js +220 -0
- package/geometry/land-town-ground.js +256 -0
- package/geometry/land-waters.js +228 -0
- package/geometry/land-wildness.js +123 -0
- package/geometry/lathed-vessel.js +293 -0
- package/geometry/outline-grid.js +11 -10
- package/geometry/outline-segments.js +74 -0
- package/geometry/part-ranges.js +38 -3
- package/geometry/path-field.js +98 -34
- package/geometry/placement.js +52 -52
- package/geometry/planked-floor.js +149 -0
- package/geometry/plant-broadleaf.js +268 -0
- package/geometry/plant-shrub.js +198 -0
- package/geometry/plant-tints.js +80 -0
- package/geometry/plant-trees.js +453 -0
- package/geometry/plant-tussock.js +107 -0
- package/geometry/point-buckets.js +50 -0
- package/geometry/primitives.js +117 -59
- package/geometry/prop-battlefield.js +69 -0
- package/geometry/prop-camp.js +175 -0
- package/geometry/prop-door.js +26 -0
- package/geometry/prop-harbour.js +105 -0
- package/geometry/prop-haycock.js +60 -0
- package/geometry/prop-sacks.js +74 -0
- package/geometry/prop-sheaf.js +68 -0
- package/geometry/prop-street.js +69 -0
- package/geometry/prop-tents.js +396 -0
- package/geometry/prop-tombs.js +80 -0
- package/geometry/prop-trade.js +393 -0
- package/geometry/prop-vehicles.js +218 -0
- package/geometry/props.js +58 -0
- package/geometry/room-arcade.js +134 -0
- package/geometry/room-dome.js +188 -0
- package/geometry/room-flames.js +138 -0
- package/geometry/room-frame.js +106 -0
- package/geometry/room-furniture.js +260 -0
- package/geometry/room-hearth.js +98 -0
- package/geometry/room-kit.js +59 -0
- package/geometry/room-openings.js +142 -0
- package/geometry/room-stairs.js +180 -0
- package/geometry/room-surfaces.js +272 -0
- package/geometry/sagging-tube.js +27 -27
- package/geometry/sampled-surface.js +123 -77
- package/geometry/scatter-grid.js +49 -6
- package/geometry/sculpt.js +97 -93
- package/geometry/ship-fittings.js +350 -0
- package/geometry/ship-hull.js +460 -0
- package/geometry/ship-kit.js +208 -0
- package/geometry/ship-lines.js +69 -0
- package/geometry/ship-oars.js +150 -0
- package/geometry/ship-presets.js +131 -0
- package/geometry/ship-rig.js +374 -0
- package/geometry/ship-sails.js +148 -0
- package/geometry/shore-grid.js +81 -34
- package/geometry/strata-field.js +131 -98
- package/geometry/strata-tiles.js +108 -94
- package/geometry/stream.js +96 -59
- package/geometry/swept-tube.js +124 -0
- package/geometry/terrain-chunks.js +216 -123
- package/geometry/terrain-extension.js +29 -13
- package/geometry/town-courtyard-inn.js +272 -0
- package/geometry/town-ground.js +76 -0
- package/geometry/town-houses.js +343 -0
- package/geometry/town-lights.js +254 -0
- package/geometry/town-lots.js +172 -0
- package/geometry/town-plan.js +370 -0
- package/geometry/town-works.js +465 -0
- package/geometry/village-layout.js +181 -0
- package/geometry/village-yards.js +167 -0
- package/geometry/wall-runs.js +64 -0
- package/index.js +138 -2
- package/math/cell-edge.js +16 -16
- package/math/cell-key.js +6 -0
- package/math/circle-clearances.js +19 -0
- package/math/cloth-textures.js +6 -6
- package/math/cloud-textures.js +22 -26
- package/math/color.js +14 -14
- package/math/curve.js +26 -22
- package/math/lamp-texels.js +43 -0
- package/math/lit-share.js +22 -0
- package/math/mountain-ranges.js +379 -205
- package/math/noise.js +101 -49
- package/math/particle-noise.js +28 -28
- package/math/periodic.js +11 -5
- package/math/random.js +24 -15
- package/math/rectangles.js +58 -0
- package/math/rock-texture.js +22 -17
- package/math/scalar.js +5 -5
- package/math/surface-textures.js +74 -59
- package/math/wandering-path.js +40 -0
- package/math/ways.js +120 -0
- package/motion/action-dynamics.js +398 -0
- package/motion/animal-bearing.js +247 -0
- package/motion/animal-canine-bearing.js +178 -0
- package/motion/animal-canine-cast.js +131 -0
- package/motion/animal-cattle-cast.js +64 -0
- package/motion/animal-herd-cast.js +154 -0
- package/motion/animal-horse-still.js +161 -0
- package/motion/animal-troop-cast.js +43 -0
- package/motion/arm-reach.js +27 -26
- package/motion/ballistic-arc.js +191 -0
- package/motion/biped-cycle.js +46 -0
- package/motion/biped-leg.js +40 -0
- package/motion/biped-posture.js +459 -0
- package/motion/biped-stride.js +226 -140
- package/motion/boat-sailing.js +214 -0
- package/motion/contact-transition.js +32 -0
- package/motion/crowd-alarms.js +72 -42
- package/motion/crowd-attention.js +108 -0
- package/motion/crowd-beasts.js +203 -0
- package/motion/crowd-camp.js +295 -0
- package/motion/crowd-figure.js +100 -0
- package/motion/crowd-herd.js +86 -0
- package/motion/crowd-hold.js +130 -0
- package/motion/crowd-pose.js +296 -0
- package/motion/crowd-poses.js +481 -0
- package/motion/crowd-routine.js +126 -67
- package/motion/crowd-town.js +166 -0
- package/motion/crowd-water.js +143 -0
- package/motion/daily-clock.js +9 -9
- package/motion/deck-surface.js +40 -0
- package/motion/figure-acts.js +411 -0
- package/motion/figure-arms.js +437 -0
- package/motion/figure-blade-slide.js +149 -0
- package/motion/figure-body-place.js +180 -0
- package/motion/figure-bones.js +118 -0
- package/motion/figure-bow-draw.js +70 -0
- package/motion/figure-fingers.js +215 -0
- package/motion/figure-gaze.js +205 -0
- package/motion/figure-gestures.js +452 -0
- package/motion/figure-grip.js +134 -0
- package/motion/figure-head.js +287 -0
- package/motion/figure-legs.js +264 -0
- package/motion/figure-links.js +293 -0
- package/motion/figure-locomotion.js +391 -0
- package/motion/figure-mount-up.js +180 -0
- package/motion/figure-mount.js +201 -0
- package/motion/figure-pose-frame.js +375 -0
- package/motion/figure-pose-table.js +156 -0
- package/motion/figure-pose.js +343 -0
- package/motion/figure-seat.js +267 -0
- package/motion/figure-sway.js +125 -0
- package/motion/flier-corvid-pose.js +74 -0
- package/motion/flier-flight-air.js +122 -0
- package/motion/flier-flight-echelon.js +164 -0
- package/motion/flier-flight-roost.js +131 -0
- package/motion/flier-swarm-flight.js +252 -0
- package/motion/formation.js +193 -0
- package/motion/ground-lookahead.js +5 -5
- package/motion/instance-sight.js +15 -8
- package/motion/melee-contact.js +143 -0
- package/motion/moorings.js +48 -0
- package/motion/path-steering.js +358 -0
- package/motion/player.js +41 -32
- package/motion/quadruped.js +244 -168
- package/motion/spaces.js +90 -38
- package/motion/speech-cadence.js +304 -0
- package/motion/vessel-motion.js +57 -0
- package/motion/walk-grid.js +235 -0
- package/motion/weather.js +133 -26
- package/motion/wind.js +58 -13
- package/package.json +33 -6
- package/rendering/alpha-mips.js +340 -0
- package/rendering/animal-camel-figure.js +29 -0
- package/rendering/animal-canine-figure.js +59 -0
- package/rendering/animal-cattle-figure.js +36 -0
- package/rendering/animal-horse-figure.js +49 -0
- package/rendering/atmosphere.js +86 -0
- package/rendering/camera-track.js +156 -0
- package/rendering/cart-track.js +92 -0
- package/rendering/caster-motion.js +6 -5
- package/rendering/cell-lod-options.js +46 -0
- package/rendering/cell-lod.js +754 -113
- package/rendering/cloth-material.js +140 -0
- package/rendering/cloud-dome.js +30 -30
- package/rendering/cloud-field.js +2 -2
- package/rendering/compilation-schedule.js +79 -14
- package/rendering/contact-shadows.js +7 -4
- package/rendering/context.js +57 -6
- package/rendering/crowd-batches.js +420 -0
- package/rendering/crowd-herd.js +198 -0
- package/rendering/crowd-rig.js +132 -0
- package/rendering/crowd-skinning.js +62 -19
- package/rendering/crowd-update.js +419 -0
- package/rendering/crowd-visibility.js +107 -0
- package/rendering/crust.js +18 -12
- package/rendering/day-cycle-defaults.js +200 -0
- package/rendering/day-cycle.js +487 -0
- package/rendering/daylight.js +4 -6
- package/rendering/detail-range.js +29 -0
- package/rendering/dispose-meshes.js +18 -0
- package/rendering/dof.js +20 -13
- package/rendering/effects-frame.js +149 -0
- package/rendering/effects-water-rises.js +221 -0
- package/rendering/energy-stream.js +128 -0
- package/rendering/eye-adapt.js +14 -14
- package/rendering/facade-glass-material.js +105 -0
- package/rendering/far-shadow.js +89 -62
- package/rendering/field-surface.js +138 -0
- package/rendering/figure-shield.js +105 -0
- package/rendering/figure-skeleton.js +329 -0
- package/rendering/fire-light-watch.js +197 -0
- package/rendering/fire-pools.js +148 -0
- package/rendering/flame-sources.js +86 -0
- package/rendering/flier-bird-looks.js +97 -0
- package/rendering/flier-corvid-figure.js +67 -0
- package/rendering/flier-long-body-company.js +169 -0
- package/rendering/flier-swarm.js +186 -0
- package/rendering/flocks.js +82 -78
- package/rendering/garment-material.js +147 -51
- package/rendering/glow-lines.js +13 -13
- package/rendering/glsl-literal.js +19 -0
- package/rendering/ground-marks.js +316 -0
- package/rendering/hair-strands.js +45 -31
- package/rendering/height-haze.js +80 -33
- package/rendering/height-probe.js +164 -22
- package/rendering/house-kit-meshes.js +124 -0
- package/rendering/interior-bake.js +807 -0
- package/rendering/label-layout.js +56 -0
- package/rendering/label-range.js +41 -0
- package/rendering/lamp-light-map.js +159 -0
- package/rendering/lamp-maps.js +62 -0
- package/rendering/lamp-wash.js +51 -0
- package/rendering/light-budget.js +71 -55
- package/rendering/light-points.js +21 -5
- package/rendering/local-lights.js +39 -8
- package/rendering/material-lod.js +49 -50
- package/rendering/memory-estimate.js +84 -0
- package/rendering/moored-fleet.js +186 -0
- package/rendering/part-costs.js +104 -0
- package/rendering/particle-bursts.js +386 -0
- package/rendering/particle-emitters.js +135 -99
- package/rendering/particle-light-bursts.js +189 -0
- package/rendering/particles.js +212 -101
- package/rendering/pen-flocks.js +118 -0
- package/rendering/piece-batch.js +298 -11
- package/rendering/planar-reflection-options.js +159 -0
- package/rendering/planar-reflection.js +806 -103
- package/rendering/plant-cells.js +122 -0
- package/rendering/plant-reeds.js +113 -0
- package/rendering/plant-shade-trees.js +239 -0
- package/rendering/plant-tuft-patch.js +122 -0
- package/rendering/post-shaders.js +98 -31
- package/rendering/post.js +107 -87
- package/rendering/pressed-cover.js +135 -0
- package/rendering/prop-dig.js +136 -0
- package/rendering/rain-streaks.js +67 -0
- package/rendering/room-light.js +250 -0
- package/rendering/room-materials.js +78 -0
- package/rendering/room-space.js +111 -0
- package/rendering/scene-lights.js +106 -0
- package/rendering/sea-shaders.js +94 -37
- package/rendering/settlement-approach.js +226 -0
- package/rendering/settlement-dissolve.js +89 -0
- package/rendering/settlement-quarter-warm.js +55 -0
- package/rendering/settlement-quarter.js +477 -0
- package/rendering/settlement-switch.js +42 -0
- package/rendering/settlement-town.js +110 -0
- package/rendering/shader-warmup.js +101 -44
- package/rendering/shadow-alignment.js +4 -4
- package/rendering/shadow-depth.js +47 -25
- package/rendering/ship-meshes.js +150 -0
- package/rendering/shot-cuts.js +68 -0
- package/rendering/sky-occlusion.js +56 -29
- package/rendering/sky-pmrem.js +216 -0
- package/rendering/sky.js +126 -54
- package/rendering/smoke-shadows.js +201 -0
- package/rendering/stage-framing.js +182 -0
- package/rendering/stage-lights.js +46 -39
- package/rendering/stain-material.js +74 -0
- package/rendering/static-point-shadow.js +65 -26
- package/rendering/still-casters.js +77 -27
- package/rendering/strata-material.js +12 -12
- package/rendering/stream-flow.js +10 -10
- package/rendering/street-lamps.js +166 -0
- package/rendering/sunbeam-motes.js +670 -0
- package/rendering/surface-light.js +65 -6
- package/rendering/surface-material.js +306 -0
- package/rendering/surface-projection.js +32 -0
- package/rendering/surface-snippets.js +314 -0
- package/rendering/taa.js +75 -44
- package/rendering/talus.js +15 -15
- package/rendering/terrain-rock.js +7 -7
- package/rendering/texture-fills.js +8 -8
- package/rendering/textures.js +28 -28
- package/rendering/tree-impostor.js +929 -0
- package/rendering/vehicle-train.js +92 -0
- package/rendering/viewport.js +67 -4
- package/rendering/wakes.js +24 -24
- package/rendering/water-material.js +304 -103
- package/rendering/waypoint-beacons.js +191 -0
- package/rendering/world-matrices.js +38 -40
- package/ruff.toml +20 -0
- package/runtime/cue-cursor.js +21 -0
- package/runtime/device-quality.js +13 -2
- package/runtime/device.js +73 -0
- package/runtime/diagnostic-log.js +12 -4
- package/runtime/effect-sites.js +85 -0
- package/runtime/figure-orders.js +59 -0
- package/runtime/first-use.js +36 -28
- package/runtime/foley-script.js +124 -0
- package/runtime/foley-strides.js +333 -0
- package/runtime/frame-pacing.js +47 -0
- package/runtime/frame-yield.js +18 -0
- package/runtime/gpu-timing.js +15 -11
- package/runtime/grid-cache.js +16 -6
- package/runtime/grid-rows.js +44 -5
- package/runtime/hand-over.js +47 -24
- package/runtime/land-bake.js +78 -0
- package/runtime/lazy-sets.js +105 -0
- package/runtime/pool.js +73 -17
- package/runtime/quality-fit.js +60 -28
- package/runtime/region-pass-lay.js +40 -0
- package/runtime/region-pass.js +78 -0
- package/runtime/search.js +26 -22
- package/runtime/settlement-reach.js +42 -0
- package/runtime/sound-calls.js +113 -0
- package/runtime/sound-impacts.js +297 -0
- package/runtime/sound-voices.js +194 -0
- package/runtime/soundscape.js +282 -0
- package/runtime/spatial-audio.js +79 -30
- package/runtime/steady-frames.js +221 -0
- package/runtime/withdrawable-task.js +46 -0
- package/runtime/worker.js +7 -0
- package/scripts/app-parts.mjs +118 -0
- package/scripts/bake-revisions.mjs +81 -0
- package/scripts/browser-scripts.mjs +64 -0
- package/scripts/bundle.mjs +192 -0
- package/scripts/check-app.sh +26 -0
- package/scripts/eslint-config.mjs +119 -0
- package/scripts/format.sh +92 -0
- package/scripts/keep-builds.mjs +158 -0
- package/scripts/layers.mjs +112 -0
- package/scripts/lint.sh +49 -0
- package/scripts/module-graph.mjs +123 -0
- package/scripts/pre-commit.sh +38 -0
- package/scripts/serve.py +5 -3
- package/scripts/site.mjs +358 -0
- package/scripts/test-runner.sh +42 -0
- package/scripts/vendor.mjs +221 -0
- package/scripts/verify-publish.mjs +175 -0
- package/scripts/world.mk +59 -0
- package/tools/README.md +73 -0
- package/tools/contact-sheet.cjs +137 -0
- package/tools/cpu-profile.cjs +275 -0
- package/tools/cpu-profile.test.cjs +98 -0
- package/tools/first-draws.cjs +395 -0
- package/tools/flight-guard.cjs +482 -0
- package/tools/flight-guard.test.cjs +153 -0
- package/tools/flight-profile.cjs +145 -0
- package/tools/frame-bench.cjs +336 -0
- package/tools/frame-parts.cjs +365 -0
- package/tools/ios-sim.sh +145 -0
- package/tools/load-audit.cjs +201 -0
- package/tools/look-compare.cjs +304 -0
- package/tools/look-guard.cjs +407 -0
- package/tools/look-guard.test.cjs +93 -0
- package/tools/look-stats.cjs +185 -0
- package/tools/look-stats.test.cjs +71 -0
- package/tools/memory-audit.cjs +323 -0
- package/tools/page-driver.cjs +320 -0
- package/tools/page-driver.test.cjs +219 -0
- package/tools/program-census-report.cjs +191 -0
- package/tools/program-census.cjs +465 -0
- package/tools/program-census.test.cjs +332 -0
- package/tools/remote-runner.sh +265 -0
- package/tools/runners.test.cjs +59 -0
- package/tools/scene-audit-beat.cjs +344 -0
- package/tools/scene-audit-sheet.cjs +282 -0
- package/tools/scene-audit.cjs +471 -0
- package/tools/scene-audit.test.cjs +201 -0
- package/tools/scene-batch.cjs +219 -0
- package/tools/scene-bench.cjs +149 -0
- package/tools/scene-bench.test.cjs +33 -0
- package/tools/scene-run.cjs +443 -0
- package/tools/scene-run.test.cjs +94 -0
- package/tools/servers.sh +59 -0
- package/tools/shader-arrival.cjs +316 -0
- package/tools/shader-renewal.cjs +53 -0
- package/tools/shader-renewal.test.cjs +115 -0
- package/tools/speed-guard.cjs +258 -0
- package/tools/stills.cjs +492 -0
- package/tools/stills.test.cjs +49 -0
- package/tools/turns.sh +7 -0
- package/tools/yaml.cjs +158 -0
- package/examples/viaduct.css +0 -75
- package/rendering/light-shafts.js +0 -131
- package/rendering/road-surface.js +0 -63
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A figure's head: the sculpted skull and face in the person's own skin, weighted to the bones that work the face (jaw, lids,
|
|
3
|
+
* brows, the corners of the mouth, the eyes), then the eyes themselves, brows and lashes of hair, ears, teeth and the neck
|
|
4
|
+
* (figure-head-features.js).
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import * as THREE from 'three';
|
|
8
|
+
import { clamp, lerp, sstep } from '../math/scalar.js';
|
|
9
|
+
import { C, TRS, plainUnitShapes } from './primitives.js';
|
|
10
|
+
import { CHANNELS, FACE, FACE_LIGHT, FACE_LO, FACE_OLD, FACE_ONE, faceAt, faceSculpt, withSkullDetail } from './figure-face-grids.js';
|
|
11
|
+
import { HEAD_BONES } from '../motion/figure-bones.js';
|
|
12
|
+
import { LID_LOW, LID_TOP, SEAM, headFn } from './head-shape.js';
|
|
13
|
+
import { browsAndLashes, ear, eyeballs, neck, oneEye, teeth } from './figure-head-features.js';
|
|
14
|
+
import { BEARD_EDGE, beardKind } from './figure-beard.js';
|
|
15
|
+
import { HAIR_EDGE, hairCut } from './figure-hair.js';
|
|
16
|
+
|
|
17
|
+
const U = plainUnitShapes();
|
|
18
|
+
|
|
19
|
+
const MM = 0.001,
|
|
20
|
+
SCAR = [47, 30, 56, -42], // a scar where the look does not say where: from over the left brow down the cheek, outside the eye
|
|
21
|
+
WOUND_C = [0.3, 0.024, 0.016], // torn flesh and the blood over it, as the skin's colour is given
|
|
22
|
+
HEALED = [1.08, 0.7, 0.74], // a healed wound's scar, weeks old: the skin's colour reddened and shining (times the skin's own)
|
|
23
|
+
HEALED_LIFT = [0.07, 0.015, 0.025], // and lifted by this
|
|
24
|
+
HALF = 118, // millimetres from the head's middle to its crown: a grid's rows are heights over this
|
|
25
|
+
HAIRLINE = 0.11, // the skin below the hair's edge darkens toward it over this much of the head's height (by HAIR_EDGE.skin),
|
|
26
|
+
BEARD_SKIN = 0.75; // and the skin under a beard's edge by this much: the edge of either is soft, as fine hairs make it
|
|
27
|
+
|
|
28
|
+
// This person's own face: the head of their kind, varied by their seed, their build and age, then by what their look says of it.
|
|
29
|
+
// `HEADS`: the kinds of head by name (head-presets.js and the world's own): a look's `people` names one, and `<people>Woman`
|
|
30
|
+
// a woman's of that people where there is one.
|
|
31
|
+
function ownHead(HEADS, L, fem, build, age, rv) {
|
|
32
|
+
const people = L.people && (HEADS[L.people + (fem ? 'Woman' : '')] ? L.people + (fem ? 'Woman' : '') : HEADS[L.people] ? L.people : ''),
|
|
33
|
+
kind = L.skull ? 'skull' : people || (L.tusks || L.horns ? 'heavy' : fem ? 'woman' : 'man'),
|
|
34
|
+
H = { ...HEADS[kind] };
|
|
35
|
+
if (kind !== 'skull') {
|
|
36
|
+
H.jaw = clamp(H.jaw + rv(-0.25, 0.3), 0, 1.15);
|
|
37
|
+
H.chin *= rv(0.75, 1.3);
|
|
38
|
+
H.chinW *= rv(0.9, 1.12);
|
|
39
|
+
H.nose *= rv(0.86, 1.18);
|
|
40
|
+
H.noseW *= rv(0.88, 1.16);
|
|
41
|
+
H.noseL *= rv(0.94, 1.07);
|
|
42
|
+
H.bridge += rv(-0.5, 0.9);
|
|
43
|
+
H.brow *= rv(0.8, 1.25) + 0.2 * age;
|
|
44
|
+
H.socket *= rv(0.85, 1.2);
|
|
45
|
+
H.cheek *= rv(0.8, 1.3);
|
|
46
|
+
H.hollow += rv(0, 0.35) + age * 0.5;
|
|
47
|
+
H.lips *= rv(0.82, 1.2) * (1 - 0.18 * age);
|
|
48
|
+
H.mouthW *= rv(0.94, 1.07);
|
|
49
|
+
H.eye *= rv(0.9, 1.08);
|
|
50
|
+
H.tilt += rv(-0.25, 0.35);
|
|
51
|
+
H.eyeGap = rv(0.96, 1.04);
|
|
52
|
+
H.age = age;
|
|
53
|
+
H.fat = Math.max(0, build - 1.12) * (L.garb === 'fur' || L.garb === 'armor' || people ? 0.5 : 1.7);
|
|
54
|
+
if (H.fat) H.hollow = 0;
|
|
55
|
+
}
|
|
56
|
+
if (L.scar) H.scar = Array.isArray(L.scar) ? L.scar : SCAR;
|
|
57
|
+
if (L.wound) H.wound = L.wound;
|
|
58
|
+
if (L.healed) H.healed = true; // the wound has closed into a scar
|
|
59
|
+
return { kind, H: { ...H, ...L.head } };
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Which bones a point of the face follows (millimetres from the head's middle), written into out as bone, other, weight and
|
|
63
|
+
// jawShare. The jaw carries the chin and the lower lip wholly and the cheeks in part; the skin about a brow or a corner of the
|
|
64
|
+
// mouth follows that bone, and near a corner the jaw's share is a third bone's. The far mesh has the jaw alone.
|
|
65
|
+
function faceBones(head, plain) {
|
|
66
|
+
const { fn, human } = head,
|
|
67
|
+
mouthX = fn.mouth.x / MM;
|
|
68
|
+
return (x, y, z, out) => {
|
|
69
|
+
const ax = Math.abs(x),
|
|
70
|
+
wide = sstep(mouthX * 0.55, mouthX + 14, ax),
|
|
71
|
+
jaw = sstep(SEAM + 6 * wide, SEAM - 0.15 - 26 * wide, y) * sstep(-25, 20, z);
|
|
72
|
+
out.bone = jaw > 0.004 ? HEAD_BONES.jaw : HEAD_BONES.head;
|
|
73
|
+
out.other = HEAD_BONES.head;
|
|
74
|
+
out.weight = jaw > 0.004 ? jaw : 1;
|
|
75
|
+
out.jawShare = 0;
|
|
76
|
+
if (plain || !human || z < 30) return out;
|
|
77
|
+
const side = x < 0 ? 0 : 1,
|
|
78
|
+
dy = y - SEAM,
|
|
79
|
+
// Extend mouth-corner weight softly up into the malar cheek pad so smiles and winces lift the cheeks naturally.
|
|
80
|
+
atCorner = sstep(18, 48, z) * Math.exp(-((ax - mouthX) * (ax - mouthX)) / 92 - (dy * dy) / (dy > 0 ? 310 : 48)),
|
|
81
|
+
line = fn.browLine(ax * MM) / MM,
|
|
82
|
+
atBrow = 0.9 * Math.exp(-((y - line) * (y - line)) / 50) * sstep(4, 12, ax) * sstep(64, 52, ax);
|
|
83
|
+
if (atCorner > 0.01) {
|
|
84
|
+
out.bone = HEAD_BONES.corner[side];
|
|
85
|
+
out.weight = Math.min(1, atCorner);
|
|
86
|
+
out.jawShare = (1 - out.weight) * jaw;
|
|
87
|
+
} else if (atBrow > 0.03) {
|
|
88
|
+
out.bone = HEAD_BONES.brow[side];
|
|
89
|
+
out.weight = atBrow;
|
|
90
|
+
}
|
|
91
|
+
return out;
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// How near the hair's edge each point of a face's grid lies, from 0 (well below it) to 1 (at it, or under the hair). It depends
|
|
96
|
+
// only on the cut and the grid, so it is worked out once for each of the two and kept.
|
|
97
|
+
const hairlines = new Map();
|
|
98
|
+
function hairlineOf(cut, grid) {
|
|
99
|
+
const kept = hairlines.get(grid) || hairlines.set(grid, new Map()).get(grid);
|
|
100
|
+
let near = kept.get(cut.key);
|
|
101
|
+
if (near) return near;
|
|
102
|
+
const { rows, angles, nr, nc } = grid;
|
|
103
|
+
near = new Float64Array(nr * nc + 2);
|
|
104
|
+
for (let i = 0; i < near.length; i++) {
|
|
105
|
+
const up = i < nr * nc ? rows[(i / nc) | 0] / HALF : i === nr * nc ? 1 : -1,
|
|
106
|
+
angle = i < nr * nc ? angles[i % nc] : 0,
|
|
107
|
+
round = Math.sqrt(Math.max(0, 1 - up * up));
|
|
108
|
+
near[i] = sstep(-HAIRLINE, 0, cut.inHair(Math.sin(angle) * round, up, Math.cos(angle) * round));
|
|
109
|
+
}
|
|
110
|
+
kept.set(cut.key, near);
|
|
111
|
+
return near;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Every head on a grid writes its used points in the same order. Renumber its triangles once, skipping the gaps at the back.
|
|
115
|
+
const skinTriangles = new WeakMap();
|
|
116
|
+
function trianglesOf(grid) {
|
|
117
|
+
let corners = skinTriangles.get(grid);
|
|
118
|
+
if (!corners) {
|
|
119
|
+
const used = grid.used,
|
|
120
|
+
points = new Uint16Array(used.length + 2); // the last two points close the crown and chin
|
|
121
|
+
for (let i = 0, v = 0; i < points.length; i++) if (i >= used.length || used[i]) points[i] = v++;
|
|
122
|
+
corners = Uint16Array.from(grid.idx, i => points[i]);
|
|
123
|
+
skinTriangles.set(grid, corners);
|
|
124
|
+
}
|
|
125
|
+
return corners;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Whether a row of the face's grid at a share t along the lids (0 the inner corner, 1 the outer) and a share m of the mouth's
|
|
129
|
+
// half width lies inside the opening of the lids or the seam of the lips. The seam's rows meet a little past the mouth's half
|
|
130
|
+
// width, two points a fifth of a millimetre apart at each corner whose triangles turn every way: they are taken in too, or each
|
|
131
|
+
// corner shows a dark fleck.
|
|
132
|
+
const EYE_ACROSS = 74.5, // half the head's width at the eyes (millimetres)
|
|
133
|
+
MOUTH_CORNER = 1.08, // the seam's reach, as a share of the mouth's half width
|
|
134
|
+
insideFold = (row, t, m) => (row >= LID_LOW && row <= LID_TOP && t > 0 && t < 1) || (Math.abs(row - SEAM) < 0.5 && m < MOUTH_CORNER);
|
|
135
|
+
|
|
136
|
+
// How deep in its socket's shadow a point of a fleshless face lies, 0 to 1, from where its eye would be (mm across, mm up):
|
|
137
|
+
// the hole wider than the eye and darkest at its middle, under a brow that overhangs it.
|
|
138
|
+
const SOCKET_DARK = [0.035, 0.025, 0.02],
|
|
139
|
+
SOCKET_WIDE = 1.3, // the hole's half width, as a share of the eye's
|
|
140
|
+
SOCKET_TALL = 1.55; // its half height, as a share of the eye's radius
|
|
141
|
+
function socket(ax, y, eye) {
|
|
142
|
+
const across = (ax - eye.x / MM) / ((SOCKET_WIDE * (eye.outer - eye.inner)) / 2 / MM),
|
|
143
|
+
up = (y - eye.y / MM) / ((SOCKET_TALL * eye.r) / MM),
|
|
144
|
+
d = Math.hypot(across, up * (up > 0 ? 0.85 : 1));
|
|
145
|
+
return 0.95 * sstep(1, 0.45, d);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// A fleshless face's sockets: a dark hollow in each where its eye was, wider than the eye and set back under the brow.
|
|
149
|
+
const HOLLOW = C(0x0c0806);
|
|
150
|
+
function sockets(fig, head) {
|
|
151
|
+
const { fn, eyeP, hd } = head,
|
|
152
|
+
eye = fn.eye,
|
|
153
|
+
[kx, ky, kz] = [head.HM.elements[0], head.HM.elements[5], head.HM.elements[10]],
|
|
154
|
+
wide = (eye.outer - eye.inner) * kx * 1.15,
|
|
155
|
+
tall = eye.r * 2.3 * ky,
|
|
156
|
+
deep = eye.r * 1.1 * kz;
|
|
157
|
+
for (const s of [-1, 1])
|
|
158
|
+
hd.add(U.sph, HOLLOW, TRS(s * eyeP[0], eyeP[1] + eye.r * 0.15 * ky, eyeP[2] + eye.r * 0.5 * kz, wide, tall, deep, s * 0.35));
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// The skin of the face and skull, coloured and weighted point by point.
|
|
162
|
+
function faceSkin(fig, head, grid, mesh) {
|
|
163
|
+
const { body, L, lod, skin, lipC, hair, skinD } = fig,
|
|
164
|
+
{ fn, human, kind, cut } = head,
|
|
165
|
+
{ P, N, CH } = mesh,
|
|
166
|
+
{ rows, nr, nc } = grid,
|
|
167
|
+
count = P.length / 3,
|
|
168
|
+
first = body.count / 3,
|
|
169
|
+
col = new Float32Array(3),
|
|
170
|
+
point = [0, 0, 0, 0, 0, 0],
|
|
171
|
+
w = {},
|
|
172
|
+
near = cut ? hairlineOf(cut, grid) : null;
|
|
173
|
+
const stubble = L.stubble ?? (kind === 'man' && !L.beard && skin[0] > 0.15 ? fig.rv(0.05, 0.3) : 0),
|
|
174
|
+
warmth = human ? clamp(skin[0] * 2.2, 0, 1) : 0,
|
|
175
|
+
stubC = [(skin[0] + hair[0]) * 0.42, (skin[1] + hair[1]) * 0.42, (skin[2] + hair[2]) * 0.45],
|
|
176
|
+
browC = [(hair[0] + skinD[0]) / 2, (hair[1] + skinD[1]) / 2, (hair[2] + skinD[2]) / 2],
|
|
177
|
+
browK = L.skull ? 0 : lod ? 0.9 : 0.45,
|
|
178
|
+
weather = L.weather ?? (L.garb === 'armor' || L.garb === 'leather' || L.garb === 'fur' ? 0.5 : 0.15), // sun and wind on the skin
|
|
179
|
+
paint = fig.kit.paints[L.tattoo], // what is drawn on the face: { colour, at(ax, y, z) } (createFigureBuilder, paints)
|
|
180
|
+
hollow = L.skull ? SOCKET_DARK : null, // a dried face's eyes are dark holes
|
|
181
|
+
sheen = fig.sheen ? 1 : 0, // skin so dark it shows its form by the light it throws back (createFigureBuilder, skinTone)
|
|
182
|
+
fresh = L.wound && !L.healed,
|
|
183
|
+
scarC = fresh // a fresh wound is raw and bloody, a healed one a reddened scar
|
|
184
|
+
? WOUND_C
|
|
185
|
+
: L.healed
|
|
186
|
+
? skin.map((v, k) => v * HEALED[k] + HEALED_LIFT[k])
|
|
187
|
+
: [skin[0] * 1.25 + 0.05, skin[1] * 0.95 + 0.02, skin[2] * 0.95 + 0.02],
|
|
188
|
+
eye = fn.eye,
|
|
189
|
+
lidSpan = (eye.outer - eye.inner) / MM,
|
|
190
|
+
mouthX = fn.mouth.x / MM,
|
|
191
|
+
folded = !lod && human, // a face whose lips open, with their insides modelled,
|
|
192
|
+
lids = folded && !fn.one, // and its lids (one eye in the brow has none of the kind)
|
|
193
|
+
beard = beardKind(L),
|
|
194
|
+
roots = [hair[0] * HAIR_EDGE.roots, hair[1] * HAIR_EDGE.roots, hair[2] * HAIR_EDGE.roots],
|
|
195
|
+
beardC = beard?.thin ? hair.map((v, k) => lerp(v, skin[k], beard.thin)) : hair;
|
|
196
|
+
body.tv = 1;
|
|
197
|
+
for (let i = 0; i < count; i++) {
|
|
198
|
+
if (i < nr * nc && !grid.used[i]) continue;
|
|
199
|
+
const q = i * 3,
|
|
200
|
+
c = i * CHANNELS,
|
|
201
|
+
x = P[q] / MM,
|
|
202
|
+
y = P[q + 1] / MM,
|
|
203
|
+
z = P[q + 2] / MM,
|
|
204
|
+
lip = CH[c],
|
|
205
|
+
warm = CH[c + 2] * warmth * (1 + weather),
|
|
206
|
+
mottle = 1 + 0.035 * Math.sin(x * 0.9 + y * 1.3) * Math.sin(y * 0.7 - x * 1.7 + z * 0.5) + 0.02 * Math.sin(x * 2.9 - y * 2.3),
|
|
207
|
+
lit = sheen ? 1 + 0.9 * CH[c + 2] + 0.5 * Math.exp(-(x * x) / 500 - ((y - 50) * (y - 50)) / 400) + 0.35 * CH[c] : 1,
|
|
208
|
+
daub = paint && z > 20 ? paint.at(Math.abs(x), y, z) : 0,
|
|
209
|
+
hole = hollow && z > 20 ? socket(Math.abs(x), y, eye) : 0,
|
|
210
|
+
seam = CH[c + 7],
|
|
211
|
+
clot = fresh ? 0.72 + 0.22 * Math.sin(x * 1.7 + y * 0.6) * Math.sin(y * 1.3 - x * 0.8) + 0.16 * Math.sin(x * 4.1 - y * 3.3) : 1, // blood clotted dark, flesh wet and red
|
|
212
|
+
st = Math.max(CH[c + 3], CH[c + 5], CH[c + 6]) * stubble,
|
|
213
|
+
br = CH[c + 4] * browK,
|
|
214
|
+
edge = near ? HAIR_EDGE.skin * near[i] : 0,
|
|
215
|
+
bristle = beard
|
|
216
|
+
? BEARD_SKIN *
|
|
217
|
+
sstep(0, BEARD_EDGE + 0.06, Math.max(beard.cheek ? CH[c + 3] : 0, beard.lip ? CH[c + 5] : 0, beard.chin ? CH[c + 6] : 0))
|
|
218
|
+
: 0;
|
|
219
|
+
for (let k = 0; k < 3; k++) {
|
|
220
|
+
let v = lerp(skin[k], lipC[k], lip) * (k === 0 ? 1 + 0.1 * warm : k === 1 ? 1 - 0.05 * warm : 1 - 0.09 * warm);
|
|
221
|
+
v += (stubC[k] - v) * st;
|
|
222
|
+
v += (browC[k] - v) * br;
|
|
223
|
+
v += (roots[k] - v) * edge;
|
|
224
|
+
v += (beardC[k] - v) * bristle;
|
|
225
|
+
v *= k === 0 ? 1 - 0.03 * weather : k === 1 ? 1 - 0.08 * weather : 1 - 0.12 * weather;
|
|
226
|
+
v += (scarC[k] * clot - v) * Math.min(1, (fresh ? 1 : L.wound ? 0.85 : 0.7) * seam);
|
|
227
|
+
if (daub) v += (paint.colour[k] - v) * daub;
|
|
228
|
+
if (hole) v += (hollow[k] - v) * hole;
|
|
229
|
+
col[k] = v * CH[c + 1] * mottle * lit;
|
|
230
|
+
}
|
|
231
|
+
head.bones(x, y, z, w);
|
|
232
|
+
const row = i < nr * nc ? rows[(i / nc) | 0] : y,
|
|
233
|
+
atLid =
|
|
234
|
+
!lod && human && !fn.one && z > 30 && row >= LID_TOP - 0.4 && row < LID_TOP + 7
|
|
235
|
+
? eye.shut((Math.abs(x) - eye.inner / MM) / lidSpan) * sstep(LID_TOP + 7, LID_TOP + 3.2, row)
|
|
236
|
+
: 0;
|
|
237
|
+
if (atLid > 0.02) {
|
|
238
|
+
// the upper lid follows the lid's bone
|
|
239
|
+
w.bone = HEAD_BONES.lid;
|
|
240
|
+
w.weight = atLid;
|
|
241
|
+
w.jawShare = 0;
|
|
242
|
+
}
|
|
243
|
+
for (let k = 0; k < 3; k++) {
|
|
244
|
+
point[k] = P[q + k];
|
|
245
|
+
point[k + 3] = N[q + k];
|
|
246
|
+
}
|
|
247
|
+
if (folded && insideFold(row, (Math.abs(x) - eye.inner / MM) / lidSpan, Math.abs(x) / mouthX, lids)) {
|
|
248
|
+
// Within the opening of the lids and the seam of the lips the skin turns up, down and back into the head. A light
|
|
249
|
+
// behind the head (a fire, a lamp: they cast no shadow) lit those faces through it, a glowing line under each eye and
|
|
250
|
+
// along the mouth: they take a normal turned out of the face, as the skin over them has.
|
|
251
|
+
const out = Math.asin(clamp(x / EYE_ACROSS, -1, 1)),
|
|
252
|
+
l = Math.hypot(point[3] + 2 * Math.sin(out), point[4], point[5] + 2 * Math.cos(out));
|
|
253
|
+
point[3] = (point[3] + 2 * Math.sin(out)) / l;
|
|
254
|
+
point[4] /= l;
|
|
255
|
+
point[5] = (point[5] + 2 * Math.cos(out)) / l;
|
|
256
|
+
}
|
|
257
|
+
head.place(point);
|
|
258
|
+
if (w.bone === HEAD_BONES.lid) head.shutLid(point, w.weight);
|
|
259
|
+
// The placed points have float precision, including the normals before they are packed into bytes.
|
|
260
|
+
body.raw(
|
|
261
|
+
Math.fround(point[0]),
|
|
262
|
+
Math.fround(point[1]),
|
|
263
|
+
Math.fround(point[2]),
|
|
264
|
+
Math.fround(point[3]),
|
|
265
|
+
Math.fround(point[4]),
|
|
266
|
+
Math.fround(point[5]),
|
|
267
|
+
col[0],
|
|
268
|
+
col[1],
|
|
269
|
+
col[2],
|
|
270
|
+
w.bone,
|
|
271
|
+
w.other,
|
|
272
|
+
w.weight,
|
|
273
|
+
);
|
|
274
|
+
if (w.jawShare > 0.004) body.third(HEAD_BONES.jaw, w.jawShare);
|
|
275
|
+
}
|
|
276
|
+
body.triangles(first, trianglesOf(grid));
|
|
277
|
+
body.tv = 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Builds the head of a figure into its builder and returns what the rest of the figure and its skeleton need of it.
|
|
281
|
+
function buildHead(fig) {
|
|
282
|
+
const { L, lod, view, skin, HY, rv } = fig,
|
|
283
|
+
{ kind, H } = ownHead(fig.kit.heads, L, fig.fem, fig.w, fig.age, rv),
|
|
284
|
+
HM = new THREE.Matrix4()
|
|
285
|
+
.makeTranslation(0, HY, 0)
|
|
286
|
+
.multiply(
|
|
287
|
+
new THREE.Matrix4().makeScale(
|
|
288
|
+
rv(0.96, 1.045) * (1 + 0.05 * (H.fat || 0)) * (H.wide || 1),
|
|
289
|
+
rv(0.97, 1.04) * (H.tall || 1),
|
|
290
|
+
rv(0.975, 1.035),
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
.multiply(new THREE.Matrix4().makeTranslation(0, -HY, 0)),
|
|
294
|
+
cut = hairCut(fig),
|
|
295
|
+
hidden = L.hood || L.helm,
|
|
296
|
+
exposed = !hidden && (L.hairStyle === 'bald' || cut?.style === 'balding' || cut?.style === 'cropped'),
|
|
297
|
+
baseGrid = lod > 1 ? FACE_LIGHT : lod ? FACE_LO : H.oneEye ? FACE_ONE : fig.age > 0.45 ? FACE_OLD : FACE,
|
|
298
|
+
grid = !lod && exposed ? withSkullDetail(baseGrid) : baseGrid,
|
|
299
|
+
fn = headFn(H, !lod),
|
|
300
|
+
mesh = faceSculpt(fn, grid),
|
|
301
|
+
eye = fn.eye,
|
|
302
|
+
[kx, ky, kz] = [HM.elements[0], HM.elements[5], HM.elements[10]],
|
|
303
|
+
browX = 31 * MM,
|
|
304
|
+
browAt = faceAt(fn, browX, fn.browLine(browX)),
|
|
305
|
+
eyeP = [eye.x * kx, HY + eye.y * ky, eye.z * kz], // where the ball of an eye turns, and the lids about it
|
|
306
|
+
shutFast = L.skull || H.oneEye, // no lids that open: a skull's, or sockets healed over
|
|
307
|
+
lidTurn = lod || shutFast ? 0 : eye.close,
|
|
308
|
+
// a point and its normal, given from the head's middle, set in the figure (the head is this person's own size)
|
|
309
|
+
place = v => {
|
|
310
|
+
const l = Math.hypot(v[3] / kx, v[4] / ky, v[5] / kz) || 1;
|
|
311
|
+
v[0] *= kx;
|
|
312
|
+
v[1] = HY + v[1] * ky;
|
|
313
|
+
v[2] *= kz;
|
|
314
|
+
v[3] /= kx * l;
|
|
315
|
+
v[4] /= ky * l;
|
|
316
|
+
v[5] /= kz * l;
|
|
317
|
+
return v;
|
|
318
|
+
},
|
|
319
|
+
// The mesh is stored with the lids shut and the lid bone turns them open: a point modelled on the open lid,
|
|
320
|
+
// following that bone by a weight, is moved to where it must be stored for the open lid to come out as modelled.
|
|
321
|
+
shutLid = (v, weight) => {
|
|
322
|
+
const a = 1 - weight + weight * Math.cos(lidTurn),
|
|
323
|
+
b = weight * Math.sin(lidTurn),
|
|
324
|
+
det = a * a + b * b,
|
|
325
|
+
y = v[1] - eyeP[1],
|
|
326
|
+
z = v[2] - eyeP[2],
|
|
327
|
+
ny = v[4],
|
|
328
|
+
nz = v[5];
|
|
329
|
+
v[1] = eyeP[1] + (a * y - b * z) / det;
|
|
330
|
+
v[2] = eyeP[2] + (b * y + a * z) / det;
|
|
331
|
+
v[4] = (a * ny - b * nz) / det;
|
|
332
|
+
v[5] = (b * ny + a * nz) / det;
|
|
333
|
+
const l = Math.hypot(v[3], v[4], v[5]) || 1;
|
|
334
|
+
v[3] /= l;
|
|
335
|
+
v[4] /= l;
|
|
336
|
+
v[5] /= l;
|
|
337
|
+
return v;
|
|
338
|
+
},
|
|
339
|
+
head = {
|
|
340
|
+
kind,
|
|
341
|
+
H,
|
|
342
|
+
human: kind !== 'skull', // a face that can move
|
|
343
|
+
fn,
|
|
344
|
+
HM,
|
|
345
|
+
grid,
|
|
346
|
+
mesh,
|
|
347
|
+
hd: view(HEAD_BONES.head, 0, 0, 0, HM),
|
|
348
|
+
jw: view(HEAD_BONES.jaw, 0, 0, 0, HM),
|
|
349
|
+
lidA: shutFast ? 0 : eye.close, // the near body's, whichever is built: the far one has no lids, but sets the bones both share
|
|
350
|
+
eyeP,
|
|
351
|
+
place,
|
|
352
|
+
shutLid,
|
|
353
|
+
browP: [browAt[0] * kx, HY + browAt[1] * ky, browAt[2] * kz], // where each brow turns
|
|
354
|
+
cut, // the hair's cut, which the skin below its edge darkens toward
|
|
355
|
+
};
|
|
356
|
+
head.bones = faceBones(head, lod);
|
|
357
|
+
faceSkin(fig, head, grid, mesh);
|
|
358
|
+
neck(fig);
|
|
359
|
+
if (lod) {
|
|
360
|
+
if (!hidden) for (const s of [-1, 1]) head.hd.add(U.sph, skin, TRS(s * 0.0765, HY - 0.008, -0.012, 0.02, 0.06, 0.034, s * 0.25));
|
|
361
|
+
return head;
|
|
362
|
+
}
|
|
363
|
+
if (!L.skull) {
|
|
364
|
+
if (fn.one) oneEye(fig, head);
|
|
365
|
+
else {
|
|
366
|
+
eyeballs(fig, head);
|
|
367
|
+
browsAndLashes(fig, head);
|
|
368
|
+
}
|
|
369
|
+
teeth(fig, head);
|
|
370
|
+
} else sockets(fig, head);
|
|
371
|
+
if (!hidden) for (const s of [-1, 1]) ear(fig, head, s);
|
|
372
|
+
return head;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
export { buildHead };
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What is worn on a head and what grows out of it besides hair: hoods, helmets and hats, horns, antlers, tusks.
|
|
3
|
+
* @module
|
|
4
|
+
*/
|
|
5
|
+
import { sstep } from '../math/scalar.js';
|
|
6
|
+
import { HAIR_FAR } from './hair-tags.js';
|
|
7
|
+
import { HANGS, KIND, garmentTag } from './garment-tags.js';
|
|
8
|
+
import { C, TRS, plainUnitShapes } from './primitives.js';
|
|
9
|
+
import { growBeard } from './figure-beard.js';
|
|
10
|
+
import { growHair } from './figure-hair.js';
|
|
11
|
+
import { faceAt } from './figure-face-grids.js';
|
|
12
|
+
import { SEAM } from './head-shape.js';
|
|
13
|
+
import { SKULL } from './head-presets.js';
|
|
14
|
+
import { capFn, loft, sculptMesh } from './figure-sculpt.js';
|
|
15
|
+
|
|
16
|
+
const U = plainUnitShapes();
|
|
17
|
+
|
|
18
|
+
const MM = 0.001,
|
|
19
|
+
JAW_BONE = 12,
|
|
20
|
+
OVER_SKULL = { skull: SKULL.skull }; // a helmet is shaped to the skull it sits on
|
|
21
|
+
|
|
22
|
+
// The face's opening in a hood, as how far a direction from the head's middle lies outside it: an oval from the middle of the
|
|
23
|
+
// brow to under the chin and out to the cheekbones, its rim turned in onto the skin.
|
|
24
|
+
const HOOD_OPEN = [0.66, 0.74, -0.1], // half its width and height, as shares of the head, and how far above the eyes its middle is
|
|
25
|
+
hoodMargin = (x, y, z) =>
|
|
26
|
+
Math.hypot(x / HOOD_OPEN[0], (y - HOOD_OPEN[2]) / HOOD_OPEN[1]) - 1 + 2 * sstep(0.45, 0.1, z) + 2 * sstep(-0.62, -0.74, y),
|
|
27
|
+
HOOD_FULL = 0.05, // how much fuller than over the crown it is where it reaches the shoulders
|
|
28
|
+
HOOD_BACK = [0.055, 0.03], // how much further down and back it falls behind the neck (metres)
|
|
29
|
+
HOOD_FOLDS = [7, 0.03, 2.4], // folds round it: how many each side, how deep (a share of its width), how far back they run as they fall
|
|
30
|
+
// how far out from the skull the cloth lies at a direction from the head's middle, as a share: a little fuller as it falls, in
|
|
31
|
+
// folds round the sides and back that run down and back from the temples, and coming to a soft point at the back of the
|
|
32
|
+
// crown where its seam runs
|
|
33
|
+
hoodHang = (x, y, z) =>
|
|
34
|
+
1 +
|
|
35
|
+
HOOD_FULL * sstep(0.1, -0.8, y) +
|
|
36
|
+
HOOD_FOLDS[1] * Math.cos(HOOD_FOLDS[0] * Math.abs(Math.atan2(x, z)) + HOOD_FOLDS[2] * y) * sstep(0.25, -0.5, y) * sstep(0.4, -0.2, z) +
|
|
37
|
+
0.06 * sstep(0.1, -0.7, z) * Math.exp(-((y - 0.45) * (y - 0.45)) / 0.06 - (x * x) / 0.03),
|
|
38
|
+
hoodCap = capFn(1.11, 1.07, 1.1, 0.008, -0.006, 0.3, hoodMargin, { skull: SKULL.skull, k: hoodHang }),
|
|
39
|
+
// the hood's shape: the cap, its back hanging from the crown down past the nape and out over the mantle
|
|
40
|
+
hoodShape = (d, o, ch) => {
|
|
41
|
+
hoodCap(d, o, ch);
|
|
42
|
+
const behind = sstep(0.2, -0.7, d.z) * sstep(-0.1, -0.85, d.y);
|
|
43
|
+
o.y -= HOOD_BACK[0] * behind;
|
|
44
|
+
o.z -= HOOD_BACK[1] * behind;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// A hood over the head and shoulders, open at the face: cloth laid over the skull, hanging to the shoulders in folds that run
|
|
48
|
+
// down and back, its rim drawn in against the brow and cheeks and open under the chin (the cape it falls onto is worn on the
|
|
49
|
+
// body: figure-clothes.js, mantle).
|
|
50
|
+
function hood(fig, head) {
|
|
51
|
+
const { L, HY, body, lod } = fig,
|
|
52
|
+
cloth = C(L.hood === true ? L.cloak || L.c1 : L.hood);
|
|
53
|
+
if (!lod) body.tv = garmentTag(HANGS, fig.cloth);
|
|
54
|
+
head.hd.sc(
|
|
55
|
+
sculptMesh('hood', 11, hoodShape),
|
|
56
|
+
cloth,
|
|
57
|
+
cloth,
|
|
58
|
+
(x, y, z) => hoodMargin(x, y, z) < -0.12 || (y < -0.86 && z > -0.2),
|
|
59
|
+
HY + 0.004,
|
|
60
|
+
);
|
|
61
|
+
body.tv = 0;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// A helmet: a skull-cap with a brim, a nasal bar and cheek plates.
|
|
65
|
+
function helm(fig, head) {
|
|
66
|
+
const { metal, metalEdge, body, HY, lod } = fig,
|
|
67
|
+
{ hd } = head;
|
|
68
|
+
if (!lod) body.tv = garmentTag(0, KIND.plate);
|
|
69
|
+
hd.sc(sculptMesh('helm', 7, capFn(1.1, 1.065, 1.085, 0, 0, 0, null, OVER_SKULL)), metal, metal, (x, y) => y < 0.27, HY);
|
|
70
|
+
body.tv = 0;
|
|
71
|
+
hd.add(U.cyl16, metalEdge, TRS(0, HY + 0.027, -0.003, 0.182, 0.015, 0.226));
|
|
72
|
+
hd.box(0, HY - 0.006, 0.108, 0.014, 0.075, 0.01, metal);
|
|
73
|
+
for (const s of [-1, 1]) hd.box(s * 0.082, HY - 0.045, 0.02, 0.01, 0.1, 0.075, metal);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// A broad-brimmed hat of felt, over the hair: a soft crown, narrowing and creased at the top, and a wide brim that droops at its edge.
|
|
77
|
+
function hat(fig, head) {
|
|
78
|
+
const { L, HY, body, lod } = fig,
|
|
79
|
+
{ hd } = head,
|
|
80
|
+
felt = C(L.hat === true ? 0x161412 : L.hat),
|
|
81
|
+
dent = (x, y) => 1 - 0.05 * sstep(0.5, 1, y) - 0.07 * sstep(0.88, 1, y) * sstep(0.3, 0, Math.abs(x));
|
|
82
|
+
if (!lod) body.tv = garmentTag(0, KIND.wool);
|
|
83
|
+
hd.sc(
|
|
84
|
+
sculptMesh('hat', 7, capFn(1.13, 1.3, 1.11, 0.006, 0, 0, null, { skull: SKULL.skull, k: dent })),
|
|
85
|
+
felt,
|
|
86
|
+
felt,
|
|
87
|
+
(x, y) => y < 0.28,
|
|
88
|
+
HY,
|
|
89
|
+
);
|
|
90
|
+
hd.add(U.cyl16, felt, TRS(0, HY + 0.034, -0.004, 0.4, 0.007, 0.42));
|
|
91
|
+
hd.add(U.cyl16, felt, TRS(0, HY + 0.028, -0.004, 0.46, 0.005, 0.48));
|
|
92
|
+
body.tv = 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// A helm of bone: the skull-cap of a horned beast, its bone yellowed and darker where it was cut from the skull, its brow a
|
|
96
|
+
// shelf jutting over the face that leaves the eyes in its shadow; one horn sweeps out from the temple and turns up, the other is broken off at its base. HELM_HORN: the horn from its
|
|
97
|
+
// foot to its point, in `steps` lengths: how far from upright it leans (radians, away from the head), its whole length and
|
|
98
|
+
// breadth (metres), and its colour, pale at the foot and dark at the point.
|
|
99
|
+
const HELM_HORN = { steps: 8, tilt: [1.3, 0.08], long: 0.25, wide: [0.05, 0.008], colour: [C(0x9e8c68), C(0x3a2e22)] };
|
|
100
|
+
function boneHelm(fig, head) {
|
|
101
|
+
const { HY, body } = fig,
|
|
102
|
+
{ hd } = head,
|
|
103
|
+
from = body.count,
|
|
104
|
+
bone = C(0xbcaa80), // yellowed
|
|
105
|
+
cut = C(0x5e4a32),
|
|
106
|
+
tag = body.tv,
|
|
107
|
+
edge = (x, y, z) => y - 0.2 + 0.6 * Math.max(0, -z) - 0.05 * Math.cos(x * 2.4); // low on the brow, lower still behind
|
|
108
|
+
body.tv = garmentTag(0, KIND.leather); // bone is smooth, with a low sheen: no cloth's weave
|
|
109
|
+
hd.sc(
|
|
110
|
+
sculptMesh('bonehelm', 9, capFn(1.09, 1.06, 1.08, 0.012, 0, 0, edge, OVER_SKULL)),
|
|
111
|
+
bone,
|
|
112
|
+
cut,
|
|
113
|
+
(x, y, z) => edge(x, y, z) < -0.25,
|
|
114
|
+
HY,
|
|
115
|
+
);
|
|
116
|
+
hd.add(U.sph, bone, TRS(0, HY + 0.03, 0.06, 0.14, 0.05, 0.072, 0.22, 0, 0)); // the brow's shelf of bone, heavy and short
|
|
117
|
+
stain(body, from, 0.32);
|
|
118
|
+
// the whole horn on the left, each length from where the last ended, curving up and narrowing, a knuckle at each join
|
|
119
|
+
const { steps, tilt, long, wide, colour } = HELM_HORN,
|
|
120
|
+
step = long / steps;
|
|
121
|
+
let x = -0.088,
|
|
122
|
+
y = HY + 0.075;
|
|
123
|
+
for (let i = 0; i < steps; i++) {
|
|
124
|
+
const t = i / steps,
|
|
125
|
+
lean = tilt[0] + (tilt[1] - tilt[0]) * sstep(0, 1, t + 0.5 / steps),
|
|
126
|
+
across = wide[0] + (wide[1] - wide[0]) * Math.pow(t, 0.8),
|
|
127
|
+
tone = colour[0].map((v, k) => v + (colour[1][k] - v) * t * t),
|
|
128
|
+
last = i === steps - 1;
|
|
129
|
+
hd.add(last ? U.cone6 : U.cyl6, tone, TRS(x, y, 0.01, across, step * (last ? 1.6 : 1.02), across, 0, 0, lean)); // a length stands on its foot
|
|
130
|
+
x -= Math.sin(lean) * step;
|
|
131
|
+
y += Math.cos(lean) * step;
|
|
132
|
+
if (!last) hd.add(U.sph, tone, TRS(x, y, 0.01, across * 0.98, across * 0.98, across * 0.98));
|
|
133
|
+
}
|
|
134
|
+
// and on the right its stump, snapped short, the break paler where the horn's core shows
|
|
135
|
+
const foot = HELM_HORN.tilt[0],
|
|
136
|
+
stub = 0.032;
|
|
137
|
+
hd.add(U.cyl6, colour[0], TRS(0.088, HY + 0.075, 0.01, wide[0], stub, wide[0], 0, 0, -foot));
|
|
138
|
+
hd.add(
|
|
139
|
+
U.cyl6,
|
|
140
|
+
C(0xc4b28c),
|
|
141
|
+
TRS(0.088 + Math.sin(foot) * stub, HY + 0.075 + Math.cos(foot) * stub, 0.01, wide[0] * 0.84, 0.004, wide[0] * 0.84, 0, 0, -foot),
|
|
142
|
+
);
|
|
143
|
+
body.tv = tag;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Old bone stained in blotches: what was put into the body from vertex `from` on is darkened and browned by up to `depth`.
|
|
147
|
+
const BLOTCH = 180; // radians a metre: blotches some three centimetres across
|
|
148
|
+
function stain(body, from, depth) {
|
|
149
|
+
const { positions: P, colours: col, colourBytes: bytes } = body;
|
|
150
|
+
for (let q = from; q < body.count; q += 3) {
|
|
151
|
+
const x = P[q] * BLOTCH,
|
|
152
|
+
y = P[q + 1] * BLOTCH,
|
|
153
|
+
z = P[q + 2] * BLOTCH,
|
|
154
|
+
n = 0.5 + 0.35 * Math.sin(x * 1.3 + y * 0.7 + 1.1) * Math.sin(y * 1.1 - z * 1.6) + 0.15 * Math.sin(x * 3.1 - z * 2.7 + y * 2.3),
|
|
155
|
+
dark = depth * n;
|
|
156
|
+
for (let k = 0; k < 3; k++) {
|
|
157
|
+
col[q + k] *= 1 - dark * (k === 0 ? 0.8 : k === 1 ? 1 : 1.25);
|
|
158
|
+
bytes[q + k] = Math.min(255, Math.round(col[q + k] * 255));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Tusks that rise from the lower jaw outside the upper lip, as long as the look says (1: some 4 cm).
|
|
164
|
+
function tusks(fig, head, size) {
|
|
165
|
+
const { body, HY } = fig,
|
|
166
|
+
{ fn } = head,
|
|
167
|
+
ivory = C(0xd8d0b0),
|
|
168
|
+
stained = C(0x9a8c6a),
|
|
169
|
+
x = fn.mouth.x * 0.72,
|
|
170
|
+
z = faceAt(fn, x, (SEAM + 2) * MM)[2] + 0.0015,
|
|
171
|
+
foot = HY + (SEAM - 7) * MM,
|
|
172
|
+
long = 0.036 * size,
|
|
173
|
+
thick = 0.0052 + 0.0022 * size;
|
|
174
|
+
body.M = head.HM;
|
|
175
|
+
for (const s of [-1, 1])
|
|
176
|
+
loft(
|
|
177
|
+
body,
|
|
178
|
+
0,
|
|
179
|
+
0,
|
|
180
|
+
0,
|
|
181
|
+
[
|
|
182
|
+
[foot, thick, thick, s * x, z - 0.004, stained, JAW_BONE],
|
|
183
|
+
[foot + 0.35 * long, thick * 0.92, thick * 0.92, s * (x + 0.003 * size), z + 0.002, ivory, JAW_BONE],
|
|
184
|
+
[foot + 0.75 * long, thick * 0.55, thick * 0.55, s * (x + 0.005 * size), z + 0.004, ivory, JAW_BONE],
|
|
185
|
+
[foot + long, 0.0004, 0.0004, s * (x + 0.004 * size), z + 0.003, ivory, JAW_BONE],
|
|
186
|
+
],
|
|
187
|
+
6,
|
|
188
|
+
);
|
|
189
|
+
body.M = null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Puts on the head what the look names: a hood, a helmet or hair, and a hat over it; a beard; tusks, horns, antlers (a scar is the
|
|
193
|
+
// face's own, head-shape.js). Returns the cut of the hair.
|
|
194
|
+
function dressHead(fig, head) {
|
|
195
|
+
const { L, HY } = fig,
|
|
196
|
+
{ hd } = head;
|
|
197
|
+
let cut = '';
|
|
198
|
+
if (L.hood) hood(fig, head);
|
|
199
|
+
else if (L.helm) helm(fig, head);
|
|
200
|
+
else if (L.skull && !head.cut && fig.kit.bareSkull)
|
|
201
|
+
fig.kit.bareSkull(fig, head); // what a skull with no hair of its own wears (createFigureBuilder, bareSkull: boneHelm, say)
|
|
202
|
+
else {
|
|
203
|
+
fig.body.tv = HAIR_FAR;
|
|
204
|
+
cut = growHair(fig, head);
|
|
205
|
+
fig.body.tv = 0;
|
|
206
|
+
}
|
|
207
|
+
if (L.hat) hat(fig, head);
|
|
208
|
+
if (L.beard) {
|
|
209
|
+
fig.body.tv = HAIR_FAR;
|
|
210
|
+
growBeard(fig, head);
|
|
211
|
+
fig.body.tv = 0;
|
|
212
|
+
}
|
|
213
|
+
if (L.tusks) tusks(fig, head, L.tusks * (fig.kit.tuskScale?.(L) ?? 1));
|
|
214
|
+
if (L.horns) for (const s of [-1, 1]) hd.add(U.cone6, C(0x1a1210), TRS(s * 0.06, HY + 0.085, 0, 0.05, 0.2, 0.05, 0, 0, -s * 0.55));
|
|
215
|
+
if (L.antler)
|
|
216
|
+
for (const s of [-1, 1]) {
|
|
217
|
+
hd.add(U.cyl6, C(0xb8a888), TRS(s * 0.05, HY + 0.1, 0, 0.022, 0.2, 0.022, 0, 0, -s * 0.5));
|
|
218
|
+
hd.add(U.cyl6, C(0xb8a888), TRS(s * 0.12, HY + 0.22, 0, 0.018, 0.11, 0.018, 0, 0, s * 0.4));
|
|
219
|
+
}
|
|
220
|
+
return cut;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export { boneHelm, dressHead };
|