@plupin/character 0.3.0 → 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/dist/anime-face.d.ts +17 -17
- package/dist/anime-face.js +1 -1
- package/dist/blob.d.ts +49 -11
- package/dist/blob.js +29 -1
- package/dist/body-presets.d.ts +105 -37
- package/dist/canvas.js +22 -3
- package/dist/{chunk-g1c0wdcj.js → chunk-7ry0n8cw.js} +386 -2
- package/dist/{chunk-sa2r1cxz.js → chunk-ew73g2v7.js} +13 -7
- package/dist/chunk-ewkkvpte.js +448 -0
- package/dist/{chunk-60p135hw.js → chunk-kf7f1tdx.js} +113 -9
- package/dist/{chunk-kber92gm.js → chunk-nx2wbkfn.js} +8 -2
- package/dist/{chunk-yd5zzkkg.js → chunk-rqenm9tn.js} +175 -1
- package/dist/chunk-vy9w8as2.js +196 -0
- package/dist/clips.d.ts +1 -1
- package/dist/index.js +5 -43
- package/dist/listing.js +39 -13
- package/dist/plup3d.d.ts +9 -58
- package/dist/png.d.ts +4 -3
- package/dist/pose.js +1 -1
- package/dist/skin-map.d.ts +3 -2
- package/dist/skin-map.js +3 -1
- package/dist/skin-native.d.ts +26 -8
- package/dist/three.d.ts +8 -1
- package/dist/three.js +1298 -404
- package/dist/wear3d.d.ts +19 -0
- package/dist/wearables.d.ts +114 -10
- package/dist/wearables.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-09c5tps4.js +0 -337
- package/dist/chunk-dpb0rnw9.js +0 -37
package/dist/three.js
CHANGED
|
@@ -2,38 +2,53 @@ import {
|
|
|
2
2
|
BLOB_HEIGHT,
|
|
3
3
|
BLOB_RADIUS,
|
|
4
4
|
BLOB_SEAT,
|
|
5
|
+
FIGURE_HIP_Y,
|
|
6
|
+
FIGURE_SHOULDER_Y,
|
|
7
|
+
FIGURE_TORSO_MAX_Y,
|
|
8
|
+
FIGURE_TORSO_MIN_Y,
|
|
5
9
|
blobRadiusAt,
|
|
6
|
-
buildBlobGeometry
|
|
7
|
-
|
|
10
|
+
buildBlobGeometry,
|
|
11
|
+
buildFigureHeadGeometry,
|
|
12
|
+
buildFigureTorsoGeometry,
|
|
13
|
+
figureHeadMetrics,
|
|
14
|
+
figureHeadRadiusAt,
|
|
15
|
+
figureTorsoPoint,
|
|
16
|
+
figureTorsoRadiusAt
|
|
17
|
+
} from "./chunk-vy9w8as2.js";
|
|
8
18
|
import {
|
|
9
19
|
ANIME_FACE_SIZE,
|
|
10
20
|
ANIME_FACE_UV,
|
|
11
21
|
drawAnimeFace
|
|
12
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-ewkkvpte.js";
|
|
13
23
|
import {
|
|
24
|
+
BODY_PRESETS,
|
|
25
|
+
EMOTES,
|
|
14
26
|
RAGDOLL_JOINTS,
|
|
15
27
|
createRagdoll,
|
|
16
28
|
emoteOf
|
|
17
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-rqenm9tn.js";
|
|
18
30
|
import {
|
|
31
|
+
WEARABLES,
|
|
19
32
|
hairVolume,
|
|
20
33
|
isHairKey,
|
|
34
|
+
isWearKey,
|
|
21
35
|
wearSlotOf
|
|
22
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-kf7f1tdx.js";
|
|
23
37
|
import {
|
|
24
38
|
boneSkin,
|
|
25
39
|
clampBodyScale,
|
|
26
40
|
clampPlupBody,
|
|
27
41
|
nativePartOf,
|
|
28
42
|
scaleBone
|
|
29
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-ew73g2v7.js";
|
|
30
44
|
import {
|
|
45
|
+
AUTHORED_CLIPS,
|
|
31
46
|
RIGS,
|
|
32
47
|
clipLift,
|
|
33
48
|
mergePoses,
|
|
34
49
|
resolvePose,
|
|
35
50
|
sampleClip
|
|
36
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-7ry0n8cw.js";
|
|
37
52
|
import {
|
|
38
53
|
BODY_HEIGHT,
|
|
39
54
|
BODY_SHAPES,
|
|
@@ -41,8 +56,9 @@ import {
|
|
|
41
56
|
FACE_COLUMN,
|
|
42
57
|
FACE_ROW,
|
|
43
58
|
SKIN_PALETTE,
|
|
44
|
-
faceStamp
|
|
45
|
-
|
|
59
|
+
faceStamp,
|
|
60
|
+
isHighResFace
|
|
61
|
+
} from "./chunk-nx2wbkfn.js";
|
|
46
62
|
import {
|
|
47
63
|
FACE_STAMP_PALETTE
|
|
48
64
|
} from "./chunk-aa5nstet.js";
|
|
@@ -112,6 +128,26 @@ import {
|
|
|
112
128
|
TorusGeometry,
|
|
113
129
|
Vector2
|
|
114
130
|
} from "three";
|
|
131
|
+
var DEFAULT_ZONES = {
|
|
132
|
+
bottomY: 0.04,
|
|
133
|
+
hipY: 0.14,
|
|
134
|
+
waistY: 0.26,
|
|
135
|
+
bustY: 0.36,
|
|
136
|
+
shoulderY: 0.42,
|
|
137
|
+
neckY: 0.28
|
|
138
|
+
};
|
|
139
|
+
function zonesOf(kit) {
|
|
140
|
+
return kit.zones ?? DEFAULT_ZONES;
|
|
141
|
+
}
|
|
142
|
+
function surfaceOf(kit) {
|
|
143
|
+
if (kit.surfaceAt)
|
|
144
|
+
return kit.surfaceAt;
|
|
145
|
+
const R = kit.radiusAt;
|
|
146
|
+
return (y, phi, grow = 0) => {
|
|
147
|
+
const r = R(y) + grow;
|
|
148
|
+
return { x: Math.sin(phi) * r, z: Math.cos(phi) * r * DEPTH };
|
|
149
|
+
};
|
|
150
|
+
}
|
|
115
151
|
var DEPTH = BLOB_RADIUS.z / BLOB_RADIUS.x;
|
|
116
152
|
var TOP = BLOB_HEIGHT;
|
|
117
153
|
var EYES_Y = 0.53;
|
|
@@ -735,131 +771,179 @@ function bow(kit) {
|
|
|
735
771
|
};
|
|
736
772
|
});
|
|
737
773
|
}
|
|
774
|
+
function fittedPatch(kit, from, to, grow, angle = (_y, t) => t * Math.PI * 2, rows = 20, columns = 48) {
|
|
775
|
+
const surf = surfaceOf(kit);
|
|
776
|
+
const positions = [];
|
|
777
|
+
const uvs = [];
|
|
778
|
+
const indices = [];
|
|
779
|
+
for (let i = 0;i <= rows; i += 1) {
|
|
780
|
+
const v = i / rows;
|
|
781
|
+
const y = from + (to - from) * v;
|
|
782
|
+
for (let j = 0;j <= columns; j += 1) {
|
|
783
|
+
const u = j / columns;
|
|
784
|
+
const phi = angle(y, u);
|
|
785
|
+
const g = typeof grow === "function" ? grow(v, phi) : grow;
|
|
786
|
+
const pt = surf(y, phi, g);
|
|
787
|
+
positions.push(pt.x, y, pt.z);
|
|
788
|
+
uvs.push(u, v);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
for (let i = 0;i < rows; i += 1)
|
|
792
|
+
for (let j = 0;j < columns; j += 1) {
|
|
793
|
+
const a = i * (columns + 1) + j;
|
|
794
|
+
const b = a + columns + 1;
|
|
795
|
+
indices.push(a, a + 1, b, a + 1, b + 1, b);
|
|
796
|
+
}
|
|
797
|
+
const geometry = new BufferGeometry;
|
|
798
|
+
geometry.setAttribute("position", new BufferAttribute(new Float32Array(positions), 3));
|
|
799
|
+
geometry.setAttribute("uv", new BufferAttribute(new Float32Array(uvs), 2));
|
|
800
|
+
geometry.setIndex(indices);
|
|
801
|
+
geometry.computeVertexNormals();
|
|
802
|
+
return geometry;
|
|
803
|
+
}
|
|
804
|
+
function aLineSkirtPatch(kit, bottom, top, flareOut, pleatCount, pleatAmp, rows = 10, columns = 64) {
|
|
805
|
+
const surf = surfaceOf(kit);
|
|
806
|
+
const z = zonesOf(kit);
|
|
807
|
+
const positions = [];
|
|
808
|
+
const uvs = [];
|
|
809
|
+
const indices = [];
|
|
810
|
+
for (let i = 0;i <= rows; i += 1) {
|
|
811
|
+
const v = i / rows;
|
|
812
|
+
const low = 1 - v;
|
|
813
|
+
const y = bottom + (top - bottom) * v;
|
|
814
|
+
for (let j = 0;j <= columns; j += 1) {
|
|
815
|
+
const u = j / columns;
|
|
816
|
+
const phi = u * Math.PI * 2;
|
|
817
|
+
const wPt = surf(top, phi, 0.022);
|
|
818
|
+
const hPt = surf(Math.max(z.hipY, bottom), phi, 0.028);
|
|
819
|
+
const bPt = surf(Math.max(y, z.bottomY), phi, 0.024);
|
|
820
|
+
const wR = Math.hypot(wPt.x, wPt.z);
|
|
821
|
+
const hR = Math.hypot(hPt.x, hPt.z);
|
|
822
|
+
const bR = Math.hypot(bPt.x, bPt.z);
|
|
823
|
+
const targetR = Math.max(bR, wR + (Math.max(hR - wR, 0.04) + flareOut) * low ** 0.85);
|
|
824
|
+
const phase = (phi / (Math.PI * 2) * pleatCount % 1 + 1) % 1;
|
|
825
|
+
const pleat = (Math.abs(phase * 2 - 1) - 0.5) * pleatAmp * low;
|
|
826
|
+
const r = targetR + pleat;
|
|
827
|
+
const baseR = bR || 1;
|
|
828
|
+
const scale = r / baseR;
|
|
829
|
+
positions.push(bPt.x * scale, y, bPt.z * scale);
|
|
830
|
+
uvs.push(u, v);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
for (let i = 0;i < rows; i += 1)
|
|
834
|
+
for (let j = 0;j < columns; j += 1) {
|
|
835
|
+
const a = i * (columns + 1) + j;
|
|
836
|
+
const b = a + columns + 1;
|
|
837
|
+
indices.push(a, a + 1, b, a + 1, b + 1, b);
|
|
838
|
+
}
|
|
839
|
+
const geometry = new BufferGeometry;
|
|
840
|
+
geometry.setAttribute("position", new BufferAttribute(new Float32Array(positions), 3));
|
|
841
|
+
geometry.setAttribute("uv", new BufferAttribute(new Float32Array(uvs), 2));
|
|
842
|
+
geometry.setIndex(indices);
|
|
843
|
+
geometry.computeVertexNormals();
|
|
844
|
+
return geometry;
|
|
845
|
+
}
|
|
738
846
|
function pleatedSkirt(kit) {
|
|
739
|
-
const
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
const
|
|
743
|
-
const
|
|
744
|
-
const
|
|
745
|
-
const pleatsAround = 24;
|
|
746
|
-
const geometry = new CylinderGeometry(waist, hem, top - bottom, pleatsAround * 4, 6, true);
|
|
847
|
+
const z = zonesOf(kit);
|
|
848
|
+
const surf = surfaceOf(kit);
|
|
849
|
+
return piece(kit, ({ add, keep }) => {
|
|
850
|
+
const top = kit.isFigure ? z.waistY + 0.02 : 0.25;
|
|
851
|
+
const bottom = kit.isFigure ? z.bottomY - 0.14 : 0.02;
|
|
852
|
+
const geometry = aLineSkirtPatch(kit, bottom, top, kit.isFigure ? 0.11 : 0.09, 22, 0.026, 10, 88);
|
|
747
853
|
const position = geometry.attributes.position;
|
|
748
854
|
const rest = Float32Array.from(position.array);
|
|
749
|
-
|
|
750
|
-
add(geometry, "#ffffff", { parent: skirt }, {
|
|
855
|
+
add(geometry, "#ffffff", {}, {
|
|
751
856
|
map: keep(tartan("#c8323c", "#1b1f5e", "#f2d24b")),
|
|
752
857
|
repeat: [6, 1.4],
|
|
753
858
|
double: true,
|
|
754
859
|
back: "#7d1d2a"
|
|
755
860
|
});
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
[waist + 0.012, top - 0.03],
|
|
761
|
-
[waist + 0.012, top + 0.012],
|
|
762
|
-
[waist - 0.004, top + 0.012]
|
|
763
|
-
], 64), "#1b1f5e", { scale: [1, 1, DEPTH] }, { outline: false });
|
|
764
|
-
add(new SphereGeometry(0.018, 10, 8), "#f2c94c", { at: [0.09, top - 0.009, (waist + 0.004) * DEPTH] }, { sheen: 0.8, outline: false });
|
|
861
|
+
add(fittedPatch(kit, top - 0.032, top + 0.014, 0.028, (_y, t) => t * Math.PI * 2, 3, 48), "#1b1f5e", {}, { double: true, outline: false });
|
|
862
|
+
add(aLineSkirtPatch(kit, bottom, bottom + 0.028, kit.isFigure ? 0.114 : 0.094, 22, 0.026, 2, 88), "#fbf8ff", {}, { double: true, outline: false });
|
|
863
|
+
const frontBtn = surf(top - 0.008, 0.18, 0.034);
|
|
864
|
+
add(new SphereGeometry(0.016, 10, 8), "#f2c94c", { at: [frontBtn.x, top - 0.008, frontBtn.z] }, { sheen: 0.8, outline: false });
|
|
765
865
|
const flare = new Spring(70, 6);
|
|
766
866
|
const sway = new Spring(50, 5);
|
|
767
|
-
const half = (top - bottom) / 2;
|
|
768
867
|
return (clock, delta, raw) => {
|
|
769
868
|
const motion = calm(raw);
|
|
770
|
-
const out = flare.step(clamp(-motion.lift * 0.05, -0.04, 0.
|
|
869
|
+
const out = flare.step(clamp(-motion.lift * 0.05, -0.04, 0.14), delta);
|
|
771
870
|
const turn = sway.step(-motion.yaw * 0.05, delta);
|
|
772
871
|
for (let i = 0;i < position.count; i += 1) {
|
|
773
872
|
const x = rest[i * 3] ?? 0;
|
|
774
873
|
const y = rest[i * 3 + 1] ?? 0;
|
|
775
|
-
const
|
|
776
|
-
const low = clamp((
|
|
777
|
-
const angle = Math.atan2(x,
|
|
778
|
-
const phase = (angle / (Math.PI * 2) * pleatsAround % 1 + 1) % 1;
|
|
779
|
-
const fold = 1 + (Math.abs(phase * 2 - 1) - 0.5) * 0.08 * low;
|
|
874
|
+
const z0 = rest[i * 3 + 2] ?? 0;
|
|
875
|
+
const low = clamp((top - y) / Math.max(0.05, top - bottom), 0, 1);
|
|
876
|
+
const angle = Math.atan2(x, z0);
|
|
780
877
|
const spread = 1 + out * low * low;
|
|
781
878
|
const lag = turn * low + Math.sin(clock * 2 + angle * 2) * 0.006 * low;
|
|
782
|
-
const r = Math.hypot(x,
|
|
879
|
+
const r = Math.hypot(x, z0) * spread;
|
|
783
880
|
position.setXYZ(i, Math.sin(angle + lag) * r, y, Math.cos(angle + lag) * r);
|
|
784
881
|
}
|
|
785
882
|
position.needsUpdate = true;
|
|
786
883
|
geometry.computeVertexNormals();
|
|
787
|
-
hemRing.scale.setScalar(1 + out);
|
|
788
884
|
};
|
|
789
885
|
});
|
|
790
886
|
}
|
|
791
887
|
function tuxedo(kit) {
|
|
792
|
-
const
|
|
888
|
+
const z = zonesOf(kit);
|
|
889
|
+
const surf = surfaceOf(kit);
|
|
793
890
|
return piece(kit, ({ add, keep, node }) => {
|
|
794
|
-
const
|
|
795
|
-
const
|
|
796
|
-
const
|
|
797
|
-
|
|
798
|
-
|
|
891
|
+
const bottom = kit.isFigure ? z.hipY - 0.04 : 0.03;
|
|
892
|
+
const button = kit.isFigure ? z.waistY + 0.02 : 0.15;
|
|
893
|
+
const collar = kit.isFigure ? z.shoulderY + 0.04 : 0.34;
|
|
894
|
+
const bowY = kit.isFigure ? collar - 0.04 : COLLAR_Y;
|
|
895
|
+
const open = (y) => y > button ? 0.14 + (y - button) / Math.max(0.05, collar - button) * 0.52 : 0.14 + (button - y) / Math.max(0.05, button - bottom) * 0.42;
|
|
896
|
+
add(fittedPatch(kit, bottom, collar, 0.026, (y, t) => open(y) + t * (Math.PI * 2 - 2 * open(y))), "#1b1830", {}, { double: true, back: "#3b2a6b", sheen: 0.15 });
|
|
897
|
+
add(fittedPatch(kit, bottom + 0.02, collar - 0.01, 0.014, (y, t) => (t * 2 - 1) * (open(y) + 0.04), 16, 16), "#ffffff", {}, { map: keep(pleats()), repeat: [3, 1], outline: false });
|
|
799
898
|
for (const side of [-1, 1])
|
|
800
|
-
add(
|
|
801
|
-
const
|
|
899
|
+
add(fittedPatch(kit, button + 0.005, collar, 0.032, (y, t) => side * (open(y) + t * (0.05 + (y - button) / Math.max(0.05, collar - button) * 0.16)), 10, 4), "#3b3560", {}, { sheen: 0.6, double: true });
|
|
900
|
+
const frontZ = (y) => surf(y, 0, 0.028).z;
|
|
802
901
|
const wing = new Shape;
|
|
803
|
-
wing.moveTo(0, 0.
|
|
804
|
-
wing.quadraticCurveTo(0.
|
|
805
|
-
wing.quadraticCurveTo(0.
|
|
806
|
-
wing.quadraticCurveTo(0.
|
|
902
|
+
wing.moveTo(0, 0.01);
|
|
903
|
+
wing.quadraticCurveTo(0.042, 0.042, 0.072, 0.034);
|
|
904
|
+
wing.quadraticCurveTo(0.08, 0, 0.072, -0.034);
|
|
905
|
+
wing.quadraticCurveTo(0.042, -0.042, 0, -0.01);
|
|
807
906
|
wing.closePath();
|
|
808
|
-
const wingGeometry = slab(wing, 0.
|
|
907
|
+
const wingGeometry = slab(wing, 0.018, 0.007);
|
|
809
908
|
for (const side of [-1, 1])
|
|
810
909
|
add(wingGeometry, "#14102e", {
|
|
811
|
-
at: [side * 0.
|
|
910
|
+
at: [side * 0.042, bowY, frontZ(bowY) + 0.008],
|
|
812
911
|
rotate: [0, side === 1 ? 0 : Math.PI, side * -0.06]
|
|
813
912
|
}, { sheen: 0.55 });
|
|
814
|
-
add(new SphereGeometry(0.
|
|
815
|
-
|
|
816
|
-
for (const y of [0.22, 0.18])
|
|
817
|
-
add(stud, "#14102e", { at: [0, y, front(y) - 0.012] }, { sheen: 0.8, outline: false });
|
|
818
|
-
add(new CylinderGeometry(0.02, 0.02, 0.01, 16), "#14102e", { at: [0, button, front(button) + 0.001], rotate: [Math.PI / 2, 0, 0] }, { sheen: 0.8 });
|
|
819
|
-
const square = new Shape;
|
|
820
|
-
square.moveTo(-0.035, 0);
|
|
821
|
-
square.lineTo(-0.02, 0.04);
|
|
822
|
-
square.lineTo(0, 0.02);
|
|
823
|
-
square.lineTo(0.02, 0.045);
|
|
824
|
-
square.lineTo(0.035, 0);
|
|
825
|
-
square.closePath();
|
|
826
|
-
const chest = 0.22;
|
|
827
|
-
const chestAngle = 0.95;
|
|
828
|
-
const reach = R(chest) + 0.03;
|
|
829
|
-
add(slab(square, 0.006, 0.003), "#fbf8ff", {
|
|
830
|
-
at: [Math.sin(chestAngle) * reach, chest, Math.cos(chestAngle) * reach * DEPTH],
|
|
831
|
-
rotate: [0, chestAngle, 0]
|
|
832
|
-
});
|
|
913
|
+
add(new SphereGeometry(0.02, 12, 10), "#2e2a4a", { at: [0, bowY, frontZ(bowY) + 0.016], scale: [1, 1.2, 0.8] }, { sheen: 0.55 });
|
|
914
|
+
add(new CylinderGeometry(0.018, 0.018, 0.01, 16), "#14102e", { at: [0, button, frontZ(button) + 0.002], rotate: [Math.PI / 2, 0, 0] }, { sheen: 0.8 });
|
|
833
915
|
const tail = new Shape;
|
|
834
|
-
tail.moveTo(-0.
|
|
835
|
-
tail.lineTo(0.
|
|
836
|
-
tail.quadraticCurveTo(0.
|
|
837
|
-
tail.lineTo(0, -0.
|
|
838
|
-
tail.lineTo(-0.
|
|
839
|
-
tail.quadraticCurveTo(-0.
|
|
916
|
+
tail.moveTo(-0.055, 0);
|
|
917
|
+
tail.lineTo(0.055, 0);
|
|
918
|
+
tail.quadraticCurveTo(0.065, -0.13, 0.032, -0.22);
|
|
919
|
+
tail.lineTo(0, -0.18);
|
|
920
|
+
tail.lineTo(-0.032, -0.22);
|
|
921
|
+
tail.quadraticCurveTo(-0.065, -0.13, -0.055, 0);
|
|
840
922
|
const tailGeometry = slab(tail, 0.014, 0.006);
|
|
923
|
+
const backPt = surf(bottom + 0.06, Math.PI, 0.026);
|
|
841
924
|
const tails = [-1, 1].map((side) => {
|
|
842
925
|
const hang = node({
|
|
843
|
-
at: [side * 0.
|
|
844
|
-
rotate: [0, Math.PI + side * -0.
|
|
926
|
+
at: [side * 0.07, bottom + 0.06, backPt.z],
|
|
927
|
+
rotate: [0, Math.PI + side * -0.18, 0]
|
|
845
928
|
});
|
|
846
|
-
add(tailGeometry, "#1b1830", { at: [0, -0.
|
|
929
|
+
add(tailGeometry, "#1b1830", { at: [0, -0.09, 0], parent: hang }, { sheen: 0.15 });
|
|
847
930
|
return { hang, spring: new Spring(60, 5), side };
|
|
848
931
|
});
|
|
849
932
|
return (clock, delta, raw) => {
|
|
850
933
|
const motion = calm(raw);
|
|
851
934
|
for (const t of tails) {
|
|
852
|
-
const kick = t.spring.step(-0.
|
|
935
|
+
const kick = t.spring.step(-0.14 + clamp(-motion.lift * 0.12, -0.3, 0.5) + Math.abs(motion.yaw) * 0.04, delta);
|
|
853
936
|
t.hang.rotation.x = kick + Math.sin(clock * 1.5 + t.side) * 0.02;
|
|
854
937
|
}
|
|
855
938
|
};
|
|
856
939
|
});
|
|
857
940
|
}
|
|
858
941
|
function heroCape(kit) {
|
|
859
|
-
const
|
|
942
|
+
const z = zonesOf(kit);
|
|
943
|
+
const surf = surfaceOf(kit);
|
|
860
944
|
return piece(kit, ({ add }) => {
|
|
861
|
-
const top = 0.6;
|
|
862
|
-
const bottom = 0;
|
|
945
|
+
const top = kit.isFigure ? z.shoulderY + 0.04 : 0.6;
|
|
946
|
+
const bottom = kit.isFigure ? -0.1 : 0;
|
|
863
947
|
const across = Math.PI * 0.95;
|
|
864
948
|
const columns = 22;
|
|
865
949
|
const rows = 14;
|
|
@@ -887,11 +971,12 @@ function heroCape(kit) {
|
|
|
887
971
|
const u = j / columns;
|
|
888
972
|
const angle = Math.PI - across / 2 + across * u + lag * v * v;
|
|
889
973
|
const ripple = Math.sin(u * 9 + clock * 2.4) * 0.025 * v * v;
|
|
890
|
-
const
|
|
974
|
+
const sampleY = Math.max(y, z.hipY);
|
|
975
|
+
const pt = surf(sampleY, angle, 0.045 + v * 0.16 + out * v * v + ripple);
|
|
891
976
|
const k = (i * (columns + 1) + j) * 3;
|
|
892
|
-
positions[k] =
|
|
977
|
+
positions[k] = pt.x;
|
|
893
978
|
positions[k + 1] = y + out * v * v * 0.1;
|
|
894
|
-
positions[k + 2] =
|
|
979
|
+
positions[k + 2] = pt.z;
|
|
895
980
|
}
|
|
896
981
|
}
|
|
897
982
|
geometry.attributes.position.needsUpdate = true;
|
|
@@ -899,11 +984,11 @@ function heroCape(kit) {
|
|
|
899
984
|
};
|
|
900
985
|
drape(0, 0, 0);
|
|
901
986
|
add(geometry, "#c8323c", {}, { double: true, back: "#f2c94c", sheen: 0.2 });
|
|
902
|
-
add(
|
|
987
|
+
add(fittedPatch(kit, top - 0.04, top + 0.06, 0.045, (_y, t) => Math.PI * 0.42 + t * (Math.PI * 2 - Math.PI * 0.84), 3, 24), "#9e1f2c", {}, { double: true, back: "#f2c94c" });
|
|
903
988
|
const clasp = new Shape;
|
|
904
989
|
for (let i = 0;i < 10; i += 1) {
|
|
905
990
|
const a = i / 10 * Math.PI * 2;
|
|
906
|
-
const r = i % 2 ? 0.
|
|
991
|
+
const r = i % 2 ? 0.02 : 0.04;
|
|
907
992
|
if (i === 0)
|
|
908
993
|
clasp.moveTo(Math.sin(a) * r, Math.cos(a) * r);
|
|
909
994
|
else
|
|
@@ -912,12 +997,9 @@ function heroCape(kit) {
|
|
|
912
997
|
clasp.closePath();
|
|
913
998
|
const star = slab(clasp, 0.012, 0.005);
|
|
914
999
|
for (const side of [-1, 1]) {
|
|
915
|
-
const angle = side * (Math.PI / 2 - 0.
|
|
916
|
-
const
|
|
917
|
-
add(star, "#f2c94c", {
|
|
918
|
-
at: [Math.sin(angle) * r, top - 0.02, Math.cos(angle) * r * DEPTH],
|
|
919
|
-
rotate: [0, angle, 0]
|
|
920
|
-
}, { sheen: 0.85 });
|
|
1000
|
+
const angle = side * (Math.PI / 2 - 0.22);
|
|
1001
|
+
const pt = surf(top - 0.02, angle, 0.04);
|
|
1002
|
+
add(star, "#f2c94c", { at: [pt.x, top - 0.02, pt.z], rotate: [0, angle, 0] }, { sheen: 0.85 });
|
|
921
1003
|
}
|
|
922
1004
|
const flare = new Spring(40, 4);
|
|
923
1005
|
const trail = new Spring(35, 4);
|
|
@@ -929,24 +1011,23 @@ function heroCape(kit) {
|
|
|
929
1011
|
});
|
|
930
1012
|
}
|
|
931
1013
|
function scarf(kit) {
|
|
932
|
-
const
|
|
1014
|
+
const z = zonesOf(kit);
|
|
1015
|
+
const surf = surfaceOf(kit);
|
|
933
1016
|
return piece(kit, ({ add, keep, node }) => {
|
|
934
1017
|
const wool = keep(knit("#e2574c", "#fbf8ff"));
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
const
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
add(new SphereGeometry(0.06, 16, 12), "#ffffff", { at: knotAt, scale: [1, 0.85, 0.75] }, { map: wool, repeat: [3, 1] });
|
|
944
|
-
const strip = new CylinderGeometry(0.05, 0.055, 0.26, 12, 6);
|
|
1018
|
+
const y = kit.isFigure ? z.neckY - 0.03 : COLLAR_Y;
|
|
1019
|
+
const r = Math.max(0.11, kit.radiusAt(y)) + 0.025;
|
|
1020
|
+
add(new TorusGeometry(r, kit.isFigure ? 0.048 : 0.058, 14, 64), "#ffffff", { at: [0, y, 0], rotate: [Math.PI / 2, 0, 0], scale: [1, DEPTH, 1.05] }, { map: wool, repeat: [14, 1] });
|
|
1021
|
+
const knotAngle = 0.52;
|
|
1022
|
+
const knotPt = surf(y, knotAngle, 0.045);
|
|
1023
|
+
const knotAt = [knotPt.x, y - 0.01, knotPt.z];
|
|
1024
|
+
add(new SphereGeometry(0.05, 16, 12), "#ffffff", { at: knotAt, scale: [1, 0.85, 0.75] }, { map: wool, repeat: [3, 1] });
|
|
1025
|
+
const strip = new CylinderGeometry(0.046, 0.05, 0.26, 12, 6);
|
|
945
1026
|
strip.scale(1, 1, 0.35);
|
|
946
|
-
const
|
|
1027
|
+
const fringeGeo = new CylinderGeometry(0.006, 0.004, 0.04, 5);
|
|
947
1028
|
const tails = [
|
|
948
1029
|
{ x: -0.01, tilt: 0.12, length: 1 },
|
|
949
|
-
{ x: 0.
|
|
1030
|
+
{ x: 0.042, tilt: -0.05, length: 0.82 }
|
|
950
1031
|
].map(({ x, tilt, length }) => {
|
|
951
1032
|
const hang = node({
|
|
952
1033
|
at: [knotAt[0] + x, knotAt[1] - 0.02, knotAt[2] + 0.02],
|
|
@@ -954,7 +1035,7 @@ function scarf(kit) {
|
|
|
954
1035
|
});
|
|
955
1036
|
add(strip, "#ffffff", { at: [0, -0.13 * length, 0], scale: [1, length, 1], parent: hang }, { map: wool, repeat: [2, 2] });
|
|
956
1037
|
for (let i = 0;i < 5; i += 1)
|
|
957
|
-
add(
|
|
1038
|
+
add(fringeGeo, "#e2574c", { at: [-0.036 + i * 0.018, -0.26 * length - 0.02, 0], parent: hang }, { outline: false });
|
|
958
1039
|
return { hang, tilt, spring: new Spring(55, 5, tilt) };
|
|
959
1040
|
});
|
|
960
1041
|
return (clock, delta, raw) => {
|
|
@@ -966,6 +1047,250 @@ function scarf(kit) {
|
|
|
966
1047
|
};
|
|
967
1048
|
});
|
|
968
1049
|
}
|
|
1050
|
+
function ribbonDress(kit) {
|
|
1051
|
+
const z = zonesOf(kit);
|
|
1052
|
+
const surf = surfaceOf(kit);
|
|
1053
|
+
return piece(kit, ({ add, keep, node }) => {
|
|
1054
|
+
const bodiceTop = kit.isFigure ? z.bustY + 0.09 : 0.36;
|
|
1055
|
+
const waist = kit.isFigure ? z.waistY : 0.24;
|
|
1056
|
+
const hem = kit.isFigure ? z.bottomY - 0.16 : 0.02;
|
|
1057
|
+
add(fittedPatch(kit, waist, bodiceTop, 0.028, (_y, t) => t * Math.PI * 2, 20, 56), "#ff6fa8", {}, { double: true, back: "#c43f76", sheen: 0.32 });
|
|
1058
|
+
add(fittedPatch(kit, bodiceTop - 0.022, bodiceTop + 0.008, 0.033, (_y, t) => t * Math.PI * 2, 2, 56), "#fff7fb", {}, { double: true, outline: false });
|
|
1059
|
+
if (kit.isFigure) {
|
|
1060
|
+
for (const side of [-1, 1]) {
|
|
1061
|
+
const shPt = surf(z.shoulderY, side * 1.15, 0.015);
|
|
1062
|
+
add(new SphereGeometry(0.055, 14, 12), "#fff7fb", { at: [shPt.x, z.shoulderY - 0.02, shPt.z], scale: [1.1, 0.85, 1] }, { sheen: 0.25 });
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
add(fittedPatch(kit, waist - 0.026, waist + 0.024, 0.032, (_y, t) => t * Math.PI * 2, 3, 56), "#fff7fb", {}, { double: true, sheen: 0.45 });
|
|
1066
|
+
const frontW = surf(waist, 0, 0.04);
|
|
1067
|
+
const bowNode = node({ at: [frontW.x, waist, frontW.z] });
|
|
1068
|
+
const loopGeo = new TorusGeometry(0.038, 0.013, 10, 20);
|
|
1069
|
+
for (const side of [-1, 1])
|
|
1070
|
+
add(loopGeo, "#ff3d8b", {
|
|
1071
|
+
at: [side * 0.04, 0, 0],
|
|
1072
|
+
rotate: [0, 0, side * 0.3],
|
|
1073
|
+
scale: [1.15, 0.72, 0.55],
|
|
1074
|
+
parent: bowNode
|
|
1075
|
+
}, { sheen: 0.5 });
|
|
1076
|
+
add(new SphereGeometry(0.018, 10, 8), "#ff3d8b", { parent: bowNode }, { sheen: 0.5 });
|
|
1077
|
+
const skirtGeo = aLineSkirtPatch(kit, hem, waist, kit.isFigure ? 0.14 : 0.1, 16, 0.02, 10, 72);
|
|
1078
|
+
const pos = skirtGeo.attributes.position;
|
|
1079
|
+
const rest = Float32Array.from(pos.array);
|
|
1080
|
+
add(skirtGeo, "#ff6fa8", {}, {
|
|
1081
|
+
map: keep(dots("#ff7eb6", "#ffe3f0")),
|
|
1082
|
+
repeat: [8, 3],
|
|
1083
|
+
double: true,
|
|
1084
|
+
back: "#ffe8f3",
|
|
1085
|
+
sheen: 0.22
|
|
1086
|
+
});
|
|
1087
|
+
add(aLineSkirtPatch(kit, hem - 0.032, hem + 0.025, kit.isFigure ? 0.145 : 0.105, 22, 0.016, 3, 72), "#fffaff", {}, { double: true, outline: false });
|
|
1088
|
+
const flare = new Spring(65, 5.5);
|
|
1089
|
+
return (clock, delta, raw) => {
|
|
1090
|
+
const motion = calm(raw);
|
|
1091
|
+
const out = flare.step(clamp(-motion.lift * 0.06, -0.03, 0.15), delta);
|
|
1092
|
+
for (let i = 0;i < pos.count; i += 1) {
|
|
1093
|
+
const x = rest[i * 3] ?? 0;
|
|
1094
|
+
const y = rest[i * 3 + 1] ?? 0;
|
|
1095
|
+
const z0 = rest[i * 3 + 2] ?? 0;
|
|
1096
|
+
const low = clamp((waist - y) / Math.max(0.05, waist - hem), 0, 1);
|
|
1097
|
+
const a = Math.atan2(x, z0);
|
|
1098
|
+
const r = Math.hypot(x, z0) * (1 + out * low * low + Math.sin(clock * 2.2 + a * 3) * 0.008 * low);
|
|
1099
|
+
pos.setXYZ(i, Math.sin(a) * r, y, Math.cos(a) * r);
|
|
1100
|
+
}
|
|
1101
|
+
pos.needsUpdate = true;
|
|
1102
|
+
skirtGeo.computeVertexNormals();
|
|
1103
|
+
};
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
function cropHoodie(kit) {
|
|
1107
|
+
const z = zonesOf(kit);
|
|
1108
|
+
const surf = surfaceOf(kit);
|
|
1109
|
+
return piece(kit, ({ add, node }) => {
|
|
1110
|
+
const bottom = kit.isFigure ? z.waistY + 0.06 : 0.2;
|
|
1111
|
+
const top = kit.isFigure ? z.shoulderY + 0.06 : 0.39;
|
|
1112
|
+
add(fittedPatch(kit, bottom, top, (v) => 0.03 + (1 - v) * 0.012, (_y, t) => t * Math.PI * 2, 18, 56), "#d8b8ff", {}, { double: true, back: "#8f6ec4", sheen: 0.1 });
|
|
1113
|
+
add(fittedPatch(kit, bottom - 0.022, bottom + 0.012, 0.036, (_y, t) => t * Math.PI * 2, 3, 56), "#fffaff", {}, { double: true, outline: false });
|
|
1114
|
+
const neckY = kit.isFigure ? z.neckY - 0.02 : top;
|
|
1115
|
+
const backPt = surf(neckY, Math.PI, 0.05);
|
|
1116
|
+
add(new SphereGeometry(kit.isFigure ? 0.12 : 0.16, 16, 12), "#c69eff", { at: [0, neckY - 0.01, backPt.z - 0.05], scale: [1.35, 0.72, 0.95] }, { sheen: 0.1 });
|
|
1117
|
+
if (kit.isFigure) {
|
|
1118
|
+
add(fittedPatch(kit, z.bottomY - 0.02, z.hipY + 0.09, 0.024, (_y, t) => t * Math.PI * 2, 12, 56), "#2c2448", {}, { double: true });
|
|
1119
|
+
}
|
|
1120
|
+
const frontNeck = surf(top - 0.02, 0, 0.04);
|
|
1121
|
+
const strings = [-1, 1].map((side) => {
|
|
1122
|
+
const hang = node({ at: [side * 0.042, top - 0.02, frontNeck.z] });
|
|
1123
|
+
add(new CylinderGeometry(0.008, 0.008, 0.14, 8), "#fffaff", { at: [0, -0.07, 0], parent: hang }, { outline: false });
|
|
1124
|
+
add(new SphereGeometry(0.013, 8, 8), "#ff7eb8", { at: [0, -0.14, 0], parent: hang }, { outline: false });
|
|
1125
|
+
return { hang, side, spring: new Spring(60, 4.5) };
|
|
1126
|
+
});
|
|
1127
|
+
return (clock, delta, raw) => {
|
|
1128
|
+
const motion = calm(raw);
|
|
1129
|
+
for (const s of strings) {
|
|
1130
|
+
s.hang.rotation.z = s.spring.step(-motion.yaw * 0.04 + Math.sin(clock * 2.1 + s.side) * 0.05, delta);
|
|
1131
|
+
s.hang.rotation.x = clamp(motion.lift * 0.08, -0.25, 0.35);
|
|
1132
|
+
}
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
}
|
|
1136
|
+
function idolSet(kit) {
|
|
1137
|
+
const z = zonesOf(kit);
|
|
1138
|
+
const surf = surfaceOf(kit);
|
|
1139
|
+
return piece(kit, ({ add, node }) => {
|
|
1140
|
+
const topBottom = kit.isFigure ? z.waistY + 0.05 : 0.24;
|
|
1141
|
+
const topHigh = kit.isFigure ? z.shoulderY + 0.05 : 0.38;
|
|
1142
|
+
const skirtTop = kit.isFigure ? z.waistY - 0.01 : 0.22;
|
|
1143
|
+
const skirtBot = kit.isFigure ? z.bottomY - 0.12 : 0.02;
|
|
1144
|
+
add(fittedPatch(kit, topBottom, topHigh, 0.028, (_y, t) => t * Math.PI * 2, 16, 56), "#ffffff", {}, { double: true, sheen: 0.2 });
|
|
1145
|
+
add(fittedPatch(kit, topHigh - 0.1, topHigh + 0.01, 0.034, (_y, t) => t * Math.PI * 2, 6, 56), "#1f2b6c", {}, { double: true });
|
|
1146
|
+
add(fittedPatch(kit, topHigh - 0.09, topHigh - 0.075, 0.038, (_y, t) => t * Math.PI * 2, 2, 56), "#ffd84d", {}, { double: true, outline: false, sheen: 0.7 });
|
|
1147
|
+
const chest = surf(topHigh - 0.09, 0, 0.045);
|
|
1148
|
+
const bow2 = node({ at: [0, topHigh - 0.09, chest.z] });
|
|
1149
|
+
const loop = new TorusGeometry(0.038, 0.013, 10, 20);
|
|
1150
|
+
for (const side of [-1, 1]) {
|
|
1151
|
+
add(loop, "#ff3b6b", { at: [side * 0.038, 0, 0], scale: [1.15, 0.75, 0.5], parent: bow2 }, { sheen: 0.45 });
|
|
1152
|
+
add(new CylinderGeometry(0.015, 0.022, 0.095, 8), "#ff3b6b", {
|
|
1153
|
+
at: [side * 0.024, -0.055, 0],
|
|
1154
|
+
rotate: [0, 0, side * 0.24],
|
|
1155
|
+
scale: [1, 1, 0.3],
|
|
1156
|
+
parent: bow2
|
|
1157
|
+
}, { outline: false });
|
|
1158
|
+
}
|
|
1159
|
+
add(aLineSkirtPatch(kit, skirtBot, skirtTop, kit.isFigure ? 0.11 : 0.085, 22, 0.02, 8, 72), "#1f2b6c", {}, { double: true, back: "#ff6fa8" });
|
|
1160
|
+
add(aLineSkirtPatch(kit, skirtBot + 0.016, skirtBot + 0.038, kit.isFigure ? 0.105 : 0.08, 22, 0.018, 2, 72), "#ffd84d", {}, { double: true, outline: false, sheen: 0.75 });
|
|
1161
|
+
return;
|
|
1162
|
+
});
|
|
1163
|
+
}
|
|
1164
|
+
function streetJacket(kit) {
|
|
1165
|
+
const z = zonesOf(kit);
|
|
1166
|
+
const surf = surfaceOf(kit);
|
|
1167
|
+
return piece(kit, ({ add }) => {
|
|
1168
|
+
const bottom = kit.isFigure ? z.hipY - 0.04 : 0.04;
|
|
1169
|
+
const top = kit.isFigure ? z.shoulderY + 0.06 : 0.39;
|
|
1170
|
+
if (kit.isFigure) {
|
|
1171
|
+
add(fittedPatch(kit, z.bottomY - 0.03, z.waistY + 0.02, 0.022, (_y, t) => t * Math.PI * 2, 12, 48), "#161622", {}, { double: true });
|
|
1172
|
+
}
|
|
1173
|
+
add(fittedPatch(kit, bottom + 0.02, top - 0.01, 0.026, (_y, t) => t * Math.PI * 2, 16, 48), "#181726", {}, { double: true });
|
|
1174
|
+
const gap = 0.34;
|
|
1175
|
+
add(fittedPatch(kit, bottom, top, (v) => 0.04 + (1 - v) * 0.008, (_y, t) => gap + t * (Math.PI * 2 - gap * 2), 18, 48), "#2c2f48", {}, { double: true, back: "#ff4f7a", sheen: 0.25 });
|
|
1176
|
+
for (const side of [-1, 1]) {
|
|
1177
|
+
add(fittedPatch(kit, bottom, top, 0.045, (_y, t) => side * (gap + t * 0.08), 12, 3), "#ff4f7a", {}, { double: true, outline: false });
|
|
1178
|
+
}
|
|
1179
|
+
add(fittedPatch(kit, top - 0.02, top + 0.065, 0.042, (_y, t) => gap * 1.1 + t * (Math.PI * 2 - gap * 2.2), 4, 32), "#1b1d2e", {}, { double: true, back: "#ff4f7a" });
|
|
1180
|
+
const chainY = kit.isFigure ? z.bustY + 0.04 : top - 0.08;
|
|
1181
|
+
const bead = new SphereGeometry(0.011, 8, 8);
|
|
1182
|
+
for (let i = -5;i <= 5; i += 1) {
|
|
1183
|
+
const phi = i * 0.08;
|
|
1184
|
+
const drop = Math.cos(i / 5 * Math.PI * 0.5) * 0.065;
|
|
1185
|
+
const pt = surf(chainY - drop, phi, 0.036);
|
|
1186
|
+
add(bead, "#e4ebff", { at: [pt.x, chainY - drop, pt.z] }, { sheen: 0.9, outline: false });
|
|
1187
|
+
}
|
|
1188
|
+
return;
|
|
1189
|
+
});
|
|
1190
|
+
}
|
|
1191
|
+
function blazerCoat(kit) {
|
|
1192
|
+
const z = zonesOf(kit);
|
|
1193
|
+
const surf = surfaceOf(kit);
|
|
1194
|
+
return piece(kit, ({ add }) => {
|
|
1195
|
+
const bottom = kit.isFigure ? z.hipY - 0.05 : 0.03;
|
|
1196
|
+
const waist = kit.isFigure ? z.waistY + 0.02 : 0.18;
|
|
1197
|
+
const top = kit.isFigure ? z.shoulderY + 0.05 : 0.37;
|
|
1198
|
+
const vOpen = (y) => y > waist ? 0.1 + (y - waist) / Math.max(0.05, top - waist) * 0.45 : 0.06;
|
|
1199
|
+
if (kit.isFigure) {
|
|
1200
|
+
add(fittedPatch(kit, z.bottomY - 0.03, z.waistY, 0.022, (_y, t) => t * Math.PI * 2, 10, 48), "#1c223c", {}, { double: true });
|
|
1201
|
+
}
|
|
1202
|
+
add(fittedPatch(kit, bottom + 0.02, top, 0.024, (_y, t) => t * Math.PI * 2, 16, 48), "#f8f9ff", {}, { double: true, outline: false });
|
|
1203
|
+
add(fittedPatch(kit, bottom, top, 0.036, (y, t) => vOpen(y) + t * (Math.PI * 2 - 2 * vOpen(y)), 18, 48), "#232b4f", {}, { double: true, back: "#3c4a7d", sheen: 0.18 });
|
|
1204
|
+
for (const side of [-1, 1]) {
|
|
1205
|
+
add(fittedPatch(kit, waist, top, 0.041, (y, t) => side * (vOpen(y) + t * 0.09), 10, 3), "#f2c94c", {}, { double: true, outline: false, sheen: 0.75 });
|
|
1206
|
+
}
|
|
1207
|
+
add(fittedPatch(kit, waist - 0.02, top - 0.02, 0.034, (y, t) => {
|
|
1208
|
+
const w = y > top - 0.07 ? 0.08 : 0.12 - (y - waist) / Math.max(0.05, top - waist) * 0.05;
|
|
1209
|
+
return (t * 2 - 1) * w;
|
|
1210
|
+
}, 10, 6), "#d6354a", {}, { double: true });
|
|
1211
|
+
const btn = new SphereGeometry(0.014, 8, 8);
|
|
1212
|
+
for (const by of [waist, waist - 0.065]) {
|
|
1213
|
+
const pt = surf(by, 0.16, 0.042);
|
|
1214
|
+
add(btn, "#f2c94c", { at: [pt.x, by, pt.z] }, { sheen: 0.85, outline: false });
|
|
1215
|
+
}
|
|
1216
|
+
return;
|
|
1217
|
+
});
|
|
1218
|
+
}
|
|
1219
|
+
function brawlerVest(kit) {
|
|
1220
|
+
const z = zonesOf(kit);
|
|
1221
|
+
const surf = surfaceOf(kit);
|
|
1222
|
+
return piece(kit, ({ add }) => {
|
|
1223
|
+
const bottom = kit.isFigure ? z.waistY - 0.08 : 0.05;
|
|
1224
|
+
const top = kit.isFigure ? z.shoulderY + 0.03 : 0.36;
|
|
1225
|
+
if (kit.isFigure) {
|
|
1226
|
+
add(fittedPatch(kit, z.bottomY - 0.04, z.waistY - 0.02, 0.026, (_y, t) => t * Math.PI * 2, 12, 48), "#2b2538", {}, { double: true });
|
|
1227
|
+
}
|
|
1228
|
+
add(fittedPatch(kit, bottom, top, (v) => 0.028 + (v > 0.7 ? 0.008 : 0), (_y, t) => t * Math.PI * 2, 20, 56), "#232030", {}, { double: true, sheen: 0.12 });
|
|
1229
|
+
add(fittedPatch(kit, (top + bottom) * 0.54, (top + bottom) * 0.65, 0.036, (_y, t) => t * Math.PI * 2, 4, 56), "#ff5733", {}, { double: true, outline: false });
|
|
1230
|
+
const beltY = kit.isFigure ? z.waistY - 0.04 : 0.14;
|
|
1231
|
+
add(fittedPatch(kit, beltY - 0.028, beltY + 0.028, 0.036, (_y, t) => t * Math.PI * 2, 3, 48), "#4a2b1d", {}, { double: true });
|
|
1232
|
+
const bucklePt = surf(beltY, 0, 0.045);
|
|
1233
|
+
add(new CylinderGeometry(0.032, 0.032, 0.016, 6), "#ffd24a", { at: [bucklePt.x, beltY, bucklePt.z], rotate: [Math.PI / 2, 0, 0] }, { sheen: 0.85 });
|
|
1234
|
+
return;
|
|
1235
|
+
});
|
|
1236
|
+
}
|
|
1237
|
+
function martialGi(kit) {
|
|
1238
|
+
const z = zonesOf(kit);
|
|
1239
|
+
const surf = surfaceOf(kit);
|
|
1240
|
+
return piece(kit, ({ add, node }) => {
|
|
1241
|
+
const bottom = kit.isFigure ? z.bottomY - 0.03 : 0.03;
|
|
1242
|
+
const waist = kit.isFigure ? z.waistY - 0.02 : 0.16;
|
|
1243
|
+
const top = kit.isFigure ? z.shoulderY + 0.04 : 0.37;
|
|
1244
|
+
const vOpen = (y) => y > waist ? 0.08 + (y - waist) / Math.max(0.05, top - waist) * 0.44 : 0;
|
|
1245
|
+
add(fittedPatch(kit, bottom, top, (v) => 0.032 + (1 - v) * 0.014, (y, t) => vOpen(y) + t * (Math.PI * 2 - 2 * vOpen(y)), 20, 56), "#f4f1ea", {}, { double: true, back: "#d8d1c5" });
|
|
1246
|
+
for (const side of [-1, 1]) {
|
|
1247
|
+
add(fittedPatch(kit, waist, top, 0.038, (y, t) => side * (vOpen(y) + t * 0.1), 10, 3), "#1b2042", {}, { double: true, outline: false });
|
|
1248
|
+
}
|
|
1249
|
+
add(fittedPatch(kit, waist - 0.032, waist + 0.032, 0.042, (_y, t) => t * Math.PI * 2, 4, 48), "#181624", {}, { double: true });
|
|
1250
|
+
const knotPt = surf(waist, 0, 0.052);
|
|
1251
|
+
add(new SphereGeometry(0.038, 12, 10), "#181624", { at: [knotPt.x, waist, knotPt.z] });
|
|
1252
|
+
const tailGeo = new CylinderGeometry(0.022, 0.028, 0.22, 8);
|
|
1253
|
+
tailGeo.scale(1, 1, 0.3);
|
|
1254
|
+
const tails = [-1, 1].map((side) => {
|
|
1255
|
+
const hang = node({
|
|
1256
|
+
at: [knotPt.x + side * 0.028, waist - 0.02, knotPt.z + 0.008],
|
|
1257
|
+
rotate: [0.08, 0, side * 0.24]
|
|
1258
|
+
});
|
|
1259
|
+
add(tailGeo, "#181624", { at: [0, -0.1, 0], parent: hang });
|
|
1260
|
+
return { hang, side, spring: new Spring(55, 5) };
|
|
1261
|
+
});
|
|
1262
|
+
return (clock, delta, raw) => {
|
|
1263
|
+
const motion = calm(raw);
|
|
1264
|
+
for (const t of tails) {
|
|
1265
|
+
t.hang.rotation.z = t.spring.step(t.side * 0.24 - motion.yaw * 0.04 + Math.sin(clock * 2 + t.side) * 0.04, delta);
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
});
|
|
1269
|
+
}
|
|
1270
|
+
function chibiOveralls(kit) {
|
|
1271
|
+
const z = zonesOf(kit);
|
|
1272
|
+
const surf = surfaceOf(kit);
|
|
1273
|
+
return piece(kit, ({ add }) => {
|
|
1274
|
+
const bottom = kit.isFigure ? z.bottomY - 0.02 : 0.03;
|
|
1275
|
+
const waist = kit.isFigure ? z.waistY + 0.02 : 0.22;
|
|
1276
|
+
const top = kit.isFigure ? z.shoulderY + 0.04 : 0.36;
|
|
1277
|
+
add(fittedPatch(kit, waist - 0.02, top, 0.014, (_y, t) => t * Math.PI * 2, 12, 48), "#fff3d9", {}, { double: true, outline: false });
|
|
1278
|
+
add(fittedPatch(kit, bottom, waist + 0.03, 0.022, (_y, t) => t * Math.PI * 2, 12, 48), "#5b8ff9", {}, { double: true, back: "#3d66bf" });
|
|
1279
|
+
add(fittedPatch(kit, waist, top - 0.05, 0.026, (_y, t) => (t * 2 - 1) * 0.55, 8, 12), "#5b8ff9", {}, { double: true });
|
|
1280
|
+
for (const side of [-1, 1]) {
|
|
1281
|
+
add(fittedPatch(kit, top - 0.07, top + 0.02, 0.028, (_y, t) => side * (0.36 + t * 0.2), 6, 4), "#5b8ff9", {}, { double: true, outline: false });
|
|
1282
|
+
const btnPt = surf(top - 0.07, side * 0.44, 0.034);
|
|
1283
|
+
add(new SphereGeometry(0.018, 10, 8), "#ffd84d", { at: [btnPt.x, top - 0.07, btnPt.z] }, { sheen: 0.85 });
|
|
1284
|
+
}
|
|
1285
|
+
const pockPt = surf(waist + 0.06, 0, 0.033);
|
|
1286
|
+
add(new CylinderGeometry(0.045, 0.045, 0.012, 12), "#ffd84d", {
|
|
1287
|
+
at: [pockPt.x, waist + 0.06, pockPt.z],
|
|
1288
|
+
rotate: [Math.PI / 2, 0, 0],
|
|
1289
|
+
scale: [1.1, 1, 0.85]
|
|
1290
|
+
}, { sheen: 0.4, outline: false });
|
|
1291
|
+
return;
|
|
1292
|
+
});
|
|
1293
|
+
}
|
|
969
1294
|
function sunglasses(kit) {
|
|
970
1295
|
const R = kit.radiusAt;
|
|
971
1296
|
return piece(kit, ({ add, keep }) => {
|
|
@@ -1009,6 +1334,14 @@ var BUILDERS = {
|
|
|
1009
1334
|
"party-hat": partyHat,
|
|
1010
1335
|
halo,
|
|
1011
1336
|
bow,
|
|
1337
|
+
"ribbon-dress": ribbonDress,
|
|
1338
|
+
"crop-hoodie": cropHoodie,
|
|
1339
|
+
"idol-set": idolSet,
|
|
1340
|
+
"street-jacket": streetJacket,
|
|
1341
|
+
"blazer-coat": blazerCoat,
|
|
1342
|
+
"brawler-vest": brawlerVest,
|
|
1343
|
+
"martial-gi": martialGi,
|
|
1344
|
+
"chibi-overalls": chibiOveralls,
|
|
1012
1345
|
"pleated-skirt": pleatedSkirt,
|
|
1013
1346
|
tuxedo,
|
|
1014
1347
|
"hero-cape": heroCape,
|
|
@@ -1021,6 +1354,18 @@ function buildGarment(key, kit) {
|
|
|
1021
1354
|
|
|
1022
1355
|
// src/hair3d.ts
|
|
1023
1356
|
var SKULL = new Vector3(0, BLOB_SEAT + 0.08, 0);
|
|
1357
|
+
var hexCh = (hex, i) => Number.parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16);
|
|
1358
|
+
var tintHex = (a, b, t) => `#${[0, 1, 2].map((i) => Math.max(0, Math.min(255, Math.round(hexCh(a, i) + (hexCh(b, i) - hexCh(a, i)) * t))).toString(16).padStart(2, "0")).join("")}`;
|
|
1359
|
+
function resolvePalette(base, override) {
|
|
1360
|
+
if (!override || !/^#[0-9a-f]{6}$/i.test(override))
|
|
1361
|
+
return base;
|
|
1362
|
+
return {
|
|
1363
|
+
color: override,
|
|
1364
|
+
tip: tintHex(override, "#fff0f8", 0.34),
|
|
1365
|
+
inner: tintHex(override, "#1c1238", 0.42),
|
|
1366
|
+
ring: base.ring ?? 1
|
|
1367
|
+
};
|
|
1368
|
+
}
|
|
1024
1369
|
var anime = (p, ring = p.ring ?? 1) => ({
|
|
1025
1370
|
anime: { center: [SKULL.x, SKULL.y, SKULL.z], ring, tip: p.tip, inner: p.inner }
|
|
1026
1371
|
});
|
|
@@ -1032,7 +1377,7 @@ var UP = new Vector3(0, 1, 0);
|
|
|
1032
1377
|
var FORWARD = new Vector3(0, 0, 1);
|
|
1033
1378
|
function clump(points, width, thickness, tip = 1, twist = 0) {
|
|
1034
1379
|
const curve = new CatmullRomCurve3(points, false, "centripetal");
|
|
1035
|
-
const segments =
|
|
1380
|
+
const segments = 22;
|
|
1036
1381
|
const sides = 10;
|
|
1037
1382
|
const positions = [];
|
|
1038
1383
|
const along = [];
|
|
@@ -1059,13 +1404,15 @@ function clump(points, width, thickness, tip = 1, twist = 0) {
|
|
|
1059
1404
|
depth.multiplyScalar(Math.cos(turn)).addScaledVector(across, -Math.sin(turn));
|
|
1060
1405
|
across.copy(a);
|
|
1061
1406
|
}
|
|
1062
|
-
const
|
|
1407
|
+
const taper = Math.max(1 - tip, (1 - t) ** 0.72);
|
|
1408
|
+
const swell = 1 + 0.48 * Math.sin(Math.min(1, t * 1.45) * Math.PI);
|
|
1409
|
+
const s = taper * swell;
|
|
1063
1410
|
for (let m = 0;m <= sides; m += 1) {
|
|
1064
1411
|
const a = m / sides * Math.PI * 2;
|
|
1065
1412
|
const c = Math.cos(a);
|
|
1066
1413
|
const n = Math.sin(a);
|
|
1067
1414
|
const w = c * width * s;
|
|
1068
|
-
const d = n * thickness * s * (0.
|
|
1415
|
+
const d = n * thickness * s * (0.38 + 0.62 * Math.abs(n));
|
|
1069
1416
|
positions.push(p.x + across.x * w + depth.x * d, p.y + across.y * w + depth.y * d, p.z + across.z * w + depth.z * d);
|
|
1070
1417
|
along.push(t);
|
|
1071
1418
|
}
|
|
@@ -1087,7 +1434,7 @@ function clump(points, width, thickness, tip = 1, twist = 0) {
|
|
|
1087
1434
|
}
|
|
1088
1435
|
const geometry = new BufferGeometry2;
|
|
1089
1436
|
geometry.setAttribute("position", new BufferAttribute2(new Float32Array(positions), 3));
|
|
1090
|
-
geometry.setAttribute("along", new BufferAttribute2(Float32Array
|
|
1437
|
+
geometry.setAttribute("along", new BufferAttribute2(new Float32Array(along), 1));
|
|
1091
1438
|
geometry.setIndex(indices);
|
|
1092
1439
|
geometry.computeVertexNormals();
|
|
1093
1440
|
return { geometry, along: Float32Array.from(along), root: points[0] ?? new Vector3 };
|
|
@@ -1113,20 +1460,24 @@ function swinger(made) {
|
|
|
1113
1460
|
made.geometry.computeVertexNormals();
|
|
1114
1461
|
};
|
|
1115
1462
|
}
|
|
1116
|
-
function cap(radius, front, back, grow, part = 0) {
|
|
1463
|
+
function cap(radius, front, back, grow, part = 0, partLift = 0.03) {
|
|
1117
1464
|
const rows = 18;
|
|
1118
1465
|
const columns = 56;
|
|
1119
1466
|
const positions = [];
|
|
1467
|
+
const along = [];
|
|
1120
1468
|
const indices = [];
|
|
1121
1469
|
for (let i = 0;i <= rows; i += 1) {
|
|
1122
1470
|
const s = i / rows;
|
|
1123
1471
|
for (let j = 0;j <= columns; j += 1) {
|
|
1124
1472
|
const phi = j / columns * Math.PI * 2;
|
|
1125
1473
|
const facing = (1 + Math.cos(phi - part)) / 2;
|
|
1126
|
-
const line = back + (front - back) * facing ** 1.
|
|
1127
|
-
const y = TOP + 0.
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1474
|
+
const line = back + (front - back) * facing ** 1.45;
|
|
1475
|
+
const y = TOP + 0.015 - s * (TOP + 0.015 - line);
|
|
1476
|
+
const dPart = Math.sin(phi - part);
|
|
1477
|
+
const lobe = Math.abs(dPart) * (1 - s * 0.65) * partLift;
|
|
1478
|
+
const p = onHead(radius, phi, y, grow * (0.78 + 0.32 * Math.sin(s * Math.PI * 0.72 + 0.25)) + lobe);
|
|
1479
|
+
positions.push(p.x, p.y + grow * 0.55 * (1 - s) + lobe * 0.65, p.z);
|
|
1480
|
+
along.push(s * 0.45);
|
|
1130
1481
|
}
|
|
1131
1482
|
}
|
|
1132
1483
|
for (let i = 0;i < rows; i += 1)
|
|
@@ -1137,6 +1488,7 @@ function cap(radius, front, back, grow, part = 0) {
|
|
|
1137
1488
|
}
|
|
1138
1489
|
const geometry = new BufferGeometry2;
|
|
1139
1490
|
geometry.setAttribute("position", new BufferAttribute2(new Float32Array(positions), 3));
|
|
1491
|
+
geometry.setAttribute("along", new BufferAttribute2(new Float32Array(along), 1));
|
|
1140
1492
|
geometry.setIndex(indices);
|
|
1141
1493
|
geometry.computeVertexNormals();
|
|
1142
1494
|
return geometry;
|
|
@@ -1145,59 +1497,81 @@ function add(b, p, made) {
|
|
|
1145
1497
|
b.add(made.geometry, p.color, {}, anime(p));
|
|
1146
1498
|
return made;
|
|
1147
1499
|
}
|
|
1148
|
-
function base(b, radius, p, front, back, grow, part = 0) {
|
|
1149
|
-
b.add(cap(radius, front, back, grow, part), p.color, {}, { ...anime(p), double: true });
|
|
1500
|
+
function base(b, radius, p, front, back, grow, part = 0, partLift = 0.036) {
|
|
1501
|
+
b.add(cap(radius, Math.min(front, 0.64), Math.min(back, 0.36), grow * 1.24, part, partLift), p.color, {}, { ...anime(p), double: true });
|
|
1150
1502
|
}
|
|
1151
1503
|
function fringe(b, radius, p, bangs, part = 0) {
|
|
1504
|
+
const wBoost = 1.2;
|
|
1505
|
+
const yShift = -0.04;
|
|
1152
1506
|
for (const bang of bangs) {
|
|
1153
1507
|
const sweep = bang.sweep ?? 0;
|
|
1154
|
-
const
|
|
1155
|
-
const
|
|
1156
|
-
const
|
|
1157
|
-
const
|
|
1158
|
-
const
|
|
1508
|
+
const mid = bang.midSweep ?? sweep * 0.48;
|
|
1509
|
+
const lift = bang.lift ?? 0;
|
|
1510
|
+
const flick = bang.flick ?? 0;
|
|
1511
|
+
const rootPhi = part + (bang.at - part) * 0.34;
|
|
1512
|
+
const root = onHead(radius, rootPhi, TOP - 0.01, 0.065 + lift * 0.4);
|
|
1513
|
+
const crest = onHead(radius, part + (bang.at - part) * 0.7 + mid * 0.28, 0.87, 0.14 + lift);
|
|
1514
|
+
const fall = onHead(radius, bang.at + mid, 0.7 + yShift * 0.5, 0.115 + lift * 0.85);
|
|
1515
|
+
const end = onHead(radius, bang.at + sweep, bang.length + yShift, 0.075 + lift * 0.45 + flick);
|
|
1516
|
+
const made = clump([root, crest, fall, end], bang.width * wBoost, bang.width * wBoost * 0.38, bang.blunt ? 0.56 : 1, bang.twist ?? sweep * 0.55);
|
|
1159
1517
|
add(b, p, made);
|
|
1160
1518
|
}
|
|
1161
1519
|
}
|
|
1162
|
-
function sidelocks(b, radius, p, end, width = 0.
|
|
1520
|
+
function sidelocks(b, radius, p, end, width = 0.09, {
|
|
1521
|
+
blunt = false,
|
|
1522
|
+
flick = 0,
|
|
1523
|
+
curlIn = 0.22
|
|
1524
|
+
} = {}) {
|
|
1163
1525
|
for (const side of [-1, 1]) {
|
|
1164
|
-
const skew = side > 0 ? 0.
|
|
1165
|
-
|
|
1166
|
-
[0.
|
|
1167
|
-
[1.
|
|
1168
|
-
|
|
1526
|
+
const skew = side > 0 ? 0.045 : -0.02;
|
|
1527
|
+
const layers = [
|
|
1528
|
+
[0.82, 0, width, 0.095],
|
|
1529
|
+
[1.04, 0.09, width * 0.88, 0.105],
|
|
1530
|
+
[0.7, 0.14, width * 0.46, 0.088]
|
|
1531
|
+
];
|
|
1532
|
+
for (const [phi, drop, w, out] of layers) {
|
|
1169
1533
|
const y = end + drop + skew;
|
|
1534
|
+
const endOut = blunt ? 0.075 : 0.078 + flick;
|
|
1170
1535
|
const path = [
|
|
1171
|
-
onHead(radius, side * (phi - 0.
|
|
1172
|
-
onHead(radius, side * phi, 0.
|
|
1173
|
-
onHead(radius, side * (phi + 0.
|
|
1174
|
-
onHead(radius, side * (phi - 0.
|
|
1175
|
-
onHead(radius, side * (phi - (blunt ? 0.
|
|
1536
|
+
onHead(radius, side * (phi - 0.28), TOP - 0.04, 0.055),
|
|
1537
|
+
onHead(radius, side * (phi + 0.04), 0.79, out + 0.02),
|
|
1538
|
+
onHead(radius, side * (phi + 0.06), 0.54, out),
|
|
1539
|
+
onHead(radius, side * (phi - (blunt ? 0.03 : curlIn * 0.5)), y + 0.12, out * 0.88 + flick * 0.35),
|
|
1540
|
+
onHead(radius, side * (phi - (blunt ? 0.04 : curlIn)), y, endOut)
|
|
1176
1541
|
];
|
|
1177
|
-
add(b, p, clump(path, w, w * 0.4, blunt ? 0.
|
|
1542
|
+
add(b, p, clump(path, w, w * 0.4, blunt ? 0.58 : 1, side * (blunt ? 0.2 : 0.55)));
|
|
1178
1543
|
}
|
|
1179
1544
|
}
|
|
1180
1545
|
}
|
|
1546
|
+
function crownTufts(b, radius, p, tufts) {
|
|
1547
|
+
for (const [phi, y, len, liftOut, w] of tufts) {
|
|
1548
|
+
const root = onHead(radius, phi, y, 0.05);
|
|
1549
|
+
const out = onHead(radius, phi, y, 1).sub(root).normalize();
|
|
1550
|
+
const mid = root.clone().addScaledVector(out, liftOut).add(new Vector3(Math.sin(phi + 0.6) * 0.05, len * 0.35, Math.cos(phi + 0.6) * 0.03));
|
|
1551
|
+
const tip = mid.clone().addScaledVector(out, liftOut * 0.85).add(new Vector3(Math.sin(phi + 1.1) * 0.08, -len * 0.45, Math.cos(phi + 1.1) * 0.05));
|
|
1552
|
+
add(b, p, clump([root, mid, tip], w, w * 0.42, 1, Math.sin(phi) * 0.5));
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1181
1555
|
function strays(b, radius, p, at) {
|
|
1182
1556
|
for (const [phi, y, length] of at) {
|
|
1183
|
-
const root = onHead(radius, phi, y, 0.
|
|
1557
|
+
const root = onHead(radius, phi, y, 0.075);
|
|
1184
1558
|
const out = onHead(radius, phi, y, 1).sub(root).normalize();
|
|
1185
1559
|
const path = [
|
|
1186
1560
|
root,
|
|
1187
|
-
root.clone().addScaledVector(out, 0.
|
|
1188
|
-
root.clone().addScaledVector(out, 0.
|
|
1561
|
+
root.clone().addScaledVector(out, 0.065).add(new Vector3(Math.cos(phi) * 0.025, -length * 0.35, 0)),
|
|
1562
|
+
root.clone().addScaledVector(out, 0.1).add(new Vector3(Math.sin(phi * 3.1) * 0.055, -length, Math.cos(phi * 2.3) * 0.03))
|
|
1189
1563
|
];
|
|
1190
|
-
add(b, p, clump(path, 0.
|
|
1564
|
+
add(b, p, clump(path, 0.028, 0.012, 1, 0.4));
|
|
1191
1565
|
}
|
|
1192
1566
|
}
|
|
1193
|
-
function ahoge(b, p, lean = 1) {
|
|
1194
|
-
const crown2 = new Vector3(0.02 * lean, TOP + 0.
|
|
1567
|
+
function ahoge(b, p, lean = 1, size = 1) {
|
|
1568
|
+
const crown2 = new Vector3(0.02 * lean, TOP + 0.035, -0.02);
|
|
1195
1569
|
const made = clump([
|
|
1196
1570
|
crown2,
|
|
1197
|
-
crown2.clone().add(new Vector3(0.
|
|
1198
|
-
crown2.clone().add(new Vector3(0.
|
|
1199
|
-
crown2.clone().add(new Vector3(0.
|
|
1200
|
-
], 0.
|
|
1571
|
+
crown2.clone().add(new Vector3(0.03 * lean * size, 0.13 * size, 0.03)),
|
|
1572
|
+
crown2.clone().add(new Vector3(0.09 * lean * size, 0.19 * size, 0.08)),
|
|
1573
|
+
crown2.clone().add(new Vector3(0.15 * lean * size, 0.14 * size, 0.11))
|
|
1574
|
+
], 0.038 * size, 0.016 * size);
|
|
1201
1575
|
add(b, p, made);
|
|
1202
1576
|
const swing = swinger(made);
|
|
1203
1577
|
const spring = new Spring(60, 3);
|
|
@@ -1211,34 +1585,37 @@ function back(b, radius, p, {
|
|
|
1211
1585
|
from,
|
|
1212
1586
|
end,
|
|
1213
1587
|
width,
|
|
1214
|
-
wave = 0.
|
|
1588
|
+
wave = 0.05,
|
|
1215
1589
|
curl = 0.08,
|
|
1590
|
+
flick = 0,
|
|
1216
1591
|
blunt = false,
|
|
1217
|
-
layers =
|
|
1592
|
+
layers = 2,
|
|
1593
|
+
spread = 0.08
|
|
1218
1594
|
}) {
|
|
1219
1595
|
const made = [];
|
|
1220
|
-
const step = (Math.PI * 2 - from * 2) / (count - 1);
|
|
1221
|
-
for (let
|
|
1222
|
-
const layer = Math.floor(n / count);
|
|
1223
|
-
const i = n % count;
|
|
1596
|
+
const step = (Math.PI * 2 - from * 2) / Math.max(1, count - 1);
|
|
1597
|
+
for (let layer = 0;layer < layers; layer += 1) {
|
|
1224
1598
|
const under = layer < layers - 1;
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1599
|
+
const nLocks = under ? Math.max(1, count - 1) : count;
|
|
1600
|
+
for (let i = 0;i < nLocks; i += 1) {
|
|
1601
|
+
const jitter = ((i * 17 + layer * 13) % 7 / 7 - 0.5) * 0.07;
|
|
1602
|
+
const phi = from + i * step + (under ? step / 2 : 0) + jitter;
|
|
1603
|
+
const vary = (i * 7 + layer * 3) % 5 / 5;
|
|
1604
|
+
const reach = blunt ? end : end + (under ? -0.05 : 0.06) - vary * (0.09 + Math.abs(flick) * 0.35);
|
|
1605
|
+
const steps = 6;
|
|
1606
|
+
const path = [onHead(radius, phi * 0.85, TOP - 0.015, 0.045)];
|
|
1607
|
+
for (let k = 1;k <= steps; k += 1) {
|
|
1608
|
+
const t = k / steps;
|
|
1609
|
+
const y = TOP - 0.04 - (TOP - 0.04 - reach) * t;
|
|
1610
|
+
const s = Math.sin(t * Math.PI * 1.65 + i * 0.85 + layer) * wave;
|
|
1611
|
+
const outFlick = t > 0.65 ? flick * ((t - 0.65) / 0.35) ** 1.4 : 0;
|
|
1612
|
+
const gap = spread + 0.06 * Math.sin(Math.min(1, t * 1.9) * Math.PI * 0.5) + t * 0.035 + outFlick - (under ? 0.022 : 0);
|
|
1613
|
+
const turn = t > 0.72 ? (phi < Math.PI ? -curl : curl) * ((t - 0.72) / 0.28) : 0;
|
|
1614
|
+
path.push(onHead(radius, phi + s + turn, y, gap));
|
|
1615
|
+
}
|
|
1616
|
+
const twist = (i % 3 === 0 ? 0.85 : i % 3 === 1 ? -0.55 : 0.25) * (blunt ? 0.25 : 1);
|
|
1617
|
+
made.push(add(b, p, clump(path, width * (0.86 + vary * 0.34) * (under ? 1.08 : 0.92), width * 0.38, blunt ? 0.56 : 1, twist)));
|
|
1618
|
+
}
|
|
1242
1619
|
}
|
|
1243
1620
|
return made;
|
|
1244
1621
|
}
|
|
@@ -1259,43 +1636,54 @@ var together = (...ticks) => (clock, delta, motion) => {
|
|
|
1259
1636
|
for (const tick of ticks)
|
|
1260
1637
|
tick?.(clock, delta, motion);
|
|
1261
1638
|
};
|
|
1262
|
-
function tail(radius, phi, tieY, length, spread, count =
|
|
1639
|
+
function tail(radius, phi, tieY, length, spread, count = 5) {
|
|
1263
1640
|
const paths = [];
|
|
1264
1641
|
for (let i = 0;i < count; i += 1) {
|
|
1265
1642
|
const k = i / Math.max(1, count - 1) - 0.5;
|
|
1266
1643
|
const fan = k * spread;
|
|
1267
|
-
const path = [onHead(radius, phi, tieY, 0.
|
|
1268
|
-
const steps =
|
|
1269
|
-
const reach = length * (1 - Math.abs(k) * 0.
|
|
1644
|
+
const path = [onHead(radius, phi, tieY, 0.06)];
|
|
1645
|
+
const steps = 7;
|
|
1646
|
+
const reach = length * (1 - Math.abs(k) * 0.2 + i * 3 % 3 * 0.05);
|
|
1270
1647
|
for (let n = 1;n <= steps; n += 1) {
|
|
1271
1648
|
const t = n / steps;
|
|
1272
|
-
const y = tieY + 0.
|
|
1273
|
-
const gap = 0.
|
|
1274
|
-
const s = Math.sin(t * Math.PI * 1.
|
|
1275
|
-
path.push(onHead(radius, phi + fan * (0.
|
|
1649
|
+
const y = tieY + 0.08 * Math.sin(t * Math.PI) - reach * t ** 1.18;
|
|
1650
|
+
const gap = 0.14 + 0.14 * Math.sin(Math.min(1, t * 1.8) * Math.PI * 0.5) + Math.abs(k) * 0.06 + t * 0.04;
|
|
1651
|
+
const s = Math.sin(t * Math.PI * 1.7 + i * 0.5) * 0.1;
|
|
1652
|
+
path.push(onHead(radius, phi + fan * (0.45 + t) + s * Math.sign(phi || 1), y, gap));
|
|
1276
1653
|
}
|
|
1277
1654
|
paths.push(path);
|
|
1278
1655
|
}
|
|
1279
1656
|
return paths;
|
|
1280
1657
|
}
|
|
1658
|
+
function ringlet(origin, length, spiralR, turns, dir) {
|
|
1659
|
+
const pts = [];
|
|
1660
|
+
const steps = 16;
|
|
1661
|
+
for (let k = 0;k <= steps; k += 1) {
|
|
1662
|
+
const t = k / steps;
|
|
1663
|
+
const a = t * turns * Math.PI * 2 * dir;
|
|
1664
|
+
const r = spiralR * (0.35 + 0.75 * Math.sin(t * Math.PI * 0.85));
|
|
1665
|
+
pts.push(new Vector3(origin.x + Math.cos(a) * r + dir * t * 0.08, origin.y - t * length, origin.z + Math.sin(a) * r + t * 0.04));
|
|
1666
|
+
}
|
|
1667
|
+
return pts;
|
|
1668
|
+
}
|
|
1281
1669
|
function ribbon(b, at, facing, color, size = 1) {
|
|
1282
1670
|
const node = b.node({ at: [at.x, at.y, at.z], rotate: [0, facing, 0], scale: [size, size, size] });
|
|
1283
|
-
const loop = new TorusGeometry2(0.
|
|
1671
|
+
const loop = new TorusGeometry2(0.052, 0.018, 10, 24);
|
|
1284
1672
|
for (const side of [-1, 1]) {
|
|
1285
1673
|
b.add(loop, color, {
|
|
1286
|
-
at: [side * 0.
|
|
1674
|
+
at: [side * 0.056, 0.008, 0],
|
|
1287
1675
|
rotate: [0, 0, side * 0.35],
|
|
1288
|
-
scale: [1.
|
|
1676
|
+
scale: [1.18, 0.74, 0.62],
|
|
1289
1677
|
parent: node
|
|
1290
1678
|
});
|
|
1291
1679
|
const end = clump([
|
|
1292
1680
|
new Vector3(side * 0.01, -0.01, 0.01),
|
|
1293
|
-
new Vector3(side * 0.
|
|
1294
|
-
new Vector3(side * 0.
|
|
1295
|
-
], 0.
|
|
1681
|
+
new Vector3(side * 0.038, -0.065, 0.014),
|
|
1682
|
+
new Vector3(side * 0.034, -0.13, 0.008)
|
|
1683
|
+
], 0.024, 0.006, 0.5);
|
|
1296
1684
|
b.add(end.geometry, color, { parent: node });
|
|
1297
1685
|
}
|
|
1298
|
-
b.add(new SphereGeometry2(0.
|
|
1686
|
+
b.add(new SphereGeometry2(0.026, 12, 10), color, { scale: [1, 1, 0.82], parent: node });
|
|
1299
1687
|
}
|
|
1300
1688
|
function clip(b, at, tilt, color) {
|
|
1301
1689
|
const node = b.node({ at: [at.x, at.y, at.z], rotate: [0, Math.atan2(at.x, at.z), tilt] });
|
|
@@ -1304,61 +1692,356 @@ function clip(b, at, tilt, color) {
|
|
|
1304
1692
|
b.add(bar, color, { rotate: [0, 0, -0.45], parent: node }, { sheen: 0.5 });
|
|
1305
1693
|
}
|
|
1306
1694
|
var HAIR = {
|
|
1307
|
-
"
|
|
1308
|
-
palette: { color: "#
|
|
1695
|
+
"wolf-cut": {
|
|
1696
|
+
palette: { color: "#1d1d2e", tip: "#565985", inner: "#11101d", ring: 0.95 },
|
|
1309
1697
|
build(b, radius, p) {
|
|
1310
|
-
base(b, radius, p, 0.
|
|
1311
|
-
|
|
1698
|
+
base(b, radius, p, 0.74, 0.42, 0.068, -0.18, 0.045);
|
|
1699
|
+
fringe(b, radius, p, [
|
|
1700
|
+
{
|
|
1701
|
+
at: -0.68,
|
|
1702
|
+
length: 0.46,
|
|
1703
|
+
width: 0.13,
|
|
1704
|
+
sweep: -0.22,
|
|
1705
|
+
midSweep: -0.06,
|
|
1706
|
+
lift: 0.01,
|
|
1707
|
+
flick: 0.02
|
|
1708
|
+
},
|
|
1709
|
+
{ at: -0.34, length: 0.54, width: 0.135, sweep: -0.18, midSweep: -0.05 },
|
|
1710
|
+
{ at: 0.08, length: 0.55, width: 0.14, sweep: 0.24, midSweep: 0.12 },
|
|
1711
|
+
{ at: 0.48, length: 0.52, width: 0.13, sweep: 0.28, midSweep: 0.12, lift: 0.01 },
|
|
1712
|
+
{ at: 0.74, length: 0.45, width: 0.12, sweep: 0.24, flick: 0.025 },
|
|
1713
|
+
{ at: -0.14, length: 0.5, width: 0.065, sweep: 0.22, midSweep: 0.08, lift: 0.028 },
|
|
1714
|
+
{ at: 0.24, length: 0.53, width: 0.058, sweep: -0.28, midSweep: -0.12, lift: 0.032 },
|
|
1715
|
+
{ at: -0.48, length: 0.58, width: 0.055, sweep: 0.16, lift: 0.024 }
|
|
1716
|
+
], -0.18);
|
|
1717
|
+
sidelocks(b, radius, p, 0.22, 0.095, { flick: 0.065, curlIn: 0.04 });
|
|
1718
|
+
const upper = back(b, radius, p, {
|
|
1719
|
+
count: 14,
|
|
1720
|
+
from: 1,
|
|
1721
|
+
end: 0.42,
|
|
1722
|
+
width: 0.15,
|
|
1723
|
+
wave: 0.06,
|
|
1724
|
+
flick: 0.11,
|
|
1725
|
+
layers: 1,
|
|
1726
|
+
spread: 0.1
|
|
1727
|
+
});
|
|
1728
|
+
const nape = back(b, radius, p, {
|
|
1729
|
+
count: 12,
|
|
1730
|
+
from: 1.22,
|
|
1731
|
+
end: 0.06,
|
|
1732
|
+
width: 0.125,
|
|
1733
|
+
wave: 0.08,
|
|
1734
|
+
flick: 0.16,
|
|
1735
|
+
layers: 2,
|
|
1736
|
+
spread: 0.08
|
|
1737
|
+
});
|
|
1738
|
+
crownTufts(b, radius, p, [
|
|
1739
|
+
[-0.45, TOP - 0.03, 0.22, 0.09, 0.075],
|
|
1740
|
+
[0.32, TOP - 0.02, 0.24, 0.1, 0.08],
|
|
1741
|
+
[1.35, TOP - 0.08, 0.26, 0.11, 0.085],
|
|
1742
|
+
[-1.55, TOP - 0.07, 0.25, 0.1, 0.08],
|
|
1743
|
+
[2.5, TOP - 0.06, 0.24, 0.11, 0.085],
|
|
1744
|
+
[-2.6, TOP - 0.05, 0.22, 0.09, 0.075]
|
|
1745
|
+
]);
|
|
1746
|
+
strays(b, radius, p, [
|
|
1747
|
+
[0.82, 0.72, 0.18],
|
|
1748
|
+
[-0.88, 0.74, 0.16],
|
|
1749
|
+
[1.75, 0.56, 0.2],
|
|
1750
|
+
[-1.9, 0.52, 0.18]
|
|
1751
|
+
]);
|
|
1752
|
+
return hangs([...upper, ...nape]);
|
|
1753
|
+
}
|
|
1754
|
+
},
|
|
1755
|
+
"curtain-ikemen": {
|
|
1756
|
+
palette: { color: "#281e2c", tip: "#6e4e60", inner: "#17101c", ring: 1.05 },
|
|
1757
|
+
build(b, radius, p) {
|
|
1758
|
+
base(b, radius, p, 0.76, 0.44, 0.065, 0.04, 0.048);
|
|
1759
|
+
fringe(b, radius, p, [
|
|
1760
|
+
{
|
|
1761
|
+
at: -0.14,
|
|
1762
|
+
length: 0.5,
|
|
1763
|
+
width: 0.13,
|
|
1764
|
+
sweep: -0.34,
|
|
1765
|
+
midSweep: -0.22,
|
|
1766
|
+
lift: 0.025,
|
|
1767
|
+
twist: -0.4
|
|
1768
|
+
},
|
|
1769
|
+
{ at: -0.44, length: 0.48, width: 0.14, sweep: -0.2, midSweep: -0.14, lift: 0.015 },
|
|
1770
|
+
{ at: -0.74, length: 0.42, width: 0.12, sweep: -0.1, flick: 0.02 },
|
|
1771
|
+
{
|
|
1772
|
+
at: 0.18,
|
|
1773
|
+
length: 0.52,
|
|
1774
|
+
width: 0.135,
|
|
1775
|
+
sweep: 0.32,
|
|
1776
|
+
midSweep: 0.2,
|
|
1777
|
+
lift: 0.025,
|
|
1778
|
+
twist: 0.4
|
|
1779
|
+
},
|
|
1780
|
+
{ at: 0.48, length: 0.48, width: 0.14, sweep: 0.22, midSweep: 0.14, lift: 0.015 },
|
|
1781
|
+
{ at: 0.76, length: 0.43, width: 0.12, sweep: 0.12, flick: 0.02 },
|
|
1782
|
+
{ at: -0.02, length: 0.56, width: 0.055, sweep: -0.18, midSweep: -0.28, lift: 0.036 },
|
|
1783
|
+
{ at: 0.09, length: 0.58, width: 0.05, sweep: 0.14, midSweep: 0.22, lift: 0.034 }
|
|
1784
|
+
], 0.04);
|
|
1785
|
+
sidelocks(b, radius, p, 0.3, 0.085, { flick: 0.03, curlIn: 0.12 });
|
|
1786
|
+
const locks = back(b, radius, p, {
|
|
1787
|
+
count: 15,
|
|
1788
|
+
from: 1.08,
|
|
1789
|
+
end: 0.28,
|
|
1790
|
+
width: 0.14,
|
|
1791
|
+
wave: 0.04,
|
|
1792
|
+
flick: 0.06,
|
|
1793
|
+
layers: 2,
|
|
1794
|
+
spread: 0.09
|
|
1795
|
+
});
|
|
1796
|
+
crownTufts(b, radius, p, [
|
|
1797
|
+
[-0.3, TOP - 0.02, 0.18, 0.08, 0.075],
|
|
1798
|
+
[0.36, TOP - 0.02, 0.19, 0.085, 0.075],
|
|
1799
|
+
[2.2, TOP - 0.06, 0.2, 0.08, 0.07]
|
|
1800
|
+
]);
|
|
1801
|
+
return hangs(locks);
|
|
1802
|
+
}
|
|
1803
|
+
},
|
|
1804
|
+
"messy-fluff": {
|
|
1805
|
+
palette: { color: "#e0e7f8", tip: "#9fb4f0", inner: "#8c9ac4", ring: 1 },
|
|
1806
|
+
build(b, radius, p) {
|
|
1807
|
+
base(b, radius, p, 0.74, 0.44, 0.075, -0.22, 0.05);
|
|
1808
|
+
fringe(b, radius, p, [
|
|
1809
|
+
{ at: -0.64, length: 0.52, width: 0.13, sweep: -0.16, lift: 0.015 },
|
|
1810
|
+
{ at: -0.34, length: 0.5, width: 0.135, sweep: 0.12, midSweep: -0.06, lift: 0.01 },
|
|
1811
|
+
{ at: -0.04, length: 0.53, width: 0.13, sweep: -0.18, midSweep: 0.04, lift: 0.02 },
|
|
1812
|
+
{ at: 0.28, length: 0.49, width: 0.14, sweep: 0.18, midSweep: 0.06, lift: 0.015 },
|
|
1813
|
+
{ at: 0.62, length: 0.52, width: 0.125, sweep: 0.22, lift: 0.015 },
|
|
1814
|
+
{
|
|
1815
|
+
at: -0.2,
|
|
1816
|
+
length: 0.47,
|
|
1817
|
+
width: 0.062,
|
|
1818
|
+
sweep: 0.26,
|
|
1819
|
+
midSweep: 0.1,
|
|
1820
|
+
lift: 0.038,
|
|
1821
|
+
flick: 0.02
|
|
1822
|
+
},
|
|
1823
|
+
{
|
|
1824
|
+
at: 0.18,
|
|
1825
|
+
length: 0.48,
|
|
1826
|
+
width: 0.06,
|
|
1827
|
+
sweep: -0.24,
|
|
1828
|
+
midSweep: -0.1,
|
|
1829
|
+
lift: 0.04,
|
|
1830
|
+
flick: 0.02
|
|
1831
|
+
},
|
|
1832
|
+
{ at: 0.52, length: 0.55, width: 0.055, sweep: -0.12, lift: 0.032 }
|
|
1833
|
+
], -0.22);
|
|
1834
|
+
sidelocks(b, radius, p, 0.34, 0.088, { flick: 0.07, curlIn: 0.02 });
|
|
1835
|
+
const locks = back(b, radius, p, {
|
|
1312
1836
|
count: 15,
|
|
1313
1837
|
from: 1,
|
|
1314
|
-
end: 0.
|
|
1315
|
-
width: 0.
|
|
1316
|
-
wave: 0.
|
|
1317
|
-
|
|
1318
|
-
layers: 2
|
|
1838
|
+
end: 0.3,
|
|
1839
|
+
width: 0.15,
|
|
1840
|
+
wave: 0.055,
|
|
1841
|
+
flick: 0.13,
|
|
1842
|
+
layers: 2,
|
|
1843
|
+
spread: 0.1
|
|
1319
1844
|
});
|
|
1845
|
+
crownTufts(b, radius, p, [
|
|
1846
|
+
[-0.65, TOP - 0.03, 0.24, 0.11, 0.085],
|
|
1847
|
+
[-0.08, TOP - 0.01, 0.26, 0.12, 0.085],
|
|
1848
|
+
[0.52, TOP - 0.02, 0.25, 0.11, 0.085],
|
|
1849
|
+
[1.25, TOP - 0.06, 0.26, 0.12, 0.09],
|
|
1850
|
+
[-1.35, TOP - 0.06, 0.25, 0.11, 0.085],
|
|
1851
|
+
[2.3, TOP - 0.05, 0.26, 0.11, 0.085],
|
|
1852
|
+
[-2.4, TOP - 0.05, 0.24, 0.1, 0.08]
|
|
1853
|
+
]);
|
|
1854
|
+
return together(ahoge(b, p, 1, 1.1), hangs(locks));
|
|
1855
|
+
}
|
|
1856
|
+
},
|
|
1857
|
+
"silky-layers": {
|
|
1858
|
+
palette: { color: "#f2cfb4", tip: "#ff9ec8", inner: "#b87a86", ring: 1.1 },
|
|
1859
|
+
build(b, radius, p) {
|
|
1860
|
+
base(b, radius, p, 0.72, 0.4, 0.065, 0.22, 0.042);
|
|
1320
1861
|
fringe(b, radius, p, [
|
|
1321
|
-
{ at: -0.
|
|
1322
|
-
{ at: -0.36, length: 0.
|
|
1323
|
-
{ at: -0.
|
|
1324
|
-
{ at: 0.
|
|
1325
|
-
{ at: 0.
|
|
1326
|
-
{ at: 0.
|
|
1862
|
+
{ at: -0.68, length: 0.44, width: 0.12, sweep: -0.14, lift: 0.01 },
|
|
1863
|
+
{ at: -0.36, length: 0.56, width: 0.1, sweep: -0.06, lift: 0.008 },
|
|
1864
|
+
{ at: -0.06, length: 0.57, width: 0.085, sweep: 0.08, lift: 0.015 },
|
|
1865
|
+
{ at: 0.22, length: 0.55, width: 0.095, sweep: 0.1, lift: 0.01 },
|
|
1866
|
+
{ at: 0.52, length: 0.52, width: 0.11, sweep: 0.16, lift: 0.012 },
|
|
1867
|
+
{ at: 0.74, length: 0.42, width: 0.115, sweep: 0.14, lift: 0.01 },
|
|
1868
|
+
{ at: -0.22, length: 0.53, width: 0.048, sweep: 0.12, lift: 0.028 },
|
|
1869
|
+
{ at: 0.1, length: 0.52, width: 0.046, sweep: -0.14, lift: 0.03 }
|
|
1870
|
+
], 0.22);
|
|
1871
|
+
sidelocks(b, radius, p, -0.08, 0.1, { curlIn: 0.24, flick: 0.02 });
|
|
1872
|
+
const midLayer = back(b, radius, p, {
|
|
1873
|
+
count: 14,
|
|
1874
|
+
from: 1.05,
|
|
1875
|
+
end: 0.18,
|
|
1876
|
+
width: 0.15,
|
|
1877
|
+
wave: 0.06,
|
|
1878
|
+
flick: 0.07,
|
|
1879
|
+
layers: 1,
|
|
1880
|
+
spread: 0.1
|
|
1881
|
+
});
|
|
1882
|
+
const longFlow = back(b, radius, p, {
|
|
1883
|
+
count: 16,
|
|
1884
|
+
from: 1.12,
|
|
1885
|
+
end: -0.95,
|
|
1886
|
+
width: 0.16,
|
|
1887
|
+
wave: 0.09,
|
|
1888
|
+
curl: 0.14,
|
|
1889
|
+
layers: 2,
|
|
1890
|
+
spread: 0.09
|
|
1891
|
+
});
|
|
1892
|
+
strays(b, radius, p, [
|
|
1893
|
+
[0.78, 0.68, 0.2],
|
|
1894
|
+
[-0.82, 0.65, 0.22],
|
|
1895
|
+
[1.6, 0.45, 0.22],
|
|
1896
|
+
[-1.7, 0.4, 0.2]
|
|
1327
1897
|
]);
|
|
1328
|
-
|
|
1898
|
+
clip(b, onHead(radius, 0.62, 0.82, 0.12), -0.35, "#ff7eb8");
|
|
1899
|
+
return together(ahoge(b, p, -1, 0.9), hangs([...midLayer, ...longFlow]));
|
|
1900
|
+
}
|
|
1901
|
+
},
|
|
1902
|
+
"ojou-curls": {
|
|
1903
|
+
palette: { color: "#eca8dc", tip: "#b596ff", inner: "#9e5c9c", ring: 1.15 },
|
|
1904
|
+
build(b, radius, p) {
|
|
1905
|
+
base(b, radius, p, 0.72, 0.4, 0.065, -0.2, 0.044);
|
|
1906
|
+
fringe(b, radius, p, [
|
|
1907
|
+
{ at: -0.64, length: 0.5, width: 0.125, sweep: -0.14, lift: 0.01 },
|
|
1908
|
+
{ at: -0.34, length: 0.55, width: 0.12, sweep: -0.08 },
|
|
1909
|
+
{ at: -0.02, length: 0.54, width: 0.115, sweep: 0.12, lift: 0.014 },
|
|
1910
|
+
{ at: 0.3, length: 0.55, width: 0.12, sweep: 0.16 },
|
|
1911
|
+
{ at: 0.62, length: 0.5, width: 0.12, sweep: 0.18, lift: 0.01 },
|
|
1912
|
+
{ at: 0.14, length: 0.51, width: 0.052, sweep: -0.16, lift: 0.028 }
|
|
1913
|
+
], -0.2);
|
|
1914
|
+
sidelocks(b, radius, p, 0.14, 0.09, { curlIn: 0.26 });
|
|
1915
|
+
const backLocks = back(b, radius, p, {
|
|
1916
|
+
count: 15,
|
|
1917
|
+
from: 1.15,
|
|
1918
|
+
end: -0.22,
|
|
1919
|
+
width: 0.15,
|
|
1920
|
+
wave: 0.08,
|
|
1921
|
+
curl: 0.16,
|
|
1922
|
+
layers: 2,
|
|
1923
|
+
spread: 0.09
|
|
1924
|
+
});
|
|
1925
|
+
const curls = [];
|
|
1926
|
+
for (const side of [-1, 1]) {
|
|
1927
|
+
const origin = onHead(radius, side * 1.18, 0.58, 0.12);
|
|
1928
|
+
curls.push(add(b, p, clump(ringlet(origin, 0.92, 0.095, 2.3, side), 0.1, 0.062, 1, side * 1.2)));
|
|
1929
|
+
curls.push(add(b, p, clump(ringlet(origin.clone().add(new Vector3(side * 0.04, -0.04, -0.06)), 0.78, 0.08, 2, -side), 0.075, 0.045, 1, -side * 0.9)));
|
|
1930
|
+
}
|
|
1931
|
+
ribbon(b, onHead(radius, Math.PI, 0.84, 0.12), Math.PI, "#ffffff", 1.55);
|
|
1932
|
+
return together(ahoge(b, p, 1, 0.85), hangs([...backLocks, ...curls]));
|
|
1933
|
+
}
|
|
1934
|
+
},
|
|
1935
|
+
"side-braid": {
|
|
1936
|
+
palette: { color: "#a45e3d", tip: "#f4c27c", inner: "#663628", ring: 1.05 },
|
|
1937
|
+
build(b, radius, p) {
|
|
1938
|
+
base(b, radius, p, 0.72, 0.42, 0.064, 0.26, 0.042);
|
|
1939
|
+
fringe(b, radius, p, [
|
|
1940
|
+
{ at: -0.62, length: 0.48, width: 0.12, sweep: -0.14 },
|
|
1941
|
+
{ at: -0.32, length: 0.54, width: 0.125, sweep: -0.16, lift: 0.01 },
|
|
1942
|
+
{ at: 0, length: 0.55, width: 0.12, sweep: -0.18, lift: 0.016 },
|
|
1943
|
+
{ at: 0.34, length: 0.56, width: 0.115, sweep: 0.18 },
|
|
1944
|
+
{ at: 0.64, length: 0.5, width: 0.115, sweep: 0.22 },
|
|
1945
|
+
{ at: 0.15, length: 0.52, width: 0.052, sweep: -0.22, lift: 0.03 }
|
|
1946
|
+
], 0.26);
|
|
1947
|
+
sidelocks(b, radius, p, 0.16, 0.085, { curlIn: 0.24 });
|
|
1948
|
+
const backLocks = back(b, radius, p, {
|
|
1949
|
+
count: 13,
|
|
1950
|
+
from: 1.2,
|
|
1951
|
+
end: 0.32,
|
|
1952
|
+
width: 0.14,
|
|
1953
|
+
wave: 0.04,
|
|
1954
|
+
curl: 0.14,
|
|
1955
|
+
layers: 2,
|
|
1956
|
+
spread: 0.08
|
|
1957
|
+
});
|
|
1958
|
+
const braidGroup = b.node();
|
|
1959
|
+
const segments = 9;
|
|
1960
|
+
const plaitGeo = new SphereGeometry2(0.085, 14, 12);
|
|
1961
|
+
for (let k = 0;k < segments; k += 1) {
|
|
1962
|
+
const t = k / (segments - 1);
|
|
1963
|
+
const phi = 1.65 - t * 0.85;
|
|
1964
|
+
const y = 0.54 - t * 0.92;
|
|
1965
|
+
const out = 0.11 + t * 0.09;
|
|
1966
|
+
const pos = onHead(radius, phi, Math.max(0.05, y), out);
|
|
1967
|
+
const sideOff = (k % 2 ? 1 : -1) * 0.034;
|
|
1968
|
+
const scale = 1.05 - t * 0.42;
|
|
1969
|
+
b.add(plaitGeo, p.color, {
|
|
1970
|
+
at: [pos.x + sideOff * 0.7, y, pos.z + sideOff * 0.5],
|
|
1971
|
+
rotate: [0.3, phi, (k % 2 ? 1 : -1) * 0.45],
|
|
1972
|
+
scale: [scale * 1.1, scale * 0.78, scale * 0.85],
|
|
1973
|
+
parent: braidGroup
|
|
1974
|
+
}, anime(p, 0.7));
|
|
1975
|
+
}
|
|
1976
|
+
const tiePos = onHead(radius, 0.82, 0.08, 0.2);
|
|
1977
|
+
tiePos.y = -0.34;
|
|
1978
|
+
ribbon(b, tiePos, 0.6, "#ff789e", 1.15);
|
|
1979
|
+
const braidTip = add(b, p, clump([
|
|
1980
|
+
tiePos.clone(),
|
|
1981
|
+
tiePos.clone().add(new Vector3(0.02, -0.16, 0.04)),
|
|
1982
|
+
tiePos.clone().add(new Vector3(-0.02, -0.3, 0.06))
|
|
1983
|
+
], 0.085, 0.045, 1, 0.4));
|
|
1984
|
+
return together(ahoge(b, p, -1, 0.85), hangs([...backLocks, braidTip]));
|
|
1985
|
+
}
|
|
1986
|
+
},
|
|
1987
|
+
"fluffy-bob": {
|
|
1988
|
+
palette: { color: "#8a5236", tip: "#eab07c", inner: "#5a323e" },
|
|
1989
|
+
build(b, radius, p) {
|
|
1990
|
+
base(b, radius, p, 0.71, 0.38, 0.066, -0.12, 0.04);
|
|
1991
|
+
const made = back(b, radius, p, {
|
|
1992
|
+
count: 16,
|
|
1993
|
+
from: 0.96,
|
|
1994
|
+
end: 0.28,
|
|
1995
|
+
width: 0.15,
|
|
1996
|
+
wave: 0.03,
|
|
1997
|
+
curl: 0.22,
|
|
1998
|
+
layers: 2,
|
|
1999
|
+
spread: 0.095
|
|
2000
|
+
});
|
|
2001
|
+
fringe(b, radius, p, [
|
|
2002
|
+
{ at: -0.64, length: 0.54, width: 0.12, sweep: -0.14, lift: 0.01 },
|
|
2003
|
+
{ at: -0.34, length: 0.54, width: 0.135, sweep: -0.05 },
|
|
2004
|
+
{ at: -0.04, length: 0.57, width: 0.125, sweep: 0.08, lift: 0.012 },
|
|
2005
|
+
{ at: 0.26, length: 0.53, width: 0.135, sweep: 0.1 },
|
|
2006
|
+
{ at: 0.58, length: 0.54, width: 0.12, sweep: 0.16, lift: 0.01 },
|
|
2007
|
+
{ at: -0.18, length: 0.52, width: 0.055, sweep: 0.16, lift: 0.028 },
|
|
2008
|
+
{ at: 0.14, length: 0.52, width: 0.05, sweep: -0.12, lift: 0.03 }
|
|
2009
|
+
], -0.12);
|
|
2010
|
+
sidelocks(b, radius, p, 0.2, 0.095, { curlIn: 0.26 });
|
|
1329
2011
|
strays(b, radius, p, [
|
|
1330
|
-
[0.
|
|
1331
|
-
[-1.5, 0.
|
|
1332
|
-
[2.
|
|
2012
|
+
[0.64, 0.84, 0.14],
|
|
2013
|
+
[-1.5, 0.78, 0.16],
|
|
2014
|
+
[2.3, 0.8, 0.14]
|
|
1333
2015
|
]);
|
|
1334
|
-
clip(b, onHead(radius, 0.
|
|
2016
|
+
clip(b, onHead(radius, 0.58, 0.78, 0.12), -0.4, "#ffd84d");
|
|
1335
2017
|
return together(ahoge(b, p), hangs(made));
|
|
1336
2018
|
}
|
|
1337
2019
|
},
|
|
1338
2020
|
"twin-tails": {
|
|
1339
2021
|
palette: { color: "#ff86b8", tip: "#b38cff", inner: "#d65a98" },
|
|
1340
2022
|
build(b, radius, p) {
|
|
1341
|
-
base(b, radius, p, 0.72, 0.44, 0.
|
|
2023
|
+
base(b, radius, p, 0.72, 0.44, 0.062, 0, 0.038);
|
|
1342
2024
|
fringe(b, radius, p, [
|
|
1343
|
-
{ at: -0.
|
|
1344
|
-
{ at: -0.
|
|
1345
|
-
{ at: 0, length: 0.
|
|
1346
|
-
{ at: 0.
|
|
1347
|
-
{ at: 0.
|
|
2025
|
+
{ at: -0.6, length: 0.54, width: 0.12, sweep: -0.12, lift: 0.01 },
|
|
2026
|
+
{ at: -0.3, length: 0.55, width: 0.13, sweep: -0.04 },
|
|
2027
|
+
{ at: 0.02, length: 0.57, width: 0.12, sweep: 0.06, lift: 0.012 },
|
|
2028
|
+
{ at: 0.32, length: 0.54, width: 0.13, sweep: 0.09 },
|
|
2029
|
+
{ at: 0.62, length: 0.55, width: 0.115, sweep: 0.14, lift: 0.01 },
|
|
2030
|
+
{ at: -0.14, length: 0.52, width: 0.052, sweep: 0.14, lift: 0.028 }
|
|
1348
2031
|
]);
|
|
1349
|
-
sidelocks(b, radius, p, 0.
|
|
1350
|
-
back(b, radius, p, { count:
|
|
2032
|
+
sidelocks(b, radius, p, 0.24, 0.082, { curlIn: 0.24 });
|
|
2033
|
+
back(b, radius, p, { count: 12, from: 1.4, end: 0.46, width: 0.14, wave: 0.02, layers: 2 });
|
|
1351
2034
|
const tails = [];
|
|
1352
2035
|
for (const side of [-1, 1]) {
|
|
1353
2036
|
const tieY = TOP - 0.1;
|
|
1354
|
-
const tie = onHead(radius, side * 1.
|
|
1355
|
-
for (const path of tail(radius, side * 1.
|
|
1356
|
-
tails.push(add(b, p, clump(path, 0.
|
|
1357
|
-
ribbon(b, tie.add(new Vector3(0, 0.02, 0.02)), side * 1.
|
|
2037
|
+
const tie = onHead(radius, side * 1.28, tieY, 0.085);
|
|
2038
|
+
for (const path of tail(radius, side * 1.28, tieY, 1.15, 0.38, 6))
|
|
2039
|
+
tails.push(add(b, p, clump(path, 0.135, 0.058, 1, side * 0.75)));
|
|
2040
|
+
ribbon(b, tie.add(new Vector3(0, 0.02, 0.02)), side * 1.28, "#5bc8ff", 1.75);
|
|
1358
2041
|
}
|
|
1359
2042
|
strays(b, radius, p, [
|
|
1360
|
-
[0.75, 0.
|
|
1361
|
-
[-0.8, 0.
|
|
2043
|
+
[0.75, 0.82, 0.13],
|
|
2044
|
+
[-0.8, 0.81, 0.15]
|
|
1362
2045
|
]);
|
|
1363
2046
|
return together(ahoge(b, p, -1), hangs(tails));
|
|
1364
2047
|
}
|
|
@@ -1366,33 +2049,34 @@ var HAIR = {
|
|
|
1366
2049
|
"spiky-hero": {
|
|
1367
2050
|
palette: { color: "#f6c945", tip: "#ff8a3d", inner: "#b07b1e" },
|
|
1368
2051
|
build(b, radius, p) {
|
|
1369
|
-
base(b, radius, p, 0.74, 0.
|
|
2052
|
+
base(b, radius, p, 0.74, 0.48, 0.06, 0, 0.035);
|
|
1370
2053
|
const spikes = [
|
|
1371
|
-
[0, TOP - 0.
|
|
1372
|
-
[0.
|
|
1373
|
-
[-0.
|
|
1374
|
-
[1.
|
|
1375
|
-
[-1.
|
|
1376
|
-
[1.
|
|
1377
|
-
[-1.
|
|
1378
|
-
[2.
|
|
1379
|
-
[-2.
|
|
1380
|
-
[Math.PI, 0.
|
|
2054
|
+
[0, TOP - 0.03, 0.3, 0.62],
|
|
2055
|
+
[0.52, TOP - 0.05, 0.28, 0.52],
|
|
2056
|
+
[-0.52, TOP - 0.05, 0.28, 0.52],
|
|
2057
|
+
[1.15, 0.8, 0.27, 0.36],
|
|
2058
|
+
[-1.15, 0.8, 0.27, 0.36],
|
|
2059
|
+
[1.85, 0.78, 0.25, 0.26],
|
|
2060
|
+
[-1.85, 0.78, 0.25, 0.26],
|
|
2061
|
+
[2.45, 0.78, 0.26, 0.3],
|
|
2062
|
+
[-2.45, 0.78, 0.26, 0.3],
|
|
2063
|
+
[Math.PI, 0.8, 0.27, 0.36],
|
|
1381
2064
|
[2.9, TOP - 0.05, 0.3, 0.55],
|
|
1382
2065
|
[-2.9, TOP - 0.05, 0.3, 0.55]
|
|
1383
2066
|
];
|
|
1384
2067
|
for (const [phi, y, reach, up] of spikes) {
|
|
1385
|
-
const length = reach * 1.
|
|
1386
|
-
const root = onHead(radius, phi, y, 0.
|
|
2068
|
+
const length = reach * 1.48;
|
|
2069
|
+
const root = onHead(radius, phi, y, 0.03);
|
|
1387
2070
|
const out = onHead(radius, phi, y, 1).sub(root).normalize();
|
|
1388
2071
|
const tip = root.clone().addScaledVector(out, length * (1 - up)).addScaledVector(UP, length * up).add(new Vector3(0, 0, -length * 0.2));
|
|
1389
|
-
const mid = root.clone().lerp(tip, 0.45).addScaledVector(out, 0.
|
|
1390
|
-
add(b, p, clump([root, mid, tip], 0.
|
|
2072
|
+
const mid = root.clone().lerp(tip, 0.45).addScaledVector(out, 0.035);
|
|
2073
|
+
add(b, p, clump([root, mid, tip], 0.15, 0.075));
|
|
1391
2074
|
}
|
|
1392
2075
|
fringe(b, radius, p, [
|
|
1393
|
-
{ at: -0.
|
|
1394
|
-
{ at: 0.
|
|
1395
|
-
{ at: 0.
|
|
2076
|
+
{ at: -0.52, length: 0.56, width: 0.125, sweep: -0.14 },
|
|
2077
|
+
{ at: -0.16, length: 0.54, width: 0.135, sweep: -0.06, lift: 0.015 },
|
|
2078
|
+
{ at: 0.18, length: 0.53, width: 0.135, sweep: 0.08, lift: 0.015 },
|
|
2079
|
+
{ at: 0.52, length: 0.56, width: 0.12, sweep: 0.14 }
|
|
1396
2080
|
]);
|
|
1397
2081
|
return;
|
|
1398
2082
|
}
|
|
@@ -1400,7 +2084,7 @@ var HAIR = {
|
|
|
1400
2084
|
afro: {
|
|
1401
2085
|
palette: { color: "#3a271b", tip: "#8a5a38", inner: "#24170f", ring: 0.45 },
|
|
1402
2086
|
build(b, radius, p) {
|
|
1403
|
-
base(b, radius, p, 0.74, 0.4, 0.
|
|
2087
|
+
base(b, radius, p, 0.74, 0.4, 0.055);
|
|
1404
2088
|
const puff = new SphereGeometry2(1, 18, 14);
|
|
1405
2089
|
for (let i = 0;i < 46; i += 1) {
|
|
1406
2090
|
const phi = i * 2.399963;
|
|
@@ -1416,68 +2100,87 @@ var HAIR = {
|
|
|
1416
2100
|
}
|
|
1417
2101
|
},
|
|
1418
2102
|
"swoosh-quiff": {
|
|
1419
|
-
palette: { color: "#5b3a86", tip: "#
|
|
2103
|
+
palette: { color: "#5b3a86", tip: "#b698f0", inner: "#372058" },
|
|
1420
2104
|
build(b, radius, p) {
|
|
1421
|
-
base(b, radius, p, 0.
|
|
1422
|
-
back(b, radius, p, {
|
|
2105
|
+
base(b, radius, p, 0.73, 0.42, 0.065, -0.42, 0.045);
|
|
2106
|
+
const locks = back(b, radius, p, {
|
|
2107
|
+
count: 14,
|
|
2108
|
+
from: 1.1,
|
|
2109
|
+
end: 0.38,
|
|
2110
|
+
width: 0.135,
|
|
2111
|
+
wave: 0.03,
|
|
2112
|
+
flick: 0.06,
|
|
2113
|
+
layers: 2,
|
|
2114
|
+
spread: 0.085
|
|
2115
|
+
});
|
|
1423
2116
|
fringe(b, radius, p, [
|
|
1424
|
-
{ at: -0.
|
|
1425
|
-
{ at: -0.
|
|
1426
|
-
{ at: -0.
|
|
1427
|
-
{ at: 0.
|
|
1428
|
-
|
|
1429
|
-
|
|
2117
|
+
{ at: -0.6, length: 0.56, width: 0.13, sweep: 0.42, midSweep: 0.2, lift: 0.015 },
|
|
2118
|
+
{ at: -0.32, length: 0.53, width: 0.145, sweep: 0.54, midSweep: 0.28, lift: 0.025 },
|
|
2119
|
+
{ at: -0.02, length: 0.52, width: 0.14, sweep: 0.56, midSweep: 0.3, lift: 0.02 },
|
|
2120
|
+
{ at: 0.28, length: 0.54, width: 0.125, sweep: 0.48, midSweep: 0.24, lift: 0.015 },
|
|
2121
|
+
{ at: -0.15, length: 0.55, width: 0.058, sweep: 0.36, lift: 0.038 }
|
|
2122
|
+
], -0.42);
|
|
2123
|
+
sidelocks(b, radius, p, 0.32, 0.08, { flick: 0.04, curlIn: 0.08 });
|
|
2124
|
+
crownTufts(b, radius, p, [
|
|
2125
|
+
[-0.35, TOP - 0.02, 0.2, 0.09, 0.08],
|
|
2126
|
+
[0.45, TOP - 0.03, 0.2, 0.09, 0.075]
|
|
2127
|
+
]);
|
|
2128
|
+
return together(ahoge(b, p, -1), hangs(locks));
|
|
1430
2129
|
}
|
|
1431
2130
|
},
|
|
1432
2131
|
"long-waves": {
|
|
1433
2132
|
palette: { color: "#c25b30", tip: "#ffbf86", inner: "#7a2f2a" },
|
|
1434
2133
|
build(b, radius, p) {
|
|
1435
|
-
base(b, radius, p, 0.
|
|
2134
|
+
base(b, radius, p, 0.71, 0.4, 0.065, 0.28, 0.042);
|
|
1436
2135
|
fringe(b, radius, p, [
|
|
1437
|
-
{ at: -0.
|
|
1438
|
-
{ at: -0.
|
|
1439
|
-
{ at: 0.06, length: 0.
|
|
1440
|
-
{ at: 0.
|
|
1441
|
-
|
|
1442
|
-
|
|
2136
|
+
{ at: -0.58, length: 0.52, width: 0.12, sweep: -0.12 },
|
|
2137
|
+
{ at: -0.26, length: 0.54, width: 0.135, sweep: -0.16, lift: 0.012 },
|
|
2138
|
+
{ at: 0.06, length: 0.55, width: 0.125, sweep: -0.18, lift: 0.016 },
|
|
2139
|
+
{ at: 0.38, length: 0.55, width: 0.12, sweep: 0.12 },
|
|
2140
|
+
{ at: 0.64, length: 0.5, width: 0.11, sweep: 0.16 },
|
|
2141
|
+
{ at: -0.1, length: 0.51, width: 0.052, sweep: -0.2, lift: 0.03 }
|
|
2142
|
+
], 0.28);
|
|
2143
|
+
sidelocks(b, radius, p, -0.02, 0.095, { curlIn: 0.22 });
|
|
1443
2144
|
const locks = back(b, radius, p, {
|
|
1444
|
-
count:
|
|
1445
|
-
from: 1.
|
|
1446
|
-
end: 0.
|
|
1447
|
-
width: 0.
|
|
1448
|
-
wave: 0.
|
|
1449
|
-
curl: 0.
|
|
1450
|
-
layers: 2
|
|
2145
|
+
count: 17,
|
|
2146
|
+
from: 1.12,
|
|
2147
|
+
end: -0.35,
|
|
2148
|
+
width: 0.15,
|
|
2149
|
+
wave: 0.085,
|
|
2150
|
+
curl: 0.14,
|
|
2151
|
+
layers: 2,
|
|
2152
|
+
spread: 0.09
|
|
1451
2153
|
});
|
|
1452
2154
|
strays(b, radius, p, [
|
|
1453
|
-
[1.3, 0.
|
|
1454
|
-
[-2.
|
|
2155
|
+
[1.3, 0.68, 0.18],
|
|
2156
|
+
[-2.1, 0.58, 0.2]
|
|
1455
2157
|
]);
|
|
1456
|
-
ribbon(b, onHead(radius, -0.95, 0.86, 0.
|
|
2158
|
+
ribbon(b, onHead(radius, -0.95, 0.86, 0.115), -0.95, "#ffffff", 0.95);
|
|
1457
2159
|
return hangs(locks);
|
|
1458
2160
|
}
|
|
1459
2161
|
},
|
|
1460
2162
|
ponytail: {
|
|
1461
2163
|
palette: { color: "#f0c96a", tip: "#fff1c2", inner: "#b98a3a" },
|
|
1462
2164
|
build(b, radius, p) {
|
|
1463
|
-
base(b, radius, p, 0.72, 0.
|
|
2165
|
+
base(b, radius, p, 0.72, 0.52, 0.06, 0.18, 0.036);
|
|
1464
2166
|
fringe(b, radius, p, [
|
|
1465
|
-
{ at: -0.
|
|
1466
|
-
{ at: -0.
|
|
1467
|
-
{ at: 0.16, length: 0.
|
|
1468
|
-
{ at: 0.
|
|
1469
|
-
|
|
1470
|
-
|
|
2167
|
+
{ at: -0.5, length: 0.54, width: 0.12, sweep: 0.12 },
|
|
2168
|
+
{ at: -0.18, length: 0.55, width: 0.13, sweep: 0.2, lift: 0.014 },
|
|
2169
|
+
{ at: 0.16, length: 0.54, width: 0.125, sweep: 0.24, lift: 0.012 },
|
|
2170
|
+
{ at: 0.48, length: 0.56, width: 0.11, sweep: 0.24 },
|
|
2171
|
+
{ at: -0.02, length: 0.51, width: 0.05, sweep: 0.28, lift: 0.03 }
|
|
2172
|
+
], 0.18);
|
|
2173
|
+
sidelocks(b, radius, p, 0.24, 0.075, { curlIn: 0.24 });
|
|
1471
2174
|
const tieY = TOP + 0.01;
|
|
1472
|
-
const locks = tail(radius, Math.PI, tieY,
|
|
1473
|
-
ribbon(b, onHead(radius, Math.PI, tieY, 0.
|
|
2175
|
+
const locks = tail(radius, Math.PI, tieY, 1.05, 0.44, 6).map((path, i) => add(b, p, clump(path, 0.135, 0.055, 1, (i % 2 ? 1 : -1) * 0.7)));
|
|
2176
|
+
ribbon(b, onHead(radius, Math.PI, tieY, 0.095), Math.PI, "#e2574c", 1.25);
|
|
1474
2177
|
return together(ahoge(b, p), hangs(locks));
|
|
1475
2178
|
}
|
|
1476
2179
|
},
|
|
1477
2180
|
mohawk: {
|
|
1478
2181
|
palette: { color: "#1fae8f", tip: "#a6f5dd", inner: "#127160" },
|
|
1479
2182
|
build(b, radius, p) {
|
|
1480
|
-
base(b, radius, { color: "#2a2440", tip: "#3a3260", inner: "#1d1830", ring: 0.25 }, 0.72, 0.4, 0.
|
|
2183
|
+
base(b, radius, { color: "#2a2440", tip: "#3a3260", inner: "#1d1830", ring: 0.25 }, 0.72, 0.4, 0.016);
|
|
1481
2184
|
for (let i = 0;i < 8; i += 1) {
|
|
1482
2185
|
const s = i / 7;
|
|
1483
2186
|
const phi = s < 0.45 ? 0 : Math.PI;
|
|
@@ -1486,7 +2189,7 @@ var HAIR = {
|
|
|
1486
2189
|
root.x = 0;
|
|
1487
2190
|
const tip = root.clone().add(new Vector3(0, 0.22 - Math.abs(s - 0.4) * 0.14, 0)).add(new Vector3(0, 0, -0.08 - s * 0.05));
|
|
1488
2191
|
const mid = root.clone().lerp(tip, 0.5).add(new Vector3(0, 0.02, 0.02));
|
|
1489
|
-
add(b, p, clump([root, mid, tip], 0.
|
|
2192
|
+
add(b, p, clump([root, mid, tip], 0.032, 0.095));
|
|
1490
2193
|
}
|
|
1491
2194
|
return;
|
|
1492
2195
|
}
|
|
@@ -1494,64 +2197,69 @@ var HAIR = {
|
|
|
1494
2197
|
"space-buns": {
|
|
1495
2198
|
palette: { color: "#b9a6ff", tip: "#ffc2ec", inner: "#7d6ad1" },
|
|
1496
2199
|
build(b, radius, p) {
|
|
1497
|
-
base(b, radius, p, 0.72, 0.42, 0.
|
|
2200
|
+
base(b, radius, p, 0.72, 0.42, 0.06, 0, 0.036);
|
|
1498
2201
|
fringe(b, radius, p, [
|
|
1499
|
-
{ at: -0.
|
|
1500
|
-
{ at: -0.
|
|
1501
|
-
{ at: 0.04, length: 0.
|
|
1502
|
-
{ at: 0.
|
|
1503
|
-
{ at: 0.
|
|
2202
|
+
{ at: -0.56, length: 0.54, width: 0.12 },
|
|
2203
|
+
{ at: -0.26, length: 0.55, width: 0.125, sweep: -0.05 },
|
|
2204
|
+
{ at: 0.04, length: 0.56, width: 0.125, sweep: 0.05, lift: 0.012 },
|
|
2205
|
+
{ at: 0.34, length: 0.54, width: 0.12, sweep: 0.08 },
|
|
2206
|
+
{ at: 0.6, length: 0.55, width: 0.11, sweep: 0.1 },
|
|
2207
|
+
{ at: -0.1, length: 0.52, width: 0.05, sweep: 0.12, lift: 0.028 }
|
|
1504
2208
|
]);
|
|
1505
|
-
sidelocks(b, radius, p, 0.
|
|
2209
|
+
sidelocks(b, radius, p, 0.22, 0.072, { curlIn: 0.24 });
|
|
1506
2210
|
const tufts = [];
|
|
1507
2211
|
for (const side of [-1, 1]) {
|
|
1508
|
-
const at = onHead(radius, side * 0.9, TOP - 0.08, 0.
|
|
2212
|
+
const at = onHead(radius, side * 0.9, TOP - 0.08, 0.11).add(new Vector3(0, 0.05, 0));
|
|
1509
2213
|
const coil = [];
|
|
1510
2214
|
for (let k = 0;k <= 14; k += 1) {
|
|
1511
2215
|
const a = k * 0.9;
|
|
1512
|
-
const r = 0.
|
|
2216
|
+
const r = 0.115 - k * 0.004;
|
|
1513
2217
|
coil.push(new Vector3(at.x + Math.cos(a) * r, at.y + (k / 14 - 0.5) * 0.12, at.z + Math.sin(a) * r));
|
|
1514
2218
|
}
|
|
1515
|
-
b.add(new SphereGeometry2(0.
|
|
1516
|
-
add(b, p, clump(coil, 0.
|
|
1517
|
-
ribbon(b, at.clone().add(new Vector3(0, -0.07, 0.06)), side * 0.9, "#ffd84d", 0.
|
|
1518
|
-
for (const path of tail(radius, side * 1.05, TOP - 0.16, 0.
|
|
1519
|
-
tufts.push(add(b, p, clump(path, 0.
|
|
2219
|
+
b.add(new SphereGeometry2(0.105, 20, 16), p.color, { at: [at.x, at.y, at.z] }, { anime: { center: [at.x, at.y, at.z], ring: 0.8, tip: p.tip, inner: p.inner } });
|
|
2220
|
+
add(b, p, clump(coil, 0.065, 0.038, 0.7));
|
|
2221
|
+
ribbon(b, at.clone().add(new Vector3(0, -0.07, 0.06)), side * 0.9, "#ffd84d", 0.88);
|
|
2222
|
+
for (const path of tail(radius, side * 1.05, TOP - 0.16, 0.48, 0.24, 3))
|
|
2223
|
+
tufts.push(add(b, p, clump(path, 0.085, 0.034)));
|
|
1520
2224
|
}
|
|
1521
2225
|
return hangs(tufts);
|
|
1522
2226
|
}
|
|
1523
2227
|
},
|
|
1524
2228
|
"hime-cut": {
|
|
1525
|
-
palette: { color: "#
|
|
2229
|
+
palette: { color: "#262348", tip: "#7d68de", inner: "#16142e", ring: 1.1 },
|
|
1526
2230
|
build(b, radius, p) {
|
|
1527
|
-
base(b, radius, p, 0.72, 0.42, 0.
|
|
2231
|
+
base(b, radius, p, 0.72, 0.42, 0.065, 0, 0.036);
|
|
1528
2232
|
fringe(b, radius, p, [
|
|
1529
|
-
{ at: -0.
|
|
1530
|
-
{ at: -0.
|
|
1531
|
-
{ at: -0.12, length: 0.
|
|
1532
|
-
{ at: 0.12, length: 0.
|
|
1533
|
-
{ at: 0.
|
|
1534
|
-
{ at: 0.
|
|
2233
|
+
{ at: -0.62, length: 0.56, width: 0.125, blunt: true },
|
|
2234
|
+
{ at: -0.37, length: 0.55, width: 0.135, blunt: true },
|
|
2235
|
+
{ at: -0.12, length: 0.545, width: 0.135, blunt: true },
|
|
2236
|
+
{ at: 0.12, length: 0.545, width: 0.135, blunt: true },
|
|
2237
|
+
{ at: 0.37, length: 0.55, width: 0.135, blunt: true },
|
|
2238
|
+
{ at: 0.62, length: 0.56, width: 0.125, blunt: true },
|
|
2239
|
+
{ at: 0.24, length: 0.53, width: 0.042, sweep: 0.06, lift: 0.022 }
|
|
1535
2240
|
]);
|
|
1536
|
-
sidelocks(b, radius, p, 0.
|
|
2241
|
+
sidelocks(b, radius, p, 0.24, 0.1, { blunt: true });
|
|
1537
2242
|
const locks = back(b, radius, p, {
|
|
1538
2243
|
count: 18,
|
|
1539
|
-
from: 1.
|
|
1540
|
-
end: 0.
|
|
1541
|
-
width: 0.
|
|
1542
|
-
wave: 0.
|
|
2244
|
+
from: 1.24,
|
|
2245
|
+
end: -0.3,
|
|
2246
|
+
width: 0.145,
|
|
2247
|
+
wave: 0.015,
|
|
1543
2248
|
curl: 0,
|
|
1544
2249
|
blunt: true,
|
|
1545
|
-
layers: 2
|
|
2250
|
+
layers: 2,
|
|
2251
|
+
spread: 0.085
|
|
1546
2252
|
});
|
|
1547
|
-
ribbon(b, onHead(radius, Math.PI, TOP - 0.02, 0.
|
|
2253
|
+
ribbon(b, onHead(radius, Math.PI, TOP - 0.02, 0.09), Math.PI, "#e8475f", 1.35);
|
|
1548
2254
|
return hangs(locks);
|
|
1549
2255
|
}
|
|
1550
2256
|
}
|
|
1551
2257
|
};
|
|
1552
2258
|
function buildHair(key, kit) {
|
|
1553
2259
|
const style = HAIR[key];
|
|
1554
|
-
|
|
2260
|
+
const palette = resolvePalette(style.palette, kit.hairColor);
|
|
2261
|
+
const headR = kit.isFigure ? (y) => y < 0.08 ? Math.max(0.32, kit.radiusAt(0.22)) : kit.radiusAt(y) : kit.radiusAt;
|
|
2262
|
+
return piece(kit, (b) => style.build(b, headR, palette));
|
|
1555
2263
|
}
|
|
1556
2264
|
|
|
1557
2265
|
// src/dress.ts
|
|
@@ -1611,20 +2319,17 @@ uniform vec3 color;
|
|
|
1611
2319
|
uniform vec3 backColor;
|
|
1612
2320
|
uniform float sheen;
|
|
1613
2321
|
void main() {
|
|
1614
|
-
// An open shell (a skirt, a cape) is seen from inside too: its back faces light as front ones,
|
|
1615
|
-
// in their own colour when it has a lining.
|
|
1616
2322
|
vec3 n = normalize(vNormal) * (gl_FrontFacing ? 1.0 : -1.0);
|
|
1617
2323
|
vec3 toLight = normalize(vec3(-0.35, 0.75, 0.55));
|
|
1618
2324
|
float light = dot(n, toLight);
|
|
1619
|
-
float band = light > 0.
|
|
2325
|
+
float band = light > 0.18 ? 1.0 : light > -0.28 ? 0.84 : 0.68;
|
|
1620
2326
|
vec3 tint = gl_FrontFacing ? color : backColor;
|
|
1621
2327
|
vec3 base = useMap > 0.5 ? texture2D(map, vUv).rgb * tint : tint;
|
|
1622
2328
|
vec3 lit = base * band;
|
|
1623
|
-
// Satin and metal: one hard highlight band, still a cartoon, never a smooth gradient.
|
|
1624
2329
|
float glint = pow(max(dot(n, normalize(toLight + vec3(0.0, 0.0, 1.0))), 0.0), 36.0);
|
|
1625
2330
|
if (sheen > 0.0 && glint > 0.45) lit = mix(lit, vec3(1.0), sheen);
|
|
1626
2331
|
float rim = 1.0 - max(n.z, 0.0);
|
|
1627
|
-
if (rim > 0.82 && n.y > -0.2) lit = mix(lit, vec3(1.0), 0.
|
|
2332
|
+
if (rim > 0.82 && n.y > -0.2) lit = mix(lit, vec3(1.0), 0.3);
|
|
1628
2333
|
gl_FragColor = vec4(lit, 1.0);
|
|
1629
2334
|
#include <colorspace_fragment>
|
|
1630
2335
|
}`;
|
|
@@ -1640,10 +2345,9 @@ void main() {
|
|
|
1640
2345
|
vec3 dome = normalize(position - center);
|
|
1641
2346
|
vec3 real = length(normal) > 0.001 ? normalize(normal) : dome;
|
|
1642
2347
|
vNormal = normalize(normalMatrix * real);
|
|
1643
|
-
vDome = normalize(normalMatrix * normalize(mix(real, dome, 0.
|
|
2348
|
+
vDome = normalize(normalMatrix * normalize(mix(real, dome, 0.74)));
|
|
1644
2349
|
vDir = dome;
|
|
1645
2350
|
vAlong = along;
|
|
1646
|
-
// The side of a lock that faces the skull: the underside of a ribbon, seen where it twists.
|
|
1647
2351
|
vInward = dot(real, dome);
|
|
1648
2352
|
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
1649
2353
|
}`;
|
|
@@ -1659,45 +2363,50 @@ varying float vAlong;
|
|
|
1659
2363
|
varying float vInward;
|
|
1660
2364
|
void main() {
|
|
1661
2365
|
vec3 n = normalize(vDome) * (gl_FrontFacing ? 1.0 : -1.0);
|
|
1662
|
-
vec3 toLight = normalize(vec3(-0.
|
|
2366
|
+
vec3 toLight = normalize(vec3(-0.32, 0.78, 0.54));
|
|
1663
2367
|
float light = dot(n, toLight);
|
|
1664
|
-
//
|
|
1665
|
-
float
|
|
1666
|
-
|
|
1667
|
-
base = mix(
|
|
1668
|
-
|
|
1669
|
-
vec3
|
|
1670
|
-
vec3
|
|
1671
|
-
|
|
1672
|
-
//
|
|
1673
|
-
if (light <= 0.
|
|
1674
|
-
//
|
|
2368
|
+
// Root ambient occlusion + smooth ombre toward translucent-feeling tips + underside colour.
|
|
2369
|
+
float rootShade = mix(0.88, 1.0, smoothstep(0.0, 0.22, vAlong));
|
|
2370
|
+
float toTip = smoothstep(0.38, 1.0, vAlong);
|
|
2371
|
+
vec3 base = mix(color * rootShade, tip, toTip);
|
|
2372
|
+
base = mix(base, inner, smoothstep(-0.18, -0.58, vInward));
|
|
2373
|
+
vec3 shadow = base * vec3(0.74, 0.67, 0.88);
|
|
2374
|
+
vec3 deep = base * vec3(0.52, 0.46, 0.72);
|
|
2375
|
+
vec3 lit = light > 0.14 ? base : light > -0.34 ? shadow : deep;
|
|
2376
|
+
// Subtle light bounce through shaded tips
|
|
2377
|
+
if (light <= 0.14) lit = mix(lit, tip, 0.34 * toTip);
|
|
2378
|
+
// Organic broken glossy anime highlight band (smooth double-wave, NOT harsh sawtooth!)
|
|
1675
2379
|
float around = atan(vDir.x, vDir.z);
|
|
1676
|
-
float
|
|
1677
|
-
float
|
|
1678
|
-
float
|
|
1679
|
-
float
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
2380
|
+
float wave = sin(around * 3.0 + 0.4) * 0.032 + sin(around * 7.0 - 0.8) * 0.014;
|
|
2381
|
+
float breakMask = smoothstep(-0.18, 0.25, sin(around * 5.0 + 1.1) + 0.35 * cos(around * 9.0));
|
|
2382
|
+
float centre = 0.56 + wave;
|
|
2383
|
+
float bandDist = abs(vDir.y - centre);
|
|
2384
|
+
float primary = (1.0 - smoothstep(0.022, 0.048, bandDist)) * breakMask;
|
|
2385
|
+
float secondary = (1.0 - smoothstep(0.008, 0.022, abs(vDir.y - (centre + 0.07)))) * (1.0 - breakMask * 0.5) * 0.55;
|
|
2386
|
+
float facingLit = smoothstep(-0.1, 0.25, n.z) * smoothstep(-0.15, 0.2, light) * (1.0 - toTip * 0.8);
|
|
2387
|
+
vec3 shine = mix(base, vec3(1.0, 0.98, 1.0), 0.44);
|
|
2388
|
+
lit = mix(lit, shine, clamp(primary + secondary, 0.0, 1.0) * facingLit * ring * 0.85);
|
|
2389
|
+
// Thin soft-cut rim separating hair silhouette from background
|
|
1683
2390
|
float rim = 1.0 - max(normalize(vNormal).z, 0.0);
|
|
1684
|
-
if (rim > 0.
|
|
2391
|
+
if (rim > 0.85 && n.y > -0.05) lit = mix(lit, mix(tip, vec3(1.0), 0.55), 0.28);
|
|
1685
2392
|
gl_FragColor = vec4(lit, 1.0);
|
|
1686
2393
|
#include <colorspace_fragment>
|
|
1687
2394
|
}`;
|
|
1688
|
-
function taperedHose(curve, muscle) {
|
|
1689
|
-
const segments =
|
|
1690
|
-
const radial =
|
|
1691
|
-
const tube = new TubeGeometry(curve, segments,
|
|
2395
|
+
function taperedHose(curve, muscle, baseRadius = 0.046) {
|
|
2396
|
+
const segments = 24;
|
|
2397
|
+
const radial = 14;
|
|
2398
|
+
const tube = new TubeGeometry(curve, segments, baseRadius, radial);
|
|
1692
2399
|
const position = tube.attributes.position;
|
|
1693
2400
|
const centre = new Vector32;
|
|
2401
|
+
const strength = Math.max(0, muscle - 1);
|
|
2402
|
+
const slim = muscle < 1 ? 0.72 + 0.28 * muscle : 1;
|
|
1694
2403
|
for (let i = 0;i <= segments; i += 1) {
|
|
1695
2404
|
const t = i / segments;
|
|
1696
2405
|
curve.getPointAt(t, centre);
|
|
1697
|
-
const
|
|
1698
|
-
const biceps = 1 + strength *
|
|
1699
|
-
const forearm = 1 + strength * 0.
|
|
1700
|
-
const k = (1.12 - 0.
|
|
2406
|
+
const deltoid = 1 + strength * 0.65 * Math.exp(-(((t - 0.06) / 0.17) ** 2));
|
|
2407
|
+
const biceps = 1 + strength * 0.78 * Math.exp(-(((t - 0.34) / 0.21) ** 2));
|
|
2408
|
+
const forearm = 1 + strength * 0.48 * Math.exp(-(((t - 0.7) / 0.19) ** 2));
|
|
2409
|
+
const k = (1.12 - 0.38 * t) * slim * deltoid * biceps * forearm;
|
|
1701
2410
|
for (let j = 0;j <= radial; j += 1) {
|
|
1702
2411
|
const v = i * (radial + 1) + j;
|
|
1703
2412
|
position.setXYZ(v, centre.x + (position.getX(v) - centre.x) * k, centre.y + (position.getY(v) - centre.y) * k, centre.z + (position.getZ(v) - centre.z) * k);
|
|
@@ -1706,6 +2415,29 @@ function taperedHose(curve, muscle) {
|
|
|
1706
2415
|
tube.computeVertexNormals();
|
|
1707
2416
|
return tube;
|
|
1708
2417
|
}
|
|
2418
|
+
function sculptedLeg(curve, hips, muscle) {
|
|
2419
|
+
const segments = 24;
|
|
2420
|
+
const radial = 14;
|
|
2421
|
+
const tube = new TubeGeometry(curve, segments, 0.095, radial);
|
|
2422
|
+
const position = tube.attributes.position;
|
|
2423
|
+
const centre = new Vector32;
|
|
2424
|
+
const thighScale = 0.88 + Math.max(0, hips - 0.85) * 0.52 + Math.max(0, muscle - 1) * 0.36;
|
|
2425
|
+
const calfScale = 0.78 + Math.max(0, muscle - 1) * 0.34 + Math.max(0, hips - 1) * 0.14;
|
|
2426
|
+
for (let i = 0;i <= segments; i += 1) {
|
|
2427
|
+
const t = i / segments;
|
|
2428
|
+
curve.getPointAt(t, centre);
|
|
2429
|
+
const upper = thighScale * Math.exp(-(((t - 0.1) / 0.32) ** 2));
|
|
2430
|
+
const calf = calfScale * 0.26 * Math.exp(-(((t - 0.65) / 0.18) ** 2));
|
|
2431
|
+
const base2 = 0.96 - 0.56 * t;
|
|
2432
|
+
const k = Math.max(0.36, base2 * (0.48 + 0.62 * upper) + calf * 0.4);
|
|
2433
|
+
for (let j = 0;j <= radial; j += 1) {
|
|
2434
|
+
const v = i * (radial + 1) + j;
|
|
2435
|
+
position.setXYZ(v, centre.x + (position.getX(v) - centre.x) * k, centre.y + (position.getY(v) - centre.y) * k, centre.z + (position.getZ(v) - centre.z) * k * 1.05);
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
tube.computeVertexNormals();
|
|
2439
|
+
return tube;
|
|
2440
|
+
}
|
|
1709
2441
|
function toon(options) {
|
|
1710
2442
|
if (options.anime)
|
|
1711
2443
|
return new ShaderMaterial({
|
|
@@ -1755,17 +2487,27 @@ void main() {
|
|
|
1755
2487
|
}`
|
|
1756
2488
|
});
|
|
1757
2489
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
2490
|
+
function hexChannels(hex) {
|
|
2491
|
+
const bare = hex.startsWith("#") ? hex.slice(1) : hex;
|
|
2492
|
+
const full = bare.length === 3 || bare.length === 4 ? `${bare[0]}${bare[0]}${bare[1]}${bare[1]}${bare[2]}${bare[2]}` : bare.length === 6 || bare.length === 8 ? bare.slice(0, 6) : "";
|
|
2493
|
+
if (!/^[0-9a-f]{6}$/i.test(full))
|
|
2494
|
+
return [0, 0, 0];
|
|
2495
|
+
return [
|
|
2496
|
+
Number.parseInt(full.slice(0, 2), 16),
|
|
2497
|
+
Number.parseInt(full.slice(2, 4), 16),
|
|
2498
|
+
Number.parseInt(full.slice(4, 6), 16)
|
|
2499
|
+
];
|
|
2500
|
+
}
|
|
2501
|
+
var shade = (hex, toward, amount) => `#${hexChannels(hex).map((value) => Math.max(0, Math.min(255, Math.round(value + (toward - value) * amount))).toString(16).padStart(2, "0")).join("")}`;
|
|
2502
|
+
function paintBody(canvas, color, face, skin, faceType, isFigure = false) {
|
|
1761
2503
|
const ctx = canvas.getContext("2d");
|
|
1762
2504
|
if (!ctx)
|
|
1763
2505
|
return;
|
|
1764
2506
|
const px = canvas.width / BODY_WIDTH;
|
|
1765
2507
|
const base2 = color;
|
|
1766
|
-
const light = shade(color, 255, 0.
|
|
1767
|
-
const belly = shade(color, 255, 0.62);
|
|
1768
|
-
const dark = shade(color, 0, 0.
|
|
2508
|
+
const light = shade(color, 255, 0.25);
|
|
2509
|
+
const belly = isFigure ? shade(color, 255, 0.1) : shade(color, 255, 0.62);
|
|
2510
|
+
const dark = shade(color, 0, 0.2);
|
|
1769
2511
|
const palette = {
|
|
1770
2512
|
...SKIN_PALETTE,
|
|
1771
2513
|
B: color,
|
|
@@ -1774,24 +2516,29 @@ function paintBody(canvas, color, face, skin, faceType) {
|
|
|
1774
2516
|
};
|
|
1775
2517
|
for (let y = 0;y < BODY_HEIGHT; y += 1) {
|
|
1776
2518
|
for (let x = 0;x < BODY_WIDTH; x += 1) {
|
|
1777
|
-
const drawn = skin?.body[y]?.[x];
|
|
2519
|
+
const drawn = !isFigure ? skin?.body[y]?.[x] : undefined;
|
|
1778
2520
|
if (drawn) {
|
|
1779
2521
|
ctx.fillStyle = palette[drawn] ?? color;
|
|
1780
2522
|
ctx.fillRect(x * px, y * px, px, px);
|
|
1781
2523
|
continue;
|
|
1782
2524
|
}
|
|
1783
2525
|
let fill = base2;
|
|
1784
|
-
if (
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
2526
|
+
if (isFigure) {
|
|
2527
|
+
if (x >= 30 && x <= 35)
|
|
2528
|
+
fill = shade(color, 0, 0.08);
|
|
2529
|
+
} else {
|
|
2530
|
+
if (y >= 16)
|
|
2531
|
+
fill = belly;
|
|
2532
|
+
else if (y === 15)
|
|
2533
|
+
fill = light;
|
|
2534
|
+
else if (x >= 29 && x <= 35)
|
|
2535
|
+
fill = dark;
|
|
2536
|
+
}
|
|
1790
2537
|
ctx.fillStyle = fill;
|
|
1791
2538
|
ctx.fillRect(x * px, y * px, px, px);
|
|
1792
2539
|
}
|
|
1793
2540
|
}
|
|
1794
|
-
if (!skin) {
|
|
2541
|
+
if (!skin && !isFigure) {
|
|
1795
2542
|
ctx.fillStyle = shade(color, 255, 0.8);
|
|
1796
2543
|
for (const [x, y] of [
|
|
1797
2544
|
[19, 4],
|
|
@@ -1802,9 +2549,10 @@ function paintBody(canvas, color, face, skin, faceType) {
|
|
|
1802
2549
|
])
|
|
1803
2550
|
ctx.fillRect(x * px, y * px, px, px);
|
|
1804
2551
|
}
|
|
1805
|
-
|
|
2552
|
+
const resolvedFaceType = skin?.faceType ?? faceType;
|
|
2553
|
+
if (isHighResFace(resolvedFaceType))
|
|
1806
2554
|
return;
|
|
1807
|
-
const stamp = stampFor(face,
|
|
2555
|
+
const stamp = stampFor(face, resolvedFaceType ?? "dot");
|
|
1808
2556
|
stamp.forEach((row, dy) => {
|
|
1809
2557
|
for (let dx = 0;dx < row.length; dx += 1) {
|
|
1810
2558
|
const key = row[dx] ?? ".";
|
|
@@ -1816,9 +2564,10 @@ function paintBody(canvas, color, face, skin, faceType) {
|
|
|
1816
2564
|
}
|
|
1817
2565
|
});
|
|
1818
2566
|
}
|
|
1819
|
-
function animeDecal(faceType, face, eyeColor) {
|
|
1820
|
-
if (faceType
|
|
2567
|
+
function animeDecal(faceType, face, eyeColor, isFigure = false) {
|
|
2568
|
+
if (!isHighResFace(faceType))
|
|
1821
2569
|
return null;
|
|
2570
|
+
const style = faceType;
|
|
1822
2571
|
const canvas = document.createElement("canvas");
|
|
1823
2572
|
canvas.width = ANIME_FACE_SIZE.width;
|
|
1824
2573
|
canvas.height = ANIME_FACE_SIZE.height;
|
|
@@ -1826,7 +2575,7 @@ function animeDecal(faceType, face, eyeColor) {
|
|
|
1826
2575
|
const map = new CanvasTexture2(canvas);
|
|
1827
2576
|
map.colorSpace = SRGBColorSpace2;
|
|
1828
2577
|
map.anisotropy = 4;
|
|
1829
|
-
const { u0, u1, v0, v1 } = ANIME_FACE_UV;
|
|
2578
|
+
const { u0, u1, v0, v1 } = isFigure ? ANIME_FACE_UV : { u0: 0.07, u1: 0.43, v0: 0.37, v1: 0.7 };
|
|
1830
2579
|
map.repeat.set(1 / (u1 - u0), 1 / (v1 - v0));
|
|
1831
2580
|
map.offset.set(-u0 / (u1 - u0), -v0 / (v1 - v0));
|
|
1832
2581
|
const material = new MeshBasicMaterial2({
|
|
@@ -1839,71 +2588,159 @@ function animeDecal(faceType, face, eyeColor) {
|
|
|
1839
2588
|
const draw = (next) => {
|
|
1840
2589
|
if (!ctx)
|
|
1841
2590
|
return;
|
|
1842
|
-
drawAnimeFace(ctx, next, eyeColor);
|
|
2591
|
+
drawAnimeFace(ctx, next, eyeColor, style);
|
|
1843
2592
|
map.needsUpdate = true;
|
|
1844
2593
|
};
|
|
1845
2594
|
draw(face);
|
|
1846
2595
|
return { material, draw };
|
|
1847
2596
|
}
|
|
2597
|
+
var OUTFIT_LEG_COLOR = {
|
|
2598
|
+
"street-jacket": "#1a1a28",
|
|
2599
|
+
"blazer-coat": "#1e2542",
|
|
2600
|
+
tuxedo: "#181529",
|
|
2601
|
+
"brawler-vest": "#2c253b",
|
|
2602
|
+
"martial-gi": "#ede9e0",
|
|
2603
|
+
"chibi-overalls": "#5b8ff9"
|
|
2604
|
+
};
|
|
1848
2605
|
var inkHull = null;
|
|
1849
2606
|
var neonHull = null;
|
|
1850
2607
|
var fineHull = null;
|
|
2608
|
+
var hairHull = null;
|
|
2609
|
+
var figureHull = null;
|
|
1851
2610
|
function createPlup(options = {}) {
|
|
1852
2611
|
inkHull ??= hull("#14102e", 0.022);
|
|
2612
|
+
figureHull ??= hull("#1b1438", 0.013);
|
|
1853
2613
|
neonHull ??= hull("#b9a6ff", 0.04);
|
|
1854
|
-
fineHull ??= hull("#
|
|
2614
|
+
fineHull ??= hull("#191233", 0.007);
|
|
2615
|
+
hairHull ??= hull("#1c1433", 0.0045);
|
|
1855
2616
|
const fine = fineHull;
|
|
1856
2617
|
const ink = inkHull;
|
|
1857
2618
|
const neon = neonHull;
|
|
2619
|
+
const figureInk = figureHull;
|
|
2620
|
+
const hairInk = hairHull;
|
|
1858
2621
|
let color = options.color ?? "#3d7bff";
|
|
1859
2622
|
let face = options.face ?? "smug";
|
|
1860
2623
|
const skin = options.skin ?? null;
|
|
1861
2624
|
const shape = BODY_SHAPES[options.shape ?? "plup"] ?? BODY_SHAPES.plup;
|
|
1862
2625
|
const fit = plupProportions(shape, options.bodyScale);
|
|
1863
2626
|
const build = clampPlupBody(options.body);
|
|
1864
|
-
const
|
|
1865
|
-
const
|
|
2627
|
+
const isFigure = build.figure >= 0.5;
|
|
2628
|
+
const silhouette = {
|
|
2629
|
+
shoulders: build.shoulders,
|
|
2630
|
+
waist: build.waist,
|
|
2631
|
+
hips: build.hips,
|
|
2632
|
+
bust: build.bust,
|
|
2633
|
+
muscle: build.muscle,
|
|
2634
|
+
figure: build.figure
|
|
2635
|
+
};
|
|
2636
|
+
const legRaise = isFigure ? 0.28 + 0.16 * (build.legLength - 1) : 0.16 * (build.legLength - 1);
|
|
1866
2637
|
const canvas = document.createElement("canvas");
|
|
1867
2638
|
canvas.width = BODY_WIDTH * 4;
|
|
1868
2639
|
canvas.height = BODY_HEIGHT * 4;
|
|
1869
|
-
paintBody(canvas, color, face, skin, options.faceType);
|
|
2640
|
+
paintBody(canvas, color, face, skin, options.faceType, isFigure);
|
|
1870
2641
|
const texture = new CanvasTexture2(canvas);
|
|
1871
2642
|
pixelArtFiltering(texture);
|
|
1872
2643
|
texture.colorSpace = SRGBColorSpace2;
|
|
1873
2644
|
texture.wrapS = RepeatWrapping2;
|
|
1874
2645
|
texture.offset.x = (FACE_COLUMN + 4) / BODY_WIDTH - 0.25;
|
|
1875
|
-
const anime2 = animeDecal(skin?.faceType ?? options.faceType, face, options.eyeColor);
|
|
2646
|
+
const anime2 = animeDecal(skin?.faceType ?? options.faceType, face, options.eyeColor, isFigure);
|
|
1876
2647
|
const bodyMaterial = toon({ map: texture });
|
|
1877
|
-
const
|
|
1878
|
-
const
|
|
2648
|
+
const torsoMaterial = toon({ color });
|
|
2649
|
+
const limbMaterial = toon({ color: isFigure ? shade(color, 0, 0.05) : shade(color, 0, 0.12) });
|
|
2650
|
+
const legMaterial = toon({ color: isFigure ? shade(color, 0, 0.05) : shade(color, 0, 0.12) });
|
|
2651
|
+
const tipMaterial = toon({ color: isFigure ? shade(color, 0, 0.12) : shade(color, 0, 0.3) });
|
|
2652
|
+
const shoeMaterial = toon({ color: "#221a3a", sheen: 0.35 });
|
|
1879
2653
|
const root = new Group2;
|
|
1880
2654
|
const lifted = new Group2;
|
|
1881
2655
|
root.add(lifted);
|
|
1882
|
-
const
|
|
2656
|
+
const headMetrics = figureHeadMetrics(build.headSize);
|
|
2657
|
+
const geometry = isFigure ? buildFigureHeadGeometry() : buildBlobGeometry(silhouette);
|
|
2658
|
+
const torsoGeometry = isFigure ? buildFigureTorsoGeometry(silhouette) : null;
|
|
2659
|
+
const headGroup = new Group2;
|
|
1883
2660
|
if (!options.model) {
|
|
1884
|
-
|
|
1885
|
-
|
|
1886
|
-
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
const
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
2661
|
+
if (isFigure && torsoGeometry) {
|
|
2662
|
+
const torsoMesh = new Mesh2(torsoGeometry, torsoMaterial);
|
|
2663
|
+
const torsoInk = new Mesh2(torsoGeometry, figureInk);
|
|
2664
|
+
lifted.add(torsoMesh, torsoInk);
|
|
2665
|
+
headGroup.position.set(0, headMetrics.originY, 0);
|
|
2666
|
+
headGroup.scale.setScalar(headMetrics.scale);
|
|
2667
|
+
const headMesh = new Mesh2(geometry, bodyMaterial);
|
|
2668
|
+
const headInk = new Mesh2(geometry, figureInk);
|
|
2669
|
+
headGroup.add(headMesh, headInk);
|
|
2670
|
+
if (anime2) {
|
|
2671
|
+
const decal = new Mesh2(geometry, anime2.material);
|
|
2672
|
+
decal.scale.setScalar(1.008);
|
|
2673
|
+
decal.renderOrder = 1;
|
|
2674
|
+
headGroup.add(decal);
|
|
2675
|
+
}
|
|
2676
|
+
lifted.add(headGroup);
|
|
2677
|
+
} else {
|
|
2678
|
+
const bodyMesh = new Mesh2(geometry, bodyMaterial);
|
|
2679
|
+
const blobMeshes = [bodyMesh, new Mesh2(geometry, ink), new Mesh2(geometry, neon)];
|
|
2680
|
+
for (const mesh of blobMeshes)
|
|
2681
|
+
mesh.scale.set(fit.girth / shape.x, clampBodyScale(options.bodyScale).head, fit.girth / shape.x);
|
|
2682
|
+
lifted.add(...blobMeshes);
|
|
2683
|
+
if (anime2) {
|
|
2684
|
+
const decal = new Mesh2(geometry, anime2.material);
|
|
2685
|
+
decal.scale.copy(bodyMesh.scale).multiplyScalar(1.006);
|
|
2686
|
+
decal.renderOrder = 1;
|
|
2687
|
+
lifted.add(decal);
|
|
2688
|
+
}
|
|
1894
2689
|
}
|
|
1895
2690
|
for (const mesh of lifted.children)
|
|
1896
2691
|
mesh.raycast = () => {};
|
|
1897
2692
|
}
|
|
1898
|
-
const
|
|
1899
|
-
|
|
1900
|
-
|
|
2693
|
+
const headWearRoot = new Group2;
|
|
2694
|
+
const bodyWearRoot = new Group2;
|
|
2695
|
+
if (isFigure) {
|
|
2696
|
+
headWearRoot.position.set(0, headMetrics.originY, 0);
|
|
2697
|
+
headWearRoot.scale.setScalar(headMetrics.scale);
|
|
2698
|
+
} else {
|
|
2699
|
+
headWearRoot.scale.set(fit.girth / shape.x, clampBodyScale(options.bodyScale).head, fit.girth / shape.x);
|
|
2700
|
+
bodyWearRoot.scale.copy(headWearRoot.scale);
|
|
2701
|
+
}
|
|
2702
|
+
lifted.add(headWearRoot, bodyWearRoot);
|
|
1901
2703
|
const worn = new Map;
|
|
1902
|
-
const
|
|
1903
|
-
radiusAt: (y) => blobRadiusAt(y, silhouette),
|
|
2704
|
+
const headKit = {
|
|
2705
|
+
radiusAt: (y) => isFigure ? figureHeadRadiusAt(y) : blobRadiusAt(y, silhouette),
|
|
2706
|
+
paint: (paint, more = {}) => toon({ ...more, color: paint }),
|
|
2707
|
+
ink: hairInk,
|
|
2708
|
+
hairColor: options.hairColor,
|
|
2709
|
+
isFigure
|
|
2710
|
+
};
|
|
2711
|
+
const bodyKit = {
|
|
2712
|
+
radiusAt: (y) => isFigure ? figureTorsoRadiusAt(y, silhouette) : blobRadiusAt(y, silhouette),
|
|
2713
|
+
surfaceAt: isFigure ? (y, phi, grow = 0) => {
|
|
2714
|
+
const pt = figureTorsoPoint(y, phi, silhouette);
|
|
2715
|
+
const len = Math.hypot(pt.x, pt.z) || 1;
|
|
2716
|
+
const nx = pt.x / len;
|
|
2717
|
+
const nz = pt.z / len;
|
|
2718
|
+
return { x: pt.x + nx * grow, z: pt.z + nz * grow };
|
|
2719
|
+
} : (y, phi, grow = 0) => {
|
|
2720
|
+
const r = blobRadiusAt(y, silhouette) + grow;
|
|
2721
|
+
return { x: Math.sin(phi) * r, z: Math.cos(phi) * r * (BLOB_RADIUS.z / BLOB_RADIUS.x) };
|
|
2722
|
+
},
|
|
1904
2723
|
paint: (paint, more = {}) => toon({ ...more, color: paint }),
|
|
1905
|
-
ink: fine
|
|
2724
|
+
ink: fine,
|
|
2725
|
+
hairColor: options.hairColor,
|
|
2726
|
+
isFigure,
|
|
2727
|
+
zones: isFigure ? {
|
|
2728
|
+
bottomY: FIGURE_TORSO_MIN_Y,
|
|
2729
|
+
hipY: 0.22,
|
|
2730
|
+
waistY: 0.41,
|
|
2731
|
+
bustY: 0.56,
|
|
2732
|
+
shoulderY: FIGURE_SHOULDER_Y,
|
|
2733
|
+
neckY: FIGURE_TORSO_MAX_Y - 0.08
|
|
2734
|
+
} : {
|
|
2735
|
+
bottomY: 0.04,
|
|
2736
|
+
hipY: 0.14,
|
|
2737
|
+
waistY: 0.25,
|
|
2738
|
+
bustY: 0.35,
|
|
2739
|
+
shoulderY: 0.42,
|
|
2740
|
+
neckY: 0.27
|
|
2741
|
+
}
|
|
1906
2742
|
};
|
|
2743
|
+
const isHeadPiece = (key) => isHairKey(key) || wearSlotOf(key) === "hat" || key === "sunglasses";
|
|
1907
2744
|
let lastLift = 0;
|
|
1908
2745
|
let lastYaw = 0;
|
|
1909
2746
|
const setWear = (next) => {
|
|
@@ -1911,26 +2748,32 @@ function createPlup(options = {}) {
|
|
|
1911
2748
|
for (const [key, piece2] of worn) {
|
|
1912
2749
|
if (wanted.has(key))
|
|
1913
2750
|
continue;
|
|
1914
|
-
|
|
2751
|
+
headWearRoot.remove(piece2.object);
|
|
2752
|
+
bodyWearRoot.remove(piece2.object);
|
|
1915
2753
|
piece2.dispose();
|
|
1916
2754
|
worn.delete(key);
|
|
1917
2755
|
}
|
|
1918
2756
|
for (const key of wanted) {
|
|
1919
2757
|
if (worn.has(key))
|
|
1920
2758
|
continue;
|
|
2759
|
+
const onHead2 = isHeadPiece(key);
|
|
2760
|
+
const kit = onHead2 ? isHairKey(key) ? headKit : { ...headKit, ink: fine } : bodyKit;
|
|
1921
2761
|
const piece2 = buildWear(key, kit);
|
|
1922
2762
|
worn.set(key, piece2);
|
|
1923
|
-
|
|
2763
|
+
(onHead2 ? headWearRoot : bodyWearRoot).add(piece2.object);
|
|
1924
2764
|
}
|
|
1925
2765
|
const volume = Math.max(0, ...[...worn.keys()].filter(isHairKey).map(hairVolume));
|
|
1926
2766
|
for (const [key, piece2] of worn)
|
|
1927
2767
|
if (wearSlotOf(key) === "hat")
|
|
1928
2768
|
piece2.object.position.y = volume;
|
|
2769
|
+
const pantHex = isFigure ? [...worn.keys()].map((k) => OUTFIT_LEG_COLOR[k]).find(Boolean) ?? shade(color, 0, 0.05) : shade(color, 0, 0.12);
|
|
2770
|
+
legMaterial.uniforms.color?.value?.set(pantHex);
|
|
2771
|
+
legMaterial.uniforms.backColor?.value?.set(pantHex);
|
|
1929
2772
|
};
|
|
1930
2773
|
setWear(options.wear ?? []);
|
|
1931
2774
|
const limbGeometry = new CapsuleGeometry(0.075, 0.2, 4, 10);
|
|
1932
|
-
const handGeometry = new SphereGeometry3(0.11, 12, 10);
|
|
1933
|
-
const footGeometry = new SphereGeometry3(0.13, 12, 10);
|
|
2775
|
+
const handGeometry = new SphereGeometry3(isFigure ? 0.056 : 0.11, 12, 10);
|
|
2776
|
+
const footGeometry = new SphereGeometry3(isFigure ? 0.072 : 0.13, 12, 10);
|
|
1934
2777
|
const pivots = {
|
|
1935
2778
|
armL: new Group2,
|
|
1936
2779
|
armR: new Group2,
|
|
@@ -1938,31 +2781,32 @@ function createPlup(options = {}) {
|
|
|
1938
2781
|
legR: new Group2
|
|
1939
2782
|
};
|
|
1940
2783
|
const armGeometries = [];
|
|
1941
|
-
const limb = (name, x, y, length, tip, flat, bow2 = 0) => {
|
|
2784
|
+
const limb = (name, x, y, length, tip, flat, bow2 = 0, legStyle = false) => {
|
|
1942
2785
|
const pivot = pivots[name];
|
|
1943
2786
|
pivot.position.set(x, y, 0);
|
|
1944
|
-
const curve = bow2 ? new QuadraticBezierCurve3(new Vector32(0, 0.02, 0), new Vector32(bow2 * 0.
|
|
1945
|
-
const shaft = curve ? taperedHose(curve, build.muscle) : limbGeometry;
|
|
2787
|
+
const curve = bow2 ? new QuadraticBezierCurve3(new Vector32(0, 0.02, 0), new Vector32(bow2 * (legStyle ? 0.025 : 0.07), -length * 0.5, legStyle ? 0.02 : 0.03), new Vector32(bow2 * (legStyle ? 0.01 : 0.03), -length, legStyle ? 0.01 : 0.04)) : null;
|
|
2788
|
+
const shaft = curve ? legStyle ? sculptedLeg(curve, build.hips, build.muscle) : taperedHose(curve, build.muscle, isFigure ? 0.042 : 0.046) : limbGeometry;
|
|
1946
2789
|
if (curve)
|
|
1947
2790
|
armGeometries.push(shaft);
|
|
1948
|
-
const tube = new Mesh2(shaft, limbMaterial);
|
|
2791
|
+
const tube = new Mesh2(shaft, flat ? legMaterial : limbMaterial);
|
|
1949
2792
|
if (!curve) {
|
|
1950
2793
|
tube.position.y = -length / 2;
|
|
1951
2794
|
tube.scale.y = length / 0.35;
|
|
1952
2795
|
}
|
|
1953
|
-
const end = new Mesh2(tip, tipMaterial);
|
|
2796
|
+
const end = new Mesh2(tip, flat && isFigure ? shoeMaterial : tipMaterial);
|
|
1954
2797
|
if (curve)
|
|
1955
2798
|
end.position.copy(curve.getPoint(1));
|
|
1956
2799
|
else
|
|
1957
2800
|
end.position.y = -length;
|
|
1958
2801
|
if (flat)
|
|
1959
|
-
end.scale.set(1.15, 0.5, 1.7);
|
|
2802
|
+
end.scale.set(isFigure ? 1.05 : 1.15, isFigure ? 0.65 : 0.5, isFigure ? 1.65 : 1.7);
|
|
1960
2803
|
else
|
|
1961
|
-
end.scale.setScalar(0.85);
|
|
1962
|
-
const
|
|
2804
|
+
end.scale.setScalar(isFigure ? 0.95 + Math.max(0, build.muscle - 1) * 0.25 : 0.85);
|
|
2805
|
+
const outlineMat = isFigure ? figureInk : ink;
|
|
2806
|
+
const inkTube = new Mesh2(shaft, outlineMat);
|
|
1963
2807
|
inkTube.position.copy(tube.position);
|
|
1964
2808
|
inkTube.scale.copy(tube.scale);
|
|
1965
|
-
const inkEnd = new Mesh2(tip,
|
|
2809
|
+
const inkEnd = new Mesh2(tip, outlineMat);
|
|
1966
2810
|
inkEnd.position.copy(end.position);
|
|
1967
2811
|
inkEnd.scale.copy(end.scale);
|
|
1968
2812
|
pivot.add(tube, end, inkTube, inkEnd);
|
|
@@ -1977,6 +2821,23 @@ function createPlup(options = {}) {
|
|
|
1977
2821
|
if (found)
|
|
1978
2822
|
pivots[name] = found;
|
|
1979
2823
|
}
|
|
2824
|
+
} else if (isFigure) {
|
|
2825
|
+
const shPt = figureTorsoPoint(FIGURE_SHOULDER_Y, Math.PI / 2, silhouette);
|
|
2826
|
+
const shoulderX = Math.max(0.14, shPt.x * 0.9);
|
|
2827
|
+
const arm = 0.34 * build.armLength;
|
|
2828
|
+
const hipAnchorY = FIGURE_HIP_Y + 0.06;
|
|
2829
|
+
const hipPt = figureTorsoPoint(hipAnchorY, Math.PI / 2, silhouette);
|
|
2830
|
+
const hipX = Math.max(0.085, hipPt.x * 0.46);
|
|
2831
|
+
const leg = Math.max(0.36, legRaise + hipAnchorY - 0.03);
|
|
2832
|
+
limb("armL", -shoulderX, FIGURE_SHOULDER_Y, arm, handGeometry, false, -1, false);
|
|
2833
|
+
limb("armR", shoulderX, FIGURE_SHOULDER_Y, arm, handGeometry, false, 1, false);
|
|
2834
|
+
limb("legL", -hipX, hipAnchorY, leg, footGeometry, true, -0.25, true);
|
|
2835
|
+
limb("legR", hipX, hipAnchorY, leg, footGeometry, true, 0.25, true);
|
|
2836
|
+
const armBulk = build.muscle > 1 ? 1 + (build.muscle - 1) * 0.28 : 0.86 + build.muscle * 0.14;
|
|
2837
|
+
pivots.armL.scale.set(fit.armWidth[0] * armBulk, 1, fit.armWidth[0] * armBulk);
|
|
2838
|
+
pivots.armR.scale.set(fit.armWidth[1] * armBulk, 1, fit.armWidth[1] * armBulk);
|
|
2839
|
+
pivots.legL.scale.set(fit.legWidth[0], 1, fit.legWidth[0]);
|
|
2840
|
+
pivots.legR.scale.set(fit.legWidth[1], 1, fit.legWidth[1]);
|
|
1980
2841
|
} else {
|
|
1981
2842
|
const torso = fit.girth / shape.x;
|
|
1982
2843
|
const shoulderY = BLOB_HEIGHT * build.shoulderHeight;
|
|
@@ -2039,15 +2900,16 @@ function createPlup(options = {}) {
|
|
|
2039
2900
|
const clearance = name === "armL" ? fit.armClear[0] : name === "armR" ? -fit.armClear[1] : 0;
|
|
2040
2901
|
const z = rotation?.z ?? 0;
|
|
2041
2902
|
const side = name === "armL" ? -1 : name === "armR" ? 1 : 0;
|
|
2042
|
-
const
|
|
2903
|
+
const restAngle = isFigure ? 0.16 : 0.42;
|
|
2904
|
+
const rest = options.model ? 0 : side * restAngle * Math.max(0, 1 - Math.abs(z) / 1.4);
|
|
2043
2905
|
pivots[name].rotation.set(rotation?.x ?? 0, rotation?.y ?? 0, z + clearance + rest);
|
|
2044
2906
|
targets[name] = { x: rotation?.x ?? 0, z: z + clearance + rest };
|
|
2045
2907
|
}
|
|
2046
2908
|
const body = pose.get("Body");
|
|
2047
2909
|
lifted.rotation.set(body?.x ?? 0, body?.y ?? 0, body?.z ?? 0);
|
|
2048
2910
|
const clipLiftY = legRaise + clipLift(clip2, seconds) * 0.32 * fit.lift;
|
|
2049
|
-
const breath = Math.sin(clock * 3.2) * 0.018 * fit.squash;
|
|
2050
|
-
lifted.scale.set(shape.x * fit.stature * (1 - breath), shape.y * fit.stature * (1 + breath), shape.x * fit.stature * (1 - breath));
|
|
2911
|
+
const breath = Math.sin(clock * 3.2) * (isFigure ? 0.01 : 0.018) * fit.squash;
|
|
2912
|
+
lifted.scale.set((isFigure ? 1 : shape.x) * fit.stature * (1 - breath), (isFigure ? 1 : shape.y) * fit.stature * (1 + breath), (isFigure ? 1 : shape.x) * fit.stature * (1 - breath));
|
|
2051
2913
|
lifted.position.y = clipLiftY;
|
|
2052
2914
|
if (ragdoll) {
|
|
2053
2915
|
root.getWorldPosition(here);
|
|
@@ -2082,13 +2944,14 @@ function createPlup(options = {}) {
|
|
|
2082
2944
|
piece2.tick?.(clock, lastDelta, motion);
|
|
2083
2945
|
if (shadow) {
|
|
2084
2946
|
const air = Math.min(1, (lifted.position.y - legRaise) / 0.5);
|
|
2085
|
-
|
|
2947
|
+
const shadowR = isFigure ? 0.72 : 1;
|
|
2948
|
+
shadow.scale.set((1 - air * 0.3) * fit.stature * fit.girth * shadowR, 0.02, (0.9 - air * 0.3) * fit.stature * fit.girth * shadowR);
|
|
2086
2949
|
shadow.material.opacity = 0.4 - air * 0.18;
|
|
2087
2950
|
}
|
|
2088
2951
|
};
|
|
2089
2952
|
apply();
|
|
2090
2953
|
const redraw = () => {
|
|
2091
|
-
paintBody(canvas, color, face, skin, options.faceType);
|
|
2954
|
+
paintBody(canvas, color, face, skin, options.faceType, isFigure);
|
|
2092
2955
|
texture.needsUpdate = true;
|
|
2093
2956
|
anime2?.draw(face);
|
|
2094
2957
|
};
|
|
@@ -2138,8 +3001,17 @@ function createPlup(options = {}) {
|
|
|
2138
3001
|
return;
|
|
2139
3002
|
color = next;
|
|
2140
3003
|
redraw();
|
|
2141
|
-
|
|
2142
|
-
|
|
3004
|
+
torsoMaterial.uniforms.color?.value?.set(color);
|
|
3005
|
+
torsoMaterial.uniforms.backColor?.value?.set(color);
|
|
3006
|
+
const limbHex = isFigure ? shade(color, 0, 0.05) : shade(color, 0, 0.12);
|
|
3007
|
+
const pantHex = isFigure ? [...worn.keys()].map((k) => OUTFIT_LEG_COLOR[k]).find(Boolean) ?? limbHex : limbHex;
|
|
3008
|
+
const tipHex = isFigure ? shade(color, 0, 0.12) : shade(color, 0, 0.3);
|
|
3009
|
+
limbMaterial.uniforms.color?.value?.set(limbHex);
|
|
3010
|
+
limbMaterial.uniforms.backColor?.value?.set(limbHex);
|
|
3011
|
+
legMaterial.uniforms.color?.value?.set(pantHex);
|
|
3012
|
+
legMaterial.uniforms.backColor?.value?.set(pantHex);
|
|
3013
|
+
tipMaterial.uniforms.color?.value?.set(tipHex);
|
|
3014
|
+
tipMaterial.uniforms.backColor?.value?.set(tipHex);
|
|
2143
3015
|
},
|
|
2144
3016
|
setWear,
|
|
2145
3017
|
update(delta) {
|
|
@@ -2151,6 +3023,7 @@ function createPlup(options = {}) {
|
|
|
2151
3023
|
dispose() {
|
|
2152
3024
|
setWear([]);
|
|
2153
3025
|
geometry.dispose();
|
|
3026
|
+
torsoGeometry?.dispose();
|
|
2154
3027
|
limbGeometry.dispose();
|
|
2155
3028
|
for (const arm of armGeometries)
|
|
2156
3029
|
arm.dispose();
|
|
@@ -2160,8 +3033,11 @@ function createPlup(options = {}) {
|
|
|
2160
3033
|
anime2?.material.map?.dispose();
|
|
2161
3034
|
anime2?.material.dispose();
|
|
2162
3035
|
bodyMaterial.dispose();
|
|
3036
|
+
torsoMaterial.dispose();
|
|
2163
3037
|
limbMaterial.dispose();
|
|
3038
|
+
legMaterial.dispose();
|
|
2164
3039
|
tipMaterial.dispose();
|
|
3040
|
+
shoeMaterial.dispose();
|
|
2165
3041
|
if (shadow) {
|
|
2166
3042
|
shadow.geometry.dispose();
|
|
2167
3043
|
shadow.material.dispose();
|
|
@@ -2296,7 +3172,25 @@ function createCharacter(rigId = "plup", look = { bodyColor: "#3d7bff" }, bodySc
|
|
|
2296
3172
|
};
|
|
2297
3173
|
}
|
|
2298
3174
|
export {
|
|
3175
|
+
wearSlotOf,
|
|
3176
|
+
toon,
|
|
3177
|
+
isWearKey,
|
|
3178
|
+
isHighResFace,
|
|
3179
|
+
isHairKey,
|
|
3180
|
+
hairVolume,
|
|
3181
|
+
figureTorsoPoint,
|
|
3182
|
+
drawAnimeFace,
|
|
2299
3183
|
createPlup,
|
|
2300
3184
|
createCharacter,
|
|
2301
|
-
buildWear
|
|
3185
|
+
buildWear,
|
|
3186
|
+
buildFigureTorsoGeometry,
|
|
3187
|
+
buildFigureHeadGeometry,
|
|
3188
|
+
buildBlobGeometry,
|
|
3189
|
+
blobRadiusAt,
|
|
3190
|
+
WEARABLES,
|
|
3191
|
+
EMOTES,
|
|
3192
|
+
BODY_PRESETS,
|
|
3193
|
+
AUTHORED_CLIPS,
|
|
3194
|
+
ANIME_FACE_UV,
|
|
3195
|
+
ANIME_FACE_SIZE
|
|
2302
3196
|
};
|