@babylonjs/viewer 7.41.1-alpha → 7.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (619) hide show
  1. package/configuration/configuration.d.ts +107 -0
  2. package/configuration/configuration.js +16 -0
  3. package/configuration/configuration.js.map +1 -0
  4. package/configuration/configurationCompatibility.d.ts +8 -0
  5. package/configuration/configurationCompatibility.js +66 -0
  6. package/configuration/configurationCompatibility.js.map +1 -0
  7. package/configuration/configurationContainer.d.ts +10 -0
  8. package/configuration/configurationContainer.js +10 -0
  9. package/configuration/configurationContainer.js.map +1 -0
  10. package/configuration/globals.d.ts +6 -0
  11. package/configuration/globals.js +18 -0
  12. package/configuration/globals.js.map +1 -0
  13. package/configuration/index.d.ts +2 -0
  14. package/configuration/index.js +4 -0
  15. package/configuration/index.js.map +1 -0
  16. package/configuration/interfaces/cameraConfiguration.d.ts +31 -0
  17. package/configuration/interfaces/cameraConfiguration.js +2 -0
  18. package/configuration/interfaces/cameraConfiguration.js.map +1 -0
  19. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -0
  20. package/configuration/interfaces/colorGradingConfiguration.js +2 -0
  21. package/configuration/interfaces/colorGradingConfiguration.js.map +1 -0
  22. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -0
  23. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +2 -0
  24. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -0
  25. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -0
  26. package/configuration/interfaces/environmentMapConfiguration.js +2 -0
  27. package/configuration/interfaces/environmentMapConfiguration.js.map +1 -0
  28. package/configuration/interfaces/groundConfiguration.d.ts +24 -0
  29. package/configuration/interfaces/groundConfiguration.js +2 -0
  30. package/configuration/interfaces/groundConfiguration.js.map +1 -0
  31. package/configuration/interfaces/imageProcessingConfiguration.d.ts +45 -0
  32. package/configuration/interfaces/imageProcessingConfiguration.js +2 -0
  33. package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -0
  34. package/configuration/interfaces/index.d.ts +15 -0
  35. package/configuration/interfaces/index.js +16 -0
  36. package/configuration/interfaces/index.js.map +1 -0
  37. package/configuration/interfaces/lightConfiguration.d.ts +60 -0
  38. package/configuration/interfaces/lightConfiguration.js +2 -0
  39. package/configuration/interfaces/lightConfiguration.js.map +1 -0
  40. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -0
  41. package/configuration/interfaces/modelAnimationConfiguration.js +2 -0
  42. package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -0
  43. package/configuration/interfaces/modelConfiguration.d.ts +65 -0
  44. package/configuration/interfaces/modelConfiguration.js +2 -0
  45. package/configuration/interfaces/modelConfiguration.js.map +1 -0
  46. package/configuration/interfaces/observersConfiguration.d.ts +5 -0
  47. package/configuration/interfaces/observersConfiguration.js +2 -0
  48. package/configuration/interfaces/observersConfiguration.js.map +1 -0
  49. package/configuration/interfaces/sceneConfiguration.d.ts +48 -0
  50. package/configuration/interfaces/sceneConfiguration.js +2 -0
  51. package/configuration/interfaces/sceneConfiguration.js.map +1 -0
  52. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -0
  53. package/configuration/interfaces/sceneOptimizerConfiguration.js +2 -0
  54. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -0
  55. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -0
  56. package/configuration/interfaces/skyboxConfiguration.js +2 -0
  57. package/configuration/interfaces/skyboxConfiguration.js.map +1 -0
  58. package/configuration/interfaces/templateConfiguration.d.ts +67 -0
  59. package/configuration/interfaces/templateConfiguration.js +2 -0
  60. package/configuration/interfaces/templateConfiguration.js.map +1 -0
  61. package/configuration/interfaces/vrConfiguration.d.ts +16 -0
  62. package/configuration/interfaces/vrConfiguration.js +2 -0
  63. package/configuration/interfaces/vrConfiguration.js.map +1 -0
  64. package/configuration/loader.d.ts +4 -0
  65. package/configuration/loader.js +17 -0
  66. package/configuration/loader.js.map +1 -0
  67. package/configuration/mappers.d.ts +43 -0
  68. package/configuration/mappers.js +193 -0
  69. package/configuration/mappers.js.map +1 -0
  70. package/configuration/renderOnlyLoader.d.ts +33 -0
  71. package/configuration/renderOnlyLoader.js +162 -0
  72. package/configuration/renderOnlyLoader.js.map +1 -0
  73. package/configuration/types/default.d.ts +6 -0
  74. package/configuration/types/default.js +121 -0
  75. package/configuration/types/default.js.map +1 -0
  76. package/configuration/types/environmentMap.d.ts +5 -0
  77. package/configuration/types/environmentMap.js +14 -0
  78. package/configuration/types/environmentMap.js.map +1 -0
  79. package/configuration/types/extended.d.ts +6 -0
  80. package/configuration/types/extended.js +317 -0
  81. package/configuration/types/extended.js.map +1 -0
  82. package/configuration/types/index.d.ts +14 -0
  83. package/configuration/types/index.js +51 -0
  84. package/configuration/types/index.js.map +1 -0
  85. package/configuration/types/minimal.d.ts +6 -0
  86. package/configuration/types/minimal.js +43 -0
  87. package/configuration/types/minimal.js.map +1 -0
  88. package/configuration/types/renderOnlyDefault.d.ts +30 -0
  89. package/configuration/types/renderOnlyDefault.js +31 -0
  90. package/configuration/types/renderOnlyDefault.js.map +1 -0
  91. package/configuration/types/shadowLight.d.ts +9 -0
  92. package/configuration/types/shadowLight.js +64 -0
  93. package/configuration/types/shadowLight.js.map +1 -0
  94. package/helper/index.d.ts +29 -0
  95. package/helper/index.js +66 -0
  96. package/helper/index.js.map +1 -0
  97. package/index.d.ts +30 -0
  98. package/index.js +46 -0
  99. package/index.js.map +1 -0
  100. package/initializer.d.ts +11 -0
  101. package/initializer.js +35 -0
  102. package/initializer.js.map +1 -0
  103. package/interfaces.d.ts +5 -0
  104. package/interfaces.js +7 -0
  105. package/interfaces.js.map +1 -0
  106. package/labs/environmentSerializer.d.ts +126 -0
  107. package/labs/environmentSerializer.js +191 -0
  108. package/labs/environmentSerializer.js.map +1 -0
  109. package/labs/texture.d.ts +183 -0
  110. package/labs/texture.js +351 -0
  111. package/labs/texture.js.map +1 -0
  112. package/labs/viewerLabs.d.ts +51 -0
  113. package/labs/viewerLabs.js +134 -0
  114. package/labs/viewerLabs.js.map +1 -0
  115. package/loader/modelLoader.d.ts +56 -0
  116. package/loader/modelLoader.js +202 -0
  117. package/loader/modelLoader.js.map +1 -0
  118. package/loader/plugins/applyMaterialConfig.d.ts +12 -0
  119. package/loader/plugins/applyMaterialConfig.js +16 -0
  120. package/loader/plugins/applyMaterialConfig.js.map +1 -0
  121. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -0
  122. package/loader/plugins/extendedMaterialLoaderPlugin.js +16 -0
  123. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -0
  124. package/loader/plugins/index.d.ts +19 -0
  125. package/loader/plugins/index.js +44 -0
  126. package/loader/plugins/index.js.map +1 -0
  127. package/loader/plugins/loaderPlugin.d.ts +24 -0
  128. package/loader/plugins/loaderPlugin.js +2 -0
  129. package/loader/plugins/loaderPlugin.js.map +1 -0
  130. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -0
  131. package/loader/plugins/msftLodLoaderPlugin.js +21 -0
  132. package/loader/plugins/msftLodLoaderPlugin.js.map +1 -0
  133. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -0
  134. package/loader/plugins/telemetryLoaderPlugin.js +36 -0
  135. package/loader/plugins/telemetryLoaderPlugin.js.map +1 -0
  136. package/managers/observablesManager.d.ts +66 -0
  137. package/managers/observablesManager.js +35 -0
  138. package/managers/observablesManager.js.map +1 -0
  139. package/managers/sceneManager.d.ts +245 -0
  140. package/managers/sceneManager.js +1375 -0
  141. package/managers/sceneManager.js.map +1 -0
  142. package/managers/telemetryManager.d.ts +78 -0
  143. package/managers/telemetryManager.js +117 -0
  144. package/managers/telemetryManager.js.map +1 -0
  145. package/model/modelAnimation.d.ts +215 -0
  146. package/model/modelAnimation.js +237 -0
  147. package/model/modelAnimation.js.map +1 -0
  148. package/model/viewerModel.d.ts +233 -0
  149. package/model/viewerModel.js +673 -0
  150. package/model/viewerModel.js.map +1 -0
  151. package/optimizer/custom/extended.d.ts +13 -0
  152. package/optimizer/custom/extended.js +101 -0
  153. package/optimizer/custom/extended.js.map +1 -0
  154. package/optimizer/custom/index.d.ts +9 -0
  155. package/optimizer/custom/index.js +26 -0
  156. package/optimizer/custom/index.js.map +1 -0
  157. package/package.json +28 -19
  158. package/readme.md +28 -28
  159. package/renderOnlyIndex.d.ts +11 -0
  160. package/renderOnlyIndex.js +18 -0
  161. package/renderOnlyIndex.js.map +1 -0
  162. package/templating/eventManager.d.ts +35 -0
  163. package/templating/eventManager.js +66 -0
  164. package/templating/eventManager.js.map +1 -0
  165. package/templating/plugins/hdButtonPlugin.d.ts +9 -0
  166. package/templating/plugins/hdButtonPlugin.js +22 -0
  167. package/templating/plugins/hdButtonPlugin.js.map +1 -0
  168. package/templating/plugins/printButton.d.ts +9 -0
  169. package/templating/plugins/printButton.js +41 -0
  170. package/templating/plugins/printButton.js.map +1 -0
  171. package/templating/templateManager.d.ts +197 -0
  172. package/templating/templateManager.js +561 -0
  173. package/templating/templateManager.js.map +1 -0
  174. package/templating/viewerTemplatePlugin.d.ts +21 -0
  175. package/templating/viewerTemplatePlugin.js +69 -0
  176. package/templating/viewerTemplatePlugin.js.map +1 -0
  177. package/viewer/defaultViewer.d.ts +130 -0
  178. package/viewer/defaultViewer.js +672 -0
  179. package/viewer/defaultViewer.js.map +1 -0
  180. package/viewer/renderOnlyViewer.d.ts +9 -0
  181. package/viewer/renderOnlyViewer.js +46 -0
  182. package/viewer/renderOnlyViewer.js.map +1 -0
  183. package/viewer/viewer.d.ts +258 -0
  184. package/viewer/viewer.js +783 -0
  185. package/viewer/viewer.js.map +1 -0
  186. package/viewer/viewerManager.d.ts +58 -0
  187. package/viewer/viewerManager.js +91 -0
  188. package/viewer/viewerManager.js.map +1 -0
  189. package/viewer/viewerWithTemplate.d.ts +9 -0
  190. package/viewer/viewerWithTemplate.js +20 -0
  191. package/viewer/viewerWithTemplate.js.map +1 -0
  192. package/assets/photoStudio.env +0 -0
  193. package/dist/babylon-viewer.esm.js +0 -2
  194. package/dist/babylon-viewer.esm.js.map +0 -1
  195. package/dist/babylon-viewer.esm.min.js +0 -2
  196. package/dist/babylon-viewer.esm.min.js.map +0 -1
  197. package/dist/chunks/EXT_lights_ies-BS2USlck.esm.min.js +0 -2
  198. package/dist/chunks/EXT_lights_ies-BS2USlck.esm.min.js.map +0 -1
  199. package/dist/chunks/EXT_lights_ies-C-joQ5O4.esm.js +0 -84
  200. package/dist/chunks/EXT_lights_ies-C-joQ5O4.esm.js.map +0 -1
  201. package/dist/chunks/EXT_lights_image_based-C3wbbb5Z.esm.js +0 -171
  202. package/dist/chunks/EXT_lights_image_based-C3wbbb5Z.esm.js.map +0 -1
  203. package/dist/chunks/EXT_lights_image_based-DDdRDnM2.esm.min.js +0 -2
  204. package/dist/chunks/EXT_lights_image_based-DDdRDnM2.esm.min.js.map +0 -1
  205. package/dist/chunks/EXT_mesh_gpu_instancing-AXAnRQN7.esm.js +0 -86
  206. package/dist/chunks/EXT_mesh_gpu_instancing-AXAnRQN7.esm.js.map +0 -1
  207. package/dist/chunks/EXT_mesh_gpu_instancing-BcjPo6uC.esm.min.js +0 -2
  208. package/dist/chunks/EXT_mesh_gpu_instancing-BcjPo6uC.esm.min.js.map +0 -1
  209. package/dist/chunks/EXT_meshopt_compression-DlUkQB2P.esm.js +0 -134
  210. package/dist/chunks/EXT_meshopt_compression-DlUkQB2P.esm.js.map +0 -1
  211. package/dist/chunks/EXT_meshopt_compression-yJ4OpORd.esm.min.js +0 -2
  212. package/dist/chunks/EXT_meshopt_compression-yJ4OpORd.esm.min.js.map +0 -1
  213. package/dist/chunks/EXT_texture_avif-BQWbvJfK.esm.min.js +0 -2
  214. package/dist/chunks/EXT_texture_avif-BQWbvJfK.esm.min.js.map +0 -1
  215. package/dist/chunks/EXT_texture_avif-C0pGpnGv.esm.js +0 -44
  216. package/dist/chunks/EXT_texture_avif-C0pGpnGv.esm.js.map +0 -1
  217. package/dist/chunks/EXT_texture_webp-Dd7Uqtmh.esm.min.js +0 -2
  218. package/dist/chunks/EXT_texture_webp-Dd7Uqtmh.esm.min.js.map +0 -1
  219. package/dist/chunks/EXT_texture_webp-DehlrnW-.esm.js +0 -43
  220. package/dist/chunks/EXT_texture_webp-DehlrnW-.esm.js.map +0 -1
  221. package/dist/chunks/ExtrasAsMetadata-C5NMuDj4.esm.js +0 -64
  222. package/dist/chunks/ExtrasAsMetadata-C5NMuDj4.esm.js.map +0 -1
  223. package/dist/chunks/ExtrasAsMetadata-Cp3LHdoG.esm.min.js +0 -2
  224. package/dist/chunks/ExtrasAsMetadata-Cp3LHdoG.esm.min.js.map +0 -1
  225. package/dist/chunks/KHR_animation_pointer-DEBOwDXh.esm.min.js +0 -2
  226. package/dist/chunks/KHR_animation_pointer-DEBOwDXh.esm.min.js.map +0 -1
  227. package/dist/chunks/KHR_animation_pointer-Dx1OeG2b.esm.js +0 -352
  228. package/dist/chunks/KHR_animation_pointer-Dx1OeG2b.esm.js.map +0 -1
  229. package/dist/chunks/KHR_draco_mesh_compression-Ch0QOlBL.esm.min.js +0 -2
  230. package/dist/chunks/KHR_draco_mesh_compression-Ch0QOlBL.esm.min.js.map +0 -1
  231. package/dist/chunks/KHR_draco_mesh_compression-D59SFLyo.esm.js +0 -610
  232. package/dist/chunks/KHR_draco_mesh_compression-D59SFLyo.esm.js.map +0 -1
  233. package/dist/chunks/KHR_interactivity-Blj_9jts.esm.min.js +0 -2
  234. package/dist/chunks/KHR_interactivity-Blj_9jts.esm.min.js.map +0 -1
  235. package/dist/chunks/KHR_interactivity-CR0LYUa7.esm.js +0 -4033
  236. package/dist/chunks/KHR_interactivity-CR0LYUa7.esm.js.map +0 -1
  237. package/dist/chunks/KHR_lights_punctual--w0a62AP.esm.js +0 -581
  238. package/dist/chunks/KHR_lights_punctual--w0a62AP.esm.js.map +0 -1
  239. package/dist/chunks/KHR_lights_punctual-BojffBbG.esm.min.js +0 -2
  240. package/dist/chunks/KHR_lights_punctual-BojffBbG.esm.min.js.map +0 -1
  241. package/dist/chunks/KHR_materials_anisotropy-BPtHWkOQ.esm.js +0 -65
  242. package/dist/chunks/KHR_materials_anisotropy-BPtHWkOQ.esm.js.map +0 -1
  243. package/dist/chunks/KHR_materials_anisotropy-DU5_bnCL.esm.min.js +0 -2
  244. package/dist/chunks/KHR_materials_anisotropy-DU5_bnCL.esm.min.js.map +0 -1
  245. package/dist/chunks/KHR_materials_clearcoat-BBuRlPhc.esm.min.js +0 -2
  246. package/dist/chunks/KHR_materials_clearcoat-BBuRlPhc.esm.min.js.map +0 -1
  247. package/dist/chunks/KHR_materials_clearcoat-Eg0xbuWN.esm.js +0 -96
  248. package/dist/chunks/KHR_materials_clearcoat-Eg0xbuWN.esm.js.map +0 -1
  249. package/dist/chunks/KHR_materials_diffuse_transmission-Bkzk60Y5.esm.min.js +0 -2
  250. package/dist/chunks/KHR_materials_diffuse_transmission-Bkzk60Y5.esm.min.js.map +0 -1
  251. package/dist/chunks/KHR_materials_diffuse_transmission-C3DaLgRY.esm.js +0 -97
  252. package/dist/chunks/KHR_materials_diffuse_transmission-C3DaLgRY.esm.js.map +0 -1
  253. package/dist/chunks/KHR_materials_dispersion-DL_XFhxj.esm.js +0 -62
  254. package/dist/chunks/KHR_materials_dispersion-DL_XFhxj.esm.js.map +0 -1
  255. package/dist/chunks/KHR_materials_dispersion-DbMQPBgM.esm.min.js +0 -2
  256. package/dist/chunks/KHR_materials_dispersion-DbMQPBgM.esm.min.js.map +0 -1
  257. package/dist/chunks/KHR_materials_emissive_strength-BuHyjtBD.esm.js +0 -55
  258. package/dist/chunks/KHR_materials_emissive_strength-BuHyjtBD.esm.js.map +0 -1
  259. package/dist/chunks/KHR_materials_emissive_strength-Djlr_ul3.esm.min.js +0 -2
  260. package/dist/chunks/KHR_materials_emissive_strength-Djlr_ul3.esm.min.js.map +0 -1
  261. package/dist/chunks/KHR_materials_ior-BIe6qBOo.esm.js +0 -64
  262. package/dist/chunks/KHR_materials_ior-BIe6qBOo.esm.js.map +0 -1
  263. package/dist/chunks/KHR_materials_ior-DOfaAmNY.esm.min.js +0 -2
  264. package/dist/chunks/KHR_materials_ior-DOfaAmNY.esm.min.js.map +0 -1
  265. package/dist/chunks/KHR_materials_iridescence-BgElZgUu.esm.js +0 -72
  266. package/dist/chunks/KHR_materials_iridescence-BgElZgUu.esm.js.map +0 -1
  267. package/dist/chunks/KHR_materials_iridescence-lUeo07SZ.esm.min.js +0 -2
  268. package/dist/chunks/KHR_materials_iridescence-lUeo07SZ.esm.min.js.map +0 -1
  269. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-9ShQyhJ6.esm.min.js +0 -2
  270. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-9ShQyhJ6.esm.min.js.map +0 -1
  271. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE5LjLg6.esm.js +0 -81
  272. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-DE5LjLg6.esm.js.map +0 -1
  273. package/dist/chunks/KHR_materials_sheen-BfZe6ZFu.esm.js +0 -85
  274. package/dist/chunks/KHR_materials_sheen-BfZe6ZFu.esm.js.map +0 -1
  275. package/dist/chunks/KHR_materials_sheen-OWjuK2V4.esm.min.js +0 -2
  276. package/dist/chunks/KHR_materials_sheen-OWjuK2V4.esm.min.js.map +0 -1
  277. package/dist/chunks/KHR_materials_specular-dowPxbW3.esm.js +0 -75
  278. package/dist/chunks/KHR_materials_specular-dowPxbW3.esm.js.map +0 -1
  279. package/dist/chunks/KHR_materials_specular-nWeBZu0R.esm.min.js +0 -2
  280. package/dist/chunks/KHR_materials_specular-nWeBZu0R.esm.min.js.map +0 -1
  281. package/dist/chunks/KHR_materials_transmission-BPNQkK0O.esm.min.js +0 -2
  282. package/dist/chunks/KHR_materials_transmission-BPNQkK0O.esm.min.js.map +0 -1
  283. package/dist/chunks/KHR_materials_transmission-CHr_yLLX.esm.js +0 -307
  284. package/dist/chunks/KHR_materials_transmission-CHr_yLLX.esm.js.map +0 -1
  285. package/dist/chunks/KHR_materials_unlit-BYXpcsdj.esm.min.js +0 -2
  286. package/dist/chunks/KHR_materials_unlit-BYXpcsdj.esm.min.js.map +0 -1
  287. package/dist/chunks/KHR_materials_unlit-Cr7YsDHT.esm.js +0 -74
  288. package/dist/chunks/KHR_materials_unlit-Cr7YsDHT.esm.js.map +0 -1
  289. package/dist/chunks/KHR_materials_variants-BCVX3sJa.esm.js +0 -262
  290. package/dist/chunks/KHR_materials_variants-BCVX3sJa.esm.js.map +0 -1
  291. package/dist/chunks/KHR_materials_variants-BXzl6KpJ.esm.min.js +0 -2
  292. package/dist/chunks/KHR_materials_variants-BXzl6KpJ.esm.min.js.map +0 -1
  293. package/dist/chunks/KHR_materials_volume-BD9KEaJz.esm.min.js +0 -2
  294. package/dist/chunks/KHR_materials_volume-BD9KEaJz.esm.min.js.map +0 -1
  295. package/dist/chunks/KHR_materials_volume-DrqGUGW6.esm.js +0 -87
  296. package/dist/chunks/KHR_materials_volume-DrqGUGW6.esm.js.map +0 -1
  297. package/dist/chunks/KHR_mesh_quantization-Dg22auJA.esm.min.js +0 -2
  298. package/dist/chunks/KHR_mesh_quantization-Dg22auJA.esm.min.js.map +0 -1
  299. package/dist/chunks/KHR_mesh_quantization-hvxpvTbe.esm.js +0 -26
  300. package/dist/chunks/KHR_mesh_quantization-hvxpvTbe.esm.js.map +0 -1
  301. package/dist/chunks/KHR_node_hoverability-BDiqFmBB.esm.js +0 -39
  302. package/dist/chunks/KHR_node_hoverability-BDiqFmBB.esm.js.map +0 -1
  303. package/dist/chunks/KHR_node_hoverability-CumkOtZM.esm.min.js +0 -2
  304. package/dist/chunks/KHR_node_hoverability-CumkOtZM.esm.min.js.map +0 -1
  305. package/dist/chunks/KHR_node_visibility-BKEa-Yfj.esm.min.js +0 -2
  306. package/dist/chunks/KHR_node_visibility-BKEa-Yfj.esm.min.js.map +0 -1
  307. package/dist/chunks/KHR_node_visibility-K0fsD4Vv.esm.js +0 -46
  308. package/dist/chunks/KHR_node_visibility-K0fsD4Vv.esm.js.map +0 -1
  309. package/dist/chunks/KHR_texture_basisu-8YVY1pKo.esm.js +0 -43
  310. package/dist/chunks/KHR_texture_basisu-8YVY1pKo.esm.js.map +0 -1
  311. package/dist/chunks/KHR_texture_basisu-BM__NeSW.esm.min.js +0 -2
  312. package/dist/chunks/KHR_texture_basisu-BM__NeSW.esm.min.js.map +0 -1
  313. package/dist/chunks/KHR_texture_transform--qxpdvRw.esm.js +0 -63
  314. package/dist/chunks/KHR_texture_transform--qxpdvRw.esm.js.map +0 -1
  315. package/dist/chunks/KHR_texture_transform-C0MO-oJp.esm.min.js +0 -2
  316. package/dist/chunks/KHR_texture_transform-C0MO-oJp.esm.min.js.map +0 -1
  317. package/dist/chunks/KHR_xmp_json_ld-D9FpHvJo.esm.js +0 -51
  318. package/dist/chunks/KHR_xmp_json_ld-D9FpHvJo.esm.js.map +0 -1
  319. package/dist/chunks/KHR_xmp_json_ld-DeXPWWQE.esm.min.js +0 -2
  320. package/dist/chunks/KHR_xmp_json_ld-DeXPWWQE.esm.min.js.map +0 -1
  321. package/dist/chunks/MSFT_audio_emitter-BbICSwFH.esm.min.js +0 -2
  322. package/dist/chunks/MSFT_audio_emitter-BbICSwFH.esm.min.js.map +0 -1
  323. package/dist/chunks/MSFT_audio_emitter-Dd5lbfUc.esm.js +0 -2201
  324. package/dist/chunks/MSFT_audio_emitter-Dd5lbfUc.esm.js.map +0 -1
  325. package/dist/chunks/MSFT_lod-B0zrRF3s.esm.js +0 -337
  326. package/dist/chunks/MSFT_lod-B0zrRF3s.esm.js.map +0 -1
  327. package/dist/chunks/MSFT_lod-Bd4znUfD.esm.min.js +0 -2
  328. package/dist/chunks/MSFT_lod-Bd4znUfD.esm.min.js.map +0 -1
  329. package/dist/chunks/MSFT_minecraftMesh-CdIpMgsb.esm.min.js +0 -2
  330. package/dist/chunks/MSFT_minecraftMesh-CdIpMgsb.esm.min.js.map +0 -1
  331. package/dist/chunks/MSFT_minecraftMesh-WFc8m_Ka.esm.js +0 -46
  332. package/dist/chunks/MSFT_minecraftMesh-WFc8m_Ka.esm.js.map +0 -1
  333. package/dist/chunks/MSFT_sRGBFactors-CTbtGna8.esm.js +0 -47
  334. package/dist/chunks/MSFT_sRGBFactors-CTbtGna8.esm.js.map +0 -1
  335. package/dist/chunks/MSFT_sRGBFactors-yTSoBQJx.esm.min.js +0 -2
  336. package/dist/chunks/MSFT_sRGBFactors-yTSoBQJx.esm.min.js.map +0 -1
  337. package/dist/chunks/animationGroup-8TJDgymS.esm.js +0 -2482
  338. package/dist/chunks/animationGroup-8TJDgymS.esm.js.map +0 -1
  339. package/dist/chunks/animationGroup-toXtd3a1.esm.min.js +0 -2
  340. package/dist/chunks/animationGroup-toXtd3a1.esm.min.js.map +0 -1
  341. package/dist/chunks/assetContainer-7pMDUaac.esm.min.js +0 -2
  342. package/dist/chunks/assetContainer-7pMDUaac.esm.min.js.map +0 -1
  343. package/dist/chunks/assetContainer-DYzO0AbX.esm.js +0 -1720
  344. package/dist/chunks/assetContainer-DYzO0AbX.esm.js.map +0 -1
  345. package/dist/chunks/audioEngine-Kz4HSEXd.esm.min.js +0 -2
  346. package/dist/chunks/audioEngine-Kz4HSEXd.esm.min.js.map +0 -1
  347. package/dist/chunks/audioEngine-peiGqjr6.esm.js +0 -305
  348. package/dist/chunks/audioEngine-peiGqjr6.esm.js.map +0 -1
  349. package/dist/chunks/bakedVertexAnimation-BZvcL01J.esm.min.js +0 -2
  350. package/dist/chunks/bakedVertexAnimation-BZvcL01J.esm.min.js.map +0 -1
  351. package/dist/chunks/bakedVertexAnimation-CPflSjER.esm.js +0 -114
  352. package/dist/chunks/bakedVertexAnimation-CPflSjER.esm.js.map +0 -1
  353. package/dist/chunks/basisTextureLoader-CR0XhSAg.esm.js +0 -600
  354. package/dist/chunks/basisTextureLoader-CR0XhSAg.esm.js.map +0 -1
  355. package/dist/chunks/basisTextureLoader-DVJdcB62.esm.min.js +0 -2
  356. package/dist/chunks/basisTextureLoader-DVJdcB62.esm.min.js.map +0 -1
  357. package/dist/chunks/dds-6EdM5O6M.esm.js +0 -540
  358. package/dist/chunks/dds-6EdM5O6M.esm.js.map +0 -1
  359. package/dist/chunks/dds-DVX_K9B3.esm.min.js +0 -2
  360. package/dist/chunks/dds-DVX_K9B3.esm.min.js.map +0 -1
  361. package/dist/chunks/ddsTextureLoader-BAK7Ib2Z.esm.min.js +0 -2
  362. package/dist/chunks/ddsTextureLoader-BAK7Ib2Z.esm.min.js.map +0 -1
  363. package/dist/chunks/ddsTextureLoader-_nktVxwZ.esm.js +0 -88
  364. package/dist/chunks/ddsTextureLoader-_nktVxwZ.esm.js.map +0 -1
  365. package/dist/chunks/decalFragment-C_Cews3-.esm.js +0 -18
  366. package/dist/chunks/decalFragment-C_Cews3-.esm.js.map +0 -1
  367. package/dist/chunks/decalFragment-Dmj88EX9.esm.min.js +0 -2
  368. package/dist/chunks/decalFragment-Dmj88EX9.esm.min.js.map +0 -1
  369. package/dist/chunks/default.fragment-Bv_nR7po.esm.min.js +0 -2
  370. package/dist/chunks/default.fragment-Bv_nR7po.esm.min.js.map +0 -1
  371. package/dist/chunks/default.fragment-CkZQyJVM.esm.min.js +0 -2
  372. package/dist/chunks/default.fragment-CkZQyJVM.esm.min.js.map +0 -1
  373. package/dist/chunks/default.fragment-CyFHDykY.esm.js +0 -446
  374. package/dist/chunks/default.fragment-CyFHDykY.esm.js.map +0 -1
  375. package/dist/chunks/default.fragment-ej-2z5tS.esm.js +0 -515
  376. package/dist/chunks/default.fragment-ej-2z5tS.esm.js.map +0 -1
  377. package/dist/chunks/default.vertex-16mVOFgT.esm.js +0 -211
  378. package/dist/chunks/default.vertex-16mVOFgT.esm.js.map +0 -1
  379. package/dist/chunks/default.vertex-D--q2At3.esm.min.js +0 -2
  380. package/dist/chunks/default.vertex-D--q2At3.esm.min.js.map +0 -1
  381. package/dist/chunks/default.vertex-DDlgZTrR.esm.js +0 -190
  382. package/dist/chunks/default.vertex-DDlgZTrR.esm.js.map +0 -1
  383. package/dist/chunks/default.vertex-_jqs3KiZ.esm.min.js +0 -2
  384. package/dist/chunks/default.vertex-_jqs3KiZ.esm.min.js.map +0 -1
  385. package/dist/chunks/defaultUboDeclaration-8YG0iNg8.esm.js +0 -15
  386. package/dist/chunks/defaultUboDeclaration-8YG0iNg8.esm.js.map +0 -1
  387. package/dist/chunks/defaultUboDeclaration-BoBSRTbi.esm.js +0 -13
  388. package/dist/chunks/defaultUboDeclaration-BoBSRTbi.esm.js.map +0 -1
  389. package/dist/chunks/defaultUboDeclaration-Dt_5vo1d.esm.min.js +0 -2
  390. package/dist/chunks/defaultUboDeclaration-Dt_5vo1d.esm.min.js.map +0 -1
  391. package/dist/chunks/defaultUboDeclaration-R6gGjkAM.esm.min.js +0 -2
  392. package/dist/chunks/defaultUboDeclaration-R6gGjkAM.esm.min.js.map +0 -1
  393. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js +0 -11
  394. package/dist/chunks/drawWrapper.functions-CKg3_9x4.esm.js.map +0 -1
  395. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js +0 -2
  396. package/dist/chunks/drawWrapper.functions-ng7lvueZ.esm.min.js.map +0 -1
  397. package/dist/chunks/dumpTools-Bhux0wvM.esm.js +0 -200
  398. package/dist/chunks/dumpTools-Bhux0wvM.esm.js.map +0 -1
  399. package/dist/chunks/dumpTools-CHCb2UkY.esm.min.js +0 -2
  400. package/dist/chunks/dumpTools-CHCb2UkY.esm.min.js.map +0 -1
  401. package/dist/chunks/engine-DF_zE4qj.esm.js +0 -2213
  402. package/dist/chunks/engine-DF_zE4qj.esm.js.map +0 -1
  403. package/dist/chunks/engine-DVmdDcyP.esm.min.js +0 -2
  404. package/dist/chunks/engine-DVmdDcyP.esm.min.js.map +0 -1
  405. package/dist/chunks/engine.common-CvOmoKru.esm.js +0 -1162
  406. package/dist/chunks/engine.common-CvOmoKru.esm.js.map +0 -1
  407. package/dist/chunks/engine.common-DpTzktQJ.esm.min.js +0 -2
  408. package/dist/chunks/engine.common-DpTzktQJ.esm.min.js.map +0 -1
  409. package/dist/chunks/envTextureLoader-4YxGm-Px.esm.js +0 -64
  410. package/dist/chunks/envTextureLoader-4YxGm-Px.esm.js.map +0 -1
  411. package/dist/chunks/envTextureLoader-DMQui088.esm.min.js +0 -2
  412. package/dist/chunks/envTextureLoader-DMQui088.esm.min.js.map +0 -1
  413. package/dist/chunks/environmentTextureTools-BPGrTBPI.esm.min.js +0 -2
  414. package/dist/chunks/environmentTextureTools-BPGrTBPI.esm.min.js.map +0 -1
  415. package/dist/chunks/environmentTextureTools-DvkpsqkN.esm.js +0 -382
  416. package/dist/chunks/environmentTextureTools-DvkpsqkN.esm.js.map +0 -1
  417. package/dist/chunks/exrTextureLoader-BRkB54sO.esm.js +0 -1683
  418. package/dist/chunks/exrTextureLoader-BRkB54sO.esm.js.map +0 -1
  419. package/dist/chunks/exrTextureLoader-BtN7_zst.esm.min.js +0 -2
  420. package/dist/chunks/exrTextureLoader-BtN7_zst.esm.min.js.map +0 -1
  421. package/dist/chunks/fogFragment-BrGGFaiu.esm.js +0 -101
  422. package/dist/chunks/fogFragment-BrGGFaiu.esm.js.map +0 -1
  423. package/dist/chunks/fogFragment-ByOwwQur.esm.min.js +0 -2
  424. package/dist/chunks/fogFragment-ByOwwQur.esm.min.js.map +0 -1
  425. package/dist/chunks/fogFragment-Chod24nu.esm.min.js +0 -2
  426. package/dist/chunks/fogFragment-Chod24nu.esm.min.js.map +0 -1
  427. package/dist/chunks/fogFragment-gZfybCpt.esm.js +0 -102
  428. package/dist/chunks/fogFragment-gZfybCpt.esm.js.map +0 -1
  429. package/dist/chunks/fresnelFunction-BdEia8ob.esm.min.js +0 -2
  430. package/dist/chunks/fresnelFunction-BdEia8ob.esm.min.js.map +0 -1
  431. package/dist/chunks/fresnelFunction-DBlxfmri.esm.js +0 -12
  432. package/dist/chunks/fresnelFunction-DBlxfmri.esm.js.map +0 -1
  433. package/dist/chunks/glTFLoader-D4C1IGb3.esm.min.js +0 -2
  434. package/dist/chunks/glTFLoader-D4C1IGb3.esm.min.js.map +0 -1
  435. package/dist/chunks/glTFLoader-fUFiWvYb.esm.js +0 -7693
  436. package/dist/chunks/glTFLoader-fUFiWvYb.esm.js.map +0 -1
  437. package/dist/chunks/glTFLoaderAnimation-BB_Vw079.esm.min.js +0 -2
  438. package/dist/chunks/glTFLoaderAnimation-BB_Vw079.esm.min.js.map +0 -1
  439. package/dist/chunks/glTFLoaderAnimation-CttmY50U.esm.js +0 -77
  440. package/dist/chunks/glTFLoaderAnimation-CttmY50U.esm.js.map +0 -1
  441. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +0 -2
  442. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +0 -1
  443. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +0 -67
  444. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +0 -1
  445. package/dist/chunks/harmonicsFunctions-B0Rp1hEo.esm.min.js +0 -2
  446. package/dist/chunks/harmonicsFunctions-B0Rp1hEo.esm.min.js.map +0 -1
  447. package/dist/chunks/harmonicsFunctions-Cca_z552.esm.js +0 -34
  448. package/dist/chunks/harmonicsFunctions-Cca_z552.esm.js.map +0 -1
  449. package/dist/chunks/harmonicsFunctions-D4ID83NC.esm.min.js +0 -2
  450. package/dist/chunks/harmonicsFunctions-D4ID83NC.esm.min.js.map +0 -1
  451. package/dist/chunks/harmonicsFunctions-HJ5dbl0w.esm.js +0 -35
  452. package/dist/chunks/harmonicsFunctions-HJ5dbl0w.esm.js.map +0 -1
  453. package/dist/chunks/hdrTextureLoader-C3kqy6YV.esm.js +0 -253
  454. package/dist/chunks/hdrTextureLoader-C3kqy6YV.esm.js.map +0 -1
  455. package/dist/chunks/hdrTextureLoader-Dhlluz4z.esm.min.js +0 -2
  456. package/dist/chunks/hdrTextureLoader-Dhlluz4z.esm.min.js.map +0 -1
  457. package/dist/chunks/helperFunctions-BJotVqUd.esm.min.js +0 -2
  458. package/dist/chunks/helperFunctions-BJotVqUd.esm.min.js.map +0 -1
  459. package/dist/chunks/helperFunctions-C66wRWtu.esm.js +0 -110
  460. package/dist/chunks/helperFunctions-C66wRWtu.esm.js.map +0 -1
  461. package/dist/chunks/helperFunctions-DwEZ9rqh.esm.min.js +0 -2
  462. package/dist/chunks/helperFunctions-DwEZ9rqh.esm.min.js.map +0 -1
  463. package/dist/chunks/helperFunctions-gnki_9Kj.esm.js +0 -83
  464. package/dist/chunks/helperFunctions-gnki_9Kj.esm.js.map +0 -1
  465. package/dist/chunks/iesTextureLoader-QDs2Cwy5.esm.js +0 -189
  466. package/dist/chunks/iesTextureLoader-QDs2Cwy5.esm.js.map +0 -1
  467. package/dist/chunks/iesTextureLoader-pwA6Q4HK.esm.min.js +0 -2
  468. package/dist/chunks/iesTextureLoader-pwA6Q4HK.esm.min.js.map +0 -1
  469. package/dist/chunks/index-C6hXZyZb.esm.js +0 -74889
  470. package/dist/chunks/index-C6hXZyZb.esm.js.map +0 -1
  471. package/dist/chunks/index-rZVkfTE6.esm.min.js +0 -57
  472. package/dist/chunks/index-rZVkfTE6.esm.min.js.map +0 -1
  473. package/dist/chunks/ktxTextureLoader-jVu-Sj-0.esm.js +0 -814
  474. package/dist/chunks/ktxTextureLoader-jVu-Sj-0.esm.js.map +0 -1
  475. package/dist/chunks/ktxTextureLoader-zG9azrZF.esm.min.js +0 -2
  476. package/dist/chunks/ktxTextureLoader-zG9azrZF.esm.min.js.map +0 -1
  477. package/dist/chunks/logDepthDeclaration-0cA1pTvQ.esm.min.js +0 -2
  478. package/dist/chunks/logDepthDeclaration-0cA1pTvQ.esm.min.js.map +0 -1
  479. package/dist/chunks/logDepthDeclaration-CYxYhXIS.esm.js +0 -11
  480. package/dist/chunks/logDepthDeclaration-CYxYhXIS.esm.js.map +0 -1
  481. package/dist/chunks/logDepthDeclaration-D4KGxdX-.esm.min.js +0 -2
  482. package/dist/chunks/logDepthDeclaration-D4KGxdX-.esm.min.js.map +0 -1
  483. package/dist/chunks/logDepthDeclaration-DJlt2-H5.esm.js +0 -35
  484. package/dist/chunks/logDepthDeclaration-DJlt2-H5.esm.js.map +0 -1
  485. package/dist/chunks/logDepthVertex-BS2JEtXA.esm.min.js +0 -2
  486. package/dist/chunks/logDepthVertex-BS2JEtXA.esm.min.js.map +0 -1
  487. package/dist/chunks/logDepthVertex-DKPfA10X.esm.js +0 -81
  488. package/dist/chunks/logDepthVertex-DKPfA10X.esm.js.map +0 -1
  489. package/dist/chunks/logDepthVertex-ojTShW5I.esm.js +0 -77
  490. package/dist/chunks/logDepthVertex-ojTShW5I.esm.js.map +0 -1
  491. package/dist/chunks/logDepthVertex-v-0pHNc-.esm.min.js +0 -2
  492. package/dist/chunks/logDepthVertex-v-0pHNc-.esm.min.js.map +0 -1
  493. package/dist/chunks/mainUVVaryingDeclaration-BAzmbS0W.esm.min.js +0 -2
  494. package/dist/chunks/mainUVVaryingDeclaration-BAzmbS0W.esm.min.js.map +0 -1
  495. package/dist/chunks/mainUVVaryingDeclaration-Cnux1jkK.esm.js +0 -11
  496. package/dist/chunks/mainUVVaryingDeclaration-Cnux1jkK.esm.js.map +0 -1
  497. package/dist/chunks/mainUVVaryingDeclaration-CwS0hUUZ.esm.min.js +0 -2
  498. package/dist/chunks/mainUVVaryingDeclaration-CwS0hUUZ.esm.min.js.map +0 -1
  499. package/dist/chunks/mainUVVaryingDeclaration-DCawby1A.esm.js +0 -11
  500. package/dist/chunks/mainUVVaryingDeclaration-DCawby1A.esm.js.map +0 -1
  501. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js +0 -119
  502. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js.map +0 -1
  503. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js +0 -2
  504. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js.map +0 -1
  505. package/dist/chunks/meshUboDeclaration-QvH0RgeZ.esm.js +0 -26
  506. package/dist/chunks/meshUboDeclaration-QvH0RgeZ.esm.js.map +0 -1
  507. package/dist/chunks/meshUboDeclaration-g2s_cYI1.esm.min.js +0 -2
  508. package/dist/chunks/meshUboDeclaration-g2s_cYI1.esm.min.js.map +0 -1
  509. package/dist/chunks/objFileLoader-BOutXdVR.esm.min.js +0 -2
  510. package/dist/chunks/objFileLoader-BOutXdVR.esm.min.js.map +0 -1
  511. package/dist/chunks/objFileLoader-BPwrX8RK.esm.js +0 -1338
  512. package/dist/chunks/objFileLoader-BPwrX8RK.esm.js.map +0 -1
  513. package/dist/chunks/oitFragment-CmcWUhsZ.esm.js +0 -1240
  514. package/dist/chunks/oitFragment-CmcWUhsZ.esm.js.map +0 -1
  515. package/dist/chunks/oitFragment-D8XBQ6Wa.esm.js +0 -1078
  516. package/dist/chunks/oitFragment-D8XBQ6Wa.esm.js.map +0 -1
  517. package/dist/chunks/oitFragment-DgAlmoHs.esm.min.js +0 -2
  518. package/dist/chunks/oitFragment-DgAlmoHs.esm.min.js.map +0 -1
  519. package/dist/chunks/oitFragment-DpJ5xGhy.esm.min.js +0 -2
  520. package/dist/chunks/oitFragment-DpJ5xGhy.esm.min.js.map +0 -1
  521. package/dist/chunks/pass.fragment--XRaXRhU.esm.js +0 -15
  522. package/dist/chunks/pass.fragment--XRaXRhU.esm.js.map +0 -1
  523. package/dist/chunks/pass.fragment-5Q3qXxDe.esm.min.js +0 -2
  524. package/dist/chunks/pass.fragment-5Q3qXxDe.esm.min.js.map +0 -1
  525. package/dist/chunks/pass.fragment-BBLiyU_i.esm.min.js +0 -2
  526. package/dist/chunks/pass.fragment-BBLiyU_i.esm.min.js.map +0 -1
  527. package/dist/chunks/pass.fragment-DI4ZYZJe.esm.js +0 -15
  528. package/dist/chunks/pass.fragment-DI4ZYZJe.esm.js.map +0 -1
  529. package/dist/chunks/pbr.fragment-C7xQS4ZJ.esm.js +0 -3269
  530. package/dist/chunks/pbr.fragment-C7xQS4ZJ.esm.js.map +0 -1
  531. package/dist/chunks/pbr.fragment-Ddxaik8T.esm.min.js +0 -2
  532. package/dist/chunks/pbr.fragment-Ddxaik8T.esm.min.js.map +0 -1
  533. package/dist/chunks/pbr.fragment-fky04gH_.esm.js +0 -3222
  534. package/dist/chunks/pbr.fragment-fky04gH_.esm.js.map +0 -1
  535. package/dist/chunks/pbr.fragment-ya1zai4w.esm.min.js +0 -2
  536. package/dist/chunks/pbr.fragment-ya1zai4w.esm.min.js.map +0 -1
  537. package/dist/chunks/pbr.vertex-BPEYHoRM.esm.js +0 -223
  538. package/dist/chunks/pbr.vertex-BPEYHoRM.esm.js.map +0 -1
  539. package/dist/chunks/pbr.vertex-BXcMYADF.esm.js +0 -348
  540. package/dist/chunks/pbr.vertex-BXcMYADF.esm.js.map +0 -1
  541. package/dist/chunks/pbr.vertex-BjA08auU.esm.min.js +0 -2
  542. package/dist/chunks/pbr.vertex-BjA08auU.esm.min.js.map +0 -1
  543. package/dist/chunks/pbr.vertex-Cx2V3lNf.esm.min.js +0 -2
  544. package/dist/chunks/pbr.vertex-Cx2V3lNf.esm.min.js.map +0 -1
  545. package/dist/chunks/postprocess.vertex-BHpQrNSx.esm.min.js +0 -2
  546. package/dist/chunks/postprocess.vertex-BHpQrNSx.esm.min.js.map +0 -1
  547. package/dist/chunks/postprocess.vertex-DnDbk0tq.esm.js +0 -20
  548. package/dist/chunks/postprocess.vertex-DnDbk0tq.esm.js.map +0 -1
  549. package/dist/chunks/rawTexture-CWiRIto8.esm.js +0 -191
  550. package/dist/chunks/rawTexture-CWiRIto8.esm.js.map +0 -1
  551. package/dist/chunks/rawTexture-DX8V9PEj.esm.min.js +0 -2
  552. package/dist/chunks/rawTexture-DX8V9PEj.esm.min.js.map +0 -1
  553. package/dist/chunks/ray-ix7SqYNQ.esm.min.js +0 -2
  554. package/dist/chunks/ray-ix7SqYNQ.esm.min.js.map +0 -1
  555. package/dist/chunks/ray-nTZBkOil.esm.js +0 -946
  556. package/dist/chunks/ray-nTZBkOil.esm.js.map +0 -1
  557. package/dist/chunks/rgbdDecode.fragment-Be3ofvlt.esm.min.js +0 -2
  558. package/dist/chunks/rgbdDecode.fragment-Be3ofvlt.esm.min.js.map +0 -1
  559. package/dist/chunks/rgbdDecode.fragment-C05QJpT2.esm.js +0 -13
  560. package/dist/chunks/rgbdDecode.fragment-C05QJpT2.esm.js.map +0 -1
  561. package/dist/chunks/rgbdDecode.fragment-D3SYBclQ.esm.min.js +0 -2
  562. package/dist/chunks/rgbdDecode.fragment-D3SYBclQ.esm.min.js.map +0 -1
  563. package/dist/chunks/rgbdDecode.fragment-DBG6KfKF.esm.js +0 -13
  564. package/dist/chunks/rgbdDecode.fragment-DBG6KfKF.esm.js.map +0 -1
  565. package/dist/chunks/rgbdEncode.fragment-BlhtohrO.esm.js +0 -13
  566. package/dist/chunks/rgbdEncode.fragment-BlhtohrO.esm.js.map +0 -1
  567. package/dist/chunks/rgbdEncode.fragment-BmJKYw6A.esm.min.js +0 -2
  568. package/dist/chunks/rgbdEncode.fragment-BmJKYw6A.esm.min.js.map +0 -1
  569. package/dist/chunks/rgbdEncode.fragment-dr2kGjSO.esm.js +0 -13
  570. package/dist/chunks/rgbdEncode.fragment-dr2kGjSO.esm.js.map +0 -1
  571. package/dist/chunks/rgbdEncode.fragment-hXPzg1p5.esm.min.js +0 -2
  572. package/dist/chunks/rgbdEncode.fragment-hXPzg1p5.esm.min.js.map +0 -1
  573. package/dist/chunks/splatFileLoader-Bs42LtsP.esm.min.js +0 -2
  574. package/dist/chunks/splatFileLoader-Bs42LtsP.esm.min.js.map +0 -1
  575. package/dist/chunks/splatFileLoader-Dp33YOem.esm.js +0 -3379
  576. package/dist/chunks/splatFileLoader-Dp33YOem.esm.js.map +0 -1
  577. package/dist/chunks/spotLight-C0NmKeem.esm.js +0 -701
  578. package/dist/chunks/spotLight-C0NmKeem.esm.js.map +0 -1
  579. package/dist/chunks/spotLight-CcuCNdES.esm.min.js +0 -2
  580. package/dist/chunks/spotLight-CcuCNdES.esm.min.js.map +0 -1
  581. package/dist/chunks/standardMaterial-C1E5n_4w.esm.min.js +0 -2
  582. package/dist/chunks/standardMaterial-C1E5n_4w.esm.min.js.map +0 -1
  583. package/dist/chunks/standardMaterial-v_D8QA4q.esm.js +0 -1807
  584. package/dist/chunks/standardMaterial-v_D8QA4q.esm.js.map +0 -1
  585. package/dist/chunks/stlFileLoader-DC2IRQDj.esm.min.js +0 -2
  586. package/dist/chunks/stlFileLoader-DC2IRQDj.esm.min.js.map +0 -1
  587. package/dist/chunks/stlFileLoader-LRHEIFfU.esm.js +0 -238
  588. package/dist/chunks/stlFileLoader-LRHEIFfU.esm.js.map +0 -1
  589. package/dist/chunks/tgaTextureLoader-2ekJC0En.esm.js +0 -349
  590. package/dist/chunks/tgaTextureLoader-2ekJC0En.esm.js.map +0 -1
  591. package/dist/chunks/tgaTextureLoader-Clj6zUK-.esm.min.js +0 -2
  592. package/dist/chunks/tgaTextureLoader-Clj6zUK-.esm.min.js.map +0 -1
  593. package/dist/chunks/thinEngine-DksimP2U.esm.js +0 -3848
  594. package/dist/chunks/thinEngine-DksimP2U.esm.js.map +0 -1
  595. package/dist/chunks/thinEngine-tsALaFYH.esm.min.js +0 -2
  596. package/dist/chunks/thinEngine-tsALaFYH.esm.min.js.map +0 -1
  597. package/dist/chunks/thinInstanceMesh-B8AW0Oa2.esm.js +0 -314
  598. package/dist/chunks/thinInstanceMesh-B8AW0Oa2.esm.js.map +0 -1
  599. package/dist/chunks/thinInstanceMesh-kCGEJ0-e.esm.min.js +0 -2
  600. package/dist/chunks/thinInstanceMesh-kCGEJ0-e.esm.min.js.map +0 -1
  601. package/dist/chunks/vertexColorMixing-Bjijk3lU.esm.min.js +0 -2
  602. package/dist/chunks/vertexColorMixing-Bjijk3lU.esm.min.js.map +0 -1
  603. package/dist/chunks/vertexColorMixing-D9917nJN.esm.js +0 -428
  604. package/dist/chunks/vertexColorMixing-D9917nJN.esm.js.map +0 -1
  605. package/dist/chunks/vertexColorMixing-DgthWrKf.esm.min.js +0 -2
  606. package/dist/chunks/vertexColorMixing-DgthWrKf.esm.min.js.map +0 -1
  607. package/dist/chunks/vertexColorMixing-U1SA6UK3.esm.js +0 -538
  608. package/dist/chunks/vertexColorMixing-U1SA6UK3.esm.js.map +0 -1
  609. package/dist/chunks/webgpuEngine-BOGR1D8F.esm.min.js +0 -2
  610. package/dist/chunks/webgpuEngine-BOGR1D8F.esm.min.js.map +0 -1
  611. package/dist/chunks/webgpuEngine-BrzOpZ-2.esm.js +0 -11533
  612. package/dist/chunks/webgpuEngine-BrzOpZ-2.esm.js.map +0 -1
  613. package/dist/chunks/workerPool-BUOov2K1.esm.js +0 -122
  614. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +0 -1
  615. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +0 -2
  616. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +0 -1
  617. package/lib/index.d.ts +0 -591
  618. package/lib/index.js +0 -2165
  619. package/lib/index.js.map +0 -1
@@ -1,2482 +0,0 @@
1
- import { aT as Animation, a5 as Matrix, bH as _staticOffsetValueColor4, bI as _staticOffsetValueColor3, bJ as _staticOffsetValueSize, bK as _staticOffsetValueVector2, bL as _staticOffsetValueVector3, bM as _staticOffsetValueQuaternion, o as PrecisionDate, aV as Observable, ac as Quaternion, a7 as TmpVectors, v as Vector3, al as Scene, E as EngineStore, bN as Tags } from './index-C6hXZyZb.esm.js';
2
- import { B as Bone } from './glTFLoader-fUFiWvYb.esm.js';
3
- import './rawTexture-CWiRIto8.esm.js';
4
- import './assetContainer-DYzO0AbX.esm.js';
5
- import './glTFLoaderAnimation-CttmY50U.esm.js';
6
-
7
- /**
8
- * Defines a runtime animation
9
- */
10
- class RuntimeAnimation {
11
- /**
12
- * Gets the current frame of the runtime animation
13
- */
14
- get currentFrame() {
15
- return this._currentFrame;
16
- }
17
- /**
18
- * Gets the weight of the runtime animation
19
- */
20
- get weight() {
21
- return this._weight;
22
- }
23
- /**
24
- * Gets the current value of the runtime animation
25
- */
26
- get currentValue() {
27
- return this._currentValue;
28
- }
29
- /**
30
- * Gets or sets the target path of the runtime animation
31
- */
32
- get targetPath() {
33
- return this._targetPath;
34
- }
35
- /**
36
- * Gets the actual target of the runtime animation
37
- */
38
- get target() {
39
- return this._currentActiveTarget;
40
- }
41
- /**
42
- * Gets the additive state of the runtime animation
43
- */
44
- get isAdditive() {
45
- return this._host && this._host.isAdditive;
46
- }
47
- /**
48
- * Create a new RuntimeAnimation object
49
- * @param target defines the target of the animation
50
- * @param animation defines the source animation object
51
- * @param scene defines the hosting scene
52
- * @param host defines the initiating Animatable
53
- */
54
- constructor(target, animation, scene, host) {
55
- this._events = new Array();
56
- /**
57
- * The current frame of the runtime animation
58
- */
59
- this._currentFrame = 0;
60
- /**
61
- * The original value of the runtime animation
62
- */
63
- this._originalValue = new Array();
64
- /**
65
- * The original blend value of the runtime animation
66
- */
67
- this._originalBlendValue = null;
68
- /**
69
- * The offsets cache of the runtime animation
70
- */
71
- this._offsetsCache = {};
72
- /**
73
- * The high limits cache of the runtime animation
74
- */
75
- this._highLimitsCache = {};
76
- /**
77
- * Specifies if the runtime animation has been stopped
78
- */
79
- this._stopped = false;
80
- /**
81
- * The blending factor of the runtime animation
82
- */
83
- this._blendingFactor = 0;
84
- /**
85
- * The current value of the runtime animation
86
- */
87
- this._currentValue = null;
88
- this._currentActiveTarget = null;
89
- this._directTarget = null;
90
- /**
91
- * The target path of the runtime animation
92
- */
93
- this._targetPath = "";
94
- /**
95
- * The weight of the runtime animation
96
- */
97
- this._weight = 1.0;
98
- /**
99
- * The absolute frame offset of the runtime animation
100
- */
101
- this._absoluteFrameOffset = 0;
102
- /**
103
- * The previous elapsed time (since start of animation) of the runtime animation
104
- */
105
- this._previousElapsedTime = 0;
106
- this._yoyoDirection = 1;
107
- /**
108
- * The previous absolute frame of the runtime animation (meaning, without taking into account the from/to values, only the elapsed time and the fps)
109
- */
110
- this._previousAbsoluteFrame = 0;
111
- this._targetIsArray = false;
112
- this._animation = animation;
113
- this._target = target;
114
- this._scene = scene;
115
- this._host = host;
116
- this._activeTargets = [];
117
- animation._runtimeAnimations.push(this);
118
- // State
119
- this._animationState = {
120
- key: 0,
121
- repeatCount: 0,
122
- loopMode: this._getCorrectLoopMode(),
123
- };
124
- if (this._animation.dataType === Animation.ANIMATIONTYPE_MATRIX) {
125
- this._animationState.workValue = Matrix.Zero();
126
- }
127
- // Limits
128
- this._keys = this._animation.getKeys();
129
- this._minFrame = this._keys[0].frame;
130
- this._maxFrame = this._keys[this._keys.length - 1].frame;
131
- this._minValue = this._keys[0].value;
132
- this._maxValue = this._keys[this._keys.length - 1].value;
133
- // Add a start key at frame 0 if missing
134
- if (this._minFrame !== 0) {
135
- const newKey = { frame: 0, value: this._minValue };
136
- this._keys.splice(0, 0, newKey);
137
- }
138
- // Check data
139
- if (this._target instanceof Array) {
140
- let index = 0;
141
- for (const target of this._target) {
142
- this._preparePath(target, index);
143
- this._getOriginalValues(index);
144
- index++;
145
- }
146
- this._targetIsArray = true;
147
- }
148
- else {
149
- this._preparePath(this._target);
150
- this._getOriginalValues();
151
- this._targetIsArray = false;
152
- this._directTarget = this._activeTargets[0];
153
- }
154
- // Cloning events locally
155
- const events = animation.getEvents();
156
- if (events && events.length > 0) {
157
- events.forEach((e) => {
158
- this._events.push(e._clone());
159
- });
160
- }
161
- this._enableBlending = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.enableBlending : this._animation.enableBlending;
162
- }
163
- _preparePath(target, targetIndex = 0) {
164
- const targetPropertyPath = this._animation.targetPropertyPath;
165
- if (targetPropertyPath.length > 1) {
166
- let property = target;
167
- for (let index = 0; index < targetPropertyPath.length - 1; index++) {
168
- const name = targetPropertyPath[index];
169
- property = property[name];
170
- if (property === undefined) {
171
- throw new Error(`Invalid property (${name}) in property path (${targetPropertyPath.join(".")})`);
172
- }
173
- }
174
- this._targetPath = targetPropertyPath[targetPropertyPath.length - 1];
175
- this._activeTargets[targetIndex] = property;
176
- }
177
- else {
178
- this._targetPath = targetPropertyPath[0];
179
- this._activeTargets[targetIndex] = target;
180
- }
181
- if (this._activeTargets[targetIndex][this._targetPath] === undefined) {
182
- throw new Error(`Invalid property (${this._targetPath}) in property path (${targetPropertyPath.join(".")})`);
183
- }
184
- }
185
- /**
186
- * Gets the animation from the runtime animation
187
- */
188
- get animation() {
189
- return this._animation;
190
- }
191
- /**
192
- * Resets the runtime animation to the beginning
193
- * @param restoreOriginal defines whether to restore the target property to the original value
194
- */
195
- reset(restoreOriginal = false) {
196
- if (restoreOriginal) {
197
- if (this._target instanceof Array) {
198
- let index = 0;
199
- for (const target of this._target) {
200
- if (this._originalValue[index] !== undefined) {
201
- this._setValue(target, this._activeTargets[index], this._originalValue[index], -1, index);
202
- }
203
- index++;
204
- }
205
- }
206
- else {
207
- if (this._originalValue[0] !== undefined) {
208
- this._setValue(this._target, this._directTarget, this._originalValue[0], -1, 0);
209
- }
210
- }
211
- }
212
- this._offsetsCache = {};
213
- this._highLimitsCache = {};
214
- this._currentFrame = 0;
215
- this._blendingFactor = 0;
216
- // Events
217
- for (let index = 0; index < this._events.length; index++) {
218
- this._events[index].isDone = false;
219
- }
220
- }
221
- /**
222
- * Specifies if the runtime animation is stopped
223
- * @returns Boolean specifying if the runtime animation is stopped
224
- */
225
- isStopped() {
226
- return this._stopped;
227
- }
228
- /**
229
- * Disposes of the runtime animation
230
- */
231
- dispose() {
232
- const index = this._animation.runtimeAnimations.indexOf(this);
233
- if (index > -1) {
234
- this._animation.runtimeAnimations.splice(index, 1);
235
- }
236
- }
237
- /**
238
- * Apply the interpolated value to the target
239
- * @param currentValue defines the value computed by the animation
240
- * @param weight defines the weight to apply to this value (Defaults to 1.0)
241
- */
242
- setValue(currentValue, weight) {
243
- if (this._targetIsArray) {
244
- for (let index = 0; index < this._target.length; index++) {
245
- const target = this._target[index];
246
- this._setValue(target, this._activeTargets[index], currentValue, weight, index);
247
- }
248
- return;
249
- }
250
- this._setValue(this._target, this._directTarget, currentValue, weight, 0);
251
- }
252
- _getOriginalValues(targetIndex = 0) {
253
- let originalValue;
254
- const target = this._activeTargets[targetIndex];
255
- if (target.getLocalMatrix && this._targetPath === "_matrix") {
256
- // For bones
257
- originalValue = target.getLocalMatrix();
258
- }
259
- else {
260
- originalValue = target[this._targetPath];
261
- }
262
- if (originalValue && originalValue.clone) {
263
- this._originalValue[targetIndex] = originalValue.clone();
264
- }
265
- else {
266
- this._originalValue[targetIndex] = originalValue;
267
- }
268
- }
269
- _registerTargetForLateAnimationBinding(runtimeAnimation, originalValue) {
270
- const target = runtimeAnimation.target;
271
- this._scene._registeredForLateAnimationBindings.pushNoDuplicate(target);
272
- if (!target._lateAnimationHolders) {
273
- target._lateAnimationHolders = {};
274
- }
275
- if (!target._lateAnimationHolders[runtimeAnimation.targetPath]) {
276
- target._lateAnimationHolders[runtimeAnimation.targetPath] = {
277
- totalWeight: 0,
278
- totalAdditiveWeight: 0,
279
- animations: [],
280
- additiveAnimations: [],
281
- originalValue: originalValue,
282
- };
283
- }
284
- if (runtimeAnimation.isAdditive) {
285
- target._lateAnimationHolders[runtimeAnimation.targetPath].additiveAnimations.push(runtimeAnimation);
286
- target._lateAnimationHolders[runtimeAnimation.targetPath].totalAdditiveWeight += runtimeAnimation.weight;
287
- }
288
- else {
289
- target._lateAnimationHolders[runtimeAnimation.targetPath].animations.push(runtimeAnimation);
290
- target._lateAnimationHolders[runtimeAnimation.targetPath].totalWeight += runtimeAnimation.weight;
291
- }
292
- }
293
- _setValue(target, destination, currentValue, weight, targetIndex) {
294
- // Set value
295
- this._currentActiveTarget = destination;
296
- this._weight = weight;
297
- if (this._enableBlending && this._blendingFactor <= 1.0) {
298
- if (!this._originalBlendValue) {
299
- const originalValue = destination[this._targetPath];
300
- if (originalValue.clone) {
301
- this._originalBlendValue = originalValue.clone();
302
- }
303
- else {
304
- this._originalBlendValue = originalValue;
305
- }
306
- }
307
- if (this._originalBlendValue.m) {
308
- // Matrix
309
- if (Animation.AllowMatrixDecomposeForInterpolation) {
310
- if (this._currentValue) {
311
- Matrix.DecomposeLerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
312
- }
313
- else {
314
- this._currentValue = Matrix.DecomposeLerp(this._originalBlendValue, currentValue, this._blendingFactor);
315
- }
316
- }
317
- else {
318
- if (this._currentValue) {
319
- Matrix.LerpToRef(this._originalBlendValue, currentValue, this._blendingFactor, this._currentValue);
320
- }
321
- else {
322
- this._currentValue = Matrix.Lerp(this._originalBlendValue, currentValue, this._blendingFactor);
323
- }
324
- }
325
- }
326
- else {
327
- this._currentValue = Animation._UniversalLerp(this._originalBlendValue, currentValue, this._blendingFactor);
328
- }
329
- const blendingSpeed = target && target.animationPropertiesOverride ? target.animationPropertiesOverride.blendingSpeed : this._animation.blendingSpeed;
330
- this._blendingFactor += blendingSpeed;
331
- }
332
- else {
333
- if (!this._currentValue) {
334
- if (currentValue?.clone) {
335
- this._currentValue = currentValue.clone();
336
- }
337
- else {
338
- this._currentValue = currentValue;
339
- }
340
- }
341
- else if (this._currentValue.copyFrom) {
342
- this._currentValue.copyFrom(currentValue);
343
- }
344
- else {
345
- this._currentValue = currentValue;
346
- }
347
- }
348
- if (weight !== -1.0) {
349
- this._registerTargetForLateAnimationBinding(this, this._originalValue[targetIndex]);
350
- }
351
- else {
352
- if (this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT) {
353
- if (this._currentValue.addToRef) {
354
- this._currentValue.addToRef(this._originalValue[targetIndex], destination[this._targetPath]);
355
- }
356
- else {
357
- destination[this._targetPath] = this._originalValue[targetIndex] + this._currentValue;
358
- }
359
- }
360
- else {
361
- destination[this._targetPath] = this._currentValue;
362
- }
363
- }
364
- if (target.markAsDirty) {
365
- target.markAsDirty(this._animation.targetProperty);
366
- }
367
- }
368
- /**
369
- * Gets the loop pmode of the runtime animation
370
- * @returns Loop Mode
371
- */
372
- _getCorrectLoopMode() {
373
- if (this._target && this._target.animationPropertiesOverride) {
374
- return this._target.animationPropertiesOverride.loopMode;
375
- }
376
- return this._animation.loopMode;
377
- }
378
- /**
379
- * Move the current animation to a given frame
380
- * @param frame defines the frame to move to
381
- * @param weight defines the weight to apply to the animation (-1.0 by default)
382
- */
383
- goToFrame(frame, weight = -1) {
384
- const keys = this._animation.getKeys();
385
- if (frame < keys[0].frame) {
386
- frame = keys[0].frame;
387
- }
388
- else if (frame > keys[keys.length - 1].frame) {
389
- frame = keys[keys.length - 1].frame;
390
- }
391
- // Need to reset animation events
392
- const events = this._events;
393
- if (events.length) {
394
- for (let index = 0; index < events.length; index++) {
395
- if (!events[index].onlyOnce) {
396
- // reset events in the future
397
- events[index].isDone = events[index].frame < frame;
398
- }
399
- }
400
- }
401
- this._currentFrame = frame;
402
- const currentValue = this._animation._interpolate(frame, this._animationState);
403
- this.setValue(currentValue, weight);
404
- }
405
- /**
406
- * @internal Internal use only
407
- */
408
- _prepareForSpeedRatioChange(newSpeedRatio) {
409
- const newAbsoluteFrame = (this._previousElapsedTime * (this._animation.framePerSecond * newSpeedRatio)) / 1000.0;
410
- this._absoluteFrameOffset = this._previousAbsoluteFrame - newAbsoluteFrame;
411
- }
412
- /**
413
- * Execute the current animation
414
- * @param elapsedTimeSinceAnimationStart defines the elapsed time (in milliseconds) since the animation was started
415
- * @param from defines the lower frame of the animation range
416
- * @param to defines the upper frame of the animation range
417
- * @param loop defines if the current animation must loop
418
- * @param speedRatio defines the current speed ratio
419
- * @param weight defines the weight of the animation (default is -1 so no weight)
420
- * @returns a boolean indicating if the animation is running
421
- */
422
- animate(elapsedTimeSinceAnimationStart, from, to, loop, speedRatio, weight = -1.0) {
423
- const animation = this._animation;
424
- const targetPropertyPath = animation.targetPropertyPath;
425
- if (!targetPropertyPath || targetPropertyPath.length < 1) {
426
- this._stopped = true;
427
- return false;
428
- }
429
- let returnValue = true;
430
- // Check limits
431
- if (from < this._minFrame || from > this._maxFrame) {
432
- from = this._minFrame;
433
- }
434
- if (to < this._minFrame || to > this._maxFrame) {
435
- to = this._maxFrame;
436
- }
437
- const frameRange = to - from;
438
- let offsetValue;
439
- // Compute the frame according to the elapsed time and the fps of the animation ("from" and "to" are not factored in!)
440
- let absoluteFrame = (elapsedTimeSinceAnimationStart * (animation.framePerSecond * speedRatio)) / 1000.0 + this._absoluteFrameOffset;
441
- let highLimitValue = 0;
442
- // Apply the yoyo function if required
443
- let yoyoLoop = false;
444
- const yoyoMode = loop && this._animationState.loopMode === Animation.ANIMATIONLOOPMODE_YOYO;
445
- if (yoyoMode) {
446
- const position = (absoluteFrame - from) / frameRange;
447
- // Apply the yoyo curve
448
- const sin = Math.sin(position * Math.PI);
449
- const yoyoPosition = Math.abs(sin);
450
- // Map the yoyo position back to the range
451
- absoluteFrame = yoyoPosition * frameRange + from;
452
- const direction = sin >= 0 ? 1 : -1;
453
- if (this._yoyoDirection !== direction) {
454
- yoyoLoop = true;
455
- }
456
- this._yoyoDirection = direction;
457
- }
458
- this._previousElapsedTime = elapsedTimeSinceAnimationStart;
459
- this._previousAbsoluteFrame = absoluteFrame;
460
- if (!loop && to >= from && ((absoluteFrame >= frameRange && speedRatio > 0) || (absoluteFrame <= 0 && speedRatio < 0))) {
461
- // If we are out of range and not looping get back to caller
462
- returnValue = false;
463
- highLimitValue = animation._getKeyValue(this._maxValue);
464
- }
465
- else if (!loop && from >= to && ((absoluteFrame <= frameRange && speedRatio < 0) || (absoluteFrame >= 0 && speedRatio > 0))) {
466
- returnValue = false;
467
- highLimitValue = animation._getKeyValue(this._minValue);
468
- }
469
- else if (this._animationState.loopMode !== Animation.ANIMATIONLOOPMODE_CYCLE) {
470
- const keyOffset = to.toString() + from.toString();
471
- if (!this._offsetsCache[keyOffset]) {
472
- this._animationState.repeatCount = 0;
473
- this._animationState.loopMode = Animation.ANIMATIONLOOPMODE_CYCLE; // force a specific codepath in animation._interpolate()!
474
- const fromValue = animation._interpolate(from, this._animationState);
475
- const toValue = animation._interpolate(to, this._animationState);
476
- this._animationState.loopMode = this._getCorrectLoopMode();
477
- switch (animation.dataType) {
478
- // Float
479
- case Animation.ANIMATIONTYPE_FLOAT:
480
- this._offsetsCache[keyOffset] = toValue - fromValue;
481
- break;
482
- // Quaternion
483
- case Animation.ANIMATIONTYPE_QUATERNION:
484
- this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
485
- break;
486
- // Vector3
487
- case Animation.ANIMATIONTYPE_VECTOR3:
488
- this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
489
- break;
490
- // Vector2
491
- case Animation.ANIMATIONTYPE_VECTOR2:
492
- this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
493
- break;
494
- // Size
495
- case Animation.ANIMATIONTYPE_SIZE:
496
- this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
497
- break;
498
- // Color3
499
- case Animation.ANIMATIONTYPE_COLOR3:
500
- this._offsetsCache[keyOffset] = toValue.subtract(fromValue);
501
- break;
502
- }
503
- this._highLimitsCache[keyOffset] = toValue;
504
- }
505
- highLimitValue = this._highLimitsCache[keyOffset];
506
- offsetValue = this._offsetsCache[keyOffset];
507
- }
508
- if (offsetValue === undefined) {
509
- switch (animation.dataType) {
510
- // Float
511
- case Animation.ANIMATIONTYPE_FLOAT:
512
- offsetValue = 0;
513
- break;
514
- // Quaternion
515
- case Animation.ANIMATIONTYPE_QUATERNION:
516
- offsetValue = _staticOffsetValueQuaternion;
517
- break;
518
- // Vector3
519
- case Animation.ANIMATIONTYPE_VECTOR3:
520
- offsetValue = _staticOffsetValueVector3;
521
- break;
522
- // Vector2
523
- case Animation.ANIMATIONTYPE_VECTOR2:
524
- offsetValue = _staticOffsetValueVector2;
525
- break;
526
- // Size
527
- case Animation.ANIMATIONTYPE_SIZE:
528
- offsetValue = _staticOffsetValueSize;
529
- break;
530
- // Color3
531
- case Animation.ANIMATIONTYPE_COLOR3:
532
- offsetValue = _staticOffsetValueColor3;
533
- break;
534
- case Animation.ANIMATIONTYPE_COLOR4:
535
- offsetValue = _staticOffsetValueColor4;
536
- break;
537
- }
538
- }
539
- // Compute value
540
- let currentFrame;
541
- if (this._host && this._host.syncRoot) {
542
- // If we must sync with an animatable, calculate the current frame based on the frame of the root animatable
543
- const syncRoot = this._host.syncRoot;
544
- const hostNormalizedFrame = (syncRoot.masterFrame - syncRoot.fromFrame) / (syncRoot.toFrame - syncRoot.fromFrame);
545
- currentFrame = from + frameRange * hostNormalizedFrame;
546
- }
547
- else {
548
- if ((absoluteFrame > 0 && from > to) || (absoluteFrame < 0 && from < to)) {
549
- currentFrame = returnValue && frameRange !== 0 ? to + (absoluteFrame % frameRange) : from;
550
- }
551
- else {
552
- currentFrame = returnValue && frameRange !== 0 ? from + (absoluteFrame % frameRange) : to;
553
- }
554
- }
555
- const events = this._events;
556
- // Reset event/state if looping
557
- if ((!yoyoMode && ((speedRatio > 0 && this.currentFrame > currentFrame) || (speedRatio < 0 && this.currentFrame < currentFrame))) || (yoyoMode && yoyoLoop)) {
558
- this._onLoop();
559
- // Need to reset animation events
560
- for (let index = 0; index < events.length; index++) {
561
- if (!events[index].onlyOnce) {
562
- // reset event, the animation is looping
563
- events[index].isDone = false;
564
- }
565
- }
566
- this._animationState.key = speedRatio > 0 ? 0 : animation.getKeys().length - 1;
567
- }
568
- this._currentFrame = currentFrame;
569
- this._animationState.repeatCount = frameRange === 0 ? 0 : (absoluteFrame / frameRange) >> 0;
570
- this._animationState.highLimitValue = highLimitValue;
571
- this._animationState.offsetValue = offsetValue;
572
- const currentValue = animation._interpolate(currentFrame, this._animationState);
573
- // Set value
574
- this.setValue(currentValue, weight);
575
- // Check events
576
- if (events.length) {
577
- for (let index = 0; index < events.length; index++) {
578
- // Make sure current frame has passed event frame and that event frame is within the current range
579
- // Also, handle both forward and reverse animations
580
- if ((frameRange >= 0 && currentFrame >= events[index].frame && events[index].frame >= from) ||
581
- (frameRange < 0 && currentFrame <= events[index].frame && events[index].frame <= from)) {
582
- const event = events[index];
583
- if (!event.isDone) {
584
- // If event should be done only once, remove it.
585
- if (event.onlyOnce) {
586
- events.splice(index, 1);
587
- index--;
588
- }
589
- event.isDone = true;
590
- event.action(currentFrame);
591
- } // Don't do anything if the event has already been done.
592
- }
593
- }
594
- }
595
- if (!returnValue) {
596
- this._stopped = true;
597
- }
598
- return returnValue;
599
- }
600
- }
601
-
602
- /**
603
- * Class used to store an actual running animation
604
- */
605
- class Animatable {
606
- /**
607
- * Gets the root Animatable used to synchronize and normalize animations
608
- */
609
- get syncRoot() {
610
- return this._syncRoot;
611
- }
612
- /**
613
- * Gets the current frame of the first RuntimeAnimation
614
- * Used to synchronize Animatables
615
- */
616
- get masterFrame() {
617
- if (this._runtimeAnimations.length === 0) {
618
- return 0;
619
- }
620
- return this._runtimeAnimations[0].currentFrame;
621
- }
622
- /**
623
- * Gets or sets the animatable weight (-1.0 by default meaning not weighted)
624
- */
625
- get weight() {
626
- return this._weight;
627
- }
628
- set weight(value) {
629
- if (value === -1) {
630
- // -1 is ok and means no weight
631
- this._weight = -1;
632
- return;
633
- }
634
- // Else weight must be in [0, 1] range
635
- this._weight = Math.min(Math.max(value, 0), 1.0);
636
- }
637
- /**
638
- * Gets or sets the speed ratio to apply to the animatable (1.0 by default)
639
- */
640
- get speedRatio() {
641
- return this._speedRatio;
642
- }
643
- set speedRatio(value) {
644
- for (let index = 0; index < this._runtimeAnimations.length; index++) {
645
- const animation = this._runtimeAnimations[index];
646
- animation._prepareForSpeedRatioChange(value);
647
- }
648
- this._speedRatio = value;
649
- // Resync _manualJumpDelay in case goToFrame was called before speedRatio was set.
650
- if (this._goToFrame !== null) {
651
- this.goToFrame(this._goToFrame);
652
- }
653
- }
654
- /**
655
- * Gets the elapsed time since the animatable started in milliseconds
656
- */
657
- get elapsedTime() {
658
- return this._localDelayOffset === null ? 0 : this._scene._animationTime - this._localDelayOffset;
659
- }
660
- /**
661
- * Creates a new Animatable
662
- * @param scene defines the hosting scene
663
- * @param target defines the target object
664
- * @param fromFrame defines the starting frame number (default is 0)
665
- * @param toFrame defines the ending frame number (default is 100)
666
- * @param loopAnimation defines if the animation must loop (default is false)
667
- * @param speedRatio defines the factor to apply to animation speed (default is 1)
668
- * @param onAnimationEnd defines a callback to call when animation ends if it is not looping
669
- * @param animations defines a group of animation to add to the new Animatable
670
- * @param onAnimationLoop defines a callback to call when animation loops
671
- * @param isAdditive defines whether the animation should be evaluated additively
672
- * @param playOrder defines the order in which this animatable should be processed in the list of active animatables (default: 0)
673
- */
674
- constructor(scene,
675
- /** defines the target object */
676
- target,
677
- /** [0] defines the starting frame number (default is 0) */
678
- fromFrame = 0,
679
- /** [100] defines the ending frame number (default is 100) */
680
- toFrame = 100,
681
- /** [false] defines if the animation must loop (default is false) */
682
- loopAnimation = false, speedRatio = 1.0,
683
- /** defines a callback to call when animation ends if it is not looping */
684
- onAnimationEnd, animations,
685
- /** defines a callback to call when animation loops */
686
- onAnimationLoop,
687
- /** [false] defines whether the animation should be evaluated additively */
688
- isAdditive = false,
689
- /** [0] defines the order in which this animatable should be processed in the list of active animatables (default: 0) */
690
- playOrder = 0) {
691
- this.target = target;
692
- this.fromFrame = fromFrame;
693
- this.toFrame = toFrame;
694
- this.loopAnimation = loopAnimation;
695
- this.onAnimationEnd = onAnimationEnd;
696
- this.onAnimationLoop = onAnimationLoop;
697
- this.isAdditive = isAdditive;
698
- this.playOrder = playOrder;
699
- this._localDelayOffset = null;
700
- this._pausedDelay = null;
701
- this._manualJumpDelay = null;
702
- /** @hidden */
703
- this._runtimeAnimations = new Array();
704
- this._paused = false;
705
- this._speedRatio = 1;
706
- this._weight = -1.0;
707
- this._syncRoot = null;
708
- this._frameToSyncFromJump = null;
709
- this._goToFrame = null;
710
- /**
711
- * Gets or sets a boolean indicating if the animatable must be disposed and removed at the end of the animation.
712
- * This will only apply for non looping animation (default is true)
713
- */
714
- this.disposeOnEnd = true;
715
- /**
716
- * Gets a boolean indicating if the animation has started
717
- */
718
- this.animationStarted = false;
719
- /**
720
- * Observer raised when the animation ends
721
- */
722
- this.onAnimationEndObservable = new Observable();
723
- /**
724
- * Observer raised when the animation loops
725
- */
726
- this.onAnimationLoopObservable = new Observable();
727
- this._scene = scene;
728
- if (animations) {
729
- this.appendAnimations(target, animations);
730
- }
731
- this._speedRatio = speedRatio;
732
- scene._activeAnimatables.push(this);
733
- }
734
- // Methods
735
- /**
736
- * Synchronize and normalize current Animatable with a source Animatable
737
- * This is useful when using animation weights and when animations are not of the same length
738
- * @param root defines the root Animatable to synchronize with (null to stop synchronizing)
739
- * @returns the current Animatable
740
- */
741
- syncWith(root) {
742
- this._syncRoot = root;
743
- if (root) {
744
- // Make sure this animatable will animate after the root
745
- const index = this._scene._activeAnimatables.indexOf(this);
746
- if (index > -1) {
747
- this._scene._activeAnimatables.splice(index, 1);
748
- this._scene._activeAnimatables.push(this);
749
- }
750
- }
751
- return this;
752
- }
753
- /**
754
- * Gets the list of runtime animations
755
- * @returns an array of RuntimeAnimation
756
- */
757
- getAnimations() {
758
- return this._runtimeAnimations;
759
- }
760
- /**
761
- * Adds more animations to the current animatable
762
- * @param target defines the target of the animations
763
- * @param animations defines the new animations to add
764
- */
765
- appendAnimations(target, animations) {
766
- for (let index = 0; index < animations.length; index++) {
767
- const animation = animations[index];
768
- const newRuntimeAnimation = new RuntimeAnimation(target, animation, this._scene, this);
769
- newRuntimeAnimation._onLoop = () => {
770
- this.onAnimationLoopObservable.notifyObservers(this);
771
- if (this.onAnimationLoop) {
772
- this.onAnimationLoop();
773
- }
774
- };
775
- this._runtimeAnimations.push(newRuntimeAnimation);
776
- }
777
- }
778
- /**
779
- * Gets the source animation for a specific property
780
- * @param property defines the property to look for
781
- * @returns null or the source animation for the given property
782
- */
783
- getAnimationByTargetProperty(property) {
784
- const runtimeAnimations = this._runtimeAnimations;
785
- for (let index = 0; index < runtimeAnimations.length; index++) {
786
- if (runtimeAnimations[index].animation.targetProperty === property) {
787
- return runtimeAnimations[index].animation;
788
- }
789
- }
790
- return null;
791
- }
792
- /**
793
- * Gets the runtime animation for a specific property
794
- * @param property defines the property to look for
795
- * @returns null or the runtime animation for the given property
796
- */
797
- getRuntimeAnimationByTargetProperty(property) {
798
- const runtimeAnimations = this._runtimeAnimations;
799
- for (let index = 0; index < runtimeAnimations.length; index++) {
800
- if (runtimeAnimations[index].animation.targetProperty === property) {
801
- return runtimeAnimations[index];
802
- }
803
- }
804
- return null;
805
- }
806
- /**
807
- * Resets the animatable to its original state
808
- */
809
- reset() {
810
- const runtimeAnimations = this._runtimeAnimations;
811
- for (let index = 0; index < runtimeAnimations.length; index++) {
812
- runtimeAnimations[index].reset(true);
813
- }
814
- this._localDelayOffset = null;
815
- this._pausedDelay = null;
816
- }
817
- /**
818
- * Allows the animatable to blend with current running animations
819
- * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending
820
- * @param blendingSpeed defines the blending speed to use
821
- */
822
- enableBlending(blendingSpeed) {
823
- const runtimeAnimations = this._runtimeAnimations;
824
- for (let index = 0; index < runtimeAnimations.length; index++) {
825
- runtimeAnimations[index].animation.enableBlending = true;
826
- runtimeAnimations[index].animation.blendingSpeed = blendingSpeed;
827
- }
828
- }
829
- /**
830
- * Disable animation blending
831
- * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-blending
832
- */
833
- disableBlending() {
834
- const runtimeAnimations = this._runtimeAnimations;
835
- for (let index = 0; index < runtimeAnimations.length; index++) {
836
- runtimeAnimations[index].animation.enableBlending = false;
837
- }
838
- }
839
- /**
840
- * Jump directly to a given frame
841
- * @param frame defines the frame to jump to
842
- * @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
843
- */
844
- goToFrame(frame, useWeight = false) {
845
- const runtimeAnimations = this._runtimeAnimations;
846
- if (runtimeAnimations[0]) {
847
- const fps = runtimeAnimations[0].animation.framePerSecond;
848
- this._frameToSyncFromJump = this._frameToSyncFromJump ?? runtimeAnimations[0].currentFrame;
849
- const delay = this.speedRatio === 0 ? 0 : (((frame - this._frameToSyncFromJump) / fps) * 1000) / this.speedRatio;
850
- this._manualJumpDelay = -delay;
851
- }
852
- for (let index = 0; index < runtimeAnimations.length; index++) {
853
- runtimeAnimations[index].goToFrame(frame, useWeight ? this._weight : -1);
854
- }
855
- this._goToFrame = frame;
856
- }
857
- /**
858
- * Returns true if the animations for this animatable are paused
859
- */
860
- get paused() {
861
- return this._paused;
862
- }
863
- /**
864
- * Pause the animation
865
- */
866
- pause() {
867
- if (this._paused) {
868
- return;
869
- }
870
- this._paused = true;
871
- }
872
- /**
873
- * Restart the animation
874
- */
875
- restart() {
876
- this._paused = false;
877
- }
878
- _raiseOnAnimationEnd() {
879
- if (this.onAnimationEnd) {
880
- this.onAnimationEnd();
881
- }
882
- this.onAnimationEndObservable.notifyObservers(this);
883
- }
884
- /**
885
- * Stop and delete the current animation
886
- * @param animationName defines a string used to only stop some of the runtime animations instead of all
887
- * @param targetMask a function that determines if the animation should be stopped based on its target (all animations will be stopped if both this and animationName are empty)
888
- * @param useGlobalSplice if true, the animatables will be removed by the caller of this function (false by default)
889
- * @param skipOnAnimationEnd defines if the system should not raise onAnimationEnd. Default is false
890
- */
891
- stop(animationName, targetMask, useGlobalSplice = false, skipOnAnimationEnd = false) {
892
- if (animationName || targetMask) {
893
- const idx = this._scene._activeAnimatables.indexOf(this);
894
- if (idx > -1) {
895
- const runtimeAnimations = this._runtimeAnimations;
896
- for (let index = runtimeAnimations.length - 1; index >= 0; index--) {
897
- const runtimeAnimation = runtimeAnimations[index];
898
- if (animationName && runtimeAnimation.animation.name != animationName) {
899
- continue;
900
- }
901
- if (targetMask && !targetMask(runtimeAnimation.target)) {
902
- continue;
903
- }
904
- runtimeAnimation.dispose();
905
- runtimeAnimations.splice(index, 1);
906
- }
907
- if (runtimeAnimations.length == 0) {
908
- if (!useGlobalSplice) {
909
- this._scene._activeAnimatables.splice(idx, 1);
910
- }
911
- if (!skipOnAnimationEnd) {
912
- this._raiseOnAnimationEnd();
913
- }
914
- }
915
- }
916
- }
917
- else {
918
- const index = this._scene._activeAnimatables.indexOf(this);
919
- if (index > -1) {
920
- if (!useGlobalSplice) {
921
- this._scene._activeAnimatables.splice(index, 1);
922
- }
923
- const runtimeAnimations = this._runtimeAnimations;
924
- for (let index = 0; index < runtimeAnimations.length; index++) {
925
- runtimeAnimations[index].dispose();
926
- }
927
- this._runtimeAnimations.length = 0;
928
- if (!skipOnAnimationEnd) {
929
- this._raiseOnAnimationEnd();
930
- }
931
- }
932
- }
933
- }
934
- /**
935
- * Wait asynchronously for the animation to end
936
- * @returns a promise which will be fulfilled when the animation ends
937
- */
938
- waitAsync() {
939
- return new Promise((resolve) => {
940
- this.onAnimationEndObservable.add(() => {
941
- resolve(this);
942
- }, undefined, undefined, this, true);
943
- });
944
- }
945
- /**
946
- * @internal
947
- */
948
- _animate(delay) {
949
- if (this._paused) {
950
- this.animationStarted = false;
951
- if (this._pausedDelay === null) {
952
- this._pausedDelay = delay;
953
- }
954
- return true;
955
- }
956
- if (this._localDelayOffset === null) {
957
- this._localDelayOffset = delay;
958
- this._pausedDelay = null;
959
- }
960
- else if (this._pausedDelay !== null) {
961
- this._localDelayOffset += delay - this._pausedDelay;
962
- this._pausedDelay = null;
963
- }
964
- if (this._manualJumpDelay !== null) {
965
- this._localDelayOffset += this._manualJumpDelay;
966
- this._manualJumpDelay = null;
967
- this._frameToSyncFromJump = null;
968
- }
969
- this._goToFrame = null;
970
- if (this._weight === 0) {
971
- // We consider that an animatable with a weight === 0 is "actively" paused
972
- return true;
973
- }
974
- // Animating
975
- let running = false;
976
- const runtimeAnimations = this._runtimeAnimations;
977
- let index;
978
- for (index = 0; index < runtimeAnimations.length; index++) {
979
- const animation = runtimeAnimations[index];
980
- const isRunning = animation.animate(delay - this._localDelayOffset, this.fromFrame, this.toFrame, this.loopAnimation, this._speedRatio, this._weight);
981
- running = running || isRunning;
982
- }
983
- this.animationStarted = running;
984
- if (!running) {
985
- if (this.disposeOnEnd) {
986
- // Remove from active animatables
987
- index = this._scene._activeAnimatables.indexOf(this);
988
- this._scene._activeAnimatables.splice(index, 1);
989
- // Dispose all runtime animations
990
- for (index = 0; index < runtimeAnimations.length; index++) {
991
- runtimeAnimations[index].dispose();
992
- }
993
- }
994
- this._raiseOnAnimationEnd();
995
- if (this.disposeOnEnd) {
996
- this.onAnimationEnd = null;
997
- this.onAnimationLoop = null;
998
- this.onAnimationLoopObservable.clear();
999
- this.onAnimationEndObservable.clear();
1000
- }
1001
- }
1002
- return running;
1003
- }
1004
- }
1005
- /** @internal */
1006
- function ProcessLateAnimationBindingsForMatrices(holder) {
1007
- if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {
1008
- return holder.originalValue;
1009
- }
1010
- let normalizer = 1.0;
1011
- const finalPosition = TmpVectors.Vector3[0];
1012
- const finalScaling = TmpVectors.Vector3[1];
1013
- const finalQuaternion = TmpVectors.Quaternion[0];
1014
- let startIndex = 0;
1015
- const originalAnimation = holder.animations[0];
1016
- const originalValue = holder.originalValue;
1017
- let scale = 1;
1018
- let skipOverride = false;
1019
- if (holder.totalWeight < 1.0) {
1020
- // We need to mix the original value in
1021
- scale = 1.0 - holder.totalWeight;
1022
- originalValue.decompose(finalScaling, finalQuaternion, finalPosition);
1023
- }
1024
- else {
1025
- startIndex = 1;
1026
- // We need to normalize the weights
1027
- normalizer = holder.totalWeight;
1028
- scale = originalAnimation.weight / normalizer;
1029
- if (scale == 1) {
1030
- if (holder.totalAdditiveWeight) {
1031
- skipOverride = true;
1032
- }
1033
- else {
1034
- return originalAnimation.currentValue;
1035
- }
1036
- }
1037
- originalAnimation.currentValue.decompose(finalScaling, finalQuaternion, finalPosition);
1038
- }
1039
- // Add up the override animations
1040
- if (!skipOverride) {
1041
- finalScaling.scaleInPlace(scale);
1042
- finalPosition.scaleInPlace(scale);
1043
- finalQuaternion.scaleInPlace(scale);
1044
- for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {
1045
- const runtimeAnimation = holder.animations[animIndex];
1046
- if (runtimeAnimation.weight === 0) {
1047
- continue;
1048
- }
1049
- scale = runtimeAnimation.weight / normalizer;
1050
- const currentPosition = TmpVectors.Vector3[2];
1051
- const currentScaling = TmpVectors.Vector3[3];
1052
- const currentQuaternion = TmpVectors.Quaternion[1];
1053
- runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);
1054
- currentScaling.scaleAndAddToRef(scale, finalScaling);
1055
- currentQuaternion.scaleAndAddToRef(Quaternion.Dot(finalQuaternion, currentQuaternion) > 0 ? scale : -scale, finalQuaternion);
1056
- currentPosition.scaleAndAddToRef(scale, finalPosition);
1057
- }
1058
- finalQuaternion.normalize();
1059
- }
1060
- // Add up the additive animations
1061
- for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {
1062
- const runtimeAnimation = holder.additiveAnimations[animIndex];
1063
- if (runtimeAnimation.weight === 0) {
1064
- continue;
1065
- }
1066
- const currentPosition = TmpVectors.Vector3[2];
1067
- const currentScaling = TmpVectors.Vector3[3];
1068
- const currentQuaternion = TmpVectors.Quaternion[1];
1069
- runtimeAnimation.currentValue.decompose(currentScaling, currentQuaternion, currentPosition);
1070
- currentScaling.multiplyToRef(finalScaling, currentScaling);
1071
- Vector3.LerpToRef(finalScaling, currentScaling, runtimeAnimation.weight, finalScaling);
1072
- finalQuaternion.multiplyToRef(currentQuaternion, currentQuaternion);
1073
- Quaternion.SlerpToRef(finalQuaternion, currentQuaternion, runtimeAnimation.weight, finalQuaternion);
1074
- currentPosition.scaleAndAddToRef(runtimeAnimation.weight, finalPosition);
1075
- }
1076
- const workValue = originalAnimation ? originalAnimation._animationState.workValue : TmpVectors.Matrix[0].clone();
1077
- Matrix.ComposeToRef(finalScaling, finalQuaternion, finalPosition, workValue);
1078
- return workValue;
1079
- }
1080
- /** @internal */
1081
- function ProcessLateAnimationBindingsForQuaternions(holder, refQuaternion) {
1082
- if (holder.totalWeight === 0 && holder.totalAdditiveWeight === 0) {
1083
- return refQuaternion;
1084
- }
1085
- const originalAnimation = holder.animations[0];
1086
- const originalValue = holder.originalValue;
1087
- let cumulativeQuaternion = refQuaternion;
1088
- if (holder.totalWeight === 0 && holder.totalAdditiveWeight > 0) {
1089
- cumulativeQuaternion.copyFrom(originalValue);
1090
- }
1091
- else if (holder.animations.length === 1) {
1092
- Quaternion.SlerpToRef(originalValue, originalAnimation.currentValue, Math.min(1.0, holder.totalWeight), cumulativeQuaternion);
1093
- if (holder.totalAdditiveWeight === 0) {
1094
- return cumulativeQuaternion;
1095
- }
1096
- }
1097
- else if (holder.animations.length > 1) {
1098
- // Add up the override animations
1099
- let normalizer = 1.0;
1100
- let quaternions;
1101
- let weights;
1102
- if (holder.totalWeight < 1.0) {
1103
- const scale = 1.0 - holder.totalWeight;
1104
- quaternions = [];
1105
- weights = [];
1106
- quaternions.push(originalValue);
1107
- weights.push(scale);
1108
- }
1109
- else {
1110
- if (holder.animations.length === 2) {
1111
- // Slerp as soon as we can
1112
- Quaternion.SlerpToRef(holder.animations[0].currentValue, holder.animations[1].currentValue, holder.animations[1].weight / holder.totalWeight, refQuaternion);
1113
- if (holder.totalAdditiveWeight === 0) {
1114
- return refQuaternion;
1115
- }
1116
- }
1117
- quaternions = [];
1118
- weights = [];
1119
- normalizer = holder.totalWeight;
1120
- }
1121
- for (let animIndex = 0; animIndex < holder.animations.length; animIndex++) {
1122
- const runtimeAnimation = holder.animations[animIndex];
1123
- quaternions.push(runtimeAnimation.currentValue);
1124
- weights.push(runtimeAnimation.weight / normalizer);
1125
- }
1126
- // https://gamedev.stackexchange.com/questions/62354/method-for-interpolation-between-3-quaternions
1127
- let cumulativeAmount = 0;
1128
- for (let index = 0; index < quaternions.length;) {
1129
- if (!index) {
1130
- Quaternion.SlerpToRef(quaternions[index], quaternions[index + 1], weights[index + 1] / (weights[index] + weights[index + 1]), refQuaternion);
1131
- cumulativeQuaternion = refQuaternion;
1132
- cumulativeAmount = weights[index] + weights[index + 1];
1133
- index += 2;
1134
- continue;
1135
- }
1136
- cumulativeAmount += weights[index];
1137
- Quaternion.SlerpToRef(cumulativeQuaternion, quaternions[index], weights[index] / cumulativeAmount, cumulativeQuaternion);
1138
- index++;
1139
- }
1140
- }
1141
- // Add up the additive animations
1142
- for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {
1143
- const runtimeAnimation = holder.additiveAnimations[animIndex];
1144
- if (runtimeAnimation.weight === 0) {
1145
- continue;
1146
- }
1147
- cumulativeQuaternion.multiplyToRef(runtimeAnimation.currentValue, TmpVectors.Quaternion[0]);
1148
- Quaternion.SlerpToRef(cumulativeQuaternion, TmpVectors.Quaternion[0], runtimeAnimation.weight, cumulativeQuaternion);
1149
- }
1150
- return cumulativeQuaternion;
1151
- }
1152
- /** @internal */
1153
- function ProcessLateAnimationBindings(scene) {
1154
- if (!scene._registeredForLateAnimationBindings.length) {
1155
- return;
1156
- }
1157
- for (let index = 0; index < scene._registeredForLateAnimationBindings.length; index++) {
1158
- const target = scene._registeredForLateAnimationBindings.data[index];
1159
- for (const path in target._lateAnimationHolders) {
1160
- const holder = target._lateAnimationHolders[path];
1161
- const originalAnimation = holder.animations[0];
1162
- const originalValue = holder.originalValue;
1163
- if (originalValue === undefined || originalValue === null) {
1164
- continue;
1165
- }
1166
- const matrixDecomposeMode = Animation.AllowMatrixDecomposeForInterpolation && originalValue.m; // ie. data is matrix
1167
- let finalValue = target[path];
1168
- if (matrixDecomposeMode) {
1169
- finalValue = ProcessLateAnimationBindingsForMatrices(holder);
1170
- }
1171
- else {
1172
- const quaternionMode = originalValue.w !== undefined;
1173
- if (quaternionMode) {
1174
- finalValue = ProcessLateAnimationBindingsForQuaternions(holder, finalValue || Quaternion.Identity());
1175
- }
1176
- else {
1177
- let startIndex = 0;
1178
- let normalizer = 1.0;
1179
- const originalAnimationIsLoopRelativeFromCurrent = originalAnimation && originalAnimation._animationState.loopMode === Animation.ANIMATIONLOOPMODE_RELATIVE_FROM_CURRENT;
1180
- if (holder.totalWeight < 1.0) {
1181
- // We need to mix the original value in
1182
- if (originalAnimationIsLoopRelativeFromCurrent) {
1183
- finalValue = originalValue.clone ? originalValue.clone() : originalValue;
1184
- }
1185
- else if (originalAnimation && originalValue.scale) {
1186
- finalValue = originalValue.scale(1.0 - holder.totalWeight);
1187
- }
1188
- else if (originalAnimation) {
1189
- finalValue = originalValue * (1.0 - holder.totalWeight);
1190
- }
1191
- else if (originalValue.clone) {
1192
- finalValue = originalValue.clone();
1193
- }
1194
- else {
1195
- finalValue = originalValue;
1196
- }
1197
- }
1198
- else if (originalAnimation) {
1199
- // We need to normalize the weights
1200
- normalizer = holder.totalWeight;
1201
- const scale = originalAnimation.weight / normalizer;
1202
- if (scale !== 1) {
1203
- if (originalAnimation.currentValue.scale) {
1204
- finalValue = originalAnimation.currentValue.scale(scale);
1205
- }
1206
- else {
1207
- finalValue = originalAnimation.currentValue * scale;
1208
- }
1209
- }
1210
- else {
1211
- finalValue = originalAnimation.currentValue;
1212
- }
1213
- if (originalAnimationIsLoopRelativeFromCurrent) {
1214
- if (finalValue.addToRef) {
1215
- finalValue.addToRef(originalValue, finalValue);
1216
- }
1217
- else {
1218
- finalValue += originalValue;
1219
- }
1220
- }
1221
- startIndex = 1;
1222
- }
1223
- // Add up the override animations
1224
- for (let animIndex = startIndex; animIndex < holder.animations.length; animIndex++) {
1225
- const runtimeAnimation = holder.animations[animIndex];
1226
- const scale = runtimeAnimation.weight / normalizer;
1227
- if (!scale) {
1228
- continue;
1229
- }
1230
- else if (runtimeAnimation.currentValue.scaleAndAddToRef) {
1231
- runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);
1232
- }
1233
- else {
1234
- finalValue += runtimeAnimation.currentValue * scale;
1235
- }
1236
- }
1237
- // Add up the additive animations
1238
- for (let animIndex = 0; animIndex < holder.additiveAnimations.length; animIndex++) {
1239
- const runtimeAnimation = holder.additiveAnimations[animIndex];
1240
- const scale = runtimeAnimation.weight;
1241
- if (!scale) {
1242
- continue;
1243
- }
1244
- else if (runtimeAnimation.currentValue.scaleAndAddToRef) {
1245
- runtimeAnimation.currentValue.scaleAndAddToRef(scale, finalValue);
1246
- }
1247
- else {
1248
- finalValue += runtimeAnimation.currentValue * scale;
1249
- }
1250
- }
1251
- }
1252
- }
1253
- target[path] = finalValue;
1254
- }
1255
- target._lateAnimationHolders = {};
1256
- }
1257
- scene._registeredForLateAnimationBindings.reset();
1258
- }
1259
- /**
1260
- * Initialize all the inter dependecies between the animations and Scene and Bone
1261
- * @param sceneClass defines the scene prototype to use
1262
- * @param boneClass defines the bone prototype to use
1263
- */
1264
- function AddAnimationExtensions(sceneClass, boneClass) {
1265
- if (boneClass) {
1266
- boneClass.prototype.copyAnimationRange = function (source, rangeName, frameOffset, rescaleAsRequired = false, skelDimensionsRatio = null) {
1267
- // all animation may be coming from a library skeleton, so may need to create animation
1268
- if (this.animations.length === 0) {
1269
- this.animations.push(new Animation(this.name, "_matrix", source.animations[0].framePerSecond, Animation.ANIMATIONTYPE_MATRIX, 0));
1270
- this.animations[0].setKeys([]);
1271
- }
1272
- // get animation info / verify there is such a range from the source bone
1273
- const sourceRange = source.animations[0].getRange(rangeName);
1274
- if (!sourceRange) {
1275
- return false;
1276
- }
1277
- const from = sourceRange.from;
1278
- const to = sourceRange.to;
1279
- const sourceKeys = source.animations[0].getKeys();
1280
- // rescaling prep
1281
- const sourceBoneLength = source.length;
1282
- const sourceParent = source.getParent();
1283
- const parent = this.getParent();
1284
- const parentScalingReqd = rescaleAsRequired && sourceParent && sourceBoneLength && this.length && sourceBoneLength !== this.length;
1285
- const parentRatio = parentScalingReqd && parent && sourceParent ? parent.length / sourceParent.length : 1;
1286
- const dimensionsScalingReqd = rescaleAsRequired && !parent && skelDimensionsRatio && (skelDimensionsRatio.x !== 1 || skelDimensionsRatio.y !== 1 || skelDimensionsRatio.z !== 1);
1287
- const destKeys = this.animations[0].getKeys();
1288
- // loop vars declaration
1289
- let orig;
1290
- let origTranslation;
1291
- let mat;
1292
- for (let key = 0, nKeys = sourceKeys.length; key < nKeys; key++) {
1293
- orig = sourceKeys[key];
1294
- if (orig.frame >= from && orig.frame <= to) {
1295
- if (rescaleAsRequired) {
1296
- mat = orig.value.clone();
1297
- // scale based on parent ratio, when bone has parent
1298
- if (parentScalingReqd) {
1299
- origTranslation = mat.getTranslation();
1300
- mat.setTranslation(origTranslation.scaleInPlace(parentRatio));
1301
- // scale based on skeleton dimension ratio when root bone, and value is passed
1302
- }
1303
- else if (dimensionsScalingReqd && skelDimensionsRatio) {
1304
- origTranslation = mat.getTranslation();
1305
- mat.setTranslation(origTranslation.multiplyInPlace(skelDimensionsRatio));
1306
- // use original when root bone, and no data for skelDimensionsRatio
1307
- }
1308
- else {
1309
- mat = orig.value;
1310
- }
1311
- }
1312
- else {
1313
- mat = orig.value;
1314
- }
1315
- destKeys.push({ frame: orig.frame + frameOffset, value: mat });
1316
- }
1317
- }
1318
- this.animations[0].createRange(rangeName, from + frameOffset, to + frameOffset);
1319
- return true;
1320
- };
1321
- }
1322
- if (!sceneClass) {
1323
- return;
1324
- }
1325
- sceneClass.prototype._animate = function (customDeltaTime) {
1326
- if (!this.animationsEnabled) {
1327
- return;
1328
- }
1329
- // Getting time
1330
- const now = PrecisionDate.Now;
1331
- if (!this._animationTimeLast) {
1332
- if (this._pendingData.length > 0) {
1333
- return;
1334
- }
1335
- this._animationTimeLast = now;
1336
- }
1337
- this.deltaTime = customDeltaTime !== undefined ? customDeltaTime : this.useConstantAnimationDeltaTime ? 16.0 : (now - this._animationTimeLast) * this.animationTimeScale;
1338
- this._animationTimeLast = now;
1339
- const animatables = this._activeAnimatables;
1340
- if (animatables.length === 0) {
1341
- return;
1342
- }
1343
- this._animationTime += this.deltaTime;
1344
- const animationTime = this._animationTime;
1345
- for (let index = 0; index < animatables.length; index++) {
1346
- const animatable = animatables[index];
1347
- if (!animatable._animate(animationTime) && animatable.disposeOnEnd) {
1348
- index--; // Array was updated
1349
- }
1350
- }
1351
- // Late animation bindings
1352
- ProcessLateAnimationBindings(this);
1353
- };
1354
- sceneClass.prototype.sortActiveAnimatables = function () {
1355
- this._activeAnimatables.sort((a, b) => {
1356
- return a.playOrder - b.playOrder;
1357
- });
1358
- };
1359
- sceneClass.prototype.beginWeightedAnimation = function (target, from, to, weight = 1.0, loop, speedRatio = 1.0, onAnimationEnd, animatable, targetMask, onAnimationLoop, isAdditive = false) {
1360
- const returnedAnimatable = this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, false, targetMask, onAnimationLoop, isAdditive);
1361
- returnedAnimatable.weight = weight;
1362
- return returnedAnimatable;
1363
- };
1364
- sceneClass.prototype.beginAnimation = function (target, from, to, loop, speedRatio = 1.0, onAnimationEnd, animatable, stopCurrent = true, targetMask, onAnimationLoop, isAdditive = false) {
1365
- // get speed speedRatio, to and from, based on the sign and value(s)
1366
- if (speedRatio < 0) {
1367
- const tmp = from;
1368
- from = to;
1369
- to = tmp;
1370
- speedRatio = -speedRatio;
1371
- }
1372
- // if from > to switch speed ratio
1373
- if (from > to) {
1374
- speedRatio = -speedRatio;
1375
- }
1376
- if (stopCurrent) {
1377
- this.stopAnimation(target, undefined, targetMask);
1378
- }
1379
- if (!animatable) {
1380
- animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, undefined, onAnimationLoop, isAdditive);
1381
- }
1382
- const shouldRunTargetAnimations = targetMask ? targetMask(target) : true;
1383
- // Local animations
1384
- if (target.animations && shouldRunTargetAnimations) {
1385
- animatable.appendAnimations(target, target.animations);
1386
- }
1387
- // Children animations
1388
- if (target.getAnimatables) {
1389
- const animatables = target.getAnimatables();
1390
- for (let index = 0; index < animatables.length; index++) {
1391
- this.beginAnimation(animatables[index], from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, onAnimationLoop);
1392
- }
1393
- }
1394
- animatable.reset();
1395
- return animatable;
1396
- };
1397
- sceneClass.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio = 1.0, onAnimationEnd, animatable, stopCurrent = true, targetMask, onAnimationLoop, isAdditive = false) {
1398
- const children = target.getDescendants(directDescendantsOnly);
1399
- const result = [];
1400
- result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));
1401
- for (const child of children) {
1402
- result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask, undefined, isAdditive));
1403
- }
1404
- return result;
1405
- };
1406
- sceneClass.prototype.beginDirectAnimation = function (target, animations, from, to, loop, speedRatio = 1.0, onAnimationEnd, onAnimationLoop, isAdditive = false) {
1407
- // get speed speedRatio, to and from, based on the sign and value(s)
1408
- if (speedRatio < 0) {
1409
- const tmp = from;
1410
- from = to;
1411
- to = tmp;
1412
- speedRatio = -speedRatio;
1413
- }
1414
- // if from > to switch speed ratio
1415
- if (from > to) {
1416
- speedRatio = -speedRatio;
1417
- }
1418
- const animatable = new Animatable(this, target, from, to, loop, speedRatio, onAnimationEnd, animations, onAnimationLoop, isAdditive);
1419
- return animatable;
1420
- };
1421
- sceneClass.prototype.beginDirectHierarchyAnimation = function (target, directDescendantsOnly, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive = false) {
1422
- const children = target.getDescendants(directDescendantsOnly);
1423
- const result = [];
1424
- result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));
1425
- for (const child of children) {
1426
- result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd, onAnimationLoop, isAdditive));
1427
- }
1428
- return result;
1429
- };
1430
- sceneClass.prototype.getAnimatableByTarget = function (target) {
1431
- for (let index = 0; index < this._activeAnimatables.length; index++) {
1432
- if (this._activeAnimatables[index].target === target) {
1433
- return this._activeAnimatables[index];
1434
- }
1435
- }
1436
- return null;
1437
- };
1438
- sceneClass.prototype.getAllAnimatablesByTarget = function (target) {
1439
- const result = [];
1440
- for (let index = 0; index < this._activeAnimatables.length; index++) {
1441
- if (this._activeAnimatables[index].target === target) {
1442
- result.push(this._activeAnimatables[index]);
1443
- }
1444
- }
1445
- return result;
1446
- };
1447
- sceneClass.prototype.stopAnimation = function (target, animationName, targetMask) {
1448
- const animatables = this.getAllAnimatablesByTarget(target);
1449
- for (const animatable of animatables) {
1450
- animatable.stop(animationName, targetMask);
1451
- }
1452
- };
1453
- sceneClass.prototype.stopAllAnimations = function () {
1454
- if (this._activeAnimatables) {
1455
- for (let i = 0; i < this._activeAnimatables.length; i++) {
1456
- this._activeAnimatables[i].stop(undefined, undefined, true);
1457
- }
1458
- this._activeAnimatables.length = 0;
1459
- }
1460
- for (const group of this.animationGroups) {
1461
- group.stop();
1462
- }
1463
- };
1464
- }
1465
-
1466
- // Connect everything!
1467
- AddAnimationExtensions(Scene, Bone);
1468
-
1469
- /**
1470
- * This class defines the direct association between an animation and a target
1471
- */
1472
- class TargetedAnimation {
1473
- /**
1474
- * Returns the string "TargetedAnimation"
1475
- * @returns "TargetedAnimation"
1476
- */
1477
- getClassName() {
1478
- return "TargetedAnimation";
1479
- }
1480
- /**
1481
- * Serialize the object
1482
- * @returns the JSON object representing the current entity
1483
- */
1484
- serialize() {
1485
- const serializationObject = {};
1486
- serializationObject.animation = this.animation.serialize();
1487
- serializationObject.targetId = this.target.id;
1488
- return serializationObject;
1489
- }
1490
- }
1491
- /**
1492
- * Use this class to create coordinated animations on multiple targets
1493
- */
1494
- class AnimationGroup {
1495
- /**
1496
- * Gets or sets the mask associated with this animation group. This mask is used to filter which objects should be animated.
1497
- */
1498
- get mask() {
1499
- return this._mask;
1500
- }
1501
- set mask(value) {
1502
- if (this._mask === value) {
1503
- return;
1504
- }
1505
- this._mask = value;
1506
- this.syncWithMask(true);
1507
- }
1508
- /**
1509
- * Makes sure that the animations are either played or stopped according to the animation group mask.
1510
- * Note however that the call won't have any effect if the animation group has not been started yet.
1511
- * @param forceUpdate If true, forces to loop over the animatables even if no mask is defined (used internally, you shouldn't need to use it). Default: false.
1512
- */
1513
- syncWithMask(forceUpdate = false) {
1514
- if (!this.mask && !forceUpdate) {
1515
- this._numActiveAnimatables = this._targetedAnimations.length;
1516
- return;
1517
- }
1518
- this._numActiveAnimatables = 0;
1519
- for (let i = 0; i < this._animatables.length; ++i) {
1520
- const animatable = this._animatables[i];
1521
- if (!this.mask || this.mask.disabled || this.mask.retainsTarget(animatable.target.name)) {
1522
- this._numActiveAnimatables++;
1523
- if (animatable.paused) {
1524
- animatable.restart();
1525
- }
1526
- }
1527
- else {
1528
- if (!animatable.paused) {
1529
- animatable.pause();
1530
- }
1531
- }
1532
- }
1533
- }
1534
- /**
1535
- * Removes all animations for the targets not retained by the animation group mask.
1536
- * Use this function if you know you won't need those animations anymore and if you want to free memory.
1537
- */
1538
- removeUnmaskedAnimations() {
1539
- if (!this.mask || this.mask.disabled) {
1540
- return;
1541
- }
1542
- // Removes all animatables (in case the animation group has already been started)
1543
- for (let i = 0; i < this._animatables.length; ++i) {
1544
- const animatable = this._animatables[i];
1545
- if (!this.mask.retainsTarget(animatable.target.name)) {
1546
- animatable.stop();
1547
- this._animatables.splice(i, 1);
1548
- --i;
1549
- }
1550
- }
1551
- // Removes the targeted animations
1552
- for (let index = 0; index < this._targetedAnimations.length; index++) {
1553
- const targetedAnimation = this._targetedAnimations[index];
1554
- if (!this.mask.retainsTarget(targetedAnimation.target.name)) {
1555
- this._targetedAnimations.splice(index, 1);
1556
- --index;
1557
- }
1558
- }
1559
- }
1560
- /**
1561
- * Gets or sets the first frame
1562
- */
1563
- get from() {
1564
- return this._from;
1565
- }
1566
- set from(value) {
1567
- if (this._from === value) {
1568
- return;
1569
- }
1570
- this._from = value;
1571
- for (let index = 0; index < this._animatables.length; index++) {
1572
- const animatable = this._animatables[index];
1573
- animatable.fromFrame = this._from;
1574
- }
1575
- }
1576
- /**
1577
- * Gets or sets the last frame
1578
- */
1579
- get to() {
1580
- return this._to;
1581
- }
1582
- set to(value) {
1583
- if (this._to === value) {
1584
- return;
1585
- }
1586
- this._to = value;
1587
- for (let index = 0; index < this._animatables.length; index++) {
1588
- const animatable = this._animatables[index];
1589
- animatable.toFrame = this._to;
1590
- }
1591
- }
1592
- /**
1593
- * Define if the animations are started
1594
- */
1595
- get isStarted() {
1596
- return this._isStarted;
1597
- }
1598
- /**
1599
- * Gets a value indicating that the current group is playing
1600
- */
1601
- get isPlaying() {
1602
- return this._isStarted && !this._isPaused;
1603
- }
1604
- /**
1605
- * Gets or sets the speed ratio to use for all animations
1606
- */
1607
- get speedRatio() {
1608
- return this._speedRatio;
1609
- }
1610
- /**
1611
- * Gets or sets the speed ratio to use for all animations
1612
- */
1613
- set speedRatio(value) {
1614
- if (this._speedRatio === value) {
1615
- return;
1616
- }
1617
- this._speedRatio = value;
1618
- for (let index = 0; index < this._animatables.length; index++) {
1619
- const animatable = this._animatables[index];
1620
- animatable.speedRatio = this._speedRatio;
1621
- }
1622
- }
1623
- /**
1624
- * Gets or sets if all animations should loop or not
1625
- */
1626
- get loopAnimation() {
1627
- return this._loopAnimation;
1628
- }
1629
- set loopAnimation(value) {
1630
- if (this._loopAnimation === value) {
1631
- return;
1632
- }
1633
- this._loopAnimation = value;
1634
- for (let index = 0; index < this._animatables.length; index++) {
1635
- const animatable = this._animatables[index];
1636
- animatable.loopAnimation = this._loopAnimation;
1637
- }
1638
- }
1639
- /**
1640
- * Gets or sets if all animations should be evaluated additively
1641
- */
1642
- get isAdditive() {
1643
- return this._isAdditive;
1644
- }
1645
- set isAdditive(value) {
1646
- if (this._isAdditive === value) {
1647
- return;
1648
- }
1649
- this._isAdditive = value;
1650
- for (let index = 0; index < this._animatables.length; index++) {
1651
- const animatable = this._animatables[index];
1652
- animatable.isAdditive = this._isAdditive;
1653
- }
1654
- }
1655
- /**
1656
- * Gets or sets the weight to apply to all animations of the group
1657
- */
1658
- get weight() {
1659
- return this._weight;
1660
- }
1661
- set weight(value) {
1662
- if (this._weight === value) {
1663
- return;
1664
- }
1665
- this._weight = value;
1666
- this.setWeightForAllAnimatables(this._weight);
1667
- }
1668
- /**
1669
- * Gets the targeted animations for this animation group
1670
- */
1671
- get targetedAnimations() {
1672
- return this._targetedAnimations;
1673
- }
1674
- /**
1675
- * returning the list of animatables controlled by this animation group.
1676
- */
1677
- get animatables() {
1678
- return this._animatables;
1679
- }
1680
- /**
1681
- * Gets the list of target animations
1682
- */
1683
- get children() {
1684
- return this._targetedAnimations;
1685
- }
1686
- /**
1687
- * Gets or sets the order of play of the animation group (default: 0)
1688
- */
1689
- get playOrder() {
1690
- return this._playOrder;
1691
- }
1692
- set playOrder(value) {
1693
- if (this._playOrder === value) {
1694
- return;
1695
- }
1696
- this._playOrder = value;
1697
- if (this._animatables.length > 0) {
1698
- for (let i = 0; i < this._animatables.length; i++) {
1699
- this._animatables[i].playOrder = this._playOrder;
1700
- }
1701
- this._scene.sortActiveAnimatables();
1702
- }
1703
- }
1704
- /**
1705
- * Allows the animations of the animation group to blend with current running animations
1706
- * Note that a null value means that each animation will use their own existing blending configuration (Animation.enableBlending)
1707
- */
1708
- get enableBlending() {
1709
- return this._enableBlending;
1710
- }
1711
- set enableBlending(value) {
1712
- if (this._enableBlending === value) {
1713
- return;
1714
- }
1715
- this._enableBlending = value;
1716
- if (value !== null) {
1717
- for (let i = 0; i < this._targetedAnimations.length; ++i) {
1718
- this._targetedAnimations[i].animation.enableBlending = value;
1719
- }
1720
- }
1721
- }
1722
- /**
1723
- * Gets or sets the animation blending speed
1724
- * Note that a null value means that each animation will use their own existing blending configuration (Animation.blendingSpeed)
1725
- */
1726
- get blendingSpeed() {
1727
- return this._blendingSpeed;
1728
- }
1729
- set blendingSpeed(value) {
1730
- if (this._blendingSpeed === value) {
1731
- return;
1732
- }
1733
- this._blendingSpeed = value;
1734
- if (value !== null) {
1735
- for (let i = 0; i < this._targetedAnimations.length; ++i) {
1736
- this._targetedAnimations[i].animation.blendingSpeed = value;
1737
- }
1738
- }
1739
- }
1740
- /**
1741
- * Gets the length (in seconds) of the animation group
1742
- * This function assumes that all animations are played at the same framePerSecond speed!
1743
- * Note: you can only call this method after you've added at least one targeted animation!
1744
- * @param from Starting frame range (default is AnimationGroup.from)
1745
- * @param to Ending frame range (default is AnimationGroup.to)
1746
- * @returns The length in seconds
1747
- */
1748
- getLength(from, to) {
1749
- from = from ?? this._from;
1750
- to = to ?? this._to;
1751
- const fps = this.targetedAnimations[0].animation.framePerSecond * this._speedRatio;
1752
- return (to - from) / fps;
1753
- }
1754
- /**
1755
- * Merge the array of animation groups into a new animation group
1756
- * @param animationGroups List of animation groups to merge
1757
- * @param disposeSource If true, animation groups will be disposed after being merged (default: true)
1758
- * @param normalize If true, animation groups will be normalized before being merged, so that all animations have the same "from" and "to" frame (default: false)
1759
- * @param weight Weight for the new animation group. If not provided, it will inherit the weight from the first animation group of the array
1760
- * @returns The new animation group or null if no animation groups were passed
1761
- */
1762
- static MergeAnimationGroups(animationGroups, disposeSource = true, normalize = false, weight) {
1763
- if (animationGroups.length === 0) {
1764
- return null;
1765
- }
1766
- weight = weight ?? animationGroups[0].weight;
1767
- let beginFrame = Number.MAX_VALUE;
1768
- let endFrame = -Number.MAX_VALUE;
1769
- if (normalize) {
1770
- for (const animationGroup of animationGroups) {
1771
- if (animationGroup.from < beginFrame) {
1772
- beginFrame = animationGroup.from;
1773
- }
1774
- if (animationGroup.to > endFrame) {
1775
- endFrame = animationGroup.to;
1776
- }
1777
- }
1778
- }
1779
- const mergedAnimationGroup = new AnimationGroup(animationGroups[0].name + "_merged", animationGroups[0]._scene, weight);
1780
- for (const animationGroup of animationGroups) {
1781
- if (normalize) {
1782
- animationGroup.normalize(beginFrame, endFrame);
1783
- }
1784
- for (const targetedAnimation of animationGroup.targetedAnimations) {
1785
- mergedAnimationGroup.addTargetedAnimation(targetedAnimation.animation, targetedAnimation.target);
1786
- }
1787
- if (disposeSource) {
1788
- animationGroup.dispose();
1789
- }
1790
- }
1791
- return mergedAnimationGroup;
1792
- }
1793
- /**
1794
- * Instantiates a new Animation Group.
1795
- * This helps managing several animations at once.
1796
- * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
1797
- * @param name Defines the name of the group
1798
- * @param scene Defines the scene the group belongs to
1799
- * @param weight Defines the weight to use for animations in the group (-1.0 by default, meaning "no weight")
1800
- * @param playOrder Defines the order of play of the animation group (default is 0)
1801
- */
1802
- constructor(
1803
- /** The name of the animation group */
1804
- name, scene = null, weight = -1, playOrder = 0) {
1805
- this.name = name;
1806
- this._targetedAnimations = new Array();
1807
- this._animatables = new Array();
1808
- this._from = Number.MAX_VALUE;
1809
- this._to = -Number.MAX_VALUE;
1810
- this._speedRatio = 1;
1811
- this._loopAnimation = false;
1812
- this._isAdditive = false;
1813
- this._weight = -1;
1814
- this._playOrder = 0;
1815
- this._enableBlending = null;
1816
- this._blendingSpeed = null;
1817
- this._numActiveAnimatables = 0;
1818
- this._shouldStart = true;
1819
- /** @internal */
1820
- this._parentContainer = null;
1821
- /**
1822
- * This observable will notify when one animation have ended
1823
- */
1824
- this.onAnimationEndObservable = new Observable();
1825
- /**
1826
- * Observer raised when one animation loops
1827
- */
1828
- this.onAnimationLoopObservable = new Observable();
1829
- /**
1830
- * Observer raised when all animations have looped
1831
- */
1832
- this.onAnimationGroupLoopObservable = new Observable();
1833
- /**
1834
- * This observable will notify when all animations have ended.
1835
- */
1836
- this.onAnimationGroupEndObservable = new Observable();
1837
- /**
1838
- * This observable will notify when all animations have paused.
1839
- */
1840
- this.onAnimationGroupPauseObservable = new Observable();
1841
- /**
1842
- * This observable will notify when all animations are playing.
1843
- */
1844
- this.onAnimationGroupPlayObservable = new Observable();
1845
- /**
1846
- * Gets or sets an object used to store user defined information for the node
1847
- */
1848
- this.metadata = null;
1849
- this._mask = null;
1850
- this._animationLoopFlags = [];
1851
- this._scene = scene || EngineStore.LastCreatedScene;
1852
- this._weight = weight;
1853
- this._playOrder = playOrder;
1854
- this.uniqueId = this._scene.getUniqueId();
1855
- this._scene.addAnimationGroup(this);
1856
- }
1857
- /**
1858
- * Add an animation (with its target) in the group
1859
- * @param animation defines the animation we want to add
1860
- * @param target defines the target of the animation
1861
- * @returns the TargetedAnimation object
1862
- */
1863
- addTargetedAnimation(animation, target) {
1864
- const targetedAnimation = new TargetedAnimation();
1865
- targetedAnimation.animation = animation;
1866
- targetedAnimation.target = target;
1867
- const keys = animation.getKeys();
1868
- if (this._from > keys[0].frame) {
1869
- this._from = keys[0].frame;
1870
- }
1871
- if (this._to < keys[keys.length - 1].frame) {
1872
- this._to = keys[keys.length - 1].frame;
1873
- }
1874
- if (this._enableBlending !== null) {
1875
- animation.enableBlending = this._enableBlending;
1876
- }
1877
- if (this._blendingSpeed !== null) {
1878
- animation.blendingSpeed = this._blendingSpeed;
1879
- }
1880
- this._targetedAnimations.push(targetedAnimation);
1881
- this._shouldStart = true;
1882
- return targetedAnimation;
1883
- }
1884
- /**
1885
- * Remove an animation from the group
1886
- * @param animation defines the animation we want to remove
1887
- */
1888
- removeTargetedAnimation(animation) {
1889
- for (let index = this._targetedAnimations.length - 1; index > -1; index--) {
1890
- const targetedAnimation = this._targetedAnimations[index];
1891
- if (targetedAnimation.animation === animation) {
1892
- this._targetedAnimations.splice(index, 1);
1893
- }
1894
- }
1895
- }
1896
- /**
1897
- * This function will normalize every animation in the group to make sure they all go from beginFrame to endFrame
1898
- * It can add constant keys at begin or end
1899
- * @param beginFrame defines the new begin frame for all animations or the smallest begin frame of all animations if null (defaults to null)
1900
- * @param endFrame defines the new end frame for all animations or the largest end frame of all animations if null (defaults to null)
1901
- * @returns the animation group
1902
- */
1903
- normalize(beginFrame = null, endFrame = null) {
1904
- if (beginFrame == null) {
1905
- beginFrame = this._from;
1906
- }
1907
- if (endFrame == null) {
1908
- endFrame = this._to;
1909
- }
1910
- for (let index = 0; index < this._targetedAnimations.length; index++) {
1911
- const targetedAnimation = this._targetedAnimations[index];
1912
- const keys = targetedAnimation.animation.getKeys();
1913
- const startKey = keys[0];
1914
- const endKey = keys[keys.length - 1];
1915
- if (startKey.frame > beginFrame) {
1916
- const newKey = {
1917
- frame: beginFrame,
1918
- value: startKey.value,
1919
- inTangent: startKey.inTangent,
1920
- outTangent: startKey.outTangent,
1921
- interpolation: startKey.interpolation,
1922
- };
1923
- keys.splice(0, 0, newKey);
1924
- }
1925
- if (endKey.frame < endFrame) {
1926
- const newKey = {
1927
- frame: endFrame,
1928
- value: endKey.value,
1929
- inTangent: endKey.inTangent,
1930
- outTangent: endKey.outTangent,
1931
- interpolation: endKey.interpolation,
1932
- };
1933
- keys.push(newKey);
1934
- }
1935
- }
1936
- this._from = beginFrame;
1937
- this._to = endFrame;
1938
- return this;
1939
- }
1940
- _processLoop(animatable, targetedAnimation, index) {
1941
- animatable.onAnimationLoop = () => {
1942
- this.onAnimationLoopObservable.notifyObservers(targetedAnimation);
1943
- if (this._animationLoopFlags[index]) {
1944
- return;
1945
- }
1946
- this._animationLoopFlags[index] = true;
1947
- this._animationLoopCount++;
1948
- if (this._animationLoopCount === this._numActiveAnimatables) {
1949
- this.onAnimationGroupLoopObservable.notifyObservers(this);
1950
- this._animationLoopCount = 0;
1951
- this._animationLoopFlags.length = 0;
1952
- }
1953
- };
1954
- }
1955
- /**
1956
- * Start all animations on given targets
1957
- * @param loop defines if animations must loop
1958
- * @param speedRatio defines the ratio to apply to animation speed (1 by default)
1959
- * @param from defines the from key (optional)
1960
- * @param to defines the to key (optional)
1961
- * @param isAdditive defines the additive state for the resulting animatables (optional)
1962
- * @returns the current animation group
1963
- */
1964
- start(loop = false, speedRatio = 1, from, to, isAdditive) {
1965
- if (this._isStarted || this._targetedAnimations.length === 0) {
1966
- return this;
1967
- }
1968
- this._loopAnimation = loop;
1969
- this._shouldStart = false;
1970
- this._animationLoopCount = 0;
1971
- this._animationLoopFlags.length = 0;
1972
- for (let index = 0; index < this._targetedAnimations.length; index++) {
1973
- const targetedAnimation = this._targetedAnimations[index];
1974
- const animatable = this._scene.beginDirectAnimation(targetedAnimation.target, [targetedAnimation.animation], from !== undefined ? from : this._from, to !== undefined ? to : this._to, loop, speedRatio, undefined, undefined, isAdditive !== undefined ? isAdditive : this._isAdditive);
1975
- animatable.weight = this._weight;
1976
- animatable.playOrder = this._playOrder;
1977
- animatable.onAnimationEnd = () => {
1978
- this.onAnimationEndObservable.notifyObservers(targetedAnimation);
1979
- this._checkAnimationGroupEnded(animatable);
1980
- };
1981
- this._processLoop(animatable, targetedAnimation, index);
1982
- this._animatables.push(animatable);
1983
- }
1984
- this.syncWithMask();
1985
- this._scene.sortActiveAnimatables();
1986
- this._speedRatio = speedRatio;
1987
- this._isStarted = true;
1988
- this._isPaused = false;
1989
- this.onAnimationGroupPlayObservable.notifyObservers(this);
1990
- return this;
1991
- }
1992
- /**
1993
- * Pause all animations
1994
- * @returns the animation group
1995
- */
1996
- pause() {
1997
- if (!this._isStarted) {
1998
- return this;
1999
- }
2000
- this._isPaused = true;
2001
- for (let index = 0; index < this._animatables.length; index++) {
2002
- const animatable = this._animatables[index];
2003
- animatable.pause();
2004
- }
2005
- this.onAnimationGroupPauseObservable.notifyObservers(this);
2006
- return this;
2007
- }
2008
- /**
2009
- * Play all animations to initial state
2010
- * This function will start() the animations if they were not started or will restart() them if they were paused
2011
- * @param loop defines if animations must loop
2012
- * @returns the animation group
2013
- */
2014
- play(loop) {
2015
- // only if there are animatable available
2016
- if (this.isStarted && this._animatables.length && !this._shouldStart) {
2017
- if (loop !== undefined) {
2018
- this.loopAnimation = loop;
2019
- }
2020
- this.restart();
2021
- }
2022
- else {
2023
- this.stop();
2024
- this.start(loop, this._speedRatio);
2025
- }
2026
- return this;
2027
- }
2028
- /**
2029
- * Reset all animations to initial state
2030
- * @returns the animation group
2031
- */
2032
- reset() {
2033
- if (!this._isStarted) {
2034
- this.play();
2035
- this.goToFrame(0);
2036
- this.stop(true);
2037
- return this;
2038
- }
2039
- for (let index = 0; index < this._animatables.length; index++) {
2040
- const animatable = this._animatables[index];
2041
- animatable.reset();
2042
- }
2043
- return this;
2044
- }
2045
- /**
2046
- * Restart animations from after pausing it
2047
- * @returns the animation group
2048
- */
2049
- restart() {
2050
- if (!this._isStarted) {
2051
- return this;
2052
- }
2053
- for (let index = 0; index < this._animatables.length; index++) {
2054
- const animatable = this._animatables[index];
2055
- animatable.restart();
2056
- }
2057
- this.syncWithMask();
2058
- this._isPaused = false;
2059
- this.onAnimationGroupPlayObservable.notifyObservers(this);
2060
- return this;
2061
- }
2062
- /**
2063
- * Stop all animations
2064
- * @param skipOnAnimationEnd defines if the system should not raise onAnimationEnd. Default is false
2065
- * @returns the animation group
2066
- */
2067
- stop(skipOnAnimationEnd = false) {
2068
- if (!this._isStarted) {
2069
- return this;
2070
- }
2071
- const list = this._animatables.slice();
2072
- for (let index = 0; index < list.length; index++) {
2073
- list[index].stop(undefined, undefined, true, skipOnAnimationEnd);
2074
- }
2075
- // We will take care of removing all stopped animatables
2076
- let curIndex = 0;
2077
- for (let index = 0; index < this._scene._activeAnimatables.length; index++) {
2078
- const animatable = this._scene._activeAnimatables[index];
2079
- if (animatable._runtimeAnimations.length > 0) {
2080
- this._scene._activeAnimatables[curIndex++] = animatable;
2081
- }
2082
- else if (skipOnAnimationEnd) {
2083
- // We normally rely on the onAnimationEnd callback (assigned in the start function) to be notified when an animatable
2084
- // ends and should be removed from the active animatables array. However, if the animatable is stopped with the skipOnAnimationEnd
2085
- // flag set to true, then we need to explicitly remove it from the active animatables array.
2086
- this._checkAnimationGroupEnded(animatable, skipOnAnimationEnd);
2087
- }
2088
- }
2089
- this._scene._activeAnimatables.length = curIndex;
2090
- this._isStarted = false;
2091
- return this;
2092
- }
2093
- /**
2094
- * Set animation weight for all animatables
2095
- *
2096
- * @since 6.12.4
2097
- * You can pass the weight to the AnimationGroup constructor, or use the weight property to set it after the group has been created,
2098
- * making it easier to define the overall animation weight than calling setWeightForAllAnimatables() after the animation group has been started
2099
- * @param weight defines the weight to use
2100
- * @returns the animationGroup
2101
- * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
2102
- */
2103
- setWeightForAllAnimatables(weight) {
2104
- for (let index = 0; index < this._animatables.length; index++) {
2105
- const animatable = this._animatables[index];
2106
- animatable.weight = weight;
2107
- }
2108
- return this;
2109
- }
2110
- /**
2111
- * Synchronize and normalize all animatables with a source animatable
2112
- * @param root defines the root animatable to synchronize with (null to stop synchronizing)
2113
- * @returns the animationGroup
2114
- * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/advanced_animations#animation-weights
2115
- */
2116
- syncAllAnimationsWith(root) {
2117
- for (let index = 0; index < this._animatables.length; index++) {
2118
- const animatable = this._animatables[index];
2119
- animatable.syncWith(root);
2120
- }
2121
- return this;
2122
- }
2123
- /**
2124
- * Goes to a specific frame in this animation group. Note that the animation group must be in playing or paused status
2125
- * @param frame the frame number to go to
2126
- * @param useWeight defines whether the animation weight should be applied to the image to be jumped to (false by default)
2127
- * @returns the animationGroup
2128
- */
2129
- goToFrame(frame, useWeight = false) {
2130
- if (!this._isStarted) {
2131
- return this;
2132
- }
2133
- for (let index = 0; index < this._animatables.length; index++) {
2134
- const animatable = this._animatables[index];
2135
- animatable.goToFrame(frame, useWeight);
2136
- }
2137
- return this;
2138
- }
2139
- /**
2140
- * Helper to get the current frame. This will return 0 if the AnimationGroup is not running, and it might return wrong results if multiple animations are running in different frames.
2141
- * @returns current animation frame.
2142
- */
2143
- getCurrentFrame() {
2144
- return this.animatables[0]?.masterFrame || 0;
2145
- }
2146
- /**
2147
- * Dispose all associated resources
2148
- */
2149
- dispose() {
2150
- if (this.isStarted) {
2151
- this.stop();
2152
- }
2153
- this._targetedAnimations.length = 0;
2154
- this._animatables.length = 0;
2155
- // Remove from scene
2156
- const index = this._scene.animationGroups.indexOf(this);
2157
- if (index > -1) {
2158
- this._scene.animationGroups.splice(index, 1);
2159
- }
2160
- if (this._parentContainer) {
2161
- const index = this._parentContainer.animationGroups.indexOf(this);
2162
- if (index > -1) {
2163
- this._parentContainer.animationGroups.splice(index, 1);
2164
- }
2165
- this._parentContainer = null;
2166
- }
2167
- this.onAnimationEndObservable.clear();
2168
- this.onAnimationGroupEndObservable.clear();
2169
- this.onAnimationGroupPauseObservable.clear();
2170
- this.onAnimationGroupPlayObservable.clear();
2171
- this.onAnimationLoopObservable.clear();
2172
- this.onAnimationGroupLoopObservable.clear();
2173
- }
2174
- _checkAnimationGroupEnded(animatable, skipOnAnimationEnd = false) {
2175
- // animatable should be taken out of the array
2176
- const idx = this._animatables.indexOf(animatable);
2177
- if (idx > -1) {
2178
- this._animatables.splice(idx, 1);
2179
- }
2180
- // all animatables were removed? animation group ended!
2181
- if (this._animatables.length === this._targetedAnimations.length - this._numActiveAnimatables) {
2182
- this._isStarted = false;
2183
- if (!skipOnAnimationEnd) {
2184
- this.onAnimationGroupEndObservable.notifyObservers(this);
2185
- }
2186
- this._animatables.length = 0;
2187
- }
2188
- }
2189
- /**
2190
- * Clone the current animation group and returns a copy
2191
- * @param newName defines the name of the new group
2192
- * @param targetConverter defines an optional function used to convert current animation targets to new ones
2193
- * @param cloneAnimations defines if the animations should be cloned or referenced
2194
- * @returns the new animation group
2195
- */
2196
- clone(newName, targetConverter, cloneAnimations = false) {
2197
- const newGroup = new AnimationGroup(newName || this.name, this._scene, this._weight, this._playOrder);
2198
- newGroup._from = this.from;
2199
- newGroup._to = this.to;
2200
- newGroup._speedRatio = this.speedRatio;
2201
- newGroup._loopAnimation = this.loopAnimation;
2202
- newGroup._isAdditive = this.isAdditive;
2203
- newGroup._enableBlending = this.enableBlending;
2204
- newGroup._blendingSpeed = this.blendingSpeed;
2205
- newGroup.metadata = this.metadata;
2206
- newGroup.mask = this.mask;
2207
- for (const targetAnimation of this._targetedAnimations) {
2208
- newGroup.addTargetedAnimation(cloneAnimations ? targetAnimation.animation.clone() : targetAnimation.animation, targetConverter ? targetConverter(targetAnimation.target) : targetAnimation.target);
2209
- }
2210
- return newGroup;
2211
- }
2212
- /**
2213
- * Serializes the animationGroup to an object
2214
- * @returns Serialized object
2215
- */
2216
- serialize() {
2217
- const serializationObject = {};
2218
- serializationObject.name = this.name;
2219
- serializationObject.from = this.from;
2220
- serializationObject.to = this.to;
2221
- serializationObject.speedRatio = this.speedRatio;
2222
- serializationObject.loopAnimation = this.loopAnimation;
2223
- serializationObject.isAdditive = this.isAdditive;
2224
- serializationObject.weight = this.weight;
2225
- serializationObject.playOrder = this.playOrder;
2226
- serializationObject.enableBlending = this.enableBlending;
2227
- serializationObject.blendingSpeed = this.blendingSpeed;
2228
- serializationObject.targetedAnimations = [];
2229
- for (let targetedAnimationIndex = 0; targetedAnimationIndex < this.targetedAnimations.length; targetedAnimationIndex++) {
2230
- const targetedAnimation = this.targetedAnimations[targetedAnimationIndex];
2231
- serializationObject.targetedAnimations[targetedAnimationIndex] = targetedAnimation.serialize();
2232
- }
2233
- if (Tags && Tags.HasTags(this)) {
2234
- serializationObject.tags = Tags.GetTags(this);
2235
- }
2236
- // Metadata
2237
- if (this.metadata) {
2238
- serializationObject.metadata = this.metadata;
2239
- }
2240
- return serializationObject;
2241
- }
2242
- // Statics
2243
- /**
2244
- * Returns a new AnimationGroup object parsed from the source provided.
2245
- * @param parsedAnimationGroup defines the source
2246
- * @param scene defines the scene that will receive the animationGroup
2247
- * @returns a new AnimationGroup
2248
- */
2249
- static Parse(parsedAnimationGroup, scene) {
2250
- const animationGroup = new AnimationGroup(parsedAnimationGroup.name, scene, parsedAnimationGroup.weight, parsedAnimationGroup.playOrder);
2251
- for (let i = 0; i < parsedAnimationGroup.targetedAnimations.length; i++) {
2252
- const targetedAnimation = parsedAnimationGroup.targetedAnimations[i];
2253
- const animation = Animation.Parse(targetedAnimation.animation);
2254
- const id = targetedAnimation.targetId;
2255
- if (targetedAnimation.animation.property === "influence") {
2256
- // morph target animation
2257
- const morphTarget = scene.getMorphTargetById(id);
2258
- if (morphTarget) {
2259
- animationGroup.addTargetedAnimation(animation, morphTarget);
2260
- }
2261
- }
2262
- else {
2263
- const targetNode = scene.getNodeById(id);
2264
- if (targetNode != null) {
2265
- animationGroup.addTargetedAnimation(animation, targetNode);
2266
- }
2267
- }
2268
- }
2269
- if (Tags) {
2270
- Tags.AddTagsTo(animationGroup, parsedAnimationGroup.tags);
2271
- }
2272
- if (parsedAnimationGroup.from !== null && parsedAnimationGroup.to !== null) {
2273
- animationGroup.normalize(parsedAnimationGroup.from, parsedAnimationGroup.to);
2274
- }
2275
- if (parsedAnimationGroup.speedRatio !== undefined) {
2276
- animationGroup._speedRatio = parsedAnimationGroup.speedRatio;
2277
- }
2278
- if (parsedAnimationGroup.loopAnimation !== undefined) {
2279
- animationGroup._loopAnimation = parsedAnimationGroup.loopAnimation;
2280
- }
2281
- if (parsedAnimationGroup.isAdditive !== undefined) {
2282
- animationGroup._isAdditive = parsedAnimationGroup.isAdditive;
2283
- }
2284
- if (parsedAnimationGroup.weight !== undefined) {
2285
- animationGroup._weight = parsedAnimationGroup.weight;
2286
- }
2287
- if (parsedAnimationGroup.playOrder !== undefined) {
2288
- animationGroup._playOrder = parsedAnimationGroup.playOrder;
2289
- }
2290
- if (parsedAnimationGroup.enableBlending !== undefined) {
2291
- animationGroup._enableBlending = parsedAnimationGroup.enableBlending;
2292
- }
2293
- if (parsedAnimationGroup.blendingSpeed !== undefined) {
2294
- animationGroup._blendingSpeed = parsedAnimationGroup.blendingSpeed;
2295
- }
2296
- if (parsedAnimationGroup.metadata !== undefined) {
2297
- animationGroup.metadata = parsedAnimationGroup.metadata;
2298
- }
2299
- return animationGroup;
2300
- }
2301
- /** @internal */
2302
- static MakeAnimationAdditive(sourceAnimationGroup, referenceFrameOrOptions, range, cloneOriginal = false, clonedName) {
2303
- let options;
2304
- if (typeof referenceFrameOrOptions === "object") {
2305
- options = referenceFrameOrOptions;
2306
- }
2307
- else {
2308
- options = {
2309
- referenceFrame: referenceFrameOrOptions,
2310
- range: range,
2311
- cloneOriginalAnimationGroup: cloneOriginal,
2312
- clonedAnimationName: clonedName,
2313
- };
2314
- }
2315
- let animationGroup = sourceAnimationGroup;
2316
- if (options.cloneOriginalAnimationGroup) {
2317
- animationGroup = sourceAnimationGroup.clone(options.clonedAnimationGroupName || animationGroup.name);
2318
- }
2319
- const targetedAnimations = animationGroup.targetedAnimations;
2320
- for (let index = 0; index < targetedAnimations.length; index++) {
2321
- const targetedAnimation = targetedAnimations[index];
2322
- targetedAnimation.animation = Animation.MakeAnimationAdditive(targetedAnimation.animation, options);
2323
- }
2324
- animationGroup.isAdditive = true;
2325
- if (options.clipKeys) {
2326
- // We need to recalculate the from/to frames for the animation group because some keys may have been removed
2327
- let from = Number.MAX_VALUE;
2328
- let to = -Number.MAX_VALUE;
2329
- const targetedAnimations = animationGroup.targetedAnimations;
2330
- for (let index = 0; index < targetedAnimations.length; index++) {
2331
- const targetedAnimation = targetedAnimations[index];
2332
- const animation = targetedAnimation.animation;
2333
- const keys = animation.getKeys();
2334
- if (from > keys[0].frame) {
2335
- from = keys[0].frame;
2336
- }
2337
- if (to < keys[keys.length - 1].frame) {
2338
- to = keys[keys.length - 1].frame;
2339
- }
2340
- }
2341
- animationGroup._from = from;
2342
- animationGroup._to = to;
2343
- }
2344
- return animationGroup;
2345
- }
2346
- /**
2347
- * Creates a new animation, keeping only the keys that are inside a given key range
2348
- * @param sourceAnimationGroup defines the animation group on which to operate
2349
- * @param fromKey defines the lower bound of the range
2350
- * @param toKey defines the upper bound of the range
2351
- * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup
2352
- * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
2353
- * @returns a new animation group stripped from all the keys outside the given range
2354
- */
2355
- static ClipKeys(sourceAnimationGroup, fromKey, toKey, name, dontCloneAnimations) {
2356
- const animationGroup = sourceAnimationGroup.clone(name || sourceAnimationGroup.name);
2357
- return AnimationGroup.ClipKeysInPlace(animationGroup, fromKey, toKey, dontCloneAnimations);
2358
- }
2359
- /**
2360
- * Updates an existing animation, keeping only the keys that are inside a given key range
2361
- * @param animationGroup defines the animation group on which to operate
2362
- * @param fromKey defines the lower bound of the range
2363
- * @param toKey defines the upper bound of the range
2364
- * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
2365
- * @returns the animationGroup stripped from all the keys outside the given range
2366
- */
2367
- static ClipKeysInPlace(animationGroup, fromKey, toKey, dontCloneAnimations) {
2368
- return AnimationGroup.ClipInPlace(animationGroup, fromKey, toKey, dontCloneAnimations, false);
2369
- }
2370
- /**
2371
- * Creates a new animation, keeping only the frames that are inside a given frame range
2372
- * @param sourceAnimationGroup defines the animation group on which to operate
2373
- * @param fromFrame defines the lower bound of the range
2374
- * @param toFrame defines the upper bound of the range
2375
- * @param name defines the name of the new animation group. If not provided, use the same name as animationGroup
2376
- * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned
2377
- * @returns a new animation group stripped from all the frames outside the given range
2378
- */
2379
- static ClipFrames(sourceAnimationGroup, fromFrame, toFrame, name, dontCloneAnimations) {
2380
- const animationGroup = sourceAnimationGroup.clone(name || sourceAnimationGroup.name);
2381
- return AnimationGroup.ClipFramesInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations);
2382
- }
2383
- /**
2384
- * Updates an existing animation, keeping only the frames that are inside a given frame range
2385
- * @param animationGroup defines the animation group on which to operate
2386
- * @param fromFrame defines the lower bound of the range
2387
- * @param toFrame defines the upper bound of the range
2388
- * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the frames. Default is false, so animations will be cloned
2389
- * @returns the animationGroup stripped from all the frames outside the given range
2390
- */
2391
- static ClipFramesInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations) {
2392
- return AnimationGroup.ClipInPlace(animationGroup, fromFrame, toFrame, dontCloneAnimations, true);
2393
- }
2394
- /**
2395
- * Updates an existing animation, keeping only the keys that are inside a given key or frame range
2396
- * @param animationGroup defines the animation group on which to operate
2397
- * @param start defines the lower bound of the range
2398
- * @param end defines the upper bound of the range
2399
- * @param dontCloneAnimations defines whether or not the animations should be cloned before clipping the keys. Default is false, so animations will be cloned
2400
- * @param useFrame defines if the range is defined by frame numbers or key indices (default is false which means use key indices)
2401
- * @returns the animationGroup stripped from all the keys outside the given range
2402
- */
2403
- static ClipInPlace(animationGroup, start, end, dontCloneAnimations, useFrame = false) {
2404
- let from = Number.MAX_VALUE;
2405
- let to = -Number.MAX_VALUE;
2406
- const targetedAnimations = animationGroup.targetedAnimations;
2407
- for (let index = 0; index < targetedAnimations.length; index++) {
2408
- const targetedAnimation = targetedAnimations[index];
2409
- const animation = dontCloneAnimations ? targetedAnimation.animation : targetedAnimation.animation.clone();
2410
- if (useFrame) {
2411
- // Make sure we have keys corresponding to the bounds of the frame range
2412
- animation.createKeyForFrame(start);
2413
- animation.createKeyForFrame(end);
2414
- }
2415
- const keys = animation.getKeys();
2416
- const newKeys = [];
2417
- let startFrame = Number.MAX_VALUE;
2418
- for (let k = 0; k < keys.length; k++) {
2419
- const key = keys[k];
2420
- if ((!useFrame && k >= start && k <= end) || (useFrame && key.frame >= start && key.frame <= end)) {
2421
- const newKey = {
2422
- frame: key.frame,
2423
- value: key.value.clone ? key.value.clone() : key.value,
2424
- inTangent: key.inTangent,
2425
- outTangent: key.outTangent,
2426
- interpolation: key.interpolation,
2427
- lockedTangent: key.lockedTangent,
2428
- };
2429
- if (startFrame === Number.MAX_VALUE) {
2430
- startFrame = newKey.frame;
2431
- }
2432
- newKey.frame -= startFrame;
2433
- newKeys.push(newKey);
2434
- }
2435
- }
2436
- if (newKeys.length === 0) {
2437
- targetedAnimations.splice(index, 1);
2438
- index--;
2439
- continue;
2440
- }
2441
- if (from > newKeys[0].frame) {
2442
- from = newKeys[0].frame;
2443
- }
2444
- if (to < newKeys[newKeys.length - 1].frame) {
2445
- to = newKeys[newKeys.length - 1].frame;
2446
- }
2447
- animation.setKeys(newKeys, true);
2448
- targetedAnimation.animation = animation; // in case the animation has been cloned
2449
- }
2450
- animationGroup._from = from;
2451
- animationGroup._to = to;
2452
- return animationGroup;
2453
- }
2454
- /**
2455
- * Returns the string "AnimationGroup"
2456
- * @returns "AnimationGroup"
2457
- */
2458
- getClassName() {
2459
- return "AnimationGroup";
2460
- }
2461
- /**
2462
- * Creates a detailed string about the object
2463
- * @param fullDetails defines if the output string will support multiple levels of logging within scene loading
2464
- * @returns a string representing the object
2465
- */
2466
- toString(fullDetails) {
2467
- let ret = "Name: " + this.name;
2468
- ret += ", type: " + this.getClassName();
2469
- if (fullDetails) {
2470
- ret += ", from: " + this._from;
2471
- ret += ", to: " + this._to;
2472
- ret += ", isStarted: " + this._isStarted;
2473
- ret += ", speedRatio: " + this._speedRatio;
2474
- ret += ", targetedAnimations length: " + this._targetedAnimations.length;
2475
- ret += ", animatables length: " + this._animatables;
2476
- }
2477
- return ret;
2478
- }
2479
- }
2480
-
2481
- export { AnimationGroup, TargetedAnimation };
2482
- //# sourceMappingURL=animationGroup-8TJDgymS.esm.js.map