Browse Source

Force set size in multi views mode

Popov72 4 years ago
parent
commit
5a78599b63

+ 1 - 1
src/Engines/Extensions/engine.views.ts

@@ -142,7 +142,7 @@ Engine.prototype._renderViews = function() {
             canvas.height = canvas.clientHeight;
             canvas.height = canvas.clientHeight;
             parent.width = canvas.clientWidth;
             parent.width = canvas.clientWidth;
             parent.height = canvas.clientHeight;
             parent.height = canvas.clientHeight;
-            this.resize();
+            this.resize(true);
         }
         }
 
 
         if (!parent.width || !parent.height) {
         if (!parent.width || !parent.height) {

+ 10 - 5
src/Engines/engine.ts

@@ -1322,7 +1322,7 @@ export class Engine extends ThinEngine {
     }
     }
 
 
     /**
     /**
-     * Enf the current frame
+     * End the current frame
      */
      */
     public endFrame(): void {
     public endFrame(): void {
         super.endFrame();
         super.endFrame();
@@ -1331,27 +1331,32 @@ export class Engine extends ThinEngine {
         this.onEndFrameObservable.notifyObservers(this);
         this.onEndFrameObservable.notifyObservers(this);
     }
     }
 
 
-    public resize(): void {
+    /**
+     * Resize the view according to the canvas' size
+     * @param forceSetSize true to force setting the sizes of the underlying canvas
+     */
+    public resize(forceSetSize = false): void {
         // We're not resizing the size of the canvas while in VR mode & presenting
         // We're not resizing the size of the canvas while in VR mode & presenting
         if (this.isVRPresenting()) {
         if (this.isVRPresenting()) {
             return;
             return;
         }
         }
 
 
-        super.resize();
+        super.resize(forceSetSize);
     }
     }
 
 
     /**
     /**
      * Force a specific size of the canvas
      * Force a specific size of the canvas
      * @param width defines the new canvas' width
      * @param width defines the new canvas' width
      * @param height defines the new canvas' height
      * @param height defines the new canvas' height
+     * @param forceSetSize true to force setting the sizes of the underlying canvas
      * @returns true if the size was changed
      * @returns true if the size was changed
      */
      */
-    public setSize(width: number, height: number): boolean {
+    public setSize(width: number, height: number, forceSetSize = false): boolean {
         if (!this._renderingCanvas) {
         if (!this._renderingCanvas) {
             return false;
             return false;
         }
         }
 
 
-        if (!super.setSize(width, height)) {
+        if (!super.setSize(width, height, forceSetSize)) {
             return false;
             return false;
         }
         }
 
 

+ 6 - 4
src/Engines/thinEngine.ts

@@ -1390,8 +1390,9 @@ export class ThinEngine {
 
 
     /**
     /**
      * Resize the view according to the canvas' size
      * Resize the view according to the canvas' size
+     * @param forceSetSize true to force setting the sizes of the underlying canvas
      */
      */
-    public resize(): void {
+    public resize(forceSetSize = false): void {
         let width: number;
         let width: number;
         let height: number;
         let height: number;
 
 
@@ -1403,16 +1404,17 @@ export class ThinEngine {
             height = this._renderingCanvas ? this._renderingCanvas.height : 100;
             height = this._renderingCanvas ? this._renderingCanvas.height : 100;
         }
         }
 
 
-        this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);
+        this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel, forceSetSize);
     }
     }
 
 
     /**
     /**
      * Force a specific size of the canvas
      * Force a specific size of the canvas
      * @param width defines the new canvas' width
      * @param width defines the new canvas' width
      * @param height defines the new canvas' height
      * @param height defines the new canvas' height
+     * @param forceSetSize true to force setting the sizes of the underlying canvas
      * @returns true if the size was changed
      * @returns true if the size was changed
      */
      */
-    public setSize(width: number, height: number): boolean {
+    public setSize(width: number, height: number, forceSetSize = false): boolean {
         if (!this._renderingCanvas) {
         if (!this._renderingCanvas) {
             return false;
             return false;
         }
         }
@@ -1420,7 +1422,7 @@ export class ThinEngine {
         width = width | 0;
         width = width | 0;
         height = height | 0;
         height = height | 0;
 
 
-        if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {
+        if (!forceSetSize && this._renderingCanvas.width === width && this._renderingCanvas.height === height) {
             return false;
             return false;
         }
         }
 
 

+ 6 - 2
src/Engines/webgpuEngine.ts

@@ -451,6 +451,9 @@ export class WebGPUEngine extends Engine {
             vertexArrayObject: false,
             vertexArrayObject: false,
             instancedArrays: true,
             instancedArrays: true,
             canUseTimestampForTimerQuery: false,
             canUseTimestampForTimerQuery: false,
+            multiview: false,
+            oculusMultiview: false,
+            parallelShaderCompile: undefined,
             blendMinMax: true,
             blendMinMax: true,
             maxMSAASamples: 4 // TODO WEBGPU what is the right value?
             maxMSAASamples: 4 // TODO WEBGPU what is the right value?
         };
         };
@@ -572,10 +575,11 @@ export class WebGPUEngine extends Engine {
      * Force a specific size of the canvas
      * Force a specific size of the canvas
      * @param width defines the new canvas' width
      * @param width defines the new canvas' width
      * @param height defines the new canvas' height
      * @param height defines the new canvas' height
+     * @param forceSetSize true to force setting the sizes of the underlying canvas
      * @returns true if the size was changed
      * @returns true if the size was changed
      */
      */
-    public setSize(width: number, height: number): boolean {
-        if (!super.setSize(width, height)) {
+    public setSize(width: number, height: number, forceSetSize = false): boolean {
+        if (!super.setSize(width, height, forceSetSize)) {
             return false;
             return false;
         }
         }