@null3d/engine 0.0.0-stage → 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 (1357) hide show
  1. package/LICENSE-APACHE +176 -0
  2. package/LICENSE-MIT +21 -0
  3. package/README.md +108 -2
  4. package/THIRD-PARTY-NOTICES.txt +637 -0
  5. package/dist/wasm/single/null3d.js +3972 -0
  6. package/dist/wasm/single/null3d_bg.wasm +0 -0
  7. package/dist/wasm/threaded/null3d.js +3988 -0
  8. package/dist/wasm/threaded/null3d_bg.wasm +0 -0
  9. package/docs/api/animation.md +492 -0
  10. package/docs/api/assets.md +400 -0
  11. package/docs/api/cameras.md +161 -0
  12. package/docs/api/controls.md +319 -0
  13. package/docs/api/debug.md +450 -0
  14. package/docs/api/engine.md +254 -0
  15. package/docs/api/feature-draws.md +172 -0
  16. package/docs/api/feature-effects.md +137 -0
  17. package/docs/api/feature-instances.md +154 -0
  18. package/docs/api/features.md +323 -0
  19. package/docs/api/geometry.md +307 -0
  20. package/docs/api/grass.md +114 -0
  21. package/docs/api/impostors.md +274 -0
  22. package/docs/api/input.md +238 -0
  23. package/docs/api/lights.md +266 -0
  24. package/docs/api/lines.md +163 -0
  25. package/docs/api/materials.md +875 -0
  26. package/docs/api/math.md +129 -0
  27. package/docs/api/objects.md +155 -0
  28. package/docs/api/page.md +97 -0
  29. package/docs/api/particles.md +205 -0
  30. package/docs/api/points.md +130 -0
  31. package/docs/api/post.md +494 -0
  32. package/docs/api/quality.md +200 -0
  33. package/docs/api/raycast.md +269 -0
  34. package/docs/api/reference/animation.md +158 -0
  35. package/docs/api/reference/assets.md +335 -0
  36. package/docs/api/reference/cameras.md +138 -0
  37. package/docs/api/reference/controls.md +463 -0
  38. package/docs/api/reference/debug.md +586 -0
  39. package/docs/api/reference/engine.md +647 -0
  40. package/docs/api/reference/feature-draws.md +94 -0
  41. package/docs/api/reference/feature-effects.md +32 -0
  42. package/docs/api/reference/feature-instances.md +63 -0
  43. package/docs/api/reference/features.md +361 -0
  44. package/docs/api/reference/geometry.md +856 -0
  45. package/docs/api/reference/grass.md +131 -0
  46. package/docs/api/reference/impostors.md +368 -0
  47. package/docs/api/reference/input.md +121 -0
  48. package/docs/api/reference/lights.md +257 -0
  49. package/docs/api/reference/lines.md +84 -0
  50. package/docs/api/reference/materials.md +375 -0
  51. package/docs/api/reference/math.md +229 -0
  52. package/docs/api/reference/objects.md +103 -0
  53. package/docs/api/reference/particles.md +336 -0
  54. package/docs/api/reference/points.md +57 -0
  55. package/docs/api/reference/post.md +244 -0
  56. package/docs/api/reference/quality.md +213 -0
  57. package/docs/api/reference/raycast.md +94 -0
  58. package/docs/api/reference/render.md +238 -0
  59. package/docs/api/reference/scene.md +543 -0
  60. package/docs/api/reference/sketch.md +125 -0
  61. package/docs/api/reference/sound.md +203 -0
  62. package/docs/api/reference/splats.md +214 -0
  63. package/docs/api/reference/sprites.md +71 -0
  64. package/docs/api/reference/tasks.md +92 -0
  65. package/docs/api/reference/terrain.md +161 -0
  66. package/docs/api/reference/textures.md +153 -0
  67. package/docs/api/reference/three-compat.md +60 -0
  68. package/docs/api/reference/time.md +25 -0
  69. package/docs/api/reference/ui.md +52 -0
  70. package/docs/api/reference/vertex-draws.md +55 -0
  71. package/docs/api/reference/water.md +430 -0
  72. package/docs/api/reference/wind.md +106 -0
  73. package/docs/api/render.md +499 -0
  74. package/docs/api/scene.md +606 -0
  75. package/docs/api/sketch.md +231 -0
  76. package/docs/api/sound.md +169 -0
  77. package/docs/api/splats.md +264 -0
  78. package/docs/api/sprites.md +169 -0
  79. package/docs/api/tasks.md +106 -0
  80. package/docs/api/terrain.md +118 -0
  81. package/docs/api/textures.md +272 -0
  82. package/docs/api/three-compat.md +102 -0
  83. package/docs/api/time.md +134 -0
  84. package/docs/api/ui.md +134 -0
  85. package/docs/api/vertex-draws.md +171 -0
  86. package/docs/api/water.md +486 -0
  87. package/docs/api/wind.md +375 -0
  88. package/docs/cli/null3d.md +603 -0
  89. package/docs/concepts/architecture.md +174 -0
  90. package/docs/concepts/assets.md +128 -0
  91. package/docs/concepts/backends.md +197 -0
  92. package/docs/concepts/color-management.md +134 -0
  93. package/docs/concepts/culling.md +227 -0
  94. package/docs/concepts/handles.md +93 -0
  95. package/docs/concepts/instances.md +285 -0
  96. package/docs/concepts/large-worlds.md +126 -0
  97. package/docs/concepts/lighting.md +587 -0
  98. package/docs/concepts/lod.md +241 -0
  99. package/docs/concepts/materials.md +128 -0
  100. package/docs/concepts/particle-buffer.md +201 -0
  101. package/docs/concepts/post-processing.md +420 -0
  102. package/docs/concepts/quality-preset-tables.md +94 -0
  103. package/docs/concepts/quality-presets.md +341 -0
  104. package/docs/concepts/render-graph.md +222 -0
  105. package/docs/concepts/render-layers.md +111 -0
  106. package/docs/concepts/shadows.md +448 -0
  107. package/docs/concepts/static-dynamic.md +113 -0
  108. package/docs/cookbook/index.md +664 -0
  109. package/docs/data/threejs-mapping.json +2152 -0
  110. package/docs/errors/E1101.md +23 -0
  111. package/docs/errors/E1102.md +23 -0
  112. package/docs/errors/E1103.md +23 -0
  113. package/docs/errors/E1104.md +23 -0
  114. package/docs/errors/E1105.md +23 -0
  115. package/docs/errors/E1106.md +23 -0
  116. package/docs/errors/E1107.md +23 -0
  117. package/docs/errors/E1108.md +23 -0
  118. package/docs/errors/E1109.md +23 -0
  119. package/docs/errors/E1110.md +23 -0
  120. package/docs/errors/E1111.md +23 -0
  121. package/docs/errors/E1112.md +23 -0
  122. package/docs/errors/E1203.md +23 -0
  123. package/docs/errors/E1204.md +23 -0
  124. package/docs/errors/E1205.md +23 -0
  125. package/docs/errors/E1206.md +23 -0
  126. package/docs/errors/E1207.md +23 -0
  127. package/docs/errors/E1208.md +23 -0
  128. package/docs/errors/E1209.md +23 -0
  129. package/docs/errors/E1213.md +23 -0
  130. package/docs/errors/E1214.md +23 -0
  131. package/docs/errors/E1215.md +23 -0
  132. package/docs/errors/E1216.md +23 -0
  133. package/docs/errors/E1217.md +23 -0
  134. package/docs/errors/E1218.md +23 -0
  135. package/docs/errors/E1219.md +23 -0
  136. package/docs/errors/E1220.md +23 -0
  137. package/docs/errors/E1221.md +23 -0
  138. package/docs/errors/E1222.md +23 -0
  139. package/docs/errors/E1223.md +23 -0
  140. package/docs/errors/E1224.md +23 -0
  141. package/docs/errors/E1225.md +23 -0
  142. package/docs/errors/E1301.md +23 -0
  143. package/docs/errors/E1302.md +23 -0
  144. package/docs/errors/E1303.md +23 -0
  145. package/docs/errors/E1304.md +23 -0
  146. package/docs/errors/E1305.md +23 -0
  147. package/docs/errors/E1306.md +23 -0
  148. package/docs/errors/E1307.md +23 -0
  149. package/docs/errors/E1401.md +23 -0
  150. package/docs/errors/E1402.md +23 -0
  151. package/docs/errors/E1403.md +23 -0
  152. package/docs/errors/E1404.md +23 -0
  153. package/docs/errors/E1405.md +23 -0
  154. package/docs/errors/E1406.md +23 -0
  155. package/docs/errors/E1407.md +23 -0
  156. package/docs/errors/E1408.md +23 -0
  157. package/docs/errors/E1409.md +23 -0
  158. package/docs/errors/E1410.md +23 -0
  159. package/docs/errors/E1411.md +23 -0
  160. package/docs/errors/E1412.md +23 -0
  161. package/docs/errors/E1413.md +23 -0
  162. package/docs/errors/E1414.md +23 -0
  163. package/docs/errors/E1415.md +23 -0
  164. package/docs/errors/E1416.md +23 -0
  165. package/docs/errors/E1417.md +23 -0
  166. package/docs/errors/E1418.md +23 -0
  167. package/docs/errors/E1419.md +23 -0
  168. package/docs/errors/E1420.md +23 -0
  169. package/docs/errors/E1421.md +23 -0
  170. package/docs/errors/E1422.md +23 -0
  171. package/docs/errors/E1423.md +23 -0
  172. package/docs/errors/E1424.md +23 -0
  173. package/docs/errors/E1425.md +23 -0
  174. package/docs/errors/E1426.md +23 -0
  175. package/docs/errors/E1430.md +23 -0
  176. package/docs/errors/E1431.md +23 -0
  177. package/docs/errors/E1432.md +23 -0
  178. package/docs/errors/E1433.md +23 -0
  179. package/docs/errors/E1434.md +23 -0
  180. package/docs/errors/E1435.md +23 -0
  181. package/docs/errors/E1436.md +23 -0
  182. package/docs/errors/E1437.md +23 -0
  183. package/docs/errors/E1501.md +23 -0
  184. package/docs/errors/E1502.md +23 -0
  185. package/docs/errors/E1503.md +23 -0
  186. package/docs/errors/E1504.md +23 -0
  187. package/docs/errors/E1505.md +23 -0
  188. package/docs/errors/E1506.md +23 -0
  189. package/docs/errors/index.md +93 -0
  190. package/docs/getting-started/cdn.md +235 -0
  191. package/docs/getting-started/first-scene.md +129 -0
  192. package/docs/getting-started/hosting.md +400 -0
  193. package/docs/getting-started/install.md +112 -0
  194. package/docs/getting-started/network-use.md +96 -0
  195. package/docs/getting-started/project-structure.md +78 -0
  196. package/docs/getting-started/third-party-notices.md +94 -0
  197. package/docs/guides/accessibility.md +96 -0
  198. package/docs/guides/add-ons.md +160 -0
  199. package/docs/guides/agents.md +77 -0
  200. package/docs/guides/assets-pipeline.md +505 -0
  201. package/docs/guides/audio.md +148 -0
  202. package/docs/guides/baked-light-data.md +176 -0
  203. package/docs/guides/car-paint.md +121 -0
  204. package/docs/guides/content-pages.md +238 -0
  205. package/docs/guides/custom-passes.md +586 -0
  206. package/docs/guides/custom-shaders.md +293 -0
  207. package/docs/guides/debugging.md +236 -0
  208. package/docs/guides/deploying.md +115 -0
  209. package/docs/guides/deterministic-simulation.md +226 -0
  210. package/docs/guides/first-use-shaders.md +57 -0
  211. package/docs/guides/lens-kit.md +134 -0
  212. package/docs/guides/loading-screens.md +263 -0
  213. package/docs/guides/multiple-views.md +122 -0
  214. package/docs/guides/performance.md +405 -0
  215. package/docs/guides/phones.md +138 -0
  216. package/docs/guides/physics.md +202 -0
  217. package/docs/guides/screens.md +125 -0
  218. package/docs/guides/start-time.md +328 -0
  219. package/docs/guides/testing.md +245 -0
  220. package/docs/guides/ui-overlays.md +182 -0
  221. package/docs/guides/video-textures.md +110 -0
  222. package/docs/index.md +49 -0
  223. package/docs/pages.md +242 -0
  224. package/docs/porting/react-three-fiber.md +238 -0
  225. package/docs/porting/threejs-loop-and-threads.md +229 -0
  226. package/docs/porting/threejs-mapping.md +297 -0
  227. package/docs/porting/threejs-materials.md +222 -0
  228. package/docs/porting/threejs-overview.md +228 -0
  229. package/docs/porting/threejs-postprocessing.md +256 -0
  230. package/docs/porting/threejs-shaders.md +308 -0
  231. package/docs/porting/threejs-unsupported.md +91 -0
  232. package/docs/porting/verification.md +191 -0
  233. package/docs/shaders/builtins.md +129 -0
  234. package/docs/shaders/library.md +1374 -0
  235. package/docs/shaders/surface-functions.md +626 -0
  236. package/docs/shaders/wgsl-rules.md +126 -0
  237. package/levels/pieces.d.ts +178 -0
  238. package/levels/pieces.js +759 -0
  239. package/levels/planner.d.ts +126 -0
  240. package/levels/planner.js +682 -0
  241. package/lib/debug/channel.d.ts +103 -0
  242. package/lib/debug/channel.js +269 -0
  243. package/lib/debug/debug.d.ts +180 -0
  244. package/lib/debug/debug.js +4 -0
  245. package/lib/debug/draw.d.ts +146 -0
  246. package/lib/debug/draw.js +719 -0
  247. package/lib/debug/frame-target.d.ts +11 -0
  248. package/lib/debug/frame-target.js +31 -0
  249. package/lib/debug/inspector.d.ts +60 -0
  250. package/lib/debug/inspector.js +475 -0
  251. package/lib/debug/overlay-look.d.ts +162 -0
  252. package/lib/debug/overlay-look.js +1365 -0
  253. package/lib/debug/overlay.d.ts +68 -0
  254. package/lib/debug/overlay.js +195 -0
  255. package/lib/debug/page-meters.d.ts +139 -0
  256. package/lib/debug/page-meters.js +267 -0
  257. package/lib/debug/sketch-debug.d.ts +41 -0
  258. package/lib/debug/sketch-debug.js +86 -0
  259. package/lib/debug/stats-options.d.ts +15 -0
  260. package/lib/debug/stats-options.js +3 -0
  261. package/lib/debug/stats-panel.d.ts +94 -0
  262. package/lib/debug/stats-panel.js +123 -0
  263. package/lib/debug/stats-text.d.ts +169 -0
  264. package/lib/debug/stats-text.js +126 -0
  265. package/lib/debug/stats.d.ts +195 -0
  266. package/lib/debug/stats.js +252 -0
  267. package/lib/debug/view-names.d.ts +15 -0
  268. package/lib/debug/view-names.js +22 -0
  269. package/lib/errors/checks.d.ts +24 -0
  270. package/lib/errors/checks.js +38 -0
  271. package/lib/errors/codes.d.ts +15 -0
  272. package/lib/errors/codes.js +489 -0
  273. package/lib/errors/core-failure.d.ts +19 -0
  274. package/lib/errors/core-failure.js +127 -0
  275. package/lib/errors/engine-error-core.d.ts +21 -0
  276. package/lib/errors/engine-error-core.js +39 -0
  277. package/lib/errors/engine-error.d.ts +38 -0
  278. package/lib/errors/engine-error.js +132 -0
  279. package/lib/errors/fixes.d.ts +89 -0
  280. package/lib/errors/fixes.js +86 -0
  281. package/lib/errors/message.d.ts +4 -0
  282. package/lib/errors/message.js +10 -0
  283. package/lib/generated/core.d.ts +657 -0
  284. package/lib/generated/core.js +659 -0
  285. package/lib/generated/gpu.d.ts +412 -0
  286. package/lib/generated/gpu.js +414 -0
  287. package/lib/generated/shader-features.d.ts +8 -0
  288. package/lib/generated/shader-permutations.d.ts +6 -0
  289. package/lib/generated/shader-permutations.js +9 -0
  290. package/lib/generated/shaders-environment-glsl.d.ts +11 -0
  291. package/lib/generated/shaders-environment-wgsl.d.ts +11 -0
  292. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-coverage-half.d.ts +3 -0
  293. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-coverage.d.ts +3 -0
  294. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-displacement-half.d.ts +3 -0
  295. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-displacement.d.ts +3 -0
  296. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-hash-half.d.ts +3 -0
  297. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-hash.d.ts +3 -0
  298. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
  299. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-lod-fade.d.ts +3 -0
  300. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-morph-half.d.ts +3 -0
  301. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-morph.d.ts +3 -0
  302. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-row-values-half.d.ts +3 -0
  303. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-row-values.d.ts +3 -0
  304. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-skinning-half.d.ts +3 -0
  305. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-skinning.d.ts +3 -0
  306. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-transmission-half.d.ts +3 -0
  307. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-transmission.d.ts +3 -0
  308. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-weighted-half.d.ts +3 -0
  309. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-and-weighted.d.ts +3 -0
  310. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen-half.d.ts +3 -0
  311. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coat-sheen.d.ts +3 -0
  312. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-displacement-half.d.ts +3 -0
  313. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-displacement.d.ts +3 -0
  314. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-lod-fade-half.d.ts +3 -0
  315. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-lod-fade.d.ts +3 -0
  316. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-morph-half.d.ts +3 -0
  317. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-morph.d.ts +3 -0
  318. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-row-values-half.d.ts +3 -0
  319. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-row-values.d.ts +3 -0
  320. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-skinning-half.d.ts +3 -0
  321. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-skinning.d.ts +3 -0
  322. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-translucency-half.d.ts +3 -0
  323. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-translucency.d.ts +3 -0
  324. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-transmission-half.d.ts +3 -0
  325. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-and-transmission.d.ts +3 -0
  326. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage-half.d.ts +3 -0
  327. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-coverage.d.ts +3 -0
  328. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-hash-half.d.ts +3 -0
  329. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-hash.d.ts +3 -0
  330. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-morph-half.d.ts +3 -0
  331. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-morph.d.ts +3 -0
  332. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-row-values-half.d.ts +3 -0
  333. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-row-values.d.ts +3 -0
  334. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-skinning-half.d.ts +3 -0
  335. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-skinning.d.ts +3 -0
  336. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-translucency-half.d.ts +3 -0
  337. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-translucency.d.ts +3 -0
  338. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-transmission-half.d.ts +3 -0
  339. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-transmission.d.ts +3 -0
  340. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-weighted-half.d.ts +3 -0
  341. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-and-weighted.d.ts +3 -0
  342. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement-half.d.ts +3 -0
  343. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-displacement.d.ts +3 -0
  344. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-morph-half.d.ts +3 -0
  345. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-morph.d.ts +3 -0
  346. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-row-values-half.d.ts +3 -0
  347. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-row-values.d.ts +3 -0
  348. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-skinning-half.d.ts +3 -0
  349. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-skinning.d.ts +3 -0
  350. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-translucency-half.d.ts +3 -0
  351. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-and-translucency.d.ts +3 -0
  352. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash-half.d.ts +3 -0
  353. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-hash.d.ts +3 -0
  354. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-row-values-half.d.ts +3 -0
  355. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-row-values.d.ts +3 -0
  356. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-translucency-half.d.ts +3 -0
  357. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-and-translucency.d.ts +3 -0
  358. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade-half.d.ts +3 -0
  359. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-lod-fade.d.ts +3 -0
  360. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-skinning-half.d.ts +3 -0
  361. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-skinning.d.ts +3 -0
  362. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-translucency-half.d.ts +3 -0
  363. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-translucency.d.ts +3 -0
  364. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-transmission-half.d.ts +3 -0
  365. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-transmission.d.ts +3 -0
  366. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-weighted-half.d.ts +3 -0
  367. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-and-weighted.d.ts +3 -0
  368. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph-half.d.ts +3 -0
  369. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-morph.d.ts +3 -0
  370. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-translucency-half.d.ts +3 -0
  371. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-translucency.d.ts +3 -0
  372. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-weighted-half.d.ts +3 -0
  373. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-and-weighted.d.ts +3 -0
  374. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values-half.d.ts +3 -0
  375. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-row-values.d.ts +3 -0
  376. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-translucency-half.d.ts +3 -0
  377. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-translucency.d.ts +3 -0
  378. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-transmission-half.d.ts +3 -0
  379. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-transmission.d.ts +3 -0
  380. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-weighted-half.d.ts +3 -0
  381. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-and-weighted.d.ts +3 -0
  382. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning-half.d.ts +3 -0
  383. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-skinning.d.ts +3 -0
  384. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-translucency-half.d.ts +3 -0
  385. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-translucency.d.ts +3 -0
  386. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-transmission-half.d.ts +3 -0
  387. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-transmission.d.ts +3 -0
  388. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-weighted-half.d.ts +3 -0
  389. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-and-weighted.d.ts +3 -0
  390. package/lib/generated/shaders-glsl-combos-area-lights-and-bump-half.d.ts +3 -0
  391. package/lib/generated/shaders-glsl-combos-area-lights-and-bump.d.ts +3 -0
  392. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-displacement-half.d.ts +3 -0
  393. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-displacement.d.ts +3 -0
  394. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-lod-fade-half.d.ts +3 -0
  395. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-lod-fade.d.ts +3 -0
  396. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-morph-half.d.ts +3 -0
  397. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-morph.d.ts +3 -0
  398. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-row-values-half.d.ts +3 -0
  399. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-row-values.d.ts +3 -0
  400. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-skinning-half.d.ts +3 -0
  401. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-skinning.d.ts +3 -0
  402. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-transmission-half.d.ts +3 -0
  403. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-and-transmission.d.ts +3 -0
  404. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage-half.d.ts +3 -0
  405. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-coverage.d.ts +3 -0
  406. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-hash-half.d.ts +3 -0
  407. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-hash.d.ts +3 -0
  408. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-morph-half.d.ts +3 -0
  409. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-morph.d.ts +3 -0
  410. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-row-values-half.d.ts +3 -0
  411. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-row-values.d.ts +3 -0
  412. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-skinning-half.d.ts +3 -0
  413. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-skinning.d.ts +3 -0
  414. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-transmission-half.d.ts +3 -0
  415. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-transmission.d.ts +3 -0
  416. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-weighted-half.d.ts +3 -0
  417. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-and-weighted.d.ts +3 -0
  418. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement-half.d.ts +3 -0
  419. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-displacement.d.ts +3 -0
  420. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-morph-half.d.ts +3 -0
  421. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-morph.d.ts +3 -0
  422. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-row-values-half.d.ts +3 -0
  423. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-row-values.d.ts +3 -0
  424. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-skinning-half.d.ts +3 -0
  425. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-and-skinning.d.ts +3 -0
  426. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash-half.d.ts +3 -0
  427. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-hash.d.ts +3 -0
  428. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-and-row-values-half.d.ts +3 -0
  429. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-and-row-values.d.ts +3 -0
  430. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
  431. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-lod-fade.d.ts +3 -0
  432. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-skinning-half.d.ts +3 -0
  433. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-skinning.d.ts +3 -0
  434. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-transmission-half.d.ts +3 -0
  435. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-transmission.d.ts +3 -0
  436. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-weighted-half.d.ts +3 -0
  437. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-and-weighted.d.ts +3 -0
  438. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph-half.d.ts +3 -0
  439. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-morph.d.ts +3 -0
  440. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-and-weighted-half.d.ts +3 -0
  441. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-and-weighted.d.ts +3 -0
  442. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values-half.d.ts +3 -0
  443. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-row-values.d.ts +3 -0
  444. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-transmission-half.d.ts +3 -0
  445. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-transmission.d.ts +3 -0
  446. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-weighted-half.d.ts +3 -0
  447. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-and-weighted.d.ts +3 -0
  448. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning-half.d.ts +3 -0
  449. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-skinning.d.ts +3 -0
  450. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-transmission-half.d.ts +3 -0
  451. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-transmission.d.ts +3 -0
  452. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-weighted-half.d.ts +3 -0
  453. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-and-weighted.d.ts +3 -0
  454. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen-half.d.ts +3 -0
  455. package/lib/generated/shaders-glsl-combos-area-lights-and-coat-sheen.d.ts +3 -0
  456. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-morph-half.d.ts +3 -0
  457. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-morph.d.ts +3 -0
  458. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-row-values-half.d.ts +3 -0
  459. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-row-values.d.ts +3 -0
  460. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-skinning-half.d.ts +3 -0
  461. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-skinning.d.ts +3 -0
  462. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-translucency-half.d.ts +3 -0
  463. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-translucency.d.ts +3 -0
  464. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-transmission-half.d.ts +3 -0
  465. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-and-transmission.d.ts +3 -0
  466. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement-half.d.ts +3 -0
  467. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-displacement.d.ts +3 -0
  468. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-row-values-half.d.ts +3 -0
  469. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-row-values.d.ts +3 -0
  470. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-translucency-half.d.ts +3 -0
  471. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-and-translucency.d.ts +3 -0
  472. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade-half.d.ts +3 -0
  473. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-lod-fade.d.ts +3 -0
  474. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-skinning-half.d.ts +3 -0
  475. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-skinning.d.ts +3 -0
  476. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-translucency-half.d.ts +3 -0
  477. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-translucency.d.ts +3 -0
  478. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-transmission-half.d.ts +3 -0
  479. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-and-transmission.d.ts +3 -0
  480. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph-half.d.ts +3 -0
  481. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-morph.d.ts +3 -0
  482. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-and-translucency-half.d.ts +3 -0
  483. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-and-translucency.d.ts +3 -0
  484. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values-half.d.ts +3 -0
  485. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-row-values.d.ts +3 -0
  486. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-translucency-half.d.ts +3 -0
  487. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-translucency.d.ts +3 -0
  488. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-transmission-half.d.ts +3 -0
  489. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-and-transmission.d.ts +3 -0
  490. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning-half.d.ts +3 -0
  491. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-skinning.d.ts +3 -0
  492. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-translucency-half.d.ts +3 -0
  493. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-translucency.d.ts +3 -0
  494. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-transmission-half.d.ts +3 -0
  495. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-and-transmission.d.ts +3 -0
  496. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage-half.d.ts +3 -0
  497. package/lib/generated/shaders-glsl-combos-area-lights-and-coverage.d.ts +3 -0
  498. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-morph-half.d.ts +3 -0
  499. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-morph.d.ts +3 -0
  500. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-row-values-half.d.ts +3 -0
  501. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-row-values.d.ts +3 -0
  502. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-skinning-half.d.ts +3 -0
  503. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-skinning.d.ts +3 -0
  504. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-translucency-half.d.ts +3 -0
  505. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-and-translucency.d.ts +3 -0
  506. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash-half.d.ts +3 -0
  507. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-hash.d.ts +3 -0
  508. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-morph-half.d.ts +3 -0
  509. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-morph.d.ts +3 -0
  510. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-row-values-half.d.ts +3 -0
  511. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-row-values.d.ts +3 -0
  512. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-skinning-half.d.ts +3 -0
  513. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-skinning.d.ts +3 -0
  514. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-translucency-half.d.ts +3 -0
  515. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-and-translucency.d.ts +3 -0
  516. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment-half.d.ts +3 -0
  517. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-moment.d.ts +3 -0
  518. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-skinning-half.d.ts +3 -0
  519. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-skinning.d.ts +3 -0
  520. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-translucency-half.d.ts +3 -0
  521. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-translucency.d.ts +3 -0
  522. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-transmission-half.d.ts +3 -0
  523. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-transmission.d.ts +3 -0
  524. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-weighted-half.d.ts +3 -0
  525. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-and-weighted.d.ts +3 -0
  526. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph-half.d.ts +3 -0
  527. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-morph.d.ts +3 -0
  528. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-translucency-half.d.ts +3 -0
  529. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-translucency.d.ts +3 -0
  530. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-weighted-half.d.ts +3 -0
  531. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-and-weighted.d.ts +3 -0
  532. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values-half.d.ts +3 -0
  533. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-row-values.d.ts +3 -0
  534. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-translucency-half.d.ts +3 -0
  535. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-translucency.d.ts +3 -0
  536. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-transmission-half.d.ts +3 -0
  537. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-transmission.d.ts +3 -0
  538. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-weighted-half.d.ts +3 -0
  539. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-and-weighted.d.ts +3 -0
  540. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning-half.d.ts +3 -0
  541. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-skinning.d.ts +3 -0
  542. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-translucency-half.d.ts +3 -0
  543. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-translucency.d.ts +3 -0
  544. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-transmission-half.d.ts +3 -0
  545. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-transmission.d.ts +3 -0
  546. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-weighted-half.d.ts +3 -0
  547. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-and-weighted.d.ts +3 -0
  548. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement-half.d.ts +3 -0
  549. package/lib/generated/shaders-glsl-combos-area-lights-and-displacement.d.ts +3 -0
  550. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-skinning-half.d.ts +3 -0
  551. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-skinning.d.ts +3 -0
  552. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-translucency-half.d.ts +3 -0
  553. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-and-translucency.d.ts +3 -0
  554. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph-half.d.ts +3 -0
  555. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-morph.d.ts +3 -0
  556. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-and-translucency-half.d.ts +3 -0
  557. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-and-translucency.d.ts +3 -0
  558. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values-half.d.ts +3 -0
  559. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-row-values.d.ts +3 -0
  560. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-and-translucency-half.d.ts +3 -0
  561. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-and-translucency.d.ts +3 -0
  562. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning-half.d.ts +3 -0
  563. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-skinning.d.ts +3 -0
  564. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-translucency-half.d.ts +3 -0
  565. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-and-translucency.d.ts +3 -0
  566. package/lib/generated/shaders-glsl-combos-area-lights-and-hash-half.d.ts +3 -0
  567. package/lib/generated/shaders-glsl-combos-area-lights-and-hash.d.ts +3 -0
  568. package/lib/generated/shaders-glsl-combos-area-lights-and-lines.d.ts +3 -0
  569. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-and-translucency-half.d.ts +3 -0
  570. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-and-translucency.d.ts +3 -0
  571. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values-half.d.ts +3 -0
  572. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-row-values.d.ts +3 -0
  573. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-translucency-half.d.ts +3 -0
  574. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-and-translucency.d.ts +3 -0
  575. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade-half.d.ts +3 -0
  576. package/lib/generated/shaders-glsl-combos-area-lights-and-lod-fade.d.ts +3 -0
  577. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-skinning-half.d.ts +3 -0
  578. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-skinning.d.ts +3 -0
  579. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-translucency-half.d.ts +3 -0
  580. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-and-translucency.d.ts +3 -0
  581. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph-half.d.ts +3 -0
  582. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-morph.d.ts +3 -0
  583. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-and-translucency-half.d.ts +3 -0
  584. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-and-translucency.d.ts +3 -0
  585. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values-half.d.ts +3 -0
  586. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-row-values.d.ts +3 -0
  587. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-and-translucency-half.d.ts +3 -0
  588. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-and-translucency.d.ts +3 -0
  589. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning-half.d.ts +3 -0
  590. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-skinning.d.ts +3 -0
  591. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-translucency-half.d.ts +3 -0
  592. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-and-translucency.d.ts +3 -0
  593. package/lib/generated/shaders-glsl-combos-area-lights-and-moment-half.d.ts +3 -0
  594. package/lib/generated/shaders-glsl-combos-area-lights-and-moment.d.ts +3 -0
  595. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-translucency-half.d.ts +3 -0
  596. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-translucency.d.ts +3 -0
  597. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-transmission-half.d.ts +3 -0
  598. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-transmission.d.ts +3 -0
  599. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-weighted-half.d.ts +3 -0
  600. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-and-weighted.d.ts +3 -0
  601. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning-half.d.ts +3 -0
  602. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-skinning.d.ts +3 -0
  603. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-translucency-half.d.ts +3 -0
  604. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-translucency.d.ts +3 -0
  605. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-transmission-half.d.ts +3 -0
  606. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-transmission.d.ts +3 -0
  607. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-weighted-half.d.ts +3 -0
  608. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-and-weighted.d.ts +3 -0
  609. package/lib/generated/shaders-glsl-combos-area-lights-and-morph-half.d.ts +3 -0
  610. package/lib/generated/shaders-glsl-combos-area-lights-and-morph.d.ts +3 -0
  611. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-translucency-half.d.ts +3 -0
  612. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-translucency.d.ts +3 -0
  613. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-weighted-half.d.ts +3 -0
  614. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-and-weighted.d.ts +3 -0
  615. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values-half.d.ts +3 -0
  616. package/lib/generated/shaders-glsl-combos-area-lights-and-row-values.d.ts +3 -0
  617. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-translucency-half.d.ts +3 -0
  618. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-translucency.d.ts +3 -0
  619. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-transmission-half.d.ts +3 -0
  620. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-transmission.d.ts +3 -0
  621. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-weighted-half.d.ts +3 -0
  622. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-and-weighted.d.ts +3 -0
  623. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning-half.d.ts +3 -0
  624. package/lib/generated/shaders-glsl-combos-area-lights-and-skinning.d.ts +3 -0
  625. package/lib/generated/shaders-glsl-combos-area-lights-and-translucency-half.d.ts +3 -0
  626. package/lib/generated/shaders-glsl-combos-area-lights-and-translucency.d.ts +3 -0
  627. package/lib/generated/shaders-glsl-combos-area-lights-and-transmission-half.d.ts +3 -0
  628. package/lib/generated/shaders-glsl-combos-area-lights-and-transmission.d.ts +3 -0
  629. package/lib/generated/shaders-glsl-combos-area-lights-and-weighted-half.d.ts +3 -0
  630. package/lib/generated/shaders-glsl-combos-area-lights-and-weighted.d.ts +3 -0
  631. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-coverage-half.d.ts +3 -0
  632. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-coverage.d.ts +3 -0
  633. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-displacement-half.d.ts +3 -0
  634. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-displacement.d.ts +3 -0
  635. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-hash-half.d.ts +3 -0
  636. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-hash.d.ts +3 -0
  637. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-lod-fade-half.d.ts +3 -0
  638. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-lod-fade.d.ts +3 -0
  639. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-morph-half.d.ts +3 -0
  640. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-morph.d.ts +3 -0
  641. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-row-values-half.d.ts +3 -0
  642. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-row-values.d.ts +3 -0
  643. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-skinning-half.d.ts +3 -0
  644. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-skinning.d.ts +3 -0
  645. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-transmission-half.d.ts +3 -0
  646. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-transmission.d.ts +3 -0
  647. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-weighted-half.d.ts +3 -0
  648. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-and-weighted.d.ts +3 -0
  649. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen-half.d.ts +3 -0
  650. package/lib/generated/shaders-glsl-combos-bump-and-coat-sheen.d.ts +3 -0
  651. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-displacement-half.d.ts +3 -0
  652. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-displacement.d.ts +3 -0
  653. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-lod-fade-half.d.ts +3 -0
  654. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-lod-fade.d.ts +3 -0
  655. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-morph-half.d.ts +3 -0
  656. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-morph.d.ts +3 -0
  657. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-row-values-half.d.ts +3 -0
  658. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-row-values.d.ts +3 -0
  659. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-skinning-half.d.ts +3 -0
  660. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-skinning.d.ts +3 -0
  661. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-translucency-half.d.ts +3 -0
  662. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-translucency.d.ts +3 -0
  663. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-transmission-half.d.ts +3 -0
  664. package/lib/generated/shaders-glsl-combos-bump-and-coverage-and-transmission.d.ts +3 -0
  665. package/lib/generated/shaders-glsl-combos-bump-and-coverage-half.d.ts +3 -0
  666. package/lib/generated/shaders-glsl-combos-bump-and-coverage.d.ts +3 -0
  667. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-hash-half.d.ts +3 -0
  668. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-hash.d.ts +3 -0
  669. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-morph-half.d.ts +3 -0
  670. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-morph.d.ts +3 -0
  671. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-row-values-half.d.ts +3 -0
  672. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-row-values.d.ts +3 -0
  673. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-skinning-half.d.ts +3 -0
  674. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-skinning.d.ts +3 -0
  675. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-translucency-half.d.ts +3 -0
  676. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-translucency.d.ts +3 -0
  677. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-transmission-half.d.ts +3 -0
  678. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-transmission.d.ts +3 -0
  679. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-weighted-half.d.ts +3 -0
  680. package/lib/generated/shaders-glsl-combos-bump-and-displacement-and-weighted.d.ts +3 -0
  681. package/lib/generated/shaders-glsl-combos-bump-and-displacement-half.d.ts +3 -0
  682. package/lib/generated/shaders-glsl-combos-bump-and-displacement.d.ts +3 -0
  683. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-morph-half.d.ts +3 -0
  684. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-morph.d.ts +3 -0
  685. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-row-values-half.d.ts +3 -0
  686. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-row-values.d.ts +3 -0
  687. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-skinning-half.d.ts +3 -0
  688. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-skinning.d.ts +3 -0
  689. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-translucency-half.d.ts +3 -0
  690. package/lib/generated/shaders-glsl-combos-bump-and-hash-and-translucency.d.ts +3 -0
  691. package/lib/generated/shaders-glsl-combos-bump-and-hash-half.d.ts +3 -0
  692. package/lib/generated/shaders-glsl-combos-bump-and-hash.d.ts +3 -0
  693. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-row-values-half.d.ts +3 -0
  694. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-row-values.d.ts +3 -0
  695. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-translucency-half.d.ts +3 -0
  696. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-and-translucency.d.ts +3 -0
  697. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade-half.d.ts +3 -0
  698. package/lib/generated/shaders-glsl-combos-bump-and-lod-fade.d.ts +3 -0
  699. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-skinning-half.d.ts +3 -0
  700. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-skinning.d.ts +3 -0
  701. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-translucency-half.d.ts +3 -0
  702. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-translucency.d.ts +3 -0
  703. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-transmission-half.d.ts +3 -0
  704. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-transmission.d.ts +3 -0
  705. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-weighted-half.d.ts +3 -0
  706. package/lib/generated/shaders-glsl-combos-bump-and-morph-and-weighted.d.ts +3 -0
  707. package/lib/generated/shaders-glsl-combos-bump-and-morph-half.d.ts +3 -0
  708. package/lib/generated/shaders-glsl-combos-bump-and-morph.d.ts +3 -0
  709. package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-translucency-half.d.ts +3 -0
  710. package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-translucency.d.ts +3 -0
  711. package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-weighted-half.d.ts +3 -0
  712. package/lib/generated/shaders-glsl-combos-bump-and-row-values-and-weighted.d.ts +3 -0
  713. package/lib/generated/shaders-glsl-combos-bump-and-row-values-half.d.ts +3 -0
  714. package/lib/generated/shaders-glsl-combos-bump-and-row-values.d.ts +3 -0
  715. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-translucency-half.d.ts +3 -0
  716. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-translucency.d.ts +3 -0
  717. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-transmission-half.d.ts +3 -0
  718. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-transmission.d.ts +3 -0
  719. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-weighted-half.d.ts +3 -0
  720. package/lib/generated/shaders-glsl-combos-bump-and-skinning-and-weighted.d.ts +3 -0
  721. package/lib/generated/shaders-glsl-combos-bump-and-skinning-half.d.ts +3 -0
  722. package/lib/generated/shaders-glsl-combos-bump-and-skinning.d.ts +3 -0
  723. package/lib/generated/shaders-glsl-combos-bump-and-translucency-half.d.ts +3 -0
  724. package/lib/generated/shaders-glsl-combos-bump-and-translucency.d.ts +3 -0
  725. package/lib/generated/shaders-glsl-combos-bump-and-transmission-half.d.ts +3 -0
  726. package/lib/generated/shaders-glsl-combos-bump-and-transmission.d.ts +3 -0
  727. package/lib/generated/shaders-glsl-combos-bump-and-weighted-half.d.ts +3 -0
  728. package/lib/generated/shaders-glsl-combos-bump-and-weighted.d.ts +3 -0
  729. package/lib/generated/shaders-glsl-combos-coat-sheen-and-coverage-half.d.ts +3 -0
  730. package/lib/generated/shaders-glsl-combos-coat-sheen-and-coverage.d.ts +3 -0
  731. package/lib/generated/shaders-glsl-combos-coat-sheen-and-displacement-half.d.ts +3 -0
  732. package/lib/generated/shaders-glsl-combos-coat-sheen-and-displacement.d.ts +3 -0
  733. package/lib/generated/shaders-glsl-combos-coat-sheen-and-hash-half.d.ts +3 -0
  734. package/lib/generated/shaders-glsl-combos-coat-sheen-and-hash.d.ts +3 -0
  735. package/lib/generated/shaders-glsl-combos-coat-sheen-and-lod-fade-half.d.ts +3 -0
  736. package/lib/generated/shaders-glsl-combos-coat-sheen-and-lod-fade.d.ts +3 -0
  737. package/lib/generated/shaders-glsl-combos-coat-sheen-and-morph-half.d.ts +3 -0
  738. package/lib/generated/shaders-glsl-combos-coat-sheen-and-morph.d.ts +3 -0
  739. package/lib/generated/shaders-glsl-combos-coat-sheen-and-row-values-half.d.ts +3 -0
  740. package/lib/generated/shaders-glsl-combos-coat-sheen-and-row-values.d.ts +3 -0
  741. package/lib/generated/shaders-glsl-combos-coat-sheen-and-skinning-half.d.ts +3 -0
  742. package/lib/generated/shaders-glsl-combos-coat-sheen-and-skinning.d.ts +3 -0
  743. package/lib/generated/shaders-glsl-combos-coat-sheen-and-transmission-half.d.ts +3 -0
  744. package/lib/generated/shaders-glsl-combos-coat-sheen-and-transmission.d.ts +3 -0
  745. package/lib/generated/shaders-glsl-combos-coat-sheen-and-weighted-half.d.ts +3 -0
  746. package/lib/generated/shaders-glsl-combos-coat-sheen-and-weighted.d.ts +3 -0
  747. package/lib/generated/shaders-glsl-combos-coverage-half.d.ts +3 -0
  748. package/lib/generated/shaders-glsl-combos-coverage.d.ts +3 -0
  749. package/lib/generated/shaders-glsl-combos-cutout.d.ts +3 -0
  750. package/lib/generated/shaders-glsl-combos-decals-half.d.ts +3 -0
  751. package/lib/generated/shaders-glsl-combos-decals.d.ts +3 -0
  752. package/lib/generated/shaders-glsl-combos-displacement-half.d.ts +3 -0
  753. package/lib/generated/shaders-glsl-combos-displacement.d.ts +3 -0
  754. package/lib/generated/shaders-glsl-combos-hash-half.d.ts +3 -0
  755. package/lib/generated/shaders-glsl-combos-hash.d.ts +3 -0
  756. package/lib/generated/shaders-glsl-combos-lod-fade-half.d.ts +3 -0
  757. package/lib/generated/shaders-glsl-combos-lod-fade.d.ts +3 -0
  758. package/lib/generated/shaders-glsl-combos-moment-half.d.ts +3 -0
  759. package/lib/generated/shaders-glsl-combos-moment.d.ts +3 -0
  760. package/lib/generated/shaders-glsl-combos-morph-half.d.ts +3 -0
  761. package/lib/generated/shaders-glsl-combos-morph.d.ts +3 -0
  762. package/lib/generated/shaders-glsl-combos-motion.d.ts +3 -0
  763. package/lib/generated/shaders-glsl-combos-picking.d.ts +3 -0
  764. package/lib/generated/shaders-glsl-combos-probe-grid-half.d.ts +3 -0
  765. package/lib/generated/shaders-glsl-combos-probe-grid.d.ts +3 -0
  766. package/lib/generated/shaders-glsl-combos-row-values-half.d.ts +3 -0
  767. package/lib/generated/shaders-glsl-combos-row-values.d.ts +3 -0
  768. package/lib/generated/shaders-glsl-combos-skinning-half.d.ts +3 -0
  769. package/lib/generated/shaders-glsl-combos-skinning.d.ts +3 -0
  770. package/lib/generated/shaders-glsl-combos-sprites.d.ts +3 -0
  771. package/lib/generated/shaders-glsl-combos-subsurface-half.d.ts +3 -0
  772. package/lib/generated/shaders-glsl-combos-subsurface.d.ts +3 -0
  773. package/lib/generated/shaders-probe-glsl.d.ts +11 -0
  774. package/lib/generated/shaders-probe-wgsl.d.ts +11 -0
  775. package/lib/generated/shaders-sky-volume-env-glsl.d.ts +11 -0
  776. package/lib/generated/shaders-sky-volume-env-wgsl.d.ts +11 -0
  777. package/lib/generated/shaders-sky-volume-panorama-glsl.d.ts +11 -0
  778. package/lib/generated/shaders-sky-volume-panorama-wgsl.d.ts +11 -0
  779. package/lib/generated/shaders-wgsl-combos-area-lights-and-bump-half.d.ts +3 -0
  780. package/lib/generated/shaders-wgsl-combos-area-lights-and-bump.d.ts +3 -0
  781. package/lib/generated/shaders-wgsl-combos-area-lights-and-coat-sheen-half.d.ts +3 -0
  782. package/lib/generated/shaders-wgsl-combos-area-lights-and-coat-sheen.d.ts +3 -0
  783. package/lib/generated/shaders-wgsl-combos-area-lights-and-coverage-half.d.ts +3 -0
  784. package/lib/generated/shaders-wgsl-combos-area-lights-and-coverage.d.ts +3 -0
  785. package/lib/generated/shaders-wgsl-combos-area-lights-and-displacement-half.d.ts +3 -0
  786. package/lib/generated/shaders-wgsl-combos-area-lights-and-displacement.d.ts +3 -0
  787. package/lib/generated/shaders-wgsl-combos-area-lights-and-hash-half.d.ts +3 -0
  788. package/lib/generated/shaders-wgsl-combos-area-lights-and-hash.d.ts +3 -0
  789. package/lib/generated/shaders-wgsl-combos-area-lights-and-instance-index-half.d.ts +3 -0
  790. package/lib/generated/shaders-wgsl-combos-area-lights-and-instance-index.d.ts +3 -0
  791. package/lib/generated/shaders-wgsl-combos-area-lights-and-lines.d.ts +3 -0
  792. package/lib/generated/shaders-wgsl-combos-area-lights-and-lod-fade-half.d.ts +3 -0
  793. package/lib/generated/shaders-wgsl-combos-area-lights-and-lod-fade.d.ts +3 -0
  794. package/lib/generated/shaders-wgsl-combos-area-lights-and-moment-half.d.ts +3 -0
  795. package/lib/generated/shaders-wgsl-combos-area-lights-and-moment.d.ts +3 -0
  796. package/lib/generated/shaders-wgsl-combos-area-lights-and-row-values-half.d.ts +3 -0
  797. package/lib/generated/shaders-wgsl-combos-area-lights-and-row-values.d.ts +3 -0
  798. package/lib/generated/shaders-wgsl-combos-area-lights-and-skinning-half.d.ts +3 -0
  799. package/lib/generated/shaders-wgsl-combos-area-lights-and-skinning.d.ts +3 -0
  800. package/lib/generated/shaders-wgsl-combos-area-lights-and-translucency-half.d.ts +3 -0
  801. package/lib/generated/shaders-wgsl-combos-area-lights-and-translucency.d.ts +3 -0
  802. package/lib/generated/shaders-wgsl-combos-area-lights-and-transmission-half.d.ts +3 -0
  803. package/lib/generated/shaders-wgsl-combos-area-lights-and-transmission.d.ts +3 -0
  804. package/lib/generated/shaders-wgsl-combos-area-lights-and-weighted-half.d.ts +3 -0
  805. package/lib/generated/shaders-wgsl-combos-area-lights-and-weighted.d.ts +3 -0
  806. package/lib/generated/shaders-wgsl-combos-bump-half.d.ts +3 -0
  807. package/lib/generated/shaders-wgsl-combos-bump.d.ts +3 -0
  808. package/lib/generated/shaders-wgsl-combos-coat-sheen-half.d.ts +3 -0
  809. package/lib/generated/shaders-wgsl-combos-coat-sheen.d.ts +3 -0
  810. package/lib/generated/shaders-wgsl-combos-coverage-half.d.ts +3 -0
  811. package/lib/generated/shaders-wgsl-combos-coverage.d.ts +3 -0
  812. package/lib/generated/shaders-wgsl-combos-cutout.d.ts +3 -0
  813. package/lib/generated/shaders-wgsl-combos-decals-half.d.ts +3 -0
  814. package/lib/generated/shaders-wgsl-combos-decals.d.ts +3 -0
  815. package/lib/generated/shaders-wgsl-combos-displacement-half.d.ts +3 -0
  816. package/lib/generated/shaders-wgsl-combos-displacement.d.ts +3 -0
  817. package/lib/generated/shaders-wgsl-combos-hash-half.d.ts +3 -0
  818. package/lib/generated/shaders-wgsl-combos-hash.d.ts +3 -0
  819. package/lib/generated/shaders-wgsl-combos-instance-index-half.d.ts +3 -0
  820. package/lib/generated/shaders-wgsl-combos-instance-index.d.ts +3 -0
  821. package/lib/generated/shaders-wgsl-combos-lod-fade-half.d.ts +3 -0
  822. package/lib/generated/shaders-wgsl-combos-lod-fade.d.ts +3 -0
  823. package/lib/generated/shaders-wgsl-combos-moment-half.d.ts +3 -0
  824. package/lib/generated/shaders-wgsl-combos-moment.d.ts +3 -0
  825. package/lib/generated/shaders-wgsl-combos-motion.d.ts +3 -0
  826. package/lib/generated/shaders-wgsl-combos-picking.d.ts +3 -0
  827. package/lib/generated/shaders-wgsl-combos-probe-grid-half.d.ts +3 -0
  828. package/lib/generated/shaders-wgsl-combos-probe-grid.d.ts +3 -0
  829. package/lib/generated/shaders-wgsl-combos-row-values-half.d.ts +3 -0
  830. package/lib/generated/shaders-wgsl-combos-row-values.d.ts +3 -0
  831. package/lib/generated/shaders-wgsl-combos-skinning-half.d.ts +3 -0
  832. package/lib/generated/shaders-wgsl-combos-skinning.d.ts +3 -0
  833. package/lib/generated/shaders-wgsl-combos-sprites.d.ts +3 -0
  834. package/lib/generated/shaders-wgsl-combos-subsurface-half.d.ts +3 -0
  835. package/lib/generated/shaders-wgsl-combos-subsurface.d.ts +3 -0
  836. package/lib/generated/shaders.d.ts +1146 -0
  837. package/lib/gpu/canvas-release.d.ts +20 -0
  838. package/lib/gpu/canvas-release.js +67 -0
  839. package/lib/gpu/completion.d.ts +35 -0
  840. package/lib/gpu/completion.js +256 -0
  841. package/lib/gpu/device-shaders.d.ts +69 -0
  842. package/lib/gpu/device-shaders.js +177 -0
  843. package/lib/gpu/early-builds.d.ts +68 -0
  844. package/lib/gpu/early-builds.js +158 -0
  845. package/lib/gpu/effect-join.d.ts +83 -0
  846. package/lib/gpu/effect-join.js +134 -0
  847. package/lib/gpu/effect-joiner.d.ts +14 -0
  848. package/lib/gpu/effect-joiner.js +165 -0
  849. package/lib/gpu/environment-steps.d.ts +135 -0
  850. package/lib/gpu/environment-steps.js +210 -0
  851. package/lib/gpu/environment-words.d.ts +14 -0
  852. package/lib/gpu/environment-words.js +19 -0
  853. package/lib/gpu/environment.d.ts +4 -0
  854. package/lib/gpu/environment.js +8 -0
  855. package/lib/gpu/float-bits.d.ts +2 -0
  856. package/lib/gpu/float-bits.js +9 -0
  857. package/lib/gpu/line-vertices.d.ts +1 -0
  858. package/lib/gpu/line-vertices.js +14 -0
  859. package/lib/gpu/memory.d.ts +19 -0
  860. package/lib/gpu/memory.js +50 -0
  861. package/lib/gpu/particle-records.d.ts +1 -0
  862. package/lib/gpu/particle-records.js +15 -0
  863. package/lib/gpu/pipeline-name.d.ts +6 -0
  864. package/lib/gpu/pipeline-name.js +23 -0
  865. package/lib/gpu/probe-steps.d.ts +22 -0
  866. package/lib/gpu/probe-steps.js +43 -0
  867. package/lib/gpu/readback.d.ts +32 -0
  868. package/lib/gpu/readback.js +163 -0
  869. package/lib/gpu/variants.d.ts +16 -0
  870. package/lib/gpu/variants.js +67 -0
  871. package/lib/gpu/vertex-format.d.ts +46 -0
  872. package/lib/gpu/vertex-format.js +111 -0
  873. package/lib/gpu/webgl2/backend.d.ts +714 -0
  874. package/lib/gpu/webgl2/backend.js +2964 -0
  875. package/lib/gpu/webgl2/call-timing.d.ts +34 -0
  876. package/lib/gpu/webgl2/call-timing.js +143 -0
  877. package/lib/gpu/webgl2/context.d.ts +31 -0
  878. package/lib/gpu/webgl2/context.js +111 -0
  879. package/lib/gpu/webgl2/depth.d.ts +25 -0
  880. package/lib/gpu/webgl2/depth.js +30 -0
  881. package/lib/gpu/webgl2/environment.d.ts +65 -0
  882. package/lib/gpu/webgl2/environment.js +572 -0
  883. package/lib/gpu/webgl2/gpu-timer.d.ts +25 -0
  884. package/lib/gpu/webgl2/gpu-timer.js +93 -0
  885. package/lib/gpu/webgl2/probes.d.ts +38 -0
  886. package/lib/gpu/webgl2/probes.js +117 -0
  887. package/lib/gpu/webgl2/programs.d.ts +238 -0
  888. package/lib/gpu/webgl2/programs.js +487 -0
  889. package/lib/gpu/webgpu/backend.d.ts +460 -0
  890. package/lib/gpu/webgpu/backend.js +1812 -0
  891. package/lib/gpu/webgpu/buffer-reads.d.ts +42 -0
  892. package/lib/gpu/webgpu/buffer-reads.js +95 -0
  893. package/lib/gpu/webgpu/culled-counts.d.ts +79 -0
  894. package/lib/gpu/webgpu/culled-counts.js +259 -0
  895. package/lib/gpu/webgpu/draw-path-probe.d.ts +37 -0
  896. package/lib/gpu/webgpu/draw-path-probe.js +187 -0
  897. package/lib/gpu/webgpu/environment.d.ts +36 -0
  898. package/lib/gpu/webgpu/environment.js +735 -0
  899. package/lib/gpu/webgpu/first-pass.d.ts +13 -0
  900. package/lib/gpu/webgpu/first-pass.js +61 -0
  901. package/lib/gpu/webgpu/gpu-timer.d.ts +67 -0
  902. package/lib/gpu/webgpu/gpu-timer.js +328 -0
  903. package/lib/gpu/webgpu/indirect-arguments.d.ts +42 -0
  904. package/lib/gpu/webgpu/indirect-arguments.js +156 -0
  905. package/lib/gpu/webgpu/pipelines.d.ts +264 -0
  906. package/lib/gpu/webgpu/pipelines.js +2013 -0
  907. package/lib/gpu/webgpu/probes.d.ts +27 -0
  908. package/lib/gpu/webgpu/probes.js +190 -0
  909. package/lib/gpu/webgpu/reusable.d.ts +74 -0
  910. package/lib/gpu/webgpu/reusable.js +212 -0
  911. package/lib/gpu/webgpu/staging.d.ts +79 -0
  912. package/lib/gpu/webgpu/staging.js +238 -0
  913. package/lib/gpu/webgpu/upload-routes.d.ts +55 -0
  914. package/lib/gpu/webgpu/upload-routes.js +128 -0
  915. package/lib/index.d.ts +121 -0
  916. package/lib/index.js +54 -0
  917. package/lib/math/color.d.ts +18 -0
  918. package/lib/math/color.js +71 -0
  919. package/lib/math/create-math.d.ts +101 -0
  920. package/lib/math/create-math.js +207 -0
  921. package/lib/math/hex.d.ts +8 -0
  922. package/lib/math/hex.js +38 -0
  923. package/lib/math/index.d.ts +2 -0
  924. package/lib/math/index.js +11 -0
  925. package/lib/math/mat4.d.ts +22 -0
  926. package/lib/math/mat4.js +206 -0
  927. package/lib/math/math.d.ts +16 -0
  928. package/lib/math/math.js +42 -0
  929. package/lib/math/namespaces/math.d.ts +7 -0
  930. package/lib/math/namespaces/math.js +14 -0
  931. package/lib/math/namespaces/quat.d.ts +20 -0
  932. package/lib/math/namespaces/quat.js +30 -0
  933. package/lib/math/namespaces/vec3.d.ts +4 -0
  934. package/lib/math/namespaces/vec3.js +8 -0
  935. package/lib/math/quat.d.ts +36 -0
  936. package/lib/math/quat.js +224 -0
  937. package/lib/math/random.d.ts +16 -0
  938. package/lib/math/random.js +57 -0
  939. package/lib/math/types.d.ts +43 -0
  940. package/lib/math/types.js +4 -0
  941. package/lib/math/vec3.d.ts +43 -0
  942. package/lib/math/vec3.js +187 -0
  943. package/lib/page/abortable.d.ts +2 -0
  944. package/lib/page/abortable.js +19 -0
  945. package/lib/page/browser-check.d.ts +8 -0
  946. package/lib/page/browser-check.js +23 -0
  947. package/lib/page/canvas-watch.d.ts +34 -0
  948. package/lib/page/canvas-watch.js +141 -0
  949. package/lib/page/capabilities.d.ts +201 -0
  950. package/lib/page/capabilities.js +409 -0
  951. package/lib/page/check-store.d.ts +54 -0
  952. package/lib/page/check-store.js +169 -0
  953. package/lib/page/display.d.ts +2 -0
  954. package/lib/page/display.js +25 -0
  955. package/lib/page/early-core.d.ts +1 -0
  956. package/lib/page/early-core.js +23 -0
  957. package/lib/page/engine.d.ts +942 -0
  958. package/lib/page/engine.js +2459 -0
  959. package/lib/page/first-frame.d.ts +16 -0
  960. package/lib/page/first-frame.js +35 -0
  961. package/lib/page/frame-stats.d.ts +402 -0
  962. package/lib/page/frame-stats.js +389 -0
  963. package/lib/page/gamepads.d.ts +37 -0
  964. package/lib/page/gamepads.js +123 -0
  965. package/lib/page/held-input.d.ts +19 -0
  966. package/lib/page/held-input.js +54 -0
  967. package/lib/page/hold.d.ts +186 -0
  968. package/lib/page/hold.js +49 -0
  969. package/lib/page/input-ring.d.ts +13 -0
  970. package/lib/page/input-ring.js +25 -0
  971. package/lib/page/input.d.ts +6 -0
  972. package/lib/page/input.js +159 -0
  973. package/lib/page/isolation-check.d.ts +14 -0
  974. package/lib/page/isolation-check.js +21 -0
  975. package/lib/page/label-loop.d.ts +80 -0
  976. package/lib/page/label-loop.js +417 -0
  977. package/lib/page/labels.d.ts +56 -0
  978. package/lib/page/labels.js +102 -0
  979. package/lib/page/limits.d.ts +321 -0
  980. package/lib/page/limits.js +323 -0
  981. package/lib/page/loader.d.ts +78 -0
  982. package/lib/page/loader.js +149 -0
  983. package/lib/page/main-thread.d.ts +10 -0
  984. package/lib/page/main-thread.js +41 -0
  985. package/lib/page/memory-pool.d.ts +26 -0
  986. package/lib/page/memory-pool.js +69 -0
  987. package/lib/page/ownership.d.ts +65 -0
  988. package/lib/page/ownership.js +166 -0
  989. package/lib/page/permutation-recording.d.ts +26 -0
  990. package/lib/page/permutation-recording.js +32 -0
  991. package/lib/page/pipeline-store.d.ts +25 -0
  992. package/lib/page/pipeline-store.js +84 -0
  993. package/lib/page/pointer-lock.d.ts +14 -0
  994. package/lib/page/pointer-lock.js +60 -0
  995. package/lib/page/preferences.d.ts +2 -0
  996. package/lib/page/preferences.js +11 -0
  997. package/lib/page/record-button.d.ts +5 -0
  998. package/lib/page/record-button.js +60 -0
  999. package/lib/page/start-marker.d.ts +47 -0
  1000. package/lib/page/start-marker.js +119 -0
  1001. package/lib/page/stats-switch.d.ts +16 -0
  1002. package/lib/page/stats-switch.js +38 -0
  1003. package/lib/page/stop-jobs.d.ts +37 -0
  1004. package/lib/page/stop-jobs.js +87 -0
  1005. package/lib/page/switches.d.ts +347 -0
  1006. package/lib/page/switches.js +150 -0
  1007. package/lib/page/videos.d.ts +70 -0
  1008. package/lib/page/videos.js +244 -0
  1009. package/lib/quality/budget.d.ts +14 -0
  1010. package/lib/quality/budget.js +25 -0
  1011. package/lib/quality/check.d.ts +119 -0
  1012. package/lib/quality/check.js +84 -0
  1013. package/lib/quality/chooser.d.ts +98 -0
  1014. package/lib/quality/chooser.js +108 -0
  1015. package/lib/quality/device-hints.d.ts +8 -0
  1016. package/lib/quality/device-hints.js +18 -0
  1017. package/lib/quality/governor.d.ts +571 -0
  1018. package/lib/quality/governor.js +1293 -0
  1019. package/lib/quality/preset-docs.d.ts +402 -0
  1020. package/lib/quality/preset-docs.js +179 -0
  1021. package/lib/quality/presets.d.ts +821 -0
  1022. package/lib/quality/presets.js +678 -0
  1023. package/lib/render/direct-loop.d.ts +4 -0
  1024. package/lib/render/direct-loop.js +52 -0
  1025. package/lib/render/draw.d.ts +66 -0
  1026. package/lib/render/draw.js +111 -0
  1027. package/lib/render/load-draw.d.ts +12 -0
  1028. package/lib/render/load-draw.js +18 -0
  1029. package/lib/render/loop.d.ts +241 -0
  1030. package/lib/render/loop.js +566 -0
  1031. package/lib/render/loss.d.ts +53 -0
  1032. package/lib/render/loss.js +127 -0
  1033. package/lib/render/pacer.d.ts +24 -0
  1034. package/lib/render/pacer.js +51 -0
  1035. package/lib/render/recovery.d.ts +82 -0
  1036. package/lib/render/recovery.js +160 -0
  1037. package/lib/render/refresh.d.ts +38 -0
  1038. package/lib/render/refresh.js +111 -0
  1039. package/lib/render/renderer.d.ts +192 -0
  1040. package/lib/render/renderer.js +295 -0
  1041. package/lib/render/scene-renderer.d.ts +135 -0
  1042. package/lib/render/scene-renderer.js +216 -0
  1043. package/lib/render/shader-salt.d.ts +5 -0
  1044. package/lib/render/shader-salt.js +31 -0
  1045. package/lib/render/webgl2-renderers.d.ts +11 -0
  1046. package/lib/render/webgl2-renderers.js +227 -0
  1047. package/lib/render/webgpu-renderers.d.ts +10 -0
  1048. package/lib/render/webgpu-renderers.js +254 -0
  1049. package/lib/scene/addon-debug-views.d.ts +30 -0
  1050. package/lib/scene/addon-debug-views.js +63 -0
  1051. package/lib/scene/animation.d.ts +547 -0
  1052. package/lib/scene/animation.js +1425 -0
  1053. package/lib/scene/area-light-tables.d.ts +32 -0
  1054. package/lib/scene/area-light-tables.js +89 -0
  1055. package/lib/scene/assets.d.ts +375 -0
  1056. package/lib/scene/assets.js +736 -0
  1057. package/lib/scene/background.d.ts +238 -0
  1058. package/lib/scene/background.js +470 -0
  1059. package/lib/scene/baked-light.d.ts +60 -0
  1060. package/lib/scene/baked-light.js +300 -0
  1061. package/lib/scene/builtin-environments.d.ts +36 -0
  1062. package/lib/scene/builtin-environments.js +43 -0
  1063. package/lib/scene/chunk-rows.d.ts +81 -0
  1064. package/lib/scene/chunk-rows.js +146 -0
  1065. package/lib/scene/color.d.ts +22 -0
  1066. package/lib/scene/color.js +45 -0
  1067. package/lib/scene/derived-cache.d.ts +139 -0
  1068. package/lib/scene/derived-cache.js +547 -0
  1069. package/lib/scene/downloads.d.ts +2 -0
  1070. package/lib/scene/downloads.js +371 -0
  1071. package/lib/scene/effects.d.ts +193 -0
  1072. package/lib/scene/effects.js +476 -0
  1073. package/lib/scene/environment-file.d.ts +22 -0
  1074. package/lib/scene/environment-file.js +81 -0
  1075. package/lib/scene/environment.d.ts +57 -0
  1076. package/lib/scene/environment.js +131 -0
  1077. package/lib/scene/fake-call-values.d.ts +8 -0
  1078. package/lib/scene/fake-call-values.js +51 -0
  1079. package/lib/scene/feature-draws.d.ts +169 -0
  1080. package/lib/scene/feature-draws.js +269 -0
  1081. package/lib/scene/feature-effects.d.ts +42 -0
  1082. package/lib/scene/feature-effects.js +155 -0
  1083. package/lib/scene/feature-host.d.ts +129 -0
  1084. package/lib/scene/feature-host.js +299 -0
  1085. package/lib/scene/feature-instances.d.ts +130 -0
  1086. package/lib/scene/feature-instances.js +326 -0
  1087. package/lib/scene/features.d.ts +412 -0
  1088. package/lib/scene/features.js +550 -0
  1089. package/lib/scene/file-limits.d.ts +70 -0
  1090. package/lib/scene/file-limits.js +224 -0
  1091. package/lib/scene/fog.d.ts +101 -0
  1092. package/lib/scene/fog.js +148 -0
  1093. package/lib/scene/frame-cameras.d.ts +175 -0
  1094. package/lib/scene/frame-cameras.js +492 -0
  1095. package/lib/scene/gltf-animation.d.ts +129 -0
  1096. package/lib/scene/gltf-animation.js +887 -0
  1097. package/lib/scene/gltf-draco.d.ts +9 -0
  1098. package/lib/scene/gltf-draco.js +224 -0
  1099. package/lib/scene/gltf-extensions.d.ts +31 -0
  1100. package/lib/scene/gltf-extensions.js +92 -0
  1101. package/lib/scene/gltf-json.d.ts +49 -0
  1102. package/lib/scene/gltf-json.js +94 -0
  1103. package/lib/scene/gltf-math.d.ts +16 -0
  1104. package/lib/scene/gltf-math.js +129 -0
  1105. package/lib/scene/gltf-meshopt.d.ts +3 -0
  1106. package/lib/scene/gltf-meshopt.js +48 -0
  1107. package/lib/scene/gltf-parse.d.ts +600 -0
  1108. package/lib/scene/gltf-parse.js +1854 -0
  1109. package/lib/scene/gltf.d.ts +189 -0
  1110. package/lib/scene/gltf.js +1589 -0
  1111. package/lib/scene/grade-table.d.ts +9 -0
  1112. package/lib/scene/grade-table.js +23 -0
  1113. package/lib/scene/grade-task.d.ts +12 -0
  1114. package/lib/scene/grade-task.js +11 -0
  1115. package/lib/scene/grading.d.ts +110 -0
  1116. package/lib/scene/grading.js +142 -0
  1117. package/lib/scene/half-float.d.ts +4 -0
  1118. package/lib/scene/half-float.js +42 -0
  1119. package/lib/scene/ktx2-cache.d.ts +32 -0
  1120. package/lib/scene/ktx2-cache.js +62 -0
  1121. package/lib/scene/ktx2-file.d.ts +57 -0
  1122. package/lib/scene/ktx2-file.js +207 -0
  1123. package/lib/scene/ktx2-transcode.d.ts +15 -0
  1124. package/lib/scene/ktx2-transcode.js +94 -0
  1125. package/lib/scene/ktx2.d.ts +42 -0
  1126. package/lib/scene/ktx2.js +179 -0
  1127. package/lib/scene/lens.d.ts +61 -0
  1128. package/lib/scene/lens.js +101 -0
  1129. package/lib/scene/level-meshopt.d.ts +20 -0
  1130. package/lib/scene/level-meshopt.js +122 -0
  1131. package/lib/scene/level-pieces.d.ts +24 -0
  1132. package/lib/scene/level-pieces.js +138 -0
  1133. package/lib/scene/level-rule.d.ts +120 -0
  1134. package/lib/scene/level-rule.js +130 -0
  1135. package/lib/scene/level-words.d.ts +19 -0
  1136. package/lib/scene/level-words.js +34 -0
  1137. package/lib/scene/levels-task.d.ts +51 -0
  1138. package/lib/scene/levels-task.js +132 -0
  1139. package/lib/scene/light-images.d.ts +36 -0
  1140. package/lib/scene/light-images.js +88 -0
  1141. package/lib/scene/light-probes.d.ts +240 -0
  1142. package/lib/scene/light-probes.js +644 -0
  1143. package/lib/scene/lines.d.ts +188 -0
  1144. package/lib/scene/lines.js +257 -0
  1145. package/lib/scene/lut-files.d.ts +41 -0
  1146. package/lib/scene/lut-files.js +399 -0
  1147. package/lib/scene/lut.d.ts +55 -0
  1148. package/lib/scene/lut.js +47 -0
  1149. package/lib/scene/memory.d.ts +72 -0
  1150. package/lib/scene/memory.js +159 -0
  1151. package/lib/scene/mesh-arrays.d.ts +110 -0
  1152. package/lib/scene/mesh-arrays.js +701 -0
  1153. package/lib/scene/mesh-levels.d.ts +10 -0
  1154. package/lib/scene/mesh-levels.js +52 -0
  1155. package/lib/scene/namespaces.d.ts +125 -0
  1156. package/lib/scene/namespaces.js +313 -0
  1157. package/lib/scene/panorama-files.d.ts +71 -0
  1158. package/lib/scene/panorama-files.js +1103 -0
  1159. package/lib/scene/panorama.d.ts +23 -0
  1160. package/lib/scene/panorama.js +108 -0
  1161. package/lib/scene/particles.d.ts +452 -0
  1162. package/lib/scene/particles.js +814 -0
  1163. package/lib/scene/pass-reads.d.ts +70 -0
  1164. package/lib/scene/pass-reads.js +220 -0
  1165. package/lib/scene/picks.d.ts +69 -0
  1166. package/lib/scene/picks.js +208 -0
  1167. package/lib/scene/pointer-events.d.ts +202 -0
  1168. package/lib/scene/pointer-events.js +500 -0
  1169. package/lib/scene/post.d.ts +567 -0
  1170. package/lib/scene/post.js +928 -0
  1171. package/lib/scene/prefab.d.ts +109 -0
  1172. package/lib/scene/prefab.js +166 -0
  1173. package/lib/scene/probes.d.ts +71 -0
  1174. package/lib/scene/probes.js +169 -0
  1175. package/lib/scene/property-animation.d.ts +160 -0
  1176. package/lib/scene/property-animation.js +276 -0
  1177. package/lib/scene/queries.d.ts +176 -0
  1178. package/lib/scene/queries.js +393 -0
  1179. package/lib/scene/render.d.ts +487 -0
  1180. package/lib/scene/render.js +829 -0
  1181. package/lib/scene/resources.d.ts +1598 -0
  1182. package/lib/scene/resources.js +2843 -0
  1183. package/lib/scene/rotation.d.ts +6 -0
  1184. package/lib/scene/rotation.js +12 -0
  1185. package/lib/scene/scene.d.ts +1858 -0
  1186. package/lib/scene/scene.js +4680 -0
  1187. package/lib/scene/serial-loads.d.ts +29 -0
  1188. package/lib/scene/serial-loads.js +68 -0
  1189. package/lib/scene/shader-preloads.d.ts +74 -0
  1190. package/lib/scene/shader-preloads.js +116 -0
  1191. package/lib/scene/shader-templates.d.ts +60 -0
  1192. package/lib/scene/shader-templates.js +156 -0
  1193. package/lib/scene/sprites.d.ts +262 -0
  1194. package/lib/scene/sprites.js +292 -0
  1195. package/lib/scene/stale-calls-scenario.d.ts +20 -0
  1196. package/lib/scene/stale-calls-scenario.js +175 -0
  1197. package/lib/scene/textures.d.ts +323 -0
  1198. package/lib/scene/textures.js +953 -0
  1199. package/lib/scene/time-of-day.d.ts +145 -0
  1200. package/lib/scene/time-of-day.js +644 -0
  1201. package/lib/scene/unmarked-writes.d.ts +118 -0
  1202. package/lib/scene/unmarked-writes.js +283 -0
  1203. package/lib/scene/unread-extensions-scenario.d.ts +6 -0
  1204. package/lib/scene/unread-extensions-scenario.js +26 -0
  1205. package/lib/scene/vertex-draws.d.ts +82 -0
  1206. package/lib/scene/vertex-draws.js +85 -0
  1207. package/lib/scene/wgsl-uniforms.d.ts +167 -0
  1208. package/lib/scene/wgsl-uniforms.js +12 -0
  1209. package/lib/shader-artifact.json +1 -0
  1210. package/lib/shared/await-later.d.ts +5 -0
  1211. package/lib/shared/await-later.js +10 -0
  1212. package/lib/shared/control.d.ts +94 -0
  1213. package/lib/shared/control.js +150 -0
  1214. package/lib/shared/core-sources.d.ts +2 -0
  1215. package/lib/shared/core-sources.js +7 -0
  1216. package/lib/shared/core.d.ts +1254 -0
  1217. package/lib/shared/core.js +381 -0
  1218. package/lib/shared/counter.d.ts +52 -0
  1219. package/lib/shared/counter.js +55 -0
  1220. package/lib/shared/dev.d.ts +8 -0
  1221. package/lib/shared/dev.js +13 -0
  1222. package/lib/shared/feature-stats.d.ts +16 -0
  1223. package/lib/shared/feature-stats.js +27 -0
  1224. package/lib/shared/frame-image.d.ts +13 -0
  1225. package/lib/shared/frame-image.js +32 -0
  1226. package/lib/shared/gpu-clock.d.ts +14 -0
  1227. package/lib/shared/gpu-clock.js +38 -0
  1228. package/lib/shared/gpu-counter.d.ts +12 -0
  1229. package/lib/shared/gpu-counter.js +15 -0
  1230. package/lib/shared/gpu-scope.d.ts +14 -0
  1231. package/lib/shared/gpu-scope.js +104 -0
  1232. package/lib/shared/helper-workers.d.ts +4 -0
  1233. package/lib/shared/helper-workers.js +23 -0
  1234. package/lib/shared/images.d.ts +255 -0
  1235. package/lib/shared/images.js +450 -0
  1236. package/lib/shared/import-once.d.ts +6 -0
  1237. package/lib/shared/import-once.js +19 -0
  1238. package/lib/shared/key-codes.d.ts +2 -0
  1239. package/lib/shared/key-codes.js +69 -0
  1240. package/lib/shared/labels.d.ts +94 -0
  1241. package/lib/shared/labels.js +172 -0
  1242. package/lib/shared/memory-area.d.ts +6 -0
  1243. package/lib/shared/memory-area.js +21 -0
  1244. package/lib/shared/memory-figure.d.ts +14 -0
  1245. package/lib/shared/memory-figure.js +18 -0
  1246. package/lib/shared/memory-views.d.ts +48 -0
  1247. package/lib/shared/memory-views.js +90 -0
  1248. package/lib/shared/metrics.d.ts +353 -0
  1249. package/lib/shared/metrics.js +799 -0
  1250. package/lib/shared/page-measurement.d.ts +9 -0
  1251. package/lib/shared/page-measurement.js +37 -0
  1252. package/lib/shared/phase.d.ts +17 -0
  1253. package/lib/shared/phase.js +20 -0
  1254. package/lib/shared/policy.d.ts +20 -0
  1255. package/lib/shared/policy.js +46 -0
  1256. package/lib/shared/recording.d.ts +100 -0
  1257. package/lib/shared/recording.js +378 -0
  1258. package/lib/shared/role.d.ts +10 -0
  1259. package/lib/shared/role.js +13 -0
  1260. package/lib/shared/run-task.d.ts +39 -0
  1261. package/lib/shared/run-task.js +69 -0
  1262. package/lib/shared/slot.d.ts +218 -0
  1263. package/lib/shared/slot.js +221 -0
  1264. package/lib/shared/software.d.ts +24 -0
  1265. package/lib/shared/software.js +22 -0
  1266. package/lib/shared/stats.d.ts +62 -0
  1267. package/lib/shared/stats.js +86 -0
  1268. package/lib/shared/task-failure.d.ts +24 -0
  1269. package/lib/shared/task-failure.js +36 -0
  1270. package/lib/shared/task-host.d.ts +42 -0
  1271. package/lib/shared/task-host.js +60 -0
  1272. package/lib/shared/task-load-error.d.ts +10 -0
  1273. package/lib/shared/task-load-error.js +13 -0
  1274. package/lib/shared/task-modules.d.ts +2 -0
  1275. package/lib/shared/task-modules.js +8 -0
  1276. package/lib/shared/task-pending.d.ts +24 -0
  1277. package/lib/shared/task-pending.js +101 -0
  1278. package/lib/shared/tasks.d.ts +54 -0
  1279. package/lib/shared/tasks.js +426 -0
  1280. package/lib/shared/tier.d.ts +7 -0
  1281. package/lib/shared/tier.js +3 -0
  1282. package/lib/shared/version.d.ts +72 -0
  1283. package/lib/shared/version.js +103 -0
  1284. package/lib/shared/videos.d.ts +15 -0
  1285. package/lib/shared/videos.js +11 -0
  1286. package/lib/shared/wake.d.ts +38 -0
  1287. package/lib/shared/wake.js +76 -0
  1288. package/lib/shared/wasm-limits.d.ts +13 -0
  1289. package/lib/shared/wasm-limits.js +75 -0
  1290. package/lib/shared/wasm.d.ts +34 -0
  1291. package/lib/shared/wasm.js +151 -0
  1292. package/lib/shared/webkit.d.ts +33 -0
  1293. package/lib/shared/webkit.js +59 -0
  1294. package/lib/shared/wgsl-updates.d.ts +9 -0
  1295. package/lib/shared/wgsl-updates.js +8 -0
  1296. package/lib/shared/worker-start.d.ts +56 -0
  1297. package/lib/shared/worker-start.js +186 -0
  1298. package/lib/sketch/clock.d.ts +61 -0
  1299. package/lib/sketch/clock.js +98 -0
  1300. package/lib/sketch/define-sketch.d.ts +269 -0
  1301. package/lib/sketch/define-sketch.js +103 -0
  1302. package/lib/sketch/input-off-scenario.d.ts +7 -0
  1303. package/lib/sketch/input-off-scenario.js +24 -0
  1304. package/lib/sketch/input-off.d.ts +16 -0
  1305. package/lib/sketch/input-off.js +38 -0
  1306. package/lib/sketch/input.d.ts +243 -0
  1307. package/lib/sketch/input.js +554 -0
  1308. package/lib/sketch/preset-check.d.ts +42 -0
  1309. package/lib/sketch/preset-check.js +120 -0
  1310. package/lib/sketch/quality.d.ts +392 -0
  1311. package/lib/sketch/quality.js +355 -0
  1312. package/lib/sketch/random.d.ts +13 -0
  1313. package/lib/sketch/random.js +25 -0
  1314. package/lib/sketch/runner.d.ts +574 -0
  1315. package/lib/sketch/runner.js +2159 -0
  1316. package/lib/sketch/ui.d.ts +94 -0
  1317. package/lib/sketch/ui.js +391 -0
  1318. package/lib/stats.d.ts +4 -0
  1319. package/lib/stats.js +8 -0
  1320. package/lib/workers/drawing-host.d.ts +24 -0
  1321. package/lib/workers/drawing-host.js +48 -0
  1322. package/lib/workers/gltf-worker.d.ts +35 -0
  1323. package/lib/workers/gltf-worker.js +210 -0
  1324. package/lib/workers/job-worker.d.ts +1 -0
  1325. package/lib/workers/job-worker.js +102 -0
  1326. package/lib/workers/panorama-worker.d.ts +15 -0
  1327. package/lib/workers/panorama-worker.js +21 -0
  1328. package/lib/workers/probe-worker.d.ts +34 -0
  1329. package/lib/workers/probe-worker.js +58 -0
  1330. package/lib/workers/protocol.d.ts +377 -0
  1331. package/lib/workers/protocol.js +57 -0
  1332. package/lib/workers/render-worker.d.ts +1 -0
  1333. package/lib/workers/render-worker.js +103 -0
  1334. package/lib/workers/sketch-worker.d.ts +1 -0
  1335. package/lib/workers/sketch-worker.js +295 -0
  1336. package/lib/workers/task-worker.d.ts +1 -0
  1337. package/lib/workers/task-worker.js +5 -0
  1338. package/lib/workers/tasks.d.ts +65 -0
  1339. package/lib/workers/tasks.js +85 -0
  1340. package/package.json +106 -5
  1341. package/vendor/basis/LICENSE +201 -0
  1342. package/vendor/basis/LICENSE-zstd +30 -0
  1343. package/vendor/basis/NOTICE +15 -0
  1344. package/vendor/basis/basis_transcoder.d.mts +36 -0
  1345. package/vendor/basis/basis_transcoder.mjs +2 -0
  1346. package/vendor/basis/basis_transcoder.wasm +0 -0
  1347. package/vendor/draco/LICENSE +252 -0
  1348. package/vendor/draco/draco_decoder_gltf.wasm +0 -0
  1349. package/vendor/draco/draco_wasm_wrapper_gltf.d.ts +71 -0
  1350. package/vendor/draco/draco_wasm_wrapper_gltf.js +116 -0
  1351. package/vendor/ltc/LICENSE +31 -0
  1352. package/vendor/ltc/area-light-tables.bin +0 -0
  1353. package/vendor/meshopt/LICENSE.md +21 -0
  1354. package/vendor/meshopt/meshopt_clusterizer.wasm +0 -0
  1355. package/vendor/meshopt/meshopt_decoder.wasm +0 -0
  1356. package/vendor/meshopt/meshopt_encoder.wasm +0 -0
  1357. package/vendor/meshopt/meshopt_simplifier.wasm +0 -0
@@ -0,0 +1,2159 @@
1
+ // Runs a sketch: starts the engine on this thread's core, calls the sketch's setup function once with
2
+ // the scene API, and steps it once per frame. A frame reads the canvas size and the input the page
3
+ // wrote, runs the sketch's fixed steps and its update, then the core's commands and transforms. It
4
+ // then runs the sketch's late update and updates what that moved, and ends with the core's other
5
+ // steps, which publish the frame's draw list. Each step's CPU time is recorded, and so is the time
6
+ // each job worker spent on the frame's work. Development builds report static objects whose
7
+ // transform changed without a setter, before each transform update. A warm-up during the setup
8
+ // records and publishes a frame of the scene as it stands, with none of the sketch's code, so the
9
+ // thread that draws builds its pipelines. In hold mode it seeds this thread's math.random and routes
10
+ // Math.random to it, steps the sketch to the held time in fixed steps after the setup, and publishes
11
+ // the last frame alone. Hold mode reads no input and no display preference, so the held frame never
12
+ // depends on them: the sketch sees no request for reduced motion and hears of no change. In
13
+ // development builds, the frame's debug drawing reaches the core just before the frame records;
14
+ // release builds give the sketch calls that do nothing. Each core step of the frame can grow the
15
+ // engine's memory, so the views of it are made again after each step that sketch code or a
16
+ // development check follows, and at the end of the frame, for code that runs between frames. When
17
+ // the engine chose the preset itself, the setup ends with the preset check (preset-check.ts), which
18
+ // loads after the first frame. The first frame after a change of preset, and the first frame whose
19
+ // handlers hear of it, wait for their pipelines on the thread that draws.
20
+ import { DebugChannel } from '../debug/channel.js';
21
+ import { DebugDraw } from '../debug/draw.js';
22
+ import { SketchDebug } from '../debug/sketch-debug.js';
23
+ import { DEV } from '../errors/checks.js';
24
+ import { coreFailure, QUEUED_CHANGE } from '../errors/core-failure.js';
25
+ import { EngineError } from '../errors/engine-error.js';
26
+ import { messageOf } from '../errors/message.js';
27
+ import { ANTIALIAS_FXAA, ANTIALIAS_MSAA, ANTIALIAS_NONE, CORE_NOT_COUNTED, LIGHT_VALUE_HERO_SIZE, LIGHT_VALUE_SHADOW_CASCADES, LIGHT_VALUE_SHADOW_MAP_SIZE, TEXTURE_OPTION_KEEP_COPIES, TEXTURE_OPTION_UPLOAD_ALL, TEXTURE_STAT_IMAGES_SENT, TEXTURE_STAT_WAITING, } from '../generated/core.js';
28
+ import { FORMAT_CANVAS, PERMUTATION_DRAW_INDEX, PERMUTATION_TONE_MAP } from '../generated/gpu.js';
29
+ import { cellTableWarning } from '../page/limits.js';
30
+ import { FULL_SCALE, thousandths } from '../quality/budget.js';
31
+ import { Governor, GovernorLoop } from '../quality/governor.js';
32
+ import { lowestTierCuts, presetSettings, presetValue, SKETCH_SETTINGS, tierRestoreSettings, } from '../quality/presets.js';
33
+ import { FrameCameras } from '../scene/frame-cameras.js';
34
+ import { GltfExtensions } from '../scene/gltf-extensions.js';
35
+ import { GradeTable } from '../scene/grade-table.js';
36
+ import { CoreMemory } from '../scene/memory.js';
37
+ import { Post } from '../scene/post.js';
38
+ import { Render } from '../scene/render.js';
39
+ import { Geometry, Materials } from '../scene/resources.js';
40
+ import { Camera, Light, Scene } from '../scene/scene.js';
41
+ import { ShaderPreloads } from '../scene/shader-preloads.js';
42
+ import { ShaderTemplates } from '../scene/shader-templates.js';
43
+ import { Textures } from '../scene/textures.js';
44
+ import { awaitLater } from '../shared/await-later.js';
45
+ import { controlLabels, controlViews, EVENT_KEY_DOWN, EVENT_KEY_UP, EVENT_POINTER_DOWN, EVENT_POINTER_MOVE, EVENT_POINTER_UP, EVENT_WHEEL, FLAG_PRIMARY, frameAfter, frameReached, nextFrame, Slot, writeInputEvent, } from '../shared/control.js';
46
+ import { stopHelperWorkers } from '../shared/helper-workers.js';
47
+ import { imagesArrived, } from '../shared/images.js';
48
+ import { MEMORY_AREA_COUNT } from '../shared/memory-area.js';
49
+ import { MemoryViews } from '../shared/memory-views.js';
50
+ import { Counter, FrameRecorder, MemoryFigure, PHASE_NAMES, Phase, RingFrames, Role, refreshRate, } from '../shared/metrics.js';
51
+ import { endPlanHold, holdPlans, plansPending, releasePlans, tasksPending, } from '../shared/task-pending.js';
52
+ import { VIDEO_FRAME } from '../shared/videos.js';
53
+ import { slotChange, slotChangeOrRecheck } from '../shared/wake.js';
54
+ import { FixedClock, FrameClock, holdSteps } from './clock.js';
55
+ import { InputReader } from './input.js';
56
+ import { InputOffNotes, noteInputReads } from './input-off.js';
57
+ import { RESTART_CHANGE, SketchQuality } from './quality.js';
58
+ import { HOLD_SEED, RECORDING_SEED, seedMathRandom } from './random.js';
59
+ import { Ui } from './ui.js';
60
+ /**
61
+ * The engine core's instance batch table, sized for the most batches a page draws at once.
62
+ *
63
+ * A page that plants twelve species draws 258: 159 for the distance bands' parts, 65 for the near
64
+ * shoot shapes and 34 for cards and dead wood. The table held 256 until Creek crossed it, so that
65
+ * number was never a budget with slack, and one more species broke it. The count grows with each
66
+ * species and each part a species draws, at about 21 a species, so 512 leaves room for some twelve
67
+ * species more before the table is full again.
68
+ *
69
+ * This is a stopgap. The table should be sized from what a page asks for: the engine learns the
70
+ * batches a page's meshes and plants need before its first frame, and refuses only past what the
71
+ * device carries. A raise past that point fails as a browser validation fault, not as this table's
72
+ * own error; at 1024 this table was still the limit.
73
+ */
74
+ const MAX_BATCHES = 512;
75
+ /**
76
+ * How long a held frame waits for the tasks that the sketch queued before it. A task answers
77
+ * between frames, and a hold runs its frames with no frame loop, so the held frame waits here or
78
+ * it draws what the tasks had not yet written. The limit keeps a task that never answers from
79
+ * stopping the hold.
80
+ */
81
+ const TASK_SETTLE_LIMIT_MS = 10_000;
82
+ /**
83
+ * How long a held frame waits for the level plans of meshes made in code. A plan of a million
84
+ * triangles takes about six seconds of one job worker on an idle machine, and far longer on a busy
85
+ * one or behind other tasks, so the limit is a guard against a plan that never answers. A held
86
+ * frame never draws without the levels that its meshes plan: past the limit, hold mode fails and
87
+ * names the meshes.
88
+ */
89
+ const PLAN_SETTLE_LIMIT_MS = 300_000;
90
+ /** How often a held frame that waits for level plans says which meshes still plan. */
91
+ const PLAN_PROGRESS_MS = 10_000;
92
+ const COMMAND_CAPACITY = 1 << 16;
93
+ /** The id of the pointer that a timed script drives, and the bit of its main button. */
94
+ const MAIN_POINTER = 1;
95
+ const MAIN_BUTTON = 1;
96
+ /**
97
+ * How many of a sketch's listed files download at once, while no load asks for one. On HTTP/1.1 a
98
+ * browser opens few connections to one server, and a large file holds one until it has arrived, so
99
+ * the engine's own start files, such as the shader files that the setup's first frame asks for,
100
+ * still find free ones. One file at a time would leave the link idle for a round trip between files.
101
+ */
102
+ const LISTED_AT_ONCE = 2;
103
+ /**
104
+ * How many of a sketch's listed files download at once while loads wait for them: those loads go
105
+ * ahead of the rest of the list. A setup that asks for many listed files together then still
106
+ * leaves connections for the engine's own files, which its loads need too, such as the model
107
+ * loader's code and the warm-up's shader files.
108
+ */
109
+ const LISTED_MOST = 4;
110
+ /**
111
+ * Fetches a listed file that no load has asked for yet, at low priority, so the engine's own files
112
+ * go first where the browser orders requests, as it does on HTTP/2.
113
+ */
114
+ const fetchListed = (address) => fetch(address, { priority: 'low' });
115
+ /**
116
+ * The addresses of a sketch's download list, resolved against the page's address, without repeats.
117
+ * Throws E1214 for a list that is not an array, and for an entry that is not a file's address.
118
+ */
119
+ function listedAddresses(list, base) {
120
+ if (!Array.isArray(list))
121
+ throw new EngineError('E1214', `defineSketch() got ${String(list)} for downloads, which takes an array of addresses.`);
122
+ const addresses = new Map();
123
+ for (const entry of list) {
124
+ let address;
125
+ if (entry instanceof URL || (typeof entry === 'string' && entry.trim() !== '')) {
126
+ try {
127
+ address = new URL(entry, base);
128
+ }
129
+ catch { }
130
+ }
131
+ if (!address)
132
+ throw new EngineError('E1214', `defineSketch() got ${typeof entry === 'string' ? JSON.stringify(entry) : String(entry)} in downloads, which is not the address of a file.`);
133
+ addresses.set(address.href, address);
134
+ }
135
+ return [...addresses.values()];
136
+ }
137
+ /**
138
+ * @internal Begins the downloads of a live sketch's list, unless `files` holds them already: the
139
+ * first two fetches at once, and the assets loader's code beside them, whose downloads read the
140
+ * bodies as they arrive and start the rest. A list that is not valid begins nothing, and the setup
141
+ * reports it.
142
+ */
143
+ export function startListedFiles(files, sketch, base) {
144
+ const list = sketch.options.downloads;
145
+ if (files.downloads || list === undefined)
146
+ return;
147
+ let addresses;
148
+ try {
149
+ addresses = listedAddresses(list, base);
150
+ }
151
+ catch {
152
+ return;
153
+ }
154
+ if (addresses.length === 0)
155
+ return;
156
+ const started = addresses
157
+ .slice(0, LISTED_AT_ONCE)
158
+ .map((address) => awaitLater(fetchListed(address)));
159
+ files.downloads = awaitLater(import('../scene/assets.js').then(({ Downloads }) => {
160
+ const downloads = new Downloads(base);
161
+ downloads.list(addresses, started, LISTED_AT_ONCE, LISTED_MOST, fetchListed);
162
+ return downloads;
163
+ }));
164
+ }
165
+ /** How often a wait for a control slot checks it, where the control block is not shared memory. */
166
+ const SLOT_POLL_MS = 4;
167
+ /** Each meter of automatic exposure, by its code in the core. */
168
+ const EXPOSURE_METERS = { downsample: 0, histogram: 1 };
169
+ /**
170
+ * While a reader shows the frame figures, the first frame that samples publishes the memory
171
+ * figures, and then one frame in every this many.
172
+ */
173
+ const MEMORY_EVERY = 8;
174
+ /** Frames over which the sketch thread averages its parallel work before it asks for job workers. */
175
+ const JOB_WINDOW = 30;
176
+ /**
177
+ * The longest a window waits for its frames, in seconds of the sketch's own time, and the fewest
178
+ * frames it judges: a software GPU draws so few frames a second that a window of frames alone
179
+ * would never end inside a page's run, so the deadline ends the window once it holds the fewest
180
+ * frames. The runner reads no clock for this and allocates nothing per frame: its own step time
181
+ * carries the deadline, and a step is capped at a quarter second, so the deadline takes as few as
182
+ * eight frames. The mean over the frames it has then decides as it does for a full window.
183
+ */
184
+ const JOB_WINDOW_SECONDS = 2;
185
+ /** The fewest frames a window needs before the deadline may end it. */
186
+ const JOB_WINDOW_MIN_FRAMES = 2;
187
+ /**
188
+ * The mean time per frame that the sketch thread spends in loops it hands out, in microseconds,
189
+ * from which it asks for more job workers: twice as many, and at least 2.
190
+ */
191
+ const JOB_GROW_US = 200;
192
+ /**
193
+ * Seconds of sketch time that the sketch thread leaves its parallel loops untimed after a window
194
+ * with too little work, before it times them again. Each timing reads the browser's clock, which
195
+ * allocates a number. It is a time, so a slow frame rate holds the job workers back no longer than
196
+ * a fast one does.
197
+ */
198
+ const JOB_PAUSE_SECONDS = 4.5;
199
+ /**
200
+ * The assets API, whose loader loads with the first call that reads a file: a sketch that loads no
201
+ * file downloads none of it. Every call waits for the loader first. The two calls that answer with
202
+ * a function of their own answer at once: the extension handlers live beside the runner, so a
203
+ * registration keeps its errors, and the progress handlers join the loader once it arrives. The
204
+ * loader takes the downloads of the sketch's list when `listed` gives them, and a development build
205
+ * watches the sketch's loads while `watching` says so.
206
+ *
207
+ * With `inOrder`, as while the engine holds its frames, the calls run one at a time in the order
208
+ * the sketch made them: each starts once the call before it has answered. A load makes its
209
+ * textures, meshes and materials when its files arrive, and files arrive in an order that changes
210
+ * from run to run, so loads that ran together would make the scene's content in another order on
211
+ * each run, and the held frame would draw its objects in another order and with other ids.
212
+ */
213
+ function lazyAssets(textures, base, makers, listed, watching, inOrder) {
214
+ const extensions = new GltfExtensions();
215
+ // The loader's file starts downloading at the first call that reads a file, or with the
216
+ // sketch's list, never at the start: a page that loads nothing must download none of it.
217
+ let ready;
218
+ /** The answer of the call made last, which the next call waits for when the calls run in order. */
219
+ let answered = Promise.resolve();
220
+ const load = () => (ready ??= awaitLater(import('../scene/assets.js').then(({ Assets, Downloads }) => {
221
+ const make = (downloads) => {
222
+ if (DEV)
223
+ downloads.watch(watching);
224
+ return new Assets(textures, base, makers, extensions, downloads);
225
+ };
226
+ // Without a list the loader is ready within the import's own promise steps, so its
227
+ // calls keep their place among the setup's other promises, as hold mode, a replay
228
+ // and a recording need.
229
+ const early = listed();
230
+ return early ? early.then(make) : make(new Downloads(base));
231
+ })));
232
+ return new Proxy({}, {
233
+ get(_target, name) {
234
+ // The proxy must not look like a promise to the code that awaits a call's result.
235
+ if (name === 'then')
236
+ return undefined;
237
+ if (name === 'registerGltfExtension')
238
+ return (handler) => extensions.register(handler);
239
+ if (name === 'cache')
240
+ return (cacheName, version) => lazyCache(load, cacheName, version);
241
+ if (name === 'onProgress') {
242
+ return (handler) => {
243
+ let off;
244
+ void load().then((assets) => {
245
+ off = assets.onProgress(handler);
246
+ });
247
+ return () => off?.();
248
+ };
249
+ }
250
+ return (...args) => {
251
+ const call = () => load().then((assets) => assets[name](...args));
252
+ if (!inOrder)
253
+ return call();
254
+ const answer = answered.then(call, call);
255
+ answered = answer;
256
+ return answer;
257
+ };
258
+ },
259
+ });
260
+ }
261
+ /**
262
+ * A namespace of the cache of derived data that answers at once, as `assets.cache` does, while
263
+ * the loader that holds the cache loads with its first read or write.
264
+ */
265
+ function lazyCache(load, name, version) {
266
+ const cache = () => load().then((assets) => assets.cache(name, version));
267
+ return {
268
+ name,
269
+ version: String(version),
270
+ get: (key) => cache().then((own) => own.get(key)),
271
+ put: (key, bytes) => cache().then((own) => own.put(key, bytes)),
272
+ };
273
+ }
274
+ /**
275
+ * Resolves once a control slot holds frame `target` or a later one, or once the engine stops. It waits without
276
+ * blocking the thread, and checks the slot on a timer where the control block is not shared memory.
277
+ * A start's steps wait this way, so each wait also checks the slot again after a short time, in case
278
+ * the browser missed the wake.
279
+ */
280
+ async function reached(slots, slot, target) {
281
+ const shared = typeof SharedArrayBuffer !== 'undefined' && slots.buffer instanceof SharedArrayBuffer;
282
+ for (;;) {
283
+ const value = Atomics.load(slots, slot);
284
+ if (frameReached(value, target) || Atomics.load(slots, Slot.Running) === 0)
285
+ return;
286
+ if (shared) {
287
+ const change = slotChangeOrRecheck(slots, slot, value);
288
+ if (change)
289
+ await change;
290
+ }
291
+ else
292
+ await new Promise((resolve) => setTimeout(resolve, SLOT_POLL_MS));
293
+ }
294
+ }
295
+ /**
296
+ * The pipelined frame loop of a thread that runs the sketch while another thread draws: the sketch
297
+ * worker, or the page with sketchThread: 'main'. It steps the sketch once the thread that draws has
298
+ * taken the frame before, and waits for that without blocking, so the thread's event loop stays free
299
+ * for promises, messages and the page's events. It ends when the engine stops, or when a frame
300
+ * step throws, such as a trap in the core: `fault` then hears the error, and the engine draws the
301
+ * last frame until the page destroys it. Each pass reads the newest published frame, because the
302
+ * setup's frames publish from the same thread.
303
+ */
304
+ export async function runPipelined(sketch, control, fault) {
305
+ const { slots } = controlViews(control);
306
+ sketch.context.scene.attachPickControl(slots);
307
+ sketch.context.render.attachReadControl(slots);
308
+ try {
309
+ while (Atomics.load(slots, Slot.Running) !== 0) {
310
+ const paused = Atomics.load(slots, Slot.Paused);
311
+ if (paused !== 0) {
312
+ const change = slotChange(slots, Slot.Paused, paused);
313
+ if (change)
314
+ await change;
315
+ continue;
316
+ }
317
+ const taken = Atomics.load(slots, Slot.FramesTaken);
318
+ if (frameAfter(Atomics.load(slots, Slot.FramesPublished), taken)) {
319
+ const change = slotChange(slots, Slot.FramesTaken, taken);
320
+ if (change)
321
+ await change;
322
+ continue;
323
+ }
324
+ const published = sketch.step(performance.now());
325
+ Atomics.store(slots, Slot.FramesPublished, published);
326
+ Atomics.notify(slots, Slot.FramesPublished);
327
+ }
328
+ }
329
+ catch (error) {
330
+ if (Atomics.load(slots, Slot.Running) !== 0)
331
+ fault(error);
332
+ }
333
+ }
334
+ export class SketchRunner {
335
+ metrics;
336
+ sketch;
337
+ holdSeconds;
338
+ holdScript;
339
+ messageHandlers = new Set();
340
+ preferenceHandlers = new Set();
341
+ /** The motion preference as the sketch last saw it. */
342
+ reducedMotion;
343
+ callbacks = {};
344
+ /** True once the setup function has returned. */
345
+ setUp = false;
346
+ /** The downloads of the sketch's list, once a live setup began or took them. */
347
+ listed;
348
+ /** Resolves the sketch's `engine.firstFrame`, until it has. */
349
+ firstFrameReached;
350
+ /**
351
+ * True while a development build watches the sketch's loads for one that waits for another:
352
+ * during the setup function of a live start.
353
+ */
354
+ watchesLoads = false;
355
+ /** The frames that warm-ups during the setup published, one after another, as the last one's number. */
356
+ setupFrames = Promise.resolve(0);
357
+ clock = new FrameClock();
358
+ /** The fixed steps' clock, which the sketch's options set up. */
359
+ fixed = new FixedClock();
360
+ /** The page's count of resumes as the last frame read it, and whether the page showed since. */
361
+ resumes = -1;
362
+ resumed = false;
363
+ /** The sketch's `time`, which each frame updates in place. Its frames are those that run the sketch. */
364
+ time = { now: 0, dt: 0, frame: 0, held: false, drawn: true };
365
+ /**
366
+ * The engine's number of the frame it recorded last. The setup's frames, for warm-ups and the
367
+ * preset check, count here but not in `time.frame`. The core, the draw lists and the thread that
368
+ * draws use these numbers. `held` is true while hold mode steps the frames, so a mesh that
369
+ * makes its planned levels one a frame takes them all at once.
370
+ */
371
+ recorded = { frame: 0, held: false };
372
+ /** The sketch's `engine.viewport`, which each frame updates in place when the canvas changed. */
373
+ viewport = { width: 0, height: 0, pixelRatio: 1 };
374
+ /** The page's count of canvas size changes when the viewport last read them. */
375
+ viewportSerial = -1;
376
+ gpuEpoch = 0;
377
+ /** True while the page lets a still view accumulate its frames, as the frame loop last read it. */
378
+ stillEnabled = true;
379
+ /** True once the development probe of the two-step pass asked the core for its answers. */
380
+ twoStepAsked = false;
381
+ /**
382
+ * Frames left before the next publish of the memory figures, while a reader samples them. It is
383
+ * 0 while nobody samples, so the first frame that samples publishes them.
384
+ */
385
+ memoryWait = 0;
386
+ /** True once the first report checked that the core's areas are the ones the page names. */
387
+ areasChecked = false;
388
+ record;
389
+ /** One recorder per job worker, for the busy time the core reports for it each frame. */
390
+ jobRecords;
391
+ /**
392
+ * The parallel work of the frames in the current window, in whole microseconds, and the
393
+ * window's frames.
394
+ */
395
+ jobWindowUs = 0;
396
+ jobWindowFrames = 0;
397
+ /** The sketch time at which the window's first frame arrived, in seconds. */
398
+ jobWindowStart = 0;
399
+ /** The sketch time at which the sketch thread times its parallel loops again, while they pause. */
400
+ jobPauseUntil = -1;
401
+ /** Whether the core times the parallel loops that the sketch thread hands out. */
402
+ timingHanded = true;
403
+ core;
404
+ reported = new Set();
405
+ /** True once the frame in progress has reported an error: its update did not run to its end. */
406
+ updateFailed = false;
407
+ /** True while a frame is open, so an error outside one does not mark the next frame. */
408
+ frameOpen = false;
409
+ /** When the current phase of the frame started. */
410
+ phaseStart = 0;
411
+ /** The last phase that the frame in progress ended, which names where a hold stopped. */
412
+ lastPhase;
413
+ /** True while hold mode steps the sketch: the first failure then stops it. */
414
+ holding = false;
415
+ /** Gives the thread its own Math.random back, after hold mode seeded it. */
416
+ restoreRandom;
417
+ input;
418
+ quality;
419
+ /** The sketch's textures, whose memory budget each frame looks at. */
420
+ textures;
421
+ /**
422
+ * The frame-budget governor, which moves the render scale and the shadow settings during play.
423
+ * In hold mode it takes no step, and the settings apply as set.
424
+ */
425
+ governor = new Governor();
426
+ /** The governor's part of the frame loop; none in hold mode. */
427
+ governorLoop;
428
+ /**
429
+ * The GPU's time for each frame that it finished, which GPU occlusion culling's check compares
430
+ * with its passes on and off; none without GPU occlusion culling.
431
+ */
432
+ frameTimes;
433
+ /** The governor's count of changes when the core last took the settings that its steps move. */
434
+ stepChanges = 0;
435
+ /** The governor's count of tier changes when the sketch last took the tier's settings. */
436
+ tierChanges = 0;
437
+ /** The settings that the tier replaced, to give back when it leaves, or undefined outside it. */
438
+ tierRestore;
439
+ /** The budgets' count of changes when the governor last took the steps that they allow. */
440
+ budgetChanges = 0;
441
+ /** The sketch's post-processing settings, which say whether bloom is on. */
442
+ post;
443
+ render;
444
+ /** True while the sketch has bloom on, as the governor knows it. */
445
+ bloomOn = false;
446
+ /** The base of bloom's chain that the `bloomSize` setting gives. */
447
+ bloomSetting = 0;
448
+ /** The `followMovingCasters` setting, which the governor's shadow steps keep. */
449
+ followMovers = true;
450
+ /** The `shadowCascadeBlend` setting, which the governor's shadow steps keep. */
451
+ cascadeBlend = 0;
452
+ /** The settings of the levels of detail, which the governor's detail steps keep. */
453
+ lodThreshold = 1;
454
+ lodShadowThreshold = 1;
455
+ lodFade = true;
456
+ /** Asks the thread that draws for the shader files that the sketch will use. */
457
+ preloads;
458
+ /** True while the sketch has ambient occlusion on, as the governor knows it. */
459
+ aoOn = false;
460
+ /** The scale of ambient occlusion's targets that the `aoScale` setting gives, in thousandths. */
461
+ aoSetting = 0;
462
+ /** True while ambient occlusion draws: the sketch has it on, and its scale is above 0. */
463
+ aoDrawn = false;
464
+ /** True while the sketch has screen-space reflections on, as the governor knows it. */
465
+ ssrOn = false;
466
+ /** The scale of the reflections' grid that the `ssrScale` setting gives, in thousandths. */
467
+ ssrSetting = 0;
468
+ /** The most steps of the reflections' march that the `ssrSteps` setting gives. */
469
+ ssrStepSetting = 0;
470
+ /** True while screen-space reflections draw: the sketch has them on, and their scale is above 0. */
471
+ ssrDrawn = false;
472
+ /**
473
+ * True once the core draws HDR color for an effect or the subsurface blur, on a device that
474
+ * started on the 8-bit path.
475
+ */
476
+ hdrForEffects = false;
477
+ /** The anti-aliasing mode that the device draws with now, which is at most the start's. */
478
+ canvasAntialias = 0;
479
+ /** True while the scene's fog is volumetric, as the governor knows it. */
480
+ fogOn = false;
481
+ /** The volumetric fog's slices that the `fogSlices` setting gives. */
482
+ fogSetting = 0;
483
+ /** The render scale in thousandths where the governor does not move it: the highest. */
484
+ heldScale = FULL_SCALE;
485
+ /** The sketch's debug drawing, in development builds only, which is also its `ctx.debug`. */
486
+ debugDraw;
487
+ /**
488
+ * The development build's inspection channel, which the in-page inspector and the MCP server
489
+ * call. A release build holds none of it.
490
+ */
491
+ channel;
492
+ /** The sketch's labels, which each frame projects. */
493
+ ui;
494
+ /** True once the sketch thread has warned that the grid cells ran out. */
495
+ cellsWarned = false;
496
+ /** What a timed script's steps gave, once hold mode has performed them. */
497
+ scriptResult;
498
+ /** The recording of this session, while the page records one. */
499
+ recorder;
500
+ /** The frames that this session replays, when the page gave a recording instead of a page to play. */
501
+ replayProgram;
502
+ /** What a replay gave, once its frames ran. */
503
+ replayResult;
504
+ /** True while a replay's frames run, so each frame reads the input that the replay wrote. */
505
+ replaying = false;
506
+ /** True when the page records this session's frames and input. */
507
+ records;
508
+ /**
509
+ * True when the session runs fixed frames rather than the page's: hold mode, which steps to a
510
+ * time, or a replay, which steps through a recording.
511
+ */
512
+ holdsFrames;
513
+ /**
514
+ * True while the preset check measures the frames of play. The governor waits until it ends, so
515
+ * the check measures each preset at the full render scale.
516
+ */
517
+ checking = false;
518
+ /**
519
+ * The refresh rate that the thread that draws measured when the sketch's setup returned, before
520
+ * the frames of play loaded the GPU, or 0 before it measured one. The preset check's target and
521
+ * the governor's start from it.
522
+ */
523
+ setupRefreshHz = 0;
524
+ context;
525
+ /**
526
+ * Starts the engine on the core's thread. `holdSeconds` starts hold mode at that sketch time: it
527
+ * seeds this thread's math.random, and routes Math.random to it, at once. So the runner must
528
+ * exist before the sketch module loads, and `setup` then steps the sketch to that time.
529
+ * `holdScript` gives hold mode the input steps, property writes and dumps to perform as it steps.
530
+ */
531
+ constructor(post, metrics, sketch, holdSeconds, holdScript, replay, record = false, debugView) {
532
+ this.metrics = metrics;
533
+ this.sketch = sketch;
534
+ this.holdSeconds = holdSeconds;
535
+ this.holdScript = holdScript;
536
+ this.replayProgram = replay;
537
+ this.records = record;
538
+ this.holdsFrames = holdSeconds !== undefined || replay !== undefined;
539
+ this.record = new FrameRecorder(metrics, Role.Sketch);
540
+ this.jobRecords = Array.from({ length: sketch.jobWorkers }, (_, k) => new FrameRecorder(metrics, Role.Job + k));
541
+ const { glue, device } = sketch;
542
+ const { slots } = sketch.control;
543
+ this.canvasAntialias = device.antialias;
544
+ glue.setMemoryMaximum(device.memoryMaximumMiB ?? 0);
545
+ const status = glue.initEngine(sketch.jobWorkers, device.expectedObjects, MAX_BATCHES, COMMAND_CAPACITY, device.storageBindingBytes, device.webgl2, device.capabilities, device.maxTextureSize, device.sceneColor, device.antialias, device.transparent, device.cellCulling, device.depthPrepass, device.prepassColor, device.skinning, device.indexInstances, device.largeWorld, device.gpuOcclusion, device.directDraws, device.shadowDepthBits);
546
+ if (status !== 0)
547
+ throw coreFailure(glue, 'createEngine');
548
+ if (glue.allowMotion(...device.motionTargets) !== 0)
549
+ throw coreFailure(glue, 'createEngine');
550
+ this.core = new CoreMemory(glue, sketch.memory, glue.arraysMovedAddress());
551
+ const { shadowTiles, shadowTileSize, pointLightShadows, shadowCascades, shadowMapSize, heroTileSize, morphTargets, } = sketch.quality.settings;
552
+ glue.setShadowTiles(shadowTiles, shadowTileSize, pointLightShadows);
553
+ glue.setMorphTargets(morphTargets);
554
+ if (device.occlusionBuffer > 0)
555
+ glue.setOcclusionBuffer(device.occlusionBuffer);
556
+ if (device.gpuOcclusion)
557
+ glue.setOcclusionReadSlot(Slot.OcclusionRead);
558
+ if (device.gpuOcclusion && !device.occlusionCheck)
559
+ glue.holdOcclusionCheck(true);
560
+ this.frameTimes = device.gpuOcclusion ? new RingFrames(metrics, Role.Completion) : undefined;
561
+ // Directional lights that name no cascades, map size or hero tile size take the preset's.
562
+ const values = this.core.callValues();
563
+ values[0] = shadowCascades;
564
+ glue.setLightDefault(LIGHT_VALUE_SHADOW_CASCADES);
565
+ values[0] = shadowMapSize;
566
+ glue.setLightDefault(LIGHT_VALUE_SHADOW_MAP_SIZE);
567
+ values[0] = heroTileSize;
568
+ glue.setLightDefault(LIGHT_VALUE_HERO_SIZE);
569
+ if (sketch.jobWorkers > 0) {
570
+ // The page ends the job workers' loops through these words when the engine stops, and
571
+ // lets them run the browser's measurement of its memory through the yield word.
572
+ Atomics.store(slots, Slot.JobsWakeAddress, glue.jobsWakeAddress());
573
+ Atomics.store(slots, Slot.JobsStopAddress, glue.jobsStopAddress());
574
+ Atomics.store(slots, Slot.JobsYieldAddress, glue.jobsYieldAddress());
575
+ Atomics.store(slots, Slot.JobsReady, 1);
576
+ Atomics.notify(slots, Slot.JobsReady);
577
+ }
578
+ this.reducedMotion = Atomics.load(slots, Slot.ReducedMotion);
579
+ this.input = new InputReader(sketch.control, sketch.keyCodes);
580
+ const textures = new Textures(this.core, sketch.sendImage, this.time, device.capabilities, () => this.quality.own('uploadBytesPerFrame'), (id) => imagesArrived(slots, id), device.webgl2, device.derivedCache, () => this.quality.own('textureMemoryMiB'), post);
581
+ // The core takes every texture setting of the preset before the setup runs, so a sketch's own
582
+ // budget wins until the setting changes. The page applies the settings it owns.
583
+ textures.applyQuality(sketch.quality.settings, SKETCH_SETTINGS);
584
+ // The page's own setting, which is not one of the preset's: it keeps the copies that bring
585
+ // each texture's map back after the GPU is lost.
586
+ glue.setTextureOption(TEXTURE_OPTION_KEEP_COPIES, sketch.quality.keepCopies === true ? 1 : 0);
587
+ // A device that draws on the CPU keeps the whole render scale once a step below it failed:
588
+ // its two-step upscale costs about what the smaller scene saves (D-237).
589
+ this.governor.setSoftware(device.softwareRenderer);
590
+ // The page's `?tier=off` switch keeps the tier out, which a test that measures the presets
591
+ // asks for.
592
+ this.governor.setLowestTier(sketch.quality.lowestAllowed !== false);
593
+ this.governorLoop =
594
+ holdSeconds === undefined
595
+ ? new GovernorLoop(this.governor, metrics, {
596
+ shadowCasters: () => glue.shadowCasters(),
597
+ hasLevels: () => glue.hasLevels() !== 0,
598
+ loading: () => glue.textureStat(TEXTURE_STAT_WAITING, 0) > 0,
599
+ }, sketch.maxTargetFps)
600
+ : undefined;
601
+ // Alpha to coverage fades a mask's edges only on targets with MSAA.
602
+ this.preloads = new ShaderPreloads(sketch.sendPreload);
603
+ this.preloads.setUsable('coverage', device.antialias === ANTIALIAS_MSAA);
604
+ this.preloads.setPassFacts({
605
+ tier: sketch.capabilities.tier,
606
+ device,
607
+ settings: () => this.quality.settings,
608
+ });
609
+ const { governor } = this;
610
+ const bloomSize = () => this.bloomSetting / 2 ** governor.bloomHalvings;
611
+ this.quality = new SketchQuality(sketch.quality, (update, changed) => {
612
+ this.applyFrameSettings(update.settings);
613
+ textures.applyQuality(update.settings, changed);
614
+ sketch.applyQuality(update);
615
+ // A preset or the sketch gives the settings their own values again, and the tier
616
+ // keeps its cuts.
617
+ if (this.governor.lowest)
618
+ this.applyTierSettings();
619
+ }, () => this.settle(true), () => this.renderScale() / FULL_SCALE, {
620
+ get steps() {
621
+ return governor.steps;
622
+ },
623
+ get farCascadeInterval() {
624
+ return governor.farInterval;
625
+ },
626
+ get shadowFilter() {
627
+ return governor.filter;
628
+ },
629
+ get bloomSize() {
630
+ return bloomSize();
631
+ },
632
+ get aoScale() {
633
+ return governor.aoScale / FULL_SCALE;
634
+ },
635
+ get ssrScale() {
636
+ return governor.ssrScale / FULL_SCALE;
637
+ },
638
+ get contactShadowSteps() {
639
+ return governor.contactSteps;
640
+ },
641
+ get farAnimationInterval() {
642
+ return governor.animationInterval;
643
+ },
644
+ get lowest() {
645
+ return governor.lowest;
646
+ },
647
+ }, textures.memory);
648
+ this.textures = textures;
649
+ if (sketch.quality.lowest === true) {
650
+ // The page started in the tier, so the settings carry its values already. Remember the
651
+ // preset's, which the governor gives back when the frames have room for its window.
652
+ const { preset } = sketch.quality;
653
+ const path = sketch.capabilities.tier;
654
+ this.governor.startLowest(thousandths(presetValue('minRenderScale', preset, path)), thousandths(presetValue('maxRenderScale', preset, path)));
655
+ this.tierRestore = tierRestoreSettings(presetSettings(preset, {}, path));
656
+ this.tierChanges = this.governor.tierChanges;
657
+ }
658
+ this.applyFrameSettings(this.quality.settings);
659
+ this.readViewport();
660
+ const host = {
661
+ showStats: sketch.showStats,
662
+ metrics,
663
+ threads: sketch.threads,
664
+ sources: {
665
+ tier: sketch.capabilities.tier,
666
+ preset: () => this.quality.preset,
667
+ renderScaleThousandths: () => this.renderScale(),
668
+ wasmBytes: () => this.core.bytes,
669
+ },
670
+ };
671
+ const templates = new ShaderTemplates(sketch.sendShader, device.webgl2 ? 'glsl' : 'wgsl', sketch.sendBuilds, device.shaderBits & (PERMUTATION_DRAW_INDEX | PERMUTATION_TONE_MAP));
672
+ sketch.onAskBuilds((template, set) => templates.answer(template, set));
673
+ const materials = new Materials(this.core, templates, this.preloads);
674
+ const geometry = new Geometry(this.core);
675
+ const scene = new Scene(this.core, this.recorded, device.webgl2, () => this.warmUp(), new FrameCameras(this.core, sketch.control, this.input), { geometry, materials }, this.input);
676
+ geometry.users = scene;
677
+ scene.probeHost = {
678
+ sendGenerator: (id) => textures.sendProbeGenerator(id),
679
+ floatTargets: device.occlusionTargets,
680
+ time: this.recorded,
681
+ };
682
+ this.post = new Post(this.core, device.effectsSceneColor !== FORMAT_CANVAS, device.occlusionTargets, materials.shaders, templates, device.joinEffects, new GradeTable(textures), this.quality);
683
+ this.render = new Render(this.core, scene, materials.shaders, templates, textures.maxSize, device.webgl2);
684
+ // A pass's target has the scene color's format: 8-bit color only on the 8-bit path.
685
+ textures.passFormat = device.sceneColor === FORMAT_CANVAS ? 'rgba8unorm' : 'rgba16float';
686
+ this.ui = new Ui(controlLabels(slots.buffer), scene, this.core, scene.frameCameras, sketch.sendLabelSlot);
687
+ this.debugDraw = DEV ? new DebugDraw(this.core, host, scene) : undefined;
688
+ // The page's ?view switch applies before the sketch's setup, so a sketch that never calls
689
+ // debug.view still draws the view. A feature that registers an add-on view during the setup
690
+ // starts it when it registers.
691
+ if (debugView !== undefined)
692
+ this.debugDraw?.requestView(debugView);
693
+ const debug = this.debugDraw ?? new SketchDebug(host);
694
+ if (DEV) {
695
+ // The channel reads the scene, the render passes and the quality settings that the
696
+ // inspector changes, and outlines the object that it selects.
697
+ const channel = new DebugChannel({
698
+ scene,
699
+ render: this.render,
700
+ quality: this.quality,
701
+ debug,
702
+ debugDraw: this.debugDraw,
703
+ info: () => ({
704
+ tier: sketch.capabilities.tier,
705
+ preset: this.quality.preset,
706
+ renderScale: this.renderScale() / FULL_SCALE,
707
+ }),
708
+ });
709
+ this.channel = channel;
710
+ this.inspect = (call, args) => channel.inspect(call, args);
711
+ }
712
+ const holdsFrames = this.holdsFrames;
713
+ this.context = {
714
+ time: this.time,
715
+ engine: {
716
+ viewport: this.viewport,
717
+ capabilities: sketch.capabilities,
718
+ held: this.holdsFrames,
719
+ firstFrame: new Promise((resolve) => {
720
+ this.firstFrameReached = resolve;
721
+ }),
722
+ },
723
+ scene,
724
+ materials,
725
+ geometry,
726
+ textures,
727
+ assets: lazyAssets(textures, sketch.pageUrl, { core: this.core, geometry, materials, scene }, () => this.listed, () => this.watchesLoads, this.holdsFrames),
728
+ input: this.input,
729
+ post: this.post,
730
+ render: this.render,
731
+ ui: this.ui,
732
+ quality: this.quality,
733
+ preferences: {
734
+ get reducedMotion() {
735
+ return !holdsFrames && Atomics.load(slots, Slot.ReducedMotion) !== 0;
736
+ },
737
+ onChange: (handler) => {
738
+ this.preferenceHandlers.add(handler);
739
+ return () => this.preferenceHandlers.delete(handler);
740
+ },
741
+ },
742
+ page: {
743
+ post: (type, data, transfer) => post(type, data, transfer),
744
+ onMessage: (handler) => {
745
+ this.messageHandlers.add(handler);
746
+ return () => this.messageHandlers.delete(handler);
747
+ },
748
+ },
749
+ debug,
750
+ };
751
+ // A page that started the engine with `input: false` writes no input. A development build
752
+ // says so, once for each kind, when the sketch relies on it.
753
+ if (DEV && Atomics.load(slots, Slot.InputOff) !== 0) {
754
+ const notes = new InputOffNotes();
755
+ this.input.inputOffNotes = notes;
756
+ noteInputReads(this.context, notes);
757
+ // The controls read the input, whenever the sketch loads them: in its module, in its
758
+ // setup, or later.
759
+ this.stopAddonNotes = sketch.hearAddons?.((name) => {
760
+ if (name === '@null3d/controls')
761
+ notes.note('controls');
762
+ });
763
+ }
764
+ // Last, so a constructor that fails leaves the thread's own Math.random in place.
765
+ const seed = holdSeconds !== undefined
766
+ ? HOLD_SEED
767
+ : (replay?.seed ?? (record ? RECORDING_SEED : undefined));
768
+ if (seed !== undefined)
769
+ this.restoreRandom = seedMathRandom(seed);
770
+ // The level plans that the setup starts hand over their levels when the hold begins, in the
771
+ // order they started, so the scene's meshes sit in engine memory in one order on every run.
772
+ // Last too, so a constructor that fails leaves the plans handing over as they answer.
773
+ if (holdSeconds !== undefined)
774
+ holdPlans();
775
+ }
776
+ /**
777
+ * Runs the sketch's setup function, which returns the sketch's callbacks. When the page asks for
778
+ * the preset check before play, the check follows, and the setup resolves after it. When it asks
779
+ * for the check during play, the check starts as the setup resolves, and measures the frames
780
+ * that the frame loop draws from then on. In hold mode, it then steps the sketch to the held time
781
+ * (see `hold`). Options out of range fail with E1214 before the setup function runs. A live
782
+ * start's listed files are downloading by then; hold mode, a replay and a recording leave each
783
+ * file to its load, so their order stays as without the list.
784
+ */
785
+ async setup(sketch) {
786
+ const { options } = sketch;
787
+ try {
788
+ this.fixed = new FixedClock(options.fixedRate, options.maxFixedSteps);
789
+ // A sketch whose own thread limits its frames keeps the governor out of the lowest tier:
790
+ // its smaller render cannot speed the sketch work, so the cut only loses the picture.
791
+ if (options.lowestTier === false)
792
+ this.governor.setLowestTier(false);
793
+ const live = !this.holdsFrames && !this.records;
794
+ if (options.downloads !== undefined) {
795
+ const { pageUrl, listed = {} } = this.sketch;
796
+ listedAddresses(options.downloads, pageUrl);
797
+ if (live) {
798
+ startListedFiles(listed, sketch, pageUrl);
799
+ this.listed = listed.downloads;
800
+ }
801
+ }
802
+ // The setup grows the scene, and a page that stalls here reports the time it spent doing it.
803
+ this.record.markSetupStart();
804
+ const growing = performance.now();
805
+ // The development warning watches the setup function's own loads. A setup that fails ends
806
+ // the start, so the watch needs no end of its own then.
807
+ if (DEV)
808
+ this.watchesLoads = live && options.serialLoadWarning !== false;
809
+ this.callbacks = (await sketch.setup(this.context)) ?? {};
810
+ if (DEV)
811
+ this.watchesLoads = false;
812
+ this.record.markSetupDone(performance.now() - growing);
813
+ this.setupRefreshHz = refreshRate(this.metrics);
814
+ this.governorLoop?.startTarget(this.setupRefreshHz);
815
+ const check = this.holdsFrames ? undefined : this.sketch.quality.check;
816
+ if (check === 'before-play')
817
+ await this.checkPreset(() => this.drawSetupFrame());
818
+ // Warm-ups that the setup started without waiting for them publish their frames first, so
819
+ // the frame loop never records while a setup frame does.
820
+ await this.setupFrames;
821
+ if (this.records) {
822
+ // The format's code loads only for a session that records one, so a page that records
823
+ // nothing downloads none of it.
824
+ const { Recorder: Recording } = await import('../shared/recording.js');
825
+ this.recorder = new Recording(RECORDING_SEED, this.sketch.keyCodes);
826
+ this.input.recorder = this.recorder;
827
+ }
828
+ this.setUp = true;
829
+ if (check === 'during-play')
830
+ void this.checkDuringPlay();
831
+ if (this.holdSeconds !== undefined)
832
+ await this.hold(this.holdSeconds);
833
+ else if (this.replayProgram !== undefined)
834
+ await this.replay(this.replayProgram);
835
+ // Hold mode and a replay record no frame after their last, so the sketch's `firstFrame`
836
+ // work can no longer change the frames that they show.
837
+ if (this.holdsFrames)
838
+ this.reachFirstFrame();
839
+ }
840
+ catch (error) {
841
+ // A setup that fails, at any step, leaves no runner to dispose, so the runner stops hearing
842
+ // add-ons now.
843
+ if (DEV)
844
+ this.stopAddonNotes?.();
845
+ throw error;
846
+ }
847
+ }
848
+ /**
849
+ * The preset check during play: the frame loop draws the scene and runs the sketch, and the
850
+ * check measures its frames. The governor waits until the check ends. A preset that the sketch
851
+ * asks for itself ends the check, which then reports no result: the sketch chose its preset.
852
+ */
853
+ async checkDuringPlay() {
854
+ const { slots } = this.sketch.control;
855
+ const { quality } = this;
856
+ const requests = quality.presetRequests;
857
+ this.checking = true;
858
+ try {
859
+ await this.checkPreset(async () => {
860
+ if (Atomics.load(slots, Slot.Running) === 0)
861
+ return false;
862
+ await reached(slots, Slot.FramesTaken, nextFrame(Atomics.load(slots, Slot.FramesTaken)));
863
+ return Atomics.load(slots, Slot.Running) !== 0 && quality.presetRequests === requests;
864
+ });
865
+ }
866
+ finally {
867
+ this.checking = false;
868
+ }
869
+ }
870
+ /**
871
+ * The preset check, after the setup: the first frame draws with every pipeline built, then the
872
+ * check measures the scene, and lowers the preset where the device cannot hold its frame rate.
873
+ * `drawFrame` resolves once the thread that draws has taken one more frame: a frame that it
874
+ * publishes of the scene as the setup built it, before play, or the frame loop's next frame,
875
+ * during play. It resolves with false when the check must stop. The check's code loads after the
876
+ * first frame, while the scene keeps drawing. A check that cannot load leaves the preset as it
877
+ * is. It goes on from the rounds that an earlier start measured before its check ended, when the
878
+ * page gives them. While the engine runs, the page hears of each lowering with the rounds so
879
+ * far, and that the check ended, with its result when it measured one.
880
+ */
881
+ async checkPreset(drawFrame) {
882
+ let check;
883
+ try {
884
+ check = await this.measurePreset(drawFrame);
885
+ }
886
+ catch (error) {
887
+ console.warn(`null3D could not check the quality preset: ${messageOf(error)}`);
888
+ }
889
+ if (this.core.stopped || Atomics.load(this.sketch.control.slots, Slot.Running) === 0)
890
+ return;
891
+ try {
892
+ this.quality.report(check);
893
+ }
894
+ catch (error) {
895
+ console.warn(`null3D could not report the quality preset check: ${messageOf(error)}`);
896
+ }
897
+ }
898
+ /**
899
+ * Runs the preset check with `drawFrame`, as `checkPreset` says, once the thread that draws has
900
+ * built the pipelines that the scene needs; undefined when it stopped.
901
+ */
902
+ async measurePreset(drawFrame) {
903
+ await this.warmUp();
904
+ if (!(await drawFrame()))
905
+ return undefined;
906
+ const loading = import('./preset-check.js');
907
+ let loaded = false;
908
+ const settled = () => {
909
+ loaded = true;
910
+ };
911
+ loading.then(settled, settled);
912
+ while (!loaded)
913
+ if (!(await drawFrame()))
914
+ return undefined;
915
+ const { glue, maxTargetFps } = this.sketch;
916
+ const { quality } = this;
917
+ const { checkPreset, checkStart } = await loading;
918
+ return checkPreset({
919
+ metrics: this.metrics,
920
+ get preset() {
921
+ return quality.preset;
922
+ },
923
+ lower: (check, to) => quality.lower(check, to),
924
+ drawFrame,
925
+ uploading: () => glue.textureStat(TEXTURE_STAT_WAITING, 0) > 0,
926
+ maxTargetFps,
927
+ resumes: () => Atomics.load(this.sketch.control.slots, Slot.Resumes),
928
+ }, checkStart(quality.preset, this.setupRefreshHz, maxTargetFps, this.sketch.quality.resume));
929
+ }
930
+ /** Resolves the sketch's `engine.firstFrame`, once. */
931
+ reachFirstFrame() {
932
+ this.firstFrameReached?.();
933
+ this.firstFrameReached = undefined;
934
+ }
935
+ /** True once the setup function has returned, so the frame loop may step the sketch. */
936
+ get started() {
937
+ return this.setUp;
938
+ }
939
+ /**
940
+ * Resolves once the thread that draws has built every pipeline that the scene needs as it
941
+ * stands. The next frame that the sketch records creates each pipeline the GPU lacks, and the
942
+ * thread that draws reports each frame whose pipelines are built. The setup has no frame loop,
943
+ * so there a warm-up records that frame itself. Hold mode draws one frame, which waits for its
944
+ * pipelines, so there a warm-up resolves at once.
945
+ */
946
+ warmUp() {
947
+ return this.settle(false);
948
+ }
949
+ /**
950
+ * Resolves once the next frame's pipelines are built, as `warmUp` describes, and with `drawn`,
951
+ * once the thread that draws has taken that frame too, so the targets it makes exist.
952
+ */
953
+ async settle(drawn) {
954
+ if (this.holdsFrames)
955
+ return;
956
+ const { slots } = this.sketch.control;
957
+ const target = this.setUp ? nextFrame(this.recorded.frame) : await this.queueSetupFrame();
958
+ await reached(slots, Slot.PipelinesBuilt, target);
959
+ if (drawn)
960
+ await reached(slots, Slot.FramesTaken, target);
961
+ }
962
+ /** Publishes a setup frame after those already queued, and resolves with its number. */
963
+ queueSetupFrame() {
964
+ this.setupFrames = this.setupFrames.then(() => this.publishSetupFrame());
965
+ return this.setupFrames;
966
+ }
967
+ /**
968
+ * Publishes a setup frame and waits until the thread that draws has taken it. Resolves with
969
+ * false when the engine stopped first.
970
+ */
971
+ async drawSetupFrame() {
972
+ const { slots } = this.sketch.control;
973
+ if (Atomics.load(slots, Slot.Running) === 0)
974
+ return false;
975
+ await reached(slots, Slot.FramesTaken, await this.queueSetupFrame());
976
+ return Atomics.load(slots, Slot.Running) !== 0;
977
+ }
978
+ /**
979
+ * Records a frame of the scene as the setup has built it so far, with no update, and publishes
980
+ * it for the thread that draws. The frame before the last shares its list. The thread that
981
+ * draws marks a frame taken before it replays the frame's list, so that list is free only once
982
+ * the last frame is taken, as in the frame loop.
983
+ */
984
+ async publishSetupFrame() {
985
+ const { slots } = this.sketch.control;
986
+ while (frameAfter(this.recorded.frame, Atomics.load(slots, Slot.FramesTaken)) &&
987
+ Atomics.load(slots, Slot.Running) !== 0)
988
+ await reached(slots, Slot.FramesTaken, this.recorded.frame);
989
+ const frame = this.frame(false);
990
+ Atomics.store(slots, Slot.FramesPublished, frame);
991
+ Atomics.notify(slots, Slot.FramesPublished);
992
+ return frame;
993
+ }
994
+ /**
995
+ * Ends the sketch when the engine stops: runs its onDestroy, then makes every later call to the
996
+ * engine fail with E1420, so code that outlives the engine never reaches the next engine's core.
997
+ * It also gives the thread its own Math.random back, where hold mode seeded it, and ends hold
998
+ * mode's hold on the level plans, for a setup that failed before its hold.
999
+ */
1000
+ dispose() {
1001
+ // Before the check below: a runner whose core stopped first still lets go of the channel,
1002
+ // which holds the scene and its memory.
1003
+ this.inspect = undefined;
1004
+ this.channel = undefined;
1005
+ // Before the check below: a runner whose core stopped first still stops hearing add-ons.
1006
+ if (DEV)
1007
+ this.stopAddonNotes?.();
1008
+ if (this.core.stopped)
1009
+ return;
1010
+ try {
1011
+ this.callbacks.onDestroy?.();
1012
+ }
1013
+ catch (error) {
1014
+ console.error(error);
1015
+ }
1016
+ this.context.scene.stopPicks();
1017
+ this.render.stopReads();
1018
+ this.core.stop();
1019
+ stopHelperWorkers();
1020
+ this.restoreRandom?.();
1021
+ this.restoreRandom = undefined;
1022
+ endPlanHold();
1023
+ }
1024
+ /**
1025
+ * Delivers a message the page sent with engine.postToSketch. It arrives between frames. A
1026
+ * video's frame goes to the texture that follows the video, and never to the sketch's handlers.
1027
+ */
1028
+ receive(type, data) {
1029
+ if (type === VIDEO_FRAME) {
1030
+ this.context.textures.receiveVideoFrame(data);
1031
+ return;
1032
+ }
1033
+ for (const handler of this.messageHandlers)
1034
+ handler(type, data);
1035
+ }
1036
+ /** Swaps the shaders of the sketch's custom materials that hot updates of WGSL name. */
1037
+ updateShaders(updates) {
1038
+ this.context.materials.updateShaders(updates);
1039
+ }
1040
+ /** Reads the canvas's size into the viewport, when the page wrote a new one. */
1041
+ readViewport() {
1042
+ const { slots, slotFloats } = this.sketch.control;
1043
+ const serial = Atomics.load(slots, Slot.ResizeSerial);
1044
+ if (serial === this.viewportSerial)
1045
+ return;
1046
+ this.viewportSerial = serial;
1047
+ const viewport = this.viewport;
1048
+ viewport.width = slotFloats[Slot.CanvasCssWidth];
1049
+ viewport.height = slotFloats[Slot.CanvasCssHeight];
1050
+ viewport.pixelRatio = slotFloats[Slot.PixelRatio];
1051
+ this.core.callValues()[0] = viewport.pixelRatio;
1052
+ this.sketch.glue.setPixelRatio();
1053
+ }
1054
+ /**
1055
+ * Records the time since the previous phase ended as a phase of the frame. The time is added
1056
+ * here rather than passed to the recorder: a double handed to a call costs an allocation that
1057
+ * the allocation check counts, and a frame ends eight phases.
1058
+ */
1059
+ endPhase(phase) {
1060
+ const now = performance.now();
1061
+ const floats = this.record.phaseFloats();
1062
+ const at = this.record.phaseIndex(phase);
1063
+ floats[at] = floats[at] + (now - this.phaseStart);
1064
+ this.phaseStart = now;
1065
+ this.lastPhase = PHASE_NAMES[phase];
1066
+ }
1067
+ /**
1068
+ * Reports a failure in the sketch or the core, logging each distinct message once so a repeating
1069
+ * one does not flood the console. A live engine carries on; hold mode stops at the first one.
1070
+ */
1071
+ report(error) {
1072
+ const message = messageOf(error);
1073
+ if (this.frameOpen)
1074
+ this.updateFailed = true;
1075
+ if (!this.reported.has(message)) {
1076
+ this.reported.add(message);
1077
+ this.channel?.recordError(message);
1078
+ console.error(error);
1079
+ this.sketch.reportSketchError?.(message);
1080
+ }
1081
+ if (this.holding)
1082
+ throw error;
1083
+ }
1084
+ /** The render scale of the frame being drawn, in thousandths. */
1085
+ /**
1086
+ * Writes the two-step pass's answers for the frame that just recorded into the control block,
1087
+ * where the page's probe reads them: whether the frame wanted the pass, declared it, had its
1088
+ * second step built and drew it, and the render scale in thousandths.
1089
+ */
1090
+ reportTwoStep() {
1091
+ const { glue, memory, control } = this.sketch;
1092
+ if (!this.twoStepAsked) {
1093
+ this.twoStepAsked = true;
1094
+ glue.setDebugTwoStep(true);
1095
+ }
1096
+ const at = glue.debugTwoStep();
1097
+ if (at === 0)
1098
+ return;
1099
+ const answers = new MemoryViews(memory).view(Int32Array, at, 5);
1100
+ for (let k = 0; k < 5; k++)
1101
+ Atomics.store(control.slots, Slot.TwoStepWanted + k, answers[k]);
1102
+ }
1103
+ renderScale() {
1104
+ return this.governorLoop ? this.governor.scale : this.heldScale;
1105
+ }
1106
+ /**
1107
+ * Adds a frame's parallel work to the window, and at the window's end asks the page for twice
1108
+ * the `asked` job workers, and at least 2, when the frames handed out enough work to share.
1109
+ * The window ends at its frame count, or at its deadline once it holds enough frames, so a
1110
+ * slow GPU asks as a fast one does. After a window with less, the loops go untimed for a
1111
+ * while; once every job worker has been asked for, for good.
1112
+ */
1113
+ growJobs(glue, asked) {
1114
+ if (asked >= this.jobRecords.length) {
1115
+ this.timeHandedLoops(glue, false);
1116
+ return;
1117
+ }
1118
+ if (this.jobPauseUntil >= 0) {
1119
+ if (this.clock.now < this.jobPauseUntil)
1120
+ return;
1121
+ this.jobPauseUntil = -1;
1122
+ this.timeHandedLoops(glue, true);
1123
+ return;
1124
+ }
1125
+ if (this.jobWindowFrames === 0)
1126
+ this.jobWindowStart = this.clock.now;
1127
+ this.jobWindowUs += glue.takeHandedUs();
1128
+ this.jobWindowFrames++;
1129
+ const byFrames = this.jobWindowFrames >= JOB_WINDOW;
1130
+ const byDeadline = this.jobWindowFrames >= JOB_WINDOW_MIN_FRAMES &&
1131
+ this.clock.now - this.jobWindowStart >= JOB_WINDOW_SECONDS;
1132
+ if (!byFrames && !byDeadline)
1133
+ return;
1134
+ const enough = this.jobWindowUs >= JOB_GROW_US * this.jobWindowFrames;
1135
+ this.jobWindowUs = 0;
1136
+ this.jobWindowFrames = 0;
1137
+ if (enough) {
1138
+ this.sketch.wantJobs(Math.max(2, asked * 2));
1139
+ }
1140
+ else {
1141
+ this.jobPauseUntil = this.clock.now + JOB_PAUSE_SECONDS;
1142
+ this.timeHandedLoops(glue, false);
1143
+ }
1144
+ }
1145
+ /** Starts or stops the core's timing of the parallel loops that this thread hands out. */
1146
+ timeHandedLoops(glue, on) {
1147
+ if (this.timingHanded === on)
1148
+ return;
1149
+ this.timingHanded = on;
1150
+ glue.timeHandedLoops(on);
1151
+ }
1152
+ /** Publishes the textures' and meshes' GPU memory for the frame figures on every thread. */
1153
+ publishMemory() {
1154
+ const { record } = this;
1155
+ const textures = this.textures.memory;
1156
+ record.publishMemory(MemoryFigure.TextureBytes, textures.bytes);
1157
+ record.publishMemory(MemoryFigure.TextureBudgetBytes, textures.budgetBytes);
1158
+ record.publishMemory(MemoryFigure.DroppedLevels, textures.droppedLevels);
1159
+ record.publishMemory(MemoryFigure.MeshBytes, this.context.geometry.memoryBytes);
1160
+ if (!DEV)
1161
+ return;
1162
+ const glue = this.sketch.glue;
1163
+ const at = glue.updateMemoryRegister();
1164
+ if (!this.areasChecked) {
1165
+ this.areasChecked = true;
1166
+ // The page names the areas, so a core that reports others would mislabel them.
1167
+ if (glue.memoryAreas() !== MEMORY_AREA_COUNT)
1168
+ console.error(`the core reports ${glue.memoryAreas()} memory areas, not ${MEMORY_AREA_COUNT}`);
1169
+ }
1170
+ if (at !== 0)
1171
+ record.publishMemoryRegister(this.core.heap(Float64Array), at / Float64Array.BYTES_PER_ELEMENT);
1172
+ }
1173
+ /**
1174
+ * Applies the settings that the frames read: gives the governor the render scale's range and
1175
+ * the shadow settings, and tells the core whether the scale can drop below the whole canvas, and
1176
+ * how shadows filter and update after the governor's steps. With the governor off, the range
1177
+ * holds the highest scale alone. Hold mode draws at the highest scale of the range, with the
1178
+ * passes that play draws the range with.
1179
+ */
1180
+ applyFrameSettings(settings) {
1181
+ this.followAntialias(settings);
1182
+ const low = thousandths(settings.minRenderScale);
1183
+ const high = thousandths(settings.maxRenderScale);
1184
+ this.heldScale = high;
1185
+ const { governor } = this;
1186
+ governor.setOn(settings.governor);
1187
+ governor.setLevelSteps(settings.governorLevels);
1188
+ governor.setRange(low, high, this.quality.owns('minRenderScale'));
1189
+ this.followMovers = settings.followMovingCasters;
1190
+ this.cascadeBlend = settings.shadowCascadeBlend;
1191
+ this.lodThreshold = settings.lodThreshold;
1192
+ this.lodShadowThreshold = settings.lodShadowThreshold;
1193
+ this.lodFade = settings.lodFade;
1194
+ this.preloads.setUsable('lod_fade', settings.lodFade);
1195
+ governor.setShadows(settings.shadowFilter, settings.farCascadeInterval, this.followMovers);
1196
+ this.bloomSetting = settings.bloomSize;
1197
+ governor.setBloom(this.bloomOn, this.bloomSetting);
1198
+ this.aoSetting = Math.round(settings.aoScale * FULL_SCALE);
1199
+ governor.setAo(this.aoOn, this.aoSetting);
1200
+ this.ssrSetting = Math.round(settings.ssrScale * FULL_SCALE);
1201
+ this.ssrStepSetting = settings.ssrSteps;
1202
+ governor.setSsr(this.ssrOn, this.ssrSetting);
1203
+ this.fogSetting = settings.fogSlices;
1204
+ governor.setFog(this.fogOn, this.fogSetting);
1205
+ governor.setContact(settings.contactShadowSteps);
1206
+ governor.setAnimation(settings.farAnimationInterval);
1207
+ this.stepChanges = governor.stepChanges;
1208
+ const { glue } = this.sketch;
1209
+ if (glue.setRenderScaling((settings.governor ? low : high) < FULL_SCALE) !== 0 ||
1210
+ glue.setDepthPrepass(settings.depthPrepass) !== 0 ||
1211
+ this.setShadowQuality() !== 0 ||
1212
+ glue.setBloomChain(this.bloomSetting, governor.bloomHalvings) !== 0 ||
1213
+ glue.setAoScale(governor.aoScale) !== 0 ||
1214
+ glue.setSsrQuality(governor.ssrScale, this.ssrStepSetting) !== 0 ||
1215
+ glue.setBounceRays(settings.bounceRays) !== 0 ||
1216
+ glue.setContactSteps(governor.contactSteps) !== 0 ||
1217
+ glue.setDofTaps(settings.dofSamples) !== 0 ||
1218
+ glue.setSubsurfaceTaps(settings.subsurfaceSamples) !== 0 ||
1219
+ glue.setExposureMeter(EXPOSURE_METERS[settings.exposureMeter]) !== 0 ||
1220
+ glue.setFogSlices(settings.fogSlices) !== 0 ||
1221
+ glue.setFogHalvings(governor.fogHalvings) !== 0 ||
1222
+ this.setReflectionScale(settings.reflectionScale) !== 0 ||
1223
+ glue.setProbeSize(settings.probeSize) !== 0 ||
1224
+ glue.setAreaLightCap(settings.areaLights) !== 0 ||
1225
+ glue.setLightFit(settings.lightFit ? 1 : 0) !== 0 ||
1226
+ this.setLevelQuality() !== 0 ||
1227
+ glue.setPhysicalSky(settings.physicalSky) !== 0 ||
1228
+ glue.setCloudSteps(settings.cloudSteps) !== 0 ||
1229
+ glue.setSoftwareOcclusion(settings.softwareOcclusion) !== 0 ||
1230
+ glue.setParallax(settings.parallax) !== 0 ||
1231
+ glue.setMomentTransparency(settings.momentTransparency) !== 0 ||
1232
+ glue.setSoftParticles(settings.softParticles) !== 0)
1233
+ this.report(coreFailure(glue, 'quality.set'));
1234
+ }
1235
+ /**
1236
+ * Moves the canvas to a lighter anti-aliasing mode that a preset asks for. A device fixes its
1237
+ * mode when it starts, so a lower preset keeps the start's MSAA unless the canvas moves: the
1238
+ * preset check lowers a tablet from Medium to Low that way, and MSAA draws the low preset at
1239
+ * twice the cost of its own FXAA. The scene colour draws with either mode, and the frame's
1240
+ * passes and pipelines follow the change. No mode heavier than the start's can begin.
1241
+ */
1242
+ followAntialias(settings) {
1243
+ const wanted = settings.antialias === 'msaa'
1244
+ ? ANTIALIAS_MSAA
1245
+ : settings.antialias === 'fxaa'
1246
+ ? ANTIALIAS_FXAA
1247
+ : ANTIALIAS_NONE;
1248
+ if (wanted === this.canvasAntialias || wanted === ANTIALIAS_MSAA)
1249
+ return;
1250
+ const { device, glue } = this.sketch;
1251
+ this.canvasAntialias = wanted;
1252
+ this.preloads.setUsable('coverage', false);
1253
+ if (glue.setCanvasOutput(device.sceneColor, wanted) !== 0)
1254
+ this.report(coreFailure(glue, 'quality.set'));
1255
+ }
1256
+ /**
1257
+ * Gives the core how the levels of detail are picked: the threshold in pixels and the shadow
1258
+ * maps' threshold in texels, both after the governor's detail steps, and the fading bands.
1259
+ * Returns the core's result: 0 when it took them.
1260
+ */
1261
+ setLevelQuality() {
1262
+ const values = this.core.callValues();
1263
+ values[0] = this.lodThreshold * this.governor.detailFactor;
1264
+ values[1] = this.lodShadowThreshold * this.governor.detailFactor;
1265
+ return this.sketch.glue.setLevelQuality(this.lodFade, this.governor.detailFactor > 1);
1266
+ }
1267
+ /** Gives the core the share of the render size that reflection targets take by default. */
1268
+ setReflectionScale(scale) {
1269
+ this.core.callValues()[0] = scale;
1270
+ return this.sketch.glue.setReflectionScale();
1271
+ }
1272
+ /**
1273
+ * Gives the core the shadow filter and the far cascades' interval after the governor's steps,
1274
+ * whether far cascades follow moving casters, and the blend between cascades. Returns the
1275
+ * core's result: 0 when it took them.
1276
+ */
1277
+ setShadowQuality() {
1278
+ const { governor } = this;
1279
+ this.core.callValues()[0] = this.cascadeBlend;
1280
+ return this.sketch.glue.setShadowQuality(governor.filter, governor.farInterval, this.followMovers);
1281
+ }
1282
+ /**
1283
+ * Gives the core the shadow settings and bloom's base after a step of the governor, and tells
1284
+ * the sketch's change handlers of it. The lowest quality tier's settings come before those
1285
+ * steps, so a step that the tier's cuts allow reads the values that it leaves.
1286
+ */
1287
+ applyGovernedSteps() {
1288
+ const { governor } = this;
1289
+ const { glue } = this.sketch;
1290
+ this.applyTierSettings();
1291
+ this.stepChanges = governor.stepChanges;
1292
+ if (this.setLevelQuality() !== 0 ||
1293
+ this.setShadowQuality() !== 0 ||
1294
+ glue.setBloomChain(this.bloomSetting, governor.bloomHalvings) !== 0 ||
1295
+ glue.setAoScale(governor.aoScale) !== 0 ||
1296
+ glue.setSsrQuality(governor.ssrScale, this.ssrStepSetting) !== 0 ||
1297
+ glue.setContactSteps(governor.contactSteps) !== 0 ||
1298
+ glue.setFogHalvings(governor.fogHalvings) !== 0)
1299
+ this.report(coreFailure(glue, 'the quality governor'));
1300
+ this.quality.governed();
1301
+ }
1302
+ /**
1303
+ * Applies the lowest quality tier's cuts when the governor enters it, and gives the settings
1304
+ * back when it leaves. The sketch's own choice of a preset does not keep them: a preset gives
1305
+ * the settings its own values again.
1306
+ */
1307
+ applyTierSettings() {
1308
+ const { governor, quality } = this;
1309
+ this.tierChanges = governor.tierChanges;
1310
+ const { settings } = quality;
1311
+ // A render-scale floor that the sketch set itself wins over the tier's, in the tier and as it
1312
+ // leaves.
1313
+ const ownFloor = quality.owns('minRenderScale');
1314
+ if (governor.lowest) {
1315
+ this.tierRestore ??= tierRestoreSettings(settings);
1316
+ const cuts = lowestTierCuts(this.sketch.capabilities.tier, settings.minRenderScale);
1317
+ if (ownFloor)
1318
+ delete cuts.minRenderScale;
1319
+ const current = settings;
1320
+ if (Object.entries(cuts).some(([name, value]) => current[name] !== value))
1321
+ void quality.setGoverned(cuts);
1322
+ if (ownFloor)
1323
+ governor.setRange(thousandths(settings.minRenderScale), thousandths(settings.maxRenderScale), true);
1324
+ }
1325
+ else if (this.tierRestore) {
1326
+ const restore = { ...this.tierRestore };
1327
+ this.tierRestore = undefined;
1328
+ if (ownFloor) {
1329
+ delete restore.minRenderScale;
1330
+ restore.maxRenderScale = Math.max(restore.maxRenderScale ?? settings.maxRenderScale, settings.minRenderScale);
1331
+ }
1332
+ void quality.setGoverned(restore);
1333
+ }
1334
+ }
1335
+ /**
1336
+ * Gives the governor the steps that the sketch's budgets allow, and moves the budgets to the
1337
+ * governor's steps of their scale, which calls their `onScale` handlers.
1338
+ */
1339
+ followBudgets() {
1340
+ const { governor } = this;
1341
+ const { budgets } = this.quality;
1342
+ if (budgets.changes !== this.budgetChanges) {
1343
+ this.budgetChanges = budgets.changes;
1344
+ governor.setBudgetSteps(budgets.steps);
1345
+ }
1346
+ if (governor.budgetLevel !== budgets.level)
1347
+ budgets.follow(governor.budgetLevel, this.reportError);
1348
+ }
1349
+ /**
1350
+ * Follows the sketch's effects. Returns true when the frame has new targets and pipelines, so
1351
+ * the thread that draws holds it until they are built, and the frame before stays on screen
1352
+ * meanwhile.
1353
+ */
1354
+ followEffects() {
1355
+ const ao = this.followAo();
1356
+ const ssr = this.followSsr();
1357
+ const bloom = this.followBloom();
1358
+ this.followFog();
1359
+ const custom = this.post.takeNewPipelines();
1360
+ const passes = this.render.takeNewPipelines();
1361
+ return ao || ssr || bloom || custom || passes;
1362
+ }
1363
+ /**
1364
+ * Follows the sketch's screen-space reflections: the governor's step needs them on. Returns true
1365
+ * when they start or stop drawing: the frame adds or removes the depth prepass and the steps.
1366
+ */
1367
+ followSsr() {
1368
+ const on = this.post.ssrOn;
1369
+ if (on !== this.ssrOn) {
1370
+ this.ssrOn = on;
1371
+ this.governor.setSsr(on, this.ssrSetting);
1372
+ }
1373
+ const drawn = on && this.ssrSetting > 0;
1374
+ if (drawn === this.ssrDrawn)
1375
+ return false;
1376
+ this.ssrDrawn = drawn;
1377
+ return true;
1378
+ }
1379
+ /**
1380
+ * Follows the sketch's ambient occlusion: the governor's steps need it on. Returns true when it
1381
+ * starts or stops drawing, either from the setting or from the governor's removal step: the
1382
+ * frame adds or removes the depth prepass and the steps.
1383
+ */
1384
+ followAo() {
1385
+ const on = this.post.aoOn;
1386
+ if (on !== this.aoOn) {
1387
+ this.aoOn = on;
1388
+ this.governor.setAo(on, this.aoSetting);
1389
+ }
1390
+ const drawn = on && this.governor.aoScale > 0;
1391
+ if (drawn === this.aoDrawn)
1392
+ return false;
1393
+ this.aoDrawn = drawn;
1394
+ return true;
1395
+ }
1396
+ /** Follows the scene's volumetric fog, which the governor's fog step needs on. */
1397
+ followFog() {
1398
+ const on = this.context.scene.needsHdr;
1399
+ if (on === this.fogOn)
1400
+ return;
1401
+ this.fogOn = on;
1402
+ this.governor.setFog(on, this.fogSetting);
1403
+ }
1404
+ /**
1405
+ * Follows the sketch's bloom, which the governor's bloom step needs on, and its other effects.
1406
+ * The first time bloom, depth of field, a custom effect, a custom tone curve, a reflection pass
1407
+ * or volumetric fog with slices to draw turns on, or the page or the sketch itself gives the
1408
+ * subsurface blur taps,
1409
+ * on a device that started on the 8-bit path only for MSAA, the core moves to HDR color with
1410
+ * FXAA for the engine's life. A preset's taps alone do not move it. Returns true then: the frame
1411
+ * has new targets and pipelines, so the thread that draws holds it until they are built, and the
1412
+ * frame before stays on screen meanwhile.
1413
+ */
1414
+ followBloom() {
1415
+ const on = this.post.bloomOn;
1416
+ if (on !== this.bloomOn) {
1417
+ this.bloomOn = on;
1418
+ this.governor.setBloom(on, this.bloomSetting);
1419
+ }
1420
+ const { device, glue } = this.sketch;
1421
+ if (this.hdrForEffects || device.sceneColor !== FORMAT_CANVAS)
1422
+ return false;
1423
+ const { quality } = this;
1424
+ const blur = quality.settings.subsurfaceSamples > 0 && quality.chose('subsurfaceSamples');
1425
+ const fog = this.context.scene.needsHdr && this.fogSetting > 0;
1426
+ // The 8-bit path stores a pass's picture tone mapped, and a surface that reflects it tone maps
1427
+ // it again.
1428
+ if (!this.post.needsHdr && !fog && !blur && !this.render.hasReflection)
1429
+ return false;
1430
+ if (device.effectsSceneColor === FORMAT_CANVAS)
1431
+ return false;
1432
+ this.hdrForEffects = true;
1433
+ this.preloads.setUsable('coverage', device.effectsAntialias === ANTIALIAS_MSAA);
1434
+ if (glue.setCanvasOutput(device.effectsSceneColor, device.effectsAntialias) !== 0)
1435
+ this.report(coreFailure(glue, 'post.set'));
1436
+ return true;
1437
+ }
1438
+ /** Calls each of the sketch's handlers with `value`, and reports each error that one throws. */
1439
+ notify(handlers, value) {
1440
+ for (const handler of handlers) {
1441
+ try {
1442
+ handler(value);
1443
+ }
1444
+ catch (error) {
1445
+ this.report(error);
1446
+ }
1447
+ }
1448
+ }
1449
+ /**
1450
+ * Advances the sketch by one frame and returns the new frame number, counting from 1.
1451
+ * `timestamp` is the frame's time in milliseconds.
1452
+ */
1453
+ step(timestamp) {
1454
+ // A live sketch's `firstFrame` resolves at the first step after the GPU finished the first
1455
+ // frame, which the thread that draws records; the check ends once it has.
1456
+ if (this.firstFrameReached !== undefined && !this.holdsFrames && this.record.firstFrameDone)
1457
+ this.reachFirstFrame();
1458
+ const resumes = Atomics.load(this.sketch.control.slots, Slot.Resumes);
1459
+ this.resumed = this.resumes >= 0 && resumes !== this.resumes;
1460
+ this.resumes = resumes;
1461
+ this.clock.advance(timestamp, resumes);
1462
+ return this.frame();
1463
+ }
1464
+ /**
1465
+ * Hold mode: steps the sketch from time 0 to `seconds` in fixed steps, with no frame loop, and
1466
+ * publishes the last frame for the thread that draws. That thread draws none of the earlier
1467
+ * frames, so the last one creates every GPU object and uploads the whole scene, as after a GPU
1468
+ * loss, textures included. It waits for the area lights' tables to load and for every texture
1469
+ * image to reach that thread first. When that frame draws with what the frame before it drew, as
1470
+ * screen-space reflections read the frame before's color, or a reflection probe waits for its
1471
+ * capture, it steps the sketch once more at the
1472
+ * same time, and that thread draws both frames in turn. The first failure in the sketch or the
1473
+ * core stops the hold with E1408.
1474
+ *
1475
+ * A timed script that the page gave is performed alongside the steps: its input events reach the
1476
+ * frame that falls at their time, its property writes land before that frame, and its dumps read
1477
+ * the state after it. A step that fails is recorded and the hold goes on.
1478
+ */
1479
+ async hold(seconds) {
1480
+ const steps = holdSteps(seconds);
1481
+ const { slots } = this.sketch.control;
1482
+ const { glue } = this.sketch;
1483
+ const script = this.holdScript;
1484
+ const scriptSteps = script?.steps ?? [];
1485
+ const keys = new Map(this.sketch.keyCodes.map((code, key) => [code, key]));
1486
+ const dumps = [];
1487
+ const problems = [];
1488
+ let cursor = 0;
1489
+ let frame = 0;
1490
+ let first = 0;
1491
+ let held = 0;
1492
+ this.holding = true;
1493
+ this.time.held = true;
1494
+ this.render.held = true;
1495
+ this.recorded.held = true;
1496
+ try {
1497
+ // The tasks and level plans that the setup started answer whenever the job workers finish
1498
+ // them. The steps start once they all have, and the plans hand over their levels in the
1499
+ // order they started, so the steps and the held frame find the same scene on every run.
1500
+ releasePlans();
1501
+ if (tasksPending() > 0)
1502
+ await this.settleTasks();
1503
+ for (let step = 0; step <= steps; step++) {
1504
+ this.clock.holdStep(step, steps, seconds);
1505
+ const now = this.clock.now;
1506
+ // Input and property writes land before the frame at their time, so the frame reads
1507
+ // them. Dumps wait for it, so they read the state that it gave.
1508
+ this.scriptDumps.length = 0;
1509
+ while (cursor < scriptSteps.length && scriptSteps[cursor].at <= now) {
1510
+ const one = scriptSteps[cursor++];
1511
+ if (one.verb === 'dump')
1512
+ this.scriptDumps.push(one);
1513
+ else
1514
+ this.performScriptStep(one, keys, problems);
1515
+ }
1516
+ // A held frame whose passes read the motion since the frame before it, as the motion
1517
+ // debug view does, has the thread that draws draw the frame before it first.
1518
+ const before = step === steps - 1 && glue.holdsFrameBefore() !== 0;
1519
+ // The thread that draws draws only the frames from the first held one on, so the steps
1520
+ // before it tell the sketch that their GPU work never runs.
1521
+ this.time.drawn = before || step === steps;
1522
+ if (first === 0 && this.time.drawn) {
1523
+ await this.context.scene.imagesSettled();
1524
+ await this.context.scene.areaTablesSettled();
1525
+ // A grading table bakes in a job worker: the held frame waits for the newest
1526
+ // one, so the picture shows the grade that the sketch set.
1527
+ await this.post.gradingSettled();
1528
+ await imagesArrived(slots, glue.textureStat(TEXTURE_STAT_IMAGES_SENT, 0));
1529
+ glue.setTextureOption(TEXTURE_OPTION_UPLOAD_ALL, 1);
1530
+ // Like a new GPU device, the thread that draws has none of the objects that the
1531
+ // earlier frames' lists created, so the first frame that it draws records as it
1532
+ // does after a GPU loss.
1533
+ this.gpuEpoch = -1;
1534
+ }
1535
+ frame = this.frame();
1536
+ if (first === 0 && this.time.drawn)
1537
+ first = frame;
1538
+ for (const one of this.scriptDumps)
1539
+ this.dumpScriptStep(one, dumps, problems);
1540
+ }
1541
+ // A reflection probe captures in one frame and lights surfaces from then on, and the
1542
+ // capture views take one probe a frame, so a second frame at the same time captures the
1543
+ // next. A light's picture copied from a texture shows from the frame after the copy, so
1544
+ // that frame draws the picture too. The thread that draws keeps two frames' lists.
1545
+ held = frame;
1546
+ Atomics.store(slots, Slot.HeldFrom, frame);
1547
+ // A task that the sketch queued in a frame answers between frames, so the last frame that
1548
+ // the loop ran may have drawn what the task had not yet written. Once the tasks settle, one
1549
+ // more frame at the same time draws what they wrote.
1550
+ if (glue.readsLastFrame() !== 0 ||
1551
+ glue.probesWaiting() !== 0 ||
1552
+ glue.lightImagesWaiting() !== 0 ||
1553
+ tasksPending() > 0) {
1554
+ if (tasksPending() > 0)
1555
+ await this.settleTasks();
1556
+ this.clock.holdStep(steps, steps, seconds);
1557
+ // The settle frame draws what the held frame prepared, such as the light that a pass
1558
+ // reads from the frame before. It is no frame of the session, so the sketch's code
1559
+ // does not run again and the held frame keeps its numbers.
1560
+ frame = this.frame(false);
1561
+ }
1562
+ }
1563
+ catch (error) {
1564
+ // The message alone rarely says where the frame stopped, so name the phase that finished
1565
+ // last: a failure during the phase after it belongs to that part of the frame.
1566
+ const phase = this.frameOpen && this.lastPhase !== undefined ? ` (past its ${this.lastPhase} phase)` : '';
1567
+ throw new EngineError('E1408', `hold mode stopped at ${Number(this.clock.now.toFixed(3))} seconds, in frame ${this.context.time.frame}: ${messageOf(error)}${phase}`);
1568
+ }
1569
+ finally {
1570
+ endPlanHold();
1571
+ this.holding = false;
1572
+ this.time.held = false;
1573
+ this.time.drawn = true;
1574
+ this.render.held = false;
1575
+ this.recorded.held = false;
1576
+ }
1577
+ if (script !== undefined)
1578
+ this.scriptResult = { dumps, problems };
1579
+ Atomics.store(slots, Slot.HeldFrame, held);
1580
+ Atomics.store(slots, Slot.HeldFrom, first);
1581
+ Atomics.store(slots, Slot.FramesPublished, frame);
1582
+ Atomics.notify(slots, Slot.FramesPublished);
1583
+ }
1584
+ /**
1585
+ * Waits for the tasks that the sketch queued, which write their answers between frames, so the
1586
+ * held frame draws what they wrote. A chain of tasks has each one queued before the promise that
1587
+ * answered before it runs its next code, so the count reaches zero only when the chain is done.
1588
+ * The level plans of meshes made in code count as tasks until their levels are in, and the wait
1589
+ * for them goes on past the other tasks' limit: a held frame draws every planned level, or hold
1590
+ * mode fails and names the meshes that still plan.
1591
+ */
1592
+ async settleTasks() {
1593
+ const start = performance.now();
1594
+ let warned = false;
1595
+ let progressAt = start + PLAN_PROGRESS_MS;
1596
+ while (tasksPending() > 0) {
1597
+ const now = performance.now();
1598
+ const planning = plansPending();
1599
+ const others = tasksPending() - planning.length;
1600
+ if (others > 0 && now - start >= TASK_SETTLE_LIMIT_MS) {
1601
+ if (planning.length === 0) {
1602
+ console.warn(`hold mode stopped waiting for ${others} task(s) that did not answer`);
1603
+ return;
1604
+ }
1605
+ if (!warned)
1606
+ console.warn(`hold mode stopped waiting for ${others} task(s) that did not answer, and waits on for the levels of detail of ${planning.length} mesh(es)`);
1607
+ warned = true;
1608
+ }
1609
+ if (planning.length > 0 && now - start >= PLAN_SETTLE_LIMIT_MS)
1610
+ throw new EngineError('E1408', `hold mode waited ${PLAN_SETTLE_LIMIT_MS / 1000} seconds for the levels of detail that meshes made in code plan, and these still plan: ${planning.join(', ')}. Pass levels: false for a mesh that a held frame should draw without them.`);
1611
+ if (planning.length > 0 && now >= progressAt) {
1612
+ console.info(`hold mode waits for the levels of detail of ${planning.length} mesh(es): ${planning.join(', ')}`);
1613
+ progressAt = now + PLAN_PROGRESS_MS;
1614
+ }
1615
+ await new Promise((resolve) => setTimeout(resolve, 0));
1616
+ }
1617
+ }
1618
+ /**
1619
+ * Steps the sketch through a recording: each frame gets the step and the sketch time that it had
1620
+ * when the session was recorded, and the input that the sketch read in it. The frames run from
1621
+ * the recording's first one on a fresh setup, so the session's states come out the same on
1622
+ * another machine, whatever its frame rate. The last frame is the one that the thread that draws
1623
+ * draws, as in hold mode.
1624
+ */
1625
+ async replay(program) {
1626
+ const { slots } = this.sketch.control;
1627
+ const { glue } = this.sketch;
1628
+ const rate = Math.round(1 / this.fixed.step);
1629
+ if (program.fixedRate !== rate)
1630
+ throw new EngineError('E1435', `the recording runs ${program.fixedRate} fixed steps a second, and this sketch runs ${rate}.`);
1631
+ /** The engine's key index of each name in the recording's dictionary. */
1632
+ const keyIndex = program.keyNames.map((name) => {
1633
+ const index = this.sketch.keyCodes.indexOf(name);
1634
+ if (index >= 0)
1635
+ return index;
1636
+ throw new EngineError('E1435', `the recording used the key "${name}", which this engine's key codes do not hold. Play the recording with the engine that recorded it.`);
1637
+ });
1638
+ const frames = program.steps.length;
1639
+ this.replaying = true;
1640
+ let first = 0;
1641
+ let frame = 0;
1642
+ let held = 0;
1643
+ let now = 0;
1644
+ try {
1645
+ for (let at = 0; at < frames; at++) {
1646
+ const step = program.steps[at];
1647
+ now += step;
1648
+ this.clock.replayStep(now, step);
1649
+ const start = program.starts[at];
1650
+ const count = program.counts[at];
1651
+ for (let k = start; k < start + count; k++)
1652
+ this.writeRecordedEvent(program, k, keyIndex);
1653
+ // The last frame is the only one that the thread that draws draws, so it is the first
1654
+ // to wait for the scene's images, as a held frame does. A pass that reads the frame
1655
+ // before it, as screen-space reflections do, draws the frame before the last too.
1656
+ const before = at === frames - 2 && glue.holdsFrameBefore() !== 0;
1657
+ this.time.drawn = before || at === frames - 1;
1658
+ if (first === 0 && this.time.drawn) {
1659
+ await this.context.scene.imagesSettled();
1660
+ await this.context.scene.areaTablesSettled();
1661
+ await this.post.gradingSettled();
1662
+ await imagesArrived(slots, glue.textureStat(TEXTURE_STAT_IMAGES_SENT, 0));
1663
+ glue.setTextureOption(TEXTURE_OPTION_UPLOAD_ALL, 1);
1664
+ this.gpuEpoch = -1;
1665
+ }
1666
+ frame = this.frame();
1667
+ if (first === 0 && this.time.drawn)
1668
+ first = frame;
1669
+ }
1670
+ held = frame;
1671
+ Atomics.store(slots, Slot.HeldFrom, frame);
1672
+ if (glue.readsLastFrame() !== 0 ||
1673
+ glue.probesWaiting() !== 0 ||
1674
+ glue.lightImagesWaiting() !== 0 ||
1675
+ tasksPending() > 0) {
1676
+ if (tasksPending() > 0)
1677
+ await this.settleTasks();
1678
+ this.clock.replayStep(now, 0);
1679
+ // The settle frame draws what the recording's last frame prepared, such as a
1680
+ // light's copied picture. It is no frame of the session, so the sketch's code does
1681
+ // not run again and the replay gives the recording's frames, no more.
1682
+ frame = this.frame(false);
1683
+ }
1684
+ }
1685
+ catch (error) {
1686
+ if (error instanceof EngineError && error.code === 'E1435')
1687
+ throw error;
1688
+ throw new EngineError('E1408', `the replay stopped at ${Number(now.toFixed(3))} seconds, in frame ${this.context.time.frame}: ${messageOf(error)}`);
1689
+ }
1690
+ finally {
1691
+ this.replaying = false;
1692
+ this.time.drawn = true;
1693
+ }
1694
+ this.replayResult = {
1695
+ frames,
1696
+ seconds: now,
1697
+ sketch: program.sketch,
1698
+ stopped: program.stopped,
1699
+ };
1700
+ Atomics.store(slots, Slot.HeldFrame, held);
1701
+ Atomics.store(slots, Slot.HeldFrom, first);
1702
+ Atomics.store(slots, Slot.FramesPublished, frame);
1703
+ Atomics.notify(slots, Slot.FramesPublished);
1704
+ }
1705
+ /** Writes one recorded input record into the ring for the frame that reads it. */
1706
+ writeRecordedEvent(program, event, keyIndex) {
1707
+ const at = event * program.stride;
1708
+ const type = program.events[at];
1709
+ const code = program.events[at + 1];
1710
+ writeInputEvent(this.sketch.control, type, program.events[at + 5], program.events[at + 6], type === EVENT_KEY_DOWN || type === EVENT_KEY_UP ? keyIndex[code] : code, program.events[at + 3], program.events[at + 4], program.events[at + 2], nextFrame(this.recorded.frame));
1711
+ }
1712
+ /** What a replay gave, once its frames ran. */
1713
+ get replayOutcome() {
1714
+ return this.replayResult;
1715
+ }
1716
+ /** The recording of this session so far, or undefined when the page records nothing. */
1717
+ async saveRecording() {
1718
+ if (this.recorder === undefined)
1719
+ return undefined;
1720
+ return this.recorder.encode({
1721
+ fixedRate: Math.round(1 / this.fixed.step),
1722
+ sketch: this.sketch.sketchUrl,
1723
+ });
1724
+ }
1725
+ /** The dump steps that fall at the frame that is about to run, which read it after it ran. */
1726
+ scriptDumps = [];
1727
+ /** What a timed script's steps gave, once hold mode has performed them. */
1728
+ get holdScriptResult() {
1729
+ return this.scriptResult;
1730
+ }
1731
+ /**
1732
+ * Performs one step of a timed script that lands before a frame: writes the input event that the
1733
+ * next frame reads, or writes a property at once. A step that fails leaves a problem and the rest
1734
+ * of the script goes on.
1735
+ */
1736
+ performScriptStep(step, keys, problems) {
1737
+ const text = scriptStepText(step);
1738
+ try {
1739
+ if (step.verb === 'key') {
1740
+ const key = keys.get(step.code);
1741
+ if (key === undefined)
1742
+ problems.push({
1743
+ at: step.at,
1744
+ step: text,
1745
+ error: `the engine reads no key named "${step.code}". Name a key by its code on a standard keyboard, such as KeyA, Space or ArrowLeft.`,
1746
+ });
1747
+ else
1748
+ writeKeyEvent(this.sketch.control, step.down, key, this.nextInputFrame());
1749
+ return;
1750
+ }
1751
+ if (step.verb === 'pointer') {
1752
+ writePointerEvent(this.sketch.control, step, this.input.pointer, this.nextInputFrame());
1753
+ return;
1754
+ }
1755
+ if (step.verb === 'set') {
1756
+ const target = this.scriptTarget(step, problems);
1757
+ if (target !== undefined)
1758
+ this.context.scene.setScriptPath(target, step.path, step.value);
1759
+ }
1760
+ }
1761
+ catch (error) {
1762
+ problems.push({ at: step.at, step: text, error: messageOf(error) });
1763
+ }
1764
+ }
1765
+ /** Records what a dump step reads, or the problem that stopped it. */
1766
+ dumpScriptStep(step, dumps, problems) {
1767
+ const target = this.scriptTarget(step, problems);
1768
+ if (target === undefined)
1769
+ return;
1770
+ const { scene } = this.context;
1771
+ try {
1772
+ if (step.path !== undefined) {
1773
+ dumps.push({
1774
+ at: step.at,
1775
+ target: step.target,
1776
+ path: step.path,
1777
+ value: scene.readScriptPath(target, step.path),
1778
+ });
1779
+ return;
1780
+ }
1781
+ const visible = scene.readScriptPath(target, 'visible');
1782
+ dumps.push({
1783
+ at: step.at,
1784
+ target: step.target,
1785
+ value: {
1786
+ name: target.name,
1787
+ kind: target instanceof Camera ? 'camera' : target instanceof Light ? 'light' : 'object',
1788
+ position: scene.readScriptPath(target, 'position'),
1789
+ rotation: scene.readScriptPath(target, 'rotation'),
1790
+ scale: scene.readScriptPath(target, 'scale'),
1791
+ visible: visible[0] === 1,
1792
+ },
1793
+ });
1794
+ }
1795
+ catch (error) {
1796
+ problems.push({ at: step.at, step: scriptStepText(step), error: messageOf(error) });
1797
+ }
1798
+ }
1799
+ /**
1800
+ * The object that a script step names: an object by name, or the scene's active camera. A name
1801
+ * that finds nothing leaves a problem that says so, with the names that are close.
1802
+ */
1803
+ scriptTarget(step, problems) {
1804
+ const { scene } = this.context;
1805
+ const found = step.target === '#camera' ? scene.shownCamera : scene.find(step.target);
1806
+ if (found !== undefined)
1807
+ return found;
1808
+ const near = scene.nearNames(step.target.replace(/^#/, ''));
1809
+ const where = step.target === '#camera'
1810
+ ? 'the scene has no active camera'
1811
+ : `the scene has no object named "${step.target}"`;
1812
+ const hint = near.length > 0
1813
+ ? ` Names that are close: ${near.map((name) => `"${name}"`).join(', ')}.`
1814
+ : ' The scene has no named objects.';
1815
+ problems.push({ at: step.at, step: scriptStepText(step), error: `${where}.${hint}` });
1816
+ return undefined;
1817
+ }
1818
+ /** The number of the frame that the next input event reaches. */
1819
+ nextInputFrame() {
1820
+ return nextFrame(this.recorded.frame);
1821
+ }
1822
+ /**
1823
+ * Updates the world transforms of the objects that moved: every one, or with `late`, only those
1824
+ * that moved since the last update, and the objects below them. Development builds first report
1825
+ * static objects whose transform changed without a setter, because the update clears the marks
1826
+ * that setters leave.
1827
+ */
1828
+ updateTransforms(late) {
1829
+ if (DEV) {
1830
+ const unmarked = this.context.scene.unmarkedWrites?.check();
1831
+ if (unmarked)
1832
+ this.report(unmarked);
1833
+ }
1834
+ const { glue } = this.sketch;
1835
+ if (late)
1836
+ glue.updateLateTransforms();
1837
+ else
1838
+ glue.updateTransforms();
1839
+ this.core.refresh();
1840
+ this.endPhase(Phase.Transforms);
1841
+ }
1842
+ /**
1843
+ * The animation step, once the scene has animated or morphed objects: advances their clips by
1844
+ * `stepUs` whole microseconds, poses them on the job workers, and moves the bounds of skinned
1845
+ * and morphed objects, which marks them. It runs before the transform update and its check of
1846
+ * static objects. It counts as transform time, with the transform update that follows it. The
1847
+ * events it collects reach the sketch's handlers at the start of the next frame's update.
1848
+ */
1849
+ animate(stepUs) {
1850
+ const { scene } = this.context;
1851
+ const properties = scene.properties;
1852
+ if (scene.animations === undefined && !scene.morphed && properties === undefined)
1853
+ return;
1854
+ try {
1855
+ // The property tracks follow the clips' times and weights, so they sample after the
1856
+ // job workers advanced them.
1857
+ if (scene.animations !== undefined || scene.morphed) {
1858
+ const step = this.sketch.glue.updateAnimations(stepUs);
1859
+ this.core.check(step, 'the animation step', undefined, true);
1860
+ }
1861
+ // The sketch's own step, which hold mode also gives, so a held frame shows each track
1862
+ // at the held time.
1863
+ properties?.step(this.clock.dt);
1864
+ }
1865
+ catch (error) {
1866
+ this.report(error);
1867
+ }
1868
+ }
1869
+ /** Reports an error from a sketch's handler, as `report` does. */
1870
+ reportError = (error) => this.report(error);
1871
+ /**
1872
+ * Runs one frame at the clock's time and step, and returns its number. Without `play`, the
1873
+ * frame reads no input and runs none of the sketch's code: only the core's steps.
1874
+ */
1875
+ frame(play = true) {
1876
+ const start = performance.now();
1877
+ const { time, callbacks } = this;
1878
+ const { glue } = this.sketch;
1879
+ const { slots } = this.sketch.control;
1880
+ const dt = this.clock.dt;
1881
+ time.now = this.clock.now;
1882
+ time.dt = dt;
1883
+ const frame = nextFrame(this.recorded.frame);
1884
+ this.recorded.frame = frame;
1885
+ if (play)
1886
+ time.frame++;
1887
+ this.record.begin(frame);
1888
+ this.updateFailed = false;
1889
+ this.frameOpen = true;
1890
+ this.phaseStart = start;
1891
+ this.lastPhase = undefined;
1892
+ this.readViewport();
1893
+ // The governor judges the frames so far before the sketch's update, which then sees the
1894
+ // render scale of this frame, and whose change handlers hear of a shadow step.
1895
+ if (play && this.governorLoop && !this.checking) {
1896
+ this.governorLoop.now[0] = start;
1897
+ this.governorLoop.frame(this.resumed);
1898
+ this.resumed = false;
1899
+ if (this.governor.stepChanges !== this.stepChanges ||
1900
+ this.governor.tierChanges !== this.tierChanges)
1901
+ this.applyGovernedSteps();
1902
+ }
1903
+ // Handlers that hear of a restart may create objects with new pipelines, so their frame
1904
+ // waits for them.
1905
+ let restart = false;
1906
+ // The sketch's part of the frame: the input the page wrote and its pointer events on
1907
+ // objects, preference changes, the fixed steps and the update. It stays in this function: a
1908
+ // call that passed the step on would allocate a number for it in every frame.
1909
+ if (play) {
1910
+ this.recorder?.beginFrame(dt);
1911
+ if (!this.holdsFrames) {
1912
+ this.input.beginFrame(frame, (frame - time.frame) | 0);
1913
+ this.context.scene.dispatchPointerEvents(this.reportError);
1914
+ const reducedMotion = Atomics.load(slots, Slot.ReducedMotion);
1915
+ if (reducedMotion !== this.reducedMotion) {
1916
+ this.reducedMotion = reducedMotion;
1917
+ this.notify(this.preferenceHandlers, undefined);
1918
+ }
1919
+ }
1920
+ else if (this.replaying || (this.holding && this.holdScript !== undefined)) {
1921
+ // A hold that performs a timed script, or a replay, reads the events that were written
1922
+ // for the frame, so a frame driven by input stays the same on every run.
1923
+ this.input.beginFrame(frame, 0);
1924
+ this.context.scene.dispatchPointerEvents(this.reportError);
1925
+ }
1926
+ const change = this.quality.takeChange();
1927
+ if (change !== 0) {
1928
+ if (change === RESTART_CHANGE)
1929
+ restart = true;
1930
+ this.notify(this.quality.handlers, this.quality);
1931
+ }
1932
+ this.followBudgets();
1933
+ // The clips' events of the frame before, so the sketch's update sees them.
1934
+ this.context.scene.animations?.dispatch(this.reportError);
1935
+ const tablesFailure = this.context.scene.takeAreaTablesFailure();
1936
+ if (tablesFailure)
1937
+ this.report(tablesFailure);
1938
+ const imageFailure = this.context.scene.takeImageFailure();
1939
+ if (imageFailure)
1940
+ this.report(imageFailure);
1941
+ // Steps that fall due count even when the sketch has no fixed update, so none pile up.
1942
+ const steps = this.fixed.stepsAt(time.now);
1943
+ if (callbacks.onFixedUpdate) {
1944
+ for (let k = 0; k < steps; k++) {
1945
+ try {
1946
+ callbacks.onFixedUpdate(this.fixed.step);
1947
+ }
1948
+ catch (error) {
1949
+ this.report(error);
1950
+ }
1951
+ }
1952
+ }
1953
+ try {
1954
+ callbacks.onUpdate?.(dt);
1955
+ }
1956
+ catch (error) {
1957
+ this.report(error);
1958
+ }
1959
+ }
1960
+ this.endPhase(Phase.Update);
1961
+ // Job workers woken now start while the engine applies the frame's commands; woken before
1962
+ // the sketch's update, they would spin through it and sleep again.
1963
+ glue.prepareJobs();
1964
+ // Each feature draw answers whether its feature is ready before the frame takes its room.
1965
+ this.context.scene.pollReadiness();
1966
+ // Whole milliseconds and microseconds cross into the core without a number object each.
1967
+ const timeMs = Math.round(time.now * 1000);
1968
+ const stepUs = Math.round(dt * 1_000_000);
1969
+ if (glue.beginFrame(frame, timeMs, stepUs) !== 0)
1970
+ this.report(coreFailure(glue, QUEUED_CHANGE));
1971
+ this.core.refresh();
1972
+ this.endPhase(Phase.Commands);
1973
+ this.animate(play ? stepUs : 0);
1974
+ this.updateTransforms(false);
1975
+ if (play && callbacks.onLateUpdate) {
1976
+ try {
1977
+ callbacks.onLateUpdate(dt);
1978
+ }
1979
+ catch (error) {
1980
+ this.report(error);
1981
+ }
1982
+ this.endPhase(Phase.Update);
1983
+ this.updateTransforms(true);
1984
+ }
1985
+ if (this.followEffects())
1986
+ restart = true;
1987
+ if (this.governor.stepChanges !== this.stepChanges ||
1988
+ this.governor.tierChanges !== this.tierChanges)
1989
+ this.applyGovernedSteps();
1990
+ // Development builds first report static batch rows written without markDirty, because the
1991
+ // batch update clears the marks.
1992
+ if (DEV) {
1993
+ const unmarked = this.context.scene.unmarkedRows?.check();
1994
+ if (unmarked)
1995
+ this.report(unmarked);
1996
+ }
1997
+ glue.updateBatches(frame);
1998
+ if (!this.cellsWarned && glue.cellsRefused() !== 0) {
1999
+ this.cellsWarned = true;
2000
+ console.warn(cellTableWarning());
2001
+ }
2002
+ this.endPhase(Phase.Batches);
2003
+ const width = Math.max(1, Atomics.load(slots, Slot.CanvasWidth));
2004
+ const height = Math.max(1, Atomics.load(slots, Slot.CanvasHeight));
2005
+ const epoch = Atomics.load(slots, Slot.GpuEpoch);
2006
+ // Read after the epoch and before a GPU reset, which needs it. The count then covers every
2007
+ // frame that an old device replayed, as the thread that draws skips the old device's frames
2008
+ // that it takes later, with their releases of images.
2009
+ glue.syncTextures(Atomics.load(slots, Slot.ImagesArrived), Atomics.load(slots, Slot.FramesTaken));
2010
+ if (epoch !== this.gpuEpoch) {
2011
+ // A new GPU device has none of the old one's objects: this frame creates them all again.
2012
+ if (glue.resetGpu() !== 0)
2013
+ this.report(coreFailure(glue, 'the GPU reset'));
2014
+ this.gpuEpoch = epoch;
2015
+ }
2016
+ // The texture memory budget dropped levels or asks for some again: the loads again start
2017
+ // now, and the quality change handlers hear of it in the next frame.
2018
+ if (this.textures.pollBudget())
2019
+ this.quality.governed();
2020
+ const built = Atomics.load(slots, Slot.PipelinesBuilt);
2021
+ const joinFailed = Atomics.exchange(slots, Slot.JoinFailed, 0);
2022
+ if (joinFailed !== 0)
2023
+ this.post.dropJoin(joinFailed);
2024
+ const scale = this.renderScale();
2025
+ const times = this.frameTimes;
2026
+ if (times)
2027
+ while (times.step())
2028
+ glue.gpuFrameTime(times.frame, times.busyUs);
2029
+ const stillEnabled = Atomics.load(slots, Slot.StillOff) === 0;
2030
+ if (stillEnabled !== this.stillEnabled) {
2031
+ this.stillEnabled = stillEnabled;
2032
+ glue.setStillEnabled(stillEnabled);
2033
+ }
2034
+ if (glue.cullFrame(frame, width, height, scale, built) !== 0)
2035
+ this.report(coreFailure(glue, 'the frame'));
2036
+ this.endPhase(Phase.Cull);
2037
+ if (DEV && this.debugDraw) {
2038
+ this.core.refresh();
2039
+ try {
2040
+ this.debugDraw.flush(width, height, play);
2041
+ }
2042
+ catch (error) {
2043
+ this.report(error);
2044
+ }
2045
+ }
2046
+ if (glue.recordFrame(frame, width, height, scale, built) !== 0)
2047
+ this.report(coreFailure(glue, 'the frame'));
2048
+ if (this.sketch.twoStepProbe)
2049
+ this.reportTwoStep();
2050
+ Atomics.store(slots, Slot.RenderScale, scale);
2051
+ // Input names frames in the engine's count, so each frame of the setup and of the preset
2052
+ // check keeps its own camera: a click can come while any of them is on screen.
2053
+ this.context.scene.keepFrameCamera(frame, width, height);
2054
+ // Every frame places the labels, as the thread that draws presents each one.
2055
+ try {
2056
+ this.ui.project(frame, width, height);
2057
+ }
2058
+ catch (error) {
2059
+ this.report(error);
2060
+ }
2061
+ this.record.count(Counter.Rebuilds, glue.drawTablesRebuilt() ? 1 : 0);
2062
+ this.record.count(Counter.VisibleEntries, glue.visibleEntries(frame));
2063
+ this.record.count(Counter.OccludedEntries, glue.occludedEntries(frame));
2064
+ // The path that the frame's cluster trees took, for a page that reports which one a held
2065
+ // frame drew: the ranges the walk chose, or none where the device draws whole levels.
2066
+ const ranges = glue.patchRanges(frame);
2067
+ Atomics.store(slots, Slot.ClusterPatches, ranges === CORE_NOT_COUNTED ? -1 : ranges);
2068
+ Atomics.store(slots, Slot.ClusterPatchFrame, frame);
2069
+ // A frame whose update threw still presents, so its record marks it: the figure that counts
2070
+ // completed updates leaves it out.
2071
+ this.record.count(Counter.UpdateErrors, this.updateFailed ? 1 : 0);
2072
+ // The memory figures change slowly, so a few times a window is enough. They start with the
2073
+ // first frame that samples, so the figures never show 0 for memory the engine holds, nor the
2074
+ // memory of the last time a reader sampled.
2075
+ if (this.record.figures) {
2076
+ if (this.memoryWait === 0) {
2077
+ this.publishMemory();
2078
+ this.memoryWait = MEMORY_EVERY;
2079
+ }
2080
+ this.memoryWait--;
2081
+ }
2082
+ else
2083
+ this.memoryWait = 0;
2084
+ // A frame whose list needs more room than any before moves the list, so each frame gives
2085
+ // the thread that draws its list's address.
2086
+ const parity = frame & 1;
2087
+ Atomics.store(slots, Slot.DrawListAddress0 + parity, glue.drawListAddress(parity));
2088
+ Atomics.store(slots, Slot.DrawListWords0 + parity, glue.drawListWords(frame));
2089
+ Atomics.store(slots, Slot.FrameRest0 + parity, glue.frameRests() ? 1 : 0);
2090
+ Atomics.store(slots, Slot.FrameEpoch0 + (frame & 1), epoch);
2091
+ // The frame may have made the plan's targets again, which leaves the other parity's list
2092
+ // naming textures that the new plan replaced.
2093
+ const planEpoch = glue.planEpoch();
2094
+ Atomics.store(slots, Slot.PlanEpoch, planEpoch);
2095
+ Atomics.store(slots, Slot.FramePlan0 + parity, planEpoch);
2096
+ // The first frame that records after a restart, whether the sketch asked for it between
2097
+ // frames or in this frame's own code, has the new settings, so the thread that draws holds it
2098
+ // until its pipelines are built.
2099
+ if (this.quality.takeRestart() || restart)
2100
+ Atomics.store(slots, Slot.PipelineHold, frame);
2101
+ this.core.refresh();
2102
+ this.endPhase(Phase.Record);
2103
+ this.frameOpen = false;
2104
+ this.record.commit(performance.now() - start);
2105
+ // Only the job workers asked for so far have records, so the figures count the ones that run.
2106
+ const asked = this.sketch.wantJobs(0);
2107
+ for (let k = 0; k < asked; k++) {
2108
+ const jobRecord = this.jobRecords[k];
2109
+ jobRecord.begin(frame);
2110
+ jobRecord.commitMicros(glue.takeJobBusyUs(k));
2111
+ }
2112
+ this.growJobs(glue, asked);
2113
+ // A pick whose read landed answers now, before the next frame's update, and so does a read
2114
+ // of a compute pass's region.
2115
+ this.context.scene.pollPicks(this.sketch.control.slots);
2116
+ this.render.pollReads(this.sketch.control.slots);
2117
+ return frame;
2118
+ }
2119
+ }
2120
+ /** A step of a timed script as a person writes it, for a message about the step. */
2121
+ function scriptStepText(step) {
2122
+ switch (step.verb) {
2123
+ case 'key':
2124
+ return `key ${step.code} ${step.down ? 'down' : 'up'}`;
2125
+ case 'pointer':
2126
+ return `pointer ${step.action}`;
2127
+ case 'set':
2128
+ return `set "${step.target}".${step.path}`;
2129
+ case 'dump':
2130
+ return step.path === undefined
2131
+ ? `dump "${step.target}"`
2132
+ : `dump "${step.target}".${step.path}`;
2133
+ }
2134
+ }
2135
+ /** Writes a key's press or release for the frame that reads it. */
2136
+ function writeKeyEvent(control, down, key, frame) {
2137
+ writeInputEvent(control, down ? EVENT_KEY_DOWN : EVENT_KEY_UP, 0, 0, key, 0, 0, 0, frame);
2138
+ }
2139
+ /** Writes a pointer's step for the frame that reads it. The script's pointer is the main pointer. */
2140
+ function writePointerEvent(control, step, pointer, frame) {
2141
+ // A press or a release without a place keeps the pointer where it is. A move or a wheel
2142
+ // scroll carries its own numbers.
2143
+ const x = step.x ?? pointer.x;
2144
+ const y = step.y ?? pointer.y;
2145
+ switch (step.action) {
2146
+ case 'move':
2147
+ writeInputEvent(control, EVENT_POINTER_MOVE, x, y, 0, MAIN_POINTER, pointer.buttons, FLAG_PRIMARY, frame);
2148
+ return;
2149
+ case 'down':
2150
+ writeInputEvent(control, EVENT_POINTER_DOWN, x, y, 0, MAIN_POINTER, pointer.buttons | MAIN_BUTTON, FLAG_PRIMARY, frame);
2151
+ return;
2152
+ case 'up':
2153
+ writeInputEvent(control, EVENT_POINTER_UP, x, y, 0, MAIN_POINTER, pointer.buttons & ~MAIN_BUTTON, FLAG_PRIMARY, frame);
2154
+ return;
2155
+ case 'wheel':
2156
+ writeInputEvent(control, EVENT_WHEEL, x, y, 0, 0, 0, 0, frame);
2157
+ return;
2158
+ }
2159
+ }