@onerjs/core 8.41.5 → 8.41.7

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 (579) hide show
  1. package/Animations/animation.d.ts +6 -2
  2. package/Animations/animation.js +28 -4
  3. package/Animations/animation.js.map +1 -1
  4. package/Animations/animationGroup.d.ts +2 -1
  5. package/Animations/animationGroup.js +3 -2
  6. package/Animations/animationGroup.js.map +1 -1
  7. package/Animations/animatorAvatar.d.ts +161 -0
  8. package/Animations/animatorAvatar.js +573 -0
  9. package/Animations/animatorAvatar.js.map +1 -0
  10. package/Animations/index.d.ts +1 -0
  11. package/Animations/index.js +1 -0
  12. package/Animations/index.js.map +1 -1
  13. package/AudioV2/webAudio/webAudioSoundSource.d.ts +2 -2
  14. package/AudioV2/webAudio/webAudioSoundSource.js +12 -2
  15. package/AudioV2/webAudio/webAudioSoundSource.js.map +1 -1
  16. package/Bones/index.d.ts +1 -0
  17. package/Bones/index.js +1 -0
  18. package/Bones/index.js.map +1 -1
  19. package/Bones/skeleton.d.ts +13 -0
  20. package/Bones/skeleton.functions.d.ts +26 -0
  21. package/Bones/skeleton.functions.js +91 -0
  22. package/Bones/skeleton.functions.js.map +1 -0
  23. package/Bones/skeleton.js +26 -0
  24. package/Bones/skeleton.js.map +1 -1
  25. package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +16 -0
  26. package/Cameras/Inputs/geospatialCameraPointersInput.js +19 -3
  27. package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
  28. package/Cameras/Limits/geospatialLimits.d.ts +0 -6
  29. package/Cameras/Limits/geospatialLimits.js +0 -6
  30. package/Cameras/Limits/geospatialLimits.js.map +1 -1
  31. package/Cameras/geospatialCamera.d.ts +5 -0
  32. package/Cameras/geospatialCamera.js +54 -25
  33. package/Cameras/geospatialCamera.js.map +1 -1
  34. package/Cameras/geospatialCameraMovement.d.ts +8 -1
  35. package/Cameras/geospatialCameraMovement.js +29 -8
  36. package/Cameras/geospatialCameraMovement.js.map +1 -1
  37. package/Collisions/gpuPicker.d.ts +11 -0
  38. package/Collisions/gpuPicker.js +148 -19
  39. package/Collisions/gpuPicker.js.map +1 -1
  40. package/Debug/skeletonViewer.d.ts +4 -8
  41. package/Debug/skeletonViewer.js +13 -22
  42. package/Debug/skeletonViewer.js.map +1 -1
  43. package/Engines/Extensions/engine.multiview.d.ts +2 -0
  44. package/Engines/Extensions/engine.multiview.js +7 -3
  45. package/Engines/Extensions/engine.multiview.js.map +1 -1
  46. package/Engines/abstractEngine.d.ts +2 -2
  47. package/Engines/abstractEngine.js +2 -2
  48. package/Engines/abstractEngine.js.map +1 -1
  49. package/Engines/constants.d.ts +4 -0
  50. package/Engines/constants.js +4 -0
  51. package/Engines/constants.js.map +1 -1
  52. package/Engines/webgpuEngine.d.ts +1 -4
  53. package/Engines/webgpuEngine.js +8 -6
  54. package/Engines/webgpuEngine.js.map +1 -1
  55. package/FrameGraph/frameGraphContext.js +1 -1
  56. package/FrameGraph/frameGraphContext.js.map +1 -1
  57. package/FrameGraph/frameGraphRenderContext.js +2 -2
  58. package/FrameGraph/frameGraphRenderContext.js.map +1 -1
  59. package/Instrumentation/engineInstrumentation.js +2 -1
  60. package/Instrumentation/engineInstrumentation.js.map +1 -1
  61. package/Layers/effectLayer.js +1 -3
  62. package/Layers/effectLayer.js.map +1 -1
  63. package/Lights/Shadows/cascadedShadowGenerator.js +2 -2
  64. package/Lights/Shadows/cascadedShadowGenerator.js.map +1 -1
  65. package/Lights/Shadows/shadowGenerator.js +3 -4
  66. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  67. package/Lights/lightingVolume.js +1 -1
  68. package/Lights/lightingVolume.js.map +1 -1
  69. package/Materials/Background/backgroundMaterial.js +37 -2
  70. package/Materials/Background/backgroundMaterial.js.map +1 -1
  71. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.d.ts +109 -0
  72. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js +210 -0
  73. package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.js.map +1 -0
  74. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +1 -0
  75. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +71 -15
  76. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -1
  77. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.d.ts +86 -0
  78. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js +161 -0
  79. package/Materials/GaussianSplatting/gaussianSplattingSolidColorMaterialPlugin.js.map +1 -0
  80. package/Materials/GreasedLine/greasedLinePluginMaterial.js +0 -6
  81. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  82. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js +0 -1
  83. package/Materials/GreasedLine/greasedLinePluginMaterialShadersGLSL.js.map +1 -1
  84. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js +0 -1
  85. package/Materials/GreasedLine/greasedLinePluginMaterialShadersWGSL.js.map +1 -1
  86. package/Materials/Node/Blocks/Dual/clipPlanesBlock.d.ts +14 -0
  87. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js +14 -0
  88. package/Materials/Node/Blocks/Dual/clipPlanesBlock.js.map +1 -1
  89. package/Materials/Node/Blocks/Dual/currentScreenBlock.d.ts +20 -1
  90. package/Materials/Node/Blocks/Dual/currentScreenBlock.js +20 -1
  91. package/Materials/Node/Blocks/Dual/currentScreenBlock.js.map +1 -1
  92. package/Materials/Node/Blocks/Dual/depthSourceBlock.d.ts +13 -0
  93. package/Materials/Node/Blocks/Dual/depthSourceBlock.js +13 -0
  94. package/Materials/Node/Blocks/Dual/depthSourceBlock.js.map +1 -1
  95. package/Materials/Node/Blocks/Dual/fogBlock.d.ts +21 -0
  96. package/Materials/Node/Blocks/Dual/fogBlock.js +21 -0
  97. package/Materials/Node/Blocks/Dual/fogBlock.js.map +1 -1
  98. package/Materials/Node/Blocks/Dual/imageSourceBlock.d.ts +21 -0
  99. package/Materials/Node/Blocks/Dual/imageSourceBlock.js +21 -0
  100. package/Materials/Node/Blocks/Dual/imageSourceBlock.js.map +1 -1
  101. package/Materials/Node/Blocks/Dual/lightBlock.d.ts +38 -0
  102. package/Materials/Node/Blocks/Dual/lightBlock.js +38 -0
  103. package/Materials/Node/Blocks/Dual/lightBlock.js.map +1 -1
  104. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +29 -0
  105. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +29 -0
  106. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  107. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.d.ts +5 -0
  108. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js +5 -0
  109. package/Materials/Node/Blocks/Dual/reflectionTextureBlock.js.map +1 -1
  110. package/Materials/Node/Blocks/Dual/sceneDepthBlock.d.ts +16 -0
  111. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js +16 -0
  112. package/Materials/Node/Blocks/Dual/sceneDepthBlock.js.map +1 -1
  113. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +16 -0
  114. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +16 -0
  115. package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
  116. package/Materials/Node/Blocks/Dual/textureBlock.d.ts +34 -0
  117. package/Materials/Node/Blocks/Dual/textureBlock.js +34 -0
  118. package/Materials/Node/Blocks/Dual/textureBlock.js.map +1 -1
  119. package/Materials/Node/Blocks/Fragment/TBNBlock.d.ts +17 -0
  120. package/Materials/Node/Blocks/Fragment/TBNBlock.js +17 -2
  121. package/Materials/Node/Blocks/Fragment/TBNBlock.js.map +1 -1
  122. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.d.ts +7 -0
  123. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js +7 -0
  124. package/Materials/Node/Blocks/Fragment/ambientOcclusionBlock.js.map +1 -1
  125. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +21 -0
  126. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +21 -0
  127. package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
  128. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.d.ts +10 -0
  129. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js +10 -0
  130. package/Materials/Node/Blocks/Fragment/heightToNormalBlock.js.map +1 -1
  131. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.d.ts +28 -0
  132. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js +28 -0
  133. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.js.map +1 -1
  134. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.d.ts +30 -0
  135. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js +30 -1
  136. package/Materials/Node/Blocks/Fragment/perturbNormalBlock.js.map +1 -1
  137. package/Materials/Node/Blocks/Fragment/screenSizeBlock.d.ts +4 -0
  138. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +4 -0
  139. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  140. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.d.ts +5 -0
  141. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js +5 -0
  142. package/Materials/Node/Blocks/Fragment/screenSpaceBlock.js.map +1 -1
  143. package/Materials/Node/Blocks/Fragment/twirlBlock.d.ts +3 -0
  144. package/Materials/Node/Blocks/Fragment/twirlBlock.js +3 -0
  145. package/Materials/Node/Blocks/Fragment/twirlBlock.js.map +1 -1
  146. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.d.ts +6 -0
  147. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js +6 -0
  148. package/Materials/Node/Blocks/GaussianSplatting/splatReaderBlock.js.map +1 -1
  149. package/Materials/Node/Blocks/Input/inputBlock.d.ts +16 -0
  150. package/Materials/Node/Blocks/Input/inputBlock.js +16 -1
  151. package/Materials/Node/Blocks/Input/inputBlock.js.map +1 -1
  152. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +5 -0
  153. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +5 -0
  154. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  155. package/Materials/Node/Blocks/PBR/anisotropyBlock.d.ts +10 -0
  156. package/Materials/Node/Blocks/PBR/anisotropyBlock.js +10 -1
  157. package/Materials/Node/Blocks/PBR/anisotropyBlock.js.map +1 -1
  158. package/Materials/Node/Blocks/PBR/clearCoatBlock.d.ts +23 -0
  159. package/Materials/Node/Blocks/PBR/clearCoatBlock.js +23 -1
  160. package/Materials/Node/Blocks/PBR/clearCoatBlock.js.map +1 -1
  161. package/Materials/Node/Blocks/PBR/iridescenceBlock.d.ts +17 -0
  162. package/Materials/Node/Blocks/PBR/iridescenceBlock.js +17 -0
  163. package/Materials/Node/Blocks/PBR/iridescenceBlock.js.map +1 -1
  164. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.d.ts +41 -0
  165. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js +41 -0
  166. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.js.map +1 -1
  167. package/Materials/Node/Blocks/PBR/reflectionBlock.d.ts +21 -0
  168. package/Materials/Node/Blocks/PBR/reflectionBlock.js +21 -0
  169. package/Materials/Node/Blocks/PBR/reflectionBlock.js.map +1 -1
  170. package/Materials/Node/Blocks/PBR/refractionBlock.d.ts +29 -0
  171. package/Materials/Node/Blocks/PBR/refractionBlock.js +29 -0
  172. package/Materials/Node/Blocks/PBR/refractionBlock.js.map +1 -1
  173. package/Materials/Node/Blocks/PBR/sheenBlock.d.ts +14 -0
  174. package/Materials/Node/Blocks/PBR/sheenBlock.js +14 -0
  175. package/Materials/Node/Blocks/PBR/sheenBlock.js.map +1 -1
  176. package/Materials/Node/Blocks/PBR/subSurfaceBlock.d.ts +7 -0
  177. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js +7 -0
  178. package/Materials/Node/Blocks/PBR/subSurfaceBlock.js.map +1 -1
  179. package/Materials/Node/Blocks/Particle/particleTextureBlock.d.ts +23 -0
  180. package/Materials/Node/Blocks/Particle/particleTextureBlock.js +23 -0
  181. package/Materials/Node/Blocks/Particle/particleTextureBlock.js.map +1 -1
  182. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +6 -0
  183. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +6 -0
  184. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  185. package/Materials/Node/Blocks/Teleport/teleportOutBlock.d.ts +17 -0
  186. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js +17 -0
  187. package/Materials/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  188. package/Materials/Node/Blocks/Vertex/bonesBlock.d.ts +22 -0
  189. package/Materials/Node/Blocks/Vertex/bonesBlock.js +22 -0
  190. package/Materials/Node/Blocks/Vertex/bonesBlock.js.map +1 -1
  191. package/Materials/Node/Blocks/Vertex/instancesBlock.d.ts +13 -0
  192. package/Materials/Node/Blocks/Vertex/instancesBlock.js +13 -0
  193. package/Materials/Node/Blocks/Vertex/instancesBlock.js.map +1 -1
  194. package/Materials/Node/Blocks/Vertex/lightInformationBlock.d.ts +20 -0
  195. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js +20 -0
  196. package/Materials/Node/Blocks/Vertex/lightInformationBlock.js.map +1 -1
  197. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.d.ts +27 -0
  198. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js +27 -0
  199. package/Materials/Node/Blocks/Vertex/morphTargetsBlock.js.map +1 -1
  200. package/Materials/Node/Blocks/clampBlock.d.ts +10 -0
  201. package/Materials/Node/Blocks/clampBlock.js +10 -0
  202. package/Materials/Node/Blocks/clampBlock.js.map +1 -1
  203. package/Materials/Node/Blocks/cloudBlock.d.ts +10 -0
  204. package/Materials/Node/Blocks/cloudBlock.js +10 -0
  205. package/Materials/Node/Blocks/cloudBlock.js.map +1 -1
  206. package/Materials/Node/Blocks/colorMergerBlock.d.ts +10 -0
  207. package/Materials/Node/Blocks/colorMergerBlock.js +10 -0
  208. package/Materials/Node/Blocks/colorMergerBlock.js.map +1 -1
  209. package/Materials/Node/Blocks/conditionalBlock.d.ts +14 -0
  210. package/Materials/Node/Blocks/conditionalBlock.js +14 -0
  211. package/Materials/Node/Blocks/conditionalBlock.js.map +1 -1
  212. package/Materials/Node/Blocks/curveBlock.d.ts +10 -0
  213. package/Materials/Node/Blocks/curveBlock.js +10 -0
  214. package/Materials/Node/Blocks/curveBlock.js.map +1 -1
  215. package/Materials/Node/Blocks/customBlock.d.ts +10 -0
  216. package/Materials/Node/Blocks/customBlock.js +10 -0
  217. package/Materials/Node/Blocks/customBlock.js.map +1 -1
  218. package/Materials/Node/Blocks/debugBlock.d.ts +10 -0
  219. package/Materials/Node/Blocks/debugBlock.js +10 -0
  220. package/Materials/Node/Blocks/debugBlock.js.map +1 -1
  221. package/Materials/Node/Blocks/fresnelBlock.d.ts +4 -0
  222. package/Materials/Node/Blocks/fresnelBlock.js +4 -0
  223. package/Materials/Node/Blocks/fresnelBlock.js.map +1 -1
  224. package/Materials/Node/Blocks/gradientBlock.d.ts +10 -0
  225. package/Materials/Node/Blocks/gradientBlock.js +10 -0
  226. package/Materials/Node/Blocks/gradientBlock.js.map +1 -1
  227. package/Materials/Node/Blocks/loopBlock.d.ts +10 -0
  228. package/Materials/Node/Blocks/loopBlock.js +10 -0
  229. package/Materials/Node/Blocks/loopBlock.js.map +1 -1
  230. package/Materials/Node/Blocks/matrixBuilderBlock.d.ts +1 -0
  231. package/Materials/Node/Blocks/matrixBuilderBlock.js +1 -0
  232. package/Materials/Node/Blocks/matrixBuilderBlock.js.map +1 -1
  233. package/Materials/Node/Blocks/meshAttributeExistsBlock.d.ts +10 -0
  234. package/Materials/Node/Blocks/meshAttributeExistsBlock.js +10 -0
  235. package/Materials/Node/Blocks/meshAttributeExistsBlock.js.map +1 -1
  236. package/Materials/Node/Blocks/pannerBlock.d.ts +5 -0
  237. package/Materials/Node/Blocks/pannerBlock.js +5 -0
  238. package/Materials/Node/Blocks/pannerBlock.js.map +1 -1
  239. package/Materials/Node/Blocks/remapBlock.d.ts +10 -0
  240. package/Materials/Node/Blocks/remapBlock.js +10 -0
  241. package/Materials/Node/Blocks/remapBlock.js.map +1 -1
  242. package/Materials/Node/Blocks/rotate2dBlock.d.ts +1 -0
  243. package/Materials/Node/Blocks/rotate2dBlock.js +1 -0
  244. package/Materials/Node/Blocks/rotate2dBlock.js.map +1 -1
  245. package/Materials/Node/Blocks/transformBlock.d.ts +10 -0
  246. package/Materials/Node/Blocks/transformBlock.js +10 -0
  247. package/Materials/Node/Blocks/transformBlock.js.map +1 -1
  248. package/Materials/Node/Blocks/triPlanarBlock.d.ts +22 -0
  249. package/Materials/Node/Blocks/triPlanarBlock.js +22 -0
  250. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  251. package/Materials/Node/Blocks/trigonometryBlock.d.ts +10 -0
  252. package/Materials/Node/Blocks/trigonometryBlock.js +10 -0
  253. package/Materials/Node/Blocks/trigonometryBlock.js.map +1 -1
  254. package/Materials/Node/Blocks/vectorMergerBlock.d.ts +10 -0
  255. package/Materials/Node/Blocks/vectorMergerBlock.js +10 -0
  256. package/Materials/Node/Blocks/vectorMergerBlock.js.map +1 -1
  257. package/Materials/Node/Blocks/viewDirectionBlock.d.ts +5 -0
  258. package/Materials/Node/Blocks/viewDirectionBlock.js +5 -0
  259. package/Materials/Node/Blocks/viewDirectionBlock.js.map +1 -1
  260. package/Materials/Node/Blocks/waveBlock.d.ts +10 -0
  261. package/Materials/Node/Blocks/waveBlock.js +10 -0
  262. package/Materials/Node/Blocks/waveBlock.js.map +1 -1
  263. package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +1 -0
  264. package/Materials/Node/Blocks/worleyNoise3DBlock.js +1 -0
  265. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  266. package/Materials/Node/nodeMaterial.d.ts +13 -0
  267. package/Materials/Node/nodeMaterial.js +14 -2
  268. package/Materials/Node/nodeMaterial.js.map +1 -1
  269. package/Materials/Node/nodeMaterialBlock.d.ts +0 -3
  270. package/Materials/Node/nodeMaterialBlock.js +1 -6
  271. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  272. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -2
  273. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  274. package/Materials/Textures/Procedurals/proceduralTexture.js +1 -1
  275. package/Materials/Textures/Procedurals/proceduralTexture.js.map +1 -1
  276. package/Materials/Textures/mirrorTexture.js +1 -1
  277. package/Materials/Textures/mirrorTexture.js.map +1 -1
  278. package/Materials/index.d.ts +2 -0
  279. package/Materials/index.js +2 -0
  280. package/Materials/index.js.map +1 -1
  281. package/Maths/math.constants.d.ts +2 -1
  282. package/Maths/math.constants.js +3 -2
  283. package/Maths/math.constants.js.map +1 -1
  284. package/Meshes/Builders/capsuleBuilder.js +0 -3
  285. package/Meshes/Builders/capsuleBuilder.js.map +1 -1
  286. package/Meshes/Builders/cylinderBuilder.d.ts +1 -1
  287. package/Meshes/Builders/cylinderBuilder.js +1 -2
  288. package/Meshes/Builders/cylinderBuilder.js.map +1 -1
  289. package/Meshes/Builders/decalBuilder.js +2 -0
  290. package/Meshes/Builders/decalBuilder.js.map +1 -1
  291. package/Meshes/Builders/discBuilder.js +0 -1
  292. package/Meshes/Builders/discBuilder.js.map +1 -1
  293. package/Meshes/Builders/groundBuilder.d.ts +50 -54
  294. package/Meshes/Builders/groundBuilder.js +50 -54
  295. package/Meshes/Builders/groundBuilder.js.map +1 -1
  296. package/Meshes/Builders/tiledBoxBuilder.d.ts +0 -26
  297. package/Meshes/Builders/tiledBoxBuilder.js +0 -26
  298. package/Meshes/Builders/tiledBoxBuilder.js.map +1 -1
  299. package/Meshes/Builders/tiledPlaneBuilder.d.ts +0 -25
  300. package/Meshes/Builders/tiledPlaneBuilder.js +0 -25
  301. package/Meshes/Builders/tiledPlaneBuilder.js.map +1 -1
  302. package/Meshes/Builders/torusBuilder.d.ts +0 -13
  303. package/Meshes/Builders/torusBuilder.js +0 -13
  304. package/Meshes/Builders/torusBuilder.js.map +1 -1
  305. package/Meshes/Builders/torusKnotBuilder.d.ts +0 -19
  306. package/Meshes/Builders/torusKnotBuilder.js +0 -19
  307. package/Meshes/Builders/torusKnotBuilder.js.map +1 -1
  308. package/Meshes/Compression/dracoCompressionWorker.js.map +1 -1
  309. package/Meshes/Compression/dracoDecoder.js.map +1 -1
  310. package/Meshes/Compression/dracoDecoder.types.d.ts +11 -0
  311. package/Meshes/Compression/dracoDecoder.types.js.map +1 -1
  312. package/Meshes/Compression/dracoEncoder.js.map +1 -1
  313. package/Meshes/Compression/meshoptCompression.js +0 -2
  314. package/Meshes/Compression/meshoptCompression.js.map +1 -1
  315. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +17 -1
  316. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -1
  317. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +0 -8
  318. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  319. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.d.ts +1 -0
  320. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js +1 -0
  321. package/Meshes/Node/Blocks/Instances/instantiateBaseBlock.js.map +1 -1
  322. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.d.ts +1 -0
  323. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js +1 -0
  324. package/Meshes/Node/Blocks/Instances/instantiateOnFacesBlock.js.map +1 -1
  325. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.d.ts +1 -0
  326. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js +1 -0
  327. package/Meshes/Node/Blocks/Instances/instantiateOnVerticesBlock.js.map +1 -1
  328. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.d.ts +1 -0
  329. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js +1 -0
  330. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.js.map +1 -1
  331. package/Meshes/Node/Blocks/Matrices/scalingBlock.d.ts +1 -0
  332. package/Meshes/Node/Blocks/Matrices/scalingBlock.js +1 -0
  333. package/Meshes/Node/Blocks/Matrices/scalingBlock.js.map +1 -1
  334. package/Meshes/Node/Blocks/Matrices/translationBlock.d.ts +1 -0
  335. package/Meshes/Node/Blocks/Matrices/translationBlock.js +1 -0
  336. package/Meshes/Node/Blocks/Matrices/translationBlock.js.map +1 -1
  337. package/Meshes/Node/Blocks/Set/aggregatorBlock.d.ts +1 -0
  338. package/Meshes/Node/Blocks/Set/aggregatorBlock.js +1 -0
  339. package/Meshes/Node/Blocks/Set/aggregatorBlock.js.map +1 -1
  340. package/Meshes/Node/Blocks/Set/latticeBlock.d.ts +1 -0
  341. package/Meshes/Node/Blocks/Set/latticeBlock.js +1 -0
  342. package/Meshes/Node/Blocks/Set/latticeBlock.js.map +1 -1
  343. package/Meshes/Node/Blocks/Set/setColorsBlock.d.ts +1 -0
  344. package/Meshes/Node/Blocks/Set/setColorsBlock.js +1 -0
  345. package/Meshes/Node/Blocks/Set/setColorsBlock.js.map +1 -1
  346. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.d.ts +1 -0
  347. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js +1 -0
  348. package/Meshes/Node/Blocks/Set/setMaterialIDBlock.js.map +1 -1
  349. package/Meshes/Node/Blocks/Set/setNormalsBlock.d.ts +1 -0
  350. package/Meshes/Node/Blocks/Set/setNormalsBlock.js +1 -0
  351. package/Meshes/Node/Blocks/Set/setNormalsBlock.js.map +1 -1
  352. package/Meshes/Node/Blocks/Set/setPositionsBlock.d.ts +1 -0
  353. package/Meshes/Node/Blocks/Set/setPositionsBlock.js +1 -0
  354. package/Meshes/Node/Blocks/Set/setPositionsBlock.js.map +1 -1
  355. package/Meshes/Node/Blocks/Set/setTangentsBlock.d.ts +1 -0
  356. package/Meshes/Node/Blocks/Set/setTangentsBlock.js +1 -0
  357. package/Meshes/Node/Blocks/Set/setTangentsBlock.js.map +1 -1
  358. package/Meshes/Node/Blocks/Set/setUVsBlock.d.ts +1 -0
  359. package/Meshes/Node/Blocks/Set/setUVsBlock.js +1 -0
  360. package/Meshes/Node/Blocks/Set/setUVsBlock.js.map +1 -1
  361. package/Meshes/Node/Blocks/Sources/boxBlock.d.ts +2 -0
  362. package/Meshes/Node/Blocks/Sources/boxBlock.js +2 -0
  363. package/Meshes/Node/Blocks/Sources/boxBlock.js.map +1 -1
  364. package/Meshes/Node/Blocks/Sources/capsuleBlock.d.ts +2 -0
  365. package/Meshes/Node/Blocks/Sources/capsuleBlock.js +2 -0
  366. package/Meshes/Node/Blocks/Sources/capsuleBlock.js.map +1 -1
  367. package/Meshes/Node/Blocks/Sources/cylinderBlock.d.ts +2 -0
  368. package/Meshes/Node/Blocks/Sources/cylinderBlock.js +2 -0
  369. package/Meshes/Node/Blocks/Sources/cylinderBlock.js.map +1 -1
  370. package/Meshes/Node/Blocks/Sources/discBlock.d.ts +2 -0
  371. package/Meshes/Node/Blocks/Sources/discBlock.js +2 -0
  372. package/Meshes/Node/Blocks/Sources/discBlock.js.map +1 -1
  373. package/Meshes/Node/Blocks/Sources/gridBlock.d.ts +2 -0
  374. package/Meshes/Node/Blocks/Sources/gridBlock.js +2 -0
  375. package/Meshes/Node/Blocks/Sources/gridBlock.js.map +1 -1
  376. package/Meshes/Node/Blocks/Sources/icoSphereBlock.d.ts +2 -0
  377. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js +2 -0
  378. package/Meshes/Node/Blocks/Sources/icoSphereBlock.js.map +1 -1
  379. package/Meshes/Node/Blocks/Sources/meshBlock.d.ts +1 -0
  380. package/Meshes/Node/Blocks/Sources/meshBlock.js +1 -0
  381. package/Meshes/Node/Blocks/Sources/meshBlock.js.map +1 -1
  382. package/Meshes/Node/Blocks/Sources/planeBlock.d.ts +2 -0
  383. package/Meshes/Node/Blocks/Sources/planeBlock.js +2 -0
  384. package/Meshes/Node/Blocks/Sources/planeBlock.js.map +1 -1
  385. package/Meshes/Node/Blocks/Sources/pointListBlock.d.ts +2 -1
  386. package/Meshes/Node/Blocks/Sources/pointListBlock.js +2 -1
  387. package/Meshes/Node/Blocks/Sources/pointListBlock.js.map +1 -1
  388. package/Meshes/Node/Blocks/Sources/sphereBlock.d.ts +2 -0
  389. package/Meshes/Node/Blocks/Sources/sphereBlock.js +2 -0
  390. package/Meshes/Node/Blocks/Sources/sphereBlock.js.map +1 -1
  391. package/Meshes/Node/Blocks/Sources/torusBlock.d.ts +2 -0
  392. package/Meshes/Node/Blocks/Sources/torusBlock.js +2 -0
  393. package/Meshes/Node/Blocks/Sources/torusBlock.js.map +1 -1
  394. package/Meshes/Node/Blocks/Teleport/teleportInBlock.d.ts +1 -0
  395. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js +1 -0
  396. package/Meshes/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  397. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.d.ts +3 -0
  398. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js +3 -0
  399. package/Meshes/Node/Blocks/Teleport/teleportOutBlock.js.map +1 -1
  400. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -0
  401. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  402. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  403. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.d.ts +1 -0
  404. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js +1 -0
  405. package/Meshes/Node/Blocks/Textures/geometryTextureFetchBlock.js.map +1 -1
  406. package/Meshes/Node/Blocks/booleanGeometryBlock.d.ts +1 -0
  407. package/Meshes/Node/Blocks/booleanGeometryBlock.js +1 -1
  408. package/Meshes/Node/Blocks/booleanGeometryBlock.js.map +1 -1
  409. package/Meshes/Node/Blocks/cleanGeometryBlock.d.ts +1 -0
  410. package/Meshes/Node/Blocks/cleanGeometryBlock.js +1 -0
  411. package/Meshes/Node/Blocks/cleanGeometryBlock.js.map +1 -1
  412. package/Meshes/Node/Blocks/conditionBlock.d.ts +2 -0
  413. package/Meshes/Node/Blocks/conditionBlock.js +2 -0
  414. package/Meshes/Node/Blocks/conditionBlock.js.map +1 -1
  415. package/Meshes/Node/Blocks/geometryClampBlock.d.ts +1 -0
  416. package/Meshes/Node/Blocks/geometryClampBlock.js +1 -0
  417. package/Meshes/Node/Blocks/geometryClampBlock.js.map +1 -1
  418. package/Meshes/Node/Blocks/geometryCollectionBlock.d.ts +1 -0
  419. package/Meshes/Node/Blocks/geometryCollectionBlock.js +1 -0
  420. package/Meshes/Node/Blocks/geometryCollectionBlock.js.map +1 -1
  421. package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +2 -0
  422. package/Meshes/Node/Blocks/geometryCurveBlock.js +2 -0
  423. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -1
  424. package/Meshes/Node/Blocks/geometryEaseBlock.d.ts +2 -0
  425. package/Meshes/Node/Blocks/geometryEaseBlock.js +2 -0
  426. package/Meshes/Node/Blocks/geometryEaseBlock.js.map +1 -1
  427. package/Meshes/Node/Blocks/geometryInputBlock.d.ts +3 -0
  428. package/Meshes/Node/Blocks/geometryInputBlock.js +3 -0
  429. package/Meshes/Node/Blocks/geometryInputBlock.js.map +1 -1
  430. package/Meshes/Node/Blocks/geometryOptimizeBlock.d.ts +1 -0
  431. package/Meshes/Node/Blocks/geometryOptimizeBlock.js +1 -0
  432. package/Meshes/Node/Blocks/geometryOptimizeBlock.js.map +1 -1
  433. package/Meshes/Node/Blocks/geometryTransformBlock.d.ts +1 -0
  434. package/Meshes/Node/Blocks/geometryTransformBlock.js +1 -0
  435. package/Meshes/Node/Blocks/geometryTransformBlock.js.map +1 -1
  436. package/Meshes/Node/Blocks/geometryTrigonometryBlock.d.ts +2 -0
  437. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js +2 -0
  438. package/Meshes/Node/Blocks/geometryTrigonometryBlock.js.map +1 -1
  439. package/Meshes/Node/Blocks/mappingBlock.d.ts +1 -0
  440. package/Meshes/Node/Blocks/mappingBlock.js +1 -0
  441. package/Meshes/Node/Blocks/mappingBlock.js.map +1 -1
  442. package/Meshes/Node/Blocks/mathBlock.d.ts +1 -0
  443. package/Meshes/Node/Blocks/mathBlock.js +1 -0
  444. package/Meshes/Node/Blocks/mathBlock.js.map +1 -1
  445. package/Meshes/Node/Blocks/mergeGeometryBlock.d.ts +1 -0
  446. package/Meshes/Node/Blocks/mergeGeometryBlock.js +1 -0
  447. package/Meshes/Node/Blocks/mergeGeometryBlock.js.map +1 -1
  448. package/Meshes/Node/Blocks/randomBlock.d.ts +2 -0
  449. package/Meshes/Node/Blocks/randomBlock.js +2 -0
  450. package/Meshes/Node/Blocks/randomBlock.js.map +1 -1
  451. package/Meshes/Node/Blocks/subdivideBlock.d.ts +1 -0
  452. package/Meshes/Node/Blocks/subdivideBlock.js +1 -0
  453. package/Meshes/Node/Blocks/subdivideBlock.js.map +1 -1
  454. package/Meshes/Node/Interfaces/nodeGeometryTextureData.d.ts +3 -0
  455. package/Meshes/Node/Interfaces/nodeGeometryTextureData.js.map +1 -1
  456. package/Meshes/Node/nodeGeometry.js +0 -2
  457. package/Meshes/Node/nodeGeometry.js.map +1 -1
  458. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +0 -1
  459. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  460. package/Meshes/Node/nodeGeometryBuildState.js +0 -1
  461. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  462. package/Meshes/WebGL/webGLDataBuffer.d.ts +2 -0
  463. package/Meshes/WebGL/webGLDataBuffer.js +2 -0
  464. package/Meshes/WebGL/webGLDataBuffer.js.map +1 -1
  465. package/Meshes/WebGPU/webgpuDataBuffer.d.ts +4 -0
  466. package/Meshes/WebGPU/webgpuDataBuffer.js +4 -0
  467. package/Meshes/WebGPU/webgpuDataBuffer.js.map +1 -1
  468. package/Meshes/abstractMesh.d.ts +1 -0
  469. package/Meshes/abstractMesh.decalMap.d.ts +1 -0
  470. package/Meshes/abstractMesh.decalMap.js.map +1 -1
  471. package/Meshes/abstractMesh.js +1 -6
  472. package/Meshes/abstractMesh.js.map +1 -1
  473. package/Meshes/csg.js +0 -6
  474. package/Meshes/csg.js.map +1 -1
  475. package/Meshes/csg2.js +1 -2
  476. package/Meshes/csg2.js.map +1 -1
  477. package/Meshes/geodesicMesh.d.ts +26 -0
  478. package/Meshes/geodesicMesh.js +18 -3
  479. package/Meshes/geodesicMesh.js.map +1 -1
  480. package/Meshes/groundMesh.d.ts +1 -0
  481. package/Meshes/groundMesh.js +1 -0
  482. package/Meshes/groundMesh.js.map +1 -1
  483. package/Meshes/index.js +0 -2
  484. package/Meshes/index.js.map +1 -1
  485. package/Meshes/instancedMesh.d.ts +18 -3
  486. package/Meshes/instancedMesh.js +11 -3
  487. package/Meshes/instancedMesh.js.map +1 -1
  488. package/Meshes/mesh.d.ts +291 -204
  489. package/Meshes/mesh.js +290 -213
  490. package/Meshes/mesh.js.map +1 -1
  491. package/Meshes/mesh.vertexData.d.ts +15 -19
  492. package/Meshes/mesh.vertexData.js +15 -19
  493. package/Meshes/mesh.vertexData.js.map +1 -1
  494. package/Meshes/meshSimplification.d.ts +0 -1
  495. package/Meshes/meshSimplification.js +6 -1
  496. package/Meshes/meshSimplification.js.map +1 -1
  497. package/Meshes/meshSimplificationSceneComponent.d.ts +2 -0
  498. package/Meshes/meshSimplificationSceneComponent.js.map +1 -1
  499. package/Meshes/meshUVSpaceRenderer.d.ts +1 -0
  500. package/Meshes/meshUVSpaceRenderer.js.map +1 -1
  501. package/Meshes/polygonMesh.js +4 -0
  502. package/Meshes/polygonMesh.js.map +1 -1
  503. package/Meshes/subMesh.project.d.ts +1 -0
  504. package/Meshes/subMesh.project.js.map +1 -1
  505. package/Meshes/thinInstanceMesh.d.ts +5 -0
  506. package/Meshes/thinInstanceMesh.js.map +1 -1
  507. package/Meshes/transformNode.d.ts +1 -1
  508. package/Meshes/transformNode.js +1 -1
  509. package/Meshes/transformNode.js.map +1 -1
  510. package/Misc/dataStorage.d.ts +13 -0
  511. package/Misc/dataStorage.js +25 -0
  512. package/Misc/dataStorage.js.map +1 -1
  513. package/Morph/morphTarget.d.ts +9 -5
  514. package/Morph/morphTarget.js +15 -7
  515. package/Morph/morphTarget.js.map +1 -1
  516. package/Morph/morphTargetManager.d.ts +3 -1
  517. package/Morph/morphTargetManager.js +5 -2
  518. package/Morph/morphTargetManager.js.map +1 -1
  519. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js +1 -1
  520. package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
  521. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +1 -1
  522. package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -1
  523. package/Particles/Node/Blocks/Emitters/customShapeBlock.js +1 -1
  524. package/Particles/Node/Blocks/Emitters/customShapeBlock.js.map +1 -1
  525. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js +1 -1
  526. package/Particles/Node/Blocks/Emitters/cylinderShapeBlock.js.map +1 -1
  527. package/Particles/Node/Blocks/Emitters/emitters.functions.js +3 -3
  528. package/Particles/Node/Blocks/Emitters/emitters.functions.js.map +1 -1
  529. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js +1 -1
  530. package/Particles/Node/Blocks/Emitters/meshShapeBlock.js.map +1 -1
  531. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js +1 -1
  532. package/Particles/Node/Blocks/Emitters/pointShapeBlock.js.map +1 -1
  533. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js +1 -1
  534. package/Particles/Node/Blocks/Emitters/sphereShapeBlock.js.map +1 -1
  535. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js +2 -2
  536. package/Particles/Node/Blocks/Update/basicPositionUpdateBlock.js.map +1 -1
  537. package/Particles/Node/Blocks/Update/updateNoiseBlock.js +7 -7
  538. package/Particles/Node/Blocks/Update/updateNoiseBlock.js.map +1 -1
  539. package/Particles/Node/Blocks/particleLocalVariableBlock.js +2 -2
  540. package/Particles/Node/Blocks/particleLocalVariableBlock.js.map +1 -1
  541. package/Particles/Node/nodeParticleBuildState.js +7 -7
  542. package/Particles/Node/nodeParticleBuildState.js.map +1 -1
  543. package/Particles/Node/nodeParticleSystemSet.helper.js +9 -4
  544. package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
  545. package/Particles/particle.d.ts +73 -61
  546. package/Particles/particle.js +106 -91
  547. package/Particles/particle.js.map +1 -1
  548. package/Particles/particleSystem.js +5 -5
  549. package/Particles/particleSystem.js.map +1 -1
  550. package/Particles/thinParticleSystem.function.js +83 -83
  551. package/Particles/thinParticleSystem.function.js.map +1 -1
  552. package/Particles/thinParticleSystem.js +8 -8
  553. package/Particles/thinParticleSystem.js.map +1 -1
  554. package/Physics/v2/Plugins/havokPlugin.d.ts +89 -3
  555. package/Physics/v2/Plugins/havokPlugin.js +388 -53
  556. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  557. package/Probes/reflectionProbe.js +10 -7
  558. package/Probes/reflectionProbe.js.map +1 -1
  559. package/Rendering/depthRenderer.js +1 -1
  560. package/Rendering/depthRenderer.js.map +1 -1
  561. package/Rendering/objectRenderer.d.ts +3 -1
  562. package/Rendering/objectRenderer.js +28 -8
  563. package/Rendering/objectRenderer.js.map +1 -1
  564. package/Rendering/reflectiveShadowMap.js +1 -1
  565. package/Rendering/reflectiveShadowMap.js.map +1 -1
  566. package/Rendering/thinDepthPeelingRenderer.js +8 -0
  567. package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
  568. package/Shaders/gaussianSplatting.fragment.js +8 -2
  569. package/Shaders/gaussianSplatting.fragment.js.map +1 -1
  570. package/Shaders/gaussianSplatting.vertex.js +8 -2
  571. package/Shaders/gaussianSplatting.vertex.js.map +1 -1
  572. package/ShadersWGSL/gaussianSplatting.fragment.js +7 -1
  573. package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
  574. package/ShadersWGSL/gaussianSplatting.vertex.js +8 -2
  575. package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
  576. package/package.json +1 -1
  577. package/scene.d.ts +22 -4
  578. package/scene.js +33 -20
  579. package/scene.js.map +1 -1
@@ -0,0 +1,573 @@
1
+ import { Vector3, Quaternion, TmpVectors, Matrix } from "../Maths/math.vector.js";
2
+ import { Logger } from "../Misc/logger.js";
3
+ /**
4
+ * Represents an animator avatar that manages skeletons and morph target managers for a hierarchical transform node and mesh structure.
5
+ * This class is used to group and manage animation-related resources (skeletons and morph targets) associated with a root transform node and its descendants.
6
+ */
7
+ export class AnimatorAvatar {
8
+ /**
9
+ * Map of morph target names to their corresponding MorphTarget instances.
10
+ * The keys are constructed using the format "meshName_morphTargetName".
11
+ */
12
+ get mapMorphTargetNameToMorphTarget() {
13
+ if (!this._mapMorphTargetNameToMorphTarget) {
14
+ this._buildMorphTargetMap();
15
+ }
16
+ return this._mapMorphTargetNameToMorphTarget;
17
+ }
18
+ /**
19
+ * Creates an instance of AnimatorAvatar.
20
+ * @param name - The name to assign to this avatar and its root node
21
+ * @param rootNode - The root node of the avatar hierarchy. This node and its descendants will be scanned for skeletons and morph target managers. If not provided, you are expected to manually manage skeletons and morph target managers.
22
+ * @param _disposeResources - Indicates whether to dispose of resources (skeletons, morph target managers, root node and descendants + materials and textures) when the avatar is disposed (true by default)
23
+ */
24
+ constructor(name, rootNode, _disposeResources = true) {
25
+ this.name = name;
26
+ this.rootNode = rootNode;
27
+ this._disposeResources = _disposeResources;
28
+ /**
29
+ * Indicates whether to show warnings during retargeting operations.
30
+ */
31
+ this.showWarnings = true;
32
+ this.skeletons = new Set();
33
+ this.morphTargetManagers = new Set();
34
+ if (!rootNode) {
35
+ return;
36
+ }
37
+ rootNode.name = name;
38
+ if (!rootNode.rotationQuaternion) {
39
+ rootNode.rotationQuaternion = new Quaternion();
40
+ }
41
+ rootNode
42
+ .getChildMeshes(false, (node) => {
43
+ const mesh = node;
44
+ return mesh.getTotalVertices && mesh.getTotalVertices() > 0;
45
+ })
46
+ .forEach((mesh) => {
47
+ if (mesh.skeleton) {
48
+ this.skeletons.add(mesh.skeleton);
49
+ }
50
+ if (mesh.morphTargetManager) {
51
+ mesh.morphTargetManager.meshName = mesh.name;
52
+ mesh.morphTargetManager.numMaxInfluencers = mesh.morphTargetManager.numTargets;
53
+ this.morphTargetManagers.add(mesh.morphTargetManager);
54
+ }
55
+ });
56
+ this._computeBoneWorldMatrices();
57
+ }
58
+ /**
59
+ * Finds a bone in the avatar's skeletons by its linked transform node or the name of the linked transform node.
60
+ * @param nameOrTransformNode The linked transform node or the name of the linked transform node
61
+ * @returns The found bone or null if not found
62
+ */
63
+ findBone(nameOrTransformNode) {
64
+ const isName = !this._isTransformNode(nameOrTransformNode);
65
+ const iterator = this.skeletons.keys();
66
+ let bone = null;
67
+ for (let key = iterator.next(); key.done !== true; key = iterator.next()) {
68
+ const skeleton = key.value;
69
+ if (isName) {
70
+ bone = skeleton.findBoneFromLinkedTransformNodeName(nameOrTransformNode);
71
+ }
72
+ else {
73
+ bone = skeleton.findBoneFromLinkedTransformNode(nameOrTransformNode);
74
+ }
75
+ if (bone) {
76
+ return bone;
77
+ }
78
+ }
79
+ return null;
80
+ }
81
+ /**
82
+ * Make sures that the animation group passed as the first parameter will animate the bones in the skeleton(s) / the morphs in the morph target manager(s) of the avatar.
83
+ * Retargeting is based on the names of the targets (TransformNode or MorphTarget) in the animation and the names of the bones in the skeleton / morph targets in the morph target manager.
84
+ * Note that you can use the mapNodeNames option to specify a mapping between source transform node names and target bone names in case they are different.
85
+ * If no bones with the same name as a target (TransformNode) of a targeted animation are found, the targeted animation is removed from the animation group.
86
+ * Same for morph targets.
87
+ * Note that for the time being, we only support a source animation group which animates transform nodes, not bones!
88
+ * That's typically the case when the source animation group is created from a glTF file, as glTF animations always target transform nodes.
89
+ * @param sourceAnimationGroup The animation group to retarget
90
+ * @param options Options for retargeting the animation group (optional)
91
+ * @returns The retargeted (new) animation group
92
+ */
93
+ retargetAnimationGroup(sourceAnimationGroup, options) {
94
+ const localOptions = {
95
+ animationGroupName: sourceAnimationGroup.name,
96
+ fixAnimations: true,
97
+ checkHierarchy: true,
98
+ retargetAnimationKeys: true,
99
+ fixGroundReference: true,
100
+ fixRootPosition: true,
101
+ ...options,
102
+ };
103
+ // Make sure that all world matrices are up to date, both in the bone hierarchy and in the animation transform node hierarchy
104
+ this._computeBoneWorldMatrices();
105
+ const mapNodeNames = localOptions.mapNodeNames ?? new Map();
106
+ const lstTransformNodes = new Set();
107
+ const sourceTransformNodeNameToNode = new Map();
108
+ for (let i = 0; i < sourceAnimationGroup.targetedAnimations.length; ++i) {
109
+ const ta = sourceAnimationGroup.targetedAnimations[i];
110
+ if (ta.target.getClassName?.() === "TransformNode" && !lstTransformNodes.has(ta.target)) {
111
+ const tn = ta.target;
112
+ lstTransformNodes.add(tn);
113
+ if (!tn.rotationQuaternion) {
114
+ tn.rotationQuaternion = Quaternion.FromEulerAngles(tn.rotation.x, tn.rotation.y, tn.rotation.z);
115
+ tn.rotation.setAll(0);
116
+ }
117
+ sourceTransformNodeNameToNode.set(mapNodeNames.get(tn.name) ?? tn.name, {
118
+ node: tn,
119
+ initialTransformations: {
120
+ position: tn.position.clone(),
121
+ scaling: tn.scaling.clone(),
122
+ quaternion: tn.rotationQuaternion.clone(),
123
+ },
124
+ });
125
+ }
126
+ }
127
+ lstTransformNodes.forEach((node) => {
128
+ node.computeWorldMatrix(true);
129
+ });
130
+ // Clone the source animation and retarget it
131
+ const animationGroup = sourceAnimationGroup.clone(localOptions.animationGroupName, undefined, true, true);
132
+ const mapTransformNodeToRootNode = new Map();
133
+ const lstAnims = new Set();
134
+ for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {
135
+ const ta = animationGroup.targetedAnimations[i];
136
+ const animation = ta.animation;
137
+ if (lstAnims.has(animation)) {
138
+ if (this.showWarnings) {
139
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': animation '${animation.name}' is used multiple times in the same animation group: duplicated animations are not supported, the retargeted animation may not work as expected.`);
140
+ }
141
+ }
142
+ lstAnims.add(animation);
143
+ switch (animation.targetProperty) {
144
+ case "influence": {
145
+ if (!this._retargetMorphTarget(ta, animationGroup.name)) {
146
+ animationGroup.targetedAnimations.splice(i, 1);
147
+ i--;
148
+ }
149
+ break;
150
+ }
151
+ case "position":
152
+ case "rotationQuaternion":
153
+ case "scaling": {
154
+ if (ta.target.getClassName?.() !== "TransformNode") {
155
+ break;
156
+ }
157
+ const sourceTransformNode = ta.target;
158
+ const sourceTransformNodeName = mapNodeNames.get(sourceTransformNode.name) ?? sourceTransformNode.name;
159
+ const targetBone = this.findBone(sourceTransformNodeName);
160
+ if (!targetBone) {
161
+ if (this.showWarnings) {
162
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': "${sourceTransformNodeName}" bone not found in any skeleton of avatar: animation removed.`);
163
+ animationGroup.targetedAnimations.splice(i, 1);
164
+ i--;
165
+ }
166
+ break;
167
+ }
168
+ if (!targetBone._linkedTransformNode) {
169
+ if (this.showWarnings) {
170
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': bone "${targetBone.name}" has no linked transform node: skipping retargeting.`);
171
+ }
172
+ break;
173
+ }
174
+ if (!this._retargetTransformNodeToBone(ta, sourceTransformNode, targetBone, animationGroup.name, mapTransformNodeToRootNode, mapNodeNames, !!localOptions.checkHierarchy)) {
175
+ animationGroup.targetedAnimations.splice(i, 1);
176
+ i--;
177
+ }
178
+ else if (localOptions.retargetAnimationKeys) {
179
+ this._retargetAnimationKeys(ta.animation, sourceTransformNode, targetBone);
180
+ }
181
+ break;
182
+ }
183
+ }
184
+ }
185
+ if (localOptions.fixAnimations) {
186
+ this._fixAnimationGroup(animationGroup);
187
+ }
188
+ if (localOptions.fixGroundReference || localOptions.fixRootPosition) {
189
+ const msg = localOptions.fixGroundReference && localOptions.fixRootPosition
190
+ ? "Ground reference and root position fixing processes skipped."
191
+ : localOptions.fixGroundReference
192
+ ? "Ground reference fixing process skipped."
193
+ : "Root position fixing process skipped.";
194
+ const res = this._findVerticalAxis(msg, animationGroup, mapNodeNames.get(localOptions.rootNodeName) ?? localOptions.rootNodeName, sourceTransformNodeNameToNode, mapNodeNames.get(localOptions.groundReferenceNodeName) ?? localOptions.groundReferenceNodeName, localOptions.groundReferenceVerticalAxis);
195
+ if (res) {
196
+ const { verticalAxis, sourceRootTransformNode, targetRootTransformNode, targetRootPositionAnimation, sourceGroundReferenceTransformNode, targetGroundReferenceTransformNode, proportionRatio, } = res;
197
+ if (localOptions.fixRootPosition) {
198
+ this._fixRootPosition(sourceAnimationGroup, animationGroup, sourceRootTransformNode, targetRootTransformNode, targetRootPositionAnimation, proportionRatio);
199
+ this._resetStates(sourceTransformNodeNameToNode);
200
+ }
201
+ if (localOptions.fixGroundReference) {
202
+ this._fixGroundReference(sourceAnimationGroup, animationGroup, verticalAxis, targetRootTransformNode, targetRootPositionAnimation, sourceGroundReferenceTransformNode, targetGroundReferenceTransformNode);
203
+ this._resetStates(sourceTransformNodeNameToNode);
204
+ }
205
+ }
206
+ }
207
+ return animationGroup;
208
+ }
209
+ /**
210
+ * Disposes of the avatar and releases all associated resources.
211
+ * This will dispose all skeletons, morph target managers, and the root mesh with its descendants (including materials and textures).
212
+ * If disposeResources was set to false in the constructor, this method does nothing.
213
+ */
214
+ dispose() {
215
+ if (!this._disposeResources) {
216
+ return;
217
+ }
218
+ const iterator = this.skeletons.keys();
219
+ for (let key = iterator.next(); key.done !== true; key = iterator.next()) {
220
+ key.value.dispose();
221
+ }
222
+ const iterator2 = this.morphTargetManagers.keys();
223
+ for (let key = iterator2.next(); key.done !== true; key = iterator2.next()) {
224
+ key.value.dispose();
225
+ }
226
+ this.rootNode?.dispose(false, true);
227
+ }
228
+ _computeBoneWorldMatrices() {
229
+ this.skeletons.forEach((skeleton) => {
230
+ skeleton.bones.forEach((bone) => {
231
+ bone._linkedTransformNode?.computeWorldMatrix(true);
232
+ });
233
+ });
234
+ }
235
+ _isTransformNode(nameOrTransformNode) {
236
+ return typeof nameOrTransformNode !== "string";
237
+ }
238
+ _buildMorphTargetMap() {
239
+ this._mapMorphTargetNameToMorphTarget = new Map();
240
+ this.morphTargetManagers.forEach((manager) => {
241
+ const numTargets = manager.numTargets;
242
+ for (let t = 0; t < numTargets; ++t) {
243
+ const target = manager.getTarget(t);
244
+ const key = manager.meshName + "_" + target.name;
245
+ this._mapMorphTargetNameToMorphTarget.set(key, target);
246
+ }
247
+ });
248
+ }
249
+ _retargetMorphTarget(ta, animationGroupName) {
250
+ const morphTarget = ta.target;
251
+ const key = morphTarget.morphTargetManager?.meshName + "_" + morphTarget.name;
252
+ if (!this.mapMorphTargetNameToMorphTarget.has(key)) {
253
+ if (this.showWarnings) {
254
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': "${morphTarget.name}" morph target not found in morph target manager of mesh "${morphTarget.morphTargetManager?.meshName}": animation removed`);
255
+ }
256
+ return false;
257
+ }
258
+ ta.target = this.mapMorphTargetNameToMorphTarget.get(key);
259
+ return true;
260
+ }
261
+ _retargetTransformNodeToBone(ta, sourceTransformNode, targetBone, animationGroupName, mapTransformNodeToRootNode, mapNodeNames, checkHierarchy) {
262
+ if (checkHierarchy) {
263
+ let rootNode = mapTransformNodeToRootNode.get(sourceTransformNode);
264
+ if (!rootNode) {
265
+ rootNode = this._getRootNode(sourceTransformNode);
266
+ mapTransformNodeToRootNode.set(sourceTransformNode, rootNode);
267
+ }
268
+ if (!this._checkParentHierarchy(targetBone, rootNode, mapNodeNames)) {
269
+ if (this.showWarnings) {
270
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroupName}': parent hierarchy mismatch between bone "${targetBone.name}" and transform node "${sourceTransformNode.name}": animation removed`);
271
+ }
272
+ return false;
273
+ }
274
+ }
275
+ ta.target = targetBone._linkedTransformNode;
276
+ return true;
277
+ }
278
+ _retargetAnimationKeys(animation, sourceTransformNode, targetBone) {
279
+ const keys = animation.getKeys();
280
+ const targetTransformNode = targetBone._linkedTransformNode;
281
+ const targetWorldMatrix = targetTransformNode.getWorldMatrix();
282
+ const targetParentWorldMatrix = targetTransformNode.parent ? targetTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;
283
+ const targetParentInverseWorldMatrix = targetParentWorldMatrix.invertToRef(TmpVectors.Matrix[0]);
284
+ const sourceInverseWorld = sourceTransformNode.getWorldMatrix().invertToRef(TmpVectors.Matrix[1]);
285
+ const sourceParentWorld = sourceTransformNode.parent ? sourceTransformNode.parent.getWorldMatrix() : Matrix.IdentityReadOnly;
286
+ switch (animation.targetProperty) {
287
+ case "rotationQuaternion": {
288
+ for (const key of keys) {
289
+ const quaternion = key.value;
290
+ const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, quaternion, sourceTransformNode.position, TmpVectors.Matrix[2]);
291
+ sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);
292
+ targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, quaternion, undefined);
293
+ }
294
+ break;
295
+ }
296
+ case "position": {
297
+ for (const key of keys) {
298
+ const position = key.value;
299
+ const localMat = Matrix.ComposeToRef(sourceTransformNode.scaling, sourceTransformNode.rotationQuaternion, position, TmpVectors.Matrix[2]);
300
+ sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);
301
+ targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(undefined, undefined, position);
302
+ }
303
+ break;
304
+ }
305
+ case "scaling": {
306
+ for (const key of keys) {
307
+ const scaling = key.value;
308
+ const localMat = Matrix.ComposeToRef(scaling, sourceTransformNode.rotationQuaternion, sourceTransformNode.position, TmpVectors.Matrix[2]);
309
+ sourceInverseWorld.multiplyToRef(localMat, localMat).multiplyToRef(sourceParentWorld, localMat);
310
+ targetWorldMatrix.multiplyToRef(localMat, localMat).multiplyToRef(targetParentInverseWorldMatrix, localMat).decompose(scaling, undefined, undefined);
311
+ }
312
+ break;
313
+ }
314
+ }
315
+ }
316
+ /**
317
+ * This method does two things:
318
+ * - It deletes a targeted animation if a bone corresponding to the target cannot be found
319
+ * - It corrects quaternion animations when two consecutive quaternions are orthogonal to each other. When this happens, in 99.99% of cases it's an error
320
+ * in the animation data, as two consecutive rotations should normally be close to each other and not have a large gap.
321
+ * The fix is to copy the first quaternion into the second.
322
+ * @param animationGroup The animation group to fix
323
+ * @internal
324
+ */
325
+ _fixAnimationGroup(animationGroup) {
326
+ for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {
327
+ const ta = animationGroup.targetedAnimations[i];
328
+ switch (ta.animation.targetProperty) {
329
+ case "position":
330
+ case "rotationQuaternion":
331
+ case "scaling": {
332
+ if (ta.target.getClassName() !== "TransformNode") {
333
+ break;
334
+ }
335
+ const transformNode = ta.target;
336
+ const bone = this.findBone(transformNode);
337
+ if (!bone) {
338
+ if (this.showWarnings) {
339
+ Logger.Warn(`FixAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': no bone in any skeleton of the avatar ${this.name} animates the transform node ${transformNode.name}: animation removed`);
340
+ }
341
+ animationGroup.targetedAnimations.splice(i, 1);
342
+ i--;
343
+ continue;
344
+ }
345
+ ta.target = bone._linkedTransformNode;
346
+ if (ta.animation.targetProperty === "rotationQuaternion") {
347
+ this._fixAnimationQuaternion(ta.animation);
348
+ }
349
+ }
350
+ }
351
+ }
352
+ }
353
+ _fixAnimationQuaternion(animation, epsilon = 0.001) {
354
+ const keys = animation.getKeys();
355
+ for (let i = 0; i < keys.length - 1; ++i) {
356
+ const curQuat = keys[i].value;
357
+ const nextQuat = keys[i + 1].value;
358
+ if (Math.abs(Quaternion.Dot(curQuat, nextQuat)) < epsilon) {
359
+ keys[i + 1].value = curQuat.clone();
360
+ i += 1;
361
+ }
362
+ }
363
+ }
364
+ _getRootNode(node) {
365
+ let current = node;
366
+ while (current.parent) {
367
+ current = current.parent;
368
+ }
369
+ return current;
370
+ }
371
+ /**
372
+ * Checks whether the parent hierarchy of a bone matches that of a given transform node. Checks are performed by name.
373
+ * It works by first finding the transform node in the descendants of the root transform node that matches the bone's linked transform node.
374
+ * Then it traverses up the hierarchy of both the bone and the transform node, comparing their names at each level.
375
+ * @param bone The bone to check
376
+ * @param rootTransformNode The root transform node to check against
377
+ * @returns True if the hierarchies match, false otherwise
378
+ * @internal
379
+ */
380
+ _checkParentHierarchy(bone, rootTransformNode, mapNodeNames) {
381
+ const children = rootTransformNode.getDescendants(false, (node) => (mapNodeNames.get(node.name) ?? node.name) === bone._linkedTransformNode.name);
382
+ if (!children || children.length !== 1) {
383
+ if (this.showWarnings) {
384
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: unable to find a corresponding transform node to bone name ${bone._linkedTransformNode.name} in the source animation.`);
385
+ }
386
+ return false;
387
+ }
388
+ let transformNode = children[0];
389
+ while (bone) {
390
+ const name = mapNodeNames.get(transformNode?.name ?? "") ?? transformNode?.name;
391
+ if (bone._linkedTransformNode.name !== name) {
392
+ if (this.showWarnings) {
393
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', CheckParentHierarchy: bone name ${bone._linkedTransformNode.name} is different from transform node name ${name}.`);
394
+ }
395
+ return false;
396
+ }
397
+ bone = bone.parent;
398
+ transformNode = transformNode.parent;
399
+ }
400
+ return true;
401
+ }
402
+ _getRootNodeName(rootNodeName, transformNodeNameToNode) {
403
+ if (rootNodeName) {
404
+ return rootNodeName;
405
+ }
406
+ // Look for the first bone that doesn't have a parent
407
+ const iterator = this.skeletons.keys();
408
+ for (let key = iterator.next(); key.done !== true; key = iterator.next()) {
409
+ const skeleton = key.value;
410
+ for (const bone of skeleton.bones) {
411
+ if (!bone.parent) {
412
+ // Make sure there's a transform node with that name in the source animation
413
+ if (transformNodeNameToNode.get(bone.name)) {
414
+ return bone.name;
415
+ }
416
+ }
417
+ }
418
+ }
419
+ return;
420
+ }
421
+ _findVerticalAxis(msg, animationGroup, remappedRootNodeName, sourceTransformNodeNameToNode, remappedGroundReferenceNodeName, groundReferenceVerticalAxis) {
422
+ if (!remappedGroundReferenceNodeName) {
423
+ if (this.showWarnings) {
424
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': you must provide the name of the ground reference node (option parameter "groundReferenceNodeName"). ${msg}`);
425
+ }
426
+ return null;
427
+ }
428
+ remappedRootNodeName = this._getRootNodeName(remappedRootNodeName, sourceTransformNodeNameToNode);
429
+ if (!remappedRootNodeName) {
430
+ if (this.showWarnings) {
431
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a suitable root node in the source animation. You should provide its name through the "rootNodeName" optional parameter. ${msg}`);
432
+ }
433
+ return null;
434
+ }
435
+ const sourceRootTransformNode = sourceTransformNodeNameToNode.get(remappedRootNodeName)?.node;
436
+ const sourceGroundReferenceTransformNode = sourceTransformNodeNameToNode.get(remappedGroundReferenceNodeName)?.node;
437
+ if (!sourceRootTransformNode) {
438
+ if (this.showWarnings) {
439
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to "${remappedRootNodeName}" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`);
440
+ }
441
+ return null;
442
+ }
443
+ if (!sourceGroundReferenceTransformNode) {
444
+ if (this.showWarnings) {
445
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to "${remappedGroundReferenceNodeName}" in the source animation. This transform node either doesn't exist or is not animated. ${msg}`);
446
+ }
447
+ return null;
448
+ }
449
+ // Look for the position animation + target node of the root node name (generally the hips) in the retargeted animation
450
+ let targetRootPositionAnimation;
451
+ let targetRootTransformNode;
452
+ for (let i = 0; i < animationGroup.targetedAnimations.length; ++i) {
453
+ const ta = animationGroup.targetedAnimations[i];
454
+ const target = ta.target;
455
+ const animation = ta.animation;
456
+ if (target.name === remappedRootNodeName && animation.targetProperty === "position") {
457
+ targetRootPositionAnimation = animation;
458
+ targetRootTransformNode = ta.target;
459
+ break;
460
+ }
461
+ }
462
+ if (!targetRootPositionAnimation || !targetRootTransformNode) {
463
+ if (this.showWarnings) {
464
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find a "position" animation for the node "${remappedRootNodeName}". ${msg}`);
465
+ }
466
+ return null;
467
+ }
468
+ const targetGroundReferenceTransformNode = this.findBone(remappedGroundReferenceNodeName)?._linkedTransformNode;
469
+ if (!targetGroundReferenceTransformNode) {
470
+ if (this.showWarnings) {
471
+ Logger.Warn(`RetargetAnimationGroup - Avatar '${this.name}', AnimationGroup '${animationGroup.name}': unable to find the transform node corresponding to the bone "${remappedGroundReferenceNodeName}" in the avatar skeleton. Ensure that this bone exists and is linked to a transform node. ${msg}`);
472
+ }
473
+ return null;
474
+ }
475
+ sourceRootTransformNode.computeWorldMatrix(true);
476
+ sourceGroundReferenceTransformNode.computeWorldMatrix(true);
477
+ // Determine the vertical axis
478
+ const sourceRootGroundReferenceDiff = sourceRootTransformNode.getAbsolutePosition().subtract(sourceGroundReferenceTransformNode.getAbsolutePosition());
479
+ let verticalAxis = 0;
480
+ if (groundReferenceVerticalAxis) {
481
+ switch (groundReferenceVerticalAxis) {
482
+ case "Y":
483
+ verticalAxis = 1;
484
+ break;
485
+ case "Z":
486
+ verticalAxis = 2;
487
+ break;
488
+ }
489
+ }
490
+ else {
491
+ // No axis provided: assume the vertical axis is the one with the larger difference between the reference and the ground reference transform nodes
492
+ if (Math.abs(sourceRootGroundReferenceDiff.y) > Math.abs(sourceRootGroundReferenceDiff.x)) {
493
+ verticalAxis = 1;
494
+ }
495
+ if (Math.abs(sourceRootGroundReferenceDiff.z) > Math.abs(sourceRootGroundReferenceDiff.y)) {
496
+ verticalAxis = 2;
497
+ }
498
+ }
499
+ const targetRootGroundReferenceDiff = targetRootTransformNode.getAbsolutePosition().subtract(targetGroundReferenceTransformNode.getAbsolutePosition());
500
+ return {
501
+ verticalAxis,
502
+ sourceRootTransformNode,
503
+ sourceGroundReferenceTransformNode,
504
+ targetRootTransformNode,
505
+ targetRootPositionAnimation,
506
+ targetGroundReferenceTransformNode,
507
+ proportionRatio: verticalAxis === 0
508
+ ? targetRootGroundReferenceDiff.x / sourceRootGroundReferenceDiff.x
509
+ : verticalAxis === 1
510
+ ? targetRootGroundReferenceDiff.y / sourceRootGroundReferenceDiff.y
511
+ : targetRootGroundReferenceDiff.z / sourceRootGroundReferenceDiff.z,
512
+ };
513
+ }
514
+ _resetStates(sourceTransformNodeNameToNode) {
515
+ this.skeletons.forEach((skeleton) => skeleton.returnToRest());
516
+ sourceTransformNodeNameToNode.forEach((data) => {
517
+ const { node, initialTransformations } = data;
518
+ node.position = initialTransformations.position;
519
+ node.scaling = initialTransformations.scaling;
520
+ node.rotationQuaternion = initialTransformations.quaternion;
521
+ node.computeWorldMatrix(true);
522
+ });
523
+ }
524
+ _fixRootPosition(sourceAnimationGroup, animationGroup, sourceRootTransformNode, targetRootTransformNode, targetRootPositionAnimation, proportionRatio) {
525
+ const targetNodeInverseParentWorldMatrix = targetRootTransformNode.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly;
526
+ sourceRootTransformNode.computeWorldMatrix(true);
527
+ targetRootTransformNode.computeWorldMatrix(true);
528
+ const sourceWorldPosition = sourceRootTransformNode.absolutePosition.clone();
529
+ const targetWorldPosition = targetRootTransformNode.absolutePosition.clone();
530
+ sourceAnimationGroup.play(false);
531
+ animationGroup.play(false);
532
+ // Loop over the position animation of the root transform node
533
+ for (const key of targetRootPositionAnimation.getKeys()) {
534
+ const frame = key.frame;
535
+ // Advance the source and retargeted animations to this frame
536
+ sourceAnimationGroup.goToFrame(frame);
537
+ sourceAnimationGroup.pause();
538
+ animationGroup.goToFrame(frame);
539
+ animationGroup.pause();
540
+ sourceRootTransformNode.computeWorldMatrix(true);
541
+ const offset = sourceRootTransformNode.absolutePosition.subtractToRef(sourceWorldPosition, TmpVectors.Vector3[0]);
542
+ offset.scaleInPlace(proportionRatio);
543
+ offset.addInPlace(targetWorldPosition);
544
+ Vector3.TransformNormalToRef(offset, targetNodeInverseParentWorldMatrix, key.value);
545
+ }
546
+ sourceAnimationGroup.stop();
547
+ animationGroup.stop();
548
+ }
549
+ _fixGroundReference(sourceAnimationGroup, animationGroup, verticalAxis, targetRootTransformNode, targetRootPositionAnimation, sourceGroundReferenceTransformNode, targetGroundReferenceTransformNode) {
550
+ const targetNodeInverseParentWorldMatrix = targetRootTransformNode.parent?.getWorldMatrix().invertToRef(TmpVectors.Matrix[0]) ?? Matrix.IdentityReadOnly;
551
+ sourceAnimationGroup.play(false);
552
+ animationGroup.play(false);
553
+ // Loop over the position animation of the root transform node
554
+ for (const key of targetRootPositionAnimation.getKeys()) {
555
+ const frame = key.frame;
556
+ // Advance the source and retargeted animations to this frame
557
+ sourceAnimationGroup.goToFrame(frame);
558
+ sourceAnimationGroup.pause();
559
+ animationGroup.goToFrame(frame);
560
+ animationGroup.pause();
561
+ sourceGroundReferenceTransformNode.computeWorldMatrix(true);
562
+ targetGroundReferenceTransformNode.computeWorldMatrix(true);
563
+ // Calculate the offset to apply to the root position in the target to have the ground reference at the same height in the source and target animations
564
+ const diffGroundReferences = targetGroundReferenceTransformNode.absolutePosition.subtractToRef(sourceGroundReferenceTransformNode.absolutePosition, TmpVectors.Vector3[0]);
565
+ const offset = verticalAxis === 0 ? diffGroundReferences.x : verticalAxis === 1 ? diffGroundReferences.y : diffGroundReferences.z;
566
+ const localOffset = Vector3.TransformNormalToRef(new Vector3(verticalAxis === 0 ? offset : 0, verticalAxis === 1 ? offset : 0, verticalAxis === 2 ? offset : 0), targetNodeInverseParentWorldMatrix, TmpVectors.Vector3[1]);
567
+ key.value.subtractInPlace(localOffset);
568
+ }
569
+ sourceAnimationGroup.stop();
570
+ animationGroup.stop();
571
+ }
572
+ }
573
+ //# sourceMappingURL=animatorAvatar.js.map