Browse Source

添加最新版potree 官网内容

bill 2 years ago
parent
commit
2774d1d981
100 changed files with 3126 additions and 9103 deletions
  1. BIN
      .DS_Store
  2. 5 3
      .vscode/settings.json
  3. 3 0
      README.md
  4. 5 5
      docs/RELEASE.MD
  5. BIN
      docs/sponsors/unstruk.png
  6. 0 114
      examples/360-test.html
  7. 0 79
      examples/4dkk.html
  8. 1 0
      examples/ca13.html
  9. 262 317
      examples/resources/sorvilier.json
  10. 0 448
      examples/resources/sorvilier2.json
  11. 1 1
      examples/showcase/santorini.html
  12. 0 10
      gulpfile.js
  13. 22 22
      libs/jstree/LICENSE-MIT
  14. 1 1
      libs/other/stats.js
  15. 2 2
      libs/proj4/test.html
  16. 21 0
      libs/stats.js/LICENSE
  17. 56 0
      libs/stats.js/README.md
  18. 179 0
      libs/stats.js/stats.js
  19. 5 0
      libs/stats.js/stats.min.js
  20. 171 0
      libs/stats.js/stats.module.js
  21. 79 107
      libs/three.js/build/three.module.js
  22. 856 856
      libs/three.js/extra/lines.js
  23. 24 259
      libs/three.js/lines/LineMaterial.js
  24. 1 1
      libs/three.js/lines/LineSegments2.js
  25. 8 9
      libs/three.js/loaders/MTLLoader.js
  26. 1 1
      package-lock.json
  27. 2 8
      package.json
  28. BIN
      resources/images/rotate-cursor.cur
  29. BIN
      resources/images/rotate-cursor.png
  30. BIN
      resources/textures/End_128.png
  31. BIN
      resources/textures/crosshair.png
  32. BIN
      resources/textures/explode.png
  33. BIN
      resources/textures/fire.png
  34. BIN
      resources/textures/icon-explode.png
  35. BIN
      resources/textures/icon-fire.png
  36. BIN
      resources/textures/icon-smoke.png
  37. BIN
      resources/textures/map_instruction_start_route.png
  38. BIN
      resources/textures/map_instruction_target_reached.png
  39. BIN
      resources/textures/map_marker.png
  40. BIN
      resources/textures/marker.png
  41. BIN
      resources/textures/pano_instruction_bottomMarker.png
  42. BIN
      resources/textures/pano_instruction_start_route.png
  43. BIN
      resources/textures/pano_instruction_target_reached.png
  44. BIN
      resources/textures/pic_location128.png
  45. BIN
      resources/textures/pic_location64.png
  46. BIN
      resources/textures/pic_point32.png
  47. BIN
      resources/textures/pic_point64.png
  48. BIN
      resources/textures/pic_point_s32.png
  49. BIN
      resources/textures/reticule-256x256.png
  50. BIN
      resources/textures/reticule_cross_hair.png
  51. BIN
      resources/textures/rotation_circle.png
  52. BIN
      resources/textures/routePoint_map_activeFloor.png
  53. BIN
      resources/textures/routePoint_map_fsna.png
  54. BIN
      resources/textures/routePoint_map_inactiveFloor.png
  55. BIN
      resources/textures/routePoint_panorama.png
  56. BIN
      resources/textures/smokeparticle.png
  57. BIN
      resources/textures/whiteCircle.png
  58. 36 69
      rollup.config.js
  59. 3 3
      src/Actions.js
  60. 5 10
      src/Annotation.js
  61. 1 1
      src/Enum.js
  62. 10 54
      src/EventDispatcher.js
  63. 0 21
      src/Features.js
  64. 1 2
      src/KeyCodes.js
  65. 2 30
      src/LRU.js
  66. 39 1021
      src/PointCloudOctree.js
  67. 14 28
      src/PointCloudOctreeGeometry.js
  68. 4 3
      src/PointCloudTree.js
  69. 24 189
      src/Potree.js
  70. 22 151
      src/PotreeRenderer.js
  71. 26 44
      src/Potree_update_visibility.js
  72. 146 0
      src/TextSprite.js
  73. 5 121
      src/defines.js
  74. 1 1
      src/exporter/DXFExporter.js
  75. 1 1
      src/exporter/GeoJSONExporter.js
  76. 0 437
      src/extensions/three.shim.js
  77. 2 19
      src/loader/BinaryLoader.js
  78. 1 1
      src/loader/GeoPackageLoader.js
  79. 7 83
      src/loader/POCLoader.js
  80. 4 20
      src/loader/PointAttributes.js
  81. 1 1
      src/loader/ShapefileLoader.js
  82. 0 122
      src/materials/DepthBasicMaterial.js
  83. 2 6
      src/materials/EyeDomeLightingMaterial.js
  84. 0 106
      src/materials/InfiniteGridMaterial.js
  85. 35 153
      src/materials/PointCloudMaterial.js
  86. 0 9
      src/materials/shaders/basicTextured.fs
  87. 0 6
      src/materials/shaders/basicTextured.vs
  88. 0 10
      src/materials/shaders/copyCubeMap.fs
  89. 0 14
      src/materials/shaders/copyCubeMap.vs
  90. 0 94
      src/materials/shaders/depthBasic.fs
  91. 0 10
      src/materials/shaders/depthBasic.vs
  92. 22 34
      src/materials/shaders/edl.fs
  93. 0 30
      src/materials/shaders/otherShaders.js
  94. 0 102
      src/materials/shaders/pointcloud - 原始.fs
  95. 0 981
      src/materials/shaders/pointcloud - 原始.vs
  96. 8 91
      src/materials/shaders/pointcloud.fs
  97. 126 279
      src/materials/shaders/pointcloud.vs
  98. 529 621
      src/modules/CameraAnimation/CameraAnimation.js
  99. 344 1882
      src/modules/Images360/Images360.js
  100. 0 0
      src/modules/Images360/Images3603.js

BIN
.DS_Store


+ 5 - 3
.vscode/settings.json

@@ -5,16 +5,18 @@
 		"*.fs": "cpp"
 	},
 	"files.trimTrailingWhitespace": false,
-	"editor.fontSize": 28,
-	"editor.autoIndent": false,
+	"editor.fontSize": 12,
+	"editor.autoIndent": "advanced",
 	"editor.detectIndentation": false,
 	"editor.insertSpaces": false,
 	"editor.minimap.enabled": false,
-	"editor.autoClosingBrackets": false,
+	"editor.autoClosingBrackets": "never",
 	"editor.formatOnType": false,
 	"editor.acceptSuggestionOnEnter": "off",
 	"editor.acceptSuggestionOnCommitCharacter": false,
 	"editor.mouseWheelZoom": true,
 	"editor.renderWhitespace": "all",
 	"workbench.tree.indent": 30,
+	"editor.autoClosingQuotes": "never",
+	"editor.autoSurround": "never",
 }

+ 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>

+ 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 -->

+ 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): 

+ 0 - 10
gulpfile.js

@@ -72,18 +72,8 @@ 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() {

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

+ 79 - 107
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 = [];
@@ -8712,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;
@@ -8723,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;
 
@@ -8897,7 +8881,7 @@ Object.defineProperty( Material.prototype, 'needsUpdate', {
  *  depthWrite: <bool>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>
@@ -8930,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';
 
@@ -8970,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;
 
@@ -11716,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>,
  *
@@ -11738,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
@@ -11802,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;
@@ -17464,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 );
@@ -18893,7 +18871,7 @@ function WebGLRenderStates( extensions, capabilities ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  * }
  */
 
@@ -18917,7 +18895,7 @@ function MeshDepthMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -18948,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;
 
@@ -19393,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 ) {
 
@@ -19796,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;
@@ -20165,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;
 
 		}
 
@@ -20362,7 +20340,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		currentFlipSided = null;
 		currentCullFace = null;
 
-		currentlineWidth = null;
+		currentLineWidth = null;
 
 		currentPolygonOffsetFactor = null;
 		currentPolygonOffsetUnits = null;
@@ -20392,7 +20370,7 @@ function WebGLState( gl, extensions, capabilities ) {
 		setFlipSided: setFlipSided,
 		setCullFace: setCullFace,
 
-		setlineWidth: setlineWidth,
+		setLineWidth: setLineWidth,
 		setPolygonOffset: setPolygonOffset,
 
 		setScissorTest: setScissorTest,
@@ -23613,8 +23591,6 @@ function WebGLRenderer( parameters ) {
 		_this.state = state;
 		_this.info = info;
 
-        _this._textures = textures;//add 
-        
 	}
 
 	initGLContext();
@@ -23689,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.' );
@@ -23700,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 ) {
@@ -24122,7 +24094,7 @@ function WebGLRenderer( parameters ) {
 
 			if ( material.wireframe === true ) {
 
-				state.setlineWidth( material.wireframelineWidth * getTargetPixelRatio() );
+				state.setLineWidth( material.wireframeLinewidth * getTargetPixelRatio() );
 				renderer.setMode( 1 );
 
 			} else {
@@ -24133,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 ) {
 
@@ -26804,7 +26776,7 @@ InstancedMesh.prototype = Object.assign( Object.create( Mesh.prototype ), {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *  linecap: "round",
  *  linejoin: "round"
  * }
@@ -26818,7 +26790,7 @@ function LineBasicMaterial( parameters ) {
 
 	this.color = new Color( 0xffffff );
 
-	this.lineWidth = 1;
+	this.linewidth = 1;
 	this.linecap = 'round';
 	this.linejoin = 'round';
 
@@ -26839,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;
 
@@ -33505,7 +33477,7 @@ RawShaderMaterial.prototype.isRawShaderMaterial = true;
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33560,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';
 
@@ -33624,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;
 
@@ -33783,7 +33755,7 @@ MeshPhysicalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33834,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';
 
@@ -33892,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;
 
@@ -33935,7 +33907,7 @@ MeshPhongMaterial.prototype.copy = function ( source ) {
  *  alphaMap: new THREE.Texture( <Image> ),
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -33980,7 +33952,7 @@ function MeshToonMaterial( parameters ) {
 	this.alphaMap = null;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 	this.wireframeLinecap = 'round';
 	this.wireframeLinejoin = 'round';
 
@@ -34030,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;
 
@@ -34058,7 +34030,7 @@ MeshToonMaterial.prototype.copy = function ( source ) {
  *  displacementBias: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>
+ *  wireframeLinewidth: <float>
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34084,7 +34056,7 @@ function MeshNormalMaterial( parameters ) {
 	this.displacementBias = 0;
 
 	this.wireframe = false;
-	this.wireframelineWidth = 1;
+	this.wireframeLinewidth = 1;
 
 	this.fog = false;
 
@@ -34117,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;
@@ -34154,7 +34126,7 @@ MeshNormalMaterial.prototype.copy = function ( source ) {
  *  refractionRatio: <float>,
  *
  *  wireframe: <boolean>,
- *  wireframelineWidth: <float>,
+ *  wireframeLinewidth: <float>,
  *
  *  skinning: <bool>,
  *  morphTargets: <bool>,
@@ -34192,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';
 
@@ -34237,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;
 
@@ -34355,7 +34327,7 @@ MeshMatcapMaterial.prototype.copy = function ( source ) {
  *  color: <hex>,
  *  opacity: <float>,
  *
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *
  *  scale: <float>,
  *  dashSize: <float>,
@@ -40399,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;
@@ -50484,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


+ 24 - 259
libs/three.js/lines/LineMaterial.js

@@ -3,14 +3,13 @@ import {
 	ShaderMaterial,
 	UniformsLib,
 	UniformsUtils,
-	Vector2,
-    Color
+	Vector2
 } from '../build/three.module.js';
 
 /**
  * parameters = {
  *  color: <hex>,
- *  lineWidth: <float>,
+ *  linewidth: <float>,
  *  dashed: <boolean>,
  *  dashScale: <float>,
  *  dashSize: <float>,
@@ -21,26 +20,15 @@ import {
  */
 
 UniformsLib.line = {
-  
-	lineWidth: { value: 1 },
+
+	linewidth: { value: 1 },
 	resolution: { value: new Vector2( 1, 1 ) },
-    viewportOffset: { value: new Vector2(0, 0 ) }, //left, top    
 	dashScale: { value: 1 },
 	dashSize: { value: 1 },
 	dashOffset: { value: 0 },
-	gapSize: { value: 1 }, 
-	opacity: { value: 1 },
-     
-    backColor:     {type:'v3',   value: new Color("#ddd")},
-    clipDistance :          { type: 'f', 	value:  4}, //消失距离
-    occlusionDistance :     { type: 'f', 	value:  1 }, //变为backColor距离
-    maxClipFactor :         { type: 'f', 	value:  1 },  //0-1
-    
-    
-    
-    depthTexture:{ value: null },
-    nearPlane:{value: 0.1},
-    farPlane:{value: 100000},
+	gapSize: { value: 1 }, // todo FIX - maybe change to totalSize
+	opacity: { value: 1 }
+
 };
 
 ShaderLib[ 'line' ] = {
@@ -59,10 +47,9 @@ ShaderLib[ 'line' ] = {
 		#include <logdepthbuf_pars_vertex>
 		#include <clipping_planes_pars_vertex>
 
-		uniform float lineWidth;
+		uniform float linewidth;
 		uniform vec2 resolution;
-        
-        
+
 		attribute vec3 instanceStart;
 		attribute vec3 instanceEnd;
 
@@ -108,8 +95,6 @@ ShaderLib[ 'line' ] = {
 				vLineDistance = ( position.y < 0.5 ) ? dashScale * instanceDistanceStart : dashScale * instanceDistanceEnd;
 
 			#endif
-            
-             
 
 			float aspect = resolution.x / resolution.y;
 
@@ -176,8 +161,8 @@ ShaderLib[ 'line' ] = {
 
 			}
 
-			// adjust for lineWidth
-			offset *= lineWidth;
+			// adjust for linewidth
+			offset *= linewidth;
 
 			// adjust for clip-space to screen-space conversion // maybe resolution should be based on viewport ...
 			offset /= resolution.y;
@@ -205,10 +190,7 @@ ShaderLib[ 'line' ] = {
 		`
 		uniform vec3 diffuse;
 		uniform float opacity;
-        uniform vec3 backColor;
-        uniform float occlusionDistance;
-        uniform float clipDistance;
-        uniform float maxClipFactor;
+
 		#ifdef USE_DASH
 
 			uniform float dashSize;
@@ -216,17 +198,7 @@ ShaderLib[ 'line' ] = {
 			uniform float gapSize;
 
 		#endif
-        
-        //加
-        #if defined(GL_EXT_frag_depth) && defined(useDepth)    
-            uniform sampler2D depthTexture;
-            uniform float nearPlane;
-            uniform float farPlane; 
-            uniform vec2 resolution;
-            uniform vec2 viewportOffset;
-        #endif
-        
-        
+
 		varying float vLineDistance;
 
 		#include <common>
@@ -237,20 +209,6 @@ ShaderLib[ 'line' ] = {
 
 		varying vec2 vUv;
 
-
-
-        #if defined(GL_EXT_frag_depth) && defined(useDepth)  
-            float convertToLinear(float zValue)
-            {
-                float z = zValue * 2.0 - 1.0;
-                return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
-            }
-        #endif
-
-
-
-
-
 		void main() {
 
 			#include <clipping_planes_fragment>
@@ -258,15 +216,9 @@ ShaderLib[ 'line' ] = {
 			#ifdef USE_DASH
 
 				if ( vUv.y < - 1.0 || vUv.y > 1.0 ) discard; // discard endcaps
-                
-                
-                bool unvisible = mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize;
-                //加
-                #ifdef DASH_with_depth
-                    
-                #else  
-                    if (unvisible) discard; // todo - FIX
-                #endif
+
+				if ( mod( vLineDistance + dashOffset, dashSize + gapSize ) > dashSize ) discard; // todo - FIX
+
 			#endif
 
 			if ( abs( vUv.y ) > 1.0 ) {
@@ -279,53 +231,7 @@ ShaderLib[ 'line' ] = {
 
 			}
 
-            vec4 diffuseColor = vec4( diffuse, opacity );
-            //加
-            #if defined(GL_EXT_frag_depth) && defined(useDepth)    
-               
-                float mixFactor = 0.0;
-                float clipFactor = 0.0;
-
-                float fragDepth = convertToLinear(gl_FragCoord.z);
-
-                vec2 depthTxtCoords = vec2(gl_FragCoord.x - viewportOffset.x,  gl_FragCoord.y - viewportOffset.y) / resolution;
-
-                float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);
-
-                float delta = fragDepth - textureDepth;
-
-                if (delta > 0.0)
-                {
-                    
-                    mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);
-                    clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);
-                }
-                 
-                if (clipFactor == 1.0)
-                {
-                    discard;
-                }
-                
-                vec4 backColor_ = vec4(backColor, opacity); //vec4(0.8,0.8,0.8, 0.8*opacity);
-                 
-                #ifdef DASH_with_depth  
-                    // 只在被遮住的部分显示虚线, 所以若同时是虚线不可见部分和被遮住时, a为0
-                    if(unvisible) backColor_.a = 0.0;
-                #endif 
-                
-                //vec4 diffuseColor = vec4(mix(diffuse, backColor_, mixFactor), opacity*(1.0 - clipFactor));
-               
-               
-               
-                diffuseColor = mix(diffuseColor, backColor_ , mixFactor);   
-               
-               
-                diffuseColor.a *= (1.0 - clipFactor);  
-                
-            #endif
- 
-
- 
+			vec4 diffuseColor = vec4( diffuse, opacity );
 
 			#include <logdepthbuf_fragment>
 			#include <color_fragment>
@@ -355,101 +261,11 @@ var LineMaterial = function ( parameters ) {
 		clipping: true // required for clipping support
 
 	} );
-    this.supportExtDepth = parameters.supportExtDepth
-    
-    
+
 	this.dashed = false;
-    this.lineWidth_ = 0
-    if(parameters.color){
-        this.color = new Color(parameters.color)  
-    }
-    if(parameters.backColor){
-        this.uniforms.backColor.value = new Color(parameters.backColor)
-    }
-    if(parameters.clipDistance){
-        this.uniforms.clipDistance.value = parameters.clipDistance
-    }
-    if(parameters.occlusionDistance){
-        this.uniforms.occlusionDistance.value = parameters.occlusionDistance
-    }
-    if(parameters.maxClipFactor){
-        this.uniforms.maxClipFactor.value = parameters.maxClipFactor
-    }
-    
-   
 
 	Object.defineProperties( this, {
-        dashed:{//add
-            enumerable: true,
-
-			get: function () {
-
-				return 'USE_DASH' in this.defines 
 
-			},
-
-			set: function ( value ) {
-                if(value){
-                    this.defines.USE_DASH = ''
-                }else{
-                    delete this.defines.USE_DASH
-                }
-                this.needsUpdate = true
-			}  
-        },
-        
-        useDepth:{//add
-            enumerable: true,
-
-			get: function () {
-
-				return 'useDepth' in this.defines 
-
-			},
-
-			set: function ( value ) {
-                
-                value = value && !!this.supportExtDepth
-                
-                if(value != this.useDepth){ 
-                    if(value){
-                        this.defines.useDepth = ''
-                        this.updateDepthParams()
-                    }else{
-                        delete this.defines.useDepth
-                    }
-                    this.needsUpdate = true
-                }
-			}  
-        },
-        
-        dashWithDepth:{//add 
-            enumerable: true,
-
-			get: function () {
-
-				return 'DASH_with_depth' in this.defines 
-
-			},
-
-			set: function ( value ) {
-                
-                value = value && !!this.supportExtDepth
-                
-                
-                if(value != this.dashWithDepth){ 
-                    if(value){
-                        this.defines.DASH_with_depth = '' 
-                    }else{
-                        delete this.defines.DASH_with_depth
-                    }
-                    this.needsUpdate = true
-                }
-			}  
-        },
-       
-        
-        
 		color: {
 
 			enumerable: true,
@@ -468,20 +284,20 @@ var LineMaterial = function ( parameters ) {
 
 		},
 
-		lineWidth: {
+		linewidth: {
 
 			enumerable: true,
 
 			get: function () {
 
-				return this.lineWidth_;//this.uniforms.lineWidth.value;
+				return this.uniforms.linewidth.value;
 
 			},
 
 			set: function ( value ) {
- 
-				this.uniforms.lineWidth.value = value * window.devicePixelRatio;
-                this.lineWidth_ = value
+
+				this.uniforms.linewidth.value = value;
+
 			}
 
 		},
@@ -597,49 +413,6 @@ var LineMaterial = function ( parameters ) {
 	} );
 
 	this.setValues( parameters );
-    
-    
-    
-    let setSize = (e)=>{ 
-        let viewport = e.viewport
-        let viewportOffset = viewport.offset || new Vector2() 
-        this.uniforms.resolution.value.copy(viewport.resolution2) 
-        this.uniforms.viewportOffset.value.copy(viewportOffset) 
-        this.lineWidth = this.lineWidth_
-    }
-    
-    let viewport = viewer.mainViewport;
-     
-    setSize({viewport})
-
-
-    viewer.addEventListener('resize',(e)=>{
-        if(!e.viewport || e.viewport.camera.isPerspectiveCamera){//地图不需要
-            setSize(e)
-            //console.log(this.name +  viewportOffset.toArray())     
-        } 
-    })  
-
-    
-    
-    if(this.supportExtDepth){
-     
-        //add
-        this.updateDepthParams()
-        
-        /* viewer.addEventListener('camera_changed', (e)=>{
-            if(e.viewport.name != 'mapViewport') this.updateDepthParams(e) 
-        })  */  
- 
-    
-        viewer.addEventListener("render.begin", (e)=>{//before render  如果有大于两个viewport的话,不同viewport用不同的depthTex
-            if(e.viewport.camera.isPerspectiveCamera) this.updateDepthParams(e)
-        }) 
-
-    }
-
-
-
 
 };
 
@@ -647,13 +420,5 @@ LineMaterial.prototype = Object.create( ShaderMaterial.prototype );
 LineMaterial.prototype.constructor = LineMaterial;
 
 LineMaterial.prototype.isLineMaterial = true;
-LineMaterial.prototype.updateDepthParams = function(e={}){   
-    if(this.useDepth){ 
-        var viewport = e.viewport || viewer.mainViewport;
-        var camera = viewport.camera;
-        this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(viewport).depthTexture  //viewer.getPRenderer().rtEDL.depthTexture  
-        this.uniforms.nearPlane.value = camera.near; //似乎因为这个所以对OrthographicCamera 无效
-        this.uniforms.farPlane.value = camera.far; 
-    }
-}
+
 export { LineMaterial };

+ 1 - 1
libs/three.js/lines/LineSegments2.js

@@ -90,7 +90,7 @@ LineSegments2.prototype = Object.assign( Object.create( Mesh.prototype ), {
 			var geometry = this.geometry;
 			var material = this.material;
 			var resolution = material.resolution;
-			var lineWidth = material.lineWidth + threshold;
+			var lineWidth = material.linewidth + threshold;
 
 			var instanceStart = geometry.attributes.instanceStart;
 			var instanceEnd = geometry.attributes.instanceEnd;

+ 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 ];
 
 	},

+ 1 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "potree",
-  "version": "1.8.0",
+  "version": "1.7.0",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 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'
-
-
-
 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');
-            }
-        },
-        
-         
-        
 		//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
+ 39 - 1021
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 - 189
src/Potree.js

@@ -1,8 +1,3 @@
-export {config, settings} from "./settings.js";
-export {start} from "./start.js";
-
-
- 
 
 export * from "./Actions.js";
 export * from "./AnimationPath.js";
@@ -21,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";
@@ -37,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";
@@ -46,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";
@@ -72,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";
@@ -80,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";
@@ -110,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;
@@ -143,159 +128,9 @@ let resourcePath = scriptPath + '/resources';
 export {scriptPath, resourcePath};
 
 
-//add: 
-
-
-
-export async function loadFile(path, callback){
-    if(Potree.fileServer){
-        Potree.fileServer.get(path).then(data=>{ 
-            callback && callback(data)
-        })
-    }else{
-        let response = await fetch(path); 
-        let text = await response.text();
-        var data = JSON.parse(text)
-        callback && callback(data) 
-        return data
-    }
-    
-    //查询: 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){//之后直接把path写进来
-    var path 
-    if(Potree.fileServer){
-        path = `/laser/dataset/${Potree.settings.number}/getDataSet` 
-    }else{
-        path = `${Potree.settings.urls.prefix2}/indoor/${Potree.settings.number}/api/datasets`
-          
-    }
-    return loadFile(path, callback)
-    
-}
-
-
-//目前上传平面图后如果不点击保存按钮,数据还是旧的不生效
-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]
-        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`
-            
-        }
-        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
-             
-    }
-    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){
+export function loadPointCloud(path, name, callback){
 	let loaded = function(e){
 		e.pointcloud.name = name;
-        e.pointcloud.sceneCode = sceneCode //对应4dkk的场景码
-        
 		callback(e);
 	};
 
@@ -316,7 +151,7 @@ export function loadPointCloud(path, name, sceneCode, timeStamp, callback){
 				}
 			});
 		} 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}`));
@@ -326,7 +161,7 @@ export function loadPointCloud(path, name, sceneCode, timeStamp, callback){
 					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;
 
@@ -358,7 +193,7 @@ export function loadPointCloud(path, name, sceneCode, timeStamp, callback){
 					resolve({type: 'pointcloud_loaded', pointcloud: pointcloud});
 				}
 			});
-		}  */else if (path.indexOf('.vpc') > 0) {
+		} else if (path.indexOf('.vpc') > 0) {
 			PointCloudArena4DGeometry.load(path, function (geometry) {
 				if (!geometry) {
 					//callback({type: 'loading_failed'});

+ 22 - 151
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();
@@ -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");
-                    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,7 +1181,7 @@ 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){
@@ -1265,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);
@@ -1334,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);
 
@@ -1347,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);
@@ -1375,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);
@@ -1482,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);
@@ -1530,37 +1436,10 @@ export class Renderer {
 		gl.activeTexture(gl.TEXTURE2);
 		gl.bindTexture(gl.TEXTURE_2D, null);
 		gl.activeTexture(gl.TEXTURE0);
-        
-        
-        
-        
-        
-        
-        
-        
-        //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 
@@ -1594,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
 
 
- */
+
+

+ 26 - 44
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; });
@@ -76,7 +75,7 @@ export function updateVisibilityStructures(pointclouds, camera, areaSize) {
 		let camObjPos = new THREE.Vector3().setFromMatrixPosition(camMatrixObject);
 		camObjPositions.push(camObjPos);
 
-		if ( viewer.getObjVisiByReason(pointcloud, 'datasetSelection') &&  pointcloud.root !== null) {//改 visible -> 
+		if (pointcloud.visible && pointcloud.root !== null) {
 			priorityQueue.push({pointcloud: i, node: pointcloud.root, weight: Number.MAX_VALUE});
 		}
 
@@ -101,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;
@@ -115,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
@@ -133,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;
 		}
 
@@ -157,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];
@@ -175,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){
@@ -303,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);
 			}
 		}
@@ -322,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) {
@@ -398,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 {
@@ -418,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";
+
 
 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
-    }
-} */

+ 2 - 19
src/loader/BinaryLoader.js

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

+ 1 - 1
src/loader/GeoPackageLoader.js

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

+ 7 - 83
src/loader/POCLoader.js

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

+ 4 - 20
src/loader/PointAttributes.js

@@ -38,28 +38,12 @@ class PointAttribute{
 	}
 
 };
-//add
-const replacements = {
-    "COLOR_PACKED": "rgba",
-    "RGBA": "rgba",
-    "INTENSITY": "intensity",
-    "CLASSIFICATION": "classification",
-    "GPS_TIME": "gps-time",
-};
-const replaceOldNames = (old) => {
-    if(replacements[old]){
-        return replacements[old];
-    }else{
-        return old;
-    }
-};
-
 
 PointAttribute.POSITION_CARTESIAN = new PointAttribute(
 	"POSITION_CARTESIAN", PointAttributeTypes.DATA_TYPE_FLOAT, 3);
 
 PointAttribute.RGBA_PACKED = new PointAttribute(
-	replaceOldNames("COLOR_PACKED"), PointAttributeTypes.DATA_TYPE_INT8, 4);
+	"COLOR_PACKED", PointAttributeTypes.DATA_TYPE_INT8, 4);
 
 PointAttribute.COLOR_PACKED = PointAttribute.RGBA_PACKED;
 
@@ -70,10 +54,10 @@ PointAttribute.NORMAL_FLOATS = new PointAttribute(
 	"NORMAL_FLOATS", PointAttributeTypes.DATA_TYPE_FLOAT, 3);
 
 PointAttribute.INTENSITY = new PointAttribute(
-	replaceOldNames("INTENSITY"), PointAttributeTypes.DATA_TYPE_UINT16, 1);
+	"INTENSITY", PointAttributeTypes.DATA_TYPE_UINT16, 1);
 
 PointAttribute.CLASSIFICATION = new PointAttribute(
-	replaceOldNames("CLASSIFICATION"), PointAttributeTypes.DATA_TYPE_UINT8, 1);
+	"CLASSIFICATION", PointAttributeTypes.DATA_TYPE_UINT8, 1);
 
 PointAttribute.NORMAL_SPHEREMAPPED = new PointAttribute(
 	"NORMAL_SPHEREMAPPED", PointAttributeTypes.DATA_TYPE_UINT8, 2);
@@ -100,7 +84,7 @@ PointAttribute.SPACING = new PointAttribute(
 	"SPACING", PointAttributeTypes.DATA_TYPE_FLOAT, 1);
 
 PointAttribute.GPS_TIME = new PointAttribute(
-	replaceOldNames("GPS_TIME"), PointAttributeTypes.DATA_TYPE_DOUBLE, 1);
+	"GPS_TIME", PointAttributeTypes.DATA_TYPE_DOUBLE, 1);
 
 export {PointAttribute};
 

+ 1 - 1
src/loader/ShapefileLoader.js

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

+ 0 - 122
src/materials/DepthBasicMaterial.js

@@ -1,122 +0,0 @@
-
-import * as THREE from "../../libs/three.js/build/three.module.js";
-import {Shaders} from "../../build/shaders/shaders.js";
-import {Features} from "../Features.js";
-    
- 
-export default class DepthBasicMaterial extends THREE.ShaderMaterial{ 
-    constructor(o={}){
-        let {width, height} = viewer.renderer.getSize(new THREE.Vector2());
-        
-        let uniforms = {
-			resolution:    { type: 'v2',  value: new THREE.Vector2(width, height ) },
-            viewportOffset: { type: 'v2',  value: new THREE.Vector2(0, 0 ) }, //left, top    
-			nearPlane:     { type: 'f', 	value: 0.1 },
-			farPlane:      { type: 'f', 	value: 10000 }, 
-			depthTexture:   { type: 't', 	value: null }, 
-			opacity:        { type: 'f',	value: o.opacity == void 0 ? 1 : o.opacity },
-			map:             { type: 't', 	value: o.map }, 
-            baseColor:     {type:'v3',      value: o.color ?  new THREE.Color(o.color) :  new THREE.Color("#ffffff")},
-            backColor:     {type:'v3',      value: o.backColor ?  new THREE.Color(o.backColor) :  new THREE.Color("#ddd")},
-            clipDistance :     { type: 'f', 	value:o.clipDistance || 4}, //消失距离
-            occlusionDistance :     { type: 'f', 	value: o.occlusionDistance || 1 }, //变为backColor距离
-            maxClipFactor :  { type: 'f', 	value: o.maxClipFactor || 1 },  //0-1
-      
-
-		}  
-        
-        let defines = {};
-        if(o.useDepth && Features.EXT_DEPTH.isSupported())defines.useDepth = ''
-        if(o.map)defines.use_map = ''
-         
-        super({ 
-            uniforms,
-            vertexShader: Shaders['depthBasic.vs'],   
-            fragmentShader: Shaders['depthBasic.fs'],
-            depthWrite: !1,
-            depthTest: !1,
-            transparent: o.transparent == void 0 ?  true : o.transparent,
-            side: o.side || 0 /* THREE.DoubleSide */,
-            defines, 
-        } )
-        
-        if(o.useDepth && Features.EXT_DEPTH.isSupported()) this.useDepth_ = true
-        
-        
-        let setSize = (e)=>{//如果出现横条状的异常,往往是viewportOffset出错 
-            let viewport = e.viewport
-            let viewportOffset = viewport.offset || new THREE.Vector2() 
-            this.uniforms.resolution.value.copy(viewport.resolution2) 
-            this.uniforms.viewportOffset.value.copy(viewportOffset)
-            
-            //console.log('depth '+viewportOffset.toArray())
-        }
-        
-        let viewport = viewer.mainViewport;
-             
-        setSize( {viewport} )
-        
-        viewer.addEventListener('resize',(e)=>{ 
-            if(!e.viewport || e.viewport.camera.isPerspectiveCamera){//地图不需要
-                setSize(e)
-                //console.log(this.name +  viewportOffset.toArray())     
-            } 
-        })  
-      
-        
-        if(this.useDepth){  
-            
-            /* viewer.addEventListener('camera_changed', (e)=>{
-                if(e.viewport.name != 'mapViewport') this.updateDepthParams(e) 
-            }) */ 
-         
-            viewer.addEventListener("render.begin", (e)=>{//before render  如果有大于两个viewport的话,不同viewport用不同的depthTex
-                if(e.viewport.camera.isPerspectiveCamera) this.updateDepthParams(e)
-            })
-            
-            this.updateDepthParams()
-        }
-         
-        
-        //点云变化时要一直触发updateDepthParams??
-        //viewer.once("render.pass.end",this.updateDepthParams.bind(this))
-    }
-    
-    updateDepthParams(e={}){//主要用于点云遮住mesh
-        if(this.useDepth){ 
-            var viewport = e.viewport || viewer.mainViewport;
-            var camera = viewport.camera;
-            this.uniforms.depthTexture.value = viewer.getPRenderer().getRtEDL(viewport).depthTexture   //其实只赋值一次就行
-            this.uniforms.nearPlane.value = camera.near;
-            this.uniforms.farPlane.value = camera.far;
-            
-        }            
-    } 
-    set map(map){
-        this.uniforms.map.value = map; 
-    }
-    
-    get useDepth(){
-        return this.useDepth_
-    }
-    
-    set useDepth(value){//如果不支持 EXT_DEPTH 的话会失效
-        if(this.useDepth_ != value){
-            if(value && Features.EXT_DEPTH.isSupported()){
-                this.defines.useDepth = ''
-                this.updateDepthParams()
-            }else{
-                delete this.defines.useDepth
-            }
-            this.useDepth_ = value
-            this.needsUpdate = true
-        }
-    } 
-    
-    
-    /* dispose(){ 
-        super.dispose()
-        viewer.depthBasic
-    } */
-    
-}

+ 2 - 6
src/materials/EyeDomeLightingMaterial.js

@@ -17,9 +17,8 @@ export class EyeDomeLightingMaterial extends THREE.RawShaderMaterial{
 		super();
 
 		let uniforms = {
-			/* screenWidth:    { type: 'f', 	value: 0 },
-			screenHeight:   { type: 'f', 	value: 0 }, */ 
-            resolution:    { type: 'v2',  value: new THREE.Vector2() },
+			screenWidth:    { type: 'f', 	value: 0 },
+			screenHeight:   { type: 'f', 	value: 0 },
 			edlStrength:    { type: 'f', 	value: 1.0 },
 			uNear:          { type: 'f', 	value: 1.0 },
 			uFar:           { type: 'f', 	value: 1.0 },
@@ -30,9 +29,6 @@ export class EyeDomeLightingMaterial extends THREE.RawShaderMaterial{
 			uEDLDepth:      { type: 't', 	value: null },
 			opacity:        { type: 'f',	value: 1.0 },
 			uProj:          { type: "Matrix4fv", value: [] },
-            
-            
-            useEDL:         { type: 'i', 	value: 1 }//add
 		};
 
 		this.setValues({

+ 0 - 106
src/materials/InfiniteGridMaterial.js

@@ -1,106 +0,0 @@
-
-import * as THREE from "../../libs/three.js/build/three.module.js";
- 
-
- 
-let vertexShader = `
-           
-   varying vec3 worldPosition;
-   
-   uniform float uDistance;
-   
-   void main() {
-   
-        vec3 pos = position.xzy * uDistance;
-        pos.xz += cameraPosition.xz;
-        
-        worldPosition = pos;
-        
-        gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);
-   
-   }
-   ` 
-
-
-let fragmentShader = `
-   
-   varying vec3 worldPosition;
-   
-   uniform float uSize1;
-   uniform float uSize2;
-   uniform vec3 uColor;
-   uniform float uDistance;
-    
-    
-    
-    float getGrid(float size) {
-    
-        vec2 r = worldPosition.xz / size;
-        
-        
-        vec2 grid = abs(fract(r - 0.5) - 0.5) / fwidth(r);
-        float line = min(grid.x, grid.y);
-        
-    
-        return 1.0 - min(line, 1.0);
-    }
-    
-   void main() {
-   
-        
-          float d = 1.0 - min(distance(cameraPosition.xz, worldPosition.xz) / uDistance, 1.0);
-        
-          float g1 = getGrid(uSize1);
-          float g2 = getGrid(uSize2);
-          
-          
-          gl_FragColor = vec4(uColor.rgb, mix(g2, g1, g1) * pow(d, 3.0));
-          gl_FragColor.a = mix(0.5 * gl_FragColor.a, gl_FragColor.a, g2);
-        
-          if ( gl_FragColor.a <= 0.0 ) discard;
-        
-   
-   }
-`
-
-
-
-
-
-
-
-
-export default class InfiniteGridMaterial extends THREE.ShaderMaterial{
-    constructor(o={}){ 
-        let color = o.color instanceof THREE.Color ? o.color : new THREE.Color(o.color || 'white');
-        let size1 = o.size1 || 10;
-        let size2 = o.size2 || 100; 
-        let distance = o.distance || 8000;
- 
-        let uniforms = { 
-            uSize1: {
-                value: size1
-            },
-            uSize2: {
-                value: size2
-            },
-            uColor: {
-                value: color
-            },
-            uDistance: {
-                value: distance
-            }
-        } 
-        
-        super({
-            uniforms,
-            vertexShader,
-            fragmentShader,
-            transparent: true,
-            side :  THREE.DoubleSide,
-            extensions: {
-                derivatives: true
-            }
-        }) 
-    }
-}

+ 35 - 153
src/materials/PointCloudMaterial.js

@@ -5,7 +5,7 @@ import {Gradients} from "./Gradients.js";
 import {Shaders} from "../../build/shaders/shaders.js";
 import {ClassificationScheme} from "./ClassificationScheme.js";
 import {PointSizeType, PointShape, TreeType, ElevationGradientRepeat} from "../defines.js";
-import {Features} from "../Features.js";
+
 //
 // how to calculate the radius of a projected sphere in screen space
 // http://stackoverflow.com/questions/21648630/radius-of-projected-sphere-in-screen-space
@@ -17,10 +17,6 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 	constructor (parameters = {}) {
 		super();
 
-        
-        
-        
-        
 		this.visibleNodesTexture = Utils.generateDataTexture(2048, 1, new THREE.Color(0xffffff));
 		this.visibleNodesTexture.minFilter = THREE.NearestFilter;
 		this.visibleNodesTexture.magFilter = THREE.NearestFilter;
@@ -35,7 +31,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 
 		let pointSize = getValid(parameters.size, 1.0);
 		let minSize = getValid(parameters.minSize, 2.0);
-		let maxSize = getValid(parameters.maxSize, 1550.0);
+		let maxSize = getValid(parameters.maxSize, 50.0);
 		let treeType = getValid(parameters.treeType, TreeType.OCTREE);
 
 		this._pointSizeType = PointSizeType.FIXED;
@@ -44,7 +40,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		this.clipBoxes = [];
 		this.clipPolygons = [];
 		this._weighted = false;
-		this._gradient = Gradients.RAINBOW//Gradients.SPECTRAL;//海拔贴图种类
+		this._gradient = Gradients.SPECTRAL;
 		this.gradientTexture = PointCloudMaterial.generateGradientTexture(this._gradient);
 		this._matcap = "matcap.jpg";
 		this.matcapTexture = Potree.PointCloudMaterial.generateMatcapTexture(this._matcap);
@@ -60,7 +56,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 
 		this._defaultIntensityRangeChanged = false;
 		this._defaultElevationRangeChanged = false;
-  
+
 		{
 			const [width, height] = [256, 1];
 			let data = new Uint8Array(width * 4);
@@ -90,9 +86,8 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 			blendHardness:		{ type: "f", value: 2.0 },
 			blendDepthSupplement:	{ type: "f", value: 0.0 },
 			fov:				{ type: "f", value: 1.0 },
-			/* screenWidth:		{ type: "f", value: 1.0 },
-			screenHeight:		{ type: "f", value: 1.0 }, */
-            resolution:    { type: 'v2',  value: new THREE.Vector2() },
+			screenWidth:		{ type: "f", value: 1.0 },
+			screenHeight:		{ type: "f", value: 1.0 },
 			near:				{ type: "f", value: 0.1 },
 			far:				{ type: "f", value: 1.0 },
 			uColor:				{ type: "c", value: new THREE.Color( 0xffffff ) },
@@ -155,43 +150,6 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 			uFilterPointSourceIDClipRange:		{ type: "fv", value: [0, 65535]},
 			matcapTextureUniform: 	{ type: "t", value: this.matcapTexture },
 			backfaceCulling: { type: "b", value: false },
-            
-            ////////////////add
-            //usePanoMap:{ type: "i", value: 0 }, 
-			progress: {
-				type: "f",
-				value: 0
-			},
-            easeInOutRatio:{
-                type: "f",
-				value: 0.3
-            },
-			pano0Map: {
-				type: "t",
-				value: null
-			},
-			pano0Position: {
-				type: "v3",
-				value: new THREE.Vector3
-			},
-			pano0Matrix: {
-				type: "m4",
-				value: new THREE.Matrix4
-			},
-			pano1Map: {
-				type: "t",
-				value: null
-			},
-			pano1Position: {
-				type: "v3",
-				value: new THREE.Vector3
-			},
-			pano1Matrix: {
-				type: "m4",
-				value: new THREE.Matrix4
-            },    
-            
-            
 		};
 
 		this.classification = ClassificationScheme.DEFAULT;
@@ -223,7 +181,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		this.defines.delete(key);
 	}
 
-	updateShaderSource () { 
+	updateShaderSource () {
 
 		let vs = Shaders['pointcloud.vs'];
 		let fs = Shaders['pointcloud.fs'];
@@ -247,13 +205,13 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		this.vertexShader = vs;
 		this.fragmentShader = fs;
 
-		if (this.opacity === 1.0 && !this.useFilterByNormal) {//add useFilterByNormal
+		if (this.opacity === 1.0) {
 			this.blending = THREE.NoBlending;
 			this.transparent = false;
 			this.depthTest = true;
 			this.depthWrite = true;
 			this.depthFunc = THREE.LessEqualDepth;
-		} else if (  (this.opacity < 1.0 ||this.useFilterByNormal) &&   !this.useEDL) {//add useFilterByNormal
+		} else if (this.opacity < 1.0 && !this.useEDL) {
 			this.blending = THREE.AdditiveBlending;
 			this.transparent = true;
 			this.depthTest = false;
@@ -273,7 +231,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 
 	getDefines () {
 		let defines = [];
- 
+
 		if (this.pointSizeType === PointSizeType.FIXED) {
 			defines.push('#define fixed_point_size');
 		} else if (this.pointSizeType === PointSizeType.ATTENUATED) {
@@ -281,22 +239,16 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		} else if (this.pointSizeType === PointSizeType.ADAPTIVE) {
 			defines.push('#define adaptive_point_size');
 		}
-        
-        if(!Features.EXT_DEPTH.isSupported() && this.shape === PointShape.PARABOLOID){
-            this.shape = PointShape.SQUARE ;//强行替换
-        }
-        
-        
+
 		if (this.shape === PointShape.SQUARE) {
 			defines.push('#define square_point_shape');
 		} else if (this.shape === PointShape.CIRCLE) {
 			defines.push('#define circle_point_shape');
-		}  else if (this.shape === PointShape.PARABOLOID) { 
+		} else if (this.shape === PointShape.PARABOLOID) {
 			defines.push('#define paraboloid_point_shape');
-		}  
-        //console.log('this.shape PARABOLOID', this.shape, this.shape === PointShape.PARABOLOID)
+		}
 
-		if (this._useEDL || this.fakeEDL) {
+		if (this._useEDL) {
 			defines.push('#define use_edl');
 		}
 
@@ -370,7 +322,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		return this._gradient;
 	}
 
-	set gradient (value) {//海拔贴图
+	set gradient (value) {
 		if (this._gradient !== value) {
 			this._gradient = value;
 			this.gradientTexture = PointCloudMaterial.generateGradientTexture(this._gradient);
@@ -478,7 +430,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 	}
 
 	set spacing (value) {
-		if (this.uniforms.spacing.value !== value) { // 即 uOctreeSpacing  来自cloud.js里
+		if (this.uniforms.spacing.value !== value) {
 			this.uniforms.spacing.value = value;
 		}
 	}
@@ -540,7 +492,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		}
 	}
 
-	/* get screenWidth () {
+	get screenWidth () {
 		return this.uniforms.screenWidth.value;
 	}
 
@@ -549,7 +501,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 			this.uniforms.screenWidth.value = value;
 			// this.updateShaderSource();
 		}
-	} 
+	}
 
 	get screenHeight () {
 		return this.uniforms.screenHeight.value;
@@ -560,19 +512,8 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 			this.uniforms.screenHeight.value = value;
 			// this.updateShaderSource();
 		}
-	}*/
-    
-    //add--------------
-    get resolution(){
-        return this.uniforms.resolution.value
-    }
-    set resolution(value){
-        this.uniforms.resolution.value.copy(value);
-    }
-    //--------------
-    
-    
-    
+	}
+
 	get near () {
 		return this.uniforms.near.value;
 	}
@@ -640,12 +581,9 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 	}
 
 	set pointSizeType (value) {
-        
-        if(typeof value == 'string' )value = PointSizeType[value]
-        
 		if (this._pointSizeType !== value) {
 			this._pointSizeType = value;
-			this.updateShaderSource();              //这句表明这个属性频繁更改会卡顿
+			this.updateShaderSource();
 			this.dispatchEvent({
 				type: 'point_size_type_changed',
 				target: this
@@ -667,48 +605,24 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 			this.updateShaderSource();
 		}
 	}
-    
-    get fakeEDL(){
-		return this._fakeEDL;
-	}
-    set fakeEDL (value) {//add
-		if (this._fakeEDL !== value) {
-			this._fakeEDL = value;
-			this.updateShaderSource();
-		}
-	}
+
 	get color () {
 		return this.uniforms.uColor.value;
 	}
 
-	set color (value) {//改
-        
-        if(value == this.color_)return
-        let color = value;
-		//if (!this.uniforms.uColor.value.equals(value)) {
-        if(typeof value == 'string') {
-            var colorArr = Potree.config.colors[value]  
-            if(!colorArr){ 
-                //console.warn('没找到该颜色值'+ value)
-            }else{
-                color = new THREE.Color().fromArray(colorArr).multiplyScalar(1/255)
-            }                
-            
-        }    
-        this.uniforms.uColor.value.set(color)  
-        //this.uniforms.uColor.value.copy(value);
+	set color (value) {
+		if (!this.uniforms.uColor.value.equals(value)) {
+			this.uniforms.uColor.value.copy(value);
 			
-        this.dispatchEvent({
-            type: 'color_changed',
-            target: this
-        });
-        this.dispatchEvent({
-            type: 'material_property_changed',
-            target: this
-        });
-		//}
-        
-        this.color_ = value //记录下str
+			this.dispatchEvent({
+				type: 'color_changed',
+				target: this
+			});
+			this.dispatchEvent({
+				type: 'material_property_changed',
+				target: this
+			});
+		}
 	}
 
 	get shape () {
@@ -765,9 +679,6 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		}
 	}
 
-
-     
-
 	get minSize(){
 		return this.uniforms.minSize.value;
 	}
@@ -1116,7 +1027,7 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		}
 	}
 
-	static generateGradientTexture (gradient) { 
+	static generateGradientTexture (gradient) {
 		let size = 64;
 
 		// create canvas
@@ -1175,33 +1086,6 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 		this._hiddenListeners = undefined;
 	};
 
-    ////////////////////////add
-    setProjectedPanos(pano0, pano1, progressValue, easeInOutRatio){
-        
-        //this.uniforms.usePanoMap.value = 1
-        this.usePanoMap = true
-        
- 		progressValue!=void 0 && (this.uniforms.progress.value = progressValue);
-		//pano0.ensureSkyboxReadyForRender();
-		this.uniforms.pano0Map.value = pano0.getSkyboxTexture()
-		this.uniforms.pano0Position.value.copy(pano0.position)
-		this.uniforms.pano0Matrix.value.copy(pano0.panoMatrix  );
-		//pano1.ensureSkyboxReadyForRender();
- 
-        this.uniforms.easeInOutRatio.value =  easeInOutRatio || 0; //之前做点云和全景混合时加的,为了让点云颜色柔和切换到全景颜色。如不混合就0
-		
-		this.uniforms.pano1Map.value = pano1.getSkyboxTexture()
-		this.uniforms.pano1Position.value.copy(pano1.position)
-		this.uniforms.pano1Matrix.value.copy(pano1.panoMatrix   );
-           
-        //this.updateShaderSource()
-        //this.needsUpdate = true;
- 	}
-    stopProjectedPanos(){
-        //this.uniforms.usePanoMap.value = 0
-        this.usePanoMap = false
-    } 
-
 	// copyFrom(from){
 
 	// 	var a = 10;
@@ -1214,7 +1098,5 @@ export class PointCloudMaterial extends THREE.RawShaderMaterial {
 	// copy(from){
 	// 	this.copyFrom(from);
 	// }
-    
-    
 
 }

+ 0 - 9
src/materials/shaders/basicTextured.fs

@@ -1,9 +0,0 @@
-varying vec2 vUv;
-uniform float alpha;
-uniform sampler2D tDiffuse;
-
-
-void main() {
-  vec4 texColor = texture2D(tDiffuse, vUv);
-  gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);
-}

+ 0 - 6
src/materials/shaders/basicTextured.vs

@@ -1,6 +0,0 @@
-varying vec2 vUv;
-void main() {
-  vUv = uv;
-  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
-} 
-  

+ 0 - 10
src/materials/shaders/copyCubeMap.fs

@@ -1,10 +0,0 @@
-varying vec3 vWorldPos;
-uniform float alpha;
-uniform samplerCube tDiffuse;
-
-
-void main() {
-  vec4 texColor = textureCube(tDiffuse, vWorldPos);
-  gl_FragColor = vec4(texColor.rgb, texColor.a * alpha);
-} 
-     

+ 0 - 14
src/materials/shaders/copyCubeMap.vs

@@ -1,14 +0,0 @@
-varying vec3 vWorldPos;
-vec3 transformAxis( vec3 direction ) //navvis->4dkk
-{
-    float y = direction.y;
-    direction.y = direction.z;
-    direction.z = -y;
-    return  direction;
-}
-void main() {
-  vWorldPos = vec3(-position.x, -position.y, position.z);
-  //vWorldPos = transformAxis(vWorldPos);
-  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
-} 
- 

+ 0 - 94
src/materials/shaders/depthBasic.fs

@@ -1,94 +0,0 @@
-varying vec2 vUv;
-uniform float opacity;
-
-uniform vec3 baseColor;
-uniform vec3 backColor;
-uniform float occlusionDistance;
-uniform float clipDistance;
-uniform float maxClipFactor;
-
-
-#if defined use_map
-    uniform sampler2D map; 
-#endif
- 
-#if defined(GL_EXT_frag_depth) && defined(useDepth)  
-    //似乎通过gl.getExtension('EXT_frag_depth')得到的GL_EXT_frag_depth
-     
-    uniform sampler2D depthTexture;
-    uniform float nearPlane;
-    uniform float farPlane; 
-    uniform vec2 resolution;
-    uniform vec2 viewportOffset; //  viewportOffset 范围从0-整个画布的像素
-    
-    float convertToLinear(float zValue)
-    {
-        float z = zValue * 2.0 - 1.0;
-        return (2.0 * nearPlane * farPlane) / (farPlane + nearPlane - z * (farPlane - nearPlane));
-    }
-#endif
-  
-void main() {
-  
-    
-    vec4 color = vec4(baseColor, opacity);
-    
-    
-    
-    #if defined(GL_EXT_frag_depth) && defined(useDepth)
-        // mixFactor and clipFactor define the color mixing proportion between the states of
-        // full visibility and occluded visibility
-        // and
-        // full visibility and total invisibility
-        
-        float mixFactor = 0.0;
-        float clipFactor = 0.0;
-        
-        
-        // The linear depth value of the current fragment
-        float fragDepth = convertToLinear(gl_FragCoord.z);
-
-        // The coordinates of the current fragment in the depth texture
-        vec2 depthTxtCoords = vec2(gl_FragCoord.x-viewportOffset.x,  gl_FragCoord.y - viewportOffset.y) / resolution;
-     
-        // The linear depth value of the pixel occupied by this fragment in the depth buffer
-        float textureDepth = convertToLinear(texture2D(depthTexture, depthTxtCoords).r);
-
-        // The difference between the two depths
-        float delta =  fragDepth - textureDepth;
-
-        if (delta > 0.0)//差距
-        {
-            // occlusionDistance and clipDistance define the width of the respective zones and
-            // mixFactor and clipFactor express the interpolation between the two colors depending on the position
-            // of the current fragment withing those zones.
-            
-            
-            mixFactor = clamp(delta / occlusionDistance, 0.0, 1.0);
-            clipFactor = clamp(delta / clipDistance, 0.0, maxClipFactor);
-        }
-        
-        // If the fragment is totally transparent, don't bother drawing it
-        if (clipFactor == 1.0)
-        {
-            discard;
-        }else{
-            
-            #if defined use_map
-                color = texture2D(map, vUv) * color; 
-            #endif
-           
-            
-             
-            color = vec4(mix(color.rgb, backColor, mixFactor), color.a * (1.0 - clipFactor));
-        }
-         
-    #else
-        #if defined use_map
-            color = texture2D(map, vUv) * color;
-        #endif 
-    #endif
-  
-    gl_FragColor = color;
-  
-}

+ 0 - 10
src/materials/shaders/depthBasic.vs

@@ -1,10 +0,0 @@
-
- 
-
-varying vec2 vUv;
-void main() {
-    
-  vUv = uv;
-  gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
-} 
- 

+ 22 - 34
src/materials/shaders/edl.fs

@@ -9,18 +9,15 @@
 precision mediump float;
 precision mediump int;
 
-//uniform float screenWidth;
-//uniform float screenHeight;
-uniform vec2 resolution;
-
-
+uniform float screenWidth;
+uniform float screenHeight;
 uniform vec2 neighbours[NEIGHBOUR_COUNT];
 uniform float edlStrength;
 uniform float radius;
 uniform float opacity;
 
-//uniform float uNear;
-//uniform float uFar;
+uniform float uNear;
+uniform float uFar;
 
 uniform mat4 uProj;
 
@@ -29,10 +26,8 @@ uniform sampler2D uEDLDepth;
 
 varying vec2 vUv;
 
-uniform int useEDL;
-
 float response(float depth){
-	vec2 uvRadius = radius / resolution;             //vec2(screenWidth, screenHeight);
+	vec2 uvRadius = radius / vec2(screenWidth, screenHeight);
 	
 	float sum = 0.0;
 	
@@ -59,30 +54,23 @@ void main(){
 	
 	float depth = cEDL.a;
 	depth = (depth == 1.0) ? 0.0 : depth;
-    
-    if(depth == 0.0){
+	float res = response(depth);
+	float shade = exp(-res * 300.0 * edlStrength);
+
+	gl_FragColor = vec4(cEDL.rgb * shade, opacity);
+
+	{ // write regular hyperbolic depth values to depth buffer
+		float dl = pow(2.0, depth);
+
+		vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);
+		float pz = dp.z / dp.w;
+		float fragDepth = (pz + 1.0) / 2.0;
+
+		gl_FragDepthEXT = fragDepth;
+	}
+
+	if(depth == 0.0){
 		discard;
 	}
-    
-    
-    if(useEDL == 1){
-        float res = response(depth);
-        float shade = exp(-res * 300.0 * edlStrength);
-
-        gl_FragColor = vec4(cEDL.rgb * shade, opacity); 
-    }else{//加  不改颜色的情况
-        gl_FragColor = vec4(cEDL.rgb, opacity);
-    } 
-    
-    
-    { // write regular hyperbolic depth values to depth buffer  修改深度
-        float dl = pow(2.0, depth);
-
-        vec4 dp = uProj * vec4(0.0, 0.0, -dl, 1.0);
-        float pz = dp.z / dp.w;
-        float fragDepth = (pz + 1.0) / 2.0;
-
-        gl_FragDepthEXT = fragDepth;
-    }
-	
+
 }

+ 0 - 30
src/materials/shaders/otherShaders.js

@@ -1,30 +0,0 @@
-export const copyShader = {
-    uniforms: {
-        tDiffuse: {
-            type: "t",
-            value: null
-        },
-        opacity: {
-            type: "f",
-            value: 1
-        }
-    },
-    vertexShader: ` 
-        varying vec2 vUv;
-        void main() {
-            vUv = uv; 
-            gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
-        }
-    `,
-    fragmentShader: `
-        uniform float opacity;
-        uniform sampler2D tDiffuse;
-        varying vec2 vUv;
-        void main() { 
-            vec4 texel = texture2D( tDiffuse, vUv );
-            gl_FragColor = opacity * texel; 
-        } 
-     `    
-}
-
- 

+ 0 - 102
src/materials/shaders/pointcloud - 原始.fs

@@ -1,102 +0,0 @@
-
-#if defined paraboloid_point_shape
-	#extension GL_EXT_frag_depth : enable
-#endif
-
-precision highp float;
-precision highp int;
-
-uniform mat4 viewMatrix;
-uniform mat4 uViewInv;
-uniform mat4 uProjInv;
-uniform vec3 cameraPosition;
-
-
-uniform mat4 projectionMatrix;
-uniform float uOpacity;
-
-uniform float blendHardness;
-uniform float blendDepthSupplement;
-uniform float fov;
-uniform float uSpacing;
-uniform float near;
-uniform float far;
-uniform float uPCIndex;
-uniform float uScreenWidth;
-uniform float uScreenHeight;
-
-varying vec3	vColor;
-varying float	vLogDepth;
-varying vec3	vViewPosition;
-varying float	vRadius;
-varying float 	vPointSize;
-varying vec3 	vPosition;
-
-
-float specularStrength = 1.0;
-
-void main() {
-
-	// gl_FragColor = vec4(vColor, 1.0);
-
-	vec3 color = vColor;
-	float depth = gl_FragCoord.z;
-
-	#if defined(circle_point_shape) || defined(paraboloid_point_shape) 
-		float u = 2.0 * gl_PointCoord.x - 1.0;
-		float v = 2.0 * gl_PointCoord.y - 1.0;
-	#endif
-	
-	#if defined(circle_point_shape) 
-		float cc = u*u + v*v;
-		if(cc > 1.0){
-			discard;
-		}
-	#endif
-		
-	#if defined color_type_indices
-		gl_FragColor = vec4(color, uPCIndex / 255.0);
-	#else
-		gl_FragColor = vec4(color, uOpacity);
-	#endif
-
-	#if defined paraboloid_point_shape
-		float wi = 0.0 - ( u*u + v*v);
-		vec4 pos = vec4(vViewPosition, 1.0);
-		pos.z += wi * vRadius;
-		float linearDepth = -pos.z;
-		pos = projectionMatrix * pos;
-		pos = pos / pos.w;
-		float expDepth = pos.z;
-		depth = (pos.z + 1.0) / 2.0;
-		gl_FragDepthEXT = depth;
-		
-		#if defined(color_type_depth)
-			color.r = linearDepth;
-			color.g = expDepth;
-		#endif
-		
-		#if defined(use_edl)
-			gl_FragColor.a = log2(linearDepth);
-		#endif
-		
-	#else
-		#if defined(use_edl)
-			gl_FragColor.a = vLogDepth;
-		#endif
-	#endif
-
-	#if defined(weighted_splats)
-		float distance = 2.0 * length(gl_PointCoord.xy - 0.5);
-		float weight = max(0.0, 1.0 - distance);
-		weight = pow(weight, 1.5);
-
-		gl_FragColor.a = weight;
-		gl_FragColor.xyz = gl_FragColor.xyz * weight;
-	#endif
-
-	//gl_FragColor = vec4(0.0, 0.7, 0.0, 1.0);
-	
-}
-
-

+ 0 - 981
src/materials/shaders/pointcloud - 原始.vs

@@ -1,981 +0,0 @@
-
-precision highp float;
-precision highp int;
-
-#define max_clip_polygons 8
-#define PI 3.141592653589793
-
-attribute vec3 position;
-attribute vec3 color;
-attribute float intensity;
-attribute float classification;
-attribute float returnNumber;
-attribute float numberOfReturns;
-attribute float pointSourceID;
-attribute vec4 indices;
-attribute float spacing;
-attribute float gpsTime;
-attribute vec3 normal;
-attribute float aExtra;
-
-uniform mat4 modelMatrix;
-uniform mat4 modelViewMatrix;
-uniform mat4 projectionMatrix;
-uniform mat4 viewMatrix;
-uniform mat4 uViewInv;
-
-uniform float uScreenWidth;
-uniform float uScreenHeight;
-uniform float fov;
-uniform float near;
-uniform float far;
-
-uniform bool uDebug;
-
-uniform bool uUseOrthographicCamera;
-uniform float uOrthoWidth;
-uniform float uOrthoHeight;
-
-#define CLIPTASK_NONE 0
-#define CLIPTASK_HIGHLIGHT 1
-#define CLIPTASK_SHOW_INSIDE 2
-#define CLIPTASK_SHOW_OUTSIDE 3
-
-#define CLIPMETHOD_INSIDE_ANY 0
-#define CLIPMETHOD_INSIDE_ALL 1
-
-uniform int clipTask;
-uniform int clipMethod;
-#if defined(num_clipboxes) && num_clipboxes > 0
-	uniform mat4 clipBoxes[num_clipboxes];
-#endif
-
-#if defined(num_clipspheres) && num_clipspheres > 0
-	uniform mat4 uClipSpheres[num_clipspheres];
-#endif
-
-#if defined(num_clippolygons) && num_clippolygons > 0
-	uniform int uClipPolygonVCount[num_clippolygons];
-	uniform vec3 uClipPolygonVertices[num_clippolygons * 8];
-	uniform mat4 uClipPolygonWVP[num_clippolygons];
-#endif
-
-
-uniform float size;
-uniform float minSize;
-uniform float maxSize;
-
-uniform float uPCIndex;
-uniform float uOctreeSpacing;
-uniform float uNodeSpacing;
-uniform float uOctreeSize;
-uniform vec3 uBBSize;
-uniform float uLevel;
-uniform float uVNStart;
-uniform bool uIsLeafNode;
-
-uniform vec3 uColor;
-uniform float uOpacity;
-
-uniform vec2 elevationRange;
-uniform vec2 intensityRange;
-
-uniform vec2 uFilterReturnNumberRange;
-uniform vec2 uFilterNumberOfReturnsRange;
-uniform vec2 uFilterPointSourceIDClipRange;
-uniform vec2 uFilterGPSTimeClipRange;
-uniform float uGpsScale;
-uniform float uGpsOffset;
-
-uniform vec2 uNormalizedGpsBufferRange;
-
-uniform vec3 uIntensity_gbc;
-uniform vec3 uRGB_gbc;
-uniform vec3 uExtra_gbc;
-
-uniform float uTransition;
-uniform float wRGB;
-uniform float wIntensity;
-uniform float wElevation;
-uniform float wClassification;
-uniform float wReturnNumber;
-uniform float wSourceID;
-
-uniform vec2 uExtraNormalizedRange;
-uniform vec2 uExtraRange;
-uniform float uExtraScale;
-uniform float uExtraOffset;
-
-uniform vec3 uShadowColor;
-
-uniform sampler2D visibleNodes;
-uniform sampler2D gradient;
-uniform sampler2D classificationLUT;
-
-#if defined(color_type_matcap)
-uniform sampler2D matcapTextureUniform;
-#endif
-uniform bool backfaceCulling;
-
-#if defined(num_shadowmaps) && num_shadowmaps > 0
-uniform sampler2D uShadowMap[num_shadowmaps];
-uniform mat4 uShadowWorldView[num_shadowmaps];
-uniform mat4 uShadowProj[num_shadowmaps];
-#endif
-
-varying vec3	vColor;
-varying float	vLogDepth;
-varying vec3	vViewPosition;
-varying float 	vRadius;
-varying float 	vPointSize;
-
-
-float round(float number){
-	return floor(number + 0.5);
-}
-
-// 
-//    ###    ########     ###    ########  ######## #### ##     ## ########     ######  #### ######## ########  ######  
-//   ## ##   ##     ##   ## ##   ##     ##    ##     ##  ##     ## ##          ##    ##  ##       ##  ##       ##    ## 
-//  ##   ##  ##     ##  ##   ##  ##     ##    ##     ##  ##     ## ##          ##        ##      ##   ##       ##       
-// ##     ## ##     ## ##     ## ########     ##     ##  ##     ## ######       ######   ##     ##    ######    ######  
-// ######### ##     ## ######### ##           ##     ##   ##   ##  ##                ##  ##    ##     ##             ## 
-// ##     ## ##     ## ##     ## ##           ##     ##    ## ##   ##          ##    ##  ##   ##      ##       ##    ## 
-// ##     ## ########  ##     ## ##           ##    ####    ###    ########     ######  #### ######## ########  ######  
-// 																			
-
-
-// ---------------------
-// OCTREE
-// ---------------------
-
-#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_octree)
-/**
- * number of 1-bits up to inclusive index position
- * number is treated as if it were an integer in the range 0-255
- *
- */
-int numberOfOnes(int number, int index){
-	int numOnes = 0;
-	int tmp = 128;
-	for(int i = 7; i >= 0; i--){
-		
-		if(number >= tmp){
-			number = number - tmp;
-
-			if(i <= index){
-				numOnes++;
-			}
-		}
-		
-		tmp = tmp / 2;
-	}
-
-	return numOnes;
-}
-
-
-/**
- * checks whether the bit at index is 1
- * number is treated as if it were an integer in the range 0-255
- *
- */
-bool isBitSet(int number, int index){
-
-	// weird multi else if due to lack of proper array, int and bitwise support in WebGL 1.0
-	int powi = 1;
-	if(index == 0){
-		powi = 1;
-	}else if(index == 1){
-		powi = 2;
-	}else if(index == 2){
-		powi = 4;
-	}else if(index == 3){
-		powi = 8;
-	}else if(index == 4){
-		powi = 16;
-	}else if(index == 5){
-		powi = 32;
-	}else if(index == 6){
-		powi = 64;
-	}else if(index == 7){
-		powi = 128;
-	}else{
-		return false;
-	}
-
-	int ndp = number / powi;
-
-	return mod(float(ndp), 2.0) != 0.0;
-}
-
-
-/**
- * find the LOD at the point position
- */
-float getLOD(){
-	
-	vec3 offset = vec3(0.0, 0.0, 0.0);
-	int iOffset = int(uVNStart);
-	float depth = uLevel;
-	for(float i = 0.0; i <= 30.0; i++){
-		float nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);
-		
-		vec3 index3d = (position-offset) / nodeSizeAtLevel;
-		index3d = floor(index3d + 0.5);
-		int index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));
-		
-		vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
-		int mask = int(round(value.r * 255.0));
-
-		if(isBitSet(mask, index)){
-			// there are more visible child nodes at this position
-			int advanceG = int(round(value.g * 255.0)) * 256;
-			int advanceB = int(round(value.b * 255.0));
-			int advanceChild = numberOfOnes(mask, index - 1);
-			int advance = advanceG + advanceB + advanceChild;
-
-			iOffset = iOffset + advance;
-			
-			depth++;
-		}else{
-			// no more visible child nodes at this position
-			//return value.a * 255.0;
-
-			float lodOffset = (255.0 * value.a) / 10.0 - 10.0;
-
-			return depth  + lodOffset;
-		}
-		
-		offset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;
-	}
-		
-	return depth;
-}
-
-float getSpacing(){
-	vec3 offset = vec3(0.0, 0.0, 0.0);
-	int iOffset = int(uVNStart);
-	float depth = uLevel;
-	float spacing = uNodeSpacing;
-	for(float i = 0.0; i <= 30.0; i++){
-		float nodeSizeAtLevel = uOctreeSize / pow(2.0, i + uLevel + 0.0);
-		
-		vec3 index3d = (position-offset) / nodeSizeAtLevel;
-		index3d = floor(index3d + 0.5);
-		int index = int(round(4.0 * index3d.x + 2.0 * index3d.y + index3d.z));
-		
-		vec4 value = texture2D(visibleNodes, vec2(float(iOffset) / 2048.0, 0.0));
-		int mask = int(round(value.r * 255.0));
-		float spacingFactor = value.a;
-
-		if(i > 0.0){
-			spacing = spacing / (255.0 * spacingFactor);
-		}
-		
-
-		if(isBitSet(mask, index)){
-			// there are more visible child nodes at this position
-			int advanceG = int(round(value.g * 255.0)) * 256;
-			int advanceB = int(round(value.b * 255.0));
-			int advanceChild = numberOfOnes(mask, index - 1);
-			int advance = advanceG + advanceB + advanceChild;
-
-			iOffset = iOffset + advance;
-
-			//spacing = spacing / (255.0 * spacingFactor);
-			//spacing = spacing / 3.0;
-			
-			depth++;
-		}else{
-			// no more visible child nodes at this position
-			return spacing;
-		}
-		
-		offset = offset + (vec3(1.0, 1.0, 1.0) * nodeSizeAtLevel * 0.5) * index3d;
-	}
-		
-	return spacing;
-}
-
-float getPointSizeAttenuation(){
-	return pow(2.0, getLOD());
-}
-
-
-#endif
-
-
-// ---------------------
-// KD-TREE
-// ---------------------
-
-#if (defined(adaptive_point_size) || defined(color_type_level_of_detail)) && defined(tree_type_kdtree)
-
-float getLOD(){
-	vec3 offset = vec3(0.0, 0.0, 0.0);
-	float iOffset = 0.0;
-	float depth = 0.0;
-		
-		
-	vec3 size = uBBSize;	
-	vec3 pos = position;
-		
-	for(float i = 0.0; i <= 1000.0; i++){
-		
-		vec4 value = texture2D(visibleNodes, vec2(iOffset / 2048.0, 0.0));
-		
-		int children = int(value.r * 255.0);
-		float next = value.g * 255.0;
-		int split = int(value.b * 255.0);
-		
-		if(next == 0.0){
-		 	return depth;
-		}
-		
-		vec3 splitv = vec3(0.0, 0.0, 0.0);
-		if(split == 1){
-			splitv.x = 1.0;
-		}else if(split == 2){
-		 	splitv.y = 1.0;
-		}else if(split == 4){
-		 	splitv.z = 1.0;
-		}
-		
-		iOffset = iOffset + next;
-		
-		float factor = length(pos * splitv / size);
-		if(factor < 0.5){
-			// left
-		if(children == 0 || children == 2){
-				return depth;
-			}
-		}else{
-			// right
-			pos = pos - size * splitv * 0.5;
-			if(children == 0 || children == 1){
-				return depth;
-			}
-			if(children == 3){
-				iOffset = iOffset + 1.0;
-			}
-		}
-		size = size * ((1.0 - (splitv + 1.0) / 2.0) + 0.5);
-		
-		depth++;
-	}
-		
-		
-	return depth;	
-}
-
-float getPointSizeAttenuation(){
-	return 0.5 * pow(1.3, getLOD());
-}
-
-#endif
-
-
-
-// 
-//    ###    ######## ######## ########  #### ########  ##     ## ######## ########  ######  
-//   ## ##      ##       ##    ##     ##  ##  ##     ## ##     ##    ##    ##       ##    ## 
-//  ##   ##     ##       ##    ##     ##  ##  ##     ## ##     ##    ##    ##       ##       
-// ##     ##    ##       ##    ########   ##  ########  ##     ##    ##    ######    ######  
-// #########    ##       ##    ##   ##    ##  ##     ## ##     ##    ##    ##             ## 
-// ##     ##    ##       ##    ##    ##   ##  ##     ## ##     ##    ##    ##       ##    ## 
-// ##     ##    ##       ##    ##     ## #### ########   #######     ##    ########  ######                                                                               
-// 
-
-
-
-// formula adapted from: http://www.dfstudios.co.uk/articles/programming/image-programming-algorithms/image-processing-algorithms-part-5-contrast-adjustment/
-float getContrastFactor(float contrast){
-	return (1.0158730158730156 * (contrast + 1.0)) / (1.0158730158730156 - contrast);
-}
-
-vec3 getRGB(){
-	vec3 rgb = color;
-	
-	rgb = pow(rgb, vec3(uRGB_gbc.x));
-	rgb = rgb + uRGB_gbc.y;
-	rgb = (rgb - 0.5) * getContrastFactor(uRGB_gbc.z) + 0.5;
-	rgb = clamp(rgb, 0.0, 1.0);
-
-	return rgb;
-}
-
-float getIntensity(){
-	float w = (intensity - intensityRange.x) / (intensityRange.y - intensityRange.x);
-	w = pow(w, uIntensity_gbc.x);
-	w = w + uIntensity_gbc.y;
-	w = (w - 0.5) * getContrastFactor(uIntensity_gbc.z) + 0.5;
-	w = clamp(w, 0.0, 1.0);
-
-	return w;
-}
-
-vec3 getGpsTime(){
-
-	float w = (gpsTime + uGpsOffset) * uGpsScale;
-
-
-	vec3 c = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
-
-
-	// vec2 r = uNormalizedGpsBufferRange;
-	// float w = gpsTime * (r.y - r.x) + r.x;
-	// w = clamp(w, 0.0, 1.0);
-	// vec3 c = texture2D(gradient, vec2(w,1.0-w)).rgb;
-	
-	return c;
-}
-
-vec3 getElevation(){
-	vec4 world = modelMatrix * vec4( position, 1.0 );
-	float w = (world.z - elevationRange.x) / (elevationRange.y - elevationRange.x);
-	vec3 cElevation = texture2D(gradient, vec2(w,1.0-w)).rgb;
-	
-	return cElevation;
-}
-
-vec4 getClassification(){
-	vec2 uv = vec2(classification / 255.0, 0.5);
-	vec4 classColor = texture2D(classificationLUT, uv);
-	
-	return classColor;
-}
-
-vec3 getReturns(){
-
-	// 0b 00_000_111
-	float rn = mod(returnNumber, 8.0);
-	// 0b 00_111_000
-	float nr = mod(returnNumber / 8.0, 8.0);
-
-	if(nr <= 1.0){
-		return vec3(1.0, 0.0, 0.0);
-	}else{
-		return vec3(0.0, 1.0, 0.0);
-	}
-
-	// return vec3(nr / 4.0, 0.0, 0.0);
-
-	// if(nr == 1.0){
-	// 	return vec3(1.0, 1.0, 0.0);
-	// }else{
-	// 	if(rn == 1.0){
-	// 		return vec3(1.0, 0.0, 0.0);
-	// 	}else if(rn == nr){
-	// 		return vec3(0.0, 0.0, 1.0);
-	// 	}else{
-	// 		return vec3(0.0, 1.0, 0.0);
-	// 	}
-	// }
-
-	// if(numberOfReturns == 1.0){
-	// 	return vec3(1.0, 1.0, 0.0);
-	// }else{
-	// 	if(returnNumber == 1.0){
-	// 		return vec3(1.0, 0.0, 0.0);
-	// 	}else if(returnNumber == numberOfReturns){
-	// 		return vec3(0.0, 0.0, 1.0);
-	// 	}else{
-	// 		return vec3(0.0, 1.0, 0.0);
-	// 	}
-	// }
-}
-
-vec3 getReturnNumber(){
-	if(numberOfReturns == 1.0){
-		return vec3(1.0, 1.0, 0.0);
-	}else{
-		if(returnNumber == 1.0){
-			return vec3(1.0, 0.0, 0.0);
-		}else if(returnNumber == numberOfReturns){
-			return vec3(0.0, 0.0, 1.0);
-		}else{
-			return vec3(0.0, 1.0, 0.0);
-		}
-	}
-}
-
-vec3 getNumberOfReturns(){
-	float value = numberOfReturns;
-
-	float w = value / 6.0;
-
-	vec3 color = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
-
-	return color;
-}
-
-vec3 getSourceID(){
-	float w = mod(pointSourceID, 10.0) / 10.0;
-	return texture2D(gradient, vec2(w,1.0 - w)).rgb;
-}
-
-vec3 getCompositeColor(){
-	vec3 c;
-	float w;
-
-	c += wRGB * getRGB();
-	w += wRGB;
-	
-	c += wIntensity * getIntensity() * vec3(1.0, 1.0, 1.0);
-	w += wIntensity;
-	
-	c += wElevation * getElevation();
-	w += wElevation;
-	
-	c += wReturnNumber * getReturnNumber();
-	w += wReturnNumber;
-	
-	c += wSourceID * getSourceID();
-	w += wSourceID;
-	
-	vec4 cl = wClassification * getClassification();
-	c += cl.a * cl.rgb;
-	w += wClassification * cl.a;
-
-	c = c / w;
-	
-	if(w == 0.0){
-		//c = color;
-		gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-	}
-	
-	return c;
-}
-
-
-vec3 getNormal(){
-	//vec3 n_hsv = vec3( modelMatrix * vec4( normal, 0.0 )) * 0.5 + 0.5; // (n_world.xyz + vec3(1.,1.,1.)) / 2.;
-	vec3 n_view = normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );
-	return n_view;
-}
-bool applyBackfaceCulling() {
-	// Black not facing vertices / Backface culling
-	vec3 e = normalize(vec3(modelViewMatrix * vec4( position, 1. )));
-	vec3 n = getNormal(); // normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );
-
-	if((uUseOrthographicCamera && n.z <= 0.) || (!uUseOrthographicCamera && dot( n, e ) >= 0.)) { 
-		return true;
-	} else {
-		return false;
-	}
-}
-
-#if defined(color_type_matcap)
-// Matcap Material
-vec3 getMatcap(){ 
-	vec3 eye = normalize( vec3( modelViewMatrix * vec4( position, 1. ) ) ); 
-	if(uUseOrthographicCamera) { 
-		eye = vec3(0., 0., -1.);
-	}
-	vec3 r_en = reflect( eye, getNormal() ); // or r_en = e - 2. * dot( n, e ) * n;
-	float m = 2. * sqrt(pow( r_en.x, 2. ) + pow( r_en.y, 2. ) + pow( r_en.z + 1., 2. ));
-	vec2 vN = r_en.xy / m + .5;
-	return texture2D(matcapTextureUniform, vN).rgb; 
-}
-#endif
-
-vec3 getExtra(){
-
-	float w = (aExtra + uExtraOffset) * uExtraScale;
-	w = clamp(w, 0.0, 1.0);
-
-	vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;
-
-	// vec2 r = uExtraNormalizedRange;
-
-	// float w = aExtra * (r.y - r.x) + r.x;
-
-	// w = (w - uExtraRange.x) / (uExtraRange.y - uExtraRange.x);
-
-	// w = clamp(w, 0.0, 1.0);
-
-	// vec3 color = texture2D(gradient, vec2(w,1.0-w)).rgb;
-
-	return color;
-}
-
-vec3 getColor(){
-	vec3 color;
-	
-	#ifdef color_type_rgba
-		color = getRGB();
-	#elif defined color_type_height || defined color_type_elevation
-		color = getElevation();
-	#elif defined color_type_rgb_height
-		vec3 cHeight = getElevation();
-		color = (1.0 - uTransition) * getRGB() + uTransition * cHeight;
-	#elif defined color_type_depth
-		float linearDepth = gl_Position.w;
-		float expDepth = (gl_Position.z / gl_Position.w) * 0.5 + 0.5;
-		color = vec3(linearDepth, expDepth, 0.0);
-		//color = vec3(1.0, 0.5, 0.3);
-	#elif defined color_type_intensity
-		float w = getIntensity();
-		color = vec3(w, w, w);
-	#elif defined color_type_gps_time
-		color = getGpsTime();
-	#elif defined color_type_intensity_gradient
-		float w = getIntensity();
-		color = texture2D(gradient, vec2(w,1.0-w)).rgb;
-	#elif defined color_type_color
-		color = uColor;
-	#elif defined color_type_level_of_detail
-		float depth = getLOD();
-		float w = depth / 10.0;
-		color = texture2D(gradient, vec2(w,1.0-w)).rgb;
-	#elif defined color_type_indices
-		color = indices.rgb;
-	#elif defined color_type_classification
-		vec4 cl = getClassification(); 
-		color = cl.rgb;
-	#elif defined color_type_return_number
-		color = getReturnNumber();
-	#elif defined color_type_returns
-		color = getReturns();
-	#elif defined color_type_number_of_returns
-		color = getNumberOfReturns();
-	#elif defined color_type_source_id
-		color = getSourceID();
-	#elif defined color_type_point_source_id
-		color = getSourceID();
-	#elif defined color_type_normal
-		color = (modelMatrix * vec4(normal, 0.0)).xyz;
-	#elif defined color_type_phong
-		color = color;
-	#elif defined color_type_composite
-		color = getCompositeColor();
-	#elif defined color_type_matcap
-		color = getMatcap();
-	#else 
-		color = getExtra();
-	#endif
-	
-	if (backfaceCulling && applyBackfaceCulling()) {
-		color = vec3(0.);
-	}
-
-	return color;
-}
-
-float getPointSize(){
-	float pointSize = 1.0;
-	
-	float slope = tan(fov / 2.0);
-	float projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);
-
-	float scale = length(
-		modelViewMatrix * vec4(0, 0, 0, 1) - 
-		modelViewMatrix * vec4(uOctreeSpacing, 0, 0, 1)
-	) / uOctreeSpacing;
-	projFactor = projFactor * scale;
-	
-	float r = uOctreeSpacing * 1.7;
-	vRadius = r;
-	#if defined fixed_point_size
-		pointSize = size;
-	#elif defined attenuated_point_size
-		if(uUseOrthographicCamera){
-			pointSize = size;
-		}else{
-			pointSize = size * spacing * projFactor;
-			//pointSize = pointSize * projFactor;
-		}
-	#elif defined adaptive_point_size
-		if(uUseOrthographicCamera) {
-			float worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();
-			pointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;
-		} else {
-			float worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();
-			pointSize = worldSpaceSize * projFactor;
-		}
-	#endif
-
-	pointSize = max(minSize, pointSize);
-	pointSize = min(maxSize, pointSize);
-	
-	vRadius = pointSize / projFactor;
-
-	return pointSize;
-}
-
-#if defined(num_clippolygons) && num_clippolygons > 0
-bool pointInClipPolygon(vec3 point, int polyIdx) {
-
-	mat4 wvp = uClipPolygonWVP[polyIdx];
-	//vec4 screenClipPos = uClipPolygonVP[polyIdx] * modelMatrix * vec4(point, 1.0);
-	//screenClipPos.xy = screenClipPos.xy / screenClipPos.w * 0.5 + 0.5;
-
-	vec4 pointNDC = wvp * vec4(point, 1.0);
-	pointNDC.xy = pointNDC.xy / pointNDC.w;
-
-	int j = uClipPolygonVCount[polyIdx] - 1;
-	bool c = false;
-	for(int i = 0; i < 8; i++) {
-		if(i == uClipPolygonVCount[polyIdx]) {
-			break;
-		}
-
-		//vec4 verti = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + i], 1);
-		//vec4 vertj = wvp * vec4(uClipPolygonVertices[polyIdx * 8 + j], 1);
-
-		//verti.xy = verti.xy / verti.w;
-		//vertj.xy = vertj.xy / vertj.w;
-
-		//verti.xy = verti.xy / verti.w * 0.5 + 0.5;
-		//vertj.xy = vertj.xy / vertj.w * 0.5 + 0.5;
-
-		vec3 verti = uClipPolygonVertices[polyIdx * 8 + i];
-		vec3 vertj = uClipPolygonVertices[polyIdx * 8 + j];
-
-		if( ((verti.y > pointNDC.y) != (vertj.y > pointNDC.y)) && 
-			(pointNDC.x < (vertj.x-verti.x) * (pointNDC.y-verti.y) / (vertj.y-verti.y) + verti.x) ) {
-			c = !c;
-		}
-		j = i;
-	}
-
-	return c;
-}
-#endif
-
-void doClipping(){
-
-	{
-		vec4 cl = getClassification(); 
-		if(cl.a == 0.0){
-			gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-			
-			return;
-		}
-	}
-
-	#if defined(clip_return_number_enabled)
-	{ // return number filter
-		vec2 range = uFilterReturnNumberRange;
-		if(returnNumber < range.x || returnNumber > range.y){
-			gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-			
-			return;
-		}
-	}
-	#endif
-
-	#if defined(clip_number_of_returns_enabled)
-	{ // number of return filter
-		vec2 range = uFilterNumberOfReturnsRange;
-		if(numberOfReturns < range.x || numberOfReturns > range.y){
-			gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-			
-			return;
-		}
-	}
-	#endif
-
-	#if defined(clip_gps_enabled)
-	{ // GPS time filter
-		float time = (gpsTime + uGpsOffset) * uGpsScale;
-		vec2 range = uFilterGPSTimeClipRange;
-
-		if(time < range.x || time > range.y){
-			gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-			
-			return;
-		}
-	}
-	#endif
-
-	#if defined(clip_point_source_id_enabled)
-	{ // point source id filter
-		vec2 range = uFilterPointSourceIDClipRange;
-		if(pointSourceID < range.x || pointSourceID > range.y){
-			gl_Position = vec4(100.0, 100.0, 100.0, 0.0);
-			
-			return;
-		}
-	}
-	#endif
-
-	int clipVolumesCount = 0;
-	int insideCount = 0;
-
-	#if defined(num_clipboxes) && num_clipboxes > 0
-		for(int i = 0; i < num_clipboxes; i++){
-			vec4 clipPosition = clipBoxes[i] * modelMatrix * vec4( position, 1.0 );
-			bool inside = -0.5 <= clipPosition.x && clipPosition.x <= 0.5;
-			inside = inside && -0.5 <= clipPosition.y && clipPosition.y <= 0.5;
-			inside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;
-
-			insideCount = insideCount + (inside ? 1 : 0);
-			clipVolumesCount++;
-		}	
-	#endif
-
-	#if defined(num_clippolygons) && num_clippolygons > 0
-		for(int i = 0; i < num_clippolygons; i++) {
-			bool inside = pointInClipPolygon(position, i);
-
-			insideCount = insideCount + (inside ? 1 : 0);
-			clipVolumesCount++;
-		}
-	#endif
-
-	bool insideAny = insideCount > 0;
-	bool insideAll = (clipVolumesCount > 0) && (clipVolumesCount == insideCount);
-
-	if(clipMethod == CLIPMETHOD_INSIDE_ANY){
-		if(insideAny && clipTask == CLIPTASK_HIGHLIGHT){
-			vColor.r += 0.5;
-		}else if(!insideAny && clipTask == CLIPTASK_SHOW_INSIDE){
-			gl_Position = vec4(100.0, 100.0, 100.0, 1.0);
-		}else if(insideAny && clipTask == CLIPTASK_SHOW_OUTSIDE){
-			gl_Position = vec4(100.0, 100.0, 100.0, 1.0);
-		}
-	}else if(clipMethod == CLIPMETHOD_INSIDE_ALL){
-		if(insideAll && clipTask == CLIPTASK_HIGHLIGHT){
-			vColor.r += 0.5;
-		}else if(!insideAll && clipTask == CLIPTASK_SHOW_INSIDE){
-			gl_Position = vec4(100.0, 100.0, 100.0, 1.0);
-		}else if(insideAll && clipTask == CLIPTASK_SHOW_OUTSIDE){
-			gl_Position = vec4(100.0, 100.0, 100.0, 1.0);
-		}
-	}
-}
-
-
-
-// 
-// ##     ##    ###    #### ##    ## 
-// ###   ###   ## ##    ##  ###   ## 
-// #### ####  ##   ##   ##  ####  ## 
-// ## ### ## ##     ##  ##  ## ## ## 
-// ##     ## #########  ##  ##  #### 
-// ##     ## ##     ##  ##  ##   ### 
-// ##     ## ##     ## #### ##    ## 
-//
-
-void main() {
-	vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );
-	vViewPosition = mvPosition.xyz;
-	gl_Position = projectionMatrix * mvPosition;
-	vLogDepth = log2(-mvPosition.z);
-
-	//gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
-	//gl_PointSize = 5.0;
-
-	// POINT SIZE
-	float pointSize = getPointSize();
-	//float pointSize = 2.0;
-	gl_PointSize = pointSize;
-	vPointSize = pointSize;
-
-	// COLOR
-	vColor = getColor();
-	// vColor = vec3(1.0, 0.0, 0.0);
-
-	//gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
-	//gl_Position = vec4(position.xzy / 1000.0, 1.0 );
-
-	//gl_PointSize = 5.0;
-	//vColor = vec3(1.0, 1.0, 1.0);
-
-	// only for "replacing" approaches
-	// if(getLOD() != uLevel){
-	// 	gl_Position = vec4(10.0, 10.0, 10.0, 1.0);
-	// }
-
-
-	#if defined hq_depth_pass
-		float originalDepth = gl_Position.w;
-		float adjustedDepth = originalDepth + 2.0 * vRadius;
-		float adjust = adjustedDepth / originalDepth;
-
-		mvPosition.xyz = mvPosition.xyz * adjust;
-		gl_Position = projectionMatrix * mvPosition;
-	#endif
-
-
-	// CLIPPING
-	doClipping();
-
-	#if defined(num_clipspheres) && num_clipspheres > 0
-		for(int i = 0; i < num_clipspheres; i++){
-			vec4 sphereLocal = uClipSpheres[i] * mvPosition;
-
-			float distance = length(sphereLocal.xyz);
-
-			if(distance < 1.0){
-				float w = distance;
-				vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
-				
-				vColor = cGradient;
-				//vColor = cGradient * 0.7 + vColor * 0.3;
-			}
-		}
-	#endif
-
-	#if defined(num_shadowmaps) && num_shadowmaps > 0
-
-		const float sm_near = 0.1;
-		const float sm_far = 10000.0;
-
-		for(int i = 0; i < num_shadowmaps; i++){
-			vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;
-			float distanceToLight = abs(viewPos.z);
-			
-			vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);
-			vec3 nc = projPos.xyz / projPos.w;
-			
-			float u = nc.x * 0.5 + 0.5;
-			float v = nc.y * 0.5 + 0.5;
-
-			vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;
-			vec2 sampleLocations[9];
-			sampleLocations[0] = vec2(0.0, 0.0);
-			sampleLocations[1] = sampleStep;
-			sampleLocations[2] = -sampleStep;
-			sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);
-			sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);
-
-			sampleLocations[5] = vec2(0.0, sampleStep.y);
-			sampleLocations[6] = vec2(0.0, -sampleStep.y);
-			sampleLocations[7] = vec2(sampleStep.x, 0.0);
-			sampleLocations[8] = vec2(-sampleStep.x, 0.0);
-
-			float visibleSamples = 0.0;
-			float numSamples = 0.0;
-
-			float bias = vRadius * 2.0;
-
-			for(int j = 0; j < 9; j++){
-				vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);
-
-				float linearDepthFromSM = depthMapValue.x + bias;
-				float linearDepthFromViewer = distanceToLight;
-
-				if(linearDepthFromSM > linearDepthFromViewer){
-					visibleSamples += 1.0;
-				}
-
-				numSamples += 1.0;
-			}
-
-			float visibility = visibleSamples / numSamples;
-
-			if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){
-				//vColor = vec3(0.0, 0.0, 0.2);
-			}else{
-				//vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);
-				vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);
-			}
-
-
-		}
-
-	#endif
-}

+ 8 - 91
src/materials/shaders/pointcloud.fs

@@ -2,41 +2,10 @@
 #if defined paraboloid_point_shape
 	#extension GL_EXT_frag_depth : enable
 #endif
-#define PI 3.141592653589793
-
-
 
 precision highp float;
 precision highp int;
 
-/*
-#if defined(usePanoMap) 
-    
-    uniform samplerCube pano0Map;   //随便设置一个samplerCube去使用都会让点云消失
-    uniform samplerCube pano1Map;
-     
-    uniform float progress;
-    uniform float easeInOutRatio;
-
-     
-    uniform vec3 pano0Position;
-    uniform mat4 pano0Matrix; 
-    uniform vec3 pano1Position;
-    uniform mat4 pano1Matrix;
-    varying vec3 vWorldPosition0;
-    varying vec3 vWorldPosition1;
-
-#endif 
-*/
-
-
-
-//------------
-
-
-
-
-
 uniform mat4 viewMatrix;
 uniform mat4 uViewInv;
 uniform mat4 uProjInv;
@@ -44,8 +13,7 @@ uniform vec3 cameraPosition;
 
 
 uniform mat4 projectionMatrix;
-//uniform float uOpacity;
-varying float vOpacity; //add
+uniform float uOpacity;
 
 uniform float blendHardness;
 uniform float blendDepthSupplement;
@@ -67,49 +35,11 @@ varying vec3 	vPosition;
 
 float specularStrength = 1.0;
 
-
-vec2 getSamplerCoord( vec3 direction ) 
-{
-    direction = normalize(direction);
-    float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;
-    float ty=acos(direction.z)/PI;
-
-    return vec2(tx,ty);
-}  
-
-
-
-
 void main() {
 
-    vec3 color = vColor;  
-	 
-    
-    /*#if defined(usePanoMap) //加     经测试,即使全部写在fragment里也是无论pointsize多大都是一个点一个颜色,所以干脆写在vectex里
-    
-    
-        vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);
-        vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);
-        
-        color = mix(colorFromPano0,colorFromPano1,progress).xyz; 
-        
-        
-        //float easeInOutRatio = 0.0;  //缓冲,渐变点云到贴图的颜色 
-        if(progress < easeInOutRatio){
-            float easeProgress = (easeInOutRatio - progress) / easeInOutRatio; 
-            color = mix(color,vColor,easeProgress); 
-        }else if(progress > 1.0 - easeInOutRatio){ 
-            float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio; 
-            color = mix(color,vColor,easeProgress); 
-        }
-        
-        
-    #else 
-        color = vColor;
-    #endif*/
-   
-   
-    
+	// gl_FragColor = vec4(vColor, 1.0);
+
+	vec3 color = vColor;
 	float depth = gl_FragCoord.z;
 
 	#if defined(circle_point_shape) || defined(paraboloid_point_shape) 
@@ -123,25 +53,12 @@ void main() {
 			discard;
 		}
 	#endif
-	
-
- 
-
-	
- 
-    #if defined color_type_indices    //pick point recognize
-		gl_FragColor = vec4(color, uPCIndex / 255.0); //uPCIndex : node Index
+		
+	#if defined color_type_indices
+		gl_FragColor = vec4(color, uPCIndex / 255.0);
 	#else
-		gl_FragColor = vec4(color, vOpacity);
+		gl_FragColor = vec4(color, uOpacity);
 	#endif
-    
-    
-    
-    
-    
-    
-    
-    
 
 	#if defined paraboloid_point_shape
 		float wi = 0.0 - ( u*u + v*v);

+ 126 - 279
src/materials/shaders/pointcloud.vs

@@ -5,40 +5,6 @@ precision highp int;
 #define max_clip_polygons 8
 #define PI 3.141592653589793
 
- 
-
-
-
-#if defined(usePanoMap) 
-    
-    uniform samplerCube pano0Map;   //随便设置一个samplerCube去使用都会让点云消失
-    uniform samplerCube pano1Map;
-     
-    uniform float progress;
-    uniform float easeInOutRatio;
-
-    
-    uniform vec3 pano0Position;
-    uniform mat4 pano0Matrix; 
-    uniform vec3 pano1Position;
-    uniform mat4 pano1Matrix;
-    /*
-    varying vec3 vWorldPosition0;
-    varying vec3 vWorldPosition1;
-    */
-#endif 
-
-
-
-
- 
-
-//--------------
-
-
-
-
-
 attribute vec3 position;
 attribute vec3 color;
 attribute float intensity;
@@ -46,7 +12,7 @@ attribute float classification;
 attribute float returnNumber;
 attribute float numberOfReturns;
 attribute float pointSourceID;
-attribute vec4 indices;    //每个点的index
+attribute vec4 indices;
 attribute float spacing;
 attribute float gpsTime;
 attribute vec3 normal;
@@ -58,18 +24,12 @@ uniform mat4 projectionMatrix;
 uniform mat4 viewMatrix;
 uniform mat4 uViewInv;
 
-//uniform float uScreenWidth;
-//uniform float uScreenHeight;
-uniform vec2 resolution;
-
-
+uniform float uScreenWidth;
+uniform float uScreenHeight;
 uniform float fov;
 uniform float near;
 uniform float far;
 
-
-
-
 uniform bool uDebug;
 
 uniform bool uUseOrthographicCamera;
@@ -115,10 +75,7 @@ uniform float uVNStart;
 uniform bool uIsLeafNode;
 
 uniform vec3 uColor;
-uniform float uOpacity; 
-varying float vOpacity; //add
-
-
+uniform float uOpacity;
 
 uniform vec2 elevationRange;
 uniform vec2 intensityRange;
@@ -127,8 +84,6 @@ uniform vec2 uFilterReturnNumberRange;
 uniform vec2 uFilterNumberOfReturnsRange;
 uniform vec2 uFilterPointSourceIDClipRange;
 uniform vec2 uFilterGPSTimeClipRange;
-//uniform float ufilterByNormalThreshold;    
-
 uniform float uGpsScale;
 uniform float uGpsOffset;
 
@@ -168,8 +123,6 @@ uniform mat4 uShadowWorldView[num_shadowmaps];
 uniform mat4 uShadowProj[num_shadowmaps];
 #endif
 
-
-
 varying vec3	vColor;
 varying float	vLogDepth;
 varying vec3	vViewPosition;
@@ -260,8 +213,8 @@ bool isBitSet(int number, int index){
 /**
  * find the LOD at the point position
  */
-float getLOD(){//////
-	 
+float getLOD(){
+	
 	vec3 offset = vec3(0.0, 0.0, 0.0);
 	int iOffset = int(uVNStart);
 	float depth = uLevel;
@@ -603,7 +556,6 @@ vec3 getNormal(){
 }
 bool applyBackfaceCulling() {
 	// Black not facing vertices / Backface culling
-      
 	vec3 e = normalize(vec3(modelViewMatrix * vec4( position, 1. )));
 	vec3 n = getNormal(); // normalize( vec3(modelViewMatrix * vec4( normal, 0.0 )) );
 
@@ -653,8 +605,6 @@ vec3 getColor(){
 	
 	#ifdef color_type_rgba
 		color = getRGB();
-         
-        
 	#elif defined color_type_height || defined color_type_elevation
 		color = getElevation();
 	#elif defined color_type_rgb_height
@@ -706,10 +656,10 @@ vec3 getColor(){
 		color = getExtra();
 	#endif
 	
-	if (backfaceCulling && applyBackfaceCulling()){
-        //color = vec3(0.);
-    }
-    //applyBackfaceCulling直接返回false或者注释color = vec3(0.);都没问题
+	if (backfaceCulling && applyBackfaceCulling()) {
+		color = vec3(0.);
+	}
+
 	return color;
 }
 
@@ -717,39 +667,29 @@ float getPointSize(){
 	float pointSize = 1.0;
 	
 	float slope = tan(fov / 2.0);
-	float projFactor = -0.5 * resolution.y / (slope * vViewPosition.z);
-    
-    
-    
-    /*
+	float projFactor = -0.5 * uScreenHeight / (slope * vViewPosition.z);
+
 	float scale = length(
 		modelViewMatrix * vec4(0, 0, 0, 1) - 
 		modelViewMatrix * vec4(uOctreeSpacing, 0, 0, 1)
 	) / uOctreeSpacing;
-    
 	projFactor = projFactor * scale;
-	*/
-    
-    
+	
 	float r = uOctreeSpacing * 1.7;
-	//vRadius = r;
-     
-    
+	vRadius = r;
 	#if defined fixed_point_size
 		pointSize = size;
 	#elif defined attenuated_point_size
 		if(uUseOrthographicCamera){
 			pointSize = size;
-		}else{  //近大远小,模拟真实mesh,边缘放大
-			//pointSize = size * spacing * projFactor;  //spacing是attribute  为空  如果有这个值就能更自适应填补
-            //pointSize = size * uOctreeSpacing * projFactor / 18.0; //直接用cloud的spacing里,不过因为都一样所以可能没有什么意义
+		}else{
+			pointSize = size * spacing * projFactor;
 			//pointSize = pointSize * projFactor;
-            pointSize = size * projFactor  ;
 		}
 	#elif defined adaptive_point_size
 		if(uUseOrthographicCamera) {
 			float worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();
-			pointSize = (worldSpaceSize / uOrthoWidth) * resolution.x;    //uScreenWidth;
+			pointSize = (worldSpaceSize / uOrthoWidth) * uScreenWidth;
 		} else {
 			float worldSpaceSize = 1.0 * size * r / getPointSizeAttenuation();
 			pointSize = worldSpaceSize * projFactor;
@@ -919,216 +859,123 @@ void doClipping(){
 // ##     ## ##     ## #### ##    ## 
 //
 
+void main() {
+	vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );
+	vViewPosition = mvPosition.xyz;
+	gl_Position = projectionMatrix * mvPosition;
+	vLogDepth = log2(-mvPosition.z);
 
-vec2 getSamplerCoord( vec3 direction ) 
-{
-    direction = normalize(direction);
-    float tx=atan(direction.x,-direction.y)/(PI*2.0)+0.5;
-    float ty=acos(direction.z)/PI;
+	//gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+	//gl_PointSize = 5.0;
 
-    return vec2(tx,ty);
-}  
+	// POINT SIZE
+	float pointSize = getPointSize();
+	//float pointSize = 2.0;
+	gl_PointSize = pointSize;
+	vPointSize = pointSize;
 
-vec3 transformAxis( vec3 direction ) //navvis->4dkk
-{
-    float y = direction.y;
-    direction.y = direction.z;
-    direction.z = -y;
-    return  direction;
-}
+	// COLOR
+	vColor = getColor();
+	// vColor = vec3(1.0, 0.0, 0.0);
 
-void main() {
-    bool filtered_by_normal = false; 
-
-    #ifdef use_filter_by_normal
-        if(abs(getNormal().z) > 0.3) { //ufilterByNormalThreshold 暂定0.3
-			// Move point outside clip space space to discard it.
-			//gl_Position = vec4(0.0, 0.0, 2.0, 1.0);   
-            //return;
-            filtered_by_normal = true; //标记一下。不直接不绘制,因为有的法线都是垂直向上
+	//gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
+	//gl_Position = vec4(position.xzy / 1000.0, 1.0 );
+
+	//gl_PointSize = 5.0;
+	//vColor = vec3(1.0, 1.0, 1.0);
+
+	// only for "replacing" approaches
+	// if(getLOD() != uLevel){
+	// 	gl_Position = vec4(10.0, 10.0, 10.0, 1.0);
+	// }
+
+
+	#if defined hq_depth_pass
+		float originalDepth = gl_Position.w;
+		float adjustedDepth = originalDepth + 2.0 * vRadius;
+		float adjust = adjustedDepth / originalDepth;
+
+		mvPosition.xyz = mvPosition.xyz * adjust;
+		gl_Position = projectionMatrix * mvPosition;
+	#endif
+
+
+	// CLIPPING
+	doClipping();
+
+	#if defined(num_clipspheres) && num_clipspheres > 0
+		for(int i = 0; i < num_clipspheres; i++){
+			vec4 sphereLocal = uClipSpheres[i] * mvPosition;
+
+			float distance = length(sphereLocal.xyz);
+
+			if(distance < 1.0){
+				float w = distance;
+				vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
+				
+				vColor = cGradient;
+				//vColor = cGradient * 0.7 + vColor * 0.3;
+			}
 		}
-    #endif
-     
-    vec4 mvPosition = modelViewMatrix * vec4(position, 1.0 );
-    vViewPosition = mvPosition.xyz;
-    gl_Position = projectionMatrix * mvPosition;
-    vLogDepth = log2(-mvPosition.z);
-
-
-     
-    // COLOR
-    //加-------------------
-    #if defined(usePanoMap)
-        vec4 worldPosition = modelMatrix * vec4(position, 1.0);
-         
-        vec3 positionLocalToPanoCenter0 = worldPosition.xyz - pano0Position;
-        vec3 vWorldPosition0 = (vec4(positionLocalToPanoCenter0, 1.0) * pano0Matrix).xyz; 
-        vWorldPosition0.x *= -1.0;
-        vWorldPosition0 = transformAxis(vWorldPosition0);
-        
-        vec3 positionLocalToPanoCenter1 = worldPosition.xyz - pano1Position;
-        vec3 vWorldPosition1 = (vec4(positionLocalToPanoCenter1, 1.0) * pano1Matrix).xyz; 
-        vWorldPosition1.x *= -1.0;
-        vWorldPosition1 = transformAxis(vWorldPosition1);
-         
-        /*
-        vec2 samplerCoord0 = getSamplerCoord(vWorldPosition0.xyz);
-        vec2 samplerCoord1 = getSamplerCoord(vWorldPosition1.xyz); 
-        vec4 colorFromPano0 = texture2D(pano0Map,samplerCoord0);
-        vec4 colorFromPano1 = texture2D(pano1Map,samplerCoord1);
-        */
-        
-        
-        
-        
-        vec4 colorFromPano0=textureCube(pano0Map,vWorldPosition0.xyz);
-        vec4 colorFromPano1=textureCube(pano1Map,vWorldPosition1.xyz);
-
-        vColor = mix(colorFromPano0,colorFromPano1,progress).xyz; 
-
-         
-        //float easeInOutRatio = 0.0;  //缓冲,渐变点云到贴图的颜色 
-        if(progress < easeInOutRatio){
-            float easeProgress = (easeInOutRatio - progress) / easeInOutRatio;
-            vec3 vColor1 = getColor();
-            vColor = mix(vColor,vColor1,easeProgress); 
-        }else if(progress > 1.0 - easeInOutRatio){ 
-            float easeProgress = (progress - (1.0 - easeInOutRatio) ) / easeInOutRatio;
-            vec3 vColor1 = getColor();
-            vColor = mix(vColor,vColor1,easeProgress); 
-        }
-        
-
-    #else
-     
-        vColor = getColor();
-    
-    #endif
-   
-   
-    //-------------------        
-
-    //数据集校准时,相机拉远后随着点云密集需降低透明度 
-    #ifdef attenuated_opacity  
-        //vOpacity = uOpacity * exp(-length(-mvPosition.xyz) / 1000.0);  //opacityAttenuation = 1000
-        vOpacity = uOpacity * exp(-mvPosition.z / 1000.0); 
-        vOpacity = clamp(vOpacity, 0.001, 1.0);          
-        if(filtered_by_normal){//垂直朝相机时降低透明度
-            vOpacity *= 0.05; 
-            vOpacity = clamp(vOpacity, 0.0001, 0.1);    
-        }  
-        
-    #else
-        vOpacity = uOpacity;
-    #endif
-	 
-
-    // POINT SIZE
-    float pointSize = getPointSize();
-    
-    gl_PointSize = pointSize;
-    vPointSize = pointSize;
-
-    
-    
-    
-     
-
-    // only for "replacing" approaches
-    // if(getLOD() != uLevel){
-    // 	gl_Position = vec4(10.0, 10.0, 10.0, 1.0);
-    // }
-
-
-    #if defined hq_depth_pass
-        float originalDepth = gl_Position.w;
-        float adjustedDepth = originalDepth + 2.0 * vRadius;
-        float adjust = adjustedDepth / originalDepth;
-
-        mvPosition.xyz = mvPosition.xyz * adjust;
-        gl_Position = projectionMatrix * mvPosition;
-    #endif
-
-
-    // CLIPPING
-    doClipping();
-
-    #if defined(num_clipspheres) && num_clipspheres > 0
-        for(int i = 0; i < num_clipspheres; i++){
-            vec4 sphereLocal = uClipSpheres[i] * mvPosition;
-
-            float distance = length(sphereLocal.xyz);
-
-            if(distance < 1.0){
-                float w = distance;
-                vec3 cGradient = texture2D(gradient, vec2(w, 1.0 - w)).rgb;
-                
-                vColor = cGradient;
-                //vColor = cGradient * 0.7 + vColor * 0.3;
-            }
-        }
-    #endif
-
-    #if defined(num_shadowmaps) && num_shadowmaps > 0
-
-        const float sm_near = 0.1;
-        const float sm_far = 10000.0;
-
-        for(int i = 0; i < num_shadowmaps; i++){
-            vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;
-            float distanceToLight = abs(viewPos.z);
-            
-            vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);
-            vec3 nc = projPos.xyz / projPos.w;
-            
-            float u = nc.x * 0.5 + 0.5;
-            float v = nc.y * 0.5 + 0.5;
-
-            vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;
-            vec2 sampleLocations[9];
-            sampleLocations[0] = vec2(0.0, 0.0);
-            sampleLocations[1] = sampleStep;
-            sampleLocations[2] = -sampleStep;
-            sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);
-            sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);
-
-            sampleLocations[5] = vec2(0.0, sampleStep.y);
-            sampleLocations[6] = vec2(0.0, -sampleStep.y);
-            sampleLocations[7] = vec2(sampleStep.x, 0.0);
-            sampleLocations[8] = vec2(-sampleStep.x, 0.0);
-
-            float visibleSamples = 0.0;
-            float numSamples = 0.0;
-
-            float bias = vRadius * 2.0;
-
-            for(int j = 0; j < 9; j++){
-                vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);
-
-                float linearDepthFromSM = depthMapValue.x + bias;
-                float linearDepthFromViewer = distanceToLight;
-
-                if(linearDepthFromSM > linearDepthFromViewer){
-                    visibleSamples += 1.0;
-                }
-
-                numSamples += 1.0;
-            }
-
-            float visibility = visibleSamples / numSamples;
+	#endif
+
+	#if defined(num_shadowmaps) && num_shadowmaps > 0
 
-            if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){
-                //vColor = vec3(0.0, 0.0, 0.2);
-            }else{
-                //vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);
-                vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);
-            }
+		const float sm_near = 0.1;
+		const float sm_far = 10000.0;
 
+		for(int i = 0; i < num_shadowmaps; i++){
+			vec3 viewPos = (uShadowWorldView[i] * vec4(position, 1.0)).xyz;
+			float distanceToLight = abs(viewPos.z);
+			
+			vec4 projPos = uShadowProj[i] * uShadowWorldView[i] * vec4(position, 1);
+			vec3 nc = projPos.xyz / projPos.w;
+			
+			float u = nc.x * 0.5 + 0.5;
+			float v = nc.y * 0.5 + 0.5;
+
+			vec2 sampleStep = vec2(1.0 / (2.0*1024.0), 1.0 / (2.0*1024.0)) * 1.5;
+			vec2 sampleLocations[9];
+			sampleLocations[0] = vec2(0.0, 0.0);
+			sampleLocations[1] = sampleStep;
+			sampleLocations[2] = -sampleStep;
+			sampleLocations[3] = vec2(sampleStep.x, -sampleStep.y);
+			sampleLocations[4] = vec2(-sampleStep.x, sampleStep.y);
+
+			sampleLocations[5] = vec2(0.0, sampleStep.y);
+			sampleLocations[6] = vec2(0.0, -sampleStep.y);
+			sampleLocations[7] = vec2(sampleStep.x, 0.0);
+			sampleLocations[8] = vec2(-sampleStep.x, 0.0);
+
+			float visibleSamples = 0.0;
+			float numSamples = 0.0;
+
+			float bias = vRadius * 2.0;
+
+			for(int j = 0; j < 9; j++){
+				vec4 depthMapValue = texture2D(uShadowMap[i], vec2(u, v) + sampleLocations[j]);
+
+				float linearDepthFromSM = depthMapValue.x + bias;
+				float linearDepthFromViewer = distanceToLight;
 
-        }
+				if(linearDepthFromSM > linearDepthFromViewer){
+					visibleSamples += 1.0;
+				}
 
-    #endif
+				numSamples += 1.0;
+			}
+
+			float visibility = visibleSamples / numSamples;
+
+			if(u < 0.0 || u > 1.0 || v < 0.0 || v > 1.0 || nc.x < -1.0 || nc.x > 1.0 || nc.y < -1.0 || nc.y > 1.0 || nc.z < -1.0 || nc.z > 1.0){
+				//vColor = vec3(0.0, 0.0, 0.2);
+			}else{
+				//vColor = vec3(1.0, 1.0, 1.0) * visibility + vec3(1.0, 1.0, 1.0) * vec3(0.5, 0.0, 0.0) * (1.0 - visibility);
+				vColor = vColor * visibility + vColor * uShadowColor * (1.0 - visibility);
+			}
 
-    
-    
+
+		}
+
+	#endif
 }

File diff suppressed because it is too large
+ 529 - 621
src/modules/CameraAnimation/CameraAnimation.js


File diff suppressed because it is too large
+ 344 - 1882
src/modules/Images360/Images360.js


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


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