|
@@ -76160,12 +76160,16 @@ void main()
|
|
viewer.addTimeMark('pick','start');
|
|
viewer.addTimeMark('pick','start');
|
|
|
|
|
|
let getVal = (a, b) => a != void 0 ? a : b;
|
|
let getVal = (a, b) => a != void 0 ? a : b;
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
let pickWindowSize_ = MathUtils$1.clamp( Math.round((1.1-this.maxLevel/this.nodeMaxLevel)*80), 5, 100);
|
|
let pickWindowSize_ = MathUtils$1.clamp( Math.round((1.1-this.maxLevel/this.nodeMaxLevel)*80), 5, 100);
|
|
let pickWindowSize = getVal(params.pickWindowSize, pickWindowSize_ ); /* 65 */ //拾取像素边长,越小越精准,但点云稀疏的话可能容易出现识别不到的情况。 另外左下侧会有缝隙无法识别到,缝隙大小和这个值有关//突然发现pickWindowSize在一百以内的变化对pick费时影响甚微,1和100差1毫秒不到,但400时会多4毫秒
|
|
let pickWindowSize = getVal(params.pickWindowSize, pickWindowSize_ ); /* 65 */ //拾取像素边长,越小越精准,但点云稀疏的话可能容易出现识别不到的情况。 另外左下侧会有缝隙无法识别到,缝隙大小和这个值有关//突然发现pickWindowSize在一百以内的变化对pick费时影响甚微,1和100差1毫秒不到,但400时会多4毫秒
|
|
|
|
|
|
|
|
+ if(camera.type == 'OrthographicCamera'){
|
|
|
|
+ var cameraDir = new Vector3(0,0,-1).applyQuaternion(camera.quaternion);
|
|
|
|
+ pickWindowSize *= 4; //pointsize比较大时截取太小会没多少点可以选
|
|
|
|
+ }
|
|
|
|
+
|
|
let pickOutsideClipRegion = getVal(params.pickOutsideClipRegion, false);
|
|
let pickOutsideClipRegion = getVal(params.pickOutsideClipRegion, false);
|
|
|
|
|
|
let size = viewport ? viewport.resolution : renderer.getSize(new Vector2());
|
|
let size = viewport ? viewport.resolution : renderer.getSize(new Vector2());
|
|
@@ -76394,7 +76398,12 @@ void main()
|
|
|
|
|
|
//add
|
|
//add
|
|
if(!params.all){
|
|
if(!params.all){
|
|
- hit.disSquare = camera.position.distanceToSquared(position);
|
|
|
|
|
|
+ if(camera.type == 'OrthographicCamera'){
|
|
|
|
+ let vec = new Vector3().subVectors(position, camera.position);
|
|
|
|
+ hit.disSquare = vec.projectOnVector( cameraDir ).lengthSq(); //只考虑到相机的垂直距离
|
|
|
|
+ }else {
|
|
|
|
+ hit.disSquare = camera.position.distanceToSquared(position);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
} else if (attributeName === 'indices') {
|
|
} else if (attributeName === 'indices') {
|
|
|
|
|
|
@@ -76436,13 +76445,18 @@ void main()
|
|
return null;
|
|
return null;
|
|
}else {
|
|
}else {
|
|
//为了防止透过点云缝隙,选到后排的点云,将选取的位置离相机的距离考虑进去。倾向选择离相机近、且离鼠标位置近的点。(否则按照原方案只选离鼠标位置最近的,可能从高楼不小心走到下层,导航选点也是)
|
|
//为了防止透过点云缝隙,选到后排的点云,将选取的位置离相机的距离考虑进去。倾向选择离相机近、且离鼠标位置近的点。(否则按照原方案只选离鼠标位置最近的,可能从高楼不小心走到下层,导航选点也是)
|
|
- let sorted1 = hits.sort( (a, b) => a.disSquare - b.disSquare );
|
|
|
|
|
|
+ let sorted1 = hits.sort( (a, b) => a.disSquare - b.disSquare ).slice();
|
|
|
|
|
|
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 ratio = 0.5;//0.1 //系数越大越不跟手,但更容易pick近处的。 (当pick的点较远时,获取框内的点距离可能差别很大,就要所以除以disSquare)
|
|
|
|
- let r = rSquare/Math.max(nearest.disSquare,0.001) * ratio;
|
|
|
|
hits.forEach( hit=>{
|
|
hits.forEach( hit=>{
|
|
let disDiff = hit.disSquare - nearest.disSquare; //和最近点的偏差
|
|
let disDiff = hit.disSquare - nearest.disSquare; //和最近点的偏差
|
|
hit.disDiff = disDiff;
|
|
hit.disDiff = disDiff;
|
|
@@ -76451,10 +76465,10 @@ void main()
|
|
|
|
|
|
let sorted2 = hits.sort( (a, b) => b.score - a.score );
|
|
let sorted2 = hits.sort( (a, b) => b.score - a.score );
|
|
|
|
|
|
- //console.log(sorted2, 'nearest',nearest)
|
|
|
|
|
|
+ //console.log(sorted2[0].point.position.z )
|
|
return sorted2[0].point;
|
|
return sorted2[0].point;
|
|
|
|
|
|
- //return hits[0].point;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -81221,9 +81235,7 @@ void main()
|
|
viewer.dispatchEvent({type:'dragMarker', object:this});
|
|
viewer.dispatchEvent({type:'dragMarker', object:this});
|
|
return true
|
|
return true
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
@@ -81233,7 +81245,7 @@ void main()
|
|
|
|
|
|
|
|
|
|
dragChange(intersectPos, i, atMap){
|
|
dragChange(intersectPos, i, atMap){
|
|
-
|
|
|
|
|
|
+
|
|
let len = this.markers.length;
|
|
let len = this.markers.length;
|
|
let oldPoint = this.points[i];
|
|
let oldPoint = this.points[i];
|
|
if(atMap){
|
|
if(atMap){
|
|
@@ -105923,7 +105935,7 @@ ENDSEC
|
|
const width2dPX = Math.round(window.devicePixelRatio >= 2 ? ( window.screen.width * window.screen.height >= maxPX ? window.devicePixelRatio/1.2 : window.devicePixelRatio/1.5)*w : w); //触屏或高分辨率的可能要放大些。但在手机上不能太大
|
|
const width2dPX = Math.round(window.devicePixelRatio >= 2 ? ( window.screen.width * window.screen.height >= maxPX ? window.devicePixelRatio/1.2 : window.devicePixelRatio/1.5)*w : w); //触屏或高分辨率的可能要放大些。但在手机上不能太大
|
|
//console.log('width2dPX', width2dPX)
|
|
//console.log('width2dPX', width2dPX)
|
|
|
|
|
|
-
|
|
|
|
|
|
+ const orthoView = new ExtendView();
|
|
|
|
|
|
class Magnifier extends Object3D {//放大镜or望远镜
|
|
class Magnifier extends Object3D {//放大镜or望远镜
|
|
constructor (viewer) {
|
|
constructor (viewer) {
|
|
@@ -106146,19 +106158,23 @@ ENDSEC
|
|
if(playerCamera.type == 'OrthographicCamera'){
|
|
if(playerCamera.type == 'OrthographicCamera'){
|
|
|
|
|
|
var finalDisToAim = 2;
|
|
var finalDisToAim = 2;
|
|
-
|
|
|
|
- }else {
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ }else {
|
|
var finalDisToAim = dis>magDisMin ? dis > fareast ? magDisMax : (dis-magDisMin) / (fareast-magDisMin) * (magDisMax-magDisMin) + magDisMin : dis / 2; //dis>magDistance_ ? magDistance_ : dis / 2;
|
|
var finalDisToAim = dis>magDisMin ? dis > fareast ? magDisMax : (dis-magDisMin) / (fareast-magDisMin) * (magDisMax-magDisMin) + magDisMin : dis / 2; //dis>magDistance_ ? magDistance_ : dis / 2;
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
this.camera.position.copy(aimPos).add(dirToCamera.multiplyScalar(finalDisToAim));
|
|
this.camera.position.copy(aimPos).add(dirToCamera.multiplyScalar(finalDisToAim));
|
|
this.camera.lookAt(aimPos);
|
|
this.camera.lookAt(aimPos);
|
|
this.camera.fov = playerCamera.type == 'OrthographicCamera' ? 30 : playerCamera.fov / 2;
|
|
this.camera.fov = playerCamera.type == 'OrthographicCamera' ? 30 : playerCamera.fov / 2;
|
|
this.camera.updateProjectionMatrix();
|
|
this.camera.updateProjectionMatrix();
|
|
|
|
|
|
-
|
|
|
|
|
|
+ if(playerCamera.type == 'OrthographicCamera'){
|
|
|
|
+ orthoView.position.copy(this.camera.position);
|
|
|
|
+ orthoView.yaw = viewer.mainViewport.view.yaw;
|
|
|
|
+ orthoView.pitch = viewer.mainViewport.view.pitch;
|
|
|
|
+ orthoView.applyToCamera(this.camera);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
//自身位置
|
|
//自身位置
|