@galacean/engine-xr-webxr 1.5.15 → 1.5.16

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.
package/dist/browser.js CHANGED
@@ -226,7 +226,8 @@
226
226
  /**
227
227
  * @internal
228
228
  */ _proto._onUpdate = function _onUpdate() {
229
- var _this__xrManager_inputManager = this._xrManager.inputManager, cameras = _this__xrManager_inputManager._cameras;
229
+ var cameras = this._xrManager.inputManager._cameras;
230
+ var platformSession = this._xrManager.sessionManager._platformSession;
230
231
  for(var i = 0, n = cameras.length; i < n; i++){
231
232
  var cameraDevice = cameras[i];
232
233
  var camera = cameraDevice._camera;
@@ -246,11 +247,22 @@
246
247
  if (!engine.Matrix.equals(camera.projectionMatrix, cameraDevice.projectionMatrix)) {
247
248
  camera.projectionMatrix = cameraDevice.projectionMatrix;
248
249
  }
250
+ // sync pixel viewport (only when rendering to XR main framebuffer)
251
+ if (!camera.renderTarget) {
252
+ // @ts-ignore
253
+ camera._adjustPixelViewport(platformSession.framebufferWidth, platformSession.framebufferHeight);
254
+ }
249
255
  }
250
256
  };
251
257
  /**
252
258
  * @internal
253
- */ _proto._onSessionExit = function _onSessionExit() {};
259
+ */ _proto._onSessionExit = function _onSessionExit() {
260
+ var cameras = this._xrManager.inputManager._cameras;
261
+ for(var i = 0, n = cameras.length; i < n; i++){
262
+ var _cameras_i__camera;
263
+ (_cameras_i__camera = cameras[i]._camera) == null ? void 0 : _cameras_i__camera._updatePixelViewport();
264
+ }
265
+ };
254
266
  /**
255
267
  * @internal
256
268
  */ _proto._getIgnoreClearFlags = function _getIgnoreClearFlags(cameraType) {
@@ -4763,7 +4775,8 @@
4763
4775
  var options = {
4764
4776
  requiredFeatures: [
4765
4777
  "local"
4766
- ]
4778
+ ],
4779
+ optionalFeatures: []
4767
4780
  };
4768
4781
  var promiseArr = [];
4769
4782
  for(var i = 0, n = platformFeatures.length; i < n; i++){
@@ -4900,7 +4913,7 @@
4900
4913
  /**
4901
4914
  * @internal
4902
4915
  */ _proto._assembleOptions = function _assembleOptions(options) {
4903
- options.requiredFeatures.push("anchors");
4916
+ options.optionalFeatures.push("anchors");
4904
4917
  };
4905
4918
  _proto._addAnchor = function _addAnchor(session, frame, requestTracking) {
4906
4919
  if (!session || !frame) {
@@ -5017,7 +5030,7 @@
5017
5030
  /**
5018
5031
  * @internal
5019
5032
  */ _proto._assembleOptions = function _assembleOptions(options) {
5020
- options.requiredFeatures.push("image-tracking");
5033
+ options.optionalFeatures.push("image-tracking");
5021
5034
  var _this = this, images = _this._images;
5022
5035
  var promiseArr = [];
5023
5036
  if (images) {
@@ -5130,7 +5143,7 @@
5130
5143
  /**
5131
5144
  * @internal
5132
5145
  */ _proto._assembleOptions = function _assembleOptions(options) {
5133
- options.requiredFeatures.push("plane-detection");
5146
+ options.optionalFeatures.push("plane-detection");
5134
5147
  };
5135
5148
  _proto._updatePlane = function _updatePlane(frame, space, trackedPlane) {
5136
5149
  var pose = trackedPlane.pose, polygon = trackedPlane.polygon, xrPlane = trackedPlane.xrPlane;