소스 검색

Stats panel: display the size of the viewport

customisations
alemart 9 달 전
부모
커밋
0f1b42ca1d
2개의 변경된 파일17개의 추가작업 그리고 6개의 파일을 삭제
  1. 1
    1
      src/core/session.ts
  2. 16
    5
      src/ui/stats-panel.ts

+ 1
- 1
src/core/session.ts 파일 보기

@@ -708,7 +708,7 @@ export class Session extends AREventTarget<SessionEventType>
708 708
 
709 709
                 // update internals
710 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 712
                 this._frameReady = false;
713 713
 
714 714
             }

+ 16
- 5
src/ui/stats-panel.ts 파일 보기

@@ -82,16 +82,17 @@ export class StatsPanel
82 82
     /**
83 83
      * A method to be called in the update loop
84 84
      * @param time current time in ms
85
-     * @param trackers the trackers attached to the session
86 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 88
      * @param gpu GPU cycles per second
88 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 93
         if(time >= this._lastUpdate + UPDATE_INTERVAL) {
93 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,12 +114,13 @@ export class StatsPanel
113 114
 
114 115
     /**
115 116
      * Update the contents of the panel
116
-     * @param trackers the trackers attached to the session
117 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 120
      * @param fps frames per second
119 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 125
         // all sanitized
124 126
         const lfps = this._label('_ar_fps');
@@ -148,6 +150,12 @@ export class StatsPanel
148 150
             const trackerStats = trackers.map(tracker => tracker._stats).join(', ');
149 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,6 +248,9 @@ export class StatsPanel
240 248
         print('<br>');
241 249
         print('OUT: <span class="_ar_out"></span>');
242 250
 
251
+        print('<br>');
252
+        print('DRAW: <span class="_ar_draw"></span>');
253
+
243 254
         return content;
244 255
     }
245 256
 }

Loading…
취소
저장