@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
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/math
3
3
  title: "Math helpers: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Math helpers API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -18,11 +17,11 @@ Colors as linear RGB in plain arrays of three numbers, from hex colors, sRGB com
18
17
 
19
18
  | Member | Description |
20
19
  | --- | --- |
21
- | `srgbToLinear(c: number): number` | An sRGB component from 0 to 1 as a linear one, as three.js's `SRGBToLinear`. |
22
- | `linearToSrgb(c: number): number` | A linear component from 0 to 1 as an sRGB one, as three.js's `LinearToSRGB`. |
20
+ | `srgbToLinear(c: number): number` | An sRGB component from 0 to 1 as a linear one, by the sRGB standard's curve. |
21
+ | `linearToSrgb(c: number): number` | A linear component from 0 to 1 as an sRGB one, by the sRGB standard's curve. |
23
22
  | `fromSrgb<T extends Vec3Like>(out: T, r: number, g: number, b: number): T` | Linear RGB from three sRGB components from 0 to 1, such as a color picker gives. |
24
23
  | `fromHex<T extends Vec3Like>(out: T, hex: string \| number): T` | Linear RGB from an sRGB hex color: a string such as `'#ff8800'` or `'#f80'`, or a number such as `0xff8800`. It throws E1204 for anything else. |
25
- | `fromHsl<T extends Vec3Like>(out: T, h: number, s: number, l: number): T` | RGB from a hue, a saturation and a lightness, each from 0 to 1, as three.js's `setHSL`. Like three.js, it takes the result as linear RGB, so the same values give the same color in both engines. |
24
+ | `fromHsl<T extends Vec3Like>(out: T, h: number, s: number, l: number): T` | Linear RGB from a hue, a saturation and a lightness, each from 0 to 1. The hue wraps around, and the saturation and lightness stop at 0 and 1. It takes the result of the HSL formula as linear RGB as it is, with no sRGB conversion. |
26
25
 
27
26
  ## `createMath`
28
27
 
@@ -30,6 +29,8 @@ Colors as linear RGB in plain arrays of three numbers, from hex colors, sRGB com
30
29
  function createMath(functions: MathFunctions): MathHelpers
31
30
  ```
32
31
 
32
+ Import from `@null3d/engine/math`.
33
+
33
34
  The math helpers that need a sine, a cosine, an arc cosine or an exponential, built on the four functions given: `quat.setAxisAngle`, `fromEuler`, `rotateX`, `rotateY`, `rotateZ` and `slerp`, `vec3.angle` and `math.damp`. Each does the same arithmetic as the main entry's helper of its name, which uses the browser's `Math`. Pass an exact math library's functions, and a deterministic simulation gets the same bits on every JavaScript engine. Call it once, outside per-frame code: it allocates the helpers. Throws E1213 when one of the four is not a function.
34
35
 
35
36
  ## `EulerOrder`
@@ -38,7 +39,7 @@ The math helpers that need a sine, a cosine, an arc cosine or an exponential, bu
38
39
  type EulerOrder = 'XYZ' | 'YXZ' | 'ZXY' | 'ZYX' | 'YZX' | 'XZY';
39
40
  ```
40
41
 
41
- The axis order of Euler angles, with three.js's names. `'XYZ'` turns an object about its own X axis, then its Y axis, then its Z axis.
42
+ The axis order of Euler angles. `'XYZ'` turns an object about its own X axis, then its Y axis, then its Z axis.
42
43
 
43
44
  ## `mat4`
44
45
 
@@ -51,10 +52,10 @@ Namespace `mat4`.
51
52
  | `create(): number[]` | A new identity matrix. It allocates, so create matrices once, outside per-frame code. |
52
53
  | `identity<T extends Mat4Like>(out: T): T` | Sets `out` to the identity matrix, which changes nothing. |
53
54
  | `copy<T extends Mat4Like>(out: T, a: Mat4Like): T` | Copies `a` into `out`. |
54
- | `multiply<T extends Mat4Like>(out: T, a: Mat4Like, b: Mat4Like): T` | The product of `a` and `b`, as three.js's `multiplyMatrices`. It transforms a point by `b` first, then by `a`. |
55
- | `invert<T extends Mat4Like>(out: T, a: Mat4Like): T` | The inverse of `a`, which undoes it, as three.js's `invert`. A matrix that has no inverse gives all zeros. |
56
- | `compose<T extends Mat4Like>(out: T, position: Vec3Like, rotation: QuatLike, scale: Vec3Like): T` | The matrix that scales by `scale`, then turns by the quaternion `rotation`, then moves by `position`, as three.js's `compose`. |
57
- | `decompose(position: Vec3Like, rotation: QuatLike, scale: Vec3Like, m: Mat4Like): void` | Splits the matrix `m` into the position, rotation and scale that `compose` joins, as three.js's `decompose`, and writes them into the first three arrays. A matrix that mirrors space gives a negative X scale. A matrix that flattens space gives no rotation and a scale of 1. |
55
+ | `multiply<T extends Mat4Like>(out: T, a: Mat4Like, b: Mat4Like): T` | The product of `a` and `b`. It transforms a point by `b` first, then by `a`. |
56
+ | `invert<T extends Mat4Like>(out: T, a: Mat4Like): T` | The inverse of `a`, which undoes it. A matrix that has no inverse gives all zeros. |
57
+ | `compose<T extends Mat4Like>(out: T, position: Vec3Like, rotation: QuatLike, scale: Vec3Like): T` | The matrix that scales by `scale`, then turns by the quaternion `rotation`, then moves by `position`. |
58
+ | `decompose(position: Vec3Like, rotation: QuatLike, scale: Vec3Like, m: Mat4Like): void` | Splits the matrix `m` into the position, rotation and scale that `compose` joins, and writes them into the first three arrays. A matrix that mirrors space gives a negative X scale. A matrix that flattens space gives no rotation and a scale of 1. |
58
59
 
59
60
  ## `Mat4Like`
60
61
 
@@ -62,13 +63,13 @@ Namespace `mat4`.
62
63
  type Mat4Like = { [index: number]: number; };
63
64
  ```
64
65
 
65
- A 4 by 4 matrix in an array of 16 numbers, stored column by column, as three.js and WebGPU store matrices. Elements 12, 13 and 14 hold the translation.
66
+ A 4 by 4 matrix in an array of 16 numbers, stored column by column, as WebGPU stores matrices. Elements 12, 13 and 14 hold the translation.
66
67
 
67
68
  ## `math`
68
69
 
69
70
  Namespace `math`.
70
71
 
71
- Number helpers with three.js's names, such as `math.clamp` and `math.damp`, and a random generator that a sketch can seed and that hold mode seeds.
72
+ Number helpers, such as `math.clamp` and `math.damp`, and a random generator that a sketch can seed and that hold mode seeds.
72
73
 
73
74
  | Member | Description |
74
75
  | --- | --- |
@@ -81,8 +82,8 @@ Number helpers with three.js's names, such as `math.clamp` and `math.damp`, and
81
82
  | `degToRad(degrees: number): number` | An angle in degrees as radians. |
82
83
  | `radToDeg(radians: number): number` | An angle in radians as degrees. |
83
84
  | `euclideanModulo(n: number, m: number): number` | The remainder of `n` divided by `m`, with the sign of `m`. For example, -1 modulo 3 is 2. |
84
- | `random(): number` | The next random number, from 0 up to but not including 1. Each thread has one generator, which starts from an unpredictable seed. Hold mode seeds it, so a sketch that draws its numbers from it draws the same frame on every run. The generator is mulberry32, as in three.js's `seededRandom`. |
85
- | `seed(value: number): void` | Starts `random` again from a seed, an integer. The same seed always gives the same numbers: `math.seed(s)` followed by `math.random()` gives what three.js's `seededRandom(s)` gives. |
85
+ | `random(): number` | The next random number, from 0 up to but not including 1. Each thread has one generator, which starts from an unpredictable seed. Hold mode seeds it, so a sketch that draws its numbers from it draws the same frame on every run. The generator is mulberry32. |
86
+ | `seed(value: number): void` | Starts `random` again from a seed, an integer. The same seed always gives the same numbers. |
86
87
  | `randFloat(low: number, high: number): number` | A random number from `low` up to but not including `high`. |
87
88
  | `randInt(low: number, high: number): number` | A random integer from `low` to `high`, both included. |
88
89
  | `randFloatSpread(range: number): number` | A random number from `-range / 2` to `range / 2`. |
@@ -91,6 +92,8 @@ Number helpers with three.js's names, such as `math.clamp` and `math.damp`, and
91
92
 
92
93
  Interface `MathFunctions`.
93
94
 
95
+ Import from `@null3d/engine/math`.
96
+
94
97
  The four functions that `createMath` builds its helpers on, each taking and giving radians where it takes an angle. An exact math library that gives the same bits on every JavaScript engine has them, under these names or others. The helpers call each one as a plain function, with no `this`.
95
98
 
96
99
  | Member | Description |
@@ -104,6 +107,8 @@ The four functions that `createMath` builds its helpers on, each taking and givi
104
107
 
105
108
  Interface `MathHelpers`.
106
109
 
110
+ Import from `@null3d/engine/math`.
111
+
107
112
  The helpers that `createMath` returns, grouped and named as the main entry's namespaces group and name them.
108
113
 
109
114
  | Member | Description |
@@ -116,6 +121,8 @@ The helpers that `createMath` returns, grouped and named as the main entry's nam
116
121
 
117
122
  Interface `NumberHelpers`.
118
123
 
124
+ Import from `@null3d/engine/math`.
125
+
119
126
  The number helper that `createMath` builds, with the same arguments and arithmetic as `math.damp`.
120
127
 
121
128
  | Member | Description |
@@ -131,20 +138,20 @@ Rotations as quaternions (x, y, z, w) in plain arrays, with angles in radians: `
131
138
  | Member | Description |
132
139
  | --- | --- |
133
140
  | `setAxisAngle<T extends QuatLike>(out: T, axis: Vec3Like, rad: number): T` | The rotation of `rad` radians about `axis`, a vector of length 1. |
134
- | `fromEuler<T extends QuatLike>(out: T, x: number, y: number, z: number, order?: EulerOrder): T` | The rotation of Euler angles in radians, applied in `order`, `'XYZ'` by default, as three.js's `setFromEuler`. gl-matrix's `fromEuler` takes degrees, but this one takes radians. |
141
+ | `fromEuler<T extends QuatLike>(out: T, x: number, y: number, z: number, order?: EulerOrder): T` | The rotation of Euler angles in radians, applied in `order`, `'XYZ'` by default. gl-matrix's `fromEuler` takes degrees, but this one takes radians. |
135
142
  | `rotateX<T extends QuatLike>(out: T, a: QuatLike, rad: number): T` | Turns the rotation `a` by `rad` radians about its own X axis. |
136
143
  | `rotateY<T extends QuatLike>(out: T, a: QuatLike, rad: number): T` | Turns the rotation `a` by `rad` radians about its own Y axis. |
137
144
  | `rotateZ<T extends QuatLike>(out: T, a: QuatLike, rad: number): T` | Turns the rotation `a` by `rad` radians about its own Z axis. |
138
- | `slerp<T extends QuatLike>(out: T, a: QuatLike, b: QuatLike, t: number): T` | The rotation a fraction `t` of the way from `a` to `b` along the shortest arc, turning at an even speed, as three.js's `slerp`. |
145
+ | `slerp<T extends QuatLike>(out: T, a: QuatLike, b: QuatLike, t: number): T` | The rotation a fraction `t` of the way from `a` to `b` along the shortest arc, turning at an even speed. |
139
146
  | `create(): [number, number, number, number]` | A new quaternion (0, 0, 0, 1), which turns nothing. It allocates, so create quaternions once, outside per-frame code. |
140
147
  | `set<T extends QuatLike>(out: T, x: number, y: number, z: number, w: number): T` | Sets the components of `out`. |
141
148
  | `copy<T extends QuatLike>(out: T, a: QuatLike): T` | Copies `a` into `out`. |
142
149
  | `identity<T extends QuatLike>(out: T): T` | Sets `out` to (0, 0, 0, 1), which turns nothing. |
143
- | `fromMat4<T extends QuatLike>(out: T, m: Mat4Like): T` | The rotation of the matrix `m`, whose upper 3 by 3 part must hold no scale, as three.js's `setFromRotationMatrix`. To read the rotation of a matrix with scale, use `mat4.decompose`. |
144
- | `lookAt<T extends QuatLike>(out: T, eye: Vec3Like, target: Vec3Like, up?: Vec3Like): T` | The rotation that turns an object at `eye` so that its +Z axis points at `target`, with its +Y axis as close to `up` as it can be, or to +Y without `up`. A mesh looks at a point this way, in null3D and in three.js. Cameras and lights look down their -Z axis instead: for them, swap `eye` and `target`. |
145
- | `rotationTo<T extends QuatLike>(out: T, a: Vec3Like, b: Vec3Like): T` | The shortest rotation that turns the direction `a` onto the direction `b`, as three.js's `setFromUnitVectors`. Both vectors must have length 1. |
146
- | `multiply<T extends QuatLike>(out: T, a: QuatLike, b: QuatLike): T` | The product of `a` and `b`, as three.js's `multiplyQuaternions`. It turns a vector by `b` first, then by `a`. |
147
- | `invert<T extends QuatLike>(out: T, a: QuatLike): T` | The rotation that undoes `a`, a quaternion of length 1, as three.js's `invert`. |
150
+ | `fromMat4<T extends QuatLike>(out: T, m: Mat4Like): T` | The rotation of the matrix `m`, whose upper 3 by 3 part must hold no scale. To read the rotation of a matrix with scale, use `mat4.decompose`. |
151
+ | `lookAt<T extends QuatLike>(out: T, eye: Vec3Like, target: Vec3Like, up?: Vec3Like): T` | The rotation that turns an object at `eye` so that its +Z axis points at `target`, with its +Y axis as close to `up` as it can be, or to +Y without `up`. A mesh's `lookAt` turns it this way. Cameras and lights look down their -Z axis instead: for them, swap `eye` and `target`. |
152
+ | `rotationTo<T extends QuatLike>(out: T, a: Vec3Like, b: Vec3Like): T` | The shortest rotation that turns the direction `a` onto the direction `b`. Both vectors must have length 1. |
153
+ | `multiply<T extends QuatLike>(out: T, a: QuatLike, b: QuatLike): T` | The product of `a` and `b`. It turns a vector by `b` first, then by `a`. |
154
+ | `invert<T extends QuatLike>(out: T, a: QuatLike): T` | The rotation that undoes `a`, a quaternion of length 1. |
148
155
  | `normalize<T extends QuatLike>(out: T, a: QuatLike): T` | Scales `a` to length 1. A zero quaternion becomes (0, 0, 0, 1). |
149
156
  | `dot(a: QuatLike, b: QuatLike): number` | The dot product of `a` and `b`. |
150
157
 
@@ -152,6 +159,8 @@ Rotations as quaternions (x, y, z, w) in plain arrays, with angles in radians: `
152
159
 
153
160
  Interface `QuatHelpers`.
154
161
 
162
+ Import from `@null3d/engine/math`.
163
+
155
164
  The quaternion helpers that `createMath` builds: the ones that turn by an angle. Each takes the same arguments as the `quat` helper of its name, and does the same arithmetic with the functions that `createMath` got.
156
165
 
157
166
  | Member | Description |
@@ -195,7 +204,7 @@ Vectors (x, y, z) in plain arrays, in the style of gl-matrix: `vec3.add(out, a,
195
204
  | `sub<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like): T` | Subtracts `b` from `a`. |
196
205
  | `multiply<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like): T` | Multiplies `a` and `b` component by component. |
197
206
  | `scale<T extends Vec3Like>(out: T, a: Vec3Like, s: number): T` | Multiplies `a` by the number `s`. |
198
- | `scaleAndAdd<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like, s: number): T` | Adds `b` times the number `s` to `a`, as three.js's `addScaledVector`. |
207
+ | `scaleAndAdd<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like, s: number): T` | Adds `b` times the number `s` to `a`. |
199
208
  | `negate<T extends Vec3Like>(out: T, a: Vec3Like): T` | Reverses the direction of `a`. |
200
209
  | `dot(a: Vec3Like, b: Vec3Like): number` | The dot product of `a` and `b`. |
201
210
  | `cross<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like): T` | The cross product of `a` and `b`: a vector at right angles to both. |
@@ -207,13 +216,15 @@ Vectors (x, y, z) in plain arrays, in the style of gl-matrix: `vec3.add(out, a,
207
216
  | `lerp<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like, t: number): T` | The point a fraction `t` of the way from `a` to `b`. |
208
217
  | `min<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like): T` | The smaller of `a` and `b` on each axis. |
209
218
  | `max<T extends Vec3Like>(out: T, a: Vec3Like, b: Vec3Like): T` | The larger of `a` and `b` on each axis. |
210
- | `transformQuat<T extends Vec3Like>(out: T, a: Vec3Like, q: QuatLike): T` | Turns `a` by the rotation `q`, a quaternion of length 1, as three.js's `applyQuaternion`. |
211
- | `transformMat4<T extends Vec3Like>(out: T, a: Vec3Like, m: Mat4Like): T` | Transforms the point `a` by the matrix `m`, with the perspective divide, as three.js's `applyMatrix4`. |
219
+ | `transformQuat<T extends Vec3Like>(out: T, a: Vec3Like, q: QuatLike): T` | Turns `a` by the rotation `q`, a quaternion of length 1. |
220
+ | `transformMat4<T extends Vec3Like>(out: T, a: Vec3Like, m: Mat4Like): T` | Transforms the point `a` by the matrix `m`, with the perspective divide. |
212
221
 
213
222
  ## `Vec3Helpers`
214
223
 
215
224
  Interface `Vec3Helpers`.
216
225
 
226
+ Import from `@null3d/engine/math`.
227
+
217
228
  The vector helper that `createMath` builds, with the same arguments and arithmetic as `vec3.angle`.
218
229
 
219
230
  | Member | Description |
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/objects
3
3
  title: "Objects and transforms: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Objects and transforms API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -25,19 +24,19 @@ A drawn object: a mesh and a material.
25
24
  | Member | Description |
26
25
  | --- | --- |
27
26
  | `readonly shaderId: number` | The number that a custom material's WGSL reads as `object.id` for this mesh. No other live mesh or batch has it. Pass it to a uniform to pick out this mesh in a shader. It is 0 once the mesh is destroyed. |
28
- | `setMorphWeight(target: number \| string, weight: number): void` | Sets how far the mesh moves toward one of its morph targets, from the next frame: 0 keeps the target's shape out, 1 adds all of it, and other numbers scale it. Like setting three.js's `morphTargetInfluences[target]`. `target` is the target's number, from 0, or its name. A clip that animates the weight blends its own value with this one while it plays, as three.js's mixer does, and this one holds when no clip moves it. A WebGL2 device draws a preset's count of each mesh's largest weights (the `morphTargets` quality setting). Throws E1218 for a target that the mesh does not have, and E1203 for a weight that is not a finite number. |
27
+ | `setMorphWeight(target: number \| string, weight: number): void` | Sets how far the mesh moves toward one of its morph targets, from the next frame: 0 keeps the target's shape out, 1 adds all of it, and other numbers scale it. `target` is the target's number, from 0, or its name. A clip that animates the weight blends its own value with this one while it plays, and this one holds when no clip moves it. A WebGL2 device draws a preset's count of each mesh's largest weights (the `morphTargets` quality setting). Throws E1218 for a target that the mesh does not have, and E1203 for a weight that is not a finite number. |
29
28
  | `getMorphWeight(target: number \| string): number` | The weight of one of the mesh's morph targets, as `setMorphWeight` or the model's file set it, without what a playing clip adds. Throws E1218 for a target that the mesh does not have. |
30
29
  | `destroy(): void` | Removes the object at the next frame, and frees its morph weights. Its children become roots. |
31
30
  | `setMaterial(material: Material): void` | Changes the material from the next frame. |
32
31
  | `setMesh(mesh: MeshGeometry): void` | Changes the shape from the next frame. The mesh's bounds replace the object's, so call `setBounds` again after this when the object needs bounds of its own. |
33
- | `setCastShadows(cast: boolean): void` | Makes the mesh cast the shadows of a directional light, or stop. The default is false. A change rebuilds the engine's tables of what it draws, as a new material does. |
32
+ | `setCastShadows(cast: boolean): void` | Makes the mesh cast the shadows of the lights that cast them, or stop. The default is false. A change rebuilds the engine's tables of what it draws, as a new material does. |
34
33
  | `setReceiveShadows(receive: boolean): void` | Makes shadows fall on the mesh, or stop. The default is false. Unlit materials show no shadows. A change rebuilds the engine's tables of what it draws, as a new material does. |
35
- | `setOutlined(outlined: boolean): void` | Draws an outline around the mesh, or stops, as adding it to three.js's `OutlinePass.selectedObjects` does. The outline shows while `post.set({ outline })` turns outlines on, and every outlined mesh takes its settings. The default is false. A change rebuilds the engine's tables of what it draws, as a new material does. |
34
+ | `setOutlined(outlined: boolean): void` | Draws an outline around the mesh, or stops. The outline shows while `post.set({ outline })` turns outlines on, and every outlined mesh takes its settings. The default is false. A change rebuilds the engine's tables of what it draws, as a new material does. |
36
35
  | `setOccluder(occluder: boolean): void` | Makes the mesh block the view, or keeps it from blocking. On WebGL2, while the `softwareOcclusion` quality setting is on, the job workers draw each blocker into a small depth buffer every frame, and the engine skips every object that lies wholly behind the blockers. Only meshes marked true block there, and the meshes of a model file that the asset tool gave blockers. Mark large, solid meshes that hide much of the scene, such as buildings and walls, whose mesh has at most 4,096 triangles. A mesh that the asset tool gave a blocker draws that blocker instead, a few boxes inside the mesh, whatever the mesh's own size. A blocker's mesh must lie inside what the object draws, as the object's own mesh does. On WebGPU, while the `gpuOcclusion` setting is on, every opaque mesh may block without a mark: the GPU draws the depth of those that showed in the last frame and look large on the screen, and skips every object wholly behind them. False keeps the mesh from blocking there too. Objects that blend, cut holes with an alpha mask or use a custom material never block, whatever this says, nor do skinned ones on WebGL2. A change needs no rebuild of the engine's tables. |
37
- | `setRenderOrder(order: number): void` | Sets the order in which the mesh draws among blended objects, lower first, as three.js's `renderOrder`. Objects of one order draw farthest first. The default is 0. The engine orders opaque and masked objects itself. |
38
- | `setLevelBias(bias: number): void` | Raises or lowers the threshold that picks this mesh's levels of detail, as Godot's `lod_bias` does. A bias above 1 makes every switch happen nearer, so the object draws coarser levels. A bias below 1 keeps its detail, which a hero object wants. The bias multiplies the threshold of the level switches and of the distance at which the object hides, so both move by the same factor. The default is 1. The object's mesh needs levels (`setLevels`). A change rebuilds the engine's tables of what it draws, as a new material does. Throws E1108 for a bias that is not a number above 0. |
36
+ | `setRenderOrder(order: number): void` | Sets the order in which the mesh draws among blended objects, lower first. Objects of one order draw farthest first. The default is 0. The engine orders opaque and masked objects itself. |
37
+ | `setLevelBias(bias: number): void` | Raises or lowers the threshold that picks this mesh's levels of detail, as the inverse of Godot's `lod_bias`: a Godot bias of 2 is about a null3D bias of 0.5. A bias above 1 makes every switch happen nearer, so the object draws coarser levels. A bias below 1 keeps its detail, which a hero object wants. The bias multiplies the threshold of the level switches and of the distance at which the object hides, so both move by the same factor. The default is 1. The object's mesh needs levels (`setLevels`). A change rebuilds the engine's tables of what it draws, as a new material does. Throws E1108 for a bias that is not a number above 0. |
39
38
  | `setDrawRange(start: number, end: number): void` | Sets the distances between which the mesh draws, as Godot's visibility range and Bevy's `VisibilityRange` do: nothing nearer than `start`, which is 0 for none, and nothing past `end`, which is `Infinity` for none. Each edge fades over a short band, so a mesh that fades in or out does not pop. A mesh whose bounds leave the range costs no draw at all. The default draws at every distance. The `lodFade` quality setting turns the bands off on Low. Throws E1108 for a range that is not two numbers with 0 <= start < end. |
40
- | `setFrustumCulled(culled: boolean): void` | With false, the engine draws the mesh even where its bounds are out of view, as three.js's `frustumCulled = false` does. The default is true. For vertices that a shader moves, larger bounds from `setBounds` cost less. |
39
+ | `setFrustumCulled(culled: boolean): void` | With false, the engine draws the mesh even where its bounds are out of view. The default is true. For vertices that a shader moves, larger bounds from `setBounds` cost less. |
41
40
 
42
41
  ## `Object3D`
43
42
 
@@ -52,18 +51,18 @@ A node in the scene: position, rotation and scale, a parent, visibility.
52
51
  | `setPosition(x: number, y: number, z: number): void` | Sets the position relative to the parent. |
53
52
  | `setPose(position: Vec3Like, rotation?: QuatLike): void` | Sets the position and, when `rotation` is given, the rotation (a quaternion, x y z w), each from an array of numbers. A caller that keeps a pose in arrays of its own writes it this way: passing an array crosses the call without a number, where a number passed to a setter that the browser does not inline becomes an object of its own. The controls write a camera's pose so in every frame. |
54
53
  | `setRotation(x: number, y: number, z: number, w: number): void` | Sets the rotation as a quaternion (x, y, z, w). |
55
- | `setRotationEuler(x: number, y: number, z: number, order: EulerOrder = 'XYZ'): void` | Sets the rotation from Euler angles in radians, with three.js's axis order names. |
54
+ | `setRotationEuler(x: number, y: number, z: number, order: EulerOrder = 'XYZ'): void` | Sets the rotation from Euler angles in radians, turned about the axes in `order`. |
56
55
  | `setScale(x: number, y: number, z: number): void` | Sets the scale on each axis. |
57
56
  | `lookAt(x: number, y: number, z: number): void` | Turns the object toward a point. It assumes the object's parents are not rotated. |
58
57
  | `rotateX(angle: number): void` | Turns the object by `angle` radians about its own X axis. |
59
58
  | `rotateY(angle: number): void` | Turns the object by `angle` radians about its own Y axis. |
60
59
  | `rotateZ(angle: number): void` | Turns the object by `angle` radians about its own Z axis. |
61
- | `translate(x: number, y: number, z: number): void` | Moves the object by (x, y, z) along its own axes, as three.js's `translateX`, `translateY` and `translateZ` do together. The object's rotation turns the vector, and its scale leaves it as it is, so `translate(0, 0, -1)` moves a camera 1 m forward. |
60
+ | `translate(x: number, y: number, z: number): void` | Moves the object by (x, y, z) along its own axes. The object's rotation turns the vector, and its scale leaves it as it is, so `translate(0, 0, -1)` moves a camera 1 m forward. |
62
61
  | `getPosition(out: Vec3Like): void` | Copies the position relative to the parent into `out`. |
63
62
  | `getRotation(out: QuatLike): void` | Copies the rotation relative to the parent into `out`, as a quaternion (x, y, z, w). |
64
63
  | `getWorldPosition(out: Vec3Like): void` | Copies the world position of the frame that last ran into `out`. |
65
64
  | `getWorldQuaternion(out: QuatLike): void` | Copies the world rotation of the frame that last ran into `out`, as a quaternion (x, y, z, w). It is the rotation part of the world matrix, which `mat4.decompose` splits off. |
66
- | `getWorldMatrix(out: Mat4Like): void` | Copies the world matrix of the frame that last ran into `out`: 16 numbers, column by column, as `mat4` and three.js's `matrixWorld` hold them. Its translation keeps full precision far from the origin when `out` is a plain array or a `Float64Array`. |
65
+ | `getWorldMatrix(out: Mat4Like): void` | Copies the world matrix of the frame that last ran into `out`: 16 numbers, column by column, as `mat4` holds them. Its translation keeps full precision far from the origin when `out` is a plain array or a `Float64Array`. |
67
66
  | `setParent(parent: Object3D \| null, options?: ParentOptions): void` | Moves the object under another, or to the root with null, from the next frame. By default it keeps its position, rotation and scale relative to the parent, so its place in the world changes with the new parent. With `keepWorld: true` it keeps its place in the world instead. |
68
67
  | `getParent(): Object3D \| null` | The object's parent, or null for a root object. A destroyed parent leaves the object a root object. |
69
68
  | `setVisible(visible: boolean): void` | Hides or shows the object and everything under it. |
@@ -84,7 +83,7 @@ Options for `setParent`.
84
83
 
85
84
  | Member | Description |
86
85
  | --- | --- |
87
- | `keepWorld?: boolean` | True keeps the object's place, rotation and size in the world, as three.js's `attach` does: the engine gives it the position, rotation and scale that do that under the new parent. The default, false, keeps the values relative to the parent, as three.js's `add` does. |
86
+ | `keepWorld?: boolean` | True keeps the object's place, rotation and size in the world: the engine gives it the position, rotation and scale that do that under the new parent. The default, false, keeps the values relative to the parent. |
88
87
 
89
88
  ## `Quat`
90
89
 
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/particles
3
3
  title: "Particles (@null3d/particles): API reference"
4
- status: generated
5
- since: "0.2"
4
+ generated: true
6
5
  summary: "Every export of the Particles (@null3d/particles) API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -16,6 +15,8 @@ summary: "Every export of the Particles (@null3d/particles) API, from the engine
16
15
  function createParticles(context: SketchContext, options: ParticleSystemOptions): Promise<ParticleSystem>
17
16
  ```
18
17
 
18
+ Import from `@null3d/particles`.
19
+
19
20
  Makes a particle system in the sketch's scene: an emitter, and the engine's particle buffer that it fills. Call the system's `update()` once per frame in `onLateUpdate`. The first system downloads the engine's particle code. Throws E1108 for a capacity out of range, and E1406 when the particle code does not download.
20
21
 
21
22
  ## `EmitterShape`
@@ -29,13 +30,19 @@ type EmitterShape =
29
30
  | { type: 'disc'; radius: number; };
30
31
  ```
31
32
 
32
- Where an emitter's particles are born, in its own space, and which way they set off. A `point` emits at the emitter, along `direction`. A `sphere` emits inside a ball of `radius`, or on its surface with `surface`, and sends particles outward. A `cone` emits on a disc of `radius` across the emitter's +y axis. It sends particles up within `angle` radians of that axis, as a fountain or a flame does. A `box` emits inside a box of `size`, centered on the emitter, along `direction`. A `disc` emits on a disc of `radius` across the +y axis, along `direction`.
33
+ Import from `@null3d/particles`.
34
+
35
+ Where an emitter's particles are born, in its own space, and which way they set off. A `point` emits at the emitter, along `direction`. A `sphere` emits inside a ball of `radius`, or on its surface with `surface`, and sends particles outward.
36
+
37
+ A `cone` emits on a disc of `radius` across the emitter's +y axis. It sends particles up within `angle` radians of that axis, as a fountain or a flame does. A `box` emits inside a box of `size`, centered on the emitter, along `direction`. A `disc` emits on a disc of `radius` across the +y axis, along `direction`.
33
38
 
34
39
  ## `ParticleBuffer`
35
40
 
36
41
  Class `ParticleBuffer`.
37
42
 
38
- A particle buffer: a scene object that draws a quad for each live particle record. The particles add-on's emitters write records into it. Write a particle's record once, when it is born, with `write`, or write a frame's births in one call with `writeRecords`. The GPU moves it and changes its look as it ages, as the buffer's values say. It stops drawing the particle at the end of its lifetime. Once per frame, write the buffer's time and the records the GPU reads into `frame`, and call `commit`. Every call takes typed arrays and whole numbers, so a frame's calls allocate nothing.
43
+ A particle buffer: a scene object that draws a quad for each live particle record. The particles add-on's emitters write records into it. Write a particle's record once, when it is born, with `write`, or write a frame's births in one call with `writeRecords`. The GPU moves it and changes its look as it ages, as the buffer's values say. It stops drawing the particle at the end of its lifetime.
44
+
45
+ Once per frame, write the buffer's time and the records the GPU reads into `frame`, and call `commit`. Every call takes typed arrays and whole numbers, so a frame's calls allocate nothing.
39
46
 
40
47
  | Member | Description |
41
48
  | --- | --- |
@@ -76,6 +83,8 @@ Options of `scene.createParticleBuffer`.
76
83
 
77
84
  Interface `ParticleBurst`.
78
85
 
86
+ Import from `@null3d/particles`.
87
+
79
88
  A burst: `count` particles at once, at `time` seconds after the system starts, then every `interval` seconds, `cycles` times in all.
80
89
 
81
90
  | Member | Description |
@@ -130,7 +139,9 @@ type ParticleEmitterShape =
130
139
  | { type: 'disc'; radius: number; };
131
140
  ```
132
141
 
133
- Where an emitter's particles are born, in its own space, and which way they set off. A `point` emits at the emitter, along `direction`. A `sphere` emits inside a ball of `radius`, or on its surface with `surface`, and sends particles outward. A `cone` emits on a disc of `radius` across the emitter's +y axis. It sends particles up within `angle` radians of that axis. A `box` emits inside a box of `size`, centered on the emitter, along `direction`. A `disc` emits on a disc of `radius` across the +y axis, along `direction`.
142
+ Where an emitter's particles are born, in its own space, and which way they set off. A `point` emits at the emitter, along `direction`. A `sphere` emits inside a ball of `radius`, or on its surface with `surface`, and sends particles outward.
143
+
144
+ A `cone` emits on a disc of `radius` across the emitter's +y axis. It sends particles up within `angle` radians of that axis. A `box` emits inside a box of `size`, centered on the emitter, along `direction`. A `disc` emits on a disc of `radius` across the +y axis, along `direction`.
134
145
 
135
146
  ## `ParticleEmitterSub`
136
147
 
@@ -227,12 +238,16 @@ How the particles of a buffer move: closed-form motion that the GPU works out at
227
238
  type ParticleRange = number | readonly [number, number];
228
239
  ```
229
240
 
241
+ Import from `@null3d/particles`.
242
+
230
243
  A number, or the smallest and the largest of a random number.
231
244
 
232
245
  ## `ParticleSystem`
233
246
 
234
247
  Class `ParticleSystem`.
235
248
 
249
+ Import from `@null3d/particles`.
250
+
236
251
  A particle system: an emitter that fills a particle buffer. `createParticles` makes one. Call `update()` once per frame, in `onLateUpdate`, where objects' world places are the frame's.
237
252
 
238
253
  | Member | Description |
@@ -249,7 +264,9 @@ A particle system: an emitter that fills a particle buffer. `createParticles` ma
249
264
 
250
265
  ## `ParticleSystemOptions`
251
266
 
252
- Interface `ParticleSystemOptions`, which extends `Omit`.
267
+ Interface `ParticleSystemOptions`, which extends `Omit<ParticleBufferOptions, 'capacity'>`.
268
+
269
+ Import from `@null3d/particles`.
253
270
 
254
271
  Options of `createParticles`: the emitter, then the engine's particle buffer options, which give the motion and the look.
255
272
 
@@ -277,6 +294,8 @@ Options of `createParticles`: the emitter, then the engine's particle buffer opt
277
294
 
278
295
  Interface `ParticleTexture`.
279
296
 
297
+ Import from `@null3d/particles`.
298
+
280
299
  A particle texture made in code, and its flipbook, which `createParticles` takes in its options: `{ ...particleTextures.smoke(textures), ... }`.
281
300
 
282
301
  | Member | Description |
@@ -288,6 +307,8 @@ A particle texture made in code, and its flipbook, which `createParticles` takes
288
307
 
289
308
  Interface `ParticleTextureOptions`.
290
309
 
310
+ Import from `@null3d/particles`.
311
+
291
312
  Options of the particle textures made in code.
292
313
 
293
314
  | Member | Description |
@@ -301,6 +322,8 @@ Options of the particle textures made in code.
301
322
  const particleTextures: { glow(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; spark(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; smoke(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; flame(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; rain(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; leaves(textures: Textures, options?: ParticleTextureOptions): ParticleTexture; }
302
323
  ```
303
324
 
325
+ Import from `@null3d/particles`.
326
+
304
327
  Particle textures made in code. Each takes the sketch's `textures` and returns a texture with its flipbook.
305
328
 
306
329
  ## `ParticleValues`
@@ -326,6 +349,8 @@ A field of air that a buffer's particles sample: a texture of the air, the box t
326
349
 
327
350
  Interface `SubEmitter`.
328
351
 
352
+ Import from `@null3d/particles`.
353
+
329
354
  A sub-emitter: another system that bursts where a particle of this system dies or first meets the ground. A firework's rocket bursts into sparks this way, and a raindrop splashes.
330
355
 
331
356
  | Member | Description |
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/points
3
3
  title: "Points: API reference"
4
- status: generated
5
- since: "0.2"
4
+ generated: true
6
5
  summary: "Every export of the Points API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -14,7 +13,7 @@ summary: "Every export of the Points API, from the engine's doc comments."
14
13
 
15
14
  Class `PointBatch`.
16
15
 
17
- Many points: squares that face the camera, all of one size, each with its own position and color, like three.js's `Points` with a `PointsMaterial`. Write points straight into the typed arrays, as for an instance batch. A dynamic batch updates every point every frame, and a static batch updates the points you mark dirty.
16
+ Many points: squares that face the camera, all of one size, each with its own position and color. Write points straight into the typed arrays, as for an instance batch. A dynamic batch updates every point every frame, and a static batch updates the points you mark dirty.
18
17
 
19
18
  | Member | Description |
20
19
  | --- | --- |
@@ -32,21 +31,21 @@ Many points: squares that face the camera, all of one size, each with its own po
32
31
 
33
32
  ## `PointOptions`
34
33
 
35
- Interface `PointOptions`, which extends `PointValues`, `Omit`.
34
+ Interface `PointOptions`, which extends `PointValues`, `Omit<MaterialFeatures, 'doubleSided' | 'vertexColors'>`.
36
35
 
37
- Options of `scene.createPoints`. The look of the points takes the options of an unlit material. Points are opaque by default, as three.js's `PointsMaterial` is.
36
+ Options of `scene.createPoints`. The look of the points takes the options of an unlit material. Points are opaque by default.
38
37
 
39
38
  | Member | Description |
40
39
  | --- | --- |
41
40
  | `positions: ArrayLike<number>` | The points: 3 numbers each. Their number is the batch's capacity, which never changes, and `points.positions` holds them after the call. |
42
41
  | `colors?: ArrayLike<number>` | Linear colors that multiply `color`: 3 numbers per point (RGB), or 4 (RGBA). The default is white. |
43
42
  | `size?: number` | The width and height of every point: world units, or CSS pixels without size attenuation. The default is 1. |
44
- | `sizeAttenuation?: boolean` | True gives the size in world units, so far points look smaller. False gives it in CSS pixels, so every point keeps its size on screen, as three.js's `sizeAttenuation: false` does. The default is true. |
43
+ | `sizeAttenuation?: boolean` | True gives the size in world units, so far points look smaller. False gives it in CSS pixels, so every point keeps its size on screen. The default is true. |
45
44
  | `map?: Texture` | A color map, in sRGB, that each point shows whole and upright, and whose color multiplies the point's. It is fixed when the batch is created. |
46
45
  | `dynamic?: boolean` | Every point updates and uploads every frame; a static batch updates points marked dirty only. |
47
46
  | `layers?: number` | The layers every point is on, as a 32-bit mask. The default, 1, is layer 0. |
48
47
  | `origin?: Vec3` | The point that every point's position is relative to, as an instance batch's `origin`. The default is (0, 0, 0). Points near it keep the precision of 32-bit floats at any distance from the world's origin. |
49
- | `alphaMode?: MaterialFeatures['alphaMode']` | How the points use their alpha. The default is `opaque`, as three.js's points are. |
48
+ | `alphaMode?: MaterialFeatures['alphaMode']` | How the points use their alpha. The default is `opaque`. |
50
49
 
51
50
  ## `PointValues`
52
51
 
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/post
3
3
  title: "Post-processing API: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Post-processing API API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -14,17 +13,17 @@ summary: "Every export of the Post-processing API API, from the engine's doc com
14
13
 
15
14
  Interface `AoSettings`.
16
15
 
17
- Ambient occlusion's settings, with the meanings of three.js's `GTAOPass`. A setting that a call leaves out keeps its value.
16
+ Ambient occlusion's settings, for ground-truth ambient occlusion (GTAO). A setting that a call leaves out keeps its value.
18
17
 
19
18
  | Member | Description |
20
19
  | --- | --- |
21
- | `radius?: number` | How far from a surface the search for what hides it reaches, in world units: 0 or more, and 0.25 by default, as `GTAOPass`'s `radius`. |
20
+ | `radius?: number` | How far from a surface the search for what hides it reaches, in world units: 0 or more, and 0.25 by default. |
22
21
  | `thickness?: number` | How far in front of a surface, along the view, an object still hides it, in world units: 0 or more, and 1 by default. Objects farther in front cast no occlusion, so a thin pole does not darken the wall far behind it. |
23
22
  | `distanceExponent?: number` | How the search's steps spread over the radius: 1 spreads them evenly, the default, and higher values gather them near the surface. It is above 0. |
24
- | `distanceFalloff?: number` | From 0 to 1: how much less the farther steps of the search count. It is 1 by default, as `GTAOPass`'s `distanceFallOff`. |
23
+ | `distanceFalloff?: number` | From 0 to 1: how much less the farther steps of the search count. It is 1 by default. |
25
24
  | `scale?: number` | The power that the occlusion is raised to: 0 or more, and 1 by default. Above 1 it darkens. |
26
25
  | `samples?: number` | The depth samples that each pixel's search reads: a whole number from 1 to 64, and 16 by default. Below 30 they spread over 3 directions, and from 30 over 5. |
27
- | `intensity?: number` | From 0 to 1: how much of the occlusion reaches the ambient light. It is 1 by default, as `GTAOPass`'s `blendIntensity`. |
26
+ | `intensity?: number` | From 0 to 1: how much of the occlusion reaches the ambient light. It is 1 by default. |
28
27
 
29
28
  ## `AutoExposureSettings`
30
29
 
@@ -49,7 +48,7 @@ Automatic exposure's settings. The engine meters the scene's brightness on the G
49
48
  type BloomBlend = 'mix' | 'add' | 'screen';
50
49
  ```
51
50
 
52
- How bloom's glow meets the scene's color. The `'mix'` blend moves each pixel's color toward the glow by the intensity, which keeps the image's total light. The `'add'` blend adds the glow, as three.js's `UnrealBloomPass` does. The `'screen'` blend screens it, as pmndrs's `BloomEffect` does.
51
+ How bloom's glow meets the scene's color. The `'mix'` blend moves each pixel's color toward the glow by the intensity, which keeps the image's total light. The `'add'` blend adds the glow, so the image gains light. The `'screen'` blend screens it, so the glow adds less where the scene is already bright.
53
52
 
54
53
  ## `BloomSettings`
55
54
 
@@ -116,7 +115,7 @@ How automatic exposure averages the scene's brightness. `'mean'` takes the weigh
116
115
 
117
116
  Interface `GradingSettings`.
118
117
 
119
- The grading controls that `post.set` takes: white balance, then lift, gamma and gain on each channel, then saturation, then split toning. A job worker bakes them into a table of 32 texels a side, which the final pass reads on every GPU path. A setting that a call leaves out keeps its value; `false` turns the grading off.
118
+ The grading controls that `post.set` takes: white balance, then saturation, then lift, gamma and gain on each channel, then split toning. A job worker bakes them into a table of 32 texels a side, which the final pass reads on every GPU path. A setting that a call leaves out keeps its value; `false` turns the grading off.
120
119
 
121
120
  | Member | Description |
122
121
  | --- | --- |
@@ -162,17 +161,17 @@ Settings for `post.set`. A setting that the call leaves out keeps its value.
162
161
 
163
162
  | Member | Description |
164
163
  | --- | --- |
165
- | `toneMapping?: ToneMapping \| ToneCurve` | How the engine maps high dynamic range color to the screen: a built-in curve's name, or a custom tone curve's WGSL. The default is `'agx-punchy'`, which keeps the hues of bright colors on their way to white and keeps the picture's contrast. three.js uses no tone mapping by default, so a port of a three.js scene without it sets `'none'`. A custom curve needs HDR color, as bloom does; on a device without an HDR target the built-in curve stays. |
166
- | `exposure?: number` | Scales the scene's color before the tone mapping, as three.js's `toneMappingExposure` does: 2 is one stop brighter, and 0.5 one stop darker. It is 0 or more, and 1 by default. With `ev100`, it scales the camera's exposure, as exposure compensation does. |
167
- | `ev100?: number \| false` | The camera's exposure value at ISO 100, for lights in real units: 15 suits a sunny day lit by a sun of 100,000 lux, 12 an overcast day, and 7 a lit room. It scales the scene's color by 1 / (1.2 × 2^ev100), as Filament and Bevy do, so each step up is one stop darker. It is a number from -20 to 30, and `false`, the default, turns it off, which leaves three.js's units. |
164
+ | `toneMapping?: ToneMapping \| ToneCurve` | How the engine maps high dynamic range color to the screen: a built-in curve's name, or a custom tone curve's WGSL. The default is `'agx-punchy'`, which keeps the hues of bright colors on their way to white and keeps the picture's contrast. A custom curve needs HDR color, as bloom does; on a device without an HDR target the built-in curve stays. |
165
+ | `exposure?: number` | Scales the scene's color before the tone mapping: 2 is one stop brighter, and 0.5 one stop darker. It is 0 or more, and 1 by default. With `ev100`, it scales the camera's exposure, as exposure compensation does. |
166
+ | `ev100?: number \| false` | The camera's exposure value at ISO 100, for lights in real units: 15 suits a sunny day lit by a sun of 100,000 lux, 12 an overcast day, and 7 a lit room. It scales the scene's color by 1 / (1.2 × 2^ev100), as Filament and Bevy do, so each step up is one stop darker. It is a number from -20 to 30. The default, `false`, turns it off, for scenes whose lights have small intensities, such as a sun of 3. |
168
167
  | `bloom?: BloomSettings \| false` | Light that spreads from the bright parts of the scene through a chain of blurred levels. Settings turn bloom on, `{}` with the values it had, and `false` turns it off. It is off by default. Its glow keeps its size as a share of the canvas at any pixel ratio and render scale. |
169
- | `ao?: AoSettings \| false` | Ambient occlusion: darkens the ambient light where nearby surfaces hide a surface from the sky, as three.js's `GTAOPass` finds it. It darkens only the light that comes from all around, where `GTAOPass` darkens the whole image. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default, and draws only where the quality setting `aoScale` is above 0. |
170
- | `lut?: Lut \| false` | A color grading table from `assets.loadLut` or `assets.lutFromData`, which maps each pixel's color after the tone mapping, as three.js's `LUTPass` does. `false` turns it off. It is off by default. |
171
- | `lutIntensity?: number` | The share of the table's color in each pixel, from 0 for none to 1 for all of it, as `LUTPass`'s `intensity`. It is 1 by default. |
168
+ | `ao?: AoSettings \| false` | Ambient occlusion: darkens the ambient light where nearby surfaces hide a surface from the sky, found with ground-truth ambient occlusion (GTAO). It darkens only the light that comes from all around, so direct light keeps its strength. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default, and draws only where the quality setting `aoScale` is above 0. |
169
+ | `lut?: Lut \| false` | A color grading table from `assets.loadLut` or `assets.lutFromData`, which maps each pixel's color after the tone mapping. `false` turns it off. It is off by default. |
170
+ | `lutIntensity?: number` | The share of the table's color in each pixel, from 0 for none to 1 for all of it. It is 1 by default. |
172
171
  | `grading?: GradingSettings \| false` | The grading controls: white balance, lift, gamma, gain, saturation and split toning, which a job worker bakes into a table of 32 texels a side. The final pass grades each pixel's display color with the table after the tone mapping, so changing a value costs no frame work. The picture shows the new grade once the worker has baked the table. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default. |
173
172
  | `vignette?: VignetteSettings \| false` | Darkens the picture toward its edges. Settings turn the vignette on, `{}` with the values it had, and `false` turns it off. It is off by default. |
174
173
  | `outline?: OutlineSettings \| false` | A sharp line around the objects that `setOutlined(true)` marks. Settings turn outlines on, `{}` with the values they had, and `false` turns them off. They are off by default. |
175
- | `dof?: DofSettings \| false` | Depth of field: blurs what lies in front of and behind the focus distance, as a camera lens does, with the near and far fields apart, as three.js's `BokehPass` intends. It runs after the custom effects and before bloom. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default, and draws only where the quality setting `dofSamples` is above 0. |
174
+ | `dof?: DofSettings \| false` | Depth of field: blurs what lies in front of and behind the focus distance, as a camera lens does. The near and far fields blur apart. It runs after the custom effects and before bloom. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default, and draws only where the quality setting `dofSamples` is above 0. |
176
175
  | `ssr?: SsrSettings \| false` | Screen-space reflections: shiny opaque surfaces reflect what the screen shows along their mirror direction, blurred by their roughness, in place of the environment's reflection. They fade into the environment's light where the screen holds no hit, as near its edges, so wet streets, polished floors and metal reflect the scene around them. Settings turn them on, `{}` with the values they had, and `false` turns them off. They are off by default, and draw only where the quality setting `ssrScale` is above 0. A planar reflection pass's reflection wins on its plane. |
177
176
  | `autoExposure?: AutoExposureSettings \| false` | Automatic exposure: the picture adapts to the scene's brightness over time, as an eye does, so a dark hall brightens after a sunny street. The engine meters each frame on the GPU, and the final pass multiplies the color by the adapted exposure before the tone mapping. The scene draws at the camera's `exposure` and `ev100`, and the eye adapts from there. Settings turn it on, `{}` with the values it had, and `false` turns it off. It is off by default. It needs HDR color, as bloom does. |
178
177
  | `sharpen?: number \| false` | Sharpens edges and fine detail: a share from 0 for none to 1 for the most, or `false` to turn it off. It is off by default, and 0.5 is a good start. The engine sharpens the display color after the tone mapping, so bright edges cannot gain rings the way sharpened light does. It draws at the whole canvas's render scale; below one, the upscale sharpens the image itself. See the post-processing concepts page. |
@@ -194,13 +193,13 @@ The colors that tint the shadows and the highlights, and where the split between
194
193
 
195
194
  Interface `SsrSettings`.
196
195
 
197
- Screen-space reflections' settings, with the meanings of three.js's `SSRPass`. A setting that a call leaves out keeps its value.
196
+ Screen-space reflections' settings. A setting that a call leaves out keeps its value.
198
197
 
199
198
  | Member | Description |
200
199
  | --- | --- |
201
- | `intensity?: number` | From 0 to 1: how much of the environment's reflection the screen's reflection replaces where a ray hits, and 1 by default, as `SSRPass`'s `opacity`. The material's Fresnel term, metalness and specular values still weigh the reflection. |
202
- | `maxDistance?: number` | How far a reflected ray travels, in world units: above 0, and 100 by default, as `SSRPass`'s `maxDistance`. Reflections fade out over the last fifth of it. |
203
- | `thickness?: number` | How far behind a surface on the screen a ray may pass and still hit it, in world units: 0 or more, and 0.5 by default, as `SSRPass`'s `thickness`. Thin objects need a small value, or objects behind them reflect as if they were solid. |
200
+ | `intensity?: number` | From 0 to 1: how much of the environment's reflection the screen's reflection replaces where a ray hits, and 1 by default. The material's Fresnel term, metalness and specular values still weigh the reflection. |
201
+ | `maxDistance?: number` | How far a reflected ray travels, in world units: above 0, and 100 by default. Reflections fade out over the last fifth of it. |
202
+ | `thickness?: number` | How far behind a surface on the screen a ray may pass and still hit it, in world units. It is 0 or more, and 0.5 by default. Thin objects need a small value, or objects behind them reflect as if they were solid. |
204
203
  | `maxRoughness?: number` | The roughest surface that shows screen-space reflections, from 0 to 1, and 0.5 by default. Rougher surfaces keep the environment's reflection. Reflections fade out from 70% of it, and blur more on rougher surfaces. |
205
204
 
206
205
  ## `ToneCurve`
@@ -217,7 +216,9 @@ A custom tone curve: WGSL that declares `fn toneCurve(color: vec3f) -> vec3f`, c
217
216
  type ToneMapping = 'agx' | 'agx-punchy' | 'neutral' | 'aces' | 'none';
218
217
  ```
219
218
 
220
- How the engine maps the scene's high dynamic range color to the screen. Three curves use three.js's formulas: `AgXToneMapping` (`'agx'`), `NeutralToneMapping` (`'neutral'`) and `ACESFilmicToneMapping` (`'aces'`). `'agx-punchy'` is AgX with Filament's punchy look, which adds contrast and color. `'aces'` serves ports of three.js scenes that set it. The value `'none'` clips the exposed color at 1, as `LinearToneMapping` does.
219
+ How the engine maps the scene's high dynamic range color to the screen. The `'agx'` curve is AgX, the curve of Blender and Filament. The `'agx-punchy'` curve is AgX with Filament's punchy look, which adds contrast and color. The `'neutral'` curve is Khronos PBR Neutral, which keeps base colors as they are until they near white. The `'aces'` curve is a fit of the ACES filmic curve, which first scales the color by 1 / 0.6 and shifts the hues of bright colors.
220
+
221
+ The value `'none'` clips the exposed color at 1.
221
222
 
222
223
  ## `VignetteSettings`
223
224