|
|
@@ -67228,7 +67228,7 @@
|
|
|
viewport.targetPlane.setFromNormalAndCoplanarPoint(view.direction.clone(), boundCenter);
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget); //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
|
|
|
- info.endPosition = this.getPosOutOfModel(viewport, boundSize);
|
|
|
+ info.endPosition = this.getPosOutOfModel(viewport, boundSize).position;
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
|
|
|
|
@@ -67270,10 +67270,23 @@
|
|
|
//let {boundSize, center} = viewer.bound
|
|
|
boundSize = boundSize || this.getViewBound(viewport).boundSize;
|
|
|
var expand = 10;
|
|
|
- var radius = boundSize.length() * 2;
|
|
|
- var position = viewport.shiftTarget.clone().sub(viewport.view.direction.clone().multiplyScalar(radius + expand));
|
|
|
- return position;
|
|
|
+ var radius = (viewport.rotateSide ? boundSize.length() : boundSize.clone().projectOnVector(viewport.view.direction).length()) * 2;
|
|
|
+ var far = radius + expand;
|
|
|
+ var position = viewport.shiftTarget.clone().sub(viewport.view.direction.clone().multiplyScalar(far));
|
|
|
+ far *= 2; //for camera.
|
|
|
+ return {
|
|
|
+ position,
|
|
|
+ far
|
|
|
+ };
|
|
|
}
|
|
|
+
|
|
|
+ /* getCamFar(viewport){
|
|
|
+ let boundSize = this.getViewBound(viewport).boundSize
|
|
|
+ let expand = 30;
|
|
|
+ let radius = boundSize.length() * 2
|
|
|
+ return expand + radius
|
|
|
+ } */
|
|
|
+
|
|
|
updateCameraOutOfModel() {
|
|
|
//因为移动模型导致模型超出相机外,所以更新位置
|
|
|
viewer.viewports.forEach((viewport, i) => {
|
|
|
@@ -67287,9 +67300,15 @@
|
|
|
viewport.targetPlane.projectPoint(viewport.view.position, viewport.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
*/
|
|
|
this.setShiftTarget(viewport, boundCenter);
|
|
|
- var endPosition = this.getPosOutOfModel(viewport, boundSize);
|
|
|
+ var {
|
|
|
+ position,
|
|
|
+ far
|
|
|
+ } = this.getPosOutOfModel(viewport, boundSize);
|
|
|
//if(viewport.name == 'mapViewport')endPosition.z = Math.max(Potree.config.map.cameraHeight, endPosition.z)
|
|
|
- viewport.view.position.copy(endPosition);
|
|
|
+
|
|
|
+ viewport.view.position.copy(position);
|
|
|
+ viewport.camera.far = far;
|
|
|
+ viewport.camera.updateProjectionMatrix();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -67320,7 +67339,7 @@
|
|
|
vec.applyMatrix4(rotMatrix);
|
|
|
viewport.shiftTarget.subVectors(center, vec); //新的
|
|
|
|
|
|
- viewport.view.position = this.getPosOutOfModel(viewport, boundSize);
|
|
|
+ viewport.view.position.copy(this.getPosOutOfModel(viewport, boundSize).position);
|
|
|
}
|
|
|
getOrthoCamera() {
|
|
|
var camera = new OrthographicCamera(-100, 100, 100, 100, 0.01, 10000);
|
|
|
@@ -73154,8 +73173,9 @@
|
|
|
//镜头朝向
|
|
|
active: true,
|
|
|
//相机位置在z轴正向
|
|
|
- limitBound: new Box3(new Vector3(-Infinity, -Infinity, 1), new Vector3(Infinity, Infinity, 5000)),
|
|
|
- //在地面以上
|
|
|
+ viewContainsPoints: [new Vector3(0, 0, 0)],
|
|
|
+ //为了看到ground
|
|
|
+ // limitBound: new THREE.Box3(new THREE.Vector3(-Infinity,-Infinity, 1),new THREE.Vector3(Infinity,Infinity,5000)), //在地面以上
|
|
|
margin: {
|
|
|
x: 50,
|
|
|
y: 150
|
|
|
@@ -73171,6 +73191,7 @@
|
|
|
active: true,
|
|
|
//相机位置在x轴负向 右下角屏
|
|
|
viewContainsPoints: [new Vector3(0, 0, 0)],
|
|
|
+ //为了看到轴线
|
|
|
margin: {
|
|
|
x: 300,
|
|
|
y: 250
|
|
|
@@ -73529,11 +73550,28 @@
|
|
|
viewer.compass.setDomPos();
|
|
|
|
|
|
//this.changeSkyboxGeo(true)
|
|
|
+ /*
|
|
|
+ if(this.selected){
|
|
|
+ this.splitFarFun = ()=>{//移动位置后两边都要更新far
|
|
|
+ viewer.viewports.forEach(v=>{
|
|
|
+ let far = this.SplitScreen.getCamFar(v)
|
|
|
+ v.camera.far = far
|
|
|
+ v.camera.updateProjectionMatrix()
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+ this.selected.addEventListener('transformChanged', this.splitFarFun)
|
|
|
+
|
|
|
+ this.splitFarFun()
|
|
|
+ } */
|
|
|
+ this.SplitScreen.updateCameraOutOfModel();
|
|
|
},
|
|
|
leaveSplit() {
|
|
|
this.split = false;
|
|
|
this.SplitScreen.unSplit();
|
|
|
viewer.setControls(viewer.orbitControls);
|
|
|
+ //this.selected?.removeEventListener('transformChanged', this.splitFarFun)
|
|
|
+
|
|
|
Potree.settings.pointDensity = this.beforeSplit.pointDensity;
|
|
|
/* if(this.selected && this.selected.isPointcloud){
|
|
|
this.showModelOutline(this.selected, true)
|