@onerjs/core 8.54.4 → 8.54.6

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 (234) hide show
  1. package/Engines/Native/nativeHelpers.js +5 -0
  2. package/Engines/Native/nativeHelpers.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  4. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  6. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  8. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  9. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  10. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  11. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  12. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  14. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  15. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  16. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  17. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  18. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  19. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  20. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  21. package/Engines/abstractEngine.pure.js +2 -2
  22. package/Engines/abstractEngine.pure.js.map +1 -1
  23. package/Engines/engineCapabilities.d.ts +5 -0
  24. package/Engines/engineCapabilities.js.map +1 -1
  25. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  26. package/Engines/thinNativeEngine.pure.js +52 -10
  27. package/Engines/thinNativeEngine.pure.js.map +1 -1
  28. package/Engines/webgpuEngine.pure.d.ts +1 -0
  29. package/Engines/webgpuEngine.pure.js +22 -8
  30. package/Engines/webgpuEngine.pure.js.map +1 -1
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  36. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  37. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  38. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  39. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  40. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  41. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  42. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  44. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  45. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  46. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  47. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  48. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  49. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  50. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  51. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  52. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  53. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  54. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  55. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  56. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  57. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  58. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  61. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  62. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  63. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  64. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  65. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  66. package/FlowGraph/Blocks/Event/index.js +1 -0
  67. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  68. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  69. package/FlowGraph/Blocks/Event/pure.js +1 -0
  70. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  75. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  76. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  78. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  82. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  83. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  84. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  85. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  86. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  87. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  89. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  90. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  91. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  92. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  93. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  94. package/FlowGraph/flowGraphContext.d.ts +23 -0
  95. package/FlowGraph/flowGraphContext.js +29 -0
  96. package/FlowGraph/flowGraphContext.js.map +1 -1
  97. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  98. package/FlowGraph/flowGraphCoordinator.js +72 -0
  99. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  100. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  101. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  102. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  103. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  104. package/FlowGraph/flowGraphHostResolver.js +25 -0
  105. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  106. package/FlowGraph/flowGraphMath.d.ts +48 -1
  107. package/FlowGraph/flowGraphMath.js +169 -4
  108. package/FlowGraph/flowGraphMath.js.map +1 -1
  109. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  110. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  111. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  112. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  113. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  114. package/FlowGraph/index.d.ts +2 -0
  115. package/FlowGraph/index.js +2 -0
  116. package/FlowGraph/index.js.map +1 -1
  117. package/FlowGraph/pure.d.ts +2 -0
  118. package/FlowGraph/pure.js +2 -0
  119. package/FlowGraph/pure.js.map +1 -1
  120. package/Materials/Node/nodeMaterial.pure.d.ts +3 -1
  121. package/Materials/Node/nodeMaterial.pure.js +18 -1
  122. package/Materials/Node/nodeMaterial.pure.js.map +1 -1
  123. package/Materials/Textures/envCubeTexture.pure.js +7 -2
  124. package/Materials/Textures/envCubeTexture.pure.js.map +1 -1
  125. package/Materials/materialHelper.functions.d.ts +14 -0
  126. package/Materials/materialHelper.functions.js +67 -0
  127. package/Materials/materialHelper.functions.js.map +1 -1
  128. package/Maths/math.vector.pure.d.ts +11 -1
  129. package/Maths/math.vector.pure.js +13 -0
  130. package/Maths/math.vector.pure.js.map +1 -1
  131. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  132. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  133. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  134. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  135. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  136. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  137. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  138. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  139. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  140. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  141. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  142. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  143. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  144. package/Meshes/abstractMesh.pure.js +1 -0
  145. package/Meshes/abstractMesh.pure.js.map +1 -1
  146. package/Meshes/mesh.pure.js +5 -0
  147. package/Meshes/mesh.pure.js.map +1 -1
  148. package/Meshes/transformNode.pure.js +1 -0
  149. package/Meshes/transformNode.pure.js.map +1 -1
  150. package/Misc/areaLightsTextureTools.js +1 -1
  151. package/Misc/areaLightsTextureTools.js.map +1 -1
  152. package/Misc/greasedLineTools.js +1 -1
  153. package/Misc/greasedLineTools.js.map +1 -1
  154. package/Misc/tools.pure.js +14 -2
  155. package/Misc/tools.pure.js.map +1 -1
  156. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  157. package/Particles/gpuParticleSystem.pure.js +189 -49
  158. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  159. package/Physics/v2/characterController.js +69 -17
  160. package/Physics/v2/characterController.js.map +1 -1
  161. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.d.ts +79 -0
  162. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js +171 -0
  163. package/PostProcesses/RenderPipeline/Pipelines/fsr1RenderingPipeline.js.map +1 -0
  164. package/PostProcesses/RenderPipeline/Pipelines/index.d.ts +5 -0
  165. package/PostProcesses/RenderPipeline/Pipelines/index.js +6 -0
  166. package/PostProcesses/RenderPipeline/Pipelines/index.js.map +1 -1
  167. package/PostProcesses/RenderPipeline/Pipelines/pure.d.ts +1 -0
  168. package/PostProcesses/RenderPipeline/Pipelines/pure.js +1 -0
  169. package/PostProcesses/RenderPipeline/Pipelines/pure.js.map +1 -1
  170. package/PostProcesses/thinFSR1SharpenPostProcess.d.ts +32 -0
  171. package/PostProcesses/thinFSR1SharpenPostProcess.js +58 -0
  172. package/PostProcesses/thinFSR1SharpenPostProcess.js.map +1 -0
  173. package/PostProcesses/thinFSR1UpscalePostProcess.d.ts +37 -0
  174. package/PostProcesses/thinFSR1UpscalePostProcess.js +68 -0
  175. package/PostProcesses/thinFSR1UpscalePostProcess.js.map +1 -0
  176. package/Shaders/ShadersInclude/ffxFunctions.d.ts +5 -0
  177. package/Shaders/ShadersInclude/ffxFunctions.js +18 -0
  178. package/Shaders/ShadersInclude/ffxFunctions.js.map +1 -0
  179. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +2 -2
  180. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  181. package/Shaders/ShadersInclude/openpbrIblFunctions.js +1 -6
  182. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  183. package/Shaders/fsr1Sharpen.fragment.d.ts +5 -0
  184. package/Shaders/fsr1Sharpen.fragment.js +26 -0
  185. package/Shaders/fsr1Sharpen.fragment.js.map +1 -0
  186. package/Shaders/fsr1Upscale.fragment.d.ts +5 -0
  187. package/Shaders/fsr1Upscale.fragment.js +77 -0
  188. package/Shaders/fsr1Upscale.fragment.js.map +1 -0
  189. package/ShadersWGSL/ShadersInclude/ffxFunctions.d.ts +5 -0
  190. package/ShadersWGSL/ShadersInclude/ffxFunctions.js +18 -0
  191. package/ShadersWGSL/ShadersInclude/ffxFunctions.js.map +1 -0
  192. package/ShadersWGSL/fsr1Sharpen.fragment.d.ts +5 -0
  193. package/ShadersWGSL/fsr1Sharpen.fragment.js +34 -0
  194. package/ShadersWGSL/fsr1Sharpen.fragment.js.map +1 -0
  195. package/ShadersWGSL/fsr1Upscale.fragment.d.ts +5 -0
  196. package/ShadersWGSL/fsr1Upscale.fragment.js +68 -0
  197. package/ShadersWGSL/fsr1Upscale.fragment.js.map +1 -0
  198. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  199. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  200. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  201. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  202. package/XR/features/WebXRAbstractFeature.js +16 -0
  203. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  204. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  205. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  206. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  207. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  208. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  209. package/XR/features/WebXRLayers.pure.js +65 -8
  210. package/XR/features/WebXRLayers.pure.js.map +1 -1
  211. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  212. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  213. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  214. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  215. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  216. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  217. package/XR/webXRCamera.js +27 -0
  218. package/XR/webXRCamera.js.map +1 -1
  219. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  220. package/XR/webXRFeatureWarningRegistry.js +19 -0
  221. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  222. package/XR/webXRFeaturesManager.d.ts +5 -0
  223. package/XR/webXRFeaturesManager.js +23 -4
  224. package/XR/webXRFeaturesManager.js.map +1 -1
  225. package/XR/webXRGraphicsBinding.d.ts +17 -10
  226. package/XR/webXRGraphicsBinding.js +8 -5
  227. package/XR/webXRGraphicsBinding.js.map +1 -1
  228. package/XR/webXRSessionManager.d.ts +3 -5
  229. package/XR/webXRSessionManager.js +1 -3
  230. package/XR/webXRSessionManager.js.map +1 -1
  231. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  232. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  233. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  234. package/package.json +1 -1
@@ -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;AA6F3C;;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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AC;YACrE,IAAI,UAAU,EAAE,CAAC;gBACb,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;oBACnB,aAAa,CAAC,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,IAAI,EAAE,CAAC;oBACtE,IAAI,aAAa,CAAC,gBAAgB,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;wBAC5D,aAAa,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBACpD,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACJ,aAAa,CAAC,gBAAgB,GAAG,aAAa,CAAC,gBAAgB,IAAI,EAAE,CAAC;oBACtE,IAAI,aAAa,CAAC,gBAAgB,CAAC,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;;AAlVuB,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 { 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 /**\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 attached = feature.featureImplementation.attach();\r\n if (!attached) {\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 if (constructed.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 Tools.Warn(`Feature ${name} not compatible with the current environment/browser and was not enabled.`);\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;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,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;AACoB,6BAAY,GAAG,iBAA0B,CAAC;AACjE;;GAEG;AACoB,mCAAkB,GAAG,uBAAgC,CAAC;AAC7E;;GAEG;AACoB,uBAAM,GAAG,WAAoB,CAAC;AACrD;;GAEG;AACoB,8BAAa,GAAG,kBAA2B,CAAC;AACnE;;GAEG;AACoB,2BAAU,GAAG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C,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"]}
@@ -14,11 +14,7 @@ export declare enum WebXRGraphicsBindingType {
14
14
  WebGPU = 1
15
15
  }
16
16
  /**
17
- * Abstraction over the WebXR graphics binding used to interact with the XR compositor
18
- * (XRWebGLBinding today, an XRGPUBinding-based binding for a future WebGPU backend).
19
- *
20
- * This is introduced as a seam so the XR features can be migrated off the concrete
21
- * `XRWebGLBinding` in a later phase without changing behavior today.
17
+ * Abstraction over the native WebXR graphics binding used to interact with the XR compositor.
22
18
  * @internal
23
19
  */
24
20
  export interface IWebXRGraphicsBinding {
@@ -32,6 +28,10 @@ export interface IWebXRGraphicsBinding {
32
28
  * @internal
33
29
  */
34
30
  export declare class WebXRWebGLGraphicsBinding implements IWebXRGraphicsBinding {
31
+ /**
32
+ * The WebGL rendering context used by the native binding.
33
+ */
34
+ readonly context: WebGLRenderingContext | WebGL2RenderingContext;
35
35
  /**
36
36
  * The kind of native binding that is wrapped.
37
37
  */
@@ -45,7 +45,11 @@ export declare class WebXRWebGLGraphicsBinding implements IWebXRGraphicsBinding
45
45
  * @param session the XR session the binding is created for
46
46
  * @param context the WebGL rendering context to bind to
47
47
  */
48
- constructor(session: XRSession, context: WebGLRenderingContext | WebGL2RenderingContext);
48
+ constructor(session: XRSession,
49
+ /**
50
+ * The WebGL rendering context used by the native binding.
51
+ */
52
+ context: WebGLRenderingContext | WebGL2RenderingContext);
49
53
  /**
50
54
  * Creates a new WebGL graphics binding from an engine, extracting its WebGL context.
51
55
  * The WebGL-specific context access is localized here so callers can stay graphics-API-agnostic.
@@ -58,10 +62,8 @@ export declare class WebXRWebGLGraphicsBinding implements IWebXRGraphicsBinding
58
62
  /**
59
63
  * WebGPU implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRGPUBinding`.
60
64
  *
61
- * This is introduced as part of the WebGPU-for-WebXR plumbing and is not consumed yet:
62
- * the per-frame layer/sub-image operations are wired up by later phases. The `XRGPUBinding`
63
- * requires a WebGPU-compatible XR session (created with the `webgpu` feature descriptor) and a
64
- * `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.
65
+ * The `XRGPUBinding` requires a WebGPU-compatible XR session (created with the `webgpu` feature
66
+ * descriptor) and a `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.
65
67
  * @internal
66
68
  */
67
69
  export declare class WebXRWebGPUGraphicsBinding implements IWebXRGraphicsBinding {
@@ -88,3 +90,8 @@ export declare class WebXRWebGPUGraphicsBinding implements IWebXRGraphicsBinding
88
90
  */
89
91
  static CreateFromEngine(session: XRSession, engine: AbstractEngine): WebXRWebGPUGraphicsBinding;
90
92
  }
93
+ /**
94
+ * The graphics bindings supported by the WebXR session manager.
95
+ * @internal
96
+ */
97
+ export type WebXRGraphicsBinding = WebXRWebGLGraphicsBinding | WebXRWebGPUGraphicsBinding;
@@ -23,7 +23,12 @@ export class WebXRWebGLGraphicsBinding {
23
23
  * @param session the XR session the binding is created for
24
24
  * @param context the WebGL rendering context to bind to
25
25
  */
26
- constructor(session, context) {
26
+ constructor(session,
27
+ /**
28
+ * The WebGL rendering context used by the native binding.
29
+ */
30
+ context) {
31
+ this.context = context;
27
32
  /**
28
33
  * The kind of native binding that is wrapped.
29
34
  */
@@ -48,10 +53,8 @@ export class WebXRWebGLGraphicsBinding {
48
53
  /**
49
54
  * WebGPU implementation of {@link IWebXRGraphicsBinding}, wrapping an `XRGPUBinding`.
50
55
  *
51
- * This is introduced as part of the WebGPU-for-WebXR plumbing and is not consumed yet:
52
- * the per-frame layer/sub-image operations are wired up by later phases. The `XRGPUBinding`
53
- * requires a WebGPU-compatible XR session (created with the `webgpu` feature descriptor) and a
54
- * `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.
56
+ * The `XRGPUBinding` requires a WebGPU-compatible XR session (created with the `webgpu` feature
57
+ * descriptor) and a `GPUDevice` obtained from an `xrCompatible` adapter, otherwise its constructor throws.
55
58
  * @internal
56
59
  */
57
60
  export class WebXRWebGPUGraphicsBinding {
@@ -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;AAiBD;;;GAGG;AACH,MAAM,OAAO,yBAAyB;IAWlC;;;;OAIG;IACH,YAAY,OAAkB,EAAE,OAAuD;QAfvF;;WAEG;QACa,gBAAW,0CAAkC;QAazD,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;;;;;;;;GAQG;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 WebXR graphics binding used to interact with the XR compositor\n * (XRWebGLBinding today, an XRGPUBinding-based binding for a future WebGPU backend).\n *\n * This is introduced as a seam so the XR features can be migrated off the concrete\n * `XRWebGLBinding` in a later phase without changing behavior today.\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(session: XRSession, context: WebGLRenderingContext | WebGL2RenderingContext) {\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 * This is introduced as part of the WebGPU-for-WebXR plumbing and is not consumed yet:\n * the per-frame layer/sub-image operations are wired up by later phases. The `XRGPUBinding`\n * requires a WebGPU-compatible XR session (created with the `webgpu` feature descriptor) and a\n * `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"]}
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"]}
@@ -7,7 +7,7 @@ import { WebXRManagedOutputCanvasOptions } from "./webXRManagedOutputCanvas.js";
7
7
  import { type IWebXRRenderTargetTextureProvider } from "./webXRRenderTargetTextureProvider.js";
8
8
  import { type Viewport } from "../Maths/math.viewport.js";
9
9
  import { type WebXRLayerWrapper } from "./webXRLayerWrapper.js";
10
- import { type IWebXRGraphicsBinding } from "./webXRGraphicsBinding.js";
10
+ import { type WebXRGraphicsBinding } from "./webXRGraphicsBinding.js";
11
11
  /**
12
12
  * Manages an XRSession to work with Babylon's engine
13
13
  * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers
@@ -145,13 +145,11 @@ export declare class WebXRSessionManager implements IDisposable, IWebXRRenderTar
145
145
  getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;
146
146
  /**
147
147
  * Obtains the XR graphics binding for the current session, creating it lazily.
148
- * This is the API-agnostic seam a future non-WebGL backend uses to provide its own binding
149
- * (XRWebGLBinding vs a future XRGPUBinding); the XR features are migrated onto it in a later
150
- * phase, so it is not consumed yet.
148
+ * This is the API-agnostic seam used by WebGL and WebGPU XR features to share a binding.
151
149
  * @returns the XR graphics binding for the current session
152
150
  * @internal
153
151
  */
154
- _getGraphicsBinding(): IWebXRGraphicsBinding;
152
+ _getGraphicsBinding(): WebXRGraphicsBinding;
155
153
  /**
156
154
  * Creates a WebXRRenderTarget object for the XR session
157
155
  * @param options optional options to provide when creating a new render target
@@ -171,9 +171,7 @@ export class WebXRSessionManager {
171
171
  }
172
172
  /**
173
173
  * Obtains the XR graphics binding for the current session, creating it lazily.
174
- * This is the API-agnostic seam a future non-WebGL backend uses to provide its own binding
175
- * (XRWebGLBinding vs a future XRGPUBinding); the XR features are migrated onto it in a later
176
- * phase, so it is not consumed yet.
174
+ * This is the API-agnostic seam used by WebGL and WebGPU XR features to share a binding.
177
175
  * @returns the XR graphics binding for the current session
178
176
  * @internal
179
177
  */
@@ -1 +1 @@
1
- {"version":3,"file":"webXRSessionManager.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAiB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAK/D,OAAO,EAAE,wBAAwB,EAAE,+BAA+B,EAAE,MAAM,4BAA4B,CAAC;AAIvG,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAA8B,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,wBAAwB,CAAC;AAG3H;;;GAGG;AACH,MAAM,OAAO,mBAAmB;IAgF5B;;OAEG;IACH,IAAW,kBAAkB;QACzB,OAAO,IAAI,CAAC,mBAAmB,CAAC;IACpC,CAAC;IAED,IAAW,kBAAkB,CAAC,KAAa;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,mBAAmB,CAAC;QAC1C,IAAI,CAAC,mBAAmB,GAAG,KAAK,CAAC;QACjC,IAAI,CAAC,mC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EAAE,eAAe,IAAI,IAAI,CAAC;IACjD,CAAC;CACJ","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { type WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRManagedOutputCanvas, WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport { type IWebXRRenderTargetTextureProvider, type WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport { type Viewport } from \"../Maths/math.viewport\";\r\nimport { type WebXRLayerWrapper } from \"./webXRLayerWrapper\";\r\nimport { NativeXRLayerWrapper, NativeXRRenderTarget } from \"./native/nativeXRRenderTarget\";\r\nimport { WebXRWebGLLayerWrapper } from \"./webXRWebGLLayer\";\r\nimport { type IWebXRGraphicsBinding, WebXRWebGLGraphicsBinding, WebXRWebGPUGraphicsBinding } from \"./webXRGraphicsBinding\";\r\nimport { type AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers\r\n */\r\nexport class WebXRSessionManager implements IDisposable, IWebXRRenderTargetTextureProvider {\r\n private _engine: Nullable<AbstractEngine>;\r\n private _referenceSpace: XRReferenceSpace;\r\n private _baseLayerWrapper: Nullable<WebXRLayerWrapper>;\r\n private _baseLayerRTTProvider: Nullable<WebXRLayerRenderTargetTextureProvider>;\r\n private _graphicsBinding: Nullable<IWebXRGraphicsBinding> = null;\r\n private _xrNavigator: any;\r\n private _sessionMode: XRSessionMode;\r\n private _onEngineDisposedObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * The base reference space from which the session started. good if you want to reset your\r\n * reference space\r\n */\r\n public baseReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Current XR frame\r\n */\r\n public currentFrame: Nullable<XRFrame>;\r\n /** WebXR timestamp updated every frame */\r\n public currentTimestamp: number = -1;\r\n /**\r\n * Used just in case of a failure to initialize an immersive session.\r\n * The viewer reference space is compensated using this height, creating a kind of \"viewer-floor\" reference space\r\n */\r\n public defaultHeightCompensation = 1.7;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n public onXRFrameObservable: Observable<XRFrame> = new Observable<XRFrame>();\r\n /**\r\n * Fires when the reference space changed\r\n */\r\n public onXRReferenceSpaceChanged: Observable<XRReferenceSpace> = new Observable();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n public onXRSessionEnded: Observable<any> = new Observable<any>();\r\n /**\r\n * Fires when the xr session is initialized: right after requestSession was called and returned with a successful result\r\n */\r\n public onXRSessionInit: Observable<XRSession> = new Observable<XRSession>();\r\n\r\n /**\r\n * Fires when the xr reference space has been initialized\r\n */\r\n public onXRReferenceSpaceInitialized: Observable<XRReferenceSpace> = new Observable<XRReferenceSpace>();\r\n\r\n /**\r\n * Fires when the session manager is rendering the first frame\r\n */\r\n public onXRReady: Observable<WebXRSessionManager> = new Observable<WebXRSessionManager>();\r\n /**\r\n * Underlying xr session\r\n */\r\n public session: XRSession;\r\n /**\r\n * The viewer (head position) reference space. This can be used to get the XR world coordinates\r\n * or get the offset the player is currently at.\r\n */\r\n public viewerReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Are we currently in the XR loop?\r\n */\r\n public inXRFrameLoop: boolean = false;\r\n /**\r\n * Are we in an XR session?\r\n */\r\n public inXRSession: boolean = false;\r\n\r\n private _worldScalingFactor: number = 1;\r\n\r\n /**\r\n * Observable raised when the world scale has changed\r\n */\r\n public onWorldScaleFactorChangedObservable: Observable<{\r\n previousScaleFactor: number;\r\n newScaleFactor: number;\r\n }> = new Observable(undefined, true);\r\n\r\n /**\r\n * Scale factor to apply to all XR-related elements (camera, controllers)\r\n */\r\n public get worldScalingFactor(): number {\r\n return this._worldScalingFactor;\r\n }\r\n\r\n public set worldScalingFactor(value: number) {\r\n const oldValue = this._worldScalingFactor;\r\n this._worldScalingFactor = value;\r\n this.onWorldScaleFactorChangedObservable.notifyObservers({\r\n previousScaleFactor: oldValue,\r\n newScaleFactor: value,\r\n });\r\n }\r\n\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n constructor(\r\n /** The scene which the session should be created for */\r\n public scene: Scene\r\n ) {\r\n this._engine = scene.getEngine();\r\n this._onEngineDisposedObserver = this._engine.onDisposeObservable.addOnce(() => {\r\n this._engine = null;\r\n });\r\n scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n\r\n this.onXRSessionEnded.add(() => {\r\n // Set the scene's pointer camera to null to stop the XR camera being used for picking.\r\n scene.cameraToUseForPointers = null;\r\n });\r\n }\r\n\r\n /**\r\n * The current reference space used in this session. This reference space can constantly change!\r\n * It is mainly used to offset the camera's position.\r\n */\r\n public get referenceSpace(): XRReferenceSpace {\r\n return this._referenceSpace;\r\n }\r\n\r\n /**\r\n * Set a new reference space and triggers the observable\r\n */\r\n public set referenceSpace(newReferenceSpace: XRReferenceSpace) {\r\n this._referenceSpace = newReferenceSpace;\r\n this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace);\r\n }\r\n\r\n /**\r\n * The mode for the managed XR session\r\n */\r\n public get sessionMode(): XRSessionMode {\r\n return this._sessionMode;\r\n }\r\n\r\n /**\r\n * Disposes of the session manager\r\n * This should be called explicitly by the dev, if required.\r\n */\r\n public dispose() {\r\n // disposing without leaving XR? Exit XR first\r\n if (this.inXRSession) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.exitXRAsync();\r\n }\r\n this.onXRReady.clear();\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n this.onXRReferenceSpaceChanged.clear();\r\n this.onXRReferenceSpaceInitialized.clear();\r\n this.onXRSessionInit.clear();\r\n this.onWorldScaleFactorChangedObservable.clear();\r\n this._engine?.onDisposeObservable.remove(this._onEngineDisposedObserver);\r\n this._engine = null;\r\n }\r\n\r\n /**\r\n * Stops the xrSession and restores the render loop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n public async exitXRAsync() {\r\n if (this.session && this.inXRSession) {\r\n this.inXRSession = false;\r\n try {\r\n return await this.session.end();\r\n } catch {\r\n Logger.Warn(\"Could not end XR session.\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Attempts to set the framebuffer-size-normalized viewport to be rendered this frame for this view.\r\n * In the event of a failure, the supplied viewport is not updated.\r\n * @param viewport the viewport to which the view will be rendered\r\n * @param view the view for which to set the viewport\r\n * @returns whether the operation was successful\r\n */\r\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\r\n return this._baseLayerRTTProvider?.trySetViewportForView(viewport, view) || false;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this eye\r\n * @param eye the eye for which to get the render target\r\n * @returns the render target for the specified eye or null if not available\r\n */\r\n public getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForEye(eye) || null;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this view\r\n * @param view the view for which to get the render target\r\n * @returns the render target for the specified view or null if not available\r\n */\r\n public getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForView(view) || null;\r\n }\r\n\r\n /**\r\n * Obtains the XR graphics binding for the current session, creating it lazily.\r\n * This is the API-agnostic seam a future non-WebGL backend uses to provide its own binding\r\n * (XRWebGLBinding vs a future XRGPUBinding); the XR features are migrated onto it in a later\r\n * phase, so it is not consumed yet.\r\n * @returns the XR graphics binding for the current session\r\n * @internal\r\n */\r\n public _getGraphicsBinding(): IWebXRGraphicsBinding {\r\n if (!this._engine) {\r\n throw new Error(\"Cannot create the XR graphics binding: the engine has been disposed.\");\r\n }\r\n if (!this.session) {\r\n throw new Error(\"Cannot create the XR graphics binding before the XR session is initialized.\");\r\n }\r\n if (!this._graphicsBinding) {\r\n this._graphicsBinding = this._engine.isWebGPU\r\n ? WebXRWebGPUGraphicsBinding.CreateFromEngine(this.session, this._engine)\r\n : WebXRWebGLGraphicsBinding.CreateFromEngine(this.session, this._engine);\r\n }\r\n return this._graphicsBinding;\r\n }\r\n\r\n /**\r\n * Creates a WebXRRenderTarget object for the XR session\r\n * @param options optional options to provide when creating a new render target\r\n * @returns a WebXR render target to which the session can render\r\n */\r\n public getWebXRRenderTarget(options?: WebXRManagedOutputCanvasOptions): WebXRRenderTarget {\r\n const engine = this.scene.getEngine();\r\n if (this._xrNavigator.xr.native) {\r\n return new NativeXRRenderTarget(this);\r\n } else {\r\n options = options || WebXRManagedOutputCanvasOptions.GetDefaults(engine);\r\n options.canvasElement = options.canvasElement || engine.getRenderingCanvas() || undefined;\r\n return new WebXRManagedOutputCanvas(this, options);\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n public async initializeAsync(): Promise<void> {\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n throw new Error(\"WebXR not supported on this browser.\");\r\n }\r\n }\r\n\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @param xrSessionInit defines optional and required values to pass to the session builder\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n public async initializeSessionAsync(xrSessionMode: XRSessionMode = \"immersive-vr\", xrSessionInit: XRSessionInit = {}): Promise<XRSession> {\r\n // A WebGPU engine requires a WebGPU-compatible XR session (per the WebXR/WebGPU binding spec).\r\n // The \"webgpu\" feature descriptor is requested as a *required* feature: a WebGPU engine cannot\r\n // fall back to a WebGL-compatible session, so if the UA/device cannot provide one we let\r\n // requestSession reject and surface that error to the caller rather than silently handing back\r\n // an incompatible session. WebGL engines leave xrSessionInit untouched.\r\n if (this._engine?.isWebGPU) {\r\n const requiredFeatures = xrSessionInit.requiredFeatures ? [...xrSessionInit.requiredFeatures] : [];\r\n if (!requiredFeatures.includes(\"webgpu\")) {\r\n requiredFeatures.push(\"webgpu\");\r\n }\r\n xrSessionInit = { ...xrSessionInit, requiredFeatures };\r\n }\r\n\r\n const session = await this._xrNavigator.xr.requestSession(xrSessionMode, xrSessionInit);\r\n\r\n this.session = session;\r\n this._sessionMode = xrSessionMode;\r\n this.inXRSession = true;\r\n this.onXRSessionInit.notifyObservers(session);\r\n\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n this.session.addEventListener(\r\n \"end\",\r\n () => {\r\n this.inXRSession = false;\r\n\r\n // Cache the value of engine in case it is disposed during onXRSessionEnded callbacks\r\n const engine = this._engine;\r\n\r\n // Notify frame observers\r\n this.onXRSessionEnded.notifyObservers(null);\r\n\r\n if (engine && !engine.isDisposed) {\r\n // make sure dimensions object is restored\r\n engine.framebufferDimensionsObject = null;\r\n\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n engine.restoreDefaultFramebuffer();\r\n\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n engine.customAnimationFrameRequester = null;\r\n engine._renderLoop();\r\n }\r\n\r\n // Dispose render target textures.\r\n // Only dispose on native because we can't destroy opaque textures on browser.\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerRTTProvider = null;\r\n this._baseLayerWrapper = null;\r\n this._graphicsBinding = null;\r\n },\r\n { once: true }\r\n );\r\n\r\n return this.session;\r\n }\r\n\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns A Promise that resolves to true if supported and false if not\r\n */\r\n public async isSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n return await WebXRSessionManager.IsSessionSupportedAsync(sessionMode);\r\n }\r\n\r\n /**\r\n * Resets the reference space to the one started the session\r\n */\r\n public resetReferenceSpace() {\r\n this.referenceSpace = this.baseReferenceSpace;\r\n }\r\n\r\n /**\r\n * Starts rendering to the xr layer\r\n */\r\n public runXRRenderLoop() {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this._engine.customAnimationFrameRequester = {\r\n requestAnimationFrame: (callback: FrameRequestCallback) => this.session.requestAnimationFrame(callback),\r\n renderFunction: (timestamp: number, xrFrame: Nullable<XRFrame>) => {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n // Store the XR frame and timestamp in the session manager\r\n this.currentFrame = xrFrame;\r\n this.currentTimestamp = timestamp;\r\n if (xrFrame) {\r\n this.inXRFrameLoop = true;\r\n const framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n // equality can be tested as it should be the same object\r\n if (this._engine.framebufferDimensionsObject !== framebufferDimensionsObject) {\r\n this._engine.framebufferDimensionsObject = framebufferDimensionsObject;\r\n }\r\n this.onXRFrameObservable.notifyObservers(xrFrame);\r\n this._engine._renderLoop();\r\n this._engine.framebufferDimensionsObject = null;\r\n this.inXRFrameLoop = false;\r\n }\r\n },\r\n };\r\n\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n this.onXRFrameObservable.addOnce(() => {\r\n this.onXRReady.notifyObservers(this);\r\n });\r\n\r\n // Stop window's animation frame and trigger sessions animation frame\r\n if (typeof window !== \"undefined\" && window.cancelAnimationFrame) {\r\n window.cancelAnimationFrame(this._engine._frameHandler);\r\n }\r\n this._engine._renderLoop();\r\n }\r\n\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpaceType space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n public async setReferenceSpaceTypeAsync(referenceSpaceType: XRReferenceSpaceType = \"local-floor\"): Promise<XRReferenceSpace> {\r\n let referenceSpace: XRReferenceSpace;\r\n let viewerReferenceSpace: Nullable<XRReferenceSpace> = null;\r\n try {\r\n referenceSpace = await this.session.requestReferenceSpace(referenceSpaceType);\r\n } catch (rejectionReason) {\r\n Logger.Error(\"XR.requestReferenceSpace failed for the following reason: \");\r\n Logger.Error(rejectionReason);\r\n Logger.Log('Defaulting to universally-supported \"viewer\" reference space type.');\r\n\r\n try {\r\n viewerReferenceSpace = (await this.session.requestReferenceSpace(\"viewer\")) as XRReferenceSpace;\r\n const heightCompensation = new XRRigidTransform({ x: 0, y: -this.defaultHeightCompensation, z: 0 });\r\n referenceSpace = viewerReferenceSpace.getOffsetReferenceSpace(heightCompensation);\r\n } catch (rejectionReason) {\r\n Logger.Error(rejectionReason);\r\n // eslint-disable-next-line no-throw-literal\r\n throw 'XR initialization failed: required \"viewer\" reference space type not supported.';\r\n }\r\n }\r\n // create viewer reference space before setting the first reference space\r\n this.viewerReferenceSpace = viewerReferenceSpace ?? ((await this.session.requestReferenceSpace(\"viewer\")) as XRReferenceSpace);\r\n // initialize the base and offset (currently the same)\r\n this.referenceSpace = this.baseReferenceSpace = referenceSpace;\r\n this.onXRReferenceSpaceInitialized.notifyObservers(referenceSpace);\r\n return this.referenceSpace;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session.\r\n * Note that this is deprecated in favor of WebXRSessionManager.updateRenderState().\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n * @deprecated Use updateRenderState() instead.\r\n */\r\n public async updateRenderStateAsync(state: XRRenderState): Promise<void> {\r\n return await this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _setBaseLayerWrapper(baseLayerWrapper: Nullable<WebXRLayerWrapper>): void {\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerWrapper = baseLayerWrapper;\r\n this._baseLayerRTTProvider = this._baseLayerWrapper?.createRenderTargetTextureProvider(this) || null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getBaseLayerWrapper(): Nullable<WebXRLayerWrapper> {\r\n return this._baseLayerWrapper;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n */\r\n public updateRenderState(state: XRRenderStateInit): void {\r\n if (state.baseLayer) {\r\n this._setBaseLayerWrapper(this.isNative ? new NativeXRLayerWrapper(state.baseLayer) : new WebXRWebGLLayerWrapper(state.baseLayer));\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves with a boolean indicating if the provided session mode is supported by this browser\r\n * @param sessionMode defines the session to test\r\n * @returns a promise with boolean as final value\r\n */\r\n public static async IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n if (!(navigator as any).xr) {\r\n return false;\r\n }\r\n // When the specs are final, remove supportsSession!\r\n const functionToUse = (navigator as any).xr.isSessionSupported || (navigator as any).xr.supportsSession;\r\n if (!functionToUse) {\r\n return false;\r\n } else {\r\n try {\r\n const result = functionToUse.call((navigator as any).xr, sessionMode);\r\n const returnValue = typeof result === \"undefined\" ? true : result;\r\n return returnValue;\r\n } catch (e: any) {\r\n Logger.Warn(e);\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if Babylon.js is using the BabylonNative backend, otherwise false\r\n */\r\n public get isNative(): boolean {\r\n return this._xrNavigator.xr.native ?? false;\r\n }\r\n\r\n /**\r\n * The current frame rate as reported by the device\r\n */\r\n public get currentFrameRate(): number | undefined {\r\n return this.session?.frameRate;\r\n }\r\n\r\n /**\r\n * A list of supported frame rates (only available in-session!\r\n */\r\n public get supportedFrameRates(): Float32Array | undefined {\r\n return this.session?.supportedFrameRates;\r\n }\r\n\r\n /**\r\n * Set the framerate of the session.\r\n * @param rate the new framerate. This value needs to be in the supportedFrameRates array\r\n * @returns a promise that resolves once the framerate has been set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async updateTargetFrameRate(rate: number): Promise<void> {\r\n return await this.session.updateTargetFrameRate(rate);\r\n }\r\n\r\n /**\r\n * Run a callback in the xr render loop\r\n * @param callback the callback to call when in XR Frame\r\n * @param ignoreIfNotInSession if no session is currently running, run it first thing on the next session\r\n */\r\n public runInXRFrame(callback: () => void, ignoreIfNotInSession = true): void {\r\n if (this.inXRFrameLoop) {\r\n callback();\r\n } else if (this.inXRSession || !ignoreIfNotInSession) {\r\n this.onXRFrameObservable.addOnce(callback);\r\n }\r\n }\r\n\r\n /**\r\n * Check if fixed foveation is supported on this device\r\n */\r\n public get isFixedFoveationSupported(): boolean {\r\n return this._baseLayerWrapper?.isFixedFoveationSupported || false;\r\n }\r\n\r\n /**\r\n * Get the fixed foveation currently set, as specified by the webxr specs\r\n * If this returns null, then fixed foveation is not supported\r\n */\r\n public get fixedFoveation(): Nullable<number> {\r\n return this._baseLayerWrapper?.fixedFoveation || null;\r\n }\r\n\r\n /**\r\n * Set the fixed foveation to the specified value, as specified by the webxr specs\r\n * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation\r\n */\r\n public set fixedFoveation(value: Nullable<number>) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n if (this._baseLayerWrapper) {\r\n this._baseLayerWrapper.fixedFoveation = val;\r\n }\r\n }\r\n\r\n /**\r\n * Get the features enabled on the current session\r\n * This is only available in-session!\r\n * @see https://www.w3.org/TR/webxr/#dom-xrsession-enabledfeatures\r\n */\r\n public get enabledFeatures(): Nullable<string[]> {\r\n return this.session?.enabledFeatures ?? null;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRSessionManager.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRSessionManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAiB,UAAU,EAAE,MAA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AyB;QAChC,OAAO,IAAI,CAAC,iBAAiB,EAAE,yBAAyB,IAAI,KAAK,CAAC;IACtE,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,OAAO,IAAI,CAAC,iBAAiB,EAAE,cAAc,IAAI,IAAI,CAAC;IAC1D,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc,CAAC,KAAuB;QAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,iBAAiB,EAAE,CAAC;YACzB,IAAI,CAAC,iBAAiB,CAAC,cAAc,GAAG,GAAG,CAAC;QAChD,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,IAAW,eAAe;QACtB,OAAO,IAAI,CAAC,OAAO,EAAE,eAAe,IAAI,IAAI,CAAC;IACjD,CAAC;CACJ","sourcesContent":["import { Logger } from \"../Misc/logger\";\r\nimport { type Observer, Observable } from \"../Misc/observable\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture\";\r\nimport { type WebXRRenderTarget } from \"./webXRTypes\";\r\nimport { WebXRManagedOutputCanvas, WebXRManagedOutputCanvasOptions } from \"./webXRManagedOutputCanvas\";\r\nimport { type IWebXRRenderTargetTextureProvider, type WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport { type Viewport } from \"../Maths/math.viewport\";\r\nimport { type WebXRLayerWrapper } from \"./webXRLayerWrapper\";\r\nimport { NativeXRLayerWrapper, NativeXRRenderTarget } from \"./native/nativeXRRenderTarget\";\r\nimport { WebXRWebGLLayerWrapper } from \"./webXRWebGLLayer\";\r\nimport { type WebXRGraphicsBinding, WebXRWebGLGraphicsBinding, WebXRWebGPUGraphicsBinding } from \"./webXRGraphicsBinding\";\r\nimport { type AbstractEngine } from \"../Engines/abstractEngine\";\r\n\r\n/**\r\n * Manages an XRSession to work with Babylon's engine\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRSessionManagers\r\n */\r\nexport class WebXRSessionManager implements IDisposable, IWebXRRenderTargetTextureProvider {\r\n private _engine: Nullable<AbstractEngine>;\r\n private _referenceSpace: XRReferenceSpace;\r\n private _baseLayerWrapper: Nullable<WebXRLayerWrapper>;\r\n private _baseLayerRTTProvider: Nullable<WebXRLayerRenderTargetTextureProvider>;\r\n private _graphicsBinding: Nullable<WebXRGraphicsBinding> = null;\r\n private _xrNavigator: any;\r\n private _sessionMode: XRSessionMode;\r\n private _onEngineDisposedObserver: Nullable<Observer<AbstractEngine>>;\r\n\r\n /**\r\n * The base reference space from which the session started. good if you want to reset your\r\n * reference space\r\n */\r\n public baseReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Current XR frame\r\n */\r\n public currentFrame: Nullable<XRFrame>;\r\n /** WebXR timestamp updated every frame */\r\n public currentTimestamp: number = -1;\r\n /**\r\n * Used just in case of a failure to initialize an immersive session.\r\n * The viewer reference space is compensated using this height, creating a kind of \"viewer-floor\" reference space\r\n */\r\n public defaultHeightCompensation = 1.7;\r\n /**\r\n * Fires every time a new xrFrame arrives which can be used to update the camera\r\n */\r\n public onXRFrameObservable: Observable<XRFrame> = new Observable<XRFrame>();\r\n /**\r\n * Fires when the reference space changed\r\n */\r\n public onXRReferenceSpaceChanged: Observable<XRReferenceSpace> = new Observable();\r\n /**\r\n * Fires when the xr session is ended either by the device or manually done\r\n */\r\n public onXRSessionEnded: Observable<any> = new Observable<any>();\r\n /**\r\n * Fires when the xr session is initialized: right after requestSession was called and returned with a successful result\r\n */\r\n public onXRSessionInit: Observable<XRSession> = new Observable<XRSession>();\r\n\r\n /**\r\n * Fires when the xr reference space has been initialized\r\n */\r\n public onXRReferenceSpaceInitialized: Observable<XRReferenceSpace> = new Observable<XRReferenceSpace>();\r\n\r\n /**\r\n * Fires when the session manager is rendering the first frame\r\n */\r\n public onXRReady: Observable<WebXRSessionManager> = new Observable<WebXRSessionManager>();\r\n /**\r\n * Underlying xr session\r\n */\r\n public session: XRSession;\r\n /**\r\n * The viewer (head position) reference space. This can be used to get the XR world coordinates\r\n * or get the offset the player is currently at.\r\n */\r\n public viewerReferenceSpace: XRReferenceSpace;\r\n /**\r\n * Are we currently in the XR loop?\r\n */\r\n public inXRFrameLoop: boolean = false;\r\n /**\r\n * Are we in an XR session?\r\n */\r\n public inXRSession: boolean = false;\r\n\r\n private _worldScalingFactor: number = 1;\r\n\r\n /**\r\n * Observable raised when the world scale has changed\r\n */\r\n public onWorldScaleFactorChangedObservable: Observable<{\r\n previousScaleFactor: number;\r\n newScaleFactor: number;\r\n }> = new Observable(undefined, true);\r\n\r\n /**\r\n * Scale factor to apply to all XR-related elements (camera, controllers)\r\n */\r\n public get worldScalingFactor(): number {\r\n return this._worldScalingFactor;\r\n }\r\n\r\n public set worldScalingFactor(value: number) {\r\n const oldValue = this._worldScalingFactor;\r\n this._worldScalingFactor = value;\r\n this.onWorldScaleFactorChangedObservable.notifyObservers({\r\n previousScaleFactor: oldValue,\r\n newScaleFactor: value,\r\n });\r\n }\r\n\r\n /**\r\n * Constructs a WebXRSessionManager, this must be initialized within a user action before usage\r\n * @param scene The scene which the session should be created for\r\n */\r\n constructor(\r\n /** The scene which the session should be created for */\r\n public scene: Scene\r\n ) {\r\n this._engine = scene.getEngine();\r\n this._onEngineDisposedObserver = this._engine.onDisposeObservable.addOnce(() => {\r\n this._engine = null;\r\n });\r\n scene.onDisposeObservable.addOnce(() => {\r\n this.dispose();\r\n });\r\n\r\n this.onXRSessionEnded.add(() => {\r\n // Set the scene's pointer camera to null to stop the XR camera being used for picking.\r\n scene.cameraToUseForPointers = null;\r\n });\r\n }\r\n\r\n /**\r\n * The current reference space used in this session. This reference space can constantly change!\r\n * It is mainly used to offset the camera's position.\r\n */\r\n public get referenceSpace(): XRReferenceSpace {\r\n return this._referenceSpace;\r\n }\r\n\r\n /**\r\n * Set a new reference space and triggers the observable\r\n */\r\n public set referenceSpace(newReferenceSpace: XRReferenceSpace) {\r\n this._referenceSpace = newReferenceSpace;\r\n this.onXRReferenceSpaceChanged.notifyObservers(this._referenceSpace);\r\n }\r\n\r\n /**\r\n * The mode for the managed XR session\r\n */\r\n public get sessionMode(): XRSessionMode {\r\n return this._sessionMode;\r\n }\r\n\r\n /**\r\n * Disposes of the session manager\r\n * This should be called explicitly by the dev, if required.\r\n */\r\n public dispose() {\r\n // disposing without leaving XR? Exit XR first\r\n if (this.inXRSession) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.exitXRAsync();\r\n }\r\n this.onXRReady.clear();\r\n this.onXRFrameObservable.clear();\r\n this.onXRSessionEnded.clear();\r\n this.onXRReferenceSpaceChanged.clear();\r\n this.onXRReferenceSpaceInitialized.clear();\r\n this.onXRSessionInit.clear();\r\n this.onWorldScaleFactorChangedObservable.clear();\r\n this._engine?.onDisposeObservable.remove(this._onEngineDisposedObserver);\r\n this._engine = null;\r\n }\r\n\r\n /**\r\n * Stops the xrSession and restores the render loop\r\n * @returns Promise which resolves after it exits XR\r\n */\r\n public async exitXRAsync() {\r\n if (this.session && this.inXRSession) {\r\n this.inXRSession = false;\r\n try {\r\n return await this.session.end();\r\n } catch {\r\n Logger.Warn(\"Could not end XR session.\");\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Attempts to set the framebuffer-size-normalized viewport to be rendered this frame for this view.\r\n * In the event of a failure, the supplied viewport is not updated.\r\n * @param viewport the viewport to which the view will be rendered\r\n * @param view the view for which to set the viewport\r\n * @returns whether the operation was successful\r\n */\r\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\r\n return this._baseLayerRTTProvider?.trySetViewportForView(viewport, view) || false;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this eye\r\n * @param eye the eye for which to get the render target\r\n * @returns the render target for the specified eye or null if not available\r\n */\r\n public getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForEye(eye) || null;\r\n }\r\n\r\n /**\r\n * Gets the correct render target texture to be rendered this frame for this view\r\n * @param view the view for which to get the render target\r\n * @returns the render target for the specified view or null if not available\r\n */\r\n public getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture> {\r\n return this._baseLayerRTTProvider?.getRenderTargetTextureForView(view) || null;\r\n }\r\n\r\n /**\r\n * Obtains the XR graphics binding for the current session, creating it lazily.\r\n * This is the API-agnostic seam used by WebGL and WebGPU XR features to share a binding.\r\n * @returns the XR graphics binding for the current session\r\n * @internal\r\n */\r\n public _getGraphicsBinding(): WebXRGraphicsBinding {\r\n if (!this._engine) {\r\n throw new Error(\"Cannot create the XR graphics binding: the engine has been disposed.\");\r\n }\r\n if (!this.session) {\r\n throw new Error(\"Cannot create the XR graphics binding before the XR session is initialized.\");\r\n }\r\n if (!this._graphicsBinding) {\r\n this._graphicsBinding = this._engine.isWebGPU\r\n ? WebXRWebGPUGraphicsBinding.CreateFromEngine(this.session, this._engine)\r\n : WebXRWebGLGraphicsBinding.CreateFromEngine(this.session, this._engine);\r\n }\r\n return this._graphicsBinding;\r\n }\r\n\r\n /**\r\n * Creates a WebXRRenderTarget object for the XR session\r\n * @param options optional options to provide when creating a new render target\r\n * @returns a WebXR render target to which the session can render\r\n */\r\n public getWebXRRenderTarget(options?: WebXRManagedOutputCanvasOptions): WebXRRenderTarget {\r\n const engine = this.scene.getEngine();\r\n if (this._xrNavigator.xr.native) {\r\n return new NativeXRRenderTarget(this);\r\n } else {\r\n options = options || WebXRManagedOutputCanvasOptions.GetDefaults(engine);\r\n options.canvasElement = options.canvasElement || engine.getRenderingCanvas() || undefined;\r\n return new WebXRManagedOutputCanvas(this, options);\r\n }\r\n }\r\n\r\n /**\r\n * Initializes the manager\r\n * After initialization enterXR can be called to start an XR session\r\n * @returns Promise which resolves after it is initialized\r\n */\r\n public async initializeAsync(): Promise<void> {\r\n // Check if the browser supports webXR\r\n this._xrNavigator = navigator;\r\n if (!this._xrNavigator.xr) {\r\n throw new Error(\"WebXR not supported on this browser.\");\r\n }\r\n }\r\n\r\n /**\r\n * Initializes an xr session\r\n * @param xrSessionMode mode to initialize\r\n * @param xrSessionInit defines optional and required values to pass to the session builder\r\n * @returns a promise which will resolve once the session has been initialized\r\n */\r\n public async initializeSessionAsync(xrSessionMode: XRSessionMode = \"immersive-vr\", xrSessionInit: XRSessionInit = {}): Promise<XRSession> {\r\n // A WebGPU engine requires a WebGPU-compatible XR session (per the WebXR/WebGPU binding spec).\r\n // The \"webgpu\" feature descriptor is requested as a *required* feature: a WebGPU engine cannot\r\n // fall back to a WebGL-compatible session, so if the UA/device cannot provide one we let\r\n // requestSession reject and surface that error to the caller rather than silently handing back\r\n // an incompatible session. WebGL engines leave xrSessionInit untouched.\r\n if (this._engine?.isWebGPU) {\r\n const requiredFeatures = xrSessionInit.requiredFeatures ? [...xrSessionInit.requiredFeatures] : [];\r\n if (!requiredFeatures.includes(\"webgpu\")) {\r\n requiredFeatures.push(\"webgpu\");\r\n }\r\n xrSessionInit = { ...xrSessionInit, requiredFeatures };\r\n }\r\n\r\n const session = await this._xrNavigator.xr.requestSession(xrSessionMode, xrSessionInit);\r\n\r\n this.session = session;\r\n this._sessionMode = xrSessionMode;\r\n this.inXRSession = true;\r\n this.onXRSessionInit.notifyObservers(session);\r\n\r\n // handle when the session is ended (By calling session.end or device ends its own session eg. pressing home button on phone)\r\n this.session.addEventListener(\r\n \"end\",\r\n () => {\r\n this.inXRSession = false;\r\n\r\n // Cache the value of engine in case it is disposed during onXRSessionEnded callbacks\r\n const engine = this._engine;\r\n\r\n // Notify frame observers\r\n this.onXRSessionEnded.notifyObservers(null);\r\n\r\n if (engine && !engine.isDisposed) {\r\n // make sure dimensions object is restored\r\n engine.framebufferDimensionsObject = null;\r\n\r\n // Restore frame buffer to avoid clear on xr framebuffer after session end\r\n engine.restoreDefaultFramebuffer();\r\n\r\n // Need to restart render loop as after the session is ended the last request for new frame will never call callback\r\n engine.customAnimationFrameRequester = null;\r\n engine._renderLoop();\r\n }\r\n\r\n // Dispose render target textures.\r\n // Only dispose on native because we can't destroy opaque textures on browser.\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerRTTProvider = null;\r\n this._baseLayerWrapper = null;\r\n this._graphicsBinding = null;\r\n },\r\n { once: true }\r\n );\r\n\r\n return this.session;\r\n }\r\n\r\n /**\r\n * Checks if a session would be supported for the creation options specified\r\n * @param sessionMode session mode to check if supported eg. immersive-vr\r\n * @returns A Promise that resolves to true if supported and false if not\r\n */\r\n public async isSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n return await WebXRSessionManager.IsSessionSupportedAsync(sessionMode);\r\n }\r\n\r\n /**\r\n * Resets the reference space to the one started the session\r\n */\r\n public resetReferenceSpace() {\r\n this.referenceSpace = this.baseReferenceSpace;\r\n }\r\n\r\n /**\r\n * Starts rendering to the xr layer\r\n */\r\n public runXRRenderLoop() {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n\r\n // Tell the engine's render loop to be driven by the xr session's refresh rate and provide xr pose information\r\n this._engine.customAnimationFrameRequester = {\r\n requestAnimationFrame: (callback: FrameRequestCallback) => this.session.requestAnimationFrame(callback),\r\n renderFunction: (timestamp: number, xrFrame: Nullable<XRFrame>) => {\r\n if (!this.inXRSession || !this._engine) {\r\n return;\r\n }\r\n // Store the XR frame and timestamp in the session manager\r\n this.currentFrame = xrFrame;\r\n this.currentTimestamp = timestamp;\r\n if (xrFrame) {\r\n this.inXRFrameLoop = true;\r\n const framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n // equality can be tested as it should be the same object\r\n if (this._engine.framebufferDimensionsObject !== framebufferDimensionsObject) {\r\n this._engine.framebufferDimensionsObject = framebufferDimensionsObject;\r\n }\r\n this.onXRFrameObservable.notifyObservers(xrFrame);\r\n this._engine._renderLoop();\r\n this._engine.framebufferDimensionsObject = null;\r\n this.inXRFrameLoop = false;\r\n }\r\n },\r\n };\r\n\r\n this._engine.framebufferDimensionsObject = this._baseLayerRTTProvider?.getFramebufferDimensions() || null;\r\n this.onXRFrameObservable.addOnce(() => {\r\n this.onXRReady.notifyObservers(this);\r\n });\r\n\r\n // Stop window's animation frame and trigger sessions animation frame\r\n if (typeof window !== \"undefined\" && window.cancelAnimationFrame) {\r\n window.cancelAnimationFrame(this._engine._frameHandler);\r\n }\r\n this._engine._renderLoop();\r\n }\r\n\r\n /**\r\n * Sets the reference space on the xr session\r\n * @param referenceSpaceType space to set\r\n * @returns a promise that will resolve once the reference space has been set\r\n */\r\n public async setReferenceSpaceTypeAsync(referenceSpaceType: XRReferenceSpaceType = \"local-floor\"): Promise<XRReferenceSpace> {\r\n let referenceSpace: XRReferenceSpace;\r\n let viewerReferenceSpace: Nullable<XRReferenceSpace> = null;\r\n try {\r\n referenceSpace = await this.session.requestReferenceSpace(referenceSpaceType);\r\n } catch (rejectionReason) {\r\n Logger.Error(\"XR.requestReferenceSpace failed for the following reason: \");\r\n Logger.Error(rejectionReason);\r\n Logger.Log('Defaulting to universally-supported \"viewer\" reference space type.');\r\n\r\n try {\r\n viewerReferenceSpace = (await this.session.requestReferenceSpace(\"viewer\")) as XRReferenceSpace;\r\n const heightCompensation = new XRRigidTransform({ x: 0, y: -this.defaultHeightCompensation, z: 0 });\r\n referenceSpace = viewerReferenceSpace.getOffsetReferenceSpace(heightCompensation);\r\n } catch (rejectionReason) {\r\n Logger.Error(rejectionReason);\r\n // eslint-disable-next-line no-throw-literal\r\n throw 'XR initialization failed: required \"viewer\" reference space type not supported.';\r\n }\r\n }\r\n // create viewer reference space before setting the first reference space\r\n this.viewerReferenceSpace = viewerReferenceSpace ?? ((await this.session.requestReferenceSpace(\"viewer\")) as XRReferenceSpace);\r\n // initialize the base and offset (currently the same)\r\n this.referenceSpace = this.baseReferenceSpace = referenceSpace;\r\n this.onXRReferenceSpaceInitialized.notifyObservers(referenceSpace);\r\n return this.referenceSpace;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session.\r\n * Note that this is deprecated in favor of WebXRSessionManager.updateRenderState().\r\n * @param state state to set\r\n * @returns a promise that resolves once the render state has been updated\r\n * @deprecated Use updateRenderState() instead.\r\n */\r\n public async updateRenderStateAsync(state: XRRenderState): Promise<void> {\r\n return await this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _setBaseLayerWrapper(baseLayerWrapper: Nullable<WebXRLayerWrapper>): void {\r\n if (this.isNative) {\r\n this._baseLayerRTTProvider?.dispose();\r\n }\r\n this._baseLayerWrapper = baseLayerWrapper;\r\n this._baseLayerRTTProvider = this._baseLayerWrapper?.createRenderTargetTextureProvider(this) || null;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _getBaseLayerWrapper(): Nullable<WebXRLayerWrapper> {\r\n return this._baseLayerWrapper;\r\n }\r\n\r\n /**\r\n * Updates the render state of the session\r\n * @param state state to set\r\n */\r\n public updateRenderState(state: XRRenderStateInit): void {\r\n if (state.baseLayer) {\r\n this._setBaseLayerWrapper(this.isNative ? new NativeXRLayerWrapper(state.baseLayer) : new WebXRWebGLLayerWrapper(state.baseLayer));\r\n }\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n this.session.updateRenderState(state);\r\n }\r\n\r\n /**\r\n * Returns a promise that resolves with a boolean indicating if the provided session mode is supported by this browser\r\n * @param sessionMode defines the session to test\r\n * @returns a promise with boolean as final value\r\n */\r\n public static async IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean> {\r\n if (!(navigator as any).xr) {\r\n return false;\r\n }\r\n // When the specs are final, remove supportsSession!\r\n const functionToUse = (navigator as any).xr.isSessionSupported || (navigator as any).xr.supportsSession;\r\n if (!functionToUse) {\r\n return false;\r\n } else {\r\n try {\r\n const result = functionToUse.call((navigator as any).xr, sessionMode);\r\n const returnValue = typeof result === \"undefined\" ? true : result;\r\n return returnValue;\r\n } catch (e: any) {\r\n Logger.Warn(e);\r\n return false;\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if Babylon.js is using the BabylonNative backend, otherwise false\r\n */\r\n public get isNative(): boolean {\r\n return this._xrNavigator.xr.native ?? false;\r\n }\r\n\r\n /**\r\n * The current frame rate as reported by the device\r\n */\r\n public get currentFrameRate(): number | undefined {\r\n return this.session?.frameRate;\r\n }\r\n\r\n /**\r\n * A list of supported frame rates (only available in-session!\r\n */\r\n public get supportedFrameRates(): Float32Array | undefined {\r\n return this.session?.supportedFrameRates;\r\n }\r\n\r\n /**\r\n * Set the framerate of the session.\r\n * @param rate the new framerate. This value needs to be in the supportedFrameRates array\r\n * @returns a promise that resolves once the framerate has been set\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n public async updateTargetFrameRate(rate: number): Promise<void> {\r\n return await this.session.updateTargetFrameRate(rate);\r\n }\r\n\r\n /**\r\n * Run a callback in the xr render loop\r\n * @param callback the callback to call when in XR Frame\r\n * @param ignoreIfNotInSession if no session is currently running, run it first thing on the next session\r\n */\r\n public runInXRFrame(callback: () => void, ignoreIfNotInSession = true): void {\r\n if (this.inXRFrameLoop) {\r\n callback();\r\n } else if (this.inXRSession || !ignoreIfNotInSession) {\r\n this.onXRFrameObservable.addOnce(callback);\r\n }\r\n }\r\n\r\n /**\r\n * Check if fixed foveation is supported on this device\r\n */\r\n public get isFixedFoveationSupported(): boolean {\r\n return this._baseLayerWrapper?.isFixedFoveationSupported || false;\r\n }\r\n\r\n /**\r\n * Get the fixed foveation currently set, as specified by the webxr specs\r\n * If this returns null, then fixed foveation is not supported\r\n */\r\n public get fixedFoveation(): Nullable<number> {\r\n return this._baseLayerWrapper?.fixedFoveation || null;\r\n }\r\n\r\n /**\r\n * Set the fixed foveation to the specified value, as specified by the webxr specs\r\n * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation\r\n */\r\n public set fixedFoveation(value: Nullable<number>) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n if (this._baseLayerWrapper) {\r\n this._baseLayerWrapper.fixedFoveation = val;\r\n }\r\n }\r\n\r\n /**\r\n * Get the features enabled on the current session\r\n * This is only available in-session!\r\n * @see https://www.w3.org/TR/webxr/#dom-xrsession-enabledfeatures\r\n */\r\n public get enabledFeatures(): Nullable<string[]> {\r\n return this.session?.enabledFeatures ?? null;\r\n }\r\n}\r\n"]}
@@ -1,7 +1,9 @@
1
1
  import { type RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.pure.js";
2
2
  import { type Nullable } from "../types.js";
3
3
  import { WebXRLayerRenderTargetTexture } from "./webXRLayerRenderTargetTexture.js";
4
+ import { type WebXRLayerWrapper } from "./webXRLayerWrapper.js";
4
5
  import { WebXRLayerRenderTargetTextureProvider } from "./webXRRenderTargetTextureProvider.js";
6
+ import { type WebXRSessionManager } from "./webXRSessionManager.js";
5
7
  /**
6
8
  * Provides render target textures for WebGPU-backed XR layers. Owns all WebGPU-specific texture wrapping
7
9
  * (via {@link WebGPUEngine.wrapWebGPUTexture} / {@link WebGPUEngine.updateWrappedWebGPUTexture}) so the base
@@ -10,6 +12,9 @@ import { WebXRLayerRenderTargetTextureProvider } from "./webXRRenderTargetTextur
10
12
  * @internal
11
13
  */
12
14
  export declare abstract class WebXRWebGPURenderTargetTextureProvider extends WebXRLayerRenderTargetTextureProvider {
15
+ protected readonly _xrSessionManager: WebXRSessionManager;
16
+ private readonly _transparentClearColor;
17
+ constructor(_xrSessionManager: WebXRSessionManager, layerWrapper: WebXRLayerWrapper);
13
18
  private get _webgpuEngine();
14
19
  private _wrapColorTexture;
15
20
  private _wrapDepthTexture;
@@ -47,11 +52,22 @@ export declare abstract class WebXRWebGPURenderTargetTextureProvider extends Web
47
52
  * `camera.isRightCamera`, so this observer clears both eyes' targets. WebGL providers never attach it,
48
53
  * so the WebGL path is unchanged.
49
54
  *
50
- * The observer mirrors the clear semantics of `Scene._clearFrameBuffer` (minus the right-eye skip): it
51
- * only clears when the scene has `autoClear` enabled, clears color at most once per frame (guarded by
52
- * `RenderTargetTexture._cleared`, which the scene resets per frame in `_checkCameraRenderTarget`), always
53
- * clears depth+stencil, and honors `skipInitialClear`. This keeps the "clear once per RTT per frame"
54
- * contract instead of clearing color on every notification.
55
+ * Color is cleared at most once per ENGINE FRAME, not once per `Scene.render`. The distinction matters:
56
+ * more than one scene can render the same XR camera within a single XR frame. `UtilityLayerRenderer`
57
+ * (used by controller pointer selection and near interaction) renders a second scene through the same
58
+ * rig cameras, and every `Scene.render` resets `RenderTargetTexture._cleared` for those cameras' targets
59
+ * (`Scene._checkCameraRenderTarget`), so a `_cleared`-based guard is defeated and each eye is re-cleared
60
+ * after it was drawn — presenting a clear-colored frame with the geometry gone. `AbstractEngine.frameId`
61
+ * only advances in `endFrame`, once per XR frame, so unlike `_cleared` it cannot be reset by another
62
+ * scene rendering the same camera.
63
+ *
64
+ * In immersive AR, color is cleared to transparent when `WebXRExperienceHelper` disables
65
+ * `Scene.autoClear`. WebGL XR framebuffers are cleared to transparent by the user agent, but WebGPU render
66
+ * passes require the application to request that clear explicitly. Skipping it leaves pixels from prior
67
+ * frames in passthrough regions, producing trails behind moving objects.
68
+ *
69
+ * Depth and stencil are still cleared on every notification, matching the previous behavior and the
70
+ * expectations of overlay scenes that draw on top of the main scene.
55
71
  * @param renderTargetTexture the per-eye render target to clear each frame
56
72
  */
57
73
  private _attachPerEyeClearObserver;