-
Notifications
You must be signed in to change notification settings - Fork 3
/
2.html
200 lines (162 loc) · 9.82 KB
/
2.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
<!DOCTYPE html>
<html>
<head>
<title>Interactive Reading Environment in Web-Based Virtual Reality, ver. 1.0</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/tfjs@1.3.1/dist/tf.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@teachablemachine/image@0.8/dist/teachablemachine-image.min.js"></script>
<script src="js/pdf.min.js"></script>
<script src="js/aframe-particle-system-component.js"></script>
<!-- New Navigation -->
<script src="js/raycaster-extras.js"></script>
<script src="js/controller-listener.js"></script>
<script src="js/player-move.js"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div id="intro">
<div class="environment">
<div class="title">1. How the AI should assist you in creating reading environment?</div>
<div id="selectFrom">
<img class="icons" onclick="showB();" src="img/aiSound.png" width="250">
<img class="icons" onclick="loadEnvironment();" src="img/aiPdf.png" width="250">
</div>
<!--
<div class="subtitle">a) You load your 360 image, AI will load the sounds</div>
<div class="options">
</div>
<div class="subtitle">b) You load your pdf file, AI will load 360 image and sound</div>
<div class="options">
</div> -->
</div>
<div class="hidden">
<a href="javascript:void(0)" class="closebtn" onclick="hideWindow1()">×</a>
<div class="selectFrom2">
<div class="title">Please load a 360 photo</div>
<input onchange="loadPhotoLocally(this)" type="file">
<img id="imagePreview" style="height: 300px;" />
<div id="label-container"></div>
</div>
</div>
</div>
<div id="intro2">
<div class="environment">
<div class="title">2. Please load a pdf file</div>
<div class="selectFrom">
<div id="my_pdf_viewer" style="text-align: center">
<input id="pdf-upload" type="file" style="margin-top: 40px;" />
<div id="canvas_container">
<canvas id="pdf_renderer" style="display:none;"></canvas>
</div>
</div>
</div>
</div>
</div>
<!-- Overlay for preloading and options -->
<!-- <div id="overlay">
<div id="loader" style="color: white;">Loading material...</div>
</div> -->
<!--A-Frame Scene. Create navMesh, add Draco decoder vr-mode-ui="enabled: false" -->
<a-scene loading-screen="enabled: false" renderer="antialias: true; precision: medium">
<!-- Assets preload -->
<a-assets id="assets">
<video id="vid" src="videos/tale.mp4" autoplay loop playsinline webkit-playsinline crossorigin="anonymous"></video>
<video id="vid2" src="videos/history.mp4" autoplay loop playsinline webkit-playsinline
crossorigin="anonymous"></video>
<img id="inImg" src="img/zoomIn.png">
<img id="outImg" src="img/zoomOut.png">
<img id="previousImg" src="img/left.png">
<img id="nextImg" src="img/right.png">
<img id="interfaceOn" src="img/interfaceOn.png">
<img id="interfaceOff" src="img/interfaceOff.png">
<img id="soundOn" src="img/soundOn.png">
<img id="soundOff" src="img/soundOff.png">
<img id="rain" src="img/rain.png">
<img id="snow" src="img/snow.png">
<img id="dust" src="img/dust.png">
<img id="effectOff" src="img/effectOff.png">
</a-assets>
<!-- Particle Component -->
<a-entity id="particle" position="0 2.25 -15"></a-entity>
<!-- Sound component -->
<a-entity id="soundlink" sound="" crossorigin="anonymous"></a-entity>
<!-- Photo background -->
<a-plane class="groundPlane" scale="2 2 2" color="#333" width="8" height="8" rotation="-90 0 0" material=""
geometry="" position="0 0.01 0" visible="false"></a-plane>
<!-- Sky component -->
<a-sky id="photoBackground"></a-sky>
<!-- GroundPlane, necessary for NavMesh-->
<!-- <a-plane class="groundPlane" scale="2 2 2" color="#333" width="8" height="8" rotation="-90 0 0" material=""
geometry="" position="0 0.01 0"></a-plane> -->
<!-- Player -->
<a-entity id="player" position="0 0 0" player-move="controllerListenerId: #controller-data;
navigationMeshClass: groundPlane;">
<a-camera></a-camera>
<a-entity id="controller-data"
controller-listener="leftControllerId: #left-controller; rightControllerId: #right-controller;">
</a-entity>
<a-entity id="left-controller" oculus-touch-controls="hand: left">
</a-entity>
<!-- experiment with raycasting interval; slight performance improvement but jittery appearance in world -->
<a-entity id="right-controller" oculus-touch-controls="hand: right" laser-controls="hand: right"
raycaster="objects: .raycaster-target, .navButton, .groundPlane; interval: 0;"
raycaster-extras="controllerListenerId: #controller-data; beamImageSrc: #gradient; beamLength: 0.5;">
</a-entity>
</a-entity>
<!-- Click events for mouse/laser-controls -->
<a-entity position="0 0 0" cursor="fuse: false; rayOrigin: mouse;" raycaster="objects: .navButton">
</a-entity>
<a-entity id="mainWindow" position="0 1.11 -0.8" rotation="-10 0 0" raycaster-target="canGrab: true;"
geometry="primitive: plane; width: 0.8; height: 0.28"
material="color: #5475d4; transparent: true; opacity: 0.5; side:double" scale="1 1 1">
<!-- All buttons-->
<a-entity id="allButtons">
<a-entity id="zoom_in" class="navButton" geometry="primitive: plane;"
material="src: #inImg; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="-0.275 0.05 0.02"></a-entity>
<a-entity id="zoom_out" class="navButton" geometry="primitive: plane;"
material="src: #outImg; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="-0.175 0.05 0.02"></a-entity>
<a-entity id="go_previous" class="navButton" geometry="primitive: plane;"
material="src: #previousImg; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="-0.03 0.05 0.02"></a-entity>
<a-entity id="go_next" class="navButton" geometry="primitive: plane;"
material="src: #nextImg; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="0.07 0.05 0.02"></a-entity>
<a-entity id="current_page" geometry="primitive: plane; width: 0.18; height:0.08"
text="value: 0; color: #000; align: center; width: 1; height: 0.5"
material="transparent: true; opacity: 1; color: #fff" position="0.22 0.05 0.02"></a-entity>
<!-- Sound On/Off Button-->
<a-entity id="soundOnOff" class="navButton" geometry="primitive: plane;"
material="src: #soundOn; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="-0.175 -0.05 0.02"></a-entity>
<!-- Weather Effects -->
<a-entity id="rainOn" class="navButton" onclick="addRain()" geometry="primitive: plane;"
material="src: #rain; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="-0.03 -0.05 0.02"></a-entity>
<a-entity id="snowOn" class="navButton" onclick="addSnow()" geometry="primitive: plane;"
material="src: #snow; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="0.07 -0.05 0.02"></a-entity>
<a-entity id="dustOn" class="navButton" onclick="addDust()" geometry="primitive: plane;"
material="src: #dust; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="0.17 -0.05 0.02"></a-entity>
<a-entity class="navButton" onclick="effectOff()" geometry="primitive: plane;"
material="src: #effectOff; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.08 0.08 0.08"
position="0.27 -0.05 0.02"></a-entity>
</a-entity>
<!-- Interface On/Off Button -->
<a-entity id="openClose" class="navButton" geometry="primitive: plane;"
material="src: #interfaceOn; transparent: true; opacity: 1; alpha-test: 0.5" scale="0.05 0.05 0.05"
position="-0.36 -0.099 0.01"></a-entity>
<!-- Create parent plane so that book can be grabbed -->
<a-entity raycaster-target="canGrab: true;" position="0 0.5 -1"
geometry="primitive: plane; width: 1; height: 1" material="transparent: true; opacity: 0">
<!-- Pdf file display -->
<a-image id="book" src="" visible="false" side="double" transparent="false"></a-image>
</a-entity>
</a-entity>
</a-scene>
</body>
<script src="js/2_main.js"></script>
</html>