@plupin/character 0.3.0 → 0.5.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 +62 -11
- package/dist/blob.js +31 -1
- package/dist/body-presets.d.ts +106 -37
- package/dist/canvas.js +22 -3
- 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-sa2r1cxz.js → chunk-phwn2cn7.js} +17 -9
- package/dist/{chunk-yd5zzkkg.js → chunk-s083mv4f.js} +176 -1
- package/dist/{chunk-g1c0wdcj.js → chunk-wryfx2sg.js} +538 -10
- package/dist/chunk-x8f5p1qg.js +226 -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 +35 -11
- package/dist/three.d.ts +8 -1
- package/dist/three.js +1510 -408
- 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/anime-face.d.ts
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* docs/product/research-anime-hair-and-bodies.md:
|
|
2
|
+
* High-resolution anime faces for Plup (`anime` cute/pretty and `ikemen` cool/handsome), drawn as
|
|
3
|
+
* crisp vector layers on a 512 x 256 face decal wrapped onto the front of the head.
|
|
5
4
|
*
|
|
6
|
-
* -
|
|
7
|
-
* -
|
|
8
|
-
*
|
|
9
|
-
* -
|
|
10
|
-
*
|
|
11
|
-
*
|
|
5
|
+
* - `anime` (Cute / Pretty): softly proportioned jewel eyes with curved velvety upper lashes,
|
|
6
|
+
* delicate multi-lash flicks, double eyelid crease (futae), luminous lower iris crescent,
|
|
7
|
+
* triple catchlights + star micro-glint, dainty nose dot, soft airbrushed cheek glow & lip tint.
|
|
8
|
+
* - `ikemen` (Cool / Handsome): sleeker horizontal almond eyes (`tsurime`), sharp sculpted brows
|
|
9
|
+
* set closer to the lid, refined dark upper lash line, intense crisp iris with angular highlights,
|
|
10
|
+
* subtle nose-bridge shadow, confident smirk/smile, and clean subtle shading.
|
|
12
11
|
*
|
|
13
|
-
* Pure canvas drawing, no three.js: `plup3d.ts` puts the canvas on the
|
|
12
|
+
* Pure canvas drawing, no three.js: `plup3d.ts` puts the canvas on the head.
|
|
14
13
|
*/
|
|
15
14
|
export declare const ANIME_FACE_SIZE: {
|
|
16
15
|
readonly width: 512;
|
|
17
16
|
readonly height: 256;
|
|
18
17
|
};
|
|
19
|
-
/** Where the decal sits on the body
|
|
18
|
+
/** Where the decal sits on the head/body UV sphere: slightly lower on the front so bangs have lush forehead room. */
|
|
20
19
|
export declare const ANIME_FACE_UV: {
|
|
21
|
-
readonly u0: 0.
|
|
22
|
-
readonly u1: 0.
|
|
23
|
-
readonly v0: 0.
|
|
24
|
-
readonly v1: 0.
|
|
20
|
+
readonly u0: 0.1;
|
|
21
|
+
readonly u1: 0.4;
|
|
22
|
+
readonly v0: 0.27;
|
|
23
|
+
readonly v1: 0.61;
|
|
25
24
|
};
|
|
25
|
+
export type AnimeFaceStyle = "anime" | "ikemen";
|
|
26
26
|
type Eyes = "open" | "closed" | "happy" | "wide" | "sad" | "half" | "angry" | "stars" | "dead" | "wink" | "cry";
|
|
27
27
|
type Mouth = "smile" | "open" | "o" | "frown" | "smirk" | "cat" | "flat" | "yell" | "tongue" | "grin";
|
|
28
28
|
type Brows = "calm" | "up" | "angry" | "sad" | "none";
|
|
@@ -37,6 +37,6 @@ interface FaceParts {
|
|
|
37
37
|
export declare function animeFaceParts(face: string): FaceParts;
|
|
38
38
|
/** How far down the face canvas the eyes sit, for drawing it over a flat icon. */
|
|
39
39
|
export declare const ANIME_EYE_LINE: number;
|
|
40
|
-
/** Draw an anime
|
|
41
|
-
export declare function drawAnimeFace(ctx: CanvasRenderingContext2D, face: string, iris?: string): void;
|
|
40
|
+
/** Draw an anime (`anime` cute/pretty or `ikemen` cool/handsome) face on a canvas of `ANIME_FACE_SIZE`. */
|
|
41
|
+
export declare function drawAnimeFace(ctx: CanvasRenderingContext2D, face: string, iris?: string, style?: AnimeFaceStyle): void;
|
|
42
42
|
export {};
|
package/dist/anime-face.js
CHANGED
package/dist/blob.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { SphereGeometry } from "three";
|
|
2
2
|
/**
|
|
3
|
-
* Plup's body:
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Plup's body:
|
|
4
|
+
* 1. Classic Plup (`figure === 0`): one round blob, bottom-heavy (a soft triangle), resting on a
|
|
5
|
+
* flat seat (ADR 0024).
|
|
6
|
+
* 2. Stylized Anime / Roblox Figure (`figure > 0`): sleek anime oval head with soft chin + slender
|
|
7
|
+
* neck + smooth sculpted torso (rounded feminine bust, tiny hourglass waist, graceful hips flowing
|
|
8
|
+
* seamlessly into shapely thighs, or broad muscular V-taper with sloped traps & pecs).
|
|
6
9
|
*/
|
|
7
10
|
export declare const BLOB_RADIUS: {
|
|
8
11
|
readonly x: 0.6;
|
|
@@ -11,22 +14,70 @@ export declare const BLOB_RADIUS: {
|
|
|
11
14
|
};
|
|
12
15
|
/** The blob's height with the seat flattened: feet on y = 0. */
|
|
13
16
|
export declare const BLOB_HEIGHT: number;
|
|
14
|
-
/**
|
|
15
|
-
* A body's silhouette on top of the blob: how broad the shoulders are, how much the waist pinches, how
|
|
16
|
-
* wide the hips spread. 1 everywhere is the round Plup; a muscular body is broad on top and narrow below,
|
|
17
|
-
* a curvy one pinched at the waist and full at the hips. Everything that has to fit the body (the
|
|
18
|
-
* wearables, the arms' shoulders) reads the same `silhouetteAt`, so clothes follow the shape.
|
|
19
|
-
*/
|
|
20
17
|
export interface Silhouette {
|
|
21
18
|
shoulders: number;
|
|
22
19
|
waist: number;
|
|
23
20
|
hips: number;
|
|
21
|
+
bust?: number;
|
|
22
|
+
muscle?: number;
|
|
23
|
+
torsoHeight?: number;
|
|
24
|
+
figure?: number;
|
|
24
25
|
}
|
|
25
26
|
export declare const ROUND: Silhouette;
|
|
26
|
-
/** The radius multiplier at a height on the unit sphere (-1 bottom, 1 top). */
|
|
27
|
+
/** The radius multiplier at a height on the classic round unit sphere (-1 bottom, 1 top). */
|
|
27
28
|
export declare function silhouetteAt(unitY: number, silhouette?: Silhouette): number;
|
|
28
29
|
/** How far the seat was raised so the feet stand on y = 0. */
|
|
29
30
|
export declare const BLOB_SEAT: number;
|
|
30
|
-
/** The body's half-width across (x) at a height above the feet, for this silhouette.
|
|
31
|
+
/** The classic body's half-width across (x) at a height above the feet, for this silhouette. */
|
|
31
32
|
export declare function blobRadiusAt(y: number, silhouette?: Silhouette): number;
|
|
32
33
|
export declare function buildBlobGeometry(silhouette?: Silhouette): SphereGeometry;
|
|
34
|
+
export declare const FIGURE_TORSO_MIN_Y = 0.04;
|
|
35
|
+
export declare const FIGURE_TORSO_MAX_Y = 0.84;
|
|
36
|
+
export declare const FIGURE_TORSO_CENTER_Y: number;
|
|
37
|
+
export declare const FIGURE_TORSO_HALF_H: number;
|
|
38
|
+
export declare const FIGURE_HEAD_BASE_SCALE = 0.46;
|
|
39
|
+
export declare const FIGURE_NECK_TOP_Y = 0.8;
|
|
40
|
+
export declare const FIGURE_SHOULDER_Y = 0.64;
|
|
41
|
+
export declare const FIGURE_HIP_Y = 0.17;
|
|
42
|
+
/** Vertical landmarks for a given `torsoHeight` (0.45 = compact chibi, 1.0 = full runway anime). */
|
|
43
|
+
export declare function figureTorsoSpan(torsoHeight?: number): {
|
|
44
|
+
minY: number;
|
|
45
|
+
maxY: number;
|
|
46
|
+
centerY: number;
|
|
47
|
+
halfH: number;
|
|
48
|
+
neckTopY: number;
|
|
49
|
+
shoulderY: number;
|
|
50
|
+
hipY: number;
|
|
51
|
+
waistY: number;
|
|
52
|
+
bustY: number;
|
|
53
|
+
};
|
|
54
|
+
/** Head scale and origin Y for a given `headSize` (0.55..1.45) and `torsoHeight` (0.45..1.15). */
|
|
55
|
+
export declare function figureHeadMetrics(headSize?: number, torsoHeight?: number): {
|
|
56
|
+
scale: number;
|
|
57
|
+
originY: number;
|
|
58
|
+
centerY: number;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Exact (x, z) point on the stylized torso surface at height `y` and azimuth `phi` (0 = front +Z,
|
|
62
|
+
* +pi/2 = +X left, pi = back -Z). Smooth anatomical curves:
|
|
63
|
+
* - Graceful neck & sloped traps (`u > 0.65`)
|
|
64
|
+
* - Rounded twin feminine bust domes (circular spherical profile, NEVER a sharp triangle!)
|
|
65
|
+
* - Clean pinched hourglass waist (`waist`)
|
|
66
|
+
* - Smooth long hip curve flowing seamlessly into full upper thighs (NO mushroom shelf!)
|
|
67
|
+
* - Broad V-taper chest/pecs & lats for muscular builds
|
|
68
|
+
*/
|
|
69
|
+
export declare function figureTorsoPoint(y: number, phi: number, silhouette?: Silhouette): {
|
|
70
|
+
x: number;
|
|
71
|
+
z: number;
|
|
72
|
+
};
|
|
73
|
+
/** Average horizontal half-width of the stylized torso at height `y`. */
|
|
74
|
+
export declare function figureTorsoRadiusAt(y: number, silhouette?: Silhouette, phi?: number): number;
|
|
75
|
+
/**
|
|
76
|
+
* Cute/handsome anime oval head in local head space: slightly taller than wide (`0.54 x 0.59 x 0.54`)
|
|
77
|
+
* with soft cheeks and a gentle delicate chin taper — NEVER a squished wide pancake!
|
|
78
|
+
*/
|
|
79
|
+
export declare function buildFigureHeadGeometry(): SphereGeometry;
|
|
80
|
+
/** Head radius at local `y` matching `buildFigureHeadGeometry` so anime hair wraps the oval head seamlessly! */
|
|
81
|
+
export declare function figureHeadRadiusAt(y: number): number;
|
|
82
|
+
/** Sculpted anatomical torso mesh for `figure > 0`, driven by `figureTorsoPoint`. */
|
|
83
|
+
export declare function buildFigureTorsoGeometry(silhouette?: Silhouette): SphereGeometry;
|
package/dist/blob.js
CHANGED
|
@@ -2,16 +2,46 @@ import {
|
|
|
2
2
|
BLOB_HEIGHT,
|
|
3
3
|
BLOB_RADIUS,
|
|
4
4
|
BLOB_SEAT,
|
|
5
|
+
FIGURE_HEAD_BASE_SCALE,
|
|
6
|
+
FIGURE_HIP_Y,
|
|
7
|
+
FIGURE_NECK_TOP_Y,
|
|
8
|
+
FIGURE_SHOULDER_Y,
|
|
9
|
+
FIGURE_TORSO_CENTER_Y,
|
|
10
|
+
FIGURE_TORSO_HALF_H,
|
|
11
|
+
FIGURE_TORSO_MAX_Y,
|
|
12
|
+
FIGURE_TORSO_MIN_Y,
|
|
5
13
|
ROUND,
|
|
6
14
|
blobRadiusAt,
|
|
7
15
|
buildBlobGeometry,
|
|
16
|
+
buildFigureHeadGeometry,
|
|
17
|
+
buildFigureTorsoGeometry,
|
|
18
|
+
figureHeadMetrics,
|
|
19
|
+
figureHeadRadiusAt,
|
|
20
|
+
figureTorsoPoint,
|
|
21
|
+
figureTorsoRadiusAt,
|
|
22
|
+
figureTorsoSpan,
|
|
8
23
|
silhouetteAt
|
|
9
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-x8f5p1qg.js";
|
|
10
25
|
export {
|
|
11
26
|
silhouetteAt,
|
|
27
|
+
figureTorsoSpan,
|
|
28
|
+
figureTorsoRadiusAt,
|
|
29
|
+
figureTorsoPoint,
|
|
30
|
+
figureHeadRadiusAt,
|
|
31
|
+
figureHeadMetrics,
|
|
32
|
+
buildFigureTorsoGeometry,
|
|
33
|
+
buildFigureHeadGeometry,
|
|
12
34
|
buildBlobGeometry,
|
|
13
35
|
blobRadiusAt,
|
|
14
36
|
ROUND,
|
|
37
|
+
FIGURE_TORSO_MIN_Y,
|
|
38
|
+
FIGURE_TORSO_MAX_Y,
|
|
39
|
+
FIGURE_TORSO_HALF_H,
|
|
40
|
+
FIGURE_TORSO_CENTER_Y,
|
|
41
|
+
FIGURE_SHOULDER_Y,
|
|
42
|
+
FIGURE_NECK_TOP_Y,
|
|
43
|
+
FIGURE_HIP_Y,
|
|
44
|
+
FIGURE_HEAD_BASE_SCALE,
|
|
15
45
|
BLOB_SEAT,
|
|
16
46
|
BLOB_RADIUS,
|
|
17
47
|
BLOB_HEIGHT
|
package/dist/body-presets.d.ts
CHANGED
|
@@ -1,66 +1,130 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Bodies a player starts from, then tunes with the sliders:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Bodies a player starts from, then tunes with the sliders: classic round Plup shapes (`figure: 0`)
|
|
3
|
+
* and stylized anime/Roblox-proportioned figures (`figure: 1`) with a sleek customizable head,
|
|
4
|
+
* slender neck, and prominent sculpted chest/bust, tiny waist, wide curvy hips, or broad muscular
|
|
5
|
+
* V-taper torso and arms. Data only, so the app, the games and the films offer the same list.
|
|
5
6
|
*/
|
|
6
7
|
export declare const BODY_PRESETS: {
|
|
7
8
|
readonly round: {
|
|
8
9
|
readonly name: "Round";
|
|
9
10
|
readonly shape: "plup";
|
|
10
|
-
readonly body: {
|
|
11
|
+
readonly body: {
|
|
12
|
+
readonly figure: 0;
|
|
13
|
+
readonly headSize: 1;
|
|
14
|
+
};
|
|
11
15
|
};
|
|
12
|
-
readonly
|
|
13
|
-
readonly name: "
|
|
14
|
-
readonly shape: "
|
|
16
|
+
readonly curvy: {
|
|
17
|
+
readonly name: "Curvy";
|
|
18
|
+
readonly shape: "plup";
|
|
15
19
|
readonly body: {
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
readonly
|
|
19
|
-
readonly
|
|
20
|
-
readonly
|
|
21
|
-
readonly
|
|
20
|
+
readonly figure: 1;
|
|
21
|
+
readonly headSize: 0.78;
|
|
22
|
+
readonly shoulders: 0.86;
|
|
23
|
+
readonly bust: 0.9;
|
|
24
|
+
readonly waist: 0.54;
|
|
25
|
+
readonly hips: 1.4;
|
|
26
|
+
readonly legLength: 2.35;
|
|
27
|
+
readonly armLength: 1.35;
|
|
28
|
+
readonly muscle: 0.82;
|
|
22
29
|
};
|
|
23
30
|
};
|
|
24
|
-
readonly
|
|
25
|
-
readonly name: "
|
|
26
|
-
readonly shape: "
|
|
31
|
+
readonly glam: {
|
|
32
|
+
readonly name: "Hourglass";
|
|
33
|
+
readonly shape: "plup";
|
|
34
|
+
readonly body: {
|
|
35
|
+
readonly figure: 1;
|
|
36
|
+
readonly headSize: 0.74;
|
|
37
|
+
readonly shoulders: 0.84;
|
|
38
|
+
readonly bust: 1.32;
|
|
39
|
+
readonly waist: 0.48;
|
|
40
|
+
readonly hips: 1.54;
|
|
41
|
+
readonly legLength: 2.55;
|
|
42
|
+
readonly armLength: 1.38;
|
|
43
|
+
readonly muscle: 0.8;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
readonly ikemen: {
|
|
47
|
+
readonly name: "Ikemen";
|
|
48
|
+
readonly shape: "plup";
|
|
27
49
|
readonly body: {
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
50
|
+
readonly figure: 1;
|
|
51
|
+
readonly headSize: 0.72;
|
|
52
|
+
readonly shoulders: 1.28;
|
|
53
|
+
readonly bust: 0;
|
|
54
|
+
readonly waist: 0.74;
|
|
55
|
+
readonly hips: 0.92;
|
|
56
|
+
readonly legLength: 2.6;
|
|
57
|
+
readonly armLength: 1.48;
|
|
58
|
+
readonly muscle: 1.22;
|
|
34
59
|
};
|
|
35
60
|
};
|
|
36
61
|
readonly muscular: {
|
|
37
62
|
readonly name: "Muscular";
|
|
38
|
-
readonly shape: "
|
|
63
|
+
readonly shape: "plup";
|
|
39
64
|
readonly body: {
|
|
40
|
-
readonly
|
|
41
|
-
readonly
|
|
42
|
-
readonly
|
|
43
|
-
readonly
|
|
44
|
-
readonly
|
|
45
|
-
readonly
|
|
65
|
+
readonly figure: 1;
|
|
66
|
+
readonly headSize: 0.7;
|
|
67
|
+
readonly shoulders: 1.56;
|
|
68
|
+
readonly bust: 0;
|
|
69
|
+
readonly waist: 0.72;
|
|
70
|
+
readonly hips: 0.96;
|
|
71
|
+
readonly legLength: 2.25;
|
|
72
|
+
readonly armLength: 1.52;
|
|
73
|
+
readonly muscle: 2.15;
|
|
46
74
|
};
|
|
47
75
|
};
|
|
48
|
-
readonly
|
|
49
|
-
readonly name: "
|
|
50
|
-
readonly shape: "
|
|
76
|
+
readonly "tall-slim": {
|
|
77
|
+
readonly name: "Tall & Slim";
|
|
78
|
+
readonly shape: "plup";
|
|
51
79
|
readonly body: {
|
|
80
|
+
readonly figure: 1;
|
|
81
|
+
readonly headSize: 0.76;
|
|
52
82
|
readonly shoulders: 0.9;
|
|
83
|
+
readonly bust: 0.28;
|
|
53
84
|
readonly waist: 0.66;
|
|
54
|
-
readonly hips:
|
|
55
|
-
readonly legLength: 2.
|
|
56
|
-
readonly armLength: 1.
|
|
57
|
-
readonly muscle: 0.
|
|
85
|
+
readonly hips: 0.98;
|
|
86
|
+
readonly legLength: 2.5;
|
|
87
|
+
readonly armLength: 1.38;
|
|
88
|
+
readonly muscle: 0.8;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
readonly athletic: {
|
|
92
|
+
readonly name: "Athletic";
|
|
93
|
+
readonly shape: "plup";
|
|
94
|
+
readonly body: {
|
|
95
|
+
readonly figure: 1;
|
|
96
|
+
readonly headSize: 0.75;
|
|
97
|
+
readonly shoulders: 1.32;
|
|
98
|
+
readonly bust: 0.12;
|
|
99
|
+
readonly waist: 0.74;
|
|
100
|
+
readonly hips: 1;
|
|
101
|
+
readonly legLength: 2.3;
|
|
102
|
+
readonly armLength: 1.44;
|
|
103
|
+
readonly muscle: 1.55;
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
readonly chibi: {
|
|
107
|
+
readonly name: "Chibi";
|
|
108
|
+
readonly shape: "plup";
|
|
109
|
+
readonly body: {
|
|
110
|
+
readonly figure: 1;
|
|
111
|
+
readonly torsoHeight: 0.48;
|
|
112
|
+
readonly headSize: 1.32;
|
|
113
|
+
readonly shoulders: 0.72;
|
|
114
|
+
readonly bust: 0;
|
|
115
|
+
readonly waist: 0.78;
|
|
116
|
+
readonly hips: 0.86;
|
|
117
|
+
readonly legLength: 0.85;
|
|
118
|
+
readonly armLength: 0.68;
|
|
119
|
+
readonly muscle: 0.78;
|
|
58
120
|
};
|
|
59
121
|
};
|
|
60
122
|
readonly chubby: {
|
|
61
123
|
readonly name: "Chubby";
|
|
62
124
|
readonly shape: "wide";
|
|
63
125
|
readonly body: {
|
|
126
|
+
readonly figure: 0;
|
|
127
|
+
readonly headSize: 1;
|
|
64
128
|
readonly shoulders: 1;
|
|
65
129
|
readonly waist: 1.15;
|
|
66
130
|
readonly hips: 1.25;
|
|
@@ -72,12 +136,17 @@ export declare const BODY_PRESETS: {
|
|
|
72
136
|
readonly tiny: {
|
|
73
137
|
readonly name: "Tiny";
|
|
74
138
|
readonly shape: "mini";
|
|
75
|
-
readonly body: {
|
|
139
|
+
readonly body: {
|
|
140
|
+
readonly figure: 0;
|
|
141
|
+
readonly headSize: 1;
|
|
142
|
+
};
|
|
76
143
|
};
|
|
77
144
|
readonly bean: {
|
|
78
145
|
readonly name: "Bean";
|
|
79
146
|
readonly shape: "bean";
|
|
80
147
|
readonly body: {
|
|
148
|
+
readonly figure: 0;
|
|
149
|
+
readonly headSize: 1;
|
|
81
150
|
readonly legLength: 1.3;
|
|
82
151
|
};
|
|
83
152
|
};
|
package/dist/canvas.js
CHANGED
|
@@ -6,14 +6,14 @@ import {
|
|
|
6
6
|
clampBodyScale,
|
|
7
7
|
nativePartOf,
|
|
8
8
|
scaleBone
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-phwn2cn7.js";
|
|
10
10
|
import {
|
|
11
11
|
RIGS,
|
|
12
12
|
clipLift,
|
|
13
13
|
mergePoses,
|
|
14
14
|
resolvePose,
|
|
15
15
|
sampleClip
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-wryfx2sg.js";
|
|
17
17
|
import {
|
|
18
18
|
FACE_STAMP_PALETTE,
|
|
19
19
|
NAMED_FACES,
|
|
@@ -34,6 +34,25 @@ var mix = (a, b, t) => {
|
|
|
34
34
|
};
|
|
35
35
|
var ORDER = ["LeftLeg", "RightLeg", "Body", "LeftArm", "RightArm"];
|
|
36
36
|
var scratch = null;
|
|
37
|
+
var MAX_FACE_CACHE = 64;
|
|
38
|
+
var faceCache = new Map;
|
|
39
|
+
function cachedFaceCanvas(face, size) {
|
|
40
|
+
const key = `${face}:${size}`;
|
|
41
|
+
const hit = faceCache.get(key);
|
|
42
|
+
if (hit) {
|
|
43
|
+
faceCache.delete(key);
|
|
44
|
+
faceCache.set(key, hit);
|
|
45
|
+
return hit;
|
|
46
|
+
}
|
|
47
|
+
const canvas = faceCanvas(face, size);
|
|
48
|
+
if (faceCache.size >= MAX_FACE_CACHE) {
|
|
49
|
+
const oldest = faceCache.keys().next().value;
|
|
50
|
+
if (oldest !== undefined)
|
|
51
|
+
faceCache.delete(oldest);
|
|
52
|
+
}
|
|
53
|
+
faceCache.set(key, canvas);
|
|
54
|
+
return canvas;
|
|
55
|
+
}
|
|
37
56
|
function roundRect(ctx, x, y, w, h, r) {
|
|
38
57
|
const radius = Math.min(r, w / 2, h / 2);
|
|
39
58
|
ctx.beginPath();
|
|
@@ -81,7 +100,7 @@ function paintBone(ctx, op, color, ink, face) {
|
|
|
81
100
|
bodyPath(ctx, x, y, w, h);
|
|
82
101
|
ctx.strokeStyle = ink;
|
|
83
102
|
ctx.stroke();
|
|
84
|
-
const stamp =
|
|
103
|
+
const stamp = cachedFaceCanvas(face, 32);
|
|
85
104
|
const faceW = w * 0.82;
|
|
86
105
|
ctx.imageSmoothingEnabled = false;
|
|
87
106
|
ctx.drawImage(stamp, 0, 0, 32, 16, x + (w - faceW) / 2, y + h * 0.2, faceW, faceW / 2);
|