@null3d/engine 0.0.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (517) hide show
  1. package/README.md +109 -0
  2. package/THIRD-PARTY-NOTICES.txt +0 -1
  3. package/dist/wasm/single/null3d.js +25 -10
  4. package/dist/wasm/single/null3d_bg.wasm +0 -0
  5. package/dist/wasm/threaded/null3d.js +25 -10
  6. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  7. package/docs/api/animation.md +114 -86
  8. package/docs/api/assets.md +135 -49
  9. package/docs/api/cameras.md +45 -12
  10. package/docs/api/controls.md +88 -62
  11. package/docs/api/debug.md +116 -41
  12. package/docs/api/engine.md +117 -35
  13. package/docs/api/feature-draws.md +23 -17
  14. package/docs/api/feature-effects.md +11 -11
  15. package/docs/api/feature-instances.md +70 -19
  16. package/docs/api/features.md +77 -47
  17. package/docs/api/geometry.md +132 -82
  18. package/docs/api/grass.md +55 -13
  19. package/docs/api/impostors.md +175 -22
  20. package/docs/api/input.md +24 -18
  21. package/docs/api/lights.md +78 -51
  22. package/docs/api/lines.md +41 -33
  23. package/docs/api/materials.md +248 -121
  24. package/docs/api/math.md +12 -13
  25. package/docs/api/objects.md +47 -22
  26. package/docs/api/page.md +58 -7
  27. package/docs/api/particles.md +33 -20
  28. package/docs/api/points.md +19 -31
  29. package/docs/api/post.md +75 -42
  30. package/docs/api/quality.md +42 -17
  31. package/docs/api/raycast.md +65 -51
  32. package/docs/api/reference/animation.md +10 -11
  33. package/docs/api/reference/assets.md +25 -22
  34. package/docs/api/reference/cameras.md +8 -4
  35. package/docs/api/reference/controls.md +134 -25
  36. package/docs/api/reference/debug.md +81 -14
  37. package/docs/api/reference/engine.md +58 -17
  38. package/docs/api/reference/feature-draws.md +3 -4
  39. package/docs/api/reference/feature-effects.md +2 -3
  40. package/docs/api/reference/feature-instances.md +5 -4
  41. package/docs/api/reference/features.md +7 -4
  42. package/docs/api/reference/geometry.md +287 -97
  43. package/docs/api/reference/grass.md +63 -3
  44. package/docs/api/reference/impostors.md +208 -13
  45. package/docs/api/reference/input.md +4 -5
  46. package/docs/api/reference/lights.md +13 -12
  47. package/docs/api/reference/lines.md +10 -11
  48. package/docs/api/reference/materials.md +54 -53
  49. package/docs/api/reference/math.md +35 -24
  50. package/docs/api/reference/objects.md +11 -12
  51. package/docs/api/reference/particles.md +31 -6
  52. package/docs/api/reference/points.md +6 -7
  53. package/docs/api/reference/post.md +21 -20
  54. package/docs/api/reference/quality.md +8 -5
  55. package/docs/api/reference/raycast.md +7 -8
  56. package/docs/api/reference/render.md +5 -4
  57. package/docs/api/reference/scene.md +52 -30
  58. package/docs/api/reference/sketch.md +15 -11
  59. package/docs/api/reference/sound.md +234 -0
  60. package/docs/api/reference/splats.md +42 -3
  61. package/docs/api/reference/sprites.md +7 -8
  62. package/docs/api/reference/tasks.md +16 -3
  63. package/docs/api/reference/terrain.md +27 -5
  64. package/docs/api/reference/textures.md +5 -6
  65. package/docs/api/reference/three-compat.md +18 -7
  66. package/docs/api/reference/time.md +1 -2
  67. package/docs/api/reference/ui.md +12 -9
  68. package/docs/api/reference/vertex-draws.md +5 -6
  69. package/docs/api/reference/water.md +153 -9
  70. package/docs/api/reference/wind.md +17 -4
  71. package/docs/api/render.md +73 -29
  72. package/docs/api/scene.md +164 -60
  73. package/docs/api/sketch.md +102 -15
  74. package/docs/api/sound.md +205 -0
  75. package/docs/api/splats.md +46 -12
  76. package/docs/api/sprites.md +10 -24
  77. package/docs/api/tasks.md +33 -24
  78. package/docs/api/terrain.md +42 -22
  79. package/docs/api/textures.md +68 -19
  80. package/docs/api/three-compat.md +15 -7
  81. package/docs/api/time.md +3 -5
  82. package/docs/api/ui.md +19 -23
  83. package/docs/api/vertex-draws.md +13 -12
  84. package/docs/api/water.md +262 -35
  85. package/docs/api/wind.md +63 -17
  86. package/docs/cli/null3d.md +177 -27
  87. package/docs/concepts/architecture.md +73 -27
  88. package/docs/concepts/assets.md +57 -33
  89. package/docs/concepts/backends.md +69 -27
  90. package/docs/concepts/color-management.md +54 -36
  91. package/docs/concepts/culling.md +68 -47
  92. package/docs/concepts/handles.md +14 -5
  93. package/docs/concepts/instances.md +74 -25
  94. package/docs/concepts/large-worlds.md +18 -8
  95. package/docs/concepts/lighting.md +155 -87
  96. package/docs/concepts/lod.md +126 -44
  97. package/docs/concepts/materials.md +58 -27
  98. package/docs/concepts/particle-buffer.md +48 -35
  99. package/docs/concepts/post-processing.md +84 -43
  100. package/docs/concepts/quality-preset-tables.md +56 -52
  101. package/docs/concepts/quality-presets.md +164 -52
  102. package/docs/concepts/render-graph.md +69 -29
  103. package/docs/concepts/render-layers.md +11 -21
  104. package/docs/concepts/shadows.md +105 -52
  105. package/docs/concepts/static-dynamic.md +22 -7
  106. package/docs/cookbook/index.md +164 -120
  107. package/docs/data/threejs-mapping.json +362 -367
  108. package/docs/errors/E1101.md +23 -5
  109. package/docs/errors/E1102.md +11 -3
  110. package/docs/errors/E1103.md +11 -3
  111. package/docs/errors/E1104.md +11 -3
  112. package/docs/errors/E1105.md +13 -5
  113. package/docs/errors/E1106.md +11 -3
  114. package/docs/errors/E1107.md +15 -5
  115. package/docs/errors/E1108.md +11 -3
  116. package/docs/errors/E1109.md +32 -6
  117. package/docs/errors/E1110.md +23 -5
  118. package/docs/errors/E1111.md +11 -3
  119. package/docs/errors/E1112.md +11 -3
  120. package/docs/errors/E1203.md +12 -4
  121. package/docs/errors/E1204.md +11 -3
  122. package/docs/errors/E1205.md +11 -3
  123. package/docs/errors/E1206.md +28 -6
  124. package/docs/errors/E1207.md +11 -3
  125. package/docs/errors/E1208.md +12 -3
  126. package/docs/errors/E1209.md +11 -3
  127. package/docs/errors/E1213.md +27 -5
  128. package/docs/errors/E1214.md +14 -6
  129. package/docs/errors/E1215.md +31 -6
  130. package/docs/errors/E1216.md +31 -6
  131. package/docs/errors/E1217.md +29 -6
  132. package/docs/errors/E1218.md +22 -6
  133. package/docs/errors/E1219.md +11 -3
  134. package/docs/errors/E1220.md +24 -5
  135. package/docs/errors/E1221.md +24 -5
  136. package/docs/errors/E1222.md +11 -3
  137. package/docs/errors/E1223.md +39 -6
  138. package/docs/errors/E1224.md +11 -3
  139. package/docs/errors/E1225.md +11 -3
  140. package/docs/errors/E1301.md +11 -3
  141. package/docs/errors/E1302.md +11 -3
  142. package/docs/errors/E1303.md +11 -3
  143. package/docs/errors/E1304.md +11 -3
  144. package/docs/errors/E1305.md +13 -3
  145. package/docs/errors/E1306.md +11 -3
  146. package/docs/errors/E1307.md +40 -0
  147. package/docs/errors/E1401.md +11 -3
  148. package/docs/errors/E1402.md +13 -5
  149. package/docs/errors/E1403.md +11 -3
  150. package/docs/errors/E1404.md +13 -3
  151. package/docs/errors/E1405.md +15 -4
  152. package/docs/errors/E1406.md +31 -5
  153. package/docs/errors/E1407.md +11 -3
  154. package/docs/errors/E1408.md +11 -3
  155. package/docs/errors/E1409.md +11 -3
  156. package/docs/errors/E1410.md +13 -5
  157. package/docs/errors/E1411.md +11 -3
  158. package/docs/errors/E1412.md +29 -6
  159. package/docs/errors/E1413.md +11 -3
  160. package/docs/errors/E1414.md +11 -3
  161. package/docs/errors/E1415.md +11 -3
  162. package/docs/errors/E1416.md +27 -6
  163. package/docs/errors/E1417.md +11 -3
  164. package/docs/errors/E1418.md +12 -3
  165. package/docs/errors/E1419.md +13 -5
  166. package/docs/errors/E1420.md +14 -6
  167. package/docs/errors/E1421.md +11 -3
  168. package/docs/errors/E1422.md +12 -3
  169. package/docs/errors/E1423.md +12 -3
  170. package/docs/errors/E1424.md +24 -5
  171. package/docs/errors/E1425.md +11 -3
  172. package/docs/errors/E1426.md +11 -3
  173. package/docs/errors/E1430.md +11 -3
  174. package/docs/errors/E1431.md +11 -3
  175. package/docs/errors/E1432.md +11 -3
  176. package/docs/errors/E1433.md +11 -3
  177. package/docs/errors/E1434.md +15 -6
  178. package/docs/errors/E1435.md +11 -3
  179. package/docs/errors/E1436.md +11 -3
  180. package/docs/errors/E1437.md +14 -6
  181. package/docs/errors/E1501.md +41 -6
  182. package/docs/errors/E1502.md +13 -3
  183. package/docs/errors/E1503.md +11 -3
  184. package/docs/errors/E1504.md +11 -3
  185. package/docs/errors/E1505.md +23 -5
  186. package/docs/errors/E1506.md +11 -3
  187. package/docs/errors/index.md +54 -30
  188. package/docs/getting-started/cdn.md +32 -10
  189. package/docs/getting-started/first-scene.md +21 -13
  190. package/docs/getting-started/hosting.md +152 -63
  191. package/docs/getting-started/install.md +44 -28
  192. package/docs/getting-started/network-use.md +33 -15
  193. package/docs/getting-started/project-structure.md +33 -12
  194. package/docs/getting-started/third-party-notices.md +12 -14
  195. package/docs/guides/accessibility.md +5 -5
  196. package/docs/guides/add-ons.md +86 -15
  197. package/docs/guides/agents.md +16 -9
  198. package/docs/guides/assets-pipeline.md +259 -82
  199. package/docs/guides/audio.md +115 -128
  200. package/docs/guides/baked-light-data.md +44 -23
  201. package/docs/guides/car-paint.md +38 -32
  202. package/docs/guides/content-pages.md +63 -35
  203. package/docs/guides/custom-passes.md +65 -22
  204. package/docs/guides/custom-shaders.md +59 -39
  205. package/docs/guides/debugging.md +74 -10
  206. package/docs/guides/deploying.md +85 -6
  207. package/docs/guides/deterministic-simulation.md +24 -17
  208. package/docs/guides/first-use-shaders.md +83 -45
  209. package/docs/guides/lens-kit.md +29 -26
  210. package/docs/guides/loading-screens.md +132 -47
  211. package/docs/guides/multiple-views.md +63 -13
  212. package/docs/guides/performance.md +192 -38
  213. package/docs/guides/phones.md +78 -15
  214. package/docs/guides/physics.md +7 -11
  215. package/docs/guides/screens.md +47 -33
  216. package/docs/guides/start-time.md +363 -0
  217. package/docs/guides/testing.md +152 -95
  218. package/docs/guides/ui-overlays.md +19 -14
  219. package/docs/guides/video-textures.md +14 -13
  220. package/docs/images/api/animation/character.webp +0 -0
  221. package/docs/images/api/animation/look-at-ring.webp +0 -0
  222. package/docs/images/api/animation/morph-tulips.webp +0 -0
  223. package/docs/images/api/animation/skeleton-lines.webp +0 -0
  224. package/docs/images/api/controls/gizmo-handles.webp +0 -0
  225. package/docs/images/api/controls/walk-and-fly.webp +0 -0
  226. package/docs/images/api/debug/debug-shapes.webp +0 -0
  227. package/docs/images/api/debug/levels-view.webp +0 -0
  228. package/docs/images/api/engine/transparent-canvas.webp +0 -0
  229. package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
  230. package/docs/images/api/feature-instances/compute-instances.webp +0 -0
  231. package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
  232. package/docs/images/api/geometry/extra-shapes.webp +0 -0
  233. package/docs/images/api/geometry/generators.webp +0 -0
  234. package/docs/images/api/geometry/mesh-arrays.webp +0 -0
  235. package/docs/images/api/geometry/vertex-updates.webp +0 -0
  236. package/docs/images/api/grass/grass-grove.webp +0 -0
  237. package/docs/images/api/grass/grass-presets.webp +0 -0
  238. package/docs/images/api/grass/grass-shadow.webp +0 -0
  239. package/docs/images/api/impostors/impostor-handover.webp +0 -0
  240. package/docs/images/api/impostors/impostor-shadow.webp +0 -0
  241. package/docs/images/api/impostors/impostors-forest.webp +0 -0
  242. package/docs/images/api/lights/spot-cookies.webp +0 -0
  243. package/docs/images/api/lines/lines-lit.webp +0 -0
  244. package/docs/images/api/lines/lines-widths.webp +0 -0
  245. package/docs/images/api/materials/coat-and-sheen.webp +0 -0
  246. package/docs/images/api/materials/decals.webp +0 -0
  247. package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
  248. package/docs/images/api/materials/relief.webp +0 -0
  249. package/docs/images/api/materials/shader-inputs.webp +0 -0
  250. package/docs/images/api/materials/standard-grid.webp +0 -0
  251. package/docs/images/api/materials/subsurface.webp +0 -0
  252. package/docs/images/api/materials/translucency.webp +0 -0
  253. package/docs/images/api/objects/objects-turntable.webp +0 -0
  254. package/docs/images/api/particles/campfire.webp +0 -0
  255. package/docs/images/api/points/galaxy.webp +0 -0
  256. package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
  257. package/docs/images/api/render/fullscreen-glow.webp +0 -0
  258. package/docs/images/api/render/reflection-mirror.webp +0 -0
  259. package/docs/images/api/render/security-camera.webp +0 -0
  260. package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
  261. package/docs/images/api/sound/sound-demo.webp +0 -0
  262. package/docs/images/api/splats/splats-demo.webp +0 -0
  263. package/docs/images/api/sprites/sprites-lines.webp +0 -0
  264. package/docs/images/api/terrain/terrain-demo.webp +0 -0
  265. package/docs/images/api/textures/canvas-screen.webp +0 -0
  266. package/docs/images/api/textures/mipmaps.webp +0 -0
  267. package/docs/images/api/vertex-draws/rain.webp +0 -0
  268. package/docs/images/api/water/ocean.webp +0 -0
  269. package/docs/images/api/water/water-demo.webp +0 -0
  270. package/docs/images/api/water/water-rain.webp +0 -0
  271. package/docs/images/api/water/waterfall.webp +0 -0
  272. package/docs/images/concepts/assets/gltf-model.webp +0 -0
  273. package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
  274. package/docs/images/concepts/culling/far-from-origin.webp +0 -0
  275. package/docs/images/concepts/instances/instances.webp +0 -0
  276. package/docs/images/concepts/instances/per-row-colors.webp +0 -0
  277. package/docs/images/concepts/large-worlds/large-world.webp +0 -0
  278. package/docs/images/concepts/lighting/area-lights.webp +0 -0
  279. package/docs/images/concepts/lighting/atmosphere.webp +0 -0
  280. package/docs/images/concepts/lighting/environment.webp +0 -0
  281. package/docs/images/concepts/lighting/light-shafts.webp +0 -0
  282. package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
  283. package/docs/images/concepts/lod/forest.webp +0 -0
  284. package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
  285. package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
  286. package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
  287. package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
  288. package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
  289. package/docs/images/concepts/post-processing/sharpen.webp +0 -0
  290. package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
  291. package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
  292. package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
  293. package/docs/images/cookbook/index/picking.webp +0 -0
  294. package/docs/images/cookbook/index/time-of-day.webp +0 -0
  295. package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
  296. package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
  297. package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
  298. package/docs/images/guides/multiple-views/split-screen.webp +0 -0
  299. package/docs/images/guides/performance/overdraw-view.webp +0 -0
  300. package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
  301. package/docs/images/index/showcase-island.webp +0 -0
  302. package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
  303. package/docs/images/shaders/builtins/builtins.webp +0 -0
  304. package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
  305. package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
  306. package/docs/images/shots.json +2231 -0
  307. package/docs/index.md +18 -23
  308. package/docs/moves.json +1 -0
  309. package/docs/nav.json +300 -0
  310. package/docs/pages.md +230 -209
  311. package/docs/porting/react-three-fiber.md +225 -6
  312. package/docs/porting/threejs-loop-and-threads.md +217 -7
  313. package/docs/porting/threejs-mapping.md +1249 -233
  314. package/docs/porting/threejs-materials.md +218 -6
  315. package/docs/porting/threejs-overview.md +240 -7
  316. package/docs/porting/threejs-postprocessing.md +4 -8
  317. package/docs/porting/threejs-shaders.md +301 -6
  318. package/docs/porting/threejs-unsupported.md +83 -7
  319. package/docs/porting/verification.md +178 -6
  320. package/docs/shaders/builtins.md +15 -4
  321. package/docs/shaders/library.md +72 -45
  322. package/docs/shaders/surface-functions.md +59 -23
  323. package/docs/shaders/wgsl-rules.md +12 -5
  324. package/lib/debug/channel.d.ts +103 -0
  325. package/lib/debug/channel.js +269 -0
  326. package/lib/debug/debug.d.ts +11 -9
  327. package/lib/debug/draw.d.ts +11 -2
  328. package/lib/debug/draw.js +57 -6
  329. package/lib/debug/inspector.d.ts +60 -0
  330. package/lib/debug/inspector.js +475 -0
  331. package/lib/debug/overlay-look.d.ts +6 -0
  332. package/lib/debug/overlay-look.js +29 -7
  333. package/lib/debug/overlay.js +15 -11
  334. package/lib/debug/stats-options.d.ts +13 -0
  335. package/lib/debug/stats-panel.d.ts +22 -7
  336. package/lib/debug/stats-panel.js +80 -13
  337. package/lib/debug/stats.d.ts +2 -3
  338. package/lib/errors/codes.d.ts +17 -3
  339. package/lib/errors/codes.js +117 -105
  340. package/lib/errors/engine-error.js +25 -10
  341. package/lib/errors/fixes.d.ts +1 -0
  342. package/lib/errors/fixes.js +20 -19
  343. package/lib/generated/core.d.ts +1 -1
  344. package/lib/generated/core.js +1 -1
  345. package/lib/gpu/early-builds.d.ts +68 -0
  346. package/lib/gpu/early-builds.js +158 -0
  347. package/lib/gpu/pipeline-name.d.ts +6 -0
  348. package/lib/gpu/pipeline-name.js +23 -0
  349. package/lib/gpu/variants.d.ts +8 -2
  350. package/lib/gpu/variants.js +39 -7
  351. package/lib/gpu/webgl2/backend.d.ts +63 -2
  352. package/lib/gpu/webgl2/backend.js +226 -8
  353. package/lib/gpu/webgl2/programs.d.ts +18 -0
  354. package/lib/gpu/webgl2/programs.js +5 -2
  355. package/lib/gpu/webgpu/backend.d.ts +89 -2
  356. package/lib/gpu/webgpu/backend.js +255 -8
  357. package/lib/gpu/webgpu/pipelines.d.ts +13 -0
  358. package/lib/gpu/webgpu/pipelines.js +28 -14
  359. package/lib/index.d.ts +7 -5
  360. package/lib/index.js +3 -2
  361. package/lib/math/color.d.ts +5 -5
  362. package/lib/math/color.js +5 -5
  363. package/lib/math/mat4.d.ts +6 -12
  364. package/lib/math/mat4.js +6 -12
  365. package/lib/math/namespaces/quat.d.ts +3 -3
  366. package/lib/math/namespaces/quat.js +3 -3
  367. package/lib/math/quat.d.ts +8 -12
  368. package/lib/math/quat.js +8 -12
  369. package/lib/math/random.d.ts +2 -3
  370. package/lib/math/random.js +2 -3
  371. package/lib/math/types.d.ts +4 -4
  372. package/lib/math/vec3.d.ts +3 -6
  373. package/lib/math/vec3.js +3 -6
  374. package/lib/page/capabilities.d.ts +8 -8
  375. package/lib/page/capabilities.js +39 -25
  376. package/lib/page/check-store.d.ts +14 -2
  377. package/lib/page/check-store.js +34 -11
  378. package/lib/page/engine.d.ts +117 -31
  379. package/lib/page/engine.js +438 -99
  380. package/lib/page/first-frame.d.ts +16 -0
  381. package/lib/page/first-frame.js +35 -0
  382. package/lib/page/frame-stats.d.ts +34 -1
  383. package/lib/page/frame-stats.js +15 -0
  384. package/lib/page/label-loop.d.ts +7 -3
  385. package/lib/page/label-loop.js +26 -14
  386. package/lib/page/labels.d.ts +3 -3
  387. package/lib/page/pipeline-store.d.ts +25 -0
  388. package/lib/page/pipeline-store.js +84 -0
  389. package/lib/page/start-marker.d.ts +4 -1
  390. package/lib/page/start-marker.js +5 -2
  391. package/lib/page/stats-switch.js +2 -0
  392. package/lib/page/switches.d.ts +38 -6
  393. package/lib/page/switches.js +29 -5
  394. package/lib/quality/check.d.ts +24 -3
  395. package/lib/quality/check.js +21 -7
  396. package/lib/quality/chooser.d.ts +6 -0
  397. package/lib/quality/chooser.js +8 -0
  398. package/lib/quality/governor.d.ts +98 -6
  399. package/lib/quality/governor.js +250 -20
  400. package/lib/quality/preset-docs.d.ts +16 -1
  401. package/lib/quality/preset-docs.js +3 -0
  402. package/lib/quality/presets.d.ts +84 -7
  403. package/lib/quality/presets.js +94 -2
  404. package/lib/render/draw.d.ts +3 -2
  405. package/lib/render/draw.js +15 -5
  406. package/lib/render/load-draw.d.ts +7 -5
  407. package/lib/render/load-draw.js +7 -5
  408. package/lib/render/loss.d.ts +28 -10
  409. package/lib/render/loss.js +50 -22
  410. package/lib/render/recovery.d.ts +20 -0
  411. package/lib/render/recovery.js +44 -4
  412. package/lib/render/renderer.d.ts +85 -9
  413. package/lib/render/renderer.js +181 -42
  414. package/lib/render/scene-renderer.d.ts +19 -1
  415. package/lib/render/scene-renderer.js +25 -1
  416. package/lib/render/webgl2-renderers.js +8 -5
  417. package/lib/render/webgpu-renderers.js +5 -4
  418. package/lib/scene/animation.d.ts +28 -32
  419. package/lib/scene/animation.js +12 -15
  420. package/lib/scene/assets.d.ts +61 -86
  421. package/lib/scene/assets.js +103 -236
  422. package/lib/scene/background.d.ts +14 -18
  423. package/lib/scene/background.js +5 -2
  424. package/lib/scene/baked-light.d.ts +2 -2
  425. package/lib/scene/color.d.ts +3 -3
  426. package/lib/scene/downloads.d.ts +2 -0
  427. package/lib/scene/downloads.js +371 -0
  428. package/lib/scene/environment.d.ts +7 -7
  429. package/lib/scene/environment.js +1 -1
  430. package/lib/scene/fake-call-values.js +3 -3
  431. package/lib/scene/fog.d.ts +11 -4
  432. package/lib/scene/fog.js +8 -2
  433. package/lib/scene/frame-cameras.d.ts +35 -4
  434. package/lib/scene/frame-cameras.js +86 -10
  435. package/lib/scene/gltf.d.ts +33 -3
  436. package/lib/scene/gltf.js +78 -49
  437. package/lib/scene/grading.d.ts +2 -2
  438. package/lib/scene/grading.js +3 -3
  439. package/lib/scene/ktx2.d.ts +9 -1
  440. package/lib/scene/ktx2.js +3 -2
  441. package/lib/scene/level-rule.d.ts +121 -0
  442. package/lib/scene/level-rule.js +130 -0
  443. package/lib/scene/lines.d.ts +13 -17
  444. package/lib/scene/lines.js +3 -3
  445. package/lib/scene/lut.d.ts +1 -2
  446. package/lib/scene/lut.js +1 -2
  447. package/lib/scene/particles.d.ts +7 -3
  448. package/lib/scene/particles.js +3 -1
  449. package/lib/scene/picks.d.ts +2 -2
  450. package/lib/scene/pointer-events.d.ts +4 -7
  451. package/lib/scene/post.d.ts +39 -43
  452. package/lib/scene/post.js +4 -1
  453. package/lib/scene/prefab.d.ts +7 -8
  454. package/lib/scene/prefab.js +7 -8
  455. package/lib/scene/property-animation.d.ts +1 -1
  456. package/lib/scene/property-animation.js +1 -1
  457. package/lib/scene/queries.d.ts +7 -13
  458. package/lib/scene/resources.d.ts +238 -261
  459. package/lib/scene/resources.js +179 -81
  460. package/lib/scene/scene.d.ts +167 -120
  461. package/lib/scene/scene.js +243 -103
  462. package/lib/scene/serial-loads.d.ts +29 -0
  463. package/lib/scene/serial-loads.js +68 -0
  464. package/lib/scene/shader-preloads.d.ts +34 -0
  465. package/lib/scene/shader-preloads.js +38 -0
  466. package/lib/scene/sprites.d.ts +14 -17
  467. package/lib/scene/sprites.js +5 -6
  468. package/lib/scene/textures.d.ts +11 -12
  469. package/lib/scene/textures.js +9 -10
  470. package/lib/scene/time-of-day.d.ts +11 -7
  471. package/lib/scene/time-of-day.js +11 -8
  472. package/lib/scene/vertex-draws.d.ts +5 -4
  473. package/lib/scene/vertex-draws.js +7 -5
  474. package/lib/shader-artifact.json +1 -0
  475. package/lib/shared/core.d.ts +5 -0
  476. package/lib/shared/core.js +1 -0
  477. package/lib/shared/import-once.d.ts +6 -0
  478. package/lib/shared/import-once.js +19 -0
  479. package/lib/shared/labels.d.ts +5 -2
  480. package/lib/shared/labels.js +5 -2
  481. package/lib/shared/metrics.d.ts +38 -0
  482. package/lib/shared/metrics.js +62 -1
  483. package/lib/shared/permutation-words.d.ts +2 -0
  484. package/lib/shared/permutation-words.js +8 -0
  485. package/lib/shared/recording.d.ts +13 -5
  486. package/lib/shared/recording.js +31 -10
  487. package/lib/shared/run-task.js +7 -1
  488. package/lib/shared/sketch-data.d.ts +9 -0
  489. package/lib/shared/sketch-data.js +57 -0
  490. package/lib/shared/task-pending.d.ts +12 -0
  491. package/lib/shared/task-pending.js +61 -1
  492. package/lib/shared/tasks.js +79 -32
  493. package/lib/shared/version.d.ts +17 -1
  494. package/lib/shared/version.js +19 -1
  495. package/lib/shared/wasm.d.ts +12 -4
  496. package/lib/shared/wasm.js +50 -27
  497. package/lib/shared/worker-start.d.ts +7 -0
  498. package/lib/shared/worker-start.js +27 -0
  499. package/lib/sketch/define-sketch.d.ts +51 -7
  500. package/lib/sketch/define-sketch.js +2 -1
  501. package/lib/sketch/input.d.ts +2 -2
  502. package/lib/sketch/preset-check.d.ts +20 -6
  503. package/lib/sketch/preset-check.js +42 -17
  504. package/lib/sketch/quality.d.ts +69 -11
  505. package/lib/sketch/quality.js +54 -13
  506. package/lib/sketch/runner.d.ts +80 -9
  507. package/lib/sketch/runner.js +390 -52
  508. package/lib/sketch/ui.d.ts +5 -8
  509. package/lib/sketch/ui.js +4 -2
  510. package/lib/stats.d.ts +1 -0
  511. package/lib/workers/probe-worker.d.ts +5 -0
  512. package/lib/workers/probe-worker.js +13 -4
  513. package/lib/workers/protocol.d.ts +71 -13
  514. package/lib/workers/protocol.js +4 -0
  515. package/lib/workers/render-worker.js +29 -5
  516. package/lib/workers/sketch-worker.js +108 -16
  517. package/package.json +2 -2
@@ -9,471 +9,483 @@ import { ERROR_FIXES } from './fixes.js';
9
9
  const DOCS = {
10
10
  E1101: {
11
11
  title: 'Stale handle',
12
- cause: 'A call used an object after it was destroyed. Its slot may already hold a new object.',
12
+ cause: 'A call used an object, instance batch or resource after you destroyed it. The engine reuses the freed slot, but a call through the old handle never changes the object that takes it.',
13
13
  example: 'E1101: setPosition() was called on "Crate" (slot 7), which was destroyed in frame 120.',
14
- since: '0.1',
14
+ details: "Development builds check every call on a scene object. Release builds skip that check: a destroyed object's setters write to a row that no object uses, and a second `destroy()` frees nothing.\n\nThe engine core checks each change that waits for the next frame and logs E1101 for a change to a destroyed object, such as a destroyed parent. Meshes, textures, color tables, probes, environments and instance batches throw E1101 in every build. A batch's array getters do too. An array that you read from a batch before its destroy can point at memory that another batch now uses.",
15
+ detailsSummary: 'which builds check',
16
+ see: ['concepts/handles'],
15
17
  },
16
18
  E1102: {
17
19
  title: 'Too many objects',
18
20
  cause: 'The scene, the table of instance batches or the queue of changes for the next frame is full. The message names which one, and how many it holds.',
19
21
  example: 'E1102: createMesh() failed: the scene already holds 1048575 objects.',
20
- since: '0.1',
21
22
  },
22
23
  E1103: {
23
24
  title: 'Object from another engine',
24
25
  cause: 'A call received an object that this engine did not create.',
25
26
  example: 'E1103: createInstances() got a mesh that is not from this engine.',
26
- since: '0.1',
27
27
  },
28
28
  E1104: {
29
29
  title: 'Parent loop',
30
30
  cause: 'A call would make an object its own ancestor: the new parent is the object itself or one of its descendants.',
31
31
  example: 'E1104: a queued change on an object (slot 9) would put it under its own descendant (slot 12).',
32
- since: '0.1',
33
32
  },
34
33
  E1105: {
35
34
  title: 'Unknown command',
36
- cause: 'The engine core received a structural change it does not know, so the TypeScript side and the core come from different builds.',
35
+ cause: "The engine core received a structural change it does not know, so the engine's JavaScript and its core come from different builds.",
37
36
  example: 'E1105: the engine core received command 42.',
38
- since: '0.1',
39
37
  },
40
38
  E1106: {
41
39
  title: 'Object never created',
42
40
  cause: 'A call such as `setVisible` or `setParent` queued a change for an object that the engine never created. The engine creates an object when the next frame starts. When that fails, for example because its parent was destroyed, the object never joins the scene.',
43
41
  example: 'E1106: a queued change named an object (slot 7), which the engine never created.',
44
- since: '0.1',
45
42
  },
46
43
  E1107: {
47
44
  title: 'Object created twice',
48
- cause: 'The engine core received a second create command for one object, so the TypeScript side and the core disagree about the scene.',
45
+ cause: "The engine core received a second create command for one object, so the engine's JavaScript and its core disagree about the scene. The core skips that command, and the scene keeps running.",
49
46
  example: 'E1107: the object in slot 7 was created twice.',
50
- since: '0.1',
51
47
  },
52
48
  E1108: {
53
49
  title: 'Value out of range',
54
50
  cause: "A call received a number outside the range it takes. Examples are a row past the capacity of an instance batch, an opacity above 1, a negative radius, and a camera's far plane that does not lie beyond its near plane.",
55
51
  example: 'E1108: setActiveCount() got 1200, above the limit of 1000.',
56
- since: '0.1',
57
52
  },
58
53
  E1109: {
59
54
  title: 'Engine memory full',
60
- cause: "The engine could not create or grow its WebAssembly memory. A page with worker threads gives the engine 1 GiB by default, and up to 4 GiB through the memory option of createEngine. Each instance row takes about 210 bytes, or about 300 with per-row colors or values. So about 5 million rows fill 1 GiB, along with the rest of the scene. A mesh of millions of vertices can fill it too, from geometry.fromArrays or a model file. Building such a mesh with normals to compute takes about 100 bytes per vertex for a moment. A frame can fail too, because the first frame copies every mesh of the scene. Its need is largest on the direct draw path: a scene with 84 MiB of meshes peaks at about 270 MiB there and about 205 MiB on the indirect path. The engine also keeps the last 8 MiB under the limit for its own small requests, so a scene stops once it reaches them. A browser can refuse memory sooner, as phones often do. It can also refuse a new engine's memory while the memory of an engine that stopped before is not free yet. The engine then tries again for about 45 seconds before it fails, and reports memory-wait through onProgress after 10 seconds.",
55
+ cause: 'The engine could not create or grow its WebAssembly memory. A page with worker threads gives the engine 1 GiB by default, and the memory option of `createEngine()` can raise it to 4 GiB. Many instance rows, a mesh of millions of vertices, or the first frame that copies every mesh can fill it.',
61
56
  example: 'E1109: createInstances() failed: the engine could not get 1282 MB more memory.',
62
- since: '0.1',
57
+ details: 'Each instance row takes about 210 bytes, or about 300 with per-row colors or values. About 5 million rows fill 1 GiB, along with the rest of the scene. Building a mesh with normals to compute takes about 100 bytes per vertex for a moment.\n\nThe first frame copies every mesh of the scene. A scene with 84 MiB of meshes peaks at about 270 MiB on the direct path. It peaks at about 205 MiB on the indirect path.\n\nThe engine keeps the last 8 MiB under the limit for its own small requests. It tries again for about 45 seconds before it fails, and reports memory-wait through onProgress after 10 seconds.\n\nA browser can refuse memory sooner, as phones often do, or while an engine that stopped before still holds its memory.',
58
+ detailsSummary: 'memory figures and the retry',
59
+ fixCases: [
60
+ 'For a huge mesh: split it into smaller meshes, or simplify it.',
61
+ 'For a batch that draws no colors: give it colors only when it needs them.',
62
+ 'For several engines on one page: destroy the engines you no longer use, or keep one and detach and attach it. A smaller maximum leaves room for more engines.',
63
+ ],
64
+ see: ['guides/performance'],
63
65
  },
64
66
  E1110: {
65
67
  title: 'Unmarked write to a static object',
66
- cause: "A static object's position, rotation, scale or bounding sphere changed without a setter. The engine recomputes a static object only in a frame where a setter marks it or its parent moves. So such a change can show late, or never. Development builds check these values of every static object before each transform update. Each frame has one transform update, and a sketch with onLateUpdate gets a second one after that callback. A row of a static instance, sprite or point batch that changed without markDirty() raises it too: the engine updates only the marked rows, and development builds check the drawn rows before each batch update, a share of a large batch in each frame. Release builds leave the check out.",
68
+ cause: "A static object's position, rotation, scale or bounding sphere changed without a setter. The engine updates a static object only in a frame where a setter marks it or its parent moves. A row of a static instance, sprite or point batch that changed without `markDirty()` raises it too.",
67
69
  example: 'E1110: the position of "Crate" (slot 7) changed without a setter.',
68
- since: '0.1',
70
+ details: 'The change can show late, or never. Development builds check for these writes in every frame. Release builds leave the check out, so no error comes, and the picture can stay wrong.',
71
+ detailsSummary: 'when the check runs',
72
+ see: ['concepts/static-dynamic'],
69
73
  },
70
74
  E1111: {
71
75
  title: 'Mesh or model still in use',
72
76
  cause: 'A call to destroy() named a mesh, or a model that assets.loadGltf loaded, while an object or an instance batch still uses it. For a model, that includes objects that use one of its meshes or materials, and objects that its animation clips move. The engine keeps the mesh or model, so nothing draws freed memory.',
73
77
  example: 'E1111: mesh.destroy() was called on a mesh that "Crate" (slot 7) still uses. Destroy the objects and instance batches that use it first.',
74
- since: '0.2',
75
78
  },
76
79
  E1112: {
77
80
  title: 'Unsupported cookie texture',
78
81
  cause: "A spot light's map copies its picture once, when the texture's texels reach the GPU. A video's texture and a render pass's texture change every frame, and a 3D or cube texture holds more than one image, so none of them fits the copy.",
79
82
  example: "E1112: setMap() got a texture that changes every frame on a spot light, which a spot light's map copies once. Give a still texture, such as one that assets.loadTexture loaded.",
80
- since: '0.3',
81
83
  },
82
84
  E1203: {
83
85
  title: 'Invalid number',
84
86
  cause: 'A call received a number that is not finite, such as NaN or Infinity.',
85
87
  example: 'E1203: setPosition() got NaN for x on "Player" (slot 12). Check the value computed before this call.',
86
- since: '0.1',
87
88
  },
88
89
  E1204: {
89
90
  title: 'Invalid color',
90
91
  cause: 'A call received a color that is not a hex string, a number from 0 to 0xffffff, or three numbers from 0 to 1.',
91
92
  example: 'E1204: setBackground() got the color "blue-ish".',
92
- since: '0.1',
93
93
  },
94
94
  E1205: {
95
95
  title: 'Unknown input name',
96
96
  cause: 'An input call received a name that no key, button or action has, or `input.actions.define()` received an action name that a key or button already has. `on()` and `off()` received an event type that objects do not have. Names are case-sensitive: `KeyW` is the W key, and `keyW` names nothing.',
97
97
  example: 'E1205: isDown() got "keyW", which names no key, button or action.',
98
- since: '0.1',
99
98
  },
100
99
  E1206: {
101
100
  title: 'Invalid mesh arrays',
102
- cause: 'geometry.fromArrays() received arrays that make no mesh, scene.createLines() received points that make no line, or scene.createPoints() received arrays that make no points. An array can have the wrong length for the vertex count, an index can name no vertex, or a value can be NaN or Infinity. Normals can also be missing, or both given and computed. A mesh can also take `targets` or `morphTargets`, not both. A line needs at least 2 points, and pairs of points need an even number. Points need at least 1 point, with 3 or 4 numbers of color each. Or mesh.updateVertices() received values that do not fit the mesh: an attribute the mesh lacks or that takes no updates, another array type than the mesh keeps, or vertices past its last one.',
101
+ cause: 'A call that builds or updates a mesh, a line or a set of points got arrays that do not fit. An array can have the wrong length, an index can name no vertex, or a value can be NaN or Infinity.',
103
102
  example: 'E1206: geometry.fromArrays() got 9 numbers in normals for 4 vertices, not 12.',
104
- since: '0.1',
103
+ details: '| Call | Refuses |\n| --- | --- |\n| `geometry.fromArrays()` | an array of the wrong length, an index past the last vertex, a NaN or Infinity value, missing normals, normals both given and computed, both `targets` and `morphTargets`, and no indices with a vertex count that is not a multiple of three |\n| `scene.createLines()` | fewer than 2 points, an odd count for segment pairs, and colors that do not match the points |\n| `scene.createPoints()` | no points, and colors that are not 3 or 4 numbers per point |\n| `mesh.updateVertices()` | an attribute that the mesh lacks or that takes no updates, another array type than the mesh keeps, an array that does not hold every vertex, vertices past the last one, a mesh with joints or morph targets, and a start or count that is not a whole number of 0 or more |',
104
+ detailsSummary: 'what each call checks',
105
+ fixCases: [
106
+ 'For `mesh.updateVertices()`: give values for every vertex, in the array type that the mesh keeps, for an attribute that the mesh has.',
107
+ ],
105
108
  },
106
109
  E1207: {
107
110
  title: 'Invalid layer mask',
108
111
  cause: 'A call that sets layers received a number that is not a 32-bit layer mask: a fraction, NaN, or a number past 32 bits.',
109
112
  example: 'E1207: setLayers() got 2.5 on "Player" (slot 12), which is not a 32-bit layer mask.',
110
- since: '0.1',
111
113
  },
112
114
  E1208: {
113
115
  title: 'Invalid texture',
114
116
  cause: "A call that makes or updates a texture received something it cannot use. It can be an option the engine does not know, or an image without pixels or larger than the device takes. It can also be data that does not fit the texture's size and format, or numbers that make no color grading table. With a KTX2 file, it can be an option that the file cannot take, or an update of its texture.",
115
117
  example: 'E1208: textures.fromData() got 12 numbers for 2 x 2 x 1 texels, not 16: give four per texel.',
116
- since: '0.1',
118
+ see: ['api/textures'],
117
119
  },
118
120
  E1209: {
119
121
  title: 'Too many textures',
120
122
  cause: 'A material whose shader reads more textures than a WebGL2 shader stage has units. The engine numbers the textures that a program reads, and WebGL2 gives every stage at least 16 units, as many as the device reports. The lit shader reads most of them, so a custom material or add-on draw reaches the limit with its own textures, beside the maps and the shadows.',
121
123
  example: 'E1209: a WebGL2 program reads 18 textures in its fragment stage, and a stage has 16 units: give the material fewer textures.',
122
- since: '0.3',
123
124
  },
124
125
  E1213: {
125
126
  title: 'Invalid setting',
126
- cause: 'A call received a setting that it does not have, or a value that the setting does not take. Examples are a tone mapping that the engine does not know, a negative exposure, a grading control outside its range, and a built-in environment that the engine does not have. It also covers a glTF extension handler that names no extension, that another handler reads, or that returns a part without a mesh or a material.',
127
+ cause: 'A call received a setting that it does not have, or a value that the setting does not take. A tone mapping that the engine does not know, or a grading control outside its range, are examples.',
127
128
  example: `E1213: post.set() got the tone mapping "filmic", which is not 'agx', 'agx-punchy', 'neutral', 'aces' or 'none'.`,
128
- since: '0.1',
129
+ details: '`post.set()` refuses a tone mapping that the engine does not know, a negative exposure, and a grading control outside its range.\n\n`assets.builtinEnvironment()` refuses a name that no built-in environment has.\n\n`assets.registerGltfExtension()` refuses a handler that names no extension, that another handler reads, or that returns a part without a mesh or a material.\n\n`createEngine()` refuses sketch data that is not plain JSON data, or that takes more than 64 KiB as JSON.',
130
+ detailsSummary: 'the calls and settings that raise it',
131
+ see: ['api/materials'],
129
132
  },
130
133
  E1214: {
131
134
  title: 'Invalid sketch option',
132
- cause: 'defineSketch() received an option out of its range. fixedRate must be a number above 0, and maxFixedSteps a whole number of 1 or more. The engine checks the options before it runs the setup function.',
135
+ cause: 'defineSketch() received an option out of its range. fixedRate must be a number above 0, and maxFixedSteps a whole number of 1 or more. downloads must be an array of file addresses: an empty string, or a string that is not an address, fails. The engine checks the options before it runs the setup function.',
133
136
  example: 'E1214: defineSketch() got 0 for fixedRate.',
134
- since: '0.1',
135
137
  },
136
138
  E1215: {
137
139
  title: 'Invalid custom WGSL',
138
- cause: 'materials.shader(), post.addEffect(), post.set() or scene.setSkyLayer() received WGSL that it cannot draw with. The null3D Vite plugin compiles WGSL while it builds the project. The engine therefore takes only what the plugin compiled: a template literal after a /* wgsl */ comment, or a .wgsl file that a module imports. The WGSL of a custom material declares a surface function, a vertex offset or a lobe. A full shader instead has a @vertex entry point that takes an InstanceIn from null3d::mesh. An effect declares fn effect, a tone curve fn toneCurve, and a sky layer fn skyLayer.',
140
+ cause: '`materials.shader()`, `post.addEffect()`, `post.set()` or `scene.setSkyLayer()` received WGSL that it cannot draw with. The engine takes only WGSL that the null3D Vite plugin compiled, as a shader of the kind that the call takes.',
139
141
  example: 'E1215: materials.shader() got WGSL as text, which the null3D Vite plugin did not compile.',
140
- since: '0.1',
142
+ fixDetails: '| Call | WGSL declares |\n| --- | --- |\n| `materials.shader()`, surface | `fn surface(input: SurfaceInput) -> Surface`, with no `@vertex` or `@fragment` entry |\n| `materials.shader()`, vertex offset | `fn vertexOffset(input: VertexInput) -> vec3f` |\n| `materials.shader()`, lobe | `fn lobe(input: LobeInput) -> vec3f` |\n| `materials.shader()`, full shader | a `@vertex` entry that takes an `InstanceIn` from `null3d::mesh` |\n| `materials.shader()`, own vertices | a `@vertex` entry with `@builtin(vertex_index)` and `@builtin(instance_index)`, and no mesh attribute |\n| `post.addEffect()` | `fn effect(input: EffectInput) -> vec4f` |\n| `post.set({ toneMapping })` | `fn toneCurve(color: vec3f) -> vec3f` |\n| `scene.setSkyLayer()` | `fn skyLayer(input: SkyLayerInput) -> SkyLayer` |',
143
+ fixDetailsSummary: 'the WGSL that each call declares',
144
+ see: ['guides/custom-shaders'],
141
145
  },
142
146
  E1216: {
143
147
  title: 'Invalid uniform or texture',
144
- cause: "A custom material's or effect's uniforms or textures did not match its WGSL. The uniforms option and set() take the names of the fields of struct Uniforms in the WGSL, each with a value of its type. A field cannot have the name of a standard value, such as color or roughness, because set() takes those too. The textures option takes the names of the WGSL's `var name: texture_2d<f32>;` and `var name: texture_2d_array<f32>;` declarations, each with a texture of the layers that its declaration takes.",
148
+ cause: "A custom material's or effect's uniforms or textures did not match its WGSL. The options take the names of the fields of `struct Uniforms` and of the WGSL's texture declarations. Give each one a value or texture of the type that its declaration takes, and leave standard values such as `color` to `set()`.",
145
149
  example: "E1216: materials.shader.set() got speeed, which is not a uniform of the material's WGSL.",
146
- since: '0.1',
150
+ fixDetails: '| WGSL type | Give |\n| --- | --- |\n| `f32` | a number |\n| `i32` | a whole number |\n| `u32` | a whole number |\n| `vec2f` | an array of 2 numbers |\n| `vec3f` | an array of 3 numbers, or a color |\n| `vec4f` | an array of 4 numbers |\n| `texture_2d<f32>` | a texture of one layer |\n| `texture_2d_array<f32>` | a texture of one or more layers, from `textures.fromData()` with a depth or a KTX2 file of layers |',
151
+ fixDetailsSummary: 'the value that each WGSL type takes',
152
+ see: ['guides/custom-shaders'],
147
153
  },
148
154
  E1217: {
149
155
  title: 'Invalid material option',
150
- cause: "A material factory or scene.createLines() received an option value that it does not take, such as an unknown alpha mode, blending or line mode. Custom materials refuse the 'weighted' blending, and take alpha to coverage or the hash mode only where their WGSL sets or reads the surface's alpha. A material that lets light through refuses the hash alpha mode and the weighted blending. A layered material, with a clear coat, a sheen, iridescence or anisotropy, refuses a light map, specular maps, and two textures for a pair of layer maps that glTF packs into one. It refuses a transmission or a thickness map only where one of its layer maps fills the array that the map samples: the clear coat's normal map and iridescence's thickness map fill the array that the transmission map samples, and the sheen's maps and the anisotropy map fill the array that the thickness map samples. A material with transmission refuses a thickness map beside a specular color map, whose sRGB texture never shares the thickness map's array, and other materials refuse those two maps. A material that lets light through to its other side refuses the specular maps, whose places its diffuse transmission maps take, a clear coat, a sheen and the weighted blending, and other materials refuse the diffuse transmission maps. A custom material refuses subsurfaceRadius, which only a standard material takes. A custom material whose WGSL declares a coverage function takes the mask mode, or the blend mode with the cutoff that its shadow caster tests.",
156
+ cause: 'A material factory or scene.createLines() got an option value that it does not take, or two options that cannot go together. The message names the option and the rule it breaks.',
157
+ see: ['api/materials', 'api/lines'],
151
158
  example: `E1217: materials.standard() got the alpha mode "cutout"; it takes 'opaque', 'mask' or 'blend'.`,
152
- since: '0.1',
159
+ details: "A material factory or scene.createLines() received an option value that it does not take, such as an unknown alpha mode, blending or line mode. Custom materials refuse the 'weighted' blending, and take alpha to coverage or the hash mode only where their WGSL sets or reads the surface's alpha. A material that lets light through refuses the hash alpha mode and the weighted blending.\n\nA layered material, with a clear coat, a sheen, iridescence or anisotropy, refuses a light map, specular maps, and two textures for a pair of layer maps that glTF packs into one. It refuses a transmission or a thickness map only where one of its layer maps fills the array that the map samples: the clear coat's normal map and iridescence's thickness map fill the array that the transmission map samples, and the sheen's maps and the anisotropy map fill the array that the thickness map samples.\n\nA material with transmission refuses a thickness map beside a specular color map, whose sRGB texture never shares the thickness map's array, and other materials refuse those two maps.\n\nA material that lets light through to its other side refuses the specular maps, whose places its diffuse transmission maps take, a clear coat, a sheen and the weighted blending, and other materials refuse the diffuse transmission maps. A custom material refuses subsurfaceRadius, which only a standard material takes. A custom material whose WGSL declares a coverage function takes the mask mode, or the blend mode with the cutoff that its shadow caster tests.",
160
+ detailsSummary: 'the rules for each material option',
153
161
  },
154
162
  E1218: {
155
163
  title: 'Invalid animation call',
156
- cause: "An animator call named a clip, layer or joint that the object's animation does not have. Or it got an option out of range, such as a negative fade. animator() was called on an object that has no animation clips. Or the engine refused animation data, such as a skeleton that lists a joint before its parent. Or setMorphWeight or getMorphWeight named a morph target that the mesh does not have. A clip of more than 4,194,304 keys, its frames times its tracks, is refused too, as a clip whose keys lie hours apart is.",
164
+ cause: 'An animation call, or animation data that the engine loads, named something that does not exist or gave a value out of range. The call can be an animator call, a morph-weight call or `animateProperty()`.',
157
165
  example: `E1218: play() got "rnu", which names no clip of "Hero" (slot 3). Its clips are idle, run and walk.`,
158
- since: '0.2',
166
+ cases: [
167
+ 'An unknown clip, layer or joint.',
168
+ 'An option out of range, such as a negative fade, a layer outside 0 to 3, or a weight outside 0 to 1.',
169
+ '`animator()` on an object that has no animation clips.',
170
+ 'A morph target that the mesh does not have.',
171
+ 'Two clips with the same name, or a clip event named `loop` or `finished`.',
172
+ 'Animation data that the core refuses, such as a skeleton that lists a joint before its parent.',
173
+ 'A clip of more than 4,194,304 keys, which is its frames times its tracks.',
174
+ ],
159
175
  },
160
176
  E1219: {
161
177
  title: 'Invalid label',
162
178
  cause: "ui.trackLabel() or ui.untrackLabel() got an id that is not a string with at least one character. Or trackLabel() got a transform that is not 'screen', 'world' or 'billboard', or a rotation that is not a number for a label that faces the camera. Or the sketch tracked more labels at once than createEngine's maxLabels option allows: 4,096 by default. A label that is a plane of the scene counts against maxLabels3d instead, which holds 256 by default.",
163
179
  example: 'E1219: trackLabel() could not track "hp-4097": the engine already tracks 4096 labels. Raise createEngine()\'s maxLabels option for more.',
164
- since: '0.2',
165
180
  },
166
181
  E1220: {
167
182
  title: 'Invalid render pass',
168
- cause: 'render.addPass() got options that it does not take: an unknown kind or option, no camera, a size outside 1 to the largest texture, both a size and a scale, an input image it does not know, a workgroup size or dispatch that a device cannot run, a format that a compute pass does not write, a compute pass on WebGL2 with no fallback, or a texture name or pass name that another pass has. Or the sketch added more passes than draw at once: 31. Or textures.fromPass(), render.setPassEnabled(), render.setPassUniform(), render.setPassUniforms() or render.removePass() got something that is not a render pass, render.setPassUniform() got a pass that is not a full-screen pass, or render.setPassUniforms() got a pass that is not a compute pass.',
183
+ cause: 'A render pass call got options that it does not take, or a pass of a kind that it does not work on. The message names the call and the rule that it breaks.',
169
184
  example: 'E1220: render.addPass() got writes "minimap", which the pass "minimap" writes already. Give each pass a texture name of its own.',
170
- since: '0.2',
185
+ details: '`render.addPass()` refuses an unknown kind or option, no camera, and a size outside 1 to the largest texture. It refuses both a size and a scale, an unknown input image, and a workgroup size or dispatch that a device cannot run.\n\nIt refuses a format that a compute pass does not write, and a compute pass on WebGL2 with no fallback. It refuses a texture name or pass name that another pass has, and a 32nd live pass, since at most 31 passes draw at once.\n\n`textures.fromPass()`, `render.setPassEnabled()` and `render.removePass()` take any render pass. `render.setPassUniform()` takes a full-screen pass, and `render.setPassUniforms()` takes a compute pass and at most 32 numbers.',
186
+ detailsSummary: 'what each render call refuses',
171
187
  },
172
188
  E1221: {
173
189
  title: 'Invalid levels of detail',
174
- cause: "mesh.setLevels() received levels that the mesh cannot take, or a glTF file's MSFT_lod levels could not become them. Each level's error, distance or coverage must be a finite number above 0, and its switch distance must lie farther than the level's before it. A coarser level covers more of the screen, so its coverage is smaller. A mesh takes at most 15 lower levels. Each level must be another live mesh of the same engine, with the same vertex attributes as the base mesh. A level's material, where it gives one, must be a live material of the same engine. mesh.buildLevels() refuses a mesh with joints, morph targets or a vertex record, whose shape poses or moves.",
190
+ cause: "`mesh.setLevels()` received levels that the mesh cannot take, or a glTF file's MSFT_lod levels could not become them. Each level gives one of an error, a distance and a coverage, and the switch distances grow from level to level.",
175
191
  example: 'E1221: mesh.setLevels() got an error of 0.02 for level 2, not above the 0.05 of level 1. Errors grow from level to level.',
176
- since: '0.2',
192
+ details: "A mesh takes at most 15 lower levels. Each level gives exactly one of an error, a distance and a coverage, as a finite number above 0. Its switch distance must lie farther than the level before it, and a coarser level covers more of the screen, so its coverage is smaller.\n\nEach level must be another live mesh of the same engine, with the same vertex attributes as the base mesh. A level's material, where it gives one, must be a live material of the same engine. The `fov` option sets the reference view, and lies between 0 and 180.\n\n`mesh.buildLevels()` refuses a mesh with joints, morph targets or a vertex record, whose shape poses or moves.",
193
+ detailsSummary: 'the rules for each level',
177
194
  },
178
195
  E1222: {
179
196
  title: 'Invalid light probe grid texture',
180
197
  cause: 'scene.setLightProbeGrid() received a texture that is not a 3D texture. A probe grid sample reads a 3D texture, so the frame cannot bind a texture array in its place. setLightProbeGrid() also refuses a texture that is not live.',
181
198
  example: "E1222: setLightProbeGrid() got a texture that is not a 3D texture. Make the grid's texture with LightProbeGridData.toTexture().",
182
- since: '0.2',
183
199
  },
184
200
  E1223: {
185
201
  title: 'Invalid feature description',
186
- cause: 'defineFeature(), FeatureRegistry.add(), addFeatureDraw(), post.addFeatureEffect(), scene.setSkyLayer() or a compute pass of render.addPass() got a description that it cannot take: an unknown option, a name that is empty or longer than 64 characters, a frame point or kind that does not exist or does not go together, an order outside its band, an unknown resource, lighting slot or view, a resource or view without a frame point, an output with no neutral default, a feature name, output name or debug view name that another feature has, a lighting slot that another feature provides, a debug view name that names one of the views that the engine draws itself or gives no set callback, a draw at a frame point, view or alpha mode that the draw adapter does not place, a full-screen effect at another frame point or view, writing another resource, reading one the effect chain does not bind, publishing an output, providing a slot, or disagreeing with its WGSL about the scene depth, a sky layer that does not record at the background point, as a draw, providing the sky and drawing in the three views, or a compute pass at a frame point, view, scene resource read or output that the compute adapter does not place.',
202
+ cause: 'A call that registers a feature, a feature draw, a full-screen effect, a sky layer or a compute pass got a description it cannot take. The message names the value and the rule that it breaks.',
187
203
  example: "E1223: FeatureRegistry.add() got the slot 'ao', which the feature 'ambient-occlusion' provides already. One feature provides each lighting slot.",
188
- since: '0.3',
204
+ details: "- Names: a name that is empty, longer than 64 characters, or holds a line break. A feature, output or debug view name that another feature has. An output name that names one of the engine's own resources.\n- Frame points, kinds and order: a frame point or kind that does not exist, or two that do not go together. A kind, read, write or view without a frame point. An order outside its band.\n- Resources, slots, views and outputs: an unknown resource, lighting slot or view, or the same one twice. An output without a neutral default. A lighting slot that another feature provides. A debug view that names an engine view, or whose set is not a function.\n- Settings and budgets: an option that a description does not take. A setting whose presets are not four values from its range. A governor without a budget. A budget whose presets are not four times above 0, or whose minimum is outside 0 to 1.\n- The GPU scope: a pass that `render.addPass()` did not return.",
205
+ detailsSummary: 'every description that the engine refuses',
206
+ fixDetails: "| Kind | Frame point | Views | Rules |\n| --- | --- | --- | --- |\n| Draw | 'opaque', 'transparent' or 'resolve' | main | The alpha mode must match the frame. |\n| Full-screen effect | 'resolve' | main | Reads 'sceneColor', and 'sceneDepth' when its WGSL reads the depth. Writes 'sceneColor' alone. |\n| Sky layer | 'background' | main, scenePass and reflection | Provides 'sky'. |\n| Compute pass | 'background', 'opaque', 'transparent', 'resolve' or 'post' | main | Reads no scene resource. Publishes one output texture, or fills an instance draw's buffers. |\n\nA full-screen effect publishes no texture and provides no lighting slot. A compute pass that fills an instance draw publishes no output. A budget gives its time in ms at full quality on each preset: four numbers above 0.",
207
+ fixDetailsSummary: 'what each kind of feature accepts',
189
208
  },
190
209
  E1224: {
191
210
  title: 'Material cannot draw a mesh',
192
211
  cause: 'scene.overrideMaterial received a sprite, point or line material. Such a material draws the rows of its batch, or a sprite or line of its own, rather than the surface of a mesh, so it cannot stand in for every mesh of the pass.',
193
212
  example: 'E1224: scene.overrideMaterial got a sprite material. It takes a material that draws meshes, from materials.standard(), materials.unlit(), materials.shader() or materials.decal().',
194
- since: '0.3',
195
213
  },
196
214
  E1225: {
197
215
  title: 'Add-on name clash',
198
216
  cause: 'An add-on registered a name that the engine or another add-on holds: its namespace, its shader library, an error-code range, a quality key, or the name of a feature, output or lighting slot. A namespace also names the package that owns it, so a second add-on that takes the name is refused even when its other fields match, while a reload of the same package keeps its namespace. Two add-ons cannot share a name, a range or a key, because the engine would have two answers for one of them.',
199
217
  example: "E1225: declareAddonNamespace() got the add-on name 'water' for the package '@ben/water', which the package '@ana/water' claims already. Give each add-on a name of its own.",
200
- since: '0.3',
201
218
  },
202
219
  E1301: {
203
220
  title: 'No usable GPU path',
204
221
  cause: 'The browser offers neither WebGPU nor WebGL2 for the way the engine was asked to draw.',
205
222
  example: 'E1301: no usable GPU path for ?gpu=webgpu in this browser.',
206
- since: '0.1',
207
223
  },
208
224
  E1302: {
209
225
  title: 'GPU lost',
210
226
  cause: 'The browser took the GPU away while the engine drew, for example after a driver reset or a GPU crash, and the engine could not carry on. No new GPU device started, or the GPU was lost more than twice within a minute. The engine stopped drawing.',
211
227
  example: 'E1302: the render worker lost its GPU: the GPU device was lost.',
212
- since: '0.1',
213
228
  },
214
229
  E1303: {
215
230
  title: 'WebAssembly SIMD missing',
216
231
  cause: "The browser runs WebAssembly without SIMD, which the engine's core needs.",
217
232
  example: 'E1303: this browser runs WebAssembly without SIMD.',
218
- since: '0.1',
219
233
  },
220
234
  E1304: {
221
235
  title: 'GPU out of memory',
222
236
  cause: 'The GPU had no room for a buffer or texture that the engine made after the start. The objects that use it draw wrong or not at all. The engine reports the first time this happens on each GPU device, and draws on.',
223
237
  example: "E1304: the render worker's GPU ran out of memory: Not enough memory left.",
224
- since: '0.2',
225
238
  },
226
239
  E1305: {
227
240
  title: 'GPU rejected work',
228
241
  cause: 'The GPU path refused a command that the engine gave it after the start, such as a buffer larger than the device allows. The objects that the command made or drew are missing, and the canvas can stay black. The engine reports the first time this happens on each GPU device, and draws on.',
229
242
  example: "E1305: the render worker's GPU rejected a command: Buffer size (377487360) exceeds the max buffer size limit (268435456).",
230
- since: '0.2',
231
243
  },
232
244
  E1306: {
233
245
  title: 'Safari before 18',
234
246
  cause: 'The browser runs the WebKit engine of a Safari before 18, which null3D does not support. Every browser on iPhone and iPad runs WebKit, so Chrome, Edge and Firefox there count too.',
235
247
  example: 'E1306: this browser runs the WebKit engine of Safari 17, and the engine needs Safari 18 or later.',
236
- since: '0.2',
248
+ },
249
+ E1307: {
250
+ title: 'Pipeline not built',
251
+ cause: "After the start, the GPU's driver could not build one pipeline that draws objects of the scene. The objects that draw with it are missing from the pass that the message names, and the engine draws on.",
252
+ example: "E1307: the render worker's GPU driver could not build the pipeline of custom material 135, so the objects that draw with it are missing. It failed twice, the second time alone: CreateGraphicsPipelines failed with VK_ERROR_UNKNOWN.",
253
+ details: 'The driver refused the pipeline among the other builds, and again when the engine built it alone. A driver does this when it runs short of memory as it compiles the shader, or when its compiler fails on the shader.\n\nOn WebGL2, a program that the driver refuses to link twice counts the same. The engine reports the first failure of each kind on each GPU device.',
254
+ detailsSummary: 'how the engine builds the pipeline',
237
255
  },
238
256
  E1401: {
239
257
  title: 'Not a sketch module',
240
258
  cause: 'The module passed to createEngine as the sketch does not export a sketch as its default export.',
241
259
  example: 'E1401: /sketch.ts must export default defineSketch(...).',
242
- since: '0.1',
243
260
  },
244
261
  E1402: {
245
262
  title: 'Engine core out of date',
246
- cause: "The engine core WebAssembly file lacks functions that the TypeScript side calls, so the two come from different builds. Development builds check this when the core loads. When null3D's own dev server serves the engine from a checkout of its repository, the check also compares the stamp of the Rust sources that the core was built from with the stamp of the checkout's sources. A core built before a merge or an edit of those sources then fails at once, before it can run with code that expects another core.",
263
+ cause: "The engine core's WebAssembly file lacks functions that the engine's JavaScript calls, so the two come from different builds. Development builds check this when the core loads. When null3D's own dev server serves the engine from a checkout of its repository, the check also compares the stamp of the Rust sources that the core was built from with the stamp of the checkout's sources. A core built before a merge or an edit of those sources then fails at once, before it can run with code that expects another core.",
247
264
  example: 'E1402: the threaded engine core lacks isThreadedBuild.',
248
- since: '0.1',
249
265
  },
250
266
  E1403: {
251
267
  title: 'Engine core not ready',
252
268
  cause: 'An engine call ran before the engine core started in this worker, or the core started twice.',
253
269
  example: 'E1403: createMesh() ran before the engine core started.',
254
- since: '0.1',
255
270
  },
256
271
  E1404: {
257
272
  title: 'Engine thread failed',
258
273
  cause: 'An engine thread, or the drawing on the page, hit an error it could not handle, such as a trap in the engine core. After the start, the thread stops its loop: the engine draws no new frames, and engine.onFailure receives this error. During the start, createEngine() stops the engine and rejects with this error.',
259
274
  example: 'E1404: the render worker failed: out of memory.',
260
- since: '0.1',
261
275
  },
262
276
  E1405: {
263
277
  title: 'Engine thread did not start',
264
278
  cause: "An engine worker failed while the engine started. The worker's script, the engine core or the renderer did not start there, or the sketch's setup function threw an error without an engine code.",
265
279
  example: 'E1405: the render worker did not start: no WebGPU adapter.',
266
- since: '0.1',
280
+ see: ['getting-started/hosting'],
267
281
  },
268
282
  E1406: {
269
283
  title: 'Engine file not downloaded',
270
- cause: 'A file of the engine core did not download whole, or a file that a call loads the first time. The first KTX2 file loads the KTX2 transcoder, and the first glTF file the glTF loader. The first mesh that plans its levels of detail loads the level planner and its simplifier. The first glTF file with meshopt compression loads the meshopt decoder, and the first with Draco compression the Draco decoder. The first color grading table loads its readers, and the first environment its reader. The first sprite or point batch loads the sprite code, and the first line batch the line code. The first feature draw, instance draw or full-screen effect loads that adapter. The server answered with an error or sent another file in its place, such as a web page, or the connection broke off.',
284
+ cause: 'A file of the engine core did not download whole, or a file that a call loads the first time it runs. The server answered with an error, sent another file in its place, such as a web page, or the connection broke off.',
271
285
  example: 'E1406: the threaded engine core did not download from /assets/null3d_bg-3f9c1a2b.wasm: HTTP 404.',
272
- since: '0.1',
286
+ details: '| First use | File |\n| --- | --- |\n| a KTX2 texture | the KTX2 transcoder |\n| a glTF model | the glTF loader and its worker |\n| a mesh that plans its levels of detail | the level planner and its simplifier |\n| a glTF file with meshopt compression | the meshopt decoder |\n| a glTF file with Draco compression | the Draco decoder |\n| a color grading table | its readers |\n| an environment map | its reader |\n| a sprite or point batch | the sprite code |\n| a line batch | the line code |\n| a feature draw, instance draw or full-screen effect | that adapter |',
287
+ detailsSummary: 'the files that load on first use',
273
288
  },
274
289
  E1407: {
275
290
  title: 'Invalid hold time',
276
291
  cause: 'The ?hold= switch or the hold option of createEngine gave a hold time that is not a number of seconds from 0 to 600.',
277
292
  example: 'E1407: ?hold=1500ms is not a number of seconds from 0 to 600.',
278
- since: '0.1',
279
293
  },
280
294
  E1408: {
281
295
  title: 'Hold failed',
282
296
  cause: 'The sketch or the engine failed in hold mode, before the engine read the held frame back. A live engine logs an error in the sketch and carries on. Hold mode stops at the first one, so a test fails at once.',
283
297
  example: 'E1408: hold mode stopped at 0.75 seconds, in frame 46: TypeError: player is undefined.',
284
- since: '0.1',
285
298
  },
286
299
  E1409: {
287
300
  title: 'Invalid memory maximum',
288
301
  cause: 'The memory option of createEngine asked for a maximum that is not a whole number of MiB from 256 to 4096.',
289
302
  example: 'E1409: the memory.maximumMiB option 8192 is not a whole number of MiB from 256 to 4096.',
290
- since: '0.1',
291
303
  },
292
304
  E1410: {
293
305
  title: 'Sketch module not loaded',
294
- cause: 'The sketch module that createEngine got did not load. It did not download, or its code threw an error while the module loaded. The engine imports a module that does not load once more after a short wait, and the console notes that second import. The error comes only when the second import fails too, and it gives the reason of the first. A module whose code threw is not downloaded again, since it would throw again.',
306
+ cause: 'The sketch module that `createEngine()` got did not load: it did not download, or its code threw while the module loaded. The engine imports a module that does not load once more after a short wait, and notes that second import in the console. The error comes only when the second import fails too, and it gives the reason of the first. A module whose code threw is not downloaded again, since it would throw again.',
295
307
  example: 'E1410: the sketch module https://example.com/assets/sketch-3f9c1a2b.js did not load: Failed to fetch dynamically imported module: https://example.com/assets/sketch-3f9c1a2b.js.',
296
- since: '0.1',
297
308
  },
298
309
  E1411: {
299
310
  title: 'Asset not downloaded',
300
311
  cause: 'A loading call could not download its file. The server answered with an error, such as 404 for a missing file, or the network failed.',
301
312
  example: 'E1411: assets.loadTexture() could not download https://example.com/tex/brick.png: HTTP 404.',
302
- since: '0.1',
303
313
  },
304
314
  E1412: {
305
315
  title: 'Asset not decoded',
306
- cause: 'A loading call downloaded its file but could not read it. The browser could not decode the image, as with a format it does not support. Or the file was a KTX2 file that the engine does not load, or not valid JSON. Or it was a color grading table that the engine does not read, such as a 1D table or one with a texel missing. Or it was not an environment map that `bunx @null3d/cli assets env` writes. The message says what in the file the engine could not read, with its line where it has one. A KTX2 file also fails before it transcodes when it passes a limit. It may be wider or taller than textures.maxSize, or hold more than 256 layers. It may hold more mip levels than its size has, or texels of more than 256 MiB. A PNG or JPEG file fails before it decodes when its header gives a side longer than textures.maxSize, or 16,384 for loadImageBitmap.',
316
+ cause: 'A loading call downloaded its file but could not read it. The message says what in the file the engine could not read, with its line where it has one.',
307
317
  example: 'E1412: assets.loadTexture() could not decode https://example.com/tex/brick.tga as an image: The source image could not be decoded.',
308
- since: '0.1',
318
+ details: '- An image that the browser cannot decode, such as one in a format that it does not support.\n- A KTX2 file that the engine does not load.\n- A file that is not valid JSON.\n- A color grading table that the engine does not read, such as a 1D table or one with a texel missing.\n- A file that is not an environment map that `bunx @null3d/cli assets env` writes.\n\nA KTX2 file fails before it transcodes when it is wider or taller than `textures.maxSize`, or holds more than 256 layers. It also fails when it holds more mip levels than its size has, or texels of more than 256 MiB.\n\nA PNG, JPEG, WebP or AVIF file fails before it decodes when its header gives a side longer than `textures.maxSize`, or longer than 16,384 for `assets.loadImageBitmap()`.',
319
+ detailsSummary: 'the files that the readers refuse and their limits',
309
320
  },
310
321
  E1413: {
311
322
  title: 'Asset from another origin blocked',
312
323
  cause: "A loading call could not read a file from another origin. The browser reads such a file only when its server allows the page's origin with an Access-Control-Allow-Origin header. The browser gives no reason, so the server may also have been unreachable.",
313
324
  example: 'E1413: assets.loadTexture() could not read https://cdn.example.com/brick.png: its server did not allow this page to read it, or could not be reached (Failed to fetch).',
314
- since: '0.1',
315
325
  },
316
326
  E1414: {
317
327
  title: 'Frame not captured',
318
328
  cause: 'engine.capture() could not give an image of a frame. The engine had stopped, or the thread that draws could not read the frame back from the GPU or encode it. The thread that draws can also stop taking messages, as when a GPU call never returns: the engine then fails the request once its wait for the answer has taken longer than its limit, instead of leaving the call to wait with no end.',
319
329
  example: 'E1414: engine.capture() failed: the engine has stopped.',
320
- since: '0.1',
321
330
  },
322
331
  E1415: {
323
332
  title: 'Page thread already runs a sketch',
324
333
  cause: "createEngine() was asked to run a sketch on the page's thread while another engine still runs its sketch there. The page's copy of the engine core serves one engine at a time. This happens with sketchThread: 'main', and in the single-threaded build, which runs every sketch on the page's thread.",
325
334
  example: 'E1415: createEngine() found another engine that runs its sketch on this page, which has not stopped.',
326
- since: '0.1',
327
335
  },
328
336
  E1416: {
329
337
  title: 'glTF file not read',
330
- cause: "assets.loadGltf() downloaded a file that is not a glTF 2.0 model it can read. Its JSON or binary chunk may be broken, or an offset or a count may point past the data. A buffer or an image may be missing, or its nodes may form a loop. A skin or a clip may break glTF's rules, such as key times that fall back. Draco data may not decode, or decode to other counts than its accessors give. Or its skins and clips may move more than 1,024 nodes, which is more than one skeleton holds. Or the file would decode to more than the engine allows one file. That is 64 MiB, plus 32 bytes for each byte of the file and its buffers, up to 1 GiB. A block of meshopt data counts against that total. One array may hold at most 256 MiB. Or a clip would hold more than 4,194,304 keys, its frames times its tracks. A PNG or JPEG image inside the file may claim sides past 4,096, or its images may decode to more than 1 GiB. Or the rewriteUrl option refused an address that the file names.",
338
+ cause: 'assets.loadGltf() could not read a file as a glTF 2.0 model. The file is broken, it goes past a limit of the engine, or the rewriteUrl option refused an address that it names. The message names the part that failed.',
331
339
  example: 'E1416: assets.loadGltf() could not read https://example.com/ship.glb: accessor 3 reads 4800 bytes from bufferView 1, which holds 2400.',
332
- since: '0.2',
340
+ details: "- A broken file: a broken JSON or binary chunk, an offset or count past the data, a missing buffer or image, a node loop, a skin or clip that breaks glTF's rules, or Draco data that does not decode to the counts its accessors give.\n- Decoded data for one file: 64 MiB, plus 32 bytes for each byte of the file and its buffers, up to 1 GiB. A block of meshopt data counts too.\n- One array: 256 MiB.\n- Nodes moved by skins and clips: 1,024.\n- Keys in one clip, its frames times its tracks: 4,194,304.\n- Sides of one PNG or JPEG image: 4,096. Decoded images: 1 GiB.",
341
+ detailsSummary: 'the limits for one model file',
342
+ see: ['api/assets'],
333
343
  },
334
344
  E1417: {
335
345
  title: 'glTF feature not supported',
336
346
  cause: 'A glTF file needs an extension that the engine does not read, as its extensionsRequired list says. When a foundation add-on reads that extension, the message names the package to import, such as "Import @null3d/splats, which reads it", and that add-on registers the handler that loads the file. Or a call asked a model for something it cannot give, such as instance batches of a model with no meshes.',
337
347
  example: 'E1417: assets.loadGltf() cannot load https://example.com/ship.glb: it requires KHR_materials_variants, which the engine does not read.',
338
- since: '0.2',
339
348
  },
340
349
  E1418: {
341
350
  title: 'WebAssembly blocked by the page',
342
351
  cause: "The page's Content-Security-Policy does not allow WebAssembly, so the engine core, the KTX2 transcoder, the meshopt decoder or the Draco decoder could not compile. A policy allows it only when its script-src, or its default-src without a script-src, holds 'wasm-unsafe-eval'.",
343
352
  example: "E1418: the page's Content-Security-Policy does not let the threaded engine core compile: WebAssembly.compileStreaming(): Refused to compile or instantiate WebAssembly module.",
344
- since: '0.2',
353
+ see: ['getting-started/hosting'],
345
354
  },
346
355
  E1419: {
347
356
  title: 'Canvas held by another engine',
348
- cause: 'createEngine() got a canvas that another engine still draws on, or a canvas whose drawing thread ended, so no engine can draw on it again. That thread ends when it fails, or when the canvas leaves the page. It also ends when the page goes away, or when the browser refuses memory for a new engine. A canvas serves one engine at a time. After destroy(), a new engine can start on the same canvas.',
357
+ cause: '`createEngine()` got a canvas that another engine still draws on, or a canvas whose drawing thread ended, so no engine can draw on it again. That thread ends when it fails, when the canvas leaves the page, or when the browser refuses memory for a new engine. A canvas serves one engine at a time, but after `destroy()` a new engine can start on it.',
349
358
  example: 'E1419: createEngine() got a canvas that another engine draws on, which has not stopped.',
350
- since: '0.2',
351
359
  },
352
360
  E1420: {
353
361
  title: 'Engine stopped',
354
- cause: 'Sketch code called the engine after the engine stopped, from a timer, a promise or an event handler that outlived destroy(). The call did nothing.',
362
+ cause: 'Sketch code called the engine after the engine stopped, from a timer, a promise or an event handler that outlived destroy(). The call did nothing. engine.firstFrame rejects with it too when the page destroys the engine before its first frame.',
355
363
  example: 'E1420: a call reached the engine after it stopped.',
356
- since: '0.2',
357
364
  },
358
365
  E1421: {
359
366
  title: 'Unknown feature to preload',
360
367
  cause: "createEngine()'s preload option names a feature whose shaders the engine does not have. The features are ao, background, bloom, coat_sheen, coverage, cutout, dof, effect_groups, hash, lines, lod_fade, morph, occlusion, row_values, skinning, sky, sprites, transmission and views, and instance_index and texcoords for the engine's own tests.",
361
368
  example: "E1421: createEngine() got 'skining' in preload. The features are ao, background, bloom, coat_sheen, coverage, cutout, dof, effect_groups, hash, instance_index, lines, lod_fade, morph, occlusion, row_values, skinning, sky, sprites, texcoords, transmission, views.",
362
- since: '0.2',
363
369
  },
364
370
  E1422: {
365
371
  title: 'Engine file blocked by the page',
366
372
  cause: "The engine's files come from another origin than the page, such as a CDN, and the page's Content-Security-Policy blocks one of them. The engine starts each worker from a blob: address that imports the worker's script from that origin, and downloads its .wasm files from there. So the policy's worker-src must allow blob: and the other origin, and its script-src and connect-src must allow the other origin too. Firefox checks the modules that a worker imports against worker-src.",
367
373
  example: "E1422: the page's Content-Security-Policy blocks the job-0 worker: its worker-src does not allow blob:, which the engine starts its workers from when its files come from another origin.",
368
- since: '0.2',
374
+ see: ['getting-started/hosting'],
369
375
  },
370
376
  E1423: {
371
377
  title: 'Engine file without CORS',
372
378
  cause: "The engine's files come from another origin than the page, such as a CDN. One of them came without a CORS header, or did not download. A page loads a module or a .wasm file from another origin only when the response carries Access-Control-Allow-Origin.",
373
379
  example: 'E1423: the KTX2 transcoder from https://cdn.example.com came without a CORS header, or did not download: Failed to fetch.',
374
- since: '0.2',
380
+ see: ['getting-started/hosting'],
375
381
  },
376
382
  E1424: {
377
383
  title: 'Custom shader builds not downloaded',
378
- cause: "A set of a custom shader's builds did not download. The null3D Vite plugin builds each custom material, effect and tone curve for every GPU path, and puts the builds in files of their own beside the sketch's files. A material's files are named material-*.js: one for each GPU path, each kind of device, and the builds that skin. An effect's and a tone curve's are named effect-*.js and curve-*.js: one for each GPU path. A page downloads its device's file when the sketch first uses the shader, and another material file when a pipeline needs it, such as the builds that skin for the first skinned mesh. The server answered with an error or sent another file in its place, such as a web page, or the connection broke off. The engine then draws no new frames.",
384
+ cause: "A file that holds a custom shader's builds did not download, so the engine draws no new frames. The server answered with an error, sent another file in its place, such as a web page, or the connection broke off.",
379
385
  example: 'E1424: the builds of a custom shader did not load: Failed to fetch dynamically imported module: https://example.com/assets/material-glsl-3-4c1d2e9a5b6f7081-Bx3kQ9.js.',
380
- since: '0.2',
386
+ details: "The null3D Vite plugin builds each custom material, effect and tone curve for every GPU path. It puts the builds in files of their own beside the sketch's files.\n\nA material's files are named material-*.js: one for each GPU path and each set of builds that the device fixes. Those sets hold the builds that tone map or skin. An effect's and a tone curve's files are named effect-*.js and curve-*.js: one for each GPU path.\n\nA page downloads its device's file when the sketch first uses the shader. It downloads another material file when a pipeline needs one, such as the builds that skin for the first skinned mesh.",
387
+ detailsSummary: 'the shader build files',
381
388
  },
382
389
  E1425: {
383
390
  title: 'Pointer lock refused',
384
391
  cause: 'engine.requestPointerLock() asked the browser to lock the pointer to the canvas, and the browser refused or ended the lock before it began. Browsers lock the pointer only right after the user clicks or presses a key. They never lock it on phones or in some frames, and they refuse for a moment after the user pressed Esc.',
385
392
  example: 'E1425: the browser refused the pointer lock: NotAllowedError.',
386
- since: '0.2',
387
393
  },
388
394
  E1426: {
389
395
  title: 'Pointer lock with input off',
390
396
  cause: "engine.requestPointerLock() asked for the pointer lock on an engine started with input: false. The lock is part of the engine's input: the sketch reads the mouse's movement through the engine's listeners, which that option turns off. So the engine takes no lock, and leaves the lock to the code that records the page's input.",
391
397
  example: 'E1426: engine.requestPointerLock() was called on an engine started with input: false, which reads no pointer movement.',
392
- since: '0.3',
393
398
  },
394
399
  E1430: {
395
400
  title: 'Too many reflection probes',
396
401
  cause: "scene.createReflectionProbe() would make a 17th reflection probe, and a scene has at most 16. Or the scene's first probe needs 6 views of the scene for its captures. The scene and its passes share 32 views, and its passes left fewer than 6.",
397
402
  example: 'E1430: scene.createReflectionProbe() would make reflection probe 17; a scene has at most 16.',
398
- since: '0.2',
399
403
  },
400
404
  E1431: {
401
405
  title: "Area lights' tables missing",
402
406
  cause: "The sketch made a rectangle or tube light, and the file of the area lights' fitted tables did not download. The engine's package ships the file, area-light-tables.bin, beside its code, and the engine downloads it with the first area light. Until the file arrives, area lights give no light. A server or a build that leaves out the file, or a Content-Security-Policy whose connect-src blocks its address, stops the download.",
403
407
  example: "E1431: the area lights' tables did not load from https://example.com/assets/area-light-tables-Zx8c_Vb1.bin: HTTP 404",
404
- since: '0.2',
405
408
  },
406
409
  E1432: {
407
410
  title: 'Add-on for another engine version',
408
411
  cause: 'An add-on package loaded beside an engine of another version. Each add-on ships in step with the engine and pins the engine version that it was built for, so a page may mix no two versions. The message names the add-on, its version and the engine version.',
409
412
  example: 'E1432: @null3d/controls 0.1.0 was built for null3D 0.1.0, and this page runs null3D 0.2.0.',
410
- since: '0.3',
411
413
  },
412
414
  E1433: {
413
415
  title: 'Add-on for another plugin interface',
414
416
  cause: "An add-on from another developer loaded against a plugin interface that its declared range does not include, or the add-on declares no range of whole versions. An outside add-on declares the plugin interface versions that it works with, because it ships on its own schedule. The engine's own add-ons pin the engine version instead. The message names the add-on, the range it declares and this engine's plugin interface version.",
415
417
  example: 'E1433: @acme/splats was built for plugin interface 1 to 2, and this page has plugin interface 3 (null3D 0.3.0).',
416
- since: '0.3',
417
418
  },
418
419
  E1434: {
419
420
  title: 'Baked light file not read',
420
- cause: "assets.loadLightProbeGrid() or assets.loadLightMap() downloaded a file that is not a baked light file that this engine reads. The file may not be JSON, or its format marker may be missing. Its version may not be the one that this engine reads, or its kind may not be the one that the call takes. A probe grid may have counts or spacing that a grid cannot take. Its coefficients may not hold 12 floats for each probe in the counts' product, or its validity or skyVisibility may not hold one float from 0 to 1 for each probe. A light map may have a width or height that a texture cannot take, or an encoding other than rgb8 or rgba16float. Its radiance or its direction may not hold the bytes that its size needs, which a cut-short file shows. The message names the fault.",
421
+ cause: 'assets.loadLightProbeGrid() or assets.loadLightMap() downloaded a file that this engine cannot read as baked light data. The file may not be JSON, may have the wrong format marker, version or kind, or may have a field whose size does not match the counts or size that the file gives. The message names the fault.',
421
422
  example: 'E1434: assets.loadLightProbeGrid() could not read https://example.com/light/grid.json: its version is 2, and this engine reads version 1.',
422
- since: '0.3',
423
+ see: ['guides/baked-light-data'],
423
424
  },
424
425
  E1435: {
425
426
  title: 'Recording not read',
426
427
  cause: 'createEngine() could not read the recording that ?replay= names, or the recording does not match this page. The file may not be a null3D recording, may come from another version of the format, may be cut short, or may name keys or fixed steps that this engine does not have. The message names the fault.',
427
428
  example: 'E1435: createEngine() could not read the recording https://example.com/bug.n3dr: the file is not a null3D recording: it does not start with the format marker. Save the recording again, or ask for a new one.',
428
- since: '0.3',
429
429
  },
430
430
  E1436: {
431
431
  title: 'Pick lost with the GPU',
432
432
  cause: 'A pick waited for the GPU to copy its pixel back when the browser took the GPU away. The engine started a new device, but the frame that recorded the pick drew on the lost device, so its read never lands. The pick is rejected rather than repeated on the new device.',
433
433
  example: 'E1436: pick() was waiting for its read when the GPU was lost.',
434
- since: '0.3',
435
434
  },
436
435
  E1437: {
437
436
  title: 'Chrome for Testing refused',
438
- cause: "The null3D command-line tool did not install Chrome for Testing, the browser that draws on the computer's GPU. The archive it downloaded does not have the SHA-256 hash that the tool records for the pinned version on this platform. Or the tool has no build, and so no hash, for this platform. The tool deletes a refused archive before it unpacks it, and never runs it.",
437
+ cause: "The null3D command-line tool did not install Chrome for Testing, the browser that draws on the computer's GPU. The archive does not have the SHA-256 hash that the tool records for the pinned version, or the tool has no build for this platform. The tool deletes a refused archive before it unpacks it, and the command then draws with the installed Google Chrome.",
439
438
  example: 'E1437: the Chrome for Testing 156.0.8078.80 archive for mac-arm64 has the SHA-256 hash 5d41402abc4b2a76b9719d911017c592ae2f4d3c1a0d9b7e6c9a3f5b8e7d2c10, not 8bc590d1b1acac042a000234c768f31830f25a3983a83ed5e067114c87c4cad1, so the tool deleted it.',
440
- since: '0.3',
441
439
  },
442
440
  E1501: {
443
441
  title: 'Render space full',
444
- cause: 'The scene needs more room than the renderer has. The message names the full part: the material table, the upload space, the culling pass, skinning on WebGPU, the draw list, one GPU buffer, or the shadow atlas. On WebGPU the culling pass covers 2,097,152 objects and instance rows on every device, and more on devices with larger GPU buffers. On WebGL2 the number follows the largest texture the device allows. The number for the device is in engine.capabilities.maxInstances. On WebGPU, skinned meshes keep their skinned vertices in at most 8 GPU buffers. Those hold 1 GiB in all on most devices. Skinned meshes fill at most 32 mesh buffers. The draw list grows with the scene, so it fills only when memory runs out. A frame that fails draws nothing, and the canvas keeps the last whole frame.',
442
+ cause: 'The scene needs more room than the renderer has. The message names the full part, such as the material table, the texture table, the culling pass or the shadow atlas. A frame that fails draws nothing, and the canvas keeps the last whole frame.',
445
443
  example: 'E1501: materials.standard() failed: the material table is full.',
446
- since: '0.1',
444
+ details: "| Full part | Limit |\n| --- | --- |\n| Material table | The message says it is full. |\n| Draw list | The megabytes that its commands may take, which it reaches only when memory runs out. |\n| Culling pass | 2,097,152 objects and instance rows on WebGPU, and more on devices with larger GPU buffers. On WebGL2 the number follows the largest texture. `engine.capabilities.maxInstances` gives the device's number. |\n| Skinning on WebGPU | 8 GPU buffers, 1 GiB in all on most devices, and 32 mesh pages. |\n| Views | 32, the camera's included. |\n| Shadow atlas | 1,024 MB. |\n| Texture table | The message says it is full. |\n| Upload space | The room that the frame sets aside. |\n| One GPU buffer | The bytes that one GPU buffer may take on the device. |\n| Rectangle lights | The most lights that show images at once. |\n| Light image size | The texels a side that an image takes. |",
445
+ detailsSummary: 'each full part and its limit',
446
+ fixCases: [
447
+ 'For the culling pass: every row of a batch counts toward the limit, active or not, so size each batch for the rows it uses.',
448
+ 'For skinned characters on WebGPU: each copy skins its own vertices, even when copies share a mesh.',
449
+ 'For the shadow atlas: name a smaller `heroTileSize` or fewer `shadowTiles`.',
450
+ 'For the views: destroy views that no longer draw.',
451
+ 'For the texture table: use fewer textures, and share them.',
452
+ 'For the upload space, the draw list or one GPU buffer: make that part smaller. The message gives the megabytes or bytes that it may take.',
453
+ 'For rectangle lights or a light image: show images on fewer lights, or use a smaller image.',
454
+ ],
447
455
  },
448
456
  E1502: {
449
457
  title: 'Pass input missing',
450
458
  cause: "A render pass uses a target or buffer that no pass creates, or reads one that no pass running in the frame writes. The render graph checks the sketch's passes when render.addPass() or render.removePass() changes them, and every pass before the frame draws.",
451
459
  example: 'E1502: the pass "Final" reads "sceneColor", but no pass that runs this frame writes it.',
452
- since: '0.1',
453
460
  },
454
461
  E1503: {
455
462
  title: 'Target created twice',
456
463
  cause: "Two render passes create the same target, or a pass creates a target that the render graph keeps between frames. A sketch's pass whose texture has the name of a target of the engine's own passes does this. Each target has one creator, which sets its format and size.",
457
464
  example: 'E1503: both "Opaque" and "Sky" create "sceneColor".',
458
- since: '0.1',
459
465
  },
460
466
  E1504: {
461
467
  title: 'Render pass cycle',
462
468
  cause: "Render passes need each other in a loop, so no order runs each pass after the passes whose output it reads. A sketch's pass that reads its own texture makes such a loop.",
463
469
  example: 'E1504: the passes form a cycle: "Tint" runs after "Glow", and "Glow" after "Tint".',
464
- since: '0.1',
465
470
  },
466
471
  E1505: {
467
472
  title: 'Pass targets do not match',
468
- cause: "A render pass draws into targets that one GPU render pass cannot hold together. A target can have another size than the pass, or the targets can have different sample counts. The pass can also draw into two depth targets, into a whole texture array instead of one layer, or into no target. It can draw into more than four color targets, or into color targets of more than 32 bytes per sample, which some devices cannot hold. A resolve pass fails the same way when it cannot resolve its target into the canvas. That target must be multisampled, in the canvas's format and size, and read by no other running pass.",
473
+ cause: 'A render pass draws into targets that one GPU render pass cannot hold together. A target can have another size or sample count than the pass, or the pass can name no target.',
469
474
  example: 'E1505: the pass "Blur" draws at half size into "sceneColor", which is full size.',
470
- since: '0.1',
475
+ cases: [
476
+ 'A target has another size than the pass.',
477
+ 'The targets have different sample counts.',
478
+ 'The pass draws into two depth targets.',
479
+ 'The pass draws into a whole texture array instead of one layer, or into a layer that the target does not have.',
480
+ 'The pass names no target.',
481
+ 'The pass draws into more than four color targets, or into color targets of more than 32 bytes per sample in all.',
482
+ "A resolve pass cannot resolve its target into the canvas. The target is not multisampled, not in the canvas's format and size, or read by another running pass.",
483
+ ],
471
484
  },
472
485
  E1506: {
473
486
  title: 'Feature draw after the first frame',
474
487
  cause: 'A draw whose instance count the GPU writes was created after the engine recorded its first frame, on a device that draws its scene directly. The direct path counts every draw on the CPU and keeps no indirect draw, so the frame has nowhere to copy the count. The frame records no draw.',
475
488
  example: 'E1506: the frame failed: a draw whose instance count the GPU writes arrived after the first frame, and this device draws directly.',
476
- since: '0.3',
477
489
  },
478
490
  };
479
491
  /** Every code's docs text with its fix, in code order. */