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