@realsee/five-webgpu 1.0.0-alpha.13 → 1.0.0-alpha.14

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 (374) hide show
  1. package/_virtual/_rolldown/runtime.js +3 -3
  2. package/docs/assets/hierarchy.js +1 -1
  3. package/docs/assets/navigation.js +1 -1
  4. package/docs/assets/search.js +1 -1
  5. package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
  6. package/docs/classes/index.BoundingMesh.html +1 -1
  7. package/docs/classes/index.Camera.html +1 -1
  8. package/docs/classes/index.EyeDomeLightingPass.html +1 -1
  9. package/docs/classes/index.Five.html +65 -64
  10. package/docs/classes/index.FivePass.html +1 -1
  11. package/docs/classes/index.FiveRenderer.html +4 -4
  12. package/docs/classes/index.FlowingFireworks3DPass.html +1 -1
  13. package/docs/classes/index.FlowingLight2DPass.html +1 -1
  14. package/docs/classes/index.FlowingLight3DPass.html +1 -1
  15. package/docs/classes/index.GaussianBlurPass.html +1 -1
  16. package/docs/classes/index.InternalWebGPURenderer.html +4 -4
  17. package/docs/classes/index.Model.html +1 -1
  18. package/docs/classes/index.ModelScene.html +1 -1
  19. package/docs/classes/index.NetworkSubscribe.html +1 -1
  20. package/docs/classes/index.PBMCustomNode.html +1 -1
  21. package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +1 -1
  22. package/docs/classes/index.PBMGaussianSplattingObject.html +1 -1
  23. package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +1 -1
  24. package/docs/classes/index.PBMGroup.html +1 -1
  25. package/docs/classes/index.PBMMesh.html +1 -1
  26. package/docs/classes/index.PBMMeshBasicMaterial.html +1 -1
  27. package/docs/classes/index.PBMMeshBasicNodeMaterial.html +1 -1
  28. package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +1 -1
  29. package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +1 -1
  30. package/docs/classes/index.PBMMeshPhongMaterial.html +1 -1
  31. package/docs/classes/index.PBMMeshPhongNodeMaterial.html +1 -1
  32. package/docs/classes/index.PBMMeshPhysicalMaterial.html +1 -1
  33. package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +1 -1
  34. package/docs/classes/index.PBMPanoFilter.html +1 -1
  35. package/docs/classes/index.PBMPointCloud.html +1 -1
  36. package/docs/classes/index.PBMPointCloudMaterial.html +1 -1
  37. package/docs/classes/index.PBMSkinnedMesh.html +1 -1
  38. package/docs/classes/index.PBMUpdateable.html +1 -1
  39. package/docs/classes/index.PanoCircleMesh.html +1 -1
  40. package/docs/classes/index.PanoCircleMeshCustom.html +1 -1
  41. package/docs/classes/index.PanoCircleMeshSolid.html +1 -1
  42. package/docs/classes/index.Parameter.html +1 -1
  43. package/docs/classes/index.Scene.html +1 -1
  44. package/docs/classes/index.Subscribe.html +1 -1
  45. package/docs/classes/index.Tile3D.html +1 -1
  46. package/docs/classes/index.TileNode.html +1 -1
  47. package/docs/classes/index.TrajectoryNode.html +1 -1
  48. package/docs/classes/index.Work.html +15 -22
  49. package/docs/classes/index.WorkResolvedObserver.html +22 -22
  50. package/docs/functions/index.createWorks.html +1 -1
  51. package/docs/functions/index.parseWork.html +1 -1
  52. package/docs/hierarchy.html +1 -1
  53. package/docs/interfaces/index.AddableObject.html +1 -1
  54. package/docs/interfaces/index.AjaxOptions.html +1 -1
  55. package/docs/interfaces/index.BaseEvent.html +1 -1
  56. package/docs/interfaces/index.Clock.html +1 -1
  57. package/docs/interfaces/index.EventCallback.html +3 -3
  58. package/docs/interfaces/index.GestureEvent.html +1 -1
  59. package/docs/interfaces/index.IPBMMaterial.html +1 -1
  60. package/docs/interfaces/index.ImageOptions.html +1 -1
  61. package/docs/interfaces/index.IntersectEvent.html +1 -1
  62. package/docs/interfaces/index.IntersectMesh.html +1 -1
  63. package/docs/interfaces/index.IntersectMeshInterface.html +1 -1
  64. package/docs/interfaces/index.Intersection.html +1 -1
  65. package/docs/interfaces/index.LooseWorkWithExtrinsics.html +8 -8
  66. package/docs/interfaces/index.ModeChangeEvent.html +1 -1
  67. package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
  68. package/docs/interfaces/index.ModelEvent.html +1 -1
  69. package/docs/interfaces/index.ModelSceneEvent.html +1 -1
  70. package/docs/interfaces/index.ModelTileEvent.html +1 -1
  71. package/docs/interfaces/index.MovePanoOptions.html +1 -1
  72. package/docs/interfaces/index.NetworkAbortError.html +1 -1
  73. package/docs/interfaces/index.NetworkFirbiddenError.html +1 -1
  74. package/docs/interfaces/index.NetworkOptions.html +1 -1
  75. package/docs/interfaces/index.NetworkProxyError.html +1 -1
  76. package/docs/interfaces/index.NetworkResourceEvent.html +1 -1
  77. package/docs/interfaces/index.NetworkResponseError.html +1 -1
  78. package/docs/interfaces/index.NetworkTimeoutError.html +1 -1
  79. package/docs/interfaces/index.ObjectEvent.html +1 -1
  80. package/docs/interfaces/index.PanoCircleMeshInterface.html +1 -1
  81. package/docs/interfaces/index.PanoEvent.html +1 -1
  82. package/docs/interfaces/index.PanoPrepareEvent.html +1 -1
  83. package/docs/interfaces/index.PanoTextureEvent.html +1 -1
  84. package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +1 -1
  85. package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
  86. package/docs/interfaces/index.ParameterMaterialValue.html +1 -1
  87. package/docs/interfaces/index.ParameterTilesetValue.html +1 -1
  88. package/docs/interfaces/index.ParameterValue.html +1 -1
  89. package/docs/interfaces/index.Pose.html +1 -1
  90. package/docs/interfaces/index.RenderEvent.html +1 -1
  91. package/docs/interfaces/index.ResolvedParameterValue.html +1 -1
  92. package/docs/interfaces/index.State.html +1 -1
  93. package/docs/interfaces/index.StateEvent.html +1 -1
  94. package/docs/interfaces/index.TextureOptions.html +1 -1
  95. package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
  96. package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +1 -1
  97. package/docs/interfaces/index.ViewLayer.html +1 -1
  98. package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +2 -2
  99. package/docs/interfaces/index.WorkCubeImage.html +2 -2
  100. package/docs/interfaces/index.WorkImage.html +5 -5
  101. package/docs/interfaces/index.WorkInitial.html +8 -8
  102. package/docs/interfaces/index.WorkInitialJson.html +2 -2
  103. package/docs/interfaces/index.WorkJson.html +2 -4
  104. package/docs/interfaces/index.WorkModel.html +8 -8
  105. package/docs/interfaces/index.WorkModelJson.html +2 -2
  106. package/docs/interfaces/index.WorkModelLayer.html +6 -6
  107. package/docs/interfaces/index.WorkModelLayerJson.html +2 -2
  108. package/docs/interfaces/index.WorkObserver.html +23 -23
  109. package/docs/interfaces/index.WorkObserverJson.html +2 -2
  110. package/docs/interfaces/index.WorkPanoramaJson.html +2 -2
  111. package/docs/interfaces/index.WorkPanoramasJson.html +2 -2
  112. package/docs/interfaces/index.WorkTile.html +5 -5
  113. package/docs/interfaces/index.WorkVideo.html +4 -4
  114. package/docs/interfaces/index.WorksEvent.html +1 -1
  115. package/docs/interfaces/index.XRControllerEvent.html +1 -1
  116. package/docs/interfaces/index.XRGestureEvent.html +2 -2
  117. package/docs/interfaces/index.XRPanoramaControllerCustomInitArgs.html +1 -1
  118. package/docs/interfaces/index.XRSessionEvent.html +1 -1
  119. package/docs/modules/index.html +1 -1
  120. package/docs/types/index.LegacyEventType.html +3 -3
  121. package/docs/types/index.OutputTextureDataType.html +1 -1
  122. package/docs/types/index.ParseOptions.html +8 -8
  123. package/docs/types/index.PointCloudTransparencyMode.html +2 -0
  124. package/docs/types/index.Works.html +1 -1
  125. package/docs/variables/index.loadAt3d.html +2 -0
  126. package/docs/variables/index.loadDome.html +2 -0
  127. package/docs/variables/index.loadDomez.html +2 -0
  128. package/docs/variables/index.loadGltf.html +2 -0
  129. package/docs/variables/index.loadPbm.html +2 -0
  130. package/docs/variables/index.loadPly.html +2 -0
  131. package/five/application/five.d.ts +3 -2
  132. package/five/chunks/at3d.js +338 -0
  133. package/five/chunks/at3d.mjs +338 -0
  134. package/five/chunks/dome.js +338 -0
  135. package/five/chunks/dome.mjs +338 -0
  136. package/five/chunks/domez.js +338 -0
  137. package/five/chunks/domez.mjs +338 -0
  138. package/five/chunks/fbx.js +338 -0
  139. package/five/chunks/fbx.mjs +338 -0
  140. package/five/chunks/fflate.js +338 -0
  141. package/five/chunks/fflate.mjs +338 -0
  142. package/five/chunks/glTF-helpers.js +804 -0
  143. package/five/chunks/glTF-helpers.mjs +804 -0
  144. package/five/chunks/gltf.js +338 -0
  145. package/five/chunks/gltf.mjs +338 -0
  146. package/five/chunks/imageBitmap.js +338 -0
  147. package/five/chunks/imageBitmap.mjs +338 -0
  148. package/five/chunks/imageSupport.js +338 -0
  149. package/five/chunks/imageSupport.mjs +338 -0
  150. package/five/chunks/lzma.js +383 -0
  151. package/five/chunks/lzma.mjs +383 -0
  152. package/five/chunks/memoryUsage.js +339 -0
  153. package/five/chunks/memoryUsage.mjs +339 -0
  154. package/five/chunks/minimal.js +338 -0
  155. package/five/chunks/minimal.mjs +338 -0
  156. package/five/chunks/pbm.js +338 -0
  157. package/five/chunks/pbm.mjs +338 -0
  158. package/five/chunks/pbmGaussianSplattingObject.js +338 -0
  159. package/five/chunks/pbmGaussianSplattingObject.mjs +338 -0
  160. package/five/chunks/pbmMeshMaterial.js +338 -0
  161. package/five/chunks/pbmMeshMaterial.mjs +338 -0
  162. package/five/chunks/pick.js +338 -0
  163. package/five/chunks/pick.mjs +338 -0
  164. package/five/chunks/ply.js +339 -0
  165. package/five/chunks/ply.mjs +339 -0
  166. package/five/chunks/spz.js +364 -0
  167. package/five/chunks/spz.mjs +364 -0
  168. package/five/core/webglBlendEquationFix.d.ts +41 -0
  169. package/five/index.d.ts +0 -1
  170. package/five/index.js +49 -626
  171. package/five/index.mjs +229 -32052
  172. package/five/model/index.d.ts +18 -6
  173. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz.d.ts +1 -1
  174. package/five/model/loaders/glTF-helpers/extensions/KHR_gaussian_splatting_compression_spz_2.d.ts +1 -1
  175. package/five/model/loaders/spz.d.ts +1 -2
  176. package/five/model/loaders/spz.worker.d.ts +37 -0
  177. package/five/renderer/five-renderer.d.ts +1 -1
  178. package/five/renderer/index.d.ts +1 -1
  179. package/five/renderer/postprocessing/passes/pass.js +3 -3
  180. package/five/renderer/postprocessing/passes/pass.mjs +3 -3
  181. package/five/renderer/tools/full-screen-quad.js +3 -3
  182. package/five/renderer/tools/full-screen-quad.mjs +3 -3
  183. package/five/texture/videoTextureBridge.d.ts +124 -15
  184. package/five/thirdparty/sha256.d.ts +149 -0
  185. package/five/utils/calculateThreeMouse.js +3 -3
  186. package/five/utils/calculateThreeMouse.mjs +3 -3
  187. package/five/utils/distance.js +3 -3
  188. package/five/utils/distance.mjs +3 -3
  189. package/five/utils/isNil.js +3 -3
  190. package/five/utils/isNil.mjs +3 -3
  191. package/five/utils/memoryUsage.d.ts +1 -1
  192. package/five/utils/uuid.js +3 -3
  193. package/five/utils/uuid.mjs +3 -3
  194. package/five/work/work.d.ts +0 -7
  195. package/five/work/workJsonType.d.ts +0 -2
  196. package/gltf-loader/index.js +3 -3
  197. package/gltf-loader/index.mjs +3 -50
  198. package/line/index.js +3 -3
  199. package/line/index.mjs +3 -88
  200. package/package.json +1 -1
  201. package/plugins/BackgroundPlugin/Controller.js +4 -4
  202. package/plugins/BackgroundPlugin/Controller.mjs +4 -4
  203. package/plugins/BackgroundPlugin/index.js +3 -3
  204. package/plugins/BackgroundPlugin/index.mjs +3 -3
  205. package/plugins/BasePlugin/index.js +3 -3
  206. package/plugins/BasePlugin/index.mjs +3 -3
  207. package/plugins/CSS2DPlugin/Controller.js +3 -3
  208. package/plugins/CSS2DPlugin/Controller.mjs +3 -3
  209. package/plugins/CSS2DPlugin/index.js +3 -3
  210. package/plugins/CSS2DPlugin/index.mjs +3 -3
  211. package/plugins/CSS2DPlugin/style.css_raw.js +4 -4
  212. package/plugins/CSS2DPlugin/style.css_raw.mjs +4 -4
  213. package/plugins/CSS3DPlugin/Controller.js +3 -3
  214. package/plugins/CSS3DPlugin/Controller.mjs +3 -3
  215. package/plugins/CSS3DPlugin/index.js +3 -3
  216. package/plugins/CSS3DPlugin/index.mjs +3 -3
  217. package/plugins/CSS3DPlugin/style.css_raw.js +4 -4
  218. package/plugins/CSS3DPlugin/style.css_raw.mjs +4 -4
  219. package/plugins/FloorplanPlugin/Controller.js +3 -3
  220. package/plugins/FloorplanPlugin/Controller.mjs +3 -3
  221. package/plugins/FloorplanPlugin/index.js +3 -3
  222. package/plugins/FloorplanPlugin/index.mjs +3 -3
  223. package/plugins/FloorplanPlugin/render/assets.js +3 -3
  224. package/plugins/FloorplanPlugin/render/assets.mjs +3 -3
  225. package/plugins/FloorplanPlugin/render/index.js +3 -3
  226. package/plugins/FloorplanPlugin/render/index.mjs +3 -3
  227. package/plugins/FloorplanPlugin/render/isPointInPolygon.js +3 -3
  228. package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +3 -3
  229. package/plugins/FloorplanPlugin/render/renderFloor.js +3 -3
  230. package/plugins/FloorplanPlugin/render/renderFloor.mjs +3 -3
  231. package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +3 -3
  232. package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +3 -3
  233. package/plugins/FloorplanPlugin/render/style.css_raw.js +4 -4
  234. package/plugins/FloorplanPlugin/render/style.css_raw.mjs +4 -4
  235. package/plugins/FloorplanPlugin/utils/changeMode.js +3 -3
  236. package/plugins/FloorplanPlugin/utils/changeMode.mjs +3 -3
  237. package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +3 -3
  238. package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +3 -3
  239. package/plugins/FloorplanPlugin/utils/correctFiveState.js +3 -3
  240. package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +3 -3
  241. package/plugins/FloorplanPlugin/utils/equal.js +3 -3
  242. package/plugins/FloorplanPlugin/utils/equal.mjs +3 -3
  243. package/plugins/FloorplanPlugin/utils/filter.js +3 -3
  244. package/plugins/FloorplanPlugin/utils/filter.mjs +3 -3
  245. package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +3 -3
  246. package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +3 -3
  247. package/plugins/FloorplanPlugin/utils/formatData.js +3 -3
  248. package/plugins/FloorplanPlugin/utils/formatData.mjs +3 -3
  249. package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +3 -3
  250. package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +3 -3
  251. package/plugins/FloorplanPlugin/utils/formatPosition.js +3 -3
  252. package/plugins/FloorplanPlugin/utils/formatPosition.mjs +3 -3
  253. package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +3 -3
  254. package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +3 -3
  255. package/plugins/FloorplanPlugin/utils/getPxmm.js +3 -3
  256. package/plugins/FloorplanPlugin/utils/getPxmm.mjs +3 -3
  257. package/plugins/FloorplanPlugin/utils/isTruelyObject.js +3 -3
  258. package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +3 -3
  259. package/plugins/FloorplanPlugin/utils/nearlyEqual.js +3 -3
  260. package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +3 -3
  261. package/plugins/FloorplanPlugin/utils/polylabel.js +3 -3
  262. package/plugins/FloorplanPlugin/utils/polylabel.mjs +3 -3
  263. package/plugins/FloorplanPlugin/utils/to.js +3 -3
  264. package/plugins/FloorplanPlugin/utils/to.mjs +3 -3
  265. package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +3 -3
  266. package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +3 -3
  267. package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +3 -3
  268. package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +3 -3
  269. package/plugins/Object3DHelperPlugin/Controller.js +3 -3
  270. package/plugins/Object3DHelperPlugin/Controller.mjs +3 -3
  271. package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +3 -3
  272. package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +3 -3
  273. package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +3 -3
  274. package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +3 -3
  275. package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +3 -3
  276. package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +3 -3
  277. package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +3 -3
  278. package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +3 -3
  279. package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +3 -3
  280. package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +3 -3
  281. package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +3 -3
  282. package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +3 -3
  283. package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +3 -3
  284. package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +3 -3
  285. package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +3 -3
  286. package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +3 -3
  287. package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +3 -3
  288. package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +3 -3
  289. package/plugins/Object3DHelperPlugin/constant.js +3 -3
  290. package/plugins/Object3DHelperPlugin/constant.mjs +3 -3
  291. package/plugins/Object3DHelperPlugin/index.js +3 -3
  292. package/plugins/Object3DHelperPlugin/index.mjs +3 -3
  293. package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +3 -3
  294. package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +3 -3
  295. package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +3 -3
  296. package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +3 -3
  297. package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +3 -3
  298. package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +3 -3
  299. package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +3 -3
  300. package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +3 -3
  301. package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +3 -3
  302. package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +3 -3
  303. package/plugins/Object3DHelperPlugin/utils/direction.js +3 -3
  304. package/plugins/Object3DHelperPlugin/utils/direction.mjs +3 -3
  305. package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +3 -3
  306. package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +3 -3
  307. package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +3 -3
  308. package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +3 -3
  309. package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +3 -3
  310. package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +3 -3
  311. package/plugins/Object3DHelperPlugin/utils/solidGuide.js +3 -3
  312. package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +3 -3
  313. package/plugins/Object3DHelperPlugin/utils/tipsDom.js +3 -3
  314. package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +3 -3
  315. package/plugins/PanoAnimePlugin/Controller.js +3 -3
  316. package/plugins/PanoAnimePlugin/Controller.mjs +3 -3
  317. package/plugins/PanoAnimePlugin/index.js +3 -3
  318. package/plugins/PanoAnimePlugin/index.mjs +3 -3
  319. package/plugins/WordPassPlugin/Controller.js +3 -3
  320. package/plugins/WordPassPlugin/Controller.mjs +3 -3
  321. package/plugins/WordPassPlugin/hersheyFont.js +3 -3
  322. package/plugins/WordPassPlugin/hersheyFont.mjs +3 -3
  323. package/plugins/WordPassPlugin/index.js +3 -3
  324. package/plugins/WordPassPlugin/index.mjs +3 -3
  325. package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +4 -4
  326. package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +4 -4
  327. package/plugins/WordPassPlugin/word-pass.js +3 -3
  328. package/plugins/WordPassPlugin/word-pass.mjs +3 -3
  329. package/plugins/index.js +3 -3
  330. package/plugins/index.mjs +3 -3
  331. package/plugins/thirdParty/CSS2DRenderer.js +3 -3
  332. package/plugins/thirdParty/CSS2DRenderer.mjs +3 -3
  333. package/plugins/thirdParty/CSS3DRenderer.js +3 -3
  334. package/plugins/thirdParty/CSS3DRenderer.mjs +3 -3
  335. package/plugins/thirdParty/doctorstrange-model.js +75 -75
  336. package/plugins/thirdParty/doctorstrange-model.mjs +75 -75
  337. package/plugins/thirdParty/domevents.js +3 -3
  338. package/plugins/thirdParty/domevents.mjs +3 -3
  339. package/plugins/utils/absoluteUrl.js +3 -3
  340. package/plugins/utils/absoluteUrl.mjs +3 -3
  341. package/plugins/utils/calculatePath.js +3 -3
  342. package/plugins/utils/calculatePath.mjs +3 -3
  343. package/plugins/utils/clamp.js +3 -3
  344. package/plugins/utils/clamp.mjs +3 -3
  345. package/plugins/utils/uuid.js +3 -3
  346. package/plugins/utils/uuid.mjs +3 -3
  347. package/react/hooks/useFiveModelReadyState.d.ts +1 -1
  348. package/react/index.js +3 -3
  349. package/react/index.mjs +3 -644
  350. package/sticker/index.js +13 -4
  351. package/sticker/index.mjs +43 -260
  352. package/umd/five-gltf-loader.js +3 -3
  353. package/umd/five-line.js +3 -3
  354. package/umd/five-plugins.js +2 -2
  355. package/umd/five-react.js +2 -2
  356. package/umd/five-sticker.js +13 -4
  357. package/umd/five-vfx.js +2 -2
  358. package/umd/five.js +154 -192
  359. package/vfx/index.js +3 -3
  360. package/vfx/index.mjs +3 -486
  361. package/work-downloader/index.js +3 -3
  362. package/work-downloader/index.mjs +3 -315
  363. package/docs/functions/index.loadAt3d.html +0 -1
  364. package/docs/functions/index.loadDome.html +0 -1
  365. package/docs/functions/index.loadDomez.html +0 -1
  366. package/docs/functions/index.loadGltf.html +0 -1
  367. package/docs/functions/index.loadPbm.html +0 -1
  368. package/docs/functions/index.loadPly.html +0 -10
  369. package/five/certificates/hardware.d.ts +0 -1
  370. package/five/thirdparty/jsrsasign.d.ts +0 -753
  371. package/five/work/_ALLOW_HOST.d.ts +0 -2
  372. package/five/work/keychain.d.ts +0 -5
  373. package/five/work/verify.d.ts +0 -7
  374. package/five/work/workVerify.d.ts +0 -2
package/vfx/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 2026/10/30
5
- * Version: 1.0.0-alpha.13
4
+ * Generated: 2026/11/3
5
+ * Version: 1.0.0-alpha.14
6
6
  * License:
7
7
  * Realsee SDK License Agreement
8
8
 
@@ -335,487 +335,4 @@
335
335
  * writing and signed by Realsee. You and Realsee hereto confirm that this
336
336
  * Agreement and all related documents shall be drafted in English.
337
337
 
338
- */import * as e from "three/webgpu";
339
- import { Discard as t, Fn as n, If as r, abs as i, attribute as a, cameraProjectionMatrix as o, clamp as s, cos as c, distance as l, dot as u, float as d, floor as f, max as p, mix as m, mod as h, modelViewMatrix as g, normalLocal as _, positionGeometry as v, positionWorld as y, pow as b, sRGBTransferEOTF as x, sin as S, step as C, texture as w, transformNormalToView as T, uniform as E, varyingProperty as D, vec2 as O, vec3 as k, vec4 as A } from "three/tsl";
340
- //#region build/vfx/common/simplex-noise.js
341
- var j = n(([e]) => h(e.mul(34).add(1).mul(e), 289)), M = n(([e]) => f(h(e.mul(34).add(1).mul(e), 289))), N = n(([e]) => d(1.79284291400159).sub(e.mul(.85373472095314))), P = n(([e]) => d(1.79284291400159).sub(e.mul(.85373472095314))), F = n(([e, t]) => {
342
- let n = A(1, 1, 1, -1), r = A(0, 0, 0, 0).toVar();
343
- r.xyz = f(k(e, e, e).mul(t.xyz).fract().mul(7)).mul(t.z).sub(1);
344
- let a = i(r.xyz);
345
- r.w = d(1.5).sub(u(a, n.xyz));
346
- let o = d(1).sub(C(A(0, 0, 0, 0), r));
347
- return r.xyz = r.xyz.add(o.xyz.mul(2).sub(1).mul(o.www)), r;
348
- }), I = n(([e]) => {
349
- let t = O(.1381966011250105, .30901699437494745), n = f(e.add(u(e, t.yyyy))).toVar(), r = e.sub(n).add(u(n, t.xxxx)).toVar(), i = A(0, 0, 0, 0).toVar(), a = C(r.yzw, r.xxx), o = C(r.zww, r.yyz);
350
- i.x = a.x.add(a.y).add(a.z), i.yzw = d(1).sub(a), i.y = i.y.add(o.x).add(o.y), i.zw = i.zw.add(d(1).sub(o.xy)), i.z = i.z.add(o.z), i.w = i.w.add(d(1).sub(o.z));
351
- let s = i.clamp(0, 1), c = i.sub(1).clamp(0, 1), l = i.sub(2).clamp(0, 1), m = r.sub(l).add(t.xxxx.mul(1)), g = r.sub(c).add(t.xxxx.mul(2)), _ = r.sub(s).add(t.xxxx.mul(3)), v = r.sub(1).add(t.xxxx.mul(4)), y = h(n, 289), b = M(M(M(M(y.w).add(y.z)).add(y.y)).add(y.x)), x = j(j(j(j(y.w.add(A(l.w, c.w, s.w, 1))).add(y.z).add(A(l.z, c.z, s.z, 1))).add(y.y).add(A(l.y, c.y, s.y, 1))).add(y.x).add(A(l.x, c.x, s.x, 1))), S = A(1 / 294, 1 / 49, 1 / 7, 0), w = F(b, S).toVar(), T = F(x.x, S).toVar(), E = F(x.y, S).toVar(), D = F(x.z, S).toVar(), I = F(x.w, S).toVar(), L = N(A(u(w, w), u(T, T), u(E, E), u(D, D)));
352
- w.assign(w.mul(L.x)), T.assign(T.mul(L.y)), E.assign(E.mul(L.z)), D.assign(D.mul(L.w)), I.assign(I.mul(P(u(I, I))));
353
- let R = p(d(.6).sub(k(u(r, r), u(m, m), u(g, g))), k(0, 0, 0)), z = p(d(.6).sub(O(u(_, _), u(v, v))), O(0, 0)), B = R.mul(R), V = z.mul(z);
354
- return d(49).mul(u(B.mul(B), k(u(w, r), u(T, m), u(E, g))).add(u(V.mul(V), O(u(D, _), u(I, v)))));
355
- }), L = new e.SphereGeometry(1, 300, 300), R = [];
356
- for (let t = 0; t < 2; t++) R.push(new e.Vector2(Math.sin(t) / 2 + 1, t * 2 - .8));
357
- var z = new e.LatheGeometry(R, 300);
358
- function B(e, t, n, r, i) {
359
- return e.sub(t).mul((i - r) / (n - t)).add(r);
360
- }
361
- function V(t, r, i) {
362
- let a = D("float", "flNoise"), o = D("vec3", "flPosition"), c = Math.max(1, Math.round(i)), l = n(() => {
363
- let e = v;
364
- o.assign(e);
365
- let n = A(e.div(t.uNoise).sub(k(0, t.uTime.mul(t.uSpeed), 0)), 0), r = d(0), i = .5;
366
- for (let e = 0; e < c; e++) r = r.add(I(n).mul(i)), n = n.mul(2).add(100), i *= .5;
367
- return a.assign(B(r, -1, 1, 0, 1)), e;
368
- }), u = n(() => {
369
- let e = o.y, n = m(d(0), d(1), e.add(1.75)), r = d(1).sub(n.mul(.3).step(a)), i = m(d(.3), d(1), e.add(.5)), c = s(r.mul(i.mul(10)), 0, 1), l = m(t.uColor2, t.uColor1, e.add(.5)), u = l.y.mul(d(1).add(n.mul(a)));
370
- return A(x(k(l.x, u, l.z)), c.mul(t.uOpacity));
371
- }), f = new e.NodeMaterial();
372
- return f.positionNode = l(), f.fragmentNode = u(), f.transparent = !0, f.depthWrite = !1, f.side = r, f;
373
- }
374
- var H = class extends e.Group {
375
- constructor(t) {
376
- super(), this.needsRender = !0, t instanceof e.BufferGeometry ? this.geometry = t : t === "ring" ? this.geometry = z : this.geometry = L, this._color1 = new e.Color("rgb(255, 177, 20)").convertLinearToSRGB(), this._color2 = new e.Color("rgb(255, 0, 0)").convertLinearToSRGB(), this.u = {
377
- uTime: E(0),
378
- uColor1: E(new e.Vector3(this._color1.r, this._color1.g, this._color1.b)),
379
- uColor2: E(new e.Vector3(this._color2.r, this._color2.g, this._color2.b)),
380
- uNoise: E(1.2),
381
- uSpeed: E(1),
382
- uOpacity: E(1)
383
- }, this._fragmentationDegree = 2, this.innerMesh = new e.Mesh(this.geometry, V(this.u, e.BackSide, this._fragmentationDegree)), this.outerMesh = new e.Mesh(this.geometry, V(this.u, e.FrontSide, this._fragmentationDegree)), this.innerMesh.scale.setScalar(.1), this.outerMesh.scale.setScalar(.1), this.add(this.innerMesh), this.add(this.outerMesh);
384
- }
385
- setTime(e) {
386
- this.startTime === void 0 && (this.startTime = e), this.u.uTime.value = (e - this.startTime) / 1e3, this.needsRender = !0;
387
- }
388
- set color1(e) {
389
- this._color1 = e.clone().convertLinearToSRGB(), this.u.uColor1.value.set(e.r, e.g, e.b), this.needsRender = !0;
390
- }
391
- get color1() {
392
- return this._color1;
393
- }
394
- set color2(e) {
395
- this._color2 = e.clone().convertLinearToSRGB(), this.u.uColor2.value.set(e.r, e.g, e.b), this.needsRender = !0;
396
- }
397
- get color2() {
398
- return this._color2;
399
- }
400
- set speed(e) {
401
- this.u.uSpeed.value = e, this.needsRender = !0;
402
- }
403
- get speed() {
404
- return this.u.uSpeed.value;
405
- }
406
- set noise(e) {
407
- this.u.uNoise.value = e, this.needsRender = !0;
408
- }
409
- get noise() {
410
- return this.u.uNoise.value;
411
- }
412
- set opacity(e) {
413
- this.u.uOpacity.value = e, this.needsRender = !0;
414
- }
415
- get opacity() {
416
- return this.u.uOpacity.value;
417
- }
418
- set fragmentationDegree(t) {
419
- t !== this._fragmentationDegree && (this._fragmentationDegree = t, this.innerMesh.material.dispose(), this.outerMesh.material.dispose(), this.innerMesh.material = V(this.u, e.BackSide, t), this.outerMesh.material = V(this.u, e.FrontSide, t), this.needsRender = !0);
420
- }
421
- get fragmentationDegree() {
422
- return this._fragmentationDegree;
423
- }
424
- };
425
- //#endregion
426
- //#region build/vfx/spotLight/spotLight.js
427
- function U(e, t, n, r, i) {
428
- return e.sub(t).mul((i - r) / (n - t)).add(r);
429
- }
430
- function W() {
431
- let t = {
432
- uTime: E(0),
433
- uAttenuation: E(0),
434
- uAnglePower: E(2),
435
- uSpotPosition: E(new e.Vector3()),
436
- uLightColor: E(new e.Color(16777215))
437
- }, r = D("vec3", "slWorldPosition"), a = D("vec3", "slNormal"), o = D("float", "slNoise"), c = n(() => {
438
- a.assign(T(_).normalize()), r.assign(y);
439
- let e = I(A(v.sub(k(0, t.uTime.mul(.4), 0)), 0));
440
- return o.assign(U(e, -1, 1, .5, 1)), v;
441
- }), f = n(() => {
442
- let e = l(r, t.uSpotPosition).div(t.uAttenuation);
443
- e = d(1).sub(s(e, .1, 1));
444
- let n = k(a.x, a.y, i(a.z)), c = d(t.uAnglePower).mul(o), f = b(u(n, k(0, 0, 1)), c);
445
- return e = e.mul(f).mul(o), A(t.uLightColor, e);
446
- }), p = new e.NodeMaterial();
447
- return p.positionNode = c(), p.fragmentNode = f(), p.transparent = !0, p.side = e.FrontSide, p.depthWrite = !1, {
448
- material: p,
449
- u: t
450
- };
451
- }
452
- var G = class extends e.Group {
453
- constructor(t = 1, n = .1, r = .2) {
454
- super(), this.needsRender = !0;
455
- let { material: i, u: a } = W();
456
- this.u = a, this.u.uAttenuation.value = t * .9, this.u.uSpotPosition.value.copy(this.position);
457
- let o = new e.CylinderGeometry(n, r, t, 64, 20, !0);
458
- o.applyMatrix4(new e.Matrix4().makeTranslation(0, -t / 2, 0)), o.applyMatrix4(new e.Matrix4().makeRotationX(-Math.PI / 2));
459
- let s = new e.Mesh(o, i);
460
- this.add(s);
461
- }
462
- setTime(e) {
463
- this.startTime === void 0 && (this.startTime = e), this.u.uTime.value = (e - this.startTime) / 1e3, this.u.uSpotPosition.value.copy(this.position), this.needsRender = !0;
464
- }
465
- set attenuation(e) {
466
- this.u.uAttenuation.value = e, this.needsRender = !0;
467
- }
468
- get attenuation() {
469
- return this.u.uAttenuation.value;
470
- }
471
- set anglePower(e) {
472
- this.u.uAnglePower.value = e, this.needsRender = !0;
473
- }
474
- get anglePower() {
475
- return this.u.uAnglePower.value;
476
- }
477
- set color(e) {
478
- this.u.uLightColor.value = e, this.needsRender = !0;
479
- }
480
- get color() {
481
- return this.u.uLightColor.value;
482
- }
483
- }, K = new e.PlaneGeometry(1, 1, 200, 200);
484
- K.translate(0, -.5, 0);
485
- function q(e, t, n, r, i) {
486
- return e.sub(t).mul((i - r) / (n - t)).add(r);
487
- }
488
- function J(t) {
489
- let r = {
490
- uTime: E(0),
491
- uSpeed: E(t.speed),
492
- uScale: E(t.scale),
493
- uExpand: E(t.expand),
494
- uColor: E(t.color),
495
- uOpacity: E(t.opacity)
496
- }, i = D("float", "afNoise"), a = D("vec3", "afPosition"), o = n(() => {
497
- let e = v;
498
- a.assign(e);
499
- let t = I(A(e.x.mul(r.uScale), e.y.add(r.uTime.mul(r.uSpeed)), 0, 0));
500
- i.assign(q(t, 0, 1, .5, 1));
501
- let n = d(1).add(e.y.abs().mul(r.uExpand.sub(1)));
502
- return k(e.x.mul(n), e.y, e.z);
503
- }), s = n(() => {
504
- let e = m(d(0), d(1), d(1).add(a.y)), t = i.mul(e).mul(r.uOpacity);
505
- return A(r.uColor, t);
506
- }), c = new e.NodeMaterial();
507
- return c.positionNode = o(), c.fragmentNode = s(), c.transparent = !0, c.side = e.DoubleSide, c.depthWrite = !1, {
508
- material: c,
509
- u: r
510
- };
511
- }
512
- var ee = class extends e.Group {
513
- constructor() {
514
- super(), this.needsRender = !0;
515
- let t = J({
516
- speed: .75,
517
- scale: 2,
518
- expand: 1.2,
519
- color: new e.Color(.5, .5, .9),
520
- opacity: 1
521
- }), n = J({
522
- speed: 2,
523
- scale: 20,
524
- expand: 1.2,
525
- color: new e.Color(1, 1, 1),
526
- opacity: .1
527
- });
528
- this.outerU = t.u, this.innerU = n.u;
529
- let r = new e.Mesh(K, t.material), i = new e.Mesh(K, n.material);
530
- r.rotateX(-Math.PI / 2), i.rotateX(-Math.PI / 2), this.add(r), this.add(i);
531
- }
532
- setTime(e) {
533
- this.startTime === void 0 && (this.startTime = e);
534
- let t = (e - this.startTime) / 1e3;
535
- this.innerU.uTime.value = t, this.outerU.uTime.value = t, this.needsRender = !0;
536
- }
537
- get expand() {
538
- return this.outerU.uExpand.value;
539
- }
540
- set expand(e) {
541
- this.outerU.uExpand.value = e, this.innerU.uExpand.value = e, this.needsRender = !0;
542
- }
543
- get speed() {
544
- return this.innerU.uSpeed.value;
545
- }
546
- set speed(e) {
547
- this.innerU.uSpeed.value = e, this.needsRender = !0;
548
- }
549
- get color() {
550
- return this.outerU.uColor.value;
551
- }
552
- set color(e) {
553
- this.outerU.uColor.value = e, this.needsRender = !0;
554
- }
555
- get flowColor() {
556
- return this.innerU.uColor.value;
557
- }
558
- set flowColor(e) {
559
- this.innerU.uColor.value = e, this.needsRender = !0;
560
- }
561
- };
562
- //#endregion
563
- //#region build/vfx/particle/utils.js
564
- function Y(e, t) {
565
- return e + t * (Math.random() - .5);
566
- }
567
- function X(t, n) {
568
- let r = new e.Vector3(Math.random() - .5, Math.random() - .5, Math.random() - .5);
569
- return new e.Vector3().addVectors(t, new e.Vector3().multiplyVectors(n, r));
570
- }
571
- function Z(e, t, n) {
572
- return e * n + t * n * n / 2;
573
- }
574
- function te(t, n, r) {
575
- return new e.Vector3(Z(t.x, n.x, r), Z(t.y, n.y, r), Z(t.z, n.z, r));
576
- }
577
- function ne(e, t) {
578
- let n = e.times.length, r = 0;
579
- for (; r < n && t > e.times[r];) r++;
580
- if (r == 0) return e.values[0];
581
- if (r == n) return e.values[n - 1];
582
- let i = (t - e.times[r - 1]) / (e.times[r] - e.times[r - 1]), a = e.values[r - 1], o = e.values[r];
583
- return typeof e.values[0] == "number" ? a + i * (o - a) : a.clone().lerp(o, i);
584
- }
585
- //#endregion
586
- //#region build/vfx/particle/instance.js
587
- var re = class {
588
- constructor(e, t, n, r, i, a, o, s, c, l, u, d, f, p) {
589
- this.birthTime = e, this.deathAge = t, this.position = n.clone(), this.velocity = r.clone(), this.acceleration = i.clone(), this.angle = a, this.angleVelocity = o, this.angleAcceleration = s, this.color = c, this.colorTween = l, this.size = u, this.sizeTween = d, this.opacity = f, this.opacityTween = p;
590
- }
591
- getAlive(e) {
592
- return this.deathAge > e - this.birthTime;
593
- }
594
- getState(t) {
595
- let n = this.getAlive(t), r = Math.min(this.deathAge, t - this.birthTime), i = te(this.velocity, this.acceleration, r).add(this.position), a = Z(this.angleVelocity, this.angleAcceleration, r) + this.angle, o = (this.sizeTween ? ne(this.sizeTween, r) : 0) + this.size, s = (this.colorTween ? ne(this.colorTween, r) : new e.Vector3()).add(this.color);
596
- return {
597
- alive: n,
598
- age: r,
599
- position: i,
600
- angle: a,
601
- size: o,
602
- color: new e.Color().setHSL(s.x, s.y, s.z).convertLinearToSRGB(),
603
- opacity: (this.opacityTween ? ne(this.opacityTween, r) : 0) + this.opacity
604
- };
605
- }
606
- }, ie = class extends e.Mesh {
607
- constructor(t) {
608
- var n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, T, D, O, k, A, j, M, N, P, F, I, L, R, z, B, V;
609
- let H = new e.PlaneGeometry(1, 1, 1, 1), U = new e.InstancedBufferGeometry();
610
- U.index = H.index, U.attributes = H.attributes, U.instanceCount = 0;
611
- let W = (n = t.texture) == null ? null : n;
612
- W && (W.colorSpace = e.NoColorSpace);
613
- let G = {
614
- map: w(W == null ? new e.Texture() : W),
615
- useMap: E(+!!W),
616
- resolution: E(new e.Vector2(1, 1))
617
- }, K = ae(G);
618
- K.blending = (r = t.blending) == null ? e.NormalBlending : r, K.transparent = !0, K.depthWrite = !1, super(U, K), this.instances = [], this.capacity = 0, this.instGeometry = U, this.particleMaterial = K, this.u = G, this._texture = W, this.frustumCulled = !1, this.needsRender = !0, this.birthTime = Date.now() / 1e3, this.disposed = !1, this.paused = !1, this.positionBase = (a = (i = t.positionBase) == null ? void 0 : i.clone()) == null ? new e.Vector3() : a, this.positionStyle = (o = t.positionStyle) == null ? "CUBE" : o, this.positionCubeSpread = (c = (s = t.positionCubeSpread) == null ? void 0 : s.clone()) == null ? new e.Vector3() : c, this.positionSphereSpread = (l = t.positionSphereSpread) == null ? 0 : l, this.velocityStyle = (u = t.velocityStyle) == null ? "CUBE" : u, this.velocityCubeBase = (f = (d = t.velocityCubeBase) == null ? void 0 : d.clone()) == null ? new e.Vector3() : f, this.velocityCubeSpread = (m = (p = t.velocityCubeSpread) == null ? void 0 : p.clone()) == null ? new e.Vector3() : m, this.velocitySphereBase = (h = t.velocitySphereBase) == null ? 0 : h, this.velocitySphereSpread = (g = t.velocitySphereSpread) == null ? 0 : g, this.accelerationBase = (v = (_ = t.accelerationBase) == null ? void 0 : _.clone()) == null ? new e.Vector3() : v, this.accelerationSpread = (b = (y = t.accelerationSpread) == null ? void 0 : y.clone()) == null ? new e.Vector3() : b, this.angleBase = (x = t.angleBase) == null ? 0 : x, this.angleSpread = (S = t.angleSpread) == null ? 0 : S, this.angleVelocityBase = (C = t.angleVelocityBase) == null ? 0 : C, this.angleVelocitySpread = (T = t.angleVelocitySpread) == null ? 0 : T, this.angleAccelerationBase = (D = t.angleAccelerationBase) == null ? 0 : D, this.angleAccelerationSpread = (O = t.angleAccelerationSpread) == null ? 0 : O, this.sizeBase = (k = t.sizeBase) == null ? .1 : k, this.sizeSpread = (A = t.sizeSpread) == null ? 0 : A, this.sizeTween = (j = t.sizeTween) == null ? null : j, this.colorBase = (N = (M = t.colorBase) == null ? void 0 : M.clone()) == null ? new e.Vector3() : N, this.colorSpread = (F = (P = t.colorSpread) == null ? void 0 : P.clone()) == null ? new e.Vector3() : F, this.colorTween = (I = t.colorTween) == null ? null : I, this.opacityBase = ((L = t.opacityBase) == null ? t.opacityTween : L) ? 0 : 1, this.opacitySpread = (R = t.opacitySpread) == null ? 0 : R, this.opacityTween = (z = t.opacityTween) == null ? null : z, this.particlesPerSecond = (B = t.particlesPerSecond) == null ? 60 : B, this.particleDeathAge = (V = t.particleDeathAge) == null ? 1 : V;
619
- }
620
- get texture() {
621
- return this._texture;
622
- }
623
- set texture(t) {
624
- this._texture = t, this.u.map.value = t == null ? new e.Texture() : t, this.u.useMap.value = +!!t, this.needsRender = !0;
625
- }
626
- get blending() {
627
- return this.particleMaterial.blending;
628
- }
629
- set blending(e) {
630
- this.particleMaterial.blending = e;
631
- }
632
- ensureCapacity(t) {
633
- if (this.capacity >= t) return;
634
- let n = (e, n) => {
635
- let r = new Float32Array(t * n);
636
- return e && r.set(e, 0), r;
637
- };
638
- this.arrPosition = n(this.arrPosition, 3), this.arrColor = n(this.arrColor, 3), this.arrOpacity = n(this.arrOpacity, 1), this.arrSize = n(this.arrSize, 1), this.arrAngle = n(this.arrAngle, 1), this.arrAlive = n(this.arrAlive, 1), this.capacity = t, this.instGeometry.setAttribute("iPosition", new e.InstancedBufferAttribute(this.arrPosition, 3)), this.instGeometry.setAttribute("iColor", new e.InstancedBufferAttribute(this.arrColor, 3)), this.instGeometry.setAttribute("iOpacity", new e.InstancedBufferAttribute(this.arrOpacity, 1)), this.instGeometry.setAttribute("iSize", new e.InstancedBufferAttribute(this.arrSize, 1)), this.instGeometry.setAttribute("iAngle", new e.InstancedBufferAttribute(this.arrAngle, 1)), this.instGeometry.setAttribute("iAlive", new e.InstancedBufferAttribute(this.arrAlive, 1));
639
- }
640
- createInstance(t) {
641
- let n = this.positionBase.clone();
642
- switch (this.positionStyle) {
643
- case "CUBE":
644
- n = X(this.positionBase, this.positionCubeSpread);
645
- break;
646
- case "SPHERE": {
647
- let t = 2 * Math.random() - 1, r = Math.PI * 2 * Math.random(), i = Math.sqrt(1 - t * t), a = new e.Vector3(i * Math.cos(r), i * Math.sin(r), t);
648
- n = new e.Vector3().addVectors(this.positionBase, a.multiplyScalar(this.positionSphereSpread));
649
- break;
650
- }
651
- }
652
- let r = new e.Vector3();
653
- switch (this.velocityStyle) {
654
- case "CUBE":
655
- r = X(this.velocityCubeBase, this.velocityCubeSpread);
656
- break;
657
- case "SPHERE": {
658
- let t = new e.Vector3().subVectors(n, this.positionBase), i = Y(this.velocitySphereBase, this.velocitySphereSpread);
659
- r = t.normalize().multiplyScalar(i);
660
- break;
661
- }
662
- }
663
- return new re(t, this.particleDeathAge, n, r, X(this.accelerationBase, this.accelerationSpread), Y(this.angleBase, this.angleSpread), Y(this.angleVelocityBase, this.angleVelocitySpread), Y(this.angleAccelerationBase, this.angleAccelerationSpread), X(this.colorBase, this.colorSpread), this.colorTween, Y(this.sizeBase, this.sizeSpread), this.sizeTween, Y(this.opacityBase, this.opacitySpread), this.opacityTween);
664
- }
665
- pause() {
666
- this.paused !== !0 && (this.paused = !0, this.birthTime = Date.now() / 1e3);
667
- }
668
- play() {
669
- this.paused !== !1 && (this.paused = !1, this.birthTime = Date.now() / 1e3);
670
- }
671
- setTime(e) {
672
- if (this.disposed) return;
673
- e /= 1e3;
674
- let t = e - this.birthTime, n = Math.ceil(this.particlesPerSecond * this.particleDeathAge);
675
- this.ensureCapacity(n), this.instances.length < n && (this.instances.length = n), this.instGeometry.instanceCount = n;
676
- for (let r = 0; r < this.instances.length; r++) {
677
- let i = this.instances[r];
678
- if (r < n && this.paused === !1 && (i === void 0 || i.getAlive(e) === !1)) {
679
- let a = this.particleDeathAge / n * r;
680
- if (t > a) {
681
- let n = e - (t - a) % this.particleDeathAge;
682
- this.instances[r] = i = this.createInstance(n);
683
- }
684
- }
685
- if (i) {
686
- let { position: t, alive: n, color: a, opacity: o, size: s, angle: c } = i.getState(e);
687
- this.arrPosition[r * 3] = t.x, this.arrPosition[r * 3 + 1] = t.y, this.arrPosition[r * 3 + 2] = t.z, this.arrColor[r * 3] = a.r, this.arrColor[r * 3 + 1] = a.g, this.arrColor[r * 3 + 2] = a.b, this.arrOpacity[r] = o, this.arrSize[r] = s, this.arrAngle[r] = c, this.arrAlive[r] = +!!n;
688
- }
689
- }
690
- this.instGeometry.getAttribute("iPosition").needsUpdate = !0, this.instGeometry.getAttribute("iColor").needsUpdate = !0, this.instGeometry.getAttribute("iOpacity").needsUpdate = !0, this.instGeometry.getAttribute("iSize").needsUpdate = !0, this.instGeometry.getAttribute("iAngle").needsUpdate = !0, this.instGeometry.getAttribute("iAlive").needsUpdate = !0, this.needsRender = !0;
691
- }
692
- setResolution(e, t) {
693
- this.u.resolution.value.set(e, t);
694
- }
695
- dispose() {
696
- var e;
697
- this.disposed = !0, this.instGeometry.dispose(), (e = this._texture) == null || e.dispose(), this.particleMaterial.dispose();
698
- }
699
- };
700
- function ae(i) {
701
- let s = D("vec4", "pColor"), l = D("float", "pAngle"), u = n(() => {
702
- let e = a("iPosition", "vec3"), t = a("iColor", "vec3"), n = a("iOpacity", "float"), r = a("iSize", "float"), c = a("iAngle", "float"), u = a("iAlive", "float"), f = v.xy, m = n.mul(u);
703
- s.assign(A(t, m)), l.assign(c);
704
- let h = g.mul(A(e, 1)), _ = o.element(1).y, y = p(d(.5).mul(i.resolution.y).mul(_), 1e-4), b = r.mul(300).div(y).div(2), x = A(f.mul(b), 0, 0), S = h.add(x);
705
- return o.mul(S);
706
- }), f = n(() => {
707
- r(s.a.lessThanEqual(0), () => {
708
- t();
709
- });
710
- let e = O(v.x, v.y), n = c(l), a = S(l), o = n.mul(e.x).add(a.mul(e.y)).add(.5), u = n.mul(e.y).sub(a.mul(e.x)).add(.5), f = i.map.sample(O(o, u)), p = s.mul(f), m = s.rgb.mul(d(1).sub(i.useMap)).add(p.rgb.mul(i.useMap)), h = s.a.mul(d(1).sub(i.useMap)).add(p.a.mul(i.useMap));
711
- return A(x(m), h);
712
- }), m = new e.NodeMaterial();
713
- return m.vertexNode = u(), m.fragmentNode = f(), m;
714
- }
715
- //#endregion
716
- //#region build/vfx/particle-gpu/utils.js
717
- function Q(e, t) {
718
- return e + t * (Math.random() - .5);
719
- }
720
- function $(t, n) {
721
- let r = new e.Vector3(Math.random() - .5, Math.random() - .5, Math.random() - .5);
722
- return new e.Vector3().addVectors(t, new e.Vector3().multiplyVectors(n, r));
723
- }
724
- //#endregion
725
- //#region build/vfx/particle-gpu/particle.js
726
- var oe = class extends e.Mesh {
727
- constructor(t) {
728
- var n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, T, D, O, k, A, j, M, N, P, F, I, L;
729
- let R = Math.ceil(((n = t.particlesPerSecond) == null ? 60 : n) * ((r = t.particleDeathAge) == null ? 1 : r)), z = new Float32Array(R * 4), B = new Float32Array(R * 4), V = new Float32Array(R * 4), H = new Float32Array(R * 4), U = new Float32Array(R * 4);
730
- for (let n = 0; n < R; n++) {
731
- let r = n * 4, w = ((i = t.particleDeathAge) == null ? 1 : i) / R * n, E = (a = t.particleDeathAge) == null ? 1 : a, P = (s = (o = t.positionBase) == null ? void 0 : o.clone()) == null ? new e.Vector3() : s;
732
- switch ((c = t.positionStyle) == null ? "CUBE" : c) {
733
- case "CUBE":
734
- P = $((l = t.positionBase) == null ? new e.Vector3() : l, (u = t.positionCubeSpread) == null ? new e.Vector3() : u);
735
- break;
736
- case "SPHERE": {
737
- let n = 2 * Math.random() - 1, r = Math.PI * 2 * Math.random(), i = Math.sqrt(1 - n * n), a = new e.Vector3(i * Math.cos(r), i * Math.sin(r), n);
738
- P = new e.Vector3().addVectors((d = t.positionBase) == null ? new e.Vector3() : d, a.multiplyScalar((f = t.positionSphereSpread) == null ? 0 : f));
739
- break;
740
- }
741
- }
742
- let F = new e.Vector3();
743
- switch ((p = t.velocityStyle) == null ? "CUBE" : p) {
744
- case "CUBE":
745
- F = $((m = t.velocityCubeBase) == null ? new e.Vector3() : m, (h = t.velocityCubeSpread) == null ? new e.Vector3() : h);
746
- break;
747
- case "SPHERE": {
748
- let n = new e.Vector3().subVectors(P, (g = t.positionBase) == null ? new e.Vector3() : g), r = Q((_ = t.velocitySphereBase) == null ? 0 : _, (v = t.velocitySphereSpread) == null ? 0 : v);
749
- F = n.normalize().multiplyScalar(r);
750
- break;
751
- }
752
- }
753
- let I = $((y = t.accelerationBase) == null ? new e.Vector3() : y, (b = t.accelerationSpread) == null ? new e.Vector3() : b), L = Q((x = t.sizeBase) == null ? .1 : x, (S = t.sizeSpread) == null ? 0 : S), W = (C = t.sizeGrowth) == null ? 0 : C, G = $(new e.Vector3().setFromColor(new e.Color().setFromVector3((T = t.colorBase) == null ? new e.Vector3() : T).convertLinearToSRGB()), new e.Vector3().setFromColor(new e.Color().setFromVector3((D = t.colorSpread) == null ? new e.Vector3() : D).convertLinearToSRGB())), K = Q((O = t.opacityBase) == null ? 1 : O, (k = t.opacitySpread) == null ? 0 : k), q = Q((A = t.angleBase) == null ? 0 : A, (j = t.angleSpread) == null ? 0 : j), J = Q((M = t.angleVelocityBase) == null ? 0 : M, (N = t.angleVelocitySpread) == null ? 0 : N);
754
- z[r] = P.x, z[r + 1] = P.y, z[r + 2] = P.z, z[r + 3] = w, B[r] = F.x, B[r + 1] = F.y, B[r + 2] = F.z, B[r + 3] = E, V[r] = I.x, V[r + 1] = I.y, V[r + 2] = I.z, V[r + 3] = L, H[r] = G.x, H[r + 1] = G.y, H[r + 2] = G.z, H[r + 3] = W, U[r] = K, U[r + 1] = q, U[r + 2] = J, U[r + 3] = 0;
755
- }
756
- let W = new e.PlaneGeometry(1, 1, 1, 1), G = new e.InstancedBufferGeometry();
757
- G.index = W.index, G.attributes = W.attributes, G.instanceCount = R, G.setAttribute("iPack0", new e.InstancedBufferAttribute(z, 4)), G.setAttribute("iPack1", new e.InstancedBufferAttribute(B, 4)), G.setAttribute("iPack2", new e.InstancedBufferAttribute(V, 4)), G.setAttribute("iPack3", new e.InstancedBufferAttribute(H, 4)), G.setAttribute("iPack4", new e.InstancedBufferAttribute(U, 4));
758
- let K = (P = t.texture) == null ? null : P;
759
- K && (K.colorSpace = e.NoColorSpace);
760
- let q = {
761
- map: w(K == null ? new e.Texture() : K),
762
- useMap: E(+!!K),
763
- uTime: E(0),
764
- resolution: E(new e.Vector2(1, 1))
765
- }, J = ce(q);
766
- J.blending = (F = t.blending) == null ? e.NormalBlending : F, J.transparent = !0, J.depthWrite = !1, super(G, J), this.particleMaterial = J, this.u = q, this._texture = K, this.frustumCulled = !1, this.needsRender = !0, this.startTime = Date.now() / 1e3, this.disposed = !1, this.paused = !1, this.particleCount = R, this.particlesPerSecond = (I = t.particlesPerSecond) == null ? 60 : I, this.particleDeathAge = (L = t.particleDeathAge) == null ? 1 : L;
767
- }
768
- get texture() {
769
- return this._texture;
770
- }
771
- set texture(t) {
772
- this._texture = t, t && (t.colorSpace = e.NoColorSpace), this.u.map.value = t == null ? new e.Texture() : t, this.u.useMap.value = +!!t, this.needsRender = !0;
773
- }
774
- get blending() {
775
- return this.particleMaterial.blending;
776
- }
777
- set blending(e) {
778
- this.particleMaterial.blending = e;
779
- }
780
- pause() {
781
- this.paused !== !0 && (this.paused = !0, this.startTime = Date.now() / 1e3);
782
- }
783
- play() {
784
- this.paused !== !1 && (this.paused = !1, this.startTime = Date.now() / 1e3);
785
- }
786
- setTime(e) {
787
- if (this.disposed || this.paused) return;
788
- let t = e / 1e3 - this.startTime;
789
- this.u.uTime.value = t, this.needsRender = !0;
790
- }
791
- setResolution(e, t) {
792
- this.u.resolution.value.set(e, t);
793
- }
794
- dispose() {
795
- var e;
796
- this.disposed = !0, this.geometry.dispose(), (e = this._texture) == null || e.dispose(), this.particleMaterial.dispose();
797
- }
798
- };
799
- function se(e) {
800
- let t = s(h(e.x.mul(6).add(k(0, 4, 2)), 6).sub(3).abs().sub(1), 0, 1);
801
- return e.z.add(e.y.mul(t.sub(.5)).mul(d(1).sub(e.z.mul(2).sub(1).abs())));
802
- }
803
- function ce(i) {
804
- let l = D("vec4", "gpColor"), u = D("float", "gpAngle"), f = n(() => {
805
- let e = (e, t) => a(e, t), t = e("iPack0", "vec4"), n = e("iPack1", "vec4"), r = e("iPack2", "vec4"), c = e("iPack3", "vec4"), f = e("iPack4", "vec4"), m = t.xyz, _ = t.w, y = n.xyz, b = n.w, x = r.xyz, S = r.w, C = c.xyz, w = c.w, T = f.x, E = f.y, D = f.z, O = v.xy, k = h(i.uTime.add(_), b), j = s(k.div(b), 0, 1), M = y.add(x.mul(k)), N = m.add(M.mul(k)), P = S.add(w.mul(j));
806
- u.assign(E.add(D.mul(k)));
807
- let F = j.div(.1), I = d(1).sub(j).div(.2), L = T.mul(j.lessThan(.1).select(s(F, 0, 1), j.greaterThan(.8).select(s(I, 0, 1), d(1)))), R = se(C);
808
- l.assign(A(R, L));
809
- let z = g.mul(A(N, 1)), B = o.element(1).y, V = p(d(.5).mul(i.resolution.y).mul(B), 1e-4), H = P.mul(300).div(V).div(2), U = A(O.mul(H), 0, 0), W = z.add(U);
810
- return o.mul(W);
811
- }), m = n(() => {
812
- r(l.a.lessThanEqual(0), () => {
813
- t();
814
- });
815
- let e = O(v.x, v.y.negate()), n = c(u), a = S(u), o = n.mul(e.x).add(a.mul(e.y)).add(.5), s = n.mul(e.y).sub(a.mul(e.x)).add(.5), f = i.map.sample(O(o, s)), p = l.mul(f), m = l.rgb.mul(d(1).sub(i.useMap)).add(p.rgb.mul(i.useMap)), h = l.a.mul(d(1).sub(i.useMap)).add(p.a.mul(i.useMap));
816
- return A(x(m), h);
817
- }), _ = new e.NodeMaterial();
818
- return _.vertexNode = f(), _.fragmentNode = m(), _;
819
- }
820
- //#endregion
821
- export { ee as Airflow, H as Flame, ie as Particle, oe as ParticleGPU, G as SpotLight };
338
+ */import*as THREE from"three/webgpu";import{Discard,Fn,If,abs,attribute,cameraProjectionMatrix,clamp,cos,distance,dot,float,floor,max,mix,mod,modelViewMatrix,normalLocal,positionGeometry,positionWorld,pow,sRGBTransferEOTF,sin,step,texture,transformNormalToView,uniform,varyingProperty,vec2,vec3,vec4}from"three/tsl";var permute4=Fn(([x])=>mod(x.mul(34).add(1).mul(x),289)),permute1=Fn(([x])=>floor(mod(x.mul(34).add(1).mul(x),289))),taylorInvSqrt4=Fn(([r])=>float(1.79284291400159).sub(r.mul(.85373472095314))),taylorInvSqrt1=Fn(([r])=>float(1.79284291400159).sub(r.mul(.85373472095314))),grad4=Fn(([j,ip])=>{let ones=vec4(1,1,1,-1),p=vec4(0,0,0,0).toVar();p.xyz=floor(vec3(j,j,j).mul(ip.xyz).fract().mul(7)).mul(ip.z).sub(1);let absXyz=abs(p.xyz);p.w=float(1.5).sub(dot(absXyz,ones.xyz));let s=float(1).sub(step(vec4(0,0,0,0),p));return p.xyz=p.xyz.add(s.xyz.mul(2).sub(1).mul(s.www)),p}),simplexNoise4D=Fn(([v])=>{let C=vec2(.1381966011250105,.30901699437494745),i=floor(v.add(dot(v,C.yyyy))).toVar(),x0=v.sub(i).add(dot(i,C.xxxx)).toVar(),i0=vec4(0,0,0,0).toVar(),isX=step(x0.yzw,x0.xxx),isYZ=step(x0.zww,x0.yyz);i0.x=isX.x.add(isX.y).add(isX.z),i0.yzw=float(1).sub(isX),i0.y=i0.y.add(isYZ.x).add(isYZ.y),i0.zw=i0.zw.add(float(1).sub(isYZ.xy)),i0.z=i0.z.add(isYZ.z),i0.w=i0.w.add(float(1).sub(isYZ.z));let i3=i0.clamp(0,1),i2=i0.sub(1).clamp(0,1),i1=i0.sub(2).clamp(0,1),x1=x0.sub(i1).add(C.xxxx.mul(1)),x2=x0.sub(i2).add(C.xxxx.mul(2)),x3=x0.sub(i3).add(C.xxxx.mul(3)),x4=x0.sub(1).add(C.xxxx.mul(4)),ii=mod(i,289),j0=permute1(permute1(permute1(permute1(ii.w).add(ii.z)).add(ii.y)).add(ii.x)),j1=permute4(permute4(permute4(permute4(ii.w.add(vec4(i1.w,i2.w,i3.w,1))).add(ii.z).add(vec4(i1.z,i2.z,i3.z,1))).add(ii.y).add(vec4(i1.y,i2.y,i3.y,1))).add(ii.x).add(vec4(i1.x,i2.x,i3.x,1))),ip=vec4(1/294,1/49,1/7,0),p0=grad4(j0,ip).toVar(),p1=grad4(j1.x,ip).toVar(),p2=grad4(j1.y,ip).toVar(),p3=grad4(j1.z,ip).toVar(),p4=grad4(j1.w,ip).toVar(),norm=taylorInvSqrt4(vec4(dot(p0,p0),dot(p1,p1),dot(p2,p2),dot(p3,p3)));p0.assign(p0.mul(norm.x)),p1.assign(p1.mul(norm.y)),p2.assign(p2.mul(norm.z)),p3.assign(p3.mul(norm.w)),p4.assign(p4.mul(taylorInvSqrt1(dot(p4,p4))));let m0=max(float(.6).sub(vec3(dot(x0,x0),dot(x1,x1),dot(x2,x2))),vec3(0,0,0)),m1=max(float(.6).sub(vec2(dot(x3,x3),dot(x4,x4))),vec2(0,0)),m0s=m0.mul(m0),m1s=m1.mul(m1);return float(49).mul(dot(m0s.mul(m0s),vec3(dot(p0,x0),dot(p1,x1),dot(p2,x2))).add(dot(m1s.mul(m1s),vec2(dot(p3,x3),dot(p4,x4)))))}),sharedSphereGeometry=new THREE.SphereGeometry(1,300,300),points=[];for(let i=0;i<2;i++)points.push(new THREE.Vector2(Math.sin(i)/2+1,i*2-.8));var sharedRingGeometry=new THREE.LatheGeometry(points,300);function tslScale$2(value,fromMin,fromMax,toMin,toMax){return value.sub(fromMin).mul((toMax-toMin)/(fromMax-fromMin)).add(toMin)}function createFlameMaterial(u,side,fragmentationDegree){let vNoise=varyingProperty(`float`,`flNoise`),vPosition=varyingProperty(`vec3`,`flPosition`),degree=Math.max(1,Math.round(fragmentationDegree)),vertex=Fn(()=>{let pos=positionGeometry;vPosition.assign(pos);let x=vec4(pos.div(u.uNoise).sub(vec3(0,u.uTime.mul(u.uSpeed),0)),0),v=float(0),a=.5;for(let i=0;i<degree;i++)v=v.add(simplexNoise4D(x).mul(a)),x=x.mul(2).add(100),a*=.5;return vNoise.assign(tslScale$2(v,-1,1,0,1)),pos}),fragment=Fn(()=>{let y=vPosition.y,gradient=mix(float(0),float(1),y.add(1.75)),alphaFlag=float(1).sub(gradient.mul(.3).step(vNoise)),mask=mix(float(.3),float(1),y.add(.5)),alpha=clamp(alphaFlag.mul(mask.mul(10)),0,1),colorMix=mix(u.uColor2,u.uColor1,y.add(.5)),g=colorMix.y.mul(float(1).add(gradient.mul(vNoise)));return vec4(sRGBTransferEOTF(vec3(colorMix.x,g,colorMix.z)),alpha.mul(u.uOpacity))}),material=new THREE.NodeMaterial;return material.positionNode=vertex(),material.fragmentNode=fragment(),material.transparent=!0,material.depthWrite=!1,material.side=side,material}var Flame=class extends THREE.Group{constructor(geometry){super(),this.needsRender=!0,geometry instanceof THREE.BufferGeometry?this.geometry=geometry:geometry===`ring`?this.geometry=sharedRingGeometry:this.geometry=sharedSphereGeometry,this._color1=new THREE.Color(`rgb(255, 177, 20)`).convertLinearToSRGB(),this._color2=new THREE.Color(`rgb(255, 0, 0)`).convertLinearToSRGB(),this.u={uTime:uniform(0),uColor1:uniform(new THREE.Vector3(this._color1.r,this._color1.g,this._color1.b)),uColor2:uniform(new THREE.Vector3(this._color2.r,this._color2.g,this._color2.b)),uNoise:uniform(1.2),uSpeed:uniform(1),uOpacity:uniform(1)},this._fragmentationDegree=2,this.innerMesh=new THREE.Mesh(this.geometry,createFlameMaterial(this.u,THREE.BackSide,this._fragmentationDegree)),this.outerMesh=new THREE.Mesh(this.geometry,createFlameMaterial(this.u,THREE.FrontSide,this._fragmentationDegree)),this.innerMesh.scale.setScalar(.1),this.outerMesh.scale.setScalar(.1),this.add(this.innerMesh),this.add(this.outerMesh)}setTime(time){this.startTime===void 0&&(this.startTime=time),this.u.uTime.value=(time-this.startTime)/1e3,this.needsRender=!0}set color1(value){this._color1=value.clone().convertLinearToSRGB(),this.u.uColor1.value.set(value.r,value.g,value.b),this.needsRender=!0}get color1(){return this._color1}set color2(value){this._color2=value.clone().convertLinearToSRGB(),this.u.uColor2.value.set(value.r,value.g,value.b),this.needsRender=!0}get color2(){return this._color2}set speed(value){this.u.uSpeed.value=value,this.needsRender=!0}get speed(){return this.u.uSpeed.value}set noise(value){this.u.uNoise.value=value,this.needsRender=!0}get noise(){return this.u.uNoise.value}set opacity(value){this.u.uOpacity.value=value,this.needsRender=!0}get opacity(){return this.u.uOpacity.value}set fragmentationDegree(value){value!==this._fragmentationDegree&&(this._fragmentationDegree=value,this.innerMesh.material.dispose(),this.outerMesh.material.dispose(),this.innerMesh.material=createFlameMaterial(this.u,THREE.BackSide,value),this.outerMesh.material=createFlameMaterial(this.u,THREE.FrontSide,value),this.needsRender=!0)}get fragmentationDegree(){return this._fragmentationDegree}};function tslScale$1(value,fromMin,fromMax,toMin,toMax){return value.sub(fromMin).mul((toMax-toMin)/(fromMax-fromMin)).add(toMin)}function createSpotLightMaterial(){let u={uTime:uniform(0),uAttenuation:uniform(0),uAnglePower:uniform(2),uSpotPosition:uniform(new THREE.Vector3),uLightColor:uniform(new THREE.Color(16777215))},vWorldPosition=varyingProperty(`vec3`,`slWorldPosition`),vNormal=varyingProperty(`vec3`,`slNormal`),vNoise=varyingProperty(`float`,`slNoise`),vertex=Fn(()=>{vNormal.assign(transformNormalToView(normalLocal).normalize()),vWorldPosition.assign(positionWorld);let n=simplexNoise4D(vec4(positionGeometry.sub(vec3(0,u.uTime.mul(.4),0)),0));return vNoise.assign(tslScale$1(n,-1,1,.5,1)),positionGeometry}),fragment=Fn(()=>{let intensity=distance(vWorldPosition,u.uSpotPosition).div(u.uAttenuation);intensity=float(1).sub(clamp(intensity,.1,1));let normal=vec3(vNormal.x,vNormal.y,abs(vNormal.z)),anglePower=float(u.uAnglePower).mul(vNoise),angleIntensity=pow(dot(normal,vec3(0,0,1)),anglePower);return intensity=intensity.mul(angleIntensity).mul(vNoise),vec4(u.uLightColor,intensity)}),material=new THREE.NodeMaterial;return material.positionNode=vertex(),material.fragmentNode=fragment(),material.transparent=!0,material.side=THREE.FrontSide,material.depthWrite=!1,{material,u}}var SpotLight=class extends THREE.Group{constructor(height=1,radiusTop=.1,radiusBottom=.2){super(),this.needsRender=!0;let{material,u}=createSpotLightMaterial();this.u=u,this.u.uAttenuation.value=height*.9,this.u.uSpotPosition.value.copy(this.position);let geometry=new THREE.CylinderGeometry(radiusTop,radiusBottom,height,64,20,!0);geometry.applyMatrix4(new THREE.Matrix4().makeTranslation(0,-height/2,0)),geometry.applyMatrix4(new THREE.Matrix4().makeRotationX(-Math.PI/2));let outer=new THREE.Mesh(geometry,material);this.add(outer)}setTime(time){this.startTime===void 0&&(this.startTime=time),this.u.uTime.value=(time-this.startTime)/1e3,this.u.uSpotPosition.value.copy(this.position),this.needsRender=!0}set attenuation(value){this.u.uAttenuation.value=value,this.needsRender=!0}get attenuation(){return this.u.uAttenuation.value}set anglePower(value){this.u.uAnglePower.value=value,this.needsRender=!0}get anglePower(){return this.u.uAnglePower.value}set color(value){this.u.uLightColor.value=value,this.needsRender=!0}get color(){return this.u.uLightColor.value}},sharedGeometry=new THREE.PlaneGeometry(1,1,200,200);sharedGeometry.translate(0,-.5,0);function tslScale(value,fromMin,fromMax,toMin,toMax){return value.sub(fromMin).mul((toMax-toMin)/(fromMax-fromMin)).add(toMin)}function createAirflowMaterial(opts){let u={uTime:uniform(0),uSpeed:uniform(opts.speed),uScale:uniform(opts.scale),uExpand:uniform(opts.expand),uColor:uniform(opts.color),uOpacity:uniform(opts.opacity)},vNoise=varyingProperty(`float`,`afNoise`),vPosition=varyingProperty(`vec3`,`afPosition`),vertex=Fn(()=>{let pos=positionGeometry;vPosition.assign(pos);let n=simplexNoise4D(vec4(pos.x.mul(u.uScale),pos.y.add(u.uTime.mul(u.uSpeed)),0,0));vNoise.assign(tslScale(n,0,1,.5,1));let expandX=float(1).add(pos.y.abs().mul(u.uExpand.sub(1)));return vec3(pos.x.mul(expandX),pos.y,pos.z)}),fragment=Fn(()=>{let gradient=mix(float(0),float(1),float(1).add(vPosition.y)),alpha=vNoise.mul(gradient).mul(u.uOpacity);return vec4(u.uColor,alpha)}),material=new THREE.NodeMaterial;return material.positionNode=vertex(),material.fragmentNode=fragment(),material.transparent=!0,material.side=THREE.DoubleSide,material.depthWrite=!1,{material,u}}var Airflow=class extends THREE.Group{constructor(){super(),this.needsRender=!0;let outer=createAirflowMaterial({speed:.75,scale:2,expand:1.2,color:new THREE.Color(.5,.5,.9),opacity:1}),inner=createAirflowMaterial({speed:2,scale:20,expand:1.2,color:new THREE.Color(1,1,1),opacity:.1});this.outerU=outer.u,this.innerU=inner.u;let outerMesh=new THREE.Mesh(sharedGeometry,outer.material),innerMesh=new THREE.Mesh(sharedGeometry,inner.material);outerMesh.rotateX(-Math.PI/2),innerMesh.rotateX(-Math.PI/2),this.add(outerMesh),this.add(innerMesh)}setTime(time){this.startTime===void 0&&(this.startTime=time);let t=(time-this.startTime)/1e3;this.innerU.uTime.value=t,this.outerU.uTime.value=t,this.needsRender=!0}get expand(){return this.outerU.uExpand.value}set expand(value){this.outerU.uExpand.value=value,this.innerU.uExpand.value=value,this.needsRender=!0}get speed(){return this.innerU.uSpeed.value}set speed(value){this.innerU.uSpeed.value=value,this.needsRender=!0}get color(){return this.outerU.uColor.value}set color(value){this.outerU.uColor.value=value,this.needsRender=!0}get flowColor(){return this.innerU.uColor.value}set flowColor(value){this.innerU.uColor.value=value,this.needsRender=!0}};function random$1(base,spread){return base+spread*(Math.random()-.5)}function randomVector3$1(base,spread){let rand3=new THREE.Vector3(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new THREE.Vector3().addVectors(base,new THREE.Vector3().multiplyVectors(spread,rand3))}function displacement(velocity,acceleration,time){return velocity*time+acceleration*time*time/2}function displacementVector3(velocity,acceleration,time){return new THREE.Vector3(displacement(velocity.x,acceleration.x,time),displacement(velocity.y,acceleration.y,time),displacement(velocity.z,acceleration.z,time))}function tweenLerp(tweenKeyframe,time){let length=tweenKeyframe.times.length,i=0;for(;i<length&&time>tweenKeyframe.times[i];)i++;if(i==0)return tweenKeyframe.values[0];if(i==length)return tweenKeyframe.values[length-1];let progress=(time-tweenKeyframe.times[i-1])/(tweenKeyframe.times[i]-tweenKeyframe.times[i-1]),fromValue=tweenKeyframe.values[i-1],toValue=tweenKeyframe.values[i];return typeof tweenKeyframe.values[0]==`number`?fromValue+progress*(toValue-fromValue):fromValue.clone().lerp(toValue,progress)}var Instance=class{constructor(birthTime,deathAge,position,velocity,acceleration,angle,angleVelocity,angleAcceleration,color,colorTween,size,sizeTween,opacity,opacityTween){this.birthTime=birthTime,this.deathAge=deathAge,this.position=position.clone(),this.velocity=velocity.clone(),this.acceleration=acceleration.clone(),this.angle=angle,this.angleVelocity=angleVelocity,this.angleAcceleration=angleAcceleration,this.color=color,this.colorTween=colorTween,this.size=size,this.sizeTween=sizeTween,this.opacity=opacity,this.opacityTween=opacityTween}getAlive(time){return this.deathAge>time-this.birthTime}getState(time){let alive=this.getAlive(time),age=Math.min(this.deathAge,time-this.birthTime),position=displacementVector3(this.velocity,this.acceleration,age).add(this.position),angle=displacement(this.angleVelocity,this.angleAcceleration,age)+this.angle,size=(this.sizeTween?tweenLerp(this.sizeTween,age):0)+this.size,hsl=(this.colorTween?tweenLerp(this.colorTween,age):new THREE.Vector3).add(this.color);return{alive,age,position,angle,size,color:new THREE.Color().setHSL(hsl.x,hsl.y,hsl.z).convertLinearToSRGB(),opacity:(this.opacityTween?tweenLerp(this.opacityTween,age):0)+this.opacity}}},Particle=class extends THREE.Mesh{constructor(args){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x,_y,_z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13;let quad=new THREE.PlaneGeometry(1,1,1,1),geometry=new THREE.InstancedBufferGeometry;geometry.index=quad.index,geometry.attributes=quad.attributes,geometry.instanceCount=0;let tex=(_a=args.texture)==null?null:_a;tex&&(tex.colorSpace=THREE.NoColorSpace);let u={map:texture(tex==null?new THREE.Texture:tex),useMap:uniform(+!!tex),resolution:uniform(new THREE.Vector2(1,1))},material=buildParticleMaterial(u);material.blending=(_b=args.blending)==null?THREE.NormalBlending:_b,material.transparent=!0,material.depthWrite=!1,super(geometry,material),this.instances=[],this.capacity=0,this.instGeometry=geometry,this.particleMaterial=material,this.u=u,this._texture=tex,this.frustumCulled=!1,this.needsRender=!0,this.birthTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.positionBase=(_d=(_c=args.positionBase)==null?void 0:_c.clone())==null?new THREE.Vector3:_d,this.positionStyle=(_e=args.positionStyle)==null?`CUBE`:_e,this.positionCubeSpread=(_g=(_f=args.positionCubeSpread)==null?void 0:_f.clone())==null?new THREE.Vector3:_g,this.positionSphereSpread=(_h=args.positionSphereSpread)==null?0:_h,this.velocityStyle=(_j=args.velocityStyle)==null?`CUBE`:_j,this.velocityCubeBase=(_l=(_k=args.velocityCubeBase)==null?void 0:_k.clone())==null?new THREE.Vector3:_l,this.velocityCubeSpread=(_o=(_m=args.velocityCubeSpread)==null?void 0:_m.clone())==null?new THREE.Vector3:_o,this.velocitySphereBase=(_p=args.velocitySphereBase)==null?0:_p,this.velocitySphereSpread=(_q=args.velocitySphereSpread)==null?0:_q,this.accelerationBase=(_s=(_r=args.accelerationBase)==null?void 0:_r.clone())==null?new THREE.Vector3:_s,this.accelerationSpread=(_u=(_t=args.accelerationSpread)==null?void 0:_t.clone())==null?new THREE.Vector3:_u,this.angleBase=(_v=args.angleBase)==null?0:_v,this.angleSpread=(_w=args.angleSpread)==null?0:_w,this.angleVelocityBase=(_x=args.angleVelocityBase)==null?0:_x,this.angleVelocitySpread=(_y=args.angleVelocitySpread)==null?0:_y,this.angleAccelerationBase=(_z=args.angleAccelerationBase)==null?0:_z,this.angleAccelerationSpread=(_0=args.angleAccelerationSpread)==null?0:_0,this.sizeBase=(_1=args.sizeBase)==null?.1:_1,this.sizeSpread=(_2=args.sizeSpread)==null?0:_2,this.sizeTween=(_3=args.sizeTween)==null?null:_3,this.colorBase=(_5=(_4=args.colorBase)==null?void 0:_4.clone())==null?new THREE.Vector3:_5,this.colorSpread=(_7=(_6=args.colorSpread)==null?void 0:_6.clone())==null?new THREE.Vector3:_7,this.colorTween=(_8=args.colorTween)==null?null:_8,this.opacityBase=((_9=args.opacityBase)==null?args.opacityTween:_9)?0:1,this.opacitySpread=(_10=args.opacitySpread)==null?0:_10,this.opacityTween=(_11=args.opacityTween)==null?null:_11,this.particlesPerSecond=(_12=args.particlesPerSecond)==null?60:_12,this.particleDeathAge=(_13=args.particleDeathAge)==null?1:_13}get texture(){return this._texture}set texture(value){this._texture=value,this.u.map.value=value==null?new THREE.Texture:value,this.u.useMap.value=+!!value,this.needsRender=!0}get blending(){return this.particleMaterial.blending}set blending(value){this.particleMaterial.blending=value}ensureCapacity(count){if(this.capacity>=count)return;let grow=(old,comps)=>{let next=new Float32Array(count*comps);return old&&next.set(old,0),next};this.arrPosition=grow(this.arrPosition,3),this.arrColor=grow(this.arrColor,3),this.arrOpacity=grow(this.arrOpacity,1),this.arrSize=grow(this.arrSize,1),this.arrAngle=grow(this.arrAngle,1),this.arrAlive=grow(this.arrAlive,1),this.capacity=count,this.instGeometry.setAttribute(`iPosition`,new THREE.InstancedBufferAttribute(this.arrPosition,3)),this.instGeometry.setAttribute(`iColor`,new THREE.InstancedBufferAttribute(this.arrColor,3)),this.instGeometry.setAttribute(`iOpacity`,new THREE.InstancedBufferAttribute(this.arrOpacity,1)),this.instGeometry.setAttribute(`iSize`,new THREE.InstancedBufferAttribute(this.arrSize,1)),this.instGeometry.setAttribute(`iAngle`,new THREE.InstancedBufferAttribute(this.arrAngle,1)),this.instGeometry.setAttribute(`iAlive`,new THREE.InstancedBufferAttribute(this.arrAlive,1))}createInstance(birthTime){let position=this.positionBase.clone();switch(this.positionStyle){case`CUBE`:position=randomVector3$1(this.positionBase,this.positionCubeSpread);break;case`SPHERE`:{let z=2*Math.random()-1,t=Math.PI*2*Math.random(),r=Math.sqrt(1-z*z),vec=new THREE.Vector3(r*Math.cos(t),r*Math.sin(t),z);position=new THREE.Vector3().addVectors(this.positionBase,vec.multiplyScalar(this.positionSphereSpread));break}}let velocity=new THREE.Vector3;switch(this.velocityStyle){case`CUBE`:velocity=randomVector3$1(this.velocityCubeBase,this.velocityCubeSpread);break;case`SPHERE`:{let direction=new THREE.Vector3().subVectors(position,this.positionBase),speed=random$1(this.velocitySphereBase,this.velocitySphereSpread);velocity=direction.normalize().multiplyScalar(speed);break}}return new Instance(birthTime,this.particleDeathAge,position,velocity,randomVector3$1(this.accelerationBase,this.accelerationSpread),random$1(this.angleBase,this.angleSpread),random$1(this.angleVelocityBase,this.angleVelocitySpread),random$1(this.angleAccelerationBase,this.angleAccelerationSpread),randomVector3$1(this.colorBase,this.colorSpread),this.colorTween,random$1(this.sizeBase,this.sizeSpread),this.sizeTween,random$1(this.opacityBase,this.opacitySpread),this.opacityTween)}pause(){this.paused!==!0&&(this.paused=!0,this.birthTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.birthTime=Date.now()/1e3)}setTime(time){if(this.disposed)return;time/=1e3;let age=time-this.birthTime,particleCount=Math.ceil(this.particlesPerSecond*this.particleDeathAge);this.ensureCapacity(particleCount),this.instances.length<particleCount&&(this.instances.length=particleCount),this.instGeometry.instanceCount=particleCount;for(let i=0;i<this.instances.length;i++){let instance=this.instances[i];if(i<particleCount&&this.paused===!1&&(instance===void 0||instance.getAlive(time)===!1)){let delay=this.particleDeathAge/particleCount*i;if(age>delay){let birthTime=time-(age-delay)%this.particleDeathAge;this.instances[i]=instance=this.createInstance(birthTime)}}if(instance){let{position,alive,color,opacity,size,angle}=instance.getState(time);this.arrPosition[i*3]=position.x,this.arrPosition[i*3+1]=position.y,this.arrPosition[i*3+2]=position.z,this.arrColor[i*3]=color.r,this.arrColor[i*3+1]=color.g,this.arrColor[i*3+2]=color.b,this.arrOpacity[i]=opacity,this.arrSize[i]=size,this.arrAngle[i]=angle,this.arrAlive[i]=+!!alive}}this.instGeometry.getAttribute(`iPosition`).needsUpdate=!0,this.instGeometry.getAttribute(`iColor`).needsUpdate=!0,this.instGeometry.getAttribute(`iOpacity`).needsUpdate=!0,this.instGeometry.getAttribute(`iSize`).needsUpdate=!0,this.instGeometry.getAttribute(`iAngle`).needsUpdate=!0,this.instGeometry.getAttribute(`iAlive`).needsUpdate=!0,this.needsRender=!0}setResolution(width,height){this.u.resolution.value.set(width,height)}dispose(){var _a;this.disposed=!0,this.instGeometry.dispose(),(_a=this._texture)==null||_a.dispose(),this.particleMaterial.dispose()}};function buildParticleMaterial(u){let vColor=varyingProperty(`vec4`,`pColor`),vAngle=varyingProperty(`float`,`pAngle`),vertex=Fn(()=>{let iPosition=attribute(`iPosition`,`vec3`),iColor=attribute(`iColor`,`vec3`),iOpacity=attribute(`iOpacity`,`float`),iSize=attribute(`iSize`,`float`),iAngle=attribute(`iAngle`,`float`),iAlive=attribute(`iAlive`,`float`),corner=positionGeometry.xy,a=iOpacity.mul(iAlive);vColor.assign(vec4(iColor,a)),vAngle.assign(iAngle);let centerView=modelViewMatrix.mul(vec4(iPosition,1)),p11=cameraProjectionMatrix.element(1).y,focal=max(float(.5).mul(u.resolution.y).mul(p11),1e-4),viewSize=iSize.mul(300).div(focal).div(2),offsetView=vec4(corner.mul(viewSize),0,0),mvPosition=centerView.add(offsetView);return cameraProjectionMatrix.mul(mvPosition)}),fragment=Fn(()=>{If(vColor.a.lessThanEqual(0),()=>{Discard()});let coord=vec2(positionGeometry.x,positionGeometry.y),c=cos(vAngle),s=sin(vAngle),rotU=c.mul(coord.x).add(s.mul(coord.y)).add(.5),rotV=c.mul(coord.y).sub(s.mul(coord.x)).add(.5),texColor=u.map.sample(vec2(rotU,rotV)),mapped=vColor.mul(texColor),srgbRgb=vColor.rgb.mul(float(1).sub(u.useMap)).add(mapped.rgb.mul(u.useMap)),outA=vColor.a.mul(float(1).sub(u.useMap)).add(mapped.a.mul(u.useMap));return vec4(sRGBTransferEOTF(srgbRgb),outA)}),material=new THREE.NodeMaterial;return material.vertexNode=vertex(),material.fragmentNode=fragment(),material}function random(base,spread){return base+spread*(Math.random()-.5)}function randomVector3(base,spread){let rand3=new THREE.Vector3(Math.random()-.5,Math.random()-.5,Math.random()-.5);return new THREE.Vector3().addVectors(base,new THREE.Vector3().multiplyVectors(spread,rand3))}var Particle$1=class extends THREE.Mesh{constructor(args){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k,_l,_m,_o,_p,_q,_r,_s,_t,_u,_v,_w,_x,_y,_z,_0,_1,_2,_3,_4,_5,_6,_7,_8,_9;let particleCount=Math.ceil(((_a=args.particlesPerSecond)==null?60:_a)*((_b=args.particleDeathAge)==null?1:_b)),pack0=new Float32Array(particleCount*4),pack1=new Float32Array(particleCount*4),pack2=new Float32Array(particleCount*4),pack3=new Float32Array(particleCount*4),pack4=new Float32Array(particleCount*4);for(let i=0;i<particleCount;i++){let i4=i*4,birthTime=((_c=args.particleDeathAge)==null?1:_c)/particleCount*i,lifeTime=(_d=args.particleDeathAge)==null?1:_d,position=(_f=(_e=args.positionBase)==null?void 0:_e.clone())==null?new THREE.Vector3:_f;switch((_g=args.positionStyle)==null?`CUBE`:_g){case`CUBE`:position=randomVector3((_h=args.positionBase)==null?new THREE.Vector3:_h,(_j=args.positionCubeSpread)==null?new THREE.Vector3:_j);break;case`SPHERE`:{let z=2*Math.random()-1,t=Math.PI*2*Math.random(),r=Math.sqrt(1-z*z),vec=new THREE.Vector3(r*Math.cos(t),r*Math.sin(t),z);position=new THREE.Vector3().addVectors((_k=args.positionBase)==null?new THREE.Vector3:_k,vec.multiplyScalar((_l=args.positionSphereSpread)==null?0:_l));break}}let velocity=new THREE.Vector3;switch((_m=args.velocityStyle)==null?`CUBE`:_m){case`CUBE`:velocity=randomVector3((_o=args.velocityCubeBase)==null?new THREE.Vector3:_o,(_p=args.velocityCubeSpread)==null?new THREE.Vector3:_p);break;case`SPHERE`:{let direction=new THREE.Vector3().subVectors(position,(_q=args.positionBase)==null?new THREE.Vector3:_q),speed=random((_r=args.velocitySphereBase)==null?0:_r,(_s=args.velocitySphereSpread)==null?0:_s);velocity=direction.normalize().multiplyScalar(speed);break}}let acceleration=randomVector3((_t=args.accelerationBase)==null?new THREE.Vector3:_t,(_u=args.accelerationSpread)==null?new THREE.Vector3:_u),initialSize=random((_v=args.sizeBase)==null?.1:_v,(_w=args.sizeSpread)==null?0:_w),sizeGrowth=(_x=args.sizeGrowth)==null?0:_x,color=randomVector3(new THREE.Vector3().setFromColor(new THREE.Color().setFromVector3((_y=args.colorBase)==null?new THREE.Vector3:_y).convertLinearToSRGB()),new THREE.Vector3().setFromColor(new THREE.Color().setFromVector3((_z=args.colorSpread)==null?new THREE.Vector3:_z).convertLinearToSRGB())),opacity=random((_0=args.opacityBase)==null?1:_0,(_1=args.opacitySpread)==null?0:_1),angle=random((_2=args.angleBase)==null?0:_2,(_3=args.angleSpread)==null?0:_3),angleVelocity=random((_4=args.angleVelocityBase)==null?0:_4,(_5=args.angleVelocitySpread)==null?0:_5);pack0[i4]=position.x,pack0[i4+1]=position.y,pack0[i4+2]=position.z,pack0[i4+3]=birthTime,pack1[i4]=velocity.x,pack1[i4+1]=velocity.y,pack1[i4+2]=velocity.z,pack1[i4+3]=lifeTime,pack2[i4]=acceleration.x,pack2[i4+1]=acceleration.y,pack2[i4+2]=acceleration.z,pack2[i4+3]=initialSize,pack3[i4]=color.x,pack3[i4+1]=color.y,pack3[i4+2]=color.z,pack3[i4+3]=sizeGrowth,pack4[i4]=opacity,pack4[i4+1]=angle,pack4[i4+2]=angleVelocity,pack4[i4+3]=0}let quad=new THREE.PlaneGeometry(1,1,1,1),geometry=new THREE.InstancedBufferGeometry;geometry.index=quad.index,geometry.attributes=quad.attributes,geometry.instanceCount=particleCount,geometry.setAttribute(`iPack0`,new THREE.InstancedBufferAttribute(pack0,4)),geometry.setAttribute(`iPack1`,new THREE.InstancedBufferAttribute(pack1,4)),geometry.setAttribute(`iPack2`,new THREE.InstancedBufferAttribute(pack2,4)),geometry.setAttribute(`iPack3`,new THREE.InstancedBufferAttribute(pack3,4)),geometry.setAttribute(`iPack4`,new THREE.InstancedBufferAttribute(pack4,4));let tex=(_6=args.texture)==null?null:_6;tex&&(tex.colorSpace=THREE.NoColorSpace);let u={map:texture(tex==null?new THREE.Texture:tex),useMap:uniform(+!!tex),uTime:uniform(0),resolution:uniform(new THREE.Vector2(1,1))},material=buildGPUParticleMaterial(u);material.blending=(_7=args.blending)==null?THREE.NormalBlending:_7,material.transparent=!0,material.depthWrite=!1,super(geometry,material),this.particleMaterial=material,this.u=u,this._texture=tex,this.frustumCulled=!1,this.needsRender=!0,this.startTime=Date.now()/1e3,this.disposed=!1,this.paused=!1,this.particleCount=particleCount,this.particlesPerSecond=(_8=args.particlesPerSecond)==null?60:_8,this.particleDeathAge=(_9=args.particleDeathAge)==null?1:_9}get texture(){return this._texture}set texture(value){this._texture=value,value&&(value.colorSpace=THREE.NoColorSpace),this.u.map.value=value==null?new THREE.Texture:value,this.u.useMap.value=+!!value,this.needsRender=!0}get blending(){return this.particleMaterial.blending}set blending(value){this.particleMaterial.blending=value}pause(){this.paused!==!0&&(this.paused=!0,this.startTime=Date.now()/1e3)}play(){this.paused!==!1&&(this.paused=!1,this.startTime=Date.now()/1e3)}setTime(time){if(this.disposed||this.paused)return;let age=time/1e3-this.startTime;this.u.uTime.value=age,this.needsRender=!0}setResolution(width,height){this.u.resolution.value.set(width,height)}dispose(){var _a;this.disposed=!0,this.geometry.dispose(),(_a=this._texture)==null||_a.dispose(),this.particleMaterial.dispose()}};function tslHsl2Rgb(c){let rgb=clamp(mod(c.x.mul(6).add(vec3(0,4,2)),6).sub(3).abs().sub(1),0,1);return c.z.add(c.y.mul(rgb.sub(.5)).mul(float(1).sub(c.z.mul(2).sub(1).abs())))}function buildGPUParticleMaterial(u){let vColor=varyingProperty(`vec4`,`gpColor`),vAngle=varyingProperty(`float`,`gpAngle`),vertex=Fn(()=>{let attr=(name,type)=>attribute(name,type),pack0=attr(`iPack0`,`vec4`),pack1=attr(`iPack1`,`vec4`),pack2=attr(`iPack2`,`vec4`),pack3=attr(`iPack3`,`vec4`),pack4=attr(`iPack4`,`vec4`),initialPosition=pack0.xyz,birthTime=pack0.w,initialVelocity=pack1.xyz,lifeTime=pack1.w,acceleration=pack2.xyz,initialSize=pack2.w,initialColor=pack3.xyz,sizeGrowth=pack3.w,initialOpacity=pack4.x,initialAngle=pack4.y,angleVelocity=pack4.z,corner=positionGeometry.xy,age=mod(u.uTime.add(birthTime),lifeTime),normalizedAge=clamp(age.div(lifeTime),0,1),currentVelocity=initialVelocity.add(acceleration.mul(age)),currentPosition=initialPosition.add(currentVelocity.mul(age)),currentSize=initialSize.add(sizeGrowth.mul(normalizedAge));vAngle.assign(initialAngle.add(angleVelocity.mul(age)));let fadeIn=normalizedAge.div(.1),fadeOut=float(1).sub(normalizedAge).div(.2),op=initialOpacity.mul(normalizedAge.lessThan(.1).select(clamp(fadeIn,0,1),normalizedAge.greaterThan(.8).select(clamp(fadeOut,0,1),float(1)))),rgb=tslHsl2Rgb(initialColor);vColor.assign(vec4(rgb,op));let centerView=modelViewMatrix.mul(vec4(currentPosition,1)),p11=cameraProjectionMatrix.element(1).y,focal=max(float(.5).mul(u.resolution.y).mul(p11),1e-4),viewSize=currentSize.mul(300).div(focal).div(2),offsetView=vec4(corner.mul(viewSize),0,0),mvPosition=centerView.add(offsetView);return cameraProjectionMatrix.mul(mvPosition)}),fragment=Fn(()=>{If(vColor.a.lessThanEqual(0),()=>{Discard()});let coord=vec2(positionGeometry.x,positionGeometry.y.negate()),c=cos(vAngle),s=sin(vAngle),rotU=c.mul(coord.x).add(s.mul(coord.y)).add(.5),rotV=c.mul(coord.y).sub(s.mul(coord.x)).add(.5),texColor=u.map.sample(vec2(rotU,rotV)),mapped=vColor.mul(texColor),srgbRgb=vColor.rgb.mul(float(1).sub(u.useMap)).add(mapped.rgb.mul(u.useMap)),outA=vColor.a.mul(float(1).sub(u.useMap)).add(mapped.a.mul(u.useMap));return vec4(sRGBTransferEOTF(srgbRgb),outA)}),material=new THREE.NodeMaterial;return material.vertexNode=vertex(),material.fragmentNode=fragment(),material}export{Airflow,Flame,Particle,Particle$1 as ParticleGPU,SpotLight};
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
3
  * @realsee/five-webgpu
4
- * Generated: 2026/10/30
5
- * Version: 1.0.0-alpha.13
4
+ * Generated: 2026/11/3
5
+ * Version: 1.0.0-alpha.14
6
6
  * License:
7
7
  * Realsee SDK License Agreement
8
8
 
@@ -335,4 +335,4 @@
335
335
  * writing and signed by Realsee. You and Realsee hereto confirm that this
336
336
  * Agreement and all related documents shall be drafted in English.
337
337
 
338
- */Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("tslib"),l=require("node:fs"),u=require("node:fs/promises"),d=require("node:path"),f=require("node:stream"),p=require("sharp");p=s(p,1);function m(e,t){if(t&&t[t.length-1]!==`/`&&(t+=`/`),e.length>t.length&&e.startsWith(t))return e.slice(t.length);throw Error(`${e} is not starting with ${t}`)}function h(...e){let t=[];e=e.map(e=>(e==null?``:e).trim()).filter(e=>e.length>0&&!/^\/+$/.test(e));for(let n=0;n<e.length;n++){let r=n===0,i=n===e.length-1,a=e[n];r||(a=a.replace(/^\.\//,``).replace(/^\/+/,``)),i||(a=a.replace(/\/+$/,``)),t.push(a)}return t.join(`/`)}var g=1024*1024*5;function _(e,t,n){return(0,c.__awaiter)(this,void 0,void 0,function*(){var r;if((0,l.existsSync)(t))return t;let i=yield n(e);if(i.ok&&i.body){if(yield(0,u.mkdir)((0,d.dirname)(t),{recursive:!0}),Number((r=i.headers.get(`content-length`))==null?`Infinity`:r)>g)return new Promise((e,n)=>{let r=f.Readable.fromWeb(i.body),a=(0,l.createWriteStream)(t);r.pipe(a),r.on(`error`,n),a.on(`finish`,()=>e(t))});{let e=yield i.arrayBuffer();return yield(0,u.writeFile)(t,Buffer.from(e)),t}}throw Error(`url: ${e}(${i.statusText})`)})}var v=[`jpg`,`png`],y=95;function b(e,t){let n=(0,d.extname)(e).slice(1)||`jpg`,{cut:r,size:i,format:a=n}=t,o=``;if(t.toFilename)o=t.toFilename(e,{cut:t.cut,size:t.size,format:t.format});else{let t=``,s=``,c=a;r&&(t=r.join(`x`)),i&&(s=`${i}x`),c===n&&!s&&!t&&(c=``),o=[e,t,s,c].filter(e=>e.length>0).join(`.`)}return o}function x(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let n=(0,d.extname)(e).slice(1)||`jpg`,{cut:r,size:i,format:a=n}=t,o=e;if((r||i)&&a!==n&&v.includes(a)){let n=b(e,{format:a,toFilename:t.toFilename});n!==o&&(0,l.existsSync)(n)&&(o=n)}let s=(0,p.default)(o);r&&(s=s.extract({left:r[0],top:r[1],width:r[2],height:r[3]})),i&&(s=s.resize(i)),s=s.toFormat(a,{quality:y});let c=b(e,t);return c!==e&&!(0,l.existsSync)(c)?s.toFile(c).then(()=>c):c})}function S(e){let t=[];if(e.content&&(e.content.uri?t.push(e.content.uri):e.content.url&&t.push(e.content.url)),e.children)for(let n of e.children){let e=S(n);if(e.length>0)for(let n=0;n<e.length;n++)t.push(e[n])}return t}function C(e,t,n){return(0,c.__awaiter)(this,void 0,void 0,function*(){let r=new URL(e,t).href,i=_(r,(0,d.join)(n.distPath,m(r,n.baseURL)),n.fetch);n.log(e=>`download: ${r} -> ${e}`,i),yield i,/\.json$/.test(e)&&(yield w(r,n))})}function w(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let n=(0,d.join)(t.distPath,m(e,t.baseURL)),r=_(e,n,t.fetch);t.log(t=>`download: ${e} -> ${t}`,r),yield r;let i=JSON.parse(yield(0,u.readFile)(n,`utf8`));if(i.asset.overview){let n=new URL(i.asset.overview.imageFile,e).href,r=_(n,(0,d.join)(t.distPath,m(n,t.baseURL)),t.fetch);t.log(e=>`download: ${n} -> ${e}`,r),yield r}if(i.asset.trajectories)for(let n of i.asset.trajectories.list){let r=new URL(n.file,e).href,i=_(r,(0,d.join)(t.distPath,m(r,t.baseURL)),t.fetch);t.log(e=>`download: ${r} -> ${e}`,i),yield i}let a=S(i.root);for(let n=0;n<a.length;n+=6){let r=[];for(let i=0;i<6;i++){let o=a[n+i];if(o){let n=C(o,e,t);r.push(n)}}yield Promise.all(r)}})}function T(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){if(t.log(`process model`),e.model){let{textures:n,layers:r,file:i,textureBase:a}=e.model;if(i){t.log(`process model file`);let r=e.getURL(i),o=_(r,(0,d.join)(t.distPath,m(r,t.baseURL)),t.fetch);if(t.log(e=>`download: ${i} -> ${e}`,o),yield o,n)for(let r of n){let n=h(e.getURL(a==null?``:a),r),i=(0,d.join)(t.distPath,m(n,t.baseURL)),o=_(n,i,t.fetch);t.log(e=>`download: ${n} -> ${e}`,o),yield o;let s=t.imageOptions.format;s.length===0&&s.push(void 0);let c=t.imageOptions.size;c.length===0&&c.push(void 0);let l=[];for(let e of s)for(let n of c){let r=x(i,{format:e,size:n,toFilename:t.imageProcessingFilename});t.log(e=>`imageProcessing: ${i} -> ${e}`,r),l.push(r)}yield Promise.all(l)}}if(r)for(let n of r){let{tileset:r}=n;t.log(`process model layer`),yield w(e.getURL(r),t)}}})}var E=[`front`,`back`,`left`,`right`,`up`,`down`];function D(e,t,n){return(0,c.__awaiter)(this,void 0,void 0,function*(){let r=(0,d.join)(n.distPath,m(e,n.baseURL)),i=_(e,r,n.fetch);n.log(t=>`download: ${e} -> ${t}`,i),yield i;let a=Math.pow(2,t.level),o=n.imageOptions.format;o.length===0&&o.push(void 0);let s=[];if(a>1)for(let e=0;e<a;e++)for(let i=0;i<a;i++)for(let c of o){let o=[t.size/a*i,t.size/a*e,t.size/a,t.size/a],l=x(r,{format:c,size:t.scale>=1?void 0:t.scale*t.size/a,cut:o,toFilename:n.imageProcessingFilename});if(n.log(e=>`imageProcessing: ${r} -> ${e}`,l),s.push(l),t.level===1&&t.scale>=.5&&(c===`jpg`||/\.jpg$/.test(r))){let e=x(r,{format:c,size:void 0,cut:o,toFilename:n.imageProcessingFilename});n.log(e=>`imageProcessing: ${r} -> ${e}`,e),s.push(e)}}yield Promise.all(s)})}function O(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let n=E.map(n=>D(e.work.getURL(e[n]),e,t));if(e.gainmap){let r=e.gainmap;n.push(...E.map(n=>D(e.work.getURL(r[n]),e,t)))}yield Promise.all(n)})}function k(e,t,n){return(0,c.__awaiter)(this,void 0,void 0,function*(){let r=(0,d.join)(n.distPath,m(e,n.baseURL)),i=_(e,r,n.fetch);n.log(t=>`download: ${e} -> ${t}`,i),yield i;let a=n.imageOptions.format;a.length===0&&a.push(void 0);let o=n.imageOptions.size;o.length===0&&o.push(void 0);for(let r of t){let t=e.replace(/cube\_\d+/,`cube_${r}`),i=(0,d.join)(n.distPath,m(t,n.baseURL)),o=_(t,i,n.fetch);n.log(e=>`download ${t} -> ${i}`,o),yield o;for(let e of a){let t=x(i,{format:e,toFilename:n.imageProcessingFilename});n.log(e=>`imageProcessing: ${i} -> ${e}`,t),yield t}}let s=[];for(let e of a)for(let t of o){let i=x(r,{format:e,size:t,toFilename:n.imageProcessingFilename});n.log(e=>`imageProcessing: ${r} -> ${e}`,i),s.push(i)}yield Promise.all(s)})}function A(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let n=_(e,(0,d.join)(t.distPath,m(e,t.baseURL)),t.fetch);t.log(t=>`download: ${e} -> ${t}`,n),yield n})}function j(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let{images:n}=e,r=E.map(e=>k(n.work.getURL(n[e]),n.sizeList,t));if(n.gainmap){let e=n.gainmap;r.push(...E.map(r=>k(n.work.getURL(e[r]),n.sizeList,t))),r.push(A(n.work.getURL(e.cfg),t))}yield Promise.all(r),n.tiles&&(yield Promise.all(n.tiles.map(e=>O(e,t))))})}function M(e,t){return(0,c.__awaiter)(this,void 0,void 0,function*(){let{observers:n}=e;for(let e of n){let n=j(e,t);t.log(`process observer #${e.index} derived: ${e.derivedIdStr}`,n),yield n}})}function N(e,t){if(t){let n=Date.now();t.then(t=>{let r=Date.now()-n,i=typeof e==`function`?e(t):e;console.log(i+`(${r}ms)`)}).catch(()=>{})}else{let t=typeof e==`function`?e(null):e;console.log(t)}}function P(e){return(0,c.__awaiter)(this,arguments,void 0,function*(e,t={}){var n,r,i,a,o,s,c,f,p,m;let h=e.baseURL,g=``;if(t.distPath)g=(0,d.resolve)(process.cwd(),t.distPath);else for(g=(0,d.resolve)(process.cwd(),(n=e.workCode)==null?`work-${Date.now()}`:n);(0,l.existsSync)(g);)/.-(\d+)$/.test(g)?g=g.replace(/.-(\d+)$/,(e,t)=>`-`+(Number(t)+1)):g+=`-1`;let _={baseURL:h,distPath:g,fetch:(r=t.fetch)==null?fetch:r,imageOptions:{size:(a=(i=t.imageOptions)==null?void 0:i.size)==null?[]:a,format:(s=(o=t.imageOptions)==null?void 0:o.format)==null?[]:s},textureOptions:{size:(f=(c=t.textureOptions)==null?void 0:c.size)==null?[]:f,format:(m=(p=t.textureOptions)==null?void 0:p.format)==null?[]:m},log:t.log?N:(()=>Promise.resolve()),imageProcessingFilename:t.imageProcessingFilename};_.log(JSON.stringify(_,null,` `)),yield(0,u.mkdir)(g,{recursive:!0}),yield(0,u.writeFile)((0,d.resolve)(g,`work.json`),JSON.stringify(e.toJSON(),null,` `)),yield M(e,_),yield T(e,_)})}exports.download=P;
338
+ */Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var __create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__copyProps=(to,from,except,desc)=>{if(from&&typeof from==`object`||typeof from==`function`)for(var keys=__getOwnPropNames(from),i=0,n=keys.length,key;i<n;i++)key=keys[i],!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:(k=>from[k]).bind(null,key),enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to},__toESM=(mod,isNodeMode,target)=>(target=mod==null?{}:__create(__getProtoOf(mod)),__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,`default`,{value:mod,enumerable:!0}):target,mod));let tslib=require("tslib"),node_fs=require("node:fs"),node_fs_promises=require("node:fs/promises"),node_path=require("node:path"),node_stream=require("node:stream"),sharp=require("sharp");sharp=__toESM(sharp,1);function relativeUrl(url,baseURL){if(baseURL&&baseURL[baseURL.length-1]!==`/`&&(baseURL+=`/`),url.length>baseURL.length&&url.startsWith(baseURL))return url.slice(baseURL.length);throw Error(`${url} is not starting with ${baseURL}`)}function joinUrl(...segments){let array=[];segments=segments.map(segment=>(segment==null?``:segment).trim()).filter(segment=>segment.length>0&&!/^\/+$/.test(segment));for(let i=0;i<segments.length;i++){let first=i===0,last=i===segments.length-1,segment=segments[i];first||(segment=segment.replace(/^\.\//,``).replace(/^\/+/,``)),last||(segment=segment.replace(/\/+$/,``)),array.push(segment)}return array.join(`/`)}var MAX_BUFFER=1024*1024*5;function downloadToFile(url,filename,aFetch){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){var _a;if((0,node_fs.existsSync)(filename))return filename;let res=yield aFetch(url);if(res.ok&&res.body){if(yield(0,node_fs_promises.mkdir)((0,node_path.dirname)(filename),{recursive:!0}),Number((_a=res.headers.get(`content-length`))==null?`Infinity`:_a)>MAX_BUFFER)return new Promise((resolve,reject)=>{let readableNodeStream=node_stream.Readable.fromWeb(res.body),fileStream=(0,node_fs.createWriteStream)(filename);readableNodeStream.pipe(fileStream),readableNodeStream.on(`error`,reject),fileStream.on(`finish`,()=>resolve(filename))});{let buffer=yield res.arrayBuffer();return yield(0,node_fs_promises.writeFile)(filename,Buffer.from(buffer)),filename}}throw Error(`url: ${url}(${res.statusText})`)})}var fastFormat=[`jpg`,`png`],quality=95;function getFilename(src,options){let defaultFormat=(0,node_path.extname)(src).slice(1)||`jpg`,{cut:c,size:s,format:f=defaultFormat}=options,filename=``;if(options.toFilename)filename=options.toFilename(src,{cut:options.cut,size:options.size,format:options.format});else{let cPath=``,sPath=``,fPath=f;c&&(cPath=c.join(`x`)),s&&(sPath=`${s}x`),fPath===defaultFormat&&!sPath&&!cPath&&(fPath=``),filename=[src,cPath,sPath,fPath].filter(s=>s.length>0).join(`.`)}return filename}function imageProcessing(src,options){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let defaultFormat=(0,node_path.extname)(src).slice(1)||`jpg`,{cut:c,size:s,format:f=defaultFormat}=options,inputSrc=src;if((c||s)&&f!==defaultFormat&&fastFormat.includes(f)){let filename=getFilename(src,{format:f,toFilename:options.toFilename});filename!==inputSrc&&(0,node_fs.existsSync)(filename)&&(inputSrc=filename)}let instance=(0,sharp.default)(inputSrc);c&&(instance=instance.extract({left:c[0],top:c[1],width:c[2],height:c[3]})),s&&(instance=instance.resize(s)),instance=instance.toFormat(f,{quality});let filename=getFilename(src,options);return filename!==src&&!(0,node_fs.existsSync)(filename)?instance.toFile(filename).then(()=>filename):filename})}function scanTileContent(tile){let contents=[];if(tile.content&&(tile.content.uri?contents.push(tile.content.uri):tile.content.url&&contents.push(tile.content.url)),tile.children)for(let child of tile.children){let childContents=scanTileContent(child);if(childContents.length>0)for(let i=0;i<childContents.length;i++)contents.push(childContents[i])}return contents}function processTileContent(content,tilesetUrl,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let url=new URL(content,tilesetUrl).href,task=downloadToFile(url,(0,node_path.join)(context.distPath,relativeUrl(url,context.baseURL)),context.fetch);context.log(result=>`download: ${url} -> ${result}`,task),yield task,/\.json$/.test(content)&&(yield processTileset(url,context))})}function processTileset(tilesetUrl,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let filename=(0,node_path.join)(context.distPath,relativeUrl(tilesetUrl,context.baseURL)),task=downloadToFile(tilesetUrl,filename,context.fetch);context.log(result=>`download: ${tilesetUrl} -> ${result}`,task),yield task;let tileset=JSON.parse(yield(0,node_fs_promises.readFile)(filename,`utf8`));if(tileset.asset.overview){let url=new URL(tileset.asset.overview.imageFile,tilesetUrl).href,task=downloadToFile(url,(0,node_path.join)(context.distPath,relativeUrl(url,context.baseURL)),context.fetch);context.log(result=>`download: ${url} -> ${result}`,task),yield task}if(tileset.asset.trajectories)for(let trajectory of tileset.asset.trajectories.list){let url=new URL(trajectory.file,tilesetUrl).href,task=downloadToFile(url,(0,node_path.join)(context.distPath,relativeUrl(url,context.baseURL)),context.fetch);context.log(result=>`download: ${url} -> ${result}`,task),yield task}let contents=scanTileContent(tileset.root);for(let i=0;i<contents.length;i+=6){let tasks=[];for(let j=0;j<6;j++){let content=contents[i+j];if(content){let task=processTileContent(content,tilesetUrl,context);tasks.push(task)}}yield Promise.all(tasks)}})}function process$2(work,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){if(context.log(`process model`),work.model){let{textures,layers,file,textureBase}=work.model;if(file){context.log(`process model file`);let url=work.getURL(file),task=downloadToFile(url,(0,node_path.join)(context.distPath,relativeUrl(url,context.baseURL)),context.fetch);if(context.log(result=>`download: ${file} -> ${result}`,task),yield task,textures)for(let texture of textures){let url=joinUrl(work.getURL(textureBase==null?``:textureBase),texture),filename=(0,node_path.join)(context.distPath,relativeUrl(url,context.baseURL)),task=downloadToFile(url,filename,context.fetch);context.log(result=>`download: ${url} -> ${result}`,task),yield task;let format=context.imageOptions.format;format.length===0&&format.push(void 0);let size=context.imageOptions.size;size.length===0&&size.push(void 0);let tasks=[];for(let f of format)for(let s of size){let task=imageProcessing(filename,{format:f,size:s,toFilename:context.imageProcessingFilename});context.log(result=>`imageProcessing: ${filename} -> ${result}`,task),tasks.push(task)}yield Promise.all(tasks)}}if(layers)for(let layer of layers){let{tileset}=layer;context.log(`process model layer`),yield processTileset(work.getURL(tileset),context)}}})}var CUBE_FACES=[`front`,`back`,`left`,`right`,`up`,`down`];function processTileImage(src,tile,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let filename=(0,node_path.join)(context.distPath,relativeUrl(src,context.baseURL)),task=downloadToFile(src,filename,context.fetch);context.log(result=>`download: ${src} -> ${result}`,task),yield task;let count=Math.pow(2,tile.level),format=context.imageOptions.format;format.length===0&&format.push(void 0);let tasks=[];if(count>1)for(let row=0;row<count;row++)for(let col=0;col<count;col++)for(let f of format){let cut=[tile.size/count*col,tile.size/count*row,tile.size/count,tile.size/count],task=imageProcessing(filename,{format:f,size:tile.scale>=1?void 0:tile.scale*tile.size/count,cut,toFilename:context.imageProcessingFilename});if(context.log(result=>`imageProcessing: ${filename} -> ${result}`,task),tasks.push(task),tile.level===1&&tile.scale>=.5&&(f===`jpg`||/\.jpg$/.test(filename))){let task=imageProcessing(filename,{format:f,size:void 0,cut,toFilename:context.imageProcessingFilename});context.log(result=>`imageProcessing: ${filename} -> ${result}`,task),tasks.push(task)}}yield Promise.all(tasks)})}function processTile(tile,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let tasks=CUBE_FACES.map(face=>processTileImage(tile.work.getURL(tile[face]),tile,context));if(tile.gainmap){let gainmap=tile.gainmap;tasks.push(...CUBE_FACES.map(face=>processTileImage(tile.work.getURL(gainmap[face]),tile,context)))}yield Promise.all(tasks)})}function processCubeImage(src,sizeList,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let filename=(0,node_path.join)(context.distPath,relativeUrl(src,context.baseURL)),task=downloadToFile(src,filename,context.fetch);context.log(result=>`download: ${src} -> ${result}`,task),yield task;let format=context.imageOptions.format;format.length===0&&format.push(void 0);let size=context.imageOptions.size;size.length===0&&size.push(void 0);for(let size of sizeList){let sizedSrc=src.replace(/cube\_\d+/,`cube_${size}`),sizedFilename=(0,node_path.join)(context.distPath,relativeUrl(sizedSrc,context.baseURL)),task=downloadToFile(sizedSrc,sizedFilename,context.fetch);context.log(result=>`download ${sizedSrc} -> ${sizedFilename}`,task),yield task;for(let f of format){let task=imageProcessing(sizedFilename,{format:f,toFilename:context.imageProcessingFilename});context.log(result=>`imageProcessing: ${sizedFilename} -> ${result}`,task),yield task}}let tasks=[];for(let f of format)for(let s of size){let task=imageProcessing(filename,{format:f,size:s,toFilename:context.imageProcessingFilename});context.log(result=>`imageProcessing: ${filename} -> ${result}`,task),tasks.push(task)}yield Promise.all(tasks)})}function processRawFile(src,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let task=downloadToFile(src,(0,node_path.join)(context.distPath,relativeUrl(src,context.baseURL)),context.fetch);context.log(result=>`download: ${src} -> ${result}`,task),yield task})}function processObserver(observer,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let{images}=observer,tasks=CUBE_FACES.map(face=>processCubeImage(images.work.getURL(images[face]),images.sizeList,context));if(images.gainmap){let gainmap=images.gainmap;tasks.push(...CUBE_FACES.map(face=>processCubeImage(images.work.getURL(gainmap[face]),images.sizeList,context))),tasks.push(processRawFile(images.work.getURL(gainmap.cfg),context))}yield Promise.all(tasks),images.tiles&&(yield Promise.all(images.tiles.map(tile=>processTile(tile,context))))})}function process$1(work,context){return(0,tslib.__awaiter)(this,void 0,void 0,function*(){let{observers}=work;for(let observer of observers){let promise=processObserver(observer,context);context.log(`process observer #${observer.index} derived: ${observer.derivedIdStr}`,promise),yield promise}})}function log(msg,promise){if(promise){let startTime=Date.now();promise.then(data=>{let cost=Date.now()-startTime,text=typeof msg==`function`?msg(data):msg;console.log(text+`(${cost}ms)`)}).catch(()=>{})}else{let text=typeof msg==`function`?msg(null):msg;console.log(text)}}function download(work_1){return(0,tslib.__awaiter)(this,arguments,void 0,function*(work,options={}){var _a,_b,_c,_d,_e,_f,_g,_h,_j,_k;let baseURL=work.baseURL,distPath=``;if(options.distPath)distPath=(0,node_path.resolve)(process.cwd(),options.distPath);else for(distPath=(0,node_path.resolve)(process.cwd(),(_a=work.workCode)==null?`work-${Date.now()}`:_a);(0,node_fs.existsSync)(distPath);)/.-(\d+)$/.test(distPath)?distPath=distPath.replace(/.-(\d+)$/,(_,d)=>`-`+(Number(d)+1)):distPath+=`-1`;let context={baseURL,distPath,fetch:(_b=options.fetch)==null?fetch:_b,imageOptions:{size:(_d=(_c=options.imageOptions)==null?void 0:_c.size)==null?[]:_d,format:(_f=(_e=options.imageOptions)==null?void 0:_e.format)==null?[]:_f},textureOptions:{size:(_h=(_g=options.textureOptions)==null?void 0:_g.size)==null?[]:_h,format:(_k=(_j=options.textureOptions)==null?void 0:_j.format)==null?[]:_k},log:options.log?log:(()=>Promise.resolve()),imageProcessingFilename:options.imageProcessingFilename};context.log(JSON.stringify(context,null,` `)),yield(0,node_fs_promises.mkdir)(distPath,{recursive:!0}),yield(0,node_fs_promises.writeFile)((0,node_path.resolve)(distPath,`work.json`),JSON.stringify(work.toJSON(),null,` `)),yield process$1(work,context),yield process$2(work,context)})}exports.download=download;