@onerjs/core 8.54.4 → 8.54.5

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 (177) hide show
  1. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js +1 -1
  2. package/Engines/WebGPU/Extensions/engine.cubeTexture.pure.js.map +1 -1
  3. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js +2 -2
  4. package/Engines/WebGPU/Extensions/engine.rawTexture.pure.js.map +1 -1
  5. package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +1 -0
  6. package/Engines/WebGPU/webgpuCacheRenderPipeline.js +18 -4
  7. package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
  8. package/Engines/WebGPU/webgpuCacheTextureView.d.ts +13 -0
  9. package/Engines/WebGPU/webgpuCacheTextureView.js +32 -0
  10. package/Engines/WebGPU/webgpuCacheTextureView.js.map +1 -0
  11. package/Engines/WebGPU/webgpuRenderTargetWrapper.d.ts +10 -0
  12. package/Engines/WebGPU/webgpuRenderTargetWrapper.js +10 -0
  13. package/Engines/WebGPU/webgpuRenderTargetWrapper.js.map +1 -1
  14. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js +57 -4
  15. package/Engines/WebGPU/webgpuShaderProcessorsWGSL.pure.js.map +1 -1
  16. package/Engines/WebGPU/webgpuTextureManager.d.ts +1 -1
  17. package/Engines/WebGPU/webgpuTextureManager.js +4 -2
  18. package/Engines/WebGPU/webgpuTextureManager.js.map +1 -1
  19. package/Engines/abstractEngine.pure.js +2 -2
  20. package/Engines/abstractEngine.pure.js.map +1 -1
  21. package/Engines/thinNativeEngine.pure.d.ts +5 -0
  22. package/Engines/thinNativeEngine.pure.js +29 -6
  23. package/Engines/thinNativeEngine.pure.js.map +1 -1
  24. package/Engines/webgpuEngine.pure.d.ts +1 -0
  25. package/Engines/webgpuEngine.pure.js +21 -8
  26. package/Engines/webgpuEngine.pure.js.map +1 -1
  27. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.d.ts +95 -1
  28. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js +169 -4
  29. package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.js.map +1 -1
  30. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.d.ts +21 -6
  31. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js +28 -26
  32. package/FlowGraph/Blocks/Data/Math/flowGraphMathCombineExtractBlocks.pure.js.map +1 -1
  33. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.d.ts +30 -2
  34. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js +111 -29
  35. package/FlowGraph/Blocks/Data/Math/flowGraphMatrixMathBlocks.pure.js.map +1 -1
  36. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.d.ts +56 -2
  37. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js +99 -14
  38. package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.js.map +1 -1
  39. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js +10 -2
  40. package/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.js.map +1 -1
  41. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js +21 -1
  42. package/FlowGraph/Blocks/Data/Utils/flowGraphArrayIndexBlock.pure.js.map +1 -1
  43. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.d.ts +18 -0
  44. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js +29 -2
  45. package/FlowGraph/Blocks/Data/flowGraphCachedOperationBlock.js.map +1 -1
  46. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.d.ts +15 -0
  47. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js +44 -7
  48. package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.pure.js.map +1 -1
  49. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.d.ts +9 -0
  50. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js +9 -1
  51. package/FlowGraph/Blocks/Event/flowGraphSceneReadyEventBlock.pure.js.map +1 -1
  52. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.d.ts +7 -0
  53. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js +8 -1
  54. package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.pure.js.map +1 -1
  55. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.d.ts +5 -0
  56. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js +8 -0
  57. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.js.map +1 -0
  58. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.d.ts +37 -0
  59. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js +44 -0
  60. package/FlowGraph/Blocks/Event/flowGraphStopEventPropagationBlock.pure.js.map +1 -0
  61. package/FlowGraph/Blocks/Event/index.d.ts +1 -0
  62. package/FlowGraph/Blocks/Event/index.js +1 -0
  63. package/FlowGraph/Blocks/Event/index.js.map +1 -1
  64. package/FlowGraph/Blocks/Event/pure.d.ts +1 -0
  65. package/FlowGraph/Blocks/Event/pure.js +1 -0
  66. package/FlowGraph/Blocks/Event/pure.js.map +1 -1
  67. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.d.ts +4 -1
  68. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js +67 -2
  69. package/FlowGraph/Blocks/Execution/Animation/flowGraphBezierCurveEasingBlock.pure.js.map +1 -1
  70. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.d.ts +13 -0
  71. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js +102 -7
  72. package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.pure.js.map +1 -1
  73. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js +5 -1
  74. package/FlowGraph/Blocks/Execution/Animation/flowGraphStopAnimationBlock.pure.js.map +1 -1
  75. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js +5 -1
  76. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphCancelDelayBlock.pure.js.map +1 -1
  77. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.d.ts +11 -2
  78. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js +21 -3
  79. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphForLoopBlock.pure.js.map +1 -1
  80. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js +25 -4
  81. package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.pure.js.map +1 -1
  82. package/FlowGraph/Blocks/flowGraphBlockFactory.js +18 -0
  83. package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
  84. package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +9 -0
  85. package/FlowGraph/Blocks/flowGraphBlockNames.js +9 -0
  86. package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
  87. package/FlowGraph/CustomTypes/flowGraphMatrix.d.ts +17 -3
  88. package/FlowGraph/CustomTypes/flowGraphMatrix.js +27 -21
  89. package/FlowGraph/CustomTypes/flowGraphMatrix.js.map +1 -1
  90. package/FlowGraph/flowGraphContext.d.ts +23 -0
  91. package/FlowGraph/flowGraphContext.js +29 -0
  92. package/FlowGraph/flowGraphContext.js.map +1 -1
  93. package/FlowGraph/flowGraphCoordinator.d.ts +58 -1
  94. package/FlowGraph/flowGraphCoordinator.js +72 -0
  95. package/FlowGraph/flowGraphCoordinator.js.map +1 -1
  96. package/FlowGraph/flowGraphDelayRegistry.d.ts +31 -0
  97. package/FlowGraph/flowGraphDelayRegistry.js +50 -0
  98. package/FlowGraph/flowGraphDelayRegistry.js.map +1 -0
  99. package/FlowGraph/flowGraphHostResolver.d.ts +69 -0
  100. package/FlowGraph/flowGraphHostResolver.js +25 -0
  101. package/FlowGraph/flowGraphHostResolver.js.map +1 -0
  102. package/FlowGraph/flowGraphMath.d.ts +48 -1
  103. package/FlowGraph/flowGraphMath.js +169 -4
  104. package/FlowGraph/flowGraphMath.js.map +1 -1
  105. package/FlowGraph/flowGraphPathConverterComponent.d.ts +14 -3
  106. package/FlowGraph/flowGraphPathConverterComponent.js +110 -18
  107. package/FlowGraph/flowGraphPathConverterComponent.js.map +1 -1
  108. package/FlowGraph/flowGraphSignalConnection.pure.js +7 -1
  109. package/FlowGraph/flowGraphSignalConnection.pure.js.map +1 -1
  110. package/FlowGraph/index.d.ts +2 -0
  111. package/FlowGraph/index.js +2 -0
  112. package/FlowGraph/index.js.map +1 -1
  113. package/FlowGraph/pure.d.ts +2 -0
  114. package/FlowGraph/pure.js +2 -0
  115. package/FlowGraph/pure.js.map +1 -1
  116. package/Maths/math.vector.pure.d.ts +10 -0
  117. package/Maths/math.vector.pure.js +13 -0
  118. package/Maths/math.vector.pure.js.map +1 -1
  119. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.d.ts +216 -1
  120. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js +714 -67
  121. package/Meshes/GaussianSplatting/gaussianSplattingMesh.pure.js.map +1 -1
  122. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +81 -4
  123. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +466 -52
  124. package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
  125. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.d.ts +19 -0
  126. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js +24 -0
  127. package/Meshes/GaussianSplatting/gaussianSplattingPartProxyMesh.pure.js.map +1 -1
  128. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +31 -6
  129. package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
  130. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js +5 -1
  131. package/Meshes/GreasedLine/greasedLineRibbonMesh.pure.js.map +1 -1
  132. package/Misc/greasedLineTools.js +1 -1
  133. package/Misc/greasedLineTools.js.map +1 -1
  134. package/Misc/tools.pure.js +14 -2
  135. package/Misc/tools.pure.js.map +1 -1
  136. package/Particles/gpuParticleSystem.pure.d.ts +66 -1
  137. package/Particles/gpuParticleSystem.pure.js +189 -49
  138. package/Particles/gpuParticleSystem.pure.js.map +1 -1
  139. package/Physics/v2/characterController.js +69 -17
  140. package/Physics/v2/characterController.js.map +1 -1
  141. package/XR/features/Layers/WebXRWebGPUCompositionLayer.d.ts +3 -9
  142. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js +4 -11
  143. package/XR/features/Layers/WebXRWebGPUCompositionLayer.js.map +1 -1
  144. package/XR/features/WebXRAbstractFeature.d.ts +9 -0
  145. package/XR/features/WebXRAbstractFeature.js +16 -0
  146. package/XR/features/WebXRAbstractFeature.js.map +1 -1
  147. package/XR/features/WebXRDepthSensing.pure.d.ts +7 -0
  148. package/XR/features/WebXRDepthSensing.pure.js +350 -39
  149. package/XR/features/WebXRDepthSensing.pure.js.map +1 -1
  150. package/XR/features/WebXRImageTracking.pure.js.map +1 -1
  151. package/XR/features/WebXRLayers.pure.d.ts +6 -5
  152. package/XR/features/WebXRLayers.pure.js +65 -8
  153. package/XR/features/WebXRLayers.pure.js.map +1 -1
  154. package/XR/features/WebXRRawCameraAccess.pure.js +9 -2
  155. package/XR/features/WebXRRawCameraAccess.pure.js.map +1 -1
  156. package/XR/features/WebXRSpaceWarp.pure.d.ts +0 -1
  157. package/XR/features/WebXRSpaceWarp.pure.js +13 -4
  158. package/XR/features/WebXRSpaceWarp.pure.js.map +1 -1
  159. package/XR/features/WebXRWalkingLocomotion.pure.js.map +1 -1
  160. package/XR/webXRCamera.js +27 -0
  161. package/XR/webXRCamera.js.map +1 -1
  162. package/XR/webXRFeatureWarningRegistry.d.ts +14 -0
  163. package/XR/webXRFeatureWarningRegistry.js +19 -0
  164. package/XR/webXRFeatureWarningRegistry.js.map +1 -0
  165. package/XR/webXRFeaturesManager.d.ts +5 -0
  166. package/XR/webXRFeaturesManager.js +23 -4
  167. package/XR/webXRFeaturesManager.js.map +1 -1
  168. package/XR/webXRGraphicsBinding.d.ts +17 -10
  169. package/XR/webXRGraphicsBinding.js +8 -5
  170. package/XR/webXRGraphicsBinding.js.map +1 -1
  171. package/XR/webXRSessionManager.d.ts +3 -5
  172. package/XR/webXRSessionManager.js +1 -3
  173. package/XR/webXRSessionManager.js.map +1 -1
  174. package/XR/webXRWebGPURenderTargetTextureProvider.d.ts +21 -5
  175. package/XR/webXRWebGPURenderTargetTextureProvider.js +38 -10
  176. package/XR/webXRWebGPURenderTargetTextureProvider.js.map +1 -1
  177. package/package.json +1 -1
@@ -2,23 +2,18 @@ import { type RenderTargetTexture } from "../../../Materials/Textures/renderTarg
2
2
  import { type Viewport } from "../../../Maths/math.viewport.js";
3
3
  import { Observable } from "../../../Misc/observable.js";
4
4
  import { type WebXRLayerRenderTargetTexture } from "../../webXRLayerRenderTargetTexture.js";
5
- import { type WebXRLayerType, WebXRLayerWrapper } from "../../webXRLayerWrapper.js";
5
+ import { type WebXRLayerType } from "../../webXRLayerWrapper.js";
6
6
  import { type WebXRLayerRenderTargetTextureProvider } from "../../webXRRenderTargetTextureProvider.js";
7
7
  import { WebXRWebGPURenderTargetTextureProvider } from "../../webXRWebGPURenderTargetTextureProvider.js";
8
8
  import { type WebXRSessionManager } from "../../webXRSessionManager.js";
9
9
  import { type Nullable } from "../../../types.js";
10
+ import { WebXRCompositionLayerWrapper } from "./WebXRCompositionLayer.js";
10
11
  /**
11
12
  * Wraps xr composition layers for the WebGPU (XRGPUBinding) backend.
12
13
  * Mirrors {@link WebXRCompositionLayerWrapper} for WebGPU.
13
14
  * @internal
14
15
  */
15
- export declare class WebXRWebGPUCompositionLayerWrapper extends WebXRLayerWrapper {
16
- getWidth: () => number;
17
- getHeight: () => number;
18
- readonly layer: XRCompositionLayer;
19
- readonly layerType: WebXRLayerType;
20
- readonly isMultiview: boolean;
21
- createRTTProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider;
16
+ export declare class WebXRWebGPUCompositionLayerWrapper extends WebXRCompositionLayerWrapper {
22
17
  constructor(getWidth: () => number, getHeight: () => number, layer: XRCompositionLayer, layerType: WebXRLayerType, isMultiview: boolean, createRTTProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider);
23
18
  }
24
19
  /**
@@ -28,7 +23,6 @@ export declare class WebXRWebGPUCompositionLayerWrapper extends WebXRLayerWrappe
28
23
  * @internal
29
24
  */
30
25
  export declare class WebXRWebGPUCompositionLayerRenderTargetTextureProvider extends WebXRWebGPURenderTargetTextureProvider {
31
- protected readonly _xrSessionManager: WebXRSessionManager;
32
26
  protected readonly _xrGPUBinding: XRGPUBinding;
33
27
  readonly layerWrapper: WebXRWebGPUCompositionLayerWrapper;
34
28
  protected readonly _depthStencilFormat?: GPUTextureFormat | undefined;
@@ -1,20 +1,14 @@
1
1
  import { Observable } from "../../../Misc/observable.js";
2
- import { WebXRLayerWrapper } from "../../webXRLayerWrapper.js";
3
2
  import { WebXRWebGPURenderTargetTextureProvider } from "../../webXRWebGPURenderTargetTextureProvider.js";
3
+ import { WebXRCompositionLayerWrapper } from "./WebXRCompositionLayer.js";
4
4
  /**
5
5
  * Wraps xr composition layers for the WebGPU (XRGPUBinding) backend.
6
6
  * Mirrors {@link WebXRCompositionLayerWrapper} for WebGPU.
7
7
  * @internal
8
8
  */
9
- export class WebXRWebGPUCompositionLayerWrapper extends WebXRLayerWrapper {
9
+ export class WebXRWebGPUCompositionLayerWrapper extends WebXRCompositionLayerWrapper {
10
10
  constructor(getWidth, getHeight, layer, layerType, isMultiview, createRTTProvider) {
11
- super(getWidth, getHeight, layer, layerType, createRTTProvider);
12
- this.getWidth = getWidth;
13
- this.getHeight = getHeight;
14
- this.layer = layer;
15
- this.layerType = layerType;
16
- this.isMultiview = isMultiview;
17
- this.createRTTProvider = createRTTProvider;
11
+ super(getWidth, getHeight, layer, layerType, isMultiview, createRTTProvider);
18
12
  }
19
13
  }
20
14
  /**
@@ -25,8 +19,7 @@ export class WebXRWebGPUCompositionLayerWrapper extends WebXRLayerWrapper {
25
19
  */
26
20
  export class WebXRWebGPUCompositionLayerRenderTargetTextureProvider extends WebXRWebGPURenderTargetTextureProvider {
27
21
  constructor(_xrSessionManager, _xrGPUBinding, layerWrapper, _depthStencilFormat) {
28
- super(_xrSessionManager.scene, layerWrapper);
29
- this._xrSessionManager = _xrSessionManager;
22
+ super(_xrSessionManager, layerWrapper);
30
23
  this._xrGPUBinding = _xrGPUBinding;
31
24
  this.layerWrapper = layerWrapper;
32
25
  this._depthStencilFormat = _depthStencilFormat;
@@ -1 +1 @@
1
- {"version":3,"file":"WebXRWebGPUCompositionLayer.js","sourceRoot":"","sources":["../../../../../../dev/core/src/XR/features/Layers/WebXRWebGPUCompositionLayer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAuB,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAEnF,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAIxG;;;;GAIG;AACH,MAAM,OAAO,kCAAmC,SAAQ,iBAAiB;IACrE,YACoB,QAAsB,EACtB,SAAuB,EACd,KAAyB,EACzB,SAAyB,EAClC,WAAoB,EAC7B,iBAAmG;QAE1G,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,E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qB,CAAC,QAAkB,EAAE,IAAY;QACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxF,IAAI,QAAQ,EAAE,CAAC;YACX,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { type RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { type Viewport } from \"core/Maths/math.viewport\";\nimport { Observable } from \"core/Misc/observable\";\nimport { type WebXRLayerRenderTargetTexture } from \"core/XR/webXRLayerRenderTargetTexture\";\nimport { type WebXRLayerType, WebXRLayerWrapper } from \"core/XR/webXRLayerWrapper\";\nimport { type WebXRLayerRenderTargetTextureProvider } from \"core/XR/webXRRenderTargetTextureProvider\";\nimport { WebXRWebGPURenderTargetTextureProvider } from \"core/XR/webXRWebGPURenderTargetTextureProvider\";\nimport { type WebXRSessionManager } from \"core/XR/webXRSessionManager\";\nimport { type Nullable } from \"core/types\";\n\n/**\n * Wraps xr composition layers for the WebGPU (XRGPUBinding) backend.\n * Mirrors {@link WebXRCompositionLayerWrapper} for WebGPU.\n * @internal\n */\nexport class WebXRWebGPUCompositionLayerWrapper extends WebXRLayerWrapper {\n constructor(\n public override getWidth: () => number,\n public override getHeight: () => number,\n public override readonly layer: XRCompositionLayer,\n public override readonly layerType: WebXRLayerType,\n public readonly isMultiview: boolean,\n public createRTTProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider\n ) {\n super(getWidth, getHeight, layer, layerType, createRTTProvider);\n }\n}\n\n/**\n * Provides render target textures and other important rendering information for a given XRCompositionLayer\n * on the WebGPU backend. Mirrors {@link WebXRCompositionLayerRenderTargetTextureProvider}, but wraps\n * {@link XRGPUSubImage} GPUTextures instead of WebGL textures.\n * @internal\n */\nexport class WebXRWebGPUCompositionLayerRenderTargetTextureProvider extends WebXRWebGPURenderTargetTextureProvider {\n protected _lastSubImages = new Map<XREye, XRGPUSubImage>();\n /**\n * Per-eye render targets, indexed by eye (0 = left/none, 1 = right). Kept separate from the base\n * `_renderTargetTextures` registry: that array is an append-only owned list (each entry is disposed once\n * on provider dispose), whereas this map is a mutable per-eye slot. Reusing `_renderTargetTextures` as\n * both would let a rebuilt eye target both stay in the registry (leaking / double-disposing the old one)\n * and grow the registry unboundedly on repeated size changes.\n */\n protected _renderTargetTexturesByEye: WebXRLayerRenderTargetTexture[] = [];\n private _compositionLayer: XRCompositionLayer;\n /**\n * Fires every time a new render target texture is created (either for eye, for view, or for the entire frame)\n */\n public onRenderTargetTextureCreatedObservable = new Observable<{ texture: RenderTargetTexture; eye?: XREye }>();\n\n constructor(\n protected readonly _xrSessionManager: WebXRSessionManager,\n protected readonly _xrGPUBinding: XRGPUBinding,\n public override readonly layerWrapper: WebXRWebGPUCompositionLayerWrapper,\n protected readonly _depthStencilFormat?: GPUTextureFormat\n ) {\n super(_xrSessionManager.scene, layerWrapper);\n this._compositionLayer = layerWrapper.layer;\n }\n\n protected _getRenderTargetForSubImage(subImage: XRGPUSubImage, eye: XREye = \"none\") {\n const lastSubImage = this._lastSubImages.get(eye);\n const eyeIndex = eye == \"right\" ? 1 : 0;\n\n const colorTexture = subImage.colorTexture;\n const colorTextureWidth = colorTexture.width;\n const colorTextureHeight = colorTexture.height;\n\n const depthStencilTexture = subImage.depthStencilTexture ?? null;\n\n const existingRenderTarget = this._renderTargetTexturesByEye[eyeIndex];\n const sizeChanged = !existingRenderTarget || lastSubImage?.colorTexture.width !== colorTextureWidth || lastSubImage?.colorTexture.height !== colorTextureHeight;\n\n if (sizeChanged) {\n if (existingRenderTarget) {\n // A previous target for this eye exists (the sub-image size changed, e.g. a scale-factor or\n // display-config change). Dispose it and remove it from the owned registry before creating the\n // replacement so the registry does not accumulate stale entries or double-dispose on teardown.\n this._destroyRenderTargetTexture(existingRenderTarget);\n }\n this._renderTargetTexturesByEye[eyeIndex] = this._createRenderTargetTextureFromGPUTextures(\n colorTextureWidth,\n colorTextureHeight,\n colorTexture,\n depthStencilTexture,\n this._depthStencilFormat,\n this.layerWrapper.isMultiview\n );\n\n this._framebufferDimensions = {\n framebufferWidth: colorTextureWidth,\n framebufferHeight: colorTextureHeight,\n };\n this.onRenderTargetTextureCreatedObservable.notifyObservers({ texture: this._renderTargetTexturesByEye[eyeIndex], eye });\n } else {\n // Same size: repoint the wrapped textures at this frame's GPUTextures, preserving the\n // RenderTargetTexture / InternalTexture identity held by the XR camera's outputRenderTarget.\n this._updateRenderTargetTextureFromGPUTextures(existingRenderTarget, colorTexture, depthStencilTexture);\n }\n\n this._lastSubImages.set(eye, subImage);\n\n // The projection-layer color/depth textures may be a texture ARRAY with one layer per eye\n // (depthOrArrayLayers > 1). The sub-image's view descriptor carries the authoritative array-layer\n // index for this eye, so route it into the render target's bind so each eye renders into its own\n // layer. For non-layered textures this is 0 (unchanged behavior).\n const renderTargetTexture = this._renderTargetTexturesByEye[eyeIndex];\n renderTargetTexture.layerIndex = subImage.getViewDescriptor().baseArrayLayer ?? 0;\n\n return renderTargetTexture;\n }\n\n private _getSubImageForEye(eye?: XREye): Nullable<XRGPUSubImage> {\n const currentFrame = this._xrSessionManager.currentFrame;\n if (currentFrame) {\n return this._xrGPUBinding.getSubImage(this._compositionLayer, currentFrame, eye);\n }\n return null;\n }\n\n public getRenderTargetTextureForEye(eye?: XREye): Nullable<RenderTargetTexture> {\n const subImage = this._getSubImageForEye(eye);\n if (subImage) {\n return this._getRenderTargetForSubImage(subImage, eye);\n }\n return null;\n }\n\n public getRenderTargetTextureForView(view?: XRView): Nullable<RenderTargetTexture> {\n return this.getRenderTargetTextureForEye(view?.eye);\n }\n\n protected _setViewportForSubImage(viewport: Viewport, subImage: XRGPUSubImage) {\n const textureWidth = subImage.colorTexture.width;\n const textureHeight = subImage.colorTexture.height;\n const xrViewport = subImage.viewport;\n viewport.x = xrViewport.x / textureWidth;\n viewport.y = xrViewport.y / textureHeight;\n viewport.width = xrViewport.width / textureWidth;\n viewport.height = xrViewport.height / textureHeight;\n }\n\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\n const subImage = this._lastSubImages.get(view.eye) || this._getSubImageForEye(view.eye);\n if (subImage) {\n this._setViewportForSubImage(viewport, subImage);\n return true;\n }\n return false;\n }\n}\n"]}
1
+ {"version":3,"file":"WebXRWebGPUCompositionLayer.js","sourceRoot":"","sources":["../../../../../../dev/core/src/XR/features/Layers/WebXRWebGPUCompositionLayer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAIlD,OAAO,EAAE,sCAAsC,EAAE,MAAM,gDAAgD,CAAC;AAGxG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAC;AAEvE;;;;GAIG;AACH,MAAM,OAAO,kCAAmC,SAAQ,4BAA4B;IAChF,YACI,QAAsB,EACtB,SAAuB,EACvB,KAAyB,EACzB,SAAyB,EACzB,WAAoB,EACpB,iBAAmG;QAEnG,KAAK,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,iBAAiB,CAAC,CAAC;IACjF,CAAC;CACJ;AAED;;;;;GAKG;AACH,MAAM,OAAO,sDAAuD,SAAQ,sCAAsC;IAgB9G,YACI,iBAAsC,EACnB,aAA2B,EACrB,YAAgD,EACtD,mBAAsC;QAEzD,KAAK,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC;QAJpB,kBAAa,GAAb,aAAa,CAAc;QACrB,iBAAY,GAAZ,YAAY,CAAoC;QACtD,wBAAmB,GAAnB,mBAAmB,CAAmB;QAnBnD,mBAAc,GAAG,IAAI,GAAG,EAAwB,CAAC;QAC3D;;;;;;WAMG;QACO,+BAA0B,GAAoC,EAAE,CAAC;QA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CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IACxD,CAAC;IAES,uBAAuB,CAAC,QAAkB,EAAE,QAAuB;QACzE,MAAM,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC;QACjD,MAAM,aAAa,GAAG,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;QACnD,MAAM,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACrC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,YAAY,CAAC;QACzC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,GAAG,aAAa,CAAC;QAC1C,QAAQ,CAAC,KAAK,GAAG,UAAU,CAAC,KAAK,GAAG,YAAY,CAAC;QACjD,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,MAAM,GAAG,aAAa,CAAC;IACxD,CAAC;IAEM,qBAAqB,CAAC,QAAkB,EAAE,IAAY;QACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxF,IAAI,QAAQ,EAAE,CAAC;YACX,IAAI,CAAC,uBAAuB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;YACjD,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["import { type RenderTargetTexture } from \"core/Materials/Textures/renderTargetTexture\";\nimport { type Viewport } from \"core/Maths/math.viewport\";\nimport { Observable } from \"core/Misc/observable\";\nimport { type WebXRLayerRenderTargetTexture } from \"core/XR/webXRLayerRenderTargetTexture\";\nimport { type WebXRLayerType } from \"core/XR/webXRLayerWrapper\";\nimport { type WebXRLayerRenderTargetTextureProvider } from \"core/XR/webXRRenderTargetTextureProvider\";\nimport { WebXRWebGPURenderTargetTextureProvider } from \"core/XR/webXRWebGPURenderTargetTextureProvider\";\nimport { type WebXRSessionManager } from \"core/XR/webXRSessionManager\";\nimport { type Nullable } from \"core/types\";\nimport { WebXRCompositionLayerWrapper } from \"./WebXRCompositionLayer\";\n\n/**\n * Wraps xr composition layers for the WebGPU (XRGPUBinding) backend.\n * Mirrors {@link WebXRCompositionLayerWrapper} for WebGPU.\n * @internal\n */\nexport class WebXRWebGPUCompositionLayerWrapper extends WebXRCompositionLayerWrapper {\n constructor(\n getWidth: () => number,\n getHeight: () => number,\n layer: XRCompositionLayer,\n layerType: WebXRLayerType,\n isMultiview: boolean,\n createRTTProvider: (xrSessionManager: WebXRSessionManager) => WebXRLayerRenderTargetTextureProvider\n ) {\n super(getWidth, getHeight, layer, layerType, isMultiview, createRTTProvider);\n }\n}\n\n/**\n * Provides render target textures and other important rendering information for a given XRCompositionLayer\n * on the WebGPU backend. Mirrors {@link WebXRCompositionLayerRenderTargetTextureProvider}, but wraps\n * {@link XRGPUSubImage} GPUTextures instead of WebGL textures.\n * @internal\n */\nexport class WebXRWebGPUCompositionLayerRenderTargetTextureProvider extends WebXRWebGPURenderTargetTextureProvider {\n protected _lastSubImages = new Map<XREye, XRGPUSubImage>();\n /**\n * Per-eye render targets, indexed by eye (0 = left/none, 1 = right). Kept separate from the base\n * `_renderTargetTextures` registry: that array is an append-only owned list (each entry is disposed once\n * on provider dispose), whereas this map is a mutable per-eye slot. Reusing `_renderTargetTextures` as\n * both would let a rebuilt eye target both stay in the registry (leaking / double-disposing the old one)\n * and grow the registry unboundedly on repeated size changes.\n */\n protected _renderTargetTexturesByEye: WebXRLayerRenderTargetTexture[] = [];\n private _compositionLayer: XRCompositionLayer;\n /**\n * Fires every time a new render target texture is created (either for eye, for view, or for the entire frame)\n */\n public onRenderTargetTextureCreatedObservable = new Observable<{ texture: RenderTargetTexture; eye?: XREye }>();\n\n constructor(\n _xrSessionManager: WebXRSessionManager,\n protected readonly _xrGPUBinding: XRGPUBinding,\n public override readonly layerWrapper: WebXRWebGPUCompositionLayerWrapper,\n protected readonly _depthStencilFormat?: GPUTextureFormat\n ) {\n super(_xrSessionManager, layerWrapper);\n this._compositionLayer = layerWrapper.layer;\n }\n\n protected _getRenderTargetForSubImage(subImage: XRGPUSubImage, eye: XREye = \"none\") {\n const lastSubImage = this._lastSubImages.get(eye);\n const eyeIndex = eye == \"right\" ? 1 : 0;\n\n const colorTexture = subImage.colorTexture;\n const colorTextureWidth = colorTexture.width;\n const colorTextureHeight = colorTexture.height;\n\n const depthStencilTexture = subImage.depthStencilTexture ?? null;\n\n const existingRenderTarget = this._renderTargetTexturesByEye[eyeIndex];\n const sizeChanged = !existingRenderTarget || lastSubImage?.colorTexture.width !== colorTextureWidth || lastSubImage?.colorTexture.height !== colorTextureHeight;\n\n if (sizeChanged) {\n if (existingRenderTarget) {\n // A previous target for this eye exists (the sub-image size changed, e.g. a scale-factor or\n // display-config change). Dispose it and remove it from the owned registry before creating the\n // replacement so the registry does not accumulate stale entries or double-dispose on teardown.\n this._destroyRenderTargetTexture(existingRenderTarget);\n }\n this._renderTargetTexturesByEye[eyeIndex] = this._createRenderTargetTextureFromGPUTextures(\n colorTextureWidth,\n colorTextureHeight,\n colorTexture,\n depthStencilTexture,\n this._depthStencilFormat,\n this.layerWrapper.isMultiview\n );\n\n this._framebufferDimensions = {\n framebufferWidth: colorTextureWidth,\n framebufferHeight: colorTextureHeight,\n };\n this.onRenderTargetTextureCreatedObservable.notifyObservers({ texture: this._renderTargetTexturesByEye[eyeIndex], eye });\n } else {\n // Same size: repoint the wrapped textures at this frame's GPUTextures, preserving the\n // RenderTargetTexture / InternalTexture identity held by the XR camera's outputRenderTarget.\n this._updateRenderTargetTextureFromGPUTextures(existingRenderTarget, colorTexture, depthStencilTexture);\n }\n\n this._lastSubImages.set(eye, subImage);\n\n // The projection-layer color/depth textures may be a texture ARRAY with one layer per eye\n // (depthOrArrayLayers > 1). The sub-image's view descriptor carries the authoritative array-layer\n // index for this eye, so route it into the render target's bind so each eye renders into its own\n // layer. For non-layered textures this is 0 (unchanged behavior).\n const renderTargetTexture = this._renderTargetTexturesByEye[eyeIndex];\n renderTargetTexture.layerIndex = subImage.getViewDescriptor().baseArrayLayer ?? 0;\n\n return renderTargetTexture;\n }\n\n private _getSubImageForEye(eye?: XREye): Nullable<XRGPUSubImage> {\n const currentFrame = this._xrSessionManager.currentFrame;\n if (currentFrame) {\n return this._xrGPUBinding.getSubImage(this._compositionLayer, currentFrame, eye);\n }\n return null;\n }\n\n public getRenderTargetTextureForEye(eye?: XREye): Nullable<RenderTargetTexture> {\n const subImage = this._getSubImageForEye(eye);\n if (subImage) {\n return this._getRenderTargetForSubImage(subImage, eye);\n }\n return null;\n }\n\n public getRenderTargetTextureForView(view?: XRView): Nullable<RenderTargetTexture> {\n return this.getRenderTargetTextureForEye(view?.eye);\n }\n\n protected _setViewportForSubImage(viewport: Viewport, subImage: XRGPUSubImage) {\n const textureWidth = subImage.colorTexture.width;\n const textureHeight = subImage.colorTexture.height;\n const xrViewport = subImage.viewport;\n viewport.x = xrViewport.x / textureWidth;\n viewport.y = xrViewport.y / textureHeight;\n viewport.width = xrViewport.width / textureWidth;\n viewport.height = xrViewport.height / textureHeight;\n }\n\n public trySetViewportForView(viewport: Viewport, view: XRView): boolean {\n const subImage = this._lastSubImages.get(view.eye) || this._getSubImageForEye(view.eye);\n if (subImage) {\n this._setViewportForSubImage(viewport, subImage);\n return true;\n }\n return false;\n }\n}\n"]}
@@ -9,6 +9,7 @@ import { type WebXRSessionManager } from "../webXRSessionManager.js";
9
9
  export declare abstract class WebXRAbstractFeature implements IWebXRFeature {
10
10
  protected _xrSessionManager: WebXRSessionManager;
11
11
  private _attached;
12
+ private _disableAutoAttachWarningEmitted;
12
13
  private _removeOnDetach;
13
14
  /**
14
15
  * Is this feature disposed?
@@ -18,6 +19,8 @@ export declare abstract class WebXRAbstractFeature implements IWebXRFeature {
18
19
  * Should auto-attach be disabled?
19
20
  */
20
21
  disableAutoAttach: boolean;
22
+ /** @internal */
23
+ _autoAttachPolicyBeforeAttach?: boolean;
21
24
  protected _xrNativeFeatureName: string;
22
25
  /**
23
26
  * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)
@@ -69,6 +72,12 @@ export declare abstract class WebXRAbstractFeature implements IWebXRFeature {
69
72
  * @returns whether or not the feature is compatible in this environment
70
73
  */
71
74
  isCompatible(): boolean;
75
+ /**
76
+ * Disables future automatic attachment when a runtime capability required by the feature is unavailable.
77
+ * @param warning the specific warning explaining why the feature was disabled
78
+ * @returns false so feature attach implementations can return the result directly
79
+ */
80
+ protected _disableAutoAttach(warning: string): false;
72
81
  /**
73
82
  * This is used to register callbacks that will automatically be removed when detach is called.
74
83
  * @param observable the observable to which the observer will be attached
@@ -1,3 +1,4 @@
1
+ import { _MarkWebXRFeatureWithSpecificDisableWarning } from "../webXRFeatureWarningRegistry.js";
1
2
  import { Observable } from "../../Misc/observable.js";
2
3
  import { Logger } from "../../Misc/logger.js";
3
4
  /**
@@ -26,6 +27,7 @@ export class WebXRAbstractFeature {
26
27
  constructor(_xrSessionManager) {
27
28
  this._xrSessionManager = _xrSessionManager;
28
29
  this._attached = false;
30
+ this._disableAutoAttachWarningEmitted = false;
29
31
  this._removeOnDetach = [];
30
32
  /**
31
33
  * Is this feature disposed?
@@ -122,6 +124,20 @@ export class WebXRAbstractFeature {
122
124
  isCompatible() {
123
125
  return true;
124
126
  }
127
+ /**
128
+ * Disables future automatic attachment when a runtime capability required by the feature is unavailable.
129
+ * @param warning the specific warning explaining why the feature was disabled
130
+ * @returns false so feature attach implementations can return the result directly
131
+ */
132
+ _disableAutoAttach(warning) {
133
+ if (!this._disableAutoAttachWarningEmitted) {
134
+ Logger.Warn(warning);
135
+ this._disableAutoAttachWarningEmitted = true;
136
+ }
137
+ _MarkWebXRFeatureWithSpecificDisableWarning(this);
138
+ this.disableAutoAttach = true;
139
+ return false;
140
+ }
125
141
  /**
126
142
  * This is used to register callbacks that will automatically be removed when detach is called.
127
143
  * @param observable the observable to which the observer will be attached
@@ -1 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CAAC;QACvB,KAAK,MAAM,QAAQ,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;YAC1C,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,CAAC,yBAAyB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;OAEG;IACI,OAAO;QACV,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;QACvC,IAAI,CAAC,yBAAyB,CAAC,KAAK,EAAE,CAAC;IAC3C,CAAC;IAED;;;;;OAKG;IACI,YAAY;QACf,OAAO,IAAI,CAAC;IAChB,CAAC;IAED;;;;;OAKG;IACO,qBAAqB,CAAI,UAAyB,EAAE,QAAwD,EAAE,WAAqB;QACzI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC;YACtB,UAAU;YACV,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,CAAC;SAC7D,CAAC,CAAC;IACP,CAAC;CAQJ","sourcesContent":["import { type IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { type Observer, type EventState, Observable } from \"../../Misc/observable\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * This is the base class for all WebXR features.\r\n * Since most features require almost the same resources and callbacks, this class can be used to simplify the development\r\n * Note that since the features manager is using the `IWebXRFeature` you are in no way obligated to use this class\r\n */\r\nexport abstract class WebXRAbstractFeature implements IWebXRFeature {\r\n private _attached: boolean = false;\r\n private _removeOnDetach: {\r\n observer: Nullable<Observer<any>>;\r\n observable: Observable<any>;\r\n }[] = [];\r\n\r\n /**\r\n * Is this feature disposed?\r\n */\r\n public isDisposed: boolean = false;\r\n\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n public disableAutoAttach: boolean = false;\r\n\r\n protected _xrNativeFeatureName: string = \"\";\r\n\r\n /**\r\n * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)\r\n */\r\n public get xrNativeFeatureName() {\r\n return this._xrNativeFeatureName;\r\n }\r\n\r\n public set xrNativeFeatureName(name: string) {\r\n // check if feature was initialized while in session but needs to be initialized before the session starts\r\n if (!this._xrSessionManager.isNative && name && this._xrSessionManager.inXRSession && this._xrSessionManager.enabledFeatures?.indexOf(name) === -1) {\r\n Logger.Warn(`The feature ${name} needs to be enabled before starting the XR session. Note - It is still possible it is not supported.`);\r\n }\r\n this._xrNativeFeatureName = name;\r\n }\r\n\r\n /**\r\n * Observers registered here will be executed when the feature is attached\r\n */\r\n public onFeatureAttachObservable: Observable<IWebXRFeature> = new Observable();\r\n /**\r\n * Observers registered here will be executed when the feature is detached\r\n */\r\n public onFeatureDetachObservable: Observable<IWebXRFeature> = new Observable();\r\n\r\n /**\r\n * The dependencies of this feature, if any\r\n */\r\n public dependsOn?: string[];\r\n\r\n /**\r\n * Construct a new (abstract) WebXR feature\r\n * @param _xrSessionManager the xr session manager for this feature\r\n */\r\n constructor(protected _xrSessionManager: WebXRSessionManager) {}\r\n\r\n /**\r\n * Is this feature attached\r\n */\r\n public get attached() {\r\n return this._attached;\r\n }\r\n\r\n /**\r\n * attach this feature\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful, false is failed or already attached\r\n */\r\n public attach(force?: boolean): boolean {\r\n // do not attach a disposed feature\r\n if (this.isDisposed) {\r\n return false;\r\n }\r\n if (!force) {\r\n if (this.attached) {\r\n return false;\r\n }\r\n } else {\r\n if (this.attached) {\r\n // detach first, to be sure\r\n this.detach();\r\n }\r\n }\r\n\r\n // if this is a native WebXR feature, check if it is enabled on the session\r\n // For now only check if not using babylon native\r\n // vision OS doesn't support the enabledFeatures array, so just warn instead of failing\r\n if (!this._xrSessionManager.enabledFeatures) {\r\n Logger.Warn(\"session.enabledFeatures is not available on this device. It is possible that this feature is not supported.\");\r\n } else if (!this._xrSessionManager.isNative && this.xrNativeFeatureName && this._xrSessionManager.enabledFeatures.indexOf(this.xrNativeFeatureName) === -1) {\r\n return false;\r\n }\r\n\r\n this._attached = true;\r\n this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, (frame) => this._onXRFrame(frame));\r\n this.onFeatureAttachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n *\r\n * @returns true if successful, false if failed or already detached\r\n */\r\n public detach(): boolean {\r\n if (!this._attached) {\r\n this.disableAutoAttach = true;\r\n return false;\r\n }\r\n this._attached = false;\r\n for (const toRemove of this._removeOnDetach) {\r\n toRemove.observable.remove(toRemove.observer);\r\n }\r\n this.onFeatureDetachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.isDisposed = true;\r\n this.onFeatureAttachObservable.clear();\r\n this.onFeatureDetachObservable.clear();\r\n }\r\n\r\n /**\r\n * This function will be executed during before enabling the feature and can be used to not-allow enabling it.\r\n * Note that at this point the session has NOT started, so this is purely checking if the browser supports it\r\n *\r\n * @returns whether or not the feature is compatible in this environment\r\n */\r\n public isCompatible(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * This is used to register callbacks that will automatically be removed when detach is called.\r\n * @param observable the observable to which the observer will be attached\r\n * @param callback the callback to register\r\n * @param insertFirst should the callback be executed as soon as it is registered\r\n */\r\n protected _addNewAttachObserver<T>(observable: Observable<T>, callback: (eventData: T, eventState: EventState) => void, insertFirst?: boolean) {\r\n this._removeOnDetach.push({\r\n observable,\r\n observer: observable.add(callback, undefined, insertFirst),\r\n });\r\n }\r\n\r\n /**\r\n * Code in this function will be executed on each xrFrame received from the browser.\r\n * This function will not execute after the feature is detached.\r\n * @param _xrFrame the current frame\r\n */\r\n protected abstract _onXRFrame(_xrFrame: XRFrame): void;\r\n}\r\n"]}
1
+ {"version":3,"file":"WebXRAbstractFeature.js","sourceRoot":"","sources":["../../../../../dev/core/src/XR/features/WebXRAbstractFeature.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,2CAA2C,EAAE,MAAM,gCAAgC,CAAC;AAC7F,OAAO,EAAkC,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnF,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;;;GAIG;AACH,MAAM,OAAgB,oBAAoB;IAuBtC;;OAEG;IACH,IAAW,mBAAmB;QAC1B,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACrC,CAAC;IAED,IAAW,mBAAmB,CAAC,IAAY;QACvC,0GAA0G;QAC1G,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,QAAQ,IAAI,IAAI,IAAI,IAAI,CAAC,iBAAiB,CAAC,WAAW,IAAI,IAAI,CAAC,iBAAiB,CAAC,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;YACjJ,MAAM,CAAC,IAAI,CAAC,eAAe,IAAI,uGAAuG,CAAC,CAAC;QAC5I,CAAC;QACD,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACrC,CAAC;IAgBD;;;OAGG;IACH,YAAsB,iBAAsC;QAAtC,sBAAiB,GAAjB,iBAAiB,CAAqB;QAvDpD,cAAS,GAAY,KAAK,CAAC;QAC3B,qCAAgC,GAAY,KAAK,CAAC;QAClD,oBAAe,GAGjB,EAAE,CAAC;QAET;;WAEG;QACI,eAAU,GAAY,KAAK,CAAC;QAEnC;;WAEG;QACI,sBAAiB,GAAY,KAAK,CAAC;QAKhC,yBAAoB,GAAW,EAAE,CAAC;QAiB5C;;WAEG;QACI,8BAAyB,GAA8B,IAAI,UAAU,EAAE,CAAC;QAC/E;;WAEG;QACI,8BAAyB,GAA8B,IAAI,UAA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Content":["import { type IWebXRFeature } from \"../webXRFeaturesManager\";\r\nimport { _MarkWebXRFeatureWithSpecificDisableWarning } from \"../webXRFeatureWarningRegistry\";\r\nimport { type Observer, type EventState, Observable } from \"../../Misc/observable\";\r\nimport { type Nullable } from \"../../types\";\r\nimport { type WebXRSessionManager } from \"../webXRSessionManager\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * This is the base class for all WebXR features.\r\n * Since most features require almost the same resources and callbacks, this class can be used to simplify the development\r\n * Note that since the features manager is using the `IWebXRFeature` you are in no way obligated to use this class\r\n */\r\nexport abstract class WebXRAbstractFeature implements IWebXRFeature {\r\n private _attached: boolean = false;\r\n private _disableAutoAttachWarningEmitted: boolean = false;\r\n private _removeOnDetach: {\r\n observer: Nullable<Observer<any>>;\r\n observable: Observable<any>;\r\n }[] = [];\r\n\r\n /**\r\n * Is this feature disposed?\r\n */\r\n public isDisposed: boolean = false;\r\n\r\n /**\r\n * Should auto-attach be disabled?\r\n */\r\n public disableAutoAttach: boolean = false;\r\n\r\n /** @internal */\r\n public _autoAttachPolicyBeforeAttach?: boolean;\r\n\r\n protected _xrNativeFeatureName: string = \"\";\r\n\r\n /**\r\n * The name of the native xr feature name (like anchor, hit-test, or hand-tracking)\r\n */\r\n public get xrNativeFeatureName() {\r\n return this._xrNativeFeatureName;\r\n }\r\n\r\n public set xrNativeFeatureName(name: string) {\r\n // check if feature was initialized while in session but needs to be initialized before the session starts\r\n if (!this._xrSessionManager.isNative && name && this._xrSessionManager.inXRSession && this._xrSessionManager.enabledFeatures?.indexOf(name) === -1) {\r\n Logger.Warn(`The feature ${name} needs to be enabled before starting the XR session. Note - It is still possible it is not supported.`);\r\n }\r\n this._xrNativeFeatureName = name;\r\n }\r\n\r\n /**\r\n * Observers registered here will be executed when the feature is attached\r\n */\r\n public onFeatureAttachObservable: Observable<IWebXRFeature> = new Observable();\r\n /**\r\n * Observers registered here will be executed when the feature is detached\r\n */\r\n public onFeatureDetachObservable: Observable<IWebXRFeature> = new Observable();\r\n\r\n /**\r\n * The dependencies of this feature, if any\r\n */\r\n public dependsOn?: string[];\r\n\r\n /**\r\n * Construct a new (abstract) WebXR feature\r\n * @param _xrSessionManager the xr session manager for this feature\r\n */\r\n constructor(protected _xrSessionManager: WebXRSessionManager) {}\r\n\r\n /**\r\n * Is this feature attached\r\n */\r\n public get attached() {\r\n return this._attached;\r\n }\r\n\r\n /**\r\n * attach this feature\r\n *\r\n * @param force should attachment be forced (even when already attached)\r\n * @returns true if successful, false is failed or already attached\r\n */\r\n public attach(force?: boolean): boolean {\r\n // do not attach a disposed feature\r\n if (this.isDisposed) {\r\n return false;\r\n }\r\n if (!force) {\r\n if (this.attached) {\r\n return false;\r\n }\r\n } else {\r\n if (this.attached) {\r\n // detach first, to be sure\r\n this.detach();\r\n }\r\n }\r\n\r\n // if this is a native WebXR feature, check if it is enabled on the session\r\n // For now only check if not using babylon native\r\n // vision OS doesn't support the enabledFeatures array, so just warn instead of failing\r\n if (!this._xrSessionManager.enabledFeatures) {\r\n Logger.Warn(\"session.enabledFeatures is not available on this device. It is possible that this feature is not supported.\");\r\n } else if (!this._xrSessionManager.isNative && this.xrNativeFeatureName && this._xrSessionManager.enabledFeatures.indexOf(this.xrNativeFeatureName) === -1) {\r\n return false;\r\n }\r\n\r\n this._attached = true;\r\n this._addNewAttachObserver(this._xrSessionManager.onXRFrameObservable, (frame) => this._onXRFrame(frame));\r\n this.onFeatureAttachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * detach this feature.\r\n *\r\n * @returns true if successful, false if failed or already detached\r\n */\r\n public detach(): boolean {\r\n if (!this._attached) {\r\n this.disableAutoAttach = true;\r\n return false;\r\n }\r\n this._attached = false;\r\n for (const toRemove of this._removeOnDetach) {\r\n toRemove.observable.remove(toRemove.observer);\r\n }\r\n this.onFeatureDetachObservable.notifyObservers(this);\r\n return true;\r\n }\r\n\r\n /**\r\n * Dispose this feature and all of the resources attached\r\n */\r\n public dispose(): void {\r\n this.detach();\r\n this.isDisposed = true;\r\n this.onFeatureAttachObservable.clear();\r\n this.onFeatureDetachObservable.clear();\r\n }\r\n\r\n /**\r\n * This function will be executed during before enabling the feature and can be used to not-allow enabling it.\r\n * Note that at this point the session has NOT started, so this is purely checking if the browser supports it\r\n *\r\n * @returns whether or not the feature is compatible in this environment\r\n */\r\n public isCompatible(): boolean {\r\n return true;\r\n }\r\n\r\n /**\r\n * Disables future automatic attachment when a runtime capability required by the feature is unavailable.\r\n * @param warning the specific warning explaining why the feature was disabled\r\n * @returns false so feature attach implementations can return the result directly\r\n */\r\n protected _disableAutoAttach(warning: string): false {\r\n if (!this._disableAutoAttachWarningEmitted) {\r\n Logger.Warn(warning);\r\n this._disableAutoAttachWarningEmitted = true;\r\n }\r\n _MarkWebXRFeatureWithSpecificDisableWarning(this);\r\n this.disableAutoAttach = true;\r\n return false;\r\n }\r\n\r\n /**\r\n * This is used to register callbacks that will automatically be removed when detach is called.\r\n * @param observable the observable to which the observer will be attached\r\n * @param callback the callback to register\r\n * @param insertFirst should the callback be executed as soon as it is registered\r\n */\r\n protected _addNewAttachObserver<T>(observable: Observable<T>, callback: (eventData: T, eventState: EventState) => void, insertFirst?: boolean) {\r\n this._removeOnDetach.push({\r\n observable,\r\n observer: observable.add(callback, undefined, insertFirst),\r\n });\r\n }\r\n\r\n /**\r\n * Code in this function will be executed on each xrFrame received from the browser.\r\n * This function will not execute after the feature is detached.\r\n * @param _xrFrame the current frame\r\n */\r\n protected abstract _onXRFrame(_xrFrame: XRFrame): void;\r\n}\r\n"]}
@@ -52,7 +52,12 @@ export declare class WebXRDepthSensing extends WebXRAbstractFeature {
52
52
  private _cachedDepthBuffer;
53
53
  private _cachedWebGLTexture;
54
54
  private _cachedDepthImageTexture;
55
+ private _cachedDepthImageTextureWrapsExternalTexture;
56
+ private _cpuDepthViewStates;
57
+ private _disableAutoAttachBeforeWebGPUGPUDepth;
58
+ private _disabledForWebGPUGPUDepth;
55
59
  private _onCameraObserver;
60
+ private _onSessionEndedObserver;
56
61
  /**
57
62
  * Width of depth data. If depth data is not exist, returns null.
58
63
  */
@@ -130,6 +135,8 @@ export declare class WebXRDepthSensing extends WebXRAbstractFeature {
130
135
  dispose(): void;
131
136
  protected _onXRFrame(_xrFrame: XRFrame): void;
132
137
  private _updateDepthInformationAndTextureCPUDepthUsage;
138
+ private _clearCPUDepthBinding;
139
+ private _bindCPUDepthView;
133
140
  private _updateDepthInformationAndTextureWebGLDepthUsage;
134
141
  /**
135
142
  * Extends the session init object if needed