bill 2 lat temu
rodzic
commit
32af74e043

Plik diff jest za duży
+ 2 - 2
public/js/smart.js


+ 61 - 27
public/static/lib/potree/potree.js

@@ -57158,6 +57158,7 @@
 	    depthTexture:{ value: null },
 	    nearPlane:{value: 0.1},
 	    farPlane:{value: 100000},
+	    //uUseOrthographicCamera:{ type: "b", value: false },
 
 	};
 
@@ -57379,7 +57380,7 @@
 				offset *= lineWidth;
 
 				// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
-				offset /= resolution.y * devicePixelRatio;
+				offset /= resolution.y; //* devicePixelRatio;
 
 				// select end
 				vec4 clip = ( position.y < 0.5 ) ? clipStart : clipEnd;
@@ -57407,7 +57408,7 @@
 		uniform vec3 diffuse;
 		uniform float opacity;
 		uniform float lineWidth;
-         
+        uniform bool uUseOrthographicCamera; 
 		#ifdef USE_DASH
 
 			uniform float dashOffset;
@@ -57461,8 +57462,12 @@
         #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
 
@@ -57961,7 +57966,7 @@
 	        this.events = {
 	            setSize:(e)=>{//如果出现横条状的异常,往往是viewportOffset出错  //地图不需要
 	                let viewport = e.viewport; 
-	                this.uniforms.resolution.value.copy(viewport.resolution);  
+	                this.uniforms.resolution.value.copy(viewport.resolution2);  
 	                this.uniforms.devicePixelRatio.value = window.devicePixelRatio; 
 	                this.lineWidth = this.lineWidth_; //update
 	                if(!this.useDepth || !e.viewport.camera.isPerspectiveCamera || !e.viewport)return
@@ -58043,7 +58048,7 @@
 	            this.uniforms.nearPlane.value = camera.near;
 	            this.uniforms.farPlane.value = camera.far;
 	        }
-	           
+	        //this.uniforms.uUseOrthographicCamera.value = !camera.isPerspectiveCamera
 	    }
 
 	}
@@ -63553,12 +63558,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
   
 void main() {
@@ -70795,7 +70805,8 @@ void main()
 	        
 	        let uniforms = {
 				resolution:    { type: 'v2',  value: new Vector2(width, height ) },
-	            viewportOffset: { type: 'v2',  value: new Vector2(0, 0 ) }, //left, top    
+	            viewportOffset: { type: 'v2',  value: new 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 }, 
@@ -70827,8 +70838,22 @@ void main()
 	                if(!this.useDepth || !e.viewport.camera.isPerspectiveCamera || !e.viewport)return
 	                let viewport = e.viewport;
 	                let viewportOffset = viewport.offset || new Vector2(); 
-	                this.uniforms.resolution.value.copy(viewport.resolution); 
+	                this.uniforms.resolution.value.copy(viewport.resolution2);  //2023.6.12突然发现ratio>1的用resolution不对,得用2才对。但是之前明明记得不是这样
 	                this.uniforms.viewportOffset.value.copy(viewportOffset);
+	                
+	                
+	                /* let dt = this.uniforms.depthTexture.value
+	                if(window.logDep != 1000 && dt ){ 
+	                    window.logDep = (window.logDep || 0) + 1
+	                    
+	                    
+	                    console.log(' DepthParams', [ viewport.resolution.x, viewport.resolution.y], 
+	                        [dt.image.width, dt.image.height] ,
+	                        this.uniforms.nearPlane.value, this.uniforms.farPlane.value
+	                    )
+	                    
+	                } */
+	                
 	            },
 	            render:(e)=>{//before render  如果有大于两个viewport的话,不同viewport用不同的depthTex
 	                this.updateDepthParams(e);
@@ -70958,8 +70983,10 @@ void main()
 	            this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(viewport).depthTexture;   //其实只赋值一次就行
 	            this.uniforms.nearPlane.value = camera.near;
 	            this.uniforms.farPlane.value = camera.far;
+	            
+	            
 	        }
-	              
+	        //this.uniforms.uUseOrthographicCamera.value = !camera.isPerspectiveCamera
 	    }
 
 	    
@@ -71029,7 +71056,7 @@ void main()
 	        while(parent){
 	            if(parent.visible === false){
 	                v = false;
-	                break; 
+	                break;  
 	            }
 	            lastParent = parent;
 	            parent = parent.parent;
@@ -72852,11 +72879,13 @@ void main()
 	    let gl_;
 	    Features.EXT_DEPTH = { 
 	        isSupported: function (gl) { 
-	        
+	         
 	            gl = gl || gl_;
 	            gl_ = gl;
 	            if(browser.detectIOS()){
 	                let {major,minor,patch} = browser.iosVersion();
+	                //console.warn('iosVersion',major,minor,patch)
+	                
 	                if(major == 15 && minor == 4 && patch == 1){
 	                    console.warn('检测到是ios15.4.1, 关闭EXT_frag_depth');//该版本ext_depth有问题,导致clear错乱。没有解决办法先关闭。
 	                    return false
@@ -73541,9 +73570,12 @@ void main()
 	    update(); 
 	    
 	}; 
-	 
-	 
-	 
+	/* 
+	    复杂案例: 如果物体默认隐藏, 当符合任何一个其他条件时可见,则可:
+	    Potree.Utils.updateVisible(this, "default", false, 0 ) //默认隐藏    
+	    Potree.Utils.updateVisible(this, 条件名,  ifShow, 1, ifShow?'add':'cancel' ) //其他的条件
+	*/ 
+
 	 
 	Utils.getObjVisiByReason = function(object,reason){//获取在某条件下是否可见.  注: 用户在数据集选择可不可见为"datasetSelection"
 	    if(object.visible)return true
@@ -74800,6 +74832,11 @@ void main()
 	     */ 
 	    Potree.settings.number = number || 't-o5YMR13';// 't-iksBApb'// 写在viewer前
 	 
+	    if(!Potree.settings.isOfficial){ 
+	        if(/* Potree.settings.isTest && */ browser.isMobile()){
+	            changeLog();
+	        }
+	    }  
 	    
 	    if(browser.urlHasValue('google'))Potree.settings.mapCompany = 'google'; 
 	    if(browser.urlHasValue('timing'))Potree.measureTimings = 1;
@@ -74826,10 +74863,7 @@ void main()
 	            viewer.toggleSidebar();
 	        }); 
 	        Potree.settings.sizeFitToLevel = true;//当type为衰减模式时自动根据level调节大小。每长一级,大小就除以2
-	        Potree.settings.rotAroundPoint = false;
-	        if(/* Potree.settings.isTest && */ browser.isMobile()){
-	            changeLog();
-	        }
+	        Potree.settings.rotAroundPoint = false; 
 	    }  
 
 	    Potree.loadDatasetsCallback = function(data, ifReload){
@@ -92459,10 +92493,11 @@ void main()
 	                
 	                var width_ = width * view.width;
 	                var height_ = height * view.height;
+	                 
+	                view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ); //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
 	                
-	                if(height_ == 0)return  //avoid NAN
 	                
-	                view.setResolution(Math.ceil(width_), Math.ceil(height_), width, height ); //本来应该是floor,但是这样奇数时会少一个像素,导致向左移一个像素且宽度少1。现在则多绘制1个像素,超出的1个像素应该不会绘制出来(但不知道其他地方是否有偏差,比如pick时)
+	                if(height_ == 0)return  //avoid NAN
 	                let aspect = width_ / height_;  //camera的参数精确些,不用视口的归整的resolution像素值,否则hasChange无法为true, 导致canvasResize了但map没update从而闪烁
 	                view.camera.aspect = aspect;
 	                
@@ -92962,9 +92997,8 @@ void main()
                     vec2 depth1 = getDepth(vWorldPosition1N, depthMap1, cameraHeight1, ceilHeight1, eyePos);
                     
                     
-                    gl_FragDepthEXT = mix(depth0.y,depth1.y,progress);
-                    
-                    
+                    gl_FragDepthEXT = mix(depth0.y,depth1.y,progress); 
+                    gl_FragDepthEXT = clamp(gl_FragDepthEXT, 0.0, 1.0);    //防止部分手机出现黑块。ios 16  。 因为我给的超远值超出范围
                     
 
                 #endif
@@ -95795,7 +95829,7 @@ void main()
 	        
 	        
 	        
-	        if(Potree.settings.isLocal){//原始规则
+	        if(Potree.settings.tileOriginUrl){//原始规则
 	            //1 === config.tiling.customCompression && (u = "_" + config.tiling["q" + e[panoSize]]);
 	            //1 === o.tiling.customCompression && (u = "_" + o.tiling["q" + e[n]]);
 	            d = "tiles/" + id + "/" + e[panoSize] + u + "_face" + h + "_" + t.tileX + "_" + t.tileY + ".jpg"; 

Plik diff jest za duży
+ 1 - 1
public/static/lib/potree/potree.js.map