@i7r.tech/moveby 0.0.21-ywc → 0.21.2-ywc
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/README.md +31 -0
- package/bin/moveby.js +431 -10
- package/bin/tooling/wasm_engine_bg.wasm +0 -0
- package/dist/engine/wasm_engine.d.ts +44 -16
- package/dist/engine/wasm_engine.js +60 -27
- package/dist/engine/wasm_engine_bg.wasm +0 -0
- package/dist/index.js +437 -225
- package/dist/passes/backdrop.d.ts +6 -1
- package/dist/passes/field.d.ts +4 -1
- package/dist/passes/road.d.ts +6 -2
- package/dist/passes/scenery.d.ts +3 -1
- package/dist/passes/sky.d.ts +1 -0
- package/dist/passes/text.d.ts +1 -0
- package/dist/scene.d.ts +16 -5
- package/dist/utils.d.ts +17 -6
- package/package.json +1 -1
|
@@ -21,28 +21,23 @@ export class Engine {
|
|
|
21
21
|
/**
|
|
22
22
|
* The live viewport aspect (canvasW / canvasH), for the scenery vertex shader's `u_aspect` — the
|
|
23
23
|
* ONLY place project-in-shader lets aspect enter the scenery projection (never baked into
|
|
24
|
-
* `
|
|
24
|
+
* the camera that `fill_camera` writes, so a stray second divide can't creep in). JS already knows this value locally (it
|
|
25
25
|
* computed it to call `set_aspect`); this getter exists so the scenery pass can read it back the
|
|
26
26
|
* same way every other per-frame uniform is read, off `&self`.
|
|
27
27
|
*/
|
|
28
28
|
aspect(): number;
|
|
29
|
-
/**
|
|
30
|
-
* The per-frame camera basis for the scenery vertex shader's projection: `[pos.x,y,z, forward.x,y,z]`
|
|
31
|
-
* (6 floats — NOT the 12 a naive `{pos,forward,right,up}` flattening would send). `right` and
|
|
32
|
-
* world-`up` are deliberately NOT included: `Camera::right()` DERIVES right from forward
|
|
33
|
-
* (`(forward.z, 0, −forward.x)`, camera.rs) rather than storing it, and `Camera::project`'s `cy` is
|
|
34
|
-
* just `ray.y` (world-up is the constant (0,1,0), never dotted). Sending only the minimal
|
|
35
|
-
* independent basis means the GLSL `project()` must derive `right` the same way — which is exactly
|
|
36
|
-
* what keeps it an auditable line-for-line mirror of `Camera::project` (camera.rs) rather than a
|
|
37
|
-
* second copy that could silently drift out of orthogonality.
|
|
38
|
-
*/
|
|
39
|
-
camera_basis(): Float32Array;
|
|
40
29
|
/**
|
|
41
30
|
* The focal length (`CAMERA_DEPTH`, consts.rs) for the scenery vertex shader's `u_cameraDepth`
|
|
42
31
|
* uniform — sent so a FOV change in Rust can't silently desync from a hardcoded GLSL literal (OQ4,
|
|
43
32
|
* project-in-shader.md; the same precedent `depth_bounds` already set for `u_scaleNear/Far`).
|
|
44
33
|
*/
|
|
45
34
|
camera_depth(): number;
|
|
35
|
+
/**
|
|
36
|
+
* The byte address of the camera scratch in WebAssembly memory: six `f32`, written by `fill_camera`.
|
|
37
|
+
* A query (`&self`). The address does not move for the life of the engine, so JavaScript reads it
|
|
38
|
+
* once.
|
|
39
|
+
*/
|
|
40
|
+
camera_ptr(): number;
|
|
46
41
|
/**
|
|
47
42
|
* The JS entry of the frame's value block (lib-value-entry): check the staging block that
|
|
48
43
|
* `value_view` handed out; on success copy it into the live block and seat the camera from its
|
|
@@ -73,6 +68,8 @@ export class Engine {
|
|
|
73
68
|
* `[u0, v0, u1, v1, start_vertex, count]` per bucket (the sub-rect as a per-draw `u_cellRect` uniform +
|
|
74
69
|
* the vertex range). The renderer draws these with the fract-tile program on the SHARED atlas (NEAREST/
|
|
75
70
|
* no-mips). CACHED like `field_draw_ranges` — valid only after this frame's `fill_field_*`, empty before.
|
|
71
|
+
*
|
|
72
|
+
* A VIEW, like `field_draw_ranges`: valid until the next call into WebAssembly.
|
|
76
73
|
*/
|
|
77
74
|
field_atlas_draw_ranges(): Float32Array;
|
|
78
75
|
/**
|
|
@@ -83,9 +80,29 @@ export class Engine {
|
|
|
83
80
|
* field-sized buffer every frame, the GC churn zero-copy kills): the CURRENT frame's buckets only
|
|
84
81
|
* after this frame's fill, **empty before the first fill**. Per-frame order:
|
|
85
82
|
* `seek → fill_field_and_view → bufferSubData → field_draw_ranges → bind+draw`.
|
|
83
|
+
*
|
|
84
|
+
* A VIEW of the cached list, not a copy (frame-static-memory): it aliases WebAssembly memory and is
|
|
85
|
+
* valid until the next call into WebAssembly. Read it at once, and take no engine call while a loop
|
|
86
|
+
* reads it. The Rust name has `_view` because the `cargo test` seam `EngineTestExt::field_draw_ranges`
|
|
87
|
+
* keeps the plain name and returns a `Vec`.
|
|
86
88
|
*/
|
|
87
89
|
field_draw_ranges(): Uint32Array;
|
|
88
90
|
fill_and_view(): Float32Array;
|
|
91
|
+
/**
|
|
92
|
+
* The per-frame camera basis for the scenery vertex shader's projection: `[pos.x,y,z, forward.x,y,z]`
|
|
93
|
+
* (6 floats — NOT the 12 a naive `{pos,forward,right,up}` flattening would send). `right` and
|
|
94
|
+
* world-`up` are deliberately NOT included: `Camera::right()` DERIVES right from forward
|
|
95
|
+
* (`(forward.z, 0, −forward.x)`, camera.rs) rather than storing it, and `Camera::project`'s `cy` is
|
|
96
|
+
* just `ray.y` (world-up is the constant (0,1,0), never dotted). Sending only the minimal
|
|
97
|
+
* independent basis means the GLSL `project()` must derive `right` the same way — which is exactly
|
|
98
|
+
* what keeps it an auditable line-for-line mirror of `Camera::project` (camera.rs) rather than a
|
|
99
|
+
* second copy that could silently drift out of orthogonality.
|
|
100
|
+
*
|
|
101
|
+
* This writes the six floats into the engine's own scratch; it returns nothing. JavaScript reads
|
|
102
|
+
* them through two views over that scratch (`camera_ptr`, `wasm_memory`), and calls this once per
|
|
103
|
+
* frame, after the frame's position is set. The views stay valid until WebAssembly memory grows.
|
|
104
|
+
*/
|
|
105
|
+
fill_camera(): void;
|
|
89
106
|
fill_field_and_view(): Float32Array;
|
|
90
107
|
fill_scenery_and_view(): Float32Array;
|
|
91
108
|
fill_text_and_view(): Float32Array;
|
|
@@ -197,6 +214,8 @@ export class Engine {
|
|
|
197
214
|
* `field_draw_ranges` idiom — re-emitting would re-allocate a text-sized buffer every frame): valid only
|
|
198
215
|
* after THIS frame's `fill_text_*`, **empty before the first fill**. Per-frame order:
|
|
199
216
|
* `seek → fill_text_and_view → bufferSubData → text_draw_ranges → draw`.
|
|
217
|
+
*
|
|
218
|
+
* A VIEW, like `field_draw_ranges`: valid until the next call into WebAssembly.
|
|
200
219
|
*/
|
|
201
220
|
text_draw_ranges(): Float32Array;
|
|
202
221
|
/**
|
|
@@ -214,6 +233,13 @@ export class Engine {
|
|
|
214
233
|
* the view allocates nothing in WebAssembly memory.
|
|
215
234
|
*/
|
|
216
235
|
value_view(): Float32Array;
|
|
236
|
+
/**
|
|
237
|
+
* The memory of the WebAssembly module that this engine lives in. JavaScript builds views over its
|
|
238
|
+
* `buffer` (`camera_ptr`); the `buffer` is replaced when the memory grows, and the views of the old one
|
|
239
|
+
* then have length 0. A method, not a free function, so a scene reads it from the engine it was
|
|
240
|
+
* given and imports no module.
|
|
241
|
+
*/
|
|
242
|
+
wasm_memory(): WebAssembly.Memory;
|
|
217
243
|
}
|
|
218
244
|
|
|
219
245
|
/**
|
|
@@ -266,14 +292,15 @@ export interface InitOutput {
|
|
|
266
292
|
readonly __wbg_engine_free: (a: number, b: number) => void;
|
|
267
293
|
readonly __wbg_rows_free: (a: number, b: number) => void;
|
|
268
294
|
readonly engine_aspect: (a: number) => number;
|
|
269
|
-
readonly engine_camera_basis: (a: number) => [number, number];
|
|
270
295
|
readonly engine_camera_depth: (a: number) => number;
|
|
296
|
+
readonly engine_camera_ptr: (a: number) => number;
|
|
271
297
|
readonly engine_commit_value_block: (a: number) => number;
|
|
272
298
|
readonly engine_dash_anchor: (a: number) => number;
|
|
273
299
|
readonly engine_depth_bounds: (a: number) => [number, number];
|
|
274
|
-
readonly engine_field_atlas_draw_ranges: (a: number) =>
|
|
275
|
-
readonly engine_field_draw_ranges: (a: number) =>
|
|
300
|
+
readonly engine_field_atlas_draw_ranges: (a: number) => any;
|
|
301
|
+
readonly engine_field_draw_ranges: (a: number) => any;
|
|
276
302
|
readonly engine_fill_and_view: (a: number) => any;
|
|
303
|
+
readonly engine_fill_camera: (a: number) => void;
|
|
277
304
|
readonly engine_fill_field_and_view: (a: number) => any;
|
|
278
305
|
readonly engine_fill_scenery_and_view: (a: number) => any;
|
|
279
306
|
readonly engine_fill_text_and_view: (a: number) => any;
|
|
@@ -292,9 +319,10 @@ export interface InitOutput {
|
|
|
292
319
|
readonly engine_set_aspect: (a: number, b: number) => void;
|
|
293
320
|
readonly engine_set_camera_offset: (a: number, b: number, c: number) => void;
|
|
294
321
|
readonly engine_sky_parallax: (a: number) => number;
|
|
295
|
-
readonly engine_text_draw_ranges: (a: number) =>
|
|
322
|
+
readonly engine_text_draw_ranges: (a: number) => any;
|
|
296
323
|
readonly engine_track_length: (a: number) => number;
|
|
297
324
|
readonly engine_value_view: (a: number) => any;
|
|
325
|
+
readonly engine_wasm_memory: (a: number) => any;
|
|
298
326
|
readonly rows_asset: (a: number, b: number, c: number, d: number) => void;
|
|
299
327
|
readonly rows_image: (a: number, b: number) => void;
|
|
300
328
|
readonly rows_new: () => number;
|
|
@@ -34,7 +34,7 @@ export class Engine {
|
|
|
34
34
|
/**
|
|
35
35
|
* The live viewport aspect (canvasW / canvasH), for the scenery vertex shader's `u_aspect` — the
|
|
36
36
|
* ONLY place project-in-shader lets aspect enter the scenery projection (never baked into
|
|
37
|
-
* `
|
|
37
|
+
* the camera that `fill_camera` writes, so a stray second divide can't creep in). JS already knows this value locally (it
|
|
38
38
|
* computed it to call `set_aspect`); this getter exists so the scenery pass can read it back the
|
|
39
39
|
* same way every other per-frame uniform is read, off `&self`.
|
|
40
40
|
* @returns {number}
|
|
@@ -43,23 +43,6 @@ export class Engine {
|
|
|
43
43
|
const ret = wasm.engine_aspect(this.__wbg_ptr);
|
|
44
44
|
return ret;
|
|
45
45
|
}
|
|
46
|
-
/**
|
|
47
|
-
* The per-frame camera basis for the scenery vertex shader's projection: `[pos.x,y,z, forward.x,y,z]`
|
|
48
|
-
* (6 floats — NOT the 12 a naive `{pos,forward,right,up}` flattening would send). `right` and
|
|
49
|
-
* world-`up` are deliberately NOT included: `Camera::right()` DERIVES right from forward
|
|
50
|
-
* (`(forward.z, 0, −forward.x)`, camera.rs) rather than storing it, and `Camera::project`'s `cy` is
|
|
51
|
-
* just `ray.y` (world-up is the constant (0,1,0), never dotted). Sending only the minimal
|
|
52
|
-
* independent basis means the GLSL `project()` must derive `right` the same way — which is exactly
|
|
53
|
-
* what keeps it an auditable line-for-line mirror of `Camera::project` (camera.rs) rather than a
|
|
54
|
-
* second copy that could silently drift out of orthogonality.
|
|
55
|
-
* @returns {Float32Array}
|
|
56
|
-
*/
|
|
57
|
-
camera_basis() {
|
|
58
|
-
const ret = wasm.engine_camera_basis(this.__wbg_ptr);
|
|
59
|
-
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
60
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
61
|
-
return v1;
|
|
62
|
-
}
|
|
63
46
|
/**
|
|
64
47
|
* The focal length (`CAMERA_DEPTH`, consts.rs) for the scenery vertex shader's `u_cameraDepth`
|
|
65
48
|
* uniform — sent so a FOV change in Rust can't silently desync from a hardcoded GLSL literal (OQ4,
|
|
@@ -70,6 +53,16 @@ export class Engine {
|
|
|
70
53
|
const ret = wasm.engine_camera_depth(this.__wbg_ptr);
|
|
71
54
|
return ret;
|
|
72
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* The byte address of the camera scratch in WebAssembly memory: six `f32`, written by `fill_camera`.
|
|
58
|
+
* A query (`&self`). The address does not move for the life of the engine, so JavaScript reads it
|
|
59
|
+
* once.
|
|
60
|
+
* @returns {number}
|
|
61
|
+
*/
|
|
62
|
+
camera_ptr() {
|
|
63
|
+
const ret = wasm.engine_camera_ptr(this.__wbg_ptr);
|
|
64
|
+
return ret >>> 0;
|
|
65
|
+
}
|
|
73
66
|
/**
|
|
74
67
|
* The JS entry of the frame's value block (lib-value-entry): check the staging block that
|
|
75
68
|
* `value_view` handed out; on success copy it into the live block and seat the camera from its
|
|
@@ -114,13 +107,13 @@ export class Engine {
|
|
|
114
107
|
* `[u0, v0, u1, v1, start_vertex, count]` per bucket (the sub-rect as a per-draw `u_cellRect` uniform +
|
|
115
108
|
* the vertex range). The renderer draws these with the fract-tile program on the SHARED atlas (NEAREST/
|
|
116
109
|
* no-mips). CACHED like `field_draw_ranges` — valid only after this frame's `fill_field_*`, empty before.
|
|
110
|
+
*
|
|
111
|
+
* A VIEW, like `field_draw_ranges`: valid until the next call into WebAssembly.
|
|
117
112
|
* @returns {Float32Array}
|
|
118
113
|
*/
|
|
119
114
|
field_atlas_draw_ranges() {
|
|
120
115
|
const ret = wasm.engine_field_atlas_draw_ranges(this.__wbg_ptr);
|
|
121
|
-
|
|
122
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
123
|
-
return v1;
|
|
116
|
+
return ret;
|
|
124
117
|
}
|
|
125
118
|
/**
|
|
126
119
|
* Per-texture field draw buckets from the LAST `fill_field_*`: a flat `[texture_id, start_vertex,
|
|
@@ -130,13 +123,16 @@ export class Engine {
|
|
|
130
123
|
* field-sized buffer every frame, the GC churn zero-copy kills): the CURRENT frame's buckets only
|
|
131
124
|
* after this frame's fill, **empty before the first fill**. Per-frame order:
|
|
132
125
|
* `seek → fill_field_and_view → bufferSubData → field_draw_ranges → bind+draw`.
|
|
126
|
+
*
|
|
127
|
+
* A VIEW of the cached list, not a copy (frame-static-memory): it aliases WebAssembly memory and is
|
|
128
|
+
* valid until the next call into WebAssembly. Read it at once, and take no engine call while a loop
|
|
129
|
+
* reads it. The Rust name has `_view` because the `cargo test` seam `EngineTestExt::field_draw_ranges`
|
|
130
|
+
* keeps the plain name and returns a `Vec`.
|
|
133
131
|
* @returns {Uint32Array}
|
|
134
132
|
*/
|
|
135
133
|
field_draw_ranges() {
|
|
136
134
|
const ret = wasm.engine_field_draw_ranges(this.__wbg_ptr);
|
|
137
|
-
|
|
138
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
139
|
-
return v1;
|
|
135
|
+
return ret;
|
|
140
136
|
}
|
|
141
137
|
/**
|
|
142
138
|
* @returns {Float32Array}
|
|
@@ -145,6 +141,23 @@ export class Engine {
|
|
|
145
141
|
const ret = wasm.engine_fill_and_view(this.__wbg_ptr);
|
|
146
142
|
return ret;
|
|
147
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* The per-frame camera basis for the scenery vertex shader's projection: `[pos.x,y,z, forward.x,y,z]`
|
|
146
|
+
* (6 floats — NOT the 12 a naive `{pos,forward,right,up}` flattening would send). `right` and
|
|
147
|
+
* world-`up` are deliberately NOT included: `Camera::right()` DERIVES right from forward
|
|
148
|
+
* (`(forward.z, 0, −forward.x)`, camera.rs) rather than storing it, and `Camera::project`'s `cy` is
|
|
149
|
+
* just `ray.y` (world-up is the constant (0,1,0), never dotted). Sending only the minimal
|
|
150
|
+
* independent basis means the GLSL `project()` must derive `right` the same way — which is exactly
|
|
151
|
+
* what keeps it an auditable line-for-line mirror of `Camera::project` (camera.rs) rather than a
|
|
152
|
+
* second copy that could silently drift out of orthogonality.
|
|
153
|
+
*
|
|
154
|
+
* This writes the six floats into the engine's own scratch; it returns nothing. JavaScript reads
|
|
155
|
+
* them through two views over that scratch (`camera_ptr`, `wasm_memory`), and calls this once per
|
|
156
|
+
* frame, after the frame's position is set. The views stay valid until WebAssembly memory grows.
|
|
157
|
+
*/
|
|
158
|
+
fill_camera() {
|
|
159
|
+
wasm.engine_fill_camera(this.__wbg_ptr);
|
|
160
|
+
}
|
|
148
161
|
/**
|
|
149
162
|
* @returns {Float32Array}
|
|
150
163
|
*/
|
|
@@ -367,13 +380,13 @@ export class Engine {
|
|
|
367
380
|
* `field_draw_ranges` idiom — re-emitting would re-allocate a text-sized buffer every frame): valid only
|
|
368
381
|
* after THIS frame's `fill_text_*`, **empty before the first fill**. Per-frame order:
|
|
369
382
|
* `seek → fill_text_and_view → bufferSubData → text_draw_ranges → draw`.
|
|
383
|
+
*
|
|
384
|
+
* A VIEW, like `field_draw_ranges`: valid until the next call into WebAssembly.
|
|
370
385
|
* @returns {Float32Array}
|
|
371
386
|
*/
|
|
372
387
|
text_draw_ranges() {
|
|
373
388
|
const ret = wasm.engine_text_draw_ranges(this.__wbg_ptr);
|
|
374
|
-
|
|
375
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
376
|
-
return v1;
|
|
389
|
+
return ret;
|
|
377
390
|
}
|
|
378
391
|
/**
|
|
379
392
|
* Total HORIZONTAL arc length of the loaded track (metres) — the upper bound of any field
|
|
@@ -398,6 +411,17 @@ export class Engine {
|
|
|
398
411
|
const ret = wasm.engine_value_view(this.__wbg_ptr);
|
|
399
412
|
return ret;
|
|
400
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* The memory of the WebAssembly module that this engine lives in. JavaScript builds views over its
|
|
416
|
+
* `buffer` (`camera_ptr`); the `buffer` is replaced when the memory grows, and the views of the old one
|
|
417
|
+
* then have length 0. A method, not a free function, so a scene reads it from the engine it was
|
|
418
|
+
* given and imports no module.
|
|
419
|
+
* @returns {WebAssembly.Memory}
|
|
420
|
+
*/
|
|
421
|
+
wasm_memory() {
|
|
422
|
+
const ret = wasm.engine_wasm_memory(this.__wbg_ptr);
|
|
423
|
+
return ret;
|
|
424
|
+
}
|
|
401
425
|
}
|
|
402
426
|
if (Symbol.dispose) Engine.prototype[Symbol.dispose] = Engine.prototype.free;
|
|
403
427
|
|
|
@@ -478,6 +502,10 @@ function __wbg_get_imports() {
|
|
|
478
502
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
479
503
|
return ret;
|
|
480
504
|
},
|
|
505
|
+
__wbg___wbindgen_memory_9751d9a3017e7c25: function() {
|
|
506
|
+
const ret = wasm.memory;
|
|
507
|
+
return ret;
|
|
508
|
+
},
|
|
481
509
|
__wbg___wbindgen_throw_ea4887a5f8f9a9db: function(arg0, arg1) {
|
|
482
510
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
483
511
|
},
|
|
@@ -486,6 +514,11 @@ function __wbg_get_imports() {
|
|
|
486
514
|
const ret = getArrayF32FromWasm0(arg0, arg1);
|
|
487
515
|
return ret;
|
|
488
516
|
},
|
|
517
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
518
|
+
// Cast intrinsic for `Ref(Slice(U32)) -> NamedExternref("Uint32Array")`.
|
|
519
|
+
const ret = getArrayU32FromWasm0(arg0, arg1);
|
|
520
|
+
return ret;
|
|
521
|
+
},
|
|
489
522
|
__wbindgen_init_externref_table: function() {
|
|
490
523
|
const table = wasm.__wbindgen_externrefs;
|
|
491
524
|
const offset = table.grow(4);
|
|
Binary file
|