Browse Source

fix: 转换过程中旋转屏幕后比例不对

xzw 2 years ago
parent
commit
7bbc5861a1
2 changed files with 19 additions and 38 deletions
  1. 18 37
      public/static/lib/potree/potree.js
  2. 1 1
      public/static/lib/potree/potree.js.map

+ 18 - 37
public/static/lib/potree/potree.js

@@ -54325,13 +54325,18 @@
 	    
 	    
 	    tranCamera(viewport,  info, duration,  easeName){
-	        viewport.camera = info.midCamera;
+	        viewport.camera = info.midCamera; 
+	        viewport.tranAimCamera = info.endCamera;
+	        
 	        //viewport.camera.matrixWorld = info.endCamera.matrixWorld
 	        console.log('tranCamera');
 	         
 	        //viewer.setCameraMode(CameraMode.ORTHOGRAPHIC) 
 	        info.midCamera.projectionMatrix.copy(info.startCamera.projectionMatrix);
 	        
+	        viewer.updateScreenSize({forceUpdateSize:true});  //更新endCamera的projection,因此前可能resize过
+	        
+	        
 	        let onUpdate = info.onUpdate;
 	        info.onUpdate = (progress, delta)=>{ 
 	            lerp.matrix4(info.midCamera.projectionMatrix, info.endCamera.projectionMatrix)(progress); 
@@ -54342,7 +54347,8 @@
 	        
 	        let callback = info.callback;
 	        info.callback = info.cancelFun = ()=>{ 
-	            viewport.camera = info.endCamera;  
+	            viewport.camera = info.endCamera; 
+	            viewport.tranAimCamera = null; 
 	            viewer.scene.measurements.forEach((e)=>{ 
 	                Potree.Utils.updateVisible(e, 'tranCamera', true); 
 	            }); 
@@ -88722,20 +88728,7 @@ void main()
 	            gl.bindVertexArray = extVAO.bindVertexArrayOES.bind(extVAO);
 	        }
 
-	                                                            
-	                           
-	 
-	                                                
-	                                      
-	                               
-	                                                                            
-	                  
-	       /*  let oldClear = gl.clear; 
-	        gl.clear = (bits)=>{
-	             console.error('clear')
-	        }   
-	 */
-	        
+	             
 	    }
 	    
 	    
@@ -88794,9 +88787,11 @@ void main()
 	                if(height_ == 0)return  //avoid NAN
 	                
 	                let aspect = width_ / height_;  //camera的参数精确些,不用视口的归整的resolution像素值,否则hasChange无法为true, 导致canvasResize了但map没update从而闪烁
-	                view.camera.aspect = aspect;
 	                
-	                if(view.camera.type == "OrthographicCamera"){
+	                let camera = view.tranAimCamera || view.camera; //当view.camera是viewer.scene.cameraBasic时使用tranAimCamera
+	                camera.aspect = aspect;
+	                
+	                if(camera.type == "OrthographicCamera"){
 	                     
 	                    /* //不改宽度 同4dkk
 	                    var heightHalf = view.camera.right / aspect 
@@ -88804,10 +88799,10 @@ void main()
 	                    view.camera.bottom = -heightHalf  */
 	                    //高宽都改 使大小不随视口大小改变  navvis (直接和视口大小一致即可,通过zoom来定大小)
 	                     
-	                    view.camera.left = -width_/2; 
-	                    view.camera.right = width_/2;
-	                    view.camera.bottom = -height_/2;
-	                    view.camera.top = height_/2;
+	                    camera.left = -width_/2; 
+	                    camera.right = width_/2;
+	                    camera.bottom = -height_/2;
+	                    camera.top = height_/2;
 	                    
 	                    
 	                }else {   
@@ -88815,7 +88810,7 @@ void main()
 	                
 	                }
 	                
-	                view.camera.updateProjectionMatrix();
+	                camera.updateProjectionMatrix();
 	            });
 	        }
 	        
@@ -88876,21 +88871,7 @@ void main()
 	        
 	       
 	        let {width, height} = size;
-	        
-	        
-	        
-	        
-	        /* let oldBudget = Potree.pointBudget;
-	        Potree.pointBudget = Math.max(10 * 1000 * 1000, 2 * oldBudget);
-	        let result = Potree.updatePointClouds(this.scene.pointclouds, camera, size );
-	        Potree.pointBudget = oldBudget;
 	         
-	         
-			this.dispatchEvent({ //resize everything  such as lines  targets
-	            type: 'resize', 
-	            resolution: new THREE.Vector2(width,height), 
-	        });*/
-	       
 			let target = new WebGLRenderTarget(width, height, {
 				format: RGBAFormat,
 			});

File diff suppressed because it is too large
+ 1 - 1
public/static/lib/potree/potree.js.map