Forráskód Böngészése

Merge branch 'master' of http://face3d.4dage.com:7005/chenzhiguang/zhengzhou_university

chenzhiguang 4 éve
szülő
commit
457309a669

+ 56 - 8
web/public/static/js/lib/stats.min.js

@@ -22,18 +22,36 @@ var Stats = function() {
       , r = h(new Stats.Panel("FPS","#0ff","#002"))
       , f = h(new Stats.Panel("MS","#0f0","#020"));
       
-    var info = {dur:0, aveFps:0}
+    var info = {dur:0, aveFps:0},  pauseTime = 0, startIntervalTime = 0 ;
       
     if (self.performance && self.performance.memory)
         var t = h(new Stats.Panel("MB","#f08","#201"));
     k(0);
     return {
         REVISION: 16,
-        dom: c,
+        dom: c, 
         addPanel: h,
         showPanel: k,
-        begin: function() {
+        intervalFun : null
+        
+        
+        ,
+        begin: function(blurEvent) {
+           
             g = (performance || Date).now()
+            
+            this.blurEvent = blurEvent
+            document.addEventListener('visibilitychange',this.blurEvent)
+            
+            
+        },
+        pause: function(){
+            pauseTime = (performance || Date).now();
+        },
+        resume:function(){
+            var delta =  (performance || Date).now() - pauseTime;
+            e += delta
+            startIntervalTime += delta
         },
         end: function() {
             /* a++;
@@ -52,26 +70,56 @@ var Stats = function() {
             
             a++; 
             var c = (performance || Date).now();
-      
-            if(c > e + 1E3){
+            var update = this.intervalFun &&  (c - startIntervalTime > 5000);
+            if( c > e + 1E3){
                 
                 var v = 1E3 * a / (c - e)
                 var {min,max} = r.update(v, 100)
+                
+                
+                
+                info = {min, max, fps:v, dur : info.dur + c - e,  aveFps:(info.aveFps * (info.dur / 1000 ) + v ) / ((info.dur + c - e) / 1000)}
+               
                 e = c
                 a = 0
                 
-                
-                info = {min, max, fps:v, dur : c - g,  aveFps:(info.aveFps * (info.dur / 1000 ) + v ) / ((c - g) / 1000)}
+                if(update){
+                    var a2 = this.intervalFun() 
+                    startIntervalTime = c;
+                    if(!a2){
+                        this.intervalFun = null
+                    }
+                }
+
                 return info
             
+            }else{
+                
             }  
             
-            
         },
         update: function() {
             var a1 = this.end()
+            
+            if(this.intervalFun && startIntervalTime){
+                
+            }
+            
             return a1
         },
+        
+        addInterval: function(f){
+            startIntervalTime = (performance || Date).now();
+            this.intervalFun = f; 
+        }
+        ,
+        dispose:function(){
+            
+            document.removeEventListener('visibilitychange',this.blurEvent)
+
+            
+        }
+        ,
         domElement: c,
         setMode: k
     }

+ 44 - 19
web/public/static/js/main_2020_show.js

@@ -22385,23 +22385,38 @@ window.Modernizr = function(n, e, t) {
                 //loadVideo();//add   
                 //-------------------
                 
-                /* setTimeout(()=>{
-                    this.qualityManager.updateMaximums()
-                    window.stats && (stats.dom.parentElement && stats.dom.parentElement.removeChild(stats.dom), window.stats = null)
-                },6000) */
-                
+                //根据帧率调整加载分辨率
                 var updateCount = 0;
-                var interval = setInterval(()=>{
-                    updateCount ++
-                    if(updateCount>4){
-                        clearInterval(interval)
-                        window.stats && (stats.dom.parentElement && stats.dom.parentElement.removeChild(stats.dom), window.stats = null)
-                        return;
-                    }
-                    this.qualityManager.updateMaximums()
-                },5000)
                 
+                window.stats.addInterval(
+                    ()=>{
+                        updateCount ++
+                        
+                        var oldMaxZoom = this.qualityManager.getMaxZoomPanoSize()
+                        this.qualityManager.updateMaximums()
+                        /* var nowMaxZoom = this.qualityManager.getMaxZoomPanoSize()
+                        
+                        if(nowMaxZoom > oldMaxZoom && this.mode == 'panorama' && this.currentPano.zoomed){
+                            this.panoRenderer.resetRenderStatus(this.currentPano.id, !1, !0, oldMaxZoom );
+                            this.panoRenderer.clearAllQueuedUploadsForPano(this.currentPano.id);
+                            this.panoRenderer.renderPanoTiles(this.currentPano.id, null, !1, !1);
+                        } */
+                        console.log("updateCount "+updateCount)
+                        if(updateCount>5){ 
+                            
+                            window.stats && (stats.dom.parentElement && stats.dom.parentElement.removeChild(stats.dom), window.stats.dispose(),  window.stats = null)
+                            
+                            return false;
+                        }
+                        
+                        
+                        
+                        return true
+                        
+                    } 
                 
+                )
+                 
                 
                 var t = e.mode
                   , i = e.pano
@@ -24577,8 +24592,16 @@ window.Modernizr = function(n, e, t) {
             e.appendChild(this.renderer.domElement)
             
             window.stats = new Stats();
-            window.stats.begin()
-            e.appendChild( stats.dom );
+            window.stats.begin(  ()=>{
+                if (document.visibilityState == 'hidden') { stats.pause();   console.log('blur')}  //blur后到focus这段之间不会render
+                // 页面变为可见时触发 
+                if (document.visibilityState == 'visible') { stats.resume();  console.log('focus')} 
+                 
+            })
+            //e.appendChild( stats.dom );
+            
+            
+             
         }
         ,
         n.prototype.overrideTextures = function() {
@@ -25194,6 +25217,8 @@ window.Modernizr = function(n, e, t) {
             this.updateTextureMemory(),
             this.render(),
             window.stats && (window.fps = stats.update() || window.fps),
+            //console.log('render'),
+            
             this.emit(a.AfterRender))
         };
         n.prototype.getImageData = function() {
@@ -28229,12 +28254,12 @@ window.Modernizr = function(n, e, t) {
         }
         ,
         n.prototype.detectMaxZoomPanoSize = function() {
-            //return this.useHighResolutionPanos ? a.isMobile() ? o.tiling.mobileHighQualityOverride ? this.getPanoSize(r.HIGH) : this.getPanoSize(r.STANDARD) : this.useUltraHighResolutionPanos ? this.getPanoSize(r.ULTRAHIGH) : this.getPanoSize(r.HIGH) : this.getPanoSize(r.STANDARD)
-            if(window.fps && window.fps.aveFps>56){
+            return this.useHighResolutionPanos ? a.isMobile() ? o.tiling.mobileHighQualityOverride ? this.getPanoSize(r.HIGH) : this.getPanoSize(r.STANDARD) : this.useUltraHighResolutionPanos ? this.getPanoSize(r.ULTRAHIGH) : this.getPanoSize(r.HIGH) : this.getPanoSize(r.STANDARD)
+            /* if(this.useUltraHighResolutionPanos && window.fps && window.fps.aveFps>56 ){
                 return this.getPanoSize(r.ULTRAHIGH)
             }else{
                 return this.getPanoSize(r.HIGH)
-            }
+            } */
             
         }
         ,