-
Notifications
You must be signed in to change notification settings - Fork 4
/
ar.html
1521 lines (1327 loc) · 74.6 KB
/
ar.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
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<title>יום העצמאות 2023 - 75 שנים למדינת ישראל - מפת מטס חיל האוויר</title>
<meta name="description" content='מטס יום העצמאות 2023: איפה יחלפו המטוסים ומתי? במסגרת אירועי יום העצמאות השנה יתקיים מעבר כלי טיס של הצוות האווירובטי של חיל האוויר. הכנסו לאתר המותאם למכשירים הסלולריים המאפשר צפיה בזמן אמת במיקום המטוסים על גבי מפה, וידאו 360 מתוך הקוקפיט ועוד...'>
<meta name="keywords" content="מטס עצמאות,2023,75 ,חיל האוויר,חיל האויר,מטס 2023, אירועי חיל האוויר 2023,כלי טיס, מטוסי קרב, מסוקים, בסיסים פתוחים חיל האוויר,חגיגות עצמאות">
<meta name="author" content="חיל האוויר">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-title" content="מטס חיל האוויר">
<meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#7bd1fc" />
<meta name="og:title" content="מטס חיל האוויר">
<meta name="og:description" content="בואו לצפות במטוסי חיל האוויר אצלכם בכף היד, לוחות זמנים, משחקים ועוד">
<meta name="og:image" content="https://matas.iaf.org.il/icons/logo-75/BigLogo.svg">
<meta name="og:url" content="https://matas.iaf.org.il">
<meta http-equiv="ScreenOrientation" content="autoRotate:disabled">
<link rel="canonical" href="https://matas.iaf.org.il/ar.html" />
<link type="text/css" rel="stylesheet" href="main.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-98360124-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() { dataLayer.push(arguments); }
gtag('js', new Date());
gtag('config', 'UA-98360124-1');
</script>
</head>
<style>
body {
min-height: 100vh;
min-height: -webkit-fill-available;
}
html {
height: -webkit-fill-available;
}
</style>
<body>
<div class="full-screen-popup">
<h1>ברוכים הבאים לתצוגת תלת מימד</h1>
<p>האתר יעבור למצב מסך-מלא</p>
<button>המשך</button>
</div>
<div class="dim-background">
</div>
<div class="camera">
<video id="video">Video stream not available.</video>
</div>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-analytics.js"></script>
<script src="https://www.gstatic.com/firebasejs/8.2.9/firebase-database.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ua-parser-js@0/dist/ua-parser.min.js"></script>
<script>
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
var firebaseConfig = {
apiKey: "",
authDomain: "matas-8f467.firebaseapp.com",
databaseURL: "https://matas-8f467-default-rtdb.firebaseio.com",
projectId: "matas-8f467",
storageBucket: "matas-8f467.appspot.com",
messagingSenderId: "119258401801",
appId: "1:119258401801:web:313d0d094555418e8cbcd8",
measurementId: "G-RWFBKYRZ5H"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
firebase.analytics();
var database = firebase.database();
function dataToFirebase(data) {
if (data == null) data = "null"
if (data == undefined) data = "undefined"
if (Array.isArray(data)) {
return data.map(item => dataToFirebase(item))
}
if (typeof data == 'object') {
Object.keys(data).map(function (key, index) {
data[key] = dataToFirebase(data[key]);
});
}
return data
}
window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
const today = new Date();
const date = today.getFullYear() + '-' + (today.getMonth() + 1) + "-" + today.getDate();
const time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds() + ":" + (+ today) % 1000;
const dateTime = date + '/' + time;
const cur_user_agent = new UAParser();
cur_user_agent.setUA(navigator.userAgent);
const result = cur_user_agent.getResult();
firebase.database().ref('error-logs/' + dateTime + "/" + Math.floor(Math.random() * 10000)).set({
date: dataToFirebase(dateTime),
user_agent: dataToFirebase(navigator.userAgent),
browser: dataToFirebase(cur_user_agent.getBrowser()),
device: dataToFirebase(cur_user_agent.getDevice()),
OS: dataToFirebase(cur_user_agent.getOS()),
engine: dataToFirebase(cur_user_agent.getEngine()),
message: dataToFirebase(errorMsg),
url: dataToFirebase(url),
line_number: dataToFirebase(lineNumber),
});
return false;
}
</script>
</head>
<body>
<div class="loading-ar">
<img src="/animation/loading.gif" alt="loading-airplane" >
</div>
<div id="ar-overly">
<div id="controls">
<div id="unsupported-share-button">
<p>שיתוף</p>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="17px" height="19px" viewBox="0 0 17 19" version="1.1">
<g id="2022" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g id="3" transform="translate(-74.000000, -622.000000)" stroke="#FFFFFF" stroke-width="1.75">
<g id="Group-11" transform="translate(28.086022, 621.319500)">
<g id="Group-9" transform="translate(46.949844, 2.500000)">
<path d="M14.3898412,2.39979628 C14.3898412,3.7249809 13.3159953,4.79959256 11.9917549,4.79959256 C10.6675145,4.79959256 9.59366857,3.7249809 9.59366857,2.39979628 C9.59366857,1.07461166 10.6664967,0.00101858925 11.990737,0 C13.3149774,0 14.3888234,1.07461166 14.3888234,2.39979628 L14.3898412,2.39979628 Z" id="Stroke-2829"/>
<path d="M4.79617267,8 C4.79617267,9.32518462 3.72232671,10.3997963 2.39808634,10.3997963 C1.07384596,10.3997963 0,9.32518462 0,8 C0,6.67481538 1.0728281,5.60122231 2.39706847,5.60020299 C3.72130885,5.59918513 4.79617267,6.67379679 4.79617267,7.99898141 L4.79617267,8 Z" id="Stroke-2831"/>
<path d="M14.3898412,13.6002037 C14.3898412,14.9253883 13.3159953,16 11.9917549,16 C10.6675145,16 9.59366857,14.9253883 9.59366857,13.6002037 C9.59366857,12.2750191 10.6664967,11.201426 11.990737,11.2004067 C13.3149774,11.1993888 14.3898412,12.2740005 14.3898412,13.5991851 L14.3898412,13.6002037 Z" id="Stroke-2833"/>
<line x1="4.46862421" y1="9.20906544" x2="9.92946173" y2="12.3931755" id="Stroke-2835"/>
<line x1="9.92121704" y1="3.60784314" x2="4.46852242" y2="6.79195314" id="Stroke-2837"/>
</g>
</g>
</g>
</g>
</svg>
</div>
<p id="url-copied">הקישור הועתק !</p>
<button id="button-mode-toggle" alt="Toggle mode" class="static" style="display: none;">
<a class='static-mode'></a>
<span class='dynamic-mode'></span>
</button>
<button id="button-close" alt="Close">
<div id="blob"
style="transform: scale(0); background-color: #3bb5f2; border-radius: 100%; width: 30px; height: 30px;">
</div>
</button>
</div>
<div id="menus">
<div id="slidecontainer" class="slidecontainer_hide">
<input type="range" min="3000" max="15000" value="10000" class="slider" id="speed_slider">
</div>
<div id="trails_menu" class="trails_menu_hide" style="display: none;">
<div style="min-width: calc(50vw - 45px); height: 50px; flex: 1 0 auto;"></div>
<img id="exit-trail" class="small-x-button" src="./assets/small-x.svg" alt="Exit Trail">
<div style="min-width: calc(50vw - 20px); height: 50px; flex: 1 0 auto;"></div>
</div>
<p class="load-aircraft">בטעינה</p>
<div id="aircrafts_menu">
<div class="buffer" style="height: 50px; flex: 1 0 auto;"></div>
<div class="buffer" style="height: 50px; flex: 1 0 auto;"></div>
</div>
<div id="help-supported-ar-conteiner">
<div id="help-supported-ar">
<div id="supported-ar-conteiner">
<p class="title">מצב מציאות רבודה</p>
<p class="description">יש ללחוץ על המסך כדי לצפות בכלי טיס וירטואלי בסביבתכם</p>
<img src="./assets/pictureInYourLivingRoom.png" alt="">
<div class="conteiner-bottom">
<button>הבנתי</button>
<div class="show-hid-check-box">
<p>אל תציג שוב</p>
<input type="checkbox">
</div>
</div>
</div>
</div>
</div>
<div id="supported-menu-borders">
<div id="space"></div>
<div class="tringle-conteiner">
<div class="tringle"></div>
<div class="tringle"></div>
</div>
</div>
<div id="supported-menu">
<div id="menu-block">
<div id="share">
<script>
document.getElementById("share").addEventListener('click', ()=>{
gtag('event', 'ar_share', {
'event_category': 'share',
'event_label': 'ar shared clicked ' + navigator.share ? 'working' : 'not working'
});
if(navigator.share){
navigator.share({
title: 'matas.iaf ar',
url: 'https://matas.iaf.org.il/ar.html'
}).then(() => {
console.log('Thanks for sharing!');
})
.catch(console.error);
} else {
// fallback
}
})
</script>
<p>שיתוף</p>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="17px" height="19px" viewBox="0 0 17 19" version="1.1">
<g id="2022" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" stroke-linecap="round" stroke-linejoin="round">
<g id="3" transform="translate(-74.000000, -622.000000)" stroke="#FFFFFF" stroke-width="1.75">
<g id="Group-11" transform="translate(28.086022, 621.319500)">
<g id="Group-9" transform="translate(46.949844, 2.500000)">
<path d="M14.3898412,2.39979628 C14.3898412,3.7249809 13.3159953,4.79959256 11.9917549,4.79959256 C10.6675145,4.79959256 9.59366857,3.7249809 9.59366857,2.39979628 C9.59366857,1.07461166 10.6664967,0.00101858925 11.990737,0 C13.3149774,0 14.3888234,1.07461166 14.3888234,2.39979628 L14.3898412,2.39979628 Z" id="Stroke-2829"/>
<path d="M4.79617267,8 C4.79617267,9.32518462 3.72232671,10.3997963 2.39808634,10.3997963 C1.07384596,10.3997963 0,9.32518462 0,8 C0,6.67481538 1.0728281,5.60122231 2.39706847,5.60020299 C3.72130885,5.59918513 4.79617267,6.67379679 4.79617267,7.99898141 L4.79617267,8 Z" id="Stroke-2831"/>
<path d="M14.3898412,13.6002037 C14.3898412,14.9253883 13.3159953,16 11.9917549,16 C10.6675145,16 9.59366857,14.9253883 9.59366857,13.6002037 C9.59366857,12.2750191 10.6664967,11.201426 11.990737,11.2004067 C13.3149774,11.1993888 14.3898412,12.2740005 14.3898412,13.5991851 L14.3898412,13.6002037 Z" id="Stroke-2833"/>
<line x1="4.46862421" y1="9.20906544" x2="9.92946173" y2="12.3931755" id="Stroke-2835"/>
<line x1="9.92121704" y1="3.60784314" x2="4.46852242" y2="6.79195314" id="Stroke-2837"/>
</g>
</g>
</g>
</g>
</svg>
</div>
<div id="change-ar-toggle">
<div id="toggle">
</div>
<div id="icons">
<svg xmlns="http://www.w3.org/2000/svg" width="45.949" height="47.989" viewBox="0 0 60.949 47.989" >
<defs>
<filter id="aewkxtddia" width="45.354" height="35.386" x="15.595" y="12.604" filterUnits="userSpaceOnUse">
<feOffset dy="3"/>
<feGaussianBlur result="blur" stdDeviation="3"/>
<feFlood flood-opacity=".161"/>
<feComposite in2="blur" operator="in"/>
<feComposite in="SourceGraphic"/>
</filter>
<filter id="zwzfo59xib" width="44" height="43.999" x="0" y="0" filterUnits="userSpaceOnUse">
<feOffset dy="3"/>
<feGaussianBlur result="blur-2" stdDeviation="3"/>
<feFlood flood-opacity=".161"/>
<feComposite in2="blur-2" operator="in"/>
<feComposite in="SourceGraphic"/>
</filter>
</defs>
<g>
<g filter="url(#aewkxtddia)" transform="translate(-189.346 -6.001) translate(189.35 6.005)">
<path id="dynamic-icon-part" fill="none" stroke="white" stroke-linecap="round" stroke-width="1.5px" d="M10826.007-4743.271s5.958 7.684 11.05 2.591 9.431-7.051 8-10.721-7.5-5.264-9.657 0 4.389 8.13 10.291 8.13c2.966 0 4.532.854 5.592 2.369-.112-.177-.055-.089 0 0" transform="translate(-10800.36 4774.14)"/>
</g>
<g filter="url(#zwzfo59xib)" transform="translate(-189.346 -6.001) translate(189.35 6)">
<path id="dynamic-icon-part-2" fill="white" d="M4.12 3.438l24.988 13.519a.523.523 0 0 1-.038.931l-4.263 1.606a1.008 1.008 0 0 0-.563.525l-3.313 6.819c-.063.3-.619.381-.625.075l.506-5.638a2.009 2.009 0 0 0-.456-1.138L7.4 7.444a.313.313 0 0 0-.281-.081.3.3 0 0 0-.163.475L18.127 21.5a2.5 2.5 0 0 1 .438 1.125l.669 4.869c-.056.425-.388.588-.656.206l-2.406-2.825a.5.5 0 0 0-.706-.119l-6.2 4.519a.5.5 0 0 1-.788-.306L3.389 4a.507.507 0 0 1 .731-.562z" transform="translate(5.62 2.62)"/>
</g>
</g>
</svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"width="30px" height="30px" viewBox="0 0 20 20" version="1.1">
<g id="20X20/Camera" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<path id="camera-icon" d="M15.7142857,2 L15.7142857,3.42857143 L18,3.42857143 C19.1045695,3.42857143 20,4.32400193 20,5.42857143 L20,15.7142857 C20,16.8188552 19.1045695,17.7142857 18,17.7142857 L2,17.7142857 C0.8954305,17.7142857 1.3527075e-16,16.8188552 0,15.7142857 L0,5.42857143 C-1.3527075e-16,4.32400193 0.8954305,3.42857143 2,3.42857143 L12.8571429,3.42857143 L12.8571429,2 L15.7142857,2 Z M10.0957764,5.66720497 L9.83925359,5.6734711 C8.56320101,5.73597443 7.3900251,6.26369902 6.52020792,7.15003171 C5.61096653,8.07393729 5.0957764,9.32297382 5.0957764,10.667205 C5.0957764,13.4608173 7.30129026,15.667205 10.0957764,15.667205 C11.4378053,15.667205 12.686798,15.1512841 13.6128421,14.242879 C14.5583712,13.3149685 15.0957764,12.0420086 15.0957764,10.667205 C15.0957764,7.87193353 12.8910478,5.66720497 10.0957764,5.66720497 Z M10.0957764,7.0957764 L10.2885189,7.10062463 C12.2014174,7.19721193 13.667205,8.72563088 13.667205,10.667205 C13.667205,11.6573996 13.2847786,12.5632586 12.6123412,13.2231661 C11.9520918,13.8708393 11.0616988,14.2386335 10.0957764,14.2386335 C8.09039518,14.2386335 6.52434783,12.6719657 6.52434783,10.667205 C6.52434783,9.69919208 6.89125036,8.80966676 7.53911218,8.15135556 C8.19972277,7.47820273 9.10558179,7.0957764 10.0957764,7.0957764 Z M10.0957764,9.14285714 C9.66447205,9.14285714 9.28012422,9.31416149 9.00534161,9.59416149 C8.7357764,9.86807453 8.57142857,10.2454658 8.57142857,10.667205 C8.57142857,11.5202484 9.24186335,12.1915528 10.0957764,12.1915528 C10.5175155,12.1915528 10.8949068,12.0263354 11.1688199,11.7576398 C11.4488199,11.4828571 11.6201242,11.0985093 11.6201242,10.667205 C11.6201242,9.81329193 10.9496894,9.14285714 10.0957764,9.14285714 Z" id="Combined-Shape" fill="rgb(170 170 170)"/>
</g>
</svg>
</div>
</div>
<div id="help">
<p>עזרה</p>
<svg xmlns="http://www.w3.org/2000/svg" width="20px" height="20px" viewBox="0 0 24 24"><path d="M12 0c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm0 18.25c-.69 0-1.25-.56-1.25-1.25s.56-1.25 1.25-1.25c.691 0 1.25.56 1.25 1.25s-.559 1.25-1.25 1.25zm1.961-5.928c-.904.975-.947 1.514-.935 2.178h-2.005c-.007-1.475.02-2.125 1.431-3.468.573-.544 1.025-.975.962-1.821-.058-.805-.73-1.226-1.365-1.226-.709 0-1.538.527-1.538 2.013h-2.01c0-2.4 1.409-3.95 3.59-3.95 1.036 0 1.942.339 2.55.955.57.578.865 1.372.854 2.298-.016 1.383-.857 2.291-1.534 3.021z"/></svg>
</div>
</div>
</div>
<div id="ar_info">
</div>
<div class="share">
</div>
</div>
</div>
</div>
<script type="module">
import * as THREE from 'https://unpkg.com/[email protected]/build/three.module.js';
import { TubePainter } from 'https://unpkg.com/[email protected]/examples/jsm/misc/TubePainter.js';
import { ARButton } from './ARButton.js';
import { GLTFLoader } from 'https://unpkg.com/[email protected]/examples/jsm/loaders/GLTFLoader.js';
//import * as HTML from '../node_modules/html2canvas/dist/html2canvas.min.js';
import { MTLLoader } from 'https://unpkg.com/[email protected]/examples/jsm/loaders/MTLLoader.js';
import { OBJLoader } from 'https://unpkg.com/[email protected]/examples/jsm/loaders/OBJLoader.js';
import { OrbitControls } from "https://unpkg.com/[email protected]/examples/jsm/controls/OrbitControls.js";
import { EXRLoader } from 'https://unpkg.com/[email protected]/examples/jsm/loaders/EXRLoader.js';
localStorage.setItem("finishedLoadingSupported", false);
const today = new Date();
const date = today.getDate() + '-' + (today.getMonth() + 1) + '-' + today.getFullYear();
const time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
const dateTime = date + ' ' + time;
const cur_user_agent = new UAParser();
cur_user_agent.setUA(navigator.userAgent);
const result = cur_user_agent.getResult();
let isSupported;
let currentAircraft = "f35";
function checkDeviceSupport() {
console.log(cur_user_agent.getResult())
console.log(cur_user_agent.getBrowser())
if ('xr' in navigator) {
navigator.xr.isSessionSupported('immersive-ar').then(function (supported) {
isSupported = supported;
if (isSupported){
document.body.classList.add('is-supported');
}
init();
animate();
// console.log(getCookie('tutorial'));
// if (supported && getCookie('tutorial') != 3) {
}).catch();
} else{
const message = document.createElement('a');
isSupported = false;
document.body.classList.remove('is-supported');
init();
animate();
if (window.isSecureContext == false) {
message.innerHTML = 'WEBXR NEEDS HTTPS';
} else {
message.innerHTML = 'WEBXR NOT AVAILABLE';
firebase.database().ref('devices/not-available/' +
cur_user_agent.getDevice().vendor + " " +
cur_user_agent.getDevice().model + " | " +
cur_user_agent.getOS().name + " " +
cur_user_agent.getOS().version.replaceAll(".", ":") + " | " +
cur_user_agent.getBrowser().name + " " +
cur_user_agent.getBrowser().version.replaceAll(".", ":") + " | " +
dateTime).set({
date: dataToFirebase(dateTime),
user_agent: dataToFirebase(navigator.userAgent),
browser: dataToFirebase(cur_user_agent.getBrowser()),
device: dataToFirebase(cur_user_agent.getDevice()),
OS: dataToFirebase(cur_user_agent.getOS()),
engine: dataToFirebase(cur_user_agent.getEngine())
});
}
}
}
let container, stats;
let camera, controls, scene, renderer;
let mixer, clock, action, delta;
let controller, painter, aircraft, animations;
let animationCycleStart = new Date();
let trails = [];
let planeMesh;
let pngCubeRenderTarget, exrCubeRenderTarget;
let pngBackground, exrBackground;
let resetSceneForFirstDraw = false;
let curSpeed = 10000;
const cursor = new THREE.Vector3();
const params = {
envMap: 'EXR',
roughness: 0.0,
metalness: 0.0,
exposure: 1.5,
debug: false,
};
const magenDavid2d = [
// top triangle
[1 / 3, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
[1 / 3, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
[1, 0],
[-1, 0],
[0, Math.sqrt(3)],
[1 / 3, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
//bottom
[1, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
[0, -Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
[-1, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
[1 / 3, Math.sqrt(3) / 2 + Math.sqrt(3) / 6],
//[1, 0],
]
const bigMagenDavid = magenDavid2d.map(([x, y]) => [0, y / 20, -x / 20]);
const smallMagenDavid = magenDavid2d.map(([x, y]) => [-0.1, y / 5 - 0.1, -x / 5]);
const spiral = [[-0.5243040872910524, -1.484632886795791, 0.7090383618241618], [-0.5033054322967195, -1.4843123091178931, 0.7165561738046619], [-0.46344087210143464, -1.4791284908216729, 0.7376674301865676], [-0.46344087210143464, -1.4791284908216729, 0.7376674301865676], [-0.44479599775559514, -1.4741336008104202, 0.75111355867189], [-0.36264799906998924, -1.478861033419382, 0.7831055910920952], [-0.3957490414418604, -1.4615587930971525, 0.7734690578792921], [-0.3695920092150864, -1.4543072886199382, 0.7769178872061469], [-0.34265271989342705, -1.446316226287704, 0.7765454110755049], [-0.3160412112066088, -1.4368292362554282, 0.7752649720267523], [-0.2883114494760768, -1.4256979497124185, 0.7730351662717032], [-0.2585838564919497, -1.4134269235207413, 0.7667365865762239], [-0.23401955079366102, -1.395381431982618, 0.7572916391659038], [-0.20087857656894298, -1.3862242567990586, 0.7369247211720386], [-0.17009094520149, -1.3705339581193274, 0.7184548084845019], [-0.14063167142174995, -1.3532899006487473, 0.698459010680089], [-0.11395066893123873, -1.3302283337608087, 0.6805843137411128], [-0.08562343574138237, -1.315601174249601, 0.650661307014985], [-0.06122284164057111, -1.2959170561413371, 0.6216246746269591], [-0.04014302565014784, -1.2759020345610212, 0.5906959342861335], [-0.022427606767085096, -1.2554074781752562, 0.5600956432356616], [-0.010855541497713922, -1.2312399764051076, 0.5292184065414154], [-1.9136781425002636E-4, -1.2097931900386045, 0.49666550610406957], [0.007469361654925094, -1.1902478304171622, 0.4615837275573309], [0.011594300989302099, -1.1723729596496062, 0.4264980535484094], [0.012393897026085465, -1.1565243548208135, 0.39343088643396873], [0.009311985318086375, -1.1436457498623538, 0.3617998114526732], [-3.9533663986887456E-4, -1.130815053739229, 0.33069354030387865], [-0.011383182227829764, -1.1229365483956129, 0.30097039384817886], [-0.023946467970247833, -1.117912016984075, 0.27258854353771383], [-0.03881496261948886, -1.1153648714830489, 0.24621726181127526], [-0.05627747368652733, -1.1152571756237624, 0.2220665911214309], [-0.07561351108475313, -1.1171504315061451, 0.20032655567332017], [-0.09771163679461083, -1.1225905543529426, 0.1813172592270201], [-0.12028029428372425, -1.1282340031373714, 0.16438848394470307], [-0.1448214190698607, -1.1353652842985928, 0.15056577642204616], [-0.17142538531759605, -1.1441407722621884, 0.14003607261332723], [-0.19991360442434633, -1.1541350956839724, 0.1321554843441558], [-0.22974200091711533, -1.1643608330636286, 0.12457470339148337], [-0.26214805979245404, -1.177791783636533, 0.11730206308391408], [-0.2936484560932517, -1.1887282876581398, 0.11237014774994115], [-0.32560510602472065, -1.198949873579216, 0.11171999091412807], [-0.3577007269067081, -1.2083978245662235, 0.11483176015627208], [-0.38954208523319384, -1.2164275370467503, 0.11950471683407007], [-0.4207341792389336, -1.2227737893080077, 0.12502533776150473], [-0.4522420025598059, -1.229115549449229, 0.13208757467580168], [-0.480272056879909, -1.2329709979884922, 0.1422749735057937], [-0.505374360497268, -1.2352229981467766, 0.15604603360902622], [-0.5292315175313036, -1.2362848273087268, 0.17344518087999197], [-0.5526557439625904, -1.2362551932682448, 0.19385460636145535], [-0.5750956947689694, -1.2352397144016138, 0.2177453031169222], [-0.5968971281243571, -1.2346741575906663, 0.24472028406079377], [-0.6171869475820351, -1.232194994521635, 0.274678366063194], [-0.6359349113412978, -1.2282776432607243, 0.3057848167542821], [-0.6526273238939946, -1.2231136400146985, 0.33710294041207006], [-0.6694113712065112, -1.2167056208792453, 0.36872634043123026], [-0.6880761533869235, -1.2089169336722885, 0.40156286381346873], [-0.708883556452444, -1.2002899611192235, 0.43777775816245434], [-0.7210679955028545, -1.1887782631093682, 0.4808052658417939], [-0.7314458607857011, -1.176055101976087, 0.5094337530663454], [-0.73122125685475, -1.1630080477462044, 0.5334219486382663], [-0.7279854370608309, -1.1487873042161998, 0.5534025714513436], [-0.7229874471701958, -1.1322951585332552, 0.5758223242667244], [-0.7126667105445086, -1.1137098417474387, 0.6086532934790282], [-0.7100586609909593, -1.0918956691744763, 0.6350127699546984], [-0.6978595681036832, -1.0689910705039603, 0.6607003420998434], [-0.6727868565632993, -1.045797665404348, 0.6802753307978038], [-0.6370095197901207, -1.0208504973141113, 0.6980804136262958], [-0.5992227409350408, -0.9936700167440133, 0.7146064722636813], [-0.5597302372852545, -0.9659604897631018, 0.7316095095347257], [-0.5323586547201321, -0.9376854090754839, 0.7362149432152283], [-0.5021034799073033, -0.9089746080458228, 0.7406307382947283], [-0.4696284785294436, -0.8789248190181167, 0.7435468472884277], [-0.43193062088553813, -0.8462053687529932, 0.7475508539167992], [-0.39385880118038213, -0.8115800662222377, 0.7504700565334086], [-0.35961825003888903, -0.7769721412602834, 0.7480724319427418], [-0.33102232123197173, -0.7457448186725882, 0.743225235823927], [-0.3031773097856685, -0.7067926236551436, 0.7319411910076472], [-0.2721954015575395, -0.67433385396398, 0.7187906609937691], [-0.2386294464189657, -0.6341015607203889, 0.7040252755047949], [-0.2062738039456325, -0.5949349239753893, 0.6801750201664495], [-0.17580070068660303, -0.5570414041846716, 0.6474443772017776], [-0.14650137428736096, -0.5139993241399745, 0.6128284743653698], [-0.11855658952250446, -0.47629004147629384, 0.5801330213403397], [-0.09289720787508475, -0.4317125584407202, 0.5500483532082074], [-0.07099513493667133, -0.3867537109373716, 0.5196827238198322], [-0.05066096035390408, -0.3432622109587528, 0.4884705141023318], [-0.040836164375534445, -0.29823999370666787, 0.45233173040158026], [-0.030758116782437714, -0.2613773008809395, 0.4177666033003497], [-0.023413631023287598, -0.2232763587791114, 0.37987553140631536], [-0.01950297515439002, -0.18805039288980158, 0.34031083604375134], [-0.018650027850378934, -0.15624534938377999, 0.30083476631981865], [-0.01945285271958269, -0.1261350921874372, 0.26138155751059156], [-0.024605114996665907, -0.10546233051321031, 0.22558574954667163], [-0.03263718830092481, -0.08806401764668864, 0.18898798148556115], [-0.04328044415713798, -0.07553040067631758, 0.15404463396183057], [-0.05412005073220827, -0.06553115294640932, 0.11990574427924316], [-0.06927349395336331, -0.06324505094398308, 0.089716706763651], [-0.08370262543082253, -0.06277895254807625, 0.05993208181267042], [-0.09873928153445072, -0.06567026061675786, 0.03181723038565472], [-0.11494575465867667, -0.07187828282894376, 0.005644940335545686], [-0.13268370965836251, -0.08106872212511256, -0.01829980291156192], [-0.15238576456878405, -0.09304511152905248, -0.04002280188003947], [-0.17185093684645908, -0.10498046448227477, -0.059983123792808], [-0.19627559604674327, -0.12298017776233006, -0.07844378206403634], [-0.21891970275210987, -0.13966364352652344, -0.09458755993564513], [-0.24298978538311775, -0.15870239368133818, -0.10712237476162259], [-0.26643599506456683, -0.17784635321660663, -0.11594103341832272], [-0.2893107822287143, -0.19696193878297952, -0.1219927412522937], [-0.3134378741610124, -0.21629231883615213, -0.12601828131185214], [-0.3401095861824646, -0.23593041769764633, -0.12870506044011282], [-0.36840629696727895, -0.2555629906889552, -0.13003970154475367], [-0.397105218518982, -0.2763251038282878, -0.12834041127156529], [-0.4227957652919867, -0.29578874442206426, -0.12274602906408648], [-0.44693607030552995, -0.3146376554100201, -0.11352389154257687], [-0.4728296377089606, -0.33303918398292176, -0.1029717864681898], [-0.500616460846874, -0.3505470695327928, -0.09337582347107651], [-0.5285608597553898, -0.36711389240086156, -0.08414844175473597], [-0.5552539858020309, -0.3839192128090363, -0.07115393397265367], [-0.577157445311114, -0.40013119096072447, -0.053140490468417075], [-0.5945499239539183, -0.4156221242129328, -0.030686863124592033], [-0.6112760255493396, -0.42995341979807045, -0.007976170159704962], [-0.6308370210046845, -0.4433314027099948, 0.012182461796805502], [-0.653251969052098, -0.4562787863467264, 0.03123764529678842], [-0.6756382933269431, -0.46940991277018373, 0.05596939666275321], [-0.6952558901001947, -0.48176832202846187, 0.08665020106849006], [-0.7122702667860493, -0.49281173551189705, 0.1228706328883947], [-0.7294127943579813, -0.5020997638958046, 0.1620742807004757], [-0.7477348219408114, -0.5094808466745798, 0.20060631875966553], [-0.765711835461416, -0.515247364045141, 0.23766713081131502], [-0.7825907468159049, -0.5190161397354517, 0.26821549625699664], [-0.7952280386947231, -0.5204718521672554, 0.29797827659432063], [-0.8014527579109266, -0.5187541937329464, 0.3350984749774993], [-0.8031028272154498, -0.5126081359311044, 0.3837420993915995], [-0.8034540531491529, -0.5018653923772182, 0.4380618917331934], [-0.8002577522464348, -0.48914800171453504, 0.4971422138323369], [-0.7980954612927491, -0.47370374742701915, 0.5358091426819092], [-0.7887788412254148, -0.4564392445315567, 0.5730824415722897], [-0.7755841537127168, -0.4374954210078297, 0.6054713358114292], [-0.759534311403717, -0.416058405411452, 0.6371239388183397], [-0.7391698340525252, -0.3906216653131353, 0.6721416387120975], [-0.7159353077312509, -0.36145993677926835, 0.7091061422459881], [-0.6897705091623362, -0.3319651980584978, 0.7442650075772965], [-0.6613203396340601, -0.30231479192952215, 0.7719739306964398], [-0.629341385439487, -0.27215260927652196, 0.7945571801762243], [-0.5945045556285504, -0.24076450839121005, 0.8141694590818496], [-0.557419200316459, -0.20971214612848108, 0.8296636293084946], [-0.5185148937253572, -0.1810719007534215, 0.8432176221276086], [-0.478720135234563, -0.152337828713348, 0.8527927774711939], [-0.4392891001466856, -0.12291675488201288, 0.8612313935730055], [-0.4008879989785227, -0.09300841050983984, 0.8689779452871335], [-0.36310513376571746, -0.0664236773849326, 0.8719990251924965], [-0.3200181165533412, -0.04323922085595577, 0.8618459832798907], [-0.28263955354162895, -0.03626980530117596, 0.8484286067379696], [-0.24144736568717112, -0.027549692026928314, 0.8322293718373379], [-0.202598654848054, -0.01755726861246938, 0.8125172671875577], [-0.16480648273350793, -0.007236666985590889, 0.7896012259468383], [-0.12432997108914746, 0.005578279084194442, 0.7658463429726662], [-0.08199875607412738, 0.02135437888122338, 0.7428015985653508], [-0.040979733354634576, 0.03862656677082424, 0.7198526090098291], [-0.0024552233084406128, 0.05487495026973466, 0.7012413503407615], [0.03454804942443357, 0.07104273177556031, 0.6746244835835661], [0.06957659628797036, 0.08459994303328344, 0.6402715679351445], [0.10192869947715455, 0.09509406053822489, 0.5993482212764158], [0.13087036765072724, 0.10362981578597064, 0.5549520019421708], [0.15489821764347672, 0.11139950968880663, 0.5116815503778749], [0.17323624651585717, 0.11747911472906403, 0.47356615770333743], [0.18805578636659098, 0.12368625635669517, 0.4356877684198003], [0.20098015598446686, 0.12898421660528048, 0.3959889824107424], [0.21165307847874482, 0.13232064598630092, 0.35338804906765114], [0.21889418001316852, 0.13349287524281797, 0.30972355329618606], [0.22266745022999723, 0.1327683987044641, 0.2660943086163497], [0.2252148450110909, 0.13115497867503412, 0.22445935344336526], [0.22698426370135993, 0.12985623145749114, 0.181933438883346], [0.2281829996282621, 0.12834329336125794, 0.13835079675431877], [0.22724393791710654, 0.12584538753048224, 0.09604605158944596], [0.22428632824917022, 0.12273949748133617, 0.05754236867607744], [0.22001751623880234, 0.11923792563441155, 0.02277162154107806], [0.21447455543530491, 0.11461944322883255, -0.009927938659410288], [0.20791249975225778, 0.10871163800375594, -0.047849920455025716], [0.20067639809654, 0.10225139264614501, -0.08797843389792347], [0.19889283837792898, 0.09914143437806267, -0.1226858872847822], [0.185229223001817, 0.09018489223885184, -0.1584499486396694], [0.175858396565937, 0.08354825380657945, -0.19031339316962223], [0.16764713557112673, 0.07846886658037068, -0.22061526314673324], [0.16067615265811863, 0.07490042539134001, -0.2499009094388316], [0.15317584862423705, 0.07118123570866419, -0.27570851148745973], [0.1425500162372798, 0.06509319884033382, -0.2988891750008443], [0.12921693459731265, 0.057209683316187886, -0.3213394774569781], [0.11572011083561529, 0.04950273951127793, -0.3407542321871794], [0.10486008325986095, 0.04454326930904548, -0.3485031901693787], [0.09976747148126675, 0.0429954760659802, -0.3499028086092656], [0.09713263926848889, 0.04318325905917282, -0.347679173047844], [0.09155386952325385, 0.04131638545612681, -0.3469415887312428], [0.08161059822351482, 0.03648945689330607, -0.3500880186589499], [0.0706925145466718, 0.0312211781489401, -0.35312865757957046], [0.06801258843917002, 0.03325510227624229, -0.3489230344102986], [0.058674357934792476, 0.028017303452849363, -0.34251216842559906], [0.05512226912728544, 0.027664585432119297, -0.3302293383868433], [0.04950369960962342, 0.025107015969318303, -0.3168306941219221], [0.04154523793697456, 0.020164124772248146, -0.30249554515316196], [0.03286903416620346, 0.014145033831104326, -0.28525535179994005], [0.02991561981852775, 0.014569392882236132, -0.2576905795798518], [0.018430703657391148, 0.005188422373768919, -0.23409424720255095], [0.012463186877713639, 7.692682688482666E-4, -0.2078892371108903], [0.007522291254610791, -0.0029383091581509646, -0.18024810401269536], [0.006215903132876899, -0.0029591456136977, -0.1511243281631316], [0.008976043636332198, 0.0014887440843482924, -0.11947828944765572], [0.013863958010288946, 0.009423301018327668, -0.07941399432044685], [0.018356750892392838, 0.017322830128394837, -0.03846534336771361], [0.021795803503889565, 0.025095733423035328, 0.004256047516047304], [0.025308912085856727, 0.03450281565257962, 0.04949426164475132], [0.029565039479857048, 0.04712056746948668, 0.09848364576089765], [0.03364077592786796, 0.06270909501950239, 0.15149014625155213], [0.035898385231294294, 0.07924121878997237, 0.2064063724454822], [0.03572016364136199, 0.09454888856256904, 0.26482548198241007], [0.03206360276379916, 0.10753963734702565, 0.3202391893809224], [0.026247421386403777, 0.11971498305862702, 0.3742975162054241], [0.019409421793524895, 0.1326680552029479, 0.42761255038434404], [0.011616690981677946, 0.14784752536720536, 0.4821781842865172], [0.0038806230188604698, 0.16552064380943965, 0.5421177454155278], [-0.006554396262044415, 0.1823600965179614, 0.5983711690394106], [-0.017714887349105587, 0.19724910618985558, 0.6496632424570201], [-0.02889854259938564, 0.2108178213688533, 0.6974661030495355], [-0.041020723361386666, 0.2243697278216697, 0.7448584938967147], [-0.054288586904103764, 0.2396973527784647, 0.7932773028665383], [-0.06824289135598438, 0.25674246463060724, 0.8415466559733397], [-0.08280528017261835, 0.2724997940272056, 0.8870831889788595], [-0.09716101486608608, 0.2856063403236495, 0.9285319106291736], [-0.10950252196387529, 0.29882929243276163, 0.9668528724297782], [-0.12012124170781913, 0.3126729488149699, 1.0031588903585926], [-0.13130442117516758, 0.325718112657893, 1.0387312805777773], [-0.1436747282943545, 0.33747396359588944, 1.0735568034652823], [-0.15552730273524754, 0.3476481037823037, 1.105631241965712], [-0.1669109181191765, 0.3560613083508929, 1.1346189048253223], [-0.17821630123786436, 0.3647143195475909, 1.1617219704762705], [-0.1868717876291014, 0.3740126209416783, 1.185708151408436], [-0.19126847830928265, 0.3806642145925305, 1.2046224805770356], [-0.19252452454306346, 0.3836350200765173, 1.2190499320581683], [-0.19375386812102538, 0.38526656390056524, 1.2319850831016201], [-0.19577000565042468, 0.38786277348108833, 1.244544259023476], [-0.19578626360309034, 0.39080728844869334, 1.2541442815484816], [-0.1904606955517909, 0.39057156236925006, 1.2568711881024095], [-0.17812949607789574, 0.386396752328927, 1.2517516115378622], [-0.1554991717353138, 0.38751411725048723, 1.2464854080729704], [-0.14054190267615485, 0.38965109959625444, 1.2429187280647294], [-0.1341093326330565, 0.3946431219891635, 1.2447471166798583], [-0.1283674965391831, 0.3986910598457486, 1.2447279194752603], [-0.11291293579779937, 0.3961602438241292, 1.2320979081316983], [-0.08681617256433044, 0.38820567780957144, 1.2058588018469212], [-0.049041928533934076, 0.3851984414792321, 1.174232383319323], [-0.01944197922374047, 0.3832501081952995, 1.1443523644731393], [0.0048270736283673, 0.38316350443522496, 1.1169840487976854], [0.026948240519505846, 0.38207929505746585, 1.088269301022184], [0.049656288730068554, 0.3790512095091788, 1.0548484340225799], [0.07242041500687435, 0.3748773098985555, 1.0172405762836951], [0.10369080707774363, 0.3754869146666639, 0.9775721258138039], [0.12795828013109878, 0.3753489971273798, 0.9378670991899871], [0.15109101025434335, 0.3743562350830565, 0.8947704537042432], [0.1745807480563093, 0.37275525205760285, 0.8476644237468762], [0.19849746220455441, 0.37138475941246385, 0.7971846311235886], [0.22180600031355713, 0.37027422452673775, 0.7445570114228861], [0.2682913788471472, 0.37897027283085605, 0.690009908443194], [0.2996651612301301, 0.38198175977295884, 0.6323976239289878], [0.32663859672799556, 0.38339848490232986, 0.5701793705042412], [0.3521355743183533, 0.3862071188309383, 0.5058041456764814], [0.37425830771312185, 0.3893704050835537, 0.44325246990670825], [0.39164850102128823, 0.39167430770567596, 0.3856145293368916], [0.41012692307391174, 0.3933131484754525, 0.3338836376612832]];
const circle = new Array(41).fill().map((_, i) => [
Math.sin(i / 20 * Math.PI),
Math.sin(i / 20 * Math.PI),
Math.cos(i / 20 * Math.PI)
])
const spiralGalil = new Array(200).fill().map((_, i) => [
Math.sin(i / 20 * Math.PI),
Math.sin(i / 100 * Math.PI),
Math.cos(i / 20 * Math.PI)
])
const poo = new Array(200).fill().map((_, i) => [
Math.sin(i / 25 * Math.PI),
Math.sin(i / 100 * Math.PI),
Math.cos(i / 20 * Math.PI)
])
const infinityTriangle = new Array(1000).fill().map((_, i) => [
-0.2 * Math.cos(i / 200 * Math.PI) + Math.sin(i / 100 * Math.PI) + Math.sin(i / 50 * Math.PI),
0.1 * Math.sin(i / 200 * Math.PI) - 2 * Math.cos(i / 100 * Math.PI) + 3 * Math.sin(i / 50 * Math.PI),
0.2 * Math.sin(i / 200 * Math.PI) + Math.sin(i / 100 * Math.PI) - Math.cos(i / 50 * Math.PI),
])
const infShape = smooth(smooth(addMidpoints([
[0, 0],
[0, 0],
[2, 1],
[3, 0],
[2, -1],
[-2, 1],
[-3, 0],
[-2, -1],
[0, 0],
[0, 0]
].map(point => [
point[0], 0, point[1] * 2
]), 2)))
const locationsOptions = [
// smallMagenDavid.concat(bigMagenDavid),
smallMagenDavid.map(point => point.map(coord => coord / 2)),
circle.map(point => point.map(coord => coord / 15)),
spiralGalil.map(point => point.map(coord => coord / 20)),
poo.map(point => point.map(coord => coord / 20)),
infinityTriangle.map(point => point.map(coord => coord / 40)),
infShape.map((point, idx) => [point[0], - Math.sin(idx / (infShape.length - 1) * Math.PI * 2), point[2]]).map(point => point.map(coord => coord / 30)),
// spiral.map(point=>point.map(coord => coord/10))
]
let locations = []
const AIRCRAFTS_META_DATA = [
{ id: "efroni", type: "glb", scale: 0.025, text: "Planes_efroni.svg", name: "עפרוני" },
{ id: "tsofit", type: "glb", scale: 0.003, text: "Planes_tsofit.svg", name: "צופית" },
{ id: "lavie", type: "glb", scale: 0.026, text: "Planes_lavie.svg", name: "לביא" },
{ id: "baz", type: "glb", scale: 0.007, text: "Planes_baz.svg", name: "בז" },
{ id: "bazi", type: "glb", scale: 0.007, text: "Planes_bazi.svg", name: "רעם" },
{ id: "f35", type: "glb", scale: 0.18, text: "Planes_f35.svg", name: "אדיר" },
{ id: "barak", type: "glb", scale: 0.006, text: "Planes_barak.svg", name: "ברק" },
{ id: "sofa", type: "glb", scale: 0.15, text: "Planes_sofa.svg", name: "סופה" },
{ id: "peten", type: "glb", scale: 0.15, text: "Planes_peten.svg", name: "שרף" },
{ id: "shimshon", type: "glb", scale: 0.032, text: "Planes_shimshon.svg", name: "שמשון" },
{ id: "karnaf", type: "glb", scale: 0.035, text: "Planes_karnaf.svg", name: "קרנף" },
]
const TRAILS_META_DATA = [
// { id: "gold", type: "obj", scale: 0.0001, text: "gold" },
// { id: "ghost", type: "obj", scale: 0.003, text: "ghost" },
// { id: "rainbow", type: "glb", scale: 0.03, text: "Personified Rainbow" },
// { id: "moustache", type: "glb", scale: 0.05, text: "moustache" },
// { id: "crown", type: "glb", scale: 0.01, text: "crown" },
// { id: "cloud", type: "glb", scale: 0.12, text: "cloud" },
// { id: "happyface", type: "glb", scale: 0.5, text: "Happy Face" },
// { id: "poo", type: "glb", scale: 0.005, text: "poo" },
// { id: "basketball", type: "glb", scale: 0.025, text: "Basketball" },
// { id: "cake", type: "glb", scale: 0.04, text: "cake" },
// { id: "present", type: "glb", scale: 0.09, text: "present" },
// { id: "blue", type: "glb", scale: 0.0001, text: "blue" },
// { id: "fire1", type: "glb", scale: 0.0001, text: "blue" },
// { id: "fire", type: "glb", scale: 0.0001, text: "blue" },
// { id: "hotdog", type: "glb", scale: 0.0001, text: "blue" },
// { id: "watermelon", type: "glb", scale: 0.0001, text: "blue" },
// { id: "avocado", type: "glb", scale: 0.0001, text: "blue" },
// { id: "candy", type: "glb", scale: 0.0001, text: "blue" },
// { id: "earth", type: "glb", scale: 0.0001, text: "blue" },
{ id: "beachball", type: "glb", scale: 0.25, text: "beachball" },
{ id: "cheeseburger", type: "glb", scale: 0.07, text: "cheeseburger" },
{ id: "star", type: "glb", scale: 0.05, text: "star" },
{ id: "love", type: "glb", scale: 0.5, text: "love" },
{ id: "doughnut", type: "glb", scale: 0.49, text: "doughnut" },
{ id: "heart", type: "glb", scale: 0.005, text: "heart" },
{ id: "disco", type: "glb", scale: 0.019, text: "disco" },
]
let mode = 'static';
var pathRef = firebase.database().ref('path');
pathRef.on('value', (snapshot) => {
const data = snapshot.val();
if (data)
for (let location of data)
if (locations.indexOf(location) === -1) {
// painter.lineTo({
// x: location[0],
// y: location[1],
// z: location[2]
// })
// locations.push(location)
// painter.update()
}
else {
// locations = []
}
});
function init() {
// Detect filter change
let isAircraftScrolling = setTimeout(() => { }, 0);
document.getElementById('aircrafts_menu').onscroll = () => {
clearInterval(isAircraftScrolling);
isAircraftScrolling = setTimeout(() => {
const centeredElement = document.elementFromPoint(
document.body.offsetWidth / 2, document.documentElement.clientHeight - 140
);
if(
!centeredElement ||
!centeredElement.parentElement ||
!centeredElement.parentElement.children[0] ||
!centeredElement.parentElement.children[0].src)
return;
let selected = centeredElement.parentElement.children[0].src.split('Planes_')[1].replace('.svg', '')
AIRCRAFTS_META_DATA.forEach((e) => {
if (e.id === selected) changeAircraft(e);
})
}, 100);
}
document.getElementById('controls').addEventListener('beforexrselect', ev => ev.preventDefault());
document.getElementById('menus').addEventListener('beforexrselect', ev => ev.preventDefault());
AIRCRAFTS_META_DATA.forEach(aircraft => {
const elem = document.createElement('button');
elem.classList.add("aircraft-option");
elem.type = "button";
elem.id = aircraft.id;
elem.innerHTML = `<img src="./assets/${aircraft.text}"/>`;
elem.innerHTML += `<span class="name">${aircraft.name}</name>`;
// elem.innerHTML += '<div class = "aircraft-text-shadow"></div>';
document.getElementById('aircrafts_menu').insertBefore(elem, document.getElementById('aircrafts_menu').children[1]);
elem.addEventListener('click', (e) => {
window.scrollIntoView(e.target, {
behavior: 'smooth',
block: 'center',
inline: 'center'
});
changeAircraft(aircraft);
})
})
scene = new THREE.Scene();
clock = new THREE.Clock();
camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 0.01, 20);
camera.position.set(.2, .06, 0);
renderer = new THREE.WebGLRenderer({ antialias: true, alpha: true });
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(window.innerWidth, window.innerHeight);
renderer.xr.enabled = true;
// environment
let material = new THREE.MeshStandardMaterial({
metalness: params.roughness,
roughness: params.metalness,
envMapIntensity: 1.0
});
let geometry = new THREE.PlaneGeometry(200, 200);
material = new THREE.MeshBasicMaterial();
planeMesh = new THREE.Mesh(geometry, material);
planeMesh.position.y = - 50;
planeMesh.rotation.x = - Math.PI * 0.5;
// scene.add(planeMesh);
THREE.DefaultLoadingManager.onLoad = function () {
pmremGenerator.dispose();
};
new EXRLoader()
.setDataType(THREE.UnsignedByteType)
.load('assets/textures/compressed.exr', function (texture) {
exrCubeRenderTarget = pmremGenerator.fromEquirectangular(texture);
exrBackground = exrCubeRenderTarget.texture;
texture.dispose();
});
new THREE.TextureLoader().load('assets/textures/equirectangular.png', function (texture) {
texture.encoding = THREE.sRGBEncoding;
pngCubeRenderTarget = pmremGenerator.fromEquirectangular(texture);
pngBackground = pngCubeRenderTarget.texture;
texture.dispose();
});
const pmremGenerator = new THREE.PMREMGenerator(renderer);
pmremGenerator.compileEquirectangularShader();
renderer.toneMapping = THREE.ACESFilmicToneMapping;
renderer.outputEncoding = THREE.sRGBEncoding;
// controls
controls = new OrbitControls(camera, renderer.domElement);
controls.listenToKeyEvents(window); // optionalz
container = document.createElement('div');
document.body.appendChild(container);
container.appendChild(renderer.domElement);
if (isSupported) {
const arButton = ARButton.createButton(renderer, {
optionalFeatures: ['dom-overlay'],
domOverlay: { root: document.getElementById("ar-overly") },
animate: () => {
animate();
},
// endSessionCallback: startup,
fallback: () => {
document.body.classList.remove('is-supported');
arButton.style.display = 'none';
isSupported = false;
}
});
document.querySelector('#change-ar-toggle').appendChild(arButton);
//try on removing the start page of the ar
//function eventFire(el, etype){
// if (el.fireEvent) {
// el.fireEvent('on' + etype);
// } else {
// var evObj = document.createEvent('Events');
// evObj.initEvent(etype, true, false);
// el.dispatchEvent(evObj);
// }
// }
//setTimeout(() => {eventFire(document.getElementById('ARButton'), 'click');}, 2000);
}
const shareData = {
title: 'כיף לצפות במטוסי חיל האוויר - אצלי בטלפון, בתלת מימד!',
text: 'כמה מגניב! באפליקצית מטס יום העצמאות ה75 אני רואה את כל המטוסים בתלת מימד. בואו לנסות גם',
url: 'https://matas.iaf.org.il',
}
//setTimeout(()=>{if(isSupported){
// alert('walla im supported');
//}else{
// alert('im wallk not supported');
//}}, 4000)
const btn = document.querySelector('#ar-overly .share');
// Must be triggered some kind of "user activation"
btn.addEventListener('click', async () => {
try {
await navigator.share(shareData);
console.log('המשתמש שיתף בהצלחה את המטס');
gtag('event', 'ar_share', {
'event_category': 'share',
'event_label': 'ar shared successfully'
});
} catch (err) {
console.log('נסיון שיתוף נכשל', err);
gtag('event', 'ar_share', {
'event_category': 'share',
'event_label': 'ar share failed'
});
}
});
var streaming = false;
var video = null;
// function startup() {
// video = document.getElementById('video');
// navigator.getUserMedia = ( navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia || navigator.mediaDevices.getUserMedia);
// navigator.getUserMedia({ video: true, audio: false })
// .then(function (stream) {
// video.srcObject = stream;
// video.play();
// arButton.addEventListener('click', () => {
// stream.getTracks().forEach(function(track) {
// track.stop();
// });
async function startup() {
/*video = document.getElementById('video');
const getUserMedia = (navigator.mediaDevices.getUserMedia || navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia);
getUserMedia({ video: true, audio: false })
// get the rear camera
const devices = await navigator.mediaDevices.enumerateDevices();
let frontDeviceId;
let backDeviceId;
if (devices.length > 0) {
// defaults so all this will work on a desktop
frontDeviceId = devices[0].deviceId;
backDeviceId = devices[0].deviceId;
}
devices.forEach(device => {
if (device.kind === 'videoinput') {
if (device.label && device.label.length > 0) {
if (device.label.toLowerCase().indexOf('back') >= 0)
backDeviceId = device.deviceId
else if (device.label.toLowerCase().indexOf('front') >= 0)
frontDeviceId = device.deviceId
}
}
});
const constraints = {
audio: false, video: {
width: screen.height,
height: screen.width,
deviceId: { exact: backDeviceId }
}
};
// get the stream
navigator.mediaDevices.getUserMedia(constraints)
.then(function (stream) {
video.srcObject = stream;
video.play();
arButton.addEventListener('click', () => {
stream.getTracks().forEach(function (track) {
track.stop();
});
})
})
.catch(function (err) {
console.log("An error occurred: " + err);
});
video.addEventListener('canplay', function (ev) {
let width = window.screen.width;
if (!streaming) {
let height = video.videoHeight / (video.videoWidth / width);
if (isNaN(height)) {
height = width / (4 / 3);
}
video.setAttribute('width', width);
video.setAttribute('height', height);
streaming = true;
}
}, false);
*/
}
document.getElementById("button-close").addEventListener("click", (e) => {
gtag('event', 'ar_close_btb', {
'event_category': 'ar_close',
'event_label': 'ar closed'
});
document.getElementById('blob').classList.add('animateScale');
let targetUrl = document.location.href.substr(0,document.location.href.lastIndexOf("/")+1);
setTimeout(() => {
if (document.referrer == targetUrl)
window.close();
else
window.location.href = targetUrl;
} , 1000);
// additional timeout in case the previous timeout didn't close the app
setTimeout(() => {
window.location.href = targetUrl;
} , 1200);
})
document.getElementById("speed_slider").oninput = function() {
curSpeed = this.value;
}
document.getElementById("speed_slider").addEventListener('touchstart', (e) => {
document.getElementById('speed_slider').classList.add('speed_slider_focused');
})
document.getElementById("speed_slider").addEventListener('touchmove', (e) => {
document.getElementById('speed_slider').classList.add('speed_slider_focused');
})
document.getElementById("speed_slider").addEventListener('touchend', (e) => {
setTimeout(() => {
document.getElementById('speed_slider').classList.remove('speed_slider_focused');
} , 1200);
})
document.getElementById("exit-trail").addEventListener("click", (e) => {
resetTrail();
})
/*document.getElementById('button-mode-toggle').addEventListener("click", function () {
if (mode == 'static') {
mode = 'dynamic';
this.classList.add('dynamic');
this.classList.remove('static');
let trails_menu = document.getElementById("trails_menu");
trails_menu.classList.add('trails_menu_hide');
let buttonreset = document.getElementById("resetbutton");
buttonreset.classList.add('trails_menu_hide');
//document.getElementById("slidecontainer").classList.remove('slidecontainer_hide');
locations.push([cursor.x, cursor.y, cursor.z]);
painter.mesh.material.opacity = 0;
} else {
if (isIOS()) return;
mode = 'static'
this.classList.add('static');
this.classList.remove('dynamic');
let trails_menu = document.getElementById("trails_menu");
trails_menu.classList.add('trails_menu_hide');
document.getElementById("slidecontainer").classList.add('slidecontainer_hide');
let buttonreset = document.getElementById("resetbutton");
buttonreset.classList.add('trails_menu_hide');
locations.push([cursor.x, cursor.y, cursor.z]);
painter.mesh.material.opacity = 0;
// trails.forEach(trail => trail.children[0].children[0].material.opacity = 0)
// trails.forEach(trail => trail.children[0].children[0].material.transparent = true)
trails.forEach(trail => scene.remove(trail))
}
})
*/
let chosenAircraftIndex = findChosenAircraftIndex(localStorage.getItem('selectedAircraft'));
let chosenAircraftObj = AIRCRAFTS_META_DATA[chosenAircraftIndex];
if(chosenAircraftIndex === -1){
changeAircraft(AIRCRAFTS_META_DATA[5]);
setTimeout(() => {
window.scrollIntoView(document.getElementById('f35'), {
behavior: 'smooth',
block: 'center',
inline: 'center'
});
}, 20);
}else{
changeAircraft(chosenAircraftObj);
setTimeout(() => {
window.scrollIntoView(document.getElementById(chosenAircraftObj.id), {
behavior: 'smooth',
block: 'center',
inline: 'center'
});
}, 20);
}
loadLight();
loadPainter();
loadController();
// changeTrails(TRAILS_META_DATA[TRAILS_META_DATA.length - 1]);
window.addEventListener('resize', onWindowResize);
}
function findChosenAircraftIndex(aircraft){
return AIRCRAFTS_META_DATA.indexOf(AIRCRAFTS_META_DATA.find(element => element.id === aircraft));
}
function createVidBackgrounds() {
const canvas = document.createElement('canvas')
let ctx = canvas.getContext('2d');
let videos = document.querySelectorAll('video')
let w, h
for (let i = 0, len = videos.length; i < len; i++) {
const v = videos[i]
try {
w = v.videoWidth
h = v.videoHeight
canvas.width = w
canvas.height = h
ctx.fillRect(0, 0, w, h)
ctx.drawImage(v, 0, 0, w, h)
document.body.style.backgroundImage = `url(${canvas.toDataURL()})` // here is the magic
document.body.style.backgroundSize = 'cover'
ctx.clearRect(0, 0, w, h); // clean the canvas
} catch (e) {
continue
}
}
}
window.setInterval(createVidBackgrounds, 30)
function takeScreenshot() {
const canvas = document.getElementsByTagName('canvas')[0];
createVidBackgrounds()
html2canvas(document.querySelector("body")).then(canvas => {
var base64image = canvas.toDataURL("image/png");
var iframe = "<img src='" + base64image + "'>"
var x = window.open();
x.document.open();
x.document.write(iframe);
x.document.close();
});
}
function resetScene() {
locations = [];
scene.remove(painter.mesh);
loadPainter();
}
function closeScene() {
let newWindow = window.open("about:blank");
window.close();
}
/*
function resetTrail() {
TRAILS_META_DATA.forEach(option => { document.getElementById(option.id).classList.remove("selected") });
scene.remove(trails);
trails.forEach(trail => { scene.remove(trail) });
trails = [];
}
*/
function loadController() {
function onSelectStart(event) {
event.inputSource
this.userData.isSelecting = true;
this.userData.skipFrames = 2;
document.body.classList.add('is-selecting')
}
function onSelectEnd() {
this.userData.isSelecting = false;
firebase.database().ref('path').set(locations);
document.body.classList.remove('is-selecting')
}
function beforeXRSelect(e) {
e.preventDefault();
}
controller = renderer.xr.getController(0);
controller.addEventListener('selectstart', onSelectStart);
controller.addEventListener('selectend', onSelectEnd);
controller.addEventListener('beforexrselect', beforeXRSelect)
controller.userData.skipFrames = 0;
scene.add(controller);
}
function loadAircraftGLTF(selectedAircraft) {
let startTimer = Date.now();
let endTime;
document.querySelector('.load-aircraft').style.display = 'block';
new GLTFLoader()
.load('https://matasstorage.blob.core.windows.net/models/2022/gltf/' + selectedAircraft.id + '/object.' + selectedAircraft.type, function (gltf) {
if (aircraft)
scene.remove(aircraft);
aircraft = gltf.scene;
animations = gltf.animations;
const scale = selectedAircraft.scale;
aircraft.scale.set(scale, scale, scale);
scene.add(aircraft);
mixer = new THREE.AnimationMixer(aircraft);
animations.forEach(animation => {
action = mixer.clipAction(animation);