@babylonjs/core 6.38.1 → 6.40.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 (710) hide show
  1. package/Actions/action.js +3 -1
  2. package/Actions/action.js.map +1 -1
  3. package/Actions/condition.js +1 -0
  4. package/Actions/condition.js.map +1 -1
  5. package/Actions/directActions.d.ts +2 -2
  6. package/Actions/directActions.js +2 -2
  7. package/Actions/directActions.js.map +1 -1
  8. package/Animations/pathCursor.js +1 -0
  9. package/Animations/pathCursor.js.map +1 -1
  10. package/Animations/runtimeAnimation.js +1 -1
  11. package/Animations/runtimeAnimation.js.map +1 -1
  12. package/Audio/audioEngine.js +5 -0
  13. package/Audio/audioEngine.js.map +1 -1
  14. package/Behaviors/Cameras/autoRotationBehavior.d.ts +3 -0
  15. package/Behaviors/Cameras/autoRotationBehavior.js +3 -0
  16. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  17. package/Behaviors/Meshes/pointerDragBehavior.d.ts +1 -0
  18. package/Behaviors/Meshes/pointerDragBehavior.js +2 -0
  19. package/Behaviors/Meshes/pointerDragBehavior.js.map +1 -1
  20. package/Behaviors/Meshes/sixDofDragBehavior.js +14 -20
  21. package/Behaviors/Meshes/sixDofDragBehavior.js.map +1 -1
  22. package/Bones/bone.d.ts +2 -0
  23. package/Bones/bone.js +2 -0
  24. package/Bones/bone.js.map +1 -1
  25. package/Cameras/Inputs/BaseCameraPointersInput.d.ts +11 -11
  26. package/Cameras/Inputs/BaseCameraPointersInput.js +12 -12
  27. package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
  28. package/Cameras/Inputs/arcRotateCameraPointersInput.d.ts +9 -9
  29. package/Cameras/Inputs/arcRotateCameraPointersInput.js +9 -9
  30. package/Cameras/Inputs/arcRotateCameraPointersInput.js.map +1 -1
  31. package/Cameras/Inputs/followCameraKeyboardMoveInput.d.ts +3 -0
  32. package/Cameras/Inputs/followCameraKeyboardMoveInput.js +3 -0
  33. package/Cameras/Inputs/followCameraKeyboardMoveInput.js.map +1 -1
  34. package/Cameras/Inputs/freeCameraMouseInput.d.ts +1 -1
  35. package/Cameras/Inputs/freeCameraMouseInput.js +1 -1
  36. package/Cameras/Inputs/freeCameraMouseInput.js.map +1 -1
  37. package/Cameras/VR/vrExperienceHelper.d.ts +2 -2
  38. package/Cameras/VR/vrExperienceHelper.js +2 -2
  39. package/Cameras/VR/vrExperienceHelper.js.map +1 -1
  40. package/Cameras/arcRotateCamera.d.ts +2 -0
  41. package/Cameras/arcRotateCamera.js +2 -0
  42. package/Cameras/arcRotateCamera.js.map +1 -1
  43. package/Cameras/camera.d.ts +2 -0
  44. package/Cameras/camera.js +4 -0
  45. package/Cameras/camera.js.map +1 -1
  46. package/Cameras/followCamera.d.ts +1 -0
  47. package/Cameras/followCamera.js +1 -0
  48. package/Cameras/followCamera.js.map +1 -1
  49. package/Culling/Octrees/octree.d.ts +4 -4
  50. package/Culling/Octrees/octree.js +4 -4
  51. package/Culling/Octrees/octree.js.map +1 -1
  52. package/Debug/debugLayer.d.ts +4 -1
  53. package/Debug/debugLayer.js +4 -1
  54. package/Debug/debugLayer.js.map +1 -1
  55. package/Debug/physicsViewer.d.ts +6 -1
  56. package/Debug/physicsViewer.js +6 -1
  57. package/Debug/physicsViewer.js.map +1 -1
  58. package/Decorators/nodeDecorator.d.ts +5 -4
  59. package/Decorators/nodeDecorator.js +5 -4
  60. package/Decorators/nodeDecorator.js.map +1 -1
  61. package/DeviceInput/eventFactory.d.ts +2 -0
  62. package/DeviceInput/eventFactory.js +3 -0
  63. package/DeviceInput/eventFactory.js.map +1 -1
  64. package/DeviceInput/webDeviceInputSystem.js +3 -0
  65. package/DeviceInput/webDeviceInputSystem.js.map +1 -1
  66. package/Engines/Extensions/engine.multiview.js +2 -0
  67. package/Engines/Extensions/engine.multiview.js.map +1 -1
  68. package/Engines/Native/nativeDataStream.d.ts +32 -0
  69. package/Engines/Native/nativeDataStream.js +32 -0
  70. package/Engines/Native/nativeDataStream.js.map +1 -1
  71. package/Engines/Native/nativePipelineContext.d.ts +0 -3
  72. package/Engines/Native/nativePipelineContext.js +0 -3
  73. package/Engines/Native/nativePipelineContext.js.map +1 -1
  74. package/Engines/Native/nativeRenderTargetWrapper.js +2 -0
  75. package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
  76. package/Engines/WebGL/webGLHardwareTexture.js +1 -0
  77. package/Engines/WebGL/webGLHardwareTexture.js.map +1 -1
  78. package/Engines/WebGL/webGLPipelineContext.d.ts +0 -3
  79. package/Engines/WebGL/webGLPipelineContext.js +0 -3
  80. package/Engines/WebGL/webGLPipelineContext.js.map +1 -1
  81. package/Engines/WebGL/webGLRenderTargetWrapper.js +1 -0
  82. package/Engines/WebGL/webGLRenderTargetWrapper.js.map +1 -1
  83. package/Engines/WebGPU/Extensions/engine.readTexture.js +1 -0
  84. package/Engines/WebGPU/Extensions/engine.readTexture.js.map +1 -1
  85. package/Engines/WebGPU/webgpuCacheBindGroups.d.ts +1 -0
  86. package/Engines/WebGPU/webgpuCacheBindGroups.js +1 -0
  87. package/Engines/WebGPU/webgpuCacheBindGroups.js.map +1 -1
  88. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +3 -0
  89. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  90. package/Engines/WebGPU/webgpuPipelineContext.d.ts +0 -3
  91. package/Engines/WebGPU/webgpuPipelineContext.js +0 -3
  92. package/Engines/WebGPU/webgpuPipelineContext.js.map +1 -1
  93. package/Engines/WebGPU/webgpuShaderProcessingContext.js +1 -0
  94. package/Engines/WebGPU/webgpuShaderProcessingContext.js.map +1 -1
  95. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.d.ts +1 -1
  96. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +11 -2
  97. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
  98. package/Engines/WebGPU/webgpuTextureHelper.js +22 -0
  99. package/Engines/WebGPU/webgpuTextureHelper.js.map +1 -1
  100. package/Engines/WebGPU/webgpuTextureManager.js +2 -1
  101. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  102. package/Engines/WebGPU/webgpuTintWASM.d.ts +1 -1
  103. package/Engines/WebGPU/webgpuTintWASM.js +5 -5
  104. package/Engines/WebGPU/webgpuTintWASM.js.map +1 -1
  105. package/Engines/engine.d.ts +1 -0
  106. package/Engines/engine.js +1 -0
  107. package/Engines/engine.js.map +1 -1
  108. package/Engines/nativeEngine.d.ts +4 -0
  109. package/Engines/nativeEngine.js +5 -0
  110. package/Engines/nativeEngine.js.map +1 -1
  111. package/Engines/thinEngine.js +7 -2
  112. package/Engines/thinEngine.js.map +1 -1
  113. package/Engines/webgpuEngine.d.ts +1 -1
  114. package/Engines/webgpuEngine.js +17 -1
  115. package/Engines/webgpuEngine.js.map +1 -1
  116. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +214 -2
  117. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +214 -6
  118. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
  119. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.d.ts +15 -0
  120. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js +9 -0
  121. package/FlowGraph/Blocks/Data/flowGraphBinaryOperationBlock.js.map +1 -1
  122. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +6 -6
  123. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  124. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.d.ts +4 -0
  125. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js +4 -0
  126. package/FlowGraph/Blocks/Data/flowGraphConditionalDataBlock.js.map +1 -1
  127. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.d.ts +17 -1
  128. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js +14 -1
  129. package/FlowGraph/Blocks/Data/flowGraphConstantBlock.js.map +1 -1
  130. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.d.ts +9 -0
  131. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js +9 -0
  132. package/FlowGraph/Blocks/Data/flowGraphConstantOperationBlock.js.map +1 -1
  133. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.d.ts +5 -0
  134. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js +5 -0
  135. package/FlowGraph/Blocks/Data/flowGraphCoordinateTransformBlock.js.map +1 -1
  136. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.d.ts +16 -1
  137. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js +13 -1
  138. package/FlowGraph/Blocks/Data/flowGraphGetPropertyBlock.js.map +1 -1
  139. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.d.ts +12 -1
  140. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js +12 -1
  141. package/FlowGraph/Blocks/Data/flowGraphGetVariableBlock.js.map +1 -1
  142. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.d.ts +18 -0
  143. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js +9 -0
  144. package/FlowGraph/Blocks/Data/flowGraphTernaryOperationBlock.js.map +1 -1
  145. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.d.ts +12 -0
  146. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js +9 -0
  147. package/FlowGraph/Blocks/Data/flowGraphUnaryOperationBlock.js.map +1 -1
  148. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.d.ts +15 -1
  149. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js +12 -1
  150. package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
  151. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.d.ts +18 -2
  152. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js +15 -4
  153. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
  154. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.d.ts +6 -0
  155. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js +6 -0
  156. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.js.map +1 -1
  157. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.d.ts +6 -0
  158. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js +6 -0
  159. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
  160. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.d.ts +5 -2
  161. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js +4 -1
  162. package/FlowGraph/Blocks/Execution/Animation/flowGraphPauseAnimationBlock.js.map +1 -1
  163. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.d.ts +15 -1
  164. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js +12 -1
  165. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
  166. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.d.ts +4 -1
  167. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js +3 -0
  168. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.js.map +1 -1
  169. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.d.ts +3 -0
  170. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js +3 -0
  171. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphBranchBlock.js.map +1 -1
  172. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.d.ts +3 -0
  173. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js +3 -0
  174. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCounterBlock.js.map +1 -1
  175. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.d.ts +3 -0
  176. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js +3 -0
  177. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDebounceBlock.js.map +1 -1
  178. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.d.ts +14 -1
  179. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js +11 -1
  180. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphDoNBlock.js.map +1 -1
  181. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.d.ts +3 -0
  182. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js +3 -0
  183. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphFlipFlopBlock.js.map +1 -1
  184. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.d.ts +3 -0
  185. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js +3 -0
  186. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.js.map +1 -1
  187. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.d.ts +15 -2
  188. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js +12 -4
  189. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphMultiGateBlock.js.map +1 -1
  190. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.d.ts +14 -2
  191. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js +11 -4
  192. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSequenceBlock.js.map +1 -1
  193. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.d.ts +15 -2
  194. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js +12 -4
  195. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSwitchBlock.js.map +1 -1
  196. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.d.ts +3 -0
  197. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js +3 -0
  198. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphThrottleBlock.js.map +1 -1
  199. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.d.ts +6 -0
  200. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js +6 -0
  201. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphTimerBlock.js.map +1 -1
  202. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.d.ts +15 -2
  203. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js +12 -3
  204. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWaitAllBlock.js.map +1 -1
  205. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.d.ts +18 -1
  206. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js +15 -1
  207. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphWhileLoopBlock.js.map +1 -1
  208. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.d.ts +6 -0
  209. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js +6 -0
  210. package/FlowGraph/Blocks/Execution/flowGraphConsoleLogBlock.js.map +1 -1
  211. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.d.ts +14 -2
  212. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js +11 -4
  213. package/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock.js.map +1 -1
  214. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +15 -1
  215. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +12 -1
  216. package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
  217. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.d.ts +14 -1
  218. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +11 -1
  219. package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
  220. package/FlowGraph/flowGraph.d.ts +16 -8
  221. package/FlowGraph/flowGraph.js +13 -8
  222. package/FlowGraph/flowGraph.js.map +1 -1
  223. package/FlowGraph/flowGraphBlock.d.ts +54 -5
  224. package/FlowGraph/flowGraphBlock.js +50 -11
  225. package/FlowGraph/flowGraphBlock.js.map +1 -1
  226. package/FlowGraph/flowGraphConnection.d.ts +10 -6
  227. package/FlowGraph/flowGraphConnection.js +10 -6
  228. package/FlowGraph/flowGraphConnection.js.map +1 -1
  229. package/FlowGraph/flowGraphContext.d.ts +10 -8
  230. package/FlowGraph/flowGraphContext.js +10 -8
  231. package/FlowGraph/flowGraphContext.js.map +1 -1
  232. package/FlowGraph/flowGraphCoordinator.d.ts +27 -1
  233. package/FlowGraph/flowGraphCoordinator.js +18 -2
  234. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  235. package/FlowGraph/flowGraphDataConnection.d.ts +26 -1
  236. package/FlowGraph/flowGraphDataConnection.js +23 -1
  237. package/FlowGraph/flowGraphDataConnection.js.map +1 -1
  238. package/FlowGraph/flowGraphExecutionBlock.d.ts +27 -1
  239. package/FlowGraph/flowGraphExecutionBlock.js +22 -4
  240. package/FlowGraph/flowGraphExecutionBlock.js.map +1 -1
  241. package/FlowGraph/flowGraphRichTypes.d.ts +24 -1
  242. package/FlowGraph/flowGraphRichTypes.js +18 -1
  243. package/FlowGraph/flowGraphRichTypes.js.map +1 -1
  244. package/FlowGraph/flowGraphSignalConnection.d.ts +2 -0
  245. package/FlowGraph/flowGraphSignalConnection.js +2 -0
  246. package/FlowGraph/flowGraphSignalConnection.js.map +1 -1
  247. package/Gamepads/gamepad.d.ts +2 -2
  248. package/Gamepads/gamepad.js +2 -2
  249. package/Gamepads/gamepad.js.map +1 -1
  250. package/Gamepads/gamepadSceneComponent.js +2 -0
  251. package/Gamepads/gamepadSceneComponent.js.map +1 -1
  252. package/Gizmos/axisScaleGizmo.d.ts +2 -0
  253. package/Gizmos/axisScaleGizmo.js +2 -0
  254. package/Gizmos/axisScaleGizmo.js.map +1 -1
  255. package/Gizmos/boundingBoxGizmo.d.ts +19 -0
  256. package/Gizmos/boundingBoxGizmo.js +36 -15
  257. package/Gizmos/boundingBoxGizmo.js.map +1 -1
  258. package/Gizmos/cameraGizmo.js +1 -0
  259. package/Gizmos/cameraGizmo.js.map +1 -1
  260. package/Gizmos/gizmo.d.ts +4 -1
  261. package/Gizmos/gizmo.js +1 -0
  262. package/Gizmos/gizmo.js.map +1 -1
  263. package/Gizmos/gizmoManager.d.ts +18 -0
  264. package/Gizmos/gizmoManager.js +34 -0
  265. package/Gizmos/gizmoManager.js.map +1 -1
  266. package/Gizmos/lightGizmo.d.ts +1 -0
  267. package/Gizmos/lightGizmo.js +1 -0
  268. package/Gizmos/lightGizmo.js.map +1 -1
  269. package/Gizmos/planeRotationGizmo.d.ts +2 -0
  270. package/Gizmos/planeRotationGizmo.js +2 -0
  271. package/Gizmos/planeRotationGizmo.js.map +1 -1
  272. package/Gizmos/positionGizmo.d.ts +11 -0
  273. package/Gizmos/positionGizmo.js +19 -0
  274. package/Gizmos/positionGizmo.js.map +1 -1
  275. package/Gizmos/rotationGizmo.d.ts +14 -0
  276. package/Gizmos/rotationGizmo.js +14 -0
  277. package/Gizmos/rotationGizmo.js.map +1 -1
  278. package/Gizmos/scaleGizmo.d.ts +18 -1
  279. package/Gizmos/scaleGizmo.js +19 -1
  280. package/Gizmos/scaleGizmo.js.map +1 -1
  281. package/Helpers/environmentHelper.d.ts +4 -2
  282. package/Helpers/environmentHelper.js +4 -2
  283. package/Helpers/environmentHelper.js.map +1 -1
  284. package/Layers/effectLayer.d.ts +1 -0
  285. package/Layers/effectLayer.js +1 -0
  286. package/Layers/effectLayer.js.map +1 -1
  287. package/Layers/glowLayer.d.ts +3 -1
  288. package/Layers/glowLayer.js +3 -1
  289. package/Layers/glowLayer.js.map +1 -1
  290. package/Layers/highlightLayer.d.ts +3 -2
  291. package/Layers/highlightLayer.js +3 -2
  292. package/Layers/highlightLayer.js.map +1 -1
  293. package/Lights/light.d.ts +1 -1
  294. package/Lights/light.js +1 -1
  295. package/Lights/light.js.map +1 -1
  296. package/Loading/sceneLoader.d.ts +9 -0
  297. package/Loading/sceneLoader.js +11 -0
  298. package/Loading/sceneLoader.js.map +1 -1
  299. package/Materials/Background/backgroundMaterial.d.ts +2 -2
  300. package/Materials/Background/backgroundMaterial.js +2 -2
  301. package/Materials/Background/backgroundMaterial.js.map +1 -1
  302. package/Materials/GaussianSplatting/gaussianSplattingMaterial.d.ts +72 -0
  303. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js +230 -0
  304. package/Materials/GaussianSplatting/gaussianSplattingMaterial.js.map +1 -0
  305. package/Materials/GreasedLine/greasedLineMaterialInterfaces.d.ts +1 -1
  306. package/Materials/GreasedLine/greasedLineMaterialInterfaces.js.map +1 -1
  307. package/Materials/GreasedLine/greasedLinePluginMaterial.d.ts +2 -2
  308. package/Materials/GreasedLine/greasedLinePluginMaterial.js +2 -2
  309. package/Materials/GreasedLine/greasedLinePluginMaterial.js.map +1 -1
  310. package/Materials/GreasedLine/greasedLineSimpleMaterial.d.ts +0 -1
  311. package/Materials/GreasedLine/greasedLineSimpleMaterial.js +0 -1
  312. package/Materials/GreasedLine/greasedLineSimpleMaterial.js.map +1 -1
  313. package/Materials/Node/Blocks/Dual/index.d.ts +1 -0
  314. package/Materials/Node/Blocks/Dual/index.js +1 -0
  315. package/Materials/Node/Blocks/Dual/index.js.map +1 -1
  316. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.d.ts +7 -1
  317. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js +6 -1
  318. package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.js.map +1 -1
  319. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js +1 -0
  320. package/Materials/Node/Blocks/Fragment/fragCoordBlock.js.map +1 -1
  321. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js +1 -0
  322. package/Materials/Node/Blocks/Fragment/frontFacingBlock.js.map +1 -1
  323. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js +1 -0
  324. package/Materials/Node/Blocks/Fragment/screenSizeBlock.js.map +1 -1
  325. package/Materials/Node/Blocks/Input/prePassTextureBlock.d.ts +1 -1
  326. package/Materials/Node/Blocks/Input/prePassTextureBlock.js +1 -1
  327. package/Materials/Node/Blocks/Input/prePassTextureBlock.js.map +1 -1
  328. package/Materials/Node/Blocks/Teleport/teleportInBlock.d.ts +3 -1
  329. package/Materials/Node/Blocks/Teleport/teleportInBlock.js +3 -1
  330. package/Materials/Node/Blocks/Teleport/teleportInBlock.js.map +1 -1
  331. package/Materials/Node/Blocks/triPlanarBlock.d.ts +1 -0
  332. package/Materials/Node/Blocks/triPlanarBlock.js +1 -0
  333. package/Materials/Node/Blocks/triPlanarBlock.js.map +1 -1
  334. package/Materials/Node/Blocks/worleyNoise3DBlock.d.ts +2 -0
  335. package/Materials/Node/Blocks/worleyNoise3DBlock.js +2 -0
  336. package/Materials/Node/Blocks/worleyNoise3DBlock.js.map +1 -1
  337. package/Materials/Node/nodeMaterial.d.ts +11 -3
  338. package/Materials/Node/nodeMaterial.js +15 -3
  339. package/Materials/Node/nodeMaterial.js.map +1 -1
  340. package/Materials/Node/nodeMaterialBlock.d.ts +3 -1
  341. package/Materials/Node/nodeMaterialBlock.js +4 -1
  342. package/Materials/Node/nodeMaterialBlock.js.map +1 -1
  343. package/Materials/Node/nodeMaterialBlockConnectionPoint.js +1 -0
  344. package/Materials/Node/nodeMaterialBlockConnectionPoint.js.map +1 -1
  345. package/Materials/Node/nodeMaterialBuildStateSharedData.js +1 -0
  346. package/Materials/Node/nodeMaterialBuildStateSharedData.js.map +1 -1
  347. package/Materials/PBR/pbrBaseMaterial.d.ts +10 -9
  348. package/Materials/PBR/pbrBaseMaterial.js +10 -9
  349. package/Materials/PBR/pbrBaseMaterial.js.map +1 -1
  350. package/Materials/PBR/pbrMaterial.d.ts +2 -1
  351. package/Materials/PBR/pbrMaterial.js +3 -2
  352. package/Materials/PBR/pbrMaterial.js.map +1 -1
  353. package/Materials/PBR/pbrMetallicRoughnessMaterial.d.ts +7 -4
  354. package/Materials/PBR/pbrMetallicRoughnessMaterial.js +7 -4
  355. package/Materials/PBR/pbrMetallicRoughnessMaterial.js.map +1 -1
  356. package/Materials/PBR/pbrSpecularGlossinessMaterial.d.ts +7 -4
  357. package/Materials/PBR/pbrSpecularGlossinessMaterial.js +7 -4
  358. package/Materials/PBR/pbrSpecularGlossinessMaterial.js.map +1 -1
  359. package/Materials/Textures/Loaders/envTextureLoader.js +1 -0
  360. package/Materials/Textures/Loaders/envTextureLoader.js.map +1 -1
  361. package/Materials/Textures/Loaders/hdrTextureLoader.js +1 -0
  362. package/Materials/Textures/Loaders/hdrTextureLoader.js.map +1 -1
  363. package/Materials/Textures/Loaders/tgaTextureLoader.js +1 -0
  364. package/Materials/Textures/Loaders/tgaTextureLoader.js.map +1 -1
  365. package/Materials/Textures/Packer/packer.d.ts +0 -1
  366. package/Materials/Textures/Packer/packer.js +0 -1
  367. package/Materials/Textures/Packer/packer.js.map +1 -1
  368. package/Materials/Textures/Procedurals/noiseProceduralTexture.d.ts +1 -1
  369. package/Materials/Textures/Procedurals/noiseProceduralTexture.js +1 -1
  370. package/Materials/Textures/Procedurals/noiseProceduralTexture.js.map +1 -1
  371. package/Materials/Textures/baseTexture.js +3 -0
  372. package/Materials/Textures/baseTexture.js.map +1 -1
  373. package/Materials/Textures/colorGradingTexture.d.ts +4 -1
  374. package/Materials/Textures/colorGradingTexture.js +4 -1
  375. package/Materials/Textures/colorGradingTexture.js.map +1 -1
  376. package/Materials/Textures/equiRectangularCubeTexture.d.ts +1 -0
  377. package/Materials/Textures/equiRectangularCubeTexture.js +1 -0
  378. package/Materials/Textures/equiRectangularCubeTexture.js.map +1 -1
  379. package/Materials/Textures/hdrCubeTexture.d.ts +3 -2
  380. package/Materials/Textures/hdrCubeTexture.js +3 -2
  381. package/Materials/Textures/hdrCubeTexture.js.map +1 -1
  382. package/Materials/Textures/htmlElementTexture.d.ts +1 -1
  383. package/Materials/Textures/htmlElementTexture.js +1 -1
  384. package/Materials/Textures/htmlElementTexture.js.map +1 -1
  385. package/Materials/Textures/multiRenderTarget.d.ts +1 -1
  386. package/Materials/Textures/multiRenderTarget.js +1 -1
  387. package/Materials/Textures/multiRenderTarget.js.map +1 -1
  388. package/Materials/Textures/texture.d.ts +4 -1
  389. package/Materials/Textures/texture.js +4 -1
  390. package/Materials/Textures/texture.js.map +1 -1
  391. package/Materials/Textures/thinRenderTargetTexture.d.ts +1 -1
  392. package/Materials/Textures/thinRenderTargetTexture.js +1 -1
  393. package/Materials/Textures/thinRenderTargetTexture.js.map +1 -1
  394. package/Materials/Textures/thinTexture.js +3 -0
  395. package/Materials/Textures/thinTexture.js.map +1 -1
  396. package/Materials/index.d.ts +1 -0
  397. package/Materials/index.js +1 -0
  398. package/Materials/index.js.map +1 -1
  399. package/Materials/material.d.ts +2 -1
  400. package/Materials/material.decalMapConfiguration.d.ts +0 -5
  401. package/Materials/material.decalMapConfiguration.js +5 -5
  402. package/Materials/material.decalMapConfiguration.js.map +1 -1
  403. package/Materials/material.js +3 -2
  404. package/Materials/material.js.map +1 -1
  405. package/Materials/materialHelper.d.ts +1 -1
  406. package/Materials/materialHelper.js +4 -3
  407. package/Materials/materialHelper.js.map +1 -1
  408. package/Materials/materialPluginManager.js +1 -0
  409. package/Materials/materialPluginManager.js.map +1 -1
  410. package/Materials/standardMaterial.d.ts +2 -2
  411. package/Materials/standardMaterial.js +3 -3
  412. package/Materials/standardMaterial.js.map +1 -1
  413. package/Materials/uniformBuffer.js +2 -1
  414. package/Materials/uniformBuffer.js.map +1 -1
  415. package/Maths/math.like.d.ts +3 -0
  416. package/Maths/math.like.js.map +1 -1
  417. package/Maths/math.path.d.ts +2 -1
  418. package/Maths/math.path.js +2 -1
  419. package/Maths/math.path.js.map +1 -1
  420. package/Maths/math.polar.d.ts +3 -2
  421. package/Maths/math.polar.js +8 -2
  422. package/Maths/math.polar.js.map +1 -1
  423. package/Maths/math.vector.d.ts +12 -5
  424. package/Maths/math.vector.js +12 -5
  425. package/Maths/math.vector.js.map +1 -1
  426. package/Meshes/Builders/hemisphereBuilder.js +1 -0
  427. package/Meshes/Builders/hemisphereBuilder.js.map +1 -1
  428. package/Meshes/Builders/textBuilder.d.ts +26 -5
  429. package/Meshes/Builders/textBuilder.js +26 -5
  430. package/Meshes/Builders/textBuilder.js.map +1 -1
  431. package/Meshes/GaussianSplatting/gaussianSplattingMesh.d.ts +84 -0
  432. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js +288 -0
  433. package/Meshes/GaussianSplatting/gaussianSplattingMesh.js.map +1 -0
  434. package/Meshes/GreasedLine/greasedLineBaseMesh.d.ts +2 -0
  435. package/Meshes/GreasedLine/greasedLineBaseMesh.js +2 -0
  436. package/Meshes/GreasedLine/greasedLineBaseMesh.js.map +1 -1
  437. package/Meshes/GreasedLine/greasedLineRibbonMesh.d.ts +2 -0
  438. package/Meshes/GreasedLine/greasedLineRibbonMesh.js +9 -0
  439. package/Meshes/GreasedLine/greasedLineRibbonMesh.js.map +1 -1
  440. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.d.ts +1 -1
  441. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js +1 -1
  442. package/Meshes/Node/Blocks/Textures/geometryTextureBlock.js.map +1 -1
  443. package/Meshes/Node/Blocks/geometryCurveBlock.d.ts +92 -0
  444. package/Meshes/Node/Blocks/geometryCurveBlock.js +292 -0
  445. package/Meshes/Node/Blocks/geometryCurveBlock.js.map +1 -0
  446. package/Meshes/Node/Blocks/noiseBlock.d.ts +5 -3
  447. package/Meshes/Node/Blocks/noiseBlock.js +5 -3
  448. package/Meshes/Node/Blocks/noiseBlock.js.map +1 -1
  449. package/Meshes/Node/index.d.ts +1 -0
  450. package/Meshes/Node/index.js +1 -0
  451. package/Meshes/Node/index.js.map +1 -1
  452. package/Meshes/Node/nodeGeometry.d.ts +6 -2
  453. package/Meshes/Node/nodeGeometry.js +7 -2
  454. package/Meshes/Node/nodeGeometry.js.map +1 -1
  455. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js +1 -0
  456. package/Meshes/Node/nodeGeometryBlockConnectionPoint.js.map +1 -1
  457. package/Meshes/Node/nodeGeometryBuildState.js +1 -0
  458. package/Meshes/Node/nodeGeometryBuildState.js.map +1 -1
  459. package/Meshes/abstractMesh.d.ts +1 -0
  460. package/Meshes/abstractMesh.js +3 -0
  461. package/Meshes/abstractMesh.js.map +1 -1
  462. package/Meshes/csg.d.ts +7 -1
  463. package/Meshes/csg.js +9 -1
  464. package/Meshes/csg.js.map +1 -1
  465. package/Meshes/geodesicMesh.d.ts +32 -1
  466. package/Meshes/geodesicMesh.js +17 -1
  467. package/Meshes/geodesicMesh.js.map +1 -1
  468. package/Meshes/index.d.ts +1 -0
  469. package/Meshes/index.js +1 -0
  470. package/Meshes/index.js.map +1 -1
  471. package/Meshes/instancedMesh.d.ts +34 -17
  472. package/Meshes/instancedMesh.js +34 -17
  473. package/Meshes/instancedMesh.js.map +1 -1
  474. package/Meshes/linesMesh.d.ts +6 -5
  475. package/Meshes/linesMesh.js +6 -5
  476. package/Meshes/linesMesh.js.map +1 -1
  477. package/Meshes/mesh.d.ts +1 -0
  478. package/Meshes/mesh.js +1 -0
  479. package/Meshes/mesh.js.map +1 -1
  480. package/Meshes/mesh.vertexData.d.ts +0 -145
  481. package/Meshes/mesh.vertexData.js +0 -145
  482. package/Meshes/mesh.vertexData.js.map +1 -1
  483. package/Meshes/transformNode.d.ts +1 -1
  484. package/Meshes/transformNode.js +19 -1
  485. package/Meshes/transformNode.js.map +1 -1
  486. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.d.ts +1 -0
  487. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js +1 -0
  488. package/Misc/HighDynamicRange/cubemapToSphericalPolynomial.js.map +1 -1
  489. package/Misc/HighDynamicRange/hdr.d.ts +1 -0
  490. package/Misc/HighDynamicRange/hdr.js +8 -0
  491. package/Misc/HighDynamicRange/hdr.js.map +1 -1
  492. package/Misc/HighDynamicRange/panoramaToCubemap.d.ts +1 -0
  493. package/Misc/HighDynamicRange/panoramaToCubemap.js +3 -0
  494. package/Misc/HighDynamicRange/panoramaToCubemap.js.map +1 -1
  495. package/Misc/assetsManager.d.ts +3 -0
  496. package/Misc/assetsManager.js +3 -0
  497. package/Misc/assetsManager.js.map +1 -1
  498. package/Misc/basis.js +1 -0
  499. package/Misc/basis.js.map +1 -1
  500. package/Misc/decorators.d.ts +2 -0
  501. package/Misc/decorators.js +3 -1
  502. package/Misc/decorators.js.map +1 -1
  503. package/Misc/fileTools.js +2 -0
  504. package/Misc/fileTools.js.map +1 -1
  505. package/Misc/filesInput.d.ts +7 -2
  506. package/Misc/filesInput.js +7 -2
  507. package/Misc/filesInput.js.map +1 -1
  508. package/Misc/greasedLineTools.d.ts +6 -1
  509. package/Misc/greasedLineTools.js +6 -1
  510. package/Misc/greasedLineTools.js.map +1 -1
  511. package/Misc/textureTools.d.ts +2 -0
  512. package/Misc/textureTools.js +2 -0
  513. package/Misc/textureTools.js.map +1 -1
  514. package/Misc/timer.d.ts +2 -1
  515. package/Misc/timer.js +1 -0
  516. package/Misc/timer.js.map +1 -1
  517. package/Misc/tools.d.ts +5 -1
  518. package/Misc/tools.js +9 -1
  519. package/Misc/tools.js.map +1 -1
  520. package/Misc/videoRecorder.d.ts +4 -1
  521. package/Misc/videoRecorder.js +11 -5
  522. package/Misc/videoRecorder.js.map +1 -1
  523. package/Misc/webRequest.d.ts +3 -0
  524. package/Misc/webRequest.js +4 -1
  525. package/Misc/webRequest.js.map +1 -1
  526. package/Morph/morphTargetManager.d.ts +11 -0
  527. package/Morph/morphTargetManager.js +22 -2
  528. package/Morph/morphTargetManager.js.map +1 -1
  529. package/Particles/EmitterTypes/customParticleEmitter.js +10 -2
  530. package/Particles/EmitterTypes/customParticleEmitter.js.map +1 -1
  531. package/Particles/EmitterTypes/cylinderParticleEmitter.d.ts +3 -1
  532. package/Particles/EmitterTypes/cylinderParticleEmitter.js +7 -1
  533. package/Particles/EmitterTypes/cylinderParticleEmitter.js.map +1 -1
  534. package/Particles/IParticleSystem.d.ts +2 -2
  535. package/Particles/IParticleSystem.js.map +1 -1
  536. package/Particles/gpuParticleSystem.js +1 -0
  537. package/Particles/gpuParticleSystem.js.map +1 -1
  538. package/Particles/particleSystem.d.ts +1 -2
  539. package/Particles/particleSystem.js +5 -1
  540. package/Particles/particleSystem.js.map +1 -1
  541. package/Particles/solidParticleSystem.d.ts +1 -1
  542. package/Particles/solidParticleSystem.js +1 -1
  543. package/Particles/solidParticleSystem.js.map +1 -1
  544. package/Physics/physicsHelper.d.ts +3 -2
  545. package/Physics/physicsHelper.js +5 -4
  546. package/Physics/physicsHelper.js.map +1 -1
  547. package/Physics/physicsRaycastResult.d.ts +2 -1
  548. package/Physics/physicsRaycastResult.js +2 -1
  549. package/Physics/physicsRaycastResult.js.map +1 -1
  550. package/Physics/v1/Plugins/ammoJSPlugin.d.ts +5 -0
  551. package/Physics/v1/Plugins/ammoJSPlugin.js +6 -0
  552. package/Physics/v1/Plugins/ammoJSPlugin.js.map +1 -1
  553. package/Physics/v1/physicsEngine.d.ts +2 -0
  554. package/Physics/v1/physicsEngine.js +2 -0
  555. package/Physics/v1/physicsEngine.js.map +1 -1
  556. package/Physics/v1/physicsImpostor.d.ts +2 -3
  557. package/Physics/v1/physicsImpostor.js +2 -3
  558. package/Physics/v1/physicsImpostor.js.map +1 -1
  559. package/Physics/v2/IPhysicsEnginePlugin.d.ts +1 -0
  560. package/Physics/v2/IPhysicsEnginePlugin.js.map +1 -1
  561. package/Physics/v2/Plugins/havokPlugin.d.ts +61 -10
  562. package/Physics/v2/Plugins/havokPlugin.js +89 -10
  563. package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
  564. package/Physics/v2/physicsBody.d.ts +41 -3
  565. package/Physics/v2/physicsBody.js +42 -9
  566. package/Physics/v2/physicsBody.js.map +1 -1
  567. package/Physics/v2/physicsConstraint.d.ts +0 -2
  568. package/Physics/v2/physicsConstraint.js +0 -2
  569. package/Physics/v2/physicsConstraint.js.map +1 -1
  570. package/Physics/v2/physicsEngine.d.ts +5 -3
  571. package/Physics/v2/physicsEngine.js +6 -3
  572. package/Physics/v2/physicsEngine.js.map +1 -1
  573. package/Physics/v2/physicsShape.d.ts +2 -0
  574. package/Physics/v2/physicsShape.js +5 -0
  575. package/Physics/v2/physicsShape.js.map +1 -1
  576. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -1
  577. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +1 -1
  578. package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
  579. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +1 -1
  580. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +1 -1
  581. package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
  582. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.d.ts +1 -1
  583. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js +1 -1
  584. package/PostProcesses/RenderPipeline/Pipelines/ssrRenderingPipeline.js.map +1 -1
  585. package/PostProcesses/motionBlurPostProcess.d.ts +1 -0
  586. package/PostProcesses/motionBlurPostProcess.js +1 -0
  587. package/PostProcesses/motionBlurPostProcess.js.map +1 -1
  588. package/PostProcesses/postProcess.d.ts +0 -1
  589. package/PostProcesses/postProcess.js +0 -1
  590. package/PostProcesses/postProcess.js.map +1 -1
  591. package/PostProcesses/volumetricLightScatteringPostProcess.d.ts +1 -1
  592. package/PostProcesses/volumetricLightScatteringPostProcess.js +1 -1
  593. package/PostProcesses/volumetricLightScatteringPostProcess.js.map +1 -1
  594. package/Rendering/GlobalIllumination/giRSMManager.d.ts +2 -1
  595. package/Rendering/GlobalIllumination/giRSMManager.js +5 -2
  596. package/Rendering/GlobalIllumination/giRSMManager.js.map +1 -1
  597. package/Rendering/depthRendererSceneComponent.js +1 -0
  598. package/Rendering/depthRendererSceneComponent.js.map +1 -1
  599. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +1 -1
  600. package/Rendering/fluidRenderer/fluidRenderingObject.js +1 -1
  601. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  602. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +1 -1
  603. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +1 -1
  604. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  605. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +1 -1
  606. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +1 -1
  607. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  608. package/Rendering/geometryBufferRenderer.d.ts +2 -2
  609. package/Rendering/geometryBufferRenderer.js +2 -2
  610. package/Rendering/geometryBufferRenderer.js.map +1 -1
  611. package/Rendering/index.d.ts +0 -1
  612. package/Rendering/index.js +0 -1
  613. package/Rendering/index.js.map +1 -1
  614. package/Rendering/prePassRenderer.d.ts +2 -2
  615. package/Rendering/prePassRenderer.js +2 -2
  616. package/Rendering/prePassRenderer.js.map +1 -1
  617. package/Rendering/reflectiveShadowMap.d.ts +4 -0
  618. package/Rendering/reflectiveShadowMap.js +7 -0
  619. package/Rendering/reflectiveShadowMap.js.map +1 -1
  620. package/Rendering/renderingGroup.d.ts +0 -1
  621. package/Rendering/renderingGroup.js +3 -4
  622. package/Rendering/renderingGroup.js.map +1 -1
  623. package/Rendering/renderingManager.d.ts +2 -1
  624. package/Rendering/renderingManager.js +2 -1
  625. package/Rendering/renderingManager.js.map +1 -1
  626. package/Rendering/subSurfaceConfiguration.d.ts +1 -0
  627. package/Rendering/subSurfaceConfiguration.js +1 -0
  628. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  629. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.d.ts +7 -0
  630. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js +13 -0
  631. package/Shaders/ShadersInclude/gaussianSplattingUboDeclaration.js.map +1 -0
  632. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.d.ts +5 -0
  633. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js +10 -0
  634. package/Shaders/ShadersInclude/gaussianSplattingVertexDeclaration.js.map +1 -0
  635. package/Shaders/ShadersInclude/morphTargetsVertex.js +8 -5
  636. package/Shaders/ShadersInclude/morphTargetsVertex.js.map +1 -1
  637. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
  638. package/Shaders/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  639. package/Shaders/gaussianSplatting.fragment.d.ts +11 -0
  640. package/Shaders/gaussianSplatting.fragment.js +27 -0
  641. package/Shaders/gaussianSplatting.fragment.js.map +1 -0
  642. package/Shaders/gaussianSplatting.vertex.d.ts +13 -0
  643. package/Shaders/gaussianSplatting.vertex.js +49 -0
  644. package/Shaders/gaussianSplatting.vertex.js.map +1 -0
  645. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js +5 -1
  646. package/ShadersWGSL/ShadersInclude/morphTargetsVertex.js.map +1 -1
  647. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js +2 -0
  648. package/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.js.map +1 -1
  649. package/XR/features/WebXRAbstractFeature.d.ts +7 -1
  650. package/XR/features/WebXRAbstractFeature.js +20 -4
  651. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  652. package/XR/features/WebXRAnchorSystem.d.ts +1 -0
  653. package/XR/features/WebXRAnchorSystem.js +1 -0
  654. package/XR/features/WebXRAnchorSystem.js.map +1 -1
  655. package/XR/features/WebXRControllerTeleportation.js +9 -2
  656. package/XR/features/WebXRControllerTeleportation.js.map +1 -1
  657. package/XR/features/WebXRDepthSensing.d.ts +1 -1
  658. package/XR/features/WebXRDepthSensing.js +1 -1
  659. package/XR/features/WebXRDepthSensing.js.map +1 -1
  660. package/XR/features/WebXREyeTracking.js +1 -1
  661. package/XR/features/WebXREyeTracking.js.map +1 -1
  662. package/XR/features/WebXRHandTracking.d.ts +4 -1
  663. package/XR/features/WebXRHandTracking.js +18 -4
  664. package/XR/features/WebXRHandTracking.js.map +1 -1
  665. package/XR/features/WebXRHitTest.js +1 -1
  666. package/XR/features/WebXRHitTest.js.map +1 -1
  667. package/XR/features/WebXRNearInteraction.d.ts +6 -3
  668. package/XR/features/WebXRNearInteraction.js +9 -4
  669. package/XR/features/WebXRNearInteraction.js.map +1 -1
  670. package/XR/features/WebXRPlaneDetector.d.ts +2 -0
  671. package/XR/features/WebXRPlaneDetector.js +2 -0
  672. package/XR/features/WebXRPlaneDetector.js.map +1 -1
  673. package/XR/features/WebXRRawCameraAccess.d.ts +2 -0
  674. package/XR/features/WebXRRawCameraAccess.js +2 -0
  675. package/XR/features/WebXRRawCameraAccess.js.map +1 -1
  676. package/XR/features/WebXRSpaceWarp.d.ts +0 -27
  677. package/XR/features/WebXRSpaceWarp.js +0 -27
  678. package/XR/features/WebXRSpaceWarp.js.map +1 -1
  679. package/XR/index.d.ts +1 -0
  680. package/XR/index.js +1 -0
  681. package/XR/index.js.map +1 -1
  682. package/XR/motionController/webXROculusTouchMotionController.d.ts +1 -0
  683. package/XR/motionController/webXROculusTouchMotionController.js +1 -0
  684. package/XR/motionController/webXROculusTouchMotionController.js.map +1 -1
  685. package/XR/webXRCamera.d.ts +2 -0
  686. package/XR/webXRCamera.js +8 -6
  687. package/XR/webXRCamera.js.map +1 -1
  688. package/XR/webXRExperienceHelper.js +1 -0
  689. package/XR/webXRExperienceHelper.js.map +1 -1
  690. package/XR/webXRInput.js +1 -1
  691. package/XR/webXRInput.js.map +1 -1
  692. package/XR/webXRInputSource.d.ts +3 -1
  693. package/XR/webXRInputSource.js +6 -3
  694. package/XR/webXRInputSource.js.map +1 -1
  695. package/XR/webXRSessionManager.d.ts +13 -0
  696. package/XR/webXRSessionManager.js +21 -1
  697. package/XR/webXRSessionManager.js.map +1 -1
  698. package/assetContainer.d.ts +5 -2
  699. package/assetContainer.js +5 -2
  700. package/assetContainer.js.map +1 -1
  701. package/package.json +1 -1
  702. package/scene.d.ts +1 -0
  703. package/scene.js +11 -0
  704. package/scene.js.map +1 -1
  705. package/Rendering/GaussianSplatting/gaussianSplatting.d.ts +0 -81
  706. package/Rendering/GaussianSplatting/gaussianSplatting.js +0 -400
  707. package/Rendering/GaussianSplatting/gaussianSplatting.js.map +0 -1
  708. package/Rendering/GaussianSplatting/index.d.ts +0 -1
  709. package/Rendering/GaussianSplatting/index.js +0 -2
  710. package/Rendering/GaussianSplatting/index.js.map +0 -1
@@ -2,7 +2,9 @@
2
2
  import { ShaderStore } from "../../Engines/shaderStore.js";
3
3
  const name = "morphTargetsVertex";
4
4
  const shader = `#ifdef MORPHTARGETS
5
- #ifdef MORPHTARGETS_TEXTURE
5
+ #ifdef MORPHTARGETS_TEXTURE
6
+ #if {X}==0
7
+ for (var i=0; i<$NUM_MORPH_INFLUENCERS$; i=i+1) {if (i>=uniforms.morphTargetCount) {break;}
6
8
  vertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x;positionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;
7
9
  #ifdef MORPHTARGETS_NORMAL
8
10
  normalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;
@@ -13,6 +15,8 @@ uvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-vertexInputs.uv)
13
15
  #ifdef MORPHTARGETS_TANGENT
14
16
  tangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];
15
17
  #endif
18
+ }
19
+ #endif
16
20
  #else
17
21
  positionUpdated=positionUpdated+(position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];
18
22
  #ifdef MORPHTARGETS_NORMAL
@@ -1 +1 @@
1
- {"version":3,"file":"morphTargetsVertex.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/morphTargetsVertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"morphTargetsVertex\";\nconst shader = `#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE \nvertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x;positionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#else\npositionUpdated=positionUpdated+(position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(tangent{X}-vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(uv_{X}-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const morphTargetsVertex = { name, shader };\n"]}
1
+ {"version":3,"file":"morphTargetsVertex.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/morphTargetsVertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6Bd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"morphTargetsVertex\";\nconst shader = `#ifdef MORPHTARGETS\n#ifdef MORPHTARGETS_TEXTURE\n#if {X}==0\nfor (var i=0; i<$NUM_MORPH_INFLUENCERS$; i=i+1) {if (i>=uniforms.morphTargetCount) {break;}\nvertexID=f32(vertexInputs.vertexIndex)*uniforms.morphTargetTextureInfo.x;positionUpdated=positionUpdated+(readVector3FromRawSampler({X},vertexID)-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated=normalUpdated+(readVector3FromRawSampler({X},vertexID) -vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(readVector3FromRawSampler({X},vertexID).xy-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];vertexID=vertexID+1.0;\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(readVector3FromRawSampler({X},vertexID) -vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n}\n#endif\n#else\npositionUpdated=positionUpdated+(position{X}-vertexInputs.position)*uniforms.morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-vertexInputs.normal)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz=tangentUpdated.xyz+(tangent{X}-vertexInputs.tangent.xyz)*uniforms.morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_UV\nuvUpdated=uvUpdated+(uv_{X}-vertexInputs.uv)*uniforms.morphTargetInfluences[{X}];\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const morphTargetsVertex = { name, shader };\n"]}
@@ -13,6 +13,8 @@ attribute tangent{X} : vec3<f32>;
13
13
  #ifdef MORPHTARGETS_UV
14
14
  attribute uv_{X} : vec2<f32>;
15
15
  #endif
16
+ #elif {X}==0
17
+ uniform morphTargetCount: i32;
16
18
  #endif
17
19
  #endif
18
20
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"morphTargetsVertexDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;CAcd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"morphTargetsVertexDeclaration\";\nconst shader = `#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute position{X} : vec3<f32>;\n#ifdef MORPHTARGETS_NORMAL\nattribute normal{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute tangent{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_UV\nattribute uv_{X} : vec2<f32>;\n#endif\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const morphTargetsVertexDeclaration = { name, shader };\n"]}
1
+ {"version":3,"file":"morphTargetsVertexDeclaration.js","sourceRoot":"","sources":["../../../../../dev/core/src/ShadersWGSL/ShadersInclude/morphTargetsVertexDeclaration.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,MAAM,IAAI,GAAG,+BAA+B,CAAC;AAC7C,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;CAgBd,CAAC;AACF,aAAa;AACb,WAAW,CAAC,wBAAwB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AACpD,gBAAgB;AAChB,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../../Engines/shaderStore\";\n\nconst name = \"morphTargetsVertexDeclaration\";\nconst shader = `#ifdef MORPHTARGETS\n#ifndef MORPHTARGETS_TEXTURE\nattribute position{X} : vec3<f32>;\n#ifdef MORPHTARGETS_NORMAL\nattribute normal{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute tangent{X} : vec3<f32>;\n#endif\n#ifdef MORPHTARGETS_UV\nattribute uv_{X} : vec2<f32>;\n#endif\n#elif {X}==0\nuniform morphTargetCount: i32;\n#endif\n#endif\n`;\n// Sideeffect\nShaderStore.IncludesShadersStoreWGSL[name] = shader;\n/** @internal */\nexport const morphTargetsVertexDeclaration = { name, shader };\n"]}
@@ -19,10 +19,12 @@ export declare abstract class WebXRAbstractFeature implements IWebXRFeature {
19
19
  * Should auto-attach be disabled?
20
20
  */
21
21
  disableAutoAttach: boolean;
22
+ protected _xrNativeFeatureName: string;
22
23
  /**
23
24
  * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
24
25
  */
25
- xrNativeFeatureName: string;
26
+ get xrNativeFeatureName(): string;
27
+ set xrNativeFeatureName(name: string);
26
28
  /**
27
29
  * Observers registered here will be executed when the feature is attached
28
30
  */
@@ -31,6 +33,10 @@ export declare abstract class WebXRAbstractFeature implements IWebXRFeature {
31
33
  * Observers registered here will be executed when the feature is detached
32
34
  */
33
35
  onFeatureDetachObservable: Observable<IWebXRFeature>;
36
+ /**
37
+ * The dependencies of this feature, if any
38
+ */
39
+ dependsOn?: string[];
34
40
  /**
35
41
  * Construct a new (abstract) WebXR feature
36
42
  * @param _xrSessionManager the xr session manager for this feature
@@ -1,10 +1,24 @@
1
1
  import { Observable } from "../../Misc/observable.js";
2
+ import { Logger } from "../../Misc/logger.js";
2
3
  /**
3
4
  * This is the base class for all WebXR features.
4
5
  * Since most features require almost the same resources and callbacks, this class can be used to simplify the development
5
6
  * Note that since the features manager is using the `IWebXRFeature` you are in no way obligated to use this class
6
7
  */
7
8
  export class WebXRAbstractFeature {
9
+ /**
10
+ * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
11
+ */
12
+ get xrNativeFeatureName() {
13
+ return this._xrNativeFeatureName;
14
+ }
15
+ set xrNativeFeatureName(name) {
16
+ // check if feature was initialized while in session but needs to be initialized before the session starts
17
+ if (!this._xrSessionManager.isNative && name && this._xrSessionManager.inXRSession && this._xrSessionManager.session.enabledFeatures.indexOf(name) === -1) {
18
+ Logger.Warn(`The feature ${name} needs to be enabled before starting the XR session. Note - It is still possible it is not supported.`);
19
+ }
20
+ this._xrNativeFeatureName = name;
21
+ }
8
22
  /**
9
23
  * Construct a new (abstract) WebXR feature
10
24
  * @param _xrSessionManager the xr session manager for this feature
@@ -21,10 +35,7 @@ export class WebXRAbstractFeature {
21
35
  * Should auto-attach be disabled?
22
36
  */
23
37
  this.disableAutoAttach = false;
24
- /**
25
- * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
26
- */
27
- this.xrNativeFeatureName = "";
38
+ this._xrNativeFeatureName = "";
28
39
  /**
29
40
  * Observers registered here will be executed when the feature is attached
30
41
  */
@@ -62,6 +73,11 @@ export class WebXRAbstractFeature {
62
73
  this.detach();
63
74
  }
64
75
  }
76
+ // if this is a native WebXR feature, check if it is enabled on the session
77
+ // For now only check if not using babylon native
78
+ if (!this._xrSessionManager.isNative && this.xrNativeFeatureName && this._xrSessionManager.session.enabledFeatures.indexOf(this.xrNativeFeatureName) === -1) {
79
+ return false;
80
+ }
65
81
  this._attached = true;
66
82
  this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, (frame) => this._onXRFrame(frame));
67
83
  this.onFeatureAttachObservable.notifyObservers(this);
@@ -1 +1 @@
1
- {"version":3,"file":"WebXRAbstractFeature.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRAbstractFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD;;;;GAIG;AACH,MAAM,OAAgB,oBAAoB;IA+BtC;;;OAGG;IACH,YAAsB,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;QAlCpD,cAAS,GAAY,KAAK,CAAC;QAC3B,oBAAe,GAGjB,EAAE,CAAC;QAET;;WAEG;QACI,eAAU,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACI,sBAAiB,GAAY,KAAK,CAAC;QAE1C;;WAEG;QACI,wBAAmB,GAAW,EAAE,CAAC;QAExC;;WAEG;QACI,8BAAyB,GAA8B,IAAI,UAAU,EAAE,CAAC;QAC/E;;WAEG;QACI,8BAAyB,GAA8B,IAAI,UAAU,EAAE,CAAC;IAMhB,CAAC;IAEhE;;OAEG;IACH,IAAW,QAAQ;QACf,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,KAAe;QACzB,mCAAmC;QACnC,IAAI,IAAI,CAAC,UAAU,EAAE;YACjB,OAAO,KAAK,CAAC;SAChB;QACD,IAAI,CAAC,KAAK,EAAE;YACR,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,OAAO,KAAK,CAAC;aAChB;SACJ;aAAM;YACH,IAAI,IAAI,CAAC,QAAQ,EAAE;gBACf,2BAA2B;gBAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;aACjB;SACJ;QAED,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1G,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACI,MAAM;QACT,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;YACjB,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;YAC9B,OAAO,KAAK,CAAC;SAChB;QACD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACtC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,YAAY;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACO,qBAAqB,CAAI,UAAyB,EAAE,QAAwD;QAClH,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YACtB,UAAU;YACV,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;SACrC,CAAC,CAAC;IACP,CAAC;CAQJ","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport type { Observer, EventState } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\n\r\n/**\r\n * This is the base class for all WebXR features.\r\n * Since most features require almost the same resources and callbacks, this class can be used to simplify the development\r\n * Note that since the features manager is using the `IWebXRFeature` you are in no way obligated to use this class\r\n */\r\nexport abstract class WebXRAbstractFeature implements IWebXRFeature {\r\n private _attached: boolean = false;\r\n private _removeOnDetach: {\r\n observer: Nullable<Observer<any>>;\r\n observable: Observable<any>;\r\n }[] = [];\r\n\r\n /**\r\n * Is this feature disposed?\r\n */\r\n public isDisposed: boolean = false;\r\n\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n public disableAutoAttach: boolean = false;\r\n\r\n /**\r\n * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)\r\n */\r\n public xrNativeFeatureName: string = \"\";\r\n\r\n /**\r\n * Observers registered here will be executed when the feature is attached\r\n */\r\n public onFeatureAttachObservable: Observable<IWebXRFeature> = new Observable();\r\n /**\r\n * Observers registered here will be executed when the feature is detached\r\n */\r\n public onFeatureDetachObservable: Observable<IWebXRFeature> = new Observable();\r\n\r\n /**\r\n * Construct a new (abstract) WebXR feature\r\n * @param _xrSessionManager the xr session manager for this feature\r\n */\r\n constructor(protected _xrSessionManager: WebXRSessionManager) {}\r\n\r\n /**\r\n * Is this feature attached\r\n */\r\n public get attached() {\r\n return this._attached;\r\n }\r\n\r\n /**\r\n * attach this feature\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful, false is failed or already attached\r\n */\r\n public attach(force?: boolean): boolean {\r\n // do not attach a disposed feature\r\n if (this.isDisposed) {\r\n return false;\r\n }\r\n if (!force) {\r\n if (this.attached) {\r\n return false;\r\n }\r\n } else {\r\n if (this.attached) {\r\n // detach first, to be sure\r\n this.detach();\r\n }\r\n }\r\n\r\n this._attached = true;\r\n this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, (frame) => this._onXRFrame(frame));\r\n this.onFeatureAttachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n *\r\n * @returns true if successful, false if failed or already detached\r\n */\r\n public detach(): boolean {\r\n if (!this._attached) {\r\n this.disableAutoAttach = true;\r\n return false;\r\n }\r\n this._attached = false;\r\n this._removeOnDetach.forEach((toRemove) => {\r\n toRemove.observable.remove(toRemove.observer);\r\n });\r\n this.onFeatureDetachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.isDisposed = true;\r\n this.onFeatureAttachObservable.clear();\r\n this.onFeatureDetachObservable.clear();\r\n }\r\n\r\n /**\r\n * This function will be executed during before enabling the feature and can be used to not-allow enabling it.\r\n * Note that at this point the session has NOT started, so this is purely checking if the browser supports it\r\n *\r\n * @returns whether or not the feature is compatible in this environment\r\n */\r\n public isCompatible(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * This is used to register callbacks that will automatically be removed when detach is called.\r\n * @param observable the observable to which the observer will be attached\r\n * @param callback the callback to register\r\n */\r\n protected _addNewAttachObserver<T>(observable: Observable<T>, callback: (eventData: T, eventState: EventState) => void) {\r\n this._removeOnDetach.push({\r\n observable,\r\n observer: observable.add(callback),\r\n });\r\n }\r\n\r\n /**\r\n * Code in this function will be executed on each xrFrame received from the browser.\r\n * This function will not execute after the feature is detached.\r\n * @param _xrFrame the current frame\r\n */\r\n protected abstract _onXRFrame(_xrFrame: XRFrame): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"WebXRAbstractFeature.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRAbstractFeature.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,MAAM,EAAE,6BAAyB;AAE1C;;;;GAIG;AACH,MAAM,OAAgB,oBAAoB;IAmBtC;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;I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IAED;;;;OAIG;IACO,qBAAqB,CAAI,UAAyB,EAAE,QAAwD;QAClH,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YACtB,UAAU;YACV,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC;SACrC,CAAC,CAAC;IACP,CAAC;CAQJ","sourcesContent":["import type { IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport type { Observer, EventState } from \"../../Misc/observable\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport type { Nullable } from \"../../types\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * This is the base class for all WebXR features.\r\n * Since most features require almost the same resources and callbacks, this class can be used to simplify the development\r\n * Note that since the features manager is using the `IWebXRFeature` you are in no way obligated to use this class\r\n */\r\nexport abstract class WebXRAbstractFeature implements IWebXRFeature {\r\n private _attached: boolean = false;\r\n private _removeOnDetach: {\r\n observer: Nullable<Observer<any>>;\r\n observable: Observable<any>;\r\n }[] = [];\r\n\r\n /**\r\n * Is this feature disposed?\r\n */\r\n public isDisposed: boolean = false;\r\n\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n public disableAutoAttach: boolean = false;\r\n\r\n protected _xrNativeFeatureName: string = \"\";\r\n\r\n /**\r\n * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)\r\n */\r\n public get xrNativeFeatureName() {\r\n return this._xrNativeFeatureName;\r\n }\r\n\r\n public set xrNativeFeatureName(name: string) {\r\n // check if feature was initialized while in session but needs to be initialized before the session starts\r\n if (!this._xrSessionManager.isNative && name && this._xrSessionManager.inXRSession && this._xrSessionManager.session.enabledFeatures.indexOf(name) === -1) {\r\n Logger.Warn(`The feature ${name} needs to be enabled before starting the XR session. Note - It is still possible it is not supported.`);\r\n }\r\n this._xrNativeFeatureName = name;\r\n }\r\n\r\n /**\r\n * Observers registered here will be executed when the feature is attached\r\n */\r\n public onFeatureAttachObservable: Observable<IWebXRFeature> = new Observable();\r\n /**\r\n * Observers registered here will be executed when the feature is detached\r\n */\r\n public onFeatureDetachObservable: Observable<IWebXRFeature> = new Observable();\r\n\r\n /**\r\n * The dependencies of this feature, if any\r\n */\r\n public dependsOn?: string[];\r\n\r\n /**\r\n * Construct a new (abstract) WebXR feature\r\n * @param _xrSessionManager the xr session manager for this feature\r\n */\r\n constructor(protected _xrSessionManager: WebXRSessionManager) {}\r\n\r\n /**\r\n * Is this feature attached\r\n */\r\n public get attached() {\r\n return this._attached;\r\n }\r\n\r\n /**\r\n * attach this feature\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful, false is failed or already attached\r\n */\r\n public attach(force?: boolean): boolean {\r\n // do not attach a disposed feature\r\n if (this.isDisposed) {\r\n return false;\r\n }\r\n if (!force) {\r\n if (this.attached) {\r\n return false;\r\n }\r\n } else {\r\n if (this.attached) {\r\n // detach first, to be sure\r\n this.detach();\r\n }\r\n }\r\n\r\n // if this is a native WebXR feature, check if it is enabled on the session\r\n // For now only check if not using babylon native\r\n if (!this._xrSessionManager.isNative && this.xrNativeFeatureName && this._xrSessionManager.session.enabledFeatures.indexOf(this.xrNativeFeatureName) === -1) {\r\n return false;\r\n }\r\n\r\n this._attached = true;\r\n this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, (frame) => this._onXRFrame(frame));\r\n this.onFeatureAttachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n *\r\n * @returns true if successful, false if failed or already detached\r\n */\r\n public detach(): boolean {\r\n if (!this._attached) {\r\n this.disableAutoAttach = true;\r\n return false;\r\n }\r\n this._attached = false;\r\n this._removeOnDetach.forEach((toRemove) => {\r\n toRemove.observable.remove(toRemove.observer);\r\n });\r\n this.onFeatureDetachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.isDisposed = true;\r\n this.onFeatureAttachObservable.clear();\r\n this.onFeatureDetachObservable.clear();\r\n }\r\n\r\n /**\r\n * This function will be executed during before enabling the feature and can be used to not-allow enabling it.\r\n * Note that at this point the session has NOT started, so this is purely checking if the browser supports it\r\n *\r\n * @returns whether or not the feature is compatible in this environment\r\n */\r\n public isCompatible(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * This is used to register callbacks that will automatically be removed when detach is called.\r\n * @param observable the observable to which the observer will be attached\r\n * @param callback the callback to register\r\n */\r\n protected _addNewAttachObserver<T>(observable: Observable<T>, callback: (eventData: T, eventState: EventState) => void) {\r\n this._removeOnDetach.push({\r\n observable,\r\n observer: observable.add(callback),\r\n });\r\n }\r\n\r\n /**\r\n * Code in this function will be executed on each xrFrame received from the browser.\r\n * This function will not execute after the feature is detached.\r\n * @param _xrFrame the current frame\r\n */\r\n protected abstract _onXRFrame(_xrFrame: XRFrame): void;\r\n}\r\n"]}
@@ -133,6 +133,7 @@ export declare class WebXRAnchorSystem extends WebXRAbstractFeature {
133
133
  /**
134
134
  * avoiding using Array.find for global support.
135
135
  * @param xrAnchor the plane to find in the array
136
+ * @returns the index of the anchor in the array or -1 if not found
136
137
  */
137
138
  private _findIndexInAnchorArray;
138
139
  private _updateAnchorWithXRFrame;
@@ -243,6 +243,7 @@ export class WebXRAnchorSystem extends WebXRAbstractFeature {
243
243
  /**
244
244
  * avoiding using Array.find for global support.
245
245
  * @param xrAnchor the plane to find in the array
246
+ * @returns the index of the anchor in the array or -1 if not found
246
247
  */
247
248
  _findIndexInAnchorArray(xrAnchor) {
248
249
  for (let i = 0; i < this._trackedAnchors.length; ++i) {
@@ -1 +1 @@
1
- {"version":3,"file":"WebXRAnchorSystem.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRAnchorSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAu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EAAE;gBACpD,GAAG,CAAC,4BAA4B,EAAE,CAAC;aACtC;YACD,MAAM,CAAC,oBAAoB,GAAG,GAAG,CAAC;YAClC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,EAAE;gBAChC,mFAAmF;aACtF;iBAAM;gBACH,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,cAAc,EAAE,EAAE,GAAG,CAAC,CAAC;aAC1E;SACJ;QAED,OAAqB,MAAM,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,6BAA6B,CAAC,gBAAkC,EAAE,OAAgB;;QAC5F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI;gBACA,OAAO,OAAO,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAA,IAAI,CAAC,8BAA8B,mCAAI,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;aAC/H;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;aAC1B;SACJ;aAAM;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;IACL,CAAC;;AAzTD;;GAEG;AACoB,sBAAI,GAAG,gBAAgB,CAAC,aAAa,AAAjC,CAAkC;AAC7D;;;;GAIG;AACoB,yBAAO,GAAG,CAAC,AAAJ,CAAK;AAmTvC,sBAAsB;AACtB,oBAAoB,CAAC,eAAe,CAChC,iBAAiB,CAAC,IAAI,EACtB,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC,EACD,iBAAiB,CAAC,OAAO,CAC5B,CAAC","sourcesContent":["import { WebXRFeatureName, WebXRFeaturesManager } from \"../webXRFeaturesManager\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix, Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport type { IWebXRHitResult } from \"./WebXRHitTest\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n\r\n/**\r\n * Configuration options of the anchor system\r\n */\r\nexport interface IWebXRAnchorSystemOptions {\r\n /**\r\n * a node that will be used to convert local to world coordinates\r\n */\r\n worldParentNode?: TransformNode;\r\n\r\n /**\r\n * If set to true a reference of the created anchors will be kept until the next session starts\r\n * If not defined, anchors will be removed from the array when the feature is detached or the session ended.\r\n */\r\n doNotRemoveAnchorsOnSessionEnded?: boolean;\r\n}\r\n\r\n/**\r\n * A babylon container for an XR Anchor\r\n */\r\nexport interface IWebXRAnchor {\r\n /**\r\n * A babylon-assigned ID for this anchor\r\n */\r\n id: number;\r\n /**\r\n * Transformation matrix to apply to an object attached to this anchor\r\n */\r\n transformationMatrix: Matrix;\r\n /**\r\n * The native anchor object\r\n */\r\n xrAnchor: XRAnchor;\r\n\r\n /**\r\n * if defined, this object will be constantly updated by the anchor's position and rotation\r\n */\r\n attachedNode?: TransformNode;\r\n\r\n /**\r\n * Remove this anchor from the scene\r\n */\r\n remove(): void;\r\n}\r\n\r\n/**\r\n * An internal interface for a future (promise based) anchor\r\n */\r\ninterface IWebXRFutureAnchor {\r\n /**\r\n * The native anchor\r\n */\r\n nativeAnchor?: XRAnchor;\r\n /**\r\n * Was this request submitted to the xr frame?\r\n */\r\n submitted: boolean;\r\n /**\r\n * Was this promise resolved already?\r\n */\r\n resolved: boolean;\r\n /**\r\n * A resolve function\r\n */\r\n resolve: (xrAnchor: IWebXRAnchor) => void;\r\n /**\r\n * A reject function\r\n */\r\n reject: (msg?: string) => void;\r\n /**\r\n * The XR Transformation of the future anchor\r\n */\r\n xrTransformation: XRRigidTransform;\r\n}\r\n\r\nlet anchorIdProvider = 0;\r\n\r\n/**\r\n * An implementation of the anchor system for WebXR.\r\n * For further information see https://github.com/immersive-web/anchors/\r\n */\r\nexport class WebXRAnchorSystem extends WebXRAbstractFeature {\r\n private _lastFrameDetected: XRAnchorSet = new Set();\r\n\r\n private _trackedAnchors: Array<IWebXRAnchor> = [];\r\n\r\n private _referenceSpaceForFrameAnchors: XRReferenceSpace;\r\n\r\n private _futureAnchors: IWebXRFutureAnchor[] = [];\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.ANCHOR_SYSTEM;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the WebXR specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Observers registered here will be executed when a new anchor was added to the session\r\n */\r\n public onAnchorAddedObservable: Observable<IWebXRAnchor> = new Observable();\r\n /**\r\n * Observers registered here will be executed when an anchor was removed from the session\r\n */\r\n public onAnchorRemovedObservable: Observable<IWebXRAnchor> = new Observable();\r\n /**\r\n * Observers registered here will be executed when an existing anchor updates\r\n * This can execute N times every frame\r\n */\r\n public onAnchorUpdatedObservable: Observable<IWebXRAnchor> = new Observable();\r\n\r\n /**\r\n * Set the reference space to use for anchor creation, when not using a hit test.\r\n * Will default to the session's reference space if not defined\r\n */\r\n public set referenceSpaceForFrameAnchors(referenceSpace: XRReferenceSpace) {\r\n this._referenceSpaceForFrameAnchors = referenceSpace;\r\n }\r\n\r\n /**\r\n * constructs a new anchor system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n private _options: IWebXRAnchorSystemOptions = {}\r\n ) {\r\n super(_xrSessionManager);\r\n this.xrNativeFeatureName = \"anchors\";\r\n }\r\n\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n private _populateTmpTransformation(position: Vector3, rotationQuaternion: Quaternion) {\r\n this._tmpVector.copyFrom(position);\r\n this._tmpQuaternion.copyFrom(rotationQuaternion);\r\n if (!this._xrSessionManager.scene.useRightHandedSystem) {\r\n this._tmpVector.z *= -1;\r\n this._tmpQuaternion.z *= -1;\r\n this._tmpQuaternion.w *= -1;\r\n }\r\n return {\r\n position: this._tmpVector,\r\n rotationQuaternion: this._tmpQuaternion,\r\n };\r\n }\r\n\r\n /**\r\n * Create a new anchor point using a hit test result at a specific point in the scene\r\n * An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that.\r\n * Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.\r\n *\r\n * @param hitTestResult The hit test result to use for this anchor creation\r\n * @param position an optional position offset for this anchor\r\n * @param rotationQuaternion an optional rotation offset for this anchor\r\n * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun\r\n */\r\n public async addAnchorPointUsingHitTestResultAsync(\r\n hitTestResult: IWebXRHitResult,\r\n position: Vector3 = new Vector3(),\r\n rotationQuaternion: Quaternion = new Quaternion()\r\n ): Promise<IWebXRAnchor> {\r\n // convert to XR space (right handed) if needed\r\n this._populateTmpTransformation(position, rotationQuaternion);\r\n // the matrix that we'll use\r\n const m = new XRRigidTransform(\r\n { x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z },\r\n { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w }\r\n );\r\n if (!hitTestResult.xrHitResult.createAnchor) {\r\n this.detach();\r\n throw new Error(\"Anchors not enabled in this environment/browser\");\r\n } else {\r\n try {\r\n const nativeAnchor = await hitTestResult.xrHitResult.createAnchor(m);\r\n return new Promise<IWebXRAnchor>((resolve, reject) => {\r\n this._futureAnchors.push({\r\n nativeAnchor,\r\n resolved: false,\r\n submitted: true,\r\n xrTransformation: m,\r\n resolve,\r\n reject,\r\n });\r\n });\r\n } catch (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a new anchor at a specific position and rotation\r\n * This function will add a new anchor per default in the next available frame. Unless forced, the createAnchor function\r\n * will be called in the next xrFrame loop to make sure that the anchor can be created correctly.\r\n * An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that.\r\n * Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.\r\n *\r\n * @param position the position in which to add an anchor\r\n * @param rotationQuaternion an optional rotation for the anchor transformation\r\n * @param forceCreateInCurrentFrame force the creation of this anchor in the current frame. Must be called inside xrFrame loop!\r\n * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun\r\n */\r\n public async addAnchorAtPositionAndRotationAsync(\r\n position: Vector3,\r\n rotationQuaternion: Quaternion = new Quaternion(),\r\n forceCreateInCurrentFrame = false\r\n ): Promise<IWebXRAnchor> {\r\n // convert to XR space (right handed) if needed\r\n this._populateTmpTransformation(position, rotationQuaternion);\r\n // the matrix that we'll use\r\n const xrTransformation = new XRRigidTransform(\r\n { x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z },\r\n { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w }\r\n );\r\n const xrAnchor =\r\n forceCreateInCurrentFrame && this.attached && this._xrSessionManager.currentFrame\r\n ? await this._createAnchorAtTransformation(xrTransformation, this._xrSessionManager.currentFrame)\r\n : undefined;\r\n // add the transformation to the future anchors list\r\n return new Promise<IWebXRAnchor>((resolve, reject) => {\r\n this._futureAnchors.push({\r\n nativeAnchor: xrAnchor,\r\n resolved: false,\r\n submitted: false,\r\n xrTransformation,\r\n resolve,\r\n reject,\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Get the list of anchors currently being tracked by the system\r\n */\r\n public get anchors(): IWebXRAnchor[] {\r\n return this._trackedAnchors;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n if (!this._options.doNotRemoveAnchorsOnSessionEnded) {\r\n while (this._trackedAnchors.length) {\r\n const toRemove = this._trackedAnchors.pop();\r\n if (toRemove) {\r\n try {\r\n // try to natively remove it as well\r\n toRemove.remove();\r\n } catch (e) {\r\n // no-op\r\n }\r\n // as the xr frame loop is removed, we need to notify manually\r\n this.onAnchorRemovedObservable.notifyObservers(toRemove);\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this._futureAnchors.length = 0;\r\n super.dispose();\r\n this.onAnchorAddedObservable.clear();\r\n this.onAnchorRemovedObservable.clear();\r\n this.onAnchorUpdatedObservable.clear();\r\n }\r\n\r\n protected _onXRFrame(frame: XRFrame) {\r\n if (!this.attached || !frame) {\r\n return;\r\n }\r\n\r\n const trackedAnchors = frame.trackedAnchors;\r\n if (trackedAnchors) {\r\n const toRemove = this._trackedAnchors\r\n .filter((anchor) => !trackedAnchors.has(anchor.xrAnchor))\r\n .map((anchor) => {\r\n const index = this._trackedAnchors.indexOf(anchor);\r\n return index;\r\n });\r\n let idxTracker = 0;\r\n toRemove.forEach((index) => {\r\n const anchor = this._trackedAnchors.splice(index - idxTracker, 1)[0];\r\n this.onAnchorRemovedObservable.notifyObservers(anchor);\r\n idxTracker++;\r\n });\r\n // now check for new ones\r\n trackedAnchors.forEach((xrAnchor) => {\r\n if (!this._lastFrameDetected.has(xrAnchor)) {\r\n const newAnchor: Partial<IWebXRAnchor> = {\r\n id: anchorIdProvider++,\r\n xrAnchor: xrAnchor,\r\n remove: () => xrAnchor.delete(),\r\n };\r\n const anchor = this._updateAnchorWithXRFrame(xrAnchor, newAnchor, frame);\r\n this._trackedAnchors.push(anchor);\r\n this.onAnchorAddedObservable.notifyObservers(anchor);\r\n // search for the future anchor promise that matches this\r\n const results = this._futureAnchors.filter((futureAnchor) => futureAnchor.nativeAnchor === xrAnchor);\r\n const result = results[0];\r\n if (result) {\r\n result.resolve(anchor);\r\n result.resolved = true;\r\n }\r\n } else {\r\n const index = this._findIndexInAnchorArray(xrAnchor);\r\n const anchor = this._trackedAnchors[index];\r\n try {\r\n // anchors update every frame\r\n this._updateAnchorWithXRFrame(xrAnchor, anchor, frame);\r\n if (anchor.attachedNode) {\r\n anchor.attachedNode.rotationQuaternion = anchor.attachedNode.rotationQuaternion || new Quaternion();\r\n anchor.transformationMatrix.decompose(anchor.attachedNode.scaling, anchor.attachedNode.rotationQuaternion, anchor.attachedNode.position);\r\n }\r\n this.onAnchorUpdatedObservable.notifyObservers(anchor);\r\n } catch (e) {\r\n Tools.Warn(`Anchor could not be updated`);\r\n }\r\n }\r\n });\r\n this._lastFrameDetected = trackedAnchors;\r\n }\r\n\r\n // process future anchors\r\n this._futureAnchors.forEach((futureAnchor) => {\r\n if (!futureAnchor.resolved && !futureAnchor.submitted) {\r\n this._createAnchorAtTransformation(futureAnchor.xrTransformation, frame).then(\r\n (nativeAnchor) => {\r\n futureAnchor.nativeAnchor = nativeAnchor;\r\n },\r\n (error) => {\r\n futureAnchor.resolved = true;\r\n futureAnchor.reject(error);\r\n }\r\n );\r\n futureAnchor.submitted = true;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * avoiding using Array.find for global support.\r\n * @param xrAnchor the plane to find in the array\r\n */\r\n private _findIndexInAnchorArray(xrAnchor: XRAnchor) {\r\n for (let i = 0; i < this._trackedAnchors.length; ++i) {\r\n if (this._trackedAnchors[i].xrAnchor === xrAnchor) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n private _updateAnchorWithXRFrame(xrAnchor: XRAnchor, anchor: Partial<IWebXRAnchor>, xrFrame: XRFrame): IWebXRAnchor {\r\n // matrix\r\n const pose = xrFrame.getPose(xrAnchor.anchorSpace, this._xrSessionManager.referenceSpace);\r\n if (pose) {\r\n const mat = anchor.transformationMatrix || new Matrix();\r\n Matrix.FromArrayToRef(pose.transform.matrix, 0, mat);\r\n if (!this._xrSessionManager.scene.useRightHandedSystem) {\r\n mat.toggleModelMatrixHandInPlace();\r\n }\r\n anchor.transformationMatrix = mat;\r\n if (!this._options.worldParentNode) {\r\n // Logger.Warn(\"Please provide a world parent node to apply world transformation\");\r\n } else {\r\n mat.multiplyToRef(this._options.worldParentNode.getWorldMatrix(), mat);\r\n }\r\n }\r\n\r\n return <IWebXRAnchor>anchor;\r\n }\r\n\r\n private async _createAnchorAtTransformation(xrTransformation: XRRigidTransform, xrFrame: XRFrame) {\r\n if (xrFrame.createAnchor) {\r\n try {\r\n return xrFrame.createAnchor(xrTransformation, this._referenceSpaceForFrameAnchors ?? this._xrSessionManager.referenceSpace);\r\n } catch (error) {\r\n throw new Error(error);\r\n }\r\n } else {\r\n this.detach();\r\n throw new Error(\"Anchors are not enabled in your browser\");\r\n }\r\n }\r\n}\r\n\r\n// register the plugin\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRAnchorSystem.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRAnchorSystem(xrSessionManager, options);\r\n },\r\n WebXRAnchorSystem.Version\r\n);\r\n"]}
1
+ {"version":3,"file":"WebXRAnchorSystem.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRAnchorSystem.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA4EzC,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB;;;GAGG;AACH,MAAM,OAAO,iBAAkB,SAAQ,oBAAoB;IAkCvD;;;OAG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,OAAqB,MAAM,CAAC;IAChC,CAAC;IAEO,KAAK,CAAC,6BAA6B,CAAC,gBAAkC,EAAE,OAAgB;;QAC5F,IAAI,OAAO,CAAC,YAAY,EAAE;YACtB,IAAI;gBACA,OAAO,OAAO,CAAC,YAAY,CAAC,gBAAgB,EAAE,MAAA,IAAI,CAAC,8BAA8B,mCAAI,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC;aAC/H;YAAC,OAAO,KAAK,EAAE;gBACZ,MAAM,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC;aAC1B;SACJ;aAAM;YACH,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;SAC9D;IACL,CAAC;;AA1TD;;GAEG;AACoB,sBAAI,GAAG,gBAAgB,CAAC,aAAa,AAAjC,CAAkC;AAC7D;;;;GAIG;AACoB,yBAAO,GAAG,CAAC,AAAJ,CAAK;AAoTvC,sBAAsB;AACtB,oBAAoB,CAAC,eAAe,CAChC,iBAAiB,CAAC,IAAI,EACtB,CAAC,gBAAgB,EAAE,OAAO,EAAE,EAAE;IAC1B,OAAO,GAAG,EAAE,CAAC,IAAI,iBAAiB,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAClE,CAAC,EACD,iBAAiB,CAAC,OAAO,CAC5B,CAAC","sourcesContent":["import { WebXRFeatureName, WebXRFeaturesManager } from \"../webXRFeaturesManager\";\r\nimport type { WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { Observable } from \"../../Misc/observable\";\r\nimport { Matrix, Vector3, Quaternion } from \"../../Maths/math.vector\";\r\nimport type { TransformNode } from \"../../Meshes/transformNode\";\r\nimport { WebXRAbstractFeature } from \"./WebXRAbstractFeature\";\r\nimport type { IWebXRHitResult } from \"./WebXRHitTest\";\r\nimport { Tools } from \"../../Misc/tools\";\r\n\r\n/**\r\n * Configuration options of the anchor system\r\n */\r\nexport interface IWebXRAnchorSystemOptions {\r\n /**\r\n * a node that will be used to convert local to world coordinates\r\n */\r\n worldParentNode?: TransformNode;\r\n\r\n /**\r\n * If set to true a reference of the created anchors will be kept until the next session starts\r\n * If not defined, anchors will be removed from the array when the feature is detached or the session ended.\r\n */\r\n doNotRemoveAnchorsOnSessionEnded?: boolean;\r\n}\r\n\r\n/**\r\n * A babylon container for an XR Anchor\r\n */\r\nexport interface IWebXRAnchor {\r\n /**\r\n * A babylon-assigned ID for this anchor\r\n */\r\n id: number;\r\n /**\r\n * Transformation matrix to apply to an object attached to this anchor\r\n */\r\n transformationMatrix: Matrix;\r\n /**\r\n * The native anchor object\r\n */\r\n xrAnchor: XRAnchor;\r\n\r\n /**\r\n * if defined, this object will be constantly updated by the anchor's position and rotation\r\n */\r\n attachedNode?: TransformNode;\r\n\r\n /**\r\n * Remove this anchor from the scene\r\n */\r\n remove(): void;\r\n}\r\n\r\n/**\r\n * An internal interface for a future (promise based) anchor\r\n */\r\ninterface IWebXRFutureAnchor {\r\n /**\r\n * The native anchor\r\n */\r\n nativeAnchor?: XRAnchor;\r\n /**\r\n * Was this request submitted to the xr frame?\r\n */\r\n submitted: boolean;\r\n /**\r\n * Was this promise resolved already?\r\n */\r\n resolved: boolean;\r\n /**\r\n * A resolve function\r\n */\r\n resolve: (xrAnchor: IWebXRAnchor) => void;\r\n /**\r\n * A reject function\r\n */\r\n reject: (msg?: string) => void;\r\n /**\r\n * The XR Transformation of the future anchor\r\n */\r\n xrTransformation: XRRigidTransform;\r\n}\r\n\r\nlet anchorIdProvider = 0;\r\n\r\n/**\r\n * An implementation of the anchor system for WebXR.\r\n * For further information see https://github.com/immersive-web/anchors/\r\n */\r\nexport class WebXRAnchorSystem extends WebXRAbstractFeature {\r\n private _lastFrameDetected: XRAnchorSet = new Set();\r\n\r\n private _trackedAnchors: Array<IWebXRAnchor> = [];\r\n\r\n private _referenceSpaceForFrameAnchors: XRReferenceSpace;\r\n\r\n private _futureAnchors: IWebXRFutureAnchor[] = [];\r\n\r\n /**\r\n * The module's name\r\n */\r\n public static readonly Name = WebXRFeatureName.ANCHOR_SYSTEM;\r\n /**\r\n * The (Babylon) version of this module.\r\n * This is an integer representing the implementation version.\r\n * This number does not correspond to the WebXR specs version\r\n */\r\n public static readonly Version = 1;\r\n\r\n /**\r\n * Observers registered here will be executed when a new anchor was added to the session\r\n */\r\n public onAnchorAddedObservable: Observable<IWebXRAnchor> = new Observable();\r\n /**\r\n * Observers registered here will be executed when an anchor was removed from the session\r\n */\r\n public onAnchorRemovedObservable: Observable<IWebXRAnchor> = new Observable();\r\n /**\r\n * Observers registered here will be executed when an existing anchor updates\r\n * This can execute N times every frame\r\n */\r\n public onAnchorUpdatedObservable: Observable<IWebXRAnchor> = new Observable();\r\n\r\n /**\r\n * Set the reference space to use for anchor creation, when not using a hit test.\r\n * Will default to the session's reference space if not defined\r\n */\r\n public set referenceSpaceForFrameAnchors(referenceSpace: XRReferenceSpace) {\r\n this._referenceSpaceForFrameAnchors = referenceSpace;\r\n }\r\n\r\n /**\r\n * constructs a new anchor system\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n * @param _options configuration object for this feature\r\n */\r\n constructor(\r\n _xrSessionManager: WebXRSessionManager,\r\n private _options: IWebXRAnchorSystemOptions = {}\r\n ) {\r\n super(_xrSessionManager);\r\n this.xrNativeFeatureName = \"anchors\";\r\n }\r\n\r\n private _tmpVector = new Vector3();\r\n private _tmpQuaternion = new Quaternion();\r\n\r\n private _populateTmpTransformation(position: Vector3, rotationQuaternion: Quaternion) {\r\n this._tmpVector.copyFrom(position);\r\n this._tmpQuaternion.copyFrom(rotationQuaternion);\r\n if (!this._xrSessionManager.scene.useRightHandedSystem) {\r\n this._tmpVector.z *= -1;\r\n this._tmpQuaternion.z *= -1;\r\n this._tmpQuaternion.w *= -1;\r\n }\r\n return {\r\n position: this._tmpVector,\r\n rotationQuaternion: this._tmpQuaternion,\r\n };\r\n }\r\n\r\n /**\r\n * Create a new anchor point using a hit test result at a specific point in the scene\r\n * An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that.\r\n * Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.\r\n *\r\n * @param hitTestResult The hit test result to use for this anchor creation\r\n * @param position an optional position offset for this anchor\r\n * @param rotationQuaternion an optional rotation offset for this anchor\r\n * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun\r\n */\r\n public async addAnchorPointUsingHitTestResultAsync(\r\n hitTestResult: IWebXRHitResult,\r\n position: Vector3 = new Vector3(),\r\n rotationQuaternion: Quaternion = new Quaternion()\r\n ): Promise<IWebXRAnchor> {\r\n // convert to XR space (right handed) if needed\r\n this._populateTmpTransformation(position, rotationQuaternion);\r\n // the matrix that we'll use\r\n const m = new XRRigidTransform(\r\n { x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z },\r\n { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w }\r\n );\r\n if (!hitTestResult.xrHitResult.createAnchor) {\r\n this.detach();\r\n throw new Error(\"Anchors not enabled in this environment/browser\");\r\n } else {\r\n try {\r\n const nativeAnchor = await hitTestResult.xrHitResult.createAnchor(m);\r\n return new Promise<IWebXRAnchor>((resolve, reject) => {\r\n this._futureAnchors.push({\r\n nativeAnchor,\r\n resolved: false,\r\n submitted: true,\r\n xrTransformation: m,\r\n resolve,\r\n reject,\r\n });\r\n });\r\n } catch (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Add a new anchor at a specific position and rotation\r\n * This function will add a new anchor per default in the next available frame. Unless forced, the createAnchor function\r\n * will be called in the next xrFrame loop to make sure that the anchor can be created correctly.\r\n * An anchor is tracked only after it is added to the trackerAnchors in xrFrame. The promise returned here does not yet guaranty that.\r\n * Use onAnchorAddedObservable to get newly added anchors if you require tracking guaranty.\r\n *\r\n * @param position the position in which to add an anchor\r\n * @param rotationQuaternion an optional rotation for the anchor transformation\r\n * @param forceCreateInCurrentFrame force the creation of this anchor in the current frame. Must be called inside xrFrame loop!\r\n * @returns A promise that fulfills when babylon has created the corresponding WebXRAnchor object and tracking has begun\r\n */\r\n public async addAnchorAtPositionAndRotationAsync(\r\n position: Vector3,\r\n rotationQuaternion: Quaternion = new Quaternion(),\r\n forceCreateInCurrentFrame = false\r\n ): Promise<IWebXRAnchor> {\r\n // convert to XR space (right handed) if needed\r\n this._populateTmpTransformation(position, rotationQuaternion);\r\n // the matrix that we'll use\r\n const xrTransformation = new XRRigidTransform(\r\n { x: this._tmpVector.x, y: this._tmpVector.y, z: this._tmpVector.z },\r\n { x: this._tmpQuaternion.x, y: this._tmpQuaternion.y, z: this._tmpQuaternion.z, w: this._tmpQuaternion.w }\r\n );\r\n const xrAnchor =\r\n forceCreateInCurrentFrame && this.attached && this._xrSessionManager.currentFrame\r\n ? await this._createAnchorAtTransformation(xrTransformation, this._xrSessionManager.currentFrame)\r\n : undefined;\r\n // add the transformation to the future anchors list\r\n return new Promise<IWebXRAnchor>((resolve, reject) => {\r\n this._futureAnchors.push({\r\n nativeAnchor: xrAnchor,\r\n resolved: false,\r\n submitted: false,\r\n xrTransformation,\r\n resolve,\r\n reject,\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Get the list of anchors currently being tracked by the system\r\n */\r\n public get anchors(): IWebXRAnchor[] {\r\n return this._trackedAnchors;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n public detach(): boolean {\r\n if (!super.detach()) {\r\n return false;\r\n }\r\n\r\n if (!this._options.doNotRemoveAnchorsOnSessionEnded) {\r\n while (this._trackedAnchors.length) {\r\n const toRemove = this._trackedAnchors.pop();\r\n if (toRemove) {\r\n try {\r\n // try to natively remove it as well\r\n toRemove.remove();\r\n } catch (e) {\r\n // no-op\r\n }\r\n // as the xr frame loop is removed, we need to notify manually\r\n this.onAnchorRemovedObservable.notifyObservers(toRemove);\r\n }\r\n }\r\n }\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this._futureAnchors.length = 0;\r\n super.dispose();\r\n this.onAnchorAddedObservable.clear();\r\n this.onAnchorRemovedObservable.clear();\r\n this.onAnchorUpdatedObservable.clear();\r\n }\r\n\r\n protected _onXRFrame(frame: XRFrame) {\r\n if (!this.attached || !frame) {\r\n return;\r\n }\r\n\r\n const trackedAnchors = frame.trackedAnchors;\r\n if (trackedAnchors) {\r\n const toRemove = this._trackedAnchors\r\n .filter((anchor) => !trackedAnchors.has(anchor.xrAnchor))\r\n .map((anchor) => {\r\n const index = this._trackedAnchors.indexOf(anchor);\r\n return index;\r\n });\r\n let idxTracker = 0;\r\n toRemove.forEach((index) => {\r\n const anchor = this._trackedAnchors.splice(index - idxTracker, 1)[0];\r\n this.onAnchorRemovedObservable.notifyObservers(anchor);\r\n idxTracker++;\r\n });\r\n // now check for new ones\r\n trackedAnchors.forEach((xrAnchor) => {\r\n if (!this._lastFrameDetected.has(xrAnchor)) {\r\n const newAnchor: Partial<IWebXRAnchor> = {\r\n id: anchorIdProvider++,\r\n xrAnchor: xrAnchor,\r\n remove: () => xrAnchor.delete(),\r\n };\r\n const anchor = this._updateAnchorWithXRFrame(xrAnchor, newAnchor, frame);\r\n this._trackedAnchors.push(anchor);\r\n this.onAnchorAddedObservable.notifyObservers(anchor);\r\n // search for the future anchor promise that matches this\r\n const results = this._futureAnchors.filter((futureAnchor) => futureAnchor.nativeAnchor === xrAnchor);\r\n const result = results[0];\r\n if (result) {\r\n result.resolve(anchor);\r\n result.resolved = true;\r\n }\r\n } else {\r\n const index = this._findIndexInAnchorArray(xrAnchor);\r\n const anchor = this._trackedAnchors[index];\r\n try {\r\n // anchors update every frame\r\n this._updateAnchorWithXRFrame(xrAnchor, anchor, frame);\r\n if (anchor.attachedNode) {\r\n anchor.attachedNode.rotationQuaternion = anchor.attachedNode.rotationQuaternion || new Quaternion();\r\n anchor.transformationMatrix.decompose(anchor.attachedNode.scaling, anchor.attachedNode.rotationQuaternion, anchor.attachedNode.position);\r\n }\r\n this.onAnchorUpdatedObservable.notifyObservers(anchor);\r\n } catch (e) {\r\n Tools.Warn(`Anchor could not be updated`);\r\n }\r\n }\r\n });\r\n this._lastFrameDetected = trackedAnchors;\r\n }\r\n\r\n // process future anchors\r\n this._futureAnchors.forEach((futureAnchor) => {\r\n if (!futureAnchor.resolved && !futureAnchor.submitted) {\r\n this._createAnchorAtTransformation(futureAnchor.xrTransformation, frame).then(\r\n (nativeAnchor) => {\r\n futureAnchor.nativeAnchor = nativeAnchor;\r\n },\r\n (error) => {\r\n futureAnchor.resolved = true;\r\n futureAnchor.reject(error);\r\n }\r\n );\r\n futureAnchor.submitted = true;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * avoiding using Array.find for global support.\r\n * @param xrAnchor the plane to find in the array\r\n * @returns the index of the anchor in the array or -1 if not found\r\n */\r\n private _findIndexInAnchorArray(xrAnchor: XRAnchor) {\r\n for (let i = 0; i < this._trackedAnchors.length; ++i) {\r\n if (this._trackedAnchors[i].xrAnchor === xrAnchor) {\r\n return i;\r\n }\r\n }\r\n return -1;\r\n }\r\n\r\n private _updateAnchorWithXRFrame(xrAnchor: XRAnchor, anchor: Partial<IWebXRAnchor>, xrFrame: XRFrame): IWebXRAnchor {\r\n // matrix\r\n const pose = xrFrame.getPose(xrAnchor.anchorSpace, this._xrSessionManager.referenceSpace);\r\n if (pose) {\r\n const mat = anchor.transformationMatrix || new Matrix();\r\n Matrix.FromArrayToRef(pose.transform.matrix, 0, mat);\r\n if (!this._xrSessionManager.scene.useRightHandedSystem) {\r\n mat.toggleModelMatrixHandInPlace();\r\n }\r\n anchor.transformationMatrix = mat;\r\n if (!this._options.worldParentNode) {\r\n // Logger.Warn(\"Please provide a world parent node to apply world transformation\");\r\n } else {\r\n mat.multiplyToRef(this._options.worldParentNode.getWorldMatrix(), mat);\r\n }\r\n }\r\n\r\n return <IWebXRAnchor>anchor;\r\n }\r\n\r\n private async _createAnchorAtTransformation(xrTransformation: XRRigidTransform, xrFrame: XRFrame) {\r\n if (xrFrame.createAnchor) {\r\n try {\r\n return xrFrame.createAnchor(xrTransformation, this._referenceSpaceForFrameAnchors ?? this._xrSessionManager.referenceSpace);\r\n } catch (error) {\r\n throw new Error(error);\r\n }\r\n } else {\r\n this.detach();\r\n throw new Error(\"Anchors are not enabled in your browser\");\r\n }\r\n }\r\n}\r\n\r\n// register the plugin\r\nWebXRFeaturesManager.AddWebXRFeature(\r\n WebXRAnchorSystem.Name,\r\n (xrSessionManager, options) => {\r\n return () => new WebXRAnchorSystem(xrSessionManager, options);\r\n },\r\n WebXRAnchorSystem.Version\r\n);\r\n"]}
@@ -310,6 +310,12 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
310
310
  // set the observables
311
311
  this.onBeforeCameraTeleport = _options.xrInput.xrCamera.onBeforeCameraTeleport;
312
312
  this.onAfterCameraTeleport = _options.xrInput.xrCamera.onAfterCameraTeleport;
313
+ this.parabolicCheckRadius *= this._xrSessionManager.worldScalingFactor;
314
+ _xrSessionManager.onWorldScaleFactorChangedObservable.add((values) => {
315
+ var _a;
316
+ this.parabolicCheckRadius = (this.parabolicCheckRadius / values.previousScaleFactor) * values.newScaleFactor;
317
+ (_a = this._options.teleportationTargetMesh) === null || _a === void 0 ? void 0 : _a.scaling.scaleInPlace(values.newScaleFactor / values.previousScaleFactor);
318
+ });
313
319
  }
314
320
  /**
315
321
  * Get the snapPointsOnly flag
@@ -626,6 +632,7 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
626
632
  cone.renderingGroupId = this._options.renderingGroupId;
627
633
  }
628
634
  this._options.teleportationTargetMesh = teleportationTarget;
635
+ this._options.teleportationTargetMesh.scaling.setAll(this._xrSessionManager.worldScalingFactor);
629
636
  // hide the teleportation target mesh right after creating it.
630
637
  this._setTargetMeshVisibility(false);
631
638
  }
@@ -748,11 +755,11 @@ export class WebXRMotionControllerTeleportation extends WebXRAbstractFeature {
748
755
  // do the movement forward here
749
756
  if (this._options.teleportationTargetMesh && this._options.teleportationTargetMesh.isVisible) {
750
757
  const height = this._options.xrInput.xrCamera.realWorldHeight;
751
- this._options.xrInput.xrCamera.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);
758
+ this.onBeforeCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);
752
759
  this._options.xrInput.xrCamera.position.copyFrom(this._options.teleportationTargetMesh.position);
753
760
  this._options.xrInput.xrCamera.position.y += height;
754
761
  Quaternion.FromEulerAngles(0, controllerData.teleportationState.currentRotation - (this._xrSessionManager.scene.useRightHandedSystem ? Math.PI : 0), 0).multiplyToRef(this._options.xrInput.xrCamera.rotationQuaternion, this._options.xrInput.xrCamera.rotationQuaternion);
755
- this._options.xrInput.xrCamera.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);
762
+ this.onAfterCameraTeleport.notifyObservers(this._options.xrInput.xrCamera.position);
756
763
  }
757
764
  }
758
765
  }