@onerjs/core 8.55.8 → 8.56.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/Animations/animation.pure.js +2 -2
  2. package/Animations/animation.pure.js.map +1 -1
  3. package/Animations/runtimeAnimation.js +4 -0
  4. package/Animations/runtimeAnimation.js.map +1 -1
  5. package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
  6. package/AudioV2/webAudio/webAudioEngine.js +6 -5
  7. package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
  8. package/Behaviors/Cameras/autoRotationBehavior.js +1 -1
  9. package/Behaviors/Cameras/autoRotationBehavior.js.map +1 -1
  10. package/Behaviors/Meshes/followBehavior.js +1 -0
  11. package/Behaviors/Meshes/followBehavior.js.map +1 -1
  12. package/Behaviors/Meshes/surfaceMagnetismBehavior.js +1 -0
  13. package/Behaviors/Meshes/surfaceMagnetismBehavior.js.map +1 -1
  14. package/Cameras/Inputs/followCameraMouseWheelInput.js +2 -2
  15. package/Cameras/Inputs/followCameraMouseWheelInput.js.map +1 -1
  16. package/Cameras/Inputs/followCameraPointersInput.d.ts +15 -0
  17. package/Cameras/Inputs/followCameraPointersInput.js +18 -3
  18. package/Cameras/Inputs/followCameraPointersInput.js.map +1 -1
  19. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js +1 -1
  20. package/Cameras/Stereoscopic/stereoscopicScreenUniversalCamera.js.map +1 -1
  21. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js +1 -1
  22. package/Cameras/Stereoscopic/stereoscopicUniversalCamera.pure.js.map +1 -1
  23. package/Cameras/arcRotateCamera.pure.js +1 -1
  24. package/Cameras/arcRotateCamera.pure.js.map +1 -1
  25. package/Collisions/gpuPicker.d.ts +1 -0
  26. package/Collisions/gpuPicker.js +5 -4
  27. package/Collisions/gpuPicker.js.map +1 -1
  28. package/Culling/Helper/boundingInfoHelper.js +9 -5
  29. package/Culling/Helper/boundingInfoHelper.js.map +1 -1
  30. package/Culling/boundingSphere.js +7 -4
  31. package/Culling/boundingSphere.js.map +1 -1
  32. package/Engines/AbstractEngine/abstractEngine.textureLoaders.d.ts +5 -1
  33. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js +7 -3
  34. package/Engines/AbstractEngine/abstractEngine.textureLoaders.js.map +1 -1
  35. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.d.ts +6 -0
  36. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js +16 -0
  37. package/Engines/AbstractEngine/abstractEngine.textureLoaders.pure.js.map +1 -0
  38. package/Engines/AbstractEngine/pure.d.ts +1 -0
  39. package/Engines/AbstractEngine/pure.js +1 -0
  40. package/Engines/AbstractEngine/pure.js.map +1 -1
  41. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js +1 -1
  42. package/Engines/Extensions/engine.prefilteredCubeTexture.pure.js.map +1 -1
  43. package/Engines/IDrawContext.d.ts +2 -0
  44. package/Engines/IDrawContext.js.map +1 -1
  45. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js +48 -6
  46. package/Engines/Native/Extensions/nativeEngine.cubeTexture.pure.js.map +1 -1
  47. package/Engines/Native/nativeInterfaces.d.ts +1 -1
  48. package/Engines/Native/nativeInterfaces.js.map +1 -1
  49. package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
  50. package/Engines/WebGPU/webgpuDrawContext.js +15 -0
  51. package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
  52. package/Engines/abstractEngine.pure.js +2 -2
  53. package/Engines/abstractEngine.pure.js.map +1 -1
  54. package/Engines/engine.d.ts +21 -4
  55. package/Engines/thinNativeEngine.pure.d.ts +6 -1
  56. package/Engines/thinNativeEngine.pure.js +29 -2
  57. package/Engines/thinNativeEngine.pure.js.map +1 -1
  58. package/Engines/webgpuEngine.d.ts +1 -0
  59. package/Engines/webgpuEngine.js +1 -0
  60. package/Engines/webgpuEngine.js.map +1 -1
  61. package/Engines/webgpuEngine.pure.d.ts +10 -0
  62. package/Engines/webgpuEngine.pure.js +15 -1
  63. package/Engines/webgpuEngine.pure.js.map +1 -1
  64. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.d.ts +3 -63
  65. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js +5 -71
  66. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.js.map +1 -1
  67. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.d.ts +71 -0
  68. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js +86 -0
  69. package/FlowGraph/Blocks/Data/flowGraphIsKeyPressedBlock.pure.js.map +1 -0
  70. package/FlowGraph/Blocks/Data/pure.d.ts +1 -0
  71. package/FlowGraph/Blocks/Data/pure.js +1 -0
  72. package/FlowGraph/Blocks/Data/pure.js.map +1 -1
  73. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.d.ts +3 -37
  74. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js +5 -39
  75. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.js.map +1 -1
  76. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.d.ts +45 -0
  77. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js +54 -0
  78. package/FlowGraph/Blocks/Event/flowGraphKeyDownEventBlock.pure.js.map +1 -0
  79. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.d.ts +3 -17
  80. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js +5 -22
  81. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.js.map +1 -1
  82. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.d.ts +25 -0
  83. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js +37 -0
  84. package/FlowGraph/Blocks/Event/flowGraphKeyUpEventBlock.pure.js.map +1 -0
  85. package/FlowGraph/Blocks/Event/pure.d.ts +2 -0
  86. package/FlowGraph/Blocks/Event/pure.js +2 -0
  87. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  88. package/FlowGraph/Blocks/flowGraphBlockFactory.d.ts +1 -1
  89. package/FlowGraph/Blocks/flowGraphBlockFactory.js +198 -172
  90. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  91. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +2 -5
  92. package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
  93. package/FrameGraph/frameGraph.js +10 -1
  94. package/FrameGraph/frameGraph.js.map +1 -1
  95. package/Gamepads/gamepadManager.d.ts +1 -0
  96. package/Gamepads/gamepadManager.js +5 -2
  97. package/Gamepads/gamepadManager.js.map +1 -1
  98. package/Gizmos/scaleGizmo.js +1 -0
  99. package/Gizmos/scaleGizmo.js.map +1 -1
  100. package/Lights/IES/iesLoader.js +6 -8
  101. package/Lights/IES/iesLoader.js.map +1 -1
  102. package/Lights/Shadows/cascadedShadowGenerator.pure.js +4 -6
  103. package/Lights/Shadows/cascadedShadowGenerator.pure.js.map +1 -1
  104. package/Lights/Shadows/shadowGenerator.js +2 -2
  105. package/Lights/Shadows/shadowGenerator.js.map +1 -1
  106. package/Lights/light.js +3 -5
  107. package/Lights/light.js.map +1 -1
  108. package/Lights/spotLight.pure.js +1 -1
  109. package/Lights/spotLight.pure.js.map +1 -1
  110. package/Materials/Background/backgroundMaterial.pure.d.ts +1 -1
  111. package/Materials/Background/backgroundMaterial.pure.js +3 -12
  112. package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
  113. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +2 -0
  114. package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
  115. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js +1 -1
  116. package/Materials/Node/Blocks/Fragment/TBNBlock.pure.js.map +1 -1
  117. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js +2 -0
  118. package/Materials/Node/Blocks/Fragment/imageProcessingBlock.pure.js.map +1 -1
  119. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js +1 -0
  120. package/Materials/Node/Blocks/PBR/pbrMetallicRoughnessBlock.pure.js.map +1 -1
  121. package/Materials/Node/Blocks/powBlock.pure.js +2 -1
  122. package/Materials/Node/Blocks/powBlock.pure.js.map +1 -1
  123. package/Materials/Node/Blocks/triPlanarBlock.pure.js +14 -12
  124. package/Materials/Node/Blocks/triPlanarBlock.pure.js.map +1 -1
  125. package/Materials/Node/nodeMaterial.pure.d.ts +1 -0
  126. package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
  127. package/Materials/PBR/openpbrMaterial.pure.d.ts +2 -1
  128. package/Materials/PBR/openpbrMaterial.pure.js +3 -12
  129. package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
  130. package/Materials/PBR/pbrBaseMaterial.pure.d.ts +2 -1
  131. package/Materials/PBR/pbrBaseMaterial.pure.js +3 -12
  132. package/Materials/PBR/pbrBaseMaterial.pure.js.map +1 -1
  133. package/Materials/Textures/index.d.ts +1 -0
  134. package/Materials/Textures/index.js +1 -0
  135. package/Materials/Textures/index.js.map +1 -1
  136. package/Materials/Textures/renderTargetTexture.pure.js +1 -1
  137. package/Materials/Textures/renderTargetTexture.pure.js.map +1 -1
  138. package/Materials/drawWrapper.js +3 -0
  139. package/Materials/drawWrapper.js.map +1 -1
  140. package/Materials/imageProcessingConfiguration.defines.d.ts +3 -0
  141. package/Materials/imageProcessingConfiguration.defines.js +2 -0
  142. package/Materials/imageProcessingConfiguration.defines.js.map +1 -1
  143. package/Materials/imageProcessingConfiguration.functions.js +3 -0
  144. package/Materials/imageProcessingConfiguration.functions.js.map +1 -1
  145. package/Materials/imageProcessingConfiguration.pure.d.ts +58 -0
  146. package/Materials/imageProcessingConfiguration.pure.js +123 -2
  147. package/Materials/imageProcessingConfiguration.pure.js.map +1 -1
  148. package/Materials/material.pure.js +2 -2
  149. package/Materials/material.pure.js.map +1 -1
  150. package/Materials/standardMaterial.pure.d.ts +2 -1
  151. package/Materials/standardMaterial.pure.js +4 -13
  152. package/Materials/standardMaterial.pure.js.map +1 -1
  153. package/Materials/uniformBuffer.d.ts +29 -0
  154. package/Materials/uniformBuffer.js +146 -0
  155. package/Materials/uniformBuffer.js.map +1 -1
  156. package/Maths/colorTemperature.functions.d.ts +29 -0
  157. package/Maths/colorTemperature.functions.js +196 -0
  158. package/Maths/colorTemperature.functions.js.map +1 -0
  159. package/Maths/index.d.ts +1 -0
  160. package/Maths/index.js +1 -0
  161. package/Maths/index.js.map +1 -1
  162. package/Maths/math.path.js +1 -1
  163. package/Maths/math.path.js.map +1 -1
  164. package/Maths/math.polar.js +1 -1
  165. package/Maths/math.polar.js.map +1 -1
  166. package/Maths/math.vector.pure.js +4 -3
  167. package/Maths/math.vector.pure.js.map +1 -1
  168. package/Maths/pure.d.ts +1 -0
  169. package/Maths/pure.js +1 -0
  170. package/Maths/pure.js.map +1 -1
  171. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +72 -0
  172. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +164 -1
  173. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  174. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +2 -1
  175. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +36 -18
  176. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  177. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +5 -4
  178. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +25 -8
  179. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  180. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +3 -3
  181. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  182. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js +1 -1
  183. package/Meshes/Node/Blocks/Instances/instantiateOnVolumeBlock.pure.js.map +1 -1
  184. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js +2 -2
  185. package/Meshes/Node/Blocks/geometryOptimizeBlock.pure.js.map +1 -1
  186. package/Meshes/Node/Blocks/mappingBlock.pure.js +2 -2
  187. package/Meshes/Node/Blocks/mappingBlock.pure.js.map +1 -1
  188. package/Meshes/csg.js +5 -5
  189. package/Meshes/csg.js.map +1 -1
  190. package/Meshes/groundMesh.pure.js +1 -1
  191. package/Meshes/groundMesh.pure.js.map +1 -1
  192. package/Meshes/mesh.pure.js +2 -2
  193. package/Meshes/mesh.pure.js.map +1 -1
  194. package/Misc/deepMerger.js +1 -1
  195. package/Misc/deepMerger.js.map +1 -1
  196. package/Misc/dumpTools.pure.js +1 -1
  197. package/Misc/dumpTools.pure.js.map +1 -1
  198. package/Misc/index.d.ts +1 -0
  199. package/Misc/index.js +1 -0
  200. package/Misc/index.js.map +1 -1
  201. package/Misc/observable.pure.js +1 -3
  202. package/Misc/observable.pure.js.map +1 -1
  203. package/Misc/pure.d.ts +1 -0
  204. package/Misc/pure.js +1 -0
  205. package/Misc/pure.js.map +1 -1
  206. package/Misc/shaderImportLoader.d.ts +25 -0
  207. package/Misc/shaderImportLoader.js +54 -0
  208. package/Misc/shaderImportLoader.js.map +1 -0
  209. package/Misc/tools.pure.js +1 -1
  210. package/Misc/tools.pure.js.map +1 -1
  211. package/Particles/Node/Blocks/particleClampBlock.pure.d.ts +0 -1
  212. package/Particles/Node/Blocks/particleClampBlock.pure.js +1 -6
  213. package/Particles/Node/Blocks/particleClampBlock.pure.js.map +1 -1
  214. package/Particles/Node/Blocks/particleMathBlock.pure.js +1 -1
  215. package/Particles/Node/Blocks/particleMathBlock.pure.js.map +1 -1
  216. package/Particles/Node/Blocks/particleNLerpBlock.pure.js +8 -3
  217. package/Particles/Node/Blocks/particleNLerpBlock.pure.js.map +1 -1
  218. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js +3 -2
  219. package/Particles/Node/Blocks/particleSmoothStepBlock.pure.js.map +1 -1
  220. package/Particles/Node/Blocks/particleStepBlock.pure.js +3 -2
  221. package/Particles/Node/Blocks/particleStepBlock.pure.js.map +1 -1
  222. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js +1 -1
  223. package/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.pure.js.map +1 -1
  224. package/PostProcesses/depthOfFieldEffect.js +1 -1
  225. package/PostProcesses/depthOfFieldEffect.js.map +1 -1
  226. package/PostProcesses/imageProcessingPostProcess.d.ts +41 -1
  227. package/PostProcesses/imageProcessingPostProcess.js +41 -1
  228. package/PostProcesses/imageProcessingPostProcess.js.map +1 -1
  229. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js +1 -1
  230. package/PostProcesses/screenSpaceCurvaturePostProcess.pure.js.map +1 -1
  231. package/PostProcesses/sharpenPostProcess.pure.js +1 -1
  232. package/PostProcesses/sharpenPostProcess.pure.js.map +1 -1
  233. package/PostProcesses/thinImageProcessingPostProcess.d.ts +50 -0
  234. package/PostProcesses/thinImageProcessingPostProcess.js +65 -0
  235. package/PostProcesses/thinImageProcessingPostProcess.js.map +1 -1
  236. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.d.ts +12 -0
  237. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js +22 -0
  238. package/Rendering/IBLShadows/iblShadowsMaterialCompatibility.pure.js.map +1 -0
  239. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.d.ts +1 -0
  240. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js +39 -0
  241. package/Rendering/IBLShadows/iblShadowsPluginMaterial.pure.js.map +1 -1
  242. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.d.ts +12 -0
  243. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +17 -5
  244. package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
  245. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +14 -0
  246. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +122 -6
  247. package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
  248. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.d.ts +7 -0
  249. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js +17 -0
  250. package/Rendering/IBLShadows/iblShadowsVoxelTracingPass.js.map +1 -1
  251. package/Rendering/IBLShadows/pure.d.ts +1 -0
  252. package/Rendering/IBLShadows/pure.js +1 -0
  253. package/Rendering/IBLShadows/pure.js.map +1 -1
  254. package/Rendering/boundingBoxRenderer.pure.js +3 -3
  255. package/Rendering/boundingBoxRenderer.pure.js.map +1 -1
  256. package/Rendering/fluidRenderer/fluidRenderingObject.d.ts +11 -0
  257. package/Rendering/fluidRenderer/fluidRenderingObject.js +36 -14
  258. package/Rendering/fluidRenderer/fluidRenderingObject.js.map +1 -1
  259. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.d.ts +5 -0
  260. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js +16 -3
  261. package/Rendering/fluidRenderer/fluidRenderingObjectCustomParticles.js.map +1 -1
  262. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.d.ts +5 -0
  263. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js +12 -0
  264. package/Rendering/fluidRenderer/fluidRenderingObjectParticleSystem.js.map +1 -1
  265. package/Rendering/iblCdfGenerator.js +10 -1
  266. package/Rendering/iblCdfGenerator.js.map +1 -1
  267. package/Rendering/outlineRenderer.pure.js +1 -0
  268. package/Rendering/outlineRenderer.pure.js.map +1 -1
  269. package/Rendering/subSurfaceConfiguration.js +1 -1
  270. package/Rendering/subSurfaceConfiguration.js.map +1 -1
  271. package/Rendering/subSurfaceSceneComponent.pure.d.ts +1 -1
  272. package/Rendering/subSurfaceSceneComponent.pure.js +1 -1
  273. package/Rendering/subSurfaceSceneComponent.pure.js.map +1 -1
  274. package/Rendering/utilityLayerRenderer.js +1 -1
  275. package/Rendering/utilityLayerRenderer.js.map +1 -1
  276. package/Shaders/ShadersInclude/hdrFilteringFunctions.js +1 -1
  277. package/Shaders/ShadersInclude/hdrFilteringFunctions.js.map +1 -1
  278. package/Shaders/ShadersInclude/helperFunctions.js +2 -2
  279. package/Shaders/ShadersInclude/helperFunctions.js.map +1 -1
  280. package/Shaders/ShadersInclude/imageProcessingDeclaration.js +3 -0
  281. package/Shaders/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  282. package/Shaders/ShadersInclude/imageProcessingFunctions.js +3 -0
  283. package/Shaders/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  284. package/Shaders/ShadersInclude/openpbrDirectLighting.js +34 -4
  285. package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  286. package/Shaders/ShadersInclude/openpbrIblFunctions.js +8 -2
  287. package/Shaders/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  288. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  289. package/Shaders/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  290. package/Shaders/fluidRenderingParticleDepth.vertex.js +7 -1
  291. package/Shaders/fluidRenderingParticleDepth.vertex.js.map +1 -1
  292. package/Shaders/fluidRenderingParticleDiffuse.vertex.js +7 -1
  293. package/Shaders/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  294. package/Shaders/fluidRenderingParticleThickness.vertex.js +7 -1
  295. package/Shaders/fluidRenderingParticleThickness.vertex.js.map +1 -1
  296. package/Shaders/gaussianSplattingVoxel.fragment.js +4 -10
  297. package/Shaders/gaussianSplattingVoxel.fragment.js.map +1 -1
  298. package/Shaders/iblCombineVoxelGrids.fragment.js +1 -1
  299. package/Shaders/iblCombineVoxelGrids.fragment.js.map +1 -1
  300. package/Shaders/iblShadowVoxelTracing.fragment.js +24 -7
  301. package/Shaders/iblShadowVoxelTracing.fragment.js.map +1 -1
  302. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.d.ts +5 -0
  303. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js +13 -0
  304. package/ShadersWGSL/ShadersInclude/iblVoxelOpacityAtomicMax.js.map +1 -0
  305. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js +3 -0
  306. package/ShadersWGSL/ShadersInclude/imageProcessingDeclaration.js.map +1 -1
  307. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js +3 -0
  308. package/ShadersWGSL/ShadersInclude/imageProcessingFunctions.js.map +1 -1
  309. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +35 -5
  310. package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
  311. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js +1 -1
  312. package/ShadersWGSL/ShadersInclude/openpbrDirectLightingInit.js.map +1 -1
  313. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +8 -2
  314. package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
  315. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js +5 -0
  316. package/ShadersWGSL/ShadersInclude/pbrDirectLightingFunctions.js.map +1 -1
  317. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js +16 -4
  318. package/ShadersWGSL/fluidRenderingParticleDepth.vertex.js.map +1 -1
  319. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js +15 -3
  320. package/ShadersWGSL/fluidRenderingParticleDiffuse.vertex.js.map +1 -1
  321. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js +15 -3
  322. package/ShadersWGSL/fluidRenderingParticleThickness.vertex.js.map +1 -1
  323. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js +15 -9
  324. package/ShadersWGSL/gaussianSplattingVoxel.fragment.js.map +1 -1
  325. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js +1 -1
  326. package/ShadersWGSL/iblCombineVoxelGrids.fragment.js.map +1 -1
  327. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.d.ts +5 -0
  328. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js +14 -0
  329. package/ShadersWGSL/iblCopyVoxelBufferToGrid.compute.js.map +1 -0
  330. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js +24 -7
  331. package/ShadersWGSL/iblShadowVoxelTracing.fragment.js.map +1 -1
  332. package/ShadersWGSL/iblVoxelGrid.fragment.js +26 -6
  333. package/ShadersWGSL/iblVoxelGrid.fragment.js.map +1 -1
  334. package/SmartAssets/smartAssetManager.pure.js +1 -1
  335. package/SmartAssets/smartAssetManager.pure.js.map +1 -1
  336. package/Sprites/thinSprite.js +1 -1
  337. package/Sprites/thinSprite.js.map +1 -1
  338. package/XR/features/Layers/WebXRCompositionLayer.d.ts +182 -12
  339. package/XR/features/Layers/WebXRCompositionLayer.js +272 -3
  340. package/XR/features/Layers/WebXRCompositionLayer.js.map +1 -1
  341. package/XR/features/Layers/WebXRFallbackLayer.d.ts +84 -0
  342. package/XR/features/Layers/WebXRFallbackLayer.js +137 -0
  343. package/XR/features/Layers/WebXRFallbackLayer.js.map +1 -0
  344. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +4 -4
  345. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  346. package/XR/features/WebXRAnchorSystem.pure.d.ts +45 -0
  347. package/XR/features/WebXRAnchorSystem.pure.js +153 -13
  348. package/XR/features/WebXRAnchorSystem.pure.js.map +1 -1
  349. package/XR/features/WebXRControllerPointerSelection.pure.js +2 -1
  350. package/XR/features/WebXRControllerPointerSelection.pure.js.map +1 -1
  351. package/XR/features/WebXRControllerTeleportation.pure.js +2 -1
  352. package/XR/features/WebXRControllerTeleportation.pure.js.map +1 -1
  353. package/XR/features/WebXRDepthSensing.pure.d.ts +21 -0
  354. package/XR/features/WebXRDepthSensing.pure.js +42 -0
  355. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  356. package/XR/features/WebXRHandTracking.pure.js +2 -0
  357. package/XR/features/WebXRHandTracking.pure.js.map +1 -1
  358. package/XR/features/WebXRLayers.pure.d.ts +183 -8
  359. package/XR/features/WebXRLayers.pure.js +531 -99
  360. package/XR/features/WebXRLayers.pure.js.map +1 -1
  361. package/XR/features/WebXRLayersFallback.d.ts +5 -0
  362. package/XR/features/WebXRLayersFallback.js +8 -0
  363. package/XR/features/WebXRLayersFallback.js.map +1 -0
  364. package/XR/features/WebXRLayersFallback.pure.d.ts +6 -0
  365. package/XR/features/WebXRLayersFallback.pure.js +44 -0
  366. package/XR/features/WebXRLayersFallback.pure.js.map +1 -0
  367. package/XR/features/WebXRLightEstimation.pure.d.ts +3 -4
  368. package/XR/features/WebXRLightEstimation.pure.js +22 -21
  369. package/XR/features/WebXRLightEstimation.pure.js.map +1 -1
  370. package/XR/features/WebXRMeshDetector.pure.d.ts +5 -0
  371. package/XR/features/WebXRMeshDetector.pure.js +1 -0
  372. package/XR/features/WebXRMeshDetector.pure.js.map +1 -1
  373. package/XR/features/WebXRNearInteraction.pure.js +3 -3
  374. package/XR/features/WebXRNearInteraction.pure.js.map +1 -1
  375. package/XR/features/WebXRPlaneDetector.pure.d.ts +9 -5
  376. package/XR/features/WebXRPlaneDetector.pure.js +12 -8
  377. package/XR/features/WebXRPlaneDetector.pure.js.map +1 -1
  378. package/XR/features/WebXRTrackedSources.d.ts +5 -0
  379. package/XR/features/WebXRTrackedSources.js +8 -0
  380. package/XR/features/WebXRTrackedSources.js.map +1 -0
  381. package/XR/features/WebXRTrackedSources.pure.d.ts +70 -0
  382. package/XR/features/WebXRTrackedSources.pure.js +153 -0
  383. package/XR/features/WebXRTrackedSources.pure.js.map +1 -0
  384. package/XR/features/index.d.ts +1 -0
  385. package/XR/features/index.js +1 -0
  386. package/XR/features/index.js.map +1 -1
  387. package/XR/features/pure.d.ts +2 -0
  388. package/XR/features/pure.js +2 -0
  389. package/XR/features/pure.js.map +1 -1
  390. package/XR/motionController/webXRAbstractMotionController.d.ts +53 -1
  391. package/XR/motionController/webXRAbstractMotionController.js +61 -0
  392. package/XR/motionController/webXRAbstractMotionController.js.map +1 -1
  393. package/XR/webXRCamera.d.ts +2 -0
  394. package/XR/webXRCamera.js +8 -2
  395. package/XR/webXRCamera.js.map +1 -1
  396. package/XR/webXRDefaultExperience.js +8 -4
  397. package/XR/webXRDefaultExperience.js.map +1 -1
  398. package/XR/webXRExperienceHelper.js +86 -44
  399. package/XR/webXRExperienceHelper.js.map +1 -1
  400. package/XR/webXRFeaturesManager.d.ts +9 -0
  401. package/XR/webXRFeaturesManager.js +4 -0
  402. package/XR/webXRFeaturesManager.js.map +1 -1
  403. package/XR/webXRGraphicsBinding.d.ts +29 -0
  404. package/XR/webXRGraphicsBinding.js +40 -0
  405. package/XR/webXRGraphicsBinding.js.map +1 -1
  406. package/XR/webXRInputSource.js +1 -1
  407. package/XR/webXRInputSource.js.map +1 -1
  408. package/XR/webXRLayerWrapper.d.ts +26 -10
  409. package/XR/webXRLayerWrapper.js +19 -7
  410. package/XR/webXRLayerWrapper.js.map +1 -1
  411. package/XR/webXRRenderTargetTextureProvider.d.ts +4 -4
  412. package/XR/webXRRenderTargetTextureProvider.js.map +1 -1
  413. package/XR/webXRSessionManager.d.ts +45 -0
  414. package/XR/webXRSessionManager.js +174 -29
  415. package/XR/webXRSessionManager.js.map +1 -1
  416. package/XR/webXRWebGLRenderTargetTextureProvider.d.ts +2 -1
  417. package/XR/webXRWebGLRenderTargetTextureProvider.js.map +1 -1
  418. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +3 -3
  419. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  420. package/package.json +1 -1
  421. package/scene.pure.d.ts +5 -0
  422. package/scene.pure.js +25 -0
  423. package/scene.pure.js.map +1 -1
@@ -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AY,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;gBAC9F,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;gBAC9F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;oBACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC1C,CAAC;YACL,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { type Ray } from \"../Culling/ray\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type WebXRAbstractMotionController } from \"./motionController/webXRAbstractMotionController\";\r\nimport { WebXRMotionControllerManager } from \"./motionController/webXRMotionControllerManager.pure\";\r\nimport { Tools } from \"../Misc/tools.pure\";\r\nimport { type WebXRCamera } from \"./webXRCamera\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Mesh } from \"../Meshes/mesh.pure\";\r\n\r\nlet IdCount = 0;\r\n\r\n/**\r\n * Configuration options for the WebXR controller creation\r\n */\r\nexport interface IWebXRControllerOptions {\r\n /**\r\n * Should the controller mesh be animated when a user interacts with it\r\n * The pressed buttons / thumbstick and touchpad animations will be disabled\r\n */\r\n disableMotionControllerAnimation?: boolean;\r\n /**\r\n * Do not load the controller mesh, in case a different mesh needs to be loaded.\r\n */\r\n doNotLoadControllerMesh?: boolean;\r\n /**\r\n * Force a specific controller type for this controller.\r\n * This can be used when creating your own profile or when testing different controllers\r\n */\r\n forceControllerProfile?: string;\r\n /**\r\n * Defines a rendering group ID for meshes that will be loaded.\r\n * This is for the default controllers only.\r\n */\r\n renderingGroupId?: number;\r\n}\r\n\r\n/**\r\n * Represents an XR controller\r\n */\r\nexport class WebXRInputSource {\r\n private _tmpVector = new Vector3();\r\n private _uniqueId: string;\r\n private _disposed = false;\r\n\r\n /**\r\n * Represents the part of the controller that is held. This may not exist if the controller is the head mounted display itself, if that's the case only the pointer from the head will be available\r\n */\r\n public grip?: AbstractMesh;\r\n /**\r\n * If available, this is the gamepad object related to this controller.\r\n * Using this object it is possible to get click events and trackpad changes of the\r\n * webxr controller that is currently being used.\r\n */\r\n public motionController?: WebXRAbstractMotionController;\r\n /**\r\n * Event that fires when the controller is removed/disposed.\r\n * The object provided as event data is this controller, after associated assets were disposed.\r\n * uniqueId is still available.\r\n */\r\n public onDisposeObservable = new Observable<WebXRInputSource>();\r\n /**\r\n * Will be triggered when the mesh associated with the motion controller is done loading.\r\n * It is also possible that this will never trigger (!) if no mesh was loaded, or if the developer decides to load a different mesh\r\n * A shortened version of controller -> motion controller -> on mesh loaded.\r\n */\r\n public onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n /**\r\n * Observers registered here will trigger when a motion controller profile was assigned to this xr controller\r\n */\r\n public onMotionControllerInitObservable = new Observable<WebXRAbstractMotionController>();\r\n /**\r\n * Pointer which can be used to select objects or attach a visible laser to\r\n */\r\n public pointer: AbstractMesh;\r\n\r\n /**\r\n * The last XRPose the was calculated on the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRPose?: XRPose;\r\n\r\n /**\r\n * Creates the input source object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRInputControllerSupport\r\n * @param _scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param _options options for this controller creation\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n /** The underlying input source for the controller */\r\n public inputSource: XRInputSource,\r\n private _options: IWebXRControllerOptions = {}\r\n ) {\r\n this._uniqueId = `controller-${IdCount++}-${inputSource.targetRayMode}-${inputSource.handedness}`;\r\n\r\n this.pointer = new Mesh(`${this._uniqueId}-pointer`, _scene);\r\n this.pointer.rotationQuaternion = new Quaternion();\r\n\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new Mesh(`${this._uniqueId}-grip`, this._scene);\r\n this.grip.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n this._tmpVector.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n\r\n // for now only load motion controllers if gamepad object available\r\n if (this.inputSource.gamepad && this.inputSource.targetRayMode === \"tracked-pointer\") {\r\n // eslint-disable-next-line github/no-then\r\n WebXRMotionControllerManager.GetMotionControllerWithXRInput(inputSource, _scene, this._options.forceControllerProfile).then(\r\n (motionController) => {\r\n this.motionController = motionController;\r\n this.onMotionControllerInitObservable.notifyObservers(motionController);\r\n // should the model be loaded?\r\n if (!this._options.doNotLoadControllerMesh && !this.motionController._doNotLoadControllerMesh) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n this.motionController.loadModel().then((success) => {\r\n if (success && this.motionController && this.motionController.rootMesh) {\r\n if (this._options.renderingGroupId) {\r\n // anything other than 0?\r\n this.motionController.rootMesh.renderingGroupId = this._options.renderingGroupId;\r\n const childMeshes = this.motionController.rootMesh.getChildMeshes(false);\r\n for (const mesh of childMeshes) {\r\n mesh.renderingGroupId = this._options.renderingGroupId!;\r\n }\r\n }\r\n this.onMeshLoadedObservable.notifyObservers(this.motionController.rootMesh);\r\n this.motionController.rootMesh.parent = this.grip || this.pointer;\r\n this.motionController.disableAnimation = !!this._options.disableMotionControllerAnimation;\r\n }\r\n // make sure to dispose is the controller is already disposed\r\n if (this._disposed) {\r\n this.motionController?.dispose();\r\n }\r\n });\r\n }\r\n },\r\n () => {\r\n Tools.Warn(`Could not find a matching motion controller for the registered input source`);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get this controllers unique id\r\n */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Disposes of the object\r\n */\r\n public dispose() {\r\n if (this.grip) {\r\n this.grip.dispose(true);\r\n }\r\n if (this.motionController) {\r\n this.motionController.dispose();\r\n }\r\n this.pointer.dispose(true);\r\n this.onMotionControllerInitObservable.clear();\r\n this.onMeshLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Gets a world space ray coming from the pointer or grip\r\n * @param result the resulting ray\r\n * @param gripIfAvailable use the grip mesh instead of the pointer, if available\r\n */\r\n public getWorldPointerRayToRef(result: Ray, gripIfAvailable: boolean = false) {\r\n const object = gripIfAvailable && this.grip ? this.grip : this.pointer;\r\n Vector3.TransformNormalToRef(this._tmpVector, object.getWorldMatrix(), result.direction);\r\n result.direction.normalize();\r\n result.origin.copyFrom(object.absolutePosition);\r\n result.length = 1000;\r\n }\r\n\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n * @param xrCamera the xr camera, used for parenting\r\n * @param xrSessionManager the session manager used to get the world reference system\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame, referenceSpace: XRReferenceSpace, xrCamera: WebXRCamera, xrSessionManager: WebXRSessionManager) {\r\n const pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n this._lastXRPose = pose;\r\n\r\n // Update the pointer mesh\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n this.pointer.position.set(pos.x, pos.y, pos.z).scaleInPlace(xrSessionManager.worldScalingFactor);\r\n const orientation = pose.transform.orientation;\r\n this.pointer.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.pointer.position.z *= -1;\r\n this.pointer.rotationQuaternion!.z *= -1;\r\n this.pointer.rotationQuaternion!.w *= -1;\r\n }\r\n this.pointer.parent = xrCamera.parent;\r\n this.pointer.scaling.setAll(xrSessionManager.worldScalingFactor);\r\n }\r\n\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n const pose = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n const orientation = pose.transform.orientation;\r\n this.grip.position.set(pos.x, pos.y, pos.z).scaleInPlace(xrSessionManager.worldScalingFactor);\r\n this.grip.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.grip.position.z *= -1;\r\n this.grip.rotationQuaternion!.z *= -1;\r\n this.grip.rotationQuaternion!.w *= -1;\r\n }\r\n }\r\n this.grip.parent = xrCamera.parent;\r\n this.grip.scaling.setAll(xrSessionManager.worldScalingFactor);\r\n }\r\n if (this.motionController) {\r\n // either update buttons only or also position, if in gamepad mode\r\n this.motionController.updateFromXRFrame(xrFrame);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRInputSource.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRInputSource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAIhE,OAAO,EAAE,4BAA4B,EAAE,MAA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BAC9F,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAC;oBACpC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC3B,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtC,IAAI,CAAC,IAAI,CAAC,kBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;gBAC1C,CAAC;YACL,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACxB,kEAAkE;YAClE,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACrD,CAAC;IACL,CAAC;CACJ","sourcesContent":["import { Observable } from \"../Misc/observable\";\r\nimport { type AbstractMesh } from \"../Meshes/abstractMesh\";\r\nimport { Quaternion, Vector3 } from \"../Maths/math.vector.pure\";\r\nimport { type Ray } from \"../Culling/ray\";\r\nimport { type Scene } from \"../scene\";\r\nimport { type WebXRAbstractMotionController } from \"./motionController/webXRAbstractMotionController\";\r\nimport { WebXRMotionControllerManager } from \"./motionController/webXRMotionControllerManager.pure\";\r\nimport { Tools } from \"../Misc/tools.pure\";\r\nimport { type WebXRCamera } from \"./webXRCamera\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\nimport { Mesh } from \"../Meshes/mesh.pure\";\r\n\r\nlet IdCount = 0;\r\n\r\n/**\r\n * Configuration options for the WebXR controller creation\r\n */\r\nexport interface IWebXRControllerOptions {\r\n /**\r\n * Should the controller mesh be animated when a user interacts with it\r\n * The pressed buttons / thumbstick and touchpad animations will be disabled\r\n */\r\n disableMotionControllerAnimation?: boolean;\r\n /**\r\n * Do not load the controller mesh, in case a different mesh needs to be loaded.\r\n */\r\n doNotLoadControllerMesh?: boolean;\r\n /**\r\n * Force a specific controller type for this controller.\r\n * This can be used when creating your own profile or when testing different controllers\r\n */\r\n forceControllerProfile?: string;\r\n /**\r\n * Defines a rendering group ID for meshes that will be loaded.\r\n * This is for the default controllers only.\r\n */\r\n renderingGroupId?: number;\r\n}\r\n\r\n/**\r\n * Represents an XR controller\r\n */\r\nexport class WebXRInputSource {\r\n private _tmpVector = new Vector3();\r\n private _uniqueId: string;\r\n private _disposed = false;\r\n\r\n /**\r\n * Represents the part of the controller that is held. This may not exist if the controller is the head mounted display itself, if that's the case only the pointer from the head will be available\r\n */\r\n public grip?: AbstractMesh;\r\n /**\r\n * If available, this is the gamepad object related to this controller.\r\n * Using this object it is possible to get click events and trackpad changes of the\r\n * webxr controller that is currently being used.\r\n */\r\n public motionController?: WebXRAbstractMotionController;\r\n /**\r\n * Event that fires when the controller is removed/disposed.\r\n * The object provided as event data is this controller, after associated assets were disposed.\r\n * uniqueId is still available.\r\n */\r\n public onDisposeObservable = new Observable<WebXRInputSource>();\r\n /**\r\n * Will be triggered when the mesh associated with the motion controller is done loading.\r\n * It is also possible that this will never trigger (!) if no mesh was loaded, or if the developer decides to load a different mesh\r\n * A shortened version of controller -> motion controller -> on mesh loaded.\r\n */\r\n public onMeshLoadedObservable = new Observable<AbstractMesh>();\r\n /**\r\n * Observers registered here will trigger when a motion controller profile was assigned to this xr controller\r\n */\r\n public onMotionControllerInitObservable = new Observable<WebXRAbstractMotionController>();\r\n /**\r\n * Pointer which can be used to select objects or attach a visible laser to\r\n */\r\n public pointer: AbstractMesh;\r\n\r\n /**\r\n * The last XRPose the was calculated on the current XRFrame\r\n * @internal\r\n */\r\n public _lastXRPose?: XRPose;\r\n\r\n /**\r\n * Creates the input source object\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/webXR/webXRInputControllerSupport\r\n * @param _scene the scene which the controller should be associated to\r\n * @param inputSource the underlying input source for the controller\r\n * @param _options options for this controller creation\r\n */\r\n constructor(\r\n private _scene: Scene,\r\n /** The underlying input source for the controller */\r\n public inputSource: XRInputSource,\r\n private _options: IWebXRControllerOptions = {}\r\n ) {\r\n this._uniqueId = `controller-${IdCount++}-${inputSource.targetRayMode}-${inputSource.handedness}`;\r\n\r\n this.pointer = new Mesh(`${this._uniqueId}-pointer`, _scene);\r\n this.pointer.rotationQuaternion = new Quaternion();\r\n\r\n if (this.inputSource.gripSpace) {\r\n this.grip = new Mesh(`${this._uniqueId}-grip`, this._scene);\r\n this.grip.rotationQuaternion = new Quaternion();\r\n }\r\n\r\n this._tmpVector.set(0, 0, this._scene.useRightHandedSystem ? -1.0 : 1.0);\r\n\r\n // for now only load motion controllers if gamepad object available\r\n if (this.inputSource.gamepad && this.inputSource.targetRayMode === \"tracked-pointer\") {\r\n // eslint-disable-next-line github/no-then\r\n WebXRMotionControllerManager.GetMotionControllerWithXRInput(inputSource, _scene, this._options.forceControllerProfile).then(\r\n (motionController) => {\r\n this.motionController = motionController;\r\n this.onMotionControllerInitObservable.notifyObservers(motionController);\r\n // should the model be loaded?\r\n if (!this._options.doNotLoadControllerMesh && !this.inputSource.skipRendering && !this.motionController._doNotLoadControllerMesh) {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises, github/no-then\r\n this.motionController.loadModel().then((success) => {\r\n if (success && this.motionController && this.motionController.rootMesh) {\r\n if (this._options.renderingGroupId) {\r\n // anything other than 0?\r\n this.motionController.rootMesh.renderingGroupId = this._options.renderingGroupId;\r\n const childMeshes = this.motionController.rootMesh.getChildMeshes(false);\r\n for (const mesh of childMeshes) {\r\n mesh.renderingGroupId = this._options.renderingGroupId!;\r\n }\r\n }\r\n this.onMeshLoadedObservable.notifyObservers(this.motionController.rootMesh);\r\n this.motionController.rootMesh.parent = this.grip || this.pointer;\r\n this.motionController.disableAnimation = !!this._options.disableMotionControllerAnimation;\r\n }\r\n // make sure to dispose is the controller is already disposed\r\n if (this._disposed) {\r\n this.motionController?.dispose();\r\n }\r\n });\r\n }\r\n },\r\n () => {\r\n Tools.Warn(`Could not find a matching motion controller for the registered input source`);\r\n }\r\n );\r\n }\r\n }\r\n\r\n /**\r\n * Get this controllers unique id\r\n */\r\n public get uniqueId() {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Disposes of the object\r\n */\r\n public dispose() {\r\n if (this.grip) {\r\n this.grip.dispose(true);\r\n }\r\n if (this.motionController) {\r\n this.motionController.dispose();\r\n }\r\n this.pointer.dispose(true);\r\n this.onMotionControllerInitObservable.clear();\r\n this.onMeshLoadedObservable.clear();\r\n this.onDisposeObservable.notifyObservers(this);\r\n this.onDisposeObservable.clear();\r\n this._disposed = true;\r\n }\r\n\r\n /**\r\n * Gets a world space ray coming from the pointer or grip\r\n * @param result the resulting ray\r\n * @param gripIfAvailable use the grip mesh instead of the pointer, if available\r\n */\r\n public getWorldPointerRayToRef(result: Ray, gripIfAvailable: boolean = false) {\r\n const object = gripIfAvailable && this.grip ? this.grip : this.pointer;\r\n Vector3.TransformNormalToRef(this._tmpVector, object.getWorldMatrix(), result.direction);\r\n result.direction.normalize();\r\n result.origin.copyFrom(object.absolutePosition);\r\n result.length = 1000;\r\n }\r\n\r\n /**\r\n * Updates the controller pose based on the given XRFrame\r\n * @param xrFrame xr frame to update the pose with\r\n * @param referenceSpace reference space to use\r\n * @param xrCamera the xr camera, used for parenting\r\n * @param xrSessionManager the session manager used to get the world reference system\r\n */\r\n public updateFromXRFrame(xrFrame: XRFrame, referenceSpace: XRReferenceSpace, xrCamera: WebXRCamera, xrSessionManager: WebXRSessionManager) {\r\n const pose = xrFrame.getPose(this.inputSource.targetRaySpace, referenceSpace);\r\n this._lastXRPose = pose;\r\n\r\n // Update the pointer mesh\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n this.pointer.position.set(pos.x, pos.y, pos.z).scaleInPlace(xrSessionManager.worldScalingFactor);\r\n const orientation = pose.transform.orientation;\r\n this.pointer.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.pointer.position.z *= -1;\r\n this.pointer.rotationQuaternion!.z *= -1;\r\n this.pointer.rotationQuaternion!.w *= -1;\r\n }\r\n this.pointer.parent = xrCamera.parent;\r\n this.pointer.scaling.setAll(xrSessionManager.worldScalingFactor);\r\n }\r\n\r\n // Update the grip mesh if it exists\r\n if (this.inputSource.gripSpace && this.grip) {\r\n const pose = xrFrame.getPose(this.inputSource.gripSpace, referenceSpace);\r\n if (pose) {\r\n const pos = pose.transform.position;\r\n const orientation = pose.transform.orientation;\r\n this.grip.position.set(pos.x, pos.y, pos.z).scaleInPlace(xrSessionManager.worldScalingFactor);\r\n this.grip.rotationQuaternion!.set(orientation.x, orientation.y, orientation.z, orientation.w);\r\n if (!this._scene.useRightHandedSystem) {\r\n this.grip.position.z *= -1;\r\n this.grip.rotationQuaternion!.z *= -1;\r\n this.grip.rotationQuaternion!.w *= -1;\r\n }\r\n }\r\n this.grip.parent = xrCamera.parent;\r\n this.grip.scaling.setAll(xrSessionManager.worldScalingFactor);\r\n }\r\n if (this.motionController) {\r\n // either update buttons only or also position, if in gamepad mode\r\n this.motionController.updateFromXRFrame(xrFrame);\r\n }\r\n }\r\n}\r\n"]}
@@ -3,14 +3,21 @@ import { type WebXRLayerRenderTargetTextureProvider } from "./webXRRenderTargetT
3
3
  import { type WebXRSessionManager } from "./webXRSessionManager.js";
4
4
  /** Covers all supported subclasses of WebXR's XRCompositionLayer */
5
5
  export type WebXRCompositionLayerType = "XRProjectionLayer";
6
+ /**
7
+ * The quad-layer type name.
8
+ */
6
9
  export type WebXRQuadLayerType = "XRQuadLayer";
7
10
  /** Covers all supported subclasses of WebXR's XRLayer */
8
11
  export type WebXRLayerType = "XRWebGLLayer" | WebXRCompositionLayerType | WebXRQuadLayerType;
12
+ /** Covers the spatial composition-layer types supported by WebXRLayers. */
13
+ export type WebXRSpatialLayerType = WebXRQuadLayerType | "XRCylinderLayer" | "XREquirectLayer" | "XRCubeLayer";
14
+ /** Covers every native layer type supported by Babylon.js. */
15
+ export type WebXRSupportedLayerType = WebXRLayerType | WebXRSpatialLayerType;
9
16
  /**
10
17
  * Wrapper over subclasses of XRLayer.
11
18
  * @internal
12
19
  */
13
- export declare class WebXRLayerWrapper {
20
+ export declare class WebXRLayerWrapper<LayerTypeT extends WebXRSupportedLayerType = WebXRLayerType> {
14
21
  /** The width of the layer's framebuffer. */
15
22
  getWidth: () => number;
16
23
  /** The height of the layer's framebuffer. */
@@ -18,22 +25,28 @@ export declare class WebXRLayerWrapper {
18
25
  /** The XR layer that this WebXRLayerWrapper wraps. */
19
26
  readonly layer: XRLayer;
20
27
  /** The type of XR layer that is being wrapped. */
21
- readonly layerType: WebXRLayerType;
28
+ readonly layerType: LayerTypeT;
22
29
  /** Create a render target provider for the wrapped layer. */
23
30
  private _createRenderTargetTextureProvider;
24
31
  private _rttWrapper;
25
32
  /**
26
- * Check if fixed foveation is supported on this device
33
+ * The render target provider created for this layer, or `null` until one is created.
34
+ */
35
+ get renderTargetTextureProvider(): Nullable<WebXRLayerRenderTargetTextureProvider<LayerTypeT>>;
36
+ /**
37
+ * Check if fixed foveation is supported by the wrapped XRWebGLLayer or XRProjectionLayer.
27
38
  */
28
39
  get isFixedFoveationSupported(): boolean;
29
40
  /**
30
- * Get the fixed foveation currently set, as specified by the webxr specs
31
- * If this returns null, then fixed foveation is not supported
41
+ * Gets the fixed foveation currently set, as specified by the WebXR specs.
42
+ * @returns The fixed foveation level, or `null` when fixed foveation is not supported.
32
43
  */
33
44
  get fixedFoveation(): Nullable<number>;
34
45
  /**
35
- * Set the fixed foveation to the specified value, as specified by the webxr specs
36
- * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation
46
+ * Sets the fixed foveation level, as specified by the WebXR specs.
47
+ * The value is normalized between 0 and 1, where 1 is maximum foveation and 0 is no foveation.
48
+ * Unsupported native layers ignore the assignment, matching the WebXR fixed-foveation contract.
49
+ * @param value The fixed foveation level, or `null` to use no foveation.
37
50
  */
38
51
  set fixedFoveation(value: Nullable<number>);
39
52
  /**
@@ -41,7 +54,10 @@ export declare class WebXRLayerWrapper {
41
54
  * @param xrSessionManager The XR Session Manager
42
55
  * @returns A new render target texture provider for the wrapped layer.
43
56
  */
44
- createRenderTargetTextureProvider(xrSessionManager: WebXRSessionManager): WebXRLayerRenderTargetTextureProvider;
57
+ createRenderTargetTextureProvider(xrSessionManager: WebXRSessionManager): WebXRLayerRenderTargetTextureProvider<LayerTypeT>;
58
+ /**
59
+ * Disposes the render target provider created for this layer.
60
+ */
45
61
  dispose(): void;
46
62
  protected constructor(
47
63
  /** The width of the layer's framebuffer. */
@@ -51,7 +67,7 @@ export declare class WebXRLayerWrapper {
51
67
  /** The XR layer that this WebXRLayerWrapper wraps. */
52
68
  layer: XRLayer,
53
69
  /** The type of XR layer that is being wrapped. */
54
- layerType: WebXRLayerType,
70
+ layerType: LayerTypeT,
55
71
  /** Create a render target provider for the wrapped layer. */
56
- _createRenderTargetTextureProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider);
72
+ _createRenderTargetTextureProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider<LayerTypeT>);
57
73
  }
@@ -4,24 +4,33 @@
4
4
  */
5
5
  export class WebXRLayerWrapper {
6
6
  /**
7
- * Check if fixed foveation is supported on this device
7
+ * The render target provider created for this layer, or `null` until one is created.
8
+ */
9
+ get renderTargetTextureProvider() {
10
+ return this._rttWrapper;
11
+ }
12
+ /**
13
+ * Check if fixed foveation is supported by the wrapped XRWebGLLayer or XRProjectionLayer.
8
14
  */
9
15
  get isFixedFoveationSupported() {
10
- return this.layerType == "XRWebGLLayer" && typeof this.layer.fixedFoveation == "number";
16
+ const isFoveationLayer = this.layerType === "XRWebGLLayer" || this.layerType === "XRProjectionLayer";
17
+ return isFoveationLayer && typeof this.layer.fixedFoveation === "number";
11
18
  }
12
19
  /**
13
- * Get the fixed foveation currently set, as specified by the webxr specs
14
- * If this returns null, then fixed foveation is not supported
20
+ * Gets the fixed foveation currently set, as specified by the WebXR specs.
21
+ * @returns The fixed foveation level, or `null` when fixed foveation is not supported.
15
22
  */
16
23
  get fixedFoveation() {
17
24
  if (this.isFixedFoveationSupported) {
18
- return this.layer.fixedFoveation;
25
+ return this.layer.fixedFoveation ?? null;
19
26
  }
20
27
  return null;
21
28
  }
22
29
  /**
23
- * Set the fixed foveation to the specified value, as specified by the webxr specs
24
- * This value will be normalized to be between 0 and 1, 1 being max foveation, 0 being no foveation
30
+ * Sets the fixed foveation level, as specified by the WebXR specs.
31
+ * The value is normalized between 0 and 1, where 1 is maximum foveation and 0 is no foveation.
32
+ * Unsupported native layers ignore the assignment, matching the WebXR fixed-foveation contract.
33
+ * @param value The fixed foveation level, or `null` to use no foveation.
25
34
  */
26
35
  set fixedFoveation(value) {
27
36
  if (this.isFixedFoveationSupported) {
@@ -38,6 +47,9 @@ export class WebXRLayerWrapper {
38
47
  this._rttWrapper = this._createRenderTargetTextureProvider(xrSessionManager);
39
48
  return this._rttWrapper;
40
49
  }
50
+ /**
51
+ * Disposes the render target provider created for this layer.
52
+ */
41
53
  dispose() {
42
54
  if (this._rttWrapper) {
43
55
  this._rttWrapper.dispose();
@@ -1 +1 @@
1
- {"version":3,"file":"webXRLayerWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRLayerWrapper.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAE1B;;OAEG;IACH,IAAW,yBAAyB;QAChC,OAAO,IAAI,CAAC,SAAS,IAAI,cAAc,IAAI,OAAQ,IAAI,CAAC,KAAsB,CAAC,cAAc,IAAI,QAAQ,CAAC;IAC9G,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,OAAQ,IAAI,CAAC,KAAsB,CAAC,cAAe,CAAC;QACxD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc,CAAC,KAAuB;QAC7C,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,KAAsB,CAAC,cAAc,GAAG,GAAG,CAAC;QACtD,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,iCAAiC,CAAC,gBAAqC;QAC1E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kCAAkC,CAAC,gBAAgB,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEM,OAAO;QACV,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;IACL,CAAC;IAED;IACI,4CAA4C;IACrC,QAAsB;IAC7B,6CAA6C;IACtC,SAAuB;IAC9B,sDAAsD;IACtC,KAAc;IAC9B,kDAAkD;IAClC,SAAyB;IACzC,6DAA6D;IACrD,kCAAoH;QARrH,aAAQ,GAAR,QAAQ,CAAc;QAEtB,cAAS,GAAT,SAAS,CAAc;QAEd,UAAK,GAAL,KAAK,CAAS;QAEd,cAAS,GAAT,SAAS,CAAgB;QAEjC,uCAAkC,GAAlC,kCAAkC,CAAkF;QAzDxH,gBAAW,GAAoD,IAAI,CAAC;IA0DzE,CAAC;CACP","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { type WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\n\r\n/** Covers all supported subclasses of WebXR's XRCompositionLayer */\r\n// TODO (rgerd): Extend for all other subclasses of XRCompositionLayer.\r\nexport type WebXRCompositionLayerType = \"XRProjectionLayer\";\r\nexport type WebXRQuadLayerType = \"XRQuadLayer\";\r\n\r\n/** Covers all supported subclasses of WebXR's XRLayer */\r\nexport type WebXRLayerType = \"XRWebGLLayer\" | WebXRCompositionLayerType | WebXRQuadLayerType;\r\n\r\n/**\r\n * Wrapper over subclasses of XRLayer.\r\n * @internal\r\n */\r\nexport class WebXRLayerWrapper {\r\n private _rttWrapper: Nullable<WebXRLayerRenderTargetTextureProvider> = null;\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.layerType == \"XRWebGLLayer\" && typeof (this.layer as XRWebGLLayer).fixedFoveation == \"number\";\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 if (this.isFixedFoveationSupported) {\r\n return (this.layer as XRWebGLLayer).fixedFoveation!;\r\n }\r\n return 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 if (this.isFixedFoveationSupported) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n (this.layer as XRWebGLLayer).fixedFoveation = val;\r\n }\r\n }\r\n\r\n /**\r\n * Create a render target provider for the wrapped layer.\r\n * @param xrSessionManager The XR Session Manager\r\n * @returns A new render target texture provider for the wrapped layer.\r\n */\r\n public createRenderTargetTextureProvider(xrSessionManager: WebXRSessionManager): WebXRLayerRenderTargetTextureProvider {\r\n this._rttWrapper = this._createRenderTargetTextureProvider(xrSessionManager);\r\n return this._rttWrapper;\r\n }\r\n\r\n public dispose(): void {\r\n if (this._rttWrapper) {\r\n this._rttWrapper.dispose();\r\n this._rttWrapper = null;\r\n }\r\n }\r\n\r\n protected constructor(\r\n /** The width of the layer's framebuffer. */\r\n public getWidth: () => number,\r\n /** The height of the layer's framebuffer. */\r\n public getHeight: () => number,\r\n /** The XR layer that this WebXRLayerWrapper wraps. */\r\n public readonly layer: XRLayer,\r\n /** The type of XR layer that is being wrapped. */\r\n public readonly layerType: WebXRLayerType,\r\n /** Create a render target provider for the wrapped layer. */\r\n private _createRenderTargetTextureProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider\r\n ) {}\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRLayerWrapper.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRLayerWrapper.ts"],"names":[],"mappings":"AAqBA;;;GAGG;AACH,MAAM,OAAO,iBAAiB;IAG1B;;OAEG;IACH,IAAW,2BAA2B;QAClC,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IACD;;OAEG;IACH,IAAW,yBAAyB;QAChC,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,KAAK,cAAc,IAAI,IAAI,CAAC,SAAS,KAAK,mBAAmB,CAAC;QACrG,OAAO,gBAAgB,IAAI,OAAQ,IAAI,CAAC,KAA0C,CAAC,cAAc,KAAK,QAAQ,CAAC;IACnH,CAAC;IAED;;;OAGG;IACH,IAAW,cAAc;QACrB,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,OAAQ,IAAI,CAAC,KAA0C,CAAC,cAAc,IAAI,IAAI,CAAC;QACnF,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACH,IAAW,cAAc,CAAC,KAAuB;QAC7C,IAAI,IAAI,CAAC,yBAAyB,EAAE,CAAC;YACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC;YAChD,IAAI,CAAC,KAA0C,CAAC,cAAc,GAAG,GAAG,CAAC;QAC1E,CAAC;IACL,CAAC;IAED;;;;OAIG;IACI,iCAAiC,CAAC,gBAAqC;QAC1E,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,kCAAkC,CAAC,gBAAgB,CAAC,CAAC;QAC7E,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC3B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAC5B,CAAC;IACL,CAAC;IAED;IACI,4CAA4C;IACrC,QAAsB;IAC7B,6CAA6C;IACtC,SAAuB;IAC9B,sDAAsD;IACtC,KAAc;IAC9B,kDAAkD;IAClC,SAAqB;IACrC,6DAA6D;IACrD,kCAAgI;QARjI,aAAQ,GAAR,QAAQ,CAAc;QAEtB,cAAS,GAAT,SAAS,CAAc;QAEd,UAAK,GAAL,KAAK,CAAS;QAEd,cAAS,GAAT,SAAS,CAAY;QAE7B,uCAAkC,GAAlC,kCAAkC,CAA8F;QAtEpI,gBAAW,GAAgE,IAAI,CAAC;IAuErF,CAAC;CACP","sourcesContent":["import { type Nullable } from \"../types\";\r\nimport { type WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider\";\r\nimport { type WebXRSessionManager } from \"./webXRSessionManager\";\r\n\r\n/** Covers all supported subclasses of WebXR's XRCompositionLayer */\r\nexport type WebXRCompositionLayerType = \"XRProjectionLayer\";\r\n\r\n/**\r\n * The quad-layer type name.\r\n */\r\nexport type WebXRQuadLayerType = \"XRQuadLayer\";\r\n\r\n/** Covers all supported subclasses of WebXR's XRLayer */\r\nexport type WebXRLayerType = \"XRWebGLLayer\" | WebXRCompositionLayerType | WebXRQuadLayerType;\r\n\r\n/** Covers the spatial composition-layer types supported by WebXRLayers. */\r\nexport type WebXRSpatialLayerType = WebXRQuadLayerType | \"XRCylinderLayer\" | \"XREquirectLayer\" | \"XRCubeLayer\";\r\n\r\n/** Covers every native layer type supported by Babylon.js. */\r\nexport type WebXRSupportedLayerType = WebXRLayerType | WebXRSpatialLayerType;\r\n\r\n/**\r\n * Wrapper over subclasses of XRLayer.\r\n * @internal\r\n */\r\nexport class WebXRLayerWrapper<LayerTypeT extends WebXRSupportedLayerType = WebXRLayerType> {\r\n private _rttWrapper: Nullable<WebXRLayerRenderTargetTextureProvider<LayerTypeT>> = null;\r\n\r\n /**\r\n * The render target provider created for this layer, or `null` until one is created.\r\n */\r\n public get renderTargetTextureProvider(): Nullable<WebXRLayerRenderTargetTextureProvider<LayerTypeT>> {\r\n return this._rttWrapper;\r\n }\r\n /**\r\n * Check if fixed foveation is supported by the wrapped XRWebGLLayer or XRProjectionLayer.\r\n */\r\n public get isFixedFoveationSupported(): boolean {\r\n const isFoveationLayer = this.layerType === \"XRWebGLLayer\" || this.layerType === \"XRProjectionLayer\";\r\n return isFoveationLayer && typeof (this.layer as XRWebGLLayer | XRProjectionLayer).fixedFoveation === \"number\";\r\n }\r\n\r\n /**\r\n * Gets the fixed foveation currently set, as specified by the WebXR specs.\r\n * @returns The fixed foveation level, or `null` when fixed foveation is not supported.\r\n */\r\n public get fixedFoveation(): Nullable<number> {\r\n if (this.isFixedFoveationSupported) {\r\n return (this.layer as XRWebGLLayer | XRProjectionLayer).fixedFoveation ?? null;\r\n }\r\n return null;\r\n }\r\n\r\n /**\r\n * Sets the fixed foveation level, as specified by the WebXR specs.\r\n * The value is normalized between 0 and 1, where 1 is maximum foveation and 0 is no foveation.\r\n * Unsupported native layers ignore the assignment, matching the WebXR fixed-foveation contract.\r\n * @param value The fixed foveation level, or `null` to use no foveation.\r\n */\r\n public set fixedFoveation(value: Nullable<number>) {\r\n if (this.isFixedFoveationSupported) {\r\n const val = Math.max(0, Math.min(1, value || 0));\r\n (this.layer as XRWebGLLayer | XRProjectionLayer).fixedFoveation = val;\r\n }\r\n }\r\n\r\n /**\r\n * Create a render target provider for the wrapped layer.\r\n * @param xrSessionManager The XR Session Manager\r\n * @returns A new render target texture provider for the wrapped layer.\r\n */\r\n public createRenderTargetTextureProvider(xrSessionManager: WebXRSessionManager): WebXRLayerRenderTargetTextureProvider<LayerTypeT> {\r\n this._rttWrapper = this._createRenderTargetTextureProvider(xrSessionManager);\r\n return this._rttWrapper;\r\n }\r\n\r\n /**\r\n * Disposes the render target provider created for this layer.\r\n */\r\n public dispose(): void {\r\n if (this._rttWrapper) {\r\n this._rttWrapper.dispose();\r\n this._rttWrapper = null;\r\n }\r\n }\r\n\r\n protected constructor(\r\n /** The width of the layer's framebuffer. */\r\n public getWidth: () => number,\r\n /** The height of the layer's framebuffer. */\r\n public getHeight: () => number,\r\n /** The XR layer that this WebXRLayerWrapper wraps. */\r\n public readonly layer: XRLayer,\r\n /** The type of XR layer that is being wrapped. */\r\n public readonly layerType: LayerTypeT,\r\n /** Create a render target provider for the wrapped layer. */\r\n private _createRenderTargetTextureProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider<LayerTypeT>\r\n ) {}\r\n}\r\n"]}
@@ -4,7 +4,7 @@ import { RenderTargetTexture } from "../Materials/Textures/renderTargetTexture.p
4
4
  import { type Viewport } from "../Maths/math.viewport.js";
5
5
  import { type IDisposable, type Scene } from "../scene.js";
6
6
  import { type Nullable } from "../types.js";
7
- import { type WebXRLayerWrapper } from "./webXRLayerWrapper.js";
7
+ import { type WebXRLayerType, type WebXRLayerWrapper, type WebXRSupportedLayerType } from "./webXRLayerWrapper.js";
8
8
  /**
9
9
  * An interface for objects that provide render target textures for XR rendering.
10
10
  */
@@ -34,9 +34,9 @@ export interface IWebXRRenderTargetTextureProvider extends IDisposable {
34
34
  * Provides render target textures and other important rendering information for a given XRLayer.
35
35
  * @internal
36
36
  */
37
- export declare abstract class WebXRLayerRenderTargetTextureProvider implements IWebXRRenderTargetTextureProvider {
37
+ export declare abstract class WebXRLayerRenderTargetTextureProvider<LayerTypeT extends WebXRSupportedLayerType = WebXRLayerType> implements IWebXRRenderTargetTextureProvider {
38
38
  protected readonly _scene: Scene;
39
- readonly layerWrapper: WebXRLayerWrapper;
39
+ readonly layerWrapper: WebXRLayerWrapper<LayerTypeT>;
40
40
  abstract trySetViewportForView(viewport: Viewport, view: XRView): boolean;
41
41
  abstract getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture>;
42
42
  abstract getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;
@@ -46,7 +46,7 @@ export declare abstract class WebXRLayerRenderTargetTextureProvider implements I
46
46
  framebufferHeight: number;
47
47
  }>;
48
48
  protected _engine: AbstractEngine;
49
- constructor(_scene: Scene, layerWrapper: WebXRLayerWrapper);
49
+ constructor(_scene: Scene, layerWrapper: WebXRLayerWrapper<LayerTypeT>);
50
50
  /**
51
51
  * Creates the render target texture "shell" (with the correct multiview type and MSAA sample count)
52
52
  * without attaching any graphics-API-specific resource. Subclasses attach their own textures.
@@ -1 +1 @@
1
- {"version":3,"file":"webXRRenderTargetTextureProvider.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRRenderTargetTextureProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAgCrF;;;GAGG;AACH,MAAM,OAAgB,qCAAqC;IAUvD,YACuB,MAAa,EAChB,YAA+B;QAD5B,WAAM,GAAN,MAAM,CAAO;QAChB,iBAAY,GAAZ,YAAY,CAAmB;QAPzC,0BAAqB,GAAG,IAAI,KAAK,EAAuB,CAAC;QAS/D,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;IACtC,CAAC;IAED;;;;;;;OAOG;IACO,+BAA+B,CAAC,KAAa,EAAE,MAAc,EAAE,SAAkB;QACvF,MAAM,WAAW,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;QACtC,MAAM,mBAAmB,GAAG,SAAS,CAA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,CAAC;IAEM,wBAAwB;QAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAEM,OAAO;QACV,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3C,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { type InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport { MultiviewRenderTarget } from \"../Materials/Textures/MultiviewRenderTarget\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.pure\";\r\nimport { type Viewport } from \"../Maths/math.viewport\";\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type WebXRLayerWrapper } from \"./webXRLayerWrapper\";\r\n\r\n/**\r\n * An interface for objects that provide render target textures for XR rendering.\r\n */\r\nexport interface IWebXRRenderTargetTextureProvider extends IDisposable {\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 trySetViewportForView(viewport: Viewport, view: XRView): boolean;\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 getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture>;\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 getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;\r\n}\r\n\r\n/**\r\n * Provides render target textures and other important rendering information for a given XRLayer.\r\n * @internal\r\n */\r\nexport abstract class WebXRLayerRenderTargetTextureProvider implements IWebXRRenderTargetTextureProvider {\r\n public abstract trySetViewportForView(viewport: Viewport, view: XRView): boolean;\r\n public abstract getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture>;\r\n public abstract getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;\r\n\r\n protected _renderTargetTextures = new Array<RenderTargetTexture>();\r\n protected _framebufferDimensions: Nullable<{ framebufferWidth: number; framebufferHeight: number }>;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n protected readonly _scene: Scene,\r\n public readonly layerWrapper: WebXRLayerWrapper\r\n ) {\r\n this._engine = _scene.getEngine();\r\n }\r\n\r\n /**\r\n * Creates the render target texture \"shell\" (with the correct multiview type and MSAA sample count)\r\n * without attaching any graphics-API-specific resource. Subclasses attach their own textures.\r\n * @param width the width of the render target\r\n * @param height the height of the render target\r\n * @param multiview whether the render target should be a multiview render target\r\n * @returns the created (but not yet registered) render target texture\r\n */\r\n protected _createRenderTargetTextureShell(width: number, height: number, multiview: boolean): RenderTargetTexture {\r\n const textureSize = { width, height };\r\n const renderTargetTexture = multiview ? new MultiviewRenderTarget(this._scene, textureSize) : new RenderTargetTexture(\"XR renderTargetTexture\", textureSize, this._scene);\r\n renderTargetTexture.renderTarget!._samples = renderTargetTexture.samples;\r\n return renderTargetTexture;\r\n }\r\n\r\n /**\r\n * Builds a render target texture from already-wrapped internal textures, without referencing any\r\n * graphics-API-specific type. A GPU-based backend (e.g. WebGPU / XRGPUBinding) wraps its native\r\n * textures with the engine and calls this hook; the WebGL backend has its own typed entry point.\r\n * @param width the width of the render target\r\n * @param height the height of the render target\r\n * @param colorTexture the internal texture to use as the color attachment, if any\r\n * @param depthStencilTexture the internal texture to use as the depth/stencil attachment, if any\r\n * @param multiview whether the render target should be a multiview render target\r\n * @returns the created render target texture\r\n */\r\n protected _createRenderTargetTextureInternal(\r\n width: number,\r\n height: number,\r\n colorTexture: Nullable<InternalTexture>,\r\n depthStencilTexture: Nullable<InternalTexture>,\r\n multiview: boolean\r\n ): RenderTargetTexture {\r\n if (multiview) {\r\n // The multiview color/depth array wiring is not implemented on this API-agnostic hook yet.\r\n // The WebGL provider still owns the array path via its own _createRenderTargetTexture.\r\n throw new Error(\"Multiview render targets are not yet supported by the API-agnostic render target creation path.\");\r\n }\r\n const renderTargetTexture = this._createRenderTargetTextureShell(width, height, multiview);\r\n const renderTargetWrapper = renderTargetTexture.renderTarget!;\r\n\r\n if (colorTexture) {\r\n renderTargetWrapper.setTexture(colorTexture, 0);\r\n renderTargetTexture._texture = colorTexture;\r\n }\r\n\r\n if (depthStencilTexture) {\r\n renderTargetWrapper._depthStencilTexture = depthStencilTexture;\r\n }\r\n\r\n renderTargetTexture.disableRescaling();\r\n\r\n this._renderTargetTextures.push(renderTargetTexture);\r\n\r\n return renderTargetTexture;\r\n }\r\n\r\n protected _destroyRenderTargetTexture(renderTargetTexture: RenderTargetTexture) {\r\n this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(renderTargetTexture), 1);\r\n renderTargetTexture.dispose();\r\n }\r\n\r\n public getFramebufferDimensions(): Nullable<{ framebufferWidth: number; framebufferHeight: number }> {\r\n return this._framebufferDimensions;\r\n }\r\n\r\n public dispose() {\r\n for (const rtt of this._renderTargetTextures) {\r\n rtt.dispose();\r\n }\r\n this._renderTargetTextures.length = 0;\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"webXRRenderTargetTextureProvider.js","sourceRoot":"","sources":["../../../../dev/core/src/XR/webXRRenderTargetTextureProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAC;AAgCrF;;;GAGG;AACH,MAAM,OAAgB,qCAAqC;IAUvD,YACuB,MAAa,EAChB,YAA2C;QADxC,WAAM,GAAN,MAAM,CAAO;QAChB,iBAAY,GAAZ,YAAY,CAA+B;QAPrD,0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qB,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;QAErD,OAAO,mBAAmB,CAAC;IAC/B,CAAC;IAES,2BAA2B,CAAC,mBAAwC;QAC1E,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,mBAAmB,CAAC,EAAE,CAAC,CAAC,CAAC;QAC9F,mBAAmB,CAAC,OAAO,EAAE,CAAC;IAClC,CAAC;IAEM,wBAAwB;QAC3B,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACvC,CAAC;IAEM,OAAO;QACV,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,qBAAqB,EAAE,CAAC;YAC3C,GAAG,CAAC,OAAO,EAAE,CAAC;QAClB,CAAC;QACD,IAAI,CAAC,qBAAqB,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1C,CAAC;CACJ","sourcesContent":["import { type AbstractEngine } from \"../Engines/abstractEngine\";\r\nimport { type InternalTexture } from \"../Materials/Textures/internalTexture\";\r\nimport { MultiviewRenderTarget } from \"../Materials/Textures/MultiviewRenderTarget\";\r\nimport { RenderTargetTexture } from \"../Materials/Textures/renderTargetTexture.pure\";\r\nimport { type Viewport } from \"../Maths/math.viewport\";\r\nimport { type IDisposable, type Scene } from \"../scene\";\r\nimport { type Nullable } from \"../types\";\r\nimport { type WebXRLayerType, type WebXRLayerWrapper, type WebXRSupportedLayerType } from \"./webXRLayerWrapper\";\r\n\r\n/**\r\n * An interface for objects that provide render target textures for XR rendering.\r\n */\r\nexport interface IWebXRRenderTargetTextureProvider extends IDisposable {\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 trySetViewportForView(viewport: Viewport, view: XRView): boolean;\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 getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture>;\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 getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;\r\n}\r\n\r\n/**\r\n * Provides render target textures and other important rendering information for a given XRLayer.\r\n * @internal\r\n */\r\nexport abstract class WebXRLayerRenderTargetTextureProvider<LayerTypeT extends WebXRSupportedLayerType = WebXRLayerType> implements IWebXRRenderTargetTextureProvider {\r\n public abstract trySetViewportForView(viewport: Viewport, view: XRView): boolean;\r\n public abstract getRenderTargetTextureForEye(eye: XREye): Nullable<RenderTargetTexture>;\r\n public abstract getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;\r\n\r\n protected _renderTargetTextures = new Array<RenderTargetTexture>();\r\n protected _framebufferDimensions: Nullable<{ framebufferWidth: number; framebufferHeight: number }>;\r\n\r\n protected _engine: AbstractEngine;\r\n\r\n constructor(\r\n protected readonly _scene: Scene,\r\n public readonly layerWrapper: WebXRLayerWrapper<LayerTypeT>\r\n ) {\r\n this._engine = _scene.getEngine();\r\n }\r\n\r\n /**\r\n * Creates the render target texture \"shell\" (with the correct multiview type and MSAA sample count)\r\n * without attaching any graphics-API-specific resource. Subclasses attach their own textures.\r\n * @param width the width of the render target\r\n * @param height the height of the render target\r\n * @param multiview whether the render target should be a multiview render target\r\n * @returns the created (but not yet registered) render target texture\r\n */\r\n protected _createRenderTargetTextureShell(width: number, height: number, multiview: boolean): RenderTargetTexture {\r\n const textureSize = { width, height };\r\n const renderTargetTexture = multiview ? new MultiviewRenderTarget(this._scene, textureSize) : new RenderTargetTexture(\"XR renderTargetTexture\", textureSize, this._scene);\r\n renderTargetTexture.renderTarget!._samples = renderTargetTexture.samples;\r\n return renderTargetTexture;\r\n }\r\n\r\n /**\r\n * Builds a render target texture from already-wrapped internal textures, without referencing any\r\n * graphics-API-specific type. A GPU-based backend (e.g. WebGPU / XRGPUBinding) wraps its native\r\n * textures with the engine and calls this hook; the WebGL backend has its own typed entry point.\r\n * @param width the width of the render target\r\n * @param height the height of the render target\r\n * @param colorTexture the internal texture to use as the color attachment, if any\r\n * @param depthStencilTexture the internal texture to use as the depth/stencil attachment, if any\r\n * @param multiview whether the render target should be a multiview render target\r\n * @returns the created render target texture\r\n */\r\n protected _createRenderTargetTextureInternal(\r\n width: number,\r\n height: number,\r\n colorTexture: Nullable<InternalTexture>,\r\n depthStencilTexture: Nullable<InternalTexture>,\r\n multiview: boolean\r\n ): RenderTargetTexture {\r\n if (multiview) {\r\n // The multiview color/depth array wiring is not implemented on this API-agnostic hook yet.\r\n // The WebGL provider still owns the array path via its own _createRenderTargetTexture.\r\n throw new Error(\"Multiview render targets are not yet supported by the API-agnostic render target creation path.\");\r\n }\r\n const renderTargetTexture = this._createRenderTargetTextureShell(width, height, multiview);\r\n const renderTargetWrapper = renderTargetTexture.renderTarget!;\r\n\r\n if (colorTexture) {\r\n renderTargetWrapper.setTexture(colorTexture, 0);\r\n renderTargetTexture._texture = colorTexture;\r\n }\r\n\r\n if (depthStencilTexture) {\r\n renderTargetWrapper._depthStencilTexture = depthStencilTexture;\r\n }\r\n\r\n renderTargetTexture.disableRescaling();\r\n\r\n this._renderTargetTextures.push(renderTargetTexture);\r\n\r\n return renderTargetTexture;\r\n }\r\n\r\n protected _destroyRenderTargetTexture(renderTargetTexture: RenderTargetTexture) {\r\n this._renderTargetTextures.splice(this._renderTargetTextures.indexOf(renderTargetTexture), 1);\r\n renderTargetTexture.dispose();\r\n }\r\n\r\n public getFramebufferDimensions(): Nullable<{ framebufferWidth: number; framebufferHeight: number }> {\r\n return this._framebufferDimensions;\r\n }\r\n\r\n public dispose() {\r\n for (const rtt of this._renderTargetTextures) {\r\n rtt.dispose();\r\n }\r\n this._renderTargetTextures.length = 0;\r\n }\r\n}\r\n"]}
@@ -23,6 +23,8 @@ export declare class WebXRSessionManager implements IDisposable, IWebXRRenderTar
23
23
  private _xrNavigator;
24
24
  private _sessionMode;
25
25
  private _onEngineDisposedObserver;
26
+ private _sessionCleanup;
27
+ private _referenceSpaceInitialized;
26
28
  /**
27
29
  * The base reference space from which the session started. good if you want to reset your
28
30
  * reference space
@@ -143,6 +145,39 @@ export declare class WebXRSessionManager implements IDisposable, IWebXRRenderTar
143
145
  * @returns the render target for the specified view or null if not available
144
146
  */
145
147
  getRenderTargetTextureForView(view: XRView): Nullable<RenderTargetTexture>;
148
+ /**
149
+ * Checks whether the current XR view exposes the dynamic viewport scaling API.
150
+ * API availability does not guarantee that the active XR device will change the viewport dimensions.
151
+ * This method must be called during an active XR frame.
152
+ * @param viewIndex the index of the view in the current viewer pose
153
+ * @returns whether dynamic viewport scaling is exposed for the view
154
+ * @see https://playground.babylonjs.com/#BAGIIM#0
155
+ */
156
+ isViewportScaleSupported(viewIndex: number): boolean;
157
+ /**
158
+ * Gets the runtime-recommended viewport scale for the current XR view.
159
+ * A number is returned when the runtime has a recommendation, `null` when the API is supported but
160
+ * the runtime has no recommendation, and `undefined` when the API is not supported.
161
+ * This method must be called during an active XR frame.
162
+ * @param viewIndex the index of the view in the current viewer pose
163
+ * @returns the recommended viewport scale, `null` when no recommendation is available, or `undefined` when unsupported
164
+ * @see https://playground.babylonjs.com/#BAGIIM#0
165
+ */
166
+ getRecommendedViewportScale(viewIndex: number): Nullable<number> | undefined;
167
+ /**
168
+ * Requests a viewport scale for the current XR view.
169
+ * The request is a hint to the runtime. Babylon uses the native viewport returned on subsequent frames
170
+ * and does not derive viewport dimensions from this value. Pass `1` to restore the full viewport scale;
171
+ * `null` follows the native no-op behavior. Native ignored-value, clamping, and exception behavior is preserved.
172
+ * Requests made from an application observer of `onXRFrameObservable` apply to a future frame because
173
+ * Babylon's camera acquires the current frame's viewport before notifying application observers.
174
+ * This method must be called during an active XR frame.
175
+ * @param viewIndex the index of the view in the current viewer pose
176
+ * @param scale the viewport scale requested from the runtime
177
+ * @see https://playground.babylonjs.com/#BAGIIM#0
178
+ */
179
+ requestViewportScale(viewIndex: number, scale: Nullable<number>): void;
180
+ private _getCurrentXRView;
146
181
  /**
147
182
  * Obtains the XR graphics binding for the current session, creating it lazily.
148
183
  * This is the API-agnostic seam used by WebGL and WebGPU XR features to share a binding.
@@ -216,6 +251,16 @@ export declare class WebXRSessionManager implements IDisposable, IWebXRRenderTar
216
251
  * @returns a promise with boolean as final value
217
252
  */
218
253
  static IsSessionSupportedAsync(sessionMode: XRSessionMode): Promise<boolean>;
254
+ /**
255
+ * Returns whether the runtime exposes the WebGPU-XR binding APIs required by Babylon.js.
256
+ *
257
+ * This is an advisory check only. XR session negotiation can still fail for the active device,
258
+ * permissions, or adapter. A WebGPU engine intended for XR must also be created with
259
+ * `xrCompatible: true`.
260
+ * @returns whether the required XRGPUBinding projection APIs are exposed
261
+ * @experimental WebGPU-XR support is experimental and may change.
262
+ */
263
+ static get IsWebGPUXRSupported(): boolean;
219
264
  /**
220
265
  * Returns true if Babylon.js is using the BabylonNative backend, otherwise false
221
266
  */