@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,250 +0,0 @@
1
- // The eagle's plumage and bare parts, baked per vertex: contour-feather shingles (material 9), a short
2
- // down haze (shells), yellow keratin bill and waxy cere, scaled yellow tarsi and toes, black talons.
3
- // Adult bald eagle: dark chocolate body and wings, white head, neck and tail with a ragged hood edge.
4
- // Juvenile bald eagle: brown with white mottling (belly, underwing, armpits), dark head, dark bill.
5
- // Golden eagle: dark brown with a golden crown and nape, pale-edged wing coverts, grey-barred tail,
6
- // dark-tipped blue-grey bill, legs feathered to the toes; juveniles with a white tail base and black
7
- // band. Colours sampled from the reference photos. Seeded variation shifts tones, wear and
8
- // the juvenile mottling.
9
- import { SDFModel } from '../../core/sdf/sdf.js';
10
- import { norm, sub, dot, cross, add, mul, clamp, smoothstep, mix, fbm3 } from '../../core/math/vec.js';
11
- import { srgb, mix3, MAT } from '../../core/build/coatKit.js';
12
- import { HEAD_O } from './rig.js';
13
-
14
- export function eagleColours(p = {}) {
15
- const golden = p.variant === 'golden', juv = p.age === 'juvenile';
16
- const warm = p.warm || 0, wear = p.wear || 0;
17
- const tone = (c) => mix3(c, srgb(0x5a4430), wear * 0.25 + warm * 0.1);
18
- if (golden) {
19
- return {
20
- golden, juv,
21
- body: tone(srgb(juv ? 0x33251b : 0x3a2a1e)), under: tone(srgb(juv ? 0x2e2118 : 0x34261b)),
22
- head: srgb(0x3a2a1e), nape: mix3(srgb(0xc08a3e), srgb(0xd9a650), p.goldK ?? 0.5), face: srgb(0x33251b),
23
- covertEdge: srgb(0x8a6a48), white: srgb(0xe6e1d6), mottle: 0,
24
- tail: srgb(0x4a3e34), tailBar: srgb(0x6e665c), tailBase: srgb(0xedeae2), tailBand: srgb(0x1e1a18),
25
- bill: srgb(0x4c5258), billTip: srgb(0x141416), cere: srgb(0xe8c040), gape: srgb(0xd8b040),
26
- leg: srgb(0xe8c040), boot: tone(srgb(0x6a4a30)), claw: srgb(0x161616), ring: srgb(0x4a3a2a),
27
- hoodWhite: false, whiteTail: false,
28
- };
29
- }
30
- const bill = juv ? mix3(srgb(0x2e2a28), srgb(0xb89a58), p.billAge || 0) : srgb(0xecc46f);
31
- return {
32
- golden, juv,
33
- body: tone(srgb(juv ? 0x3a2a1e : 0x2b1e16)), under: tone(srgb(juv ? 0x3a2b20 : 0x2a1d15)),
34
- head: juv ? srgb(0x2e2218) : srgb(0xf2f0ea), nape: juv ? srgb(0x3a2a1e) : srgb(0xf2f0ea), face: juv ? srgb(0x3a2c20) : srgb(0xeeece6),
35
- covertEdge: srgb(0x4a3828), white: srgb(0xe0d8c8), mottle: juv ? (p.mottle ?? 0.5) : 0,
36
- tail: juv ? srgb(0x4a3a2c) : srgb(0xf4f2ec), tailBar: srgb(0x4a3a2c), tailBase: srgb(0xf4f2ec), tailBand: srgb(0x2a1e16),
37
- bill, billTip: bill, cere: juv ? mix3(srgb(0x7a6a50), srgb(0xd8b450), p.billAge || 0) : srgb(0xedc45a),
38
- gape: juv ? srgb(0x8a7a60) : srgb(0xe8c060),
39
- leg: srgb(juv ? 0xe8b840 : 0xf0b830), boot: null, claw: srgb(0x161616), ring: juv ? srgb(0x5a4a38) : srgb(0xd8c078),
40
- hoodWhite: !juv, whiteTail: !juv,
41
- };
42
- }
43
-
44
- export function eagleCoat(ctx) {
45
- const { model, rig, pos, nrm, regionOf, regionNames, weights, nV, params } = ctx;
46
- const { BONES, J } = rig;
47
- const C = eagleColours(params);
48
- const comb = new Float32Array(nV * 3), tint = new Float32Array(nV * 4), surf = new Float32Array(nV * 4);
49
- const furLen = new Float32Array(nV), mark = new Float32Array(nV).fill(1), pattern = new Float32Array(nV).fill(1);
50
- const patternColor = new Float32Array(nV * 4);
51
- const boneName = BONES.map((b) => b.name);
52
- const tagged = (...t) => model.prims.filter((p) => t.includes(p.tag));
53
- const billP = tagged('bill'), cereP = tagged('cere'), nostrilP = tagged('nostril'), mandP = model.forPart('jaw');
54
- const eyeP = tagged('eyesocket'), clawP = tagged('claw'), bareP = tagged('tarsus', 'toe', 'pad'), featherLegP = tagged('cuff', 'boot', 'trousers');
55
- const minD = (list, p) => { let d = 1e9; for (const q of list) d = Math.min(d, SDFModel.dist(q, p[0], p[1], p[2])); return d; };
56
- const H = HEAD_O;
57
- const axialPts = rig.AXIAL.points;
58
- const axialDir = (p) => {
59
- let best = 1e9, dir = [0, 0, -1];
60
- for (let i = 0; i < axialPts.length - 1; i++) {
61
- const a = axialPts[i], b = axialPts[i + 1], ab = sub(b, a), l2 = dot(ab, ab);
62
- const t = clamp(dot(sub(p, a), ab) / l2, 0, 1);
63
- const q = add(a, mul(ab, t)), d = Math.hypot(p[0] - q[0], p[1] - q[1], p[2] - q[2]);
64
- if (d < best) { best = d; dir = norm(ab); }
65
- }
66
- return dir;
67
- };
68
- // hood edge (bald adult): along the neck from the neck base (0) to the occiput (1), ragged
69
- const nb = J.neckBase, nd = sub(J.occiput, J.neckBase), nl2 = dot(nd, nd);
70
- const hoodT = (p) => dot(sub(p, nb), nd) / nl2;
71
- // bald adult white hood: everything within a ragged radius of a point at the back of the skull, so the
72
- // white ends at the base of the neck all round, the throat as cleanly as the nape (a plane across the
73
- // neck, t above, left the throat white far down onto the breast once the body is levelled in flight).
74
- // Flight photos: the white reaches ~0.21 m back from the bill tip, the dark breast
75
- // begins where the neck meets the body.
76
- const hoodC = add(J.occiput, [0, -0.008, 0.01]);
77
- const hoodR = 0.1 - ((params.hood ?? 0.26) - 0.26) * 0.15;
78
- const tailDir = norm(sub(J.tailTip, J.tailBase));
79
- const seed = (params.seed || 1) * 0.37;
80
- for (let v = 0; v < nV; v++) {
81
- const p = [pos[v * 3], pos[v * 3 + 1], pos[v * 3 + 2]], n = [nrm[v * 3], nrm[v * 3 + 1], nrm[v * 3 + 2]];
82
- const bn = boneName[weights.dominant[v]] || '';
83
- const region = regionNames[regionOf[v]];
84
- let col = C.body, mat = MAT.FEATHER, fl = 0.006, gloss = 0.35, size = 0.022;
85
- let flow = axialDir(p);
86
- const h = [p[0] - H[0], p[1] - H[1], p[2] - H[2]];
87
- const up = n[1];
88
- let mottleOK = 0; // where juvenile white mottling may appear
89
- if (region === 'jaw' || bn === 'jaw') {
90
- mat = MAT.KERATIN; col = mix3(C.bill, C.billTip, smoothstep(0.05, 0.085, h[2])); fl = 0; gloss = C.golden || C.juv ? 0.26 : 0.4; size = 0;
91
- flow = [0, 0, 1];
92
- if (h[2] < 0.012) { mat = MAT.SKIN; col = C.gape; gloss = 0.35; }
93
- } else if (bn === 'head' || region === 'head') {
94
- col = C.head; size = 0.0055; gloss = 0.3; fl = 0.006;
95
- flow = norm([0, -0.2, -1]);
96
- if (Math.abs(h[0]) > 0.01) flow = norm([h[0] * 6, -0.35, -1]);
97
- if (C.golden) {
98
- col = C.face; // (the golden crown and nape are laid on below, continuous with the neck)
99
- } else if (C.juv) {
100
- // juvenile: dark head with a paler, streaky cheek and throat
101
- col = mix3(C.head, C.face, smoothstep(0.0, -0.03, h[1]));
102
- }
103
- if (h[2] < -0.04) fl = 0.009; // lanceolate hackles on the nape
104
- const db = minD(billP, p), dc = minD(cereP, p), dn = minD(nostrilP, p), dm = minD(mandP, p);
105
- // (surface points on the smooth-union blend lie up to ~3 mm from the nearest primitive)
106
- const bare = Math.min(db, dc) < 0.003 && h[2] > 0.024;
107
- if (bare && db < dc - 0.0005 && h[2] > 0.045) {
108
- mat = MAT.KERATIN; fl = 0; gloss = C.golden || C.juv ? 0.26 : 0.4; flow = [0, 0, 1]; size = 0;
109
- col = mix3(C.bill, C.billTip, smoothstep(0.07, 0.098, h[2]));
110
- } else if (bare) {
111
- mat = MAT.SKIN; col = C.cere; fl = 0; gloss = 0.45; flow = [0, 0, 1]; size = 0;
112
- if (dn < 0.0025) col = mul(C.cere, 0.25);
113
- } else if (dm < 0.0015 && h[2] > 0.0) { mat = MAT.SKIN; col = C.gape; fl = 0; }
114
- else if (h[2] > 0.012 && h[1] < 0.004 && Math.abs(h[0]) < 0.022) {
115
- // lores: short bristly feathers between eye and cere
116
- fl = 0.0025; size = 0.004; flow = norm([h[0] * 4, -0.1, -1]);
117
- }
118
- // eye ring: narrow bare skin at the lid margin, very short feathers around it
119
- for (const e of eyeP) {
120
- const de = SDFModel.dist(e, p[0], p[1], p[2]);
121
- if (Math.abs(de) < 0.0012) { mat = MAT.SKIN; col = C.ring; fl = 0; gloss = 0.4; }
122
- else if (Math.abs(de) < 0.004) { fl = Math.min(fl, 0.0015); size = 0.004; }
123
- }
124
- } else if (/^(tarsus|toe)/.test(bn) || (bn.startsWith('tibia') && minD(bareP, p) < 0.001)) {
125
- const dFeather = minD(featherLegP, p), dBare = minD(bareP, p);
126
- if (dFeather < dBare - 0.0015 && /^tarsus/.test(bn)) {
127
- // feathered tarsus: the cuff below the trousers (bald) or the golden eagle's boot
128
- col = C.boot || C.under; fl = 0.007; size = 0.012; gloss = 0.3; flow = [0, -1, 0.1];
129
- mottleOK = 0.5;
130
- } else {
131
- mat = MAT.SCALES; col = C.leg; fl = 0; gloss = 0.4; size = 0.006; flow = [0, -1, 0];
132
- if (minD(clawP, p) < 0.0008) { mat = MAT.KERATIN; col = C.claw; gloss = 0.7; size = 0; }
133
- if (/^toe/.test(bn)) { const b = BONES[weights.dominant[v]]; flow = norm(sub(b.tail, b.head)); size = 0.0045; }
134
- }
135
- } else if (bn.startsWith('tibia') || bn.startsWith('femur')) {
136
- // feathered "trousers": soft, loose, pointing down the leg
137
- col = C.golden ? mix3(C.under, C.boot, 0.5) : C.under; fl = 0.009; size = 0.016; gloss = 0.28;
138
- flow = [0, -1, -0.15]; mottleOK = 0.7;
139
- } else if (/^(humerus|ulna|hand)/.test(bn)) {
140
- // wing coverts: lie toward the trailing edge
141
- const b = BONES[weights.dominant[v]];
142
- const S = b.side === 'R' ? 'R' : 'L';
143
- const d = norm(sub(b.tail, b.head));
144
- let wn = norm(cross(sub(J['elbow' + S], J['shoulder' + S]), sub(J['wrist' + S], J['elbow' + S])));
145
- if (wn[1] < 0) wn = mul(wn, -1);
146
- const s = S === 'R' ? -1 : 1;
147
- flow = mul(norm(cross(wn, d)), s);
148
- size = 0.018; fl = 0.005;
149
- const top = dot(n, wn);
150
- if (top < 0) { col = C.under; mottleOK = 1; } // underwing coverts / armpits
151
- else if (C.golden) col = mix3(C.body, C.covertEdge, 0.22 * smoothstep(0.2, 0.8, top));
152
- } else if (bn === 'tail') {
153
- // tail coverts: white on the adult bald eagle from ~3 cm behind the base of the tail (where the
154
- // rectrices emerge) back; the rump and vent in front of it stay dark, as in the flight photos (the
155
- // white used to start at the tail joint and read as a pale wedge in front of the tail)
156
- const dorsal = smoothstep(-0.2, 0.5, up);
157
- col = mix3(C.under, C.body, dorsal); size = 0.02; fl = 0.006;
158
- if (C.whiteTail) {
159
- const u = dot(sub(p, J.tailBase), tailDir) + (fbm3(p[0] * 70 + seed, p[1] * 70, p[2] * 70, 2) - 0.5) * 0.012;
160
- col = mix3(col, C.tail, smoothstep(0.02, 0.036, u));
161
- } else mottleOK = 0.6;
162
- } else {
163
- // body: dark back and mantle, the breast and belly a shade warmer
164
- const dorsal = smoothstep(-0.2, 0.5, up);
165
- col = mix3(C.under, C.body, dorsal);
166
- size = 0.024; fl = 0.007;
167
- mottleOK = 1 - dorsal * 0.7;
168
- if (bn === 'chest' && up < 0.2) flow = norm(add(flow, [0, -0.7, 0]));
169
- }
170
- // hood: bald adult white head and upper neck with a ragged edge; golden eagle golden crown, nape and
171
- // hind neck (one rule for the head and the neck meshes, so the colour is continuous across the cut)
172
- if ((bn.startsWith('neck') || bn === 'chest' || bn === 'head' || region === 'head') && mat === MAT.FEATHER) {
173
- const t = hoodT(p);
174
- const jag = (fbm3(p[0] * 60 + seed, p[1] * 60, p[2] * 60, 3) - 0.5) * 0.35;
175
- const h0 = params.hood ?? 0.26;
176
- let hood = smoothstep(h0, h0 + 0.1, t + jag);
177
- if (C.hoodWhite) {
178
- const r = Math.hypot(p[0] - hoodC[0], p[1] - hoodC[1], p[2] - hoodC[2]) + jag * 0.05;
179
- hood = smoothstep(hoodR + 0.008, hoodR - 0.004, r);
180
- col = mix3(col, mix3(C.head, srgb(0xd4d2cc), 0.3 * smoothstep(-0.1, -0.7, n[1]) * smoothstep(0.9, 1.2, t)), hood);
181
- }
182
- else if (C.golden) {
183
- const gw = smoothstep(0.45, 0.8, t + jag * 0.5) * smoothstep(-0.25, 0.45, -0.8 * n[2] + 0.6 * n[1]) * smoothstep(0.035, 0.0, h[2]);
184
- col = mix3(col, C.nape, gw);
185
- } else if (bn !== 'head' && region !== 'head') col = mix3(col, C.head, hood * 0.7);
186
- if (hood > 0.5 && bn !== 'head' && region !== 'head') { fl = 0.008; size = 0.012; }
187
- mottleOK *= 1 - smoothstep(0.2, 0.5, t);
188
- }
189
- // juvenile mottling: irregular white blotches on the underparts, armpits and trousers
190
- if (C.mottle > 0 && mottleOK > 0 && mat === MAT.FEATHER) {
191
- const m = fbm3(p[0] * 48 + seed * 3, p[1] * 48, p[2] * 48, 4);
192
- const thr = 0.68 - 0.2 * C.mottle * mottleOK;
193
- const d = (thr - m) * 0.04; // metres-ish (< 0 inside a blotch)
194
- pattern[v] = clamp(d, -0.02, 0.02);
195
- patternColor[v * 4] = C.white[0]; patternColor[v * 4 + 1] = C.white[1]; patternColor[v * 4 + 2] = C.white[2];
196
- patternColor[v * 4 + 3] = 0.6 * mottleOK;
197
- }
198
- // low-frequency variation (wear, sun-bleached feather tips)
199
- const cv = fbm3(p[0] * 18, p[1] * 18, p[2] * 18, 3) - 0.5;
200
- const kk = mat === MAT.FEATHER ? 0.3 : 0.08;
201
- col = [col[0] * (1 + kk * cv), col[1] * (1 + kk * cv), col[2] * (1 + kk * 0.9 * cv)];
202
- const f = sub(flow, mul(n, dot(flow, n)));
203
- const fN = norm(Math.hypot(...f) > 1e-6 ? f : cross(n, [1, 0, 0]));
204
- comb.set(fN, v * 3);
205
- tint[v * 4] = col[0]; tint[v * 4 + 1] = col[1]; tint[v * 4 + 2] = col[2]; tint[v * 4 + 3] = mat;
206
- furLen[v] = fl;
207
- surf[v * 4] = gloss; surf[v * 4 + 1] = size; surf[v * 4 + 2] = 0; surf[v * 4 + 3] = mat === MAT.FEATHER ? 0.03 : 0;
208
- }
209
- return { comb, tint, pattern, mark, furLen, surf, patternColor };
210
- }
211
-
212
- // flight-feather card colours
213
- export function eagleFeatherColour(params) {
214
- const C = eagleColours(params);
215
- const mot = C.mottle;
216
- return (kind, i, side, t, c, layer) => {
217
- const top = layer > 0;
218
- const covert = kind.endsWith('Covert');
219
- const hsh = (a) => { const x = Math.sin(a * 12.9898 + i * 78.233 + side * 3.1) * 43758.5453; return x - Math.floor(x); };
220
- let rgb = top ? mul(C.body, 0.68) : mix3(C.under, srgb(0x4a3e36), 0.3);
221
- if (kind === 'rectrix' || kind === 'tailCovert') {
222
- if (C.whiteTail) rgb = top ? C.tail : mix3(C.tail, srgb(0xc8c6c0), 0.3);
223
- else if (C.golden && C.juv) rgb = t < 0.62 ? C.tailBase : mix3(C.tailBase, C.tailBand, smoothstep(0.62, 0.7, t));
224
- else if (C.golden) {
225
- // greyish bands across the tail
226
- const bar = smoothstep(0.35, 0.5, Math.sin(t * 5 * Math.PI + 0.6) * 0.5 + 0.5) * (1 - smoothstep(0.8, 0.95, t));
227
- rgb = mix3(C.tail, C.tailBar, bar * (top ? 0.8 : 0.6));
228
- } else {
229
- // juvenile bald: brown, mottled white toward the base and inner webs
230
- rgb = C.tail;
231
- const w = (1 - smoothstep(0.35, 0.85, t)) * mot * (0.4 + 0.6 * hsh(Math.floor(t * 9) + c));
232
- rgb = mix3(rgb, C.white, clamp(w, 0, 0.8));
233
- rgb = mix3(rgb, srgb(0x2a1e16), smoothstep(0.85, 0.97, t) * 0.6);
234
- }
235
- } else if (kind === 'primary' || kind === 'secondary') {
236
- // flight feathers: slightly greyer below, darker tips
237
- if (!top) rgb = mix3(rgb, srgb(0x5a5048), 0.25);
238
- rgb = mix3(rgb, srgb(0x16110d), smoothstep(0.7, 1, t) * 0.35);
239
- if (C.golden && kind === 'secondary' && top) rgb = mix3(rgb, C.tailBar, 0.25 * (Math.sin(t * 14) * 0.5 + 0.5) * (1 - t));
240
- if (C.golden && C.juv && kind === 'primary' && i < 6) rgb = mix3(rgb, C.tailBase, (1 - smoothstep(0.2, 0.45, t)) * 0.9);
241
- if (!C.golden && C.juv && !top) rgb = mix3(rgb, C.white, mot * 0.5 * (1 - smoothstep(0.3, 0.6, t)) * (0.5 + 0.5 * hsh(c * 3)));
242
- } else if (covert) {
243
- if (C.golden && top) rgb = mix3(mul(C.body, 0.8), C.covertEdge, smoothstep(0.6, 1, t) * 0.45);
244
- if (!C.golden && C.juv && !top) rgb = mix3(rgb, C.white, mot * 0.7);
245
- if (!C.golden && C.juv && top) rgb = mix3(rgb, C.white, mot * 0.25 * smoothstep(0.6, 1, t) * hsh(1));
246
- }
247
- const k = 1 + 0.07 * Math.sin(i * 12.9898 + side * 3.1 + t * 2.1);
248
- return { rgb: [rgb[0] * k, rgb[1] * k, rgb[2] * k], gloss: top ? 0.25 : 0.2, irid: 0 };
249
- };
250
- }
@@ -1,76 +0,0 @@
1
- // Eagle (bald eagle Haliaeetus leucocephalus; golden eagle Aquila chrysaetos as `variant: 'golden'`).
2
- // A soaring raptor on the bird body plan (core/motion/bird.js): upright perching carriage, massive
3
- // hooked bill under a heavy brow, huge talons, broad plank wings with deeply slotted primaries.
4
- import { eagleRig, HEAD_O } from './rig.js';
5
- import { sculptEagle, EYE } from './sculpt.js';
6
- import { eagleRegions } from './regions.js';
7
- import { eagleCoat, eagleFeatherColour } from './coat.js';
8
- import { motion, WING, FEATHERS } from './motion.js';
9
- import { featherCards } from '../../core/build/featherCards.js';
10
- import { srgb } from '../../core/build/coatKit.js';
11
-
12
- export default {
13
- id: 'eagle',
14
- name: 'Eagle',
15
- latin: 'Haliaeetus leucocephalus',
16
- group: 'birds',
17
- plan: 'bird',
18
- covering: 'feathers',
19
- variants: ['bald', 'golden'],
20
-
21
- // Seeded individual. Reversed size dimorphism: females ~25-35 % heavier, ~8-10 % larger linearly.
22
- // Age: ~30 % of seeds are juveniles (bald: brown with white mottling, dark head and bill, brown
23
- // iris; golden: white tail base with a black band and white wing patches). Individuals differ in
24
- // size, bill size, leg length, head size, girth, plumage tone, wear and mottling.
25
- variation(R, o) {
26
- const g = () => (R() + R() + R() - 1.5) / 1.5;
27
- const variant = o.variant === 'golden' ? 'golden' : 'bald';
28
- const sex = o.sex || (R() < 0.5 ? 'male' : 'female');
29
- const age = o.age || (R() < 0.3 ? 'juvenile' : 'adult');
30
- const juv = age === 'juvenile';
31
- const size = (sex === 'female' ? 1.04 : 0.94) * (1 + 0.035 * g()) * (variant === 'golden' ? 0.96 : 1);
32
- const bill = (sex === 'female' ? 1.03 : 0.98) * (1 + 0.05 * g()) * (variant === 'golden' ? 0.94 : 1);
33
- return {
34
- sex, age, size, variant,
35
- warps: [
36
- { type: 'legs', k: 1 + 0.035 * g(), top: 0.24 },
37
- // bill length / depth about the bill base (golden eagle: a smaller bill)
38
- { type: 'scaleAbout', c: [HEAD_O[0], HEAD_O[1] - 0.012, HEAD_O[2] + 0.045], k: bill, r0: 0.05, r1: 0.1 },
39
- { type: 'scaleAbout', c: HEAD_O, k: (1 + 0.03 * g()) * (variant === 'golden' ? 0.95 : 1), r0: 0.06, r1: 0.12 },
40
- // (girth: +-3.5 %, juveniles +1 % for their looser plumage - they read heavy at +3 %)
41
- { type: 'girth', k: 1 + 0.035 * g() + (juv ? 0.01 : 0), cy: 0.32, z0: -0.14, z1: 0.1, fade: 0.06 },
42
- ],
43
- wear: Math.max(0, 0.3 * g() + (juv ? 0.35 : 0.1)),
44
- warm: 0.5 + 0.5 * g(),
45
- mottle: juv ? 0.55 + 0.35 * g() : 0,
46
- billAge: juv ? Math.max(0, 0.25 * g()) : 1,
47
- goldK: 0.5 + 0.4 * g(),
48
- hood: 0.26 + 0.07 * g(), // how far down the neck the white hood reaches
49
- };
50
- },
51
- rig: () => eagleRig(),
52
- sculpt: (m, rig, params) => sculptEagle(m, rig, params),
53
- regions: eagleRegions,
54
- coat: eagleCoat,
55
- surfaces: (ctx) => featherCards({ ...ctx, wing: WING, feathers: FEATHERS, tail: { bindFan: 0.2 }, colour: eagleFeatherColour(ctx.params), thickness: 0.0009 }),
56
- eyeSpecs: (params) => [1, -1].map((side) => ({ side, spec: EYE, headOrigin: HEAD_O, bone: 'head', look: eyeLook(params) })),
57
- motion,
58
- render: { markColor: srgb(0x1a140f), strandDensity: 700, clumpDensity: 1.2, shellScale: 1, finWidth: 0.3 },
59
- };
60
-
61
- // Round pupil; bald adult: pale yellow iris; juveniles and golden eagles: brown. Bird lids with a
62
- // nictitating membrane.
63
- const EYE_BASE = {
64
- pupil: 'round',
65
- lids: 'bird',
66
- sclera: { visible: false, color: [0.02, 0.02, 0.02] },
67
- pupilSize: [0.34, 0.5],
68
- };
69
- export function eyeLook(p = {}) {
70
- const golden = p.variant === 'golden', juv = p.age === 'juvenile';
71
- let iris;
72
- if (!golden && !juv) iris = { inner: srgb(0xd9c878), mid: srgb(0xf2e6a0), hi: srgb(0xfaf2c8), outer: srgb(0xa89048) };
73
- else if (golden && !juv) iris = { inner: srgb(0x5a3414), mid: srgb(0x8a5a28), hi: srgb(0xb07a3c), outer: srgb(0x3a2410) };
74
- else iris = { inner: srgb(0x241408), mid: srgb(0x4a2c14), hi: srgb(0x6a4424), outer: srgb(0x1c1008) };
75
- return { ...EYE_BASE, iris, lidColor: golden || juv ? srgb(0x4a3a2a) : srgb(0xc8b070) };
76
- }
@@ -1,3 +0,0 @@
1
- // Reference-pose joints of the eagle (see rig.js), exported for modules that need fixed landmarks.
2
- import { eagleJoints } from './rig.js';
3
- export const J = eagleJoints();
@@ -1,137 +0,0 @@
1
- // Eagle motion data for the bird engine (schema: src/core/motion/bird.js). Numbers are for the
2
- // reference individual (params.size = 1: ~4.7 kg adult bald eagle, 0.86 m bill to tail, span ~2.1 m);
3
- // the engine scales them by dynamic similarity.
4
- //
5
- // Ground: eagles walk rarely and awkwardly (a rolling, wide-footed waddle with the talons lifted high)
6
- // and hop with a wing flap to close on prey or reposition [research 4].
7
- // Flight: soaring and gliding almost all the time (95-100 % flap-gliding, Pennycuick 1990): a few slow
8
- // deep beats (2.72 Hz at 11.2 m/s, amplitude ~85 deg) then long glides on flat (bald) or slightly
9
- // raised (golden) wings with the outer primaries splayed into 6-7 upturned fingers; banked thermal
10
- // circles; take-off with 3-6 heavy beats; landing: long shallow approach, swoop up, body pitched up,
11
- // wings raised and swept forward for braking beats, tail fanned and depressed, talons thrown forward.
12
- const G = (name, v, f, D, off, o) => ({ name, v, f, D, off, ...o });
13
-
14
- export const WING = {
15
- // humerus, ulna, hand (carpometacarpus + digit II) in metres (bald eagle osteometry)
16
- lengths: [0.19, 0.22, 0.15],
17
- // the wing root frame follows the upright body axis (standing tilt 48, see body.tilt), so the glide
18
- // chord and the stroke plane are level when the body is levelled in flight (2 deg short of it, with
19
- // glide.pitch 6: the folded / dead wing stays as it was tuned for the ground contact of a fly-death)
20
- tilt: 46,
21
- // degrees: elev (+ tip up), pitch (+ leading edge up), alpha (humerus, + back), elbow / wrist flexion
22
- bind: { elev: -5, pitch: 0, alpha: 50, elbow: 95, wrist: 100, bend: 0, twist: 0 },
23
- fold: { elev: -84, pitch: 2, alpha: 100, elbow: 152, wrist: 160, bend: 0, twist: 0 },
24
- // soaring glide: long flat "plank" wings, leading edge nearly straight, hand slightly swept back
25
- glide: { elev: 3, pitch: 6, alpha: 2, elbow: 18, wrist: 16, bend: 3, twist: 1 },
26
- // cruise stroke: slow and deep, flexed upstroke
27
- flap: { freq: 2.72, amp: 84, mid: 4, down: 0.56, upFlex: 30, upWrist: 36, sweep: 10, twist: 12 },
28
- // take-off / climb / braking beats (heavy, full amplitude; reduced from the research estimate of
29
- // ~3.5 Hz / 130 deg so the long primaries stay smooth at 60 fps)
30
- power: { freq: 3.2, amp: 98, mid: 6, down: 0.52, upFlex: 46, upWrist: 56, sweep: 16, twist: 16 },
31
- // flap-gliding: most of level flight is spent gliding; soaring birds take long glides
32
- glideShare: 0.6,
33
- soar: 0.8,
34
- // soaring: the slotted outer primaries bend up into separate fingers
35
- fingerLift: 12,
36
- // part-open wings on the ground are carried raised (the long primaries would drag)
37
- groundLift: 45,
38
- // thick feathered forearm: wrist / tip clearance above the ground
39
- skin: 0.04,
40
- };
41
-
42
- // Primaries: 10, p10 short, p5-p10 emarginated (6-7 "fingers" in flight), longest p7-p8.
43
- // Secondaries + tertials 12 per wing, rectrices 12 (bald: slightly wedge-shaped tail).
44
- export const FEATHERS = {
45
- primaries: [
46
- { u: 0.05, len: 0.33, width: 0.066, spread: 78, fold: 8, droop: 0.008 },
47
- { u: 0.15, len: 0.345, width: 0.066, spread: 70, fold: 7, droop: 0.008 },
48
- { u: 0.26, len: 0.36, width: 0.065, spread: 62, fold: 6, droop: 0.008 },
49
- { u: 0.37, len: 0.38, width: 0.064, spread: 54, fold: 5.5, emarg: 0.35, droop: 0.008 },
50
- { u: 0.48, len: 0.405, width: 0.062, spread: 46, fold: 5, emarg: 0.8, droop: 0.008 },
51
- { u: 0.59, len: 0.43, width: 0.06, spread: 38, fold: 4, emarg: 1, bend: 2, droop: 0.008 },
52
- { u: 0.70, len: 0.45, width: 0.058, spread: 30, fold: 3, emarg: 1, bend: 3, droop: 0.008 },
53
- { u: 0.80, len: 0.45, width: 0.055, spread: 21, fold: 2, emarg: 1, bend: 4, droop: 0.008 },
54
- { u: 0.90, len: 0.43, width: 0.052, spread: 12, fold: 1, emarg: 1, bend: 5, droop: 0.008 },
55
- { u: 1.00, len: 0.35, width: 0.046, spread: 3, fold: 0.5, emarg: 1, bend: 5, droop: 0.008 },
56
- ],
57
- secondaries: [
58
- { u: 0.03, len: 0.32, width: 0.072, spread: 84, fold: 144 },
59
- { u: 0.11, len: 0.325, width: 0.072, spread: 86, fold: 144 },
60
- { u: 0.19, len: 0.325, width: 0.072, spread: 88, fold: 144.5 },
61
- { u: 0.27, len: 0.325, width: 0.072, spread: 90, fold: 145 },
62
- { u: 0.35, len: 0.322, width: 0.072, spread: 92, fold: 145 },
63
- { u: 0.43, len: 0.318, width: 0.072, spread: 94, fold: 145.5 },
64
- { u: 0.51, len: 0.312, width: 0.071, spread: 96, fold: 146 },
65
- { u: 0.59, len: 0.304, width: 0.07, spread: 99, fold: 146 },
66
- { u: 0.67, len: 0.295, width: 0.069, spread: 104, fold: 146.5 },
67
- { u: 0.75, len: 0.29, width: 0.068, spread: 112, fold: 147 },
68
- { u: 0.84, len: 0.28, width: 0.068, spread: 124, fold: 147.5 },
69
- { u: 0.93, len: 0.265, width: 0.068, spread: 140, fold: 148 },
70
- ],
71
- rectrices: [
72
- { x: 0.004, len: 0.31, width: 0.075, fan: 4, fold: 0.5, bend: 0 },
73
- { x: 0.008, len: 0.305, width: 0.074, fan: 13, fold: 1, bend: -1 },
74
- { x: 0.012, len: 0.298, width: 0.073, fan: 23, fold: 1.5, bend: -2 },
75
- { x: 0.016, len: 0.29, width: 0.072, fan: 33, fold: 2, bend: -3 },
76
- { x: 0.020, len: 0.28, width: 0.07, fan: 43, fold: 2.5, bend: -4 },
77
- { x: 0.024, len: 0.268, width: 0.068, fan: 53, fold: 3, bend: -5 },
78
- ],
79
- coverts: { primary: 0.32, secondary: 0.46, tail: 0.5 },
80
- };
81
-
82
- // Cruise-flight carriage (bird engine flight.shape; flight photos): the head carried
83
- // forward and low on an extended neck, in line with the body (bill and tail tip on one line, the belly
84
- // ~0.06 of the bill-to-tail length below it, the back ~0.12 above), the neck sleeked (cross-section x0.6:
85
- // ~0.55 of the torso's depth, the throat flush with the breast), the contour plumage sleeked (torso depth x0.82 about a centre 10 cm up on the back: the belly
86
- // rises toward the back), the thigh and trouser feathers drawn in, the tail fanned into a broad wedge.
87
- const FLIGHT_SHAPE = { reach: 0.1, drop: 0.5, neck: 0.4, body: [0.95, 1, 0.82], back: 0.1, legs: 0.3, fan: 0.6 };
88
-
89
- export const motion = {
90
- gears: { walk: 0.4, hop: 1.1, run: 2.2, fly: 11.2 },
91
- maxSpeed: 19,
92
- ground: { maxSpeed: 3, accel: [1.8, 3], decel: 4, turnRate: 3 },
93
- gaits: [
94
- // waddling walk: wide feet, big roll toward the stance leg, talons lifted high
95
- G('walk', 0.0, 0.8, 0.74, [0, 0.5], { lift: 0.05, bob: 0.008, sway: 0.02, pitch: 0, headBob: 0.25, wings: 0.05, tail: 0.3 }),
96
- G('walk', 0.35, 1.0, 0.7, [0, 0.5], { lift: 0.055, bob: 0.01, sway: 0.022, pitch: -4, headBob: 0.25, wings: 0.1, tail: 0.4 }),
97
- G('walk', 0.6, 1.2, 0.66, [0, 0.5], { lift: 0.06, bob: 0.012, sway: 0.02, pitch: -8, headBob: 0.2, wings: 0.15, tail: 0.4 }),
98
- // hop: both feet together (closing on prey, repositioning)
99
- G('hop', 0.9, 1.5, 0.36, [0, 0], { lift: 0.04, bob: 0.006, hop: 0.06, sway: 0, pitch: -14, headBob: 0.1, wings: 0, tail: 0.5 }),
100
- G('hop', 1.3, 1.7, 0.34, [0, 0], { lift: 0.045, bob: 0.006, hop: 0.07, sway: 0, pitch: -18, headBob: 0.05, wings: 0, tail: 0.5 }),
101
- // run: short alternating take-off run (2-4 steps, 1-3 m/s, 2-3 Hz, duty 0.4-0.5)
102
- G('run', 1.7, 2.2, 0.46, [0, 0.5], { lift: 0.05, bob: 0.01, sway: 0.012, pitch: -20, headBob: 0.05, wings: 0, tail: 0.5 }),
103
- G('run', 2.8, 2.6, 0.4, [0, 0.5], { lift: 0.055, bob: 0.012, sway: 0.01, pitch: -26, headBob: 0.0, wings: 0, tail: 0.5 }),
104
- ],
105
- // (hock: the intertarsal joint's skin radius - the feathered cuff and the end of the trousers, ~2 cm)
106
- feet: { spread: [0, 20, 0, -22], curl: 10, grip: 1, pad: 0.016, toeClear: 0.0075, sitPad: 0.011, hock: 0.02 },
107
- body: { tilt: 48, belly: { y: 0.26, hh: 0.13, hw: 0.2 } },
108
- head: { bob: 0.25, yaw: 1.8, pitchUp: 0.5, pitchDown: 1.0, saccade: 1, cock: 0.25, jawRest: 0 },
109
- // (flight 2.4: in flight the tail droops ~14 deg below the body axis, its underside continuing the
110
- // belly line, as in the flight photos)
111
- tail: { pitch: -4, walkBob: 4, sway: 4, flick: 0.5, fanRest: 0.04, soarFan: 0.35, flight: 2.4 },
112
- wing: WING,
113
- feathers: FEATHERS,
114
- flight: {
115
- minSpeed: 7, cruise: 11.2, maxSpeed: 19, climb: [2.2, -6], bankMax: 45, turnRate: 1.2,
116
- clearance: 3, glideRatio: 12, sustained: true,
117
- // legs folded back along the belly, the feet tight under the tail coverts (flight photos)
118
- legTuck: { back: 0.82, down: 0.07, side: 0.5 },
119
- shape: FLIGHT_SHAPE,
120
- },
121
- takeoff: { crouch: 0.3, jump: 2.4, angle: 25, beats: 5, open: 0.8 },
122
- landing: { approach: 8, flare: 0.8, touch: 1.0 },
123
- actions: {
124
- attack: { style: 'talons', mantle: 1 },
125
- eat: { style: 'tear', rate: 0.8 },
126
- drink: {},
127
- jump: { height: 0.3, distance: 0.8 },
128
- sleep: { style: 'sink' },
129
- // preening the breast / shoulder: the upright eagle's breast is well forward of the hips
130
- preen: { spot: [0.035, 0.27, 0.19], pitch: 0.9 },
131
- },
132
- // golden eagle: soars with the wings raised in a shallow V (dihedral); its smaller head projects less
133
- // in flight (less than half the tail's length, a field mark against the bald eagle's)
134
- variants: {
135
- golden: { wing: { glide: { ...WING.glide, elev: 3, bend: 10 } }, flight: { shape: { ...FLIGHT_SHAPE, reach: 0 } } },
136
- },
137
- };
@@ -1,57 +0,0 @@
1
- // Meshing plan: body (incl. wing arms and legs) at 3.2 mm, head + the top of the neck at 1.5 mm
2
- // (overlapping the body at the cut and cross-faded), eyelid patches at 0.6 mm, and the lower mandible
3
- // as its own rigid surface so the bill can open. Cells scale with the quality tier (Q.res).
4
- import { J } from './joints.js';
5
- import { EYE } from './sculpt.js';
6
- import { HEAD_O, NECK_SEGS } from './rig.js';
7
- import { eyeFrameOf } from '../../core/sdf/eyeSocket.js';
8
- import { lerp, norm, sub, smoothstep } from '../../core/math/vec.js';
9
-
10
- export const NECK_CUT = (() => {
11
- const d = norm(sub(J.occiput, J['neck' + (NECK_SEGS - 1)]));
12
- const c = lerp(J['neck' + (NECK_SEGS - 1)], J.occiput, 0.65);
13
- return { c, d, band: 0.008 };
14
- })();
15
- 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];
16
-
17
- export const EYE_PATCH = { R: 0.0205, B: 0.0035, h: 0.0006, centres: [1, -1].map((s) => eyeFrameOf(EYE, HEAD_O, s).c) };
18
- export function eyePatchWeight(x, y, z) {
19
- let dmin = 1e9;
20
- for (const c of EYE_PATCH.centres) dmin = Math.min(dmin, Math.hypot(x - c[0], y - c[1], z - c[2]));
21
- return 1 - smoothstep(EYE_PATCH.R - EYE_PATCH.B, EYE_PATCH.R + EYE_PATCH.B, dmin);
22
- }
23
-
24
- export function eagleRegions(rig, params, Q) {
25
- const B = NECK_CUT.band, r = Q.res;
26
- const patches = Q.eyePatches ? EYE_PATCH.centres.map((c) => ({ c, R: EYE_PATCH.R, B: EYE_PATCH.B, h: EYE_PATCH.h * Math.max(1, r) })) : [];
27
- const [hx, hy, hz] = HEAD_O;
28
- const hBody = 0.0038 * r, hHead = 0.0018 * r;
29
- // Each surface is cut two of its cells past the far edge of the band, not at the edge: the mesher
30
- // keeps a cell by its centre and its vertex may sit ~1.5 cells from there, so at the coarse tiers
31
- // (a 16 mm crowd cell vs the +-8 mm band) a cut at the band edge landed on the visible side of the
32
- // cross-fade and left an open rim under the head (the head's fade midline is 3 mm below the body's).
33
- const cutBody = B + 2 * hBody, cutHead = B + 0.003 + 2 * hHead;
34
- return {
35
- jobs: [
36
- [
37
- { name: 'body', part: 'body', bmin: [-0.44, -0.006, -0.28], bmax: [0.44, 0.62, 0.26], h: hBody, F: 4, clip: (x, y, z) => neckS(x, y, z) < cutBody },
38
- ],
39
- [
40
- { name: 'head', part: 'body', bmin: [hx - 0.1, hy - 0.23, hz - 0.18], bmax: [hx + 0.1, hy + 0.06, hz + 0.125], h: hHead, F: 6, clip: (x, y, z) => neckS(x, y, z) > -cutHead, patches },
41
- { name: 'jaw', part: 'jaw', bmin: [hx - 0.022, hy - 0.05, hz - 0.02], bmax: [hx + 0.022, hy - 0.015, hz + 0.1], h: 0.0012 * r, F: 6, rigidBone: 'jaw' },
42
- ],
43
- ],
44
- fade(x, y, z, name, patch) {
45
- const sN = neckS(x, y, z);
46
- if (name === 'body') return 1 - smoothstep(-B, B, sN);
47
- if (name === 'head') {
48
- // (the head surface reaches 3 mm past the body's cut: the two overlap instead of leaving a
49
- // see-through crack where the meshes do not coincide exactly)
50
- let f = smoothstep(-B - 0.003, B - 0.003, sN);
51
- if (patches.length) { const ew = eyePatchWeight(x, y, z); f *= patch ? ew : 1 - ew; }
52
- return f;
53
- }
54
- return 1;
55
- },
56
- };
57
- }
@@ -1,107 +0,0 @@
1
- // Eagle skeleton in bind pose (metres). Forward = +Z, up = +Y, the bird's left = +X; ground at y = 0,
2
- // the feet under the centre of mass at z ~ 0. Reference individual: adult bald eagle, ~4.7 kg,
3
- // crown ~0.66 m above the feet when standing upright (body axis 48 deg above horizontal, side1 /
4
- // golden_side1 photos: 45-55 deg), bill tip to tail tip 0.86 m. Bones from raptor osteometry scaled to a 95 mm
5
- // tarsometatarsus: femur 100, tibiotarsus 160, tarsometatarsus 95 mm; humerus 190, ulna 220,
6
- // hand 150 mm; long thick toes with huge talons (hallux and inner toe the largest).
7
- // Wings are bound half open (drooped out to the side) so the arm skin deforms evenly toward both the
8
- // folded and the spread wing; the flight feathers are separate bones (see core/rig/bird.js).
9
- import { buildRig } from '../../core/rig/rig.js';
10
- import { birdBones, birdLimbs, neckChain, wingJoints, featherJoints } from '../../core/rig/bird.js';
11
- import { WING, FEATHERS } from './motion.js';
12
-
13
- export const NECK_SEGS = 4;
14
- export const TILT = 48; // standing body axis above horizontal (deg)
15
- export const HEAD_O = [0, 0.595, 0.205]; // head-local origin: between the eyes
16
-
17
- const n2 = (y, z) => { const l = Math.hypot(y, z); return [0, y / l, z / l]; };
18
- // body-axis frame: a along the axis (forward-up), b dorsal
19
- const ct = Math.cos((TILT * Math.PI) / 180), st = Math.sin((TILT * Math.PI) / 180);
20
- export const SYN = [0, 0.285, -0.03];
21
- export const AX = (a, b, x = 0) => [x, SYN[1] + a * st + b * ct, SYN[2] + a * ct - b * st];
22
- export const U_AX = [0, st, ct];
23
- export const V_AX = [0, ct, -st];
24
-
25
- // leg bones (m): femur, tibiotarsus (the tarsometatarsus is ankle -> MTP)
26
- const FEMUR = 0.098, TIBIA = 0.1595;
27
- // knee of a hip -> knee -> ankle chain with the given lengths, bent toward `pole`
28
- function kneeOf(hip, ankle, l1, l2, pole) {
29
- const d = [ankle[0] - hip[0], ankle[1] - hip[1], ankle[2] - hip[2]], L = Math.hypot(...d);
30
- const e1 = d.map((v) => v / L), pd = pole[0] * e1[0] + pole[1] * e1[1] + pole[2] * e1[2];
31
- let e2 = pole.map((v, i) => v - pd * e1[i]);
32
- const l = Math.hypot(...e2);
33
- e2 = e2.map((v) => v / l);
34
- const c = (l1 * l1 + L * L - l2 * l2) / (2 * l1 * L), sn = Math.sqrt(Math.max(0, 1 - c * c));
35
- return hip.map((h, i) => h + e1[i] * l1 * c + e2[i] * l1 * sn);
36
- }
37
-
38
- export function eagleJoints() {
39
- const hl = (x, y, z) => [HEAD_O[0] + x, HEAD_O[1] + y, HEAD_O[2] + z];
40
- const J = {
41
- synsacrum: SYN,
42
- tailBase: AX(-0.06, 0.05),
43
- tailTip: null,
44
- neckBase: AX(0.19, -0.03),
45
- occiput: hl(0, -0.026, -0.058),
46
- bill: hl(0, -0.046, 0.109),
47
- jawHinge: hl(0, -0.027, -0.002),
48
- jawTip: hl(0, -0.04, 0.094),
49
- // the shoulder at the front of the thorax, level with the neck's root (flight photos: the wing's
50
- // leading edge meets the body right behind the white hood)
51
- shoulderL: AX(0.2, 0.045, 0.056),
52
- // the hip (acetabulum) high in the body, ~6 cm under the back; the knee hidden in the flank
53
- // feathers (solved below from the femur and tibiotarsus lengths)
54
- hipL: AX(0, 0.015, 0.055),
55
- ankleL: [0.064, 0.108, -0.03],
56
- mtpL: [0.05, 0.016, 0.0],
57
- };
58
- // the tail points 38 deg below the horizontal standing (10 deg above the body axis; in flight it
59
- // droops below the body axis, see motion tail.flight)
60
- J.tailTip = [0, J.tailBase[1] - 0.042 * Math.sin(38 * Math.PI / 180), J.tailBase[2] - 0.042 * Math.cos(38 * Math.PI / 180)];
61
- J.kneeL = kneeOf(J.hipL, J.ankleL, FEMUR, TIBIA, [0, 0, 1]);
62
- // toes: III (middle) forward, II inner, IV outer, I (hallux) back; two segments each (phalanges +
63
- // talon in the distal one), lying on the ground
64
- const toe = (j, yawDeg, a, b, back = false) => {
65
- const y = (yawDeg * Math.PI) / 180, m = J.mtpL;
66
- const dir = back ? [Math.sin(y), 0, -Math.cos(y)] : [Math.sin(y), 0, Math.cos(y)];
67
- J[`t${j}mL`] = [m[0] + dir[0] * a, 0.011, m[2] + dir[2] * a];
68
- J[`t${j}tL`] = [m[0] + dir[0] * (a + b), 0.0085, m[2] + dir[2] * (a + b)];
69
- };
70
- toe(3, 3, 0.046, 0.05);
71
- toe(2, -24, 0.036, 0.048);
72
- toe(4, 28, 0.037, 0.04);
73
- toe(1, -8, 0.03, 0.05, true);
74
- neckChain(J, NECK_SEGS, n2(1, 0.15), n2(1, 0.7), 0.35);
75
- wingJoints(J, WING);
76
- featherJoints(J, WING, FEATHERS, { bindFan: 0.2 });
77
- return J;
78
- }
79
-
80
- export function eagleRig() {
81
- const J = eagleJoints();
82
- const neck = Array.from({ length: NECK_SEGS - 1 }, (_, i) => 'neck' + (NECK_SEGS - 1 - i));
83
- const neckBones = Array.from({ length: NECK_SEGS }, (_, i) => 'neck' + (NECK_SEGS - 1 - i));
84
- return buildRig({
85
- joints: J,
86
- unit: 0.5,
87
- headOrigin: HEAD_O,
88
- bones: birdBones({ neckSegs: NECK_SEGS, jaw: true, primaries: FEATHERS.primaries.length, secondaries: FEATHERS.secondaries.length, rectrices: FEATHERS.rectrices.length }),
89
- axial: {
90
- points: ['bill', 'occiput', ...neck, 'neckBase', 'synsacrum', 'tailBase', 'tailTip'],
91
- bones: ['head', ...neckBones, 'chest', 'pelvis', 'tail'],
92
- // wide blends along the thick feathered neck (see the crow): the skull's influence runs down the
93
- // neck and the neck base blends into the breast
94
- blend: Object.fromEntries([
95
- [1, [-0.2, 0.1]],
96
- ...Array.from({ length: NECK_SEGS - 1 }, (_, k) => [2 + k, [-0.03, 0.03]]),
97
- [1 + NECK_SEGS, [-0.45, 0.03]],
98
- ]),
99
- },
100
- limbs: birdLimbs({
101
- leg: { tCore: 0.95, aCore: 0.07, aBody: -0.05, midX: 0.012 },
102
- wing: { tCore: 0.4, aCore: 0.16, aBody: -0.24, midX: 0.02 },
103
- }),
104
- appendages: [],
105
- webTags: ['flankfold', 'scapular'],
106
- });
107
- }