@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,266 +0,0 @@
|
|
|
1
|
-
// The domestic cat, sculpted as a signed distance field.
|
|
2
|
-
// Every primitive is attached to a bone (skinning) and a group (axial / limb / ear / jaw). Compared
|
|
3
|
-
// with the cheetah (the template): a much smaller animal with a big round head (short muzzle, puffy
|
|
4
|
-
// whisker pads, huge forward-facing eyes, tall triangular ears), a stocky rounded body with a low
|
|
5
|
-
// belly (the primordial pouch between the hind legs), thick short legs on round paws, and a long
|
|
6
|
-
// even tail. Longhaired individuals get a sculpted ruff, britches and a plumed tail under the coat.
|
|
7
|
-
import { HEAD_O, TAIL_SEGS, hl } from './rig.js';
|
|
8
|
-
import { add, sub, mul, lerp, norm, cross, dot, clamp } 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
|
-
// Globe ~20 mm (r 10.2 mm), cornea ~15 mm (iris radius 7.5 mm) filling the palpebral fissure
|
|
13
|
-
// (~14.8 x 11.5 mm: 0.4 x 0.31 of the inter-pupil distance in frontal photos; no sclera shows), eyes ~37 mm apart, facing almost straight ahead (yaw ~7 deg),
|
|
14
|
-
// the fissure tilted a little (inner corner lower).
|
|
15
|
-
// (the eyeball 1.5 mm further back than an earlier build's: its front 4.4 mm proud of the head surface without the lid prims,
|
|
16
|
-
// was 7.0) (the fissure 14.7 x 11.5 mm, as measured: 15.8 x 12.5 drew the eyes
|
|
17
|
-
// ~20 % wider than face1's and face2's at the same inter-pupil distance; the iris fills its width)
|
|
18
|
-
export const EYE_BASE = { c: [0.0185, 0.0, 0.011], r: 0.0105, back: 0.0027, yaw: 0.12, pitch: 0.02, lid: 0.001, R: 0.0076, d: 0.00185, off: -0.0003, tilt: (9 * Math.PI) / 180, irisZ: 0.0063, irisR: 0.0074 };
|
|
19
|
-
export const eyeOf = () => EYE_BASE;
|
|
20
|
-
|
|
21
|
-
const X = [1, 0, 0];
|
|
22
|
-
|
|
23
|
-
// ear frame (shared with the coat): base, tip, up (along the pinna), facing (its concave front), across
|
|
24
|
-
export function earFrame(J, S) {
|
|
25
|
-
const s = S === 'L' ? 1 : -1;
|
|
26
|
-
const base = J['earBase' + S], tip = J['earTip' + S];
|
|
27
|
-
const up = norm(sub(tip, base));
|
|
28
|
-
let f = norm([0.42 * s, 0.05, 1]);
|
|
29
|
-
f = norm(sub(f, mul(up, dot(f, up))));
|
|
30
|
-
const across = norm(cross(up, f)); // in the pinna plane, perpendicular to the ear's axis
|
|
31
|
-
return { base, tip, up, f, across, s, h: Math.hypot(...sub(tip, base)) };
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function sculptCat(m, rig, params = {}) {
|
|
35
|
-
const J = rig.J;
|
|
36
|
-
const EYE = eyeOf(params);
|
|
37
|
-
const lh = params.longhair ? 1 : 0;
|
|
38
|
-
const eyeFrame = (s) => eyeFrameOf(EYE, HEAD_O, s);
|
|
39
|
-
|
|
40
|
-
// Ellipsoid whose local Y follows `ydir`; radii = [lateral, along ydir, third axis]
|
|
41
|
-
const ellY = (o) => {
|
|
42
|
-
const y = norm(o.ydir);
|
|
43
|
-
const lat = o.lateral || X;
|
|
44
|
-
const z = norm(cross(lat, y));
|
|
45
|
-
return m.ell({ ...o, axis: z, up: y, r: [o.r[0], o.r[1], o.r[2]] });
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
// ---------------------------------------------------------------- TORSO
|
|
49
|
-
// a round, barrel-shaped trunk: chest ~10 cm wide and 11-12 cm deep (research: ~0.5 x the withers), its
|
|
50
|
-
// floor at the elbows, the back rising a little to the hips, the belly hanging a little lower behind the
|
|
51
|
-
// ribs (primordial pouch); (the chest floor 2 cm below the elbows read as a munchkin)
|
|
52
|
-
m.ell({ tag: 'ribcage', bone: 'spine3', c: [0, 0.169, 0.034], r: [0.05, 0.056, 0.074], axis: norm([0, 0.1, -1]), k: 0 });
|
|
53
|
-
m.ell({ tag: 'brisket', bone: 'chest', c: [0, 0.146, 0.082], r: [0.031, 0.035, 0.036], axis: norm([0, -0.35, 1]), k: 0.02 });
|
|
54
|
-
m.ell({ tag: 'pectoral', bone: 'chest', c: [0, 0.152, 0.104], r: [0.036, 0.032, 0.025], k: 0.017 });
|
|
55
|
-
m.ell({ tag: 'withers', bone: 'chest', c: [0, 0.212, 0.07], r: [0.022, 0.02, 0.045], axis: norm([0, -0.08, 1]), k: 0.02 });
|
|
56
|
-
m.ell({ tag: 'back', bone: 'spine3', c: [0, 0.213, -0.01], r: [0.03, 0.02, 0.058], k: 0.02 });
|
|
57
|
-
m.ell({ tag: 'abdomen', bone: 'spine2', c: [0, 0.163, -0.058], r: [0.049, 0.05, 0.07], axis: norm([0, 0.12, -1]), k: 0.022 });
|
|
58
|
-
m.ell({ tag: 'loin', bone: 'spine1', c: [0, 0.209, -0.085], r: [0.029, 0.02, 0.06], k: 0.017 });
|
|
59
|
-
m.ell({ tag: 'flank', bone: 'spine1', c: [0, 0.168, -0.11], r: [0.042, 0.04, 0.045], k: 0.017 });
|
|
60
|
-
m.ell({ tag: 'pouch', bone: 'spine1', c: [0, 0.126, -0.098], r: [0.027, 0.018, 0.042], axis: norm([0, 0.2, -1]), k: 0.022 });
|
|
61
|
-
m.ell({ tag: 'pelvis', bone: 'pelvis', c: [0, 0.184, -0.15], r: [0.041, 0.034, 0.045], k: 0.02 });
|
|
62
|
-
m.ell({ tag: 'croup', bone: 'pelvis', c: [0, 0.203, -0.146], r: [0.026, 0.017, 0.042], k: 0.014 });
|
|
63
|
-
for (const s of [1, -1]) {
|
|
64
|
-
m.ell({ tag: 'rump', bone: 'pelvis', c: [0.017 * s, 0.168, -0.182], r: [0.019, 0.029, 0.021], k: 0.014 });
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// ---------------------------------------------------------------- NECK (short, thick, furred)
|
|
68
|
-
m.cone({ tag: 'neck', bone: 'neck1', a: [0, 0.178, 0.096], b: [0, 0.208, 0.134], ra: 0.038, rb: 0.031, k: 0.02 });
|
|
69
|
-
m.cone({ tag: 'neck', bone: 'neck2', a: [0, 0.208, 0.134], b: hl([0, -0.008, -0.03]), ra: 0.031, rb: 0.027, k: 0.014 });
|
|
70
|
-
m.ell({ tag: 'nape', bone: 'neck1', c: [0, 0.226, 0.122], r: [0.022, 0.012, 0.04], axis: norm([0, 0.3, 1]), k: 0.014 });
|
|
71
|
-
m.ell({ tag: 'throat', bone: 'neck1', c: [0, 0.172, 0.142], r: [0.025, 0.026, 0.03], axis: norm([0, 0.8, 0.6]), k: 0.017 });
|
|
72
|
-
m.ell({ tag: 'throat', bone: 'neck2', c: hl([0, -0.031, -0.022]), r: [0.021, 0.013, 0.023], k: 0.01 });
|
|
73
|
-
if (lh) {
|
|
74
|
-
// longhair: the ruff (a collar of long hair round the neck and chest) and the frill under the chin
|
|
75
|
-
// (the fur makes most of the ruff, 3.8x the shorthair's: a smaller skin collar than an earlier, larger one, whose skin far from the
|
|
76
|
-
// neck axis stretched > 3x when the neck bent, longhair seeds 19 / 27 at 4.1 %)
|
|
77
|
-
m.ell({ tag: 'ruff', bone: 'neck1', c: [0, 0.172, 0.126], r: [0.037, 0.036, 0.035], axis: norm([0, 0.6, 1]), k: 0.02 });
|
|
78
|
-
m.ell({ tag: 'ruff', bone: 'neck2', c: hl([0, -0.03, -0.028]), r: [0.026, 0.017, 0.019], k: 0.014 });
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// ---------------------------------------------------------------- HEAD (head-local coords, see HEAD_O)
|
|
82
|
-
// landmarks from frontal / profile photos, in units of the inter-pupil distance (37 mm): face 2.45
|
|
83
|
-
// wide at the cheeks (with fur), eye level -> skull top 0.6, -> nose tip 0.55 down / 0.8 ahead,
|
|
84
|
-
// -> chin 0.9; ears set out on the corners of the skull, their outer base at eye level.
|
|
85
|
-
// Head-local: eyes (+-0.0185, 0, 0.011), nose tip (0,-0.02,0.043), whisker pads (+-0.009,-0.026,0.031),
|
|
86
|
-
// chin (0,-0.035,0.027), skull top 0.022, occiput -0.049, cheeks +-0.04 (toms: wider jowls, params.jowl)
|
|
87
|
-
const H = { bone: 'head' };
|
|
88
|
-
const jw = params.jowl || 1;
|
|
89
|
-
const HL = (v) => hl([v[0] / 1000, v[1] / 1000, v[2] / 1000]); // head-local millimetres
|
|
90
|
-
// (the cheek, malar, whisker pads, lips, jowls and muzzle are their own skin group on the head bone (rig.js appendage
|
|
91
|
-
// 'lips'): the occiput blend's ventral lever gave the lips and jowls 8-30 % neck2 weight while the lower jaw is rigid on
|
|
92
|
-
// the head, and a kitten's mouth corner opened into a dark slit when its head pitched against the neck)
|
|
93
|
-
const LIPS = { group: 'lips' };
|
|
94
|
-
const E3 = (tag, c, r, k, o = {}) => m.ell({ ...H, tag, c: HL(c), r: r.map((v) => v / 1000), k: k / 1000, ...o });
|
|
95
|
-
// The cat's face is flat and broad: the skull is a round dome rising ~28 mm above the eyes, the big eyes
|
|
96
|
-
// face forward from a wide face (skin ~72 mm across the zygomatic arches, ~95 mm with the cheek fur),
|
|
97
|
-
// the short nose bridge runs from the stop between the eyes (level with the corneas) to the nose leather
|
|
98
|
-
// ~18 mm ahead of the cornea, and the muzzle is two round whisker pads that merge into the cheeks; the
|
|
99
|
-
// chin is small and set back. The skin round each eye comes up to the lid margins on every side (brow,
|
|
100
|
-
// canthus, malar, nose bridge), so only the domed cornea shows between the lids.
|
|
101
|
-
// skull: the braincase and the flat forehead between and above the eyes
|
|
102
|
-
E3('cranium', [0, 7, -19], [25, 21.5, 29], 14);
|
|
103
|
-
E3('forehead', [0, 12, 3], [19, 12, 13.5], 10);
|
|
104
|
-
// the short nose bridge, from the stop between the eyes down and forward to the nose leather
|
|
105
|
-
m.cone({ ...H, tag: 'nasal', a: HL([0, -1, 12.5]), b: HL([0, -15.5, 27.5]), ra: 0.007, rb: 0.0055, k: 0.007 });
|
|
106
|
-
for (const s of [1, -1]) {
|
|
107
|
-
E3('temple', [14 * s, 7, -18], [17, 16, 24], 12);
|
|
108
|
-
// the brow over the upper lid (1.5 mm further forward and lower than first built, over the lid: the eye sits in the face, not
|
|
109
|
-
// on it), and its lateral end toward the ear
|
|
110
|
-
E3('brow', [17 * s, 10, 8.5], [11, 5.5, 7.5], 6);
|
|
111
|
-
E3('brow', [26 * s, 8, -2], [9, 7, 11], 8);
|
|
112
|
-
// the lateral canthus: skin beside the eye comes forward to the lid (no globe side showing; 2 mm further forward
|
|
113
|
-
// than first built: the lid shell stood alone at the outer corner, a beak with a groove behind it)
|
|
114
|
-
E3('canthus', [26.5 * s, 0.5, 4], [8, 9, 10], 8);
|
|
115
|
-
// zygomatic arch: behind and below the eye, the widest point of the skull
|
|
116
|
-
E3('zygomatic', [25 * s, -5, -4], [11.5, 8.5, 16], 10, { axis: norm([-0.35 * s, 0, 1]) });
|
|
117
|
-
// cheek: the masseter below the arch (toms: fat jowls, params.jowl)
|
|
118
|
-
// (the face is wider at the zygomatic arch instead: 2 mm wider here pushed its back end through the head / neck
|
|
119
|
-
// overlap at the side of the neck, open edges at the low tier)
|
|
120
|
-
E3('cheek', [21 * s * jw, -16, -12], [12.5 * jw, 12, 20], 12, LIPS);
|
|
121
|
-
// the flat face below the eye, from the lower lid down to the whisker pad (1 mm further forward raised the tuxedo's
|
|
122
|
-
// near-edge stretch at the white muzzle's edge in sleep by 1 %: it stays)
|
|
123
|
-
E3('malar', [16 * s, -13, 8.5], [11, 8, 8], 8, LIPS);
|
|
124
|
-
E3('mastoid', [19 * s, -12, -31], [12, 14, 14], 12);
|
|
125
|
-
// the whisker pads: two round cushions either side of the philtrum
|
|
126
|
-
E3('whisker', [8.5 * s, -22.5, 23.5], [9.5, 7, 7.5], 5, LIPS);
|
|
127
|
-
// the face below the eye runs down into the whisker pad and the lip without a crease: the malar and cheek bulge
|
|
128
|
-
// ended in a steep front edge over the flat side of the pad and lip (skin 7 mm deeper over 3 mm at y -18..-21),
|
|
129
|
-
// a sunken pocket below the eye toward the mouth corner
|
|
130
|
-
E3('mystacial', [13 * s, -22, 13], [8, 7, 9], 8, LIPS);
|
|
131
|
-
E3('lip', [11 * s, -28.5, 19], [6.5, 4, 10], 4, { axis: norm([-0.4 * s, -0.1, 1]), ...LIPS });
|
|
132
|
-
// the lower cheek over the jaw behind the mouth corner: the lower jaw's side stays under it (no
|
|
133
|
-
// pocket at the corner of the mouth)
|
|
134
|
-
E3('jowl', [14 * s, -26, -2], [9 * jw, 6.5, 14], 8, { axis: norm([-0.38 * s, -0.12, 1]), ...LIPS });
|
|
135
|
-
// the throat below the angle of the jaw is full (glands, loose skin): the jowl runs down into it without
|
|
136
|
-
// an undercut (the cheek's fur hung over a crease there and read as a pad with a dark rim)
|
|
137
|
-
// (a tom's fat jowls sit on a thick neck: the fill grows faster than the cheek)
|
|
138
|
-
const tj = jw - 1;
|
|
139
|
-
m.ell({ tag: 'throat', bone: 'neck2', c: HL([(19 + 20 * tj) * s, -30 - 6 * tj, -17]), r: [0.0095 + 0.014 * tj, 0.009 + 0.006 * tj, 0.015], k: 0.012 });
|
|
140
|
-
// (the side of the neck behind a jowled cheek: a cobby tom's jowl stood 6-8 mm proud of the head / neck junction behind
|
|
141
|
-
// it, a waist its hair could not fill, and the cheek read as a round disc with its own outline; the fill grows with the jowl)
|
|
142
|
-
const fk = clamp((jw - 1) / 0.19, 0, 1);
|
|
143
|
-
m.ell({ tag: 'jowlneck', bone: 'neck2', c: HL([(19 + 5 * fk) * s, -21, -38]), r: [0.009 + 0.0035 * fk, 0.014, 0.02], k: 0.014 });
|
|
144
|
-
}
|
|
145
|
-
// the muzzle mass behind the whisker pads, merging into the cheeks
|
|
146
|
-
E3('muzzle', [0, -19, 17], [15, 10.5, 12], 7, LIPS);
|
|
147
|
-
E3('nose', [0, -19, 32.5], [5.9, 4.3, 3.6], 3, { axis: norm([0, 0.2, 1]) });
|
|
148
|
-
E3('philtrum', [0, -23.5, 29.5], [3.5, 4, 3], 3);
|
|
149
|
-
for (const s of [1, -1]) {
|
|
150
|
-
// eyelids: a thin skin shell hugging the eyeball, cut open along an almond aperture 0.5 mm outside the
|
|
151
|
-
// shader's, so the dark lid margin the eye shader paints on its moving lids is the eyeliner: it descends
|
|
152
|
-
// with a blink and becomes the seam of a shut eye (a static line on the mesh rim ringed a shut eye like
|
|
153
|
-
// a coin)
|
|
154
|
-
const ef = eyeFrame(s);
|
|
155
|
-
const at = (u, v, w) => add(add(add(ef.c, mul(ef.x, u)), mul(ef.y, v)), mul(ef.z, w));
|
|
156
|
-
// the lids: a thin shell hugging the eyeball (0.7 mm over it, blended over 3.5 mm), with the brow and the canthus
|
|
157
|
-
// brought forward to meet it, so the skin runs from the face into the lid margin without a ridge. (A first
|
|
158
|
-
// shell, 12.3 x 11 x 11.5 mm blended over 8 mm, stood as a thick lip 2-2.5 mm over the eyeball at the corners,
|
|
159
|
-
// and an orbit hollow carved in front of the eye dropped the face away behind it: every eye sat in a raised ring,
|
|
160
|
-
// a round button standing out of the face)
|
|
161
|
-
ellY({ ...H, tag: 'eyelid', c: ef.c, ydir: ef.y, lateral: ef.x, r: [0.0112, 0.0112, 0.0112], k: 0.0035 });
|
|
162
|
-
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 + 0.0005, d: EYE.d, zMin: -0.0016, zMax: 0.02, k: 0.0009, carve: true });
|
|
163
|
-
m.sphere({ ...H, tag: 'nostril', c: HL([2.7 * s, -20.3, 35.3]), rad: 0.0012, k: 0.0008, carve: true });
|
|
164
|
-
// third eyelid (nictitating membrane): a narrow, pigmented sliver deep in the inner corner of the eye
|
|
165
|
-
// (the frame's x points to world +X for both eyes: the medial corner is at -x for the left eye)
|
|
166
|
-
const inner = at(-0.0076 * s, -0.0012, 0.0058);
|
|
167
|
-
m.ell({ ...H, tag: 'nictitans', c: inner, axis: ef.z, up: ef.y, r: [0.0012, 0.0026, 0.0017], k: 0.0005 });
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
// ---------------------------------------------------------------- JAW (separate surface so the mouth can open)
|
|
171
|
-
// a narrow V of two rami meeting at a small chin tucked under the upper lip; the floor between them
|
|
172
|
-
// (the underside of the jaw) runs back into the throat
|
|
173
|
-
const JW = { bone: 'jaw', group: 'jaw', part: 'jaw' };
|
|
174
|
-
// (the chin tucked 2-3 mm behind the upper lip and no lower than the lip line: a small rounded chin under
|
|
175
|
-
// the mouth, not a lump standing out below the muzzle)
|
|
176
|
-
// (a slim jaw: its underside only ~2 mm below the head's, so it meets the throat without a shelf)
|
|
177
|
-
m.cone({ ...JW, tag: 'mandible', a: HL([0, -27, -8]), b: HL([0, -29.6, 17.5]), ra: 0.0047, rb: 0.0036, k: 0 });
|
|
178
|
-
for (const s of [1, -1]) {
|
|
179
|
-
m.cone({ ...JW, tag: 'mandible', a: HL([12.5 * s, -23.5, -12]), b: HL([4.5 * s, -29, 18]), ra: 0.004, rb: 0.003, k: 0.005 });
|
|
180
|
-
}
|
|
181
|
-
m.ell({ ...JW, tag: 'chin', c: HL([0, -29.9, 19]), r: [0.0046, 0.0031, 0.0042], k: 0.005 });
|
|
182
|
-
// the floor between the rami, as wide as the head's underside behind the chin: the slim keel alone stood as an island
|
|
183
|
-
// in a channel between the lip lobes, seen from below
|
|
184
|
-
m.ell({ ...JW, tag: 'jawfloor', c: HL([0, -29.6, 7]), r: [0.0145, 0.0037, 0.0135], k: 0.004 });
|
|
185
|
-
|
|
186
|
-
// ---------------------------------------------------------------- EARS
|
|
187
|
-
// tall triangular pinnae (~5 cm), thin, cupped forward; the base rounds into the skull
|
|
188
|
-
for (const S of ['L', 'R']) {
|
|
189
|
-
const E = earFrame(J, S);
|
|
190
|
-
const ear = { bone: 'ear' + S, group: 'ear' + S };
|
|
191
|
-
const hk = E.h;
|
|
192
|
-
const w = 0.022 * (params.ear || 1);
|
|
193
|
-
// outline in the pinna plane (u across: + toward the outer edge; v up the ear), the tip gently rounded
|
|
194
|
-
const outer = dot(E.across, [E.s, 0, 0]) >= 0 ? 1 : -1;
|
|
195
|
-
const poly = [[-w * 0.92, -0.004], [w, -0.004], [w * 0.55, hk * 0.5], [w * 0.16, hk * 0.93], [0, hk * 1.02], [-w * 0.14, hk * 0.93], [-w * 0.5, hk * 0.5]].map(([u, v]) => [u * outer, v]);
|
|
196
|
-
m.fin({ ...ear, tag: 'ear', o: add(E.base, mul(E.f, -0.0006)), u: E.across, v: E.up, poly, t: 0.0034, round: 0.0014, k: 0.004, thin: true });
|
|
197
|
-
// rounded back of the pinna base and the cup of the concha
|
|
198
|
-
const eh = hk / 0.0352; // (the cup and the rounded back were fitted to a 35 mm pinna)
|
|
199
|
-
m.ell({ ...ear, tag: 'earback', c: add(add(E.base, mul(E.up, 0.009 * eh)), mul(E.f, -0.0035)), axis: E.f, up: E.up, r: [0.0165, 0.013 * eh, 0.0045], k: 0.005, thin: true });
|
|
200
|
-
// (the cup starts at the pinna's base: reaching below it, it dug a round crater into the side of the skull
|
|
201
|
-
// in front of the ear)
|
|
202
|
-
m.ell({ ...ear, tag: 'earinner', c: add(add(E.base, mul(E.up, 0.53 * hk)), mul(E.f, 0.0107)), axis: E.f, up: E.up, r: [0.0165, 0.5 * hk, 0.0105], k: 0.0015, carve: true });
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
// ---------------------------------------------------------------- LEGS
|
|
206
|
-
const toeX = [-0.0105, -0.0036, 0.0036, 0.0105], toeZ = [-0.0038, 0, 0, -0.0038];
|
|
207
|
-
const lt = params.limb || 1; // lower-leg thickness (the cobby blue's thick legs)
|
|
208
|
-
for (const S of ['L', 'R']) {
|
|
209
|
-
const s = S === 'L' ? 1 : -1;
|
|
210
|
-
const lat = [s, 0, 0];
|
|
211
|
-
const sx = (v) => [v[0] * s, v[1], v[2]];
|
|
212
|
-
// front
|
|
213
|
-
const g = 'F' + S;
|
|
214
|
-
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];
|
|
215
|
-
ellY({ tag: 'scapmuscle', bone: 'scapula' + S, group: g, c: add(lerp(Sc, Sh, 0.5), sx([0.003, 0, 0])), ydir: sub(Sh, Sc), lateral: lat, r: [0.0095, 0.036, 0.022], k: 0.02, bias: 0.0013 });
|
|
216
|
-
m.cone({ tag: 'upperarm', bone: 'humerus' + S, group: g, a: Sh, b: E, ra: 0.0175, rb: 0.0132, k: 0.02 });
|
|
217
|
-
ellY({ tag: 'triceps', bone: 'humerus' + S, group: g, c: add(lerp(Sh, E, 0.55), [0, 0, -0.01]), ydir: sub(E, Sh), lateral: lat, r: [0.0142, 0.029, 0.0165], k: 0.017 });
|
|
218
|
-
m.sphere({ tag: 'olecranon', bone: 'radius' + S, group: g, c: add(E, [0, 0.003, -0.009]), rad: 0.0072, k: 0.007 });
|
|
219
|
-
m.cone({ tag: 'forearm', bone: 'radius' + S, group: g, a: E, b: W, ra: 0.0126 * lt, rb: 0.0081 * lt, k: 0.009 });
|
|
220
|
-
ellY({ tag: 'forearmmuscle', bone: 'radius' + S, group: g, c: add(lerp(E, W, 0.27), sx([0.0015, 0, 0.0015])), ydir: sub(W, E), lateral: lat, r: [0.0124 * lt, 0.026, 0.0134 * lt], k: 0.01 });
|
|
221
|
-
m.sphere({ tag: 'wrist', bone: 'metacarpus' + S, group: g, c: add(W, [0, 0, -0.0012]), rad: 0.0082 * lt, k: 0.004 });
|
|
222
|
-
m.sphere({ tag: 'carpalpad', bone: 'metacarpus' + S, group: g, c: add(W, [0, -0.0035, -0.0068]), rad: 0.0033, k: 0.003 });
|
|
223
|
-
m.cone({ tag: 'pastern', bone: 'metacarpus' + S, group: g, a: W, b: M, ra: 0.0079 * lt, rb: 0.0078 * lt, k: 0.004 });
|
|
224
|
-
m.sphere({ tag: 'dewclaw', bone: 'metacarpus' + S, group: g, c: add(lerp(W, M, 0.3), sx([-0.0068, 0, 0.0015])), rad: 0.0026, k: 0.002 });
|
|
225
|
-
const dp = norm(sub(T, M));
|
|
226
|
-
ellY({ tag: 'paw', bone: 'fpaw' + S, group: g, c: add(add(M, mul(dp, 0.0075)), [0, -0.0015, 0]), ydir: dp, lateral: lat, r: [0.0128, 0.0138, 0.0072], k: 0.005 });
|
|
227
|
-
m.sphere({ tag: 'pad', bone: 'fpaw' + S, group: g, c: add(M, [0, -0.0068, 0.0028]), rad: 0.0054, k: 0.003 });
|
|
228
|
-
for (let i = 0; i < 4; i++) m.sphere({ tag: 'toe', bone: 'fpaw' + S, group: g, c: [T[0] + toeX[i] * s, 0.0054, T[2] - 0.0042 + toeZ[i]], rad: 0.0051, k: 0.0025 });
|
|
229
|
-
|
|
230
|
-
// hind
|
|
231
|
-
const h = 'H' + S;
|
|
232
|
-
const Hp = J['hip' + S], K = J['knee' + S], Hk = J['hock' + S], Mt = J['mtp' + S], Tt = J['htoe' + S];
|
|
233
|
-
// meaty thighs: a broad teardrop rising into the flank and croup; the flank fold webs the stifle
|
|
234
|
-
// to the low belly
|
|
235
|
-
ellY({ tag: 'thigh', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.34), sx([0.002, 0, -0.012])), ydir: sub(K, Hp), lateral: lat, r: [0.0185, 0.047, 0.037], k: 0.017, bias: 0.0013 });
|
|
236
|
-
m.cone({ tag: 'thighfront', bone: 'femur' + S, group: h, a: sx([0.016, 0.186, -0.098]), b: add(K, sx([-0.0012, 0.018, 0.0])), ra: 0.0138, rb: 0.009, k: 0.02 });
|
|
237
|
-
m.cone({ tag: 'hamstring', bone: 'femur' + S, group: h, a: sx([0.017, 0.188, -0.186]), b: add(lerp(K, Hk, 0.1), [0, 0.006, -0.011]), ra: 0.0158, rb: 0.0095, k: 0.013 }); // (ends at the stifle: femur skin below the knee tore when it bent)
|
|
238
|
-
ellY({ tag: 'flankfold', bone: 'femur' + S, group: h, c: sx([0.019, 0.14, -0.085]), ydir: [-0.03, 0.16, 0.1], lateral: lat, r: [0.0075, 0.028, 0.0135], k: 0.02 });
|
|
239
|
-
m.sphere({ tag: 'stifle', bone: 'tibia' + S, group: h, c: add(K, sx([0.0007, 0.0027, 0.002])), rad: 0.0068, k: 0.013 });
|
|
240
|
-
m.cone({ tag: 'shin', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.06), sx([0.0, 0.0, 0.0013])), b: Hk, ra: 0.0095 * lt, rb: 0.0068 * lt, k: 0.01 });
|
|
241
|
-
ellY({ tag: 'calf', bone: 'tibia' + S, group: h, c: add(lerp(K, Hk, 0.3), sx([0.0007, 0.0035, -0.009])), ydir: sub(Hk, K), lateral: lat, r: [0.0102 * lt, 0.024, 0.0115 * lt], k: 0.012 });
|
|
242
|
-
m.cone({ tag: 'achilles', bone: 'tibia' + S, group: h, a: add(lerp(K, Hk, 0.5), [0, 0.0033, -0.0115]), b: add(Hk, [0, 0.004, -0.0095]), ra: 0.0042, rb: 0.0038, k: 0.005 });
|
|
243
|
-
m.sphere({ tag: 'calcaneus', bone: 'metatarsus' + S, group: h, c: add(Hk, [0, 0.004, -0.0085]), rad: 0.0052, k: 0.004 });
|
|
244
|
-
m.sphere({ tag: 'hock', bone: 'metatarsus' + S, group: h, c: Hk, rad: 0.0072 * lt, k: 0.004 });
|
|
245
|
-
m.cone({ tag: 'metatarsus', bone: 'metatarsus' + S, group: h, a: Hk, b: Mt, ra: 0.0071 * lt, rb: 0.007 * lt, k: 0.004 });
|
|
246
|
-
const dh = norm(sub(Tt, Mt));
|
|
247
|
-
ellY({ tag: 'paw', bone: 'hpaw' + S, group: h, c: add(add(Mt, mul(dh, 0.007)), [0, -0.0015, 0]), ydir: dh, lateral: lat, r: [0.012, 0.0132, 0.007], k: 0.005 });
|
|
248
|
-
m.sphere({ tag: 'pad', bone: 'hpaw' + S, group: h, c: add(Mt, [0, -0.0068, 0.0026]), rad: 0.0051, k: 0.003 });
|
|
249
|
-
for (let i = 0; i < 4; i++) m.sphere({ tag: 'toe', bone: 'hpaw' + S, group: h, c: [Tt[0] + toeX[i] * 0.94 * s, 0.0052, Tt[2] - 0.004 + toeZ[i]], rad: 0.0049, k: 0.0025 });
|
|
250
|
-
if (lh) {
|
|
251
|
-
// longhair britches: long hair on the back of the thighs
|
|
252
|
-
ellY({ tag: 'britches', bone: 'femur' + S, group: h, c: add(lerp(Hp, K, 0.55), sx([0.004, -0.004, -0.027])), ydir: sub(K, Hp), lateral: lat, r: [0.012, 0.03, 0.014], k: 0.014 }); // (smaller than first built: the fur makes the britches; the skin behind the thigh stretched > 3x)
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// ---------------------------------------------------------------- TAIL
|
|
257
|
-
// an even, cylindrical tail ~1 cm thick under the coat, tapering only near the tip
|
|
258
|
-
const tb = lh ? 1.25 : 1;
|
|
259
|
-
const tailR = (t) => tb * (t < 0.15 ? 0.0122 - 0.012 * t : t < 0.85 ? 0.0104 - 0.0024 * ((t - 0.15) / 0.7) : 0.008 - 0.014 * (t - 0.85));
|
|
260
|
-
m.cone({ tag: 'tailroot', bone: 'tail0', a: [0, 0.19, -0.158], b: J.tail1, ra: 0.016, rb: tailR(0.08), k: 0.013 });
|
|
261
|
-
for (let i = 0; i < TAIL_SEGS; i++) {
|
|
262
|
-
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, thin: i >= TAIL_SEGS - 3 });
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return m;
|
|
266
|
-
}
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
// Whiskers: the mystacial vibrissae as real geometry (species.surfaces, appended to the base mesh).
|
|
2
|
-
//
|
|
3
|
-
// 12 per side in 4 rows on the whisker pad, 45-75 mm long (the longest about the width of the body),
|
|
4
|
-
// fanning out sideways and a little forward and down, each a tapered keratin strand (0.17 mm at the
|
|
5
|
-
// root, 0.03 mm at the tip) curving gently down and forward. They ride on their own bone per side
|
|
6
|
-
// (whiskerL / whiskerR, children of the head), so the behaviour hook can fan them forward (hunting,
|
|
7
|
-
// curious) or sweep them back (eating, angry, asleep) and lift them clear of the ground. White in most
|
|
8
|
-
// coats, dark in black cats. Not built for the crowd tier.
|
|
9
|
-
import { hl } from './rig.js';
|
|
10
|
-
import { projectToSurface, MAT, srgb } from '../../core/build/coatKit.js';
|
|
11
|
-
import { norm, add, mul, cross, sub } from '../../core/math/vec.js';
|
|
12
|
-
|
|
13
|
-
export const WHISKER_BASE = [0.0105, -0.0265, 0.0325]; // head-local joint at the middle of the pad (left)
|
|
14
|
-
export const WHISKER_TIP = [0.06, -0.034, 0.046];
|
|
15
|
-
|
|
16
|
-
// rows (top -> bottom) x columns (back -> front) on the pad, head-local (left side)
|
|
17
|
-
function follicles() {
|
|
18
|
-
const out = [];
|
|
19
|
-
const rows = [
|
|
20
|
-
{ y: -0.0215, len: 0.074, down: 0.05 },
|
|
21
|
-
{ y: -0.0245, len: 0.068, down: 0.12 },
|
|
22
|
-
{ y: -0.0275, len: 0.06, down: 0.2 },
|
|
23
|
-
{ y: -0.0305, len: 0.048, down: 0.28 },
|
|
24
|
-
];
|
|
25
|
-
rows.forEach((r, i) => {
|
|
26
|
-
for (let j = 0; j < 3; j++) {
|
|
27
|
-
const z = 0.0265 + j * 0.0042 + i * 0.0006;
|
|
28
|
-
out.push({ p: [0.0125 - j * 0.0012 + i * 0.0006, r.y, z], len: r.len * (0.92 + 0.06 * j), down: r.down, fwd: -0.05 + 0.13 * j, row: i, col: j });
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
return out;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// head-local sample points of the left fan (middles and tips of every whisker, and the bone's tip joint)
|
|
35
|
-
// for the ground clearance in the behaviour hook
|
|
36
|
-
export function whiskerSamples() {
|
|
37
|
-
const out = [WHISKER_TIP];
|
|
38
|
-
for (const f of follicles()) {
|
|
39
|
-
const d0 = norm([0.86, -f.down * 0.6, 0.42 + f.fwd]);
|
|
40
|
-
const bow = norm([0.1, -0.55, 0.35]);
|
|
41
|
-
for (const t of [0.5, 1]) out.push(add(add(f.p, mul(d0, f.len * t)), mul(bow, f.len * 0.16 * t * t)));
|
|
42
|
-
}
|
|
43
|
-
return out;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export function catWhiskers({ rig, params, Q, model }) {
|
|
47
|
-
if (!Q || Q.shells <= 0) return null;
|
|
48
|
-
const headPrims = model.prims.filter((p) => p.bone === 'head' && !p.carve && p.part === 'body' && p.tag !== 'nictitans');
|
|
49
|
-
const dark = params.variant === 'black';
|
|
50
|
-
const col = dark ? srgb(0x242020) : srgb(0xe8e4dc);
|
|
51
|
-
const SEG = Q.res <= 1.35 ? 7 : 4, SIDES = 3;
|
|
52
|
-
const pos = [], nrm = [], idx = [], comb = [], skinIndex = [];
|
|
53
|
-
const F = follicles();
|
|
54
|
-
for (const S of ['L', 'R']) {
|
|
55
|
-
const s = S === 'L' ? 1 : -1;
|
|
56
|
-
const bi = rig.BONE['whisker' + S].index;
|
|
57
|
-
for (const f of F) {
|
|
58
|
-
const root = projectToSurface(headPrims, hl([f.p[0] * s, f.p[1], f.p[2]]));
|
|
59
|
-
// direction: out to the side, a little forward and down; the strand bows down and forward
|
|
60
|
-
const d0 = norm([0.86 * s, -f.down * 0.6, 0.42 + f.fwd]);
|
|
61
|
-
const bow = norm([0.1 * s, -0.55, 0.35]);
|
|
62
|
-
const L = f.len * (params.whisker || 1);
|
|
63
|
-
const pts = [], tans = [];
|
|
64
|
-
for (let k = 0; k <= SEG; k++) {
|
|
65
|
-
const t = k / SEG;
|
|
66
|
-
pts.push(add(add(root, mul(d0, L * t)), mul(bow, L * 0.16 * t * t)));
|
|
67
|
-
tans.push(norm(add(d0, mul(bow, 0.32 * t))));
|
|
68
|
-
}
|
|
69
|
-
const v0 = pos.length / 3;
|
|
70
|
-
for (let k = 0; k <= SEG; k++) {
|
|
71
|
-
const t = k / SEG, T = tans[k];
|
|
72
|
-
const r = 0.00017 * (1 - t) + 0.00003 * t;
|
|
73
|
-
let a = cross(T, [0, 1, 0]);
|
|
74
|
-
if (Math.hypot(...a) < 1e-4) a = cross(T, [1, 0, 0]);
|
|
75
|
-
a = norm(a);
|
|
76
|
-
const b = cross(T, a);
|
|
77
|
-
for (let q = 0; q < SIDES; q++) {
|
|
78
|
-
const ang = (q / SIDES) * Math.PI * 2;
|
|
79
|
-
const n = add(mul(a, Math.cos(ang)), mul(b, Math.sin(ang)));
|
|
80
|
-
pos.push(...add(pts[k], mul(n, r)));
|
|
81
|
-
nrm.push(...n);
|
|
82
|
-
comb.push(...T);
|
|
83
|
-
skinIndex.push(bi, 0, 0, 0);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (let k = 0; k < SEG; k++) {
|
|
87
|
-
for (let q = 0; q < SIDES; q++) {
|
|
88
|
-
const a = v0 + k * SIDES + q, b = v0 + k * SIDES + ((q + 1) % SIDES);
|
|
89
|
-
const c = a + SIDES, d = b + SIDES;
|
|
90
|
-
idx.push(a, b, c, b, d, c);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
const nV = pos.length / 3;
|
|
96
|
-
const tint = new Float32Array(nV * 4), surf = new Float32Array(nV * 4), patternColor = new Float32Array(nV * 4);
|
|
97
|
-
for (let v = 0; v < nV; v++) {
|
|
98
|
-
tint.set([col[0], col[1], col[2], MAT.KERATIN], v * 4);
|
|
99
|
-
surf.set([0.75, 0, 0, 0], v * 4);
|
|
100
|
-
}
|
|
101
|
-
const skinWeight = new Float32Array(nV * 4);
|
|
102
|
-
for (let v = 0; v < nV; v++) skinWeight[v * 4] = 1;
|
|
103
|
-
return {
|
|
104
|
-
nV, pos: new Float32Array(pos), nrm: new Float32Array(nrm), index: new Uint32Array(idx),
|
|
105
|
-
skinIndex: new Uint16Array(skinIndex), skinWeight, comb: new Float32Array(comb), tint,
|
|
106
|
-
pattern: new Float32Array(nV).fill(1), mark: new Float32Array(nV).fill(1), furLen: new Float32Array(nV),
|
|
107
|
-
patternColor, surf,
|
|
108
|
-
};
|
|
109
|
-
}
|
|
110
|
-
void sub;
|