diff --git a/src/framework/xr/xr-manager.js b/src/framework/xr/xr-manager.js index 03d10a18067..f992730b932 100644 --- a/src/framework/xr/xr-manager.js +++ b/src/framework/xr/xr-manager.js @@ -1018,6 +1018,34 @@ class XrManager extends EventHandler { return this._framebufferScaleFactor; } + /** + * Set fixed foveation to the value between 0 and 1. Where 0 - no foveation, and 1 - highest + * foveation. It only can be set during an active XR session. + * Fixed foveation will reduce the resolution of the back buffer at the edges of the sceen, + * which can improve rendering performance. + * + * @type {number} + */ + set fixedFoveation(value) { + if ((this._baseLayer?.fixedFoveation ?? null) !== null) { + if (this.app.graphicsDevice.samples > 1) { + Debug.warn('Fixed Foveation is ignored. Disable anti-aliasing for it to be effective.'); + } + + this._baseLayer.fixedFoveation = value; + } + } + + /** + * Current fixed foveation level, which is between 0 and 1. 0 - no forveation, and 1 - highest + * foveation. If fixed foveation is not supported, this value returns null. + * + * @type {number|null} + */ + get fixedFoveation() { + return this._baseLayer?.fixedFoveation ?? null; + } + /** * Active camera for which XR session is running or null. *