Browse Source

Merge pull request #7887 from RaananW/frame-nofps-xr

Don't update FPS when in Frame and in XR
David Catuhe 5 years ago
parent
commit
bac949ded4
3 changed files with 10 additions and 3 deletions
  1. 3 1
      Playground/js/frame.js
  2. 6 1
      Playground/js/mainWebGPU.js
  3. 1 1
      dist/preview release/what's new.md

+ 3 - 1
Playground/js/frame.js

@@ -118,7 +118,9 @@ run = function () {
                 if (scene.activeCamera || scene.activeCameras.length > 0) {
                     scene.render();
                 }
-                if (fpsLabel) {
+                if (fpsLabel && !(scene.activeCamera && 
+                    scene.activeCamera.getClassName && 
+                    scene.activeCamera.getClassName() === 'WebXRCamera')) {
                     fpsLabel.innerHTML = engine.getFps().toFixed() + " fps";
                 }
             }.bind(this));

+ 6 - 1
Playground/js/mainWebGPU.js

@@ -153,7 +153,12 @@ compileAndRun = function(parent, fpsLabel) {
                         scene.render();
                     }
 
-                    fpsLabel.innerHTML = engine.getFps().toFixed() + " fps";
+                    // Update FPS if camera is not a webxr camera
+                    if(!(scene.activeCamera && 
+                        scene.activeCamera.getClassName && 
+                        scene.activeCamera.getClassName() === 'WebXRCamera')) {
+                        fpsLabel.innerHTML = engine.getFps().toFixed() + " fps";
+                    }
                 }.bind(this));
 
                 if (checkSceneCount && engine.scenes.length === 0) {

+ 1 - 1
dist/preview release/what's new.md

@@ -64,7 +64,7 @@
 
 - Added optional ray and mesh selection predicates to `WebXRControllerPointerSelection` ([Exolun](https://github.com/Exolun))
 - Implemented the new WebXR HitTest API ([#7364](https://github.com/BabylonJS/Babylon.js/issues/7364)) ([RaananW](https://github.com/RaananW))
-- Playground doesn't update FPS when in XR ([#7875](https://github.com/BabylonJS/Babylon.js/issues/7875)) ([RaananW](https://github.com/RaananW))
+- Playground doesn't update FPS when in XR in main and frame ([#7875](https://github.com/BabylonJS/Babylon.js/issues/7875)) ([RaananW](https://github.com/RaananW))
 
 ### Collisions