Browse Source

Stats panel: display the size of the viewport

customisations
alemart 9 months ago
parent
commit
0f1b42ca1d
2 changed files with 17 additions and 6 deletions
  1. 1
    1
      src/core/session.ts
  2. 16
    5
      src/ui/stats-panel.ts

+ 1
- 1
src/core/session.ts View File

708
 
708
 
709
                 // update internals
709
                 // update internals
710
                 this._renderStats.update();
710
                 this._renderStats.update();
711
-                this._statsPanel.update(time, this._trackers, this._sources, this._updateStats.cyclesPerSecond, this._renderStats.cyclesPerSecond);
711
+                this._statsPanel.update(time, this._sources, this._trackers, this._viewport, this._updateStats.cyclesPerSecond, this._renderStats.cyclesPerSecond);
712
                 this._frameReady = false;
712
                 this._frameReady = false;
713
 
713
 
714
             }
714
             }

+ 16
- 5
src/ui/stats-panel.ts View File

82
     /**
82
     /**
83
      * A method to be called in the update loop
83
      * A method to be called in the update loop
84
      * @param time current time in ms
84
      * @param time current time in ms
85
-     * @param trackers the trackers attached to the session
86
      * @param sources the sources of media linked to the session
85
      * @param sources the sources of media linked to the session
86
+     * @param trackers the trackers attached to the session
87
+     * @param viewport the viewport
87
      * @param gpu GPU cycles per second
88
      * @param gpu GPU cycles per second
88
      * @param fps frames per second
89
      * @param fps frames per second
89
      */
90
      */
90
-    update(time: DOMHighResTimeStamp, trackers: Tracker[], sources: Source[], gpu: number, fps: number): void
91
+    update(time: DOMHighResTimeStamp, sources: Source[], trackers: Tracker[], viewport: Viewport, gpu: number, fps: number): void
91
     {
92
     {
92
         if(time >= this._lastUpdate + UPDATE_INTERVAL) {
93
         if(time >= this._lastUpdate + UPDATE_INTERVAL) {
93
             this._lastUpdate = time;
94
             this._lastUpdate = time;
94
-            this._update(trackers, sources, fps, gpu);
95
+            this._update(sources, trackers, viewport, fps, gpu);
95
         }
96
         }
96
     }
97
     }
97
 
98
 
113
 
114
 
114
     /**
115
     /**
115
      * Update the contents of the panel
116
      * Update the contents of the panel
116
-     * @param trackers the trackers attached to the session
117
      * @param sources the sources of media linked to the session
117
      * @param sources the sources of media linked to the session
118
+     * @param trackers the trackers attached to the session
119
+     * @param viewport the viewport
118
      * @param fps frames per second
120
      * @param fps frames per second
119
      * @param gpu GPU cycles per second
121
      * @param gpu GPU cycles per second
120
      */
122
      */
121
-    private _update(trackers: Tracker[], sources: Source[], fps: number, gpu: number): void
123
+    private _update(sources: Source[], trackers: Tracker[], viewport: Viewport, fps: number, gpu: number): void
122
     {
124
     {
123
         // all sanitized
125
         // all sanitized
124
         const lfps = this._label('_ar_fps');
126
         const lfps = this._label('_ar_fps');
148
             const trackerStats = trackers.map(tracker => tracker._stats).join(', ');
150
             const trackerStats = trackers.map(tracker => tracker._stats).join(', ');
149
             lout.innerText = trackerStats;
151
             lout.innerText = trackerStats;
150
         }
152
         }
153
+
154
+        const ldraw = this._label('_ar_draw');
155
+        if(ldraw !== null) {
156
+            const size = viewport.virtualSize;
157
+            ldraw.innerText = `${size.width}x${size.height} viewport`;
158
+        }
151
     }
159
     }
152
 
160
 
153
     /**
161
     /**
240
         print('<br>');
248
         print('<br>');
241
         print('OUT: <span class="_ar_out"></span>');
249
         print('OUT: <span class="_ar_out"></span>');
242
 
250
 
251
+        print('<br>');
252
+        print('DRAW: <span class="_ar_draw"></span>');
253
+
243
         return content;
254
         return content;
244
     }
255
     }
245
 }
256
 }

Loading…
Cancel
Save