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