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