@motionscript/renderer 0.1.1-alpha.0 → 0.1.1-alpha.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/CHANGELOG.md +21 -0
- package/dist/browser/index.js +8 -8
- package/dist/browser/index.js.map +2 -2
- package/dist/browser/manifest.json +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +18 -10
- package/dist/index.js.map +1 -1
- package/dist/ms_renderer_bg.wasm +0 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ export declare class ShaderPreview {
|
|
|
152
152
|
destroy(): void;
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
/** Experimental: the bytes of an export stream for
|
|
155
|
+
/** Experimental: the bytes of an export stream for a native host process, as recorded so far. */
|
|
156
156
|
export interface NativeExportStream {
|
|
157
157
|
/** Bytes waiting to be taken. */
|
|
158
158
|
readonly size: number;
|
|
@@ -161,16 +161,16 @@ export interface NativeExportStream {
|
|
|
161
161
|
take(): Uint8Array;
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
-
/** Experimental: a render context whose frames go to
|
|
164
|
+
/** Experimental: a render context whose frames go to a native host process (`crates/renderer/src/replay.rs`). */
|
|
165
165
|
export type NativeExportContext = EngineRenderContext & {
|
|
166
166
|
readonly out: NativeExportStream;
|
|
167
167
|
/** The scene as last drawn is the next video frame. */
|
|
168
168
|
frameDone(): void;
|
|
169
|
-
/** Images handed to the
|
|
169
|
+
/** Images handed to the host, and the ms spent reading their pixels. */
|
|
170
170
|
readonly recorder: { imageUploads: number; imageMs: number };
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
-
/** The export stream's record kinds (`crates/
|
|
173
|
+
/** The export stream's record kinds (`crates/renderer/src/replay.rs`). */
|
|
174
174
|
export declare const NATIVE_RECORD: {
|
|
175
175
|
readonly BEGIN: 1; readonly APPLY: 2; readonly FONT: 3; readonly IMAGE: 4; readonly SURFACE: 5; readonly SCENE3D: 6;
|
|
176
176
|
readonly SCENE3D_BIND: 7; readonly SCENE3D_PIXELS: 8; readonly FREE_IMAGE: 9; readonly SHADER_ADD: 10; readonly SHADER_BUILD: 11;
|
package/dist/index.js
CHANGED
|
@@ -7495,6 +7495,7 @@ function writeMaterial(w, m, report, textures) {
|
|
|
7495
7495
|
if (bag.depthTest === false) flags |= 128;
|
|
7496
7496
|
if (bag.depthWrite !== void 0) flags |= 256 | (bag.depthWrite ? 512 : 0);
|
|
7497
7497
|
if (bag.sizeAttenuation === false) flags |= 1024;
|
|
7498
|
+
if (bag.polygonOffset === true) flags |= 2048;
|
|
7498
7499
|
w.u(flags);
|
|
7499
7500
|
w.u(FACES[bag.faces ?? "front"] ?? 0);
|
|
7500
7501
|
w.u(BLEND$1[bag.blend ?? "normal"] ?? 0);
|
|
@@ -7514,6 +7515,8 @@ function writeMaterial(w, m, report, textures) {
|
|
|
7514
7515
|
w.f(bag.gapSize);
|
|
7515
7516
|
w.f(bag.scale);
|
|
7516
7517
|
writeMap(w, m.type === "toon" ? bag.gradientMap : void 0, textures, report);
|
|
7518
|
+
w.f(bag.polygonOffsetFactor);
|
|
7519
|
+
w.f(bag.polygonOffsetUnits);
|
|
7517
7520
|
}
|
|
7518
7521
|
function writeLight(w, l, t) {
|
|
7519
7522
|
const bag = l;
|
|
@@ -7568,7 +7571,7 @@ function encodeScene3D(scene, report = { unsupported: /* @__PURE__ */ new Set()
|
|
|
7568
7571
|
w.u(geometries.ref(g, scopes[scopes.length - 1], kind, report));
|
|
7569
7572
|
};
|
|
7570
7573
|
w.u(MAGIC);
|
|
7571
|
-
w.u(
|
|
7574
|
+
w.u(4);
|
|
7572
7575
|
const tone = scene.toneSettings();
|
|
7573
7576
|
w.u(TONE[tone?.mapping ?? "aces"] ?? 4);
|
|
7574
7577
|
w.f(tone?.exposure);
|
|
@@ -10205,7 +10208,10 @@ var utf8$1 = new TextEncoder();
|
|
|
10205
10208
|
var KEEP_UNUSED = 120;
|
|
10206
10209
|
function hashWords(words) {
|
|
10207
10210
|
let h = 2166136261;
|
|
10208
|
-
for (let i = 0; i < words.length; i++)
|
|
10211
|
+
for (let i = 0; i < words.length; i++) {
|
|
10212
|
+
h = Math.imul(h ^ words[i], 16777619);
|
|
10213
|
+
h ^= h >>> 15;
|
|
10214
|
+
}
|
|
10209
10215
|
return h >>> 0;
|
|
10210
10216
|
}
|
|
10211
10217
|
/** FNV-1a over a path's verbs and point bits, twice with different seeds. */
|
|
@@ -10218,7 +10224,9 @@ function pathKey(d) {
|
|
|
10218
10224
|
}
|
|
10219
10225
|
for (let i = 0; i < bits.length; i++) {
|
|
10220
10226
|
a = Math.imul(a ^ bits[i], 16777619);
|
|
10227
|
+
a ^= a >>> 15;
|
|
10221
10228
|
b = Math.imul(b ^ bits[i], 1540483477);
|
|
10229
|
+
b ^= b >>> 13;
|
|
10222
10230
|
}
|
|
10223
10231
|
return `${d.verbs.length}:${bits.length}:${a >>> 0}:${b >>> 0}`;
|
|
10224
10232
|
}
|
|
@@ -11785,7 +11793,7 @@ var RecordingRenderer = class {
|
|
|
11785
11793
|
return [...this.effects];
|
|
11786
11794
|
}
|
|
11787
11795
|
adapter_info() {
|
|
11788
|
-
return "native export
|
|
11796
|
+
return "native export host";
|
|
11789
11797
|
}
|
|
11790
11798
|
gpu_device() {
|
|
11791
11799
|
return null;
|
|
@@ -11854,7 +11862,7 @@ var RecordingRenderer = class {
|
|
|
11854
11862
|
free_image(id) {
|
|
11855
11863
|
this.out.record(REC.FREE_IMAGE, [id]);
|
|
11856
11864
|
}
|
|
11857
|
-
/** Validated here (the same naga build the
|
|
11865
|
+
/** Validated here (the same naga build the host runs), recorded for the host to compile. */
|
|
11858
11866
|
shader_add(id, kind, source) {
|
|
11859
11867
|
const report = validate_shader(kind, source);
|
|
11860
11868
|
if (JSON.parse(report).ok) this.out.record(REC.SHADER_ADD, [id, kind], utf8.encode(source));
|
|
@@ -11900,8 +11908,8 @@ var NativeExportContext = class extends WgpuRenderContext {
|
|
|
11900
11908
|
frameCount = 0;
|
|
11901
11909
|
/**
|
|
11902
11910
|
* `size` is the render target in pixels (the output times its
|
|
11903
|
-
* supersampling); `effects` the
|
|
11904
|
-
* index order (`
|
|
11911
|
+
* supersampling); `effects` the host renderer's built-in effect names in
|
|
11912
|
+
* its index order (`NativeRenderer::effect_names`).
|
|
11905
11913
|
*/
|
|
11906
11914
|
constructor(store, viewport, out, effects, size) {
|
|
11907
11915
|
const shaper = shaperFor(store);
|
|
@@ -12723,10 +12731,10 @@ async function createWgpuRenderer(options = {}) {
|
|
|
12723
12731
|
};
|
|
12724
12732
|
}
|
|
12725
12733
|
/**
|
|
12726
|
-
* Experimental: a render context that records the export stream for
|
|
12727
|
-
*
|
|
12728
|
-
* target in pixels; `effects` the
|
|
12729
|
-
* index order
|
|
12734
|
+
* Experimental: a render context that records the export stream for a native
|
|
12735
|
+
* host process (`ms-renderer`'s `replay`, feature `native`) instead of
|
|
12736
|
+
* drawing. `size` is the render target in pixels; `effects` the host
|
|
12737
|
+
* renderer's built-in effect names in its index order.
|
|
12730
12738
|
*/
|
|
12731
12739
|
function createNativeExportContext(storage, options) {
|
|
12732
12740
|
return new NativeExportContext(storage, options.viewport, new StreamWriter(), options.effects, options.size);
|