-
Notifications
You must be signed in to change notification settings - Fork 1
/
vr.html
212 lines (177 loc) · 9.39 KB
/
vr.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
<!doctype html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<title>Glossopticon VR</title>
<meta name="description" content="Glossopticon project : WebVR">
<meta name="author" content="Andrew Burrell ">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- jquery don't need dat.gui anymore but still commented out just in case want to bring it back-->
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<!--<script src="js/dat.gui.min.js"></script>-->
<link href="https://fonts.googleapis.com/css?family=Josefin+Sans:300|Roboto" rel="stylesheet">
<!-- style sheet -->
<link rel="stylesheet" href="css/vr-styles.css">
<!-- aframe and external components from cdn-->
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
<script src="https://rawgit.com/blairmacintyre/aframe-look-at-billboard-component/master/dist/aframe-look-at-billboard-component.min.js"></script>
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.1/dist/aframe-extras.min.js"></script>
<!-- custom component -->
<!-- see each compnents comments for details -->
<script src="components/loaderv2.js"></script>
<script src="components/audioController.js"></script>
<script src="components/cursorListener.js"></script>
<script src="components/metaData.js"></script>
<script src="components/keepAbove.js"></script>
<script src="components/distanceToCamera.js"></script>
<script src="components/enterExit.js"></script>
<script src="components/touchRot.js"></script>
<script src="components/touchMoveControls.js"></script>
<script src="components/audioGui.js"></script>
<script src="components/linkGui.js"></script>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-108233254-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-108233254-1');
</script>
<!-- end google analytics -->
</head>
<body>
<!-- side-panel is used on non VR tablet and phone for navigation -->
<div class="side-panel"></div>
<!-- data loader GUI - ab 2021 - allowing CSV upload -->
<div id="gui-container">
<form id="myForm">
<b>Select locations you would like
<br>
to display in the visualisation</b>
<br>
<div id="locationCheckBoxes"></div>
<div id="otherInput"></div>
<b>OR load your own csv file,</b><br>
<input type="file" id="csvFile" accept=".csv" height="30px"/>
<div class="smallerText">then select from from generated locations.</div>
<input type="button" id="build" height="30px" value="generate visualisation"/>
<div class="smallerText">*can be slow on older devices.</div>
</form>
</div>
<!-- end data loader GUI -->
<!-- the aframe scene -->
<!-- fairly minimal here as a lot is generated in the components -->
<a-scene loaderv2 fog="type: exponential; color: pink; density:0.005" enter-exit> <!-- vr-mode-ui="enabled: false">-->
<!-- assets manager -->
<!-- most assets are loaded live via components-->
<a-assets>
<!-- world map - 2:1 ratio with a rectalinear projection & pacific at center-->
<img id="world" src="img/world_wide.png">
<!-- icons used on the inworld popup GUI -->
<img id="audio-icon" src="img/audio_2.png">
<img id="link-icon" src="img/link_2.png">
<img id="beam-texture" src="img/beam.png">
</a-assets>
<!-- map: the map size is overridden by the loaderv2 compnent -->
<a-plane id="world-plane" height="500" width="1000" src="#world" position="0 0 0" rotation="-90 -90 0"></a-plane>
<!-- camera and reticle -->
<!-- backup controls -->
<!--<a-entity id="camera" keep-above="yHeight:0.5" movement-controls="speed: 0.5; movementControls: gamepad, keyboard, touch-movement, hmd; fly: true; movementEasingY: 15; movementAcceleration: 100; rotationControls: hmd, mouse, touch-rotation, gamepad; " position="-105 40 -80"> -->
<a-entity id="camera" keep-above="yHeight:0.5" movement-controls="speed: 0.3; movementControls: gamepad, keyboard, touch-movement, hmd; fly: true; movementEasingY: 15; movementAcceleration: 100; " position="-105 40 -80"> <!--rotation="-16 250 0-->
<!-- pointer locked camera -->
<!--
<a-entity camera
id="cameraInner"
position="0 0 0"
look-controls="pointerLockEnabled: true">
-->
<!-- alternate camera test for desktop functionality -->
<!-- pointer lock gets overwritten in enterExit for mobile -->
<a-entity camera
id="cameraInner"
position="0 0 0"
look-controls="pointerLockEnabled: false">
<a-entity id="inFront" position="0 0 -1.1"></a-entity>
<!-- for desktop version added in rayOrigin: mouse below
so we are now using mouse and click to bring up info boxes
this gets overwritten in enterExit for mobile -->
<a-entity id="mainCursor" cursor="fuse: true; fuseTimeout: 350; rayOrigin: mouse" raycaster="far: 20; interval: 100; objects: .clickable;" position="0 0 -1" geometry="primitive: ring; radiusInner: 0.01; radiusOuter: 0.015" material="color: hotpink; shader: flat">
<a-animation begin="click" easing="ease-in" attribute="scale" dur="150" fill="forwards" from="0.1 0.1 0.1" to="1 1 1"></a-animation>
<a-animation begin="cursor-fusing" easing="ease-in" attribute="scale" dur="800" fill="backwards" from="1 1 1" to="0.1 0.1 0.1"></a-animation>
</a-entity>
</a-entity>
</a-entity>
<!-- In world GUI -->
<!-- need to look at this still - playing up in mobile view, also font in cruchy -->
<a-plane id="infoGUISurround" position="0 0 -0.75" width="0.6" height="0.35" visible="true" material="shader:flat; transparent:false; opacity:1;">
<!-- <a-plane id="infoGUI" position="0 0.06 0" width="0.50" height="0.20" visible="true" material="transparent:false; opacity:1; color:white; shader: flat" text="font: font/roboto_extended.fnt; fontImage: font/roboto_extended.png; value: ; align: center; color:black; wrapCount:26; zOffset:0.02; opacity:1"> -->
<a-plane id="infoGUI" position="0 0.06 0" width="0.50" height="0.20" visible="true" material="transparent:false; opacity:1; color:white; shader: flat" text="shader: msdf; font: custom-msdf.json; negate: false; align: center; color:black; wrapCount:26; zOffset:0.02; opacity:1">
<a-animation attribute="text.opacity" begin="fade" to="1"></a-animation>
</a-plane>
<a-plane class="clickable" audio-gui id="audioIcon" position="0.180 -0.1 0.01" width="0.1" height="0.1" visible="true" material="shader:flat; opacity:1; src:#audio-icon; color:grey">
<a-animation attribute="material.opacity" begin="fade" to="1"></a-animation>
</a-plane>
<a-plane class="clickable" link-gui id="linkIcon" position="-0.180 -0.1 0.01" width="0.1" height="0.1" visible="true" material="shader:flat; opacity:1; src:#link-icon; color:grey">
<a-animation attribute="material.opacity" begin="fade" to="1"></a-animation>
</a-plane>
<a-animation attribute="material.opacity" begin="fade" to="1"></a-animation>
</a-plane>
<!-- Vive -->
<a-entity vive-controls="hand: right"></a-entity>
<!-- sky sphere -->
<a-sky color="pink"></a-sky>
</a-scene>
<!-- Trigger/Open The Modal -->
<button id="instructionsBtn">instructions</button>
<!-- The Modal -->
<div id="myModal" class="modal">
<!-- Modal content -->
<div class="modal-content">
<div class="modal-header">
<span class="close">×</span>
<h2>Instructions</h2>
</div>
<div class="modal-body">
<div id="hidden-sm">
<h5>desktop</h5>
<p>Use the W, A, S & D keys to move and the mouse to look around. Holding [SHIFT] and an movement key will speed up your movement to move longer distances quickly.</p>
<p>use the mouse cursor to point and click on the langauge shards for more information and use the icons to save links for later or isolate audio.</p>
</div>
<div id="hidden-lg">
<h5 class="hidden-lg">mobile</h5>
<p class="hidden-lg">touch and hold the screen to move forward and rotate the device to look around. </p>
<p class="hidden-lg">use the central circle cursor to select langauge shards by hovering it over them and use the same technique to select the icons to save links for later or isolate audio.</p>
</div>
</div>
<div class="modal-footer">
<h3>collect your links <a href="links.html">here</a></h3>
</div>
</div>
</div>
<!-- instructions popup -->
<script>
// Get the modal
var modal = document.getElementById("myModal");
// Get the button that opens the modal
var btn = document.getElementById("instructionsBtn");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
btn.onclick = function() {
modal.style.display = "block";
}
// When the user clicks on <span> (x), close the modal
span.onclick = function() {
modal.style.display = "none";
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
</body>
</html>