@zephyr3d/scene 0.7.0 → 0.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (319) hide show
  1. package/dist/animation/animation.js +4 -15
  2. package/dist/animation/animation.js.map +1 -1
  3. package/dist/animation/animationset.js +22 -9
  4. package/dist/animation/animationset.js.map +1 -1
  5. package/dist/animation/animationtrack.js +1 -0
  6. package/dist/animation/animationtrack.js.map +1 -1
  7. package/dist/animation/eulerrotationtrack.js +0 -1
  8. package/dist/animation/eulerrotationtrack.js.map +1 -1
  9. package/dist/animation/morphtarget.js +7 -1
  10. package/dist/animation/morphtarget.js.map +1 -1
  11. package/dist/animation/morphtrack.js +3 -3
  12. package/dist/animation/morphtrack.js.map +1 -1
  13. package/dist/animation/proptrack.js +37 -41
  14. package/dist/animation/proptrack.js.map +1 -1
  15. package/dist/animation/rotationtrack.js +0 -1
  16. package/dist/animation/rotationtrack.js.map +1 -1
  17. package/dist/animation/scaletrack.js +0 -1
  18. package/dist/animation/scaletrack.js.map +1 -1
  19. package/dist/animation/skeleton.js +7 -14
  20. package/dist/animation/skeleton.js.map +1 -1
  21. package/dist/animation/translationtrack.js +0 -1
  22. package/dist/animation/translationtrack.js.map +1 -1
  23. package/dist/app/api.js +13 -4
  24. package/dist/app/api.js.map +1 -1
  25. package/dist/app/app.js +13 -1
  26. package/dist/app/app.js.map +1 -1
  27. package/dist/app/engine.js +33 -45
  28. package/dist/app/engine.js.map +1 -1
  29. package/dist/app/inputmgr.js.map +1 -1
  30. package/dist/app/runtimescript.js.map +1 -1
  31. package/dist/app/screen.js +318 -0
  32. package/dist/app/screen.js.map +1 -0
  33. package/dist/app/scriptingsystem.js +10 -6
  34. package/dist/app/scriptingsystem.js.map +1 -1
  35. package/dist/app/scriptregistry.js +11 -22
  36. package/dist/app/scriptregistry.js.map +1 -1
  37. package/dist/asset/assetmanager.js +79 -58
  38. package/dist/asset/assetmanager.js.map +1 -1
  39. package/dist/asset/builtin.js +5 -5
  40. package/dist/asset/builtin.js.map +1 -1
  41. package/dist/asset/loaders/dds/dds.js +6 -2
  42. package/dist/asset/loaders/dds/dds.js.map +1 -1
  43. package/dist/asset/loaders/dds/dds_loader.js +1 -1
  44. package/dist/asset/loaders/dds/dds_loader.js.map +1 -1
  45. package/dist/asset/loaders/gltf/gltf_loader.js +14 -6
  46. package/dist/asset/loaders/gltf/gltf_loader.js.map +1 -1
  47. package/dist/asset/loaders/gltf/helpers.js +6 -2
  48. package/dist/asset/loaders/gltf/helpers.js.map +1 -1
  49. package/dist/asset/loaders/hdr/hdr.js +22 -15
  50. package/dist/asset/loaders/hdr/hdr.js.map +1 -1
  51. package/dist/asset/loaders/image/tga_Loader.js +2 -1
  52. package/dist/asset/loaders/image/tga_Loader.js.map +1 -1
  53. package/dist/asset/loaders/image/webimage_loader.js.map +1 -1
  54. package/dist/asset/loaders/loader.js +2 -2
  55. package/dist/asset/loaders/loader.js.map +1 -1
  56. package/dist/asset/model.js +2 -2
  57. package/dist/asset/model.js.map +1 -1
  58. package/dist/blitter/bilateralblur.js.map +1 -1
  59. package/dist/blitter/blitter.js +9 -11
  60. package/dist/blitter/blitter.js.map +1 -1
  61. package/dist/blitter/box.js +0 -1
  62. package/dist/blitter/box.js.map +1 -1
  63. package/dist/blitter/copy.js.map +1 -1
  64. package/dist/blitter/gaussianblur.js.map +1 -1
  65. package/dist/camera/base.js +1 -3
  66. package/dist/camera/base.js.map +1 -1
  67. package/dist/camera/camera.js +121 -37
  68. package/dist/camera/camera.js.map +1 -1
  69. package/dist/camera/fps.js +19 -17
  70. package/dist/camera/fps.js.map +1 -1
  71. package/dist/camera/orbit.js +45 -43
  72. package/dist/camera/orbit.js.map +1 -1
  73. package/dist/camera/orthocamera.js +27 -21
  74. package/dist/camera/orthocamera.js.map +1 -1
  75. package/dist/camera/perspectivecamera.js +26 -17
  76. package/dist/camera/perspectivecamera.js.map +1 -1
  77. package/dist/index.d.ts +14453 -15609
  78. package/dist/index.js +17 -11
  79. package/dist/index.js.map +1 -1
  80. package/dist/material/blinn.js.map +1 -1
  81. package/dist/material/grassmaterial.js.map +1 -1
  82. package/dist/material/lambert.js.map +1 -1
  83. package/dist/material/material.js +11 -5
  84. package/dist/material/material.js.map +1 -1
  85. package/dist/material/meshmaterial.js +10 -9
  86. package/dist/material/meshmaterial.js.map +1 -1
  87. package/dist/material/mixins/albedocolor.js.map +1 -1
  88. package/dist/material/mixins/foliage.js.map +1 -1
  89. package/dist/material/mixins/lightmodel/blinnphong.js.map +1 -1
  90. package/dist/material/mixins/lightmodel/lambert.js.map +1 -1
  91. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js +7 -0
  92. package/dist/material/mixins/lightmodel/pbrblueprintmixin.js.map +1 -1
  93. package/dist/material/mixins/lightmodel/pbrmetallicroughness.js.map +1 -1
  94. package/dist/material/mixins/lightmodel/pbrspecularglossness.js.map +1 -1
  95. package/dist/material/mixins/lit.js +3 -3
  96. package/dist/material/mixins/lit.js.map +1 -1
  97. package/dist/material/mixins/pbr/brdf.js.map +1 -1
  98. package/dist/material/mixins/pbr/common.js.map +1 -1
  99. package/dist/material/mixins/texture.js +3 -0
  100. package/dist/material/mixins/texture.js.map +1 -1
  101. package/dist/material/mixins/vertexcolor.js.map +1 -1
  102. package/dist/material/particle.js.map +1 -1
  103. package/dist/material/pbrblueprint.js +180 -22
  104. package/dist/material/pbrblueprint.js.map +1 -1
  105. package/dist/material/pbrmr.js.map +1 -1
  106. package/dist/material/pbrsg.js.map +1 -1
  107. package/dist/material/shader/helper.js +36 -53
  108. package/dist/material/shader/helper.js.map +1 -1
  109. package/dist/material/sprite.js +301 -0
  110. package/dist/material/sprite.js.map +1 -0
  111. package/dist/material/sprite3d.js +301 -0
  112. package/dist/material/sprite3d.js.map +1 -0
  113. package/dist/material/sprite3d_std.js +116 -0
  114. package/dist/material/sprite3d_std.js.map +1 -0
  115. package/dist/material/sprite3dblueprint.js +235 -0
  116. package/dist/material/sprite3dblueprint.js.map +1 -0
  117. package/dist/material/sprite_std.js +116 -0
  118. package/dist/material/sprite_std.js.map +1 -0
  119. package/dist/material/spriteblueprint.js +235 -0
  120. package/dist/material/spriteblueprint.js.map +1 -0
  121. package/dist/material/terrain-cm.js +0 -1
  122. package/dist/material/terrain-cm.js.map +1 -1
  123. package/dist/material/unlit.js.map +1 -1
  124. package/dist/material/water.js.map +1 -1
  125. package/dist/posteffect/bloom.js.map +1 -1
  126. package/dist/posteffect/compositor.js.map +1 -1
  127. package/dist/posteffect/fxaa.js.map +1 -1
  128. package/dist/posteffect/grayscale.js.map +1 -1
  129. package/dist/posteffect/motionblur.js.map +1 -1
  130. package/dist/posteffect/posteffect.js.map +1 -1
  131. package/dist/posteffect/sao.js.map +1 -1
  132. package/dist/posteffect/ssr.js +7 -5
  133. package/dist/posteffect/ssr.js.map +1 -1
  134. package/dist/posteffect/taa.js.map +1 -1
  135. package/dist/posteffect/tonemap.js.map +1 -1
  136. package/dist/render/abuffer_oit.js +8 -6
  137. package/dist/render/abuffer_oit.js.map +1 -1
  138. package/dist/render/clipmap.js +0 -10
  139. package/dist/render/clipmap.js.map +1 -1
  140. package/dist/render/cluster_light.js +4 -4
  141. package/dist/render/cluster_light.js.map +1 -1
  142. package/dist/render/cull_visitor.js +15 -17
  143. package/dist/render/cull_visitor.js.map +1 -1
  144. package/dist/render/depthpass.js +3 -4
  145. package/dist/render/depthpass.js.map +1 -1
  146. package/dist/render/drawable.js +15 -0
  147. package/dist/render/drawable.js.map +1 -0
  148. package/dist/render/drawable_mixin.js +8 -4
  149. package/dist/render/drawable_mixin.js.map +1 -1
  150. package/dist/render/envlight.js.map +1 -1
  151. package/dist/render/fbm_wavegenerator.js +3 -1
  152. package/dist/render/fbm_wavegenerator.js.map +1 -1
  153. package/dist/render/fft_wavegenerator.js +67 -64
  154. package/dist/render/fft_wavegenerator.js.map +1 -1
  155. package/dist/render/fullscreenquad.js.map +1 -1
  156. package/dist/render/gerstner_wavegenerator.js +3 -1
  157. package/dist/render/gerstner_wavegenerator.js.map +1 -1
  158. package/dist/render/globalbindgroup_allocator.js +3 -1
  159. package/dist/render/globalbindgroup_allocator.js.map +1 -1
  160. package/dist/render/hzb.js +1 -2
  161. package/dist/render/hzb.js.map +1 -1
  162. package/dist/render/lightpass.js +13 -13
  163. package/dist/render/lightpass.js.map +1 -1
  164. package/dist/render/objectcolorpass.js +4 -7
  165. package/dist/render/objectcolorpass.js.map +1 -1
  166. package/dist/render/primitive.js +4 -5
  167. package/dist/render/primitive.js.map +1 -1
  168. package/dist/render/render_queue.js +10 -5
  169. package/dist/render/render_queue.js.map +1 -1
  170. package/dist/render/renderer.js +16 -22
  171. package/dist/render/renderer.js.map +1 -1
  172. package/dist/render/renderpass.js +27 -52
  173. package/dist/render/renderpass.js.map +1 -1
  174. package/dist/render/rendertarget.js +5 -0
  175. package/dist/render/rendertarget.js.map +1 -0
  176. package/dist/render/screenrendertarget.js +56 -0
  177. package/dist/render/screenrendertarget.js.map +1 -0
  178. package/dist/render/shadowmap_pass.js +4 -5
  179. package/dist/render/shadowmap_pass.js.map +1 -1
  180. package/dist/render/sky.js +16 -14
  181. package/dist/render/sky.js.map +1 -1
  182. package/dist/render/weightedblended_oit.js.map +1 -1
  183. package/dist/scene/basesprite.js +296 -0
  184. package/dist/scene/basesprite.js.map +1 -0
  185. package/dist/scene/batchgroup.js +4 -2
  186. package/dist/scene/batchgroup.js.map +1 -1
  187. package/dist/scene/environment.js +9 -10
  188. package/dist/scene/environment.js.map +1 -1
  189. package/dist/scene/graph_node.js.map +1 -1
  190. package/dist/scene/light.js +22 -4
  191. package/dist/scene/light.js.map +1 -1
  192. package/dist/scene/mesh.js +93 -15
  193. package/dist/scene/mesh.js.map +1 -1
  194. package/dist/scene/octree.js.map +1 -1
  195. package/dist/scene/particlesys.js +25 -22
  196. package/dist/scene/particlesys.js.map +1 -1
  197. package/dist/scene/raycast_visitor.js +0 -16
  198. package/dist/scene/raycast_visitor.js.map +1 -1
  199. package/dist/scene/scene.js +7 -4
  200. package/dist/scene/scene.js.map +1 -1
  201. package/dist/scene/scene_node.js +20 -35
  202. package/dist/scene/scene_node.js.map +1 -1
  203. package/dist/scene/sprite.js +18 -0
  204. package/dist/scene/sprite.js.map +1 -0
  205. package/dist/scene/sprite3d.js +18 -0
  206. package/dist/scene/sprite3d.js.map +1 -0
  207. package/dist/scene/terrain-cm/grass.js +5 -4
  208. package/dist/scene/terrain-cm/grass.js.map +1 -1
  209. package/dist/scene/terrain-cm/grassmaterial.js +3 -1
  210. package/dist/scene/terrain-cm/grassmaterial.js.map +1 -1
  211. package/dist/scene/terrain-cm/terrain-cm.js +65 -48
  212. package/dist/scene/terrain-cm/terrain-cm.js.map +1 -1
  213. package/dist/scene/water.js +35 -30
  214. package/dist/scene/water.js.map +1 -1
  215. package/dist/shaders/atmosphere.js +17 -29
  216. package/dist/shaders/atmosphere.js.map +1 -1
  217. package/dist/shaders/fog.js.map +1 -1
  218. package/dist/shaders/misc.js.map +1 -1
  219. package/dist/shaders/noise.js.map +1 -1
  220. package/dist/shaders/pbr.js.map +1 -1
  221. package/dist/shaders/shadow.js.map +1 -1
  222. package/dist/shaders/ssr.js.map +1 -1
  223. package/dist/shaders/temporal.js.map +1 -1
  224. package/dist/shaders/water.js.map +1 -1
  225. package/dist/shadow/esm.js +1 -1
  226. package/dist/shadow/esm.js.map +1 -1
  227. package/dist/shadow/pcf_opt.js.map +1 -1
  228. package/dist/shadow/pcf_pd.js.map +1 -1
  229. package/dist/shadow/shader.js +3 -1
  230. package/dist/shadow/shader.js.map +1 -1
  231. package/dist/shadow/shadow_impl.js.map +1 -1
  232. package/dist/shadow/shadowmapper.js +6 -18
  233. package/dist/shadow/shadowmapper.js.map +1 -1
  234. package/dist/shadow/ssm.js.map +1 -1
  235. package/dist/shadow/vsm.js.map +1 -1
  236. package/dist/shapes/box.js +9 -3
  237. package/dist/shapes/box.js.map +1 -1
  238. package/dist/shapes/cylinder.js +2 -2
  239. package/dist/shapes/cylinder.js.map +1 -1
  240. package/dist/shapes/plane.js +2 -2
  241. package/dist/shapes/plane.js.map +1 -1
  242. package/dist/shapes/shape.js +2 -1
  243. package/dist/shapes/shape.js.map +1 -1
  244. package/dist/shapes/sphere.js +2 -2
  245. package/dist/shapes/sphere.js.map +1 -1
  246. package/dist/shapes/tetrahedron.js +5 -6
  247. package/dist/shapes/tetrahedron.js.map +1 -1
  248. package/dist/shapes/torus.js +2 -2
  249. package/dist/shapes/torus.js.map +1 -1
  250. package/dist/utility/aabbtree.js +1 -1
  251. package/dist/utility/aabbtree.js.map +1 -1
  252. package/dist/utility/blueprint/common/constants.js +578 -104
  253. package/dist/utility/blueprint/common/constants.js.map +1 -1
  254. package/dist/utility/blueprint/common/math.js +471 -9
  255. package/dist/utility/blueprint/common/math.js.map +1 -1
  256. package/dist/utility/blueprint/common.js +1 -1
  257. package/dist/utility/blueprint/common.js.map +1 -1
  258. package/dist/utility/blueprint/material/func.js +9 -5
  259. package/dist/utility/blueprint/material/func.js.map +1 -1
  260. package/dist/utility/blueprint/material/inputs.js.map +1 -1
  261. package/dist/utility/blueprint/material/ir.js +288 -80
  262. package/dist/utility/blueprint/material/ir.js.map +1 -1
  263. package/dist/utility/blueprint/material/pbr.js +92 -4
  264. package/dist/utility/blueprint/material/pbr.js.map +1 -1
  265. package/dist/utility/blueprint/material/texture.js +62 -45
  266. package/dist/utility/blueprint/material/texture.js.map +1 -1
  267. package/dist/utility/blueprint/node.js +28 -1
  268. package/dist/utility/blueprint/node.js.map +1 -1
  269. package/dist/utility/bounding_volume.js.map +1 -1
  270. package/dist/utility/debug.js.map +1 -1
  271. package/dist/utility/draco/decoder.js.map +1 -1
  272. package/dist/utility/misc.js +1 -1
  273. package/dist/utility/misc.js.map +1 -1
  274. package/dist/utility/panorama.js.map +1 -1
  275. package/dist/utility/pmrem.js.map +1 -1
  276. package/dist/utility/rendermipmap.js.map +1 -1
  277. package/dist/utility/serialization/json.js +19 -15
  278. package/dist/utility/serialization/json.js.map +1 -1
  279. package/dist/utility/serialization/manager.js +89 -22
  280. package/dist/utility/serialization/manager.js.map +1 -1
  281. package/dist/utility/serialization/scene/animation.js +23 -21
  282. package/dist/utility/serialization/scene/animation.js.map +1 -1
  283. package/dist/utility/serialization/scene/batch.js +4 -3
  284. package/dist/utility/serialization/scene/batch.js.map +1 -1
  285. package/dist/utility/serialization/scene/camera.js +97 -9
  286. package/dist/utility/serialization/scene/camera.js.map +1 -1
  287. package/dist/utility/serialization/scene/common.js +102 -28
  288. package/dist/utility/serialization/scene/common.js.map +1 -1
  289. package/dist/utility/serialization/scene/light.js +14 -12
  290. package/dist/utility/serialization/scene/light.js.map +1 -1
  291. package/dist/utility/serialization/scene/material.js +154 -26
  292. package/dist/utility/serialization/scene/material.js.map +1 -1
  293. package/dist/utility/serialization/scene/mesh.js +71 -100
  294. package/dist/utility/serialization/scene/mesh.js.map +1 -1
  295. package/dist/utility/serialization/scene/misc.js +3 -2
  296. package/dist/utility/serialization/scene/misc.js.map +1 -1
  297. package/dist/utility/serialization/scene/node.js +42 -9
  298. package/dist/utility/serialization/scene/node.js.map +1 -1
  299. package/dist/utility/serialization/scene/particle.js +7 -5
  300. package/dist/utility/serialization/scene/particle.js.map +1 -1
  301. package/dist/utility/serialization/scene/primitive.js +18 -15
  302. package/dist/utility/serialization/scene/primitive.js.map +1 -1
  303. package/dist/utility/serialization/scene/scene.js +3 -2
  304. package/dist/utility/serialization/scene/scene.js.map +1 -1
  305. package/dist/utility/serialization/scene/sprite.js +164 -0
  306. package/dist/utility/serialization/scene/sprite.js.map +1 -0
  307. package/dist/utility/serialization/scene/terrain.js +8 -6
  308. package/dist/utility/serialization/scene/terrain.js.map +1 -1
  309. package/dist/utility/serialization/scene/water.js +11 -9
  310. package/dist/utility/serialization/scene/water.js.map +1 -1
  311. package/dist/utility/serialization/types.js +6 -0
  312. package/dist/utility/serialization/types.js.map +1 -0
  313. package/dist/utility/shprojector.js.map +1 -1
  314. package/dist/utility/textures/ggxlut.js.map +1 -1
  315. package/dist/utility/textures/gradientnoise.js.map +1 -1
  316. package/dist/utility/textures/randomnoise.js.map +1 -1
  317. package/dist/values.js +14 -14
  318. package/dist/values.js.map +1 -1
  319. package/package.json +80 -80
@@ -104,17 +104,17 @@ const THREAD_GROUP_SIZE = 16;
104
104
  programs: {
105
105
  h0Program: createProgramH0(this._useComputeShader, THREAD_GROUP_SIZE, this._h0TextureFormat),
106
106
  hkProgram: this._renderMode === RENDER_NORMAL ? createProgramHk(this._useComputeShader, THREAD_GROUP_SIZE, this._dataTextureFormat) : null,
107
- hkProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramHk(false, 0, null, 2) : null,
108
- hkProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramHk(false, 0, null, 4) : null,
107
+ hkProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramHk(false, 0, undefined, 2) : null,
108
+ hkProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramHk(false, 0, undefined, 4) : null,
109
109
  fft2hProgram: this._renderMode === RENDER_NORMAL ? createProgramFFT2H(this._useComputeShader, THREAD_GROUP_SIZE, this._dataTextureFormat) : null,
110
- fft2hProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2H(false, 0, null, 2) : null,
111
- fft2hProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2H(false, 0, null, 4) : null,
110
+ fft2hProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2H(false, 0, undefined, 2) : null,
111
+ fft2hProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2H(false, 0, undefined, 4) : null,
112
112
  fft2vProgram: this._renderMode === RENDER_NORMAL ? createProgramFFT2V(this._useComputeShader, THREAD_GROUP_SIZE, this._dataTextureFormat) : null,
113
- fft2vProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2V(false, 0, null, 2) : null,
114
- fft2vProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2V(false, 0, null, 4) : null,
113
+ fft2vProgram2: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2V(false, 0, undefined, 2) : null,
114
+ fft2vProgram4: this._renderMode === RENDER_TWO_PASS ? createProgramFFT2V(false, 0, undefined, 4) : null,
115
115
  postfft2Program: this._renderMode === RENDER_NORMAL ? createProgramPostFFT2(this._useComputeShader, THREAD_GROUP_SIZE, this._dataTextureFormat) : null,
116
- postfft2Program2: this._renderMode === RENDER_TWO_PASS ? createProgramPostFFT2(false, 0, null, 2) : null,
117
- postfft2Program4: this._renderMode === RENDER_TWO_PASS ? createProgramPostFFT2(false, 0, null, 4) : null
116
+ postfft2Program2: this._renderMode === RENDER_TWO_PASS ? createProgramPostFFT2(false, 0, undefined, 2) : null,
117
+ postfft2Program4: this._renderMode === RENDER_TWO_PASS ? createProgramPostFFT2(false, 0, undefined, 4) : null
118
118
  },
119
119
  quad: FFTWaveGenerator.createQuad(),
120
120
  noiseTextures: new Map(),
@@ -123,11 +123,11 @@ const THREAD_GROUP_SIZE = 16;
123
123
  this._params = params ?? getDefaultBuildParams();
124
124
  const programs = FFTWaveGenerator._globals.programs;
125
125
  this._h0BindGroup = device.createBindGroup(programs.h0Program.bindGroupLayouts[0]);
126
- this._hkBindGroup = programs.hkProgram ? device.createBindGroup(FFTWaveGenerator._globals.programs.hkProgram.bindGroupLayouts[0]) : null;
127
- this._hkBindGroup2 = programs.hkProgram2 ? device.createBindGroup(FFTWaveGenerator._globals.programs.hkProgram2.bindGroupLayouts[0]) : null;
128
- this._hkBindGroup4 = programs.hkProgram4 ? device.createBindGroup(FFTWaveGenerator._globals.programs.hkProgram4.bindGroupLayouts[0]) : null;
129
- this._fft2hBindGroup = programs.fft2hProgram ? device.createBindGroup(FFTWaveGenerator._globals.programs.fft2hProgram.bindGroupLayouts[0]) : null;
130
- this._fft2vBindGroup = programs.fft2vProgram ? device.createBindGroup(FFTWaveGenerator._globals.programs.fft2vProgram.bindGroupLayouts[0]) : null;
126
+ this._hkBindGroup = programs.hkProgram ? device.createBindGroup(programs.hkProgram.bindGroupLayouts[0]) : null;
127
+ this._hkBindGroup2 = programs.hkProgram2 ? device.createBindGroup(programs.hkProgram2.bindGroupLayouts[0]) : null;
128
+ this._hkBindGroup4 = programs.hkProgram4 ? device.createBindGroup(programs.hkProgram4.bindGroupLayouts[0]) : null;
129
+ this._fft2hBindGroup = programs.fft2hProgram ? device.createBindGroup(programs.fft2hProgram.bindGroupLayouts[0]) : null;
130
+ this._fft2vBindGroup = programs.fft2vProgram ? device.createBindGroup(programs.fft2vProgram.bindGroupLayouts[0]) : null;
131
131
  this._fft2hBindGroup2Used = [
132
132
  [],
133
133
  []
@@ -160,9 +160,9 @@ const THREAD_GROUP_SIZE = 16;
160
160
  [],
161
161
  []
162
162
  ];
163
- this._postfft2BindGroup = programs.postfft2Program ? device.createBindGroup(FFTWaveGenerator._globals.programs.postfft2Program.bindGroupLayouts[0]) : null;
164
- this._postfft2BindGroup2 = programs.postfft2Program2 ? device.createBindGroup(FFTWaveGenerator._globals.programs.postfft2Program2.bindGroupLayouts[0]) : null;
165
- this._postfft2BindGroup4 = programs.postfft2Program4 ? device.createBindGroup(FFTWaveGenerator._globals.programs.postfft2Program4.bindGroupLayouts[0]) : null;
163
+ this._postfft2BindGroup = programs.postfft2Program ? device.createBindGroup(programs.postfft2Program.bindGroupLayouts[0]) : null;
164
+ this._postfft2BindGroup2 = programs.postfft2Program2 ? device.createBindGroup(programs.postfft2Program2.bindGroupLayouts[0]) : null;
165
+ this._postfft2BindGroup4 = programs.postfft2Program4 ? device.createBindGroup(programs.postfft2Program4.bindGroupLayouts[0]) : null;
166
166
  this._instanceData = null;
167
167
  this._ifftTextures = null;
168
168
  this._sizes = new Vector4();
@@ -518,13 +518,9 @@ const THREAD_GROUP_SIZE = 16;
518
518
  /** @internal */ disposeInstanceData() {
519
519
  if (this._instanceData) {
520
520
  this.disposeNTextures(this._instanceData.dataTextures);
521
- this._instanceData.dataTextures = null;
522
521
  this.disposeNTextures(this._instanceData.h0Textures);
523
- this._instanceData.h0Textures = null;
524
522
  this.disposeNTextures(this._instanceData.pingpongTextures);
525
- this._instanceData.pingpongTextures = null;
526
523
  this.disposeNTextures(this._instanceData.spectrumTextures);
527
- this._instanceData.spectrumTextures = null;
528
524
  this._instanceData.h0Framebuffer?.dispose();
529
525
  this._instanceData.pingpongFramebuffer?.dispose();
530
526
  this._instanceData.pingpongFramebuffer2?.dispose();
@@ -552,11 +548,12 @@ const THREAD_GROUP_SIZE = 16;
552
548
  this._hkBindGroup.setTexture('spectrum', instanceData.spectrumTextures);
553
549
  device.compute(this._params.resolution / THREAD_GROUP_SIZE, this._params.resolution / THREAD_GROUP_SIZE, 1);
554
550
  } else {
555
- this._hkBindGroup.setTexture('h0Texture0', instanceData.h0Textures[0], nearestRepeatSampler);
556
- this._hkBindGroup.setTexture('h0Texture1', instanceData.h0Textures[1], nearestRepeatSampler);
557
- this._hkBindGroup.setTexture('h0Texture2', instanceData.h0Textures[2], nearestRepeatSampler);
551
+ const h0Textures = instanceData.h0Textures;
552
+ this._hkBindGroup.setTexture('h0Texture0', h0Textures[0], nearestRepeatSampler);
553
+ this._hkBindGroup.setTexture('h0Texture1', h0Textures[1], nearestRepeatSampler);
554
+ this._hkBindGroup.setTexture('h0Texture2', h0Textures[2], nearestRepeatSampler);
558
555
  if (device.type === 'webgl') {
559
- this._hkBindGroup.setValue('h0TexSize', new Vector2(instanceData.h0Textures[0].width, instanceData.h0Textures[0].height));
556
+ this._hkBindGroup.setValue('h0TexSize', new Vector2(h0Textures[0].width, h0Textures[0].height));
560
557
  }
561
558
  device.setFramebuffer(instanceData.spectrumFramebuffer);
562
559
  FFTWaveGenerator._globals.quad.draw();
@@ -568,13 +565,14 @@ const THREAD_GROUP_SIZE = 16;
568
565
  const nearestRepeatSampler = fetchSampler('repeat_nearest_nomip');
569
566
  device.setProgram(FFTWaveGenerator._globals.programs.hkProgram4);
570
567
  device.setBindGroup(0, this._hkBindGroup4);
568
+ const h0Textures = instanceData.h0Textures;
571
569
  this._hkBindGroup4.setValue('resolution', this._params.resolution);
572
570
  this._hkBindGroup4.setValue('sizes', this._sizes);
573
- this._hkBindGroup4.setTexture('h0Texture0', instanceData.h0Textures[0], nearestRepeatSampler);
574
- this._hkBindGroup4.setTexture('h0Texture1', instanceData.h0Textures[1], nearestRepeatSampler);
571
+ this._hkBindGroup4.setTexture('h0Texture0', h0Textures[0], nearestRepeatSampler);
572
+ this._hkBindGroup4.setTexture('h0Texture1', h0Textures[1], nearestRepeatSampler);
575
573
  this._hkBindGroup4.setValue('t', time);
576
574
  if (device.type === 'webgl') {
577
- this._hkBindGroup4.setValue('h0TexSize', new Vector2(instanceData.h0Textures[0].width, instanceData.h0Textures[0].height));
575
+ this._hkBindGroup4.setValue('h0TexSize', new Vector2(h0Textures[0].width, h0Textures[0].height));
578
576
  }
579
577
  device.setFramebuffer(instanceData.spectrumFramebuffer4);
580
578
  FFTWaveGenerator._globals.quad.draw();
@@ -582,10 +580,10 @@ const THREAD_GROUP_SIZE = 16;
582
580
  device.setBindGroup(0, this._hkBindGroup2);
583
581
  this._hkBindGroup2.setValue('resolution', this._params.resolution);
584
582
  this._hkBindGroup2.setValue('sizes', this._sizes);
585
- this._hkBindGroup2.setTexture('h0Texture2', instanceData.h0Textures[2], nearestRepeatSampler);
583
+ this._hkBindGroup2.setTexture('h0Texture2', h0Textures[2], nearestRepeatSampler);
586
584
  this._hkBindGroup2.setValue('t', time);
587
585
  if (device.type === 'webgl') {
588
- this._hkBindGroup2.setValue('h0TexSize', new Vector2(instanceData.h0Textures[0].width, instanceData.h0Textures[0].height));
586
+ this._hkBindGroup2.setValue('h0TexSize', new Vector2(h0Textures[0].width, h0Textures[0].height));
589
587
  }
590
588
  device.setFramebuffer(instanceData.spectrumFramebuffer2);
591
589
  FFTWaveGenerator._globals.quad.draw();
@@ -619,15 +617,16 @@ const THREAD_GROUP_SIZE = 16;
619
617
  this._fft2hBindGroup.setTexture('ifft', pingPongFramebuffers[pingPong]);
620
618
  device.compute(this._params.resolution / THREAD_GROUP_SIZE, this._params.resolution / THREAD_GROUP_SIZE, 1);
621
619
  } else {
620
+ const pingPongTexture = pingPongTextures[pingPong];
622
621
  device.setFramebuffer(pingPongFramebuffers[pingPong]);
623
- this._fft2hBindGroup.setTexture('spectrum0', pingPongTextures[pingPong][0], nearestRepeatSampler);
624
- this._fft2hBindGroup.setTexture('spectrum1', pingPongTextures[pingPong][1], nearestRepeatSampler);
625
- this._fft2hBindGroup.setTexture('spectrum2', pingPongTextures[pingPong][2], nearestRepeatSampler);
626
- this._fft2hBindGroup.setTexture('spectrum3', pingPongTextures[pingPong][3], nearestRepeatSampler);
627
- this._fft2hBindGroup.setTexture('spectrum4', pingPongTextures[pingPong][4], nearestRepeatSampler);
628
- this._fft2hBindGroup.setTexture('spectrum5', pingPongTextures[pingPong][5], nearestRepeatSampler);
622
+ this._fft2hBindGroup.setTexture('spectrum0', pingPongTexture[0], nearestRepeatSampler);
623
+ this._fft2hBindGroup.setTexture('spectrum1', pingPongTexture[1], nearestRepeatSampler);
624
+ this._fft2hBindGroup.setTexture('spectrum2', pingPongTexture[2], nearestRepeatSampler);
625
+ this._fft2hBindGroup.setTexture('spectrum3', pingPongTexture[3], nearestRepeatSampler);
626
+ this._fft2hBindGroup.setTexture('spectrum4', pingPongTexture[4], nearestRepeatSampler);
627
+ this._fft2hBindGroup.setTexture('spectrum5', pingPongTexture[5], nearestRepeatSampler);
629
628
  if (device.type === 'webgl') {
630
- this._fft2hBindGroup.setValue('texSize', new Vector4(pingPongTextures[pingPong][0].width, pingPongTextures[pingPong][0].height, butterflyTex.width, butterflyTex.height));
629
+ this._fft2hBindGroup.setValue('texSize', new Vector4(pingPongTexture[0].width, pingPongTexture[0].height, butterflyTex.width, butterflyTex.height));
631
630
  }
632
631
  FFTWaveGenerator._globals.quad.draw();
633
632
  }
@@ -644,15 +643,16 @@ const THREAD_GROUP_SIZE = 16;
644
643
  this._fft2vBindGroup.setTexture('ifft', pingPongFramebuffers[pingPong]);
645
644
  device.compute(this._params.resolution / THREAD_GROUP_SIZE, this._params.resolution / THREAD_GROUP_SIZE, 1);
646
645
  } else {
646
+ const pingPongTexture = pingPongTextures[pingPong];
647
647
  device.setFramebuffer(pingPongFramebuffers[pingPong]);
648
- this._fft2vBindGroup.setTexture('spectrum0', pingPongTextures[pingPong][0], nearestRepeatSampler);
649
- this._fft2vBindGroup.setTexture('spectrum1', pingPongTextures[pingPong][1], nearestRepeatSampler);
650
- this._fft2vBindGroup.setTexture('spectrum2', pingPongTextures[pingPong][2], nearestRepeatSampler);
651
- this._fft2vBindGroup.setTexture('spectrum3', pingPongTextures[pingPong][3], nearestRepeatSampler);
652
- this._fft2vBindGroup.setTexture('spectrum4', pingPongTextures[pingPong][4], nearestRepeatSampler);
653
- this._fft2vBindGroup.setTexture('spectrum5', pingPongTextures[pingPong][5], nearestRepeatSampler);
648
+ this._fft2vBindGroup.setTexture('spectrum0', pingPongTexture[0], nearestRepeatSampler);
649
+ this._fft2vBindGroup.setTexture('spectrum1', pingPongTexture[1], nearestRepeatSampler);
650
+ this._fft2vBindGroup.setTexture('spectrum2', pingPongTexture[2], nearestRepeatSampler);
651
+ this._fft2vBindGroup.setTexture('spectrum3', pingPongTexture[3], nearestRepeatSampler);
652
+ this._fft2vBindGroup.setTexture('spectrum4', pingPongTexture[4], nearestRepeatSampler);
653
+ this._fft2vBindGroup.setTexture('spectrum5', pingPongTexture[5], nearestRepeatSampler);
654
654
  if (device.type === 'webgl') {
655
- this._fft2vBindGroup.setValue('texSize', new Vector4(pingPongTextures[pingPong][0].width, pingPongTextures[pingPong][0].height, butterflyTex.width, butterflyTex.height));
655
+ this._fft2vBindGroup.setValue('texSize', new Vector4(pingPongTexture[0].width, pingPongTexture[0].height, butterflyTex.width, butterflyTex.height));
656
656
  }
657
657
  FFTWaveGenerator._globals.quad.draw();
658
658
  }
@@ -795,15 +795,16 @@ const THREAD_GROUP_SIZE = 16;
795
795
  this._postfft2BindGroup.setTexture('ifft', this._ifftTextures, nearestRepeatSampler);
796
796
  device.compute(this._params.resolution / THREAD_GROUP_SIZE, this._params.resolution / THREAD_GROUP_SIZE, 1);
797
797
  } else {
798
+ const ifftTextures = this._ifftTextures;
798
799
  device.setFramebuffer(instanceData.postIfft2Framebuffer);
799
- this._postfft2BindGroup.setTexture('ifft0', this._ifftTextures[0], nearestRepeatSampler);
800
- this._postfft2BindGroup.setTexture('ifft1', this._ifftTextures[1], nearestRepeatSampler);
801
- this._postfft2BindGroup.setTexture('ifft2', this._ifftTextures[2], nearestRepeatSampler);
802
- this._postfft2BindGroup.setTexture('ifft3', this._ifftTextures[3], nearestRepeatSampler);
803
- this._postfft2BindGroup.setTexture('ifft4', this._ifftTextures[4], nearestRepeatSampler);
804
- this._postfft2BindGroup.setTexture('ifft5', this._ifftTextures[5], nearestRepeatSampler);
800
+ this._postfft2BindGroup.setTexture('ifft0', ifftTextures[0], nearestRepeatSampler);
801
+ this._postfft2BindGroup.setTexture('ifft1', ifftTextures[1], nearestRepeatSampler);
802
+ this._postfft2BindGroup.setTexture('ifft2', ifftTextures[2], nearestRepeatSampler);
803
+ this._postfft2BindGroup.setTexture('ifft3', ifftTextures[3], nearestRepeatSampler);
804
+ this._postfft2BindGroup.setTexture('ifft4', ifftTextures[4], nearestRepeatSampler);
805
+ this._postfft2BindGroup.setTexture('ifft5', ifftTextures[5], nearestRepeatSampler);
805
806
  if (device.type === 'webgl') {
806
- this._postfft2BindGroup.setValue('ifftTexSize', new Vector2(this._ifftTextures[0].width, this._ifftTextures[0].height));
807
+ this._postfft2BindGroup.setValue('ifftTexSize', new Vector2(ifftTextures[0].width, ifftTextures[0].height));
807
808
  }
808
809
  FFTWaveGenerator._globals.quad.draw();
809
810
  }
@@ -815,23 +816,24 @@ const THREAD_GROUP_SIZE = 16;
815
816
  device.setFramebuffer(instanceData.postIfft2Framebuffer4);
816
817
  device.setProgram(FFTWaveGenerator._globals.programs.postfft2Program4);
817
818
  device.setBindGroup(0, this._postfft2BindGroup4);
819
+ const ifftTextures = this._ifftTextures;
818
820
  this._postfft2BindGroup4.setValue('N2', this._params.resolution * this._params.resolution);
819
- this._postfft2BindGroup4.setTexture('ifft0', this._ifftTextures[0], nearestRepeatSampler);
820
- this._postfft2BindGroup4.setTexture('ifft1', this._ifftTextures[1], nearestRepeatSampler);
821
- this._postfft2BindGroup4.setTexture('ifft2', this._ifftTextures[2], nearestRepeatSampler);
822
- this._postfft2BindGroup4.setTexture('ifft3', this._ifftTextures[3], nearestRepeatSampler);
821
+ this._postfft2BindGroup4.setTexture('ifft0', ifftTextures[0], nearestRepeatSampler);
822
+ this._postfft2BindGroup4.setTexture('ifft1', ifftTextures[1], nearestRepeatSampler);
823
+ this._postfft2BindGroup4.setTexture('ifft2', ifftTextures[2], nearestRepeatSampler);
824
+ this._postfft2BindGroup4.setTexture('ifft3', ifftTextures[3], nearestRepeatSampler);
823
825
  if (device.type === 'webgl') {
824
- this._postfft2BindGroup4.setValue('ifftTexSize', new Vector2(this._ifftTextures[0].width, this._ifftTextures[0].height));
826
+ this._postfft2BindGroup4.setValue('ifftTexSize', new Vector2(ifftTextures[0].width, ifftTextures[0].height));
825
827
  }
826
828
  FFTWaveGenerator._globals.quad.draw();
827
829
  device.setFramebuffer(instanceData.postIfft2Framebuffer2);
828
830
  device.setProgram(FFTWaveGenerator._globals.programs.postfft2Program2);
829
831
  device.setBindGroup(0, this._postfft2BindGroup2);
830
832
  this._postfft2BindGroup2.setValue('N2', this._params.resolution * this._params.resolution);
831
- this._postfft2BindGroup2.setTexture('ifft4', this._ifftTextures[4], nearestRepeatSampler);
832
- this._postfft2BindGroup2.setTexture('ifft5', this._ifftTextures[5], nearestRepeatSampler);
833
+ this._postfft2BindGroup2.setTexture('ifft4', ifftTextures[4], nearestRepeatSampler);
834
+ this._postfft2BindGroup2.setTexture('ifft5', ifftTextures[5], nearestRepeatSampler);
833
835
  if (device.type === 'webgl') {
834
- this._postfft2BindGroup2.setValue('ifftTexSize', new Vector2(this._ifftTextures[0].width, this._ifftTextures[0].height));
836
+ this._postfft2BindGroup2.setValue('ifftTexSize', new Vector2(ifftTextures[0].width, ifftTextures[0].height));
835
837
  }
836
838
  FFTWaveGenerator._globals.quad.draw();
837
839
  }
@@ -974,12 +976,13 @@ const THREAD_GROUP_SIZE = 16;
974
976
  if (this._useComputeShader) {
975
977
  bindGroup.setTexture('dataTexture', instanceData.dataTextures, linearRepeatSampler);
976
978
  } else {
977
- bindGroup.setTexture('dx_hy_dz_dxdz0', instanceData.dataTextures[0], linearRepeatSampler);
978
- bindGroup.setTexture('sx_sz_dxdx_dzdz0', instanceData.dataTextures[1], linearRepeatSampler);
979
- bindGroup.setTexture('dx_hy_dz_dxdz1', instanceData.dataTextures[2], linearRepeatSampler);
980
- bindGroup.setTexture('sx_sz_dxdx_dzdz1', instanceData.dataTextures[3], linearRepeatSampler);
981
- bindGroup.setTexture('dx_hy_dz_dxdz2', instanceData.dataTextures[4], linearRepeatSampler);
982
- bindGroup.setTexture('sx_sz_dxdx_dzdz2', instanceData.dataTextures[5], linearRepeatSampler);
979
+ const dataTextures = instanceData.dataTextures;
980
+ bindGroup.setTexture('dx_hy_dz_dxdz0', dataTextures[0], linearRepeatSampler);
981
+ bindGroup.setTexture('sx_sz_dxdx_dzdz0', dataTextures[1], linearRepeatSampler);
982
+ bindGroup.setTexture('dx_hy_dz_dxdz1', dataTextures[2], linearRepeatSampler);
983
+ bindGroup.setTexture('sx_sz_dxdx_dzdz1', dataTextures[3], linearRepeatSampler);
984
+ bindGroup.setTexture('dx_hy_dz_dxdz2', dataTextures[4], linearRepeatSampler);
985
+ bindGroup.setTexture('sx_sz_dxdx_dzdz2', dataTextures[5], linearRepeatSampler);
983
986
  }
984
987
  bindGroup.setValue('foamParams', this._params.foamParams);
985
988
  bindGroup.setValue('sizes', this._sizes);