roamwright 0.60.0 → 0.61.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/geometry/animal-camel-body.js +201 -214
- package/geometry/animal-camel-pack.js +192 -0
- package/geometry/animal-canine-body.js +125 -73
- package/geometry/animal-canine-breeds.js +46 -43
- package/geometry/animal-canine-head.js +26 -25
- package/geometry/animal-cat-body.js +374 -0
- package/geometry/animal-cat-head.js +301 -0
- package/geometry/animal-cattle-body.js +185 -151
- package/geometry/animal-cattle-head.js +9 -6
- package/geometry/animal-ear.js +137 -0
- package/geometry/animal-eye.js +154 -0
- package/geometry/animal-haunch.js +87 -0
- package/geometry/animal-hen-head.js +149 -0
- package/geometry/animal-hen.js +282 -115
- package/geometry/animal-horse-body.js +60 -41
- package/geometry/animal-horse-hair.js +8 -8
- package/geometry/animal-nose.js +79 -0
- package/geometry/animal-skin.js +11 -7
- package/index.js +2 -0
- package/motion/animal-bearing.js +4 -4
- package/motion/animal-canine-bearing.js +4 -2
- package/motion/animal-cat-bearing.js +157 -0
- package/package.json +1 -1
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
import * as THREE from 'three';
|
|
2
2
|
import { lerp, sstep } from '../math/scalar.js';
|
|
3
3
|
import { GB } from './builder.js';
|
|
4
|
-
import { TRS } from './primitives.js';
|
|
5
|
-
import { SHAPES } from './animal-shapes.js';
|
|
6
4
|
import { tube } from './animal-skin.js';
|
|
5
|
+
import { haunchStations } from './animal-haunch.js';
|
|
7
6
|
import { CALLUS, HIDE_TAG, PAD, PAD_TAG, camelHead } from './animal-camel-head.js';
|
|
7
|
+
import { camelPack } from './animal-camel-pack.js';
|
|
8
8
|
import { BONE, LEGS } from '../motion/quadruped.js';
|
|
9
9
|
|
|
10
10
|
// ════════════════════════════════════════════════════════════════════════
|
|
11
|
-
// A camel
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// colour gives it its sand, tawny or dark brown; the hair is longer on the hump, the shoulders and under the neck.
|
|
11
|
+
// A dromedary camel built on the four-legged skeleton (motion/quadruped.js): nose to +z, feet at y = 0, laid out in withers
|
|
12
|
+
// heights (1.85 m). Deep chest and tucked flank over narrow sloping hips, one fat hump over the ribcage, convex sloping croup
|
|
13
|
+
// with a thin tufted tail to the hock, low U-curved neck rising to a level head (animal-camel-head.js), long thighs joined high
|
|
14
|
+
// under a flank fold, paired stifle-hock hind legs, calloused kneeling pads (brisket, elbows, knees, stifles), and broad flat
|
|
15
|
+
// soft two-toed foot pads with small front nails. Near-white base coat so an instance colour tints sand, cream or brown.
|
|
17
16
|
// ════════════════════════════════════════════════════════════════════════
|
|
18
|
-
const WITHERS = 1.85, // metres at the shoulder; the hump stands
|
|
17
|
+
const WITHERS = 1.85, // metres at the shoulder; the hump crown stands ~33 cm higher
|
|
19
18
|
COAT = [0.88, 0.84, 0.77], // near white: the herd's tint gives the colour
|
|
20
19
|
zF = 0.33, // where the fore feet stand along the body,
|
|
21
20
|
zH = -0.4, // and the hind ones
|
|
22
|
-
GRAZE_BEND = [0.85, 0.75, -0.95], //
|
|
23
|
-
GIRTH = 1,
|
|
24
|
-
BONE_W = 1;
|
|
21
|
+
GRAZE_BEND = [0.85, 0.75, -0.95], // neck lowered from base, upper half and head bent to scrub (motion/animal-bearing.js)
|
|
22
|
+
GIRTH = 1,
|
|
23
|
+
BONE_W = 1;
|
|
25
24
|
|
|
26
|
-
// How a camel's legs go, and its gaits (motion/quadruped.js):
|
|
27
|
-
//
|
|
28
|
-
// hind right), rise, lift, flex].
|
|
25
|
+
// How a camel's legs go, and its gaits (motion/quadruped.js): walks and paces with the two legs of one side swinging near together.
|
|
26
|
+
// Hind legs use paired stifle/hock linkage so the hock stays cleanly behind the stifle and never buckles or splays.
|
|
29
27
|
const HABITS = {
|
|
30
|
-
fore: { follow: 0.9, heel3: 0.08, fold3: 1.
|
|
31
|
-
hind: { follow: 0.65, heel3: 0.
|
|
28
|
+
fore: { follow: 0.9, heel3: 0.08, fold3: 1.15, heel4: 0.55, fold4: 0.65, sink: 0.06, glide: 0.12 },
|
|
29
|
+
hind: { follow: 0.65, heel3: 0.18, fold3: 0.25, heel4: 0.55, fold4: 0.5, sink: 0.06, glide: 0, paired: true, thigh: 0.45 },
|
|
32
30
|
crouch: 0.015,
|
|
33
31
|
gaits: [
|
|
34
32
|
[0.1, 0.6, 0.72, [0.12, 0.62, 0, 0.5], 0.008, 0.06, 0.015],
|
|
@@ -38,33 +36,40 @@ const HABITS = {
|
|
|
38
36
|
],
|
|
39
37
|
};
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
/** The squareness of the rump's sections: gently full so the narrow camel quarters round smoothly into the lean thighs. */
|
|
40
|
+
const RUMP_SQUARE = 2.6;
|
|
41
|
+
|
|
42
|
+
// Where the joints are, in withers heights: [y, z] in the body's upright plane. Real proportions of a dromedary: the hip joint
|
|
43
|
+
// 0.87, the stifle 0.54 (free of the body, below the flank's floor, 0.13 ahead of the hip), the hock 0.37 (0.06 behind the hip),
|
|
44
|
+
// the elbow 0.59 and the knee 0.35; the hind legs set close together (0.075 to each side of the midline, the fore ones 0.115).
|
|
42
45
|
const A = {
|
|
43
|
-
sx: 0.
|
|
44
|
-
hx: 0.
|
|
45
|
-
shoulder: [0.
|
|
46
|
-
elbow: [0.
|
|
47
|
-
knee: [0.
|
|
48
|
-
fetlock: [0.
|
|
49
|
-
hoof: [0, zF + 0.
|
|
50
|
-
hip: [0.
|
|
51
|
-
stifle: [0.
|
|
52
|
-
hock: [0.
|
|
53
|
-
hindFetlock: [0.
|
|
54
|
-
hindHoof: [0, zH + 0.
|
|
55
|
-
neck: [0.
|
|
56
|
-
bow: [0.
|
|
46
|
+
sx: 0.115 * GIRTH,
|
|
47
|
+
hx: 0.075 * GIRTH,
|
|
48
|
+
shoulder: [0.89, zF - 0.01],
|
|
49
|
+
elbow: [0.59, zF - 0.05],
|
|
50
|
+
knee: [0.35, zF - 0.005],
|
|
51
|
+
fetlock: [0.095, zF + 0.005],
|
|
52
|
+
hoof: [0, zF + 0.055],
|
|
53
|
+
hip: [0.87, zH + 0.02],
|
|
54
|
+
stifle: [0.55, zH + 0.115],
|
|
55
|
+
hock: [0.37, zH - 0.068],
|
|
56
|
+
hindFetlock: [0.095, zH - 0.015],
|
|
57
|
+
hindHoof: [0, zH + 0.035],
|
|
58
|
+
neck: [0.78, zF + 0.14], // neck root low on the chest front
|
|
59
|
+
bow: [0.76, zF + 0.32], // low point of the U-curve
|
|
57
60
|
poll: [1.14, zF + 0.56],
|
|
58
|
-
dock: [0.
|
|
61
|
+
dock: [0.795, zH - 0.115], // tail root set cleanly in the sloping convex croup
|
|
62
|
+
// the rump's section at the hips (the ring over them in trunkStations), for the thigh to hang inside (geometry/animal-haunch.js)
|
|
63
|
+
rump: { y: 0.775, h: 0.145, w: 0.115 * GIRTH, n: RUMP_SQUARE },
|
|
59
64
|
};
|
|
60
65
|
|
|
61
66
|
// The bones' joints and the feet, in metres (as cattle's, animal-cattle-body.js).
|
|
62
67
|
function jointsAt(K, headAt) {
|
|
63
68
|
const at = (x, q) => [x * K, q[0] * K, q[1] * K],
|
|
64
69
|
joints = [];
|
|
65
|
-
joints[BONE.root] = at(0, [0.
|
|
66
|
-
joints[BONE.hips] = at(0, [0.
|
|
67
|
-
joints[BONE.chest] = at(0, [0.
|
|
70
|
+
joints[BONE.root] = at(0, [0.88, -0.04]);
|
|
71
|
+
joints[BONE.hips] = at(0, [0.89, -0.2]);
|
|
72
|
+
joints[BONE.chest] = at(0, [0.94, 0.12]);
|
|
68
73
|
joints[BONE.neck] = at(0, A.neck);
|
|
69
74
|
joints[BONE.neck2] = at(0, A.bow);
|
|
70
75
|
joints[BONE.head] = at(0, A.poll);
|
|
@@ -85,141 +90,153 @@ function jointsAt(K, headAt) {
|
|
|
85
90
|
joints[h + 3] = at(s * A.hx, A.hindFetlock);
|
|
86
91
|
});
|
|
87
92
|
joints[BONE.tail] = at(0, A.dock);
|
|
88
|
-
joints[BONE.tail + 1] = at(0, [A.dock[0] - 0.
|
|
89
|
-
joints[BONE.tail + 2] = at(0, [A.dock[0] - 0.
|
|
93
|
+
joints[BONE.tail + 1] = at(0, [A.dock[0] - 0.18, A.dock[1] - 0.025]);
|
|
94
|
+
joints[BONE.tail + 2] = at(0, [A.dock[0] - 0.35, A.dock[1] - 0.03]);
|
|
90
95
|
joints[BONE.crest] = at(0, [1.15, 0.02]);
|
|
91
96
|
return { joints, feet: [at(-A.sx, A.hoof), at(A.sx, A.hoof), at(-A.hx, A.hindHoof), at(A.hx, A.hindHoof)] };
|
|
92
97
|
}
|
|
93
98
|
|
|
94
|
-
//
|
|
95
|
-
// mottled with the world's value noise.
|
|
99
|
+
// Coat shading: paler belly and inner legs, subtle dust low down, calloused brisket and elbows, value-noise mottling.
|
|
96
100
|
const hideWith = vnoise => (col, x, y, z, nx, ny) => {
|
|
97
101
|
const under = 0.07 * sstep(-0.3, -0.9, ny),
|
|
98
|
-
dust = 0.
|
|
99
|
-
mottle = 0.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
elbow = sstep(0.04, 0.012, Math.hypot(Math.abs(x) - A.sx - 0.03, y - A.elbow[0], z - A.elbow[1] + 0.03)),
|
|
102
|
+
dust = 0.09 * sstep(0.28, 0.05, y),
|
|
103
|
+
mottle = 0.055 * (vnoise(x * 19 + z * 7, y * 23, 391) - 0.5),
|
|
104
|
+
brisket = sstep(0.085, 0.03, Math.hypot(x * 0.75, y - 0.505, (z - 0.21) * 0.65)),
|
|
105
|
+
elbow = sstep(0.042, 0.014, Math.hypot(Math.abs(x) - A.sx - 0.025, y - A.elbow[0], z - A.elbow[1] + 0.025)),
|
|
103
106
|
pad = Math.max(brisket, elbow);
|
|
104
107
|
for (let i = 0; i < 3; i++) col[i] = lerp(COAT[i] * (1 + under - dust + mottle), CALLUS[i], pad);
|
|
105
108
|
col[3] = lerp(HIDE_TAG, PAD_TAG, pad);
|
|
106
109
|
};
|
|
107
110
|
|
|
108
|
-
// The hump: a
|
|
109
|
-
//
|
|
110
|
-
const HUMP = { rise: 0.
|
|
111
|
+
// The hump: a single mass of fat seated over the middle ribcage, narrower than the barrel, its crown about a fifth of the withers
|
|
112
|
+
// height above the back line.
|
|
113
|
+
const HUMP = { rise: 0.23, z: -0.04, long: 0.205, half: 0.15 };
|
|
111
114
|
function humpLift(x, y, z, pad = 0) {
|
|
112
115
|
const across = Math.max(0, 1 - (Math.abs(x) / (HUMP.half + pad)) ** 2),
|
|
113
116
|
along = (z - HUMP.z) / HUMP.long;
|
|
114
|
-
return HUMP.rise * Math.exp(-(along * along) * (0.
|
|
117
|
+
return HUMP.rise * Math.exp(-(along * along) * (0.65 + along * along)) * across ** 0.72 * sstep(0.76, 0.92, y);
|
|
115
118
|
}
|
|
116
119
|
|
|
117
|
-
//
|
|
118
|
-
//
|
|
120
|
+
// Trunk stations from a narrow rump, a short slope behind the hump, tucked flank, deep chest and low-U neck to poll. Real
|
|
121
|
+
// proportions, in withers heights: the back line 0.98 under the hump, falling over a short rump to the tail root at 0.80; the
|
|
122
|
+
// floor rising from the belly (0.50) to the flank (0.60) and the rump's floor (0.68), so the stifle (0.54) hangs free; the hips
|
|
123
|
+
// (0.11 to each side) the widest point of the hindquarters, the buttocks flat (fuller sections), the ribs the widest of all (0.17).
|
|
124
|
+
// Station 0's y (0.745) sits monotonically below station 1's center (0.748) and station 2's (0.763) so the rear spline closes
|
|
125
|
+
// into a smooth convex sloping croup with no pit or dimple under the tail root.
|
|
119
126
|
function trunkStations() {
|
|
120
|
-
const ring = (z, top, bottom, w, bone, sq = 2.
|
|
121
|
-
neck = (y, z, w,
|
|
127
|
+
const ring = (z, top, bottom, w, bone, sq = 2.3) => [(top + bottom) / 2, z, w * GIRTH, (top - bottom) / 2, (top - bottom) / 2, bone, sq],
|
|
128
|
+
neck = (y, z, w, up, bone, low = up) => [y, z, w, up, low, bone, 2.1];
|
|
122
129
|
return [
|
|
123
|
-
[0.
|
|
124
|
-
ring(zH - 0.
|
|
125
|
-
ring(zH - 0.
|
|
126
|
-
|
|
127
|
-
ring(zH + 0.
|
|
128
|
-
ring(-0.
|
|
129
|
-
ring(0.
|
|
130
|
-
ring(0.
|
|
131
|
-
ring(0.
|
|
132
|
-
ring(0.
|
|
133
|
-
|
|
134
|
-
neck(0.
|
|
135
|
-
neck(0.
|
|
136
|
-
neck(0.
|
|
137
|
-
neck(0.
|
|
138
|
-
neck(
|
|
139
|
-
neck(1.
|
|
140
|
-
|
|
141
|
-
[A.poll[0] + 0.
|
|
142
|
-
[A.poll[0] + 0.05, A.poll[1] + 0.005, 0, 0, 0, 4],
|
|
130
|
+
[0.745, zH - 0.142, 0, 0, 0, 0],
|
|
131
|
+
ring(zH - 0.11, 0.805, 0.69, 0.058, 0, 2.25),
|
|
132
|
+
ring(zH - 0.045, 0.865, 0.66, 0.092, 0, 2.45),
|
|
133
|
+
[A.rump.y, zH + 0.05, A.rump.w, A.rump.h, A.rump.h, 0.12, A.rump.n], // the rump's section the thigh hangs inside
|
|
134
|
+
ring(zH + 0.18, 0.955, 0.6, 0.14, 0.38, 2.8),
|
|
135
|
+
ring(-0.08, 0.98, 0.545, 0.16, 0.6, 2.6),
|
|
136
|
+
ring(0.06, 0.985, 0.51, 0.17, 0.85, 2.5),
|
|
137
|
+
ring(0.19, 0.98, 0.5, 0.165, 1.0, 2.5),
|
|
138
|
+
ring(0.29, 0.96, 0.53, 0.15, 1.0, 2.3),
|
|
139
|
+
ring(zF + 0.06, 0.925, 0.6, 0.122, 1.35, 2.1),
|
|
140
|
+
neck(0.77, zF + 0.14, 0.092, 0.112, 1.9, 0.125),
|
|
141
|
+
neck(0.755, zF + 0.23, 0.075, 0.088, 2.35, 0.095),
|
|
142
|
+
neck(0.765, zF + 0.32, 0.064, 0.074, 2.8, 0.08),
|
|
143
|
+
neck(0.825, zF + 0.405, 0.057, 0.066, 3.2, 0.07),
|
|
144
|
+
neck(0.925, zF + 0.475, 0.052, 0.06, 3.55, 0.062),
|
|
145
|
+
neck(1.035, zF + 0.525, 0.049, 0.056, 3.85, 0.056),
|
|
146
|
+
neck(1.115, zF + 0.552, 0.047, 0.052, 4.0, 0.052),
|
|
147
|
+
[A.poll[0] + 0.02, A.poll[1] + 0.005, 0.036, 0.034, 0.04, 4],
|
|
148
|
+
[A.poll[0] + 0.04, A.poll[1] + 0.015, 0, 0, 0, 4],
|
|
143
149
|
];
|
|
144
150
|
}
|
|
145
151
|
|
|
146
|
-
//
|
|
147
|
-
// bones at the corners of the rump.
|
|
152
|
+
// Sculpted anatomy under the hide: hump, brisket pedestal pad, shoulder blades, hip hooks, hollow flank, spine ridge.
|
|
148
153
|
function bodyWarp(Q, q) {
|
|
149
154
|
const x = Q[q],
|
|
150
155
|
y = Q[q + 1],
|
|
151
156
|
z = Q[q + 2],
|
|
152
157
|
ax = Math.abs(x),
|
|
153
|
-
blade = sstep(0.09, 0.0, Math.hypot(ax - 0.
|
|
154
|
-
hook = sstep(0.
|
|
155
|
-
flank = sstep(0.12, 0.02, Math.hypot(y - 0.
|
|
158
|
+
blade = sstep(0.09, 0.0, Math.hypot(ax - 0.13, y - 0.87, (z - zF + 0.01) * 0.6)),
|
|
159
|
+
hook = sstep(0.065, 0.0, Math.hypot(ax - 0.085, y - 0.88, z - zH - 0.04)),
|
|
160
|
+
flank = sstep(0.12, 0.02, Math.hypot(y - 0.76, (z - zH - 0.22) * 0.7)) * sstep(0.07, 0.14, ax),
|
|
161
|
+
brisketPad = sstep(0.09, 0.02, Math.hypot(ax * 0.9, y - 0.505, (z - 0.2) * 0.75)) * sstep(0.55, 0.505, y),
|
|
156
162
|
spine =
|
|
157
163
|
sstep(0.03, 0, ax) *
|
|
158
|
-
sstep(0.
|
|
164
|
+
sstep(0.92, 0.98, y) *
|
|
159
165
|
(sstep(-0.42, -0.3, z) * sstep(-0.18, -0.26, z) + sstep(0.18, 0.24, z) * sstep(0.36, 0.3, z));
|
|
160
|
-
Q[q] += Math.sign(x) * (0.
|
|
161
|
-
Q[q + 1] += 0.
|
|
166
|
+
Q[q] += Math.sign(x) * (0.014 * blade + 0.014 * hook - 0.016 * flank);
|
|
167
|
+
Q[q + 1] += 0.008 * blade + 0.01 * hook + 0.008 * spine - 0.018 * brisketPad + (z < 0.4 ? humpLift(x, y, z) : 0);
|
|
162
168
|
}
|
|
163
169
|
|
|
164
|
-
//
|
|
165
|
-
// front and underside of the neck; out: [length, lift, width, locks at the point, the tips' shade].
|
|
170
|
+
// Subtle woollier coat on the hump crown and upper shoulders (fine locks that blend without jagged dark triangles on the throat).
|
|
166
171
|
const shagWith = vnoise => (out, x, y, z, nx, ny) => {
|
|
167
|
-
const hump = sstep(1.
|
|
168
|
-
throat = sstep(-0.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
out[
|
|
173
|
-
out[
|
|
174
|
-
out[
|
|
175
|
-
out[
|
|
176
|
-
out[4] = 0.8;
|
|
172
|
+
const hump = sstep(1.07, 1.16, y) * sstep(-0.18, -0.07, z) * sstep(0.16, 0.07, z),
|
|
173
|
+
throat = sstep(-0.5, -0.9, ny) * sstep(zF + 0.2, zF + 0.28, z) * sstep(zF + 0.42, zF + 0.35, z),
|
|
174
|
+
grow = Math.max(hump * 0.75, throat * 0.42);
|
|
175
|
+
if (grow < 0.24) return false;
|
|
176
|
+
out[0] = grow * 0.013 * (0.85 + 0.3 * vnoise(x * 50, z * 50, 393));
|
|
177
|
+
out[1] = 0.1 + 0.1 * hump;
|
|
178
|
+
out[2] = 0.02;
|
|
179
|
+
out[3] = 1;
|
|
180
|
+
out[4] = 1.02;
|
|
177
181
|
return true;
|
|
178
182
|
};
|
|
179
183
|
|
|
180
|
-
// A leg
|
|
181
|
-
//
|
|
184
|
+
// A hind leg's thigh as rounded slices (geometry/animal-haunch.js): height, front edge, back edge, half-width, lean, squareness,
|
|
185
|
+
// level. A dromedary's thigh is lean, rounded and high-set: it emerges tangentially from the narrow sloping rump, carries the
|
|
186
|
+
// stifle clear below the tucked flank, and tapers cleanly back along the tibia to a crisp backward-pointing hock.
|
|
187
|
+
const THIGH = [
|
|
188
|
+
[0.87, A.hip[1] + 0.05, A.hip[1] - 0.06, 0, -0.032, 2], // closed inside the upper rump
|
|
189
|
+
[0.79, A.hip[1] + 0.08, A.hip[1] - 0.09, 0.042, -0.022, 2], // rounded upper thigh
|
|
190
|
+
[0.68, A.hip[1] + 0.105, A.hip[1] - 0.095, 0.044, -0.012, 2], // lean muscular mid-thigh flush-tangent with narrow rump
|
|
191
|
+
[A.stifle[0], A.stifle[1] + 0.03, lerp(A.hip[1] - 0.09, A.stifle[1] - 0.08, 0.42), 0.035, -0.004, 2], // free rounded stifle
|
|
192
|
+
[
|
|
193
|
+
lerp(A.stifle[0], A.hock[0], 0.42),
|
|
194
|
+
lerp(A.stifle[1], A.hock[1], 0.45) + 0.026,
|
|
195
|
+
lerp(A.stifle[1] - 0.085, A.hock[1] - 0.042, 0.56),
|
|
196
|
+
0.026,
|
|
197
|
+
0,
|
|
198
|
+
2,
|
|
199
|
+
], // slender backward-sloping camel gaskin
|
|
200
|
+
[lerp(A.stifle[0], A.hock[0], 0.76), lerp(A.stifle[1], A.hock[1], 0.8) + 0.022, A.hock[1] - 0.038, 0.023, 0, 2], // Achilles
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
// A leg from shoulder or high muscular thigh to fetlock, then sloping pastern and broad flat soft two-toed foot pad.
|
|
182
204
|
function leg(b, q, s, hind, hide) {
|
|
183
205
|
const t = BONE_W,
|
|
184
206
|
i = (hind ? 2 : 0) + (s > 0 ? 1 : 0),
|
|
185
207
|
f = LEGS[i],
|
|
186
208
|
mix = (P, R, k, dz = 0) => [P[0] + (R[0] - P[0]) * k, P[1] + (R[1] - P[1]) * k + dz],
|
|
187
|
-
at = (P, w, front, back, bone, lean = 0) => [P[0], P[1], w * t, front * t, back * t, bone, 2.2, lean],
|
|
209
|
+
at = (P, w, front, back, bone, lean = 0, level = 0) => [P[0], P[1], w * t, front * t, back * t, bone, 2.2, lean, level],
|
|
188
210
|
pad = hind ? A.stifle : A.knee,
|
|
189
211
|
coat = (col, x, y, z, nx, ny) => {
|
|
190
212
|
hide(col, x, y, z, nx, ny);
|
|
191
|
-
const callus = sstep(0.
|
|
213
|
+
const callus = sstep(0.048, 0.018, Math.hypot(y - pad[0], z - pad[1] - (hind ? 0.018 : 0.024)));
|
|
192
214
|
for (let k = 0; k < 3; k++) col[k] = lerp(col[k], CALLUS[k], callus);
|
|
193
215
|
col[3] = lerp(col[3], PAD_TAG, callus);
|
|
194
216
|
};
|
|
195
217
|
const S = hind
|
|
196
218
|
? [
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
at(
|
|
200
|
-
at(mix(A.
|
|
201
|
-
at(A.
|
|
202
|
-
at(
|
|
203
|
-
|
|
204
|
-
at(A.hock, 0.026, 0.026, 0.04, 2.5),
|
|
205
|
-
at(mix(A.hock, A.hindFetlock, 0.3), 0.018, 0.02, 0.022, 3),
|
|
206
|
-
at(mix(A.hock, A.hindFetlock, 0.85), 0.017, 0.019, 0.022, 3),
|
|
207
|
-
at(A.hindFetlock, 0.023, 0.024, 0.028, 3),
|
|
208
|
-
[A.hindFetlock[0] - 0.02, A.hindFetlock[1] + 0.012, 0, 0, 0, 3],
|
|
219
|
+
// the rounded lean thigh & gaskin (above), then the crisp backward camel hock and slender cannon to the fetlock
|
|
220
|
+
...haunchStations(THIGH, { x: A.hx, hip: A.hip[0], stifle: A.stifle[0], hock: A.hock[0] }, A.rump, q === 0),
|
|
221
|
+
at(A.hock, 0.024, 0.025, 0.044, 2.5, 0, 1),
|
|
222
|
+
at(mix(A.hock, A.hindFetlock, 0.3), 0.018, 0.019, 0.023, 3, 0, 0.4),
|
|
223
|
+
at(mix(A.hock, A.hindFetlock, 0.82), 0.017, 0.018, 0.021, 3),
|
|
224
|
+
at(A.hindFetlock, 0.022, 0.023, 0.026, 3),
|
|
225
|
+
[A.hindFetlock[0] - 0.018, A.hindFetlock[1] + 0.01, 0, 0, 0, 3],
|
|
209
226
|
]
|
|
210
227
|
: [
|
|
211
|
-
[0.
|
|
212
|
-
[0.
|
|
213
|
-
at(mix(A.shoulder, A.elbow, 0.
|
|
214
|
-
at(mix(A.shoulder, A.elbow, 0.
|
|
215
|
-
at(A.elbow, 0.
|
|
216
|
-
at(mix(A.elbow, A.knee, 0.3), 0.
|
|
217
|
-
at(mix(A.elbow, A.knee, 0.82), 0.022, 0.024, 0.
|
|
218
|
-
at(A.knee, 0.
|
|
219
|
-
at(mix(A.knee, A.fetlock, 0.
|
|
220
|
-
at(mix(A.knee, A.fetlock, 0.
|
|
221
|
-
at(A.fetlock, 0.
|
|
222
|
-
[A.fetlock[0] - 0.
|
|
228
|
+
[0.9, zF - 0.03, 0, 0, 0, 0, 2, -0.06],
|
|
229
|
+
[0.855, zF - 0.025, 0.04, 0.064, 0.074, 0.2, 2.1, -0.048],
|
|
230
|
+
at(mix(A.shoulder, A.elbow, 0.3), 0.045, 0.064, 0.076, 0.65, -0.026),
|
|
231
|
+
at(mix(A.shoulder, A.elbow, 0.68), 0.041, 0.054, 0.065, 1.05, -0.01),
|
|
232
|
+
at(A.elbow, 0.037, 0.044, 0.054, 1.5, 0.002),
|
|
233
|
+
at(mix(A.elbow, A.knee, 0.3), 0.031, 0.036, 0.038, 2),
|
|
234
|
+
at(mix(A.elbow, A.knee, 0.82), 0.022, 0.024, 0.025, 2),
|
|
235
|
+
at(A.knee, 0.026, 0.032, 0.026, 2.5),
|
|
236
|
+
at(mix(A.knee, A.fetlock, 0.25), 0.018, 0.019, 0.022, 3),
|
|
237
|
+
at(mix(A.knee, A.fetlock, 0.82), 0.017, 0.018, 0.021, 3),
|
|
238
|
+
at(A.fetlock, 0.022, 0.023, 0.026, 3),
|
|
239
|
+
[A.fetlock[0] - 0.018, A.fetlock[1] + 0.01, 0, 0, 0, 3],
|
|
223
240
|
];
|
|
224
241
|
const x = s * (hind ? A.hx : A.sx),
|
|
225
242
|
F = hind ? A.hindFetlock : A.fetlock,
|
|
@@ -233,131 +250,101 @@ function leg(b, q, s, hind, hide) {
|
|
|
233
250
|
coat,
|
|
234
251
|
droop: 0.6,
|
|
235
252
|
});
|
|
236
|
-
//
|
|
253
|
+
// Sloping pastern joining the fetlock cleanly down into the top of the foot pad.
|
|
254
|
+
tube(
|
|
255
|
+
b,
|
|
256
|
+
[
|
|
257
|
+
[F[0] + 0.012, F[1] - 0.005, 0, 0, 0, 0],
|
|
258
|
+
[F[0], F[1], 0.022 * t, 0.023 * t, 0.025 * t, 0.3],
|
|
259
|
+
[0.056, lerp(F[1], H[1], 0.45), 0.022 * t, 0.023 * t, 0.024 * t, 0.9],
|
|
260
|
+
[0.028, lerp(F[1], H[1], 0.82), 0.028 * t, 0.028 * t, 0.026 * t, 1],
|
|
261
|
+
[0.014, H[1] - 0.002, 0, 0, 0, 1],
|
|
262
|
+
],
|
|
263
|
+
{
|
|
264
|
+
x,
|
|
265
|
+
side: s,
|
|
266
|
+
chain: [f + 2, f + 3],
|
|
267
|
+
around: [6, 8, 10][q],
|
|
268
|
+
sub: [1, 1, 2][q],
|
|
269
|
+
coat: hide,
|
|
270
|
+
},
|
|
271
|
+
);
|
|
272
|
+
// Broad soft two-toed camel foot pad: lofted horizontally along +z with a flat sole on y = 0, a gentle front toe cleft, and
|
|
273
|
+
// two small dark nails sitting on the front edge of the two toes (never an upturned hoof cup).
|
|
237
274
|
const foot = (col, px, py, pz, nx, ny) => {
|
|
238
275
|
hide(col, px, py, pz, nx, ny);
|
|
239
|
-
const sole = sstep(0.
|
|
240
|
-
|
|
241
|
-
|
|
276
|
+
const sole = sstep(0.016, 0.005, py),
|
|
277
|
+
dx = Math.abs(px - x),
|
|
278
|
+
nail = sstep(H[1] + 0.038, H[1] + 0.056, pz) * sstep(0.005, 0.024, dx) * sstep(0.036, 0.026, dx) * sstep(0.03, 0.01, py);
|
|
279
|
+
for (let k = 0; k < 3; k++) col[k] = lerp(lerp(col[k], PAD[k], sole * 0.85), PAD[k] * 0.42, nail);
|
|
242
280
|
col[3] = lerp(col[3], PAD_TAG, Math.max(sole, nail));
|
|
243
281
|
};
|
|
244
282
|
tube(
|
|
245
283
|
b,
|
|
246
284
|
[
|
|
247
|
-
[
|
|
248
|
-
[
|
|
249
|
-
[0.
|
|
250
|
-
[0.
|
|
251
|
-
[0.
|
|
252
|
-
[0.
|
|
253
|
-
[0, H[1] + 0.
|
|
285
|
+
[0.018, H[1] - 0.048, 0, 0, 0, 0],
|
|
286
|
+
[0.018, H[1] - 0.042, 0.032 * t, 0.017 * t, 0.018 * t, 0, 2.1],
|
|
287
|
+
[0.018, H[1] - 0.016, 0.048 * t, 0.022 * t, 0.018 * t, 0, 2.2],
|
|
288
|
+
[0.018, H[1] + 0.018, 0.053 * t, 0.021 * t, 0.018 * t, 0, 2.2],
|
|
289
|
+
[0.015, H[1] + 0.048, 0.046 * t, 0.016 * t, 0.015 * t, 0, 2.1],
|
|
290
|
+
[0.012, H[1] + 0.062, 0.026 * t, 0.01 * t, 0.012 * t, 0, 2.0],
|
|
291
|
+
[0.012, H[1] + 0.068, 0, 0, 0, 0],
|
|
254
292
|
],
|
|
255
293
|
{
|
|
256
294
|
x,
|
|
257
295
|
side: s,
|
|
258
|
-
chain: [f +
|
|
296
|
+
chain: [f + 3],
|
|
259
297
|
around: [6, 8, 12][q],
|
|
260
298
|
sub: [1, 1, 2][q],
|
|
261
299
|
coat: foot,
|
|
262
|
-
// the cleft between the toes, from the front of the pad back along its middle
|
|
263
300
|
warp: (Q, k) => {
|
|
264
|
-
const cleft = sstep(0.
|
|
265
|
-
Q[k + 2] -= 0.
|
|
301
|
+
const cleft = sstep(0.011, 0, Math.abs(Q[k] - x)) * sstep(H[1] + 0.022, H[1] + 0.062, Q[k + 2]);
|
|
302
|
+
Q[k + 2] -= 0.016 * cleft;
|
|
303
|
+
Q[k + 1] = Math.max(0, Q[k + 1] - 0.005 * cleft);
|
|
266
304
|
},
|
|
267
305
|
},
|
|
268
306
|
);
|
|
269
307
|
}
|
|
270
308
|
|
|
271
|
-
//
|
|
309
|
+
// Thin round tail rooted cleanly into the sloping croup, hanging down to the hock and ending in a soft dark hair tuft.
|
|
272
310
|
function tail(b, q, hide) {
|
|
273
311
|
const D = A.dock,
|
|
274
312
|
hair = (col, x, y, z, nx, ny) => {
|
|
275
313
|
hide(col, x, y, z, nx, ny);
|
|
276
|
-
const tuft = sstep(0.
|
|
277
|
-
for (let i = 0; i < 3; i++) col[i] = lerp(col[i], COAT[i] * 0.
|
|
278
|
-
col[3] = lerp(
|
|
314
|
+
const tuft = sstep(0.56, 0.47, y);
|
|
315
|
+
for (let i = 0; i < 3; i++) col[i] = lerp(col[i], COAT[i] * 0.42, tuft);
|
|
316
|
+
col[3] = lerp(HIDE_TAG, 0.3, tuft);
|
|
279
317
|
};
|
|
280
318
|
tube(
|
|
281
319
|
b,
|
|
282
320
|
[
|
|
283
|
-
[D[0] + 0.
|
|
284
|
-
[D[0] - 0.005, D[1] + 0.005, 0.018, 0.
|
|
285
|
-
[D[0] - 0.
|
|
286
|
-
[D[0] - 0.
|
|
287
|
-
[D[0] - 0.
|
|
288
|
-
[D[0] - 0.
|
|
289
|
-
[D[0] - 0.
|
|
290
|
-
],
|
|
291
|
-
{ chain: [BONE.hips, BONE.tail, BONE.tail + 1, BONE.tail + 2], around: [4, 6, 8][q], sub: [1, 2, 2][q], coat: hair, lay: 1 },
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// A pack camel's load, set on the chest's bone: a striped blanket over the hump, a wooden pack saddle of two arches tied over it,
|
|
296
|
-
// a pair of stuffed sacks hung on each side under a rolled rug, and the ropes that bind them. The blanket and the rugs are of
|
|
297
|
-
// undyed wool unless a world dyes them (`camelPack` of geometry/animal-options.js).
|
|
298
|
-
const BLANKET = [0.46, 0.4, 0.32], // undyed wool, its stripes dark and pale
|
|
299
|
-
SACK = [0.62, 0.55, 0.44],
|
|
300
|
-
RUGS = [
|
|
301
|
-
[0.36, 0.3, 0.24],
|
|
302
|
-
[0.56, 0.5, 0.41],
|
|
303
|
-
], // a dark fleece's and a pale one's
|
|
304
|
-
WOOD = [0.32, 0.22, 0.13],
|
|
305
|
-
ROPE = [0.5, 0.42, 0.3];
|
|
306
|
-
function pack(b, q, { blanket = BLANKET, rugs = RUGS } = {}) {
|
|
307
|
-
// the blanket follows the body's own sections a little out from the hide, over the top and down to the sacks
|
|
308
|
-
const drape = (z, top, bottom, w) => [(top + bottom) / 2, z, w + 0.02, (top - bottom) / 2 + 0.02, (top - bottom) / 2 + 0.02, 0, 2.4];
|
|
309
|
-
b.tv = 0.8; // cloth
|
|
310
|
-
tube(
|
|
311
|
-
b,
|
|
312
|
-
[
|
|
313
|
-
drape(-0.24, 0.99, 0.58, 0.168),
|
|
314
|
-
drape(-0.12, 0.995, 0.57, 0.178),
|
|
315
|
-
drape(0.0, 1.0, 0.56, 0.188),
|
|
316
|
-
drape(0.1, 1.0, 0.55, 0.19),
|
|
317
|
-
drape(0.2, 1.0, 0.53, 0.182),
|
|
321
|
+
[D[0] + 0.02, D[1] + 0.035, 0, 0, 0, 0],
|
|
322
|
+
[D[0] - 0.005, D[1] + 0.005, 0.018, 0.018, 0.018, 0.5],
|
|
323
|
+
[D[0] - 0.075, D[1] - 0.026, 0.013, 0.013, 0.013, 1],
|
|
324
|
+
[D[0] - 0.19, D[1] - 0.036, 0.01, 0.01, 0.01, 1.5],
|
|
325
|
+
[D[0] - 0.3, D[1] - 0.036, 0.012, 0.012, 0.012, 2.2],
|
|
326
|
+
[D[0] - 0.39, D[1] - 0.032, 0.018, 0.018, 0.018, 2.9],
|
|
327
|
+
[D[0] - 0.45, D[1] - 0.028, 0, 0, 0, 3],
|
|
318
328
|
],
|
|
319
329
|
{
|
|
320
|
-
chain: [BONE.
|
|
321
|
-
around: [
|
|
330
|
+
chain: [BONE.hips, BONE.tail, BONE.tail + 1, BONE.tail + 2],
|
|
331
|
+
around: [5, 6, 8][q],
|
|
322
332
|
sub: [1, 2, 2][q],
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
+
coat: hair,
|
|
334
|
+
lay: 1,
|
|
335
|
+
fur:
|
|
336
|
+
q > 0 &&
|
|
337
|
+
((out, x, y) => {
|
|
338
|
+
if (y > D[0] - 0.3) return false;
|
|
339
|
+
out[0] = 0.055;
|
|
340
|
+
out[1] = 0.08;
|
|
341
|
+
out[2] = 0.014;
|
|
342
|
+
out[3] = q > 1 ? 2 : 1;
|
|
343
|
+
out[4] = 0.78;
|
|
344
|
+
return true;
|
|
345
|
+
}),
|
|
333
346
|
},
|
|
334
347
|
);
|
|
335
|
-
b.bone = BONE.chest;
|
|
336
|
-
const put = (shape, col, x, y, z, sx, sy, sz, ry = 0, rx = 0, rz = 0) => b.add(shape, col, TRS(x, y, z, sx, sy, sz, ry, rx, rz));
|
|
337
|
-
b.tv = 0.3; // wood: each arch two legs crossed over the hump, and the side bars that join the arches
|
|
338
|
-
for (const z of [-0.22, 0.17]) for (const s of [-1, 1]) put(SHAPES.cyl6, WOOD, s * 0.15, 0.97, z, 0.025, 0.27, 0.025, 0, 0, s * 0.95);
|
|
339
|
-
for (const s of [-1, 1]) put(SHAPES.cyl6, WOOD, s * 0.18, 0.94, -0.25, 0.022, 0.47, 0.022, 0, Math.PI / 2);
|
|
340
|
-
b.tv = 0.75;
|
|
341
|
-
for (const s of [-1, 1]) {
|
|
342
|
-
// two sacks a side, stuffed full and slumped against the flank, a rolled rug on them, and the ropes down their outer faces
|
|
343
|
-
put(SHAPES.sph, SACK, s * 0.29, 0.86, 0.0, 0.17, 0.25, 0.36, 0, 0, s * 0.1);
|
|
344
|
-
put(
|
|
345
|
-
SHAPES.sph,
|
|
346
|
-
SACK.map(v => v * 0.92),
|
|
347
|
-
s * 0.28,
|
|
348
|
-
0.93,
|
|
349
|
-
0.18,
|
|
350
|
-
0.15,
|
|
351
|
-
0.2,
|
|
352
|
-
0.2,
|
|
353
|
-
0,
|
|
354
|
-
0,
|
|
355
|
-
s * 0.12,
|
|
356
|
-
);
|
|
357
|
-
put(SHAPES.cyl, rugs[s > 0 ? 0 : 1], s * 0.27, 1.0, -0.17, 0.11, 0.42, 0.11, 0, Math.PI / 2);
|
|
358
|
-
for (const z of [-0.08, 0.08]) put(SHAPES.cyl6, ROPE, s * 0.37, 0.74, z, 0.012, 0.26, 0.012, 0, 0, s * 0.08);
|
|
359
|
-
}
|
|
360
|
-
put(SHAPES.cyl6, ROPE, 0.2, 0.545, 0.2, 0.014, 0.4, 0.014, 0, 0, Math.PI / 2); // the girth under the belly, holding it all down
|
|
361
348
|
}
|
|
362
349
|
|
|
363
350
|
const HEAD_DIP = 0.3; // radians the face slopes down from level
|
|
@@ -400,7 +387,7 @@ function camelMesh(q, packed, vnoise, colours) {
|
|
|
400
387
|
leg(b, q, s, true, hide);
|
|
401
388
|
}
|
|
402
389
|
tail(b, q, hide);
|
|
403
|
-
if (packed)
|
|
390
|
+
if (packed) camelPack(b, q, humpLift, colours);
|
|
404
391
|
b.M = headMatrix(K);
|
|
405
392
|
camelHead(b, q, hide);
|
|
406
393
|
b.M = null;
|