Browse Source

Merge branch 'master' of http://192.168.0.115:3000/chenzhiguang/yangshi_cloudExbition

tremble 3 năm trước cách đây
mục cha
commit
d48015f2e4
1 tập tin đã thay đổi với 60 bổ sung20 xóa
  1. 60 20
      public/static/js/main_2020_show.js

+ 60 - 20
public/static/js/main_2020_show.js

@@ -15946,19 +15946,41 @@ window.Modernizr = function(n, e, t) {
         hot.prototype.setVisiblePanos = function(visibleData){ 
             this.visiblePanos = []; 
             
-            this.model.panos.list.forEach((pano)=>{
-                this.visiblePanos.push(pano.id) 
-            })
-            
-            /* this.model.panos.list.forEach((pano)=>{// 模型遮挡的, 直接不可见
-                if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
-                var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
-                if(!isShelter){
-                    this.visiblePanos.push(pano.id)
-                }
-            }) */
+             
+            let c = this.model.panos.list.length * this.model.colliders.length
+            if(c < 10000){
+                this.model.panos.list.forEach((pano)=>{// 模型遮挡的, 直接不可见
+                    if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
+                    var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
+                    if(!isShelter){
+                        this.visiblePanos.push(pano.id)
+                    }
+                }) 
+            }else{
+                let c1 = Math.ceil(10000 / this.model.colliders.length)
+                let start = 0
+                let interval = setInterval(()=>{
+                    let end = start + c1; 
+                    end = Math.min(end, this.model.panos.list.length)
+                    let i = start
+                    start = end
+                    for(;i<end; i++){ 
+                        var pano = this.model.panos.list[i]
+                        if(visibleData && !visibleData.includes(pano.id))return; //在热点可视中设置过,不可见
+                        var isShelter = convertTool.ifIntersectChunks(pano.position, this.position, {model: this.model.colliders});
+                        if(!isShelter){
+                            this.visiblePanos.push(pano.id)
+                        }
+                    } 
+                    if(end>=this.model.panos.list.length){
+                        //console.log(window.hotsi ?(++window.hotsi): (window.hotsi = 1))
+                        clearInterval(interval)
+                    }
+                },16 )
+                
+                
+            }
         }
-        
 		 //绘制热点
 		hot.prototype.build = function(){
             var t = r.UniformsUtils.clone(f.hot.uniforms); 
@@ -18387,8 +18409,24 @@ window.Modernizr = function(n, e, t) {
                     this.tags[t].build();
                 
                 //add-----
-                for(let i in this.hots){
-                    this.hots[i].setVisiblePanos(this.hots[i].visibleData);
+                { 
+                    let c = this.panos.list.length * this.colliders.length
+                    if(c < 10000){
+                        for(let i in this.hots){
+                            this.hots[i].setVisiblePanos(this.hots[i].visibleData);
+                        }
+                    }else{//防止加载时间过长,分批计算
+                        console.log('hot分批setVisiblePanos')
+                        let hotsId = Object.keys(this.hots)
+                        let i = 0
+                        let hotVisiInterval = setInterval(()=>{
+                            this.hots[hotsId[i]].setVisiblePanos(this.hots[hotsId[i]].visibleData);
+                            i++;
+                            if(i>=hotsId.length){
+                                clearInterval(hotVisiInterval)
+                            }
+                        }, Math.round(c/600)) 
+                    }    
                 }
                 //---------   
                 
@@ -23395,8 +23433,10 @@ window.Modernizr = function(n, e, t) {
             ,
             
             n.prototype.blackToPano = function(o={}) {//add 瞬间过渡
-                
-                var pano = o.pano || this.model.panos.index[o.panoId] 
+                o.panoId = "8bc9156b288d48459e4e0f74d7051ef1"
+                let oldPos = this.position.clone();
+                let oldPano = this.currentPano
+                let pano = o.pano || this.model.panos.index[o.panoId] 
                  
 
                 this.path.warpDestPano = pano
@@ -23408,7 +23448,7 @@ window.Modernizr = function(n, e, t) {
                 if (this.checkAndWaitForPanoLoad(pano, "high", "low", this.basePanoSize, retry))
                     return void (this.waitingToWarp = !0)
                  
-                this.emit("pano.chosen", this.currentPano, this.path.warpDestPano),
+                this.emit("pano.chosen", oldPano, pano),
 
  
                 this.path.warpDestHeroLoc = {  
@@ -23417,17 +23457,17 @@ window.Modernizr = function(n, e, t) {
                     quaternion: o.quaternion || this.quaternion.clone()
                    
                 }
-
+                
+                
                 this.path.warpTravel_BLACK(null, 1500,1, ()=>{ 
                     pano != this.currentPano && this.currentPano.exit() 
                     pano.enter() 
                     this.currentPano = pano
-                    
+                    this.emit("flying.ended", pano.position, oldPos, pano, oldPano),
                 } )
                 
             }
             
-            
             window._transitionPosId = 9999
             
             n.prototype.transitionPos = function(o={}) {//渐变overlay和热点的位置