@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.
- package/GUIDE.md +221 -0
- package/content/abilities/bite.json +24 -0
- package/content/abilities/charge.json +25 -0
- package/content/abilities/claw.json +24 -0
- package/content/abilities/slam.json +24 -0
- package/content/abilities/swing.json +25 -0
- package/content/animated/bear/pbr/black-blaze.glb +0 -0
- package/content/animated/bear/pbr/black-blaze.json +1 -0
- package/content/animated/bear/pbr/black-old.glb +0 -0
- package/content/animated/bear/pbr/black-old.json +1 -0
- package/content/animated/bear/pbr/black.glb +0 -0
- package/content/animated/bear/pbr/black.json +1 -0
- package/content/animated/bear/pbr/brown-old.glb +0 -0
- package/content/animated/bear/pbr/brown-old.json +1 -0
- package/content/animated/bear/pbr/brown.glb +0 -0
- package/content/animated/bear/pbr/brown.json +1 -0
- package/content/animated/bear/toon/black-blaze.glb +0 -0
- package/content/animated/bear/toon/black-blaze.json +1 -0
- package/content/animated/bear/toon/black-old.glb +0 -0
- package/content/animated/bear/toon/black-old.json +1 -0
- package/content/animated/bear/toon/black.glb +0 -0
- package/content/animated/bear/toon/black.json +1 -0
- package/content/animated/bear/toon/brown-old.glb +0 -0
- package/content/animated/bear/toon/brown-old.json +1 -0
- package/content/animated/bear/toon/brown.glb +0 -0
- package/content/animated/bear/toon/brown.json +1 -0
- package/content/animated/boar/pbr/big.glb +0 -0
- package/content/animated/boar/pbr/big.json +1 -0
- package/content/animated/boar/pbr/black.glb +0 -0
- package/content/animated/boar/pbr/black.json +1 -0
- package/content/animated/boar/pbr/boar.glb +0 -0
- package/content/animated/boar/pbr/boar.json +1 -0
- package/content/animated/boar/pbr/ironhide.glb +0 -0
- package/content/animated/boar/pbr/ironhide.json +1 -0
- package/content/animated/boar/pbr/scarback.glb +0 -0
- package/content/animated/boar/pbr/scarback.json +1 -0
- package/content/animated/boar/pbr/sow.glb +0 -0
- package/content/animated/boar/pbr/sow.json +1 -0
- package/content/animated/boar/toon/big.glb +0 -0
- package/content/animated/boar/toon/big.json +1 -0
- package/content/animated/boar/toon/black.glb +0 -0
- package/content/animated/boar/toon/black.json +1 -0
- package/content/animated/boar/toon/boar.glb +0 -0
- package/content/animated/boar/toon/boar.json +1 -0
- package/content/animated/boar/toon/ironhide.glb +0 -0
- package/content/animated/boar/toon/ironhide.json +1 -0
- package/content/animated/boar/toon/scarback.glb +0 -0
- package/content/animated/boar/toon/scarback.json +1 -0
- package/content/animated/boar/toon/sow.glb +0 -0
- package/content/animated/boar/toon/sow.json +1 -0
- package/content/animated/catalogue.json +1 -0
- package/content/bodies/biped.json +5 -0
- package/content/bodies/quadruped.json +5 -0
- package/content/clips/quadruped.json +1 -0
- package/content/creatures/bear/look.json +199 -0
- package/content/creatures/bear/pbr/black-blaze.glb +0 -0
- package/content/creatures/bear/pbr/black-old.glb +0 -0
- package/content/creatures/bear/pbr/black.glb +0 -0
- package/content/creatures/bear/pbr/brown-old.glb +0 -0
- package/content/creatures/bear/pbr/brown.glb +0 -0
- package/content/creatures/bear/toon/black-blaze.glb +0 -0
- package/content/creatures/bear/toon/black-old.glb +0 -0
- package/content/creatures/bear/toon/black.glb +0 -0
- package/content/creatures/bear/toon/brown-old.glb +0 -0
- package/content/creatures/bear/toon/brown.glb +0 -0
- package/content/creatures/bear.json +257 -0
- package/content/creatures/boar/look.json +184 -0
- package/content/creatures/boar/pbr/big.glb +0 -0
- package/content/creatures/boar/pbr/black.glb +0 -0
- package/content/creatures/boar/pbr/boar.glb +0 -0
- package/content/creatures/boar/pbr/ironhide.glb +0 -0
- package/content/creatures/boar/pbr/scarback.glb +0 -0
- package/content/creatures/boar/pbr/sow.glb +0 -0
- package/content/creatures/boar/toon/big.glb +0 -0
- package/content/creatures/boar/toon/black.glb +0 -0
- package/content/creatures/boar/toon/boar.glb +0 -0
- package/content/creatures/boar/toon/ironhide.glb +0 -0
- package/content/creatures/boar/toon/scarback.glb +0 -0
- package/content/creatures/boar/toon/sow.glb +0 -0
- package/content/creatures/boar.json +275 -0
- package/content/creatures/bodies.json +4754 -0
- package/content/harvest-items.json +98 -0
- package/content/harvest.json +31 -0
- package/content/journal-icons/antlers.png +0 -0
- package/content/journal-icons/bear.png +0 -0
- package/content/journal-icons/boar.png +0 -0
- package/content/journal-icons/deer.png +0 -0
- package/content/journal-icons/elk.png +0 -0
- package/content/journal-icons/ghost.png +0 -0
- package/content/journal-icons/ironhide.png +0 -0
- package/content/journal-icons.json +9 -0
- package/content/shared/pickupCatalogue.json +1008 -0
- package/content/shared/starterBow.json +21 -0
- package/content/species/bear.json +144 -0
- package/content/species/boar.json +147 -0
- package/content/sword-debris.json +7 -0
- package/content/temperaments.json +519 -0
- package/content/tuning/bear.json +43 -0
- package/content/tuning/boar.json +32 -0
- package/content/tuning/deer.json +32 -0
- package/content/tuning/pursue.json +12 -0
- package/package.json +63 -3
- package/src/abilities.ts +85 -0
- package/src/body.ts +25 -0
- package/src/clips.ts +139 -0
- package/src/creatures.ts +76 -0
- package/src/geometry/arms.ts +725 -0
- package/src/geometry/bear.ts +521 -0
- package/src/geometry/boar.ts +604 -0
- package/src/geometry/bowProfile.ts +34 -0
- package/src/geometry/export.ts +101 -0
- package/src/geometry/meleeProfile.ts +261 -0
- package/src/geometry/nativeInteractionFacts.ts +7 -0
- package/src/geometry/nativeLooks.ts +54 -0
- package/src/geometry/riderArms.ts +215 -0
- package/src/geometry/sharedSpecs.ts +26 -0
- package/src/geometry/species.ts +768 -0
- package/src/geometry/specimenCatalogue.ts +80 -0
- package/src/geometry/starterCombat.ts +194 -0
- package/src/geometry/starterGlyphs.ts +12 -0
- package/src/geometry/starterMeleeProfile.ts +134 -0
- package/src/geometry/starterMoves.ts +172 -0
- package/src/index.ts +26 -0
- package/src/legacyCombat.ts +25 -0
- package/src/legacyHarvest.ts +104 -0
- package/src/legacyJournalIcons.ts +10 -0
- package/src/legacySpecies.ts +127 -0
- package/src/temperament.ts +97 -0
- package/README.md +0 -3
|
@@ -0,0 +1,604 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* Wild boar — 0.62 m at the spine, shoulder hump, bristle crest, tusks, held-low wedge head.
|
|
17
|
+
*
|
|
18
|
+
* Variants (traits read by build): tuskScale (length; radius grows as tuskScale^0.6), scar (0/1: a pale
|
|
19
|
+
* ragged stripe across the withers).
|
|
20
|
+
* Palette keys (VariantDef.tint): base grizzle dark black snout tusk hoof eye cheek scar.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
export const BOAR_PALETTE: {
|
|
24
|
+
// exported: pineCoats.ts recolours the rigged hull per variant from it
|
|
25
|
+
// dark grey-brown with grizzled pale bristle tips along the spine, pale tusks
|
|
26
|
+
base: [number, number, number]
|
|
27
|
+
grizzle: [number, number, number]
|
|
28
|
+
dark: [number, number, number]
|
|
29
|
+
black: [number, number, number]
|
|
30
|
+
snout: [number, number, number]
|
|
31
|
+
tusk: [number, number, number]
|
|
32
|
+
hoof: [number, number, number]
|
|
33
|
+
eye: [number, number, number]
|
|
34
|
+
cheek: [number, number, number]
|
|
35
|
+
scar: [number, number, number]
|
|
36
|
+
} = {
|
|
37
|
+
// exported: pineCoats.ts recolours the rigged hull per variant from it
|
|
38
|
+
// dark grey-brown with grizzled pale bristle tips along the spine, pale tusks
|
|
39
|
+
base: [0.36, 0.29, 0.225],
|
|
40
|
+
grizzle: [0.58, 0.5, 0.4],
|
|
41
|
+
dark: [0.16, 0.13, 0.1],
|
|
42
|
+
black: [0.06, 0.05, 0.045],
|
|
43
|
+
snout: [0.16, 0.09, 0.08],
|
|
44
|
+
tusk: [0.9, 0.86, 0.74],
|
|
45
|
+
hoof: [0.09, 0.075, 0.065],
|
|
46
|
+
eye: [0.02, 0.015, 0.01],
|
|
47
|
+
cheek: [0.4, 0.36, 0.3],
|
|
48
|
+
scar: [0.8, 0.62, 0.56], // bare, healed hide
|
|
49
|
+
} satisfies Record<string, RGB>
|
|
50
|
+
|
|
51
|
+
/** near-black coat: the grizzle is only a dull sheen, the cheeks barely lighter */
|
|
52
|
+
const BLACK_TINT: Record<string, RGB> = {
|
|
53
|
+
base: [0.1, 0.09, 0.085],
|
|
54
|
+
grizzle: [0.24, 0.22, 0.2],
|
|
55
|
+
dark: [0.05, 0.045, 0.04],
|
|
56
|
+
black: [0.03, 0.03, 0.03],
|
|
57
|
+
cheek: [0.17, 0.15, 0.13],
|
|
58
|
+
snout: [0.1, 0.07, 0.07],
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** grey-brown, heavily grizzled old boar */
|
|
62
|
+
const SCARBACK_TINT: Record<string, RGB> = {
|
|
63
|
+
base: [0.34, 0.31, 0.27],
|
|
64
|
+
grizzle: [0.6, 0.56, 0.5],
|
|
65
|
+
dark: [0.15, 0.135, 0.12],
|
|
66
|
+
cheek: [0.46, 0.43, 0.38],
|
|
67
|
+
tusk: [0.86, 0.8, 0.66],
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** Old Ironhide: iron-grey, almost blue in the shade, with steel-pale bristle tips */
|
|
71
|
+
const IRONHIDE_TINT: Record<string, RGB> = {
|
|
72
|
+
base: [0.28, 0.29, 0.31],
|
|
73
|
+
grizzle: [0.52, 0.54, 0.56],
|
|
74
|
+
dark: [0.12, 0.125, 0.14],
|
|
75
|
+
black: [0.05, 0.05, 0.06],
|
|
76
|
+
cheek: [0.4, 0.41, 0.42],
|
|
77
|
+
snout: [0.12, 0.1, 0.1],
|
|
78
|
+
tusk: [0.8, 0.78, 0.7],
|
|
79
|
+
hoof: [0.08, 0.08, 0.085],
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function createBoarLook(compiler: SpeciesGeometryCompiler): CommonLook {
|
|
83
|
+
const {
|
|
84
|
+
loft,
|
|
85
|
+
tube,
|
|
86
|
+
skinPlain,
|
|
87
|
+
S,
|
|
88
|
+
boneIndex,
|
|
89
|
+
mix,
|
|
90
|
+
paintNoise,
|
|
91
|
+
setShag,
|
|
92
|
+
isLowPoly,
|
|
93
|
+
paletteColors,
|
|
94
|
+
srgb,
|
|
95
|
+
toonPaint,
|
|
96
|
+
} = compiler
|
|
97
|
+
function crestSpikes(
|
|
98
|
+
pts: [number, number, number, number, number, number][],
|
|
99
|
+
yOff: number,
|
|
100
|
+
paint: Paint,
|
|
101
|
+
): THREE.BufferGeometry[] {
|
|
102
|
+
const out: THREE.BufferGeometry[] = []
|
|
103
|
+
const P = pts.filter(p => p[2] >= 0.03).sort((a, b) => a[0] - b[0]) // rear → front
|
|
104
|
+
if (P.length < 2) return out
|
|
105
|
+
const first = P[0],
|
|
106
|
+
last = P[P.length - 1]
|
|
107
|
+
if (first === undefined || last === undefined) return out
|
|
108
|
+
const z0 = first[0],
|
|
109
|
+
z1 = last[0],
|
|
110
|
+
step = 0.082
|
|
111
|
+
const n = Math.max(2, Math.round((z1 - z0) / step))
|
|
112
|
+
for (let i = 0; i <= n; i++) {
|
|
113
|
+
const z = z0 + ((z1 - z0) * i) / n
|
|
114
|
+
let k = 0
|
|
115
|
+
while (k < P.length - 2 && (P[k + 1]?.[0] ?? Infinity) < z) k++
|
|
116
|
+
const a = P[k],
|
|
117
|
+
b = P[k + 1]
|
|
118
|
+
if (a === undefined || b === undefined) continue
|
|
119
|
+
const u = THREE.MathUtils.clamp(
|
|
120
|
+
(z - a[0]) / Math.max(1e-4, b[0] - a[0]),
|
|
121
|
+
0,
|
|
122
|
+
1,
|
|
123
|
+
)
|
|
124
|
+
const y = a[1] + (b[1] - a[1]) * u,
|
|
125
|
+
ry = a[2] + (b[2] - a[2]) * u
|
|
126
|
+
const near = u < 0.5 ? a : b
|
|
127
|
+
// the PBR fin sits mostly inside the back (its fur shells do the work); the spikes start at the skin
|
|
128
|
+
const h =
|
|
129
|
+
(ry * 1.8 + 0.03) *
|
|
130
|
+
(i % 2 ? 0.72 : 1) *
|
|
131
|
+
(0.8 + 0.2 * Math.sin(z * 5 + 1))
|
|
132
|
+
const baseY = y + 0.02 + yOff
|
|
133
|
+
out.push(
|
|
134
|
+
loft(
|
|
135
|
+
[
|
|
136
|
+
S(0, baseY - 0.05, z, 0.034, 0.05, near[3], near[4], near[5]),
|
|
137
|
+
S(
|
|
138
|
+
0,
|
|
139
|
+
baseY + h * 0.45,
|
|
140
|
+
z - h * 0.2,
|
|
141
|
+
0.02,
|
|
142
|
+
0.03,
|
|
143
|
+
near[3],
|
|
144
|
+
near[4],
|
|
145
|
+
near[5],
|
|
146
|
+
),
|
|
147
|
+
S(
|
|
148
|
+
0,
|
|
149
|
+
baseY + h,
|
|
150
|
+
z - h * 0.55,
|
|
151
|
+
0.003,
|
|
152
|
+
0.003,
|
|
153
|
+
near[3],
|
|
154
|
+
near[4],
|
|
155
|
+
near[5],
|
|
156
|
+
),
|
|
157
|
+
],
|
|
158
|
+
4,
|
|
159
|
+
'crest',
|
|
160
|
+
paint,
|
|
161
|
+
false,
|
|
162
|
+
false,
|
|
163
|
+
),
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
return out
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function boarPaint(v: VariantDef): Paint {
|
|
170
|
+
const P = paletteColors(BOAR_PALETTE, v.tint)
|
|
171
|
+
const { base, grizzle, dark, black, snout, tusk, hoof, eye, cheek, scar } =
|
|
172
|
+
P
|
|
173
|
+
const tuskRoot = srgb(0.55, 0.48, 0.4)
|
|
174
|
+
const hasScar = Boolean(v.traits?.['scar'])
|
|
175
|
+
return (out, x, y, z, nx, ny, nz, part, t, _a) => {
|
|
176
|
+
const n1 = paintNoise.fbm(x * 4 + 11, z * 4 + y * 3, 3)
|
|
177
|
+
switch (part) {
|
|
178
|
+
case 'body':
|
|
179
|
+
out.copy(base)
|
|
180
|
+
mix(
|
|
181
|
+
out,
|
|
182
|
+
out,
|
|
183
|
+
grizzle,
|
|
184
|
+
sstep(-0.1, 0.9, ny) * (0.3 + 0.4 * sstep(-0.3, 0.5, n1)),
|
|
185
|
+
) // grizzled back
|
|
186
|
+
mix(out, out, dark, sstep(-0.3, -0.8, ny) * 0.85)
|
|
187
|
+
break
|
|
188
|
+
case 'neck':
|
|
189
|
+
case 'head':
|
|
190
|
+
out.copy(base)
|
|
191
|
+
mix(
|
|
192
|
+
out,
|
|
193
|
+
out,
|
|
194
|
+
cheek,
|
|
195
|
+
sstep(0.55, 0.85, t) * sstep(0.3, 0.9, Math.abs(nx)) * 0.75,
|
|
196
|
+
) // pale cheek whiskers
|
|
197
|
+
mix(out, out, grizzle, sstep(0.2, 0.9, ny) * 0.3)
|
|
198
|
+
mix(out, out, dark, sstep(-0.3, -0.8, ny) * 0.75)
|
|
199
|
+
mix(out, out, black, sstep(0.9, 0.98, t))
|
|
200
|
+
break
|
|
201
|
+
case 'snout':
|
|
202
|
+
out.copy(snout)
|
|
203
|
+
break
|
|
204
|
+
case 'crest':
|
|
205
|
+
mix(out, dark, grizzle, sstep(0.0, 0.5, ny) * (0.35 + 0.3 * n1))
|
|
206
|
+
break
|
|
207
|
+
case 'ear':
|
|
208
|
+
out.copy(dark)
|
|
209
|
+
mix(out, out, base, sstep(0.1, 0.6, nz) * 0.6)
|
|
210
|
+
break
|
|
211
|
+
case 'leg':
|
|
212
|
+
mix(out, base, dark, sstep(0.45, 0.2, y))
|
|
213
|
+
break
|
|
214
|
+
case 'tail':
|
|
215
|
+
mix(out, dark, black, sstep(0.6, 1, t))
|
|
216
|
+
break
|
|
217
|
+
case 'tusk':
|
|
218
|
+
mix(out, tuskRoot, tusk, sstep(0.0, 0.45, t))
|
|
219
|
+
break
|
|
220
|
+
case 'hoof':
|
|
221
|
+
out.copy(hoof)
|
|
222
|
+
break
|
|
223
|
+
case 'eye':
|
|
224
|
+
out.copy(eye)
|
|
225
|
+
break
|
|
226
|
+
default:
|
|
227
|
+
out.copy(base)
|
|
228
|
+
}
|
|
229
|
+
// Scarback: a pale, ragged old wound across the withers (upper body / crest, z ≈ 0.25..0.55)
|
|
230
|
+
if (
|
|
231
|
+
hasScar &&
|
|
232
|
+
(part === 'body' || part === 'crest' || part === 'neck') &&
|
|
233
|
+
ny > -0.6
|
|
234
|
+
) {
|
|
235
|
+
const edge = paintNoise.fbm(x * 9 + 70, z * 7 - 30, 2) * 0.06
|
|
236
|
+
const band =
|
|
237
|
+
sstep(0.2, 0.09, Math.abs(z - 0.38 + edge)) * sstep(-0.6, -0.1, ny) // over the withers, down both shoulders
|
|
238
|
+
const gaps = sstep(
|
|
239
|
+
-0.7,
|
|
240
|
+
-0.35,
|
|
241
|
+
paintNoise.fbm(x * 6 - 15, z * 14 + y * 5, 2),
|
|
242
|
+
) // broken, not a painted stripe
|
|
243
|
+
mix(out, out, scar, band * gaps)
|
|
244
|
+
}
|
|
245
|
+
let m = 1 + 0.14 * n1
|
|
246
|
+
if (part === 'body')
|
|
247
|
+
m *=
|
|
248
|
+
1 -
|
|
249
|
+
0.35 * sstep(-0.2, -0.9, ny) -
|
|
250
|
+
0.25 *
|
|
251
|
+
sstep(0.25, 0.05, Math.abs(Math.abs(z) - 0.45)) *
|
|
252
|
+
sstep(0.55, 0.35, y)
|
|
253
|
+
if (part === 'leg')
|
|
254
|
+
m *= 1 - 0.3 * sstep(0.3, 0.55, y) - 0.2 * sstep(0.15, 0.1, Math.abs(x))
|
|
255
|
+
out.r *= m
|
|
256
|
+
out.g *= m
|
|
257
|
+
out.b *= m
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function buildBoar(v: VariantDef, rng: Rng): AnimalSpecies {
|
|
262
|
+
const tuskScale = Number(v.traits?.['tuskScale'] ?? 1)
|
|
263
|
+
setShag(0.016)
|
|
264
|
+
const bones: BoneDef[] = [
|
|
265
|
+
{ name: 'body', parent: null, pos: [0, 0.62, -0.02] },
|
|
266
|
+
{ name: 'neck1', parent: 'body', pos: [0, 0.69, 0.55] },
|
|
267
|
+
{ name: 'neck2', parent: 'neck1', pos: [0, 0.7, 0.66] },
|
|
268
|
+
{ name: 'head', parent: 'neck2', pos: [0, 0.7, 0.78] },
|
|
269
|
+
{ name: 'earL', parent: 'head', pos: [0.09, 0.85, 0.82] },
|
|
270
|
+
{ name: 'earR', parent: 'head', pos: [-0.09, 0.85, 0.82] },
|
|
271
|
+
{ name: 'tail', parent: 'body', pos: [0, 0.71, -0.62] },
|
|
272
|
+
{ name: 'belly', parent: 'body', pos: [0, 0.5, 0.0] },
|
|
273
|
+
]
|
|
274
|
+
for (const side of ['L', 'R'] as const) {
|
|
275
|
+
const sx = side === 'L' ? 1 : -1
|
|
276
|
+
bones.push(
|
|
277
|
+
{
|
|
278
|
+
name: `F${side}_shoulder`,
|
|
279
|
+
parent: 'body',
|
|
280
|
+
pos: [sx * 0.14, 0.58, 0.42],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: `F${side}_carpus`,
|
|
284
|
+
parent: `F${side}_shoulder`,
|
|
285
|
+
pos: [sx * 0.14, 0.3, 0.42],
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: `F${side}_fetlock`,
|
|
289
|
+
parent: `F${side}_carpus`,
|
|
290
|
+
pos: [sx * 0.14, 0.1, 0.42],
|
|
291
|
+
},
|
|
292
|
+
{ name: `B${side}_hip`, parent: 'body', pos: [sx * 0.13, 0.58, -0.45] },
|
|
293
|
+
{
|
|
294
|
+
name: `B${side}_stifle`,
|
|
295
|
+
parent: `B${side}_hip`,
|
|
296
|
+
pos: [sx * 0.14, 0.36, -0.36],
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
name: `B${side}_hock`,
|
|
300
|
+
parent: `B${side}_stifle`,
|
|
301
|
+
pos: [sx * 0.14, 0.24, -0.48],
|
|
302
|
+
},
|
|
303
|
+
)
|
|
304
|
+
}
|
|
305
|
+
const B = boneIndex(bones)
|
|
306
|
+
const lowPoly = isLowPoly() // a toon level: its own palette (toonPaint), crest = a row of spikes
|
|
307
|
+
const toon = lowPoly ? toonPaint('boar') : null
|
|
308
|
+
const paint = toon !== null ? toon(v) : boarPaint(v)
|
|
309
|
+
const fur: THREE.BufferGeometry[] = [],
|
|
310
|
+
hard: THREE.BufferGeometry[] = [],
|
|
311
|
+
eyes: THREE.BufferGeometry[] = []
|
|
312
|
+
const body = B('body'),
|
|
313
|
+
n1 = B('neck1'),
|
|
314
|
+
n2 = B('neck2'),
|
|
315
|
+
hd = B('head'),
|
|
316
|
+
bl = B('belly')
|
|
317
|
+
// torso: barrel with shoulder hump, narrower hips (y is raised 0.07 vs the first draft: legs were too short)
|
|
318
|
+
const Y = 0.07
|
|
319
|
+
fur.push(
|
|
320
|
+
loft(
|
|
321
|
+
[
|
|
322
|
+
S(0, 0.55 + Y, -0.64, 0.02, 0.02, body),
|
|
323
|
+
S(0, 0.545 + Y, -0.625, 0.12, 0.16, body),
|
|
324
|
+
S(0, 0.54 + Y, -0.58, 0.19, 0.24, body, body, 0, 1.0, 1.0),
|
|
325
|
+
S(0, 0.54 + Y, -0.48, 0.225, 0.27, body, body, 0, 1.04, 1.0),
|
|
326
|
+
S(0, 0.55 + Y, -0.3, 0.26, 0.32, body, bl, 0.5, 1.06, 1.06),
|
|
327
|
+
S(0, 0.55 + Y, -0.05, 0.275, 0.335, body, bl, 0.7, 1.14, 1.08),
|
|
328
|
+
S(0, 0.56 + Y, 0.18, 0.285, 0.34, body, bl, 0.4, 1.3, 1.06),
|
|
329
|
+
S(0, 0.58 + Y, 0.36, 0.285, 0.34, body, n1, 0.15, 1.38, 1.02),
|
|
330
|
+
S(0, 0.6 + Y, 0.52, 0.26, 0.32, body, n1, 0.5, 1.3, 0.96),
|
|
331
|
+
S(0, 0.62 + Y, 0.66, 0.21, 0.26, n1, n2, 0.5, 1.12, 0.95),
|
|
332
|
+
S(0, 0.625 + Y, 0.78, 0.175, 0.21, n2, hd, 0.6, 1.06, 0.98),
|
|
333
|
+
],
|
|
334
|
+
22,
|
|
335
|
+
'body',
|
|
336
|
+
paint,
|
|
337
|
+
true,
|
|
338
|
+
false,
|
|
339
|
+
),
|
|
340
|
+
)
|
|
341
|
+
// head: heavy wedge from the neck to a narrow snout, held low
|
|
342
|
+
fur.push(
|
|
343
|
+
loft(
|
|
344
|
+
[
|
|
345
|
+
S(0, 0.625 + Y, 0.76, 0.18, 0.215, n2, hd, 0.5, 1.06, 0.98),
|
|
346
|
+
S(0, 0.615 + Y, 0.9, 0.155, 0.185, hd, hd, 0, 1.05, 1.0),
|
|
347
|
+
S(0, 0.585 + Y, 1.02, 0.125, 0.145, hd, hd, 0, 1.0, 1.08),
|
|
348
|
+
S(0, 0.535 + Y, 1.14, 0.095, 0.11, hd, hd, 0, 1.0, 1.12),
|
|
349
|
+
S(0, 0.48 + Y, 1.25, 0.072, 0.082, hd, hd, 0, 1.0, 1.12),
|
|
350
|
+
S(0, 0.44 + Y, 1.33, 0.058, 0.064, hd),
|
|
351
|
+
S(0, 0.425 + Y, 1.37, 0.052, 0.054, hd),
|
|
352
|
+
],
|
|
353
|
+
18,
|
|
354
|
+
'head',
|
|
355
|
+
paint,
|
|
356
|
+
false,
|
|
357
|
+
true,
|
|
358
|
+
),
|
|
359
|
+
)
|
|
360
|
+
// snout disc
|
|
361
|
+
hard.push(
|
|
362
|
+
loft(
|
|
363
|
+
[
|
|
364
|
+
S(0, 0.425 + Y, 1.365, 0.054, 0.056, hd),
|
|
365
|
+
S(0, 0.42 + Y, 1.395, 0.062, 0.064, hd),
|
|
366
|
+
S(0, 0.418 + Y, 1.405, 0.057, 0.059, hd),
|
|
367
|
+
S(0, 0.418 + Y, 1.408, 0.02, 0.02, hd),
|
|
368
|
+
],
|
|
369
|
+
14,
|
|
370
|
+
'snout',
|
|
371
|
+
paint,
|
|
372
|
+
),
|
|
373
|
+
)
|
|
374
|
+
// tusks (lower, curving up and out) — scaled about the root in the jaw by tuskScale
|
|
375
|
+
const tk = tuskScale,
|
|
376
|
+
trk = tuskScale ** 0.6
|
|
377
|
+
for (const sx of [1, -1]) {
|
|
378
|
+
const root: [number, number, number] = [sx * 0.05, 0.43 + Y, 1.22]
|
|
379
|
+
const T = (p: [number, number, number]): [number, number, number] => [
|
|
380
|
+
root[0] + (p[0] - root[0]) * tk,
|
|
381
|
+
root[1] + (p[1] - root[1]) * tk,
|
|
382
|
+
root[2] + (p[2] - root[2]) * tk,
|
|
383
|
+
]
|
|
384
|
+
const pts: [number, number, number][] = [
|
|
385
|
+
[sx * 0.05, 0.43 + Y, 1.22],
|
|
386
|
+
[sx * 0.078, 0.45 + Y, 1.265],
|
|
387
|
+
[sx * 0.1, 0.5 + Y, 1.28],
|
|
388
|
+
[sx * 0.105, 0.55 + Y, 1.275],
|
|
389
|
+
]
|
|
390
|
+
if (tk > 1.5) pts.push([sx * 0.1, 0.585 + Y, 1.255]) // big tusks curl back over the snout
|
|
391
|
+
hard.push(
|
|
392
|
+
tube(pts.map(T), 0.016 * trk, 0.004 * trk, hd, 'tusk', paint, 6),
|
|
393
|
+
)
|
|
394
|
+
const eb = B(sx > 0 ? 'earL' : 'earR')
|
|
395
|
+
fur.push(
|
|
396
|
+
loft(
|
|
397
|
+
[
|
|
398
|
+
S(sx * 0.08, 0.76 + Y, 0.84, 0.03, 0.015, hd, eb, 0.3),
|
|
399
|
+
S(sx * 0.11, 0.83 + Y, 0.82, 0.05, 0.015, eb),
|
|
400
|
+
S(sx * 0.14, 0.9 + Y, 0.8, 0.045, 0.013, eb),
|
|
401
|
+
S(sx * 0.165, 0.96 + Y, 0.78, 0.025, 0.01, eb),
|
|
402
|
+
S(sx * 0.175, 0.985 + Y, 0.77, 0.008, 0.005, eb),
|
|
403
|
+
],
|
|
404
|
+
10,
|
|
405
|
+
'ear',
|
|
406
|
+
paint,
|
|
407
|
+
true,
|
|
408
|
+
true,
|
|
409
|
+
'z',
|
|
410
|
+
),
|
|
411
|
+
)
|
|
412
|
+
const eye = lowPoly
|
|
413
|
+
? new THREE.SphereGeometry(0.018, 6, 4)
|
|
414
|
+
: new THREE.SphereGeometry(0.016, 10, 8)
|
|
415
|
+
eye.translate(sx * 0.115, 0.625 + Y, 0.97)
|
|
416
|
+
eyes.push(skinPlain(eye, hd, 'eye', paint))
|
|
417
|
+
}
|
|
418
|
+
// bristle crest along the spine (a jagged fin), stations rear → front so the ring 'up' is +Y
|
|
419
|
+
const crestSt = [] as ReturnType<typeof S>[]
|
|
420
|
+
const crestPts: [number, number, number, number, number, number][] = [
|
|
421
|
+
// z, y, ry, b0, b1, w1
|
|
422
|
+
[0.86, 0.78, 0.02, hd, hd, 0],
|
|
423
|
+
[0.74, 0.86, 0.06, n2, hd, 0.5],
|
|
424
|
+
[0.58, 0.93, 0.09, n1, n2, 0.5],
|
|
425
|
+
[0.42, 0.985, 0.1, body, n1, 0.4],
|
|
426
|
+
[0.26, 0.965, 0.09, body, body, 0],
|
|
427
|
+
[0.08, 0.915, 0.075, body, body, 0],
|
|
428
|
+
[-0.12, 0.875, 0.06, body, body, 0],
|
|
429
|
+
[-0.32, 0.85, 0.045, body, body, 0],
|
|
430
|
+
[-0.5, 0.82, 0.025, body, body, 0],
|
|
431
|
+
[-0.58, 0.8, 0.01, body, body, 0],
|
|
432
|
+
]
|
|
433
|
+
crestPts.reverse().forEach(([z, y, ry, b0, b1, w1]) => {
|
|
434
|
+
crestSt.push(
|
|
435
|
+
S(
|
|
436
|
+
0,
|
|
437
|
+
y - 0.04 + Y,
|
|
438
|
+
z,
|
|
439
|
+
0.022,
|
|
440
|
+
ry * (0.85 + rng.next() * 0.3),
|
|
441
|
+
b0,
|
|
442
|
+
b1,
|
|
443
|
+
w1,
|
|
444
|
+
1,
|
|
445
|
+
0.3,
|
|
446
|
+
),
|
|
447
|
+
)
|
|
448
|
+
})
|
|
449
|
+
if (lowPoly) fur.push(...crestSpikes(crestPts, Y, paint))
|
|
450
|
+
else fur.push(loft(crestSt, 6, 'crest', paint))
|
|
451
|
+
// tail with tuft
|
|
452
|
+
const tl = B('tail')
|
|
453
|
+
fur.push(
|
|
454
|
+
loft(
|
|
455
|
+
[
|
|
456
|
+
S(0, 0.63 + Y, -0.62, 0.028, 0.028, body, tl, 0.3),
|
|
457
|
+
S(0, 0.52 + Y, -0.69, 0.02, 0.02, tl),
|
|
458
|
+
S(0, 0.4 + Y, -0.72, 0.016, 0.016, tl),
|
|
459
|
+
S(0, 0.33 + Y, -0.73, 0.03, 0.03, tl),
|
|
460
|
+
S(0, 0.27 + Y, -0.735, 0.022, 0.022, tl),
|
|
461
|
+
S(0, 0.24 + Y, -0.74, 0.008, 0.008, tl),
|
|
462
|
+
],
|
|
463
|
+
8,
|
|
464
|
+
'tail',
|
|
465
|
+
paint,
|
|
466
|
+
false,
|
|
467
|
+
true,
|
|
468
|
+
),
|
|
469
|
+
)
|
|
470
|
+
// legs
|
|
471
|
+
const feetF: [number, number][] = [],
|
|
472
|
+
feetB: [number, number][] = [] // front / back, each L then R
|
|
473
|
+
for (const side of ['L', 'R'] as const) {
|
|
474
|
+
const sx = side === 'L' ? 1 : -1
|
|
475
|
+
const sh = B(`F${side}_shoulder`),
|
|
476
|
+
ca = B(`F${side}_carpus`),
|
|
477
|
+
fe = B(`F${side}_fetlock`)
|
|
478
|
+
fur.push(
|
|
479
|
+
loft(
|
|
480
|
+
[
|
|
481
|
+
S(sx * 0.13, 0.66, 0.4, 0.13, 0.19, body, sh, 0.3),
|
|
482
|
+
S(sx * 0.145, 0.5, 0.42, 0.105, 0.15, body, sh, 0.8),
|
|
483
|
+
S(sx * 0.15, 0.37, 0.42, 0.072, 0.095, sh),
|
|
484
|
+
S(sx * 0.15, 0.31, 0.42, 0.054, 0.066, sh, ca, 0.5),
|
|
485
|
+
S(sx * 0.15, 0.22, 0.42, 0.046, 0.056, ca),
|
|
486
|
+
S(sx * 0.15, 0.13, 0.42, 0.045, 0.055, ca, fe, 0.5),
|
|
487
|
+
S(sx * 0.15, 0.07, 0.43, 0.042, 0.052, fe),
|
|
488
|
+
],
|
|
489
|
+
12,
|
|
490
|
+
'leg',
|
|
491
|
+
paint,
|
|
492
|
+
false,
|
|
493
|
+
true,
|
|
494
|
+
),
|
|
495
|
+
)
|
|
496
|
+
hard.push(
|
|
497
|
+
loft(
|
|
498
|
+
[
|
|
499
|
+
S(sx * 0.145, 0.07, 0.43, 0.036, 0.045, fe),
|
|
500
|
+
S(sx * 0.145, 0.035, 0.44, 0.042, 0.052, fe),
|
|
501
|
+
S(sx * 0.145, 0.0, 0.445, 0.038, 0.048, fe),
|
|
502
|
+
S(sx * 0.145, -0.005, 0.445, 0.01, 0.01, fe),
|
|
503
|
+
],
|
|
504
|
+
10,
|
|
505
|
+
'hoof',
|
|
506
|
+
paint,
|
|
507
|
+
),
|
|
508
|
+
)
|
|
509
|
+
feetF.push([sx * 0.145, 0.445])
|
|
510
|
+
const hp = B(`B${side}_hip`),
|
|
511
|
+
stf = B(`B${side}_stifle`),
|
|
512
|
+
hk = B(`B${side}_hock`)
|
|
513
|
+
fur.push(
|
|
514
|
+
loft(
|
|
515
|
+
[
|
|
516
|
+
S(sx * 0.11, 0.62, -0.5, 0.13, 0.2, body, hp, 0.3),
|
|
517
|
+
S(sx * 0.135, 0.49, -0.43, 0.11, 0.16, body, hp, 0.8),
|
|
518
|
+
S(sx * 0.145, 0.38, -0.38, 0.076, 0.098, hp, stf, 0.5),
|
|
519
|
+
S(sx * 0.15, 0.3, -0.43, 0.056, 0.07, stf),
|
|
520
|
+
S(sx * 0.15, 0.25, -0.475, 0.048, 0.06, stf, hk, 0.5),
|
|
521
|
+
S(sx * 0.15, 0.15, -0.465, 0.045, 0.055, hk),
|
|
522
|
+
S(sx * 0.15, 0.07, -0.45, 0.042, 0.052, hk),
|
|
523
|
+
],
|
|
524
|
+
12,
|
|
525
|
+
'leg',
|
|
526
|
+
paint,
|
|
527
|
+
false,
|
|
528
|
+
true,
|
|
529
|
+
),
|
|
530
|
+
)
|
|
531
|
+
hard.push(
|
|
532
|
+
loft(
|
|
533
|
+
[
|
|
534
|
+
S(sx * 0.145, 0.07, -0.45, 0.036, 0.045, hk),
|
|
535
|
+
S(sx * 0.145, 0.035, -0.445, 0.042, 0.052, hk),
|
|
536
|
+
S(sx * 0.145, 0.0, -0.44, 0.038, 0.048, hk),
|
|
537
|
+
S(sx * 0.145, -0.005, -0.44, 0.01, 0.01, hk),
|
|
538
|
+
],
|
|
539
|
+
10,
|
|
540
|
+
'hoof',
|
|
541
|
+
paint,
|
|
542
|
+
),
|
|
543
|
+
)
|
|
544
|
+
feetB.push([sx * 0.145, -0.44])
|
|
545
|
+
}
|
|
546
|
+
setShag(0)
|
|
547
|
+
const feetOrdered: [number, number][] = [...feetF, ...feetB]
|
|
548
|
+
return {
|
|
549
|
+
bones,
|
|
550
|
+
furParts: fur,
|
|
551
|
+
hardParts: hard,
|
|
552
|
+
eyeParts: eyes,
|
|
553
|
+
dims: {
|
|
554
|
+
bodyY: 0.62,
|
|
555
|
+
bodyHalfLen: 0.65,
|
|
556
|
+
bodyRadius: 0.33,
|
|
557
|
+
headRadius: 0.2,
|
|
558
|
+
legLen: 0.58,
|
|
559
|
+
feet: feetOrdered,
|
|
560
|
+
halfWidth: 0.29,
|
|
561
|
+
},
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
const BOAR_LOOK: CommonLook = {
|
|
566
|
+
rigContract: { skeleton: 'boar.v1', clips: [], sockets: ['body', 'head'] },
|
|
567
|
+
id: 'kit.look.boar',
|
|
568
|
+
species: 'kit.creature.boar',
|
|
569
|
+
kind: 'boar',
|
|
570
|
+
fur: {
|
|
571
|
+
texSeed: 202,
|
|
572
|
+
tex: {
|
|
573
|
+
contrast: 1.0,
|
|
574
|
+
grizzle: 0.6,
|
|
575
|
+
normalStrength: 2.2,
|
|
576
|
+
bristle: 0.6,
|
|
577
|
+
strandLen: 12,
|
|
578
|
+
root: 0.24,
|
|
579
|
+
},
|
|
580
|
+
roughness: 0.88,
|
|
581
|
+
sheen: 0.15,
|
|
582
|
+
sheenColor: [0.35, 0.3, 0.24],
|
|
583
|
+
envMapIntensity: 0.9,
|
|
584
|
+
rim: [0.9, 0.7, 0.45],
|
|
585
|
+
shellLen: 0.065,
|
|
586
|
+
shag: 0.016,
|
|
587
|
+
},
|
|
588
|
+
pose: { grazeNeck: 0.3, gallopTail: 0.5 },
|
|
589
|
+
variants: {
|
|
590
|
+
sow: { traits: { tuskScale: 0.6 } },
|
|
591
|
+
black: { tint: BLACK_TINT, traits: { tuskScale: 1.6 } },
|
|
592
|
+
big: { traits: { tuskScale: 1.3 } },
|
|
593
|
+
scarback: { tint: SCARBACK_TINT, traits: { tuskScale: 1.8, scar: 1 } },
|
|
594
|
+
ironhide: {
|
|
595
|
+
tint: IRONHIDE_TINT,
|
|
596
|
+
traits: { tuskScale: 2.2 },
|
|
597
|
+
fur: { rim: [0.75, 0.78, 0.85], sheenColor: [0.4, 0.42, 0.46] },
|
|
598
|
+
},
|
|
599
|
+
},
|
|
600
|
+
build: buildBoar,
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
return BOAR_LOOK
|
|
604
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BowWeaponProfileSchema,
|
|
3
|
+
HeldBowFileSchema,
|
|
4
|
+
type HeldBowFileRows,
|
|
5
|
+
} from '@wildshard/shard-format/weaponProfiles'
|
|
6
|
+
import { parse, type InferOutput } from 'valibot'
|
|
7
|
+
|
|
8
|
+
import STARTER_BOW from '../../content/shared/starterBow.json' with { type: 'json' }
|
|
9
|
+
|
|
10
|
+
/** Named transitional bow view strategy styles: any name the shard's bow view repaints by (`test/sdk-engine-types.test.ts`
|
|
11
|
+
* keeps it equal to the engine's `combat/view/bowProfile` `BowStyle`). */
|
|
12
|
+
export type BowStyle = string
|
|
13
|
+
|
|
14
|
+
/** Admit a complete authored bow file before its pool or display strategy is borrowed. */
|
|
15
|
+
export function parseHeldBowFile(input: unknown): HeldBowFileRows {
|
|
16
|
+
return parse(HeldBowFileSchema, input)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/** Admit numeric draw, flight, spread and ammunition policy without a weapon or view service. */
|
|
20
|
+
export function parseBowProfile(
|
|
21
|
+
input: unknown,
|
|
22
|
+
): InferOutput<typeof BowWeaponProfileSchema> {
|
|
23
|
+
return parse(BowWeaponProfileSchema, input)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Compile an independent shared numeric bow base from its defining committed author table.
|
|
27
|
+
* No wind owner, runtime profile object or view service enters the author result. */
|
|
28
|
+
export function sharedBowAuthorBase(): Omit<typeof STARTER_BOW, 'family'> & {
|
|
29
|
+
family: 'bow'
|
|
30
|
+
} {
|
|
31
|
+
if (STARTER_BOW.family !== 'bow')
|
|
32
|
+
throw new Error('Shared bow author base requires the bow family')
|
|
33
|
+
return structuredClone({ ...STARTER_BOW, family: STARTER_BOW.family })
|
|
34
|
+
}
|