@null3d/engine 0.1.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 (381) hide show
  1. package/dist/wasm/single/null3d.js +10 -8
  2. package/dist/wasm/single/null3d_bg.wasm +0 -0
  3. package/dist/wasm/threaded/null3d.js +10 -8
  4. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  5. package/docs/api/animation.md +96 -24
  6. package/docs/api/assets.md +99 -29
  7. package/docs/api/cameras.md +38 -7
  8. package/docs/api/controls.md +47 -23
  9. package/docs/api/debug.md +105 -35
  10. package/docs/api/engine.md +108 -32
  11. package/docs/api/feature-draws.md +21 -15
  12. package/docs/api/feature-effects.md +8 -8
  13. package/docs/api/feature-instances.md +68 -17
  14. package/docs/api/features.md +68 -37
  15. package/docs/api/geometry.md +83 -14
  16. package/docs/api/grass.md +55 -13
  17. package/docs/api/impostors.md +92 -50
  18. package/docs/api/input.md +22 -9
  19. package/docs/api/lights.md +67 -16
  20. package/docs/api/lines.md +38 -13
  21. package/docs/api/materials.md +187 -59
  22. package/docs/api/math.md +6 -6
  23. package/docs/api/objects.md +40 -15
  24. package/docs/api/page.md +58 -7
  25. package/docs/api/particles.md +36 -11
  26. package/docs/api/points.md +18 -8
  27. package/docs/api/post.md +57 -23
  28. package/docs/api/quality.md +36 -16
  29. package/docs/api/raycast.md +57 -24
  30. package/docs/api/reference/animation.md +1 -2
  31. package/docs/api/reference/assets.md +7 -4
  32. package/docs/api/reference/cameras.md +3 -2
  33. package/docs/api/reference/controls.md +59 -2
  34. package/docs/api/reference/debug.md +58 -6
  35. package/docs/api/reference/engine.md +39 -10
  36. package/docs/api/reference/feature-draws.md +3 -4
  37. package/docs/api/reference/feature-effects.md +2 -3
  38. package/docs/api/reference/feature-instances.md +5 -4
  39. package/docs/api/reference/features.md +7 -4
  40. package/docs/api/reference/geometry.md +132 -21
  41. package/docs/api/reference/grass.md +62 -2
  42. package/docs/api/reference/impostors.md +120 -16
  43. package/docs/api/reference/input.md +1 -2
  44. package/docs/api/reference/lights.md +4 -3
  45. package/docs/api/reference/lines.md +3 -4
  46. package/docs/api/reference/materials.md +7 -6
  47. package/docs/api/reference/math.md +13 -2
  48. package/docs/api/reference/objects.md +2 -3
  49. package/docs/api/reference/particles.md +31 -6
  50. package/docs/api/reference/points.md +2 -3
  51. package/docs/api/reference/post.md +4 -3
  52. package/docs/api/reference/quality.md +1 -2
  53. package/docs/api/reference/raycast.md +1 -2
  54. package/docs/api/reference/render.md +4 -3
  55. package/docs/api/reference/scene.md +24 -5
  56. package/docs/api/reference/sketch.md +11 -11
  57. package/docs/api/reference/sound.md +33 -2
  58. package/docs/api/reference/splats.md +42 -3
  59. package/docs/api/reference/sprites.md +2 -3
  60. package/docs/api/reference/tasks.md +16 -3
  61. package/docs/api/reference/terrain.md +26 -5
  62. package/docs/api/reference/textures.md +1 -2
  63. package/docs/api/reference/three-compat.md +18 -7
  64. package/docs/api/reference/time.md +1 -2
  65. package/docs/api/reference/ui.md +10 -7
  66. package/docs/api/reference/vertex-draws.md +2 -3
  67. package/docs/api/reference/water.md +78 -5
  68. package/docs/api/reference/wind.md +15 -2
  69. package/docs/api/render.md +67 -25
  70. package/docs/api/scene.md +129 -36
  71. package/docs/api/sketch.md +45 -19
  72. package/docs/api/sound.md +48 -12
  73. package/docs/api/splats.md +42 -15
  74. package/docs/api/sprites.md +8 -6
  75. package/docs/api/tasks.md +31 -22
  76. package/docs/api/terrain.md +44 -12
  77. package/docs/api/textures.md +61 -12
  78. package/docs/api/three-compat.md +15 -7
  79. package/docs/api/time.md +3 -5
  80. package/docs/api/ui.md +18 -10
  81. package/docs/api/vertex-draws.md +13 -12
  82. package/docs/api/water.md +111 -67
  83. package/docs/api/wind.md +61 -15
  84. package/docs/cli/null3d.md +90 -15
  85. package/docs/concepts/architecture.md +69 -23
  86. package/docs/concepts/assets.md +57 -16
  87. package/docs/concepts/backends.md +65 -25
  88. package/docs/concepts/color-management.md +42 -13
  89. package/docs/concepts/culling.md +68 -47
  90. package/docs/concepts/handles.md +14 -5
  91. package/docs/concepts/instances.md +72 -23
  92. package/docs/concepts/large-worlds.md +17 -7
  93. package/docs/concepts/lighting.md +117 -44
  94. package/docs/concepts/lod.md +128 -33
  95. package/docs/concepts/materials.md +43 -12
  96. package/docs/concepts/particle-buffer.md +48 -35
  97. package/docs/concepts/post-processing.md +77 -14
  98. package/docs/concepts/quality-preset-tables.md +3 -2
  99. package/docs/concepts/quality-presets.md +122 -39
  100. package/docs/concepts/render-graph.md +56 -21
  101. package/docs/concepts/render-layers.md +9 -5
  102. package/docs/concepts/shadows.md +96 -25
  103. package/docs/concepts/static-dynamic.md +22 -7
  104. package/docs/cookbook/index.md +163 -119
  105. package/docs/data/threejs-mapping.json +301 -340
  106. package/docs/errors/E1101.md +23 -5
  107. package/docs/errors/E1102.md +11 -3
  108. package/docs/errors/E1103.md +11 -3
  109. package/docs/errors/E1104.md +11 -3
  110. package/docs/errors/E1105.md +13 -5
  111. package/docs/errors/E1106.md +11 -3
  112. package/docs/errors/E1107.md +15 -5
  113. package/docs/errors/E1108.md +11 -3
  114. package/docs/errors/E1109.md +32 -6
  115. package/docs/errors/E1110.md +23 -5
  116. package/docs/errors/E1111.md +11 -3
  117. package/docs/errors/E1112.md +11 -3
  118. package/docs/errors/E1203.md +12 -4
  119. package/docs/errors/E1204.md +11 -3
  120. package/docs/errors/E1205.md +11 -3
  121. package/docs/errors/E1206.md +28 -6
  122. package/docs/errors/E1207.md +11 -3
  123. package/docs/errors/E1208.md +12 -3
  124. package/docs/errors/E1209.md +11 -3
  125. package/docs/errors/E1213.md +27 -5
  126. package/docs/errors/E1214.md +11 -3
  127. package/docs/errors/E1215.md +31 -6
  128. package/docs/errors/E1216.md +31 -6
  129. package/docs/errors/E1217.md +29 -6
  130. package/docs/errors/E1218.md +22 -6
  131. package/docs/errors/E1219.md +11 -3
  132. package/docs/errors/E1220.md +24 -5
  133. package/docs/errors/E1221.md +24 -5
  134. package/docs/errors/E1222.md +11 -3
  135. package/docs/errors/E1223.md +39 -6
  136. package/docs/errors/E1224.md +11 -3
  137. package/docs/errors/E1225.md +11 -3
  138. package/docs/errors/E1301.md +11 -3
  139. package/docs/errors/E1302.md +11 -3
  140. package/docs/errors/E1303.md +11 -3
  141. package/docs/errors/E1304.md +11 -3
  142. package/docs/errors/E1305.md +13 -3
  143. package/docs/errors/E1306.md +11 -3
  144. package/docs/errors/E1307.md +23 -6
  145. package/docs/errors/E1401.md +11 -3
  146. package/docs/errors/E1402.md +13 -5
  147. package/docs/errors/E1403.md +11 -3
  148. package/docs/errors/E1404.md +13 -3
  149. package/docs/errors/E1405.md +15 -4
  150. package/docs/errors/E1406.md +31 -5
  151. package/docs/errors/E1407.md +11 -3
  152. package/docs/errors/E1408.md +11 -3
  153. package/docs/errors/E1409.md +11 -3
  154. package/docs/errors/E1410.md +13 -5
  155. package/docs/errors/E1411.md +11 -3
  156. package/docs/errors/E1412.md +29 -6
  157. package/docs/errors/E1413.md +11 -3
  158. package/docs/errors/E1414.md +11 -3
  159. package/docs/errors/E1415.md +11 -3
  160. package/docs/errors/E1416.md +27 -6
  161. package/docs/errors/E1417.md +11 -3
  162. package/docs/errors/E1418.md +12 -3
  163. package/docs/errors/E1419.md +13 -5
  164. package/docs/errors/E1420.md +11 -3
  165. package/docs/errors/E1421.md +11 -3
  166. package/docs/errors/E1422.md +12 -3
  167. package/docs/errors/E1423.md +12 -3
  168. package/docs/errors/E1424.md +24 -5
  169. package/docs/errors/E1425.md +11 -3
  170. package/docs/errors/E1426.md +11 -3
  171. package/docs/errors/E1430.md +11 -3
  172. package/docs/errors/E1431.md +11 -3
  173. package/docs/errors/E1432.md +11 -3
  174. package/docs/errors/E1433.md +11 -3
  175. package/docs/errors/E1434.md +15 -6
  176. package/docs/errors/E1435.md +11 -3
  177. package/docs/errors/E1436.md +11 -3
  178. package/docs/errors/E1437.md +14 -6
  179. package/docs/errors/E1501.md +41 -6
  180. package/docs/errors/E1502.md +13 -3
  181. package/docs/errors/E1503.md +11 -3
  182. package/docs/errors/E1504.md +11 -3
  183. package/docs/errors/E1505.md +23 -5
  184. package/docs/errors/E1506.md +11 -3
  185. package/docs/errors/index.md +52 -29
  186. package/docs/getting-started/cdn.md +15 -9
  187. package/docs/getting-started/first-scene.md +20 -12
  188. package/docs/getting-started/hosting.md +111 -63
  189. package/docs/getting-started/install.md +39 -24
  190. package/docs/getting-started/network-use.md +31 -21
  191. package/docs/getting-started/project-structure.md +20 -8
  192. package/docs/getting-started/third-party-notices.md +6 -10
  193. package/docs/guides/accessibility.md +4 -4
  194. package/docs/guides/add-ons.md +83 -13
  195. package/docs/guides/agents.md +2 -6
  196. package/docs/guides/assets-pipeline.md +248 -72
  197. package/docs/guides/audio.md +17 -15
  198. package/docs/guides/baked-light-data.md +44 -23
  199. package/docs/guides/car-paint.md +37 -31
  200. package/docs/guides/content-pages.md +53 -29
  201. package/docs/guides/custom-passes.md +59 -17
  202. package/docs/guides/custom-shaders.md +54 -37
  203. package/docs/guides/debugging.md +31 -41
  204. package/docs/guides/deploying.md +6 -27
  205. package/docs/guides/deterministic-simulation.md +23 -16
  206. package/docs/guides/first-use-shaders.md +83 -45
  207. package/docs/guides/lens-kit.md +29 -26
  208. package/docs/guides/loading-screens.md +70 -30
  209. package/docs/guides/multiple-views.md +22 -11
  210. package/docs/guides/performance.md +188 -37
  211. package/docs/guides/phones.md +71 -19
  212. package/docs/guides/physics.md +6 -10
  213. package/docs/guides/screens.md +41 -29
  214. package/docs/guides/start-time.md +120 -85
  215. package/docs/guides/testing.md +137 -98
  216. package/docs/guides/ui-overlays.md +17 -12
  217. package/docs/guides/video-textures.md +14 -13
  218. package/docs/images/api/animation/character.webp +0 -0
  219. package/docs/images/api/animation/look-at-ring.webp +0 -0
  220. package/docs/images/api/animation/morph-tulips.webp +0 -0
  221. package/docs/images/api/animation/skeleton-lines.webp +0 -0
  222. package/docs/images/api/controls/gizmo-handles.webp +0 -0
  223. package/docs/images/api/controls/walk-and-fly.webp +0 -0
  224. package/docs/images/api/debug/debug-shapes.webp +0 -0
  225. package/docs/images/api/debug/levels-view.webp +0 -0
  226. package/docs/images/api/engine/transparent-canvas.webp +0 -0
  227. package/docs/images/api/feature-draws/feature-draw-clouds.webp +0 -0
  228. package/docs/images/api/feature-instances/compute-instances.webp +0 -0
  229. package/docs/images/api/feature-instances/instances-shadow.webp +0 -0
  230. package/docs/images/api/geometry/extra-shapes.webp +0 -0
  231. package/docs/images/api/geometry/generators.webp +0 -0
  232. package/docs/images/api/geometry/mesh-arrays.webp +0 -0
  233. package/docs/images/api/geometry/vertex-updates.webp +0 -0
  234. package/docs/images/api/grass/grass-grove.webp +0 -0
  235. package/docs/images/api/grass/grass-presets.webp +0 -0
  236. package/docs/images/api/grass/grass-shadow.webp +0 -0
  237. package/docs/images/api/impostors/impostor-handover.webp +0 -0
  238. package/docs/images/api/impostors/impostor-shadow.webp +0 -0
  239. package/docs/images/api/impostors/impostors-forest.webp +0 -0
  240. package/docs/images/api/lights/spot-cookies.webp +0 -0
  241. package/docs/images/api/lines/lines-lit.webp +0 -0
  242. package/docs/images/api/lines/lines-widths.webp +0 -0
  243. package/docs/images/api/materials/coat-and-sheen.webp +0 -0
  244. package/docs/images/api/materials/decals.webp +0 -0
  245. package/docs/images/api/materials/iridescence-and-anisotropy.webp +0 -0
  246. package/docs/images/api/materials/relief.webp +0 -0
  247. package/docs/images/api/materials/shader-inputs.webp +0 -0
  248. package/docs/images/api/materials/standard-grid.webp +0 -0
  249. package/docs/images/api/materials/subsurface.webp +0 -0
  250. package/docs/images/api/materials/translucency.webp +0 -0
  251. package/docs/images/api/objects/objects-turntable.webp +0 -0
  252. package/docs/images/api/particles/campfire.webp +0 -0
  253. package/docs/images/api/points/galaxy.webp +0 -0
  254. package/docs/images/api/reference/textures/texture-wrap.webp +0 -0
  255. package/docs/images/api/render/fullscreen-glow.webp +0 -0
  256. package/docs/images/api/render/reflection-mirror.webp +0 -0
  257. package/docs/images/api/render/security-camera.webp +0 -0
  258. package/docs/images/api/scene/aurora-sky-layer.webp +0 -0
  259. package/docs/images/api/sound/sound-demo.webp +0 -0
  260. package/docs/images/api/splats/splats-demo.webp +0 -0
  261. package/docs/images/api/sprites/sprites-lines.webp +0 -0
  262. package/docs/images/api/terrain/terrain-demo.webp +0 -0
  263. package/docs/images/api/textures/canvas-screen.webp +0 -0
  264. package/docs/images/api/textures/mipmaps.webp +0 -0
  265. package/docs/images/api/vertex-draws/rain.webp +0 -0
  266. package/docs/images/api/water/ocean.webp +0 -0
  267. package/docs/images/api/water/water-demo.webp +0 -0
  268. package/docs/images/api/water/water-rain.webp +0 -0
  269. package/docs/images/api/water/waterfall.webp +0 -0
  270. package/docs/images/concepts/assets/gltf-model.webp +0 -0
  271. package/docs/images/concepts/color-management/tone-mapped.webp +0 -0
  272. package/docs/images/concepts/culling/far-from-origin.webp +0 -0
  273. package/docs/images/concepts/instances/instances.webp +0 -0
  274. package/docs/images/concepts/instances/per-row-colors.webp +0 -0
  275. package/docs/images/concepts/large-worlds/large-world.webp +0 -0
  276. package/docs/images/concepts/lighting/area-lights.webp +0 -0
  277. package/docs/images/concepts/lighting/atmosphere.webp +0 -0
  278. package/docs/images/concepts/lighting/environment.webp +0 -0
  279. package/docs/images/concepts/lighting/light-shafts.webp +0 -0
  280. package/docs/images/concepts/lighting/reflection-probes.webp +0 -0
  281. package/docs/images/concepts/lod/forest.webp +0 -0
  282. package/docs/images/concepts/materials/weighted-transparency.webp +0 -0
  283. package/docs/images/concepts/post-processing/auto-exposure.webp +0 -0
  284. package/docs/images/concepts/post-processing/bounce-light.webp +0 -0
  285. package/docs/images/concepts/post-processing/depth-of-field.webp +0 -0
  286. package/docs/images/concepts/post-processing/post-effects-alley.webp +0 -0
  287. package/docs/images/concepts/post-processing/sharpen.webp +0 -0
  288. package/docs/images/concepts/post-processing/ssr-wet-street.webp +0 -0
  289. package/docs/images/concepts/render-layers/layers-cottages.webp +0 -0
  290. package/docs/images/concepts/shadows/hero-shadow.webp +0 -0
  291. package/docs/images/cookbook/index/picking.webp +0 -0
  292. package/docs/images/cookbook/index/time-of-day.webp +0 -0
  293. package/docs/images/errors/E1431/area-lights-no-tables.webp +0 -0
  294. package/docs/images/guides/custom-passes/reflection-water.webp +0 -0
  295. package/docs/images/guides/deterministic-simulation/replay-demo.webp +0 -0
  296. package/docs/images/guides/multiple-views/split-screen.webp +0 -0
  297. package/docs/images/guides/performance/overdraw-view.webp +0 -0
  298. package/docs/images/guides/testing/hold-mode-frame.webp +0 -0
  299. package/docs/images/index/showcase-island.webp +0 -0
  300. package/docs/images/porting/threejs-shaders/dissolve.webp +0 -0
  301. package/docs/images/shaders/builtins/builtins.webp +0 -0
  302. package/docs/images/shaders/surface-functions/custom-surface.webp +0 -0
  303. package/docs/images/shaders/surface-functions/vertex-offset.webp +0 -0
  304. package/docs/images/shots.json +2231 -0
  305. package/docs/index.md +14 -23
  306. package/docs/moves.json +1 -0
  307. package/docs/nav.json +300 -0
  308. package/docs/pages.md +230 -212
  309. package/docs/porting/react-three-fiber.md +2 -6
  310. package/docs/porting/threejs-loop-and-threads.md +1 -5
  311. package/docs/porting/threejs-mapping.md +1248 -234
  312. package/docs/porting/threejs-materials.md +10 -5
  313. package/docs/porting/threejs-overview.md +26 -6
  314. package/docs/porting/threejs-postprocessing.md +2 -6
  315. package/docs/porting/threejs-shaders.md +16 -14
  316. package/docs/porting/threejs-unsupported.md +6 -6
  317. package/docs/porting/verification.md +0 -4
  318. package/docs/shaders/builtins.md +15 -4
  319. package/docs/shaders/library.md +9 -6
  320. package/docs/shaders/surface-functions.md +51 -16
  321. package/docs/shaders/wgsl-rules.md +12 -5
  322. package/lib/debug/debug.d.ts +2 -2
  323. package/lib/debug/draw.d.ts +2 -2
  324. package/lib/debug/draw.js +8 -4
  325. package/lib/debug/overlay-look.d.ts +6 -0
  326. package/lib/debug/overlay-look.js +29 -7
  327. package/lib/debug/overlay.js +15 -11
  328. package/lib/debug/stats-options.d.ts +13 -0
  329. package/lib/debug/stats-panel.d.ts +21 -6
  330. package/lib/debug/stats-panel.js +80 -13
  331. package/lib/errors/codes.d.ts +17 -3
  332. package/lib/errors/codes.js +111 -105
  333. package/lib/errors/fixes.js +18 -18
  334. package/lib/gpu/variants.d.ts +8 -2
  335. package/lib/gpu/variants.js +39 -7
  336. package/lib/gpu/webgl2/programs.js +1 -1
  337. package/lib/gpu/webgpu/pipelines.js +13 -13
  338. package/lib/index.d.ts +1 -1
  339. package/lib/page/capabilities.d.ts +1 -1
  340. package/lib/page/engine.d.ts +14 -5
  341. package/lib/page/engine.js +18 -2
  342. package/lib/page/label-loop.js +9 -4
  343. package/lib/page/stats-switch.js +2 -0
  344. package/lib/page/switches.d.ts +6 -4
  345. package/lib/page/switches.js +20 -4
  346. package/lib/scene/baked-light.d.ts +2 -2
  347. package/lib/scene/fake-call-values.js +2 -2
  348. package/lib/scene/frame-cameras.d.ts +16 -4
  349. package/lib/scene/frame-cameras.js +28 -10
  350. package/lib/scene/gltf.d.ts +1 -1
  351. package/lib/scene/level-rule.d.ts +6 -5
  352. package/lib/scene/level-rule.js +2 -2
  353. package/lib/scene/particles.d.ts +7 -3
  354. package/lib/scene/particles.js +3 -1
  355. package/lib/scene/post.d.ts +3 -2
  356. package/lib/scene/resources.d.ts +15 -9
  357. package/lib/scene/scene.d.ts +18 -2
  358. package/lib/scene/scene.js +47 -5
  359. package/lib/scene/time-of-day.d.ts +10 -5
  360. package/lib/scene/time-of-day.js +11 -7
  361. package/lib/shader-artifact.json +1 -1
  362. package/lib/shared/labels.d.ts +5 -2
  363. package/lib/shared/labels.js +5 -2
  364. package/lib/shared/permutation-words.d.ts +2 -0
  365. package/lib/shared/permutation-words.js +8 -0
  366. package/lib/shared/recording.d.ts +13 -5
  367. package/lib/shared/recording.js +31 -10
  368. package/lib/shared/sketch-data.d.ts +9 -0
  369. package/lib/shared/sketch-data.js +57 -0
  370. package/lib/shared/version.d.ts +1 -1
  371. package/lib/shared/version.js +1 -1
  372. package/lib/sketch/define-sketch.d.ts +16 -7
  373. package/lib/sketch/define-sketch.js +2 -1
  374. package/lib/sketch/runner.d.ts +4 -0
  375. package/lib/sketch/runner.js +5 -0
  376. package/lib/sketch/ui.js +4 -2
  377. package/lib/stats.d.ts +1 -0
  378. package/lib/workers/protocol.d.ts +10 -0
  379. package/lib/workers/render-worker.js +4 -1
  380. package/lib/workers/sketch-worker.js +4 -1
  381. package/package.json +1 -1
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/grass
3
3
  title: "Grass (@null3d/grass): API reference"
4
- status: generated
5
- since: "0.3"
4
+ generated: true
6
5
  summary: "Every export of the Grass (@null3d/grass) API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -16,12 +15,23 @@ summary: "Every export of the Grass (@null3d/grass) API, from the engine's doc c
16
15
  function createGrass(ctx: SketchContext, options: GrassOptions): Promise<Grass>
17
16
  ```
18
17
 
18
+ Import from `@null3d/grass`.
19
+
19
20
  Makes the grass: one draw for each tuft shape, filled with the placed tufts, and the calls that draw a preset's share and give the blades the frame's air. A page awaits it in its setup.
20
21
 
22
+ | Parameter | Description |
23
+ | --- | --- |
24
+ | `ctx` | The sketch's context. |
25
+ | `options` | The ground, the area, the count and the seed. |
26
+
27
+ Returns: The grass's draws, ready to draw.
28
+
21
29
  ## `Grass`
22
30
 
23
31
  Interface `Grass`.
24
32
 
33
+ Import from `@null3d/grass`.
34
+
25
35
  The grass that `createGrass` made: the draws, and the calls that draw a preset's share and give them the frame's air.
26
36
 
27
37
  | Member | Description |
@@ -36,6 +46,8 @@ The grass that `createGrass` made: the draws, and the calls that draw a preset's
36
46
 
37
47
  Interface `GrassBladeShape`.
38
48
 
49
+ Import from `@null3d/grass`.
50
+
39
51
  The shape of a cover's blades, which `createGrass` gives every blade in place of its own narrowing strip.
40
52
 
41
53
  | Member | Description |
@@ -47,6 +59,8 @@ The shape of a cover's blades, which `createGrass` gives every blade in place of
47
59
 
48
60
  Interface `GrassDraw`.
49
61
 
62
+ Import from `@null3d/grass`.
63
+
50
64
  One shape's tufts: the rows that draw them and the draw that fills them.
51
65
 
52
66
  | Member | Description |
@@ -58,6 +72,8 @@ One shape's tufts: the rows that draw them and the draw that fills them.
58
72
 
59
73
  Interface `GrassMaterial`.
60
74
 
75
+ Import from `@null3d/grass`.
76
+
61
77
  The part of a grass material that the grass itself sets.
62
78
 
63
79
  | Member | Description |
@@ -68,6 +84,8 @@ The part of a grass material that the grass itself sets.
68
84
 
69
85
  Interface `GrassOptions`.
70
86
 
87
+ Import from `@null3d/grass`.
88
+
71
89
  What `createGrass` takes: the ground, the area, the count at the High preset, and the seed.
72
90
 
73
91
  | Member | Description |
@@ -96,22 +114,44 @@ What `createGrass` takes: the ground, the area, the count at the High preset, an
96
114
  function hashAt(seed: number, a = 0, b = 0, c = 0, d = 0): number
97
115
  ```
98
116
 
117
+ Import from `@null3d/grass`.
118
+
99
119
  The hash of a seed and up to four choice keys. The keys are mixed in order, so a choice names the thing, its part and the value it picks with a key of its own.
100
120
 
121
+ | Parameter | Description |
122
+ | --- | --- |
123
+ | `seed` | The seed. |
124
+ | `a` | The first key. |
125
+ | `b` | The second key. |
126
+ | `c` | The third key. |
127
+ | `d` | The fourth key. |
128
+
129
+ Returns: A 32-bit hash.
130
+
101
131
  ## `pcg`
102
132
 
103
133
  ```ts
104
134
  function pcg(value: number): number
105
135
  ```
106
136
 
137
+ Import from `@null3d/grass`.
138
+
107
139
  The permutation of one 32-bit value, with the same bits as the shaders' `pcg`.
108
140
 
141
+ | Parameter | Description |
142
+ | --- | --- |
143
+ | `value` | The value to hash. |
144
+
145
+ Returns: The hashed value.
146
+
109
147
  ## `PLANT_SWAY_DISTANCE`
110
148
 
111
149
  ```ts
112
150
  const PLANT_SWAY_DISTANCE: Readonly<Record<QualityPreset, number>>
113
151
  ```
114
152
 
153
+ Import from `@null3d/grass`.
154
+
115
155
  The distance from the camera out to which plants and grass sway, in meters, for each preset. A page reads it from the engine's preset, so a governor step that lowers the preset shortens the distance with it.
116
156
 
117
157
  ## `swayDistanceFor`
@@ -120,12 +160,32 @@ The distance from the camera out to which plants and grass sway, in meters, for
120
160
  function swayDistanceFor(preset: QualityPreset): number
121
161
  ```
122
162
 
163
+ Import from `@null3d/grass`.
164
+
123
165
  The distance from the camera out to which plants and grass sway at a preset, in meters. Pass it as `swayDistance` to `createGrass` and to a swaying plant's material, and again to `grass.setSwayDistance` when the preset changes.
124
166
 
167
+ | Parameter | Description |
168
+ | --- | --- |
169
+ | `preset` | The engine's quality preset. |
170
+
171
+ Returns: The distance that {@link PLANT_SWAY_DISTANCE} gives the preset.
172
+
125
173
  ## `unitAt`
126
174
 
127
175
  ```ts
128
176
  function unitAt(seed: number, a = 0, b = 0, c = 0, d = 0): number
129
177
  ```
130
178
 
179
+ Import from `@null3d/grass`.
180
+
131
181
  A choice between 0 and 1, from a seed and its keys. The top 24 bits of the hash make the value, so every device gets the same fraction.
182
+
183
+ | Parameter | Description |
184
+ | --- | --- |
185
+ | `seed` | The seed. |
186
+ | `a` | The first key. |
187
+ | `b` | The second key. |
188
+ | `c` | The third key. |
189
+ | `d` | The fourth key. |
190
+
191
+ Returns: A value in [0, 1).
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/impostors
3
3
  title: "Impostors (@null3d/impostors): API reference"
4
- status: generated
5
- since: "0.2"
4
+ generated: true
6
5
  summary: "Every export of the Impostors (@null3d/impostors) API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -16,7 +15,17 @@ summary: "Every export of the Impostors (@null3d/impostors) API, from the engine
16
15
  function bakeImpostorAtlas(options: ImpostorBakeOptions): ImpostorBake
17
16
  ```
18
17
 
19
- Draws `parts` from every cell of `atlas` into the colour and surface atlases, which it returns. The bake is arithmetic over the arrays. It gives the same pixels on every device, so both GPU paths draw one card.
18
+ Import from `@null3d/impostors`.
19
+
20
+ Draws `parts` from every cell of `atlas` into the color and surface atlases, which it returns.
21
+
22
+ The bake is arithmetic over the arrays. It gives the same pixels on every device, so both GPU paths draw one card.
23
+
24
+ | Parameter | Description |
25
+ | --- | --- |
26
+ | `options` | The grid, the cells' size and the parts. |
27
+
28
+ Returns: The two atlases and the size of a card.
20
29
 
21
30
  ## `createImpostors`
22
31
 
@@ -24,7 +33,11 @@ Draws `parts` from every cell of `atlas` into the colour and surface atlases, wh
24
33
  function createImpostors(ctx: ImpostorContext, options: ImpostorOptions): ImpostorBatch
25
34
  ```
26
35
 
27
- Makes a batch of impostor cards: one card per position, drawn from the three atlas views nearest the direction from the card toward the eye, and lit by the scene's lights. The cards need no `update` call: the material reads the eye from the frame's camera. A card's turn, in `turn`, turns its views and its light by the same angle about the world's up, so a turned tree hands over to a card whose crown matches it. A batch that casts the sun's shadow cuts that shadow to the crown's shape, and a batch that receives shadows reads them at the surface that it shows.
36
+ Import from `@null3d/impostors`.
37
+
38
+ Makes a batch of impostor cards: one card per position, drawn from the three atlas views nearest the direction from the card toward the eye, and lit by the scene's lights. The cards need no `update` call: the material reads the eye from the frame's camera.
39
+
40
+ A card's turn, in `turn`, turns its views and its light by the same angle about the world's up, so a turned tree hands over to a card whose crown matches it. A batch that casts the sun's shadow cuts that shadow to the crown's shape, and a batch that receives shadows reads them at the surface that it shows.
28
41
 
29
42
  ## `decodeOctahedral`
30
43
 
@@ -32,6 +45,8 @@ Makes a batch of impostor cards: one card per position, drawn from the three atl
32
45
  function decodeOctahedral(uv: OctahedralUv, out: [number, number, number] = [0, 0, 0]): Direction
33
46
  ```
34
47
 
48
+ Import from `@null3d/impostors`.
49
+
35
50
  The unit direction that an octahedral coordinate pair names, the inverse of `encodeOctahedral`. Encoding the result gives the pair again, except on the square's outer edges, where the fold makes two points name one direction.
36
51
 
37
52
  ## `Direction`
@@ -40,6 +55,8 @@ The unit direction that an octahedral coordinate pair names, the inverse of `enc
40
55
  type Direction = readonly [number, number, number];
41
56
  ```
42
57
 
58
+ Import from `@null3d/impostors`.
59
+
43
60
  A direction, three numbers. It need not have length 1: this module makes it unit length.
44
61
 
45
62
  ## `EDGE_BAND`
@@ -48,6 +65,8 @@ A direction, three numbers. It need not have length 1: this module makes it unit
48
65
  const EDGE_BAND: 0.08
49
66
  ```
50
67
 
68
+ Import from `@null3d/impostors`.
69
+
51
70
  The share of a draw range's edge distance over which the engine dithers that edge. The dither's phase comes from each copy's own source. The mesh and the card are different sources, so their phases differ: a card that faded in while the mesh faded out would drop the pixels that both left out, and the background would show through the crown.
52
71
 
53
72
  ## `encodeImpostorSurface`
@@ -56,6 +75,8 @@ The share of a draw range's edge distance over which the engine dithers that edg
56
75
  function encodeImpostorSurface(normal: Direction, depth: number, coverage = 1, out: Uint8Array = new Uint8Array(4)): Uint8Array
57
76
  ```
58
77
 
78
+ Import from `@null3d/impostors`.
79
+
59
80
  Writes the surface atlas's texel for a point of a view: the normal in the view's space, where x and y lie across and up the picture and z points at the viewer, the point's depth from the view's front, 0, to its back, 1, and its coverage. `out` takes the four bytes, and is returned, so a bake writes one buffer without allocating.
60
81
 
61
82
  ## `encodeOctahedral`
@@ -64,6 +85,8 @@ Writes the surface atlas's texel for a point of a view: the normal in the view's
64
85
  function encodeOctahedral(direction: Direction, out: OctahedralUv = [0, 0]): OctahedralUv
65
86
  ```
66
87
 
88
+ Import from `@null3d/impostors`.
89
+
67
90
  Folds a direction onto the octahedron's two coordinates, each from -1 to 1. The front half of the sphere, z from 0 up, fills the square's middle diamond, and the back half fills its four corners, so a grid of cells covers the whole sphere. The back pole, (0, 0, -1), lands on the corner (1, 1).
68
91
 
69
92
  ## `farCellGroups`
@@ -72,12 +95,16 @@ Folds a direction onto the octahedron's two coordinates, each from -1 to 1. The
72
95
  function farCellGroups(centers: readonly (readonly [number, number, number])[], cellSize: number): number[][]
73
96
  ```
74
97
 
98
+ Import from `@null3d/impostors`.
99
+
75
100
  Groups copies by the grid cell of their centers: the cell a center falls in is its position divided by `cellSize` and rounded down, along each axis. Merge each group into one mesh, so a large world draws a few meshes instead of one per copy. Centers that share a cell, in the order they were given, come back as one list.
76
101
 
77
102
  ## `FarPart`
78
103
 
79
104
  Interface `FarPart`.
80
105
 
106
+ Import from `@null3d/impostors`.
107
+
81
108
  One copy of a mesh in a merge: its arrays, and the transform that places it. The transform is a column-major 4 by 4 matrix, as `mat4` writes; without one the copy stays where its arrays are.
82
109
 
83
110
  | Member | Description |
@@ -91,6 +118,8 @@ One copy of a mesh in a merge: its arrays, and the transform that places it. The
91
118
  function frameDirection(frame: number, atlas: OctahedralAtlas, out: [number, number, number] = [0, 0, 0]): Direction
92
119
  ```
93
120
 
121
+ Import from `@null3d/impostors`.
122
+
94
123
  The direction that the view of a cell was drawn from: the center of the octahedron's cell, as a unit direction. `impostorFrame` of the result gives `frame` again.
95
124
 
96
125
  ## `HAND_OVER_GROUPS`
@@ -99,6 +128,8 @@ The direction that the view of a cell was drawn from: the center of the octahedr
99
128
  const HAND_OVER_GROUPS: 4
100
129
  ```
101
130
 
131
+ Import from `@null3d/impostors`.
132
+
102
133
  The groups that a plant's trees hand over in, and how far either side of the plant's switch distance the groups' switches spread, as a share of it. The groups are what keeps one frame from taking every tree's mesh at once: a tree's own swap is as it was, but the trees around it swap a little before or after it, so a view loses one group's cards a frame instead of all of them.
103
134
 
104
135
  ## `HAND_OVER_SPREAD`
@@ -107,6 +138,8 @@ The groups that a plant's trees hand over in, and how far either side of the pla
107
138
  const HAND_OVER_SPREAD: 0.06
108
139
  ```
109
140
 
141
+ Import from `@null3d/impostors`.
142
+
110
143
  The share of the hand-over distance that the groups' switches spread either side of it, so the first group swaps a little early and the last a little late and the change is spread over a short stretch of travel rather than landing in one frame.
111
144
 
112
145
  ## `handOverCards`
@@ -115,6 +148,8 @@ The share of the hand-over distance that the groups' switches spread either side
115
148
  function handOverCards(cards: InstanceBatch, earliestSwitch: number): void
116
149
  ```
117
150
 
151
+ Import from `@null3d/impostors`.
152
+
118
153
  Starts a batch of cards early enough that they stand at full coverage before the earliest mesh group that hands over to them begins to thin. Write the cards' turns and sizes before this call.
119
154
 
120
155
  ## `handOverMeshes`
@@ -123,6 +158,8 @@ Starts a batch of cards early enough that they stand at full coverage before the
123
158
  function handOverMeshes(meshes: InstanceBatch, switchDistance: number, start = 0): void
124
159
  ```
125
160
 
161
+ Import from `@null3d/impostors`.
162
+
126
163
  Draws a group of near meshes from `start` up to its switch distance, where the engine dithers the range's far edge out.
127
164
 
128
165
  ## `handOverSwitches`
@@ -131,6 +168,8 @@ Draws a group of near meshes from `start` up to its switch distance, where the e
131
168
  function handOverSwitches(switchDistance: number, count = HAND_OVER_GROUPS, spread = HAND_OVER_SPREAD): number[]
132
169
  ```
133
170
 
171
+ Import from `@null3d/impostors`.
172
+
134
173
  The switch distances of `count` groups, spread evenly either side of `switchDistance`: the first group hands over earliest and the last latest, and their mean is the switch distance itself. A group draws its meshes up to its own distance, so a camera crossing the plant's hand-over meets one group's switch after another.
135
174
 
136
175
  ## `handOverToCards`
@@ -139,7 +178,18 @@ The switch distances of `count` groups, spread evenly either side of `switchDist
139
178
  function handOverToCards(meshes: InstanceBatch, cards: InstanceBatch, switchDistance: number, start = 0): void
140
179
  ```
141
180
 
142
- Hands one group of near meshes over to its far cards. The meshes draw up to `switchDistance`, and the cards start early enough that their own dithered edge ends before the meshes' edge begins to thin. So each pixel that a mesh drops shows its card at full coverage, and the background never shows through. Write the cards' turns and sizes before this call, and call it at setup. A plant that hands over in groups calls `handOverCards` once with the earliest group's switch, so the cards stand behind every group, and `handOverMeshes` once for each group's own distance.
181
+ Import from `@null3d/impostors`.
182
+
183
+ Hands one group of near meshes over to its far cards. The meshes draw up to `switchDistance`, and the cards start early enough that their own dithered edge ends before the meshes' edge begins to thin. So each pixel that a mesh drops shows its card at full coverage, and the background never shows through. Write the cards' turns and sizes before this call, and call it at setup.
184
+
185
+ A plant that hands over in groups calls `handOverCards` once with the earliest group's switch, so the cards stand behind every group, and `handOverMeshes` once for each group's own distance.
186
+
187
+ | Parameter | Description |
188
+ | --- | --- |
189
+ | `meshes` | The batch of near meshes, whose rows stand at the same places as the cards' rows. |
190
+ | `cards` | The card batch, such as `ImpostorBatch.batch`. |
191
+ | `switchDistance` | The distance from the camera at which these trees hand over, in meters. |
192
+ | `start` | The distance from which the meshes draw, in meters: 0 for a batch that draws from the camera out, or the start of a coarser level's own band. |
143
193
 
144
194
  ## `IMPOSTOR_FILE_FORMAT`
145
195
 
@@ -147,12 +197,16 @@ Hands one group of near meshes over to its far cards. The meshes draw up to `swi
147
197
  const IMPOSTOR_FILE_FORMAT: 'null3d-impostor'
148
198
  ```
149
199
 
200
+ Import from `@null3d/impostors`.
201
+
150
202
  The `format` field of an impostor atlas file.
151
203
 
152
204
  ## `ImpostorAtlasFile`
153
205
 
154
206
  Interface `ImpostorAtlasFile`.
155
207
 
208
+ Import from `@null3d/impostors`.
209
+
156
210
  What an impostor atlas file holds: the bake's grid and figures, and the names of its two images.
157
211
 
158
212
  | Member | Description |
@@ -161,7 +215,7 @@ What an impostor atlas file holds: the bake's grid and figures, and the names of
161
215
  | `readonly version: number` | The format's version: 1. |
162
216
  | `readonly atlas: OctahedralAtlas` | The cells across and down. |
163
217
  | `readonly texels: number` | The texels on each side of a cell. |
164
- | `readonly color: string` | The colour atlas's PNG file, next to this file: sRGB colour, with the coverage in alpha. |
218
+ | `readonly color: string` | The color atlas's PNG file, next to this file: sRGB color, with the coverage in alpha. |
165
219
  | `readonly surface: string` | The surface atlas's PNG file, next to this file: linear normals, depth and coverage. |
166
220
  | `readonly size: readonly [number, number]` | The card's width and height at scale 1, as the bake's `size`. |
167
221
  | `readonly room: number` | How much taller a view's picture is than the card's height, as the bake's `room`. |
@@ -173,12 +227,14 @@ What an impostor atlas file holds: the bake's grid and figures, and the names of
173
227
 
174
228
  Interface `ImpostorBake`.
175
229
 
176
- The two atlases that a bake writes: the colour in sRGB, with the coverage in alpha, and the surface in linear colour, as `createImpostors` takes them.
230
+ Import from `@null3d/impostors`.
231
+
232
+ The two atlases that a bake writes: the color in sRGB, with the coverage in alpha, and the surface in linear color, as `createImpostors` takes them.
177
233
 
178
234
  | Member | Description |
179
235
  | --- | --- |
180
236
  | `readonly atlas: OctahedralAtlas` | The grid that the bake drew. |
181
- | `readonly color: { width: number; height: number; data: Uint8Array; }` | The colour atlas: its texels, and their grid. |
237
+ | `readonly color: { width: number; height: number; data: Uint8Array; }` | The color atlas: its texels, and their grid. |
182
238
  | `readonly surface: { width: number; height: number; data: Uint8Array; }` | The surface atlas: its texels, and their grid. |
183
239
  | `readonly size: readonly [number, number]` | The world size of one card's quad at scale 1: the width that holds the object's widest horizontal reach, and its height. The card stands on the object's lowest point. |
184
240
  | `readonly room: number` | How many times taller a view's picture is than `size`'s height, which holds the object from every view: `createImpostors` takes it as `room`. |
@@ -188,6 +244,8 @@ The two atlases that a bake writes: the colour in sRGB, with the coverage in alp
188
244
 
189
245
  Interface `ImpostorBakeMap`.
190
246
 
247
+ Import from `@null3d/impostors`.
248
+
191
249
  A map that a bake samples: its pixels, four bytes a texel in the first row first, and the cell that a part draws.
192
250
 
193
251
  | Member | Description |
@@ -204,6 +262,8 @@ A map that a bake samples: its pixels, four bytes a texel in the first row first
204
262
 
205
263
  Interface `ImpostorBakeOptions`.
206
264
 
265
+ Import from `@null3d/impostors`.
266
+
207
267
  What `bakeImpostorAtlas` takes: the grid, its cells' size, and the object.
208
268
 
209
269
  | Member | Description |
@@ -218,18 +278,20 @@ What `bakeImpostorAtlas` takes: the grid, its cells' size, and the object.
218
278
 
219
279
  Interface `ImpostorBakePart`.
220
280
 
221
- One part that a bake draws: its mesh arrays and what colours its surface.
281
+ Import from `@null3d/impostors`.
282
+
283
+ One part that a bake draws: its mesh arrays and what colors its surface.
222
284
 
223
285
  | Member | Description |
224
286
  | --- | --- |
225
287
  | `readonly positions: ArrayLike<number>` | The vertices' positions, three numbers each, in the object's frame. |
226
288
  | `readonly normals?: ArrayLike<number>` | The vertices' normals, three numbers each. They are made where the part leaves them out. |
227
289
  | `readonly uvs?: ArrayLike<number>` | The vertices' texture coordinates, two numbers each, where a map is drawn. |
228
- | `readonly colors?: ArrayLike<number>` | The vertices' colours, three or four numbers each, linear. A fourth number is the vertex's coverage. |
290
+ | `readonly colors?: ArrayLike<number>` | The vertices' colors, three or four numbers each, linear. A fourth number is the vertex's coverage. |
229
291
  | `readonly indices: ArrayLike<number>` | The triangles' vertices, three each. |
230
- | `readonly color?: ImpostorBakeMap` | The colour map, in sRGB, that the part samples. Its alpha is not the coverage. |
292
+ | `readonly color?: ImpostorBakeMap` | The color map, in sRGB, that the part samples. Its alpha is not the coverage. |
231
293
  | `readonly coverage?: ImpostorBakeMap` | The coverage map, linear: its blue holds the coverage. |
232
- | `readonly tint?: readonly [number, number, number]` | A linear colour that multiplies the part's own colour. The default is white. |
294
+ | `readonly tint?: readonly [number, number, number]` | A linear color that multiplies the part's own color. The default is white. |
233
295
  | `readonly alphaCutoff?: number` | The coverage under which nothing draws. The default is 0.5. |
234
296
  | `readonly doubleSided?: boolean` | True to draw both sides of the part's triangles and light the back ones. |
235
297
 
@@ -237,6 +299,8 @@ One part that a bake draws: its mesh arrays and what colours its surface.
237
299
 
238
300
  Class `ImpostorBatch`.
239
301
 
302
+ Import from `@null3d/impostors`.
303
+
240
304
  A batch of impostor cards, which `createImpostors` makes. The cards need no per-frame work: the material reads the eye from the frame's camera and picks each card's views itself. Write the cards' positions, sizes, turns or colors through `batch`, then call `markDirty` for those cards.
241
305
 
242
306
  | Member | Description |
@@ -251,6 +315,8 @@ A batch of impostor cards, which `createImpostors` makes. The cards need no per-
251
315
 
252
316
  Interface `ImpostorContext`.
253
317
 
318
+ Import from `@null3d/impostors`.
319
+
254
320
  What `createImpostors` needs of the sketch: the scene, and the factories it draws with.
255
321
 
256
322
  | Member | Description |
@@ -265,17 +331,21 @@ What `createImpostors` needs of the sketch: the scene, and the factories it draw
265
331
  function impostorFrame(direction: Direction, atlas: OctahedralAtlas): number
266
332
  ```
267
333
 
334
+ Import from `@null3d/impostors`.
335
+
268
336
  The cell of an atlas that shows a view from `direction`, as a frame counted from the atlas's top left, along each row and then down. A view was drawn from the direction a cell's center names, so a bake that walks `frameDirection` over every frame and this agree on every cell. A direction of length 0 shows the middle cell.
269
337
 
270
338
  ## `ImpostorOptions`
271
339
 
272
340
  Interface `ImpostorOptions`.
273
341
 
342
+ Import from `@null3d/impostors`.
343
+
274
344
  Options of `createImpostors`: the atlases, the cards and their look.
275
345
 
276
346
  | Member | Description |
277
347
  | --- | --- |
278
- | `readonly color: Texture` | The colour of every view, in sRGB: one cell per view, in the cells of `atlas`. |
348
+ | `readonly color: Texture` | The color of every view, in sRGB: one cell per view, in the cells of `atlas`. |
279
349
  | `readonly surface: Texture` | The surface of every view, in the same cells as `color`: red and green hold the octahedral code of the normal in the object's frame, blue its depth from the view's front to its back, and alpha its coverage. `bakeImpostorAtlas` writes one. |
280
350
  | `readonly atlas: OctahedralAtlas` | The cells of the atlases: the frames across and down. |
281
351
  | `readonly positions: ArrayLike<number>` | The cards: three numbers each, x, y and z, in world units. Each stands on its position, like a tree on the ground. Their count is the batch's size. |
@@ -297,11 +367,13 @@ Options of `createImpostors`: the atlases, the cards and their look.
297
367
 
298
368
  Interface `LoadedImpostorAtlas`.
299
369
 
370
+ Import from `@null3d/impostors`.
371
+
300
372
  A baked atlas that `loadImpostorAtlas` loaded: the fields that `createImpostors` takes from a bake, so a sketch spreads it into the options.
301
373
 
302
374
  | Member | Description |
303
375
  | --- | --- |
304
- | `readonly color: Texture` | The colour atlas, in sRGB, with no mipmaps. |
376
+ | `readonly color: Texture` | The color atlas, in sRGB, with no mipmaps. |
305
377
  | `readonly surface: Texture` | The surface atlas, linear, with no mipmaps. |
306
378
  | `readonly atlas: OctahedralAtlas` | The cells across and down. |
307
379
  | `readonly size: readonly [number, number]` | The card's width and height at scale 1. |
@@ -314,7 +386,23 @@ A baked atlas that `loadImpostorAtlas` loaded: the fields that `createImpostors`
314
386
  function loadImpostorAtlas(assets: Pick<Assets, 'loadJson' | 'loadTexture'>, url: string | URL): Promise<LoadedImpostorAtlas>
315
387
  ```
316
388
 
317
- Loads an impostor atlas file that `bunx @null3d/cli assets impostor` wrote, with its two images. The images load from the JSON file's folder. The result holds the fields that `createImpostors` takes from a bake: ```ts const pine = await loadImpostorAtlas(assets, 'pine-impostor.json'); const trees = createImpostors({ scene, materials, geometry }, { ...pine, positions, alphaMode: 'mask' }); ```
389
+ Import from `@null3d/impostors`.
390
+
391
+ Loads an impostor atlas file that `bunx @null3d/cli assets impostor` wrote, with its two images.
392
+
393
+ The images load from the JSON file's folder. The result holds the fields that `createImpostors` takes from a bake:
394
+
395
+ ```ts
396
+ const pine = await loadImpostorAtlas(assets, 'pine-impostor.json');
397
+ const trees = createImpostors({ scene, materials, geometry }, { ...pine, positions, alphaMode: 'mask' });
398
+ ```
399
+
400
+ | Parameter | Description |
401
+ | --- | --- |
402
+ | `assets` | The sketch's asset loader. |
403
+ | `url` | The JSON file's address. |
404
+
405
+ Returns: The two atlases and the bake's figures.
318
406
 
319
407
  ## `mergeFarGeometry`
320
408
 
@@ -322,7 +410,13 @@ Loads an impostor atlas file that `bunx @null3d/cli assets impostor` wrote, with
322
410
  function mergeFarGeometry(parts: readonly FarPart[]): MeshArrays
323
411
  ```
324
412
 
325
- Merges copies of a mesh into the arrays of one mesh, moving each copy by its own transform. The result holds every vertex and triangle of every copy, with each copy's indices moved to point at its own vertices. Give it to `geometry.fromArrays`. Every copy must carry the same attributes, and each attribute must hold the same numbers per vertex in every copy. An attribute that any copy lacks is left out of the result. Positions are always carried, and indices are made for a copy that has none. A copy's normals turn by the inverse transpose of its transform's upper left 3 by 3, as normals turn, so a stretched copy keeps its shading. Its tangents turn by the upper left 3 by 3 itself. A mirrored copy, whose transform has a negative determinant, gets its triangles' winding reversed and its tangents' fourth number negated, so its front faces stay outward and its normal map keeps its sense. Throws a RangeError for arrays that do not fit together.
413
+ Import from `@null3d/impostors`.
414
+
415
+ Merges copies of a mesh into the arrays of one mesh, moving each copy by its own transform. The result holds every vertex and triangle of every copy, with each copy's indices moved to point at its own vertices. Give it to `geometry.fromArrays`.
416
+
417
+ Every copy must carry the same attributes, and each attribute must hold the same numbers per vertex in every copy. An attribute that any copy lacks is left out of the result. Positions are always carried, and indices are made for a copy that has none.
418
+
419
+ A copy's normals turn by the inverse transpose of its transform's upper left 3 by 3, as normals turn, so a stretched copy keeps its shading. Its tangents turn by the upper left 3 by 3 itself. A mirrored copy, whose transform has a negative determinant, gets its triangles' winding reversed and its tangents' fourth number negated, so its front faces stay outward and its normal map keeps its sense. Throws a RangeError for arrays that do not fit together.
326
420
 
327
421
  ## `nearestFrame`
328
422
 
@@ -330,6 +424,8 @@ Merges copies of a mesh into the arrays of one mesh, moving each copy by its own
330
424
  function nearestFrame(direction: Direction, directions: readonly Direction[]): number
331
425
  ```
332
426
 
427
+ Import from `@null3d/impostors`.
428
+
333
429
  The view of a list of directions that faces the camera most: the one whose direction has the largest dot product with `direction`. Use it when a bake holds views that are not an octahedral grid, such as 12 views a tool picked. It returns -1 for an empty list.
334
430
 
335
431
  ## `octahedralAtlas`
@@ -338,12 +434,16 @@ The view of a list of directions that faces the camera most: the one whose direc
338
434
  function octahedralAtlas(views: number): OctahedralAtlas
339
435
  ```
340
436
 
437
+ Import from `@null3d/impostors`.
438
+
341
439
  The squarest grid of cells that holds at least `views` views, as `{ columns, rows }`. The grid can hold more cells than `views`, and every cell shows a direction. Give the result to a bake, which draws a view in each cell, and to `createImpostors`, which shows them.
342
440
 
343
441
  ## `OctahedralAtlas`
344
442
 
345
443
  Interface `OctahedralAtlas`.
346
444
 
445
+ Import from `@null3d/impostors`.
446
+
347
447
  The cells of an impostor atlas: `columns` across and `rows` down, as a sprite atlas.
348
448
 
349
449
  | Member | Description |
@@ -357,6 +457,8 @@ The cells of an impostor atlas: `columns` across and `rows` down, as a sprite at
357
457
  function octahedralCells(atlas: OctahedralAtlas): number
358
458
  ```
359
459
 
460
+ Import from `@null3d/impostors`.
461
+
360
462
  The number of cells of an octahedral atlas: `columns` times `rows`. A bake draws a view in each of them, because each shows a direction.
361
463
 
362
464
  ## `OctahedralUv`
@@ -365,4 +467,6 @@ The number of cells of an octahedral atlas: `columns` times `rows`. A bake draws
365
467
  type OctahedralUv = [number, number];
366
468
  ```
367
469
 
470
+ Import from `@null3d/impostors`.
471
+
368
472
  Two octahedral coordinates, each from -1 to 1.
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/input
3
3
  title: "Input: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Input API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/lights
3
3
  title: "Lights: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Lights API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -30,7 +29,9 @@ Options for `scene.createAmbientLight`.
30
29
 
31
30
  Class `DirectionalLight`, which extends `Light`.
32
31
 
33
- Light from one direction, like sunlight. It travels along the light's -Z axis, which `setDirection`, `lookAt` and the light's parents turn. Its position does not matter. Up to four directional lights light surfaces at once. The first one created casts the shadows, when `castShadows` is on, and up to three more light as fill and rim lights, without shadows. A fifth directional light gives no light.
32
+ Light from one direction, like sunlight. It travels along the light's -Z axis, which `setDirection`, `lookAt` and the light's parents turn. Its position does not matter.
33
+
34
+ Up to four directional lights light surfaces at once. The first one created casts the shadows, when `castShadows` is on, and up to three more light as fill and rim lights, without shadows. A fifth directional light gives no light.
34
35
 
35
36
  | Member | Description |
36
37
  | --- | --- |
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/lines
3
3
  title: "Lines: API reference"
4
- status: generated
5
- since: "0.2"
4
+ generated: true
6
5
  summary: "Every export of the Lines API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -51,7 +50,7 @@ Which points each segment joins. With `segments`, each pair of points makes a se
51
50
 
52
51
  ## `LineOptions`
53
52
 
54
- Interface `LineOptions`, which extends `LineValues`, `Pick`.
53
+ Interface `LineOptions`, which extends `LineValues`, `Pick<MaterialFeatures, 'fog' | 'depthWrite' | 'depthTest' | 'depthBias'>`.
55
54
 
56
55
  Options of `scene.createLines`. The look of the lines takes the options of an unlit material.
57
56
 
@@ -72,7 +71,7 @@ Options of `scene.createLines`. The look of the lines takes the options of an un
72
71
 
73
72
  ## `LineValues`
74
73
 
75
- Interface `LineValues`, which extends `Omit`, `Pick`.
74
+ Interface `LineValues`, which extends `Omit<MaterialOptions, 'alphaCutoff'>`, `Pick<StandardValues, 'metalness' | 'roughness' | 'emissive' | 'emissiveIntensity'>`.
76
75
 
77
76
  The values of a line batch's material, which `lines.material.set` changes at any time. The dash values act on dashed lines. The metalness, roughness and emissive values act on lit lines, as a standard material takes them.
78
77
 
@@ -1,8 +1,7 @@
1
1
  ---
2
2
  id: api/reference/materials
3
3
  title: "Materials: API reference"
4
- status: generated
5
- since: "0.1"
4
+ generated: true
6
5
  summary: "Every export of the Materials API, from the engine's doc comments."
7
6
  ---
8
7
 
@@ -16,7 +15,9 @@ summary: "Every export of the Materials API, from the engine's doc comments."
16
15
  type AlphaMode = 'opaque' | 'mask' | 'hash' | 'blend';
17
16
  ```
18
17
 
19
- How a material uses its alpha: its opacity, times its base color map's alpha, and times its mesh's vertex alpha with `vertexColors`. The `opaque` mode ignores the alpha. The `mask` mode draws nothing where the alpha falls below `alphaCutoff`, and draws the rest opaque. The `hash` mode draws each point of the surface opaque or not at all, by a pattern that stays on the mesh. The alpha then sets how much of the surface draws. The `blend` mode blends the surface over what lies behind it. Blended objects draw after the opaque ones, farthest first.
18
+ How a material uses its alpha: its opacity, times its base color map's alpha, and times its mesh's vertex alpha with `vertexColors`. The `opaque` mode ignores the alpha. The `mask` mode draws nothing where the alpha falls below `alphaCutoff`, and draws the rest opaque.
19
+
20
+ The `hash` mode draws each point of the surface opaque or not at all, by a pattern that stays on the mesh. The alpha then sets how much of the surface draws. The `blend` mode blends the surface over what lies behind it. Blended objects draw after the opaque ones, farthest first.
20
21
 
21
22
  ## `Blending`
22
23
 
@@ -47,13 +48,13 @@ WGSL that the null3D Vite plugin compiled: a template literal that a `wgsl` bloc
47
48
 
48
49
  ## `DecalOptions`
49
50
 
50
- Interface `DecalOptions`, which extends `DecalValues`, `Omit`.
51
+ Interface `DecalOptions`, which extends `DecalValues`, `Omit<StandardMaps, 'lightMap' | 'transmissionMap' | 'thicknessMap'>`.
51
52
 
52
53
  Options of `materials.decal`: its values and the standard material's maps, which the decal projects along its box. The light map is left out.
53
54
 
54
55
  ## `DecalValues`
55
56
 
56
- Interface `DecalValues`, which extends `Omit`.
57
+ Interface `DecalValues`, which extends `Omit<StandardValues, 'alphaCutoff' | 'lightMapIntensity' | 'transmission' | 'thickness' | 'dispersion' | 'attenuationColor' | 'attenuationDistance'>`.
57
58
 
58
59
  The values of a decal material, which `set` changes at any time: the standard material's values that a decal shows, and how the decal fades.
59
60
 
@@ -218,7 +219,7 @@ The texture maps of a standard material. They are fixed when the material is cre
218
219
  | `diffuseTransmissionMap?: Texture` | The diffuse transmission in alpha, in linear color. Its alpha multiplies `diffuseTransmission`. Only a material created with `diffuseTransmission` takes it, and such a material takes no specular maps. |
219
220
  | `diffuseTransmissionColorMap?: Texture` | The diffuse transmission color, in sRGB. Its color multiplies `diffuseTransmissionColor`. Only a material created with `diffuseTransmission` takes it, and such a material takes no specular maps. |
220
221
  | `transmissionMap?: Texture` | The share of the light behind the surface that passes through it, in red, in linear color. Its red multiplies `transmission`. Only a material created with `transmission` takes it. It keeps a row slot of its own and samples the specular intensity map's texture array at its own layer, so a specular intensity map may draw beside it when the two textures share an array. A material with layers keeps it unless a layer map fills that slot: a clear coat's normal map and iridescence's thickness map do. |
221
- | `thicknessMap?: Texture` | The thickness of the volume under the surface, in green, in linear color. Its green multiplies `thickness`. Only a material created with `transmission` takes it. It keeps a row slot of its own and samples the specular color map's texture array at its own layer, so a specular color map may draw beside it when the two textures share an array. A material with layers keeps it unless a layer map fills that slot: the sheen's maps and an anisotropy map do. |
222
+ | `thicknessMap?: Texture` | The thickness of the volume under the surface, in green, in linear color. Its green multiplies `thickness`. Only a material created with `transmission` takes it. It keeps a row slot of its own and samples the specular color map's texture array at its own layer, so it takes no specular color map, whose sRGB texture never shares that array. A material with layers keeps it unless a layer map fills that slot: the sheen's maps and an anisotropy map do. |
222
223
  | `clearcoatMap?: Texture` | The clear coat in red, in linear color, which multiplies `clearcoat`. A material with a clear coat or a sheen takes no light map and no specular maps, since its layers' maps take their places. |
223
224
  | `clearcoatRoughnessMap?: Texture` | The clear coat's roughness in green, in linear color, which multiplies `clearcoatRoughness`. With `clearcoatMap`, it is the same texture, as glTF packs them. |
224
225
  | `clearcoatNormalMap?: Texture` | The clear coat's normals in tangent space, in linear color, which `clearcoatNormalScale` scales. |