|
@@ -70,16 +70,19 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
viewer.updateScreenSize({forceUpdateSize:true})
|
|
|
}
|
|
|
|
|
|
+
|
|
|
viewportFitBound(viewport, bound, center, duration=0, margin){
|
|
|
let view = viewport.view
|
|
|
let info = {bound}
|
|
|
- let {boundSize, boundCenter} = this.getViewBound(viewport)
|
|
|
+
|
|
|
+
|
|
|
+ let {boundSize, boundCenter} = this.getViewBound(viewport, bound )
|
|
|
|
|
|
- this.setShiftTarget(viewport, boundCenter)
|
|
|
- /*
|
|
|
+ //this.setShiftTarget(viewport, boundCenter)
|
|
|
+
|
|
|
viewport.targetPlane.setFromNormalAndCoplanarPoint( view.direction.clone(), boundCenter )
|
|
|
viewport.targetPlane.projectPoint(center, viewport.shiftTarget) //target转换到过模型中心的平面,以保证镜头一定在模型外 this.shiftTarget是得到的
|
|
|
- */
|
|
|
+
|
|
|
info.endPosition = this.getPosOutOfModel(viewport, boundSize)
|
|
|
|
|
|
//if(viewport.name == 'mapViewport')info.endPosition.z = Math.max(Potree.config.map.cameraHeight, info.endPosition.z)
|
|
@@ -89,10 +92,17 @@ class SplitScreen extends THREE.EventDispatcher{
|
|
|
}
|
|
|
|
|
|
|
|
|
- getViewBound(viewport){
|
|
|
- let {boundSize, center} = viewer.bound
|
|
|
+ getViewBound(viewport, boundingBox){
|
|
|
+ if(boundingBox){
|
|
|
+ boundSize = boundingBox.getSize(new THREE.Vector3)
|
|
|
+ center = boundingBox.getCenter(new THREE.Vector3)
|
|
|
+ }else{
|
|
|
+ var {boundSize, center, boundingBox} = viewer.bound
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if(viewport.viewContainsPoints){//视野范围内必须要包含的点,直接算入模型区域。这时候得到的boundCenter和模型中心不重合
|
|
|
- let boundingBox = viewer.bound.boundingBox.clone()
|
|
|
+ boundingBox = boundingBox.clone()
|
|
|
viewport.viewContainsPoints.forEach(point=>{
|
|
|
boundingBox.expandByPoint(point)
|
|
|
})
|