@bitefoundry/retrieviewer 0.0.0-stage → 0.0.2
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/ASSET-PROVENANCE.md +43 -0
- package/ASSETS-LICENSE.md +58 -0
- package/ATTRIBUTION.md +54 -0
- package/EMBEDDING.md +96 -0
- package/INSTALLING.md +126 -0
- package/LICENSE +16 -0
- package/LICENSE-CODE +21 -0
- package/PLUGIN.md +110 -0
- package/PUPPY-MEMORY.md +57 -0
- package/PUPPY-Q5-COMPARISON.md +73 -0
- package/README.md +86 -2
- package/RELEASING.md +70 -0
- package/THIRD-PARTY-NOTICES.md +17 -0
- package/TRADEMARKS.md +21 -0
- package/WINDOWS-COMPANION.md +113 -0
- package/braille.mjs +45 -0
- package/examples/bridge.py +62 -0
- package/examples/embed.mjs +15 -0
- package/examples/live.mjs +40 -0
- package/examples/plugin.mjs +21 -0
- package/integrations/opencode/runtime.mjs +195 -0
- package/integrations/opencode/tui.tsx +59 -0
- package/integrations/windows-overlay/Overlay.cs +259 -0
- package/integrations/windows-overlay/desktop.mjs +87 -0
- package/integrations/windows-overlay/protocol.mjs +39 -0
- package/integrations/windows-overlay/worker.mjs +60 -0
- package/locomotion-core.mjs +21 -0
- package/locomotion-puppy.animal +0 -0
- package/package.json +131 -4
- package/pet-q5-manifest.json +118 -0
- package/puppy-clean.mjs +51 -0
- package/puppy-companion-interactions-v3-q5.bin.gz +0 -0
- package/puppy-companion-interactions-v3.json +1 -0
- package/puppy-companion-life.mjs +182 -0
- package/puppy-companion-objects.mjs +30 -0
- package/puppy-companion-sprites.mjs +14 -0
- package/puppy-continuous.mjs +57 -0
- package/puppy-face.mjs +46 -0
- package/puppy-frame-predictive.mjs +147 -0
- package/puppy-frame-store.mjs +108 -0
- package/puppy-mouth-anchor.json +1 -0
- package/puppy-mouth-anchor.mjs +33 -0
- package/puppy-paper-actions-v9-q5.bin.gz +0 -0
- package/puppy-paper-actions-v9.json +1 -0
- package/puppy-paper-actions.mjs +48 -0
- package/puppy-paper-approach-q5.bin.gz +0 -0
- package/puppy-paper-approach.json +1 -0
- package/puppy-paper-area.mjs +15 -0
- package/puppy-paper-arrival-seat-q5.bin.gz +0 -0
- package/puppy-paper-arrival-seat.json +1 -0
- package/puppy-paper-behaviors-q5.bin.gz +0 -0
- package/puppy-paper-behaviors.json +1 -0
- package/puppy-paper-behaviors.mjs +8 -0
- package/puppy-paper-contact.mjs +103 -0
- package/puppy-paper-director.mjs +21 -0
- package/puppy-paper-paw-transport.mjs +76 -0
- package/puppy-paper-rear-gallop-q5.bin.gz +0 -0
- package/puppy-paper-rear-gallop.json +1 -0
- package/puppy-paper-seat-q5.bin.gz +0 -0
- package/puppy-paper-seat.json +14 -0
- package/puppy-paper-seat.mjs +13 -0
- package/puppy-paper-trick-timing.mjs +58 -0
- package/puppy-paper-world.mjs +108 -0
- package/puppy-paper.mjs +271 -0
- package/puppy-stable-meta.json +1606 -0
- package/puppy-stable.mjs +72 -0
- package/puppy-stride-meta.json +343 -0
- package/puppy-stride-tweens-q5.bin.gz +0 -0
- package/puppy-zoomies.mjs +27 -0
- package/puppy-zoomies30.mjs +12 -0
- package/retrieviewer-cli.mjs +94 -0
- package/retrieviewer-config.mjs +49 -0
- package/retrieviewer-install.mjs +157 -0
- package/retrieviewer-plugin.d.mts +44 -0
- package/retrieviewer-plugin.mjs +97 -0
- package/retrieviewer-stdio.mjs +38 -0
- package/retrieviewer.d.mts +85 -0
- package/retrieviewer.mjs +142 -0
- package/vendor/procedural-animals/LICENSE +21 -0
- package/vendor/procedural-animals/package.json +40 -0
- package/vendor/procedural-animals/src/animal.js +146 -0
- package/vendor/procedural-animals/src/bake.js +51 -0
- package/vendor/procedural-animals/src/build.js +81 -0
- package/vendor/procedural-animals/src/core/build/coatKit.js +121 -0
- package/vendor/procedural-animals/src/core/build/featherCards.js +189 -0
- package/vendor/procedural-animals/src/core/build/finEdges.js +85 -0
- package/vendor/procedural-animals/src/core/build/furSlope.js +115 -0
- package/vendor/procedural-animals/src/core/build/mesh.js +67 -0
- package/vendor/procedural-animals/src/core/build/pipeline.js +272 -0
- package/vendor/procedural-animals/src/core/build/seams.js +183 -0
- package/vendor/procedural-animals/src/core/build/warp.js +112 -0
- package/vendor/procedural-animals/src/core/build/weights.js +393 -0
- package/vendor/procedural-animals/src/core/math/vec.js +81 -0
- package/vendor/procedural-animals/src/core/motion/actions.js +800 -0
- package/vendor/procedural-animals/src/core/motion/bird.js +3063 -0
- package/vendor/procedural-animals/src/core/motion/birdActions.js +1059 -0
- package/vendor/procedural-animals/src/core/motion/common.js +158 -0
- package/vendor/procedural-animals/src/core/motion/index.js +22 -0
- package/vendor/procedural-animals/src/core/motion/quadruped.js +2875 -0
- package/vendor/procedural-animals/src/core/motion/snake.js +1594 -0
- package/vendor/procedural-animals/src/core/motion/spider.js +1810 -0
- package/vendor/procedural-animals/src/core/motion/swimmer.js +1047 -0
- package/vendor/procedural-animals/src/core/motion/swimmerActions.js +613 -0
- package/vendor/procedural-animals/src/core/render/animalObject.js +262 -0
- package/vendor/procedural-animals/src/core/render/coatMaterial.js +1301 -0
- package/vendor/procedural-animals/src/core/render/dqs.js +159 -0
- package/vendor/procedural-animals/src/core/render/eyes.js +676 -0
- package/vendor/procedural-animals/src/core/render/membranes.js +77 -0
- package/vendor/procedural-animals/src/core/render/skeleton.js +41 -0
- package/vendor/procedural-animals/src/core/rig/bird.js +327 -0
- package/vendor/procedural-animals/src/core/rig/quadruped.js +76 -0
- package/vendor/procedural-animals/src/core/rig/rig.js +79 -0
- package/vendor/procedural-animals/src/core/rig/snake.js +76 -0
- package/vendor/procedural-animals/src/core/rig/spider.js +110 -0
- package/vendor/procedural-animals/src/core/rig/swimmer.js +181 -0
- package/vendor/procedural-animals/src/core/sdf/eyeSocket.js +53 -0
- package/vendor/procedural-animals/src/core/sdf/mesher.js +238 -0
- package/vendor/procedural-animals/src/core/sdf/sdf.js +263 -0
- package/vendor/procedural-animals/src/index.d.ts +98 -0
- package/vendor/procedural-animals/src/index.js +29 -0
- package/vendor/procedural-animals/src/registry.js +48 -0
- package/vendor/procedural-animals/src/species/bear/behaviour.js +463 -0
- package/vendor/procedural-animals/src/species/bear/claws.js +147 -0
- package/vendor/procedural-animals/src/species/bear/coat.js +726 -0
- package/vendor/procedural-animals/src/species/bear/index.js +139 -0
- package/vendor/procedural-animals/src/species/bear/motion.js +112 -0
- package/vendor/procedural-animals/src/species/bear/regions.js +78 -0
- package/vendor/procedural-animals/src/species/bear/rig.js +112 -0
- package/vendor/procedural-animals/src/species/bear/sculpt.js +272 -0
- package/vendor/procedural-animals/src/species/boar/behaviour.js +335 -0
- package/vendor/procedural-animals/src/species/boar/coat.js +372 -0
- package/vendor/procedural-animals/src/species/boar/index.js +110 -0
- package/vendor/procedural-animals/src/species/boar/motion.js +85 -0
- package/vendor/procedural-animals/src/species/boar/regions.js +88 -0
- package/vendor/procedural-animals/src/species/boar/rig.js +111 -0
- package/vendor/procedural-animals/src/species/boar/sculpt.js +285 -0
- package/vendor/procedural-animals/src/species/cat/behaviour.js +559 -0
- package/vendor/procedural-animals/src/species/cat/coat.js +841 -0
- package/vendor/procedural-animals/src/species/cat/index.js +211 -0
- package/vendor/procedural-animals/src/species/cat/motion.js +101 -0
- package/vendor/procedural-animals/src/species/cat/regions.js +82 -0
- package/vendor/procedural-animals/src/species/cat/rig.js +100 -0
- package/vendor/procedural-animals/src/species/cat/sculpt.js +266 -0
- package/vendor/procedural-animals/src/species/cat/whiskers.js +110 -0
- package/vendor/procedural-animals/src/species/cheetah/coat.js +427 -0
- package/vendor/procedural-animals/src/species/cheetah/index.js +51 -0
- package/vendor/procedural-animals/src/species/cheetah/joints.js +3 -0
- package/vendor/procedural-animals/src/species/cheetah/motion.js +77 -0
- package/vendor/procedural-animals/src/species/cheetah/regions.js +95 -0
- package/vendor/procedural-animals/src/species/cheetah/rig.js +66 -0
- package/vendor/procedural-animals/src/species/cheetah/sculpt.js +158 -0
- package/vendor/procedural-animals/src/species/chicken/coat.js +313 -0
- package/vendor/procedural-animals/src/species/chicken/coverts.js +320 -0
- package/vendor/procedural-animals/src/species/chicken/index.js +110 -0
- package/vendor/procedural-animals/src/species/chicken/motion.js +177 -0
- package/vendor/procedural-animals/src/species/chicken/regions.js +66 -0
- package/vendor/procedural-animals/src/species/chicken/rig.js +144 -0
- package/vendor/procedural-animals/src/species/chicken/sculpt.js +389 -0
- package/vendor/procedural-animals/src/species/chicken/wingLook.js +66 -0
- package/vendor/procedural-animals/src/species/chicken/wingStack.js +124 -0
- package/vendor/procedural-animals/src/species/cow/behaviour.js +521 -0
- package/vendor/procedural-animals/src/species/cow/coat.js +465 -0
- package/vendor/procedural-animals/src/species/cow/index.js +118 -0
- package/vendor/procedural-animals/src/species/cow/motion.js +81 -0
- package/vendor/procedural-animals/src/species/cow/regions.js +98 -0
- package/vendor/procedural-animals/src/species/cow/rig.js +116 -0
- package/vendor/procedural-animals/src/species/cow/sculpt.js +339 -0
- package/vendor/procedural-animals/src/species/crow/coat.js +145 -0
- package/vendor/procedural-animals/src/species/crow/index.js +70 -0
- package/vendor/procedural-animals/src/species/crow/joints.js +3 -0
- package/vendor/procedural-animals/src/species/crow/motion.js +101 -0
- package/vendor/procedural-animals/src/species/crow/regions.js +50 -0
- package/vendor/procedural-animals/src/species/crow/rig.js +83 -0
- package/vendor/procedural-animals/src/species/crow/sculpt.js +118 -0
- package/vendor/procedural-animals/src/species/deer/behaviour.js +513 -0
- package/vendor/procedural-animals/src/species/deer/coat.js +391 -0
- package/vendor/procedural-animals/src/species/deer/index.js +106 -0
- package/vendor/procedural-animals/src/species/deer/motion.js +97 -0
- package/vendor/procedural-animals/src/species/deer/regions.js +60 -0
- package/vendor/procedural-animals/src/species/deer/rig.js +124 -0
- package/vendor/procedural-animals/src/species/deer/sculpt.js +297 -0
- package/vendor/procedural-animals/src/species/dog/behaviour.js +521 -0
- package/vendor/procedural-animals/src/species/dog/coat.js +495 -0
- package/vendor/procedural-animals/src/species/dog/index.js +144 -0
- package/vendor/procedural-animals/src/species/dog/motion.js +118 -0
- package/vendor/procedural-animals/src/species/dog/regions.js +61 -0
- package/vendor/procedural-animals/src/species/dog/rig.js +129 -0
- package/vendor/procedural-animals/src/species/dog/sculpt.js +246 -0
- package/vendor/procedural-animals/src/species/eagle/coat.js +250 -0
- package/vendor/procedural-animals/src/species/eagle/index.js +76 -0
- package/vendor/procedural-animals/src/species/eagle/joints.js +3 -0
- package/vendor/procedural-animals/src/species/eagle/motion.js +137 -0
- package/vendor/procedural-animals/src/species/eagle/regions.js +57 -0
- package/vendor/procedural-animals/src/species/eagle/rig.js +107 -0
- package/vendor/procedural-animals/src/species/eagle/sculpt.js +137 -0
- package/vendor/procedural-animals/src/species/fish/coat.js +271 -0
- package/vendor/procedural-animals/src/species/fish/index.js +88 -0
- package/vendor/procedural-animals/src/species/fish/motion.js +92 -0
- package/vendor/procedural-animals/src/species/fish/regions.js +27 -0
- package/vendor/procedural-animals/src/species/fish/rig.js +143 -0
- package/vendor/procedural-animals/src/species/fish/sculpt.js +214 -0
- package/vendor/procedural-animals/src/species/fish/variants.js +126 -0
- package/vendor/procedural-animals/src/species/fox/behaviour.js +314 -0
- package/vendor/procedural-animals/src/species/fox/coat.js +444 -0
- package/vendor/procedural-animals/src/species/fox/index.js +120 -0
- package/vendor/procedural-animals/src/species/fox/motion.js +81 -0
- package/vendor/procedural-animals/src/species/fox/regions.js +59 -0
- package/vendor/procedural-animals/src/species/fox/rig.js +91 -0
- package/vendor/procedural-animals/src/species/fox/sculpt.js +202 -0
- package/vendor/procedural-animals/src/species/frog/behaviour.js +590 -0
- package/vendor/procedural-animals/src/species/frog/coat.js +305 -0
- package/vendor/procedural-animals/src/species/frog/index.js +97 -0
- package/vendor/procedural-animals/src/species/frog/motion.js +69 -0
- package/vendor/procedural-animals/src/species/frog/regions.js +46 -0
- package/vendor/procedural-animals/src/species/frog/rig.js +156 -0
- package/vendor/procedural-animals/src/species/frog/sculpt.js +240 -0
- package/vendor/procedural-animals/src/species/goat/behaviour.js +509 -0
- package/vendor/procedural-animals/src/species/goat/coat.js +590 -0
- package/vendor/procedural-animals/src/species/goat/index.js +149 -0
- package/vendor/procedural-animals/src/species/goat/motion.js +95 -0
- package/vendor/procedural-animals/src/species/goat/regions.js +98 -0
- package/vendor/procedural-animals/src/species/goat/rig.js +181 -0
- package/vendor/procedural-animals/src/species/goat/sculpt.js +547 -0
- package/vendor/procedural-animals/src/species/horse/coat.js +361 -0
- package/vendor/procedural-animals/src/species/horse/coatSeam.js +122 -0
- package/vendor/procedural-animals/src/species/horse/index.js +80 -0
- package/vendor/procedural-animals/src/species/horse/motion.js +245 -0
- package/vendor/procedural-animals/src/species/horse/regions.js +60 -0
- package/vendor/procedural-animals/src/species/horse/rig.js +117 -0
- package/vendor/procedural-animals/src/species/horse/sculpt.js +316 -0
- package/vendor/procedural-animals/src/species/horse/seamWeights.js +272 -0
- package/vendor/procedural-animals/src/species/lion/behaviour.js +509 -0
- package/vendor/procedural-animals/src/species/lion/coat.js +1016 -0
- package/vendor/procedural-animals/src/species/lion/index.js +111 -0
- package/vendor/procedural-animals/src/species/lion/motion.js +87 -0
- package/vendor/procedural-animals/src/species/lion/regions.js +106 -0
- package/vendor/procedural-animals/src/species/lion/rig.js +110 -0
- package/vendor/procedural-animals/src/species/lion/sculpt.js +384 -0
- package/vendor/procedural-animals/src/species/lion/whiskers.js +132 -0
- package/vendor/procedural-animals/src/species/pig/behaviour.js +575 -0
- package/vendor/procedural-animals/src/species/pig/coat.js +730 -0
- package/vendor/procedural-animals/src/species/pig/ears.js +242 -0
- package/vendor/procedural-animals/src/species/pig/index.js +161 -0
- package/vendor/procedural-animals/src/species/pig/motion.js +105 -0
- package/vendor/procedural-animals/src/species/pig/regions.js +100 -0
- package/vendor/procedural-animals/src/species/pig/rig.js +152 -0
- package/vendor/procedural-animals/src/species/pig/sculpt.js +382 -0
- package/vendor/procedural-animals/src/species/rabbit/behaviour.js +605 -0
- package/vendor/procedural-animals/src/species/rabbit/coat.js +285 -0
- package/vendor/procedural-animals/src/species/rabbit/index.js +85 -0
- package/vendor/procedural-animals/src/species/rabbit/motion.js +85 -0
- package/vendor/procedural-animals/src/species/rabbit/regions.js +48 -0
- package/vendor/procedural-animals/src/species/rabbit/rig.js +99 -0
- package/vendor/procedural-animals/src/species/rabbit/sculpt.js +148 -0
- package/vendor/procedural-animals/src/species/rat/behaviour.js +539 -0
- package/vendor/procedural-animals/src/species/rat/coat.js +341 -0
- package/vendor/procedural-animals/src/species/rat/index.js +111 -0
- package/vendor/procedural-animals/src/species/rat/motion.js +90 -0
- package/vendor/procedural-animals/src/species/rat/regions.js +92 -0
- package/vendor/procedural-animals/src/species/rat/rig.js +112 -0
- package/vendor/procedural-animals/src/species/rat/sculpt.js +163 -0
- package/vendor/procedural-animals/src/species/rat/whiskers.js +119 -0
- package/vendor/procedural-animals/src/species/shark/coat.js +383 -0
- package/vendor/procedural-animals/src/species/shark/index.js +104 -0
- package/vendor/procedural-animals/src/species/shark/motion.js +69 -0
- package/vendor/procedural-animals/src/species/shark/regions.js +34 -0
- package/vendor/procedural-animals/src/species/shark/rig.js +194 -0
- package/vendor/procedural-animals/src/species/shark/sculpt.js +343 -0
- package/vendor/procedural-animals/src/species/shark/variants.js +105 -0
- package/vendor/procedural-animals/src/species/sheep/behaviour.js +522 -0
- package/vendor/procedural-animals/src/species/sheep/coat.js +529 -0
- package/vendor/procedural-animals/src/species/sheep/index.js +152 -0
- package/vendor/procedural-animals/src/species/sheep/motion.js +86 -0
- package/vendor/procedural-animals/src/species/sheep/neck.js +41 -0
- package/vendor/procedural-animals/src/species/sheep/regions.js +62 -0
- package/vendor/procedural-animals/src/species/sheep/rig.js +163 -0
- package/vendor/procedural-animals/src/species/sheep/sculpt.js +542 -0
- package/vendor/procedural-animals/src/species/snake/coat.js +315 -0
- package/vendor/procedural-animals/src/species/snake/index.js +73 -0
- package/vendor/procedural-animals/src/species/snake/motion.js +51 -0
- package/vendor/procedural-animals/src/species/snake/regions.js +51 -0
- package/vendor/procedural-animals/src/species/snake/rig.js +108 -0
- package/vendor/procedural-animals/src/species/snake/sculpt.js +122 -0
- package/vendor/procedural-animals/src/species/spider/coat.js +279 -0
- package/vendor/procedural-animals/src/species/spider/index.js +78 -0
- package/vendor/procedural-animals/src/species/spider/motion.js +72 -0
- package/vendor/procedural-animals/src/species/spider/regions.js +87 -0
- package/vendor/procedural-animals/src/species/spider/rig.js +118 -0
- package/vendor/procedural-animals/src/species/spider/sculpt.js +182 -0
- package/vendor/procedural-animals/src/species/wolf/behaviour.js +160 -0
- package/vendor/procedural-animals/src/species/wolf/coat.js +749 -0
- package/vendor/procedural-animals/src/species/wolf/index.js +107 -0
- package/vendor/procedural-animals/src/species/wolf/motion.js +80 -0
- package/vendor/procedural-animals/src/species/wolf/regions.js +57 -0
- package/vendor/procedural-animals/src/species/wolf/rig.js +87 -0
- package/vendor/procedural-animals/src/species/wolf/sculpt.js +339 -0
- package/vendor/procedural-animals/src/worker.js +29 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
// Horse motion data for the quadruped engine (schema: src/core/motion/quadruped.js).
|
|
2
|
+
// Numbers are for the reference individual (params.size = 1, 1.63 m at the withers); the engine
|
|
3
|
+
// scales them by dynamic similarity for ponies, foals and big horses.
|
|
4
|
+
//
|
|
5
|
+
// Gaits: lateral-sequence 4-beat walk, 2-beat diagonal trot (hind lands
|
|
6
|
+
// ~2 % before its diagonal fore), 3-beat canter (right lead: LH, then RH + LF, then RF) and 4-beat
|
|
7
|
+
// transverse gallop (LH, RH, LF, RF, one gathered suspension). Rows sit so the table's crossover
|
|
8
|
+
// speeds are the measured transitions: walk -> trot 2.1 m/s (Froude 0.35), trot -> canter ~5 m/s,
|
|
9
|
+
// canter -> gallop ~8.8 m/s. Stride frequency rises only slowly in the gallop; stride length does
|
|
10
|
+
// the work.
|
|
11
|
+
import { HEAD_PITCH } from './rig.js';
|
|
12
|
+
import { ONESHOTS, POSTURES } from '../../core/motion/actions.js';
|
|
13
|
+
// the bind pose carries the head less flexed at the poll than the resting horse (the throat skin is
|
|
14
|
+
// meshed at mid-range between grazing and an alert head): the carriage table adds the difference
|
|
15
|
+
const DP = (55 * Math.PI) / 180 - HEAD_PITCH;
|
|
16
|
+
const G = (name, v, f, D, off, o) => ({ name, v, f, D, off, ...o });
|
|
17
|
+
const DEG = Math.PI / 180;
|
|
18
|
+
const clamp = (x, a, b) => (x < a ? a : x > b ? b : x);
|
|
19
|
+
const smooth = (a, b, x) => { const t = clamp((x - a) / (b - a), 0, 1); return t * t * (3 - 2 * t); };
|
|
20
|
+
const mx = (P, k, v, w) => { P[k] += (v - P[k]) * w; };
|
|
21
|
+
|
|
22
|
+
export const motion = {
|
|
23
|
+
maxSpeed: 18,
|
|
24
|
+
accel: [3.5, 6],
|
|
25
|
+
decel: 6.5,
|
|
26
|
+
// school figures: a trot circle of ~6-10 m, lean below ~15 deg (lateral acceleration ~2.8 m/s^2)
|
|
27
|
+
turnRate: 1.0,
|
|
28
|
+
latAccelMax: 2.8,
|
|
29
|
+
gears: { walk: 1.5, trot: 3.6, canter: 6.2, gallop: 13 },
|
|
30
|
+
gallopBlend: [5, 10],
|
|
31
|
+
// (drop: the girdles carried 1-2 cm low from the fast walk up. A horse stands on nearly straight
|
|
32
|
+
// forelegs: at the standing height the foreleg's forward reach is at the edge of its range, where
|
|
33
|
+
// the reach grows as a square root, and a trot braking through that height moved the landing of a
|
|
34
|
+
// swinging forefoot 8 cm in one frame. The top gallop row: 6 cm drop and 2.2 Hz (were 8 cm and
|
|
35
|
+
// 2.35 Hz, which left 2-frame fore stances dragged in sprint turns and jerking elbows at the sprint)
|
|
36
|
+
// name v f D [FL, FR, HL, HR]
|
|
37
|
+
gaits: [
|
|
38
|
+
G('walk', 0.0, 0.75, 0.72, [0.25, 0.75, 0.0, 0.5], { liftF: 0.08, liftH: 0.07, bobF: 0.03, bobH: 0.03, flex: 0, lat: 0.02, fold: 0.3, heel: 30, tail: 0, drop: 0 }),
|
|
39
|
+
G('walk', 1.7, 0.98, 0.63, [0.25, 0.75, 0.0, 0.5], { liftF: 0.1, liftH: 0.085, bobF: 0.08, bobH: 0.08, flex: 0, lat: 0.025, fold: 0.42, heel: 40, tail: 0.1, drop: 0.01 }),
|
|
40
|
+
G('trot', 2.5, 1.3, 0.5, [0.52, 0.02, 0.0, 0.5], { liftF: 0.15, liftH: 0.12, bobF: 0.07, bobH: 0.07, flex: 0.01, lat: 0.0, fold: 1.0, heel: 50, tail: 0.35, drop: 0.02 }),
|
|
41
|
+
G('trot', 4.2, 1.5, 0.42, [0.52, 0.02, 0.0, 0.5], { liftF: 0.18, liftH: 0.15, bobF: 0.08, bobH: 0.08, flex: 0.015, lat: 0.0, fold: 1.1, heel: 55, tail: 0.45, drop: 0.02 }),
|
|
42
|
+
G('canter', 5.8, 1.75, 0.45, [0.3, 0.55, 0.0, 0.27], { liftF: 0.2, liftH: 0.16, bobF: 0.035, bobH: 0.05, flex: 0.05, lat: 0, fold: 1.15, heel: 55, tail: 0.55, drop: 0.03 }),
|
|
43
|
+
G('canter', 7.5, 1.9, 0.38, [0.3, 0.55, 0.0, 0.25], { liftF: 0.22, liftH: 0.18, bobF: 0.04, bobH: 0.055, flex: 0.07, lat: 0, fold: 1.2, heel: 45, tail: 0.65, drop: 0.035 }),
|
|
44
|
+
G('gallop', 10, 2.1, 0.28, [0.38, 0.52, 0.0, 0.12], { liftF: 0.25, liftH: 0.21, bobF: 0.045, bobH: 0.06, flex: 0.1, lat: 0, fold: 1.3, heel: 40, tail: 0.8, drop: 0.06 }),
|
|
45
|
+
G('gallop', 17, 2.2, 0.21, [0.4, 0.52, 0.0, 0.13], { liftF: 0.28, liftH: 0.24, bobF: 0.045, bobH: 0.065, flex: 0.13, lat: 0, fold: 1.4, heel: 40, tail: 1.0, drop: 0.06 }),
|
|
46
|
+
],
|
|
47
|
+
feet: {
|
|
48
|
+
// hoof: fetlock sinks under load (the suspensory apparatus), the hoof flips in swing,
|
|
49
|
+
// breakover about the toe at push-off
|
|
50
|
+
front: { type: 'unguligrade', contact: 0.95, curl: 70, flex: 4, sink: 20, hoofFlex: 25, swingBack: 0.25 },
|
|
51
|
+
hind: { type: 'unguligrade', contact: 0.95, curl: 70, flex: 4, sink: 16, hoofFlex: 25, swingBack: 0.05 },
|
|
52
|
+
},
|
|
53
|
+
stance: { width: 1, gallopWidth: 0.8, sprawl: 0, crouch: 0, scuff: [14, 24, 0] },
|
|
54
|
+
// torso cross-sections (bind pose, reference size): centre height, half height, half width
|
|
55
|
+
body: {
|
|
56
|
+
// (half heights include the legs folded under the chest and thighs when lying down)
|
|
57
|
+
chest: { y: 1.25, hh: 0.45, hw: 0.31 },
|
|
58
|
+
mid: { y: 1.24, hh: 0.37, hw: 0.3 },
|
|
59
|
+
pelvis: { y: 1.32, hh: 0.5, hw: 0.38 }, // (hw: the thigh muscles a horse lying flat rests on)
|
|
60
|
+
back: 0.15,
|
|
61
|
+
},
|
|
62
|
+
head: {
|
|
63
|
+
// [speed, raise (m), reach (m), pitch (rad, + = nose down)]: the head goes down and forward
|
|
64
|
+
// at the walk, is carried higher at the trot and stretched forward in the gallop
|
|
65
|
+
carriage: [[0, 0, 0, DP], [1.5, -0.06, 0.06, 0.05 + DP], [3.5, -0.02, 0.04, 0.02 + DP], [6.5, -0.14, 0.12, 0.1 + DP], [14, -0.28, 0.2, 0.12 + DP]],
|
|
66
|
+
// walk: the head nods (see hooks), trot: steady, canter / gallop: swings with the stride
|
|
67
|
+
stab: [[0, 0], [1.5, 0.1], [3.5, 0.45], [6.5, 0.3], [14, 0.35]],
|
|
68
|
+
neckBend: 50, neckPivot: 0.5, yaw: 0.55, pitchUp: 0.6, pitchDown: 0.9, mouth: 'jawTip',
|
|
69
|
+
},
|
|
70
|
+
tail: {
|
|
71
|
+
// [speed, pitch per segment from horizontal (deg), dock -> hair tip]
|
|
72
|
+
carriage: [
|
|
73
|
+
[0.0, [-25, -50, -66, -76, -82, -86, -88, -89, -89, -89]],
|
|
74
|
+
[1.5, [-20, -45, -62, -74, -80, -85, -87, -88, -88, -88]],
|
|
75
|
+
[3.5, [-5, -26, -46, -60, -70, -76, -79, -81, -83, -84]],
|
|
76
|
+
[6.5, [8, -10, -28, -42, -52, -58, -62, -64, -66, -68]],
|
|
77
|
+
[14, [14, 0, -12, -22, -28, -30, -30, -30, -31, -32]],
|
|
78
|
+
],
|
|
79
|
+
stiffness: 0.8, sway: 5, flick: 0, wag: 0, swish: 1, curl: 0, balance: 0,
|
|
80
|
+
radius: [0.07, 0.09], // (dock, then the hair switch)
|
|
81
|
+
},
|
|
82
|
+
ears: { rest: [0, 0], mobility: 1.25, speedFlatten: 0.25, twitch: 1.2, prick: 0.45 },
|
|
83
|
+
breath: { rate: 0.2, amp: 0.008, pant: false, pantRate: 1.2, pantAmp: 0.02, heatSpeed: 10 },
|
|
84
|
+
actions: {
|
|
85
|
+
attack: { style: 'kick', kick: 'double', kickReach: [0.6, 0.45] }, // play('attack', { kick: 'rear' }) rears and strikes
|
|
86
|
+
// grazing / drinking: the long head hangs near vertical (the default pitch 1.3 curls a cat's head
|
|
87
|
+
// under; a horse's head is already carried 55 deg nose-down in the bind pose)
|
|
88
|
+
eat: { style: 'graze', dropF: 0, dropH: 0, pitch: DP + 0.7, ahead: 0.45 },
|
|
89
|
+
drink: { dropF: 0, dropH: 0, pitch: DP + 0.7, ahead: 0.45 },
|
|
90
|
+
// a 1 m jump (0.7 m flight from the canter) lands the forelegs in step with the canter; the landing
|
|
91
|
+
// sink comes from the engine's landing springs, the crouch adds a little knee give
|
|
92
|
+
jump: { height: 1.0, distance: 3.6, land: [0.15, 0.12] },
|
|
93
|
+
sit: { dropH: 1.0 }, // (the hind cannons fold flat under the haunches and the rump rests on the ground)
|
|
94
|
+
// kneels on the forelegs first, then lowers the hindquarters; gets up forelegs first
|
|
95
|
+
lie: { down: 'front', up: 'front' },
|
|
96
|
+
sleep: { style: 'lateral', down: 'front', up: 'front' },
|
|
97
|
+
// lying sternal: forelegs folded under the chest (carpus flexed, cannons back along the ground)
|
|
98
|
+
fold: { front: { z: -0.26, k: 1.5, beta: 0.9 } },
|
|
99
|
+
},
|
|
100
|
+
// tack: saddle seat on the back (T12-T14, ~0.30 m behind the withers, from the research),
|
|
101
|
+
// rider's seat above it, stirrup treads, bit rings at the mouth corners
|
|
102
|
+
attachments: {
|
|
103
|
+
back: { bone: 'spine3', from: 'saddle' },
|
|
104
|
+
seat: { bone: 'spine3', from: 'seat' },
|
|
105
|
+
stirrupL: { bone: 'spine3', from: 'stirrupL' },
|
|
106
|
+
stirrupR: { bone: 'spine3', from: 'stirrupR' },
|
|
107
|
+
bitL: { bone: 'head', from: 'jawHinge', to: 'jawTip', t: 0.76, offset: [0.047, 0, 0] },
|
|
108
|
+
bitR: { bone: 'head', from: 'jawHinge', to: 'jawTip', t: 0.76, offset: [-0.047, 0, 0] },
|
|
109
|
+
},
|
|
110
|
+
hooks: { update: horseBehaviour, actions: { attack: horseAttack(), lie: rising(POSTURES.lie), sleep: rising(POSTURES.sleep) } },
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
// Getting up (lie / sleep with tune.up): the core staged rise follows its front / hind weights with a
|
|
114
|
+
// spring, which still held ~4 % of the lying drop when the posture's weight reached zero and the
|
|
115
|
+
// posture ended, so the body stepped 2.5 cm up in the last frame (a 3.07 % S jitter at the hind
|
|
116
|
+
// fetlocks). The staged weights are held under the posture weight as it fades out, so both reach
|
|
117
|
+
// zero together.
|
|
118
|
+
function rising(core) {
|
|
119
|
+
return {
|
|
120
|
+
...core, kind: 'posture',
|
|
121
|
+
apply(P, w, inst, L) {
|
|
122
|
+
if (inst.target === 0 && inst.kF !== undefined) {
|
|
123
|
+
const cap = smooth(0, 0.3, w);
|
|
124
|
+
inst.kF = Math.min(inst.kF, cap); inst.kH = Math.min(inst.kH, cap);
|
|
125
|
+
}
|
|
126
|
+
core.apply.call(this, P, w, inst, L);
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Attack on the move: a horse does not kick out of a canter; it props to a halt (the stride runs
|
|
132
|
+
// on while it brakes) and kicks from the stand. The core's kick holds the legs out of the gait
|
|
133
|
+
// (legGait 0.4), so started at speed it dragged the planted forefeet ~1.9 leg lengths behind and
|
|
134
|
+
// then snapped them forward (a 120 rad/s* forearm pop). Braking first keeps every stride stepped.
|
|
135
|
+
function horseAttack() {
|
|
136
|
+
const core = ONESHOTS.attack;
|
|
137
|
+
const HALT = 0.7; // m/s x sk: kick below this speed
|
|
138
|
+
return {
|
|
139
|
+
...core,
|
|
140
|
+
start(inst, L) {
|
|
141
|
+
const e = L.engine;
|
|
142
|
+
inst.brake = e.speed > HALT * e.cfg.sk;
|
|
143
|
+
inst.t0 = 0;
|
|
144
|
+
core.start.call(this, inst, L);
|
|
145
|
+
},
|
|
146
|
+
update(inst, dt, L) {
|
|
147
|
+
const e = L.engine;
|
|
148
|
+
if (inst.brake) {
|
|
149
|
+
if (e.speed <= HALT * e.cfg.sk || inst.t > 3) { inst.brake = false; inst.t0 = inst.t; core.start.call(this, inst, L); }
|
|
150
|
+
return false;
|
|
151
|
+
}
|
|
152
|
+
const t = inst.t; inst.t = t - inst.t0;
|
|
153
|
+
const r = core.update.call(this, inst, dt, L);
|
|
154
|
+
inst.t = t;
|
|
155
|
+
return r;
|
|
156
|
+
},
|
|
157
|
+
apply(P, w, inst, L) {
|
|
158
|
+
// (held to a halt through the kick; the speed request comes back as the attack fades out)
|
|
159
|
+
mx(P, 'speedScale', 0, w);
|
|
160
|
+
if (inst.brake) { mx(P, 'earFlat', 1, w * smooth(0, 0.3, inst.t)); return; }
|
|
161
|
+
const t = inst.t; inst.t = t - inst.t0;
|
|
162
|
+
core.apply.call(this, P, w, inst, L);
|
|
163
|
+
inst.t = t;
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Horse behaviour on top of the actions (see core/motion/actions.js):
|
|
169
|
+
// * walk: the head and neck nod once per forelimb stance (twice per stride);
|
|
170
|
+
// * idle: after a while the horse dozes on its feet (stay apparatus): one hind leg rested on the
|
|
171
|
+
// toe of its hoof with that hip dropped, head lowered to withers level, lower lip slack, ears
|
|
172
|
+
// sideways, eyes half closed; it swaps the resting leg now and then. Flies: tail swishes.
|
|
173
|
+
function horseBehaviour(P, dt, layer) {
|
|
174
|
+
const e = layer.engine, cfg = e.cfg, s = cfg.s, u = 1 / cfg.unit; // (posture lengths are in cheetah units: x cfg.k)
|
|
175
|
+
const st = layer.horse || (layer.horse = { idleT: 0, doze: 0, dozeOn: false, dozeT: 10 + e.rand() * 6, restLeg: 2, swishT: 3, swish: 0, swishAge: 9 });
|
|
176
|
+
const vn = e.speed / cfg.sq, g = e.gait;
|
|
177
|
+
// ---- walk head nod
|
|
178
|
+
const walkW = smooth(0.15, 0.7, vn) * (1 - smooth(1.9, 2.4, vn)) * P.gaitW;
|
|
179
|
+
if (walkW > 0.001) {
|
|
180
|
+
const ph = e.phase - g.off[0];
|
|
181
|
+
const c = 0.5 + 0.5 * Math.cos(4 * Math.PI * (ph - 0.12));
|
|
182
|
+
P.headRaise -= 0.07 * u * walkW * c;
|
|
183
|
+
P.headPitch += 0.06 * walkW * (c - 0.5);
|
|
184
|
+
}
|
|
185
|
+
// ---- idle: dozing on its feet
|
|
186
|
+
const idleW = layer.idle.w;
|
|
187
|
+
if (idleW > 0.9 && !layer.postures.length) st.idleT += dt; else { st.idleT = 0; st.dozeOn = false; }
|
|
188
|
+
if (st.idleT > 0) {
|
|
189
|
+
st.dozeT -= dt;
|
|
190
|
+
if (st.dozeT <= 0) {
|
|
191
|
+
st.dozeOn = !st.dozeOn;
|
|
192
|
+
st.dozeT = st.dozeOn ? 14 + e.rand() * 14 : 5 + e.rand() * 6;
|
|
193
|
+
if (st.dozeOn) st.restLeg = e.rand() < 0.5 ? 2 : 3;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
st.doze = clamp(st.doze + (st.dozeOn ? dt * 0.35 : -dt * 0.8), 0, 1);
|
|
197
|
+
const dz = smooth(0, 1, st.doze) * idleW;
|
|
198
|
+
if (dz > 0.001) {
|
|
199
|
+
layer.idle.stepT = Math.max(layer.idle.stepT, 1); // no re-steps while dozing
|
|
200
|
+
const leg = e.legs[st.restLeg], L = leg.def, pl = P.legs[st.restLeg];
|
|
201
|
+
const side = L.s;
|
|
202
|
+
// resting hind hoof tipped on its toe a little forward and under the body
|
|
203
|
+
const tgt = e.bodyToWorld(L.cx * side * 0.85, 0, L.cz + 0.1 * s, e.heading, e.pos, pl.target);
|
|
204
|
+
tgt.y = e.terrainH(tgt.x, tgt.z);
|
|
205
|
+
const w = smooth(0, 0.6, dz);
|
|
206
|
+
pl.reach += (1 - pl.reach) * w;
|
|
207
|
+
mx(P, 'roll', 0.035 * side * -1, dz); // that hip drops
|
|
208
|
+
mx(P, 'dropH', 0.05, dz); mx(P, 'side', -0.012 * u * side, dz);
|
|
209
|
+
mx(P, 'headRaise', -0.3 * u, dz); mx(P, 'headPitch', 0.18, dz); mx(P, 'neckReach', 0.06 * u, dz);
|
|
210
|
+
mx(P, 'eyelid', 0.6, dz); mx(P, 'jaw', 0.05, dz);
|
|
211
|
+
mx(P, 'earFlat', 0.35, dz); mx(P, 'earSwivel', 0.5, dz); mx(P, 'earTwitch', 0.25, dz);
|
|
212
|
+
mx(P, 'lookW', 0, dz); mx(P, 'breathRate', 0.75, dz); mx(P, 'tailIdle', 0.5, dz);
|
|
213
|
+
}
|
|
214
|
+
// ---- grazing / drinking: the trunk stays level on straight forelegs and the long neck does the
|
|
215
|
+
// reaching (the engine would otherwise lower the forehand); one fore hoof is advanced
|
|
216
|
+
let graze = 0;
|
|
217
|
+
for (const o of layer.oneshots) if (o.name === 'eat' || o.name === 'drink') graze = Math.max(graze, o.w * o.w * (3 - 2 * o.w));
|
|
218
|
+
if (graze > 0.001) {
|
|
219
|
+
P.headReach *= 1 - graze;
|
|
220
|
+
mx(P, 'dropF', 0.055, graze); mx(P, 'dropH', 0, graze); // (the withers give ~4 cm: saddle < 2 cm, < 2.5 deg)
|
|
221
|
+
layer.idle.stepT = Math.max(layer.idle.stepT, 1);
|
|
222
|
+
}
|
|
223
|
+
if (graze > 0.5) e.legs[0].idleOff.set(0, 0, 0.22 * s); // (released: the idle layer relaxes it back)
|
|
224
|
+
// ---- flat out (lateral sleep, death): the long head lies on its cheek, the ears laid back along
|
|
225
|
+
// the neck instead of sticking into the ground
|
|
226
|
+
for (const p of layer.postures) {
|
|
227
|
+
if (p.name !== 'sleep' && p.name !== 'death') continue;
|
|
228
|
+
const w = p.w * p.w * (3 - 2 * p.w) * (p.name === 'sleep' ? smooth(1.0, 3.0, p.t) : smooth(0.35, 1.0, p.t));
|
|
229
|
+
P.headPos.y += 0.14 * s * w;
|
|
230
|
+
P.headPitch += 0.5 * w; // (nose tucked: the throat is not stretched open)
|
|
231
|
+
mx(P, 'earFlat', 1, w); mx(P, 'earTwitch', 0.1, w);
|
|
232
|
+
// the forelegs held a little out from the ground, straight (the side pose presses the hooves to
|
|
233
|
+
// the ground and the long cannon sagged into a bump on uneven ground, 35 mm at the knee)
|
|
234
|
+
for (let i = 0; i < 2; i++) { const pl = P.legs[i]; pl.tuck += (1 - pl.tuck) * 0.12 * w; pl.extend = 1; }
|
|
235
|
+
}
|
|
236
|
+
// ---- fly swish: short bursts of tail lashing while standing
|
|
237
|
+
if (idleW > 0.5) {
|
|
238
|
+
st.swishT -= dt;
|
|
239
|
+
if (st.swishT <= 0) { st.swishT = 4 + e.rand() * 8; st.swishAge = 0; }
|
|
240
|
+
}
|
|
241
|
+
st.swishAge += dt;
|
|
242
|
+
const sw = Math.sin(Math.PI * clamp(st.swishAge / 1.6, 0, 1)) * idleW;
|
|
243
|
+
if (sw > 0.001) P.tailWag = Math.max(P.tailWag, 0.55 * sw);
|
|
244
|
+
void DEG;
|
|
245
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Meshing plan: body at 10.7 mm (0.66 % of the withers height), head at 5.1 mm overlapping the body
|
|
2
|
+
// across the upper neck and cross-faded, eyelid patches at 1.6 mm, and the lower lip / chin as its
|
|
3
|
+
// own rigid surface so the mouth can open.
|
|
4
|
+
import { EYE } from './sculpt.js';
|
|
5
|
+
import { HEAD_O, horseJoints } from './rig.js';
|
|
6
|
+
import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
|
|
7
|
+
import { norm, smoothstep } from '../../core/math/vec.js';
|
|
8
|
+
|
|
9
|
+
const J = horseJoints();
|
|
10
|
+
// the head hangs steeply from the neck: cut just behind the poll - throat latch line
|
|
11
|
+
export const NECK_CUT = { c: [0, 1.7, J.occiput[2] - 0.045], d: norm([0, 0.25, 1]), band: 0.024 };
|
|
12
|
+
export const neckS = (x, y, z) => (x - NECK_CUT.c[0]) * NECK_CUT.d[0] + (y - NECK_CUT.c[1]) * NECK_CUT.d[1] + (z - NECK_CUT.c[2]) * NECK_CUT.d[2];
|
|
13
|
+
|
|
14
|
+
export const EYE_PATCH = { R: 0.042, B: 0.007, h: 0.0016, centres: [1, -1].map((s) => eyeFrameOf(EYE, HEAD_O, s).c) };
|
|
15
|
+
export function eyePatchWeight(x, y, z) {
|
|
16
|
+
let dmin = 1e9;
|
|
17
|
+
for (const c of EYE_PATCH.centres) dmin = Math.min(dmin, Math.hypot(x - c[0], y - c[1], z - c[2]));
|
|
18
|
+
return 1 - smoothstep(EYE_PATCH.R - EYE_PATCH.B, EYE_PATCH.R + EYE_PATCH.B, dmin);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Cell sizes (x Q.res): body and head. The head / body cross-fade band B widens with the body's cell
|
|
22
|
+
// at the coarse tiers (at least one body cell), and the two surfaces overlap by OV: across the middle
|
|
23
|
+
// of the band both are drawn (fade > 0.5), so the fur does not thin where two half-faded shell stacks
|
|
24
|
+
// meet (a dark seam over the under-shell base) and no crack opens between them.
|
|
25
|
+
export const H_BODY = 0.0111, H_HEAD = 0.0051;
|
|
26
|
+
export function neckBand(r) {
|
|
27
|
+
const B = Math.max(NECK_CUT.band, 1.1 * H_BODY * r), OV = 0.5 * B;
|
|
28
|
+
// Each surface runs on 2-3 of its own cells past the band, where it is hidden (fade 0): its ragged
|
|
29
|
+
// clip edge stays out of view, and its band vertices are not biased by the edge (the axial skin
|
|
30
|
+
// coordinate is relaxed over each surface separately, so near an edge it drifts by about a cell)
|
|
31
|
+
return { B, OV, clipBody: B + OV + 3 * H_BODY * r, clipHead: B + OV + 2 * H_HEAD * r };
|
|
32
|
+
}
|
|
33
|
+
export const neckFade = (sN, name, r) => {
|
|
34
|
+
const { B, OV } = neckBand(r);
|
|
35
|
+
return name === 'body' ? 1 - smoothstep(-B, B, sN - OV) : smoothstep(-B, B, sN + OV);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export function horseRegions(rig, params, Q) {
|
|
39
|
+
const r = Q.res, { B, OV, clipBody, clipHead } = neckBand(r);
|
|
40
|
+
const patches = Q.eyePatches ? EYE_PATCH.centres.map((c) => ({ c, R: EYE_PATCH.R, B: EYE_PATCH.B, h: EYE_PATCH.h * Math.max(1, r) })) : [];
|
|
41
|
+
return {
|
|
42
|
+
jobs: [
|
|
43
|
+
[{ name: 'body', part: 'body', bmin: [-0.46, -0.01, -1.12], bmax: [0.46, 2.2, 1.3], h: H_BODY * r, F: 4, clip: (x, y, z) => neckS(x, y, z) < clipBody }],
|
|
44
|
+
[
|
|
45
|
+
{ name: 'head', part: 'body', bmin: [-0.2, 1.25, 0.88], bmax: [0.2, 2.3, 1.72], h: H_HEAD * r, F: 6, clip: (x, y, z) => neckS(x, y, z) > -clipHead, patches },
|
|
46
|
+
{ name: 'jaw', part: 'jaw', bmin: [-0.08, 1.3, 1.2], bmax: [0.08, 1.72, 1.72], h: H_HEAD * r, F: 6, rigidBone: 'jaw' },
|
|
47
|
+
],
|
|
48
|
+
],
|
|
49
|
+
fade(x, y, z, name, patch) {
|
|
50
|
+
const sN = neckS(x, y, z);
|
|
51
|
+
if (name === 'body') return 1 - smoothstep(-B, B, sN - OV);
|
|
52
|
+
if (name === 'head') {
|
|
53
|
+
let f = smoothstep(-B, B, sN + OV);
|
|
54
|
+
if (patches.length) { const ew = eyePatchWeight(x, y, z); f *= patch ? ew : 1 - ew; }
|
|
55
|
+
return f;
|
|
56
|
+
}
|
|
57
|
+
return 1;
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
// Horse skeleton in bind pose (metres). Forward = +Z, up = +Y, the animal's left = +X.
|
|
2
|
+
// Reference individual: a 16 hh (1.63 m at the withers) warmblood / sport horse, ~560 kg.
|
|
3
|
+
// Landmarks measured on the side reference (side1.jpg, 1 px = 2.63 mm at 4x) and equine osteology
|
|
4
|
+
//: point of shoulder 1.14 m, elbow 0.90, carpus 0.50, fetlock 0.17, stifle 0.90,
|
|
5
|
+
// hock 0.55 (point of hock 0.62), body length (point of shoulder -> point of buttock) 1.70 m.
|
|
6
|
+
//
|
|
7
|
+
// Hooves: the standard quadruped bones plus a hoof bone per leg. fpaw / hpaw are the pasterns
|
|
8
|
+
// (fetlock -> coffin joint) and fhoof / hhoof the hooves (coffin joint -> toe), so the engine can
|
|
9
|
+
// keep the hoof flat on the ground while the fetlock sinks under load.
|
|
10
|
+
import { buildRig } from '../../core/rig/rig.js';
|
|
11
|
+
import { quadrupedBones, quadrupedLimbs, tailChain } from '../../core/rig/quadruped.js';
|
|
12
|
+
|
|
13
|
+
export const TAIL_SEGS = 10; // 6 dock bones + 4 segments of free-hanging tail hair
|
|
14
|
+
export const DOCK_SEGS = 6;
|
|
15
|
+
|
|
16
|
+
// Head frame: the head is modelled along its own axis (poll -> muzzle), pitched 55 degrees nose
|
|
17
|
+
// down in the bind pose. Head-local coordinates: x lateral, y dorsal (forehead side), z along the
|
|
18
|
+
// nasal line toward the muzzle; origin on the axis 0.20 m in front of the poll (level with the eyes).
|
|
19
|
+
// (the bind pose holds the head at 37 deg, less flexed at the poll than at rest (55 deg, restored by the
|
|
20
|
+
// head carriage), so the throat skin is meshed at mid-range between grazing and an alert head)
|
|
21
|
+
export const HEAD_PITCH = (37 * Math.PI) / 180;
|
|
22
|
+
export const HZ = [0, -Math.sin(HEAD_PITCH), Math.cos(HEAD_PITCH)];
|
|
23
|
+
export const HY = [0, Math.cos(HEAD_PITCH), Math.sin(HEAD_PITCH)];
|
|
24
|
+
// poll ~0.30 x withers height above the withers (side1.jpg), the neck arched and carried high
|
|
25
|
+
const POLL = [0, 2.05, 1.2]; // top of the poll (skin), bind
|
|
26
|
+
export const HEAD_O = [0, POLL[1] + 0.2 * HZ[1], POLL[2] + 0.2 * HZ[2]];
|
|
27
|
+
export const hl = (v) => [HEAD_O[0] + v[0], HEAD_O[1] + v[1] * HY[1] + v[2] * HZ[1], HEAD_O[2] + v[1] * HY[2] + v[2] * HZ[2]];
|
|
28
|
+
|
|
29
|
+
export function horseJoints() {
|
|
30
|
+
const J = {
|
|
31
|
+
nose: hl([0, 0.0, 0.4]),
|
|
32
|
+
occiput: hl([0, -0.06, -0.19]),
|
|
33
|
+
neckMid: [0, 1.63, 0.97],
|
|
34
|
+
neckBase: [0, 1.19, 0.74], // cervicothoracic junction: the neck hinges low, at about the point of shoulder // cervicothoracic junction, deep at the base of the neck
|
|
35
|
+
chestMid: [0, 1.4, 0.4],
|
|
36
|
+
thoraxRear: [0, 1.43, 0.02],
|
|
37
|
+
lumbarMid: [0, 1.46, -0.24],
|
|
38
|
+
lumbosacral: [0, 1.47, -0.44],
|
|
39
|
+
tailBase: [0, 1.46, -0.8],
|
|
40
|
+
// fore: scapula slopes ~50 deg, humerus down and back, radius and cannon vertical,
|
|
41
|
+
// pastern ~55 deg to the ground
|
|
42
|
+
scapTopL: [0.1, 1.47, 0.5],
|
|
43
|
+
shoulderL: [0.165, 1.14, 0.77],
|
|
44
|
+
elbowL: [0.16, 0.9, 0.6],
|
|
45
|
+
wristL: [0.13, 0.5, 0.63],
|
|
46
|
+
mcpL: [0.125, 0.17, 0.64],
|
|
47
|
+
fcoffinL: [0.125, 0.066, 0.713],
|
|
48
|
+
ftoeL: [0.125, 0.004, 0.8],
|
|
49
|
+
// hind: hip joint, stifle, hock, fetlock, coffin joint, toe
|
|
50
|
+
hipL: [0.155, 1.23, -0.62],
|
|
51
|
+
kneeL: [0.185, 0.94, -0.36],
|
|
52
|
+
hockL: [0.13, 0.55, -0.61],
|
|
53
|
+
mtpL: [0.12, 0.175, -0.585],
|
|
54
|
+
hcoffinL: [0.12, 0.068, -0.515],
|
|
55
|
+
htoeL: [0.12, 0.004, -0.435],
|
|
56
|
+
// tack (not bones: attachment landmarks carried by the variation warps like the skin): saddle
|
|
57
|
+
// base on the skin of the back over T12-T14 (~0.3 m behind the withers point; measured on the
|
|
58
|
+
// sculpt's surface at x 0, z 0.21), rider's seat 0.12 m above it, stirrup treads ~10 cm outside
|
|
59
|
+
// the barrel at ~1.0 m
|
|
60
|
+
saddle: [0, 1.625, 0.21],
|
|
61
|
+
seat: [0, 1.745, 0.19],
|
|
62
|
+
stirrupL: [0.3, 1.02, 0.24],
|
|
63
|
+
jawHinge: hl([0, -0.04, -0.1]),
|
|
64
|
+
jawTip: hl([0, -0.1, 0.39]),
|
|
65
|
+
earBaseL: hl([0.058, 0.06, -0.185]),
|
|
66
|
+
earTipL: hl([0.085, 0.205, -0.225]),
|
|
67
|
+
};
|
|
68
|
+
// dock droops from the croup, the hair hangs to the hocks
|
|
69
|
+
tailChain(J, 'tailBase', [-25, -50, -66, -76, -82, -86, -88, -89, -89, -89], [0.085, 0.08, 0.075, 0.07, 0.065, 0.06, 0.12, 0.12, 0.12, 0.12]);
|
|
70
|
+
return J;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export function horseBones() {
|
|
74
|
+
const b = quadrupedBones({ tailSegs: TAIL_SEGS, ears: true, jaw: true });
|
|
75
|
+
for (const d of b) {
|
|
76
|
+
if (d[0] === 'fpaw{S}') { d[2] = 'fcoffin{S}'; d[4] = { region: 'limb', group: 'F{S}' }; }
|
|
77
|
+
if (d[0] === 'hpaw{S}') { d[2] = 'hcoffin{S}'; d[4] = { region: 'limb', group: 'H{S}' }; }
|
|
78
|
+
}
|
|
79
|
+
b.push(
|
|
80
|
+
['fhoof{S}', 'fcoffin{S}', 'ftoe{S}', 'fpaw{S}', { region: 'foot', group: 'F{S}' }],
|
|
81
|
+
['hhoof{S}', 'hcoffin{S}', 'htoe{S}', 'hpaw{S}', { region: 'foot', group: 'H{S}' }],
|
|
82
|
+
);
|
|
83
|
+
return b;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export function horseRig(J = horseJoints()) {
|
|
87
|
+
const limbs = quadrupedLimbs({
|
|
88
|
+
front: { tCore: 0.55, aCore: 0.07, aBody: -0.13, midX: 0.0 },
|
|
89
|
+
hind: { tCore: 0.5, aCore: 0.022, aBody: -0.08, midX: 0.008 },
|
|
90
|
+
});
|
|
91
|
+
for (const L of Object.values(limbs)) { L.bones.push((L.front ? 'fhoof' : 'hhoof') + L.S); L.distal.push((L.front ? 'fhoof' : 'hhoof') + L.S); }
|
|
92
|
+
return buildRig({
|
|
93
|
+
joints: J,
|
|
94
|
+
unit: 2.14,
|
|
95
|
+
headOrigin: HEAD_O,
|
|
96
|
+
bones: horseBones(),
|
|
97
|
+
axial: {
|
|
98
|
+
points: ['nose', 'occiput', 'neckMid', 'neckBase', 'chestMid', 'thoraxRear', 'lumbarMid', 'lumbosacral', 'tailBase', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + (i + 1))],
|
|
99
|
+
bones: ['head', 'neck2', 'neck1', 'chest', 'spine3', 'spine2', 'spine1', 'pelvis', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + i)],
|
|
100
|
+
// the skull's influence reaches back into the throat latch and nape (3rd value: the blend widens
|
|
101
|
+
// with the skin's depth under the axis: the throat under the jaw). The occiput blend must end
|
|
102
|
+
// before the neckMid joint (0.418 m on) for every throat vertex (depth <= 0.22 m): the core
|
|
103
|
+
// applies only the blends at the two ends of a segment, so a blend reaching past neckMid was cut
|
|
104
|
+
// off there and the head weight under the throat jumped from 0.45 to 0 (the head and body copies
|
|
105
|
+
// of the throat then took weights 0.3-0.45 apart and parted when the head moved). Now the
|
|
106
|
+
// throat latch is half head, the crest hands over from the head 5-30 cm behind the poll.
|
|
107
|
+
blend: { 1: [-0.004, 0.139, 0.5], 3: [-0.12, 0.12, 2] },
|
|
108
|
+
bodyTail: 0, // the dock hangs behind the buttocks: their skin blends into it only at the tail base
|
|
109
|
+
},
|
|
110
|
+
limbs,
|
|
111
|
+
appendages: [
|
|
112
|
+
{ group: 'earL', bone: 'earL', blend: [-0.003, 0.005] },
|
|
113
|
+
{ group: 'earR', bone: 'earR', blend: [-0.003, 0.005] },
|
|
114
|
+
],
|
|
115
|
+
webTags: ['flankfold', 'thighfront', 'scapmuscle', 'pectoral', 'forearmweb'],
|
|
116
|
+
});
|
|
117
|
+
}
|