|
|
@@ -4914,21 +4914,33 @@ window.Modernizr = function(n, e, t) {
|
|
|
if(location.panoId != void 0 && location.panoId!= "outside"){
|
|
|
var pano = this.model.panos.index[location.panoId];
|
|
|
var dis = pano.position.distanceTo(this.player.currentPano.position)
|
|
|
+
|
|
|
if(dis<result.dis){
|
|
|
- result.item = item, result.dis = dis
|
|
|
+ result.item = item, result.dis = dis, result.location = location
|
|
|
}else if(dis == result.dis){//如果两个位置相同,优先播放在导览条上离激活的最近的那段导览
|
|
|
-
|
|
|
- /* if(this.itemCompare(item, this.currentItem, 'equal')){//优先用当前的
|
|
|
- result.item = item, result.dis = dis
|
|
|
- }else if(this.currentItem && Math.abs(item[0]-this.currentItem[0]) < Math.abs(result.item[0]-this.currentItem[0])){
|
|
|
- result.item = item, result.dis = dis
|
|
|
- } */
|
|
|
+
|
|
|
+
|
|
|
if(this.currentItem){
|
|
|
- let dis1 = [Math.abs(item[0] - this.currentItem[0]), Math.abs(item[1] - this.currentItem[1])] //当前差距
|
|
|
- let dis2 = [Math.abs(result.item[0] - this.currentItem[0]), Math.abs(result.item[1] - this.currentItem[1])]
|
|
|
- if( this.itemCompare(dis1, dis2, 'less')){
|
|
|
- result.item = item, result.dis = dis
|
|
|
- }
|
|
|
+
|
|
|
+ //if(this.itemCompare(item, this.currentItem, 'equal')){
|
|
|
+ if(result.angle == void 0){
|
|
|
+ result.angle = result.location.quaternion.angleTo(player.quaternion)
|
|
|
+ }
|
|
|
+
|
|
|
+ let angle = location.quaternion.angleTo(player.quaternion)
|
|
|
+ if(angle < result.angle){
|
|
|
+ result.item = item, result.dis = dis, result.location = location, result.angle = angle
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /* }else{
|
|
|
+
|
|
|
+ let dis1 = [Math.abs(item[0] - this.currentItem[0]), Math.abs(item[1] - this.currentItem[1])] //当前差距
|
|
|
+ let dis2 = [Math.abs(result.item[0] - this.currentItem[0]), Math.abs(result.item[1] - this.currentItem[1])]
|
|
|
+ if( this.itemCompare(dis1, dis2, 'less')){
|
|
|
+ result.item = item, result.dis = dis, result.location = location
|
|
|
+ }
|
|
|
+ } */
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -23706,7 +23718,7 @@ window.Modernizr = function(n, e, t) {
|
|
|
this.flying = true
|
|
|
this.nextPano = pano //提前加载高清图片
|
|
|
this.path.warpDestHeroLoc = {
|
|
|
- panoId : o.panoId,
|
|
|
+ panoId : pano.id,
|
|
|
position: pano.position,
|
|
|
quaternion: o.quaternion || this.quaternion.clone()
|
|
|
|
|
|
@@ -59217,127 +59229,7 @@ window.Modernizr = function(n, e, t) {
|
|
|
, {}]
|
|
|
}, {}, [116]);
|
|
|
|
|
|
-
|
|
|
-/* class PanTransGuide{
|
|
|
- constructor(player){
|
|
|
- this.player = player
|
|
|
- this.currentIndex = 0
|
|
|
- this.getNodes()
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- getNodes(){
|
|
|
- this.nodes = []
|
|
|
- let path = this.player.path
|
|
|
- let last
|
|
|
-
|
|
|
- let index = this.player.model.heroLocations.findIndex(e=>e.name == '沉浸看展')
|
|
|
- let locations = this.player.model.heroLocations[index].heroLocations
|
|
|
- this.player.model.heroLocations.splice(index,1)
|
|
|
-
|
|
|
- locations.forEach((e,i)=>{
|
|
|
- if(e.cameraMode != 'panorama')return
|
|
|
-
|
|
|
- if(i>0){
|
|
|
- path.setWarpDestination(e)
|
|
|
- path.setWarpDestPano()
|
|
|
- let A = path.getHeroPano(last),
|
|
|
- B = path.warpDestPano
|
|
|
- if(e.momentTour == 'black' && A!=B){
|
|
|
- path.nodes = [A.id,B.id];//直接加入
|
|
|
- }else{
|
|
|
- path.nodes = path.findShortestPath(A, B)
|
|
|
- if(path.nodes == null){//两个点之间不相通
|
|
|
- console.log('两个点之间不相通',A.id,B.id)
|
|
|
- path.nodes = [A.id,B.id];//直接加入
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- let wholeDis = 0, disSections = []
|
|
|
- path.nodes.forEach((cur,i)=>{
|
|
|
- if(i==0)return
|
|
|
- let prePano = this.player.model.panos.get(path.nodes[i-1])
|
|
|
- let curPano = this.player.model.panos.get(cur)
|
|
|
- let dis = prePano.position.distanceTo(curPano.position)
|
|
|
- disSections.push(dis)
|
|
|
- wholeDis += dis
|
|
|
- },0)
|
|
|
-
|
|
|
- let quaStart = last.quaternion
|
|
|
- let quaEnd = e.quaternion
|
|
|
-
|
|
|
- path.nodes.forEach((panoId,j)=>{
|
|
|
- if(j == 0){
|
|
|
- if(path.nodes.length == 1)return this.nodes.push({panoId,quaternion:quaEnd})//原地旋转
|
|
|
- if(i > 0)return //和上一段末尾重复
|
|
|
- return this.nodes.push({panoId,quaternion:quaStart})
|
|
|
- }
|
|
|
- let r = disSections[j-1] / wholeDis
|
|
|
- let quaternion = quaStart.clone()
|
|
|
- lerp.quaternion(quaternion, quaEnd)(r)
|
|
|
- this.nodes.push({panoId, quaternion})
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
- last = e
|
|
|
- })
|
|
|
-
|
|
|
- //path.setWarpDestinationByHeroIndex()
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- go(axis){
|
|
|
- if(this.player.flying)return
|
|
|
- let aimNode
|
|
|
- let cur = this.nodes[this.currentIndex]
|
|
|
- if(cur.panoId != this.player.currentPano.id){//已走动
|
|
|
- let curs = this.nodes.filter(e=>e.panoId == this.player.currentPano)
|
|
|
- curs.sort((a,b)=>{ //如果有多个,找到和currentIndex最接近的,可能是刚走过的
|
|
|
- let indexA = this.nodes.indexOf(a)
|
|
|
- let indexB = this.nodes.indexOf(b)
|
|
|
- return Math.abs(indexA - this.currentIndex) < Math.abs(indexB - this.currentIndex)
|
|
|
- })
|
|
|
- cur = curs[0]
|
|
|
- if(!cur){//不在道上 . 找离当前位置最近的node
|
|
|
- let disMap = new Map
|
|
|
- this.nodes.forEach(e=>{
|
|
|
- disMap.set(e,player.currentPano.position.distanceToSquared(this.player.model.panos.get(e.panoId).position))
|
|
|
- })
|
|
|
- let sorted = this.nodes.slice().sort((a,b)=>{
|
|
|
- return disMap.get(a) - disMap.get(b)
|
|
|
- })
|
|
|
-
|
|
|
- this.currentIndex = this.nodes.indexOf(sorted[0])//next
|
|
|
- if(axis == 'prev'){
|
|
|
- this.moveIndex(-1)
|
|
|
- }
|
|
|
- aimNode = this.nodes[this.currentIndex]
|
|
|
- }
|
|
|
- }
|
|
|
- let lastIndex = this.currentIndex
|
|
|
- if(!aimNode){
|
|
|
- this.moveIndex(axis == 'prev' ? -1 : 1)
|
|
|
- aimNode = this.nodes[this.currentIndex]
|
|
|
- }
|
|
|
-
|
|
|
- //let dis = this.player.model.panos.get(aimNode.panoId).position.distanceTo(this.player.position)
|
|
|
- let moveStyle = (lastIndex == 0 && axis == 'prev' || this.currentIndex == 0 && axis != 'prev') ? "blackToPano" : "flyToPano"
|
|
|
- this.player[moveStyle]({pano: this.player.model.panos.get(aimNode.panoId),quaternion:aimNode.quaternion})
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- moveIndex(step){
|
|
|
- this.currentIndex += (step + this.nodes.length)
|
|
|
- this.currentIndex %= this.nodes.length
|
|
|
- return this.currentIndex
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-}*/
|
|
|
+
|
|
|
|
|
|
|
|
|
class PanTransGuide{
|
|
|
@@ -59348,7 +59240,7 @@ class PanTransGuide{
|
|
|
|
|
|
|
|
|
}
|
|
|
- getNodes(){
|
|
|
+ /* getNodes(){ //根据提供的点位,自动连起来,一点点平移过去
|
|
|
this.nodes = []
|
|
|
let path = this.player.path
|
|
|
let last
|
|
|
@@ -59425,8 +59317,37 @@ class PanTransGuide{
|
|
|
get(last)
|
|
|
}
|
|
|
|
|
|
+ } */
|
|
|
+
|
|
|
+ getNodes(){//提取每个区域的第一个点,然后在这些点间瞬移
|
|
|
+
|
|
|
+ this.nodes = []
|
|
|
+
|
|
|
+ let index = this.player.model.heroLocations.findIndex(e=>e.name == '沉浸看展') //先去掉之前旧的数据
|
|
|
+ if(index>-1){
|
|
|
+ let locations = this.player.model.heroLocations[index].heroLocations
|
|
|
+ this.player.model.heroLocations.splice(index,1)
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ let get = (e,originItem)=>{
|
|
|
+ if(e.cameraMode != 'panorama'){
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.nodes.push(e)
|
|
|
+ }
|
|
|
+
|
|
|
+ //仅使用每个导览区域第一个的版本
|
|
|
+ this.player.model.heroLocations.forEach((e,i)=>{ //按片段每个都使用的版本
|
|
|
+ if(e.heroLocations){
|
|
|
+ get(e.heroLocations[0],[i,0])
|
|
|
+ }else{
|
|
|
+ get(e,[i,0])
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
+
|
|
|
go(axis){
|
|
|
if(this.player.flying)return
|
|
|
let aimNode
|