@moku-labs/game 0.15.89 → 0.15.91
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/dist/app/page.d.mts +1 -1
- package/dist/app/system.d.mts +3 -3
- package/dist/app.d.mts +3 -3
- package/dist/app.mjs +1 -1
- package/dist/assets.d.mts +1 -1
- package/dist/cli.mjs +3 -2
- package/dist/{commands-COLf1y-2.d.mts → commands-DUco80gt.d.mts} +5 -5
- package/dist/control.d.mts +4 -4
- package/dist/{define-CegLUMAK.d.mts → define-C-EbeoLA.d.mts} +2 -2
- package/dist/{headless-DhNDRVXy.d.mts → headless-Dasz6dgy.d.mts} +1 -1
- package/dist/{index-B1bdw4B2.d.mts → index-vPc22SoP.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1 -1
- package/dist/inspect.d.mts +6 -6
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/{runtime-a9AK--Fj.d.mts → runtime-CW4HJWqC.d.mts} +1 -1
- package/dist/{src-CZSz-mMz.mjs → src-BBJh9Uxh.mjs} +790 -33
- package/dist/testing.d.mts +4 -4
- package/dist/testing.mjs +1 -1
- package/dist/{types-Fbq4snuX.d.mts → types-B2Dh7oWu.d.mts} +4 -4
- package/dist/{types-CXbcEveH.d.mts → types-BMUuyOcm.d.mts} +1 -1
- package/dist/{types-CJzm90e_.d.mts → types-Btqe51cJ.d.mts} +2 -2
- package/dist/{types-CgrPwBjC.d.mts → types-Cc7uKiHX.d.mts} +2 -2
- package/dist/{types--QXvRPXM.d.mts → types-D1lRinVJ.d.mts} +178 -3
- package/dist/{visual-xduW0Ojp.d.mts → visual-BMyWTUgm.d.mts} +6 -6
- package/dist/visual.d.mts +1 -1
- package/llms.txt +3 -2
- package/package.json +1 -1
|
@@ -13418,7 +13418,7 @@ function emptyRest() {
|
|
|
13418
13418
|
*
|
|
13419
13419
|
* @returns An empty table of key to entity.
|
|
13420
13420
|
*/
|
|
13421
|
-
function emptyKeys$
|
|
13421
|
+
function emptyKeys$2() {
|
|
13422
13422
|
return /* @__PURE__ */ new Map();
|
|
13423
13423
|
}
|
|
13424
13424
|
/**
|
|
@@ -13614,7 +13614,7 @@ function createProjectionApi(ctx, deps) {
|
|
|
13614
13614
|
},
|
|
13615
13615
|
registerKey: (projection, key, entity) => {
|
|
13616
13616
|
if (state.mounted.get(projection)?.live.has(key) === true) throw new Error(`[game] Key "${key}" of projection "${projection}" is already a live view.\n Register the element under another key.`);
|
|
13617
|
-
const byKey = state.keys.get(projection) ?? emptyKeys$
|
|
13617
|
+
const byKey = state.keys.get(projection) ?? emptyKeys$2();
|
|
13618
13618
|
byKey.set(key, entity);
|
|
13619
13619
|
state.keys.set(projection, byKey);
|
|
13620
13620
|
state.keysByEntity.set(entity, {
|
|
@@ -17169,6 +17169,11 @@ function createHostApi(ctx, deps) {
|
|
|
17169
17169
|
if (!state.ready || app === void 0) return;
|
|
17170
17170
|
app.renderer.texture.initSource(source);
|
|
17171
17171
|
},
|
|
17172
|
+
canvasTexture: () => liveDevice(state) === void 0 ? void 0 : state.canvas?.getContext("webgpu")?.getCurrentTexture(),
|
|
17173
|
+
gpuTexture: (source) => {
|
|
17174
|
+
const textures = state.ready ? state.app?.renderer.texture : void 0;
|
|
17175
|
+
return textures !== void 0 && "getGpuSource" in textures ? textures.getGpuSource(source) : void 0;
|
|
17176
|
+
},
|
|
17172
17177
|
clearsCanvas: () => state.ready && state.app?.renderer.background.clearBeforeRender === true,
|
|
17173
17178
|
setResolution: (value, reason) => askResolution(state, value, reason),
|
|
17174
17179
|
overrideResolution: (value) => {
|
|
@@ -26965,6 +26970,359 @@ function stopMonitor(state) {
|
|
|
26965
26970
|
if (typeof __MOKU_GAME_AGENT__ !== "undefined" && __MOKU_GAME_AGENT__ && state.perf !== void 0) stopPerf(state.perf, state.sinks);
|
|
26966
26971
|
}
|
|
26967
26972
|
//#endregion
|
|
26973
|
+
//#region src/plugins/renderer/shots/chain.ts
|
|
26974
|
+
/** The factor of a hop: its output texel centre falls on a corner of source pixels, so 2 x 2 taps are an exact box. */
|
|
26975
|
+
const HOP_FACTOR = 4;
|
|
26976
|
+
/** The widest radius of a kernel: the centre, and 15 pairs. */
|
|
26977
|
+
const MAX_RADIUS = 30;
|
|
26978
|
+
/** The radius of a kernel, in sigmas. */
|
|
26979
|
+
const RADIUS_SIGMAS = 3;
|
|
26980
|
+
/** The widest blur, in texels of the shot: its radius is the widest the uniform holds. */
|
|
26981
|
+
const MAX_SIGMA = MAX_RADIUS / RADIUS_SIGMAS;
|
|
26982
|
+
/** Taps a side of an exact box: each averages two source pixels, at 2 texels from the next. */
|
|
26983
|
+
const BOX_TAPS = 2;
|
|
26984
|
+
/** Taps a side of any other hop, spread evenly over it. */
|
|
26985
|
+
const SPREAD_TAPS = 3;
|
|
26986
|
+
/** Floats of the box uniform: `texel`, `step`, `size`, `count` and its padding. */
|
|
26987
|
+
const BOX_FLOATS = 8;
|
|
26988
|
+
/** Where the taps start in the blur uniform: an array of `vec4f` is aligned to 16 bytes, past `count`. */
|
|
26989
|
+
const KERNEL_HEAD = 8;
|
|
26990
|
+
/** Floats of one tap in the blur uniform: a `vec4f`. */
|
|
26991
|
+
const TAP_FLOATS = 4;
|
|
26992
|
+
/**
|
|
26993
|
+
* The sizes a chain draws into, the shot last: the canvas divided by 4, rounding up, while that stays at least twice
|
|
26994
|
+
* the shot's size, then the shot. A last hop of a ratio near 1 would sample without averaging anything, so a canvas
|
|
26995
|
+
* smaller than 8 x the shot goes straight to it.
|
|
26996
|
+
*
|
|
26997
|
+
* @param canvasWidth - The canvas in device pixels, across.
|
|
26998
|
+
* @param canvasHeight - The canvas in device pixels, down.
|
|
26999
|
+
* @param width - The shot, across.
|
|
27000
|
+
* @param height - The shot, down.
|
|
27001
|
+
* @returns The hops, in order.
|
|
27002
|
+
* @example
|
|
27003
|
+
* ```ts
|
|
27004
|
+
* hopsOf(1080, 2340, 96, 208); // [{ width: 270, height: 585 }, { width: 96, height: 208 }]
|
|
27005
|
+
* ```
|
|
27006
|
+
*/
|
|
27007
|
+
function hopsOf(canvasWidth, canvasHeight, width, height) {
|
|
27008
|
+
const hops = [];
|
|
27009
|
+
let hopWidth = Math.ceil(canvasWidth / HOP_FACTOR);
|
|
27010
|
+
let hopHeight = Math.ceil(canvasHeight / HOP_FACTOR);
|
|
27011
|
+
while (hopWidth >= 2 * width && hopHeight >= 2 * height) {
|
|
27012
|
+
hops.push({
|
|
27013
|
+
width: hopWidth,
|
|
27014
|
+
height: hopHeight
|
|
27015
|
+
});
|
|
27016
|
+
hopWidth = Math.ceil(hopWidth / HOP_FACTOR);
|
|
27017
|
+
hopHeight = Math.ceil(hopHeight / HOP_FACTOR);
|
|
27018
|
+
}
|
|
27019
|
+
hops.push({
|
|
27020
|
+
width,
|
|
27021
|
+
height
|
|
27022
|
+
});
|
|
27023
|
+
return hops;
|
|
27024
|
+
}
|
|
27025
|
+
/**
|
|
27026
|
+
* One side of a Gaussian of radius `ceil(3 * sigma)`, normalised so the centre and twice the rest make 1, its
|
|
27027
|
+
* neighbouring texels paired into one bilinear tap at their weights' centre. At most `MAX_TAPS` taps.
|
|
27028
|
+
*
|
|
27029
|
+
* @param sigma - The sigma in texels; 0 or less is no blur.
|
|
27030
|
+
* @returns The taps, the centre first; none for no blur.
|
|
27031
|
+
* @example
|
|
27032
|
+
* ```ts
|
|
27033
|
+
* gaussianTaps(0); // []
|
|
27034
|
+
* ```
|
|
27035
|
+
*/
|
|
27036
|
+
function gaussianTaps(sigma) {
|
|
27037
|
+
if (sigma <= 0) return [];
|
|
27038
|
+
const radius = Math.min(Math.ceil(RADIUS_SIGMAS * sigma), MAX_RADIUS);
|
|
27039
|
+
const spread = 2 * sigma * sigma;
|
|
27040
|
+
const weightAt = (texel) => Math.exp(-(texel * texel) / spread);
|
|
27041
|
+
let total = 1;
|
|
27042
|
+
for (let texel = 1; texel <= radius; texel += 1) total += 2 * weightAt(texel);
|
|
27043
|
+
const taps = [{
|
|
27044
|
+
offset: 0,
|
|
27045
|
+
weight: 1 / total
|
|
27046
|
+
}];
|
|
27047
|
+
for (let texel = 1; texel <= radius; texel += 2) {
|
|
27048
|
+
const near = weightAt(texel);
|
|
27049
|
+
const far = texel < radius ? weightAt(texel + 1) : 0;
|
|
27050
|
+
const pair = near + far;
|
|
27051
|
+
if (pair > 0) taps.push({
|
|
27052
|
+
offset: (texel * near + (texel + 1) * far) / pair,
|
|
27053
|
+
weight: pair / total
|
|
27054
|
+
});
|
|
27055
|
+
}
|
|
27056
|
+
return taps;
|
|
27057
|
+
}
|
|
27058
|
+
/**
|
|
27059
|
+
* The sigma of a take in texels of the shot, from the reference units of the config, capped.
|
|
27060
|
+
*
|
|
27061
|
+
* @param blur - `shots.blur`.
|
|
27062
|
+
* @param width - `shots.width`.
|
|
27063
|
+
* @param frameWidth - The frame's width in reference units now; 0 while there is no frame.
|
|
27064
|
+
* @returns The sigma; 0 for no blur.
|
|
27065
|
+
* @example
|
|
27066
|
+
* ```ts
|
|
27067
|
+
* sigmaOf(54, 96, 1080); // 4.8
|
|
27068
|
+
* ```
|
|
27069
|
+
*/
|
|
27070
|
+
function sigmaOf(blur, width, frameWidth) {
|
|
27071
|
+
return frameWidth > 0 ? Math.min(blur * width / frameWidth, MAX_SIGMA) : 0;
|
|
27072
|
+
}
|
|
27073
|
+
/**
|
|
27074
|
+
* The uniform of a hop. A hop of a factor of 4 takes two taps a side at +-1 source pixel: an exact box of 4 x 4. The
|
|
27075
|
+
* last hop, of any other factor, takes three a side, a third of the ratio apart.
|
|
27076
|
+
*
|
|
27077
|
+
* @param source - What it reads.
|
|
27078
|
+
* @param target - What it draws.
|
|
27079
|
+
* @param last - True for the hop that ends at the shot.
|
|
27080
|
+
* @returns `texel`, `step`, `size`, `count` of the box shader.
|
|
27081
|
+
* @example
|
|
27082
|
+
* ```ts
|
|
27083
|
+
* boxData({ width: 8, height: 4 }, { width: 2, height: 1 }, false); // [0.125, 0.25, 2, 2, 2, 1, 2, 0]
|
|
27084
|
+
* ```
|
|
27085
|
+
*/
|
|
27086
|
+
function boxData(source, target, last) {
|
|
27087
|
+
const ratioX = source.width / target.width;
|
|
27088
|
+
const ratioY = source.height / target.height;
|
|
27089
|
+
const exactBox = !last || ratioX === HOP_FACTOR && ratioY === HOP_FACTOR;
|
|
27090
|
+
const data = new Float32Array(BOX_FLOATS);
|
|
27091
|
+
data.set([
|
|
27092
|
+
1 / source.width,
|
|
27093
|
+
1 / source.height,
|
|
27094
|
+
exactBox ? BOX_TAPS : ratioX / SPREAD_TAPS,
|
|
27095
|
+
exactBox ? BOX_TAPS : ratioY / SPREAD_TAPS,
|
|
27096
|
+
target.width,
|
|
27097
|
+
target.height,
|
|
27098
|
+
exactBox ? BOX_TAPS : SPREAD_TAPS
|
|
27099
|
+
]);
|
|
27100
|
+
return data;
|
|
27101
|
+
}
|
|
27102
|
+
/**
|
|
27103
|
+
* The uniform of one axis of the Gaussian: one texel along that axis, the size, the tap count, and each tap as the `x`
|
|
27104
|
+
* and `y` of a `vec4f`.
|
|
27105
|
+
*
|
|
27106
|
+
* @param size - The shot.
|
|
27107
|
+
* @param axis - The axis of the pass.
|
|
27108
|
+
* @param taps - The kernel, at most `MAX_TAPS`.
|
|
27109
|
+
* @returns `axis`, `size`, `count`, `taps` of the blur shader.
|
|
27110
|
+
* @example
|
|
27111
|
+
* ```ts
|
|
27112
|
+
* blurData({ width: 4, height: 2 }, "y", [{ offset: 0, weight: 1 }]).slice(0, 5); // [0, 0.5, 4, 2, 1]
|
|
27113
|
+
* ```
|
|
27114
|
+
*/
|
|
27115
|
+
function blurData(size, axis, taps) {
|
|
27116
|
+
const data = /* @__PURE__ */ new Float32Array(72);
|
|
27117
|
+
data.set([
|
|
27118
|
+
axis === "x" ? 1 / size.width : 0,
|
|
27119
|
+
axis === "y" ? 1 / size.height : 0,
|
|
27120
|
+
size.width,
|
|
27121
|
+
size.height,
|
|
27122
|
+
taps.length
|
|
27123
|
+
]);
|
|
27124
|
+
for (const [index, tap] of taps.entries()) data.set([tap.offset, tap.weight], KERNEL_HEAD + index * TAP_FLOATS);
|
|
27125
|
+
return data;
|
|
27126
|
+
}
|
|
27127
|
+
//#endregion
|
|
27128
|
+
//#region src/plugins/renderer/shots/shader.ts
|
|
27129
|
+
/**
|
|
27130
|
+
* @file renderer/shots — the two filters of a chain and their pipelines: a box filter of bilinear taps and one axis of a
|
|
27131
|
+
* Gaussian. One fullscreen triangle each, reading a texture through a sampler. Their weights and sizes live in uniforms
|
|
27132
|
+
* (`chain.ts` writes them), so a kernel that follows the frame's width needs no new pipeline.
|
|
27133
|
+
*/
|
|
27134
|
+
/** The format of a shot, of the hops between the canvas and it, and so of both pipelines' target. */
|
|
27135
|
+
const SHOT_FORMAT = "bgra8unorm";
|
|
27136
|
+
/** The vertex stage and the two bindings every filter reads: a triangle over the whole target. */
|
|
27137
|
+
const SHARED_WGSL = `
|
|
27138
|
+
@group(0) @binding(0) var picture: texture_2d<f32>;
|
|
27139
|
+
@group(0) @binding(1) var smooth_sampler: sampler;
|
|
27140
|
+
|
|
27141
|
+
@vertex fn vertex_main(@builtin(vertex_index) index: u32) -> @builtin(position) vec4f {
|
|
27142
|
+
let corner = vec2f(f32((index << 1u) & 2u), f32(index & 2u));
|
|
27143
|
+
|
|
27144
|
+
return vec4f(corner * 2.0 - 1.0, 0.0, 1.0);
|
|
27145
|
+
}
|
|
27146
|
+
`;
|
|
27147
|
+
/** The box filter: `count` x `count` taps round the centre of a target pixel, `step` source pixels apart. */
|
|
27148
|
+
const BOX_WGSL = `${SHARED_WGSL}
|
|
27149
|
+
struct Box {
|
|
27150
|
+
texel: vec2f,
|
|
27151
|
+
spacing: vec2f,
|
|
27152
|
+
size: vec2f,
|
|
27153
|
+
count: f32,
|
|
27154
|
+
};
|
|
27155
|
+
|
|
27156
|
+
@group(0) @binding(2) var<uniform> box: Box;
|
|
27157
|
+
|
|
27158
|
+
@fragment fn fragment_main(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
27159
|
+
let uv = position.xy / box.size;
|
|
27160
|
+
let count = i32(box.count);
|
|
27161
|
+
let centre = (box.count - 1.0) / 2.0;
|
|
27162
|
+
var sum = vec4f(0.0);
|
|
27163
|
+
|
|
27164
|
+
for (var y = 0; y < count; y++) {
|
|
27165
|
+
for (var x = 0; x < count; x++) {
|
|
27166
|
+
let place = (vec2f(f32(x), f32(y)) - centre) * box.spacing * box.texel;
|
|
27167
|
+
|
|
27168
|
+
sum += textureSampleLevel(picture, smooth_sampler, uv + place, 0.0);
|
|
27169
|
+
}
|
|
27170
|
+
}
|
|
27171
|
+
|
|
27172
|
+
return vec4f(sum.rgb / (box.count * box.count), 1.0);
|
|
27173
|
+
}
|
|
27174
|
+
`;
|
|
27175
|
+
/** One axis of the Gaussian: the centre, then each tap on both sides. A tap's `x` is its offset, its `y` its weight. */
|
|
27176
|
+
const BLUR_WGSL = `${SHARED_WGSL}
|
|
27177
|
+
struct Kernel {
|
|
27178
|
+
axis: vec2f,
|
|
27179
|
+
size: vec2f,
|
|
27180
|
+
count: f32,
|
|
27181
|
+
taps: array<vec4f, 16>,
|
|
27182
|
+
};
|
|
27183
|
+
|
|
27184
|
+
@group(0) @binding(2) var<uniform> kernel: Kernel;
|
|
27185
|
+
|
|
27186
|
+
@fragment fn fragment_main(@builtin(position) position: vec4f) -> @location(0) vec4f {
|
|
27187
|
+
let uv = position.xy / kernel.size;
|
|
27188
|
+
var sum = textureSampleLevel(picture, smooth_sampler, uv, 0.0) * kernel.taps[0].y;
|
|
27189
|
+
|
|
27190
|
+
for (var index = 1; index < i32(kernel.count); index++) {
|
|
27191
|
+
let tap = kernel.taps[index];
|
|
27192
|
+
let place = tap.x * kernel.axis;
|
|
27193
|
+
|
|
27194
|
+
sum += textureSampleLevel(picture, smooth_sampler, uv + place, 0.0) * tap.y;
|
|
27195
|
+
sum += textureSampleLevel(picture, smooth_sampler, uv - place, 0.0) * tap.y;
|
|
27196
|
+
}
|
|
27197
|
+
|
|
27198
|
+
return vec4f(sum.rgb, 1.0);
|
|
27199
|
+
}
|
|
27200
|
+
`;
|
|
27201
|
+
/**
|
|
27202
|
+
* Compiles one filter off the main thread.
|
|
27203
|
+
*
|
|
27204
|
+
* @param device - The device.
|
|
27205
|
+
* @param code - Its WGSL.
|
|
27206
|
+
* @returns The pipeline.
|
|
27207
|
+
*/
|
|
27208
|
+
function pipelineOf(device, code) {
|
|
27209
|
+
const module = device.createShaderModule({ code });
|
|
27210
|
+
return device.createRenderPipelineAsync({
|
|
27211
|
+
layout: "auto",
|
|
27212
|
+
vertex: {
|
|
27213
|
+
module,
|
|
27214
|
+
entryPoint: "vertex_main"
|
|
27215
|
+
},
|
|
27216
|
+
fragment: {
|
|
27217
|
+
module,
|
|
27218
|
+
entryPoint: "fragment_main",
|
|
27219
|
+
targets: [{ format: SHOT_FORMAT }]
|
|
27220
|
+
},
|
|
27221
|
+
primitive: { topology: "triangle-list" }
|
|
27222
|
+
});
|
|
27223
|
+
}
|
|
27224
|
+
/**
|
|
27225
|
+
* Compiles the pipelines of a device, off the main thread: a take never compiles in the tap frame.
|
|
27226
|
+
*
|
|
27227
|
+
* @param device - The device.
|
|
27228
|
+
* @returns The pipelines and their sampler.
|
|
27229
|
+
*/
|
|
27230
|
+
async function createShotPipes(device) {
|
|
27231
|
+
const [box, blur] = await Promise.all([pipelineOf(device, BOX_WGSL), pipelineOf(device, BLUR_WGSL)]);
|
|
27232
|
+
return {
|
|
27233
|
+
box,
|
|
27234
|
+
blur,
|
|
27235
|
+
sampler: device.createSampler({
|
|
27236
|
+
magFilter: "linear",
|
|
27237
|
+
minFilter: "linear",
|
|
27238
|
+
addressModeU: "clamp-to-edge",
|
|
27239
|
+
addressModeV: "clamp-to-edge"
|
|
27240
|
+
})
|
|
27241
|
+
};
|
|
27242
|
+
}
|
|
27243
|
+
//#endregion
|
|
27244
|
+
//#region src/plugins/renderer/shots/state.ts
|
|
27245
|
+
/**
|
|
27246
|
+
* @file renderer/shots — the state of the shots, the texture of a shot, and what a loss and a stop leave.
|
|
27247
|
+
*/
|
|
27248
|
+
/**
|
|
27249
|
+
* Creates an empty key list. It lives in its own non-exported function because lint rule L5 refuses a collection built
|
|
27250
|
+
* inside an exported declaration.
|
|
27251
|
+
*
|
|
27252
|
+
* @returns An empty list.
|
|
27253
|
+
*/
|
|
27254
|
+
function emptyKeys$1() {
|
|
27255
|
+
return [];
|
|
27256
|
+
}
|
|
27257
|
+
/**
|
|
27258
|
+
* Creates an empty map. Same reason as `emptyKeys`.
|
|
27259
|
+
*
|
|
27260
|
+
* @returns An empty map.
|
|
27261
|
+
*/
|
|
27262
|
+
function emptyShots() {
|
|
27263
|
+
return /* @__PURE__ */ new Map();
|
|
27264
|
+
}
|
|
27265
|
+
/**
|
|
27266
|
+
* Makes the empty state of the shots.
|
|
27267
|
+
*
|
|
27268
|
+
* @returns The shots branch of the plugin state.
|
|
27269
|
+
*/
|
|
27270
|
+
function createShotsState() {
|
|
27271
|
+
return {
|
|
27272
|
+
wanted: emptyKeys$1(),
|
|
27273
|
+
taken: emptyShots(),
|
|
27274
|
+
pipes: void 0,
|
|
27275
|
+
off: void 0,
|
|
27276
|
+
warned: false
|
|
27277
|
+
};
|
|
27278
|
+
}
|
|
27279
|
+
/**
|
|
27280
|
+
* Makes the texture of a shot, on the GPU at once: linear and clamped, so a stretched shot stays soft to its edges, of
|
|
27281
|
+
* the format the pipelines draw, and Pixi's collector leaves it alone. Its own texture, no atlas, no mipmaps.
|
|
27282
|
+
*
|
|
27283
|
+
* @param pixi - The module that draws.
|
|
27284
|
+
* @param host - What registers and uploads it.
|
|
27285
|
+
* @param shots - The config.
|
|
27286
|
+
* @returns The texture.
|
|
27287
|
+
*/
|
|
27288
|
+
function createShotTexture(pixi, host, shots) {
|
|
27289
|
+
const texture = pixi.RenderTexture.create({
|
|
27290
|
+
width: shots.width,
|
|
27291
|
+
height: shots.height,
|
|
27292
|
+
resolution: 1,
|
|
27293
|
+
scaleMode: "linear",
|
|
27294
|
+
addressMode: "clamp-to-edge",
|
|
27295
|
+
autoGarbageCollect: false,
|
|
27296
|
+
format: SHOT_FORMAT,
|
|
27297
|
+
label: "renderer.shot"
|
|
27298
|
+
});
|
|
27299
|
+
host.keep(texture.source, true);
|
|
27300
|
+
host.initSource(texture.source);
|
|
27301
|
+
return texture;
|
|
27302
|
+
}
|
|
27303
|
+
/**
|
|
27304
|
+
* Forgets what a device held: the takes, the shots and the pipelines. The textures went with the device.
|
|
27305
|
+
*
|
|
27306
|
+
* @param state - The shots branch of the plugin state.
|
|
27307
|
+
*/
|
|
27308
|
+
function forgetShots(state) {
|
|
27309
|
+
state.wanted.length = 0;
|
|
27310
|
+
state.taken.clear();
|
|
27311
|
+
state.pipes = void 0;
|
|
27312
|
+
}
|
|
27313
|
+
/**
|
|
27314
|
+
* Removes the texture provider and destroys every shot while the application exists (`stopRenderer` runs it before
|
|
27315
|
+
* `stopHost`).
|
|
27316
|
+
*
|
|
27317
|
+
* @param state - The shots branch of the plugin state.
|
|
27318
|
+
*/
|
|
27319
|
+
function stopShots(state) {
|
|
27320
|
+
state.off?.();
|
|
27321
|
+
state.off = void 0;
|
|
27322
|
+
for (const texture of state.taken.values()) destroyWhole(texture);
|
|
27323
|
+
forgetShots(state);
|
|
27324
|
+
}
|
|
27325
|
+
//#endregion
|
|
26968
27326
|
//#region src/plugins/renderer/sync/hidden.ts
|
|
26969
27327
|
/** The bit of each reason in a mask. */
|
|
26970
27328
|
const BITS = {
|
|
@@ -30486,6 +30844,7 @@ function advance(run, now) {
|
|
|
30486
30844
|
*/
|
|
30487
30845
|
function hang$1(sctx, objects, stage, screen) {
|
|
30488
30846
|
if (stage.children.at(-1) !== objects.top) stage.addChild(objects.top);
|
|
30847
|
+
objects.top.visible = sctx.ctx.state.shots.wanted.length === 0;
|
|
30489
30848
|
objects.veil.position.set(screen.x, screen.y);
|
|
30490
30849
|
objects.veil.scale.set(screen.width, screen.height);
|
|
30491
30850
|
sctx.deps.viewport.apply(objects.frame);
|
|
@@ -33081,8 +33440,9 @@ function withDeps$8(ctx) {
|
|
|
33081
33440
|
* overlay step (spec 22), then `kept` reads the marks before `demand` decides whether the frame is
|
|
33082
33441
|
* drawn and clears them; a drawn frame draws the probes of the warm-up onto the canvas first (F4: the
|
|
33083
33442
|
* stage pass clears them, in the same task, so they never show), then uploads the queued texture sources (F60), then
|
|
33084
|
-
* the kept pictures (`kept.flush`, so the canvas stays one pass, E7), then the stage, then
|
|
33085
|
-
*
|
|
33443
|
+
* the kept pictures (`kept.flush`, so the canvas stays one pass, E7), then the stage, then a shot of the frame just drawn
|
|
33444
|
+
* while the canvas texture holds it (`shots.after`, never of the heat map), then the pixel leg of the kept oracle;
|
|
33445
|
+
* `demand` settles the
|
|
33086
33446
|
* frame (the dev check, the pixel oracle), and `monitor` closes it and hands a drawn one to a
|
|
33087
33447
|
* waiting capture; last, `host` trims Pixi's texture pool when a rest or a scene change is due. The display objects
|
|
33088
33448
|
* are written by the `sync` system. While the overdraw heat map of a dev or debug build is on, every frame asks to be
|
|
@@ -33096,7 +33456,7 @@ function withDeps$8(ctx) {
|
|
|
33096
33456
|
* never a sample of the rate.
|
|
33097
33457
|
*
|
|
33098
33458
|
* @param ctx - Domain context of the renderer plugin.
|
|
33099
|
-
* @param modules - The
|
|
33459
|
+
* @param modules - The seven modules.
|
|
33100
33460
|
*/
|
|
33101
33461
|
function renderFrame(ctx, modules) {
|
|
33102
33462
|
if (modules.host.resolutionPending()) ctx.state.viewport.resizePending = true;
|
|
@@ -33120,7 +33480,9 @@ function renderFrame(ctx, modules) {
|
|
|
33120
33480
|
const uploaded = modules.sync.uploadStep();
|
|
33121
33481
|
const built = modules.sync.takeBuildWork();
|
|
33122
33482
|
modules.kept.flush();
|
|
33123
|
-
|
|
33483
|
+
const rendered = overdraw ? modules.sync.drawOverdraw(modules.host.render) : modules.host.render();
|
|
33484
|
+
modules.shots.after(rendered && !overdraw);
|
|
33485
|
+
if (rendered) {
|
|
33124
33486
|
ctx.deps.time.frameDrawn();
|
|
33125
33487
|
if (probed || uploaded || built) ctx.deps.time.frameProbed();
|
|
33126
33488
|
}
|
|
@@ -33149,16 +33511,21 @@ async function startRenderer(ctx) {
|
|
|
33149
33511
|
modules.host.onReady(() => {
|
|
33150
33512
|
modules.viewport.start();
|
|
33151
33513
|
modules.sync.start();
|
|
33514
|
+
modules.shots.start();
|
|
33152
33515
|
rendererCtx.state.host.cleanups.push(rendererCtx.deps.time.onFrame("input", () => modules.monitor.begin()), rendererCtx.deps.time.onFrame("render", () => renderFrame(rendererCtx, modules)));
|
|
33153
33516
|
modules.monitor.attach();
|
|
33154
33517
|
modules.monitor.attachPasses();
|
|
33155
33518
|
});
|
|
33156
|
-
modules.host.onLoss(() =>
|
|
33519
|
+
modules.host.onLoss(() => {
|
|
33520
|
+
modules.sync.forget();
|
|
33521
|
+
modules.shots.forget();
|
|
33522
|
+
});
|
|
33157
33523
|
modules.host.onRestore((rebuilt) => {
|
|
33158
33524
|
modules.demand.whole("restore");
|
|
33159
33525
|
if (!rebuilt) return;
|
|
33160
33526
|
rendererCtx.state.viewport.resizePending = true;
|
|
33161
33527
|
modules.sync.rebuildAll();
|
|
33528
|
+
modules.shots.start();
|
|
33162
33529
|
modules.monitor.attach();
|
|
33163
33530
|
modules.monitor.attachPasses();
|
|
33164
33531
|
});
|
|
@@ -33166,7 +33533,7 @@ async function startRenderer(ctx) {
|
|
|
33166
33533
|
}
|
|
33167
33534
|
/**
|
|
33168
33535
|
* Stops the renderer in the reverse order of the start: `monitor` answers the waiting captures
|
|
33169
|
-
* and stops its performance monitor, `demand` forgets its marks and pictures, `kept`
|
|
33536
|
+
* and stops its performance monitor, `demand` forgets its marks and pictures, `kept` and `shots` destroy their
|
|
33170
33537
|
* textures, `sync` lets its views go while `world` is still alive, `viewport` drops its observer and its
|
|
33171
33538
|
* probe, and `host` destroys the application. Textures are left to `assets`; a `Display` object
|
|
33172
33539
|
* is left to the game.
|
|
@@ -33177,6 +33544,7 @@ function stopRenderer(scope) {
|
|
|
33177
33544
|
stopMonitor(scope.state.monitor);
|
|
33178
33545
|
stopDemand(scope.state.demand);
|
|
33179
33546
|
stopKept(scope.state.kept);
|
|
33547
|
+
stopShots(scope.state.shots);
|
|
33180
33548
|
stopSync(scope.state.sync);
|
|
33181
33549
|
stopViewport(scope.state.viewport);
|
|
33182
33550
|
stopHost(scope.state.host);
|
|
@@ -33601,6 +33969,252 @@ function installPassCounting(pixi, sinks) {
|
|
|
33601
33969
|
};
|
|
33602
33970
|
}
|
|
33603
33971
|
//#endregion
|
|
33972
|
+
//#region src/plugins/renderer/shots/passes.ts
|
|
33973
|
+
/**
|
|
33974
|
+
* @file renderer/shots — the passes of one take, in one command encoder, submitted once: the canvas down through the
|
|
33975
|
+
* hops to the shot, then a horizontal and a vertical Gaussian through one extra texture of the shot's size. What only
|
|
33976
|
+
* the take needs is made here and destroyed after the submit. A take may allocate: it runs once per switch.
|
|
33977
|
+
*/
|
|
33978
|
+
/** `GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT`. */
|
|
33979
|
+
const HOP_USAGE = 20;
|
|
33980
|
+
/** `GPUBufferUsage.COPY_DST | GPUBufferUsage.UNIFORM`. */
|
|
33981
|
+
const UNIFORM_USAGE = 72;
|
|
33982
|
+
/**
|
|
33983
|
+
* Makes a texture for this take alone.
|
|
33984
|
+
*
|
|
33985
|
+
* @param run - The take.
|
|
33986
|
+
* @param size - Its size.
|
|
33987
|
+
* @returns The texture.
|
|
33988
|
+
*/
|
|
33989
|
+
function hopTexture(run, size) {
|
|
33990
|
+
const texture = run.device.createTexture({
|
|
33991
|
+
size,
|
|
33992
|
+
format: SHOT_FORMAT,
|
|
33993
|
+
usage: HOP_USAGE
|
|
33994
|
+
});
|
|
33995
|
+
run.spent.push(texture);
|
|
33996
|
+
return texture;
|
|
33997
|
+
}
|
|
33998
|
+
/**
|
|
33999
|
+
* Draws one pass: a fullscreen triangle of a filter, from a texture onto another.
|
|
34000
|
+
*
|
|
34001
|
+
* @param run - The take.
|
|
34002
|
+
* @param pipeline - The filter.
|
|
34003
|
+
* @param source - What it reads.
|
|
34004
|
+
* @param target - What it draws.
|
|
34005
|
+
* @param data - Its uniform.
|
|
34006
|
+
*/
|
|
34007
|
+
function drawPass(run, pipeline, source, target, data) {
|
|
34008
|
+
const { device, encoder, pipes, spent } = run;
|
|
34009
|
+
const uniform = device.createBuffer({
|
|
34010
|
+
size: data.byteLength,
|
|
34011
|
+
usage: UNIFORM_USAGE
|
|
34012
|
+
});
|
|
34013
|
+
spent.push(uniform);
|
|
34014
|
+
device.queue.writeBuffer(uniform, 0, data);
|
|
34015
|
+
const group = device.createBindGroup({
|
|
34016
|
+
layout: pipeline.getBindGroupLayout(0),
|
|
34017
|
+
entries: [
|
|
34018
|
+
{
|
|
34019
|
+
binding: 0,
|
|
34020
|
+
resource: source.createView()
|
|
34021
|
+
},
|
|
34022
|
+
{
|
|
34023
|
+
binding: 1,
|
|
34024
|
+
resource: pipes.sampler
|
|
34025
|
+
},
|
|
34026
|
+
{
|
|
34027
|
+
binding: 2,
|
|
34028
|
+
resource: { buffer: uniform }
|
|
34029
|
+
}
|
|
34030
|
+
]
|
|
34031
|
+
});
|
|
34032
|
+
const pass = encoder.beginRenderPass({ colorAttachments: [{
|
|
34033
|
+
view: target.createView(),
|
|
34034
|
+
loadOp: "clear",
|
|
34035
|
+
storeOp: "store"
|
|
34036
|
+
}] });
|
|
34037
|
+
pass.setPipeline(pipeline);
|
|
34038
|
+
pass.setBindGroup(0, group);
|
|
34039
|
+
pass.draw(3);
|
|
34040
|
+
pass.end();
|
|
34041
|
+
}
|
|
34042
|
+
/**
|
|
34043
|
+
* Draws the hops from the canvas down to the shot.
|
|
34044
|
+
*
|
|
34045
|
+
* @param run - The take.
|
|
34046
|
+
* @param canvas - The canvas texture of this frame.
|
|
34047
|
+
* @param shot - The texture of the shot.
|
|
34048
|
+
*/
|
|
34049
|
+
function drawHops(run, canvas, shot) {
|
|
34050
|
+
const hops = hopsOf(canvas.width, canvas.height, shot.width, shot.height);
|
|
34051
|
+
let source = canvas;
|
|
34052
|
+
for (const [index, hop] of hops.entries()) {
|
|
34053
|
+
const last = index === hops.length - 1;
|
|
34054
|
+
const target = last ? shot : hopTexture(run, hop);
|
|
34055
|
+
drawPass(run, run.pipes.box, source, target, boxData(source, hop, last));
|
|
34056
|
+
source = target;
|
|
34057
|
+
}
|
|
34058
|
+
}
|
|
34059
|
+
/**
|
|
34060
|
+
* Blurs the shot in place: across into a texture of its size, and back down.
|
|
34061
|
+
*
|
|
34062
|
+
* @param run - The take.
|
|
34063
|
+
* @param shot - The texture of the shot.
|
|
34064
|
+
* @param taps - The kernel.
|
|
34065
|
+
*/
|
|
34066
|
+
function drawBlur(run, shot, taps) {
|
|
34067
|
+
const across = hopTexture(run, shot);
|
|
34068
|
+
drawPass(run, run.pipes.blur, shot, across, blurData(shot, "x", taps));
|
|
34069
|
+
drawPass(run, run.pipes.blur, across, shot, blurData(shot, "y", taps));
|
|
34070
|
+
}
|
|
34071
|
+
/**
|
|
34072
|
+
* Takes one picture of the canvas into every target: the chain draws the first, and the others are copies of it, so
|
|
34073
|
+
* two keys of one frame cost one chain.
|
|
34074
|
+
*
|
|
34075
|
+
* @param device - The device.
|
|
34076
|
+
* @param pipes - The pipelines of that device.
|
|
34077
|
+
* @param canvas - The canvas texture of this frame.
|
|
34078
|
+
* @param targets - The textures of the shots, each once, all of one size.
|
|
34079
|
+
* @param sigma - The Gaussian in texels of the shot; 0 for none.
|
|
34080
|
+
*/
|
|
34081
|
+
function drawShot(device, pipes, canvas, targets, sigma) {
|
|
34082
|
+
const [shot, ...copies] = targets;
|
|
34083
|
+
if (shot === void 0) return;
|
|
34084
|
+
const encoder = device.createCommandEncoder();
|
|
34085
|
+
const run = {
|
|
34086
|
+
device,
|
|
34087
|
+
pipes,
|
|
34088
|
+
encoder,
|
|
34089
|
+
spent: []
|
|
34090
|
+
};
|
|
34091
|
+
const taps = gaussianTaps(sigma);
|
|
34092
|
+
drawHops(run, canvas, shot);
|
|
34093
|
+
if (taps.length > 0) drawBlur(run, shot, taps);
|
|
34094
|
+
for (const copy of copies) encoder.copyTextureToTexture({ texture: shot }, { texture: copy }, shot);
|
|
34095
|
+
device.queue.submit([encoder.finish()]);
|
|
34096
|
+
for (const resource of run.spent) resource.destroy();
|
|
34097
|
+
}
|
|
34098
|
+
//#endregion
|
|
34099
|
+
//#region src/plugins/renderer/shots/api.ts
|
|
34100
|
+
/** Shots kept when `shots.keep` is left out. */
|
|
34101
|
+
const DEFAULT_KEEP = 8;
|
|
34102
|
+
/**
|
|
34103
|
+
* Compiles the pipelines of a device, off the main thread. What ends on a device that is no longer the live one is
|
|
34104
|
+
* dropped, a failure too: the restore compiles again. A failure on the live device leaves `take` a no-op, and warns
|
|
34105
|
+
* once.
|
|
34106
|
+
*
|
|
34107
|
+
* @param ctx - Domain context of the renderer plugin.
|
|
34108
|
+
* @param deps - The modules it reads.
|
|
34109
|
+
* @param device - The device.
|
|
34110
|
+
*/
|
|
34111
|
+
async function compilePipes(ctx, deps, device) {
|
|
34112
|
+
const state = ctx.state.shots;
|
|
34113
|
+
try {
|
|
34114
|
+
const pipes = await createShotPipes(device);
|
|
34115
|
+
if (deps.host.device() === device) state.pipes = pipes;
|
|
34116
|
+
} catch (error) {
|
|
34117
|
+
if (deps.host.device() !== device || state.warned) return;
|
|
34118
|
+
state.warned = true;
|
|
34119
|
+
ctx.log.warn("renderer:shots-unavailable", { error });
|
|
34120
|
+
}
|
|
34121
|
+
}
|
|
34122
|
+
/**
|
|
34123
|
+
* The texture of the oldest shot, which leaves its key to a new one, once `keep` shots stand.
|
|
34124
|
+
*
|
|
34125
|
+
* @param state - The shots branch of the plugin state.
|
|
34126
|
+
* @param keep - The limit.
|
|
34127
|
+
* @param stale - The keys whose views look again: the key that went joins them.
|
|
34128
|
+
* @returns Its texture, or `undefined` while there is room.
|
|
34129
|
+
*/
|
|
34130
|
+
function recycled(state, keep, stale) {
|
|
34131
|
+
const [oldest] = state.taken;
|
|
34132
|
+
if (oldest === void 0 || state.taken.size < keep) return void 0;
|
|
34133
|
+
state.taken.delete(oldest[0]);
|
|
34134
|
+
stale.push(oldest[0]);
|
|
34135
|
+
return oldest[1];
|
|
34136
|
+
}
|
|
34137
|
+
/**
|
|
34138
|
+
* Seats every wanted key on a texture: its own for a retake, as the newest; the oldest's at the limit; a new one
|
|
34139
|
+
* otherwise. Keys may end on one texture when a frame wants more than `keep`.
|
|
34140
|
+
*
|
|
34141
|
+
* @param ctx - Domain context of the renderer plugin.
|
|
34142
|
+
* @param deps - The modules it reads.
|
|
34143
|
+
* @param pixi - The module that draws.
|
|
34144
|
+
* @param shots - The config.
|
|
34145
|
+
* @param stale - The keys whose views look again: the keys that went join them.
|
|
34146
|
+
* @returns The textures to draw, each once.
|
|
34147
|
+
*/
|
|
34148
|
+
function seatWanted(ctx, deps, pixi, shots, stale) {
|
|
34149
|
+
const state = ctx.state.shots;
|
|
34150
|
+
const keep = shots.keep ?? DEFAULT_KEEP;
|
|
34151
|
+
const seats = /* @__PURE__ */ new Set();
|
|
34152
|
+
for (const key of state.wanted) {
|
|
34153
|
+
const held = state.taken.get(key);
|
|
34154
|
+
state.taken.delete(key);
|
|
34155
|
+
const texture = held ?? recycled(state, keep, stale) ?? createShotTexture(pixi, deps.host, shots);
|
|
34156
|
+
state.taken.set(key, texture);
|
|
34157
|
+
seats.add(texture);
|
|
34158
|
+
}
|
|
34159
|
+
return seats;
|
|
34160
|
+
}
|
|
34161
|
+
/**
|
|
34162
|
+
* Reads this frame's canvas into the wanted keys, once, and asks for one more frame: the look shows from it, and the
|
|
34163
|
+
* views of the keys, which look again, draw from it. Nothing that can be read: nothing is taken.
|
|
34164
|
+
*
|
|
34165
|
+
* @param ctx - Domain context of the renderer plugin.
|
|
34166
|
+
* @param deps - The modules it reads.
|
|
34167
|
+
*/
|
|
34168
|
+
function shoot(ctx, deps) {
|
|
34169
|
+
const { shots } = ctx.config;
|
|
34170
|
+
const { pipes, wanted } = ctx.state.shots;
|
|
34171
|
+
const device = deps.host.device();
|
|
34172
|
+
const pixi = deps.host.pixi();
|
|
34173
|
+
const canvas = deps.host.canvasTexture();
|
|
34174
|
+
if (shots === void 0 || pipes === void 0) return;
|
|
34175
|
+
if (device === void 0 || pixi === void 0 || canvas === void 0) return;
|
|
34176
|
+
const stale = [...wanted];
|
|
34177
|
+
const targets = [];
|
|
34178
|
+
for (const texture of seatWanted(ctx, deps, pixi, shots, stale)) {
|
|
34179
|
+
const target = deps.host.gpuTexture(texture.source);
|
|
34180
|
+
if (target !== void 0) targets.push(target);
|
|
34181
|
+
}
|
|
34182
|
+
drawShot(device, pipes, canvas, targets, sigmaOf(shots.blur, shots.width, deps.viewport.size().width));
|
|
34183
|
+
deps.sync.textures.invalidate(stale);
|
|
34184
|
+
deps.demand.request();
|
|
34185
|
+
}
|
|
34186
|
+
/**
|
|
34187
|
+
* Creates the shots module. It keeps nothing of its own: the plugin builds its modules more than once over one state.
|
|
34188
|
+
*
|
|
34189
|
+
* @param ctx - Domain context of the renderer plugin.
|
|
34190
|
+
* @param deps - The modules it reads.
|
|
34191
|
+
* @returns The shots API and its internal half.
|
|
34192
|
+
*/
|
|
34193
|
+
function createShotsApi(ctx, deps) {
|
|
34194
|
+
const state = ctx.state.shots;
|
|
34195
|
+
return {
|
|
34196
|
+
take: (key) => {
|
|
34197
|
+
if (state.pipes === void 0 || !deps.host.ready()) return;
|
|
34198
|
+
if (ctx.deps.world.ecs.mode() !== "live") return;
|
|
34199
|
+
if (!state.wanted.includes(key)) state.wanted.push(key);
|
|
34200
|
+
deps.demand.request();
|
|
34201
|
+
},
|
|
34202
|
+
has: (key) => state.taken.has(key),
|
|
34203
|
+
start: () => {
|
|
34204
|
+
if (ctx.config.shots === void 0) return;
|
|
34205
|
+
state.off ??= deps.sync.textures.provide((key) => state.taken.get(key));
|
|
34206
|
+
const device = deps.host.device();
|
|
34207
|
+
if (device !== void 0) compilePipes(ctx, deps, device);
|
|
34208
|
+
},
|
|
34209
|
+
after: (drawn) => {
|
|
34210
|
+
if (state.wanted.length === 0) return;
|
|
34211
|
+
if (drawn) shoot(ctx, deps);
|
|
34212
|
+
state.wanted.length = 0;
|
|
34213
|
+
},
|
|
34214
|
+
forget: () => forgetShots(state)
|
|
34215
|
+
};
|
|
34216
|
+
}
|
|
34217
|
+
//#endregion
|
|
33604
34218
|
//#region src/plugins/renderer/sync/hit-test.ts
|
|
33605
34219
|
/** How deep a parent chain or a container tree is followed. */
|
|
33606
34220
|
const MAX_DEPTH$6 = 32;
|
|
@@ -36392,8 +37006,8 @@ function createViewportApi(ctx, deps) {
|
|
|
36392
37006
|
//#region src/plugins/renderer/api.ts
|
|
36393
37007
|
/**
|
|
36394
37008
|
* @file renderer plugin — API factory. The one place that builds `host`, `viewport`, `demand`,
|
|
36395
|
-
* `kept`, `sync` and `monitor` in the accepted injection order, and the one place that
|
|
36396
|
-
* them to their public half.
|
|
37009
|
+
* `kept`, `sync`, `shots` and `monitor` in the accepted injection order, and the one place that
|
|
37010
|
+
* reduces them to their public half.
|
|
36397
37011
|
*/
|
|
36398
37012
|
/**
|
|
36399
37013
|
* The counting `host` installs before `new Application()`: the seven counting classes (BatcherPipe among them) of
|
|
@@ -36422,7 +37036,7 @@ const syncWriters = {
|
|
|
36422
37036
|
renderPassesOf
|
|
36423
37037
|
};
|
|
36424
37038
|
/**
|
|
36425
|
-
* Builds the
|
|
37039
|
+
* Builds the seven modules in the accepted order `host → viewport → demand → kept → sync → shots → monitor`.
|
|
36426
37040
|
* Each keeps its data in its branch of `ctx.state`, so these objects are views on the plugin
|
|
36427
37041
|
* state, not owners of it. `host` gets the counting of `monitor` up front, because it installs
|
|
36428
37042
|
* the classes before `monitor` exists (the six of a dev or debug build, the pass counter of the
|
|
@@ -36430,11 +37044,12 @@ const syncWriters = {
|
|
|
36430
37044
|
* keep their identity; `kept` reads the views of `sync` the same way, and gives a bare view its
|
|
36431
37045
|
* wrapper through `sync.wrapForPicture` (spec 23 D4), reached through a holder filled once `sync`
|
|
36432
37046
|
* exists; `sync` marks every write in
|
|
36433
|
-
* `demand` and asks `kept` where a view's filters hang; `
|
|
37047
|
+
* `demand` and asks `kept` where a view's filters hang; `shots` provides its textures through `sync`,
|
|
37048
|
+
* which reads its waiting keys through the state alone; `monitor` gets the others, since a legend
|
|
36434
37049
|
* places views on the picture and the performance log reads all of them.
|
|
36435
37050
|
*
|
|
36436
37051
|
* @param ctx - Domain context of the renderer plugin.
|
|
36437
|
-
* @returns The
|
|
37052
|
+
* @returns The seven modules with their public and internal methods.
|
|
36438
37053
|
*/
|
|
36439
37054
|
function createModules$1(ctx) {
|
|
36440
37055
|
const host = createHostApi(ctx, {
|
|
@@ -36468,6 +37083,12 @@ function createModules$1(ctx) {
|
|
|
36468
37083
|
demand,
|
|
36469
37084
|
kept,
|
|
36470
37085
|
sync,
|
|
37086
|
+
shots: createShotsApi(ctx, {
|
|
37087
|
+
host,
|
|
37088
|
+
viewport,
|
|
37089
|
+
demand,
|
|
37090
|
+
sync
|
|
37091
|
+
}),
|
|
36471
37092
|
monitor: createMonitorApi(ctx, {
|
|
36472
37093
|
host,
|
|
36473
37094
|
viewport,
|
|
@@ -36520,14 +37141,14 @@ function exposeSync(sync) {
|
|
|
36520
37141
|
};
|
|
36521
37142
|
}
|
|
36522
37143
|
/**
|
|
36523
|
-
* Creates the renderer API: `app.renderer.host`, `.viewport`, `.sync` and `.monitor`, and
|
|
37144
|
+
* Creates the renderer API: `app.renderer.host`, `.viewport`, `.sync`, `.shots` and `.monitor`, and
|
|
36524
37145
|
* `stats()` and `capture()` of `monitor` on the plugin itself.
|
|
36525
37146
|
*
|
|
36526
37147
|
* @param ctx - Kernel context of the renderer plugin.
|
|
36527
37148
|
* @returns The plugin API.
|
|
36528
37149
|
*/
|
|
36529
37150
|
function createRendererApi(ctx) {
|
|
36530
|
-
const { host, viewport, demand, sync, monitor } = createModules$1({
|
|
37151
|
+
const { host, viewport, demand, sync, shots, monitor } = createModules$1({
|
|
36531
37152
|
...ctx,
|
|
36532
37153
|
deps: resolveDeps$6(ctx)
|
|
36533
37154
|
});
|
|
@@ -36551,6 +37172,10 @@ function createRendererApi(ctx) {
|
|
|
36551
37172
|
sections: monitor.sections,
|
|
36552
37173
|
counts: monitor.counts
|
|
36553
37174
|
},
|
|
37175
|
+
shots: {
|
|
37176
|
+
take: shots.take,
|
|
37177
|
+
has: shots.has
|
|
37178
|
+
},
|
|
36554
37179
|
invalidate: demand.invalidate,
|
|
36555
37180
|
stats: monitor.stats,
|
|
36556
37181
|
capture: monitor.capture
|
|
@@ -36881,6 +37506,8 @@ const RING_FRAMES = {
|
|
|
36881
37506
|
const MAX_WARM = 16;
|
|
36882
37507
|
/** The most textures the upload queue may put on the GPU in one drawn frame: about 9 ms each on a Galaxy A26. */
|
|
36883
37508
|
const MAX_UPLOADS = 8;
|
|
37509
|
+
/** The most texels a side of a shot may have. */
|
|
37510
|
+
const MAX_SHOT_SIDE = 512;
|
|
36884
37511
|
/**
|
|
36885
37512
|
* Tells a finite number of at least 0 from anything else a config can hold.
|
|
36886
37513
|
*
|
|
@@ -36926,12 +37553,44 @@ function checkAdaptiveScale(adaptiveScale) {
|
|
|
36926
37553
|
if (devices !== "phone" && devices !== "all") throw new Error(`[game] renderer.adaptiveScale.devices is ${String(devices)}.\n Give "phone" or "all".`);
|
|
36927
37554
|
}
|
|
36928
37555
|
/**
|
|
37556
|
+
* Tells a side of a shot from anything else a config can hold.
|
|
37557
|
+
*
|
|
37558
|
+
* @param value - The config value.
|
|
37559
|
+
* @returns True for a whole number from 1 to 512.
|
|
37560
|
+
* @example
|
|
37561
|
+
* ```ts
|
|
37562
|
+
* isShotSide(512); // true
|
|
37563
|
+
* ```
|
|
37564
|
+
*/
|
|
37565
|
+
function isShotSide(value) {
|
|
37566
|
+
return Number.isInteger(value) && Number(value) >= 1 && Number(value) <= MAX_SHOT_SIDE;
|
|
37567
|
+
}
|
|
37568
|
+
/**
|
|
37569
|
+
* Checks the shots of the config: left out, or an object of a size, a blur and, when given, a limit.
|
|
37570
|
+
*
|
|
37571
|
+
* @param shots - What the config holds.
|
|
37572
|
+
* @throws {Error} When it is no object, `width` or `height` is not a whole number from 1 to 512, `blur` is not a finite
|
|
37573
|
+
* number of at least 0, or `keep` is given and not a whole number of at least 1.
|
|
37574
|
+
*/
|
|
37575
|
+
function checkShots(shots) {
|
|
37576
|
+
if (shots === void 0) return;
|
|
37577
|
+
if (typeof shots !== "object" || shots === null) throw new Error(`[game] renderer.shots is ${String(shots)}.\n Give { width, height, blur } or leave it out.`);
|
|
37578
|
+
const width = "width" in shots ? shots.width : void 0;
|
|
37579
|
+
const height = "height" in shots ? shots.height : void 0;
|
|
37580
|
+
const blur = "blur" in shots ? shots.blur : void 0;
|
|
37581
|
+
const keep = "keep" in shots ? shots.keep : void 0;
|
|
37582
|
+
if (!isShotSide(width)) throw new Error(`[game] renderer.shots.width is ${String(width)}.\n Give the texels across, a whole number from 1 to 512.`);
|
|
37583
|
+
if (!isShotSide(height)) throw new Error(`[game] renderer.shots.height is ${String(height)}.\n Give the texels down, a whole number from 1 to 512.`);
|
|
37584
|
+
if (!isCount(blur)) throw new Error(`[game] renderer.shots.blur is ${String(blur)}.\n Give the sigma in reference units, 0 or more.`);
|
|
37585
|
+
if (keep !== void 0 && !(Number.isInteger(keep) && Number(keep) >= 1)) throw new Error(`[game] renderer.shots.keep is ${String(keep)}.\n Give the shots kept, a whole number of at least 1.`);
|
|
37586
|
+
}
|
|
37587
|
+
/**
|
|
36929
37588
|
* Checks the numbers of the config a game can get wrong, at `createApp`, in every build: the
|
|
36930
37589
|
* resolution cap, the pool trim, the adaptive render scale, the performance monitor, the budget of the kept pictures,
|
|
36931
|
-
* the probe draws of the warm-up
|
|
37590
|
+
* the probe draws of the warm-up, the textures uploaded per drawn frame and the shots.
|
|
36932
37591
|
*
|
|
36933
37592
|
* @param config - The resolved plugin config.
|
|
36934
|
-
* @throws {Error} When `maxResolution` is not a number above 0, `poolTrim` or `
|
|
37593
|
+
* @throws {Error} When `maxResolution` is not a number above 0, `poolTrim`, `adaptiveScale` or `shots` fails its check,
|
|
36935
37594
|
* `monitor.budgetMs` is neither `"rate"` nor a number above 0, `monitor.frames` is not a whole
|
|
36936
37595
|
* number from 64 to 16384, `keptMb` is not a finite number of at least 0, `warm` is not a
|
|
36937
37596
|
* whole number from 0 to 16, or `uploads` is not a whole number from 0 to 8.
|
|
@@ -36942,6 +37601,7 @@ function checkConfig$1(config) {
|
|
|
36942
37601
|
if (!Number.isFinite(maxResolution) || maxResolution <= 0) throw new Error(`[game] renderer.maxResolution is ${maxResolution}.\n Give a number above 0.`);
|
|
36943
37602
|
checkPoolTrim(config.poolTrim);
|
|
36944
37603
|
checkAdaptiveScale(config.adaptiveScale);
|
|
37604
|
+
checkShots(config.shots);
|
|
36945
37605
|
if (budgetMs !== "rate" && !(Number.isFinite(budgetMs) && budgetMs > 0)) throw new Error(`[game] renderer.monitor.budgetMs is ${String(budgetMs)}.\n Give the frame budget in milliseconds, or "rate" for one frame of the current rate.`);
|
|
36946
37606
|
if (!Number.isInteger(frames) || frames < RING_FRAMES.min || frames > RING_FRAMES.max) throw new Error(`[game] renderer.monitor.frames is ${frames}.\n Give a whole number from 64 to 16384.`);
|
|
36947
37607
|
if (typeof keptMb !== "number" || !Number.isFinite(keptMb) || keptMb < 0) throw new Error(`[game] renderer.keptMb is ${String(keptMb)}.\n Give the MiB kept pictures may hold, or 0 to keep none.`);
|
|
@@ -36968,7 +37628,8 @@ function createRendererState(ctx) {
|
|
|
36968
37628
|
sync: createSyncState(ctx.config.debug),
|
|
36969
37629
|
monitor: createMonitorState(ctx.config.monitor),
|
|
36970
37630
|
demand: createDemandState(ctx.config.debug.verifyFrames === true),
|
|
36971
|
-
kept: createKeptState(ctx.config)
|
|
37631
|
+
kept: createKeptState(ctx.config),
|
|
37632
|
+
shots: createShotsState()
|
|
36972
37633
|
};
|
|
36973
37634
|
}
|
|
36974
37635
|
/**
|
|
@@ -37034,7 +37695,8 @@ const rendererPlugin = /*#__PURE__*/ createPlugin$1("renderer", {
|
|
|
37034
37695
|
adaptiveScale: {
|
|
37035
37696
|
floor: .75,
|
|
37036
37697
|
devices: "phone"
|
|
37037
|
-
}
|
|
37698
|
+
},
|
|
37699
|
+
shots: void 0
|
|
37038
37700
|
},
|
|
37039
37701
|
events: (register) => register.map({ "renderer:device-lost": "The GPU device or context was lost; the game is paused" }),
|
|
37040
37702
|
createState: createRendererState,
|
|
@@ -55445,6 +56107,16 @@ function onCancel(ctx, pointer, reason) {
|
|
|
55445
56107
|
toIdle(ctx);
|
|
55446
56108
|
}
|
|
55447
56109
|
/**
|
|
56110
|
+
* The capture was lost. The sample carries no place: WebKit sends it at (0, 0) about 9 ms after
|
|
56111
|
+
* the lift (F143), so it never moves the pointer, and it cancels only a press still followed.
|
|
56112
|
+
*
|
|
56113
|
+
* @param ctx - Domain context of the input plugin.
|
|
56114
|
+
* @param pointer - The `Pointer` resource of this frame.
|
|
56115
|
+
*/
|
|
56116
|
+
function onLost(ctx, pointer) {
|
|
56117
|
+
if (ctx.state.pointerId !== void 0) onCancel(ctx, pointer, "capture-lost");
|
|
56118
|
+
}
|
|
56119
|
+
/**
|
|
55448
56120
|
* Lets a running drag or trace go with no answer: the drag is released with no target, so the
|
|
55449
56121
|
* stack settles home, and the trace drops its `Traced` tags.
|
|
55450
56122
|
*
|
|
@@ -55483,7 +56155,7 @@ function leavesSlop(ctx, point) {
|
|
|
55483
56155
|
* thumb or palm never blocks the finger that plays. A move of an idle mouse or pen hit-tests
|
|
55484
56156
|
* nothing: its point is returned, so the drain moves the hover once per frame. A move of a press
|
|
55485
56157
|
* past the tap slop marks the press as moved for good and, in that one sample, hands it to the
|
|
55486
|
-
* scroll it pans. A lost capture ends
|
|
56158
|
+
* scroll it pans. A lost capture ends a followed gesture like a cancel and never moves the pointer.
|
|
55487
56159
|
*
|
|
55488
56160
|
* @param ctx - Domain context of the input plugin.
|
|
55489
56161
|
* @param pointer - The `Pointer` resource of this frame.
|
|
@@ -55498,6 +56170,10 @@ function handleSample(ctx, pointer, sample) {
|
|
|
55498
56170
|
lostPress(ctx, "other-finger");
|
|
55499
56171
|
toIdle(ctx);
|
|
55500
56172
|
}
|
|
56173
|
+
if (sample.kind === "lost") {
|
|
56174
|
+
onLost(ctx, pointer);
|
|
56175
|
+
return;
|
|
56176
|
+
}
|
|
55501
56177
|
const point = ctx.deps.renderer.viewport.toReference(sample.clientX, sample.clientY);
|
|
55502
56178
|
pointer.x = point.x;
|
|
55503
56179
|
pointer.y = point.y;
|
|
@@ -55517,7 +56193,7 @@ function handleSample(ctx, pointer, sample) {
|
|
|
55517
56193
|
case "up":
|
|
55518
56194
|
onUp(ctx, pointer, point);
|
|
55519
56195
|
break;
|
|
55520
|
-
default: onCancel(ctx, pointer,
|
|
56196
|
+
default: onCancel(ctx, pointer, "cancelled");
|
|
55521
56197
|
}
|
|
55522
56198
|
}
|
|
55523
56199
|
/**
|
|
@@ -56909,6 +57585,14 @@ const BOX_SLACK = 1e-4;
|
|
|
56909
57585
|
/** Splits a run's text into words, runs of spaces and line breaks, separators kept. */
|
|
56910
57586
|
const TOKENS = /(\n| +)/;
|
|
56911
57587
|
/**
|
|
57588
|
+
* Splits a word after a hyphen (`-` or U+2010) that joins two parts, the hyphen kept on the first:
|
|
57589
|
+
* `купли-продажи` may break as `купли-` / `продажи`. No break after a leading hyphen, between two
|
|
57590
|
+
* hyphens or before a digit (`-5`, `10-20`), as a browser keeps them.
|
|
57591
|
+
*/
|
|
57592
|
+
const HYPHEN_BREAKS = /(?<=[^\-\u2010][-\u2010])(?=[^\-\u2010\d])/;
|
|
57593
|
+
/** The soft hyphen: a break the text allows, drawn as `-` only when the line breaks there. */
|
|
57594
|
+
const SOFT_HYPHEN = "";
|
|
57595
|
+
/**
|
|
56912
57596
|
* Tells whether a value is a plain record, so its fields can be read one by one.
|
|
56913
57597
|
*
|
|
56914
57598
|
* @param value - Anything `JSON.parse` returned.
|
|
@@ -57186,7 +57870,7 @@ function layoutFixed(runs, style, tables, options) {
|
|
|
57186
57870
|
width += measureRun(run, style, tables, options);
|
|
57187
57871
|
continue;
|
|
57188
57872
|
}
|
|
57189
|
-
const segments = run.text.split("\n");
|
|
57873
|
+
const segments = run.text.replaceAll(SOFT_HYPHEN, "").split("\n");
|
|
57190
57874
|
for (const [index, segment] of segments.entries()) {
|
|
57191
57875
|
if (index > 0) push();
|
|
57192
57876
|
if (segment.length === 0) continue;
|
|
@@ -57224,6 +57908,7 @@ function pushToken(tokens, token, touches) {
|
|
|
57224
57908
|
if (touches && token.kind === "word" && last?.kind === "word") {
|
|
57225
57909
|
last.runs.push(...token.runs);
|
|
57226
57910
|
last.width += token.width;
|
|
57911
|
+
last.tail = token.tail;
|
|
57227
57912
|
return;
|
|
57228
57913
|
}
|
|
57229
57914
|
tokens.push(token);
|
|
@@ -57246,28 +57931,90 @@ function tokenise(runs, style, tables, options) {
|
|
|
57246
57931
|
pushToken(tokens, {
|
|
57247
57932
|
kind: "word",
|
|
57248
57933
|
runs: [run],
|
|
57249
|
-
width
|
|
57934
|
+
width,
|
|
57935
|
+
tail: 0
|
|
57250
57936
|
}, true);
|
|
57251
57937
|
continue;
|
|
57252
57938
|
}
|
|
57253
57939
|
for (const [index, piece] of run.text.split(TOKENS).entries()) {
|
|
57254
57940
|
if (piece.length === 0) continue;
|
|
57941
|
+
const kind = kindOf(piece);
|
|
57942
|
+
if (kind === "word") {
|
|
57943
|
+
pushWord(tokens, run, piece, index === 0, {
|
|
57944
|
+
style,
|
|
57945
|
+
tables,
|
|
57946
|
+
options
|
|
57947
|
+
});
|
|
57948
|
+
continue;
|
|
57949
|
+
}
|
|
57255
57950
|
const part = {
|
|
57256
57951
|
...run,
|
|
57257
57952
|
text: piece
|
|
57258
57953
|
};
|
|
57259
|
-
const kind = kindOf(piece);
|
|
57260
57954
|
const width = kind === "break" ? 0 : measureRun(part, style, tables, options);
|
|
57261
57955
|
pushToken(tokens, {
|
|
57262
57956
|
kind,
|
|
57263
57957
|
runs: [part],
|
|
57264
|
-
width
|
|
57958
|
+
width,
|
|
57959
|
+
tail: 0
|
|
57265
57960
|
}, index === 0);
|
|
57266
57961
|
}
|
|
57267
57962
|
}
|
|
57268
57963
|
return tokens;
|
|
57269
57964
|
}
|
|
57270
57965
|
/**
|
|
57966
|
+
* Puts one word of a run into the tokens, split at its breaks: after a joining hyphen, and at a
|
|
57967
|
+
* soft hyphen, which is dropped from the glyphs and becomes the `-` of a break there.
|
|
57968
|
+
*
|
|
57969
|
+
* @param tokens - The tokens so far.
|
|
57970
|
+
* @param run - The run the word is part of.
|
|
57971
|
+
* @param word - The word, with no spaces and no line break.
|
|
57972
|
+
* @param touches - True when nothing stands between the word and the token before it.
|
|
57973
|
+
* @param metrics - The style, the tables and the warning.
|
|
57974
|
+
*/
|
|
57975
|
+
function pushWord(tokens, run, word, touches, metrics) {
|
|
57976
|
+
for (const [softIndex, between] of word.split(SOFT_HYPHEN).entries()) {
|
|
57977
|
+
if (softIndex > 0) pushSoft(tokens, {
|
|
57978
|
+
...run,
|
|
57979
|
+
text: "-"
|
|
57980
|
+
}, metrics);
|
|
57981
|
+
for (const [index, piece] of between.split(HYPHEN_BREAKS).entries()) {
|
|
57982
|
+
if (index > 0) pushSoft(tokens, void 0, metrics);
|
|
57983
|
+
if (piece.length === 0) continue;
|
|
57984
|
+
const part = {
|
|
57985
|
+
...run,
|
|
57986
|
+
text: piece
|
|
57987
|
+
};
|
|
57988
|
+
const width = measureRun(part, metrics.style, metrics.tables, metrics.options);
|
|
57989
|
+
pushToken(tokens, {
|
|
57990
|
+
kind: "word",
|
|
57991
|
+
runs: [part],
|
|
57992
|
+
width,
|
|
57993
|
+
tail: 0
|
|
57994
|
+
}, touches && softIndex === 0 && index === 0);
|
|
57995
|
+
}
|
|
57996
|
+
}
|
|
57997
|
+
}
|
|
57998
|
+
/**
|
|
57999
|
+
* Puts a break inside a word into the tokens, and gives the word before it the width of the `-`
|
|
58000
|
+
* the break draws.
|
|
58001
|
+
*
|
|
58002
|
+
* @param tokens - The tokens so far.
|
|
58003
|
+
* @param hyphen - The `-` of a soft hyphen, or `undefined` after a hyphen the word already has.
|
|
58004
|
+
* @param metrics - The style, the tables and the warning.
|
|
58005
|
+
*/
|
|
58006
|
+
function pushSoft(tokens, hyphen, metrics) {
|
|
58007
|
+
const width = hyphen === void 0 ? 0 : measureRun(hyphen, metrics.style, metrics.tables, metrics.options);
|
|
58008
|
+
const last = tokens.at(-1);
|
|
58009
|
+
if (last?.kind === "word") last.tail = width;
|
|
58010
|
+
tokens.push({
|
|
58011
|
+
kind: "soft",
|
|
58012
|
+
runs: hyphen === void 0 ? [] : [hyphen],
|
|
58013
|
+
width,
|
|
58014
|
+
tail: 0
|
|
58015
|
+
});
|
|
58016
|
+
}
|
|
58017
|
+
/**
|
|
57271
58018
|
* Closes the open line and starts a new one.
|
|
57272
58019
|
*
|
|
57273
58020
|
* @param builder - The lines built so far.
|
|
@@ -57325,25 +58072,30 @@ function breakWord(builder, token, wrap, metrics) {
|
|
|
57325
58072
|
}
|
|
57326
58073
|
}
|
|
57327
58074
|
/**
|
|
57328
|
-
* Places one word: on the open line when it still fits there with the spaces before it
|
|
57329
|
-
* next one when it does not, and glyph by glyph when
|
|
58075
|
+
* Places one word: on the open line when it still fits there with the spaces before it and the
|
|
58076
|
+
* hyphen a break after it would draw, on the next one when it does not, and glyph by glyph when
|
|
58077
|
+
* it fits on no line at all. A break inside a word stands before it with no width: the line ends
|
|
58078
|
+
* there with the `-` of a soft hyphen, and the word goes on with nothing between when it fits.
|
|
57330
58079
|
*
|
|
57331
58080
|
* @param builder - The lines built so far.
|
|
57332
58081
|
* @param token - The word to place.
|
|
57333
|
-
* @param pending - The spaces
|
|
58082
|
+
* @param pending - The spaces or the break inside a word that stand before it.
|
|
57334
58083
|
* @param wrap - The wrap width in reference pixels.
|
|
57335
58084
|
* @param metrics - The style, the tables and the warning.
|
|
57336
58085
|
*/
|
|
57337
58086
|
function placeWord(builder, token, pending, wrap, metrics) {
|
|
57338
|
-
const
|
|
57339
|
-
|
|
57340
|
-
|
|
58087
|
+
const space = pending?.kind === "space" ? pending : void 0;
|
|
58088
|
+
const lead = space?.width ?? 0;
|
|
58089
|
+
if (builder.runs.length > 0 && builder.width + lead + token.width + token.tail > wrap) {
|
|
58090
|
+
if (pending?.kind === "soft") add(builder, pending);
|
|
58091
|
+
commit(builder);
|
|
58092
|
+
} else if (space !== void 0) add(builder, space);
|
|
57341
58093
|
if (token.width <= wrap) add(builder, token);
|
|
57342
58094
|
else breakWord(builder, token, wrap, metrics);
|
|
57343
58095
|
}
|
|
57344
58096
|
/**
|
|
57345
|
-
* Lays runs out into lines no wider than the wrap. Words break between them
|
|
57346
|
-
* the wrap breaks between its glyphs.
|
|
58097
|
+
* Lays runs out into lines no wider than the wrap. Words break between them, after a hyphen that
|
|
58098
|
+
* joins two parts and at a soft hyphen; a word wider than the wrap breaks between its glyphs.
|
|
57347
58099
|
*
|
|
57348
58100
|
* @param runs - The runs of the block.
|
|
57349
58101
|
* @param metrics - The style, the tables and the warning.
|
|
@@ -57367,6 +58119,10 @@ function layoutWrapped(runs, metrics, wrap) {
|
|
|
57367
58119
|
if (builder.runs.length > 0) pending = token;
|
|
57368
58120
|
continue;
|
|
57369
58121
|
}
|
|
58122
|
+
if (token.kind === "soft") {
|
|
58123
|
+
if (builder.runs.length > 0 && pending === void 0) pending = token;
|
|
58124
|
+
continue;
|
|
58125
|
+
}
|
|
57370
58126
|
placeWord(builder, token, pending, wrap, metrics);
|
|
57371
58127
|
pending = void 0;
|
|
57372
58128
|
}
|
|
@@ -72913,6 +73669,7 @@ function cubicBezier(x1, y1, x2, y2) {
|
|
|
72913
73669
|
* | renderer | keptMb | 64, MiB the kept pictures may hold: a filtered view that did not change is drawn from its picture, the least recently drawn goes first; 0 keeps none |
|
|
72914
73670
|
* | renderer | warm | 1, probe draws a drawn frame that create the GPU pipelines while the game loads; 0 creates each in the first frame that needs it |
|
|
72915
73671
|
* | renderer | uploads | 1, texture sources `sync.textures.upload` puts on the GPU a drawn frame (~9 ms each on the A26); 0 turns the queue off |
|
|
73672
|
+
* | renderer | shots | undefined, no shot is taken; { width, height, blur, keep? }: texels 1–512 a side, sigma in reference units, pictures kept (8); shallow merge: a game that sets `shots` gives width, height and blur |
|
|
72916
73673
|
* | input | tapSlopPx | 12 |
|
|
72917
73674
|
* | input | longPressMs | 450 |
|
|
72918
73675
|
* | input | dragStartPx | 8 |
|