Ver código fonte

diff钟文最新代码

bill 2 anos atrás
pai
commit
25e315bbc7
100 arquivos alterados com 13977 adições e 3184 exclusões
  1. BIN
      .DS_Store
  2. BIN
      4dkk到navvis坐标对应图.png
  3. 0 3
      README.md
  4. 5 5
      docs/RELEASE.MD
  5. BIN
      docs/sponsors/unstruk.png
  6. 114 0
      examples/360-test.html
  7. 79 0
      examples/4dkk.html
  8. 0 1
      examples/ca13.html
  9. 79 0
      examples/pano.html
  10. 317 262
      examples/resources/sorvilier.json
  11. 448 0
      examples/resources/sorvilier2.json
  12. 1 1
      examples/showcase/santorini.html
  13. 12 1
      gulpfile.js
  14. 22 22
      libs/jstree/LICENSE-MIT
  15. 1 1
      libs/other/stats.js
  16. 2 2
      libs/proj4/test.html
  17. 0 21
      libs/stats.js/LICENSE
  18. 0 56
      libs/stats.js/README.md
  19. 0 179
      libs/stats.js/stats.js
  20. 0 5
      libs/stats.js/stats.min.js
  21. 0 171
      libs/stats.js/stats.module.js
  22. 119 88
      libs/three.js/build/three.module.js
  23. 856 856
      libs/three.js/extra/lines.js
  24. 1 0
      libs/three.js/libs/ktx-parse.module.js
  25. 7 12
      libs/three.js/lines/Line2.js
  26. 22 40
      libs/three.js/lines/LineGeometry.js
  27. 649 136
      libs/three.js/lines/LineMaterial.js
  28. 274 128
      libs/three.js/lines/LineSegments2.js
  29. 76 95
      libs/three.js/lines/LineSegmentsGeometry.js
  30. 1 1
      libs/three.js/loaders/DDSLoader.js
  31. 117 170
      libs/three.js/loaders/DRACOLoader.js
  32. 92 35
      libs/three.js/loaders/GLTFLoader.js
  33. 481 499
      libs/three.js/loaders/KTX2Loader.js
  34. 9 8
      libs/three.js/loaders/MTLLoader.js
  35. 2 2
      libs/three.js/loaders/OBJLoader.js
  36. 52 0
      libs/three.js/loaders/draco/draco_decoder.js
  37. BIN
      libs/three.js/loaders/draco/draco_decoder.wasm
  38. 104 0
      libs/three.js/loaders/draco/draco_wasm_wrapper.js
  39. 21 0
      libs/three.js/loaders/ktx/basis_transcoder.js
  40. BIN
      libs/three.js/loaders/ktx/basis_transcoder.wasm
  41. 102 0
      libs/utils/WorkerPool.js
  42. 33 0
      main.js
  43. BIN
      note/images360.updateCube笔记.jpg
  44. 16 0
      note/note.js
  45. BIN
      note/旋转平移中心(数据集校准).png
  46. 7437 19
      package-lock.json
  47. 8 2
      package.json
  48. BIN
      resources/images/rotate-cursor.cur
  49. BIN
      resources/images/rotate-cursor.png
  50. BIN
      resources/textures/End_128.png
  51. BIN
      resources/textures/crosshair.png
  52. BIN
      resources/textures/explode.png
  53. BIN
      resources/textures/fire.png
  54. BIN
      resources/textures/icon-explode.png
  55. BIN
      resources/textures/icon-fire.png
  56. BIN
      resources/textures/icon-smoke.png
  57. BIN
      resources/textures/map_instruction_start_route.png
  58. BIN
      resources/textures/map_instruction_target_reached.png
  59. BIN
      resources/textures/map_marker.png
  60. BIN
      resources/textures/marker.png
  61. BIN
      resources/textures/pano_instruction_bottomMarker.png
  62. BIN
      resources/textures/pano_instruction_start_route.png
  63. BIN
      resources/textures/pano_instruction_target_reached.png
  64. BIN
      resources/textures/pic_location128.png
  65. BIN
      resources/textures/pic_location64.png
  66. BIN
      resources/textures/pic_point32.png
  67. BIN
      resources/textures/pic_point64.png
  68. BIN
      resources/textures/pic_point_s32.png
  69. BIN
      resources/textures/reticule-256x256.png
  70. BIN
      resources/textures/reticule_cross_hair.png
  71. BIN
      resources/textures/rotation_circle.png
  72. BIN
      resources/textures/routePoint_map_activeFloor.png
  73. BIN
      resources/textures/routePoint_map_fsna.png
  74. BIN
      resources/textures/routePoint_map_inactiveFloor.png
  75. BIN
      resources/textures/routePoint_panorama.png
  76. BIN
      resources/textures/smokeparticle.png
  77. BIN
      resources/textures/whiteCircle.png
  78. 69 36
      rollup.config.js
  79. 3 3
      src/Actions.js
  80. 10 5
      src/Annotation.js
  81. 1 1
      src/Enum.js
  82. 54 10
      src/EventDispatcher.js
  83. 21 0
      src/Features.js
  84. 2 1
      src/KeyCodes.js
  85. 30 2
      src/LRU.js
  86. 1065 45
      src/PointCloudOctree.js
  87. 28 14
      src/PointCloudOctreeGeometry.js
  88. 3 4
      src/PointCloudTree.js
  89. 224 24
      src/Potree.js
  90. 197 28
      src/PotreeRenderer.js
  91. 48 27
      src/Potree_update_visibility.js
  92. 0 146
      src/TextSprite.js
  93. 121 5
      src/defines.js
  94. 1 1
      src/exporter/DXFExporter.js
  95. 1 1
      src/exporter/GeoJSONExporter.js
  96. 437 0
      src/extensions/three.shim.js
  97. 19 2
      src/loader/BinaryLoader.js
  98. 1 1
      src/loader/GeoPackageLoader.js
  99. 83 7
      src/loader/POCLoader.js
  100. 0 0
      src/loader/PointAttributes.js

BIN
.DS_Store


BIN
4dkk到navvis坐标对应图.png


+ 0 - 3
README.md

@@ -481,9 +481,6 @@ We would like to thank our sponsors for their financial contributions that keep
 			€ 1,000+
 		</th>
 		<td>
-			<a href="https://www.unstruk.com/">
-				<img src="docs/sponsors/unstruk.png" height="33"/> &nbsp;
-			</a>
 			<a href="http://scanx.com/">
 				<img src="docs/sponsors/scanx.jpg" height="33"/> &nbsp;
 			</a>

+ 5 - 5
docs/RELEASE.MD

@@ -1,5 +1,5 @@
-
-# On Release
-
-* Update version in Potree.js
-
+
+# On Release
+
+* Update version in Potree.js
+

BIN
docs/sponsors/unstruk.png


+ 114 - 0
examples/360-test.html

@@ -0,0 +1,114 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="utf-8">
+	<meta name="description" content="">
+	<meta name="author" content="">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+	<title>Potree Viewer</title>
+
+	<link rel="stylesheet" type="text/css" href="../../build/potree/potree.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jquery-ui/jquery-ui.min.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/openlayers3/ol.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/spectrum/spectrum.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jstree/themes/mixed/style.css">
+</head>
+
+<body>
+	<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
+	<script src="../../libs/spectrum/spectrum.js"></script>
+	<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
+	<script src="../../libs/other/BinaryHeap.js"></script>
+	<script src="../../libs/tween/tween.min.js"></script>
+	<script src="../../libs/d3/d3.js"></script>
+	<script src="../../libs/proj4/proj4.js"></script>
+	<script src="../../libs/openlayers3/ol.js"></script>
+	<script src="../../libs/i18next/i18next.js"></script>
+	<script src="../../libs/jstree/jstree.js"></script>
+	<script src="../../build/potree/potree.js"></script>
+	<script src="../../libs/plasio/js/laslaz.js"></script>
+	
+	
+	<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
+		<div id="potree_render_area" style="background-image: url('../../build/potree/resources/images/background.jpg');">
+		
+		</div>
+		<div id="potree_sidebar_container"> </div>
+	</div>
+	
+	<script type="module">
+
+	import * as THREE from "../libs/three.js/build/three.module.js";
+	
+		window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
+		
+		viewer.setEDLEnabled(true);
+		viewer.setFOV(60);
+		viewer.setPointBudget(2_000_000);
+		viewer.loadSettingsFromURL();
+		viewer.setDescription(`Mobile LIDAR with 360 degree image overlays. 
+		Click on a sphere to enter 360 view. Click "unfocus" to leave 360 view. <br>
+		Point cloud courtesy of <a href="http://www.helimap.com/">Helimap System SA</a>. Images were downsized for this online demo; Original size is 8000x400.`);
+		
+		viewer.loadGUI(() => {
+			viewer.setLanguage('en');
+			$("#menu_appearance").next().show();
+			viewer.toggleSidebar();
+		});
+		
+		// Load and add point cloud to scene
+        var path = "http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/360/MLS_drive1/cloud.js"
+        //var path = 'https://laser.4dkankan.com/data/t-SNZRfWt/data/chunk1/webcloud/cloud.js' 
+		Potree.loadPointCloud(path, "MLS", e => {
+			let scene = viewer.scene;
+			let pointcloud = e.pointcloud;
+			
+			let material = pointcloud.material;
+			material.size = 0.5;
+			material.minSize = 2.0;
+			material.pointSizeType = Potree.PointSizeType.ADAPTIVE;
+			material.shape = Potree.PointShape.SQUARE;
+			material.activeAttributeName = "rgba";
+			
+			scene.addPointCloud(pointcloud);
+
+			viewer.scene.view.setView(
+				[2652381.103, 1249049.447, 411.636],
+				[2652364.407, 1249077.205, 399.696],
+			);
+            //viewer.scene.view.setView(
+            //    pointcloud.position.clone().add(new THREE.Vector3(0,10,3)),
+            //    pointcloud.position.toArray()
+            //)
+			run(pointcloud.boundingBox, pointcloud.position);
+		});
+
+		async function run(boundingBox, position){
+            proj4.defs("EPSG:31468", "+proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +units=m +no_defs");
+   
+			//proj4.defs("WGS84", "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs");
+			proj4.defs("pointcloud", viewer.getProjection());
+			let transform = proj4("WGS84", "pointcloud");
+
+			let params = {
+				transform: transform,
+                boundingBox, 
+                position
+			};
+
+			// this file contains coordinates, orientation and filenames of the images:
+			// http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/360/Drive2_selection/coordinates.txt
+			Potree.Images360Loader.load("http://5.9.65.151/mschuetz/potree/resources/pointclouds/helimap/360/Drive2_selection", viewer, params).then( images => {
+				viewer.scene.add360Images(images);
+			});
+
+			viewer.mapView.showSources(false);
+		}
+
+
+		
+	</script>
+	
+	
+  </body>
+</html>

+ 79 - 0
examples/4dkk.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="utf-8">
+	<meta name="description" content="">
+	<meta name="author" content="">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+	<title>Potree Viewer</title>
+
+	<link rel="stylesheet" type="text/css" href="../../build/potree/potree.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jquery-ui/jquery-ui.min.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/openlayers3/ol.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/spectrum/spectrum.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jstree/themes/mixed/style.css">
+</head>
+
+<body>
+	<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
+	<script src="../../libs/spectrum/spectrum.js"></script>
+	<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
+	<script src="../../libs/other/BinaryHeap.js"></script>
+	<script src="../../libs/tween/tween.min.js"></script>
+	<script src="../../libs/d3/d3.js"></script>
+	<script src="../../libs/proj4/proj4.js"></script> 
+	
+    
+	<script src="../../libs/openlayers3/ol.js"></script>
+	<script src="../../libs/i18next/i18next.js"></script>
+	<script src="../../libs/jstree/jstree.js"></script>
+	<script src="../../build/potree/potree.js"></script>
+	<script src="../../libs/plasio/js/laslaz.js"></script>
+	
+	
+	<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
+		<div id="potree_render_area" style="background-image: url('../../build/potree/resources/images/background.jpg');">
+            
+		</div>
+		<div id="potree_sidebar_container"> </div>
+	</div>
+	
+	<script type="module">
+
+	import * as THREE from "../libs/three.js/build/three.module.js";
+    import browser from '../src/utils/browser.js' //这里必须加.js
+     
+        /*var number = window.location.href.substring(window.location.href.indexOf("=") + 1);
+        if (number.indexOf("&") != -1) {
+            number = number.substring(0, number.indexOf("&"));
+        }
+        if (number.indexOf("#") != -1) {
+            number = number.substring(0, number.indexOf("#"));
+        }*/
+        
+        var number = browser.urlHasValue('m',true);
+        console.log(number)
+        Potree.start(document.getElementById("potree_render_area"),null, number);
+        
+          
+		/*
+        数据集校准 平移后
+        单个数据集:
+        
+        点云的本地位置是一样的 。说明:单个数据集时点云最终平移量为0,同理漫游点也是 
+        多个数据集时,参照为第一个dataset,见GeoTransformationService.setOffsetFromGlobal。所以第一个数据集的位置为000,其他的不是。因此本地坐标是不固定的,只有指定了参考数据集才能确定,如果去掉第一个数据集下一次显示的坐标就不同了,但是不影响相对位置所以看起来一样。
+        (注意:navvis平移后要刷新location才生效。)
+        
+        
+        var view = window.IV.getMainView() 
+        view.ImageService.images.forEach(e=>console.log(e.id + ": "+e.location.toArray()))
+        
+        
+        images360.panos.forEach(e=>console.log(e.id + ": "+e.position.toArray()))
+        */        
+		
+	</script>
+	
+	
+  </body>
+</html>

+ 0 - 1
examples/ca13.html

@@ -27,7 +27,6 @@
 	<script src="../libs/jstree/jstree.js"></script>
 	<script src="../build/potree/potree.js"></script>
 	<script src="../libs/plasio/js/laslaz.js"></script>
-	<script src="../libs/other/stats.js"></script>
 	
 	<!-- INCLUDE ADDITIONAL DEPENDENCIES HERE -->
 	<!-- INCLUDE SETTINGS HERE -->

+ 79 - 0
examples/pano.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+	<meta charset="utf-8">
+	<meta name="description" content="">
+	<meta name="author" content="">
+	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
+	<title>Potree Viewer</title>
+
+	<link rel="stylesheet" type="text/css" href="../../build/potree/potree.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jquery-ui/jquery-ui.min.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/openlayers3/ol.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/spectrum/spectrum.css">
+	<link rel="stylesheet" type="text/css" href="../../libs/jstree/themes/mixed/style.css">
+</head>
+
+<body>
+	<script src="../../libs/jquery/jquery-3.1.1.min.js"></script>
+	<script src="../../libs/spectrum/spectrum.js"></script>
+	<script src="../../libs/jquery-ui/jquery-ui.min.js"></script>
+	<script src="../../libs/other/BinaryHeap.js"></script>
+	<script src="../../libs/tween/tween.min.js"></script>
+	<script src="../../libs/d3/d3.js"></script>
+	<script src="../../libs/proj4/proj4.js"></script> 
+	
+    
+	<script src="../../libs/openlayers3/ol.js"></script>
+	<script src="../../libs/i18next/i18next.js"></script>
+	<script src="../../libs/jstree/jstree.js"></script>
+	<script src="../../build/potree/potree.js"></script>
+	<script src="../../libs/plasio/js/laslaz.js"></script>
+	
+	
+	<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
+		<div id="potree_render_area" style="background-image: url('../../build/potree/resources/images/background.jpg');">
+            
+		</div>
+		<div id="potree_sidebar_container"> </div>
+	</div>
+	
+	<script type="module">
+
+	import * as THREE from "../libs/three.js/build/three.module.js";
+    import browser from '../src/utils/browser.js' //这里必须加.js
+     
+        /*var number = window.location.href.substring(window.location.href.indexOf("=") + 1);
+        if (number.indexOf("&") != -1) {
+            number = number.substring(0, number.indexOf("&"));
+        }
+        if (number.indexOf("#") != -1) {
+            number = number.substring(0, number.indexOf("#"));
+        }*/
+        
+        var number = browser.urlHasValue('m',true);
+        console.log(number)
+        Potree.panoEditStart(document.getElementById("potree_render_area"),null, number);
+        
+          
+		/*
+        数据集校准 平移后
+        单个数据集:
+        
+        点云的本地位置是一样的 。说明:单个数据集时点云最终平移量为0,同理漫游点也是 
+        多个数据集时,参照为第一个dataset,见GeoTransformationService.setOffsetFromGlobal。所以第一个数据集的位置为000,其他的不是。因此本地坐标是不固定的,只有指定了参考数据集才能确定,如果去掉第一个数据集下一次显示的坐标就不同了,但是不影响相对位置所以看起来一样。
+        (注意:navvis平移后要刷新location才生效。)
+        
+        
+        var view = window.IV.getMainView() 
+        view.ImageService.images.forEach(e=>console.log(e.id + ": "+e.location.toArray()))
+        
+        
+        images360.panos.forEach(e=>console.log(e.id + ": "+e.position.toArray()))
+        */        
+		
+	</script>
+	
+	
+  </body>
+</html>

+ 317 - 262
examples/resources/sorvilier.json

@@ -1,448 +1,503 @@
 {
-	"type": "Potree",
-	"version": 1.7,
-	"settings": {
-		"pointBudget": 1000000,
-		"fov": 60,
-		"edlEnabled": true,
-		"edlRadius": 1.4,
-		"edlStrength": 0.4,
-		"background": "gradient",
-		"minNodeSize": 30,
-		"showBoundingBoxes": false
+	type: 'Potree',
+	version: 1.7,
+	settings: {
+		pointBudget: 1000000,
+		fov: 60,
+		edlEnabled: true,
+		edlRadius: 1.4,
+		edlStrength: 0.4,
+		background: 'gradient',
+		minNodeSize: 30,
+		showBoundingBoxes: false,
 	},
-	"view": {
-		"position": [
-			589974.341,
-			231698.397,
-			986.146
+	view: {
+		position: [
+			590044.2281658746,
+			231687.47696911512,
+			967.1205078136775,
+		],
+		target: [
+			590043.3985338517,
+			231685.8457774173,
+			966.1351601839054,
 		],
-		"target": [
-			589851.587,
-			231428.213,
-			715.634
-		]
 	},
-	"classification": {
-		"0": {
-			"visible": true,
-			"name": "never classified",
-			"color": [
+	classification: {
+		'0': {
+			visible: true,
+			name: 'never classified',
+			color: [
 				0.5,
 				0.5,
 				0.5,
-				1
-			]
+				1,
+			],
 		},
-		"1": {
-			"visible": true,
-			"name": "unclassified",
-			"color": [
+		'1': {
+			visible: true,
+			name: 'unclassified',
+			color: [
 				0.5,
 				0.5,
 				0.5,
-				1
-			]
+				1,
+			],
 		},
-		"2": {
-			"visible": true,
-			"name": "ground",
-			"color": [
+		'2': {
+			visible: true,
+			name: 'ground',
+			color: [
 				0.63,
 				0.32,
 				0.18,
-				1
-			]
+				1,
+			],
 		},
-		"3": {
-			"visible": true,
-			"name": "low vegetation",
-			"color": [
+		'3': {
+			visible: true,
+			name: 'low vegetation',
+			color: [
 				0,
 				1,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"4": {
-			"visible": true,
-			"name": "medium vegetation",
-			"color": [
+		'4': {
+			visible: true,
+			name: 'medium vegetation',
+			color: [
 				0,
 				0.8,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"5": {
-			"visible": true,
-			"name": "high vegetation",
-			"color": [
+		'5': {
+			visible: true,
+			name: 'high vegetation',
+			color: [
 				0,
 				0.6,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"6": {
-			"visible": true,
-			"name": "building",
-			"color": [
+		'6': {
+			visible: true,
+			name: 'building',
+			color: [
 				1,
 				0.66,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"7": {
-			"visible": true,
-			"name": "low point(noise)",
-			"color": [
+		'7': {
+			visible: true,
+			name: 'low point(noise)',
+			color: [
 				1,
 				0,
 				1,
-				1
-			]
+				1,
+			],
 		},
-		"8": {
-			"visible": true,
-			"name": "key-point",
-			"color": [
+		'8': {
+			visible: true,
+			name: 'key-point',
+			color: [
 				1,
 				0,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"9": {
-			"visible": true,
-			"name": "water",
-			"color": [
+		'9': {
+			visible: true,
+			name: 'water',
+			color: [
 				0,
 				0,
 				1,
-				1
-			]
+				1,
+			],
 		},
-		"12": {
-			"visible": true,
-			"name": "overlap",
-			"color": [
+		'12': {
+			visible: true,
+			name: 'overlap',
+			color: [
 				1,
 				1,
 				0,
-				1
-			]
+				1,
+			],
 		},
-		"DEFAULT": {
-			"visible": true,
-			"name": "default",
-			"color": [
+		DEFAULT: {
+			visible: true,
+			name: 'default',
+			color: [
 				0.3,
 				0.6,
 				0.6,
-				0.5
-			]
-		}
+				0.5,
+			],
+		},
 	},
-	"pointclouds": [
+	pointclouds: [
 		{
-			"name": "sigeom.sa",
-			"url": "../pointclouds/vol_total/cloud.js",
-			"position": [
+			name: 'sigeom.sa',
+			url: '../pointclouds/vol_total/cloud.js',
+			position: [
 				589500,
 				231300,
-				722.505
+				722.505,
 			],
-			"rotation": [
+			rotation: [
 				0,
 				0,
 				0,
-				"XYZ"
+				'XYZ',
 			],
-			"scale": [
+			scale: [
+				1,
 				1,
 				1,
-				1
 			],
-			"activeAttributeName": "rgba"
-		}
+			material: {
+				activeAttributeName: 'rgba',
+				ranges: [
+					{
+						name: 'elevationRange',
+						value: [
+							722.564,
+							789.921,
+						],
+					},
+					{
+						name: 'intensityRange',
+						value: [
+							Infinity,
+							-Infinity,
+						],
+					},
+				],
+				size: 1,
+				minSize: 2,
+				pointSizeType: 'FIXED',
+				matcap: 'matcap.jpg',
+			},
+		},
 	],
-	"measurements": [
+	measurements: [
 		{
-			"uuid": "CCFEDDB1-7CEE-4B2C-BBFD-64405DED63C3",
-			"name": "Measure_0",
-			"points": [
+			uuid: 'CCFEDDB1-7CEE-4B2C-BBFD-64405DED63C3',
+			name: 'Measure_0',
+			points: [
 				[
 					589803.18,
 					231357.35,
-					745.38
+					745.38,
 				],
 				[
 					589795.74,
 					231323.42,
-					746.21
+					746.21,
 				],
 				[
 					589822.5,
 					231315.9,
-					744.45
-				]
-			],
-			"showDistances": true,
-			"showCoordinates": false,
-			"showArea": false,
-			"closed": false,
-			"showAngles": false,
-			"showHeight": false,
-			"showEdges": true,
-			"color": [
+					744.45,
+				],
+			],
+			showDistances: true,
+			showCoordinates: false,
+			showArea: false,
+			closed: false,
+			showAngles: false,
+			showHeight: false,
+			showEdges: true,
+			color: [
 				1,
 				0,
-				0
-			]
+				0,
+			],
 		},
 		{
-			"uuid": "92086379-896A-4608-9584-855A04B915D0",
-			"name": "Angle Sample",
-			"points": [
+			uuid: '92086379-896A-4608-9584-855A04B915D0',
+			name: 'Angle Sample',
+			points: [
 				[
 					589866.11,
 					231372.25,
-					737.41
+					737.41,
 				],
 				[
 					589842.15,
 					231366.82,
-					743.61
+					743.61,
 				],
 				[
 					589860.61,
 					231348.01,
-					740.33
-				]
-			],
-			"showDistances": false,
-			"showCoordinates": false,
-			"showArea": false,
-			"closed": true,
-			"showAngles": true,
-			"showHeight": false,
-			"showEdges": true,
-			"color": [
+					740.33,
+				],
+			],
+			showDistances: false,
+			showCoordinates: false,
+			showArea: false,
+			closed: true,
+			showAngles: true,
+			showHeight: false,
+			showEdges: true,
+			color: [
 				1,
 				0,
-				0
-			]
+				0,
+			],
 		},
 		{
-			"uuid": "D62705BF-C151-49FD-991B-9CEFD223FAFB",
-			"name": "Canopy",
-			"points": [
+			uuid: 'D62705BF-C151-49FD-991B-9CEFD223FAFB',
+			name: 'Canopy',
+			points: [
 				[
 					589853.73,
 					231300.24,
-					775.48
-				]
-			],
-			"showDistances": false,
-			"showCoordinates": true,
-			"showArea": false,
-			"closed": true,
-			"showAngles": false,
-			"showHeight": false,
-			"color": [
+					775.48,
+				],
+			],
+			showDistances: false,
+			showCoordinates: true,
+			showArea: false,
+			closed: true,
+			showAngles: false,
+			showHeight: false,
+			color: [
 				1,
 				0,
-				0
-			]
+				0,
+			],
 		},
 		{
-			"uuid": "19D13159-B509-4CB0-8CA2-A58FB60B6D50",
-			"name": "Tree Height",
-			"points": [
+			uuid: '19D13159-B509-4CB0-8CA2-A58FB60B6D50',
+			name: 'Tree Height',
+			points: [
 				[
 					589849.69,
 					231327.26,
-					766.32
+					766.32,
 				],
 				[
 					589840.96,
 					231329.53,
-					744.52
-				]
-			],
-			"showDistances": false,
-			"showCoordinates": false,
-			"showArea": false,
-			"closed": false,
-			"showAngles": false,
-			"showHeight": true,
-			"showEdges": true,
-			"color": [
+					744.52,
+				],
+			],
+			showDistances: false,
+			showCoordinates: false,
+			showArea: false,
+			closed: false,
+			showAngles: false,
+			showHeight: true,
+			showEdges: true,
+			color: [
 				1,
 				0,
-				0
-			]
+				0,
+			],
 		},
 		{
-			"uuid": "E46A0D60-EA59-4589-88AA-788DE0A91DF4",
-			"name": "Area",
-			"points": [
+			uuid: 'E46A0D60-EA59-4589-88AA-788DE0A91DF4',
+			name: 'Area',
+			points: [
 				[
 					589899.37,
 					231300.16,
-					750.25
+					750.25,
 				],
 				[
 					589874.6,
 					231326.06,
-					743.4
+					743.4,
 				],
 				[
 					589911.61,
 					231352.57,
-					743.58
+					743.58,
 				],
 				[
 					589943.5,
 					231300.08,
-					754.62
-				]
-			],
-			"showDistances": true,
-			"showCoordinates": false,
-			"showArea": true,
-			"closed": true,
-			"showAngles": false,
-			"showHeight": false,
-			"showEdges": true,
-			"color": [
+					754.62,
+				],
+			],
+			showDistances: true,
+			showCoordinates: false,
+			showArea: true,
+			closed: true,
+			showAngles: false,
+			showHeight: false,
+			showEdges: true,
+			color: [
 				1,
 				0,
-				0
-			]
-		}
+				0,
+			],
+		},
 	],
-	"volumes": [
+	volumes: [
 		{
-			"uuid": "1A553B0B-D35B-4B26-84BD-F8CFD287A200",
-			"type": "BoxVolume",
-			"name": "Test Volume",
-			"position": [
+			uuid: '1A553B0B-D35B-4B26-84BD-F8CFD287A200',
+			type: 'BoxVolume',
+			name: 'Test Volume',
+			position: [
 				589688.5173246722,
 				231341.79786558595,
-				792.7726157084892
+				792.7726157084892,
 			],
-			"rotation": [
+			rotation: [
 				0,
 				0,
 				0.6338484063020134,
-				"XYZ"
+				'XYZ',
 			],
-			"scale": [
+			scale: [
 				87.70990081104037,
 				65.01472874807978,
-				95.53770288101325
+				95.53770288101325,
 			],
-			"visible": true,
-			"clip": true
-		}
+			visible: true,
+			clip: true,
+		},
 	],
-	"cameraAnimations": [],
-	"profiles": [
+	cameraAnimations: [],
+	profiles: [
 		{
-			"uuid": "C08F6835-4E6E-47BB-8D13-7428BAEA48CE",
-			"name": "Profile_0",
-			"points": [
+			uuid: 'C08F6835-4E6E-47BB-8D13-7428BAEA48CE',
+			name: 'Profile_0',
+			points: [
 				[
 					589641.6098756103,
 					231453.76974998094,
-					760.4950016784668
+					760.4950016784668,
 				],
 				[
 					589514.4799995422,
 					231309.46000003815,
-					775.6249989318848
+					775.6249989318848,
 				],
 				[
 					589512.4600000381,
 					231504.9597490845,
-					764.6350010681152
-				]
+					764.6350010681152,
+				],
 			],
-			"height": 20,
-			"width": 6
-		}
+			height: 20,
+			width: 6,
+		},
 	],
-	"annotations": [
+	annotations: [
 		{
-			"uuid": "96E6ECB5-BED1-4903-B8C9-252AC78E864D",
-			"title": "Sorvilier",
-			"description": "",
-			"position": [
+			uuid: '96E6ECB5-BED1-4903-B8C9-252AC78E864D',
+			title: 'Sorvilier',
+			description: '',
+			position: [
 				589847.17,
 				231436.78,
-				892.6
+				892.6,
 			],
-			"children": [],
-			"offset": [
+			offset: [
 				0,
 				0,
-				0
+				0,
+			],
+			children: [],
+			cameraPosition: [
+				590034.03,
+				231814.02,
+				961.68,
 			],
-			"cameraPosition": [590034.03, 231814.02, 961.68],
-			"cameraTarget": [589851.587, 231428.213, 715.634]
-		},{
-			"uuid": "D94E1D0B-7AA5-46FB-A513-A42282D3BD18",
-			"title": "Trees",
-			"description": "Point cloud of a small section in Sorvilier, Switzerland. <br>\n\t\t\t\tCourtesy of sigeom.sa",
-			"children": [],
-			"position": [
+			cameraTarget: [
+				589851.587,
+				231428.213,
+				715.634,
+			],
+		},
+		{
+			uuid: 'D94E1D0B-7AA5-46FB-A513-A42282D3BD18',
+			title: 'Trees',
+			description: 'Point cloud of a small section in Sorvilier, Switzerland. <br>\n\t\t\t\tCourtesy of sigeom.sa',
+			position: [
 				589850.15,
 				231300.1,
-				770.94
+				770.94,
 			],
-			"offset": [
+			offset: [
+				0,
 				0,
 				0,
-				0
-			]
+			],
+			children: [],
+			cameraTarget: [
+				589850.15,
+				231300.1,
+				770.94,
+			],
 		},
 		{
-			"uuid": "8B6543FC-64CA-4FD6-9C8D-ACE446D4A711",
-			"title": "About Annotations",
-			"description": "<ul><li>Click on the annotation label to move a predefined view.</li> \n\t\t\t\t<li>Click on the icon to execute the specified action.</li>\n\t\t\t\tIn this case, the action will bring you to another scene and point cloud.</ul>",
-			"children": [],
-			"position": [
+			uuid: '8B6543FC-64CA-4FD6-9C8D-ACE446D4A711',
+			title: 'About Annotations',
+			description: '<ul><li>Click on the annotation label to move a predefined view.</li> \n\t\t\t\t<li>Click on the icon to execute the specified action.</li>\n\t\t\t\tIn this case, the action will bring you to another scene and point cloud.</ul>',
+			position: [
 				590043.63,
 				231490.79,
-				740.78
+				740.78,
+			],
+			offset: [
+				0,
+				0,
+				0,
+			],
+			children: [],
+			cameraPosition: [
+				590105.53,
+				231541.63,
+				782.05,
+			],
+			cameraTarget: [
+				590043.63,
+				231488.79,
+				740.78,
 			],
-			"cameraPosition": [590105.53, 231541.63, 782.05],
-			"cameraTarget": [590043.63, 231488.79, 740.78]
 		},
 		{
-			"uuid": "EE329482-3EF6-448C-A12B-46BF95143F79",
-			"title": "About Annotations 2",
-			"description": "\n\t\t\t\tSuitable annotation positions and views can be obtained by \n\t\t\t\tlooking up the current camera position and target in the \"Scene\" panel, \n\t\t\t\tor by evaluating following lines in your browser's developer console:<br><br>\n\t\t\t\t<code>viewer.scene.view.position</code><br>\n\t\t\t\t<code>viewer.scene.view.getPivot()</code><br>\n\t\t\t\t",
-			"children": [],
-			"position": [
+			uuid: 'EE329482-3EF6-448C-A12B-46BF95143F79',
+			title: 'About Annotations 2',
+			description: '\n\t\t\t\tSuitable annotation positions and views can be obtained by \n\t\t\t\tlooking up the current camera position and target in the "Scene" panel, \n\t\t\t\tor by evaluating following lines in your browser\'s developer console:<br><br>\n\t\t\t\t<code>viewer.scene.view.position</code><br>\n\t\t\t\t<code>viewer.scene.view.getPivot()</code><br>\n\t\t\t\t',
+			position: [
 				589621,
 				231437,
-				784
+				784,
 			],
-			"cameraPosition": [
+			offset: [
+				0,
+				0,
+				0,
+			],
+			children: [],
+			cameraPosition: [
 				589585.81,
 				231463.63,
-				804
+				804,
 			],
-			"cameraTarget": [
+			cameraTarget: [
 				589625.86,
 				231439,
-				775.38
-			]
-		}
+				775.38,
+			],
+		},
 	],
-	"objects": []
+	orientedImages: [],
+	geopackages: [],
 }

+ 448 - 0
examples/resources/sorvilier2.json

@@ -0,0 +1,448 @@
+{
+	"type": "Potree",
+	"version": 1.7,
+	"settings": {
+		"pointBudget": 1000000,
+		"fov": 60,
+		"edlEnabled": true,
+		"edlRadius": 1.4,
+		"edlStrength": 0.4,
+		"background": "gradient",
+		"minNodeSize": 30,
+		"showBoundingBoxes": false
+	},
+	"view": {
+		"position": [
+			589974.341,
+			231698.397,
+			986.146
+		],
+		"target": [
+			589851.587,
+			231428.213,
+			715.634
+		]
+	},
+	"classification": {
+		"0": {
+			"visible": true,
+			"name": "never classified",
+			"color": [
+				0.5,
+				0.5,
+				0.5,
+				1
+			]
+		},
+		"1": {
+			"visible": true,
+			"name": "unclassified",
+			"color": [
+				0.5,
+				0.5,
+				0.5,
+				1
+			]
+		},
+		"2": {
+			"visible": true,
+			"name": "ground",
+			"color": [
+				0.63,
+				0.32,
+				0.18,
+				1
+			]
+		},
+		"3": {
+			"visible": true,
+			"name": "low vegetation",
+			"color": [
+				0,
+				1,
+				0,
+				1
+			]
+		},
+		"4": {
+			"visible": true,
+			"name": "medium vegetation",
+			"color": [
+				0,
+				0.8,
+				0,
+				1
+			]
+		},
+		"5": {
+			"visible": true,
+			"name": "high vegetation",
+			"color": [
+				0,
+				0.6,
+				0,
+				1
+			]
+		},
+		"6": {
+			"visible": true,
+			"name": "building",
+			"color": [
+				1,
+				0.66,
+				0,
+				1
+			]
+		},
+		"7": {
+			"visible": true,
+			"name": "low point(noise)",
+			"color": [
+				1,
+				0,
+				1,
+				1
+			]
+		},
+		"8": {
+			"visible": true,
+			"name": "key-point",
+			"color": [
+				1,
+				0,
+				0,
+				1
+			]
+		},
+		"9": {
+			"visible": true,
+			"name": "water",
+			"color": [
+				0,
+				0,
+				1,
+				1
+			]
+		},
+		"12": {
+			"visible": true,
+			"name": "overlap",
+			"color": [
+				1,
+				1,
+				0,
+				1
+			]
+		},
+		"DEFAULT": {
+			"visible": true,
+			"name": "default",
+			"color": [
+				0.3,
+				0.6,
+				0.6,
+				0.5
+			]
+		}
+	},
+	"pointclouds": [
+		{
+			"name": "sigeom.sa",
+			"url": "../pointclouds/vol_total/cloud.js",
+			"position": [
+				589500,
+				231300,
+				722.505
+			],
+			"rotation": [
+				0,
+				0,
+				0,
+				"XYZ"
+			],
+			"scale": [
+				1,
+				1,
+				1
+			],
+			"activeAttributeName": "rgba"
+		}
+	],
+	"measurements": [
+		{
+			"uuid": "CCFEDDB1-7CEE-4B2C-BBFD-64405DED63C3",
+			"name": "Measure_0",
+			"points": [
+				[
+					589803.18,
+					231357.35,
+					745.38
+				],
+				[
+					589795.74,
+					231323.42,
+					746.21
+				],
+				[
+					589822.5,
+					231315.9,
+					744.45
+				]
+			],
+			"showDistances": true,
+			"showCoordinates": false,
+			"showArea": false,
+			"closed": false,
+			"showAngles": false,
+			"showHeight": false,
+			"showEdges": true,
+			"color": [
+				1,
+				0,
+				0
+			]
+		},
+		{
+			"uuid": "92086379-896A-4608-9584-855A04B915D0",
+			"name": "Angle Sample",
+			"points": [
+				[
+					589866.11,
+					231372.25,
+					737.41
+				],
+				[
+					589842.15,
+					231366.82,
+					743.61
+				],
+				[
+					589860.61,
+					231348.01,
+					740.33
+				]
+			],
+			"showDistances": false,
+			"showCoordinates": false,
+			"showArea": false,
+			"closed": true,
+			"showAngles": true,
+			"showHeight": false,
+			"showEdges": true,
+			"color": [
+				1,
+				0,
+				0
+			]
+		},
+		{
+			"uuid": "D62705BF-C151-49FD-991B-9CEFD223FAFB",
+			"name": "Canopy",
+			"points": [
+				[
+					589853.73,
+					231300.24,
+					775.48
+				]
+			],
+			"showDistances": false,
+			"showCoordinates": true,
+			"showArea": false,
+			"closed": true,
+			"showAngles": false,
+			"showHeight": false,
+			"color": [
+				1,
+				0,
+				0
+			]
+		},
+		{
+			"uuid": "19D13159-B509-4CB0-8CA2-A58FB60B6D50",
+			"name": "Tree Height",
+			"points": [
+				[
+					589849.69,
+					231327.26,
+					766.32
+				],
+				[
+					589840.96,
+					231329.53,
+					744.52
+				]
+			],
+			"showDistances": false,
+			"showCoordinates": false,
+			"showArea": false,
+			"closed": false,
+			"showAngles": false,
+			"showHeight": true,
+			"showEdges": true,
+			"color": [
+				1,
+				0,
+				0
+			]
+		},
+		{
+			"uuid": "E46A0D60-EA59-4589-88AA-788DE0A91DF4",
+			"name": "Area",
+			"points": [
+				[
+					589899.37,
+					231300.16,
+					750.25
+				],
+				[
+					589874.6,
+					231326.06,
+					743.4
+				],
+				[
+					589911.61,
+					231352.57,
+					743.58
+				],
+				[
+					589943.5,
+					231300.08,
+					754.62
+				]
+			],
+			"showDistances": true,
+			"showCoordinates": false,
+			"showArea": true,
+			"closed": true,
+			"showAngles": false,
+			"showHeight": false,
+			"showEdges": true,
+			"color": [
+				1,
+				0,
+				0
+			]
+		}
+	],
+	"volumes": [
+		{
+			"uuid": "1A553B0B-D35B-4B26-84BD-F8CFD287A200",
+			"type": "BoxVolume",
+			"name": "Test Volume",
+			"position": [
+				589688.5173246722,
+				231341.79786558595,
+				792.7726157084892
+			],
+			"rotation": [
+				0,
+				0,
+				0.6338484063020134,
+				"XYZ"
+			],
+			"scale": [
+				87.70990081104037,
+				65.01472874807978,
+				95.53770288101325
+			],
+			"visible": true,
+			"clip": true
+		}
+	],
+	"cameraAnimations": [],
+	"profiles": [
+		{
+			"uuid": "C08F6835-4E6E-47BB-8D13-7428BAEA48CE",
+			"name": "Profile_0",
+			"points": [
+				[
+					589641.6098756103,
+					231453.76974998094,
+					760.4950016784668
+				],
+				[
+					589514.4799995422,
+					231309.46000003815,
+					775.6249989318848
+				],
+				[
+					589512.4600000381,
+					231504.9597490845,
+					764.6350010681152
+				]
+			],
+			"height": 20,
+			"width": 6
+		}
+	],
+	"annotations": [
+		{
+			"uuid": "96E6ECB5-BED1-4903-B8C9-252AC78E864D",
+			"title": "Sorvilier",
+			"description": "",
+			"position": [
+				589847.17,
+				231436.78,
+				892.6
+			],
+			"children": [],
+			"offset": [
+				0,
+				0,
+				0
+			],
+			"cameraPosition": [590034.03, 231814.02, 961.68],
+			"cameraTarget": [589851.587, 231428.213, 715.634]
+		},{
+			"uuid": "D94E1D0B-7AA5-46FB-A513-A42282D3BD18",
+			"title": "Trees",
+			"description": "Point cloud of a small section in Sorvilier, Switzerland. <br>\n\t\t\t\tCourtesy of sigeom.sa",
+			"children": [],
+			"position": [
+				589850.15,
+				231300.1,
+				770.94
+			],
+			"offset": [
+				0,
+				0,
+				0
+			]
+		},
+		{
+			"uuid": "8B6543FC-64CA-4FD6-9C8D-ACE446D4A711",
+			"title": "About Annotations",
+			"description": "<ul><li>Click on the annotation label to move a predefined view.</li> \n\t\t\t\t<li>Click on the icon to execute the specified action.</li>\n\t\t\t\tIn this case, the action will bring you to another scene and point cloud.</ul>",
+			"children": [],
+			"position": [
+				590043.63,
+				231490.79,
+				740.78
+			],
+			"cameraPosition": [590105.53, 231541.63, 782.05],
+			"cameraTarget": [590043.63, 231488.79, 740.78]
+		},
+		{
+			"uuid": "EE329482-3EF6-448C-A12B-46BF95143F79",
+			"title": "About Annotations 2",
+			"description": "\n\t\t\t\tSuitable annotation positions and views can be obtained by \n\t\t\t\tlooking up the current camera position and target in the \"Scene\" panel, \n\t\t\t\tor by evaluating following lines in your browser's developer console:<br><br>\n\t\t\t\t<code>viewer.scene.view.position</code><br>\n\t\t\t\t<code>viewer.scene.view.getPivot()</code><br>\n\t\t\t\t",
+			"children": [],
+			"position": [
+				589621,
+				231437,
+				784
+			],
+			"cameraPosition": [
+				589585.81,
+				231463.63,
+				804
+			],
+			"cameraTarget": [
+				589625.86,
+				231439,
+				775.38
+			]
+		}
+	],
+	"objects": []
+}

+ 1 - 1
examples/showcase/santorini.html

@@ -45,7 +45,7 @@
 		
 		viewer.setEDLEnabled(true);
 		viewer.setFOV(60);
-		viewer.setPointBudget(1_000_000);
+		viewer.setPointBudget(1_000_000);
 		viewer.loadSettingsFromURL();
 		
 		viewer.setDescription(`Pyle, David; Parks, Michelle; Mather, Tamsin; Nomikou, Paraskevi (2014): 

+ 12 - 1
gulpfile.js

@@ -72,13 +72,24 @@ let shaders = [
 	"src/materials/shaders/edl.fs",
 	"src/materials/shaders/blur.vs",
 	"src/materials/shaders/blur.fs",
+    //add:
+	"src/materials/shaders/depthBasic.vs", 
+	"src/materials/shaders/depthBasic.fs",
+    "src/materials/shaders/copyCubeMap.vs",
+	"src/materials/shaders/copyCubeMap.fs",
+	"src/materials/shaders/basicTextured.vs",
+	"src/materials/shaders/basicTextured.fs",
 ];
 
+
+'src/**/*.js',
+
 // For development, it is now possible to use 'gulp webserver'
 // from the command line to start the server (default port is 8080)
 gulp.task('webserver', gulp.series(async function() {
 	server = connect.server({
-		port: 1234,
+		port: 5000,
+        host:'0.0.0.0',
 		https: false,
 	});
 }));

+ 22 - 22
libs/jstree/LICENSE-MIT

@@ -1,22 +1,22 @@
-Copyright (c) 2014 Ivan Bozhanov
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
+Copyright (c) 2014 Ivan Bozhanov
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.

+ 1 - 1
libs/other/stats.js

@@ -22,7 +22,7 @@
 // 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 () {
 

+ 2 - 2
libs/proj4/test.html

@@ -1,2 +1,2 @@
-<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js"></script>
-
+<script src="https://cdnjs.cloudflare.com/ajax/libs/proj4js/2.4.3/proj4.js"></script>
+

+ 0 - 21
libs/stats.js/LICENSE

@@ -1,21 +0,0 @@
-The MIT License
-
-Copyright (c) 2009-2016 stats.js authors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-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.

+ 0 - 56
libs/stats.js/README.md

@@ -1,56 +0,0 @@
-stats.js
-========
-
-#### JavaScript Performance Monitor ####
-
-This class provides a simple info box that will help you monitor your code performance.
-
-* **FPS** Frames rendered in the last second. The higher the number the better.
-* **MS** Milliseconds needed to render a frame. The lower the number the better.
-* **MB** MBytes of allocated memory. (Run Chrome with `--enable-precise-memory-info`)
-* **CUSTOM** User-defined panel support.
-
-
-### Screenshots ###
-
-![fps.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/fps.png)
-![ms.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/ms.png)
-![mb.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/mb.png)
-![custom.png](https://raw.githubusercontent.com/mrdoob/stats.js/master/files/custom.png)
-
-
-### Installation ###
-```bash
-npm install stats.js
-```
-
-### Usage ###
-
-```javascript
-var stats = new Stats();
-stats.showPanel( 1 ); // 0: fps, 1: ms, 2: mb, 3+: custom
-document.body.appendChild( stats.dom );
-
-function animate() {
-
-	stats.begin();
-
-	// monitored code goes here
-
-	stats.end();
-
-	requestAnimationFrame( animate );
-
-}
-
-requestAnimationFrame( animate );
-```
-
-
-### Bookmarklet ###
-
-You can add this code to any page using the following bookmarklet:
-
-```javascript
-javascript:(function(){var script=document.createElement('script');script.onload=function(){var stats=new Stats();document.body.appendChild(stats.dom);requestAnimationFrame(function loop(){stats.update();requestAnimationFrame(loop)});};script.src='//mrdoob.github.io/stats.js/build/stats.min.js';document.head.appendChild(script);})()
-```

+ 0 - 179
libs/stats.js/stats.js

@@ -1,179 +0,0 @@
-(function (global, factory) {
-	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-	typeof define === 'function' && define.amd ? define(factory) :
-	(global.Stats = factory());
-}(this, (function () { 'use strict';
-
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-var Stats = function () {
-
-	var mode = 0;
-
-	var container = document.createElement( 'div' );
-	container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
-	container.addEventListener( 'click', function ( event ) {
-
-		event.preventDefault();
-		showPanel( ++ mode % container.children.length );
-
-	}, false );
-
-	//
-
-	function addPanel( panel ) {
-
-		container.appendChild( panel.dom );
-		return panel;
-
-	}
-
-	function showPanel( id ) {
-
-		for ( var i = 0; i < container.children.length; i ++ ) {
-
-			container.children[ i ].style.display = i === id ? 'block' : 'none';
-
-		}
-
-		mode = id;
-
-	}
-
-	//
-
-	var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
-
-	var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
-	var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );
-
-	if ( self.performance && self.performance.memory ) {
-
-		var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );
-
-	}
-
-	showPanel( 0 );
-
-	return {
-
-		REVISION: 16,
-
-		dom: container,
-
-		addPanel: addPanel,
-		showPanel: showPanel,
-
-		begin: function () {
-
-			beginTime = ( performance || Date ).now();
-
-		},
-
-		end: function () {
-
-			frames ++;
-
-			var time = ( performance || Date ).now();
-
-			msPanel.update( time - beginTime, 200 );
-
-			if ( time >= prevTime + 1000 ) {
-
-				fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
-
-				prevTime = time;
-				frames = 0;
-
-				if ( memPanel ) {
-
-					var memory = performance.memory;
-					memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
-
-				}
-
-			}
-
-			return time;
-
-		},
-
-		update: function () {
-
-			beginTime = this.end();
-
-		},
-
-		// Backwards Compatibility
-
-		domElement: container,
-		setMode: showPanel
-
-	};
-
-};
-
-Stats.Panel = function ( name, fg, bg ) {
-
-	var min = Infinity, max = 0, round = Math.round;
-	var PR = round( window.devicePixelRatio || 1 );
-
-	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
-			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
-			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
-			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
-
-	var canvas = document.createElement( 'canvas' );
-	canvas.width = WIDTH;
-	canvas.height = HEIGHT;
-	canvas.style.cssText = 'width:80px;height:48px';
-
-	var context = canvas.getContext( '2d' );
-	context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
-	context.textBaseline = 'top';
-
-	context.fillStyle = bg;
-	context.fillRect( 0, 0, WIDTH, HEIGHT );
-
-	context.fillStyle = fg;
-	context.fillText( name, TEXT_X, TEXT_Y );
-	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
-
-	context.fillStyle = bg;
-	context.globalAlpha = 0.9;
-	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
-
-	return {
-
-		dom: canvas,
-
-		update: function ( value, maxValue ) {
-
-			min = Math.min( min, value );
-			max = Math.max( max, value );
-
-			context.fillStyle = bg;
-			context.globalAlpha = 1;
-			context.fillRect( 0, 0, WIDTH, GRAPH_Y );
-			context.fillStyle = fg;
-			context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
-
-			context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
-
-			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
-
-			context.fillStyle = bg;
-			context.globalAlpha = 0.9;
-			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
-
-		}
-
-	};
-
-};
-
-return Stats;
-
-})));

Diferenças do arquivo suprimidas por serem muito extensas
+ 0 - 5
libs/stats.js/stats.min.js


+ 0 - 171
libs/stats.js/stats.module.js

@@ -1,171 +0,0 @@
-/**
- * @author mrdoob / http://mrdoob.com/
- */
-
-var Stats = function () {
-
-	var mode = 0;
-
-	var container = document.createElement( 'div' );
-	container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000';
-	container.addEventListener( 'click', function ( event ) {
-
-		event.preventDefault();
-		showPanel( ++ mode % container.children.length );
-
-	}, false );
-
-	//
-
-	function addPanel( panel ) {
-
-		container.appendChild( panel.dom );
-		return panel;
-
-	}
-
-	function showPanel( id ) {
-
-		for ( var i = 0; i < container.children.length; i ++ ) {
-
-			container.children[ i ].style.display = i === id ? 'block' : 'none';
-
-		}
-
-		mode = id;
-
-	}
-
-	//
-
-	var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0;
-
-	var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) );
-	var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) );
-
-	if ( self.performance && self.performance.memory ) {
-
-		var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) );
-
-	}
-
-	showPanel( 0 );
-
-	return {
-
-		REVISION: 16,
-
-		dom: container,
-
-		addPanel: addPanel,
-		showPanel: showPanel,
-
-		begin: function () {
-
-			beginTime = ( performance || Date ).now();
-
-		},
-
-		end: function () {
-
-			frames ++;
-
-			var time = ( performance || Date ).now();
-
-			msPanel.update( time - beginTime, 200 );
-
-			if ( time >= prevTime + 1000 ) {
-
-				fpsPanel.update( ( frames * 1000 ) / ( time - prevTime ), 100 );
-
-				prevTime = time;
-				frames = 0;
-
-				if ( memPanel ) {
-
-					var memory = performance.memory;
-					memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 );
-
-				}
-
-			}
-
-			return time;
-
-		},
-
-		update: function () {
-
-			beginTime = this.end();
-
-		},
-
-		// Backwards Compatibility
-
-		domElement: container,
-		setMode: showPanel
-
-	};
-
-};
-
-Stats.Panel = function ( name, fg, bg ) {
-
-	var min = Infinity, max = 0, round = Math.round;
-	var PR = round( window.devicePixelRatio || 1 );
-
-	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
-			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
-			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
-			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
-
-	var canvas = document.createElement( 'canvas' );
-	canvas.width = WIDTH;
-	canvas.height = HEIGHT;
-	canvas.style.cssText = 'width:80px;height:48px';
-
-	var context = canvas.getContext( '2d' );
-	context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif';
-	context.textBaseline = 'top';
-
-	context.fillStyle = bg;
-	context.fillRect( 0, 0, WIDTH, HEIGHT );
-
-	context.fillStyle = fg;
-	context.fillText( name, TEXT_X, TEXT_Y );
-	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
-
-	context.fillStyle = bg;
-	context.globalAlpha = 0.9;
-	context.fillRect( GRAPH_X, GRAPH_Y, GRAPH_WIDTH, GRAPH_HEIGHT );
-
-	return {
-
-		dom: canvas,
-
-		update: function ( value, maxValue ) {
-
-			min = Math.min( min, value );
-			max = Math.max( max, value );
-
-			context.fillStyle = bg;
-			context.globalAlpha = 1;
-			context.fillRect( 0, 0, WIDTH, GRAPH_Y );
-			context.fillStyle = fg;
-			context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', TEXT_X, TEXT_Y );
-
-			context.drawImage( canvas, GRAPH_X + PR, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT, GRAPH_X, GRAPH_Y, GRAPH_WIDTH - PR, GRAPH_HEIGHT );
-
-			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, GRAPH_HEIGHT );
-
-			context.fillStyle = bg;
-			context.globalAlpha = 0.9;
-			context.fillRect( GRAPH_X + GRAPH_WIDTH - PR, GRAPH_Y, PR, round( ( 1 - ( value / maxValue ) ) * GRAPH_HEIGHT ) );
-
-		}
-
-	};
-
-};
-
-export default Stats;

+ 119 - 88
libs/three.js/build/three.module.js

@@ -208,7 +208,7 @@ function EventDispatcher() {}
 
 Object.assign( EventDispatcher.prototype, {
 
-	addEventListener: function ( type, listener ) {
+	addEventListener: function ( type, listener, importance=0 ) {//add importance
 
 		if ( this._listeners === undefined ) this._listeners = {};
 
@@ -220,10 +220,10 @@ Object.assign( EventDispatcher.prototype, {
 
 		}
 
-		if ( listeners[ type ].indexOf( listener ) === - 1 ) {
-
-			listeners[ type ].push( listener );
-
+		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
 		}
 
 	},
@@ -234,7 +234,7 @@ Object.assign( EventDispatcher.prototype, {
 
 		const listeners = this._listeners;
 
-		return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
+		return listeners[ type ] !== undefined &&  listeners[ type ].some(e=>e.listener == listener )    
 
 	},
 
@@ -247,20 +247,36 @@ Object.assign( EventDispatcher.prototype, {
 
 		if ( listenerArray !== undefined ) {
 
-			const index = listenerArray.indexOf( listener );
+			/* 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);
 
 		}
 
 	},
-
-	dispatchEvent: function ( event ) {
-
+    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;
@@ -271,18 +287,18 @@ Object.assign( EventDispatcher.prototype, {
 			event.target = this;
 
 			// Make a copy, in case listeners are removed while iterating.
-			const array = listenerArray.slice( 0 );
-
-			for ( let i = 0, l = array.length; i < l; i ++ ) {
-
-				array[ i ].call( this, event );
-
+			 
+            for(let {listener} of listenerArray.slice(0)){
+				let result = listener.call(this, event);   //add stopContinue
+                if(result && result.stopContinue){
+                    break
+                }
 			}
 
 		}
 
 	}
-
+    
 } );
 
 const _lut = [];
@@ -6829,8 +6845,11 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 	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 ++ ) {
@@ -8524,7 +8543,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 			if ( currentValue === undefined ) {
 
-				console.warn( 'THREE.' + this.type + ': \'' + key + '\' is not a property of this material.' );
+				//console.warn( 'THREE.' + this.type + ': \'' + key + '\' is not a property of this material.' );
 				continue;
 
 			}
@@ -8696,7 +8715,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;
@@ -8707,7 +8726,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;
 
@@ -8881,7 +8900,7 @@ Object.defineProperty( Material.prototype, 'needsUpdate', {
  *  depthWrite: <bool>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
+ *  wireframelineWidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>
@@ -8914,7 +8933,7 @@ function MeshBasicMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -8954,7 +8973,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;
 
@@ -11700,7 +11719,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>,
  *
@@ -11722,10 +11741,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
@@ -11786,7 +11805,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;
@@ -17448,7 +17467,13 @@ function WebGLProgram( renderer, cacheKey, parameters, bindingStates ) {
 			const fragmentErrors = getShaderErrors( gl, glFragmentShader, 'fragment' );
 
 			console.error( 'THREE.WebGLProgram: shader error: ', gl.getError(), '35715', gl.getProgramParameter( program, 35715 ), 'gl.getProgramInfoLog', programLog, vertexErrors, fragmentErrors );
-
+            //add:
+            if(fragmentErrors){
+                console.log(fragmentGlsl.split("\n").map((a, i) => `${i + 1}`.padEnd(5) + a).join("\n") )
+            }else{
+                console.log(vertexGlsl.split("\n").map((a, i) => `${i + 1}`.padEnd(5) + a).join("\n") )
+            }
+            
 		} else if ( programLog !== '' ) {
 
 			console.warn( 'THREE.WebGLProgram: gl.getProgramInfoLog()', programLog );
@@ -18871,7 +18896,7 @@ function WebGLRenderStates( extensions, capabilities ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>
+ *  wireframelineWidth: <float>
  * }
  */
 
@@ -18895,7 +18920,7 @@ function MeshDepthMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 
 	this.fog = false;
 
@@ -18926,7 +18951,7 @@ MeshDepthMaterial.prototype.copy = function ( source ) {
 	this.displacementBias = source.displacementBias;
 
 	this.wireframe = source.wireframe;
-	this.wireframeLinewidth = source.wireframeLinewidth;
+	this.wireframelineWidth = source.wireframelineWidth;
 
 	return this;
 
@@ -19371,8 +19396,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 ) {
 
@@ -19774,7 +19799,7 @@ function WebGLState( gl, extensions, capabilities ) {
 	let currentFlipSided = null;
 	let currentCullFace = null;
 
-	let currentLineWidth = null;
+	let currentlineWidth = null;
 
 	let currentPolygonOffsetFactor = null;
 	let currentPolygonOffsetUnits = null;
@@ -20143,13 +20168,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;
 
 		}
 
@@ -20340,7 +20365,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		currentFlipSided = null;
 		currentCullFace = null;
 
-		currentLineWidth = null;
+		currentlineWidth = null;
 
 		currentPolygonOffsetFactor = null;
 		currentPolygonOffsetUnits = null;
@@ -20370,7 +20395,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		setFlipSided: setFlipSided,
 		setCullFace: setCullFace,
 
-		setLineWidth: setLineWidth,
+		setlineWidth: setlineWidth,
 		setPolygonOffset: setPolygonOffset,
 
 		setScissorTest: setScissorTest,
@@ -23591,6 +23616,8 @@ function WebGLRenderer( parameters ) {
 		_this.state = state;
 		_this.info = info;
 
+        _this._textures = textures;//add 
+        
 	}
 
 	initGLContext();
@@ -23665,8 +23692,8 @@ function WebGLRenderer( parameters ) {
 
 	};
 
-	this.setSize = function ( width, height, updateStyle ) {
-
+	this.setSize = function ( width, height,  updateStyle, devicePixelRatio ) {//改
+        if (devicePixelRatio != void 0) _pixelRatio = devicePixelRatio;  //add
 		if ( xr.isPresenting ) {
 
 			console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
@@ -23676,19 +23703,23 @@ function WebGLRenderer( parameters ) {
 
 		_width = width;
 		_height = height;
-
-		_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 );
-
+        
+        //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';
+
+            }
+            
+            
+            this.setViewport( 0, 0, width, height );
+        //}
 	};
 
 	this.getDrawingBufferSize = function ( target ) {
@@ -24094,7 +24125,7 @@ function WebGLRenderer( parameters ) {
 
 			if ( material.wireframe === true ) {
 
-				state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );
+				state.setlineWidth( material.wireframelineWidth * getTargetPixelRatio() );
 				renderer.setMode( 1 );
 
 			} else {
@@ -24105,11 +24136,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 ) {
 
@@ -26776,7 +26807,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  linewidth: <float>,
+ *  lineWidth: <float>,
  *  linecap: "round",
  *  linejoin: "round"
  * }
@@ -26790,7 +26821,7 @@ function LineBasicMaterial( parameters ) {
 
 	this.color = new Color( 0xffffff );
 
-	this.linewidth = 1;
+	this.lineWidth = 1;
 	this.linecap = 'round';
 	this.linejoin = 'round';
 
@@ -26811,7 +26842,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;
 
@@ -33477,7 +33508,7 @@ RawShaderMaterial.prototype.isRawShaderMaterial = true;
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
+ *  wireframelineWidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33532,7 +33563,7 @@ function MeshStandardMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33596,7 +33627,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;
 
@@ -33755,7 +33786,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
+ *  wireframelineWidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33806,7 +33837,7 @@ function MeshPhongMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33864,7 +33895,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;
 
@@ -33907,7 +33938,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
  *  alphaMap: new THREE.Texture( <Image> ),
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
+ *  wireframelineWidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33952,7 +33983,7 @@ function MeshToonMaterial( parameters ) {
 	this.alphaMap = null;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34002,7 +34033,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;
 
@@ -34030,7 +34061,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>
+ *  wireframelineWidth: <float>
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34056,7 +34087,7 @@ function MeshNormalMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 
 	this.fog = false;
 
@@ -34089,7 +34120,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;
@@ -34126,7 +34157,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframeLinewidth: <float>,
+ *  wireframelineWidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34164,7 +34195,7 @@ function MeshLambertMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframeLinewidth = 1;
+	this.wireframelineWidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34209,7 +34240,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;
 
@@ -34327,7 +34358,7 @@ MeshMatcapMaterial.prototype.copy = function ( source ) {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  linewidth: <float>,
+ *  lineWidth: <float>,
  *
  *  scale: <float>,
  *  dashSize: <float>,
@@ -36746,8 +36777,8 @@ 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 );
-
+						if ( callback.onLoad ) callback.onLoad( response, event.total); //xzw add event.total
+  
 					}
 
 					scope.manager.itemEnd( url );
@@ -40371,13 +40402,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;
@@ -42089,7 +42120,7 @@ ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 			return res.blob();
 
 		} ).then( function ( blob ) {
-
+            //console.log('getBlob', url   )
 			return createImageBitmap( blob, scope.options );
 
 		} ).then( function ( imageBitmap ) {
@@ -42100,9 +42131,9 @@ ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 
 			scope.manager.itemEnd( url );
 
-		} ).catch( function ( e ) {
-
-			if ( onError ) onError( e );
+		} ).catch( function ( e ) { 
+            //console.log('error', url, e)
+			if ( onError ) onError( e, url );
 
 			scope.manager.itemError( url );
 			scope.manager.itemEnd( url );
@@ -50456,7 +50487,7 @@ Object.defineProperties( BufferAttribute.prototype, {
 Object.assign( BufferAttribute.prototype, {
 	setDynamic: function ( value ) {
 
-		console.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' );
+		//console.warn( 'THREE.BufferAttribute: .setDynamic() has been deprecated. Use .setUsage() instead.' );
 		this.setUsage( value === true ? DynamicDrawUsage : StaticDrawUsage );
 		return this;
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 856 - 856
libs/three.js/extra/lines.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 1 - 0
libs/three.js/libs/ktx-parse.module.js


+ 7 - 12
libs/three.js/lines/Line2.js

@@ -2,23 +2,18 @@ import { LineSegments2 } from '../lines/LineSegments2.js';
 import { LineGeometry } from '../lines/LineGeometry.js';
 import { LineMaterial } from '../lines/LineMaterial.js';
 
-var Line2 = function ( geometry, material ) {
+class Line2 extends LineSegments2 {
 
-	if ( geometry === undefined ) geometry = new LineGeometry();
-	if ( material === undefined ) material = new LineMaterial( { color: Math.random() * 0xffffff } );
+	constructor( geometry = new LineGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
 
-	LineSegments2.call( this, geometry, material );
+		super( geometry, material );
 
-	this.type = 'Line2';
+		this.isLine2 = true;
 
-};
+		this.type = 'Line2';
 
-Line2.prototype = Object.assign( Object.create( LineSegments2.prototype ), {
+	}
 
-	constructor: Line2,
-
-	isLine2: true
-
-} );
+}
 
 export { Line2 };

+ 22 - 40
libs/three.js/lines/LineGeometry.js

@@ -1,27 +1,25 @@
 import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
 
-var LineGeometry = function () {
+class LineGeometry extends LineSegmentsGeometry {
 
-	LineSegmentsGeometry.call( this );
+	constructor() {
 
-	this.type = 'LineGeometry';
+		super();
 
-};
+		this.isLineGeometry = true;
 
-LineGeometry.prototype = Object.assign( Object.create( LineSegmentsGeometry.prototype ), {
+		this.type = 'LineGeometry';
 
-	constructor: LineGeometry,
-
-	isLineGeometry: true,
+	}
 
-	setPositions: function ( array ) {
+	setPositions( array ) {
 
 		// converts [ x1, y1, z1,  x2, y2, z2, ... ] to pairs format
 
-		var length = array.length - 3;
-		var points = new Float32Array( 2 * length );
+		const length = array.length - 3;
+		const points = new Float32Array( 2 * length );
 
-		for ( var i = 0; i < length; i += 3 ) {
+		for ( let i = 0; i < length; i += 3 ) {
 
 			points[ 2 * i ] = array[ i ];
 			points[ 2 * i + 1 ] = array[ i + 1 ];
@@ -33,20 +31,20 @@ LineGeometry.prototype = Object.assign( Object.create( LineSegmentsGeometry.prot
 
 		}
 
-		LineSegmentsGeometry.prototype.setPositions.call( this, points );
+		super.setPositions( points );
 
 		return this;
 
-	},
+	}
 
-	setColors: function ( array ) {
+	setColors( array ) {
 
 		// converts [ r1, g1, b1,  r2, g2, b2, ... ] to pairs format
 
-		var length = array.length - 3;
-		var colors = new Float32Array( 2 * length );
+		const length = array.length - 3;
+		const colors = new Float32Array( 2 * length );
 
-		for ( var i = 0; i < length; i += 3 ) {
+		for ( let i = 0; i < length; i += 3 ) {
 
 			colors[ 2 * i ] = array[ i ];
 			colors[ 2 * i + 1 ] = array[ i + 1 ];
@@ -58,40 +56,24 @@ LineGeometry.prototype = Object.assign( Object.create( LineSegmentsGeometry.prot
 
 		}
 
-		LineSegmentsGeometry.prototype.setColors.call( this, colors );
+		super.setColors( colors );
 
 		return this;
 
-	},
-
-	fromLine: function ( line ) {
-
-		var geometry = line.geometry;
-
-		if ( geometry.isGeometry ) {
-
-			this.setPositions( geometry.vertices );
+	}
 
-		} else if ( geometry.isBufferGeometry ) {
+	fromLine( line ) {
 
-			this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
+		const geometry = line.geometry;
 
-		}
+		this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
 
 		// set colors, maybe
 
 		return this;
 
-	},
-
-	copy: function ( /* source */ ) {
-
-		// todo
-
-		return this;
-
 	}
 
-} );
+}
 
 export { LineGeometry };

Diferenças do arquivo suprimidas por serem muito extensas
+ 649 - 136
libs/three.js/lines/LineMaterial.js


+ 274 - 128
libs/three.js/lines/LineSegments2.js

@@ -1,209 +1,355 @@
 import {
+	Box3,
 	InstancedInterleavedBuffer,
 	InterleavedBufferAttribute,
 	Line3,
 	MathUtils,
 	Matrix4,
 	Mesh,
+	Sphere,
 	Vector3,
 	Vector4
-} from '../build/three.module.js';
+} from '../build/three.module.js'; 
 import { LineSegmentsGeometry } from '../lines/LineSegmentsGeometry.js';
 import { LineMaterial } from '../lines/LineMaterial.js';
 
-var LineSegments2 = function ( geometry, material ) {
+const _start = new Vector3();
+const _end = new Vector3();
 
-	if ( geometry === undefined ) geometry = new LineSegmentsGeometry();
-	if ( material === undefined ) material = new LineMaterial( { color: Math.random() * 0xffffff } );
+const _start4 = new Vector4();
+const _end4 = new Vector4();
 
-	Mesh.call( this, geometry, material );
+const _ssOrigin = new Vector4();
+const _ssOrigin3 = new Vector3();
+const _mvMatrix = new Matrix4();
+const _line = new Line3();
+const _closestPoint = new Vector3();
 
-	this.type = 'LineSegments2';
+const _box = new Box3();
+const _sphere = new Sphere();
+const _clipToWorldVector = new Vector4();
 
-};
+let _ray, _instanceStart, _instanceEnd, _lineWidth;
 
-LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
+// Returns the margin required to expand by in world space given the distance from the camera,
+// line width, resolution, and camera projection
+function getWorldSpaceHalfWidth( camera, distance, resolution ) {
 
-	constructor: LineSegments2,
+	// transform into clip space, adjust the x and y values by the pixel width offset, then
+	// transform back into world space to get world offset. Note clip space is [-1, 1] so full
+	// width does not need to be halved.
+	_clipToWorldVector.set( 0, 0, - distance, 1.0 ).applyMatrix4( camera.projectionMatrix );
+	_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
+	_clipToWorldVector.x = _lineWidth / resolution.width;
+	_clipToWorldVector.y = _lineWidth / resolution.height;
+	_clipToWorldVector.applyMatrix4( camera.projectionMatrixInverse );
+	_clipToWorldVector.multiplyScalar( 1.0 / _clipToWorldVector.w );
 
-	isLineSegments2: true,
+	return Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) );
 
-	computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
+}
 
-		var start = new Vector3();
-		var end = new Vector3();
+function raycastWorldUnits( lineSegments, intersects ) {
 
-		return function computeLineDistances() {
+	for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) {
 
-			var geometry = this.geometry;
+		_line.start.fromBufferAttribute( _instanceStart, i );
+		_line.end.fromBufferAttribute( _instanceEnd, i );
 
-			var instanceStart = geometry.attributes.instanceStart;
-			var instanceEnd = geometry.attributes.instanceEnd;
-			var lineDistances = new Float32Array( 2 * instanceStart.data.count );
+		const pointOnLine = new Vector3();
+		const point = new Vector3();
 
-			for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
+		_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );
+		const isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5;
 
-				start.fromBufferAttribute( instanceStart, i );
-				end.fromBufferAttribute( instanceEnd, i );
+		if ( isInside ) {
 
-				lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
-				lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
+			intersects.push( {
+				point,
+				pointOnLine,
+				distance: _ray.origin.distanceTo( point ),
+				object: lineSegments,
+				face: null,
+				faceIndex: i,
+				uv: null,
+				uv2: null,
+			} );
 
-			}
+		}
 
-			var instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
+	}
 
-			geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
-			geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+}
 
-			return this;
+function raycastScreenSpace( lineSegments, camera, intersects ) {
 
-		};
+	const projectionMatrix = camera.projectionMatrix;
+	const material = lineSegments.material;
+	const resolution = material.resolution;
+	const matrixWorld = lineSegments.matrixWorld;
 
-	}() ),
+	const geometry = lineSegments.geometry;
+	const instanceStart = geometry.attributes.instanceStart;
+	const instanceEnd = geometry.attributes.instanceEnd;
 
-	raycast: ( function () {
+	const near = - camera.near;
 
-		var start = new Vector4();
-		var end = new Vector4();
+	//
 
-		var ssOrigin = new Vector4();
-		var ssOrigin3 = new Vector3();
-		var mvMatrix = new Matrix4();
-		var line = new Line3();
-		var closestPoint = new Vector3();
+	// pick a point 1 unit out along the ray to avoid the ray origin
+	// sitting at the camera origin which will cause "w" to be 0 when
+	// applying the projection matrix.
+	_ray.at( 1, _ssOrigin );
 
-		return function raycast( raycaster, intersects ) {
+	// ndc space [ - 1.0, 1.0 ]
+	_ssOrigin.w = 1;
+	_ssOrigin.applyMatrix4( camera.matrixWorldInverse );
+	_ssOrigin.applyMatrix4( projectionMatrix );
+	_ssOrigin.multiplyScalar( 1 / _ssOrigin.w );
 
-			if ( raycaster.camera === null ) {
+	// screen space
+	_ssOrigin.x *= resolution.x / 2;
+	_ssOrigin.y *= resolution.y / 2;
+	_ssOrigin.z = 0;
 
-				console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.' );
+	_ssOrigin3.copy( _ssOrigin );
 
-			}
+	_mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
 
-			var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
+	for ( let i = 0, l = instanceStart.count; i < l; i ++ ) {
 
-			var ray = raycaster.ray;
-			var camera = raycaster.camera;
-			var projectionMatrix = camera.projectionMatrix;
+		_start4.fromBufferAttribute( instanceStart, i );
+		_end4.fromBufferAttribute( instanceEnd, i );
 
-			var geometry = this.geometry;
-			var material = this.material;
-			var resolution = material.resolution;
-			var lineWidth = material.linewidth + threshold;
+		_start4.w = 1;
+		_end4.w = 1;
 
-			var instanceStart = geometry.attributes.instanceStart;
-			var instanceEnd = geometry.attributes.instanceEnd;
+		// camera space
+		_start4.applyMatrix4( _mvMatrix );
+		_end4.applyMatrix4( _mvMatrix );
 
-			// pick a point 1 unit out along the ray to avoid the ray origin
-			// sitting at the camera origin which will cause "w" to be 0 when
-			// applying the projection matrix.
-			ray.at( 1, ssOrigin );
+		// skip the segment if it's entirely behind the camera
+		const isBehindCameraNear = _start4.z > near && _end4.z > near;
+		if ( isBehindCameraNear ) {
 
-			// ndc space [ - 1.0, 1.0 ]
-			ssOrigin.w = 1;
-			ssOrigin.applyMatrix4( camera.matrixWorldInverse );
-			ssOrigin.applyMatrix4( projectionMatrix );
-			ssOrigin.multiplyScalar( 1 / ssOrigin.w );
+			continue;
 
-			// screen space
-			ssOrigin.x *= resolution.x / 2;
-			ssOrigin.y *= resolution.y / 2;
-			ssOrigin.z = 0;
+		}
 
-			ssOrigin3.copy( ssOrigin );
+		// trim the segment if it extends behind camera near
+		if ( _start4.z > near ) {
 
-			var matrixWorld = this.matrixWorld;
-			mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
+			const deltaDist = _start4.z - _end4.z;
+			const t = ( _start4.z - near ) / deltaDist;
+			_start4.lerp( _end4, t );
 
-			for ( var i = 0, l = instanceStart.count; i < l; i ++ ) {
+		} else if ( _end4.z > near ) {
 
-				start.fromBufferAttribute( instanceStart, i );
-				end.fromBufferAttribute( instanceEnd, i );
+			const deltaDist = _end4.z - _start4.z;
+			const t = ( _end4.z - near ) / deltaDist;
+			_end4.lerp( _start4, t );
 
-				start.w = 1;
-				end.w = 1;
+		}
 
-				// camera space
-				start.applyMatrix4( mvMatrix );
-				end.applyMatrix4( mvMatrix );
+		// clip space
+		_start4.applyMatrix4( projectionMatrix );
+		_end4.applyMatrix4( projectionMatrix );
 
-				// clip space
-				start.applyMatrix4( projectionMatrix );
-				end.applyMatrix4( projectionMatrix );
+		// ndc space [ - 1.0, 1.0 ]
+		_start4.multiplyScalar( 1 / _start4.w );
+		_end4.multiplyScalar( 1 / _end4.w );
 
-				// ndc space [ - 1.0, 1.0 ]
-				start.multiplyScalar( 1 / start.w );
-				end.multiplyScalar( 1 / end.w );
+		// screen space
+		_start4.x *= resolution.x / 2;
+		_start4.y *= resolution.y / 2;
 
-				// skip the segment if it's outside the camera near and far planes
-				var isBehindCameraNear = start.z < - 1 && end.z < - 1;
-				var isPastCameraFar = start.z > 1 && end.z > 1;
-				if ( isBehindCameraNear || isPastCameraFar ) {
+		_end4.x *= resolution.x / 2;
+		_end4.y *= resolution.y / 2;
 
-					continue;
+		// create 2d segment
+		_line.start.copy( _start4 );
+		_line.start.z = 0;
 
-				}
+		_line.end.copy( _end4 );
+		_line.end.z = 0;
 
-				// screen space
-				start.x *= resolution.x / 2;
-				start.y *= resolution.y / 2;
+		// get closest point on ray to segment
+		const param = _line.closestPointToPointParameter( _ssOrigin3, true );
+		_line.at( param, _closestPoint );
 
-				end.x *= resolution.x / 2;
-				end.y *= resolution.y / 2;
+		// check if the intersection point is within clip space
+		const zPos = MathUtils.lerp( _start4.z, _end4.z, param );
+		const isInClipSpace = zPos >= - 1 && zPos <= 1;
 
-				// create 2d segment
-				line.start.copy( start );
-				line.start.z = 0;
+		const isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5;
 
-				line.end.copy( end );
-				line.end.z = 0;
+		if ( isInClipSpace && isInside ) {
 
-				// get closest point on ray to segment
-				var param = line.closestPointToPointParameter( ssOrigin3, true );
-				line.at( param, closestPoint );
+			_line.start.fromBufferAttribute( instanceStart, i );
+			_line.end.fromBufferAttribute( instanceEnd, i );
 
-				// check if the intersection point is within clip space
-				var zPos = MathUtils.lerp( start.z, end.z, param );
-				var isInClipSpace = zPos >= - 1 && zPos <= 1;
+			_line.start.applyMatrix4( matrixWorld );
+			_line.end.applyMatrix4( matrixWorld );
 
-				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;
+			const pointOnLine = new Vector3();
+			const point = new Vector3();
 
-				if ( isInClipSpace && isInside ) {
+			_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );
 
-					line.start.fromBufferAttribute( instanceStart, i );
-					line.end.fromBufferAttribute( instanceEnd, i );
+			intersects.push( {
+				point: point,
+				pointOnLine: pointOnLine,
+				distance: _ray.origin.distanceTo( point ),
+				object: lineSegments,
+				face: null,
+				faceIndex: i,
+				uv: null,
+				uv2: null,
+			} );
 
-					line.start.applyMatrix4( matrixWorld );
-					line.end.applyMatrix4( matrixWorld );
+		}
 
-					var pointOnLine = new Vector3();
-					var point = new Vector3();
+	}
 
-					ray.distanceSqToSegment( line.start, line.end, point, pointOnLine );
+}
 
-					intersects.push( {
+class LineSegments2 extends Mesh {
 
-						point: point,
-						pointOnLine: pointOnLine,
-						distance: ray.origin.distanceTo( point ),
+	constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
 
-						object: this,
-						face: null,
-						faceIndex: i,
-						uv: null,
-						uv2: null,
+		super( geometry, material );
 
-					} );
+		this.isLineSegments2 = true;
 
-				}
+		this.type = 'LineSegments2';
 
-			}
+	}
 
-		};
+	// for backwards-compatibility, but could be a method of LineSegmentsGeometry...
 
-	}() )
+	computeLineDistances() {
 
-} );
+		const geometry = this.geometry;
+
+		const instanceStart = geometry.attributes.instanceStart;
+		const instanceEnd = geometry.attributes.instanceEnd;
+		const lineDistances = new Float32Array( 2 * instanceStart.count );
+
+		for ( let i = 0, j = 0, l = instanceStart.count; i < l; i ++, j += 2 ) {
+
+			_start.fromBufferAttribute( instanceStart, i );
+			_end.fromBufferAttribute( instanceEnd, i );
+
+			lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
+			lineDistances[ j + 1 ] = lineDistances[ j ] + _start.distanceTo( _end );
+
+		}
+
+		const instanceDistanceBuffer = new InstancedInterleavedBuffer( lineDistances, 2, 1 ); // d0, d1
+
+		geometry.setAttribute( 'instanceDistanceStart', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 0 ) ); // d0
+		geometry.setAttribute( 'instanceDistanceEnd', new InterleavedBufferAttribute( instanceDistanceBuffer, 1, 1 ) ); // d1
+
+		return this;
+
+	}
+
+	raycast( raycaster, intersects ) {
+
+		const worldUnits = this.material.worldUnits;
+		const camera = raycaster.camera;
+
+		if ( camera === null && ! worldUnits ) {
+
+			console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2 while worldUnits is set to false.' );
+
+		}
+
+		const threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
+
+		_ray = raycaster.ray;
+
+		const matrixWorld = this.matrixWorld;
+		const geometry = this.geometry;
+		const material = this.material;
+
+		_lineWidth = material.lineWidth + threshold;
+
+		_instanceStart = geometry.attributes.instanceStart;
+		_instanceEnd = geometry.attributes.instanceEnd;
+
+		// check if we intersect the sphere bounds
+		if ( geometry.boundingSphere === null ) {
+
+			geometry.computeBoundingSphere();
+
+		}
+
+		_sphere.copy( geometry.boundingSphere ).applyMatrix4( matrixWorld );
+
+		// increase the sphere bounds by the worst case line screen space width
+		let sphereMargin;
+		if ( worldUnits ) {
+
+			sphereMargin = _lineWidth * 0.5;
+
+		} else {
+
+			const distanceToSphere = Math.max( camera.near, _sphere.distanceToPoint( _ray.origin ) );
+			sphereMargin = getWorldSpaceHalfWidth( camera, distanceToSphere, material.resolution );
+
+		}
+
+		_sphere.radius += sphereMargin;
+
+		if ( _ray.intersectsSphere( _sphere ) === false ) {
+
+			return;
+
+		}
+
+		// check if we intersect the box bounds
+		if ( geometry.boundingBox === null ) {
+
+			geometry.computeBoundingBox();
+
+		}
+
+		_box.copy( geometry.boundingBox ).applyMatrix4( matrixWorld );
+
+		// increase the box bounds by the worst case line width
+		let boxMargin;
+		if ( worldUnits ) {
+
+			boxMargin = _lineWidth * 0.5;
+
+		} else {
+
+			const distanceToBox = Math.max( camera.near, _box.distanceToPoint( _ray.origin ) );
+			boxMargin = getWorldSpaceHalfWidth( camera, distanceToBox, material.resolution );
+
+		}
+
+		_box.expandByScalar( boxMargin );
+
+		if ( _ray.intersectsBox( _box ) === false ) {
+
+			return;
+
+		}
+
+		if ( worldUnits ) {
+
+			raycastWorldUnits( this, intersects );
+
+		} else {
+
+			raycastScreenSpace( this, camera, intersects );
+
+		}
+
+	}
+
+}
 
 export { LineSegments2 };

+ 76 - 95
libs/three.js/lines/LineSegmentsGeometry.js

@@ -9,32 +9,33 @@ import {
 	WireframeGeometry
 } from '../build/three.module.js';
 
-var LineSegmentsGeometry = function () {
+const _box = new Box3();
+const _vector = new Vector3();
 
-	InstancedBufferGeometry.call( this );
+class LineSegmentsGeometry extends InstancedBufferGeometry {
 
-	this.type = 'LineSegmentsGeometry';
+	constructor() {
 
-	var positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];
-	var uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];
-	var index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
+		super();
 
-	this.setIndex( index );
-	this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
-	this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
+		this.isLineSegmentsGeometry = true;
 
-};
+		this.type = 'LineSegmentsGeometry';
 
-LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGeometry.prototype ), {
+		const positions = [ - 1, 2, 0, 1, 2, 0, - 1, 1, 0, 1, 1, 0, - 1, 0, 0, 1, 0, 0, - 1, - 1, 0, 1, - 1, 0 ];
+		const uvs = [ - 1, 2, 1, 2, - 1, 1, 1, 1, - 1, - 1, 1, - 1, - 1, - 2, 1, - 2 ];
+		const index = [ 0, 2, 1, 2, 3, 1, 2, 4, 3, 4, 5, 3, 4, 6, 5, 6, 7, 5 ];
 
-	constructor: LineSegmentsGeometry,
+		this.setIndex( index );
+		this.setAttribute( 'position', new Float32BufferAttribute( positions, 3 ) );
+		this.setAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
-	isLineSegmentsGeometry: true,
+	}
 
-	applyMatrix4: function ( matrix ) {
+	applyMatrix4( matrix ) {
 
-		var start = this.attributes.instanceStart;
-		var end = this.attributes.instanceEnd;
+		const start = this.attributes.instanceStart;
+		const end = this.attributes.instanceEnd;
 
 		if ( start !== undefined ) {
 
@@ -60,11 +61,11 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		return this;
 
-	},
+	}
 
-	setPositions: function ( array ) {
+	setPositions( array ) {
 
-		var lineSegments;
+		let lineSegments;
 
 		if ( array instanceof Float32Array ) {
 
@@ -76,7 +77,7 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		}
 
-		var instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
+		const instanceBuffer = new InstancedInterleavedBuffer( lineSegments, 6, 1 ); // xyz, xyz
 
 		this.setAttribute( 'instanceStart', new InterleavedBufferAttribute( instanceBuffer, 3, 0 ) ); // xyz
 		this.setAttribute( 'instanceEnd', new InterleavedBufferAttribute( instanceBuffer, 3, 3 ) ); // xyz
@@ -88,11 +89,11 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		return this;
 
-	},
+	}
 
-	setColors: function ( array ) {
+	setColors( array ) {
 
-		var colors;
+		let colors;
 
 		if ( array instanceof Float32Array ) {
 
@@ -104,32 +105,32 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		}
 
-		var instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
+		const instanceColorBuffer = new InstancedInterleavedBuffer( colors, 6, 1 ); // rgb, rgb
 
 		this.setAttribute( 'instanceColorStart', new InterleavedBufferAttribute( instanceColorBuffer, 3, 0 ) ); // rgb
 		this.setAttribute( 'instanceColorEnd', new InterleavedBufferAttribute( instanceColorBuffer, 3, 3 ) ); // rgb
 
 		return this;
 
-	},
+	}
 
-	fromWireframeGeometry: function ( geometry ) {
+	fromWireframeGeometry( geometry ) {
 
 		this.setPositions( geometry.attributes.position.array );
 
 		return this;
 
-	},
+	}
 
-	fromEdgesGeometry: function ( geometry ) {
+	fromEdgesGeometry( geometry ) {
 
 		this.setPositions( geometry.attributes.position.array );
 
 		return this;
 
-	},
+	}
 
-	fromMesh: function ( mesh ) {
+	fromMesh( mesh ) {
 
 		this.fromWireframeGeometry( new WireframeGeometry( mesh.geometry ) );
 
@@ -137,117 +138,97 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 		return this;
 
-	},
-
-	fromLineSegments: function ( lineSegments ) {
-
-		var geometry = lineSegments.geometry;
-
-		if ( geometry.isGeometry ) {
-
-			this.setPositions( geometry.vertices );
+	}
 
-		} else if ( geometry.isBufferGeometry ) {
+	fromLineSegments( lineSegments ) {
 
-			this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
+		const geometry = lineSegments.geometry;
 
-		}
+		this.setPositions( geometry.attributes.position.array ); // assumes non-indexed
 
 		// set colors, maybe
 
 		return this;
 
-	},
-
-	computeBoundingBox: function () {
-
-		var box = new Box3();
-
-		return function computeBoundingBox() {
-
-			if ( this.boundingBox === null ) {
-
-				this.boundingBox = new Box3();
-
-			}
+	}
 
-			var start = this.attributes.instanceStart;
-			var end = this.attributes.instanceEnd;
+	computeBoundingBox() {
 
-			if ( start !== undefined && end !== undefined ) {
+		if ( this.boundingBox === null ) {
 
-				this.boundingBox.setFromBufferAttribute( start );
+			this.boundingBox = new Box3();
 
-				box.setFromBufferAttribute( end );
+		}
 
-				this.boundingBox.union( box );
+		const start = this.attributes.instanceStart;
+		const end = this.attributes.instanceEnd;
 
-			}
+		if ( start !== undefined && end !== undefined ) {
 
-		};
+			this.boundingBox.setFromBufferAttribute( start );
 
-	}(),
+			_box.setFromBufferAttribute( end );
 
-	computeBoundingSphere: function () {
+			this.boundingBox.union( _box );
 
-		var vector = new Vector3();
+		}
 
-		return function computeBoundingSphere() {
+	}
 
-			if ( this.boundingSphere === null ) {
+	computeBoundingSphere() {
 
-				this.boundingSphere = new Sphere();
+		if ( this.boundingSphere === null ) {
 
-			}
+			this.boundingSphere = new Sphere();
 
-			if ( this.boundingBox === null ) {
+		}
 
-				this.computeBoundingBox();
+		if ( this.boundingBox === null ) {
 
-			}
+			this.computeBoundingBox();
 
-			var start = this.attributes.instanceStart;
-			var end = this.attributes.instanceEnd;
+		}
 
-			if ( start !== undefined && end !== undefined ) {
+		const start = this.attributes.instanceStart;
+		const end = this.attributes.instanceEnd;
 
-				var center = this.boundingSphere.center;
+		if ( start !== undefined && end !== undefined ) {
 
-				this.boundingBox.getCenter( center );
+			const center = this.boundingSphere.center;
 
-				var maxRadiusSq = 0;
+			this.boundingBox.getCenter( center );
 
-				for ( var i = 0, il = start.count; i < il; i ++ ) {
+			let maxRadiusSq = 0;
 
-					vector.fromBufferAttribute( start, i );
-					maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
+			for ( let i = 0, il = start.count; i < il; i ++ ) {
 
-					vector.fromBufferAttribute( end, i );
-					maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( vector ) );
+				_vector.fromBufferAttribute( start, i );
+				maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
 
-				}
+				_vector.fromBufferAttribute( end, i );
+				maxRadiusSq = Math.max( maxRadiusSq, center.distanceToSquared( _vector ) );
 
-				this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
+			}
 
-				if ( isNaN( this.boundingSphere.radius ) ) {
+			this.boundingSphere.radius = Math.sqrt( maxRadiusSq );
 
-					console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );
+			if ( isNaN( this.boundingSphere.radius ) ) {
 
-				}
+				console.error( 'THREE.LineSegmentsGeometry.computeBoundingSphere(): Computed radius is NaN. The instanced position data is likely to have NaN values.', this );
 
 			}
 
-		};
+		}
 
-	}(),
+	}
 
-	toJSON: function () {
+	toJSON() {
 
 		// todo
 
-	},
+	}
 
-	applyMatrix: function ( matrix ) {
+	applyMatrix( matrix ) {
 
 		console.warn( 'THREE.LineSegmentsGeometry: applyMatrix() has been renamed to applyMatrix4().' );
 
@@ -255,6 +236,6 @@ LineSegmentsGeometry.prototype = Object.assign( Object.create( InstancedBufferGe
 
 	}
 
-} );
+}
 
 export { LineSegmentsGeometry };

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

@@ -5,7 +5,7 @@ import {
 	RGBA_S3TC_DXT5_Format,
 	RGB_ETC1_Format,
 	RGB_S3TC_DXT1_Format
-} from '../../../build/three.module.js';
+} from '../build/three.module.js';
 
 var DDSLoader = function ( manager ) {
 

+ 117 - 170
libs/three.js/loaders/DRACOLoader.js

@@ -3,89 +3,68 @@ import {
 	BufferGeometry,
 	FileLoader,
 	Loader
-} from '../../../build/three.module.js';
+} from '../build/three.module.js';
 
-var DRACOLoader = function ( manager ) {
+const _taskCache = new WeakMap();
 
-	Loader.call( this, manager );
+class DRACOLoader extends Loader {
 
-	this.decoderPath = '';
-	this.decoderConfig = {};
-	this.decoderBinary = null;
-	this.decoderPending = null;
+	constructor( manager ) {
 
-	this.workerLimit = 4;
-	this.workerPool = [];
-	this.workerNextTaskID = 1;
-	this.workerSourceURL = '';
+		super( manager );
 
-	this.defaultAttributeIDs = {
-		position: 'POSITION',
-		normal: 'NORMAL',
-		color: 'COLOR',
-		uv: 'TEX_COORD'
-	};
-	this.defaultAttributeTypes = {
-		position: 'Float32Array',
-		normal: 'Float32Array',
-		color: 'Float32Array',
-		uv: 'Float32Array'
-	};
+		this.decoderPath = '';
+		this.decoderConfig = {};
+		this.decoderBinary = null;
+		this.decoderPending = null;
 
-};
+		this.workerLimit = 4;
+		this.workerPool = [];
+		this.workerNextTaskID = 1;
+		this.workerSourceURL = '';
 
-DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
+		this.defaultAttributeIDs = {
+			position: 'POSITION',
+			normal: 'NORMAL',
+			color: 'COLOR',
+			uv: 'TEX_COORD'
+		};
+		this.defaultAttributeTypes = {
+			position: 'Float32Array',
+			normal: 'Float32Array',
+			color: 'Float32Array',
+			uv: 'Float32Array'
+		};
 
-	constructor: DRACOLoader,
+	}
 
-	setDecoderPath: function ( path ) {
+	setDecoderPath( path ) {
 
 		this.decoderPath = path;
 
 		return this;
 
-	},
+	}
 
-	setDecoderConfig: function ( config ) {
+	setDecoderConfig( config ) {
 
 		this.decoderConfig = config;
 
 		return this;
 
-	},
+	}
 
-	setWorkerLimit: function ( workerLimit ) {
+	setWorkerLimit( workerLimit ) {
 
 		this.workerLimit = workerLimit;
 
 		return this;
 
-	},
-
-	/** @deprecated */
-	setVerbosity: function () {
-
-		console.warn( 'THREE.DRACOLoader: The .setVerbosity() method has been removed.' );
-
-	},
-
-	/** @deprecated */
-	setDrawMode: function () {
-
-		console.warn( 'THREE.DRACOLoader: The .setDrawMode() method has been removed.' );
-
-	},
-
-	/** @deprecated */
-	setSkipDequantization: function () {
-
-		console.warn( 'THREE.DRACOLoader: The .setSkipDequantization() method has been removed.' );
-
-	},
+	}
 
-	load: function ( url, onLoad, onProgress, onError ) {
+	load( url, onLoad, onProgress, onError ) {
 
-		var loader = new FileLoader( this.manager );
+		const loader = new FileLoader( this.manager );
 
 		loader.setPath( this.path );
 		loader.setResponseType( 'arraybuffer' );
@@ -94,7 +73,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		loader.load( url, ( buffer ) => {
 
-			var taskConfig = {
+			const taskConfig = {
 				attributeIDs: this.defaultAttributeIDs,
 				attributeTypes: this.defaultAttributeTypes,
 				useUniqueIDs: false
@@ -106,12 +85,12 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		}, onProgress, onError );
 
-	},
+	}
 
 	/** @deprecated Kept for backward-compatibility with previous DRACOLoader versions. */
-	decodeDracoFile: function ( buffer, callback, attributeIDs, attributeTypes ) {
+	decodeDracoFile( buffer, callback, attributeIDs, attributeTypes ) {
 
-		var taskConfig = {
+		const taskConfig = {
 			attributeIDs: attributeIDs || this.defaultAttributeIDs,
 			attributeTypes: attributeTypes || this.defaultAttributeTypes,
 			useUniqueIDs: !! attributeIDs
@@ -119,16 +98,16 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		this.decodeGeometry( buffer, taskConfig ).then( callback );
 
-	},
+	}
 
-	decodeGeometry: function ( buffer, taskConfig ) {
+	decodeGeometry( buffer, taskConfig ) {
 
 		// TODO: For backward-compatibility, support 'attributeTypes' objects containing
 		// references (rather than names) to typed array constructors. These must be
 		// serialized before sending them to the worker.
-		for ( var attribute in taskConfig.attributeTypes ) {
+		for ( const attribute in taskConfig.attributeTypes ) {
 
-			var type = taskConfig.attributeTypes[ attribute ];
+			const type = taskConfig.attributeTypes[ attribute ];
 
 			if ( type.BYTES_PER_ELEMENT !== undefined ) {
 
@@ -140,13 +119,13 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		//
 
-		var taskKey = JSON.stringify( taskConfig );
+		const taskKey = JSON.stringify( taskConfig );
 
 		// Check for an existing task using this buffer. A transferred buffer cannot be transferred
 		// again from this thread.
-		if ( DRACOLoader.taskCache.has( buffer ) ) {
+		if ( _taskCache.has( buffer ) ) {
 
-			var cachedTask = DRACOLoader.taskCache.get( buffer );
+			const cachedTask = _taskCache.get( buffer );
 
 			if ( cachedTask.key === taskKey ) {
 
@@ -171,13 +150,13 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		//
 
-		var worker;
-		var taskID = this.workerNextTaskID ++;
-		var taskCost = buffer.byteLength;
+		let worker;
+		const taskID = this.workerNextTaskID ++;
+		const taskCost = buffer.byteLength;
 
 		// Obtain a worker and assign a task, and construct a geometry instance
 		// when the task completes.
-		var geometryPending = this._getWorker( taskID, taskCost )
+		const geometryPending = this._getWorker( taskID, taskCost )
 			.then( ( _worker ) => {
 
 				worker = _worker;
@@ -212,7 +191,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			} );
 
 		// Cache the task result.
-		DRACOLoader.taskCache.set( buffer, {
+		_taskCache.set( buffer, {
 
 			key: taskKey,
 			promise: geometryPending
@@ -221,11 +200,11 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		return geometryPending;
 
-	},
+	}
 
-	_createGeometry: function ( geometryData ) {
+	_createGeometry( geometryData ) {
 
-		var geometry = new BufferGeometry();
+		const geometry = new BufferGeometry();
 
 		if ( geometryData.index ) {
 
@@ -233,12 +212,12 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		}
 
-		for ( var i = 0; i < geometryData.attributes.length; i ++ ) {
+		for ( let i = 0; i < geometryData.attributes.length; i ++ ) {
 
-			var attribute = geometryData.attributes[ i ];
-			var name = attribute.name;
-			var array = attribute.array;
-			var itemSize = attribute.itemSize;
+			const attribute = geometryData.attributes[ i ];
+			const name = attribute.name;
+			const array = attribute.array;
+			const itemSize = attribute.itemSize;
 
 			geometry.setAttribute( name, new BufferAttribute( array, itemSize ) );
 
@@ -246,11 +225,11 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		return geometry;
 
-	},
+	}
 
-	_loadLibrary: function ( url, responseType ) {
+	_loadLibrary( url, responseType ) {
 
-		var loader = new FileLoader( this.manager );
+		const loader = new FileLoader( this.manager );
 		loader.setPath( this.decoderPath );
 		loader.setResponseType( responseType );
 		loader.setWithCredentials( this.withCredentials );
@@ -261,22 +240,22 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		} );
 
-	},
+	}
 
-	preload: function () {
+	preload() {
 
 		this._initDecoder();
 
 		return this;
 
-	},
+	}
 
-	_initDecoder: function () {
+	_initDecoder() {
 
 		if ( this.decoderPending ) return this.decoderPending;
 
-		var useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js';
-		var librariesPending = [];
+		const useJS = typeof WebAssembly !== 'object' || this.decoderConfig.type === 'js';
+		const librariesPending = [];
 
 		if ( useJS ) {
 
@@ -292,7 +271,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 		this.decoderPending = Promise.all( librariesPending )
 			.then( ( libraries ) => {
 
-				var jsContent = libraries[ 0 ];
+				const jsContent = libraries[ 0 ];
 
 				if ( ! useJS ) {
 
@@ -300,9 +279,9 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				}
 
-				var fn = DRACOLoader.DRACOWorker.toString();
+				const fn = DRACOWorker.toString();
 
-				var body = [
+				const body = [
 					'/* draco decoder */',
 					jsContent,
 					'',
@@ -316,15 +295,15 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		return this.decoderPending;
 
-	},
+	}
 
-	_getWorker: function ( taskID, taskCost ) {
+	_getWorker( taskID, taskCost ) {
 
 		return this._initDecoder().then( () => {
 
 			if ( this.workerPool.length < this.workerLimit ) {
 
-				var worker = new Worker( this.workerSourceURL );
+				const worker = new Worker( this.workerSourceURL );
 
 				worker._callbacks = {};
 				worker._taskCosts = {};
@@ -334,7 +313,7 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 				worker.onmessage = function ( e ) {
 
-					var message = e.data;
+					const message = e.data;
 
 					switch ( message.type ) {
 
@@ -365,32 +344,32 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 			}
 
-			var worker = this.workerPool[ this.workerPool.length - 1 ];
+			const worker = this.workerPool[ this.workerPool.length - 1 ];
 			worker._taskCosts[ taskID ] = taskCost;
 			worker._taskLoad += taskCost;
 			return worker;
 
 		} );
 
-	},
+	}
 
-	_releaseTask: function ( worker, taskID ) {
+	_releaseTask( worker, taskID ) {
 
 		worker._taskLoad -= worker._taskCosts[ taskID ];
 		delete worker._callbacks[ taskID ];
 		delete worker._taskCosts[ taskID ];
 
-	},
+	}
 
-	debug: function () {
+	debug() {
 
 		console.log( 'Task load: ', this.workerPool.map( ( worker ) => worker._taskLoad ) );
 
-	},
+	}
 
-	dispose: function () {
+	dispose() {
 
-		for ( var i = 0; i < this.workerPool.length; ++ i ) {
+		for ( let i = 0; i < this.workerPool.length; ++ i ) {
 
 			this.workerPool[ i ].terminate();
 
@@ -402,18 +381,18 @@ DRACOLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 	}
 
-} );
+}
 
 /* WEB WORKER */
 
-DRACOLoader.DRACOWorker = function () {
+function DRACOWorker() {
 
-	var decoderConfig;
-	var decoderPending;
+	let decoderConfig;
+	let decoderPending;
 
 	onmessage = function ( e ) {
 
-		var message = e.data;
+		const message = e.data;
 
 		switch ( message.type ) {
 
@@ -434,20 +413,20 @@ DRACOLoader.DRACOWorker = function () {
 				break;
 
 			case 'decode':
-				var buffer = message.buffer;
-				var taskConfig = message.taskConfig;
+				const buffer = message.buffer;
+				const taskConfig = message.taskConfig;
 				decoderPending.then( ( module ) => {
 
-					var draco = module.draco;
-					var decoder = new draco.Decoder();
-					var decoderBuffer = new draco.DecoderBuffer();
+					const draco = module.draco;
+					const decoder = new draco.Decoder();
+					const decoderBuffer = new draco.DecoderBuffer();
 					decoderBuffer.Init( new Int8Array( buffer ), buffer.byteLength );
 
 					try {
 
-						var geometry = decodeGeometry( draco, decoder, decoderBuffer, taskConfig );
+						const geometry = decodeGeometry( draco, decoder, decoderBuffer, taskConfig );
 
-						var buffers = geometry.attributes.map( ( attr ) => attr.array.buffer );
+						const buffers = geometry.attributes.map( ( attr ) => attr.array.buffer );
 
 						if ( geometry.index ) buffers.push( geometry.index.array.buffer );
 
@@ -475,13 +454,13 @@ DRACOLoader.DRACOWorker = function () {
 
 	function decodeGeometry( draco, decoder, decoderBuffer, taskConfig ) {
 
-		var attributeIDs = taskConfig.attributeIDs;
-		var attributeTypes = taskConfig.attributeTypes;
+		const attributeIDs = taskConfig.attributeIDs;
+		const attributeTypes = taskConfig.attributeTypes;
 
-		var dracoGeometry;
-		var decodingStatus;
+		let dracoGeometry;
+		let decodingStatus;
 
-		var geometryType = decoder.GetEncodedGeometryType( decoderBuffer );
+		const geometryType = decoder.GetEncodedGeometryType( decoderBuffer );
 
 		if ( geometryType === draco.TRIANGULAR_MESH ) {
 
@@ -505,15 +484,15 @@ DRACOLoader.DRACOWorker = function () {
 
 		}
 
-		var geometry = { index: null, attributes: [] };
+		const geometry = { index: null, attributes: [] };
 
 		// Gather all vertex attributes.
-		for ( var attributeName in attributeIDs ) {
+		for ( const attributeName in attributeIDs ) {
 
-			var attributeType = self[ attributeTypes[ attributeName ] ];
+			const attributeType = self[ attributeTypes[ attributeName ] ];
 
-			var attribute;
-			var attributeID;
+			let attribute;
+			let attributeID;
 
 			// A Draco file may be created with default vertex attributes, whose attribute IDs
 			// are mapped 1:1 from their semantic name (POSITION, NORMAL, ...). Alternatively,
@@ -553,13 +532,13 @@ DRACOLoader.DRACOWorker = function () {
 
 	function decodeIndex( draco, decoder, dracoGeometry ) {
 
-		var numFaces = dracoGeometry.num_faces();
-		var numIndices = numFaces * 3;
-		var byteLength = numIndices * 4;
+		const numFaces = dracoGeometry.num_faces();
+		const numIndices = numFaces * 3;
+		const byteLength = numIndices * 4;
 
-		var ptr = draco._malloc( byteLength );
+		const ptr = draco._malloc( byteLength );
 		decoder.GetTrianglesUInt32Array( dracoGeometry, byteLength, ptr );
-		var index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice();
+		const index = new Uint32Array( draco.HEAPF32.buffer, ptr, numIndices ).slice();
 		draco._free( ptr );
 
 		return { array: index, itemSize: 1 };
@@ -568,15 +547,15 @@ DRACOLoader.DRACOWorker = function () {
 
 	function decodeAttribute( draco, decoder, dracoGeometry, attributeName, attributeType, attribute ) {
 
-		var numComponents = attribute.num_components();
-		var numPoints = dracoGeometry.num_points();
-		var numValues = numPoints * numComponents;
-		var byteLength = numValues * attributeType.BYTES_PER_ELEMENT;
-		var dataType = getDracoDataType( draco, attributeType );
+		const numComponents = attribute.num_components();
+		const numPoints = dracoGeometry.num_points();
+		const numValues = numPoints * numComponents;
+		const byteLength = numValues * attributeType.BYTES_PER_ELEMENT;
+		const dataType = getDracoDataType( draco, attributeType );
 
-		var ptr = draco._malloc( byteLength );
+		const ptr = draco._malloc( byteLength );
 		decoder.GetAttributeDataArrayForAllPoints( dracoGeometry, attribute, dataType, byteLength, ptr );
-		var array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();
+		const array = new attributeType( draco.HEAPF32.buffer, ptr, numValues ).slice();
 		draco._free( ptr );
 
 		return {
@@ -603,38 +582,6 @@ DRACOLoader.DRACOWorker = function () {
 
 	}
 
-};
-
-DRACOLoader.taskCache = new WeakMap();
-
-/** Deprecated static methods */
-
-/** @deprecated */
-DRACOLoader.setDecoderPath = function () {
-
-	console.warn( 'THREE.DRACOLoader: The .setDecoderPath() method has been removed. Use instance methods.' );
-
-};
-
-/** @deprecated */
-DRACOLoader.setDecoderConfig = function () {
-
-	console.warn( 'THREE.DRACOLoader: The .setDecoderConfig() method has been removed. Use instance methods.' );
-
-};
-
-/** @deprecated */
-DRACOLoader.releaseDecoderModule = function () {
-
-	console.warn( 'THREE.DRACOLoader: The .releaseDecoderModule() method has been removed. Use instance methods.' );
-
-};
-
-/** @deprecated */
-DRACOLoader.getDecoderModule = function () {
-
-	console.warn( 'THREE.DRACOLoader: The .getDecoderModule() method has been removed. Use instance methods.' );
-
-};
+}
 
 export { DRACOLoader };

+ 92 - 35
libs/three.js/loaders/GLTFLoader.js

@@ -62,17 +62,38 @@ import {
 	VectorKeyframeTrack,
 	sRGBEncoding
 } from '../build/three.module.js';
+ 
+
+import {DRACOLoader} from './DRACOLoader.js'
+import {KTX2Loader} from './KTX2Loader.js'
+import { MeshoptDecoder } from '../libs/meshopt_decoder.module.js';
+import {DDSLoader} from './DDSLoader.js'
 
-var GLTFLoader = ( function () {
 
-	function GLTFLoader( manager ) {
 
+var GLTFLoader = ( function () {
+
+	function GLTFLoader( manager, renderer, urlPrefix) {
+ 
 		Loader.call( this, manager );
 
-		this.dracoLoader = null;
+		/* this.dracoLoader = null;
 		this.ddsLoader = null;
 		this.ktx2Loader = null;
-		this.meshoptDecoder = null;
+		this.meshoptDecoder = null; */
+        
+        //xzw add:
+        this.dracoLoader = new DRACOLoader;
+        this.ktx2Loader = new KTX2Loader
+        this.meshoptDecoder = MeshoptDecoder;
+        this.ddsLoader = new DDSLoader //这个没测过
+        
+        //路径相对于index.html  
+        this.dracoLoader.setDecoderPath( urlPrefix + 'three.js/loaders/draco/'  /*or 'https://unpkg.com/three@0.144.0/examples/js/libs/draco/gltf/' 版本可升级 */) //这两个路径可以自己改。在laser的环境也要放一份这个路径
+        this.ktx2Loader.setTranscoderPath(urlPrefix + 'three.js/loaders/ktx/' /*or 'https://unpkg.com/three@0.144.0/examples/js/libs/basis/' 版本可升级  */).detectSupport( renderer )
+            
+        //------------
+
 
 		this.pluginCallbacks = [];
 
@@ -118,7 +139,7 @@ var GLTFLoader = ( function () {
 
 		constructor: GLTFLoader,
 
-		load: function ( url, onLoad, onProgress, onError ) {
+		load: function ( url, onLoad, onProgress, onError   ) {
 
 			var scope = this;
 
@@ -167,23 +188,27 @@ var GLTFLoader = ( function () {
 			loader.setRequestHeader( this.requestHeader );
 			loader.setWithCredentials( this.withCredentials );
 
-			loader.load( url, function ( data ) {
+			loader.load( url, function ( data, total ) {// xzw add total 
+                console.log('数据加载成功', url.split('/').pop(), '  ,total: '+total)
+                let f = ()=>{
+                    try {
 
-				try {
+                        scope.parse( data, resourcePath, function ( gltf ) {
 
-					scope.parse( data, resourcePath, function ( gltf ) {
+                            onLoad( gltf, total );
 
-						onLoad( gltf );
+                            scope.manager.itemEnd( url );
 
-						scope.manager.itemEnd( url );
+                        }, _onError );
 
-					}, _onError );
+                    } catch ( e ) {
 
-				} catch ( e ) {
+                        _onError( e );
 
-					_onError( e );
-
-				}
+                    }
+                }
+                f()
+                //setTimeout(f,5000)/////////////////test
 
 			}, onProgress, _onError );
 
@@ -293,10 +318,9 @@ var GLTFLoader = ( function () {
 				crossOrigin: this.crossOrigin,
 				manager: this.manager,
 				ktx2Loader: this.ktx2Loader,
-				meshoptDecoder: this.meshoptDecoder
-
+				meshoptDecoder: this.meshoptDecoder, 
 			} );
-
+            parser.unlitMat = this.unlitMat//add
 			parser.fileLoader.setRequestHeader( this.requestHeader );
 
 			for ( var i = 0; i < this.pluginCallbacks.length; i ++ ) {
@@ -329,7 +353,7 @@ var GLTFLoader = ( function () {
 							extensions[ extensionName ] = new GLTFMaterialsPbrSpecularGlossinessExtension();
 							break;
 
-						case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION:
+						case EXTENSIONS.KHR_DRACO_MESH_COMPRESSION: 
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							break;
 
@@ -1009,7 +1033,7 @@ var GLTFLoader = ( function () {
 	function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
 
 		if ( ! dracoLoader ) {
-
+                
 			throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
 
 		}
@@ -1910,15 +1934,17 @@ var GLTFLoader = ( function () {
 
 		// Use an ImageBitmapLoader if imageBitmaps are supported. Moves much of the
 		// expensive work of uploading a texture to the GPU off the main thread.
-		if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
+		/* if ( typeof createImageBitmap !== 'undefined' && /Firefox/.test( navigator.userAgent ) === false ) {
 
 			this.textureLoader = new ImageBitmapLoader( this.options.manager );
 
-		} else {
+		} else { */
+        //为了防止chrome出现报错  The source image could not be decoded. 导致reject,改用TextureLoader  by xzw
 
 			this.textureLoader = new TextureLoader( this.options.manager );
 
-		}
+		//}
+ 
 
 		this.textureLoader.setCrossOrigin( this.options.crossOrigin );
 
@@ -2465,7 +2491,7 @@ var GLTFLoader = ( function () {
 	};
 
 	GLTFParser.prototype.loadTextureImage = function ( textureIndex, source, loader ) {
-
+         
 		var parser = this;
 		var json = this.json;
 		var options = this.options;
@@ -2512,26 +2538,57 @@ var GLTFLoader = ( function () {
 
 			return new Promise( function ( resolve, reject ) {
 
-				var onLoad = resolve;
-
-				if ( loader.isImageBitmapLoader === true ) {
-
-					onLoad = function ( imageBitmap ) {
+				/* var onLoad = resolve;
 
+				if ( loader.isImageBitmapLoader === true ) { 
+                    onLoad = function ( imageBitmap ) {
+                        //console.log('resolveURL onLoad',textureIndex )
 						resolve( new CanvasTexture( imageBitmap ) );
 
 					};
-
 				}
-
-				loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
+                */
+
+                //为了防止chrome出现报错  The source image could not be decoded. 导致reject,重新写贴图加载方式:
+
+                parser.textureLoader.load(sourceURI, (tex)=>{
+                    tex.minFilter = THREE.LinearMipmapLinearFilter //原本:NearestMipMapNearestFilter 闪烁
+                    //tex.needsUpdate
+                    resolve(tex) 
+                })  
+               
+                return;
+
+				loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined,   (e,url)=>{
+                    console.log('reject',textureIndex, arguments)
+                    if ( loader.isImageBitmapLoader === true ) {
+                        let img = new Image;
+                        img.setAttribute('crossOrigin', 'Anonymous')
+                        img.src = url; 
+                        resolve(new THREE.Texture(img))
+                        
+                        
+                        /* img.onload = ()=>{
+                            let canvas = document.createElement('canvas')
+                            let context = canvas.getContext('2d')
+                            context.canvas.width = img.width
+                            context.canvas.height = img.height
+                            context.drawImage(img, 0, 0, img.width, img.height)
+                            resolve( new CanvasTexture( canvas ) );   
+                            console.log('自己绘制 onload', textureIndex)
+                        } */
+                    }else{
+                        reject.apply(this,arguments)
+                    }
+                     
+                }  /*  ,  reject  */  );
 
 			} );
 
 		} ).then( function ( texture ) {
-
+            
 			// Clean up resources and configure Texture.
-
+            //console.log('texture', textureIndex, texture.image)
 			if ( isObjectURL === true ) {
 
 				URL.revokeObjectURL( sourceURI );
@@ -2728,7 +2785,7 @@ var GLTFLoader = ( function () {
 
 	GLTFParser.prototype.getMaterialType = function ( /* materialIndex */ ) {
 
-		return MeshStandardMaterial;
+		return this.unlitMat ? MeshBasicMaterial : MeshStandardMaterial;  //xzw add unlitMat
 
 	};
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 481 - 499
libs/three.js/loaders/KTX2Loader.js


+ 9 - 8
libs/three.js/loaders/MTLLoader.js

@@ -5,12 +5,12 @@ import {
 	FrontSide,
 	Loader,
 	LoaderUtils,
-	MeshPhongMaterial,
+	MeshStandardMaterial,//MeshPhongMaterial, 用MeshStandardMaterial好调些,因为遵循能量守恒
 	RepeatWrapping,
 	TextureLoader,
 	Vector2
-} from '../../../build/three.module.js';
-
+} from '../build/three.module.js';
+ 
 /**
  * Loads a Wavefront .mtl file specifying materials
  */
@@ -388,8 +388,8 @@ MTLLoader.MaterialCreator.prototype = {
 				case 'ks':
 
 					// Specular color (color when light is reflected from shiny surface) using RGB values
-					params.specular = new Color().fromArray( value );
-
+					//params.specular = new Color().fromArray( value );
+                    //console.log('specular',value)
 					break;
 
 				case 'ke':
@@ -452,8 +452,9 @@ MTLLoader.MaterialCreator.prototype = {
 					// The specular exponent (defines the focus of the specular highlight)
 					// A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
 
-					params.shininess = parseFloat( value );
-
+					//params.shininess = parseFloat( value );
+                    //console.log('shininess',value)
+                    
 					break;
 
 				case 'd':
@@ -489,7 +490,7 @@ MTLLoader.MaterialCreator.prototype = {
 
 		}
 
-		this.materials[ materialName ] = new MeshPhongMaterial( params );
+		this.materials[ materialName ] = new MeshStandardMaterial( params )//MeshPhongMaterial( params );
 		return this.materials[ materialName ];
 
 	},

+ 2 - 2
libs/three.js/loaders/OBJLoader.js

@@ -451,11 +451,11 @@ var OBJLoader = ( function () {
 			loader.setPath( this.path );
 			loader.setRequestHeader( this.requestHeader );
 			loader.setWithCredentials( this.withCredentials );
-			loader.load( url, function ( text ) {
+			loader.load( url, function ( text , total ) {// xzw add total 
 
 				try {
 
-					onLoad( scope.parse( text ) );
+					onLoad( scope.parse( text ) , total );
 
 				} catch ( e ) {
 

Diferenças do arquivo suprimidas por serem muito extensas
+ 52 - 0
libs/three.js/loaders/draco/draco_decoder.js


BIN
libs/three.js/loaders/draco/draco_decoder.wasm


Diferenças do arquivo suprimidas por serem muito extensas
+ 104 - 0
libs/three.js/loaders/draco/draco_wasm_wrapper.js


Diferenças do arquivo suprimidas por serem muito extensas
+ 21 - 0
libs/three.js/loaders/ktx/basis_transcoder.js


BIN
libs/three.js/loaders/ktx/basis_transcoder.wasm


+ 102 - 0
libs/utils/WorkerPool.js

@@ -0,0 +1,102 @@
+/**
+ * @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;
+
+	}
+
+}

+ 33 - 0
main.js

@@ -0,0 +1,33 @@
+const util = require('util');
+const child_process = require('child_process');
+const exec = util.promisify(child_process.exec);
+const fs = require('fs-extra')
+const PATH = `./.laser-lib-path`
+const inInit = fs.existsSync(PATH)
+const initLocal = inInit && fs.readFileSync(PATH).toString()
+const buildPaths = [
+	`build`,
+	...inInit ? [initLocal] : []
+]
+
+const runBuild = async () => {
+	console.log('正在进行打包')
+	await exec(`yarn build-c`);
+	console.log('打包已完成正在发布到git仓库')
+	if (initLocal) {
+		try {
+			await exec(`
+				cd ${initLocal}
+				git pull
+				git add -A
+				git commit -m 'fix: 更新sdk'
+				git push
+			`)
+			console.log('发布成功')
+		} catch {
+			console.error('自动发布失败,请手动上传')
+		}
+	}
+}
+
+runBuild()

BIN
note/images360.updateCube笔记.jpg


+ 16 - 0
note/note.js

@@ -0,0 +1,16 @@
+ 
+
+/*
+proj4 用法:   proj4(fromProjection[, toProjection, coordinates]) //see http://proj4js.org/
+
+美国GPS系统用的是EPSG:4326 (等价于WGS84) 
+查询define : 如 https://spatialreference.org/ref/epsg/31468/proj4/ 可得description: +proj=tmerc +lat_0=0 +lon_0=12 +k=1 +x_0=4500000 +y_0=0 +ellps=bessel +towgs84=598.1,73.7,418.2,0.202,0.045,-2.455,6.7 +units=m +no_defs
+
+fromProjection:源坐标系
+toProjection:目标坐标系
+coordinates:需要转换的坐标值,可以是对象{x:x,y:y},也可以是数组[x,y]
+
+tmerc : 笛卡尔坐标 本地 
+
+注:不同笛卡尔转经纬度可能得到的一致,说明笛卡尔的精度大于经纬度。
+*/

BIN
note/旋转平移中心(数据集校准).png


Diferenças do arquivo suprimidas por serem muito extensas
+ 7437 - 19
package-lock.json


+ 8 - 2
package.json

@@ -17,16 +17,22 @@
   ],
   "main": "./build/potree/potree.js",
   "scripts": {
-    "start": "gulp watch",
-    "build": "gulp build pack",
+    "start": "gulp watch -c development",
+    "build": "node main.js",
+    "build-c": "gulp build pack -c production",
     "postinstall": "npm run build"
   },
   "dependencies": {
+    "@babel/core": "^7.16.10",
+    "@babel/preset-env": "^7.16.10",
+    "fs-extra": "^10.0.0",
     "gulp": "^4.0.2",
     "gulp-concat": "^2.6.1",
     "gulp-connect": "^5.7.0",
     "json5": "^2.1.3",
     "rollup": "^1.31.1",
+    "rollup-plugin-babel": "^4.4.0",
+    "rollup-plugin-uglify": "^6.0.4",
     "through": "~2.3.4"
   },
   "author": "Markus Schütz",

BIN
resources/images/rotate-cursor.cur


BIN
resources/images/rotate-cursor.png


BIN
resources/textures/End_128.png


BIN
resources/textures/crosshair.png


BIN
resources/textures/explode.png


BIN
resources/textures/fire.png


BIN
resources/textures/icon-explode.png


BIN
resources/textures/icon-fire.png


BIN
resources/textures/icon-smoke.png


BIN
resources/textures/map_instruction_start_route.png


BIN
resources/textures/map_instruction_target_reached.png


BIN
resources/textures/map_marker.png


BIN
resources/textures/marker.png


BIN
resources/textures/pano_instruction_bottomMarker.png


BIN
resources/textures/pano_instruction_start_route.png


BIN
resources/textures/pano_instruction_target_reached.png


BIN
resources/textures/pic_location128.png


BIN
resources/textures/pic_location64.png


BIN
resources/textures/pic_point32.png


BIN
resources/textures/pic_point64.png


BIN
resources/textures/pic_point_s32.png


BIN
resources/textures/reticule-256x256.png


BIN
resources/textures/reticule_cross_hair.png


BIN
resources/textures/rotation_circle.png


BIN
resources/textures/routePoint_map_activeFloor.png


BIN
resources/textures/routePoint_map_fsna.png


BIN
resources/textures/routePoint_map_inactiveFloor.png


BIN
resources/textures/routePoint_panorama.png


BIN
resources/textures/smokeparticle.png


BIN
resources/textures/whiteCircle.png


+ 69 - 36
rollup.config.js

@@ -1,36 +1,69 @@
-export default [
-	{
-		input: 'src/Potree.js',
-		treeshake: false,
-		output: {
-			file: 'build/potree/potree.js',
-			format: 'umd',
-			name: 'Potree',
-			sourcemap: true,
-		}
-	},{
-		input: 'src/workers/BinaryDecoderWorker.js',
-		output: {
-			file: 'build/potree/workers/BinaryDecoderWorker.js',
-			format: 'es',
-			name: 'Potree',
-			sourcemap: false
-		}
-	},{
-		input: 'src/modules/loader/2.0/DecoderWorker.js',
-		output: {
-			file: 'build/potree/workers/2.0/DecoderWorker.js',
-			format: 'es',
-			name: 'Potree',
-			sourcemap: false
-		}
-	},{
-		input: 'src/modules/loader/2.0/DecoderWorker_brotli.js',
-		output: {
-			file: 'build/potree/workers/2.0/DecoderWorker_brotli.js',
-			format: 'es',
-			name: 'Potree',
-			sourcemap: false
-		}
-	}
-]
+const fs = require('fs-extra')
+const path = require('path')
+const babel = require('rollup-plugin-babel');
+const { uglify } = require('rollup-plugin-uglify');
+
+const PATH = `./.laser-lib-path`
+const buildPaths = [
+	`build`,
+	...fs.existsSync(PATH) ? [fs.readFileSync(PATH).toString()] : []
+]
+
+const builds = []
+
+for (const dir of buildPaths) {
+	builds.push(
+		...[
+			{
+				input: 'src/Potree.js',
+				treeshake: false,
+				output: {
+					file: `${dir}/potree/potree.js`,
+					format: 'umd',
+					name: 'Potree',
+					sourcemap: true,
+				}
+			}, {
+				input: 'src/workers/BinaryDecoderWorker.js',
+				output: {
+					file: `${dir}/potree/workers/BinaryDecoderWorker.js`,
+					format: 'es',
+					name: 'Potree',
+					sourcemap: false
+				}
+			},{
+				input: 'src/modules/loader/2.0/DecoderWorker.js',
+				output: {
+					file: `${dir}/potree/workers/2.0/DecoderWorker.js`,
+					format: 'es',
+					name: 'Potree',
+					sourcemap: false
+				}
+			},{
+				input: 'src/modules/loader/2.0/DecoderWorker_brotli.js',
+				output: {
+					file: `${dir}/potree/workers/2.0/DecoderWorker_brotli.js`,
+					format: 'es',
+					name: 'Potree',
+					sourcemap: false
+				}
+			}
+		]
+	)
+}
+
+if (process.env.npm_lifecycle_script.includes('production')) {
+	builds.forEach(item => {
+		item.output.sourcemap = false
+		item.plugins = [
+			babel({
+				exclude: "node_modules/**"
+			}),
+			// 压缩代码
+			uglify()
+		]
+	})
+}
+
+
+export default builds

+ 3 - 3
src/Actions.js

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

+ 10 - 5
src/Annotation.js

@@ -2,10 +2,9 @@
 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {Action} from "./Actions.js";
-import {Utils} from "./utils.js";
-import {EventDispatcher} from "./EventDispatcher.js";
+import {Utils} from "./utils.js"; 
 
-export class Annotation extends EventDispatcher {
+export class Annotation extends THREE.EventDispatcher {
 	constructor (args = {}) {
 		super();
 
@@ -27,6 +26,11 @@ export class Annotation extends 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;
@@ -68,10 +72,11 @@ export class Annotation extends 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);

+ 1 - 1
src/Enum.js

@@ -11,7 +11,7 @@ class EnumItem{
 	}
 };
 
-class Enum{
+class Enum{//??????做什么用的
 
 	constructor(object){
 		this.object = object;

+ 54 - 10
src/EventDispatcher.js

@@ -28,9 +28,9 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 // THE SOFTWARE.
 
+ 
 
-
-
+ 
 
 export class EventDispatcher{
 
@@ -38,7 +38,7 @@ export class EventDispatcher{
 		this._listeners = {};
 	}
 
-	addEventListener(type, listener){
+	addEventListener(type, listener, importance=0  ){//add importance
 
 		const listeners = this._listeners;
 
@@ -47,7 +47,8 @@ export class EventDispatcher{
 		}
 
 		if(listeners[type].indexOf(listener) === - 1){
-			listeners[type].push( listener );
+			listeners[type].push({ listener,  importance});
+            listeners[type] = listeners[type].sort((e,a)=> a.importance - e.importance)//add
 		}
 
 	}
@@ -66,11 +67,14 @@ 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);
+            
 		}
 
 	}
@@ -80,20 +84,60 @@ 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)){
-				listener.call(this, event);
+			for(let {listener} of listenerArray.slice(0)){
+				let result = listener.call(this, event);   //add stopContinue
+                if(result && result.stopContinue){
+                    break
+                }
 			}
 		}
 
 	}
-
+    
+    
+    //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 = {};
+        
+    }
+     
 }

+ 21 - 0
src/Features.js

@@ -1,4 +1,8 @@
 
+import browser from './utils/browser.js'
+
+
+
 let ftCanvas = document.createElement('canvas');
 
 export const Features = (function () {
@@ -67,6 +71,23 @@ export const Features = (function () {
 			}
 
 		},
+        //add:
+        EXT_DEPTH:{
+            isSupported: function () { 
+                if(browser.detectIOS()){
+                    let {major,minor,patch} = browser.iosVersion()
+                    if(major == 15 && minor == 4 && patch == 1){
+                        console.warn('检测到是ios15.4.1, 关闭EXT_frag_depth')//该版本ext_depth有问题,导致clear错乱。没有解决办法先关闭。
+                        return false
+                    }
+                }
+
+                return  gl.getExtension('EXT_frag_depth'); //shader中的GL_EXT_frag_depth需要判断一下detectIOS吗。。
+            }
+        },
+        
+         
+        
 		//WEBGL2: {
 		//	isSupported: function(){
 		//		return gl instanceof WebGL2RenderingContext;

+ 2 - 1
src/KeyCodes.js

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

+ 30 - 2
src/LRU.js

@@ -140,13 +140,41 @@ 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);

Diferenças do arquivo suprimidas por serem muito extensas
+ 1065 - 45
src/PointCloudOctree.js


+ 28 - 14
src/PointCloudOctreeGeometry.js

@@ -1,13 +1,13 @@
-
-
+ 
 import * as THREE from "../libs/three.js/build/three.module.js";
 import {PointCloudTreeNode} from "./PointCloudTree.js";
 import {XHRFactory} from "./XHRFactory.js";
 import {Utils} from "./utils.js";
 
-export class PointCloudOctreeGeometry{
+export class PointCloudOctreeGeometry extends THREE.EventDispatcher{
 
 	constructor(){
+        super()
 		this.url = null;
 		this.octreeDir = null;
 		this.spacing = 0;
@@ -92,7 +92,7 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		} else if (version.upTo('1.3')) {
 			url = this.pcoGeometry.octreeDir + '/' + this.name;
 		}
-
+       
 		return url;
 	}
 
@@ -117,7 +117,8 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		child.parent = this;
 	}
 
-	load(){
+	load(){  
+    
 		if (this.loading === true || this.loaded === true || Potree.numNodesLoading >= Potree.maxNodesLoading) {
 			return;
 		}
@@ -141,7 +142,7 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		this.pcoGeometry.loader.load(this);
 	}
 
-	loadHierachyThenPoints(){
+	loadHierachyThenPoints(pointcloud){
 		let node = this;
 
 		// load hierarchy
@@ -198,6 +199,8 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 				let parentName = name.substring(0, name.length - 1);
 				let parentNode = nodes[parentName];
 				let level = name.length - 1;
+                pco.dispatchEvent({type:'updateNodeMaxLevel',level});//add
+                
 				let boundingBox = Utils.createChildAABB(parentNode.boundingBox, index);
 
 				let currentNode = new PointCloudOctreeGeometryNode(name, pco, boundingBox);
@@ -211,8 +214,8 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 
 			let duration = performance.now() - tStart;
 			if(duration > 5){
-				let msg = `duration: ${duration}ms, numNodes: ${decoded.length}`;
-				console.log(msg);
+				/* let msg = `duration: ${duration}ms, numNodes: ${decoded.length}`;
+				console.log(msg); */
 			}
 
 			node.loadPoints();
@@ -220,7 +223,8 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		if ((node.level % node.pcoGeometry.hierarchyStepSize) === 0) {
 			// let hurl = node.pcoGeometry.octreeDir + "/../hierarchy/" + node.name + ".hrc";
 			let hurl = node.pcoGeometry.octreeDir + '/' + node.getHierarchyPath() + '/' + node.name + '.hrc';
-
+            hurl += '?m='+node.pcoGeometry.timeStamp //add
+            
 			let xhr = XHRFactory.createXMLHttpRequest();
 			xhr.open('GET', hurl, true);
 			xhr.responseType = 'arraybuffer';
@@ -240,14 +244,14 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 				xhr.send(null);
 			} catch (e) {
 				console.log('fehler beim laden der punktwolke: ' + e);
-			}
+			} 
 		}
-	}
+	} 
 
-	getNumPoints(){
+	getNumPoints(){  
 		return this.numPoints;
 	}
-
+ 
 	dispose(){
 		if (this.geometry && this.parent != null) {
 			this.geometry.dispose();
@@ -263,7 +267,17 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 			this.oneTimeDisposeHandlers = [];
 		}
 	}
-	
+    
+	traverse(t, e){//add from navvis 25.js
+        void 0 === e && (e = !0);
+        for (var n, i = e ? [this] : []; void 0 !== (n = i.pop()); ) {
+            t(n);
+            for (var o = 0, r = n.children; o < r.length; o++) {
+                var a = r[o];
+                null !== a && i.push(a)
+            }
+        }
+    }
 }
 
 PointCloudOctreeGeometryNode.IDCount = 0;

+ 3 - 4
src/PointCloudTree.js

@@ -1,9 +1,7 @@
 
-import * as THREE from "../libs/three.js/build/three.module.js";
-import { EventDispatcher } from "./EventDispatcher.js";
+import * as THREE from "../libs/three.js/build/three.module.js"; 
 
-
-export class PointCloudTreeNode extends EventDispatcher{
+export class PointCloudTreeNode extends THREE.EventDispatcher{
 
 	constructor(){
 		super();
@@ -42,6 +40,7 @@ export class PointCloudTreeNode extends EventDispatcher{
 export class PointCloudTree extends THREE.Object3D {
 	constructor () {
 		super();
+        //this.spriteGroup = new THREE.Object3D  //add
 	}
 
 	initialized () {

+ 224 - 24
src/Potree.js

@@ -1,3 +1,6 @@
+export {config, settings} from "./settings.js";
+export * from "./start.js";
+ 
 
 export * from "./Actions.js";
 export * from "./AnimationPath.js";
@@ -16,7 +19,7 @@ export * from "./Points.js";
 export * from "./Potree_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";
@@ -32,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";
@@ -41,23 +44,23 @@ export * from "./loader/PointAttributes.js";
 export * from "./loader/ShapefileLoader.js";
 export * from "./loader/GeoPackageLoader.js";
 
-export * from "./utils/Box3Helper.js";
-export * from "./utils/ClippingTool.js";
-export * from "./utils/ClipVolume.js";
+export * from "./objects/tool/Box3Helper.js";
+export * from "./objects/tool/ClippingTool.js";
+export * from "./objects/tool/ClipVolume.js";
 export * from "./utils/GeoTIFF.js";
-export * from "./utils/Measure.js";
-export * from "./utils/MeasuringTool.js";
+export * from "./objects/tool/Measure.js";
+export * from "./objects/tool/MeasuringTool.js";
 export * from "./utils/Message.js";
 export * from "./utils/PointCloudSM.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 "./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 "./viewer/viewer.js";
 export * from "./viewer/Scene.js";
@@ -67,7 +70,7 @@ 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";
@@ -75,12 +78,22 @@ 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";
+
+
+
+
+
+
+
 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";
@@ -95,8 +108,8 @@ 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;
@@ -128,9 +141,195 @@ let resourcePath = scriptPath + '/resources';
 export {scriptPath, resourcePath};
 
 
-export function loadPointCloud(path, name, callback){
+//add: 
+
+ 
+
+
+export async function loadFile(path, callback, onError){
+    if(Potree.fileServer){
+         
+        Potree.fileServer.get(path).then(data=>{ 
+            if(data.data)data = data.data
+            if(data.data)data = data.data //融合页面getdataset需要查找两次data
+            callback && callback(data)
+        }).catch(onError) 
+    }else{
+        try{
+            let response = await fetch(path); 
+            let text = await response.text();
+            var data = JSON.parse(text)
+            if(data.data) data = data.data
+            callback && callback(data)    
+            return data 
+        }catch(e){
+            onError && onError(e)
+        }
+          
+    }
+    
+    //查询: http://192.168.0.26:8080/doc.html#/default/filter-%E6%BC%AB%E6%B8%B8%E7%82%B9/filterUsingGET    
+}
+
+export async function loadDatasets(callback,sceneCode,onError){//之后直接把path写进来
+    let path 
+    sceneCode = sceneCode || Potree.settings.number
+    if(Potree.fileServer){
+        path = `/laser/dataset/${sceneCode}/getDataSet` 
+    }else{
+        
+        //path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/datasets`
+        //现在只能加载得了本地的了
+        path = `${Potree.settings.urls.prefix}/laser/dataset/${sceneCode}/getDataSet`
+        //path = `${Potree.scriptPath}/data/${sceneCode}/getDataSet.json`
+        
+    }
+    return loadFile(path, callback,onError)
+    
+}
+
+
+//目前上传平面图后如果不点击保存按钮,数据还是旧的不生效
+export async function loadMapEntity(datasetId, force){ 
+    if(!Potree.settings.floorplanEnable && !force && Potree.fileServer  )return /* 等待平面图类型定义好会加载 */
+     
+    
+    let loaded = 0
+    
+    let needLoads = datasetId == 'all' ? viewer.scene.pointclouds.map(e=>e.dataset_id) : [datasetId]
+    
+    
+    let callback = (dataset_id, floorplanType, data  )=>{
+        //要防止旧的比新的先获取到导致覆盖新的,因为两种type随时可能切换
+        if(floorplanType != Potree.settings.floorplanType[dataset_id]) return //如果请求的floorplanType不是当前最新的floorplanType就返回
+        
+        var map = viewer.mapViewer.mapLayer.maps.find(e => e.name == 'floorplan_'+ dataset_id)
+        if(map){  
+            viewer.mapViewer.mapLayer.removeMap(map)
+        } 
+        
+        var mapNew = viewer.mapViewer.mapLayer.addMapEntity(data.data || data,  dataset_id)
+        if(map){
+            mapNew.visibleReasons = map.visibleReasons 
+            mapNew.unvisibleReasons = map.unvisibleReasons 
+        }
+        loaded ++; 
+    } 
+    
+    needLoads.forEach(dataset_id=>{
+        let floorplanType = Potree.settings.floorplanType[dataset_id],  prefix = ''
+        if(!Potree.fileServer){   
+            prefix = Potree.settings.urls.prefix
+        }
+        if(!floorplanType)return
+        var path 
+        /* if(Potree.fileServer){ 
+            path = `/laser/tiledMap/${Potree.settings.number}/tiledMap/${floorplanType}/${dataset_id}` 
+        }else{
+            path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/tiled_maps`
+            
+        } */
+        path = `${prefix}/laser/tiledMap/${Potree.settings.number}/tiledMap/${floorplanType}/${dataset_id}` 
+        
+        Potree.settings.floorplanRequests[dataset_id] = true //开始加载了
+        return loadFile(path, callback.bind(this,  dataset_id, floorplanType)  )
+    })
+    
+     
+    
+}
+ 
+export async function loadPanos(datasetId, callback){
+    var path 
+    let query = `?datasetId=${datasetId}`                  //`?lat=${center.lat}&lon=${center.lon}&radius=200000`
+    if(Potree.fileServer){
+        path = `/laser/filter/${Potree.settings.number}/query` + query
+    }else{
+        //path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/images/filter` + query
+        //path = `${Potree.scriptPath}/data/${Potree.settings.number}/panos-${datasetId}.json`
+        path = `${Potree.settings.urls.prefix}/laser/filter/${Potree.settings.number}/query` + query
+       
+         
+    }
+    return loadFile(path, callback) 
+    
+}
+
+
+export async function loadPanosInfo(callback){ 
+    var path 
+    if(Potree.fileServer){
+        
+    }else{
+        path = `${Potree.scriptPath}/data/panoEdit/vision_edit.txt`
+          
+    }
+    return loadFile(path, callback)
+    
+}
+
+
+
+//site_model
+/* {
+    "area": 2503.30551910935,
+    "attributes": {},
+    "center": [
+        113.59568277455075,
+        22.366566635195288,
+        12.78751625
+    ],
+    "children": [],
+    "geometry_hash": 1891071345,
+    "id": 10,
+    "name": "港湾一号",
+    "parentId": null,
+    "polygon": {
+        "coordinates": [
+            [
+                [
+                    113.59590810534583,
+                    22.36679132753878
+                ],
+                [
+                    113.59590810534583,
+                    22.366807172528629
+                ],
+                [
+                    113.59545610274934,
+                    22.366807172528629
+                ],
+                [
+                    113.59545610274934,
+                    22.36679132753878
+                ]
+            ]
+        ],
+        "type": "Polygon"
+    },
+    "type": "BUILDING",
+    "volume": null,
+    "z_max": null,
+    "z_min": null
+}
+ */
+
+
+
+
+export function Log(value, color, fontSize){ 
+    color = color || '#13f'
+    fontSize = fontSize || 14
+    console.warn(`%c${value}`, `color:${color};font-size:${fontSize}px`) 
+}
+
+ 
+
+export function loadPointCloud(path, name, sceneCode, timeStamp, callback, onError){
 	let loaded = function(e){
 		e.pointcloud.name = name;
+        e.pointcloud.sceneCode = sceneCode //对应4dkk的场景码
+        
 		callback(e);
 	};
 
@@ -151,17 +350,18 @@ export function loadPointCloud(path, name, callback){
 				}
 			});
 		} else if (path.indexOf('cloud.js') > 0) {
-			POCLoader.load(path, function (geometry) {
+			POCLoader.load(path, timeStamp, function (geometry) {
 				if (!geometry) {
 					//callback({type: 'loading_failed'});
 					console.error(new Error(`failed to load point cloud from URL: ${path}`));
+                    onError && onError()
 				} else {
 					let pointcloud = new PointCloudOctree(geometry);
 					// loaded(pointcloud);
 					resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
 				}
 			});
-		} else if (path.indexOf('metadata.json') > 0) {
+		}/*  else if (path.indexOf('metadata.json') > 0) {  //部分浏览器(如uc)不支持NodeLoader中的1n的大数据写法
 			Potree.OctreeLoader.load(path).then(e => {
 				let geometry = e.geometry;
 
@@ -193,7 +393,7 @@ export function loadPointCloud(path, name, callback){
 					resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
 				}
 			});
-		} else if (path.indexOf('.vpc') > 0) {
+		}  */else if (path.indexOf('.vpc') > 0) {
 			PointCloudArena4DGeometry.load(path, function (geometry) {
 				if (!geometry) {
 					//callback({type: 'loading_failed'});

+ 197 - 28
src/PotreeRenderer.js

@@ -156,7 +156,7 @@ let attributeLocations = {
 class Shader {
 
 	constructor(gl, name, vsSource, fsSource) {
-		this.gl = gl;
+		this.gl = gl; 
 		this.name = name;
 		this.vsSource = vsSource;
 		this.fsSource = fsSource;
@@ -225,7 +225,20 @@ class Shader {
 
 			this.vs = gl.createShader(gl.VERTEX_SHADER);
 			this.fs = gl.createShader(gl.FRAGMENT_SHADER);
+            
+            
+            
+            
 			this.program = gl.createProgram();
+            
+            if(  !gl.isProgram(this.program  )){//创建失败  开启多个页面可能会,原因是webglcontextlost
+                //console.error('创建program失败');
+                viewer.dispatchEvent('webglError', {msg: 'potreeRenderer创建program失败'})
+                console.log(this.vs)
+                console.log(this.fs)
+                
+                return;
+            }
 
 			for(let name of Object.keys(attributeLocations)){
 				let location = attributeLocations[name].location;
@@ -245,7 +258,9 @@ class Shader {
 
 			gl.detachShader(program, this.vs);
 			gl.detachShader(program, this.fs);
+            
 
+            // 检测当前程序链接状态
 			let success = gl.getProgramParameter(program, gl.LINK_STATUS);
 			if (!success) {
 				let info = gl.getProgramInfoLog(program);
@@ -281,7 +296,7 @@ class Shader {
 			}
 
 			// uniform blocks
-			if(gl instanceof WebGL2RenderingContext){ 
+			if( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext){ //WebGL2RenderingContext在mac的safari14以下是没有定义的
 				let numBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);
 
 				for (let i = 0; i < numBlocks; i++) {
@@ -328,7 +343,7 @@ class Shader {
 		const tEnd = performance.now();
 		const duration = tEnd - tStart;
 
-		console.log(`shader compile duration: ${duration.toFixed(3)}`);
+		//console.log(`shader compile duration: ${duration.toFixed(3)}`);
 
 
 	}
@@ -456,8 +471,7 @@ class WebGLTexture {
 		this.gl = gl;
 
 		this.texture = texture;
-		this.id = gl.createTexture();
-
+		this.id = gl.createTexture(); 
 		this.target = gl.TEXTURE_2D;
 		this.version = -1;
 
@@ -508,7 +522,8 @@ class WebGLTexture {
 			gl.texImage2D(this.target, level, internalFormat,
 				width, height, border, srcFormat, srcType,
 				data);
-		} else if ((texture instanceof THREE.CanvasTexture) || (texture instanceof THREE.Texture)) {
+		}/* else if(texture instanceof THREE.CubeTexture){//add 
+        } */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));
@@ -545,7 +560,7 @@ export class Renderer {
 	constructor(threeRenderer) {
 		this.threeRenderer = threeRenderer;
 		this.gl = this.threeRenderer.getContext();
-
+  
 		this.buffers = new Map();
 		this.shaders = new Map();
 		this.textures = new Map();
@@ -676,7 +691,7 @@ export class Renderer {
 
 			let node = stack.pop();
 
-			if (node instanceof PointCloudTree) {
+			if (node instanceof PointCloudTree) { 
 				octrees.push(node);
 				continue;
 			}
@@ -1027,8 +1042,11 @@ export class Renderer {
 			}
 
 			let numPoints = webglBuffer.numElements;
-			gl.drawArrays(gl.POINTS, 0, numPoints);
-
+			 
+            gl.drawArrays(gl.POINTS, 0, numPoints); 
+            //gl.drawArrays(gl.TRIANGLES, 0, numPoints);
+            
+            
 			i++;
 		}
 
@@ -1039,6 +1057,10 @@ export class Renderer {
 			performance.measure("render.renderNodes", "renderNodes-start", "renderNodes-end");
 		}
 	}
+    
+    
+    
+    
 
 	renderOctree(octree, nodes, camera, target, params = {}){
 
@@ -1085,7 +1107,7 @@ export class Renderer {
 
 				this.shaders.set(material, shader);
 			}
-
+            
 			shader = this.shaders.get(material);
 
 			//if(material.needsUpdate){
@@ -1104,8 +1126,23 @@ export class Renderer {
 					`#define num_clipspheres ${numClipSpheres}`,
 					`#define num_clippolygons ${numClipPolygons}`,
 				];
-
-
+                
+                //add:-----------
+                if(material.usePanoMap){
+                    defines.push("#define usePanoMap");
+                }
+                
+                if(material.useFilterByNormal){
+                    defines.push("#define use_filter_by_normal");
+                    //Potree.settings.editType == 'pano' ? defines.push("#define attenuated_opacity2") : defines.push("#define attenuated_opacity");
+                    
+                }
+
+                
+                //---------------
+                
+                
+                
 				if(octree.pcoGeometry.root.isLoaded()){
 					let attributes = octree.pcoGeometry.root.geometry.attributes;
 
@@ -1149,7 +1186,7 @@ export class Renderer {
 
 				material.needsUpdate = false;
 			}
-
+             
 			for (let uniformName of Object.keys(material.uniforms)) {
 				let uniform = material.uniforms[uniformName];
 
@@ -1160,7 +1197,11 @@ export class Renderer {
 					if (!texture) {
 						continue;
 					}
-
+                    //add 
+                    if(uniformName == 'pano0Map' || uniformName == 'pano1Map' ){ //属于cubeTex,另外设置 
+                        continue
+                    } 
+                    
 					if (!this.textures.has(texture)) {
 						let webglTexture = new WebGLTexture(gl, texture);
 
@@ -1181,14 +1222,23 @@ export class Renderer {
 		if(params.transparent !== undefined){
 			transparent = params.transparent && material.opacity < 1;
 		}else{
-			transparent = material.opacity < 1;
+			transparent = material.usePanoMap ? false : (material.useFilterByNormal || material.opacity < 1); //add useFilterByNormal
 		}
 
 		if (transparent){
 			gl.enable(gl.BLEND);
-			gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
-			gl.depthMask(false);
-			gl.disable(gl.DEPTH_TEST);
+            
+            if(params.notAdditiveBlending){
+                gl.blendFuncSeparate( gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA ); //NormalBlending 
+                gl.enable(gl.DEPTH_TEST);
+                gl.depthMask(true); //如果不开启depthWrite,深度会错乱。 
+            }else{
+                gl.blendFunc(gl.SRC_ALPHA, gl.ONE); //AdditiveBlending   原本
+                gl.disable(gl.DEPTH_TEST);
+                gl.depthMask(false);
+            } 
+			
+			
 		} else {
 			gl.disable(gl.BLEND);
 			gl.depthMask(true);
@@ -1224,11 +1274,15 @@ export class Renderer {
 			shader.setUniformMatrix4("uViewInv", viewInv);
 			shader.setUniformMatrix4("uProjInv", projInv);
 
-			let screenWidth = target ? target.width : material.screenWidth;
+			/* let screenWidth = target ? target.width : material.screenWidth;
 			let screenHeight = target ? target.height : material.screenHeight;
 
 			shader.setUniform1f("uScreenWidth", screenWidth);
-			shader.setUniform1f("uScreenHeight", screenHeight);
+			shader.setUniform1f("uScreenHeight", screenHeight); */
+            
+            shader.setUniform2f('resolution', material.resolution.toArray())
+            
+            
 			shader.setUniform1f("fov", Math.PI * camera.fov / 180);
 			shader.setUniform1f("near", camera.near);
 			shader.setUniform1f("far", camera.far);
@@ -1289,7 +1343,7 @@ export class Renderer {
 			}
 
 
-			shader.setUniform1f("size", material.size);
+			shader.setUniform1f("size", material.usePanoMap ? Potree.config.material.absolutePanoramaSize * Math.min(window.devicePixelRatio,2) : material.size);//usePanoMap时控制在不大不小的范围内感觉较好,考虑到有的点云稀疏,用大一点的点
 			shader.setUniform1f("maxSize", material.uniforms.maxSize.value);
 			shader.setUniform1f("minSize", material.uniforms.minSize.value);
 
@@ -1302,7 +1356,7 @@ export class Renderer {
 			//uniform vec3 uColor;
 			shader.setUniform3f("uColor", material.color.toArray());
 			//uniform float opacity;
-			shader.setUniform1f("uOpacity", material.opacity);
+			shader.setUniform1f("uOpacity", material.usePanoMap ? 1: material.opacity);
 
 			shader.setUniform2f("elevationRange", material.elevationRange);
 			shader.setUniform2f("intensityRange", material.intensityRange);
@@ -1330,6 +1384,14 @@ export class Renderer {
 
 			shader.setUniform("backfaceCulling", material.uniforms.backfaceCulling.value);
 
+
+
+                
+          
+            //==========================
+            //gl.TEXTURE_CUBE_MAP: 34067
+            //gl.TEXTURE0=33984 , vnWebGLTexture.target=gl.TEXTURE_2D = 3353
+            
 			let vnWebGLTexture = this.textures.get(material.visibleNodesTexture);
 			if(vnWebGLTexture){
 				shader.setUniform1i("visibleNodesTexture", currentTextureBindingPoint);
@@ -1429,6 +1491,47 @@ export class Renderer {
 				}
 
 			}
+            
+            
+            
+
+
+
+            //=============add===========
+            
+            
+            
+            if(material.usePanoMap){//为什么pointsize失效 
+                shader.setUniform1f("progress", material.uniforms.progress.value);
+                shader.setUniform1f("easeInOutRatio", material.uniforms.easeInOutRatio.value);
+                shader.setUniform3f("pano0Position", material.uniforms.pano0Position.value.toArray());
+                shader.setUniform3f("pano1Position", material.uniforms.pano1Position.value.toArray()); 
+                shader.setUniform('pano0Matrix',  material.uniforms.pano0Matrix.value);
+                shader.setUniform('pano1Matrix',  material.uniforms.pano1Matrix.value);
+                
+                let pano0Map = material.uniforms.pano0Map.value
+                if(pano0Map){
+                    this.threeRenderer._textures.safeSetTextureCube( pano0Map, ++currentTextureBindingPoint );
+                          
+                    shader.setUniform1i('pano0Map', currentTextureBindingPoint);
+                }
+                let pano1Map = material.uniforms.pano1Map.value
+                if(pano1Map){
+                    this.threeRenderer._textures.safeSetTextureCube( pano1Map, ++currentTextureBindingPoint );
+                         
+                    shader.setUniform1i('pano1Map', currentTextureBindingPoint);
+                } 
+                
+                //注: three.js我添加了个 _textures,   safeSetTextureCube里主要就是activeTexture和bindTexture
+             
+            }   
+
+
+            
+            
+            
+            
+            
 		}
 
 		this.renderNodes(octree, nodes, visibilityTextureData, camera, target, shader, params);
@@ -1436,10 +1539,37 @@ export class Renderer {
 		gl.activeTexture(gl.TEXTURE2);
 		gl.bindTexture(gl.TEXTURE_2D, null);
 		gl.activeTexture(gl.TEXTURE0);
+        
+        
+        
+        //gl.bindTexture(gl.TEXTURE_2D, null); //add
+        
+        
+        
+        
+        //add  恢复为不透明(否则renderToCubeMap时的贴图会被渲染成高亮的颜色)
+        gl.disable(gl.BLEND);
+        gl.depthMask(true);
+        gl.enable(gl.DEPTH_TEST);
+            //DEPTH_TEST等需要恢复吗
+         
+        
 	}
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
 
-	render(scene, camera, target = null, params = {}) {
 
+	render(scene, camera, target = null, params = {}) {
+ 
 		const gl = this.gl;
 
 		// PREPARE 
@@ -1451,11 +1581,42 @@ export class Renderer {
 		// camera.matrixWorldInverse.invert(camera.matrixWorld);
 
 		const traversalResult = this.traverse(scene);
-
-
+        
+        //排序
+        if(Potree.settings.notAdditiveBlending){//add 
+            
+            traversalResult.octrees.forEach(tree=>{
+                if(tree.material.opacity==1){
+                    tree._z = Infinity //不透明的先渲染
+                }else{
+                    let center = tree.boundCenter ? tree.boundCenter.clone() : tree.boundingBox.getCenter(tree.boundCenter).applyMatrix4(tree.matrixWorld) 
+                    center.project(camera) 
+                    tree._z = center.z 
+                }
+            })   
+                 
+            traversalResult.octrees.sort((tree1,tree2)=>{ 
+                return tree2._z - tree1._z //降序  (-1 朝外)。 离屏幕近的后渲染
+            })
+        }
+        
+        
+        
+        
 		// RENDER
 		for (const octree of traversalResult.octrees) {
 			let nodes = octree.visibleNodes;
+            
+            
+            
+            /* nodes.sort((node1,node2)=>{//姑且
+                
+                let center = node.getBoundingSphere().center.clone().applyMatrix4(octree.matrixWorld)
+                return  
+                
+                
+            }) */
+            
 			this.renderOctree(octree, nodes, camera, target, params);
 		}
 
@@ -1473,10 +1634,18 @@ export class Renderer {
 
 };
 
+/* 
+中东的链接http://indoor.popsmart.cn:8094/zdoblh-yz/?vlon=5.14&vlat=-0.13&fov=100.0&pc=true&lon=121.61136592&lat=29.87855579&z=16.577
+geometry: 有的attributes: 属性是:
 
+classification:  
+color: 
+indices:  
+normal: 
+position:  
 
 
+最好有个spacing
 
 
-
-
+ */

+ 48 - 27
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 "./utils/Box3Helper.js";
-
-export function updatePointClouds(pointclouds, camera, renderer){
+import {Box3Helper} from "./objects/tool/Box3Helper.js";
 
+export function updatePointClouds(pointclouds,camera, areaSize /* renderer */){
+ 
 	for (let pointcloud of pointclouds) {
 		let start = performance.now();
 
@@ -19,22 +19,23 @@ export function updatePointClouds(pointclouds, camera, renderer){
 
 		let duration = performance.now() - start;
 	}
+    
+    
+	let result = updateVisibility(pointclouds, camera, areaSize  );
 
-	let result = updateVisibility(pointclouds, camera, renderer);
-
-	for (let pointcloud of pointclouds) {
-		pointcloud.updateMaterial(pointcloud.material, pointcloud.visibleNodes, camera, renderer);
+	for (let pointcloud of pointclouds) { 
+		//pointcloud.updateMaterial(pointcloud.material, pointcloud.visibleNodes, camera, renderer);//转移到渲染时
 		pointcloud.updateVisibleBounds();
 	}
 
-	exports.lru.freeMemory();
+	exports.lru.freeMemory();//即Potree.lru 能看到所有在加载的node
 
 	return result;
 };
 
 
 
-export function updateVisibilityStructures(pointclouds, camera, renderer) {
+export function updateVisibilityStructures(pointclouds, camera, areaSize) {
 	let frustums = [];
 	let camObjPositions = [];
 	let priorityQueue = new BinaryHeap(function (x) { return 1 / x.weight; });
@@ -74,8 +75,11 @@ export function updateVisibilityStructures(pointclouds, camera, renderer) {
 		let camMatrixObject = new THREE.Matrix4().multiply(worldI).multiply(view);
 		let camObjPos = new THREE.Vector3().setFromMatrixPosition(camMatrixObject);
 		camObjPositions.push(camObjPos);
-
-		if (pointcloud.visible && pointcloud.root !== null) {
+        
+        // 因漫游模式而隐藏的话 依旧需要加入visibleNodes,因为pick需要
+        
+                                                    /*  viewer.getObjVisiByReason(pointcloud, 'datasetSelection') */
+		if (pointcloud.visible || pointcloud.unvisibleReasons && pointcloud.unvisibleReasons.length == 1 && pointcloud.unvisibleReasons[0].reason == 'displayMode'   &&  pointcloud.root !== null) {//改 visible -> 
 			priorityQueue.push({pointcloud: i, node: pointcloud.root, weight: Number.MAX_VALUE});
 		}
 
@@ -100,7 +104,7 @@ export function updateVisibilityStructures(pointclouds, camera, renderer) {
 };
 
 
-export function updateVisibility(pointclouds, camera, renderer){
+export function updateVisibility(pointclouds, camera, areaSize){
 
 	let numVisibleNodes = 0;
 	let numVisiblePoints = 0;
@@ -114,15 +118,15 @@ export function updateVisibility(pointclouds, camera, renderer){
 	let lowestSpacing = Infinity;
 
 	// calculate object space frustum and cam pos and setup priority queue
-	let s = updateVisibilityStructures(pointclouds, camera, renderer);
+	let s = updateVisibilityStructures(pointclouds, camera, areaSize);//得到相机可见范围
 	let frustums = s.frustums;
 	let camObjPositions = s.camObjPositions;
 	let priorityQueue = s.priorityQueue;
 
 	let loadedToGPUThisFrame = 0;
 	
-	let domWidth = renderer.domElement.clientWidth;
-	let domHeight = renderer.domElement.clientHeight;
+	let domWidth = areaSize.x; //renderer.domElement.clientWidth;
+	let domHeight = areaSize.y;//renderer.domElement.clientHeight;
 
 	// check if pointcloud has been transformed
 	// some code will only be executed if changes have been detected
@@ -132,7 +136,7 @@ export function updateVisibility(pointclouds, camera, renderer){
 	let pointcloudTransformVersion = Potree._pointcloudTransformVersion;
 	for(let pointcloud of pointclouds){
 
-		if(!pointcloud.visible){
+		if(!viewer.getObjVisiByReason(pointcloud, 'datasetSelection')){//改 visible ->  
 			continue;
 		}
 
@@ -156,7 +160,8 @@ export function updateVisibility(pointclouds, camera, renderer){
 	}
 
 	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];
@@ -173,13 +178,13 @@ export function updateVisibility(pointclouds, camera, renderer){
 		let camObjPos = camObjPositions[element.pointcloud];
 
 		let insideFrustum = frustum.intersectsBox(box);
-		let maxLevel = pointcloud.maxLevel || Infinity;
+		let maxLevel = pointcloud.maxLevel == void 0 ? Infinity : pointcloud.maxLevel;
 		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){
@@ -301,7 +306,7 @@ export function updateVisibility(pointclouds, camera, renderer){
 				node = pointcloud.toTreeNode(node, parent);
 				loadedToGPUThisFrame++;
 			} else {
-				unloadedGeometry.push(node);
+				unloadedGeometry.push({pointcloud,node});
 				visibleGeometry.push(node);
 			}
 		}
@@ -320,8 +325,11 @@ export function updateVisibility(pointclouds, camera, renderer){
 			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) {
@@ -393,18 +401,17 @@ export function updateVisibility(pointclouds, camera, renderer){
 		}
 	}// 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].load();
+		unloadedGeometry[i].node.load(unloadedGeometry[i].pointcloud.pcoGeometry); 
 	}
 
 	return {
@@ -414,3 +421,17 @@ export function updateVisibility(pointclouds, camera, renderer){
 	};
 };
 
+
+//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 - 146
src/TextSprite.js

@@ -1,146 +0,0 @@
-
-
-// /**
-//  * adapted from http://stemkoski.github.io/Three.js/Sprite-Text-Labels.html
-//  */
-
-import * as THREE from "../libs/three.js/build/three.module.js";
-
-export class TextSprite extends THREE.Object3D{
-	
-	constructor(text){
-		super();
-
-		let texture = new THREE.Texture();
-		texture.minFilter = THREE.LinearFilter;
-		texture.magFilter = THREE.LinearFilter;
-		let spriteMaterial = new THREE.SpriteMaterial({
-			map: texture,
-			depthTest: false,
-			depthWrite: false});
-
-		this.texture = texture;
-
-		this.material = spriteMaterial;
-		//this.material = getRawMaterial(texture);
-		this.sprite = new THREE.Sprite(this.material);
-		this.add(this.sprite);
-
-		this.borderThickness = 4;
-		this.fontface = 'Arial';
-		this.fontsize = 28;
-		this.borderColor = { r: 0, g: 0, b: 0, a: 1.0 };
-		this.backgroundColor = { r: 255, g: 255, b: 255, a: 1.0 };
-		this.textColor = {r: 255, g: 255, b: 255, a: 1.0};
-		this.text = '';
-
-		this.setText(text);
-	}
-
-	setText(text){
-		if (this.text !== text){
-			this.text = text;
-
-			this.update();
-		}
-	}
-
-	setTextColor(color){
-		this.textColor = color;
-
-		this.update();
-	}
-
-	setBorderColor(color){
-		this.borderColor = color;
-
-		this.update();
-	}
-
-	setBackgroundColor(color){
-		this.backgroundColor = color;
-
-		this.update();
-	}
-
-	update(){
-		let canvas = document.createElement('canvas');
-		let context = canvas.getContext('2d');
-		context.font = 'Bold ' + this.fontsize + 'px ' + this.fontface;
-
-		// get size data (height depends only on font size)
-		let metrics = context.measureText(this.text);
-		let textWidth = metrics.width;
-		let margin = 5;
-		let spriteWidth = 2 * margin + textWidth + 2 * this.borderThickness;
-		let spriteHeight = this.fontsize * 1.4 + 2 * this.borderThickness;
-
-		context.canvas.width = spriteWidth;
-		context.canvas.height = spriteHeight;
-		context.font = 'Bold ' + this.fontsize + 'px ' + this.fontface;
-
-		// background color
-		context.fillStyle = 'rgba(' + this.backgroundColor.r + ',' + this.backgroundColor.g + ',' +
-			this.backgroundColor.b + ',' + this.backgroundColor.a + ')';
-		// border color
-		context.strokeStyle = 'rgba(' + this.borderColor.r + ',' + this.borderColor.g + ',' +
-			this.borderColor.b + ',' + this.borderColor.a + ')';
-
-		context.lineWidth = this.borderThickness;
-		this.roundRect(context, this.borderThickness / 2, this.borderThickness / 2,
-			textWidth + this.borderThickness + 2 * margin, this.fontsize * 1.4 + this.borderThickness, 6);
-
-		// text color
-		context.strokeStyle = 'rgba(0, 0, 0, 1.0)';
-		context.strokeText(this.text, this.borderThickness + margin, this.fontsize + this.borderThickness);
-
-		context.fillStyle = 'rgba(' + this.textColor.r + ',' + this.textColor.g + ',' +
-			this.textColor.b + ',' + this.textColor.a + ')';
-		context.fillText(this.text, this.borderThickness + margin, this.fontsize + this.borderThickness);
-
-		let texture = new THREE.Texture(canvas);
-		texture.minFilter = THREE.LinearFilter;
-		texture.magFilter = THREE.LinearFilter;
-		texture.needsUpdate = true;
-		//this.material.needsUpdate = true;
-
-		// { // screen-space sprite
-		// 	let [screenWidth, screenHeight] = [1620, 937];
-
-		// 	let uniforms = this.sprite.material.uniforms;
-		// 	let aspect = spriteHeight / spriteWidth;
-		// 	let factor = 0.5;
-
-		// 	let w = spriteWidth / screenWidth;
-		// 	let h = spriteHeight / screenHeight;
-
-		// 	uniforms.uScale.value = [2 * w, 2 * h];
-		// 	//uniforms.uScale.value = [factor * 1, factor * aspect];
-		//	this.sprite.material.uniforms.map.value = texture;
-		// }
-
-		this.sprite.material.map = texture;
-		this.texture = texture;
-
-		this.sprite.scale.set(spriteWidth * 0.01, spriteHeight * 0.01, 1.0);
-	}
-
-	roundRect(ctx, x, y, w, h, r){
-		ctx.beginPath();
-		ctx.moveTo(x + r, y);
-		ctx.lineTo(x + w - r, y);
-		ctx.quadraticCurveTo(x + w, y, x + w, y + r);
-		ctx.lineTo(x + w, y + h - r);
-		ctx.quadraticCurveTo(x + w, y + h, x + w - r, y + h);
-		ctx.lineTo(x + r, y + h);
-		ctx.quadraticCurveTo(x, y + h, x, y + h - r);
-		ctx.lineTo(x, y + r);
-		ctx.quadraticCurveTo(x, y, x + r, y);
-		ctx.closePath();
-		ctx.fill();
-		ctx.stroke();
-	}
-
-}
-
-

+ 121 - 5
src/defines.js

@@ -1,6 +1,6 @@
-
+import * as THREE from "../libs/three.js/build/three.module.js";
 import {Enum} from "./Enum.js";
-
+import math from "./utils/math.js";
 
 export const CameraMode = {
 	ORTHOGRAPHIC: 0,
@@ -26,11 +26,17 @@ export const ElevationGradientRepeat = {
 	MIRRORED_REPEAT: 2,
 };
 
-export const MOUSE = {
-	LEFT: 0b0001,
+export const Buttons = {// MouseEvent.buttons
+    //buttons,设置按下了鼠标哪些键,是一个3个比特位的二进制值,默认为0。1表示按下主键(通常是左键),2表示按下次要键(通常是右键),4表示按下辅助键(通常是中间的键)。
+	NONE:0,//add
+    
+    LEFT: 0b0001,
 	RIGHT: 0b0010,
 	MIDDLE: 0b0100
 };
+/*  如果访问的是button, 用THREE.MOUSE来判断:
+    button,设置按下了哪一个鼠标按键,默认为0。-1表示没有按键,0表示按下主键(通常是左键),1表示按下辅助键(通常是中间的键),2表示按下次要键(通常是右键)
+ */
 
 export const PointSizeType = {
 	FIXED: 0,
@@ -53,4 +59,114 @@ export const LengthUnits = {
 	METER: {code: 'm', unitspermeter: 1.0},
 	FEET: {code: 'ft', unitspermeter: 3.28084},
 	INCH: {code: '\u2033', unitspermeter: 39.3701}
-};
+};
+
+
+
+/////////// add //////////////////////////////////
+
+ 
+
+var GLCubeFaces = {
+    GL_TEXTURE_CUBE_MAP_POSITIVE_X: 0,
+    GL_TEXTURE_CUBE_MAP_NEGATIVE_X: 1,
+    GL_TEXTURE_CUBE_MAP_POSITIVE_Y: 2,
+    GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: 3,
+    GL_TEXTURE_CUBE_MAP_POSITIVE_Z: 4,
+    GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: 5
+};
+
+
+var PanoSizeClass = {
+    BASE: 1,
+    STANDARD: 2,
+    HIGH: 3,
+    ULTRAHIGH: 4
+};
+
+var PanoRendererEvents = {
+    PanoRenderComplete: "panorama.render.complete",
+    TileRenderFailure: "panorama.tile.render.failed",
+    TileRenderSuccess: "panorama.tile.render.success",
+    TileUploadAttempted: "panorama.tile.upload.attempted",
+    UploadAttemptedForAllTiles: "panorama.upload.attempted.all.tiles",
+    ZoomLevelRenderStarted: "panorama.zoom.render.started"
+};
+
+var SceneRendererEvents = {
+    ContextCreated: "scene-renderer-context-created",
+    AfterRender: "after-render",
+    MemoryUsageUpdated: "scene-renderer-memory-usage-updated"
+};
+
+
+var TileDownloaderEvents = {
+    TileDownloadSuccess: "tiledownloader.download.success",
+    TileDownloadFailure: "tiledownloader.download.failure",
+    PanoDownloadComplete: "tiledownloader.pano.download.complete"
+};
+
+var Vectors = {
+    UP: new THREE.Vector3(0,1,0),
+    DOWN: new THREE.Vector3(0,-1,0),
+    LEFT: new THREE.Vector3(-1,0,0),
+    RIGHT: new THREE.Vector3(1,0,0),
+    FORWARD: new THREE.Vector3(0,0,-1),
+    BACK: new THREE.Vector3(0,0,1)
+};
+var Vectors2 = {}
+for(var i in Vectors){
+    Vectors2[i] = math.convertVector.YupToZup(Vectors[i])  
+}
+
+
+
+var DownloadStatus = Object.freeze({
+    None: 0,
+    Queued: 1,
+    ForceQueued: 2,
+    Downloading: 3,
+    Downloaded: 4,
+    DownloadFailed: 5
+});
+var ModelManagerEvents = {
+    ModelAdded: "model-added",
+    ActiveModelChanged: "active-model-changed"
+};
+
+var PanoramaEvents = {
+
+    Enter: 'panorama.enter',
+    Exit: 'panorama.exit',
+
+    LoadComplete: "panorama.load.complete",
+    LoadFailed: "panorama.load.failed",
+    TileLoaded: "panorama.tile.loaded",
+    VideoRendered: "panorama.video.rendered"
+};
+ 
+
+
+
+
+export {GLCubeFaces,PanoSizeClass,PanoRendererEvents,SceneRendererEvents,
+TileDownloaderEvents,Vectors,Vectors2,DownloadStatus,ModelManagerEvents, PanoramaEvents,
+ 
+
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

+ 1 - 1
src/exporter/DXFExporter.js

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

+ 1 - 1
src/exporter/GeoJSONExporter.js

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

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

@@ -0,0 +1,437 @@
+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
+    }
+} */

+ 19 - 2
src/loader/BinaryLoader.js

@@ -5,6 +5,9 @@ import {Version} from "../Version.js";
 import {XHRFactory} from "../XHRFactory.js";
 
 
+
+
+//加载 解析点云
 export class BinaryLoader{
 
 	constructor(version, boundingBox, scale){
@@ -28,7 +31,8 @@ export class BinaryLoader{
 		if (this.version.equalOrHigher('1.4')) {
 			url += '.bin';
 		}
-
+        url += '?m='+node.pcoGeometry.timeStamp //add
+        
 		let xhr = XHRFactory.createXMLHttpRequest();
 		xhr.open('GET', url, true);
 		xhr.responseType = 'arraybuffer';
@@ -52,7 +56,7 @@ export class BinaryLoader{
 		}
 	};
 
-	parse(node, buffer){
+	parse(node, buffer){ //解析点云
 		let pointAttributes = node.pcoGeometry.pointAttributes;
 		let numPoints = buffer.byteLength / node.pcoGeometry.pointAttributes.byteSize;
 
@@ -133,7 +137,20 @@ export class BinaryLoader{
 			node.loading = false;
 			node.estimatedSpacing = data.estimatedSpacing;
 			Potree.numNodesLoading--;
+            
+            
+            
+             
+            
+            
+            
+            
+            
+            
+            
 		};
+ 
+
 
 		let message = {
 			buffer: buffer,

+ 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
 				} );

+ 83 - 7
src/loader/POCLoader.js

@@ -8,6 +8,65 @@ import {BinaryLoader} from "./BinaryLoader.js";
 import {Utils} from "../utils.js";
 import {PointAttribute, PointAttributes, PointAttributeTypes} from "./PointAttributes.js";
 
+
+var transformFrom4dkk = function(name){
+    var jsAttribute = PointAttribute[name] 
+    return jsAttribute
+    /* if(name == "POSITION_CARTESIAN"){
+        jsAttribute = {
+            description: "",
+            elementSize: 4,
+            elements: 3,
+            name: "POSITION_CARTESIAN",
+            size: 12,
+            type: "int32",
+        }
+    }else if(name == "COLOR_PACKED"){
+        jsAttribute = {
+            description: "" ,
+            elementSize: 1,
+            elements: 4,
+            name: "RGBA",
+            size: 4,
+            type: 'int8', 
+        }
+    }else if(name == "NORMAL_OCT16"){
+       
+        jsAttribute = {
+            description: "" ,
+            elementSize: 4,
+            elements: 2,
+            name: "NORMAL_OCT16",
+            size: 12,
+            type: "uint8",
+        }
+    } */
+    /*  var Q = q(L.COLOR_PACKED, K.DATA_TYPE_INT8, 4)
+    POSITION_CARTESIAN: q(L.POSITION_CARTESIAN, K.DATA_TYPE_FLOAT, 3),
+    RGBA_PACKED: Q,
+    COLOR_PACKED: Q,
+    RGB_PACKED: q(L.COLOR_PACKED, K.DATA_TYPE_INT8, 3),
+    NORMAL_FLOATS: q(L.NORMAL_FLOATS, K.DATA_TYPE_FLOAT, 3),
+    FILLER_1B: q(L.FILLER, K.DATA_TYPE_UINT8, 1),
+    INTENSITY: q(L.INTENSITY, K.DATA_TYPE_UINT16, 1),
+    CLASSIFICATION: q(L.CLASSIFICATION, K.DATA_TYPE_UINT8, 1),
+    NORMAL_SPHEREMAPPED: q(L.NORMAL_SPHEREMAPPED, K.DATA_TYPE_UINT8, 2),
+    NORMAL_OCT16: q(L.NORMAL_OCT16, K.DATA_TYPE_UINT8, 2),
+    NORMAL: q(L.NORMAL, K.DATA_TYPE_FLOAT, 3) */
+    
+}
+    
+
+
+
+
+
+
+
+
+
+
+
 function parseAttributes(cloudjs){
 
 	let version = new Version(cloudjs.version);
@@ -67,7 +126,15 @@ function parseAttributes(cloudjs){
 			float:  PointAttributeTypes.DATA_TYPE_FLOAT,
 		};
 
-		for(const jsAttribute of pointAttributes){
+		for(let jsAttribute of pointAttributes){
+            
+            if(jsAttribute.name == void 0){//是来自四维看看的数据
+                //attribute = transformFrom4dkk(jsAttribute)
+                var attribute_ = PointAttribute[jsAttribute] 
+                attributes.add(attribute_);
+                continue;
+            }
+            
 			const name = replaceOldNames(jsAttribute.name);
 			const type = typeConversion[jsAttribute.type];
 			const numElements = jsAttribute.elements;
@@ -118,12 +185,14 @@ function lasLazAttributes(fMno){
 
 export class POCLoader {
 
-	static load(url, callback){
+	static load(url, timeStamp, callback){ //add timeStamp
 		try {
 			let pco = new PointCloudOctreeGeometry();
+            pco.timeStamp = timeStamp
+            
 			pco.url = url;
 			let xhr = XHRFactory.createXMLHttpRequest();
-			xhr.open('GET', url, true);
+			xhr.open('GET', url+'?m='+timeStamp, true);  
 
 			xhr.onreadystatechange = function () {
 				if (xhr.readyState === 4 && (xhr.status === 200 || xhr.status === 0)) {
@@ -148,20 +217,27 @@ export class POCLoader {
 					let boundingBox = new THREE.Box3(min, max);
 					let tightBoundingBox = boundingBox.clone();
 
-					if (fMno.tightBoundingBox) {
+					if (fMno.tightBoundingBox) {//这个才是真实的bounding,前面那个bounding的size是个正方体,似乎取了最长边作为边长
 						tightBoundingBox.min.copy(new THREE.Vector3(fMno.tightBoundingBox.lx, fMno.tightBoundingBox.ly, fMno.tightBoundingBox.lz));
 						tightBoundingBox.max.copy(new THREE.Vector3(fMno.tightBoundingBox.ux, fMno.tightBoundingBox.uy, fMno.tightBoundingBox.uz));
 					}
+                    
+					let offset = min.clone(); //将成为点云的position,被我用作旋转中心(但在点云中不那么居中,navvis也是这样, 这样可能是为了让模型在这数据的bounding上)
+
+
 
-					let offset = min.clone();
 
-					boundingBox.min.sub(offset);
+					boundingBox.min.sub(offset);   //点云的真实坐标的min都是0,0,0吗(我看案例是,因绕角落旋转,也就是原点)
+                    
 					boundingBox.max.sub(offset);
 
 					tightBoundingBox.min.sub(offset);
 					tightBoundingBox.max.sub(offset);
 
-					pco.projection = fMno.projection;
+                    //改
+					//pco.projection = fMno.projection ||  "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs ",
+                        //"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" //给地图
+                    
 					pco.boundingBox = boundingBox;
 					pco.tightBoundingBox = tightBoundingBox;
 					pco.boundingSphere = boundingBox.getBoundingSphere(new THREE.Sphere());

+ 0 - 0
src/loader/PointAttributes.js


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff