@plupin/character 0.2.0 → 0.3.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 +42 -0
- package/dist/anime-face.js +14 -0
- package/dist/blob.d.ts +32 -0
- package/dist/blob.js +18 -0
- package/dist/body-presets.d.ts +85 -0
- package/dist/canvas.js +7 -7
- package/dist/chunk-09c5tps4.js +337 -0
- package/dist/chunk-60p135hw.js +103 -0
- package/dist/chunk-dpb0rnw9.js +37 -0
- package/dist/chunk-g1c0wdcj.js +825 -0
- package/dist/chunk-kber92gm.js +415 -0
- package/dist/{chunk-k5gwaq6t.js → chunk-sa2r1cxz.js} +30 -3
- package/dist/chunk-yd5zzkkg.js +313 -0
- package/dist/clips.d.ts +40 -0
- package/dist/dress.d.ts +4 -0
- package/dist/emote.d.ts +5 -3
- package/dist/gaze.d.ts +81 -0
- package/dist/gaze.js +113 -0
- package/dist/hair3d.d.ts +3 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.js +84 -10
- package/dist/listing.d.ts +1 -1
- package/dist/listing.js +16 -6
- package/dist/platform-body-data.d.ts +9 -0
- package/dist/platform-body.d.ts +91 -0
- package/dist/plup3d.d.ts +75 -27
- package/dist/png.d.ts +19 -2
- package/dist/pose.d.ts +7 -1
- package/dist/pose.js +1 -1
- package/dist/proportions.d.ts +31 -0
- package/dist/ragdoll.d.ts +51 -0
- package/dist/resolution.d.ts +21 -0
- package/dist/skin-map.d.ts +155 -0
- package/dist/skin-map.js +55 -0
- package/dist/skin-native.d.ts +55 -6
- package/dist/texture.d.ts +8 -0
- package/dist/three.d.ts +3 -0
- package/dist/three.js +1909 -188
- package/dist/wear3d.d.ts +99 -0
- package/dist/wearables.d.ts +203 -0
- package/dist/wearables.js +26 -0
- package/package.json +21 -1
- package/dist/chunk-ae7gp5cc.js +0 -101
- package/dist/chunk-wpbgtn0y.js +0 -179
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The skin map, the face painter and the eyes: the one place that says how Plup's pixels are made, for the app,
|
|
3
|
+
* the games and the films (ADR 0024). Pure TypeScript, no DOM and no three.
|
|
4
|
+
*
|
|
5
|
+
* Character skins are pixel art, not geometry. A skin is a hand-drawable body map
|
|
6
|
+
* (48 x 24, equirectangular around the Character blob, column 24 faces the camera)
|
|
7
|
+
* plus a face type. The face is stamped onto the front of the body map per
|
|
8
|
+
* expression, so the same drawing renders on the 3D Character and in the editor.
|
|
9
|
+
* One character = one pixel.
|
|
10
|
+
*/
|
|
11
|
+
export declare const BODY_WIDTH = 48;
|
|
12
|
+
export declare const BODY_HEIGHT = 24;
|
|
13
|
+
/** Face stamp position on the body map (8 x 4, centred on the front). */
|
|
14
|
+
export declare const FACE_COLUMN = 20;
|
|
15
|
+
export declare const FACE_ROW = 9;
|
|
16
|
+
import { type NamedFace } from "./faces";
|
|
17
|
+
/** `anime` is drawn at high resolution on the 3D body (`anime-face.ts`); pixel-only surfaces fall back to sparkle. */
|
|
18
|
+
export declare const FACE_TYPES: readonly ["dot", "sparkle", "sleepy", "derp", "anime"];
|
|
19
|
+
export type FaceType = (typeof FACE_TYPES)[number];
|
|
20
|
+
/**
|
|
21
|
+
* The six the face rule picks from, plus every named face of the content films (`@plupin/character`
|
|
22
|
+
* faces): an emote forces one of those through `expression`, and the rule never picks them itself.
|
|
23
|
+
*/
|
|
24
|
+
export declare const EXPRESSIONS: readonly ["idle", "blink", "happy", "surprised", "sad", "wee", ...("stars" | "dead" | "cry" | "smirk" | "yell" | "tongue" | "sparkle" | "shock" | "pain" | "rage" | "speechless" | "idea" | "smug" | "cool" | "serious" | "licik" | "tidur" | "teriak" | "ngomel")[]];
|
|
25
|
+
export type CharacterExpression = (typeof EXPRESSIONS)[number];
|
|
26
|
+
export declare function isNamedExpression(expression: CharacterExpression): expression is NamedFace;
|
|
27
|
+
export interface CharacterSkin {
|
|
28
|
+
/** BODY_HEIGHT rows of BODY_WIDTH palette keys. */
|
|
29
|
+
body: readonly string[];
|
|
30
|
+
face: FaceType;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Drawing palette. `B`, `L` and `D` follow the equipped outfit colour; every
|
|
34
|
+
* other key is a fixed colour the user can paint with.
|
|
35
|
+
*/
|
|
36
|
+
export declare const SKIN_PALETTE: Readonly<Record<string, string>>;
|
|
37
|
+
/** Order of swatches in the editor. */
|
|
38
|
+
export declare const PAINT_KEYS: string[];
|
|
39
|
+
/** Colours used only by face stamps; never tinted. */
|
|
40
|
+
export declare const FACE_PALETTE: Readonly<Record<string, string>>;
|
|
41
|
+
type Rows2 = readonly [string, string];
|
|
42
|
+
interface FaceDefinition {
|
|
43
|
+
eyes: Record<"open" | "blink" | "happy" | "wide" | "sad", Rows2>;
|
|
44
|
+
mouth: Record<"idle" | "open" | "o" | "frown", Rows2>;
|
|
45
|
+
blush: boolean;
|
|
46
|
+
}
|
|
47
|
+
export declare const FACES: Readonly<Record<FaceType, FaceDefinition>>;
|
|
48
|
+
/** Face stamp (8 x 4) for a face type and expression; `.` is transparent. */
|
|
49
|
+
export declare function faceStamp(face: FaceType, expression: CharacterExpression): string[];
|
|
50
|
+
/** Body palette with the outfit colour applied to the `B`/`L`/`D` keys. */
|
|
51
|
+
export declare function bodyPalette(outfitColor?: string): Record<string, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Final colour of every body-map pixel: the drawing, with the face stamp for
|
|
54
|
+
* the expression painted over the front. Row-major, BODY_HEIGHT x BODY_WIDTH.
|
|
55
|
+
*/
|
|
56
|
+
export declare function composeSkin(skin: CharacterSkin, expression: CharacterExpression, outfitColor?: string,
|
|
57
|
+
/** Columns the eyes slide by. The mouth and blush never move (the eyes-only gaze rule). */
|
|
58
|
+
look?: number,
|
|
59
|
+
/**
|
|
60
|
+
* Rows the eyes slide by: -1 up. Down (+1) is clamped to 0 (Q9, owner decision 2026-10-21, PR #327), so no eye
|
|
61
|
+
* pixel lands on the mouth row. The mouth and blush never move.
|
|
62
|
+
*/
|
|
63
|
+
lookY?: number,
|
|
64
|
+
/** Off for the 3D body: the face is a decal on the front, not a stamp in the body texture. */
|
|
65
|
+
drawFace?: boolean,
|
|
66
|
+
/** 2 draws every face pixel as a 2x2 block, for the 3D body where the texture is stretched. */
|
|
67
|
+
faceScale?: number): string[][];
|
|
68
|
+
/** A blank body map filled with one key. */
|
|
69
|
+
export declare function blankBody(key?: string): string[];
|
|
70
|
+
/** Outfit colours used to show a crowd of buddies. */
|
|
71
|
+
export declare const BUDDY_TINTS: readonly ["#2f6fed", "#e2574c", "#3fae74", "#e6a23c", "#8a5ad8"];
|
|
72
|
+
/**
|
|
73
|
+
* Plup's own look, for every surface that shows Plup without a player's drawing: the landing, a guest in
|
|
74
|
+
* the lobby, headshots. The sparkle face (eyes with a catch-light, a resting smile) is the face the
|
|
75
|
+
* films and the landing use; the guest lobby wore the plain dot face, so one character read as two.
|
|
76
|
+
*/
|
|
77
|
+
export declare const DEFAULT_BUDDY_SKIN: CharacterSkin;
|
|
78
|
+
/** Clamp unknown or malformed stored drawings back to a valid map. */
|
|
79
|
+
export declare function sanitizeSkin(value: unknown): CharacterSkin;
|
|
80
|
+
/**
|
|
81
|
+
* A random character worth keeping: a colour, a face and one of a few patterns painted over the
|
|
82
|
+
* default body (none, a belly, stripes, spots), in a second colour that is not the body's own.
|
|
83
|
+
*/
|
|
84
|
+
export declare function randomSkin(): {
|
|
85
|
+
skin: CharacterSkin;
|
|
86
|
+
tint: string;
|
|
87
|
+
};
|
|
88
|
+
/** Texels per skin pixel when a skin is painted for display (body texture, headshot). */
|
|
89
|
+
export declare const SKIN_DETAIL = 4;
|
|
90
|
+
/**
|
|
91
|
+
* Which face key sits on which skin pixel, with the same placement rules as `composeSkin` (eyes follow
|
|
92
|
+
* the gaze, up only; mouth and blush never move). `painSkinDetailed` uses it to draw the face finer.
|
|
93
|
+
*/
|
|
94
|
+
export declare function faceKeys(skin: CharacterSkin, expression: CharacterExpression, look?: number, lookY?: number,
|
|
95
|
+
/** False leaves the eyes out: `paintEyesSmooth` draws them, so they can move between cells. */
|
|
96
|
+
withEyes?: boolean): Map<string, string>;
|
|
97
|
+
/**
|
|
98
|
+
* Paint a composed skin at `SKIN_DETAIL` texels per pixel. The body stays chunky pixel art; the face
|
|
99
|
+
* keeps its exact cells and size but is drawn finer, so a large character does not read as black bars
|
|
100
|
+
* and a red block: eyes are rounded with a light glint, the mouth is a thin rounded stroke, blush is a
|
|
101
|
+
* soft dash. `body` is the skin without the face (composeSkin with drawFace off), for what lies under it.
|
|
102
|
+
*/
|
|
103
|
+
export declare function paintSkinDetailed(context: CanvasRenderingContext2D, pixels: string[][], body: string[][], keys: Map<string, string>, from?: {
|
|
104
|
+
x: number;
|
|
105
|
+
y: number;
|
|
106
|
+
w: number;
|
|
107
|
+
h: number;
|
|
108
|
+
}, soften?: (fill: string) => string): void;
|
|
109
|
+
/**
|
|
110
|
+
* The eyes, drawn on their own so they move smoothly. Pixel is how the character is drawn, not how it moves:
|
|
111
|
+
* the eyes keep their pixel-art cells and rounded shape, but they slide by a fraction of a cell (the canvas
|
|
112
|
+
* antialiases the edge) and a blink is the eye closing by `openness` (1 open, 0 shut), not one stamp swapped
|
|
113
|
+
* for another. Call after `paintSkinDetailed` with the face drawn without eyes (`faceKeys`' `withEyes` off).
|
|
114
|
+
*/
|
|
115
|
+
export declare function paintEyesSmooth(context: CanvasRenderingContext2D, skin: CharacterSkin, expression: CharacterExpression, offset: {
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
}, openness: number, from?: {
|
|
119
|
+
x: number;
|
|
120
|
+
y: number;
|
|
121
|
+
w: number;
|
|
122
|
+
h: number;
|
|
123
|
+
}): void;
|
|
124
|
+
/** Bodies a character can wear. Same skeleton in each: only the blob's proportions change. */
|
|
125
|
+
export declare const BODY_SHAPES: {
|
|
126
|
+
readonly plup: {
|
|
127
|
+
readonly x: 1;
|
|
128
|
+
readonly y: 1;
|
|
129
|
+
};
|
|
130
|
+
readonly tall: {
|
|
131
|
+
readonly x: 0.88;
|
|
132
|
+
readonly y: 1.25;
|
|
133
|
+
};
|
|
134
|
+
readonly wide: {
|
|
135
|
+
readonly x: 1.2;
|
|
136
|
+
readonly y: 0.85;
|
|
137
|
+
};
|
|
138
|
+
readonly mini: {
|
|
139
|
+
readonly x: 0.82;
|
|
140
|
+
readonly y: 0.82;
|
|
141
|
+
};
|
|
142
|
+
readonly bean: {
|
|
143
|
+
readonly x: 0.72;
|
|
144
|
+
readonly y: 1.35;
|
|
145
|
+
};
|
|
146
|
+
};
|
|
147
|
+
export type BodyShapeId = keyof typeof BODY_SHAPES;
|
|
148
|
+
/** Roblox-format clothing templates (585x559), as data URLs, painted onto Plup's own body. */
|
|
149
|
+
export type PlupClothing = {
|
|
150
|
+
shirt?: string;
|
|
151
|
+
pants?: string;
|
|
152
|
+
};
|
|
153
|
+
/** A stable colour for someone whose look we do not have: the same name always gets the same tint. */
|
|
154
|
+
export declare function tintForName(name: string): string | undefined;
|
|
155
|
+
export {};
|
package/dist/skin-map.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BODY_HEIGHT,
|
|
3
|
+
BODY_SHAPES,
|
|
4
|
+
BODY_WIDTH,
|
|
5
|
+
BUDDY_TINTS,
|
|
6
|
+
DEFAULT_BUDDY_SKIN,
|
|
7
|
+
EXPRESSIONS,
|
|
8
|
+
FACES,
|
|
9
|
+
FACE_COLUMN,
|
|
10
|
+
FACE_PALETTE,
|
|
11
|
+
FACE_ROW,
|
|
12
|
+
FACE_TYPES,
|
|
13
|
+
PAINT_KEYS,
|
|
14
|
+
SKIN_DETAIL,
|
|
15
|
+
SKIN_PALETTE,
|
|
16
|
+
blankBody,
|
|
17
|
+
bodyPalette,
|
|
18
|
+
composeSkin,
|
|
19
|
+
faceKeys,
|
|
20
|
+
faceStamp,
|
|
21
|
+
isNamedExpression,
|
|
22
|
+
paintEyesSmooth,
|
|
23
|
+
paintSkinDetailed,
|
|
24
|
+
randomSkin,
|
|
25
|
+
sanitizeSkin,
|
|
26
|
+
tintForName
|
|
27
|
+
} from "./chunk-kber92gm.js";
|
|
28
|
+
import"./chunk-aa5nstet.js";
|
|
29
|
+
export {
|
|
30
|
+
tintForName,
|
|
31
|
+
sanitizeSkin,
|
|
32
|
+
randomSkin,
|
|
33
|
+
paintSkinDetailed,
|
|
34
|
+
paintEyesSmooth,
|
|
35
|
+
isNamedExpression,
|
|
36
|
+
faceStamp,
|
|
37
|
+
faceKeys,
|
|
38
|
+
composeSkin,
|
|
39
|
+
bodyPalette,
|
|
40
|
+
blankBody,
|
|
41
|
+
SKIN_PALETTE,
|
|
42
|
+
SKIN_DETAIL,
|
|
43
|
+
PAINT_KEYS,
|
|
44
|
+
FACE_TYPES,
|
|
45
|
+
FACE_ROW,
|
|
46
|
+
FACE_PALETTE,
|
|
47
|
+
FACE_COLUMN,
|
|
48
|
+
FACES,
|
|
49
|
+
EXPRESSIONS,
|
|
50
|
+
DEFAULT_BUDDY_SKIN,
|
|
51
|
+
BUDDY_TINTS,
|
|
52
|
+
BODY_WIDTH,
|
|
53
|
+
BODY_SHAPES,
|
|
54
|
+
BODY_HEIGHT
|
|
55
|
+
};
|
package/dist/skin-native.d.ts
CHANGED
|
@@ -74,23 +74,26 @@ export type SkinImage = object;
|
|
|
74
74
|
* bounded, not fixed, because a kid-sized ("bocil") and a tall character are the same rig at a
|
|
75
75
|
* different stature, and a muscular arm is the same bone with a wider box.
|
|
76
76
|
*
|
|
77
|
-
* - stature 0.5-1.
|
|
77
|
+
* - stature 0.5-1.5: the whole body, uniformly. 0.5 is "bocil" — half size, still the same
|
|
78
78
|
* creature — and it is the floor because at 32 px per stud the smallest screen a character is
|
|
79
79
|
* drawn on still gets one device pixel per native texel at 0.5; below it the 32 x 64 limb faces
|
|
80
|
-
* and the face stamp stop reading as art. 1.
|
|
81
|
-
*
|
|
80
|
+
* and the face stamp stop reading as art. 1.5 is the tall end of the usable range: the owner
|
|
81
|
+
* raised the ceiling from 1.15 to 1.5 when height became a property of the equipped body model
|
|
82
|
+
* (`platform-body.ts`) instead of a free slider, so the three platform bodies — bocil, normal and
|
|
83
|
+
* tall — span the whole clamp. Nothing collides differently: `canonicalFootprint` ignores this
|
|
84
|
+
* number, and `visualEnvelope` is what grows.
|
|
82
85
|
* - width 0.9-1.3: across the body only (x in the front view, z in the side view), so an arm can
|
|
83
86
|
* be 30% thicker without getting 30% longer. 0.9 is the thinnest silhouette that still covers the
|
|
84
87
|
* native face rect's edges; 1.3 is the widest a limb may be before it reads as a different part.
|
|
85
88
|
* - head 0.9-1.25: a big head is a style, and 1.25 is where it stops swallowing the torso.
|
|
86
89
|
*
|
|
87
|
-
* These are the numbers
|
|
88
|
-
* copied clamp is a second balance rule; there is one.
|
|
90
|
+
* These are the numbers every surface imports — the listing validator, the renderer, the sandbox's
|
|
91
|
+
* sliders and the seeded platform bodies. A copied clamp is a second balance rule; there is one.
|
|
89
92
|
*/
|
|
90
93
|
export declare const BODY_SCALE_LIMITS: {
|
|
91
94
|
readonly stature: {
|
|
92
95
|
readonly min: 0.5;
|
|
93
|
-
readonly max: 1.
|
|
96
|
+
readonly max: 1.5;
|
|
94
97
|
};
|
|
95
98
|
readonly width: {
|
|
96
99
|
readonly min: 0.9;
|
|
@@ -101,6 +104,52 @@ export declare const BODY_SCALE_LIMITS: {
|
|
|
101
104
|
readonly max: 1.25;
|
|
102
105
|
};
|
|
103
106
|
};
|
|
107
|
+
/** The round Plup's own knobs, beyond the box rig's: its outline, its limbs' length and bulk. */
|
|
108
|
+
export declare const PLUP_BODY_LIMITS: {
|
|
109
|
+
readonly shoulders: {
|
|
110
|
+
readonly min: 0.7;
|
|
111
|
+
readonly max: 1.45;
|
|
112
|
+
};
|
|
113
|
+
readonly waist: {
|
|
114
|
+
readonly min: 0.62;
|
|
115
|
+
readonly max: 1.2;
|
|
116
|
+
};
|
|
117
|
+
readonly hips: {
|
|
118
|
+
readonly min: 0.75;
|
|
119
|
+
readonly max: 1.4;
|
|
120
|
+
};
|
|
121
|
+
/** Leg length: 1 is Plup's stubs, 3 is a long-legged runway walker. */
|
|
122
|
+
readonly legLength: {
|
|
123
|
+
readonly min: 1;
|
|
124
|
+
readonly max: 3;
|
|
125
|
+
};
|
|
126
|
+
readonly armLength: {
|
|
127
|
+
readonly min: 0.8;
|
|
128
|
+
readonly max: 1.8;
|
|
129
|
+
};
|
|
130
|
+
/** Arm and leg bulk, a muscular body's biceps. */
|
|
131
|
+
readonly muscle: {
|
|
132
|
+
readonly min: 0.7;
|
|
133
|
+
readonly max: 1.9;
|
|
134
|
+
};
|
|
135
|
+
/** Where the arms come out, as a share of the body's height (the films' rig puts them at 0.34). */
|
|
136
|
+
readonly shoulderHeight: {
|
|
137
|
+
readonly min: 0.2;
|
|
138
|
+
readonly max: 0.55;
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
export interface PlupBody {
|
|
142
|
+
shoulders: number;
|
|
143
|
+
waist: number;
|
|
144
|
+
hips: number;
|
|
145
|
+
legLength: number;
|
|
146
|
+
armLength: number;
|
|
147
|
+
muscle: number;
|
|
148
|
+
shoulderHeight: number;
|
|
149
|
+
}
|
|
150
|
+
export declare const CANONICAL_PLUP_BODY: PlupBody;
|
|
151
|
+
/** Clamp a Plup body the same way `clampBodyScale` clamps the rig's: missing or broken is canonical. */
|
|
152
|
+
export declare function clampPlupBody(body?: Partial<PlupBody> | null): PlupBody;
|
|
104
153
|
export interface BodyScale {
|
|
105
154
|
/** Uniform stature: every joint offset, bone length, pixel and the clip's lift. 0.5 is bocil. */
|
|
106
155
|
stature: number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Texture } from "three";
|
|
2
|
+
/**
|
|
3
|
+
* The filtering every Plup skin texture uses (ADR 0024). Up close a texel is a hard pixel (nearest);
|
|
4
|
+
* from far away the texture is mip-mapped and filtered, so a small Plup shows the average of the pixels
|
|
5
|
+
* under each screen pixel instead of a random one of them: with nearest both ways a small Plup's eye
|
|
6
|
+
* lost rows and columns and its face came out ragged.
|
|
7
|
+
*/
|
|
8
|
+
export declare function pixelArtFiltering<T extends Texture>(texture: T): T;
|
package/dist/three.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { Group } from "three";
|
|
2
2
|
import { type Emote } from "./emote";
|
|
3
|
+
export { buildWear } from "./dress";
|
|
4
|
+
export type { WearKit, WornPiece } from "./wear3d";
|
|
3
5
|
import { type ClipRef, type Pose } from "./pose";
|
|
4
6
|
export { type BodyShapeId, createPlup, type Expression, type PlupFace, type PlupHandle, type PlupOptions, type PlupSkin, } from "./plup3d";
|
|
7
|
+
export type { RagdollMode } from "./ragdoll";
|
|
5
8
|
import { type RigId } from "./rig";
|
|
6
9
|
import { type BodyScale, type CharacterLook } from "./skin-native";
|
|
7
10
|
export interface CharacterHandle {
|