alpha2 0.2.2 → 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.
- package/README.md +6 -4
- package/dist/containers.d.ts +89 -0
- package/dist/containers.js +150 -0
- package/dist/effects.d.ts +12 -2
- package/dist/frame-supply.d.ts +5 -0
- package/dist/generated/project-schema.d.ts +564 -100
- package/dist/generated/project-schema.js +36 -0
- package/dist/generated/project-shape.js +345 -55
- package/dist/geometry.d.ts +98 -0
- package/dist/geometry.js +71 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mediabunny.d.ts +33 -26
- package/dist/mediabunny.js +45 -14
- package/dist/player.d.ts +5 -0
- package/dist/project.d.ts +26 -2
- package/dist/project.js +358 -55
- package/dist/worker.js +1 -0
- package/package.json +9 -1
- package/wasm/alpha2_extensions_bg.wasm +0 -0
- package/wasm/alpha2_wasm.d.ts +116 -8
- package/wasm/alpha2_wasm.js +369 -34
- package/wasm/alpha2_wasm_bg.wasm +0 -0
- package/wasm/alpha2_wasm_bg.wasm.d.ts +16 -4
- /package/wasm/snippets/{alpha2-wasm-e7f44ec6b15db6c6 → alpha2-wasm-7f557ec9a60cc69b}/inline0.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-e7f44ec6b15db6c6 → alpha2-wasm-7f557ec9a60cc69b}/inline1.js +0 -0
- /package/wasm/snippets/{alpha2-wasm-e7f44ec6b15db6c6 → alpha2-wasm-7f557ec9a60cc69b}/inline2.js +0 -0
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install alpha2
|
|
|
13
13
|
- The WebAssembly modules need Chrome 96, Firefox 89 or Safari 16.4, or later.
|
|
14
14
|
- Serve `.wasm` files as `application/wasm`; otherwise the loader falls back to a slower way of compiling them and warns.
|
|
15
15
|
- Audio preview needs a cross-origin isolated page (`Cross-Origin-Opener-Policy: same-origin`, `Cross-Origin-Embedder-Policy: require-corp`).
|
|
16
|
-
- [mediabunny](https://www.npmjs.com/package/mediabunny) is an optional dependency, for the decoders and the MP4 writer in `alpha2/mediabunny`. It installs `@types/dom-webcodecs` 0.1.13, whose declarations clash with TypeScript 5.9's DOM library. A TypeScript application either compiles with `skipLibCheck` or adds `"overrides": { "@types/dom-webcodecs": "0.1.19" }` to its `package.json`; one that imports `alpha2/mediabunny` also needs `"ESNext.Disposable"` in its `lib`.
|
|
16
|
+
- [mediabunny](https://www.npmjs.com/package/mediabunny) is an optional dependency, for the decoders and the MP4, MOV, MKV and WebM writer in `alpha2/mediabunny`. It installs `@types/dom-webcodecs` 0.1.13, whose declarations clash with TypeScript 5.9's DOM library. A TypeScript application either compiles with `skipLibCheck` or adds `"overrides": { "@types/dom-webcodecs": "0.1.19" }` to its `package.json`; one that imports `alpha2/mediabunny` also needs `"ESNext.Disposable"` in its `lib`.
|
|
17
17
|
|
|
18
18
|
## Render a frame
|
|
19
19
|
|
|
@@ -66,7 +66,7 @@ for (;;) {
|
|
|
66
66
|
engine.endExport();
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
A `waiting` ticket names the source frames the next frame needs (`missingFrames`); upload them and ask again, and the export continues at the same frame. `beginExportFrame` can be called again before a readback resolves, so that the GPU renders the next frame while the last one is read back. `exportToSink` in `alpha2/exporter` runs an export this way into an encoder sink, and `
|
|
69
|
+
A `waiting` ticket names the source frames the next frame needs (`missingFrames`); upload them and ask again, and the export continues at the same frame. `beginExportFrame` can be called again before a readback resolves, so that the GPU renders the next frame while the last one is read back. `exportToSink` in `alpha2/exporter` runs an export this way into an encoder sink, and `MediabunnySink` in `alpha2/mediabunny` is a WebCodecs sink for it that writes MP4, MOV, MKV or WebM.
|
|
70
70
|
|
|
71
71
|
## Audio
|
|
72
72
|
|
|
@@ -87,24 +87,26 @@ For preview, `alpha2/audio-timeline` moves the mixed blocks to the audio thread
|
|
|
87
87
|
| `alpha2/builder` | `ProjectBuilder`: documents from seconds, with generated ids. |
|
|
88
88
|
| `alpha2/edit` | Editing operations on a project: split, trim, ripple, roll, slip, slide, retime, insert, overwrite, append, move. |
|
|
89
89
|
| `alpha2/captions` | SRT and WebVTT import into caption tracks. |
|
|
90
|
+
| `alpha2/geometry` | Shape geometry for editors, from the engine's own code: item bounds, hit tests, nearest points, path lengths, trims, resampling, convert to path, motion paths. |
|
|
90
91
|
| `alpha2/effects` | Effect definitions and the built-in catalog's types; `RuntimeEffectRegistry`, a typed wrapper for registering WGSL effects and effect resources at run time. |
|
|
91
92
|
| `alpha2/extensions`, `alpha2/extensions-wasm` | SVG, animated image, Lottie, OpenEXR and image sequence sources, from their own WebAssembly module (`loadExtensions`). |
|
|
92
93
|
| `alpha2/text` | Text rasterizers: `WasmTextRasterizer` (the engine's, the same pixels as a native export) and `OffscreenTextRasterizer` (the browser's). |
|
|
93
94
|
| `alpha2/assets` | Media identity, proxies and conform reports. |
|
|
94
95
|
| `alpha2/frame-supply` | `FrameSupply`: decodes and uploads the frames a time needs. |
|
|
95
96
|
| `alpha2/media` | Decoder contracts, `WebCodecsVideoDecoder`, `DecoderRefillCoordinator`. |
|
|
96
|
-
| `alpha2/mediabunny` | Decoders and an MP4 sink on mediabunny (an optional dependency). |
|
|
97
|
+
| `alpha2/mediabunny` | Decoders and an MP4, MOV, MKV and WebM sink on mediabunny (an optional dependency). |
|
|
97
98
|
| `alpha2/hdr-frames`, `alpha2/video-frames` | Uploading planar and HDR `VideoFrame`s; `VideoFrame`s from exported I420 planes. |
|
|
98
99
|
| `alpha2/player`, `alpha2/worker` | `Alpha2Player` and the render worker. |
|
|
99
100
|
| `alpha2/exporter` | `Alpha2Exporter` and `exportToSink`. |
|
|
100
101
|
| `alpha2/export-destination` | Where an export's bytes go: a file, or memory. |
|
|
101
102
|
| `alpha2/export-failure`, `alpha2/export-retry` | How export failures are classified, and a retry policy over them. |
|
|
103
|
+
| `alpha2/containers` | The export containers (MP4, MOV, MKV, WebM) and the codecs each offers. |
|
|
102
104
|
| `alpha2/rate-control` | Output bitrates for the engine's quality levels. |
|
|
103
105
|
| `alpha2/audio`, `alpha2/audio-worker` | Offline audio rendering into a sink, in a worker or not. |
|
|
104
106
|
| `alpha2/audio-timeline`, `alpha2/audio-worklet`, `alpha2/audio-worklet-processor` | Real-time audio: the shared ring, its pump, and the AudioWorklet and its processor module. |
|
|
105
107
|
| `alpha2/loudness`, `alpha2/waveform` | Loudness measurement and normalization; waveform summaries. |
|
|
106
108
|
| `alpha2/robustness` | Browser capability detection and degradation reports. |
|
|
107
|
-
| `alpha2` | `alpha2/assets`, `audio`, `audio-timeline`, `audio-worker`, `audio-worklet`, `effects`, `exporter`, `extensions`, `frame-supply`, `hdr-frames`, `loudness`, `media`, `player`, `project`, `rate-control`, `robustness`, `text`, `waveform` and `worker` in one import. |
|
|
109
|
+
| `alpha2` | `alpha2/assets`, `audio`, `audio-timeline`, `audio-worker`, `audio-worklet`, `containers`, `effects`, `exporter`, `extensions`, `frame-supply`, `hdr-frames`, `loudness`, `media`, `player`, `project`, `rate-control`, `robustness`, `text`, `waveform` and `worker` in one import. |
|
|
108
110
|
|
|
109
111
|
Each module's declarations document its API.
|
|
110
112
|
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export containers: the file formats an export is written in, and which codecs each one offers.
|
|
3
|
+
*
|
|
4
|
+
* This is the engine's container policy (`alpha2_media::Container`), mirrored here as a constant so
|
|
5
|
+
* a browser sink, or a client of a native host, can validate a request before it opens an encoder
|
|
6
|
+
* or starts a host. Both copies are pinned by the shared corpus
|
|
7
|
+
* `tests/cases/export-container-corpus.json`. A container offers only the codecs its mainstream
|
|
8
|
+
* players decode in it, which is narrower than what mediabunny writes: QuickTime does not play
|
|
9
|
+
* VP9, AV1 or Opus in a MOV.
|
|
10
|
+
*/
|
|
11
|
+
import { type BrowserVideoCodec, type EngineVideoCodec } from "./rate-control.js";
|
|
12
|
+
/** The containers an export can be written in. */
|
|
13
|
+
export type ExportContainer = "mp4" | "mov" | "mkv" | "webm";
|
|
14
|
+
/** The audio codecs an export can carry. */
|
|
15
|
+
export type ExportAudioCodec = "aac" | "opus";
|
|
16
|
+
/** One container's policy. */
|
|
17
|
+
export interface ContainerPolicy {
|
|
18
|
+
readonly id: ExportContainer;
|
|
19
|
+
/** Lowercase file extensions without the dot; the first names an exported file. */
|
|
20
|
+
readonly extensions: readonly string[];
|
|
21
|
+
readonly mimeType: string;
|
|
22
|
+
/** Offered video codecs in the engine's spelling, the default first. */
|
|
23
|
+
readonly video: readonly EngineVideoCodec[];
|
|
24
|
+
/** Offered audio codecs, the default first; also the order a browser falls back in. */
|
|
25
|
+
readonly audio: readonly ExportAudioCodec[];
|
|
26
|
+
}
|
|
27
|
+
/** Every container's policy, in the engine's order. */
|
|
28
|
+
export declare const EXPORT_CONTAINERS: readonly ContainerPolicy[];
|
|
29
|
+
/** Why an export format request cannot be resolved. */
|
|
30
|
+
export type ExportFormatErrorReason = "unknown" | "unknown-extension" | "extension-mismatch" | "video-codec-not-offered" | "audio-codec-not-offered";
|
|
31
|
+
/** A container or codec request the policy refuses. */
|
|
32
|
+
export declare class ExportFormatError extends RangeError {
|
|
33
|
+
readonly reason: ExportFormatErrorReason;
|
|
34
|
+
constructor(reason: ExportFormatErrorReason, message: string);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The policy of a container.
|
|
38
|
+
*
|
|
39
|
+
* @throws ExportFormatError When `container` is not one of {@link EXPORT_CONTAINERS}.
|
|
40
|
+
*/
|
|
41
|
+
export declare function containerPolicy(container: string): ContainerPolicy;
|
|
42
|
+
/** The container a file extension (without the dot) names, case-insensitively. */
|
|
43
|
+
export declare function containerFromExtension(extension: string): ExportContainer | undefined;
|
|
44
|
+
/** The video codec a browser export in `container` gets when it names none. */
|
|
45
|
+
export declare function defaultVideoCodec(container: ExportContainer): BrowserVideoCodec;
|
|
46
|
+
/** The audio codecs `container` offers, in the order a browser tries them. */
|
|
47
|
+
export declare function offeredAudioCodecs(container: ExportContainer): readonly ExportAudioCodec[];
|
|
48
|
+
/** A resolved export format, in the engine's codec spelling. */
|
|
49
|
+
export interface EngineExportFormat {
|
|
50
|
+
readonly container: ExportContainer;
|
|
51
|
+
readonly videoCodec: EngineVideoCodec;
|
|
52
|
+
readonly audioCodec: ExportAudioCodec;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Resolves an export's container and codecs, in the engine's codec spelling (`h264`): the same rule
|
|
56
|
+
* as the engine's `resolve_export_format`, which a native host applies to the same request.
|
|
57
|
+
*
|
|
58
|
+
* - `container` names the container. When it is absent, `extension` names it, and with neither
|
|
59
|
+
* (a browser export, which writes no path) it is MP4.
|
|
60
|
+
* - A named container and an extension must agree.
|
|
61
|
+
* - An absent codec is the container's default, and a named one must be one it offers.
|
|
62
|
+
*
|
|
63
|
+
* @throws ExportFormatError When the request breaks one of these rules.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveEngineExportFormat(request: {
|
|
66
|
+
readonly container?: string;
|
|
67
|
+
/** The output's extension without the dot, empty when it has none. */
|
|
68
|
+
readonly extension?: string;
|
|
69
|
+
readonly videoCodec?: string;
|
|
70
|
+
readonly audioCodec?: string;
|
|
71
|
+
}): EngineExportFormat;
|
|
72
|
+
/** A resolved export format, in the browser's codec spelling. */
|
|
73
|
+
export interface ExportFormat {
|
|
74
|
+
readonly container: ExportContainer;
|
|
75
|
+
readonly videoCodec: BrowserVideoCodec;
|
|
76
|
+
readonly audioCodec: ExportAudioCodec;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* {@link resolveEngineExportFormat} in the browser's codec spelling (`avc`), for a browser sink.
|
|
80
|
+
*
|
|
81
|
+
* @throws ExportFormatError When the request breaks one of its rules.
|
|
82
|
+
*/
|
|
83
|
+
export declare function resolveExportFormat(request: {
|
|
84
|
+
readonly container?: string;
|
|
85
|
+
/** The output's extension without the dot, empty when it has none. */
|
|
86
|
+
readonly extension?: string;
|
|
87
|
+
readonly videoCodec?: BrowserVideoCodec;
|
|
88
|
+
readonly audioCodec?: ExportAudioCodec;
|
|
89
|
+
}): ExportFormat;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export containers: the file formats an export is written in, and which codecs each one offers.
|
|
3
|
+
*
|
|
4
|
+
* This is the engine's container policy (`alpha2_media::Container`), mirrored here as a constant so
|
|
5
|
+
* a browser sink, or a client of a native host, can validate a request before it opens an encoder
|
|
6
|
+
* or starts a host. Both copies are pinned by the shared corpus
|
|
7
|
+
* `tests/cases/export-container-corpus.json`. A container offers only the codecs its mainstream
|
|
8
|
+
* players decode in it, which is narrower than what mediabunny writes: QuickTime does not play
|
|
9
|
+
* VP9, AV1 or Opus in a MOV.
|
|
10
|
+
*/
|
|
11
|
+
import { engineVideoCodec, } from "./rate-control.js";
|
|
12
|
+
/** Every container's policy, in the engine's order. */
|
|
13
|
+
export const EXPORT_CONTAINERS = [
|
|
14
|
+
{
|
|
15
|
+
id: "mp4",
|
|
16
|
+
extensions: ["mp4", "m4v"],
|
|
17
|
+
mimeType: "video/mp4",
|
|
18
|
+
video: ["h264", "hevc", "vp9", "av1", "mpeg4-part2"],
|
|
19
|
+
audio: ["aac", "opus"],
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "mov",
|
|
23
|
+
extensions: ["mov"],
|
|
24
|
+
mimeType: "video/quicktime",
|
|
25
|
+
video: ["h264", "hevc", "mpeg4-part2"],
|
|
26
|
+
audio: ["aac"],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: "mkv",
|
|
30
|
+
extensions: ["mkv"],
|
|
31
|
+
mimeType: "video/x-matroska",
|
|
32
|
+
video: ["h264", "hevc", "vp9", "av1", "mpeg4-part2"],
|
|
33
|
+
audio: ["aac", "opus"],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "webm",
|
|
37
|
+
extensions: ["webm"],
|
|
38
|
+
mimeType: "video/webm",
|
|
39
|
+
video: ["vp9", "av1"],
|
|
40
|
+
audio: ["opus"],
|
|
41
|
+
},
|
|
42
|
+
];
|
|
43
|
+
/** A container or codec request the policy refuses. */
|
|
44
|
+
export class ExportFormatError extends RangeError {
|
|
45
|
+
reason;
|
|
46
|
+
constructor(reason, message) {
|
|
47
|
+
super(message);
|
|
48
|
+
this.name = "ExportFormatError";
|
|
49
|
+
this.reason = reason;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The policy of a container.
|
|
54
|
+
*
|
|
55
|
+
* @throws ExportFormatError When `container` is not one of {@link EXPORT_CONTAINERS}.
|
|
56
|
+
*/
|
|
57
|
+
export function containerPolicy(container) {
|
|
58
|
+
const policy = EXPORT_CONTAINERS.find((entry) => entry.id === container);
|
|
59
|
+
if (policy === undefined)
|
|
60
|
+
throw new ExportFormatError("unknown", `unknown container "${container}"; expected one of ${EXPORT_CONTAINERS.map((entry) => entry.id).join(", ")}`);
|
|
61
|
+
return policy;
|
|
62
|
+
}
|
|
63
|
+
/** The container a file extension (without the dot) names, case-insensitively. */
|
|
64
|
+
export function containerFromExtension(extension) {
|
|
65
|
+
const lower = extension.toLowerCase();
|
|
66
|
+
return EXPORT_CONTAINERS.find((entry) => entry.extensions.includes(lower))
|
|
67
|
+
?.id;
|
|
68
|
+
}
|
|
69
|
+
/** The video codec a browser export in `container` gets when it names none. */
|
|
70
|
+
export function defaultVideoCodec(container) {
|
|
71
|
+
return browserVideoCodec(containerPolicy(container).video[0]);
|
|
72
|
+
}
|
|
73
|
+
/** The audio codecs `container` offers, in the order a browser tries them. */
|
|
74
|
+
export function offeredAudioCodecs(container) {
|
|
75
|
+
return containerPolicy(container).audio;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Resolves an export's container and codecs, in the engine's codec spelling (`h264`): the same rule
|
|
79
|
+
* as the engine's `resolve_export_format`, which a native host applies to the same request.
|
|
80
|
+
*
|
|
81
|
+
* - `container` names the container. When it is absent, `extension` names it, and with neither
|
|
82
|
+
* (a browser export, which writes no path) it is MP4.
|
|
83
|
+
* - A named container and an extension must agree.
|
|
84
|
+
* - An absent codec is the container's default, and a named one must be one it offers.
|
|
85
|
+
*
|
|
86
|
+
* @throws ExportFormatError When the request breaks one of these rules.
|
|
87
|
+
*/
|
|
88
|
+
export function resolveEngineExportFormat(request) {
|
|
89
|
+
const policy = resolveContainer(request.container, request.extension);
|
|
90
|
+
const video = request.videoCodec ?? policy.video[0];
|
|
91
|
+
if (!policy.video.includes(video))
|
|
92
|
+
throw new ExportFormatError("video-codec-not-offered", `${policy.id} does not offer video codec ${video}; it offers ${policy.video.join(", ")}`);
|
|
93
|
+
const audio = request.audioCodec ?? policy.audio[0];
|
|
94
|
+
if (!policy.audio.includes(audio))
|
|
95
|
+
throw new ExportFormatError("audio-codec-not-offered", `${policy.id} does not offer audio codec ${audio}; it offers ${policy.audio.join(", ")}`);
|
|
96
|
+
return {
|
|
97
|
+
container: policy.id,
|
|
98
|
+
videoCodec: video,
|
|
99
|
+
audioCodec: audio,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* {@link resolveEngineExportFormat} in the browser's codec spelling (`avc`), for a browser sink.
|
|
104
|
+
*
|
|
105
|
+
* @throws ExportFormatError When the request breaks one of its rules.
|
|
106
|
+
*/
|
|
107
|
+
export function resolveExportFormat(request) {
|
|
108
|
+
const { videoCodec, ...rest } = request;
|
|
109
|
+
const format = resolveEngineExportFormat({
|
|
110
|
+
...rest,
|
|
111
|
+
...(videoCodec === undefined
|
|
112
|
+
? {}
|
|
113
|
+
: { videoCodec: engineVideoCodec(videoCodec) }),
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
container: format.container,
|
|
117
|
+
videoCodec: browserVideoCodec(format.videoCodec),
|
|
118
|
+
audioCodec: format.audioCodec,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function resolveContainer(container, extension) {
|
|
122
|
+
if (container !== undefined) {
|
|
123
|
+
const policy = containerPolicy(container);
|
|
124
|
+
if (extension !== undefined &&
|
|
125
|
+
!policy.extensions.includes(extension.toLowerCase())) {
|
|
126
|
+
const found = extension === "" ? "no extension" : `".${extension}"`;
|
|
127
|
+
throw new ExportFormatError("extension-mismatch", `a ${policy.id} output must end in ${dotted(policy.extensions)}, not ${found}`);
|
|
128
|
+
}
|
|
129
|
+
return policy;
|
|
130
|
+
}
|
|
131
|
+
if (extension === undefined)
|
|
132
|
+
return containerPolicy("mp4");
|
|
133
|
+
const named = containerFromExtension(extension);
|
|
134
|
+
if (named !== undefined)
|
|
135
|
+
return containerPolicy(named);
|
|
136
|
+
const every = dotted(EXPORT_CONTAINERS.flatMap((entry) => entry.extensions));
|
|
137
|
+
throw new ExportFormatError("unknown-extension", extension === ""
|
|
138
|
+
? `the output has no extension to name its container; use one of ${every}`
|
|
139
|
+
: `the output extension ".${extension}" names no container; use one of ${every}`);
|
|
140
|
+
}
|
|
141
|
+
function dotted(extensions) {
|
|
142
|
+
return extensions.map((extension) => `.${extension}`).join(", ");
|
|
143
|
+
}
|
|
144
|
+
function browserVideoCodec(codec) {
|
|
145
|
+
if (codec === "h264")
|
|
146
|
+
return "avc";
|
|
147
|
+
if (codec === "mpeg4-part2")
|
|
148
|
+
throw new ExportFormatError("video-codec-not-offered", "the browser has no mpeg4-part2 encoder");
|
|
149
|
+
return codec;
|
|
150
|
+
}
|
package/dist/effects.d.ts
CHANGED
|
@@ -14,6 +14,10 @@ export interface EffectResourceSpec {
|
|
|
14
14
|
readonly name: string;
|
|
15
15
|
readonly kind: EffectResourceKind;
|
|
16
16
|
}
|
|
17
|
+
/** An image an effect samples besides its source; an effect node binds it under `inputs.<name>`. */
|
|
18
|
+
export interface EffectInputSpec {
|
|
19
|
+
readonly name: string;
|
|
20
|
+
}
|
|
17
21
|
/** Host-loaded bytes for one project effect resource. */
|
|
18
22
|
export type EffectResourceData = {
|
|
19
23
|
readonly id: string;
|
|
@@ -26,7 +30,7 @@ export interface BuiltinEffectCatalogEntry {
|
|
|
26
30
|
readonly id: string;
|
|
27
31
|
readonly version: number;
|
|
28
32
|
readonly kind: EffectKind;
|
|
29
|
-
readonly inputs:
|
|
33
|
+
readonly inputs: readonly EffectInputSpec[];
|
|
30
34
|
readonly label: string;
|
|
31
35
|
readonly group: string;
|
|
32
36
|
readonly params: readonly (EffectParameter & {
|
|
@@ -100,7 +104,13 @@ export interface EffectDefinition {
|
|
|
100
104
|
readonly id: string;
|
|
101
105
|
readonly version: number;
|
|
102
106
|
readonly kind: EffectKind;
|
|
103
|
-
|
|
107
|
+
/**
|
|
108
|
+
* Images the effect samples besides its source, at most 8; only `kind: "effect"` declares them.
|
|
109
|
+
* The shader reads each as `sample_<name>(uv) -> vec4f` (premultiplied, sRGB-encoded, clamped at
|
|
110
|
+
* the edges, as `sample_src`) and `size_<name>() -> vec2f` (the bound texture's size in texels).
|
|
111
|
+
* The wrapper declares `input_<name>`, `sample_<name>` and `size_<name>`, so a body must not.
|
|
112
|
+
*/
|
|
113
|
+
readonly inputs?: readonly EffectInputSpec[];
|
|
104
114
|
readonly params?: readonly EffectParameter[];
|
|
105
115
|
readonly resources?: readonly EffectResourceSpec[];
|
|
106
116
|
/** WGSL the engine places into its effect shader; compile errors reject registration. */
|
package/dist/frame-supply.d.ts
CHANGED
|
@@ -204,6 +204,11 @@ export interface PlaybackResult {
|
|
|
204
204
|
readonly presentedTimeTicks: number | null;
|
|
205
205
|
readonly missingSources: readonly string[];
|
|
206
206
|
readonly repeated: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* The frame equals the one presented last, so the engine neither rendered nor presented it: the
|
|
209
|
+
* canvas still shows it, and a host copying the canvas elsewhere need not copy it again.
|
|
210
|
+
*/
|
|
211
|
+
readonly unchanged: boolean;
|
|
207
212
|
}
|
|
208
213
|
/**
|
|
209
214
|
* Engine surface this module drives.
|