@null3d/engine 0.1.0 → 0.1.2

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 (388) hide show
  1. package/dist/wasm/single/null3d.js +10 -8
  2. package/dist/wasm/single/null3d_bg.wasm +0 -0
  3. package/dist/wasm/threaded/null3d.js +10 -8
  4. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  5. package/docs/api/animation.md +96 -24
  6. package/docs/api/assets.md +99 -29
  7. package/docs/api/cameras.md +38 -7
  8. package/docs/api/controls.md +47 -23
  9. package/docs/api/debug.md +105 -35
  10. package/docs/api/engine.md +108 -32
  11. package/docs/api/feature-draws.md +21 -15
  12. package/docs/api/feature-effects.md +8 -8
  13. package/docs/api/feature-instances.md +68 -17
  14. package/docs/api/features.md +68 -37
  15. package/docs/api/geometry.md +83 -14
  16. package/docs/api/grass.md +55 -13
  17. package/docs/api/impostors.md +92 -50
  18. package/docs/api/input.md +22 -9
  19. package/docs/api/lights.md +67 -16
  20. package/docs/api/lines.md +38 -13
  21. package/docs/api/materials.md +187 -59
  22. package/docs/api/math.md +6 -6
  23. package/docs/api/objects.md +40 -15
  24. package/docs/api/page.md +58 -7
  25. package/docs/api/particles.md +36 -11
  26. package/docs/api/points.md +18 -8
  27. package/docs/api/post.md +57 -23
  28. package/docs/api/quality.md +36 -16
  29. package/docs/api/raycast.md +57 -24
  30. package/docs/api/reference/animation.md +1 -2
  31. package/docs/api/reference/assets.md +7 -4
  32. package/docs/api/reference/cameras.md +3 -2
  33. package/docs/api/reference/controls.md +59 -2
  34. package/docs/api/reference/debug.md +58 -6
  35. package/docs/api/reference/engine.md +40 -10
  36. package/docs/api/reference/feature-draws.md +3 -4
  37. package/docs/api/reference/feature-effects.md +2 -3
  38. package/docs/api/reference/feature-instances.md +5 -4
  39. package/docs/api/reference/features.md +7 -4
  40. package/docs/api/reference/geometry.md +132 -21
  41. package/docs/api/reference/grass.md +62 -2
  42. package/docs/api/reference/impostors.md +120 -16
  43. package/docs/api/reference/input.md +1 -2
  44. package/docs/api/reference/lights.md +4 -3
  45. package/docs/api/reference/lines.md +3 -4
  46. package/docs/api/reference/materials.md +7 -6
  47. package/docs/api/reference/math.md +13 -2
  48. package/docs/api/reference/objects.md +2 -3
  49. package/docs/api/reference/particles.md +31 -6
  50. package/docs/api/reference/points.md +2 -3
  51. package/docs/api/reference/post.md +4 -3
  52. package/docs/api/reference/quality.md +1 -2
  53. package/docs/api/reference/raycast.md +1 -2
  54. package/docs/api/reference/render.md +4 -3
  55. package/docs/api/reference/scene.md +24 -5
  56. package/docs/api/reference/sketch.md +11 -11
  57. package/docs/api/reference/sound.md +33 -2
  58. package/docs/api/reference/splats.md +42 -3
  59. package/docs/api/reference/sprites.md +2 -3
  60. package/docs/api/reference/tasks.md +16 -3
  61. package/docs/api/reference/terrain.md +26 -5
  62. package/docs/api/reference/textures.md +1 -2
  63. package/docs/api/reference/three-compat.md +18 -7
  64. package/docs/api/reference/time.md +1 -2
  65. package/docs/api/reference/ui.md +10 -7
  66. package/docs/api/reference/vertex-draws.md +2 -3
  67. package/docs/api/reference/water.md +78 -5
  68. package/docs/api/reference/wind.md +15 -2
  69. package/docs/api/render.md +67 -25
  70. package/docs/api/scene.md +129 -36
  71. package/docs/api/sketch.md +45 -19
  72. package/docs/api/sound.md +48 -12
  73. package/docs/api/splats.md +42 -15
  74. package/docs/api/sprites.md +8 -6
  75. package/docs/api/tasks.md +31 -22
  76. package/docs/api/terrain.md +44 -12
  77. package/docs/api/textures.md +61 -12
  78. package/docs/api/three-compat.md +15 -7
  79. package/docs/api/time.md +3 -5
  80. package/docs/api/ui.md +18 -10
  81. package/docs/api/vertex-draws.md +13 -12
  82. package/docs/api/water.md +111 -67
  83. package/docs/api/wind.md +61 -15
  84. package/docs/cli/null3d.md +90 -15
  85. package/docs/concepts/architecture.md +69 -23
  86. package/docs/concepts/assets.md +57 -16
  87. package/docs/concepts/backends.md +68 -24
  88. package/docs/concepts/color-management.md +42 -13
  89. package/docs/concepts/culling.md +68 -47
  90. package/docs/concepts/handles.md +14 -5
  91. package/docs/concepts/instances.md +72 -23
  92. package/docs/concepts/large-worlds.md +17 -7
  93. package/docs/concepts/lighting.md +117 -44
  94. package/docs/concepts/lod.md +128 -33
  95. package/docs/concepts/materials.md +43 -12
  96. package/docs/concepts/particle-buffer.md +48 -35
  97. package/docs/concepts/post-processing.md +77 -14
  98. package/docs/concepts/quality-preset-tables.md +3 -2
  99. package/docs/concepts/quality-presets.md +122 -39
  100. package/docs/concepts/render-graph.md +56 -21
  101. package/docs/concepts/render-layers.md +9 -5
  102. package/docs/concepts/shadows.md +96 -25
  103. package/docs/concepts/static-dynamic.md +22 -7
  104. package/docs/cookbook/index.md +163 -119
  105. package/docs/data/threejs-mapping.json +301 -340
  106. package/docs/errors/E1101.md +23 -5
  107. package/docs/errors/E1102.md +11 -3
  108. package/docs/errors/E1103.md +11 -3
  109. package/docs/errors/E1104.md +11 -3
  110. package/docs/errors/E1105.md +13 -5
  111. package/docs/errors/E1106.md +11 -3
  112. package/docs/errors/E1107.md +15 -5
  113. package/docs/errors/E1108.md +11 -3
  114. package/docs/errors/E1109.md +32 -6
  115. package/docs/errors/E1110.md +23 -5
  116. package/docs/errors/E1111.md +11 -3
  117. package/docs/errors/E1112.md +11 -3
  118. package/docs/errors/E1203.md +12 -4
  119. package/docs/errors/E1204.md +11 -3
  120. package/docs/errors/E1205.md +11 -3
  121. package/docs/errors/E1206.md +28 -6
  122. package/docs/errors/E1207.md +11 -3
  123. package/docs/errors/E1208.md +12 -3
  124. package/docs/errors/E1209.md +11 -3
  125. package/docs/errors/E1213.md +27 -5
  126. package/docs/errors/E1214.md +11 -3
  127. package/docs/errors/E1215.md +31 -6
  128. package/docs/errors/E1216.md +31 -6
  129. package/docs/errors/E1217.md +29 -6
  130. package/docs/errors/E1218.md +22 -6
  131. package/docs/errors/E1219.md +11 -3
  132. package/docs/errors/E1220.md +24 -5
  133. package/docs/errors/E1221.md +24 -5
  134. package/docs/errors/E1222.md +11 -3
  135. package/docs/errors/E1223.md +39 -6
  136. package/docs/errors/E1224.md +11 -3
  137. package/docs/errors/E1225.md +11 -3
  138. package/docs/errors/E1301.md +11 -3
  139. package/docs/errors/E1302.md +11 -3
  140. package/docs/errors/E1303.md +11 -3
  141. package/docs/errors/E1304.md +11 -3
  142. package/docs/errors/E1305.md +13 -3
  143. package/docs/errors/E1306.md +11 -3
  144. package/docs/errors/E1307.md +23 -6
  145. package/docs/errors/E1308.md +31 -0
  146. package/docs/errors/E1401.md +11 -3
  147. package/docs/errors/E1402.md +13 -5
  148. package/docs/errors/E1403.md +11 -3
  149. package/docs/errors/E1404.md +13 -3
  150. package/docs/errors/E1405.md +15 -4
  151. package/docs/errors/E1406.md +31 -5
  152. package/docs/errors/E1407.md +11 -3
  153. package/docs/errors/E1408.md +11 -3
  154. package/docs/errors/E1409.md +11 -3
  155. package/docs/errors/E1410.md +13 -5
  156. package/docs/errors/E1411.md +11 -3
  157. package/docs/errors/E1412.md +29 -6
  158. package/docs/errors/E1413.md +11 -3
  159. package/docs/errors/E1414.md +11 -3
  160. package/docs/errors/E1415.md +11 -3
  161. package/docs/errors/E1416.md +27 -6
  162. package/docs/errors/E1417.md +11 -3
  163. package/docs/errors/E1418.md +12 -3
  164. package/docs/errors/E1419.md +13 -5
  165. package/docs/errors/E1420.md +11 -3
  166. package/docs/errors/E1421.md +11 -3
  167. package/docs/errors/E1422.md +12 -3
  168. package/docs/errors/E1423.md +12 -3
  169. package/docs/errors/E1424.md +24 -5
  170. package/docs/errors/E1425.md +11 -3
  171. package/docs/errors/E1426.md +11 -3
  172. package/docs/errors/E1430.md +11 -3
  173. package/docs/errors/E1431.md +11 -3
  174. package/docs/errors/E1432.md +11 -3
  175. package/docs/errors/E1433.md +11 -3
  176. package/docs/errors/E1434.md +15 -6
  177. package/docs/errors/E1435.md +11 -3
  178. package/docs/errors/E1436.md +11 -3
  179. package/docs/errors/E1437.md +14 -6
  180. package/docs/errors/E1501.md +41 -6
  181. package/docs/errors/E1502.md +13 -3
  182. package/docs/errors/E1503.md +11 -3
  183. package/docs/errors/E1504.md +11 -3
  184. package/docs/errors/E1505.md +23 -5
  185. package/docs/errors/E1506.md +11 -3
  186. package/docs/errors/index.md +53 -29
  187. package/docs/getting-started/cdn.md +15 -9
  188. package/docs/getting-started/first-scene.md +20 -12
  189. package/docs/getting-started/hosting.md +113 -63
  190. package/docs/getting-started/install.md +39 -24
  191. package/docs/getting-started/network-use.md +31 -21
  192. package/docs/getting-started/project-structure.md +20 -8
  193. package/docs/getting-started/third-party-notices.md +6 -10
  194. package/docs/guides/accessibility.md +4 -4
  195. package/docs/guides/add-ons.md +83 -13
  196. package/docs/guides/agents.md +13 -14
  197. package/docs/guides/assets-pipeline.md +294 -72
  198. package/docs/guides/audio.md +17 -15
  199. package/docs/guides/baked-light-data.md +44 -23
  200. package/docs/guides/car-paint.md +37 -31
  201. package/docs/guides/content-pages.md +86 -29
  202. package/docs/guides/custom-passes.md +59 -17
  203. package/docs/guides/custom-shaders.md +54 -37
  204. package/docs/guides/debugging.md +31 -41
  205. package/docs/guides/deploying.md +10 -27
  206. package/docs/guides/deterministic-simulation.md +23 -16
  207. package/docs/guides/first-use-shaders.md +83 -45
  208. package/docs/guides/lens-kit.md +29 -26
  209. package/docs/guides/loading-screens.md +74 -30
  210. package/docs/guides/multiple-views.md +22 -11
  211. package/docs/guides/performance.md +188 -37
  212. package/docs/guides/phones.md +71 -19
  213. package/docs/guides/physics.md +6 -10
  214. package/docs/guides/screens.md +41 -29
  215. package/docs/guides/start-time.md +126 -85
  216. package/docs/guides/testing.md +137 -98
  217. package/docs/guides/ui-overlays.md +17 -12
  218. package/docs/guides/video-textures.md +14 -13
  219. package/docs/images/api/animation/character.webp +0 -0
  220. package/docs/images/api/animation/look-at-ring.webp +0 -0
  221. package/docs/images/api/animation/morph-tulips.webp +0 -0
  222. package/docs/images/api/animation/skeleton-lines.webp +0 -0
  223. package/docs/images/api/controls/gizmo-handles.webp +0 -0
  224. package/docs/images/api/controls/walk-and-fly.webp +0 -0
  225. package/docs/images/api/debug/debug-shapes.webp +0 -0
  226. package/docs/images/api/debug/levels-view.webp +0 -0
  227. package/docs/images/api/engine/transparent-canvas.webp +0 -0
  228. package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
  229. package/docs/images/api/feature-instances/compute-instances.webp +0 -0
  230. package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
  231. package/docs/images/api/geometry/extra-shapes.webp +0 -0
  232. package/docs/images/api/geometry/generators.webp +0 -0
  233. package/docs/images/api/geometry/mesh-arrays.webp +0 -0
  234. package/docs/images/api/geometry/vertex-updates.webp +0 -0
  235. package/docs/images/api/grass/grass-grove.webp +0 -0
  236. package/docs/images/api/grass/grass-presets.webp +0 -0
  237. package/docs/images/api/grass/grass-shadow.webp +0 -0
  238. package/docs/images/api/impostors/impostor-handover.webp +0 -0
  239. package/docs/images/api/impostors/impostor-shadow.webp +0 -0
  240. package/docs/images/api/impostors/impostors-forest.webp +0 -0
  241. package/docs/images/api/lights/spot-cookies.webp +0 -0
  242. package/docs/images/api/lines/lines-lit.webp +0 -0
  243. package/docs/images/api/lines/lines-widths.webp +0 -0
  244. package/docs/images/api/materials/coat-and-sheen.webp +0 -0
  245. package/docs/images/api/materials/decals.webp +0 -0
  246. package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
  247. package/docs/images/api/materials/relief.webp +0 -0
  248. package/docs/images/api/materials/shader-inputs.webp +0 -0
  249. package/docs/images/api/materials/standard-grid.webp +0 -0
  250. package/docs/images/api/materials/subsurface.webp +0 -0
  251. package/docs/images/api/materials/translucency.webp +0 -0
  252. package/docs/images/api/objects/objects-turntable.webp +0 -0
  253. package/docs/images/api/particles/campfire.webp +0 -0
  254. package/docs/images/api/points/galaxy.webp +0 -0
  255. package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
  256. package/docs/images/api/render/fullscreen-glow.webp +0 -0
  257. package/docs/images/api/render/reflection-mirror.webp +0 -0
  258. package/docs/images/api/render/security-camera.webp +0 -0
  259. package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
  260. package/docs/images/api/sound/sound-demo.webp +0 -0
  261. package/docs/images/api/splats/splats-demo.webp +0 -0
  262. package/docs/images/api/sprites/sprites-lines.webp +0 -0
  263. package/docs/images/api/terrain/terrain-demo.webp +0 -0
  264. package/docs/images/api/textures/canvas-screen.webp +0 -0
  265. package/docs/images/api/textures/mipmaps.webp +0 -0
  266. package/docs/images/api/vertex-draws/rain.webp +0 -0
  267. package/docs/images/api/water/ocean.webp +0 -0
  268. package/docs/images/api/water/water-demo.webp +0 -0
  269. package/docs/images/api/water/water-rain.webp +0 -0
  270. package/docs/images/api/water/waterfall.webp +0 -0
  271. package/docs/images/concepts/assets/gltf-model.webp +0 -0
  272. package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
  273. package/docs/images/concepts/culling/far-from-origin.webp +0 -0
  274. package/docs/images/concepts/instances/instances.webp +0 -0
  275. package/docs/images/concepts/instances/per-row-colors.webp +0 -0
  276. package/docs/images/concepts/large-worlds/large-world.webp +0 -0
  277. package/docs/images/concepts/lighting/area-lights.webp +0 -0
  278. package/docs/images/concepts/lighting/atmosphere.webp +0 -0
  279. package/docs/images/concepts/lighting/environment.webp +0 -0
  280. package/docs/images/concepts/lighting/light-shafts.webp +0 -0
  281. package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
  282. package/docs/images/concepts/lod/forest.webp +0 -0
  283. package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
  284. package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
  285. package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
  286. package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
  287. package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
  288. package/docs/images/concepts/post-processing/sharpen.webp +0 -0
  289. package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
  290. package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
  291. package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
  292. package/docs/images/cookbook/index/picking.webp +0 -0
  293. package/docs/images/cookbook/index/time-of-day.webp +0 -0
  294. package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
  295. package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
  296. package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
  297. package/docs/images/guides/multiple-views/split-screen.webp +0 -0
  298. package/docs/images/guides/performance/overdraw-view.webp +0 -0
  299. package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
  300. package/docs/images/index/showcase-island.webp +0 -0
  301. package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
  302. package/docs/images/shaders/builtins/builtins.webp +0 -0
  303. package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
  304. package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
  305. package/docs/images/shots.json +2231 -0
  306. package/docs/index.md +14 -23
  307. package/docs/moves.json +1 -0
  308. package/docs/nav.json +300 -0
  309. package/docs/pages.md +230 -212
  310. package/docs/porting/react-three-fiber.md +2 -6
  311. package/docs/porting/threejs-loop-and-threads.md +1 -5
  312. package/docs/porting/threejs-mapping.md +1248 -234
  313. package/docs/porting/threejs-materials.md +10 -5
  314. package/docs/porting/threejs-overview.md +26 -6
  315. package/docs/porting/threejs-postprocessing.md +2 -6
  316. package/docs/porting/threejs-shaders.md +16 -14
  317. package/docs/porting/threejs-unsupported.md +6 -6
  318. package/docs/porting/verification.md +0 -4
  319. package/docs/shaders/builtins.md +15 -4
  320. package/docs/shaders/library.md +9 -6
  321. package/docs/shaders/surface-functions.md +51 -16
  322. package/docs/shaders/wgsl-rules.md +12 -5
  323. package/lib/debug/debug.d.ts +2 -2
  324. package/lib/debug/draw.d.ts +2 -2
  325. package/lib/debug/draw.js +8 -4
  326. package/lib/debug/overlay-look.d.ts +6 -0
  327. package/lib/debug/overlay-look.js +29 -7
  328. package/lib/debug/overlay.js +15 -11
  329. package/lib/debug/stats-options.d.ts +13 -0
  330. package/lib/debug/stats-panel.d.ts +21 -6
  331. package/lib/debug/stats-panel.js +80 -13
  332. package/lib/errors/codes.d.ts +17 -3
  333. package/lib/errors/codes.js +116 -105
  334. package/lib/errors/engine-error.js +1 -1
  335. package/lib/errors/fixes.d.ts +1 -0
  336. package/lib/errors/fixes.js +19 -18
  337. package/lib/generated/shader-permutations.d.ts +6 -0
  338. package/lib/generated/shader-permutations.js +6 -0
  339. package/lib/gpu/variants.d.ts +8 -2
  340. package/lib/gpu/variants.js +39 -7
  341. package/lib/gpu/webgl2/programs.js +1 -1
  342. package/lib/gpu/webgpu/pipelines.js +13 -13
  343. package/lib/index.d.ts +1 -1
  344. package/lib/page/capabilities.d.ts +1 -1
  345. package/lib/page/engine.d.ts +29 -7
  346. package/lib/page/engine.js +79 -7
  347. package/lib/page/label-loop.js +9 -4
  348. package/lib/page/stats-switch.js +2 -0
  349. package/lib/page/switches.d.ts +6 -4
  350. package/lib/page/switches.js +20 -4
  351. package/lib/scene/baked-light.d.ts +2 -2
  352. package/lib/scene/fake-call-values.js +2 -2
  353. package/lib/scene/frame-cameras.d.ts +16 -4
  354. package/lib/scene/frame-cameras.js +28 -10
  355. package/lib/scene/gltf.d.ts +1 -1
  356. package/lib/scene/level-rule.d.ts +6 -5
  357. package/lib/scene/level-rule.js +2 -2
  358. package/lib/scene/particles.d.ts +7 -3
  359. package/lib/scene/particles.js +3 -1
  360. package/lib/scene/post.d.ts +3 -2
  361. package/lib/scene/resources.d.ts +15 -9
  362. package/lib/scene/scene.d.ts +18 -2
  363. package/lib/scene/scene.js +47 -5
  364. package/lib/scene/time-of-day.d.ts +10 -5
  365. package/lib/scene/time-of-day.js +11 -7
  366. package/lib/shader-artifact.json +1 -1
  367. package/lib/shared/labels.d.ts +5 -2
  368. package/lib/shared/labels.js +5 -2
  369. package/lib/shared/permutation-words.d.ts +8 -0
  370. package/lib/shared/permutation-words.js +14 -0
  371. package/lib/shared/recording.d.ts +13 -5
  372. package/lib/shared/recording.js +31 -10
  373. package/lib/shared/sketch-data.d.ts +9 -0
  374. package/lib/shared/sketch-data.js +57 -0
  375. package/lib/shared/tier.d.ts +9 -0
  376. package/lib/shared/tier.js +4 -1
  377. package/lib/shared/version.d.ts +1 -1
  378. package/lib/shared/version.js +1 -1
  379. package/lib/sketch/define-sketch.d.ts +16 -7
  380. package/lib/sketch/define-sketch.js +2 -1
  381. package/lib/sketch/runner.d.ts +4 -0
  382. package/lib/sketch/runner.js +5 -0
  383. package/lib/sketch/ui.js +4 -2
  384. package/lib/stats.d.ts +1 -0
  385. package/lib/workers/protocol.d.ts +10 -0
  386. package/lib/workers/render-worker.js +4 -1
  387. package/lib/workers/sketch-worker.js +4 -1
  388. package/package.json +1 -1
@@ -1,20 +1,16 @@
1
1
  ---
2
2
  id: getting-started/network-use
3
3
  title: Network use
4
- status: experimental
5
- since: "0.2"
6
4
  summary: "What null3D downloads, when each file loads, the build's one download, and how to keep a page on its own origin."
7
5
  ---
8
6
 
9
7
  # Network use
10
8
 
11
- > Roadmap step 0.2, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
12
-
13
9
  null3D sends nothing to any server of its own. The engine and its add-ons have no telemetry, no analytics, no crash reporting and no update check. Every request they make is for a file that the page names, or a file that the build produced.
14
10
 
15
11
  ## What the engine downloads
16
12
 
17
- The engine downloads its own files from the address where the page serves them. That address is the page's own origin, or a CDN that the page names. [Hosting](hosting.md#the-engines-files-on-a-cdn) covers the CDN case. A replay page names a recording, and the engine downloads that file from the address the page gives it; no other address is used for it.
13
+ The engine downloads its own files from the address where the page serves them. That address is the page's own origin, or a CDN that the page names. [Hosting](hosting.md#the-engines-files-on-a-cdn) covers the CDN case.
18
14
 
19
15
  | File | When it loads |
20
16
  | --- | --- |
@@ -25,22 +21,24 @@ The engine downloads its own files from the address where the page serves them.
25
21
  | The area light tables | On the first rectangle or tube light |
26
22
  | A feature's first-use code module, such as a decoder's wrapper or a pass's setup | On the first use of that feature |
27
23
 
28
- The table names what the engine ships. A feature may have both a shader module and a code module, and each loads at its own first use; a page that never uses the feature downloads neither.
24
+ The table names what the engine ships. A feature may have both a shader module and a code module, and each loads at its own first use. A page that never uses the feature downloads neither.
29
25
 
30
26
  The engine builds each address with `new URL(..., import.meta.url)`. The bundler then ships that file beside the engine's code.
31
27
 
32
28
  A repeat visit downloads less. The HTTP cache keeps the build's files, and the engine's cache of derived data keeps what it made from them, such as transcoded textures, in the browser's own storage. [Caches between visits](hosting.md#caches-between-visits) shows each cache.
33
29
 
30
+ The `preload` option of `createEngine` moves a feature's shader download to before the first frame, for a game that must fetch nothing while it plays.
31
+
34
32
  The vendored decoders hold a download path of their own, and the engine never uses it. The engine hands each decoder its compiled WebAssembly, so a page can block every other origin.
35
33
 
36
34
  ## What your own code downloads
37
35
 
38
36
  The engine downloads only the addresses that you give it:
39
37
 
40
- - `assets.loadTexture`, `assets.loadGltf`, `assets.loadBinary`, `assets.loadJson` and `assets.loadImageBitmap` download the address that you pass.
38
+ - `assets.loadTexture`, `assets.loadGltf`, `assets.loadBinary`, `assets.loadJson`, `assets.loadImageBitmap` and `assets.preload` download the addresses that you pass.
41
39
  - A glTF file names more addresses inside it, for its buffers, images and extensions. The engine downloads those too. They may be on another origin, which must allow the page to read them.
42
- - `preload` downloads the features that you list, when you call it.
43
- - The `downloads` option of `defineSketch` downloads the files that it names, as soon as the sketch's module has loaded. A recording, a replay and hold mode download them only at their loads.
40
+ - A page that replays a recording ([Record a session that went wrong](../guides/testing.md#record-a-session-that-went-wrong)) downloads that file from the address that the page gives. It uses no other address for it.
41
+ - The `downloads` option of `defineSketch` downloads the files that it names, as soon as the sketch's module has loaded. In [hold mode](../guides/testing.md#hold-mode), and while the engine records or replays a session, each file downloads only when the setup loads it. So every run stays the same.
44
42
  - `@null3d/sound` downloads the sound files that the sketch names, each once, when the sound starts. It downloads its own mixer module, about 17 KB, from beside its code at the same time. So the files do not wait for the mixer.
45
43
  - `@null3d/splats` downloads the SPZ file that you pass. A streamed cloud is fetched as its index and then only the chunk files that the view asks for, so a large cloud appears without the whole file. No other address is contacted.
46
44
 
@@ -52,36 +50,48 @@ A service worker can keep these files for a later visit. [Hosting](hosting.md#of
52
50
 
53
51
  The Vite plugin needs the engine's compiled shader modules to build a page. It looks for them in this order:
54
52
 
55
- 1. The folder that the `NULL3D_ENGINE_SHADERS` setting names.
53
+ 1. The folder that the `NULL3D_ENGINE_SHADERS` setting names. It must hold the engine's generated shader modules, including `shaders.ts`. With it set, the build makes no request.
56
54
  2. A release file of the engine's GitHub repository. The plugin checks its SHA-256 hash against the value in the engine package.
57
55
  3. The engine's own sources, built on the spot. This takes longer and needs no network.
58
56
 
59
57
  So a build contacts GitHub only when `NULL3D_ENGINE_SHADERS` is unset and the cache holds no copy. The build machine makes that request, and a page never makes it.
60
58
 
61
- The release asset holds the full set of shader modules. A game that builds against it and names no permutation list copies every module into its files folder. That can exceed the folder's limits. Narrow the set first, as [Using null3D with a deterministic simulation](../guides/deterministic-simulation.md#a-production-build-of-a-games-engine-files) shows.
59
+ The release asset holds the full set of shader modules, which is thousands of files and gigabytes. A page downloads only the few that its device needs. A build without a list of permutation words copies every module into its output, and it warns with the size that it copied. A build with a list copies only the builds of the listed words, and downloads and compiles nothing more. [Build only the shader permutations you draw with](../guides/assets-pipeline.md#build-only-the-shader-permutations-you-draw-with) shows how to record the list.
62
60
 
63
61
  In development, Vite keeps its own connection to the local dev server, for hot reload. That connection belongs to Vite, and it goes to the dev server, not to another server.
64
62
 
65
- ## Turn off the build's download
66
-
67
- Set `NULL3D_ENGINE_SHADERS` to a folder that holds the engine's generated shader modules, including `shaders.ts`. The plugin then uses that folder and makes no request.
68
-
69
63
  ## The command-line tool
70
64
 
71
65
  `bunx @null3d/cli` contacts no server of its own. It serves the page from a server on the same machine, and it drives a browser on that machine, unless you give `mcp` other addresses. When Playwright's browser is missing, the tool prints the command that installs it. You run that command yourself.
72
66
 
73
- To draw on your computer's GPU, the tool uses one pinned version of Chrome for Testing. On first use it downloads that version once, from Google's Chrome for Testing releases on `storage.googleapis.com`. The tool records the SHA-256 hash of each platform's archive, and checks the download against it before it unpacks it. It deletes an archive with another hash and installs nothing ([E1437](../errors/E1437.md)). The command then draws with the installed Google Chrome, or it stops when `NULL3D_CHROME=testing` is set. It keeps the checked build in a cache folder that every project on the computer shares, with the hash that it checked. A copy in that folder without that record downloads again. The [command-line tool's page](../cli/null3d.md#chrome-for-testing) says where the folder is. The tool makes no other request to that host, and a page never makes it. When the `CI` variable is set, the tool draws on the software GPU and downloads nothing. `NULL3D_CHROME=installed` draws with the installed Google Chrome and also downloads nothing.
67
+ To draw on your computer's GPU, the tool uses one pinned version of Chrome for Testing. It downloads it once, from Google's Chrome for Testing releases on `storage.googleapis.com`, and checks its SHA-256 hash before it unpacks it. The tool makes no other request to that host, and a page never makes it.
68
+
69
+ | Case | What the tool downloads |
70
+ | --- | --- |
71
+ | First command that draws on the GPU | Chrome for Testing, once, hash checked |
72
+ | Hash does not match | The archive is deleted and nothing is installed ([E1437](../errors/E1437.md)). The command draws with the installed Google Chrome, or stops when `NULL3D_CHROME=testing` is set |
73
+ | `CI` is set | Nothing; it draws on the software GPU |
74
+ | `NULL3D_CHROME=installed` | Nothing; it draws with the installed Google Chrome |
75
+ | `mcp --connect` | Nothing; it starts no browser |
76
+
77
+ <details>
78
+ <summary>Technical details: the cache folder</summary>
79
+
80
+ The tool keeps the checked build in a cache folder that every project on the computer shares, with the hash that it checked. A copy in that folder without that record downloads again. The [command-line tool's page](../cli/null3d.md#chrome-for-testing) says where the folder is.
81
+
82
+ </details>
74
83
 
75
84
  `check-addon` reads the allocations of an add-on's own code by asking the browser it started for a
76
85
  heap profile. That browser listens on a loopback address on this machine, and the tool talks to it
77
86
  over that address and its debugging socket. Nothing leaves the machine, and no address is a server
78
87
  the tool chooses.
79
88
 
80
- The `mcp` command talks to the agent over its standard input and output. By default it serves the
81
- page and drives the browser on this machine, as `shot` does. The `--url` option opens the dev server
82
- at the address that you give. The `--connect` option attaches to the Chrome debugging endpoint at the
83
- address that you give. Either address may be on another machine. The command contacts no other
84
- address of its own choice. With `--connect` it starts no browser, so it downloads no Chrome.
89
+ The `mcp` command talks to the agent over its standard input and output. By default it serves the page and drives the browser on this machine, as `shot` does.
90
+
91
+ - `--url` opens the dev server at the address that you give.
92
+ - `--connect` attaches to the Chrome debugging endpoint at the address that you give, and starts no browser, so it downloads no Chrome.
93
+
94
+ Either address may be on another machine. The command contacts no other address of its own choice.
85
95
 
86
96
  A command that builds the page also runs the build's one download, the engine's generated shader modules, as the section above says. Set `NULL3D_ENGINE_SHADERS` on that command to keep the tool's whole run off every network.
87
97
 
@@ -1,15 +1,11 @@
1
1
  ---
2
2
  id: getting-started/project-structure
3
3
  title: Project structure
4
- status: experimental
5
- since: "0.3"
6
4
  summary: "Starting from the `empty`, `product` or `game` template with `bunx @null3d/cli create`; page.ts, sketch.ts, AGENTS.md and the agent hook; what runs where."
7
5
  ---
8
6
 
9
7
  # Project structure
10
8
 
11
- > Roadmap step 0.3, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
12
-
13
9
  ```mermaid
14
10
  flowchart LR
15
11
  create["bunx @null3d/cli create"] --> project["my-game/"]
@@ -67,12 +63,28 @@ The folder must not exist, or it must be empty. A folder with files stays as it
67
63
 
68
64
  ## The agent files
69
65
 
70
- `AGENTS.md` names the installed null3D version and the `null3d-develop` skill. The project does not hold a copy of the skill today. When the project has `.claude/skills/null3d-develop/SKILL.md`, an agent reads that file. Otherwise the agent reads the engine docs in `node_modules/@null3d/engine/docs/`, which match the installed version.
66
+ `AGENTS.md` names the installed null3D version and the `null3d-develop` skill. The template holds no copy of the skill. [Working with AI agents](../guides/agents.md) shows how to install it: as a Claude Code plugin, with `bunx skills add`, or by a copy of its folder. When the project has `.claude/skills/null3d-develop/SKILL.md`, an agent reads that file. Otherwise the agent reads the engine docs in `node_modules/@null3d/engine/docs/`, which match the installed version.
71
67
 
72
68
  Claude Code runs the hook through `.claude/settings.json`, and Codex runs it through `.codex/hooks.json`. Both run the same file, `.agent/agent-hook.mjs`. Codex runs the hooks of a folder that you trust.
73
69
 
74
- The hook refuses three commands, so they do not run. They are a command that waits with `sleep`, one that stops a process by name, and one that follows a log. The message gives the fix.
70
+ The hook is optional. To stop its checks, delete its entries in `.claude/settings.json` and `.codex/hooks.json`.
71
+
72
+ The hook refuses some commands so that they do not run. It flags some source rules and lets the edit go on.
73
+
74
+ | Rule | What the hook does | What the message gives |
75
+ | --- | --- | --- |
76
+ | A command that waits with `sleep` | Refuses the command | The fix |
77
+ | A command that stops a process by name | Refuses the command | The fix |
78
+ | A command that follows a log | Refuses the command | The fix |
79
+ | An object, array or string made in `onUpdate` | Flags it; the edit goes on | The file, the line and the fix |
80
+ | A DOM name in the sketch module | Flags it; the edit goes on | The file, the line and the fix |
81
+ | An import of a name that the installed engine does not export | Flags it; the edit goes on | The file, the line and the fix |
82
+
83
+ The hook reads its rules from the installed packages, which `bun install` writes. Before that install, the hook cannot check a call. It tells the agent to install the packages, and the call goes on.
84
+
85
+ <details>
86
+ <summary>Technical details: where the hook's rules come from</summary>
75
87
 
76
- The hook flags three source rules and lets the edit go on. It flags an object, array or string made in `onUpdate`. It flags a DOM name in the sketch module. It flags an import of a name that the installed engine does not export. The message names the file, the line and the fix.
88
+ The hook takes every rule from `@null3d/cli/agent-rules`. That module holds each rule and its message once, so a project and any other null3D tool agree.
77
89
 
78
- The hook takes every rule from `@null3d/cli/agent-rules`. That module holds each rule and its message once, so a project and any other null3D tool agree. The hook reads the module from the installed packages, and `bun install` writes them. Before that install, the hook cannot check a call. It tells the agent to install the packages, and the call goes on.
90
+ </details>
@@ -1,24 +1,20 @@
1
1
  ---
2
2
  id: getting-started/third-party-notices
3
3
  title: Third-party notices
4
- status: experimental
5
- since: "0.2"
6
4
  summary: "The third-party code in each null3D package, with its version and license, and the notices file that a build writes beside the page."
7
5
  ---
8
6
 
9
7
  # Third-party notices
10
8
 
11
- > Roadmap step 0.2, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
12
-
13
- Some null3D packages ship code from other projects, as the original file or as a port of it. Each license asks a copy to carry its notice, so every such package ships a `THIRD-PARTY-NOTICES.txt` file with the full text.
9
+ Some null3D packages ship code from other projects, as the original file or as a port of it. Each license asks a copy to carry its notice, so every such package ships a `THIRD-PARTY-NOTICES.txt` file with the full text. A production build with the Vite plugin collects these notices into `null3d-third-party-notices.txt` beside the page. Keep that file with the build when you publish it, or show its text in your game's credits ([Hosting](hosting.md#publish-the-third-party-notices)).
14
10
 
15
11
  ## Each package
16
12
 
17
13
  | Package | Third-party code | License | Where | Notices |
18
14
  | --- | --- | --- | --- | --- |
19
- | `@null3d/engine` | Basis Universal 2.50 with Zstandard, meshoptimizer 1.3.0, Draco 1.5.7, three.js 0.186.1, TinyEXR and OpenEXR, Linearly transformed cosines, Filament, KinoBokeh and Unity's post-processing stack v1, AMD FidelityFX FSR 1 and SSSR, Qualcomm Snapdragon GSR 1, SMAA 1x, and the core's Rust crates | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, the shader modules, `panorama-worker.js`, `dist/wasm` | `THIRD-PARTY-NOTICES.txt` |
20
- | `@null3d/cli` | Basis Universal 2.50 with Zstandard, ufbx 0.23.1, the `exr` and `lebe` crates, three.js 0.186.1, and the asset module's other crates | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, `dist/assets.wasm` | `THIRD-PARTY-NOTICES.txt` |
21
- | `@null3d/vite-plugin` | naga and naga-types 30.0.1, naga_oil 0.23.0, serde, serde_json, toml, the shader compiler's other crates, and the engine shaders it embeds: three.js 0.186.1, Filament, KinoBokeh and Unity's post-processing stack v1, AMD FidelityFX, Qualcomm Snapdragon GSR 1, SMAA 1x | MIT, Apache License 2.0, BSD 3-Clause and Zlib | `dist/shader-compiler.wasm` | `THIRD-PARTY-NOTICES.txt` |
15
+ | `@null3d/engine` | 13 projects, among them Basis Universal, Draco, meshoptimizer and three.js. See [The engine](#the-engine). | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, the shader modules, `panorama-worker.js`, `dist/wasm` | `THIRD-PARTY-NOTICES.txt` |
16
+ | `@null3d/cli` | Basis Universal, ufbx, three.js and the asset module's crates. See [The tools](#the-tools). | Apache License 2.0, BSD 3-Clause and MIT | `vendor/`, `dist/assets.wasm` | `THIRD-PARTY-NOTICES.txt` |
17
+ | `@null3d/vite-plugin` | naga, naga_oil and the shader compiler's crates, and the engine shaders it embeds. See [The tools](#the-tools). | MIT, Apache License 2.0, BSD 3-Clause and Zlib | `dist/shader-compiler.wasm` | `THIRD-PARTY-NOTICES.txt` |
22
18
  | `@null3d/controls` | three.js 0.186.1, the math and the option names of its controls | MIT | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
23
19
  | `@null3d/geometry` | three.js 0.186.1, its generators, curves, paths and shapes; earcut 3.0.2 | MIT and ISC | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
24
20
  | `@null3d/three-compat` | three.js 0.186.1, its tone curves and its outline pass | MIT | `lib/index.js` | `THIRD-PARTY-NOTICES.txt` |
@@ -50,7 +46,7 @@ The null3D packages themselves are offered under the MIT License or the Apache L
50
46
  | Qualcomm Snapdragon GSR 1: the render-scale upscale | BSD 3-Clause | the shader library |
51
47
  | TinyEXR and OpenEXR, whose code the EXR decoders follow | BSD 3-Clause | `panorama-worker.js` |
52
48
  | Linearly transformed cosines, the area light tables | BSD 3-Clause | `vendor/ltc` |
53
- | SMAA, the subpixel morphological anti-aliasing that smooths the moment transparency layer's edges | MIT | the renderer's moment layer tables and shaders |
49
+ | SMAA 1x, the anti-aliasing of the optional [moment transparency layer](../api/materials.md#moment-transparency) | MIT | the renderer's moment layer tables and shaders |
54
50
  | The Rust crates of the core: the standard library, wasm-bindgen, cfg-if, once_cell and dlmalloc | MIT or Apache License 2.0 | `dist/wasm` |
55
51
 
56
52
  The full texts are in the engine's `THIRD-PARTY-NOTICES.txt`.
@@ -91,4 +87,4 @@ The command-line tool and the Vite plugin put no code in a page. Their packages
91
87
 
92
88
  Each package's `THIRD-PARTY-NOTICES.txt` holds the full text. The engine's copy is also at `node_modules/@null3d/engine/THIRD-PARTY-NOTICES.txt` after an install.
93
89
 
94
- A production build with the Vite plugin writes every package's notices into `null3d-third-party-notices.txt` beside the page. Keep that file with the build when you publish it, or show its text in your game's credits. The tools' notices stay out of that file, because a page ships none of their code.
90
+ The tools' notices stay out of the build's notices file, because a page ships none of their code.
@@ -1,15 +1,11 @@
1
1
  ---
2
2
  id: guides/accessibility
3
3
  title: Accessibility
4
- status: experimental
5
- since: "0.1"
6
4
  summary: "What the canvas tells assistive technology; keyboard use; reduced motion; pausing; loading and errors."
7
5
  ---
8
6
 
9
7
  # Accessibility
10
8
 
11
- > Roadmap step 0.1, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
12
-
13
9
  A screen reader sees a canvas as one element. It cannot see the objects drawn inside it. So the HTML around the canvas carries the meaning, and the sketch sends that HTML what it needs through messages.
14
10
 
15
11
  ## Tell assistive technology what the canvas is
@@ -37,6 +33,8 @@ engine.onSketchMessage((type, data) => {
37
33
  });
38
34
  ```
39
35
 
36
+ The [deterministic simulation demo](https://github.com/null3d-engine/null3d/tree/main/examples/replay) writes a status line with `aria-live="polite"` as the user plays.
37
+
40
38
  ## Keyboard
41
39
 
42
40
  The engine reads key presses from the whole window. It leaves them to the page while a text field, text area, drop-down list or editable element has focus.
@@ -45,6 +43,8 @@ The engine reads key presses from the whole window. It leaves them to the page w
45
43
  - Never trap focus. The Tab key must always move on to the rest of the page.
46
44
  - A canvas the user operates can take focus with `tabindex="0"`. Give it a visible focus outline.
47
45
 
46
+ The [input demo](https://github.com/null3d-engine/null3d/tree/main/examples/input) moves its robot with the arrow keys, the WASD keys and a gamepad, and turns the camera with the right stick.
47
+
48
48
  ## Motion
49
49
 
50
50
  Some users get dizzy or sick from motion on screen, so their system asks every page for less of it. In the sketch, `preferences.reducedMotion` is true while it does. `preferences.onChange` calls a handler at the start of the first frame after the setting changes:
@@ -1,16 +1,31 @@
1
1
  ---
2
2
  id: guides/add-ons
3
3
  title: Building an add-on
4
- status: experimental
5
- since: "0.3"
6
4
  summary: "One package with one entry; claim a namespace and the plugin interface range; import only the public entry points; compile the shaders on both paths; name a page; run the check."
7
5
  ---
8
6
 
9
7
  # Building an add-on
10
8
 
11
- > Roadmap step 0.3, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
9
+ An add-on is a package that adds a feature above the engine's public API. It has one install and one import, and it reaches the engine only through the engine's public entry points. The engine's own add-ons work the same way.
12
10
 
13
- An add-on is a package that adds a feature above the engine's public API. It has one install and one import, and it reaches the engine only through the engine's public entry points. The engine's own add-ons work the same way. `bunx @null3d/cli check-addon` runs these rules on a folder before a listing publishes it.
11
+ `bunx @null3d/cli check-addon` runs gates on a folder before a listing publishes it. [The `null3d` command](../cli/null3d.md#check-addon) lists them. The sections on names, entry points, shaders, file sizes and the preset cost each have a gate. The sections on Rust and levels of detail are advice that no gate checks.
12
+
13
+ ## Choose a way to add drawing
14
+
15
+ | What you want to draw | The call | Where in the frame it runs | GPU paths | The page |
16
+ | --- | --- | --- | --- | --- |
17
+ | A surface's look, with the engine's lighting | a surface function | in the material's draw | both | [Surface functions](../shaders/surface-functions.md) |
18
+ | A material with WGSL of its own from end to end | `materials.shader` | in the object's draw | both | [Custom shaders](custom-shaders.md) |
19
+ | A full-screen effect over the scene color | `post.addEffect` | after the scene passes, before bloom | both | [Custom passes and render targets](custom-passes.md) |
20
+ | A scene drawn from another camera | `render.addPass` with `kind: 'scene'` | before the passes that show its texture | both | [Render graph API](../api/render.md) |
21
+ | A full-screen pass into a texture | `render.addPass` with `kind: 'fullscreen'` | before the passes that read its texture | both | [Render graph API](../api/render.md#full-screen-passes) |
22
+ | A compute pass | `render.addPass` with `kind: 'compute'` | before the passes that read its texture | WebGPU, with a WebGL2 fallback | [Render graph API](../api/render.md#compute-passes) |
23
+ | A draw from a vertex count | `scene.createVertexDraw` | with the scene's draws | both | [Vertex draws](../api/vertex-draws.md) |
24
+ | A draw from a feature | `scene.addFeatureDraw` | with the scene's draws | both | [Feature draws](../api/feature-draws.md) |
25
+ | A full-screen pass from a feature | `post.addFeatureEffect` | after the scene passes | both | [Feature effects](../api/feature-effects.md) |
26
+ | Instances whose count the GPU writes | `scene.addComputeInstances` | with the scene's draws | WebGPU | [Feature instances](../api/feature-instances.md) |
27
+
28
+ Tasks (`runTask`) are the CPU side, not a draw: they run on the job workers ([Tasks on the job workers](../api/tasks.md)).
14
29
 
15
30
  ## Claim the add-on's names
16
31
 
@@ -30,9 +45,19 @@ declareAddonNamespace({
30
45
  });
31
46
  ```
32
47
 
33
- The name takes lowercase letters, digits and underscores, and starts with a letter. The package names the module that owns the add-on, and it gives the same value every time the add-on loads, so a development reload takes back its namespace. A second add-on that takes the name is refused. The engine owns `null3d`, and codes below 2000 are the engine's own. The engine refuses a name or a code that another add-on holds.
48
+ The name rules:
49
+
50
+ - lowercase letters, digits and underscores, starting with a letter;
51
+ - `null3d` belongs to the engine;
52
+ - error codes from 2000 to 9999, with the engine's codes below 2000;
53
+ - a held name, package or code range throws [E1225](../errors/E1225.md);
54
+ - a reload with the same package takes back its namespace.
55
+
56
+ A second add-on that takes a name is refused. [Namespaces](../api/features.md#namespaces) gives the full rules.
57
+
58
+ The plugin interface version changes only when a stable hook changes, so an add-on can span many engine releases. A page whose engine lies outside the declared range stops with [E1433](../errors/E1433.md) before it draws.
34
59
 
35
- The plugin interface version changes only when a stable hook changes, so an add-on can span many engine releases. A page whose engine lies outside the declared range stops with [E1433](../errors/E1433.md) before it draws. The message names the add-on, the range and the engine's interface. The version is `PLUGIN_INTERFACE_VERSION` in the engine that the add-on builds against. Widen the range only after the add-on works with the wider interface.
60
+ The message names the add-on, the range and the engine's interface. The version is `PLUGIN_INTERFACE_VERSION` in the engine that the add-on builds against. Widen the range only after the add-on works with the wider interface.
36
61
 
37
62
  The engine's own add-ons leave the range out and pin the engine version exactly with `checkAddonVersion`, because they ship in step with the engine.
38
63
 
@@ -52,11 +77,20 @@ Keep setup, options, the public API and event handling in TypeScript. They run o
52
77
 
53
78
  An add-on's meshes get levels of detail as a page's meshes do, with no call of the add-on's own. A far copy then draws a few dozen triangles instead of its full mesh. The engine hides a copy that covers less than a pixel.
54
79
 
55
- A mesh from `geometry.fromArrays` or a generator plans its levels at its first draw. It plans when it holds 4,096 triangles or more, or when it holds at least 256 and its copies hold 65,536 together. The plan runs on the job workers with the asset tool's planner. The levels keep their measured errors, so they switch in at once while the threshold stays small, and fade once the governor raises it past about one and a half pixels ([Levels of detail](../concepts/lod.md#levels-of-meshes-made-in-code)). They name the mesh's own vertices, so the mesh keeps its vertex and triangle order, which raycasts and `updateVertices` read.
80
+ The engine plans a mesh's levels when it holds 4,096 triangles or more. It plans a smaller mesh when it holds at least 256 and its copies hold 65,536 together. A mesh from `geometry.fromArrays` or a generator plans them at its first draw. The levels keep the mesh's vertex and triangle order, which raycasts and `updateVertices` read ([Levels of detail](../concepts/lod.md#levels-of-meshes-made-in-code)).
81
+
82
+ <details>
83
+ <summary>Technical details: when a mesh plans its levels</summary>
84
+
85
+ The plan runs on the job workers with the asset tool's planner. The levels keep their measured errors, so they switch in at once while the threshold stays small. They fade once the governor raises it past about one and a half pixels.
86
+
87
+ </details>
56
88
 
57
89
  So make every mesh through `fromArrays` or a generator, and leave its `levels` option out. Arrays that a task of the add-on builds on a job worker go to `fromArrays` too, and the mesh then plans as any other. An add-on that returns arrays, such as a shape generator, leaves the mesh, and its levels, to the page.
58
90
 
59
- Do not ask for levels mesh by mesh. The default picks the meshes whose levels save GPU time. A small mesh drawn a few times gains little, and each level adds draw work. `levels: true` and `await mesh.buildLevels()` plan at any size. Use `buildLevels()` to plan again after `updateVertices` gives a mesh a new shape, or to await the levels in a test. The one exception is a mesh of separate leaf cards. It asks for `levels: { cards: true }`, so each level thins its cards rather than dropping whole small pieces.
91
+ Do not ask for levels mesh by mesh. The default picks the meshes whose levels save GPU time.
92
+
93
+ `levels: true` and `await mesh.buildLevels()` plan at any size. Use `buildLevels()` to plan again after `updateVertices` gives a mesh a new shape, or to await the levels in a test. The one exception is a mesh of separate leaf cards. It asks for `levels: { cards: true }`, so each level thins its cards rather than dropping whole small pieces.
60
94
 
61
95
  Opt a mesh out with `levels: false` only where levels are wrong for it, and say why in a comment beside the mesh:
62
96
 
@@ -68,9 +102,24 @@ Opt a mesh out with `levels: false` only where levels are wrong for it, and say
68
102
  | It keeps one size on the screen | Its levels would never switch | Gizmo handles |
69
103
  | Its vertices change in every frame | The levels would measure a shape that the next frame replaces | None |
70
104
 
71
- The engine refuses planned levels by itself in a few cases. A mesh with joints, morph targets or a vertex record (`targets`) plans none, and so does a mesh that lies flat. A mesh that a material with a displacement map or a custom `vertexOffset` draws drops its planned levels. The first `updateVertices` drops them too. Levels that `mesh.setLevels` gives win over the plan, so a mesh with hand-made levels, such as a generated plant's, gets no planned levels on top. Still pass `levels: false` for a mesh of the table, so the code states the decision where the mesh is made.
105
+ The engine refuses planned levels by itself in some cases:
106
+
107
+ - a mesh with joints, morph targets or a vertex record (`targets`);
108
+ - a flat mesh;
109
+ - a mesh that a material with a displacement map or a custom `vertexOffset` draws;
110
+ - the first `updateVertices`;
111
+ - levels that `mesh.setLevels` gives.
72
112
 
73
- The asset tool also sorts a large level into pieces ([Pieces of a large level](../concepts/lod.md#pieces-of-a-large-level)). Each copy skips the pieces that the view leaves out or that face away. A mesh made in code gets pieces with its planned levels, so an add-on that takes the default gets them with no change. A smaller mesh that many copies draw, such as a building kit's walls, gets a piece for each way it faces. It gets them even when its levels are set by hand or come from a file that holds it once. A mesh with `levels: false` gets none. Some large meshes take no levels but span the view, such as a merged far cell. Such a mesh asks for `levels: 'pieces'`, which sorts it into pieces by space alone.
113
+ A mesh that `mesh.setLevels` gives hand-made levels gets no planned levels on top, such as a generated plant's. Still pass `levels: false` for a mesh of the table, so the code states the decision where the mesh is made.
114
+
115
+ A mesh made in code gets pieces with its planned levels, so an add-on that takes the default gets them with no change. Each copy skips the pieces that the view leaves out or that face away. A mesh with `levels: false` gets none. A large mesh that takes no levels but spans the view, such as a merged far cell, asks for `levels: 'pieces'`, which sorts it into pieces by space alone ([Pieces of a large level](../concepts/lod.md#pieces-of-a-large-level)).
116
+
117
+ <details>
118
+ <summary>Technical details: which meshes get pieces</summary>
119
+
120
+ A smaller mesh that many copies draw, such as a building kit's walls, gets a piece for each way it faces. It gets them even when its levels are set by hand or come from a file that holds it once.
121
+
122
+ </details>
74
123
 
75
124
  ## Follow the preset and show the cost
76
125
 
@@ -114,11 +163,18 @@ The null3D Vite plugin compiles each `.wgsl` file that the add-on imports, for W
114
163
 
115
164
  The engine's start stays small, and so does an add-on's. The files that the add-on loads after the first frame hold to a budget in each of three columns: raw bytes, gzip and Brotli. The check warns about each file that goes over its budget, with each column and its figure. An add-on is a choice, so an over-budget file does not fail the check.
116
165
 
117
- A custom material's, a custom effect's and a custom tone curve's compiled builds load on first use, in files of their own. Those files take the budget for shader builds, which is larger than the budget for code. Not all compiled WGSL leaves the entry, though. A whole shader's or a sky layer's builds sit in the file that imports them, and so do an effect's pieces. The check counts those bytes as shader data, and holds them to the budget for shader builds. A file that holds both therefore answers both budgets. [Custom shaders](custom-shaders.md#where-a-custom-materials-builds-go) shows the files.
166
+ A custom material's, a custom effect's and a custom tone curve's compiled builds load on first use in files of their own. Those files take the budget for shader builds, which is larger than the budget for code ([Custom shaders](custom-shaders.md#where-the-builds-go)).
167
+
168
+ <details>
169
+ <summary>Technical details: how the size gate counts shader bytes</summary>
170
+
171
+ Not all compiled WGSL leaves the entry, though. A whole shader's or a sky layer's builds sit in the file that imports them, and so do an effect's pieces. The check counts those bytes as shader data, and holds them to the budget for shader builds. A file that holds both therefore answers both budgets.
172
+
173
+ </details>
118
174
 
119
175
  ## Name a page
120
176
 
121
- The browser gates open a page of the add-on's project. The check takes the page of the first test in `null3d.json`, or the page that `--page` names:
177
+ The page, cost and allocation gates open a page of the add-on's project in a browser. The check takes the page of the first test in `null3d.json`, or the page that `--page` names:
122
178
 
123
179
  ```json
124
180
  { "tests": [{ "name": "demo", "page": "/index.html", "hold": 1.5 }] }
@@ -150,7 +206,14 @@ Use `--skip-browser` on a machine that has no GPU or no browser. Use `--skip-cos
150
206
 
151
207
  The cost figures are measured, and the check prints them; it does not compare them with a number that the add-on claims. The page builds for production, so the figures match what a user gets.
152
208
 
153
- The allocation gate counts the bytes that the add-on's own code allocates in each frame, on each quality preset. It reads the heaps of the page's sketch worker and render worker, and names each function by its source file. A place counts as the add-on's own when its source file is in the add-on's folder, or in the add-on's copy under `node_modules`. The gate prints the page's figure beside it. A frame that allocates feeds the browser's garbage collector, so aim at zero. The gate fails only when it cannot measure the add-on's code, such as on a page that runs none of the add-on's files.
209
+ The allocation gate counts the bytes that the add-on's own code allocates in each frame, on each quality preset. Aim at zero, since a frame that allocates feeds the garbage collector. The gate fails only when it cannot measure the add-on's code.
210
+
211
+ <details>
212
+ <summary>Technical details: how the allocation gate measures</summary>
213
+
214
+ It reads the heaps of the page's sketch worker and render worker, and names each function by its source file. A place counts as the add-on's own when its source file is in the add-on's folder, or in the add-on's copy under `node_modules`. The gate prints the page's figure beside it.
215
+
216
+ </details>
154
217
 
155
218
  ## Related pages
156
219
 
@@ -158,3 +221,10 @@ The allocation gate counts the bytes that the add-on's own code allocates in eac
158
221
  - [E1433](../errors/E1433.md): the error for an add-on built for another plugin interface.
159
222
  - [Custom shaders](custom-shaders.md): the WGSL that an add-on can use.
160
223
  - [Custom passes and render targets](custom-passes.md): the engine's public hooks for extra drawing.
224
+ - [Feature descriptions](../api/features.md): one description of the render work.
225
+ - [Feature draws](../api/feature-draws.md): a draw from a feature.
226
+ - [Feature effects](../api/feature-effects.md): a full-screen pass from a feature.
227
+ - [Feature instances](../api/feature-instances.md): instances whose count the GPU writes.
228
+ - [Tasks on the job workers](../api/tasks.md): work on the job workers.
229
+ - [Terrain blocks with their own level system](https://github.com/null3d-engine/null3d/tree/main/examples/terrain): a 1.2 km valley whose far hills draw as coarser blocks.
230
+ - [Impostor cards as far stand-ins](https://github.com/null3d-engine/null3d/tree/main/examples/impostors): a forest whose far trees are cards from an atlas made in code.
@@ -1,15 +1,11 @@
1
1
  ---
2
2
  id: guides/agents
3
3
  title: Working with AI agents
4
- status: experimental
5
- since: "0.1"
6
4
  summary: "Installing the null3D skills in Claude Code, claude.ai and other agent tools; docs by ID; the test loop; the MCP server and the in-page inspector."
7
5
  ---
8
6
 
9
7
  # Working with AI agents
10
8
 
11
- > Roadmap step 0.1, first released in null3D 0.1.0. The API is experimental, so it can still change between versions.
12
-
13
9
  null3D comes with two agent skills. A skill is a folder of instructions that a coding agent loads when a task needs it.
14
10
 
15
11
  | Skill | What it does |
@@ -17,12 +13,12 @@ null3D comes with two agent skills. A skill is a folder of instructions that a c
17
13
  | `null3d-develop` | Builds, debugs and speeds up null3D projects, including product and marketing pages |
18
14
  | `null3d-port-threejs` | Ports three.js and React Three Fiber projects to null3D |
19
15
 
20
- Install the skills that match the engine version your project uses. Each release of the engine has its own skills.
16
+ Each release of the engine has its own skills. The links in this page give the latest release's skills. [Other agent tools](#other-agent-tools) shows how to pin an older release.
21
17
 
22
18
  ## Claude Code
23
19
 
24
20
  ```sh
25
- claude plugin marketplace add https://raw.githubusercontent.com/null3d-engine/null3d/main/.claude-plugin/marketplace.json
21
+ claude plugin marketplace add null3d-engine/null3d
26
22
  claude plugin install null3d@null3d
27
23
  ```
28
24
 
@@ -30,20 +26,23 @@ The plugin holds the skills of the latest release, and Claude Code downloads onl
30
26
 
31
27
  ## claude.ai and the Claude desktop app
32
28
 
33
- Each release's page on GitHub has `null3d-develop.zip` and `null3d-port-threejs.zip` attached. Upload each zip where the app lets you add skills.
29
+ Download each skill as a zip and upload it where the app lets you add skills:
30
+
31
+ - [null3d-develop](https://null3d.dev/skills/null3d-develop)
32
+ - [null3d-port-threejs](https://null3d.dev/skills/null3d-port-threejs)
34
33
 
35
34
  ## Other agent tools
36
35
 
37
- The [`skills` command](https://github.com/vercel-labs/skills) installs a skill into many agent tools, including Claude Code, Cursor and OpenCode. Give it the folder of each skill in the release that your project uses:
36
+ The [`skills` command](https://github.com/vercel-labs/skills) installs a skill into many agent tools, including Claude Code, Cursor and OpenCode:
38
37
 
39
38
  ```sh
40
- bunx skills add https://github.com/null3d-engine/null3d/tree/0.1.0/.claude/skills/null3d-develop
41
- bunx skills add https://github.com/null3d-engine/null3d/tree/0.1.0/.claude/skills/null3d-port-threejs
39
+ bunx skills add https://null3d.dev/skills/null3d-develop
40
+ bunx skills add https://null3d.dev/skills/null3d-port-threejs
42
41
  ```
43
42
 
44
- Replace `0.1.0` with your engine version. The command asks which agents to install into, and `-a` names them.
43
+ The command asks which agents to install into, and `-a` names them. These links give the latest release. For an older engine, add its release tag as a last path segment, such as `/skills/null3d-develop/<tag>`.
45
44
 
46
- To install by hand, copy each skill's folder from `.claude/skills/` in the release into your agent's skills folder, and keep the folder's name. Use those copies: the repository's `skills/` folder also holds test material for the skills.
45
+ To install by hand, unzip a skill into your agent's skills folder and keep the folder's name.
47
46
 
48
47
  ## Docs by ID
49
48
 
@@ -64,7 +63,7 @@ An agent checks its work with the `null3d` command, which prints short lines of
64
63
 
65
64
  `bunx @null3d/cli mcp` starts a Model Context Protocol server for the project in the current folder. It runs over stdio, and an agent uses it to look inside the running scene and change it live. The server needs a development build, because a production build leaves the inspection channel out.
66
65
 
67
- By default the server starts the project's own Vite dev server and a headless Chrome, as `shot` does. This works on a cloud agent with no window. With `--connect <endpoint>` it attaches to a Chrome that the developer already runs with a remote debugging port. It then drives the tab that shows the page, so the agent sees exactly what the developer sees. [Debugging](debugging.md#the-mcp-server) lists the options and the tools, and [the `mcp` command](../cli/null3d.md#mcp) is the full reference.
66
+ By default it starts the project's own Vite dev server and a headless Chrome; with `--connect <endpoint>` it drives a Chrome that you already run. [The `mcp` command](../cli/null3d.md#mcp) lists every option and tool.
68
67
 
69
68
  Register the server in Claude Code with:
70
69
 
@@ -72,6 +71,6 @@ Register the server in Claude Code with:
72
71
  claude mcp add null3d -- bunx @null3d/cli mcp
73
72
  ```
74
73
 
75
- The tools list and read objects, and change a transform or a material. They capture a frame, and read the frame figures, the errors and the render graph. They also switch the quality preset or the GPU path. Live changes are for exploring: the agent writes the final values into the sketch and its tests, and checks them with `bunx @null3d/cli test`.
74
+ Live changes are for exploring: the agent writes the final values into the sketch and its tests, and checks them with `bunx @null3d/cli test`.
76
75
 
77
76
  The page also shows a panel of its own with `?inspect`, which lists the scene, selects an object and edits it. [The in-page inspector](debugging.md#the-in-page-inspector) describes it.