xzw преди 2 години
родител
ревизия
56574ad707
променени са 4 файла, в които са добавени 209 реда и са изтрити 17 реда
  1. 23 4
      js/Hot.js
  2. 2 2
      js/main_2020_edit.js
  3. 159 9
      js/main_2020_show.js
  4. 25 2
      js/manage.js

+ 23 - 4
js/Hot.js

@@ -764,7 +764,7 @@ window.initHot = function(model){
                     }));
                     
                     if(end>=model.panos.list.length){
-                        console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
+                        //console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
                         clearInterval(interval)
                     }
                 }, Hot.visiEveryDurSlice )// visiEveryDurSlice 等在main中定义
@@ -1012,7 +1012,7 @@ window.initHot = function(model){
                 if(video.paused){
                     this.loadVideo(video)
                     video.play()
-                    console.log("play " + this.sid)                    
+                    //console.log("play " + this.sid)                    
                 }                    
                   
             }
@@ -1458,7 +1458,7 @@ window.initHot = function(model){
                 if(this.photoHasRequestLoad || this.texType != 'photo'){ 
                     return; //为什么之前1191需要在这加callback() 才能呢。现在又没事了
                 }
-                console.log(' beginDownload : ' + this.sid)
+                //console.log(' beginDownload : ' + this.sid)
                 
                  
                 /* this.material_.map =  */Texture.load(this.info.texSrc, (tex)=>{ 
@@ -1687,6 +1687,8 @@ window.initHot = function(model){
         else{ 
             Hot.load()
         }
+        
+        setTimeout(Hot.beginShineHot, 1000)
     }
     window.Hot = Hot   
         
@@ -1758,7 +1760,24 @@ window.initHot = function(model){
          
     }
             
-
+    
+    
+    
+    Hot.mobileAutoPlay = function(player){//移动端。不这么写video不会播放 
+        if(browser.isMobile()){
+            hotGroup.children.forEach((hot)=>{ 
+                if(!hot.clickToPlayInited && hot.texType == 'video' && hot.material_.map.image.paused){
+                    hot.update(player)
+                    console.log('clickToPlayInited111')
+                    if(!hot.material_.map.image.paused){
+                        console.log('clickToPlayInited')
+                        hot.clickToPlayInited = true 
+                    } 
+                }  
+            }) 
+        }
+        
+    }
 }
 
 

+ 2 - 2
js/main_2020_edit.js

@@ -17148,12 +17148,12 @@ function o(a, s, l) {
                 this.skybox = new n(this.boundingBox),
                 this.skybox.matrixWorldNeedsUpdate = !0,
                 this.add(this.skybox),
-                setTimeout(function() {
+                /* setTimeout(function() {
                     //this.hotsCount && this.shineHots() 
                     Hot.beginShineHot()
                     
                 }
-                .bind(this), 1300),
+                .bind(this), 1300), */
                 this.tags)
                     this.tags[t].build();
                 

+ 159 - 9
js/main_2020_show.js

@@ -18040,12 +18040,12 @@ window.Modernizr = function(n, e, t) {
                 this.skybox.matrixWorldNeedsUpdate = !0,
                 this.add(this.skybox);
 				
-				setTimeout(function() {
+				/* setTimeout(function() {
                     //this.hotsCount && this.shineHots() 
                     Hot.beginShineHot()
                     
                 }
-                .bind(this), 1300) 
+                .bind(this), 1300)  */
                 
                 
                
@@ -21988,6 +21988,10 @@ window.Modernizr = function(n, e, t) {
                 this.mouseCouldBeClickToMove = !0,
                 this.mouseDown = !0;
                  
+                 
+                 
+                Hot.mobileAutoPlay(this)
+                 
             }
             ,
 			
@@ -24066,14 +24070,14 @@ window.Modernizr = function(n, e, t) {
             }
                     
             ,
-            n.prototype.updateZoomPano = function() {
+            /* n.prototype.updateZoomPano = function() {
                 if (!this.panoRenderer.zoomPanoRenderingDisabled && this.mode === u.PANORAMA) {
                     var e = this.currentPano;
                     if (e) {
                         var t = this.zoomLevel > f.zoom.activationThreshold
                           , i = this.flying && this.nextPano && this.nextPano !== this.currentPano
                           , n = !i && !this.isWarping()
-                          , r = t /*&& n*/;  // 允许flying状态下加载4K图
+                          , r = t //&& n ;  // 允许flying状态下加载4K图
                         this.tileDownloader.tilePrioritizer.setZoomingActive(r),
                         this.panoRenderer.setZoomingActive(r, e, !0);
                         var o = function(e, t) {
@@ -24084,14 +24088,83 @@ window.Modernizr = function(n, e, t) {
                         }
                         .bind(this);
                         r && !e.zoomed ? (o(e, !0),
-                        this.panoRenderer.enableUltraHighQualityMode(function() {
+                        this.panoRenderer.  (function() {
                             this.qualityManager.useUltraHighResolutionPanos && !f.zoom.overridemax && (f.zoom.max = D.ultraHighQualityMaxZoom),
                             r && o(e, !0)
                         }
                         .bind(this))) : !t && e.zoomed && o(e, !1)
                     }
                 }
-            },
+            }, */
+            
+            n.prototype.updateZoomPano = function() {
+                if (!this.panoRenderer.zoomPanoRenderingDisabled && this.mode === u.PANORAMA && this.currentPano) {
+                    let navTileClass = this.qualityManager.getNavZoomClass() 
+                    let tileClass = this.qualityManager.getMaxZoomClass()
+                    let levelThreshold1 = navTileClass == '1k' ? 1.3 : 1.8 , levelThreshold2 = 2 //levelThreshold2不能比zoom.max大也就是不能超过2,否则zoom.max将无法提升到3
+               
+                    var t = this.zoomLevel > levelThreshold1
+                        , i = this.flying && this.nextPano && this.nextPano !== this.currentPano
+                        , n = !i && !this.isWarping()
+                        , r = t //&& n ;  // 允许flying状态下加载4K图
+                        this.tileDownloader.tilePrioritizer.setZoomingActive(r),
+                        this.panoRenderer.setZoomingActive(r, this.currentPano, !0);
+                        var o = function(pano, ifZoom) {
+                            this.panoRenderer.resetRenderStatus(pano.id, !1, !0, this.qualityManager.getMaxNavPanoSize()),
+                            this.panoRenderer.clearAllQueuedUploadsForPano(pano.id),
+                            this.panoRenderer.renderPanoTiles(pano.id, null, !1, !1),
+                            pano.setZoomed(ifZoom)
+                        }.bind(this);
+                    
+                    let zoomLevelRes = this.qualityManager.zoomLevelResolution
+                    
+                    if (r && (!this.currentPano.zoomed || zoomLevelRes && zoomLevelRes != '4k')) {//needZoom
+                        this.currentPano.zoomed || o(this.currentPano, !0); 
+                        
+                        if(navTileClass == '1k' && tileClass != '1k' && this.zoomLevel < levelThreshold2){
+                            this.panoRenderer.enableHighQuality( function() {//开启2k 
+                                if(tileClass != '4k'){
+                                    o(this.currentPano, !0); 
+                                }
+                            }.bind(this));
+                        }else{ 
+                            this.panoRenderer.enableUltraHighQualityMode(function() {//开启4k getMaxZoomPanoSize
+                                this.qualityManager.useUltraHighResolutionPanos && !f.zoom.overridemax && (f.zoom.max = D.ultraHighQualityMaxZoom) 
+                                o(this.currentPano, !0)
+                            }.bind(this));
+                        } 
+                    } else {  
+                        !t && this.currentPano.zoomed && o(this.currentPano, !1);
+                    }
+                    
+                    
+                    //有三个级别的话,需要标记zoomLevelResolution,以便更新maxZoomPanoSize判断能下载的最高级别
+                    if(r && navTileClass == '1k' && tileClass == '4k'  ){ //目前只有手机端navTileClass == '1k'
+                        var change = (zoomedFlag)=>{ 
+                            this.qualityManager.updateMaximums()//更新maxZoomPanoSize
+                            this.panoRenderer.setupZoomRenderTarget() //更新renderTarget  
+                            //this.currentPano.setZoomed(t);//更新uniforms贴图 
+                        }
+                        this.qualityManager.zoomLevelResolution = this.zoomLevel >= levelThreshold2 ? '4k' : this.zoomLevel > levelThreshold1? '2k' : '1k'
+                        
+                        if(this.oldZoomLevel < levelThreshold2 && this.zoomLevel >= levelThreshold2){//1k/2k-4k
+                            change()
+                            o(this.currentPano, t)
+                        }else if(this.oldZoomLevel <= levelThreshold1 && this.zoomLevel > levelThreshold1){//1k-2k
+                            change()
+                        }else if(this.oldZoomLevel > levelThreshold2 && this.zoomLevel <= levelThreshold2){//4k-2k/1k
+                            change()
+                            o(this.currentPano, t)
+                        }else if(this.oldZoomLevel > levelThreshold1 && this.zoomLevel <= levelThreshold1){//2k-1k
+                            change() 
+                        } 
+                        this.oldZoomLevel = this.zoomLevel  
+                    }    
+                            
+                }
+                
+            }
+            
             n.prototype.checkHasNeighbor = function(pano){//add
                 for(var i in pano.neighbourPanos ){
                     if(i == pano.id)continue;
@@ -27578,6 +27651,19 @@ window.Modernizr = function(n, e, t) {
                 this.zoomPanoRenderingDisabled = !0
         }
         ,
+        
+        
+        l.prototype.enableHighQuality = function(e) {
+            //xzw add  如果最多只要2k图的话enableUltraHighQualityMode替换成这个
+            if (!this.qualityManager.highQualityModeStarted) {
+                this.setupZoomRenderTarget()
+                e()
+                this.qualityManager.highQualityModeStarted = true
+            }
+        }
+        
+        
+        ,
         l.prototype.enableUltraHighQualityMode = function(e) {
             if (!this.qualityManager.ultraHighQualityModeEnabled()) {
                 var t = this.qualityManager.getPanoSize(p.ULTRAHIGH);
@@ -28259,19 +28345,83 @@ window.Modernizr = function(n, e, t) {
             return this.maxZoomPanoSize
         }
         ,
-        n.prototype.detectMaxNavPanoSizeClass = function() {
+        /* n.prototype.detectMaxNavPanoSizeClass = function() {
             if(settings.mobileNavHigh)return r.HIGH  //改
             else return this.useHighResolutionPanos ? a.isMobile() ? r.STANDARD : $("#player").height() < this.highQualityThreshold ? r.STANDARD : r.HIGH : r.STANDARD
+        } */
+        
+        n.prototype.detectDevice = function(){//add
+            if(a.isMobile()){
+                let area = $("#player").width() * $("#player").height()
+                
+                if(area < 768 * 1024){//ipad mini full screen 大场景拍的质量很好默认不需要很高清
+                    return 'mobile'
+                }else{
+                    return 'bigMobile'
+                }  
+            }else{
+                return 'pc'
+            }
+        }
+        
+        n.prototype.detectMaxNavPanoSizeClass = function() { //xzw 改 
+            switch(this.getNavZoomClass()){  
+                case '1k':
+                    return r.STANDARD;
+                    break;
+                case '2k':             
+                default:
+                    return r.HIGH;
+                case '4k': //虽然这种暂不支持
+                    return r.ULTRAHIGH;
+            }
         }
+        
         ,
         n.prototype.detectMaxNavPanoSize = function() {
             var e = this.detectMaxNavPanoSizeClass();
             return this.getPanoSize(e)
         }
         ,
-        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)
+        
+        n.prototype.getMaxZoomClass = function(){//add
+            let type = this.detectDevice() 
+            let setting = settings.tileClass[type] //见manage.js的settings
+            return setting.max
         }
+        n.prototype.getNavZoomClass = function(){//add
+            let type = this.detectDevice() 
+            let setting = settings.tileClass[type] 
+            return setting.nav
+        }
+        ,
+        n.prototype.detectMaxZoomPanoSize = function() {//获取当前zoomRenderTarget应下载的最高级别
+            //若是有三个级别,每次只需要加载到当前的zoomLevel;而两级时因为有zoomed来判断是使用基本贴图还是zoomRenderTarget,所以只需要返回最大的即可
+            
+            if (this.zoomLevelResolution) {//有三个级别
+                if (this.zoomLevelResolution == '4k' && this.useUltraHighResolutionPanos) {
+                    return this.getPanoSize(r.ULTRAHIGH)
+                } else if (this.zoomLevelResolution == '1k' || !this.useHighResolutionPanos) {
+                    return this.getPanoSize(r.STANDARD)
+                } else {
+                    return this.getPanoSize(r.HIGH)
+                }
+            } else {
+                let tileClass = this.getMaxZoomClass()
+                
+                if(tileClass == '1k')return this.getPanoSize(r.STANDARD);
+                 
+                if(tileClass == '4k' && this.useUltraHighResolutionPanos ){
+                    this.getPanoSize(r.ULTRAHIGH);
+                }else{//'2k'
+                    return this.getPanoSize(r.HIGH);
+                }
+            }     
+            
+        }
+        /* 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)
+        } */
         ,
         t.exports = n
     }

+ 25 - 2
js/manage.js

@@ -88,13 +88,36 @@ var settings = {
     //dontExamHot:true,  
     hotFastTran:true,
     transparentBg: false,
-    bgImg:  null 
+    bgImg:  null,
+     
+    tileClass:{//默认全景贴图加载的清晰度
+        pc:{
+            nav: '2k',
+            max: '4k',
+        },
+        bigMobile:{ //width和height都超过一定值
+            nav: '2k',
+            max: '2k',
+        },
+        mobile:{
+            nav: '1k',  //不放大时
+            max: '2k',  //放大最大
+        }
+    }, //可以稍后自行修改
 }
+
+
 if(window.number == '725'||window.number == '724'){
-    settings.mobileNavHigh = true
+    //settings.mobileNavHigh = true 
+    settings.tileClass.mobile = {nav:'2k', max: '2k'}
+    
 }
 
 
+ 
+ 
+
+
 //共用函数: