-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathca13.html
249 lines (203 loc) · 8.28 KB
/
ca13.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
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
<html>
<head>
<meta http-equiv="origin-trial" content="AmgwKkyLeQetn/dhGSsOlfOa/QLp1JOUgqyYSeFTadHtP83gkgHrDEj62CN//MgSjDbVwOY/LAr4qg/XyU2YYwMAAABdeyJvcmlnaW4iOiJodHRwczovL3BvdHJlZS5vcmc6NDQzIiwiZmVhdHVyZSI6IldlYkdQVSIsImV4cGlyeSI6MTY3NTIwOTU5OSwiaXNTdWJkb21haW4iOnRydWV9">
<style>
td{
padding: 2px 10px 0px 0px;
}
#big_message{
position: absolute;
left: calc(50%);
bottom: 10px;
color: white;
text-shadow: 4px 4px 4px black;
font-size: 4em;
font-weight: bold;
font-family: "Consolas";
/* from https://stackoverflow.com/a/14249403/913630 */
text-shadow: 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black;
}
#msg_dbg{
position: absolute;
left: 10px;
bottom: 10px;
color: white;
text-shadow: 4px 4px 4px black;
font-size: 1em;
font-weight: bold;
font-family: "Consolas";
/* from https://stackoverflow.com/a/14249403/913630 */
text-shadow: 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black, 0 0 4px black;
}
canvas{
image-rendering: pixelated;
display: flex;
position: absolute;
height: 100%;
}
</style>
</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>
</span>
</div>
<span id="big_message"></span>
<pre id="msg_dbg"></pre>
<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"
}
}
</script>
<script type="module">
import {Potree} from "potree";
import {Vector3, Mesh, Geometry, geometries, Points, PointLight} from "potree";
import {WireframeMaterial, TriangleColorMaterial} from "potree";
import {initGUI} from "./src/modules/gui_dat/gui.js";
import "range-select";
import {proj4} from "./libs/proj4js/proj4-src.js";
import {load as loadGLB} from "./src/misc/GLBLoader.js";
// import {GlbVoxelLoader} from "./src/misc/glbvoxels/GlbVoxelLoader.js";
console.log(proj4.version);
// 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);
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);
}
});
// window.sidebar.toggle();
window.Potree = Potree;
window.potree = potree;
window.Vector3 = Vector3;
// default, if not overriden later on
// controls.set({
// position: [-19.0, 13.6, 12.2],
// pivot: [-0.0, 2.2, 3.9],
// });
import {CopcLoader, Image360, Images360, SplatType} from "potree";
import {Potree3Loader} from "./src/potree/octree/loader_v3/Potree3Loader.js";
import {MAPPINGS} from "./src/modules/attributes/mappings.js";
Potree.settings.edlEnabled = true;
Potree.settings.dilateEnabled = false;
Potree.settings.hqsEnabled = true;
Potree.settings.pointBudget = 8_000_000;
Potree.settings.attribute = "rgba";
// Potree.settings.attribute = "intensity";
Potree.settings.splatType = SplatType.QUADS;
Potree.settings.splatType = SplatType.POINTS;
Potree.settings.pointSize = 2;
Potree.settings.minNodeSize = 100;
{
// Potree3Loader.load("./resources/G/temp/helimap_MLS/metadata.json").then(pointcloud => {
// Potree3Loader.load("./resources/G/temp/retz/metadata.json").then(pointcloud => {
// Potree3Loader.load("./resources/G/temp/eclepens/metadata.json").then(pointcloud => {
// Potree3Loader.load("./resources/G/temp/heidentor/metadata.json").then(pointcloud => {
// Potree3Loader.load("./resources/G/temp/test/metadata.json").then(pointcloud => {
Potree3Loader.load("./resources/pointclouds/mozartplatz/metadata.json").then(pointcloud => {
// Potree3Loader.load("./resources/pointclouds/retz_potree3/metadata.json").then(pointcloud => {
scene.root.children.push(pointcloud);
let min = new Vector3(...pointcloud.loader.metadata.boundingBox.min);
let max = new Vector3(...pointcloud.loader.metadata.boundingBox.max);
let center = max.clone().add(min).multiplyScalar(0.5);
let diagonal = max.sub(min);
let campos = center.clone().add(diagonal);
controls.set({
position: campos.toArray(),
pivot: center.toArray()
});
// RETZ
controls.set({
position: [49.3, -71.0, 89.9],
pivot: [-15.9, 14.6, 11.6]
});
// Mozartplatz
controls.set({
position: [-18.6, 0.7, 2.7],
pivot: [-11.1, 6.6, -1.0]
});
let material = pointcloud.material;
// add lastools visualization of return number and number of returns, if both are present
let idx_returnNumber = pointcloud.attributes.indexOf("return number");
let idx_numberReturns = pointcloud.attributes.indexOf("number of returns");
// if(idx_returnNumber !== -1 && idx_numberReturns !== -1)
// material.registerMapping({
// name: "return nr. & num returns (lastools)",
// condition: (attribute) => (attribute.name === "return number"),
// wgsl: `
// fn mapping(pointID : u32, attrib : AttributeDescriptor, node : Node, position : vec4<f32>) -> vec4<f32> {
// var att_return_number = attributes[${idx_returnNumber}];
// var att_num_returns = attributes[${idx_numberReturns}];
// var rn = readU8(node.numPoints * att_return_number.offset + pointID);
// var nr = readU8(node.numPoints * att_num_returns.offset + pointID);
// if(nr == 1u){
// return vec4f(1.0, 1.0, 0.0, 1.0);
// }else{
// if(rn == 1u){
// return vec4f(1.0, 0.0, 0.0, 1.0);
// }else if(rn == nr){
// return vec4f(0.0, 0.0, 1.0, 1.0);
// }else{
// return vec4f(0.0, 1.0, 0.0, 1.0);
// }
// }
// }
// `,
// });
// material.registerMapping({
// name: "Normal 3xDouble",
// condition: (attribute) => (attribute.name === "NormalX" && attribute.byteSize === 8),
// wgsl: `
// fn mapping(pointID : u32, attrib : AttributeDescriptor, node : Node, position : vec4<f32>) -> vec4<f32> {
// var nx = readF64(node.numPoints * (attrib.offset + 0) + 8 * pointID);
// var ny = readF64(node.numPoints * (attrib.offset + 8) + 8 * pointID);
// var nz = readF64(node.numPoints * (attrib.offset + 16) + 8 * pointID);
// var color = vec4f(nx, ny, nz, 1.0);
// return color;
// }
// `,
// });
// add standard attribute mappings
for(let mapping of Object.values(MAPPINGS)){
if(["vec3", "scalar"].includes(mapping.name))
material.registerMapping(mapping);
}
// retz
// controls.set({
// position: [596.2, 873.3, 62.3],
// pivot: [578.1, 864.7, 57.4]
// // position: [832.2, 879.7, 1234.2],
// // pivot: [744.8, 902.5, -5.2],
// });
// heidentor
// controls.set({
// position: [-6.8, 13.9, 7.8],
// pivot: [1.5, 8.9, 5.6],
// // position: [3.3, 16.6, 2.3],
// // pivot: [4.3, 14.9, 1.3]
// });
});
}
</script>
</body>
</html>