@eidolonmc/wasm 0.0.1-alpha → 0.0.3-alpha

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/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@eidolonmc/wasm",
3
- "version": "0.0.1-alpha",
3
+ "version": "0.0.3-alpha",
4
4
  "description": "WebAssembly bindings for Eidolon Minecraft skin renderer",
5
+ "homepage": "https://github.com/bingling-sama/eidolon",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/bingling-sama/eidolon.git"
9
+ },
5
10
  "type": "module",
6
11
  "main": "./pkg/eidolon.js",
7
12
  "types": "./pkg/eidolon.d.ts",
@@ -13,16 +18,12 @@
13
18
  }
14
19
  },
15
20
  "files": [
16
- "pkg/eidolon_bg.wasm",
17
- "pkg/eidolon_bg.wasm.d.ts",
18
- "pkg/eidolon.js",
19
- "pkg/eidolon.d.ts",
20
- "pkg/package.json"
21
+ "pkg"
21
22
  ],
22
23
  "license": "MIT",
23
24
  "scripts": {
24
- "build": "wasm-pack build --target bundler --out-dir pkg",
25
- "build:dev": "wasm-pack build --dev --target bundler --out-dir pkg",
26
- "build:web": "wasm-pack build --target web --out-dir pkg/web"
25
+ "build": "wasm-pack build --target bundler --out-dir pkg && rm -f pkg/.gitignore",
26
+ "build:dev": "wasm-pack build --dev --target bundler --out-dir pkg && rm -f pkg/.gitignore",
27
+ "build:web": "wasm-pack build --target web --out-dir pkg/web && rm -f pkg/web/.gitignore"
27
28
  }
28
29
  }
@@ -0,0 +1,177 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Real-time canvas renderer — presents directly to a `<canvas>` element at 60fps.
6
+ *
7
+ * No readback, no PNG encode — GPU renders straight to the canvas swapchain.
8
+ */
9
+ export class CanvasRenderer {
10
+ private constructor();
11
+ free(): void;
12
+ [Symbol.dispose](): void;
13
+ /**
14
+ * Advance playback by a browser-provided frame delta in seconds.
15
+ */
16
+ advance_animation(delta_seconds: number): void;
17
+ /**
18
+ * Natural cycle duration of the selected animation, in seconds.
19
+ */
20
+ animation_duration(): number;
21
+ /**
22
+ * Whether a one-shot timeline has reached its final pose.
23
+ */
24
+ animation_finished(): boolean;
25
+ /**
26
+ * Whether the timeline is currently playing.
27
+ */
28
+ animation_playing(): boolean;
29
+ /**
30
+ * Current playback position in seconds.
31
+ */
32
+ animation_time(): number;
33
+ /**
34
+ * Offscreen render at high resolution, return encoded image bytes for download.
35
+ * Renders at the given size independently of the canvas.
36
+ * Supports "png" (default), "webp", and "jpeg"/"jpg".
37
+ */
38
+ capture_frame(width: number, height: number, format?: string | null): Promise<Uint8Array>;
39
+ /**
40
+ * Disable cape rendering.
41
+ */
42
+ clear_cape(): void;
43
+ /**
44
+ * Disable elytra rendering.
45
+ */
46
+ clear_elytra(): void;
47
+ /**
48
+ * Remove the player nametag.
49
+ */
50
+ clear_nametag(): void;
51
+ /**
52
+ * Disable skin/body rendering.
53
+ */
54
+ clear_skin(): void;
55
+ /**
56
+ * Current elytra pitch in degrees.
57
+ */
58
+ elytra_pitch(): number;
59
+ /**
60
+ * Current elytra opening angle in degrees.
61
+ */
62
+ elytra_spread(): number;
63
+ /**
64
+ * Load a cape from PNG bytes and enable cape rendering.
65
+ */
66
+ load_cape(bytes: Uint8Array): void;
67
+ /**
68
+ * Load a Back equipment atlas from PNG bytes and select Elytra presentation.
69
+ */
70
+ load_elytra(bytes: Uint8Array): void;
71
+ /**
72
+ * Load a skin from PNG bytes. Must be called before `render_frame`.
73
+ */
74
+ load_skin(bytes: Uint8Array): void;
75
+ /**
76
+ * Current nametag text, or `None` if hidden.
77
+ */
78
+ nametag(): string | undefined;
79
+ /**
80
+ * Whether nametag see-through occlusion is enabled.
81
+ */
82
+ nametag_see_through(): boolean;
83
+ /**
84
+ * Attach to a `<canvas>` element. Call as `await CanvasRenderer.new(canvas)`.
85
+ */
86
+ static new(canvas: HTMLCanvasElement): Promise<CanvasRenderer>;
87
+ /**
88
+ * Present one frame to the canvas. Call in a rAF loop at 60fps.
89
+ */
90
+ render_frame(): void;
91
+ /**
92
+ * Remove the manual elytra override and return control to the animation.
93
+ */
94
+ reset_elytra_angles(): void;
95
+ /**
96
+ * Update surface size after canvas resize. Call from ResizeObserver.
97
+ */
98
+ resize(width: number, height: number): void;
99
+ /**
100
+ * Seek the selected animation to an explicit position in seconds.
101
+ *
102
+ * Kept for compatibility with older browser clients; new clients should
103
+ * use `advance_animation` and the playback controls below.
104
+ */
105
+ sample_animation(time_seconds: number): void;
106
+ /**
107
+ * Select a procedural animation and reset it to phase zero.
108
+ */
109
+ set_animation(preset: string): void;
110
+ /**
111
+ * Select looping (`true`) or one-shot (`false`) playback.
112
+ */
113
+ set_animation_loop(looping: boolean): void;
114
+ /**
115
+ * Start or pause playback.
116
+ */
117
+ set_animation_playing(playing: boolean): void;
118
+ /**
119
+ * Set playback speed; values are clamped to the core timeline range.
120
+ */
121
+ set_animation_speed(speed: number): void;
122
+ /**
123
+ * Set background clear color. `r`,`g`,`b`,`a` in 0.0-1.0 range.
124
+ * Default is transparent black `(0,0,0,0)`.
125
+ */
126
+ set_background(r: number, g: number, b: number, a: number): void;
127
+ /**
128
+ * Set camera orbit. `yaw`/`pitch` in degrees, `scale` > 0 (higher = closer).
129
+ */
130
+ set_camera(yaw: number, pitch: number, scale: number): void;
131
+ /**
132
+ * Override elytra pitch and opening angle in degrees.
133
+ */
134
+ set_elytra_angles(pitch: number, spread: number): void;
135
+ /**
136
+ * Set or clear the player nametag. An empty string or whitespace removes the nametag.
137
+ */
138
+ set_nametag(text: string): void;
139
+ /**
140
+ * Set whether occluded nametag pixels remain visible at reduced opacity.
141
+ */
142
+ set_nametag_see_through(see_through: boolean): void;
143
+ /**
144
+ * Set posture by preset. `"stand"`, `"wave"`, `"walking"`, `"running"`, `"flying"`.
145
+ */
146
+ set_posture(preset: string): void;
147
+ /**
148
+ * Set arm width. `"classic"` (4px) or `"slim"` (3px).
149
+ */
150
+ set_skin_type(skin_type: string): void;
151
+ }
152
+
153
+ /**
154
+ * JS-accessible representation of a texture inspection report.
155
+ */
156
+ export class JsTextureReport {
157
+ private constructor();
158
+ free(): void;
159
+ [Symbol.dispose](): void;
160
+ readonly can_auto_upgrade: boolean;
161
+ readonly description: string;
162
+ readonly hd_scale: number;
163
+ readonly height: number;
164
+ readonly is_hd: boolean;
165
+ readonly kind: string;
166
+ readonly width: number;
167
+ }
168
+
169
+ /**
170
+ * Initialize `console_log` so Rust `log` macros print to the browser console.
171
+ */
172
+ export function init_logger(): void;
173
+
174
+ /**
175
+ * Inspect and classify a Minecraft texture from raw image bytes (e.g. PNG).
176
+ */
177
+ export function inspect_texture(bytes: Uint8Array): JsTextureReport;
package/pkg/eidolon.js ADDED
@@ -0,0 +1,9 @@
1
+ /* @ts-self-types="./eidolon.d.ts" */
2
+ import * as wasm from "./eidolon_bg.wasm";
3
+ import { __wbg_set_wasm } from "./eidolon_bg.js";
4
+
5
+ __wbg_set_wasm(wasm);
6
+ wasm.__wbindgen_start();
7
+ export {
8
+ CanvasRenderer, JsTextureReport, init_logger, inspect_texture
9
+ } from "./eidolon_bg.js";