@null3d/engine 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (311) hide show
  1. package/README.md +109 -0
  2. package/THIRD-PARTY-NOTICES.txt +0 -1
  3. package/dist/wasm/single/null3d.js +19 -6
  4. package/dist/wasm/single/null3d_bg.wasm +0 -0
  5. package/dist/wasm/threaded/null3d.js +19 -6
  6. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  7. package/docs/api/animation.md +23 -67
  8. package/docs/api/assets.md +42 -26
  9. package/docs/api/cameras.md +8 -6
  10. package/docs/api/controls.md +46 -44
  11. package/docs/api/debug.md +13 -8
  12. package/docs/api/engine.md +17 -11
  13. package/docs/api/feature-draws.md +3 -3
  14. package/docs/api/feature-effects.md +3 -3
  15. package/docs/api/feature-instances.md +2 -2
  16. package/docs/api/features.md +14 -15
  17. package/docs/api/geometry.md +56 -75
  18. package/docs/api/grass.md +1 -1
  19. package/docs/api/impostors.md +120 -9
  20. package/docs/api/input.md +4 -11
  21. package/docs/api/lights.md +14 -38
  22. package/docs/api/lines.md +8 -25
  23. package/docs/api/materials.md +69 -70
  24. package/docs/api/math.md +6 -7
  25. package/docs/api/objects.md +13 -13
  26. package/docs/api/particles.md +2 -14
  27. package/docs/api/points.md +3 -25
  28. package/docs/api/post.md +22 -23
  29. package/docs/api/quality.md +11 -6
  30. package/docs/api/raycast.md +13 -32
  31. package/docs/api/reference/animation.md +9 -9
  32. package/docs/api/reference/assets.md +18 -18
  33. package/docs/api/reference/cameras.md +5 -2
  34. package/docs/api/reference/controls.md +75 -23
  35. package/docs/api/reference/debug.md +23 -8
  36. package/docs/api/reference/engine.md +22 -10
  37. package/docs/api/reference/geometry.md +161 -82
  38. package/docs/api/reference/grass.md +1 -1
  39. package/docs/api/reference/impostors.md +92 -1
  40. package/docs/api/reference/input.md +3 -3
  41. package/docs/api/reference/lights.md +9 -9
  42. package/docs/api/reference/lines.md +7 -7
  43. package/docs/api/reference/materials.md +48 -48
  44. package/docs/api/reference/math.md +22 -22
  45. package/docs/api/reference/objects.md +9 -9
  46. package/docs/api/reference/points.md +4 -4
  47. package/docs/api/reference/post.md +18 -18
  48. package/docs/api/reference/quality.md +7 -3
  49. package/docs/api/reference/raycast.md +6 -6
  50. package/docs/api/reference/render.md +2 -2
  51. package/docs/api/reference/scene.md +29 -26
  52. package/docs/api/reference/sketch.md +4 -0
  53. package/docs/api/reference/sound.md +203 -0
  54. package/docs/api/reference/sprites.md +5 -5
  55. package/docs/api/reference/terrain.md +2 -1
  56. package/docs/api/reference/textures.md +4 -4
  57. package/docs/api/reference/ui.md +3 -3
  58. package/docs/api/reference/vertex-draws.md +3 -3
  59. package/docs/api/reference/water.md +77 -6
  60. package/docs/api/reference/wind.md +2 -2
  61. package/docs/api/render.md +12 -10
  62. package/docs/api/scene.md +40 -29
  63. package/docs/api/sketch.md +64 -3
  64. package/docs/api/sound.md +169 -0
  65. package/docs/api/splats.md +7 -0
  66. package/docs/api/sprites.md +4 -20
  67. package/docs/api/tasks.md +2 -2
  68. package/docs/api/terrain.md +2 -14
  69. package/docs/api/textures.md +9 -9
  70. package/docs/api/ui.md +3 -15
  71. package/docs/api/water.md +198 -15
  72. package/docs/api/wind.md +5 -5
  73. package/docs/cli/null3d.md +93 -18
  74. package/docs/concepts/architecture.md +10 -10
  75. package/docs/concepts/assets.md +2 -19
  76. package/docs/concepts/backends.md +7 -5
  77. package/docs/concepts/color-management.md +15 -26
  78. package/docs/concepts/culling.md +1 -1
  79. package/docs/concepts/instances.md +5 -5
  80. package/docs/concepts/large-worlds.md +1 -1
  81. package/docs/concepts/lighting.md +50 -55
  82. package/docs/concepts/lod.md +2 -15
  83. package/docs/concepts/materials.md +16 -16
  84. package/docs/concepts/post-processing.md +7 -29
  85. package/docs/concepts/quality-preset-tables.md +53 -50
  86. package/docs/concepts/quality-presets.md +56 -27
  87. package/docs/concepts/render-graph.md +19 -14
  88. package/docs/concepts/render-layers.md +3 -17
  89. package/docs/concepts/shadows.md +10 -28
  90. package/docs/concepts/static-dynamic.md +2 -2
  91. package/docs/cookbook/index.md +1 -1
  92. package/docs/data/threejs-mapping.json +136 -102
  93. package/docs/errors/E1214.md +3 -3
  94. package/docs/errors/E1307.md +23 -0
  95. package/docs/errors/E1420.md +3 -3
  96. package/docs/errors/index.md +3 -2
  97. package/docs/getting-started/cdn.md +17 -1
  98. package/docs/getting-started/first-scene.md +1 -1
  99. package/docs/getting-started/hosting.md +50 -9
  100. package/docs/getting-started/install.md +8 -7
  101. package/docs/getting-started/network-use.md +10 -2
  102. package/docs/getting-started/project-structure.md +15 -6
  103. package/docs/getting-started/third-party-notices.md +8 -6
  104. package/docs/guides/accessibility.md +1 -1
  105. package/docs/guides/add-ons.md +3 -2
  106. package/docs/guides/agents.md +16 -5
  107. package/docs/guides/assets-pipeline.md +13 -12
  108. package/docs/guides/audio.md +109 -124
  109. package/docs/guides/car-paint.md +1 -1
  110. package/docs/guides/content-pages.md +10 -6
  111. package/docs/guides/custom-passes.md +9 -8
  112. package/docs/guides/custom-shaders.md +6 -3
  113. package/docs/guides/debugging.md +78 -4
  114. package/docs/guides/deploying.md +105 -5
  115. package/docs/guides/deterministic-simulation.md +1 -1
  116. package/docs/guides/first-use-shaders.md +4 -4
  117. package/docs/guides/loading-screens.md +78 -33
  118. package/docs/guides/multiple-views.md +41 -2
  119. package/docs/guides/performance.md +6 -3
  120. package/docs/guides/phones.md +12 -1
  121. package/docs/guides/physics.md +1 -1
  122. package/docs/guides/screens.md +7 -5
  123. package/docs/guides/start-time.md +328 -0
  124. package/docs/guides/testing.md +23 -5
  125. package/docs/guides/ui-overlays.md +3 -3
  126. package/docs/index.md +12 -8
  127. package/docs/pages.md +26 -23
  128. package/docs/porting/react-three-fiber.md +228 -5
  129. package/docs/porting/threejs-loop-and-threads.md +220 -6
  130. package/docs/porting/threejs-mapping.md +86 -84
  131. package/docs/porting/threejs-materials.md +212 -5
  132. package/docs/porting/threejs-overview.md +218 -5
  133. package/docs/porting/threejs-postprocessing.md +2 -2
  134. package/docs/porting/threejs-shaders.md +298 -5
  135. package/docs/porting/threejs-unsupported.md +82 -6
  136. package/docs/porting/verification.md +181 -5
  137. package/docs/shaders/builtins.md +1 -1
  138. package/docs/shaders/library.md +63 -39
  139. package/docs/shaders/surface-functions.md +11 -10
  140. package/docs/shaders/wgsl-rules.md +1 -1
  141. package/lib/debug/channel.d.ts +103 -0
  142. package/lib/debug/channel.js +269 -0
  143. package/lib/debug/debug.d.ts +9 -7
  144. package/lib/debug/draw.d.ts +9 -0
  145. package/lib/debug/draw.js +49 -2
  146. package/lib/debug/inspector.d.ts +60 -0
  147. package/lib/debug/inspector.js +475 -0
  148. package/lib/debug/stats-panel.d.ts +1 -1
  149. package/lib/debug/stats.d.ts +2 -3
  150. package/lib/errors/codes.js +8 -2
  151. package/lib/errors/engine-error.js +25 -10
  152. package/lib/errors/fixes.d.ts +1 -0
  153. package/lib/errors/fixes.js +3 -2
  154. package/lib/generated/core.d.ts +1 -1
  155. package/lib/generated/core.js +1 -1
  156. package/lib/gpu/early-builds.d.ts +68 -0
  157. package/lib/gpu/early-builds.js +158 -0
  158. package/lib/gpu/pipeline-name.d.ts +6 -0
  159. package/lib/gpu/pipeline-name.js +23 -0
  160. package/lib/gpu/webgl2/backend.d.ts +63 -2
  161. package/lib/gpu/webgl2/backend.js +226 -8
  162. package/lib/gpu/webgl2/programs.d.ts +18 -0
  163. package/lib/gpu/webgl2/programs.js +4 -1
  164. package/lib/gpu/webgpu/backend.d.ts +89 -2
  165. package/lib/gpu/webgpu/backend.js +255 -8
  166. package/lib/gpu/webgpu/pipelines.d.ts +13 -0
  167. package/lib/gpu/webgpu/pipelines.js +15 -1
  168. package/lib/index.d.ts +6 -4
  169. package/lib/index.js +3 -2
  170. package/lib/math/color.d.ts +5 -5
  171. package/lib/math/color.js +5 -5
  172. package/lib/math/mat4.d.ts +6 -12
  173. package/lib/math/mat4.js +6 -12
  174. package/lib/math/namespaces/quat.d.ts +3 -3
  175. package/lib/math/namespaces/quat.js +3 -3
  176. package/lib/math/quat.d.ts +8 -12
  177. package/lib/math/quat.js +8 -12
  178. package/lib/math/random.d.ts +2 -3
  179. package/lib/math/random.js +2 -3
  180. package/lib/math/types.d.ts +4 -4
  181. package/lib/math/vec3.d.ts +3 -6
  182. package/lib/math/vec3.js +3 -6
  183. package/lib/page/capabilities.d.ts +7 -7
  184. package/lib/page/capabilities.js +39 -25
  185. package/lib/page/check-store.d.ts +14 -2
  186. package/lib/page/check-store.js +34 -11
  187. package/lib/page/engine.d.ts +103 -26
  188. package/lib/page/engine.js +420 -97
  189. package/lib/page/first-frame.d.ts +16 -0
  190. package/lib/page/first-frame.js +35 -0
  191. package/lib/page/frame-stats.d.ts +34 -1
  192. package/lib/page/frame-stats.js +15 -0
  193. package/lib/page/label-loop.d.ts +7 -3
  194. package/lib/page/label-loop.js +17 -10
  195. package/lib/page/labels.d.ts +3 -3
  196. package/lib/page/pipeline-store.d.ts +25 -0
  197. package/lib/page/pipeline-store.js +84 -0
  198. package/lib/page/start-marker.d.ts +4 -1
  199. package/lib/page/start-marker.js +5 -2
  200. package/lib/page/switches.d.ts +32 -2
  201. package/lib/page/switches.js +9 -1
  202. package/lib/quality/check.d.ts +24 -3
  203. package/lib/quality/check.js +21 -7
  204. package/lib/quality/chooser.d.ts +6 -0
  205. package/lib/quality/chooser.js +8 -0
  206. package/lib/quality/governor.d.ts +98 -6
  207. package/lib/quality/governor.js +250 -20
  208. package/lib/quality/preset-docs.d.ts +16 -1
  209. package/lib/quality/preset-docs.js +3 -0
  210. package/lib/quality/presets.d.ts +84 -7
  211. package/lib/quality/presets.js +94 -2
  212. package/lib/render/draw.d.ts +3 -2
  213. package/lib/render/draw.js +15 -5
  214. package/lib/render/load-draw.d.ts +7 -5
  215. package/lib/render/load-draw.js +7 -5
  216. package/lib/render/loss.d.ts +28 -10
  217. package/lib/render/loss.js +50 -22
  218. package/lib/render/recovery.d.ts +20 -0
  219. package/lib/render/recovery.js +44 -4
  220. package/lib/render/renderer.d.ts +85 -9
  221. package/lib/render/renderer.js +181 -42
  222. package/lib/render/scene-renderer.d.ts +19 -1
  223. package/lib/render/scene-renderer.js +25 -1
  224. package/lib/render/webgl2-renderers.js +8 -5
  225. package/lib/render/webgpu-renderers.js +5 -4
  226. package/lib/scene/animation.d.ts +28 -32
  227. package/lib/scene/animation.js +12 -15
  228. package/lib/scene/assets.d.ts +61 -86
  229. package/lib/scene/assets.js +103 -236
  230. package/lib/scene/background.d.ts +14 -18
  231. package/lib/scene/background.js +5 -2
  232. package/lib/scene/color.d.ts +3 -3
  233. package/lib/scene/downloads.d.ts +2 -0
  234. package/lib/scene/downloads.js +371 -0
  235. package/lib/scene/environment.d.ts +7 -7
  236. package/lib/scene/environment.js +1 -1
  237. package/lib/scene/fake-call-values.js +1 -1
  238. package/lib/scene/fog.d.ts +11 -4
  239. package/lib/scene/fog.js +8 -2
  240. package/lib/scene/frame-cameras.d.ts +19 -0
  241. package/lib/scene/frame-cameras.js +58 -0
  242. package/lib/scene/gltf.d.ts +32 -2
  243. package/lib/scene/gltf.js +78 -49
  244. package/lib/scene/grading.d.ts +2 -2
  245. package/lib/scene/grading.js +3 -3
  246. package/lib/scene/ktx2.d.ts +9 -1
  247. package/lib/scene/ktx2.js +3 -2
  248. package/lib/scene/level-rule.d.ts +120 -0
  249. package/lib/scene/level-rule.js +130 -0
  250. package/lib/scene/lines.d.ts +13 -17
  251. package/lib/scene/lines.js +3 -3
  252. package/lib/scene/lut.d.ts +1 -2
  253. package/lib/scene/lut.js +1 -2
  254. package/lib/scene/picks.d.ts +2 -2
  255. package/lib/scene/pointer-events.d.ts +4 -7
  256. package/lib/scene/post.d.ts +38 -43
  257. package/lib/scene/post.js +4 -1
  258. package/lib/scene/prefab.d.ts +7 -8
  259. package/lib/scene/prefab.js +7 -8
  260. package/lib/scene/property-animation.d.ts +1 -1
  261. package/lib/scene/property-animation.js +1 -1
  262. package/lib/scene/queries.d.ts +7 -13
  263. package/lib/scene/resources.d.ts +225 -254
  264. package/lib/scene/resources.js +179 -81
  265. package/lib/scene/scene.d.ts +149 -118
  266. package/lib/scene/scene.js +196 -98
  267. package/lib/scene/serial-loads.d.ts +29 -0
  268. package/lib/scene/serial-loads.js +68 -0
  269. package/lib/scene/shader-preloads.d.ts +34 -0
  270. package/lib/scene/shader-preloads.js +38 -0
  271. package/lib/scene/sprites.d.ts +14 -17
  272. package/lib/scene/sprites.js +5 -6
  273. package/lib/scene/textures.d.ts +11 -12
  274. package/lib/scene/textures.js +9 -10
  275. package/lib/scene/time-of-day.d.ts +3 -4
  276. package/lib/scene/time-of-day.js +2 -3
  277. package/lib/scene/vertex-draws.d.ts +5 -4
  278. package/lib/scene/vertex-draws.js +7 -5
  279. package/lib/shader-artifact.json +1 -0
  280. package/lib/shared/core.d.ts +5 -0
  281. package/lib/shared/core.js +1 -0
  282. package/lib/shared/import-once.d.ts +6 -0
  283. package/lib/shared/import-once.js +19 -0
  284. package/lib/shared/metrics.d.ts +38 -0
  285. package/lib/shared/metrics.js +62 -1
  286. package/lib/shared/run-task.js +7 -1
  287. package/lib/shared/task-pending.d.ts +12 -0
  288. package/lib/shared/task-pending.js +61 -1
  289. package/lib/shared/tasks.js +79 -32
  290. package/lib/shared/version.d.ts +17 -1
  291. package/lib/shared/version.js +19 -1
  292. package/lib/shared/wasm.d.ts +12 -4
  293. package/lib/shared/wasm.js +50 -27
  294. package/lib/shared/worker-start.d.ts +7 -0
  295. package/lib/shared/worker-start.js +27 -0
  296. package/lib/sketch/define-sketch.d.ts +35 -0
  297. package/lib/sketch/input.d.ts +2 -2
  298. package/lib/sketch/preset-check.d.ts +20 -6
  299. package/lib/sketch/preset-check.js +42 -17
  300. package/lib/sketch/quality.d.ts +69 -11
  301. package/lib/sketch/quality.js +54 -13
  302. package/lib/sketch/runner.d.ts +76 -9
  303. package/lib/sketch/runner.js +385 -52
  304. package/lib/sketch/ui.d.ts +5 -8
  305. package/lib/workers/probe-worker.d.ts +5 -0
  306. package/lib/workers/probe-worker.js +13 -4
  307. package/lib/workers/protocol.d.ts +61 -13
  308. package/lib/workers/protocol.js +4 -0
  309. package/lib/workers/render-worker.js +25 -4
  310. package/lib/workers/sketch-worker.js +104 -15
  311. package/package.json +2 -2
@@ -19,23 +19,23 @@ Loads files, and textures from image files. Every call runs outside the sketch's
19
19
  | Member | Description |
20
20
  | --- | --- |
21
21
  | `loadTexture(url: string \| URL, options: LoadTextureOptions = {}): Promise<Texture>` | Downloads an image file or a KTX2 file, decodes it off the sketch's frames, and makes a texture from it. The browser decodes PNG, JPEG, WebP and AVIF files. A KTX2 file of ETC1S or UASTC data becomes the compressed format that the device supports, with the file's mip levels, and UASTC HDR data becomes BC6H or shared-exponent floats. The first KTX2 file loads the transcoder. The engine keeps the transcoded texels in its cache of derived data, so a later load of a file with the same bytes, on this visit or a later one, skips the transcoder. Throws E1411 when the file does not download, E1413 when a server of another origin does not allow the page to read it, E1412 when the file does not decode or passes a limit of the engine's (a KTX2 file larger than the device's textures, before it transcodes), E1406 when the transcoder does not load, and E1208 for options the engine does not know. |
22
- | `registerGltfExtension(handler: GltfExtensionHandler): () => void` | Registers a handler for glTF extensions that an add-on reads, as three.js's `GLTFLoader.register()` does. A file that carries one of the handler's extensions hands each primitive that holds one to the handler, and draws the parts that it returns. A file that requires such an extension loads with the handler and fails with E1417 without it. Register the handler before the first load that needs it. Returns a function that unregisters it. Throws E1213 for a handler without a list of extension names or a `load` function, and for one that reads an extension which another handler reads. |
22
+ | `registerGltfExtension(handler: GltfExtensionHandler): () => void` | Registers a handler for glTF extensions that an add-on reads. A file that carries one of the handler's extensions hands each primitive that holds one to the handler, and draws the parts that it returns. A file that requires such an extension loads with the handler and fails with E1417 without it. Register the handler before the first load that needs it. Returns a function that unregisters it. Throws E1213 for a handler without a list of extension names or a `load` function, and for one that reads an extension which another handler reads. |
23
23
  | `loadGltf(url: string \| URL, options: LoadGltfOptions = {}): Promise<Prefab>` | Downloads a glTF 2.0 model, a `.glb` file or a `.gltf` file with the files it names, and makes a prefab of it: its meshes, materials, textures, lights and nodes, made once, which `scene.instantiate` copies. A worker parses the file off the sketch's frames, and the first call downloads the loader and its worker. The first file with meshopt compression also downloads the meshopt decoder. The loads count for `onProgress`, the files the model names too, and they take files that `preload` downloaded. Throws E1411 when a file does not download, E1413 when a server of another origin does not allow the page to read it, E1416 for a file that is not a glTF model the engine reads or that passes a limit on what one file may decode to, E1417 for a file that requires an extension the engine does not read, E1412 when an image does not decode, E1109 when a mesh does not fit engine memory, and E1406 when the loader or the meshopt decoder does not download. `options.rewriteUrl` checks the addresses that the file names. |
24
24
  | `loadImageBitmap(url: string \| URL, options: LoadImageOptions = {}): Promise<ImageBitmap>` | Downloads an image file and decodes it into an `ImageBitmap`, off the sketch's frames. By default it decodes as `loadTexture` does, so `textures.fromImageBitmap` makes the same texture. Throws E1411, E1412 or E1413 as `loadTexture` does. |
25
- | `loadCubemap(urls: readonly (string \| URL)[]): Promise<Cubemap>` | Downloads six images and makes a `Cubemap` from them, a sky box for `scene.setBackground`, as three.js's `CubeTextureLoader` does: the faces toward +X, -X, +Y, -Y, +Z and -Z, in that order, each square and of one size, at most 2,048 pixels a side. The images decode off the sketch's frames and upload in the frames after the call. A cube map does not light the scene: for light, and for a background that blurs, make an environment with `bunx |
26
- | `loadLut(url: string \| URL): Promise<Lut>` | Downloads a color grading table in a `.cube` or a `.3dl` file and makes a `Lut` from it, for `post.set({ lut })`. It reads the forms that three.js's `LUTCubeLoader` and `LUT3dlLoader` read, with tables of 2 to 256 texels a side. A `.cube` file's domain and title come along; a `.3dl` file's values are whole numbers of the depth that its largest value or its `Mesh` line gives. The first table loads the readers. Throws E1411 or E1413 as `loadTexture` does, E1412 when the file holds no table that the engine reads, and E1406 when the readers do not load. |
27
- | `lutFromData(table: LutData): Promise<Lut>` | Makes a color grading table from numbers, for `post.set({ lut })`, as three.js's `LUTPass` takes a `Data3DTexture` that code fills. It takes the numbers in the order of a `.cube` file: three or four per texel, red changing fastest. A file and its numbers make the same table. The first table loads the code that makes it, as `loadLut` does. Throws E1208 when the size is not a whole number from 2 to 256, when `data` does not hold three or four numbers per texel, or holds a number that is not finite, and when a domain is not three numbers whose maximum is above its minimum. Throws E1406 when the code does not load. |
28
- | `loadEnvironment(url: string \| URL): Promise<Environment>` | Downloads an environment and makes an `Environment` from it, for `scene.setEnvironment`. It takes a KTX2 file that `bunx |
29
- | `builtinEnvironment(name: BuiltinEnvironmentName): Promise<Environment>` | Makes a built-in environment: `room`, the room that three.js's `RoomEnvironment` builds, for soft, neutral light with no file of your own. No file downloads: the GPU draws the room into its cube map and filters it for each roughness, as three.js's `PMREMGenerator.fromScene` does. It resolves once the code and the shaders that make the map are ready. The next frame then makes the whole map before it draws, so the first frame with the environment already has its light. That frame takes longer, by the map's GPU time: call it while the scene loads, since a call during play makes one long frame. The first one loads the code that makes it, about 12 KB after Brotli. Throws E1213 for a name that no built-in environment has, and E1406 when its code does not download. |
30
- | `skyEnvironment(): Promise<Environment>` | Makes an environment of the scene's sky, the sky that `scene.setBackground({ sky })` draws, as three.js's `PMREMGenerator.fromScene` makes one from a scene that holds its `Sky`. Light it with `scene.setEnvironment`. The map follows the sky: when the sketch moves the sun or changes the air or the clouds, the map refreshes over the next frames, and no call is needed. Until the scene's first sky background, it shows the sky's defaults. The map leaves out the sun's disc: the scene's directional light gives the sun's own light. The GPU draws the sky into the map and filters it for each roughness, and the CPU works out its diffuse light. It resolves once the code and the shaders that make the map are ready, and the next frame makes the whole map before it draws. The first call loads the code that makes environments, about 12 KB after Brotli. Throws E1406 when that code does not download. |
25
+ | `loadCubemap(urls: readonly (string \| URL)[]): Promise<Cubemap>` | Downloads six images and makes a `Cubemap` from them, a sky box for `scene.setBackground`: the faces toward +X, -X, +Y, -Y, +Z and -Z, in that order, each square and of one size, at most 2,048 pixels a side. The engine reads the faces as seen from inside the cube, mirrored across x, so a common six-image sky box shows the right way round. The images decode off the sketch's frames and upload in the frames after the call. A cube map does not light the scene: for light, and for a background that blurs, make an environment with `bunx @null3d/cli assets env`. Throws E1411, E1412 or E1413 as `loadTexture` does, E1412 also when the faces are not square or not of one size, and E1208 when `urls` does not hold six addresses. |
26
+ | `loadLut(url: string \| URL): Promise<Lut>` | Downloads a color grading table in a `.cube` or a `.3dl` file and makes a `Lut` from it, for `post.set({ lut })`. It reads tables of 2 to 256 texels a side. A `.cube` file's domain and title come along; a `.3dl` file's values are whole numbers of the depth that its largest value or its `Mesh` line gives. The first table loads the readers. Throws E1411 or E1413 as `loadTexture` does, E1412 when the file holds no table that the engine reads, and E1406 when the readers do not load. |
27
+ | `lutFromData(table: LutData): Promise<Lut>` | Makes a color grading table from numbers, for `post.set({ lut })`. It takes the numbers in the order of a `.cube` file: three or four per texel, red changing fastest. A file and its numbers make the same table. The first table loads the code that makes it, as `loadLut` does. Throws E1208 when the size is not a whole number from 2 to 256, when `data` does not hold three or four numbers per texel, or holds a number that is not finite, and when a domain is not three numbers whose maximum is above its minimum. Throws E1406 when the code does not load. |
28
+ | `loadEnvironment(url: string \| URL): Promise<Environment>` | Downloads an environment and makes an `Environment` from it, for `scene.setEnvironment`. It takes a KTX2 file that `bunx @null3d/cli assets env` made, the fast path, or an HDR file: a Radiance file (`.hdr`) or an OpenEXR file (`.exr`) of an equirectangular panorama. A KTX2 map's cube texture uploads in the frames after the call, and the scene draws without the environment until it is on the GPU. A worker reads an HDR file, off the sketch's frames. The GPU then filters it for each roughness, with the asset tool's filter, in the next frame, before that frame draws: call it while the scene loads, since a call during play makes one long frame. Light brighter than a 16-bit float keeps its share of the rough reflections and the diffuse light, and the sharpest level stops at 65,408, as in the tool's files. The first file of each kind loads its reader. Throws E1411 or E1413 as `loadTexture` does, E1412 when the file is not one that the engine reads, and E1406 when a reader does not load. |
29
+ | `builtinEnvironment(name: BuiltinEnvironmentName): Promise<Environment>` | Makes a built-in environment: `room`, a white room with boxes and glowing panels, for soft, neutral light with no file of your own. No file downloads: the GPU draws the room into its cube map and filters it for each roughness. It resolves once the code and the shaders that make the map are ready. The next frame then makes the whole map before it draws, so the first frame with the environment already has its light. That frame takes longer, by the map's GPU time: call it while the scene loads, since a call during play makes one long frame. The first one loads the code that makes it, about 12 KB after Brotli. Throws E1213 for a name that no built-in environment has, and E1406 when its code does not download. |
30
+ | `skyEnvironment(): Promise<Environment>` | Makes an environment of the scene's sky, the sky that `scene.setBackground({ sky })` draws. Light it with `scene.setEnvironment`. The map follows the sky: when the sketch moves the sun or changes the air or the clouds, the map refreshes over the next frames, and no call is needed. Until the scene's first sky background, it shows the sky's defaults. The map leaves out the sun's disc: the scene's directional light gives the sun's own light. The GPU draws the sky into the map and filters it for each roughness, and the CPU works out its diffuse light. It resolves once the code and the shaders that make the map are ready, and the next frame makes the whole map before it draws. The first call loads the code that makes environments, about 12 KB after Brotli. Throws E1406 when that code does not download. |
31
31
  | `loadLightProbeGrid(url: string \| URL): Promise<LightProbeGridOptions>` | Downloads a probe grid that a tool outside the engine baked, in the [baked light file](../../guides/baked-light-data.md) format, and makes the texture and the placement that `scene.setLightProbeGrid` takes. The grid's coefficients are the four RGB values of L1 spherical harmonics per probe, in the shader's order. The first grid loads the reader, about 2 KB after Brotli. Throws E1411 or E1413 as `loadTexture` does, E1434 when the file is not a probe grid that this engine reads, and E1406 when the reader does not load. |
32
32
  | `loadLightMap(url: string \| URL): Promise<LightMapData>` | Downloads a light map that a tool outside the engine baked, in the [baked light file](../../guides/baked-light-data.md) format. It gives the radiance as a texture for a material's `lightMap`, and, for a directional light map, the light's direction at each texel as a second texture for the same material's `lightMapDirection`. The first light map loads the reader, about 2 KB after Brotli. Throws E1411 or E1413 as `loadTexture` does, E1434 when the file is not a light map that this engine reads, and E1406 when the reader does not load. |
33
33
  | `lightProbeGridFile(grid: LightProbeGridData): Promise<Uint8Array>` | Makes the file of a probe grid that `bakeProbes` made, in the [baked light file](../../guides/baked-light-data.md) format, as bytes to save or send. The file holds the same values that `loadLightProbeGrid` reads, so a bake in the browser and a bake in another tool give one format. The first call loads the writer, about 2 KB after Brotli. Throws E1108 when the grid's coefficients do not hold 12 numbers for each probe in its counts, or its masks do not hold one number for each probe, and E1406 when the writer does not load. |
34
34
  | `loadJson<T = unknown>(url: string \| URL): Promise<T>` | Downloads a JSON file and parses it. Throws E1411 or E1413 as `loadTexture` does, and E1412 when the file is not valid JSON. |
35
35
  | `loadBinary(url: string \| URL): Promise<ArrayBuffer>` | Downloads a file as bytes. Throws E1411 or E1413 as `loadTexture` does. |
36
36
  | `cache(name: string, version: string \| number): DerivedCache` | A namespace of the cache of derived data: bytes that a sketch or an add-on makes from its inputs, kept in the browser's storage across visits, such as a generated terrain or grown plants. `name` names the producer, such as an add-on's package name. `version` is the version of the bytes it makes: the first call with a new version deletes the entries of the others. Key each entry by every input that the bytes depend on, such as a hash of their content. The calls never reject, and answer no entry when the cache is off or the storage fails, so the caller makes its data again. The same name and version give the same namespace. |
37
- | `preload(urls: readonly (string \| URL)[]): Promise<void>` | Downloads files ahead of their loads, all at once, and resolves when every one has arrived. The next load of each address takes its file from memory. Pair it with `onProgress` for a loading screen. Throws the error of the first file that fails, as `loadBinary` does. |
38
- | `onProgress(handler: ProgressHandler): () => void` | Calls `handler` as a download's bytes arrive and when one finishes or fails, with the bytes downloaded so far, the bytes expected so far and the address whose bytes moved, as `ProgressHandler` describes. Loads that take a file that `preload` downloaded report no further. Returns a function that removes the handler. |
37
+ | `preload(urls: readonly (string \| URL)[]): Promise<void>` | Downloads files ahead of their loads, all at once, and resolves when every one has arrived. The next load of each address takes its file from memory. Pair it with `onProgress` for a loading screen. For the files that the setup loads, name them in `defineSketch`'s `downloads` option instead, which starts them sooner. Throws the error of the first file that fails, as `loadBinary` does, and the next load of that file downloads it again. |
38
+ | `onProgress(handler: ProgressHandler): () => void` | Calls `handler` as a download's bytes arrive and when one finishes or fails, with the bytes downloaded so far, the bytes expected so far and the address whose bytes moved, as `ProgressHandler` describes. The files of `defineSketch`'s `downloads` option count too, from before the setup adds the handler. Loads that take a file that `preload` or that option downloaded report no further. Returns a function that removes the handler. |
39
39
 
40
40
  ## `BuiltinEnvironmentName`
41
41
 
@@ -43,13 +43,13 @@ Loads files, and textures from image files. Every call runs outside the sketch's
43
43
  type BuiltinEnvironmentName = 'room';
44
44
  ```
45
45
 
46
- The names of the built-in environments that `assets.builtinEnvironment` loads. `room` is the room that three.js's `RoomEnvironment` builds, blurred as three.js's examples blur it. It is a white room with six boxes and glowing panels, which gives soft, neutral light.
46
+ The names of the built-in environments that `assets.builtinEnvironment` loads. `room` is a white room with six boxes and glowing panels, lit by one point light. It is slightly blurred, and gives soft, neutral light.
47
47
 
48
48
  ## `Cubemap`
49
49
 
50
50
  Class `Cubemap`.
51
51
 
52
- A cube map of six images, which `assets.loadCubemap` loads, for a sky box behind every object: `scene.setBackground(cubemap)`, as three.js's `CubeTextureLoader` makes a `CubeTexture` for `scene.background`. It does not light the scene: light comes from an environment.
52
+ A cube map of six images, which `assets.loadCubemap` loads, for a sky box behind every object: `scene.setBackground(cubemap)`. The engine reads the faces as seen from inside the cube, mirrored across x. It does not light the scene: light comes from an environment.
53
53
 
54
54
  | Member | Description |
55
55
  | --- | --- |
@@ -74,7 +74,7 @@ A namespace of the cache of derived data, which `assets.cache` gives: bytes by k
74
74
 
75
75
  Class `Environment`.
76
76
 
77
- An environment map, which `assets.loadEnvironment` and `assets.builtinEnvironment` load. It holds the light around a scene from every direction, filtered for each roughness, and the diffuse light that it gives. Give it to `scene.setEnvironment`, which lights standard materials with it, as three.js's `scene.environment` does with a texture from `PMREMGenerator`.
77
+ An environment map, which `assets.loadEnvironment` and `assets.builtinEnvironment` load. It holds the light around a scene from every direction, filtered for each roughness, and the diffuse light that it gives. Give it to `scene.setEnvironment`, which lights standard materials with it.
78
78
 
79
79
  | Member | Description |
80
80
  | --- | --- |
@@ -120,7 +120,7 @@ What the loader hands a glTF extension handler for one primitive.
120
120
 
121
121
  Interface `GltfExtensionHandler`.
122
122
 
123
- A handler for the glTF extensions that an add-on reads, as three.js's `GLTFLoader.register()` takes one. Register it with `assets.registerGltfExtension` before the first load of a model that carries the extension.
123
+ A handler for the glTF extensions that an add-on reads. Register it with `assets.registerGltfExtension` before the first load of a model that carries the extension.
124
124
 
125
125
  | Member | Description |
126
126
  | --- | --- |
@@ -195,7 +195,7 @@ The options of `assets.loadGltf`.
195
195
 
196
196
  | Member | Description |
197
197
  | --- | --- |
198
- | `rewriteUrl?: (address: URL) => URL \| string \| null` | Checks or changes each address that the file names, for a buffer or an image, before it downloads. It gets the address resolved against the file's own, and returns the address to download, or null to refuse the file with E1416. A model that a user uploads can name any address, which the page then requests with its cookies, so a page that loads such models should allow only the addresses it expects. three.js's `LoadingManager.setURLModifier` does the same for its loaders. |
198
+ | `rewriteUrl?: (address: URL) => URL \| string \| null` | Checks or changes each address that the file names, for a buffer or an image, before it downloads. It gets the address resolved against the file's own, and returns the address to download, or null to refuse the file with E1416. A model that a user uploads can name any address, which the page then requests with its cookies, so a page that loads such models should allow only the addresses it expects. |
199
199
  | `maxLevels?: number` | The most levels of detail to load from a file that stores its levels as separate downloads, counting the level in the file itself. A band of a cluster tree counts as a level. The default loads every level, and the loader skips a level that the camera never draws. A page whose objects never come close enough to show the finest level sets 1, or the number of levels that show, and downloads less. A file whose levels are all in the file itself ignores the option. |
200
200
 
201
201
  ## `LoadImageOptions`
@@ -218,14 +218,14 @@ The options of `assets.loadTexture`: how the image decodes, and the texture's op
218
218
 
219
219
  | Member | Description |
220
220
  | --- | --- |
221
- | `flipY?: boolean` | True to put the image's top row at v = 1, the top of a plane, as three.js's `TextureLoader` does. The default is true. glTF textures use false. A KTX2 file keeps the rows as it holds them, its first row at v = 0, as three.js's `KTX2Loader` does: encode it flipped, as `basisu -y_flip` does, for a plane. It takes no `flipY: true`. |
222
- | `premultipliedAlpha?: boolean` | True to store each color multiplied by its alpha, as three.js's `premultiplyAlpha` does. The default is false. A KTX2 file takes no `premultipliedAlpha: true`. |
221
+ | `flipY?: boolean` | True to put the image's top row at v = 1, the top of a plane. The default is true. glTF textures use false. A KTX2 file keeps the rows as it holds them, its first row at v = 0: encode it flipped, as `basisu -y_flip` does, for a plane. It takes no `flipY: true`. |
222
+ | `premultipliedAlpha?: boolean` | True to store each color multiplied by its alpha. The default is false. A KTX2 file takes no `premultipliedAlpha: true`. |
223
223
 
224
224
  ## `Lut`
225
225
 
226
226
  Class `Lut`.
227
227
 
228
- A color grading table, which `assets.loadLut` loads from a file and `assets.lutFromData` makes from numbers. It is a 3D texture that maps each color of the picture to its graded color. Give it to `post.set({ lut })`, which applies it to every pixel after the tone mapping, as three.js's `LUTPass` does.
228
+ A color grading table, which `assets.loadLut` loads from a file and `assets.lutFromData` makes from numbers. It is a 3D texture that maps each color of the picture to its graded color. Give it to `post.set({ lut })`, which applies it to every pixel after the tone mapping.
229
229
 
230
230
  | Member | Description |
231
231
  | --- | --- |
@@ -270,7 +270,7 @@ A model that `assets.loadGltf` loaded: a template whose meshes, materials and te
270
270
  | `readonly bounds: PrefabBounds` | The bounds of the whole model, around the origin of its copies. |
271
271
  | `readonly materials: readonly Material[]` | The model's materials, in the file's order. |
272
272
  | `readonly textures: readonly Texture[]` | The model's textures, in the order that its materials first sample them: each material's base color, then its metalness and roughness, its normals, its occlusion and its emission. A texture that an earlier material or slot already samples comes once. `find` gives a node's own textures by slot. |
273
- | `destroy(): void` | Destroys the model, like calling three.js's `dispose()` on each geometry, material and texture of a loaded glTF scene. It frees the GPU memory and the engine data of every mesh, material and texture that the load made, and of its skeleton and animation clips. Destroy the copies that `scene.instantiate` and `scene.createInstances` made first, and the objects that use one of its meshes or materials, in the same frame or before. Throws E1111 while one still does, and E1101 for a model that is destroyed already. Materials of your own that map one of the model's textures draw with their colors alone afterwards. Later calls that pass the model throw E1101. |
273
+ | `destroy(): void` | Destroys the model. It frees the GPU memory and the engine data of every mesh, material and texture that the load made, and of its skeleton and animation clips. Destroy the copies that `scene.instantiate` and `scene.createInstances` made first, and the objects that use one of its meshes or materials, in the same frame or before. Throws E1111 while one still does, and E1101 for a model that is destroyed already. Materials of your own that map one of the model's textures draw with their colors alone afterwards. Later calls that pass the model throw E1101. |
274
274
  | `readonly clips: readonly string[]` | The names of the model's clips, which a copy's animator plays. |
275
275
  | `find(name: string): PrefabNode \| undefined` | The first node with `name`, in the file's order, or undefined when no node has it. The nodes of a copy have the same names, and its `find` gives them. |
276
276
 
@@ -49,13 +49,13 @@ A camera whose view is a box: things keep their size at every distance, as in ma
49
49
  | `readonly isOrthographic: true` | True: an orthographic camera. |
50
50
  | `readonly height: number` | The view's height in world units. |
51
51
  | `readonly width: number \| undefined` | The view's width in world units, or undefined when the width follows the canvas's aspect ratio. |
52
- | `setOrthoHeight(height: number): void` | Sets the view's height in world units. A width that follows the canvas keeps following it. A view made from four edges scales about its center and keeps its shape, as three.js's `zoom` scales it. |
52
+ | `setOrthoHeight(height: number): void` | Sets the view's height in world units. A width that follows the canvas keeps following it. A view made from four edges scales about its center and keeps its shape. |
53
53
 
54
54
  ## `OrthographicCameraOptions`
55
55
 
56
56
  Interface `OrthographicCameraOptions`, which extends `CameraOptions`.
57
57
 
58
- Options for `scene.createOrthographicCamera`. Give `height`, and the width follows the canvas's aspect ratio. Or give all four edges, as three.js's `OrthographicCamera` takes them, for a view that keeps its shape on any canvas.
58
+ Options for `scene.createOrthographicCamera`. Give `height`, and the width follows the canvas's aspect ratio. Or give all four edges, for a view that keeps its shape on any canvas.
59
59
 
60
60
  | Member | Description |
61
61
  | --- | --- |
@@ -113,6 +113,9 @@ A view of the scene from its own camera, drawn into a rectangle of the canvas af
113
113
  | `readonly rect: SceneViewRect` | The rectangle of the canvas that the view draws into. |
114
114
  | `setCamera(camera: Camera): void` | Draws the view from `camera` from the next frame on. It takes the camera's layers, and follows them when they change. |
115
115
  | `setRect(rect: SceneViewRect): void` | Draws the view into `rect` from the next frame on. It allocates nothing, so a sketch can change the rectangle in any frame. Development builds throw E1203 for a number that is not finite, and E1213 for a rectangle outside the canvas. |
116
+ | `screenToRay(x: number, y: number, out: Ray): void` | Writes the ray from the view's camera through a point of the view's image into `out`: `x` and `y` are CSS pixels from the canvas's top-left corner, as `camera.screenToRay` takes them, and as `input.pointer` gives them. The lens takes the shape of the view's rectangle, as the view draws it, so a click on the view's image picks what the view shows. A perspective ray starts at the camera, and an orthographic ray on the near plane. The direction has length 1. It uses the camera of the frame that last ran, with its lens as it is now. A point outside the rectangle gives the ray that the view's lens would give there. `scene.viewAt` finds the view under a point. Development builds throw E1101 for a view that was removed, and E1203 for a number that is not finite. |
117
+ | `worldToScreen(point: Vec3Like, out: Vec3Like): void` | Writes where a point in the world lies in the view's image into `out`: x and y in CSS pixels from the canvas's top-left corner, then the point's depth, its distance in front of the view's camera along the view. A depth below 0 puts the point behind the camera, where x and y have no meaning. The lens takes the shape of the view's rectangle. A point outside the view's sight lands outside the rectangle. Development builds throw E1101 for a view that was removed, and E1203 for a number that is not finite. |
118
+ | `contains(x: number, y: number): boolean` | True when the point (`x`, `y`) in CSS pixels from the canvas's top-left corner lies in the view's rectangle, its left and top edges included. |
116
119
  | `destroy(): void` | Removes the view from the next frame on. The camera's view draws the canvas alone again. Development builds throw E1101 for a view that was removed. |
117
120
 
118
121
  ## `SceneViewOptions`
@@ -16,7 +16,7 @@ summary: "Every export of the Controls (@null3d/controls) API, from the engine's
16
16
  function createDragControls(context: SketchContext, camera: PerspectiveCamera | OrthographicCamera, objects: Object3D[], options: DragControlsOptions = {}): DragControls
17
17
  ```
18
18
 
19
- Creates drag controls, which three.js calls `DragControls`. A press on one of `objects` drags it over a plane that faces the camera, and the right button or an option turns it instead. `controls.update(dt)` reads the input once per frame in `onUpdate`, and `controls.dragging` names the object that the pointer holds. Pass the sketch's context first, as the other controls take it.
19
+ Creates drag controls. A press on one of `objects` drags it over a plane that faces the camera, and the right button or an option turns it instead. `controls.update(dt)` reads the input once per frame in `onUpdate`, and `controls.dragging` names the object that the pointer holds. Pass the sketch's context first, as the other controls take it.
20
20
 
21
21
  ## `createFirstPersonControls`
22
22
 
@@ -24,7 +24,7 @@ Creates drag controls, which three.js calls `DragControls`. A press on one of `o
24
24
  function createFirstPersonControls(ctx: SketchContext, camera: PerspectiveCamera | OrthographicCamera, options: FirstPersonControlsOptions = {}): FirstPersonControls
25
25
  ```
26
26
 
27
- Creates first-person controls, which three.js calls `FirstPersonControls`, and which also take the place of its `PointerLockControls`. Keys walk, and a drag looks around. While the page holds the pointer lock, which `engine.requestPointerLock()` asks for, the mouse turns the view. Call `controls.update(dt)` once per frame in `onUpdate`.
27
+ Creates first-person controls. Keys walk, and a drag looks around. While the page holds the pointer lock, which `engine.requestPointerLock()` asks for, the mouse turns the view. Call `controls.update(dt)` once per frame in `onUpdate`.
28
28
 
29
29
  ## `createFlyControls`
30
30
 
@@ -32,7 +32,7 @@ Creates first-person controls, which three.js calls `FirstPersonControls`, and w
32
32
  function createFlyControls(ctx: SketchContext, camera: PerspectiveCamera | OrthographicCamera, options: FlyControlsOptions = {}): FlyControls
33
33
  ```
34
34
 
35
- Creates fly controls, which three.js calls `FlyControls`. W, A, S, D, R and F move the camera, the arrow keys turn it, Q and E roll it, and the pointer steers it. Call `controls.update(dt)` once per frame in `onUpdate`.
35
+ Creates fly controls. W, A, S, D, R and F move the camera, the arrow keys turn it, Q and E roll it, and the pointer steers it. Call `controls.update(dt)` once per frame in `onUpdate`.
36
36
 
37
37
  ## `createMapControls`
38
38
 
@@ -40,7 +40,7 @@ Creates fly controls, which three.js calls `FlyControls`. W, A, S, D, R and F mo
40
40
  function createMapControls(ctx: SketchContext, camera: PerspectiveCamera | OrthographicCamera, options: OrbitControlsOptions = {}): MapControls
41
41
  ```
42
42
 
43
- Creates map controls, which three.js calls `MapControls`. A left drag or one finger pans over the ground. The wheel, a pinch and a middle drag dolly the camera. A right drag or two fingers turn it. Call `controls.update(dt)` once per frame in `onUpdate`.
43
+ Creates map controls. A left drag or one finger pans over the ground. The wheel, a pinch and a middle drag dolly the camera. A right drag or two fingers turn it. Call `controls.update(dt)` once per frame in `onUpdate`.
44
44
 
45
45
  ## `createOrbitControls`
46
46
 
@@ -48,7 +48,7 @@ Creates map controls, which three.js calls `MapControls`. A left drag or one fin
48
48
  function createOrbitControls(ctx: SketchContext, camera: PerspectiveCamera | OrthographicCamera, options: OrbitControlsOptions = {}): OrbitControls
49
49
  ```
50
50
 
51
- Creates orbit controls, which three.js calls `OrbitControls`. A left drag or one finger turns the camera around the target. The wheel, a pinch and a middle drag dolly it. A right drag or two fingers pan. Call `controls.update(dt)` once per frame in `onUpdate`.
51
+ Creates orbit controls. A left drag or one finger turns the camera around the target. The wheel, a pinch and a middle drag dolly it. A right drag or two fingers pan. Call `controls.update(dt)` once per frame in `onUpdate`.
52
52
 
53
53
  ## `createTransformControls`
54
54
 
@@ -56,7 +56,7 @@ Creates orbit controls, which three.js calls `OrbitControls`. A left drag or one
56
56
  function createTransformControls(context: SketchContext, camera: PerspectiveCamera | OrthographicCamera, options: TransformControlsOptions = {}): TransformControls
57
57
  ```
58
58
 
59
- Creates translate, rotate and scale gizmos for one object, which three.js calls `TransformControls`. `attach` picks the object, `setMode` picks what a drag does, and `controls.update(dt)` reads the input once per frame in `onUpdate`. A press on a handle begins the drag, and `controls.dragging` is true until the pointer comes up, so a sketch can leave its camera controls alone meanwhile.
59
+ Creates translate, rotate and scale gizmos for one object. `attach` picks the object, `setMode` picks what a drag does, and `controls.update(dt)` reads the input once per frame in `onUpdate`. A press on a handle begins the drag, and `controls.dragging` is true until the pointer comes up, so a sketch can leave its camera controls alone meanwhile.
60
60
 
61
61
  ## `DragAction`
62
62
 
@@ -91,7 +91,7 @@ Drag controls: they drag the objects of a list over a plane that faces the camer
91
91
 
92
92
  Interface `DragControlsOptions`.
93
93
 
94
- Options for `createDragControls`, with three.js's names and defaults. The controls keep each option as a property of the same name, which a sketch can change at any time.
94
+ Options for `createDragControls`. The controls keep each option except `layers` as a property of the same name, which a sketch can change at any time.
95
95
 
96
96
  | Member | Description |
97
97
  | --- | --- |
@@ -100,14 +100,14 @@ Options for `createDragControls`, with three.js's names and defaults. The contro
100
100
  | `transformGroup?: boolean` | True drags the outermost listed object that holds the one under the pointer, instead of that object alone. The default is false. |
101
101
  | `rotateSpeed?: number` | How fast a rotate drag turns the object. The default is 1. |
102
102
  | `layers?: number` | The layers that the pointer's ray tests, as `setLayers` takes them. The default is layer 0 alone, where every new object starts. |
103
- | `mouseButtons?: Partial<DragMouseButtons>` | What each mouse button does. The main button drags and the right one turns, as in three.js. |
104
- | `touches?: Partial<DragTouchActions>` | What one finger does. A finger drags, as in three.js. |
103
+ | `mouseButtons?: Partial<DragMouseButtons>` | What each mouse button does. The main and middle buttons drag, and the right one turns. |
104
+ | `touches?: Partial<DragTouchActions>` | What one finger does. A finger drags. |
105
105
 
106
106
  ## `DragMouseButtons`
107
107
 
108
108
  Interface `DragMouseButtons`.
109
109
 
110
- The action of each mouse button, with three.js's names for the buttons. Null gives a button no action.
110
+ The action of each mouse button. Null gives a button no action.
111
111
 
112
112
  | Member | Description |
113
113
  | --- | --- |
@@ -151,20 +151,20 @@ First-person controls: keys walk the camera over the ground. The user looks arou
151
151
  | `maxPolarAngle: number` | The largest angle between the view and +Y while the pointer is locked, in radians. |
152
152
  | `update(dt: number): boolean` | Moves and turns the camera by the frame's input. Call it once per frame in `onUpdate`, with the frame's step in seconds. Returns true when the camera moved or turned. |
153
153
  | `lookAt(x: number, y: number, z: number): void` | Turns the camera toward a point, and takes the view's angles from there. |
154
- | `moveForward(distance: number): void` | Moves the camera forward over the ground, at right angles to its right, as three.js's `PointerLockControls.moveForward` does. Negative distances move it back. |
155
- | `moveRight(distance: number): void` | Moves the camera to its right, as three.js's `PointerLockControls.moveRight` does. |
154
+ | `moveForward(distance: number): void` | Moves the camera forward over the ground, at right angles to its right. Negative distances move it back. |
155
+ | `moveRight(distance: number): void` | Moves the camera to its right. Negative distances move it to its left. |
156
156
  | `getDirection<T extends Vec3Like>(out: T): T` | Copies the direction the camera looks in into `out`, and returns `out`. |
157
157
 
158
158
  ## `FirstPersonControlsOptions`
159
159
 
160
160
  Interface `FirstPersonControlsOptions`.
161
161
 
162
- Options for `createFirstPersonControls`, with the names and defaults of three.js's `FirstPersonControls` and `PointerLockControls`. The controls keep each option as a property of the same name, which a sketch can change at any time.
162
+ Options for `createFirstPersonControls`. The controls keep each option as a property of the same name, which a sketch can change at any time.
163
163
 
164
164
  | Member | Description |
165
165
  | --- | --- |
166
166
  | `enabled?: boolean` | False ignores the user's input and stops the camera. The default is true. |
167
- | `movementSpeed?: number` | How fast the keys and the pointer move the camera, in world units per second. 0 leaves the moves to the sketch, as with three.js's `PointerLockControls`. The default is 1. |
167
+ | `movementSpeed?: number` | How fast the keys and the pointer move the camera, in world units per second. 0 leaves the moves to the sketch, which calls `moveForward` and `moveRight`. The default is 1. |
168
168
  | `lookSpeed?: number` | How fast a drag turns the view: degrees per second for each pixel of the drag. The default is 0.005. |
169
169
  | `dampingFactor?: number` | The share of the remaining change of speed that each frame applies, at 60 frames per second, so moves and turns start and stop smoothly. Other frame rates get the same motion over the same time. The default is 0.1. |
170
170
  | `lookVertical?: boolean` | False keeps a drag from turning the view up and down. The default is true. |
@@ -199,13 +199,13 @@ Fly controls: they move the camera in all directions and turn it about its own a
199
199
 
200
200
  Interface `FlyControlsOptions`.
201
201
 
202
- Options for `createFlyControls`, with three.js's names and defaults. The controls keep each option as a property of the same name, which a sketch can change at any time.
202
+ Options for `createFlyControls`. The controls keep each option as a property of the same name, which a sketch can change at any time.
203
203
 
204
204
  | Member | Description |
205
205
  | --- | --- |
206
206
  | `enabled?: boolean` | False ignores the user's input and stops the camera. The default is true. |
207
207
  | `movementSpeed?: number` | How fast the camera moves, in world units per second. The default is 1. |
208
- | `rollSpeed?: number` | How fast the camera turns, in radians per second at full turn: about twice this, as three.js counts it. The default is 0.005. |
208
+ | `rollSpeed?: number` | How fast the camera turns: about twice this, in radians per second, at full turn. The default is 0.005. |
209
209
  | `dragToLook?: boolean` | True steers only while a button or a finger is down. False steers by the pointer's place whenever it moves over the canvas, and the left and right buttons move forward and back. The default is false. |
210
210
  | `autoForward?: boolean` | True moves the camera forward all the time, unless a key moves it back. The default is false. |
211
211
 
@@ -215,7 +215,7 @@ Options for `createFlyControls`, with three.js's names and defaults. The control
215
215
  type GizmoAxis = 'X' | 'Y' | 'Z' | 'XY' | 'YZ' | 'XZ' | 'XYZ' | 'E';
216
216
  ```
217
217
 
218
- The handle that the user grabs, with three.js's names: one axis, two axes of a plane handle, all three for the center handle, and `E` for the outer ring that turns about the view.
218
+ The handle that the user grabs: one axis, two axes for a plane handle, or all three for the center handle. The outer ring that turns about the view is `E`.
219
219
 
220
220
  ## `GizmoMode`
221
221
 
@@ -251,7 +251,7 @@ What a held mouse button does: turn the camera around the target, dolly it towar
251
251
 
252
252
  Interface `MouseButtons`.
253
253
 
254
- The action of each mouse button, with three.js's names for the buttons. Null gives a button no action.
254
+ The action of each mouse button. Null gives a button no action.
255
255
 
256
256
  | Member | Description |
257
257
  | --- | --- |
@@ -285,6 +285,16 @@ Orbit controls: they turn a camera around a target point, dolly it toward the ta
285
285
  | `zoomSpeed: number` | How fast the wheel, a pinch and a dolly drag move the camera. |
286
286
  | `enablePan: boolean` | False stops the user panning the camera. |
287
287
  | `panSpeed: number` | How fast drags pan the camera. |
288
+ | `zoomToCursor: boolean` | True makes the wheel and a pinch zoom toward the point under the pointer. |
289
+ | `readonly keys: OrbitKeys` | The keys that pan the camera, and turn it while Shift, Control or Meta is down. |
290
+ | `keyPanSpeed: number` | How far each key step pans, in CSS pixels of a drag. |
291
+ | `keyRotateSpeed: number` | How fast each key step turns the camera. |
292
+ | `readonly cursor: [number, number, number]` | The center of the sphere that the target stays in. Change it in place, such as with `vec3.set(controls.cursor, x, y, z)`. |
293
+ | `minTargetRadius: number` | The closest the target comes to `cursor`. |
294
+ | `maxTargetRadius: number` | The farthest the target goes from `cursor`. |
295
+ | `readonly target0: [number, number, number]` | The target that `reset` restores: the target at the start, or at the last `saveState`. |
296
+ | `readonly position0: [number, number, number]` | The camera position that `reset` restores. |
297
+ | `zoom0: number` | The orthographic camera's zoom that `reset` restores: 1 is the view height at the start. |
288
298
  | `screenSpacePanning: boolean` | True pans in the plane of the screen; false pans over the ground. |
289
299
  | `minDistance: number` | The closest the camera comes to the target. |
290
300
  | `maxDistance: number` | The farthest the camera goes from the target. |
@@ -299,6 +309,10 @@ Orbit controls: they turn a camera around a target point, dolly it toward the ta
299
309
  | `readonly mouseButtons: MouseButtons` | What each mouse button does. |
300
310
  | `readonly touches: TouchActions` | What one and two fingers do. |
301
311
  | `update(dt: number): boolean` | Moves the camera by the frame's input, damping and auto-rotation, and turns it toward the target. Call it once per frame in `onUpdate`, with the frame's step in seconds. Returns true when the camera or the target moved. |
312
+ | `listenToKeyEvents(): void` | Turns on the keys: the arrow keys, or those in `keys`, pan the camera, and turn it while Shift, Control or Meta is down. three.js's controls take a DOM element here. The sketch's input already holds the keys, so this takes none. |
313
+ | `stopListenToKeyEvents(): void` | Turns the keys off again. |
314
+ | `saveState(): void` | Keeps the target, the camera's position and an orthographic camera's zoom, for `reset`. |
315
+ | `reset(): void` | Puts the target, the camera and an orthographic camera's zoom back as `saveState` kept them, or as they were when the controls started. Then it updates once, as three.js's `reset` does, and ends the user's gesture. |
302
316
  | `getDistance(): number` | The distance from the camera to the target. |
303
317
  | `getPolarAngle(): number` | The angle between the camera and +Y as seen from the target, in radians, after the last update. |
304
318
  | `getAzimuthalAngle(): number` | The camera's angle around +Y as seen from the target, in radians, after the last update. |
@@ -313,7 +327,7 @@ Orbit controls: they turn a camera around a target point, dolly it toward the ta
313
327
 
314
328
  Interface `OrbitControlsOptions`.
315
329
 
316
- Options for `createOrbitControls` and `createMapControls`, with three.js's names and defaults. The controls keep each option as a property of the same name, which a sketch can change at any time.
330
+ Options for `createOrbitControls` and `createMapControls`. The controls keep each option as a property of the same name, which a sketch can change at any time.
317
331
 
318
332
  | Member | Description |
319
333
  | --- | --- |
@@ -327,10 +341,17 @@ Options for `createOrbitControls` and `createMapControls`, with three.js's names
327
341
  | `zoomSpeed?: number` | How fast the wheel, a pinch and a dolly drag move the camera. The default is 1. |
328
342
  | `enablePan?: boolean` | False stops the user panning the camera. The default is true. |
329
343
  | `panSpeed?: number` | How fast drags pan the camera. The default is 1. |
344
+ | `zoomToCursor?: boolean` | True makes the wheel and a pinch zoom toward the point under the pointer, or between the fingers, where false zooms toward the target. The target moves with the zoom. The default is false. |
345
+ | `keys?: Partial<OrbitKeys>` | The keys that pan the camera, and turn it while Shift, Control or Meta is down. They act only after `listenToKeyEvents()`. The default is the four arrow keys. |
346
+ | `keyPanSpeed?: number` | How far each key step pans, in CSS pixels of a drag. The default is 7. |
347
+ | `keyRotateSpeed?: number` | How fast each key step turns the camera. The default is 1. |
348
+ | `cursor?: Vec3Like` | The center of the sphere that the target stays in, with `minTargetRadius` and `maxTargetRadius`. The default is (0, 0, 0). |
349
+ | `minTargetRadius?: number` | The closest the target comes to `cursor`. The default is 0. |
350
+ | `maxTargetRadius?: number` | The farthest the target goes from `cursor`. The default is Infinity. |
330
351
  | `screenSpacePanning?: boolean` | True pans in the plane of the screen. False pans over the ground: the plane at right angles to +Y. The default is true for orbit controls and false for map controls. |
331
352
  | `minDistance?: number` | The closest the camera comes to the target. The default is 0. |
332
353
  | `maxDistance?: number` | The farthest the camera goes from the target. The default is Infinity. |
333
- | `minZoom?: number` | The smallest zoom of an orthographic camera, as three.js counts zoom: 1 shows the view's height when the controls start, and 2 shows half of it. The default is 0. |
354
+ | `minZoom?: number` | The smallest zoom of an orthographic camera: 1 shows the view's height when the controls start, and 2 shows half of it. The default is 0. |
334
355
  | `maxZoom?: number` | The largest zoom of an orthographic camera. The default is Infinity. |
335
356
  | `minPolarAngle?: number` | The smallest angle between the camera and +Y as seen from the target, in radians. The default is 0. |
336
357
  | `maxPolarAngle?: number` | The largest angle between the camera and +Y as seen from the target, in radians. The default is π. |
@@ -341,11 +362,24 @@ Options for `createOrbitControls` and `createMapControls`, with three.js's names
341
362
  | `mouseButtons?: Partial<MouseButtons>` | What each mouse button does. Orbit controls rotate with the left button, dolly with the middle one and pan with the right one. Map controls pan with the left button and rotate with the right one. |
342
363
  | `touches?: Partial<TouchActions>` | What one and two fingers do. Orbit controls rotate with one finger and dolly and pan with two. Map controls pan with one finger and dolly and rotate with two. |
343
364
 
365
+ ## `OrbitKeys`
366
+
367
+ Interface `OrbitKeys`.
368
+
369
+ The keys that pan the camera, and turn it while Shift, Control or Meta is down. Each is a `KeyboardEvent.code` name, such as `ArrowLeft`.
370
+
371
+ | Member | Description |
372
+ | --- | --- |
373
+ | `LEFT: string` | The key that pans or turns to the left. |
374
+ | `UP: string` | The key that pans or turns up. |
375
+ | `RIGHT: string` | The key that pans or turns to the right. |
376
+ | `BOTTOM: string` | The key that pans or turns down. |
377
+
344
378
  ## `TouchActions`
345
379
 
346
380
  Interface `TouchActions`.
347
381
 
348
- The action of one finger and of two fingers, with three.js's names. Null gives no action.
382
+ The action of one finger and of two fingers. Null gives no action.
349
383
 
350
384
  | Member | Description |
351
385
  | --- | --- |
@@ -366,6 +400,15 @@ Translate, rotate and scale gizmos for one object. `createTransformControls` mak
366
400
  | `showX: boolean` | True shows the handles of the X axis, and the planes that it lies in. |
367
401
  | `showY: boolean` | True shows the handles of the Y axis, and the planes that it lies in. |
368
402
  | `showZ: boolean` | True shows the handles of the Z axis, and the planes that it lies in. |
403
+ | `showXY: boolean` | True shows the handle of the XY plane, and the other handles whose names hold "XY". |
404
+ | `showYZ: boolean` | True shows the handle of the YZ plane, and the other handles whose names hold "YZ". |
405
+ | `showXZ: boolean` | True shows the handle of the XZ plane. |
406
+ | `minX: number` | The smallest X that a move gives the object's position relative to its parent. |
407
+ | `maxX: number` | The largest X that a move gives the object's position relative to its parent. |
408
+ | `minY: number` | The smallest Y that a move gives the object's position relative to its parent. |
409
+ | `maxY: number` | The largest Y that a move gives the object's position relative to its parent. |
410
+ | `minZ: number` | The smallest Z that a move gives the object's position relative to its parent. |
411
+ | `maxZ: number` | The largest Z that a move gives the object's position relative to its parent. |
369
412
  | `enabled: boolean` | False ignores the user's input. |
370
413
  | `translationSnap: number \| null` | The steps, in meters, that a move snaps to, or null for a free move. |
371
414
  | `rotationSnap: number \| null` | The steps, in radians, that a turn snaps to, or null for a free turn. |
@@ -385,16 +428,25 @@ Translate, rotate and scale gizmos for one object. `createTransformControls` mak
385
428
 
386
429
  Interface `TransformControlsOptions`.
387
430
 
388
- Options for `createTransformControls`, with three.js's names and defaults. The controls keep each option as a property of the same name, which a sketch can change at any time.
431
+ Options for `createTransformControls`. The controls keep each option except `layers` and `pickLayers` as a property of the same name, which a sketch can change at any time.
389
432
 
390
433
  | Member | Description |
391
434
  | --- | --- |
392
435
  | `mode?: GizmoMode` | What a drag does: move the object, turn it or scale it. The default is `'translate'`. |
393
- | `space?: GizmoSpace` | The axes that a drag works along: the world's or the object's own. A scale drag always works along the object's axes, as in three.js. The default is `'world'`. |
436
+ | `space?: GizmoSpace` | The axes that a drag works along: the world's or the object's own. A scale drag always works along the object's axes. The default is `'world'`. |
394
437
  | `size?: number` | The size of the handles on the screen. The default is 1. |
395
438
  | `showX?: boolean` | False hides the handles of the X axis, and the planes that it lies in. The default is true. |
396
439
  | `showY?: boolean` | False hides the handles of the Y axis, and the planes that it lies in. The default is true. |
397
440
  | `showZ?: boolean` | False hides the handles of the Z axis, and the planes that it lies in. The default is true. |
441
+ | `showXY?: boolean` | False hides the handle of the XY plane. As in three.js, it also hides each handle whose axis name holds "XY", such as the center handle `XYZ`. The default is true. |
442
+ | `showYZ?: boolean` | False hides the handle of the YZ plane. As in three.js, it also hides each handle whose axis name holds "YZ", such as the center handle `XYZ`. The default is true. |
443
+ | `showXZ?: boolean` | False hides the handle of the XZ plane. The default is true. |
444
+ | `minX?: number` | The limits of a move on each axis, as three.js's options of the same names. A move clamps the object's position relative to its parent to them, after it snaps. The defaults are `-Infinity` and `Infinity`: no limit. |
445
+ | `maxX?: number` | The largest X that a move gives the object's position. The default is `Infinity`. |
446
+ | `minY?: number` | The smallest Y that a move gives the object's position. The default is `-Infinity`. |
447
+ | `maxY?: number` | The largest Y that a move gives the object's position. The default is `Infinity`. |
448
+ | `minZ?: number` | The smallest Z that a move gives the object's position. The default is `-Infinity`. |
449
+ | `maxZ?: number` | The largest Z that a move gives the object's position. The default is `Infinity`. |
398
450
  | `enabled?: boolean` | False ignores the user's input. The default is true. |
399
451
  | `translationSnap?: number \| null` | The steps, in meters, that a move snaps to. The default is null: a free move. |
400
452
  | `rotationSnap?: number \| null` | The steps, in radians, that a turn snaps to. The default is null: a free turn. |
@@ -37,10 +37,10 @@ Debug drawing and frame figures. The drawing calls draw lines that show where th
37
37
  | `sphere(center: Vec3Like, radius: number, color?: ColorInput): void` | Draws a sphere as three circles around its center, one in each plane of the world's axes. The default color is yellow. |
38
38
  | `arrow(origin: Vec3Like, direction: Vec3Like, length?: number, color?: ColorInput): void` | Draws an arrow from `origin` in `direction`, `length` meters long, with a head at its tip. The direction needs no unit length. The default length is 1, and the default color is yellow. |
39
39
  | `axes(target: Object3D \| Vec3Like, size?: number): void` | Draws x, y and z axes, in red, green and blue, `size` meters long: at a position, or on an object. An object's axes take its position and rotation in the frame they draw in, so they never lag behind it. The default size is 1. |
40
- | `grid(size?: number, divisions?: number, options?: DebugGridOptions): void` | Draws a square grid on the horizontal plane through its center, `size` meters wide, with `divisions` cells along each side, as three.js's `GridHelper` does. The defaults are 10 and 10. |
41
- | `frustum(camera: Camera, color?: ColorInput): void` | Draws the space that a camera sees: its near and far planes and the edges between them, in the canvas's shape. The camera takes its place in the frame it draws in. The default color is orange, as in three.js's `CameraHelper`. |
40
+ | `grid(size?: number, divisions?: number, options?: DebugGridOptions): void` | Draws a square grid on the horizontal plane through its center, `size` meters wide, with `divisions` cells along each side. The defaults are 10 and 10. |
41
+ | `frustum(camera: Camera, color?: ColorInput): void` | Draws the space that a camera sees: its near and far planes and the edges between them, in the canvas's shape. The camera takes its place in the frame it draws in. The default color is orange. |
42
42
  | `light(light: DirectionalLight, options?: DebugLightOptions): void` | Draws a directional light as a square that faces its light, with an arrow in the direction its light travels. The light takes its place and direction in the frame it draws in. |
43
- | `skeleton(object: Object3D, color?: ColorInput): void` | Draws the skeleton that animates an object, such as the copy of a model that `scene.instantiate` made: a line from each joint of the model's skins to its parent joint, in the pose of the frame it draws in. As in three.js's `SkeletonHelper`, each line is blue at the joint and green at its parent, unless `color` gives one color. An object without an animator draws nothing. |
43
+ | `skeleton(object: Object3D, color?: ColorInput): void` | Draws the skeleton that animates an object, such as the copy of a model that `scene.instantiate` made: a line from each joint of the model's skins to its parent joint, in the pose of the frame it draws in. Each line is blue at the joint and green at its parent, unless `color` gives one color. An object without an animator draws nothing. |
44
44
 
45
45
  ## `DebugGridOptions`
46
46
 
@@ -51,8 +51,8 @@ Options for `debug.grid`.
51
51
  | Member | Description |
52
52
  | --- | --- |
53
53
  | `center?: Vec3Like` | The center of the grid. The default is the origin. |
54
- | `color?: ColorInput` | The color of the grid's lines. The default is `'#888888'`, as in three.js's `GridHelper`. |
55
- | `centerColor?: ColorInput` | The color of the two lines through the center. The default is `'#444444'`. |
54
+ | `color?: ColorInput` | The color of the grid's lines. The default is gray, `'#888888'`. |
55
+ | `centerColor?: ColorInput` | The color of the two lines through the center, which an even number of divisions draws. The default is `'#444444'`. |
56
56
 
57
57
  ## `DebugLightOptions`
58
58
 
@@ -82,6 +82,21 @@ type DebugViewName = DebugView | (string & {});
82
82
 
83
83
  The name that `debug.view` takes: one of the engine's own views, or a view that an add-on feature registers.
84
84
 
85
+ ## `DrawingStart`
86
+
87
+ Interface `DrawingStart`.
88
+
89
+ When the thread that draws reached each step of its start, in `FrameMetrics.load.drawingStart`: milliseconds from the start of page navigation, or null for a step that it has not reached or does not take.
90
+
91
+ | Member | Description |
92
+ | --- | --- |
93
+ | `requestMs: number \| null` | The page's message after the probe arrived. The thread then started the downloads of its renderers and shader files, and on WebGPU the request for its device. |
94
+ | `adapterMs: number \| null` | Its WebGPU adapter arrived. Null on WebGL2. |
95
+ | `deviceMs: number \| null` | Its WebGPU device arrived. Null on WebGL2. |
96
+ | `shadersMs: number \| null` | The shader file of its device arrived. |
97
+ | `initMs: number \| null` | The core and the thread's setup arrived from the page. |
98
+ | `rendererMs: number \| null` | Its first renderer was built, so its frame loop could start. |
99
+
85
100
  ## `EngineDebugView`
86
101
 
87
102
  ```ts
@@ -108,7 +123,7 @@ What `engine.measure` returns: the per-frame figures, memory, load time and down
108
123
  | --- | --- |
109
124
  | `seconds: number` | Length of the measurement. |
110
125
  | `memory: MemoryStats` | The engine's WebAssembly memory and the JavaScript heap. |
111
- | `load: { engineStartMs: number; probeMs: number; coreMs: number; firstFrameMs: number \| null; firstFrameDoneMs: number \| null; warmUpMs: number \| null; firstDrawMs: number \| null; firstFramePipelines: number \| null; firstFramePreset: string; }` | How long the engine took to start and to draw its first frame, in milliseconds. |
126
+ | `load: { engineStartMs: number; probeMs: number; coreMs: number; firstFrameMs: number \| null; firstFrameDoneMs: number \| null; warmUpMs: number \| null; firstDrawMs: number \| null; firstFramePipelines: number \| null; drawingStart: DrawingStart; firstFramePreset: string; }` | How long the engine took to start and to draw its first frame, in milliseconds. |
112
127
  | `gpuLosses: number` | Times the browser took the GPU away since the engine started, and the engine carried on with a new device. `simulateGpuLoss` counts too. |
113
128
  | `downloadBytes: { wasm: number \| null; }` | Bytes of the engine's WebAssembly file as the page downloaded it. |
114
129
  | `lostRecords: number` | Frame records the page read too late; nonzero means some frames are missing from the figures. |
@@ -137,7 +152,7 @@ Figures of the running engine, as `debug.frameStats()` returns them and the stat
137
152
  | `readonly gpuStepMs: number \| null` | The step between the GPU's timestamps, in milliseconds, when the browser rounds them, or null when they look exact. It is the greatest common divisor of the offsets that the timer reads back, not a constant of the device. The window that has no timed frame keeps the figure of the window before it. |
138
153
  | `readonly gpuSteps: readonly FrameStatsStep[]` | The GPU time per frame of each step of the frame that the GPU timed one by one, in the order the frame runs them: the engine's own passes, by their step, and a sketch's pass by its place. A tile GPU overlaps the passes, so the steps do not add up to `gpuMs`. The engine times one frame in eleven and at most seven passes in it. The passes after them share one figure, named `later passes`, which no scope names. Empty on WebGL2, which times the whole frame alone. |
139
154
  | `readonly drawCalls: number` | Mean draw calls per frame, over every pass. |
140
- | `readonly triangles: number` | Mean triangles drawn per frame, over every pass: shadow maps and the depth prepass count as well as the passes that shade, as three.js's `renderer.info` counts them. Lines count none. On WebGPU the GPU culls most objects, and the count of their triangles comes back from the GPU on one frame in eleven, a few frames late. |
155
+ | `readonly triangles: number` | Mean triangles drawn per frame, over every pass: shadow maps and the depth prepass count as well as the passes that shade. Lines count none. On WebGPU the GPU culls most objects, and the count of their triangles comes back from the GPU on one frame in eleven, a few frames late. |
141
156
  | `readonly objects: number` | Mean objects drawn per frame, over every pass: each draw counts its instances, so an object counts once in each pass that draws it, such as a shadow cascade, and each part of a mesh with several materials counts once. On WebGPU the count of the objects that the GPU culls comes back from the GPU on one frame in eleven, a few frames late. |
142
157
  | `readonly uploadBytes: number` | Mean bytes uploaded to the GPU per frame. |
143
158
  | `readonly tier: Tier` | The GPU path the engine draws with. |
@@ -436,7 +451,7 @@ The figures that the stats overlay shows, in the form that `statsText` lays out.
436
451
  type StatsFrameMode = 'pipelined' | 'low' | 'single' | 'one-thread';
437
452
  ```
438
453
 
439
- How the threads of a renderer share each frame's work, which a symbol before the target explains: `'pipelined'` and `'low'` are null3D's latency modes, `'single'` is null3D's single-thread build, and `'one-thread'` is a renderer that prepares and draws each frame on one thread, as three.js does.
454
+ How the threads of a renderer share each frame's work, which a symbol before the target explains: `'pipelined'` and `'low'` are null3D's latency modes, `'single'` is null3D's single-thread build, and `'one-thread'` is a renderer that prepares and draws each frame on one thread.
440
455
 
441
456
  ## `StatsGpuStep`
442
457