Browse Source

更新最新版potree

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

BIN
.DS_Store


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


+ 3 - 0
README.md

@@ -481,6 +481,9 @@ 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>

BIN
build/potree/resources/textures/icon-explode.png


BIN
build/potree/resources/textures/icon-fire.png


BIN
build/potree/resources/textures/icon-smoke.png


+ 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


+ 0 - 114
examples/360-test.html

@@ -1,114 +0,0 @@
-<!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>

+ 0 - 79
examples/4dkk.html

@@ -1,79 +0,0 @@
-<!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>

+ 1 - 0
examples/ca13.html

@@ -27,6 +27,7 @@
 	<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 -->

+ 0 - 79
examples/pano.html

@@ -1,79 +0,0 @@
-<!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>

+ 262 - 317
examples/resources/sorvilier.json

@@ -1,503 +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,
+	"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: [
-			590044.2281658746,
-			231687.47696911512,
-			967.1205078136775,
-		],
-		target: [
-			590043.3985338517,
-			231685.8457774173,
-			966.1351601839054,
+	"view": {
+		"position": [
+			589974.341,
+			231698.397,
+			986.146
 		],
+		"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: [
-				1,
+			"scale": [
 				1,
 				1,
+				1
 			],
-			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',
-			},
-		},
+			"activeAttributeName": "rgba"
+		}
 	],
-	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
 			],
-			offset: [
+			"children": [],
+			"offset": [
 				0,
 				0,
-				0,
-			],
-			children: [],
-			cameraPosition: [
-				590034.03,
-				231814.02,
-				961.68,
+				0
 			],
-			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: [
+			"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,
+				770.94
 			],
-			offset: [
-				0,
+			"offset": [
 				0,
 				0,
-			],
-			children: [],
-			cameraTarget: [
-				589850.15,
-				231300.1,
-				770.94,
-			],
+				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>',
-			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>",
+			"children": [],
+			"position": [
 				590043.63,
 				231490.79,
-				740.78,
-			],
-			offset: [
-				0,
-				0,
-				0,
-			],
-			children: [],
-			cameraPosition: [
-				590105.53,
-				231541.63,
-				782.05,
-			],
-			cameraTarget: [
-				590043.63,
-				231488.79,
-				740.78,
+				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',
-			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",
+			"children": [],
+			"position": [
 				589621,
 				231437,
-				784,
+				784
 			],
-			offset: [
-				0,
-				0,
-				0,
-			],
-			children: [],
-			cameraPosition: [
+			"cameraPosition": [
 				589585.81,
 				231463.63,
-				804,
+				804
 			],
-			cameraTarget: [
+			"cameraTarget": [
 				589625.86,
 				231439,
-				775.38,
-			],
-		},
+				775.38
+			]
+		}
 	],
-	orientedImages: [],
-	geopackages: [],
+	"objects": []
 }

+ 0 - 448
examples/resources/sorvilier2.json

@@ -1,448 +0,0 @@
-{
-	"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): 

+ 1 - 12
gulpfile.js

@@ -72,24 +72,13 @@ 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: 5000,
-        host:'0.0.0.0',
+		port: 1234,
 		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>
+

+ 21 - 0
libs/stats.js/LICENSE

@@ -0,0 +1,21 @@
+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.

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

@@ -0,0 +1,56 @@
+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);})()
+```

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

@@ -0,0 +1,179 @@
+(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;
+
+})));

File diff suppressed because it is too large
+ 5 - 0
libs/stats.js/stats.min.js


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

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

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

@@ -208,7 +208,7 @@ function EventDispatcher() {}
 
 Object.assign( EventDispatcher.prototype, {
 
-	addEventListener: function ( type, listener, importance=0 ) {//add importance
+	addEventListener: function ( type, listener ) {
 
 		if ( this._listeners === undefined ) this._listeners = {};
 
@@ -220,10 +220,10 @@ Object.assign( EventDispatcher.prototype, {
 
 		}
 
-		if ( !listeners[ type ].some(e=>e.listener == listener )  ) { 
-			//listeners[ type ].push( listener );
-            listeners[type].push({ listener,  importance});
-            listeners[type] = listeners[type].sort((e,a)=> a.importance - e.importance)//add
+		if ( listeners[ type ].indexOf( listener ) === - 1 ) {
+
+			listeners[ type ].push( listener );
+
 		}
 
 	},
@@ -234,7 +234,7 @@ Object.assign( EventDispatcher.prototype, {
 
 		const listeners = this._listeners;
 
-		return listeners[ type ] !== undefined &&  listeners[ type ].some(e=>e.listener == listener )    
+		return listeners[ type ] !== undefined && listeners[ type ].indexOf( listener ) !== - 1;
 
 	},
 
@@ -247,36 +247,20 @@ 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);
+			}
 
 		}
 
 	},
-    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}
-        }
+
+	dispatchEvent: function ( event ) {
+
 		if ( this._listeners === undefined ) return;
 
 		const listeners = this._listeners;
@@ -287,18 +271,18 @@ Object.assign( EventDispatcher.prototype, {
 			event.target = this;
 
 			// Make a copy, in case listeners are removed while iterating.
-			 
-            for(let {listener} of listenerArray.slice(0)){
-				let result = listener.call(this, event);   //add stopContinue
-                if(result && result.stopContinue){
-                    break
-                }
+			const array = listenerArray.slice( 0 );
+
+			for ( let i = 0, l = array.length; i < l; i ++ ) {
+
+				array[ i ].call( this, event );
+
 			}
 
 		}
 
 	}
-    
+
 } );
 
 const _lut = [];
@@ -6845,11 +6829,8 @@ Object3D.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 
 	traverse: function ( callback ) {
 
-		let result = callback( this );
-        if(result && result.stopContinue){//xzw add
-            return 
-        }
-             
+		callback( this );
+
 		const children = this.children;
 
 		for ( let i = 0, l = children.length; i < l; i ++ ) {
@@ -8543,7 +8524,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;
 
 			}
@@ -8715,7 +8696,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( this.polygonOffsetFactor !== 0 ) data.polygonOffsetFactor = this.polygonOffsetFactor;
 		if ( this.polygonOffsetUnits !== 0 ) data.polygonOffsetUnits = this.polygonOffsetUnits;
 
-		if ( this.lineWidth && this.lineWidth !== 1 ) data.lineWidth = this.lineWidth;
+		if ( this.linewidth && this.linewidth !== 1 ) data.linewidth = this.linewidth;
 		if ( this.dashSize !== undefined ) data.dashSize = this.dashSize;
 		if ( this.gapSize !== undefined ) data.gapSize = this.gapSize;
 		if ( this.scale !== undefined ) data.scale = this.scale;
@@ -8726,7 +8707,7 @@ Material.prototype = Object.assign( Object.create( EventDispatcher.prototype ),
 		if ( this.premultipliedAlpha === true ) data.premultipliedAlpha = this.premultipliedAlpha;
 
 		if ( this.wireframe === true ) data.wireframe = this.wireframe;
-		if ( this.wireframelineWidth > 1 ) data.wireframelineWidth = this.wireframelineWidth;
+		if ( this.wireframeLinewidth > 1 ) data.wireframeLinewidth = this.wireframeLinewidth;
 		if ( this.wireframeLinecap !== 'round' ) data.wireframeLinecap = this.wireframeLinecap;
 		if ( this.wireframeLinejoin !== 'round' ) data.wireframeLinejoin = this.wireframeLinejoin;
 
@@ -8900,7 +8881,7 @@ Object.defineProperty( Material.prototype, 'needsUpdate', {
  *  depthWrite: <bool>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>
@@ -8933,7 +8914,7 @@ function MeshBasicMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -8973,7 +8954,7 @@ MeshBasicMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -11719,7 +11700,7 @@ var default_fragment = "void main() {\n\tgl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0
  *  vertexShader: <string>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  lights: <bool>,
  *
@@ -11741,10 +11722,10 @@ function ShaderMaterial( parameters ) {
 	this.vertexShader = default_vertex;
 	this.fragmentShader = default_fragment;
 
-	this.lineWidth = 1;
+	this.linewidth = 1;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false; // set to use scene fog
 	this.lights = false; // set to use scene lights
@@ -11805,7 +11786,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;
@@ -17467,13 +17448,7 @@ 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 );
@@ -18896,7 +18871,7 @@ function WebGLRenderStates( extensions, capabilities ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  * }
  */
 
@@ -18920,7 +18895,7 @@ function MeshDepthMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -18951,7 +18926,7 @@ MeshDepthMaterial.prototype.copy = function ( source ) {
 	this.displacementBias = source.displacementBias;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 
 	return this;
 
@@ -19396,8 +19371,8 @@ function WebGLShadowMap( _renderer, _objects, maxTextureSize ) {
 		result.clippingPlanes = material.clippingPlanes;
 		result.clipIntersection = material.clipIntersection;
 
-		result.wireframelineWidth = material.wireframelineWidth;
-		result.lineWidth = material.lineWidth;
+		result.wireframeLinewidth = material.wireframeLinewidth;
+		result.linewidth = material.linewidth;
 
 		if ( light.isPointLight === true && result.isMeshDistanceMaterial === true ) {
 
@@ -19799,7 +19774,7 @@ function WebGLState( gl, extensions, capabilities ) {
 	let currentFlipSided = null;
 	let currentCullFace = null;
 
-	let currentlineWidth = null;
+	let currentLineWidth = null;
 
 	let currentPolygonOffsetFactor = null;
 	let currentPolygonOffsetUnits = null;
@@ -20168,13 +20143,13 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	}
 
-	function setlineWidth( width ) {
+	function setLineWidth( width ) {
 
-		if ( width !== currentlineWidth ) {
+		if ( width !== currentLineWidth ) {
 
 			if ( lineWidthAvailable ) gl.lineWidth( width );
 
-			currentlineWidth = width;
+			currentLineWidth = width;
 
 		}
 
@@ -20365,7 +20340,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		currentFlipSided = null;
 		currentCullFace = null;
 
-		currentlineWidth = null;
+		currentLineWidth = null;
 
 		currentPolygonOffsetFactor = null;
 		currentPolygonOffsetUnits = null;
@@ -20395,7 +20370,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		setFlipSided: setFlipSided,
 		setCullFace: setCullFace,
 
-		setlineWidth: setlineWidth,
+		setLineWidth: setLineWidth,
 		setPolygonOffset: setPolygonOffset,
 
 		setScissorTest: setScissorTest,
@@ -23616,8 +23591,6 @@ function WebGLRenderer( parameters ) {
 		_this.state = state;
 		_this.info = info;
 
-        _this._textures = textures;//add 
-        
 	}
 
 	initGLContext();
@@ -23692,8 +23665,8 @@ function WebGLRenderer( parameters ) {
 
 	};
 
-	this.setSize = function ( width, height,  updateStyle, devicePixelRatio ) {//改
-        if (devicePixelRatio != void 0) _pixelRatio = devicePixelRatio;  //add
+	this.setSize = function ( width, height, updateStyle ) {
+
 		if ( xr.isPresenting ) {
 
 			console.warn( 'THREE.WebGLRenderer: Can\'t change size while VR device is presenting.' );
@@ -23703,23 +23676,19 @@ function WebGLRenderer( parameters ) {
 
 		_width = width;
 		_height = height;
-        
-        //if(!window.unableSetSize){ 
-            _canvas.width = Math.floor( width * _pixelRatio );
-            _canvas.height = Math.floor( height * _pixelRatio );
-        
-        
-        
-            if ( updateStyle !== false ) {
-
-                _canvas.style.width = width + 'px';
-                _canvas.style.height = height + 'px';
-
-            }
-            
-            
-            this.setViewport( 0, 0, width, 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 );
+
 	};
 
 	this.getDrawingBufferSize = function ( target ) {
@@ -24125,7 +24094,7 @@ function WebGLRenderer( parameters ) {
 
 			if ( material.wireframe === true ) {
 
-				state.setlineWidth( material.wireframelineWidth * getTargetPixelRatio() );
+				state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );
 				renderer.setMode( 1 );
 
 			} else {
@@ -24136,11 +24105,11 @@ function WebGLRenderer( parameters ) {
 
 		} else if ( object.isLine ) {
 
-			let lineWidth = material.lineWidth;
+			let lineWidth = material.linewidth;
 
 			if ( lineWidth === undefined ) lineWidth = 1; // Not using Line*Material
 
-			state.setlineWidth( lineWidth * getTargetPixelRatio() );
+			state.setLineWidth( lineWidth * getTargetPixelRatio() );
 
 			if ( object.isLineSegments ) {
 
@@ -26807,7 +26776,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *  linecap: "round",
  *  linejoin: "round"
  * }
@@ -26821,7 +26790,7 @@ function LineBasicMaterial( parameters ) {
 
 	this.color = new Color( 0xffffff );
 
-	this.lineWidth = 1;
+	this.linewidth = 1;
 	this.linecap = 'round';
 	this.linejoin = 'round';
 
@@ -26842,7 +26811,7 @@ LineBasicMaterial.prototype.copy = function ( source ) {
 
 	this.color.copy( source.color );
 
-	this.lineWidth = source.lineWidth;
+	this.linewidth = source.linewidth;
 	this.linecap = source.linecap;
 	this.linejoin = source.linejoin;
 
@@ -33508,7 +33477,7 @@ RawShaderMaterial.prototype.isRawShaderMaterial = true;
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33563,7 +33532,7 @@ function MeshStandardMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33627,7 +33596,7 @@ MeshStandardMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -33786,7 +33755,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33837,7 +33806,7 @@ function MeshPhongMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -33895,7 +33864,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -33938,7 +33907,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
  *  alphaMap: new THREE.Texture( <Image> ),
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33983,7 +33952,7 @@ function MeshToonMaterial( parameters ) {
 	this.alphaMap = null;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34033,7 +34002,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
 	this.alphaMap = source.alphaMap;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -34061,7 +34030,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34087,7 +34056,7 @@ function MeshNormalMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -34120,7 +34089,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
 	this.displacementBias = source.displacementBias;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 
 	this.skinning = source.skinning;
 	this.morphTargets = source.morphTargets;
@@ -34157,7 +34126,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34195,7 +34164,7 @@ function MeshLambertMaterial( parameters ) {
 	this.refractionRatio = 0.98;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34240,7 +34209,7 @@ MeshLambertMaterial.prototype.copy = function ( source ) {
 	this.refractionRatio = source.refractionRatio;
 
 	this.wireframe = source.wireframe;
-	this.wireframelineWidth = source.wireframelineWidth;
+	this.wireframeLinewidth = source.wireframeLinewidth;
 	this.wireframeLinecap = source.wireframeLinecap;
 	this.wireframeLinejoin = source.wireframeLinejoin;
 
@@ -34358,7 +34327,7 @@ MeshMatcapMaterial.prototype.copy = function ( source ) {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *
  *  scale: <float>,
  *  dashSize: <float>,
@@ -36777,8 +36746,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, event.total); //xzw add event.total
-  
+						if ( callback.onLoad ) callback.onLoad( response );
+
 					}
 
 					scope.manager.itemEnd( url );
@@ -40402,13 +40371,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;
@@ -42120,7 +42089,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 ) {
@@ -42131,9 +42100,9 @@ ImageBitmapLoader.prototype = Object.assign( Object.create( Loader.prototype ),
 
 			scope.manager.itemEnd( url );
 
-		} ).catch( function ( e ) { 
-            //console.log('error', url, e)
-			if ( onError ) onError( e, url );
+		} ).catch( function ( e ) {
+
+			if ( onError ) onError( e );
 
 			scope.manager.itemError( url );
 			scope.manager.itemEnd( url );
@@ -50487,7 +50456,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;
 

File diff suppressed because it is too large
+ 856 - 856
libs/three.js/extra/lines.js


File diff suppressed because it is too large
+ 0 - 1
libs/three.js/libs/ktx-parse.module.js


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

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

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

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

File diff suppressed because it is too large
+ 136 - 649
libs/three.js/lines/LineMaterial.js


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

@@ -1,355 +1,209 @@
 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';
 
-const _start = new Vector3();
-const _end = new Vector3();
+var LineSegments2 = function ( geometry, material ) {
 
-const _start4 = new Vector4();
-const _end4 = new Vector4();
+	if ( geometry === undefined ) geometry = new LineSegmentsGeometry();
+	if ( material === undefined ) material = new LineMaterial( { color: Math.random() * 0xffffff } );
 
-const _ssOrigin = new Vector4();
-const _ssOrigin3 = new Vector3();
-const _mvMatrix = new Matrix4();
-const _line = new Line3();
-const _closestPoint = new Vector3();
+	Mesh.call( this, geometry, material );
 
-const _box = new Box3();
-const _sphere = new Sphere();
-const _clipToWorldVector = new Vector4();
+	this.type = 'LineSegments2';
 
-let _ray, _instanceStart, _instanceEnd, _lineWidth;
+};
 
-// 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 ) {
+LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 
-	// 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 );
+	constructor: LineSegments2,
 
-	return Math.abs( Math.max( _clipToWorldVector.x, _clipToWorldVector.y ) );
+	isLineSegments2: true,
 
-}
+	computeLineDistances: ( function () { // for backwards-compatability, but could be a method of LineSegmentsGeometry...
 
-function raycastWorldUnits( lineSegments, intersects ) {
+		var start = new Vector3();
+		var end = new Vector3();
 
-	for ( let i = 0, l = _instanceStart.count; i < l; i ++ ) {
+		return function computeLineDistances() {
 
-		_line.start.fromBufferAttribute( _instanceStart, i );
-		_line.end.fromBufferAttribute( _instanceEnd, i );
+			var geometry = this.geometry;
 
-		const pointOnLine = new Vector3();
-		const point = new Vector3();
+			var instanceStart = geometry.attributes.instanceStart;
+			var instanceEnd = geometry.attributes.instanceEnd;
+			var lineDistances = new Float32Array( 2 * instanceStart.data.count );
 
-		_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );
-		const isInside = point.distanceTo( pointOnLine ) < _lineWidth * 0.5;
+			for ( var i = 0, j = 0, l = instanceStart.data.count; i < l; i ++, j += 2 ) {
 
-		if ( isInside ) {
+				start.fromBufferAttribute( instanceStart, i );
+				end.fromBufferAttribute( instanceEnd, i );
 
-			intersects.push( {
-				point,
-				pointOnLine,
-				distance: _ray.origin.distanceTo( point ),
-				object: lineSegments,
-				face: null,
-				faceIndex: i,
-				uv: null,
-				uv2: null,
-			} );
+				lineDistances[ j ] = ( j === 0 ) ? 0 : lineDistances[ j - 1 ];
+				lineDistances[ j + 1 ] = lineDistances[ j ] + start.distanceTo( end );
 
-		}
+			}
 
-	}
+			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
 
-function raycastScreenSpace( lineSegments, camera, intersects ) {
+			return this;
 
-	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;
+	}() ),
 
-	const near = - camera.near;
+	raycast: ( function () {
 
-	//
+		var start = new Vector4();
+		var end = new Vector4();
 
-	// 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 );
+		var ssOrigin = new Vector4();
+		var ssOrigin3 = new Vector3();
+		var mvMatrix = new Matrix4();
+		var line = new Line3();
+		var closestPoint = new Vector3();
 
-	// ndc space [ - 1.0, 1.0 ]
-	_ssOrigin.w = 1;
-	_ssOrigin.applyMatrix4( camera.matrixWorldInverse );
-	_ssOrigin.applyMatrix4( projectionMatrix );
-	_ssOrigin.multiplyScalar( 1 / _ssOrigin.w );
+		return function raycast( raycaster, intersects ) {
 
-	// screen space
-	_ssOrigin.x *= resolution.x / 2;
-	_ssOrigin.y *= resolution.y / 2;
-	_ssOrigin.z = 0;
+			if ( raycaster.camera === null ) {
 
-	_ssOrigin3.copy( _ssOrigin );
+				console.error( 'LineSegments2: "Raycaster.camera" needs to be set in order to raycast against LineSegments2.' );
 
-	_mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
+			}
 
-	for ( let i = 0, l = instanceStart.count; i < l; i ++ ) {
+			var threshold = ( raycaster.params.Line2 !== undefined ) ? raycaster.params.Line2.threshold || 0 : 0;
 
-		_start4.fromBufferAttribute( instanceStart, i );
-		_end4.fromBufferAttribute( instanceEnd, i );
+			var ray = raycaster.ray;
+			var camera = raycaster.camera;
+			var projectionMatrix = camera.projectionMatrix;
 
-		_start4.w = 1;
-		_end4.w = 1;
+			var geometry = this.geometry;
+			var material = this.material;
+			var resolution = material.resolution;
+			var lineWidth = material.linewidth + threshold;
 
-		// camera space
-		_start4.applyMatrix4( _mvMatrix );
-		_end4.applyMatrix4( _mvMatrix );
+			var instanceStart = geometry.attributes.instanceStart;
+			var instanceEnd = geometry.attributes.instanceEnd;
 
-		// skip the segment if it's entirely behind the camera
-		const isBehindCameraNear = _start4.z > near && _end4.z > near;
-		if ( isBehindCameraNear ) {
+			// 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 );
 
-			continue;
+			// ndc space [ - 1.0, 1.0 ]
+			ssOrigin.w = 1;
+			ssOrigin.applyMatrix4( camera.matrixWorldInverse );
+			ssOrigin.applyMatrix4( projectionMatrix );
+			ssOrigin.multiplyScalar( 1 / ssOrigin.w );
 
-		}
+			// screen space
+			ssOrigin.x *= resolution.x / 2;
+			ssOrigin.y *= resolution.y / 2;
+			ssOrigin.z = 0;
 
-		// trim the segment if it extends behind camera near
-		if ( _start4.z > near ) {
+			ssOrigin3.copy( ssOrigin );
 
-			const deltaDist = _start4.z - _end4.z;
-			const t = ( _start4.z - near ) / deltaDist;
-			_start4.lerp( _end4, t );
+			var matrixWorld = this.matrixWorld;
+			mvMatrix.multiplyMatrices( camera.matrixWorldInverse, matrixWorld );
 
-		} else if ( _end4.z > near ) {
+			for ( var i = 0, l = instanceStart.count; i < l; i ++ ) {
 
-			const deltaDist = _end4.z - _start4.z;
-			const t = ( _end4.z - near ) / deltaDist;
-			_end4.lerp( _start4, t );
+				start.fromBufferAttribute( instanceStart, i );
+				end.fromBufferAttribute( instanceEnd, i );
 
-		}
+				start.w = 1;
+				end.w = 1;
 
-		// clip space
-		_start4.applyMatrix4( projectionMatrix );
-		_end4.applyMatrix4( projectionMatrix );
+				// camera space
+				start.applyMatrix4( mvMatrix );
+				end.applyMatrix4( mvMatrix );
 
-		// ndc space [ - 1.0, 1.0 ]
-		_start4.multiplyScalar( 1 / _start4.w );
-		_end4.multiplyScalar( 1 / _end4.w );
+				// clip space
+				start.applyMatrix4( projectionMatrix );
+				end.applyMatrix4( projectionMatrix );
 
-		// screen space
-		_start4.x *= resolution.x / 2;
-		_start4.y *= resolution.y / 2;
+				// ndc space [ - 1.0, 1.0 ]
+				start.multiplyScalar( 1 / start.w );
+				end.multiplyScalar( 1 / end.w );
 
-		_end4.x *= resolution.x / 2;
-		_end4.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 ) {
 
-		// create 2d segment
-		_line.start.copy( _start4 );
-		_line.start.z = 0;
+					continue;
 
-		_line.end.copy( _end4 );
-		_line.end.z = 0;
+				}
 
-		// get closest point on ray to segment
-		const param = _line.closestPointToPointParameter( _ssOrigin3, true );
-		_line.at( param, _closestPoint );
+				// screen space
+				start.x *= resolution.x / 2;
+				start.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;
+				end.x *= resolution.x / 2;
+				end.y *= resolution.y / 2;
 
-		const isInside = _ssOrigin3.distanceTo( _closestPoint ) < _lineWidth * 0.5;
+				// create 2d segment
+				line.start.copy( start );
+				line.start.z = 0;
 
-		if ( isInClipSpace && isInside ) {
+				line.end.copy( end );
+				line.end.z = 0;
 
-			_line.start.fromBufferAttribute( instanceStart, i );
-			_line.end.fromBufferAttribute( instanceEnd, i );
+				// get closest point on ray to segment
+				var param = line.closestPointToPointParameter( ssOrigin3, true );
+				line.at( param, closestPoint );
 
-			_line.start.applyMatrix4( matrixWorld );
-			_line.end.applyMatrix4( matrixWorld );
+				// check if the intersection point is within clip space
+				var zPos = MathUtils.lerp( start.z, end.z, param );
+				var isInClipSpace = zPos >= - 1 && zPos <= 1;
 
-			const pointOnLine = new Vector3();
-			const point = new Vector3();
+				var isInside = ssOrigin3.distanceTo( closestPoint ) < lineWidth * 0.5;
 
-			_ray.distanceSqToSegment( _line.start, _line.end, point, pointOnLine );
+				if ( isInClipSpace && isInside ) {
 
-			intersects.push( {
-				point: point,
-				pointOnLine: pointOnLine,
-				distance: _ray.origin.distanceTo( point ),
-				object: lineSegments,
-				face: null,
-				faceIndex: i,
-				uv: null,
-				uv2: null,
-			} );
+					line.start.fromBufferAttribute( instanceStart, i );
+					line.end.fromBufferAttribute( instanceEnd, i );
 
-		}
+					line.start.applyMatrix4( matrixWorld );
+					line.end.applyMatrix4( matrixWorld );
 
-	}
+					var pointOnLine = new Vector3();
+					var point = new Vector3();
 
-}
+					ray.distanceSqToSegment( line.start, line.end, point, pointOnLine );
 
-class LineSegments2 extends Mesh {
+					intersects.push( {
 
-	constructor( geometry = new LineSegmentsGeometry(), material = new LineMaterial( { color: Math.random() * 0xffffff } ) ) {
+						point: point,
+						pointOnLine: pointOnLine,
+						distance: ray.origin.distanceTo( point ),
 
-		super( geometry, material );
+						object: this,
+						face: null,
+						faceIndex: i,
+						uv: null,
+						uv2: null,
 
-		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 };

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

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

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

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

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

@@ -62,38 +62,17 @@ 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, renderer, urlPrefix) {
- 
+	function GLTFLoader( manager ) {
+
 		Loader.call( this, manager );
 
-		/* this.dracoLoader = null;
+		this.dracoLoader = null;
 		this.ddsLoader = null;
 		this.ktx2Loader = 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.meshoptDecoder = null;
 
 		this.pluginCallbacks = [];
 
@@ -139,7 +118,7 @@ var GLTFLoader = ( function () {
 
 		constructor: GLTFLoader,
 
-		load: function ( url, onLoad, onProgress, onError   ) {
+		load: function ( url, onLoad, onProgress, onError ) {
 
 			var scope = this;
 
@@ -188,27 +167,23 @@ var GLTFLoader = ( function () {
 			loader.setRequestHeader( this.requestHeader );
 			loader.setWithCredentials( this.withCredentials );
 
-			loader.load( url, function ( data, total ) {// xzw add total 
-                console.log('数据加载成功', url.split('/').pop(), '  ,total: '+total)
-                let f = ()=>{
-                    try {
+			loader.load( url, function ( data ) {
 
-                        scope.parse( data, resourcePath, function ( gltf ) {
+				try {
 
-                            onLoad( gltf, total );
+					scope.parse( data, resourcePath, function ( gltf ) {
 
-                            scope.manager.itemEnd( url );
+						onLoad( gltf );
 
-                        }, _onError );
+						scope.manager.itemEnd( url );
 
-                    } catch ( e ) {
+					}, _onError );
 
-                        _onError( e );
+				} catch ( e ) {
 
-                    }
-                }
-                f()
-                //setTimeout(f,5000)/////////////////test
+					_onError( e );
+
+				}
 
 			}, onProgress, _onError );
 
@@ -318,9 +293,10 @@ 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 ++ ) {
@@ -353,7 +329,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;
 
@@ -1033,7 +1009,7 @@ var GLTFLoader = ( function () {
 	function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
 
 		if ( ! dracoLoader ) {
-                
+
 			throw new Error( 'THREE.GLTFLoader: No DRACOLoader instance provided.' );
 
 		}
@@ -1934,17 +1910,15 @@ 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 { */
-        //为了防止chrome出现报错  The source image could not be decoded. 导致reject,改用TextureLoader  by xzw
+		} else {
 
 			this.textureLoader = new TextureLoader( this.options.manager );
 
-		//}
- 
+		}
 
 		this.textureLoader.setCrossOrigin( this.options.crossOrigin );
 
@@ -2491,7 +2465,7 @@ var GLTFLoader = ( function () {
 	};
 
 	GLTFParser.prototype.loadTextureImage = function ( textureIndex, source, loader ) {
-         
+
 		var parser = this;
 		var json = this.json;
 		var options = this.options;
@@ -2538,57 +2512,26 @@ var GLTFLoader = ( function () {
 
 			return new Promise( function ( resolve, reject ) {
 
-				/* var onLoad = resolve;
+				var onLoad = resolve;
+
+				if ( loader.isImageBitmapLoader === true ) {
+
+					onLoad = function ( imageBitmap ) {
 
-				if ( loader.isImageBitmapLoader === true ) { 
-                    onLoad = function ( imageBitmap ) {
-                        //console.log('resolveURL onLoad',textureIndex )
 						resolve( new CanvasTexture( imageBitmap ) );
 
 					};
+
 				}
-                */
-
-                //为了防止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  */  );
+
+				loader.load( resolveURL( sourceURI, options.path ), onLoad, undefined, reject );
 
 			} );
 
 		} ).then( function ( texture ) {
-            
+
 			// Clean up resources and configure Texture.
-            //console.log('texture', textureIndex, texture.image)
+
 			if ( isObjectURL === true ) {
 
 				URL.revokeObjectURL( sourceURI );
@@ -2785,7 +2728,7 @@ var GLTFLoader = ( function () {
 
 	GLTFParser.prototype.getMaterialType = function ( /* materialIndex */ ) {
 
-		return this.unlitMat ? MeshBasicMaterial : MeshStandardMaterial;  //xzw add unlitMat
+		return MeshStandardMaterial;
 
 	};
 

File diff suppressed because it is too large
+ 499 - 481
libs/three.js/loaders/KTX2Loader.js


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

@@ -5,12 +5,12 @@ import {
 	FrontSide,
 	Loader,
 	LoaderUtils,
-	MeshStandardMaterial,//MeshPhongMaterial, 用MeshStandardMaterial好调些,因为遵循能量守恒
+	MeshPhongMaterial,
 	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 );
-                    //console.log('specular',value)
+					params.specular = new Color().fromArray( value );
+
 					break;
 
 				case 'ke':
@@ -452,9 +452,8 @@ 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 );
-                    //console.log('shininess',value)
-                    
+					params.shininess = parseFloat( value );
+
 					break;
 
 				case 'd':
@@ -490,7 +489,7 @@ MTLLoader.MaterialCreator.prototype = {
 
 		}
 
-		this.materials[ materialName ] = new MeshStandardMaterial( params )//MeshPhongMaterial( params );
+		this.materials[ materialName ] = new 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 , total ) {// xzw add total 
+			loader.load( url, function ( text ) {
 
 				try {
 
-					onLoad( scope.parse( text ) , total );
+					onLoad( scope.parse( text ) );
 
 				} catch ( e ) {
 

File diff suppressed because it is too large
+ 0 - 52
libs/three.js/loaders/draco/draco_decoder.js


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


File diff suppressed because it is too large
+ 0 - 104
libs/three.js/loaders/draco/draco_wasm_wrapper.js


File diff suppressed because it is too large
+ 0 - 21
libs/three.js/loaders/ktx/basis_transcoder.js


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


+ 0 - 102
libs/utils/WorkerPool.js

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

+ 0 - 33
main.js

@@ -1,33 +0,0 @@
-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


+ 0 - 16
note/note.js

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


File diff suppressed because it is too large
+ 20 - 7438
package-lock.json


+ 2 - 8
package.json

@@ -17,22 +17,16 @@
   ],
   "main": "./build/potree/potree.js",
   "scripts": {
-    "start": "gulp watch -c development",
-    "build": "node main.js",
-    "build-c": "gulp build pack -c production",
+    "start": "gulp watch",
+    "build": "gulp build pack",
     "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


+ 36 - 69
rollup.config.js

@@ -1,69 +1,36 @@
-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
+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
+		}
+	}
+]

+ 3 - 3
src/Actions.js

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

+ 5 - 10
src/Annotation.js

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

+ 1 - 1
src/Enum.js

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

+ 10 - 54
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, importance=0  ){//add importance
+	addEventListener(type, listener){
 
 		const listeners = this._listeners;
 
@@ -47,8 +47,7 @@ export class EventDispatcher{
 		}
 
 		if(listeners[type].indexOf(listener) === - 1){
-			listeners[type].push({ listener,  importance});
-            listeners[type] = listeners[type].sort((e,a)=> a.importance - e.importance)//add
+			listeners[type].push( listener );
 		}
 
 	}
@@ -67,14 +66,11 @@ export class EventDispatcher{
 
 		if (listenerArray !== undefined){
 
-			/* let index = listenerArray.indexOf(listener);
+			let index = listenerArray.indexOf(listener);
 
 			if(index !== - 1){
 				listenerArray.splice(index, 1);
-			} */
-            let item = listenerArray.find(e=>e.listener == listener)
-            item && listenerArray.splice(listenerArray.indexOf(item), 1);
-            
+			}
 		}
 
 	}
@@ -84,60 +80,20 @@ export class EventDispatcher{
 			delete this._listeners[type];
 		}
 	};
-    
-    
-    
 
 	dispatchEvent(event){
-        if(typeof event == 'string'){//add
-            event = {type:event}
-        }
-        
+
 		let listeners = this._listeners;
 		let listenerArray = listeners[event.type];
 
 		if ( listenerArray !== undefined ) {
 			event.target = this;
 
-			for(let {listener} of listenerArray.slice(0)){
-				let result = listener.call(this, event);   //add stopContinue
-                if(result && result.stopContinue){
-                    break
-                }
+			for(let listener of listenerArray.slice(0)){
+				listener.call(this, event);
 			}
 		}
 
 	}
-    
-    
-    //add 
-    /* emit(type){ 
-        this.dispatchEvent({type, arguments: Array.from(arguments).slice(1, arguments.length) })
-    }
-    on(type, fun){  
-        this.addEventListener(type,(ev)=>{
-            fun.apply(this, ev.arguments)
-        })
-    } 
-    off(type, fun){
-        this.removeEventListener(type,)
-    }
-    
-    once(type, fun) {
-        function callback() {
-            this.removeEventListener(type, callback),
-            n || (n = !0, fun.apply(this, arguments))
-        }
-        var n = !1;
-        return callback.listener = fun,
-            this.on(type, callback),
-            this
-    }  */
-    
-    removeAllListeners(){
-        
-        this._listeners = {};
-        
-    }
-     
+
 }

+ 0 - 21
src/Features.js

@@ -1,8 +1,4 @@
 
-import browser from './utils/browser.js'
-
-
-
 let ftCanvas = document.createElement('canvas');
 
 export const Features = (function () {
@@ -71,23 +67,6 @@ 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;

+ 1 - 2
src/KeyCodes.js

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

+ 2 - 30
src/LRU.js

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

File diff suppressed because it is too large
+ 45 - 1065
src/PointCloudOctree.js


+ 14 - 28
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 extends THREE.EventDispatcher{
+export class PointCloudOctreeGeometry{
 
 	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,8 +117,7 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		child.parent = this;
 	}
 
-	load(){  
-    
+	load(){
 		if (this.loading === true || this.loaded === true || Potree.numNodesLoading >= Potree.maxNodesLoading) {
 			return;
 		}
@@ -142,7 +141,7 @@ export class PointCloudOctreeGeometryNode extends PointCloudTreeNode{
 		this.pcoGeometry.loader.load(this);
 	}
 
-	loadHierachyThenPoints(pointcloud){
+	loadHierachyThenPoints(){
 		let node = this;
 
 		// load hierarchy
@@ -199,8 +198,6 @@ 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);
@@ -214,8 +211,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();
@@ -223,8 +220,7 @@ 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';
@@ -244,14 +240,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();
@@ -267,17 +263,7 @@ 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;

+ 4 - 3
src/PointCloudTree.js

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

+ 24 - 224
src/Potree.js

@@ -1,6 +1,3 @@
-export {config, settings} from "./settings.js";
-export * from "./start.js";
- 
 
 export * from "./Actions.js";
 export * from "./AnimationPath.js";
@@ -19,7 +16,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";
@@ -35,7 +32,7 @@ export * from "./materials/NormalizationMaterial.js";
 export * from "./materials/PointCloudMaterial.js";
 
 export * from "./loader/POCLoader.js";
-//export * from "./modules/loader/2.0/OctreeLoader.js";
+export * from "./modules/loader/2.0/OctreeLoader.js";
 export * from "./loader/EptLoader.js";
 export * from "./loader/ept/BinaryLoader.js";
 export * from "./loader/ept/LaszipLoader.js";
@@ -44,23 +41,23 @@ export * from "./loader/PointAttributes.js";
 export * from "./loader/ShapefileLoader.js";
 export * from "./loader/GeoPackageLoader.js";
 
-export * from "./objects/tool/Box3Helper.js";
-export * from "./objects/tool/ClippingTool.js";
-export * from "./objects/tool/ClipVolume.js";
+export * from "./utils/Box3Helper.js";
+export * from "./utils/ClippingTool.js";
+export * from "./utils/ClipVolume.js";
 export * from "./utils/GeoTIFF.js";
-export * from "./objects/tool/Measure.js";
-export * from "./objects/tool/MeasuringTool.js";
+export * from "./utils/Measure.js";
+export * from "./utils/MeasuringTool.js";
 export * from "./utils/Message.js";
 export * from "./utils/PointCloudSM.js";
-export * from "./objects/tool/PolygonClipVolume.js";
-export * from "./objects/tool/Profile.js";
-export * from "./objects/tool/ProfileTool.js";
-export * from "./objects/tool/ScreenBoxSelectTool.js";
-export * from "./objects/tool/SpotLightHelper.js";
-export * from "./objects/tool/TransformationTool.js";
-export * from "./objects/tool/Volume.js";
-export * from "./objects/tool/VolumeTool.js";
-export * from "./objects/tool/Compass.js";
+export * from "./utils/PolygonClipVolume.js";
+export * from "./utils/Profile.js";
+export * from "./utils/ProfileTool.js";
+export * from "./utils/ScreenBoxSelectTool.js";
+export * from "./utils/SpotLightHelper.js";
+export * from "./utils/TransformationTool.js";
+export * from "./utils/Volume.js";
+export * from "./utils/VolumeTool.js";
+export * from "./utils/Compass.js";
 
 export * from "./viewer/viewer.js";
 export * from "./viewer/Scene.js";
@@ -70,7 +67,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";
@@ -78,22 +75,12 @@ 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";
@@ -108,8 +95,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;
@@ -141,195 +128,9 @@ let resourcePath = scriptPath + '/resources';
 export {scriptPath, resourcePath};
 
 
-//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){
+export function loadPointCloud(path, name, callback){
 	let loaded = function(e){
 		e.pointcloud.name = name;
-        e.pointcloud.sceneCode = sceneCode //对应4dkk的场景码
-        
 		callback(e);
 	};
 
@@ -350,18 +151,17 @@ export function loadPointCloud(path, name, sceneCode, timeStamp, callback, onErr
 				}
 			});
 		} else if (path.indexOf('cloud.js') > 0) {
-			POCLoader.load(path, timeStamp, function (geometry) {
+			POCLoader.load(path, 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) {  //部分浏览器(如uc)不支持NodeLoader中的1n的大数据写法
+		} else if (path.indexOf('metadata.json') > 0) {
 			Potree.OctreeLoader.load(path).then(e => {
 				let geometry = e.geometry;
 
@@ -393,7 +193,7 @@ export function loadPointCloud(path, name, sceneCode, timeStamp, callback, onErr
 					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'});

+ 28 - 197
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,20 +225,7 @@ 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;
@@ -258,9 +245,7 @@ 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);
@@ -296,7 +281,7 @@ class Shader {
 			}
 
 			// uniform blocks
-			if( typeof WebGL2RenderingContext !== 'undefined' && gl instanceof WebGL2RenderingContext){ //WebGL2RenderingContext在mac的safari14以下是没有定义的
+			if(gl instanceof WebGL2RenderingContext){ 
 				let numBlocks = gl.getProgramParameter(program, gl.ACTIVE_UNIFORM_BLOCKS);
 
 				for (let i = 0; i < numBlocks; i++) {
@@ -343,7 +328,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)}`);
 
 
 	}
@@ -471,7 +456,8 @@ class WebGLTexture {
 		this.gl = gl;
 
 		this.texture = texture;
-		this.id = gl.createTexture(); 
+		this.id = gl.createTexture();
+
 		this.target = gl.TEXTURE_2D;
 		this.version = -1;
 
@@ -522,8 +508,7 @@ class WebGLTexture {
 			gl.texImage2D(this.target, level, internalFormat,
 				width, height, border, srcFormat, srcType,
 				data);
-		}/* else if(texture instanceof THREE.CubeTexture){//add 
-        } */else if ((texture instanceof THREE.CanvasTexture) || (texture instanceof THREE.Texture)) {
+		} else if ((texture instanceof THREE.CanvasTexture) || (texture instanceof THREE.Texture)) {
 			data = texture.image;
 
 			gl.texParameteri(this.target, gl.TEXTURE_WRAP_S, paramThreeToGL(gl, texture.wrapS));
@@ -560,7 +545,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();
@@ -691,7 +676,7 @@ export class Renderer {
 
 			let node = stack.pop();
 
-			if (node instanceof PointCloudTree) { 
+			if (node instanceof PointCloudTree) {
 				octrees.push(node);
 				continue;
 			}
@@ -1042,11 +1027,8 @@ export class Renderer {
 			}
 
 			let numPoints = webglBuffer.numElements;
-			 
-            gl.drawArrays(gl.POINTS, 0, numPoints); 
-            //gl.drawArrays(gl.TRIANGLES, 0, numPoints);
-            
-            
+			gl.drawArrays(gl.POINTS, 0, numPoints);
+
 			i++;
 		}
 
@@ -1057,10 +1039,6 @@ export class Renderer {
 			performance.measure("render.renderNodes", "renderNodes-start", "renderNodes-end");
 		}
 	}
-    
-    
-    
-    
 
 	renderOctree(octree, nodes, camera, target, params = {}){
 
@@ -1107,7 +1085,7 @@ export class Renderer {
 
 				this.shaders.set(material, shader);
 			}
-            
+
 			shader = this.shaders.get(material);
 
 			//if(material.needsUpdate){
@@ -1126,23 +1104,8 @@ 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;
 
@@ -1186,7 +1149,7 @@ export class Renderer {
 
 				material.needsUpdate = false;
 			}
-             
+
 			for (let uniformName of Object.keys(material.uniforms)) {
 				let uniform = material.uniforms[uniformName];
 
@@ -1197,11 +1160,7 @@ 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);
 
@@ -1222,23 +1181,14 @@ export class Renderer {
 		if(params.transparent !== undefined){
 			transparent = params.transparent && material.opacity < 1;
 		}else{
-			transparent = material.usePanoMap ? false : (material.useFilterByNormal || material.opacity < 1); //add useFilterByNormal
+			transparent = material.opacity < 1;
 		}
 
 		if (transparent){
 			gl.enable(gl.BLEND);
-            
-            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);
-            } 
-			
-			
+			gl.blendFunc(gl.SRC_ALPHA, gl.ONE);
+			gl.depthMask(false);
+			gl.disable(gl.DEPTH_TEST);
 		} else {
 			gl.disable(gl.BLEND);
 			gl.depthMask(true);
@@ -1274,15 +1224,11 @@ 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.setUniform2f('resolution', material.resolution.toArray())
-            
-            
+			shader.setUniform1f("uScreenHeight", screenHeight);
 			shader.setUniform1f("fov", Math.PI * camera.fov / 180);
 			shader.setUniform1f("near", camera.near);
 			shader.setUniform1f("far", camera.far);
@@ -1343,7 +1289,7 @@ export class Renderer {
 			}
 
 
-			shader.setUniform1f("size", material.usePanoMap ? Potree.config.material.absolutePanoramaSize * Math.min(window.devicePixelRatio,2) : material.size);//usePanoMap时控制在不大不小的范围内感觉较好,考虑到有的点云稀疏,用大一点的点
+			shader.setUniform1f("size", material.size);
 			shader.setUniform1f("maxSize", material.uniforms.maxSize.value);
 			shader.setUniform1f("minSize", material.uniforms.minSize.value);
 
@@ -1356,7 +1302,7 @@ export class Renderer {
 			//uniform vec3 uColor;
 			shader.setUniform3f("uColor", material.color.toArray());
 			//uniform float opacity;
-			shader.setUniform1f("uOpacity", material.usePanoMap ? 1: material.opacity);
+			shader.setUniform1f("uOpacity", material.opacity);
 
 			shader.setUniform2f("elevationRange", material.elevationRange);
 			shader.setUniform2f("intensityRange", material.intensityRange);
@@ -1384,14 +1330,6 @@ 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);
@@ -1491,47 +1429,6 @@ 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);
@@ -1539,37 +1436,10 @@ 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 = {}) {
- 
+
 		const gl = this.gl;
 
 		// PREPARE 
@@ -1581,42 +1451,11 @@ 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);
 		}
 
@@ -1634,18 +1473,10 @@ 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
 
 
- */
+
+

+ 27 - 48
src/Potree_update_visibility.js

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

+ 146 - 0
src/TextSprite.js

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

+ 5 - 121
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,17 +26,11 @@ export const ElevationGradientRepeat = {
 	MIRRORED_REPEAT: 2,
 };
 
-export const Buttons = {// MouseEvent.buttons
-    //buttons,设置按下了鼠标哪些键,是一个3个比特位的二进制值,默认为0。1表示按下主键(通常是左键),2表示按下次要键(通常是右键),4表示按下辅助键(通常是中间的键)。
-	NONE:0,//add
-    
-    LEFT: 0b0001,
+export const MOUSE = {
+	LEFT: 0b0001,
 	RIGHT: 0b0010,
 	MIDDLE: 0b0100
 };
-/*  如果访问的是button, 用THREE.MOUSE来判断:
-    button,设置按下了哪一个鼠标按键,默认为0。-1表示没有按键,0表示按下主键(通常是左键),1表示按下辅助键(通常是中间的键),2表示按下次要键(通常是右键)
- */
 
 export const PointSizeType = {
 	FIXED: 0,
@@ -59,114 +53,4 @@ 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 "../objects/tool/Measure.js";
+import {Measure} from "../utils/Measure.js";
 
 export class DXFExporter {
 

+ 1 - 1
src/exporter/GeoJSONExporter.js

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

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

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

+ 0 - 0
src/loader/BinaryLoader.js


Some files were not shown because too many files changed in this diff