aframe-babia-components 1.2.2 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/filters/babia-selector.js +256 -79
- package/components/filters/babia-treebuilder.js +1 -2
- package/components/geometries/babia-bar.js +13 -1
- package/components/geometries/babia-cyl.js +189 -0
- package/components/others/assets/tooltip.png +0 -0
- package/components/others/babia-camera.js +195 -0
- package/components/others/babia-controls.js +56 -31
- package/components/others/babia-navigator.js +55 -49
- package/components/others/babia-range-selector.js +218 -0
- package/components/others/babia-slider.js +36 -8
- package/components/others/babia-ui.js +246 -73
- package/components/others/common.js +91 -83
- package/components/queriers/babia-querycsv.js +96 -0
- package/components/queriers/babia-queryes.js +209 -131
- package/components/visualizers/babia-bars.js +15 -38
- package/components/visualizers/babia-barsmap.js +19 -34
- package/components/visualizers/babia-boats.js +221 -134
- package/components/visualizers/babia-bubbles.js +13 -26
- package/components/visualizers/babia-cyls.js +203 -201
- package/components/visualizers/babia-cylsmap.js +173 -241
- package/components/visualizers/babia-doughnut.js +6 -28
- package/components/visualizers/babia-network.js +191 -124
- package/components/visualizers/babia-pie.js +6 -30
- package/dist/aframe-babia-components.js +21913 -19571
- package/dist/aframe-babia-components.min.js +7 -1
- package/dist/aframe-babia-components.min.js.map +1 -1
- package/docs/APIs/CHARTS.md +33 -14
- package/docs/APIs/DATAMANAGEMENT.md +7 -0
- package/docs/APIs/OTHERS.md +42 -0
- package/docs/APIs/QUERIERS.md +18 -0
- package/docs/RELEASE_NOTES.md +58 -21
- package/docs/Tutorials/multiuser.md +47 -2
- package/examples/assets/door/New Bitmap Image.jpg +0 -0
- package/examples/assets/door/door.mtl +26 -0
- package/examples/assets/door/door.obj +6927 -0
- package/examples/assets/popups/0.png +0 -0
- package/examples/assets/popups/1.png +0 -0
- package/examples/assets/popups/10.png +0 -0
- package/examples/assets/popups/2.png +0 -0
- package/examples/assets/popups/3.png +0 -0
- package/examples/assets/popups/4.png +0 -0
- package/examples/assets/popups/5.png +0 -0
- package/examples/assets/popups/6.png +0 -0
- package/examples/assets/popups/7.png +0 -0
- package/examples/assets/popups/8.png +0 -0
- package/examples/assets/popups/9.png +0 -0
- package/examples/assets/popups/close.jpg +0 -0
- package/examples/assets/popups/info.jpg +0 -0
- package/examples/assets/textures/brownwall.png +0 -0
- package/examples/assets/textures/concrete.png +0 -0
- package/examples/assets/textures/white-wall-texture.jpg +0 -0
- package/examples/charts/cyls/index.html +13 -4
- package/examples/charts/cyls/primitive.html +76 -0
- package/examples/charts/cylsmap/index.html +14 -5
- package/examples/charts_querier/bars_querier/data.csv +10 -0
- package/examples/charts_querier/bars_querier/index_csv.html +80 -0
- package/examples/charts_querier/multichart_querier/manual_colors.html +81 -0
- package/examples/dashboard/chaoss-dashboards.html +259 -0
- package/examples/dashboard/chaoss-issues.html +248 -0
- package/examples/dashboard/chaoss-pr.html +248 -0
- package/examples/dashboard/index.html +247 -0
- package/examples/dashboard/issues_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/issues_queries/issues-by-organization.json +107 -0
- package/examples/dashboard/issues_queries/issues.json +117 -0
- package/examples/dashboard/issues_queries/median-open-time.json +123 -0
- package/examples/dashboard/issues_queries/organizations.json +130 -0
- package/examples/dashboard/issues_queries/projects.json +130 -0
- package/examples/dashboard/issues_queries/repositories.json +130 -0
- package/examples/dashboard/issues_queries/status.json +107 -0
- package/examples/dashboard/issues_queries/submitter.json +125 -0
- package/examples/dashboard/issues_queries/submitters.json +113 -0
- package/examples/dashboard/pullrequests_queries/80-percent-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/median-open-time.json +123 -0
- package/examples/dashboard/pullrequests_queries/organizations.json +130 -0
- package/examples/dashboard/pullrequests_queries/projects.json +130 -0
- package/examples/dashboard/pullrequests_queries/pull-requests-by-organization.json +107 -0
- package/examples/dashboard/pullrequests_queries/pull-requests.json +117 -0
- package/examples/dashboard/pullrequests_queries/repositories.json +130 -0
- package/examples/dashboard/pullrequests_queries/status.json +107 -0
- package/examples/dashboard/pullrequests_queries/submitter.json +125 -0
- package/examples/dashboard/pullrequests_queries/submitters.json +113 -0
- package/examples/dashboard/range.html +88 -0
- package/examples/dashboard/template.html +136 -0
- package/examples/demos/1.0.11/index_multiuser_ui.html +1 -1
- package/examples/multi_bars/data.json +14 -0
- package/examples/multi_bars/data2.json +15 -0
- package/examples/multi_bars/data3.json +23 -0
- package/examples/multi_bars/easyrtc.js +11984 -0
- package/examples/multi_bars/index.html +97 -0
- package/examples/multi_bars/index1.html +111 -0
- package/examples/multi_bars/index2.html +102 -0
- package/examples/multi_bars/index3.html +104 -0
- package/examples/multi_boats/data3.json +174 -0
- package/examples/multi_boats/data4.json +192 -0
- package/examples/multi_boats/{index.html → index_multi_boats.html} +50 -55
- package/examples/multi_boats/jetuml.html +124 -115
- package/examples/multi_boats/jetuml_evolution_experiment.html +419 -0
- package/examples/multi_boats/only_queryjson.html +132 -0
- package/examples/multi_boats/only_queryjson2.html +167 -0
- package/examples/multi_boats/only_queryjson3.html +165 -0
- package/examples/multi_boats/queryjson_treebuilder.html +132 -0
- package/examples/multi_boats/with_selector.html +121 -111
- package/examples/multiuser/choose_avatar/index.html +18 -8
- package/examples/selector_boats/jetuml_from_3_2_to_1_0.json +62382 -0
- package/examples/ui/network/data.json +123 -0
- package/examples/ui/network/links.json +13 -0
- package/examples/ui/network/network.html +75 -0
- package/examples/ui/network/network_nodes_links.html +82 -0
- package/examples/ui/network/nodes.json +12 -0
- package/index.html +69 -3
- package/index.js +6 -1
- package/package.json +4 -3
- package/tests/screenshots/other_snapshots.js/chaoss-issues.png +0 -0
- package/tests/screenshots/other_snapshots.js/chaoss-pr.png +0 -0
- package/tests/screenshots/other_snapshots.js/template.png +0 -0
- package/tests/ui.js +7 -0
- package/webpack.common.js +1 -1
- package/webpack.devnossl.js +16 -0
- package/.idea/vcs.xml +0 -6
- package/.idea/workspace.xml +0 -79
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>BabiaXR - Multiuser Babia-boats Demo</title>
|
|
7
|
+
<meta name="description" content="Babiaxr multiuser demo using babia-boats.">
|
|
8
|
+
</meta>
|
|
9
|
+
<!-- Aframe -->
|
|
10
|
+
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.0/dist/aframe-extras.min.js"></script>
|
|
12
|
+
<script
|
|
13
|
+
src="https://unpkg.com/aframe-environment-component@1.2.0/dist/aframe-environment-component.min.js"></script>
|
|
14
|
+
<script src="../../dist/aframe-babia-components.js"></script>
|
|
15
|
+
<script
|
|
16
|
+
src="https://rawgit.com/fernandojsg/aframe-teleport-controls/master/dist/aframe-teleport-controls.min.js"></script>
|
|
17
|
+
<script src="https://unpkg.com/aframe-tooltip-component/dist/aframe-tooltip-component.min.js"></script>
|
|
18
|
+
<!-- Mulituser -->
|
|
19
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.slim.js"></script>
|
|
20
|
+
<script src="./easyrtc.js"></script>
|
|
21
|
+
<script src="https://unpkg.com/networked-aframe@^0.8.0/dist/networked-aframe.js"></script>
|
|
22
|
+
<script
|
|
23
|
+
src="https://unpkg.com/@editvr/aframe-dialog-popup-component@1.7.3/dist/aframe-dialog-popup-component.min.js"></script>
|
|
24
|
+
<!-- Gitlab Corner -->
|
|
25
|
+
<link rel="stylesheet" href="../assets/gitlab-corner.css">
|
|
26
|
+
</head>
|
|
27
|
+
|
|
28
|
+
<body>
|
|
29
|
+
<a-scene id="AframeScene" networked-scene="
|
|
30
|
+
room: multi_boats_jetuml;
|
|
31
|
+
adapter: easyrtc;
|
|
32
|
+
debug: true;
|
|
33
|
+
audio: true;
|
|
34
|
+
serverURL: https://f-l2108-pc02.aulas.etsit.urjc.es:49153/;
|
|
35
|
+
">
|
|
36
|
+
|
|
37
|
+
<a-assets>
|
|
38
|
+
<!-- Dummy asset to make the scene sync (WIP)-->
|
|
39
|
+
<img src="https://wallpapercave.com/wp/wp2345390.jpg?dummy=8484744">
|
|
40
|
+
<img id="sky" src="../demos/1.0.11/assets/360-panorama.jpg">
|
|
41
|
+
<img id="floor" src="../demos/1.0.11/assets/floor-texture.jpg">
|
|
42
|
+
<img id="metalic" src="../demos/1.0.11/assets/metalic-texture.jpg">
|
|
43
|
+
<img id="wall" src="../assets/textures/concrete.png">
|
|
44
|
+
<a-asset-item id="door-obj" src="../assets/door/door.obj"></a-asset-item>
|
|
45
|
+
<a-asset-item id="door-mtl" src="../assets/door/door.mtl"></a-asset-item>
|
|
46
|
+
|
|
47
|
+
<!-- Templates -->
|
|
48
|
+
|
|
49
|
+
<!-- Selector and navigator -->
|
|
50
|
+
<template id="selector-template">
|
|
51
|
+
<a-entity class="selector"></a-entity>
|
|
52
|
+
</template>
|
|
53
|
+
<template id="nav-template">
|
|
54
|
+
<a-entity class="nav"></a-entity>
|
|
55
|
+
</template>
|
|
56
|
+
<!--<template id="controls-template">
|
|
57
|
+
<a-entity class="controls"></a-entity>
|
|
58
|
+
</template>
|
|
59
|
+
-->
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
<!-- Camera -->
|
|
63
|
+
<template id="rig-template">
|
|
64
|
+
<a-entity class="rig"></a-entity>
|
|
65
|
+
</template>
|
|
66
|
+
<template id="camera-template">
|
|
67
|
+
<a-entity class="camera"></a-entity>
|
|
68
|
+
</template>
|
|
69
|
+
<template id="avatar-template">
|
|
70
|
+
<a-sphere class="avatar" networked-audio-source></a-sphere>
|
|
71
|
+
</template>
|
|
72
|
+
<template id="username-tag-template">
|
|
73
|
+
<a-text class="username-tag"></a-text>
|
|
74
|
+
</template>
|
|
75
|
+
</a-assets>
|
|
76
|
+
|
|
77
|
+
<!-- Environment -->
|
|
78
|
+
<a-sky src="#sky"></a-sky>
|
|
79
|
+
|
|
80
|
+
<!-- Room -->
|
|
81
|
+
<a-entity id="Room">
|
|
82
|
+
<a-entity id="floorRoom" material="shader: flat; src: #floor"
|
|
83
|
+
geometry="primitive: box; width: 7; depth: 9; height: 0.1"></a-entity>
|
|
84
|
+
<a-entity id="ceiling" geometry="primitive: box; width: 7; depth: 9; height: 0.1" position="0 3 0"
|
|
85
|
+
material="shader: flat; src: #wall"></a-entity>
|
|
86
|
+
<a-entity id="door" obj-model="obj: #door-obj; mtl: #door-mtl" position="3.4 1.2 -2.7" rotation="-90 -90 0"
|
|
87
|
+
scale="0.013 0.013 0.011"></a-entity>
|
|
88
|
+
<a-entity id="wall1" position="3.65 1.5 0">
|
|
89
|
+
<a-entity id="wall1-1" geometry="primitive: box; width: 0.5; depth: 8.7; height: 3"
|
|
90
|
+
material="shader: flat; src: #wall"></a-entity>
|
|
91
|
+
</a-entity>
|
|
92
|
+
<a-entity id="wall2" position="-3.5 1.5 0">
|
|
93
|
+
<a-entity id="wall2-1" geometry="primitive: box; width: 0.3; depth: 8.7; height: 1"
|
|
94
|
+
material="shader: flat; src: #wall; repeat: 5 1" position="0 -1 0"></a-entity>
|
|
95
|
+
<a-entity id="wall2-2" geometry="primitive: box; width: 0.3; depth: 8.7; height: 0.3"
|
|
96
|
+
material="shader: flat; src: #wall; repeat: 5 1" position="0 1.35 0"></a-entity>
|
|
97
|
+
<a-entity id="wall2-3" geometry="primitive: box; width: 0.3; depth: 0.5; height: 1.7"
|
|
98
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="0 0.35 0"></a-entity>
|
|
99
|
+
<a-entity id="wall2-4" geometry="primitive: box; width: 0.3; depth: 0.6; height: 1.7"
|
|
100
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="0 0.35 4.35"></a-entity>
|
|
101
|
+
<a-entity id="wall2-5" geometry="primitive: box; width: 0.3; depth: 0.6; height: 1.7"
|
|
102
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="0 0.35 -4.35"></a-entity>
|
|
103
|
+
</a-entity>
|
|
104
|
+
<a-entity id="wall3" position="0 1.5 -4.5">
|
|
105
|
+
<a-entity id="wall3-1" geometry="primitive: box; width: 7; depth: 0.3; height: 3"
|
|
106
|
+
material="shader: flat; src: #wall"></a-entity>
|
|
107
|
+
<a-entity id="column3" geometry="primitive: box; width: 0.3; depth: 0.3; height: 3"
|
|
108
|
+
material="shader: flat; src: #wall; repeat: 1 5" position="0 0 0.15"></a-entity>
|
|
109
|
+
</a-entity>
|
|
110
|
+
<a-entity id="wall4" position="0 1.5 4.5">
|
|
111
|
+
<a-entity id="wall4-1" geometry="primitive: box; width: 7.3; depth: 0.3; height: 1"
|
|
112
|
+
material="shader: flat; src: #wall; repeat: 5 1" position="0 -1 0"></a-entity>
|
|
113
|
+
<a-entity id="wall4-2" geometry="primitive: box; width: 7.3; depth: 0.3; height: 0.3"
|
|
114
|
+
material="shader: flat; src: #wall; repeat: 5 1" position="0 1.35 0"></a-entity>
|
|
115
|
+
<a-entity id="wall4-3" geometry="primitive: box; width: 0.5; depth: 0.3; height: 1.7"
|
|
116
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="0 0.35 0"></a-entity>
|
|
117
|
+
<a-entity id="wall4-4" geometry="primitive: box; width: 0.3; depth: 0.3; height: 1.7"
|
|
118
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="-3.2 0.35 0"></a-entity>
|
|
119
|
+
<a-entity id="wall4-5" geometry="primitive: box; width: 0.6; depth: 0.3; height: 1.7"
|
|
120
|
+
material="shader: flat; src: #wall; repeat: 1 3" position="3.4 0.35 0"></a-entity>
|
|
121
|
+
<a-entity id="column4" geometry="primitive: box; width: 0.3; depth: 0.3; height: 3"
|
|
122
|
+
material="shader: flat; src: #wall; repeat: 1 5" position="0 0 -0.15"></a-entity>
|
|
123
|
+
</a-entity>
|
|
124
|
+
</a-entity>
|
|
125
|
+
|
|
126
|
+
<!-- Slider -->
|
|
127
|
+
<a-entity id="nav" babia-navigator position="1.4 1 1" rotation="0 0 0" scale="0.3 0.3 0.3"
|
|
128
|
+
networked="template:#nav-template; networkId:nav; persistent: true; owner: scene"></a-entity>
|
|
129
|
+
|
|
130
|
+
<!-- Querier -->
|
|
131
|
+
<a-entity id="querier" babia-queryjson="url:../selector_boats/jetuml_from_3_2_to_1_0.json;"></a-entity>
|
|
132
|
+
<!-- 3 Selector -->
|
|
133
|
+
<a-entity id="selector" babia-selector="from: querier; controller: nav"
|
|
134
|
+
networked="template:#selector-template; networkId:selector; persistent: true; owner: scene"></a-entity>
|
|
135
|
+
<!-- Treebuilder -->
|
|
136
|
+
<a-entity id="treebuilder" babia-treebuilder="field: file_path; split_by: /; from: selector"></a-entity>
|
|
137
|
+
|
|
138
|
+
<!-- Boats Visualizer -->
|
|
139
|
+
<a-entity id="boats"
|
|
140
|
+
babia-boats="from: treebuilder; area: num_funs; height: loc_per_function; color: ccn; height_building_legend: -0.5; legend_scale: 0.25; height_quarter_legend_box: 1; height_quarter_legend_title: 1.5"
|
|
141
|
+
position="-1 0.3 0" scale="0.015 0.015 0.015"></a-entity>
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
<!-- Lights -->
|
|
145
|
+
<a-entity position="5 50 0" light="type: hemisphere; color: #CEE4F0; intensity: 1; groundColor: #454545">
|
|
146
|
+
</a-entity>
|
|
147
|
+
|
|
148
|
+
<!-- Controls and Camera -->
|
|
149
|
+
<a-entity id="cameraRig" position="0 1.6 3" networked="template:#rig-template; attachTemplateToLocal:false">
|
|
150
|
+
<a-entity id="head" babia-camera="raycasterMouse: .babiaxraycasterclass, #audio_button, #navbarpopup, #navbarpopup--close-icon;
|
|
151
|
+
raycasterHand: .babiaxraycasterclass, #audio_button, #navbarpopup, #navbarpopup--close-icon; teleportCollision: #floorRoom"
|
|
152
|
+
look-controls wasd-controls="fly: false"
|
|
153
|
+
networked="template:#camera-template;attachTemplateToLocal:false;">
|
|
154
|
+
<a-sphere id="avatar" color="#D3FFE4" scale="0.25 0.25 0.25"
|
|
155
|
+
networked="template:#avatar-template;attachTemplateToLocal:false;">
|
|
156
|
+
<a-text id="username-tag" networked="template:#username-tag-template; attachTemplateToLocal:false"
|
|
157
|
+
position="-0.5 1.5 0" width="5" color="black" value="username"></a-text>
|
|
158
|
+
</a-sphere>
|
|
159
|
+
</a-entity>
|
|
160
|
+
</a-entity>
|
|
161
|
+
|
|
162
|
+
<!-- Audio Button -->
|
|
163
|
+
<a-plane id="audio_button" position="1 2.5 0" rotation="0 0 0" height="0.5" width="1.5" color="#800"
|
|
164
|
+
scale="0.5 0.5 0.5">
|
|
165
|
+
<a-text id="audio_label" value="Stop Audio" color="#fff" width="4" position="-0.5 0 0" rotation="0 0 0">
|
|
166
|
+
</a-text>
|
|
167
|
+
</a-plane>
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
<!-- Information popup -->
|
|
171
|
+
<a-entity id="navbarpopup" position="2.5 1 -0.5" scale="0.3 0.3 0.3"
|
|
172
|
+
dialog-popup="
|
|
173
|
+
openIconImage: ../assets/popups/info.jpg;
|
|
174
|
+
closeIconImage: ../assets/popups/close.jpg;
|
|
175
|
+
title: How to use the navigation bar;
|
|
176
|
+
titleWrapCount: 30;
|
|
177
|
+
titleColor: white;
|
|
178
|
+
bodyColor: white;
|
|
179
|
+
dialogBoxColor: black;
|
|
180
|
+
bodyFont: roboto;
|
|
181
|
+
dialogBoxHeight: 8.5;
|
|
182
|
+
body: \n In this experiment we want to assess whether it is better to navigate 3D visualizations on-screen or using Virtual Reality (VR) headsets. \n Below you see a 3D representation of JetUML using the City metaphor. If you want to know more, please read the legend on the right of the city. \n
|
|
183
|
+
= CONTROLS AND INTERACTIONS \n Look around with your Virtual Reality (VR) headset and walk in the room to explore the city. \n To show a tooltip with additional information on a building, point on it with the cursor. If you press the trigger after pointing on a building, the tooltip will remain open. To show information on a quarter, you need to point on it and press the trigger. To close all tooltips, you can press the dedicated button above the legend on the right. \n To reset the view, please press and hold the Oculus Button. \n
|
|
184
|
+
= START THE EXPERIMENT \n Please make sure that your supervisor acitvated both voice and screen recording. When you are ready, close this information dialog by hitting the (X) and press the trigger on the button labeled with (0).; "
|
|
185
|
+
babia-lookat="[camera]"></a-entity>
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
</a-scene>
|
|
190
|
+
|
|
191
|
+
<script>
|
|
192
|
+
|
|
193
|
+
let selector = document.getElementById('selector')
|
|
194
|
+
let nav = document.getElementById('nav')
|
|
195
|
+
|
|
196
|
+
document.body.addEventListener('clientConnected', function (event) {
|
|
197
|
+
let clientId = event.detail.clientId;
|
|
198
|
+
console.log('clientConnected event. clientId =', clientId);
|
|
199
|
+
console.log("Selector owner: ", selector.components.networked.data.owner);
|
|
200
|
+
let imFirst = true
|
|
201
|
+
if (selector.components.networked.data.owner == 'scene'){
|
|
202
|
+
for (client in NAF.connection.getConnectedClients()){
|
|
203
|
+
let otherTime = NAF.connection.getConnectedClients()[client].roomJoinTime
|
|
204
|
+
let myTime = NAF.connection.adapter._myRoomJoinTime
|
|
205
|
+
console.log("Other: ", otherTime)
|
|
206
|
+
console.log("Mine: ", myTime)
|
|
207
|
+
if (myTime > otherTime){
|
|
208
|
+
imFirst = false;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (imFirst) {
|
|
212
|
+
NAF.utils.takeOwnership(selector)
|
|
213
|
+
NAF.utils.takeOwnership(nav)
|
|
214
|
+
} else {
|
|
215
|
+
console.log("I'm not first")
|
|
216
|
+
makeInvisible()
|
|
217
|
+
}
|
|
218
|
+
} else if (selector.components.networked.data.owner != NAF.clientId){
|
|
219
|
+
makeInvisible();
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
nav.addEventListener('click', function (e) {
|
|
225
|
+
if (!NAF.utils.isMine(selector) && nav.components.networked.data.owner != 'scene'){
|
|
226
|
+
if (Object.keys(NAF.connection.connectedClients).length > 0){
|
|
227
|
+
NAF.utils.takeOwnership(selector)
|
|
228
|
+
NAF.utils.takeOwnership(nav)
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
selector.addEventListener('ownership-gained', e => {
|
|
234
|
+
console.log("Selector ownership gained");
|
|
235
|
+
makeVisible();
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
selector.addEventListener('ownership-lost', e => {
|
|
240
|
+
console.log("Selector ownership lost");
|
|
241
|
+
makeInvisible();
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
function makeInvisible(){
|
|
245
|
+
nav.children[1].setAttribute('visible', false)
|
|
246
|
+
nav.children[2].setAttribute('visible', false)
|
|
247
|
+
nav.children[3].setAttribute('visible', false)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
function makeVisible(){
|
|
251
|
+
nav.children[1].setAttribute('visible', true)
|
|
252
|
+
nav.children[2].setAttribute('visible', true)
|
|
253
|
+
nav.children[3].setAttribute('visible', true)
|
|
254
|
+
}
|
|
255
|
+
</script>
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
<script>
|
|
259
|
+
|
|
260
|
+
document.addEventListener('controllerconnected' , (event) => {
|
|
261
|
+
let hand_left = document.getElementById('babia-leftHand');
|
|
262
|
+
// stop audio left hand
|
|
263
|
+
hand_left.addEventListener('gripdown', function (evt) {
|
|
264
|
+
let tooltipAudioButton = document.getElementById('babia-tooltip_grip_L')
|
|
265
|
+
if (tooltipAudioButton.components.tooltip.data.text === 'Stop Audio') {
|
|
266
|
+
NAF.connection.adapter.enableMicrophone(false);
|
|
267
|
+
tooltipAudioButton.setAttribute('tooltip', {'text': "Turn on Audio"});
|
|
268
|
+
} else {
|
|
269
|
+
NAF.connection.adapter.enableMicrophone(true);
|
|
270
|
+
tooltipAudioButton.setAttribute('tooltip', {'text': "Stop Audio"});
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
/* Camera */
|
|
277
|
+
let rig = document.getElementById('rig')
|
|
278
|
+
let avatar = document.getElementById('avatar')
|
|
279
|
+
let usernameTag = document.getElementById('username-tag')
|
|
280
|
+
|
|
281
|
+
let color = getRandomColor();
|
|
282
|
+
usernameTag.setAttribute('value', color)
|
|
283
|
+
avatar.setAttribute('color', color)
|
|
284
|
+
|
|
285
|
+
function getRandomColor() {
|
|
286
|
+
var digits = '0123456789ABCDEF';
|
|
287
|
+
var color = '#';
|
|
288
|
+
for (var i = 0; i < 6; i++) {
|
|
289
|
+
color += digits[Math.floor(Math.random() * 16)];
|
|
290
|
+
}
|
|
291
|
+
return color;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
/* Audio */
|
|
295
|
+
let audioButton = document.getElementById('audio_button');
|
|
296
|
+
let audioLabel = document.getElementById('audio_label');
|
|
297
|
+
|
|
298
|
+
audioButton.addEventListener('click', function (event) {
|
|
299
|
+
if (audioLabel.getAttribute('value') === 'Stop Audio') {
|
|
300
|
+
stopAudio();
|
|
301
|
+
} else {
|
|
302
|
+
turnOnAudio();
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
function turnOnAudio() {
|
|
306
|
+
NAF.connection.adapter.enableMicrophone(true);
|
|
307
|
+
audioButton.setAttribute('color', '#800');
|
|
308
|
+
audioLabel.setAttribute('color', '#fff');
|
|
309
|
+
audioLabel.setAttribute('value', 'Stop Audio');
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function stopAudio() {
|
|
313
|
+
NAF.connection.adapter.enableMicrophone(false);
|
|
314
|
+
audioButton.setAttribute('color', '#fff');
|
|
315
|
+
audioLabel.setAttribute('color', '#000');
|
|
316
|
+
audioLabel.setAttribute('value', 'Turn on Audio');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
</script>
|
|
322
|
+
<script>
|
|
323
|
+
NAF.schemas.add({
|
|
324
|
+
template: '#selector-template',
|
|
325
|
+
components: [
|
|
326
|
+
'babia-selector'
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
NAF.schemas.add({
|
|
330
|
+
template: '#nav-template',
|
|
331
|
+
components: [
|
|
332
|
+
'babia-navigator'
|
|
333
|
+
]
|
|
334
|
+
})
|
|
335
|
+
/*
|
|
336
|
+
NAF.schemas.add({
|
|
337
|
+
template: '#controls-template',
|
|
338
|
+
components: [
|
|
339
|
+
'babia-controls'
|
|
340
|
+
]
|
|
341
|
+
})*/
|
|
342
|
+
|
|
343
|
+
// Avatar
|
|
344
|
+
NAF.schemas.add({
|
|
345
|
+
template: '#rig-template',
|
|
346
|
+
components: [
|
|
347
|
+
'position',
|
|
348
|
+
'rotation'
|
|
349
|
+
]
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
NAF.schemas.add({
|
|
353
|
+
template: '#camera-template',
|
|
354
|
+
components: [
|
|
355
|
+
'position',
|
|
356
|
+
'rotation'
|
|
357
|
+
]
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
NAF.schemas.add({
|
|
361
|
+
template: '#avatar-template',
|
|
362
|
+
components: [
|
|
363
|
+
'position',
|
|
364
|
+
'rotation',
|
|
365
|
+
'color',
|
|
366
|
+
'scale'
|
|
367
|
+
]
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
NAF.schemas.add({
|
|
371
|
+
template: '#username-tag-template',
|
|
372
|
+
components: [
|
|
373
|
+
'value',
|
|
374
|
+
'color',
|
|
375
|
+
'width',
|
|
376
|
+
'position',
|
|
377
|
+
'rotation'
|
|
378
|
+
]
|
|
379
|
+
});
|
|
380
|
+
</script>
|
|
381
|
+
|
|
382
|
+
<!-- GITLAB CORNER-->
|
|
383
|
+
<div class="gitlab-corner-wrapper"><a
|
|
384
|
+
href="https://gitlab.com/babiaxr/aframe-babia-components/-/blob/master/examples/multi_boats/jetuml.html"
|
|
385
|
+
class="gitlab-corner" aria-label="View source on GitLab"><svg id="logo_art" data-name="logo art"
|
|
386
|
+
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 586 559">
|
|
387
|
+
<g id="g44">
|
|
388
|
+
<path id="path46" class="cls-1"
|
|
389
|
+
d="M461.17,301.83l-18.91-58.12L404.84,128.43a6.47,6.47,0,0,0-12.27,0L355.15,243.64H230.82L193.4,128.43a6.46,6.46,0,0,0-12.26,0L143.78,243.64l-18.91,58.19a12.88,12.88,0,0,0,4.66,14.39L293,435,456.44,316.22a12.9,12.9,0,0,0,4.73-14.39" />
|
|
390
|
+
</g>
|
|
391
|
+
<g id="g48">
|
|
392
|
+
<path id="path50" class="cls-2" d="M293,434.91h0l62.16-191.28H230.87L293,434.91Z" />
|
|
393
|
+
</g>
|
|
394
|
+
<g id="g56">
|
|
395
|
+
<path id="path58" class="cls-1" d="M293,434.91,230.82,243.63h-87L293,434.91Z" />
|
|
396
|
+
</g>
|
|
397
|
+
<g id="g64">
|
|
398
|
+
<path id="path66" class="cls-3"
|
|
399
|
+
d="M143.75,243.69h0l-18.91,58.12a12.88,12.88,0,0,0,4.66,14.39L293,435,143.75,243.69Z" />
|
|
400
|
+
</g>
|
|
401
|
+
<g id="g72">
|
|
402
|
+
<path id="path74" class="cls-2"
|
|
403
|
+
d="M143.78,243.69h87.11L193.4,128.49a6.47,6.47,0,0,0-12.27,0l-37.35,115.2Z" />
|
|
404
|
+
</g>
|
|
405
|
+
<g id="g76">
|
|
406
|
+
<path id="path78" class="cls-1" d="M293,434.91l62.16-191.28H442.3L293,434.91Z" />
|
|
407
|
+
</g>
|
|
408
|
+
<g id="g80">
|
|
409
|
+
<path id="path82" class="cls-3"
|
|
410
|
+
d="M442.24,243.69h0l18.91,58.12a12.85,12.85,0,0,1-4.66,14.39L293,434.91l149.2-191.22Z" />
|
|
411
|
+
</g>
|
|
412
|
+
<g id="g84">
|
|
413
|
+
<path id="path86" class="cls-2"
|
|
414
|
+
d="M442.28,243.69h-87.1l37.42-115.2a6.46,6.46,0,0,1,12.26,0l37.42,115.2Z" />
|
|
415
|
+
</g>
|
|
416
|
+
</svg></a></div>
|
|
417
|
+
</body>
|
|
418
|
+
|
|
419
|
+
</html>
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
<html>
|
|
2
|
+
|
|
3
|
+
<head>
|
|
4
|
+
<title>Multiuser Time Evolution with Babia-Boats, queryjson and boats together. Start when new user joins</title>
|
|
5
|
+
<script src="https://aframe.io/releases/1.2.0/aframe.min.js"></script>
|
|
6
|
+
<script src="https://cdn.jsdelivr.net/gh/donmccurdy/aframe-extras@v6.1.0/dist/aframe-extras.min.js"></script>
|
|
7
|
+
<script src="https://unpkg.com/aframe-environment-component@1.2.0/dist/aframe-environment-component.min.js"></script>
|
|
8
|
+
<script src="https://unpkg.com/aframe-text-geometry-component@0.5.1/dist/aframe-text-geometry-component.min.js"></script>
|
|
9
|
+
<script src="../../dist/aframe-babia-components.js"></script>
|
|
10
|
+
<!-- Mulituser -->
|
|
11
|
+
<script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.3.0/socket.io.slim.js"></script>
|
|
12
|
+
<script src="./easyrtc.js"></script>
|
|
13
|
+
<script src="https://unpkg.com/networked-aframe@^0.8.0/dist/networked-aframe.js"></script>
|
|
14
|
+
<!-- Gitlab Corner -->
|
|
15
|
+
<link rel="stylesheet" href="../assets/gitlab-corner.css">
|
|
16
|
+
</head>
|
|
17
|
+
|
|
18
|
+
<body>
|
|
19
|
+
<a-scene rain background="color: #ECECEC" networked-scene="
|
|
20
|
+
room: multi_boats_queryjson;
|
|
21
|
+
adapter: easyrtc;
|
|
22
|
+
debug: true;
|
|
23
|
+
audio: false;
|
|
24
|
+
serverURL: https://f-l2108-pc02.aulas.etsit.urjc.es:49153/;
|
|
25
|
+
">
|
|
26
|
+
<a-assets>
|
|
27
|
+
<!-- Dummy asset to make the scene sync (WIP)-->
|
|
28
|
+
<img src="https://wallpapercave.com/wp/wp2345390.jpg?dummy=8484744">
|
|
29
|
+
|
|
30
|
+
<template id="boats-template">
|
|
31
|
+
<a-entity class="boats"></a-entity>
|
|
32
|
+
</template>
|
|
33
|
+
</a-assets>
|
|
34
|
+
<a-entity environment="preset: japan"></a-entity>
|
|
35
|
+
|
|
36
|
+
<a-entity id="boats" networked="template:#boats-template; networkId:boats; persistent: true; owner: scene"
|
|
37
|
+
babia-queryjson="url: ../boats/boats_temporal/data1.json;"
|
|
38
|
+
babia-boats position="0 1 0">
|
|
39
|
+
</a-entity>
|
|
40
|
+
|
|
41
|
+
<a-entity movement-controls="fly: true" position="2 5 15">
|
|
42
|
+
<a-entity camera position="0 0 0" look-controls></a-entity>
|
|
43
|
+
<a-entity cursor="rayOrigin:mouse"></a-entity>
|
|
44
|
+
<a-entity laser-controls="hand: right"></a-entity>
|
|
45
|
+
</a-entity>
|
|
46
|
+
</a-scene>
|
|
47
|
+
<script>
|
|
48
|
+
|
|
49
|
+
let boats = document.getElementById('boats')
|
|
50
|
+
document.body.addEventListener('clientConnected', function (event) {
|
|
51
|
+
let clientId = event.detail.clientId;
|
|
52
|
+
console.log('clientConnected event. clientId =', clientId);
|
|
53
|
+
console.log("Boats owner: ", boats.components.networked.data.owner);
|
|
54
|
+
if (boats.components.networked.data.owner == 'scene'){
|
|
55
|
+
let imFirst = true
|
|
56
|
+
for (client in NAF.connection.getConnectedClients()){
|
|
57
|
+
let otherTime = NAF.connection.getConnectedClients()[client].roomJoinTime
|
|
58
|
+
let myTime = NAF.connection.adapter._myRoomJoinTime
|
|
59
|
+
console.log("Other: ", otherTime)
|
|
60
|
+
console.log("Mine: ", myTime)
|
|
61
|
+
if (myTime > otherTime){
|
|
62
|
+
imFirst = false;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (imFirst){
|
|
66
|
+
NAF.utils.takeOwnership(boats)
|
|
67
|
+
setTimeout(updateData, 4000);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
function updateData () {
|
|
73
|
+
boats.setAttribute('babia-queryjson', 'url', '../boats/boats_temporal/data2.json');
|
|
74
|
+
setTimeout(updateData1, 4000);
|
|
75
|
+
}
|
|
76
|
+
function updateData1 () {
|
|
77
|
+
boats.setAttribute('babia-queryjson', 'url', '../boats/boats_temporal/data1.json');
|
|
78
|
+
setTimeout(updateData2, 4000);
|
|
79
|
+
}
|
|
80
|
+
function updateData2 () {
|
|
81
|
+
boats.setAttribute('babia-queryjson', 'url', '../boats/boats_temporal/data2.json');
|
|
82
|
+
}
|
|
83
|
+
</script>
|
|
84
|
+
<script>
|
|
85
|
+
NAF.schemas.add({
|
|
86
|
+
template: '#boats-template',
|
|
87
|
+
components: [
|
|
88
|
+
'position',
|
|
89
|
+
'rotation',
|
|
90
|
+
'scale',
|
|
91
|
+
'babia-boats',
|
|
92
|
+
'babia-queryjson',
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
</script>
|
|
96
|
+
<!-- GITLAB CORNER-->
|
|
97
|
+
<div class="gitlab-corner-wrapper"><a
|
|
98
|
+
href="https://gitlab.com/babiaxr/aframe-babia-components/-/blob/master/examples/multi_boats/only_queryjson.html"
|
|
99
|
+
class="gitlab-corner" aria-label="View source on GitLab"><svg id="logo_art" data-name="logo art"
|
|
100
|
+
xmlns="http://www.w3.org/2000/svg" viewBox="0 0 586 559">
|
|
101
|
+
<g id="g44">
|
|
102
|
+
<path id="path46" class="cls-1"
|
|
103
|
+
d="M461.17,301.83l-18.91-58.12L404.84,128.43a6.47,6.47,0,0,0-12.27,0L355.15,243.64H230.82L193.4,128.43a6.46,6.46,0,0,0-12.26,0L143.78,243.64l-18.91,58.19a12.88,12.88,0,0,0,4.66,14.39L293,435,456.44,316.22a12.9,12.9,0,0,0,4.73-14.39" />
|
|
104
|
+
</g>
|
|
105
|
+
<g id="g48">
|
|
106
|
+
<path id="path50" class="cls-2" d="M293,434.91h0l62.16-191.28H230.87L293,434.91Z" />
|
|
107
|
+
</g>
|
|
108
|
+
<g id="g56">
|
|
109
|
+
<path id="path58" class="cls-1" d="M293,434.91,230.82,243.63h-87L293,434.91Z" />
|
|
110
|
+
</g>
|
|
111
|
+
<g id="g64">
|
|
112
|
+
<path id="path66" class="cls-3"
|
|
113
|
+
d="M143.75,243.69h0l-18.91,58.12a12.88,12.88,0,0,0,4.66,14.39L293,435,143.75,243.69Z" />
|
|
114
|
+
</g>
|
|
115
|
+
<g id="g72">
|
|
116
|
+
<path id="path74" class="cls-2"
|
|
117
|
+
d="M143.78,243.69h87.11L193.4,128.49a6.47,6.47,0,0,0-12.27,0l-37.35,115.2Z" />
|
|
118
|
+
</g>
|
|
119
|
+
<g id="g76">
|
|
120
|
+
<path id="path78" class="cls-1" d="M293,434.91l62.16-191.28H442.3L293,434.91Z" />
|
|
121
|
+
</g>
|
|
122
|
+
<g id="g80">
|
|
123
|
+
<path id="path82" class="cls-3"
|
|
124
|
+
d="M442.24,243.69h0l18.91,58.12a12.85,12.85,0,0,1-4.66,14.39L293,434.91l149.2-191.22Z" />
|
|
125
|
+
</g>
|
|
126
|
+
<g id="g84">
|
|
127
|
+
<path id="path86" class="cls-2"
|
|
128
|
+
d="M442.28,243.69h-87.1l37.42-115.2a6.46,6.46,0,0,1,12.26,0l37.42,115.2Z" />
|
|
129
|
+
</g>
|
|
130
|
+
</svg></a></div>
|
|
131
|
+
</body>
|
|
132
|
+
</html>
|