@onerjs/core 8.55.8 → 8.56.1

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 (423) hide show
  1. package/Animations/animation.pure.js +2 -2
  2. package/Animations/animation.pure.js.map +1 -1
  3. package/Animations/runtimeAnimation.js +4 -0
  4. package/Animations/runtimeAnimation.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
  6. package/AudioV2/webAudio/webAudioEngine.js +6 -5
  7. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  8. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  9. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  10. package/Behaviors/Meshes/followBehavior.js +1 -0
  11. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  12. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +1 -0
  13. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  14. package/Cameras/Inputs/followCameraMouseWheelInput.js +2 -2
  15. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  16. package/Cameras/Inputs/followCameraPointersInput.d.ts +15 -0
  17. package/Cameras/Inputs/followCameraPointersInput.js +18 -3
  18. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  19. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
  20. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  21. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js +1 -1
  22. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js.map +1 -1
  23. package/Cameras/arcRotateCamera.pure.js +1 -1
  24. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  25. package/Collisions/gpuPicker.d.ts +1 -0
  26. package/Collisions/gpuPicker.js +5 -4
  27. package/Collisions/gpuPicker.js.map +1 -1
  28. package/Culling/Helper/boundingInfoHelper.js +9 -5
  29. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  30. package/Culling/boundingSphere.js +7 -4
  31. package/Culling/boundingSphere.js.map +1 -1
  32. package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +5 -1
  33. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +7 -3
  34. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -1
  35. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.d.ts +6 -0
  36. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js +16 -0
  37. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js.map +1 -0
  38. package/Engines/AbstractEngine/pure.d.ts +1 -0
  39. package/Engines/AbstractEngine/pure.js +1 -0
  40. package/Engines/AbstractEngine/pure.js.map +1 -1
  41. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +1 -1
  42. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  43. package/Engines/IDrawContext.d.ts +2 -0
  44. package/Engines/IDrawContext.js.map +1 -1
  45. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +48 -6
  46. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  47. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  48. package/Engines/Native/nativeInterfaces.js.map +1 -1
  49. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  50. package/Engines/WebGPU/webgpuDrawContext.js +15 -0
  51. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  52. package/Engines/abstractEngine.pure.js +2 -2
  53. package/Engines/abstractEngine.pure.js.map +1 -1
  54. package/Engines/engine.d.ts +21 -4
  55. package/Engines/thinNativeEngine.pure.d.ts +6 -1
  56. package/Engines/thinNativeEngine.pure.js +29 -2
  57. package/Engines/thinNativeEngine.pure.js.map +1 -1
  58. package/Engines/webgpuEngine.d.ts +1 -0
  59. package/Engines/webgpuEngine.js +1 -0
  60. package/Engines/webgpuEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.pure.d.ts +10 -0
  62. package/Engines/webgpuEngine.pure.js +15 -1
  63. package/Engines/webgpuEngine.pure.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +3 -63
  65. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +5 -71
  66. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.d.ts +71 -0
  68. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js +86 -0
  69. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js.map +1 -0
  70. package/FlowGraph/Blocks/Data/pure.d.ts +1 -0
  71. package/FlowGraph/Blocks/Data/pure.js +1 -0
  72. package/FlowGraph/Blocks/Data/pure.js.map +1 -1
  73. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +3 -37
  74. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +5 -39
  75. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.d.ts +45 -0
  77. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js +54 -0
  78. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js.map +1 -0
  79. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +3 -17
  80. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +5 -22
  81. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.d.ts +25 -0
  83. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js +37 -0
  84. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js.map +1 -0
  85. package/FlowGraph/Blocks/Event/pure.d.ts +2 -0
  86. package/FlowGraph/Blocks/Event/pure.js +2 -0
  87. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +1 -1
  89. package/FlowGraph/Blocks/flowGraphBlockFactory.js +198 -172
  90. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  91. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +2 -5
  92. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  93. package/FrameGraph/frameGraph.js +10 -1
  94. package/FrameGraph/frameGraph.js.map +1 -1
  95. package/Gamepads/gamepadManager.d.ts +1 -0
  96. package/Gamepads/gamepadManager.js +5 -2
  97. package/Gamepads/gamepadManager.js.map +1 -1
  98. package/Gizmos/scaleGizmo.js +1 -0
  99. package/Gizmos/scaleGizmo.js.map +1 -1
  100. package/Lights/IES/iesLoader.js +6 -8
  101. package/Lights/IES/iesLoader.js.map +1 -1
  102. package/Lights/Shadows/cascadedShadowGenerator.pure.js +4 -6
  103. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
  104. package/Lights/Shadows/shadowGenerator.js +2 -2
  105. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  106. package/Lights/light.js +3 -5
  107. package/Lights/light.js.map +1 -1
  108. package/Lights/spotLight.pure.js +1 -1
  109. package/Lights/spotLight.pure.js.map +1 -1
  110. package/Materials/Background/backgroundMaterial.pure.d.ts +1 -1
  111. package/Materials/Background/backgroundMaterial.pure.js +3 -12
  112. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  113. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +2 -0
  114. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  115. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js +1 -1
  116. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js.map +1 -1
  117. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +2 -0
  118. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
  119. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1 -0
  120. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  121. package/Materials/Node/Blocks/powBlock.pure.js +2 -1
  122. package/Materials/Node/Blocks/powBlock.pure.js.map +1 -1
  123. package/Materials/Node/Blocks/triPlanarBlock.pure.js +14 -12
  124. package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
  125. package/Materials/Node/nodeMaterial.pure.d.ts +1 -0
  126. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  127. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -1
  128. package/Materials/PBR/openpbrMaterial.pure.js +3 -12
  129. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  130. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -1
  131. package/Materials/PBR/pbrBaseMaterial.pure.js +3 -12
  132. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  133. package/Materials/Textures/index.d.ts +1 -0
  134. package/Materials/Textures/index.js +1 -0
  135. package/Materials/Textures/index.js.map +1 -1
  136. package/Materials/Textures/renderTargetTexture.pure.js +1 -1
  137. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  138. package/Materials/drawWrapper.js +3 -0
  139. package/Materials/drawWrapper.js.map +1 -1
  140. package/Materials/imageProcessingConfiguration.defines.d.ts +3 -0
  141. package/Materials/imageProcessingConfiguration.defines.js +2 -0
  142. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  143. package/Materials/imageProcessingConfiguration.functions.js +3 -0
  144. package/Materials/imageProcessingConfiguration.functions.js.map +1 -1
  145. package/Materials/imageProcessingConfiguration.pure.d.ts +58 -0
  146. package/Materials/imageProcessingConfiguration.pure.js +123 -2
  147. package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
  148. package/Materials/material.pure.js +2 -2
  149. package/Materials/material.pure.js.map +1 -1
  150. package/Materials/standardMaterial.pure.d.ts +2 -1
  151. package/Materials/standardMaterial.pure.js +4 -13
  152. package/Materials/standardMaterial.pure.js.map +1 -1
  153. package/Materials/uniformBuffer.d.ts +29 -0
  154. package/Materials/uniformBuffer.js +146 -0
  155. package/Materials/uniformBuffer.js.map +1 -1
  156. package/Maths/colorTemperature.functions.d.ts +29 -0
  157. package/Maths/colorTemperature.functions.js +196 -0
  158. package/Maths/colorTemperature.functions.js.map +1 -0
  159. package/Maths/index.d.ts +1 -0
  160. package/Maths/index.js +1 -0
  161. package/Maths/index.js.map +1 -1
  162. package/Maths/math.path.js +1 -1
  163. package/Maths/math.path.js.map +1 -1
  164. package/Maths/math.polar.js +1 -1
  165. package/Maths/math.polar.js.map +1 -1
  166. package/Maths/math.vector.pure.js +4 -3
  167. package/Maths/math.vector.pure.js.map +1 -1
  168. package/Maths/pure.d.ts +1 -0
  169. package/Maths/pure.js +1 -0
  170. package/Maths/pure.js.map +1 -1
  171. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +72 -0
  172. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +164 -1
  173. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  174. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -1
  175. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +36 -18
  176. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  177. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +5 -4
  178. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +25 -8
  179. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  180. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
  181. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  182. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +1 -1
  183. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
  184. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +2 -2
  185. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
  186. package/Meshes/Node/Blocks/mappingBlock.pure.js +2 -2
  187. package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
  188. package/Meshes/csg.js +5 -5
  189. package/Meshes/csg.js.map +1 -1
  190. package/Meshes/groundMesh.pure.js +1 -1
  191. package/Meshes/groundMesh.pure.js.map +1 -1
  192. package/Meshes/mesh.pure.js +2 -2
  193. package/Meshes/mesh.pure.js.map +1 -1
  194. package/Misc/deepMerger.js +1 -1
  195. package/Misc/deepMerger.js.map +1 -1
  196. package/Misc/dumpTools.pure.js +1 -1
  197. package/Misc/dumpTools.pure.js.map +1 -1
  198. package/Misc/index.d.ts +1 -0
  199. package/Misc/index.js +1 -0
  200. package/Misc/index.js.map +1 -1
  201. package/Misc/observable.pure.js +1 -3
  202. package/Misc/observable.pure.js.map +1 -1
  203. package/Misc/pure.d.ts +1 -0
  204. package/Misc/pure.js +1 -0
  205. package/Misc/pure.js.map +1 -1
  206. package/Misc/shaderImportLoader.d.ts +25 -0
  207. package/Misc/shaderImportLoader.js +54 -0
  208. package/Misc/shaderImportLoader.js.map +1 -0
  209. package/Misc/tools.pure.js +1 -1
  210. package/Misc/tools.pure.js.map +1 -1
  211. package/Particles/Node/Blocks/particleClampBlock.pure.d.ts +0 -1
  212. package/Particles/Node/Blocks/particleClampBlock.pure.js +1 -6
  213. package/Particles/Node/Blocks/particleClampBlock.pure.js.map +1 -1
  214. package/Particles/Node/Blocks/particleMathBlock.pure.js +1 -1
  215. package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
  216. package/Particles/Node/Blocks/particleNLerpBlock.pure.js +8 -3
  217. package/Particles/Node/Blocks/particleNLerpBlock.pure.js.map +1 -1
  218. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js +3 -2
  219. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js.map +1 -1
  220. package/Particles/Node/Blocks/particleStepBlock.pure.js +3 -2
  221. package/Particles/Node/Blocks/particleStepBlock.pure.js.map +1 -1
  222. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +1 -1
  223. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
  224. package/PostProcesses/depthOfFieldEffect.js +1 -1
  225. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  226. package/PostProcesses/imageProcessingPostProcess.d.ts +41 -1
  227. package/PostProcesses/imageProcessingPostProcess.js +41 -1
  228. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  229. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +1 -1
  230. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
  231. package/PostProcesses/sharpenPostProcess.pure.js +1 -1
  232. package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
  233. package/PostProcesses/thinImageProcessingPostProcess.d.ts +50 -0
  234. package/PostProcesses/thinImageProcessingPostProcess.js +65 -0
  235. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
  236. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.d.ts +12 -0
  237. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js +22 -0
  238. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js.map +1 -0
  239. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -0
  240. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +39 -0
  241. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
  242. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.d.ts +12 -0
  243. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +17 -5
  244. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  245. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +14 -0
  246. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +122 -6
  247. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  248. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +7 -0
  249. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +17 -0
  250. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  251. package/Rendering/IBLShadows/pure.d.ts +1 -0
  252. package/Rendering/IBLShadows/pure.js +1 -0
  253. package/Rendering/IBLShadows/pure.js.map +1 -1
  254. package/Rendering/boundingBoxRenderer.pure.js +3 -3
  255. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  256. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +11 -0
  257. package/Rendering/fluidRenderer/fluidRenderingObject.js +36 -14
  258. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  259. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +5 -0
  260. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +16 -3
  261. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  262. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +5 -0
  263. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +12 -0
  264. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  265. package/Rendering/iblCdfGenerator.js +10 -1
  266. package/Rendering/iblCdfGenerator.js.map +1 -1
  267. package/Rendering/outlineRenderer.pure.js +1 -0
  268. package/Rendering/outlineRenderer.pure.js.map +1 -1
  269. package/Rendering/subSurfaceConfiguration.js +1 -1
  270. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  271. package/Rendering/subSurfaceSceneComponent.pure.d.ts +1 -1
  272. package/Rendering/subSurfaceSceneComponent.pure.js +1 -1
  273. package/Rendering/subSurfaceSceneComponent.pure.js.map +1 -1
  274. package/Rendering/utilityLayerRenderer.js +1 -1
  275. package/Rendering/utilityLayerRenderer.js.map +1 -1
  276. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
  277. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  278. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  279. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  280. package/Shaders/ShadersInclude/imageProcessingDeclaration.js +3 -0
  281. package/Shaders/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  282. package/Shaders/ShadersInclude/imageProcessingFunctions.js +3 -0
  283. package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  284. package/Shaders/ShadersInclude/openpbrDirectLighting.js +34 -4
  285. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  286. package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -2
  287. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  288. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  289. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  290. package/Shaders/fluidRenderingParticleDepth.vertex.js +7 -1
  291. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  292. package/Shaders/fluidRenderingParticleDiffuse.vertex.js +7 -1
  293. package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  294. package/Shaders/fluidRenderingParticleThickness.vertex.js +7 -1
  295. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  296. package/Shaders/gaussianSplattingVoxel.fragment.js +4 -10
  297. package/Shaders/gaussianSplattingVoxel.fragment.js.map +1 -1
  298. package/Shaders/iblCombineVoxelGrids.fragment.js +1 -1
  299. package/Shaders/iblCombineVoxelGrids.fragment.js.map +1 -1
  300. package/Shaders/iblShadowVoxelTracing.fragment.js +24 -7
  301. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  302. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.d.ts +5 -0
  303. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js +13 -0
  304. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js.map +1 -0
  305. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +3 -0
  306. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  307. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +3 -0
  308. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  309. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +35 -5
  310. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  311. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +1 -1
  312. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  313. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +8 -2
  314. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  315. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  316. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  317. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +16 -4
  318. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  319. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +15 -3
  320. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  321. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -3
  322. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  323. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js +15 -9
  324. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js.map +1 -1
  325. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js +1 -1
  326. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js.map +1 -1
  327. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.d.ts +5 -0
  328. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js +14 -0
  329. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js.map +1 -0
  330. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +24 -7
  331. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
  332. package/ShadersWGSL/iblVoxelGrid.fragment.js +26 -6
  333. package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
  334. package/SmartAssets/smartAssetManager.pure.js +1 -1
  335. package/SmartAssets/smartAssetManager.pure.js.map +1 -1
  336. package/Sprites/thinSprite.js +1 -1
  337. package/Sprites/thinSprite.js.map +1 -1
  338. package/XR/features/Layers/WebXRCompositionLayer.d.ts +182 -12
  339. package/XR/features/Layers/WebXRCompositionLayer.js +272 -3
  340. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  341. package/XR/features/Layers/WebXRFallbackLayer.d.ts +84 -0
  342. package/XR/features/Layers/WebXRFallbackLayer.js +137 -0
  343. package/XR/features/Layers/WebXRFallbackLayer.js.map +1 -0
  344. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +4 -4
  345. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  346. package/XR/features/WebXRAnchorSystem.pure.d.ts +45 -0
  347. package/XR/features/WebXRAnchorSystem.pure.js +153 -13
  348. package/XR/features/WebXRAnchorSystem.pure.js.map +1 -1
  349. package/XR/features/WebXRControllerPointerSelection.pure.js +2 -1
  350. package/XR/features/WebXRControllerPointerSelection.pure.js.map +1 -1
  351. package/XR/features/WebXRControllerTeleportation.pure.js +2 -1
  352. package/XR/features/WebXRControllerTeleportation.pure.js.map +1 -1
  353. package/XR/features/WebXRDepthSensing.pure.d.ts +21 -0
  354. package/XR/features/WebXRDepthSensing.pure.js +42 -0
  355. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  356. package/XR/features/WebXRHandTracking.pure.js +2 -0
  357. package/XR/features/WebXRHandTracking.pure.js.map +1 -1
  358. package/XR/features/WebXRLayers.pure.d.ts +183 -8
  359. package/XR/features/WebXRLayers.pure.js +531 -99
  360. package/XR/features/WebXRLayers.pure.js.map +1 -1
  361. package/XR/features/WebXRLayersFallback.d.ts +5 -0
  362. package/XR/features/WebXRLayersFallback.js +8 -0
  363. package/XR/features/WebXRLayersFallback.js.map +1 -0
  364. package/XR/features/WebXRLayersFallback.pure.d.ts +6 -0
  365. package/XR/features/WebXRLayersFallback.pure.js +44 -0
  366. package/XR/features/WebXRLayersFallback.pure.js.map +1 -0
  367. package/XR/features/WebXRLightEstimation.pure.d.ts +3 -4
  368. package/XR/features/WebXRLightEstimation.pure.js +22 -21
  369. package/XR/features/WebXRLightEstimation.pure.js.map +1 -1
  370. package/XR/features/WebXRMeshDetector.pure.d.ts +5 -0
  371. package/XR/features/WebXRMeshDetector.pure.js +1 -0
  372. package/XR/features/WebXRMeshDetector.pure.js.map +1 -1
  373. package/XR/features/WebXRNearInteraction.pure.js +3 -3
  374. package/XR/features/WebXRNearInteraction.pure.js.map +1 -1
  375. package/XR/features/WebXRPlaneDetector.pure.d.ts +9 -5
  376. package/XR/features/WebXRPlaneDetector.pure.js +12 -8
  377. package/XR/features/WebXRPlaneDetector.pure.js.map +1 -1
  378. package/XR/features/WebXRTrackedSources.d.ts +5 -0
  379. package/XR/features/WebXRTrackedSources.js +8 -0
  380. package/XR/features/WebXRTrackedSources.js.map +1 -0
  381. package/XR/features/WebXRTrackedSources.pure.d.ts +70 -0
  382. package/XR/features/WebXRTrackedSources.pure.js +153 -0
  383. package/XR/features/WebXRTrackedSources.pure.js.map +1 -0
  384. package/XR/features/index.d.ts +1 -0
  385. package/XR/features/index.js +1 -0
  386. package/XR/features/index.js.map +1 -1
  387. package/XR/features/pure.d.ts +2 -0
  388. package/XR/features/pure.js +2 -0
  389. package/XR/features/pure.js.map +1 -1
  390. package/XR/motionController/webXRAbstractMotionController.d.ts +53 -1
  391. package/XR/motionController/webXRAbstractMotionController.js +61 -0
  392. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  393. package/XR/webXRCamera.d.ts +2 -0
  394. package/XR/webXRCamera.js +8 -2
  395. package/XR/webXRCamera.js.map +1 -1
  396. package/XR/webXRDefaultExperience.js +8 -4
  397. package/XR/webXRDefaultExperience.js.map +1 -1
  398. package/XR/webXRExperienceHelper.js +86 -44
  399. package/XR/webXRExperienceHelper.js.map +1 -1
  400. package/XR/webXRFeaturesManager.d.ts +9 -0
  401. package/XR/webXRFeaturesManager.js +4 -0
  402. package/XR/webXRFeaturesManager.js.map +1 -1
  403. package/XR/webXRGraphicsBinding.d.ts +29 -0
  404. package/XR/webXRGraphicsBinding.js +40 -0
  405. package/XR/webXRGraphicsBinding.js.map +1 -1
  406. package/XR/webXRInputSource.js +1 -1
  407. package/XR/webXRInputSource.js.map +1 -1
  408. package/XR/webXRLayerWrapper.d.ts +26 -10
  409. package/XR/webXRLayerWrapper.js +19 -7
  410. package/XR/webXRLayerWrapper.js.map +1 -1
  411. package/XR/webXRRenderTargetTextureProvider.d.ts +4 -4
  412. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  413. package/XR/webXRSessionManager.d.ts +45 -0
  414. package/XR/webXRSessionManager.js +174 -29
  415. package/XR/webXRSessionManager.js.map +1 -1
  416. package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +2 -1
  417. package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -1
  418. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +3 -3
  419. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  420. package/package.json +1 -1
  421. package/scene.pure.d.ts +5 -0
  422. package/scene.pure.js +25 -0
  423. package/scene.pure.js.map +1 -1
@@ -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\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type Camera } from \"../Cameras/camera\";\r\nimport { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { WebXRCamera } from \"./webXRCamera\";\r\nimport { type WebXRRenderTarget, WebXRState } from \"./webXRTypes\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"./webXRFeaturesManager\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { UniversalCamera } from \"../Cameras/universalCamera.pure\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n/**\r\n * Options for setting up XR spectator camera.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface WebXRSpectatorModeOption {\r\n /**\r\n * Expected refresh rate (frames per sec) for a spectator camera.\r\n */\r\n fps?: number;\r\n /**\r\n * The index of rigCameras array in a WebXR camera.\r\n */\r\n preferredCameraIndex?: number;\r\n}\r\n\r\n/**\r\n * Base set of functionality needed to create an XR experience (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRExperienceHelpers\r\n */\r\nexport class WebXRExperienceHelper implements IDisposable {\r\n private _nonVRCamera: Nullable<Camera> = null;\r\n private _attachedToElement: boolean = false;\r\n private _spectatorCamera: Nullable<UniversalCamera> = null;\r\n private _originalSceneAutoClear = true;\r\n private _supported = false;\r\n private _spectatorMode = false;\r\n private _lastTimestamp = 0;\r\n private _spectatorStateChangedObserver: Nullable<Observer<WebXRState>> = null;\r\n private _spectatorXRFrameObserver: Nullable<Observer<XRFrame>> = null;\r\n private _spectatorAfterRenderObserver: Nullable<Observer<Camera>> = null;\r\n\r\n /**\r\n * Camera used to render xr content\r\n */\r\n public camera: WebXRCamera;\r\n /** A features manager for this xr session */\r\n public featuresManager: WebXRFeaturesManager;\r\n /**\r\n * Observers registered here will be triggered after the camera's initial transformation is set\r\n * This can be used to set a different ground level or an extra rotation.\r\n *\r\n * Note that ground level is considered to be at 0. The height defined by the XR camera will be added\r\n * to the position set after this observable is done executing.\r\n */\r\n public onInitialXRPoseSetObservable = new Observable<WebXRCamera>();\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n public onStateChangedObservable = new Observable<WebXRState>();\r\n /** Session manager used to keep track of xr session */\r\n public sessionManager: WebXRSessionManager;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n public state: WebXRState = WebXRState.NOT_IN_XR;\r\n\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param _scene The scene the helper should be created in\r\n */\r\n private constructor(private _scene: Scene) {\r\n this.sessionManager = new WebXRSessionManager(_scene);\r\n this.camera = new WebXRCamera(\"webxr\", _scene, this.sessionManager);\r\n this.featuresManager = new WebXRFeaturesManager(this.sessionManager);\r\n\r\n _scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n public static async CreateAsync(scene: Scene): Promise<WebXRExperienceHelper> {\r\n const helper = new WebXRExperienceHelper(scene);\r\n return await helper.sessionManager\r\n .initializeAsync()\r\n // eslint-disable-next-line github/no-then\r\n .then(() => {\r\n helper._supported = true;\r\n return helper;\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((e) => {\r\n helper._setState(WebXRState.NOT_IN_XR);\r\n helper.dispose();\r\n throw e;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.exitXRAsync();\r\n this._clearSpectatorObservers();\r\n this.camera.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.onInitialXRPoseSetObservable.clear();\r\n this.sessionManager.dispose();\r\n this._spectatorCamera?.dispose();\r\n if (this._nonVRCamera) {\r\n this._scene.activeCamera = this._nonVRCamera;\r\n }\r\n }\r\n\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionMode options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param renderTarget the output canvas that will be used to enter XR mode\r\n * @param sessionCreationOptions optional XRSessionInit object to init the session with\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n public async enterXRAsync(\r\n sessionMode: XRSessionMode,\r\n referenceSpaceType: XRReferenceSpaceType,\r\n renderTarget: WebXRRenderTarget = this.sessionManager.getWebXRRenderTarget(),\r\n sessionCreationOptions: XRSessionInit = {}\r\n ): Promise<WebXRSessionManager> {\r\n if (!this._supported) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"WebXR not supported in this browser or environment\";\r\n }\r\n this._setState(WebXRState.ENTERING_XR);\r\n if (referenceSpaceType !== \"viewer\" && referenceSpaceType !== \"local\") {\r\n sessionCreationOptions.optionalFeatures = sessionCreationOptions.optionalFeatures || [];\r\n sessionCreationOptions.optionalFeatures.push(referenceSpaceType);\r\n }\r\n sessionCreationOptions = await this.featuresManager._extendXRSessionInitObject(sessionCreationOptions);\r\n // we currently recommend \"unbounded\" space in AR (#7959)\r\n if (sessionMode === \"immersive-ar\" && referenceSpaceType !== \"unbounded\") {\r\n Logger.Warn(\"We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode\");\r\n }\r\n // make sure that the session mode is supported\r\n try {\r\n await this.sessionManager.initializeSessionAsync(sessionMode, sessionCreationOptions);\r\n await this.sessionManager.setReferenceSpaceTypeAsync(referenceSpaceType);\r\n\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.camera.maxZ || 10000,\r\n depthNear: this.camera.minZ,\r\n };\r\n\r\n // The layers feature will have already initialized the xr session's layers on session init.\r\n // A WebGPU-compatible XR session is layers-only (per the WebXR/WebGPU binding spec): the\r\n // baseLayer/XRWebGLLayer path cannot be used. The WebGPU XRProjectionLayer is wired up in a\r\n // later phase, so a WebGPU XR session currently enters with no layer and renders nothing yet.\r\n // Because no layer is attached, the session receives no requestAnimationFrame callbacks, so\r\n // onXRFrameObservable never fires and WebXRState stays at ENTERING_XR (it does NOT reach\r\n // IN_XR, which is gated on the first frame below) until the later-phase projection layer\r\n // produces that first frame. This is the expected Phase 1 end-state, not a regression, and\r\n // has been confirmed on Quest hardware as well as at the raw-browser level (a no-layer WebXR\r\n // session gets zero rAF callbacks). The session still ends cleanly via its native \"end\" path.\r\n if (!this._scene.getEngine().isWebGPU && !this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)) {\r\n const baseLayer = await renderTarget.initializeXRLayerAsync(this.sessionManager.session);\r\n xrRenderState.baseLayer = baseLayer;\r\n }\r\n\r\n this.sessionManager.updateRenderState(xrRenderState);\r\n // run the render loop\r\n this.sessionManager.runXRRenderLoop();\r\n // Cache pre xr scene settings\r\n this._originalSceneAutoClear = this._scene.autoClear;\r\n this._nonVRCamera = this._scene.activeCamera;\r\n this._attachedToElement = !!this._nonVRCamera?.inputs?.attachedToElement;\r\n this._nonVRCamera?.detachControl();\r\n\r\n this._scene.activeCamera = this.camera;\r\n // do not compensate when AR session is used\r\n if (sessionMode !== \"immersive-ar\") {\r\n this._nonXRToXRCamera();\r\n } else {\r\n // Kept here, TODO - check if needed\r\n this._scene.autoClear = false;\r\n this.camera.compensateOnFirstFrame = false;\r\n // reset the camera's position to the origin\r\n this.camera.position.set(0, 0, 0);\r\n this.camera.rotationQuaternion.set(0, 0, 0, 1);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n // Vision Pro suspends the audio context when entering XR, so we resume it here if needed.\r\n AbstractEngine.audioEngine?._resumeAudioContextOnStateChange();\r\n\r\n this.sessionManager.onXRSessionEnded.addOnce(() => {\r\n // when using the back button and not the exit button (default on mobile), the session is ending but the EXITING state was not set\r\n if (this.state !== WebXRState.EXITING_XR) {\r\n this._setState(WebXRState.EXITING_XR);\r\n }\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n for (const c of this.camera.rigCameras) {\r\n c.outputRenderTarget = null;\r\n }\r\n\r\n // Restore scene settings\r\n this._scene.autoClear = this._originalSceneAutoClear;\r\n this._scene.activeCamera = this._nonVRCamera;\r\n if (this._attachedToElement && this._nonVRCamera) {\r\n this._nonVRCamera.attachControl(!!this._nonVRCamera.inputs.noPreventDefault);\r\n }\r\n if (sessionMode !== \"immersive-ar\" && this.camera.compensateOnFirstFrame) {\r\n if ((<any>this._nonVRCamera).setPosition) {\r\n (<any>this._nonVRCamera).setPosition(this.camera.position);\r\n } else {\r\n this._nonVRCamera!.position.copyFrom(this.camera.position);\r\n }\r\n }\r\n\r\n this._setState(WebXRState.NOT_IN_XR);\r\n });\r\n\r\n // Wait until the first frame arrives before setting state to in xr\r\n this.sessionManager.onXRFrameObservable.addOnce(() => {\r\n this._setState(WebXRState.IN_XR);\r\n });\r\n return this.sessionManager;\r\n } catch (e) {\r\n Logger.Log(e);\r\n Logger.Log(e.message);\r\n this._setState(WebXRState.NOT_IN_XR);\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n public async exitXRAsync() {\r\n // only exit if state is IN_XR\r\n if (this.state !== WebXRState.IN_XR) {\r\n return;\r\n }\r\n this._setState(WebXRState.EXITING_XR);\r\n return await this.sessionManager.exitXRAsync();\r\n }\r\n\r\n /**\r\n * Enable spectator mode for desktop VR experiences.\r\n * When spectator mode is enabled a camera will be attached to the desktop canvas and will\r\n * display the first rig camera's view on the desktop canvas.\r\n * Please note that this will degrade performance, as it requires another camera render.\r\n * It is also not recommended to enable this in devices like the quest, as it brings no benefit there.\r\n * @param options giving WebXRSpectatorModeOption for specutator camera to setup when the spectator mode is enabled.\r\n */\r\n public enableSpectatorMode(options?: WebXRSpectatorModeOption): void {\r\n if (!this._spectatorMode) {\r\n this._spectatorMode = true;\r\n this._switchSpectatorMode(options);\r\n }\r\n }\r\n\r\n /**\r\n * Disable spectator mode for desktop VR experiences.\r\n */\r\n public disableSpecatatorMode(): void {\r\n if (this._spectatorMode) {\r\n this._spectatorMode = false;\r\n this._switchSpectatorMode();\r\n }\r\n }\r\n\r\n private _clearSpectatorObservers() {\r\n this.sessionManager.onXRFrameObservable.remove(this._spectatorXRFrameObserver);\r\n this._spectatorXRFrameObserver = null;\r\n this._scene.onAfterRenderCameraObservable.remove(this._spectatorAfterRenderObserver);\r\n this._spectatorAfterRenderObserver = null;\r\n this.onStateChangedObservable.remove(this._spectatorStateChangedObserver);\r\n this._spectatorStateChangedObserver = null;\r\n }\r\n\r\n private _switchSpectatorMode(options?: WebXRSpectatorModeOption): void {\r\n this._clearSpectatorObservers();\r\n\r\n const fps = options?.fps ? options.fps : 1000.0;\r\n const refreshRate = (1.0 / fps) * 1000.0;\r\n const cameraIndex = options?.preferredCameraIndex ? options?.preferredCameraIndex : 0;\r\n\r\n const updateSpectatorCamera = () => {\r\n if (this._spectatorCamera) {\r\n const delta = this.sessionManager.currentTimestamp - this._lastTimestamp;\r\n if (delta >= refreshRate) {\r\n this._lastTimestamp = this.sessionManager.currentTimestamp;\r\n this._spectatorCamera.position.copyFrom(this.camera.rigCameras[cameraIndex].globalPosition);\r\n this._spectatorCamera.rotationQuaternion?.copyFrom(this.camera.rigCameras[cameraIndex].absoluteRotation);\r\n }\r\n }\r\n };\r\n if (this._spectatorMode) {\r\n if (cameraIndex >= this.camera.rigCameras.length) {\r\n throw new Error(\"the preferred camera index is beyond the length of rig camera array.\");\r\n }\r\n const onStateChanged = () => {\r\n if (this.state === WebXRState.IN_XR) {\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = new UniversalCamera(\"webxr-spectator\", Vector3.Zero(), this._scene);\r\n this._spectatorCamera.rotationQuaternion = new Quaternion();\r\n this._scene.activeCameras = [this.camera, this._spectatorCamera];\r\n this._spectatorXRFrameObserver = this.sessionManager.onXRFrameObservable.add(updateSpectatorCamera);\r\n this._spectatorAfterRenderObserver = this._scene.onAfterRenderCameraObservable.add((camera) => {\r\n if (camera === this.camera) {\r\n // reset the dimensions object for correct resizing\r\n this._scene.getEngine().framebufferDimensionsObject = null;\r\n }\r\n });\r\n } else if (this.state === WebXRState.EXITING_XR) {\r\n this.sessionManager.onXRFrameObservable.remove(this._spectatorXRFrameObserver);\r\n this._spectatorXRFrameObserver = null;\r\n\r\n this._scene.onAfterRenderCameraObservable.remove(this._spectatorAfterRenderObserver);\r\n this._spectatorAfterRenderObserver = null;\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = null;\r\n this._scene.activeCameras = null;\r\n }\r\n };\r\n this._spectatorStateChangedObserver = this.onStateChangedObservable.add(onStateChanged);\r\n onStateChanged();\r\n } else {\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = null;\r\n this._scene.activeCameras = [this.camera];\r\n }\r\n }\r\n\r\n private _nonXRToXRCamera() {\r\n this.camera.setTransformationFromNonVRCamera(this._nonVRCamera!);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n private _setState(val: WebXRState) {\r\n if (this.state === val) {\r\n return;\r\n }\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRExperienceHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRExperienceHelper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAiB,MAAM,oBAAoB,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAChF,OAAO,EAAE,0BAA0B,EAAE,uCAAuC,EAAE,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AAC/I,OAAO,EA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CAAC,8BAA8B,GAAG,IAAI,CAAC,wBAAwB,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACxF,cAAc,EAAE,CAAC;QACrB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,gBAAgB,EAAE,OAAO,EAAE,CAAC;YACjC,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,MAAM,CAAC,aAAa,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9C,CAAC;IACL,CAAC;IAEO,gBAAgB;QACpB,IAAI,CAAC,MAAM,CAAC,gCAAgC,CAAC,IAAI,CAAC,YAAa,CAAC,CAAC;QACjE,IAAI,CAAC,4BAA4B,CAAC,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnE,CAAC;IAEO,SAAS,CAAC,GAAe;QAC7B,IAAI,IAAI,CAAC,KAAK,KAAK,GAAG,EAAE,CAAC;YACrB,OAAO;QACX,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,wBAAwB,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC9D,CAAC;CACJ","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { Observable, type Observer } from \"../Misc/observable\";\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type Camera } from \"../Cameras/camera\";\r\nimport { WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { WebXRCamera } from \"./webXRCamera\";\r\nimport { type WebXRRenderTarget, WebXRState } from \"./webXRTypes\";\r\nimport { WebXRFeatureName, WebXRFeaturesManager } from \"./webXRFeaturesManager\";\r\nimport { IsWebGPUXREngineCompatible, WebGPUXREngineNotCompatibleErrorMessage, WebGPUXRNotSupportedErrorMessage } from \"./webXRGraphicsBinding\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { UniversalCamera } from \"../Cameras/universalCamera.pure\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\n\r\n/**\r\n * Options for setting up XR spectator camera.\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface WebXRSpectatorModeOption {\r\n /**\r\n * Expected refresh rate (frames per sec) for a spectator camera.\r\n */\r\n fps?: number;\r\n /**\r\n * The index of rigCameras array in a WebXR camera.\r\n */\r\n preferredCameraIndex?: number;\r\n}\r\n\r\n/**\r\n * Base set of functionality needed to create an XR experience (WebXRSessionManager, Camera, StateManagement, etc.)\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRExperienceHelpers\r\n */\r\nexport class WebXRExperienceHelper implements IDisposable {\r\n private _nonVRCamera: Nullable<Camera> = null;\r\n private _attachedToElement: boolean = false;\r\n private _spectatorCamera: Nullable<UniversalCamera> = null;\r\n private _originalSceneAutoClear = true;\r\n private _supported = false;\r\n private _spectatorMode = false;\r\n private _lastTimestamp = 0;\r\n private _spectatorStateChangedObserver: Nullable<Observer<WebXRState>> = null;\r\n private _spectatorXRFrameObserver: Nullable<Observer<XRFrame>> = null;\r\n private _spectatorAfterRenderObserver: Nullable<Observer<Camera>> = null;\r\n\r\n /**\r\n * Camera used to render xr content\r\n */\r\n public camera: WebXRCamera;\r\n /** A features manager for this xr session */\r\n public featuresManager: WebXRFeaturesManager;\r\n /**\r\n * Observers registered here will be triggered after the camera's initial transformation is set\r\n * This can be used to set a different ground level or an extra rotation.\r\n *\r\n * Note that ground level is considered to be at 0. The height defined by the XR camera will be added\r\n * to the position set after this observable is done executing.\r\n */\r\n public onInitialXRPoseSetObservable = new Observable<WebXRCamera>();\r\n /**\r\n * Fires when the state of the experience helper has changed\r\n */\r\n public onStateChangedObservable = new Observable<WebXRState>();\r\n /** Session manager used to keep track of xr session */\r\n public sessionManager: WebXRSessionManager;\r\n /**\r\n * The current state of the XR experience (eg. transitioning, in XR or not in XR)\r\n */\r\n public state: WebXRState = WebXRState.NOT_IN_XR;\r\n\r\n /**\r\n * Creates a WebXRExperienceHelper\r\n * @param _scene The scene the helper should be created in\r\n */\r\n private constructor(private _scene: Scene) {\r\n this.sessionManager = new WebXRSessionManager(_scene);\r\n this.camera = new WebXRCamera(\"webxr\", _scene, this.sessionManager);\r\n this.featuresManager = new WebXRFeaturesManager(this.sessionManager);\r\n this.sessionManager.onXRSessionInit.add(() => {\r\n if (this._scene.getEngine().isWebGPU && !this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)?.attached) {\r\n throw new Error(\"WebGPU XR could not attach the required WebXR Layers feature.\");\r\n }\r\n });\r\n\r\n _scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n }\r\n\r\n /**\r\n * Creates the experience helper\r\n * @param scene the scene to attach the experience helper to\r\n * @returns a promise for the experience helper\r\n */\r\n public static async CreateAsync(scene: Scene): Promise<WebXRExperienceHelper> {\r\n const helper = new WebXRExperienceHelper(scene);\r\n return await helper.sessionManager\r\n .initializeAsync()\r\n // eslint-disable-next-line github/no-then\r\n .then(() => {\r\n helper._supported = true;\r\n return helper;\r\n })\r\n // eslint-disable-next-line github/no-then\r\n .catch((e) => {\r\n helper._setState(WebXRState.NOT_IN_XR);\r\n helper.dispose();\r\n throw e;\r\n });\r\n }\r\n\r\n /**\r\n * Disposes of the experience helper\r\n */\r\n public dispose() {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.exitXRAsync();\r\n this._clearSpectatorObservers();\r\n this.camera.dispose();\r\n this.onStateChangedObservable.clear();\r\n this.onInitialXRPoseSetObservable.clear();\r\n this.sessionManager.dispose();\r\n this._spectatorCamera?.dispose();\r\n if (this._nonVRCamera) {\r\n this._scene.activeCamera = this._nonVRCamera;\r\n }\r\n }\r\n\r\n /**\r\n * Enters XR mode (This must be done within a user interaction in most browsers eg. button click)\r\n * @param sessionMode options for the XR session\r\n * @param referenceSpaceType frame of reference of the XR session\r\n * @param renderTarget the output canvas that will be used to enter XR mode\r\n * @param sessionCreationOptions optional XRSessionInit object to init the session with\r\n * @returns promise that resolves after xr mode has entered\r\n */\r\n public async enterXRAsync(\r\n sessionMode: XRSessionMode,\r\n referenceSpaceType: XRReferenceSpaceType,\r\n renderTarget?: WebXRRenderTarget,\r\n sessionCreationOptions: XRSessionInit = {}\r\n ): Promise<WebXRSessionManager> {\r\n if (!this._supported) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"WebXR not supported in this browser or environment\";\r\n }\r\n if (this._scene.getEngine().isWebGPU) {\r\n if (!IsWebGPUXREngineCompatible(this._scene.getEngine())) {\r\n throw new Error(WebGPUXREngineNotCompatibleErrorMessage);\r\n }\r\n if (!WebXRSessionManager.IsWebGPUXRSupported) {\r\n throw new Error(WebGPUXRNotSupportedErrorMessage);\r\n }\r\n if (!this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)) {\r\n throw new Error(\"WebGPU XR requires the WebXR Layers feature. Import and enable WebXRLayers before calling enterXRAsync.\");\r\n }\r\n sessionCreationOptions = {\r\n ...sessionCreationOptions,\r\n requiredFeatures: sessionCreationOptions.requiredFeatures ? [...sessionCreationOptions.requiredFeatures] : undefined,\r\n optionalFeatures: sessionCreationOptions.optionalFeatures ? [...sessionCreationOptions.optionalFeatures] : undefined,\r\n };\r\n }\r\n renderTarget ??= this.sessionManager.getWebXRRenderTarget();\r\n this._setState(WebXRState.ENTERING_XR);\r\n if (referenceSpaceType !== \"viewer\" && referenceSpaceType !== \"local\") {\r\n sessionCreationOptions.optionalFeatures = sessionCreationOptions.optionalFeatures || [];\r\n sessionCreationOptions.optionalFeatures.push(referenceSpaceType);\r\n }\r\n sessionCreationOptions = await this.featuresManager._extendXRSessionInitObject(sessionCreationOptions);\r\n if (this._scene.getEngine().isWebGPU) {\r\n const requiredFeatures = sessionCreationOptions.requiredFeatures ? [...sessionCreationOptions.requiredFeatures] : [];\r\n if (!requiredFeatures.includes(\"layers\")) {\r\n requiredFeatures.push(\"layers\");\r\n }\r\n sessionCreationOptions = {\r\n ...sessionCreationOptions,\r\n requiredFeatures,\r\n optionalFeatures: sessionCreationOptions.optionalFeatures?.filter((feature) => feature !== \"layers\"),\r\n };\r\n }\r\n // we currently recommend \"unbounded\" space in AR (#7959)\r\n if (sessionMode === \"immersive-ar\" && referenceSpaceType !== \"unbounded\") {\r\n Logger.Warn(\"We recommend using 'unbounded' reference space type when using 'immersive-ar' session mode\");\r\n }\r\n this._originalSceneAutoClear = this._scene.autoClear;\r\n this._nonVRCamera = this._scene.activeCamera;\r\n this._attachedToElement = !!this._nonVRCamera?.inputs?.attachedToElement;\r\n let sceneStateChanged = false;\r\n const sessionEndedObserver = this.sessionManager.onXRSessionEnded.add(\r\n () => {\r\n // when using the back button and not the exit button (default on mobile), the session is ending but the EXITING state was not set\r\n if (this.state !== WebXRState.EXITING_XR) {\r\n this._setState(WebXRState.EXITING_XR);\r\n }\r\n if (sceneStateChanged) {\r\n // Reset camera rigs output render target to ensure sessions render target is not drawn after it ends\r\n for (const c of this.camera.rigCameras) {\r\n c.outputRenderTarget = null;\r\n }\r\n\r\n // Restore scene settings\r\n this._scene.autoClear = this._originalSceneAutoClear;\r\n this._scene.activeCamera = this._nonVRCamera;\r\n if (this._attachedToElement && this._nonVRCamera) {\r\n this._nonVRCamera.attachControl(!!this._nonVRCamera.inputs.noPreventDefault);\r\n }\r\n if (sessionMode !== \"immersive-ar\" && this.camera.compensateOnFirstFrame) {\r\n if ((<any>this._nonVRCamera).setPosition) {\r\n (<any>this._nonVRCamera).setPosition(this.camera.position);\r\n } else {\r\n this._nonVRCamera!.position.copyFrom(this.camera.position);\r\n }\r\n }\r\n }\r\n\r\n this._setState(WebXRState.NOT_IN_XR);\r\n },\r\n undefined,\r\n // Restore the scene before feature observers in case one of them throws during teardown.\r\n true,\r\n undefined,\r\n true\r\n );\r\n // make sure that the session mode is supported\r\n try {\r\n await this.sessionManager.initializeSessionAsync(sessionMode, sessionCreationOptions);\r\n await this.sessionManager.setReferenceSpaceTypeAsync(referenceSpaceType);\r\n\r\n const xrRenderState: XRRenderStateInit = {\r\n // if maxZ is 0 it should be \"Infinity\", but it doesn't work with the WebXR API. Setting to a large number.\r\n depthFar: this.camera.maxZ || 10000,\r\n depthNear: this.camera.minZ,\r\n };\r\n\r\n // The layers feature will have already initialized the XR session's layers on session init.\r\n // WebGPU-XR is layers-only, while WebGL can continue to use the legacy base-layer path.\r\n if (!this._scene.getEngine().isWebGPU && !this.featuresManager.getEnabledFeature(WebXRFeatureName.LAYERS)) {\r\n const baseLayer = await renderTarget.initializeXRLayerAsync(this.sessionManager.session);\r\n xrRenderState.baseLayer = baseLayer;\r\n }\r\n\r\n this.sessionManager.updateRenderState(xrRenderState);\r\n // run the render loop\r\n this.sessionManager.runXRRenderLoop();\r\n // Switch the scene to the XR camera.\r\n sceneStateChanged = true;\r\n this._nonVRCamera?.detachControl();\r\n\r\n this._scene.activeCamera = this.camera;\r\n // do not compensate when AR session is used\r\n if (sessionMode !== \"immersive-ar\") {\r\n this._nonXRToXRCamera();\r\n } else {\r\n // Kept here, TODO - check if needed\r\n this._scene.autoClear = false;\r\n this.camera.compensateOnFirstFrame = false;\r\n // reset the camera's position to the origin\r\n this.camera.position.set(0, 0, 0);\r\n this.camera.rotationQuaternion.set(0, 0, 0, 1);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n // Vision Pro suspends the audio context when entering XR, so we resume it here if needed.\r\n AbstractEngine.audioEngine?._resumeAudioContextOnStateChange();\r\n\r\n // Wait until the first frame arrives before setting state to in xr\r\n this.sessionManager.onXRFrameObservable.addOnce(() => {\r\n this._setState(WebXRState.IN_XR);\r\n });\r\n return this.sessionManager;\r\n } catch (e) {\r\n if (this.sessionManager.inXRSession) {\r\n await this.sessionManager.exitXRAsync();\r\n }\r\n if (!this.sessionManager.inXRSession) {\r\n this.sessionManager.onXRSessionEnded.remove(sessionEndedObserver);\r\n }\r\n Logger.Log(e);\r\n Logger.Log(e.message);\r\n this._setState(this.sessionManager.inXRSession ? WebXRState.ENTERING_XR : WebXRState.NOT_IN_XR);\r\n throw e;\r\n }\r\n }\r\n\r\n /**\r\n * Exits XR mode and returns the scene to its original state\r\n * @returns promise that resolves after xr mode has exited\r\n */\r\n public async exitXRAsync() {\r\n const isSessionStarting = this.state === WebXRState.ENTERING_XR && this.sessionManager.inXRSession;\r\n if (this.state !== WebXRState.IN_XR && !isSessionStarting) {\r\n return;\r\n }\r\n const previousState = this.state;\r\n this._setState(WebXRState.EXITING_XR);\r\n await this.sessionManager.exitXRAsync();\r\n if (this.sessionManager.inXRSession) {\r\n this._setState(previousState);\r\n }\r\n }\r\n\r\n /**\r\n * Enable spectator mode for desktop VR experiences.\r\n * When spectator mode is enabled a camera will be attached to the desktop canvas and will\r\n * display the first rig camera's view on the desktop canvas.\r\n * Please note that this will degrade performance, as it requires another camera render.\r\n * It is also not recommended to enable this in devices like the quest, as it brings no benefit there.\r\n * @param options giving WebXRSpectatorModeOption for specutator camera to setup when the spectator mode is enabled.\r\n */\r\n public enableSpectatorMode(options?: WebXRSpectatorModeOption): void {\r\n if (!this._spectatorMode) {\r\n this._spectatorMode = true;\r\n this._switchSpectatorMode(options);\r\n }\r\n }\r\n\r\n /**\r\n * Disable spectator mode for desktop VR experiences.\r\n */\r\n public disableSpecatatorMode(): void {\r\n if (this._spectatorMode) {\r\n this._spectatorMode = false;\r\n this._switchSpectatorMode();\r\n }\r\n }\r\n\r\n private _clearSpectatorObservers() {\r\n this.sessionManager.onXRFrameObservable.remove(this._spectatorXRFrameObserver);\r\n this._spectatorXRFrameObserver = null;\r\n this._scene.onAfterRenderCameraObservable.remove(this._spectatorAfterRenderObserver);\r\n this._spectatorAfterRenderObserver = null;\r\n this.onStateChangedObservable.remove(this._spectatorStateChangedObserver);\r\n this._spectatorStateChangedObserver = null;\r\n }\r\n\r\n private _switchSpectatorMode(options?: WebXRSpectatorModeOption): void {\r\n this._clearSpectatorObservers();\r\n\r\n const fps = options?.fps ? options.fps : 1000.0;\r\n const refreshRate = (1.0 / fps) * 1000.0;\r\n const cameraIndex = options?.preferredCameraIndex ? options?.preferredCameraIndex : 0;\r\n\r\n const updateSpectatorCamera = () => {\r\n if (this._spectatorCamera) {\r\n const delta = this.sessionManager.currentTimestamp - this._lastTimestamp;\r\n if (delta >= refreshRate) {\r\n this._lastTimestamp = this.sessionManager.currentTimestamp;\r\n this._spectatorCamera.position.copyFrom(this.camera.rigCameras[cameraIndex].globalPosition);\r\n this._spectatorCamera.rotationQuaternion?.copyFrom(this.camera.rigCameras[cameraIndex].absoluteRotation);\r\n }\r\n }\r\n };\r\n if (this._spectatorMode) {\r\n if (cameraIndex >= this.camera.rigCameras.length) {\r\n throw new Error(\"the preferred camera index is beyond the length of rig camera array.\");\r\n }\r\n const onStateChanged = () => {\r\n if (this.state === WebXRState.IN_XR) {\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = new UniversalCamera(\"webxr-spectator\", Vector3.Zero(), this._scene);\r\n this._spectatorCamera.rotationQuaternion = new Quaternion();\r\n this._scene.activeCameras = [this.camera, this._spectatorCamera];\r\n this._spectatorXRFrameObserver = this.sessionManager.onXRFrameObservable.add(updateSpectatorCamera);\r\n this._spectatorAfterRenderObserver = this._scene.onAfterRenderCameraObservable.add((camera) => {\r\n if (camera === this.camera) {\r\n // reset the dimensions object for correct resizing\r\n this._scene.getEngine().framebufferDimensionsObject = null;\r\n }\r\n });\r\n } else if (this.state === WebXRState.EXITING_XR) {\r\n this.sessionManager.onXRFrameObservable.remove(this._spectatorXRFrameObserver);\r\n this._spectatorXRFrameObserver = null;\r\n\r\n this._scene.onAfterRenderCameraObservable.remove(this._spectatorAfterRenderObserver);\r\n this._spectatorAfterRenderObserver = null;\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = null;\r\n this._scene.activeCameras = null;\r\n }\r\n };\r\n this._spectatorStateChangedObserver = this.onStateChangedObservable.add(onStateChanged);\r\n onStateChanged();\r\n } else {\r\n this._spectatorCamera?.dispose();\r\n this._spectatorCamera = null;\r\n this._scene.activeCameras = [this.camera];\r\n }\r\n }\r\n\r\n private _nonXRToXRCamera() {\r\n this.camera.setTransformationFromNonVRCamera(this._nonVRCamera!);\r\n this.onInitialXRPoseSetObservable.notifyObservers(this.camera);\r\n }\r\n\r\n private _setState(val: WebXRState) {\r\n if (this.state === val) {\r\n return;\r\n }\r\n this.state = val;\r\n this.onStateChangedObservable.notifyObservers(this.state);\r\n }\r\n}\r\n"]}
@@ -21,6 +21,7 @@ import { type IWebXRNearInteractionOptions, type WebXRNearInteraction } from "./
21
21
  import { type IWebXRPlaneDetectorOptions, type WebXRPlaneDetector } from "./features/WebXRPlaneDetector.js";
22
22
  import { type IWebXRRawCameraAccessOptions, type WebXRRawCameraAccess } from "./features/WebXRRawCameraAccess.js";
23
23
  import { type WebXRSpaceWarp } from "./features/WebXRSpaceWarp.js";
24
+ import { type WebXRTrackedSources } from "./features/WebXRTrackedSources.js";
24
25
  import { type IWebXRWalkingLocomotionOptions, type WebXRWalkingLocomotion } from "./features/WebXRWalkingLocomotion.js";
25
26
  import { type WebXRSessionManager } from "./webXRSessionManager.js";
26
27
  /**
@@ -179,6 +180,10 @@ export declare class WebXRFeatureName {
179
180
  * The name of the body tracking feature
180
181
  */
181
182
  static readonly BODY_TRACKING: "xr-body-tracking";
183
+ /**
184
+ * The name of the tracked sources feature
185
+ */
186
+ static readonly TRACKED_SOURCES: "xr-tracked-sources";
182
187
  }
183
188
  export type WebXRFeatureNameType = (typeof WebXRFeatureName)[Exclude<keyof typeof WebXRFeatureName, "prototype">];
184
189
  /**
@@ -229,6 +234,8 @@ export interface IWebXRFeatureNameTypeMap {
229
234
  [WebXRFeatureName.WALKING_LOCOMOTION]: WebXRWalkingLocomotion;
230
235
  /** Body tracking feature implementation. */
231
236
  [WebXRFeatureName.BODY_TRACKING]: WebXRBodyTracking;
237
+ /** Tracked sources feature implementation. */
238
+ [WebXRFeatureName.TRACKED_SOURCES]: WebXRTrackedSources;
232
239
  }
233
240
  /**
234
241
  * Maps feature names to their corresponding options interfaces.
@@ -278,6 +285,8 @@ export interface IWebXRFeatureNameOptionsMap {
278
285
  [WebXRFeatureName.WALKING_LOCOMOTION]: IWebXRWalkingLocomotionOptions;
279
286
  /** Body tracking feature options. */
280
287
  [WebXRFeatureName.BODY_TRACKING]: IWebXRBodyTrackingOptions;
288
+ /** Tracked sources feature options. */
289
+ [WebXRFeatureName.TRACKED_SOURCES]: undefined;
281
290
  }
282
291
  /**
283
292
  * Helper type that expands/flattens a type to show its properties inline in IntelliSense
@@ -93,6 +93,10 @@ WebXRFeatureName.RAW_CAMERA_ACCESS = "xr-raw-camera-access";
93
93
  * The name of the body tracking feature
94
94
  */
95
95
  WebXRFeatureName.BODY_TRACKING = "xr-body-tracking";
96
+ /**
97
+ * The name of the tracked sources feature
98
+ */
99
+ WebXRFeatureName.TRACKED_SOURCES = "xr-tracked-sources";
96
100
  /**
97
101
  * The WebXR features manager is responsible of enabling or disabling features required for the current XR session.
98
102
  * It is mainly used in AR sessions.
@@ -1 +1 @@
1
- {"version":3,"file":"webXRFeaturesManager.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRFeaturesManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAwB3C,OAAO,EAAE,0CAA0C,EAAE,MAAM,+BAA+B,CAAC;AA2E3F;;GAEG;AACH,MAAM,OAAO,gBAAgB;;AACzB;;GAEG;AACoB,8BAAa,GAAG,kBAA2B,CAAC;AACnE;;GAEG;AACoB,mCAAkB,GAAG,uBAAgC,CAAC;AAC7E;;GAEG;AACoB,yBAAQ,GAAG,aAAsB,CAAC;AACzD;;GAEG;AACoB,+BAAc,GAAG,mBAA4B,CAAC;AACrE;;GAEG;AACoB,oCAAmB,GAAG,uBAAgC,CAAC;AAC9E;;GAEG;AACoB,gCAAe,GAAG,oBAA6B,CAAC;AACvE;;GAEG;AACoB,kCAAiB,GAAG,iCAA0C,CAAC;AACtF;;GAEG;AACoB,8BAAa,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,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;wBAC5D,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACpD,CAAC;gBACL,CAAC;YACL,CAAC;YACD,IAAI,OAAO,CAAC,qBAAqB,CAAC,yBAAyB,EAAE,CAAC;gBAC1D,4CAA4C;gBAC5C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,qBAAqB,CAAC,yBAAyB,EAAE,CAAC;gBACjF,aAAa,GAAG;oBACZ,GAAG,aAAa;oBAChB,GAAG,QAAQ;iBACd,CAAC;YACN,CAAC;QACL,CAAC;QACD,OAAO,aAAa,CAAC;IACzB,CAAC;;AAnWuB,uCAAkB,GAMtC,EAAE,AANoC,CAMnC;AAWP;;GAEG;AACqB,yCAAoB,GAA8B;IACtE,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,QAAQ;IAC3D,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,aAAa;CAC9D,AAH2C,CAG1C","sourcesContent":["import { type Observable } from \"core/Misc/observable\";\r\nimport { Tools } from \"../Misc/tools.pure\";\r\nimport { type IDisposable } from \"../scene\";\r\nimport { type IWebXRAnchorSystemOptions, type WebXRAnchorSystem } from \"./features/WebXRAnchorSystem\";\r\nimport { type IWebXRBackgroundRemoverOptions, type WebXRBackgroundRemover } from \"./features/WebXRBackgroundRemover\";\r\nimport { type IWebXRBodyTrackingOptions, type WebXRBodyTracking } from \"./features/WebXRBodyTracking\";\r\nimport { type IWebXRControllerMovementOptions, type WebXRControllerMovement } from \"./features/WebXRControllerMovement\";\r\nimport { type IWebXRControllerPhysicsOptions, type WebXRControllerPhysics } from \"./features/WebXRControllerPhysics\";\r\nimport { type IWebXRControllerPointerSelectionOptions, type WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport { type IWebXRTeleportationOptions, type WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { type IWebXRDepthSensingOptions, type WebXRDepthSensing } from \"./features/WebXRDepthSensing\";\r\nimport { type IWebXRDomOverlayOptions, type WebXRDomOverlay } from \"./features/WebXRDOMOverlay\";\r\nimport { type WebXREyeTracking } from \"./features/WebXREyeTracking\";\r\nimport { type WebXRFeaturePointSystem } from \"./features/WebXRFeaturePointSystem\";\r\nimport { type IWebXRHandTrackingOptions, type WebXRHandTracking } from \"./features/WebXRHandTracking\";\r\nimport { type IWebXRHitTestOptions, type WebXRHitTest } from \"./features/WebXRHitTest\";\r\nimport { type IWebXRImageTrackingOptions, type WebXRImageTracking } from \"./features/WebXRImageTracking\";\r\nimport { type IWebXRLayersOptions, type WebXRLayers } from \"./features/WebXRLayers\";\r\nimport { type IWebXRLightEstimationOptions, type WebXRLightEstimation } from \"./features/WebXRLightEstimation\";\r\nimport { type IWebXRMeshDetectorOptions, type WebXRMeshDetector } from \"./features/WebXRMeshDetector\";\r\nimport { type IWebXRNearInteractionOptions, type WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport { type IWebXRPlaneDetectorOptions, type WebXRPlaneDetector } from \"./features/WebXRPlaneDetector\";\r\nimport { type IWebXRRawCameraAccessOptions, type WebXRRawCameraAccess } from \"./features/WebXRRawCameraAccess\";\r\nimport { type WebXRSpaceWarp } from \"./features/WebXRSpaceWarp\";\r\nimport { type IWebXRWalkingLocomotionOptions, type WebXRWalkingLocomotion } from \"./features/WebXRWalkingLocomotion\";\r\nimport { _ConsumeWebXRFeatureSpecificDisableWarning } from \"./webXRFeatureWarningRegistry\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\n\r\n/**\r\n * Defining the interface required for a (webxr) feature\r\n */\r\nexport interface IWebXRFeature extends IDisposable {\r\n /**\r\n * Is this feature attached\r\n */\r\n attached: boolean;\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n disableAutoAttach: boolean;\r\n /**\r\n * The auto-attach policy in effect before the features manager starts a manual attachment.\r\n * @internal\r\n */\r\n _autoAttachPolicyBeforeAttach?: boolean;\r\n\r\n /**\r\n * Attach the feature to the session\r\n * Will usually be called by the features manager\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful.\r\n */\r\n attach(force?: boolean): boolean;\r\n /**\r\n * Detach the feature from the session\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n detach(): boolean;\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 isCompatible(): boolean;\r\n\r\n /**\r\n * Was this feature disposed;\r\n */\r\n isDisposed: boolean;\r\n\r\n /**\r\n * The name of the native xr feature name, if applicable (like anchor, hit-test, or hand-tracking)\r\n */\r\n xrNativeFeatureName?: string;\r\n\r\n /**\r\n * A list of (Babylon WebXR) features this feature depends on\r\n */\r\n dependsOn?: string[];\r\n\r\n /**\r\n * If this feature requires to extend the XRSessionInit object, this function will return the partial XR session init object\r\n */\r\n getXRSessionInitExtension?: () => Promise<Partial<XRSessionInit>>;\r\n\r\n /**\r\n * Triggered when the feature is attached\r\n */\r\n onFeatureAttachObservable: Observable<IWebXRFeature>;\r\n /**\r\n * Triggered when the feature is detached\r\n */\r\n onFeatureDetachObservable: Observable<IWebXRFeature>;\r\n}\r\n\r\n/**\r\n * A list of the currently available features without referencing them\r\n */\r\nexport class WebXRFeatureName {\r\n /**\r\n * The name of the anchor system feature\r\n */\r\n public static readonly ANCHOR_SYSTEM = \"xr-anchor-system\" as const;\r\n /**\r\n * The name of the background remover feature\r\n */\r\n public static readonly BACKGROUND_REMOVER = \"xr-background-remover\" as const;\r\n /**\r\n * The name of the hit test feature\r\n */\r\n public static readonly HIT_TEST = \"xr-hit-test\" as const;\r\n /**\r\n * The name of the mesh detection feature\r\n */\r\n public static readonly MESH_DETECTION = \"xr-mesh-detection\" as const;\r\n /**\r\n * physics impostors for xr controllers feature\r\n */\r\n public static readonly PHYSICS_CONTROLLERS = \"xr-physics-controller\" as const;\r\n /**\r\n * The name of the plane detection feature\r\n */\r\n public static readonly PLANE_DETECTION = \"xr-plane-detection\" as const;\r\n /**\r\n * The name of the pointer selection feature\r\n */\r\n public static readonly POINTER_SELECTION = \"xr-controller-pointer-selection\" as const;\r\n /**\r\n * The name of the teleportation feature\r\n */\r\n public static readonly TELEPORTATION = \"xr-controller-teleportation\" as const;\r\n /**\r\n * The name of the feature points feature.\r\n */\r\n public static readonly FEATURE_POINTS = \"xr-feature-points\" as const;\r\n /**\r\n * The name of the hand tracking feature.\r\n */\r\n public static readonly HAND_TRACKING = \"xr-hand-tracking\" as const;\r\n /**\r\n * The name of the image tracking feature\r\n */\r\n public static readonly IMAGE_TRACKING = \"xr-image-tracking\" as const;\r\n /**\r\n * The name of the near interaction feature\r\n */\r\n public static readonly NEAR_INTERACTION = \"xr-near-interaction\" as const;\r\n /**\r\n * The name of the DOM overlay feature\r\n */\r\n public static readonly DOM_OVERLAY = \"xr-dom-overlay\" as const;\r\n /**\r\n * The name of the movement feature\r\n */\r\n public static readonly MOVEMENT = \"xr-controller-movement\" as const;\r\n /**\r\n * The name of the light estimation feature\r\n */\r\n public static readonly LIGHT_ESTIMATION = \"xr-light-estimation\" as const;\r\n /**\r\n * The name of the eye tracking feature\r\n */\r\n public static readonly EYE_TRACKING = \"xr-eye-tracking\" as const;\r\n /**\r\n * The name of the walking locomotion feature\r\n */\r\n public static readonly WALKING_LOCOMOTION = \"xr-walking-locomotion\" as const;\r\n /**\r\n * The name of the composition layers feature\r\n */\r\n public static readonly LAYERS = \"xr-layers\" as const;\r\n /**\r\n * The name of the depth sensing feature\r\n */\r\n public static readonly DEPTH_SENSING = \"xr-depth-sensing\" as const;\r\n /**\r\n * The name of the WebXR Space Warp feature\r\n */\r\n public static readonly SPACE_WARP = \"xr-space-warp\" as const;\r\n /**\r\n * The name of the WebXR Raw Camera Access feature\r\n */\r\n public static readonly RAW_CAMERA_ACCESS = \"xr-raw-camera-access\" as const;\r\n /**\r\n * The name of the body tracking feature\r\n */\r\n public static readonly BODY_TRACKING = \"xr-body-tracking\" as const;\r\n}\r\n\r\nexport type WebXRFeatureNameType = (typeof WebXRFeatureName)[Exclude<keyof typeof WebXRFeatureName, \"prototype\">];\r\n\r\n/**\r\n * Maps feature names to their corresponding feature implementation classes.\r\n */\r\nexport interface IWebXRFeatureNameTypeMap {\r\n /** Anchor system feature implementation. */\r\n [WebXRFeatureName.ANCHOR_SYSTEM]: WebXRAnchorSystem;\r\n /** Background remover feature implementation. */\r\n [WebXRFeatureName.BACKGROUND_REMOVER]: WebXRBackgroundRemover;\r\n /** Depth sensing feature implementation. */\r\n [WebXRFeatureName.DEPTH_SENSING]: WebXRDepthSensing;\r\n /** DOM overlay feature implementation. */\r\n [WebXRFeatureName.DOM_OVERLAY]: WebXRDomOverlay;\r\n /** Eye tracking feature implementation. */\r\n [WebXRFeatureName.EYE_TRACKING]: WebXREyeTracking;\r\n /** Feature points feature implementation. */\r\n [WebXRFeatureName.FEATURE_POINTS]: WebXRFeaturePointSystem;\r\n /** Hand tracking feature implementation. */\r\n [WebXRFeatureName.HAND_TRACKING]: WebXRHandTracking;\r\n /** Hit test feature implementation. */\r\n [WebXRFeatureName.HIT_TEST]: WebXRHitTest;\r\n /** Image tracking feature implementation. */\r\n [WebXRFeatureName.IMAGE_TRACKING]: WebXRImageTracking;\r\n /** Layers feature implementation. */\r\n [WebXRFeatureName.LAYERS]: WebXRLayers;\r\n /** Light estimation feature implementation. */\r\n [WebXRFeatureName.LIGHT_ESTIMATION]: WebXRLightEstimation;\r\n /** Mesh detection feature implementation. */\r\n [WebXRFeatureName.MESH_DETECTION]: WebXRMeshDetector;\r\n /** Controller movement feature implementation. */\r\n [WebXRFeatureName.MOVEMENT]: WebXRControllerMovement;\r\n /** Near interaction feature implementation. */\r\n [WebXRFeatureName.NEAR_INTERACTION]: WebXRNearInteraction;\r\n /** Physics controllers feature implementation. */\r\n [WebXRFeatureName.PHYSICS_CONTROLLERS]: WebXRControllerPhysics;\r\n /** Plane detection feature implementation. */\r\n [WebXRFeatureName.PLANE_DETECTION]: WebXRPlaneDetector;\r\n /** Controller pointer selection feature implementation. */\r\n [WebXRFeatureName.POINTER_SELECTION]: WebXRControllerPointerSelection;\r\n /** Raw camera access feature implementation. */\r\n [WebXRFeatureName.RAW_CAMERA_ACCESS]: WebXRRawCameraAccess;\r\n /** Space warp feature implementation. */\r\n [WebXRFeatureName.SPACE_WARP]: WebXRSpaceWarp;\r\n /** Teleportation feature implementation. */\r\n [WebXRFeatureName.TELEPORTATION]: WebXRMotionControllerTeleportation;\r\n /** Walking locomotion feature implementation. */\r\n [WebXRFeatureName.WALKING_LOCOMOTION]: WebXRWalkingLocomotion;\r\n /** Body tracking feature implementation. */\r\n [WebXRFeatureName.BODY_TRACKING]: WebXRBodyTracking;\r\n}\r\n\r\n/**\r\n * Maps feature names to their corresponding options interfaces.\r\n */\r\nexport interface IWebXRFeatureNameOptionsMap {\r\n /** Anchor system feature options. */\r\n [WebXRFeatureName.ANCHOR_SYSTEM]: IWebXRAnchorSystemOptions;\r\n /** Background remover feature options. */\r\n [WebXRFeatureName.BACKGROUND_REMOVER]: IWebXRBackgroundRemoverOptions;\r\n /** Depth sensing feature options. */\r\n [WebXRFeatureName.DEPTH_SENSING]: IWebXRDepthSensingOptions;\r\n /** DOM overlay feature options. */\r\n [WebXRFeatureName.DOM_OVERLAY]: IWebXRDomOverlayOptions;\r\n /** Eye tracking feature options. */\r\n [WebXRFeatureName.EYE_TRACKING]: undefined;\r\n /** Feature points feature options. */\r\n [WebXRFeatureName.FEATURE_POINTS]: undefined;\r\n /** Hand tracking feature options. */\r\n [WebXRFeatureName.HAND_TRACKING]: IWebXRHandTrackingOptions;\r\n /** Hit test feature options. */\r\n [WebXRFeatureName.HIT_TEST]: IWebXRHitTestOptions;\r\n /** Image tracking feature options. */\r\n [WebXRFeatureName.IMAGE_TRACKING]: IWebXRImageTrackingOptions;\r\n /** Layers feature options. */\r\n [WebXRFeatureName.LAYERS]: IWebXRLayersOptions;\r\n /** Light estimation feature options. */\r\n [WebXRFeatureName.LIGHT_ESTIMATION]: IWebXRLightEstimationOptions;\r\n /** Mesh detection feature options. */\r\n [WebXRFeatureName.MESH_DETECTION]: IWebXRMeshDetectorOptions;\r\n /** Controller movement feature options. */\r\n [WebXRFeatureName.MOVEMENT]: IWebXRControllerMovementOptions;\r\n /** Near interaction feature options. */\r\n [WebXRFeatureName.NEAR_INTERACTION]: IWebXRNearInteractionOptions;\r\n /** Physics controllers feature options. */\r\n [WebXRFeatureName.PHYSICS_CONTROLLERS]: IWebXRControllerPhysicsOptions;\r\n /** Plane detection feature options. */\r\n [WebXRFeatureName.PLANE_DETECTION]: IWebXRPlaneDetectorOptions;\r\n /** Controller pointer selection feature options. */\r\n [WebXRFeatureName.POINTER_SELECTION]: IWebXRControllerPointerSelectionOptions;\r\n /** Raw camera access feature options. */\r\n [WebXRFeatureName.RAW_CAMERA_ACCESS]: IWebXRRawCameraAccessOptions;\r\n /** Space warp feature options. */\r\n [WebXRFeatureName.SPACE_WARP]: undefined;\r\n /** Teleportation feature options. */\r\n [WebXRFeatureName.TELEPORTATION]: IWebXRTeleportationOptions;\r\n /** Walking locomotion feature options. */\r\n [WebXRFeatureName.WALKING_LOCOMOTION]: IWebXRWalkingLocomotionOptions;\r\n /** Body tracking feature options. */\r\n [WebXRFeatureName.BODY_TRACKING]: IWebXRBodyTrackingOptions;\r\n}\r\n\r\n/**\r\n * Helper type that expands/flattens a type to show its properties inline in IntelliSense\r\n */\r\ntype Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;\r\n\r\n/**\r\n * Helper type to resolve the specific feature type based on the feature name,\r\n * or fallback to IWebXRFeature if the feature name is not in the type map.\r\n */\r\nexport type ResolveWebXRFeature<T extends WebXRFeatureNameType> = T extends keyof IWebXRFeatureNameTypeMap ? IWebXRFeatureNameTypeMap[T] : IWebXRFeature;\r\n\r\n/**\r\n * Helper type to resolve the options type for a specific feature based on the feature name,\r\n * or fallback to any if the feature name is not in the type map.\r\n * The Expand utility type flattens the interface to show properties inline in IntelliSense.\r\n */\r\nexport type ResolveWebXRFeatureOptions<T extends WebXRFeatureNameType> = T extends keyof IWebXRFeatureNameOptionsMap\r\n ? IWebXRFeatureNameOptionsMap[T] extends undefined\r\n ? undefined\r\n : Expand<IWebXRFeatureNameOptionsMap[T]>\r\n : any;\r\n\r\n/**\r\n * Defining the constructor of a feature. Used to register the modules.\r\n */\r\nexport type WebXRFeatureConstructor = (xrSessionManager: WebXRSessionManager, options?: any) => () => IWebXRFeature;\r\n\r\n/**\r\n * The WebXR features manager is responsible of enabling or disabling features required for the current XR session.\r\n * It is mainly used in AR sessions.\r\n *\r\n * A feature can have a version that is defined by Babylon (and does not correspond with the webxr version).\r\n */\r\nexport class WebXRFeaturesManager implements IDisposable {\r\n private static readonly _AvailableFeatures: {\r\n [name: string]: {\r\n stable: number;\r\n latest: number;\r\n [version: number]: WebXRFeatureConstructor;\r\n };\r\n } = {};\r\n\r\n private _features: {\r\n [name: string]: {\r\n featureImplementation: IWebXRFeature;\r\n version: number;\r\n enabled: boolean;\r\n required: boolean;\r\n };\r\n } = {};\r\n\r\n /**\r\n * The key is the feature to check and the value is the feature that conflicts.\r\n */\r\n private static readonly _ConflictingFeatures: { [key: string]: string } = {\r\n [WebXRFeatureName.TELEPORTATION]: WebXRFeatureName.MOVEMENT,\r\n [WebXRFeatureName.MOVEMENT]: WebXRFeatureName.TELEPORTATION,\r\n };\r\n\r\n /**\r\n * constructs a new features manages.\r\n *\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n */\r\n constructor(private _xrSessionManager: WebXRSessionManager) {\r\n // when session starts / initialized - attach\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n const feature = this._features[featureName];\r\n if (feature.enabled && !feature.featureImplementation.attached && !feature.featureImplementation.disableAutoAttach) {\r\n this.attachFeature(featureName);\r\n }\r\n }\r\n });\r\n\r\n // when session ends - detach\r\n this._xrSessionManager.onXRSessionEnded.add(() => {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n const feature = this._features[featureName];\r\n if (feature.enabled && feature.featureImplementation.attached) {\r\n // detach, but don't disable!\r\n this.detachFeature(featureName);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Used to register a module. After calling this function a developer can use this feature in the scene.\r\n * Mainly used internally.\r\n *\r\n * @param featureName the name of the feature to register\r\n * @param constructorFunction the function used to construct the module\r\n * @param version the (babylon) version of the module\r\n * @param stable is that a stable version of this module\r\n */\r\n public static AddWebXRFeature(featureName: string, constructorFunction: WebXRFeatureConstructor, version: number = 1, stable: boolean = false) {\r\n this._AvailableFeatures[featureName] = this._AvailableFeatures[featureName] || { latest: version };\r\n if (version > this._AvailableFeatures[featureName].latest) {\r\n this._AvailableFeatures[featureName].latest = version;\r\n }\r\n if (stable) {\r\n this._AvailableFeatures[featureName].stable = version;\r\n }\r\n this._AvailableFeatures[featureName][version] = constructorFunction;\r\n }\r\n\r\n /**\r\n * Returns a constructor of a specific feature.\r\n *\r\n * @param featureName the name of the feature to construct\r\n * @param version the version of the feature to load\r\n * @param xrSessionManager the xrSessionManager. Used to construct the module\r\n * @param options optional options provided to the module.\r\n * @returns a function that, when called, will return a new instance of this feature\r\n */\r\n public static ConstructFeature(featureName: string, version: number = 1, xrSessionManager: WebXRSessionManager, options?: any): () => IWebXRFeature {\r\n const constructorFunction = this._AvailableFeatures[featureName][version];\r\n if (!constructorFunction) {\r\n // throw an error? return nothing?\r\n throw new Error(\"feature not found\");\r\n }\r\n\r\n return constructorFunction(xrSessionManager, options);\r\n }\r\n\r\n /**\r\n * Can be used to return the list of features currently registered\r\n *\r\n * @returns an Array of available features\r\n */\r\n public static GetAvailableFeatures() {\r\n return Object.keys(this._AvailableFeatures);\r\n }\r\n\r\n /**\r\n * Gets the versions available for a specific feature\r\n * @param featureName the name of the feature\r\n * @returns an array with the available versions\r\n */\r\n public static GetAvailableVersions(featureName: string) {\r\n return Object.keys(this._AvailableFeatures[featureName]);\r\n }\r\n\r\n /**\r\n * Return the latest unstable version of this feature\r\n * @param featureName the name of the feature to search\r\n * @returns the version number. if not found will return -1\r\n */\r\n public static GetLatestVersionOfFeature(featureName: string): number {\r\n return (this._AvailableFeatures[featureName] && this._AvailableFeatures[featureName].latest) || -1;\r\n }\r\n\r\n /**\r\n * Return the latest stable version of this feature\r\n * @param featureName the name of the feature to search\r\n * @returns the version number. if not found will return -1\r\n */\r\n public static GetStableVersionOfFeature(featureName: string): number {\r\n return (this._AvailableFeatures[featureName] && this._AvailableFeatures[featureName].stable) || -1;\r\n }\r\n\r\n /**\r\n * Attach a feature to the current session. Mainly used when session started to start the feature effect.\r\n * Can be used during a session to start a feature\r\n * @param featureName the name of feature to attach\r\n */\r\n public attachFeature(featureName: string) {\r\n const feature = this._features[featureName];\r\n if (feature && feature.enabled && !feature.featureImplementation.attached) {\r\n const disableAutoAttachBeforeAttach = feature.featureImplementation.disableAutoAttach;\r\n feature.featureImplementation._autoAttachPolicyBeforeAttach = disableAutoAttachBeforeAttach;\r\n feature.featureImplementation.disableAutoAttach = false;\r\n let attached: boolean;\r\n try {\r\n attached = feature.featureImplementation.attach();\r\n } finally {\r\n delete feature.featureImplementation._autoAttachPolicyBeforeAttach;\r\n }\r\n const intentionallyDisabledDuringAttach = feature.featureImplementation.disableAutoAttach;\r\n if (!intentionallyDisabledDuringAttach) {\r\n feature.featureImplementation.disableAutoAttach = disableAutoAttachBeforeAttach;\r\n }\r\n if (!attached && !intentionallyDisabledDuringAttach) {\r\n Tools.Warn(`Feature ${featureName} failed to attach`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Can be used inside a session or when the session ends to detach a specific feature\r\n * @param featureName the name of the feature to detach\r\n */\r\n public detachFeature(featureName: string) {\r\n const feature = this._features[featureName];\r\n if (feature && feature.featureImplementation.attached) {\r\n const detached = feature.featureImplementation.detach();\r\n if (!detached) {\r\n Tools.Warn(`Feature ${featureName} failed to detach`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Used to disable an already-enabled feature\r\n * The feature will be disposed and will be recreated once enabled.\r\n * @param featureName the feature to disable\r\n * @returns true if disable was successful\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public disableFeature(featureName: string | { Name: string }): boolean {\r\n const name = typeof featureName === \"string\" ? featureName : featureName.Name;\r\n const feature = this._features[name];\r\n if (feature && feature.enabled) {\r\n feature.enabled = false;\r\n this.detachFeature(name);\r\n feature.featureImplementation.dispose();\r\n delete this._features[name];\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * dispose this features manager\r\n */\r\n public dispose(): void {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n this.disableFeature(featureName);\r\n }\r\n }\r\n\r\n /**\r\n * Enable a feature using its name and a version. This will enable it in the scene, and will be responsible to attach it when the session starts.\r\n * If used twice, the old version will be disposed and a new one will be constructed. This way you can re-enable with different configuration.\r\n *\r\n * @param featureName the name of the feature to load or the class of the feature\r\n * @param version optional version to load. if not provided the latest version will be enabled\r\n * @param moduleOptions options provided to the module. Ses the module documentation / constructor\r\n * @param attachIfPossible if set to true (default) the feature will be automatically attached, if it is currently possible\r\n * @param required is this feature required to the app. If set to true the session init will fail if the feature is not available.\r\n * @returns a new constructed feature or throws an error if feature not found or conflicts with another enabled feature.\r\n */\r\n public enableFeature<T extends WebXRFeatureNameType>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n featureName: T | { Name: T },\r\n version: number | string = \"latest\",\r\n moduleOptions: ResolveWebXRFeatureOptions<T> = {} as ResolveWebXRFeatureOptions<T>,\r\n attachIfPossible: boolean = true,\r\n required: boolean = true\r\n ): ResolveWebXRFeature<T> {\r\n const name = typeof featureName === \"string\" ? featureName : featureName.Name;\r\n let versionToLoad: number;\r\n if (typeof version === \"string\") {\r\n if (!version) {\r\n throw new Error(`Error in provided version - ${name} (${version})`);\r\n }\r\n if (version === \"stable\") {\r\n versionToLoad = WebXRFeaturesManager.GetStableVersionOfFeature(name);\r\n } else if (version === \"latest\") {\r\n versionToLoad = WebXRFeaturesManager.GetLatestVersionOfFeature(name);\r\n } else {\r\n // try loading the number the string represents\r\n versionToLoad = +version;\r\n }\r\n if (versionToLoad === -1 || isNaN(versionToLoad)) {\r\n throw new Error(`feature not found - ${name} (${version})`);\r\n }\r\n } else {\r\n versionToLoad = version;\r\n }\r\n\r\n // check if there is a feature conflict\r\n const conflictingFeature = WebXRFeaturesManager._ConflictingFeatures[name];\r\n if (conflictingFeature !== undefined && this.getEnabledFeatures().indexOf(conflictingFeature) !== -1) {\r\n throw new Error(`Feature ${name} cannot be enabled while ${conflictingFeature} is enabled.`);\r\n }\r\n\r\n // check if already initialized\r\n const feature = this._features[name];\r\n const constructFunction = WebXRFeaturesManager.ConstructFeature(name, versionToLoad, this._xrSessionManager, moduleOptions);\r\n if (!constructFunction) {\r\n // report error?\r\n throw new Error(`feature not found - ${name}`);\r\n }\r\n\r\n /* If the feature is already enabled, detach and dispose it, and create a new one */\r\n if (feature) {\r\n this.disableFeature(name);\r\n }\r\n\r\n const constructed = constructFunction();\r\n if (constructed.dependsOn) {\r\n const dependentsFound = constructed.dependsOn.every((featureName) => !!this._features[featureName]);\r\n if (!dependentsFound) {\r\n throw new Error(`Dependant features missing. Make sure the following features are enabled - ${constructed.dependsOn.join(\", \")}`);\r\n }\r\n }\r\n _ConsumeWebXRFeatureSpecificDisableWarning(constructed);\r\n const isCompatible = constructed.isCompatible();\r\n const emittedSpecificDisableWarning = _ConsumeWebXRFeatureSpecificDisableWarning(constructed);\r\n if (isCompatible) {\r\n this._features[name] = {\r\n featureImplementation: constructed,\r\n enabled: true,\r\n version: versionToLoad,\r\n required,\r\n };\r\n\r\n if (attachIfPossible) {\r\n // if session started already, request and enable\r\n if (this._xrSessionManager.session && !this._features[name].featureImplementation.attached) {\r\n // enable feature\r\n this.attachFeature(name);\r\n }\r\n } else {\r\n // disable auto-attach when session starts\r\n this._features[name].featureImplementation.disableAutoAttach = true;\r\n }\r\n\r\n return this._features[name].featureImplementation as ResolveWebXRFeature<T>;\r\n } else {\r\n if (required) {\r\n throw new Error(\"required feature not compatible\");\r\n } else {\r\n if (!emittedSpecificDisableWarning) {\r\n Tools.Warn(`Feature ${name} not compatible with the current environment/browser and was not enabled.`);\r\n }\r\n return constructed as ResolveWebXRFeature<T>;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * get the implementation of an enabled feature.\r\n * @param featureName the name of the feature to load\r\n * @returns the feature class, if found\r\n */\r\n public getEnabledFeature<T extends WebXRFeatureNameType>(featureName: T): ResolveWebXRFeature<T> {\r\n return this._features[featureName] && (this._features[featureName].featureImplementation as ResolveWebXRFeature<T>);\r\n }\r\n\r\n /**\r\n * Get the list of enabled features\r\n * @returns an array of enabled features\r\n */\r\n public getEnabledFeatures() {\r\n return Object.keys(this._features);\r\n }\r\n\r\n /**\r\n * This function will extend the session creation configuration object with enabled features.\r\n * If, for example, the anchors feature is enabled, it will be automatically added to the optional or required features list,\r\n * according to the defined \"required\" variable, provided during enableFeature call\r\n * @param xrSessionInit the xr Session init object to extend\r\n *\r\n * @returns an extended XRSessionInit object\r\n */\r\n public async _extendXRSessionInitObject(xrSessionInit: XRSessionInit): Promise<XRSessionInit> {\r\n const enabledFeatures = this.getEnabledFeatures();\r\n for (const featureName of enabledFeatures) {\r\n const feature = this._features[featureName];\r\n const nativeName = feature.featureImplementation.xrNativeFeatureName;\r\n if (nativeName) {\r\n if (feature.required) {\r\n xrSessionInit.requiredFeatures = xrSessionInit.requiredFeatures || [];\r\n if (xrSessionInit.requiredFeatures.indexOf(nativeName) === -1) {\r\n xrSessionInit.requiredFeatures.push(nativeName);\r\n }\r\n } else {\r\n xrSessionInit.optionalFeatures = xrSessionInit.optionalFeatures || [];\r\n if (xrSessionInit.optionalFeatures.indexOf(nativeName) === -1) {\r\n xrSessionInit.optionalFeatures.push(nativeName);\r\n }\r\n }\r\n }\r\n if (feature.featureImplementation.getXRSessionInitExtension) {\r\n // eslint-disable-next-line no-await-in-loop\r\n const extended = await feature.featureImplementation.getXRSessionInitExtension();\r\n xrSessionInit = {\r\n ...xrSessionInit,\r\n ...extended,\r\n };\r\n }\r\n }\r\n return xrSessionInit;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRFeaturesManager.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRFeaturesManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAyB3C,OAAO,EAAE,0CAA0C,EAAE,MAAM,+BAA+B,CAAC;AA2E3F;;GAEG;AACH,MAAM,OAAO,gBAAgB;;AACzB;;GAEG;AACoB,8BAAa,GAAG,kBAA2B,CAAC;AACnE;;GAEG;AACoB,mCAAkB,GAAG,uBAAgC,CAAC;AAC7E;;GAEG;AACoB,yBAAQ,GAAG,aAAsB,CAAC;AACzD;;GAEG;AACoB,+BAAc,GAAG,mBAA4B,CAAC;AACrE;;GAEG;AACoB,oCAAmB,GAAG,uBAAgC,CAAC;AAC9E;;GAEG;AACoB,gCAAe,GAAG,oBAA6B,CAAC;AACvE;;GAEG;AACoB,kCAAiB,GAAG,iCAA0C,CAAC;AACtF;;GAEG;AACoB,8BAAa,GAAG,6BAAsC,CAAC;AAC9E;;GAEG;AACoB,+BAAc,GAAG,mBAA4B,CAAC;AACrE;;GAEG;AACoB,8BAAa,GAAG,kBAA2B,CAAC;AACnE;;GAEG;AACoB,+BAAc,GAAG,mBAA4B,CAAC;AACrE;;GAEG;AACoB,iCAAgB,GAAG,qBAA8B,CAAC;AACzE;;GAEG;AACoB,4BAAW,GAAG,gBAAyB,CAAC;AAC/D;;GAEG;AACoB,yBAAQ,GAAG,wBAAiC,CAAC;AACpE;;GAEG;AACoB,iCAAgB,GAAG,qBAA8B,CAAC;AACzE;;GAEG;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Aa,GAAG;oBACZ,GAAG,aAAa;oBAChB,GAAG,QAAQ;iBACd,CAAC;YACN,CAAC;QACL,CAAC;QACD,OAAO,aAAa,CAAC;IACzB,CAAC;;AAnWuB,uCAAkB,GAMtC,EAAE,AANoC,CAMnC;AAWP;;GAEG;AACqB,yCAAoB,GAA8B;IACtE,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAC,QAAQ;IAC3D,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC,aAAa;CAC9D,AAH2C,CAG1C","sourcesContent":["import { type Observable } from \"core/Misc/observable\";\r\nimport { Tools } from \"../Misc/tools.pure\";\r\nimport { type IDisposable } from \"../scene\";\r\nimport { type IWebXRAnchorSystemOptions, type WebXRAnchorSystem } from \"./features/WebXRAnchorSystem\";\r\nimport { type IWebXRBackgroundRemoverOptions, type WebXRBackgroundRemover } from \"./features/WebXRBackgroundRemover\";\r\nimport { type IWebXRBodyTrackingOptions, type WebXRBodyTracking } from \"./features/WebXRBodyTracking\";\r\nimport { type IWebXRControllerMovementOptions, type WebXRControllerMovement } from \"./features/WebXRControllerMovement\";\r\nimport { type IWebXRControllerPhysicsOptions, type WebXRControllerPhysics } from \"./features/WebXRControllerPhysics\";\r\nimport { type IWebXRControllerPointerSelectionOptions, type WebXRControllerPointerSelection } from \"./features/WebXRControllerPointerSelection\";\r\nimport { type IWebXRTeleportationOptions, type WebXRMotionControllerTeleportation } from \"./features/WebXRControllerTeleportation\";\r\nimport { type IWebXRDepthSensingOptions, type WebXRDepthSensing } from \"./features/WebXRDepthSensing\";\r\nimport { type IWebXRDomOverlayOptions, type WebXRDomOverlay } from \"./features/WebXRDOMOverlay\";\r\nimport { type WebXREyeTracking } from \"./features/WebXREyeTracking\";\r\nimport { type WebXRFeaturePointSystem } from \"./features/WebXRFeaturePointSystem\";\r\nimport { type IWebXRHandTrackingOptions, type WebXRHandTracking } from \"./features/WebXRHandTracking\";\r\nimport { type IWebXRHitTestOptions, type WebXRHitTest } from \"./features/WebXRHitTest\";\r\nimport { type IWebXRImageTrackingOptions, type WebXRImageTracking } from \"./features/WebXRImageTracking\";\r\nimport { type IWebXRLayersOptions, type WebXRLayers } from \"./features/WebXRLayers\";\r\nimport { type IWebXRLightEstimationOptions, type WebXRLightEstimation } from \"./features/WebXRLightEstimation\";\r\nimport { type IWebXRMeshDetectorOptions, type WebXRMeshDetector } from \"./features/WebXRMeshDetector\";\r\nimport { type IWebXRNearInteractionOptions, type WebXRNearInteraction } from \"./features/WebXRNearInteraction\";\r\nimport { type IWebXRPlaneDetectorOptions, type WebXRPlaneDetector } from \"./features/WebXRPlaneDetector\";\r\nimport { type IWebXRRawCameraAccessOptions, type WebXRRawCameraAccess } from \"./features/WebXRRawCameraAccess\";\r\nimport { type WebXRSpaceWarp } from \"./features/WebXRSpaceWarp\";\r\nimport { type WebXRTrackedSources } from \"./features/WebXRTrackedSources\";\r\nimport { type IWebXRWalkingLocomotionOptions, type WebXRWalkingLocomotion } from \"./features/WebXRWalkingLocomotion\";\r\nimport { _ConsumeWebXRFeatureSpecificDisableWarning } from \"./webXRFeatureWarningRegistry\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\n\r\n/**\r\n * Defining the interface required for a (webxr) feature\r\n */\r\nexport interface IWebXRFeature extends IDisposable {\r\n /**\r\n * Is this feature attached\r\n */\r\n attached: boolean;\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n disableAutoAttach: boolean;\r\n /**\r\n * The auto-attach policy in effect before the features manager starts a manual attachment.\r\n * @internal\r\n */\r\n _autoAttachPolicyBeforeAttach?: boolean;\r\n\r\n /**\r\n * Attach the feature to the session\r\n * Will usually be called by the features manager\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful.\r\n */\r\n attach(force?: boolean): boolean;\r\n /**\r\n * Detach the feature from the session\r\n * Will usually be called by the features manager\r\n *\r\n * @returns true if successful.\r\n */\r\n detach(): boolean;\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 isCompatible(): boolean;\r\n\r\n /**\r\n * Was this feature disposed;\r\n */\r\n isDisposed: boolean;\r\n\r\n /**\r\n * The name of the native xr feature name, if applicable (like anchor, hit-test, or hand-tracking)\r\n */\r\n xrNativeFeatureName?: string;\r\n\r\n /**\r\n * A list of (Babylon WebXR) features this feature depends on\r\n */\r\n dependsOn?: string[];\r\n\r\n /**\r\n * If this feature requires to extend the XRSessionInit object, this function will return the partial XR session init object\r\n */\r\n getXRSessionInitExtension?: () => Promise<Partial<XRSessionInit>>;\r\n\r\n /**\r\n * Triggered when the feature is attached\r\n */\r\n onFeatureAttachObservable: Observable<IWebXRFeature>;\r\n /**\r\n * Triggered when the feature is detached\r\n */\r\n onFeatureDetachObservable: Observable<IWebXRFeature>;\r\n}\r\n\r\n/**\r\n * A list of the currently available features without referencing them\r\n */\r\nexport class WebXRFeatureName {\r\n /**\r\n * The name of the anchor system feature\r\n */\r\n public static readonly ANCHOR_SYSTEM = \"xr-anchor-system\" as const;\r\n /**\r\n * The name of the background remover feature\r\n */\r\n public static readonly BACKGROUND_REMOVER = \"xr-background-remover\" as const;\r\n /**\r\n * The name of the hit test feature\r\n */\r\n public static readonly HIT_TEST = \"xr-hit-test\" as const;\r\n /**\r\n * The name of the mesh detection feature\r\n */\r\n public static readonly MESH_DETECTION = \"xr-mesh-detection\" as const;\r\n /**\r\n * physics impostors for xr controllers feature\r\n */\r\n public static readonly PHYSICS_CONTROLLERS = \"xr-physics-controller\" as const;\r\n /**\r\n * The name of the plane detection feature\r\n */\r\n public static readonly PLANE_DETECTION = \"xr-plane-detection\" as const;\r\n /**\r\n * The name of the pointer selection feature\r\n */\r\n public static readonly POINTER_SELECTION = \"xr-controller-pointer-selection\" as const;\r\n /**\r\n * The name of the teleportation feature\r\n */\r\n public static readonly TELEPORTATION = \"xr-controller-teleportation\" as const;\r\n /**\r\n * The name of the feature points feature.\r\n */\r\n public static readonly FEATURE_POINTS = \"xr-feature-points\" as const;\r\n /**\r\n * The name of the hand tracking feature.\r\n */\r\n public static readonly HAND_TRACKING = \"xr-hand-tracking\" as const;\r\n /**\r\n * The name of the image tracking feature\r\n */\r\n public static readonly IMAGE_TRACKING = \"xr-image-tracking\" as const;\r\n /**\r\n * The name of the near interaction feature\r\n */\r\n public static readonly NEAR_INTERACTION = \"xr-near-interaction\" as const;\r\n /**\r\n * The name of the DOM overlay feature\r\n */\r\n public static readonly DOM_OVERLAY = \"xr-dom-overlay\" as const;\r\n /**\r\n * The name of the movement feature\r\n */\r\n public static readonly MOVEMENT = \"xr-controller-movement\" as const;\r\n /**\r\n * The name of the light estimation feature\r\n */\r\n public static readonly LIGHT_ESTIMATION = \"xr-light-estimation\" as const;\r\n /**\r\n * The name of the eye tracking feature\r\n */\r\n public static readonly EYE_TRACKING = \"xr-eye-tracking\" as const;\r\n /**\r\n * The name of the walking locomotion feature\r\n */\r\n public static readonly WALKING_LOCOMOTION = \"xr-walking-locomotion\" as const;\r\n /**\r\n * The name of the composition layers feature\r\n */\r\n public static readonly LAYERS = \"xr-layers\" as const;\r\n /**\r\n * The name of the depth sensing feature\r\n */\r\n public static readonly DEPTH_SENSING = \"xr-depth-sensing\" as const;\r\n /**\r\n * The name of the WebXR Space Warp feature\r\n */\r\n public static readonly SPACE_WARP = \"xr-space-warp\" as const;\r\n /**\r\n * The name of the WebXR Raw Camera Access feature\r\n */\r\n public static readonly RAW_CAMERA_ACCESS = \"xr-raw-camera-access\" as const;\r\n /**\r\n * The name of the body tracking feature\r\n */\r\n public static readonly BODY_TRACKING = \"xr-body-tracking\" as const;\r\n /**\r\n * The name of the tracked sources feature\r\n */\r\n public static readonly TRACKED_SOURCES = \"xr-tracked-sources\" as const;\r\n}\r\n\r\nexport type WebXRFeatureNameType = (typeof WebXRFeatureName)[Exclude<keyof typeof WebXRFeatureName, \"prototype\">];\r\n\r\n/**\r\n * Maps feature names to their corresponding feature implementation classes.\r\n */\r\nexport interface IWebXRFeatureNameTypeMap {\r\n /** Anchor system feature implementation. */\r\n [WebXRFeatureName.ANCHOR_SYSTEM]: WebXRAnchorSystem;\r\n /** Background remover feature implementation. */\r\n [WebXRFeatureName.BACKGROUND_REMOVER]: WebXRBackgroundRemover;\r\n /** Depth sensing feature implementation. */\r\n [WebXRFeatureName.DEPTH_SENSING]: WebXRDepthSensing;\r\n /** DOM overlay feature implementation. */\r\n [WebXRFeatureName.DOM_OVERLAY]: WebXRDomOverlay;\r\n /** Eye tracking feature implementation. */\r\n [WebXRFeatureName.EYE_TRACKING]: WebXREyeTracking;\r\n /** Feature points feature implementation. */\r\n [WebXRFeatureName.FEATURE_POINTS]: WebXRFeaturePointSystem;\r\n /** Hand tracking feature implementation. */\r\n [WebXRFeatureName.HAND_TRACKING]: WebXRHandTracking;\r\n /** Hit test feature implementation. */\r\n [WebXRFeatureName.HIT_TEST]: WebXRHitTest;\r\n /** Image tracking feature implementation. */\r\n [WebXRFeatureName.IMAGE_TRACKING]: WebXRImageTracking;\r\n /** Layers feature implementation. */\r\n [WebXRFeatureName.LAYERS]: WebXRLayers;\r\n /** Light estimation feature implementation. */\r\n [WebXRFeatureName.LIGHT_ESTIMATION]: WebXRLightEstimation;\r\n /** Mesh detection feature implementation. */\r\n [WebXRFeatureName.MESH_DETECTION]: WebXRMeshDetector;\r\n /** Controller movement feature implementation. */\r\n [WebXRFeatureName.MOVEMENT]: WebXRControllerMovement;\r\n /** Near interaction feature implementation. */\r\n [WebXRFeatureName.NEAR_INTERACTION]: WebXRNearInteraction;\r\n /** Physics controllers feature implementation. */\r\n [WebXRFeatureName.PHYSICS_CONTROLLERS]: WebXRControllerPhysics;\r\n /** Plane detection feature implementation. */\r\n [WebXRFeatureName.PLANE_DETECTION]: WebXRPlaneDetector;\r\n /** Controller pointer selection feature implementation. */\r\n [WebXRFeatureName.POINTER_SELECTION]: WebXRControllerPointerSelection;\r\n /** Raw camera access feature implementation. */\r\n [WebXRFeatureName.RAW_CAMERA_ACCESS]: WebXRRawCameraAccess;\r\n /** Space warp feature implementation. */\r\n [WebXRFeatureName.SPACE_WARP]: WebXRSpaceWarp;\r\n /** Teleportation feature implementation. */\r\n [WebXRFeatureName.TELEPORTATION]: WebXRMotionControllerTeleportation;\r\n /** Walking locomotion feature implementation. */\r\n [WebXRFeatureName.WALKING_LOCOMOTION]: WebXRWalkingLocomotion;\r\n /** Body tracking feature implementation. */\r\n [WebXRFeatureName.BODY_TRACKING]: WebXRBodyTracking;\r\n /** Tracked sources feature implementation. */\r\n [WebXRFeatureName.TRACKED_SOURCES]: WebXRTrackedSources;\r\n}\r\n\r\n/**\r\n * Maps feature names to their corresponding options interfaces.\r\n */\r\nexport interface IWebXRFeatureNameOptionsMap {\r\n /** Anchor system feature options. */\r\n [WebXRFeatureName.ANCHOR_SYSTEM]: IWebXRAnchorSystemOptions;\r\n /** Background remover feature options. */\r\n [WebXRFeatureName.BACKGROUND_REMOVER]: IWebXRBackgroundRemoverOptions;\r\n /** Depth sensing feature options. */\r\n [WebXRFeatureName.DEPTH_SENSING]: IWebXRDepthSensingOptions;\r\n /** DOM overlay feature options. */\r\n [WebXRFeatureName.DOM_OVERLAY]: IWebXRDomOverlayOptions;\r\n /** Eye tracking feature options. */\r\n [WebXRFeatureName.EYE_TRACKING]: undefined;\r\n /** Feature points feature options. */\r\n [WebXRFeatureName.FEATURE_POINTS]: undefined;\r\n /** Hand tracking feature options. */\r\n [WebXRFeatureName.HAND_TRACKING]: IWebXRHandTrackingOptions;\r\n /** Hit test feature options. */\r\n [WebXRFeatureName.HIT_TEST]: IWebXRHitTestOptions;\r\n /** Image tracking feature options. */\r\n [WebXRFeatureName.IMAGE_TRACKING]: IWebXRImageTrackingOptions;\r\n /** Layers feature options. */\r\n [WebXRFeatureName.LAYERS]: IWebXRLayersOptions;\r\n /** Light estimation feature options. */\r\n [WebXRFeatureName.LIGHT_ESTIMATION]: IWebXRLightEstimationOptions;\r\n /** Mesh detection feature options. */\r\n [WebXRFeatureName.MESH_DETECTION]: IWebXRMeshDetectorOptions;\r\n /** Controller movement feature options. */\r\n [WebXRFeatureName.MOVEMENT]: IWebXRControllerMovementOptions;\r\n /** Near interaction feature options. */\r\n [WebXRFeatureName.NEAR_INTERACTION]: IWebXRNearInteractionOptions;\r\n /** Physics controllers feature options. */\r\n [WebXRFeatureName.PHYSICS_CONTROLLERS]: IWebXRControllerPhysicsOptions;\r\n /** Plane detection feature options. */\r\n [WebXRFeatureName.PLANE_DETECTION]: IWebXRPlaneDetectorOptions;\r\n /** Controller pointer selection feature options. */\r\n [WebXRFeatureName.POINTER_SELECTION]: IWebXRControllerPointerSelectionOptions;\r\n /** Raw camera access feature options. */\r\n [WebXRFeatureName.RAW_CAMERA_ACCESS]: IWebXRRawCameraAccessOptions;\r\n /** Space warp feature options. */\r\n [WebXRFeatureName.SPACE_WARP]: undefined;\r\n /** Teleportation feature options. */\r\n [WebXRFeatureName.TELEPORTATION]: IWebXRTeleportationOptions;\r\n /** Walking locomotion feature options. */\r\n [WebXRFeatureName.WALKING_LOCOMOTION]: IWebXRWalkingLocomotionOptions;\r\n /** Body tracking feature options. */\r\n [WebXRFeatureName.BODY_TRACKING]: IWebXRBodyTrackingOptions;\r\n /** Tracked sources feature options. */\r\n [WebXRFeatureName.TRACKED_SOURCES]: undefined;\r\n}\r\n\r\n/**\r\n * Helper type that expands/flattens a type to show its properties inline in IntelliSense\r\n */\r\ntype Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;\r\n\r\n/**\r\n * Helper type to resolve the specific feature type based on the feature name,\r\n * or fallback to IWebXRFeature if the feature name is not in the type map.\r\n */\r\nexport type ResolveWebXRFeature<T extends WebXRFeatureNameType> = T extends keyof IWebXRFeatureNameTypeMap ? IWebXRFeatureNameTypeMap[T] : IWebXRFeature;\r\n\r\n/**\r\n * Helper type to resolve the options type for a specific feature based on the feature name,\r\n * or fallback to any if the feature name is not in the type map.\r\n * The Expand utility type flattens the interface to show properties inline in IntelliSense.\r\n */\r\nexport type ResolveWebXRFeatureOptions<T extends WebXRFeatureNameType> = T extends keyof IWebXRFeatureNameOptionsMap\r\n ? IWebXRFeatureNameOptionsMap[T] extends undefined\r\n ? undefined\r\n : Expand<IWebXRFeatureNameOptionsMap[T]>\r\n : any;\r\n\r\n/**\r\n * Defining the constructor of a feature. Used to register the modules.\r\n */\r\nexport type WebXRFeatureConstructor = (xrSessionManager: WebXRSessionManager, options?: any) => () => IWebXRFeature;\r\n\r\n/**\r\n * The WebXR features manager is responsible of enabling or disabling features required for the current XR session.\r\n * It is mainly used in AR sessions.\r\n *\r\n * A feature can have a version that is defined by Babylon (and does not correspond with the webxr version).\r\n */\r\nexport class WebXRFeaturesManager implements IDisposable {\r\n private static readonly _AvailableFeatures: {\r\n [name: string]: {\r\n stable: number;\r\n latest: number;\r\n [version: number]: WebXRFeatureConstructor;\r\n };\r\n } = {};\r\n\r\n private _features: {\r\n [name: string]: {\r\n featureImplementation: IWebXRFeature;\r\n version: number;\r\n enabled: boolean;\r\n required: boolean;\r\n };\r\n } = {};\r\n\r\n /**\r\n * The key is the feature to check and the value is the feature that conflicts.\r\n */\r\n private static readonly _ConflictingFeatures: { [key: string]: string } = {\r\n [WebXRFeatureName.TELEPORTATION]: WebXRFeatureName.MOVEMENT,\r\n [WebXRFeatureName.MOVEMENT]: WebXRFeatureName.TELEPORTATION,\r\n };\r\n\r\n /**\r\n * constructs a new features manages.\r\n *\r\n * @param _xrSessionManager an instance of WebXRSessionManager\r\n */\r\n constructor(private _xrSessionManager: WebXRSessionManager) {\r\n // when session starts / initialized - attach\r\n this._xrSessionManager.onXRSessionInit.add(() => {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n const feature = this._features[featureName];\r\n if (feature.enabled && !feature.featureImplementation.attached && !feature.featureImplementation.disableAutoAttach) {\r\n this.attachFeature(featureName);\r\n }\r\n }\r\n });\r\n\r\n // when session ends - detach\r\n this._xrSessionManager.onXRSessionEnded.add(() => {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n const feature = this._features[featureName];\r\n if (feature.enabled && feature.featureImplementation.attached) {\r\n // detach, but don't disable!\r\n this.detachFeature(featureName);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Used to register a module. After calling this function a developer can use this feature in the scene.\r\n * Mainly used internally.\r\n *\r\n * @param featureName the name of the feature to register\r\n * @param constructorFunction the function used to construct the module\r\n * @param version the (babylon) version of the module\r\n * @param stable is that a stable version of this module\r\n */\r\n public static AddWebXRFeature(featureName: string, constructorFunction: WebXRFeatureConstructor, version: number = 1, stable: boolean = false) {\r\n this._AvailableFeatures[featureName] = this._AvailableFeatures[featureName] || { latest: version };\r\n if (version > this._AvailableFeatures[featureName].latest) {\r\n this._AvailableFeatures[featureName].latest = version;\r\n }\r\n if (stable) {\r\n this._AvailableFeatures[featureName].stable = version;\r\n }\r\n this._AvailableFeatures[featureName][version] = constructorFunction;\r\n }\r\n\r\n /**\r\n * Returns a constructor of a specific feature.\r\n *\r\n * @param featureName the name of the feature to construct\r\n * @param version the version of the feature to load\r\n * @param xrSessionManager the xrSessionManager. Used to construct the module\r\n * @param options optional options provided to the module.\r\n * @returns a function that, when called, will return a new instance of this feature\r\n */\r\n public static ConstructFeature(featureName: string, version: number = 1, xrSessionManager: WebXRSessionManager, options?: any): () => IWebXRFeature {\r\n const constructorFunction = this._AvailableFeatures[featureName][version];\r\n if (!constructorFunction) {\r\n // throw an error? return nothing?\r\n throw new Error(\"feature not found\");\r\n }\r\n\r\n return constructorFunction(xrSessionManager, options);\r\n }\r\n\r\n /**\r\n * Can be used to return the list of features currently registered\r\n *\r\n * @returns an Array of available features\r\n */\r\n public static GetAvailableFeatures() {\r\n return Object.keys(this._AvailableFeatures);\r\n }\r\n\r\n /**\r\n * Gets the versions available for a specific feature\r\n * @param featureName the name of the feature\r\n * @returns an array with the available versions\r\n */\r\n public static GetAvailableVersions(featureName: string) {\r\n return Object.keys(this._AvailableFeatures[featureName]);\r\n }\r\n\r\n /**\r\n * Return the latest unstable version of this feature\r\n * @param featureName the name of the feature to search\r\n * @returns the version number. if not found will return -1\r\n */\r\n public static GetLatestVersionOfFeature(featureName: string): number {\r\n return (this._AvailableFeatures[featureName] && this._AvailableFeatures[featureName].latest) || -1;\r\n }\r\n\r\n /**\r\n * Return the latest stable version of this feature\r\n * @param featureName the name of the feature to search\r\n * @returns the version number. if not found will return -1\r\n */\r\n public static GetStableVersionOfFeature(featureName: string): number {\r\n return (this._AvailableFeatures[featureName] && this._AvailableFeatures[featureName].stable) || -1;\r\n }\r\n\r\n /**\r\n * Attach a feature to the current session. Mainly used when session started to start the feature effect.\r\n * Can be used during a session to start a feature\r\n * @param featureName the name of feature to attach\r\n */\r\n public attachFeature(featureName: string) {\r\n const feature = this._features[featureName];\r\n if (feature && feature.enabled && !feature.featureImplementation.attached) {\r\n const disableAutoAttachBeforeAttach = feature.featureImplementation.disableAutoAttach;\r\n feature.featureImplementation._autoAttachPolicyBeforeAttach = disableAutoAttachBeforeAttach;\r\n feature.featureImplementation.disableAutoAttach = false;\r\n let attached: boolean;\r\n try {\r\n attached = feature.featureImplementation.attach();\r\n } finally {\r\n delete feature.featureImplementation._autoAttachPolicyBeforeAttach;\r\n }\r\n const intentionallyDisabledDuringAttach = feature.featureImplementation.disableAutoAttach;\r\n if (!intentionallyDisabledDuringAttach) {\r\n feature.featureImplementation.disableAutoAttach = disableAutoAttachBeforeAttach;\r\n }\r\n if (!attached && !intentionallyDisabledDuringAttach) {\r\n Tools.Warn(`Feature ${featureName} failed to attach`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Can be used inside a session or when the session ends to detach a specific feature\r\n * @param featureName the name of the feature to detach\r\n */\r\n public detachFeature(featureName: string) {\r\n const feature = this._features[featureName];\r\n if (feature && feature.featureImplementation.attached) {\r\n const detached = feature.featureImplementation.detach();\r\n if (!detached) {\r\n Tools.Warn(`Feature ${featureName} failed to detach`);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Used to disable an already-enabled feature\r\n * The feature will be disposed and will be recreated once enabled.\r\n * @param featureName the feature to disable\r\n * @returns true if disable was successful\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public disableFeature(featureName: string | { Name: string }): boolean {\r\n const name = typeof featureName === \"string\" ? featureName : featureName.Name;\r\n const feature = this._features[name];\r\n if (feature && feature.enabled) {\r\n feature.enabled = false;\r\n this.detachFeature(name);\r\n feature.featureImplementation.dispose();\r\n delete this._features[name];\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n /**\r\n * dispose this features manager\r\n */\r\n public dispose(): void {\r\n const features = this.getEnabledFeatures();\r\n for (const featureName of features) {\r\n this.disableFeature(featureName);\r\n }\r\n }\r\n\r\n /**\r\n * Enable a feature using its name and a version. This will enable it in the scene, and will be responsible to attach it when the session starts.\r\n * If used twice, the old version will be disposed and a new one will be constructed. This way you can re-enable with different configuration.\r\n *\r\n * @param featureName the name of the feature to load or the class of the feature\r\n * @param version optional version to load. if not provided the latest version will be enabled\r\n * @param moduleOptions options provided to the module. Ses the module documentation / constructor\r\n * @param attachIfPossible if set to true (default) the feature will be automatically attached, if it is currently possible\r\n * @param required is this feature required to the app. If set to true the session init will fail if the feature is not available.\r\n * @returns a new constructed feature or throws an error if feature not found or conflicts with another enabled feature.\r\n */\r\n public enableFeature<T extends WebXRFeatureNameType>(\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n featureName: T | { Name: T },\r\n version: number | string = \"latest\",\r\n moduleOptions: ResolveWebXRFeatureOptions<T> = {} as ResolveWebXRFeatureOptions<T>,\r\n attachIfPossible: boolean = true,\r\n required: boolean = true\r\n ): ResolveWebXRFeature<T> {\r\n const name = typeof featureName === \"string\" ? featureName : featureName.Name;\r\n let versionToLoad: number;\r\n if (typeof version === \"string\") {\r\n if (!version) {\r\n throw new Error(`Error in provided version - ${name} (${version})`);\r\n }\r\n if (version === \"stable\") {\r\n versionToLoad = WebXRFeaturesManager.GetStableVersionOfFeature(name);\r\n } else if (version === \"latest\") {\r\n versionToLoad = WebXRFeaturesManager.GetLatestVersionOfFeature(name);\r\n } else {\r\n // try loading the number the string represents\r\n versionToLoad = +version;\r\n }\r\n if (versionToLoad === -1 || isNaN(versionToLoad)) {\r\n throw new Error(`feature not found - ${name} (${version})`);\r\n }\r\n } else {\r\n versionToLoad = version;\r\n }\r\n\r\n // check if there is a feature conflict\r\n const conflictingFeature = WebXRFeaturesManager._ConflictingFeatures[name];\r\n if (conflictingFeature !== undefined && this.getEnabledFeatures().indexOf(conflictingFeature) !== -1) {\r\n throw new Error(`Feature ${name} cannot be enabled while ${conflictingFeature} is enabled.`);\r\n }\r\n\r\n // check if already initialized\r\n const feature = this._features[name];\r\n const constructFunction = WebXRFeaturesManager.ConstructFeature(name, versionToLoad, this._xrSessionManager, moduleOptions);\r\n if (!constructFunction) {\r\n // report error?\r\n throw new Error(`feature not found - ${name}`);\r\n }\r\n\r\n /* If the feature is already enabled, detach and dispose it, and create a new one */\r\n if (feature) {\r\n this.disableFeature(name);\r\n }\r\n\r\n const constructed = constructFunction();\r\n if (constructed.dependsOn) {\r\n const dependentsFound = constructed.dependsOn.every((featureName) => !!this._features[featureName]);\r\n if (!dependentsFound) {\r\n throw new Error(`Dependant features missing. Make sure the following features are enabled - ${constructed.dependsOn.join(\", \")}`);\r\n }\r\n }\r\n _ConsumeWebXRFeatureSpecificDisableWarning(constructed);\r\n const isCompatible = constructed.isCompatible();\r\n const emittedSpecificDisableWarning = _ConsumeWebXRFeatureSpecificDisableWarning(constructed);\r\n if (isCompatible) {\r\n this._features[name] = {\r\n featureImplementation: constructed,\r\n enabled: true,\r\n version: versionToLoad,\r\n required,\r\n };\r\n\r\n if (attachIfPossible) {\r\n // if session started already, request and enable\r\n if (this._xrSessionManager.session && !this._features[name].featureImplementation.attached) {\r\n // enable feature\r\n this.attachFeature(name);\r\n }\r\n } else {\r\n // disable auto-attach when session starts\r\n this._features[name].featureImplementation.disableAutoAttach = true;\r\n }\r\n\r\n return this._features[name].featureImplementation as ResolveWebXRFeature<T>;\r\n } else {\r\n if (required) {\r\n throw new Error(\"required feature not compatible\");\r\n } else {\r\n if (!emittedSpecificDisableWarning) {\r\n Tools.Warn(`Feature ${name} not compatible with the current environment/browser and was not enabled.`);\r\n }\r\n return constructed as ResolveWebXRFeature<T>;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * get the implementation of an enabled feature.\r\n * @param featureName the name of the feature to load\r\n * @returns the feature class, if found\r\n */\r\n public getEnabledFeature<T extends WebXRFeatureNameType>(featureName: T): ResolveWebXRFeature<T> {\r\n return this._features[featureName] && (this._features[featureName].featureImplementation as ResolveWebXRFeature<T>);\r\n }\r\n\r\n /**\r\n * Get the list of enabled features\r\n * @returns an array of enabled features\r\n */\r\n public getEnabledFeatures() {\r\n return Object.keys(this._features);\r\n }\r\n\r\n /**\r\n * This function will extend the session creation configuration object with enabled features.\r\n * If, for example, the anchors feature is enabled, it will be automatically added to the optional or required features list,\r\n * according to the defined \"required\" variable, provided during enableFeature call\r\n * @param xrSessionInit the xr Session init object to extend\r\n *\r\n * @returns an extended XRSessionInit object\r\n */\r\n public async _extendXRSessionInitObject(xrSessionInit: XRSessionInit): Promise<XRSessionInit> {\r\n const enabledFeatures = this.getEnabledFeatures();\r\n for (const featureName of enabledFeatures) {\r\n const feature = this._features[featureName];\r\n const nativeName = feature.featureImplementation.xrNativeFeatureName;\r\n if (nativeName) {\r\n if (feature.required) {\r\n xrSessionInit.requiredFeatures = xrSessionInit.requiredFeatures || [];\r\n if (xrSessionInit.requiredFeatures.indexOf(nativeName) === -1) {\r\n xrSessionInit.requiredFeatures.push(nativeName);\r\n }\r\n } else {\r\n xrSessionInit.optionalFeatures = xrSessionInit.optionalFeatures || [];\r\n if (xrSessionInit.optionalFeatures.indexOf(nativeName) === -1) {\r\n xrSessionInit.optionalFeatures.push(nativeName);\r\n }\r\n }\r\n }\r\n if (feature.featureImplementation.getXRSessionInitExtension) {\r\n // eslint-disable-next-line no-await-in-loop\r\n const extended = await feature.featureImplementation.getXRSessionInitExtension();\r\n xrSessionInit = {\r\n ...xrSessionInit,\r\n ...extended,\r\n };\r\n }\r\n }\r\n return xrSessionInit;\r\n }\r\n}\r\n"]}
@@ -1,4 +1,33 @@
1
1
  import { type AbstractEngine } from "../Engines/abstractEngine.js";
2
+ /**
3
+ * The error shown when the active WebGPU engine cannot start an XR session.
4
+ * @internal
5
+ */
6
+ export declare const WebGPUXRNotSupportedErrorMessage = "WebGPU XR is unavailable in this browser or device. This experimental path requires XRGPUBinding with projection-layer support. To fall back, create a WebGL engine before creating the scene; Babylon.js cannot switch an existing scene's rendering backend.";
7
+ /**
8
+ * The error shown when a WebGPU XR session request is rejected as unsupported.
9
+ * @internal
10
+ */
11
+ export declare const WebGPUXRSessionNotSupportedErrorMessage = "The WebGPU XR session request was rejected as unsupported. The session mode, WebGPU or Layers requirements, or another required feature may be unavailable. If WebGPU XR is unavailable, create a WebGL engine before creating the scene.";
12
+ /**
13
+ * The error shown when the active WebGPU engine was not created with XR compatibility enabled.
14
+ * @internal
15
+ */
16
+ export declare const WebGPUXREngineNotCompatibleErrorMessage = "WebGPU XR requires a WebGPUEngine created with { xrCompatible: true }. Select an XR-capable WebGPU engine or WebGL before creating scene resources.";
17
+ /**
18
+ * Checks whether the runtime exposes the XRGPUBinding projection path required by Babylon.js.
19
+ * This is an advisory shape check; session negotiation can still reject for the active device.
20
+ * @returns whether the required WebGPU-XR binding APIs are exposed
21
+ * @internal
22
+ */
23
+ export declare function IsWebGPUXRSupported(): boolean;
24
+ /**
25
+ * Checks whether an engine was initialized with the adapter option required for WebGPU XR.
26
+ * @param engine the engine to test
27
+ * @returns true for non-WebGPU engines or WebGPU engines created with xrCompatible enabled
28
+ * @internal
29
+ */
30
+ export declare function IsWebGPUXREngineCompatible(engine: AbstractEngine): boolean;
2
31
  /**
3
32
  * The kind of underlying native binding an {@link IWebXRGraphicsBinding} wraps.
4
33
  * @internal
@@ -1,3 +1,43 @@
1
+ /**
2
+ * The error shown when the active WebGPU engine cannot start an XR session.
3
+ * @internal
4
+ */
5
+ export const WebGPUXRNotSupportedErrorMessage = "WebGPU XR is unavailable in this browser or device. This experimental path requires XRGPUBinding with projection-layer support. To fall back, create a WebGL engine before creating the scene; Babylon.js cannot switch an existing scene's rendering backend.";
6
+ /**
7
+ * The error shown when a WebGPU XR session request is rejected as unsupported.
8
+ * @internal
9
+ */
10
+ export const WebGPUXRSessionNotSupportedErrorMessage = "The WebGPU XR session request was rejected as unsupported. The session mode, WebGPU or Layers requirements, or another required feature may be unavailable. If WebGPU XR is unavailable, create a WebGL engine before creating the scene.";
11
+ /**
12
+ * The error shown when the active WebGPU engine was not created with XR compatibility enabled.
13
+ * @internal
14
+ */
15
+ export const WebGPUXREngineNotCompatibleErrorMessage = "WebGPU XR requires a WebGPUEngine created with { xrCompatible: true }. Select an XR-capable WebGPU engine or WebGL before creating scene resources.";
16
+ /**
17
+ * Checks whether the runtime exposes the XRGPUBinding projection path required by Babylon.js.
18
+ * This is an advisory shape check; session negotiation can still reject for the active device.
19
+ * @returns whether the required WebGPU-XR binding APIs are exposed
20
+ * @internal
21
+ */
22
+ // eslint-disable-next-line @typescript-eslint/naming-convention
23
+ export function IsWebGPUXRSupported() {
24
+ return (typeof XRGPUBinding === "function" &&
25
+ typeof XRGPUBinding.prototype.createProjectionLayer === "function" &&
26
+ typeof XRGPUBinding.prototype.getViewSubImage === "function" &&
27
+ typeof XRGPUBinding.prototype.getPreferredColorFormat === "function" &&
28
+ typeof XRGPUSubImage === "function" &&
29
+ typeof XRGPUSubImage.prototype.getViewDescriptor === "function");
30
+ }
31
+ /**
32
+ * Checks whether an engine was initialized with the adapter option required for WebGPU XR.
33
+ * @param engine the engine to test
34
+ * @returns true for non-WebGPU engines or WebGPU engines created with xrCompatible enabled
35
+ * @internal
36
+ */
37
+ // eslint-disable-next-line @typescript-eslint/naming-convention
38
+ export function IsWebGPUXREngineCompatible(engine) {
39
+ return !engine.isWebGPU || engine._options?.xrCompatible === true;
40
+ }
1
41
  /**
2
42
  * The kind of underlying native binding an {@link IWebXRGraphicsBinding} wraps.
3
43
  * @internal
@@ -1 +1 @@
1
- {"version":3,"file":"webXRGraphicsBinding.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRGraphicsBinding.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,CAAN,IAAkB,wBAUjB;AAVD,WAAkB,wBAAwB;IACtC;;OAEG;IACH,yEAAK,CAAA;IAEL;;OAEG;IACH,2EAAM,CAAA;AACV,CAAC,EAViB,wBAAwB,KAAxB,wBAAwB,QAUzC;AAaD;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAWlC;;;;OAIG;IACH,YACI,OAAkB;IAClB;;OAEG;IACa,OAAuD;QAAvD,YAAO,GAAP,OAAO,CAAgD;QApB3E;;WAEG;QACa,gBAAW,0CAAkC;QAmBzD,IAAI,CAAC,OAAO,GAAG,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,OAAkB,EAAE,MAAsB;QACrE,MAAM,EAAE,GAAI,MAAqB,CAAC,GAAG,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,IAAI,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IAWnC;;;;OAIG;IACH,YAAY,OAAkB,EAAE,MAAiB;QAfjD;;WAEG;QACa,gBAAW,2CAAmC;QAa1D,IAAI,CAAC,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,OAAkB,EAAE,MAAsB;QACrE,MAAM,MAAM,GAAI,MAAuB,CAAC,OAAO,CAAC;QAChD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"../Engines/abstractEngine\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { type WebGPUEngine } from \"../Engines/webgpuEngine\";\n\n/**\n * The kind of underlying native binding an {@link IWebXRGraphicsBinding} wraps.\n * @internal\n */\nexport const enum WebXRGraphicsBindingType {\n /**\n * Backed by an XRWebGLBinding (WebGL / WebGL2).\n */\n WebGL,\n\n /**\n * Backed by an XRGPUBinding (WebGPU).\n */\n WebGPU,\n}\n\n/**\n * Abstraction over the native WebXR graphics binding used to interact with the XR compositor.\n * @internal\n */\nexport interface IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n readonly bindingType: WebXRGraphicsBindingType;\n}\n\n/**\n * WebGL implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRWebGLBinding`.\n * @internal\n */\nexport class WebXRWebGLGraphicsBinding implements IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n public readonly bindingType = WebXRGraphicsBindingType.WebGL;\n\n /**\n * The wrapped native `XRWebGLBinding`.\n */\n public readonly binding: XRWebGLBinding;\n\n /**\n * Creates a new WebGL graphics binding.\n * @param session the XR session the binding is created for\n * @param context the WebGL rendering context to bind to\n */\n constructor(\n session: XRSession,\n /**\n * The WebGL rendering context used by the native binding.\n */\n public readonly context: WebGLRenderingContext | WebGL2RenderingContext\n ) {\n this.binding = new XRWebGLBinding(session, context);\n }\n\n /**\n * Creates a new WebGL graphics binding from an engine, extracting its WebGL context.\n * The WebGL-specific context access is localized here so callers can stay graphics-API-agnostic.\n * @param session the XR session the binding is created for\n * @param engine the engine whose WebGL context should be bound\n * @returns the created WebGL graphics binding\n */\n public static CreateFromEngine(session: XRSession, engine: AbstractEngine): WebXRWebGLGraphicsBinding {\n const gl = (engine as ThinEngine)._gl;\n if (!gl) {\n throw new Error(\"WebXRWebGLGraphicsBinding requires a WebGL-capable engine.\");\n }\n return new WebXRWebGLGraphicsBinding(session, gl);\n }\n}\n\n/**\n * WebGPU implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRGPUBinding`.\n *\n * The `XRGPUBinding` requires a WebGPU-compatible XR session (created with the `webgpu` feature\n * descriptor) and a `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.\n * @internal\n */\nexport class WebXRWebGPUGraphicsBinding implements IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n public readonly bindingType = WebXRGraphicsBindingType.WebGPU;\n\n /**\n * The wrapped native `XRGPUBinding`.\n */\n public readonly binding: XRGPUBinding;\n\n /**\n * Creates a new WebGPU graphics binding.\n * @param session the XR session the binding is created for\n * @param device the WebGPU device to bind to\n */\n constructor(session: XRSession, device: GPUDevice) {\n this.binding = new XRGPUBinding(session, device);\n }\n\n /**\n * Creates a new WebGPU graphics binding from an engine, extracting its `GPUDevice`.\n * The WebGPU-specific device access is localized here so callers can stay graphics-API-agnostic.\n * @param session the XR session the binding is created for\n * @param engine the engine whose WebGPU device should be bound\n * @returns the created WebGPU graphics binding\n */\n public static CreateFromEngine(session: XRSession, engine: AbstractEngine): WebXRWebGPUGraphicsBinding {\n const device = (engine as WebGPUEngine)._device;\n if (!device) {\n throw new Error(\"WebXRWebGPUGraphicsBinding requires a WebGPU-capable engine.\");\n }\n return new WebXRWebGPUGraphicsBinding(session, device);\n }\n}\n\n/**\n * The graphics bindings supported by the WebXR session manager.\n * @internal\n */\nexport type WebXRGraphicsBinding = WebXRWebGLGraphicsBinding | WebXRWebGPUGraphicsBinding;\n"]}
1
+ {"version":3,"file":"webXRGraphicsBinding.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AAO,CAAC,CAAC;IACxD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,OAAkB,EAAE,MAAsB;QACrE,MAAM,EAAE,GAAI,MAAqB,CAAC,GAAG,CAAC;QACtC,IAAI,CAAC,EAAE,EAAE,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;QAClF,CAAC;QACD,OAAO,IAAI,yBAAyB,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACtD,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAM,OAAO,0BAA0B;IAWnC;;;;OAIG;IACH,YAAY,OAAkB,EAAE,MAAiB;QAfjD;;WAEG;QACa,gBAAW,2CAAmC;QAa1D,IAAI,CAAC,OAAO,GAAG,IAAI,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACrD,CAAC;IAED;;;;;;OAMG;IACI,MAAM,CAAC,gBAAgB,CAAC,OAAkB,EAAE,MAAsB;QACrE,MAAM,MAAM,GAAI,MAAuB,CAAC,OAAO,CAAC;QAChD,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;QACpF,CAAC;QACD,OAAO,IAAI,0BAA0B,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3D,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"../Engines/abstractEngine\";\nimport { type ThinEngine } from \"../Engines/thinEngine\";\nimport { type WebGPUEngine } from \"../Engines/webgpuEngine\";\n\n/**\n * The error shown when the active WebGPU engine cannot start an XR session.\n * @internal\n */\nexport const WebGPUXRNotSupportedErrorMessage =\n \"WebGPU XR is unavailable in this browser or device. This experimental path requires XRGPUBinding with projection-layer support. To fall back, create a WebGL engine before creating the scene; Babylon.js cannot switch an existing scene's rendering backend.\";\n\n/**\n * The error shown when a WebGPU XR session request is rejected as unsupported.\n * @internal\n */\nexport const WebGPUXRSessionNotSupportedErrorMessage =\n \"The WebGPU XR session request was rejected as unsupported. The session mode, WebGPU or Layers requirements, or another required feature may be unavailable. If WebGPU XR is unavailable, create a WebGL engine before creating the scene.\";\n\n/**\n * The error shown when the active WebGPU engine was not created with XR compatibility enabled.\n * @internal\n */\nexport const WebGPUXREngineNotCompatibleErrorMessage =\n \"WebGPU XR requires a WebGPUEngine created with { xrCompatible: true }. Select an XR-capable WebGPU engine or WebGL before creating scene resources.\";\n\n/**\n * Checks whether the runtime exposes the XRGPUBinding projection path required by Babylon.js.\n * This is an advisory shape check; session negotiation can still reject for the active device.\n * @returns whether the required WebGPU-XR binding APIs are exposed\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function IsWebGPUXRSupported(): boolean {\n return (\n typeof XRGPUBinding === \"function\" &&\n typeof XRGPUBinding.prototype.createProjectionLayer === \"function\" &&\n typeof XRGPUBinding.prototype.getViewSubImage === \"function\" &&\n typeof XRGPUBinding.prototype.getPreferredColorFormat === \"function\" &&\n typeof XRGPUSubImage === \"function\" &&\n typeof XRGPUSubImage.prototype.getViewDescriptor === \"function\"\n );\n}\n\n/**\n * Checks whether an engine was initialized with the adapter option required for WebGPU XR.\n * @param engine the engine to test\n * @returns true for non-WebGPU engines or WebGPU engines created with xrCompatible enabled\n * @internal\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function IsWebGPUXREngineCompatible(engine: AbstractEngine): boolean {\n return !engine.isWebGPU || (engine as WebGPUEngine)._options?.xrCompatible === true;\n}\n\n/**\n * The kind of underlying native binding an {@link IWebXRGraphicsBinding} wraps.\n * @internal\n */\nexport const enum WebXRGraphicsBindingType {\n /**\n * Backed by an XRWebGLBinding (WebGL / WebGL2).\n */\n WebGL,\n\n /**\n * Backed by an XRGPUBinding (WebGPU).\n */\n WebGPU,\n}\n\n/**\n * Abstraction over the native WebXR graphics binding used to interact with the XR compositor.\n * @internal\n */\nexport interface IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n readonly bindingType: WebXRGraphicsBindingType;\n}\n\n/**\n * WebGL implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRWebGLBinding`.\n * @internal\n */\nexport class WebXRWebGLGraphicsBinding implements IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n public readonly bindingType = WebXRGraphicsBindingType.WebGL;\n\n /**\n * The wrapped native `XRWebGLBinding`.\n */\n public readonly binding: XRWebGLBinding;\n\n /**\n * Creates a new WebGL graphics binding.\n * @param session the XR session the binding is created for\n * @param context the WebGL rendering context to bind to\n */\n constructor(\n session: XRSession,\n /**\n * The WebGL rendering context used by the native binding.\n */\n public readonly context: WebGLRenderingContext | WebGL2RenderingContext\n ) {\n this.binding = new XRWebGLBinding(session, context);\n }\n\n /**\n * Creates a new WebGL graphics binding from an engine, extracting its WebGL context.\n * The WebGL-specific context access is localized here so callers can stay graphics-API-agnostic.\n * @param session the XR session the binding is created for\n * @param engine the engine whose WebGL context should be bound\n * @returns the created WebGL graphics binding\n */\n public static CreateFromEngine(session: XRSession, engine: AbstractEngine): WebXRWebGLGraphicsBinding {\n const gl = (engine as ThinEngine)._gl;\n if (!gl) {\n throw new Error(\"WebXRWebGLGraphicsBinding requires a WebGL-capable engine.\");\n }\n return new WebXRWebGLGraphicsBinding(session, gl);\n }\n}\n\n/**\n * WebGPU implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRGPUBinding`.\n *\n * The `XRGPUBinding` requires a WebGPU-compatible XR session (created with the `webgpu` feature\n * descriptor) and a `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.\n * @internal\n */\nexport class WebXRWebGPUGraphicsBinding implements IWebXRGraphicsBinding {\n /**\n * The kind of native binding that is wrapped.\n */\n public readonly bindingType = WebXRGraphicsBindingType.WebGPU;\n\n /**\n * The wrapped native `XRGPUBinding`.\n */\n public readonly binding: XRGPUBinding;\n\n /**\n * Creates a new WebGPU graphics binding.\n * @param session the XR session the binding is created for\n * @param device the WebGPU device to bind to\n */\n constructor(session: XRSession, device: GPUDevice) {\n this.binding = new XRGPUBinding(session, device);\n }\n\n /**\n * Creates a new WebGPU graphics binding from an engine, extracting its `GPUDevice`.\n * The WebGPU-specific device access is localized here so callers can stay graphics-API-agnostic.\n * @param session the XR session the binding is created for\n * @param engine the engine whose WebGPU device should be bound\n * @returns the created WebGPU graphics binding\n */\n public static CreateFromEngine(session: XRSession, engine: AbstractEngine): WebXRWebGPUGraphicsBinding {\n const device = (engine as WebGPUEngine)._device;\n if (!device) {\n throw new Error(\"WebXRWebGPUGraphicsBinding requires a WebGPU-capable engine.\");\n }\n return new WebXRWebGPUGraphicsBinding(session, device);\n }\n}\n\n/**\n * The graphics bindings supported by the WebXR session manager.\n * @internal\n */\nexport type WebXRGraphicsBinding = WebXRWebGLGraphicsBinding | WebXRWebGPUGraphicsBinding;\n"]}
@@ -54,7 +54,7 @@ export class WebXRInputSource {
54
54
  this.motionController = motionController;
55
55
  this.onMotionControllerInitObservable.notifyObservers(motionController);
56
56
  // should the model be loaded?
57
- if (!this._options.doNotLoadControllerMesh && !this.motionController._doNotLoadControllerMesh) {
57
+ if (!this._options.doNotLoadControllerMesh && !this.inputSource.skipRendering && !this.motionController._doNotLoadControllerMesh) {
58
58
  // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then
59
59
  this.motionController.loadModel().then((success) => {
60
60
  if (success && this.motionController && this.motionController.rootMesh) {