3fbe55b7a45ee94534955c16514b32832711fe2b4032dd0734d8fbc0b41130e0.json 8.0 KB

1
  1. {"ast":null,"code":"import { WebXRLayerWrapper } from \"./webXRLayerWrapper.js\";\nimport { WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider.js\";\n/**\n * Wraps xr webgl layers.\n * @internal\n */\nexport class WebXRWebGLLayerWrapper extends WebXRLayerWrapper {\n /**\n * @param layer is the layer to be wrapped.\n * @returns a new WebXRLayerWrapper wrapping the provided XRWebGLLayer.\n */\n constructor(layer) {\n super(() => layer.framebufferWidth, () => layer.framebufferHeight, layer, \"XRWebGLLayer\", sessionManager => new WebXRWebGLLayerRenderTargetTextureProvider(sessionManager.scene, this));\n this.layer = layer;\n }\n}\n/**\n * Provides render target textures and other important rendering information for a given XRWebGLLayer.\n * @internal\n */\nexport class WebXRWebGLLayerRenderTargetTextureProvider extends WebXRLayerRenderTargetTextureProvider {\n constructor(scene, layerWrapper) {\n super(scene, layerWrapper);\n this.layerWrapper = layerWrapper;\n this._layer = layerWrapper.layer;\n this._framebufferDimensions = {\n framebufferWidth: this._layer.framebufferWidth,\n framebufferHeight: this._layer.framebufferHeight\n };\n }\n trySetViewportForView(viewport, view) {\n const xrViewport = this._layer.getViewport(view);\n if (!xrViewport) {\n return false;\n }\n const framebufferWidth = this._framebufferDimensions.framebufferWidth;\n const framebufferHeight = this._framebufferDimensions.framebufferHeight;\n viewport.x = xrViewport.x / framebufferWidth;\n viewport.y = xrViewport.y / framebufferHeight;\n viewport.width = xrViewport.width / framebufferWidth;\n viewport.height = xrViewport.height / framebufferHeight;\n return true;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getRenderTargetTextureForEye(eye) {\n const layerWidth = this._layer.framebufferWidth;\n const layerHeight = this._layer.framebufferHeight;\n const framebuffer = this._layer.framebuffer;\n if (!this._rtt || layerWidth !== this._framebufferDimensions.framebufferWidth || layerHeight !== this._framebufferDimensions.framebufferHeight || framebuffer !== this._framebuffer) {\n this._rtt = this._createRenderTargetTexture(layerWidth, layerHeight, framebuffer);\n this._framebufferDimensions.framebufferWidth = layerWidth;\n this._framebufferDimensions.framebufferHeight = layerHeight;\n this._framebuffer = framebuffer;\n }\n return this._rtt;\n }\n getRenderTargetTextureForView(view) {\n return this.getRenderTargetTextureForEye(view.eye);\n }\n}","map":{"version":3,"names":["WebXRLayerWrapper","WebXRLayerRenderTargetTextureProvider","WebXRWebGLLayerWrapper","constructor","layer","framebufferWidth","framebufferHeight","sessionManager","WebXRWebGLLayerRenderTargetTextureProvider","scene","layerWrapper","_layer","_framebufferDimensions","trySetViewportForView","viewport","view","xrViewport","getViewport","x","y","width","height","getRenderTargetTextureForEye","eye","layerWidth","layerHeight","framebuffer","_rtt","_framebuffer","_createRenderTargetTexture","getRenderTargetTextureForView"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/XR/webXRWebGLLayer.js"],"sourcesContent":["import { WebXRLayerWrapper } from \"./webXRLayerWrapper.js\";\nimport { WebXRLayerRenderTargetTextureProvider } from \"./webXRRenderTargetTextureProvider.js\";\n/**\n * Wraps xr webgl layers.\n * @internal\n */\nexport class WebXRWebGLLayerWrapper extends WebXRLayerWrapper {\n /**\n * @param layer is the layer to be wrapped.\n * @returns a new WebXRLayerWrapper wrapping the provided XRWebGLLayer.\n */\n constructor(layer) {\n super(() => layer.framebufferWidth, () => layer.framebufferHeight, layer, \"XRWebGLLayer\", (sessionManager) => new WebXRWebGLLayerRenderTargetTextureProvider(sessionManager.scene, this));\n this.layer = layer;\n }\n}\n/**\n * Provides render target textures and other important rendering information for a given XRWebGLLayer.\n * @internal\n */\nexport class WebXRWebGLLayerRenderTargetTextureProvider extends WebXRLayerRenderTargetTextureProvider {\n constructor(scene, layerWrapper) {\n super(scene, layerWrapper);\n this.layerWrapper = layerWrapper;\n this._layer = layerWrapper.layer;\n this._framebufferDimensions = {\n framebufferWidth: this._layer.framebufferWidth,\n framebufferHeight: this._layer.framebufferHeight,\n };\n }\n trySetViewportForView(viewport, view) {\n const xrViewport = this._layer.getViewport(view);\n if (!xrViewport) {\n return false;\n }\n const framebufferWidth = this._framebufferDimensions.framebufferWidth;\n const framebufferHeight = this._framebufferDimensions.framebufferHeight;\n viewport.x = xrViewport.x / framebufferWidth;\n viewport.y = xrViewport.y / framebufferHeight;\n viewport.width = xrViewport.width / framebufferWidth;\n viewport.height = xrViewport.height / framebufferHeight;\n return true;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n getRenderTargetTextureForEye(eye) {\n const layerWidth = this._layer.framebufferWidth;\n const layerHeight = this._layer.framebufferHeight;\n const framebuffer = this._layer.framebuffer;\n if (!this._rtt ||\n layerWidth !== this._framebufferDimensions.framebufferWidth ||\n layerHeight !== this._framebufferDimensions.framebufferHeight ||\n framebuffer !== this._framebuffer) {\n this._rtt = this._createRenderTargetTexture(layerWidth, layerHeight, framebuffer);\n this._framebufferDimensions.framebufferWidth = layerWidth;\n this._framebufferDimensions.framebufferHeight = layerHeight;\n this._framebuffer = framebuffer;\n }\n return this._rtt;\n }\n getRenderTargetTextureForView(view) {\n return this.getRenderTargetTextureForEye(view.eye);\n }\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,qCAAqC,QAAQ,uCAAuC;AAC7F;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,SAASF,iBAAiB,CAAC;EAC1D;AACJ;AACA;AACA;EACIG,WAAWA,CAACC,KAAK,EAAE;IACf,KAAK,CAAC,MAAMA,KAAK,CAACC,gBAAgB,EAAE,MAAMD,KAAK,CAACE,iBAAiB,EAAEF,KAAK,EAAE,cAAc,EAAGG,cAAc,IAAK,IAAIC,0CAA0C,CAACD,cAAc,CAACE,KAAK,EAAE,IAAI,CAAC,CAAC;IACzL,IAAI,CAACL,KAAK,GAAGA,KAAK;EACtB;AACJ;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMI,0CAA0C,SAASP,qCAAqC,CAAC;EA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