TA159

Notas, resueltos y trabajos practicos de la materia Sistemas Gráficos
Index Commits Files Refs Submodules README LICENSE
commit 24e77e8cbefcf7df71812555f71a9b0684948fd3
parent 8a2384d5f2d74eb94d0857b96ce345725a5d3e96
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date:   Fri, 12 Jul 2024 18:18:19 -0300

add `Mostrar FPS` checkbox to toggle the fps counter on/off

Diffstat:
Mtp/src/scene.js | 12++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/tp/src/scene.js b/tp/src/scene.js
@@ -39,7 +39,8 @@ let settings = {
     showTrain: true,
     currCameraIndex: 0,
     nightMode: true,
-    showHelpers: true,
+    showHelpers: false,
+    showFps: true,
 };
 
 let raycaster;
@@ -302,7 +303,7 @@ function setupThreeJs() {
     document.body.appendChild(renderer.domElement);
 
     stats = new Stats();
-    if(settings.showHelpers == true) {
+    if(settings.showFps == true) {
         document.body.appendChild(stats.dom);
     }
 
@@ -858,12 +859,15 @@ function createMenu() {
                 helpers[i].visible = settings.showHelpers;
                 scene.add(helpers[i]);
             }
-            if(settings.showHelpers == true) {
+        }
+    );
+    gui.add(settings, 'showFps', true).name('Mostrar FPS').onChange(
+        function() {
+            if(settings.showFps == true) {
                 document.body.appendChild(stats.dom);
             } else {
                 document.body.removeChild(stats.dom);
             }
-
         });
 }