-
Notifications
You must be signed in to change notification settings - Fork 1
/
prova.html
495 lines (418 loc) · 13.6 KB
/
prova.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
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta content="charset=UTF-8"/>
<title>backtothefutureproject</title>
<!--STYLESHEET-->
<link type="text/css" rel="stylesheet" href="stylesheet/3dhop.css"/>
<link type="text/css" rel="stylesheet" href="stylesheet/backto.css"/>
<!--SPIDERGL-->
<script type="text/javascript" src="js/spidergl.js"></script>
<!--JQUERY-->
<script type="text/javascript" src="js/jquery.js"></script>
<!--PRESENTER-->
<script type="text/javascript" src="js/presenter.js"></script>
<!--3D MODELS LOADING AND RENDERING-->
<script type="text/javascript" src="js/nexus.js"></script>
<script type="text/javascript" src="js/ply.js"></script>
<!--TRACKBALLS-->
<script type="text/javascript" src="js/trackball_turntable.js"></script>
<script type="text/javascript" src="js/trackball_turntable_pan.js"></script>
<script type="text/javascript" src="js/trackball_pantilt.js"></script>
<script type="text/javascript" src="js/trackball_sphere.js"></script>
<!--UTILITY-->
<script type="text/javascript" src="js/init.js"></script>
</head>
<!--START-HEADER-->
<header>
<a class="logo" title="backtothefuture" href="http://www.backtothefuture.polito.it/la-collezione-digitale.html"><span>Back to the future</span></a>
<div class="back">
<h1>B.A.C.K. TO T.H.E. F.U.T.U.R.E.</h1>
<h2>BIM Acquisition as Cultural Key TO Transfer Heritage of ancient Egypt</h2>
<h3>For many Uses To many Users REplayed</h3>
</div>
</header>
<!--END-HEADER-->
<body>
<div id="3dhop" class="tdhop" onmousedown="if (event.preventDefault) event.preventDefault()">
<div id="tdhlg"></div>
<!--START-TOOLBAR-->
<div id="toolbar">
<img id="home"
title="Home"
src="skins/dark/home.png"/><br/>
<!--ZOOM-->
<img id="zoomin"
title="Zoom In"
src="skins/dark/zoomin.png"/><br/>
<img id="zoomout"
title="Zoom Out"
src="skins/dark/zoomout.png"/><br/>
<!--ZOOM-->
<!--LIGHTING-->
<img id="lighting_off"
title="Enable Lighting"
src="skins/dark/lighting_off.png"
style="position:absolute; visibility:hidden;"/>
<img id="lighting"
title="Disable Lighting"
src="skins/dark/lighting.png"/><br/>
<!--LIGHTING-->
<!--LIGHT-->
<img id="light_on"
title="Disable Light Control"
src="skins/dark/lightcontrol_on.png"
style="position:absolute; visibility:hidden;"/>
<img id="light"
title="Enable Light Control"
src="skins/dark/lightcontrol.png"/><br/>
<!--LIGHT-->
<!--HOTSPOT-->
<img id="hotspot_on"
title="Hide Hotspots"
src="skins/dark/pin_on.png"
style="position: absolute; visibility: hidden;">
<img id="hotspot"
title="Show Hotspots"
src="skins/dark/pin.png" /><br/>
<!--HOTSPOT-->
<!--MEASURE-->
<img id="measure_on"
title="Disable Measure Tool"
src="skins/dark/measure_on.png"
style="position:absolute; visibility:hidden;"/>
<img id="measure"
title="Enable Measure Tool"
src="skins/dark/measure.png"/><br/>
<!--MEASURE-->
<!--POINT PICKING-->
<img id="pick_on"
title="Disable PickPoint Mode"
src="skins/dark/pick_on.png"
style="position:absolute; visibility:hidden;"/>
<img id="pick"
title="Enable PickPoint Mode"
src="skins/dark/pick.png"/><br/>
<!--POINT PICKING-->
<!--SECTIONS-->
<img id="sections_on"
title="Disable Plane Sections"
src="skins/dark/sections_on.png"
style="position:absolute; visibility:hidden;"/>
<img id="sections"
title="Enable Plane Sections"
src="skins/dark/sections.png"/><br/>
<!--SECTIONS-->
<!--COLOR-->
<img id="color_on"
title="Disable Solid Color"
src="skins/dark/color_on.png"
style="position:absolute; visibility:hidden;"/>
<img id="color"
title="Enable Solid Color"
src="skins/dark/color.png"/><br/>
<!--COLOR-->
<!--CAMERA-->
<img id="perspective"
title="Perspective Camera"
src="skins/dark/perspective.png"
style="position:absolute; visibility:hidden;"/>
<img id="orthographic"
title="Orthographic Camera"
src="skins/dark/orthographic.png"/><br/>
<!--CAMERA-->
<!--FULLSCREEN-->
<!-- <img id="full_on" title="Exit Full Screen" src="skins/dark/full_on.png" style="position:absolute; visibility:hidden;"/>
<img id="full" title="Full Screen" src="skins/dark/full.png"/>-->
<!--FULLSCREEN-->
</div>
<!--MEASURE-->
<div id="measure-box"
class="output-box">Measured length<hr/>
<span id="measure-output"
class="output-text"
onmousedown="event.stopPropagation()">0.0</span></div>
<!--MEASURE-->
<!--POINT PICKING-->
<div id="pickpoint-box"
class="output-box">XYZ picked point<hr/>
<span id="pickpoint-output"
class="output-text"
onmousedown="event.stopPropagation()">[ 0 , 0 , 0 ]</span></div>
<!--POINT PICKING-->
<!--SECTIONS-->
<div id="sections-box" class="output-box">
<table class="output-table" onmousedown="event.stopPropagation()">
<tr><td>Plane</td><td>Position</td><td>Flip</td></tr>
<tr>
<td><img id="xplane_on"
title="Disable X Axis Section"
src="skins/icons/sectionX_on.png"
onclick="sectionxSwitch()"
style="position:absolute; visibility:hidden; border:1px inset;"/>
<img id="xplane"
title="Enable X Axis Section"
src="skins/icons/sectionX.png"
onclick="sectionxSwitch()"/><br/></td>
<td><input id="xplaneSlider"
class="output-input"
type="range"
title="Move X Axis Section Position"/></td>
<td><input id="xplaneFlip"
class="output-input"
type="checkbox"
title="Flip X Axis Section Direction"/></td>
</tr>
<tr>
<td><img id="yplane_on"
title="Disable Y Axis Section"
src="skins/icons/sectionY_on.png"
onclick="sectionySwitch()"
style="position:absolute; visibility:hidden; border:1px inset;"/>
<img id="yplane"
title="Enable Y Axis Section"
src="skins/icons/sectionY.png"
onclick="sectionySwitch()"/><br/></td>
<td><input id="yplaneSlider"
class="output-input"
type="range"
title="Move Y Axis Section Position"/></td>
<td><input id="yplaneFlip"
class="output-input"
type="checkbox"
title="Flip Y Axis Section Direction"/></td>
</tr>
<tr>
<td><img id="zplane_on"
title="Disable Z Axis Section"
src="skins/icons/sectionZ_on.png"
onclick="sectionzSwitch()"
style="position:absolute; visibility:hidden; border:1px inset;"/>
<img id="zplane"
title="Enable Z Axis Section"
src="skins/icons/sectionZ.png"
onclick="sectionzSwitch()"/><br/></td>
<td><input id="zplaneSlider"
class="output-input"
type="range"
title="Move Y Axis Section Position"/></td>
<td><input id="zplaneFlip"
class="output-input"
type="checkbox"
title="Flip Z Axis Section Direction"/></td>
</tr>
</table>
<table class="output-table"
onmousedown="event.stopPropagation()"
style="text-align:right;">
<tr>
<td>Show planes<input id="showPlane"
class="output-input"
type="checkbox"
title="Show Section Planes"
style="bottom:-3px;"/></td>
<td>Show edges<input id="showBorder"
class="output-input"
type="checkbox"
title="Show Section Edges"
style="bottom:-3px;"/></td>
</tr>
</table>
</div>
<!--SECTIONS-->
<!--END-TOOLBAR-->
<!--START-BOOKMARKS-TOOLBAR-->
<div id="bookmarksToolbar"
class="tdhop"
onmousedown="if (event.preventDefault) event.preventDefault()">
<!--SHOW-HIDE-ALL-->
<img id="showall"
title="Show All"
src="skins/buttons/show_all.png"
onclick="presenter.setInstanceVisibility(HOP_ALL, true, true);"/><br/>
<img id="hideall"
title="Hide All"
src="skins/buttons/hide_all.png"
onclick="presenter.setInstanceVisibility(HOP_ALL, false, true);"/><br/>
<!--SHOW-PARTS-->
<img id="showdx"
title="Show Right"
src="skins/buttons/right.png"
onclick="presenter.setInstanceVisibility(HOP_ALL, false, false); presenter.setInstanceVisibility('meshright', true, true);"/><br/>
<img id="showsx"
title="Show Left"
src="skins/buttons/left.png"
onclick="presenter.setInstanceVisibility(HOP_ALL, false, false); presenter.setInstanceVisibility('meshleft', true, true);"/><br/>
<!--TOGGLE-PARTS-->
<img id="toggledx"
title="Toggle Right"
src="skins/buttons/toggle_right.png"
onclick="presenter.toggleInstanceVisibility('meshright', true);"/><br/>
<img id="togglesx"
title="Toggle Left"
src="skins/buttons/toggle_left.png"
onclick="presenter.toggleInstanceVisibility('meshleft', true);"/><br/>
</div>
<!--END-BOOKMARKS-TOOLBAR-->
<div id="DBinfo">
<h4>Temple of Nefertari at Abu Simbel</h4>
<p1>ID:</p1><p2>Cat.7104</p2><br/>
<p1>Material:</p1><p2>Painted wood</p2><br/>
<p1>Period:</p1><p2>About 1820</p2><br/>
<p1>Number of parts:</p1><p2>2</p2><br/>
<p1>Dimension Part DX:</p1><p2>31x36x81cm</p2><br/>
<p1>Dimension Part SX:</p1><p2>38x36x82cm</p2><br/>
</div>
</div>
<canvas id="draw-canvas" style="background-color: #F0F0F0"/>
</body>
<script type="text/javascript">
var presenter = null;
function setup3dhop() {
presenter = new Presenter("draw-canvas");
presenter.setScene({
meshes: {
"mesh_r" : { url: "models/04_abusimbel/DXABUSIMBELmeshmixer.nxz" },
"mesh_l" : { url: "models/04_abusimbel/SXABUSIMBELmeshmixer.nxz" },
"hotspot_1" : { url: "models/04_abusimbel/abusimbel_hotspots/abusimbel_s_0.ply" },
"hotspot_2" : { url: "models/04_abusimbel/abusimbel_hotspots/abusimbel_s_1.ply" },
"hotspot_3" : { url: "models/04_abusimbel/abusimbel_hotspots/abusimbel_h_0.ply" },
"hotspot_4" : { url: "models/04_abusimbel/abusimbel_hotspots/abusimbel_h_1.ply" }
},
modelInstances : {
"model_r" : {
mesh : "mesh_r",
color : [0.8, 0.7, 0.75],
tags : ["meshright"]
},
"model_l" : {
mesh : "mesh_l",
color : [0.8, 0.7, 0.75],
tags : ["meshleft"]
}
},
spots : {
"spot1" : {
mesh : "hotspot_1",
color : [0.0, 1, 1.0, 0.4],
tags : ["s_0"]
},
"spot2" : {
mesh : "hotspot_2",
color : [0.0, 1, 1.0, 0.4],
tags : ["s_1"]
},
"spot3" : {
mesh : "hotspot_3",
color : [0.0, 1, 1.0, 0.4],
tags : ["h_0"]
},
"spot4" : {
mesh : "hotspot_4",
color : [0.0, 1, 1.0, 0.4],
tags : ["h_1"]
}
},
trackball: {
type : TurntablePanTrackball,
trackOptions : {
startPhi: 0,
startTheta: 15.0,
startDistance: 2.5,
minMaxPhi: [-180, 180],
minMaxTheta: [0, 180.0],
minMaxDist: [0.5, 3.0]
}
},
space : {
centerMode: "scene",
cameraFOV : 50.0
}
});
presenter._onEndMeasurement = onEndMeasure;
//--MEASURE--
//--POINT PICKING--
presenter._onEndPickingPoint = onEndPick;
//--POINT PICKING--
//--SECTIONS--
sectiontoolInit();
//--SECTIONS--
//--LIGHTING--
presenter.enableSceneLighting(false);
//--LIGHTING--
//--HIDE HOTSPOTS AT START--
presenter.setSpotVisibility(HOP_ALL, false, true);
//--HIDE HOTSPOTS AT START--
}
//--VAR HOTSPOTS--
var showspots = false;
function updateSpots() {
if(!showspots) {
presenter.setSpotVisibility(HOP_ALL, false, true); //redraw
return;
}
var model_1_visible = presenter.isInstanceVisibilityEnabledByName('model_1');
var model_2_visible = presenter.isInstanceVisibilityEnabledByName('model_2');
presenter.setSpotVisibility('s_1', model_1_visible, true);
presenter.setSpotVisibility('h_1', model_1_visible, true);
presenter.setSpotVisibility('s_0', model_2_visible, true);
presenter.setSpotVisibility('h_0', model_2_visible, true);
};
//--VAR HOTSPOTS--
function actionsToolbar(action) {
if(action=='home') presenter.resetTrackball();
//--FULLSCREEN--
//-- else if(action=='full' || action=='full_on') fullscreenSwitch();
//--FULLSCREEN--
//--ZOOM--
else if(action=='zoomin') presenter.zoomIn();
else if(action=='zoomout') presenter.zoomOut();
//--ZOOM--
//--LIGHTING--
else if(action=='lighting' || action=='lighting_off') { presenter.enableSceneLighting(!presenter.isSceneLightingEnabled()); lightingSwitch(); }
//--LIGHTING--
//--LIGHT--
else if(action=='light' || action=='light_on') { presenter.enableLightTrackball(!presenter.isLightTrackballEnabled()); lightSwitch(); }
//--LIGHT--
//--CAMERA--
else if(action=='perspective' || action=='orthographic') { presenter.toggleCameraType(); cameraSwitch(); }
//--CAMERA--
//--COLOR--
else if(action=='color' || action=='color_on') { presenter.toggleInstanceSolidColor(HOP_ALL, true); colorSwitch(); }
//--COLOR--
//--MEASURE--
else if(action=='measure' || action=='measure_on') { presenter.enableMeasurementTool(!presenter.isMeasurementToolEnabled()); measureSwitch(); }
//--MEASURE--
//--POINT PICKING--
else if(action=='pick' || action=='pick_on') { presenter.enablePickpointMode(!presenter.isPickpointModeEnabled()); pickpointSwitch(); }
//--POINT PICKING--
//--SECTIONS--
else if(action=='sections' || action=='sections_on') { sectiontoolReset(); sectiontoolSwitch(); }
//--SECTIONS--
//--HOTSPOTS--
else if(action=='hotspot'|| action=='hotspot_on') { showspots = !showspots; presenter.enableOnHover(!presenter.isOnHoverEnabled()); hotspotSwitch(); }
//--HOTSPOTS--
}
//--MEASURE--
function onEndMeasure(measure) {
// measure.toFixed(2) sets the number of decimals when displaying the measure
// depending on the model measure units, use "mm","m","km" or whatever you have
$('#measure-output').html(measure.toFixed(2) + "cm");
}
//--MEASURE--
//--PICKPOINT--
function onEndPick(point) {
// .toFixed(2) sets the number of decimals when displaying the picked point
var x = point[0].toFixed(2);
var y = point[1].toFixed(2);
var z = point[2].toFixed(2);
$('#pickpoint-output').html("[ "+x+" , "+y+" , "+z+" ]");
}
//--PICKPOINT--
$(document).ready(function(){
init3dhop();
setup3dhop();
resizeCanvas (1000,750);
});
</script>
</html>