@bitefoundry/retrieviewer 0.0.2 → 0.0.4

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.
Files changed (261) hide show
  1. package/ASSET-PROVENANCE.md +6 -0
  2. package/ASSETS-LICENSE.md +2 -1
  3. package/ATTRIBUTION.md +6 -1
  4. package/COMFORT-ART.md +65 -0
  5. package/DESKTOP-PLATFORMS.md +75 -0
  6. package/INSTALLING.md +8 -5
  7. package/PLUGIN.md +13 -10
  8. package/PREREQUISITES.md +95 -0
  9. package/PUPPY-MEMORY.md +102 -1
  10. package/README.ko.md +110 -0
  11. package/README.md +119 -58
  12. package/RELEASING.md +27 -14
  13. package/THIRD-PARTY-NOTICES.md +5 -3
  14. package/braille.mjs +35 -9
  15. package/examples/live.mjs +2 -2
  16. package/integrations/desktop/platform.mjs +27 -0
  17. package/integrations/linux-overlay/README.md +83 -0
  18. package/integrations/linux-overlay/overlay.py +1094 -0
  19. package/integrations/macos-overlay/README.md +83 -0
  20. package/integrations/macos-overlay/overlay.jxa +639 -0
  21. package/integrations/opencode/runtime.mjs +4 -4
  22. package/integrations/opencode/tui.tsx +1 -1
  23. package/integrations/windows-overlay/Overlay.cs +4 -4
  24. package/integrations/windows-overlay/desktop.mjs +40 -8
  25. package/integrations/windows-overlay/protocol.mjs +11 -7
  26. package/integrations/windows-overlay/worker.mjs +13 -7
  27. package/package.json +41 -14
  28. package/puppy-comfort-sprites.mjs +25 -0
  29. package/puppy-companion-comfort-q5.bin.gz +0 -0
  30. package/puppy-companion-comfort.json +77 -0
  31. package/puppy-companion-life.mjs +49 -16
  32. package/puppy-companion-objects.mjs +12 -0
  33. package/puppy-frame-predictive.mjs +15 -9
  34. package/puppy-frame-store.mjs +2 -2
  35. package/puppy-paper-world.mjs +14 -0
  36. package/puppy-paper.mjs +65 -14
  37. package/retrieviewer-cli.mjs +10 -3
  38. package/retrieviewer-plugin.d.mts +1 -1
  39. package/retrieviewer-plugin.mjs +1 -1
  40. package/retrieviewer.d.mts +10 -4
  41. package/retrieviewer.mjs +20 -14
  42. package/locomotion-core.mjs +0 -21
  43. package/locomotion-puppy.animal +0 -0
  44. package/vendor/procedural-animals/package.json +0 -40
  45. package/vendor/procedural-animals/src/animal.js +0 -146
  46. package/vendor/procedural-animals/src/bake.js +0 -51
  47. package/vendor/procedural-animals/src/build.js +0 -81
  48. package/vendor/procedural-animals/src/core/build/coatKit.js +0 -121
  49. package/vendor/procedural-animals/src/core/build/featherCards.js +0 -189
  50. package/vendor/procedural-animals/src/core/build/finEdges.js +0 -85
  51. package/vendor/procedural-animals/src/core/build/furSlope.js +0 -115
  52. package/vendor/procedural-animals/src/core/build/mesh.js +0 -67
  53. package/vendor/procedural-animals/src/core/build/pipeline.js +0 -272
  54. package/vendor/procedural-animals/src/core/build/seams.js +0 -183
  55. package/vendor/procedural-animals/src/core/build/warp.js +0 -112
  56. package/vendor/procedural-animals/src/core/build/weights.js +0 -393
  57. package/vendor/procedural-animals/src/core/math/vec.js +0 -81
  58. package/vendor/procedural-animals/src/core/motion/actions.js +0 -800
  59. package/vendor/procedural-animals/src/core/motion/bird.js +0 -3063
  60. package/vendor/procedural-animals/src/core/motion/birdActions.js +0 -1059
  61. package/vendor/procedural-animals/src/core/motion/common.js +0 -158
  62. package/vendor/procedural-animals/src/core/motion/index.js +0 -22
  63. package/vendor/procedural-animals/src/core/motion/quadruped.js +0 -2875
  64. package/vendor/procedural-animals/src/core/motion/snake.js +0 -1594
  65. package/vendor/procedural-animals/src/core/motion/spider.js +0 -1810
  66. package/vendor/procedural-animals/src/core/motion/swimmer.js +0 -1047
  67. package/vendor/procedural-animals/src/core/motion/swimmerActions.js +0 -613
  68. package/vendor/procedural-animals/src/core/render/animalObject.js +0 -262
  69. package/vendor/procedural-animals/src/core/render/coatMaterial.js +0 -1301
  70. package/vendor/procedural-animals/src/core/render/dqs.js +0 -159
  71. package/vendor/procedural-animals/src/core/render/eyes.js +0 -676
  72. package/vendor/procedural-animals/src/core/render/membranes.js +0 -77
  73. package/vendor/procedural-animals/src/core/render/skeleton.js +0 -41
  74. package/vendor/procedural-animals/src/core/rig/bird.js +0 -327
  75. package/vendor/procedural-animals/src/core/rig/quadruped.js +0 -76
  76. package/vendor/procedural-animals/src/core/rig/rig.js +0 -79
  77. package/vendor/procedural-animals/src/core/rig/snake.js +0 -76
  78. package/vendor/procedural-animals/src/core/rig/spider.js +0 -110
  79. package/vendor/procedural-animals/src/core/rig/swimmer.js +0 -181
  80. package/vendor/procedural-animals/src/core/sdf/eyeSocket.js +0 -53
  81. package/vendor/procedural-animals/src/core/sdf/mesher.js +0 -238
  82. package/vendor/procedural-animals/src/core/sdf/sdf.js +0 -263
  83. package/vendor/procedural-animals/src/index.d.ts +0 -98
  84. package/vendor/procedural-animals/src/index.js +0 -29
  85. package/vendor/procedural-animals/src/registry.js +0 -48
  86. package/vendor/procedural-animals/src/species/bear/behaviour.js +0 -463
  87. package/vendor/procedural-animals/src/species/bear/claws.js +0 -147
  88. package/vendor/procedural-animals/src/species/bear/coat.js +0 -726
  89. package/vendor/procedural-animals/src/species/bear/index.js +0 -139
  90. package/vendor/procedural-animals/src/species/bear/motion.js +0 -112
  91. package/vendor/procedural-animals/src/species/bear/regions.js +0 -78
  92. package/vendor/procedural-animals/src/species/bear/rig.js +0 -112
  93. package/vendor/procedural-animals/src/species/bear/sculpt.js +0 -272
  94. package/vendor/procedural-animals/src/species/boar/behaviour.js +0 -335
  95. package/vendor/procedural-animals/src/species/boar/coat.js +0 -372
  96. package/vendor/procedural-animals/src/species/boar/index.js +0 -110
  97. package/vendor/procedural-animals/src/species/boar/motion.js +0 -85
  98. package/vendor/procedural-animals/src/species/boar/regions.js +0 -88
  99. package/vendor/procedural-animals/src/species/boar/rig.js +0 -111
  100. package/vendor/procedural-animals/src/species/boar/sculpt.js +0 -285
  101. package/vendor/procedural-animals/src/species/cat/behaviour.js +0 -559
  102. package/vendor/procedural-animals/src/species/cat/coat.js +0 -841
  103. package/vendor/procedural-animals/src/species/cat/index.js +0 -211
  104. package/vendor/procedural-animals/src/species/cat/motion.js +0 -101
  105. package/vendor/procedural-animals/src/species/cat/regions.js +0 -82
  106. package/vendor/procedural-animals/src/species/cat/rig.js +0 -100
  107. package/vendor/procedural-animals/src/species/cat/sculpt.js +0 -266
  108. package/vendor/procedural-animals/src/species/cat/whiskers.js +0 -110
  109. package/vendor/procedural-animals/src/species/cheetah/coat.js +0 -427
  110. package/vendor/procedural-animals/src/species/cheetah/index.js +0 -51
  111. package/vendor/procedural-animals/src/species/cheetah/joints.js +0 -3
  112. package/vendor/procedural-animals/src/species/cheetah/motion.js +0 -77
  113. package/vendor/procedural-animals/src/species/cheetah/regions.js +0 -95
  114. package/vendor/procedural-animals/src/species/cheetah/rig.js +0 -66
  115. package/vendor/procedural-animals/src/species/cheetah/sculpt.js +0 -158
  116. package/vendor/procedural-animals/src/species/chicken/coat.js +0 -313
  117. package/vendor/procedural-animals/src/species/chicken/coverts.js +0 -320
  118. package/vendor/procedural-animals/src/species/chicken/index.js +0 -110
  119. package/vendor/procedural-animals/src/species/chicken/motion.js +0 -177
  120. package/vendor/procedural-animals/src/species/chicken/regions.js +0 -66
  121. package/vendor/procedural-animals/src/species/chicken/rig.js +0 -144
  122. package/vendor/procedural-animals/src/species/chicken/sculpt.js +0 -389
  123. package/vendor/procedural-animals/src/species/chicken/wingLook.js +0 -66
  124. package/vendor/procedural-animals/src/species/chicken/wingStack.js +0 -124
  125. package/vendor/procedural-animals/src/species/cow/behaviour.js +0 -521
  126. package/vendor/procedural-animals/src/species/cow/coat.js +0 -465
  127. package/vendor/procedural-animals/src/species/cow/index.js +0 -118
  128. package/vendor/procedural-animals/src/species/cow/motion.js +0 -81
  129. package/vendor/procedural-animals/src/species/cow/regions.js +0 -98
  130. package/vendor/procedural-animals/src/species/cow/rig.js +0 -116
  131. package/vendor/procedural-animals/src/species/cow/sculpt.js +0 -339
  132. package/vendor/procedural-animals/src/species/crow/coat.js +0 -145
  133. package/vendor/procedural-animals/src/species/crow/index.js +0 -70
  134. package/vendor/procedural-animals/src/species/crow/joints.js +0 -3
  135. package/vendor/procedural-animals/src/species/crow/motion.js +0 -101
  136. package/vendor/procedural-animals/src/species/crow/regions.js +0 -50
  137. package/vendor/procedural-animals/src/species/crow/rig.js +0 -83
  138. package/vendor/procedural-animals/src/species/crow/sculpt.js +0 -118
  139. package/vendor/procedural-animals/src/species/deer/behaviour.js +0 -513
  140. package/vendor/procedural-animals/src/species/deer/coat.js +0 -391
  141. package/vendor/procedural-animals/src/species/deer/index.js +0 -106
  142. package/vendor/procedural-animals/src/species/deer/motion.js +0 -97
  143. package/vendor/procedural-animals/src/species/deer/regions.js +0 -60
  144. package/vendor/procedural-animals/src/species/deer/rig.js +0 -124
  145. package/vendor/procedural-animals/src/species/deer/sculpt.js +0 -297
  146. package/vendor/procedural-animals/src/species/dog/behaviour.js +0 -521
  147. package/vendor/procedural-animals/src/species/dog/coat.js +0 -495
  148. package/vendor/procedural-animals/src/species/dog/index.js +0 -144
  149. package/vendor/procedural-animals/src/species/dog/motion.js +0 -118
  150. package/vendor/procedural-animals/src/species/dog/regions.js +0 -61
  151. package/vendor/procedural-animals/src/species/dog/rig.js +0 -129
  152. package/vendor/procedural-animals/src/species/dog/sculpt.js +0 -246
  153. package/vendor/procedural-animals/src/species/eagle/coat.js +0 -250
  154. package/vendor/procedural-animals/src/species/eagle/index.js +0 -76
  155. package/vendor/procedural-animals/src/species/eagle/joints.js +0 -3
  156. package/vendor/procedural-animals/src/species/eagle/motion.js +0 -137
  157. package/vendor/procedural-animals/src/species/eagle/regions.js +0 -57
  158. package/vendor/procedural-animals/src/species/eagle/rig.js +0 -107
  159. package/vendor/procedural-animals/src/species/eagle/sculpt.js +0 -137
  160. package/vendor/procedural-animals/src/species/fish/coat.js +0 -271
  161. package/vendor/procedural-animals/src/species/fish/index.js +0 -88
  162. package/vendor/procedural-animals/src/species/fish/motion.js +0 -92
  163. package/vendor/procedural-animals/src/species/fish/regions.js +0 -27
  164. package/vendor/procedural-animals/src/species/fish/rig.js +0 -143
  165. package/vendor/procedural-animals/src/species/fish/sculpt.js +0 -214
  166. package/vendor/procedural-animals/src/species/fish/variants.js +0 -126
  167. package/vendor/procedural-animals/src/species/fox/behaviour.js +0 -314
  168. package/vendor/procedural-animals/src/species/fox/coat.js +0 -444
  169. package/vendor/procedural-animals/src/species/fox/index.js +0 -120
  170. package/vendor/procedural-animals/src/species/fox/motion.js +0 -81
  171. package/vendor/procedural-animals/src/species/fox/regions.js +0 -59
  172. package/vendor/procedural-animals/src/species/fox/rig.js +0 -91
  173. package/vendor/procedural-animals/src/species/fox/sculpt.js +0 -202
  174. package/vendor/procedural-animals/src/species/frog/behaviour.js +0 -590
  175. package/vendor/procedural-animals/src/species/frog/coat.js +0 -305
  176. package/vendor/procedural-animals/src/species/frog/index.js +0 -97
  177. package/vendor/procedural-animals/src/species/frog/motion.js +0 -69
  178. package/vendor/procedural-animals/src/species/frog/regions.js +0 -46
  179. package/vendor/procedural-animals/src/species/frog/rig.js +0 -156
  180. package/vendor/procedural-animals/src/species/frog/sculpt.js +0 -240
  181. package/vendor/procedural-animals/src/species/goat/behaviour.js +0 -509
  182. package/vendor/procedural-animals/src/species/goat/coat.js +0 -590
  183. package/vendor/procedural-animals/src/species/goat/index.js +0 -149
  184. package/vendor/procedural-animals/src/species/goat/motion.js +0 -95
  185. package/vendor/procedural-animals/src/species/goat/regions.js +0 -98
  186. package/vendor/procedural-animals/src/species/goat/rig.js +0 -181
  187. package/vendor/procedural-animals/src/species/goat/sculpt.js +0 -547
  188. package/vendor/procedural-animals/src/species/horse/coat.js +0 -361
  189. package/vendor/procedural-animals/src/species/horse/coatSeam.js +0 -122
  190. package/vendor/procedural-animals/src/species/horse/index.js +0 -80
  191. package/vendor/procedural-animals/src/species/horse/motion.js +0 -245
  192. package/vendor/procedural-animals/src/species/horse/regions.js +0 -60
  193. package/vendor/procedural-animals/src/species/horse/rig.js +0 -117
  194. package/vendor/procedural-animals/src/species/horse/sculpt.js +0 -316
  195. package/vendor/procedural-animals/src/species/horse/seamWeights.js +0 -272
  196. package/vendor/procedural-animals/src/species/lion/behaviour.js +0 -509
  197. package/vendor/procedural-animals/src/species/lion/coat.js +0 -1016
  198. package/vendor/procedural-animals/src/species/lion/index.js +0 -111
  199. package/vendor/procedural-animals/src/species/lion/motion.js +0 -87
  200. package/vendor/procedural-animals/src/species/lion/regions.js +0 -106
  201. package/vendor/procedural-animals/src/species/lion/rig.js +0 -110
  202. package/vendor/procedural-animals/src/species/lion/sculpt.js +0 -384
  203. package/vendor/procedural-animals/src/species/lion/whiskers.js +0 -132
  204. package/vendor/procedural-animals/src/species/pig/behaviour.js +0 -575
  205. package/vendor/procedural-animals/src/species/pig/coat.js +0 -730
  206. package/vendor/procedural-animals/src/species/pig/ears.js +0 -242
  207. package/vendor/procedural-animals/src/species/pig/index.js +0 -161
  208. package/vendor/procedural-animals/src/species/pig/motion.js +0 -105
  209. package/vendor/procedural-animals/src/species/pig/regions.js +0 -100
  210. package/vendor/procedural-animals/src/species/pig/rig.js +0 -152
  211. package/vendor/procedural-animals/src/species/pig/sculpt.js +0 -382
  212. package/vendor/procedural-animals/src/species/rabbit/behaviour.js +0 -605
  213. package/vendor/procedural-animals/src/species/rabbit/coat.js +0 -285
  214. package/vendor/procedural-animals/src/species/rabbit/index.js +0 -85
  215. package/vendor/procedural-animals/src/species/rabbit/motion.js +0 -85
  216. package/vendor/procedural-animals/src/species/rabbit/regions.js +0 -48
  217. package/vendor/procedural-animals/src/species/rabbit/rig.js +0 -99
  218. package/vendor/procedural-animals/src/species/rabbit/sculpt.js +0 -148
  219. package/vendor/procedural-animals/src/species/rat/behaviour.js +0 -539
  220. package/vendor/procedural-animals/src/species/rat/coat.js +0 -341
  221. package/vendor/procedural-animals/src/species/rat/index.js +0 -111
  222. package/vendor/procedural-animals/src/species/rat/motion.js +0 -90
  223. package/vendor/procedural-animals/src/species/rat/regions.js +0 -92
  224. package/vendor/procedural-animals/src/species/rat/rig.js +0 -112
  225. package/vendor/procedural-animals/src/species/rat/sculpt.js +0 -163
  226. package/vendor/procedural-animals/src/species/rat/whiskers.js +0 -119
  227. package/vendor/procedural-animals/src/species/shark/coat.js +0 -383
  228. package/vendor/procedural-animals/src/species/shark/index.js +0 -104
  229. package/vendor/procedural-animals/src/species/shark/motion.js +0 -69
  230. package/vendor/procedural-animals/src/species/shark/regions.js +0 -34
  231. package/vendor/procedural-animals/src/species/shark/rig.js +0 -194
  232. package/vendor/procedural-animals/src/species/shark/sculpt.js +0 -343
  233. package/vendor/procedural-animals/src/species/shark/variants.js +0 -105
  234. package/vendor/procedural-animals/src/species/sheep/behaviour.js +0 -522
  235. package/vendor/procedural-animals/src/species/sheep/coat.js +0 -529
  236. package/vendor/procedural-animals/src/species/sheep/index.js +0 -152
  237. package/vendor/procedural-animals/src/species/sheep/motion.js +0 -86
  238. package/vendor/procedural-animals/src/species/sheep/neck.js +0 -41
  239. package/vendor/procedural-animals/src/species/sheep/regions.js +0 -62
  240. package/vendor/procedural-animals/src/species/sheep/rig.js +0 -163
  241. package/vendor/procedural-animals/src/species/sheep/sculpt.js +0 -542
  242. package/vendor/procedural-animals/src/species/snake/coat.js +0 -315
  243. package/vendor/procedural-animals/src/species/snake/index.js +0 -73
  244. package/vendor/procedural-animals/src/species/snake/motion.js +0 -51
  245. package/vendor/procedural-animals/src/species/snake/regions.js +0 -51
  246. package/vendor/procedural-animals/src/species/snake/rig.js +0 -108
  247. package/vendor/procedural-animals/src/species/snake/sculpt.js +0 -122
  248. package/vendor/procedural-animals/src/species/spider/coat.js +0 -279
  249. package/vendor/procedural-animals/src/species/spider/index.js +0 -78
  250. package/vendor/procedural-animals/src/species/spider/motion.js +0 -72
  251. package/vendor/procedural-animals/src/species/spider/regions.js +0 -87
  252. package/vendor/procedural-animals/src/species/spider/rig.js +0 -118
  253. package/vendor/procedural-animals/src/species/spider/sculpt.js +0 -182
  254. package/vendor/procedural-animals/src/species/wolf/behaviour.js +0 -160
  255. package/vendor/procedural-animals/src/species/wolf/coat.js +0 -749
  256. package/vendor/procedural-animals/src/species/wolf/index.js +0 -107
  257. package/vendor/procedural-animals/src/species/wolf/motion.js +0 -80
  258. package/vendor/procedural-animals/src/species/wolf/regions.js +0 -57
  259. package/vendor/procedural-animals/src/species/wolf/rig.js +0 -87
  260. package/vendor/procedural-animals/src/species/wolf/sculpt.js +0 -339
  261. package/vendor/procedural-animals/src/worker.js +0 -29
@@ -1,139 +0,0 @@
1
- // Brown bear (Ursus arctos). Plantigrade, heavy-bodied omnivore with a shoulder hump, a dished face,
2
- // small round ears and long non-retractile fore claws; walks, ambles, canters and gallops but avoids
3
- // the trot. Variants: Eurasian (default), grizzly, coastal (Kodiak / Kamchatka type) and, on request
4
- // only, the American black bear (Ursus americanus: no hump, straight profile, bigger ears).
5
- import { bearRig, HEAD_O } from './rig.js';
6
- import { sculptBear, eyeOf } from './sculpt.js';
7
- import { bearRegions } from './regions.js';
8
- import { bearCoat } from './coat.js';
9
- import { motion } from './motion.js';
10
- import { bearClaws } from './claws.js';
11
-
12
- // random draws never produce the black bear (a different species): it is built only when asked for
13
- const VARIANTS = [['eurasian', 0.45], ['grizzly', 0.3], ['coastal', 0.25]];
14
- // coat colour morph per variant (probabilities)
15
- const COATS = {
16
- eurasian: [['dark', 0.55], ['red', 0.25], ['medium', 0.2]],
17
- grizzly: [['grizzled', 0.7], ['blonde', 0.2], ['medium', 0.1]],
18
- coastal: [['medium', 0.5], ['blonde', 0.3], ['dark', 0.2]],
19
- black: [['black', 1]],
20
- };
21
- const pick = (list, x) => { for (const [name, p] of list) { if (x < p) return name; x -= p; } return list[list.length - 1][0]; };
22
-
23
- export default {
24
- id: 'bear',
25
- name: 'Brown bear',
26
- latin: 'Ursus arctos',
27
- group: 'paws',
28
- plan: 'quadruped',
29
- covering: 'fur',
30
- variants: [
31
- { id: 'eurasian', name: 'Eurasian brown bear', latin: 'Ursus arctos arctos' },
32
- { id: 'grizzly', name: 'Grizzly bear', latin: 'Ursus arctos horribilis' },
33
- { id: 'coastal', name: 'Kodiak / coastal brown bear', latin: 'Ursus arctos middendorffi' },
34
- { id: 'black', name: 'American black bear', latin: 'Ursus americanus' },
35
- ],
36
-
37
- // Seeded individual. Males are much larger (1.2-2x the mass: x1.16 linear here), with broader
38
- // heads, thicker necks and a bigger hump; cubs (age 'juvenile', a yearling): x0.45 size, big domed
39
- // head with a short muzzle, large ears, short legs, fluffy uniform coat, Eurasian cubs often with a
40
- // pale neck collar. Individuals vary in size, leg and body length, head, muzzle, ears, hump, girth,
41
- // claw length, coat colour (morph per variant), sun-bleaching and coat length (summer / winter).
42
- variation(R, o) {
43
- const sex = o.sex || (R() < 0.5 ? 'male' : 'female');
44
- const age = o.age || 'adult';
45
- const juv = age === 'juvenile' ? 1 : 0;
46
- const male = sex === 'male';
47
- const g = () => (R() + R() + R() - 1.5) / 1.5; // ~[-1, 1], peaked
48
- let variant = o.variant;
49
- const xv = R();
50
- if (!variant) variant = pick(VARIANTS, xv);
51
- const coat = o.overrides?.coat || pick(COATS[variant] || COATS.eurasian, R());
52
- const black = variant === 'black' ? 1 : 0;
53
- const vSize = { eurasian: 1, grizzly: 1.02, coastal: 1.11, black: 0.84 }[variant] || 1;
54
- const size = (male ? 1.08 : 0.93) * vSize * (1 + 0.04 * g()) * (juv ? 0.45 : 1);
55
- const legs = 1 + 0.03 * g() - 0.08 * juv + 0.04 * black;
56
- const head = 1.1 * (male ? 1.03 : 0.98) * (1 + 0.025 * g());
57
- const hump = Math.max(0, ({ eurasian: 0.9, grizzly: 1.25, coastal: 1.05, black: 0 }[variant] ?? 1) * (male ? 1.12 : 0.92) * (1 + 0.15 * g()) * (juv ? 0.3 : 1));
58
- return {
59
- sex, age, size, variant, coat, juv,
60
- muzzle: (1 + 0.04 * g()) * (juv ? 0.66 : 1) * (black ? 1.04 : 1),
61
- headW: 1.1 * (male ? 1.07 : 0.96) * (1 + 0.025 * g()) * (juv ? 1.02 : 1) * (black ? 0.9 : 1),
62
- ear: (1 + 0.08 * g()) * (juv ? 1.3 : 1) * (black ? 1.3 : 1) * (variant === 'grizzly' ? 0.95 : 1),
63
- dish: clamp01(({ eurasian: 1, grizzly: 1.1, coastal: 0.9, black: 0.15 }[variant] ?? 1) + 0.12 * g()) * (juv ? 0.5 : 1),
64
- hump,
65
- girth: (male ? 1.04 : 0.98) * (1 + 0.035 * g()) * (juv ? 0.96 : 1) * (black ? 0.9 : 1),
66
- claw: ({ grizzly: 1.15, black: 0.65 }[variant] ?? 1) * (1 + 0.1 * g()) * (juv ? 0.7 : 1),
67
- tail: 1 + 0.1 * g(),
68
- shag: Math.max(0.65, (1 + 0.18 * g()) * (juv ? 0.9 : 1)),
69
- bleach: black ? 0 : Math.max(0, 0.35 + 0.5 * g()),
70
- collar: juv && variant === 'eurasian' && R() < 0.7 ? 0.6 + 0.4 * R() : 0,
71
- coatWarmth: 0.5 * g(),
72
- coatLightness: 0.1 * g(),
73
- coatSeed: Math.floor(R() * 1e6),
74
- minThick: 0.005,
75
- warps: [
76
- { type: 'legs', k: legs, top: 0.5 },
77
- { type: 'length', k: 1 + 0.03 * g() - 0.06 * juv, z0: -0.35, z1: 0.33 },
78
- { type: 'scaleAbout', c: HEAD_O, k: head * (juv ? 1.38 : 1), r0: 0.13, r1: 0.3 },
79
- ],
80
- };
81
- },
82
- rig: (params) => bearRig(params),
83
- sculpt: (m, rig, params) => sculptBear(m, rig, params),
84
- regions: bearRegions,
85
- coat: bearCoat,
86
- // the claws: curved horn tubes on the paw bones (claws.js)
87
- surfaces: bearClaws,
88
- eyeSpecs: (params) => [1, -1].map((side) => ({ side, spec: eyeOf(params), headOrigin: HEAD_O, bone: 'head', look: EYE_LOOK })),
89
- motion,
90
- render: {
91
- markColor: [0.01, 0.008, 0.007],
92
- strandDensity: 650,
93
- // big locks of guard hair (side3, front3, tq4: clumped locks with pale tips; at 0.85 the coat read as
94
- // a dense even pile, velvet; below ~0.6 the short face hair curls like a lamb's)
95
- // (0.75: between velvet, 0.85, and round scale-like tufts at medium, 0.62)
96
- clumpDensity: 0.75,
97
- // (the tufts start in hair over 3 mm and form fully at 22 mm: the 9 mm muzzle a little (0.18), the 12-14 mm
98
- // eye surround and bridge half (0.4-0.5), the 20 mm forehead and cheeks nearly fully. At [12, 45] mm the face
99
- // got none and its short hair rendered as a smooth pale felt, a suede mask; at [2, 12] the
100
- // forehead curled like lamb's wool, as the default [5.5, 16] did with the old 20-30 mm forehead)
101
- clumpLen: [0.003, 0.022],
102
- // no silhouette fins: on the 6-10 cm coat they draw contour lines inside the body wherever the hump,
103
- // back or rump outline crosses it (a pale harness round the hump from behind, a ring round the face),
104
- // even at finWidth 0.25; the shells alone give the shaggy outline
105
- fins: false,
106
- // (cast shadows on the shells looked up at the hair's root: the neck's long hair behind the jaw lies in the head's
107
- // shadow, and with each layer shadowed at its own height the shell stack showed there as torn dark sheets in look
108
- // turns)
109
- shellShadowRoot: 1,
110
- },
111
- };
112
-
113
- function clamp01(x) { return Math.max(0, Math.min(1.3, x)); }
114
-
115
- // Round pupil, brown iris (#3a2516 in shade, amber-brown #6b4a2a in bright light: face2, front3, tq1 show
116
- // a brown to amber ring round a clearly darker pupil, not a black bead), no visible sclera in normal
117
- // gaze, black lid rims.
118
- // (face1 / face2 show the eye at 0.12-0.65 of the brightness of the fur beside it, a brown iris round a darker pupil:
119
- // a brighter iris rendered paler than that fur in full sun, a golden-beige eye; 60 % of its albedo was tried next,
120
- // and at 45 % it read black in the studio)
121
- // (now a dull, dark warm brown, ~30 % of that 60 % iris: the 60 % iris (hi R/B 5) lit up golden-amber in the
122
- // showcase's sun (photos: the ring's hue 0-30 deg, saturation 0.06-0.35, 0.16-0.39 of the fur's
123
- // luminance); a dark neutral iris turned the sky's blue-grey, so it stays warm (R/B ~3) to offset the sky light)
124
- export const EYE_LOOK = {
125
- pupil: 'round',
126
- lids: 'mammal',
127
- iris: { inner: [0.02, 0.012, 0.007], mid: [0.032, 0.019, 0.011], hi: [0.05, 0.03, 0.016], outer: [0.012, 0.0075, 0.0045] },
128
- // (the sclera a bear shows round the iris is pigmented dark brown: the default-grey sclera, x0.6 when 'not visible',
129
- // albedo ~0.15, was paler than the iris and drew a pale grey ring whenever the eye turned in its aperture)
130
- sclera: { color: [0.06, 0.042, 0.03], visible: false },
131
- lidColor: [0.015, 0.012, 0.01],
132
- pupilSize: [0.26, 0.44],
133
- // (a faint clear coat: at the default 1 the sky's reflection on the cornea swamped the dark iris and the eyes read
134
- // pale blue-grey in the showcase; 0.15 keeps a small wet catchlight)
135
- cornea: 0.15,
136
- // (and the eyeball's environment sheen, which the showcase's bright sky laid over the dark iris as a blue-grey film;
137
- // probed in the page: indirect specular x0 gives a dark brown eye, x0.1 keeps a faint sheen)
138
- envSpecular: 0.1,
139
- };
@@ -1,112 +0,0 @@
1
- // Brown bear motion data for the quadruped engine (schema: src/core/motion/quadruped.js).
2
- // Numbers are for the reference individual (params.size = 1, hump ~1.0 m, hip joint 0.72 m); the
3
- // engine scales them by dynamic similarity for cubs and big males.
4
- //
5
- // Gaits (Shine et al. 2015, 2017 on grizzlies): bears AVOID THE TROT. At slow to
6
- // moderate speed they walk (lateral sequence, limb phase 0.2-0.25, mean 1.7 m/s), use a running
7
- // walk / amble (singlefoot, at most two feet down, no suspension, ~2.6 m/s) and a three-beat canter
8
- // (~2.9 m/s, no suspension); above ~4 m/s a rotary gallop with one gathered suspension, the hind
9
- // feet landing close together, big spinal flexion (charges at 11-13 m/s). Stride frequencies
10
- // from speed and Heglund-Taylor scaling, x1.14 for the reference individual's hip height (0.77 m
11
- // against the ~1.0 m of the adults in research 4.1: f ~ 1 / sqrt(leg length)). The walk swaggers: the shoulders and hump roll +-4-6 deg,
12
- // the head swings with the forelegs (behaviour.js), the forefeet swing out and land toes-in.
13
- import { hooks } from './behaviour.js';
14
-
15
- const G = (name, v, f, D, off, o) => ({ name, v, f, D, off, ...o });
16
-
17
- export const motion = {
18
- hooks,
19
- maxSpeed: 13,
20
- accel: [3.5, 6],
21
- decel: 7,
22
- // a 200 kg plantigrade animal steps round a turn with its back level (research 4.2: slow turns pivot
23
- // about the forelimbs with small steps): at 1.9 rad/s and 4.5 m/s^2 the torso spun about its middle,
24
- // the hips swung out at 0.85 m/s and it rolled 12-21 deg into every turn like a cheetah
25
- turnRate: 1.1,
26
- // (6 m/s^2, 0.6 g, with the lean into the turn at 0.4 of a runner's: a heavy bear corners on its feet, it
27
- // does not bank like a cheetah. At 2.5 without a lean scale the sprint turned at 0.20 rad/s, a 60 m radius;
28
- // at 4 / 0.55 0.32 rad/s at 12.7 m/s, ~40 m; now ~0.47 rad/s, ~27 m,
29
- // the lean still ~11 deg. research 4.2: charging bears turn and reverse within a few strides)
30
- latAccelMax: 6,
31
- bankScale: 0.4,
32
- gears: { walk: 1.2, amble: 2.4, canter: 3.3, gallop: 8 },
33
- gallopBlend: [3.6, 7],
34
- flexBlend: [3.2, 6],
35
- gaits: [
36
- // (the swinging forepaw peels off heel first with the palm turned back, flattens as it swings and is
37
- // carried low, the toes 5-6 cm up: fold -1.0 keeps the palm within ~13 deg of flat at mid swing. The
38
- // engine places the wrist from the paw: a paw folded to hang below the wrist put the wrist 25-30 cm up,
39
- // 35 cm under the shoulder, where the 62 cm arm is folded to 56 % of its length, and the forearm swung
40
- // up to 83 deg from vertical (a prance); now <= 55 deg. The body walks 1.5 cm low,
41
- // so the planted forefoot stays in reach through the stance)
42
- G('walk', 0.0, 0.7, 0.76, [0.25, 0.75, 0.0, 0.5], { liftF: 0.045, liftH: 0.065, bobF: 0.006, bobH: 0.008, flex: 0.0, lat: 0.06, fold: -1.0, heel: 30, tail: 0, drop: 0.015, width: 1.0 }),
43
- G('walk', 0.9, 0.84, 0.7, [0.23, 0.73, 0.0, 0.5], { liftF: 0.05, liftH: 0.075, bobF: 0.01, bobH: 0.012, flex: 0.0, lat: 0.07, fold: -1.0, heel: 38, tail: 0, drop: 0.015, width: 1.0 }),
44
- G('walk', 1.6, 1.0, 0.63, [0.22, 0.72, 0.0, 0.5], { liftF: 0.055, liftH: 0.085, bobF: 0.014, bobH: 0.016, flex: 0.01, lat: 0.07, fold: -1.0, heel: 45, tail: 0.1, drop: 0.015, width: 0.98 }),
45
- // running walk / amble: singlefoot, never more than two feet down, no suspension
46
- G('amble', 2.1, 1.24, 0.52, [0.18, 0.68, 0.0, 0.5], { liftF: 0.05, liftH: 0.095, bobF: 0.016, bobH: 0.018, flex: 0.02, lat: 0.05, fold: -1.0, heel: 52, tail: 0.2, drop: 0.005, width: 0.95 }),
47
- G('amble', 2.6, 1.35, 0.48, [0.18, 0.68, 0.0, 0.5], { liftF: 0.06, liftH: 0.1, bobF: 0.018, bobH: 0.02, flex: 0.03, lat: 0.045, fold: -0.9, heel: 56, tail: 0.3, drop: 0.008, width: 0.95 }),
48
- // three-beat canter (right lead): trailing hind, the diagonal pair, leading fore
49
- G('canter', 3.0, 1.52, 0.44, [0.3, 0.55, 0.0, 0.3], { liftF: 0.07, liftH: 0.12, bobF: 0.022, bobH: 0.03, flex: 0.1, lat: 0, fold: -0.5, heel: 60, tail: 0.4, drop: 0.012, width: 0.95 }),
50
- G('canter', 3.8, 1.7, 0.4, [0.3, 0.55, 0.0, 0.3], { liftF: 0.08, liftH: 0.13, bobF: 0.026, bobH: 0.034, flex: 0.16, lat: 0, fold: -0.3, heel: 64, tail: 0.5, drop: 0.016, width: 0.95 }),
51
- // rotary gallop: the hind feet land close together, then the forefeet; one gathered suspension
52
- // (the back arches and stretches: flex 0.36-0.48, research 4.1 "big spinal flexion"; at 0.26-0.38 the back
53
- // angle ranged 172-180 deg, a rigid loaf, against the cheetah's 162-180; now 170-180,
54
- // the back shortening 21 % through the stride. At 0.4-0.55 the rump skin stretched past 3x in the sprint
55
- // turns: the stretch metric's margin went under 5 %)
56
- // (the fore pair lands as the hind pair lifts off, so the only flight is the gathered one after the forefeet
57
- // push off, research 4.1 "single gathered suspension"; at [0.62, 0.5] with duty 0.2-0.26 the gallop and sprint
58
- // also flew 0.14-0.2 of a stride extended between the pairs)
59
- G('gallop', 5.0, 1.9, 0.34, [0.56, 0.44, 0.0, 0.1], { liftF: 0.17, liftH: 0.15, bobF: 0.022, bobH: 0.04, flex: 0.36, lat: 0, fold: 1.1, heel: 58, tail: 0.6, drop: 0.05, width: 1 }),
60
- // (the hips a little lower and steadier at speed, and the sprint's stride a little quicker: the hind foot that lands first
61
- // after the gathered flight came down under hips at the top of their bob, out of its reach, and its stance was cut to
62
- // half the other's, duty 0.10 against 0.21 at 13 m/s; now 0.19-0.25 / 0.21-0.27 from 10 to 13 m/s)
63
- G('gallop', 9.0, 2.3, 0.26, [0.48, 0.36, 0.0, 0.1], { liftF: 0.2, liftH: 0.18, bobF: 0.02, bobH: 0.03, flex: 0.44, lat: 0, fold: 1.2, heel: 60, tail: 0.8, drop: 0.09, width: 1 }),
64
- G('gallop', 13, 2.85, 0.2, [0.42, 0.3, 0.0, 0.1], { liftF: 0.22, liftH: 0.2, bobF: 0.02, bobH: 0.03, flex: 0.48, lat: 0, fold: 1.3, heel: 62, tail: 0.9, drop: 0.1, width: 1 }),
65
- ],
66
- feet: {
67
- // plantigrade: the palm lands nearly flat (a little toe-up), the hind foot heel first; the
68
- // forefeet are pigeon-toed (toeOut < 0 turns the toes in)
69
- // (no swing toe curl: curled toes lifted the palm's back 5 cm and tipped the wrist forward)
70
- front: { type: 'plantigrade', curl: 0, heelStrike: 3, flex: 6, couple: 1, toeOut: -0.26 },
71
- hind: { type: 'plantigrade', curl: 30, heelStrike: 5, lead: 0.42 },
72
- },
73
- stance: { width: 1, gallopWidth: 0.7, sprawl: 0, crouch: 0, scuff: [11, 18, 0] },
74
- // torso cross-sections (bind, reference size): centre height, half height, half width (incl. coat)
75
- body: {
76
- chest: { y: 0.66, hh: 0.26, hw: 0.28 },
77
- pelvis: { y: 0.7, hh: 0.28, hw: 0.29 },
78
- back: 0.11,
79
- },
80
- head: {
81
- // [speed, raise (m), reach (m), pitch (rad, + = nose down)]: the head hangs at or below the
82
- // withers at rest and in the walk, nose pointing down-forward; stretched forward in the gallop
83
- // (side1, side3 / side4_walk, tq4: walking, the ears at 0.6-0.75 of the hump height and the nose at
84
- // 0.4-0.45, pitched 30-40 deg down; gait1 / gait2: low and forward at the gallop)
85
- carriage: [[0, -0.08, 0.03, 0.34], [1.0, -0.11, 0.04, 0.46], [2.3, -0.12, 0.05, 0.42], [4.5, -0.1, 0.08, 0.32], [9, -0.1, 0.11, 0.28]],
86
- stab: [[0, 0], [0.9, 0.2], [1.8, 0.26], [4.5, 0.32], [9, 0.55]],
87
- neckBend: 34, neckPivot: 0.55, yaw: 1.0, pitchUp: 0.7, pitchDown: 0.7,
88
- },
89
- tail: {
90
- // the stub hangs over the anus; lifts a little at a gallop
91
- carriage: [[0, [-45, -70]], [4, [-30, -50]], [10, [-15, -30]]],
92
- stiffness: 1.6, sway: 3, flick: 0, wag: 0, swish: 0, curl: 0, balance: 0,
93
- radius: [0.06, 0.05],
94
- },
95
- ears: { rest: [0, 0], mobility: 0.6, speedFlatten: 0.5, flattenSpeeds: [4, 12], twitch: 0.8, prick: 0.3 },
96
- breath: { rate: 0.22, amp: 0.01, pant: true, pantRate: 1.6, pantAmp: 0.035, heatSpeed: 5 },
97
- actions: {
98
- attack: { style: 'charge' },
99
- eat: { style: 'graze', dropF: 0.12, dropH: 0.0, ahead: 0.45 },
100
- drink: { dropF: 0.2, dropH: 0.02, ahead: 0.45 },
101
- jump: { height: 0.45, distance: 1.8, land: [0.25, 0.2] },
102
- sit: {},
103
- lie: { dropF: 0.65 },
104
- sleep: { style: 'curl', dropF: 0.65 },
105
- idle: { shift: 1.2 },
106
- // lying sternal: the forearms forward along the ground with the palms flat (plantigrade), the paws
107
- // a little ahead of the chest and the elbows at its sides (at 0.42 leg lengths ahead of the shoulder
108
- // the humerus swung forward level with the ground, a sphinx, and stretched the brisket 3x); the palm
109
- // tilted 1.0 rad (at 1.15 it dipped 1 cm into the ground as the bear rose from sleep: 0.97 % S)
110
- fold: { front: { z: 0.2, k: -1.0, beta: 0 } },
111
- },
112
- };
@@ -1,78 +0,0 @@
1
- // Meshing plan: body at 7.8 mm (0.78 % of the hump height), head at 3.6 mm overlapping the body
2
- // across the upper neck and cross-faded, eyelid patches at 1.2 mm, and the lower jaw as its own
3
- // surface so the mouth can open.
4
- import { bearJoints, HEAD_O, hlOf } from './rig.js';
5
- import { eyeOf } from './sculpt.js';
6
- import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
7
- import { lerp, norm, sub, smoothstep } from '../../core/math/vec.js';
8
-
9
- // the neck cut is fixed in reference space (joints of the reference individual)
10
- const J0 = bearJoints();
11
- export const NECK_CUT = (() => {
12
- const d = norm(sub(J0.occiput, J0.neckMid));
13
- const c = lerp(J0.neckMid, J0.occiput, 0.55);
14
- return { c, d, band: 0.02 };
15
- })();
16
- export const neckS = (x, y, z) => (x - NECK_CUT.c[0]) * NECK_CUT.d[0] + (y - NECK_CUT.c[1]) * NECK_CUT.d[1] + (z - NECK_CUT.c[2]) * NECK_CUT.d[2];
17
-
18
- export const eyeCentres = (params) => [1, -1].map((s) => eyeFrameOf(eyeOf(params), HEAD_O, s).c);
19
- const PATCH = { R: 0.024, B: 0.005, h: 0.0012 };
20
- // the nose pad re-meshed finer (nostrils ~13 mm across, a 5 mm groove: at the head's 3.6-7.2 mm cells they were
21
- // dimples or nothing), at every tier with shells (hero 1.8 mm, high 2.3 mm, medium 3.6 mm)
22
- const NOSE_PATCH = { R: 0.04, B: 0.005, h: 0.0018 };
23
- export const eyePatchesAt = (Q) => !!Q && (Q.eyePatches || Q.res <= 2.01);
24
- export const noseCentre = (params) => hlOf(params.muzzle || 1, params.headW || 1)([0, -0.002, 0.212]);
25
- function patchWeight(patches, x, y, z) {
26
- let w = 0;
27
- for (const p of patches) w = Math.max(w, 1 - smoothstep(p.R - p.B, p.R + p.B, Math.hypot(x - p.c[0], y - p.c[1], z - p.c[2])));
28
- return w;
29
- }
30
-
31
- export function bearRegions(rig, params, Q) {
32
- const r = Q.res;
33
- // the cross-fade band is at least 1.5 body cells wide on either side of the cut: at the coarse tiers
34
- // a 2 cm band was a single body cell and the body's clipped edge showed at the side of the neck
35
- const B = Math.max(NECK_CUT.band, 1.5 * 0.0078 * r);
36
- // each mesh carries on past the far side of the band, hidden (fade 0): the skin weights relax the axial coordinate
37
- // over each mesh on its own, and near a mesh's edge that average is one-sided (in the band the head mesh took up to
38
- // 11 % more head weight than the body mesh at the same place, 20 % at medium), so in a look turn the two copies of
39
- // the skin parted by up to 6 mm: the head's surface sank under the body's seam skirt, its hair's roots under the
40
- // body's base, a bald trench behind the ear edged by the standing ruff. With the edges 4 body cells and
41
- // 3 head cells past the band the copies agree to ~1 % there (at medium the body's extension only: the budget)
42
- const XB = Math.min(0.062, 4 * 0.0078 * r), XH = r > 1.5 && r < 2.5 ? 0 : Math.min(0.022, 3 * 0.0036 * r);
43
- const centres = eyeCentres(params);
44
- // (eyelid patches down to medium, which Safari on a Mac and phones show: without them the aperture was meshed at the
45
- // 7.2 mm head cell, a ragged polygon with white slivers on its lower rim; medium 2.4 mm)
46
- // (the cross-fade band at least a head cell wide, and the eye patch's inner radius keeping the aperture rim, ~16 mm,
47
- // and the painted lid margin; at medium the cells a little coarser than the tier's res alone: the vertex budget)
48
- const bandOf = (b) => Math.max(b, 1.05 * 0.0036 * r);
49
- const hK = r > 1.5 ? 1.15 : 1;
50
- const eB = bandOf(PATCH.B), nB = bandOf(NOSE_PATCH.B);
51
- const patches = eyePatchesAt(Q) ? centres.map((c) => ({ c, R: Math.max(PATCH.R, 0.018 + eB), B: eB, h: PATCH.h * Math.max(1, r) * hK })) : [];
52
- // (at medium the pad at 2.7 mm in a slightly smaller patch, and the head's cells 5 % coarser for the budget: at
53
- // 4.1 mm the nostrils were jagged polygons flecked with pale facets)
54
- // (at medium the body's cells 2 % coarser: the claws' own surfaces, claws.js, ~520 vertices there)
55
- const med = r > 1.5 && r < 2.5;
56
- if (r <= 2.01) patches.push(med ? { c: noseCentre(params), R: 0.036, B: nB, h: 0.0027 } : { c: noseCentre(params), R: NOSE_PATCH.R, B: nB, h: NOSE_PATCH.h * Math.max(1, r) * hK });
57
- const zN = rig.J.nose[2] + 0.04;
58
- return {
59
- jobs: [
60
- [{ name: 'body', part: 'body', bmin: [-0.4, -0.02, -0.82], bmax: [0.4, 1.08, 0.78], h: 0.0078 * r * (med ? 1.02 : 1), F: 4, clip: (x, y, z) => neckS(x, y, z) < B + XB }],
61
- [
62
- // (the box's top clears the tips of the black bear's big ears)
63
- { name: 'head', part: 'body', bmin: [-0.22, 0.54, 0.46], bmax: [0.22, 1.12, zN], h: 0.0036 * r * (med ? 1.05 : 1), F: 6, clip: (x, y, z) => neckS(x, y, z) > -B - XH, patches },
64
- { name: 'jaw', part: 'jaw', bmin: [-0.1, 0.62, 0.6], bmax: [0.1, 0.78, zN], h: 0.0036 * r, F: 6, rigidBone: 'jaw' },
65
- ],
66
- ],
67
- fade(x, y, z, name, patch) {
68
- const sN = neckS(x, y, z);
69
- if (name === 'body') return 1 - smoothstep(-B, B, sN);
70
- if (name === 'head') {
71
- let f = smoothstep(-B, B, sN);
72
- if (patches.length) { const pw = patchWeight(patches, x, y, z); f *= patch ? pw : 1 - pw; }
73
- return f;
74
- }
75
- return 1;
76
- },
77
- };
78
- }
@@ -1,112 +0,0 @@
1
- // Brown bear skeleton in bind pose (metres). Forward = +Z, up = +Y, the animal's left = +X.
2
- //
3
- // Reference individual: an average adult (between the sexes, ~200 kg), hump height with the coat
4
- // ~1.0 m, nose to rump ~1.7 m, head ~0.36 m (occiput -> nose with soft tissue). Graviportal,
5
- // plantigrade limbs with long proximal and short distal segments: scapula 0.30,
6
- // humerus 0.30, radius 0.28, carpus + metacarpus 0.12 (lying almost flat: the palm is on the
7
- // ground), femur 0.38, tibia 0.30, tarsus + metatarsus 0.18 (flat: heel on the ground). The
8
- // forelegs stand as near-vertical columns under the hump, elbows under the chest; the hind legs
9
- // are straight-ish (stifle ~150 deg). The head is modelled level in its own frame (HEAD_O); the
10
- // low head carriage comes from the motion data.
11
- import { buildRig } from '../../core/rig/rig.js';
12
- import { quadrupedBones, quadrupedLimbs, tailChain } from '../../core/rig/quadruped.js';
13
-
14
- export const TAIL_SEGS = 2;
15
- export const HEAD_O = [0, 0.78, 0.72]; // head-local origin (mid cranium, between the eyes and the ears)
16
- export const SH = 1.0; // reference hump height (with the coat)
17
- export const MUZZLE_Z0 = 0.06; // head-local z where the muzzle starts (muzzle length variation acts ahead of it)
18
-
19
- // head-local -> reference space, with per-individual muzzle length and head width factors
20
- export const hlOf = (m = 1, w = 1) => (v) => [HEAD_O[0] + v[0] * w, HEAD_O[1] + v[1], HEAD_O[2] + (v[2] > MUZZLE_Z0 ? MUZZLE_Z0 + (v[2] - MUZZLE_Z0) * m : v[2])];
21
-
22
- export function bearJoints(params = {}) {
23
- const hl = hlOf(params.muzzle || 1);
24
- const earK = params.ear || 1, hw = params.headW || 1;
25
- const J = {
26
- nose: hl([0, -0.012, 0.215]),
27
- occiput: hl([0, 0.025, -0.125]),
28
- neckMid: [0, 0.79, 0.49],
29
- neckBase: [0, 0.81, 0.35],
30
- chestMid: [0, 0.845, 0.14],
31
- thoraxRear: [0, 0.835, -0.04],
32
- lumbarMid: [0, 0.825, -0.2],
33
- lumbosacral: [0, 0.815, -0.34],
34
- tailBase: [0, 0.78, -0.48],
35
- // forelimb: the point of the shoulder low at the front of the chest (~0.64 of the hump height), the
36
- // humerus sloping back ~35 deg to the elbow at the bottom of the chest, the forearm a column leaning
37
- // a little forward to the flat palm. Standing, the leg is at 0.915 of its length (elbow ~132 deg,
38
- // like the other quadrupeds' 0.94 / 140 deg): at 0.98 (158 deg) the shoulder stood higher above the
39
- // wrist than the IK's 95 % reach and a planted forepaw was out of reach at once (fore stance 7 % of
40
- // a walking stride, 3 % of a gallop)
41
- scapTopL: [0.075, 0.9, 0.2],
42
- // (fore stance 0.31 m centre to centre, research 2.2: 0.30-0.38 m; at 0.29 the forelegs stood close
43
- // together under a chest ~20 % narrower than tq2's)
44
- shoulderL: [0.152, 0.635, 0.38],
45
- elbowL: [0.167, 0.38, 0.205],
46
- wristL: [0.157, 0.078, 0.275],
47
- mcpL: [0.157, 0.034, 0.395],
48
- ftoeL: [0.157, 0.012, 0.515],
49
- // hind limb: long near-vertical femur, tibia sloping back, heel (hock) close to the ground
50
- // (the heel stands under the back of the rump, side1 / side2 / side3: 5 cm further back than before,
51
- // when the rump overhung the hind feet by a fifth of the body length)
52
- hipL: [0.115, 0.77, -0.32],
53
- kneeL: [0.175, 0.4, -0.195],
54
- hockL: [0.157, 0.09, -0.41],
55
- mtpL: [0.157, 0.034, -0.24],
56
- htoeL: [0.157, 0.012, -0.145],
57
- jawHinge: hl([0, -0.045, -0.04]),
58
- jawTip: hl([0, -0.08, 0.172]),
59
- // ears on the top corners of the head, wide apart (face1 / face2: ear centres 1.0-1.3 x the eye
60
- // separation from the midline), over the back of the zygomatic arches; they follow the head's width
61
- // (1 cm further out and lower, leaning out more: face1 / face2 / tq2 show the ears on the outer corners of a broad,
62
- // flat forehead; on top of the skull they framed a round ball of a head)
63
- earBaseL: hl([0.122 * hw, 0.082, -0.05]),
64
- // (the tip 1 cm lower than before: in profile the ears stood tall over the head line, side1 / face3_profile show them
65
- // short and round)
66
- earTipL: hl([0.122 * hw + 0.03 * earK, 0.082 + 0.062 * earK, -0.05 - 0.012 * earK]),
67
- };
68
- // the stubby tail hangs down over the anus, hidden in the rump fur
69
- tailChain(J, 'tailBase', [-40, -62], [0.055, 0.05].map((l) => l * (params.tail || 1)));
70
- return J;
71
- }
72
-
73
- // the thick wrist of a plantigrade forefoot blends over a wide region (the carpus flexes 60-90 deg
74
- // in the swing; a narrow distal blend creased the skin behind it). The foreleg's field ends 8 cm from
75
- // the body (aBody): at -0.14 it spread humerus weight up the short neck to the head / neck cut, where
76
- // the head's own copy of the skin has none, and the two copies split apart whenever the head moved
77
- // (sniff 53 mm; now <= 9 mm).
78
- function bearLimbs() {
79
- const L = quadrupedLimbs({
80
- front: { tCore: 0.68, aCore: 0.08, aBody: -0.06, midX: 0.0 },
81
- hind: { tCore: 0.75, aCore: 0.07, aBody: -0.14, midX: 0.008 },
82
- });
83
- for (const S of ['L', 'R']) L['F' + S].distal = ['fpaw' + S];
84
- return L;
85
- }
86
-
87
- export function bearRig(params = {}) {
88
- const J = bearJoints(params);
89
- return buildRig({
90
- joints: J,
91
- unit: SH / 0.76,
92
- headOrigin: HEAD_O,
93
- bones: quadrupedBones({ tailSegs: TAIL_SEGS, ears: true, jaw: true }),
94
- axial: {
95
- points: ['nose', 'occiput', 'neckMid', 'neckBase', 'chestMid', 'thoraxRear', 'lumbarMid', 'lumbosacral', 'tailBase', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + (i + 1))],
96
- bones: ['head', 'neck2', 'neck1', 'chest', 'spine3', 'spine2', 'spine1', 'pelvis', ...Array.from({ length: TAIL_SEGS }, (_, i) => 'tail' + i)],
97
- // the skull's influence reaches back into the thick nape and the cheek ruff; the throat
98
- // stretches most when the head goes down (rooting, drinking, sleeping on the paws). The blend
99
- // starts at the occiput: the skin at the lips must move with the head alone, like the rigid
100
- // lower jaw below it (an earlier start with a longer lever gave the mouth corners 17 % neck
101
- // weight, and the lips opened 3 cm off the jaw when the head turned)
102
- blend: { 1: [0.0, 0.16, 1.5] },
103
- bodyTail: 0,
104
- },
105
- limbs: bearLimbs(),
106
- appendages: [
107
- { group: 'earL', bone: 'earL', blend: [-0.012, 0.018] },
108
- { group: 'earR', bone: 'earR', blend: [-0.012, 0.018] },
109
- ],
110
- webTags: ['flankfold', 'thighfront', 'scapmuscle', 'armpit'],
111
- });
112
- }