-
-
Notifications
You must be signed in to change notification settings - Fork 25
/
ARToolkitNFT_ES6_example.html
91 lines (79 loc) · 2.11 KB
/
ARToolkitNFT_ES6_example.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ARToolkitNFT_ES6 example</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=0.5, maximum-scale=1">
<link rel="stylesheet" href="css/nft-style.css">
</head>
<body>
<div id="loading" >
<img src="Data/JsartoolkitNFT-logo.gif"/>
<span class="loading-text">Loading, please wait</span>
</div>
<!--
==================
STATS
==================
-->
<div id="stats" class="ui stats">
<div id="stats1" class="stats-item">
<p class="stats-item-title">
Main
</p>
</div>
<div id="stats2" class="stats-item">
<p class="stats-item-title">
Worker
</p>
</div>
</div>
<div id="app">
<video
loop
autoplay
muted
playsinline
id="video">
</video>
<canvas id="canvas"></canvas>
</div>
<script src="js/third_party/three.js/stats.min.js"></script>
<script src="js/third_party/three.js/three.min.js"></script>
<script src="index.js"></script>
<script src="threejs_worker_ES6.js"></script>
<script>
/**
* STATS
*/
var statsMain = new Stats();
statsMain.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.getElementById( 'stats1' ).appendChild( statsMain.dom );
var statsWorker = new Stats();
statsWorker.showPanel( 0 ); // 0: fps, 1: ms, 2: mb, 3+: custom
document.getElementById( 'stats2' ).appendChild( statsWorker.dom );
window.addEventListener('load', () => {
console.log('init ARToolkitNFT...');
initCamera()
.then(video => {
// start camera playback
sourceVideo = video;
sourceVideo.width = 640;
sourceVideo.height = 480;
sourceVideo.play();
// init target canvas
initTargetCanvas();
return new Promise(resolve => {
sourceVideo.addEventListener("loadeddata", event => {
console.log("Camera is ready");
resolve();
});
});
})
.then(_ => {
start('../examples/DataNFT/pinball', video, video.videoWidth, video.videoHeight, function() { statsMain.update() }, function() { statsWorker.update() })
});
})
</script>
</body>
</html>