skinview3d-node 3.4.2-node.1
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/LICENSE +22 -0
- package/README.md +210 -0
- package/assets/minecraft.woff2 +0 -0
- package/libs/animation.d.ts +469 -0
- package/libs/model.d.ts +76 -0
- package/libs/nametag.d.ts +89 -0
- package/libs/skinview3d.cjs +2922 -0
- package/libs/skinview3d.d.ts +4 -0
- package/libs/skinview3d.mjs +2898 -0
- package/libs/utils/index.d.ts +3 -0
- package/libs/utils/load-image.d.ts +7 -0
- package/libs/utils/process.d.ts +7 -0
- package/libs/utils/types.d.ts +5 -0
- package/libs/viewer.d.ts +328 -0
- package/package.json +78 -0
package/libs/model.d.ts
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { NameTagObject } from './nametag.js';
|
|
2
|
+
import type { ModelType } from './utils/index.js';
|
|
3
|
+
import { Group, Mesh, Object3D, Texture } from 'three';
|
|
4
|
+
/**
|
|
5
|
+
* Notice that innerLayer and outerLayer may NOT be the direct children of the Group.
|
|
6
|
+
*/
|
|
7
|
+
export declare class BodyPart extends Group {
|
|
8
|
+
readonly innerLayer: Object3D;
|
|
9
|
+
readonly outerLayer: Object3D;
|
|
10
|
+
constructor(innerLayer: Object3D, outerLayer: Object3D);
|
|
11
|
+
}
|
|
12
|
+
export declare class SkinObject extends Group {
|
|
13
|
+
readonly head: BodyPart;
|
|
14
|
+
readonly body: BodyPart;
|
|
15
|
+
readonly rightArm: BodyPart;
|
|
16
|
+
readonly leftArm: BodyPart;
|
|
17
|
+
readonly rightLeg: BodyPart;
|
|
18
|
+
readonly leftLeg: BodyPart;
|
|
19
|
+
private modelListeners;
|
|
20
|
+
private slim;
|
|
21
|
+
private _map;
|
|
22
|
+
private layer1Material;
|
|
23
|
+
private layer1MaterialBiased;
|
|
24
|
+
private layer2Material;
|
|
25
|
+
private layer2MaterialBiased;
|
|
26
|
+
constructor();
|
|
27
|
+
get map(): Texture | null;
|
|
28
|
+
set map(newMap: Texture | null);
|
|
29
|
+
get modelType(): ModelType;
|
|
30
|
+
set modelType(value: ModelType);
|
|
31
|
+
private getBodyParts;
|
|
32
|
+
setInnerLayerVisible(value: boolean): void;
|
|
33
|
+
setOuterLayerVisible(value: boolean): void;
|
|
34
|
+
resetJoints(): void;
|
|
35
|
+
}
|
|
36
|
+
export declare class CapeObject extends Group {
|
|
37
|
+
readonly cape: Mesh;
|
|
38
|
+
private material;
|
|
39
|
+
constructor();
|
|
40
|
+
get map(): Texture | null;
|
|
41
|
+
set map(newMap: Texture | null);
|
|
42
|
+
}
|
|
43
|
+
export declare class ElytraObject extends Group {
|
|
44
|
+
readonly leftWing: Group;
|
|
45
|
+
readonly rightWing: Group;
|
|
46
|
+
private material;
|
|
47
|
+
constructor();
|
|
48
|
+
resetJoints(): void;
|
|
49
|
+
/**
|
|
50
|
+
* Mirrors the position & rotation of left wing,
|
|
51
|
+
* and apply them to the right wing.
|
|
52
|
+
*/
|
|
53
|
+
updateRightWing(): void;
|
|
54
|
+
get map(): Texture | null;
|
|
55
|
+
set map(newMap: Texture | null);
|
|
56
|
+
}
|
|
57
|
+
export declare class EarsObject extends Group {
|
|
58
|
+
readonly rightEar: Mesh;
|
|
59
|
+
readonly leftEar: Mesh;
|
|
60
|
+
private material;
|
|
61
|
+
constructor();
|
|
62
|
+
get map(): Texture | null;
|
|
63
|
+
set map(newMap: Texture | null);
|
|
64
|
+
}
|
|
65
|
+
export type BackEquipment = 'cape' | 'elytra';
|
|
66
|
+
export declare class PlayerObject extends Group {
|
|
67
|
+
readonly skin: SkinObject;
|
|
68
|
+
readonly cape: CapeObject;
|
|
69
|
+
readonly elytra: ElytraObject;
|
|
70
|
+
readonly ears: EarsObject;
|
|
71
|
+
nameTag?: NameTagObject;
|
|
72
|
+
constructor();
|
|
73
|
+
get backEquipment(): BackEquipment | null;
|
|
74
|
+
set backEquipment(value: BackEquipment | null);
|
|
75
|
+
resetJoints(): void;
|
|
76
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { Sprite } from 'three';
|
|
2
|
+
export interface NameTagOptions {
|
|
3
|
+
/**
|
|
4
|
+
* A font specification using the CSS value syntax.
|
|
5
|
+
*
|
|
6
|
+
* The default value uses `Minecraft` font from
|
|
7
|
+
* {@link https://github.com/South-Paw/typeface-minecraft | South-Paw/typeface-minecraft},
|
|
8
|
+
* which is available at `skinview3d/assets/minecraft.woff2`.
|
|
9
|
+
*
|
|
10
|
+
* In order to use this font, please add the `@font-face` rule to your CSS:
|
|
11
|
+
* ```css
|
|
12
|
+
* @font-face {
|
|
13
|
+
* font-family: 'Minecraft';
|
|
14
|
+
* src: url('/path/to/minecraft.woff2') format('woff2');
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
* Remember to replace the font URL based on your situation.
|
|
18
|
+
*
|
|
19
|
+
* @defaultValue `"48px Minecraft"`
|
|
20
|
+
*/
|
|
21
|
+
font?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to repaint the name tag after the desired font is loaded.
|
|
24
|
+
*
|
|
25
|
+
* The font specified in `font` option may not be available when a {@link NameTagObject} is created,
|
|
26
|
+
* especially when you are using a web font. In this case, a fallback font will be used.
|
|
27
|
+
*
|
|
28
|
+
* If `repaintAfterLoaded` is `true`, the name tag is repainted after the desired font is loaded.
|
|
29
|
+
* This process can be monitored using {@link NameTagObject.painted}.
|
|
30
|
+
*
|
|
31
|
+
* @defaultValue `true`
|
|
32
|
+
*/
|
|
33
|
+
repaintAfterLoaded?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* The space (in pixels) between the text and the border of the name tag.
|
|
36
|
+
*
|
|
37
|
+
* Order: **top**, **right**, **bottom**, **left** (clockwise).
|
|
38
|
+
*
|
|
39
|
+
* @defaultValue `[5, 10, 5, 10]`
|
|
40
|
+
*/
|
|
41
|
+
margin?: [number, number, number, number];
|
|
42
|
+
/**
|
|
43
|
+
* The color, gradient, or pattern used to draw the text.
|
|
44
|
+
*
|
|
45
|
+
* @defaultValue `"white"`
|
|
46
|
+
*/
|
|
47
|
+
textStyle?: string | CanvasGradient | CanvasPattern;
|
|
48
|
+
/**
|
|
49
|
+
* The color, gradient, or pattern used to draw the background.
|
|
50
|
+
*
|
|
51
|
+
* @defaultValue `"rgba(0,0,0,.25)"`
|
|
52
|
+
*/
|
|
53
|
+
backgroundStyle?: string | CanvasGradient | CanvasPattern;
|
|
54
|
+
/**
|
|
55
|
+
* The height of the name tag object.
|
|
56
|
+
*
|
|
57
|
+
* @defaultValue `4.0`
|
|
58
|
+
*/
|
|
59
|
+
height?: number;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A Minecraft name tag, i.e. a text label with background.
|
|
63
|
+
*/
|
|
64
|
+
export declare class NameTagObject extends Sprite {
|
|
65
|
+
/**
|
|
66
|
+
* A promise that is resolved after the name tag is fully painted.
|
|
67
|
+
*
|
|
68
|
+
* This will be a resolved promise, if
|
|
69
|
+
* {@link NameTagOptions.repaintAfterLoaded} is `false`, or
|
|
70
|
+
* the desired font is available when the `NameTagObject` is created.
|
|
71
|
+
*
|
|
72
|
+
* If {@link NameTagOptions.repaintAfterLoaded} is `true`, and
|
|
73
|
+
* the desired font hasn't been loaded when the `NameTagObject` is created,
|
|
74
|
+
* the name tag will be painted with the fallback font first, and then
|
|
75
|
+
* repainted with the desired font after it's loaded. This promise is
|
|
76
|
+
* resolved after repainting is done.
|
|
77
|
+
*/
|
|
78
|
+
readonly painted: Promise<void>;
|
|
79
|
+
private text;
|
|
80
|
+
private font;
|
|
81
|
+
private margin;
|
|
82
|
+
private textStyle;
|
|
83
|
+
private backgroundStyle;
|
|
84
|
+
private height;
|
|
85
|
+
private textMaterial;
|
|
86
|
+
constructor(text?: string, options?: NameTagOptions);
|
|
87
|
+
private loadAndPaint;
|
|
88
|
+
private paint;
|
|
89
|
+
}
|