@wildshard/kit 0.0.0-stage → 0.4.0

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 (129) hide show
  1. package/GUIDE.md +221 -0
  2. package/content/abilities/bite.json +24 -0
  3. package/content/abilities/charge.json +25 -0
  4. package/content/abilities/claw.json +24 -0
  5. package/content/abilities/slam.json +24 -0
  6. package/content/abilities/swing.json +25 -0
  7. package/content/animated/bear/pbr/black-blaze.glb +0 -0
  8. package/content/animated/bear/pbr/black-blaze.json +1 -0
  9. package/content/animated/bear/pbr/black-old.glb +0 -0
  10. package/content/animated/bear/pbr/black-old.json +1 -0
  11. package/content/animated/bear/pbr/black.glb +0 -0
  12. package/content/animated/bear/pbr/black.json +1 -0
  13. package/content/animated/bear/pbr/brown-old.glb +0 -0
  14. package/content/animated/bear/pbr/brown-old.json +1 -0
  15. package/content/animated/bear/pbr/brown.glb +0 -0
  16. package/content/animated/bear/pbr/brown.json +1 -0
  17. package/content/animated/bear/toon/black-blaze.glb +0 -0
  18. package/content/animated/bear/toon/black-blaze.json +1 -0
  19. package/content/animated/bear/toon/black-old.glb +0 -0
  20. package/content/animated/bear/toon/black-old.json +1 -0
  21. package/content/animated/bear/toon/black.glb +0 -0
  22. package/content/animated/bear/toon/black.json +1 -0
  23. package/content/animated/bear/toon/brown-old.glb +0 -0
  24. package/content/animated/bear/toon/brown-old.json +1 -0
  25. package/content/animated/bear/toon/brown.glb +0 -0
  26. package/content/animated/bear/toon/brown.json +1 -0
  27. package/content/animated/boar/pbr/big.glb +0 -0
  28. package/content/animated/boar/pbr/big.json +1 -0
  29. package/content/animated/boar/pbr/black.glb +0 -0
  30. package/content/animated/boar/pbr/black.json +1 -0
  31. package/content/animated/boar/pbr/boar.glb +0 -0
  32. package/content/animated/boar/pbr/boar.json +1 -0
  33. package/content/animated/boar/pbr/ironhide.glb +0 -0
  34. package/content/animated/boar/pbr/ironhide.json +1 -0
  35. package/content/animated/boar/pbr/scarback.glb +0 -0
  36. package/content/animated/boar/pbr/scarback.json +1 -0
  37. package/content/animated/boar/pbr/sow.glb +0 -0
  38. package/content/animated/boar/pbr/sow.json +1 -0
  39. package/content/animated/boar/toon/big.glb +0 -0
  40. package/content/animated/boar/toon/big.json +1 -0
  41. package/content/animated/boar/toon/black.glb +0 -0
  42. package/content/animated/boar/toon/black.json +1 -0
  43. package/content/animated/boar/toon/boar.glb +0 -0
  44. package/content/animated/boar/toon/boar.json +1 -0
  45. package/content/animated/boar/toon/ironhide.glb +0 -0
  46. package/content/animated/boar/toon/ironhide.json +1 -0
  47. package/content/animated/boar/toon/scarback.glb +0 -0
  48. package/content/animated/boar/toon/scarback.json +1 -0
  49. package/content/animated/boar/toon/sow.glb +0 -0
  50. package/content/animated/boar/toon/sow.json +1 -0
  51. package/content/animated/catalogue.json +1 -0
  52. package/content/bodies/biped.json +5 -0
  53. package/content/bodies/quadruped.json +5 -0
  54. package/content/clips/quadruped.json +1 -0
  55. package/content/creatures/bear/look.json +199 -0
  56. package/content/creatures/bear/pbr/black-blaze.glb +0 -0
  57. package/content/creatures/bear/pbr/black-old.glb +0 -0
  58. package/content/creatures/bear/pbr/black.glb +0 -0
  59. package/content/creatures/bear/pbr/brown-old.glb +0 -0
  60. package/content/creatures/bear/pbr/brown.glb +0 -0
  61. package/content/creatures/bear/toon/black-blaze.glb +0 -0
  62. package/content/creatures/bear/toon/black-old.glb +0 -0
  63. package/content/creatures/bear/toon/black.glb +0 -0
  64. package/content/creatures/bear/toon/brown-old.glb +0 -0
  65. package/content/creatures/bear/toon/brown.glb +0 -0
  66. package/content/creatures/bear.json +257 -0
  67. package/content/creatures/boar/look.json +184 -0
  68. package/content/creatures/boar/pbr/big.glb +0 -0
  69. package/content/creatures/boar/pbr/black.glb +0 -0
  70. package/content/creatures/boar/pbr/boar.glb +0 -0
  71. package/content/creatures/boar/pbr/ironhide.glb +0 -0
  72. package/content/creatures/boar/pbr/scarback.glb +0 -0
  73. package/content/creatures/boar/pbr/sow.glb +0 -0
  74. package/content/creatures/boar/toon/big.glb +0 -0
  75. package/content/creatures/boar/toon/black.glb +0 -0
  76. package/content/creatures/boar/toon/boar.glb +0 -0
  77. package/content/creatures/boar/toon/ironhide.glb +0 -0
  78. package/content/creatures/boar/toon/scarback.glb +0 -0
  79. package/content/creatures/boar/toon/sow.glb +0 -0
  80. package/content/creatures/boar.json +275 -0
  81. package/content/creatures/bodies.json +4754 -0
  82. package/content/harvest-items.json +98 -0
  83. package/content/harvest.json +31 -0
  84. package/content/journal-icons/antlers.png +0 -0
  85. package/content/journal-icons/bear.png +0 -0
  86. package/content/journal-icons/boar.png +0 -0
  87. package/content/journal-icons/deer.png +0 -0
  88. package/content/journal-icons/elk.png +0 -0
  89. package/content/journal-icons/ghost.png +0 -0
  90. package/content/journal-icons/ironhide.png +0 -0
  91. package/content/journal-icons.json +9 -0
  92. package/content/shared/pickupCatalogue.json +1008 -0
  93. package/content/shared/starterBow.json +21 -0
  94. package/content/species/bear.json +144 -0
  95. package/content/species/boar.json +147 -0
  96. package/content/sword-debris.json +7 -0
  97. package/content/temperaments.json +519 -0
  98. package/content/tuning/bear.json +43 -0
  99. package/content/tuning/boar.json +32 -0
  100. package/content/tuning/deer.json +32 -0
  101. package/content/tuning/pursue.json +12 -0
  102. package/package.json +63 -3
  103. package/src/abilities.ts +85 -0
  104. package/src/body.ts +25 -0
  105. package/src/clips.ts +139 -0
  106. package/src/creatures.ts +76 -0
  107. package/src/geometry/arms.ts +725 -0
  108. package/src/geometry/bear.ts +521 -0
  109. package/src/geometry/boar.ts +604 -0
  110. package/src/geometry/bowProfile.ts +34 -0
  111. package/src/geometry/export.ts +101 -0
  112. package/src/geometry/meleeProfile.ts +261 -0
  113. package/src/geometry/nativeInteractionFacts.ts +7 -0
  114. package/src/geometry/nativeLooks.ts +54 -0
  115. package/src/geometry/riderArms.ts +215 -0
  116. package/src/geometry/sharedSpecs.ts +26 -0
  117. package/src/geometry/species.ts +768 -0
  118. package/src/geometry/specimenCatalogue.ts +80 -0
  119. package/src/geometry/starterCombat.ts +194 -0
  120. package/src/geometry/starterGlyphs.ts +12 -0
  121. package/src/geometry/starterMeleeProfile.ts +134 -0
  122. package/src/geometry/starterMoves.ts +172 -0
  123. package/src/index.ts +26 -0
  124. package/src/legacyCombat.ts +25 -0
  125. package/src/legacyHarvest.ts +104 -0
  126. package/src/legacyJournalIcons.ts +10 -0
  127. package/src/legacySpecies.ts +127 -0
  128. package/src/temperament.ts +97 -0
  129. package/README.md +0 -3
@@ -0,0 +1,521 @@
1
+ import { smoothstep as sstep } from '@wildshard/sdk/noise'
2
+ import * as THREE from 'three'
3
+
4
+ import type {
5
+ CommonLook,
6
+ AnimalSpecies,
7
+ BoneDef,
8
+ VariantDef,
9
+ SpeciesGeometryCompiler,
10
+ Paint,
11
+ RGB,
12
+ } from './species.ts'
13
+ import type { Rng } from '@wildshard/sdk/random'
14
+
15
+ export function createBearLook(compiler: SpeciesGeometryCompiler): CommonLook {
16
+ const {
17
+ loft,
18
+ tube,
19
+ skinPlain,
20
+ S,
21
+ boneIndex,
22
+ mix,
23
+ paintNoise,
24
+ setShag,
25
+ isLowPoly,
26
+ paletteColors,
27
+ toonPaint,
28
+ } = compiler
29
+ /**
30
+ * Bear — black bear (scale 1: ~1.0 m at the shoulder, ~2.0 m nose to rump) and the bigger humped brown /
31
+ * grizzly. Long heavy barrel, big round skull with a long muzzle, small round ears, stub tail, thick legs
32
+ * on flat plantigrade paws with five dark claws. Shaggy coat (long shells, strong silhouette shag).
33
+ *
34
+ * TERRITORIAL HUNTERS: a bear does not run from you. Inside `stalk.detect` m (or when a bolt lands within
35
+ * impactAlert m) it stands up alert for 1–2 s, then STALKS — walks at you huffing — and CHARGES at 9 m/s
36
+ * (faster than your 7.2 sprint; only the hoverboard outruns it) from panicDist m. A hit that does not kill
37
+ * it makes it charge from wherever it is. See AnimalManager.ts `HuntTuning.stalk`.
38
+ *
39
+ * Variants (traits read by build): hump (0..1.3: shoulder hump height), blaze (0/1: cream chest blaze),
40
+ * grizzle (0..1: pale guard-hair tips on the back and shoulders).
41
+ * Palette keys (VariantDef.tint): base tip dark muzzle blaze nose claw eye pad.
42
+ */
43
+
44
+ const BEAR_PALETTE: {
45
+ // black bear: near-black coat with a warm brown cast in the light, tan muzzle
46
+ base: [number, number, number]
47
+ tip: [number, number, number]
48
+ dark: [number, number, number]
49
+ muzzle: [number, number, number]
50
+ blaze: [number, number, number]
51
+ nose: [number, number, number]
52
+ claw: [number, number, number]
53
+ eye: [number, number, number]
54
+ pad: [number, number, number]
55
+ } = {
56
+ // exported: pineCoats.ts recolours the rigged hull per variant from it
57
+ // black bear: near-black coat with a warm brown cast in the light, tan muzzle
58
+ base: [0.075, 0.062, 0.055],
59
+ tip: [0.2, 0.16, 0.13],
60
+ dark: [0.035, 0.03, 0.028],
61
+ muzzle: [0.4, 0.29, 0.19],
62
+ blaze: [0.82, 0.74, 0.58],
63
+ nose: [0.04, 0.035, 0.035],
64
+ claw: [0.12, 0.1, 0.085],
65
+ eye: [0.02, 0.015, 0.01],
66
+ pad: [0.1, 0.08, 0.07],
67
+ } satisfies Record<string, RGB>
68
+
69
+ /** brown / grizzly: mid brown with pale silver-blond guard-hair tips over the shoulders and back */
70
+ const BROWN_TINT: Record<string, RGB> = {
71
+ base: [0.36, 0.25, 0.155],
72
+ tip: [0.68, 0.56, 0.4],
73
+ dark: [0.16, 0.115, 0.08],
74
+ muzzle: [0.5, 0.4, 0.29],
75
+ nose: [0.06, 0.045, 0.04],
76
+ claw: [0.55, 0.48, 0.38],
77
+ pad: [0.16, 0.12, 0.1],
78
+ }
79
+
80
+ /** Grizzled Sow: an old, silvered grizzly — paler base, near-white tips, a grey muzzle */
81
+ const GRIZZLED_TINT: Record<string, RGB> = {
82
+ base: [0.38, 0.3, 0.22],
83
+ tip: [0.78, 0.72, 0.62],
84
+ dark: [0.18, 0.14, 0.11],
85
+ muzzle: [0.62, 0.56, 0.48],
86
+ nose: [0.07, 0.06, 0.055],
87
+ claw: [0.6, 0.54, 0.44],
88
+ pad: [0.18, 0.14, 0.12],
89
+ }
90
+
91
+ /** Old Blackpaw: coal black with a rust sheen over the shoulders and a greyed muzzle */
92
+ const BLACKPAW_TINT: Record<string, RGB> = {
93
+ base: [0.06, 0.05, 0.045],
94
+ tip: [0.26, 0.17, 0.11],
95
+ dark: [0.028, 0.025, 0.024],
96
+ muzzle: [0.5, 0.44, 0.36],
97
+ nose: [0.035, 0.03, 0.03],
98
+ }
99
+
100
+ function bearPaint(v: VariantDef): Paint {
101
+ const P = paletteColors(BEAR_PALETTE, v.tint)
102
+ const { base, tip, dark, muzzle, blaze, nose, claw, eye, pad } = P
103
+ const hasBlaze = Boolean(v.traits?.['blaze'])
104
+ const grizzle = Number(v.traits?.['grizzle'] ?? 0.35)
105
+ return (out, x, y, z, nx, ny, nz, part, t, _a) => {
106
+ const n1 = paintNoise.fbm(x * 3.5 + 23, z * 3.5 + y * 2.5, 3)
107
+ const n2 = paintNoise.fbm(x * 12 - 40, z * 10 + y * 6, 2)
108
+ switch (part) {
109
+ case 'body':
110
+ out.copy(base)
111
+ // pale guard-hair tips over the back and shoulders (strongest on the hump), broken by noise
112
+ mix(
113
+ out,
114
+ out,
115
+ tip,
116
+ sstep(-0.15, 0.85, ny) *
117
+ grizzle *
118
+ (0.45 + 0.55 * sstep(-0.4, 0.5, n1)) *
119
+ (0.6 + 0.4 * sstep(-0.1, 0.55, z)),
120
+ )
121
+ mix(out, out, dark, sstep(-0.35, -0.85, ny) * 0.8)
122
+ // cream chest blaze: a V on the upper chest between the front legs
123
+ if (hasBlaze && z > 0.28 && ny < -0.15) {
124
+ const edge = n2 * 0.05
125
+ const band =
126
+ sstep(
127
+ 0.17,
128
+ 0.08,
129
+ Math.abs(x) - 0.06 * sstep(0.35, 0.62, z) + edge,
130
+ ) *
131
+ sstep(0.28, 0.42, z) *
132
+ sstep(0.72, 0.6, z + Math.abs(x) * 0.6)
133
+ mix(out, out, blaze, band * sstep(-0.15, -0.6, ny))
134
+ }
135
+ break
136
+ case 'neck':
137
+ out.copy(base)
138
+ mix(out, out, tip, sstep(0.0, 0.9, ny) * grizzle * 0.5)
139
+ mix(out, out, dark, sstep(-0.3, -0.85, ny) * 0.7)
140
+ break
141
+ case 'head':
142
+ out.copy(base)
143
+ mix(
144
+ out,
145
+ out,
146
+ tip,
147
+ sstep(0.3, 0.95, ny) * grizzle * 0.35 * sstep(0.55, 0.2, t),
148
+ )
149
+ // tan muzzle from the brow forward, a little paler around the eyes / cheeks
150
+ mix(
151
+ out,
152
+ out,
153
+ muzzle,
154
+ sstep(0.5, 0.78, t) * (0.75 + 0.25 * sstep(-0.2, -0.9, ny)),
155
+ )
156
+ mix(
157
+ out,
158
+ out,
159
+ muzzle,
160
+ sstep(0.28, 0.5, t) * sstep(0.5, 0.95, Math.abs(nx)) * 0.25,
161
+ )
162
+ mix(out, out, dark, sstep(0.94, 1.0, t) * 0.6)
163
+ break
164
+ case 'ear':
165
+ out.copy(base)
166
+ mix(out, out, dark, sstep(0.2, 0.8, nz) * 0.7)
167
+ mix(out, out, tip, sstep(-0.3, -0.9, nz) * grizzle * 0.4)
168
+ break
169
+ case 'leg':
170
+ mix(out, base, dark, sstep(0.5, 0.12, y) * 0.85)
171
+ mix(out, out, pad, sstep(0.09, 0.03, y) * sstep(0.2, -0.8, ny) * 0.8)
172
+ break
173
+ case 'tail':
174
+ mix(out, base, dark, sstep(0.3, 1, t) * 0.6)
175
+ break
176
+ case 'nose':
177
+ out.copy(nose)
178
+ break
179
+ case 'claw':
180
+ mix(out, claw, dark, sstep(0.4, 1.0, t) * 0.5)
181
+ break
182
+ case 'eye':
183
+ out.copy(eye)
184
+ break
185
+ default:
186
+ out.copy(base)
187
+ }
188
+ let m = 1 + 0.12 * n1 + 0.05 * n2
189
+ if (part === 'body')
190
+ m *=
191
+ 1 -
192
+ 0.3 * sstep(-0.2, -0.9, ny) -
193
+ 0.22 *
194
+ sstep(0.28, 0.08, Math.abs(Math.abs(z) - 0.48)) *
195
+ sstep(0.6, 0.4, y) // shadowed belly, leg roots
196
+ if (part === 'leg') m *= 1 - 0.25 * sstep(0.35, 0.62, y)
197
+ if (part === 'head')
198
+ m *= 1 - 0.2 * sstep(0.5, 0.2, ny) * sstep(0.55, 0.3, t) // under the jaw
199
+ out.r *= m
200
+ out.g *= m
201
+ out.b *= m
202
+ }
203
+ }
204
+
205
+ function buildBear(v: VariantDef, rng: Rng): AnimalSpecies {
206
+ const hump = Number(v.traits?.['hump'] ?? 0)
207
+ setShag(0.028)
208
+ const bones: BoneDef[] = [
209
+ { name: 'body', parent: null, pos: [0, 0.66, -0.05] },
210
+ { name: 'neck1', parent: 'body', pos: [0, 0.72, 0.52] },
211
+ { name: 'neck2', parent: 'neck1', pos: [0, 0.75, 0.66] },
212
+ { name: 'head', parent: 'neck2', pos: [0, 0.78, 0.78] },
213
+ { name: 'earL', parent: 'head', pos: [0.1, 0.96, 0.77] },
214
+ { name: 'earR', parent: 'head', pos: [-0.1, 0.96, 0.77] },
215
+ { name: 'tail', parent: 'body', pos: [0, 0.73, -0.76] },
216
+ { name: 'belly', parent: 'body', pos: [0, 0.5, -0.05] },
217
+ ]
218
+ for (const side of ['L', 'R'] as const) {
219
+ const sx = side === 'L' ? 1 : -1
220
+ bones.push(
221
+ {
222
+ name: `F${side}_shoulder`,
223
+ parent: 'body',
224
+ pos: [sx * 0.17, 0.62, 0.4],
225
+ },
226
+ {
227
+ name: `F${side}_carpus`,
228
+ parent: `F${side}_shoulder`,
229
+ pos: [sx * 0.18, 0.32, 0.41],
230
+ },
231
+ {
232
+ name: `F${side}_fetlock`,
233
+ parent: `F${side}_carpus`,
234
+ pos: [sx * 0.18, 0.12, 0.42],
235
+ },
236
+ { name: `B${side}_hip`, parent: 'body', pos: [sx * 0.16, 0.64, -0.5] },
237
+ {
238
+ name: `B${side}_stifle`,
239
+ parent: `B${side}_hip`,
240
+ pos: [sx * 0.17, 0.4, -0.4],
241
+ },
242
+ {
243
+ name: `B${side}_hock`,
244
+ parent: `B${side}_stifle`,
245
+ pos: [sx * 0.17, 0.2, -0.51],
246
+ },
247
+ )
248
+ }
249
+ const B = boneIndex(bones)
250
+ const toon = isLowPoly() ? toonPaint('bear') : null // a toon level: its own palette
251
+ const paint = toon !== null ? toon(v) : bearPaint(v)
252
+ const fur: THREE.BufferGeometry[] = [],
253
+ hard: THREE.BufferGeometry[] = [],
254
+ eyes: THREE.BufferGeometry[] = []
255
+ const body = B('body'),
256
+ n1 = B('neck1'),
257
+ n2 = B('neck2'),
258
+ hd = B('head'),
259
+ bl = B('belly')
260
+ // torso: a long, deep, low-slung barrel; heavy round rump, the withers rise into a hump (brown bear)
261
+ fur.push(
262
+ loft(
263
+ [
264
+ S(0, 0.7, -0.82, 0.03, 0.03, body),
265
+ S(0, 0.7, -0.79, 0.17, 0.21, body),
266
+ S(0, 0.69, -0.7, 0.265, 0.32, body, body, 0, 1.0, 1.04),
267
+ S(0, 0.68, -0.54, 0.3, 0.36, body, body, 0, 1.0, 1.08),
268
+ S(0, 0.67, -0.32, 0.305, 0.365, body, bl, 0.5, 0.98, 1.12),
269
+ S(0, 0.67, -0.06, 0.3, 0.36, body, bl, 0.7, 1.0, 1.12),
270
+ S(0, 0.68, 0.18, 0.295, 0.35, body, bl, 0.4, 1.08 + hump * 0.1, 1.08),
271
+ S(
272
+ 0,
273
+ 0.69,
274
+ 0.38,
275
+ 0.285,
276
+ 0.34,
277
+ body,
278
+ n1,
279
+ 0.15,
280
+ 1.16 + hump * 0.24,
281
+ 1.0,
282
+ ),
283
+ S(0, 0.71, 0.55, 0.25, 0.3, body, n1, 0.5, 1.12 + hump * 0.14, 0.94),
284
+ S(0, 0.74, 0.69, 0.215, 0.245, n1, n2, 0.5, 1.04 + hump * 0.04, 0.94),
285
+ S(0, 0.765, 0.8, 0.19, 0.21, n2, hd, 0.6, 1.02, 0.97),
286
+ ],
287
+ 22,
288
+ 'body',
289
+ paint,
290
+ true,
291
+ false,
292
+ ),
293
+ )
294
+ // head: big round skull with a heavy brow, tapering into a long straight muzzle
295
+ fur.push(
296
+ loft(
297
+ [
298
+ S(0, 0.765, 0.78, 0.195, 0.215, n2, hd, 0.5, 1.04, 0.98),
299
+ S(0, 0.79, 0.9, 0.18, 0.195, hd, hd, 0, 1.12, 0.95),
300
+ S(0, 0.795, 1.0, 0.15, 0.16, hd, hd, 0, 1.06, 0.92),
301
+ S(0, 0.77, 1.08, 0.11, 0.115, hd, hd, 0, 0.95, 1.0),
302
+ S(0, 0.745, 1.16, 0.084, 0.088, hd),
303
+ S(0, 0.725, 1.23, 0.068, 0.07, hd),
304
+ S(0, 0.715, 1.27, 0.055, 0.054, hd),
305
+ ],
306
+ 18,
307
+ 'head',
308
+ paint,
309
+ false,
310
+ true,
311
+ ),
312
+ )
313
+ // nose pad
314
+ hard.push(
315
+ loft(
316
+ [
317
+ S(0, 0.715, 1.265, 0.052, 0.05, hd),
318
+ S(0, 0.717, 1.29, 0.048, 0.044, hd),
319
+ S(0, 0.717, 1.3, 0.022, 0.02, hd),
320
+ ],
321
+ 12,
322
+ 'nose',
323
+ paint,
324
+ ),
325
+ )
326
+ // ears (small, round, set wide on the skull) + eyes (small, forward-set)
327
+ for (const sx of [1, -1]) {
328
+ const eb = B(sx > 0 ? 'earL' : 'earR')
329
+ fur.push(
330
+ loft(
331
+ [
332
+ S(sx * 0.085, 0.92, 0.8, 0.035, 0.02, hd, eb, 0.3),
333
+ S(sx * 0.105, 0.975, 0.785, 0.052, 0.026, eb),
334
+ S(sx * 0.12, 1.025, 0.775, 0.048, 0.024, eb),
335
+ S(sx * 0.13, 1.055, 0.77, 0.028, 0.014, eb),
336
+ S(sx * 0.135, 1.065, 0.768, 0.008, 0.005, eb),
337
+ ],
338
+ 10,
339
+ 'ear',
340
+ paint,
341
+ true,
342
+ true,
343
+ 'z',
344
+ ),
345
+ )
346
+ const eye = new THREE.SphereGeometry(0.015, 10, 8)
347
+ eye.translate(sx * 0.082, 0.8, 1.0)
348
+ eyes.push(skinPlain(eye, hd, 'eye', paint))
349
+ }
350
+ // stub tail
351
+ const tl = B('tail')
352
+ fur.push(
353
+ loft(
354
+ [
355
+ S(0, 0.72, -0.77, 0.045, 0.045, body, tl, 0.3),
356
+ S(0, 0.685, -0.84, 0.04, 0.04, tl),
357
+ S(0, 0.65, -0.885, 0.028, 0.028, tl),
358
+ S(0, 0.63, -0.9, 0.01, 0.01, tl),
359
+ ],
360
+ 8,
361
+ 'tail',
362
+ paint,
363
+ false,
364
+ true,
365
+ ),
366
+ )
367
+ // legs: thick columns on flat plantigrade paws (a long foot lofted forward from the ankle) with five claws
368
+ const feetF: [number, number][] = [],
369
+ feetB: [number, number][] = [] // front / back, each L then R
370
+ const paw = (x: number, z0: number, bone: number, len: number) => {
371
+ fur.push(
372
+ loft(
373
+ [
374
+ S(x, 0.075, z0 - 0.02, 0.078, 0.05, bone),
375
+ S(x, 0.06, z0 + len * 0.35, 0.092, 0.052, bone),
376
+ S(x, 0.05, z0 + len * 0.72, 0.09, 0.045, bone),
377
+ S(x, 0.045, z0 + len, 0.07, 0.035, bone),
378
+ ],
379
+ 12,
380
+ 'leg',
381
+ paint,
382
+ true,
383
+ true,
384
+ ),
385
+ )
386
+ for (let i = 0; i < 5; i++) {
387
+ const cx = x + (i - 2) * 0.034,
388
+ cz = z0 + len - 0.01 + (0.012 - Math.abs(i - 2) * 0.008)
389
+ hard.push(
390
+ tube(
391
+ [
392
+ [cx, 0.05, cz],
393
+ [cx, 0.04, cz + 0.035],
394
+ [cx, 0.012, cz + 0.06],
395
+ ],
396
+ 0.012,
397
+ 0.004,
398
+ bone,
399
+ 'claw',
400
+ paint,
401
+ 6,
402
+ ),
403
+ )
404
+ }
405
+ }
406
+ for (const side of ['L', 'R'] as const) {
407
+ const sx = side === 'L' ? 1 : -1
408
+ const sh = B(`F${side}_shoulder`),
409
+ ca = B(`F${side}_carpus`),
410
+ fe = B(`F${side}_fetlock`)
411
+ fur.push(
412
+ loft(
413
+ [
414
+ S(sx * 0.16, 0.72, 0.39, 0.16, 0.24, body, sh, 0.3),
415
+ S(sx * 0.175, 0.56, 0.4, 0.13, 0.18, body, sh, 0.8),
416
+ S(sx * 0.18, 0.43, 0.41, 0.1, 0.125, sh),
417
+ S(sx * 0.18, 0.32, 0.41, 0.085, 0.1, sh, ca, 0.5),
418
+ S(sx * 0.18, 0.22, 0.41, 0.078, 0.088, ca),
419
+ S(sx * 0.18, 0.13, 0.42, 0.076, 0.086, ca, fe, 0.5),
420
+ S(sx * 0.18, 0.08, 0.43, 0.08, 0.075, fe),
421
+ ],
422
+ 12,
423
+ 'leg',
424
+ paint,
425
+ false,
426
+ true,
427
+ ),
428
+ )
429
+ paw(sx * 0.18, 0.36, fe, 0.24)
430
+ feetF.push([sx * 0.18, 0.48])
431
+ const hp = B(`B${side}_hip`),
432
+ stf = B(`B${side}_stifle`),
433
+ hk = B(`B${side}_hock`)
434
+ fur.push(
435
+ loft(
436
+ [
437
+ S(sx * 0.15, 0.72, -0.53, 0.165, 0.25, body, hp, 0.3),
438
+ S(sx * 0.165, 0.56, -0.46, 0.14, 0.2, body, hp, 0.8),
439
+ S(sx * 0.17, 0.44, -0.4, 0.105, 0.135, hp, stf, 0.5),
440
+ S(sx * 0.17, 0.34, -0.44, 0.088, 0.105, stf),
441
+ S(sx * 0.17, 0.24, -0.51, 0.08, 0.092, stf, hk, 0.5),
442
+ S(sx * 0.17, 0.15, -0.5, 0.078, 0.086, hk),
443
+ S(sx * 0.17, 0.08, -0.49, 0.08, 0.075, hk),
444
+ ],
445
+ 12,
446
+ 'leg',
447
+ paint,
448
+ false,
449
+ true,
450
+ ),
451
+ )
452
+ paw(sx * 0.17, -0.57, hk, 0.29)
453
+ feetB.push([sx * 0.17, -0.4])
454
+ }
455
+ setShag(0)
456
+ const feetOrdered: [number, number][] = [...feetF, ...feetB]
457
+ void rng
458
+ return {
459
+ bones,
460
+ furParts: fur,
461
+ hardParts: hard,
462
+ eyeParts: eyes,
463
+ dims: {
464
+ bodyY: 0.66,
465
+ bodyHalfLen: 0.72,
466
+ bodyRadius: 0.36,
467
+ headRadius: 0.21,
468
+ legLen: 0.62,
469
+ feet: feetOrdered,
470
+ halfWidth: 0.31,
471
+ },
472
+ }
473
+ }
474
+
475
+ const BEAR_LOOK: CommonLook = {
476
+ rigContract: { skeleton: 'bear.v1', clips: [], sockets: ['body', 'head'] },
477
+ id: 'kit.look.bear',
478
+ species: 'kit.creature.bear',
479
+ kind: 'bear',
480
+ fur: {
481
+ texSeed: 303,
482
+ tex: {
483
+ contrast: 0.9,
484
+ grizzle: 0.45,
485
+ normalStrength: 2.4,
486
+ bristle: 0.3,
487
+ strandLen: 16,
488
+ root: 0.3,
489
+ },
490
+ roughness: 0.92,
491
+ sheen: 0.12,
492
+ sheenColor: [0.3, 0.24, 0.18],
493
+ envMapIntensity: 0.85,
494
+ rim: [0.85, 0.66, 0.42],
495
+ shellLen: 0.095,
496
+ shag: 0.028,
497
+ },
498
+ pose: { grazeNeck: 0.55, gallopTail: 0.2 },
499
+ variants: {
500
+ black: { traits: { grizzle: 0.3 } },
501
+ 'black-blaze': { traits: { grizzle: 0.3, blaze: 1 } },
502
+ brown: {
503
+ tint: BROWN_TINT,
504
+ traits: { hump: 1, grizzle: 0.6 },
505
+ fur: { rim: [0.95, 0.8, 0.55], sheenColor: [0.42, 0.34, 0.24] },
506
+ },
507
+ 'black-old': {
508
+ tint: BLACKPAW_TINT,
509
+ traits: { grizzle: 0.45, hump: 0.3 },
510
+ },
511
+ 'brown-old': {
512
+ tint: GRIZZLED_TINT,
513
+ traits: { hump: 1.3, grizzle: 1.0 },
514
+ fur: { rim: [0.95, 0.9, 0.78], sheenColor: [0.5, 0.46, 0.4] },
515
+ },
516
+ },
517
+ build: buildBear,
518
+ }
519
+
520
+ return BEAR_LOOK
521
+ }