-
Notifications
You must be signed in to change notification settings - Fork 11
/
potree3.html
191 lines (151 loc) · 7.67 KB
/
potree3.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<html>
<head>
<meta http-equiv="origin-trial" content="AmgwKkyLeQetn/dhGSsOlfOa/QLp1JOUgqyYSeFTadHtP83gkgHrDEj62CN//MgSjDbVwOY/LAr4qg/XyU2YYwMAAABdeyJvcmlnaW4iOiJodHRwczovL3BvdHJlZS5vcmc6NDQzIiwiZmVhdHVyZSI6IldlYkdQVSIsImV4cGlyeSI6MTY3NTIwOTU5OSwiaXNTdWJkb21haW4iOnRydWV9">
<link rel="stylesheet" href="resources/potree.css">
</head>
<body style="padding: 0; margin: 0">
<div id="potree" style="width: 100%; height: 100%; position: fixed;">
<span style="position: relative">
<canvas id="canvas" width="800" height="600" style="width: 100%; height: 100%;"></canvas>
<pre id="msg_resources"></pre>
<pre id="msg_dbg"></pre>
</span>
</div>
<span id="big_message"></span>
<script type="importmap">
{
"imports": {
"potree": "./src/Potree.js",
"lazperf": "./libs/laz-perf/laz-perf.js",
"toolbar": "./src/modules/toolbar/toolbar.js",
"sidebar": "./src/modules/sidebar/sidebar.js",
"dat.gui": "./libs/dat.gui/dat.gui.module.js",
"stats": "./libs/stats.js/stats.module.js",
"BinaryHeap": "./libs/BinaryHeap/BinaryHeap.js",
"tween": "./libs/tween/tween.esm.js",
"range-select": "./libs/range-select/RangeSelect.js",
"json5": "./libs/json5/json5.js",
"proj4": "./libs/proj4js/proj4-src.js"
}
}
</script>
<script type="module">
import {Potree} from "potree";
import {Vector3, Box3, Mesh, Geometry, geometries, Points, PointLight} from "potree";
import {WireframeMaterial, TriangleColorMaterial} from "potree";
import {CopcLoader, Image360, Images360, Images360Loader, SplatType} from "potree";
import {PotreeLoader, Potree3Loader, TDTilesLoader} from "potree";
import "range-select";
import {proj4} from "proj4";
import * as TWEEN from "tween";
import {load as loadGLB} from "./src/misc/GLBLoader.js";
// import {initGUI} from "./src/modules/gui_dat/gui.js";
// import {MAPPINGS} from "./src/modules/attributes/mappings.js";
// import {GlbVoxelLoader} from "./src/misc/glbvoxels/GlbVoxelLoader.js";
// import {installToolbar} from "toolbar";
import {installSidebar} from "sidebar";
let canvas = document.getElementById("canvas");
let elPotree = document.getElementById("potree");
let potree = await Potree.init(canvas);
let {scene, controls} = potree;
// installToolbar(potree.renderer.canvas, potree);
window.Potree = Potree;
window.potree = potree;
window.Vector3 = Vector3;
window.TWEEN = TWEEN;
Potree.settings.edlEnabled = true;
Potree.settings.dilateEnabled = false;
Potree.settings.hqsEnabled = true;
Potree.settings.pointBudget = 8_000_000;
Potree.settings.attribute = "rgba";
Potree.settings.splatType = SplatType.QUADS;
Potree.settings.splatType = SplatType.POINTS;
Potree.settings.pointSize = 2;
Potree.settings.minNodeSize = 500;
Potree.settings.showBoundingBox = false;
installSidebar(elPotree, potree).then(sidebar => {
window.sidebar = sidebar;
let panelAttributes = sidebar.sections.find(section => section.handler.name === "Attributes").handler;
let pointcloud = scene.root.children.find(c => c.constructor.name === "PointCloudOctree");
if(panelAttributes && pointcloud){
panelAttributes.set(pointcloud);
}
// sidebar.toggle();
});
// swiss coordinate reference system
let target_crs = "+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 ";
// standard CRS of 3D Tiles, see: https://docs.ogc.org/cs/22-025r4/22-025r4.html
proj4.defs("EPSG:4978","+proj=geocent +datum=WGS84 +units=m +no_defs +type=crs");
Potree.events.onFrameStart(() => {
document.getElementById("msg_resources").innerText = Potree.renderer.createResourceReport();
});
// default, if not overriden later on
controls.set({
position: [2546599.1, 1211503.9, 955.9],
pivot: [2546612.5, 1211565.2, 922.6]
});
// * Awaiting the loaders is done to guarantee the order in which they appear in the GUI. It is not essential, though.
// TDTilesLoader.load("https://sitn.ne.ch/3dtiles/chaux81123/Production_1_pro_tie_3d_cesium.json").then(tiles => {
if(false)
await TDTilesLoader.load("https://sitn.ne.ch/3dtiles/le_locle_est/LeLocle_objmCesium3DTiles.json").then(tiles => {
tiles.name = "le_locle_est";
tiles.projector = proj4("EPSG:4978", target_crs);
let box = tiles.root.boundingVolume.toBox();
let bbox = new Box3();
bbox.expandByXYZ(...tiles.project([box.min.x, box.min.y, box.min.z]));
bbox.expandByXYZ(...tiles.project([box.min.x, box.min.y, box.max.z]));
bbox.expandByXYZ(...tiles.project([box.min.x, box.max.y, box.min.z]));
bbox.expandByXYZ(...tiles.project([box.min.x, box.max.y, box.max.z]));
bbox.expandByXYZ(...tiles.project([box.max.x, box.min.y, box.min.z]));
bbox.expandByXYZ(...tiles.project([box.max.x, box.min.y, box.max.z]));
bbox.expandByXYZ(...tiles.project([box.max.x, box.max.y, box.min.z]));
bbox.expandByXYZ(...tiles.project([box.max.x, box.max.y, box.max.z]));
tiles.boundingBox.copy(bbox);
scene.root.children.push(tiles);
});
if(false)
await PotreeLoader.load("https://sitn.ne.ch/lidar/pointclouds/aerial/2022/lidar2022/metadata.json").then(pointcloud => {
scene.root.children.push(pointcloud);
pointcloud.name = "SITN 2022";
// let material = pointcloud.material;
// controls.zoomTo(pointcloud);
});
// if(false)
// Potree3Loader.load("../resources/pointclouds/lion.potree").then(pointcloud => {
// Potree3Loader.load("../resources/pointclouds/meroe.potree").then(pointcloud => {
// Potree3Loader.load("../resources/pointclouds/eclepens.potree").then(pointcloud => {
if(false)
await Potree3Loader.load("../resources/pointclouds/sitn_subset.potree").then(pointcloud => {
pointcloud.name = "SITN";
scene.root.children.push(pointcloud);
// controls.zoomTo(pointcloud);
// controls.set({
// position: [625.7, -668.1, 610.2],
// pivot: [177.0, -82.9, 41.8]
// });
});
// await Potree3Loader.load("../resources/pointclouds/ot_35120A4202A_1_1.potree").then(pointcloud => {
// pointcloud.name = "CA13 - ot_35120A4202A_1_1";
// scene.root.children.push(pointcloud);
// controls.zoomTo(pointcloud);
// });
await PotreeLoader.load("https://sitn.ne.ch/lidar/pointclouds/mobile/2020/streetlidar2020_2th/metadata.json").then(async pointcloud => {
//await Potree3Loader.load("./resources/E/resources/pointclouds/helimap/MLS/MLS/aabi_drive2_lv95_nf02_vuxlr_d2_180422_070250_ADJ.potree").then(pointcloud => {
pointcloud.name = "Helimap MLS Drive 3";
scene.root.children.push(pointcloud);
// let images = await Images360Loader.load("https://sitn.ne.ch/web/images/photos360/assets/textures/coordinates.txt", target_crs);
let images = await Images360Loader.load("./resources/test/coordinates_new.txt", target_crs);
// let images = await Images360Loader.load("https://sitn.ne.ch/web/images/photos360/assets/textures/coordinates.txt", target_crs);
scene.add(scene.root, images);
});
if(false)
await PotreeLoader.load("./resources/E/resources/pointclouds/helimap/MLS/MLS/aabi_drive2_lv95_nf02_vuxlr_d2_180422_070250_ADJ.laz_converted/metadata.json").then(async pointcloud => {
//await Potree3Loader.load("./resources/E/resources/pointclouds/helimap/MLS/MLS/aabi_drive2_lv95_nf02_vuxlr_d2_180422_070250_ADJ.potree").then(pointcloud => {
pointcloud.name = "Helimap MLS Drive 3";
scene.root.children.push(pointcloud);
let images = await Images360Loader.load("./resources/E/resources/pointclouds/helimap/MLS/IMG/Drive3/coordinates.txt", target_crs);
scene.add(scene.root, images);
});
</script>
</body>
</html>