xzw 3 年之前
父節點
當前提交
5117b96f34
共有 3 個文件被更改,包括 21 次插入13 次删除
  1. 14 8
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map
  3. 6 4
      src/sdk/cover/index.js

+ 14 - 8
public/lib/potree/potree.js

@@ -81269,10 +81269,10 @@ void main() {
                             
                             if(camera.aspect > aspect){//视野更宽则用bound的纵向来决定
                                 h = boundSize.y; 
-                                endZoom = (viewport.resolution.y - margin.x) / h;    //注意,要在resolution不为0时执行 
+                                endZoom = (viewport.resolution.y - margin.y) / h;    //注意,要在resolution不为0时执行 
                             }else {
                                 w = boundSize.x;  
-                                endZoom = (viewport.resolution.x - margin.y) / w;
+                                endZoom = (viewport.resolution.x - margin.x) / w;
                             }  
                             //onUpdate时更新endzoom是因为画布大小可能更改
                         }  
@@ -112367,13 +112367,14 @@ ENDSEC
                     viewport.targetPlane = new Plane();
                     viewport.shiftTarget = new Vector3; //project在targetPlane上的位置
                 }
+                viewport.fitMargin = prop.margin;
                 viewports.push(viewport); 
             } 
             viewer.viewports = viewports;
             viewer.updateScreenSize({forceUpdateSize:true});
             viewports.forEach(viewport=>{
                 if(viewport.name == 'MainView')return
-                this.viewportFitBound(viewport, viewer.bound.boundingBox , viewer.bound.center);
+                this.viewportFitBound(viewport, viewer.bound.boundingBox , viewer.bound.center , 0, viewport.fitMargin);
             }); 
             return viewports
         } 
@@ -117353,7 +117354,8 @@ ENDSEC
         direction : new Vector3(0,0,-1), //镜头朝向 
         active: true,
         //相机位置在z轴正向
-        limitBound: new Box3(new Vector3(-Infinity,-Infinity, 1),new Vector3(Infinity,Infinity,5000)) //在地面以上
+        limitBound: new Box3(new Vector3(-Infinity,-Infinity, 1),new Vector3(Infinity,Infinity,5000)), //在地面以上
+        margin:{x:50, y:150} ,
     },
     {
         left:0.5,
@@ -117364,7 +117366,8 @@ ENDSEC
         direction : new Vector3(1,0,0), 
         active: true,
         //相机位置在x轴负向  右下角屏
-        viewContainsPoints:[new Vector3(0,0,0)]
+        viewContainsPoints:[new Vector3(0,0,0)],
+        margin:{x:300, y:250} ,
     } ];
      
      
@@ -129902,8 +129905,8 @@ ENDSEC
                         }//获取在scale为1时,表现出的大小
                         Common.makeTexDontResize(child.material.map); 
                         //console.log(child.name, 'roughness',child.material.roughness,'metalness',child.material.metalness)
-                        child.material.roughness = 0.6; 
-                        child.material.metalness = 0.3; 
+                        
+                        
                         
                         /* child.depthMat = child.material.clone()
                         child.standardMat = child.material
@@ -129928,7 +129931,10 @@ ENDSEC
                             child.material = material;
                            
                         }
-                        
+                        if(child.material instanceof MeshStandardMaterial){
+                            child.material.roughness = 0.6; 
+                            child.material.metalness = 0.3; 
+                        }
                     }
                 } );
 

文件差異過大導致無法顯示
+ 1 - 1
public/lib/potree/potree.js.map


+ 6 - 4
src/sdk/cover/index.js

@@ -396,10 +396,10 @@ export const enter = (dom, isLocal) => {
             if(!props.isFirstLoad){ 
                 if(autoLoads.length == 0){ //首次加载
                     setTimeout(()=>{
-                        let sizes = autoLoads.map(e=>e.size||'0')
+                        let sizes = autoLoads.map(e=>e.size|| 0 )
                         console.log('需要请求加载的模型大小为', sizes, '总大小', sizes.reduce(function(total, currentValue ){
                             let current = parseFloat(currentValue)
-                            return total + (currentValue.includes('M') ? current : current / 1024)
+                            return total + ((typeof currentValue == 'number' || currentValue.includes('M')) ? current : current / 1024)
                         }, 0))
                          
                         readyToAddModel = true  //准备开始加载
@@ -587,7 +587,7 @@ export const enter = (dom, isLocal) => {
                 enterAlignment(){//开始校准
                     MergeEditor.enterSplit()
                     result.leaveTransform()
-                    
+                     
                     let bus = new mitt()
                     
                     return { 
@@ -602,7 +602,9 @@ export const enter = (dom, isLocal) => {
                     let bus = new mitt()
                     let length, measure;
                     viewer.outlinePass.selectedObjects = []
-                    
+                    if(!Potree.Utils.isInsideFrustum(model.boundingBox, viewer.scene.getActiveCamera())){
+                        MergeEditor.focusOn(model, 600 )
+                    }
                 
                     MergeEditor.getAllObjects().forEach(m=>{//隐藏其他的模型
                         if(m!=model) viewer.updateVisible(m, 'enterScaleSet', false)