|
@@ -54053,7 +54053,7 @@
|
|
|
|
|
|
|
|
this.position = this.position.add(t);
|
|
this.position = this.position.add(t);
|
|
|
|
|
|
|
|
- if((!math.closeTo(x, 0, 1e-4) || !math.closeTo(y, 0, 1e-4) || !math.closeTo(z, 0, 1e-4)) && Potree.settings.displayMode != 'showPanos'){
|
|
|
|
|
|
|
+ if((!math.closeTo(x, 0, 1e-2) || !math.closeTo(y, 0, 1e-2) || !math.closeTo(z, 0, 1e-2)) && Potree.settings.displayMode != 'showPanos'){
|
|
|
this.cancelFlying('pos');
|
|
this.cancelFlying('pos');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -54063,7 +54063,7 @@
|
|
|
translateWorld (x, y, z) {
|
|
translateWorld (x, y, z) {
|
|
|
super.translateWorld(x, y, z);
|
|
super.translateWorld(x, y, z);
|
|
|
|
|
|
|
|
- if((!math.closeTo(x, 0, 1e-4) || !math.closeTo(y, 0, 1e-4) || !math.closeTo(z, 0, 1e-4)) && Potree.settings.displayMode != 'showPanos'){
|
|
|
|
|
|
|
+ if((!math.closeTo(x, 0, 1e-2) || !math.closeTo(y, 0, 1e-2) || !math.closeTo(z, 0, 1e-2)) && Potree.settings.displayMode != 'showPanos'){
|
|
|
this.cancelFlying('pos');
|
|
this.cancelFlying('pos');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -76525,9 +76525,9 @@ void main()
|
|
|
if(!params.all){
|
|
if(!params.all){
|
|
|
if(camera.type == 'OrthographicCamera'){
|
|
if(camera.type == 'OrthographicCamera'){
|
|
|
let vec = new Vector3().subVectors(position, camera.position);
|
|
let vec = new Vector3().subVectors(position, camera.position);
|
|
|
- hit.disSquare = vec.projectOnVector( cameraDir ).lengthSq(); //只考虑到相机的垂直距离
|
|
|
|
|
- }else {
|
|
|
|
|
- hit.disSquare = camera.position.distanceToSquared(position);
|
|
|
|
|
|
|
+ hit.disSquare = vec.projectOnVector( cameraDir ).length(); //只考虑到相机的垂直距离
|
|
|
|
|
+ }else {
|
|
|
|
|
+ hit.disSquare = camera.position.distanceTo(position);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} else if (attributeName === 'indices') {
|
|
} else if (attributeName === 'indices') {
|
|
@@ -76574,13 +76574,7 @@ void main()
|
|
|
|
|
|
|
|
let nearest = sorted1[0]; //return nearest.point; //直接用最近点 在点云稀疏时不太跟手,如地面上,最近点往往在鼠标下方
|
|
let nearest = sorted1[0]; //return nearest.point; //直接用最近点 在点云稀疏时不太跟手,如地面上,最近点往往在鼠标下方
|
|
|
|
|
|
|
|
- let r;
|
|
|
|
|
- if(camera.type != 'OrthographicCamera'){
|
|
|
|
|
- let ratio = 0.1; //系数越大越不跟手,但更容易pick近处的。 (当pick的点较远时,获取框内的点距离可能差别很大,就要所以除以disSquare)
|
|
|
|
|
- r = rSquare/Math.max(nearest.disSquare,0.001) * ratio;
|
|
|
|
|
- }else {
|
|
|
|
|
- r = 10; //大一点才能pick到表面的点,但太大了有时不跟手,且总容易吸附到近点
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let r = 10;
|
|
|
|
|
|
|
|
hits.forEach( hit=>{
|
|
hits.forEach( hit=>{
|
|
|
let disDiff = hit.disSquare - nearest.disSquare; //和最近点的偏差
|
|
let disDiff = hit.disSquare - nearest.disSquare; //和最近点的偏差
|
|
@@ -97819,7 +97813,30 @@ ENDSEC
|
|
|
pano: panoSet,
|
|
pano: panoSet,
|
|
|
callback: deferred.resolve.bind(deferred, !0)
|
|
callback: deferred.resolve.bind(deferred, !0)
|
|
|
} );
|
|
} );
|
|
|
- } else {
|
|
|
|
|
|
|
+ } else { //如果离数据集较远,转动也很难找到点云,就飞到就近点:
|
|
|
|
|
+ let po = viewer.scene.pointclouds.find(e=>e.visibleNodes.some(a=>a.getLevel() > Math.ceil(e.maxLevel * 0.15) )); //虽然当点云在前方很远的地方也可能符合
|
|
|
|
|
+
|
|
|
|
|
+ if(!po){//无可见点云
|
|
|
|
|
+ //console.log('no visi cloud')
|
|
|
|
|
+
|
|
|
|
|
+ if(!this.panos.length){//如果场景中没有漫游点,如SG-t-XPf1k9pv3Zg 点击后回到可见区域
|
|
|
|
|
+ let map = new Map();
|
|
|
|
|
+ let clouds = viewer.scene.pointclouds.filter(e=>e.root.geometryNode);
|
|
|
|
|
+ clouds.forEach(e=>map.set(e, e.bound.distanceToPoint(this.position)));
|
|
|
|
|
+ clouds.sort((a,b)=>map.get(a) - map.get(b));
|
|
|
|
|
+
|
|
|
|
|
+ viewer.flyToDataset({focusOnPoint:true, pointcloud:clouds[0] });//飞最近的一个点云
|
|
|
|
|
+ return deferred.promise();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ this.flyToPano({
|
|
|
|
|
+ pano: this.findNearestPano(),
|
|
|
|
|
+ callback: deferred.resolve.bind(deferred, !0)
|
|
|
|
|
+ });
|
|
|
|
|
+ return deferred.promise();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
this.bump(direction);
|
|
this.bump(direction);
|
|
|
deferred.resolve(!1);
|
|
deferred.resolve(!1);
|
|
|
}
|
|
}
|
|
@@ -133264,8 +133281,12 @@ ENDSEC
|
|
|
|
|
|
|
|
let distance = camera.position.distanceTo(this.rotateStartInfo.rotCenter/* this.intersectStart.location */); //不按下ctrl的话
|
|
let distance = camera.position.distanceTo(this.rotateStartInfo.rotCenter/* this.intersectStart.location */); //不按下ctrl的话
|
|
|
|
|
|
|
|
- if(this.rotateStartInfo.rotCenter2d.z>1)distance *= -1; //在背面
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ let posDir = new Vector3().subVectors(this.rotateStartInfo.rotCenter, view.position);
|
|
|
|
|
+ if(posDir.dot(view.direction) < 0 )distance *= -1; //在背面
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
//按照orbitControl的方式旋转:
|
|
//按照orbitControl的方式旋转:
|
|
|
let rotationSpeed = 2;
|
|
let rotationSpeed = 2;
|
|
|
this.yawDelta -= e.drag.pointerDelta.x * rotationSpeed;
|
|
this.yawDelta -= e.drag.pointerDelta.x * rotationSpeed;
|
|
@@ -138063,6 +138084,30 @@ ENDSEC
|
|
|
else pointcloud = this.scene.pointclouds.find(p => p.dataset_id == o.id);
|
|
else pointcloud = this.scene.pointclouds.find(p => p.dataset_id == o.id);
|
|
|
|
|
|
|
|
let duration = o.duration == void 0 ? 1000 : o.duration;
|
|
let duration = o.duration == void 0 ? 1000 : o.duration;
|
|
|
|
|
+
|
|
|
|
|
+ if(o.focusOnPoint){//focus点云上一点,避免center区域刚好没有点
|
|
|
|
|
+ if(pointcloud.root.geometryNode){
|
|
|
|
|
+ let posArr = pointcloud.root.geometryNode.geometry.attributes.position.array;
|
|
|
|
|
+
|
|
|
|
|
+ let count = pointcloud.root.geometryNode.geometry.attributes.position.count;
|
|
|
|
|
+ let index = Math.ceil(count / 2); //随便取一个点
|
|
|
|
|
+ let point = new Vector3(posArr[index*3+0],posArr[index*3+1],posArr[index*3+2]);
|
|
|
|
|
+ //point.applyMatrix4(pointcloud.root.pointcloud.matrixWorld)
|
|
|
|
|
+ point.applyMatrix4(pointcloud.root.sceneNode.matrixWorld);
|
|
|
|
|
+ viewer.focusOnObject({position:point},'point',duration,{dontChangeCamDir:true, distance:15});
|
|
|
|
|
+
|
|
|
|
|
+ o.dontMoveMap || viewer.mapViewer.fitToPointcloud(pointcloud, duration);
|
|
|
|
|
+ console.log('flyToDataset focusOnPoint done');
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
var center = pointcloud.bound.getCenter(new Vector3);
|
|
var center = pointcloud.bound.getCenter(new Vector3);
|
|
|
let position;
|
|
let position;
|
|
|
let getPano = ()=>{//获取离中心最近的pano
|
|
let getPano = ()=>{//获取离中心最近的pano
|
|
@@ -138325,7 +138370,6 @@ ENDSEC
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------
|
|
//-------------
|
|
|
- this.images360.update();
|
|
|
|
|
|
|
|
|
|
this.computeShelter();
|
|
this.computeShelter();
|
|
|
//-------------
|
|
//-------------
|