xzw 4 lat temu
rodzic
commit
fc1b11af2d

+ 40 - 36
edit-backstage/js/edit.js

@@ -3535,52 +3535,56 @@ var VisiSet = {
             }else{
                 //显示该点时,显示周围一定距离内、到该点没有遮挡的pano
                 //????? 
-                var list = player.model.panos.sortByScore([], [(pano)=>{return -pano.position.distanceTo(this.panoVsetting.position)}])	
+                var list = player.model.panos.sortByScore([e=>e.isAligned()], [(pano)=>{return -pano.position.distanceTo(this.panoVsetting.position)}])	
                
-               
-                var length=0 
+                 
 				if(list.length == 1){
-					//objects.gui.showInfo('仅有一个漫游点')
+					console.log('仅有一个漫游点')
 					return;
 				} 
-               
-                
-				var s = Math.max(-list[1].score*1.5,   4);	//i==1的一定显示
-                for(var i=1;i<list.length;i++){
-                    if(!list[i].pano.isAligned())continue;
-                    if(-list[i].score < s){ 
-                    
-						if(length>0){
-							var A = this.panoVsetting.position.clone();
-							var B = list[i].pano.position.clone();
-                             
-                            if (convertTool.ifIntersectChunks(A, B, {}))  continue  
-                            
-                    
-						}		 
-                    
-                        this.dealPanoVisible(list[i].pano.id);
-                        length ++;
-                        //console.log()
-                    }else if(length==1){//少于2个
-                        var lastPos = list[i-1].pano.position.clone().sub(this.panoVsetting.position).setY(0);
-                        var thisPos = list[i].pano.position.clone().sub(this.panoVsetting.position).setY(0);
-                        if(lastPos.angleTo(thisPos) > Math.PI / 2){
-                            console.log('再加一个  角度'+THREE.Math.radToDeg(lastPos.angleTo(thisPos)))
-                            this.dealPanoVisible(list[i].pano.id);
-                        } 
-                        break;
+                var ifBlock = function(panoA, panoB, ){
+                    var A = panoA.position.clone();
+                    var B = panoB.position.clone(); 
+                    return convertTool.ifIntersectChunks(A, B, {})
+                }
+                var okList
+				var s = Math.max(-list[1].score*2,   4);	//i==1的一定显示
+                for(var i=1;i<list.length;i++){ 
+                    if(-list[i].score < s){  
+                        if(ifBlock(this.panoVsetting, list[i].pano)){
+                            list[i].block = true   //有阻挡 
+                        }
+                        list[i].good = true  
                     }else{
-                        break;
+                        okList || (okList = list.filter(e=>e.good && !e.block));//绝对可以使用的
+                          
+                        if(okList.length <2 ){
+                            if(!ifBlock(this.panoVsetting, list[i].pano)){
+                                if(okList.length == 0){
+                                    okList.push(list[i])
+                                }else{//1 
+                                    var lastPos = okList[0].pano.position.clone().sub(this.panoVsetting.position).setY(0);
+                                    var thisPos = list[i].pano.position.clone().sub(this.panoVsetting.position).setY(0);
+                                    if(lastPos.angleTo(thisPos) > Math.PI / 2){
+                                        console.log('再加一个  角度'+THREE.Math.radToDeg(lastPos.angleTo(thisPos)))
+                                        break;
+                                    } 
+                                    
+                                }
+                            }
+                        }else{
+                            break;
+                        }
                     }
                 }
+                if(okList.length==0){//如果length为0,至少加一个pano, 虽然是遮挡的
+                    okList.push(list[0].pano)
+                }
+                okList.forEach(e=>this.dealPanoVisible(e.pano.id))
                 
-                 
-                console.log(list)
-                
+                console.log(okList)
             } 
         }) 
-        
     
         
     },

+ 14 - 6
edit-backstage/js/main_2020_edit.js

@@ -21966,17 +21966,23 @@ function o(a, s, l) {
                 } 
             } 
                 
-            var getQuaByAim = function (aim, center) {
+            /* var getQuaByAim = function (aim, center) {
                 return new THREE.Quaternion().setFromUnitVectors(new THREE.Vector3(0, 0, -1), aim.clone().sub(center).normalize())
                 //或var _ = (new THREE.Matrix4).lookAt(pano.position, aim, new THREE.Vector3(0,1,0));  aimQua = (new THREE.Quaternion).setFromRotationMatrix(_);
-            } 
-
+            }  */
+            
+            
+     
             t.prototype.flyToPano = function(e, t) {
                 
                 var i, n = e.pano, aim = e.lookAtPoint, aimQua = e.quaternion,//ADD
                 o = e.duration, a = e.aimDuration, s = e.maxDistanceOverride, 
                 l = e.skipWarpingCheck, c = e.constantMoveSpeed, h = null, u = null 
-                if (aim) aimQua = getQuaByAim(aim, n.position)
+                
+                if (aim){
+                    var m = (new B.Matrix4).lookAt(n.position, r, T.UP)
+                    aimQua = (new B.Quaternion).setFromRotationMatrix(m)  
+                }
                 else aimQua = aimQua 
             
                 var zoomLevel = e.zoomLevel || 1  //add
@@ -22045,10 +22051,12 @@ function o(a, s, l) {
                         G.cancelById(q.LookTransition),
                         p *= k.transition.aimSlowFactor;
                         var g = this.cameraControls.activeControl.camera.quaternion.clone() 
-                                                                           
-                                                                           
+                                                                       
                           , y = g.clone()
                           , A = new B.Vector3;
+                          
+                         
+                          
                         if (n === this.currentPano) {
                             var C = T.FORWARD.clone().applyQuaternion(g)
                               , I = T.FORWARD.clone().applyQuaternion(aimQua)

+ 4 - 1
web/public/static/js/main_2020_show.js

@@ -23289,7 +23289,10 @@ window.Modernizr = function(n, e, t) {
                   , h = null
                   , p = null 
                 
-                if (aim) aimQua = getQuaByAim(aim, i.position)
+                if (aim){ 
+                    var _ = (new r.Matrix4).lookAt(i.position, n, d.UP)
+                    aimQua = (new r.Quaternion).setFromRotationMatrix(_)
+                }
                 else aimQua = aimQua 
             
                 var zoomLevel = e.zoomLevel || 1  //add