ソースを参照

fix: 高亮更改

xzw 3 年 前
コミット
e9b14d8333
2 ファイル変更76 行追加60 行削除
  1. 75 59
      public/lib/potree/potree.js
  2. 1 1
      public/lib/potree/potree.js.map

+ 75 - 59
public/lib/potree/potree.js

@@ -2193,7 +2193,7 @@
 
     let textureId = 0;
 
-    function Texture$1( image = Texture$1.DEFAULT_IMAGE, mapping = Texture$1.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding ) {
+    function Texture( image = Texture.DEFAULT_IMAGE, mapping = Texture.DEFAULT_MAPPING, wrapS = ClampToEdgeWrapping, wrapT = ClampToEdgeWrapping, magFilter = LinearFilter, minFilter = LinearMipmapLinearFilter, format = RGBAFormat, type = UnsignedByteType, anisotropy = 1, encoding = LinearEncoding ) {
 
     	Object.defineProperty( this, 'id', { value: textureId ++ } );
 
@@ -2242,12 +2242,12 @@
 
     }
 
-    Texture$1.DEFAULT_IMAGE = undefined;
-    Texture$1.DEFAULT_MAPPING = UVMapping;
+    Texture.DEFAULT_IMAGE = undefined;
+    Texture.DEFAULT_MAPPING = UVMapping;
 
-    Texture$1.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+    Texture.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
 
-    	constructor: Texture$1,
+    	constructor: Texture,
 
     	isTexture: true,
 
@@ -2502,7 +2502,7 @@
 
     } );
 
-    Object.defineProperty( Texture$1.prototype, 'needsUpdate', {
+    Object.defineProperty( Texture.prototype, 'needsUpdate', {
 
     	set: function ( value ) {
 
@@ -3206,7 +3206,7 @@
 
     	options = options || {};
 
-    	this.texture = new Texture$1( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
+    	this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
 
     	this.texture.image = {};
     	this.texture.image.width = width;
@@ -13123,7 +13123,7 @@
     	mapping = mapping !== undefined ? mapping : CubeReflectionMapping;
     	format = format !== undefined ? format : RGBFormat;
 
-    	Texture$1.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
+    	Texture.call( this, images, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
     	this.flipY = false;
 
@@ -13141,7 +13141,7 @@
 
     }
 
-    CubeTexture.prototype = Object.create( Texture$1.prototype );
+    CubeTexture.prototype = Object.create( Texture.prototype );
     CubeTexture.prototype.constructor = CubeTexture;
 
     CubeTexture.prototype.isCubeTexture = true;
@@ -13296,7 +13296,7 @@
 
     function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
 
-    	Texture$1.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
+    	Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
     	this.image = { data: data || null, width: width || 1, height: height || 1 };
 
@@ -13311,7 +13311,7 @@
 
     }
 
-    DataTexture.prototype = Object.create( Texture$1.prototype );
+    DataTexture.prototype = Object.create( Texture.prototype );
     DataTexture.prototype.constructor = DataTexture;
 
     DataTexture.prototype.isDataTexture = true;
@@ -16580,7 +16580,7 @@
 
     function DataTexture2DArray( data = null, width = 1, height = 1, depth = 1 ) {
 
-    	Texture$1.call( this, null );
+    	Texture.call( this, null );
 
     	this.image = { data, width, height, depth };
 
@@ -16596,7 +16596,7 @@
 
     }
 
-    DataTexture2DArray.prototype = Object.create( Texture$1.prototype );
+    DataTexture2DArray.prototype = Object.create( Texture.prototype );
     DataTexture2DArray.prototype.constructor = DataTexture2DArray;
     DataTexture2DArray.prototype.isDataTexture2DArray = true;
 
@@ -16610,7 +16610,7 @@
     	//
     	// See #14839
 
-    	Texture$1.call( this, null );
+    	Texture.call( this, null );
 
     	this.image = { data, width, height, depth };
 
@@ -16627,7 +16627,7 @@
 
     }
 
-    DataTexture3D.prototype = Object.create( Texture$1.prototype );
+    DataTexture3D.prototype = Object.create( Texture.prototype );
     DataTexture3D.prototype.constructor = DataTexture3D;
     DataTexture3D.prototype.isDataTexture3D = true;
 
@@ -16674,7 +16674,7 @@
      *
      */
 
-    const emptyTexture = new Texture$1();
+    const emptyTexture = new Texture();
     const emptyTexture2dArray = new DataTexture2DArray();
     const emptyTexture3d = new DataTexture3D();
     const emptyCubeTexture = new CubeTexture();
@@ -28260,7 +28260,7 @@
 
     function VideoTexture( video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
 
-    	Texture$1.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
+    	Texture.call( this, video, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
     	this.format = format !== undefined ? format : RGBFormat;
 
@@ -28286,7 +28286,7 @@
 
     }
 
-    VideoTexture.prototype = Object.assign( Object.create( Texture$1.prototype ), {
+    VideoTexture.prototype = Object.assign( Object.create( Texture.prototype ), {
 
     	constructor: VideoTexture,
 
@@ -28315,7 +28315,7 @@
 
     function CompressedTexture( mipmaps, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
 
-    	Texture$1.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
+    	Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding );
 
     	this.image = { width: width, height: height };
     	this.mipmaps = mipmaps;
@@ -28332,20 +28332,20 @@
 
     }
 
-    CompressedTexture.prototype = Object.create( Texture$1.prototype );
+    CompressedTexture.prototype = Object.create( Texture.prototype );
     CompressedTexture.prototype.constructor = CompressedTexture;
 
     CompressedTexture.prototype.isCompressedTexture = true;
 
     function CanvasTexture( canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy ) {
 
-    	Texture$1.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
+    	Texture.call( this, canvas, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
     	this.needsUpdate = true;
 
     }
 
-    CanvasTexture.prototype = Object.create( Texture$1.prototype );
+    CanvasTexture.prototype = Object.create( Texture.prototype );
     CanvasTexture.prototype.constructor = CanvasTexture;
     CanvasTexture.prototype.isCanvasTexture = true;
 
@@ -28362,7 +28362,7 @@
     	if ( type === undefined && format === DepthFormat ) type = UnsignedShortType;
     	if ( type === undefined && format === DepthStencilFormat ) type = UnsignedInt248Type$1;
 
-    	Texture$1.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
+    	Texture.call( this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy );
 
     	this.image = { width: width, height: height };
 
@@ -28374,7 +28374,7 @@
 
     }
 
-    DepthTexture.prototype = Object.create( Texture$1.prototype );
+    DepthTexture.prototype = Object.create( Texture.prototype );
     DepthTexture.prototype.constructor = DepthTexture;
     DepthTexture.prototype.isDepthTexture = true;
 
@@ -38114,7 +38114,7 @@
 
     	load: function ( url, onLoad, onProgress, onError ) {
 
-    		const texture = new Texture$1();
+    		const texture = new Texture();
 
     		const loader = new ImageLoader( this.manager );
     		loader.setCrossOrigin( this.crossOrigin );
@@ -42412,7 +42412,7 @@
 
     					} else {
 
-    						texture = new Texture$1( image );
+    						texture = new Texture( image );
 
     					}
 
@@ -52704,7 +52704,7 @@
         TetrahedronGeometry: TetrahedronGeometry,
         TextBufferGeometry: TextBufferGeometry,
         TextGeometry: TextGeometry,
-        Texture: Texture$1,
+        Texture: Texture,
         TextureLoader: TextureLoader,
         TorusBufferGeometry: TorusBufferGeometry,
         TorusGeometry: TorusGeometry,
@@ -56989,7 +56989,7 @@ void main() {
     	
     	constructor( options={}){ 
             super();
-    		let map = new Texture$1();
+    		let map = new Texture();
     		map.minFilter = LinearFilter;
     		map.magFilter = LinearFilter;
             
@@ -57105,7 +57105,7 @@ void main() {
     			this.textColor.b + ',' + this.textColor.a + ')';
     		context.fillText(this.text , this.rectBorderThick + margin.x, spriteHeight/2  + diff );//x,y
 
-    		let texture = new Texture$1(canvas);
+    		let texture = new Texture(canvas);
     		texture.minFilter = LinearFilter;
     		texture.magFilter = LinearFilter;
     		texture.needsUpdate = true;
@@ -63921,7 +63921,7 @@ void main() {
                     loadDone(object);
                 };
                 
-                
+                 
                 let info = { 
                     name: prop.type, 
                     id: prop.id,
@@ -71554,7 +71554,7 @@ void main() {
     				width, height, border, srcFormat, srcType,
     				data);
     		}/* else if(texture instanceof THREE.CubeTexture){//add 
-            } */else if ((texture instanceof CanvasTexture) || (texture instanceof Texture$1)) {
+            } */else if ((texture instanceof CanvasTexture) || (texture instanceof Texture)) {
     			data = texture.image;
 
     			gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, paramThreeToGL(gl, texture.wrapS));
@@ -71566,7 +71566,7 @@ void main() {
     			gl.texImage2D(this.target, level, internalFormat,
     				internalFormat, srcType, data);
 
-    			if (texture instanceof Texture$1) {gl.generateMipmap(gl.TEXTURE_2D);}
+    			if (texture instanceof Texture) {gl.generateMipmap(gl.TEXTURE_2D);}
     		}
 
     		gl.bindTexture(this.target, null);
@@ -81386,7 +81386,7 @@ void main() {
             context.clearRect(0,0,canvas.width,canvas.height);
             context.fillText(text, (canvas.width - textWidth) / 2 , (canvas.height + fontSize) / 2);
              
-            var tex = new Texture$1(canvas); 
+            var tex = new Texture(canvas); 
             tex.needsUpdate = true;
 
 
@@ -85941,7 +85941,7 @@ void main() {
     			return null;
     		}
     	}
-     
+      
          
      
      
@@ -90237,7 +90237,7 @@ void main() {
             var renderer = this.viewer.renderer,
                 o = renderer.getContext(),
                 a = renderer.state,
-                s = new Texture$1(null);
+                s = new Texture(null);
             s.flipY = !1,
                 i !== !0 && (i = !1),
                 s.generateMipmaps = i;
@@ -99074,7 +99074,7 @@ ENDSEC
     		uniforms: {
     			// time: { value: 1.0 },
     			// resolution: { value: new THREE.Vector2() }
-    			tColor: {value: new Texture$1() },
+    			tColor: {value: new Texture() },
     			uNear: {value: 0.0},
     			uOpacity: {value: 1.0},
     		},
@@ -106102,10 +106102,9 @@ ENDSEC
     				crossOrigin: this.crossOrigin,
     				manager: this.manager,
     				ktx2Loader: this.ktx2Loader,
-    				meshoptDecoder: this.meshoptDecoder
-
+    				meshoptDecoder: this.meshoptDecoder, 
     			} );
-
+                parser.unlitMat = this.unlitMat;//add
     			parser.fileLoader.setRequestHeader( this.requestHeader );
 
     			for ( var i = 0; i < this.pluginCallbacks.length; i ++ ) {
@@ -108343,7 +108342,7 @@ ENDSEC
                             let img = new Image;
                             img.setAttribute('crossOrigin', 'Anonymous');
                             img.src = url;
-                            resolve(new Texture(img));
+                            resolve(new THREE.Texture(img));
                             
                             
                             /* img.onload = ()=>{
@@ -108563,7 +108562,7 @@ ENDSEC
 
     	GLTFParser.prototype.getMaterialType = function ( /* materialIndex */ ) {
 
-    		return MeshStandardMaterial;
+    		return this.unlitMat ? MeshBasicMaterial : MeshStandardMaterial;  //xzw add unlitMat
 
     	};
 
@@ -117109,7 +117108,12 @@ ENDSEC
                 }
             });  
             
-            
+            viewer.inputHandler.addEventListener('keydown', (e)=>{
+                if((e.event.key).toLowerCase() == "h" ){ 
+                    this.fadeOutlineAuto = !this.fadeOutlineAuto;
+                    this.showModelOutline(this.selected,!!this.selected);
+                } 
+            });
             viewer.ssaaRenderPass.enabled = false;
             viewer.outlinePass.enabled = true;
             //Potree.settings.intersectWhenHover = false
@@ -117144,6 +117148,7 @@ ENDSEC
             return models.find(e=>e.dataset_id == id)
         },
         removeModel(model){
+            if(this.selected == model) this.selectModel(null);
             model.traverse(e=>{
                 e.geometry && e.geometry.dispose(); 
                 e.material && e.material.dispose();
@@ -117193,21 +117198,29 @@ ENDSEC
         },
         
         
-        showModelOutline(model, state){
-            if(state === false){
-                viewer.outlinePass.selectedObjects = [];
-                clearTimeout(this.timer);
-                return
-            }
-            
-            viewer.outlinePass.selectedObjects = [model];
-            if(this.timer){
-                clearTimeout(this.timer);
+        showModelOutline(model, state){ 
+            if(this.fadeOutlineAuto){ 
+                if(state === false){
+                    viewer.outlinePass.selectedObjects = [];
+                    clearTimeout(this.timer);
+                    return
+                }
+                
+                viewer.outlinePass.selectedObjects = [model];
+                if(this.timer){
+                    clearTimeout(this.timer);
+                }
+                
+                this.timer = setTimeout(()=>{
+                    viewer.outlinePass.selectedObjects = [];
+                }, 1000);
+            }else {
+                if(state === false){
+                    viewer.outlinePass.selectedObjects = [];
+                }else {
+                    viewer.outlinePass.selectedObjects = [model];
+                }
             }
-            
-            this.timer = setTimeout(()=>{
-                viewer.outlinePass.selectedObjects = [];
-            }, 1000);
         },
         
         /* focusOn(object, duration = 400){  
@@ -125765,7 +125778,7 @@ ENDSEC
                 this.images360 = new Images360(this);
                 
                 this.scene.scene.add(this.objs);
-                
+                 
                 loaders = {
                     objLoader : new OBJLoader( manager ),
                     mtlLoader : new MTLLoader( manager ),
@@ -129490,11 +129503,13 @@ ENDSEC
                         }; */
                         
                         //暂时用这种材质:
-                        if(fileInfo.unlit){
+                        if(fileInfo.unlit && !(child.material instanceof MeshBasicMaterial)){
                             let material = new MeshBasicMaterial({map:child.material.map});
+                            child.material.dispose();
                             child.material = material;
+                           
                         }
-                        child.flatShading = false;
+                        
                     }
                 } );
 
@@ -129557,6 +129572,7 @@ ENDSEC
                 } , onProgress,  onError  );  
                 
             }else if(fileType == 'glb'){
+                loaders.glbLoader.unlitMat = !!fileInfo.unlit;
                 loaders.glbLoader.load(fileInfo.glburl,  ( gltf, total )=>{     //.setPath( Potree.resourcePath + '/models/glb/'  );
                     //console.log('loadGLTF', gltf)
                     loadDone(gltf.scene, total, fileInfo.glburl); 

ファイルの差分が大きいため隠しています
+ 1 - 1
public/lib/potree/potree.js.map