@bitefoundry/retrieviewer 0.0.3 → 0.0.5
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 +11 -0
- package/ASSETS-LICENSE.md +2 -1
- package/ATTRIBUTION.md +6 -1
- package/COMFORT-ART.md +95 -0
- package/DESKTOP-PLATFORMS.md +6 -1
- package/INSTALLING.md +4 -0
- package/PLUGIN.md +13 -10
- package/PREREQUISITES.md +95 -0
- package/PUPPY-MEMORY.md +102 -1
- package/README.ko.md +116 -0
- package/README.md +121 -59
- package/RELEASING.md +33 -13
- package/THIRD-PARTY-NOTICES.md +5 -3
- package/braille.mjs +35 -9
- package/examples/live.mjs +2 -2
- package/integrations/linux-overlay/overlay.py +8 -2
- package/integrations/macos-overlay/overlay.jxa +9 -7
- package/integrations/opencode/runtime.mjs +4 -4
- package/integrations/opencode/tui.tsx +1 -1
- package/integrations/windows-overlay/Overlay.cs +7 -6
- package/integrations/windows-overlay/desktop.mjs +2 -1
- package/integrations/windows-overlay/protocol.mjs +13 -7
- package/integrations/windows-overlay/worker.mjs +1 -1
- package/package.json +34 -13
- package/puppy-comfort-sprites.mjs +33 -0
- package/puppy-companion-comfort-q5.bin.gz +0 -0
- package/puppy-companion-comfort.json +140 -0
- package/puppy-companion-life.mjs +58 -18
- package/puppy-companion-objects.mjs +12 -0
- package/puppy-companion-sprites.mjs +4 -2
- package/puppy-frame-predictive.mjs +15 -9
- package/puppy-frame-store.mjs +2 -2
- package/puppy-paper-actions.mjs +4 -2
- package/puppy-paper-behaviors.mjs +1 -1
- package/puppy-paper-contact.mjs +4 -2
- package/puppy-paper-seat.mjs +4 -2
- package/puppy-paper-world.mjs +14 -0
- package/puppy-paper.mjs +79 -21
- package/retrieviewer-cli.mjs +8 -6
- package/retrieviewer-plugin.d.mts +1 -1
- package/retrieviewer-plugin.mjs +1 -1
- package/retrieviewer.d.mts +12 -4
- package/retrieviewer.mjs +20 -14
- package/locomotion-core.mjs +0 -21
- package/locomotion-puppy.animal +0 -0
- package/vendor/procedural-animals/package.json +0 -40
- package/vendor/procedural-animals/src/animal.js +0 -146
- package/vendor/procedural-animals/src/bake.js +0 -51
- package/vendor/procedural-animals/src/build.js +0 -81
- package/vendor/procedural-animals/src/core/build/coatKit.js +0 -121
- package/vendor/procedural-animals/src/core/build/featherCards.js +0 -189
- package/vendor/procedural-animals/src/core/build/finEdges.js +0 -85
- package/vendor/procedural-animals/src/core/build/furSlope.js +0 -115
- package/vendor/procedural-animals/src/core/build/mesh.js +0 -67
- package/vendor/procedural-animals/src/core/build/pipeline.js +0 -272
- package/vendor/procedural-animals/src/core/build/seams.js +0 -183
- package/vendor/procedural-animals/src/core/build/warp.js +0 -112
- package/vendor/procedural-animals/src/core/build/weights.js +0 -393
- package/vendor/procedural-animals/src/core/math/vec.js +0 -81
- package/vendor/procedural-animals/src/core/motion/actions.js +0 -800
- package/vendor/procedural-animals/src/core/motion/bird.js +0 -3063
- package/vendor/procedural-animals/src/core/motion/birdActions.js +0 -1059
- package/vendor/procedural-animals/src/core/motion/common.js +0 -158
- package/vendor/procedural-animals/src/core/motion/index.js +0 -22
- package/vendor/procedural-animals/src/core/motion/quadruped.js +0 -2875
- package/vendor/procedural-animals/src/core/motion/snake.js +0 -1594
- package/vendor/procedural-animals/src/core/motion/spider.js +0 -1810
- package/vendor/procedural-animals/src/core/motion/swimmer.js +0 -1047
- package/vendor/procedural-animals/src/core/motion/swimmerActions.js +0 -613
- package/vendor/procedural-animals/src/core/render/animalObject.js +0 -262
- package/vendor/procedural-animals/src/core/render/coatMaterial.js +0 -1301
- package/vendor/procedural-animals/src/core/render/dqs.js +0 -159
- package/vendor/procedural-animals/src/core/render/eyes.js +0 -676
- package/vendor/procedural-animals/src/core/render/membranes.js +0 -77
- package/vendor/procedural-animals/src/core/render/skeleton.js +0 -41
- package/vendor/procedural-animals/src/core/rig/bird.js +0 -327
- package/vendor/procedural-animals/src/core/rig/quadruped.js +0 -76
- package/vendor/procedural-animals/src/core/rig/rig.js +0 -79
- package/vendor/procedural-animals/src/core/rig/snake.js +0 -76
- package/vendor/procedural-animals/src/core/rig/spider.js +0 -110
- package/vendor/procedural-animals/src/core/rig/swimmer.js +0 -181
- package/vendor/procedural-animals/src/core/sdf/eyeSocket.js +0 -53
- package/vendor/procedural-animals/src/core/sdf/mesher.js +0 -238
- package/vendor/procedural-animals/src/core/sdf/sdf.js +0 -263
- package/vendor/procedural-animals/src/index.d.ts +0 -98
- package/vendor/procedural-animals/src/index.js +0 -29
- package/vendor/procedural-animals/src/registry.js +0 -48
- package/vendor/procedural-animals/src/species/bear/behaviour.js +0 -463
- package/vendor/procedural-animals/src/species/bear/claws.js +0 -147
- package/vendor/procedural-animals/src/species/bear/coat.js +0 -726
- package/vendor/procedural-animals/src/species/bear/index.js +0 -139
- package/vendor/procedural-animals/src/species/bear/motion.js +0 -112
- package/vendor/procedural-animals/src/species/bear/regions.js +0 -78
- package/vendor/procedural-animals/src/species/bear/rig.js +0 -112
- package/vendor/procedural-animals/src/species/bear/sculpt.js +0 -272
- package/vendor/procedural-animals/src/species/boar/behaviour.js +0 -335
- package/vendor/procedural-animals/src/species/boar/coat.js +0 -372
- package/vendor/procedural-animals/src/species/boar/index.js +0 -110
- package/vendor/procedural-animals/src/species/boar/motion.js +0 -85
- package/vendor/procedural-animals/src/species/boar/regions.js +0 -88
- package/vendor/procedural-animals/src/species/boar/rig.js +0 -111
- package/vendor/procedural-animals/src/species/boar/sculpt.js +0 -285
- package/vendor/procedural-animals/src/species/cat/behaviour.js +0 -559
- package/vendor/procedural-animals/src/species/cat/coat.js +0 -841
- package/vendor/procedural-animals/src/species/cat/index.js +0 -211
- package/vendor/procedural-animals/src/species/cat/motion.js +0 -101
- package/vendor/procedural-animals/src/species/cat/regions.js +0 -82
- package/vendor/procedural-animals/src/species/cat/rig.js +0 -100
- package/vendor/procedural-animals/src/species/cat/sculpt.js +0 -266
- package/vendor/procedural-animals/src/species/cat/whiskers.js +0 -110
- package/vendor/procedural-animals/src/species/cheetah/coat.js +0 -427
- package/vendor/procedural-animals/src/species/cheetah/index.js +0 -51
- package/vendor/procedural-animals/src/species/cheetah/joints.js +0 -3
- package/vendor/procedural-animals/src/species/cheetah/motion.js +0 -77
- package/vendor/procedural-animals/src/species/cheetah/regions.js +0 -95
- package/vendor/procedural-animals/src/species/cheetah/rig.js +0 -66
- package/vendor/procedural-animals/src/species/cheetah/sculpt.js +0 -158
- package/vendor/procedural-animals/src/species/chicken/coat.js +0 -313
- package/vendor/procedural-animals/src/species/chicken/coverts.js +0 -320
- package/vendor/procedural-animals/src/species/chicken/index.js +0 -110
- package/vendor/procedural-animals/src/species/chicken/motion.js +0 -177
- package/vendor/procedural-animals/src/species/chicken/regions.js +0 -66
- package/vendor/procedural-animals/src/species/chicken/rig.js +0 -144
- package/vendor/procedural-animals/src/species/chicken/sculpt.js +0 -389
- package/vendor/procedural-animals/src/species/chicken/wingLook.js +0 -66
- package/vendor/procedural-animals/src/species/chicken/wingStack.js +0 -124
- package/vendor/procedural-animals/src/species/cow/behaviour.js +0 -521
- package/vendor/procedural-animals/src/species/cow/coat.js +0 -465
- package/vendor/procedural-animals/src/species/cow/index.js +0 -118
- package/vendor/procedural-animals/src/species/cow/motion.js +0 -81
- package/vendor/procedural-animals/src/species/cow/regions.js +0 -98
- package/vendor/procedural-animals/src/species/cow/rig.js +0 -116
- package/vendor/procedural-animals/src/species/cow/sculpt.js +0 -339
- package/vendor/procedural-animals/src/species/crow/coat.js +0 -145
- package/vendor/procedural-animals/src/species/crow/index.js +0 -70
- package/vendor/procedural-animals/src/species/crow/joints.js +0 -3
- package/vendor/procedural-animals/src/species/crow/motion.js +0 -101
- package/vendor/procedural-animals/src/species/crow/regions.js +0 -50
- package/vendor/procedural-animals/src/species/crow/rig.js +0 -83
- package/vendor/procedural-animals/src/species/crow/sculpt.js +0 -118
- package/vendor/procedural-animals/src/species/deer/behaviour.js +0 -513
- package/vendor/procedural-animals/src/species/deer/coat.js +0 -391
- package/vendor/procedural-animals/src/species/deer/index.js +0 -106
- package/vendor/procedural-animals/src/species/deer/motion.js +0 -97
- package/vendor/procedural-animals/src/species/deer/regions.js +0 -60
- package/vendor/procedural-animals/src/species/deer/rig.js +0 -124
- package/vendor/procedural-animals/src/species/deer/sculpt.js +0 -297
- package/vendor/procedural-animals/src/species/dog/behaviour.js +0 -521
- package/vendor/procedural-animals/src/species/dog/coat.js +0 -495
- package/vendor/procedural-animals/src/species/dog/index.js +0 -144
- package/vendor/procedural-animals/src/species/dog/motion.js +0 -118
- package/vendor/procedural-animals/src/species/dog/regions.js +0 -61
- package/vendor/procedural-animals/src/species/dog/rig.js +0 -129
- package/vendor/procedural-animals/src/species/dog/sculpt.js +0 -246
- package/vendor/procedural-animals/src/species/eagle/coat.js +0 -250
- package/vendor/procedural-animals/src/species/eagle/index.js +0 -76
- package/vendor/procedural-animals/src/species/eagle/joints.js +0 -3
- package/vendor/procedural-animals/src/species/eagle/motion.js +0 -137
- package/vendor/procedural-animals/src/species/eagle/regions.js +0 -57
- package/vendor/procedural-animals/src/species/eagle/rig.js +0 -107
- package/vendor/procedural-animals/src/species/eagle/sculpt.js +0 -137
- package/vendor/procedural-animals/src/species/fish/coat.js +0 -271
- package/vendor/procedural-animals/src/species/fish/index.js +0 -88
- package/vendor/procedural-animals/src/species/fish/motion.js +0 -92
- package/vendor/procedural-animals/src/species/fish/regions.js +0 -27
- package/vendor/procedural-animals/src/species/fish/rig.js +0 -143
- package/vendor/procedural-animals/src/species/fish/sculpt.js +0 -214
- package/vendor/procedural-animals/src/species/fish/variants.js +0 -126
- package/vendor/procedural-animals/src/species/fox/behaviour.js +0 -314
- package/vendor/procedural-animals/src/species/fox/coat.js +0 -444
- package/vendor/procedural-animals/src/species/fox/index.js +0 -120
- package/vendor/procedural-animals/src/species/fox/motion.js +0 -81
- package/vendor/procedural-animals/src/species/fox/regions.js +0 -59
- package/vendor/procedural-animals/src/species/fox/rig.js +0 -91
- package/vendor/procedural-animals/src/species/fox/sculpt.js +0 -202
- package/vendor/procedural-animals/src/species/frog/behaviour.js +0 -590
- package/vendor/procedural-animals/src/species/frog/coat.js +0 -305
- package/vendor/procedural-animals/src/species/frog/index.js +0 -97
- package/vendor/procedural-animals/src/species/frog/motion.js +0 -69
- package/vendor/procedural-animals/src/species/frog/regions.js +0 -46
- package/vendor/procedural-animals/src/species/frog/rig.js +0 -156
- package/vendor/procedural-animals/src/species/frog/sculpt.js +0 -240
- package/vendor/procedural-animals/src/species/goat/behaviour.js +0 -509
- package/vendor/procedural-animals/src/species/goat/coat.js +0 -590
- package/vendor/procedural-animals/src/species/goat/index.js +0 -149
- package/vendor/procedural-animals/src/species/goat/motion.js +0 -95
- package/vendor/procedural-animals/src/species/goat/regions.js +0 -98
- package/vendor/procedural-animals/src/species/goat/rig.js +0 -181
- package/vendor/procedural-animals/src/species/goat/sculpt.js +0 -547
- package/vendor/procedural-animals/src/species/horse/coat.js +0 -361
- package/vendor/procedural-animals/src/species/horse/coatSeam.js +0 -122
- package/vendor/procedural-animals/src/species/horse/index.js +0 -80
- package/vendor/procedural-animals/src/species/horse/motion.js +0 -245
- package/vendor/procedural-animals/src/species/horse/regions.js +0 -60
- package/vendor/procedural-animals/src/species/horse/rig.js +0 -117
- package/vendor/procedural-animals/src/species/horse/sculpt.js +0 -316
- package/vendor/procedural-animals/src/species/horse/seamWeights.js +0 -272
- package/vendor/procedural-animals/src/species/lion/behaviour.js +0 -509
- package/vendor/procedural-animals/src/species/lion/coat.js +0 -1016
- package/vendor/procedural-animals/src/species/lion/index.js +0 -111
- package/vendor/procedural-animals/src/species/lion/motion.js +0 -87
- package/vendor/procedural-animals/src/species/lion/regions.js +0 -106
- package/vendor/procedural-animals/src/species/lion/rig.js +0 -110
- package/vendor/procedural-animals/src/species/lion/sculpt.js +0 -384
- package/vendor/procedural-animals/src/species/lion/whiskers.js +0 -132
- package/vendor/procedural-animals/src/species/pig/behaviour.js +0 -575
- package/vendor/procedural-animals/src/species/pig/coat.js +0 -730
- package/vendor/procedural-animals/src/species/pig/ears.js +0 -242
- package/vendor/procedural-animals/src/species/pig/index.js +0 -161
- package/vendor/procedural-animals/src/species/pig/motion.js +0 -105
- package/vendor/procedural-animals/src/species/pig/regions.js +0 -100
- package/vendor/procedural-animals/src/species/pig/rig.js +0 -152
- package/vendor/procedural-animals/src/species/pig/sculpt.js +0 -382
- package/vendor/procedural-animals/src/species/rabbit/behaviour.js +0 -605
- package/vendor/procedural-animals/src/species/rabbit/coat.js +0 -285
- package/vendor/procedural-animals/src/species/rabbit/index.js +0 -85
- package/vendor/procedural-animals/src/species/rabbit/motion.js +0 -85
- package/vendor/procedural-animals/src/species/rabbit/regions.js +0 -48
- package/vendor/procedural-animals/src/species/rabbit/rig.js +0 -99
- package/vendor/procedural-animals/src/species/rabbit/sculpt.js +0 -148
- package/vendor/procedural-animals/src/species/rat/behaviour.js +0 -539
- package/vendor/procedural-animals/src/species/rat/coat.js +0 -341
- package/vendor/procedural-animals/src/species/rat/index.js +0 -111
- package/vendor/procedural-animals/src/species/rat/motion.js +0 -90
- package/vendor/procedural-animals/src/species/rat/regions.js +0 -92
- package/vendor/procedural-animals/src/species/rat/rig.js +0 -112
- package/vendor/procedural-animals/src/species/rat/sculpt.js +0 -163
- package/vendor/procedural-animals/src/species/rat/whiskers.js +0 -119
- package/vendor/procedural-animals/src/species/shark/coat.js +0 -383
- package/vendor/procedural-animals/src/species/shark/index.js +0 -104
- package/vendor/procedural-animals/src/species/shark/motion.js +0 -69
- package/vendor/procedural-animals/src/species/shark/regions.js +0 -34
- package/vendor/procedural-animals/src/species/shark/rig.js +0 -194
- package/vendor/procedural-animals/src/species/shark/sculpt.js +0 -343
- package/vendor/procedural-animals/src/species/shark/variants.js +0 -105
- package/vendor/procedural-animals/src/species/sheep/behaviour.js +0 -522
- package/vendor/procedural-animals/src/species/sheep/coat.js +0 -529
- package/vendor/procedural-animals/src/species/sheep/index.js +0 -152
- package/vendor/procedural-animals/src/species/sheep/motion.js +0 -86
- package/vendor/procedural-animals/src/species/sheep/neck.js +0 -41
- package/vendor/procedural-animals/src/species/sheep/regions.js +0 -62
- package/vendor/procedural-animals/src/species/sheep/rig.js +0 -163
- package/vendor/procedural-animals/src/species/sheep/sculpt.js +0 -542
- package/vendor/procedural-animals/src/species/snake/coat.js +0 -315
- package/vendor/procedural-animals/src/species/snake/index.js +0 -73
- package/vendor/procedural-animals/src/species/snake/motion.js +0 -51
- package/vendor/procedural-animals/src/species/snake/regions.js +0 -51
- package/vendor/procedural-animals/src/species/snake/rig.js +0 -108
- package/vendor/procedural-animals/src/species/snake/sculpt.js +0 -122
- package/vendor/procedural-animals/src/species/spider/coat.js +0 -279
- package/vendor/procedural-animals/src/species/spider/index.js +0 -78
- package/vendor/procedural-animals/src/species/spider/motion.js +0 -72
- package/vendor/procedural-animals/src/species/spider/regions.js +0 -87
- package/vendor/procedural-animals/src/species/spider/rig.js +0 -118
- package/vendor/procedural-animals/src/species/spider/sculpt.js +0 -182
- package/vendor/procedural-animals/src/species/wolf/behaviour.js +0 -160
- package/vendor/procedural-animals/src/species/wolf/coat.js +0 -749
- package/vendor/procedural-animals/src/species/wolf/index.js +0 -107
- package/vendor/procedural-animals/src/species/wolf/motion.js +0 -80
- package/vendor/procedural-animals/src/species/wolf/regions.js +0 -57
- package/vendor/procedural-animals/src/species/wolf/rig.js +0 -87
- package/vendor/procedural-animals/src/species/wolf/sculpt.js +0 -339
- package/vendor/procedural-animals/src/worker.js +0 -29
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
// Meshing plan: body at 2.8 mm (0.7 % of the withers height), head at 1.35 mm (overlapping across the
|
|
2
|
-
// upper neck and cross-faded), eyelid patches at ~0.7 mm, and the lower jaw as its own surface so the
|
|
3
|
-
// mouth can open.
|
|
4
|
-
import { foxJoints, HEAD_O } from './rig.js';
|
|
5
|
-
import { eyeOf } from './sculpt.js';
|
|
6
|
-
import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
|
|
7
|
-
import { lerp, norm, sub, smoothstep } from '../../core/math/vec.js';
|
|
8
|
-
|
|
9
|
-
// the neck cut is fixed in reference space (joints of the reference individual)
|
|
10
|
-
const J0 = foxJoints();
|
|
11
|
-
export const NECK_CUT = (() => {
|
|
12
|
-
const d = norm(sub(J0.occiput, J0.neckMid));
|
|
13
|
-
const c = lerp(J0.neckMid, J0.occiput, 0.75);
|
|
14
|
-
return { c, d, band: 0.0065 };
|
|
15
|
-
})();
|
|
16
|
-
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];
|
|
17
|
-
|
|
18
|
-
export const eyeCentres = (params) => [1, -1].map((s) => eyeFrameOf(eyeOf(params), HEAD_O, s).c);
|
|
19
|
-
const PATCH = { R: 0.017, B: 0.003, h: 0.0007 };
|
|
20
|
-
function eyePatchWeight(centres, R, B, x, y, z) {
|
|
21
|
-
let dmin = 1e9;
|
|
22
|
-
for (const c of centres) dmin = Math.min(dmin, Math.hypot(x - c[0], y - c[1], z - c[2]));
|
|
23
|
-
return 1 - smoothstep(R - B, R + B, dmin);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function foxRegions(rig, params, Q) {
|
|
27
|
-
// the cross-fade band grows with the coarser (body) cell: at the low and crowd tiers the body cells
|
|
28
|
-
// (9-13 mm) were bigger than a fixed 6.5 mm band, so the body's clip rim could land on the visible
|
|
29
|
-
// side of the band and open the skin beside the cheeks (exposed holes, low / crowd)
|
|
30
|
-
const r = Q.res, B = Math.max(NECK_CUT.band, 1.6 * 0.003 * r);
|
|
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 zN = rig.J.nose[2] + 0.02;
|
|
36
|
-
const hw = params.headW || 1;
|
|
37
|
-
return {
|
|
38
|
-
jobs: [
|
|
39
|
-
// (the body box reaches past the jaw hinge: the neck cut runs steeply down through the back of the
|
|
40
|
-
// jaw, and the jowl's lower front, flush with the jaw's lower line, still lies on the body's side of
|
|
41
|
-
// the band there (z ~0.38-0.40); a box face at 0.38 cut it open)
|
|
42
|
-
[{ name: 'body', part: 'body', bmin: [-0.11, -0.02, -0.62], bmax: [0.11, 0.52, 0.42], h: 0.003 * r, F: 4, clip: (x, y, z) => neckS(x, y, z) < B }],
|
|
43
|
-
[
|
|
44
|
-
{ name: 'head', part: 'body', bmin: [-0.08, 0.3, 0.22], bmax: [0.08, 0.58, zN], h: 0.00142 * r, F: 6, clip: (x, y, z) => neckS(x, y, z) > -B, patches },
|
|
45
|
-
{ name: 'jaw', part: 'jaw', bmin: [-0.035 * hw, 0.34, 0.31], bmax: [0.035 * hw, 0.41, zN], h: 0.00135 * r, F: 6, rigidBone: 'jaw' },
|
|
46
|
-
],
|
|
47
|
-
],
|
|
48
|
-
fade(x, y, z, name, patch) {
|
|
49
|
-
const sN = neckS(x, y, z);
|
|
50
|
-
if (name === 'body') return 1 - smoothstep(-B, B, sN);
|
|
51
|
-
if (name === 'head') {
|
|
52
|
-
let f = smoothstep(-B, B, sN);
|
|
53
|
-
if (patches.length) { const ew = eyePatchWeight(centres, PR, PB, x, y, z); f *= patch ? ew : 1 - ew; }
|
|
54
|
-
return f;
|
|
55
|
-
}
|
|
56
|
-
return 1;
|
|
57
|
-
},
|
|
58
|
-
};
|
|
59
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
// Red fox skeleton in bind pose (metres). Forward = +Z, up = +Y, the animal's left = +X.
|
|
2
|
-
//
|
|
3
|
-
// Reference individual: an average adult between the sexes, withers height 0.40 m (M 0.42 / F 0.39),
|
|
4
|
-
// nose -> tail base ~0.64 m straight (head-body 0.60-0.68 m), tail vertebrae 0.40 m (+ ~6 cm of brush
|
|
5
|
-
// beyond the tip), head 0.165 m occiput -> nose with skin and coat (condylobasal 135-160 mm).
|
|
6
|
-
// Limb segments (von den Driesch 1976 / Iberian red fox series): scapula 95, humerus 120,
|
|
7
|
-
// radius 122, metacarpus 50, femur 130, tibia 140, metatarsus 62 mm. Standing angles from the side
|
|
8
|
-
// photos: elbow under the front of the withers, near-vertical metacarpus, straight thin forelegs,
|
|
9
|
-
// moderately angled hind legs with the hock a hand behind the hip. Very narrow front: the forefeet
|
|
10
|
-
// stand ~6 cm apart centre to centre (a single-file track), the chest is narrow and keeled.
|
|
11
|
-
// The head is modelled level in its own frame (HEAD_O); its carriage comes from the motion data.
|
|
12
|
-
import { buildRig } from '../../core/rig/rig.js';
|
|
13
|
-
import { quadrupedBones, quadrupedLimbs, tailChain } from '../../core/rig/quadruped.js';
|
|
14
|
-
|
|
15
|
-
export const TAIL_SEGS = 10;
|
|
16
|
-
export const HEAD_O = [0, 0.418, 0.352]; // head-local origin (mid cranium, between eyes and ears)
|
|
17
|
-
export const HS = 0.66; // head-local scale (landmarks in sculpt.js are for a 0.25 m skull -> 0.165 m)
|
|
18
|
-
export const SH = 0.4; // reference withers height
|
|
19
|
-
export const MUZZLE_Z0 = 0.035; // head-local z where the muzzle starts (muzzle length variation acts ahead of it)
|
|
20
|
-
|
|
21
|
-
// head-local -> reference space, with per-individual muzzle length and head width factors
|
|
22
|
-
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])];
|
|
23
|
-
|
|
24
|
-
// ear (head-local): big erect triangle (85-110 mm, ~60 % of the head length), set high and fairly
|
|
25
|
-
// close, pointing up and a little out, the opening forward
|
|
26
|
-
export const EAR = { base: [0.046, 0.048, -0.034], dir: [0.05, 0.118, -0.006] };
|
|
27
|
-
|
|
28
|
-
export function foxJoints(params = {}) {
|
|
29
|
-
const hl = hlOf(params.muzzle || 1, params.headW || 1);
|
|
30
|
-
const earK = params.ear || 1;
|
|
31
|
-
const ear = hl(EAR.base);
|
|
32
|
-
const hw = params.headW || 1;
|
|
33
|
-
const J = {
|
|
34
|
-
nose: hl([0, -0.014, 0.16]),
|
|
35
|
-
occiput: hl([0, 0.02, -0.095]),
|
|
36
|
-
neckMid: [0, 0.378, 0.27],
|
|
37
|
-
neckBase: [0, 0.335, 0.245],
|
|
38
|
-
chestMid: [0, 0.338, 0.14],
|
|
39
|
-
thoraxRear: [0, 0.345, 0.03],
|
|
40
|
-
lumbarMid: [0, 0.35, -0.065],
|
|
41
|
-
lumbosacral: [0, 0.345, -0.135],
|
|
42
|
-
tailBase: [0, 0.336, -0.19],
|
|
43
|
-
scapTopL: [0.022, 0.372, 0.2],
|
|
44
|
-
shoulderL: [0.038, 0.283, 0.252],
|
|
45
|
-
elbowL: [0.034, 0.19, 0.184],
|
|
46
|
-
wristL: [0.029, 0.067, 0.19],
|
|
47
|
-
mcpL: [0.028, 0.019, 0.197],
|
|
48
|
-
ftoeL: [0.028, 0.0085, 0.222],
|
|
49
|
-
hipL: [0.036, 0.3, -0.168],
|
|
50
|
-
kneeL: [0.046, 0.18, -0.118],
|
|
51
|
-
hockL: [0.035, 0.078, -0.212],
|
|
52
|
-
mtpL: [0.033, 0.019, -0.205],
|
|
53
|
-
htoeL: [0.033, 0.0085, -0.18],
|
|
54
|
-
jawHinge: hl([0, -0.034, -0.03]),
|
|
55
|
-
jawTip: hl([0, -0.057, 0.127]),
|
|
56
|
-
earBaseL: ear,
|
|
57
|
-
earTipL: [ear[0] + EAR.dir[0] * earK * HS * hw, ear[1] + EAR.dir[1] * earK * HS, ear[2] + EAR.dir[2] * earK * HS],
|
|
58
|
-
};
|
|
59
|
-
// bind tail held out behind in a shallow downward curve (the trotting carriage), clear of the
|
|
60
|
-
// hocks; the resting droop and every behaviour come from the motion data
|
|
61
|
-
const tk = (params.tail || 1) * 0.4;
|
|
62
|
-
const w = [1.06, 1.06, 1.05, 1.03, 1.01, 0.99, 0.97, 0.95, 0.94, 0.94], ws = w.reduce((a, b) => a + b, 0);
|
|
63
|
-
tailChain(J, 'tailBase', [-12, -18, -23, -26, -28, -29, -29, -28, -27, -26], w.map((x) => (x / ws) * tk));
|
|
64
|
-
return J;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function foxRig(params = {}) {
|
|
68
|
-
const J = foxJoints(params);
|
|
69
|
-
return buildRig({
|
|
70
|
-
joints: J,
|
|
71
|
-
unit: SH / 0.76,
|
|
72
|
-
headOrigin: HEAD_O,
|
|
73
|
-
bones: quadrupedBones({ tailSegs: TAIL_SEGS, ears: true, jaw: true }),
|
|
74
|
-
axial: {
|
|
75
|
-
points: ['nose', 'occiput', 'neckMid', 'neckBase', 'chestMid', 'thoraxRear', 'lumbarMid', 'lumbosacral', 'tailBase', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + (i + 1))],
|
|
76
|
-
bones: ['head', 'neck2', 'neck1', 'chest', 'spine3', 'spine2', 'spine1', 'pelvis', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + i)],
|
|
77
|
-
// the skull's influence reaches back into the nape and the cheek ruff; wider on the throat
|
|
78
|
-
blend: { 1: [-0.08, 0.17, 3] },
|
|
79
|
-
bodyTail: 0, // the brush hangs behind the thighs: their skin blends into it only at the tail base
|
|
80
|
-
},
|
|
81
|
-
limbs: quadrupedLimbs({
|
|
82
|
-
front: { tCore: 0.55, aCore: 0.04, aBody: -0.07, midX: 0.0 },
|
|
83
|
-
hind: { tCore: 0.52, aCore: 0.022, aBody: -0.045, midX: 0.008 },
|
|
84
|
-
}),
|
|
85
|
-
appendages: [
|
|
86
|
-
{ group: 'earL', bone: 'earL', blend: [-0.003, 0.006] },
|
|
87
|
-
{ group: 'earR', bone: 'earR', blend: [-0.003, 0.006] },
|
|
88
|
-
],
|
|
89
|
-
webTags: ['flankfold', 'thighfront', 'scapmuscle'],
|
|
90
|
-
});
|
|
91
|
-
}
|
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
// The red fox, sculpted as a signed distance field.
|
|
2
|
-
// Every primitive is attached to a bone (skinning) and a group (axial / limb / ear / jaw). The fox is
|
|
3
|
-
// a small, light canid made to look bigger by its fur: a slim, narrow-chested body with a tucked
|
|
4
|
-
// belly on long thin legs, a long narrow muzzle, big erect ears and a huge cylindrical brush. The
|
|
5
|
-
// winter coat is partly sculpted as volume (cheek ruff, chest fluff, the brush), the shells add the
|
|
6
|
-
// hair on top of it.
|
|
7
|
-
import { HEAD_O, TAIL_SEGS, HS, hlOf } from './rig.js';
|
|
8
|
-
import { add, sub, mul, lerp, norm, cross } from '../../core/math/vec.js';
|
|
9
|
-
import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
|
|
10
|
-
|
|
11
|
-
// Eye geometry shared by the sculpt (lids + aperture) and the eyeball shader (head-local, left eye).
|
|
12
|
-
// Axial eyeball ~17.6 mm (r 8.8 mm); almond fissure ~17 x 8.5 mm, set obliquely (outer corner higher,
|
|
13
|
-
// ~24 deg); the eyes sit high and fairly close (~46 mm apart), diverging ~15 deg each.
|
|
14
|
-
export const EYE_BASE = { c: [0.035, 0.022, 0.035], r: 0.0098, back: 0.0021, yaw: 0.2, pitch: 0.05, lid: 0.0012, R: 0.012, d: 0.0062, off: -0.0006, tilt: (24 * Math.PI) / 180, irisZ: 0.006, irisR: 0.0082 };
|
|
15
|
-
// per individual: the eye moves with the head width (the muzzle stretch starts in front of it); kits
|
|
16
|
-
// have relatively bigger eyes
|
|
17
|
-
export const eyeOf = (params = {}) => {
|
|
18
|
-
const k = params.eyeK || 1;
|
|
19
|
-
return { ...EYE_BASE, c: [EYE_BASE.c[0] * (params.headW || 1) * HS, EYE_BASE.c[1] * HS, EYE_BASE.c[2] * HS], r: EYE_BASE.r * k, back: EYE_BASE.back * k, lid: EYE_BASE.lid * k, R: EYE_BASE.R * k, d: EYE_BASE.d * k, off: EYE_BASE.off * k, irisZ: EYE_BASE.irisZ * k, irisR: EYE_BASE.irisR * k };
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const X = [1, 0, 0];
|
|
23
|
-
|
|
24
|
-
export function sculptFox(m, rig, params = {}) {
|
|
25
|
-
const J = rig.J;
|
|
26
|
-
const EYE = eyeOf(params);
|
|
27
|
-
const mz = params.muzzle || 1, hw = params.headW || 1, ruff = params.ruff ?? 1, juv = params.juv || 0;
|
|
28
|
-
const slim = params.slim ?? 1; // body girth factor (males a little heavier)
|
|
29
|
-
// head-local -> reference space: width factor, and the muzzle stretched ahead of MUZZLE_Z0
|
|
30
|
-
const hl = hlOf(mz, hw);
|
|
31
|
-
const hr = (r) => [r[0] * hw * HS, r[1] * HS, r[2] * HS]; // radii in head space
|
|
32
|
-
const eyeFrame = (s) => eyeFrameOf(EYE, HEAD_O, s);
|
|
33
|
-
|
|
34
|
-
// Ellipsoid whose local Y follows `ydir`; radii = [lateral, along ydir, third axis]
|
|
35
|
-
const ellY = (o) => {
|
|
36
|
-
const y = norm(o.ydir);
|
|
37
|
-
const lat = o.lateral || X;
|
|
38
|
-
const z = norm(cross(lat, y));
|
|
39
|
-
return m.ell({ ...o, axis: z, up: y, r: [o.r[0], o.r[1], o.r[2]] });
|
|
40
|
-
};
|
|
41
|
-
const sw = (r) => [r[0] * slim, r[1], r[2]];
|
|
42
|
-
|
|
43
|
-
// ---------------------------------------------------------------- TORSO
|
|
44
|
-
// narrow, keeled chest (the elbows almost touch), level back, belly tucked up behind the ribs
|
|
45
|
-
m.ell({ tag: 'ribcage', bone: 'spine3', c: [0, 0.296, 0.1], r: sw([0.048, 0.082, 0.125]), axis: norm([0, 0.12, -1]), k: 0 });
|
|
46
|
-
m.ell({ tag: 'brisket', bone: 'chest', c: [0, 0.24, 0.185], r: sw([0.031, 0.042, 0.065]), axis: norm([0, -0.35, 1]), k: 0.035 });
|
|
47
|
-
m.ell({ tag: 'pectoral', bone: 'chest', c: [0, 0.272, 0.25], r: sw([0.034, 0.042, 0.034]), k: 0.03 });
|
|
48
|
-
m.ell({ tag: 'withers', bone: 'chest', c: [0, 0.372, 0.172], r: sw([0.026, 0.03, 0.075]), axis: norm([0, -0.1, 1]), k: 0.035 });
|
|
49
|
-
m.ell({ tag: 'back', bone: 'spine3', c: [0, 0.37, 0.03], r: sw([0.034, 0.028, 0.1]), k: 0.035 });
|
|
50
|
-
m.ell({ tag: 'abdomen', bone: 'spine2', c: [0, 0.308, -0.045], r: sw([0.04, 0.05, 0.095]), axis: norm([0, 0.3, -1]), k: 0.04 });
|
|
51
|
-
m.ell({ tag: 'loin', bone: 'spine1', c: [0, 0.362, -0.085], r: sw([0.031, 0.027, 0.085]), k: 0.03 });
|
|
52
|
-
m.ell({ tag: 'flank', bone: 'spine1', c: [0, 0.318, -0.115], r: sw([0.033, 0.034, 0.055]), k: 0.03 });
|
|
53
|
-
m.ell({ tag: 'pelvis', bone: 'pelvis', c: [0, 0.333, -0.17], r: sw([0.036, 0.046, 0.065]), k: 0.035 });
|
|
54
|
-
m.ell({ tag: 'croup', bone: 'pelvis', c: [0, 0.36, -0.165], r: sw([0.028, 0.022, 0.06]), k: 0.025 });
|
|
55
|
-
for (const s of [1, -1]) {
|
|
56
|
-
m.ell({ tag: 'rump', bone: 'pelvis', c: [0.022 * s * slim, 0.31, -0.212], r: [0.022, 0.038, 0.028], k: 0.025 });
|
|
57
|
-
}
|
|
58
|
-
// shoulder fluff over the withers (sculpted coat volume)
|
|
59
|
-
m.ell({ tag: 'cape', bone: 'chest', c: [0, 0.362, 0.2], r: [0.04 * slim, 0.036, 0.075], axis: norm([0, 0.25, 1]), k: 0.04 });
|
|
60
|
-
|
|
61
|
-
// ---------------------------------------------------------------- NECK (slim, wrapped in the ruff)
|
|
62
|
-
m.cone({ tag: 'neck', bone: 'neck1', a: [0, 0.312, 0.228], b: [0, 0.37, 0.278], ra: 0.043, rb: 0.035, k: 0.035 });
|
|
63
|
-
m.cone({ tag: 'neck', bone: 'neck2', a: [0, 0.37, 0.278], b: [0, 0.41, 0.315], ra: 0.035, rb: 0.03, k: 0.025 });
|
|
64
|
-
m.ell({ tag: 'nape', bone: 'neck1', c: [0, 0.4, 0.265], r: [0.024, 0.018, 0.058], axis: norm([0, 0.55, 1]), k: 0.025 });
|
|
65
|
-
m.ell({ tag: 'throat', bone: 'neck2', c: [0, 0.34, 0.31], r: [0.025, 0.032, 0.036], axis: norm([0, 0.8, 0.6]), k: 0.04 });
|
|
66
|
-
// the ruff: a fluffy collar, fullest on the white throat and chest (the "bib")
|
|
67
|
-
const rf = 0.8 + 0.2 * ruff;
|
|
68
|
-
m.ell({ tag: 'ruff', bone: 'neck1', c: [0, 0.335, 0.27], r: [0.042 * rf, 0.048 * rf, 0.05], axis: norm([0, 0.6, 1]), k: 0.045 });
|
|
69
|
-
m.ell({ tag: 'ruff', bone: 'neck2', c: [0, 0.36, 0.312], r: [0.028 * rf, 0.026 * rf, 0.03], axis: norm([0, 0.8, 1]), k: 0.042 });
|
|
70
|
-
|
|
71
|
-
// ---------------------------------------------------------------- HEAD (head-local coords, see HEAD_O)
|
|
72
|
-
// landmarks from the profile / frontal photos (0.165 m occiput -> nose; local units x HS): nose tip
|
|
73
|
-
// (0,-0.014,0.16), eyes (+-0.035, 0.022, 0.035), shallow stop ~z 0.045, chin (0,-0.058,0.13),
|
|
74
|
-
// flat skull top 0.058, occiput -0.1; wide cheeks (the white cheek ruff) narrowing sharply into a
|
|
75
|
-
// long, slender, pointed muzzle. Kits: domed skull, short muzzle (params)
|
|
76
|
-
const H = { bone: 'head' };
|
|
77
|
-
m.ell({ ...H, tag: 'cranium', c: hl([0, 0.016 + 0.008 * juv, -0.035]), r: hr([0.05 + 0.004 * juv, 0.047 + 0.01 * juv, 0.065]), k: 0.04 });
|
|
78
|
-
m.ell({ ...H, tag: 'forehead', c: hl([0, 0.03 + 0.005 * juv, 0.018]), r: hr([0.033, 0.028, 0.04]), axis: norm([0, -0.3, 1]), k: 0.025 });
|
|
79
|
-
for (const s of [1, -1]) {
|
|
80
|
-
m.ell({ ...H, tag: 'brow', c: hl([0.029 * s, 0.036, 0.03]), r: hr([0.015, 0.008, 0.014]), k: 0.012 });
|
|
81
|
-
m.ell({ ...H, tag: 'zygomatic', c: hl([0.052 * s, 0.0, -0.004]), r: hr([0.016, 0.022, 0.042]), axis: norm([-0.3 * s, 0, 1]), k: 0.025 });
|
|
82
|
-
m.ell({ ...H, tag: 'cheek', c: hl([0.038 * s, -0.026, -0.004]), r: hr([0.024, 0.027, 0.04]), k: 0.025 });
|
|
83
|
-
// cheek ruff: the white hair flares sideways and back below the ears (the fox's triangular face)
|
|
84
|
-
m.ell({ ...H, tag: 'cheekruff', c: hl([0.064 * s, -0.034, -0.035]), r: hr([0.036 * rf, 0.044, 0.05]), axis: norm([0.4 * s, -0.1, 1]), k: 0.03 });
|
|
85
|
-
m.ell({ ...H, tag: 'mastoid', c: hl([0.034 * s, -0.018, -0.064]), r: hr([0.024, 0.03, 0.03]), k: 0.03 });
|
|
86
|
-
m.ell({ ...H, tag: 'lip', c: hl([0.0145 * s, -0.0435, 0.083]), r: hr([0.0088, 0.0118, 0.058]), axis: norm([-0.17 * s, -0.06, 1]), k: 0.012 });
|
|
87
|
-
m.ell({ ...H, tag: 'whisker', c: hl([0.012 * s, -0.026, 0.125]), r: hr([0.0105, 0.011, 0.022]), k: 0.012 });
|
|
88
|
-
// jowl: the cheek's skin runs on down over the side of the lower jaw behind the mouth corner, flush
|
|
89
|
-
// with the jaw's lower line, and forward into the lip's back end (the commissure). Without it the
|
|
90
|
-
// cheek ended in a flat floor above the narrow jaw, and a dark pocket ran from the mouth corner back
|
|
91
|
-
// under the white cheek fur (a "hollow cheek" look)
|
|
92
|
-
m.ell({ ...H, tag: 'jowl', c: hl([0.021 * s, -0.0485, 0.006]), r: hr([0.0105, 0.0095, 0.036]), axis: norm([-0.2 * s, -0.06, 1]), k: 0.014 });
|
|
93
|
-
// buccal: the side of the face tapers from the cheek into the upper lip (the cheek's front met the
|
|
94
|
-
// narrow lip in a tight crease right behind the mouth corner: a shadowed pocket)
|
|
95
|
-
m.ell({ ...H, tag: 'buccal', c: hl([0.027 * s, -0.036, 0.035]), r: hr([0.011, 0.014, 0.036]), axis: norm([-0.35 * s, -0.05, 1]), k: 0.014 });
|
|
96
|
-
}
|
|
97
|
-
// long, slender muzzle with a straight nasal bridge
|
|
98
|
-
m.cone({ ...H, tag: 'nasal', a: hl([0, 0.027, 0.052]), b: hl([0, 0.004, 0.145]), ra: 0.0125 * hw, rb: 0.0078 * hw, k: 0.014 });
|
|
99
|
-
m.ell({ ...H, tag: 'muzzle', c: hl([0, -0.018, 0.088]), r: hr([0.02, 0.023, 0.064]), axis: norm([0, -0.12, 1]), k: 0.016 });
|
|
100
|
-
m.ell({ ...H, tag: 'nose', c: hl([0, -0.006, 0.152]), r: hr([0.0135, 0.0105, 0.01]), axis: norm([0, 0.4, 1]), k: 0.006 });
|
|
101
|
-
m.ell({ ...H, tag: 'philtrum', c: hl([0, -0.029, 0.147]), r: hr([0.008, 0.011, 0.008]), k: 0.007 });
|
|
102
|
-
for (const s of [1, -1]) {
|
|
103
|
-
const ef = eyeFrame(s);
|
|
104
|
-
const at = (u, v, w) => add(add(add(ef.c, mul(ef.x, u)), mul(ef.y, v)), mul(ef.z, w));
|
|
105
|
-
// orbit: a soft hollow so brow, cheek and bridge fall away to the lids
|
|
106
|
-
ellY({ ...H, tag: 'orbit', c: at(-0.0015 * s, -0.0004, 0.0142), ydir: ef.y, lateral: ef.x, r: [0.0135, 0.0094, 0.0068], k: 0.006, carve: true });
|
|
107
|
-
m.sphere({ ...H, tag: 'eyelid', c: ef.c, rad: EYE.r + EYE.lid, k: 0.004 });
|
|
108
|
-
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.0015, zMax: 0.018, k: 0.0016, carve: true });
|
|
109
|
-
m.sphere({ ...H, tag: 'nostril', c: hl([0.0072 * s, -0.009, 0.161]), rad: 0.0023, k: 0.0014, carve: true });
|
|
110
|
-
// upper canine, hidden behind the lip and inside the closed jaw; shows when the mouth opens
|
|
111
|
-
m.cone({ ...H, tag: 'canine', a: hl([0.0085 * s, -0.036, 0.118]), b: hl([0.008 * s, -0.047, 0.116]), ra: 0.0022, rb: 0.0007, k: 0.0014 });
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
// ---------------------------------------------------------------- JAW (separate surface so the mouth can open)
|
|
115
|
-
const JW = { bone: 'jaw', group: 'jaw', part: 'jaw' };
|
|
116
|
-
m.cone({ ...JW, tag: 'mandible', a: hl([0, -0.05, -0.015]), b: hl([0, -0.054, 0.108]), ra: 0.0078, rb: 0.0038, k: 0 });
|
|
117
|
-
for (const s of [1, -1]) {
|
|
118
|
-
m.cone({ ...JW, tag: 'mandible', a: hl([0.025 * s, -0.044, -0.03]), b: hl([0.004 * s, -0.052, 0.105]), ra: 0.0058, rb: 0.0033, k: 0.013 });
|
|
119
|
-
}
|
|
120
|
-
m.ell({ ...JW, tag: 'chin', c: hl([0, -0.055, 0.1]), r: hr([0.0085, 0.0068, 0.011]), k: 0.01 });
|
|
121
|
-
|
|
122
|
-
// ---------------------------------------------------------------- EARS
|
|
123
|
-
// big, erect, triangular: broad at the base, pointed tip, deeply cupped front; thin
|
|
124
|
-
const ek = params.ear || 1;
|
|
125
|
-
for (const S of ['L', 'R']) {
|
|
126
|
-
const s = S === 'L' ? 1 : -1;
|
|
127
|
-
const base = J['earBase' + S], tip = J['earTip' + S];
|
|
128
|
-
const up = norm(sub(tip, base));
|
|
129
|
-
const facing = norm([0.45 * s, 0.1, 1]);
|
|
130
|
-
const lat = norm(cross(up, facing));
|
|
131
|
-
const ear = { bone: 'ear' + S, group: 'ear' + S, thin: true };
|
|
132
|
-
const at = (t) => lerp(base, tip, t);
|
|
133
|
-
const w = ek * (1 + 0.1 * juv);
|
|
134
|
-
ellY({ ...ear, tag: 'ear', c: at(0.2), ydir: up, lateral: lat, r: [0.034 * w, 0.032 * ek, 0.0068], k: 0.009 });
|
|
135
|
-
ellY({ ...ear, tag: 'ear', c: at(0.52), ydir: up, lateral: lat, r: [0.023 * w, 0.03 * ek, 0.0048], k: 0.009 });
|
|
136
|
-
ellY({ ...ear, tag: 'ear', c: at(0.83), ydir: up, lateral: lat, r: [0.009 * w, 0.021 * ek, 0.0034], k: 0.007 });
|
|
137
|
-
ellY({ ...ear, tag: 'earinner', c: add(at(0.34), mul(facing, 0.0062)), ydir: up, lateral: lat, r: [0.023 * w, 0.031 * ek, 0.0045], k: 0.003, carve: true });
|
|
138
|
-
ellY({ ...ear, tag: 'earinner', c: add(at(0.66), mul(facing, 0.0045)), ydir: up, lateral: lat, r: [0.012 * w, 0.023 * ek, 0.0032], k: 0.0022, carve: true });
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// ---------------------------------------------------------------- LEGS
|
|
142
|
-
// long, thin legs; small neat paws; elbows tucked in under the narrow chest
|
|
143
|
-
const bk = params.boneK || 1;
|
|
144
|
-
for (const S of ['L', 'R']) {
|
|
145
|
-
const s = S === 'L' ? 1 : -1;
|
|
146
|
-
const lat = [s, 0, 0];
|
|
147
|
-
const sx = (v) => [v[0] * s, v[1], v[2]];
|
|
148
|
-
const g = 'F' + S;
|
|
149
|
-
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];
|
|
150
|
-
ellY({ tag: 'scapmuscle', bone: 'scapula' + S, group: g, c: add(lerp(Sc, Sh, 0.5), sx([0.004, 0, 0])), ydir: sub(Sh, Sc), lateral: lat, r: [0.014, 0.055, 0.032], k: 0.035, bias: 0.002 });
|
|
151
|
-
m.cone({ tag: 'upperarm', bone: 'humerus' + S, group: g, a: Sh, b: E, ra: 0.021, rb: 0.015, k: 0.035 });
|
|
152
|
-
ellY({ tag: 'triceps', bone: 'humerus' + S, group: g, c: add(lerp(Sh, E, 0.55), [0, 0, -0.016]), ydir: sub(E, Sh), lateral: lat, r: [0.016, 0.04, 0.019], k: 0.028 });
|
|
153
|
-
m.sphere({ tag: 'olecranon', bone: 'radius' + S, group: g, c: add(E, [0, 0.004, -0.012]), rad: 0.0095, k: 0.011 });
|
|
154
|
-
m.cone({ tag: 'forearm', bone: 'radius' + S, group: g, a: E, b: W, ra: 0.0155 * bk, rb: 0.0095 * bk, k: 0.014 });
|
|
155
|
-
ellY({ tag: 'forearmmuscle', bone: 'radius' + S, group: g, c: add(lerp(E, W, 0.25), sx([0.0015, 0, 0.002])), ydir: sub(W, E), lateral: lat, r: [0.0135, 0.036, 0.0155], k: 0.016 });
|
|
156
|
-
m.sphere({ tag: 'wrist', bone: 'metacarpus' + S, group: g, c: add(W, [0, 0, -0.0015]), rad: 0.0095 * bk, k: 0.007 });
|
|
157
|
-
m.sphere({ tag: 'carpalpad', bone: 'metacarpus' + S, group: g, c: add(W, [0, -0.004, -0.0095]), rad: 0.0045, k: 0.005 });
|
|
158
|
-
m.cone({ tag: 'pastern', bone: 'metacarpus' + S, group: g, a: W, b: M, ra: 0.0088 * bk, rb: 0.009 * bk, k: 0.007 });
|
|
159
|
-
m.sphere({ tag: 'dewclaw', bone: 'metacarpus' + S, group: g, c: add(lerp(W, M, 0.3), sx([-0.008, 0, 0.001])), rad: 0.003, k: 0.003 });
|
|
160
|
-
const dp = norm(sub(T, M));
|
|
161
|
-
const pk = params.pawK || 1;
|
|
162
|
-
// small oval forefoot (print ~5.5 x 4.5 cm)
|
|
163
|
-
ellY({ tag: 'paw', bone: 'fpaw' + S, group: g, c: add(add(M, mul(dp, 0.011)), [0, -0.003, 0]), ydir: dp, lateral: lat, r: [0.0145 * pk, 0.02 * pk, 0.0095], k: 0.008 });
|
|
164
|
-
m.sphere({ tag: 'pad', bone: 'fpaw' + S, group: g, c: add(M, [0, -0.0125, 0.006]), rad: 0.0065 * pk, k: 0.006 });
|
|
165
|
-
const toeX = [-0.0105, -0.0036, 0.0036, 0.0105].map((x) => x * pk), toeZ = [-0.0055, 0, 0, -0.0055].map((z) => z * pk);
|
|
166
|
-
for (let i = 0; i < 4; i++) m.sphere({ tag: 'toe', bone: 'fpaw' + S, group: g, c: [T[0] + toeX[i] * s, 0.0061 * pk, T[2] - 0.0045 + toeZ[i]], rad: 0.0058 * pk, k: 0.004 });
|
|
167
|
-
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.0055, T[2] + toeZ[i]], b: [T[0] + toeX[i] * s * 0.95, 0.002, T[2] + 0.0055 + toeZ[i]], ra: 0.0016, rb: 0.0006, k: 0.001 });
|
|
168
|
-
|
|
169
|
-
const h = 'H' + S;
|
|
170
|
-
const Hp = J['hip' + S], K = J['knee' + S], Hk = J['hock' + S], Mt = J['mtp' + S], Tt = J['htoe' + S];
|
|
171
|
-
// muscular thigh (the fox's hind legs are its jumping engine), long hair behind
|
|
172
|
-
ellY({ tag: 'thigh', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.4), sx([0.002, 0, -0.016])), ydir: sub(K, Hp), lateral: lat, r: [0.022, 0.078, 0.05], k: 0.03, bias: 0.002 });
|
|
173
|
-
m.cone({ tag: 'thighfront', bone: 'femur' + S, group: h, a: sx([0.021, 0.325, -0.1]), b: add(K, sx([-0.002, 0.029, 0.0])), ra: 0.02, rb: 0.0125, k: 0.035 });
|
|
174
|
-
m.cone({ tag: 'hamstring', bone: 'femur' + S, group: h, a: sx([0.024, 0.325, -0.212]), b: add(lerp(K, Hk, 0.28), [0, 0, -0.016]), ra: 0.024, rb: 0.0145, k: 0.024 });
|
|
175
|
-
ellY({ tag: 'breeches', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.62), sx([0.003, -0.005, -0.045])), ydir: sub(K, Hp), lateral: lat, r: [0.016, 0.043, 0.016], k: 0.02 });
|
|
176
|
-
ellY({ tag: 'flankfold', bone: 'femur' + S, group: h, c: sx([0.026, 0.26, -0.08]), ydir: [-0.03, 0.16, 0.1], lateral: lat, r: [0.0105, 0.043, 0.021], k: 0.035 });
|
|
177
|
-
m.sphere({ tag: 'stifle', bone: 'tibia' + S, group: h, c: add(K, sx([0.001, 0.004, 0.003])), rad: 0.009, k: 0.022 });
|
|
178
|
-
m.cone({ tag: 'shin', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.06), sx([0.0, 0.0, 0.002])), b: Hk, ra: 0.0122 * bk, rb: 0.0085 * bk, k: 0.017 });
|
|
179
|
-
ellY({ tag: 'calf', bone: 'tibia' + S, group: h, c: add(lerp(K, Hk, 0.3), sx([0.001, 0.005, -0.0145])), ydir: sub(Hk, K), lateral: lat, r: [0.0132, 0.038, 0.016], k: 0.019 });
|
|
180
|
-
m.cone({ tag: 'achilles', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.5), [0, 0.005, -0.018]), b: add(Hk, [0, 0.006, -0.0155]), ra: 0.0062, rb: 0.0058, k: 0.008 });
|
|
181
|
-
m.sphere({ tag: 'calcaneus', bone: 'metatarsus' + S, group: h, c: add(Hk, [0, 0.006, -0.013]), rad: 0.0078, k: 0.0065 });
|
|
182
|
-
m.sphere({ tag: 'hock', bone: 'metatarsus' + S, group: h, c: Hk, rad: 0.0102 * bk, k: 0.0065 });
|
|
183
|
-
m.cone({ tag: 'metatarsus', bone: 'metatarsus' + S, group: h, a: Hk, b: Mt, ra: 0.0088 * bk, rb: 0.0086 * bk, k: 0.0065 });
|
|
184
|
-
const dh = norm(sub(Tt, Mt));
|
|
185
|
-
ellY({ tag: 'paw', bone: 'hpaw' + S, group: h, c: add(add(Mt, mul(dh, 0.01)), [0, -0.003, 0]), ydir: dh, lateral: lat, r: [0.013 * pk, 0.0185 * pk, 0.009], k: 0.008 });
|
|
186
|
-
m.sphere({ tag: 'pad', bone: 'hpaw' + S, group: h, c: add(Mt, [0, -0.0125, 0.005]), rad: 0.006 * pk, k: 0.006 });
|
|
187
|
-
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.0058 * pk, Tt[2] - 0.0045 + toeZ[i]], rad: 0.0054 * pk, k: 0.004 });
|
|
188
|
-
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.005, Tt[2] + toeZ[i]], b: [Tt[0] + toeX[i] * 0.88 * s, 0.002, Tt[2] + 0.005 + toeZ[i]], ra: 0.0015, rb: 0.0006, k: 0.001 });
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// ---------------------------------------------------------------- TAIL
|
|
192
|
-
// the brush: a huge, round, cylindrical tail, thick almost to the end and rounded off at the white
|
|
193
|
-
// tip (the long guard hair is carried partly by this volume, partly by the shells)
|
|
194
|
-
const tb = params.tailBrush ?? 1;
|
|
195
|
-
const tailR = (t) => tb * (t < 0.15 ? 0.021 + (0.027 - 0.021) * (t / 0.15) : t < 0.55 ? 0.027 + (0.033 - 0.027) * ((t - 0.15) / 0.4) : 0.033 - 0.017 * Math.pow((t - 0.55) / 0.45, 1.8));
|
|
196
|
-
m.cone({ tag: 'tailroot', bone: 'tail0', a: [0, 0.342, -0.175], b: J.tail1, ra: 0.02, rb: tailR(0.1), k: 0.022 });
|
|
197
|
-
for (let i = 0; i < TAIL_SEGS; i++) {
|
|
198
|
-
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: 0.008, thin: i >= TAIL_SEGS - 1 });
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return m;
|
|
202
|
-
}
|