Skip to content

Commit

Permalink
WebXR Fixed Foveation (#6078)
Browse files Browse the repository at this point in the history
* webxr fixed foveation

* fixed foveation + anti-aliasing warning
  • Loading branch information
Maksims committed Feb 22, 2024
1 parent 2d1df64 commit 5c5fe16
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/framework/xr/xr-manager.js
Expand Up @@ -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.
*
Expand Down

0 comments on commit 5c5fe16

Please sign in to comment.