@fleox/agent3d 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (122) hide show
  1. package/README.md +16 -14
  2. package/changelog.json +25 -0
  3. package/dist/agent/agent3d.mjs +802 -90
  4. package/dist/agent/chunks/{assets-YBkgdfgy.mjs → assets-DdzHgVcn.mjs} +2 -2
  5. package/dist/agent/chunks/{browser-Dil7VM5m.mjs → browser-nFaRUETt.mjs} +1 -1
  6. package/dist/agent/chunks/{cdp-DLEis_Z3.mjs → cdp-6vF_gP-H.mjs} +1 -1
  7. package/dist/agent/chunks/{check-DP9fRYbK.mjs → check-E7GdPxTt.mjs} +14 -2
  8. package/dist/agent/chunks/{depth-CD_ql3QJ.mjs → depth-Bf7cHwod.mjs} +4 -4
  9. package/dist/agent/chunks/{depth-BZT4gseQ.mjs → depth-DEaogEAi.mjs} +4 -114
  10. package/dist/agent/chunks/{export-bJwh2SqG.mjs → export-BSOqVfPT.mjs} +87 -7
  11. package/dist/agent/chunks/{imageCodec-DeGfmBp3.mjs → imageCodec-DXxqkEQA.mjs} +53 -4
  12. package/dist/agent/chunks/{objects-DuytRxiC.mjs → objects-DvzrcVmK.mjs} +2 -2
  13. package/dist/agent/chunks/{optimizeSizing-B-BBiUkD.mjs → optimizeSizing-Dd8vaSnE.mjs} +24 -1
  14. package/dist/agent/chunks/{package-fMbw9UGh.mjs → package-DzXqX5Oe.mjs} +2 -2
  15. package/dist/agent/chunks/photoPlacement-D-k3mD0T.mjs +138 -0
  16. package/dist/agent/chunks/plate-Cwl35I2T.mjs +604 -0
  17. package/dist/agent/chunks/pngEncode-BMc3U9QC.mjs +119 -0
  18. package/dist/agent/chunks/{render-B05DU4Q5.mjs → render-CCKciCgu.mjs} +76 -11
  19. package/dist/agent/chunks/{scene-DWgXH6As.mjs → scene-DSjsun-3.mjs} +22 -5
  20. package/dist/agent/chunks/{server-Dt_YFvN7.mjs → server-CLvLORgA.mjs} +1 -1
  21. package/dist/agent/chunks/{tools-Cm4BqDkO.mjs → tools-Vs74Xopx.mjs} +153 -14
  22. package/dist/runtime/agent3d-photo.js +72 -0
  23. package/dist/runtime/agent3d-runtime.js +41 -41
  24. package/dist/runtime/agent3d-runtime.single.js +526 -250
  25. package/dist/runtime/chunks/assets-kC2Z1Xy_.js +1 -0
  26. package/dist/runtime/chunks/game-CbQaEB4q.js +20 -0
  27. package/dist/runtime/chunks/materials-jwhXlLYl.js +107 -0
  28. package/dist/runtime/chunks/model-CG5T_jcB.js +1 -0
  29. package/dist/runtime/chunks/num-CQNAlL82.js +1 -0
  30. package/dist/runtime/chunks/photo-Dq-AKlfw.js +526 -0
  31. package/dist/runtime/chunks/physicsHost-BU-2V-CZ.js +1 -0
  32. package/dist/runtime/chunks/{postfx-Cbf_vvOr.js → postfx-DnIeKXAh.js} +1 -1
  33. package/dist/runtime/chunks/postfx-ylpcQcVK.js +1 -0
  34. package/dist/runtime/chunks/svg-fYjsY-rV.js +1 -0
  35. package/dist/runtime/chunks/{text-rSo_2Luk.js → text-CySfj5sH.js} +1 -1
  36. package/dist/runtime/chunks/util-BEflQURG.js +1 -0
  37. package/dist/studio/assets/BufferGeometryUtils-BbzK4rCj.js +1 -0
  38. package/dist/studio/assets/{EXRLoader-BKkzlNd8.js → EXRLoader-CuDOo1xG.js} +1 -1
  39. package/dist/studio/assets/{FontLoader-Bzjx8mXt.js → FontLoader-DlBfss5q.js} +1 -1
  40. package/dist/studio/assets/{GLTFLoader-1Zd9N406.js → GLTFLoader-bl1eymL4.js} +1 -1
  41. package/dist/studio/assets/{GroundedSkybox-BEMqNCBD.js → GroundedSkybox-cLn9JVlt.js} +1 -1
  42. package/dist/studio/assets/{HDRLoader-DxB0kxPH.js → HDRLoader-8EiZoQQP.js} +1 -1
  43. package/dist/studio/assets/{OrbitControls-MlE9XiCg.js → OrbitControls-1xEm394I.js} +1 -1
  44. package/dist/studio/assets/{RectAreaLightUniformsLib-ClHrtYY6.js → RectAreaLightUniformsLib-S0AelTmO.js} +1 -1
  45. package/dist/studio/assets/{RoomEnvironment-MJ-jIEC8.js → RoomEnvironment-v4QurKxu.js} +1 -1
  46. package/dist/studio/assets/{SVGLoader-CIYl0nEy.js → SVGLoader-KDBVv02P.js} +1 -1
  47. package/dist/studio/assets/{Sky-DNMfpp92.js → Sky-D8Lp9Zh3.js} +1 -1
  48. package/dist/studio/assets/assets-DnOt59SU.js +2 -0
  49. package/dist/studio/assets/camera-DrubOxWu.js +2 -0
  50. package/dist/studio/assets/catalog-DDg904x2.js +1 -0
  51. package/dist/studio/assets/{editor-NkBUKsDB.js → editor-V--luWVq.js} +1 -1
  52. package/dist/studio/assets/{extrude-9bG8hr2C.js → extrude-BpJda0hq.js} +1 -1
  53. package/dist/studio/assets/game-43BhY_EE.js +19 -0
  54. package/dist/studio/assets/{generators-BjIs-kHx.js → generators-lG93qWTO.js} +5 -5
  55. package/dist/studio/assets/index-BPVRhKVV.js +479 -0
  56. package/dist/studio/assets/index-D-TPNQMQ.css +1 -0
  57. package/dist/studio/assets/model-D8-inS_D.js +2 -0
  58. package/dist/studio/assets/num-CQNAlL82.js +1 -0
  59. package/dist/studio/assets/params-BZqUA__U.js +1 -0
  60. package/dist/studio/assets/photo-BuVK-UvQ.js +526 -0
  61. package/dist/studio/assets/physicsHost-EkPuIy04.js +1 -0
  62. package/dist/studio/assets/{postfx-BGu30OJK.js → postfx-Bcnem9ci.js} +13 -13
  63. package/dist/studio/assets/rolldown-runtime-4tVxZq34.js +1 -0
  64. package/dist/studio/assets/runtime-5Ti8UJJR.js +572 -0
  65. package/dist/studio/assets/{shaders-Dt6FGXH_.js → shaders-WM5brr9C.js} +1 -1
  66. package/dist/studio/assets/svg-CJ_RtiER.js +2 -0
  67. package/dist/studio/assets/text-NO7lyCoH.js +3 -0
  68. package/dist/studio/assets/three.module-B9FlcKtd.js +4225 -0
  69. package/dist/studio/index.html +5 -3
  70. package/package.json +2 -2
  71. package/plugin/.claude-plugin/plugin.json +1 -1
  72. package/plugin/skills/agent3d-assets/SKILL.md +42 -27
  73. package/plugin/skills/agent3d-create/SKILL.md +77 -29
  74. package/plugin/skills/agent3d-create/references/art-direction.md +3 -3
  75. package/plugin/skills/agent3d-create/references/recipes.md +6 -6
  76. package/plugin/skills/agent3d-edit/SKILL.md +22 -22
  77. package/plugin/skills/agent3d-edit/references/patch-ops.md +3 -3
  78. package/plugin/skills/agent3d-game/SKILL.md +7 -7
  79. package/plugin/skills/agent3d-publish/SKILL.md +32 -23
  80. package/plugin/skills/agent3d-publish/references/integrations.md +1 -1
  81. package/templates/hero-scroll-story/README.md +1 -1
  82. package/templates/photo-scroll-story/README.md +29 -0
  83. package/templates/photo-scroll-story/agent3d.json +8 -0
  84. package/templates/photo-scroll-story/assets/depth/lake-depth.png +0 -0
  85. package/templates/photo-scroll-story/assets/depth/street-depth.png +0 -0
  86. package/templates/photo-scroll-story/assets/manifest.json +46 -0
  87. package/templates/photo-scroll-story/assets/textures/lake.webp +0 -0
  88. package/templates/photo-scroll-story/assets/textures/street.webp +0 -0
  89. package/templates/photo-scroll-story/preview.png +0 -0
  90. package/templates/photo-scroll-story/scene.json +112 -0
  91. package/templates/photo-scroll-story/template.json +8 -0
  92. package/templates/photo-title-inside/README.md +31 -0
  93. package/templates/photo-title-inside/agent3d.json +8 -0
  94. package/templates/photo-title-inside/assets/depth/street-depth.png +0 -0
  95. package/templates/photo-title-inside/assets/manifest.json +25 -0
  96. package/templates/photo-title-inside/assets/textures/street.webp +0 -0
  97. package/templates/photo-title-inside/preview.png +0 -0
  98. package/templates/photo-title-inside/scene.json +80 -0
  99. package/templates/photo-title-inside/template.json +8 -0
  100. package/dist/runtime/chunks/assets-qnxDnVkj.js +0 -1
  101. package/dist/runtime/chunks/game-BoEiyZrL.js +0 -20
  102. package/dist/runtime/chunks/materials-dC4vDNHh.js +0 -107
  103. package/dist/runtime/chunks/model-BCAl_NRl.js +0 -1
  104. package/dist/runtime/chunks/photo-DNf14X7B.js +0 -250
  105. package/dist/runtime/chunks/physicsHost-ChPgysMQ.js +0 -1
  106. package/dist/runtime/chunks/postfx-CFucYRev.js +0 -1
  107. package/dist/runtime/chunks/svg-CLUxY6Zy.js +0 -1
  108. package/dist/runtime/chunks/util-CyaW1fcW.js +0 -1
  109. package/dist/studio/assets/BufferGeometryUtils-CAlXAboW.js +0 -1
  110. package/dist/studio/assets/assets-BW5lQkYR.js +0 -1
  111. package/dist/studio/assets/camera-BgzPVnn-.js +0 -2
  112. package/dist/studio/assets/game-DARpu0ah.js +0 -19
  113. package/dist/studio/assets/index-BQT0otii.css +0 -1
  114. package/dist/studio/assets/index-L-N-e2KM.js +0 -479
  115. package/dist/studio/assets/model-CqI8j03Z.js +0 -2
  116. package/dist/studio/assets/params-DhsDKSDs.js +0 -1
  117. package/dist/studio/assets/photo-DAHd1yNF.js +0 -250
  118. package/dist/studio/assets/physicsHost-tEUto2-_.js +0 -1
  119. package/dist/studio/assets/runtime-C_qkIpAK.js +0 -572
  120. package/dist/studio/assets/svg-ZZt5MdNf.js +0 -2
  121. package/dist/studio/assets/text-B-HM422i.js +0 -3
  122. package/dist/studio/assets/three.module-CnI50X0U.js +0 -4225
@@ -5,9 +5,9 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
- import { A as OpsError, F as writeJson, I as normalizePath, M as nowIso, N as readJsonOr, O as slugify, d as readSceneFile, f as saveScene, k as KB, o as ASSET_MANIFEST_FILE } from "../agent3d.mjs";
8
+ import { F as KB, H as normalizePath, I as OpsError, P as slugify, R as nowIso, V as writeJson, _ as readSceneFile, f as ASSET_MANIFEST_FILE, v as saveScene, z as readJsonOr } from "../agent3d.mjs";
9
9
  import { t as closest } from "./suggest-Cpcgv1RP.mjs";
10
- import { a as collectAssetRefs, i as planTextureSizes, l as visitAssetRefs, n as imageHeader, s as kindFromPath } from "./optimizeSizing-B-BBiUkD.mjs";
10
+ import { a as collectAssetRefs, i as planTextureSizes, l as visitAssetRefs, n as imageHeader, s as kindFromPath } from "./optimizeSizing-Dd8vaSnE.mjs";
11
11
  import { i as modelInfo, r as modelFileBounds } from "./gltf-f_f0-OiV.mjs";
12
12
  // src/ops/zip.ts
13
13
  var ZipError = class extends Error {
@@ -4,7 +4,7 @@ import { dirname as __a3dDirname, delimiter, join } from "node:path";
4
4
  __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
- import { H as CliError } from "../agent3d.mjs";
7
+ import { J as CliError } from "../agent3d.mjs";
8
8
  import { existsSync, mkdtempSync, readdirSync, rmSync, statSync } from "node:fs";
9
9
  import { homedir, tmpdir } from "node:os";
10
10
  import { execFile, spawn } from "node:child_process";
@@ -4,7 +4,7 @@ import { dirname as __a3dDirname } from "node:path";
4
4
  __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
- import { H as CliError } from "../agent3d.mjs";
7
+ import { J as CliError } from "../agent3d.mjs";
8
8
  // agent/render/cdp.ts
9
9
  var DEFAULT_TIMEOUT_MS = Number(process.env.AGENT3D_CDP_TIMEOUT_MS) || 6e4;
10
10
  var CdpError = class extends Error {
@@ -5,11 +5,12 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
- import { C as CATALOG, N as readJsonOr, S as libraryId, T as catalogEntry, _ as validateScene, b as findLibraryAsset, c as SCENE_FILE, d as readSceneFile, k as KB, m as DEFAULT_BUDGET_KB, o as ASSET_MANIFEST_FILE, v as expandPostFx, w as GENERATORS, x as isLibraryRef, y as postfxCost } from "../agent3d.mjs";
8
+ import { A as GENERATORS, C as validateScene, D as isLibraryRef, E as findLibraryAsset, F as KB, O as libraryId, T as postfxCost, _ as readSceneFile, b as DEFAULT_BUDGET_KB, f as ASSET_MANIFEST_FILE, j as catalogEntry, k as CATALOG, m as SCENE_FILE, w as expandPostFx, z as readJsonOr } from "../agent3d.mjs";
9
9
  import { t as closest } from "./suggest-Cpcgv1RP.mjs";
10
10
  import { o as walkObjects } from "./tree-CqSj-o8T.mjs";
11
11
  import { i as modelInfo } from "./gltf-f_f0-OiV.mjs";
12
- import { a as collectAssetRefs, n as imageHeader, o as gltfDependencies, r as optimizeSuggestions } from "./optimizeSizing-B-BBiUkD.mjs";
12
+ import { a as collectAssetRefs, n as imageHeader, o as gltfDependencies, r as optimizeSuggestions } from "./optimizeSizing-Dd8vaSnE.mjs";
13
+ import { t as photoDepthIssues } from "./photoPlacement-D-k3mD0T.mjs";
13
14
  // src/ops/budget.ts
14
15
  function evalCost(formula, vars) {
15
16
  const src = formula.replace(/~/g, "");
@@ -855,6 +856,16 @@ async function photoIssues(fs, scene) {
855
856
  hint: `Regenerate it from this image: \`agent3d assets depth ${String(o.src)}\` (or crop both the same way).`
856
857
  });
857
858
  }
859
+ for (const k of ["plate", "plateDepth"]) {
860
+ const f = await header(o[k]).catch(() => null);
861
+ if (src?.h && f?.h && src.h.height > 0 && f.h.height > 0 && Math.abs(src.h.width / src.h.height - f.h.width / f.h.height) / (src.h.width / src.h.height) > .02) out.push({
862
+ severity: "warning",
863
+ code: "photo-plate-aspect",
864
+ path: `${at}.${k}`,
865
+ message: `${k === "plate" ? "Plate" : "Plate depth"} "${String(o[k])}" is ${f.h.width}x${f.h.height} but the photo is ${src.h.width}x${src.h.height}: the plate will not line up with the picture.`,
866
+ hint: `Rebuild it from this image: \`agent3d assets plate ${String(o.src)}\`.`
867
+ });
868
+ }
858
869
  if (depth?.h && depth.h.mimeType === "image/jpeg") out.push({
859
870
  severity: "info",
860
871
  code: "photo-depth-lossy",
@@ -863,6 +874,7 @@ async function photoIssues(fs, scene) {
863
874
  hint: `Use a PNG depth map (\`agent3d assets depth ${String(o.src)}\` writes one).`
864
875
  });
865
876
  }
877
+ out.push(...photoDepthIssues(scene));
866
878
  return out;
867
879
  }
868
880
  function textureFiles(scene) {
@@ -4,10 +4,10 @@ import { dirname as __a3dDirname, dirname, join, resolve } from "node:path";
4
4
  __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
- import { i as ensureDepthModel, t as DEPTH_MODEL } from "./depth-BZT4gseQ.mjs";
8
- import { H as CliError, L as ORT_FILES, r as startLocalServer, t as mimeOf, z as ortDir } from "../agent3d.mjs";
9
- import { launchBrowser, requireBrowser } from "./browser-Dil7VM5m.mjs";
10
- import { t as CdpClient } from "./cdp-DLEis_Z3.mjs";
7
+ import { i as ensureDepthModel, t as DEPTH_MODEL } from "./depth-DEaogEAi.mjs";
8
+ import { G as ortDir, J as CliError, U as ORT_FILES, r as startLocalServer, t as mimeOf } from "../agent3d.mjs";
9
+ import { launchBrowser, requireBrowser } from "./browser-nFaRUETt.mjs";
10
+ import { t as CdpClient } from "./cdp-6vF_gP-H.mjs";
11
11
  import { createReadStream, existsSync, mkdirSync, renameSync, statSync, writeFileSync } from "node:fs";
12
12
  import { homedir } from "node:os";
13
13
  // agent/render/depth.ts
@@ -5,120 +5,10 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
- import { A as OpsError, I as normalizePath, S as libraryId, b as findLibraryAsset, x as isLibraryRef } from "../agent3d.mjs";
9
- import { c as readAssetManifest, m as crc32, t as addAsset } from "./assets-YBkgdfgy.mjs";
10
- import { n as imageHeader } from "./optimizeSizing-B-BBiUkD.mjs";
11
- // src/ops/pngEncode.ts
12
- async function deflateZlib(data, deflate) {
13
- if (deflate) return deflate(data);
14
- const CS = globalThis.CompressionStream;
15
- if (!CS) throw new Error("No deflate available: pass `deflate` (CompressionStream is missing).");
16
- const stream = new Blob([data]).stream().pipeThrough(new CS("deflate"));
17
- return new Uint8Array(await new Response(stream).arrayBuffer());
18
- }
19
- async function encodePng(rgba, width, height, opts = {}) {
20
- if (rgba.length !== width * height * 4) throw new Error(`encodePng: expected ${width * height * 4} bytes, got ${rgba.length}`);
21
- let channels = opts.channels ?? "auto";
22
- if (channels === "auto") {
23
- let grey = true;
24
- let opaque = true;
25
- for (let i = 0; i < rgba.length && (grey || opaque); i += 4) {
26
- if (rgba[i] !== rgba[i + 1] || rgba[i] !== rgba[i + 2]) grey = false;
27
- if (rgba[i + 3] !== 255) opaque = false;
28
- }
29
- channels = grey ? opaque ? 1 : 2 : opaque ? 3 : 4;
30
- }
31
- const colorType = {
32
- 1: 0,
33
- 2: 4,
34
- 3: 2,
35
- 4: 6
36
- }[channels];
37
- const stride = width * channels;
38
- const raw = new Uint8Array((stride + 1) * height);
39
- const row = new Uint8Array(stride);
40
- const prev = new Uint8Array(stride);
41
- const cand = new Uint8Array(stride);
42
- for (let y = 0; y < height; y++) {
43
- for (let x = 0; x < width; x++) {
44
- const s = (y * width + x) * 4;
45
- const d = x * channels;
46
- if (channels === 1) row[d] = rgba[s];
47
- else if (channels === 2) row[d] = rgba[s], row[d + 1] = rgba[s + 3];
48
- else for (let c = 0; c < channels; c++) row[d + c] = rgba[s + c];
49
- }
50
- let best = 0;
51
- let bestScore = Infinity;
52
- const out = raw.subarray(y * (stride + 1) + 1, (y + 1) * (stride + 1));
53
- for (let f = 0; f < 5; f++) {
54
- let score = 0;
55
- for (let i = 0; i < stride; i++) {
56
- const a = i >= channels ? row[i - channels] : 0;
57
- const b = prev[i];
58
- const c = i >= channels ? prev[i - channels] : 0;
59
- let p;
60
- if (f === 0) p = 0;
61
- else if (f === 1) p = a;
62
- else if (f === 2) p = b;
63
- else if (f === 3) p = a + b >> 1;
64
- else {
65
- const pa = Math.abs(b - c);
66
- const pb = Math.abs(a - c);
67
- const pc = Math.abs(a + b - 2 * c);
68
- p = pa <= pb && pa <= pc ? a : pb <= pc ? b : c;
69
- }
70
- const v = row[i] - p & 255;
71
- cand[i] = v;
72
- score += v < 128 ? v : 256 - v;
73
- if (score >= bestScore) break;
74
- }
75
- if (score < bestScore) {
76
- bestScore = score;
77
- best = f;
78
- out.set(cand);
79
- }
80
- }
81
- raw[y * (stride + 1)] = best;
82
- prev.set(row);
83
- }
84
- const idat = await deflateZlib(raw, opts.deflate);
85
- const ihdr = /* @__PURE__ */ new Uint8Array(13);
86
- const dv = new DataView(ihdr.buffer);
87
- dv.setUint32(0, width);
88
- dv.setUint32(4, height);
89
- ihdr[8] = 8;
90
- ihdr[9] = colorType;
91
- const chunks = [
92
- chunk("IHDR", ihdr),
93
- chunk("IDAT", idat),
94
- chunk("IEND", /* @__PURE__ */ new Uint8Array(0))
95
- ];
96
- const sig = [
97
- 137,
98
- 80,
99
- 78,
100
- 71,
101
- 13,
102
- 10,
103
- 26,
104
- 10
105
- ];
106
- const total = 8 + chunks.reduce((n, c) => n + c.length, 0);
107
- const png = new Uint8Array(total);
108
- png.set(sig, 0);
109
- let o = 8;
110
- for (const c of chunks) png.set(c, o), o += c.length;
111
- return png;
112
- }
113
- function chunk(type, data) {
114
- const out = new Uint8Array(12 + data.length);
115
- const dv = new DataView(out.buffer);
116
- dv.setUint32(0, data.length);
117
- for (let i = 0; i < 4; i++) out[4 + i] = type.charCodeAt(i);
118
- out.set(data, 8);
119
- dv.setUint32(8 + data.length, crc32(out.subarray(4, 8 + data.length)));
120
- return out;
121
- }
8
+ import { D as isLibraryRef, E as findLibraryAsset, H as normalizePath, I as OpsError, O as libraryId } from "../agent3d.mjs";
9
+ import { c as readAssetManifest, t as addAsset } from "./assets-DdzHgVcn.mjs";
10
+ import { n as imageHeader } from "./optimizeSizing-Dd8vaSnE.mjs";
11
+ import { t as encodePng } from "./pngEncode-BMc3U9QC.mjs";
122
12
  // src/ops/depth.ts
123
13
  var depth_exports = /* @__PURE__ */ __exportAll({
124
14
  checkDepthRequest: () => checkDepthRequest,
@@ -5,11 +5,11 @@ __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
- import { A as OpsError, E as parseAspect, N as readJsonOr, O as slugify, P as validationError, S as libraryId, _ as validateScene, b as findLibraryAsset, d as readSceneFile, j as hasErrors, k as KB, m as DEFAULT_BUDGET_KB, s as MANIFEST_FILE, x as isLibraryRef } from "../agent3d.mjs";
8
+ import { B as validationError, C as validateScene, D as isLibraryRef, E as findLibraryAsset, F as KB, I as OpsError, L as hasErrors, M as parseAspect, O as libraryId, P as slugify, _ as readSceneFile, b as DEFAULT_BUDGET_KB, p as MANIFEST_FILE, z as readJsonOr } from "../agent3d.mjs";
9
9
  import { n as clone } from "./jsonPath-DUCe1JpS.mjs";
10
- import { t as attributionText } from "./check-DP9fRYbK.mjs";
11
- import { c as mimeFromPath, l as visitAssetRefs, o as gltfDependencies } from "./optimizeSizing-B-BBiUkD.mjs";
12
- import { c as readAssetManifest, m as crc32 } from "./assets-YBkgdfgy.mjs";
10
+ import { t as attributionText } from "./check-E7GdPxTt.mjs";
11
+ import { c as mimeFromPath, l as visitAssetRefs, o as gltfDependencies } from "./optimizeSizing-Dd8vaSnE.mjs";
12
+ import { c as readAssetManifest, m as crc32 } from "./assets-DdzHgVcn.mjs";
13
13
  // src/core/data.ts
14
14
  var DATA_PLACEHOLDER = /\{data\.([a-zA-Z_$][\w$-]*(?:\.[a-zA-Z_$][\w$-]*)*)(?:\|([^}]*))?\}/g;
15
15
  function lookup(data, path) {
@@ -47,6 +47,73 @@ function base64Encode(bytes) {
47
47
  function dataUri(bytes, mime) {
48
48
  return `data:${mime};base64,${base64Encode(bytes)}`;
49
49
  }
50
+ // src/ops/liteRuntime.ts
51
+ var LITE_RUNTIME_FILE = "agent3d-photo.js";
52
+ var HEX = /^#(?:[0-9a-f]{3}|[0-9a-f]{6})$/i;
53
+ var nonEmpty = (v) => Array.isArray(v) ? v.length > 0 : v !== void 0 && v !== null && v !== false;
54
+ function liteRuntimeEligibility(scene) {
55
+ const reasons = [];
56
+ const no = (cond, why) => {
57
+ if (cond) reasons.push(why);
58
+ };
59
+ const s = scene ?? {};
60
+ no((s.target ?? {}).kind === "game", "target.kind is game");
61
+ no(nonEmpty(s.timeline), "timeline");
62
+ no(nonEmpty(s.interactions), "interactions");
63
+ no(nonEmpty(s.postfx), "post effects (postfx)");
64
+ no(nonEmpty(s.physics), "physics");
65
+ no(nonEmpty(s.scripts), "scripts");
66
+ no(s.ui?.elements?.length, "ui (HUD)");
67
+ no(nonEmpty(s.audio), "audio");
68
+ no(/\{data\./.test(JSON.stringify(scene ?? {})), "data bindings ({data.*} placeholders)");
69
+ const cam = s.camera;
70
+ if (!cam || cam.type !== "perspective") reasons.push("camera is not perspective");
71
+ else {
72
+ no(cam.controls && cam.controls !== "none", `camera.controls "${cam.controls}"`);
73
+ no(cam.autoRotate, "camera.autoRotate");
74
+ no(nonEmpty(cam.shots), "camera.shots");
75
+ no(cam.shake, "camera.shake");
76
+ no(cam.lookAt, "camera.lookAt");
77
+ no(cam.follow, "camera.follow");
78
+ }
79
+ const env = s.environment;
80
+ const bg = env?.background;
81
+ no(bg !== void 0 && (typeof bg !== "string" || bg !== "transparent" && !HEX.test(bg)), "environment.background is not a #hex colour or transparent");
82
+ no(env?.ground, "environment.ground");
83
+ no(env?.contactShadows, "environment.contactShadows");
84
+ no(env?.rig, "environment.rig (light rig)");
85
+ for (const l of s.lights ?? []) {
86
+ no(l.type === "rect", "rect lights (visible panels)");
87
+ no(l.type === "spot" && l.volumetric, "volumetric spot lights");
88
+ }
89
+ const objects = s.objects ?? [];
90
+ if (objects.length !== 1) reasons.push(`${objects.length} objects (the lite runtime shows exactly one photo)`);
91
+ const o = objects[0];
92
+ if (o && o.kind !== "photo") reasons.push(`object "${o.id}" is a ${o.kind}, not a photo`);
93
+ else if (o) {
94
+ const p = o;
95
+ no(!!p.depth && p.mode && p.mode !== "parallax", `photo mode "${p.mode}" (lite: parallax or a flat photo)`);
96
+ no(nonEmpty(p.children), "photo has children");
97
+ no(p.visible === false, "photo is hidden");
98
+ no(nonEmpty(p.behaviours), "photo behaviours");
99
+ no(p.body, "photo physics body");
100
+ no(p.href, "photo link (href)");
101
+ no(p.attach, "photo attached to the camera");
102
+ no(Array.isArray(p.rotation) && p.rotation.some((r) => r !== 0), "photo is rotated");
103
+ const sc = p.scale;
104
+ no(sc !== void 0 && (typeof sc === "number" ? !(sc > 0) : !Array.isArray(sc) || !(sc[0] > 0 && sc[1] > 0)), "photo scale is not positive");
105
+ no(p.material?.color !== void 0 && !(typeof p.material.color === "string" && HEX.test(p.material.color)), "photo material.color is not a #hex colour");
106
+ no(typeof p.src !== "string" || !p.src, "photo has no src");
107
+ for (const [id, fx] of Object.entries(p.effects ?? {})) {
108
+ const c = fx?.color;
109
+ no(c !== void 0 && !(typeof c === "string" && HEX.test(c)), `photo effects.${id}.color is not a #hex colour`);
110
+ }
111
+ }
112
+ return reasons.length ? {
113
+ ok: false,
114
+ reasons
115
+ } : { ok: true };
116
+ }
50
117
  // src/ops/runtimeChunks.ts
51
118
  var hasKind = (scene, kinds) => {
52
119
  const walk = (objs) => !!objs?.some((o) => kinds.includes(o.kind) || walk(o.children));
@@ -223,7 +290,7 @@ function pageRuntime(files, entry, scene) {
223
290
  }
224
291
  }
225
292
  }
226
- const js = Object.keys(files).filter((f) => f.endsWith(".js") && !f.endsWith(".single.js"));
293
+ const js = Object.keys(files).filter((f) => f.endsWith(".js") && !f.endsWith(".single.js") && f !== "agent3d-photo.js");
227
294
  return {
228
295
  loaded: [...loaded],
229
296
  skipped: js.filter((f) => !loaded.has(f)),
@@ -756,7 +823,13 @@ async function buildExport(fs, opts) {
756
823
  if (hasErrors(issues)) throw validationError("Cannot export an invalid scene:", issues, "Run check / scene_validate and fix the errors first.");
757
824
  const projectManifest = await readJsonOr(fs, MANIFEST_FILE, null);
758
825
  const name = slugify(opts.name ?? projectManifest?.name ?? source.id ?? "scene", "scene");
759
- const runtimeEntry = pickRuntime(opts.runtime, format === "single-html" ? "single-html" : "embed");
826
+ const choice = opts.runtimeChoice ?? "auto";
827
+ if (choice !== "auto" && choice !== "full") throw new OpsError("invalid", `Unknown runtime "${String(choice)}".`, "Use \"auto\" (the photo-only lite runtime when the scene is a single 3D photo) or \"full\".");
828
+ const eligibility = liteRuntimeEligibility(source);
829
+ const hasLite = !!opts.runtime?.files?.[LITE_RUNTIME_FILE];
830
+ const runtimeReasons = choice === "full" ? ["runtime: full was requested"] : !eligibility.ok ? eligibility.reasons : !hasLite ? [`the runtime files have no ${LITE_RUNTIME_FILE} (rebuild the runtime: npm run build:runtime)`] : void 0;
831
+ const lite = !runtimeReasons;
832
+ const runtimeEntry = lite ? LITE_RUNTIME_FILE : pickRuntime(opts.runtime, format === "single-html" ? "single-html" : "embed");
760
833
  const manifest = await readAssetManifest(fs);
761
834
  const entries = new Map(manifest.assets.map((a) => [a.path, a]));
762
835
  const scene = clone(source);
@@ -849,7 +922,12 @@ async function buildExport(fs, opts) {
849
922
  let head;
850
923
  if (format === "embed" || format === "zip") {
851
924
  const allRuntime = Object.entries(opts.runtime.files).filter(([k]) => !k.endsWith(".single.js"));
852
- pageRt = pageRuntime(Object.fromEntries(allRuntime), runtimeEntry, scene);
925
+ pageRt = lite ? {
926
+ loaded: [LITE_RUNTIME_FILE],
927
+ skipped: [],
928
+ unknown: [],
929
+ features: {}
930
+ } : pageRuntime(Object.fromEntries(allRuntime.filter(([k]) => k !== LITE_RUNTIME_FILE)), runtimeEntry, scene);
853
931
  pruned = !!opts.pruneRuntime && !pageRt.unknown.length;
854
932
  if (opts.pruneRuntime && pageRt.unknown.length) outIssues.push({
855
933
  severity: "info",
@@ -1032,6 +1110,8 @@ async function buildExport(fs, opts) {
1032
1110
  },
1033
1111
  credits,
1034
1112
  issues: outIssues,
1113
+ runtime: lite ? "photo-lite" : "full",
1114
+ ...runtimeReasons ? { runtimeReasons } : {},
1035
1115
  ...runtimeDirName ? { runtimeDir: runtimeDirName } : {},
1036
1116
  ...integrity ? { integrity } : {},
1037
1117
  ...head ? { head } : {}
@@ -4,9 +4,9 @@ import { dirname as __a3dDirname } from "node:path";
4
4
  __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
- import { H as CliError } from "../agent3d.mjs";
8
- import { launchBrowser, requireBrowser } from "./browser-Dil7VM5m.mjs";
9
- import { t as CdpClient } from "./cdp-DLEis_Z3.mjs";
7
+ import { J as CliError } from "../agent3d.mjs";
8
+ import { launchBrowser, requireBrowser } from "./browser-nFaRUETt.mjs";
9
+ import { t as CdpClient } from "./cdp-6vF_gP-H.mjs";
10
10
  // agent/render/imageCodec.ts
11
11
  var PAGE_FN = `async function (b64, mime, maxSize, quality, format, allowJpeg) {
12
12
  const bin = atob(b64);
@@ -36,6 +36,23 @@ var PAGE_FN = `async function (b64, mime, maxSize, quality, format, allowJpeg) {
36
36
  for (let i = 0; i < buf.length; i += 0x8000) out += String.fromCharCode.apply(null, buf.subarray(i, i + 0x8000));
37
37
  return { b64: btoa(out), mimeType: blob.type, width: w, height: h, srcWidth: bmp.width, srcHeight: bmp.height, hasAlpha };
38
38
  }`;
39
+ var DECODE_FN = `async function (b64, mime, maxSize) {
40
+ const bin = atob(b64);
41
+ const bytes = new Uint8Array(bin.length);
42
+ for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
43
+ const bmp = await createImageBitmap(new Blob([bytes], { type: mime }), { colorSpaceConversion: "none", premultiplyAlpha: "none" });
44
+ const s = Math.min(1, maxSize / Math.max(bmp.width, bmp.height));
45
+ const w = Math.max(1, Math.round(bmp.width * s)), h = Math.max(1, Math.round(bmp.height * s));
46
+ const canvas = new OffscreenCanvas(w, h);
47
+ const g = canvas.getContext("2d", { willReadFrequently: true });
48
+ g.imageSmoothingEnabled = true;
49
+ g.imageSmoothingQuality = "high";
50
+ g.drawImage(bmp, 0, 0, w, h);
51
+ const buf = new Uint8Array(g.getImageData(0, 0, w, h).data.buffer);
52
+ let out = "";
53
+ for (let i = 0; i < buf.length; i += 0x8000) out += String.fromCharCode.apply(null, buf.subarray(i, i + 0x8000));
54
+ return { b64: btoa(out), width: w, height: h };
55
+ }`;
39
56
  async function openImageCodec(opts = {}) {
40
57
  const info = requireBrowser();
41
58
  let browser = null;
@@ -85,11 +102,43 @@ async function openImageCodec(opts = {}) {
85
102
  hasAlpha: v.hasAlpha
86
103
  };
87
104
  };
105
+ const decode = async (input) => {
106
+ const r = await page.send("Runtime.callFunctionOn", {
107
+ functionDeclaration: DECODE_FN,
108
+ objectId: windowId,
109
+ arguments: [
110
+ { value: Buffer.from(input.bytes).toString("base64") },
111
+ { value: input.mimeType },
112
+ { value: input.maxSize }
113
+ ],
114
+ awaitPromise: true,
115
+ returnByValue: true
116
+ }, 12e4);
117
+ if (r.exceptionDetails || !r.result.value) throw new CliError("image-decode", `Could not decode this ${input.mimeType} image: ${(r.exceptionDetails?.exception?.description ?? r.exceptionDetails?.text ?? "no result").split("\n")[0]}`, "The file may be corrupt or in an unsupported format (use .jpg, .png or .webp).");
118
+ const v = r.result.value;
119
+ return {
120
+ data: new Uint8Array(Buffer.from(v.b64, "base64")),
121
+ width: v.width,
122
+ height: v.height
123
+ };
124
+ };
88
125
  return {
89
126
  codec,
127
+ decode,
90
128
  close
91
129
  };
92
130
  }
131
+ async function withPixelCodec(fn, opts = {}) {
132
+ const c = await openImageCodec(opts);
133
+ try {
134
+ return await fn({
135
+ decode: c.decode,
136
+ codec: c.codec
137
+ });
138
+ } finally {
139
+ await c.close();
140
+ }
141
+ }
93
142
  async function withImageCodec(fn, opts = {}) {
94
143
  const c = await openImageCodec(opts);
95
144
  try {
@@ -98,4 +147,4 @@ async function withImageCodec(fn, opts = {}) {
98
147
  await c.close();
99
148
  }
100
149
  }
101
- export { openImageCodec, withImageCodec };
150
+ export { openImageCodec, withImageCodec, withPixelCodec };
@@ -6,8 +6,8 @@ const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
7
  import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
8
  import { t as closest } from "./suggest-Cpcgv1RP.mjs";
9
- import { A as OpsError, d as readSceneFile } from "../agent3d.mjs";
10
- import { i as patchScene } from "./scene-DWgXH6As.mjs";
9
+ import { I as OpsError, _ as readSceneFile } from "../agent3d.mjs";
10
+ import { i as patchScene } from "./scene-DSjsun-3.mjs";
11
11
  import { n as findObject, r as flattenObjects, t as allObjectIds } from "./tree-CqSj-o8T.mjs";
12
12
  // src/ops/objects.ts
13
13
  var objects_exports = /* @__PURE__ */ __exportAll({
@@ -4,7 +4,7 @@ import { dirname as __a3dDirname } from "node:path";
4
4
  __a3dRequire(import.meta.url);
5
5
  const __filename = __a3dPath(import.meta.url);
6
6
  __a3dDirname(__filename);
7
- import { C as CATALOG, S as libraryId, b as findLibraryAsset, h as MATERIAL_TEXTURE_SLOTS, p as DEFAULT_ASPECT, x as isLibraryRef } from "../agent3d.mjs";
7
+ import { D as isLibraryRef, E as findLibraryAsset, O as libraryId, k as CATALOG, x as MATERIAL_TEXTURE_SLOTS, y as DEFAULT_ASPECT } from "../agent3d.mjs";
8
8
  import { o as walkObjects } from "./tree-CqSj-o8T.mjs";
9
9
  import { r as modelFileBounds, t as glbJson } from "./gltf-f_f0-OiV.mjs";
10
10
  // src/ops/refs.ts
@@ -49,6 +49,11 @@ function visitAssetRefs(scene, visit) {
49
49
  const r = visit(o.depth, `${at}.depth`, "texture");
50
50
  if (typeof r === "string") o.depth = r;
51
51
  }
52
+ for (const k of ["plate", "plateDepth"]) {
53
+ if (typeof o[k] !== "string") continue;
54
+ const r = visit(o[k], `${at}.${k}`, "texture");
55
+ if (typeof r === "string") o[k] = r;
56
+ }
52
57
  }
53
58
  if (o.kind === "text") {
54
59
  const font = typeof o.font === "string" && o.font ? o.font : "sans-bold";
@@ -444,6 +449,24 @@ async function planTextureSizes(fs, scene, ctx = {}) {
444
449
  why: `depth map of photo "${o.id}" (smooth data, kept lossless) ≈ ${round(pixels)} px`
445
450
  }, TEXTURE_TIERS, DEPTH_MIN_TIER, Math.min(DEPTH_MAX_TIER, max));
446
451
  }
452
+ if (typeof o.plate === "string" && (ctx.includeLibrary || !isLibraryRef(o.plate))) {
453
+ const pixels = projected * MARGIN * PHOTO_ZOOM_MARGIN;
454
+ addUse(files, o.plate, {
455
+ at: `objects#${o.id}.plate`,
456
+ role: "color",
457
+ pixels: round(pixels),
458
+ why: `background plate of photo "${o.id}", sized like the photo ≈ ${round(projected)} px`
459
+ }, TEXTURE_TIERS, Math.min(PHOTO_MIN_TIER, max), max);
460
+ }
461
+ if (typeof o.plateDepth === "string" && (ctx.includeLibrary || !isLibraryRef(o.plateDepth))) {
462
+ const pixels = projected * ROLE_FACTOR.depth * MARGIN;
463
+ addUse(files, o.plateDepth, {
464
+ at: `objects#${o.id}.plateDepth`,
465
+ role: "depth",
466
+ pixels: round(pixels),
467
+ why: `plate depth of photo "${o.id}" (smooth data, kept lossless) ≈ ${round(pixels)} px`
468
+ }, TEXTURE_TIERS, DEPTH_MIN_TIER, Math.min(DEPTH_MAX_TIER, max));
469
+ }
447
470
  }
448
471
  const mat = o.material;
449
472
  if (mat && typeof mat === "object") {
@@ -8,7 +8,7 @@ import { t as __exportAll } from "./rolldown-runtime-ebOQtxsr.mjs";
8
8
  // package.json
9
9
  var package_exports = /* @__PURE__ */ __exportAll({ default: () => package_default });
10
10
  var name = "@fleox/agent3d";
11
- var version = "0.3.1";
11
+ var version = "0.5.0";
12
12
  var package_default = {
13
13
  name,
14
14
  version,
@@ -33,7 +33,7 @@ var package_default = {
33
33
  "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.agent.json",
34
34
  "test": "vitest run",
35
35
  "test:watch": "vitest",
36
- "build:runtime": "vite build --config vite.runtime.config.ts && vite build --config vite.runtime.config.ts --mode single",
36
+ "build:runtime": "vite build --config vite.runtime.config.ts && vite build --config vite.runtime.config.ts --mode single && vite build --config vite.runtime.config.ts --mode photo",
37
37
  "build:studio": "vite build",
38
38
  "build:agent": "vite build --config vite.agent.config.ts",
39
39
  "build": "npm run build:runtime && npm run build:studio && npm run build:agent && node scripts/write-version.mjs",
@@ -0,0 +1,138 @@
1
+ import { createRequire as __a3dRequire } from "node:module";
2
+ import { fileURLToPath as __a3dPath } from "node:url";
3
+ import { dirname as __a3dDirname } from "node:path";
4
+ __a3dRequire(import.meta.url);
5
+ const __filename = __a3dPath(import.meta.url);
6
+ __a3dDirname(__filename);
7
+ // src/core/photoDepth.ts
8
+ var clamp01 = (v, d) => typeof v === "number" && Number.isFinite(v) ? Math.min(1, Math.max(0, v)) : d;
9
+ function photoDepthRange(strength, width) {
10
+ return Math.min(1, Math.max(0, strength)) * width * .25;
11
+ }
12
+ function resolved(p) {
13
+ const strength = clamp01(p.strength, .5);
14
+ const width = typeof p.width === "number" && p.width > 0 ? p.width : 4;
15
+ const focus = clamp01(p.focus, .5);
16
+ const D = p.mode !== "mesh" && typeof p.cameraDistance === "number" && p.cameraDistance > 0 && Number.isFinite(p.cameraDistance) ? p.cameraDistance : Infinity;
17
+ return {
18
+ range: photoDepthRange(strength, width),
19
+ focus,
20
+ D
21
+ };
22
+ }
23
+ function photoDepthToZ(d, p) {
24
+ const { range, focus, D } = resolved(p);
25
+ const lin = (d - focus) * range;
26
+ if (!Number.isFinite(D)) return lin;
27
+ const u = lin / D;
28
+ return D * u / (1 + u);
29
+ }
30
+ // src/ops/photoPlacement.ts
31
+ var r2 = (v) => Math.round(v * 100) / 100;
32
+ function placedObjects(objects, base = [
33
+ 0,
34
+ 0,
35
+ 0
36
+ ], out = []) {
37
+ for (const o of objects ?? []) {
38
+ if (!o || typeof o !== "object") continue;
39
+ const p = Array.isArray(o.position) ? o.position : [
40
+ 0,
41
+ 0,
42
+ 0
43
+ ];
44
+ const world = [
45
+ base[0] + (Number(p[0]) || 0),
46
+ base[1] + (Number(p[1]) || 0),
47
+ base[2] + (Number(p[2]) || 0)
48
+ ];
49
+ out.push({
50
+ def: o,
51
+ world
52
+ });
53
+ if (Array.isArray(o.children)) placedObjects(o.children, world, out);
54
+ }
55
+ return out;
56
+ }
57
+ function scaleZ(o) {
58
+ const s = o.scale;
59
+ if (typeof s === "number" && s > 0) return s;
60
+ if (Array.isArray(s) && typeof s[2] === "number" && s[2] > 0) return s[2];
61
+ return 1;
62
+ }
63
+ function photoPlacement(scene, photo, world) {
64
+ if (!photo.depth) return null;
65
+ const sz = scaleZ(photo);
66
+ const cam = scene.camera;
67
+ let distance;
68
+ if (cam?.type !== "orthographic" && Array.isArray(cam?.position)) {
69
+ const t = Array.isArray(cam.target) ? cam.target : [
70
+ 0,
71
+ 0,
72
+ 0
73
+ ];
74
+ const f = [
75
+ t[0] - cam.position[0],
76
+ t[1] - cam.position[1],
77
+ t[2] - cam.position[2]
78
+ ];
79
+ const len = Math.hypot(f[0], f[1], f[2]) || 1;
80
+ const d = ((world[0] - cam.position[0]) * f[0] + (world[1] - cam.position[1]) * f[1] + (world[2] - cam.position[2]) * f[2]) / len;
81
+ if (d > 0) distance = d / sz;
82
+ }
83
+ const params = {
84
+ mode: photo.mode ?? "parallax",
85
+ strength: photo.strength,
86
+ width: photo.width,
87
+ focus: photo.focus,
88
+ cameraDistance: distance
89
+ };
90
+ return {
91
+ id: photo.id,
92
+ occlude: photo.occlude === true,
93
+ zFar: r2(world[2] + photoDepthToZ(0, params) * sz),
94
+ zFocus: r2(world[2]),
95
+ zNear: r2(world[2] + photoDepthToZ(1, params) * sz),
96
+ position: world
97
+ };
98
+ }
99
+ function photoDepthIssues(scene) {
100
+ const out = [];
101
+ const content = placedObjects(scene.objects).filter(({ def }) => def.kind !== "photo" && def.kind !== "group" && def.visible !== false && !def.attach);
102
+ for (const pl of photoPlacements(scene)) {
103
+ const at = `objects#${pl.id}.occlude`;
104
+ const range = `world z ${pl.zFar} (depth 0, far) … ${pl.zFocus} (focus, still) … ${pl.zNear} (depth 1, near)`;
105
+ const inside = content.filter(({ world }) => world[2] > pl.zFar && world[2] < pl.zNear).map(({ def }) => def.id);
106
+ if (!pl.occlude && inside.length) out.push({
107
+ severity: "info",
108
+ code: "photo-occlude",
109
+ path: at,
110
+ message: `${inside.slice(0, 4).map((id) => `"${id}"`).join(", ")}${inside.length > 4 ? "…" : ""} sit${inside.length === 1 ? "s" : ""} within the depth of photo "${pl.id}" (${range}) but always draw${inside.length === 1 ? "s" : ""} over it.`,
111
+ hint: `To put them inside the photo (hidden by its nearer parts, moving with its planes), set ${at}: true. Keep it off for a title meant to float over the picture.`
112
+ });
113
+ else if (pl.occlude) out.push(content.length ? {
114
+ severity: "info",
115
+ code: "photo-depth-range",
116
+ path: at,
117
+ message: `Photo "${pl.id}" occludes: its pixels span ${range}.`,
118
+ hint: "An object at world z is hidden where the photo is nearer: put a title between the far and the near z (e.g. just behind the nearest building's depth); objects in front of the near z are never hidden."
119
+ } : {
120
+ severity: "info",
121
+ code: "ignored",
122
+ path: at,
123
+ message: `occlude does nothing on photo "${pl.id}": the scene has no other objects to hide.`,
124
+ hint: "Add 3D objects between its depth planes, or remove occlude."
125
+ });
126
+ }
127
+ return out;
128
+ }
129
+ function photoPlacements(scene) {
130
+ const out = [];
131
+ for (const { def, world } of placedObjects(scene.objects)) {
132
+ if (def.kind !== "photo") continue;
133
+ const p = photoPlacement(scene, def, world);
134
+ if (p) out.push(p);
135
+ }
136
+ return out;
137
+ }
138
+ export { photoPlacement as n, photoDepthIssues as t };