xzw 2 năm trước cách đây
mục cha
commit
26fab154b0

+ 11 - 5
libs/three.js/lines/LineMaterial.js

@@ -52,7 +52,7 @@ UniformsLib.line = {
     depthTexture:{ value: null },
     nearPlane:{value: 0.1},
     farPlane:{value: 100000},
-
+    uUseOrthographicCamera:{ type: "b", value: false },
 };
 
 ShaderLib[ 'line' ] = {
@@ -301,7 +301,8 @@ ShaderLib[ 'line' ] = {
 		uniform vec3 diffuse;
 		uniform float opacity;
 		uniform float lineWidth;
-         
+        uniform bool uUseOrthographicCamera;
+        
 		#ifdef USE_DASH
 
 			uniform float dashOffset;
@@ -355,9 +356,14 @@ ShaderLib[ 'line' ] = {
         #if defined(GL_EXT_frag_depth) && defined(useDepth)  
             float convertToLinear(float zValue)
             {
-                float z = zValue * 2.0 - 1.0;
-                return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
+                if(uUseOrthographicCamera){
+                    return zValue*(farPlane-nearPlane)+nearPlane;
+                }else{ 
+                    float z = zValue * 2.0 - 1.0;
+                    return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
+                }  
             }
+            
         #endif
 
 
@@ -939,7 +945,7 @@ class LineMaterial extends ShaderMaterial {
             this.uniforms.nearPlane.value = camera.near;
             this.uniforms.farPlane.value = camera.far;
         }
-           
+        this.uniforms.uUseOrthographicCamera.value = !camera.isPerspectiveCamera
     }
 
 }

+ 8 - 4
src/custom/materials/DepthBasicMaterial.js

@@ -10,7 +10,8 @@ export default class DepthBasicMaterial extends THREE.ShaderMaterial{
         
         let uniforms = {
 			resolution:    { type: 'v2',  value: new THREE.Vector2(width, height ) },
-            viewportOffset: { type: 'v2',  value: new THREE.Vector2(0, 0 ) }, //left, top    
+            viewportOffset: { type: 'v2',  value: new THREE.Vector2(0, 0 ) }, //left, top   
+            uUseOrthographicCamera:{ type: "b", value: false },
 			nearPlane:     { type: 'f', 	value: 0.1 },
 			farPlane:      { type: 'f', 	value: 10000 }, 
 			depthTexture:   { type: 't', 	value: null }, 
@@ -24,7 +25,8 @@ export default class DepthBasicMaterial extends THREE.ShaderMaterial{
             maxOcclusionFactor :  { type: 'f', 	value: o.maxOcclusionFactor || 1 },  //0-1
             //-------add:-----
             replaceColor : {type:'v3', value: o.replaceColor ?  new THREE.Color(o.replaceColor) : null},
-            beReplacedRed : {type:'f', value: o.beReplacedRed},
+            beReplacedRed : {type:'f', value: o.beReplacedRed}, 
+            
         }  
      
         super({ 
@@ -162,7 +164,7 @@ export default class DepthBasicMaterial extends THREE.ShaderMaterial{
         return this
     }
     
-    
+     
     
     
     updateDepthParams(e={}){//主要用于点云遮住mesh
@@ -179,7 +181,9 @@ export default class DepthBasicMaterial extends THREE.ShaderMaterial{
             this.uniforms.nearPlane.value = camera.near;
             this.uniforms.farPlane.value = camera.far;
         }
-              
+         
+
+        this.uniforms.uUseOrthographicCamera.value = !camera.isPerspectiveCamera
     }
 
     

+ 1 - 1
src/custom/modules/panos/Images360.js

@@ -170,7 +170,7 @@ export class Images360 extends THREE.EventDispatcher{
             this.domRoot.appendChild(elUnfocus[0]);
             
             if(Potree.settings.editType != 'merge'){
-            
+             
                 let elHide = $("<input type='button' value='隐藏点云'></input>")
                 elHide.css({
                     position : "absolute",

+ 6 - 6
src/custom/settings.js

@@ -66,12 +66,12 @@ const config = {//配置参数   不可修改
     
     urls:{
         //localTextures:'../resources/textures/', 
-        prefix1: 'https://laser-oss.4dkankan.com',//oss
-        prefix2: 'https://testlaser.4dkankan.com',
-        prefix3: 'https://4dkk.4dage.com',
-        prefix4: 'https://uat-laser.4dkankan.com',//test.4dkankan
-        prefix5: 'https://laser.4dkankan.com',
-        prefix6: 'https://mix3d.4dkankan.com/backend',
+        prefix1: '',//'https://laser-oss.4dkankan.com',//oss
+        prefix2: '',//'https://testlaser.4dkankan.com',
+        prefix3: '',//'https://4dkk.4dage.com',
+        prefix4: '',//'https://uat-laser.4dkankan.com',//test.4dkankan
+        prefix5: '',//'https://laser.4dkankan.com',
+        prefix6: '',//'https://mix3d.4dkankan.com/backend',
         
     },
     

+ 1 - 1
src/custom/start.js

@@ -132,7 +132,7 @@ export function start(dom, navDom, number ){ //t-Zvd3w0m
             }else if(e.event.key == 'y'){
                 viewer.images360.cube.material.wireframe = false
                 viewer.images360.cube.visible = Potree.settings.displayMode == 'showPanos'
-            }                
+            }                 
         }) 
         
     }  

+ 9 - 3
src/materials/shaders/depthBasic.fs

@@ -25,11 +25,17 @@ uniform vec3 baseColor;
     uniform float clipDistance;
     uniform float maxClipFactor;
     uniform float maxOcclusionFactor;
-
+    uniform bool uUseOrthographicCamera;
+    
+    
     float convertToLinear(float zValue)
     {
-        float z = zValue * 2.0 - 1.0;
-        return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
+        if(uUseOrthographicCamera){
+            return zValue*(farPlane-nearPlane)+nearPlane;
+        }else{ 
+            float z = zValue * 2.0 - 1.0;
+            return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
+        }  
     }
 #endif