Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

feat: add device quality policy and lighting validation

yhhc9a6a0bcb1a5
diff --git a/desktop b/desktop
index 3e3a8932f..c2a9e77d4 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 3e3a8932fb1c6d4a7d4de20b7842974e17c2e53e
+Subproject commit c2a9e77d4047a08a967d25f3f6ec024443f8797f
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index a1b4de1ff..364b1c156 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -3,10 +3,10 @@
"counts": {
"public": 115,
"beta": 103,
- "experimental": 2140,
+ "experimental": 2150,
"deprecated": 3
},
- "total": 2358,
+ "total": 2368,
"subsystems": [
{
"id": "ecs",
diff --git a/examples/device-quality/assets/scenes/main.esscene b/examples/device-quality/assets/scenes/main.esscene
new file mode 100644
index 000000000..e8672d3d4
--- /dev/null
+++ b/examples/device-quality/assets/scenes/main.esscene
@@ -0,0 +1,745 @@
+{
+ "version": 4,
+ "name": "Device quality",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.5,
+ "y": 1,
+ "z": 4
+ },
+ "rotation": {
+ "x": -0.103,
+ "y": 0.178,
+ "z": 0.019,
+ "w": 0.978
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 0,
+ "fov": 50,
+ "nearPlane": 0.1,
+ "farPlane": 20,
+ "isActive": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Lamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "rotation": {
+ "x": -0.3,
+ "y": -0.25,
+ "z": 0,
+ "w": 0.9205976319760985
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 3,
+ "meshShadows": true,
+ "shadowExtent": 8,
+ "enabled": true,
+ "sourceAngle": 0.53
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Floor",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": -0.6,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.05,
+ "y": 0.001,
+ "z": 0.05
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.35,
+ "g": 0.4,
+ "b": 0.5,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Test cube",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.01,
+ "y": 0.01,
+ "z": 0.01
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 1,
+ "g": 0.4,
+ "b": 0.12,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ },
+ {
+ "type": "QualitySubject",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Canvas",
+ "parent": null,
+ "children": [
+ 7,
+ 8
+ ],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 960,
+ "y": 640
+ },
+ "scaleMode": 2,
+ "backgroundColor": {
+ "r": 0,
+ "g": 0,
+ "b": 0,
+ "a": 0
+ }
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Status",
+ "parent": 6,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 930,
+ "unit": 0
+ },
+ "height": {
+ "value": 36,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 15,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 12,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Device quality",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ },
+ {
+ "type": "QualityStatus",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Controls",
+ "parent": 6,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 930,
+ "unit": 0
+ },
+ "height": {
+ "value": 30,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 15,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 48,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "1 / 2 / 3: quality | A: auto | 0: original | Arrows: camera",
+ "fontSize": 16,
+ "color": {
+ "r": 0.8,
+ "g": 0.9,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ]
+ },
+ {
+ "id": 9,
+ "name": "Ambient",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 2,
+ "intensity": 0.2,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 20,
+ "name": "Cube 0",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -1.35,
+ "y": -0.25,
+ "z": -0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 21,
+ "name": "Cube 1",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -0.45,
+ "y": -0.25,
+ "z": -0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 22,
+ "name": "Cube 2",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0.45,
+ "y": -0.25,
+ "z": -0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 23,
+ "name": "Cube 3",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.35,
+ "y": -0.25,
+ "z": -0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 24,
+ "name": "Cube 4",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -1.35,
+ "y": -0.25,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 27,
+ "name": "Cube 7",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.35,
+ "y": -0.25,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 28,
+ "name": "Cube 8",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -1.35,
+ "y": -0.25,
+ "z": 0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 29,
+ "name": "Cube 9",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": -0.45,
+ "y": -0.25,
+ "z": 0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 30,
+ "name": "Cube 10",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0.45,
+ "y": -0.25,
+ "z": 0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 31,
+ "name": "Cube 11",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.35,
+ "y": -0.25,
+ "z": 0.9
+ },
+ "scale": {
+ "x": 0.005,
+ "y": 0.005,
+ "z": 0.005
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "enabled": true,
+ "color": {
+ "r": 0.1,
+ "g": 0.65,
+ "b": 0.8,
+ "a": 1
+ },
+ "opaque": true,
+ "cullBackfaces": true
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/examples/device-quality/assets/scenes/main.esscene.meta b/examples/device-quality/assets/scenes/main.esscene.meta
new file mode 100644
index 000000000..a480b30eb
--- /dev/null
+++ b/examples/device-quality/assets/scenes/main.esscene.meta
@@ -0,0 +1,6 @@
+{
+ "uuid": "5fd19f1c-83f7-4068-ad29-33e874bff973",
+ "version": "2.0",
+ "type": "scene",
+ "importer": {}
+}
diff --git a/examples/device-quality/project.esproject b/examples/device-quality/project.esproject
new file mode 100644
index 000000000..f8637cf97
--- /dev/null
+++ b/examples/device-quality/project.esproject
@@ -0,0 +1,22 @@
+{
+ "formatVersion": "1",
+ "name": "Device Quality",
+ "version": "0.1.0",
+ "defaultScene": "assets/scenes/main.esscene",
+ "designResolution": {
+ "width": 960,
+ "height": 640
+ },
+ "features": {
+ "rendering": {
+ "backend": "webgpu",
+ "colorSpace": "linear",
+ "outputTransform": "aces",
+ "quality": {
+ "mode": "auto",
+ "targetFps": 60,
+ "dynamicResolution": true
+ }
+ }
+ }
+}
diff --git a/examples/device-quality/src/components.ts b/examples/device-quality/src/components.ts
new file mode 100644
index 000000000..29ac847b1
--- /dev/null
+++ b/examples/device-quality/src/components.ts
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { defineTag } from 'esengine';
+
+export const QualityStatus = defineTag('QualityStatus');
+export const QualitySubject = defineTag('QualitySubject');
diff --git a/examples/device-quality/src/main.ts b/examples/device-quality/src/main.ts
new file mode 100644
index 000000000..8a4be7212
--- /dev/null
+++ b/examples/device-quality/src/main.ts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { addPlugin, Camera, defineSystem, getDeviceIdentity, Input, Mut, Playthrough, Quality, Query, Res, Text, Time, Transform } from 'esengine';
+import { QualityStatus, QualitySubject } from './components';
+
+addPlugin({
+ name: 'device-quality-demo',
+ build(app) {
+ let angle = 0;
+ const facts = { backend: '', mode: '', level: '', renderScale: 1, reason: '' };
+ app.insertResource(Playthrough, { facts });
+ app.addSystem(defineSystem([
+ Res(Input), Res(Time), Res(Quality), Query(Mut(Text), QualityStatus),
+ Query(Mut(Transform), QualitySubject), Query(Mut(Transform), Camera),
+ ], (input, time, quality, labels, subjects, cameras) => {
+ if (!quality) return;
+ for (const [key, mode] of [['Digit1', 'low'], ['Digit2', 'medium'],
+ ['Digit3', 'high'], ['KeyA', 'auto'], ['Digit0', 'off']] as const) {
+ if (input.isKeyPressed(key)) quality.setMode(mode);
+ }
+ angle += time.delta * 0.35;
+ for (const [, transform] of subjects) transform.rotation = {
+ x: 0, y: Math.sin(angle / 2), z: 0, w: Math.cos(angle / 2),
+ };
+ for (const [, transform] of cameras) {
+ const p = transform.position;
+ p.x = Math.max(-2, Math.min(4, p.x + time.delta * 1.5 *
+ (Number(input.isKeyDown('ArrowRight')) - Number(input.isKeyDown('ArrowLeft')))));
+ p.z = Math.max(3, Math.min(7, p.z + time.delta * 1.5 *
+ (Number(input.isKeyDown('ArrowDown')) - Number(input.isKeyDown('ArrowUp')))));
+ }
+ const report = quality.report();
+ Object.assign(facts, { mode: report.mode, level: report.level,
+ renderScale: report.renderScale, reason: report.reason,
+ backend: getDeviceIdentity(app.wasmModule)?.backend ?? 'unknown' });
+ const profile = quality.profile;
+ for (const [, label] of labels) label.content = `${report.mode}: ${report.level} | `
+ + `${Math.round(report.renderScale * 100)}% | ${report.targetFps} fps target | `
+ + `MSAA requested ${quality.enabled ? profile.msaaSamples : 'original'} | ${report.reason}`;
+ }, { name: 'DeviceQualityDemo' }));
+ },
+});
diff --git a/examples/device-quality/tsconfig.json b/examples/device-quality/tsconfig.json
new file mode 100644
index 000000000..105dd19fa
--- /dev/null
+++ b/examples/device-quality/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "declaration": false,
+ "outDir": "./dist",
+ "rootDir": ".",
+ "paths": {
+ "esengine": ["./.esengine/sdk/index.d.ts"],
+ "estella-plugin-*": ["./.esengine/packages/*"],
+ "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"]
+ }
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules"]
+}
diff --git a/examples/physics-3d/assets/scenes/main_lightmap.png b/examples/physics-3d/assets/scenes/main_lightmap.png
index c3c23b6aa..13344017d 100644
Binary files a/examples/physics-3d/assets/scenes/main_lightmap.png and b/examples/physics-3d/assets/scenes/main_lightmap.png differ
diff --git a/examples/physics-3d/assets/scenes/main_probes_50.esprobes b/examples/physics-3d/assets/scenes/main_probes_50.esprobes
index f77bb4dbd..e7ed20cd7 100644
--- a/examples/physics-3d/assets/scenes/main_probes_50.esprobes
+++ b/examples/physics-3d/assets/scenes/main_probes_50.esprobes
@@ -1,5 +1,5 @@
{
"version": 1,
"resolution": [7,3,5],
- "irradiance": [0.787525,0.947183,1.21709,-0.0128871,-0.0145809,-0.0199165,-0.0216912,-0.024515,-0.0335227,-0.0226589,-0.0256378,-0.0350183,-0.00620364,-0.00699162,-0.00958744,-0.00623858,-0.00705768,-0.00964144,-0.00212922,-0.00240502,-0.00329061,-0.0105509,-0.0119378,-0.0163059,-0.00414027,-0.00468563,-0.00639859,0.738265,0.891448,1.14096,-0.0415297,-0.0469878,-0.0641822,-0.0613031,-0.0693331,-0.0947412,-0.00666444,-0.00754116,-0.0102996,-0.000164008,-0.000158209,-0.000253468,-0.0219174,-0.0247971,-0.0338723,-0.00980345,-0.0110879,-0.0151508,-0.00276039,-0.00312344,-0.00426606,-0.00145615,-0.00164875,-0.0022504,0.729309,0.881314,1.12712,-0.0423377,-0.047902,-0.0654308,-0.0694891,-0.0785949,-0.107392,-0.00111113,-0.00125799,-0.00171721,0.000277233,0.000341024,0.000428451,-0.0223998,-0.0253429,-0.0346179,-0.012195,-0.0137937,-0.0188468,0.000610242,0.000690194,0.0009431,-0.00289992,-0.00328227,-0.00448168,0.730707,0.882808,1.12998,-0.0422219,-0.0477847,-0.0651816,-0.0681888,-0.0772125,-0.104719,-0.000105739,-0.000157315,0.00028999,0.000345285,0.000414414,0.000566514,-0.0223234,-0.0252667,-0.0344513,-0.0118302,-0.0134136,-0.0180826,0.00130522,0.00145183,0.00232894,-0.00266381,-0.0030229,-0.00401197,0.72871,0.880371,1.12656,-0.042488,-0.0481302,-0.0655913,-0.0700922,-0.0795621,-0.107909,-0.000917724,-0.00100318,-0.00141457,0.000312197,0.000387325,0.00048253,-0.0225097,-0.0255122,-0.034729,-0.0124137,-0.0141612,-0.0189932,0.000737173,0.000856444,0.00114404,-0.00293781,-0.0033316,-0.00454241,0.733278,0.885576,1.13353,-0.0419621,-0.047508,-0.0648129,-0.0656175,-0.0743816,-0.101206,0.00226046,0.00275908,0.0032482,0.00053198,0.000649137,0.000798054,-0.0221305,-0.0250547,-0.0341818,-0.0109466,-0.0123941,-0.016902,0.00285925,0.00334212,0.00428876,-0.00236481,-0.00274025,-0.00357782,0.790954,0.950547,1.22174,-0.00960914,-0.0109881,-0.0149956,-0.0201508,-0.0228443,-0.0312323,0.0199909,0.0231963,0.0316186,0.00565002,0.00651475,0.00885036,-0.00446563,-0.00506353,-0.0069162,-0.00271103,-0.00292566,-0.00401773,0.00975895,0.0111002,0.0151556,-0.00394222,-0.00468825,-0.00637588,0.800496,0.959563,1.21962,0.00644747,0.00821149,0.0191199,-0.0227969,-0.0271348,-0.0408284,-0.00119849,-0.00315642,-0.0193024,0.0000410554,0.000592982,0.00593914,0.00555783,0.0066437,0.011335,-0.0101426,-0.0114592,-0.0114748,-0.00493011,-0.00625899,-0.0121223,0.00339554,0.0034675,0.000937253,0.860872,1.01938,1.24144,-0.0272271,-0.0267536,0.00751207,0.0300581,0.0255765,-0.0176962,0.0249131,0.0250343,0.0119226,-0.00560587,-0.0056801,-0.00224833,-0.0138034,-0.0135731,0.00301913,0.00309019,0.00200364,-0.00302856,0.0108663,0.0109264,0.00605545,-0.00242788,-0.00338045,-0.00243578,0.862347,1.02182,1.23465,-0.032222,-0.0320372,0.00582751,0.0275115,0.0239823,-0.0242222,-0.00537432,-0.00596468,-0.00850571,0.00162083,0.00191538,0.00185963,-0.0150149,-0.0148549,0.00306737,0.00103919,0.000379351,-0.00421886,-0.00426092,-0.00476123,-0.00560804,-0.00292746,-0.00395755,-0.00509168,0.887573,1.04676,1.25702,-0.0338124,-0.0335401,0.00483102,0.0480382,0.0439146,-0.00574505,-0.0260572,-0.0260476,-0.0229879,0.00432752,0.00465832,0.00392746,-0.0157253,-0.0154292,0.00267342,0.00435309,0.00317731,-0.00130267,-0.0173181,-0.0175083,-0.0153057,0.00322475,0.00232248,0.00027055,0.860906,1.02005,1.24154,-0.0291718,-0.0285755,0.00781472,0.0279506,0.0234507,-0.0185362,0.00188072,0.00324124,0.00620576,0.000174752,0.000126676,-0.000234617,-0.0129673,-0.0123648,0.00479953,0.00152834,-0.000160204,-0.00367052,0.00047771,0.000930894,0.00146565,-0.00311592,-0.00372695,-0.00314301,0.852004,1.01337,1.24106,-0.028092,-0.0280754,0.00567179,0.0203721,0.0180982,-0.0200936,-0.00189919,-0.0004092,0.0121622,0.00259356,0.00257306,-0.000565682,-0.0127473,-0.0125429,0.00392074,-0.00138562,-0.00226723,-0.0055742,0.000623176,0.00136291,0.00549433,-0.00420041,-0.00468323,-0.00303971,0.837734,1.00022,1.25399,-0.010854,-0.0107294,0.00332394,0.0114334,0.0104304,-0.00919001,-0.012505,-0.0115858,0.00701943,0.00563716,0.00570465,-0.000606735,-0.0044717,-0.00430582,0.00227023,-0.000358693,-0.000615321,-0.00239543,-0.00414448,-0.00367089,0.00379254,0.00128062,0.000988999,-0.00141091,0.822954,0.98456,1.24419,-0.00418006,-0.00284488,0.0134422,-0.0037781,-0.00565253,-0.0174685,0.00797472,0.00737906,-0.00648878,-0.00309924,-0.00273474,0.0037775,0.00165075,0.00249459,0.0077429,-0.00530499,-0.00581176,-0.00421836,0.00191514,0.00155918,-0.00347616,0.0011147,0.00136022,0.00236154,0.854811,1.01673,1.25782,-0.0320514,-0.03118,0.00335539,0.0194942,0.0180646,-0.00380148,0.00193945,0.00160735,-0.00853064,-0.00106941,-0.00101542,0.00348796,-0.0111989,-0.0106035,0.00125953,-0.00180661,-0.00203874,0.000381528,0.000636795,0.000582873,-0.00366002,-0.00867818,-0.00885823,-0.00133129,0.854748,1.01285,1.24118,-0.0294058,-0.0267382,0.0158177,0.0187663,0.0150899,-0.016121,0.0037877,0.00201504,-0.0026555,0.00026282,0.00086454,0.00225308,-0.00986331,-0.00856418,0.00746947,-0.0021122,-0.00213927,-0.000844322,0.000703785,-0.0000406061,-0.00157516,-0.00617337,-0.00698879,0.00092101,0.850005,1.01014,1.24037,-0.0229792,-0.0207523,0.0206152,0.0138771,0.0111516,-0.0183881,-0.0118688,-0.0124227,-0.0110753,0.00446025,0.00486087,0.00406341,-0.00586924,-0.0045922,0.0106492,-0.00357584,-0.00387308,-0.00225576,-0.00634459,-0.00679376,-0.00606706,-0.00225405,-0.00214503,0.00526742,0.858125,1.017,1.24561,-0.0314373,-0.0289928,0.0131091,0.0220577,0.0184534,-0.0130407,-0.00115696,-0.00187198,0.0028731,0.0012198,0.00176116,0.0000877137,-0.0108612,-0.00939949,0.0066399,-0.00147662,-0.00191581,-0.000877415,-0.000365041,-0.00118455,0.0000259359,-0.00615863,-0.00655571,0.00113428,0.855363,1.01206,1.24357,-0.0289972,-0.0254601,0.0146203,0.0179333,0.0109861,-0.0171108,-0.011662,-0.0111853,0.00137112,0.00553361,0.00554909,0.000663614,-0.00865102,-0.00598065,0.00863058,-0.00282911,-0.00516589,-0.00314004,-0.0041978,-0.00399893,0.0000983545,-0.00523437,-0.00485754,0.00236351,0.835127,0.993163,1.24984,-0.0129033,-0.0100216,0.00941048,0.00532716,0.000906712,-0.0120507,-0.0109294,-0.0074001,0.00738052,0.00566315,0.00451564,-0.00230642,-0.00275675,-0.00105727,0.00556439,-0.00359931,-0.00425899,-0.00211841,-0.0026541,-0.000813324,0.0040823,-0.00100434,-0.0013968,0.000645681,0.729509,0.881399,1.12839,-0.0467424,-0.0530276,-0.0712735,-0.00356342,-0.00403267,-0.00531706,-0.0666252,-0.075459,-0.102446,-0.0236764,-0.0268164,-0.0362123,-0.000963635,-0.00110976,-0.00135106,0.00324216,0.00370843,0.00476489,-0.00185991,-0.00211556,-0.00279986,-0.00858882,-0.00968229,-0.0135223,0.563616,0.693843,0.871043,-0.163331,-0.184797,-0.252421,-0.00312799,-0.00351208,-0.00483417,-0.00570718,-0.00645809,-0.00882019,-0.000219454,-0.000220942,-0.000339157,-0.000316014,-0.000356715,-0.000488385,0.00451025,0.00510706,0.00697039,-0.00326112,-0.00368997,-0.00503991,0.00737592,0.0083441,0.0113992,0.558189,0.687495,0.862693,-0.164101,-0.185704,-0.253604,-0.00644702,-0.00727783,-0.00996171,-0.00282568,-0.00343343,-0.0043244,0.0000356534,0.0000384371,0.0000604703,-0.000642574,-0.000727317,-0.00099287,0.00451963,0.00517458,0.00697461,-0.00120126,-0.00136814,-0.00185493,0.00570266,0.00635639,0.00883024,0.556418,0.683723,0.864382,-0.167018,-0.190358,-0.256482,-0.00684113,-0.00744186,-0.0117001,0.00829701,0.00817313,0.0170444,0.000436146,-0.000050206,0.00175217,-0.000646604,-0.000608417,-0.00126299,0.00494531,0.00583923,0.00704142,-0.00328745,-0.00361991,-0.00571979,0.00743027,0.00840923,0.0127357,0.636202,0.773727,1.01852,-0.107938,-0.123673,-0.142421,-0.00873854,-0.00977028,-0.0150059,-0.000951478,-0.000963839,-0.00329603,-0.00020291,-0.000184486,-0.000601835,-0.00120158,-0.00134282,-0.00212771,0.00195993,0.00231153,0.00157805,-0.00225331,-0.00254749,-0.00354334,-0.000294205,-0.000213799,-0.00235455,0.564091,0.694089,0.872507,-0.163334,-0.18487,-0.25236,-0.0012593,-0.00141044,-0.00212137,0.0107621,0.0124973,0.0158129,0.00137096,0.00163216,0.0020655,-0.00027098,-0.000307812,-0.000428955,0.00526789,0.00603849,0.00796702,0.000554288,0.000638355,0.0009992,0.00712257,0.00793546,0.0113389,0.752697,0.907175,1.15645,-0.0276135,-0.0316344,-0.0483254,0.00192,0.00228869,0.00374418,0.0567952,0.0647225,0.0922712,0.0168116,0.0192403,0.0286925,0.0010311,0.00120527,0.00212307,0.00454369,0.00524966,0.0080726,-0.000970871,-0.0011425,-0.00170238,-0.0131332,-0.014885,-0.0196908,0.674555,0.815024,1.06506,0.0495696,0.0574047,0.0732287,-0.0217849,-0.0252712,-0.0300659,-0.109856,-0.127845,-0.149824,0.0207393,0.024107,0.0302933,0.00523577,0.00607406,0.00741895,0.00786213,0.00923883,0.0105487,-0.00607644,-0.00709569,-0.00812058,-0.017887,-0.0209324,-0.0222696,0.883645,1.02887,1.18098,-0.0687556,-0.0645631,0.0285511,-0.00472256,-0.0086901,-0.0175563,0.0315105,0.0440019,0.0323728,-0.00759729,-0.00888225,-0.000519995,0.00213982,0.00294328,0.00454949,-0.00197669,-0.000520843,0.00709915,-0.0013919,-0.00101487,-0.000851769,-0.0218369,-0.0258815,-0.0138033,0.907239,1.06138,1.19687,-0.0800625,-0.07853,0.0266419,0.0165289,0.0157453,0.00154129,-0.0129637,-0.013242,-0.0172969,0.00336094,0.00362366,0.0040498,-0.00483681,-0.00475794,-0.00076464,-0.000344163,0.00136025,0.0108934,0.0100496,0.0123107,0.0101821,-0.020391,-0.0238571,-0.0132019,0.907376,1.05137,1.17719,-0.0804518,-0.0781026,0.0239283,0.023123,0.0225669,0.00663528,0.0237665,0.0291194,0.0300844,-0.00309608,-0.00190891,0.00191971,-0.00595762,-0.0047675,0.00200444,-0.00408008,-0.00326378,0.00687755,-0.00984809,-0.0158576,-0.0181096,-0.015417,-0.0191261,-0.0114021,0.945702,1.09109,1.23362,-0.100327,-0.0909018,0.00615737,-0.00416698,-0.0180982,-0.0337722,-0.0276967,-0.0312387,-0.0254469,0.0131776,0.013942,0.0141744,0.00464845,0.00932017,0.013409,-0.0127294,-0.0151937,-0.00774476,-0.00591711,-0.0090682,-0.0100239,-0.0155296,-0.0153868,-0.0090673,0.906882,1.05086,1.19709,-0.0620062,-0.053125,0.0456678,-0.0158368,-0.0346713,-0.047552,-0.0227535,-0.0204186,0.00330449,0.00812814,0.00758905,0.001696,0.0150274,0.0212729,0.0228551,-0.0077994,-0.0128519,-0.00553197,-0.000441158,0.000437896,0.000802504,-0.0049932,-0.00493082,0.00686803,0.850225,1.009,1.23215,-0.0235832,-0.021935,0.0143697,-0.0109869,-0.015063,-0.0187087,-0.0204032,-0.016588,0.0267149,0.0106351,0.00983894,-0.00739616,0.0036441,0.00480044,0.00563833,-0.00439115,-0.0047902,0.000498097,0.00771721,0.00980612,0.0104849,-0.00122416,-0.00214435,-0.00552289,0.835614,0.990697,1.24577,0.00267216,0.00883513,0.026658,0.00970429,0.00788269,0.00289505,0.0315913,0.0258439,0.00453388,-0.0088642,-0.00647811,0.00221516,-0.00325456,-0.00244938,-0.000923271,-0.00473516,-0.00319338,0.00157928,0.00773767,0.0068118,0.0039396,0.0173337,0.0175205,0.0156406,0.897277,1.05733,1.27082,-0.0664869,-0.0632194,-0.00351023,0.0150228,0.0143071,-0.000950169,0.0152068,0.0176642,-0.00928711,-0.00605199,-0.00747242,0.0058794,-0.00718409,-0.00682732,0.000740639,-0.00991774,-0.00963938,-0.000363748,0.00371928,0.00398372,-0.000491779,-0.0122695,-0.011494,0.000741346,0.893818,1.04904,1.24355,-0.0623718,-0.0576028,0.0176422,0.0242595,0.0223354,-0.00073703,0.019934,0.0166169,0.00566039,-0.00684755,-0.00559846,-0.00158721,-0.0122168,-0.0117057,-0.000351845,-0.00883122,-0.00729283,0.00336766,0.00486114,0.00409776,0.00140844,-0.0111979,-0.0127808,0.00215107,0.89989,1.05486,1.2508,-0.0650871,-0.0589376,0.0149052,0.0274111,0.0256949,0.00152978,0.00134054,0.000273788,-0.00188826,-0.00101401,-0.000228786,0.00134506,-0.0127588,-0.0120977,0.0000316478,-0.0077634,-0.00597146,0.00376577,-0.00180545,-0.00291932,-0.00194784,-0.0102449,-0.0106832,0.00359494,0.891081,1.04076,1.23956,-0.0644396,-0.0538915,0.0179526,0.0191796,0.0113609,-0.0109848,-0.00604972,-0.00818703,0.00012916,0.00553146,0.00721532,0.00386088,-0.00826995,-0.00397038,0.0066374,-0.00693701,-0.00628275,0.00285159,-0.00143115,-0.00321524,-0.0015606,-0.0164008,-0.0150333,-0.000255386,0.897824,1.04435,1.24926,-0.0661389,-0.0514119,0.0156784,0.0252963,0.0136439,-0.00541754,-0.0181562,-0.0168053,0.00339963,0.00818116,0.00739875,-0.00154777,-0.0126078,-0.00551666,0.00396361,-0.00678901,-0.00698838,0.00242836,-0.00281224,-0.00236102,0.00065171,-0.0132,-0.00932599,0.00474075,0.864498,1.02013,1.25347,-0.0350887,-0.0293282,0.00977904,0.0141562,0.0101815,-0.00134962,-0.027682,-0.0221626,0.00624837,0.0149575,0.0124329,-0.00184987,-0.00643677,-0.00423086,0.00110793,-0.00483917,-0.0039824,0.00262238,-0.00559888,-0.00378335,0.000736385,-0.00317166,-0.00309039,0.00158832,0.72053,0.871234,1.11451,-0.0475521,-0.0539442,-0.072525,0.00408972,0.00462909,0.0065097,-0.0718517,-0.0813773,-0.110522,-0.0239441,-0.0271195,-0.0366261,-0.000412469,-0.000486045,-0.000499316,0.00119227,0.00138952,0.00159679,0.000590996,0.000659491,0.00098732,-0.0102455,-0.0115585,-0.0160822,0.554043,0.682762,0.856505,-0.164178,-0.185771,-0.253713,0.00486246,0.00567046,0.00736907,-0.0115287,-0.0132953,-0.0175601,-0.000514353,-0.000566084,-0.00078312,0.000250663,0.000290947,0.000380709,0.00250558,0.00285799,0.00385269,-0.000564506,-0.000535575,-0.000978515,0.00550317,0.00613435,0.00859816,0.549883,0.678136,0.850139,-0.164764,-0.186429,-0.254615,0.00141022,0.00171929,0.00199814,-0.00725001,-0.00837437,-0.0108846,-0.000110668,-0.000105685,-0.00015636,-0.0000790722,-0.0000841975,-0.000130516,0.00223036,0.00254053,0.00342256,0.00140334,0.00165797,0.00203674,0.00437827,0.00489055,0.00688251,0.545507,0.673312,0.843066,-0.16514,-0.186851,-0.255215,0.00259318,0.00300347,0.00399883,-0.00201245,-0.00229686,-0.00310629,0.000187179,0.000236477,0.00028981,0.00000358028,0.00000971133,0.00000454124,0.00320082,0.0036102,0.00494995,0.000395478,0.000459861,0.000608633,0.00243025,0.00274446,0.00375662,0.549686,0.677862,0.849849,-0.164907,-0.186611,-0.254816,0.000379343,0.000699523,0.000208761,0.0026304,0.00297089,0.00411154,0.000416818,0.0004999,0.000647846,-0.000073289,-0.0000576319,-0.000146185,0.00271013,0.00296216,0.00436443,-0.00154956,-0.0017457,-0.00243399,0.00405615,0.00458275,0.00627093,0.559088,0.68871,0.864048,-0.163703,-0.18522,-0.252995,0.00439774,0.00501152,0.00679482,0.0106475,0.0120547,0.0164536,0.0011909,0.00137585,0.00184028,0.000204575,0.000233385,0.00031595,0.00295751,0.00334878,0.00457098,0.000687408,0.000772403,0.00106334,0.00682936,0.00772332,0.0105549,0.751503,0.905845,1.15286,-0.0280399,-0.0321359,-0.049435,0.00376431,0.00446702,0.00848615,0.0565171,0.0642827,0.0922848,0.0168516,0.0192819,0.0288335,0.00140286,0.00164789,0.0030558,0.00351562,0.00399884,0.00566869,-0.00118207,-0.00137462,-0.00235897,-0.0128373,-0.0144879,-0.0192414,0.66063,0.79867,1.04636,0.0520614,0.0603918,0.0766293,0.000309106,0.000561037,-0.000549619,-0.118535,-0.138012,-0.161404,0.0214998,0.02502,0.0313314,0.0032567,0.00372724,0.00471288,0.00451941,0.0053238,0.00602131,0.00160138,0.00187596,0.00211849,-0.019328,-0.0226004,-0.0241777,0.901682,1.04255,1.18406,-0.0729347,-0.0679661,0.0281205,-0.0202856,-0.0190296,-0.024125,0.0699396,0.083158,0.0682688,-0.0164766,-0.0181859,-0.00828854,-0.00147166,-0.00247361,-0.00135847,-0.0041447,-0.00394999,0.00313747,-0.00896078,-0.00812438,-0.00698926,-0.0131327,-0.0172831,-0.00646912,0.990061,1.14265,1.25808,-0.111902,-0.111374,0.00290989,-0.0308005,-0.0284522,-0.0265959,0.00582065,0.00684885,0.000664505,0.000419867,0.00016726,0.00180014,0.00490472,0.00455237,0.00469164,0.000366145,0.00167465,0.0102863,0.0166698,0.0166131,0.0180572,-0.00823976,-0.0130583,-0.00495064,0.943573,1.09414,1.21643,-0.0947451,-0.0915653,0.0202458,0.0043863,0.00928277,0.00543029,-0.014825,-0.0220501,-0.0135414,0.00827789,0.0116342,0.00981804,-0.000973897,-0.00174748,0.0000374596,-0.00336134,-0.00187574,0.007284,-0.00421494,-0.00376261,-0.00375973,-0.0145979,-0.0189429,-0.0100142,0.972634,1.07035,1.19206,-0.124936,-0.0710252,0.0417408,0.007824,0.00780756,0.00503326,-0.0201057,-0.0377616,-0.0298938,0.00939806,0.0177267,0.0158437,-0.00233799,-0.001708,-0.000648919,-0.00822116,-0.0000422503,0.00904504,-0.00194945,-0.00304774,-0.00209683,-0.0257499,-0.0157093,-0.00658655,1.05129,1.10191,1.22323,-0.170331,-0.0868376,0.0273426,-0.00287092,-0.00350229,-0.00514177,-0.00809702,-0.00656597,0.00591739,0.0019855,0.00180736,-0.000180869,0.00073405,0.00088698,0.00121845,-0.0134095,-0.00808421,0.000651789,0.00182268,0.00184729,0.0022726,-0.018125,-0.00809017,0.00159568,0.862763,1.00886,1.22881,-0.024228,-0.0155968,0.0219945,0.00382506,0.00298547,0.000687828,-0.0294917,-0.0132699,0.0303524,0.0104741,0.0050025,-0.0123166,-0.000802806,-0.000633561,-0.0000459908,-0.00133061,0.00134647,0.00476874,-0.00184388,-0.0012597,-0.000186928,0.00233692,-0.00140631,-0.00428852,0.802521,0.958427,1.21189,0.0205159,0.027303,0.0472672,-0.00178062,-0.00166739,0.00197414,0.00595894,0.00277929,-0.0186006,0.000122737,0.00209146,0.0114092,-0.000538009,-0.000778108,-0.00251629,-0.00153099,-0.001043,0.00388987,-0.00259544,-0.00280476,-0.00117317,0.0128127,0.0145347,0.0134559,0.906121,1.06256,1.26429,-0.0711656,-0.0659347,0.00197067,-0.00304482,-0.00267679,-0.000916967,0.0144888,0.0139549,-0.0178877,-0.00584743,-0.00632783,0.00891249,-0.000840375,-0.001209,-0.00150472,-0.00798643,-0.00683063,0.00201908,-0.00154967,-0.00175663,-0.000424638,-0.0112418,-0.0111436,0.0019956,0.884456,1.04204,1.22441,-0.0625293,-0.0590826,0.0277547,-0.00185613,-0.00161064,-0.0000341217,0.0115326,0.0129746,0.00167224,-0.00583183,-0.00657611,-0.00132104,0.00142831,0.00138734,0.00076902,-0.00492418,-0.00364262,0.00746482,0.00144822,0.00171487,0.00245783,-0.0197727,-0.0211083,-0.00301472,0.914182,1.0612,1.23896,-0.0817305,-0.0702737,0.0194391,-0.00580651,-0.00663656,-0.00507419,0.0149053,0.00789325,-0.00027896,-0.0066067,-0.00221568,0.00138809,0.00397613,0.00438478,0.00392274,-0.0103475,-0.00623911,0.00646839,0.00414444,0.00409898,0.00484666,-0.0169186,-0.0184488,-0.00145611,0.917067,1.06043,1.23843,-0.0875737,-0.0686188,0.0215283,-0.00204304,0.000132502,0.0018192,-0.000783758,-0.00637015,0.00198096,0.00120953,0.00557808,0.00247258,0.00186261,0.000815349,0.000279357,-0.0122771,-0.0072431,0.00504682,-0.00190066,-0.00201501,-0.00208546,-0.0195898,-0.0154384,0.0024093,0.910365,1.04953,1.2478,-0.0873899,-0.0615893,0.0133217,0.00312886,0.00357486,-0.00111202,-0.0141456,-0.0111574,0.00910365,0.00926027,0.0075215,-0.00243689,-0.0017166,-0.00199289,0.000536269,-0.0123376,-0.00654627,0.00384822,0.00181522,0.00192011,0.00116866,-0.0249044,-0.0163138,0.000630049,0.864366,1.01498,1.24443,-0.0370838,-0.0260347,0.016537,0.00263942,0.00230974,0.00331259,-0.0276957,-0.0187866,0.0125181,0.0162517,0.0113767,-0.00445214,-0.00119605,-0.000814109,-0.00117436,-0.00625245,-0.00308726,0.00486233,-0.00186455,-0.00177291,-0.00147649,-0.00403675,-0.00280263,0.0019797,0.725074,0.876382,1.12152,-0.0470635,-0.0533894,-0.0717842,0.00832833,0.00942228,0.0130582,-0.0688837,-0.0780135,-0.105944,-0.0237157,-0.0268603,-0.0362788,-0.000101161,-0.000133728,-0.0000202226,0.00245645,0.00281908,0.00355428,0.00259516,0.00292515,0.00408413,-0.00957207,-0.0107951,-0.0150382,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.0138529,0.0157006,0.0214091,-0.00780275,-0.00882908,-0.0120588,-0.000249881,-0.000255367,-0.000386179,0.00124164,0.00140566,0.0019189,0.00613283,0.00694291,0.00947802,0.00134433,0.00152077,0.0020776,0.00634808,0.00718118,0.00981068,0.559137,0.688776,0.864122,-0.163452,-0.184934,-0.252608,0.0105819,0.0119997,0.0163539,-0.00384389,-0.00434991,-0.00594055,0.000139135,0.000184776,0.000215026,0.000920217,0.00104199,0.00142215,0.00588196,0.00665907,0.00909031,0.0034442,0.00389662,0.00532286,0.00510713,0.00577713,0.00789285,0.554659,0.68371,0.857201,-0.163816,-0.185346,-0.25317,0.0117386,0.0133084,0.0181414,0.00118296,0.00133761,0.00182821,0.000435512,0.000520105,0.000673063,0.000988412,0.00111915,0.00152755,0.00694578,0.0078627,0.0107344,0.00250135,0.00282985,0.00386572,0.00306904,0.00347117,0.00474305,0.559137,0.688776,0.864122,-0.163533,-0.185026,-0.252733,0.0091934,0.0104287,0.014208,0.00567532,0.0064204,0.00877095,0.000641517,0.000753186,0.000991435,0.000871698,0.000987097,0.00134717,0.00660381,0.00747579,0.0102059,0.000647237,0.000732052,0.00100028,0.00469885,0.00531518,0.00726185,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.00945511,0.0107248,0.0146124,0.0107938,0.0122116,0.0166814,0.00121155,0.00139813,0.00187239,0.000900844,0.00102007,0.00139221,0.00536173,0.00607046,0.00828631,0.000864462,0.000977826,0.00133599,0.00678481,0.00767531,0.0104856,0.751528,0.905878,1.15289,-0.0280379,-0.0321332,-0.049432,0.00375796,0.00445846,0.00847661,0.0564895,0.0642455,0.0922434,0.01685,0.0192797,0.0288311,0.00140249,0.00164738,0.00305523,0.00350978,0.00399097,0.00565992,-0.00117689,-0.00136764,-0.0023512,-0.0128261,-0.0144728,-0.0192246,0.695336,0.837426,1.08271,0.0308742,0.0368234,0.055224,0.033174,0.0375408,0.03591,-0.104026,-0.121797,-0.147061,0.0146549,0.0173656,0.0244975,-0.00727788,-0.00791685,-0.0056617,0.0120507,0.0138782,0.0153342,0.0123751,0.0140502,0.0137217,-0.0211581,-0.0245563,-0.0257718,0.877124,1.02161,1.16481,-0.0684846,-0.0650189,0.0251456,0.0096301,0.0138409,0.0262876,0.0485916,0.0610279,0.0370116,-0.0156082,-0.0177392,-0.00665419,-0.00264647,-0.00342661,-0.00611495,-0.00461286,-0.00314202,0.00624165,-0.00277253,-0.00332328,-0.00339605,-0.0155121,-0.0190861,-0.0101088,0.91486,1.06989,1.19793,-0.0851337,-0.0845644,0.02115,0.00901208,0.0133143,0.0266004,0.0243628,0.0268754,0.0128542,-0.00675792,-0.00750487,-0.00502111,-0.00406886,-0.00512902,-0.00839534,-0.00918973,-0.00858381,0.00302648,-0.00125849,-0.00137378,-0.00105449,-0.0148914,-0.0178989,-0.0092571,0.953136,1.11033,1.23406,-0.100694,-0.100172,0.0110752,-0.00527114,0.00022744,0.0167638,-0.00209644,-0.00622579,-0.0071255,0.00177008,0.00338115,0.00390325,0.00156287,0.000339934,-0.00361396,-0.0105916,-0.0105381,0.00081086,0.00647031,0.00883374,0.00597584,-0.0110174,-0.0137496,-0.00613509,0.988172,1.13728,1.26008,-0.10505,-0.0991978,0.0128321,-0.0331341,-0.0200358,0.00112783,-0.0304282,-0.036114,-0.0342535,0.00351721,0.00552477,0.00567639,0.00506319,0.000445131,-0.00444959,-0.00806675,-0.0101662,-0.000817681,0.0154816,0.0185283,0.0166877,-0.00251635,-0.00405367,0.00490305,0.944056,1.0922,1.23312,-0.0922936,-0.085015,0.0200408,-0.00899499,0.00706017,0.0239636,-0.0218138,-0.020836,-0.0000722143,0.00646877,0.00612676,0.000582521,0.000420311,-0.0051952,-0.00955475,-0.00840949,-0.012898,-0.00487024,0.00369612,0.00322544,0.000808726,-0.0113631,-0.0111548,0.00235255,0.863897,1.01873,1.2434,-0.0286589,-0.025542,0.00994951,-0.000115797,0.00755906,0.0158063,-0.0341589,-0.0281363,0.0146362,0.0148235,0.0134276,-0.00398204,-0.000603064,-0.00265636,-0.00475719,-0.00596523,-0.00733859,-0.00198121,0.000324777,-0.00308022,-0.00625096,0.00221806,0.000978004,-0.00230261,0.801064,0.957013,1.21371,0.0132136,0.0188958,0.0376622,0.0150169,0.0176719,0.0223798,-0.00692051,-0.0115019,-0.0294645,0.00280356,0.00492909,0.0129876,-0.00717696,-0.00834586,-0.0102222,0.000731553,0.00150048,0.00619813,0.00493368,0.00584414,0.00767243,0.0032895,0.00385793,0.00393073,0.912074,1.06857,1.28606,-0.0740565,-0.0690693,-0.0141793,-0.0413218,-0.0378098,-0.0217234,0.00544679,0.00495039,-0.0205431,-0.00240233,-0.00283428,0.00943565,0.0201095,0.0186916,0.0112198,0.000743638,0.00105727,0.0094167,0.000666506,0.00151681,0.00513208,-0.0151773,-0.0148513,-0.0043675,0.882884,1.03664,1.22645,-0.0514453,-0.0466198,0.0287866,-0.017649,-0.012954,0.0117156,0.0238189,0.0218652,0.00744775,-0.0111645,-0.0110208,-0.00535929,0.00724667,0.00571634,-0.00556024,-0.00638765,-0.00551473,0.00465982,-0.00572083,-0.00474701,-0.0031946,-0.00840912,-0.0101784,0.00221703,0.898186,1.05494,1.24645,-0.0676156,-0.0636747,0.0138878,-0.0196475,-0.0159528,0.00729721,0.0111818,0.010212,0.0084344,-0.00548298,-0.0045947,-0.0033445,0.0101634,0.00850275,-0.00293877,-0.00833373,-0.007559,0.00328909,-0.00347703,-0.00241568,-0.00224135,-0.0137342,-0.0147847,0.0000587122,0.907059,1.05847,1.25414,-0.0762591,-0.0665889,0.00853857,-0.0276272,-0.0183533,0.00593633,-0.00724954,-0.010019,0.00190714,0.00335538,0.00531336,0.000513299,0.0142605,0.00904357,-0.0027387,-0.00812971,-0.00883234,0.00100745,0.000631304,0.00193804,-0.000464372,-0.0170317,-0.0148846,0.00101726,0.899372,1.0509,1.25916,-0.0674725,-0.0572437,0.00680962,-0.0241002,-0.0154133,0.00027373,-0.0251604,-0.023038,-0.000284962,0.012646,0.0117727,0.0014574,0.011997,0.00680489,-0.000699143,-0.00670065,-0.00692882,0.0030167,0.00567654,0.00459235,0.00132002,-0.0140124,-0.0113872,0.0017522,0.870105,1.02548,1.2561,-0.0366427,-0.0309832,0.00887319,-0.0159666,-0.0109508,0.00201017,-0.0336542,-0.0283596,0.00338349,0.0163688,0.0140592,-0.00116871,0.00749481,0.00503139,-0.00104936,-0.00555684,-0.00525644,0.0019108,0.0065933,0.00451922,-0.0000765998,-0.00108742,-0.000951656,0.00253503,0.789868,0.949537,1.21631,-0.00911252,-0.0104758,-0.0165453,0.0241234,0.0274545,0.0392661,-0.0181919,-0.0208268,-0.0317287,-0.00366167,-0.00420053,-0.00692165,0.00528928,0.00604637,0.00908243,-0.00492692,-0.00552825,-0.00698758,0.0095642,0.0108941,0.0158683,-0.00355553,-0.00406198,-0.00605875,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.75425,0.908644,1.15245,-0.0228776,-0.0264855,-0.0442923,0.0518791,0.0592863,0.0885259,0.00131852,0.00143235,0.00116621,0.000369316,0.000447251,0.000601101,0.0136702,0.0157593,0.0254614,-0.010215,-0.011544,-0.0156455,0.000868765,0.000974867,0.0012263,-0.00694381,-0.00782933,-0.0103106,0.758728,0.913711,1.15937,-0.0225948,-0.0261656,-0.0438552,0.0493339,0.0564066,0.0845925,0.00581088,0.00651513,0.00810895,0.000575321,0.000680332,0.000919473,0.0135535,0.0156273,0.025281,-0.010557,-0.0119309,-0.016174,-0.000985346,-0.00112293,-0.00163915,-0.00531401,-0.00598533,-0.00779178,0.755849,0.91041,1.15562,-0.0226727,-0.0262549,-0.0439569,0.0523576,0.0598737,0.0885384,0.00719001,0.00809654,0.00990879,0.000602426,0.000711411,0.000954845,0.0136129,0.0156954,0.0253585,-0.0117495,-0.0132983,-0.0177302,-0.00203722,-0.00232907,-0.00301189,-0.00555313,-0.00625952,-0.00810385,0.796241,0.956665,1.22493,-0.0068611,-0.00796482,-0.0136065,0.0152788,0.0176076,0.027977,0.0179561,0.0205238,0.0308504,0.00392171,0.00455279,0.00737316,0.00355315,0.00412452,0.00703021,-0.000793993,-0.000942731,-0.00194683,-0.007531,-0.00862594,-0.0131979,-0.00471064,-0.00533534,-0.00734516,0.810671,0.9705,1.2309,0.00230774,0.0035619,0.0153705,0.0113564,0.0148536,0.0281815,0.0000261672,-0.00205918,-0.0186128,0.000173623,0.000707025,0.0068509,-0.00210021,-0.00274359,-0.00723294,-0.00570316,-0.00660273,-0.00598361,0.00188374,0.00311903,0.00969843,0.00160369,0.00147089,-0.000489016,0.851496,1.01076,1.23803,-0.0198486,-0.0187504,0.0171311,-0.0242301,-0.0203952,0.0170042,0.0033784,0.00334097,-0.00939571,-0.000553066,-0.000402888,0.00407701,0.00990815,0.00949257,-0.00634728,0.00348777,0.00259674,0.000215638,-0.00243173,-0.00272841,0.00258347,-0.00374276,-0.00400345,-0.000366706,0.86431,1.02369,1.24052,-0.0276295,-0.0268353,0.0135241,-0.0339443,-0.0306862,0.0153175,0.00921155,0.00821092,0.000581694,-0.0000475147,0.000412101,0.00328457,0.0148959,0.0146892,-0.00392417,0.00455744,0.00420803,0.000168181,-0.00557249,-0.00522193,-0.00288633,-0.00152255,-0.00242483,0.0000476273,0.86978,1.03018,1.24099,-0.0291664,-0.0285757,0.0132993,-0.0378841,-0.0352322,0.0148327,-0.00293681,-0.00419331,-0.00685286,0.00185436,0.00234016,0.00421894,0.0156146,0.0154856,-0.00380518,0.00512249,0.0046417,0.000163596,0.000904187,0.00149173,0.00189669,-0.000445809,-0.00102386,0.0000143418,0.875709,1.0358,1.2533,-0.0294543,-0.0285464,0.011731,-0.0469037,-0.0433947,0.00254374,-0.00681098,-0.00749945,-0.00432852,0.00260773,0.00309396,0.00391281,0.0163641,0.0159229,-0.00273635,0.0105257,0.00929809,0.00475459,0.00226914,0.00269874,0.000749171,-0.00157446,-0.00172881,0.00120342,0.86098,1.01799,1.24046,-0.0243427,-0.0226503,0.0146166,-0.0331145,-0.0262667,0.0167977,-0.0115728,-0.0113697,-0.00309225,0.00422961,0.00453422,0.00360396,0.0131573,0.0121329,-0.00502543,0.00613397,0.00346769,-0.00158971,0.00477561,0.00447611,-0.000173306,-0.00231652,-0.00242758,0.00131404,0.846173,1.0062,1.26434,-0.00969531,-0.00884849,0.00227676,-0.0166774,-0.0129655,0.00441221,-0.0224543,-0.0204405,-0.00307156,0.00536066,0.00518383,-0.0000022086,0.0044124,0.00375427,-0.00167365,-0.0004839,-0.00165263,-0.00300421,0.00981069,0.00845144,0.000377497,0.00506132,0.004663,0.00203809,0.821468,0.980117,1.24193,0.00298811,0.00602617,0.0196807,0.00225578,0.00518339,0.016166,0.0102584,0.00690256,-0.00745617,-0.00266511,-0.00151252,0.004697,-0.00296691,-0.00428599,-0.00911382,-0.00230023,-0.00194187,-0.000226552,-0.00271811,-0.00153836,0.00341521,0.00575563,0.00550131,0.00502971,0.862897,1.02408,1.26142,-0.0336285,-0.0325215,0.0021291,-0.0269994,-0.0254681,0.00132177,0.00978804,0.00880725,-0.00654088,-0.00408357,-0.0040218,0.00242431,0.0139969,0.0134724,-0.000268068,0.00034865,0.000525963,0.00160136,-0.00348023,-0.0033488,0.00262763,-0.00616212,-0.00670878,-0.000979832,0.870092,1.03275,1.26089,-0.0383655,-0.0381292,0.00428608,-0.0311363,-0.0302113,0.00244691,0.0047874,0.00629419,0.00122913,-0.00198377,-0.00244111,-0.000504493,0.015349,0.0151998,-0.00160393,0.000317928,0.000245612,0.00105968,-0.00143026,-0.00214413,0.00000493385,-0.0068378,-0.00721979,0.000273647,0.879958,1.03786,1.25926,-0.0446263,-0.0421809,0.00398593,-0.0362355,-0.0310928,0.00359163,0.00161115,0.000444121,0.00150944,-0.0000880058,0.000601692,0.0000878106,0.0176923,0.0160232,-0.00161248,-0.000228465,-0.00131053,0.00089924,-0.00173354,-0.000735432,0.000155206,-0.00618544,-0.00674788,-0.000655871,0.863949,1.02182,1.25183,-0.0358987,-0.0327076,0.00853402,-0.0245211,-0.0188141,0.011031,-0.00900985,-0.00911438,0.0017813,0.00452902,0.00479628,0.000362512,0.0133438,0.0110096,-0.00483938,-0.00179453,-0.00350896,-0.00150763,0.00261201,0.00285737,-0.000164386,-0.00652501,-0.00617361,0.000650005,0.859522,1.01651,1.25595,-0.0315602,-0.0278863,0.00589069,-0.0231244,-0.0167404,0.00749477,-0.013986,-0.0122725,0.0038006,0.0073597,0.00683745,-0.000605512,0.0122038,0.00961937,-0.00319946,-0.000699175,-0.00250754,-0.000714679,0.0045953,0.00366231,-0.00142353,-0.00565166,-0.00532555,0.00029033,0.846839,1.00918,1.2593,-0.0200197,-0.0192563,0.00376689,-0.0128674,-0.0113459,0.0053999,-0.0175228,-0.0169074,0.00323455,0.00842656,0.00827265,-0.000726324,0.00680173,0.00620661,-0.00207971,-0.00284099,-0.0032521,-0.000642953,0.00524263,0.00476047,-0.0016963,-0.000856329,-0.000812317,0.000127704]
+ "irradiance": [0.787525,0.947183,1.21709,-0.0128871,-0.0145809,-0.0199165,-0.0216912,-0.024515,-0.0335227,-0.0226589,-0.0256378,-0.0350183,-0.00620364,-0.00699162,-0.00958744,-0.00623858,-0.00705768,-0.00964144,-0.00212922,-0.00240502,-0.00329061,-0.0105509,-0.0119378,-0.0163059,-0.00414027,-0.00468563,-0.00639859,0.738265,0.891448,1.14096,-0.0415297,-0.0469878,-0.0641822,-0.0613031,-0.0693331,-0.0947412,-0.00666444,-0.00754116,-0.0102996,-0.000164008,-0.000158209,-0.000253468,-0.0219174,-0.0247971,-0.0338723,-0.00980345,-0.0110879,-0.0151508,-0.00276039,-0.00312344,-0.00426606,-0.00145615,-0.00164875,-0.0022504,0.729309,0.881314,1.12712,-0.0423377,-0.047902,-0.0654308,-0.0694891,-0.0785949,-0.107392,-0.00111113,-0.00125799,-0.00171721,0.000277233,0.000341024,0.000428451,-0.0223998,-0.0253429,-0.0346179,-0.012195,-0.0137937,-0.0188468,0.000610242,0.000690194,0.0009431,-0.00289992,-0.00328227,-0.00448168,0.730707,0.882808,1.12998,-0.0422219,-0.0477847,-0.0651816,-0.0681888,-0.0772125,-0.104719,-0.000105739,-0.000157315,0.00028999,0.000345285,0.000414414,0.000566514,-0.0223234,-0.0252667,-0.0344513,-0.0118302,-0.0134136,-0.0180826,0.00130522,0.00145183,0.00232894,-0.00266381,-0.0030229,-0.00401197,0.72871,0.880371,1.12656,-0.042488,-0.0481302,-0.0655913,-0.0700922,-0.0795621,-0.107909,-0.000917724,-0.00100318,-0.00141457,0.000312197,0.000387325,0.00048253,-0.0225097,-0.0255122,-0.034729,-0.0124137,-0.0141612,-0.0189932,0.000737173,0.000856444,0.00114404,-0.00293781,-0.0033316,-0.00454241,0.733278,0.885576,1.13353,-0.0419621,-0.047508,-0.0648129,-0.0656175,-0.0743816,-0.101206,0.00226046,0.00275908,0.0032482,0.00053198,0.000649137,0.000798054,-0.0221305,-0.0250547,-0.0341818,-0.0109466,-0.0123941,-0.016902,0.00285925,0.00334212,0.00428876,-0.00236481,-0.00274025,-0.00357782,0.790954,0.950547,1.22174,-0.00960914,-0.0109881,-0.0149956,-0.0201508,-0.0228443,-0.0312323,0.0199909,0.0231963,0.0316186,0.00565002,0.00651476,0.00885036,-0.00446563,-0.00506353,-0.0069162,-0.00271103,-0.00292566,-0.00401773,0.00975895,0.0111002,0.0151556,-0.00394222,-0.00468825,-0.00637588,0.800498,0.959564,1.21963,0.00644706,0.008211,0.0191193,-0.022796,-0.0271337,-0.0408272,-0.00119756,-0.00315519,-0.0193011,0.000040834,0.000592715,0.00593887,0.00555764,0.00664348,0.0113348,-0.0101426,-0.0114591,-0.0114747,-0.00492963,-0.00625834,-0.0121216,0.00339572,0.00346775,0.000937562,0.860871,1.01938,1.24144,-0.0272274,-0.0267538,0.00751219,0.0300575,0.0255756,-0.0176981,0.0249137,0.0250348,0.0119226,-0.00560589,-0.00568009,-0.00224824,-0.0138035,-0.0135731,0.00301931,0.00308987,0.00200317,-0.0030293,0.0108666,0.0109266,0.00605532,-0.00242782,-0.00338041,-0.00243581,0.862349,1.02183,1.23466,-0.0322227,-0.0320379,0.00582689,0.0275135,0.0239846,-0.0242201,-0.00537591,-0.00596647,-0.00850743,0.00162107,0.00191565,0.00185988,-0.0150153,-0.0148553,0.00306701,0.00103957,0.000379819,-0.00421849,-0.00426181,-0.00476225,-0.00560898,-0.00292707,-0.00395712,-0.00509123,0.88751,1.04669,1.25697,-0.0338026,-0.0335294,0.00483955,0.0479799,0.0438554,-0.00579573,-0.0260166,-0.0260075,-0.0229529,0.0043234,0.00465394,0.00392388,-0.0157185,-0.0154217,0.00267941,0.0043364,0.00316006,-0.00131731,-0.0172908,-0.0174812,-0.0152821,0.00321578,0.00231392,0.000262888,0.860906,1.02005,1.24154,-0.0291718,-0.0285755,0.00781472,0.0279506,0.0234507,-0.0185361,0.00188057,0.00324109,0.00620558,0.000174754,0.000126678,-0.000234615,-0.0129673,-0.0123648,0.00479953,0.00152831,-0.00016023,-0.00367055,0.000477666,0.000930851,0.0014656,-0.00311585,-0.00372689,-0.00314294,0.852004,1.01337,1.24106,-0.028092,-0.0280754,0.00567179,0.0203721,0.0180982,-0.0200936,-0.00189919,-0.000409201,0.0121622,0.00259356,0.00257306,-0.000565682,-0.0127473,-0.0125429,0.00392074,-0.00138562,-0.00226722,-0.0055742,0.000623175,0.00136291,0.00549433,-0.00420041,-0.00468323,-0.00303971,0.837733,1.00022,1.25399,-0.010854,-0.0107294,0.00332398,0.0114332,0.0104302,-0.00919021,-0.0125045,-0.0115853,0.00701999,0.00563715,0.00570464,-0.000606739,-0.0044717,-0.00430582,0.00227023,-0.000358609,-0.000615237,-0.00239533,-0.00414434,-0.00367076,0.00379269,0.00128043,0.000988809,-0.00141113,0.822954,0.98456,1.24419,-0.00418009,-0.0028449,0.0134422,-0.00377807,-0.0056525,-0.0174684,0.00797475,0.00737909,-0.00648875,-0.00309925,-0.00273475,0.00377749,0.00165074,0.00249458,0.00774289,-0.00530499,-0.00581176,-0.00421836,0.00191516,0.00155919,-0.00347615,0.0011147,0.00136022,0.00236153,0.854914,1.01683,1.25791,-0.0321192,-0.0312452,0.00329404,0.0195864,0.0181533,-0.00371789,0.00197168,0.00163837,-0.0085014,-0.00108477,-0.00103021,0.00347402,-0.011243,-0.0106459,0.00121958,-0.00178347,-0.00201649,0.000402512,0.000657756,0.000603049,-0.00364101,-0.00869065,-0.00887022,-0.00134258,0.854747,1.01285,1.24118,-0.0294049,-0.0267369,0.0158184,0.0187656,0.0150889,-0.0161215,0.0037868,0.00201416,-0.0026566,0.000263157,0.000864865,0.00225349,-0.00986281,-0.0085635,0.00746986,-0.00211248,-0.00213961,-0.000844576,0.000703419,-0.0000409559,-0.00157562,-0.00617271,-0.00698804,0.000921678,0.849948,1.01008,1.2403,-0.0229279,-0.0206988,0.0206733,0.0138419,0.011115,-0.0184278,-0.0118924,-0.0124476,-0.0111024,0.00447526,0.00487669,0.00408064,-0.00584611,-0.00456812,0.0106753,-0.00357365,-0.0038708,-0.00225329,-0.00635533,-0.0068051,-0.00607938,-0.00224009,-0.00213042,0.00528326,0.858124,1.017,1.24561,-0.0314371,-0.0289926,0.0131094,0.0220573,0.0184529,-0.0130411,-0.00115652,-0.0018715,0.00287353,0.00121966,0.00176101,0.0000875829,-0.0108611,-0.00939934,0.00664003,-0.00147665,-0.00191584,-0.000877438,-0.000364811,-0.0011843,0.0000261559,-0.00615871,-0.0065558,0.0011342,0.855363,1.01206,1.24357,-0.0289972,-0.0254601,0.0146203,0.0179333,0.010986,-0.0171108,-0.011662,-0.0111853,0.00137111,0.00553361,0.00554909,0.000663616,-0.00865102,-0.00598065,0.00863058,-0.00282911,-0.0051659,-0.00314004,-0.00419779,-0.00399892,0.0000983564,-0.00523437,-0.00485754,0.00236352,0.835127,0.993163,1.24984,-0.0129034,-0.0100217,0.00941044,0.00532719,0.000906738,-0.0120506,-0.0109295,-0.00740021,0.00738043,0.00566318,0.00451567,-0.00230639,-0.00275676,-0.00105727,0.00556438,-0.00359933,-0.00425901,-0.00211844,-0.00265412,-0.000813343,0.00408228,-0.00100431,-0.00139677,0.000645711,0.729509,0.881399,1.12839,-0.0467424,-0.0530276,-0.0712735,-0.00356342,-0.00403267,-0.00531706,-0.0666252,-0.075459,-0.102446,-0.0236764,-0.0268164,-0.0362123,-0.000963635,-0.00110976,-0.00135106,0.00324216,0.00370843,0.00476489,-0.00185991,-0.00211556,-0.00279986,-0.00858882,-0.00968229,-0.0135223,0.563616,0.693843,0.871043,-0.163331,-0.184797,-0.252421,-0.00312799,-0.00351208,-0.00483417,-0.00570718,-0.00645809,-0.00882019,-0.000219454,-0.000220942,-0.000339157,-0.000316014,-0.000356715,-0.000488385,0.00451025,0.00510706,0.00697039,-0.00326112,-0.00368997,-0.00503991,0.00737592,0.0083441,0.0113992,0.558189,0.687495,0.862693,-0.164101,-0.185704,-0.253604,-0.00644702,-0.00727783,-0.00996171,-0.00282568,-0.00343343,-0.0043244,0.0000356534,0.0000384371,0.0000604703,-0.000642574,-0.000727317,-0.00099287,0.00451963,0.00517458,0.00697461,-0.00120126,-0.00136814,-0.00185493,0.00570266,0.00635639,0.00883024,0.556418,0.683723,0.864382,-0.167018,-0.190358,-0.256482,-0.00684113,-0.00744186,-0.0117001,0.00829701,0.00817313,0.0170444,0.000436146,-0.000050206,0.00175217,-0.000646604,-0.000608417,-0.00126299,0.00494531,0.00583923,0.00704142,-0.00328745,-0.00361991,-0.00571979,0.00743027,0.00840923,0.0127357,0.636202,0.773727,1.01852,-0.107938,-0.123673,-0.142421,-0.00873854,-0.00977028,-0.0150059,-0.000951478,-0.000963839,-0.00329603,-0.00020291,-0.000184486,-0.000601835,-0.00120158,-0.00134282,-0.00212771,0.00195993,0.00231153,0.00157805,-0.00225331,-0.00254749,-0.00354334,-0.000294205,-0.000213799,-0.00235455,0.564091,0.694089,0.872507,-0.163334,-0.18487,-0.25236,-0.0012593,-0.00141044,-0.00212137,0.0107621,0.0124973,0.0158129,0.00137096,0.00163216,0.0020655,-0.00027098,-0.000307812,-0.000428955,0.00526789,0.00603849,0.00796702,0.000554288,0.000638355,0.0009992,0.00712257,0.00793546,0.0113389,0.752697,0.907175,1.15645,-0.0276135,-0.0316344,-0.0483254,0.00192,0.00228869,0.00374418,0.0567952,0.0647225,0.0922712,0.0168116,0.0192403,0.0286925,0.0010311,0.00120527,0.00212307,0.00454369,0.00524966,0.0080726,-0.000970871,-0.0011425,-0.00170238,-0.0131332,-0.014885,-0.0196908,0.674555,0.815024,1.06506,0.0495696,0.0574047,0.0732287,-0.0217849,-0.0252712,-0.0300659,-0.109856,-0.127845,-0.149824,0.0207393,0.024107,0.0302933,0.00523577,0.00607406,0.00741895,0.00786213,0.00923883,0.0105487,-0.00607644,-0.00709569,-0.00812058,-0.017887,-0.0209324,-0.0222696,0.883545,1.02875,1.18087,-0.0686548,-0.0644379,0.0286695,-0.004729,-0.0086985,-0.0175623,0.0314977,0.0439847,0.0323613,-0.00758831,-0.00886961,-0.000510295,0.00214174,0.00294573,0.00455068,-0.00196329,-0.00050429,0.00711626,-0.00139518,-0.00101841,-0.000853916,-0.021803,-0.0258391,-0.0137626,0.907388,1.06154,1.19701,-0.0801457,-0.0786195,0.026563,0.0166388,0.0158602,0.00164404,-0.0130507,-0.013327,-0.0173772,0.00339079,0.00365292,0.00407705,-0.00488196,-0.00480669,-0.000807286,-0.000333676,0.00137175,0.0109029,0.0100046,0.0122669,0.0101408,-0.0203857,-0.0238545,-0.0131975,0.907382,1.05138,1.1772,-0.0804499,-0.0781001,0.0239309,0.0231253,0.022569,0.00663867,0.0237574,0.029111,0.0300727,-0.00309681,-0.00190998,0.0019186,-0.0059568,-0.0047665,0.00200542,-0.00408181,-0.00326542,0.00687542,-0.00985084,-0.0158604,-0.0181134,-0.015413,-0.0191222,-0.0113969,0.945707,1.09109,1.23363,-0.100328,-0.0909026,0.00615641,-0.00416417,-0.0180951,-0.0337689,-0.0277022,-0.0312447,-0.0254531,0.0131783,0.0139428,0.0141753,0.00464819,0.00931988,0.0134087,-0.0127299,-0.0151942,-0.0077453,-0.00591935,-0.00907067,-0.0100264,-0.0155276,-0.0153846,-0.00906503,0.906882,1.05086,1.19709,-0.0620061,-0.0531249,0.0456679,-0.015837,-0.0346715,-0.0475522,-0.0227531,-0.0204182,0.00330498,0.00812815,0.00758906,0.001696,0.0150274,0.0212729,0.0228551,-0.00779932,-0.0128518,-0.00553187,-0.000441054,0.000438,0.000802626,-0.00499337,-0.00493099,0.00686785,0.850226,1.009,1.23215,-0.0235833,-0.0219351,0.0143695,-0.0109869,-0.015063,-0.0187087,-0.0204038,-0.0165888,0.026714,0.0106352,0.00983902,-0.00739607,0.0036441,0.00480044,0.00563833,-0.00439129,-0.00479039,0.000497885,0.0077172,0.00980611,0.0104849,-0.00122392,-0.00214403,-0.00552252,0.835638,0.99072,1.24579,0.00265753,0.00882108,0.0266447,0.00971133,0.00788933,0.00290127,0.0316135,0.025865,0.00455376,-0.00887405,-0.00648754,0.00220626,-0.00325766,-0.00245231,-0.000926017,-0.00474045,-0.00319845,0.00157449,0.00774244,0.0068163,0.00394381,0.0173379,0.0175245,0.0156443,0.897285,1.05734,1.27082,-0.0664915,-0.0632237,-0.00350519,0.0150273,0.0143125,-0.000947217,0.0152207,0.0176816,-0.00927399,-0.00606151,-0.00748427,0.00587065,-0.00718684,-0.00683062,0.000739172,-0.009919,-0.00964066,-0.000362895,0.00372217,0.00398736,-0.000488986,-0.0122663,-0.0114893,0.000748659,0.893784,1.04899,1.24351,-0.0623369,-0.0575578,0.0176885,0.0242519,0.0223259,-0.000746408,0.0199491,0.0166367,0.00568082,-0.00685881,-0.00561326,-0.0016025,-0.0122112,-0.0116986,-0.000344779,-0.00882298,-0.00728206,0.00337885,0.00486313,0.00410035,0.00141105,-0.0111877,-0.0127677,0.00216461,0.899891,1.05486,1.2508,-0.0650875,-0.0589378,0.0149049,0.0274116,0.0256954,0.00153034,0.00133992,0.00027329,-0.00188881,-0.00101387,-0.000228716,0.00134515,-0.012759,-0.0120979,0.0000314,-0.00776352,-0.00597154,0.00376569,-0.00180571,-0.00291958,-0.00194817,-0.0102448,-0.0106831,0.00359506,0.89108,1.04076,1.23956,-0.0644385,-0.0538903,0.017954,0.0191789,0.0113601,-0.0109856,-0.00604845,-0.00818555,0.000130935,0.00553083,0.0072146,0.00386011,-0.00826959,-0.00396998,0.00663778,-0.00693675,-0.00628245,0.00285196,-0.00143075,-0.00321478,-0.00156011,-0.0164009,-0.0150334,-0.000255639,0.897823,1.04435,1.24926,-0.0661386,-0.0514116,0.0156786,0.0252961,0.0136438,-0.00541765,-0.0181555,-0.0168046,0.00340015,0.00818098,0.00739856,-0.00154792,-0.0126078,-0.00551662,0.00396364,-0.00678885,-0.00698822,0.00242848,-0.00281214,-0.00236091,0.000651795,-0.0132002,-0.00932623,0.00474058,0.864486,1.02012,1.25346,-0.0350868,-0.0293262,0.00978135,0.0141562,0.0101815,-0.00134955,-0.0276688,-0.0221489,0.00626477,0.0149559,0.0124313,-0.00185176,-0.00643675,-0.00423084,0.00110793,-0.00483596,-0.00397906,0.00262639,-0.00559889,-0.00378337,0.00073632,-0.003177,-0.00309594,0.00158166,0.72053,0.871234,1.11451,-0.0475521,-0.0539442,-0.072525,0.00408972,0.00462909,0.0065097,-0.0718517,-0.0813773,-0.110522,-0.0239441,-0.0271195,-0.0366261,-0.000412469,-0.000486045,-0.000499316,0.00119227,0.00138952,0.00159679,0.000590996,0.000659491,0.00098732,-0.0102455,-0.0115585,-0.0160822,0.554043,0.682762,0.856505,-0.164178,-0.185771,-0.253713,0.00486246,0.00567046,0.00736907,-0.0115287,-0.0132953,-0.0175601,-0.000514353,-0.000566084,-0.00078312,0.000250663,0.000290947,0.000380709,0.00250558,0.00285799,0.00385269,-0.000564506,-0.000535575,-0.000978515,0.00550317,0.00613435,0.00859816,0.549883,0.678136,0.850139,-0.164764,-0.186429,-0.254615,0.00141022,0.00171929,0.00199814,-0.00725001,-0.00837437,-0.0108846,-0.000110668,-0.000105685,-0.00015636,-0.0000790722,-0.0000841975,-0.000130516,0.00223036,0.00254053,0.00342256,0.00140334,0.00165797,0.00203674,0.00437827,0.00489055,0.00688251,0.545507,0.673312,0.843066,-0.16514,-0.186851,-0.255215,0.00259318,0.00300347,0.00399883,-0.00201245,-0.00229686,-0.00310629,0.000187179,0.000236477,0.00028981,0.00000358028,0.00000971133,0.00000454124,0.00320082,0.0036102,0.00494995,0.000395478,0.000459861,0.000608633,0.00243025,0.00274446,0.00375662,0.549686,0.677862,0.849849,-0.164907,-0.186611,-0.254816,0.000379343,0.000699523,0.000208761,0.0026304,0.00297089,0.00411154,0.000416818,0.0004999,0.000647846,-0.000073289,-0.0000576319,-0.000146185,0.00271013,0.00296216,0.00436443,-0.00154956,-0.0017457,-0.00243399,0.00405615,0.00458275,0.00627093,0.559088,0.68871,0.864048,-0.163703,-0.18522,-0.252995,0.00439774,0.00501152,0.00679482,0.0106475,0.0120547,0.0164536,0.0011909,0.00137585,0.00184028,0.000204575,0.000233385,0.00031595,0.00295751,0.00334878,0.00457098,0.000687408,0.000772403,0.00106334,0.00682936,0.00772332,0.0105549,0.751503,0.905845,1.15286,-0.0280399,-0.0321359,-0.049435,0.00376431,0.00446702,0.00848615,0.0565171,0.0642827,0.0922848,0.0168516,0.0192819,0.0288335,0.00140286,0.00164789,0.0030558,0.00351562,0.00399884,0.00566869,-0.00118207,-0.00137462,-0.00235897,-0.0128373,-0.0144879,-0.0192414,0.66063,0.79867,1.04636,0.0520614,0.0603918,0.0766293,0.000309106,0.000561037,-0.000549619,-0.118535,-0.138012,-0.161404,0.0214998,0.02502,0.0313314,0.0032567,0.00372724,0.00471288,0.00451941,0.0053238,0.00602131,0.00160138,0.00187596,0.00211849,-0.019328,-0.0226004,-0.0241777,0.9017,1.04256,1.18408,-0.0729311,-0.0679613,0.0281244,-0.0202786,-0.0190215,-0.0241151,0.0699189,0.0831358,0.0682412,-0.0164717,-0.0181805,-0.00828213,-0.00147427,-0.00247697,-0.00136184,-0.00414589,-0.00395112,0.00313507,-0.00896513,-0.00812805,-0.00699286,-0.0131257,-0.0172759,-0.00646157,0.990377,1.14293,1.25831,-0.112095,-0.111547,0.00277154,-0.0310692,-0.0286886,-0.0267805,0.00568724,0.00672971,0.000568231,0.00047997,0.000221362,0.00184195,0.00503145,0.00466597,0.00478352,0.000435739,0.0017353,0.0103361,0.0167489,0.0166814,0.0181073,-0.00826697,-0.0130836,-0.00497132,0.943388,1.09394,1.21635,-0.0946893,-0.0915054,0.0202694,0.00445953,0.00936129,0.0054609,-0.0146316,-0.0218428,-0.0134613,0.00823572,0.011589,0.00980028,-0.000989864,-0.00176461,0.000030687,-0.00332771,-0.00183973,0.00729782,-0.00427044,-0.0038221,-0.00378289,-0.0146649,-0.0190147,-0.0100417,0.972634,1.07035,1.19206,-0.124936,-0.0710254,0.0417403,0.00782377,0.00780725,0.00503257,-0.0201063,-0.0377624,-0.0298952,0.00939829,0.017727,0.0158442,-0.00233792,-0.0017079,-0.000648683,-0.00822116,-0.0000422889,0.00904492,-0.00194936,-0.0030476,-0.00209648,-0.0257498,-0.0157091,-0.00658624,1.05129,1.10191,1.22323,-0.170331,-0.0868376,0.0273426,-0.00287092,-0.0035023,-0.00514178,-0.00809715,-0.00656612,0.00591725,0.00198552,0.00180737,-0.000180852,0.00073405,0.00088698,0.00121845,-0.0134096,-0.00808425,0.000651755,0.00182269,0.00184729,0.0022726,-0.0181249,-0.00809011,0.00159574,0.862763,1.00886,1.22881,-0.0242279,-0.0155967,0.0219946,0.00382506,0.00298547,0.000687828,-0.0294913,-0.0132695,0.0303527,0.010474,0.00500245,-0.0123167,-0.000802806,-0.000633561,-0.0000459908,-0.00133052,0.00134656,0.00476882,-0.00184389,-0.0012597,-0.00018693,0.00233677,-0.00140647,-0.00428866,0.802521,0.958428,1.21189,0.0205155,0.0273023,0.0472665,-0.00178076,-0.00166762,0.00197392,0.00595946,0.00278019,-0.0185998,0.000122466,0.002091,0.0114087,-0.000537944,-0.000777996,-0.00251618,-0.00153114,-0.00104326,0.00388962,-0.00259553,-0.00280491,-0.00117331,0.0128128,0.0145349,0.013456,0.90615,1.0626,1.26432,-0.0711845,-0.0659583,0.00195198,-0.00305065,-0.00268392,-0.000922387,0.0145168,0.0139901,-0.0178586,-0.00586138,-0.0063453,0.00889806,-0.000837804,-0.00120591,-0.0015025,-0.0079938,-0.00683992,0.00201149,-0.001554,-0.00176204,-0.000428986,-0.011237,-0.0111375,0.00200094,0.884446,1.04203,1.2244,-0.0625224,-0.0590771,0.0277565,-0.00186661,-0.00162431,-0.0000465102,0.0115241,0.0129685,0.00166629,-0.00583102,-0.00657653,-0.00132088,0.00143527,0.00139638,0.000777222,-0.00491575,-0.00363351,0.007472,0.00144965,0.00171661,0.00245954,-0.0197761,-0.0211114,-0.0030184,0.9142,1.06121,1.23898,-0.0817431,-0.0702858,0.0194275,-0.00581542,-0.00664517,-0.00508237,0.014889,0.00787767,-0.000293702,-0.00659862,-0.00220788,0.00139547,0.00398048,0.00438899,0.00392675,-0.0103503,-0.00624182,0.00646579,0.00414989,0.00410424,0.00485165,-0.0169167,-0.018447,-0.00145447,0.917082,1.06045,1.23844,-0.0875811,-0.0686284,0.0215211,-0.00204503,0.000129995,0.00181737,-0.000800079,-0.00639018,0.00196588,0.00121589,0.00558583,0.00247841,0.00186337,0.000816318,0.00028007,-0.0122811,-0.0072482,0.00504297,-0.00189912,-0.00201309,-0.00208405,-0.0195851,-0.0154328,0.00241354,0.910238,1.04938,1.24767,-0.087322,-0.0615116,0.0133901,0.00314763,0.00359632,-0.00109313,-0.0140161,-0.0110093,0.00923403,0.00921021,0.00746425,-0.00248728,-0.00172386,-0.0020012,0.000528958,-0.0123036,-0.00650741,0.00388243,0.00180144,0.00190434,0.00115478,-0.024939,-0.0163533,0.000595244,0.864367,1.01498,1.24443,-0.037084,-0.0260349,0.0165367,0.00263944,0.00230976,0.00331261,-0.0276968,-0.0187877,0.0125169,0.0162519,0.0113769,-0.00445197,-0.00119607,-0.000814125,-0.00117438,-0.00625271,-0.00308753,0.00486203,-0.00186455,-0.00177291,-0.00147649,-0.00403633,-0.00280219,0.00198018,0.725074,0.876382,1.12152,-0.0470635,-0.0533894,-0.0717842,0.00832833,0.00942228,0.0130582,-0.0688837,-0.0780135,-0.105944,-0.0237157,-0.0268603,-0.0362788,-0.000101161,-0.000133728,-0.0000202226,0.00245645,0.00281908,0.00355428,0.00259516,0.00292515,0.00408413,-0.00957207,-0.0107951,-0.0150382,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.0138529,0.0157006,0.0214091,-0.00780275,-0.00882908,-0.0120588,-0.000249881,-0.000255367,-0.000386179,0.00124164,0.00140566,0.0019189,0.00613283,0.00694291,0.00947802,0.00134433,0.00152077,0.0020776,0.00634808,0.00718118,0.00981068,0.559137,0.688776,0.864122,-0.163452,-0.184934,-0.252608,0.0105819,0.0119997,0.0163539,-0.00384389,-0.00434991,-0.00594055,0.000139135,0.000184776,0.000215026,0.000920217,0.00104199,0.00142215,0.00588196,0.00665907,0.00909031,0.0034442,0.00389662,0.00532286,0.00510713,0.00577713,0.00789285,0.554659,0.68371,0.857201,-0.163816,-0.185346,-0.25317,0.0117386,0.0133084,0.0181414,0.00118296,0.00133761,0.00182821,0.000435512,0.000520105,0.000673063,0.000988412,0.00111915,0.00152755,0.00694578,0.0078627,0.0107344,0.00250135,0.00282985,0.00386572,0.00306904,0.00347117,0.00474305,0.559137,0.688776,0.864122,-0.163533,-0.185026,-0.252733,0.0091934,0.0104287,0.014208,0.00567532,0.0064204,0.00877095,0.000641517,0.000753186,0.000991435,0.000871698,0.000987097,0.00134717,0.00660381,0.00747579,0.0102059,0.000647237,0.000732052,0.00100028,0.00469885,0.00531518,0.00726185,0.563616,0.693843,0.871043,-0.162846,-0.184249,-0.251671,0.00945511,0.0107248,0.0146124,0.0107938,0.0122116,0.0166814,0.00121155,0.00139813,0.00187239,0.000900844,0.00102007,0.00139221,0.00536173,0.00607046,0.00828631,0.000864462,0.000977826,0.00133599,0.00678481,0.00767531,0.0104856,0.751528,0.905878,1.15289,-0.0280379,-0.0321332,-0.049432,0.00375796,0.00445846,0.00847661,0.0564895,0.0642455,0.0922434,0.01685,0.0192797,0.0288311,0.00140249,0.00164738,0.00305523,0.00350978,0.00399097,0.00565992,-0.00117689,-0.00136764,-0.0023512,-0.0128261,-0.0144728,-0.0192246,0.695336,0.837426,1.08271,0.0308742,0.0368234,0.055224,0.033174,0.0375408,0.03591,-0.104026,-0.121797,-0.147061,0.0146549,0.0173656,0.0244975,-0.00727787,-0.00791685,-0.0056617,0.0120507,0.0138782,0.0153342,0.0123752,0.0140502,0.0137217,-0.0211581,-0.0245563,-0.0257718,0.877122,1.02161,1.16481,-0.0684848,-0.0650192,0.0251454,0.00963087,0.0138415,0.0262889,0.0485927,0.0610291,0.0370131,-0.0156077,-0.0177387,-0.00665367,-0.00264643,-0.00342649,-0.00611496,-0.00461262,-0.00314173,0.00624176,-0.00277284,-0.00332364,-0.00339644,-0.0155125,-0.0190865,-0.0101093,0.914859,1.06989,1.19792,-0.0851335,-0.0845644,0.0211499,0.00901242,0.0133142,0.0266001,0.0243643,0.0268769,0.0128557,-0.00675845,-0.00750541,-0.00502173,-0.00406894,-0.00512898,-0.00839518,-0.00918924,-0.00858314,0.00302708,-0.0012591,-0.00137436,-0.00105526,-0.0148917,-0.0178992,-0.00925746,0.953106,1.11029,1.23403,-0.100688,-0.100164,0.0110824,-0.00524365,0.000262615,0.0167953,-0.00207549,-0.00619902,-0.00710178,0.00176693,0.00337713,0.00389967,0.00155879,0.000334709,-0.00361867,-0.0105988,-0.0105472,0.000802635,0.00645651,0.00881611,0.00596021,-0.0110221,-0.0137557,-0.00614045,0.988172,1.13724,1.26004,-0.10505,-0.0991954,0.0128344,-0.0331341,-0.0200122,0.00114992,-0.0304283,-0.0360778,-0.0342195,0.0035172,0.0055231,0.00567482,0.00506318,0.000444042,-0.00445061,-0.00806673,-0.010165,-0.000816562,0.0154816,0.0185117,0.0166722,-0.00251633,-0.00406631,0.00489117,0.944056,1.0922,1.23312,-0.0922936,-0.085015,0.0200408,-0.008995,0.00706016,0.0239635,-0.0218138,-0.020836,-0.0000722097,0.00646877,0.00612676,0.000582518,0.000420313,-0.00519519,-0.00955475,-0.00840949,-0.012898,-0.00487024,0.00369612,0.00322544,0.000808725,-0.0113631,-0.0111548,0.00235255,0.863897,1.01873,1.2434,-0.0286592,-0.0255422,0.00994937,-0.000115661,0.00755919,0.0158064,-0.0341595,-0.0281369,0.0146358,0.0148237,0.0134277,-0.00398191,-0.000603102,-0.0026564,-0.00475722,-0.00596539,-0.00733874,-0.00198132,0.000324671,-0.00308032,-0.00625103,0.00221828,0.000978218,-0.00230245,0.801064,0.957013,1.21371,0.0132136,0.0188958,0.0376621,0.0150168,0.0176718,0.0223797,-0.00692042,-0.0115019,-0.0294644,0.00280353,0.00492906,0.0129875,-0.00717694,-0.00834583,-0.0102222,0.000731549,0.00150048,0.00619812,0.00493363,0.00584408,0.00767239,0.00328953,0.00385796,0.00393075,0.912085,1.06858,1.28607,-0.0740632,-0.0690758,-0.0141858,-0.0413326,-0.0378201,-0.0217337,0.00545191,0.00495543,-0.020538,-0.00240474,-0.00283667,0.00943317,0.0201144,0.0186962,0.0112245,0.000746514,0.00106001,0.00941929,0.000663424,0.00151381,0.00512912,-0.0151781,-0.014852,-0.00436824,0.882912,1.03667,1.22648,-0.0514649,-0.0466451,0.0287647,-0.0176743,-0.0129862,0.0116879,0.0238145,0.0218595,0.00744271,-0.0111623,-0.0110179,-0.00535674,0.00725986,0.00573321,-0.00554573,-0.00638126,-0.00550666,0.0046667,-0.00571804,-0.00474347,-0.00319145,-0.0084139,-0.0101846,0.00221176,0.898185,1.05493,1.24645,-0.0676148,-0.0636739,0.0138885,-0.0196471,-0.0159524,0.00729754,0.0111823,0.0102126,0.00843482,-0.00548332,-0.00459506,-0.0033448,0.0101632,0.00850249,-0.00293899,-0.00833363,-0.0075589,0.00328917,-0.00347719,-0.00241585,-0.00224148,-0.0137341,-0.0147846,0.0000588091,0.907059,1.05847,1.25414,-0.0762589,-0.0665888,0.00853872,-0.027627,-0.0183531,0.00593656,-0.007249,-0.0100185,0.00190778,0.00335528,0.00531325,0.00051317,0.0142605,0.00904354,-0.00273874,-0.00812961,-0.00883224,0.00100756,0.000631153,0.00193789,-0.000464552,-0.0170319,-0.0148848,0.00101702,0.899373,1.05091,1.25916,-0.0674727,-0.057244,0.0068093,-0.0241006,-0.0154137,0.000273299,-0.0251613,-0.023039,-0.000286017,0.0126463,0.0117729,0.00145764,0.011997,0.00680498,-0.000699044,-0.00670079,-0.00692897,0.00301653,0.00567682,0.00459264,0.00132033,-0.0140121,-0.0113869,0.00175256,0.870113,1.02548,1.2561,-0.0366453,-0.0309856,0.008871,-0.0159702,-0.0109542,0.00200707,-0.0336629,-0.0283675,0.00337665,0.0163707,0.0140611,-0.00116708,0.00749559,0.00503211,-0.00104869,-0.00555829,-0.00525774,0.00190971,0.00659602,0.00452175,-0.000074244,-0.00108445,-0.000948982,0.00253733,0.789868,0.949537,1.21631,-0.00911252,-0.0104758,-0.0165453,0.0241234,0.0274545,0.0392661,-0.0181919,-0.0208268,-0.0317287,-0.00366167,-0.00420053,-0.00692165,0.00528928,0.00604637,0.00908243,-0.00492692,-0.00552825,-0.00698758,0.0095642,0.0108941,0.0158683,-0.00355553,-0.00406198,-0.00605875,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.758728,0.913711,1.15937,-0.022514,-0.0260741,-0.0437304,0.0507225,0.0579777,0.0867384,-0.00370833,-0.00425517,-0.00660255,0.0000729396,0.000111922,0.000143064,0.013602,0.0156822,0.025356,-0.0112788,-0.0127476,-0.0172895,0.00181162,0.00204164,0.00268343,-0.00490572,-0.00552338,-0.00716079,0.75425,0.908644,1.15245,-0.0228776,-0.0264855,-0.0442923,0.0518791,0.0592863,0.0885259,0.00131852,0.00143235,0.00116621,0.000369316,0.000447251,0.000601101,0.0136702,0.0157593,0.0254614,-0.010215,-0.011544,-0.0156455,0.000868765,0.000974867,0.0012263,-0.00694381,-0.00782933,-0.0103106,0.758728,0.913711,1.15937,-0.0225948,-0.0261656,-0.0438552,0.0493339,0.0564066,0.0845925,0.00581088,0.00651513,0.00810895,0.000575321,0.000680332,0.000919473,0.0135535,0.0156273,0.025281,-0.010557,-0.0119309,-0.016174,-0.000985346,-0.00112293,-0.00163915,-0.00531401,-0.00598533,-0.00779178,0.755849,0.91041,1.15562,-0.0226727,-0.0262549,-0.0439569,0.0523576,0.0598737,0.0885384,0.00719001,0.00809654,0.00990879,0.000602426,0.000711411,0.000954845,0.0136129,0.0156954,0.0253585,-0.0117495,-0.0132983,-0.0177302,-0.00203722,-0.00232907,-0.00301189,-0.00555313,-0.00625952,-0.00810385,0.796241,0.956665,1.22493,-0.0068611,-0.00796482,-0.0136065,0.0152788,0.0176076,0.027977,0.0179561,0.0205238,0.0308504,0.00392171,0.00455279,0.00737316,0.00355315,0.00412452,0.00703021,-0.000793993,-0.000942731,-0.00194683,-0.007531,-0.00862594,-0.0131979,-0.00471064,-0.00533534,-0.00734516,0.810671,0.9705,1.2309,0.00230774,0.0035619,0.0153705,0.0113564,0.0148536,0.0281815,0.0000261865,-0.00205916,-0.0186128,0.000173618,0.00070702,0.00685089,-0.00210021,-0.00274358,-0.00723293,-0.00570316,-0.00660273,-0.00598362,0.00188373,0.00311903,0.00969842,0.0016037,0.0014709,-0.000489008,0.851495,1.01076,1.23803,-0.0198484,-0.0187502,0.0171313,-0.0242292,-0.0203943,0.0170053,0.00337817,0.00334071,-0.00939601,-0.000553022,-0.000402838,0.00407707,0.00990799,0.00949239,-0.00634749,0.00348742,0.00259634,0.000215179,-0.00243155,-0.0027282,0.00258371,-0.00374277,-0.00400346,-0.000366721,0.864311,1.02369,1.24052,-0.0276295,-0.0268353,0.013524,-0.0339446,-0.0306866,0.0153166,0.00921122,0.0082105,0.00058097,-0.0000475027,0.000412124,0.00328463,0.0148958,0.0146891,-0.00392412,0.00455747,0.00420807,0.000168371,-0.00557228,-0.00522167,-0.00288586,-0.00152245,-0.00242469,0.0000478228,0.869769,1.03016,1.24098,-0.029164,-0.0285731,0.0133017,-0.0378739,-0.0352208,0.014843,-0.00292918,-0.00418479,-0.00684525,0.00185321,0.00233888,0.00421779,0.0156131,0.0154839,-0.00380674,0.00511978,0.00463868,0.000160897,0.000899154,0.00148611,0.00189166,-0.000447518,-0.00102576,0.0000126393,0.875709,1.0358,1.2533,-0.0294543,-0.0285464,0.011731,-0.0469039,-0.0433948,0.00254361,-0.00681109,-0.00749957,-0.00432864,0.00260774,0.00309397,0.00391282,0.0163642,0.0159229,-0.00273634,0.0105258,0.00929811,0.00475462,0.0022692,0.00269881,0.000749243,-0.00157442,-0.00172877,0.00120345,0.86098,1.01799,1.24046,-0.0243427,-0.0226503,0.0146166,-0.0331143,-0.0262664,0.016798,-0.0115725,-0.0113693,-0.00309192,0.00422959,0.0045342,0.00360394,0.0131573,0.0121329,-0.00502544,0.00613398,0.00346771,-0.0015897,0.00477545,0.00447592,-0.000173459,-0.00231665,-0.00242774,0.00131392,0.846192,1.00622,1.26436,-0.0096965,-0.00884964,0.00227569,-0.0166893,-0.0129768,0.00440156,-0.0224725,-0.020458,-0.00308795,0.0053615,0.00518463,-0.00000145749,0.00441294,0.00375479,-0.00167317,-0.000484489,-0.0016532,-0.00300474,0.009819,0.0084594,0.000384973,0.00506768,0.00466911,0.00204382,0.821468,0.980118,1.24193,0.00298807,0.00602613,0.0196806,0.00225569,0.0051833,0.0161659,0.0102585,0.00690266,-0.00745607,-0.00266514,-0.00151255,0.00469698,-0.00296688,-0.00428596,-0.00911379,-0.00230023,-0.00194186,-0.000226548,-0.00271816,-0.00153841,0.00341517,0.00575566,0.00550134,0.00502974,0.862898,1.02408,1.26142,-0.0336287,-0.0325218,0.00212898,-0.027,-0.0254689,0.00132122,0.00978798,0.00880718,-0.00654104,-0.00408353,-0.00402176,0.00242439,0.0139971,0.0134727,-0.000267926,0.000348937,0.000526338,0.00160165,-0.0034802,-0.00334877,0.00262772,-0.00616216,-0.00670884,-0.000979873,0.870091,1.03275,1.26089,-0.0383652,-0.0381289,0.00428638,-0.0311358,-0.0302108,0.0024473,0.00478767,0.00629449,0.00122939,-0.00198388,-0.00244123,-0.0005046,0.0153488,0.0151996,-0.0016041,0.000317848,0.000245527,0.0010596,-0.00143042,-0.00214431,0.00000478028,-0.00683779,-0.00721978,0.000273657,0.879957,1.03785,1.25926,-0.0446258,-0.0421804,0.00398639,-0.0362348,-0.031092,0.00359237,0.00161176,0.00044476,0.0015101,-0.0000882249,0.000601464,0.000087578,0.0176921,0.016023,-0.00161275,-0.000228559,-0.00131063,0.000899154,-0.00173388,-0.000735781,0.000154849,-0.00618551,-0.00674795,-0.000655956,0.863949,1.02182,1.25183,-0.0358987,-0.0327077,0.00853394,-0.0245212,-0.0188143,0.0110309,-0.00900998,-0.00911458,0.00178117,0.00452905,0.00479634,0.000362547,0.0133438,0.0110097,-0.00483936,-0.00179453,-0.00350897,-0.00150764,0.00261206,0.00285746,-0.000164333,-0.00652498,-0.00617356,0.000650038,0.859521,1.01651,1.25595,-0.03156,-0.0278862,0.00589085,-0.0231242,-0.0167402,0.00749497,-0.0139855,-0.012272,0.00380115,0.0073596,0.00683736,-0.000605628,0.0122037,0.00961933,-0.0031995,-0.00069909,-0.00250746,-0.000714578,0.00459517,0.00366218,-0.00142368,-0.00565182,-0.00532572,0.000290142,0.846839,1.00918,1.2593,-0.0200197,-0.0192563,0.00376693,-0.0128674,-0.0113459,0.0053999,-0.0175228,-0.0169074,0.00323457,0.00842655,0.00827265,-0.000726327,0.00680173,0.00620661,-0.00207971,-0.00284099,-0.00325209,-0.000642949,0.00524263,0.00476047,-0.0016963,-0.000856337,-0.000812321,0.000127697]
}
diff --git a/examples/probe-update/assets/scenes/main.esscene b/examples/probe-update/assets/scenes/main.esscene
new file mode 100644
index 000000000..85bc0246e
--- /dev/null
+++ b/examples/probe-update/assets/scenes/main.esscene
@@ -0,0 +1,388 @@
+{
+ "version": 4,
+ "name": "Probe research",
+ "entities": [
+ {
+ "id": 0,
+ "name": "Camera",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.5,
+ "y": 1,
+ "z": 4
+ },
+ "rotation": {
+ "x": -0.103,
+ "y": 0.178,
+ "z": 0.019,
+ "w": 0.978
+ }
+ }
+ },
+ {
+ "type": "Camera",
+ "data": {
+ "projectionType": 0,
+ "fov": 50,
+ "nearPlane": 0.1,
+ "farPlane": 20,
+ "isActive": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 1,
+ "name": "Lamp",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "rotation": {
+ "w": 0.7071067811865475,
+ "x": 0,
+ "y": -0.7071067811865475,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "Light",
+ "data": {
+ "type": 1,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "intensity": 1,
+ "meshShadows": true,
+ "shadowExtent": 8,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 2,
+ "name": "Wall",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 3,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.001,
+ "y": 0.04,
+ "z": 0.04
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "color": {
+ "r": 1,
+ "g": 0.3,
+ "b": 0.1,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 3,
+ "name": "Test cube",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 0.01,
+ "y": 0.01,
+ "z": 0.01
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ }
+ }
+ }
+ ]
+ },
+ {
+ "id": 4,
+ "name": "Occluder",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 1.5,
+ "y": 0,
+ "z": 0
+ },
+ "scale": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "MeshRenderer",
+ "data": {
+ "mesh": "builtin:cube",
+ "lit": true,
+ "opaque": true,
+ "cullBackfaces": true,
+ "enabled": true,
+ "color": {
+ "r": 0.4,
+ "g": 0.4,
+ "b": 0.4,
+ "a": 1
+ }
+ }
+ },
+ {
+ "type": "ProbeOccluder",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 5,
+ "name": "Probe volume",
+ "parent": null,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {
+ "position": {
+ "x": 0,
+ "y": 0,
+ "z": 0
+ }
+ }
+ },
+ {
+ "type": "LightProbeVolume",
+ "data": {
+ "halfExtents": {
+ "x": 1,
+ "y": 1,
+ "z": 1
+ },
+ "spacing": 1,
+ "enabled": true
+ }
+ }
+ ]
+ },
+ {
+ "id": 6,
+ "name": "Canvas",
+ "parent": null,
+ "children": [
+ 7,
+ 8
+ ],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "Canvas",
+ "data": {
+ "designResolution": {
+ "x": 960,
+ "y": 640
+ },
+ "scaleMode": 2,
+ "backgroundColor": {
+ "r": 0,
+ "g": 0,
+ "b": 0,
+ "a": 0
+ }
+ }
+ },
+ {
+ "type": "UINode",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 7,
+ "name": "Status",
+ "parent": 6,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 930,
+ "unit": 0
+ },
+ "height": {
+ "value": 36,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 15,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 12,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "Probe research",
+ "fontSize": 18,
+ "color": {
+ "r": 1,
+ "g": 1,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ },
+ {
+ "type": "ProbeStatus",
+ "data": {}
+ }
+ ]
+ },
+ {
+ "id": 8,
+ "name": "Controls",
+ "parent": 6,
+ "children": [],
+ "visible": true,
+ "components": [
+ {
+ "type": "Transform",
+ "data": {}
+ },
+ {
+ "type": "UINode",
+ "data": {
+ "position": 1,
+ "width": {
+ "value": 930,
+ "unit": 0
+ },
+ "height": {
+ "value": 30,
+ "unit": 0
+ },
+ "insetLeft": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginLeft": {
+ "value": 15,
+ "unit": 0
+ },
+ "insetTop": {
+ "value": 0,
+ "unit": 1
+ },
+ "marginTop": {
+ "value": 48,
+ "unit": 0
+ }
+ }
+ },
+ {
+ "type": "Text",
+ "data": {
+ "content": "L: light | Space: updates | O: occluder | R: cycle | Arrows: camera",
+ "fontSize": 16,
+ "color": {
+ "r": 0.8,
+ "g": 0.9,
+ "b": 1,
+ "a": 1
+ },
+ "align": 1,
+ "verticalAlign": 1
+ }
+ }
+ ]
+ }
+ ]
+}
diff --git a/examples/probe-update/assets/scenes/main.esscene.meta b/examples/probe-update/assets/scenes/main.esscene.meta
new file mode 100644
index 000000000..27e72eca0
--- /dev/null
+++ b/examples/probe-update/assets/scenes/main.esscene.meta
@@ -0,0 +1,6 @@
+{
+ "uuid": "6adcc6bc-f8ce-4aa0-87fc-8e6be34682bb",
+ "version": "2.0",
+ "type": "scene",
+ "importer": {}
+}
diff --git a/examples/probe-update/project.esproject b/examples/probe-update/project.esproject
new file mode 100644
index 000000000..29e10bbe0
--- /dev/null
+++ b/examples/probe-update/project.esproject
@@ -0,0 +1,11 @@
+{
+ "formatVersion": "1",
+ "name": "Probe Update Research",
+ "description": "Experimental SH updates: one fresh probe solve per frame in a small proxy scene.",
+ "tag": "3D",
+ "version": "0.1.0",
+ "defaultScene": "assets/scenes/main.esscene",
+ "designResolution": { "width": 960, "height": 640 },
+ "spineVersion": "none",
+ "features": { "rendering": { "backend": "webgpu" } }
+}
diff --git a/examples/probe-update/src/components.ts b/examples/probe-update/src/components.ts
new file mode 100644
index 000000000..b2454689b
--- /dev/null
+++ b/examples/probe-update/src/components.ts
@@ -0,0 +1,6 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { defineTag } from 'esengine';
+
+export const ProbeStatus = defineTag('ProbeStatus');
+export const ProbeOccluder = defineTag('ProbeOccluder');
diff --git a/examples/probe-update/src/main.ts b/examples/probe-update/src/main.ts
new file mode 100644
index 000000000..fd58b6564
--- /dev/null
+++ b/examples/probe-update/src/main.ts
@@ -0,0 +1,160 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import {
+ addPlugin, bakeLightmap, Camera, defineSystem, Input, Light, LightProbeVolume,
+ MeshChannel, MeshChannelType, Mut, Query, Res, Text, Time, Transform, unwrapLightmapUV,
+ type BakeSurface,
+} from 'esengine';
+import type { ESEngineModule } from 'esengine/wasm';
+import { ProbeStatus, ProbeOccluder } from './components';
+
+const identity = Float32Array.from([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
+const resolution = [3, 1, 3] as const;
+const options = { atlasSize: 64, texelsPerUnit: 4, bounces: 1, samples: 64, probeSamples: 256 };
+
+function plane(x: number, edge: number, albedo: [number, number, number]): BakeSurface {
+ const points = [[x, -edge, -edge], [x, -edge, edge], [x, edge, edge], [x, edge, -edge]];
+ const vertices = new Uint8Array(4 * 24);
+ const view = new DataView(vertices.buffer);
+ points.forEach((point, i) => {
+ point.forEach((value, k) => view.setFloat32(i * 24 + k * 4, value, true));
+ view.setFloat32(i * 24 + 12, -1, true);
+ });
+ const mesh = unwrapLightmapUV({
+ channels: [
+ { semantic: MeshChannel.Position, components: 3, type: MeshChannelType.Float32, offset: 0 },
+ { semantic: MeshChannel.Normal, components: 3, type: MeshChannelType.Float32, offset: 12 },
+ ],
+ vertexStride: 24, vertexCount: 4, vertices, indices: Uint32Array.from([0, 1, 2, 0, 2, 3]),
+ aabbMin: [x, -edge, -edge], aabbMax: [x, edge, edge],
+ }).mesh;
+ return { mesh, transform: identity, albedo };
+}
+
+const wall = plane(3, 2, [1, 0.3, 0.1]);
+const occluder = plane(1.5, 0.75, [0.4, 0.4, 0.4]);
+const coefficients = new Float32Array(9 * 27);
+let reference: Float32Array = new Float32Array(coefficients.length);
+const state = {
+ intensity: 1, updating: false, occluded: false, dirty: [] as number[],
+ completed: 0, lastSolveMs: 0, maxSolveMs: 0, referenceMs: 0,
+ failedProbe: -1, failure: '', samples: [] as number[],
+ cycling: false, cycleFrames: 0, budgetMs: 4, overBudget: 0, updateSamples: [] as number[],
+};
+const grid = { min: [-1, 0, -1] as const, max: [1, 0, 1] as const, resolution };
+const lights = () => [{ kind: 'directional' as const, direction: [1, 0, 0] as const,
+ color: [1, 1, 1] as const, intensity: state.intensity }];
+const surfaces = () => state.occluded ? [wall, occluder] : [wall];
+const error = () => Math.sqrt(coefficients.reduce((sum, value, i) =>
+ sum + (value - reference[i]!) ** 2, 0) / coefficients.length);
+
+function invalidate(): void {
+ const start = performance.now();
+ reference = bakeLightmap(surfaces(), lights(), { ...options, probeGrids: [grid] }).probes[0]!;
+ state.referenceMs = performance.now() - start;
+ state.dirty = Array.from({ length: 9 }, (_, i) => i);
+ state.completed = 0;
+ state.failedProbe = -1;
+ state.failure = '';
+}
+
+function upload(module: ESEngineModule): number {
+ if (!module.probe_volume_create) throw new Error('Probe updates are unavailable on this runtime');
+ const pointer = module._malloc(coefficients.byteLength);
+ if (!pointer) throw new Error('Probe allocation failed');
+ try {
+ module.HEAPF32.set(coefficients, pointer >> 2);
+ const handle = module.probe_volume_create(3, 1, 3, pointer);
+ if (!handle) throw new Error('Probe upload failed');
+ return handle;
+ } finally {
+ module._free(pointer);
+ }
+}
+
+const controls = {
+ state,
+ error,
+ setIntensity(value: number) { state.intensity = value === 3 ? 3 : 1; invalidate(); },
+ setUpdating(value: boolean) { state.updating = value; },
+ setOccluded(value: boolean) { state.occluded = value; invalidate(); },
+ setCycling(value: boolean) { state.cycling = value; state.cycleFrames = 0; },
+};
+(globalThis as typeof globalThis & { probeResearch?: typeof controls }).probeResearch = controls;
+
+addPlugin({
+ name: 'probe-update-research',
+ build(app) {
+ let handle = 0;
+ app.addStartupSystem(defineSystem([Query(Mut(LightProbeVolume))], volumes => {
+ invalidate();
+ coefficients.set(reference);
+ if (!app.wasmModule) { state.failure = 'This prototype needs the Web runtime'; return; }
+ handle = upload(app.wasmModule);
+ for (const [, volume] of volumes) volume.probes = handle;
+ state.dirty = [];
+ }, { name: 'ProbeResearchSetup' }));
+ app.addSystem(defineSystem([
+ Res(Input), Query(Mut(Light)), Query(Mut(LightProbeVolume)),
+ Query(Mut(Transform), ProbeOccluder), Query(Mut(Text), ProbeStatus),
+ Res(Time), Query(Mut(Transform), Camera),
+ ], (input, lamps, volumes, blockers, labels, time, cameras) => {
+ const updateStart = performance.now();
+ if (input.isKeyPressed('KeyL')) controls.setIntensity(state.intensity === 1 ? 3 : 1);
+ if (input.isKeyPressed('Space')) state.updating = !state.updating;
+ if (input.isKeyPressed('KeyO')) controls.setOccluded(!state.occluded);
+ if (input.isKeyPressed('KeyR')) controls.setCycling(!state.cycling);
+ if (state.cycling && state.updating && ++state.cycleFrames >= 30) {
+ state.cycleFrames = 0;
+ controls.setIntensity(state.intensity === 1 ? 3 : 1);
+ }
+ for (const [, transform] of cameras) {
+ const p = transform.position;
+ p.x = Math.max(0, Math.min(3, p.x + time.delta * 1.5 *
+ (Number(input.isKeyDown('ArrowRight')) - Number(input.isKeyDown('ArrowLeft')))));
+ p.z = Math.max(3, Math.min(6, p.z + time.delta * 1.5 *
+ (Number(input.isKeyDown('ArrowDown')) - Number(input.isKeyDown('ArrowUp')))));
+ }
+ for (const [, lamp] of lamps) lamp.intensity = state.intensity;
+ for (const [, transform] of blockers) transform.scale = state.occluded
+ ? { x: 0.001, y: 0.015, z: 0.015 } : { x: 0, y: 0, z: 0 };
+ if (state.updating && state.dirty.length > 0 && !state.failure && app.wasmModule) {
+ const index = state.dirty[0]!;
+ const start = performance.now();
+ const point = [index % 3 - 1, 0, Math.floor(index / 3) - 1] as const;
+ try {
+ const fresh = bakeLightmap(surfaces(), lights(), { ...options,
+ probeGrids: [{ min: point, max: point, resolution: [1, 1, 1] }],
+ }).probes[0]!;
+ const previous = coefficients.slice(index * 27, (index + 1) * 27);
+ coefficients.set(fresh, index * 27);
+ let next: number;
+ try { next = upload(app.wasmModule); }
+ catch (failure) { coefficients.set(previous, index * 27); throw failure; }
+ for (const [, volume] of volumes) volume.probes = next;
+ app.wasmModule.probe_volume_release?.(handle);
+ handle = next;
+ state.dirty.shift();
+ state.completed++;
+ } catch (failure) {
+ state.failedProbe = index;
+ state.failure = failure instanceof Error ? failure.message : String(failure);
+ }
+ state.lastSolveMs = performance.now() - start;
+ state.maxSolveMs = Math.max(state.maxSolveMs, state.lastSolveMs);
+ state.samples.push(state.lastSolveMs);
+ if (state.samples.length > 256) state.samples.shift();
+ }
+ const updateMs = performance.now() - updateStart;
+ state.updateSamples.push(updateMs);
+ if (state.updateSamples.length > 256) state.updateSamples.shift();
+ if (updateMs > state.budgetMs) state.overBudget++;
+ for (const [, label] of labels) label.content = state.failure
+ ? `Probe (${state.failedProbe % 3 - 1}, 0, ${Math.floor(state.failedProbe / 3) - 1}) failed: ${state.failure}`
+ : `${state.updating ? 'Updating' : 'Static'} | ${state.completed}/9 | error ${error().toFixed(4)} | solve ${state.lastSolveMs.toFixed(2)} ms | >4ms ${state.overBudget}`;
+ }, { name: 'ProbeResearchUpdate' }));
+ app.addPlugin({ name: 'probe-research-lifetime', build() {},
+ cleanup() { app.wasmModule?.probe_volume_release?.(handle); },
+ });
+ },
+});
diff --git a/examples/probe-update/tsconfig.json b/examples/probe-update/tsconfig.json
new file mode 100644
index 000000000..105dd19fa
--- /dev/null
+++ b/examples/probe-update/tsconfig.json
@@ -0,0 +1,21 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "module": "ESNext",
+ "moduleResolution": "bundler",
+ "strict": true,
+ "esModuleInterop": true,
+ "skipLibCheck": true,
+ "forceConsistentCasingInFileNames": true,
+ "declaration": false,
+ "outDir": "./dist",
+ "rootDir": ".",
+ "paths": {
+ "esengine": ["./.esengine/sdk/index.d.ts"],
+ "estella-plugin-*": ["./.esengine/packages/*"],
+ "esengine/wasm": ["./.esengine/sdk/wasm.d.ts"]
+ }
+ },
+ "include": ["src/**/*"],
+ "exclude": ["node_modules"]
+}
diff --git a/pipeline/src/assets/textureCook.ts b/pipeline/src/assets/textureCook.ts
index fdcb81728..1df786611 100644
--- a/pipeline/src/assets/textureCook.ts
+++ b/pipeline/src/assets/textureCook.ts
@@ -11,7 +11,7 @@
import { readTextureCookSettings } from '../project/importSettings';
import { decodePngImage, encodeRgbaPng, downscaleRgba } from './atlasPacker';
import {
- decideTextureCook, cookIntentDefeated, explainTextureCook,
+ decideTextureCook, cookIntentDefeated, explainTextureCook, downscaledSize,
type TextureCookDecision,
} from './textureCookDecision';
import { halveRgba, joinMipLevels, alphaCoverage, preserveAlphaCoverage } from './ktx2Mips';
@@ -145,20 +145,11 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookO
// maxSize downscale first — it applies even when a texture opts OUT of
// compression (a huge UI sprite can ship as a smaller raw PNG), and the
// ENCODED size is what block alignment is judged on.
- let rgba: Uint8Array | null = null;
- let tw = 0, th = 0;
- if (textureEnc && raster) {
- try {
- const dims = pngDimensions(data);
- if (tex.maxSize < Math.max(dims.width, dims.height)) {
- const scaled = downscaleRgba(decodePngImage(path, data), tex.maxSize);
- rgba = scaled.rgba; tw = scaled.width; th = scaled.height;
- }
- } catch (err) {
- warnings.push(`${path}: texture resize skipped — ${err instanceof Error ? err.message : String(err)}`);
- }
- }
- const size = raster ? (rgba ? { width: tw, height: th } : safePngDimensions(data)) : null;
+ const sourceSize = raster ? safePngDimensions(data) : null;
+ const scaled = !!(textureEnc && sourceSize && tex.maxSize > 0 &&
+ tex.maxSize < Math.max(sourceSize.width, sourceSize.height));
+ const size = scaled ? downscaledSize(sourceSize!.width, sourceSize!.height, tex.maxSize) : sourceSize;
+ const scaledImage = () => downscaleRgba(decodePngImage(path, data), tex.maxSize);
const cook = decideTextureCook({
compressTextures: input.compressTextures, atlasTextures: input.atlasTextures, inAtlas: false, raster,
compress: tex.compress, drawnIn3D: input.drawnIn3D, format: tex.format, size,
@@ -171,7 +162,10 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookO
else warnings.push(`${path}: ${explainTextureCook(cook, size)}`);
}
// A texture that ships as an image ships the shrunk one.
- if (cook.selected === 'raw' && rgba) data = encodeRgbaPng(tw, th, rgba);
+ if (cook.selected === 'raw' && scaled) {
+ const image = scaledImage();
+ data = encodeRgbaPng(image.width, image.height, image.rgba);
+ }
if (cook.selected !== 'raw') {
// Only a build that encodes can select an encoding, and that is exactly
// when the encoder was loaded — an absent one here is a broken invariant
@@ -180,14 +174,16 @@ export async function cookTexture(input: TextureCookInput): Promise<TextureCookO
const mode = cook.selected;
const source = data;
const coverage = mode === 'uastc' ? tex.mipCoverage : 0;
- const key = [source, JSON.stringify({ mode, srgb: tex.srgb, maxSize: tex.maxSize, scaled: rgba ? [tw, th] : null,
+ const key = [source, JSON.stringify({ mode, srgb: tex.srgb, maxSize: tex.maxSize, scaled: scaled ? [size!.width, size!.height] : null,
...(coverage ? { mipCoverage: coverage } : {}) }), input.encoder!.id];
- const produce = (): Promise<Uint8Array> => (coverage
- ? encodeCoverageChain(enc, rgba ? { rgba, width: tw, height: th } : decodePngImage(path, source),
- tex.srgb, coverage)
- : rgba
- ? enc.encodeToKtx2({ type: enc.ImageType.RGBA, data: rgba, width: tw, height: th }, { mode, srgb: tex.srgb })
- : enc.encodeToKtx2({ type: enc.ImageType.PNG, data: source }, { mode, srgb: tex.srgb }));
+ const produce = (): Promise<Uint8Array> => {
+ const image = scaled ? scaledImage() : null;
+ return coverage
+ ? encodeCoverageChain(enc, image ?? decodePngImage(path, source), tex.srgb, coverage)
+ : image
+ ? enc.encodeToKtx2({ type: enc.ImageType.RGBA, data: image.rgba, width: image.width, height: image.height }, { mode, srgb: tex.srgb })
+ : enc.encodeToKtx2({ type: enc.ImageType.PNG, data: source }, { mode, srgb: tex.srgb });
+ };
const file = cookCacheFile(root, key);
const encoded = input.cachedOnly ? await cookCacheHitAt(file) : (await cookCachedAt(file, produce)).bytes;
if (!encoded) return { data, ext, cook, warnings, defeatedByFormat, pending: true };
diff --git a/pipeline/src/project/format.ts b/pipeline/src/project/format.ts
index 873b8edae..e5a3c6347 100644
--- a/pipeline/src/project/format.ts
+++ b/pipeline/src/project/format.ts
@@ -18,7 +18,10 @@
* into workspace.json.
*/
-import { parseAudioProjectConfig, THEME_COLOR_ROLES, type AudioProjectConfig } from 'esengine';
+import {
+ parseAudioProjectConfig, parseQualityConfig, THEME_COLOR_ROLES,
+ type AudioProjectConfig, type QualityConfig,
+} from 'esengine';
import { normalizePlatform, type ExportPlatform } from './platforms';
export const PROJECT_FORMAT_VERSION = '1';
@@ -159,6 +162,7 @@ export interface ProjectFeatures {
* what a browser gives its own drawing buffer. Clamped by what the device
* supports. A low-end target turns this down; nothing else should. */
msaa?: 1 | 2 | 4 | 8;
+ quality?: QualityConfig;
/** GPU backend a shipped build asks for. 'webgpu' takes it where the machine
* serves one and falls back to WebGL2 where it does not, so a project can
* opt in without giving up the browsers that have neither. Absent ⇒ WebGL2,
@@ -761,6 +765,10 @@ export function parseManifest(raw: unknown): ProjectManifest {
if (r.outputTransform === 'aces') rendering.outputTransform = 'aces';
// Only a NON-default count persists; 4 is absence, like the fields above.
if (r.msaa === 1 || r.msaa === 2 || r.msaa === 8) rendering.msaa = r.msaa;
+ if (r.quality) {
+ const quality = parseQualityConfig(r.quality);
+ rendering.quality = quality;
+ }
// Same shape: only the opt-in persists, WebGL2 is absence.
if (r.backend === 'webgpu') rendering.backend = 'webgpu';
// Camera fit — 'none' (off) is the default, expressed by absence.
diff --git a/pipeline/src/project/runtimeConfig.ts b/pipeline/src/project/runtimeConfig.ts
index e1a5bd9f1..4c15d6f58 100644
--- a/pipeline/src/project/runtimeConfig.ts
+++ b/pipeline/src/project/runtimeConfig.ts
@@ -26,7 +26,10 @@
* fails the build when a field in this shape is not carried by every consumer —
* or is not listed there as a declared, reasoned gap.
*/
-import type { AudioProjectConfig, PackagedGameConfig, Physics2DPluginConfig } from 'esengine';
+import { parseQualityConfig } from 'esengine';
+import type {
+ AudioProjectConfig, PackagedGameConfig, Physics2DPluginConfig, QualityConfig,
+} from 'esengine';
import { resolveScreenFit, SORTING_LAYER_COUNT, type ProjectFeatures, type ProjectManifest, type ProjectPackaging } from './format';
/** The project's camera fit as a runtime takes it (`scaleMode < 0` ⇒ off). */
@@ -74,6 +77,7 @@ export interface RuntimeProjectConfig {
/** Scene-target multisampling the project asks for; 4 is the default. The
* device clamps it — this is the policy half, never the capability. */
msaaSamples: number;
+ quality: QualityConfig;
/** GPU backend the build asks for; 'webgl2' is the default. Boot-fixed, and a
* request for 'webgpu' still falls back where the machine has none. */
renderBackend: 'webgl2' | 'webgpu';
@@ -156,6 +160,7 @@ export function runtimeConfigOf(
colorSpace: f?.rendering?.colorSpace === 'linear' ? 'linear' : 'gamma',
outputTransform: f?.rendering?.outputTransform === 'aces' ? 'aces' : 'none',
msaaSamples: msaaOf(f?.rendering?.msaa),
+ quality: parseQualityConfig(f?.rendering?.quality),
renderBackend: f?.rendering?.backend === 'webgpu' ? 'webgpu' : 'webgl2',
screenFit: resolveScreenFit(manifest),
};
@@ -165,7 +170,7 @@ export function runtimeConfigOf(
export type PackagedRuntimeFields = Pick<
PackagedGameConfig,
'ySortLayers' | 'depthLayers' | 'colorSpace' | 'outputTransform' | 'renderBackend' | 'screenFit'
- | 'msaaSamples'
+ | 'msaaSamples' | 'quality'
| 'uiTheme' | 'uiThemeColors'
| 'physicsEnabled' | 'physicsConfig' | 'audioConfig' | 'achievements' | 'steamAppId'
>;
@@ -186,6 +191,7 @@ export function packagedRuntimeFields(rc: RuntimeProjectConfig): PackagedRuntime
...(rc.colorSpace === 'linear' ? { colorSpace: rc.colorSpace } : {}),
...(rc.outputTransform === 'aces' ? { outputTransform: rc.outputTransform } : {}),
...(rc.msaaSamples !== 4 ? { msaaSamples: rc.msaaSamples } : {}),
+ ...(rc.quality.mode !== 'off' ? { quality: rc.quality } : {}),
...(rc.renderBackend === 'webgpu' ? { renderBackend: rc.renderBackend } : {}),
// ALWAYS, even with the fit off (`scaleMode < 0`): it carries the design
// resolution, which is what a desktop window opens at. One representation, or
diff --git a/pipeline/tests/runtime-config.test.ts b/pipeline/tests/runtime-config.test.ts
index cc5e1fa3f..1a1fb637c 100644
--- a/pipeline/tests/runtime-config.test.ts
+++ b/pipeline/tests/runtime-config.test.ts
@@ -15,6 +15,14 @@ import {
} from '../src/project/runtimeConfig';
describe('runtimeConfigOf', () => {
+ it('carries the same normalized quality policy into exported builds', () => {
+ const rc = runtimeConfigOf({ features: { rendering: {
+ quality: { mode: 'low', dynamicResolution: true, targetFps: 30 },
+ } } });
+ expect(packagedRuntimeFields(rc).quality).toEqual(rc.quality);
+ expect(rc.quality.targetFps).toBe(30);
+ expect(packagedRuntimeFields(runtimeConfigOf({}))).not.toHaveProperty('quality');
+ });
it('answers with the engine defaults for a project that declares nothing', () => {
const rc = runtimeConfigOf({});
expect(rc.ySortLayers).toBe(0);
diff --git a/pipeline/tests/texture-cache-readback.test.ts b/pipeline/tests/texture-cache-readback.test.ts
new file mode 100644
index 000000000..df4f6d5f7
--- /dev/null
+++ b/pipeline/tests/texture-cache-readback.test.ts
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import { mkdtempSync, rmSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import path from 'node:path';
+import { solidPng } from './fixtures/solidPng.mjs';
+
+vi.mock('../src/assets/atlasPacker', async original => {
+ const module = await original<typeof import('../src/assets/atlasPacker')>();
+ return { ...module, decodePngImage: vi.fn(module.decodePngImage) };
+});
+import { decodePngImage } from '../src/assets/atlasPacker';
+import { cookTexture, type TextureEncoder } from '../src/assets/textureCook';
+
+describe('texture cache readback', () => {
+ let temporaryRoot: string | undefined;
+ afterEach(() => {
+ if (temporaryRoot) rmSync(temporaryRoot, { recursive: true, force: true, maxRetries: 10, retryDelay: 50 });
+ });
+ it('checks a capped texture without decoding, and reuses the exact resized output on cache hits', async () => {
+ const root = mkdtempSync(path.join(tmpdir(), 'estella-cache-readback-'));
+ temporaryRoot = root;
+ const encode = vi.fn(async () => Uint8Array.from([1, 2, 3]));
+ const encoder = { id: 'cache-readback', module: {
+ encodeToKtx2: encode, ImageType: { PNG: 'png', RGBA: 'rgba' },
+ } } as unknown as TextureEncoder;
+ const ask = (cachedOnly: boolean) => cookTexture({
+ root, path: 'wall.png', data: new Uint8Array(solidPng(64, 32, [100, 80, 60, 255])),
+ ext: '.png', importer: { compress: 'uastc', maxSize: 16 }, encoder,
+ compressTextures: true, atlasTextures: false, drawnIn3D: true, cachedOnly,
+ });
+ expect((await ask(true)).pending).toBe(true);
+ expect(decodePngImage).not.toHaveBeenCalled();
+ const made = await ask(false);
+ expect(decodePngImage).toHaveBeenCalledTimes(1);
+ expect(encode).toHaveBeenCalledWith(expect.objectContaining({
+ type: 'rgba', width: 16, height: 8, data: expect.any(Uint8Array),
+ }), expect.objectContaining({ mode: 'uastc' }));
+ expect(Array.from((await ask(true)).data)).toEqual(Array.from(made.data));
+ expect(Array.from((await ask(false)).data)).toEqual(Array.from(made.data));
+ expect(decodePngImage).toHaveBeenCalledTimes(1);
+ expect(encode).toHaveBeenCalledTimes(1);
+ });
+});
diff --git a/sdk/etc/dragonbones.api.md b/sdk/etc/dragonbones.api.md
index d7e636faa..dbe6e7df8 100644
--- a/sdk/etc/dragonbones.api.md
+++ b/sdk/etc/dragonbones.api.md
@@ -139,7 +139,7 @@ update: (instanceId: number, dt: number) => void
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 9193776f6..2e383ef27 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 91 beta · 1526 experimental · 3 deprecated
+Symbols: 115 public · 91 beta · 1536 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -750,6 +750,7 @@ getEntityCount: () => number
getFixedTimestep: () => number
getFrameCosts: () => FrameCosts | null
getFrameScopes: () => ReadonlyMap<string, number> | null
+getFrameTiming: () => Readonly<{ seq: number; frameMs: number; }> | null
getPhaseTimings: () => ReadonlyMap<string, number> | null
getPlaySpeed: () => number
getPlugin: <T extends Plugin>(ctor: new (...args: any[]) => T) => T | undefined
@@ -2074,6 +2075,7 @@ gpuMs: number | undefined
id: number
memory: { wasmBytes?: number; jsHeapBytes?: number; vramBytes?: number; } | undefined
nativeScopes: ScopeCost[] | undefined
+quality: QualityReport | undefined
scopes: ScopeCost[]
systems: SystemCost[]
triangles: number | undefined
@@ -2557,6 +2559,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -2830,6 +2833,23 @@ version: string
{ readonly Unknown: 0; readonly ContextLost: 1; readonly OutOfMemory: 2; readonly Reset: 3; readonly Removed: 4; readonly Destroyed: 5; readonly Validation: 6; readonly Internal: 7; }
```
+## DeviceQualityInfo — interface @experimental
+```
+cores: number | undefined
+gpu: string | undefined
+memoryGB: number | undefined
+model: string | undefined
+```
+
+## DeviceQualityRule — interface @experimental
+```
+gpuIncludes: string | undefined
+level: QualityLevel
+maxCores: number | undefined
+maxMemoryGB: number | undefined
+modelIncludes: string | undefined
+```
+
## DeviceRestoredListener — type @experimental
```
(generation: number) => void
@@ -3861,9 +3881,12 @@ cppCounters: Record<string, number>
cppScopes: Record<string, number>
drawCalls: number
entities: number
+frameMs: number | undefined
gpuMs: number
gpuScopes: Record<string, number>
phases: Record<string, number>
+quality: QualityReport | undefined
+seq: number | undefined
sprites: number
triangles: number
vramBytes: number
@@ -5355,7 +5378,7 @@ textureImport: (ref: string) => ParsedTextureImportSettings | undefined
## PackagedAssetSourceOptions — interface @experimental
```
backend: Backend | undefined
-decodePixels: ((path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
+decodePixels: ((path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
```
## PackagedGameConfig — interface @experimental
@@ -5373,6 +5396,7 @@ msaaSamples: number | undefined
outputTransform: "none" | "aces" | undefined
physicsConfig: Physics2DPluginConfig | undefined
physicsEnabled: boolean | undefined
+quality: QualityConfig | undefined
renderBackend: "webgl2" | "webgpu" | undefined
scenes: { name: string; path: string; }[] | undefined
screenFit: { designWidth: number; designHeight: number; scaleMode: number; matchWidthOrHeight: number; } | undefined
@@ -5791,6 +5815,7 @@ createTextEditor: (() => PlatformTextEditor | null) | undefined
createVideoBackend: ((ctx: VideoBackendContext) => PlatformVideoBackend) | undefined
deviceName: (() => string) | undefined
devicePixelRatio: () => number
+deviceQualityInfo: (() => DeviceQualityInfo) | undefined
family: "minigame" | undefined
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -5859,7 +5884,7 @@ width: number
## PlatformCanvas2DContext — interface @experimental
```
clearRect: (x: number, y: number, w: number, h: number) => void
-drawImage: (image: PlatformImageSource, dx: number, dy: number) => void
+drawImage: { (image: PlatformImageSource, dx: number, dy: number): void; (image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void; }
fillStyle: PlatformCanvasPaint
fillText: (text: string, x: number, y: number) => void
font: string
@@ -6165,6 +6190,7 @@ setMsaaSamples: (samples: number) => void
setOutputTransform: (transform: OutputTransform) => void
setOutputViewport: (x: number, y: number, w: number, h: number) => void
setPresentRequired: (required: boolean) => void
+setQualityFilter: (profile: Readonly<QualityProfile> | null) => void
setScreenStack: (stack: PostProcessStack | null) => void
shutdown: () => void
state: PostProcessState
@@ -6467,6 +6493,68 @@ fields: readonly PtrFieldDesc[]
ptrFn: string
```
+## Quality — const @experimental
+```
+ResourceDef<QualityController | null>
+```
+
+## QualityConfig — interface @experimental
+```
+deviceRules: DeviceQualityRule[] | undefined
+dynamicResolution: boolean | undefined
+mode: QualityMode | undefined
+profiles: Partial<Record<QualityLevel, Partial<QualityProfile>>> | undefined
+targetFps: number | undefined
+```
+
+## QualityController — class @experimental
+```
+enabled: boolean
+profile: Readonly<QualityProfile>
+renderScale: number
+report: () => QualityReport
+sample: (frameMs: number, gpuMs?: number) => void
+setLimitation: (reason: string, active: boolean) => void
+setMode: (mode: QualityMode) => void
+static new (config: QualityConfig, device_?: DeviceQualityInfo): QualityController
+static prototype: QualityController
+```
+
+## QualityLevel — type @experimental
+```
+'low' | 'medium' | 'high'
+```
+
+## QualityMode — type @experimental
+```
+'off' | 'auto' | QualityLevel
+```
+
+## QualityProfile — interface @experimental
+```
+minRenderScale: number
+msaaSamples: 2 | 1 | 4 | 8
+particleLimit: number
+postProcess: boolean
+renderScale: number
+shadowAtlasSize: number
+shadowCascades: number
+shadowCellSize: number
+shadowDistance: number
+ssao: boolean
+```
+
+## QualityReport — interface @experimental
+```
+frameMs: number
+level: QualityLevel
+limitations: string[]
+mode: QualityMode
+reason: string
+renderScale: number
+targetFps: number
+```
+
## Quat — interface @public
```
w: number
@@ -6638,9 +6726,12 @@ endScreenCapture: () => void
render: (params: RenderParams) => void
renderCamera: (params: CameraRenderParams) => void
renderScreenOverlay: (registry: { _cpp: CppRegistry; }, overlay: ScreenOverlayData, target?: number) => void
+renderingEnabled: boolean
runPreFlushCallbacks: (registry: { _cpp: CppRegistry; }) => void
setActiveScenes: (scenes: Set<string> | null) => void
setPostProcess: (pp: PostProcessAPI | null) => void
+setQuality: (quality: QualityController, apply?: () => void) => void
+setRenderingEnabled: (enabled: boolean) => void
submitScene: (registry: { _cpp: CppRegistry; }, viewProjection: Float32Array, viewport: Viewport, _elapsed: number) => void
static new (): RenderPipeline
static prototype: RenderPipeline
@@ -6893,7 +6984,7 @@ rotation: Quat
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
@@ -9537,6 +9628,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -10571,7 +10663,7 @@ Plugin
## decodeImagePixels — function @experimental
```
-(src: ImageBitmapSource): Promise<DecodedPixels>
+(src: ImageBitmapSource, maxEdge?: number): Promise<DecodedPixels>
```
## decodeLightmap — function @experimental
@@ -10921,7 +11013,7 @@ EventBindingPlugin
## fetchDecodePixels — function @experimental
```
-(url: string): Promise<DecodedPixels>
+(url: string, maxEdge?: number): Promise<DecodedPixels>
```
## findControllerOwner — function @experimental
@@ -11101,7 +11193,7 @@ FocusPlugin
## getDeviceIdentity — function @experimental
```
-(): DeviceIdentity | null
+(source?: ESEngineModule | null): DeviceIdentity | null
```
## getDeviceLostReport — function @experimental
@@ -11636,7 +11728,7 @@ MeshRendererPlugin
## packagedAppOptions — function @experimental
```
-(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
+(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples" | "quality">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; quality?: QualityConfig; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
```
## packagedRuntimeInit — function @experimental
@@ -11704,6 +11796,11 @@ MeshRendererPlugin
(text: string): { capture: ProfileCapture; } | { error: string; }
```
+## parseQualityConfig — function @experimental
+```
+(value: unknown): QualityConfig
+```
+
## parseRichText — function @experimental
```
(input: string): RichTextRun[]
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index cfa2118e9..5237d1934 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.native
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 96 beta · 1545 experimental · 3 deprecated
+Symbols: 115 public · 96 beta · 1555 experimental · 3 deprecated
## ABI_LAYOUT_HASH — const @experimental
```
@@ -750,6 +750,7 @@ getEntityCount: () => number
getFixedTimestep: () => number
getFrameCosts: () => FrameCosts | null
getFrameScopes: () => ReadonlyMap<string, number> | null
+getFrameTiming: () => Readonly<{ seq: number; frameMs: number; }> | null
getPhaseTimings: () => ReadonlyMap<string, number> | null
getPlaySpeed: () => number
getPlugin: <T extends Plugin>(ctor: new (...args: any[]) => T) => T | undefined
@@ -2074,6 +2075,7 @@ gpuMs: number | undefined
id: number
memory: { wasmBytes?: number; jsHeapBytes?: number; vramBytes?: number; } | undefined
nativeScopes: ScopeCost[] | undefined
+quality: QualityReport | undefined
scopes: ScopeCost[]
systems: SystemCost[]
triangles: number | undefined
@@ -2565,6 +2567,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -2838,6 +2841,23 @@ version: string
{ readonly Unknown: 0; readonly ContextLost: 1; readonly OutOfMemory: 2; readonly Reset: 3; readonly Removed: 4; readonly Destroyed: 5; readonly Validation: 6; readonly Internal: 7; }
```
+## DeviceQualityInfo — interface @experimental
+```
+cores: number | undefined
+gpu: string | undefined
+memoryGB: number | undefined
+model: string | undefined
+```
+
+## DeviceQualityRule — interface @experimental
+```
+gpuIncludes: string | undefined
+level: QualityLevel
+maxCores: number | undefined
+maxMemoryGB: number | undefined
+modelIncludes: string | undefined
+```
+
## DeviceRestoredListener — type @experimental
```
(generation: number) => void
@@ -3869,9 +3889,12 @@ cppCounters: Record<string, number>
cppScopes: Record<string, number>
drawCalls: number
entities: number
+frameMs: number | undefined
gpuMs: number
gpuScopes: Record<string, number>
phases: Record<string, number>
+quality: QualityReport | undefined
+seq: number | undefined
sprites: number
triangles: number
vramBytes: number
@@ -5546,7 +5569,7 @@ textureImport: (ref: string) => ParsedTextureImportSettings | undefined
## PackagedAssetSourceOptions — interface @experimental
```
backend: Backend | undefined
-decodePixels: ((path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
+decodePixels: ((path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
```
## PackagedGameConfig — interface @experimental
@@ -5564,6 +5587,7 @@ msaaSamples: number | undefined
outputTransform: "none" | "aces" | undefined
physicsConfig: Physics2DPluginConfig | undefined
physicsEnabled: boolean | undefined
+quality: QualityConfig | undefined
renderBackend: "webgl2" | "webgpu" | undefined
scenes: { name: string; path: string; }[] | undefined
screenFit: { designWidth: number; designHeight: number; scaleMode: number; matchWidthOrHeight: number; } | undefined
@@ -5982,6 +6006,7 @@ createTextEditor: (() => PlatformTextEditor | null) | undefined
createVideoBackend: ((ctx: VideoBackendContext) => PlatformVideoBackend) | undefined
deviceName: (() => string) | undefined
devicePixelRatio: () => number
+deviceQualityInfo: (() => DeviceQualityInfo) | undefined
family: "minigame" | undefined
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -6050,7 +6075,7 @@ width: number
## PlatformCanvas2DContext — interface @experimental
```
clearRect: (x: number, y: number, w: number, h: number) => void
-drawImage: (image: PlatformImageSource, dx: number, dy: number) => void
+drawImage: { (image: PlatformImageSource, dx: number, dy: number): void; (image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void; }
fillStyle: PlatformCanvasPaint
fillText: (text: string, x: number, y: number) => void
font: string
@@ -6356,6 +6381,7 @@ setMsaaSamples: (samples: number) => void
setOutputTransform: (transform: OutputTransform) => void
setOutputViewport: (x: number, y: number, w: number, h: number) => void
setPresentRequired: (required: boolean) => void
+setQualityFilter: (profile: Readonly<QualityProfile> | null) => void
setScreenStack: (stack: PostProcessStack | null) => void
shutdown: () => void
state: PostProcessState
@@ -6658,6 +6684,68 @@ fields: readonly PtrFieldDesc[]
ptrFn: string
```
+## Quality — const @experimental
+```
+ResourceDef<QualityController | null>
+```
+
+## QualityConfig — interface @experimental
+```
+deviceRules: DeviceQualityRule[] | undefined
+dynamicResolution: boolean | undefined
+mode: QualityMode | undefined
+profiles: Partial<Record<QualityLevel, Partial<QualityProfile>>> | undefined
+targetFps: number | undefined
+```
+
+## QualityController — class @experimental
+```
+enabled: boolean
+profile: Readonly<QualityProfile>
+renderScale: number
+report: () => QualityReport
+sample: (frameMs: number, gpuMs?: number) => void
+setLimitation: (reason: string, active: boolean) => void
+setMode: (mode: QualityMode) => void
+static new (config: QualityConfig, device_?: DeviceQualityInfo): QualityController
+static prototype: QualityController
+```
+
+## QualityLevel — type @experimental
+```
+'low' | 'medium' | 'high'
+```
+
+## QualityMode — type @experimental
+```
+'off' | 'auto' | QualityLevel
+```
+
+## QualityProfile — interface @experimental
+```
+minRenderScale: number
+msaaSamples: 2 | 1 | 4 | 8
+particleLimit: number
+postProcess: boolean
+renderScale: number
+shadowAtlasSize: number
+shadowCascades: number
+shadowCellSize: number
+shadowDistance: number
+ssao: boolean
+```
+
+## QualityReport — interface @experimental
+```
+frameMs: number
+level: QualityLevel
+limitations: string[]
+mode: QualityMode
+reason: string
+renderScale: number
+targetFps: number
+```
+
## Quat — interface @public
```
w: number
@@ -6839,9 +6927,12 @@ endScreenCapture: () => void
render: (params: RenderParams) => void
renderCamera: (params: CameraRenderParams) => void
renderScreenOverlay: (registry: { _cpp: CppRegistry; }, overlay: ScreenOverlayData, target?: number) => void
+renderingEnabled: boolean
runPreFlushCallbacks: (registry: { _cpp: CppRegistry; }) => void
setActiveScenes: (scenes: Set<string> | null) => void
setPostProcess: (pp: PostProcessAPI | null) => void
+setQuality: (quality: QualityController, apply?: () => void) => void
+setRenderingEnabled: (enabled: boolean) => void
submitScene: (registry: { _cpp: CppRegistry; }, viewProjection: Float32Array, viewport: Viewport, _elapsed: number) => void
static new (): RenderPipeline
static prototype: RenderPipeline
@@ -7094,7 +7185,7 @@ rotation: Quat
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
@@ -9738,6 +9829,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -10812,7 +10904,7 @@ Plugin
## decodeImagePixels — function @experimental
```
-(src: ImageBitmapSource): Promise<DecodedPixels>
+(src: ImageBitmapSource, maxEdge?: number): Promise<DecodedPixels>
```
## decodeLightmap — function @experimental
@@ -11162,7 +11254,7 @@ EventBindingPlugin
## fetchDecodePixels — function @experimental
```
-(url: string): Promise<DecodedPixels>
+(url: string, maxEdge?: number): Promise<DecodedPixels>
```
## findControllerOwner — function @experimental
@@ -11342,7 +11434,7 @@ FocusPlugin
## getDeviceIdentity — function @experimental
```
-(): DeviceIdentity | null
+(source?: ESEngineModule | null): DeviceIdentity | null
```
## getDeviceLostReport — function @experimental
@@ -11887,7 +11979,7 @@ MeshRendererPlugin
## packagedAppOptions — function @experimental
```
-(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
+(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples" | "quality">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; quality?: QualityConfig; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
```
## packagedRuntimeInit — function @experimental
@@ -11955,6 +12047,11 @@ MeshRendererPlugin
(text: string): { capture: ProfileCapture; } | { error: string; }
```
+## parseQualityConfig — function @experimental
+```
+(value: unknown): QualityConfig
+```
+
## parseRichText — function @experimental
```
(input: string): RichTextRun[]
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index eaf0b2974..971a8f5fd 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/index.node
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 93 beta · 1525 experimental · 3 deprecated
+Symbols: 115 public · 93 beta · 1535 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -745,6 +745,7 @@ getEntityCount: () => number
getFixedTimestep: () => number
getFrameCosts: () => FrameCosts | null
getFrameScopes: () => ReadonlyMap<string, number> | null
+getFrameTiming: () => Readonly<{ seq: number; frameMs: number; }> | null
getPhaseTimings: () => ReadonlyMap<string, number> | null
getPlaySpeed: () => number
getPlugin: <T extends Plugin>(ctor: new (...args: any[]) => T) => T | undefined
@@ -2069,6 +2070,7 @@ gpuMs: number | undefined
id: number
memory: { wasmBytes?: number; jsHeapBytes?: number; vramBytes?: number; } | undefined
nativeScopes: ScopeCost[] | undefined
+quality: QualityReport | undefined
scopes: ScopeCost[]
systems: SystemCost[]
triangles: number | undefined
@@ -2552,6 +2554,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -2825,6 +2828,23 @@ version: string
{ readonly Unknown: 0; readonly ContextLost: 1; readonly OutOfMemory: 2; readonly Reset: 3; readonly Removed: 4; readonly Destroyed: 5; readonly Validation: 6; readonly Internal: 7; }
```
+## DeviceQualityInfo — interface @experimental
+```
+cores: number | undefined
+gpu: string | undefined
+memoryGB: number | undefined
+model: string | undefined
+```
+
+## DeviceQualityRule — interface @experimental
+```
+gpuIncludes: string | undefined
+level: QualityLevel
+maxCores: number | undefined
+maxMemoryGB: number | undefined
+modelIncludes: string | undefined
+```
+
## DeviceRestoredListener — type @experimental
```
(generation: number) => void
@@ -3856,9 +3876,12 @@ cppCounters: Record<string, number>
cppScopes: Record<string, number>
drawCalls: number
entities: number
+frameMs: number | undefined
gpuMs: number
gpuScopes: Record<string, number>
phases: Record<string, number>
+quality: QualityReport | undefined
+seq: number | undefined
sprites: number
triangles: number
vramBytes: number
@@ -5350,7 +5373,7 @@ textureImport: (ref: string) => ParsedTextureImportSettings | undefined
## PackagedAssetSourceOptions — interface @experimental
```
backend: Backend | undefined
-decodePixels: ((path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
+decodePixels: ((path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
```
## PackagedGameConfig — interface @experimental
@@ -5368,6 +5391,7 @@ msaaSamples: number | undefined
outputTransform: "none" | "aces" | undefined
physicsConfig: Physics2DPluginConfig | undefined
physicsEnabled: boolean | undefined
+quality: QualityConfig | undefined
renderBackend: "webgl2" | "webgpu" | undefined
scenes: { name: string; path: string; }[] | undefined
screenFit: { designWidth: number; designHeight: number; scaleMode: number; matchWidthOrHeight: number; } | undefined
@@ -5786,6 +5810,7 @@ createTextEditor: (() => PlatformTextEditor | null) | undefined
createVideoBackend: ((ctx: VideoBackendContext) => PlatformVideoBackend) | undefined
deviceName: (() => string) | undefined
devicePixelRatio: () => number
+deviceQualityInfo: (() => DeviceQualityInfo) | undefined
family: "minigame" | undefined
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -5854,7 +5879,7 @@ width: number
## PlatformCanvas2DContext — interface @experimental
```
clearRect: (x: number, y: number, w: number, h: number) => void
-drawImage: (image: PlatformImageSource, dx: number, dy: number) => void
+drawImage: { (image: PlatformImageSource, dx: number, dy: number): void; (image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void; }
fillStyle: PlatformCanvasPaint
fillText: (text: string, x: number, y: number) => void
font: string
@@ -6160,6 +6185,7 @@ setMsaaSamples: (samples: number) => void
setOutputTransform: (transform: OutputTransform) => void
setOutputViewport: (x: number, y: number, w: number, h: number) => void
setPresentRequired: (required: boolean) => void
+setQualityFilter: (profile: Readonly<QualityProfile> | null) => void
setScreenStack: (stack: PostProcessStack | null) => void
shutdown: () => void
state: PostProcessState
@@ -6462,6 +6488,68 @@ fields: readonly PtrFieldDesc[]
ptrFn: string
```
+## Quality — const @experimental
+```
+ResourceDef<QualityController | null>
+```
+
+## QualityConfig — interface @experimental
+```
+deviceRules: DeviceQualityRule[] | undefined
+dynamicResolution: boolean | undefined
+mode: QualityMode | undefined
+profiles: Partial<Record<QualityLevel, Partial<QualityProfile>>> | undefined
+targetFps: number | undefined
+```
+
+## QualityController — class @experimental
+```
+enabled: boolean
+profile: Readonly<QualityProfile>
+renderScale: number
+report: () => QualityReport
+sample: (frameMs: number, gpuMs?: number) => void
+setLimitation: (reason: string, active: boolean) => void
+setMode: (mode: QualityMode) => void
+static new (config: QualityConfig, device_?: DeviceQualityInfo): QualityController
+static prototype: QualityController
+```
+
+## QualityLevel — type @experimental
+```
+'low' | 'medium' | 'high'
+```
+
+## QualityMode — type @experimental
+```
+'off' | 'auto' | QualityLevel
+```
+
+## QualityProfile — interface @experimental
+```
+minRenderScale: number
+msaaSamples: 2 | 1 | 4 | 8
+particleLimit: number
+postProcess: boolean
+renderScale: number
+shadowAtlasSize: number
+shadowCascades: number
+shadowCellSize: number
+shadowDistance: number
+ssao: boolean
+```
+
+## QualityReport — interface @experimental
+```
+frameMs: number
+level: QualityLevel
+limitations: string[]
+mode: QualityMode
+reason: string
+renderScale: number
+targetFps: number
+```
+
## Quat — interface @public
```
w: number
@@ -6633,9 +6721,12 @@ endScreenCapture: () => void
render: (params: RenderParams) => void
renderCamera: (params: CameraRenderParams) => void
renderScreenOverlay: (registry: { _cpp: CppRegistry; }, overlay: ScreenOverlayData, target?: number) => void
+renderingEnabled: boolean
runPreFlushCallbacks: (registry: { _cpp: CppRegistry; }) => void
setActiveScenes: (scenes: Set<string> | null) => void
setPostProcess: (pp: PostProcessAPI | null) => void
+setQuality: (quality: QualityController, apply?: () => void) => void
+setRenderingEnabled: (enabled: boolean) => void
submitScene: (registry: { _cpp: CppRegistry; }, viewProjection: Float32Array, viewport: Viewport, _elapsed: number) => void
static new (): RenderPipeline
static prototype: RenderPipeline
@@ -6888,7 +6979,7 @@ rotation: Quat
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
@@ -9532,6 +9623,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -10566,7 +10658,7 @@ Plugin
## decodeImagePixels — function @experimental
```
-(src: ImageBitmapSource): Promise<DecodedPixels>
+(src: ImageBitmapSource, maxEdge?: number): Promise<DecodedPixels>
```
## decodeLightmap — function @experimental
@@ -10916,7 +11008,7 @@ EventBindingPlugin
## fetchDecodePixels — function @experimental
```
-(url: string): Promise<DecodedPixels>
+(url: string, maxEdge?: number): Promise<DecodedPixels>
```
## findControllerOwner — function @experimental
@@ -11096,7 +11188,7 @@ FocusPlugin
## getDeviceIdentity — function @experimental
```
-(): DeviceIdentity | null
+(source?: ESEngineModule | null): DeviceIdentity | null
```
## getDeviceLostReport — function @experimental
@@ -11641,7 +11733,7 @@ NodePlatformAdapter
## packagedAppOptions — function @experimental
```
-(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
+(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples" | "quality">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; quality?: QualityConfig; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
```
## packagedRuntimeInit — function @experimental
@@ -11709,6 +11801,11 @@ NodePlatformAdapter
(text: string): { capture: ProfileCapture; } | { error: string; }
```
+## parseQualityConfig — function @experimental
+```
+(value: unknown): QualityConfig
+```
+
## parseRichText — function @experimental
```
(input: string): RichTextRun[]
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index c43b50b8c..fd0110167 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/minigame
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 91 beta · 1547 experimental · 3 deprecated
+Symbols: 115 public · 91 beta · 1557 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -745,6 +745,7 @@ getEntityCount: () => number
getFixedTimestep: () => number
getFrameCosts: () => FrameCosts | null
getFrameScopes: () => ReadonlyMap<string, number> | null
+getFrameTiming: () => Readonly<{ seq: number; frameMs: number; }> | null
getPhaseTimings: () => ReadonlyMap<string, number> | null
getPlaySpeed: () => number
getPlugin: <T extends Plugin>(ctor: new (...args: any[]) => T) => T | undefined
@@ -2069,6 +2070,7 @@ gpuMs: number | undefined
id: number
memory: { wasmBytes?: number; jsHeapBytes?: number; vramBytes?: number; } | undefined
nativeScopes: ScopeCost[] | undefined
+quality: QualityReport | undefined
scopes: ScopeCost[]
systems: SystemCost[]
triangles: number | undefined
@@ -2552,6 +2554,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -2825,6 +2828,23 @@ version: string
{ readonly Unknown: 0; readonly ContextLost: 1; readonly OutOfMemory: 2; readonly Reset: 3; readonly Removed: 4; readonly Destroyed: 5; readonly Validation: 6; readonly Internal: 7; }
```
+## DeviceQualityInfo — interface @experimental
+```
+cores: number | undefined
+gpu: string | undefined
+memoryGB: number | undefined
+model: string | undefined
+```
+
+## DeviceQualityRule — interface @experimental
+```
+gpuIncludes: string | undefined
+level: QualityLevel
+maxCores: number | undefined
+maxMemoryGB: number | undefined
+modelIncludes: string | undefined
+```
+
## DeviceRestoredListener — type @experimental
```
(generation: number) => void
@@ -3856,9 +3876,12 @@ cppCounters: Record<string, number>
cppScopes: Record<string, number>
drawCalls: number
entities: number
+frameMs: number | undefined
gpuMs: number
gpuScopes: Record<string, number>
phases: Record<string, number>
+quality: QualityReport | undefined
+seq: number | undefined
sprites: number
triangles: number
vramBytes: number
@@ -5156,6 +5179,7 @@ createInnerAudioContext: () => MiniGameInnerAudioContext
createInterstitialAd: ((opts: { adUnitId: string; }) => MiniGameInterstitialAd) | undefined
createRewardedVideoAd: ((opts: { adUnitId: string; }) => MiniGameRewardedVideoAd) | undefined
env: { USER_DATA_PATH?: string; } | undefined
+getDeviceInfo: (() => MiniGameSystemInfo) | undefined
getFileSystemManager: () => MiniGameFileSystemManager
getGameRecorder: (() => MiniGameWxRecorder) | undefined
getGameRecorderManager: (() => MiniGameTtRecorder) | undefined
@@ -5251,6 +5275,7 @@ createSocket: (options: PlatformSocketOptions) => PlatformSocket
createVideoBackend: (ctx: VideoBackendContext) => PlatformVideoBackend
deviceName: () => string
devicePixelRatio: () => number
+deviceQualityInfo: () => { model?: string; memoryGB?: number; }
family: "minigame"
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -5369,6 +5394,7 @@ keys: string[]
## MiniGameSystemInfo — interface @experimental
```
language: string | undefined
+memorySize: string | number | undefined
model: string | undefined
pixelRatio: number | undefined
platform: string | undefined
@@ -5620,7 +5646,7 @@ textureImport: (ref: string) => ParsedTextureImportSettings | undefined
## PackagedAssetSourceOptions — interface @experimental
```
backend: Backend | undefined
-decodePixels: ((path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
+decodePixels: ((path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
```
## PackagedGameConfig — interface @experimental
@@ -5638,6 +5664,7 @@ msaaSamples: number | undefined
outputTransform: "none" | "aces" | undefined
physicsConfig: Physics2DPluginConfig | undefined
physicsEnabled: boolean | undefined
+quality: QualityConfig | undefined
renderBackend: "webgl2" | "webgpu" | undefined
scenes: { name: string; path: string; }[] | undefined
screenFit: { designWidth: number; designHeight: number; scaleMode: number; matchWidthOrHeight: number; } | undefined
@@ -6056,6 +6083,7 @@ createTextEditor: (() => PlatformTextEditor | null) | undefined
createVideoBackend: ((ctx: VideoBackendContext) => PlatformVideoBackend) | undefined
deviceName: (() => string) | undefined
devicePixelRatio: () => number
+deviceQualityInfo: (() => DeviceQualityInfo) | undefined
family: "minigame" | undefined
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -6124,7 +6152,7 @@ width: number
## PlatformCanvas2DContext — interface @experimental
```
clearRect: (x: number, y: number, w: number, h: number) => void
-drawImage: (image: PlatformImageSource, dx: number, dy: number) => void
+drawImage: { (image: PlatformImageSource, dx: number, dy: number): void; (image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void; }
fillStyle: PlatformCanvasPaint
fillText: (text: string, x: number, y: number) => void
font: string
@@ -6430,6 +6458,7 @@ setMsaaSamples: (samples: number) => void
setOutputTransform: (transform: OutputTransform) => void
setOutputViewport: (x: number, y: number, w: number, h: number) => void
setPresentRequired: (required: boolean) => void
+setQualityFilter: (profile: Readonly<QualityProfile> | null) => void
setScreenStack: (stack: PostProcessStack | null) => void
shutdown: () => void
state: PostProcessState
@@ -6732,6 +6761,68 @@ fields: readonly PtrFieldDesc[]
ptrFn: string
```
+## Quality — const @experimental
+```
+ResourceDef<QualityController | null>
+```
+
+## QualityConfig — interface @experimental
+```
+deviceRules: DeviceQualityRule[] | undefined
+dynamicResolution: boolean | undefined
+mode: QualityMode | undefined
+profiles: Partial<Record<QualityLevel, Partial<QualityProfile>>> | undefined
+targetFps: number | undefined
+```
+
+## QualityController — class @experimental
+```
+enabled: boolean
+profile: Readonly<QualityProfile>
+renderScale: number
+report: () => QualityReport
+sample: (frameMs: number, gpuMs?: number) => void
+setLimitation: (reason: string, active: boolean) => void
+setMode: (mode: QualityMode) => void
+static new (config: QualityConfig, device_?: DeviceQualityInfo): QualityController
+static prototype: QualityController
+```
+
+## QualityLevel — type @experimental
+```
+'low' | 'medium' | 'high'
+```
+
+## QualityMode — type @experimental
+```
+'off' | 'auto' | QualityLevel
+```
+
+## QualityProfile — interface @experimental
+```
+minRenderScale: number
+msaaSamples: 2 | 1 | 4 | 8
+particleLimit: number
+postProcess: boolean
+renderScale: number
+shadowAtlasSize: number
+shadowCascades: number
+shadowCellSize: number
+shadowDistance: number
+ssao: boolean
+```
+
+## QualityReport — interface @experimental
+```
+frameMs: number
+level: QualityLevel
+limitations: string[]
+mode: QualityMode
+reason: string
+renderScale: number
+targetFps: number
+```
+
## Quat — interface @public
```
w: number
@@ -6903,9 +6994,12 @@ endScreenCapture: () => void
render: (params: RenderParams) => void
renderCamera: (params: CameraRenderParams) => void
renderScreenOverlay: (registry: { _cpp: CppRegistry; }, overlay: ScreenOverlayData, target?: number) => void
+renderingEnabled: boolean
runPreFlushCallbacks: (registry: { _cpp: CppRegistry; }) => void
setActiveScenes: (scenes: Set<string> | null) => void
setPostProcess: (pp: PostProcessAPI | null) => void
+setQuality: (quality: QualityController, apply?: () => void) => void
+setRenderingEnabled: (enabled: boolean) => void
submitScene: (registry: { _cpp: CppRegistry; }, viewProjection: Float32Array, viewport: Viewport, _elapsed: number) => void
static new (): RenderPipeline
static prototype: RenderPipeline
@@ -7158,7 +7252,7 @@ rotation: Quat
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
@@ -9808,6 +9902,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -10847,7 +10942,7 @@ Plugin
## decodeImagePixels — function @experimental
```
-(src: ImageBitmapSource): Promise<DecodedPixels>
+(src: ImageBitmapSource, maxEdge?: number): Promise<DecodedPixels>
```
## decodeLightmap — function @experimental
@@ -11197,7 +11292,7 @@ EventBindingPlugin
## fetchDecodePixels — function @experimental
```
-(url: string): Promise<DecodedPixels>
+(url: string, maxEdge?: number): Promise<DecodedPixels>
```
## findControllerOwner — function @experimental
@@ -11377,7 +11472,7 @@ FocusPlugin
## getDeviceIdentity — function @experimental
```
-(): DeviceIdentity | null
+(source?: ESEngineModule | null): DeviceIdentity | null
```
## getDeviceLostReport — function @experimental
@@ -11922,7 +12017,7 @@ MeshRendererPlugin
## packagedAppOptions — function @experimental
```
-(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
+(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples" | "quality">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; quality?: QualityConfig; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
```
## packagedRuntimeInit — function @experimental
@@ -11990,6 +12085,11 @@ MeshRendererPlugin
(text: string): { capture: ProfileCapture; } | { error: string; }
```
+## parseQualityConfig — function @experimental
+```
+(value: unknown): QualityConfig
+```
+
## parseRichText — function @experimental
```
(input: string): RichTextRun[]
diff --git a/sdk/etc/spine.api.md b/sdk/etc/spine.api.md
index 20956097a..6839f691c 100644
--- a/sdk/etc/spine.api.md
+++ b/sdk/etc/spine.api.md
@@ -28,7 +28,7 @@ spacing: number
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index 4d81556a7..8f1f0c601 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -462,6 +462,8 @@ renderer_setCullingMask: ((mask: number) => void) | undefined
renderer_setDepthLayers: ((mask: number) => void) | undefined
renderer_setEntityDrawOrder: ((registry: CppRegistry, entitiesPtr: number, count: number) => void) | undefined
renderer_setLodPreview: ((view: number, entity: number, level: number) => void) | undefined
+renderer_setQualityBudgets: ((atlasSize: number, cellSize: number, cascades: number, particleLimit: number) => void) | undefined
+renderer_setShadowDistance: ((distance: number) => void) | undefined
renderer_setStage: (stage: number) => void
renderer_setTextureParams: (textureId: number, minFilter: number, magFilter: number, wrapS: number, wrapT: number) => void
renderer_setViewId: ((view: number) => void) | undefined
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index d93eab85e..fb68c1493 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -1,7 +1,7 @@
# API surface — esengine/wechat
<!-- Generated by tools/api-surface.mjs — do not edit. Run --update to accept changes. -->
-Symbols: 115 public · 91 beta · 1538 experimental · 3 deprecated
+Symbols: 115 public · 91 beta · 1548 experimental · 3 deprecated
## ANCHOR_AXES — const @experimental
```
@@ -745,6 +745,7 @@ getEntityCount: () => number
getFixedTimestep: () => number
getFrameCosts: () => FrameCosts | null
getFrameScopes: () => ReadonlyMap<string, number> | null
+getFrameTiming: () => Readonly<{ seq: number; frameMs: number; }> | null
getPhaseTimings: () => ReadonlyMap<string, number> | null
getPlaySpeed: () => number
getPlugin: <T extends Plugin>(ctor: new (...args: any[]) => T) => T | undefined
@@ -2069,6 +2070,7 @@ gpuMs: number | undefined
id: number
memory: { wasmBytes?: number; jsHeapBytes?: number; vramBytes?: number; } | undefined
nativeScopes: ScopeCost[] | undefined
+quality: QualityReport | undefined
scopes: ScopeCost[]
systems: SystemCost[]
triangles: number | undefined
@@ -2552,6 +2554,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -2825,6 +2828,23 @@ version: string
{ readonly Unknown: 0; readonly ContextLost: 1; readonly OutOfMemory: 2; readonly Reset: 3; readonly Removed: 4; readonly Destroyed: 5; readonly Validation: 6; readonly Internal: 7; }
```
+## DeviceQualityInfo — interface @experimental
+```
+cores: number | undefined
+gpu: string | undefined
+memoryGB: number | undefined
+model: string | undefined
+```
+
+## DeviceQualityRule — interface @experimental
+```
+gpuIncludes: string | undefined
+level: QualityLevel
+maxCores: number | undefined
+maxMemoryGB: number | undefined
+modelIncludes: string | undefined
+```
+
## DeviceRestoredListener — type @experimental
```
(generation: number) => void
@@ -3856,9 +3876,12 @@ cppCounters: Record<string, number>
cppScopes: Record<string, number>
drawCalls: number
entities: number
+frameMs: number | undefined
gpuMs: number
gpuScopes: Record<string, number>
phases: Record<string, number>
+quality: QualityReport | undefined
+seq: number | undefined
sprites: number
triangles: number
vramBytes: number
@@ -5357,7 +5380,7 @@ textureImport: (ref: string) => ParsedTextureImportSettings | undefined
## PackagedAssetSourceOptions — interface @experimental
```
backend: Backend | undefined
-decodePixels: ((path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
+decodePixels: ((path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>) | undefined
```
## PackagedGameConfig — interface @experimental
@@ -5375,6 +5398,7 @@ msaaSamples: number | undefined
outputTransform: "none" | "aces" | undefined
physicsConfig: Physics2DPluginConfig | undefined
physicsEnabled: boolean | undefined
+quality: QualityConfig | undefined
renderBackend: "webgl2" | "webgpu" | undefined
scenes: { name: string; path: string; }[] | undefined
screenFit: { designWidth: number; designHeight: number; scaleMode: number; matchWidthOrHeight: number; } | undefined
@@ -5793,6 +5817,7 @@ createTextEditor: (() => PlatformTextEditor | null) | undefined
createVideoBackend: ((ctx: VideoBackendContext) => PlatformVideoBackend) | undefined
deviceName: (() => string) | undefined
devicePixelRatio: () => number
+deviceQualityInfo: (() => DeviceQualityInfo) | undefined
family: "minigame" | undefined
fetch: (url: string, options?: PlatformRequestOptions) => Promise<PlatformResponse>
fileExists: (path: string) => Promise<boolean>
@@ -5861,7 +5886,7 @@ width: number
## PlatformCanvas2DContext — interface @experimental
```
clearRect: (x: number, y: number, w: number, h: number) => void
-drawImage: (image: PlatformImageSource, dx: number, dy: number) => void
+drawImage: { (image: PlatformImageSource, dx: number, dy: number): void; (image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void; }
fillStyle: PlatformCanvasPaint
fillText: (text: string, x: number, y: number) => void
font: string
@@ -6167,6 +6192,7 @@ setMsaaSamples: (samples: number) => void
setOutputTransform: (transform: OutputTransform) => void
setOutputViewport: (x: number, y: number, w: number, h: number) => void
setPresentRequired: (required: boolean) => void
+setQualityFilter: (profile: Readonly<QualityProfile> | null) => void
setScreenStack: (stack: PostProcessStack | null) => void
shutdown: () => void
state: PostProcessState
@@ -6469,6 +6495,68 @@ fields: readonly PtrFieldDesc[]
ptrFn: string
```
+## Quality — const @experimental
+```
+ResourceDef<QualityController | null>
+```
+
+## QualityConfig — interface @experimental
+```
+deviceRules: DeviceQualityRule[] | undefined
+dynamicResolution: boolean | undefined
+mode: QualityMode | undefined
+profiles: Partial<Record<QualityLevel, Partial<QualityProfile>>> | undefined
+targetFps: number | undefined
+```
+
+## QualityController — class @experimental
+```
+enabled: boolean
+profile: Readonly<QualityProfile>
+renderScale: number
+report: () => QualityReport
+sample: (frameMs: number, gpuMs?: number) => void
+setLimitation: (reason: string, active: boolean) => void
+setMode: (mode: QualityMode) => void
+static new (config: QualityConfig, device_?: DeviceQualityInfo): QualityController
+static prototype: QualityController
+```
+
+## QualityLevel — type @experimental
+```
+'low' | 'medium' | 'high'
+```
+
+## QualityMode — type @experimental
+```
+'off' | 'auto' | QualityLevel
+```
+
+## QualityProfile — interface @experimental
+```
+minRenderScale: number
+msaaSamples: 2 | 1 | 4 | 8
+particleLimit: number
+postProcess: boolean
+renderScale: number
+shadowAtlasSize: number
+shadowCascades: number
+shadowCellSize: number
+shadowDistance: number
+ssao: boolean
+```
+
+## QualityReport — interface @experimental
+```
+frameMs: number
+level: QualityLevel
+limitations: string[]
+mode: QualityMode
+reason: string
+renderScale: number
+targetFps: number
+```
+
## Quat — interface @public
```
w: number
@@ -6640,9 +6728,12 @@ endScreenCapture: () => void
render: (params: RenderParams) => void
renderCamera: (params: CameraRenderParams) => void
renderScreenOverlay: (registry: { _cpp: CppRegistry; }, overlay: ScreenOverlayData, target?: number) => void
+renderingEnabled: boolean
runPreFlushCallbacks: (registry: { _cpp: CppRegistry; }) => void
setActiveScenes: (scenes: Set<string> | null) => void
setPostProcess: (pp: PostProcessAPI | null) => void
+setQuality: (quality: QualityController, apply?: () => void) => void
+setRenderingEnabled: (enabled: boolean) => void
submitScene: (registry: { _cpp: CppRegistry; }, viewProjection: Float32Array, viewport: Viewport, _elapsed: number) => void
static new (): RenderPipeline
static prototype: RenderPipeline
@@ -6895,7 +6986,7 @@ rotation: Quat
```
backend: Backend
compressedTexture: ((path: string) => Promise<Uint8Array | "pending" | null>) | undefined
-decodePixels: (path: string, flip: boolean) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
+decodePixels: (path: string, flip: boolean, maxEdge?: number) => Promise<{ width: number; height: number; pixels: Uint8Array; }>
listAssetPaths: (() => string[]) | undefined
resolveAddress: ((ref: string) => string | null) | undefined
resolveRef: ((ref: string) => string) | undefined
@@ -9563,6 +9654,7 @@ getViewportSize: (() => { width: number; height: number; }) | undefined
msaaSamples: number | undefined
outputTransform: OutputTransform | undefined
plugins: Plugin[] | undefined
+quality: QualityConfig | undefined
randomSeed: number | undefined
renderSurface: RenderSurfaceSource | undefined
screenFit: ScreenScalingData | undefined
@@ -10597,7 +10689,7 @@ Plugin
## decodeImagePixels — function @experimental
```
-(src: ImageBitmapSource): Promise<DecodedPixels>
+(src: ImageBitmapSource, maxEdge?: number): Promise<DecodedPixels>
```
## decodeLightmap — function @experimental
@@ -10947,7 +11039,7 @@ EventBindingPlugin
## fetchDecodePixels — function @experimental
```
-(url: string): Promise<DecodedPixels>
+(url: string, maxEdge?: number): Promise<DecodedPixels>
```
## findControllerOwner — function @experimental
@@ -11127,7 +11219,7 @@ FocusPlugin
## getDeviceIdentity — function @experimental
```
-(): DeviceIdentity | null
+(source?: ESEngineModule | null): DeviceIdentity | null
```
## getDeviceLostReport — function @experimental
@@ -11672,7 +11764,7 @@ MeshRendererPlugin
## packagedAppOptions — function @experimental
```
-(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
+(config: Pick<PackagedGameConfig, "ySortLayers" | "depthLayers" | "colorSpace" | "outputTransform" | "screenFit" | "msaaSamples" | "quality">): { ySortLayers?: number; depthLayers?: number; colorSpace?: "gamma" | "linear"; outputTransform?: "none" | "aces"; msaaSamples?: number; quality?: QualityConfig; renderBackend?: "webgl2" | "webgpu"; screenFit?: PackagedGameConfig["screenFit"]; }
```
## packagedRuntimeInit — function @experimental
@@ -11740,6 +11832,11 @@ MeshRendererPlugin
(text: string): { capture: ProfileCapture; } | { error: string; }
```
+## parseQualityConfig — function @experimental
+```
+(value: unknown): QualityConfig
+```
+
## parseRichText — function @experimental
```
(input: string): RichTextRun[]
diff --git a/sdk/src/ai/perception/PerceptionPlugin.ts b/sdk/src/ai/perception/PerceptionPlugin.ts
index a482e4e4b..9c331694b 100644
--- a/sdk/src/ai/perception/PerceptionPlugin.ts
+++ b/sdk/src/ai/perception/PerceptionPlugin.ts
@@ -17,7 +17,8 @@ import { defineSystem, Schedule, GetWorld } from '../../ecs/system';
import { playModeOnly } from '../../ecs/env';
import { Transform } from '../../ecs/component';
import type { AnyComponentDef, ComponentData } from '../../ecs/component';
-import { Physics2D, type Physics2DAPI } from '../../physics';
+import { Physics2D } from '../../physics/Physics2DPlugin';
+import type { Physics2DAPI } from '../../physics/Physics2D';
import { Physics3D } from '../../physics3d/Physics3DPlugin';
import type { Physics3DQueries } from '../../physics3d/Physics3DQueries';
import { senseTarget, facingFromRotation } from './sense';
diff --git a/sdk/src/app/app.ts b/sdk/src/app/app.ts
index 08d37d0a5..bb01bb9a8 100644
--- a/sdk/src/app/app.ts
+++ b/sdk/src/app/app.ts
@@ -6,6 +6,8 @@
*/
import { World } from '../ecs/world';
+import { installQuality } from '../render/qualityRuntime';
+import type { QualityConfig } from '../render/quality';
import { Schedule, SystemDef, SystemRunner, SystemSet, mergeOrderingEdges, rescopeSystem, type RunCondition } from '../ecs/system';
import { builtinResource, declaredResource, ResourceStorage, Time, TimeData, type ResourceDef } from '../ecs/resource';
import { Speculation, SpeculationInstance } from '../ecs/speculation';
@@ -149,6 +151,10 @@ export class App {
private readonly setMembership_ = new Map<string, string[]>();
private running_ = false;
+ private loopVersion_ = 0;
+ private queuedFrame_: number | null = null;
+ private frameInFlight_: Promise<void> | null = null;
+ private frameTiming_: { seq: number; frameMs: number } | null = null;
private lastTime_ = 0;
private fixedTimestep_ = 1 / 60;
private fixedAccumulator_ = 0;
@@ -773,6 +779,11 @@ export class App {
return this.phaseTimings_;
}
+ /** @experimental Completed frame interval before simulation speed or delta clamping. */
+ getFrameTiming(): Readonly<{ seq: number; frameMs: number }> | null {
+ return this.frameTiming_;
+ }
+
/**
* Sub-frame CPU scopes recorded this frame via {@link measureFrameScope} —
* the finer breakdown within a single system, keyed by scope name. Null when
@@ -1030,21 +1041,22 @@ export class App {
async stepFrames(frames = 1, dt = 1 / 60): Promise<void> {
const wasRunning = this.running_;
const wasPaused = this.user_paused_;
- // The in-flight rAF callback returns without rescheduling, so nothing else
- // ticks the world while this runs.
+ this.invalidateLoop_();
+ const version = this.loopVersion_;
this.running_ = false;
- this.user_paused_ = false;
try {
+ await this.frameInFlight_;
+ this.user_paused_ = false;
for (let i = 0; i < frames; i++) await this.tick(dt);
} finally {
this.user_paused_ = wasPaused;
- if (wasRunning) {
+ if (wasRunning && version === this.loopVersion_) {
this.lastTime_ = platformNow();
this.running_ = true;
// Resumed on the next animation frame, not by starting one here:
// a frame begun inside this call's own microtask drain swallows
// the input edge a caller injects the moment it returns.
- if (typeof requestAnimationFrame === 'function') requestAnimationFrame(this.onAnimationFrame_);
+ if (typeof requestAnimationFrame === 'function') this.queueLoopFrame_();
else void this.mainLoop();
}
}
@@ -1063,16 +1075,26 @@ export class App {
this.mainLoop();
}
- /**
- * @param rafTime The host's animation-frame timestamp, when it passes one.
- */
- /** What every requestAnimationFrame is handed: a plain function, because a host
- * may refuse an async one — vivo's quick game warned "handler is not a function"
- * and every game stood on its first frame. */
- private readonly onAnimationFrame_ = (rafTime?: number): Promise<void> => this.mainLoop(rafTime);
+ private invalidateLoop_(): void {
+ this.loopVersion_++;
+ if (this.queuedFrame_ !== null && typeof cancelAnimationFrame === 'function') {
+ cancelAnimationFrame(this.queuedFrame_);
+ }
+ this.queuedFrame_ = null;
+ }
- private mainLoop = async (rafTime?: number): Promise<void> => {
- if (!this.running_) {
+ private queueLoopFrame_(): void {
+ if (typeof requestAnimationFrame !== 'function') return;
+ const version = this.loopVersion_;
+ this.queuedFrame_ = requestAnimationFrame((time) => {
+ if (version !== this.loopVersion_) return;
+ this.queuedFrame_ = null;
+ return this.mainLoop(time, version);
+ });
+ }
+
+ private mainLoop = async (rafTime?: number, version = this.loopVersion_): Promise<void> => {
+ if (!this.running_ || version !== this.loopVersion_) {
return;
}
@@ -1086,7 +1108,7 @@ export class App {
// loses to jitter half the time and waits a third (30 fps on 60 Hz ran at 24).
if (this.targetFrameInterval_ > 0) {
if (currentTime < this.nextCapFrameAt_ - CAP_JITTER_MS) {
- requestAnimationFrame(this.onAnimationFrame_);
+ this.queueLoopFrame_();
return;
}
// More than a frame behind (a stall, a hidden page): the cadence restarts here.
@@ -1104,12 +1126,17 @@ export class App {
const delta = rawDelta * this.play_speed_;
await this.flushStartupSystems_();
- await this.runFrame_(delta);
+ if (!this.running_ || version !== this.loopVersion_) return;
+ const frame = this.runFrame_(delta, Math.max(0, deltaMs));
+ this.frameInFlight_ = frame;
+ try { await frame; }
+ finally { if (this.frameInFlight_ === frame) this.frameInFlight_ = null; }
- requestAnimationFrame(this.onAnimationFrame_);
+ if (this.running_ && version === this.loopVersion_) this.queueLoopFrame_();
};
quit(options?: { keepRenderer?: boolean }): void {
+ this.invalidateLoop_();
this.running_ = false;
for (let i = this.installed_plugins_.length - 1; i >= 0; i--) {
@@ -1204,7 +1231,7 @@ export class App {
this.finishPlugins_();
}
- private async runFrame_(delta: number): Promise<void> {
+ private async runFrame_(delta: number, frameMs = delta * 1000): Promise<void> {
this.runner_?.clearTimings();
this.phaseTimings_?.clear();
this.frameScopes_?.clear();
@@ -1269,8 +1296,9 @@ export class App {
}
}
+ this.frameTiming_ = { seq: (this.frameTiming_?.seq ?? 0) + 1, frameMs };
for (const observe of this.frameObservers_) {
- try { observe(delta * 1000); } catch (e) {
+ try { observe(frameMs); } catch (e) {
log.error('app', 'Frame observer error', e);
}
}
@@ -1676,6 +1704,7 @@ export interface WebAppOptions {
* device clamps it, so this is what the project WANTS, not what it gets.
*/
msaaSamples?: number;
+ quality?: QualityConfig;
/**
* Seed the engine's randomness so this run reproduces — a replay, a bug
* report, a pixel assertion. Absent, every run differs, which is what a
@@ -1798,6 +1827,7 @@ export function createWebApp(module: ESEngineModule, options?: WebAppOptions): A
app.insertResource(ScreenScaling, { ...options.screenFit });
}
+ if (options?.quality) installQuality(app, options.quality, options.msaaSamples ?? 4);
return app;
}
diff --git a/sdk/src/app/profileCapture.ts b/sdk/src/app/profileCapture.ts
index 3e90b9800..214d3b8ae 100644
--- a/sdk/src/app/profileCapture.ts
+++ b/sdk/src/app/profileCapture.ts
@@ -3,6 +3,7 @@
/**
* @file profileCapture.ts — recorded frames as a portable document.
*/
+import type { QualityReport } from '../render/quality';
import {
buildFrameProfile,
meanFrameProfile,
@@ -31,6 +32,7 @@ export interface CaptureSource {
* and no reader can drift from what the panel shows.
*/
export interface CapturedFrame {
+ quality?: QualityReport;
id: number;
dtMs: number;
systems: SystemCost[];
diff --git a/sdk/src/asset/imageDecode.ts b/sdk/src/asset/imageDecode.ts
index b5b35e4e5..2b3b8589f 100644
--- a/sdk/src/asset/imageDecode.ts
+++ b/sdk/src/asset/imageDecode.ts
@@ -54,10 +54,10 @@ export interface DecodedPixels {
* consumer chooses the final convention via `createTextureFromPixels(flipY)` —
* v=1=top for general textures, v=0=top for spine / bitmap fonts.
*/
-export async function decodeImagePixels(src: ImageBitmapSource): Promise<DecodedPixels> {
+export async function decodeImagePixels(src: ImageBitmapSource, maxEdge = 0): Promise<DecodedPixels> {
const bitmap = await decodeImageBitmap(src, false);
try {
- return readImagePixels(bitmap);
+ return readImagePixels(bitmap, maxEdge);
} finally {
bitmap.close?.();
}
@@ -70,14 +70,16 @@ export async function decodeImagePixels(src: ImageBitmapSource): Promise<Decoded
* they stand: dividing them by alpha again drives every half-transparent texel
* toward white, and an RGBM texel — whose alpha IS its brightness — to grey.
*/
-export function readImagePixels(image: PlatformImage | ImageBitmap): DecodedPixels {
- const { width, height } = image;
+export function readImagePixels(image: PlatformImage | ImageBitmap, maxEdge = 0): DecodedPixels {
+ const scale = maxEdge > 0 ? Math.min(1, maxEdge / Math.max(image.width, image.height)) : 1;
+ const width = Math.max(1, Math.round(image.width * scale));
+ const height = Math.max(1, Math.round(image.height * scale));
const canvas = platformCreateCanvas(width, height);
canvas.width = width;
canvas.height = height;
const ctx = canvas.getContext('2d', { willReadFrequently: true });
if (!ctx) throw new Error('imageDecode: 2D context unavailable for pixel decode');
- ctx.drawImage(image, 0, 0);
+ ctx.drawImage(image, 0, 0, width, height);
const data = ctx.getImageData(0, 0, width, height);
return { width, height, pixels: new Uint8Array(data.data.buffer) };
}
@@ -88,8 +90,8 @@ export function readImagePixels(image: PlatformImage | ImageBitmap): DecodedPixe
* `<img>` taints the canvas on custom schemes; fetch→blob sidesteps it). Uses the
* global `fetch` — these callers all run in a browser/electron context.
*/
-export async function fetchDecodePixels(url: string): Promise<DecodedPixels> {
+export async function fetchDecodePixels(url: string, maxEdge = 0): Promise<DecodedPixels> {
const res = await fetch(url);
if (!res.ok) throw new Error(`image fetch failed (${res.status}): ${url}`);
- return decodeImagePixels(await res.blob());
+ return decodeImagePixels(await res.blob(), maxEdge);
}
diff --git a/sdk/src/asset/loaders/TextureLoader.ts b/sdk/src/asset/loaders/TextureLoader.ts
index 44ca1b8ce..24000b14f 100644
--- a/sdk/src/asset/loaders/TextureLoader.ts
+++ b/sdk/src/asset/loaders/TextureLoader.ts
@@ -31,6 +31,7 @@ import { createTextureFromPixels, type TextureParams } from '../../runtime/runti
export type TexturePixelDecoder = (
path: string,
flip: boolean,
+ maxEdge?: number,
) => Promise<{ width: number; height: number; pixels: Uint8Array }>;
/**
@@ -242,7 +243,7 @@ export class TextureLoader implements AssetLoader<TextureResult> {
// uploads through the shared createTexture path — the same code the old
// runtimeLoader.loadTextures used — instead of a URL-based <img>.
if (this.pixelDecoder_) {
- const result = await this.pixelDecoder_(path, flip);
+ const result = await this.pixelDecoder_(path, flip, preview ? TEXTURE_PREVIEW_EDGE : 0);
const handle = createTextureFromPixels(this.module_, result, TextureContent.Asset, flip, pixelParams(settings));
return { handle, width: result.width, height: result.height };
}
diff --git a/sdk/src/camera/CameraPlugin.ts b/sdk/src/camera/CameraPlugin.ts
index f7b222c79..6a502022b 100644
--- a/sdk/src/camera/CameraPlugin.ts
+++ b/sdk/src/camera/CameraPlugin.ts
@@ -793,6 +793,7 @@ export function cameraPlugin(
_name: 'RenderSystem',
_params: [],
_fn: () => {
+ if (!pipeline.renderingEnabled) return;
const { width, height } = viewport();
if (width === 0 || height === 0) return;
const canvasEntity = canvasEntityOf(module, cppRegistry);
diff --git a/sdk/src/core-render.ts b/sdk/src/core-render.ts
index e271f4629..6002cc168 100644
--- a/sdk/src/core-render.ts
+++ b/sdk/src/core-render.ts
@@ -298,3 +298,9 @@ export {
type PreSceneDrawCallback,
type PreSceneDrawInfo,
} from './render/customDraw';
+export { QualityController, parseQualityConfig } from './render/quality';
+export type {
+ QualityConfig, QualityProfile, QualityLevel, QualityMode,
+ QualityReport, DeviceQualityInfo, DeviceQualityRule,
+} from './render/quality';
+export { Quality } from './render/qualityRuntime';
diff --git a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
index 48b1152c2..c101eac0f 100644
--- a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
+++ b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
@@ -186,6 +186,8 @@ export interface NativeEngineApi {
renderer_setDepthLayers?(mask: number): void;
renderer_setEntityDrawOrder?(registry: unknown, entitiesPtr: number, count: number): void;
renderer_setLodPreview?(view: number, entity: number, level: number): void;
+ renderer_setQualityBudgets?(atlasSize: number, cellSize: number, cascades: number, particleLimit: number): void;
+ renderer_setShadowDistance?(distance: number): void;
renderer_setStage?(stage: number): void;
renderer_setTextureParams?(textureId: number, minFilter: number, magFilter: number, wrapS: number, wrapT: number): void;
renderer_setViewId?(view: number): void;
@@ -464,6 +466,8 @@ export function createNativeEngineApi(
bind('renderer_setDepthLayers', 'es_renderer_setDepthLayers', false);
bind('renderer_setEntityDrawOrder', 'es_renderer_setEntityDrawOrder', true);
bind('renderer_setLodPreview', 'es_renderer_setLodPreview', false);
+ bind('renderer_setQualityBudgets', 'es_renderer_setQualityBudgets', false);
+ bind('renderer_setShadowDistance', 'es_renderer_setShadowDistance', false);
bind('renderer_setStage', 'es_renderer_setStage', false);
bind('renderer_setTextureParams', 'es_renderer_setTextureParams', false);
bind('renderer_setViewId', 'es_renderer_setViewId', false);
diff --git a/sdk/src/lightmap/charts.ts b/sdk/src/lightmap/charts.ts
index 84a65eef8..6505aa9f4 100644
--- a/sdk/src/lightmap/charts.ts
+++ b/sdk/src/lightmap/charts.ts
@@ -108,8 +108,15 @@ export function buildCharts(positions: Float32Array, tris: Tri[], rep: Int32Arra
const out: number[] = [];
const push = (u: number, v: number): void => {
const lo = Math.min(rep[u], rep[v]), hi = Math.max(rep[u], rep[v]);
- for (const other of edges.get(lo * 67108864 + hi) ?? []) {
- if (other !== t) out.push(other);
+ if (lo === hi) return;
+ const shared = edges.get(lo * 67108864 + hi);
+ if (shared?.length !== 2) return;
+ for (const other of shared) {
+ if (other === t) continue;
+ const next = tris[other];
+ if ((rep[next.a] === rep[v] && rep[next.b] === rep[u])
+ || (rep[next.b] === rep[v] && rep[next.c] === rep[u])
+ || (rep[next.c] === rep[v] && rep[next.a] === rep[u])) out.push(other);
}
};
push(tri.a, tri.b); push(tri.b, tri.c); push(tri.c, tri.a);
diff --git a/sdk/src/platform/minigame/adapter.ts b/sdk/src/platform/minigame/adapter.ts
index 33667f3b9..0b7a1abb3 100644
--- a/sdk/src/platform/minigame/adapter.ts
+++ b/sdk/src/platform/minigame/adapter.ts
@@ -585,6 +585,19 @@ export class MiniGamePlatformAdapter implements PlatformAdapter {
}
}
+ deviceQualityInfo(): { model?: string; memoryGB?: number } {
+ try {
+ const info = this.g_.getDeviceInfo?.() ?? this.g_.getSystemInfoSync?.();
+ const memory = Number(info?.memorySize);
+ return {
+ model: info?.model?.replace(/<.*>$/, '').trim(),
+ ...(Number.isFinite(memory) && memory > 0 ? { memoryGB: memory / 1024 } : {}),
+ };
+ } catch {
+ return {};
+ }
+ }
+
language(): string {
try {
// Hosts report 'zh_CN'-style tags; platformLanguage() normalizes underscores.
diff --git a/sdk/src/platform/minigame/api.ts b/sdk/src/platform/minigame/api.ts
index feef0b666..9084901a5 100644
--- a/sdk/src/platform/minigame/api.ts
+++ b/sdk/src/platform/minigame/api.ts
@@ -80,6 +80,7 @@ export interface MiniGameSystemInfo {
* on others, so a capability has to read it. */
platform?: string;
model?: string;
+ memorySize?: number | string;
}
export interface MiniGameTouch {
@@ -259,6 +260,7 @@ export interface MiniGameGlobal {
createInnerAudioContext(): MiniGameInnerAudioContext;
connectSocket(opts: { url: string; protocols?: string[] }): MiniGameSocketTask;
getSystemInfoSync(): MiniGameSystemInfo;
+ getDeviceInfo?(): MiniGameSystemInfo;
onTouchStart(cb: (res: MiniGameTouchEvent) => void): void;
onTouchMove(cb: (res: MiniGameTouchEvent) => void): void;
diff --git a/sdk/src/platform/types.ts b/sdk/src/platform/types.ts
index e8add7462..ad15a671d 100644
--- a/sdk/src/platform/types.ts
+++ b/sdk/src/platform/types.ts
@@ -6,6 +6,7 @@
*/
import type { AchievementProvider } from '../services/achievements';
+import type { DeviceQualityInfo } from '../render/quality';
// =============================================================================
// Response Types
@@ -260,6 +261,7 @@ export type PlatformCanvasPaint = string | object;
export interface PlatformCanvas2DContext {
// Image decode.
drawImage(image: PlatformImageSource, dx: number, dy: number): void;
+ drawImage(image: PlatformImageSource, dx: number, dy: number, dw: number, dh: number): void;
getImageData(sx: number, sy: number, sw: number, sh: number): PlatformImageData;
clearRect(x: number, y: number, w: number, h: number): void;
// Glyph rasterization (ui/text/glyph-rasterizer.ts).
@@ -365,6 +367,7 @@ export type PlatformName = 'web' | 'wechat' | 'douyin' | 'node' | 'native' | (st
export type PlatformFamily = 'minigame';
export interface PlatformAdapter {
+ deviceQualityInfo?(): DeviceQualityInfo;
readonly name: PlatformName;
/**
diff --git a/sdk/src/platform/web.ts b/sdk/src/platform/web.ts
index 69c68d28a..e05068f32 100644
--- a/sdk/src/platform/web.ts
+++ b/sdk/src/platform/web.ts
@@ -322,6 +322,12 @@ class WebPlatformAdapter implements PlatformAdapter {
return typeof navigator !== 'undefined' ? browserDeviceName(navigator.userAgent) : '';
}
+ deviceQualityInfo(): { memoryGB?: number; cores?: number } {
+ if (typeof navigator === 'undefined') return {};
+ return { memoryGB: (navigator as Navigator & { deviceMemory?: number }).deviceMemory,
+ cores: navigator.hardwareConcurrency };
+ }
+
/**
* Both ways an error reaches the browser with nobody holding it.
*
diff --git a/sdk/src/postprocess/PostProcessAPI.ts b/sdk/src/postprocess/PostProcessAPI.ts
index a2a83101e..baa83c2ee 100644
--- a/sdk/src/postprocess/PostProcessAPI.ts
+++ b/sdk/src/postprocess/PostProcessAPI.ts
@@ -7,6 +7,7 @@ import { defineResource } from '../ecs/resource';
import { handleWasmError } from '../wasm/wasmError';
import { WasmBridge } from '../wasm/WasmBridge';
import { PostProcessStack, PostProcessState } from './PostProcessStack';
+import type { QualityProfile } from '../render/quality';
/**
* The post-process entry points as a core that HAS them answers them. Named, not
@@ -100,7 +101,8 @@ function getModule(): PostProcessCore {
* camera (see {@link PostProcessAPI._resetAfterCamera}), so "not dirty" says the
* stack is unchanged, NOT that the engine still holds it.
*/
-export function syncStackToWasm(stack: PostProcessStack, force = false): void {
+export function syncStackToWasm(stack: PostProcessStack, force = false,
+ allow: (name: string) => boolean = () => true): void {
if (!force && !stack.isDirty) return;
const m = getModule();
@@ -113,7 +115,7 @@ export function syncStackToWasm(stack: PostProcessStack, force = false): void {
}
for (const pass of stack.passes) {
- if (!pass.enabled) continue;
+ if (!pass.enabled || !allow(pass.name)) continue;
try {
m.postprocess_addPass(pass.name, pass.shader);
// Only when it is not 1: every pass that predates fractional sizing
@@ -194,6 +196,18 @@ export class PostProcessAPI {
* pushed last frame and never edited must still be pushed again this frame.
*/
private engineStack_: PostProcessStack | null = null;
+ private qualityFilter_: Readonly<QualityProfile> | null = null;
+
+ setQualityFilter(profile: Readonly<QualityProfile> | null): void {
+ if (this.qualityFilter_ === profile) return;
+ this.qualityFilter_ = profile;
+ this.engineStack_ = null;
+ }
+
+ private allowQualityPass_ = (name: string): boolean => {
+ const q = this.qualityFilter_;
+ return q === null || (q.postProcess && (q.ssao || !name.toLowerCase().startsWith('ssao')));
+ };
// -- per-App state (stacks / bindings / screen stack) --------------------
@@ -402,7 +416,7 @@ export class PostProcessAPI {
}
this.setBypass(false);
- syncStackToWasm(stack, /*force=*/this.engineStack_ !== stack);
+ syncStackToWasm(stack, this.engineStack_ !== stack, this.allowQualityPass_);
this.engineStack_ = stack;
}
@@ -445,7 +459,7 @@ export class PostProcessAPI {
}
for (const pass of stack.passes) {
- if (!pass.enabled) continue;
+ if (!pass.enabled || !this.allowQualityPass_(pass.name)) continue;
try {
m.postprocess_addScreenPass(pass.name, pass.shader);
} catch (e) {
diff --git a/sdk/src/render/quality.ts b/sdk/src/render/quality.ts
new file mode 100644
index 000000000..f4a2e7a46
--- /dev/null
+++ b/sdk/src/render/quality.ts
@@ -0,0 +1,228 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+
+export type QualityLevel = 'low' | 'medium' | 'high';
+export type QualityMode = 'off' | 'auto' | QualityLevel;
+
+export interface DeviceQualityInfo {
+ model?: string;
+ gpu?: string;
+ memoryGB?: number;
+ cores?: number;
+}
+
+export interface QualityProfile {
+ renderScale: number;
+ minRenderScale: number;
+ msaaSamples: 1 | 2 | 4 | 8;
+ shadowAtlasSize: number;
+ shadowCellSize: number;
+ shadowCascades: number;
+ shadowDistance: number;
+ particleLimit: number;
+ postProcess: boolean;
+ ssao: boolean;
+}
+
+export interface DeviceQualityRule {
+ level: QualityLevel;
+ modelIncludes?: string;
+ gpuIncludes?: string;
+ maxMemoryGB?: number;
+ maxCores?: number;
+}
+
+/** @experimental */
+export interface QualityConfig {
+ mode?: QualityMode;
+ targetFps?: number;
+ dynamicResolution?: boolean;
+ profiles?: Partial<Record<QualityLevel, Partial<QualityProfile>>>;
+ deviceRules?: DeviceQualityRule[];
+}
+
+const LEVELS: readonly QualityLevel[] = ['low', 'medium', 'high'];
+const PROFILES: Record<QualityLevel, QualityProfile> = {
+ low: {
+ renderScale: 0.75, minRenderScale: 0.5, msaaSamples: 1,
+ shadowAtlasSize: 1024, shadowCellSize: 256, shadowCascades: 2,
+ shadowDistance: 0, particleLimit: 1000, postProcess: true, ssao: false,
+ },
+ medium: {
+ renderScale: 1, minRenderScale: 0.65, msaaSamples: 2,
+ shadowAtlasSize: 2048, shadowCellSize: 512, shadowCascades: 3,
+ shadowDistance: 0, particleLimit: 5000, postProcess: true, ssao: true,
+ },
+ high: {
+ renderScale: 1, minRenderScale: 0.75, msaaSamples: 4,
+ shadowAtlasSize: 2048, shadowCellSize: 512, shadowCascades: 4,
+ shadowDistance: 0, particleLimit: 20000, postProcess: true, ssao: true,
+ },
+};
+
+function record(value: unknown): Record<string, unknown> {
+ return value !== null && typeof value === 'object' && !Array.isArray(value)
+ ? value as Record<string, unknown> : {};
+}
+
+function finite(value: unknown, fallback: number, min: number, max: number): number {
+ return typeof value === 'number' && Number.isFinite(value)
+ ? Math.min(max, Math.max(min, value)) : fallback;
+}
+
+/** @experimental */
+export function parseQualityConfig(value: unknown): QualityConfig {
+ const raw = record(value);
+ const mode = raw.mode === 'auto' || LEVELS.includes(raw.mode as QualityLevel)
+ ? raw.mode as QualityMode : 'off';
+ const config: QualityConfig = {
+ mode, targetFps: finite(raw.targetFps, 60, 15, 120),
+ dynamicResolution: raw.dynamicResolution === true,
+ };
+ if (raw.profiles) {
+ config.profiles = {};
+ for (const level of LEVELS) {
+ if (!record(raw.profiles)[level]) continue;
+ config.profiles[level] = resolveProfile(level, record(raw.profiles)[level]);
+ }
+ }
+ if (Array.isArray(raw.deviceRules)) {
+ config.deviceRules = raw.deviceRules.slice(0, 64).flatMap(value => {
+ const r = record(value);
+ if (!LEVELS.includes(r.level as QualityLevel)) return [];
+ const rule: DeviceQualityRule = { level: r.level as QualityLevel };
+ for (const key of ['modelIncludes', 'gpuIncludes'] as const) {
+ if (typeof r[key] === 'string' && r[key].trim()) rule[key] = r[key].trim();
+ }
+ for (const key of ['maxMemoryGB', 'maxCores'] as const) {
+ if (typeof r[key] === 'number' && Number.isFinite(r[key]) && r[key] > 0) {
+ rule[key] = r[key];
+ }
+ }
+ return Object.keys(rule).length > 1 ? [rule] : [];
+ });
+ }
+ return config;
+}
+
+function resolveProfile(level: QualityLevel, value: unknown): QualityProfile {
+ const base = PROFILES[level];
+ const r = record(value);
+ const renderScale = finite(r.renderScale, base.renderScale, 0.25, 1);
+ const atlas = [512, 1024, 2048, 4096].includes(r.shadowAtlasSize as number)
+ ? r.shadowAtlasSize as number : base.shadowAtlasSize;
+ const cell = [128, 256, 512, 1024].includes(r.shadowCellSize as number)
+ ? r.shadowCellSize as number : base.shadowCellSize;
+ return {
+ renderScale,
+ minRenderScale: finite(r.minRenderScale, Math.min(base.minRenderScale, renderScale),
+ 0.25, renderScale),
+ msaaSamples: [1, 2, 4, 8].includes(r.msaaSamples as number)
+ ? r.msaaSamples as QualityProfile['msaaSamples'] : base.msaaSamples,
+ shadowAtlasSize: atlas,
+ shadowCellSize: Math.min(cell, atlas / 2),
+ shadowCascades: Math.round(finite(r.shadowCascades, base.shadowCascades, 1, 4)),
+ shadowDistance: finite(r.shadowDistance, base.shadowDistance, 0, 10000000),
+ particleLimit: Math.round(finite(r.particleLimit, base.particleLimit, 0, 1000000)),
+ postProcess: typeof r.postProcess === 'boolean' ? r.postProcess : base.postProcess,
+ ssao: typeof r.ssao === 'boolean' ? r.ssao : base.ssao,
+ };
+}
+
+function matches(rule: DeviceQualityRule, info: DeviceQualityInfo): boolean {
+ const includes = (text: string | undefined, part: string): boolean =>
+ text?.toLowerCase().includes(part.toLowerCase()) ?? false;
+ return (!rule.modelIncludes || includes(info.model, rule.modelIncludes))
+ && (!rule.gpuIncludes || includes(info.gpu, rule.gpuIncludes))
+ && (rule.maxMemoryGB === undefined
+ || (info.memoryGB !== undefined && info.memoryGB <= rule.maxMemoryGB))
+ && (rule.maxCores === undefined
+ || (info.cores !== undefined && info.cores <= rule.maxCores));
+}
+
+export interface QualityReport {
+ mode: QualityMode;
+ level: QualityLevel;
+ renderScale: number;
+ targetFps: number;
+ frameMs: number;
+ reason: string;
+ limitations: string[];
+}
+
+/** @experimental Per-app policy; authored scene components remain unchanged. */
+export class QualityController {
+ private config_: QualityConfig;
+ private level_: QualityLevel = 'high';
+ private profile_: QualityProfile = PROFILES.high;
+ private scale_ = 1;
+ private average_ = 0;
+ private pressureMs_ = 0;
+ private recoveryMs_ = 0;
+ private reason_ = 'disabled';
+ private modeReason_ = 'disabled';
+ private limitations_ = new Set<string>();
+
+ constructor(config: QualityConfig, private readonly device_: DeviceQualityInfo = {}) {
+ this.config_ = parseQualityConfig(config);
+ this.setMode(this.config_.mode ?? 'off');
+ }
+
+ get enabled(): boolean { return this.config_.mode !== 'off'; }
+ get profile(): Readonly<QualityProfile> { return this.profile_; }
+ get renderScale(): number { return this.enabled ? this.scale_ : 1; }
+
+ setMode(mode: QualityMode): void {
+ this.config_.mode = mode;
+ const rule = this.config_.deviceRules?.find(r => matches(r, this.device_));
+ const low = (this.device_.memoryGB !== undefined && this.device_.memoryGB <= 2)
+ || (this.device_.cores !== undefined && this.device_.cores <= 2);
+ this.level_ = mode === 'off' ? 'high' : mode === 'auto'
+ ? rule?.level ?? (low ? 'low' : 'medium') : mode;
+ this.profile_ = resolveProfile(this.level_, this.config_.profiles?.[this.level_]);
+ this.scale_ = mode === 'off' ? 1 : this.profile_.renderScale;
+ this.average_ = this.pressureMs_ = this.recoveryMs_ = 0;
+ this.reason_ = mode === 'off' ? 'disabled' : mode !== 'auto' ? 'manual'
+ : rule ? 'device-rule' : low ? 'device-capacity' : 'device-unknown';
+ this.modeReason_ = this.reason_;
+ }
+
+ setLimitation(reason: string, active: boolean): void {
+ if (active) this.limitations_.add(reason);
+ else this.limitations_.delete(reason);
+ }
+
+ sample(frameMs: number, gpuMs = -1): void {
+ if (!this.enabled || !this.config_.dynamicResolution) return;
+ if (!Number.isFinite(frameMs) || frameMs <= 0 || frameMs > 250) {
+ this.average_ = this.pressureMs_ = this.recoveryMs_ = 0;
+ return;
+ }
+ const ms = Number.isFinite(gpuMs) && gpuMs > 0 ? gpuMs : frameMs;
+ const weight = 1 - Math.exp(-frameMs / 250);
+ this.average_ = this.average_ === 0 ? ms : this.average_ + weight * (ms - this.average_);
+ const budget = 1000 / (this.config_.targetFps ?? 60);
+ this.pressureMs_ = this.average_ > budget * 1.1 ? this.pressureMs_ + frameMs : 0;
+ this.recoveryMs_ = this.average_ < budget * 0.8 ? this.recoveryMs_ + frameMs : 0;
+ if (this.pressureMs_ >= 500) {
+ this.scale_ = Math.max(this.profile_.minRenderScale,
+ Math.round((this.scale_ - 0.05) * 100) / 100);
+ this.reason_ = this.scale_ === this.profile_.minRenderScale
+ ? 'resolution-floor' : gpuMs > 0 ? 'gpu-pressure' : 'frame-pressure';
+ this.pressureMs_ = this.recoveryMs_ = 0;
+ } else if (this.recoveryMs_ >= 2000) {
+ this.scale_ = Math.min(this.profile_.renderScale,
+ Math.round((this.scale_ + 0.05) * 100) / 100);
+ this.reason_ = this.scale_ === this.profile_.renderScale ? this.modeReason_ : 'recovery';
+ this.pressureMs_ = this.recoveryMs_ = 0;
+ }
+ }
+
+ report(): QualityReport {
+ return {
+ mode: this.config_.mode ?? 'off', level: this.level_,
+ renderScale: this.renderScale, targetFps: this.config_.targetFps ?? 60,
+ frameMs: this.average_, reason: this.reason_, limitations: [...this.limitations_],
+ };
+ }
+}
diff --git a/sdk/src/render/qualityRuntime.ts b/sdk/src/render/qualityRuntime.ts
new file mode 100644
index 000000000..94faf7f58
--- /dev/null
+++ b/sdk/src/render/qualityRuntime.ts
@@ -0,0 +1,52 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+
+import type { App } from '../app/app';
+import { defineResource } from '../ecs/resource';
+import { engineApi } from '../ecs/bridge/engineApi';
+import { getPlatform, platformNow, platformOnAppHide, platformOnAppShow } from '../platform';
+import { QualityController, type QualityConfig, type QualityProfile } from './quality';
+import { getDeviceIdentity } from './renderer';
+
+/** @experimental */
+export const Quality = defineResource<QualityController | null>(null, 'Quality');
+
+export function installQuality(app: App, config: QualityConfig, authoredMsaa: number): void {
+ const platform = getPlatform();
+ const info = platform.deviceQualityInfo?.();
+ const gpu = getDeviceIdentity(app.wasmModule)?.renderer || info?.gpu;
+ const quality = new QualityController(config, {
+ model: platform.deviceName?.(), ...info, gpu,
+ });
+ app.insertResource(Quality, quality);
+ let applied: Readonly<QualityProfile> | null = null;
+ let enabled: boolean | null = null;
+ let last = 0;
+ let hidden = false;
+ const hide = platformOnAppHide(() => { hidden = true; last = 0; });
+ const show = platformOnAppShow(() => { hidden = false; last = 0; });
+ const apply = (): void => {
+ if (applied === quality.profile && enabled === quality.enabled) return;
+ applied = quality.profile;
+ enabled = quality.enabled;
+ const api = engineApi(app);
+ api?.postprocess_setMsaaSamples?.(enabled ? applied.msaaSamples : authoredMsaa);
+ const budgets = api?.renderer_setQualityBudgets;
+ quality.setLimitation('quality-budgets-unavailable', enabled && !budgets);
+ budgets?.(enabled ? applied.shadowAtlasSize : 2048,
+ enabled ? applied.shadowCellSize : 512, enabled ? applied.shadowCascades : 4,
+ enabled ? applied.particleLimit : 0xffffffff);
+ quality.setLimitation('shadow-distance-unavailable',
+ enabled && applied.shadowDistance > 0 && !api?.renderer_setShadowDistance);
+ api?.renderer_setShadowDistance?.(enabled ? applied.shadowDistance : 0);
+ };
+ app.pipeline?.setQuality(quality, apply);
+ apply();
+ const stop = app.onFrameEnd(() => {
+ const now = platformNow();
+ if (!hidden && !app.isPaused() && last > 0) quality.sample(now - last,
+ engineApi(app)?.renderer_getGpuTimeMs?.() ?? -1);
+ last = hidden || app.isPaused() ? 0 : now;
+ });
+ app.addPlugin({ name: 'quality', build() {}, cleanup() { stop(); hide(); show(); } });
+}
diff --git a/sdk/src/render/renderPipeline.ts b/sdk/src/render/renderPipeline.ts
index 67659584f..c90011c9a 100644
--- a/sdk/src/render/renderPipeline.ts
+++ b/sdk/src/render/renderPipeline.ts
@@ -19,6 +19,7 @@ import {
} from './customDraw';
import { log } from '../util/logger';
import { planPresent, RenderResolution } from '../camera/presentPlan';
+import type { QualityController } from './quality';
export interface Viewport {
x: number;
@@ -63,12 +64,27 @@ export interface CameraRenderParams {
}
export class RenderPipeline {
+ private renderingEnabled_ = true;
private lastWidth_ = 0;
private lastHeight_ = 0;
private activeScenes_: Set<string> | null = null;
private preFlushCallbacks_: ((registry: { _cpp: CppRegistry }) => void)[] = [];
private screenOverlayCallbacks_: ((registry: { _cpp: CppRegistry }) => void)[] = [];
private postProcess_: PostProcessAPI | null = null;
+ private quality_: QualityController | null = null;
+ private applyQuality_: (() => void) | null = null;
+ private warnedMissingPresent_ = false;
+
+ /** @experimental */
+ get renderingEnabled(): boolean { return this.renderingEnabled_; }
+
+ /** @experimental */
+ setRenderingEnabled(enabled: boolean): void { this.renderingEnabled_ = enabled; }
+
+ setQuality(quality: QualityController, apply?: () => void): void {
+ this.quality_ = quality;
+ this.applyQuality_ = apply ?? null;
+ }
setActiveScenes(scenes: Set<string> | null): void {
this.activeScenes_ = scenes;
@@ -109,6 +125,10 @@ export class RenderPipeline {
}
beginFrame(elapsedSec = 0): void {
+ this.applyQuality_?.();
+ this.quality_?.setLimitation('fixed-render-resolution', false);
+ this.quality_?.setLimitation('resolution-present-unavailable', false);
+ this.postProcess_?.setQualityFilter(this.quality_?.enabled ? this.quality_.profile : null);
Renderer.beginFrame(elapsedSec);
}
@@ -208,9 +228,29 @@ export class RenderPipeline {
// Where the scene is drawn and where it lands are two rects. A sprite that
// scales itself can only clamp at its own texture's edge, so every boundary
// breaks; scaling one whole image has no interior boundary to break.
- const plan = planPresent(
+ let plan = planPresent(
params.renderPolicy ?? RenderResolution.Surface,
params.worldHeight ?? 0, vp.w, vp.h);
+ const quality = this.quality_;
+ const scale = quality?.renderScale ?? 1;
+ const fixedResolution = (params.renderPolicy ?? RenderResolution.Surface)
+ !== RenderResolution.Surface;
+ const scaling = scale < 1 && !fixedResolution && !params.renderTarget;
+ if (scale < 1 && fixedResolution) quality?.setLimitation('fixed-render-resolution', true);
+ if (scaling && !this.postProcess_) {
+ quality?.setLimitation('resolution-present-unavailable', true);
+ }
+ if (scaling && this.postProcess_) {
+ plan = { ...plan, renderWidth: Math.max(1, Math.round(vp.w * scale)),
+ renderHeight: Math.max(1, Math.round(vp.h * scale)), oneToOne: false };
+ }
+ if (!plan.oneToOne && !this.postProcess_) {
+ if (!this.warnedMissingPresent_) {
+ log.warn('render', 'Resolution policy needs post-processing; using surface resolution');
+ this.warnedMissingPresent_ = true;
+ }
+ plan = planPresent(RenderResolution.Surface, 0, vp.w, vp.h);
+ }
const scene: Viewport = plan.oneToOne
? vp
: { x: 0, y: 0, w: plan.renderWidth, h: plan.renderHeight };
@@ -219,6 +259,7 @@ export class RenderPipeline {
: { x: vp.x + plan.x, y: vp.y + plan.y, w: plan.width, h: plan.height };
const pp = this.postProcess_;
+ pp?.setQualityFilter(quality?.enabled ? quality.profile : null);
const hasStack = pp !== null && cameraEntity !== undefined && pp.getStack(cameraEntity) !== null;
// A scaling present needs the chain even with no effects on it: the blit
// that ends the chain IS the present, and nothing else can draw one.
@@ -230,11 +271,15 @@ export class RenderPipeline {
// disengaged — so the policy would go quietly missing.
if (!pp!.isInitialized()) pp!.init(1, 1);
if (hasStack) pp!._applyForCamera(cameraEntity!);
- pp!.resize(scene.w, scene.h);
- pp!.setOutputViewport(present.x, present.y, present.w, present.h);
+ }
+ if (pp?.isInitialized()) {
+ pp.resize(scene.w, scene.h);
+ pp.setOutputViewport(present.x, present.y, present.w, present.h);
// A letterbox at 1x is the same size as its chain and merely offset, so
// the engine cannot read the need for it off the rects.
- pp!.setPresentRequired(!plan.oneToOne);
+ pp.setPresentRequired(!plan.oneToOne);
+ }
+ if (hasPostProcess) {
pp!.begin();
}
diff --git a/sdk/src/render/renderer.ts b/sdk/src/render/renderer.ts
index 3865c8ece..f41f9ebd1 100644
--- a/sdk/src/render/renderer.ts
+++ b/sdk/src/render/renderer.ts
@@ -327,8 +327,8 @@ export interface DeviceIdentity {
* who it was — but it could only be read off a loss report, so a healthy session
* could not say which GPU it had. Null before a device exists.
*/
-export function getDeviceIdentity(): DeviceIdentity | null {
- const raw = module?.deviceIdentity?.() ?? '';
+export function getDeviceIdentity(source: ESEngineModule | null = module): DeviceIdentity | null {
+ const raw = source?.deviceIdentity?.() ?? '';
if (!raw) return null;
const [backend = '', vendor = '', renderer = '', version = ''] = raw.split('|');
return { backend, vendor, renderer, version };
diff --git a/sdk/src/runtime/frameStats.ts b/sdk/src/runtime/frameStats.ts
index e3f27c8f6..b90c027d3 100644
--- a/sdk/src/runtime/frameStats.ts
+++ b/sdk/src/runtime/frameStats.ts
@@ -7,8 +7,12 @@
*/
import type { App, FrameCosts } from '../app/app';
import { engineApi } from '../ecs/bridge/engineApi';
+import { Quality } from '../render/qualityRuntime';
+import type { QualityReport } from '../render/quality';
export interface FrameStatsReport {
+ seq?: number;
+ frameMs?: number;
phases: Record<string, number>;
/** Per-system and per-scope cost with the domain/system attribution the
* profile tree is folded from. Null while the app has stats off. */
@@ -23,6 +27,7 @@ export interface FrameStatsReport {
gpuScopes: Record<string, number>;
wasmBytes: number;
vramBytes: number;
+ quality?: QualityReport;
}
function jsonMap(json: string | undefined): Record<string, number> {
@@ -33,6 +38,7 @@ function jsonMap(json: string | undefined): Record<string, number> {
export function frameStatsReport(app: App): FrameStatsReport {
const m = engineApi(app);
return {
+ ...app.getFrameTiming(),
phases: Object.fromEntries(app.getPhaseTimings() ?? []),
costs: app.getFrameCosts(),
drawCalls: m?.renderer_getDrawCalls?.() ?? 0,
@@ -45,5 +51,6 @@ export function frameStatsReport(app: App): FrameStatsReport {
gpuScopes: jsonMap(m?.engine_getGpuScopes?.()),
wasmBytes: app.wasmModule?.HEAPU8?.byteLength ?? 0,
vramBytes: m?.renderer_getTextureBytes?.() ?? 0,
+ quality: app.hasResource(Quality) ? app.getResource(Quality)?.report() : undefined,
};
}
diff --git a/sdk/src/runtime/packagedRuntime.ts b/sdk/src/runtime/packagedRuntime.ts
index 399c544ab..b5e367aea 100644
--- a/sdk/src/runtime/packagedRuntime.ts
+++ b/sdk/src/runtime/packagedRuntime.ts
@@ -12,6 +12,7 @@
* the bytes arrive, so the same code serves both realms.
*/
+import type { QualityConfig } from '../render/quality';
import type { DebugChannelConfig } from './debugChannelProtocol';
import { extractUuid } from '../asset/AssetRegistry';
import { platformReadTextFile, platformLoadImagePixels } from '../platform';
@@ -64,6 +65,7 @@ export interface PackagedGameConfig {
/** Scene-target multisampling the project asked for; absent ⇒ 4. Clamped by
* the device, which answers capability and never policy. */
msaaSamples?: number;
+ quality?: QualityConfig;
/** GPU backend the build asks for; absent ⇒ WebGL2. A request for
* 'webgpu' falls back where the machine cannot serve one. */
renderBackend?: 'webgl2' | 'webgpu';
@@ -196,13 +198,14 @@ export function glContextAttributes(preserveDrawingBuffer = false): WebGLContext
export function packagedAppOptions(
config: Pick<PackagedGameConfig,
'ySortLayers' | 'depthLayers' | 'colorSpace' | 'outputTransform' | 'screenFit'
- | 'msaaSamples'>,
+ | 'msaaSamples' | 'quality'>,
): {
ySortLayers?: number;
depthLayers?: number;
colorSpace?: 'gamma' | 'linear';
outputTransform?: 'none' | 'aces';
msaaSamples?: number;
+ quality?: QualityConfig;
/** GPU backend the build asks for; absent ⇒ WebGL2. A request for
* 'webgpu' falls back where the machine cannot serve one. */
renderBackend?: 'webgl2' | 'webgpu';
@@ -214,6 +217,7 @@ export function packagedAppOptions(
colorSpace: config.colorSpace,
outputTransform: config.outputTransform,
msaaSamples: config.msaaSamples,
+ quality: config.quality,
screenFit: config.screenFit,
};
}
diff --git a/sdk/src/runtime/playRealmRuntime.ts b/sdk/src/runtime/playRealmRuntime.ts
index b2c6df647..d55a507d1 100644
--- a/sdk/src/runtime/playRealmRuntime.ts
+++ b/sdk/src/runtime/playRealmRuntime.ts
@@ -28,7 +28,7 @@ import { HttpBackend } from '../asset/Backend';
import { Catalog, type CatalogData } from '../asset/Catalog';
import { ManifestModel, type AddressableManifest } from '../asset/AddressableManifest';
import type { SceneData } from '../scene/scene';
-import type { Physics2DPluginConfig } from '../physics/Physics2DPlugin';
+import type { Physics2DPluginConfig } from '../physics/PhysicsTypes';
import type { AudioProjectConfig } from '../audio/AudioProjectConfig';
import { fetchDecodePixels } from '../asset/imageDecode';
import { applyAssetRefResolvers } from './packagedRuntime';
@@ -169,7 +169,7 @@ function createPlayRealmSource(
return {
backend,
...(compressedTexture ? { compressedTexture } : {}),
- decodePixels: (path) => fetchDecodePixels(backend.resolveUrl(path)),
+ decodePixels: (path, _flip, maxEdge) => fetchDecodePixels(backend.resolveUrl(path), maxEdge),
resolveRef: (ref) => resolvePlayAssetRef(ref, manifest, assetBaseUrl, pathMap),
// Cooked builds: logical paths (the pathMap keys). Editor play: the
// manifest's resolved URLs — both keep the real extension, which is all
diff --git a/sdk/src/runtime/runtimeAssets.ts b/sdk/src/runtime/runtimeAssets.ts
index 38634986b..112417611 100644
--- a/sdk/src/runtime/runtimeAssets.ts
+++ b/sdk/src/runtime/runtimeAssets.ts
@@ -31,7 +31,7 @@ import { withMalloc } from '../wasm/wasmScratch';
*/
export interface RuntimeAssetSource {
backend: Backend;
- decodePixels(path: string, flip: boolean): Promise<{ width: number; height: number; pixels: Uint8Array }>;
+ decodePixels(path: string, flip: boolean, maxEdge?: number): Promise<{ width: number; height: number; pixels: Uint8Array }>;
resolveRef?(ref: string): string;
/**
* The LOGICAL source path a ref was authored at (e.g. `assets/spine/hero.atlas`),
diff --git a/sdk/src/runtime/runtimeLoader.ts b/sdk/src/runtime/runtimeLoader.ts
index 9b7b98a90..b251a6e78 100644
--- a/sdk/src/runtime/runtimeLoader.ts
+++ b/sdk/src/runtime/runtimeLoader.ts
@@ -17,7 +17,7 @@ import type { ESEngineModule } from '../wasm';
import type { SpineWasmModule } from '../spine/SpineModuleLoader';
import type { SpineManager } from '../spine/SpineManager';
import type { PhysicsWasmModule } from '../physics/PhysicsModuleLoader';
-import type { Physics2DPluginConfig } from '../physics/Physics2DPlugin';
+import type { Physics2DPluginConfig } from '../physics/PhysicsTypes';
import type { Physics3DWasmModule } from '../physics3d/Physics3DModule';
import { applyAudioProjectConfig, type AudioProjectConfig } from '../audio/AudioProjectConfig';
import type { App } from '../app/app';
@@ -115,7 +115,7 @@ function ensureRuntimeAssets(
if (source.resolveRef) assets.setAssetRefResolver(source.resolveRef);
const loader = assets.getTextureLoader();
- loader.setPixelDecoder((path, flip) => source.decodePixels(path, flip));
+ loader.setPixelDecoder((path, flip, maxEdge) => source.decodePixels(path, flip, maxEdge));
if (source.compressedTexture) loader.setCompressedSource((path) => source.compressedTexture!(path));
// KTX2 transcoder, self-gated off app.sideModules — identical wiring to
// AssetPlugin.build so eager + on-demand loads transcode the same way.
diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts
index 4744784ed..28156514c 100644
--- a/sdk/src/wasm.ts
+++ b/sdk/src/wasm.ts
@@ -642,6 +642,9 @@ export interface ESEngineModule {
/** Bitmask of layers 0..31 that y-sort within the layer (top-down occlusion). */
renderer_setYSortLayers?(mask: number): void;
renderer_setDepthLayers?(mask: number): void;
+ renderer_setQualityBudgets?(atlasSize: number, cellSize: number,
+ cascades: number, particleLimit: number): void;
+ renderer_setShadowDistance?(distance: number): void;
renderer_setCullingMask?(mask: number): void;
renderer_setViewId?(view: number): void;
renderer_lodInspect?(view: number, entity: number, outPtr: number): number;
diff --git a/sdk/tests/app-tick.test.ts b/sdk/tests/app-tick.test.ts
index 4483ca6bf..e12d57e24 100644
--- a/sdk/tests/app-tick.test.ts
+++ b/sdk/tests/app-tick.test.ts
@@ -128,6 +128,69 @@ describe('App.tick()', () => {
});
describe('App.stepFrames()', () => {
+ it('waits for an in-flight frame and resumes only one loop', async () => {
+ const realRaf = globalThis.requestAnimationFrame;
+ const realCancel = globalThis.cancelAnimationFrame;
+ const pending = new Map<number, FrameRequestCallback>();
+ let nextId = 0;
+ globalThis.requestAnimationFrame = callback => { pending.set(++nextId, callback); return nextId; };
+ globalThis.cancelAnimationFrame = id => { pending.delete(id); };
+ setPlatform({ now: () => 1000 } as unknown as PlatformAdapter);
+ let release!: () => void;
+ const blocked = new Promise<void>(resolve => { release = resolve; });
+ const app = App.new();
+ let frames = 0;
+ app.addSystem(defineSystem([], async () => { if (++frames === 1) await blocked; }, { name: 'AsyncFrame' }));
+ const settle = async () => { for (let i = 0; i < 50; i++) await Promise.resolve(); };
+ try {
+ await app.run(); await settle();
+ const stepping = app.stepFrames(2);
+ await settle();
+ expect(frames).toBe(1);
+ release(); await stepping; await settle();
+ expect(frames).toBe(3);
+ expect(pending.size).toBe(1);
+ } finally {
+ release(); app.quit();
+ globalThis.requestAnimationFrame = realRaf;
+ globalThis.cancelAnimationFrame = realCancel;
+ }
+ });
+ it('replaces the pending loop when stepping and ignores a stale callback', async () => {
+ const realRaf = globalThis.requestAnimationFrame;
+ const realCancel = globalThis.cancelAnimationFrame;
+ const pending = new Map<number, FrameRequestCallback>();
+ let nextId = 0;
+ globalThis.requestAnimationFrame = callback => { pending.set(++nextId, callback); return nextId; };
+ globalThis.cancelAnimationFrame = id => { pending.delete(id); };
+ setPlatform({ now: () => 1000 } as unknown as PlatformAdapter);
+ const app = App.new();
+ let frames = 0;
+ app.addSystem(defineSystem([], () => { frames++; }, { name: 'CountLoopFrames' }));
+ const settle = async () => { for (let i = 0; i < 50; i++) await Promise.resolve(); };
+ try {
+ await app.run(); await settle();
+ expect(pending.size).toBe(1);
+ const stale = [...pending.values()][0];
+ for (let i = 0; i < 5; i++) await app.stepFrames(2);
+ expect(pending.size).toBe(1);
+ const before = frames;
+ await stale(1016.67); await settle();
+ expect(frames).toBe(before);
+ expect(pending.size).toBe(1);
+ const [id, callback] = [...pending.entries()][0];
+ pending.delete(id);
+ await callback(1033.33); await settle();
+ expect(frames).toBe(before + 1);
+ expect(pending.size).toBe(1);
+ app.quit();
+ expect(pending.size).toBe(0);
+ } finally {
+ app.quit();
+ globalThis.requestAnimationFrame = realRaf;
+ globalThis.cancelAnimationFrame = realCancel;
+ }
+ });
// The rAF loop is wall-clock and the browser throttles it in a background tab
// to about a frame a second, so "wait and look again" cannot observe a game.
// This is the door that advances one on purpose; before it existed the only
@@ -193,6 +256,7 @@ describe('App.stepFrames()', () => {
await app.run(); // seeds the clock and runs one frame off platformNow()
await settle();
deltasMs.length = 0;
+ app.setPlaySpeed(2);
const VSYNC = 1000 / 60;
const startDelay = [0.2, 4.1, 0.9, 6.3, 1.7, 3.0];
@@ -206,7 +270,8 @@ describe('App.stepFrames()', () => {
}
expect(deltasMs).toHaveLength(startDelay.length);
- for (const d of deltasMs) expect(d).toBeCloseTo(VSYNC, 6);
+ for (const d of deltasMs) expect(d).toBeCloseTo(VSYNC * 2, 6);
+ expect(app.getFrameTiming()?.frameMs).toBeCloseTo(VSYNC, 6);
} finally {
app.quit();
globalThis.requestAnimationFrame = realRaf;
diff --git a/sdk/tests/camera-render-order.test.ts b/sdk/tests/camera-render-order.test.ts
index 42f295346..97da3ee02 100644
--- a/sdk/tests/camera-render-order.test.ts
+++ b/sdk/tests/camera-render-order.test.ts
@@ -76,6 +76,29 @@ describe('render order: transforms resolve before cameras are read', () => {
});
afterEach(() => { setRendererBackend(null); });
+ it('keeps updates alive without drawing a covered surface and resumes rendering', async () => {
+ const { app, module } = bootMockApp();
+ const registry = module.getRegistry() as unknown as Record<string, unknown> & CppRegistry;
+ registry.getCameraEntities = () => [];
+ registry.getCanvasEntities = () => [];
+ const pipeline = new RenderPipeline();
+ app.setPipeline(pipeline);
+ setRendererBackend(fakeBackend(registry, []));
+ app.addPlugin(cameraPlugin(() => ({ width: 800, height: 600 })));
+ let updates = 0;
+ app.addSystem(defineSystem([], () => { updates++; }, { name: 'LiveUpdate' }));
+ pipeline.setRenderingEnabled(false);
+ await app.tick(1 / 60);
+ expect(updates).toBe(1);
+ expect(beginFrames).toBe(0);
+ expect(calls).not.toContain('submitAll');
+ pipeline.setRenderingEnabled(true);
+ await app.tick(1 / 60);
+ expect(updates).toBe(2);
+ expect(beginFrames).toBe(1);
+ expect(calls).toContain('submitAll');
+ });
+
it('a camera moved in Update is looked through at THIS frame’s position', async () => {
const { app, module } = bootMockApp();
const registry = module.getRegistry() as unknown as Record<string, unknown> & CppRegistry;
diff --git a/sdk/tests/debug-channel.test.ts b/sdk/tests/debug-channel.test.ts
index 22407d5ce..6264aecb5 100644
--- a/sdk/tests/debug-channel.test.ts
+++ b/sdk/tests/debug-channel.test.ts
@@ -119,6 +119,7 @@ describe('what the channel costs a device', () => {
onFrameEnd: () => () => {},
getPhaseTimings: () => [],
getFrameCosts: () => null,
+ getFrameTiming: () => null,
wasmModule: null,
world: { getAllEntities: () => [] },
} as unknown as App);
diff --git a/sdk/tests/lightmap-unwrap.test.ts b/sdk/tests/lightmap-unwrap.test.ts
index 4d9142536..fd7809905 100644
--- a/sdk/tests/lightmap-unwrap.test.ts
+++ b/sdk/tests/lightmap-unwrap.test.ts
@@ -123,6 +123,22 @@ describe('a lightmap UV set', () => {
expect(max).toBe(1);
});
+ it('keeps coincident layers separate across welded non-manifold edges', () => {
+ const source = cube();
+ source.indices = Uint32Array.from([...source.indices, ...source.indices]);
+ const { mesh } = unwrapLightmapUV(source);
+ expect(mesh.indices.length).toBe(source.indices.length);
+ expect(coverage(mesh, 128).max).toBe(1);
+ });
+
+ it('keeps duplicate triangles separate when their shared edges have the same winding', () => {
+ const source = cube();
+ source.indices = Uint32Array.from([0, 1, 2, 0, 1, 2]);
+ const { mesh } = unwrapLightmapUV(source);
+ expect(mesh.indices.length).toBe(6);
+ expect(coverage(mesh, 128).max).toBe(1);
+ });
+
it('stays inside the unit square', () => {
const { mesh } = unwrapLightmapUV(cube());
for (let v = 0; v < mesh.vertexCount; v++) {
diff --git a/sdk/tests/minigame-quality-info.test.ts b/sdk/tests/minigame-quality-info.test.ts
new file mode 100644
index 000000000..cb7bee80b
--- /dev/null
+++ b/sdk/tests/minigame-quality-info.test.ts
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { describe, expect, it } from 'vitest';
+import { MiniGamePlatformAdapter } from '../src/platform/minigame/adapter';
+import type { MiniGameGlobal, MiniGameProfile } from '../src/platform/minigame/api';
+import { QualityController } from '../src/render/quality';
+
+const adapter = (global: Partial<MiniGameGlobal>) => new MiniGamePlatformAdapter({
+ id: 'wx', global,
+} as MiniGameProfile);
+
+describe('mini-game device quality facts', () => {
+ it('uses device information and normalizes MB into the quality rules unit', () => {
+ const info = adapter({ getDeviceInfo: () => ({ model: 'iPhone 13<iPhone14,5>', memorySize: '2048' }) })
+ .deviceQualityInfo();
+ expect(info).toEqual({ model: 'iPhone 13', memoryGB: 2 });
+ expect(new QualityController({ mode: 'auto' }, info).report().level).toBe('low');
+ });
+
+ it('accepts numeric memory from older vendor system information', () => {
+ expect(adapter({ getSystemInfoSync: () => ({ memorySize: 4096 }) }).deviceQualityInfo().memoryGB)
+ .toBe(4);
+ });
+
+ it('keeps unavailable or malformed facts unknown rather than inventing a device tier', () => {
+ for (const memorySize of [undefined, 'unknown', '', 0, -1, Infinity]) {
+ const info = adapter({ getDeviceInfo: () => ({ memorySize }) }).deviceQualityInfo();
+ expect(info.memoryGB).toBeUndefined();
+ expect(new QualityController({ mode: 'auto' }, info).report().level).toBe('medium');
+ }
+ expect(adapter({ getDeviceInfo: () => { throw new Error('unavailable'); } }).deviceQualityInfo())
+ .toEqual({});
+ });
+});
diff --git a/sdk/tests/native-frame-stats.test.ts b/sdk/tests/native-frame-stats.test.ts
index 3755442a8..636043108 100644
--- a/sdk/tests/native-frame-stats.test.ts
+++ b/sdk/tests/native-frame-stats.test.ts
@@ -32,6 +32,15 @@ function nativeEngine() {
afterEach(() => setNativeEngineApi(null));
describe('frame stats on a device with no wasm module', () => {
+ it('reports the completed app frame rather than a polling host clock', async () => {
+ const app = App.new();
+ expect(frameStatsReport(app).seq).toBeUndefined();
+ await app.tick(0.05);
+ expect(frameStatsReport(app)).toMatchObject({ seq: 1, frameMs: 50 });
+ await app.tick(0.1);
+ expect(frameStatsReport(app)).toMatchObject({ seq: 2, frameMs: 100 });
+ app.quit();
+ });
it('reads the counters from the native engine', () => {
setNativeEngineApi(nativeEngine());
const report = frameStatsReport(App.new());
diff --git a/sdk/tests/quality-render.test.ts b/sdk/tests/quality-render.test.ts
new file mode 100644
index 000000000..7bb1e6b4a
--- /dev/null
+++ b/sdk/tests/quality-render.test.ts
@@ -0,0 +1,82 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+
+import { beforeEach, describe, expect, it, vi } from 'vitest';
+vi.mock('../src/render/renderer', () => ({ Renderer: {
+ setViewport: vi.fn(), begin: vi.fn(), setCullingMask: vi.fn(),
+ setViewId: vi.fn(), end: vi.fn(), beginFrame: vi.fn(),
+} }));
+import { Renderer } from '../src/render/renderer';
+import { RenderPipeline, type CameraRenderParams } from '../src/render/renderPipeline';
+import { QualityController } from '../src/render/quality';
+import { RenderResolution } from '../src/camera/presentPlan';
+import type { PostProcessAPI } from '../src/postprocess';
+
+describe('quality present', () => {
+ const params = (): CameraRenderParams => ({
+ registry: { _cpp: {} as never }, viewProjection: new Float32Array(16),
+ viewportPixels: { x: 200, y: 50, w: 800, h: 600 },
+ clearFlags: 3, elapsed: 0, cameraEntity: 2 as never, worldHeight: 100,
+ });
+ const setup = (post = true) => {
+ const pipeline = new RenderPipeline();
+ const q = new QualityController({ mode: 'low' });
+ pipeline.setQuality(q);
+ const pp = { setQualityFilter: vi.fn(), getStack: () => null,
+ isInitialized: () => true, resize: vi.fn(), setOutputViewport: vi.fn(),
+ setPresentRequired: vi.fn(), begin: vi.fn(), end: vi.fn() };
+ if (post) pipeline.setPostProcess(pp as unknown as PostProcessAPI);
+ const submit = vi.spyOn(pipeline, 'submitScene').mockImplementation(() => {});
+ return { pipeline, q, pp, submit };
+ };
+ beforeEach(() => vi.clearAllMocks());
+
+ it('scales only scene pixels while preserving the projection and surface viewport', () => {
+ const { pipeline, pp, submit } = setup();
+ const p = params();
+ pipeline.renderCamera(p);
+ expect(pp.resize).toHaveBeenCalledWith(600, 450);
+ expect(pp.setOutputViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ expect(submit.mock.calls[0][1]).toBe(p.viewProjection);
+ expect(p.viewportPixels).toEqual({ x: 200, y: 50, w: 800, h: 600 });
+ });
+
+ it('preserves fixed pixel policies and reports their priority', () => {
+ const { pipeline, pp, q } = setup();
+ pipeline.renderCamera({ ...params(), renderPolicy: RenderResolution.Design });
+ expect(pp.resize).toHaveBeenCalledWith(133, 100);
+ expect(q.report().limitations).toContain('fixed-render-resolution');
+ });
+
+ it('keeps authored render textures at their declared size', () => {
+ const { pipeline, pp } = setup();
+ pipeline.renderCamera({ ...params(), renderTarget: 7 });
+ expect(pp.begin).not.toHaveBeenCalled();
+ expect(pp.resize).toHaveBeenCalledWith(800, 600);
+ expect(pp.setOutputViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ expect(pp.setPresentRequired).toHaveBeenCalledWith(false);
+ expect(Renderer.setViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ });
+
+ it('falls back to full surface size when the presentation module is absent', () => {
+ const { pipeline, q } = setup(false);
+ pipeline.renderCamera(params());
+ expect(Renderer.setViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ expect(q.report().limitations).toContain('resolution-present-unavailable');
+ pipeline.renderCamera({ ...params(), renderPolicy: RenderResolution.Design });
+ expect(Renderer.setViewport).toHaveBeenLastCalledWith(200, 50, 800, 600);
+ });
+
+ it('switches back to full resolution without reloading the scene', () => {
+ const { pipeline, q, pp } = setup();
+ pipeline.renderCamera(params());
+ q.setMode('off');
+ vi.clearAllMocks();
+ pipeline.renderCamera(params());
+ expect(pp.begin).not.toHaveBeenCalled();
+ expect(pp.resize).toHaveBeenCalledWith(800, 600);
+ expect(pp.setOutputViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ expect(pp.setPresentRequired).toHaveBeenCalledWith(false);
+ expect(Renderer.setViewport).toHaveBeenCalledWith(200, 50, 800, 600);
+ });
+});
diff --git a/sdk/tests/quality-runtime.test.ts b/sdk/tests/quality-runtime.test.ts
new file mode 100644
index 000000000..5d64d734c
--- /dev/null
+++ b/sdk/tests/quality-runtime.test.ts
@@ -0,0 +1,50 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { describe, expect, it, vi } from 'vitest';
+import type { App } from '../src/app/app';
+import type { ESEngineModule } from '../src/wasm';
+import { Quality, installQuality } from '../src/render/qualityRuntime';
+import { getDeviceIdentity } from '../src/render/renderer';
+
+vi.mock('../src/platform', () => ({
+ getPlatform: () => ({ deviceName: () => 'desktop', deviceQualityInfo: () => ({ memoryGB: 8, cores: 2 }) }),
+ platformNow: () => 1,
+ platformOnAppHide: () => () => {}, platformOnAppShow: () => () => {},
+}));
+vi.mock('../src/ecs/bridge/engineApi', () => ({
+ engineApi: () => ({ renderer_setQualityBudgets: vi.fn(), renderer_setShadowDistance: distanceBudget }),
+}));
+
+const { distanceBudget } = vi.hoisted(() => ({ distanceBudget: vi.fn() }));
+
+describe('quality runtime device selection', () => {
+ it('applies the tier shadow range and restores camera coverage when disabled', () => {
+ let apply: (() => void) | undefined;
+ let controller: import('../src/render/quality').QualityController;
+ const app = { wasmModule: null, insertResource: (_: unknown, value: typeof controller) => { controller = value; },
+ pipeline: { setQuality: (_: unknown, callback: () => void) => { apply = callback; } },
+ addPlugin: vi.fn(), onFrameEnd: () => () => {},
+ } as unknown as App;
+ installQuality(app, { mode: 'high', profiles: { high: { shadowDistance: 60 } } }, 4);
+ expect(distanceBudget).toHaveBeenLastCalledWith(60);
+ controller!.setMode('off'); apply!();
+ expect(distanceBudget).toHaveBeenLastCalledWith(0);
+ });
+ it('uses this app’s actual renderer identity when a GPU rule matches', () => {
+ const insertResource = vi.fn();
+ const wasmModule = { deviceIdentity: () => 'WebGL2|NVIDIA|RTX 3060|driver' } as ESEngineModule;
+ const app = { wasmModule, insertResource, addPlugin: vi.fn(), onFrameEnd: () => () => {} } as unknown as App;
+ installQuality(app, { mode: 'auto', deviceRules: [{ level: 'high', gpuIncludes: 'RTX' }] }, 1);
+ expect(insertResource).toHaveBeenCalledWith(Quality, expect.anything());
+ expect(insertResource.mock.calls[0][1].report()).toMatchObject({ level: 'high', reason: 'device-rule' });
+ expect(getDeviceIdentity(wasmModule)?.renderer).toBe('RTX 3060');
+ });
+
+ it('uses platform capacity when this app provides no GPU identity', () => {
+ const insertResource = vi.fn();
+ const app = { wasmModule: null, insertResource, addPlugin: vi.fn(), onFrameEnd: () => () => {} } as unknown as App;
+ installQuality(app, { mode: 'auto', deviceRules: [{ level: 'high', gpuIncludes: 'RTX' }] }, 1);
+ expect(insertResource.mock.calls[0][1].report()).toMatchObject({ level: 'low', reason: 'device-capacity' });
+ expect(getDeviceIdentity(null)).toBeNull();
+ });
+});
diff --git a/sdk/tests/quality.test.ts b/sdk/tests/quality.test.ts
new file mode 100644
index 000000000..79c7d079c
--- /dev/null
+++ b/sdk/tests/quality.test.ts
@@ -0,0 +1,102 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+
+import { describe, expect, it } from 'vitest';
+import { parseQualityConfig, QualityController } from '../src/render/quality';
+
+describe('quality selection', () => {
+ it('keeps unconfigured projects at their authored resolution', () => {
+ const q = new QualityController({});
+ for (let i = 0; i < 100; i++) q.sample(40);
+ expect(q.enabled).toBe(false);
+ expect(q.renderScale).toBe(1);
+ });
+
+ it('requires all rule conditions and takes the first matching device rule', () => {
+ const config = { mode: 'auto' as const, deviceRules: [
+ { level: 'high' as const, gpuIncludes: 'RTX', maxMemoryGB: 16 },
+ { level: 'low' as const, modelIncludes: 'phone', maxCores: 4 },
+ ] };
+ expect(new QualityController(config, { gpu: 'rtx 4060', memoryGB: 8 })
+ .report().level).toBe('high');
+ expect(new QualityController(config, { gpu: 'RTX 4060' }).report().level).toBe('medium');
+ expect(new QualityController(config, { model: 'Phone 1', cores: 4 })
+ .report().level).toBe('low');
+ });
+
+ it('keeps profile overrides when switching tiers at runtime', () => {
+ const q = new QualityController({ mode: 'low', profiles: {
+ high: { renderScale: 0.9 }, low: { renderScale: 0.6, minRenderScale: 0.4 },
+ } });
+ q.setMode('high');
+ expect(q.renderScale).toBe(0.9);
+ q.setMode('off');
+ expect(q.renderScale).toBe(1);
+ q.setMode('low');
+ expect(q.renderScale).toBe(0.6);
+ });
+
+ it('normalizes malformed manifests and bounds allocation sizes', () => {
+ const config = parseQualityConfig({ mode: 'invalid', targetFps: NaN, profiles: {
+ low: { renderScale: 0, minRenderScale: 2, shadowAtlasSize: 1024,
+ shadowCellSize: 1024, particleLimit: Infinity, shadowCascades: 500, shadowDistance: -100 },
+ }, deviceRules: [null, { level: 'high' }, { level: 'low', maxCores: NaN }] });
+ const q = new QualityController({ ...config, mode: 'low' });
+ expect(config.mode).toBe('off');
+ expect(config.targetFps).toBe(60);
+ expect(config.deviceRules).toEqual([]);
+ expect(q.profile.renderScale).toBe(0.25);
+ expect(q.profile.minRenderScale).toBe(0.25);
+ expect(q.profile.shadowCellSize).toBe(512);
+ expect(q.profile.shadowCascades).toBe(4);
+ expect(q.profile.shadowDistance).toBe(0);
+ expect(q.profile.particleLimit).toBe(1000);
+ });
+});
+
+describe('dynamic resolution', () => {
+ const make = () => new QualityController({ mode: 'high', dynamicResolution: true });
+ const sample = (q: QualityController, frames: number, frameMs: number, gpuMs = -1) => {
+ for (let i = 0; i < frames; i++) q.sample(frameMs, gpuMs);
+ };
+
+ it('ignores a transient spike, then reduces resolution under sustained pressure', () => {
+ const q = make();
+ q.sample(40, 40);
+ expect(q.renderScale).toBe(1);
+ sample(q, 20, 40, 40);
+ expect(q.renderScale).toBeLessThan(1);
+ expect(q.report().reason).toBe('gpu-pressure');
+ });
+
+ it('does not lower resolution for CPU pressure when the GPU has headroom', () => {
+ const q = make();
+ sample(q, 200, 40, 5);
+ expect(q.renderScale).toBe(1);
+ expect(q.report().reason).toBe('manual');
+ });
+
+ it('bounds the floor and slowly recovers without oscillating near the budget', () => {
+ const q = make();
+ sample(q, 200, 40, 40);
+ expect(q.renderScale).toBe(0.75);
+ expect(q.report().reason).toBe('resolution-floor');
+ sample(q, 100, 16.67, 16.67);
+ expect(q.renderScale).toBe(0.75);
+ sample(q, 200, 10, 10);
+ expect(q.renderScale).toBe(0.75);
+ sample(q, 400, 10, 10);
+ expect(q.renderScale).toBeGreaterThan(0.75);
+ expect(q.renderScale).toBeLessThanOrEqual(1);
+ });
+
+ it('does not react to background gaps, invalid clocks or a static tier', () => {
+ const q = make();
+ for (const ms of [NaN, Infinity, 0, -5, 30000]) q.sample(ms);
+ expect(q.renderScale).toBe(1);
+ expect(q.report().frameMs).toBe(0);
+ const staticQ = new QualityController({ mode: 'low' });
+ sample(staticQ, 100, 40);
+ expect(staticQ.renderScale).toBe(0.75);
+ });
+});
diff --git a/sdk/tests/texture-preview.test.ts b/sdk/tests/texture-preview.test.ts
new file mode 100644
index 000000000..df539482b
--- /dev/null
+++ b/sdk/tests/texture-preview.test.ts
@@ -0,0 +1,47 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import { describe, expect, it, vi } from 'vitest';
+
+const mocks = vi.hoisted(() => ({
+ draw: vi.fn(),
+ read: vi.fn((_x: number, _y: number, width: number, height: number) => ({
+ data: new Uint8ClampedArray(width * height * 4),
+ })),
+ upload: vi.fn(() => 42),
+}));
+vi.mock('../src/platform/base', () => ({
+ platformCreateCanvas: (width: number, height: number) => ({
+ width, height, getContext: () => ({ drawImage: mocks.draw, getImageData: mocks.read }),
+ }),
+}));
+vi.mock('../src/wasm/resourceManager', () => ({ requireResourceManager: () => ({}) }));
+vi.mock('../src/runtime/runtimeAssets', () => ({ createTextureFromPixels: mocks.upload }));
+
+import { readImagePixels } from '../src/asset/imageDecode';
+import { TextureLoader } from '../src/asset/loaders/TextureLoader';
+import type { LoadContext } from '../src/asset/AssetLoader';
+import type { PlatformImage } from '../src/platform/types';
+
+describe('pending texture previews', () => {
+ it('limits pixel readback before allocating RGBA, preserving aspect ratio without enlarging images', () => {
+ const image = { width: 8192, height: 4096 } as PlatformImage;
+ const preview = readImagePixels(image, 1024);
+ expect([preview.width, preview.height, preview.pixels.length]).toEqual([1024, 512, 1024 * 512 * 4]);
+ expect(mocks.draw).toHaveBeenLastCalledWith(image, 0, 0, 1024, 512);
+ expect(readImagePixels({ width: 4, height: 2 } as PlatformImage, 1024).width).toBe(4);
+ });
+
+ it('passes the preview cap to runtime pixel providers only while compression is pending', async () => {
+ const loader = new TextureLoader(null);
+ const decoder = vi.fn(async (_path: string, _flip: boolean, maxEdge?: number) => ({
+ width: maxEdge || 2048, height: maxEdge || 2048, pixels: new Uint8Array(4),
+ }));
+ loader.setPixelDecoder(decoder);
+ loader.setCompressedSource(async () => 'pending');
+ expect((await loader.load('color.png', {} as LoadContext)).width).toBe(1024);
+ expect(decoder).toHaveBeenLastCalledWith('color.png', true, 1024);
+ loader.setCompressedSource(async () => null);
+ expect((await loader.load('color.png', {} as LoadContext)).width).toBe(2048);
+ expect(decoder).toHaveBeenLastCalledWith('color.png', true, 0);
+ });
+});
diff --git a/src/esengine/bindings/RendererBindings.cpp b/src/esengine/bindings/RendererBindings.cpp
index e6d8f745e..29fdc5d64 100644
--- a/src/esengine/bindings/RendererBindings.cpp
+++ b/src/esengine/bindings/RendererBindings.cpp
@@ -1012,10 +1012,21 @@ void renderer_setYSortLayers(u32 mask) {
// The 2.5D opt-in, per sorting layer. Same shape as setYSortLayers because it is
// the same kind of declaration: how a layer resolves the draws inside it.
+void renderer_setQualityBudgets(u32 atlasSize, u32 cellSize, u32 cascades, u32 particleLimit) {
+ if (g_renderFrame) g_renderFrame->setShadowBudget(atlasSize, cellSize, cascades);
+#ifdef ES_ENABLE_PARTICLES
+ if (g_particleSystem) g_particleSystem->setParticleLimit(particleLimit);
+#endif
+}
+
void renderer_setDepthLayers(u32 mask) {
if (auto* frame = g_renderFrame) frame->setDepthLayers(mask);
}
+void renderer_setShadowDistance(f32 distance) {
+ if (g_renderFrame) g_renderFrame->setShadowDistance(distance);
+}
+
// Which layers the NEXT collect draws. Set per camera, before renderer_submitAll.
void renderer_setCullingMask(u32 mask) {
if (auto* frame = g_renderFrame) frame->setCullingMask(mask);
diff --git a/src/esengine/bindings/RendererBindings.hpp b/src/esengine/bindings/RendererBindings.hpp
index 2d1e61056..7caf64b02 100644
--- a/src/esengine/bindings/RendererBindings.hpp
+++ b/src/esengine/bindings/RendererBindings.hpp
@@ -24,6 +24,8 @@ namespace ecs {
void renderer_init(u32 width, u32 height);
void renderer_resize(u32 width, u32 height);
+void renderer_setQualityBudgets(u32 atlasSize, u32 cellSize, u32 cascades, u32 particleLimit);
+void renderer_setShadowDistance(f32 distance);
void renderer_beginFrame(f32 elapsedSec);
void renderer_begin(uintptr_t matrixPtr, u32 targetHandle, i32 clearFlags,
f32 r, f32 g, f32 b, f32 a,
diff --git a/src/esengine/bindings/WebSDKEntry.cpp b/src/esengine/bindings/WebSDKEntry.cpp
index 1767fc566..2176c551a 100644
--- a/src/esengine/bindings/WebSDKEntry.cpp
+++ b/src/esengine/bindings/WebSDKEntry.cpp
@@ -743,6 +743,8 @@ EMSCRIPTEN_BINDINGS(esengine_renderer) {
emscripten::function("renderer_setViewport", &esengine::renderer_setViewport);
emscripten::function("renderer_setYSortLayers", &esengine::renderer_setYSortLayers);
emscripten::function("renderer_setDepthLayers", &esengine::renderer_setDepthLayers);
+ emscripten::function("renderer_setQualityBudgets", &esengine::renderer_setQualityBudgets);
+ emscripten::function("renderer_setShadowDistance", &esengine::renderer_setShadowDistance);
emscripten::function("renderer_setCullingMask", &esengine::renderer_setCullingMask);
emscripten::function("renderer_setViewId", &esengine::renderer_setViewId);
emscripten::function("renderer_lodInspect", &esengine::renderer_lodInspect);
diff --git a/src/esengine/particle/ParticleSystem.cpp b/src/esengine/particle/ParticleSystem.cpp
index 790d8bb2a..686dbc975 100644
--- a/src/esengine/particle/ParticleSystem.cpp
+++ b/src/esengine/particle/ParticleSystem.cpp
@@ -263,6 +263,10 @@ void ParticleSystem::emitInto(const ecs::ParticleEmitter& emitter, EmitterState&
emitter.subEmitterTrigger ==
static_cast<i32>(ecs::SubEmitterTrigger::Birth);
+ if (particle_limit_ != 0xffffffffu) {
+ const u32 alive = totalAliveParticles();
+ count = std::min(count, alive < particle_limit_ ? particle_limit_ - alive : 0u);
+ }
for (u32 i = 0; i < count; ++i) {
Particle* p = state.pool.allocate();
if (!p) {
diff --git a/src/esengine/particle/ParticleSystem.hpp b/src/esengine/particle/ParticleSystem.hpp
index 75536833d..43e85e6b2 100644
--- a/src/esengine/particle/ParticleSystem.hpp
+++ b/src/esengine/particle/ParticleSystem.hpp
@@ -88,6 +88,7 @@ public:
u32 aliveCount(Entity entity) const;
u32 totalAliveParticles() const;
+ void setParticleLimit(u32 limit) { particle_limit_ = limit; }
void forEachParticle(Entity entity, const std::function<void(const Particle&)>& fn) const;
@@ -144,6 +145,7 @@ private:
std::unordered_map<Entity, SizeLut> sizeLuts_;
std::unordered_map<Entity, SizeLut> speedLuts_;
std::mt19937 rng_;
+ u32 particle_limit_ = 0xffffffffu;
std::vector<u32> dead_particle_indices_;
// Active scene force fields, rebuilt each update() and applied to world-space
// particles during integration.
diff --git a/src/esengine/renderer/frame/RenderFrame.cpp b/src/esengine/renderer/frame/RenderFrame.cpp
index 173d99c5a..1dbd80db3 100644
--- a/src/esengine/renderer/frame/RenderFrame.cpp
+++ b/src/esengine/renderer/frame/RenderFrame.cpp
@@ -1545,6 +1545,24 @@ static glm::vec3 cubeFace(u32 index) {
return dir;
}
+void RenderFrame::setShadowBudget(u32 atlasSize, u32 cellSize, u32 cascades) {
+ const auto powerOfTwo = [](u32 n) { return n > 0 && (n & (n - 1)) == 0; };
+ if (!powerOfTwo(atlasSize) || atlasSize < 512 || atlasSize > 4096
+ || !powerOfTwo(cellSize) || cellSize < 128 || cellSize > atlasSize / 2) {
+ ES_LOG_WARN("invalid shadow quality budget: atlas {}, cell {}", atlasSize, cellSize);
+ return;
+ }
+ shadow_cascades_ = std::clamp(cascades, 1u, MAX_SHADOW_CASCADES);
+ if (shadow_atlas_size_ == atlasSize && shadow_cell_size_ == cellSize) return;
+ shadow_atlas_size_ = atlasSize;
+ shadow_cell_size_ = cellSize;
+ shadow_atlas_ = ShadowAtlas(atlasSize, cellSize);
+}
+
+void RenderFrame::setShadowDistance(f32 distance) {
+ shadow_distance_ = std::isfinite(distance) ? std::max(distance, 0.0f) : 0.0f;
+}
+
void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
shadow_texture_id_ = 0;
shadow_resource_ = rg::kNoResource;
@@ -1576,6 +1594,14 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
// behind the far plane is a camera nothing can be seen through.
nearDist = std::max(nearDist, 1e-3f);
farDist = std::max(farDist, nearDist * 1.001f);
+ if (shadow_distance_ > 0.0f && shadow_distance_ < farDist) {
+ const f32 limitedFar = std::max(shadow_distance_, nearDist * 1.001f);
+ const f32 fraction = (limitedFar - nearDist) / (farDist - nearDist);
+ for (u32 i = 0; i < 4; ++i) {
+ corners[i + 4] = corners[i] + (corners[i + 4] - corners[i]) * fraction;
+ }
+ farDist = limitedFar;
+ }
}
// Who gets what. A light that stands somewhere claims first, because a sun taking the
@@ -1587,8 +1613,8 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
};
std::vector<TilePlan> plan(shadow_casters_.size());
shadow_plan_.clear();
- shadow_plan_.atlasSize = kShadowAtlasSize;
- shadow_plan_.cellSize = kShadowCellSize;
+ shadow_plan_.atlasSize = shadow_atlas_size_;
+ shadow_plan_.cellSize = shadow_cell_size_;
for (usize i = 0; i < shadow_casters_.size(); ++i) {
const ShadowCaster& caster = shadow_casters_[i];
if (caster.shape == ShadowShape::Box) continue;
@@ -1603,7 +1629,7 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
if (caster.shape != ShadowShape::Box) continue;
// A fixed reach is the author saying what the map covers; splitting it would
// hand the rest of the atlas to slices they never asked for.
- const u32 want = (perspective && caster.extent <= 0.0f) ? MAX_SHADOW_CASCADES : 1;
+ const u32 want = (perspective && caster.extent <= 0.0f) ? shadow_cascades_ : 1;
i32 at = -1;
const ShadowGrant grant = claimTiles(shadow_atlas_, caster.light, want,
kShadowCascadeCells, at);
@@ -1653,7 +1679,7 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
const glm::mat4 lightRotInv = glm::inverse(lightRot);
glm::vec3 centre(0.0f);
f32 radius = 1.0f;
- if (mine.count == 1) {
+ if (!perspective || caster.extent > 0.0f) {
// What the map covers: the 3D geometry, unless the light asked for a
// fixed reach. A radius, so coverage does not change as the light turns.
const CameraView view = computeCameraView(view_projection_);
@@ -1758,8 +1784,8 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
// the id has to exist NOW rather than when the pass runs — the atlas travels
// into the sort key of every draw that receives it, and the scene collects next.
rg::TargetDesc desc;
- desc.width = kShadowAtlasSize;
- desc.height = kShadowAtlasSize;
+ desc.width = shadow_atlas_size_;
+ desc.height = shadow_atlas_size_;
desc.depthStencil = true;
desc.linearFilter = false;
shadow_resource_ = graph_.createExternalTarget(desc);
@@ -1771,7 +1797,7 @@ void RenderFrame::buildShadowPlan(ecs::Registry& registry) {
shadow_texture_id_ = static_cast<u32>(graph_.textureOf(shadow_resource_));
context_.lights().setShadowTiles(
matrices, tiles, shadow_atlas_.tileCount(),
- glm::vec4(1.0f, 1.0f / static_cast<f32>(kShadowAtlasSize), 0.0f, 0.0f));
+ glm::vec4(1.0f, 1.0f / static_cast<f32>(shadow_atlas_size_), 0.0f, 0.0f));
// Which of them each light reads. Without it a fragment would test against
// every map in the atlas, including ones rendered from where it cannot see.
for (usize i = 0; i < shadow_casters_.size(); ++i) {
diff --git a/src/esengine/renderer/frame/RenderFrame.hpp b/src/esengine/renderer/frame/RenderFrame.hpp
index 70778278c..7df2aea30 100644
--- a/src/esengine/renderer/frame/RenderFrame.hpp
+++ b/src/esengine/renderer/frame/RenderFrame.hpp
@@ -105,6 +105,8 @@ public:
void init(u32 width, u32 height);
void shutdown();
void resize(u32 width, u32 height);
+ void setShadowBudget(u32 atlasSize, u32 cellSize, u32 cascades);
+ void setShadowDistance(f32 distance);
/** Geometry collected for this camera and drawn after its scene. */
void setPresentedOverlayDraw(ImmediateDraw* draw) { presented_overlay_draw_ = draw; }
@@ -870,6 +872,10 @@ private:
/// Who owns which square of the atlas. Rebuilt every frame: a tile means
/// nothing once the depths in it belong to a frame that is gone.
ShadowAtlas shadow_atlas_{kShadowAtlasSize, kShadowCellSize};
+ u32 shadow_atlas_size_ = kShadowAtlasSize;
+ u32 shadow_cell_size_ = kShadowCellSize;
+ u32 shadow_cascades_ = MAX_SHADOW_CASCADES;
+ f32 shadow_distance_ = 0.0f;
ShadowPlanReport shadow_plan_;
LightCapReport light_cap_;
/// The map's colour texture, handed to every mesh that receives it. 0 = none this frame.
diff --git a/src/esengine/renderer/store/HdrFormat.hpp b/src/esengine/renderer/store/HdrFormat.hpp
index 45d286b29..7d7e195c0 100644
--- a/src/esengine/renderer/store/HdrFormat.hpp
+++ b/src/esengine/renderer/store/HdrFormat.hpp
@@ -50,6 +50,7 @@ inline const char* pixelFormatName(GfxPixelFormat format) {
case GfxPixelFormat::RGBA8: return "RGBA8";
case GfxPixelFormat::SRGB8_ALPHA8: return "SRGB8_ALPHA8";
case GfxPixelFormat::RGBA16F: return "RGBA16F";
+ case GfxPixelFormat::RGBA32F: return "RGBA32F";
case GfxPixelFormat::DepthComponent24: return "DepthComponent24";
case GfxPixelFormat::Depth24Stencil8: return "Depth24Stencil8";
}
diff --git a/tools/check-entry-boots.mjs b/tools/check-entry-boots.mjs
index c073422d9..1acf0519a 100644
--- a/tools/check-entry-boots.mjs
+++ b/tools/check-entry-boots.mjs
@@ -53,7 +53,7 @@ if (!existsSync(path.join(SDK, 'dist', 'index.js'))) {
}
mkdirSync(path.join(work, 'node_modules'), { recursive: true });
-symlinkSync(SDK, path.join(work, 'node_modules', 'esengine'), 'dir');
+symlinkSync(SDK, path.join(work, 'node_modules', 'esengine'), process.platform === 'win32' ? 'junction' : 'dir');
const { build } = await import('esbuild');
const results = [];
diff --git a/tools/check-project-settings.mjs b/tools/check-project-settings.mjs
index 1d420aec7..4fde9447b 100644
--- a/tools/check-project-settings.mjs
+++ b/tools/check-project-settings.mjs
@@ -93,6 +93,10 @@ const DECLARED_GAPS = {
editor: 'the device preview reads it through projectSeams, not by applying it '
+ 'to the edit camera (the editor view is a free zoom by design)',
},
+ quality: {
+ editor: 'the edit viewport stays at authored quality; Play previews the selected '
+ + 'device tier and dynamic resolution through the same packaged app options',
+ },
uiThemeColors: {
editor: 'applied together with uiTheme (one applyWidgetTheme call takes both)',
},
@@ -114,6 +118,7 @@ const PARSE_KEY = {
renderBackend: 'r.backend',
screenFit: 'r.cameraScaleMode',
msaaSamples: 'r.msaa',
+ quality: 'r.quality',
};
/**
@@ -134,6 +139,7 @@ const AUTHORING = {
colorSpace: { ui: 'project.rendering.colorSpace' },
outputTransform: { ui: 'project.rendering.outputTransform' },
msaaSamples: { ui: 'project.rendering.msaa' },
+ quality: { ui: 'project.rendering.quality' },
renderBackend: { ui: 'project.rendering.backend' },
screenFit: { ui: 'project.display.cameraFit' },
};
diff --git a/tools/check-workflows.mjs b/tools/check-workflows.mjs
index 6b5394c97..2b37eaa40 100644
--- a/tools/check-workflows.mjs
+++ b/tools/check-workflows.mjs
@@ -164,7 +164,7 @@ function hiddenUploads(lines) {
const hiddenUploadViolations = [];
for (const file of readdirSync(WORKFLOWS).filter((f) => /\.ya?ml$/.test(f))) {
- const lines = readFileSync(path.join(WORKFLOWS, file), 'utf8').split('\n');
+ const lines = readFileSync(path.join(WORKFLOWS, file), 'utf8').split(/\r?\n/);
for (const v of hiddenUploads(lines)) hiddenUploadViolations.push({ file, ...v });
const found = jobs(lines);
const jobsAt = lines.findIndex((l) => /^jobs:\s*$/.test(l));
diff --git a/tools/launchers/launch-export.mjs b/tools/launchers/launch-export.mjs
index bff47cc8c..7ece8241f 100644
--- a/tools/launchers/launch-export.mjs
+++ b/tools/launchers/launch-export.mjs
@@ -38,6 +38,7 @@
* --render after settling, print the renderer counters of the last
* frame — draws, culls and LOD levels, which no pixel shows
* --facts after settling, print what the GAME says about its run
+ * --render-facts print the shipping renderer's backend and capabilities
* --gameplay p[,c] after settling, print what the third-person character
* IS: where it stands, what the physics step gave it, and
* what its animator was told
@@ -221,6 +222,7 @@ async function main() {
}
const PROBE = flag('probe', '');
const FACTS = has('facts');
+const RENDER_FACTS = has('render-facts');
/** What residency did — which cells exist, and what the subsystems still hold. */
const STREAMING = has('streaming');
const GAMEPLAY = flag('gameplay', '');
@@ -232,7 +234,7 @@ const RENDER = has('render');
const SCENE = flag('scene', '');
const server = await serve(DIR, flag('safe-area', ''), Number(flag('frame-ms', String(1000 / 60))), !!THROTTLE);
const query = new URLSearchParams();
- if (PROBE || GAMEPLAY || PARTICLES || COMBAT || AI || RENDER || FACTS || STREAMING) query.set('headless', '');
+ if (PROBE || GAMEPLAY || PARTICLES || COMBAT || AI || RENDER || FACTS || RENDER_FACTS || STREAMING) query.set('headless', '');
if (SCENE) query.set('scene', SCENE);
const search = query.toString() ? `?${query.toString().replace(/=$/, '').replace(/=&/g, '&')}` : '';
const base = `http://127.0.0.1:${server.address().port}/${search}`;
@@ -340,6 +342,12 @@ const SCENE = flag('scene', '');
).catch((e) => ({ error: String(e) }));
console.log(` facts: ${JSON.stringify(seen)}`);
}
+ if (RENDER_FACTS) {
+ const seen = await win.webContents.executeJavaScript(
+ 'window.__estellaCooked?.renderFacts() ?? null',
+ ).catch((e) => ({ error: String(e) }));
+ console.log(` render facts: ${JSON.stringify(seen)}`);
+ }
if (PROBE) {
const names = PROBE.split(',').map((n) => n.trim()).filter(Boolean);
const seen = await win.webContents.executeJavaScript(
diff --git a/tools/research/probe-update.mjs b/tools/research/probe-update.mjs
new file mode 100644
index 000000000..a2d5f619f
--- /dev/null
+++ b/tools/research/probe-update.mjs
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+import {bakeLightmap,unwrapLightmapUV,MeshChannel,MeshChannelType} from '../../sdk/dist/index.node.js';
+import {writeFile} from 'node:fs/promises';
+const p=[[0,-2,-2],[0,-2,2],[0,2,2],[0,2,-2]];
+const vertices=new Uint8Array(4*24),v=new DataView(vertices.buffer);
+p.forEach((q,i)=>{q.forEach((c,k)=>v.setFloat32(i*24+k*4,c,true));v.setFloat32(i*24+12,-1,true);});
+const mesh=unwrapLightmapUV({channels:[{semantic:MeshChannel.Position,components:3,type:MeshChannelType.Float32,offset:0},{semantic:MeshChannel.Normal,components:3,type:MeshChannelType.Float32,offset:12}],vertexStride:24,vertexCount:4,vertices,indices:Uint32Array.from([0,1,2,0,2,3]),aabbMin:[0,-2,-2],aabbMax:[0,2,2]}).mesh;
+const transform=Float32Array.from([1,0,0,0,0,1,0,0,0,0,1,0,3,0,0,1]);
+const surface={mesh,transform,albedo:[1,.3,.1]};
+const light=intensity=>[{kind:'directional',direction:[1,0,0],color:[1,1,1],intensity}];
+const options={atlasSize:64,texelsPerUnit:4,bounces:1,samples:64,probeSamples:256,probeGrids:[{min:[-1,0,-1],max:[1,0,1],resolution:[3,1,3]}]};
+const before=bakeLightmap([surface],light(1),options).probes[0];
+const times=[],fieldTimes=[]; let fresh;
+for(let i=0;i<10;i++){
+ let at=performance.now(); bakeLightmap([surface],light(3),{...options,probeGrids:[]});fieldTimes.push(performance.now()-at);
+ at=performance.now();fresh=bakeLightmap([surface],light(3),options).probes[0];times.push(performance.now()-at);
+}
+const old=before.slice(), errors=[];
+const error=()=>Math.sqrt(old.reduce((s,n,i)=>s+(n-fresh[i])**2,0)/old.length);
+errors.push(error());
+for(let i=0;i<9;i++){old.set(fresh.subarray(i*27,(i+1)*27),i*27);errors.push(error());}
+const report={scope:'Research only: fresh full solve followed by one probe publication per frame; solve itself is not time sliced',probeCount:9,coeffRmsErrorPerFrame:errors,fullSolveMs:times,fieldSolveMs:fieldTimes,fullSolveMaxMs:Math.max(...times),fieldSolveMaxMs:Math.max(...fieldTimes),frameBudgetMs:16.67};
+const output=process.argv.indexOf('--out');
+if(output>=0) await writeFile(process.argv[output+1],JSON.stringify(report,null,2));
+console.log(JSON.stringify(report,null,2));