@babylonjs/viewer 7.42.0 → 7.44.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 (607) hide show
  1. package/assets/photoStudio.env +0 -0
  2. package/dist/babylon-viewer.esm.js +2 -0
  3. package/dist/babylon-viewer.esm.js.map +1 -0
  4. package/dist/babylon-viewer.esm.min.js +2 -0
  5. package/dist/babylon-viewer.esm.min.js.map +1 -0
  6. package/dist/chunks/EXT_lights_ies-D-oSSifC.esm.min.js +2 -0
  7. package/dist/chunks/EXT_lights_ies-D-oSSifC.esm.min.js.map +1 -0
  8. package/dist/chunks/EXT_lights_ies-DJJLktlG.esm.js +84 -0
  9. package/dist/chunks/EXT_lights_ies-DJJLktlG.esm.js.map +1 -0
  10. package/dist/chunks/EXT_lights_image_based-Bm1EdHWU.esm.js +171 -0
  11. package/dist/chunks/EXT_lights_image_based-Bm1EdHWU.esm.js.map +1 -0
  12. package/dist/chunks/EXT_lights_image_based-CPP95suP.esm.min.js +2 -0
  13. package/dist/chunks/EXT_lights_image_based-CPP95suP.esm.min.js.map +1 -0
  14. package/dist/chunks/EXT_mesh_gpu_instancing-DuFNjp-b.esm.js +86 -0
  15. package/dist/chunks/EXT_mesh_gpu_instancing-DuFNjp-b.esm.js.map +1 -0
  16. package/dist/chunks/EXT_mesh_gpu_instancing-RXBAS2yg.esm.min.js +2 -0
  17. package/dist/chunks/EXT_mesh_gpu_instancing-RXBAS2yg.esm.min.js.map +1 -0
  18. package/dist/chunks/EXT_meshopt_compression-B_tol2Sa.esm.min.js +2 -0
  19. package/dist/chunks/EXT_meshopt_compression-B_tol2Sa.esm.min.js.map +1 -0
  20. package/dist/chunks/EXT_meshopt_compression-Rai3-_W3.esm.js +134 -0
  21. package/dist/chunks/EXT_meshopt_compression-Rai3-_W3.esm.js.map +1 -0
  22. package/dist/chunks/EXT_texture_avif-D3PbSGsk.esm.js +44 -0
  23. package/dist/chunks/EXT_texture_avif-D3PbSGsk.esm.js.map +1 -0
  24. package/dist/chunks/EXT_texture_avif-DB96e8gK.esm.min.js +2 -0
  25. package/dist/chunks/EXT_texture_avif-DB96e8gK.esm.min.js.map +1 -0
  26. package/dist/chunks/EXT_texture_webp-BrAdNUVI.esm.min.js +2 -0
  27. package/dist/chunks/EXT_texture_webp-BrAdNUVI.esm.min.js.map +1 -0
  28. package/dist/chunks/EXT_texture_webp-BsSdw4hb.esm.js +43 -0
  29. package/dist/chunks/EXT_texture_webp-BsSdw4hb.esm.js.map +1 -0
  30. package/dist/chunks/ExtrasAsMetadata-CvpNkVJm.esm.js +64 -0
  31. package/dist/chunks/ExtrasAsMetadata-CvpNkVJm.esm.js.map +1 -0
  32. package/dist/chunks/ExtrasAsMetadata-CwSGAnId.esm.min.js +2 -0
  33. package/dist/chunks/ExtrasAsMetadata-CwSGAnId.esm.min.js.map +1 -0
  34. package/dist/chunks/KHR_animation_pointer-B29-7REN.esm.js +352 -0
  35. package/dist/chunks/KHR_animation_pointer-B29-7REN.esm.js.map +1 -0
  36. package/dist/chunks/KHR_animation_pointer-DXhkj5r0.esm.min.js +2 -0
  37. package/dist/chunks/KHR_animation_pointer-DXhkj5r0.esm.min.js.map +1 -0
  38. package/dist/chunks/KHR_draco_mesh_compression-4y3oU3vs.esm.js +611 -0
  39. package/dist/chunks/KHR_draco_mesh_compression-4y3oU3vs.esm.js.map +1 -0
  40. package/dist/chunks/KHR_draco_mesh_compression-OUEmCF9O.esm.min.js +2 -0
  41. package/dist/chunks/KHR_draco_mesh_compression-OUEmCF9O.esm.min.js.map +1 -0
  42. package/dist/chunks/KHR_interactivity-DmxwZO-B.esm.min.js +2 -0
  43. package/dist/chunks/KHR_interactivity-DmxwZO-B.esm.min.js.map +1 -0
  44. package/dist/chunks/KHR_interactivity-Nql0vbRS.esm.js +4033 -0
  45. package/dist/chunks/KHR_interactivity-Nql0vbRS.esm.js.map +1 -0
  46. package/dist/chunks/KHR_lights_punctual-BuxTRJTD.esm.min.js +2 -0
  47. package/dist/chunks/KHR_lights_punctual-BuxTRJTD.esm.min.js.map +1 -0
  48. package/dist/chunks/KHR_lights_punctual-DT1Tmy49.esm.js +581 -0
  49. package/dist/chunks/KHR_lights_punctual-DT1Tmy49.esm.js.map +1 -0
  50. package/dist/chunks/KHR_materials_anisotropy-CkyM8JSq.esm.min.js +2 -0
  51. package/dist/chunks/KHR_materials_anisotropy-CkyM8JSq.esm.min.js.map +1 -0
  52. package/dist/chunks/KHR_materials_anisotropy-rMp1ahNa.esm.js +65 -0
  53. package/dist/chunks/KHR_materials_anisotropy-rMp1ahNa.esm.js.map +1 -0
  54. package/dist/chunks/KHR_materials_clearcoat-Dw7bP6zs.esm.js +96 -0
  55. package/dist/chunks/KHR_materials_clearcoat-Dw7bP6zs.esm.js.map +1 -0
  56. package/dist/chunks/KHR_materials_clearcoat-c_8cDReS.esm.min.js +2 -0
  57. package/dist/chunks/KHR_materials_clearcoat-c_8cDReS.esm.min.js.map +1 -0
  58. package/dist/chunks/KHR_materials_diffuse_transmission-CXn0MUer.esm.min.js +2 -0
  59. package/dist/chunks/KHR_materials_diffuse_transmission-CXn0MUer.esm.min.js.map +1 -0
  60. package/dist/chunks/KHR_materials_diffuse_transmission-CsMJW09v.esm.js +97 -0
  61. package/dist/chunks/KHR_materials_diffuse_transmission-CsMJW09v.esm.js.map +1 -0
  62. package/dist/chunks/KHR_materials_dispersion-BDCbGsPA.esm.js +62 -0
  63. package/dist/chunks/KHR_materials_dispersion-BDCbGsPA.esm.js.map +1 -0
  64. package/dist/chunks/KHR_materials_dispersion-D2yTJOjM.esm.min.js +2 -0
  65. package/dist/chunks/KHR_materials_dispersion-D2yTJOjM.esm.min.js.map +1 -0
  66. package/dist/chunks/KHR_materials_emissive_strength-Tz0C88U3.esm.min.js +2 -0
  67. package/dist/chunks/KHR_materials_emissive_strength-Tz0C88U3.esm.min.js.map +1 -0
  68. package/dist/chunks/KHR_materials_emissive_strength-jQMxZKq5.esm.js +55 -0
  69. package/dist/chunks/KHR_materials_emissive_strength-jQMxZKq5.esm.js.map +1 -0
  70. package/dist/chunks/KHR_materials_ior-2zUX8jy7.esm.js +64 -0
  71. package/dist/chunks/KHR_materials_ior-2zUX8jy7.esm.js.map +1 -0
  72. package/dist/chunks/KHR_materials_ior-sCAKuvLs.esm.min.js +2 -0
  73. package/dist/chunks/KHR_materials_ior-sCAKuvLs.esm.min.js.map +1 -0
  74. package/dist/chunks/KHR_materials_iridescence-CTk6lY7i.esm.min.js +2 -0
  75. package/dist/chunks/KHR_materials_iridescence-CTk6lY7i.esm.min.js.map +1 -0
  76. package/dist/chunks/KHR_materials_iridescence-DxBAsUzR.esm.js +72 -0
  77. package/dist/chunks/KHR_materials_iridescence-DxBAsUzR.esm.js.map +1 -0
  78. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BgkZXf0x.esm.js +81 -0
  79. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-BgkZXf0x.esm.js.map +1 -0
  80. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Dq7WTMdT.esm.min.js +2 -0
  81. package/dist/chunks/KHR_materials_pbrSpecularGlossiness-Dq7WTMdT.esm.min.js.map +1 -0
  82. package/dist/chunks/KHR_materials_sheen-35UGLw0C.esm.js +85 -0
  83. package/dist/chunks/KHR_materials_sheen-35UGLw0C.esm.js.map +1 -0
  84. package/dist/chunks/KHR_materials_sheen-DQ6C57Dt.esm.min.js +2 -0
  85. package/dist/chunks/KHR_materials_sheen-DQ6C57Dt.esm.min.js.map +1 -0
  86. package/dist/chunks/KHR_materials_specular-BPk7EQUD.esm.min.js +2 -0
  87. package/dist/chunks/KHR_materials_specular-BPk7EQUD.esm.min.js.map +1 -0
  88. package/dist/chunks/KHR_materials_specular-DrL3M38a.esm.js +75 -0
  89. package/dist/chunks/KHR_materials_specular-DrL3M38a.esm.js.map +1 -0
  90. package/dist/chunks/KHR_materials_transmission-3olkVCcW.esm.min.js +2 -0
  91. package/dist/chunks/KHR_materials_transmission-3olkVCcW.esm.min.js.map +1 -0
  92. package/dist/chunks/KHR_materials_transmission-BpjfU0Rf.esm.js +307 -0
  93. package/dist/chunks/KHR_materials_transmission-BpjfU0Rf.esm.js.map +1 -0
  94. package/dist/chunks/KHR_materials_unlit-BK4Bp8qS.esm.min.js +2 -0
  95. package/dist/chunks/KHR_materials_unlit-BK4Bp8qS.esm.min.js.map +1 -0
  96. package/dist/chunks/KHR_materials_unlit-DqWkeMIs.esm.js +74 -0
  97. package/dist/chunks/KHR_materials_unlit-DqWkeMIs.esm.js.map +1 -0
  98. package/dist/chunks/KHR_materials_variants-C8EH6z5q.esm.js +262 -0
  99. package/dist/chunks/KHR_materials_variants-C8EH6z5q.esm.js.map +1 -0
  100. package/dist/chunks/KHR_materials_variants-U_7nHGWs.esm.min.js +2 -0
  101. package/dist/chunks/KHR_materials_variants-U_7nHGWs.esm.min.js.map +1 -0
  102. package/dist/chunks/KHR_materials_volume-QCITeTgE.esm.min.js +2 -0
  103. package/dist/chunks/KHR_materials_volume-QCITeTgE.esm.min.js.map +1 -0
  104. package/dist/chunks/KHR_materials_volume-eXcEVVpW.esm.js +87 -0
  105. package/dist/chunks/KHR_materials_volume-eXcEVVpW.esm.js.map +1 -0
  106. package/dist/chunks/KHR_mesh_quantization-BjqgHT7P.esm.js +26 -0
  107. package/dist/chunks/KHR_mesh_quantization-BjqgHT7P.esm.js.map +1 -0
  108. package/dist/chunks/KHR_mesh_quantization-CEo8-_n9.esm.min.js +2 -0
  109. package/dist/chunks/KHR_mesh_quantization-CEo8-_n9.esm.min.js.map +1 -0
  110. package/dist/chunks/KHR_node_hoverability-CLakAM7o.esm.min.js +2 -0
  111. package/dist/chunks/KHR_node_hoverability-CLakAM7o.esm.min.js.map +1 -0
  112. package/dist/chunks/KHR_node_hoverability-XR4H2sEJ.esm.js +39 -0
  113. package/dist/chunks/KHR_node_hoverability-XR4H2sEJ.esm.js.map +1 -0
  114. package/dist/chunks/KHR_node_visibility-D5-Uq040.esm.js +46 -0
  115. package/dist/chunks/KHR_node_visibility-D5-Uq040.esm.js.map +1 -0
  116. package/dist/chunks/KHR_node_visibility-JpHMpDZy.esm.min.js +2 -0
  117. package/dist/chunks/KHR_node_visibility-JpHMpDZy.esm.min.js.map +1 -0
  118. package/dist/chunks/KHR_texture_basisu-CK096eX9.esm.min.js +2 -0
  119. package/dist/chunks/KHR_texture_basisu-CK096eX9.esm.min.js.map +1 -0
  120. package/dist/chunks/KHR_texture_basisu-JvEhdHQJ.esm.js +43 -0
  121. package/dist/chunks/KHR_texture_basisu-JvEhdHQJ.esm.js.map +1 -0
  122. package/dist/chunks/KHR_texture_transform-ASnRyeyf.esm.js +63 -0
  123. package/dist/chunks/KHR_texture_transform-ASnRyeyf.esm.js.map +1 -0
  124. package/dist/chunks/KHR_texture_transform-Ci769L7F.esm.min.js +2 -0
  125. package/dist/chunks/KHR_texture_transform-Ci769L7F.esm.min.js.map +1 -0
  126. package/dist/chunks/KHR_xmp_json_ld-Cf0IphHD.esm.min.js +2 -0
  127. package/dist/chunks/KHR_xmp_json_ld-Cf0IphHD.esm.min.js.map +1 -0
  128. package/dist/chunks/KHR_xmp_json_ld-ZytUWg-l.esm.js +51 -0
  129. package/dist/chunks/KHR_xmp_json_ld-ZytUWg-l.esm.js.map +1 -0
  130. package/dist/chunks/MSFT_audio_emitter-BjoYL7lC.esm.min.js +2 -0
  131. package/dist/chunks/MSFT_audio_emitter-BjoYL7lC.esm.min.js.map +1 -0
  132. package/dist/chunks/MSFT_audio_emitter-Di8nqSDi.esm.js +2200 -0
  133. package/dist/chunks/MSFT_audio_emitter-Di8nqSDi.esm.js.map +1 -0
  134. package/dist/chunks/MSFT_lod-BMUlo5OU.esm.js +337 -0
  135. package/dist/chunks/MSFT_lod-BMUlo5OU.esm.js.map +1 -0
  136. package/dist/chunks/MSFT_lod-OG5_k4mO.esm.min.js +2 -0
  137. package/dist/chunks/MSFT_lod-OG5_k4mO.esm.min.js.map +1 -0
  138. package/dist/chunks/MSFT_minecraftMesh-CA9_SnEQ.esm.js +46 -0
  139. package/dist/chunks/MSFT_minecraftMesh-CA9_SnEQ.esm.js.map +1 -0
  140. package/dist/chunks/MSFT_minecraftMesh-DA-GfwSb.esm.min.js +2 -0
  141. package/dist/chunks/MSFT_minecraftMesh-DA-GfwSb.esm.min.js.map +1 -0
  142. package/dist/chunks/MSFT_sRGBFactors-BpXptZ3D.esm.js +47 -0
  143. package/dist/chunks/MSFT_sRGBFactors-BpXptZ3D.esm.js.map +1 -0
  144. package/dist/chunks/MSFT_sRGBFactors-COm0y2eh.esm.min.js +2 -0
  145. package/dist/chunks/MSFT_sRGBFactors-COm0y2eh.esm.min.js.map +1 -0
  146. package/dist/chunks/animationGroup-DeyI1KVN.esm.min.js +2 -0
  147. package/dist/chunks/animationGroup-DeyI1KVN.esm.min.js.map +1 -0
  148. package/dist/chunks/animationGroup-DrsZkXQW.esm.js +2482 -0
  149. package/dist/chunks/animationGroup-DrsZkXQW.esm.js.map +1 -0
  150. package/dist/chunks/assetContainer-Cx2Wvxkg.esm.js +1786 -0
  151. package/dist/chunks/assetContainer-Cx2Wvxkg.esm.js.map +1 -0
  152. package/dist/chunks/assetContainer-l3mez3br.esm.min.js +2 -0
  153. package/dist/chunks/assetContainer-l3mez3br.esm.min.js.map +1 -0
  154. package/dist/chunks/bakedVertexAnimation-CwJYQylG.esm.js +114 -0
  155. package/dist/chunks/bakedVertexAnimation-CwJYQylG.esm.js.map +1 -0
  156. package/dist/chunks/bakedVertexAnimation-D5PLG8Vz.esm.min.js +2 -0
  157. package/dist/chunks/bakedVertexAnimation-D5PLG8Vz.esm.min.js.map +1 -0
  158. package/dist/chunks/basisTextureLoader-BNH-2Zvb.esm.min.js +2 -0
  159. package/dist/chunks/basisTextureLoader-BNH-2Zvb.esm.min.js.map +1 -0
  160. package/dist/chunks/basisTextureLoader-JW5tEMV8.esm.js +600 -0
  161. package/dist/chunks/basisTextureLoader-JW5tEMV8.esm.js.map +1 -0
  162. package/dist/chunks/dds-B1kYpKg4.esm.js +540 -0
  163. package/dist/chunks/dds-B1kYpKg4.esm.js.map +1 -0
  164. package/dist/chunks/dds-BIaKvdM8.esm.min.js +2 -0
  165. package/dist/chunks/dds-BIaKvdM8.esm.min.js.map +1 -0
  166. package/dist/chunks/ddsTextureLoader-DHdy4-WN.esm.js +88 -0
  167. package/dist/chunks/ddsTextureLoader-DHdy4-WN.esm.js.map +1 -0
  168. package/dist/chunks/ddsTextureLoader-DQvH8BPG.esm.min.js +2 -0
  169. package/dist/chunks/ddsTextureLoader-DQvH8BPG.esm.min.js.map +1 -0
  170. package/dist/chunks/decalFragment-B07XA08h.esm.min.js +2 -0
  171. package/dist/chunks/decalFragment-B07XA08h.esm.min.js.map +1 -0
  172. package/dist/chunks/decalFragment-ClGzoop1.esm.js +18 -0
  173. package/dist/chunks/decalFragment-ClGzoop1.esm.js.map +1 -0
  174. package/dist/chunks/default.fragment-CAC3-eH5.esm.min.js +2 -0
  175. package/dist/chunks/default.fragment-CAC3-eH5.esm.min.js.map +1 -0
  176. package/dist/chunks/default.fragment-Cr0qnYU0.esm.js +446 -0
  177. package/dist/chunks/default.fragment-Cr0qnYU0.esm.js.map +1 -0
  178. package/dist/chunks/default.fragment-DJgifW8z.esm.min.js +2 -0
  179. package/dist/chunks/default.fragment-DJgifW8z.esm.min.js.map +1 -0
  180. package/dist/chunks/default.fragment-uFTw5k6Z.esm.js +515 -0
  181. package/dist/chunks/default.fragment-uFTw5k6Z.esm.js.map +1 -0
  182. package/dist/chunks/default.vertex-B_u-vpoR.esm.js +211 -0
  183. package/dist/chunks/default.vertex-B_u-vpoR.esm.js.map +1 -0
  184. package/dist/chunks/default.vertex-Bo-YeuPk.esm.min.js +2 -0
  185. package/dist/chunks/default.vertex-Bo-YeuPk.esm.min.js.map +1 -0
  186. package/dist/chunks/default.vertex-C6LMYeLT.esm.min.js +2 -0
  187. package/dist/chunks/default.vertex-C6LMYeLT.esm.min.js.map +1 -0
  188. package/dist/chunks/default.vertex-CzuD5tIE.esm.js +190 -0
  189. package/dist/chunks/default.vertex-CzuD5tIE.esm.js.map +1 -0
  190. package/dist/chunks/defaultUboDeclaration-BSYuerQe.esm.min.js +2 -0
  191. package/dist/chunks/defaultUboDeclaration-BSYuerQe.esm.min.js.map +1 -0
  192. package/dist/chunks/defaultUboDeclaration-CQJaKPLM.esm.min.js +2 -0
  193. package/dist/chunks/defaultUboDeclaration-CQJaKPLM.esm.min.js.map +1 -0
  194. package/dist/chunks/defaultUboDeclaration-DzRt1iTO.esm.js +13 -0
  195. package/dist/chunks/defaultUboDeclaration-DzRt1iTO.esm.js.map +1 -0
  196. package/dist/chunks/defaultUboDeclaration-DzpAmCf1.esm.js +15 -0
  197. package/dist/chunks/defaultUboDeclaration-DzpAmCf1.esm.js.map +1 -0
  198. package/dist/chunks/dumpTools-JfWNUHd1.esm.js +200 -0
  199. package/dist/chunks/dumpTools-JfWNUHd1.esm.js.map +1 -0
  200. package/dist/chunks/dumpTools-MGQM1tV4.esm.min.js +2 -0
  201. package/dist/chunks/dumpTools-MGQM1tV4.esm.min.js.map +1 -0
  202. package/dist/chunks/envTextureLoader-CoD9RkFy.esm.js +64 -0
  203. package/dist/chunks/envTextureLoader-CoD9RkFy.esm.js.map +1 -0
  204. package/dist/chunks/envTextureLoader-_huqF4Iu.esm.min.js +2 -0
  205. package/dist/chunks/envTextureLoader-_huqF4Iu.esm.min.js.map +1 -0
  206. package/dist/chunks/environmentTextureTools-BFBrSyc_.esm.min.js +2 -0
  207. package/dist/chunks/environmentTextureTools-BFBrSyc_.esm.min.js.map +1 -0
  208. package/dist/chunks/environmentTextureTools-DMKf2lIW.esm.js +382 -0
  209. package/dist/chunks/environmentTextureTools-DMKf2lIW.esm.js.map +1 -0
  210. package/dist/chunks/exrTextureLoader-BkuwS0XF.esm.min.js +2 -0
  211. package/dist/chunks/exrTextureLoader-BkuwS0XF.esm.min.js.map +1 -0
  212. package/dist/chunks/exrTextureLoader-DxOSgB3m.esm.js +1683 -0
  213. package/dist/chunks/exrTextureLoader-DxOSgB3m.esm.js.map +1 -0
  214. package/dist/chunks/fogFragment-CdyzhyDy.esm.min.js +2 -0
  215. package/dist/chunks/fogFragment-CdyzhyDy.esm.min.js.map +1 -0
  216. package/dist/chunks/fogFragment-Ct0roave.esm.js +101 -0
  217. package/dist/chunks/fogFragment-Ct0roave.esm.js.map +1 -0
  218. package/dist/chunks/fogFragment-DjORBY8D.esm.min.js +2 -0
  219. package/dist/chunks/fogFragment-DjORBY8D.esm.min.js.map +1 -0
  220. package/dist/chunks/fogFragment-DwdRh83Z.esm.js +102 -0
  221. package/dist/chunks/fogFragment-DwdRh83Z.esm.js.map +1 -0
  222. package/dist/chunks/fresnelFunction-CuDZqiSs.esm.js +12 -0
  223. package/dist/chunks/fresnelFunction-CuDZqiSs.esm.js.map +1 -0
  224. package/dist/chunks/fresnelFunction-zYzL693r.esm.min.js +2 -0
  225. package/dist/chunks/fresnelFunction-zYzL693r.esm.min.js.map +1 -0
  226. package/dist/chunks/glTFLoader-CKBe9bFc.esm.js +7735 -0
  227. package/dist/chunks/glTFLoader-CKBe9bFc.esm.js.map +1 -0
  228. package/dist/chunks/glTFLoader-HrDvovFY.esm.min.js +2 -0
  229. package/dist/chunks/glTFLoader-HrDvovFY.esm.min.js.map +1 -0
  230. package/dist/chunks/glTFLoaderAnimation-D-y1xZvo.esm.min.js +2 -0
  231. package/dist/chunks/glTFLoaderAnimation-D-y1xZvo.esm.min.js.map +1 -0
  232. package/dist/chunks/glTFLoaderAnimation-D57wBZJj.esm.js +77 -0
  233. package/dist/chunks/glTFLoaderAnimation-D57wBZJj.esm.js.map +1 -0
  234. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js +2 -0
  235. package/dist/chunks/gltfPathToObjectConverter-Dyt_Y9jE.esm.min.js.map +1 -0
  236. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js +67 -0
  237. package/dist/chunks/gltfPathToObjectConverter-GcUmfOyo.esm.js.map +1 -0
  238. package/dist/chunks/harmonicsFunctions-8p1AKl3B.esm.js +35 -0
  239. package/dist/chunks/harmonicsFunctions-8p1AKl3B.esm.js.map +1 -0
  240. package/dist/chunks/harmonicsFunctions-C3M4g6jE.esm.min.js +2 -0
  241. package/dist/chunks/harmonicsFunctions-C3M4g6jE.esm.min.js.map +1 -0
  242. package/dist/chunks/harmonicsFunctions-CoiTSsVa.esm.min.js +2 -0
  243. package/dist/chunks/harmonicsFunctions-CoiTSsVa.esm.min.js.map +1 -0
  244. package/dist/chunks/harmonicsFunctions-HT06ZoZl.esm.js +34 -0
  245. package/dist/chunks/harmonicsFunctions-HT06ZoZl.esm.js.map +1 -0
  246. package/dist/chunks/hdrTextureLoader-B0kksMif.esm.js +253 -0
  247. package/dist/chunks/hdrTextureLoader-B0kksMif.esm.js.map +1 -0
  248. package/dist/chunks/hdrTextureLoader-CnTSpduj.esm.min.js +2 -0
  249. package/dist/chunks/hdrTextureLoader-CnTSpduj.esm.min.js.map +1 -0
  250. package/dist/chunks/helperFunctions-Bq5KkNmT.esm.js +83 -0
  251. package/dist/chunks/helperFunctions-Bq5KkNmT.esm.js.map +1 -0
  252. package/dist/chunks/helperFunctions-DauLsm9X.esm.min.js +2 -0
  253. package/dist/chunks/helperFunctions-DauLsm9X.esm.min.js.map +1 -0
  254. package/dist/chunks/helperFunctions-Du6Zsfhy.esm.min.js +2 -0
  255. package/dist/chunks/helperFunctions-Du6Zsfhy.esm.min.js.map +1 -0
  256. package/dist/chunks/helperFunctions-oDSGYqJN.esm.js +110 -0
  257. package/dist/chunks/helperFunctions-oDSGYqJN.esm.js.map +1 -0
  258. package/dist/chunks/iesTextureLoader-DdRr77cj.esm.js +189 -0
  259. package/dist/chunks/iesTextureLoader-DdRr77cj.esm.js.map +1 -0
  260. package/dist/chunks/iesTextureLoader-DkEckxVj.esm.min.js +2 -0
  261. package/dist/chunks/iesTextureLoader-DkEckxVj.esm.min.js.map +1 -0
  262. package/dist/chunks/index-D46Rc8Qa.esm.js +82819 -0
  263. package/dist/chunks/index-D46Rc8Qa.esm.js.map +1 -0
  264. package/dist/chunks/index-r5IGv8fd.esm.min.js +57 -0
  265. package/dist/chunks/index-r5IGv8fd.esm.min.js.map +1 -0
  266. package/dist/chunks/ktxTextureLoader-CImJ68er.esm.min.js +2 -0
  267. package/dist/chunks/ktxTextureLoader-CImJ68er.esm.min.js.map +1 -0
  268. package/dist/chunks/ktxTextureLoader-CvQzBtnz.esm.js +814 -0
  269. package/dist/chunks/ktxTextureLoader-CvQzBtnz.esm.js.map +1 -0
  270. package/dist/chunks/logDepthDeclaration-BNJ_qeEv.esm.min.js +2 -0
  271. package/dist/chunks/logDepthDeclaration-BNJ_qeEv.esm.min.js.map +1 -0
  272. package/dist/chunks/logDepthDeclaration-Co9yKHfe.esm.js +35 -0
  273. package/dist/chunks/logDepthDeclaration-Co9yKHfe.esm.js.map +1 -0
  274. package/dist/chunks/logDepthDeclaration-DP9tYyv7.esm.min.js +2 -0
  275. package/dist/chunks/logDepthDeclaration-DP9tYyv7.esm.min.js.map +1 -0
  276. package/dist/chunks/logDepthDeclaration-KzS73dPG.esm.js +11 -0
  277. package/dist/chunks/logDepthDeclaration-KzS73dPG.esm.js.map +1 -0
  278. package/dist/chunks/logDepthVertex-BBDSLJJg.esm.js +77 -0
  279. package/dist/chunks/logDepthVertex-BBDSLJJg.esm.js.map +1 -0
  280. package/dist/chunks/logDepthVertex-CHXEv8Hm.esm.min.js +2 -0
  281. package/dist/chunks/logDepthVertex-CHXEv8Hm.esm.min.js.map +1 -0
  282. package/dist/chunks/logDepthVertex-CkCG5UAD.esm.min.js +2 -0
  283. package/dist/chunks/logDepthVertex-CkCG5UAD.esm.min.js.map +1 -0
  284. package/dist/chunks/logDepthVertex-DKTOhgu8.esm.js +81 -0
  285. package/dist/chunks/logDepthVertex-DKTOhgu8.esm.js.map +1 -0
  286. package/dist/chunks/mainUVVaryingDeclaration-BxP2qnf1.esm.js +11 -0
  287. package/dist/chunks/mainUVVaryingDeclaration-BxP2qnf1.esm.js.map +1 -0
  288. package/dist/chunks/mainUVVaryingDeclaration-D-YFWEWb.esm.min.js +2 -0
  289. package/dist/chunks/mainUVVaryingDeclaration-D-YFWEWb.esm.min.js.map +1 -0
  290. package/dist/chunks/mainUVVaryingDeclaration-D5LXIN_s.esm.min.js +2 -0
  291. package/dist/chunks/mainUVVaryingDeclaration-D5LXIN_s.esm.min.js.map +1 -0
  292. package/dist/chunks/mainUVVaryingDeclaration-DBd0Ca2K.esm.js +11 -0
  293. package/dist/chunks/mainUVVaryingDeclaration-DBd0Ca2K.esm.js.map +1 -0
  294. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js +119 -0
  295. package/dist/chunks/mesh.vertexData.functions-B_pMCAzZ.esm.js.map +1 -0
  296. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js +2 -0
  297. package/dist/chunks/mesh.vertexData.functions-Bo7e6Of9.esm.min.js.map +1 -0
  298. package/dist/chunks/meshUboDeclaration-D7vtpetW.esm.js +26 -0
  299. package/dist/chunks/meshUboDeclaration-D7vtpetW.esm.js.map +1 -0
  300. package/dist/chunks/meshUboDeclaration-tb8T5asG.esm.min.js +2 -0
  301. package/dist/chunks/meshUboDeclaration-tb8T5asG.esm.min.js.map +1 -0
  302. package/dist/chunks/objFileLoader-B0XaXxyr.esm.min.js +2 -0
  303. package/dist/chunks/objFileLoader-B0XaXxyr.esm.min.js.map +1 -0
  304. package/dist/chunks/objFileLoader-B1MaGxQt.esm.js +1338 -0
  305. package/dist/chunks/objFileLoader-B1MaGxQt.esm.js.map +1 -0
  306. package/dist/chunks/oitFragment-BEKFrqPY.esm.js +1078 -0
  307. package/dist/chunks/oitFragment-BEKFrqPY.esm.js.map +1 -0
  308. package/dist/chunks/oitFragment-CJrbQh0i.esm.min.js +2 -0
  309. package/dist/chunks/oitFragment-CJrbQh0i.esm.min.js.map +1 -0
  310. package/dist/chunks/oitFragment-DCxGblwL.esm.js +1240 -0
  311. package/dist/chunks/oitFragment-DCxGblwL.esm.js.map +1 -0
  312. package/dist/chunks/oitFragment-sZA5tkE3.esm.min.js +2 -0
  313. package/dist/chunks/oitFragment-sZA5tkE3.esm.min.js.map +1 -0
  314. package/dist/chunks/pass.fragment-BYDvFFL5.esm.js +15 -0
  315. package/dist/chunks/pass.fragment-BYDvFFL5.esm.js.map +1 -0
  316. package/dist/chunks/pass.fragment-BgXOqRns.esm.js +15 -0
  317. package/dist/chunks/pass.fragment-BgXOqRns.esm.js.map +1 -0
  318. package/dist/chunks/pass.fragment-DgadxzwS.esm.min.js +2 -0
  319. package/dist/chunks/pass.fragment-DgadxzwS.esm.min.js.map +1 -0
  320. package/dist/chunks/pass.fragment-Dqmp3CRB.esm.min.js +2 -0
  321. package/dist/chunks/pass.fragment-Dqmp3CRB.esm.min.js.map +1 -0
  322. package/dist/chunks/passCube.fragment-07CNLnnq.esm.js +34 -0
  323. package/dist/chunks/passCube.fragment-07CNLnnq.esm.js.map +1 -0
  324. package/dist/chunks/passCube.fragment-4R2Z-LXR.esm.min.js +2 -0
  325. package/dist/chunks/passCube.fragment-4R2Z-LXR.esm.min.js.map +1 -0
  326. package/dist/chunks/passCube.fragment-Aq1scRJ9.esm.js +34 -0
  327. package/dist/chunks/passCube.fragment-Aq1scRJ9.esm.js.map +1 -0
  328. package/dist/chunks/passCube.fragment-DiybDNvK.esm.min.js +2 -0
  329. package/dist/chunks/passCube.fragment-DiybDNvK.esm.min.js.map +1 -0
  330. package/dist/chunks/pbr.fragment-CBb8vd51.esm.min.js +2 -0
  331. package/dist/chunks/pbr.fragment-CBb8vd51.esm.min.js.map +1 -0
  332. package/dist/chunks/pbr.fragment-DSUT21Rk.esm.min.js +2 -0
  333. package/dist/chunks/pbr.fragment-DSUT21Rk.esm.min.js.map +1 -0
  334. package/dist/chunks/pbr.fragment-DmP7eqg7.esm.js +3272 -0
  335. package/dist/chunks/pbr.fragment-DmP7eqg7.esm.js.map +1 -0
  336. package/dist/chunks/pbr.fragment-DzIZJg6m.esm.js +3225 -0
  337. package/dist/chunks/pbr.fragment-DzIZJg6m.esm.js.map +1 -0
  338. package/dist/chunks/pbr.vertex--Lj5Uipt.esm.js +223 -0
  339. package/dist/chunks/pbr.vertex--Lj5Uipt.esm.js.map +1 -0
  340. package/dist/chunks/pbr.vertex-BScRF6wh.esm.min.js +2 -0
  341. package/dist/chunks/pbr.vertex-BScRF6wh.esm.min.js.map +1 -0
  342. package/dist/chunks/pbr.vertex-CZSsnbPf.esm.js +348 -0
  343. package/dist/chunks/pbr.vertex-CZSsnbPf.esm.js.map +1 -0
  344. package/dist/chunks/pbr.vertex-Nho2p99M.esm.min.js +2 -0
  345. package/dist/chunks/pbr.vertex-Nho2p99M.esm.min.js.map +1 -0
  346. package/dist/chunks/postprocess.vertex-B_q6GHTK.esm.js +20 -0
  347. package/dist/chunks/postprocess.vertex-B_q6GHTK.esm.js.map +1 -0
  348. package/dist/chunks/postprocess.vertex-C-ocJcje.esm.min.js +2 -0
  349. package/dist/chunks/postprocess.vertex-C-ocJcje.esm.min.js.map +1 -0
  350. package/dist/chunks/rawTexture-DeYN01jd.esm.min.js +2 -0
  351. package/dist/chunks/rawTexture-DeYN01jd.esm.min.js.map +1 -0
  352. package/dist/chunks/rawTexture-Dh4jdTlv.esm.js +191 -0
  353. package/dist/chunks/rawTexture-Dh4jdTlv.esm.js.map +1 -0
  354. package/dist/chunks/ray-DMN9ip7z.esm.min.js +2 -0
  355. package/dist/chunks/ray-DMN9ip7z.esm.min.js.map +1 -0
  356. package/dist/chunks/ray-QR2k6aJd.esm.js +946 -0
  357. package/dist/chunks/ray-QR2k6aJd.esm.js.map +1 -0
  358. package/dist/chunks/rgbdDecode.fragment-C3AkoFAQ.esm.min.js +2 -0
  359. package/dist/chunks/rgbdDecode.fragment-C3AkoFAQ.esm.min.js.map +1 -0
  360. package/dist/chunks/rgbdDecode.fragment-Cok6PVQr.esm.js +13 -0
  361. package/dist/chunks/rgbdDecode.fragment-Cok6PVQr.esm.js.map +1 -0
  362. package/dist/chunks/rgbdDecode.fragment-CqcagT1x.esm.min.js +2 -0
  363. package/dist/chunks/rgbdDecode.fragment-CqcagT1x.esm.min.js.map +1 -0
  364. package/dist/chunks/rgbdDecode.fragment-DRpqF3bE.esm.js +13 -0
  365. package/dist/chunks/rgbdDecode.fragment-DRpqF3bE.esm.js.map +1 -0
  366. package/dist/chunks/rgbdEncode.fragment-BLe7imXf.esm.min.js +2 -0
  367. package/dist/chunks/rgbdEncode.fragment-BLe7imXf.esm.min.js.map +1 -0
  368. package/dist/chunks/rgbdEncode.fragment-Bi6E_oVW.esm.js +13 -0
  369. package/dist/chunks/rgbdEncode.fragment-Bi6E_oVW.esm.js.map +1 -0
  370. package/dist/chunks/rgbdEncode.fragment-C7hBKPem.esm.min.js +2 -0
  371. package/dist/chunks/rgbdEncode.fragment-C7hBKPem.esm.min.js.map +1 -0
  372. package/dist/chunks/rgbdEncode.fragment-C9DicUjD.esm.js +13 -0
  373. package/dist/chunks/rgbdEncode.fragment-C9DicUjD.esm.js.map +1 -0
  374. package/dist/chunks/splatFileLoader-BzfYte-_.esm.min.js +2 -0
  375. package/dist/chunks/splatFileLoader-BzfYte-_.esm.min.js.map +1 -0
  376. package/dist/chunks/splatFileLoader-K9RpjB6c.esm.js +3660 -0
  377. package/dist/chunks/splatFileLoader-K9RpjB6c.esm.js.map +1 -0
  378. package/dist/chunks/spotLight-CJlK-_c5.esm.min.js +2 -0
  379. package/dist/chunks/spotLight-CJlK-_c5.esm.min.js.map +1 -0
  380. package/dist/chunks/spotLight-DxPJdRVZ.esm.js +701 -0
  381. package/dist/chunks/spotLight-DxPJdRVZ.esm.js.map +1 -0
  382. package/dist/chunks/standardMaterial-BRKRGk7c.esm.js +1811 -0
  383. package/dist/chunks/standardMaterial-BRKRGk7c.esm.js.map +1 -0
  384. package/dist/chunks/standardMaterial-Bs9Jda3X.esm.min.js +2 -0
  385. package/dist/chunks/standardMaterial-Bs9Jda3X.esm.min.js.map +1 -0
  386. package/dist/chunks/stlFileLoader-BSGzPo-z.esm.min.js +2 -0
  387. package/dist/chunks/stlFileLoader-BSGzPo-z.esm.min.js.map +1 -0
  388. package/dist/chunks/stlFileLoader-DtPzeNXZ.esm.js +238 -0
  389. package/dist/chunks/stlFileLoader-DtPzeNXZ.esm.js.map +1 -0
  390. package/dist/chunks/tgaTextureLoader-CFjxRPEE.esm.js +349 -0
  391. package/dist/chunks/tgaTextureLoader-CFjxRPEE.esm.js.map +1 -0
  392. package/dist/chunks/tgaTextureLoader-Ch1a2Rcd.esm.min.js +2 -0
  393. package/dist/chunks/tgaTextureLoader-Ch1a2Rcd.esm.min.js.map +1 -0
  394. package/dist/chunks/thinInstanceMesh-CgfQdxDM.esm.min.js +2 -0
  395. package/dist/chunks/thinInstanceMesh-CgfQdxDM.esm.min.js.map +1 -0
  396. package/dist/chunks/thinInstanceMesh-tQGPk8rE.esm.js +314 -0
  397. package/dist/chunks/thinInstanceMesh-tQGPk8rE.esm.js.map +1 -0
  398. package/dist/chunks/vertexColorMixing-BcDvzwMA.esm.js +440 -0
  399. package/dist/chunks/vertexColorMixing-BcDvzwMA.esm.js.map +1 -0
  400. package/dist/chunks/vertexColorMixing-CJeeWCpY.esm.min.js +2 -0
  401. package/dist/chunks/vertexColorMixing-CJeeWCpY.esm.min.js.map +1 -0
  402. package/dist/chunks/vertexColorMixing-DQESmS2T.esm.js +550 -0
  403. package/dist/chunks/vertexColorMixing-DQESmS2T.esm.js.map +1 -0
  404. package/dist/chunks/vertexColorMixing-DlrEyRWJ.esm.min.js +2 -0
  405. package/dist/chunks/vertexColorMixing-DlrEyRWJ.esm.min.js.map +1 -0
  406. package/dist/chunks/webgpuEngine-B8AMUx8i.esm.js +11539 -0
  407. package/dist/chunks/webgpuEngine-B8AMUx8i.esm.js.map +1 -0
  408. package/dist/chunks/webgpuEngine-CxY3O3Qz.esm.min.js +2 -0
  409. package/dist/chunks/webgpuEngine-CxY3O3Qz.esm.min.js.map +1 -0
  410. package/dist/chunks/workerPool-BUOov2K1.esm.js +122 -0
  411. package/dist/chunks/workerPool-BUOov2K1.esm.js.map +1 -0
  412. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js +2 -0
  413. package/dist/chunks/workerPool-BWHiDmEZ.esm.min.js.map +1 -0
  414. package/lib/index.d.ts +637 -0
  415. package/lib/index.js +2257 -0
  416. package/lib/index.js.map +1 -0
  417. package/package.json +38 -24
  418. package/readme.md +28 -28
  419. package/configuration/configuration.d.ts +0 -107
  420. package/configuration/configuration.js +0 -16
  421. package/configuration/configuration.js.map +0 -1
  422. package/configuration/configurationCompatibility.d.ts +0 -8
  423. package/configuration/configurationCompatibility.js +0 -66
  424. package/configuration/configurationCompatibility.js.map +0 -1
  425. package/configuration/configurationContainer.d.ts +0 -10
  426. package/configuration/configurationContainer.js +0 -10
  427. package/configuration/configurationContainer.js.map +0 -1
  428. package/configuration/globals.d.ts +0 -6
  429. package/configuration/globals.js +0 -18
  430. package/configuration/globals.js.map +0 -1
  431. package/configuration/index.d.ts +0 -2
  432. package/configuration/index.js +0 -4
  433. package/configuration/index.js.map +0 -1
  434. package/configuration/interfaces/cameraConfiguration.d.ts +0 -31
  435. package/configuration/interfaces/cameraConfiguration.js +0 -2
  436. package/configuration/interfaces/cameraConfiguration.js.map +0 -1
  437. package/configuration/interfaces/colorGradingConfiguration.d.ts +0 -81
  438. package/configuration/interfaces/colorGradingConfiguration.js +0 -2
  439. package/configuration/interfaces/colorGradingConfiguration.js.map +0 -1
  440. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +0 -20
  441. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +0 -2
  442. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +0 -1
  443. package/configuration/interfaces/environmentMapConfiguration.d.ts +0 -22
  444. package/configuration/interfaces/environmentMapConfiguration.js +0 -2
  445. package/configuration/interfaces/environmentMapConfiguration.js.map +0 -1
  446. package/configuration/interfaces/groundConfiguration.d.ts +0 -24
  447. package/configuration/interfaces/groundConfiguration.js +0 -2
  448. package/configuration/interfaces/groundConfiguration.js.map +0 -1
  449. package/configuration/interfaces/imageProcessingConfiguration.d.ts +0 -45
  450. package/configuration/interfaces/imageProcessingConfiguration.js +0 -2
  451. package/configuration/interfaces/imageProcessingConfiguration.js.map +0 -1
  452. package/configuration/interfaces/index.d.ts +0 -15
  453. package/configuration/interfaces/index.js +0 -16
  454. package/configuration/interfaces/index.js.map +0 -1
  455. package/configuration/interfaces/lightConfiguration.d.ts +0 -60
  456. package/configuration/interfaces/lightConfiguration.js +0 -2
  457. package/configuration/interfaces/lightConfiguration.js.map +0 -1
  458. package/configuration/interfaces/modelAnimationConfiguration.d.ts +0 -26
  459. package/configuration/interfaces/modelAnimationConfiguration.js +0 -2
  460. package/configuration/interfaces/modelAnimationConfiguration.js.map +0 -1
  461. package/configuration/interfaces/modelConfiguration.d.ts +0 -65
  462. package/configuration/interfaces/modelConfiguration.js +0 -2
  463. package/configuration/interfaces/modelConfiguration.js.map +0 -1
  464. package/configuration/interfaces/observersConfiguration.d.ts +0 -5
  465. package/configuration/interfaces/observersConfiguration.js +0 -2
  466. package/configuration/interfaces/observersConfiguration.js.map +0 -1
  467. package/configuration/interfaces/sceneConfiguration.d.ts +0 -48
  468. package/configuration/interfaces/sceneConfiguration.js +0 -2
  469. package/configuration/interfaces/sceneConfiguration.js.map +0 -1
  470. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +0 -23
  471. package/configuration/interfaces/sceneOptimizerConfiguration.js +0 -2
  472. package/configuration/interfaces/sceneOptimizerConfiguration.js.map +0 -1
  473. package/configuration/interfaces/skyboxConfiguration.d.ts +0 -21
  474. package/configuration/interfaces/skyboxConfiguration.js +0 -2
  475. package/configuration/interfaces/skyboxConfiguration.js.map +0 -1
  476. package/configuration/interfaces/templateConfiguration.d.ts +0 -67
  477. package/configuration/interfaces/templateConfiguration.js +0 -2
  478. package/configuration/interfaces/templateConfiguration.js.map +0 -1
  479. package/configuration/interfaces/vrConfiguration.d.ts +0 -16
  480. package/configuration/interfaces/vrConfiguration.js +0 -2
  481. package/configuration/interfaces/vrConfiguration.js.map +0 -1
  482. package/configuration/loader.d.ts +0 -4
  483. package/configuration/loader.js +0 -17
  484. package/configuration/loader.js.map +0 -1
  485. package/configuration/mappers.d.ts +0 -43
  486. package/configuration/mappers.js +0 -193
  487. package/configuration/mappers.js.map +0 -1
  488. package/configuration/renderOnlyLoader.d.ts +0 -33
  489. package/configuration/renderOnlyLoader.js +0 -162
  490. package/configuration/renderOnlyLoader.js.map +0 -1
  491. package/configuration/types/default.d.ts +0 -6
  492. package/configuration/types/default.js +0 -121
  493. package/configuration/types/default.js.map +0 -1
  494. package/configuration/types/environmentMap.d.ts +0 -5
  495. package/configuration/types/environmentMap.js +0 -14
  496. package/configuration/types/environmentMap.js.map +0 -1
  497. package/configuration/types/extended.d.ts +0 -6
  498. package/configuration/types/extended.js +0 -317
  499. package/configuration/types/extended.js.map +0 -1
  500. package/configuration/types/index.d.ts +0 -14
  501. package/configuration/types/index.js +0 -51
  502. package/configuration/types/index.js.map +0 -1
  503. package/configuration/types/minimal.d.ts +0 -6
  504. package/configuration/types/minimal.js +0 -43
  505. package/configuration/types/minimal.js.map +0 -1
  506. package/configuration/types/renderOnlyDefault.d.ts +0 -30
  507. package/configuration/types/renderOnlyDefault.js +0 -31
  508. package/configuration/types/renderOnlyDefault.js.map +0 -1
  509. package/configuration/types/shadowLight.d.ts +0 -9
  510. package/configuration/types/shadowLight.js +0 -64
  511. package/configuration/types/shadowLight.js.map +0 -1
  512. package/helper/index.d.ts +0 -29
  513. package/helper/index.js +0 -66
  514. package/helper/index.js.map +0 -1
  515. package/index.d.ts +0 -30
  516. package/index.js +0 -46
  517. package/index.js.map +0 -1
  518. package/initializer.d.ts +0 -11
  519. package/initializer.js +0 -35
  520. package/initializer.js.map +0 -1
  521. package/interfaces.d.ts +0 -5
  522. package/interfaces.js +0 -7
  523. package/interfaces.js.map +0 -1
  524. package/labs/environmentSerializer.d.ts +0 -126
  525. package/labs/environmentSerializer.js +0 -191
  526. package/labs/environmentSerializer.js.map +0 -1
  527. package/labs/texture.d.ts +0 -183
  528. package/labs/texture.js +0 -351
  529. package/labs/texture.js.map +0 -1
  530. package/labs/viewerLabs.d.ts +0 -51
  531. package/labs/viewerLabs.js +0 -134
  532. package/labs/viewerLabs.js.map +0 -1
  533. package/loader/modelLoader.d.ts +0 -56
  534. package/loader/modelLoader.js +0 -202
  535. package/loader/modelLoader.js.map +0 -1
  536. package/loader/plugins/applyMaterialConfig.d.ts +0 -12
  537. package/loader/plugins/applyMaterialConfig.js +0 -16
  538. package/loader/plugins/applyMaterialConfig.js.map +0 -1
  539. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +0 -9
  540. package/loader/plugins/extendedMaterialLoaderPlugin.js +0 -16
  541. package/loader/plugins/extendedMaterialLoaderPlugin.js.map +0 -1
  542. package/loader/plugins/index.d.ts +0 -19
  543. package/loader/plugins/index.js +0 -44
  544. package/loader/plugins/index.js.map +0 -1
  545. package/loader/plugins/loaderPlugin.d.ts +0 -24
  546. package/loader/plugins/loaderPlugin.js +0 -2
  547. package/loader/plugins/loaderPlugin.js.map +0 -1
  548. package/loader/plugins/msftLodLoaderPlugin.d.ts +0 -12
  549. package/loader/plugins/msftLodLoaderPlugin.js +0 -21
  550. package/loader/plugins/msftLodLoaderPlugin.js.map +0 -1
  551. package/loader/plugins/telemetryLoaderPlugin.d.ts +0 -12
  552. package/loader/plugins/telemetryLoaderPlugin.js +0 -36
  553. package/loader/plugins/telemetryLoaderPlugin.js.map +0 -1
  554. package/managers/observablesManager.d.ts +0 -66
  555. package/managers/observablesManager.js +0 -35
  556. package/managers/observablesManager.js.map +0 -1
  557. package/managers/sceneManager.d.ts +0 -245
  558. package/managers/sceneManager.js +0 -1375
  559. package/managers/sceneManager.js.map +0 -1
  560. package/managers/telemetryManager.d.ts +0 -78
  561. package/managers/telemetryManager.js +0 -117
  562. package/managers/telemetryManager.js.map +0 -1
  563. package/model/modelAnimation.d.ts +0 -215
  564. package/model/modelAnimation.js +0 -237
  565. package/model/modelAnimation.js.map +0 -1
  566. package/model/viewerModel.d.ts +0 -233
  567. package/model/viewerModel.js +0 -673
  568. package/model/viewerModel.js.map +0 -1
  569. package/optimizer/custom/extended.d.ts +0 -13
  570. package/optimizer/custom/extended.js +0 -101
  571. package/optimizer/custom/extended.js.map +0 -1
  572. package/optimizer/custom/index.d.ts +0 -9
  573. package/optimizer/custom/index.js +0 -26
  574. package/optimizer/custom/index.js.map +0 -1
  575. package/renderOnlyIndex.d.ts +0 -11
  576. package/renderOnlyIndex.js +0 -18
  577. package/renderOnlyIndex.js.map +0 -1
  578. package/templating/eventManager.d.ts +0 -35
  579. package/templating/eventManager.js +0 -66
  580. package/templating/eventManager.js.map +0 -1
  581. package/templating/plugins/hdButtonPlugin.d.ts +0 -9
  582. package/templating/plugins/hdButtonPlugin.js +0 -22
  583. package/templating/plugins/hdButtonPlugin.js.map +0 -1
  584. package/templating/plugins/printButton.d.ts +0 -9
  585. package/templating/plugins/printButton.js +0 -41
  586. package/templating/plugins/printButton.js.map +0 -1
  587. package/templating/templateManager.d.ts +0 -197
  588. package/templating/templateManager.js +0 -561
  589. package/templating/templateManager.js.map +0 -1
  590. package/templating/viewerTemplatePlugin.d.ts +0 -21
  591. package/templating/viewerTemplatePlugin.js +0 -69
  592. package/templating/viewerTemplatePlugin.js.map +0 -1
  593. package/viewer/defaultViewer.d.ts +0 -130
  594. package/viewer/defaultViewer.js +0 -672
  595. package/viewer/defaultViewer.js.map +0 -1
  596. package/viewer/renderOnlyViewer.d.ts +0 -9
  597. package/viewer/renderOnlyViewer.js +0 -46
  598. package/viewer/renderOnlyViewer.js.map +0 -1
  599. package/viewer/viewer.d.ts +0 -258
  600. package/viewer/viewer.js +0 -783
  601. package/viewer/viewer.js.map +0 -1
  602. package/viewer/viewerManager.d.ts +0 -58
  603. package/viewer/viewerManager.js +0 -91
  604. package/viewer/viewerManager.js.map +0 -1
  605. package/viewer/viewerWithTemplate.d.ts +0 -9
  606. package/viewer/viewerWithTemplate.js +0 -20
  607. package/viewer/viewerWithTemplate.js.map +0 -1
@@ -0,0 +1,1786 @@
1
+ import { M as Mesh, h as AbstractMesh, T as Tools, L as Logger, V as VertexBuffer, bk as TransformNode, a8 as Matrix, aa as TmpVectors, bb as DeepCopier, K as RegisterClass, ab as EngineStore, b1 as Light, a0 as Camera, bp as Tags } from './index-D46Rc8Qa.esm.js';
2
+
3
+ Mesh._instancedMeshFactory = (name, mesh) => {
4
+ const instance = new InstancedMesh(name, mesh);
5
+ if (mesh.instancedBuffers) {
6
+ instance.instancedBuffers = {};
7
+ for (const key in mesh.instancedBuffers) {
8
+ instance.instancedBuffers[key] = mesh.instancedBuffers[key];
9
+ }
10
+ }
11
+ return instance;
12
+ };
13
+ /**
14
+ * Creates an instance based on a source mesh.
15
+ */
16
+ class InstancedMesh extends AbstractMesh {
17
+ /**
18
+ * Creates a new InstancedMesh object from the mesh source.
19
+ * @param name defines the name of the instance
20
+ * @param source the mesh to create the instance from
21
+ */
22
+ constructor(name, source) {
23
+ super(name, source.getScene());
24
+ /** @internal */
25
+ this._indexInSourceMeshInstanceArray = -1;
26
+ /** @internal */
27
+ this._distanceToCamera = 0;
28
+ source.addInstance(this);
29
+ this._sourceMesh = source;
30
+ this._unIndexed = source._unIndexed;
31
+ this.position.copyFrom(source.position);
32
+ this.rotation.copyFrom(source.rotation);
33
+ this.scaling.copyFrom(source.scaling);
34
+ if (source.rotationQuaternion) {
35
+ this.rotationQuaternion = source.rotationQuaternion.clone();
36
+ }
37
+ this.animations = source.animations.slice();
38
+ for (const range of source.getAnimationRanges()) {
39
+ if (range != null) {
40
+ this.createAnimationRange(range.name, range.from, range.to);
41
+ }
42
+ }
43
+ this.infiniteDistance = source.infiniteDistance;
44
+ this.setPivotMatrix(source.getPivotMatrix());
45
+ this.refreshBoundingInfo(true, true);
46
+ this._syncSubMeshes();
47
+ }
48
+ /**
49
+ * @returns the string "InstancedMesh".
50
+ */
51
+ getClassName() {
52
+ return "InstancedMesh";
53
+ }
54
+ /** Gets the list of lights affecting that mesh */
55
+ get lightSources() {
56
+ return this._sourceMesh._lightSources;
57
+ }
58
+ _resyncLightSources() {
59
+ // Do nothing as all the work will be done by source mesh
60
+ }
61
+ _resyncLightSource() {
62
+ // Do nothing as all the work will be done by source mesh
63
+ }
64
+ _removeLightSource() {
65
+ // Do nothing as all the work will be done by source mesh
66
+ }
67
+ // Methods
68
+ /**
69
+ * If the source mesh receives shadows
70
+ */
71
+ get receiveShadows() {
72
+ return this._sourceMesh.receiveShadows;
73
+ }
74
+ set receiveShadows(_value) {
75
+ if (this._sourceMesh?.receiveShadows !== _value) {
76
+ Tools.Warn("Setting receiveShadows on an instanced mesh has no effect");
77
+ }
78
+ }
79
+ /**
80
+ * The material of the source mesh
81
+ */
82
+ get material() {
83
+ return this._sourceMesh.material;
84
+ }
85
+ set material(_value) {
86
+ if (this._sourceMesh?.material !== _value) {
87
+ Tools.Warn("Setting material on an instanced mesh has no effect");
88
+ }
89
+ }
90
+ /**
91
+ * Visibility of the source mesh
92
+ */
93
+ get visibility() {
94
+ return this._sourceMesh.visibility;
95
+ }
96
+ set visibility(_value) {
97
+ if (this._sourceMesh?.visibility !== _value) {
98
+ Tools.Warn("Setting visibility on an instanced mesh has no effect");
99
+ }
100
+ }
101
+ /**
102
+ * Skeleton of the source mesh
103
+ */
104
+ get skeleton() {
105
+ return this._sourceMesh.skeleton;
106
+ }
107
+ set skeleton(_value) {
108
+ if (this._sourceMesh?.skeleton !== _value) {
109
+ Tools.Warn("Setting skeleton on an instanced mesh has no effect");
110
+ }
111
+ }
112
+ /**
113
+ * Rendering ground id of the source mesh
114
+ */
115
+ get renderingGroupId() {
116
+ return this._sourceMesh.renderingGroupId;
117
+ }
118
+ set renderingGroupId(value) {
119
+ if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {
120
+ return;
121
+ }
122
+ //no-op with warning
123
+ Logger.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene");
124
+ }
125
+ /**
126
+ * @returns the total number of vertices (integer).
127
+ */
128
+ getTotalVertices() {
129
+ return this._sourceMesh ? this._sourceMesh.getTotalVertices() : 0;
130
+ }
131
+ /**
132
+ * Returns a positive integer : the total number of indices in this mesh geometry.
133
+ * @returns the number of indices or zero if the mesh has no geometry.
134
+ */
135
+ getTotalIndices() {
136
+ return this._sourceMesh.getTotalIndices();
137
+ }
138
+ /**
139
+ * The source mesh of the instance
140
+ */
141
+ get sourceMesh() {
142
+ return this._sourceMesh;
143
+ }
144
+ /**
145
+ * Creates a new InstancedMesh object from the mesh model.
146
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/copies/instances
147
+ * @param name defines the name of the new instance
148
+ * @returns a new InstancedMesh
149
+ */
150
+ createInstance(name) {
151
+ return this._sourceMesh.createInstance(name);
152
+ }
153
+ /**
154
+ * Is this node ready to be used/rendered
155
+ * @param completeCheck defines if a complete check (including materials and lights) has to be done (false by default)
156
+ * @returns {boolean} is it ready
157
+ */
158
+ isReady(completeCheck = false) {
159
+ return this._sourceMesh.isReady(completeCheck, true);
160
+ }
161
+ /**
162
+ * Returns an array of integers or a typed array (Int32Array, Uint32Array, Uint16Array) populated with the mesh indices.
163
+ * @param kind kind of verticies to retrieve (eg. positions, normals, uvs, etc.)
164
+ * @param copyWhenShared If true (default false) and and if the mesh geometry is shared among some other meshes, the returned array is a copy of the internal one.
165
+ * @param forceCopy defines a boolean forcing the copy of the buffer no matter what the value of copyWhenShared is
166
+ * @returns a float array or a Float32Array of the requested kind of data : positions, normals, uvs, etc.
167
+ */
168
+ getVerticesData(kind, copyWhenShared, forceCopy) {
169
+ return this._sourceMesh.getVerticesData(kind, copyWhenShared, forceCopy);
170
+ }
171
+ copyVerticesData(kind, vertexData) {
172
+ this._sourceMesh.copyVerticesData(kind, vertexData);
173
+ }
174
+ /**
175
+ * Sets the vertex data of the mesh geometry for the requested `kind`.
176
+ * If the mesh has no geometry, a new Geometry object is set to the mesh and then passed this vertex data.
177
+ * The `data` are either a numeric array either a Float32Array.
178
+ * The parameter `updatable` is passed as is to the underlying Geometry object constructor (if initially none) or updater.
179
+ * The parameter `stride` is an optional positive integer, it is usually automatically deducted from the `kind` (3 for positions or normals, 2 for UV, etc).
180
+ * Note that a new underlying VertexBuffer object is created each call.
181
+ * If the `kind` is the `PositionKind`, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
182
+ *
183
+ * Possible `kind` values :
184
+ * - VertexBuffer.PositionKind
185
+ * - VertexBuffer.UVKind
186
+ * - VertexBuffer.UV2Kind
187
+ * - VertexBuffer.UV3Kind
188
+ * - VertexBuffer.UV4Kind
189
+ * - VertexBuffer.UV5Kind
190
+ * - VertexBuffer.UV6Kind
191
+ * - VertexBuffer.ColorKind
192
+ * - VertexBuffer.MatricesIndicesKind
193
+ * - VertexBuffer.MatricesIndicesExtraKind
194
+ * - VertexBuffer.MatricesWeightsKind
195
+ * - VertexBuffer.MatricesWeightsExtraKind
196
+ *
197
+ * Returns the Mesh.
198
+ * @param kind defines vertex data kind
199
+ * @param data defines the data source
200
+ * @param updatable defines if the data must be flagged as updatable (false as default)
201
+ * @param stride defines the vertex stride (optional)
202
+ * @returns the current mesh
203
+ */
204
+ setVerticesData(kind, data, updatable, stride) {
205
+ if (this.sourceMesh) {
206
+ this.sourceMesh.setVerticesData(kind, data, updatable, stride);
207
+ }
208
+ return this.sourceMesh;
209
+ }
210
+ /**
211
+ * Updates the existing vertex data of the mesh geometry for the requested `kind`.
212
+ * If the mesh has no geometry, it is simply returned as it is.
213
+ * The `data` are either a numeric array either a Float32Array.
214
+ * No new underlying VertexBuffer object is created.
215
+ * If the `kind` is the `PositionKind` and if `updateExtends` is true, the mesh BoundingInfo is renewed, so the bounding box and sphere, and the mesh World Matrix is recomputed.
216
+ * If the parameter `makeItUnique` is true, a new global geometry is created from this positions and is set to the mesh.
217
+ *
218
+ * Possible `kind` values :
219
+ * - VertexBuffer.PositionKind
220
+ * - VertexBuffer.UVKind
221
+ * - VertexBuffer.UV2Kind
222
+ * - VertexBuffer.UV3Kind
223
+ * - VertexBuffer.UV4Kind
224
+ * - VertexBuffer.UV5Kind
225
+ * - VertexBuffer.UV6Kind
226
+ * - VertexBuffer.ColorKind
227
+ * - VertexBuffer.MatricesIndicesKind
228
+ * - VertexBuffer.MatricesIndicesExtraKind
229
+ * - VertexBuffer.MatricesWeightsKind
230
+ * - VertexBuffer.MatricesWeightsExtraKind
231
+ *
232
+ * Returns the Mesh.
233
+ * @param kind defines vertex data kind
234
+ * @param data defines the data source
235
+ * @param updateExtends defines if extends info of the mesh must be updated (can be null). This is mostly useful for "position" kind
236
+ * @param makeItUnique defines it the updated vertex buffer must be flagged as unique (false by default)
237
+ * @returns the source mesh
238
+ */
239
+ updateVerticesData(kind, data, updateExtends, makeItUnique) {
240
+ if (this.sourceMesh) {
241
+ this.sourceMesh.updateVerticesData(kind, data, updateExtends, makeItUnique);
242
+ }
243
+ return this.sourceMesh;
244
+ }
245
+ /**
246
+ * Sets the mesh indices.
247
+ * Expects an array populated with integers or a typed array (Int32Array, Uint32Array, Uint16Array).
248
+ * If the mesh has no geometry, a new Geometry object is created and set to the mesh.
249
+ * This method creates a new index buffer each call.
250
+ * Returns the Mesh.
251
+ * @param indices the source data
252
+ * @param totalVertices defines the total number of vertices referenced by indices (could be null)
253
+ * @returns source mesh
254
+ */
255
+ setIndices(indices, totalVertices = null) {
256
+ if (this.sourceMesh) {
257
+ this.sourceMesh.setIndices(indices, totalVertices);
258
+ }
259
+ return this.sourceMesh;
260
+ }
261
+ /**
262
+ * Boolean : True if the mesh owns the requested kind of data.
263
+ * @param kind defines which buffer to check (positions, indices, normals, etc). Possible `kind` values :
264
+ * - VertexBuffer.PositionKind
265
+ * - VertexBuffer.UVKind
266
+ * - VertexBuffer.UV2Kind
267
+ * - VertexBuffer.UV3Kind
268
+ * - VertexBuffer.UV4Kind
269
+ * - VertexBuffer.UV5Kind
270
+ * - VertexBuffer.UV6Kind
271
+ * - VertexBuffer.ColorKind
272
+ * - VertexBuffer.MatricesIndicesKind
273
+ * - VertexBuffer.MatricesIndicesExtraKind
274
+ * - VertexBuffer.MatricesWeightsKind
275
+ * - VertexBuffer.MatricesWeightsExtraKind
276
+ * @returns true if data kind is present
277
+ */
278
+ isVerticesDataPresent(kind) {
279
+ return this._sourceMesh.isVerticesDataPresent(kind);
280
+ }
281
+ /**
282
+ * @returns an array of indices (IndicesArray).
283
+ */
284
+ getIndices() {
285
+ return this._sourceMesh.getIndices();
286
+ }
287
+ get _positions() {
288
+ return this._sourceMesh._positions;
289
+ }
290
+ refreshBoundingInfo(applySkeletonOrOptions = false, applyMorph = false) {
291
+ if (this.hasBoundingInfo && this.getBoundingInfo().isLocked) {
292
+ return this;
293
+ }
294
+ let options;
295
+ if (typeof applySkeletonOrOptions === "object") {
296
+ options = applySkeletonOrOptions;
297
+ }
298
+ else {
299
+ options = {
300
+ applySkeleton: applySkeletonOrOptions,
301
+ applyMorph: applyMorph,
302
+ };
303
+ }
304
+ const bias = this._sourceMesh.geometry ? this._sourceMesh.geometry.boundingBias : null;
305
+ this._refreshBoundingInfo(this._sourceMesh._getData(options, null, VertexBuffer.PositionKind), bias);
306
+ return this;
307
+ }
308
+ /** @internal */
309
+ _preActivate() {
310
+ if (this._currentLOD) {
311
+ this._currentLOD._preActivate();
312
+ }
313
+ return this;
314
+ }
315
+ /**
316
+ * @internal
317
+ */
318
+ _activate(renderId, intermediateRendering) {
319
+ super._activate(renderId, intermediateRendering);
320
+ if (!this._sourceMesh.subMeshes) {
321
+ Logger.Warn("Instances should only be created for meshes with geometry.");
322
+ }
323
+ if (this._currentLOD) {
324
+ const differentSign = this._currentLOD._getWorldMatrixDeterminant() >= 0 !== this._getWorldMatrixDeterminant() >= 0;
325
+ if (differentSign) {
326
+ this._internalAbstractMeshDataInfo._actAsRegularMesh = true;
327
+ return true;
328
+ }
329
+ this._internalAbstractMeshDataInfo._actAsRegularMesh = false;
330
+ this._currentLOD._registerInstanceForRenderId(this, renderId);
331
+ if (intermediateRendering) {
332
+ if (!this._currentLOD._internalAbstractMeshDataInfo._isActiveIntermediate) {
333
+ this._currentLOD._internalAbstractMeshDataInfo._onlyForInstancesIntermediate = true;
334
+ return true;
335
+ }
336
+ }
337
+ else {
338
+ if (!this._currentLOD._internalAbstractMeshDataInfo._isActive) {
339
+ this._currentLOD._internalAbstractMeshDataInfo._onlyForInstances = true;
340
+ return true;
341
+ }
342
+ }
343
+ }
344
+ return false;
345
+ }
346
+ /** @internal */
347
+ _postActivate() {
348
+ if (this._sourceMesh.edgesShareWithInstances && this._sourceMesh._edgesRenderer && this._sourceMesh._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {
349
+ // we are using the edge renderer of the source mesh
350
+ this._sourceMesh._renderingGroup._edgesRenderers.pushNoDuplicate(this._sourceMesh._edgesRenderer);
351
+ this._sourceMesh._edgesRenderer.customInstances.push(this.getWorldMatrix());
352
+ }
353
+ else if (this._edgesRenderer && this._edgesRenderer.isEnabled && this._sourceMesh._renderingGroup) {
354
+ // we are using the edge renderer defined for this instance
355
+ this._sourceMesh._renderingGroup._edgesRenderers.push(this._edgesRenderer);
356
+ }
357
+ }
358
+ getWorldMatrix() {
359
+ if (this._currentLOD && this._currentLOD.billboardMode !== TransformNode.BILLBOARDMODE_NONE && this._currentLOD._masterMesh !== this) {
360
+ if (!this._billboardWorldMatrix) {
361
+ this._billboardWorldMatrix = new Matrix();
362
+ }
363
+ const tempMaster = this._currentLOD._masterMesh;
364
+ this._currentLOD._masterMesh = this;
365
+ TmpVectors.Vector3[7].copyFrom(this._currentLOD.position);
366
+ this._currentLOD.position.set(0, 0, 0);
367
+ this._billboardWorldMatrix.copyFrom(this._currentLOD.computeWorldMatrix(true));
368
+ this._currentLOD.position.copyFrom(TmpVectors.Vector3[7]);
369
+ this._currentLOD._masterMesh = tempMaster;
370
+ return this._billboardWorldMatrix;
371
+ }
372
+ return super.getWorldMatrix();
373
+ }
374
+ get isAnInstance() {
375
+ return true;
376
+ }
377
+ /**
378
+ * Returns the current associated LOD AbstractMesh.
379
+ * @param camera defines the camera to use to pick the LOD level
380
+ * @returns a Mesh or `null` if no LOD is associated with the AbstractMesh
381
+ */
382
+ getLOD(camera) {
383
+ if (!camera) {
384
+ return this;
385
+ }
386
+ const sourceMeshLODLevels = this.sourceMesh.getLODLevels();
387
+ if (!sourceMeshLODLevels || sourceMeshLODLevels.length === 0) {
388
+ this._currentLOD = this.sourceMesh;
389
+ }
390
+ else {
391
+ const boundingInfo = this.getBoundingInfo();
392
+ this._currentLOD = this.sourceMesh.getLOD(camera, boundingInfo.boundingSphere);
393
+ }
394
+ return this._currentLOD;
395
+ }
396
+ /**
397
+ * @internal
398
+ */
399
+ _preActivateForIntermediateRendering(renderId) {
400
+ return this.sourceMesh._preActivateForIntermediateRendering(renderId);
401
+ }
402
+ /** @internal */
403
+ _syncSubMeshes() {
404
+ this.releaseSubMeshes();
405
+ if (this._sourceMesh.subMeshes) {
406
+ for (let index = 0; index < this._sourceMesh.subMeshes.length; index++) {
407
+ this._sourceMesh.subMeshes[index].clone(this, this._sourceMesh);
408
+ }
409
+ }
410
+ return this;
411
+ }
412
+ /** @internal */
413
+ _generatePointsArray() {
414
+ return this._sourceMesh._generatePointsArray();
415
+ }
416
+ /** @internal */
417
+ _updateBoundingInfo() {
418
+ if (this.hasBoundingInfo) {
419
+ this.getBoundingInfo().update(this.worldMatrixFromCache);
420
+ }
421
+ else {
422
+ this.buildBoundingInfo(this.absolutePosition, this.absolutePosition, this.worldMatrixFromCache);
423
+ }
424
+ this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);
425
+ return this;
426
+ }
427
+ /**
428
+ * Creates a new InstancedMesh from the current mesh.
429
+ *
430
+ * Returns the clone.
431
+ * @param name the cloned mesh name
432
+ * @param newParent the optional Node to parent the clone to.
433
+ * @param doNotCloneChildren if `true` the model children aren't cloned.
434
+ * @param newSourceMesh if set this mesh will be used as the source mesh instead of ths instance's one
435
+ * @returns the clone
436
+ */
437
+ clone(name, newParent = null, doNotCloneChildren, newSourceMesh) {
438
+ const result = (newSourceMesh || this._sourceMesh).createInstance(name);
439
+ // Deep copy
440
+ DeepCopier.DeepCopy(this, result, [
441
+ "name",
442
+ "subMeshes",
443
+ "uniqueId",
444
+ "parent",
445
+ "lightSources",
446
+ "receiveShadows",
447
+ "material",
448
+ "visibility",
449
+ "skeleton",
450
+ "sourceMesh",
451
+ "isAnInstance",
452
+ "facetNb",
453
+ "isFacetDataEnabled",
454
+ "isBlocked",
455
+ "useBones",
456
+ "hasInstances",
457
+ "collider",
458
+ "edgesRenderer",
459
+ "forward",
460
+ "up",
461
+ "right",
462
+ "absolutePosition",
463
+ "absoluteScaling",
464
+ "absoluteRotationQuaternion",
465
+ "isWorldMatrixFrozen",
466
+ "nonUniformScaling",
467
+ "behaviors",
468
+ "worldMatrixFromCache",
469
+ "hasThinInstances",
470
+ "hasBoundingInfo",
471
+ ], []);
472
+ // Bounding info
473
+ this.refreshBoundingInfo();
474
+ // Parent
475
+ if (newParent) {
476
+ result.parent = newParent;
477
+ }
478
+ if (!doNotCloneChildren) {
479
+ // Children
480
+ for (let index = 0; index < this.getScene().meshes.length; index++) {
481
+ const mesh = this.getScene().meshes[index];
482
+ if (mesh.parent === this) {
483
+ mesh.clone(mesh.name, result);
484
+ }
485
+ }
486
+ }
487
+ result.computeWorldMatrix(true);
488
+ this.onClonedObservable.notifyObservers(result);
489
+ return result;
490
+ }
491
+ /**
492
+ * Disposes the InstancedMesh.
493
+ * Returns nothing.
494
+ * @param doNotRecurse Set to true to not recurse into each children (recurse into each children by default)
495
+ * @param disposeMaterialAndTextures Set to true to also dispose referenced materials and textures (false by default)
496
+ */
497
+ dispose(doNotRecurse, disposeMaterialAndTextures = false) {
498
+ // Remove from mesh
499
+ this._sourceMesh.removeInstance(this);
500
+ super.dispose(doNotRecurse, disposeMaterialAndTextures);
501
+ }
502
+ /**
503
+ * @internal
504
+ */
505
+ _serializeAsParent(serializationObject) {
506
+ super._serializeAsParent(serializationObject);
507
+ serializationObject.parentId = this._sourceMesh.uniqueId;
508
+ serializationObject.parentInstanceIndex = this._indexInSourceMeshInstanceArray;
509
+ }
510
+ /**
511
+ * Instantiate (when possible) or clone that node with its hierarchy
512
+ * @param newParent defines the new parent to use for the instance (or clone)
513
+ * @param options defines options to configure how copy is done
514
+ * @param options.doNotInstantiate defines if the model must be instantiated or just cloned
515
+ * @param options.newSourcedMesh newSourcedMesh the new source mesh for the instance (or clone)
516
+ * @param onNewNodeCreated defines an option callback to call when a clone or an instance is created
517
+ * @returns an instance (or a clone) of the current node with its hierarchy
518
+ */
519
+ instantiateHierarchy(newParent = null, options, onNewNodeCreated) {
520
+ const clone = this.clone("Clone of " + (this.name || this.id), newParent || this.parent, true, options && options.newSourcedMesh);
521
+ if (clone) {
522
+ if (onNewNodeCreated) {
523
+ onNewNodeCreated(this, clone);
524
+ }
525
+ }
526
+ for (const child of this.getChildTransformNodes(true)) {
527
+ child.instantiateHierarchy(clone, options, onNewNodeCreated);
528
+ }
529
+ return clone;
530
+ }
531
+ }
532
+ Mesh.prototype.registerInstancedBuffer = function (kind, stride) {
533
+ // Remove existing one
534
+ this._userInstancedBuffersStorage?.vertexBuffers[kind]?.dispose();
535
+ // Creates the instancedBuffer field if not present
536
+ if (!this.instancedBuffers) {
537
+ this.instancedBuffers = {};
538
+ for (const instance of this.instances) {
539
+ instance.instancedBuffers = {};
540
+ }
541
+ }
542
+ if (!this._userInstancedBuffersStorage) {
543
+ this._userInstancedBuffersStorage = {
544
+ data: {},
545
+ vertexBuffers: {},
546
+ strides: {},
547
+ sizes: {},
548
+ vertexArrayObjects: this.getEngine().getCaps().vertexArrayObject ? {} : undefined,
549
+ };
550
+ }
551
+ // Creates an empty property for this kind
552
+ this.instancedBuffers[kind] = null;
553
+ this._userInstancedBuffersStorage.strides[kind] = stride;
554
+ this._userInstancedBuffersStorage.sizes[kind] = stride * 32; // Initial size
555
+ this._userInstancedBuffersStorage.data[kind] = new Float32Array(this._userInstancedBuffersStorage.sizes[kind]);
556
+ this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);
557
+ for (const instance of this.instances) {
558
+ instance.instancedBuffers[kind] = null;
559
+ }
560
+ this._invalidateInstanceVertexArrayObject();
561
+ this._markSubMeshesAsAttributesDirty();
562
+ };
563
+ Mesh.prototype._processInstancedBuffers = function (visibleInstances, renderSelf) {
564
+ const instanceCount = visibleInstances ? visibleInstances.length : 0;
565
+ for (const kind in this.instancedBuffers) {
566
+ let size = this._userInstancedBuffersStorage.sizes[kind];
567
+ const stride = this._userInstancedBuffersStorage.strides[kind];
568
+ // Resize if required
569
+ const expectedSize = (instanceCount + 1) * stride;
570
+ while (size < expectedSize) {
571
+ size *= 2;
572
+ }
573
+ if (this._userInstancedBuffersStorage.data[kind].length != size) {
574
+ this._userInstancedBuffersStorage.data[kind] = new Float32Array(size);
575
+ this._userInstancedBuffersStorage.sizes[kind] = size;
576
+ if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {
577
+ this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();
578
+ this._userInstancedBuffersStorage.vertexBuffers[kind] = null;
579
+ }
580
+ }
581
+ const data = this._userInstancedBuffersStorage.data[kind];
582
+ // Update data buffer
583
+ let offset = 0;
584
+ if (renderSelf) {
585
+ const value = this.instancedBuffers[kind];
586
+ if (value.toArray) {
587
+ value.toArray(data, offset);
588
+ }
589
+ else if (value.copyToArray) {
590
+ value.copyToArray(data, offset);
591
+ }
592
+ else {
593
+ data[offset] = value;
594
+ }
595
+ offset += stride;
596
+ }
597
+ for (let instanceIndex = 0; instanceIndex < instanceCount; instanceIndex++) {
598
+ const instance = visibleInstances[instanceIndex];
599
+ const value = instance.instancedBuffers[kind];
600
+ if (value.toArray) {
601
+ value.toArray(data, offset);
602
+ }
603
+ else if (value.copyToArray) {
604
+ value.copyToArray(data, offset);
605
+ }
606
+ else {
607
+ data[offset] = value;
608
+ }
609
+ offset += stride;
610
+ }
611
+ // Update vertex buffer
612
+ if (!this._userInstancedBuffersStorage.vertexBuffers[kind]) {
613
+ this._userInstancedBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userInstancedBuffersStorage.data[kind], kind, true, false, stride, true);
614
+ this._invalidateInstanceVertexArrayObject();
615
+ }
616
+ else {
617
+ this._userInstancedBuffersStorage.vertexBuffers[kind].updateDirectly(data, 0);
618
+ }
619
+ }
620
+ };
621
+ Mesh.prototype._invalidateInstanceVertexArrayObject = function () {
622
+ if (!this._userInstancedBuffersStorage || this._userInstancedBuffersStorage.vertexArrayObjects === undefined) {
623
+ return;
624
+ }
625
+ for (const kind in this._userInstancedBuffersStorage.vertexArrayObjects) {
626
+ this.getEngine().releaseVertexArrayObject(this._userInstancedBuffersStorage.vertexArrayObjects[kind]);
627
+ }
628
+ this._userInstancedBuffersStorage.vertexArrayObjects = {};
629
+ };
630
+ Mesh.prototype._disposeInstanceSpecificData = function () {
631
+ if (this._instanceDataStorage.instancesBuffer) {
632
+ this._instanceDataStorage.instancesBuffer.dispose();
633
+ this._instanceDataStorage.instancesBuffer = null;
634
+ }
635
+ while (this.instances.length) {
636
+ this.instances[0].dispose();
637
+ }
638
+ for (const kind in this.instancedBuffers) {
639
+ if (this._userInstancedBuffersStorage.vertexBuffers[kind]) {
640
+ this._userInstancedBuffersStorage.vertexBuffers[kind].dispose();
641
+ }
642
+ }
643
+ this._invalidateInstanceVertexArrayObject();
644
+ this.instancedBuffers = {};
645
+ };
646
+ // Register Class Name
647
+ RegisterClass("BABYLON.InstancedMesh", InstancedMesh);
648
+
649
+ /**
650
+ * Root class for AssetContainer and KeepAssets
651
+ */
652
+ class AbstractAssetContainer {
653
+ constructor() {
654
+ /**
655
+ * Gets the list of root nodes (ie. nodes with no parent)
656
+ */
657
+ this.rootNodes = [];
658
+ /** All of the cameras added to this scene
659
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/cameras
660
+ */
661
+ this.cameras = [];
662
+ /**
663
+ * All of the lights added to this scene
664
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/lights/lights_introduction
665
+ */
666
+ this.lights = [];
667
+ /**
668
+ * All of the (abstract) meshes added to this scene
669
+ */
670
+ this.meshes = [];
671
+ /**
672
+ * The list of skeletons added to the scene
673
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/bonesSkeletons
674
+ */
675
+ this.skeletons = [];
676
+ /**
677
+ * All of the particle systems added to this scene
678
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/particle_system_intro
679
+ */
680
+ this.particleSystems = [];
681
+ /**
682
+ * Gets a list of Animations associated with the scene
683
+ */
684
+ this.animations = [];
685
+ /**
686
+ * All of the animation groups added to this scene
687
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/animation/groupAnimations
688
+ */
689
+ this.animationGroups = [];
690
+ /**
691
+ * All of the multi-materials added to this scene
692
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/multiMaterials
693
+ */
694
+ this.multiMaterials = [];
695
+ /**
696
+ * All of the materials added to this scene
697
+ * In the context of a Scene, it is not supposed to be modified manually.
698
+ * Any addition or removal should be done using the addMaterial and removeMaterial Scene methods.
699
+ * Note also that the order of the Material within the array is not significant and might change.
700
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/materials/using/materials_introduction
701
+ */
702
+ this.materials = [];
703
+ /**
704
+ * The list of morph target managers added to the scene
705
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/dynamicMeshMorph
706
+ */
707
+ this.morphTargetManagers = [];
708
+ /**
709
+ * The list of geometries used in the scene.
710
+ */
711
+ this.geometries = [];
712
+ /**
713
+ * All of the transform nodes added to this scene
714
+ * In the context of a Scene, it is not supposed to be modified manually.
715
+ * Any addition or removal should be done using the addTransformNode and removeTransformNode Scene methods.
716
+ * Note also that the order of the TransformNode within the array is not significant and might change.
717
+ * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/transforms/parent_pivot/transform_node
718
+ */
719
+ this.transformNodes = [];
720
+ /**
721
+ * ActionManagers available on the scene.
722
+ * @deprecated
723
+ */
724
+ this.actionManagers = [];
725
+ /**
726
+ * Textures to keep.
727
+ */
728
+ this.textures = [];
729
+ /** @internal */
730
+ this._environmentTexture = null;
731
+ /**
732
+ * The list of postprocesses added to the scene
733
+ */
734
+ this.postProcesses = [];
735
+ /**
736
+ * The list of sounds
737
+ */
738
+ this.sounds = null;
739
+ /**
740
+ * The list of effect layers added to the scene
741
+ */
742
+ this.effectLayers = [];
743
+ /**
744
+ * The list of layers added to the scene
745
+ */
746
+ this.layers = [];
747
+ /**
748
+ * The list of reflection probes added to the scene
749
+ */
750
+ this.reflectionProbes = [];
751
+ }
752
+ /**
753
+ * Texture used in all pbr material as the reflection texture.
754
+ * As in the majority of the scene they are the same (exception for multi room and so on),
755
+ * this is easier to reference from here than from all the materials.
756
+ */
757
+ get environmentTexture() {
758
+ return this._environmentTexture;
759
+ }
760
+ set environmentTexture(value) {
761
+ this._environmentTexture = value;
762
+ }
763
+ /**
764
+ * @returns all meshes, lights, cameras, transformNodes and bones
765
+ */
766
+ getNodes() {
767
+ let nodes = [];
768
+ nodes = nodes.concat(this.meshes);
769
+ nodes = nodes.concat(this.lights);
770
+ nodes = nodes.concat(this.cameras);
771
+ nodes = nodes.concat(this.transformNodes); // dummies
772
+ this.skeletons.forEach((skeleton) => (nodes = nodes.concat(skeleton.bones)));
773
+ return nodes;
774
+ }
775
+ }
776
+ /**
777
+ * Set of assets to keep when moving a scene into an asset container.
778
+ */
779
+ class KeepAssets extends AbstractAssetContainer {
780
+ }
781
+ /**
782
+ * Class used to store the output of the AssetContainer.instantiateAllMeshesToScene function
783
+ */
784
+ class InstantiatedEntries {
785
+ constructor() {
786
+ /**
787
+ * List of new root nodes (eg. nodes with no parent)
788
+ */
789
+ this.rootNodes = [];
790
+ /**
791
+ * List of new skeletons
792
+ */
793
+ this.skeletons = [];
794
+ /**
795
+ * List of new animation groups
796
+ */
797
+ this.animationGroups = [];
798
+ }
799
+ /**
800
+ * Disposes the instantiated entries from the scene
801
+ */
802
+ dispose() {
803
+ this.rootNodes.slice(0).forEach((o) => {
804
+ o.dispose();
805
+ });
806
+ this.rootNodes.length = 0;
807
+ this.skeletons.slice(0).forEach((o) => {
808
+ o.dispose();
809
+ });
810
+ this.skeletons.length = 0;
811
+ this.animationGroups.slice(0).forEach((o) => {
812
+ o.dispose();
813
+ });
814
+ this.animationGroups.length = 0;
815
+ }
816
+ }
817
+ /**
818
+ * Container with a set of assets that can be added or removed from a scene.
819
+ */
820
+ class AssetContainer extends AbstractAssetContainer {
821
+ /**
822
+ * Instantiates an AssetContainer.
823
+ * @param scene The scene the AssetContainer belongs to.
824
+ */
825
+ constructor(scene) {
826
+ super();
827
+ this._wasAddedToScene = false;
828
+ scene = scene || EngineStore.LastCreatedScene;
829
+ if (!scene) {
830
+ return;
831
+ }
832
+ this.scene = scene;
833
+ this["proceduralTextures"] = [];
834
+ scene.onDisposeObservable.add(() => {
835
+ if (!this._wasAddedToScene) {
836
+ this.dispose();
837
+ }
838
+ });
839
+ this._onContextRestoredObserver = scene.getEngine().onContextRestoredObservable.add(() => {
840
+ for (const geometry of this.geometries) {
841
+ geometry._rebuild();
842
+ }
843
+ for (const mesh of this.meshes) {
844
+ mesh._rebuild();
845
+ }
846
+ for (const system of this.particleSystems) {
847
+ system.rebuild();
848
+ }
849
+ for (const texture of this.textures) {
850
+ texture._rebuild();
851
+ }
852
+ });
853
+ }
854
+ /**
855
+ * Given a list of nodes, return a topological sorting of them.
856
+ * @param nodes
857
+ * @returns a sorted array of nodes
858
+ */
859
+ _topologicalSort(nodes) {
860
+ const nodesUidMap = new Map();
861
+ for (const node of nodes) {
862
+ nodesUidMap.set(node.uniqueId, node);
863
+ }
864
+ const dependencyGraph = {
865
+ dependsOn: new Map(), // given a node id, what are the ids of the nodes it depends on
866
+ dependedBy: new Map(), // given a node id, what are the ids of the nodes that depend on it
867
+ };
868
+ // Build the dependency graph given the list of nodes
869
+ // First pass: Initialize the empty dependency graph
870
+ for (const node of nodes) {
871
+ const nodeId = node.uniqueId;
872
+ dependencyGraph.dependsOn.set(nodeId, new Set());
873
+ dependencyGraph.dependedBy.set(nodeId, new Set());
874
+ }
875
+ // Second pass: Populate the dependency graph. We assume that we
876
+ // don't need to check for cycles here, as the scene graph cannot
877
+ // contain cycles. Our graph also already contains all transitive
878
+ // dependencies because getDescendants returns the transitive
879
+ // dependencies by default.
880
+ for (const node of nodes) {
881
+ const nodeId = node.uniqueId;
882
+ const dependsOn = dependencyGraph.dependsOn.get(nodeId);
883
+ if (node instanceof InstancedMesh) {
884
+ const masterMesh = node.sourceMesh;
885
+ if (nodesUidMap.has(masterMesh.uniqueId)) {
886
+ dependsOn.add(masterMesh.uniqueId);
887
+ dependencyGraph.dependedBy.get(masterMesh.uniqueId).add(nodeId);
888
+ }
889
+ }
890
+ const dependedBy = dependencyGraph.dependedBy.get(nodeId);
891
+ for (const child of node.getDescendants()) {
892
+ const childId = child.uniqueId;
893
+ if (nodesUidMap.has(childId)) {
894
+ dependedBy.add(childId);
895
+ const childDependsOn = dependencyGraph.dependsOn.get(childId);
896
+ childDependsOn.add(nodeId);
897
+ }
898
+ }
899
+ }
900
+ // Third pass: Topological sort
901
+ const sortedNodes = [];
902
+ // First: Find all nodes that have no dependencies
903
+ const leaves = [];
904
+ for (const node of nodes) {
905
+ const nodeId = node.uniqueId;
906
+ if (dependencyGraph.dependsOn.get(nodeId).size === 0) {
907
+ leaves.push(node);
908
+ nodesUidMap.delete(nodeId);
909
+ }
910
+ }
911
+ const visitList = leaves;
912
+ while (visitList.length > 0) {
913
+ const nodeToVisit = visitList.shift();
914
+ sortedNodes.push(nodeToVisit);
915
+ // Remove the node from the dependency graph
916
+ // When a node is visited, we know that dependsOn is empty.
917
+ // So we only need to remove the node from dependedBy.
918
+ const dependedByVisitedNode = dependencyGraph.dependedBy.get(nodeToVisit.uniqueId);
919
+ // Array.from(x.values()) is to make the TS compiler happy
920
+ for (const dependedByVisitedNodeId of Array.from(dependedByVisitedNode.values())) {
921
+ const dependsOnDependedByVisitedNode = dependencyGraph.dependsOn.get(dependedByVisitedNodeId);
922
+ dependsOnDependedByVisitedNode.delete(nodeToVisit.uniqueId);
923
+ if (dependsOnDependedByVisitedNode.size === 0 && nodesUidMap.get(dependedByVisitedNodeId)) {
924
+ visitList.push(nodesUidMap.get(dependedByVisitedNodeId));
925
+ nodesUidMap.delete(dependedByVisitedNodeId);
926
+ }
927
+ }
928
+ }
929
+ if (nodesUidMap.size > 0) {
930
+ Logger.Error("SceneSerializer._topologicalSort: There were unvisited nodes:");
931
+ nodesUidMap.forEach((node) => Logger.Error(node.name));
932
+ }
933
+ return sortedNodes;
934
+ }
935
+ _addNodeAndDescendantsToList(list, addedIds, rootNode, predicate) {
936
+ if (!rootNode || (predicate && !predicate(rootNode)) || addedIds.has(rootNode.uniqueId)) {
937
+ return;
938
+ }
939
+ list.push(rootNode);
940
+ addedIds.add(rootNode.uniqueId);
941
+ for (const child of rootNode.getDescendants(true)) {
942
+ this._addNodeAndDescendantsToList(list, addedIds, child, predicate);
943
+ }
944
+ }
945
+ /**
946
+ * Check if a specific node is contained in this asset container.
947
+ * @param node the node to check
948
+ * @returns true if the node is contained in this container, otherwise false.
949
+ */
950
+ _isNodeInContainer(node) {
951
+ if (node instanceof AbstractMesh && this.meshes.indexOf(node) !== -1) {
952
+ return true;
953
+ }
954
+ if (node instanceof TransformNode && this.transformNodes.indexOf(node) !== -1) {
955
+ return true;
956
+ }
957
+ if (node instanceof Light && this.lights.indexOf(node) !== -1) {
958
+ return true;
959
+ }
960
+ if (node instanceof Camera && this.cameras.indexOf(node) !== -1) {
961
+ return true;
962
+ }
963
+ return false;
964
+ }
965
+ /**
966
+ * For every node in the scene, check if its parent node is also in the scene.
967
+ * @returns true if every node's parent is also in the scene, otherwise false.
968
+ */
969
+ _isValidHierarchy() {
970
+ for (const node of this.meshes) {
971
+ if (node.parent && !this._isNodeInContainer(node.parent)) {
972
+ Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);
973
+ return false;
974
+ }
975
+ }
976
+ for (const node of this.transformNodes) {
977
+ if (node.parent && !this._isNodeInContainer(node.parent)) {
978
+ Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);
979
+ return false;
980
+ }
981
+ }
982
+ for (const node of this.lights) {
983
+ if (node.parent && !this._isNodeInContainer(node.parent)) {
984
+ Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);
985
+ return false;
986
+ }
987
+ }
988
+ for (const node of this.cameras) {
989
+ if (node.parent && !this._isNodeInContainer(node.parent)) {
990
+ Logger.Warn(`Node ${node.name} has a parent that is not in the container.`);
991
+ return false;
992
+ }
993
+ }
994
+ return true;
995
+ }
996
+ /**
997
+ * Instantiate or clone all meshes and add the new ones to the scene.
998
+ * Skeletons and animation groups will all be cloned
999
+ * @param nameFunction defines an optional function used to get new names for clones
1000
+ * @param cloneMaterials defines an optional boolean that defines if materials must be cloned as well (false by default)
1001
+ * @param options defines an optional list of options to control how to instantiate / clone models
1002
+ * @param options.doNotInstantiate defines if the model must be instantiated or just cloned
1003
+ * @param options.predicate defines a predicate used to filter whih mesh to instantiate/clone
1004
+ * @returns a list of rootNodes, skeletons and animation groups that were duplicated
1005
+ */
1006
+ instantiateModelsToScene(nameFunction, cloneMaterials = false, options) {
1007
+ if (!this._isValidHierarchy()) {
1008
+ Tools.Warn("SceneSerializer.InstantiateModelsToScene: The Asset Container hierarchy is not valid.");
1009
+ }
1010
+ const conversionMap = {};
1011
+ const storeMap = {};
1012
+ const result = new InstantiatedEntries();
1013
+ const alreadySwappedSkeletons = [];
1014
+ const alreadySwappedMaterials = [];
1015
+ const localOptions = {
1016
+ doNotInstantiate: true,
1017
+ ...options,
1018
+ };
1019
+ const onClone = (source, clone) => {
1020
+ conversionMap[source.uniqueId] = clone.uniqueId;
1021
+ storeMap[clone.uniqueId] = clone;
1022
+ if (nameFunction) {
1023
+ clone.name = nameFunction(source.name);
1024
+ }
1025
+ if (clone instanceof Mesh) {
1026
+ const clonedMesh = clone;
1027
+ if (clonedMesh.morphTargetManager) {
1028
+ const oldMorphTargetManager = source.morphTargetManager;
1029
+ clonedMesh.morphTargetManager = oldMorphTargetManager.clone();
1030
+ for (let index = 0; index < oldMorphTargetManager.numTargets; index++) {
1031
+ const oldTarget = oldMorphTargetManager.getTarget(index);
1032
+ const newTarget = clonedMesh.morphTargetManager.getTarget(index);
1033
+ conversionMap[oldTarget.uniqueId] = newTarget.uniqueId;
1034
+ storeMap[newTarget.uniqueId] = newTarget;
1035
+ }
1036
+ }
1037
+ }
1038
+ };
1039
+ const nodesToSort = [];
1040
+ const idsOnSortList = new Set();
1041
+ for (const transformNode of this.transformNodes) {
1042
+ if (transformNode.parent === null) {
1043
+ this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, transformNode, localOptions.predicate);
1044
+ }
1045
+ }
1046
+ for (const mesh of this.meshes) {
1047
+ if (mesh.parent === null) {
1048
+ this._addNodeAndDescendantsToList(nodesToSort, idsOnSortList, mesh, localOptions.predicate);
1049
+ }
1050
+ }
1051
+ // Topologically sort nodes by parenting/instancing relationships so that all resources are in place
1052
+ // when a given node is instantiated.
1053
+ const sortedNodes = this._topologicalSort(nodesToSort);
1054
+ const onNewCreated = (source, clone) => {
1055
+ onClone(source, clone);
1056
+ if (source.parent) {
1057
+ const replicatedParentId = conversionMap[source.parent.uniqueId];
1058
+ const replicatedParent = storeMap[replicatedParentId];
1059
+ if (replicatedParent) {
1060
+ clone.parent = replicatedParent;
1061
+ }
1062
+ else {
1063
+ clone.parent = source.parent;
1064
+ }
1065
+ }
1066
+ if (clone.position && source.position) {
1067
+ clone.position.copyFrom(source.position);
1068
+ }
1069
+ if (clone.rotationQuaternion && source.rotationQuaternion) {
1070
+ clone.rotationQuaternion.copyFrom(source.rotationQuaternion);
1071
+ }
1072
+ if (clone.rotation && source.rotation) {
1073
+ clone.rotation.copyFrom(source.rotation);
1074
+ }
1075
+ if (clone.scaling && source.scaling) {
1076
+ clone.scaling.copyFrom(source.scaling);
1077
+ }
1078
+ if (clone.material) {
1079
+ const mesh = clone;
1080
+ if (mesh.material) {
1081
+ if (cloneMaterials) {
1082
+ const sourceMaterial = source.material;
1083
+ if (alreadySwappedMaterials.indexOf(sourceMaterial) === -1) {
1084
+ let swap = sourceMaterial.clone(nameFunction ? nameFunction(sourceMaterial.name) : "Clone of " + sourceMaterial.name);
1085
+ alreadySwappedMaterials.push(sourceMaterial);
1086
+ conversionMap[sourceMaterial.uniqueId] = swap.uniqueId;
1087
+ storeMap[swap.uniqueId] = swap;
1088
+ if (sourceMaterial.getClassName() === "MultiMaterial") {
1089
+ const multi = sourceMaterial;
1090
+ for (const material of multi.subMaterials) {
1091
+ if (!material) {
1092
+ continue;
1093
+ }
1094
+ swap = material.clone(nameFunction ? nameFunction(material.name) : "Clone of " + material.name);
1095
+ alreadySwappedMaterials.push(material);
1096
+ conversionMap[material.uniqueId] = swap.uniqueId;
1097
+ storeMap[swap.uniqueId] = swap;
1098
+ }
1099
+ multi.subMaterials = multi.subMaterials.map((m) => m && storeMap[conversionMap[m.uniqueId]]);
1100
+ }
1101
+ }
1102
+ if (mesh.getClassName() !== "InstancedMesh") {
1103
+ mesh.material = storeMap[conversionMap[sourceMaterial.uniqueId]];
1104
+ }
1105
+ }
1106
+ else {
1107
+ if (mesh.material.getClassName() === "MultiMaterial") {
1108
+ if (this.scene.multiMaterials.indexOf(mesh.material) === -1) {
1109
+ this.scene.addMultiMaterial(mesh.material);
1110
+ }
1111
+ }
1112
+ else {
1113
+ if (this.scene.materials.indexOf(mesh.material) === -1) {
1114
+ this.scene.addMaterial(mesh.material);
1115
+ }
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ if (clone.parent === null) {
1121
+ result.rootNodes.push(clone);
1122
+ }
1123
+ };
1124
+ sortedNodes.forEach((node) => {
1125
+ if (node.getClassName() === "InstancedMesh") {
1126
+ const instancedNode = node;
1127
+ const sourceMesh = instancedNode.sourceMesh;
1128
+ const replicatedSourceId = conversionMap[sourceMesh.uniqueId];
1129
+ const replicatedSource = typeof replicatedSourceId === "number" ? storeMap[replicatedSourceId] : sourceMesh;
1130
+ const replicatedInstancedNode = replicatedSource.createInstance(instancedNode.name);
1131
+ onNewCreated(instancedNode, replicatedInstancedNode);
1132
+ }
1133
+ else {
1134
+ // Mesh or TransformNode
1135
+ let canInstance = true;
1136
+ if (node.getClassName() === "TransformNode" ||
1137
+ node.getClassName() === "Node" ||
1138
+ node.skeleton ||
1139
+ !node.getTotalVertices ||
1140
+ node.getTotalVertices() === 0) {
1141
+ // Transform nodes, skinned meshes, and meshes with no vertices can never be instanced!
1142
+ canInstance = false;
1143
+ }
1144
+ else if (localOptions.doNotInstantiate) {
1145
+ if (typeof localOptions.doNotInstantiate === "function") {
1146
+ canInstance = !localOptions.doNotInstantiate(node);
1147
+ }
1148
+ else {
1149
+ canInstance = !localOptions.doNotInstantiate;
1150
+ }
1151
+ }
1152
+ const replicatedNode = canInstance ? node.createInstance(`instance of ${node.name}`) : node.clone(`Clone of ${node.name}`, null, true);
1153
+ if (!replicatedNode) {
1154
+ throw new Error(`Could not clone or instantiate node on Asset Container ${node.name}`);
1155
+ }
1156
+ onNewCreated(node, replicatedNode);
1157
+ }
1158
+ });
1159
+ this.skeletons.forEach((s) => {
1160
+ if (localOptions.predicate && !localOptions.predicate(s)) {
1161
+ return;
1162
+ }
1163
+ const clone = s.clone(nameFunction ? nameFunction(s.name) : "Clone of " + s.name);
1164
+ for (const m of this.meshes) {
1165
+ if (m.skeleton === s && !m.isAnInstance) {
1166
+ const copy = storeMap[conversionMap[m.uniqueId]];
1167
+ if (!copy || copy.isAnInstance) {
1168
+ continue;
1169
+ }
1170
+ copy.skeleton = clone;
1171
+ if (alreadySwappedSkeletons.indexOf(clone) !== -1) {
1172
+ continue;
1173
+ }
1174
+ alreadySwappedSkeletons.push(clone);
1175
+ // Check if bones are mesh linked
1176
+ for (const bone of clone.bones) {
1177
+ if (bone._linkedTransformNode) {
1178
+ bone._linkedTransformNode = storeMap[conversionMap[bone._linkedTransformNode.uniqueId]];
1179
+ }
1180
+ }
1181
+ }
1182
+ }
1183
+ result.skeletons.push(clone);
1184
+ });
1185
+ this.animationGroups.forEach((o) => {
1186
+ if (localOptions.predicate && !localOptions.predicate(o)) {
1187
+ return;
1188
+ }
1189
+ const clone = o.clone(nameFunction ? nameFunction(o.name) : "Clone of " + o.name, (oldTarget) => {
1190
+ const newTarget = storeMap[conversionMap[oldTarget.uniqueId]];
1191
+ return newTarget || oldTarget;
1192
+ });
1193
+ result.animationGroups.push(clone);
1194
+ });
1195
+ return result;
1196
+ }
1197
+ /**
1198
+ * Adds all the assets from the container to the scene.
1199
+ */
1200
+ addAllToScene() {
1201
+ if (this._wasAddedToScene) {
1202
+ return;
1203
+ }
1204
+ if (!this._isValidHierarchy()) {
1205
+ Tools.Warn("SceneSerializer.addAllToScene: The Asset Container hierarchy is not valid.");
1206
+ }
1207
+ this._wasAddedToScene = true;
1208
+ this.addToScene(null);
1209
+ if (this.environmentTexture) {
1210
+ this.scene.environmentTexture = this.environmentTexture;
1211
+ }
1212
+ for (const component of this.scene._serializableComponents) {
1213
+ component.addFromContainer(this);
1214
+ }
1215
+ this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);
1216
+ this._onContextRestoredObserver = null;
1217
+ }
1218
+ /**
1219
+ * Adds assets from the container to the scene.
1220
+ * @param predicate defines a predicate used to select which entity will be added (can be null)
1221
+ */
1222
+ addToScene(predicate = null) {
1223
+ const addedNodes = [];
1224
+ this.cameras.forEach((o) => {
1225
+ if (predicate && !predicate(o)) {
1226
+ return;
1227
+ }
1228
+ this.scene.addCamera(o);
1229
+ addedNodes.push(o);
1230
+ });
1231
+ this.lights.forEach((o) => {
1232
+ if (predicate && !predicate(o)) {
1233
+ return;
1234
+ }
1235
+ this.scene.addLight(o);
1236
+ addedNodes.push(o);
1237
+ });
1238
+ this.meshes.forEach((o) => {
1239
+ if (predicate && !predicate(o)) {
1240
+ return;
1241
+ }
1242
+ this.scene.addMesh(o);
1243
+ addedNodes.push(o);
1244
+ });
1245
+ this.skeletons.forEach((o) => {
1246
+ if (predicate && !predicate(o)) {
1247
+ return;
1248
+ }
1249
+ this.scene.addSkeleton(o);
1250
+ });
1251
+ this.animations.forEach((o) => {
1252
+ if (predicate && !predicate(o)) {
1253
+ return;
1254
+ }
1255
+ this.scene.addAnimation(o);
1256
+ });
1257
+ this.animationGroups.forEach((o) => {
1258
+ if (predicate && !predicate(o)) {
1259
+ return;
1260
+ }
1261
+ this.scene.addAnimationGroup(o);
1262
+ });
1263
+ this.multiMaterials.forEach((o) => {
1264
+ if (predicate && !predicate(o)) {
1265
+ return;
1266
+ }
1267
+ this.scene.addMultiMaterial(o);
1268
+ });
1269
+ this.materials.forEach((o) => {
1270
+ if (predicate && !predicate(o)) {
1271
+ return;
1272
+ }
1273
+ this.scene.addMaterial(o);
1274
+ });
1275
+ this.morphTargetManagers.forEach((o) => {
1276
+ if (predicate && !predicate(o)) {
1277
+ return;
1278
+ }
1279
+ this.scene.addMorphTargetManager(o);
1280
+ });
1281
+ this.geometries.forEach((o) => {
1282
+ if (predicate && !predicate(o)) {
1283
+ return;
1284
+ }
1285
+ this.scene.addGeometry(o);
1286
+ });
1287
+ this.transformNodes.forEach((o) => {
1288
+ if (predicate && !predicate(o)) {
1289
+ return;
1290
+ }
1291
+ this.scene.addTransformNode(o);
1292
+ addedNodes.push(o);
1293
+ });
1294
+ this.actionManagers.forEach((o) => {
1295
+ if (predicate && !predicate(o)) {
1296
+ return;
1297
+ }
1298
+ this.scene.addActionManager(o);
1299
+ });
1300
+ this.textures.forEach((o) => {
1301
+ if (predicate && !predicate(o)) {
1302
+ return;
1303
+ }
1304
+ this.scene.addTexture(o);
1305
+ });
1306
+ this.reflectionProbes.forEach((o) => {
1307
+ if (predicate && !predicate(o)) {
1308
+ return;
1309
+ }
1310
+ this.scene.addReflectionProbe(o);
1311
+ });
1312
+ for (const addedNode of addedNodes) {
1313
+ // If node was added to the scene, but parent is not in the scene, break the relationship
1314
+ if (addedNode.parent && this.scene.getNodes().indexOf(addedNode.parent) === -1) {
1315
+ // Use setParent to keep transform if possible
1316
+ if (addedNode.setParent) {
1317
+ addedNode.setParent(null);
1318
+ }
1319
+ else {
1320
+ addedNode.parent = null;
1321
+ }
1322
+ }
1323
+ }
1324
+ }
1325
+ /**
1326
+ * Removes all the assets in the container from the scene
1327
+ */
1328
+ removeAllFromScene() {
1329
+ if (!this._isValidHierarchy()) {
1330
+ Tools.Warn("SceneSerializer.removeAllFromScene: The Asset Container hierarchy is not valid.");
1331
+ }
1332
+ this._wasAddedToScene = false;
1333
+ this.removeFromScene(null);
1334
+ if (this.environmentTexture === this.scene.environmentTexture) {
1335
+ this.scene.environmentTexture = null;
1336
+ }
1337
+ for (const component of this.scene._serializableComponents) {
1338
+ component.removeFromContainer(this);
1339
+ }
1340
+ }
1341
+ /**
1342
+ * Removes assets in the container from the scene
1343
+ * @param predicate defines a predicate used to select which entity will be added (can be null)
1344
+ */
1345
+ removeFromScene(predicate = null) {
1346
+ this.cameras.forEach((o) => {
1347
+ if (predicate && !predicate(o)) {
1348
+ return;
1349
+ }
1350
+ this.scene.removeCamera(o);
1351
+ });
1352
+ this.lights.forEach((o) => {
1353
+ if (predicate && !predicate(o)) {
1354
+ return;
1355
+ }
1356
+ this.scene.removeLight(o);
1357
+ });
1358
+ this.meshes.forEach((o) => {
1359
+ if (predicate && !predicate(o)) {
1360
+ return;
1361
+ }
1362
+ this.scene.removeMesh(o, true);
1363
+ });
1364
+ this.skeletons.forEach((o) => {
1365
+ if (predicate && !predicate(o)) {
1366
+ return;
1367
+ }
1368
+ this.scene.removeSkeleton(o);
1369
+ });
1370
+ this.animations.forEach((o) => {
1371
+ if (predicate && !predicate(o)) {
1372
+ return;
1373
+ }
1374
+ this.scene.removeAnimation(o);
1375
+ });
1376
+ this.animationGroups.forEach((o) => {
1377
+ if (predicate && !predicate(o)) {
1378
+ return;
1379
+ }
1380
+ this.scene.removeAnimationGroup(o);
1381
+ });
1382
+ this.multiMaterials.forEach((o) => {
1383
+ if (predicate && !predicate(o)) {
1384
+ return;
1385
+ }
1386
+ this.scene.removeMultiMaterial(o);
1387
+ });
1388
+ this.materials.forEach((o) => {
1389
+ if (predicate && !predicate(o)) {
1390
+ return;
1391
+ }
1392
+ this.scene.removeMaterial(o);
1393
+ });
1394
+ this.morphTargetManagers.forEach((o) => {
1395
+ if (predicate && !predicate(o)) {
1396
+ return;
1397
+ }
1398
+ this.scene.removeMorphTargetManager(o);
1399
+ });
1400
+ this.geometries.forEach((o) => {
1401
+ if (predicate && !predicate(o)) {
1402
+ return;
1403
+ }
1404
+ this.scene.removeGeometry(o);
1405
+ });
1406
+ this.transformNodes.forEach((o) => {
1407
+ if (predicate && !predicate(o)) {
1408
+ return;
1409
+ }
1410
+ this.scene.removeTransformNode(o);
1411
+ });
1412
+ this.actionManagers.forEach((o) => {
1413
+ if (predicate && !predicate(o)) {
1414
+ return;
1415
+ }
1416
+ this.scene.removeActionManager(o);
1417
+ });
1418
+ this.textures.forEach((o) => {
1419
+ if (predicate && !predicate(o)) {
1420
+ return;
1421
+ }
1422
+ this.scene.removeTexture(o);
1423
+ });
1424
+ this.reflectionProbes.forEach((o) => {
1425
+ if (predicate && !predicate(o)) {
1426
+ return;
1427
+ }
1428
+ this.scene.removeReflectionProbe(o);
1429
+ });
1430
+ }
1431
+ /**
1432
+ * Disposes all the assets in the container
1433
+ */
1434
+ dispose() {
1435
+ this.cameras.slice(0).forEach((o) => {
1436
+ o.dispose();
1437
+ });
1438
+ this.cameras.length = 0;
1439
+ this.lights.slice(0).forEach((o) => {
1440
+ o.dispose();
1441
+ });
1442
+ this.lights.length = 0;
1443
+ this.meshes.slice(0).forEach((o) => {
1444
+ o.dispose();
1445
+ });
1446
+ this.meshes.length = 0;
1447
+ this.skeletons.slice(0).forEach((o) => {
1448
+ o.dispose();
1449
+ });
1450
+ this.skeletons.length = 0;
1451
+ this.animationGroups.slice(0).forEach((o) => {
1452
+ o.dispose();
1453
+ });
1454
+ this.animationGroups.length = 0;
1455
+ this.multiMaterials.slice(0).forEach((o) => {
1456
+ o.dispose();
1457
+ });
1458
+ this.multiMaterials.length = 0;
1459
+ this.materials.slice(0).forEach((o) => {
1460
+ o.dispose();
1461
+ });
1462
+ this.materials.length = 0;
1463
+ this.geometries.slice(0).forEach((o) => {
1464
+ o.dispose();
1465
+ });
1466
+ this.geometries.length = 0;
1467
+ this.transformNodes.slice(0).forEach((o) => {
1468
+ o.dispose();
1469
+ });
1470
+ this.transformNodes.length = 0;
1471
+ this.actionManagers.slice(0).forEach((o) => {
1472
+ o.dispose();
1473
+ });
1474
+ this.actionManagers.length = 0;
1475
+ this.textures.slice(0).forEach((o) => {
1476
+ o.dispose();
1477
+ });
1478
+ this.textures.length = 0;
1479
+ this.reflectionProbes.slice(0).forEach((o) => {
1480
+ o.dispose();
1481
+ });
1482
+ this.reflectionProbes.length = 0;
1483
+ this.morphTargetManagers.slice(0).forEach((o) => {
1484
+ o.dispose();
1485
+ });
1486
+ this.morphTargetManagers.length = 0;
1487
+ if (this.environmentTexture) {
1488
+ this.environmentTexture.dispose();
1489
+ this.environmentTexture = null;
1490
+ }
1491
+ for (const component of this.scene._serializableComponents) {
1492
+ component.removeFromContainer(this, true);
1493
+ }
1494
+ if (this._onContextRestoredObserver) {
1495
+ this.scene.getEngine().onContextRestoredObservable.remove(this._onContextRestoredObserver);
1496
+ this._onContextRestoredObserver = null;
1497
+ }
1498
+ }
1499
+ _moveAssets(sourceAssets, targetAssets, keepAssets) {
1500
+ if (!sourceAssets || !targetAssets) {
1501
+ return;
1502
+ }
1503
+ for (const asset of sourceAssets) {
1504
+ let move = true;
1505
+ if (keepAssets) {
1506
+ for (const keepAsset of keepAssets) {
1507
+ if (asset === keepAsset) {
1508
+ move = false;
1509
+ break;
1510
+ }
1511
+ }
1512
+ }
1513
+ if (move) {
1514
+ targetAssets.push(asset);
1515
+ asset._parentContainer = this;
1516
+ }
1517
+ }
1518
+ }
1519
+ /**
1520
+ * Removes all the assets contained in the scene and adds them to the container.
1521
+ * @param keepAssets Set of assets to keep in the scene. (default: empty)
1522
+ */
1523
+ moveAllFromScene(keepAssets) {
1524
+ this._wasAddedToScene = false;
1525
+ if (keepAssets === undefined) {
1526
+ keepAssets = new KeepAssets();
1527
+ }
1528
+ for (const key in this) {
1529
+ if (Object.prototype.hasOwnProperty.call(this, key)) {
1530
+ this[key] = this[key] || (key === "_environmentTexture" ? null : []);
1531
+ this._moveAssets(this.scene[key], this[key], keepAssets[key]);
1532
+ }
1533
+ }
1534
+ this.environmentTexture = this.scene.environmentTexture;
1535
+ this.removeAllFromScene();
1536
+ }
1537
+ /**
1538
+ * Adds all meshes in the asset container to a root mesh that can be used to position all the contained meshes. The root mesh is then added to the front of the meshes in the assetContainer.
1539
+ * @returns the root mesh
1540
+ */
1541
+ createRootMesh() {
1542
+ const rootMesh = new Mesh("assetContainerRootMesh", this.scene);
1543
+ this.meshes.forEach((m) => {
1544
+ if (!m.parent) {
1545
+ rootMesh.addChild(m);
1546
+ }
1547
+ });
1548
+ this.meshes.unshift(rootMesh);
1549
+ return rootMesh;
1550
+ }
1551
+ /**
1552
+ * Merge animations (direct and animation groups) from this asset container into a scene
1553
+ * @param scene is the instance of BABYLON.Scene to append to (default: last created scene)
1554
+ * @param animatables set of animatables to retarget to a node from the scene
1555
+ * @param targetConverter defines a function used to convert animation targets from the asset container to the scene (default: search node by name)
1556
+ * @returns an array of the new AnimationGroup added to the scene (empty array if none)
1557
+ */
1558
+ mergeAnimationsTo(scene = EngineStore.LastCreatedScene, animatables, targetConverter = null) {
1559
+ if (!scene) {
1560
+ Logger.Error("No scene available to merge animations to");
1561
+ return [];
1562
+ }
1563
+ const _targetConverter = targetConverter
1564
+ ? targetConverter
1565
+ : (target) => {
1566
+ let node = null;
1567
+ const targetProperty = target.animations.length ? target.animations[0].targetProperty : "";
1568
+ /*
1569
+ BabylonJS adds special naming to targets that are children of nodes.
1570
+ This name attempts to remove that special naming to get the parent nodes name in case the target
1571
+ can't be found in the node tree
1572
+
1573
+ Ex: Torso_primitive0 likely points to a Mesh primitive. We take away primitive0 and are left with "Torso" which is the name
1574
+ of the primitive's parent.
1575
+ */
1576
+ const name = target.name.split(".").join("").split("_primitive")[0];
1577
+ switch (targetProperty) {
1578
+ case "position":
1579
+ case "rotationQuaternion":
1580
+ node = scene.getTransformNodeByName(target.name) || scene.getTransformNodeByName(name);
1581
+ break;
1582
+ case "influence":
1583
+ node = scene.getMorphTargetByName(target.name) || scene.getMorphTargetByName(name);
1584
+ break;
1585
+ default:
1586
+ node = scene.getNodeByName(target.name) || scene.getNodeByName(name);
1587
+ }
1588
+ return node;
1589
+ };
1590
+ // Copy new node animations
1591
+ const nodesInAC = this.getNodes();
1592
+ nodesInAC.forEach((nodeInAC) => {
1593
+ const nodeInScene = _targetConverter(nodeInAC);
1594
+ if (nodeInScene !== null) {
1595
+ // Remove old animations with same target property as a new one
1596
+ for (const animationInAC of nodeInAC.animations) {
1597
+ // Doing treatment on an array for safety measure
1598
+ const animationsWithSameProperty = nodeInScene.animations.filter((animationInScene) => {
1599
+ return animationInScene.targetProperty === animationInAC.targetProperty;
1600
+ });
1601
+ for (const animationWithSameProperty of animationsWithSameProperty) {
1602
+ const index = nodeInScene.animations.indexOf(animationWithSameProperty, 0);
1603
+ if (index > -1) {
1604
+ nodeInScene.animations.splice(index, 1);
1605
+ }
1606
+ }
1607
+ }
1608
+ // Append new animations
1609
+ nodeInScene.animations = nodeInScene.animations.concat(nodeInAC.animations);
1610
+ }
1611
+ });
1612
+ const newAnimationGroups = [];
1613
+ // Copy new animation groups
1614
+ this.animationGroups.slice().forEach((animationGroupInAC) => {
1615
+ // Clone the animation group and all its animatables
1616
+ newAnimationGroups.push(animationGroupInAC.clone(animationGroupInAC.name, _targetConverter));
1617
+ // Remove animatables related to the asset container
1618
+ animationGroupInAC.animatables.forEach((animatable) => {
1619
+ animatable.stop();
1620
+ });
1621
+ });
1622
+ // Retarget animatables
1623
+ animatables.forEach((animatable) => {
1624
+ const target = _targetConverter(animatable.target);
1625
+ if (target) {
1626
+ // Clone the animatable and retarget it
1627
+ scene.beginAnimation(target, animatable.fromFrame, animatable.toFrame, animatable.loopAnimation, animatable.speedRatio, animatable.onAnimationEnd ? animatable.onAnimationEnd : undefined, undefined, true, undefined, animatable.onAnimationLoop ? animatable.onAnimationLoop : undefined);
1628
+ // Stop animation for the target in the asset container
1629
+ scene.stopAnimation(animatable.target);
1630
+ }
1631
+ });
1632
+ return newAnimationGroups;
1633
+ }
1634
+ /**
1635
+ * @since 6.15.0
1636
+ * This method checks for any node that has no parent
1637
+ * and is not in the rootNodes array, and adds the node
1638
+ * there, if so.
1639
+ */
1640
+ populateRootNodes() {
1641
+ this.rootNodes.length = 0;
1642
+ this.meshes.forEach((m) => {
1643
+ if (!m.parent && this.rootNodes.indexOf(m) === -1) {
1644
+ this.rootNodes.push(m);
1645
+ }
1646
+ });
1647
+ this.transformNodes.forEach((t) => {
1648
+ if (!t.parent && this.rootNodes.indexOf(t) === -1) {
1649
+ this.rootNodes.push(t);
1650
+ }
1651
+ });
1652
+ this.lights.forEach((l) => {
1653
+ if (!l.parent && this.rootNodes.indexOf(l) === -1) {
1654
+ this.rootNodes.push(l);
1655
+ }
1656
+ });
1657
+ this.cameras.forEach((c) => {
1658
+ if (!c.parent && this.rootNodes.indexOf(c) === -1) {
1659
+ this.rootNodes.push(c);
1660
+ }
1661
+ });
1662
+ }
1663
+ /**
1664
+ * @since 6.26.0
1665
+ * Given a root asset, this method will traverse its hierarchy and add it, its children and any materials/skeletons/animation groups to the container.
1666
+ * @param root root node
1667
+ */
1668
+ addAllAssetsToContainer(root) {
1669
+ if (!root) {
1670
+ return;
1671
+ }
1672
+ const nodesToVisit = [];
1673
+ const visitedNodes = new Set();
1674
+ nodesToVisit.push(root);
1675
+ while (nodesToVisit.length > 0) {
1676
+ const nodeToVisit = nodesToVisit.pop();
1677
+ if (nodeToVisit instanceof Mesh) {
1678
+ if (nodeToVisit.geometry && this.geometries.indexOf(nodeToVisit.geometry) === -1) {
1679
+ this.geometries.push(nodeToVisit.geometry);
1680
+ }
1681
+ this.meshes.push(nodeToVisit);
1682
+ }
1683
+ else if (nodeToVisit instanceof TransformNode) {
1684
+ this.transformNodes.push(nodeToVisit);
1685
+ }
1686
+ else if (nodeToVisit instanceof Light) {
1687
+ this.lights.push(nodeToVisit);
1688
+ }
1689
+ else if (nodeToVisit instanceof Camera) {
1690
+ this.cameras.push(nodeToVisit);
1691
+ }
1692
+ if (nodeToVisit instanceof AbstractMesh) {
1693
+ if (nodeToVisit.material && this.materials.indexOf(nodeToVisit.material) === -1) {
1694
+ this.materials.push(nodeToVisit.material);
1695
+ for (const texture of nodeToVisit.material.getActiveTextures()) {
1696
+ if (this.textures.indexOf(texture) === -1) {
1697
+ this.textures.push(texture);
1698
+ }
1699
+ }
1700
+ }
1701
+ if (nodeToVisit.skeleton && this.skeletons.indexOf(nodeToVisit.skeleton) === -1) {
1702
+ this.skeletons.push(nodeToVisit.skeleton);
1703
+ }
1704
+ if (nodeToVisit.morphTargetManager && this.morphTargetManagers.indexOf(nodeToVisit.morphTargetManager) === -1) {
1705
+ this.morphTargetManagers.push(nodeToVisit.morphTargetManager);
1706
+ }
1707
+ }
1708
+ for (const child of nodeToVisit.getChildren()) {
1709
+ if (!visitedNodes.has(child)) {
1710
+ nodesToVisit.push(child);
1711
+ }
1712
+ }
1713
+ visitedNodes.add(nodeToVisit);
1714
+ }
1715
+ this.populateRootNodes();
1716
+ }
1717
+ /**
1718
+ * Get from a list of objects by tags
1719
+ * @param list the list of objects to use
1720
+ * @param tagsQuery the query to use
1721
+ * @param filter a predicate to filter for tags
1722
+ * @returns
1723
+ */
1724
+ _getByTags(list, tagsQuery, filter) {
1725
+ if (tagsQuery === undefined) {
1726
+ // returns the complete list (could be done with Tags.MatchesQuery but no need to have a for-loop here)
1727
+ return list;
1728
+ }
1729
+ const listByTags = [];
1730
+ for (const i in list) {
1731
+ const item = list[i];
1732
+ if (Tags && Tags.MatchesQuery(item, tagsQuery) && (!filter || filter(item))) {
1733
+ listByTags.push(item);
1734
+ }
1735
+ }
1736
+ return listByTags;
1737
+ }
1738
+ /**
1739
+ * Get a list of meshes by tags
1740
+ * @param tagsQuery defines the tags query to use
1741
+ * @param filter defines a predicate used to filter results
1742
+ * @returns an array of Mesh
1743
+ */
1744
+ getMeshesByTags(tagsQuery, filter) {
1745
+ return this._getByTags(this.meshes, tagsQuery, filter);
1746
+ }
1747
+ /**
1748
+ * Get a list of cameras by tags
1749
+ * @param tagsQuery defines the tags query to use
1750
+ * @param filter defines a predicate used to filter results
1751
+ * @returns an array of Camera
1752
+ */
1753
+ getCamerasByTags(tagsQuery, filter) {
1754
+ return this._getByTags(this.cameras, tagsQuery, filter);
1755
+ }
1756
+ /**
1757
+ * Get a list of lights by tags
1758
+ * @param tagsQuery defines the tags query to use
1759
+ * @param filter defines a predicate used to filter results
1760
+ * @returns an array of Light
1761
+ */
1762
+ getLightsByTags(tagsQuery, filter) {
1763
+ return this._getByTags(this.lights, tagsQuery, filter);
1764
+ }
1765
+ /**
1766
+ * Get a list of materials by tags
1767
+ * @param tagsQuery defines the tags query to use
1768
+ * @param filter defines a predicate used to filter results
1769
+ * @returns an array of Material
1770
+ */
1771
+ getMaterialsByTags(tagsQuery, filter) {
1772
+ return this._getByTags(this.materials, tagsQuery, filter).concat(this._getByTags(this.multiMaterials, tagsQuery, filter));
1773
+ }
1774
+ /**
1775
+ * Get a list of transform nodes by tags
1776
+ * @param tagsQuery defines the tags query to use
1777
+ * @param filter defines a predicate used to filter results
1778
+ * @returns an array of TransformNode
1779
+ */
1780
+ getTransformNodesByTags(tagsQuery, filter) {
1781
+ return this._getByTags(this.transformNodes, tagsQuery, filter);
1782
+ }
1783
+ }
1784
+
1785
+ export { AssetContainer as A };
1786
+ //# sourceMappingURL=assetContainer-Cx2Wvxkg.esm.js.map