@holtjs/stage 0.16.0 → 0.17.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 +11 -0
- package/dist/{game-Dxh9e0Hv.d.ts → game-BrYrde7y.d.ts} +71 -1
- package/dist/{game-CFxS641c.js → game-ChUlbQwx.js} +1 -1
- package/dist/headless.d.ts +102 -4
- package/dist/headless.js +185 -12
- package/dist/index.d.ts +2 -2
- package/dist/index.js +4 -4
- package/dist/joystick.d.ts +1 -1
- package/dist/kernel.d.ts +2 -2
- package/dist/kernel.js +303 -1
- package/dist/lighting.d.ts +1 -1
- package/dist/projection.d.ts +1 -1
- package/dist/{renderer-webgpu-q4vdE3kA.js → renderer-webgpu-B4AvHUEt.js} +48 -7
- package/dist/renderer-webgpu.d.ts +2 -2
- package/dist/renderer-webgpu.js +1 -1
- package/dist/rig2d.d.ts +1 -1
- package/dist/tilemap.d.ts +1 -1
- package/dist/trace.d.ts +1 -1
- package/dist/world.d.ts +1 -1
- package/package.json +2 -2
- package/skills/stage/SKILL.md +38 -26
- package/skills/stage/references/subpaths.md +7 -6
package/dist/kernel.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { a as ScriptOptions, i as ScriptHandle, o as ScriptScheduler, r as ScriptContext, s as ScriptStats, t as CoroutineGenerator } from "./coroutine-DLgJumtD.js";
|
|
2
|
-
import { A as
|
|
3
|
-
export { ActionMap, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, RollbackResult, RollbackSession, RollbackSessionOptions, RollbackStateCodec, RollbackStats, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createInputRecorder, createInputReplay, createInputTimeline, createRollbackSession };
|
|
2
|
+
import { A as RecordedInputEntry, B as TimelineDragOptions, C as CameraPanOptions, D as InputTargetSpec, E as InputRecorderPlugin, F as RollbackStats, G as createInputTimeline, H as createCameraDirector, I as StageInputEvent, K as createRollbackSession, L as StageKernel, M as RollbackSession, N as RollbackSessionOptions, O as InputTimelineOptions, P as RollbackStateCodec, R as StagePlugin, S as CameraFollowCueOptions, T as InputProvider, U as createInputRecorder, V as TimelineKeyOptions, W as createInputReplay, _ as ActionMap, b as CameraDirectorPlugin, j as RollbackResult, k as InputTimelinePlugin, v as CameraCutOptions, w as CameraSpotlightOptions, x as CameraDirectorTarget, y as CameraDirectorOptions, z as TimelineClickOptions } from "./game-BrYrde7y.js";
|
|
3
|
+
export { ActionMap, CameraCutOptions, CameraDirectorOptions, CameraDirectorPlugin, CameraDirectorTarget, CameraFollowCueOptions, CameraPanOptions, CameraSpotlightOptions, type CoroutineGenerator, InputProvider, InputRecorderPlugin, InputTargetSpec, InputTimelineOptions, InputTimelinePlugin, RecordedInputEntry, RollbackResult, RollbackSession, RollbackSessionOptions, RollbackStateCodec, RollbackStats, type ScriptContext, type ScriptHandle, type ScriptOptions, ScriptScheduler, type ScriptStats, StageInputEvent, StageKernel, StagePlugin, TimelineClickOptions, TimelineDragOptions, TimelineKeyOptions, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createRollbackSession };
|
package/dist/kernel.js
CHANGED
|
@@ -819,4 +819,306 @@ var RollbackSession = class RollbackSession {
|
|
|
819
819
|
function createRollbackSession(options) {
|
|
820
820
|
return new RollbackSession(options);
|
|
821
821
|
}
|
|
822
|
-
|
|
822
|
+
/**
|
|
823
|
+
* In-engine virtual camera choreography & spotlight framing plugin (`StagePlugin`) for product demos,
|
|
824
|
+
* scientific visualizations, and game cutscenes. Resolves targets either by world coordinates `{ x, y }`
|
|
825
|
+
* or live `trackId` across scene display nodes and `UiRoot` elements.
|
|
826
|
+
*/
|
|
827
|
+
function createCameraDirector(options = {}) {
|
|
828
|
+
const id = options.id ?? "stage.camera-director";
|
|
829
|
+
let hostKernel = null;
|
|
830
|
+
const cuts = [];
|
|
831
|
+
const pans = [];
|
|
832
|
+
let followState = null;
|
|
833
|
+
let spotState = null;
|
|
834
|
+
let spotGfx = null;
|
|
835
|
+
let spotScene = null;
|
|
836
|
+
const resolveRect = (scene, spec) => {
|
|
837
|
+
const cam = scene.cameras.main;
|
|
838
|
+
const z = cam.zoom || 1;
|
|
839
|
+
if (typeof spec !== "string") {
|
|
840
|
+
const w = spec.w ?? 48;
|
|
841
|
+
const h = spec.h ?? 48;
|
|
842
|
+
const pt = cam.worldToScreen(spec.x, spec.y);
|
|
843
|
+
return {
|
|
844
|
+
wx: spec.x,
|
|
845
|
+
wy: spec.y,
|
|
846
|
+
sx: pt.x - w * z * .5,
|
|
847
|
+
sy: pt.y - h * z * .5,
|
|
848
|
+
sw: w * z,
|
|
849
|
+
sh: h * z
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
let foundNode = null;
|
|
853
|
+
let foundWx = 0;
|
|
854
|
+
let foundWy = 0;
|
|
855
|
+
const walk = (list, px, py) => {
|
|
856
|
+
for (let i = 0; i < list.length; i++) {
|
|
857
|
+
const o = list[i];
|
|
858
|
+
if (!o || !o.active) continue;
|
|
859
|
+
const wx = px + (o.x || 0);
|
|
860
|
+
const wy = py + (o.y || 0);
|
|
861
|
+
if (o.trackId === spec) {
|
|
862
|
+
foundNode = o;
|
|
863
|
+
foundWx = wx;
|
|
864
|
+
foundWy = wy;
|
|
865
|
+
return true;
|
|
866
|
+
}
|
|
867
|
+
if (o.type === "Container" && Array.isArray(o.list)) {
|
|
868
|
+
if (walk(o.list, wx, wy)) return true;
|
|
869
|
+
}
|
|
870
|
+
}
|
|
871
|
+
return false;
|
|
872
|
+
};
|
|
873
|
+
if (walk(scene.children.list, 0, 0) && foundNode) {
|
|
874
|
+
const dw = Math.max(8, Math.abs(foundNode.displayWidth || foundNode.width || 32));
|
|
875
|
+
const dh = Math.max(8, Math.abs(foundNode.displayHeight || foundNode.height || 32));
|
|
876
|
+
const ox = (foundNode.displayOriginX ?? 0) * Math.abs(foundNode.scaleX ?? 1);
|
|
877
|
+
const oy = (foundNode.displayOriginY ?? 0) * Math.abs(foundNode.scaleY ?? 1);
|
|
878
|
+
const left = foundWx - ox;
|
|
879
|
+
const top = foundWy - oy;
|
|
880
|
+
const cx = left + dw * .5;
|
|
881
|
+
const cy = top + dh * .5;
|
|
882
|
+
const sfx = foundNode.scrollFactorX ?? 1;
|
|
883
|
+
const sfy = foundNode.scrollFactorY ?? 1;
|
|
884
|
+
if (sfx === 0 && sfy === 0) {
|
|
885
|
+
const worldPt = cam.screenToWorld(cx, cy);
|
|
886
|
+
return {
|
|
887
|
+
wx: worldPt.x,
|
|
888
|
+
wy: worldPt.y,
|
|
889
|
+
sx: left,
|
|
890
|
+
sy: top,
|
|
891
|
+
sw: dw,
|
|
892
|
+
sh: dh
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
const scrTl = cam.worldToScreen(left, top);
|
|
896
|
+
return {
|
|
897
|
+
wx: cx,
|
|
898
|
+
wy: cy,
|
|
899
|
+
sx: scrTl.x,
|
|
900
|
+
sy: scrTl.y,
|
|
901
|
+
sw: dw * z,
|
|
902
|
+
sh: dh * z
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
const dg = buildSceneDigest(scene, options.digestOptions);
|
|
906
|
+
for (let i = 0; i < dg.nodes.length; i++) {
|
|
907
|
+
const n = dg.nodes[i];
|
|
908
|
+
if (n.trackId === spec) {
|
|
909
|
+
const [bx, by, bw, bh] = n.bounds;
|
|
910
|
+
const cx = bx + bw * .5;
|
|
911
|
+
const cy = by + bh * .5;
|
|
912
|
+
const tl = cam.worldToScreen(bx, by);
|
|
913
|
+
return {
|
|
914
|
+
wx: cx,
|
|
915
|
+
wy: cy,
|
|
916
|
+
sx: tl.x,
|
|
917
|
+
sy: tl.y,
|
|
918
|
+
sw: Math.max(8, bw * z),
|
|
919
|
+
sh: Math.max(8, bh * z)
|
|
920
|
+
};
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return null;
|
|
924
|
+
};
|
|
925
|
+
const applyInstantCut = (scene, target, zoom) => {
|
|
926
|
+
const cam = scene.cameras.main;
|
|
927
|
+
if (zoom !== void 0 && zoom > 0) cam.setZoom(zoom);
|
|
928
|
+
const rect = resolveRect(scene, target);
|
|
929
|
+
if (rect) cam.centerOn(rect.wx, rect.wy);
|
|
930
|
+
};
|
|
931
|
+
const director = {
|
|
932
|
+
id,
|
|
933
|
+
setup(kernel) {
|
|
934
|
+
hostKernel = kernel;
|
|
935
|
+
return () => {
|
|
936
|
+
hostKernel = null;
|
|
937
|
+
};
|
|
938
|
+
},
|
|
939
|
+
update(scene, _timeMs, deltaMs) {
|
|
940
|
+
const simTimeMs = scene.game.clock.simTimeMs;
|
|
941
|
+
const cam = scene.cameras.main;
|
|
942
|
+
for (let i = 0; i < cuts.length; i++) {
|
|
943
|
+
const c = cuts[i];
|
|
944
|
+
if (!c.fired && simTimeMs >= c.atMs) {
|
|
945
|
+
c.fired = true;
|
|
946
|
+
followState = null;
|
|
947
|
+
applyInstantCut(scene, c.target, c.zoom);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
for (let i = 0; i < pans.length; i++) {
|
|
951
|
+
const p = pans[i];
|
|
952
|
+
if (p.finished) continue;
|
|
953
|
+
const startAt = p.startMs ?? simTimeMs;
|
|
954
|
+
if (p.startMs === null) p.startMs = startAt;
|
|
955
|
+
if (simTimeMs < startAt) continue;
|
|
956
|
+
if (!p.started) {
|
|
957
|
+
p.started = true;
|
|
958
|
+
followState = null;
|
|
959
|
+
cam.syncMetrics();
|
|
960
|
+
p.fromX = cam.worldView.x + cam.worldView.width * .5;
|
|
961
|
+
p.fromY = cam.worldView.y + cam.worldView.height * .5;
|
|
962
|
+
p.fromZoom = cam.zoom || 1;
|
|
963
|
+
}
|
|
964
|
+
const rect = resolveRect(scene, p.target);
|
|
965
|
+
const toX = rect ? rect.wx : p.fromX;
|
|
966
|
+
const toY = rect ? rect.wy : p.fromY;
|
|
967
|
+
const toZ = p.toZoom !== void 0 && p.toZoom > 0 ? p.toZoom : p.fromZoom;
|
|
968
|
+
const rawT = p.durationMs <= 0 ? 1 : Math.min(1, (simTimeMs - startAt) / p.durationMs);
|
|
969
|
+
const e = p.easing(rawT);
|
|
970
|
+
cam.setZoom(p.fromZoom + (toZ - p.fromZoom) * e);
|
|
971
|
+
cam.centerOn(p.fromX + (toX - p.fromX) * e, p.fromY + (toY - p.fromY) * e);
|
|
972
|
+
if (rawT >= 1) p.finished = true;
|
|
973
|
+
}
|
|
974
|
+
if (followState) {
|
|
975
|
+
const rect = resolveRect(scene, followState.target);
|
|
976
|
+
if (rect) {
|
|
977
|
+
if (followState.zoom !== void 0 && followState.zoom > 0) {
|
|
978
|
+
const zAlpha = 1 - Math.pow(1 - followState.lerp, Math.max(1, deltaMs / 16.6667));
|
|
979
|
+
cam.setZoom(cam.zoom + (followState.zoom - cam.zoom) * zAlpha);
|
|
980
|
+
}
|
|
981
|
+
cam.syncMetrics();
|
|
982
|
+
const curX = cam.worldView.x + cam.worldView.width * .5;
|
|
983
|
+
const curY = cam.worldView.y + cam.worldView.height * .5;
|
|
984
|
+
const alpha = 1 - Math.pow(1 - followState.lerp, Math.max(1, deltaMs / 16.6667));
|
|
985
|
+
cam.centerOn(curX + (rect.wx - curX) * alpha, curY + (rect.wy - curY) * alpha);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
const activeSpot = spotState && (spotState.startMs === null || simTimeMs >= spotState.startMs) && (spotState.endMs === null || simTimeMs < spotState.endMs) ? spotState : null;
|
|
989
|
+
if (!activeSpot) {
|
|
990
|
+
if (spotGfx && spotGfx.active) {
|
|
991
|
+
spotGfx.clear();
|
|
992
|
+
spotGfx.setVisible(false);
|
|
993
|
+
}
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
const rect = resolveRect(scene, activeSpot.target);
|
|
997
|
+
if (!rect) return;
|
|
998
|
+
if (!spotGfx || spotScene !== scene || !spotGfx.active) {
|
|
999
|
+
spotScene = scene;
|
|
1000
|
+
spotGfx = scene.add.graphics();
|
|
1001
|
+
spotGfx.setDepth(999999e3);
|
|
1002
|
+
spotGfx.setScrollFactor(0, 0);
|
|
1003
|
+
spotGfx.trackId = "stage.camera-spotlight";
|
|
1004
|
+
spotGfx.role = "presentation";
|
|
1005
|
+
}
|
|
1006
|
+
spotGfx.setVisible(true);
|
|
1007
|
+
spotGfx.clear();
|
|
1008
|
+
const vw = cam.width;
|
|
1009
|
+
const vh = cam.height;
|
|
1010
|
+
const pad = activeSpot.padding;
|
|
1011
|
+
const hx = Math.max(0, Math.round(rect.sx - pad));
|
|
1012
|
+
const hy = Math.max(0, Math.round(rect.sy - pad));
|
|
1013
|
+
const hr = Math.min(vw, Math.round(rect.sx + rect.sw + pad));
|
|
1014
|
+
const hb = Math.min(vh, Math.round(rect.sy + rect.sh + pad));
|
|
1015
|
+
const hw = Math.max(0, hr - hx);
|
|
1016
|
+
const hh = Math.max(0, hb - hy);
|
|
1017
|
+
spotGfx.fillStyle(activeSpot.dimColor, activeSpot.dimAlpha);
|
|
1018
|
+
if (hy > 0) spotGfx.fillRect(0, 0, vw, hy);
|
|
1019
|
+
if (hb < vh) spotGfx.fillRect(0, hb, vw, vh - hb);
|
|
1020
|
+
if (hx > 0 && hh > 0) spotGfx.fillRect(0, hy, hx, hh);
|
|
1021
|
+
if (hr < vw && hh > 0) spotGfx.fillRect(hr, hy, vw - hr, hh);
|
|
1022
|
+
if (activeSpot.borderWidth > 0 && hw > 0 && hh > 0) {
|
|
1023
|
+
spotGfx.lineStyle(activeSpot.borderWidth, activeSpot.borderColor, .95);
|
|
1024
|
+
spotGfx.strokeRect(hx, hy, hw, hh);
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
digest() {
|
|
1028
|
+
const cam = (hostKernel?.game.scene.scenes[0])?.cameras.main;
|
|
1029
|
+
return {
|
|
1030
|
+
zoom: cam ? +cam.zoom.toFixed(3) : 1,
|
|
1031
|
+
scrollX: cam ? Math.round(cam.scrollX) : 0,
|
|
1032
|
+
scrollY: cam ? Math.round(cam.scrollY) : 0,
|
|
1033
|
+
following: Boolean(followState),
|
|
1034
|
+
spotlight: Boolean(spotState)
|
|
1035
|
+
};
|
|
1036
|
+
},
|
|
1037
|
+
dispose() {
|
|
1038
|
+
spotGfx?.destroy();
|
|
1039
|
+
spotGfx = null;
|
|
1040
|
+
spotScene = null;
|
|
1041
|
+
hostKernel = null;
|
|
1042
|
+
},
|
|
1043
|
+
cutTo(target, cutOpts = {}) {
|
|
1044
|
+
if (cutOpts.atMs !== void 0) cuts.push({
|
|
1045
|
+
target,
|
|
1046
|
+
atMs: Math.max(0, cutOpts.atMs),
|
|
1047
|
+
zoom: cutOpts.zoom,
|
|
1048
|
+
fired: false
|
|
1049
|
+
});
|
|
1050
|
+
else {
|
|
1051
|
+
followState = null;
|
|
1052
|
+
const sc = hostKernel?.game.scene.scenes[0];
|
|
1053
|
+
if (sc) applyInstantCut(sc, target, cutOpts.zoom);
|
|
1054
|
+
}
|
|
1055
|
+
return director;
|
|
1056
|
+
},
|
|
1057
|
+
panTo(target, panOpts = {}) {
|
|
1058
|
+
pans.push({
|
|
1059
|
+
target,
|
|
1060
|
+
startMs: panOpts.atMs !== void 0 ? Math.max(0, panOpts.atMs) : null,
|
|
1061
|
+
durationMs: Math.max(0, panOpts.durationMs ?? 450),
|
|
1062
|
+
toZoom: panOpts.zoom,
|
|
1063
|
+
easing: panOpts.easing ?? Easings.inOutCubic,
|
|
1064
|
+
started: false,
|
|
1065
|
+
finished: false,
|
|
1066
|
+
fromX: 0,
|
|
1067
|
+
fromY: 0,
|
|
1068
|
+
fromZoom: 1
|
|
1069
|
+
});
|
|
1070
|
+
return director;
|
|
1071
|
+
},
|
|
1072
|
+
follow(target, followOpts = {}) {
|
|
1073
|
+
followState = {
|
|
1074
|
+
target,
|
|
1075
|
+
lerp: Math.max(.01, Math.min(1, followOpts.lerp ?? .18)),
|
|
1076
|
+
zoom: followOpts.zoom
|
|
1077
|
+
};
|
|
1078
|
+
return director;
|
|
1079
|
+
},
|
|
1080
|
+
stopFollow() {
|
|
1081
|
+
followState = null;
|
|
1082
|
+
return director;
|
|
1083
|
+
},
|
|
1084
|
+
spotlight(target, spotOpts = {}) {
|
|
1085
|
+
const startMs = spotOpts.atMs !== void 0 ? Math.max(0, spotOpts.atMs) : null;
|
|
1086
|
+
const dur = spotOpts.durationMs && spotOpts.durationMs > 0 ? spotOpts.durationMs : null;
|
|
1087
|
+
const curNow = hostKernel?.game.clock.simTimeMs ?? 0;
|
|
1088
|
+
spotState = {
|
|
1089
|
+
target,
|
|
1090
|
+
padding: Math.max(0, spotOpts.padding ?? 14),
|
|
1091
|
+
dimColor: spotOpts.dimColor ?? 527122,
|
|
1092
|
+
dimAlpha: Math.max(0, Math.min(1, spotOpts.dimAlpha ?? .68)),
|
|
1093
|
+
borderColor: spotOpts.borderColor ?? 0xb6ef48,
|
|
1094
|
+
borderWidth: Math.max(0, spotOpts.borderWidth ?? 2.5),
|
|
1095
|
+
startMs,
|
|
1096
|
+
endMs: dur !== null ? (startMs ?? curNow) + dur : null
|
|
1097
|
+
};
|
|
1098
|
+
return director;
|
|
1099
|
+
},
|
|
1100
|
+
clearSpotlight() {
|
|
1101
|
+
spotState = null;
|
|
1102
|
+
if (spotGfx && spotGfx.active) {
|
|
1103
|
+
spotGfx.clear();
|
|
1104
|
+
spotGfx.setVisible(false);
|
|
1105
|
+
}
|
|
1106
|
+
return director;
|
|
1107
|
+
},
|
|
1108
|
+
reset() {
|
|
1109
|
+
cuts.length = 0;
|
|
1110
|
+
pans.length = 0;
|
|
1111
|
+
followState = null;
|
|
1112
|
+
director.clearSpotlight();
|
|
1113
|
+
const sc = hostKernel?.game.scene.scenes[0];
|
|
1114
|
+
if (sc) {
|
|
1115
|
+
const cam = sc.cameras.main;
|
|
1116
|
+
cam.setZoom(1);
|
|
1117
|
+
cam.setScroll(0, 0);
|
|
1118
|
+
}
|
|
1119
|
+
return director;
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
return director;
|
|
1123
|
+
}
|
|
1124
|
+
export { ActionMap, RollbackSession, ScriptScheduler, StageKernel, createCameraDirector, createInputRecorder, createInputReplay, createInputTimeline, createRollbackSession };
|
package/dist/lighting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as Container, Kn as ImageObject, Ln as DisplayObject, Nn as CustomPassObject, Tn as StageRenderTarget, rr as SceneHostLike } from "./game-BrYrde7y.js";
|
|
2
2
|
export type DayPhase = 'day' | 'dusk' | 'night';
|
|
3
3
|
export interface DayNightConfig {
|
|
4
4
|
dayLengthMs?: number;
|
package/dist/projection.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { An as Container, Ln as DisplayObject, rr as SceneHostLike } from "./game-BrYrde7y.js";
|
|
2
2
|
export interface Camera25DConfig {
|
|
3
3
|
viewportWidth: number;
|
|
4
4
|
viewportHeight: number;
|
|
@@ -3200,6 +3200,37 @@ async function requestWebGpuDevice(canvas, options = {}) {
|
|
|
3200
3200
|
return null;
|
|
3201
3201
|
}
|
|
3202
3202
|
}
|
|
3203
|
+
const UNPREMUL_RECIP_LUT = /* @__PURE__ */ (() => {
|
|
3204
|
+
const lut = /* @__PURE__ */ new Uint32Array(256);
|
|
3205
|
+
for (let a = 1; a < 256; a++) lut[a] = Math.round(0xff0000 / a);
|
|
3206
|
+
return lut;
|
|
3207
|
+
})();
|
|
3208
|
+
/**
|
|
3209
|
+
* Convert premultiplied-alpha `RGBA8888` pixels (`rgb = straight * a / 255`) into W3C straight-alpha `RGBA8888`
|
|
3210
|
+
* in place using a 16.16 fixed-point reciprocal LUT, preventing `alpha^2` dark-halo fringing when exporting
|
|
3211
|
+
* transparent WebGPU / WebGL2 frames to PNG, `yuva420p` WebM, or `ffmpeg` `overlay` pipelines.
|
|
3212
|
+
*/
|
|
3213
|
+
function unpremultiplyRgbaInPlace(rgba) {
|
|
3214
|
+
const len = rgba.length & -4;
|
|
3215
|
+
for (let i = 0; i < len; i += 4) {
|
|
3216
|
+
const a = rgba[i + 3];
|
|
3217
|
+
if (a === 255) continue;
|
|
3218
|
+
if (a === 0) {
|
|
3219
|
+
rgba[i] = 0;
|
|
3220
|
+
rgba[i + 1] = 0;
|
|
3221
|
+
rgba[i + 2] = 0;
|
|
3222
|
+
continue;
|
|
3223
|
+
}
|
|
3224
|
+
const inv = UNPREMUL_RECIP_LUT[a];
|
|
3225
|
+
const r = rgba[i] * inv + 32768 >>> 16;
|
|
3226
|
+
const g = rgba[i + 1] * inv + 32768 >>> 16;
|
|
3227
|
+
const b = rgba[i + 2] * inv + 32768 >>> 16;
|
|
3228
|
+
rgba[i] = r > 255 ? 255 : r;
|
|
3229
|
+
rgba[i + 1] = g > 255 ? 255 : g;
|
|
3230
|
+
rgba[i + 2] = b > 255 ? 255 : b;
|
|
3231
|
+
}
|
|
3232
|
+
return rgba;
|
|
3233
|
+
}
|
|
3203
3234
|
const INITIAL_VERTS = 65536;
|
|
3204
3235
|
const INITIAL_INDICES = 98304;
|
|
3205
3236
|
const VERT_FLOATS = 6;
|
|
@@ -3457,8 +3488,10 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
3457
3488
|
device;
|
|
3458
3489
|
gpuContext;
|
|
3459
3490
|
format;
|
|
3491
|
+
transparent;
|
|
3460
3492
|
width;
|
|
3461
3493
|
height;
|
|
3494
|
+
lastPassTransparent = false;
|
|
3462
3495
|
offscreenTex = null;
|
|
3463
3496
|
offscreenView = null;
|
|
3464
3497
|
offscreenW = 0;
|
|
@@ -3538,6 +3571,8 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
3538
3571
|
const ctx = opts.context !== void 0 ? opts.context : canvas?.getContext?.("webgpu") ?? null;
|
|
3539
3572
|
const format = opts.format ?? (ctx ? "bgra8unorm" : "rgba8unorm");
|
|
3540
3573
|
this.format = format;
|
|
3574
|
+
this.transparent = Boolean(opts.transparent);
|
|
3575
|
+
this.lastPassTransparent = this.transparent;
|
|
3541
3576
|
this.gpuContext = ctx;
|
|
3542
3577
|
if (ctx) ctx.configure({
|
|
3543
3578
|
device: this.device,
|
|
@@ -4694,7 +4729,9 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4694
4729
|
}
|
|
4695
4730
|
if (this.sdfCount > 0) this.device.queue.writeBuffer(this.sdfInstVbo, 0, this.sdfF32.subarray(0, this.sdfCount * SDF_FLOATS));
|
|
4696
4731
|
const bg = camera.backgroundColor;
|
|
4697
|
-
const
|
|
4732
|
+
const isTrans = Boolean(this.transparent || camera.transparent);
|
|
4733
|
+
if (recordMainStats) this.lastPassTransparent = isTrans;
|
|
4734
|
+
const clearColor = isTrans ? {
|
|
4698
4735
|
r: 0,
|
|
4699
4736
|
g: 0,
|
|
4700
4737
|
b: 0,
|
|
@@ -4834,15 +4871,18 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4834
4871
|
readPixelsSync(out) {
|
|
4835
4872
|
if (typeof this.device._readBufferSync !== "function") throw new Error("RendererWebGpu.readPixelsSync: current GPUDevice only supports async mapAsync(); use await stage.toRgbaAsync() or stage.recordFrames() / stage.encodeVideo()");
|
|
4836
4873
|
const { buf, w, h, bytesPerRow, byteLen } = this.encodeCopyToStaging();
|
|
4874
|
+
let res;
|
|
4837
4875
|
if (bytesPerRow === w * 4 && this.format !== "bgra8unorm") {
|
|
4838
4876
|
const totalOut = w * h * 4;
|
|
4839
4877
|
const dst = out && out.byteLength >= totalOut ? out : new Uint8Array(totalOut);
|
|
4840
4878
|
this.device._readBufferSync(buf, dst, totalOut);
|
|
4841
|
-
|
|
4879
|
+
res = dst;
|
|
4880
|
+
} else {
|
|
4881
|
+
const raw = new Uint8Array(byteLen);
|
|
4882
|
+
this.device._readBufferSync(buf, raw, byteLen);
|
|
4883
|
+
res = this.unpackStagingBytes(raw, w, h, bytesPerRow, out);
|
|
4842
4884
|
}
|
|
4843
|
-
|
|
4844
|
-
this.device._readBufferSync(buf, raw, byteLen);
|
|
4845
|
-
return this.unpackStagingBytes(raw, w, h, bytesPerRow, out);
|
|
4885
|
+
return this.lastPassTransparent ? unpremultiplyRgbaInPlace(res) : res;
|
|
4846
4886
|
}
|
|
4847
4887
|
/**
|
|
4848
4888
|
* Asynchronously read rendered W3C `RGBA8888` pixels across ALL WebGPU backends
|
|
@@ -4854,7 +4894,8 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4854
4894
|
await buf.mapAsync(GPUMapMode_READ, 0, byteLen);
|
|
4855
4895
|
try {
|
|
4856
4896
|
const mapped = new Uint8Array(buf.getMappedRange(0, byteLen));
|
|
4857
|
-
|
|
4897
|
+
const res = this.unpackStagingBytes(mapped, w, h, bytesPerRow, out);
|
|
4898
|
+
return this.lastPassTransparent ? unpremultiplyRgbaInPlace(res) : res;
|
|
4858
4899
|
} finally {
|
|
4859
4900
|
buf.unmap();
|
|
4860
4901
|
}
|
|
@@ -4978,4 +5019,4 @@ var RendererWebGpu = class extends EventEmitter {
|
|
|
4978
5019
|
} catch {}
|
|
4979
5020
|
}
|
|
4980
5021
|
};
|
|
4981
|
-
export {
|
|
5022
|
+
export { openWgpuNativeFfi as a, Camera as c, openDawnWebGpu as i, requestWebGpuDevice as n, requestHeadlessWebGpu as o, unpremultiplyRgbaInPlace as r, Renderer2D as s, RendererWebGpu as t };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, openDawnWebGpu, openWgpuNativeFfi, requestHeadlessWebGpu, requestWebGpuDevice };
|
|
1
|
+
import { _n as openDawnWebGpu, an as RendererWebGpuOptions, cn as WebGpuCanvasContextLike, dn as unpremultiplyRgbaInPlace, fn as HeadlessWebGpuBackend, gn as OpenWgpuNativeFfiOptions, hn as OpenDawnWebGpuOptions, in as RendererWebGpu, ln as WebGpuDeviceLike, mn as HeadlessWebGpuOptions, on as RequestWebGpuOptions, pn as HeadlessWebGpuHandle, sn as WebGpuBootstrapResult, un as requestWebGpuDevice, vn as openWgpuNativeFfi, yn as requestHeadlessWebGpu } from "./game-BrYrde7y.js";
|
|
2
|
+
export { type HeadlessWebGpuBackend, type HeadlessWebGpuHandle, type HeadlessWebGpuOptions, type OpenDawnWebGpuOptions, type OpenWgpuNativeFfiOptions, RendererWebGpu, RendererWebGpuOptions, RequestWebGpuOptions, WebGpuBootstrapResult, WebGpuCanvasContextLike, WebGpuDeviceLike, openDawnWebGpu, openWgpuNativeFfi, requestHeadlessWebGpu, requestWebGpuDevice, unpremultiplyRgbaInPlace };
|
package/dist/renderer-webgpu.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as RendererWebGpu,
|
|
1
|
+
export { t as RendererWebGpu, i as openDawnWebGpu, a as openWgpuNativeFfi, o as requestHeadlessWebGpu, n as requestWebGpuDevice, r as unpremultiplyRgbaInPlace } from "./renderer-webgpu-B4AvHUEt.js";
|
package/dist/rig2d.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { T as BlendMode } from "./anims-BOvaKn6w.js";
|
|
2
|
-
import {
|
|
2
|
+
import { An as Container, Gn as Graphics, Kn as ImageObject, rr as SceneHostLike } from "./game-BrYrde7y.js";
|
|
3
3
|
export type RigCurveKind = 'linear' | 'step' | 'smoothstep' | 'outBack';
|
|
4
4
|
export interface RigBoneDef {
|
|
5
5
|
name: string;
|
package/dist/tilemap.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { At as computeDualGridMask, Bt as valueNoise2D, Ct as MountChunkedTilemapOptions, Dt as TileChunk, Et as TileCellFlags, Ft as mountChunkedTilemap, It as packChunkKey, Lt as positiveMod, Mt as fbm2D, Nt as floorDiv, Ot as bakeDualGridTileset, Pt as hash2D, Rt as unpackChunkX, St as IslandBiomeConfig, Tt as SurvivalBiomes, _t as BakedDualGridAtlas, bt as ChunkedTilemapOptions, gt as BakeDualGridTilesetOptions, jt as createIslandBiomeGenerator, kt as computeBlob47Index, vt as ChunkGeneratorFn, wt as MountedChunkedTilemap, xt as DualGridLayerSpec, yt as ChunkedTilemap, zt as unpackChunkY } from "./game-BrYrde7y.js";
|
|
2
2
|
export { BakeDualGridTilesetOptions, BakedDualGridAtlas, ChunkGeneratorFn, ChunkedTilemap, ChunkedTilemapOptions, DualGridLayerSpec, IslandBiomeConfig, MountChunkedTilemapOptions, MountedChunkedTilemap, SurvivalBiomes, TileCellFlags, TileChunk, bakeDualGridTileset, computeBlob47Index, computeDualGridMask, createIslandBiomeGenerator, fbm2D, floorDiv, hash2D, mountChunkedTilemap, packChunkKey, positiveMod, unpackChunkX, unpackChunkY, valueNoise2D };
|
package/dist/trace.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Gt as SceneDigestOptions, Ht as SceneDigestActiveFocus, Jt as SceneDigestSurfaceEntry, Kt as SceneDigestOverlayStats, Qt as sanitizeTrackToken, Ut as SceneDigestEngineSandbox, Vt as SceneDigest, Wt as SceneDigestNode, Xt as SceneDigestSurfaces, Yt as SceneDigestSurfaceSource, Zt as buildSceneDigest, qt as SceneDigestSandbox } from "./game-BrYrde7y.js";
|
|
2
2
|
export { SceneDigest, SceneDigestActiveFocus, SceneDigestEngineSandbox, SceneDigestNode, SceneDigestOptions, SceneDigestOverlayStats, SceneDigestSandbox, SceneDigestSurfaceEntry, SceneDigestSurfaceSource, SceneDigestSurfaces, buildSceneDigest, sanitizeTrackToken };
|
package/dist/world.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as RecipeDef, J as FrozenWorldCatalog, Q as ItemStack, X as ItemDef, Y as InventoryContainer, Z as ItemRegistry, at as WorkstationSnapshot, ct as WorldDeltaSnapshot, dt as captureWorldDelta, et as RecipeRegistry, ft as createWorldCatalogRuntime, ht as encodeWorldDeltaBytes, it as WorkstationScheduler, lt as WorldEntityRecord, mt as defineWorldCatalog, nt as WorkstationInstance, ot as WorldCatalogRuntime, pt as decodeWorldDeltaBytes, q as CatalogReloadDiff, rt as WorkstationJob, st as WorldCatalogSpec, tt as TileCellDelta, ut as applyWorldDelta } from "./game-BrYrde7y.js";
|
|
2
2
|
export { CatalogReloadDiff, FrozenWorldCatalog, InventoryContainer, ItemDef, ItemRegistry, ItemStack, RecipeDef, RecipeRegistry, TileCellDelta, WorkstationInstance, WorkstationJob, WorkstationScheduler, WorkstationSnapshot, WorldCatalogRuntime, WorldCatalogSpec, WorldDeltaSnapshot, WorldEntityRecord, applyWorldDelta, captureWorldDelta, createWorldCatalogRuntime, decodeWorldDeltaBytes, defineWorldCatalog, encodeWorldDeltaBytes };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holtjs/stage",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Zero-dependency TypeScript
|
|
3
|
+
"version": "0.17.1",
|
|
4
|
+
"description": "Zero-dependency TypeScript 2D & 2.5D game and motion-compositing engine for WebGPU/WebGL2/Canvas2D, Bun, and Node.js with GPU SDF UI, deterministic coroutines, alpha-overlay export, and FFmpeg video compositing.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Botiverse, Inc.",
|
|
7
7
|
"homepage": "https://github.com/botiverse-play/stage#readme",
|
package/skills/stage/SKILL.md
CHANGED
|
@@ -3,13 +3,13 @@ name: stage
|
|
|
3
3
|
description: Build zero-dependency WebGPU/WebGL2/Canvas2D 2D & 2.5D games, GPU SDF UIs, StageKernel plugins, survival sandboxes, and zero-browser 60 FPS programmable videos/images with @holtjs/stage (RendererWebGpu, StageKernel, InputTimeline, Rig2D cutout skeletons, Dual-Grid ChunkedTilemap, Camera25D projection, DayNightCycle & 2D normal-map lighting, WorldDeltaSave, PanelObject, Flex/Wrap layout, damped springs, SurfaceTree barriers, SoaWorld ECS, SpatialHashGrid, FlowFieldGrid/A* nav, deterministic hit/knockback, ParticlePool/JuiceController, procedural audio DSP, headless 60 FPS recorder, and zero-PII buildSceneDigest tracing).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Building 2D/2.5D Games, WebGPU UI & 60 FPS
|
|
6
|
+
# Building 2D/2.5D Games, WebGPU UI & 60 FPS Motion Compositing with `@holtjs/stage`
|
|
7
7
|
|
|
8
|
-
Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline`
|
|
8
|
+
Use this skill whenever creating or modifying a browser 2D/2.5D game, WebGPU/WebGL2 canvas UI, survival sandbox, automated `InputTimeline` / `CameraDirector` sequence, or headless 60 FPS alpha-overlay & video compositing pipeline built on `@holtjs/stage` (`v0.17.1`, 22 subpaths).
|
|
9
9
|
|
|
10
|
-
For the exhaustive exported symbol list across all
|
|
10
|
+
For the exhaustive exported symbol list across all 22 subpaths, see [references/subpaths.md](references/subpaths.md).
|
|
11
11
|
|
|
12
|
-
## 1. Install & Choose from the
|
|
12
|
+
## 1. Install & Choose from the 22 Subpaths
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
15
|
pnpm add @holtjs/stage
|
|
@@ -22,8 +22,8 @@ pnpm add @holtjs/stage
|
|
|
22
22
|
| Core engine (`Game`, `Scene`, `SpriteObject`, `AnimationManager`, `ShapeBatch`, `InstancedBatch`, `Panel`, `Graphics`, `Container`, `Text`) | `@holtjs/stage` | Browser (Headless via `./headless`) |
|
|
23
23
|
| Sprite-sheet & 4/8-directional atlas animation (`AnimationManager`, `createFromAtlas`) | `@holtjs/stage/anims` | Yes |
|
|
24
24
|
| Native WebGPU WGSL batch & analytical SDF renderer (`RendererWebGpu`, `requestWebGpuDevice`) | `@holtjs/stage/webgpu` | Browser WebGPU |
|
|
25
|
-
| `StageKernel` plugins, `ActionMap`,
|
|
26
|
-
|
|
|
25
|
+
| `StageKernel` plugins, `ActionMap`, `createInputTimeline`, `createCameraDirector`, `RollbackSession` | `@holtjs/stage/kernel` | Yes |
|
|
26
|
+
| Headless WebGPU/Canvas2D 60 FPS PNG, Alpha Overlays, `composeVideoLayers` & `runHeadlessRollouts` | `@holtjs/stage/headless` | Yes (Bun / Node / Deno) |
|
|
27
27
|
| 2D cutout skeletal rig, O(1) equipment/skin swap, 2-layer bone-masked mixer | `@holtjs/stage/rig2d` | Yes |
|
|
28
28
|
| Sparse `ChunkedTilemap`, 16-tile Dual-Grid & 47-tile Blob autotilers, island generator | `@holtjs/stage/tilemap` | Yes |
|
|
29
29
|
| Rotatable oblique `Camera25D` + `mountStage25D` upright cylindrical billboards | `@holtjs/stage/projection` | Yes |
|
|
@@ -245,35 +245,47 @@ scene.tweens.spring({
|
|
|
245
245
|
scene.tweens.to({ targets: card, alpha: { from: 0, to: 1 }, duration: 180, ease: 'outCubic' });
|
|
246
246
|
```
|
|
247
247
|
|
|
248
|
-
## 7.
|
|
248
|
+
## 7. Headless 60 FPS Alpha Overlays, `CameraDirector` & `composeVideoLayers` (`@holtjs/stage/headless`)
|
|
249
249
|
|
|
250
250
|
```ts
|
|
251
|
-
import {
|
|
252
|
-
import {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
251
|
+
import { createCameraDirector } from '@holtjs/stage/kernel';
|
|
252
|
+
import {
|
|
253
|
+
composeVideoLayers,
|
|
254
|
+
createHeadlessStageAsync,
|
|
255
|
+
renderStoryboard,
|
|
256
|
+
} from '@holtjs/stage/headless';
|
|
257
|
+
|
|
258
|
+
const director = createCameraDirector();
|
|
259
|
+
const stage = await createHeadlessStageAsync({
|
|
260
|
+
renderer: 'auto',
|
|
258
261
|
width: 1280,
|
|
259
262
|
height: 720,
|
|
260
263
|
fps: 60,
|
|
261
|
-
|
|
262
|
-
|
|
264
|
+
transparent: true, // straight-alpha RGBA readback (`unpremultiplyRgbaInPlace`)
|
|
265
|
+
plugins: [director],
|
|
266
|
+
scene: OverlayScene,
|
|
263
267
|
});
|
|
264
268
|
|
|
265
|
-
//
|
|
266
|
-
const
|
|
267
|
-
frames: [0, 60, 120, 180, 240, 300],
|
|
268
|
-
columns: 3,
|
|
269
|
-
tileScale: 0.5,
|
|
270
|
-
createCanvas,
|
|
271
|
-
});
|
|
269
|
+
// 1. Visual QA keyframe contact sheet + paired SceneDigest array:
|
|
270
|
+
const qa = renderStoryboard(stage, { frames: [0, 120, 240, 360], columns: 2, tileScale: 0.5 });
|
|
272
271
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
const wavBytes = audio.toWav(5000);
|
|
272
|
+
// 2. Encode 60 FPS transparent Alpha Overlay (`libvpx-vp9` `yuva420p` on .webm, `qtrle` on .mov):
|
|
273
|
+
await stage.encodeVideo({ outputPath: 'overlay.webm', frames: 600, alpha: true });
|
|
276
274
|
stage.destroy();
|
|
275
|
+
|
|
276
|
+
// 3. Composite external video cuts + Stage Alpha Overlay + voiceover segments + ducked BGM:
|
|
277
|
+
await composeVideoLayers({
|
|
278
|
+
outputPath: 'final.mp4',
|
|
279
|
+
fps: 60,
|
|
280
|
+
cuts: [
|
|
281
|
+
{ path: 'shot1.mp4', startSec: 2, durationSec: 5, zoom: 1.25, cropY: 0 },
|
|
282
|
+
{ path: 'shot2.mp4', startSec: 0, durationSec: 5 },
|
|
283
|
+
],
|
|
284
|
+
overlays: [{ path: 'overlay.webm', startSec: 0 }],
|
|
285
|
+
voiceoverSegments: [{ path: 'seg0.mp3', startSec: 0.4 }],
|
|
286
|
+
bgmPath: 'bgm.wav',
|
|
287
|
+
ducking: true,
|
|
288
|
+
});
|
|
277
289
|
```
|
|
278
290
|
|
|
279
291
|
## 8. High-Value Gotchas (Avoid These Mistakes!)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@holtjs/stage` Subpath API Quick Reference
|
|
2
2
|
|
|
3
|
-
All symbols verified against `src/*.ts` (`@holtjs/stage@0.
|
|
3
|
+
All symbols verified against `src/*.ts` (`@holtjs/stage@0.17.1`, 22 subpaths).
|
|
4
4
|
|
|
5
5
|
## `@holtjs/stage` (~71.3 kB gz · Core Engine Barrel)
|
|
6
6
|
- **Bootstrap & Lifecycle**: `Stage` / `Stage2D` (namespaces), `AUTO`, `WEBGPU`, `WEBGL`, `CANVAS`, `Scale` (`NONE`, `FIT`, `RESIZE`), `Scenes`, `Game` (`.stepSimOnly()`, `.kernel`, `.anims`), `Scene` (`.update()` simulation + `.preRender()` presentation, `.anims`), `SceneManager`, `ScaleManager` (`.fitToContainer()`), `GameLoop`, `EngineClock`, `LoaderPlugin` (`.atlas()`), `JsonCache`, `GameObjectFactory` (`scene.add.sprite`, `shapeBatch`, `instancedBatch`, `customPass`, `panel`, `blitter`, etc.), `AnimationManager` (`.create()`, `.createFromAtlas()`, `.generateFrameNames()`, `.generateFrameNumbers()`)
|
|
@@ -23,15 +23,16 @@ All symbols verified against `src/*.ts` (`@holtjs/stage@0.16.0`, 22 subpaths).
|
|
|
23
23
|
- `StageKernel` (`game.kernel`): `.use(plugin)`, `.remove(id)`, `.get(id)`, `.addInputProvider(p)`, `.actions`, `.digest()`
|
|
24
24
|
- `ActionMap`: `.bind(action, codes)`, `.unbind(action)`, `.isDown(action)`, `.justPressed(action)`, `.justReleased(action)`, `.axis(negAction, posAction)`
|
|
25
25
|
- `createInputTimeline(opts?)`: `.moveTo()`, `.click(trackIdOrPt, atMs, opts?)`, `.drag()`, `.pressKey()`, `.typeText()` (with optional rendered virtual cursor & click ripples via `showCursor: true`)
|
|
26
|
-
- `createInputRecorder(id?)`, `createInputReplay(entries, id?)`, `RollbackSession` (`.fromSoaWorld()`, `.advance()`, `.applyAuthoritativeInput()`, `.rewindTo()`, `.checksumAt()`), `createRollbackSession(opts)`
|
|
27
|
-
- Types: `StagePlugin`, `InputProvider`, `StageInputEvent`, `InputTargetSpec`, `TimelineClickOptions`, `TimelineDragOptions`, `TimelineKeyOptions`, `InputTimelineOptions`, `InputTimelinePlugin`, `InputRecorderPlugin`, `RecordedInputEntry`, `RollbackStateCodec`, `RollbackSessionOptions`, `RollbackResult`, `RollbackStats`
|
|
26
|
+
- `createInputRecorder(id?)`, `createInputReplay(entries, id?)`, `createCameraDirector(opts?)` (`.cutTo()`, `.panTo()`, `.follow()`, `.spotlight()`, `.clearSpotlight()`), `RollbackSession` (`.fromSoaWorld()`, `.advance()`, `.applyAuthoritativeInput()`, `.rewindTo()`, `.checksumAt()`), `createRollbackSession(opts)`
|
|
27
|
+
- Types: `StagePlugin`, `InputProvider`, `StageInputEvent`, `InputTargetSpec`, `TimelineClickOptions`, `TimelineDragOptions`, `TimelineKeyOptions`, `InputTimelineOptions`, `InputTimelinePlugin`, `InputRecorderPlugin`, `RecordedInputEntry`, `CameraDirectorPlugin`, `CameraDirectorTarget`, `CameraPanOptions`, `CameraSpotlightOptions`, `RollbackStateCodec`, `RollbackSessionOptions`, `RollbackResult`, `RollbackStats`
|
|
28
28
|
|
|
29
|
-
## `@holtjs/stage/headless` (~
|
|
30
|
-
- `createHeadlessStageAsync(opts)` (`openHeadlessStage`), `createHeadlessStage(opts)`: `.step()`, `.stepToMs()`, `.stepToFrame()`, `.fastForward(frames)`, `.pointerDown/Move/Up()`, `.keyDown/Up()`, `.toRgba()`, `.toRgbaAsync()`, `.toPng()`, `.toPngAsync()`, `.encodeVideo(opts)
|
|
29
|
+
## `@holtjs/stage/headless` (~44 kB gz · Headless WebGPU, Alpha Overlays, FFmpeg Compositor & Batch Rollouts)
|
|
30
|
+
- `createHeadlessStageAsync(opts)` (`openHeadlessStage`), `createHeadlessStage(opts)`: `.step()`, `.stepToMs()`, `.stepToFrame()`, `.fastForward(frames)`, `.pointerDown/Move/Up()`, `.keyDown/Up()`, `.toRgba()`, `.toRgbaAsync()`, `.toPng()`, `.toPngAsync()`, `.encodeVideo(opts)` (`alpha?: boolean`), `.digest()`, `.recordFrames({ ..., reuseFrameBuffer? })`
|
|
31
|
+
- `composeVideoLayers(opts)`, `buildFfmpegCompositeArgs(opts)`, `unpremultiplyRgbaInPlace(rgba)`
|
|
31
32
|
- `runHeadlessRollouts(opts)` -> `HeadlessRolloutReport` (`summary` with `min / max / mean / p50 / p95 / sum`, `ticksPerSecond`, `results`)
|
|
32
33
|
- `renderStoryboard(stage, opts)` -> `{ png, width, height, digests }`
|
|
33
34
|
- `createAudioTimeline(opts?)`: `.addAtMs()`, `.addAtFrame()`, `.toStereoPcm16()`, `.toWav()`
|
|
34
|
-
- Types: `HeadlessCanvasLike`, `CreateHeadlessCanvas`, `HeadlessStageOptions`, `AsyncHeadlessStageOptions`, `HeadlessRecordedFrame`, `RecordFramesOptions`, `HeadlessStage`, `StoryboardOptions`, `StoryboardResult`, `AudioCueOptions`, `AudioTimelineOptions`, `AudioTimeline`, `EncodeVideoWithFfmpegOptions`, `EncodeVideoResult`, `HeadlessRolloutOptions`, `HeadlessRolloutReport`, `MetricSummaryStats`
|
|
35
|
+
- Types: `HeadlessCanvasLike`, `CreateHeadlessCanvas`, `HeadlessStageOptions`, `AsyncHeadlessStageOptions`, `HeadlessRecordedFrame`, `RecordFramesOptions`, `HeadlessStage`, `StoryboardOptions`, `StoryboardResult`, `AudioCueOptions`, `AudioTimelineOptions`, `AudioTimeline`, `EncodeVideoWithFfmpegOptions`, `EncodeVideoResult`, `ComposeVideoLayersOptions`, `ComposeVideoLayersResult`, `CompositeVideoCut`, `CompositeOverlayLayer`, `CompositeVoiceoverSegment`, `HeadlessRolloutOptions`, `HeadlessRolloutReport`, `MetricSummaryStats`
|
|
35
36
|
|
|
36
37
|
## `@holtjs/stage/rig2d` (~5.7 kB gz · zero DOM)
|
|
37
38
|
- Skeleton & Mixer: `defineRig2DSkeleton(def)`, `Rig2DInstance` (`.play(clip, opts?)`, `.playOverlay(clip, { maskBones?, loop? })`, `.clearOverlay()`, `.setAttachment(slot, attachment)`, `.applySkin(skinNameOrMap)`, `.setSlotTint()`, `.setBoneManualOffset()`, `.onEvent(fn)`, `.step(deltaMs)`, `.getBoneWorldTransform(bone, out?)`)
|