David Catuhe il y a 5 ans
Parent
commit
f6012e79eb

+ 2 - 2
Playground/babylon.d.txt

@@ -40850,10 +40850,10 @@ declare module BABYLON {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */

+ 2 - 2
dist/preview release/babylon.d.ts

@@ -41588,10 +41588,10 @@ declare module BABYLON {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/babylon.js


+ 14 - 12
dist/preview release/babylon.max.js

@@ -21198,10 +21198,10 @@ var WebXRManagedOutputCanvas = /** @class */ (function () {
     /**
      * Initializes the canvas to be added/removed upon entering/exiting xr
      * @param engine the Babylon engine
-     * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
      * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+     * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
      */
-    function WebXRManagedOutputCanvas(engine, onStateChangedObservable, canvas) {
+    function WebXRManagedOutputCanvas(engine, canvas, onStateChangedObservable) {
         var _this = this;
         this._canvas = null;
         /**
@@ -21214,15 +21214,17 @@ var WebXRManagedOutputCanvas = /** @class */ (function () {
             canvas.style.cssText = "position:absolute; bottom:0px;right:0px;z-index:10;width:90%;height:100%;background-color: #000000;";
         }
         this._setManagedOutputCanvas(canvas);
-        onStateChangedObservable.add(function (stateInfo) {
-            if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].ENTERING_XR) {
-                // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly
-                _this._addCanvas();
-            }
-            else if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].NOT_IN_XR) {
-                _this._removeCanvas();
-            }
-        });
+        if (onStateChangedObservable) {
+            onStateChangedObservable.add(function (stateInfo) {
+                if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].ENTERING_XR) {
+                    // The canvas is added to the screen before entering XR because currently the xr session must be initialized while the canvas is added render properly
+                    _this._addCanvas();
+                }
+                else if (stateInfo == _webXRTypes__WEBPACK_IMPORTED_MODULE_0__["WebXRState"].NOT_IN_XR) {
+                    _this._removeCanvas();
+                }
+            });
+        }
     }
     /**
      * Initializes the xr layer for the session
@@ -21480,7 +21482,7 @@ var WebXRSessionManager = /** @class */ (function () {
             return this._xrNavigator.xr.getWebXRRenderTarget(this.scene.getEngine());
         }
         else {
-            return new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_4__["WebXRManagedOutputCanvas"](this.scene.getEngine(), onStateChangedObservable, this.scene.getEngine().getRenderingCanvas());
+            return new _webXRManagedOutputCanvas__WEBPACK_IMPORTED_MODULE_4__["WebXRManagedOutputCanvas"](this.scene.getEngine(), this.scene.getEngine().getRenderingCanvas(), onStateChangedObservable);
         }
     };
     /**

Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/babylon.max.js.map


+ 4 - 4
dist/preview release/babylon.module.d.ts

@@ -43067,10 +43067,10 @@ declare module "babylonjs/Cameras/XR/webXRManagedOutputCanvas" {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */
@@ -109296,10 +109296,10 @@ declare module BABYLON {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */

+ 2 - 2
dist/preview release/documentation.d.ts

@@ -41588,10 +41588,10 @@ declare module BABYLON {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */

+ 4 - 4
dist/preview release/viewer/babylon.module.d.ts

@@ -43067,10 +43067,10 @@ declare module "babylonjs/Cameras/XR/webXRManagedOutputCanvas" {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */
@@ -109296,10 +109296,10 @@ declare module BABYLON {
         /**
          * Initializes the canvas to be added/removed upon entering/exiting xr
          * @param engine the Babylon engine
-         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          * @param canvas The canvas to be added/removed (If not specified a full screen canvas will be created)
+         * @param onStateChangedObservable the mechanism by which the canvas will be added/removed based on XR state
          */
-        constructor(engine: ThinEngine, onStateChangedObservable: Observable<WebXRState>, canvas?: HTMLCanvasElement);
+        constructor(engine: ThinEngine, canvas?: HTMLCanvasElement, onStateChangedObservable?: Observable<WebXRState>);
         /**
          * Disposes of the object
          */

Fichier diff supprimé car celui-ci est trop grand
+ 2 - 2
dist/preview release/viewer/babylon.viewer.js


Fichier diff supprimé car celui-ci est trop grand
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js