@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,118 @@
|
|
|
1
|
+
// Dog motion data for the quadruped engine (schema: src/core/motion/quadruped.js).
|
|
2
|
+
// Numbers are for the reference individual (a 30 kg shepherd type, params.size = 1, withers 0.60 m,
|
|
3
|
+
// hip 0.55 m); the engine scales them by dynamic similarity for retrievers (~0.93), terriers (~0.47)
|
|
4
|
+
// and pups: speeds x sqrt(size), stride frequencies / sqrt(size) (terrier ~x1.46, as measured).
|
|
5
|
+
//
|
|
6
|
+
// Gaits (Maes et al. 2008, Blaszczyk & Dobrzecka 2001, Hildebrand 1968,
|
|
7
|
+
// Heglund & Taylor 1988): lateral-sequence walk (0.5-1.4 m/s, 1.0-1.6 Hz, duty 0.75-0.6, limb phase
|
|
8
|
+
// ~0.25); trot, the dog's steady gait (1.3-3.5 m/s, 1.8-2.6 Hz, duty 0.5-0.35, hind of each diagonal
|
|
9
|
+
// ~3 % first), the shepherd's ground-covering flying trot with suspension at its top; the canter is a
|
|
10
|
+
// transverse (right-lead) gallop (3-6 m/s, 2.3-2.8 Hz, duty 0.3-0.4), the rotary gallop (LH-RH-RF-LF,
|
|
11
|
+
// 2.8-3.9 Hz, duty 0.2-0.3, strong spinal flexion-extension: gathered and extended flights) above
|
|
12
|
+
// ~6 m/s. Trot -> gallop 1.53 M^0.24 = 3.5 m/s for 30 kg (Heglund & Taylor 1988).
|
|
13
|
+
import { dogHooks } from './behaviour.js';
|
|
14
|
+
|
|
15
|
+
const G = (name, v, f, D, off, o) => ({ name, v, f, D, off, ...o });
|
|
16
|
+
const GAITS = [
|
|
17
|
+
G('walk', 0.0, 0.95, 0.72, [0.25, 0.75, 0.0, 0.5], { liftF: 0.05, liftH: 0.042, bobF: 0.005, bobH: 0.005, flex: 0.0, lat: 0.05, fold: 1.0, heel: 35, tail: 0, drop: 0.0, width: 0.95 }),
|
|
18
|
+
G('walk', 1.25, 1.35, 0.62, [0.25, 0.75, 0.0, 0.5], { liftF: 0.062, liftH: 0.05, bobF: 0.008, bobH: 0.008, flex: 0.0, lat: 0.05, fold: 1.2, heel: 42, tail: 0.12, drop: 0.0, width: 0.82 }),
|
|
19
|
+
G('trot', 1.75, 1.95, 0.47, [0.53, 0.03, 0.0, 0.5], { liftF: 0.082, liftH: 0.07, bobF: 0.015, bobH: 0.015, flex: 0.02, lat: 0.015, fold: 1.45, heel: 50, tail: 0.3, drop: 0.005, width: 0.62 }),
|
|
20
|
+
G('trot', 3.3, 2.35, 0.38, [0.53, 0.03, 0.0, 0.5], { liftF: 0.1, liftH: 0.085, bobF: 0.02, bobH: 0.02, flex: 0.03, lat: 0.01, fold: 1.6, heel: 58, tail: 0.4, drop: 0.01, width: 0.55 }),
|
|
21
|
+
G('canter', 4.2, 2.5, 0.35, [0.3, 0.45, 0.0, 0.3], { liftF: 0.13, liftH: 0.115, bobF: 0.018, bobH: 0.028, flex: 0.2, lat: 0, fold: 1.8, heel: 62, tail: 0.6, drop: 0.016, width: 0.8 }),
|
|
22
|
+
G('gallop', 7, 2.9, 0.27, [0.52, 0.42, 0.0, 0.1], { liftF: 0.16, liftH: 0.15, bobF: 0.025, bobH: 0.036, flex: 0.34, lat: 0, fold: 1.9, heel: 68, tail: 0.8, drop: 0.025, width: 1 }),
|
|
23
|
+
G('gallop', 13, 3.5, 0.21, [0.52, 0.42, 0.0, 0.1], { liftF: 0.19, liftH: 0.18, bobF: 0.025, bobH: 0.04, flex: 0.44, lat: 0, fold: 2.0, heel: 72, tail: 0.9, drop: 0.04, width: 1 }),
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const motion = {
|
|
27
|
+
hooks: dogHooks,
|
|
28
|
+
maxSpeed: 13,
|
|
29
|
+
accel: [5.5, 9],
|
|
30
|
+
decel: 10,
|
|
31
|
+
turnRate: 2.8,
|
|
32
|
+
latAccelMax: 11,
|
|
33
|
+
gears: { walk: 1.0, trot: 2.4, canter: 4.4, gallop: 9 },
|
|
34
|
+
gallopBlend: [3.8, 7],
|
|
35
|
+
gaits: GAITS,
|
|
36
|
+
feet: {
|
|
37
|
+
front: { type: 'digitigrade', curl: 55 },
|
|
38
|
+
hind: { type: 'digitigrade', curl: 65 },
|
|
39
|
+
},
|
|
40
|
+
stance: { width: 1, gallopWidth: 0.6, sprawl: 0, crouch: 0, scuff: [11, 18, 0] },
|
|
41
|
+
// torso cross-sections (bind, reference size): centre height, half height, half width (incl. coat)
|
|
42
|
+
body: {
|
|
43
|
+
// (measured on the bind mesh at the shoulder / hip, + coat; the pelvis includes the thighs a lying
|
|
44
|
+
// dog rests on)
|
|
45
|
+
chest: { y: 0.41, hh: 0.1, hw: 0.112 },
|
|
46
|
+
pelvis: { y: 0.41, hh: 0.15, hw: 0.118 },
|
|
47
|
+
back: 0.055,
|
|
48
|
+
},
|
|
49
|
+
head: {
|
|
50
|
+
// [speed, raise (m), reach (m), pitch (rad, + = nose down)]: head carried up standing and walking (standing: raised
|
|
51
|
+
// 7 cm, not 9.5 cm and pulled back 4.5: that bunched the throat skin under the jaw into a fold),
|
|
52
|
+
// lowered toward the back line in the shepherd's ground-covering trot, stretched in the gallop
|
|
53
|
+
carriage: [[0, 0.07, -0.02, -0.04], [1.0, 0.03, -0.01, 0.1], [2.4, -0.065, 0.045, 0.3], [4.4, -0.06, 0.05, 0.25], [9, -0.06, 0.07, 0.18]],
|
|
54
|
+
stab: [[0, 0], [0.9, 0.22], [1.8, 0.3], [4.5, 0.34], [9, 0.6]],
|
|
55
|
+
neckBend: 55, neckPivot: 0.6, yaw: 1.25, pitchUp: 0.65, pitchDown: 0.75,
|
|
56
|
+
},
|
|
57
|
+
tail: {
|
|
58
|
+
// [speed, pitch per segment from horizontal (deg), base -> tip]: the shepherd's saber tail hangs
|
|
59
|
+
// at rest (tip near the hock), rises toward level in the trot (never above the back), streams
|
|
60
|
+
// back at the gallop
|
|
61
|
+
carriage: [
|
|
62
|
+
[0.0, [-45, -64, -72, -76, -77, -75, -70, -62]],
|
|
63
|
+
[1.0, [-38, -54, -62, -65, -65, -62, -56, -48]],
|
|
64
|
+
[2.4, [-20, -28, -32, -33, -32, -29, -24, -18]],
|
|
65
|
+
[4.4, [-12, -16, -17, -16, -14, -11, -8, -5]],
|
|
66
|
+
[9, [-6, -8, -8, -7, -6, -4, -2, 0]],
|
|
67
|
+
],
|
|
68
|
+
stiffness: 0.9, sway: 7, flick: 0, wag: 0, swish: 0, curl: 0,
|
|
69
|
+
balance: 0.4,
|
|
70
|
+
radius: [0.055, 0.04],
|
|
71
|
+
},
|
|
72
|
+
ears: { rest: [0, 0], mobility: 1, speedFlatten: 0.6, twitch: 1, prick: 0.45 },
|
|
73
|
+
breath: { rate: 0.3, amp: 0.012, pant: true, pantRate: 3.6, pantAmp: 0.045, heatSpeed: 3.2 },
|
|
74
|
+
actions: {
|
|
75
|
+
attack: { style: 'bite-lunge', paws: false }, // (forefeet planted: the head and neck drive the bite)
|
|
76
|
+
eat: { style: 'tear', dropF: 0.3, dropH: 0.1, ahead: 0.9, pitch: 1.0 },
|
|
77
|
+
drink: { dropF: 0.32, dropH: 0.1, ahead: 0.9, pitch: 1.0 },
|
|
78
|
+
jump: { height: 0.9, distance: 2.8 },
|
|
79
|
+
sit: { dropH: 1.0 },
|
|
80
|
+
lie: {},
|
|
81
|
+
sleep: { style: 'curl' },
|
|
82
|
+
},
|
|
83
|
+
// per variant (merged one level deep over the above)
|
|
84
|
+
variants: {
|
|
85
|
+
retriever: {
|
|
86
|
+
// level, gently curved otter tail, wagging freely; drop ears swing (behaviour.js pose)
|
|
87
|
+
tail: {
|
|
88
|
+
carriage: [
|
|
89
|
+
[0.0, [-28, -40, -46, -50, -52, -52, -50, -46]],
|
|
90
|
+
[1.0, [-18, -26, -30, -32, -33, -32, -30, -26]],
|
|
91
|
+
[2.4, [-10, -14, -16, -17, -17, -16, -14, -12]],
|
|
92
|
+
[4.4, [-6, -8, -9, -9, -8, -7, -5, -3]],
|
|
93
|
+
[9, [-4, -5, -5, -4, -3, -2, -1, 0]],
|
|
94
|
+
],
|
|
95
|
+
stiffness: 1.0, sway: 9, balance: 0.35, radius: [0.04, 0.018],
|
|
96
|
+
},
|
|
97
|
+
ears: { rest: [0, 0], mobility: 0.25, speedFlatten: 0.25, twitch: 0.3, prick: 0.05 },
|
|
98
|
+
body: { chest: { y: 0.385, hh: 0.112, hw: 0.128 }, pelvis: { y: 0.41, hh: 0.16, hw: 0.13 }, back: 0.05 },
|
|
99
|
+
head: { carriage: [[0, 0.09, -0.045, -0.03], [1.0, 0.04, -0.01, 0.07], [2.4, -0.04, 0.04, 0.22], [4.4, -0.045, 0.05, 0.2], [9, -0.05, 0.07, 0.15]] },
|
|
100
|
+
},
|
|
101
|
+
terrier: {
|
|
102
|
+
// erect tail, carried up (60-90 deg); lowers toward level only at the gallop
|
|
103
|
+
tail: {
|
|
104
|
+
carriage: [
|
|
105
|
+
[0.0, [55, 64, 70, 72, 72, 70, 66, 60]],
|
|
106
|
+
[1.0, [52, 60, 65, 66, 65, 62, 58, 52]],
|
|
107
|
+
[2.4, [42, 48, 50, 50, 48, 45, 40, 35]],
|
|
108
|
+
[4.4, [25, 28, 28, 26, 24, 21, 18, 15]],
|
|
109
|
+
[9, [8, 8, 7, 5, 3, 2, 1, 0]],
|
|
110
|
+
],
|
|
111
|
+
stiffness: 1.3, sway: 5, balance: 0.3, radius: [0.026, 0.014],
|
|
112
|
+
},
|
|
113
|
+
ears: { rest: [0, 0], mobility: 0.55, speedFlatten: 0.35, twitch: 0.8, prick: 0.15 },
|
|
114
|
+
body: { chest: { y: 0.41, hh: 0.105, hw: 0.108 }, pelvis: { y: 0.41, hh: 0.15, hw: 0.11 }, back: 0.05 },
|
|
115
|
+
head: { carriage: [[0, 0.085, -0.04, -0.04], [1.0, 0.04, -0.01, 0.05], [2.4, -0.02, 0.03, 0.15], [4.4, -0.03, 0.05, 0.15], [9, -0.04, 0.07, 0.12]] },
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Meshing plan: body at 4.2 mm (0.7 % of the withers height), head at 2.1 mm (overlapping across the
|
|
2
|
+
// upper neck and cross-faded), eyelid patches at ~1 mm, the lower jaw and the tongue as their own
|
|
3
|
+
// rigid surfaces so the mouth can open and the tongue slide out. The tongue is dropped at the low and
|
|
4
|
+
// crowd tiers (it is hidden in the closed mouth and too thin for their cells).
|
|
5
|
+
import { HEAD_O } from './rig.js';
|
|
6
|
+
import { eyeOf } from './sculpt.js';
|
|
7
|
+
import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
|
|
8
|
+
import { norm, smoothstep } from '../../core/math/vec.js';
|
|
9
|
+
|
|
10
|
+
// the neck cut, fixed in reference space: a plane just behind the skull, tilted forward so the throat
|
|
11
|
+
// stays with the neck and the whole jaw with the head (the dog carries its neck steeply)
|
|
12
|
+
export const NECK_CUT = { c: [HEAD_O[0], HEAD_O[1] - 0.005, HEAD_O[2] - 0.085], d: norm([0, 0.45, 1]), band: 0.011 };
|
|
13
|
+
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];
|
|
14
|
+
|
|
15
|
+
export const eyeCentres = (params) => [1, -1].map((s) => eyeFrameOf(eyeOf(params), HEAD_O, s).c);
|
|
16
|
+
const PATCH = { R: 0.019, B: 0.0036, h: 0.001 };
|
|
17
|
+
function eyePatchWeight(centres, R, B, x, y, z) {
|
|
18
|
+
let dmin = 1e9;
|
|
19
|
+
for (const c of centres) dmin = Math.min(dmin, Math.hypot(x - c[0], y - c[1], z - c[2]));
|
|
20
|
+
return 1 - smoothstep(R - B, R + B, dmin);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function dogRegions(rig, params, Q) {
|
|
24
|
+
const B = NECK_CUT.band, r = Q.res;
|
|
25
|
+
// Each surface is clipped past the band's midline by at least two of its own cells: the mesher keeps
|
|
26
|
+
// whole cells, so a clipped surface's open edge lies up to ~2 cells inside the clip plane. With the
|
|
27
|
+
// clip at the band edge (11 mm) the coarse body (13 mm cells at low, 18 mm at crowd) ended on the
|
|
28
|
+
// visible side of the midline and left a row of open cells round the throat and the nape.
|
|
29
|
+
const hB = 0.00435 * r, hH = 0.00218 * r;
|
|
30
|
+
const cB = Math.max(B, 2 * hB), cH = Math.max(B, 2 * hH);
|
|
31
|
+
const ek = params.eyeK || 1;
|
|
32
|
+
const PR = PATCH.R * ek, PB = PATCH.B * ek;
|
|
33
|
+
const centres = eyeCentres(params);
|
|
34
|
+
const patches = Q.eyePatches ? centres.map((c) => ({ c, R: PR, B: PB, h: PATCH.h * Math.max(1, r) })) : [];
|
|
35
|
+
const J = rig.J;
|
|
36
|
+
const zN = J.nose[2] + 0.03;
|
|
37
|
+
const hw = params.headW || 1;
|
|
38
|
+
const tb = J.tongueBase, tt = J.tongueTip;
|
|
39
|
+
const jobs = [
|
|
40
|
+
[{ name: 'body', part: 'body', bmin: [-0.17, -0.03, -0.72], bmax: [0.17, 0.86, 0.56], h: hB, F: 4, clip: (x, y, z) => neckS(x, y, z) < cB }],
|
|
41
|
+
[
|
|
42
|
+
{ name: 'head', part: 'body', bmin: [-0.14, 0.5, 0.33], bmax: [0.14, 0.88, zN], h: hH, F: 6, clip: (x, y, z) => neckS(x, y, z) > -cH, patches },
|
|
43
|
+
{ name: 'jaw', part: 'jaw', bmin: [-0.06 * hw, 0.54, 0.44], bmax: [0.06 * hw, 0.66, zN], h: 0.0021 * r, F: 6, rigidBone: 'jaw' },
|
|
44
|
+
],
|
|
45
|
+
];
|
|
46
|
+
// the tongue (hero, high, medium)
|
|
47
|
+
if (r < 2.5) jobs[1].push({ name: 'tongue', part: 'tongue', bmin: [-0.03 * hw, Math.min(tb[1], tt[1]) - 0.02, tb[2] - 0.04], bmax: [0.03 * hw, Math.max(tb[1], tt[1]) + 0.02, tt[2] + 0.03], h: 0.0021 * r, F: 4, rigidBone: 'tongue' });
|
|
48
|
+
return {
|
|
49
|
+
jobs,
|
|
50
|
+
fade(x, y, z, name, patch) {
|
|
51
|
+
const sN = neckS(x, y, z);
|
|
52
|
+
if (name === 'body') return 1 - smoothstep(-B, B, sN);
|
|
53
|
+
if (name === 'head') {
|
|
54
|
+
let f = smoothstep(-B, B, sN);
|
|
55
|
+
if (patches.length) { const ew = eyePatchWeight(centres, PR, PB, x, y, z); f *= patch ? ew : 1 - ew; }
|
|
56
|
+
return f;
|
|
57
|
+
}
|
|
58
|
+
return 1;
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// Domestic dog skeleton in bind pose (metres). Forward = +Z, up = +Y, the animal's left = +X.
|
|
2
|
+
//
|
|
3
|
+
// Reference individual: a medium shepherd-type dog between the sexes, withers height 0.60 m
|
|
4
|
+
// (German shepherd M 0.60-0.65 / F 0.55-0.60, FCI 166), body (point of shoulder -> buttock)
|
|
5
|
+
// ~1.15 x withers height, head 0.25 m (~40 % of the withers height).
|
|
6
|
+
// Limb segments (Fischer & Lilje 2011, Miller's Anatomy; shepherd ratios to SH):
|
|
7
|
+
// scapula 0.25, humerus 0.29, radius 0.30, metacarpus 0.11, femur 0.31, tibia 0.32, metatarsus 0.12.
|
|
8
|
+
//
|
|
9
|
+
// Every variant is modelled at this reference scale and brought to its own size by params.size
|
|
10
|
+
// (retriever ~0.93, terrier ~0.47): the variant changes the skeleton here (topline, hind angulation,
|
|
11
|
+
// tail set and length, ears) and the sculpt; broader or shorter-legged builds and head size are
|
|
12
|
+
// proportion warps (index.js). The head is modelled level in its own frame (HEAD_O); its carriage
|
|
13
|
+
// comes from the motion data.
|
|
14
|
+
import { buildRig } from '../../core/rig/rig.js';
|
|
15
|
+
import { quadrupedBones, quadrupedLimbs, tailChain } from '../../core/rig/quadruped.js';
|
|
16
|
+
|
|
17
|
+
export const TAIL_SEGS = 8;
|
|
18
|
+
export const HEAD_O = [0, 0.622, 0.562]; // head-local origin (mid cranium, between eyes and ears)
|
|
19
|
+
export const HS = 1.0; // head-local scale (landmarks below are for a 0.25 m skull)
|
|
20
|
+
export const SH = 0.6; // reference withers height
|
|
21
|
+
export const MUZZLE_Z0 = 0.04; // head-local z where the muzzle starts (muzzle length variation acts ahead of it)
|
|
22
|
+
|
|
23
|
+
// head-local -> reference space, with per-individual muzzle length and head width factors
|
|
24
|
+
export const hlOf = (m = 1, w = 1) => (v) => [HEAD_O[0] + v[0] * w * HS, HEAD_O[1] + v[1] * HS, HEAD_O[2] + HS * (v[2] > MUZZLE_Z0 ? MUZZLE_Z0 + (v[2] - MUZZLE_Z0) * m : v[2])];
|
|
25
|
+
|
|
26
|
+
// ear bone (base -> tip, head-local) by ear type:
|
|
27
|
+
// prick (shepherd): tall erect triangle, slightly outward and back
|
|
28
|
+
// drop (retriever): pendant flap hanging from the fold at the top of the skull down the cheek
|
|
29
|
+
// button (terrier, shepherd pups): rises a little, the flap folds forward over the ear opening
|
|
30
|
+
export const EAR = {
|
|
31
|
+
prick: { base: [0.04, 0.045, -0.037], dir: [0.034, 0.116, -0.012] },
|
|
32
|
+
drop: { base: [0.05, 0.036, -0.026], dir: [0.026, -0.08, 0.034] },
|
|
33
|
+
button: { base: [0.043, 0.047, -0.036], dir: [0.028, -0.004, 0.04] },
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// per-variant skeleton changes (reference scale): axial heights and hind limb
|
|
37
|
+
const BODY = {
|
|
38
|
+
// sloping topline, long well-angulated hind legs (hock well behind the croup), low-set tail
|
|
39
|
+
shepherd: {
|
|
40
|
+
lumbarMid: [0, 0.505, -0.1], lumbosacral: [0, 0.488, -0.205], tailBase: [0, 0.468, -0.285],
|
|
41
|
+
hip: [0.056, 0.41, -0.24], knee: [0.07, 0.245, -0.165], hock: [0.055, 0.105, -0.318], mtp: [0.052, 0.03, -0.305], htoe: [0.052, 0.012, -0.267],
|
|
42
|
+
tail: { ang: [-20, -32, -40, -45, -47, -47, -45, -41], len: 0.39 },
|
|
43
|
+
},
|
|
44
|
+
// level topline, moderate angulation, thick otter tail set on level with the back
|
|
45
|
+
retriever: {
|
|
46
|
+
lumbarMid: [0, 0.512, -0.095], lumbosacral: [0, 0.505, -0.195], tailBase: [0, 0.498, -0.27],
|
|
47
|
+
hip: [0.058, 0.425, -0.23], knee: [0.072, 0.252, -0.158], hock: [0.056, 0.105, -0.295], mtp: [0.053, 0.03, -0.283], htoe: [0.053, 0.012, -0.245],
|
|
48
|
+
tail: { ang: [-10, -16, -20, -23, -25, -26, -26, -25], len: 0.36 },
|
|
49
|
+
},
|
|
50
|
+
// square, level, straight hind legs, tail set high and carried erect
|
|
51
|
+
terrier: {
|
|
52
|
+
lumbarMid: [0, 0.515, -0.09], lumbosacral: [0, 0.51, -0.185], tailBase: [0, 0.505, -0.255],
|
|
53
|
+
hip: [0.056, 0.43, -0.215], knee: [0.068, 0.26, -0.145], hock: [0.054, 0.108, -0.268], mtp: [0.051, 0.03, -0.258], htoe: [0.051, 0.012, -0.22],
|
|
54
|
+
tail: { ang: [38, 52, 62, 68, 70, 70, 68, 64], len: 0.3 },
|
|
55
|
+
// (a little more bend in the standing foreleg: reach to spare for the quick steps of a small dog)
|
|
56
|
+
scapTop: [0.034, 0.53, 0.255], shoulder: [0.06, 0.398, 0.333], elbow: [0.054, 0.264, 0.232],
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export function dogJoints(params = {}) {
|
|
61
|
+
const V = BODY[params.variant] || BODY.shepherd;
|
|
62
|
+
const hl = hlOf(params.muzzle || 1, params.headW || 1);
|
|
63
|
+
const earK = params.ear || 1;
|
|
64
|
+
const E = EAR[params.earType || 'prick'];
|
|
65
|
+
const ear = hl(E.base);
|
|
66
|
+
const J = {
|
|
67
|
+
nose: hl([0, -0.014, 0.158]),
|
|
68
|
+
occiput: hl([0, 0.02, -0.095]),
|
|
69
|
+
neckMid: [0, 0.556, 0.405],
|
|
70
|
+
neckBase: [0, 0.5, 0.33],
|
|
71
|
+
chestMid: [0, 0.51, 0.17],
|
|
72
|
+
thoraxRear: [0, 0.514, 0.02],
|
|
73
|
+
lumbarMid: V.lumbarMid,
|
|
74
|
+
lumbosacral: V.lumbosacral,
|
|
75
|
+
tailBase: V.tailBase,
|
|
76
|
+
scapTopL: V.scapTop || [0.034, 0.54, 0.255],
|
|
77
|
+
shoulderL: V.shoulder || [0.06, 0.41, 0.335],
|
|
78
|
+
elbowL: V.elbow || [0.054, 0.27, 0.238],
|
|
79
|
+
wristL: [0.047, 0.1, 0.247],
|
|
80
|
+
mcpL: [0.046, 0.029, 0.259],
|
|
81
|
+
ftoeL: [0.046, 0.012, 0.299],
|
|
82
|
+
hipL: V.hip,
|
|
83
|
+
kneeL: V.knee,
|
|
84
|
+
hockL: V.hock,
|
|
85
|
+
mtpL: V.mtp,
|
|
86
|
+
htoeL: V.htoe,
|
|
87
|
+
jawHinge: hl([0, -0.034, -0.03]),
|
|
88
|
+
jawTip: hl([0, -0.06, 0.13]),
|
|
89
|
+
// tongue (rigid, rides on the jaw): lies in the floor of the mouth, slides out to pant and lap
|
|
90
|
+
tongueBase: hl([0, -0.046, 0.02]),
|
|
91
|
+
tongueTip: hl([0, -0.05, 0.118]),
|
|
92
|
+
earBaseL: ear,
|
|
93
|
+
earTipL: [ear[0] + E.dir[0] * earK * HS * (params.headW || 1), ear[1] + E.dir[1] * earK * HS, ear[2] + E.dir[2] * earK * HS],
|
|
94
|
+
};
|
|
95
|
+
const tk = (params.tail || 1) * V.tail.len;
|
|
96
|
+
// segment lengths taper toward the tip (sum = tk)
|
|
97
|
+
const w = [1.14, 1.09, 1.04, 0.99, 0.95, 0.91, 0.86, 0.82], ws = w.reduce((a, b) => a + b, 0);
|
|
98
|
+
tailChain(J, 'tailBase', V.tail.ang, w.map((x) => (x / ws) * tk));
|
|
99
|
+
return J;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export function dogRig(params = {}) {
|
|
103
|
+
const J = dogJoints(params);
|
|
104
|
+
return buildRig({
|
|
105
|
+
joints: J,
|
|
106
|
+
unit: SH / 0.76,
|
|
107
|
+
headOrigin: HEAD_O,
|
|
108
|
+
bones: quadrupedBones({ tailSegs: TAIL_SEGS, ears: true, jaw: true, extra: [['tongue', 'tongueBase', 'tongueTip', 'jaw', { region: 'jaw', group: 'jaw' }]] }),
|
|
109
|
+
axial: {
|
|
110
|
+
points: ['nose', 'occiput', 'neckMid', 'neckBase', 'chestMid', 'thoraxRear', 'lumbarMid', 'lumbosacral', 'tailBase', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + (i + 1))],
|
|
111
|
+
bones: ['head', 'neck2', 'neck1', 'chest', 'spine3', 'spine2', 'spine1', 'pelvis', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + i)],
|
|
112
|
+
// the skull's influence reaches back into the nape; wider on the throat side (3rd value)
|
|
113
|
+
blend: { 1: [-0.09, 0.18, 3] },
|
|
114
|
+
// (core weights.js `cascade`: the skull's throat lever reaches past the mid-neck joint, where the default cut its
|
|
115
|
+
// share off: carried high, the head bunched the throat skin into a fold along that line, and the ruff's shells
|
|
116
|
+
// drew it as a crisp line round the throat. Faded out over the next segment instead)
|
|
117
|
+
cascade: { 1: 0.25 },
|
|
118
|
+
// a hanging tail (shepherd) lies behind the thighs: body skin blends into it only at its base
|
|
119
|
+
bodyTail: params.variant === 'terrier' ? 1 : 0,
|
|
120
|
+
},
|
|
121
|
+
limbs: quadrupedLimbs({
|
|
122
|
+
front: { tCore: 0.55, aCore: 0.04, aBody: -0.07, midX: 0.0 },
|
|
123
|
+
hind: { tCore: 0.52, aCore: 0.022, aBody: -0.045, midX: 0.008 },
|
|
124
|
+
}),
|
|
125
|
+
// (soft drop / button ears hinge over a wider fold)
|
|
126
|
+
appendages: ['L', 'R'].map((S) => ({ group: 'ear' + S, bone: 'ear' + S, blend: params.earType === 'prick' || !params.earType ? [-0.003, 0.006] : [-0.006, 0.01] })),
|
|
127
|
+
webTags: ['flankfold', 'thighfront', 'scapmuscle'],
|
|
128
|
+
});
|
|
129
|
+
}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
// The domestic dog, sculpted as a signed distance field.
|
|
2
|
+
// Every primitive is attached to a bone (skinning) and a group (axial / limb / ear / jaw / tongue).
|
|
3
|
+
// The torso is placed relative to the axial joints so the variants' toplines (the shepherd's slope,
|
|
4
|
+
// the level retriever and terrier) carry the body with them. The head is modelled in head-local
|
|
5
|
+
// coordinates (HEAD_O) and shaped per individual by params: stop, skull width, muzzle length and
|
|
6
|
+
// depth, flews (the retriever's pendulous upper lips), cheek fur; ears by type (prick, drop,
|
|
7
|
+
// button); tail by type (the shepherd's bushy saber, the retriever's thick otter tail, the
|
|
8
|
+
// terrier's short erect tail).
|
|
9
|
+
import { HEAD_O, TAIL_SEGS, HS, hlOf } from './rig.js';
|
|
10
|
+
import { add, sub, mul, lerp, norm, cross } from '../../core/math/vec.js';
|
|
11
|
+
import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
|
|
12
|
+
|
|
13
|
+
// Eye geometry shared by the sculpt (lids + aperture) and the eyeball shader (head-local, left eye).
|
|
14
|
+
// Axial eyeball ~21.5 mm (r 10.8 mm) for a 30 kg dog (Miller & Murphy 1995); almond fissure
|
|
15
|
+
// ~20 x 10 mm set a little obliquely (shepherd); rounder and more forward-facing in retrievers and
|
|
16
|
+
// terriers (params.eyeRound); eyes ~62 mm apart. Small dogs and pups have relatively larger eyes
|
|
17
|
+
// (params.eyeK).
|
|
18
|
+
export const EYE_BASE = { c: [0.033, 0.022, 0.038], r: 0.0108, back: 0.0023, yaw: 0.2, pitch: 0.04, lid: 0.0014, R: 0.0131, d: 0.0081, off: -0.0006, tilt: (12 * Math.PI) / 180, irisZ: 0.0066, irisR: 0.0089 };
|
|
19
|
+
export const eyeOf = (params = {}) => {
|
|
20
|
+
const k = params.eyeK || 1, rd = params.eyeRound || 0;
|
|
21
|
+
const R = EYE_BASE.R * k, d = EYE_BASE.d * k * (1 - 0.3 * rd);
|
|
22
|
+
return {
|
|
23
|
+
...EYE_BASE,
|
|
24
|
+
c: [EYE_BASE.c[0] * (params.headW || 1) * HS, (EYE_BASE.c[1] + 0.002 * (k - 1)) * HS, EYE_BASE.c[2] * HS],
|
|
25
|
+
r: EYE_BASE.r * k, back: EYE_BASE.back * k, lid: EYE_BASE.lid * k, R, d, irisZ: EYE_BASE.irisZ * k, irisR: EYE_BASE.irisR * k,
|
|
26
|
+
yaw: EYE_BASE.yaw - 0.05 * rd, tilt: EYE_BASE.tilt * (1 - 0.6 * rd),
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const X = [1, 0, 0];
|
|
31
|
+
|
|
32
|
+
export function sculptDog(m, rig, params = {}) {
|
|
33
|
+
const J = rig.J;
|
|
34
|
+
const EYE = eyeOf(params);
|
|
35
|
+
const mz = params.muzzle || 1, hw = params.headW || 1, juv = params.juv || 0;
|
|
36
|
+
const stop = params.stop ?? 0.5, flews = params.flews || 0, mzD = params.muzzleDepth || 1;
|
|
37
|
+
const ruff = params.ruff ?? 0.5, neckK = params.neckK || 1, chestK = params.chestK || 1;
|
|
38
|
+
const hl = hlOf(mz, hw);
|
|
39
|
+
// short muzzles (pups, terrier) shorten the muzzle pads with the muzzle, so they never swallow the nose
|
|
40
|
+
const mzS = Math.min(1, mz);
|
|
41
|
+
const hr = (r) => [r[0] * hw * HS, r[1] * HS, r[2] * HS];
|
|
42
|
+
const eyeFrame = (s) => eyeFrameOf(EYE, HEAD_O, s);
|
|
43
|
+
const ellY = (o) => {
|
|
44
|
+
const y = norm(o.ydir);
|
|
45
|
+
const lat = o.lateral || X;
|
|
46
|
+
const z = norm(cross(lat, y));
|
|
47
|
+
return m.ell({ ...o, axis: z, up: y, r: [o.r[0], o.r[1], o.r[2]] });
|
|
48
|
+
};
|
|
49
|
+
const cm = J.chestMid, tr = J.thoraxRear, lm = J.lumbarMid, ls = J.lumbosacral, nb = J.neckBase, nm = J.neckMid;
|
|
50
|
+
const P = (x, y, z) => [x, y, z];
|
|
51
|
+
|
|
52
|
+
// ---------------------------------------------------------------- TORSO
|
|
53
|
+
// deep chest reaching the elbow, prominent forechest, firm back, belly tucked up behind the ribs
|
|
54
|
+
const ribY = (cm[1] + tr[1]) / 2;
|
|
55
|
+
m.ell({ tag: 'ribcage', bone: 'spine3', c: P(0, ribY - 0.077, lerp(cm, tr, 0.4)[2]), r: [0.077 * chestK, 0.128 * chestK, 0.165], axis: norm([0, 0.1, -1]), k: 0 });
|
|
56
|
+
m.ell({ tag: 'brisket', bone: 'chest', c: P(0, cm[1] - 0.148, cm[2] + 0.07), r: [0.048 * chestK, 0.062, 0.085], axis: norm([0, -0.35, 1]), k: 0.05 });
|
|
57
|
+
m.ell({ tag: 'pectoral', bone: 'chest', c: P(0, nb[1] - 0.095, nb[2] + 0.008), r: [0.056 * chestK, 0.066, 0.052], k: 0.045 });
|
|
58
|
+
m.ell({ tag: 'withers', bone: 'chest', c: P(0, J.scapTopL[1] + 0.012, J.scapTopL[2] - 0.045), r: [0.044, 0.046, 0.105], axis: norm([0, -0.1, 1]), k: 0.05 });
|
|
59
|
+
m.ell({ tag: 'back', bone: 'spine3', c: P(0, tr[1] + 0.036, tr[2] + 0.01), r: [0.055, 0.042, 0.13], k: 0.05 });
|
|
60
|
+
m.ell({ tag: 'abdomen', bone: 'spine2', c: P(0, lm[1] - 0.048 + 0.012 * (params.tuck || 0), lm[2] + 0.035), r: [0.06 * chestK, 0.06 - 0.008 * (params.tuck || 0), 0.13], axis: norm([0, 0.34 * Math.max(0, params.tuck ?? 1), -1]), k: 0.055 });
|
|
61
|
+
const lo = lerp(lm, ls, 0.4);
|
|
62
|
+
m.ell({ tag: 'loin', bone: 'spine1', c: P(0, lo[1] + 0.022, lo[2]), r: [0.05, 0.041, 0.115], k: 0.045 });
|
|
63
|
+
m.ell({ tag: 'flank', bone: 'spine1', c: P(0, ls[1] - 0.05 - 0.01 * Math.max(0, -(params.tuck || 0)), ls[2] + 0.02), r: [0.053 * chestK, 0.053 + 0.012 * Math.max(0, -(params.tuck || 0)), 0.075], k: 0.045 });
|
|
64
|
+
m.ell({ tag: 'pelvis', bone: 'pelvis', c: P(0, ls[1] - 0.02, ls[2] - 0.058), r: [0.058, 0.07, 0.09], k: 0.05 });
|
|
65
|
+
m.ell({ tag: 'croup', bone: 'pelvis', c: P(0, ls[1] + 0.02, ls[2] - 0.048), r: [0.046, 0.034, 0.085], axis: norm([0, (J.tailBase[1] - ls[1]) * 3, -0.25]), k: 0.035 });
|
|
66
|
+
for (const s of [1, -1]) {
|
|
67
|
+
m.ell({ tag: 'rump', bone: 'pelvis', c: P(0.035 * s, ls[1] - 0.052, ls[2] - 0.118), r: [0.036, 0.058, 0.042], k: 0.035 });
|
|
68
|
+
}
|
|
69
|
+
// shepherd: the thicker coat over the shoulders and neck (sculpted coat volume)
|
|
70
|
+
if (ruff > 0.3) m.ell({ tag: 'cape', bone: 'chest', c: P(0, J.scapTopL[1] + 0.005, J.scapTopL[2] + 0.04), r: [0.06 * (0.7 + 0.3 * ruff), 0.055, 0.1], axis: norm([0, 0.25, 1]), k: 0.06 });
|
|
71
|
+
|
|
72
|
+
// ---------------------------------------------------------------- NECK
|
|
73
|
+
const occ = J.occiput;
|
|
74
|
+
const nTop = lerp(nm, occ, 0.55);
|
|
75
|
+
m.cone({ tag: 'neck', bone: 'neck1', a: P(0, nb[1] - 0.02, nb[2] - 0.03), b: nm, ra: 0.072 * neckK, rb: 0.058 * neckK, k: 0.05 });
|
|
76
|
+
m.cone({ tag: 'neck', bone: 'neck2', a: nm, b: P(0, nTop[1], nTop[2]), ra: 0.056 * neckK, rb: 0.049 * neckK, k: 0.04 });
|
|
77
|
+
// crest: the top line runs in one convex arc from the occiput to the withers
|
|
78
|
+
const cr = lerp(nm, occ, 0.3);
|
|
79
|
+
m.ell({ tag: 'nape', bone: 'neck1', c: P(0, cr[1] + 0.046, cr[2] - 0.025), r: [0.042 * neckK, 0.034, 0.1], axis: norm([0, 0.55, 1]), k: 0.045 });
|
|
80
|
+
// throat: a straight line from under the jaw to the forechest (no dewlap)
|
|
81
|
+
const hl0 = hlOf(mz, hw);
|
|
82
|
+
m.cone({ tag: 'throat', bone: 'neck1', a: hl0([0, -0.05, -0.03]), b: P(0, nb[1] - 0.085, nb[2] + 0.035), ra: 0.034 * neckK, rb: 0.05 * neckK, k: 0.05 });
|
|
83
|
+
// ruff (shepherd): the longer hair of the neck sides
|
|
84
|
+
const rf = 0.7 + 0.3 * ruff;
|
|
85
|
+
if (ruff > 0.3) m.ell({ tag: 'ruff', bone: 'neck1', c: P(0, nm[1] - 0.03, nm[2] - 0.035), r: [0.058 * rf * neckK, 0.052 * rf, 0.07], axis: norm([0, 0.6, 1]), k: 0.05 });
|
|
86
|
+
|
|
87
|
+
// ---------------------------------------------------------------- HEAD (head-local coords, see HEAD_O)
|
|
88
|
+
// landmarks (adult ~0.25 m occiput -> nose): nose tip (0, -0.014, 0.158), eyes (+-0.033, 0.022, 0.038),
|
|
89
|
+
// stop ~z 0.045 (deeper with params.stop), chin (0, -0.062, 0.125), skull top 0.064, occiput -0.095
|
|
90
|
+
const H = { bone: 'head' };
|
|
91
|
+
const dome = 0.004 * juv + 0.003 * (params.dome || 0);
|
|
92
|
+
m.ell({ ...H, tag: 'cranium', c: hl([0, 0.016 + dome, -0.034]), r: hr([0.05 + 0.004 * juv, 0.048 + 0.008 * juv + 0.003 * (params.dome || 0), 0.064]), k: 0.035 });
|
|
93
|
+
m.ell({ ...H, tag: 'forehead', c: hl([0, 0.027 + 0.011 * stop + dome, 0.008 + 0.008 * stop]), r: hr([0.034, 0.03, 0.042]), axis: norm([0, -0.35 + 0.35 * stop, 1]), k: 0.026 });
|
|
94
|
+
m.ell({ ...H, tag: 'crest', c: hl([0, 0.05, -0.055]), r: hr([0.016, 0.013, 0.048]), k: 0.03 });
|
|
95
|
+
for (const s of [1, -1]) {
|
|
96
|
+
m.ell({ ...H, tag: 'brow', c: hl([0.028 * s, 0.037 + 0.006 * stop, 0.034]), r: hr([0.016, 0.008 + 0.002 * stop, 0.014]), k: 0.012 });
|
|
97
|
+
m.ell({ ...H, tag: 'zygomatic', c: hl([0.05 * s, 0.002, -0.006]), r: hr([0.015 * (params.zyg ?? 1), 0.02, 0.042]), axis: norm([-0.3 * s, 0, 1]), k: 0.024 });
|
|
98
|
+
m.ell({ ...H, tag: 'cheek', c: hl([0.034 * s, -0.022, -0.006]), r: hr([0.021, 0.027, 0.04]), k: 0.03 });
|
|
99
|
+
// maxilla: carries the cheek forward into the side of the muzzle under the eye (a wedge from above,
|
|
100
|
+
// no crease or pit between the cheek and the muzzle)
|
|
101
|
+
m.ell({ ...H, tag: 'maxilla', c: hl([0.029 * s, -0.02, 0.046]), r: hr([0.021, 0.025, 0.038]), k: 0.03 });
|
|
102
|
+
if (ruff > 0.2) m.ell({ ...H, tag: 'cheekruff', c: hl([0.046 * s, -0.026, -0.046]), r: hr([0.014 * ruff, 0.036, 0.04]), axis: norm([0.3 * s, 0, 1]), k: 0.03 });
|
|
103
|
+
m.ell({ ...H, tag: 'mastoid', c: hl([0.034 * s, -0.02, -0.062]), r: hr([0.023, 0.03, 0.03]), k: 0.03 });
|
|
104
|
+
// upper lip; the retriever's flews hang lower and fuller behind the canines
|
|
105
|
+
m.ell({ ...H, tag: 'lip', c: hl([0.025 * s, -0.045 - 0.006 * flews, 0.078]), r: hr([0.015 + 0.002 * flews, 0.013 + 0.005 * flews, 0.058]), axis: norm([-0.2 * s, -0.06, 1]), k: 0.016 });
|
|
106
|
+
m.ell({ ...H, tag: 'whisker', c: hl([0.021 * s, -0.027 - 0.003 * flews, 0.121]), r: hr([0.015 + 0.002 * flews, 0.015 * mzD, 0.026 * mzS]), k: 0.016 });
|
|
107
|
+
}
|
|
108
|
+
// muzzle: straight nasal bridge (shepherd) to a broad, deeper muzzle (retriever)
|
|
109
|
+
m.cone({ ...H, tag: 'nasal', a: hl([0, 0.033 - 0.004 * stop - 0.023 * hw, 0.055]), b: hl([0, 0.007 - 0.016 * hw, 0.1505 - 0.0145 / mz]), ra: 0.023 * hw, rb: 0.016 * hw, k: 0.016 });
|
|
110
|
+
m.ell({ ...H, tag: 'muzzle', c: hl([0, -0.02, 0.084]), r: hr([0.033, 0.027 * mzD, 0.064 * mzS]), axis: norm([0, -0.1, 1]), k: 0.02 });
|
|
111
|
+
m.ell({ ...H, tag: 'nose', c: hl([0, -0.006, 0.1505]), r: hr([0.02, 0.0135, 0.0095]), axis: norm([0, 0.4, 1]), k: 0.008 });
|
|
112
|
+
m.ell({ ...H, tag: 'philtrum', c: hl([0, -0.031, 0.146]), r: hr([0.01, 0.012, 0.008]), k: 0.01 });
|
|
113
|
+
for (const s of [1, -1]) {
|
|
114
|
+
const ef = eyeFrame(s);
|
|
115
|
+
const at = (u, v, w) => add(add(add(ef.c, mul(ef.x, u)), mul(ef.y, v)), mul(ef.z, w));
|
|
116
|
+
ellY({ ...H, tag: 'orbit', c: at(-0.002 * s, -0.0005, 0.018), ydir: ef.y, lateral: ef.x, r: [0.017 * EYE.r / 0.0108, 0.012 * EYE.r / 0.0108, 0.0085], k: 0.008, carve: true });
|
|
117
|
+
m.sphere({ ...H, tag: 'eyelid', c: ef.c, rad: EYE.r + EYE.lid, k: 0.005 });
|
|
118
|
+
m.lens({ ...H, tag: 'eyesocket', c: add(ef.c, mul(ef.y, EYE.off)), x: ef.x, y: ef.y, z: ef.z, R: EYE.R, d: EYE.d, zMin: -0.002, zMax: 0.024, k: 0.0021, carve: true });
|
|
119
|
+
m.sphere({ ...H, tag: 'nostril', c: hl([0.0078 * s, -0.009, 0.16]), rad: 0.0035, k: 0.002, carve: true });
|
|
120
|
+
// upper canine, hidden behind the lip; shows when the mouth opens (snarl, pant)
|
|
121
|
+
m.cone({ ...H, tag: 'canine', a: hl([0.014 * s, -0.043, 0.118]), b: hl([0.013 * s, -0.057 - 0.004 * flews, 0.115]), ra: 0.0038, rb: 0.0011, k: 0.002 });
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// ---------------------------------------------------------------- JAW (separate surface so the mouth can open)
|
|
125
|
+
const JW = { bone: 'jaw', group: 'jaw', part: 'jaw' };
|
|
126
|
+
m.cone({ ...JW, tag: 'mandible', a: hl([0, -0.05, -0.015]), b: hl([0, -0.058, 0.11]), ra: 0.016, rb: 0.0085, k: 0 });
|
|
127
|
+
for (const s of [1, -1]) {
|
|
128
|
+
m.cone({ ...JW, tag: 'mandible', a: hl([0.03 * s * hw, -0.044, -0.03]), b: hl([0.0065 * s, -0.056, 0.108]), ra: 0.012, rb: 0.007, k: 0.02 });
|
|
129
|
+
m.cone({ ...JW, tag: 'lowercanine', a: hl([0.0105 * s, -0.05, 0.112]), b: hl([0.0115 * s, -0.038, 0.109]), ra: 0.0032, rb: 0.001, k: 0.001 });
|
|
130
|
+
}
|
|
131
|
+
m.ell({ ...JW, tag: 'chin', c: hl([0, -0.06, 0.104]), r: hr([0.0105, 0.0085, 0.012]), k: 0.015 });
|
|
132
|
+
|
|
133
|
+
// ---------------------------------------------------------------- TONGUE (rigid, slides out)
|
|
134
|
+
// a long flat tongue in the floor of the mouth, just under the jaw's top surface when retracted
|
|
135
|
+
const TG = { bone: 'tongue', group: 'jaw', part: 'tongue' };
|
|
136
|
+
const tb = J.tongueBase, tt = J.tongueTip;
|
|
137
|
+
const tdir = norm(sub(tt, tb)), tl = Math.hypot(...sub(tt, tb));
|
|
138
|
+
ellY({ ...TG, tag: 'tongue', c: lerp(tb, tt, 0.45), ydir: tdir, lateral: X, r: [0.018 * hw, tl * 0.56, 0.0055], k: 0 });
|
|
139
|
+
ellY({ ...TG, tag: 'tongue', c: lerp(tb, tt, 0.86), ydir: tdir, lateral: X, r: [0.019 * hw, tl * 0.2, 0.0045], k: 0.01 });
|
|
140
|
+
|
|
141
|
+
// ---------------------------------------------------------------- EARS
|
|
142
|
+
const earType = params.earType || 'prick';
|
|
143
|
+
for (const S of ['L', 'R']) {
|
|
144
|
+
const s = S === 'L' ? 1 : -1;
|
|
145
|
+
const base = J['earBase' + S], tip = J['earTip' + S];
|
|
146
|
+
const dir = norm(sub(tip, base));
|
|
147
|
+
const L = Math.hypot(...sub(tip, base));
|
|
148
|
+
const ear = { bone: 'ear' + S, group: 'ear' + S, thin: true };
|
|
149
|
+
const at = (t) => lerp(base, tip, t);
|
|
150
|
+
if (earType === 'prick') {
|
|
151
|
+
// erect, broad at the base, pointed, the opening facing forward and a little out
|
|
152
|
+
const facing = norm([0.5 * s, 0.05, 1]);
|
|
153
|
+
const lat = norm(cross(dir, facing));
|
|
154
|
+
const k = L / 0.125;
|
|
155
|
+
ellY({ ...ear, tag: 'ear', c: at(0.22), ydir: dir, lateral: lat, r: [0.031 * k, 0.042 * k, 0.0085], k: 0.012 });
|
|
156
|
+
ellY({ ...ear, tag: 'ear', c: at(0.55), ydir: dir, lateral: lat, r: [0.02 * k, 0.042 * k, 0.006], k: 0.012 });
|
|
157
|
+
ellY({ ...ear, tag: 'ear', c: at(0.85), ydir: dir, lateral: lat, r: [0.0085 * k, 0.026 * k, 0.0042], k: 0.01 });
|
|
158
|
+
// the cup: a deep hollow on the front of the pinna, open toward the skull at its base
|
|
159
|
+
ellY({ ...ear, tag: 'earinner', c: add(at(0.34), mul(facing, 0.0075)), ydir: dir, lateral: lat, r: [0.022 * k, 0.044 * k, 0.0075], k: 0.004, carve: true });
|
|
160
|
+
ellY({ ...ear, tag: 'earinner', c: add(at(0.67), mul(facing, 0.0055)), ydir: dir, lateral: lat, r: [0.011 * k, 0.03 * k, 0.0048], k: 0.003, carve: true });
|
|
161
|
+
} else if (earType === 'drop') {
|
|
162
|
+
// pendant flap: thin, broadest just below the fold, rounded tip, lying against the cheek
|
|
163
|
+
const fwd = norm(cross(X.map((v) => v * s), dir).map((v) => -v));
|
|
164
|
+
const k = L / 0.09;
|
|
165
|
+
ellY({ ...ear, tag: 'ear', c: at(0.12), ydir: dir, lateral: fwd, r: [0.022 * k, 0.02 * k, 0.008], k: 0.012 });
|
|
166
|
+
ellY({ ...ear, tag: 'ear', c: at(0.45), ydir: dir, lateral: fwd, r: [0.033 * k, 0.04 * k, 0.0055], k: 0.012 });
|
|
167
|
+
ellY({ ...ear, tag: 'ear', c: at(0.8), ydir: dir, lateral: fwd, r: [0.026 * k, 0.026 * k, 0.005], k: 0.012 });
|
|
168
|
+
} else {
|
|
169
|
+
// button: a short upright root, then the flap folded forward and down over the opening
|
|
170
|
+
const k = L / 0.05;
|
|
171
|
+
ellY({ ...ear, tag: 'ear', c: add(base, [0.004 * s, 0.006, 0]), ydir: [0, 1, 0], lateral: [0, 0, 1], r: [0.019 * k, 0.013 * k, 0.008], k: 0.01 });
|
|
172
|
+
// the flap lies tangent to the skull: its plane faces out and up
|
|
173
|
+
const n = norm([0.8 * s, 0.6, 0.1]);
|
|
174
|
+
const bend = norm(add(dir, [0, -0.6, 0]));
|
|
175
|
+
ellY({ ...ear, tag: 'ear', c: at(0.5), ydir: dir, lateral: norm(cross(n, dir)), r: [0.022 * k, 0.026 * k, 0.005], k: 0.01 });
|
|
176
|
+
ellY({ ...ear, tag: 'ear', c: add(at(0.88), mul(bend, 0.008 * k)), ydir: bend, lateral: norm(cross(n, bend)), r: [0.017 * k, 0.014 * k, 0.0045], k: 0.01 });
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ---------------------------------------------------------------- LEGS
|
|
181
|
+
const legK = params.boneK || 1; // bone / paw substance (retriever heavier, terrier finer)
|
|
182
|
+
for (const S of ['L', 'R']) {
|
|
183
|
+
const s = S === 'L' ? 1 : -1;
|
|
184
|
+
const lat = [s, 0, 0];
|
|
185
|
+
const sx = (v) => [v[0] * s, v[1], v[2]];
|
|
186
|
+
const g = 'F' + S;
|
|
187
|
+
const Sc = J['scapTop' + S], Sh = J['shoulder' + S], E = J['elbow' + S], W = J['wrist' + S], M = J['mcp' + S], T = J['ftoe' + S];
|
|
188
|
+
ellY({ tag: 'scapmuscle', bone: 'scapula' + S, group: g, c: add(lerp(Sc, Sh, 0.5), sx([0.007, 0, 0])), ydir: sub(Sh, Sc), lateral: lat, r: [0.022, 0.085, 0.05], k: 0.05, bias: 0.003 });
|
|
189
|
+
m.cone({ tag: 'upperarm', bone: 'humerus' + S, group: g, a: Sh, b: E, ra: 0.034, rb: 0.025, k: 0.05 });
|
|
190
|
+
ellY({ tag: 'triceps', bone: 'humerus' + S, group: g, c: add(lerp(Sh, E, 0.55), [0, 0, -0.025]), ydir: sub(E, Sh), lateral: lat, r: [0.026, 0.063, 0.031], k: 0.042 });
|
|
191
|
+
m.sphere({ tag: 'olecranon', bone: 'radius' + S, group: g, c: add(E, [0, 0.006, -0.02]), rad: 0.015, k: 0.018 });
|
|
192
|
+
m.cone({ tag: 'forearm', bone: 'radius' + S, group: g, a: E, b: W, ra: 0.025 * legK, rb: 0.0155 * legK, k: 0.022 });
|
|
193
|
+
ellY({ tag: 'forearmmuscle', bone: 'radius' + S, group: g, c: add(lerp(E, W, 0.25), sx([0.0025, 0, 0.003])), ydir: sub(W, E), lateral: lat, r: [0.023 * legK, 0.056, 0.027 * legK], k: 0.026 });
|
|
194
|
+
ellY({ tag: 'feather', bone: 'radius' + S, group: g, c: add(lerp(E, W, 0.45), [0, 0, -0.014]), ydir: sub(W, E), lateral: lat, r: [0.012, 0.05, 0.014 * (0.6 + 0.6 * ruff)], k: 0.018 });
|
|
195
|
+
m.sphere({ tag: 'wrist', bone: 'metacarpus' + S, group: g, c: add(W, [0, 0, -0.0025]), rad: 0.016 * legK, k: 0.01 });
|
|
196
|
+
m.sphere({ tag: 'carpalpad', bone: 'metacarpus' + S, group: g, c: add(W, [0, -0.007, -0.016]), rad: 0.0075, k: 0.009 });
|
|
197
|
+
m.cone({ tag: 'pastern', bone: 'metacarpus' + S, group: g, a: W, b: M, ra: 0.0155 * legK, rb: 0.0155 * legK, k: 0.01 });
|
|
198
|
+
m.sphere({ tag: 'dewclaw', bone: 'metacarpus' + S, group: g, c: add(lerp(W, M, 0.3), sx([-0.0135, 0, 0.002])), rad: 0.005, k: 0.004 });
|
|
199
|
+
const dp = norm(sub(T, M));
|
|
200
|
+
const pk = params.pawK || 1;
|
|
201
|
+
ellY({ tag: 'paw', bone: 'fpaw' + S, group: g, c: add(add(M, mul(dp, 0.018)), [0, -0.005, 0]), ydir: dp, lateral: lat, r: [0.025 * pk, 0.033 * pk, 0.016], k: 0.012 });
|
|
202
|
+
m.sphere({ tag: 'pad', bone: 'fpaw' + S, group: g, c: add(M, [0, -0.016, 0.01]), rad: 0.011 * pk, k: 0.009 });
|
|
203
|
+
const toeX = [-0.0175, -0.006, 0.006, 0.0175].map((x) => x * pk), toeZ = [-0.009, 0, 0, -0.009].map((z) => z * pk);
|
|
204
|
+
for (let i = 0; i < 4; i++) m.sphere({ tag: 'toe', bone: 'fpaw' + S, group: g, c: [T[0] + toeX[i] * s, 0.0102 * pk, T[2] - 0.0075 * pk + toeZ[i]], rad: 0.0096 * pk, k: 0.006 });
|
|
205
|
+
for (let i = 0; i < 4; i++) m.cone({ tag: 'claw', bone: 'fpaw' + S, group: g, a: [T[0] + toeX[i] * s * 0.95, 0.0092 * pk, T[2] + toeZ[i]], b: [T[0] + toeX[i] * s * 0.95, 0.0035, T[2] + 0.009 * pk + toeZ[i]], ra: 0.0027, rb: 0.001, k: 0.002 });
|
|
206
|
+
|
|
207
|
+
const h = 'H' + S;
|
|
208
|
+
const Hp = J['hip' + S], K = J['knee' + S], Hk = J['hock' + S], Mt = J['mtp' + S], Tt = J['htoe' + S];
|
|
209
|
+
const hip = (d) => add(Hp, sx(d));
|
|
210
|
+
ellY({ tag: 'thigh', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.4), sx([0.003, 0, -0.024])), ydir: sub(K, Hp), lateral: lat, r: [0.035, 0.118, 0.078], k: 0.045, bias: 0.003 });
|
|
211
|
+
m.cone({ tag: 'thighfront', bone: 'femur' + S, group: h, a: hip([-0.024, 0.044, 0.084]), b: add(K, sx([-0.003, 0.045, 0.0])), ra: 0.031, rb: 0.02, k: 0.05 });
|
|
212
|
+
m.cone({ tag: 'hamstring', bone: 'femur' + S, group: h, a: hip([-0.02, 0.044, -0.084]), b: add(lerp(K, Hk, 0.28), [0, 0, -0.025]), ra: 0.037, rb: 0.023, k: 0.035 });
|
|
213
|
+
ellY({ tag: 'breeches', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.62), sx([0.005, -0.008, -0.068])), ydir: sub(K, Hp), lateral: lat, r: [0.024, 0.064, 0.018 + 0.012 * ruff], k: 0.03 });
|
|
214
|
+
ellY({ tag: 'flankfold', bone: 'femur' + S, group: h, c: hip([-0.016, -0.052, 0.1]), ydir: [-0.03, 0.16, 0.1], lateral: lat, r: [0.017, 0.066, 0.033], k: 0.05 });
|
|
215
|
+
m.sphere({ tag: 'stifle', bone: 'tibia' + S, group: h, c: add(K, sx([0.002, 0.007, 0.005])), rad: 0.014, k: 0.035 });
|
|
216
|
+
m.cone({ tag: 'shin', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.06), sx([0.0, 0.0, 0.003])), b: Hk, ra: 0.019 * legK, rb: 0.014 * legK, k: 0.025 });
|
|
217
|
+
ellY({ tag: 'calf', bone: 'tibia' + S, group: h, c: add(lerp(K, Hk, 0.3), sx([0.002, 0.008, -0.022])), ydir: sub(Hk, K), lateral: lat, r: [0.021, 0.058, 0.025], k: 0.03 });
|
|
218
|
+
m.cone({ tag: 'achilles', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.5), [0, 0.008, -0.028]), b: add(Hk, [0, 0.01, -0.024]), ra: 0.01, rb: 0.009, k: 0.013 });
|
|
219
|
+
m.sphere({ tag: 'calcaneus', bone: 'metatarsus' + S, group: h, c: add(Hk, [0, 0.01, -0.02]), rad: 0.0125, k: 0.01 });
|
|
220
|
+
m.sphere({ tag: 'hock', bone: 'metatarsus' + S, group: h, c: Hk, rad: 0.0165 * legK, k: 0.01 });
|
|
221
|
+
m.cone({ tag: 'metatarsus', bone: 'metatarsus' + S, group: h, a: Hk, b: Mt, ra: 0.015 * legK, rb: 0.014 * legK, k: 0.01 });
|
|
222
|
+
const dh = norm(sub(Tt, Mt));
|
|
223
|
+
ellY({ tag: 'paw', bone: 'hpaw' + S, group: h, c: add(add(Mt, mul(dh, 0.016)), [0, -0.005, 0]), ydir: dh, lateral: lat, r: [0.022 * pk, 0.03 * pk, 0.015], k: 0.012 });
|
|
224
|
+
m.sphere({ tag: 'pad', bone: 'hpaw' + S, group: h, c: add(Mt, [0, -0.018, 0.008]), rad: 0.01 * pk, k: 0.009 });
|
|
225
|
+
for (let i = 0; i < 4; i++) m.sphere({ tag: 'toe', bone: 'hpaw' + S, group: h, c: [Tt[0] + toeX[i] * 0.92 * s, 0.0096 * pk, Tt[2] - 0.0075 * pk + toeZ[i]], rad: 0.0088 * pk, k: 0.006 });
|
|
226
|
+
for (let i = 0; i < 4; i++) m.cone({ tag: 'claw', bone: 'hpaw' + S, group: h, a: [Tt[0] + toeX[i] * 0.88 * s, 0.0085 * pk, Tt[2] + toeZ[i]], b: [Tt[0] + toeX[i] * 0.88 * s, 0.0035, Tt[2] + 0.0085 * pk + toeZ[i]], ra: 0.0025, rb: 0.0009, k: 0.002 });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ---------------------------------------------------------------- TAIL
|
|
230
|
+
const tailType = params.tailType || 'brush';
|
|
231
|
+
const tb2 = params.tailBrush ?? 1;
|
|
232
|
+
const tailR = tailType === 'otter'
|
|
233
|
+
// thick at the root, tapering evenly to a rounded tip ("otter tail", FCI 122)
|
|
234
|
+
? (t) => tb2 * (0.034 - 0.022 * Math.pow(t, 1.1))
|
|
235
|
+
: tailType === 'thin'
|
|
236
|
+
? (t) => tb2 * (0.019 - 0.008 * t)
|
|
237
|
+
// bushy saber: thickest at a third of its length
|
|
238
|
+
: (t) => tb2 * (t < 0.12 ? 0.024 + 0.004 * (t / 0.12) : t < 0.45 ? 0.028 + 0.004 * ((t - 0.12) / 0.33) : 0.032 - 0.016 * Math.pow((t - 0.45) / 0.55, 1.6));
|
|
239
|
+
const rootR = tailType === 'thin' ? 0.024 : 0.03;
|
|
240
|
+
m.cone({ tag: 'tailroot', bone: 'tail0', a: lerp(J.tailBase, ls, 0.3), b: J.tail1, ra: rootR, rb: tailR(0.1), k: 0.035 });
|
|
241
|
+
for (let i = 0; i < TAIL_SEGS; i++) {
|
|
242
|
+
m.cone({ tag: 'tail', bone: 'tail' + i, a: J['tail' + i], b: J['tail' + (i + 1)], ra: tailR(i / TAIL_SEGS), rb: tailR((i + 1) / TAIL_SEGS), k: tailType === 'brush' ? 0.012 : 0.022, thin: i >= TAIL_SEGS - 1 });
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return m;
|
|
246
|
+
}
|