xzw 2 年之前
父節點
當前提交
f732df7c02
共有 2 個文件被更改,包括 96 次插入127 次删除
  1. 95 126
      public/static/lib/potree/potree.js
  2. 1 1
      public/static/lib/potree/potree.js.map

+ 95 - 126
public/static/lib/potree/potree.js

@@ -85099,7 +85099,7 @@ void main()
 	        this.createCompass();
 	          
 	        viewer.addEventListener('camera_changed', e => {
-	            if (e.viewport == this.viewport && (e.changeInfo.positionChanged || e.changeInfo.quaternionChanged)) {
+	            if (e.viewport == this.viewport && (/* e.changeInfo.positionChanged ||  */e.changeInfo.quaternionChanged)) {
 	                 this.update();
 	            } 
 	        });
@@ -88255,6 +88255,7 @@ void main()
 	        this.name = args.name;
 	        this.renderArea = domElement; 
 	        this.oldResolution = new Vector2();
+	        this.oldResolution2 = new Vector2();
 	        
 	        this.screenSizeInfo = {
 	            W:0, H:0, pixelRatio:1 , windowWidth:0, windowHeight:0
@@ -88369,14 +88370,15 @@ void main()
 
 	            w = this.renderArea.clientWidth;
 	            h = this.renderArea.clientHeight;
-	             
+	            
+	            
 	            if(w !== this.screenSizeInfo.W || h !== this.screenSizeInfo.H || o.forceUpdateSize || this.screenSizeInfo.pixelRatio != window.devicePixelRatio){
 	                this.screenSizeInfo.W = w; 
 	                this.screenSizeInfo.H = h; 
 	                render = true; 
 	                this.screenSizeInfo.pixelRatio = window.devicePixelRatio;  //如果player放在小窗口了,也要监测devicePixelRatio,因为缩放时client宽高不会改变
 	                //config.isMobile ? (ratio = Math.min(window.devicePixelRatio, 2)) : (ratio = window.devicePixelRatio)
-	                ratio = window.devicePixelRatio;
+	                ratio = window.devicePixelRatio; 
 	            }     
 	        }
 	        if (render) { 
@@ -88435,18 +88437,17 @@ void main()
 	        
 	        
 	        if(!onlyForTarget){//因为onlyForTarget不传递devicePixelRatio所以不发送了
-	            this.emitResizeMsg({viewport:this.viewports[0],  deviceRatio:devicePixelRatio});
-	        }
+	            this.ifEmitResize({viewport:this.viewports[0],  deviceRatio:devicePixelRatio});
+	        }  
 	         
 	    } 
 	    
-	    emitResizeMsg(e){//切换viewport渲染时就发送一次, 通知一些材质更新resolution。  
-	        if(!e.viewport.resolution.equals(this.oldResolution)){ 
+	    ifEmitResize(e){//切换viewport渲染时, 若这些viewport大小不同就发送一次, 通知一些材质更新resolution。  
+	        if(!e.viewport.resolution.equals(this.oldResolution)||!e.viewport.resolution2.equals(this.oldResolution2)){ 
 	            this.dispatchEvent($.extend(e, {type:'resize'})); 
 	            this.oldResolution.copy(e.viewport.resolution);
-	        }
-	        
-	        
+	            this.oldResolution2.copy(e.viewport.resolution2);  
+	         } 
 	    }
 	    
 	    
@@ -88474,9 +88475,9 @@ void main()
 	                    //this.changeTime = (this.changeTime || 0) +1
 	                //}
 	                viewport.needRender = true;  //直接写这咯  
-	                if(viewport.resolutionChanged){
-	                    this.emitResizeMsg({viewport});
-	                }
+	                if(changeInfo.resolutionChanged){
+	                    this.dispatchEvent( {type:'resize', viewport});  
+	                } 
 	                  
 	            }                
 	        }
@@ -88604,6 +88605,7 @@ void main()
 	                quaternion: this.camera.quaternion.clone(),
 	                active:this.active,
 	                resolution:this.resolution.clone(),
+	                resolution2:this.resolution2.clone(), //有时clientWidth没变但是ratio缩放了
 	            }; 
 	        };
 	        let projectionChanged = true, positionChanged = true, quaternionChanged = true, activeChanged = true, resolutionChanged = true;
@@ -88618,7 +88620,7 @@ void main()
 	            positionChanged = !this.camera.position.equals(this.previousState.position);  
 	            quaternionChanged = !this.camera.quaternion.equals(this.previousState.quaternion); 
 	            activeChanged = this.active != this.previousState.active;
-	            resolutionChanged = !this.resolution.equals(this.previousState.resolution);
+	            resolutionChanged = !this.resolution.equals(this.previousState.resolution) || !this.resolution2.equals(this.previousState.resolution2);
 	        }   
 	        copy(); 
 	        
@@ -90820,27 +90822,13 @@ void main()
 	        l
 	    }
 	     
-	    createWireframe(e, lineWidth) {
-	        /* for (var t = new THREE.LineGeometry, i = [], n = 0; n < e.length; n++) {
-	            var o = e[n];
-	            i.push(o.x, o.y, o.z)
-	        }
-	        t.setPositions(i);
-	        var s = new THREE.LineMaterial({
-	            color: this.wireframeDefaultColor,
-	            linewidth: 1
-	        });
-	        s.resolution.set(160, 160);
-	        var r = new THREE.Line2(t,s);
-	        return r.componentId = this.componentId,
-	        r */
-	        
+	    createWireframe(e ) { 
 	        let line = LineDraw.createFatLine(e,{
 		        color: Colors.gray , 
-				lineWidth ,
+				lineWidth : 2,
 	            viewer:   navCubeViewer,
 	            depthTest:true, depthWrite:true,
-	            //transparent:true
+	             transparent:true
 		    });
 	        line.renderOrder = 3;
 	        return line
@@ -90873,11 +90861,11 @@ void main()
 
 
 
-
+	/* 
 
 	class Edge extends base{
 	    constructor(t, i, n) {
-	        super();
+	        super()
 	       
 	        this.highlightWidth = 3,
 	        this.width = 15,
@@ -90886,7 +90874,7 @@ void main()
 	        this.componentId = n,
 	        this.highlightWireframeMesh = null,
 	        this.testWireframe = null,
-	        this.build(); 
+	        this.build() 
 	         
 	    }
 	  
@@ -90904,15 +90892,15 @@ void main()
 	          , c = [];
 	        if (0 !== o.x) {
 	            var d = o.x > 0 ? this.width : -this.width;
-	            c.push((new Vector3).setX(d).add(s));
+	            c.push((new THREE.Vector3).setX(d).add(s))
 	        }
 	        if (0 !== o.y) {
 	            var u = o.y > 0 ? this.width : -this.width;
-	            c.push((new Vector3).setY(u).add(s));
+	            c.push((new THREE.Vector3).setY(u).add(s))
 	        }
 	        if (0 !== o.z) {
 	            var g = o.z > 0 ? this.width : -this.width;
-	            c.push((new Vector3).setZ(g).add(s));
+	            c.push((new THREE.Vector3).setZ(g).add(s))
 	        }
 	        2 === c.length && (r.push(l.clone().add(s)),
 	        r.push(l.clone().add(c[0])),
@@ -90920,8 +90908,8 @@ void main()
 	        r.push(h.clone().add(s)),
 	        r.push(h.clone().add(c[1])),
 	        r.push(l.clone().add(c[1]))),
-	        this.mesh = this.createMesh(r); 
-	        this.transparent(this.mesh); 
+	        this.mesh = this.createMesh(r) 
+	        this.transparent(this.mesh) 
 	        //this.wireframeMesh = this.createWireframe([l, h]),
 	        //this.highlightWireframeMesh = this.createHighlightWireframe([l.sub(s), h.sub(s)])
 	    }
@@ -90929,17 +90917,17 @@ void main()
 	    createHighlightWireframe(e) {
 	        for (var t = [], i = 0; i < e.length; i++) {
 	            var n = e[i];
-	            t.push(n.x, n.y, n.z);
+	            t.push(n.x, n.y, n.z)
 	        }
-	        var o = new undefined;
+	        var o = new THREE.LineGeometry;
 	        o.setPositions(t);
-	        var s = new undefined({
+	        var s = new THREE.LineMaterial({
 	            color: this.wireframeHighlightColor,
 	            linewidth: this.highlightWidth,
 	            dashed: !1
 	        });
 	        s.resolution.set(160, 160);
-	        var r = new undefined(o,s);
+	        var r = new THREE.Line2(o,s);
 	        return r.computeLineDistances(),
 	        r.scale.set(1, 1, 1),
 	        r.visible = !1,
@@ -90957,15 +90945,15 @@ void main()
 	     
 	    highlight() {
 	        this.highlightWireframeMesh.visible = !0,
-	        this.highlightWireframeMesh.renderOrder = 100;
+	        this.highlightWireframeMesh.renderOrder = 100
 	    }
 	     
 	    cancelHighlight() {
-	        this.highlightWireframeMesh.visible = !1;
+	        this.highlightWireframeMesh.visible = !1
 	    }
 	    
 	} 
-
+	 */
 
 
 
@@ -91007,12 +90995,12 @@ void main()
 	        e.push(a),
 	        this.cornerVertices = e; 
 	        this.mesh = this.createMesh([n, s, a]); 
-	         this.wireframeMesh = this.createWireframe([n, s, a, n], 2),
-	        this.buildCornerFace(); 
-	         this.buildCornerWireframe();
+	        /*  this.wireframeMesh = this.createWireframe([n, s, a, n], 2),
+	        this.buildCornerFace() 
+	         this.buildCornerWireframe() */
 	    }
 	    
-	    highlight() {
+	    /* highlight() {
 	        this.wireframeMesh.material.color.setHex(this.wireframeHighlightColor),
 	        this.wireframeMesh.renderOrder = 100,
 	        this.mesh.material.color.setHex(this.faceHighlightColor),
@@ -91020,7 +91008,7 @@ void main()
 	        this.cornerFace.material.transparent = !0,
 	        this.cornerFace.material.opacity = .5,
 	        this.cornerWireframe.material.color.setHex(this.wireframeHighlightColor),
-	        this.cornerWireframe.visible = !0;
+	        this.cornerWireframe.visible = !0
 	    }
 	   
 	    cancelHighlight() {
@@ -91028,15 +91016,15 @@ void main()
 	        this.wireframeMesh.renderOrder = 0,
 	        this.mesh.material.color.setHex(this.faceDefaultColor),
 	        this.transparent(this.cornerFace),
-	        this.cornerWireframe.visible = !1;
-	    }
+	        this.cornerWireframe.visible = !1
+	    } 
 	  
 	    buildCornerFace() {
 	        if (!this.cornerFace) {
 	            var e = this.cornerVertices;
-	            e.push(e[1]),
-	            this.cornerFace = this.createMesh(e),
-	            this.transparent(this.cornerFace);
+	            e.push(e[1]) 
+	            this.cornerFace = this.createMesh(e) 
+	            this.transparent(this.cornerFace)
 	        }
 	    }
 	    
@@ -91053,13 +91041,13 @@ void main()
 	            for (var e = [], t = 1; t < this.cornerVertices.length; t++) {
 	                var i = this.cornerVertices[0]
 	                  , n = this.cornerVertices[t];
-	                e.push(i, n);
+	                e.push(i, n)
 	            }
 	            this.cornerWireframe = this.createWireframe(e),
-	            this.cornerWireframe.visible = !1;
+	            this.cornerWireframe.visible = !1
 	        }
 	    }
-	    
+	    */
 	    
 	} 
 
@@ -91115,25 +91103,25 @@ void main()
 	            var m = e[p];
 	            g.push(m.clone().add(u));
 	        }
-	        this.highlightMesh = this.createMesh(g); 
-	        this.highlightMesh.visible = !1; 
-	        this.highlightMesh.isHighlightMesh = !0; 
+	        /*  this.highlightMesh = this.createMesh(g) 
+	        this.highlightMesh.visible = !1 
+	        this.highlightMesh.isHighlightMesh = !0  */  
 	        g.push(g[0]); 
-	        this.wireframeMesh = this.createWireframe(g, 1);
+	        this.wireframeMesh = this.createWireframe(g, 1);  
 	    }
 	     
-	    highlight() {
-	        this.highlightMesh.visible = !0; 
-	        this.highlightMesh.material.color.setHex(this.faceHighlightColor); 
-	        this.highlightMesh.material.transparent = !0; 
-	        this.highlightMesh.material.opacity = .5; 
+	    /* highlight() {
+	        this.highlightMesh.visible = !0 
+	        this.highlightMesh.material.color.setHex(this.faceHighlightColor) 
+	        this.highlightMesh.material.transparent = !0 
+	        this.highlightMesh.material.opacity = .5 
 	        //this.wireframeMesh.material.color.setHex(this.wireframeHighlightColor)
 	    }
 	    
 	    cancelHighlight() {
-	        this.highlightMesh.visible = !1; 
+	        this.highlightMesh.visible = !1 
 	        //this.wireframeMesh.material.color.setHex(this.wireframeDefaultColor)
-	    }
+	    } */
 	     
 	    createTexturedMesh(e) {
 	        for (var t = e.length - 2, i = new Uint32Array(3 * t), n = 0, o = 1; o <= t; o++)
@@ -91193,26 +91181,26 @@ void main()
 	        this.mesh.componentId = this.componentId;
 	    }
 	    
-	    getHighlightMesh() {
+	    /* getHighlightMesh() {
 	        return this.highlightMesh
 	    }
 	     
 	    buildVertexUvs(e) {
 	        var t = []
-	          , i = (new Box3).setFromPoints(e)
+	          , i = (new THREE.Box3).setFromPoints(e)
 	          , n = i.min
-	          , o = new Vector2;
+	          , o = new THREE.Vector2;
 	        i.getSize(o);
 	        for (var s = 0 == o.x ? "x" : 0 == o.y ? "y" : "z", r = 0; r < e.length; r++) {
 	            var a = e[r]
 	              , l = (o.x + o.y + o.z) / 2
 	              , h = a.clone().sub(n).multiplyScalar(1 / l)
-	              , c = new Vector2(h.x,h.y);
-	            "x" == s ? c = new Vector2(h.y,h.z) : "y" == s && (c = new Vector2(h.x,h.z)),
-	            t.push(c);
+	              , c = new THREE.Vector2(h.x,h.y);
+	            "x" == s ? c = new THREE.Vector2(h.y,h.z) : "y" == s && (c = new THREE.Vector2(h.x,h.z)),
+	            t.push(c)
 	        }
 	        return t
-	    }
+	    } */
 	     
 	} 
 
@@ -91244,7 +91232,7 @@ void main()
 	            "5764": "Back",
 	            "1375": "Right",
 	            "4620": "Left",
-	            3: "RoofSouthEast",
+	            /* 3: "RoofSouthEast",
 	            2: "RoofSouthWest",
 	            7: "RoofNorthEast",
 	            6: "RoofNorthWest",
@@ -91263,7 +91251,7 @@ void main()
 	            13: "SouthEast",
 	            20: "SouthWest",
 	            57: "NorthEast",
-	            64: "NorthWest"
+	            64: "NorthWest" */
 	        };  
 	        this.vertices = [],
 	        this.vertexIds = [],
@@ -91286,13 +91274,13 @@ void main()
 	        for (var t = 0; t < 8; t++)
 	            this.vertexIds.push(t + ""); 
 	        //12条边
-	        this.edgeIndices.push([0, 1], [1, 3], [3, 2], [2, 0]),
+	        /* this.edgeIndices.push([0, 1], [1, 3], [3, 2], [2, 0]),
 	        this.edgeIndices.push([0, 4], [1, 5], [2, 6], [3, 7]),
 	        this.edgeIndices.push([4, 5], [5, 7], [7, 6], [6, 4]);
 	        for (t = 0; t < 12; t++) {
 	            var i = this.edgeIndices[t];
-	            this.edgeIds.push(i[0] + "" + i[1]);
-	        }
+	            this.edgeIds.push(i[0] + "" + i[1])
+	        } */
 	        
 	        //6个面,每个面2个三角形
 	        this.faceIndices.push([0, 2, 3, 1]),
@@ -91331,11 +91319,11 @@ void main()
 	              , r = new TextureLoader;
 	            r.setCrossOrigin("anonymous"); 
 	            r.load(url, (tex)=> {
-	                var face = new Face(e,t[n], this.faceIds[n], tex);
+	                var face = new Face(e,t[n], this.faceIds[n], tex); 
 	                this.componentList.push(face); 
-	                let faceMesh = face.getMesh();
+	                let faceMesh = face.getMesh(); 
 	                this.scene.add(faceMesh); 
-	                this.scene.add(face.getWireframe()); 
+	                this.scene.add(face.getWireframe()); //每个面是八边形
 	                /* this.scene.add(face.getHighlightMesh())  */
 	                //6 == ++texturesLoaded && a.callback && a.callback()
 	                
@@ -91372,31 +91360,34 @@ void main()
 	           create(s);
 	        }
 	    }
-	      
+	    
+	    
+	    
+	    buildCorners() {
+	        for (var e = this.vertices, t = this.vertexIds, i = 0; i < 8; i++) {
+	            var n = new Corner(e[i],t[i]);
+	            this.componentList.push(n); 
+	            this.scene.add(n.getMesh()); //8个三角形 
+	            //this.scene.add(n.getWireframe()) 
+	            //this.scene.add(n.getCornerFace()) 
+	            //this.scene.add(n.getCornerWireframe())
+	        }
+	    } 
 
 
 
 
-	    buildEdges() {
+	    /* buildEdges() {
 	        for (var e = this.vertices, t = this.edgeIndices, i = this.edgeIds, n = 0; n < 12; n++) {
 	            var o = new Edge(e,t[n],i[n]);
-	            this.componentList.push(o),
-	            this.scene.add(o.getMesh()),
-	            this.scene.add(o.getWireframe()),
-	            this.scene.add(o.getHighlightWireframeMesh());
+	            this.componentList.push(o) 
+	            //this.scene.add(o.getMesh()) 
+	            //this.scene.add(o.getWireframe())   
+	            //this.scene.add(o.getHighlightWireframeMesh())
 	        }
-	    }
+	    } */
 
-	    buildCorners() {
-	        for (var e = this.vertices, t = this.vertexIds, i = 0; i < 8; i++) {
-	            var n = new Corner(e[i],t[i]);
-	            this.componentList.push(n); 
-	            this.scene.add(n.getMesh());  
-	            this.scene.add(n.getWireframe()),
-	            this.scene.add(n.getCornerFace()); 
-	            this.scene.add(n.getCornerWireframe());
-	        }
-	    }
+	    
 	     
 	    getComponent(e) {
 	        for (var t = 0; t < this.componentList.length; t++) {
@@ -91408,27 +91399,6 @@ void main()
 	    }
 	    
 	    
-	    /* 
-	    getMeshes() {
-	        for (var e = [], t = this.scene.children, i = 0; i < t.length; i++) {
-	            var n = t[i];
-	            "Mesh" === n.type && !0 !== n.isHighlightMesh && e.push(n)
-	        }
-	        return e
-	    }
-	    
-	    destroy() {
-	        this.scene = null,
-	        this.vertices = null,
-	        this.vertexIds = null,
-	        this.edgeIds = null,
-	        this.edgeIndices = null,
-	        this.faceIds = null,
-	        this.faceIndices = null,
-	        this.componentList = null,
-	        this.enumViewMode = null
-	    }
-	    , */
 	    
 	    
 	}
@@ -91499,6 +91469,7 @@ void main()
 	            splitScreen.splitStart(viewportProps);
 	        });
 	        
+	        //this.addEventListener('resize',(e)=>{console.log('resize',e)})
 	        
 	    }
 	   
@@ -136164,9 +136135,7 @@ ENDSEC
 	            
 	            
 	        } 
-	        
-	        
-	         
+	          
 		}
 	    
 	    

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