@bitefoundry/retrieviewer 0.0.0-stage → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ASSET-PROVENANCE.md +43 -0
- package/ASSETS-LICENSE.md +58 -0
- package/ATTRIBUTION.md +54 -0
- package/EMBEDDING.md +96 -0
- package/INSTALLING.md +107 -0
- package/LICENSE +16 -0
- package/LICENSE-CODE +21 -0
- package/PLUGIN.md +110 -0
- package/PUPPY-MEMORY.md +57 -0
- package/PUPPY-Q5-COMPARISON.md +73 -0
- package/README.md +61 -2
- package/RELEASING.md +61 -0
- package/THIRD-PARTY-NOTICES.md +17 -0
- package/TRADEMARKS.md +21 -0
- package/braille.mjs +45 -0
- package/examples/bridge.py +62 -0
- package/examples/embed.mjs +15 -0
- package/examples/live.mjs +40 -0
- package/examples/plugin.mjs +21 -0
- package/integrations/opencode/runtime.mjs +195 -0
- package/integrations/opencode/tui.tsx +59 -0
- package/locomotion-core.mjs +21 -0
- package/locomotion-puppy.animal +0 -0
- package/package.json +125 -4
- package/pet-q5-manifest.json +118 -0
- package/puppy-clean.mjs +51 -0
- package/puppy-companion-interactions-v3-q5.bin.gz +0 -0
- package/puppy-companion-interactions-v3.json +1 -0
- package/puppy-companion-life.mjs +182 -0
- package/puppy-companion-objects.mjs +30 -0
- package/puppy-companion-sprites.mjs +14 -0
- package/puppy-continuous.mjs +57 -0
- package/puppy-face.mjs +46 -0
- package/puppy-frame-predictive.mjs +147 -0
- package/puppy-frame-store.mjs +108 -0
- package/puppy-mouth-anchor.json +1 -0
- package/puppy-mouth-anchor.mjs +33 -0
- package/puppy-paper-actions-v9-q5.bin.gz +0 -0
- package/puppy-paper-actions-v9.json +1 -0
- package/puppy-paper-actions.mjs +48 -0
- package/puppy-paper-approach-q5.bin.gz +0 -0
- package/puppy-paper-approach.json +1 -0
- package/puppy-paper-area.mjs +15 -0
- package/puppy-paper-arrival-seat-q5.bin.gz +0 -0
- package/puppy-paper-arrival-seat.json +1 -0
- package/puppy-paper-behaviors-q5.bin.gz +0 -0
- package/puppy-paper-behaviors.json +1 -0
- package/puppy-paper-behaviors.mjs +8 -0
- package/puppy-paper-contact.mjs +103 -0
- package/puppy-paper-director.mjs +21 -0
- package/puppy-paper-paw-transport.mjs +76 -0
- package/puppy-paper-rear-gallop-q5.bin.gz +0 -0
- package/puppy-paper-rear-gallop.json +1 -0
- package/puppy-paper-seat-q5.bin.gz +0 -0
- package/puppy-paper-seat.json +14 -0
- package/puppy-paper-seat.mjs +13 -0
- package/puppy-paper-trick-timing.mjs +58 -0
- package/puppy-paper-world.mjs +108 -0
- package/puppy-paper.mjs +271 -0
- package/puppy-stable-meta.json +1606 -0
- package/puppy-stable.mjs +72 -0
- package/puppy-stride-meta.json +343 -0
- package/puppy-stride-tweens-q5.bin.gz +0 -0
- package/puppy-zoomies.mjs +27 -0
- package/puppy-zoomies30.mjs +12 -0
- package/retrieviewer-cli.mjs +81 -0
- package/retrieviewer-config.mjs +49 -0
- package/retrieviewer-install.mjs +157 -0
- package/retrieviewer-plugin.d.mts +44 -0
- package/retrieviewer-plugin.mjs +97 -0
- package/retrieviewer-stdio.mjs +38 -0
- package/retrieviewer.d.mts +85 -0
- package/retrieviewer.mjs +142 -0
- package/vendor/procedural-animals/LICENSE +21 -0
- package/vendor/procedural-animals/package.json +40 -0
- package/vendor/procedural-animals/src/animal.js +146 -0
- package/vendor/procedural-animals/src/bake.js +51 -0
- package/vendor/procedural-animals/src/build.js +81 -0
- package/vendor/procedural-animals/src/core/build/coatKit.js +121 -0
- package/vendor/procedural-animals/src/core/build/featherCards.js +189 -0
- package/vendor/procedural-animals/src/core/build/finEdges.js +85 -0
- package/vendor/procedural-animals/src/core/build/furSlope.js +115 -0
- package/vendor/procedural-animals/src/core/build/mesh.js +67 -0
- package/vendor/procedural-animals/src/core/build/pipeline.js +272 -0
- package/vendor/procedural-animals/src/core/build/seams.js +183 -0
- package/vendor/procedural-animals/src/core/build/warp.js +112 -0
- package/vendor/procedural-animals/src/core/build/weights.js +393 -0
- package/vendor/procedural-animals/src/core/math/vec.js +81 -0
- package/vendor/procedural-animals/src/core/motion/actions.js +800 -0
- package/vendor/procedural-animals/src/core/motion/bird.js +3063 -0
- package/vendor/procedural-animals/src/core/motion/birdActions.js +1059 -0
- package/vendor/procedural-animals/src/core/motion/common.js +158 -0
- package/vendor/procedural-animals/src/core/motion/index.js +22 -0
- package/vendor/procedural-animals/src/core/motion/quadruped.js +2875 -0
- package/vendor/procedural-animals/src/core/motion/snake.js +1594 -0
- package/vendor/procedural-animals/src/core/motion/spider.js +1810 -0
- package/vendor/procedural-animals/src/core/motion/swimmer.js +1047 -0
- package/vendor/procedural-animals/src/core/motion/swimmerActions.js +613 -0
- package/vendor/procedural-animals/src/core/render/animalObject.js +262 -0
- package/vendor/procedural-animals/src/core/render/coatMaterial.js +1301 -0
- package/vendor/procedural-animals/src/core/render/dqs.js +159 -0
- package/vendor/procedural-animals/src/core/render/eyes.js +676 -0
- package/vendor/procedural-animals/src/core/render/membranes.js +77 -0
- package/vendor/procedural-animals/src/core/render/skeleton.js +41 -0
- package/vendor/procedural-animals/src/core/rig/bird.js +327 -0
- package/vendor/procedural-animals/src/core/rig/quadruped.js +76 -0
- package/vendor/procedural-animals/src/core/rig/rig.js +79 -0
- package/vendor/procedural-animals/src/core/rig/snake.js +76 -0
- package/vendor/procedural-animals/src/core/rig/spider.js +110 -0
- package/vendor/procedural-animals/src/core/rig/swimmer.js +181 -0
- package/vendor/procedural-animals/src/core/sdf/eyeSocket.js +53 -0
- package/vendor/procedural-animals/src/core/sdf/mesher.js +238 -0
- package/vendor/procedural-animals/src/core/sdf/sdf.js +263 -0
- package/vendor/procedural-animals/src/index.d.ts +98 -0
- package/vendor/procedural-animals/src/index.js +29 -0
- package/vendor/procedural-animals/src/registry.js +48 -0
- package/vendor/procedural-animals/src/species/bear/behaviour.js +463 -0
- package/vendor/procedural-animals/src/species/bear/claws.js +147 -0
- package/vendor/procedural-animals/src/species/bear/coat.js +726 -0
- package/vendor/procedural-animals/src/species/bear/index.js +139 -0
- package/vendor/procedural-animals/src/species/bear/motion.js +112 -0
- package/vendor/procedural-animals/src/species/bear/regions.js +78 -0
- package/vendor/procedural-animals/src/species/bear/rig.js +112 -0
- package/vendor/procedural-animals/src/species/bear/sculpt.js +272 -0
- package/vendor/procedural-animals/src/species/boar/behaviour.js +335 -0
- package/vendor/procedural-animals/src/species/boar/coat.js +372 -0
- package/vendor/procedural-animals/src/species/boar/index.js +110 -0
- package/vendor/procedural-animals/src/species/boar/motion.js +85 -0
- package/vendor/procedural-animals/src/species/boar/regions.js +88 -0
- package/vendor/procedural-animals/src/species/boar/rig.js +111 -0
- package/vendor/procedural-animals/src/species/boar/sculpt.js +285 -0
- package/vendor/procedural-animals/src/species/cat/behaviour.js +559 -0
- package/vendor/procedural-animals/src/species/cat/coat.js +841 -0
- package/vendor/procedural-animals/src/species/cat/index.js +211 -0
- package/vendor/procedural-animals/src/species/cat/motion.js +101 -0
- package/vendor/procedural-animals/src/species/cat/regions.js +82 -0
- package/vendor/procedural-animals/src/species/cat/rig.js +100 -0
- package/vendor/procedural-animals/src/species/cat/sculpt.js +266 -0
- package/vendor/procedural-animals/src/species/cat/whiskers.js +110 -0
- package/vendor/procedural-animals/src/species/cheetah/coat.js +427 -0
- package/vendor/procedural-animals/src/species/cheetah/index.js +51 -0
- package/vendor/procedural-animals/src/species/cheetah/joints.js +3 -0
- package/vendor/procedural-animals/src/species/cheetah/motion.js +77 -0
- package/vendor/procedural-animals/src/species/cheetah/regions.js +95 -0
- package/vendor/procedural-animals/src/species/cheetah/rig.js +66 -0
- package/vendor/procedural-animals/src/species/cheetah/sculpt.js +158 -0
- package/vendor/procedural-animals/src/species/chicken/coat.js +313 -0
- package/vendor/procedural-animals/src/species/chicken/coverts.js +320 -0
- package/vendor/procedural-animals/src/species/chicken/index.js +110 -0
- package/vendor/procedural-animals/src/species/chicken/motion.js +177 -0
- package/vendor/procedural-animals/src/species/chicken/regions.js +66 -0
- package/vendor/procedural-animals/src/species/chicken/rig.js +144 -0
- package/vendor/procedural-animals/src/species/chicken/sculpt.js +389 -0
- package/vendor/procedural-animals/src/species/chicken/wingLook.js +66 -0
- package/vendor/procedural-animals/src/species/chicken/wingStack.js +124 -0
- package/vendor/procedural-animals/src/species/cow/behaviour.js +521 -0
- package/vendor/procedural-animals/src/species/cow/coat.js +465 -0
- package/vendor/procedural-animals/src/species/cow/index.js +118 -0
- package/vendor/procedural-animals/src/species/cow/motion.js +81 -0
- package/vendor/procedural-animals/src/species/cow/regions.js +98 -0
- package/vendor/procedural-animals/src/species/cow/rig.js +116 -0
- package/vendor/procedural-animals/src/species/cow/sculpt.js +339 -0
- package/vendor/procedural-animals/src/species/crow/coat.js +145 -0
- package/vendor/procedural-animals/src/species/crow/index.js +70 -0
- package/vendor/procedural-animals/src/species/crow/joints.js +3 -0
- package/vendor/procedural-animals/src/species/crow/motion.js +101 -0
- package/vendor/procedural-animals/src/species/crow/regions.js +50 -0
- package/vendor/procedural-animals/src/species/crow/rig.js +83 -0
- package/vendor/procedural-animals/src/species/crow/sculpt.js +118 -0
- package/vendor/procedural-animals/src/species/deer/behaviour.js +513 -0
- package/vendor/procedural-animals/src/species/deer/coat.js +391 -0
- package/vendor/procedural-animals/src/species/deer/index.js +106 -0
- package/vendor/procedural-animals/src/species/deer/motion.js +97 -0
- package/vendor/procedural-animals/src/species/deer/regions.js +60 -0
- package/vendor/procedural-animals/src/species/deer/rig.js +124 -0
- package/vendor/procedural-animals/src/species/deer/sculpt.js +297 -0
- package/vendor/procedural-animals/src/species/dog/behaviour.js +521 -0
- package/vendor/procedural-animals/src/species/dog/coat.js +495 -0
- package/vendor/procedural-animals/src/species/dog/index.js +144 -0
- package/vendor/procedural-animals/src/species/dog/motion.js +118 -0
- package/vendor/procedural-animals/src/species/dog/regions.js +61 -0
- package/vendor/procedural-animals/src/species/dog/rig.js +129 -0
- package/vendor/procedural-animals/src/species/dog/sculpt.js +246 -0
- package/vendor/procedural-animals/src/species/eagle/coat.js +250 -0
- package/vendor/procedural-animals/src/species/eagle/index.js +76 -0
- package/vendor/procedural-animals/src/species/eagle/joints.js +3 -0
- package/vendor/procedural-animals/src/species/eagle/motion.js +137 -0
- package/vendor/procedural-animals/src/species/eagle/regions.js +57 -0
- package/vendor/procedural-animals/src/species/eagle/rig.js +107 -0
- package/vendor/procedural-animals/src/species/eagle/sculpt.js +137 -0
- package/vendor/procedural-animals/src/species/fish/coat.js +271 -0
- package/vendor/procedural-animals/src/species/fish/index.js +88 -0
- package/vendor/procedural-animals/src/species/fish/motion.js +92 -0
- package/vendor/procedural-animals/src/species/fish/regions.js +27 -0
- package/vendor/procedural-animals/src/species/fish/rig.js +143 -0
- package/vendor/procedural-animals/src/species/fish/sculpt.js +214 -0
- package/vendor/procedural-animals/src/species/fish/variants.js +126 -0
- package/vendor/procedural-animals/src/species/fox/behaviour.js +314 -0
- package/vendor/procedural-animals/src/species/fox/coat.js +444 -0
- package/vendor/procedural-animals/src/species/fox/index.js +120 -0
- package/vendor/procedural-animals/src/species/fox/motion.js +81 -0
- package/vendor/procedural-animals/src/species/fox/regions.js +59 -0
- package/vendor/procedural-animals/src/species/fox/rig.js +91 -0
- package/vendor/procedural-animals/src/species/fox/sculpt.js +202 -0
- package/vendor/procedural-animals/src/species/frog/behaviour.js +590 -0
- package/vendor/procedural-animals/src/species/frog/coat.js +305 -0
- package/vendor/procedural-animals/src/species/frog/index.js +97 -0
- package/vendor/procedural-animals/src/species/frog/motion.js +69 -0
- package/vendor/procedural-animals/src/species/frog/regions.js +46 -0
- package/vendor/procedural-animals/src/species/frog/rig.js +156 -0
- package/vendor/procedural-animals/src/species/frog/sculpt.js +240 -0
- package/vendor/procedural-animals/src/species/goat/behaviour.js +509 -0
- package/vendor/procedural-animals/src/species/goat/coat.js +590 -0
- package/vendor/procedural-animals/src/species/goat/index.js +149 -0
- package/vendor/procedural-animals/src/species/goat/motion.js +95 -0
- package/vendor/procedural-animals/src/species/goat/regions.js +98 -0
- package/vendor/procedural-animals/src/species/goat/rig.js +181 -0
- package/vendor/procedural-animals/src/species/goat/sculpt.js +547 -0
- package/vendor/procedural-animals/src/species/horse/coat.js +361 -0
- package/vendor/procedural-animals/src/species/horse/coatSeam.js +122 -0
- package/vendor/procedural-animals/src/species/horse/index.js +80 -0
- package/vendor/procedural-animals/src/species/horse/motion.js +245 -0
- package/vendor/procedural-animals/src/species/horse/regions.js +60 -0
- package/vendor/procedural-animals/src/species/horse/rig.js +117 -0
- package/vendor/procedural-animals/src/species/horse/sculpt.js +316 -0
- package/vendor/procedural-animals/src/species/horse/seamWeights.js +272 -0
- package/vendor/procedural-animals/src/species/lion/behaviour.js +509 -0
- package/vendor/procedural-animals/src/species/lion/coat.js +1016 -0
- package/vendor/procedural-animals/src/species/lion/index.js +111 -0
- package/vendor/procedural-animals/src/species/lion/motion.js +87 -0
- package/vendor/procedural-animals/src/species/lion/regions.js +106 -0
- package/vendor/procedural-animals/src/species/lion/rig.js +110 -0
- package/vendor/procedural-animals/src/species/lion/sculpt.js +384 -0
- package/vendor/procedural-animals/src/species/lion/whiskers.js +132 -0
- package/vendor/procedural-animals/src/species/pig/behaviour.js +575 -0
- package/vendor/procedural-animals/src/species/pig/coat.js +730 -0
- package/vendor/procedural-animals/src/species/pig/ears.js +242 -0
- package/vendor/procedural-animals/src/species/pig/index.js +161 -0
- package/vendor/procedural-animals/src/species/pig/motion.js +105 -0
- package/vendor/procedural-animals/src/species/pig/regions.js +100 -0
- package/vendor/procedural-animals/src/species/pig/rig.js +152 -0
- package/vendor/procedural-animals/src/species/pig/sculpt.js +382 -0
- package/vendor/procedural-animals/src/species/rabbit/behaviour.js +605 -0
- package/vendor/procedural-animals/src/species/rabbit/coat.js +285 -0
- package/vendor/procedural-animals/src/species/rabbit/index.js +85 -0
- package/vendor/procedural-animals/src/species/rabbit/motion.js +85 -0
- package/vendor/procedural-animals/src/species/rabbit/regions.js +48 -0
- package/vendor/procedural-animals/src/species/rabbit/rig.js +99 -0
- package/vendor/procedural-animals/src/species/rabbit/sculpt.js +148 -0
- package/vendor/procedural-animals/src/species/rat/behaviour.js +539 -0
- package/vendor/procedural-animals/src/species/rat/coat.js +341 -0
- package/vendor/procedural-animals/src/species/rat/index.js +111 -0
- package/vendor/procedural-animals/src/species/rat/motion.js +90 -0
- package/vendor/procedural-animals/src/species/rat/regions.js +92 -0
- package/vendor/procedural-animals/src/species/rat/rig.js +112 -0
- package/vendor/procedural-animals/src/species/rat/sculpt.js +163 -0
- package/vendor/procedural-animals/src/species/rat/whiskers.js +119 -0
- package/vendor/procedural-animals/src/species/shark/coat.js +383 -0
- package/vendor/procedural-animals/src/species/shark/index.js +104 -0
- package/vendor/procedural-animals/src/species/shark/motion.js +69 -0
- package/vendor/procedural-animals/src/species/shark/regions.js +34 -0
- package/vendor/procedural-animals/src/species/shark/rig.js +194 -0
- package/vendor/procedural-animals/src/species/shark/sculpt.js +343 -0
- package/vendor/procedural-animals/src/species/shark/variants.js +105 -0
- package/vendor/procedural-animals/src/species/sheep/behaviour.js +522 -0
- package/vendor/procedural-animals/src/species/sheep/coat.js +529 -0
- package/vendor/procedural-animals/src/species/sheep/index.js +152 -0
- package/vendor/procedural-animals/src/species/sheep/motion.js +86 -0
- package/vendor/procedural-animals/src/species/sheep/neck.js +41 -0
- package/vendor/procedural-animals/src/species/sheep/regions.js +62 -0
- package/vendor/procedural-animals/src/species/sheep/rig.js +163 -0
- package/vendor/procedural-animals/src/species/sheep/sculpt.js +542 -0
- package/vendor/procedural-animals/src/species/snake/coat.js +315 -0
- package/vendor/procedural-animals/src/species/snake/index.js +73 -0
- package/vendor/procedural-animals/src/species/snake/motion.js +51 -0
- package/vendor/procedural-animals/src/species/snake/regions.js +51 -0
- package/vendor/procedural-animals/src/species/snake/rig.js +108 -0
- package/vendor/procedural-animals/src/species/snake/sculpt.js +122 -0
- package/vendor/procedural-animals/src/species/spider/coat.js +279 -0
- package/vendor/procedural-animals/src/species/spider/index.js +78 -0
- package/vendor/procedural-animals/src/species/spider/motion.js +72 -0
- package/vendor/procedural-animals/src/species/spider/regions.js +87 -0
- package/vendor/procedural-animals/src/species/spider/rig.js +118 -0
- package/vendor/procedural-animals/src/species/spider/sculpt.js +182 -0
- package/vendor/procedural-animals/src/species/wolf/behaviour.js +160 -0
- package/vendor/procedural-animals/src/species/wolf/coat.js +749 -0
- package/vendor/procedural-animals/src/species/wolf/index.js +107 -0
- package/vendor/procedural-animals/src/species/wolf/motion.js +80 -0
- package/vendor/procedural-animals/src/species/wolf/regions.js +57 -0
- package/vendor/procedural-animals/src/species/wolf/rig.js +87 -0
- package/vendor/procedural-animals/src/species/wolf/sculpt.js +339 -0
- package/vendor/procedural-animals/src/worker.js +29 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Lion (Panthera leo). A heavy, deep-chested digitigrade cat: massive head and forequarters, short
|
|
2
|
+
// legs relative to its bulk; the male's mane, the lioness, and woolly spotted cubs.
|
|
3
|
+
import { lionRig, HEAD_O } from './rig.js';
|
|
4
|
+
import { sculptLion, EYE } from './sculpt.js';
|
|
5
|
+
import { lionRegions, EYE_CENTRES } from './regions.js';
|
|
6
|
+
import { lionCoat } from './coat.js';
|
|
7
|
+
import { motion } from './motion.js';
|
|
8
|
+
import { lionWhiskers } from './whiskers.js';
|
|
9
|
+
|
|
10
|
+
export default {
|
|
11
|
+
id: 'lion',
|
|
12
|
+
name: 'Lion',
|
|
13
|
+
latin: 'Panthera leo',
|
|
14
|
+
group: 'paws',
|
|
15
|
+
plan: 'quadruped',
|
|
16
|
+
covering: 'fur',
|
|
17
|
+
variants: ['tawny', 'white'],
|
|
18
|
+
|
|
19
|
+
// Seeded individual. Males ~1.075 x the reference size (withers
|
|
20
|
+
// ~1.15 m), a bigger, broader head and a mane whose extent grows with age (young / "maneless"
|
|
21
|
+
// Tsavo-type males carry a short ruff) and whose colour runs from blond to black-fringed; lionesses
|
|
22
|
+
// ~0.935 (withers ~1.0 m), no mane, a flatter head. Cubs (age 'juvenile', ~4-6 months): ~0.42 size,
|
|
23
|
+
// big head, ears and paws, short legs, woolly greyer coat with faint rosettes, grey-amber eyes.
|
|
24
|
+
// Individuals vary in leg length, body length, head size, coat warmth / lightness, nose freckling
|
|
25
|
+
// (age), faint leg spots. Rare leucistic "white lion" (variant 'white', ~3 %).
|
|
26
|
+
variation(R, o) {
|
|
27
|
+
const sex = o.sex || (R() < 0.5 ? 'male' : 'female');
|
|
28
|
+
const age = o.age || 'adult';
|
|
29
|
+
const juv = age === 'juvenile' ? 1 : 0;
|
|
30
|
+
const male = sex === 'male' && !juv;
|
|
31
|
+
const g = () => R() + R() - 1; // [-1, 1], triangular
|
|
32
|
+
let variant = o.variant;
|
|
33
|
+
if (!variant) variant = R() < 0.03 ? 'white' : 'tawny'; else R();
|
|
34
|
+
const prime = R(); // 0 young adult .. 1 prime / old (mane extent and darkness, nose freckling)
|
|
35
|
+
const maneless = R() < 0.08;
|
|
36
|
+
const mane = male ? (maneless ? 0.12 : Math.min(1, 0.3 + 0.75 * prime * (0.8 + 0.2 * R()))) : 0;
|
|
37
|
+
const maneDark = male ? Math.min(1, Math.max(0, 0.1 + 0.65 * prime + 0.3 * g())) : 0;
|
|
38
|
+
const size = (male ? 1.075 : 0.935) * (1 + 0.06 * g()) * (juv ? 0.42 : 1);
|
|
39
|
+
const legs = 1 + 0.045 * g() - 0.08 * juv;
|
|
40
|
+
const head = (male ? 1.12 : 1.07) * (1 + 0.04 * g()) * (juv ? 1.28 : 1);
|
|
41
|
+
return {
|
|
42
|
+
sex, age, size, variant, juv,
|
|
43
|
+
mane, maneDark,
|
|
44
|
+
noseDark: juv ? 0 : Math.min(1, Math.max(0, 0.15 + 0.6 * prime + 0.15 * g())),
|
|
45
|
+
legSpots: juv ? 1 : Math.max(0, 0.15 + 0.2 * g()),
|
|
46
|
+
coatWarmth: 1.1 * g(),
|
|
47
|
+
coatLightness: 0.25 * g(), // (+-0.16 read as a pride of clones)
|
|
48
|
+
coatSeed: Math.floor(R() * 1e6),
|
|
49
|
+
minThick: 0.005,
|
|
50
|
+
warps: [
|
|
51
|
+
// cubs (research 1, cub_lying1): a short muzzle (the face in front of the eyes 22 % shorter) and eyes 15 %
|
|
52
|
+
// bigger, in reference space before the other warps (the adult's muzzle scaled down)
|
|
53
|
+
...(juv ? [{ type: 'length', k: 0.7, z0: 0.878, z1: 1.03 }, ...EYE_CENTRES.map((c) => ({ type: 'scaleAbout', c, k: 1.15, r0: 0.026, r1: 0.05 }))] : []),
|
|
54
|
+
{ type: 'legs', k: legs, top: 0.55 },
|
|
55
|
+
{ type: 'length', k: 1 + 0.07 * g() - 0.05 * juv, z0: -0.55, z1: 0.4 },
|
|
56
|
+
{ type: 'scaleAbout', c: HEAD_O, k: head, r0: 0.14, r1: 0.32 },
|
|
57
|
+
// (cub paws: sculpt.js, longer and deeper; a warp about them also made them wider, and they lay in the ground)
|
|
58
|
+
],
|
|
59
|
+
// (drawn after everything above, so a seed keeps its sex, mane, size and coat)
|
|
60
|
+
earDark: 0.55 + 0.45 * R(), // ear backs from sooty brown to black
|
|
61
|
+
belly: 0.6 + 0.8 * R(), // the loose belly fold (primordial pouch), small .. heavy
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
rig: () => lionRig(),
|
|
65
|
+
sculpt: (m, rig, params) => sculptLion(m, rig, params),
|
|
66
|
+
regions: lionRegions,
|
|
67
|
+
coat: lionCoat,
|
|
68
|
+
eyeSpecs: (params) => [1, -1].map((side) => ({ side, spec: params.juv ? CUB_EYE_SPEC : EYE, headOrigin: HEAD_O, bone: 'head', look: params.juv ? CUB_EYE : EYE_LOOK })),
|
|
69
|
+
motion,
|
|
70
|
+
surfaces: lionWhiskers, // the whiskers (strands on a bone per side)
|
|
71
|
+
render: {
|
|
72
|
+
markColor: [0.012, 0.009, 0.007],
|
|
73
|
+
strandDensity: 560,
|
|
74
|
+
// silhouette fins on the mane, the tufts and the fringes only (hair >= 24 mm): on the face, the cheeks and a cub's
|
|
75
|
+
// soft head their dark roots drew a dark outline wherever the head turns side-on, a hood round a cub's face; the core option finMinLen (default 5.8 mm)
|
|
76
|
+
finMinLen: 0.024,
|
|
77
|
+
// the shells' strands cross-faded between two hashing planes near a switch of the plane (the core option
|
|
78
|
+
// strandBlend, default off): the broad forehead tilted ~45 deg drew a rectangle where the plane switched
|
|
79
|
+
// (0.35: at 0.12 the bridge, sloping ~45 deg and convex, still drew two or three horizontal bands of
|
|
80
|
+
// stretched strands across it and one across the top of the forehead, stitches or creases from the front)
|
|
81
|
+
strandBlend: 0.35,
|
|
82
|
+
clumpDensity: 0.85,
|
|
83
|
+
leatherTint: 1, // nose leather in its tint: pink-brown to mottled black by age (coat.js), pink in the white lion
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// Round pupil (constricts to a small circle), amber iris (#b8802f, darker limbal ring), no visible
|
|
88
|
+
// sclera, black lid margins.
|
|
89
|
+
export const EYE_LOOK = {
|
|
90
|
+
pupil: 'round',
|
|
91
|
+
lids: 'mammal',
|
|
92
|
+
// (amber-gold: face_male1 amber, face_female1 paler gold; a saturated orange read as a cartoon eye, a
|
|
93
|
+
// grey-gold hazel as a washed-out yellow in sunlight)
|
|
94
|
+
iris: { inner: [0.3, 0.16, 0.035], mid: [0.5, 0.3, 0.075], hi: [0.7, 0.47, 0.15], outer: [0.13, 0.07, 0.018] },
|
|
95
|
+
sclera: { color: [0.2, 0.15, 0.11], visible: false },
|
|
96
|
+
lidColor: [0.015, 0.012, 0.01],
|
|
97
|
+
pupilSize: [0.2, 0.55], // (about 0.25-0.3 of the iris in daylight, the photos; ~0.5 measured in the harness light)
|
|
98
|
+
};
|
|
99
|
+
// cubs (4-6 months): amber-brown, duller than an adult's (blue-grey until ~3 months, amber by the end of the first year;
|
|
100
|
+
// cub_lying1: amber-brown; a grey-blue iris read as a doll's eye)
|
|
101
|
+
// (a cub's iris fills more of its opening, cub_Alert_cub_*, cub_Krueger_lion_cub: the dark eyeball round a
|
|
102
|
+
// small iris read as dark bluish rings, eye make-up or bruises, in the showcase's sky light)
|
|
103
|
+
const CUB_EYE_SPEC = { ...EYE, irisR: EYE.irisR * 1.14 };
|
|
104
|
+
export const CUB_EYE = {
|
|
105
|
+
...EYE_LOOK,
|
|
106
|
+
sclera: { color: [0.26, 0.17, 0.1], visible: false },
|
|
107
|
+
// (the upper lid that covers the iris's top in a cub's bigger opening: tawny furred skin with the dark margin at its edge; black, it
|
|
108
|
+
// reflected the sky as a dark blue band over the iris)
|
|
109
|
+
lidColor: [0.18, 0.1, 0.045],
|
|
110
|
+
iris: { inner: [0.22, 0.13, 0.05], mid: [0.38, 0.24, 0.09], hi: [0.52, 0.36, 0.16], outer: [0.1, 0.06, 0.025] },
|
|
111
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// Lion motion data for the quadruped engine (schema: src/core/motion/quadruped.js).
|
|
2
|
+
// Numbers are for the reference individual (params.size = 1, withers ~1.07 m); the engine scales them
|
|
3
|
+
// by dynamic similarity for cubs and big males.
|
|
4
|
+
//
|
|
5
|
+
// Gaits: a slow, heavy lateral-sequence walk (0.8-1.6 m/s, 0.6-0.8 Hz,
|
|
6
|
+
// duty 0.72-0.64, [LF .27, RF .77, LH 0, RH .5]), head carried low; a trot that lions rarely use
|
|
7
|
+
// (2-4 m/s, 1.3-1.7 Hz, duty 0.46-0.4: a narrow band between walk and gallop); the transverse gallop
|
|
8
|
+
// (4.5-8 m/s, 1.8-2.2 Hz, duty 0.36-0.3) and the rotary gallop of the charge (8-16 m/s, 2.2-2.6 Hz,
|
|
9
|
+
// duty 0.3-0.22, LH-RH-RF-LF); top speed ~14-16 m/s in bursts (98th percentile 13.9 m/s, Wilson et
|
|
10
|
+
// al. 2018), hard acceleration and even harder braking.
|
|
11
|
+
import { lionHooks } from './behaviour.js';
|
|
12
|
+
|
|
13
|
+
const G = (name, v, f, D, off, o) => ({ name, v, f, D, off, ...o });
|
|
14
|
+
|
|
15
|
+
export const motion = {
|
|
16
|
+
hooks: lionHooks,
|
|
17
|
+
maxSpeed: 16,
|
|
18
|
+
accel: [6, 9.5],
|
|
19
|
+
decel: 13,
|
|
20
|
+
// a heavy cat turns slowly and wide: ~50 deg/s at the walk, ~0.7 rad/s at a 7 m/s gallop (10 m radius,
|
|
21
|
+
// a ~23 deg lean at speed),
|
|
22
|
+
// wider at the charge (88 deg/s at the walk and a 5 m gallop radius read as a swinging rod)
|
|
23
|
+
turnRate: 1.1,
|
|
24
|
+
latAccelMax: 5,
|
|
25
|
+
gears: { walk: 1.2, trot: 2.9, gallop: 7, sprint: 14 },
|
|
26
|
+
gallopBlend: [4.2, 8],
|
|
27
|
+
gaits: [
|
|
28
|
+
G('walk', 0.0, 0.62, 0.72, [0.27, 0.77, 0.0, 0.5], { liftF: 0.075, liftH: 0.06, bobF: 0.008, bobH: 0.008, flex: 0.0, lat: 0.05, fold: 1.0, heel: 35, tail: 0, drop: 0.0, width: 0.95 }),
|
|
29
|
+
G('walk', 1.5, 0.82, 0.64, [0.27, 0.77, 0.0, 0.5], { liftF: 0.1, liftH: 0.075, bobF: 0.014, bobH: 0.012, flex: 0.0, lat: 0.05, fold: 1.2, heel: 42, tail: 0.1, drop: 0.0, width: 0.9 }),
|
|
30
|
+
G('trot', 2.1, 1.35, 0.46, [0.5, 0.02, 0.0, 0.5], { liftF: 0.13, liftH: 0.11, bobF: 0.025, bobH: 0.025, flex: 0.02, lat: 0.015, fold: 1.45, heel: 50, tail: 0.3, drop: 0.01, width: 0.95 }),
|
|
31
|
+
G('trot', 3.6, 1.6, 0.4, [0.5, 0.02, 0.0, 0.5], { liftF: 0.15, liftH: 0.13, bobF: 0.03, bobH: 0.03, flex: 0.03, lat: 0.01, fold: 1.55, heel: 56, tail: 0.4, drop: 0.015, width: 0.95 }),
|
|
32
|
+
G('gallop', 4.8, 1.85, 0.36, [0.46, 0.58, 0.0, 0.12], { liftF: 0.2, liftH: 0.18, bobF: 0.03, bobH: 0.045, flex: 0.22, lat: 0, fold: 1.75, heel: 62, tail: 0.6, drop: 0.03, width: 0.9 }),
|
|
33
|
+
// (transverse up to 7.5 m/s, rotary from 9.5: in between the leads swap, and the 7 m/s gear read both
|
|
34
|
+
// forefeet landing together, a half-bound)
|
|
35
|
+
G('gallop', 7.5, 2.1, 0.32, [0.46, 0.58, 0.0, 0.12], { liftF: 0.235, liftH: 0.215, bobF: 0.033, bobH: 0.055, flex: 0.3, lat: 0, fold: 1.85, heel: 66, tail: 0.75, drop: 0.035, width: 0.95 }),
|
|
36
|
+
G('gallop', 9.5, 2.25, 0.29, [0.58, 0.46, 0.0, 0.12], { liftF: 0.25, liftH: 0.23, bobF: 0.035, bobH: 0.06, flex: 0.34, lat: 0, fold: 1.9, heel: 68, tail: 0.8, drop: 0.04, width: 1 }),
|
|
37
|
+
G('gallop', 16, 2.6, 0.23, [0.58, 0.46, 0.0, 0.12], { liftF: 0.3, liftH: 0.28, bobF: 0.04, bobH: 0.07, flex: 0.44, lat: 0, fold: 2.0, heel: 72, tail: 0.95, drop: 0.07, width: 1 }),
|
|
38
|
+
],
|
|
39
|
+
feet: {
|
|
40
|
+
front: { type: 'digitigrade', curl: 55 },
|
|
41
|
+
hind: { type: 'digitigrade', curl: 65 },
|
|
42
|
+
},
|
|
43
|
+
stance: { width: 1, gallopWidth: 0.6, sprawl: 0, crouch: 0.03 }, // (a tall walk on straight legs: 0.15 walked crouched)
|
|
44
|
+
// torso cross-sections (bind, reference size): centre height, half height, half width (from the mesh)
|
|
45
|
+
body: {
|
|
46
|
+
chest: { y: 0.745, hh: 0.28, hw: 0.185 },
|
|
47
|
+
pelvis: { y: 0.79, hh: 0.25, hw: 0.18 }, // incl. the thigh muscles a lion lying on its side rests on
|
|
48
|
+
rump: { z: -0.765, y: 0.81, hh: 0.17, hw: 0.165 },
|
|
49
|
+
back: 0.13,
|
|
50
|
+
},
|
|
51
|
+
head: {
|
|
52
|
+
// [speed, raise (m), reach (m), pitch (rad, + = nose down)]: standing head at about withers
|
|
53
|
+
// height; the relaxed walk carries it low (crown below the withers, nose ~30 deg down) and the
|
|
54
|
+
// charge stretches it forward in line with the spine
|
|
55
|
+
carriage: [[0, 0.02, 0.0, -0.06], [1.0, -0.075, 0.04, 0.27], [2.4, -0.08, 0.05, 0.24], [4.5, -0.085, 0.07, 0.2], [9, -0.1, 0.09, 0.16]],
|
|
56
|
+
stab: [[0, 0], [0.9, 0.25], [1.8, 0.3], [4.5, 0.34], [9, 0.6]],
|
|
57
|
+
neckBend: 30, neckPivot: 0.4, yaw: 0.85, pitchUp: 0.45, pitchDown: 0.6,
|
|
58
|
+
},
|
|
59
|
+
tail: {
|
|
60
|
+
// [speed, pitch per segment from horizontal (deg), base -> tip]: J-hang with the tuft curled up at
|
|
61
|
+
// rest and in the walk; lifted into a shallow curve in the gallop
|
|
62
|
+
carriage: [
|
|
63
|
+
[0.0, [-40, -62, -74, -80, -82, -80, -72, -54, -24, 12]],
|
|
64
|
+
[1.2, [-36, -58, -71, -77, -79, -76, -66, -46, -16, 16]],
|
|
65
|
+
[3.0, [-24, -38, -46, -50, -50, -46, -38, -24, -6, 12]],
|
|
66
|
+
[6.0, [-16, -20, -20, -18, -14, -9, -3, 4, 10, 16]],
|
|
67
|
+
[12, [-10, -10, -8, -6, -3, 0, 3, 6, 9, 12]],
|
|
68
|
+
],
|
|
69
|
+
stiffness: 0.9, sway: 6, flick: 1, wag: 0, swish: 0, curl: 0,
|
|
70
|
+
balance: 0.6, // counterweight in turns and speed changes: the tuft lags and overshoots
|
|
71
|
+
radius: [0.055, 0.045], // (coat and the tuft included)
|
|
72
|
+
},
|
|
73
|
+
ears: { rest: [0, 0], mobility: 0.6, speedFlatten: 0.45, twitch: 1, prick: 0.3 },
|
|
74
|
+
breath: { rate: 0.25, amp: 0.012, pant: true, pantRate: 2.2, pantAmp: 0.045, heatSpeed: 7 },
|
|
75
|
+
actions: {
|
|
76
|
+
attack: { style: 'pounce' }, // replaced by the species action (stalk, charge, pounce, neck bite): behaviour.js
|
|
77
|
+
eat: { style: 'tear', dropF: 0.45, dropH: 0.5, ahead: 0.75, pitch: 0.85 }, // (the lion's own eat lies down: behaviour.js)
|
|
78
|
+
drink: { dropF: 0.72, dropH: 0.35, ahead: 0.7, pitch: 0.9 }, // crouched at the edge, elbows out, lapping
|
|
79
|
+
jump: { height: 1.2, distance: 3.6 },
|
|
80
|
+
sit: {},
|
|
81
|
+
lie: { dropF: 0.93, dropH: 0.97 },
|
|
82
|
+
// sphinx: forelegs stretched forward along the ground (paws ~0.7 leg lengths ahead of the shoulder;
|
|
83
|
+
// the thick forearm lies on the ground instead of folding into it)
|
|
84
|
+
fold: { front: { z: 0.03, k: -1.45, beta: 0 } },
|
|
85
|
+
sleep: { style: 'lateral' }, // flat on one flank, legs out
|
|
86
|
+
},
|
|
87
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// Meshing plan: body at 8.1 mm (the cheetah's 5.4 mm scaled to the lion's size), head at 4.2 mm
|
|
2
|
+
// (overlapping across the upper neck and cross-faded), eyelid patches at 1.5 mm, and the lower jaw
|
|
3
|
+
// as its own surface so the mouth can open.
|
|
4
|
+
import { lionJoints, HEAD_O, fe } from './rig.js';
|
|
5
|
+
import { EYE } 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 = lionJoints();
|
|
11
|
+
export const NECK_CUT = (() => {
|
|
12
|
+
const d = norm(sub(J0.occiput, J0.neckMid));
|
|
13
|
+
const c = lerp(J0.neckMid, J0.occiput, 0.95);
|
|
14
|
+
return { c, d, band: 0.018 };
|
|
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
|
+
// A maned head: the head surface is the part in front of the neck cut AND inside a flattened ellipsoid
|
|
19
|
+
// round the face, or round an ear: the outer mane ruff stays on the (coarser) body surface, so the cut
|
|
20
|
+
// between the two surfaces never runs through the long hair far from the neck axis, where a bent neck
|
|
21
|
+
// opened it. The ellipsoid term is a pseudo-distance (the scaled radius divided by its gradient), so the
|
|
22
|
+
// cross-fade band is as wide in metres all round it (its gradient was up to 1.5: the band shrank to 12 mm
|
|
23
|
+
// on the sides, less than a coarse cell, and the cut came out on the visible side of the fade).
|
|
24
|
+
// A maneless head (lioness, cub) is cut at the neck alone: the ellipsoid crossed the nape at a grazing
|
|
25
|
+
// angle (a 28 cm crack at the crowd tier) and cut the ears off the head surface.
|
|
26
|
+
const HC = [HEAD_O[0], HEAD_O[1] + 0.01, HEAD_O[2] + 0.03], HR = 0.29;
|
|
27
|
+
function faceEll(x, y, z) {
|
|
28
|
+
const sx = 1.5, sy = y < HC[1] ? 1.45 : 1, sz = z < HC[2] ? 1.3 : 1;
|
|
29
|
+
const dx = (x - HC[0]) * sx, dy = (y - HC[1]) * sy, dz = (z - HC[2]) * sz;
|
|
30
|
+
const r = Math.hypot(dx, dy, dz) || 1e-9;
|
|
31
|
+
return ((HR - r) * r) / (Math.hypot(dx * sx, dy * sy, dz * sz) || 1e-9);
|
|
32
|
+
}
|
|
33
|
+
// the ears (a capsule round the pinna standing out of the mane, from above its buried base to beyond the
|
|
34
|
+
// tip) are head surface in a mane too; kept tight so the fine head mesh does not spread over the mane skin
|
|
35
|
+
// round the ears, which folds when the neck bends
|
|
36
|
+
const EAR_R = 0.05, EAR_T0 = 0.3;
|
|
37
|
+
const EARS = [1, -1].map((s) => {
|
|
38
|
+
const a = [J0.earBaseL[0] * s, J0.earBaseL[1], J0.earBaseL[2]], t = [J0.earTipL[0] * s, J0.earTipL[1], J0.earTipL[2]];
|
|
39
|
+
return { a, d: sub(t, a) };
|
|
40
|
+
});
|
|
41
|
+
function earS(x, y, z) {
|
|
42
|
+
let best = -1e9;
|
|
43
|
+
for (const { a, d } of EARS) {
|
|
44
|
+
const px = x - a[0], py = y - a[1], pz = z - a[2];
|
|
45
|
+
const t = Math.max(EAR_T0, Math.min(1.15, (px * d[0] + py * d[1] + pz * d[2]) / (d[0] * d[0] + d[1] * d[1] + d[2] * d[2])));
|
|
46
|
+
best = Math.max(best, EAR_R - Math.hypot(px - d[0] * t, py - d[1] * t, pz - d[2] * t));
|
|
47
|
+
}
|
|
48
|
+
return best;
|
|
49
|
+
}
|
|
50
|
+
const splitMane = (x, y, z) => Math.min(neckS(x, y, z), Math.max(faceEll(x, y, z), earS(x, y, z)));
|
|
51
|
+
// the split for an individual (> 0 head surface, < 0 body)
|
|
52
|
+
export const splitFor = (params) => ((params && params.mane > 0) ? splitMane : neckS);
|
|
53
|
+
|
|
54
|
+
export const EYE_CENTRES = [1, -1].map((s) => eyeFrameOf(EYE, HEAD_O, s).c);
|
|
55
|
+
const PATCH = { R: 0.039, B: 0.006, h: 0.0015 }; // (R - B holds the aperture rim at the skin, 31.6 mm)
|
|
56
|
+
// the nose leather (its edge, the comma nostrils) meshed finer as well: at the medium tier's 8.4 mm face
|
|
57
|
+
// cells its lower edge and the nostrils were jagged dark notches
|
|
58
|
+
// (the whole leather, its outline and the short fur round it inside the patch's core, R - B: with the leather's top corners in
|
|
59
|
+
// the cross-fade band the coarse face mesh's colours showed through there as ragged dark-red patches)
|
|
60
|
+
export const NOSE_PATCH = { c: fe(0, -0.98, 1.03), R: 0.072, B: 0.008, h: 0.0022 };
|
|
61
|
+
export function eyePatchWeight(x, y, z) {
|
|
62
|
+
let w = 0;
|
|
63
|
+
for (const c of EYE_CENTRES) w = Math.max(w, 1 - smoothstep(PATCH.R - PATCH.B, PATCH.R + PATCH.B, Math.hypot(x - c[0], y - c[1], z - c[2])));
|
|
64
|
+
const n = NOSE_PATCH;
|
|
65
|
+
return Math.max(w, 1 - smoothstep(n.R - n.B, n.R + n.B, Math.hypot(x - n.c[0], y - n.c[1], z - n.c[2])));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function lionRegions(rig, params, Q) {
|
|
69
|
+
// (the medium tier's body 5 % coarser: its eyelid and nose patches take ~2k of its 32k vertices)
|
|
70
|
+
// (a maned body 5 % coarser at a full mane: the mane's locks add surface; a lioness's cells unchanged)
|
|
71
|
+
const r = Q.res, hBody = 0.0081 * r * (Math.abs(r - 2) < 0.01 ? 1.05 : 1) * (1 + 0.05 * (params.mane || 0));
|
|
72
|
+
const splitS = splitFor(params);
|
|
73
|
+
// The mesher keeps whole cells by their centre, so a cut's boundary vertices lie up to ~0.85 of a
|
|
74
|
+
// cell either side of it: the band must be over a body cell wide (1.2 cells), or at the medium and low tiers
|
|
75
|
+
// the body's cut came out where its fade still shows (open edges on the visible side).
|
|
76
|
+
const B = Math.max(NECK_CUT.band, 1.2 * hBody);
|
|
77
|
+
// Without fur shells (crowd tier) the coarse body surface and the head surface do not coincide in
|
|
78
|
+
// the overlap band: each surface stays visible past the cut by D there (see the cheetah).
|
|
79
|
+
const D = Q.shells > 0 ? 0 : 0.6 * 0.0076 * r;
|
|
80
|
+
// (patches at medium too: Safari on a Mac and phones show medium; the eyes' lid margins and the nose)
|
|
81
|
+
const patches = r <= 2.01 ? [...EYE_CENTRES.map((c) => ({ c, R: PATCH.R, B: PATCH.B, h: PATCH.h * Math.max(1, r) })), { ...NOSE_PATCH, h: NOSE_PATCH.h * Math.max(1, r) }] : [];
|
|
82
|
+
const zN = rig.J.nose[2] + 0.04;
|
|
83
|
+
return {
|
|
84
|
+
jobs: [
|
|
85
|
+
[{ name: 'body', part: 'body', bmin: [-0.36, -0.03, -1.5], bmax: [0.36, 1.3, 0.95], h: hBody, F: 4, clip: (x, y, z) => splitS(x, y, z) < B + D }],
|
|
86
|
+
[
|
|
87
|
+
{ name: 'head', part: 'body', bmin: [-0.3, 0.6, 0.45], bmax: [0.3, 1.27, zN], h: 0.0042 * r, F: 6, clip: (x, y, z) => splitS(x, y, z) > -B - D, patches },
|
|
88
|
+
// (the jaw is small and sits under the overhanging upper lip, where its dark lip band meets the white
|
|
89
|
+
// chin: at 8 mm cells that edge was a black-and-white saw-tooth, a grimace)
|
|
90
|
+
{ name: 'jaw', part: 'jaw', bmin: [-0.12, 0.77, 0.69], bmax: [0.12, 0.94, zN], h: 0.004 * (r <= 2.01 ? Math.min(r, 1.5) : 0.75 * r), F: 6, rigidBone: 'jaw' },
|
|
91
|
+
// the upper canines (up to the medium tier: at low and crowd nobody sees into a mouth)
|
|
92
|
+
...(r <= 2.01 ? [{ name: 'canine', part: 'canine', bmin: [-0.07, 0.785, 0.9], bmax: [0.07, 0.875, 0.98], h: 0.0019 * Math.pow(r, 0.8), F: 6, rigidBone: 'head' }] : []),
|
|
93
|
+
],
|
|
94
|
+
],
|
|
95
|
+
fade(x, y, z, name, patch) {
|
|
96
|
+
const sN = splitS(x, y, z);
|
|
97
|
+
if (name === 'body') return 1 - smoothstep(-B, B, sN - D);
|
|
98
|
+
if (name === 'head') {
|
|
99
|
+
let f = smoothstep(-B, B, sN + D);
|
|
100
|
+
if (patches.length) { const ew = eyePatchWeight(x, y, z); f *= patch ? ew : 1 - ew; }
|
|
101
|
+
return f;
|
|
102
|
+
}
|
|
103
|
+
return 1;
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
// Lion 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 ~1.07 m over the
|
|
4
|
+
// coat, head-body ~1.8 m along the curve, tail ~0.85 m (plus the tuft), skull ~0.32 m.
|
|
5
|
+
// Limb segments (museum long bones, x ~0.95 for the reference individual):
|
|
6
|
+
// scapula 0.29, humerus 0.32, radius 0.28, metacarpus 0.10, fore digits 0.075; femur 0.37,
|
|
7
|
+
// tibia 0.32, tarsus + metatarsus 0.17, hind digits 0.075. Standing angles from side photos
|
|
8
|
+
// (side_walk_male3, side_male1): scapula ~60 deg, elbow close under the front of the chest, radius
|
|
9
|
+
// near vertical, hock ~0.2 x withers height, metatarsus nearly vertical. Compared with the cheetah the
|
|
10
|
+
// lion is shorter in the leg (elbow ~0.39 x withers height vs 0.46), deeper in the chest (brisket at
|
|
11
|
+
// ~0.42 x withers height), shorter in the back relative to its height and much heavier in the head.
|
|
12
|
+
// The head is modelled level in its own frame (HEAD_O); its carriage comes from the motion data.
|
|
13
|
+
import { buildRig } from '../../core/rig/rig.js';
|
|
14
|
+
import { quadrupedBones, quadrupedLimbs, tailChain } from '../../core/rig/quadruped.js';
|
|
15
|
+
import { WHISKER_BASE_F, WHISKER_TIP_F } from './whiskers.js';
|
|
16
|
+
|
|
17
|
+
export const TAIL_SEGS = 10;
|
|
18
|
+
export const SH = 1.07; // reference withers height (top of the coat)
|
|
19
|
+
export const HEAD_O = [0, 0.95, 0.8]; // head-local origin (mid cranium, between eyes and ears)
|
|
20
|
+
export const HS = 1.15; // head-local scale: landmarks below are for a 0.3 m head (x1.15: ~0.35 m over the skin)
|
|
21
|
+
export const hl = (v) => [HEAD_O[0] + v[0] * HS, HEAD_O[1] + v[1] * HS, HEAD_O[2] + v[2] * HS];
|
|
22
|
+
// Face units (sculpt, rig and coat share them): landmarks measured on the photos are given in units of
|
|
23
|
+
// the eye separation E (0.112 head units = 0.129 m on the reference head) from the eye midpoint, in the
|
|
24
|
+
// head frame (gaze +Z); X is in units of 0.1 head units times the head width hw (1.12 for a lioness:
|
|
25
|
+
// X = 0.5 is the eye), so a male's broader face widens with hw.
|
|
26
|
+
export const FACE = { E: 0.112, X: 0.1, EY: 0.047, EZ: 0.05 };
|
|
27
|
+
export const fe = (X, Y, Z, hw = 1.12) => hl([X * FACE.X * hw, FACE.EY + Y * FACE.E, FACE.EZ + Z * FACE.E]);
|
|
28
|
+
// head-local (x already divided by hw) -> face units
|
|
29
|
+
export const toFace = (h) => [h[0] / FACE.X, (h[1] - FACE.EY) / FACE.E, (h[2] - FACE.EZ) / FACE.E];
|
|
30
|
+
|
|
31
|
+
export function lionJoints() {
|
|
32
|
+
const J = {
|
|
33
|
+
nose: fe(0, -1.0, 1.2),
|
|
34
|
+
occiput: hl([0, 0.02, -0.135]),
|
|
35
|
+
neckMid: [0, 0.949, 0.575],
|
|
36
|
+
neckBase: [0, 0.915, 0.4],
|
|
37
|
+
chestMid: [0, 0.895, 0.22],
|
|
38
|
+
thoraxRear: [0, 0.915, -0.03],
|
|
39
|
+
lumbarMid: [0, 0.925, -0.28],
|
|
40
|
+
lumbosacral: [0, 0.915, -0.52],
|
|
41
|
+
tailBase: [0, 0.915, -0.765], // (high on the croup: the croup curves into the tail, side_walk_male3)
|
|
42
|
+
scapTopL: [0.065, 0.93, 0.29],
|
|
43
|
+
// (elbow ~0.43 x withers, brisket ~0.44: the legs read short for the chest with the elbow at 0.39;
|
|
44
|
+
// the humerus keeps its length, the forearm is longer)
|
|
45
|
+
shoulderL: [0.105, 0.7, 0.43],
|
|
46
|
+
elbowL: [0.1, 0.46, 0.225],
|
|
47
|
+
wristL: [0.08, 0.14, 0.27],
|
|
48
|
+
mcpL: [0.078, 0.05, 0.315],
|
|
49
|
+
ftoeL: [0.078, 0.024, 0.39],
|
|
50
|
+
hipL: [0.09, 0.8, -0.6],
|
|
51
|
+
kneeL: [0.11, 0.46, -0.45],
|
|
52
|
+
hockL: [0.09, 0.215, -0.66],
|
|
53
|
+
mtpL: [0.086, 0.05, -0.62],
|
|
54
|
+
htoeL: [0.086, 0.024, -0.548],
|
|
55
|
+
jawHinge: hl([0, -0.062, -0.04]),
|
|
56
|
+
jawTip: fe(0, -1.42, 0.78),
|
|
57
|
+
// (set out on the side of the crown, so the pinna's outer edge carries on the head's outline down to ~0.3 E above the
|
|
58
|
+
// eye line (face_female1); further in, the ears stood on top of the dome with a notch below them)
|
|
59
|
+
// (the tip ~1.05-1.15 E out and ~1.2 E above the eye line, face_female1 / face_male1: at 1.3-1.4 E out the ears stood on
|
|
60
|
+
// the corners of the head like a mouse's)
|
|
61
|
+
earBaseL: hl([0.106, 0.1, -0.068]),
|
|
62
|
+
// (lower, ~0.25 E: the pinnae stood 1.4 E above the eye line against the photos' 1.1-1.15 with their fur
|
|
63
|
+
// (ffront_*, fprof_*, f34_*), tall round ears on a dome, a plush toy's)
|
|
64
|
+
earTipL: hl([0.152, 0.192, -0.095]), // (the pinna ~9 cm above the skull's side, a little lower than wide at the base)
|
|
65
|
+
// the whisker fan's bone (whiskers.js): from the middle of the pad out to the side
|
|
66
|
+
whiskerBaseL: fe(...WHISKER_BASE_F),
|
|
67
|
+
whiskerTipL: fe(...WHISKER_TIP_F),
|
|
68
|
+
// the upper lip's lower edge from the canine back to the corner of the mouth: drawn back and up with the gape
|
|
69
|
+
// (behaviour.js pose hook), so a roaring or yawning lion bares its upper canines
|
|
70
|
+
lipBaseL: fe(0.42, -1.4, 0.3),
|
|
71
|
+
lipTipL: fe(0.52, -1.4, -0.1),
|
|
72
|
+
};
|
|
73
|
+
// bind tail held out behind and down (clear of the thighs and buttocks so the SDF does not merge
|
|
74
|
+
// them); the relaxed J-hang with the tuft curled up comes from the motion data
|
|
75
|
+
tailChain(J, 'tailBase', [-22, -34, -44, -51, -56, -58, -58, -55, -48, -38], [0.088, 0.088, 0.087, 0.086, 0.085, 0.084, 0.083, 0.082, 0.081, 0.08]);
|
|
76
|
+
return J;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function lionRig() {
|
|
80
|
+
const J = lionJoints();
|
|
81
|
+
return buildRig({
|
|
82
|
+
joints: J,
|
|
83
|
+
unit: SH / 0.76,
|
|
84
|
+
headOrigin: HEAD_O,
|
|
85
|
+
// (+ a whisker bone per side: the whisker fans ride on it, whiskers.js)
|
|
86
|
+
bones: quadrupedBones({ tailSegs: TAIL_SEGS, ears: true, jaw: true, extra: [['whisker{S}', 'whiskerBase{S}', 'whiskerTip{S}', 'head', { region: 'head', group: 'whisk{S}' }], ['lip{S}', 'lipBase{S}', 'lipTip{S}', 'head', { region: 'head', group: 'lip{S}' }]] }),
|
|
87
|
+
axial: {
|
|
88
|
+
points: ['nose', 'occiput', 'neckMid', 'neckBase', 'chestMid', 'thoraxRear', 'lumbarMid', 'lumbosacral', 'tailBase', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + (i + 1))],
|
|
89
|
+
bones: ['head', 'neck2', 'neck1', 'chest', 'spine3', 'spine2', 'spine1', 'pelvis', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + i)],
|
|
90
|
+
// the skull's influence reaches back into the nape, the mane and the throat (3rd value: wider
|
|
91
|
+
// with the skin's distance from the axis under the throat)
|
|
92
|
+
blend: { 1: [-0.09, 0.2, 2.6] },
|
|
93
|
+
bodyTail: 0, // the tail hangs behind the buttocks: their skin blends into it only at the root
|
|
94
|
+
},
|
|
95
|
+
limbs: quadrupedLimbs({
|
|
96
|
+
front: { tCore: 0.55, aCore: 0.05, aBody: -0.12, midX: 0.0 },
|
|
97
|
+
hind: { tCore: 0.52, aCore: 0.035, aBody: -0.11, midX: 0.008 },
|
|
98
|
+
}),
|
|
99
|
+
appendages: [
|
|
100
|
+
// (a wide hand-over from the pinna to the skull: the broad ear base stretched > 3x round its rim
|
|
101
|
+
// when the ear flattened or swivelled)
|
|
102
|
+
{ group: 'earL', bone: 'earL', blend: [-0.008, 0.022] },
|
|
103
|
+
{ group: 'earR', bone: 'earR', blend: [-0.008, 0.022] },
|
|
104
|
+
// the upper lip's edge (sculpt.js 'lipedge', inside the lip): full weight within ~6 mm of it, none beyond ~3 cm
|
|
105
|
+
{ group: 'lipL', bone: 'lipL', blend: [-0.0213, -0.0043] },
|
|
106
|
+
{ group: 'lipR', bone: 'lipR', blend: [-0.0213, -0.0043] },
|
|
107
|
+
],
|
|
108
|
+
webTags: ['flankfold', 'thighfront', 'scapmuscle', 'elbowtuft'],
|
|
109
|
+
});
|
|
110
|
+
}
|