xushiting 2 gadi atpakaļ
vecāks
revīzija
075a82e0e9
74 mainītis faili ar 409 papildinājumiem un 1831 dzēšanām
  1. 0 20
      .vscode/settings.json
  2. 0 1
      libs/other/stats.js
  3. 71 118
      libs/three.js/build/three.module.js
  4. 1 1
      libs/three.js/loaders/KTX2Loader.js
  5. 0 102
      libs/utils/WorkerPool.js
  6. 3 3
      src/Actions.js
  7. 6 13
      src/Annotation.js
  8. 1 2
      src/Enum.js
  9. 10 55
      src/EventDispatcher.js
  10. 1 3
      src/Features.js
  11. 0 1
      src/KeyCodes.js
  12. 2 32
      src/LRU.js
  13. 0 7
      src/PointCloudOctree.js
  14. 1 2
      src/PointCloudOctreeGeometry.js
  15. 2 1
      src/PointCloudTree.js
  16. 42 40
      src/Potree.js
  17. 1 4
      src/PotreeRenderer.js
  18. 27 48
      src/Potree_update_visibility.js
  19. 0 1
      src/WorkerPool.js
  20. 1 1
      src/exporter/DXFExporter.js
  21. 1 1
      src/exporter/GeoJSONExporter.js
  22. 0 437
      src/extensions/three.shim.js
  23. 1 1
      src/loader/GeoPackageLoader.js
  24. 2 3
      src/loader/PointAttributes.js
  25. 1 1
      src/loader/ShapefileLoader.js
  26. 1 1
      src/materials/DepthBasicMaterial.js
  27. 1 0
      src/materials/ModelTextureMaterial.js
  28. 2 2
      src/modules/CameraAnimation/CameraAnimation.js
  29. 2 3
      src/modules/Images360/Images360.js
  30. 0 344
      src/modules/Images360/Images3603.js
  31. 2 2
      src/modules/Images360/Panorama.js
  32. 2 1
      src/modules/Images360/tile/PanoRenderer.js
  33. 2 2
      src/modules/Images360/tile/TileDownloader.js
  34. 2 1
      src/modules/OrientedImages/OrientedImageControls.js
  35. 3 2
      src/modules/OrientedImages/OrientedImages.js
  36. 2 2
      src/modules/Particles/ParticleEditor.js
  37. 2 1
      src/modules/clipModel/Clip.js
  38. 2 1
      src/modules/datasetAlignment/Alignment.js
  39. 12 1
      src/modules/loader/2.0/DecoderWorker_brotli.js
  40. 8 1
      src/modules/loader/2.0/OctreeLoader.js
  41. 2 2
      src/modules/mergeModel/MergeEditor.js
  42. 2 2
      src/modules/panoEdit/panoEditor.js
  43. 3 1
      src/modules/route/RouteGuider.js
  44. 3 1
      src/modules/siteModel/SiteModel.js
  45. 2 1
      src/navigation/DeviceOrientationControls.js
  46. 2 1
      src/navigation/EarthControls.js
  47. 3 2
      src/navigation/FirstPersonControls.js
  48. 2 2
      src/navigation/InputHandler.js
  49. 2 1
      src/navigation/OrbitControls.js
  50. 5 3
      src/navigation/VRControls.js
  51. 2 2
      src/objects/Label.js
  52. 2 1
      src/objects/tool/AnnotationTool.js
  53. 2 1
      src/objects/tool/ClippingTool.js
  54. 10 4
      src/objects/tool/Compass.js
  55. 2 2
      src/objects/tool/HandleSvg.js
  56. 2 2
      src/objects/tool/MeasuringTool.js
  57. 2 2
      src/objects/tool/ProfileTool.js
  58. 2 2
      src/objects/tool/TagTool.js
  59. 2 2
      src/start.js
  60. 81 396
      src/utils.js
  61. 0 1
      src/utils/DrawUtil.js
  62. 2 3
      src/utils/History.js
  63. 7 5
      src/utils/PointCloudSM.js
  64. 2 2
      src/utils/SplitScreen.js
  65. 18 72
      src/viewer/PotreeRenderer.js
  66. 5 7
      src/viewer/PropertyPanels/PropertiesPanel.js
  67. 1 1
      src/viewer/PropertyPanels/VolumePanel.js
  68. 0 23
      src/viewer/SaveProject.js
  69. 2 1
      src/viewer/Scene.js
  70. 2 1
      src/viewer/View.js
  71. 2 3
      src/viewer/map.js
  72. 2 2
      src/viewer/map/Map.js
  73. 6 14
      src/viewer/profile.js
  74. 10 4
      src/viewer/viewerBase.js

+ 0 - 20
.vscode/settings.json

@@ -1,22 +1,2 @@
 {
-	"workbench.editor.enablePreview": false,
-	"files.associations": {
-		"*.vs": "cpp",
-		"*.fs": "cpp"
-	},
-	"files.trimTrailingWhitespace": false,
-	"editor.fontSize": 12,
-	"editor.autoIndent": "advanced",
-	"editor.detectIndentation": false,
-	"editor.insertSpaces": false,
-	"editor.minimap.enabled": false,
-	"editor.autoClosingBrackets": "never",
-	"editor.formatOnType": false,
-	"editor.acceptSuggestionOnEnter": "off",
-	"editor.acceptSuggestionOnCommitCharacter": false,
-	"editor.mouseWheelZoom": true,
-	"editor.renderWhitespace": "all",
-	"workbench.tree.indent": 30,
-	"editor.autoClosingQuotes": "never",
-	"editor.autoSurround": "never",
 }

+ 0 - 1
libs/other/stats.js

@@ -22,7 +22,6 @@
 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
- */
 
 var Stats = function () {
 

+ 71 - 118
libs/three.js/build/three.module.js

@@ -208,7 +208,7 @@ function EventDispatcher() {}
 
 Object.assign( EventDispatcher.prototype, {
 
-	addEventListener: function ( type, listener, importance=0 ) {//add importance
+	addEventListener: function ( type, listener ) {
 
 		if ( this._listeners === undefined ) this._listeners = {};
 
@@ -220,10 +220,10 @@ Object.assign( EventDispatcher.prototype, {
 
 		}
 
-		if ( !listeners[ type ].some(e=>e.listener == listener )  ) { 
-			//listeners[ type ].push( listener );
-            listeners[type].push({ listener,  importance});
-            listeners[type] = listeners[type].sort((e,a)=> a.importance - e.importance)//add
+		if ( listeners[ type ].indexOf( listener ) === - 1 ) {
+
+			listeners[ type ].push( listener );
+
 		}
 
 	},
@@ -234,49 +234,11 @@ Object.assign( EventDispatcher.prototype, {
 
 		const listeners = this._listeners;
 
-		return listeners[ type ] !== undefined &&  listeners[ type ].some(e=>e.listener == listener )    
+		return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
 
 	},
-
-	removeEventListener: function ( type, listener ) {
-
-		if ( this._listeners === undefined ) return;
-
-		const listeners = this._listeners;
-		const listenerArray = listeners[ type ];
-
-		if ( listenerArray !== undefined ) {
-
-			/* const index = listenerArray.indexOf( listener );
-
-			if ( index !== - 1 ) {
-
-				listenerArray.splice( index, 1 );
-
-			} */
-
-            let item = listenerArray.find(e=>e.listener == listener)
-            item && listenerArray.splice(listenerArray.indexOf(item), 1);
-
-		}
-
-	},
-    removeEventListeners(type){//add
-		if(this._listeners && this._listeners[type] !== undefined){
-			delete this._listeners[type];
-		}
-	} ,
-    removeAllListeners(){ //add
-        this._listeners = {};
-        
-    },
-    
-    
     
 	dispatchEvent: function ( event ) { 
-        if(typeof event == 'string'){//add
-            event = {type:event}
-        }
 		if ( this._listeners === undefined ) return;
 
 		const listeners = this._listeners;
@@ -287,16 +249,15 @@ Object.assign( EventDispatcher.prototype, {
 			event.target = this;
 
 			// Make a copy, in case listeners are removed while iterating.
-			 
-            for(let {listener} of listenerArray.slice(0)){
-				let result = listener.call(this, event);   //add stopContinue
-                if(result && result.stopContinue){
-                    break
-                }
+			const array = listenerArray.slice( 0 );
+
+			for ( let i = 0, l = array.length; i < l; i ++ ) {
+
+				array[ i ].call( this, event );
+
 			}
 
 		}
-
 	}
     
 } );
@@ -6844,12 +6805,8 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 	raycast: function () {},
 
 	traverse: function ( callback ) {
+		callback( this );
 
-		let result = callback( this );
-        if(result && result.stopContinue){//xzw add
-            return 
-        }
-             
 		const children = this.children;
 
 		for ( let i = 0, l = children.length; i < l; i ++ ) {
@@ -8715,7 +8672,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
 		if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
 
-		if ( this.lineWidth && this.lineWidth !== 1 ) data.lineWidth = this.lineWidth;
+		if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;
 		if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
 		if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
 		if ( this.scale !== undefined ) data.scale = this.scale;
@@ -8726,7 +8683,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
 
 		if ( this.wireframe === true ) data.wireframe = this.wireframe;
-		if ( this.wireframelineWidth > 1 ) data.wireframelineWidth = this.wireframelineWidth;
+		if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
 		if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
 		if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
 
@@ -8900,7 +8857,7 @@ Object.defineProperty( Material.prototype, 'needsUpdate', {
  *  depthWrite: <bool>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>
@@ -8933,7 +8890,7 @@ function MeshBasicMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -8973,7 +8930,7 @@ MeshBasicMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -11719,7 +11676,7 @@ var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0
  *  vertexShader: <string>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  lights: <bool>,
  *
@@ -11741,10 +11698,10 @@ function ShaderMaterial( parameters ) {
 	this.vertexShader = default_vertex;
 	this.fragmentShader = default_fragment;
 
-	this.lineWidth = 1;
+	this.linewidth = 1;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false; // set to use scene fog
 	this.lights = false; // set to use scene lights
@@ -11805,7 +11762,7 @@ ShaderMaterial.prototype.copy = function ( source ) {
 	this.defines = Object.assign( {}, source.defines );
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 
 	this.lights = source.lights;
 	this.clipping = source.clipping;
@@ -18896,7 +18853,7 @@ function WebGLRenderStates( extensions, capabilities ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  * }
  */
 
@@ -18920,7 +18877,7 @@ function MeshDepthMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -18951,7 +18908,7 @@ MeshDepthMaterial.prototype.copy = function ( source ) {
 	this.displacementBias = source.displacementBias;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 
 	return this;
 
@@ -19396,8 +19353,8 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
 		result.clippingPlanes = material.clippingPlanes;
 		result.clipIntersection = material.clipIntersection;
 
-		result.wireframelineWidth = material.wireframelineWidth;
-		result.lineWidth = material.lineWidth;
+		result.wireframeLinewidth = material.wireframeLinewidth;
+		result.linewidth = material.linewidth;
 
 		if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {
 
@@ -19799,7 +19756,7 @@ function WebGLState( gl, extensions, capabilities ) {
 	let currentFlipSided = null;
 	let currentCullFace = null;
 
-	let currentlineWidth = null;
+	let currentLineWidth = null;
 
 	let currentPolygonOffsetFactor = null;
 	let currentPolygonOffsetUnits = null;
@@ -20168,13 +20125,13 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	}
 
-	function setlineWidth( width ) {
+	function setLineWidth( width ) {
 
-		if ( width !== currentlineWidth ) {
+		if ( width !== currentLineWidth ) {
 
 			if ( lineWidthAvailable ) gl.lineWidth( width );
 
-			currentlineWidth = width;
+			currentLineWidth = width;
 
 		}
 
@@ -20365,7 +20322,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		currentFlipSided = null;
 		currentCullFace = null;
 
-		currentlineWidth = null;
+		currentLineWidth = null;
 
 		currentPolygonOffsetFactor = null;
 		currentPolygonOffsetUnits = null;
@@ -20395,7 +20352,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		setFlipSided: setFlipSided,
 		setCullFace: setCullFace,
 
-		setlineWidth: setlineWidth,
+		setLineWidth: setLineWidth,
 		setPolygonOffset: setPolygonOffset,
 
 		setScissorTest: setScissorTest,
@@ -23692,8 +23649,8 @@ function WebGLRenderer( parameters ) {
 
 	};
 
-	this.setSize = function ( width, height,  updateStyle, devicePixelRatio ) {//改
-        if (devicePixelRatio != void 0) _pixelRatio = devicePixelRatio;  //add
+	this.setSize = function ( width, height, updateStyle ) {
+
 		if ( xr.isPresenting ) {
 
 			console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
@@ -23703,23 +23660,19 @@ function WebGLRenderer( parameters ) {
 
 		_width = width;
 		_height = height;
-        
-        //if(!window.unableSetSize){ 
-            _canvas.width = Math.floor( width * _pixelRatio );
-            _canvas.height = Math.floor( height * _pixelRatio );
-        
-        
-        
-            if ( updateStyle !== false ) {
 
-                _canvas.style.width = width + 'px';
-                _canvas.style.height = height + 'px';
+		_canvas.width = Math.floor( width * _pixelRatio );
+		_canvas.height = Math.floor( height * _pixelRatio );
+
+		if ( updateStyle !== false ) {
+
+			_canvas.style.width = width + 'px';
+			_canvas.style.height = height + 'px';
+
+		}
+
+		this.setViewport( 0, 0, width, height );
 
-            }
-            
-            
-            this.setViewport( 0, 0, width, height );
-        //}
 	};
 
 	this.getDrawingBufferSize = function ( target ) {
@@ -24125,7 +24078,7 @@ function WebGLRenderer( parameters ) {
 
 			if ( material.wireframe === true ) {
 
-				state.setlineWidth( material.wireframelineWidth * getTargetPixelRatio() );
+				state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );
 				renderer.setMode( 1 );
 
 			} else {
@@ -24136,11 +24089,11 @@ function WebGLRenderer( parameters ) {
 
 		} else if ( object.isLine ) {
 
-			let lineWidth = material.lineWidth;
+			let lineWidth = material.linewidth;
 
 			if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material
 
-			state.setlineWidth( lineWidth * getTargetPixelRatio() );
+			state.setLineWidth( lineWidth * getTargetPixelRatio() );
 
 			if ( object.isLineSegments ) {
 
@@ -26807,7 +26760,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *  linecap: "round",
  *  linejoin: "round"
  * }
@@ -26821,7 +26774,7 @@ function LineBasicMaterial( parameters ) {
 
 	this.color = new Color( 0xffffff );
 
-	this.lineWidth = 1;
+	this.linewidth = 1;
 	this.linecap = 'round';
 	this.linejoin = 'round';
 
@@ -26842,7 +26795,7 @@ LineBasicMaterial.prototype.copy = function ( source ) {
 
 	this.color.copy( source.color );
 
-	this.lineWidth = source.lineWidth;
+	this.linewidth = source.linewidth;
 	this.linecap = source.linecap;
 	this.linejoin = source.linejoin;
 
@@ -33508,7 +33461,7 @@ RawShaderMaterial.prototype.isRawShaderMaterial = true;
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33563,7 +33516,7 @@ function MeshStandardMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33627,7 +33580,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -33786,7 +33739,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33837,7 +33790,7 @@ function MeshPhongMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33895,7 +33848,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -33938,7 +33891,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
  *  alphaMap: new THREE.Texture( <Image> ),
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33983,7 +33936,7 @@ function MeshToonMaterial( parameters ) {
 	this.alphaMap = null;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34033,7 +33986,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
 	this.alphaMap = source.alphaMap;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -34061,7 +34014,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34087,7 +34040,7 @@ function MeshNormalMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -34120,7 +34073,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
 	this.displacementBias = source.displacementBias;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 
 	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
@@ -34157,7 +34110,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34195,7 +34148,7 @@ function MeshLambertMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34240,7 +34193,7 @@ MeshLambertMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -34358,7 +34311,7 @@ MeshMatcapMaterial.prototype.copy = function ( source ) {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *
  *  scale: <float>,
  *  dashSize: <float>,
@@ -36777,7 +36730,7 @@ FileLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					for ( let i = 0, il = callbacks.length; i < il; i ++ ) {
 
 						const callback = callbacks[ i ];
-						if ( callback.onLoad ) callback.onLoad( response, event.total); //xzw add event.total
+						if ( callback.onLoad ) callback.onLoad( response );
   
 					}
 
@@ -40402,13 +40355,13 @@ MaterialLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		if ( json.stencilZPass !== undefined ) material.stencilZPass = json.stencilZPass;
 
 		if ( json.wireframe !== undefined ) material.wireframe = json.wireframe;
-		if ( json.wireframelineWidth !== undefined ) material.wireframelineWidth = json.wireframelineWidth;
+		if ( json.wireframeLinewidth !== undefined ) material.wireframeLinewidth = json.wireframeLinewidth;
 		if ( json.wireframeLinecap !== undefined ) material.wireframeLinecap = json.wireframeLinecap;
 		if ( json.wireframeLinejoin !== undefined ) material.wireframeLinejoin = json.wireframeLinejoin;
 
 		if ( json.rotation !== undefined ) material.rotation = json.rotation;
 
-		if ( json.lineWidth !== 1 ) material.lineWidth = json.lineWidth;
+		if ( json.linewidth !== 1 ) material.linewidth = json.linewidth;
 		if ( json.dashSize !== undefined ) material.dashSize = json.dashSize;
 		if ( json.gapSize !== undefined ) material.gapSize = json.gapSize;
 		if ( json.scale !== undefined ) material.scale = json.scale;

+ 1 - 1
libs/three.js/loaders/KTX2Loader.js

@@ -39,7 +39,7 @@ import {
 } from '../build/three.module.js';
 
 
-import { WorkerPool } from '../../utils/WorkerPool.js';
+import { WorkerPool } from '../../../src/custom/utils/WorkerPool.js';
 import * as KTX from '../libs/ktx-parse.module.js';
 
 const {

+ 0 - 102
libs/utils/WorkerPool.js

@@ -1,102 +0,0 @@
-/**
- * @author Deepkolos / https://github.com/deepkolos
- */
-
-export class WorkerPool {
-
-	constructor( pool = 4 ) {
-
-		this.pool = pool;
-		this.queue = [];
-		this.workers = [];
-		this.workersResolve = [];
-		this.workerStatus = 0;
-
-	}
-
-	_initWorker( workerId ) {
-
-		if ( ! this.workers[ workerId ] ) {
-
-			const worker = this.workerCreator();
-			worker.addEventListener( 'message', this._onMessage.bind( this, workerId ) );
-			this.workers[ workerId ] = worker;
-
-		}
-
-	}
-
-	_getIdleWorker() {
-
-		for ( let i = 0; i < this.pool; i ++ )
-			if ( ! ( this.workerStatus & ( 1 << i ) ) ) return i;
-
-		return - 1;
-
-	}
-
-	_onMessage( workerId, msg ) {
-
-		const resolve = this.workersResolve[ workerId ];
-		resolve && resolve( msg );
-
-		if ( this.queue.length ) {
-
-			const { resolve, msg, transfer } = this.queue.shift();
-			this.workersResolve[ workerId ] = resolve;
-			this.workers[ workerId ].postMessage( msg, transfer );
-
-		} else {
-
-			this.workerStatus ^= 1 << workerId;
-
-		}
-
-	}
-
-	setWorkerCreator( workerCreator ) {
-
-		this.workerCreator = workerCreator;
-
-	}
-
-	setWorkerLimit( pool ) {
-
-		this.pool = pool;
-
-	}
-
-	postMessage( msg, transfer ) {
-
-		return new Promise( ( resolve ) => {
-
-			const workerId = this._getIdleWorker();
-
-			if ( workerId !== - 1 ) {
-
-				this._initWorker( workerId );
-				this.workerStatus |= 1 << workerId;
-				this.workersResolve[ workerId ] = resolve;
-				this.workers[ workerId ].postMessage( msg, transfer );
-
-			} else {
-
-				this.queue.push( { resolve, msg, transfer } );
-
-			}
-
-		} );
-
-	}
-
-	dispose() {
-
-		this.workers.forEach( ( worker ) => worker.terminate() );
-		this.workersResolve.length = 0;
-		this.workers.length = 0;
-		this.queue.length = 0;
-		this.workerStatus = 0;
-
-	}
-
-}

+ 3 - 3
src/Actions.js

@@ -1,8 +1,8 @@
 
-import * as THREE from "../libs/three.js/build/three.module.js";
- 
 
-export class Action extends THREE.EventDispatcher {
+import {EventDispatcher} from "./EventDispatcher.js";
+
+export class Action extends EventDispatcher {
 	constructor (args = {}) {
 		super();
 

+ 6 - 13
src/Annotation.js

@@ -1,10 +1,9 @@
-
-
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {Action} from "./Actions.js";
-import {Utils} from "./utils.js"; 
+import {Utils} from "./utils.js";
+import {EventDispatcher} from "./EventDispatcher.js";
 
-export class Annotation extends THREE.EventDispatcher {
+export class Annotation extends EventDispatcher {
 	constructor (args = {}) {
 		super();
 
@@ -26,11 +25,6 @@ export class Annotation extends THREE.EventDispatcher {
 			? new THREE.Vector3().fromArray(args.cameraPosition) : args.cameraPosition;
 		this.cameraTarget = (args.cameraTarget instanceof Array)
 			? new THREE.Vector3().fromArray(args.cameraTarget) : args.cameraTarget;
-            
-        if(!this.cameraTarget && this.position){//add
-            this.cameraTarget = this.position.clone()
-        }    
-            
 		this.radius = args.radius;
 		this.view = args.view || null;
 		this.keepOpen = false;
@@ -72,11 +66,10 @@ export class Annotation extends THREE.EventDispatcher {
 		// this.elDescriptionContent = this.elDescription.find(".annotation-description-content");
 
 		this.clickTitle = () => {
-			//if(this.hasView()){
+			if(this.hasView()){
 				this.moveHere(this.scene.getActiveCamera());
-			//}
+			}
 			this.dispatchEvent({type: 'click', target: this});
-            viewer.renderer.domElement.focus()//add 使得方向键可用
 		};
 
 		this.elTitle.click(this.clickTitle);
@@ -575,4 +568,4 @@ export class Annotation extends THREE.EventDispatcher {
 	toString () {
 		return 'Annotation: ' + this._title;
 	}
-};
+};

+ 1 - 2
src/Enum.js

@@ -1,4 +1,3 @@
-
 class EnumItem{
 	constructor(object){
 		for(let key of Object.keys(object)){
@@ -11,7 +10,7 @@ class EnumItem{
 	}
 };
 
-class Enum{//??????做什么用的
+class Enum{
 
 	constructor(object){
 		this.object = object;

+ 10 - 55
src/EventDispatcher.js

@@ -1,4 +1,3 @@
-
 /**
  * @author mrdoob / http://mrdoob.com/ https://github.com/mrdoob/eventdispatcher.js
  * 
@@ -28,9 +27,9 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
- 
 
- 
+
+
 
 export class EventDispatcher{
 
@@ -38,7 +37,7 @@ export class EventDispatcher{
 		this._listeners = {};
 	}
 
-	addEventListener(type, listener, importance=0  ){//add importance
+	addEventListener(type, listener){
 
 		const listeners = this._listeners;
 
@@ -47,8 +46,7 @@ export class EventDispatcher{
 		}
 
 		if(listeners[type].indexOf(listener) === - 1){
-			listeners[type].push({ listener,  importance});
-            listeners[type] = listeners[type].sort((e,a)=> a.importance - e.importance)//add
+			listeners[type].push( listener );
 		}
 
 	}
@@ -67,14 +65,11 @@ export class EventDispatcher{
 
 		if (listenerArray !== undefined){
 
-			/* let index = listenerArray.indexOf(listener);
+			let index = listenerArray.indexOf(listener);
 
 			if(index !== - 1){
 				listenerArray.splice(index, 1);
-			} */
-            let item = listenerArray.find(e=>e.listener == listener)
-            item && listenerArray.splice(listenerArray.indexOf(item), 1);
-            
+			}
 		}
 
 	}
@@ -84,60 +79,20 @@ export class EventDispatcher{
 			delete this._listeners[type];
 		}
 	};
-    
-    
-    
 
 	dispatchEvent(event){
-        if(typeof event == 'string'){//add
-            event = {type:event}
-        }
-        
+
 		let listeners = this._listeners;
 		let listenerArray = listeners[event.type];
 
 		if ( listenerArray !== undefined ) {
 			event.target = this;
 
-			for(let {listener} of listenerArray.slice(0)){
-				let result = listener.call(this, event);   //add stopContinue
-                if(result && result.stopContinue){
-                    break
-                }
+			for(let listener of listenerArray.slice(0)){
+				listener.call(this, event);
 			}
 		}
 
 	}
-    
-    
-    //add 
-    /* emit(type){ 
-        this.dispatchEvent({type, arguments: Array.from(arguments).slice(1, arguments.length) })
-    }
-    on(type, fun){  
-        this.addEventListener(type,(ev)=>{
-            fun.apply(this, ev.arguments)
-        })
-    } 
-    off(type, fun){
-        this.removeEventListener(type,)
-    }
-    
-    once(type, fun) {
-        function callback() {
-            this.removeEventListener(type, callback),
-            n || (n = !0, fun.apply(this, arguments))
-        }
-        var n = !1;
-        return callback.listener = fun,
-            this.on(type, callback),
-            this
-    }  */
-    
-    removeAllListeners(){
-        
-        this._listeners = {};
-        
-    }
-     
+
 }

+ 1 - 3
src/Features.js

@@ -1,4 +1,3 @@
-
 import browser from './utils/browser.js'
 
 
@@ -95,5 +94,4 @@ export const Features = (function () {
 		//},
 		precision: precision
 	};
-}());
-
+}());

+ 0 - 1
src/KeyCodes.js

@@ -7,7 +7,6 @@ export const KeyCodes = {
 	RIGHT: 39,
 	BOTTOM: 40,
 	DELETE: 46,
-    BACKSPACE:8,
     
 	A: 'A'.charCodeAt(0),
 	S: 'S'.charCodeAt(0),

+ 2 - 32
src/LRU.js

@@ -1,5 +1,3 @@
-
-
 class LRUItem{
 
 	constructor(node){
@@ -140,41 +138,13 @@ class LRU{
 			return;
 		}
 
-		/* while (this.numPoints > Potree.pointLoadLimit) {
+		while (this.numPoints > Potree.pointLoadLimit) {
 			let element = this.first;
 			let node = element.node;
 			this.disposeDescendants(node);
-		} */ 
-        
-        //改成navvis的,使用pointBudget,否则四屏点云闪烁。
-        
-        
-        let max = /* this.pageVisible ?  */viewer.viewports.length * 2 * Potree.pointBudget// : 1000
-        
-        
-        
-        for (; this.numPoints > max;  ) {//要根据屏幕数量来增加pointBudget
-            var node = this.getLRUItem();
-            node && this.disposeSubtree(node)
-        }
-        
-        
+		}
 	}
 
-    disposeSubtree(t) {//add from navvis 25.js
-        var e = [t];
-        t.traverse((function(t) {
-            t.loaded && e.push(t)
-        }
-        ));
-        for (var n = 0, i = e; n < i.length; n++) {
-            var o = i[n];
-            o.dispose(),
-            this.remove(o)
-        }
-    }
-
-
 	disposeDescendants(node){
 		let stack = [];
 		stack.push(node);

+ 0 - 7
src/PointCloudOctree.js

@@ -1,5 +1,3 @@
-
-
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {PointCloudTree, PointCloudTreeNode} from "./PointCloudTree.js";
 import {PointCloudOctreeGeometryNode} from "./PointCloudOctreeGeometry.js";
@@ -2166,8 +2164,3 @@ window.searchOutRing = function(points){
     })
 }
  */
-
-
-
-
-

+ 1 - 2
src/PointCloudOctreeGeometry.js

@@ -1,4 +1,3 @@
- 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {PointCloudTreeNode} from "./PointCloudTree.js";
 import {XHRFactory} from "./XHRFactory.js";
@@ -280,4 +279,4 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
     }
 }
 
-PointCloudOctreeGeometryNode.IDCount = 0;
+PointCloudOctreeGeometryNode.IDCount = 0;

+ 2 - 1
src/PointCloudTree.js

@@ -1,7 +1,8 @@
 
 import * as THREE from "../libs/three.js/build/three.module.js"; 
+import {EventDispatcher} from "./EventDispatcher.js";
 
-export class PointCloudTreeNode extends THREE.EventDispatcher{
+export class PointCloudTreeNode extends EventDispatcher{
 
 	constructor(){
 		super();

+ 42 - 40
src/Potree.js

@@ -1,7 +1,5 @@
-export {config, settings} from "./settings.js";
-export * from "./start.js";
- 
-
+												export {config, settings} from "./settings.js";
+												export * from "./start.js";
 export * from "./Actions.js";
 export * from "./AnimationPath.js";
 export * from "./Annotation.js";
@@ -13,13 +11,15 @@ export * from "./KeyCodes.js";
 export * from "./LRU.js";
 export * from "./PointCloudEptGeometry.js";
 export * from "./PointCloudOctree.js";
+												//export * from "./custom/ExtendPointCloudOctree.js";
 export * from "./PointCloudOctreeGeometry.js";
 export * from "./PointCloudTree.js";
 export * from "./Points.js";
-export * from "./Potree_update_visibility.js";
+// export * from "./Potree_update_visibility.js";
+												//export * from "./custom/ExtendPotree_update_visibility.js";
 export * from "./PotreeRenderer.js";
 export * from "./ProfileRequest.js";
-//export * from "./TextSprite.js";
+export * from "./TextSprite.js";
 export * from "./utils.js";
 export * from "./Version.js";
 export * from "./WorkerPool.js";
@@ -35,7 +35,7 @@ export * from "./materials/NormalizationMaterial.js";
 export * from "./materials/PointCloudMaterial.js";
 
 export * from "./loader/POCLoader.js";
-//export * from "./modules/loader/2.0/OctreeLoader.js";
+export * from "./modules/loader/2.0/OctreeLoader.js";
 export * from "./loader/EptLoader.js";
 export * from "./loader/ept/BinaryLoader.js";
 export * from "./loader/ept/LaszipLoader.js";
@@ -44,24 +44,38 @@ export * from "./loader/PointAttributes.js";
 export * from "./loader/ShapefileLoader.js";
 export * from "./loader/GeoPackageLoader.js";
 
-export * from "./objects/tool/Box3Helper.js";
-export * from "./objects/tool/ClippingTool.js";
-export * from "./objects/tool/ClipVolume.js";
+												// export * from "./objects/tool/Box3Helper.js";
+												// export * from "./objects/tool/ClippingTool.js";
+												// export * from "./objects/tool/ClipVolume.js";
+export * from "./utils/Box3Helper.js";
+export * from "./utils/ClippingTool.js";
+export * from "./utils/ClipVolume.js";
 export * from "./utils/GeoTIFF.js";
-export * from "./objects/tool/Measure.js";
-export * from "./objects/tool/MeasuringTool.js";
+												// export * from "./objects/tool/Measure.js";
+												// export * from "./objects/tool/MeasuringTool.js";
+
+export * from "./utils/Measure.js";
+export * from "./utils/MeasuringTool.js";
 export * from "./utils/Message.js";
 export * from "./utils/PointCloudSM.js";
-export * from "./objects/tool/PolygonClipVolume.js";
-export * from "./objects/tool/Profile.js";
-export * from "./objects/tool/ProfileTool.js";
-export * from "./objects/tool/ScreenBoxSelectTool.js";
-export * from "./objects/tool/SpotLightHelper.js";
-export * from "./objects/tool/TransformationTool.js";
-export * from "./objects/tool/Volume.js";
-export * from "./objects/tool/VolumeTool.js";
-export * from "./objects/tool/Compass.js";
-
+												// export * from "./objects/tool/PolygonClipVolume.js";
+												// export * from "./objects/tool/Profile.js";
+												// export * from "./objects/tool/ProfileTool.js";
+												// export * from "./objects/tool/ScreenBoxSelectTool.js";
+												// export * from "./objects/tool/SpotLightHelper.js";
+												// export * from "./objects/tool/TransformationTool.js";
+												// export * from "./objects/tool/Volume.js";
+												// export * from "./objects/tool/VolumeTool.js";
+												// export * from "./objects/tool/Compass.js";
+export * from "./utils/PolygonClipVolume.js";
+export * from "./utils/Profile.js";
+export * from "./utils/ProfileTool.js";
+export * from "./utils/ScreenBoxSelectTool.js";
+export * from "./utils/SpotLightHelper.js";
+export * from "./utils/TransformationTool.js";
+export * from "./utils/Volume.js";
+export * from "./utils/VolumeTool.js";
+export * from "./utils/Compass.js";
 export * from "./viewer/viewer.js";
 export * from "./viewer/Scene.js";
 export * from "./viewer/HierarchicalSlider.js";
@@ -70,33 +84,25 @@ export * from "./modules/OrientedImages/OrientedImages.js";
 export * from "./modules/Images360/Images360.js";
 export * from "./modules/CameraAnimation/CameraAnimation.js";
 
-//export * from "./modules/loader/2.0/OctreeLoader.js";
+export * from "./modules/loader/2.0/OctreeLoader.js";
 
 export {OrbitControls} from "./navigation/OrbitControls.js";
 export {FirstPersonControls} from "./navigation/FirstPersonControls.js";
 export {EarthControls} from "./navigation/EarthControls.js";
 export {DeviceOrientationControls} from "./navigation/DeviceOrientationControls.js";
 export {VRControls} from "./navigation/VRControls.js";
-
-
-//add:
-export {Alignment} from "./modules/datasetAlignment/Alignment.js";
-
-
-
-
-
-
-
+												//add:
+												export {Alignment} from "./modules/datasetAlignment/Alignment.js";
 import "./extensions/OrthographicCamera.js";
 import "./extensions/PerspectiveCamera.js";
 import "./extensions/Ray.js";
 
 import {LRU} from "./LRU.js";
-//import {OctreeLoader} from "./modules/loader/2.0/OctreeLoader.js";
+import {OctreeLoader} from "./modules/loader/2.0/OctreeLoader.js";
 import {POCLoader} from "./loader/POCLoader.js";
 import {EptLoader} from "./loader/EptLoader.js";
 import {PointCloudOctree} from "./PointCloudOctree.js";
+												//import {ExtendPointCloudOctree} from "./custom/ExtendPointCloudOctree.js";
 import {WorkerPool} from "./WorkerPool.js";
 
 export const workerPool = new WorkerPool();
@@ -109,7 +115,7 @@ export const version = {
 
 export let lru = new LRU();
  
-//console.log('Potree ' + version.major + '.' + version.minor + version.suffix);
+console.log('Potree ' + version.major + '.' + version.minor + version.suffix);
 
 export let pointBudget = 1 * 1000 * 1000;
 export let framenumber = 0;
@@ -142,10 +148,6 @@ export {scriptPath, resourcePath};
 
 
 //add: 
-
- 
-
-
 export async function loadFile(path, callback, onError){
     if(Potree.fileServer){
          

+ 1 - 4
src/PotreeRenderer.js

@@ -1,8 +1,6 @@
 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {PointCloudTree} from "./PointCloudTree.js";
-import {PointCloudOctreeNode} from "./PointCloudOctree.js";
-import {PointCloudArena4DNode} from "./arena4d/PointCloudArena4D.js";
 import {PointSizeType, ClipTask, ElevationGradientRepeat} from "./defines.js";
 
 // Copied from three.js: WebGLRenderer.js
@@ -522,8 +520,7 @@ class WebGLTexture {
 			gl.texImage2D(this.target, level, internalFormat,
 				width, height, border, srcFormat, srcType,
 				data);
-		}/* else if(texture instanceof THREE.CubeTexture){//add 
-        } */else if ((texture instanceof THREE.CanvasTexture) || (texture instanceof THREE.Texture)) {
+		} else if ((texture instanceof THREE.CanvasTexture) || (texture instanceof THREE.Texture)) {
 			data = texture.image;
 
 			gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, paramThreeToGL(gl, texture.wrapS));

+ 27 - 48
src/Potree_update_visibility.js

@@ -1,10 +1,10 @@
 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {ClipTask, ClipMethod} from "./defines.js";
-import {Box3Helper} from "./objects/tool/Box3Helper.js";
+import {Box3Helper} from "./utils/Box3Helper.js";
+
+export function updatePointClouds(pointclouds, camera, renderer){
 
-export function updatePointClouds(pointclouds,camera, areaSize /* renderer */){
- 
 	for (let pointcloud of pointclouds) {
 		let start = performance.now();
 
@@ -19,23 +19,22 @@ export function updatePointClouds(pointclouds,camera, areaSize /* renderer */){
 
 		let duration = performance.now() - start;
 	}
-    
-    
-	let result = updateVisibility(pointclouds, camera, areaSize  );
 
-	for (let pointcloud of pointclouds) { 
-		//pointcloud.updateMaterial(pointcloud.material, pointcloud.visibleNodes, camera, renderer);//转移到渲染时
+	let result = updateVisibility(pointclouds, camera, renderer);
+
+	for (let pointcloud of pointclouds) {
+		pointcloud.updateMaterial(pointcloud.material, pointcloud.visibleNodes, camera, renderer);
 		pointcloud.updateVisibleBounds();
 	}
 
-	exports.lru.freeMemory();//即Potree.lru 能看到所有在加载的node
+	exports.lru.freeMemory();
 
 	return result;
 };
 
 
 
-export function updateVisibilityStructures(pointclouds, camera, areaSize) {
+export function updateVisibilityStructures(pointclouds, camera, renderer) {
 	let frustums = [];
 	let camObjPositions = [];
 	let priorityQueue = new BinaryHeap(function (x) { return 1 / x.weight; });
@@ -75,11 +74,8 @@ export function updateVisibilityStructures(pointclouds, camera, areaSize) {
 		let camMatrixObject = new THREE.Matrix4().multiply(worldI).multiply(view);
 		let camObjPos = new THREE.Vector3().setFromMatrixPosition(camMatrixObject);
 		camObjPositions.push(camObjPos);
-        
-        // 因漫游模式而隐藏的话 依旧需要加入visibleNodes,因为pick需要
-        
-                                                    /*  viewer.getObjVisiByReason(pointcloud, 'datasetSelection') */
-		if (pointcloud.visible || pointcloud.unvisibleReasons && pointcloud.unvisibleReasons.length == 1 && pointcloud.unvisibleReasons[0].reason == 'displayMode'   &&  pointcloud.root !== null) {//改 visible -> 
+
+		if (pointcloud.visible && pointcloud.root !== null) {
 			priorityQueue.push({pointcloud: i, node: pointcloud.root, weight: Number.MAX_VALUE});
 		}
 
@@ -104,7 +100,7 @@ export function updateVisibilityStructures(pointclouds, camera, areaSize) {
 };
 
 
-export function updateVisibility(pointclouds, camera, areaSize){
+export function updateVisibility(pointclouds, camera, renderer){
 
 	let numVisibleNodes = 0;
 	let numVisiblePoints = 0;
@@ -118,15 +114,15 @@ export function updateVisibility(pointclouds, camera, areaSize){
 	let lowestSpacing = Infinity;
 
 	// calculate object space frustum and cam pos and setup priority queue
-	let s = updateVisibilityStructures(pointclouds, camera, areaSize);//得到相机可见范围
+	let s = updateVisibilityStructures(pointclouds, camera, renderer);
 	let frustums = s.frustums;
 	let camObjPositions = s.camObjPositions;
 	let priorityQueue = s.priorityQueue;
 
 	let loadedToGPUThisFrame = 0;
 	
-	let domWidth = areaSize.x; //renderer.domElement.clientWidth;
-	let domHeight = areaSize.y;//renderer.domElement.clientHeight;
+	let domWidth = renderer.domElement.clientWidth;
+	let domHeight = renderer.domElement.clientHeight;
 
 	// check if pointcloud has been transformed
 	// some code will only be executed if changes have been detected
@@ -136,7 +132,7 @@ export function updateVisibility(pointclouds, camera, areaSize){
 	let pointcloudTransformVersion = Potree._pointcloudTransformVersion;
 	for(let pointcloud of pointclouds){
 
-		if(!viewer.getObjVisiByReason(pointcloud, 'datasetSelection')){//改 visible ->  
+		if(!pointcloud.visible){
 			continue;
 		}
 
@@ -160,8 +156,7 @@ export function updateVisibility(pointclouds, camera, areaSize){
 	}
 
 	while (priorityQueue.size() > 0) {
-		let element = priorityQueue.pop();//其实是拿第一个, 再把最后一个放到前面
-         
+		let element = priorityQueue.pop();
 		let node = element.node;
 		let parent = element.parent;
 		let pointcloud = pointclouds[element.pointcloud];
@@ -178,13 +173,13 @@ export function updateVisibility(pointclouds, camera, areaSize){
 		let camObjPos = camObjPositions[element.pointcloud];
 
 		let insideFrustum = frustum.intersectsBox(box);
-		let maxLevel = pointcloud.maxLevel == void 0 ? Infinity : pointcloud.maxLevel;
+		let maxLevel = pointcloud.maxLevel || Infinity;
 		let level = node.getLevel();
 		let visible = insideFrustum;
 		visible = visible && !(numVisiblePoints + node.getNumPoints() > Potree.pointBudget);
 		visible = visible && !(numVisiblePointsInPointclouds.get(pointcloud) + node.getNumPoints() > pointcloud.pointBudget);
-		visible = visible && level <= maxLevel; //< 改为 <=
-		//visible = visible || node.getLevel() <= 2;
+		visible = visible && level < maxLevel;
+		visible = visible || node.getLevel() <= 2;
 
 		let clipBoxes = pointcloud.material.clipBoxes;
 		if(true && clipBoxes.length > 0){
@@ -306,7 +301,7 @@ export function updateVisibility(pointclouds, camera, areaSize){
 				node = pointcloud.toTreeNode(node, parent);
 				loadedToGPUThisFrame++;
 			} else {
-				unloadedGeometry.push({pointcloud,node});
+				unloadedGeometry.push(node);
 				visibleGeometry.push(node);
 			}
 		}
@@ -325,11 +320,8 @@ export function updateVisibility(pointclouds, camera, areaSize){
 			let transformVersion = pointcloudTransformVersion.get(pointcloud);
 			if(node._transformVersion !== transformVersion.number){
 				node.sceneNode.updateMatrix();
-				//node.sceneNode.matrixWorld.multiplyMatrices(pointcloud.matrixWorld, node.sceneNode.matrix);	
 				node.sceneNode.matrixWorld.multiplyMatrices(pointcloud.matrixWorld, node.sceneNode.matrix);	
-				
-                node._transformVersion = transformVersion.number;
-                               
+				node._transformVersion = transformVersion.number;
 			}
 
 			if (pointcloud.showBoundingBox && !node.boundingBoxNode && node.getBoundingBox) {
@@ -401,17 +393,18 @@ export function updateVisibility(pointclouds, camera, areaSize){
 		}
 	}// end priority queue loop
 
-	{ // update DEM  这是什么
+	{ // update DEM
 		let maxDEMLevel = 4;
-		let candidates = pointclouds.filter(p => (p.generateDEM && p.dem instanceof Potree.DEM));
+		let candidates = pointclouds
+			.filter(p => (p.generateDEM && p.dem instanceof Potree.DEM));
 		for (let pointcloud of candidates) {
 			let updatingNodes = pointcloud.visibleNodes.filter(n => n.getLevel() <= maxDEMLevel);
 			pointcloud.dem.update(updatingNodes);
 		}
 	}
-    //加载点云
+
 	for (let i = 0; i < Math.min(Potree.maxNodesLoading, unloadedGeometry.length); i++) {
-		unloadedGeometry[i].node.load(unloadedGeometry[i].pointcloud.pcoGeometry); 
+		unloadedGeometry[i].load();
 	}
 
 	return {
@@ -421,17 +414,3 @@ export function updateVisibility(pointclouds, camera, areaSize){
 	};
 };
 
-
-//console
-//viewer.scene.pointclouds[0].visibleNodes.map(e=> e && e.name )
-//viewer.scene.pointclouds[0].visibleNodes.map(e=>e.children.map(e=>e && e.name))
-
-
-
-
-
-
-
-
-
-

+ 0 - 1
src/WorkerPool.js

@@ -24,4 +24,3 @@ export class WorkerPool{
 	}
 };
 
-//Potree.workerPool = new Potree.WorkerPool();

+ 1 - 1
src/exporter/DXFExporter.js

@@ -7,7 +7,7 @@
  */
 
 import * as THREE from "../../libs/three.js/build/three.module.js";
-import {Measure} from "../objects/tool/Measure.js";
+import {Measure} from "../utils/Measure.js";
 
 export class DXFExporter {
 

+ 1 - 1
src/exporter/GeoJSONExporter.js

@@ -6,7 +6,7 @@
  *
  */
 
-import {Measure} from "../objects/tool/Measure.js";
+import {Measure} from "../utils/Measure.js";
 
 export class GeoJSONExporter{
 

+ 0 - 437
src/extensions/three.shim.js

@@ -1,437 +0,0 @@
-import * as THREE from "../../libs/three.js/build/three.module.js";
-
-!function() {
-    if ("performance"in window == 0 && (window.performance = {}),
-    "now"in window.performance == 0) {
-        var e = Date.now();
-        performance.timing && performance.timing.navigationStart && (e = performance.timing.navigationStart),
-        window.performance.now = function() {
-            return Date.now() - e
-        }
-    }
-}(),
-THREE.WebGLRenderer.prototype.paramThreeToGL = function(e) {
-    var t, i = this.extensions, r = this.getContext();//context;
-    if (e === THREE.RepeatWrapping)
-        return r.REPEAT;
-    if (e === THREE.ClampToEdgeWrapping)
-        return r.CLAMP_TO_EDGE;
-    if (e === THREE.MirroredRepeatWrapping)
-        return r.MIRRORED_REPEAT;
-    if (e === THREE.NearestFilter)
-        return r.NEAREST;
-    if (e === THREE.NearestMipMapNearestFilter)
-        return r.NEAREST_MIPMAP_NEAREST;
-    if (e === THREE.NearestMipMapLinearFilter)
-        return r.NEAREST_MIPMAP_LINEAR;
-    if (e === THREE.LinearFilter)
-        return r.LINEAR;
-    if (e === THREE.LinearMipMapNearestFilter)
-        return r.LINEAR_MIPMAP_NEAREST;
-    if (e === THREE.LinearMipMapLinearFilter)
-        return r.LINEAR_MIPMAP_LINEAR;
-    if (e === THREE.UnsignedByteType)
-        return r.UNSIGNED_BYTE;
-    if (e === THREE.UnsignedShort4444Type)
-        return r.UNSIGNED_SHORT_4_4_4_4;
-    if (e === THREE.UnsignedShort5551Type)
-        return r.UNSIGNED_SHORT_5_5_5_1;
-    if (e === THREE.UnsignedShort565Type)
-        return r.UNSIGNED_SHORT_5_6_5;
-    if (e === THREE.ByteType)
-        return r.BYTE;
-    if (e === THREE.ShortType)
-        return r.SHORT;
-    if (e === THREE.UnsignedShortType)
-        return r.UNSIGNED_SHORT;
-    if (e === THREE.IntType)
-        return r.INT;
-    if (e === THREE.UnsignedIntType)
-        return r.UNSIGNED_INT;
-    if (e === THREE.FloatType)
-        return r.FLOAT;
-    if (t = i.get("OES_texture_half_float"),
-    null !== t && e === THREE.HalfFloatType)
-        return t.HALF_FLOAT_OES;
-    if (e === THREE.AlphaFormat)
-        return r.ALPHA;
-    if (e === THREE.RGBFormat)
-        return r.RGB;
-    if (e === THREE.RGBAFormat)
-        return r.RGBA;
-    if (e === THREE.LuminanceFormat)
-        return r.LUMINANCE;
-    if (e === THREE.LuminanceAlphaFormat)
-        return r.LUMINANCE_ALPHA;
-    if (e === THREE.AddEquation)
-        return r.FUNC_ADD;
-    if (e === THREE.SubtractEquation)
-        return r.FUNC_SUBTRACT;
-    if (e === THREE.ReverseSubtractEquation)
-        return r.FUNC_REVERSE_SUBTRACT;
-    if (e === THREE.ZeroFactor)
-        return r.ZERO;
-    if (e === THREE.OneFactor)
-        return r.ONE;
-    if (e === THREE.SrcColorFactor)
-        return r.SRC_COLOR;
-    if (e === THREE.OneMinusSrcColorFactor)
-        return r.ONE_MINUS_SRC_COLOR;
-    if (e === THREE.SrcAlphaFactor)
-        return r.SRC_ALPHA;
-    if (e === THREE.OneMinusSrcAlphaFactor)
-        return r.ONE_MINUS_SRC_ALPHA;
-    if (e === THREE.DstAlphaFactor)
-        return r.DST_ALPHA;
-    if (e === THREE.OneMinusDstAlphaFactor)
-        return r.ONE_MINUS_DST_ALPHA;
-    if (e === THREE.DstColorFactor)
-        return r.DST_COLOR;
-    if (e === THREE.OneMinusDstColorFactor)
-        return r.ONE_MINUS_DST_COLOR;
-    if (e === THREE.SrcAlphaSaturateFactor)
-        return r.SRC_ALPHA_SATURATE;
-    if (t = i.get("WEBGL_compressed_texture_s3tc"),
-    null !== t) {
-        if (e === THREE.RGB_S3TC_DXT1_Format)
-            return t.COMPRESSED_RGB_S3TC_DXT1_EXT;
-        if (e === THREE.RGBA_S3TC_DXT1_Format)
-            return t.COMPRESSED_RGBA_S3TC_DXT1_EXT;
-        if (e === THREE.RGBA_S3TC_DXT3_Format)
-            return t.COMPRESSED_RGBA_S3TC_DXT3_EXT;
-        if (e === THREE.RGBA_S3TC_DXT5_Format)
-            return t.COMPRESSED_RGBA_S3TC_DXT5_EXT
-    }
-    if (t = i.get("WEBGL_compressed_texture_pvrtc"),
-    null !== t) {
-        if (e === THREE.RGB_PVRTC_4BPPV1_Format)
-            return t.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;
-        if (e === THREE.RGB_PVRTC_2BPPV1_Format)
-            return t.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;
-        if (e === THREE.RGBA_PVRTC_4BPPV1_Format)
-            return t.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;
-        if (e === THREE.RGBA_PVRTC_2BPPV1_Format)
-            return t.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG
-    }
-    if (t = i.get("WEBGL_compressed_texture_etc1"),
-    null !== t && e === THREE.RGB_ETC1_Format)
-        return t.COMPRESSED_RGB_ETC1_WEBGL;
-    if (t = i.get("EXT_blend_minmax"),
-    null !== t) {
-        if (e === THREE.MinEquation)
-            return t.MIN_EXT;
-        if (e === THREE.MaxEquation)
-            return t.MAX_EXT
-    }
-    return 0
-}
-/* ,
-THREE.WebGLState = function(e, t, i) {
-    var r = this
-      , o = new THREE.Vector4
-      , a = e.getParameter(e.MAX_VERTEX_ATTRIBS)
-      , s = new Uint8Array(a)
-      , l = new Uint8Array(a)
-      , c = new Uint8Array(a)
-      , h = {}
-      , u = null
-      , d = null
-      , p = null
-      , f = null
-      , g = null
-      , m = null
-      , v = null
-      , A = null
-      , y = !1
-      , C = null
-      , I = null
-      , E = null
-      , b = null
-      , w = null
-      , _ = null
-      , T = null
-      , x = null
-      , S = null
-      , M = null
-      , R = null
-      , P = null
-      , O = null
-      , L = null
-      , D = null
-      , N = e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS)
-      , B = void 0
-      , F = {}
-      , V = new THREE.Vector4
-      , U = null
-      , k = null
-      , H = new THREE.Vector4
-      , G = new THREE.Vector4;
-    this.init = function() {
-        this.clearColor(0, 0, 0, 1),
-        this.clearDepth(1),
-        this.clearStencil(0),
-        this.enable(e.DEPTH_TEST),
-        e.depthFunc(e.LEQUAL),
-        e.frontFace(e.CCW),
-        e.cullFace(e.BACK),
-        this.enable(e.CULL_FACE),
-        this.enable(e.BLEND),
-        e.blendEquation(e.FUNC_ADD),
-        e.blendFunc(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA)
-    }
-    ,
-    this.initAttributes = function() {
-        for (var e = 0, t = s.length; e < t; e++)
-            s[e] = 0
-    }
-    ,
-    this.enableAttribute = function(i) {
-        if (s[i] = 1,
-        0 === l[i] && (e.enableVertexAttribArray(i),
-        l[i] = 1),
-        0 !== c[i]) {
-            var n = t.get("ANGLE_instanced_arrays");
-            n.vertexAttribDivisorANGLE(i, 0),
-            c[i] = 0
-        }
-    }
-    ,
-    this.enableAttributeAndDivisor = function(t, i, n) {
-        s[t] = 1,
-        0 === l[t] && (e.enableVertexAttribArray(t),
-        l[t] = 1),
-        c[t] !== i && (n.vertexAttribDivisorANGLE(t, i),
-        c[t] = i)
-    }
-    ,
-    this.disableUnusedAttributes = function() {
-        for (var t = 0, i = l.length; t < i; t++)
-            l[t] !== s[t] && (e.disableVertexAttribArray(t),
-            l[t] = 0)
-    }
-    ,
-    this.enable = function(t) {
-        h[t] !== !0 && (e.enable(t),
-        h[t] = !0)
-    }
-    ,
-    this.disable = function(t) {
-        h[t] !== !1 && (e.disable(t),
-        h[t] = !1)
-    }
-    ,
-    this.getCompressedTextureFormats = function() {
-        if (null === u && (u = [],
-        t.get("WEBGL_compressed_texture_pvrtc") || t.get("WEBGL_compressed_texture_s3tc") || t.get("WEBGL_compressed_texture_etc1")))
-            for (var i = e.getParameter(e.COMPRESSED_TEXTURE_FORMATS), n = 0; n < i.length; n++)
-                u.push(i[n]);
-        return u
-    }
-    ,
-    this.setBlending = function(t, r, o, a, s, l, c, h) {
-        t === THREE.NoBlending ? this.disable(e.BLEND) : this.enable(e.BLEND),
-        t === d && h === y || (t === THREE.AdditiveBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
-        e.blendFuncSeparate(e.ONE, e.ONE, e.ONE, e.ONE)) : (e.blendEquation(e.FUNC_ADD),
-        e.blendFunc(e.SRC_ALPHA, e.ONE)) : t === THREE.SubtractiveBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
-        e.blendFuncSeparate(e.ZERO, e.ZERO, e.ONE_MINUS_SRC_COLOR, e.ONE_MINUS_SRC_ALPHA)) : (e.blendEquation(e.FUNC_ADD),
-        e.blendFunc(e.ZERO, e.ONE_MINUS_SRC_COLOR)) : t === THREE.MultiplyBlending ? h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
-        e.blendFuncSeparate(e.ZERO, e.ZERO, e.SRC_COLOR, e.SRC_ALPHA)) : (e.blendEquation(e.FUNC_ADD),
-        e.blendFunc(e.ZERO, e.SRC_COLOR)) : h ? (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
-        e.blendFuncSeparate(e.ONE, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA)) : (e.blendEquationSeparate(e.FUNC_ADD, e.FUNC_ADD),
-        e.blendFuncSeparate(e.SRC_ALPHA, e.ONE_MINUS_SRC_ALPHA, e.ONE, e.ONE_MINUS_SRC_ALPHA)),
-        d = t,
-        y = h),
-        t === THREE.CustomBlending ? (s = s || r,
-        l = l || o,
-        c = c || a,
-        r === p && s === m || (e.blendEquationSeparate(i(r), i(s)),
-        p = r,
-        m = s),
-        o === f && a === g && l === v && c === A || (e.blendFuncSeparate(i(o), i(a), i(l), i(c)),
-        f = o,
-        g = a,
-        v = l,
-        A = c)) : (p = null,
-        f = null,
-        g = null,
-        m = null,
-        v = null,
-        A = null)
-    }
-    ,
-    this.setDepthFunc = function(t) {
-        if (C !== t) {
-            if (t)
-                switch (t) {
-                case THREE.NeverDepth:
-                    e.depthFunc(e.NEVER);
-                    break;
-                case THREE.AlwaysDepth:
-                    e.depthFunc(e.ALWAYS);
-                    break;
-                case THREE.LessDepth:
-                    e.depthFunc(e.LESS);
-                    break;
-                case THREE.LessEqualDepth:
-                    e.depthFunc(e.LEQUAL);
-                    break;
-                case THREE.EqualDepth:
-                    e.depthFunc(e.EQUAL);
-                    break;
-                case THREE.GreaterEqualDepth:
-                    e.depthFunc(e.GEQUAL);
-                    break;
-                case THREE.GreaterDepth:
-                    e.depthFunc(e.GREATER);
-                    break;
-                case THREE.NotEqualDepth:
-                    e.depthFunc(e.NOTEQUAL);
-                    break;
-                default:
-                    e.depthFunc(e.LEQUAL)
-                }
-            else
-                e.depthFunc(e.LEQUAL);
-            C = t
-        }
-    }
-    ,
-    this.setDepthTest = function(t) {
-        t ? this.enable(e.DEPTH_TEST) : this.disable(e.DEPTH_TEST)
-    }
-    ,
-    this.setDepthWrite = function(t) {
-        I !== t && (e.depthMask(t),
-        I = t)
-    }
-    ,
-    this.setColorWrite = function(t) {
-        E !== t && (e.colorMask(t, t, t, t),
-        E = t)
-    }
-    ,
-    this.setStencilFunc = function(t, i, n) {
-        w === t && _ === i && T === n || (e.stencilFunc(t, i, n),
-        w = t,
-        _ = i,
-        T = n)
-    }
-    ,
-    this.setStencilOp = function(t, i, n) {
-        x === t && S === i && M === n || (e.stencilOp(t, i, n),
-        x = t,
-        S = i,
-        M = n)
-    }
-    ,
-    this.setStencilTest = function(t) {
-        t ? this.enable(e.STENCIL_TEST) : this.disable(e.STENCIL_TEST)
-    }
-    ,
-    this.setStencilWrite = function(t) {
-        b !== t && (e.stencilMask(t),
-        b = t)
-    }
-    ,
-    this.setFlipSided = function(t) {
-        R !== t && (t ? e.frontFace(e.CW) : e.frontFace(e.CCW),
-        R = t)
-    }
-    ,
-    this.setLineWidth = function(t) {
-        t !== P && (e.lineWidth(t),
-        P = t)
-    }
-    ,
-    this.setPolygonOffset = function(t, i, n) {
-        t ? this.enable(e.POLYGON_OFFSET_FILL) : this.disable(e.POLYGON_OFFSET_FILL),
-        !t || O === i && L === n || (e.polygonOffset(i, n),
-        O = i,
-        L = n)
-    }
-    ,
-    this.getScissorTest = function() {
-        return D
-    }
-    ,
-    this.setScissorTest = function(t) {
-        D = t,
-        t ? this.enable(e.SCISSOR_TEST) : this.disable(e.SCISSOR_TEST)
-    }
-    ,
-    this.activeTexture = function(t) {
-        void 0 === t && (t = e.TEXTURE0 + N - 1),
-        B !== t && (e.activeTexture(t),
-        B = t)
-    }
-    ,
-    this.bindTexture = function(t, i) {
-        void 0 === B && r.activeTexture();
-        var n = F[B];
-        void 0 === n && (n = {
-            type: void 0,
-            texture: void 0
-        },
-        F[B] = n),
-        n.type === t && n.texture === i || (e.bindTexture(t, i),
-        n.type = t,
-        n.texture = i)
-    }
-    ,
-    this.compressedTexImage2D = function() {
-        try {
-            e.compressedTexImage2D.apply(e, arguments)
-        } catch (e) {
-            console.error(e)
-        }
-    }
-    ,
-    this.texImage2D = function() {
-        try {
-            e.texImage2D.apply(e, arguments)
-        } catch (e) {
-            console.error(e)
-        }
-    }
-    ,
-    this.clearColor = function(t, i, n, r) {
-        o.set(t, i, n, r),
-        V.equals(o) === !1 && (e.clearColor(t, i, n, r),
-        V.copy(o))
-    }
-    ,
-    this.clearDepth = function(t) {
-        U !== t && (e.clearDepth(t),
-        U = t)
-    }
-    ,
-    this.clearStencil = function(t) {
-        k !== t && (e.clearStencil(t),
-        k = t)
-    }
-    ,
-    this.scissor = function(t) {
-        H.equals(t) === !1 && (e.scissor(t.x, t.y, t.z, t.w),
-        H.copy(t))
-    }
-    ,
-    this.viewport = function(t) {
-        G.equals(t) === !1 && (e.viewport(t.x, t.y, t.z, t.w),
-        G.copy(t))
-    }
-    ,
-    this.reset = function() {
-        for (var t = 0; t < l.length; t++)
-            1 === l[t] && (e.disableVertexAttribArray(t),
-            l[t] = 0);
-        h = {},
-        u = null,
-        B = void 0,
-        F = {},
-        d = null,
-        E = null,
-        I = null,
-        b = null,
-        R = null
-    }
-} */

+ 1 - 1
src/loader/GeoPackageLoader.js

@@ -100,7 +100,7 @@ export class GeoPackageLoader{
 
 				const matLine = new LineMaterial( {
 					color: new THREE.Color().setRGB(...getColor(table)),
-					lineWidth: 2, 
+					linewidth: 2, 
 					resolution:  new THREE.Vector2(1000, 1000),
 					dashed: false
 				} );

+ 2 - 3
src/loader/PointAttributes.js

@@ -1,10 +1,9 @@
-
 /**
  * Some types of possible point attribute data formats
  *
  * @class
  */
-const PointAttributeTypes = {
+ const PointAttributeTypes = {
 	DATA_TYPE_DOUBLE: {ordinal: 0, name: "double", size: 8},
 	DATA_TYPE_FLOAT:  {ordinal: 1, name: "float",  size: 4},
 	DATA_TYPE_INT8:   {ordinal: 2, name: "int8",   size: 1},
@@ -149,4 +148,4 @@ export class PointAttributes{
 		return false;
 	};
 
-}
+}

+ 1 - 1
src/loader/ShapefileLoader.js

@@ -14,7 +14,7 @@ export class ShapefileLoader{
 
 		const matLine = new LineMaterial( {
 			color: 0xff0000,
-			lineWidth: 3, // in pixels
+			linewidth: 3, // in pixels
 			resolution:  new THREE.Vector2(1000, 1000),
 			dashed: false
 		} );

+ 1 - 1
src/materials/DepthBasicMaterial.js

@@ -2,7 +2,7 @@
 import * as THREE from "../../libs/three.js/build/three.module.js";
 import {Shaders} from "../../build/shaders/shaders.js";
 import {Features} from "../Features.js";
-    
+
  
 export default class DepthBasicMaterial extends THREE.ShaderMaterial{ 
     constructor(o={}){

+ 1 - 0
src/materials/ModelTextureMaterial.js

@@ -1,5 +1,6 @@
 import * as THREE from "../../libs/three.js/build/three.module.js";
 import Common from '../utils/Common.js'
+import {Features} from "../Features.js";
 
 const prefixVertex ="precision highp float;\nprecision highp int;\n\nuniform mat4 modelMatrix;\nuniform mat4 modelViewMatrix;\nuniform mat4 projectionMatrix;\nuniform mat4 viewMatrix;\nuniform mat3 normalMatrix;\nuniform vec3 cameraPosition;\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n"
 const prefixFragment ="precision highp float;\nprecision highp int;\n\nuniform mat4 viewMatrix;\nuniform vec3 cameraPosition;\n"

+ 2 - 2
src/modules/CameraAnimation/CameraAnimation.js

@@ -6,7 +6,7 @@ import {LineDraw} from "../../utils/DrawUtil.js";
 import CurveCtrl from  "../../objects/tool/CurveCtrl.js";
 import HandleSvg from  "../../objects/tool/HandleSvg.js";
 import {/* transitions,*/ easing,  lerp} from '../../utils/transitions.js'
- 
+import { EventDispatcher } from "../../EventDispatcher.js";
 
 const colors = {
     position: 'red', 
@@ -39,7 +39,7 @@ const getLineMat = function(name){
  
 
 
-export class CameraAnimation extends THREE.EventDispatcher{
+export class CameraAnimation extends EventDispatcher{
 
 	constructor(viewer){
 		super();

+ 2 - 3
src/modules/Images360/Images360.js

@@ -16,8 +16,7 @@ import { PanoSizeClass,Vectors,GLCubeFaces, PanoramaEvents} from '../../defines.
  
 import {transitions, easing, lerp} from "../../utils/transitions.js";
 import DepthImageSampler from './DepthImageSampler.js'
-
-
+import { EventDispatcher } from "../../EventDispatcher.js";
  
 var rot90 = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1),  Math.PI/2 ); //使用的是刚好适合全景图的,给cube贴图需要转90°
  
@@ -41,7 +40,7 @@ const HighMapCubeWidth = 1
 const directionFactor = 200 //原先10,几乎只往距离近的走了;设置太大楼梯上不去
  
  
-export class Images360 extends THREE.EventDispatcher{
+export class Images360 extends EventDispatcher{
 
 	constructor(viewer ){
 		super();

+ 0 - 344
src/modules/Images360/Images3603.js

@@ -1,344 +0,0 @@
-
-import * as THREE from "../../../libs/three.js/build/three.module.js";
-import { EventDispatcher } from "../../EventDispatcher.js";
-import {TextSprite} from "../../TextSprite.js";
-
-let sg = new THREE.SphereGeometry(1, 8, 8);
-let sgHigh = new THREE.SphereGeometry(1, 128, 128);
-
-let sm = new THREE.MeshBasicMaterial({side: THREE.BackSide});
-let smHovered = new THREE.MeshBasicMaterial({side: THREE.BackSide, color: 0xff0000});
-
-let raycaster = new THREE.Raycaster();
-let currentlyHovered = null;
-
-let previousView = {
-	controls: null,
-	position: null,
-	target: null,
-};
-
-class Image360{
-
-	constructor(file, time, longitude, latitude, altitude, course, pitch, roll){
-		this.file = file;
-		this.time = time;
-		this.longitude = longitude;
-		this.latitude = latitude;
-		this.altitude = altitude;
-		this.course = course;
-		this.pitch = pitch;
-		this.roll = roll;
-		this.mesh = null;
-	}
-};
-
-export class Images360 extends EventDispatcher{
-
-	constructor(viewer){
-		super();
-
-		this.viewer = viewer;
-
-		this.selectingEnabled = true;
-
-		this.images = [];
-		this.node = new THREE.Object3D();
-
-		this.sphere = new THREE.Mesh(sgHigh, sm);
-		this.sphere.visible = false;
-		this.sphere.scale.set(1000, 1000, 1000);
-		this.node.add(this.sphere);
-		this._visible = true;
-		// this.node.add(label);
-
-		this.focusedImage = null;
-
-		let elUnfocus = document.createElement("input");
-		elUnfocus.type = "button";
-		elUnfocus.value = "unfocus";
-		elUnfocus.style.position = "absolute";
-		elUnfocus.style.right = "10px";
-		elUnfocus.style.bottom = "10px";
-		elUnfocus.style.zIndex = "10000";
-		elUnfocus.style.fontSize = "2em";
-		elUnfocus.addEventListener("click", () => this.unfocus());
-		this.elUnfocus = elUnfocus;
-
-		this.domRoot = viewer.renderer.domElement.parentElement;
-		this.domRoot.appendChild(elUnfocus);
-		this.elUnfocus.style.display = "none";
-
-		viewer.addEventListener("update", () => {
-			this.update(viewer);
-		});
-		viewer.inputHandler.addInputListener(this);
-
-		this.addEventListener("mousedown", () => {
-			if(currentlyHovered && currentlyHovered.image360){
-				this.focus(currentlyHovered.image360);
-			}
-		});
-		
-	};
-
-	set visible(visible){
-		if(this._visible === visible){
-			return;
-		}
-
-
-		for(const image of this.images){
-			image.mesh.visible = visible && (this.focusedImage == null);
-		}
-
-		this.sphere.visible = visible && (this.focusedImage != null);
-		this._visible = visible;
-		this.dispatchEvent({
-			type: "visibility_changed",
-			images: this,
-		});
-	}
-
-	get visible(){
-		return this._visible;
-	}
-
-	focus(image360){
-		if(this.focusedImage !== null){
-			this.unfocus();
-		}
-
-		previousView = {
-			controls: this.viewer.controls,
-			position: this.viewer.scene.view.position.clone(),
-			target: viewer.scene.view.getPivot(),
-		};
-
-		this.viewer.setControls(this.viewer.orbitControls);
-		this.viewer.orbitControls.doubleClockZoomEnabled = false;
-
-		for(let image of this.images){
-			image.mesh.visible = false;
-		}
-
-		this.selectingEnabled = false;
-
-		this.sphere.visible = false;
-
-		this.load(image360).then( () => {
-			this.sphere.visible = true;
-			this.sphere.material.map = image360.texture;
-			this.sphere.material.needsUpdate = true;
-		});
-
-		{ // orientation
-			let {course, pitch, roll} = image360;
-			this.sphere.rotation.set(
-				THREE.Math.degToRad(+roll + 90),
-				THREE.Math.degToRad(-pitch),
-				THREE.Math.degToRad(-course + 90),
-				"ZYX"
-			);
-		}
-
-		this.sphere.position.set(...image360.position);
-
-		let target = new THREE.Vector3(...image360.position);
-		let dir = target.clone().sub(viewer.scene.view.position).normalize();
-		let move = dir.multiplyScalar(0.000001);
-		let newCamPos = target.clone().sub(move);
-
-		viewer.scene.view.setView(
-			newCamPos, 
-			target,
-			500
-		);
-
-		this.focusedImage = image360;
-
-		this.elUnfocus.style.display = "";
-	}
-
-	unfocus(){
-		this.selectingEnabled = true;
-
-		for(let image of this.images){
-			image.mesh.visible = true;
-		}
-
-		let image = this.focusedImage;
-
-		if(image === null){
-			return;
-		}
-
-
-		this.sphere.material.map = null;
-		this.sphere.material.needsUpdate = true;
-		this.sphere.visible = false;
-
-		let pos = viewer.scene.view.position;
-		let target = viewer.scene.view.getPivot();
-		let dir = target.clone().sub(pos).normalize();
-		let move = dir.multiplyScalar(10);
-		let newCamPos = target.clone().sub(move);
-
-		viewer.orbitControls.doubleClockZoomEnabled = true;
-		viewer.setControls(previousView.controls);
-
-		viewer.scene.view.setView(
-			previousView.position, 
-			previousView.target,
-			500
-		);
-
-
-		this.focusedImage = null;
-
-		this.elUnfocus.style.display = "none";
-	}
-
-	load(image360){
-
-		return new Promise(resolve => {
-			let texture = new THREE.TextureLoader().load(image360.file, resolve);
-			texture.wrapS = THREE.RepeatWrapping;
-			texture.repeat.x = -1;
-
-			image360.texture = texture;
-		});
-
-	}
-
-	handleHovering(){
-		let mouse = viewer.inputHandler.mouse;
-		let camera = viewer.scene.getActiveCamera();
-		let domElement = viewer.renderer.domElement;
-
-		let ray = Potree.Utils.mouseToRay(mouse, camera, domElement.clientWidth, domElement.clientHeight);
-
-		// let tStart = performance.now();
-		raycaster.ray.copy(ray);
-		let intersections = raycaster.intersectObjects(this.node.children);
-
-		if(intersections.length === 0){
-			// label.visible = false;
-
-			return;
-		}
-
-		let intersection = intersections[0];
-		currentlyHovered = intersection.object;
-		currentlyHovered.material = smHovered;
-
-		//label.visible = true;
-		//label.setText(currentlyHovered.image360.file);
-		//currentlyHovered.getWorldPosition(label.position);
-	}
-
-	update(){
-
-		let {viewer} = this;
-
-		if(currentlyHovered){
-			currentlyHovered.material = sm;
-			currentlyHovered = null;
-		}
-
-		if(this.selectingEnabled){
-			this.handleHovering();
-		}
-
-	}
-
-};
-
-
-export class Images360Loader{
-
-	static async load(url, viewer, params = {}){
-
-		if(!params.transform){
-			params.transform = {
-				forward: a => a,
-			};
-		}
-		
-		let response = await fetch(`${url}/coordinates.txt`);
-		let text = await response.text();
-
-		let lines = text.split(/\r?\n/);
-		let coordinateLines = lines.slice(1);
-
-		let images360 = new Images360(viewer);
-
-		for(let line of coordinateLines){
-
-			if(line.trim().length === 0){
-				continue;
-			}
-
-			let tokens = line.split(/\t/);
-
-			let [filename, time, long, lat, alt, course, pitch, roll] = tokens;
-			time = parseFloat(time);
-			long = parseFloat(long);
-			lat = parseFloat(lat);
-			alt = parseFloat(alt);
-			course = parseFloat(course);
-			pitch = parseFloat(pitch);
-			roll = parseFloat(roll);
-
-			filename = filename.replace(/"/g, "");
-			let file = `${url}/${filename}`;
-
-			let image360 = new Image360(file, time, long, lat, alt, course, pitch, roll);
-
-			let xy = params.transform.forward([long, lat]);
-			let position = [...xy, alt];
-			image360.position = position;
-
-			images360.images.push(image360);
-		}
-
-		Images360Loader.createSceneNodes(images360, params.transform);
-
-		return images360;
-
-	}
-
-	static createSceneNodes(images360, transform){
-
-		for(let image360 of images360.images){
-			let {longitude, latitude, altitude} = image360;
-			let xy = transform.forward([longitude, latitude]);
-
-			let mesh = new THREE.Mesh(sg, sm);
-			mesh.position.set(...xy, altitude);
-			mesh.scale.set(1, 1, 1);
-			mesh.material.transparent = true;
-			mesh.material.opacity = 0.75;
-			mesh.image360 = image360;
-
-			{ // orientation
-				var {course, pitch, roll} = image360;
-				mesh.rotation.set(
-					THREE.Math.degToRad(+roll + 90),
-					THREE.Math.degToRad(-pitch),
-					THREE.Math.degToRad(-course + 90),
-					"ZYX"
-				);
-			}
-
-			images360.node.add(mesh);
-
-			image360.mesh = mesh;
-		}
-	}
-
-	
-
-};
-
-

+ 2 - 2
src/modules/Images360/Panorama.js

@@ -5,7 +5,7 @@ import { PanoRendererEvents, PanoramaEvents, PanoSizeClass} from '../../defines.
 import math from '../../utils/math.js' 
 import {TextSprite} from '../../objects/TextSprite.js'
 import DepthBasicMaterial from "../../materials/DepthBasicMaterial.js";
-
+import { ExtendEventDispatcher } from "../../custom/ExtendEventDispatcher.js";
 
 var texLoader = new THREE.TextureLoader()
 
@@ -64,7 +64,7 @@ var a = new THREE.Quaternion().setFromAxisAngle(new THREE.Vector3(0,0,1), THREE.
  */
 
 //暂时直接用4dkkconsole输出的数据 
-class Panorama extends THREE.EventDispatcher{
+class Panorama extends ExtendEventDispatcher{
 
 	constructor(o,  images360){//file, time, longitude, latitude, altitude, course, pitch, roll
         super()

+ 2 - 1
src/modules/Images360/tile/PanoRenderer.js

@@ -9,6 +9,7 @@ import {settings,config} from '../../../settings.js'
 /* import config from '../../config' */
 import * as THREE from "../../../../libs/three.js/build/three.module.js"; 
 import math from '../../../utils/math.js' 
+import {ExtendEventDispatcher} from "../../../custom/ExtendEventDispatcher.js";
 
 function createDescriptor() {
     var e = {
@@ -47,7 +48,7 @@ var b = !1,
     }/* ,
     M = []; */
 
-class PanoRenderer extends THREE.EventDispatcher{
+class PanoRenderer extends ExtendEventDispatcher{
     constructor(viewer, tileDownloader, qualityManager) {
         super()
 		this.tileDirectory = {};

+ 2 - 2
src/modules/Images360/tile/TileDownloader.js

@@ -3,7 +3,7 @@ import * as THREE from "../../../../libs/three.js/build/three.module.js";
  
 import TilePrioritizer from './TilePrioritizer.js'
 import TileUtils from './TileUtils.js'
- 
+import {ExtendEventDispatcher} from "../../../custom/ExtendEventDispatcher.js";
  
 import {settings, config} from '../../../settings.js' 
 import {
@@ -18,7 +18,7 @@ window.startdownloads = [];
 
 
 
-class TileDownloader extends THREE.EventDispatcher{
+class TileDownloader extends ExtendEventDispatcher{
     constructor( ) {
         super()
         this.panos = null;

+ 2 - 1
src/modules/OrientedImages/OrientedImageControls.js

@@ -1,8 +1,9 @@
 
 import * as THREE from "../../../libs/three.js/build/three.module.js";
+import {EventDispatcher} from "../../EventDispatcher.js";
 
  
-export class OrientedImageControls extends THREE.EventDispatcher{
+export class OrientedImageControls extends EventDispatcher{
 	
 	constructor(viewer){
 		super();

+ 3 - 2
src/modules/OrientedImages/OrientedImages.js

@@ -1,6 +1,7 @@
 
 import * as THREE from "../../../libs/three.js/build/three.module.js";
-import {OrientedImageControls} from "./OrientedImageControls.js"; 
+import {OrientedImageControls} from "./OrientedImageControls.js";
+import { EventDispatcher } from "../../EventDispatcher.js";
 
 // https://support.pix4d.com/hc/en-us/articles/205675256-How-are-yaw-pitch-roll-defined
 // https://support.pix4d.com/hc/en-us/articles/202558969-How-are-omega-phi-kappa-defined
@@ -118,7 +119,7 @@ export class OrientedImage{
 
 };
 
-export class OrientedImages extends THREE.EventDispatcher{
+export class OrientedImages extends EventDispatcher{
 
 	constructor(){
 		super();

+ 2 - 2
src/modules/Particles/ParticleEditor.js

@@ -6,7 +6,7 @@ import ExplodeParticle from '../../objects/fireParticle/explode/ExplodeParticle.
 import CurveCtrl from '../../objects/tool/CurveCtrl.js'
 import {LineDraw} from "../../utils/DrawUtil.js";
 import Common from '../../utils/Common.js'
-import {EventDispatcher} from "../../EventDispatcher.js";
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 import DepthBasicMaterial from "../../materials/DepthBasicMaterial.js";
 
 
@@ -69,7 +69,7 @@ let getHandleMat = function(type){
 
 let ParticleEditor = {
     
-    bus: new EventDispatcher,
+    bus: ExtendEventDispatcher,
     particleGroup : new THREE.Object3D ,
     curveGroup:new THREE.Object3D ,
     init:function(){

+ 2 - 1
src/modules/clipModel/Clip.js

@@ -5,12 +5,13 @@ import {mapClipBox} from '../../objects/tool/mapClipBox.js'
 import Common from '../../utils/Common.js'
 import math from '../../utils/math.js' 
 import {Images360} from '../Images360/Images360.js' 
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
 const defaultBoxWidth = 6;  //navvis:  10
                             //navvis position: si {x: 0, y: 0, z: 0}
    
 var Clip = {
-    bus : new THREE.EventDispatcher,
+    bus : new ExtendEventDispatcher,
     selectedDatasets : [],    
     changeCallback(force){ 
         if(Potree.settings.isOfficial){  

+ 2 - 1
src/modules/datasetAlignment/Alignment.js

@@ -3,11 +3,12 @@ import * as THREE from "../../../libs/three.js/build/three.module.js";
 import SplitScreen4Views from "../../utils/SplitScreen4Views.js"
 import math from "../../utils/math.js"
 import History from "../../utils/History.js"
+import { EventDispatcher } from "../../EventDispatcher.js";
 
 var Alignment = {
     SplitScreen: SplitScreen4Views, 
     handleState:null,  //操作状态 'translate'|'rotate'
-    bus: new THREE.EventDispatcher(), 
+    bus: new EventDispatcher(), 
     
     prepareRecord : true, 
     

+ 12 - 1
src/modules/loader/2.0/DecoderWorker_brotli.js

@@ -57,7 +57,18 @@ onmessage = function (event) {
 
 	let tStart = performance.now();
 
-	let buffer = BrotliDecode(new Int8Array(event.data.buffer));
+	let buffer; 
+	if(numPoints === 0){
+		buffer = {buffer: new ArrayBuffer(0)};
+	}else{
+		try{
+			buffer = BrotliDecode(new Int8Array(event.data.buffer));
+		}catch(e){
+			buffer = {buffer: new ArrayBuffer(numPoints * (pointAttributes.byteSize + 12))};
+			console.error(`problem with node ${name}: `, e);
+		}
+	}
+
 	let view = new DataView(buffer.buffer);
 	
 	let attributeBuffers = {};

+ 8 - 1
src/modules/loader/2.0/OctreeLoader.js

@@ -38,7 +38,7 @@ export class NodeLoader{
 			let urlOctree = `${this.url}/../octree.bin`;
 
 			let first = byteOffset;
-			let last = byteOffset + byteSize - 1n;  //1n这种写法部分浏览器不支持
+			let last = byteOffset + byteSize - 1n;
 
 			let buffer;
 
@@ -192,6 +192,13 @@ export class NodeLoader{
 				current.byteSize = byteSize;
 				current.numPoints = numPoints;
 			}
+
+			if(current.byteSize === 0n){
+				// workaround for issue #1125
+				// some inner nodes erroneously report >0 points even though have 0 points
+				// however, they still report a byteSize of 0, so based on that we now set node.numPoints to 0
+				current.numPoints = 0;
+			}
 			
 			current.nodeType = type;
 

+ 2 - 2
src/modules/mergeModel/MergeEditor.js

@@ -11,8 +11,8 @@ import InfiniteGridHelper from '../../objects/InfiniteGridHelper.js'
 import Compass from "../../objects/tool/Compass.js";
 import {TransformControls} from "../../objects/tool/TransformControls.js";
 import History from "../../utils/History.js"
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
- 
 const texLoader = new THREE.TextureLoader() 
       texLoader.crossOrigin = "anonymous" 
   
@@ -48,7 +48,7 @@ const viewportProps = [{
  
  
 let MergeEditor = {
-    bus:new THREE.EventDispatcher(), 
+    bus:new ExtendEventDispatcher(), 
      
     
     SplitScreen : new SplitScreen(),

+ 2 - 2
src/modules/panoEdit/panoEditor.js

@@ -10,7 +10,7 @@ import Sprite from "../../objects/Sprite.js";
 import {transitions, easing, lerp} from '../../utils/transitions.js'
 import {TransformControls} from "../../objects/tool/TransformControls.js";
 import SplitScreen from "../../utils/SplitScreen.js"
-
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
 
 
@@ -55,7 +55,7 @@ const cameraProps = [
 
 
 
-class PanoEditor extends THREE.EventDispatcher{
+class PanoEditor extends ExtendEventDispatcher{
     
     constructor(){
         super()

+ 3 - 1
src/modules/route/RouteGuider.js

@@ -4,6 +4,8 @@ import {Utils} from "../../utils.js";
 import Sprite from '../../objects/Sprite.js'
 import Common from "../../utils/Common.js";
 import browser from '../../utils/browser.js'
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
+
 const texLoader = new THREE.TextureLoader()
 const arrowSpacing = 1 //间隔
 const arrowSize = arrowSpacing * 0.5
@@ -14,7 +16,7 @@ const sphereSizeInfo = {
 }
 //const arrowsShowingCount = 25; //场景里最多展示多少个箭头
 const arrowShowMinDis = 10
-export class RouteGuider extends THREE.EventDispatcher{
+export class RouteGuider extends ExtendEventDispatcher{
     constructor () {
 		super();
         

+ 3 - 1
src/modules/siteModel/SiteModel.js

@@ -6,6 +6,8 @@ import {Images360} from '../Images360/Images360.js'
 import {KeyCodes} from '../../KeyCodes.js' 
 import {config } from "../../settings.js";
 import math from "../../utils/math.js";
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
+
 const minFloorHeight = 0.5
 const ifDrawDatasetBound = true //显示一下数据集的tightBound线框
 const minMarkers = 3
@@ -14,7 +16,7 @@ const minMarkers = 3
 const Limit = {zMin:-config.map.cameraHeight,  zMax:config.map.cameraHeight,} //不能超过camera的高度,为了对称所以也限制了最低
 
 var SiteModel = {
-    bus: new THREE.EventDispatcher(), 
+    bus: new ExtendEventDispatcher(), 
     entities:[],  //所有实体
     buildings:[], //所有建筑父集
     meshGroup: new THREE.Object3D,

+ 2 - 1
src/navigation/DeviceOrientationControls.js

@@ -15,8 +15,9 @@
  */
 
 import * as THREE from "../../libs/three.js/build/three.module.js"; 
+import {EventDispatcher} from "../EventDispatcher.js";
 
-export class DeviceOrientationControls extends THREE.EventDispatcher{
+export class DeviceOrientationControls extends EventDispatcher{
 	constructor(viewer){
 		super();
 

+ 2 - 1
src/navigation/EarthControls.js

@@ -2,8 +2,9 @@
 import * as THREE from "../../libs/three.js/build/three.module.js";
 import {Buttons} from "../defines.js";
 import {Utils} from "../utils.js"; 
+import {EventDispatcher} from "../EventDispatcher.js";
 
-export class EarthControls extends THREE.EventDispatcher {
+export class EarthControls extends EventDispatcher {
 	constructor (viewer) {
 		super(viewer);
 

+ 3 - 2
src/navigation/FirstPersonControls.js

@@ -18,8 +18,9 @@ import {Buttons} from "../defines.js";
 import {Utils} from "../utils.js"; 
 import cameraLight from "../utils/cameraLight.js"; 
 import Common from "../utils/Common.js"; 
- 
-export class FirstPersonControls extends THREE.EventDispatcher {
+import {EventDispatcher} from "../EventDispatcher.js";
+
+export class FirstPersonControls extends EventDispatcher {
 	constructor (viewer, viewport) {
 		super();
         

+ 2 - 2
src/navigation/InputHandler.js

@@ -10,10 +10,10 @@ import {Utils} from "../utils.js";
 import {Buttons} from "../defines.js";  
 import Common from "../utils/Common.js";
 import DepthBasicMaterial from '../materials/DepthBasicMaterial.js'
+import {EventDispatcher} from "../EventDispatcher.js";
 
 
-
-export class InputHandler extends THREE.EventDispatcher {
+export class InputHandler extends EventDispatcher {
 	constructor (viewer,scene) {
 		super();
 

+ 2 - 1
src/navigation/OrbitControls.js

@@ -16,11 +16,12 @@
 import * as THREE from "../../libs/three.js/build/three.module.js";
 import {Buttons} from "../defines.js";
 import {Utils} from "../utils.js"; 
+import {EventDispatcher} from "../EventDispatcher.js";
 
 let minRadius = 2
 
  
-export class OrbitControls extends THREE.EventDispatcher{
+export class OrbitControls extends EventDispatcher{
 	
 	constructor(viewer){
 		super();

+ 5 - 3
src/navigation/VRControls.js

@@ -4,6 +4,7 @@ import { XRControllerModelFactory } from '../../libs/three.js/webxr/XRController
 import {Line2} from "../../libs/three.js/lines/Line2.js";
 import {LineGeometry} from "../../libs/three.js/lines/LineGeometry.js";
 import {LineMaterial} from "../../libs/three.js/lines/LineMaterial.js";
+import {EventDispatcher} from "../EventDispatcher.js";
 
 let fakeCam = new THREE.PerspectiveCamera();
 
@@ -73,6 +74,7 @@ class FlyMode{
 
 	start(vrControls){
 		if(!this.dbgLabel){
+			debugger;
 			/* this.dbgLabel = new Potree.TextSprite("abc");
 			this.dbgLabel.name = "debug label";
 			vrControls.viewer.sceneVR.add(this.dbgLabel);
@@ -276,7 +278,7 @@ class RotScaleMode{
 };
 
 
-export class VRControls extends THREE.EventDispatcher{
+export class VRControls extends EventDispatcher{
 
 	constructor(viewer){
 		super(viewer);
@@ -335,7 +337,7 @@ export class VRControls extends THREE.EventDispatcher{
 
 				let lineMaterial = new LineMaterial({ 
 					color: 0xff0000, 
-					lineWidth: 2, 
+					linewidth: 2, 
 					resolution:  new THREE.Vector2(1000, 1000),
 				});
 
@@ -386,7 +388,7 @@ export class VRControls extends THREE.EventDispatcher{
 
 				let lineMaterial = new LineMaterial({ 
 					color: 0xff0000, 
-					lineWidth: 2, 
+					linewidth: 2, 
 					resolution:  new THREE.Vector2(1000, 1000),
 				});
 

+ 2 - 2
src/objects/Label.js

@@ -1,9 +1,9 @@
 import * as THREE from "../../libs/three.js/build/three.module.js";
 import {Utils} from "../utils.js";  
+import {ExtendEventDispatcher} from "../custom/ExtendEventDispatcher.js";
 
 
-
-class Label  extends THREE.EventDispatcher{
+class Label  extends ExtendEventDispatcher{
     constructor(o={}){
         super()
         

+ 2 - 1
src/objects/tool/AnnotationTool.js

@@ -3,8 +3,9 @@ import * as THREE from "../../../libs/three.js/build/three.module.js";
 import {Annotation} from "../../Annotation.js";
 import {Utils} from "../../utils.js";
 import {CameraMode} from "../../defines.js"; 
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
-export class AnnotationTool extends THREE.EventDispatcher{
+export class AnnotationTool extends ExtendEventDispatcher{
 	constructor (viewer) {
 		super();
 

+ 2 - 1
src/objects/tool/ClippingTool.js

@@ -3,8 +3,9 @@
 import * as THREE from "../../../libs/three.js/build/three.module.js";
 import {ClipVolume} from "./ClipVolume.js";
 import {PolygonClipVolume} from "./PolygonClipVolume.js"; 
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
-export class ClippingTool extends THREE.EventDispatcher{
+export class ClippingTool extends ExtendEventDispatcher{
 
 	constructor(viewer){
 		super(); 

+ 10 - 4
src/objects/tool/Compass.js

@@ -1,11 +1,11 @@
  
 import * as THREE from "../../../libs/three.js/build/three.module.js";
-
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
 
 const initDir = new THREE.Vector3(0,1,0)//指南针模型的北方向 向屏幕里
 
-class Compass extends THREE.EventDispatcher{
+class Compass extends ExtendEventDispatcher{
     
     constructor(dom, viewport){
         super()
@@ -83,8 +83,14 @@ class Compass extends THREE.EventDispatcher{
             this.renderer.setPixelRatio(window.devicePixelRatio ? window.devicePixelRatio : 1)
             this.renderer.domElement.setAttribute('name','compass')
             this.renderer.setClearAlpha(0.0)
-            this.renderer.setSize(width/2, height/2, false, window.devicePixelRatio ? window.devicePixelRatio : 1);
-            //this.emit(SceneRendererEvents.ContextCreated)
+            //xst修改
+			//this.renderer.setSize(width/2, height/2, false, window.devicePixelRatio ? window.devicePixelRatio : 1);
+            //xst修改
+			//this.renderer.setPixelRatio(window.devicePixelRatio ? window.devicePixelRatio : 1);
+			//this.renderer.setSize(width/2, height/2);
+			//xst修改
+			this.renderer.setDrawingBufferSize( width/2, height/2, window.devicePixelRatio ? window.devicePixelRatio : 1 )
+			//this.emit(SceneRendererEvents.ContextCreated)
         } catch (e) {
             viewer.dispatchEvent('webglError', {msg:e})
         }

+ 2 - 2
src/objects/tool/HandleSvg.js

@@ -2,9 +2,9 @@
 import math  from "../../utils/math.js";
  
 import * as THREE from "../../../libs/three.js/build/three.module.js";
-
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
  
-export default class HandleSvg extends THREE.EventDispatcher{
+export default class HandleSvg extends ExtendEventDispatcher{
     constructor(position, color){
         super()
         this.position = position

+ 2 - 2
src/objects/tool/MeasuringTool.js

@@ -5,7 +5,7 @@ import {Utils} from "../../utils.js";
 import math from "../../utils/math.js";
 import {CameraMode} from "../../defines.js"; 
 import {TextSprite} from '../TextSprite.js'
-
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
  
  
  
@@ -124,7 +124,7 @@ function updateAzimuth(viewer, measure){
 	azimuth.label.scale.set(scale, scale, scale);
 }
 
-export class MeasuringTool extends THREE.EventDispatcher{
+export class MeasuringTool extends ExtendEventDispatcher{
 	constructor (viewer) {
 		super();
 

+ 2 - 2
src/objects/tool/ProfileTool.js

@@ -2,9 +2,9 @@
 import * as THREE from "../../../libs/three.js/build/three.module.js";
 import {Profile} from "./Profile.js";
 import {Utils} from "../../utils.js"; 
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
-
-export class ProfileTool extends THREE.EventDispatcher {
+export class ProfileTool extends ExtendEventDispatcher {
 	constructor (viewer) {
 		super();
 

+ 2 - 2
src/objects/tool/TagTool.js

@@ -5,9 +5,9 @@ import math from "../../utils/math.js";
 import {Utils} from "../../utils.js"; 
 
 import Tag from '../Tag.js'
+import {ExtendEventDispatcher} from "../../custom/ExtendEventDispatcher.js";
 
-
-export class TagTool extends THREE.EventDispatcher{
+export class TagTool extends ExtendEventDispatcher{
 	constructor (viewer) {
 		super();
         

+ 2 - 2
src/start.js

@@ -2,10 +2,10 @@ import * as THREE from "../libs/three.js/build/three.module.js";
 import {settings, config} from './settings.js' 
 import math from './utils/math.js' 
 import browser from './utils/browser.js' 
-import './extensions/three.shim.js' 
+import './custom/three.shim.js' 
  
-
 import {Utils} from "./utils.js"
+import "./custom/potree.shim.js"
  
 
 var start = function(dom, mapDom, number ){ //t-Zvd3w0m

+ 81 - 396
src/utils.js

@@ -1,15 +1,10 @@
 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {XHRFactory} from "./XHRFactory.js";
-import {Volume} from "./objects/tool/Volume.js";
-import {Profile} from "./objects/tool/Profile.js";
-import {Measure} from "./objects/tool/Measure.js";
-import {PolygonClipVolume} from "./objects/tool/PolygonClipVolume.js";
-import math from "./utils/math.js";
-
-
-
-
+import {Volume} from "./utils/Volume.js";
+import {Profile} from "./utils/Profile.js";
+import {Measure} from "./utils/Measure.js";
+import {PolygonClipVolume} from "./utils/PolygonClipVolume.js";
 
 export class Utils {
 	static async loadShapefileFeatures (file, callback) {
@@ -289,7 +284,7 @@ export class Utils {
 		let parent = new THREE.Object3D("skybox_root");
 
 		let camera = new THREE.PerspectiveCamera(75, window.innerWidth / window.innerHeight, 1, 100000);
-		if(!window.axisYup)  camera.up.set(0, 0, 1);
+		camera.up.set(0, 0, 1);
 		let scene = new THREE.Scene();
 
 		let format = '.jpg';
@@ -401,88 +396,40 @@ export class Utils {
 		return texture;
 	}
 
-	static getMousePointCloudIntersection (viewport, mouse, pointer, camera, viewer, pointclouds, pickParams = {} ) {
-		if(!pointclouds || pointclouds.length == 0)return
-        
-		let renderer = viewer.renderer;
+	static getMousePointCloudIntersection (mouse, camera, viewer, pointclouds, params = {}) {
 		
-		  
-        if(viewport){ //转换到类似整个画面时
-            
-             /*let mouseInViewport = Utils.convertNDCToScreenPosition(pointer, null, viewport.resolution.x, viewport.resolution.y)
-        
-            pickParams.x = mouseInViewport.x   //mouse.x / viewport.width;
-            pickParams.y = mouseInViewport.y //renderer.domElement.clientHeight - mouse.y / viewport.height;  */
-            pickParams.x = mouse.x;
-            pickParams.y = viewport.resolution.y - mouse.y;
-        }else{ 
-            pickParams.x = mouse.x;
-            pickParams.y = renderer.domElement.clientHeight - mouse.y; 
-        } 
-         
-        //console.log('getMousePointCloudIntersection')
+		let renderer = viewer.renderer;
 		
+		let nmouse = {
+			x: (mouse.x / renderer.domElement.clientWidth) * 2 - 1,
+			y: -(mouse.y / renderer.domElement.clientHeight) * 2 + 1
+		};
+
+		let pickParams = {};
+
+		if(params.pickClipped){
+			pickParams.pickClipped = params.pickClipped;
+		}
+
+		pickParams.x = mouse.x;
+		pickParams.y = renderer.domElement.clientHeight - mouse.y;
+
+		let raycaster = new THREE.Raycaster();
+		raycaster.setFromCamera(nmouse, camera);
+		let ray = raycaster.ray;
 
-		 
-		
-		/* if(!raycaster){
-            raycaster = new THREE.Raycaster();
-            raycaster.setFromCamera(pointer, camera); 
-        }  */
-        
-        let raycaster = new THREE.Raycaster();
-        raycaster.setFromCamera(pointer, camera); 
-        let ray = raycaster.ray;
-        
 		let selectedPointcloud = null;
 		let closestDistance = Infinity;
 		let closestIntersection = null;
 		let closestPoint = null;
 		
-        
-        let density
-        let sizeType
-        let size = new Map()  
-        if(pickParams.isMeasuring || Potree.settings.displayMode == 'showPanos'){ //测量或全景模式提高精准度
-            density = Potree.settings.pointDensity 
-            Potree.settings.pointDensity = 'magnifier' 
-            
-            pointclouds.forEach(e=>{//因为全景模式的pointSizeType是fixed所以要还原下
-                size.set(e, e.temp.pointSize)    
-                sizeType = e.material.pointSizeType  
-                e.material.pointSizeType = Potree.config.material.pointSizeType 
-                 
-                e.changePointSize(Potree.config.material.realPointSize*2, true)//更改点云大小到能铺满为止,否则容易识别不到
-            }) 
-            Potree.updatePointClouds(pointclouds,  camera, viewport.resolution );
-        }else{
-            if(viewer.viewports.filter(e=>!e.noPointcloud && e.active).length>1 || pickParams.cameraChanged){
-                viewport.beforeRender && viewport.beforeRender()
-                Potree.updatePointClouds(pointclouds,  camera, viewport.resolution ); //不加这句的话hover久了会不准 因node是错的
-                //但依旧需要camera真的移动到那个位置才能加载出点云
-            }
-            
-        }
-        
-        
-         
-        
-        
-        
-        
-        let allPointclouds = [] 
-		for(let pointcloud of pointclouds){ 
-            
-			let point = pointcloud.pick(viewer, viewport, camera, ray, pickParams );
+		for(let pointcloud of pointclouds){
+			let point = pointcloud.pick(viewer, camera, ray, pickParams);
 			
-          
-            
 			if(!point){
 				continue;
 			}
-            allPointclouds.push(pointcloud)
-            
-            
+
 			let distance = camera.position.distanceTo(point.position);
 
 			if (distance < closestDistance) {
@@ -493,48 +440,43 @@ export class Utils {
 			}
 		}
 
-
-        if(pickParams.isMeasuring || Potree.settings.displayMode == 'showPanos'){
-            Potree.settings.pointDensity = density
-            
-            pointclouds.forEach(e=>{
-                e.material.pointSizeType = sizeType
-                e.changePointSize(size.get(e))
-                
-            })
-        }else{
-            /* if(viewer.viewports.filter(e=>!e.noPointcloud).length>1){
-                viewport.afterRender && viewport.afterRender() 
-            } */
-        }
-
-
 		if (selectedPointcloud) {
 			return {
 				location: closestIntersection,
 				distance: closestDistance,
 				pointcloud: selectedPointcloud,
-                point: closestPoint,
-                pointclouds: allPointclouds, //add 
-                normal: new THREE.Vector3().fromArray(closestPoint.normal )//add
+				point: closestPoint
 			};
 		} else {
 			return null;
 		}
-        
 	}
 
-	static renderTargetToDataUrl(renderTarget, width, height, renderer, compressRatio = 0.7){
-        let pixelCount = width * height;
-        let buffer = new Uint8Array(4 * pixelCount);
+	static pixelsArrayToImage (pixels, width, height) {
+		let canvas = document.createElement('canvas');
+		canvas.width = width;
+		canvas.height = height;
+
+		let context = canvas.getContext('2d');
+
+		pixels = new pixels.constructor(pixels);
+
+		for (let i = 0; i < pixels.length; i++) {
+			pixels[i * 4 + 3] = 255;
+		}
+
+		let imageData = context.createImageData(width, height);
+		imageData.data.set(pixels);
+		context.putImageData(imageData, 0, 0);
+
+		let img = new Image();
+		img.src = canvas.toDataURL();
+		// img.style.transform = "scaleY(-1)";
 
-        renderer.readRenderTargetPixels(renderTarget, 0, 0, width, height, buffer);
-        var dataUrl = Potree.Utils.pixelsArrayToDataUrl(buffer, width, height, compressRatio)
-        return dataUrl
-        
-    } 
+		return img;
+	}
 
-	static pixelsArrayToDataUrl(pixels, width, height, compressRatio = 0.7) {
+	static pixelsArrayToDataUrl(pixels, width, height) {
 		let canvas = document.createElement('canvas');
 		canvas.width = width;
 		canvas.height = height;
@@ -543,10 +485,33 @@ export class Utils {
 
 		pixels = new pixels.constructor(pixels);
 
-		/* for (let i = 0; i < pixels.length; i++) {
+		for (let i = 0; i < pixels.length; i++) {
 			pixels[i * 4 + 3] = 255;
-		} */
-        // flip vertically
+		}
+
+		let imageData = context.createImageData(width, height);
+		imageData.data.set(pixels);
+		context.putImageData(imageData, 0, 0);
+
+		let dataURL = canvas.toDataURL();
+
+		return dataURL;
+	}
+
+	static pixelsArrayToCanvas(pixels, width, height){
+		let canvas = document.createElement('canvas');
+		canvas.width = width;
+		canvas.height = height;
+
+		let context = canvas.getContext('2d');
+
+		pixels = new pixels.constructor(pixels);
+
+		//for (let i = 0; i < pixels.length; i++) {
+		//	pixels[i * 4 + 3] = 255;
+		//}
+
+		// flip vertically
 		let bytesPerLine = width * 4;
 		for(let i = 0; i < parseInt(height / 2); i++){
 			let j = height - i - 1;
@@ -556,20 +521,14 @@ export class Utils {
 			pixels.set(lineJ, i * bytesPerLine);
 			pixels.set(lineI, j * bytesPerLine);
 		}
-        
-        
-        
+
 		let imageData = context.createImageData(width, height);
 		imageData.data.set(pixels);
 		context.putImageData(imageData, 0, 0);
 
-		let dataURL = canvas.toDataURL(compressRatio);
-
-		return dataURL;
+		return canvas;
 	}
 
- 
-
 	static removeListeners(dispatcher, type){
 		if (dispatcher._listeners === undefined) {
 			return;
@@ -580,7 +539,7 @@ export class Utils {
 		}
 	}
 
-	/* static mouseToRay(mouse, camera, width, height){
+	static mouseToRay(mouse, camera, width, height){
 
 		let normalizedMouse = {
 			x: (mouse.x / width) * 2 - 1,
@@ -595,50 +554,8 @@ export class Utils {
 		let ray = new THREE.Ray(origin, direction);
 
 		return ray;
-	} */
-    static mouseToRay(pointer, camera  ){
- 
-		let vector = new THREE.Vector3(pointer.x, pointer.y, 1); 
-        let origin = new THREE.Vector3(pointer.x, pointer.y, -1); //不能用camera.position,在orbitCamera时不准
-		vector.unproject(camera);
-        origin.unproject(camera);
-		let direction = new THREE.Vector3().subVectors(vector, origin).normalize();
-
-		let ray = new THREE.Ray(origin, direction);
-
-		return ray;
 	}
-    
-    static getPos2d(point, camera, dom, viewport){//获取一个三维坐标对应屏幕中的二维坐标
-        var pos
-        if(math.closeTo(camera.position, point, 1e-5) ){ //和相机位置重合时显示会四处飘,看是要改成一直显示中间还是隐藏?
-            pos = new THREE.Vector3(0,0,1.5); //1.5是为了不可见
-        }else{ 
-            pos = point.clone().project(camera)	//比之前hotspot的计算方式写得简单  project用于3转2(求法同shader); unproject用于2转3 :new r.Vector3(e.x, e.y, -1).unproject(this.camera);
-		}
-        
-        
-		var x,y,left,top;
-		x = (pos.x + 1) / 2 * dom.clientWidth * viewport.width;
-		y = (1 - (pos.y + 1) / 2) * dom.clientHeight * viewport.height; 
-        left = viewport.left * dom.clientWidth;
-        top = (1- viewport.bottom - viewport.height) * dom.clientHeight;
-         
-  
-		var inSight = pos.x <= 1 &&  pos.x >= -1    //是否在屏幕中   
-					&& pos.x <= 1 &&  pos.y >= -1 
-	 
-	
-		return {
-			pos:  new THREE.Vector2(left+x,top+y) ,// 屏幕像素坐标
-			vector:  pos,   //(范围 -1 ~ 1)
-			trueSide : pos.z<1, //trueSide为false时,即使在屏幕范围内可见,也是反方向的另一个不可以被渲染的点   参见Tag.update
-			inSight : inSight,	//在屏幕范围内可见,
-            posInViewport: new THREE.Vector2(x,y)
-		};
-	} 
 
-    
 	static projectedRadius(radius, camera, distance, screenWidth, screenHeight){
 		if(camera instanceof THREE.OrthographicCamera){
 			return Utils.projectedRadiusOrtho(radius, camera.projectionMatrix, screenWidth, screenHeight);
@@ -1176,239 +1093,7 @@ Utils.screenPass = new function () {
 		if (typeof target === 'undefined') {
 			renderer.render(this.screenScene, this.camera);
 		} else {
-            renderer.setRenderTarget(target)
-			renderer.render(this.screenScene, this.camera);
+			renderer.render(this.screenScene, this.camera, target);
 		}
 	};
 }();
-
-//add
-Utils.computePointcloudsBound = function(pointclouds){
-    var boundingBox = new THREE.Box3();
-    pointclouds.forEach(pointcloud=>{
-        pointcloud.updateBound()
-        boundingBox.union(pointcloud.bound)
-    })
-    var boundSize = boundingBox.getSize(new THREE.Vector3)
-    var center = boundingBox.getCenter(new THREE.Vector3)
-    return {boundSize, center, boundingBox}
-}
-
-
-Utils.convertScreenPositionToNDC = function(pointer, mouse, width, height) { 
-    return pointer = pointer || new THREE.Vector2,
-        pointer.x = mouse.x / width * 2 - 1,
-        pointer.y = 2 * -(mouse.y / height) + 1,
-        pointer 
-}
-Utils.convertNDCToScreenPosition = function(pointer, mouse, width, height) { 
-    return mouse = mouse || new THREE.Vector2,
-        mouse.x = Math.round((pointer.x + 1 ) / 2 * width),
-        mouse.y = Math.round(-(pointer.y - 1 ) / 2 * height),
-        mouse 
-}
-
-
-
-Utils.getOrthoCameraMoveVec = function(pointerDelta, camera ){//获取当camera为Ortho型时 屏幕点1 到 屏幕点2 的三维距离
-     
-    let cameraViewWidth = camera.right / camera.zoom  
-    let cameraViewHeight = camera.top / camera.zoom
-    let moveVec = new THREE.Vector3; 
-    moveVec.set( pointerDelta.x * cameraViewWidth  , pointerDelta.y * cameraViewHeight  , 0).applyQuaternion(camera.quaternion)  
-    return moveVec              
-}
-
-
-
-
-Utils.VectorFactory = {
-    fromArray : function(t) {
-        if (t) {
-            if (t.length < 2 || t.length > 3)
-                console.error("Wrong number of ordinates for a point!");
-            return 3 === t.length ? (new THREE.Vector3).fromArray(t) : (new THREE.Vector2).fromArray(t)
-        }
-    },
-    fromArray3 : function(t) {
-        if (t) {
-            if (3 !== t.length)
-                console.error("Wrong number of ordinates for a point!");
-            return (new THREE.Vector3).fromArray(t)
-        }
-    },
-    fromArray2 : function(t) {
-        if (t) {
-            if (2 !== t.length)
-                console.error("Wrong number of ordinates for a point!");
-            return (new THREE.Vector2).fromArray(t)
-        }
-    },
-    toString : function(t) {
-        return t.x.toFixed(8) + "," + t.y.toFixed(8) + "," + t.z.toFixed(3)
-    }
-
-}
- 
-Utils.QuaternionFactory = {
-    rot90 : (new THREE.Quaternion).setFromAxisAngle(new THREE.Vector3(0,0,1), THREE.Math.degToRad(-90)),
-    fromArray : function(t) {
-        if (t) {
-            if (4 !== t.length)
-                console.error("Wrong number of ordinates for a quaternion!");
-            return new THREE.Quaternion(t[1],t[2],t[3],t[0]).multiply(this.rot90)
-        }
-    }
-    ,
-    toArray : function(t) {
-        if (t) {
-            var e = t.clone().multiply(a).toArray();
-            return [e[3], e[0], e[1], e[2]]
-        }
-    }
-    ,
-    fromLonLat : function(t) {
-        if (t)
-            return (new THREE.Quaternion).setFromEuler(new THREE.Euler(t.lon,t.lat,0))
-    }
-    ,
-    toLonLat : function(t) {
-        if (t) {
-            var e = (new THREE.Euler).setFromQuaternion(t);
-            return {
-                lon: e.x,
-                lat: e.y
-            }
-        }
-    }
-    
-    
-}
- 
-  
-Utils.datasetPosTransform = function(o={}){  
- 
-    let pointcloud = o.pointcloud || viewer.scene.pointclouds.find(e=>e.dataset_id == o.datasetId)
-    let tranMatrix 
-    if(pointcloud){ 
-        if(Potree.settings.editType == 'merge'){
-            tranMatrix = o.fromDataset ? pointcloud.matrixWorld : new THREE.Matrix4().copy(pointcloud.matrixWorld).invert() 
-        }else{
-            tranMatrix = o.fromDataset ? pointcloud.transformMatrix : pointcloud.transformInvMatrix 
-        }
-    }else{ 
-        if(Potree.settings.intersectOnObjs){
-            let object = o.object || viewer.objs.children.find(e=>e.dataset_id == o.datasetId)
-            if(object){
-                tranMatrix = o.fromDataset ? object.matrixWorld : new THREE.Matrix4().copy(object.matrixWorld).invert() 
-            }  
-        } 
-    } 
-    if(tranMatrix){
-        return (new THREE.Vector3).copy(o.position).applyMatrix4(tranMatrix)
-    }else{
-        if(o.datasetId != void 0){
-            console.error(`datasetPosTransform找不到datasetId为${o.datasetId}的数据集或模型,请检查数据, 模型未创建或删除`)
-            //很可能是旧的热点,需要删除
-        }
-    }
-    
-}
-
-
-
-Utils.datasetRotTransform = function(o={}){
-    let pointcloud = o.pointcloud || viewer.scene.pointclouds.find(e=>e.dataset_id == o.datasetId)
-    if(pointcloud){
-        var matrix, newMatrix, result
-        
-        if(o.rotation){
-            matrix = new THREE.Matrix4().makeRotationFromEuler(o.rotation)
-        }else if(o.quaternion){
-            matrix = new THREE.Matrix4().makeRotationFromQuaternion(o.quaternion) 
-        }else if(o.matrix){
-            matrix = o.matrix.clone()
-        }else{
-            return
-        } 
-        let rotateMatrix = o.fromDataset ? pointcloud.rotateMatrix : pointcloud.rotateInvMatrix
-        newMatrix = new THREE.Matrix4().multiplyMatrices(rotateMatrix, matrix  ) 
-         
-        if(o.getRotation){
-            result = new THREE.Euler().setFromRotationMatrix(newMatrix)
-        }else if(o.getQuaternion){
-            result = new THREE.Quaternion().setFromRotationMatrix(newMatrix)
-        }else if(o.getMatrix){
-            result = newMatrix
-        }
-        
-        return result
-        
-    }
-
-    
-}
-
-Utils.isInsideFrustum = function(bounding, camera){// boundingBox在视野范围内有可见部分
-    let frustumMatrix = new THREE.Matrix4
-    frustumMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse)
-    
-    let frustum = new THREE.Frustum();
-    frustum.setFromProjectionMatrix(frustumMatrix) 
-     
-    if(bounding instanceof THREE.Sphere){
-        return frustum.intersectsSphere(bounding)  
-    }else{
-        return frustum.intersectsBox(bounding)  
-    }
-}
-
-Utils.isInsideBox = function(object,  boxMatrixInverse){//object可以是点或者bounding, box原为1*1*1,但可能形变
-    let frustum = new THREE.Frustum();
-    frustum.setFromProjectionMatrix(boxMatrixInverse) 
-     
-    if(object instanceof THREE.Box3){
-        return frustum.intersectsSphere(object)  
-    }else if(object instanceof Array){//点合集,先求Sphere setFromPoints
-        let sphere = new THREE.Sphere()
-        sphere.setFromPoints(object) 
-        return this.isInsideBox(sphere, boxMatrixInverse)
-
-    }else if(object instanceof THREE.Sphere){
-        return frustum.intersectsSphere(object)  
-    }else if(object instanceof THREE.Vector3){
-        return frustum.containsPoint(object)  
-    }
-
-    /* containsPoint: ƒ containsPoint( point ) 
-    intersectsBox: ƒ intersectsBox( box )
-    intersectsObject: ƒ intersectsObject( object )//geo
-    intersectsSphere: ƒ intersectsSphere( sphere )
-    intersectsSprite: ƒ intersectsSprite( sprite )
-     */
-
-} 
-
- 
-Utils.getIntersect = function (camera, meshes, pointer, raycaster) {
-    //获取鼠标和meshes交点
-    camera.updateMatrixWorld()
-    if(!raycaster){//getMouseIntersect
-        raycaster = new THREE.Raycaster()
-        var origin = new THREE.Vector3(pointer.x, pointer.y, -1).unproject(camera),
-        end = new THREE.Vector3(pointer.x, pointer.y, 1).unproject(camera)
-        var dir = end.sub(origin).normalize()
-        raycaster.set(origin, dir)
-    } 
-    
-    meshes.forEach(e=>{ 
-        raycaster.layers.enable(math.getBaseLog(e.layers.mask,2)) 
-    }) 
-    var n = raycaster.intersectObjects(meshes)
-    if (0 === n.length) return null
-    return n[0]
-} 
-
-
-
-

+ 0 - 1
src/utils/DrawUtil.js

@@ -8,7 +8,6 @@ import {LineMaterial} from "../../libs/three.js/lines/LineMaterial.js";
 //画线等函数--by 许钟文
 import {Features} from "../Features.js";
 
-
 var defaultColor = new THREE.Color(1,1,1);//config.applicationName == "zhiHouse" ? Colors.zhiBlue : Colors.lightGreen;
 
 var LineDraw = {

+ 2 - 3
src/utils/History.js

@@ -1,9 +1,8 @@
 
-import * as THREE from "../../libs/three.js/build/three.module.js";
+import {ExtendEventDispatcher} from "../custom/ExtendEventDispatcher.js";
 
 
-
-class History extends THREE.EventDispatcher{
+class History extends ExtendEventDispatcher{
     
     constructor(o){ 
         super()

+ 7 - 5
src/utils/PointCloudSM.js

@@ -1,7 +1,7 @@
 
 import * as THREE from "../../libs/three.js/build/three.module.js";
 
-export class PointCloudSM{//shadow material ?
+export class PointCloudSM{
 
 	constructor(potreeRenderer){
 
@@ -12,10 +12,10 @@ export class PointCloudSM{//shadow material ?
 			minFilter: THREE.LinearFilter,
 			magFilter: THREE.LinearFilter,
 			format: THREE.RGBAFormat,
-			type: THREE.FloatType, 
+			type: THREE.FloatType
 		});
 		this.target.depthTexture = new THREE.DepthTexture();
-		this.target.depthTexture.type = THREE.UnsignedIntType; 
+		this.target.depthTexture.type = THREE.UnsignedIntType;
 
 		//this.threeRenderer.setClearColor(0x000000, 1);
 		this.threeRenderer.setClearColor(0xff0000, 1);
@@ -24,8 +24,10 @@ export class PointCloudSM{//shadow material ?
 		//this.threeRenderer.clearTarget(this.target, true, true, true); 
 		{
 			const oldTarget = this.threeRenderer.getRenderTarget();
-			this.threeRenderer.setRenderTarget(this.target); 
-			//this.threeRenderer.clear(true, true, true); //救命,为什么iphoneX ios13.6执行这一句clear会崩溃?即使把target的大小改为1*1.
+
+			this.threeRenderer.setRenderTarget(this.target);
+			this.threeRenderer.clear(true, true, true);
+
 			this.threeRenderer.setRenderTarget(oldTarget);
 		}
 	}

+ 2 - 2
src/utils/SplitScreen.js

@@ -1,11 +1,11 @@
 import {View} from "../viewer/View.js";
 import Viewport from "../viewer/Viewport.js";
 import * as THREE from "../../libs/three.js/build/three.module.js";
-
+import {ExtendEventDispatcher} from "../custom/ExtendEventDispatcher.js";
 
  
 
-class SplitScreen extends THREE.EventDispatcher{
+class SplitScreen extends ExtendEventDispatcher{
     constructor (args = {}) {
 		super();
         

+ 18 - 72
src/viewer/PotreeRenderer.js

@@ -20,31 +20,11 @@ export class PotreeRenderer {
 		}
 	}
 
-	clearTargets(params){//add
-        const viewer = this.viewer;
-		const {renderer} = viewer;
-
-		const oldTarget = renderer.getRenderTarget();
-        
-        if(params.target){//add
-            renderer.setRenderTarget( params.target);
-            renderer.clear() 
-        }
-        if(params.rtEDL){
-            renderer.setRenderTarget( params.rtEDL);
-            renderer.clear() 
-        }else{
-            renderer.setRenderTarget( this.rtEDL );
-            renderer.clear( true, true, true );
-        }
-
-		/* renderer.setRenderTarget( this.rtRegular );
-		renderer.clear( true, true, false ); */
-
-		renderer.setRenderTarget(oldTarget);
+	clearTargets(){
+
 	}
 
-	clear(params={}){
+	clear(){
 		let {viewer, renderer} = this;
 
 
@@ -60,14 +40,11 @@ export class PotreeRenderer {
 		}else{
 			renderer.setClearColor(0x000000, 0);
 		}
-        
-        params.target || renderer.clear();
-        
+
 		renderer.clear();
-        this.clearTargets(params)
 	}
  
-	render(params={}){
+	render(params){
 		let {viewer, renderer} = this;
 
 		const camera = params.camera ? params.camera : viewer.scene.getActiveCamera();
@@ -75,8 +52,8 @@ export class PotreeRenderer {
 		viewer.dispatchEvent({type: "render.pass.begin",viewer: viewer});
 
 		const renderAreaSize = renderer.getSize(new THREE.Vector2());
-		const width = params.width ? params.width : params.viewport ? params.viewport[2] : renderAreaSize.x;
-		const height = params.height ? params.height : params.viewport ? params.viewport[3] : renderAreaSize.y;
+		const width = params.viewport ? params.viewport[2] : renderAreaSize.x;
+		const height = params.viewport ? params.viewport[3] : renderAreaSize.y;
 
 		// render skybox
 		if(viewer.background === "skybox"){
@@ -90,66 +67,35 @@ export class PotreeRenderer {
 			viewer.skybox.camera.updateProjectionMatrix();
 			renderer.render(viewer.skybox.scene, viewer.skybox.camera);
 		}else if(viewer.background === "gradient"){
-            
-            if(params.target){//add
-                renderer.setRenderTarget(params.target)
-                renderer.render(viewer.scene.sceneBG, viewer.scene.cameraBG);
-                renderer.setRenderTarget(null)                
-            }else{ 
-                renderer.render(viewer.scene.sceneBG, viewer.scene.cameraBG);
-            }
-        
-        }
+			renderer.render(viewer.scene.sceneBG, viewer.scene.cameraBG);
+		}
 		
 		for(let pointcloud of this.viewer.scene.pointclouds){
 			const {material} = pointcloud;
 			material.useEDL = false;
 		}
-		 
-                    
-		viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, params.target || null, {
+		
+		viewer.pRenderer.render(viewer.scene.scenePointCloud, camera, null, {
 			clipSpheres: viewer.scene.volumes.filter(v => (v instanceof Potree.SphereVolume)),
 		});
 		
-        
-        
 		// render scene
-		viewer.dispatchEvent({type: "render.pass.scene",viewer: viewer});
-		renderer.setRenderTarget(params.target ? params.target : null);//add
-        renderer.render(viewer.scene.scene, camera);
+		renderer.render(viewer.scene.scene, camera);
 
-        
+		viewer.dispatchEvent({type: "render.pass.scene",viewer: viewer});
 		
-        renderer.render(viewer.scene.sceneOverlay, camera);// add   透明贴图层
-        
-        
-        renderer.clearDepth();
-		viewer.transformationTool.update();
-        
-        
-        if(!params.target){ 
-            
-            //测量线
-            viewer.dispatchEvent({type: "render.pass.perspective_overlay", viewer: viewer, camera});
-            viewer.renderer.render(viewer.overlay, camera);//从 viewer.renderDefault搬过来,为了reticule不遮住测量线
-            
-        } 
-        
-        
 		viewer.clippingTool.update();
-        
 		renderer.render(viewer.clippingTool.sceneMarker, viewer.scene.cameraScreenSpace); //viewer.scene.cameraScreenSpace);
 		renderer.render(viewer.clippingTool.sceneVolume, camera);
 
 		renderer.render(viewer.controls.sceneControls, camera);
-		viewer.renderer.render(viewer.transformationTool.scene, camera);
-		//viewer.renderer.render(viewer.transformationTool.scene, camera);
-        
-          
-        
 		
+		renderer.clearDepth();
 		
- 
+		viewer.transformationTool.update();
+		
+		viewer.dispatchEvent({type: "render.pass.perspective_overlay",viewer: viewer});
+
 		// renderer.render(viewer.controls.sceneControls, camera);
 		// renderer.render(viewer.clippingTool.sceneVolume, camera);
 		// renderer.render(viewer.transformationTool.scene, camera);

+ 5 - 7
src/viewer/PropertyPanels/PropertiesPanel.js

@@ -3,9 +3,9 @@ import * as THREE from "../../../libs/three.js/build/three.module.js";
 import {Utils} from "../../utils.js";
 import {PointCloudTree} from "../../PointCloudTree.js";
 import {Annotation} from "../../Annotation.js";
-import {Measure} from "../../objects/tool/Measure.js";
-import {Profile} from "../../objects/tool/Profile.js";
-import {Volume, BoxVolume, SphereVolume} from "../../objects/tool/Volume.js";
+import {Measure} from "../../utils/Measure.js";
+import {Profile} from "../../utils/Profile.js";
+import {Volume, BoxVolume, SphereVolume} from "../../utils/Volume.js";
 import {CameraAnimation} from "../../modules/CameraAnimation/CameraAnimation.js";
 import {PointSizeType, PointShape, ElevationGradientRepeat} from "../../defines.js";
 import {Gradients} from "../../materials/Gradients.js";
@@ -440,8 +440,8 @@ export class PropertiesPanel{
 						}
 					});
 				} else if(attribute){
-					let [min, max] = attribute.range;
-        
+					const [min, max] = attribute.range;
+
 					let selectedRange = material.getRange(attribute.name);
 
 					if(!selectedRange){
@@ -449,8 +449,6 @@ export class PropertiesPanel{
 					}
 
 					let minMaxAreNumbers = typeof min === "number" && typeof max === "number";
-                    /* min = 0 ;max =  50
-                    selectedRange[0] =min; selectedRange[1] = max;  */
 
 					if(minMaxAreNumbers){
 						panel.find('#sldExtraRange').slider({

+ 1 - 1
src/viewer/PropertyPanels/VolumePanel.js

@@ -1,7 +1,7 @@
 
 import * as THREE from "../../../libs/three.js/build/three.module.js";
 import {Utils} from "../../utils.js";
-import {Volume, BoxVolume, SphereVolume} from "../../objects/tool/Volume.js";
+import {Volume, BoxVolume, SphereVolume} from "../../utils/Volume.js";
 
 import {MeasurePanel} from "./MeasurePanel.js";
 

+ 0 - 23
src/viewer/SaveProject.js

@@ -101,29 +101,6 @@ function createCameraAnimationData(animation){
 }
 
 function createMeasurementData(measurement){
-
-	/* const data = {
-		uuid: measurement.uuid,
-		name: measurement.name,
-        measureType:measurement.measureType, //add
-        direction:measurement.direction,//add
-        minMarkers:measurement.minMarkers,//add
-        maxMarkers: measurement.maxMarkers,//add
-        isRect: measurement.isRect,//add
-        faceDirection: measurement.faceDirection,//add
-        
-		points: measurement.points.map(p => p.position.toArray()),
-		showDistances: measurement.showDistances,
-		showCoordinates: measurement.showCoordinates,
-		showArea: measurement.showArea,
-		closed: measurement.closed,
-		showAngles: measurement.showAngles,
-		showHeight: measurement.showHeight,
-		showCircle: measurement.showCircle,
-		showAzimuth: measurement.showAzimuth,
-		showEdges: measurement.showEdges,
-		color: measurement.color.toArray(),
-	}; */
     const data = {
 		uuid: measurement.uuid,
 		name: measurement.name,

+ 2 - 1
src/viewer/Scene.js

@@ -5,8 +5,9 @@ import {CameraMode} from "../defines.js";
 import {View} from "./View.js";
 import {Utils} from "../utils.js"; 
 import Axis from '../objects/Axis.js'
+import { EventDispatcher } from "../EventDispatcher.js";
 
-export class Scene extends THREE.EventDispatcher{
+export class Scene extends EventDispatcher{
 
 	constructor(){
 		super();

+ 2 - 1
src/viewer/View.js

@@ -2,10 +2,11 @@ import * as THREE from "../../libs/three.js/build/three.module.js";
 import {transitions, easing, lerp} from '../utils/transitions.js'
 import math from '../utils/math.js'
 import Common from '../utils/Common.js' 
+import { EventDispatcher } from "../EventDispatcher.js";
 
 let sid = 0
  
-export class View extends THREE.EventDispatcher{
+export class View extends EventDispatcher{
 	constructor () {
         super()
 		this.position = new THREE.Vector3(0, 0, 0);

+ 2 - 3
src/viewer/map.js

@@ -100,11 +100,10 @@ export class MapView{
 	}
 
 	init () {
-
 		if(typeof ol === "undefined"){
 			return;
 		}
-
+		debugger;
 		this.elMap = $('#potree_map');
 		this.elMap.draggable({ handle: $('#potree_map_header') });
 		this.elMap.resizable();
@@ -656,7 +655,7 @@ export class MapView{
 		if (!pointcloud) {
 			return;
 		}
-
+		debugger;
 		/* if (!pointcloud.projection) {
 			return;
 		}

+ 2 - 2
src/viewer/map/Map.js

@@ -1,5 +1,5 @@
 import * as THREE from "../../../libs/three.js/build/three.module.js";
-
+import { ExtendEventDispatcher } from "../../custom/ExtendEventDispatcher.js";
 
 
 
@@ -42,7 +42,7 @@ const MAX_VERTICAL_DIST_TO_BEST = 1
 //高德坐标拾取工具 : https://lbs.amap.com/tools/picker
 
 
-export class MapLayer extends THREE.EventDispatcher{ // 包括了 MapLayerBase SceneLayer
+export class MapLayer extends ExtendEventDispatcher{ // 包括了 MapLayerBase SceneLayer
     constructor(viewer_, viewport){
         super()
         this.sceneGroup = new THREE.Object3D;

+ 6 - 14
src/viewer/profile.js

@@ -3,7 +3,8 @@ import * as THREE from "../../libs/three.js/build/three.module.js";
 import {Utils} from "../utils.js";
 import {Points} from "../Points.js";
 import {CSVExporter} from "../exporter/CSVExporter.js";
-import {LASExporter} from "../exporter/LASExporter.js"; 
+import {LASExporter} from "../exporter/LASExporter.js";
+import { EventDispatcher } from "../EventDispatcher.js";
 import {PointCloudTree} from "../PointCloudTree.js";
 import {Renderer} from "../PotreeRenderer.js";
 import {PointCloudMaterial} from "../materials/PointCloudMaterial.js";
@@ -228,7 +229,7 @@ class ProfileFakeOctree extends PointCloudTree{
 
 }
 
-export class ProfileWindow extends THREE.EventDispatcher {
+export class ProfileWindow extends EventDispatcher {
 	constructor (viewer) {
 		super();
 
@@ -644,19 +645,10 @@ export class ProfileWindow extends THREE.EventDispatcher {
 		}
 
 		this.camera = new THREE.OrthographicCamera(-1000, 1000, 1000, -1000, -1000, 1000);
-		/*  */
+		this.camera.up.set(0, 0, 1);
+		this.camera.rotation.order = "ZXY";
+		this.camera.rotation.x = Math.PI / 2.0;
 	
-        if(window.axisYup){
-
-
-        }else{
-            this.camera.up.set(0, 0, 1);
-            this.camera.rotation.order = "ZXY";
-            this.camera.rotation.x = Math.PI / 2.0;
-
-        }
-
-
 
 		this.scene = new THREE.Scene();
 		this.profileScene = new THREE.Scene();

+ 10 - 4
src/viewer/viewerBase.js

@@ -2,9 +2,9 @@
 import * as THREE from "../../libs/three.js/build/three.module.js"; 
 
 import Common from '../utils/Common.js'
- 
+import { ExtendEventDispatcher } from "../custom/ExtendEventDispatcher.js";
 
-export class ViewerBase extends THREE.EventDispatcher{
+export class ViewerBase extends ExtendEventDispatcher{
     constructor(domElement, args = {}){
         super()
         this.name = args.name
@@ -199,8 +199,14 @@ export class ViewerBase extends THREE.EventDispatcher{
     setSize(width, height, devicePixelRatio, onlyForTarget){ 
         //console.log('setSize', width) 
         if(!onlyForTarget){//onlyForTarget表示不更改当前renderer,只是为了rendertarget才要改变viewport
-            this.renderer.setSize(width, height, null, devicePixelRatio); // resize之后会自动clear(似乎因为setScissor ),所以一定要立刻绘制,所以setSize要在cameraChanged、update之前
-        }
+            //xst修改
+			//this.renderer.setSize(width, height, null, devicePixelRatio); // resize之后会自动clear(似乎因为setScissor ),所以一定要立刻绘制,所以setSize要在cameraChanged、update之前
+			//xst修改
+			//this.renderer.setPixelRatio (devicePixelRatio); 
+			//this.renderer.setSize(width, height); // resize之后会自动clear(似乎因为setScissor ),所以一定要立刻绘制,所以setSize要在cameraChanged、update之前
+			//xst修改
+			this.renderer.setDrawingBufferSize( width, height, devicePixelRatio )
+		}
        
         this.composer && this.composer.setSize(width, height);