|
@@ -1241,13 +1241,11 @@ export class Images360 extends THREE.EventDispatcher{
|
|
}else{
|
|
}else{
|
|
return 0
|
|
return 0
|
|
}
|
|
}
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
var request = [//必要条件
|
|
var request = [//必要条件
|
|
- Images360.filters.inPanoDirection( this.position, direction, option1),
|
|
|
|
|
|
+ Images360.filters.inFloorDirection( this.position, direction, option1 ), //原先用inPanoDirection,但容易穿楼层,当mouse较低或较高
|
|
|
|
+ Images360.filters.inPanoDirection( this.position, this.getDirection(), option1/* , true */), //垂直方向上再稍微限制一下, 要接近视线方向,避免点击前方时因无路而到下一楼。但不能太高,否则楼梯上稍微朝下点击都到不了上方。之所以使用视线方向是因为镜头方向比鼠标方向目的性更强。
|
|
//Images360.filters.isNeighbourPanoTo(this.currentPano),
|
|
//Images360.filters.isNeighbourPanoTo(this.currentPano),
|
|
Images360.filters.not(this.currentPano),
|
|
Images360.filters.not(this.currentPano),
|
|
Images360.filters.isEnabled(),
|
|
Images360.filters.isEnabled(),
|
|
@@ -1262,21 +1260,17 @@ export class Images360 extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
} */
|
|
} */
|
|
]
|
|
]
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
var list = [//决胜项目
|
|
var list = [//决胜项目
|
|
Images360.scoreFunctions.distanceSquared(this.position, 1 ),
|
|
Images360.scoreFunctions.distanceSquared(this.position, 1 ),
|
|
|
|
|
|
Images360.scoreFunctions[o]( this.position, direction,true),
|
|
Images360.scoreFunctions[o]( this.position, direction,true),
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
(pano)=>{
|
|
(pano)=>{
|
|
let neighbour = this.isNeighbour(this.currentPano, pano)
|
|
let neighbour = this.isNeighbour(this.currentPano, pano)
|
|
|
|
|
|
return neighbour ? directionFactor : 0;
|
|
return neighbour ? directionFactor : 0;
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
/* (pano)=>{//尽量不穿越地板到下一层
|
|
/* (pano)=>{//尽量不穿越地板到下一层
|
|
let dis = getHeightDis(pano)
|
|
let dis = getHeightDis(pano)
|
|
return -dis * directionFactor * 0.1;
|
|
return -dis * directionFactor * 0.1;
|
|
@@ -1290,7 +1284,7 @@ export class Images360 extends THREE.EventDispatcher{
|
|
}
|
|
}
|
|
} */
|
|
} */
|
|
];
|
|
];
|
|
- if(!byKey && viewer.inputHandler.intersect && this.currentPano ){//方便上下楼, 考虑panos之间的角度差
|
|
|
|
|
|
+ if(!byKey && viewer.inputHandler.intersect && this.currentPano ){//方便上下楼, 考虑panos之间的角度差
|
|
let pos1 = this.currentPano.floorPosition
|
|
let pos1 = this.currentPano.floorPosition
|
|
let vec1 = new THREE.Vector3().subVectors(viewer.inputHandler.intersect.location, pos1 ).normalize()//应该只有atPano时才会执行到这吧?
|
|
let vec1 = new THREE.Vector3().subVectors(viewer.inputHandler.intersect.location, pos1 ).normalize()//应该只有atPano时才会执行到这吧?
|
|
list.push( function(pano) {
|
|
list.push( function(pano) {
|
|
@@ -1313,7 +1307,7 @@ export class Images360 extends THREE.EventDispatcher{
|
|
n.pano = null),
|
|
n.pano = null),
|
|
e || (e = 0);
|
|
e || (e = 0);
|
|
var r = Common.sortByScore(this.panos, t, i);
|
|
var r = Common.sortByScore(this.panos, t, i);
|
|
- console.log('findRankedByScore', r && r.map(u=>u.item.id + '| ' + math.toPrecision(u.score,4) + " | " + math.toPrecision(u.scores,4)))
|
|
|
|
|
|
+ //console.log('findRankedByScore', r && r.map(u=>u.item.id + '| ' + math.toPrecision(u.score,4) + " | " + math.toPrecision(u.scores,4)))
|
|
|
|
|
|
|
|
|
|
return !r || 0 === r.length || e >= r.length ? null : (n && (n.candidates = r,
|
|
return !r || 0 === r.length || e >= r.length ? null : (n && (n.candidates = r,
|
|
@@ -2023,19 +2017,23 @@ Images360.prototype.checkAndWaitForPanoLoad = function() {
|
|
|
|
|
|
|
|
|
|
Images360.filters = {
|
|
Images360.filters = {
|
|
- inPanoDirection : function(pos, dir, i) {
|
|
|
|
|
|
+ inPanoDirection : function(pos, dir, i, log) { //pano在mouse的方向上
|
|
return function(pano) {
|
|
return function(pano) {
|
|
var r = pano.floorPosition.clone().sub(pos).normalize()
|
|
var r = pano.floorPosition.clone().sub(pos).normalize()
|
|
var o = pano.position.clone().sub(pos).normalize()
|
|
var o = pano.position.clone().sub(pos).normalize()
|
|
- return r.dot(dir) > i || o.dot(dir) > i
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ log && console.log('dire',pano.id, r.dot(dir), o.dot(dir) )
|
|
|
|
+ return r.dot(dir) > i || o.dot(dir) > i
|
|
}
|
|
}
|
|
},
|
|
},
|
|
- inFloorDirection: function(pos, e, o) {//许钟文 改 for鱼眼
|
|
|
|
- return function(n) {
|
|
|
|
- var i = n.floorPosition.clone().sub(pos).setZ(0).normalize();//改成在xz方向上,否则点击墙面不会移动
|
|
|
|
- return i.dot(e) > o
|
|
|
|
|
|
+ inFloorDirection: function(pos, dir, min, log) { //pano在mouse的水平方向上
|
|
|
|
+ return function(pano) {
|
|
|
|
+ var vec = new THREE.Vector2().subVectors(pano.floorPosition, pos).normalize()
|
|
|
|
+ var dir_ = new THREE.Vector2().copy(dir).normalize()
|
|
|
|
+ log && console.log('dire', pano.id, vec.dot(dir_) )
|
|
|
|
+ return vec.dot(dir_) > min
|
|
|
|
+
|
|
|
|
+ /* var i = pano.floorPosition.clone().sub(pos).setZ(0).normalize();//改成在xz方向上,否则点击墙面不会移动
|
|
|
|
+ return i.dot(dir.clone().setZ(0)) > min */
|
|
}
|
|
}
|
|
},
|
|
},
|
|
isNotBehindNormal: function(e, t) {
|
|
isNotBehindNormal: function(e, t) {
|
|
@@ -2129,7 +2127,7 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
let minTanBeta = minDis / height /* (pano0.position.z - pano0.floorPosition.z) */
|
|
let minTanBeta = minDis / height /* (pano0.position.z - pano0.floorPosition.z) */
|
|
let minBeta = Math.atan(minTanBeta)
|
|
let minBeta = Math.atan(minTanBeta)
|
|
const maxSinAlpha = Math.cos(minBeta) // 注:beta = Math/2 - alpha
|
|
const maxSinAlpha = Math.cos(minBeta) // 注:beta = Math/2 - alpha
|
|
-
|
|
|
|
|
|
+ const skyHeight = 50
|
|
return function(pano0, pano1){
|
|
return function(pano0, pano1){
|
|
|
|
|
|
if(Potree.settings.displayMode != 'showPanos' || pano0 == pano1
|
|
if(Potree.settings.displayMode != 'showPanos' || pano0 == pano1
|
|
@@ -2174,7 +2172,7 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
let sinAlpha = Math.abs(pano0.position.z - pano1.position.z) / dis //俯仰角的sin,随角度增大而增大 0-1
|
|
let sinAlpha = Math.abs(pano0.position.z - pano1.position.z) / dis //俯仰角的sin,随角度增大而增大 0-1
|
|
let score = (1+sinAlpha*20) * dis //score越大创建的mesh越不适合
|
|
let score = (1+sinAlpha*20) * dis //score越大创建的mesh越不适合
|
|
let isNeighbour = this.isNeighbour(pano0, pano1)
|
|
let isNeighbour = this.isNeighbour(pano0, pano1)
|
|
- console.log(pano0.id, pano1.id, maxSinAlpha.toFixed(2), sinAlpha.toFixed(2), score.toFixed(2), isNeighbour)
|
|
|
|
|
|
+ //console.log(pano0.id, pano1.id, maxSinAlpha.toFixed(2), sinAlpha.toFixed(2), score.toFixed(2), isNeighbour)
|
|
|
|
|
|
let depthTiming = Potree.timeCollect.depthSampler.median //pc firefox达到4. chrome为0.01
|
|
let depthTiming = Potree.timeCollect.depthSampler.median //pc firefox达到4. chrome为0.01
|
|
|
|
|
|
@@ -2211,7 +2209,7 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
let getFar = (dir, pano, origin, height)=>{//获取在这个方向上和墙体intersect的距离
|
|
let getFar = (dir, pano, origin, height)=>{//获取在这个方向上和墙体intersect的距离
|
|
//在垂直方向上分出多个方向,取一个最可能的接近真实的距离
|
|
//在垂直方向上分出多个方向,取一个最可能的接近真实的距离
|
|
let maxH = 40, minH = 2, minR = 0.5, maxR = 2
|
|
let maxH = 40, minH = 2, minR = 0.5, maxR = 2
|
|
- height = height == void 0 ? (pano.ceilZ - pano.floorPosition.z) : height
|
|
|
|
|
|
+ height = height == void 0 ? (Math.min(skyHeight,pano.ceilZ) - pano.floorPosition.z) : height
|
|
//let r = height (maxH - minH)* 0.14 // 高度越小,角度越小
|
|
//let r = height (maxH - minH)* 0.14 // 高度越小,角度越小
|
|
//let r = minR + ( maxR - minR) * THREE.Math.clamp((height - minH) / (maxH - minH),0,1) //THREE.Math.smoothstep(currentDis, op.nearBound, op.farBound);
|
|
//let r = minR + ( maxR - minR) * THREE.Math.clamp((height - minH) / (maxH - minH),0,1) //THREE.Math.smoothstep(currentDis, op.nearBound, op.farBound);
|
|
let r = math.linearClamp(height, minH,maxH, minR, maxR)
|
|
let r = math.linearClamp(height, minH,maxH, minR, maxR)
|
|
@@ -2251,7 +2249,7 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
minZ = pano.floorPosition.z
|
|
minZ = pano.floorPosition.z
|
|
|
|
|
|
maxZ = pano.getCeilHeight()
|
|
maxZ = pano.getCeilHeight()
|
|
- let skyHeight = 50
|
|
|
|
|
|
+
|
|
if(maxZ == Infinity) maxZ = skyHeight; //maxZ = Math.max(skyHeight, maxZ)
|
|
if(maxZ == Infinity) maxZ = skyHeight; //maxZ = Math.max(skyHeight, maxZ)
|
|
|
|
|
|
|
|
|
|
@@ -2389,7 +2387,9 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
|
|
|
|
let addSide = ()=>{//两个漫游点间两边各加一些侧线
|
|
let addSide = ()=>{//两个漫游点间两边各加一些侧线
|
|
//中点处的
|
|
//中点处的
|
|
- let midMaxZ = (pano0.ceilZ + pano1.ceilZ)/2
|
|
|
|
|
|
+ let top0 = pano0.ceilZ == Infinity ? skyHeight : pano0.ceilZ
|
|
|
|
+ let top1 = pano1.ceilZ == Infinity ? skyHeight : pano1.ceilZ
|
|
|
|
+ let midMaxZ = (top0 + top1)/2
|
|
let midMinZ = (pano0.floorPosition.z+pano1.floorPosition.z)/2;
|
|
let midMinZ = (pano0.floorPosition.z+pano1.floorPosition.z)/2;
|
|
let mid = new THREE.Vector3().addVectors(pano0.position, pano1.position).multiplyScalar(0.5)
|
|
let mid = new THREE.Vector3().addVectors(pano0.position, pano1.position).multiplyScalar(0.5)
|
|
|
|
|
|
@@ -2448,7 +2448,7 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
disToSides.forEach(e=>{//求z
|
|
disToSides.forEach(e=>{//求z
|
|
let ratio = e.disToPano2d / dis2d
|
|
let ratio = e.disToPano2d / dis2d
|
|
let r = accordingPano == pano0 ? (1-ratio) : ratio
|
|
let r = accordingPano == pano0 ? (1-ratio) : ratio
|
|
- let sideMaxZ_ = pano0.ceilZ * r + pano1.ceilZ * (1-r);
|
|
|
|
|
|
+ let sideMaxZ_ = top0 * r + top1 * (1-r);
|
|
let sideMinZ_ = pano0.floorPosition.z * r + pano1.floorPosition.z * (1-r);
|
|
let sideMinZ_ = pano0.floorPosition.z * r + pano1.floorPosition.z * (1-r);
|
|
[sideMaxZ_,sideMinZ_].forEach(z=>{
|
|
[sideMaxZ_,sideMinZ_].forEach(z=>{
|
|
posArr.push(e.pano.position.clone().setZ(z).add(e.dir_)) //是直接使用最长dis的那个intersect点好还是mid
|
|
posArr.push(e.pano.position.clone().setZ(z).add(e.dir_)) //是直接使用最长dis的那个intersect点好还是mid
|
|
@@ -2596,8 +2596,8 @@ Images360.prototype.updateCube = (function(){//增加细分的版本,且垂直
|
|
|
|
|
|
|
|
|
|
*/
|
|
*/
|
|
-
|
|
|
|
-}())
|
|
|
|
|
|
+ }
|
|
|
|
+})()
|
|
|
|
|
|
|
|
|
|
|
|
|