@plupin/character 0.0.0-stage → 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.
Files changed (53) hide show
  1. package/dist/anime-face.d.ts +42 -0
  2. package/dist/anime-face.js +14 -0
  3. package/dist/blob.d.ts +32 -0
  4. package/dist/blob.js +18 -0
  5. package/dist/body-presets.d.ts +85 -0
  6. package/dist/canvas.d.ts +79 -0
  7. package/dist/canvas.js +315 -0
  8. package/dist/chunk-09c5tps4.js +337 -0
  9. package/dist/chunk-60p135hw.js +103 -0
  10. package/dist/chunk-aa5nstet.js +39 -0
  11. package/dist/chunk-dpb0rnw9.js +37 -0
  12. package/dist/chunk-g1c0wdcj.js +825 -0
  13. package/dist/chunk-kber92gm.js +415 -0
  14. package/dist/chunk-sa2r1cxz.js +342 -0
  15. package/dist/chunk-yd5zzkkg.js +313 -0
  16. package/dist/clip-bake.d.ts +48 -0
  17. package/dist/clip-bake.js +132 -0
  18. package/dist/clips.d.ts +40 -0
  19. package/dist/dress.d.ts +4 -0
  20. package/dist/emote.d.ts +25 -0
  21. package/dist/faces.d.ts +10 -0
  22. package/dist/faces.js +12 -0
  23. package/dist/gaze.d.ts +81 -0
  24. package/dist/gaze.js +113 -0
  25. package/dist/hair3d.d.ts +3 -0
  26. package/dist/index.d.ts +19 -0
  27. package/dist/index.js +176 -0
  28. package/dist/listing.d.ts +195 -0
  29. package/dist/listing.js +763 -0
  30. package/dist/named-faces.d.ts +22 -0
  31. package/dist/platform-body-data.d.ts +9 -0
  32. package/dist/platform-body.d.ts +91 -0
  33. package/dist/plup2d.d.ts +29 -0
  34. package/dist/plup3d.d.ts +121 -0
  35. package/dist/png.d.ts +78 -0
  36. package/dist/pose.d.ts +49 -0
  37. package/dist/pose.js +18 -0
  38. package/dist/proportions.d.ts +31 -0
  39. package/dist/ragdoll.d.ts +51 -0
  40. package/dist/resolution.d.ts +21 -0
  41. package/dist/rig.d.ts +29 -0
  42. package/dist/skin-map.d.ts +155 -0
  43. package/dist/skin-map.js +55 -0
  44. package/dist/skin-native.d.ts +301 -0
  45. package/dist/skin.d.ts +35 -0
  46. package/dist/texture.d.ts +8 -0
  47. package/dist/three.d.ts +25 -0
  48. package/dist/three.js +2302 -0
  49. package/dist/wear3d.d.ts +99 -0
  50. package/dist/wearables.d.ts +203 -0
  51. package/dist/wearables.js +26 -0
  52. package/package.json +78 -4
  53. package/README.md +0 -3
@@ -0,0 +1,99 @@
1
+ import { BufferGeometry, CanvasTexture, ExtrudeGeometry, Group, LatheGeometry, type Material, Mesh, Shape, type Texture } from "three";
2
+ import type { GarmentKey } from "./wearables";
3
+ /**
4
+ * The wearables in three.js. They are made to hold up in a film close-up, not only on a shop tile:
5
+ * shaped profiles and extruded outlines instead of bare primitives, cloth patterns drawn into
6
+ * textures, a satin or metal glint where the material has one, and secondary motion on springs: ears
7
+ * flop when Plup lands and sway when it turns, a skirt flares on a hop, a cape ripples.
8
+ *
9
+ * The toon bands, the glint and the ink outline come from the caller (`createPlup`), so a hat and the
10
+ * head it sits on are lit and outlined the same way. Every piece is placed in the blob's own
11
+ * coordinates (feet at y = 0, facing +z) under the body's scale, so it follows a wide belly or a big
12
+ * head like skin would.
13
+ */
14
+ export interface PaintOptions {
15
+ map?: Texture;
16
+ double?: boolean;
17
+ back?: string;
18
+ repeat?: readonly [number, number];
19
+ sheen?: number;
20
+ /** Anime hair shading wrapped round this centre (see `toon`). */
21
+ anime?: {
22
+ center: readonly [number, number, number];
23
+ ring?: number;
24
+ tip?: string;
25
+ inner?: string;
26
+ };
27
+ }
28
+ export interface WearKit {
29
+ /** A toon material in this colour, optionally patterned, two-sided, lined or glinting. */
30
+ paint: (color: string, options?: PaintOptions) => Material;
31
+ /** The ink outline (an inverted hull). */
32
+ ink: Material;
33
+ /** The body's half-width at a height (its silhouette), so a coat fits a muscular or a curvy body. */
34
+ radiusAt: (y: number) => number;
35
+ }
36
+ /** What the body is doing this frame, for the clothes to react to (units and radians per second). */
37
+ export interface WearMotion {
38
+ lift: number;
39
+ yaw: number;
40
+ }
41
+ export interface WornPiece {
42
+ object: Group;
43
+ tick?: (clock: number, delta: number, motion: WearMotion) => void;
44
+ dispose: () => void;
45
+ }
46
+ export declare const DEPTH: number;
47
+ export declare const TOP: number;
48
+ /** The middle of the eyes on the face stamp. */
49
+ export declare const EYES_Y = 0.53;
50
+ /** Just under the mouth: where a collar or a scarf sits on a body with no neck. */
51
+ export declare const COLLAR_Y = 0.27;
52
+ export declare const clamp: (value: number, min: number, max: number) => number;
53
+ export declare const smooth: (edge0: number, edge1: number, x: number) => number;
54
+ /** A damped spring: the secondary motion of everything that dangles. */
55
+ export declare class Spring {
56
+ private stiffness;
57
+ private damping;
58
+ value: number;
59
+ velocity: number;
60
+ constructor(stiffness: number, damping: number, start?: number);
61
+ step(target: number, delta: number): number;
62
+ kick(amount: number): void;
63
+ }
64
+ /** The body's motion, bounded: a camera cut or a teleport must not fling the clothes off. */
65
+ export declare const calm: (motion: WearMotion) => {
66
+ lift: number;
67
+ yaw: number;
68
+ };
69
+ export declare function canvasTexture(size: number, draw: (ctx: CanvasRenderingContext2D, size: number) => void): CanvasTexture<HTMLCanvasElement>;
70
+ /** A solid of revolution from (radius, height) pairs. */
71
+ export declare function lathe(profile: readonly (readonly [number, number])[], segments?: number): LatheGeometry;
72
+ /** An outline pushed into a soft slab, centred on its own middle. */
73
+ export declare function slab(shape: Shape, depth: number, bevel: number): ExtrudeGeometry;
74
+ /**
75
+ * A geometry that bends: its rest shape is kept, and `bend` curls it from the root (y = 0) towards
76
+ * the tip (y = length), forward/back by `pitch` and sideways by `roll`, more towards the tip, starting
77
+ * a share `from` of the way up. A floppy ear.
78
+ */
79
+ export declare function bendable(geometry: BufferGeometry, length: number): (pitch: number, roll: number, from?: number) => void;
80
+ export type Vec = readonly [number, number, number];
81
+ type Place = {
82
+ at?: Vec;
83
+ rotate?: Vec;
84
+ scale?: Vec;
85
+ parent?: Group;
86
+ };
87
+ type Look = PaintOptions & {
88
+ outline?: boolean;
89
+ };
90
+ export interface Builder {
91
+ add: (geometry: BufferGeometry, color: string, place?: Place, look?: Look) => Mesh;
92
+ glow: (geometry: BufferGeometry, color: string, opacity: number, place?: Place) => Mesh;
93
+ keep: (texture: Texture) => Texture;
94
+ node: (place?: Place) => Group;
95
+ }
96
+ export declare function piece(kit: WearKit, build: (b: Builder) => WornPiece["tick"] | undefined): WornPiece;
97
+ /** A hat, a garment or a face piece (hair is `hair3d.ts`). */
98
+ export declare function buildGarment(key: GarmentKey, kit: WearKit): WornPiece;
99
+ export {};
@@ -0,0 +1,203 @@
1
+ /**
2
+ * What Plup can put on: real 3D pieces in the same toon and ink style as the body (`hair3d.ts` and
3
+ * `wear3d.ts` build them), not pictures pasted on a 3D character. This file is data only (no
4
+ * three.js), so the server can seed the shop from the same list the renderer draws and the two cannot
5
+ * disagree.
6
+ *
7
+ * A wearable is sold as a cosmetic item whose id is `wear-<key>` and whose manifest is `{ wear: key }`.
8
+ * The id alone is enough to draw it: a lobby appearance carries item ids, never manifests.
9
+ *
10
+ * Three slots, worn together on top of the body colour (`outfit`): a hairstyle (`hair`), something on
11
+ * the head (`hat`: hats, ears, a halo) and a garment or face piece (`accessory`). A hat sits on the
12
+ * hair: each hairstyle says how much `volume` it adds, and the hat is lifted by that much.
13
+ */
14
+ type Entry = {
15
+ slot: "hair" | "hat" | "accessory";
16
+ name: string;
17
+ rarity: "common" | "rare" | "epic";
18
+ sigmaPrice: number;
19
+ /** Hair only: how far above the scalp it reaches, so a hat sits on it rather than in it. */
20
+ volume?: number;
21
+ /** The turn a still picture is taken at, when the front would hide it (a cape, a ponytail). */
22
+ view?: number;
23
+ };
24
+ export declare const WEARABLES: {
25
+ readonly "fluffy-bob": {
26
+ readonly slot: "hair";
27
+ readonly name: "Fluffy Bob";
28
+ readonly rarity: "common";
29
+ readonly sigmaPrice: 40;
30
+ readonly volume: 0.06;
31
+ };
32
+ readonly "twin-tails": {
33
+ readonly slot: "hair";
34
+ readonly name: "Twin Tails";
35
+ readonly rarity: "rare";
36
+ readonly sigmaPrice: 70;
37
+ readonly volume: 0.05;
38
+ };
39
+ readonly "spiky-hero": {
40
+ readonly slot: "hair";
41
+ readonly name: "Spiky Hero";
42
+ readonly rarity: "rare";
43
+ readonly sigmaPrice: 65;
44
+ readonly volume: 0.12;
45
+ };
46
+ readonly afro: {
47
+ readonly slot: "hair";
48
+ readonly name: "Afro";
49
+ readonly rarity: "rare";
50
+ readonly sigmaPrice: 60;
51
+ readonly volume: 0.2;
52
+ };
53
+ readonly "swoosh-quiff": {
54
+ readonly slot: "hair";
55
+ readonly name: "Swoosh Quiff";
56
+ readonly rarity: "common";
57
+ readonly sigmaPrice: 35;
58
+ readonly volume: 0.08;
59
+ };
60
+ readonly "long-waves": {
61
+ readonly slot: "hair";
62
+ readonly name: "Long Waves";
63
+ readonly rarity: "epic";
64
+ readonly sigmaPrice: 110;
65
+ readonly volume: 0.05;
66
+ readonly view: -0.9;
67
+ };
68
+ readonly ponytail: {
69
+ readonly slot: "hair";
70
+ readonly name: "Ponytail";
71
+ readonly rarity: "common";
72
+ readonly sigmaPrice: 45;
73
+ readonly volume: 0.05;
74
+ readonly view: -1.2;
75
+ };
76
+ readonly mohawk: {
77
+ readonly slot: "hair";
78
+ readonly name: "Mohawk";
79
+ readonly rarity: "rare";
80
+ readonly sigmaPrice: 55;
81
+ readonly volume: 0.14;
82
+ readonly view: -0.8;
83
+ };
84
+ readonly "space-buns": {
85
+ readonly slot: "hair";
86
+ readonly name: "Space Buns";
87
+ readonly rarity: "rare";
88
+ readonly sigmaPrice: 60;
89
+ readonly volume: 0.06;
90
+ };
91
+ readonly "hime-cut": {
92
+ readonly slot: "hair";
93
+ readonly name: "Hime Cut";
94
+ readonly rarity: "epic";
95
+ readonly sigmaPrice: 120;
96
+ readonly volume: 0.06;
97
+ readonly view: -0.6;
98
+ };
99
+ readonly "bunny-ears": {
100
+ readonly slot: "hat";
101
+ readonly name: "Bunny Ears";
102
+ readonly rarity: "rare";
103
+ readonly sigmaPrice: 60;
104
+ };
105
+ readonly "cat-ears": {
106
+ readonly slot: "hat";
107
+ readonly name: "Cat Ears";
108
+ readonly rarity: "common";
109
+ readonly sigmaPrice: 45;
110
+ };
111
+ readonly "top-hat": {
112
+ readonly slot: "hat";
113
+ readonly name: "Top Hat";
114
+ readonly rarity: "rare";
115
+ readonly sigmaPrice: 70;
116
+ };
117
+ readonly crown: {
118
+ readonly slot: "hat";
119
+ readonly name: "Crown";
120
+ readonly rarity: "epic";
121
+ readonly sigmaPrice: 150;
122
+ };
123
+ readonly "party-hat": {
124
+ readonly slot: "hat";
125
+ readonly name: "Party Hat";
126
+ readonly rarity: "common";
127
+ readonly sigmaPrice: 35;
128
+ };
129
+ readonly halo: {
130
+ readonly slot: "hat";
131
+ readonly name: "Halo";
132
+ readonly rarity: "epic";
133
+ readonly sigmaPrice: 120;
134
+ };
135
+ readonly bow: {
136
+ readonly slot: "hat";
137
+ readonly name: "Bow";
138
+ readonly rarity: "common";
139
+ readonly sigmaPrice: 30;
140
+ };
141
+ readonly "pleated-skirt": {
142
+ readonly slot: "accessory";
143
+ readonly name: "Pleated Skirt";
144
+ readonly rarity: "common";
145
+ readonly sigmaPrice: 50;
146
+ };
147
+ readonly tuxedo: {
148
+ readonly slot: "accessory";
149
+ readonly name: "Tuxedo";
150
+ readonly rarity: "epic";
151
+ readonly sigmaPrice: 140;
152
+ };
153
+ readonly "hero-cape": {
154
+ readonly slot: "accessory";
155
+ readonly name: "Hero Cape";
156
+ readonly rarity: "rare";
157
+ readonly sigmaPrice: 90;
158
+ readonly view: 2.6;
159
+ };
160
+ readonly scarf: {
161
+ readonly slot: "accessory";
162
+ readonly name: "Scarf";
163
+ readonly rarity: "common";
164
+ readonly sigmaPrice: 40;
165
+ };
166
+ readonly sunglasses: {
167
+ readonly slot: "accessory";
168
+ readonly name: "Sunglasses";
169
+ readonly rarity: "rare";
170
+ readonly sigmaPrice: 65;
171
+ };
172
+ };
173
+ export type WearKey = keyof typeof WEARABLES;
174
+ export type WearSlot = Entry["slot"];
175
+ export type HairKey = {
176
+ [K in WearKey]: (typeof WEARABLES)[K]["slot"] extends "hair" ? K : never;
177
+ }[WearKey];
178
+ export type GarmentKey = Exclude<WearKey, HairKey>;
179
+ export declare const WEAR_KEYS: WearKey[];
180
+ export declare const isWearKey: (value: unknown) => value is WearKey;
181
+ export declare const isHairKey: (key: WearKey) => key is HairKey;
182
+ /** How far a hairstyle reaches above the scalp: a hat worn with it is lifted this much. */
183
+ export declare const hairVolume: (key: WearKey) => number;
184
+ export declare const wearSlotOf: (key: WearKey) => WearSlot;
185
+ /** The wearable a cosmetic item id names, or null for any other item. */
186
+ export declare function wearKeyOf(itemId: string | null | undefined): WearKey | null;
187
+ export declare const wearItemId: (key: WearKey) => string;
188
+ /** The wearables a loadout or an appearance puts on, from its item ids, in a stable order. */
189
+ export declare function wearKeysOf(itemIds: readonly (string | null | undefined)[]): WearKey[];
190
+ /** The shop rows, one per wearable: what `ensureStarterCatalog` inserts. */
191
+ export declare function wearableItems(): {
192
+ id: string;
193
+ slot: "hair" | "hat" | "accessory";
194
+ name: string;
195
+ rarity: "common" | "rare" | "epic";
196
+ sigmaPrice: number;
197
+ assetConfig: {
198
+ wear: "fluffy-bob" | "twin-tails" | "spiky-hero" | "afro" | "swoosh-quiff" | "long-waves" | "ponytail" | "mohawk" | "space-buns" | "hime-cut" | "bunny-ears" | "cat-ears" | "top-hat" | "crown" | "party-hat" | "halo" | "bow" | "pleated-skirt" | "tuxedo" | "hero-cape" | "scarf" | "sunglasses";
199
+ };
200
+ }[];
201
+ /** The turn a still picture of this wearable is taken at: three-quarters, or from behind for a cape. */
202
+ export declare function wearView(key: WearKey | null | undefined): number;
203
+ export {};
@@ -0,0 +1,26 @@
1
+ import {
2
+ WEARABLES,
3
+ WEAR_KEYS,
4
+ hairVolume,
5
+ isHairKey,
6
+ isWearKey,
7
+ wearItemId,
8
+ wearKeyOf,
9
+ wearKeysOf,
10
+ wearSlotOf,
11
+ wearView,
12
+ wearableItems
13
+ } from "./chunk-60p135hw.js";
14
+ export {
15
+ wearableItems,
16
+ wearView,
17
+ wearSlotOf,
18
+ wearKeysOf,
19
+ wearKeyOf,
20
+ wearItemId,
21
+ isWearKey,
22
+ isHairKey,
23
+ hairVolume,
24
+ WEAR_KEYS,
25
+ WEARABLES
26
+ };
package/package.json CHANGED
@@ -1,6 +1,80 @@
1
1
  {
2
2
  "name": "@plupin/character",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Plup, the Plupin mascot, in three.js and canvas: createPlup, drawPlup2D, clips, emotes and the listing validator.",
5
+ "license": "UNLICENSED",
6
+ "type": "module",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js"
14
+ },
15
+ "./three": {
16
+ "types": "./dist/three.d.ts",
17
+ "import": "./dist/three.js"
18
+ },
19
+ "./canvas": {
20
+ "types": "./dist/canvas.d.ts",
21
+ "import": "./dist/canvas.js"
22
+ },
23
+ "./faces": {
24
+ "types": "./dist/faces.d.ts",
25
+ "import": "./dist/faces.js"
26
+ },
27
+ "./listing": {
28
+ "types": "./dist/listing.d.ts",
29
+ "import": "./dist/listing.js"
30
+ },
31
+ "./pose": {
32
+ "types": "./dist/pose.d.ts",
33
+ "import": "./dist/pose.js"
34
+ },
35
+ "./clip-bake": {
36
+ "types": "./dist/clip-bake.d.ts",
37
+ "import": "./dist/clip-bake.js"
38
+ },
39
+ "./skin-map": {
40
+ "types": "./dist/skin-map.d.ts",
41
+ "import": "./dist/skin-map.js"
42
+ },
43
+ "./gaze": {
44
+ "types": "./dist/gaze.d.ts",
45
+ "import": "./dist/gaze.js"
46
+ },
47
+ "./blob": {
48
+ "types": "./dist/blob.d.ts",
49
+ "import": "./dist/blob.js"
50
+ },
51
+ "./wearables": {
52
+ "types": "./dist/wearables.d.ts",
53
+ "import": "./dist/wearables.js"
54
+ },
55
+ "./anime-face": {
56
+ "types": "./dist/anime-face.d.ts",
57
+ "import": "./dist/anime-face.js"
58
+ }
59
+ },
60
+ "dependencies": {
61
+ "fflate": "^0.8.3"
62
+ },
63
+ "peerDependencies": {
64
+ "three": ">=0.160.0"
65
+ },
66
+ "peerDependenciesMeta": {
67
+ "three": {
68
+ "optional": true
69
+ }
70
+ },
71
+ "repository": {
72
+ "type": "git",
73
+ "url": "git+https://github.com/himanusia/plupin.git",
74
+ "directory": "packages/character"
75
+ },
76
+ "homepage": "https://plupin.com/docs",
77
+ "publishConfig": {
78
+ "access": "public"
79
+ }
80
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.