浏览代码

俯视图旋转

xzw 3 年之前
父节点
当前提交
818c610936
共有 1 个文件被更改,包括 67 次插入21 次删除
  1. 67 21
      js/main_2020_show.js

+ 67 - 21
js/main_2020_show.js

@@ -3602,13 +3602,46 @@ window.Modernizr = function(n, e, t) {
         },
         },
         
         
         
         
-        n.prototype.rotateToView = function(e, t) {
-            var i = 0
-              , n = h.aspectRatio() < 1
-              , r = e.x < e.z;
-            n === r ? t.z > 0 && (i = Math.PI) : i = t.x > 0 ? Math.PI / 2 : -Math.PI / 2,
-            this.rotateLeft(i),
-            this.update(0)
+        n.prototype.rotateToView = function(modelSize, direction) {
+            let i = 0, n = h.aspectRatio() < 1  //是否模型尺寸显“细长” 
+              
+            if(_settings.floorPlanAngle ){//规定了cadImage旋转值的话 (0是无效的,将不设置)
+                i = parseFloat(_settings.floorPlanAngle)
+                 
+                
+            }else{ 
+                let r = modelSize.x < modelSize.z; //是否视口为“窄屏”
+                
+                if(n === r)                                     //“细长” 且 “窄屏”,说明模型尺寸比例与视口比例匹配,相机坐标只需要调转“前”“后”
+                {
+                    if(direction.z > 0)                         //(第一种情况)相机是否位于背面。 注:在默认情况下webgl的相机朝向-z, direction.z > 0 说明相机视野已经偏向+z,说明相机位于模型“背面”
+                    {
+                        i = Math.PI;                            //经度上做180度轨道角位移,使相机移到静止模型的“前面”
+                    }
+                                                                //(第二种情况) 不做处理
+
+                }
+                else if(direction.x > 0)                        
+                {
+                    i = Math.PI / 2;                           
+                }
+                else
+                {
+                    i = -Math.PI / 2;                        
+                }
+            }
+              
+
+            this.rotateLeft(i);
+            this.update(0);
+            
+            
+        }
+        ,
+        n.prototype.rotateToAngle = function(angle){//add  旋转到特定角度 
+            this.rotateLeft(angle + this.lon);
+            this.update(0); 
+            
         }
         }
         ,
         ,
         n.prototype.pan = function(e, t) {
         n.prototype.pan = function(e, t) {
@@ -4715,11 +4748,11 @@ window.Modernizr = function(n, e, t) {
                 })
                 })
             }
             }
             ,
             ,
-            n.prototype.checkAndHandleWalkingtourInterruption = function(e) {
-                return e === u.WALK && (this.interrupt(g.NONE),
+            n.prototype.checkAndHandleWalkingtourInterruption = function(e) {//快速停止。 改:去掉判断nextWarpStyle,因为这个属性改乱了,导致点击停止按钮不执行
+                return /* e === u.WALK && ( */this.interrupt(g.NONE),
                 this.pauseWalkingSection(),
                 this.pauseWalkingSection(),
                 this.player.fastForwardActivePanoFlight(),
                 this.player.fastForwardActivePanoFlight(),
-                !0)
+                !0/* ) */
             }
             }
             ,
             ,
             n.prototype.handlePlayerMove = function(e) {
             n.prototype.handlePlayerMove = function(e) {
@@ -14647,8 +14680,15 @@ window.Modernizr = function(n, e, t) {
                     
                     
                     
                     
                     if(DATA.tourWalkSpeed == void 0)DATA.tourWalkSpeed = 100 
                     if(DATA.tourWalkSpeed == void 0)DATA.tourWalkSpeed = 100 
-                }
+                    
+                    if(DATA.tourRotTime == '' || DATA.tourRotTime == void 0){
+                        DATA.tourRotTime = settings.tourRotTime; //默认停留2秒
+                    }
                 
                 
+                }
+                {//其他
+                    _settings.floorPlanAngle = DATA.floorPlanAngle || 0  
+                }
             }).fail(e=>{
             }).fail(e=>{
                 alert("缺少someData文件,请检查场景码是否正确。")
                 alert("缺少someData文件,请检查场景码是否正确。")
             })
             })
@@ -23845,25 +23885,31 @@ window.Modernizr = function(n, e, t) {
                 this.history.invalidate();
                 this.history.invalidate();
                 this.path.discardSlow();
                 this.path.discardSlow();
 				//xzw:  
 				//xzw:  
-                
-                var timeEachItem = 2e3 / (DATA.tourWalkSpeed + DATA.tourBlackSpeed) * 200 //预估时间假设每个item飞的时间
+                var defaultRotTime = DATA.tourRotTime * 1000
+                var timeEachItem = 2e3 / (DATA.tourWalkSpeed + DATA.tourBlackSpeed) * 200 //预估时间假设每个item飞的时间(如果距离远就少了)
+                 
                 var currentLocation = this.model.heroLocations[this.director.currentItem[0]] 
                 var currentLocation = this.model.heroLocations[this.director.currentItem[0]] 
                 var rotTime
                 var rotTime
                 if(currentLocation.rotTime == void 0 || currentLocation.rotTime == ''){
                 if(currentLocation.rotTime == void 0 || currentLocation.rotTime == ''){
                     var restChildCount = currentLocation.heroLocations ? (currentLocation.heroLocations.length-this.director.currentItem[1]-1) : 0
                     var restChildCount = currentLocation.heroLocations ? (currentLocation.heroLocations.length-this.director.currentItem[1]-1) : 0
-                    var audioObj = SoundManager.list.find(e=>e.name == 'tour')
-                    var current = audioObj.audio.currentTime * 1e3 // || 0  //g_tourAudio ? 1e3 * g_tourAudio.currentTime : 0
-                    rotTime = currentLocation && currentLocation.musicInfo.music ? currentLocation.musicInfo.time - current : timeEachItem;  
-                    
-                    if(restChildCount){//如果当前folder中还有剩下的item,平分一下时间
-                        var rotTime = (rotTime-timeEachItem*restChildCount) / (restChildCount+1);
+                    var hasMusic = currentLocation && currentLocation.musicInfo.music
+                    if(hasMusic){
+                        var audioObj = SoundManager.list.find(e=>e.name == 'tour') 
+                        var current = audioObj.audio.currentTime * 1e3 // || 0  //g_tourAudio ? 1e3 * g_tourAudio.currentTime : 0
+                        rotTime = currentLocation.musicInfo.time - current
+                        if(restChildCount){//如果当前folder中还有剩下的item,平分一下时间
+                            rotTime = (rotTime-timeEachItem*restChildCount) / (restChildCount+1);   
+                        }  
+                    }else{
+                        rotTime = defaultRotTime
                     } 
                     } 
                     rotTime = Math.max(0, rotTime)
                     rotTime = Math.max(0, rotTime)
-                    console.log("rotTime "+rotTime +" at item "+this.director.currentItem + ",musicCurrentTime:"+current) 
+                    Log("rotTime "+rotTime +" at item "+this.director.currentItem + (hasMusic ? (",musicCurrentTime:"+current+'音乐总长:'+currentLocation.musicInfo.time) : ''),"#E8E") 
                 }else{
                 }else{
                     rotTime = currentLocation.rotTime * 1000
                     rotTime = currentLocation.rotTime * 1000
-                    console.log("rotTime "+rotTime +" at item "+this.director.currentItem) 
+                    Log("rotTime "+rotTime +" at item "+this.director.currentItem,"#E8E") 
                 }
                 }
+                 
 
 
                 this.path.waitNextStep(e, function() {
                 this.path.waitNextStep(e, function() {
                     t && t()
                     t && t()