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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
feat(corpus): a room that is actually lit, and a gate that keeps it lit
esengine054d93ed5eb9
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e46d2285d..1fbfd73e9 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,23 @@ published separately; it ships inside the editor.### Added+- **A room in the corpus is actually lit.** `physics-3d` — twenty-two boxes and+ two lamps — now ships with its lighting baked: an atlas beside the scene, and a+ `MeshLightmap` on every object saying where in it to read. It is the first+ shipped scene that carries one, and what closes the last debt+ `check-corpus-authoring` was tracking.++ `estella.mjs bake-scene` is the door CI and a rebake go through, beside the+ editor's Bake Lighting for a creator. It reads the document rather than a+ world, so it **refuses a scene with a hierarchy** — resolving one is the+ editor's answer, and an atlas lit for a place nothing is at looks like a bake+ that is wrong rather than one never run.++ A gate holds the result, because a baked room rots the moment the baker changes+ and a stale atlas looks exactly like a correct one. The bake is deterministic,+ so what is committed is simply compared to what a bake of it produces now —+ red if either the atlas or the scene has drifted, with the command to fix it.+- **Stock geometry takes a bake, and the density suits this engine's units.**Trying to bake a real example found both. `physics-3d` is twenty-two builtincubes and two lights — the most ordinary lightmap candidate there is — anddiff --git a/desktop b/desktopindex af88e40d7..6e7e16277 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit af88e40d7ab7da3a45da59a252bb6f93ec6dc795+Subproject commit 6e7e1627793adb5b1bae807889b79c554760478fdiff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.jsonindex 84b7953d8..f1c5f4297 100644--- a/docs/astro/src/data/apiStability.generated.json+++ b/docs/astro/src/data/apiStability.generated.json@@ -3,10 +3,10 @@"counts": {"public": 114,"beta": 101,- "experimental": 1889,+ "experimental": 1890,"deprecated": 3},- "total": 2104,+ "total": 2105,"subsystems": [{"id": "ecs",diff --git a/examples/physics-3d/assets/scenes/main.esscene b/examples/physics-3d/assets/scenes/main.essceneindex b7f7aa32d..9e0124beb 100644--- a/examples/physics-3d/assets/scenes/main.esscene+++ b/examples/physics-3d/assets/scenes/main.esscene@@ -85,6 +85,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.59765625,+ "y": 0.59765625,+ "z": 0,+ "w": 0+ }+ }}]},@@ -141,6 +153,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.1455078125,+ "y": 0.1455078125,+ "z": 0.59765625,+ "w": 0.21875+ }+ }}]},@@ -197,6 +221,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.169921875,+ "y": 0.169921875,+ "z": 0.81640625,+ "w": 0+ }+ }}]},@@ -253,6 +289,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.21875,+ "y": 0.21875,+ "z": 0.59765625,+ "w": 0+ }+ }}]},@@ -311,6 +359,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.05078125,+ "y": 0.05078125,+ "z": 0.939453125,+ "w": 0.3935546875+ }+ }}]},@@ -369,6 +429,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.05078125,+ "y": 0.05078125,+ "z": 0.666015625,+ "w": 0.4267578125+ }+ }}]},@@ -427,6 +499,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.05078125,+ "y": 0.05078125,+ "z": 0.59765625,+ "w": 0.4326171875+ }+ }}]},@@ -483,6 +567,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0712890625,+ "y": 0.0712890625,+ "z": 0.8818359375,+ "w": 0.322265625+ }+ }}]},@@ -560,6 +656,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.138671875,+ "y": 0.138671875,+ "z": 0.7431640625,+ "w": 0.322265625+ }+ }}]},@@ -608,6 +716,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0625,+ "y": 0.0625,+ "z": 0.666015625,+ "w": 0.3642578125+ }+ }}]},@@ -735,6 +855,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.044921875,+ "y": 0.044921875,+ "z": 0.939453125,+ "w": 0.4443359375+ }+ }}]},@@ -796,6 +928,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0419921875,+ "y": 0.0419921875,+ "z": 0.759765625,+ "w": 0.4609375+ }+ }}]},@@ -850,6 +994,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0576171875,+ "y": 0.0576171875,+ "z": 0.8818359375,+ "w": 0.3935546875+ }+ }}]},@@ -902,6 +1058,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.15234375,+ "y": 0.15234375,+ "z": 0.81640625,+ "w": 0.169921875+ }+ }}]},@@ -957,6 +1125,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.033203125,+ "y": 0.033203125,+ "z": 0.6484375,+ "w": 0.4775390625+ }+ }}]},@@ -1029,6 +1209,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.037109375,+ "y": 0.037109375,+ "z": 0.8017578125,+ "w": 0.4609375+ }+ }}]},@@ -1085,6 +1277,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.04296875,+ "y": 0.04296875,+ "z": 0.8818359375,+ "w": 0.451171875+ }+ }}]},@@ -1147,6 +1351,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.04296875,+ "y": 0.04296875,+ "z": 0.716796875,+ "w": 0.4609375+ }+ }}]},@@ -1202,6 +1418,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0283203125,+ "y": 0.0283203125,+ "z": 0.681640625,+ "w": 0.4775390625+ }+ }}]},@@ -1266,6 +1494,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.0341796875,+ "y": 0.0341796875,+ "z": 0.8388671875,+ "w": 0.4609375+ }+ }}]},@@ -1321,6 +1561,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.025390625,+ "y": 0.025390625,+ "z": 0.59765625,+ "w": 0.4833984375+ }+ }}]},@@ -1396,6 +1648,18 @@"a": 1}}+ },+ {+ "type": "MeshLightmap",+ "data": {+ "lightmap": "main_lightmap.png",+ "scaleOffset": {+ "x": 0.068359375,+ "y": 0.068359375,+ "z": 0.59765625,+ "w": 0.3642578125+ }+ }}]}diff --git a/examples/physics-3d/assets/scenes/main_lightmap.png b/examples/physics-3d/assets/scenes/main_lightmap.pngnew file mode 100644index 000000000..ea9cc1820Binary files /dev/null and b/examples/physics-3d/assets/scenes/main_lightmap.png differdiff --git a/pipeline/bin/estella.mjs b/pipeline/bin/estella.mjsindex 80949a8f8..6b6b33cdf 100644--- a/pipeline/bin/estella.mjs+++ b/pipeline/bin/estella.mjs@@ -16,6 +16,7 @@ const USAGE = `usage: node pipeline/bin/estella.mjs export <projectDir> [optionsnode pipeline/bin/estella.mjs import-model <file.gltf|file.glb|file.fbx> [outDir][--project <dir>] [--scale <n>]node pipeline/bin/estella.mjs import-hdr <file.hdr> [outDir] [--face-size <n>]+ node pipeline/bin/estella.mjs bake-scene <scene.esscene> [--check]--platform <id> web | desktop | wechat | playable | android | ios (default web)--out <dir> output dir (default <projectDir>/dist-<platform>)@@ -61,6 +62,13 @@ function parseArgs(argv) {console.log(USAGE);process.exit(0);}+ if (command === 'bake-scene') {+ if (!projectDir) {+ console.error(USAGE);+ process.exit(2);+ }+ return { command, source: path.resolve(projectDir), check: rest.includes('--check') };+ }if (command === 'import-model' || command === 'import-gltf' || command === 'import-hdr') {if (!projectDir) {console.error(USAGE);@@ -107,6 +115,133 @@ const HOST_DESKTOP_OS = process.platform === 'darwin' ? 'macos'* with a `require` shim, because some dependencies are CommonJS (pngjs). esbuild* itself stays external and resolves at runtime.*/+const BAKE_IDENTITY_Q = { x: 0, y: 0, z: 0, w: 1 };+const BAKE_ONE = { x: 1, y: 1, z: 1 };+const BAKE_ZERO = { x: 0, y: 0, z: 0 };+const BAKE_LIGHT_KIND = { 0: 'point', 1: 'directional', 2: 'spot' };++const bakeComponent = (entity, type) => entity.components?.find((c) => c.type === type);+const bakeVec = (v, fallback) => ({ ...fallback, ...(v ?? {}) });++/** Column-major 4x4 from a document's Transform. Flat scenes only — see bakeScene. */+function bakeTransformOf(entity) {+ const tf = bakeComponent(entity, 'Transform')?.data ?? {};+ const p = bakeVec(tf.position, BAKE_ZERO);+ const { x, y, z, w } = bakeVec(tf.rotation, BAKE_IDENTITY_Q);+ const s = bakeVec(tf.scale, BAKE_ONE);+ return [+ (1 - 2 * (y * y + z * z)) * s.x, (2 * (x * y + z * w)) * s.x, (2 * (x * z - y * w)) * s.x, 0,+ (2 * (x * y - z * w)) * s.y, (1 - 2 * (x * x + z * z)) * s.y, (2 * (y * z + x * w)) * s.y, 0,+ (2 * (x * z + y * w)) * s.z, (2 * (y * z - x * w)) * s.z, (1 - 2 * (x * x + y * y)) * s.z, 0,+ p.x, p.y, p.z, 1,+ ];+}++/** Where a light aims: -Z under its rotation, as the renderer reads it. */+function bakeForwardOf(q) {+ const { x, y, z, w } = q;+ return [-2 * (x * z + y * w), -2 * (y * z - x * w), -(1 - 2 * (x * x + y * y))];+}++/**+ * Bakes a shipped scene, or checks that what is committed IS a bake of it.+ *+ * Reads the DOCUMENT rather than a world, which is why a scene with a hierarchy+ * is refused: resolving one is the editor's job, and an atlas lit for a place+ * nothing is at looks like a bake that is wrong rather than one never run.+ */+async function bakeScene(baker, sceneFile, check) {+ const sceneDir = path.dirname(sceneFile);+ const rel = path.relative(REPO, sceneFile);+ const scene = JSON.parse(readFileSync(sceneFile, 'utf8'));++ const parented = (scene.entities ?? []).filter((e) => e.parent != null);+ if (parented.length > 0) {+ console.error(`bake-scene: ${rel} has ${parented.length} parented entit(ies), whose world`+ + ' transforms only the editor resolves — bake it there instead.');+ return 1;+ }++ const surfaces = [];+ const lights = [];+ for (const entity of scene.entities ?? []) {+ const tf = bakeComponent(entity, 'Transform')?.data ?? {};+ const mesh = bakeComponent(entity, 'MeshRenderer');+ const light = bakeComponent(entity, 'Light');+ if (mesh && mesh.data?.enabled !== false) {+ const ref = typeof mesh.data?.mesh === 'string' ? mesh.data.mesh : '';+ const builtin = ref.startsWith('builtin:') ? ref : undefined;+ const file = builtin ? '' : path.resolve(sceneDir, ref);+ if (builtin || (ref && existsSync(file))) {+ const c = mesh.data?.color;+ surfaces.push({+ entity: entity.id, label: entity.name ?? String(entity.id),+ meshFile: file, builtinRef: builtin, transform: bakeTransformOf(entity),+ baseColor: c ? [c.r ?? 1, c.g ?? 1, c.b ?? 1] : undefined,+ });+ }+ }+ if (light && light.data?.enabled !== false) {+ const d = light.data ?? {};+ const p = bakeVec(tf.position, BAKE_ZERO);+ const kind = BAKE_LIGHT_KIND[d.type ?? 0] ?? 'point';+ const cos = (deg) => Math.cos(((deg ?? 45) * Math.PI) / 180 / 2);+ lights.push({+ kind, position: [p.x, p.y, p.z],+ direction: bakeForwardOf(bakeVec(tf.rotation, BAKE_IDENTITY_Q)),+ color: [d.color?.r ?? 1, d.color?.g ?? 1, d.color?.b ?? 1],+ intensity: d.intensity ?? 1,+ radius: kind === 'directional' ? undefined : (d.radius ?? 200),+ innerCos: cos(d.innerAngle), outerCos: cos(d.outerAngle),+ });+ }+ }++ const result = baker.bakeSceneLightmap({ surfaces, lights });+ for (const w of result.warnings) console.warn(` ! ${w}`);++ const stem = path.basename(sceneFile).replace(/\.esscene$/i, '');+ const atlasName = `${stem}_lightmap.png`;+ const atlasFile = path.join(sceneDir, atlasName);++ const placed = new Map();+ result.scaleOffset.forEach((rect, i) => { if (rect) placed.set(surfaces[i].entity, rect); });+ for (const entity of scene.entities ?? []) {+ const rect = placed.get(entity.id);+ const at = entity.components.findIndex((c) => c.type === 'MeshLightmap');+ if (!rect) {+ if (at >= 0) entity.components.splice(at, 1);+ continue;+ }+ const data = { lightmap: atlasName,+ scaleOffset: { x: rect[0], y: rect[1], z: rect[2], w: rect[3] } };+ if (at >= 0) entity.components[at] = { type: 'MeshLightmap', data };+ else entity.components.push({ type: 'MeshLightmap', data });+ }+ const document = `${JSON.stringify(scene, null, 2)}\n`;++ if (check) {+ const staleAtlas = !existsSync(atlasFile)+ || Buffer.compare(readFileSync(atlasFile), Buffer.from(result.atlasBytes)) !== 0;+ const staleScene = readFileSync(sceneFile, 'utf8') !== document;+ if (staleAtlas || staleScene) {+ const what = [staleAtlas && 'the atlas', staleScene && 'the scene'].filter(Boolean).join(' and ');+ console.error(`bake-scene: ${rel} is not what a bake of it produces (${what} differ).`);+ console.error(`Rebake: node pipeline/bin/estella.mjs bake-scene ${rel}`);+ return 1;+ }+ console.log(`bake-scene: ${rel} matches a fresh bake`+ + ` (${result.lumels} lumel(s) over ${placed.size} object(s)).`);+ return 0;+ }++ writeFileSync(atlasFile, result.atlasBytes);+ writeFileSync(sceneFile, document);+ console.log(`bake-scene: ${result.lumels} lumel(s) over ${placed.size} object(s)`+ + ` -> ${path.relative(REPO, atlasFile)}`);+ return 0;+}+async function loadPipeline(entry, outName) {const require = createRequire(path.join(PIPELINE, 'package.json'));const esbuild = require('esbuild');@@ -291,6 +426,16 @@ if (opts.command === 'import-model' || opts.command === 'import-gltf') {process.exit(imported > 0 ? 0 : 1);}+if (opts.command === 'bake-scene') {+ const { mod: baker, cleanup } = await loadPipeline(+ path.join(PIPELINE, 'src', 'assets', 'lightmapBake.ts'), 'lightmapBake.mjs');+ try {+ process.exit(await bakeScene(baker, opts.source, opts.check));+ } finally {+ cleanup();+ }+}+if (opts.command === 'import-hdr') {const { mod: importer, cleanup } = await loadPipeline(path.join(PIPELINE, 'src', 'assets', 'environmentImport.ts'), 'environmentImport.mjs');diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.mdindex c0d2d0e5a..5906db100 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: 114 public · 94 beta · 1728 experimental · 3 deprecated+Symbols: 114 public · 94 beta · 1729 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -11346,6 +11346,11 @@ BtPlugin(graph: MaterialGraph): string```+## composeTRS — function @experimental+```+(p: { x: number; y: number; z: number; }, q: { x: number; y: number; z: number; w: number; }, s: { x: number; y: number; z: number; }): number[]+```+## compressedUploadDecision — function @experimental```(target: CompressedTextureFormat | null, transcoded: boolean): TextureUploadDecisiondiff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.mdindex ae0c03660..22dcc59b4 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: 114 public · 99 beta · 1747 experimental · 3 deprecated+Symbols: 114 public · 99 beta · 1748 experimental · 3 deprecated## ABI_LAYOUT_HASH — const @experimental```@@ -11554,6 +11554,11 @@ BtPlugin(graph: MaterialGraph): string```+## composeTRS — function @experimental+```+(p: { x: number; y: number; z: number; }, q: { x: number; y: number; z: number; w: number; }, s: { x: number; y: number; z: number; }): number[]+```+## compressedUploadDecision — function @experimental```(target: CompressedTextureFormat | null, transcoded: boolean): TextureUploadDecisiondiff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.mdindex a64b3f4bc..83e9d7883 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: 114 public · 96 beta · 1727 experimental · 3 deprecated+Symbols: 114 public · 96 beta · 1728 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -11341,6 +11341,11 @@ BtPlugin(graph: MaterialGraph): string```+## composeTRS — function @experimental+```+(p: { x: number; y: number; z: number; }, q: { x: number; y: number; z: number; w: number; }, s: { x: number; y: number; z: number; }): number[]+```+## compressedUploadDecision — function @experimental```(target: CompressedTextureFormat | null, transcoded: boolean): TextureUploadDecisiondiff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.mdindex b9c136b35..5ba14d953 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: 114 public · 94 beta · 1749 experimental · 3 deprecated+Symbols: 114 public · 94 beta · 1750 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -11595,6 +11595,11 @@ BtPlugin(graph: MaterialGraph): string```+## composeTRS — function @experimental+```+(p: { x: number; y: number; z: number; }, q: { x: number; y: number; z: number; w: number; }, s: { x: number; y: number; z: number; }): number[]+```+## compressedUploadDecision — function @experimental```(target: CompressedTextureFormat | null, transcoded: boolean): TextureUploadDecisiondiff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.mdindex b1f5333f7..87cd23f07 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: 114 public · 94 beta · 1739 experimental · 3 deprecated+Symbols: 114 public · 94 beta · 1740 experimental · 3 deprecated## ANCHOR_AXES — const @experimental```@@ -11369,6 +11369,11 @@ BtPlugin(graph: MaterialGraph): string```+## composeTRS — function @experimental+```+(p: { x: number; y: number; z: number; }, q: { x: number; y: number; z: number; w: number; }, s: { x: number; y: number; z: number; }): number[]+```+## compressedUploadDecision — function @experimental```(target: CompressedTextureFormat | null, transcoded: boolean): TextureUploadDecisiondiff --git a/sdk/src/core-sys.ts b/sdk/src/core-sys.tsindex c37c34cea..096c4ba8d 100644--- a/sdk/src/core-sys.ts+++ b/sdk/src/core-sys.ts@@ -17,6 +17,14 @@// =============================================================================export { exact, scalar, v2, v3, q, col } from './math';+/**+ * A world transform as a column-major 4x4, from a resolved TRS. Public because+ * more than one reader outside the engine wants it in that form — a bake+ * collects it from the editor's world, a tool collects it from a document.+ *+ * @experimental Pre-1.0.+ */+export { composeTRS } from './math/mat4';// The engine's one curve: a timeline channel, a particle's size over life, and the// editor's curve control all author and sample THIS.export {diff --git a/sdk/src/math/mat4.ts b/sdk/src/math/mat4.tsindex c77dada28..398e04d41 100644--- a/sdk/src/math/mat4.ts+++ b/sdk/src/math/mat4.ts@@ -161,6 +161,25 @@ export function invertViewOrbit(const _mulM = new Float32Array(16);+/**+ * A world transform as a column-major 4x4, from the TRS the engine resolved.+ *+ * One author for it, because more than one reader wants it in this form — a bake+ * collects it from the editor's world, and a tool collects it from a document —+ * and two transcriptions of a rotation matrix are two chances to transpose one.+ */+export function composeTRS(p: { x: number; y: number; z: number },+ q: { x: number; y: number; z: number; w: number },+ s: { x: number; y: number; z: number }): number[] {+ const { x, y, z, w } = q;+ return [+ (1 - 2 * (y * y + z * z)) * s.x, (2 * (x * y + z * w)) * s.x, (2 * (x * z - y * w)) * s.x, 0,+ (2 * (x * y - z * w)) * s.y, (1 - 2 * (x * x + z * z)) * s.y, (2 * (y * z + x * w)) * s.y, 0,+ (2 * (x * z + y * w)) * s.z, (2 * (y * z - x * w)) * s.z, (1 - 2 * (x * x + y * y)) * s.z, 0,+ p.x, p.y, p.z, 1,+ ];+}+export function multiply(a: Float32Array, b: Float32Array): Float32Array {const m = _mulM;for (let i = 0; i < 4; i++) {diff --git a/tools/check-corpus-authoring.mjs b/tools/check-corpus-authoring.mjsindex 368f3e110..a48acc0a4 100644--- a/tools/check-corpus-authoring.mjs+++ b/tools/check-corpus-authoring.mjs@@ -120,8 +120,6 @@ const DISPOSITION = {// — owed: a creator-facing component nothing in the shipped corpus authors.// Each reason names where the coverage belongs. —- MeshLightmap: ['owed', 'the reading side shipped before the baking side, deliberately: nothing in the editor produces an atlas yet, so a corpus scene would have to carry one baked in another tool. The coverage belongs with the lightmapper, in the example whose room it lights'],-};const snapshot = JSON.parse(readFileSync(SNAPSHOT, 'utf8'));diff --git a/tools/gates.mjs b/tools/gates.mjsindex a0d369550..4b624fa9b 100644--- a/tools/gates.mjs+++ b/tools/gates.mjs@@ -221,6 +221,15 @@ export const GATES = [{ id: 'import-settings', run: 'node tools/check-import-settings.mjs' },{ id: 'gizmo-coverage', run: 'node tools/check-gizmo-coverage.mjs', needs: 'editor' },{ id: 'corpus-authoring', run: 'node tools/check-corpus-authoring.mjs' },+ {+ // A baked room in the corpus rots the moment the baker changes, and a stale+ // atlas looks exactly like a correct one. Rebaking is deterministic, so what+ // is committed can simply be compared to what a bake of it produces now.+ id: 'corpus-bake',+ run: 'node pipeline/bin/estella.mjs bake-scene'+ + ' examples/physics-3d/assets/scenes/main.esscene --check',+ why: 'the bake reads the meshes the scene names, and takes about ten seconds',+ },{ id: 'asset-vocabulary', run: 'node tools/check-asset-vocabulary.mjs' },{ id: 'lod-authoring', run: 'node tools/check-lod-authoring.mjs', needs: 'editor' },{ id: 'shadow-plan', run: 'node tools/check-shadow-plan.mjs' },diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex ad228c561..2501f9fdf 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,11 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'feat(corpus): a room that is actually lit, and a gate that keeps it lit':+ { note: 'A room in the corpus is actually lit.' },+ 'refactor(engine): the collector composes a transform through the SDK\'s own':+ { internal: 'where one expression lives — the matrix it produces is identical' },+'feat(lighting): stock geometry takes a bake, and a refused one says why':{ note: 'Stock geometry takes a bake, and the density suits this engine\'s units.' },'feat(render): a bake derives UVs for geometry that has no file':