janusweb 1.5.47 → 1.5.49
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/media/assets/webui/apps/buttons/buttons.js +5 -3
- package/media/assets/webui/apps/comms/comms.js +6 -1
- package/package.json +2 -2
- package/scripts/client.js +5 -1
- package/scripts/elements/outliner.js +21 -8
- package/scripts/janusbase.js +11 -4
- package/scripts/janusghost.js +9 -12
- package/scripts/janusplayer.js +106 -16
- package/scripts/janusweb.js +1 -0
- package/scripts/multiplayermanager.js +1 -1
- package/scripts/object.js +1 -2
- package/scripts/remoteplayer.js +2 -0
- package/scripts/sound.js +30 -14
|
@@ -189,12 +189,14 @@ elation.elements.define('janus-button-start', class extends elation.elements.ui.
|
|
|
189
189
|
}
|
|
190
190
|
onclick(ev) {
|
|
191
191
|
janus.engine.systems.sound.enableSound();
|
|
192
|
-
janus.engine.systems.controls.requestPointerLock();
|
|
193
192
|
if (room.objects.scroller) {
|
|
194
193
|
room.objects.scroller.disable();
|
|
195
194
|
}
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
if (room.pointerlock) {
|
|
196
|
+
janus.engine.systems.controls.requestPointerLock();
|
|
197
|
+
//player.flying = false;
|
|
198
|
+
player.enable();
|
|
199
|
+
}
|
|
198
200
|
//janus.ui.show();
|
|
199
201
|
}
|
|
200
202
|
});
|
|
@@ -209,8 +209,10 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
|
|
|
209
209
|
}
|
|
210
210
|
});
|
|
211
211
|
elation.events.add(janus._target, 'clientprint', (ev) => this.handleClientPrint(ev.data));
|
|
212
|
+
elation.events.add(this.janusweb, 'room_load_start', (ev) => { this.updateRoom(ev.data); });
|
|
212
213
|
// FIXME - first element with the current design is a <detail> element, but this is fragile if that changes
|
|
213
214
|
this.elements[0].addEventListener('toggle', (ev) => this.elements.chatinput.focus());
|
|
215
|
+
this.updateRoom(room);
|
|
214
216
|
}
|
|
215
217
|
scrollToBottom() {
|
|
216
218
|
setTimeout(() => {
|
|
@@ -219,7 +221,7 @@ elation.elements.define('janus-comms-chat', class extends elation.elements.base
|
|
|
219
221
|
}
|
|
220
222
|
handleUserJoined(ev) {
|
|
221
223
|
var data = ev.data;
|
|
222
|
-
if (!this.elements.chatmessages) return;
|
|
224
|
+
if (!this.elements || !this.elements.chatmessages) return;
|
|
223
225
|
this.elements.chatmessages.add({
|
|
224
226
|
timestamp: new Date().getTime(),
|
|
225
227
|
type: 'join',
|
|
@@ -302,6 +304,9 @@ if (!this.elements.chatmessages) return;
|
|
|
302
304
|
}
|
|
303
305
|
this.elements.unread.count = this.numunread;
|
|
304
306
|
}
|
|
307
|
+
updateRoom(newroom) {
|
|
308
|
+
this.elements.toggle.open = !newroom.private;
|
|
309
|
+
}
|
|
305
310
|
});
|
|
306
311
|
|
|
307
312
|
elation.elements.define('janus-comms-voip', class extends elation.elements.base {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "janusweb",
|
|
3
3
|
"description": "Web client for JanusVR worlds",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.49",
|
|
5
5
|
"main": "scripts/janusweb.js",
|
|
6
6
|
"author": "James Baicoianu",
|
|
7
7
|
"license": "MIT",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"elation-engine": ">=0.9.114",
|
|
22
|
-
"uglify-
|
|
22
|
+
"uglify-js": "*"
|
|
23
23
|
},
|
|
24
24
|
"keywords": [
|
|
25
25
|
"elation",
|
package/scripts/client.js
CHANGED
|
@@ -65,6 +65,7 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
65
65
|
append: container,
|
|
66
66
|
homepage: homepage,
|
|
67
67
|
corsproxy: corsproxy,
|
|
68
|
+
showui: (args.showui && args.showui != "false"),
|
|
68
69
|
shownavigation: (args.shownavigation && args.shownavigation != "false"),
|
|
69
70
|
uiconfig: args.uiconfig,
|
|
70
71
|
showchat: elation.utils.any(args.showchat, true),
|
|
@@ -95,6 +96,7 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
95
96
|
homepage: { type: 'string' },
|
|
96
97
|
url: { type: 'string' },
|
|
97
98
|
uiconfig: { type: 'string' },
|
|
99
|
+
showui: { type: 'boolean' },
|
|
98
100
|
shownavigation: { type: 'boolean', default: true },
|
|
99
101
|
showchat: { type: 'boolean', default: true },
|
|
100
102
|
networking: { type: 'boolean', default: true },
|
|
@@ -195,7 +197,7 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
195
197
|
|
|
196
198
|
var datapath = elation.config.get('janusweb.datapath', '/media/janusweb');
|
|
197
199
|
this.uiconfig = elation.utils.any(this.player.getSetting('uiconfig'), this.uiconfig, datapath + (datapath[datapath.length-1] != '/' ? '/' : '') + 'assets/webui/default.json');
|
|
198
|
-
if (this.shownavigation) {
|
|
200
|
+
if (this.showui && this.shownavigation) {
|
|
199
201
|
this.createUI();
|
|
200
202
|
}
|
|
201
203
|
this.view.pickingactive = true;
|
|
@@ -327,6 +329,7 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
327
329
|
networking: { type: 'boolean', default: true },
|
|
328
330
|
avatarsrc: { type: 'string', default: false },
|
|
329
331
|
uiconfig: { type: 'string', default: false },
|
|
332
|
+
showui: { type: 'boolean', default: true },
|
|
330
333
|
shownavigation: { type: 'boolean', default: true },
|
|
331
334
|
});
|
|
332
335
|
}
|
|
@@ -355,6 +358,7 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
355
358
|
networking: this.networking,
|
|
356
359
|
corsproxy: this.corsproxy,
|
|
357
360
|
//resolution: width + 'x' + height,
|
|
361
|
+
showui: this.showui && this.showui != 'false',
|
|
358
362
|
shownavigation: this.shownavigation,
|
|
359
363
|
avatarsrc: this.avatarsrc,
|
|
360
364
|
uiconfig: this.uiconfig,
|
|
@@ -69,19 +69,31 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
69
69
|
},
|
|
70
70
|
select(object) {
|
|
71
71
|
this.selected = object;
|
|
72
|
+
if (!this.meshes) return;
|
|
72
73
|
if (!object) {
|
|
73
74
|
this.deselect();
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
77
|
let objmeshes = [], skinnedmeshes = [];
|
|
77
|
-
object.
|
|
78
|
-
|
|
79
|
-
if (n.
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
if (object instanceof THREE.Object3D) {
|
|
79
|
+
object.traverse(n => {
|
|
80
|
+
if (n instanceof THREE.Mesh && n.material !== this.outlinematerial) {
|
|
81
|
+
if (n.isSkinnedMesh)
|
|
82
|
+
skinnedmeshes.push(n);
|
|
83
|
+
else
|
|
84
|
+
objmeshes.push(n);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
} else {
|
|
88
|
+
object.traverseObjects(n => {
|
|
89
|
+
if (n instanceof THREE.Mesh && n.material !== this.outlinematerial) {
|
|
90
|
+
if (n.isSkinnedMesh)
|
|
91
|
+
skinnedmeshes.push(n);
|
|
92
|
+
else
|
|
93
|
+
objmeshes.push(n);
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
}
|
|
85
97
|
// Create and update regular Meshes
|
|
86
98
|
let meshIdx = 0;
|
|
87
99
|
for (; meshIdx < objmeshes.length; meshIdx++) {
|
|
@@ -119,6 +131,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
119
131
|
this.refresh();
|
|
120
132
|
},
|
|
121
133
|
deselect() {
|
|
134
|
+
if (!this.meshes) return;
|
|
122
135
|
for (let meshIdx = 0; meshIdx < this.meshes.length; meshIdx++) {
|
|
123
136
|
this.meshes[meshIdx].geometry = null;
|
|
124
137
|
if (this.meshes[meshIdx].parent) {
|
package/scripts/janusbase.js
CHANGED
|
@@ -57,6 +57,9 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
57
57
|
ongazeprogress: { type: 'callback' },
|
|
58
58
|
ongazeactivate: { type: 'callback' },
|
|
59
59
|
oncollision: { type: 'callback' },
|
|
60
|
+
onmouseover: { type: 'callback' },
|
|
61
|
+
onmouseout: { type: 'callback' },
|
|
62
|
+
onmousemove: { type: 'callback' },
|
|
60
63
|
});
|
|
61
64
|
this.lastframevalues = {
|
|
62
65
|
position: new THREE.Vector3(0,0,0),
|
|
@@ -431,7 +434,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
431
434
|
addForce: ['function', 'addForce'],
|
|
432
435
|
removeForce: ['function', 'removeForce'],
|
|
433
436
|
die: ['function', 'die'],
|
|
434
|
-
refresh: [
|
|
437
|
+
refresh: ['function', 'refresh'],
|
|
435
438
|
executeCallback: ['function', 'executeCallback'],
|
|
436
439
|
isEqual: ['function', 'isEqual'],
|
|
437
440
|
addClass: ['function', 'addClass'],
|
|
@@ -467,11 +470,15 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
467
470
|
//} else if (v === true || v === false) {
|
|
468
471
|
// propertydefs[k] = {type: 'boolean', default: v };
|
|
469
472
|
} else if (v instanceof THREE.Vector3) {
|
|
470
|
-
propertydefs[k] = {type: 'vector3', default: v };
|
|
473
|
+
propertydefs[k] = {type: 'vector3', default: v.clone() };
|
|
471
474
|
} else if (v instanceof THREE.Color) {
|
|
472
|
-
propertydefs[k] = {type: 'color', default: v };
|
|
475
|
+
propertydefs[k] = {type: 'color', default: v.clone() };
|
|
473
476
|
} else if (v instanceof THREE.Euler) {
|
|
474
|
-
propertydefs[k] = {type: 'euler', default: v };
|
|
477
|
+
propertydefs[k] = {type: 'euler', default: v.clone() };
|
|
478
|
+
} else if (typeof v == 'boolean') {
|
|
479
|
+
propertydefs[k] = {type: 'boolean', default: v };
|
|
480
|
+
} else if (v instanceof CustomEvent) {
|
|
481
|
+
propertydefs[k] = {type: 'callback' };
|
|
475
482
|
} else {
|
|
476
483
|
propertydefs[k] = {type: 'object', default: v };
|
|
477
484
|
}
|
package/scripts/janusghost.js
CHANGED
|
@@ -286,7 +286,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
286
286
|
this.body = this.createObject('object', {
|
|
287
287
|
id: bodyid,
|
|
288
288
|
//orientation: new THREE.Quaternion().setFromEuler(new THREE.Euler(0,Math.PI,0)),
|
|
289
|
-
|
|
289
|
+
rotation: V(0, 180, 0),
|
|
290
290
|
lighting: this.lighting,
|
|
291
291
|
//cull_face: 'none'
|
|
292
292
|
opacity: 0.9999,
|
|
@@ -446,7 +446,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
446
446
|
}
|
|
447
447
|
});
|
|
448
448
|
} else {
|
|
449
|
-
let armature = sourcecontainer.getObjectByName('Armature');
|
|
449
|
+
let armature = sourcecontainer.getObjectByName('Armature') || sourcecontainer;
|
|
450
450
|
newclip.tracks.forEach(track => {
|
|
451
451
|
track.name = track.name.replace('mixamorig', '');
|
|
452
452
|
let p = track.name.split('.');
|
|
@@ -528,6 +528,8 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
528
528
|
var xdir = new THREE.Vector3(),
|
|
529
529
|
ydir = new THREE.Vector3(),
|
|
530
530
|
zdir = new THREE.Vector3(),
|
|
531
|
+
flip = new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0));
|
|
532
|
+
origin = new THREE.Vector3(),
|
|
531
533
|
matrix = new THREE.Matrix4(),
|
|
532
534
|
q1 = new THREE.Quaternion();
|
|
533
535
|
return function(movedata) {
|
|
@@ -550,16 +552,11 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
550
552
|
if (this.head) {
|
|
551
553
|
ydir.fromArray(parser.getVectorValue(movedata.up_dir, [0,1,0]));
|
|
552
554
|
zdir.fromArray(parser.getVectorValue(movedata.view_dir, [0,0,1]));
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
xdir.crossVectors(zdir, ydir).normalize();
|
|
556
|
-
zdir.crossVectors(xdir, ydir).normalize();
|
|
557
|
-
|
|
558
|
-
matrix.makeBasis(xdir, ydir, zdir);
|
|
555
|
+
matrix.lookAt(origin, zdir, ydir);
|
|
559
556
|
q1.setFromRotationMatrix(matrix);
|
|
560
|
-
this.head.properties.orientation.copy(this.orientation).invert().multiply(q1);
|
|
557
|
+
this.head.properties.orientation.copy(this.orientation).invert().multiply(q1).multiply(flip);
|
|
561
558
|
if (this.body && this.headaction) {
|
|
562
|
-
this.setHeadOrientation(this.head.orientation);
|
|
559
|
+
this.setHeadOrientation(this.head.orientation, true);
|
|
563
560
|
}
|
|
564
561
|
if (movedata.head_pos && this.face) {
|
|
565
562
|
var headpos = this.head.properties.position;
|
|
@@ -863,7 +860,7 @@ return;
|
|
|
863
860
|
let track = headaction._clip.tracks[0];
|
|
864
861
|
if (track) {
|
|
865
862
|
track.values[0] = orientation.x * (invert ? -1 : 1);
|
|
866
|
-
track.values[1] = orientation.y * (invert ?
|
|
863
|
+
track.values[1] = orientation.y * (invert ? 1 : -1);
|
|
867
864
|
track.values[2] = orientation.z * (invert ? -1 : 1);
|
|
868
865
|
track.values[3] = orientation.w; // * (invert ? -1 : 1);
|
|
869
866
|
}
|
|
@@ -880,7 +877,7 @@ return;
|
|
|
880
877
|
this.blinktimer = setTimeout(() => {
|
|
881
878
|
this.blinktimer = false;
|
|
882
879
|
this.blink();
|
|
883
|
-
},
|
|
880
|
+
}, 250 + Math.random() * 10000);
|
|
884
881
|
}
|
|
885
882
|
}
|
|
886
883
|
this.setSpeakingVolume = function(volume) {
|
package/scripts/janusplayer.js
CHANGED
|
@@ -147,6 +147,7 @@ document.body.dispatchEvent(click);
|
|
|
147
147
|
this.currentavatar = '';
|
|
148
148
|
this.getAvatarData().then(d => this.currentavatar = d);
|
|
149
149
|
this.morphtargetchanges = {};
|
|
150
|
+
this.eventlistenerproxies = {};
|
|
150
151
|
}
|
|
151
152
|
this.createChildren = function() {
|
|
152
153
|
elation.engine.things.janusplayer.extendclass.createChildren.call(this);
|
|
@@ -303,10 +304,10 @@ document.body.dispatchEvent(click);
|
|
|
303
304
|
}
|
|
304
305
|
}
|
|
305
306
|
if (this.ghost && !this.decouplehead) {
|
|
306
|
-
this.ghost.setHeadOrientation(this.head.orientation, true);
|
|
307
|
+
this.ghost.setHeadOrientation(_tmpquat.multiplyQuaternions(this.neck.orientation._target, this.head.orientation._target), true);
|
|
307
308
|
if (this.ghost._target.head) {
|
|
308
309
|
//this.ghost._target.face.position.copy(this.head.position);
|
|
309
|
-
this.ghost.head.orientation.copy(this.head.orientation).
|
|
310
|
+
this.ghost.head.orientation.copy(this.head.orientation).multiply(this.neck.orientation);;
|
|
310
311
|
}
|
|
311
312
|
}
|
|
312
313
|
}
|
|
@@ -510,10 +511,10 @@ document.body.dispatchEvent(click);
|
|
|
510
511
|
avatar_src: 'data:text/plain,' + encodeURIComponent(avatar),
|
|
511
512
|
showlabel: false,
|
|
512
513
|
//pos: V(0, -this.fatness, 0),
|
|
513
|
-
rotation: V(0, 180, 0),
|
|
514
|
+
//rotation: V(0, 180, 0),
|
|
514
515
|
renderorder: 101,
|
|
515
516
|
});
|
|
516
|
-
this.ghost.orientation.set(0,1,0,0);
|
|
517
|
+
//this.ghost.orientation.set(0,1,0,0);
|
|
517
518
|
}
|
|
518
519
|
});
|
|
519
520
|
this.visible = true;
|
|
@@ -661,6 +662,9 @@ document.body.dispatchEvent(click);
|
|
|
661
662
|
getSetting: ['function', 'getSetting'],
|
|
662
663
|
setSetting: ['function', 'setSetting'],
|
|
663
664
|
setAvatar: ['function', 'setAvatar'],
|
|
665
|
+
addEventListener: ['function', 'addEventListenerProxy'],
|
|
666
|
+
dispatchEvent: ['function', 'dispatchEvent'],
|
|
667
|
+
removeEventListener: ['function', 'removeEventListenerProxy'],
|
|
664
668
|
});
|
|
665
669
|
}
|
|
666
670
|
return this._proxyobject;
|
|
@@ -702,7 +706,7 @@ document.body.dispatchEvent(click);
|
|
|
702
706
|
avatar_src: 'data:text/plain,' + encodeURIComponent(avatar),
|
|
703
707
|
showlabel: false,
|
|
704
708
|
//pos: V(0, -this.fatness, 0),
|
|
705
|
-
rotation: V(0, 180, 0),
|
|
709
|
+
//rotation: V(0, 180, 0),
|
|
706
710
|
renderorder: 101,
|
|
707
711
|
});
|
|
708
712
|
|
|
@@ -1004,6 +1008,7 @@ document.body.dispatchEvent(click);
|
|
|
1004
1008
|
}
|
|
1005
1009
|
this.handleTouchStart = function(ev) {
|
|
1006
1010
|
//if (!this.enabled) return;
|
|
1011
|
+
if (!room.pointerlock) return;
|
|
1007
1012
|
let halfscreenwidth = window.innerWidth / 2;
|
|
1008
1013
|
this.enabled = true;
|
|
1009
1014
|
for (let i = 0; i < ev.changedTouches.length; i++) {
|
|
@@ -1021,6 +1026,7 @@ document.body.dispatchEvent(click);
|
|
|
1021
1026
|
this.cancelTouchMovement(ev);
|
|
1022
1027
|
}
|
|
1023
1028
|
this.handleTouchMove = function(ev) {
|
|
1029
|
+
if (!room.pointerlock) return;
|
|
1024
1030
|
if (ev.defaultPrevented) return;
|
|
1025
1031
|
//if (ev.touches.length == 1) {
|
|
1026
1032
|
//var touchindex = this.touchindex;
|
|
@@ -1106,7 +1112,34 @@ document.body.dispatchEvent(click);
|
|
|
1106
1112
|
this.dispatchEvent = function(event, target) {
|
|
1107
1113
|
let firedev = elation.events.fire(event);
|
|
1108
1114
|
}
|
|
1109
|
-
this.lookAt = function(other, up) {
|
|
1115
|
+
this.lookAt = function(other, up, turnhead) {
|
|
1116
|
+
if (!up) up = new THREE.Vector3(0,1,0);
|
|
1117
|
+
if (!other) return;
|
|
1118
|
+
var otherpos = false;
|
|
1119
|
+
if (other.properties && other.properties.position) {
|
|
1120
|
+
otherpos = other.localToWorld(new THREE.Vector3());
|
|
1121
|
+
} else if (other instanceof THREE.Object3D) {
|
|
1122
|
+
if (!otherpos) otherpos = new THREE.Vector3();
|
|
1123
|
+
other.getWorldPosition(otherpos);
|
|
1124
|
+
} else if (other instanceof THREE.Vector3) {
|
|
1125
|
+
otherpos = other.clone();
|
|
1126
|
+
}
|
|
1127
|
+
var thispos = this.head.localToWorld(new THREE.Vector3());
|
|
1128
|
+
|
|
1129
|
+
if (otherpos) {
|
|
1130
|
+
var dir = thispos.clone().sub(otherpos).normalize();
|
|
1131
|
+
if (turnhead) {
|
|
1132
|
+
this.head.properties.orientation.setFromEuler(new THREE.Euler(-Math.asin(dir.y), Math.atan2(dir.x, dir.z), 0, 'XYZ'));
|
|
1133
|
+
} else {
|
|
1134
|
+
this.properties.orientation.setFromEuler(new THREE.Euler(0, Math.atan2(dir.x, dir.z), 0));
|
|
1135
|
+
this.head.properties.orientation.setFromEuler(new THREE.Euler(-Math.asin(dir.y), 0, 0));
|
|
1136
|
+
}
|
|
1137
|
+
this.refresh();
|
|
1138
|
+
room.refresh();
|
|
1139
|
+
this.engine.systems.render.setdirty();
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
this.turnTo = function(other, up) {
|
|
1110
1143
|
if (!up) up = new THREE.Vector3(0,1,0);
|
|
1111
1144
|
var otherpos = false;
|
|
1112
1145
|
if (other.properties && other.properties.position) {
|
|
@@ -1119,7 +1152,7 @@ document.body.dispatchEvent(click);
|
|
|
1119
1152
|
if (otherpos) {
|
|
1120
1153
|
var dir = thispos.clone().sub(otherpos).normalize();
|
|
1121
1154
|
this.properties.orientation.setFromEuler(new THREE.Euler(0, Math.atan2(dir.x, dir.z), 0));
|
|
1122
|
-
this.head.properties.orientation.setFromEuler(new THREE.Euler(-Math.asin(dir.y), 0, 0));
|
|
1155
|
+
//this.head.properties.orientation.setFromEuler(new THREE.Euler(-Math.asin(dir.y), 0, 0));
|
|
1123
1156
|
this.refresh();
|
|
1124
1157
|
room.refresh();
|
|
1125
1158
|
this.engine.systems.render.setdirty();
|
|
@@ -1223,19 +1256,76 @@ document.body.dispatchEvent(click);
|
|
|
1223
1256
|
this.camera.orientation.setFromEuler(new THREE.Euler(0, this.cameraangle, 0));
|
|
1224
1257
|
}
|
|
1225
1258
|
}
|
|
1259
|
+
this.hasAnimation = function(anim_id) {
|
|
1260
|
+
return anim_id in this.ghost.body.animations;
|
|
1261
|
+
}
|
|
1262
|
+
this.getAnimation = function(anim_id) {
|
|
1263
|
+
if (this.hasAnimation(anim_id)) {
|
|
1264
|
+
return this.ghost.body.animations[anim_id];
|
|
1265
|
+
}
|
|
1266
|
+
return false;
|
|
1267
|
+
}
|
|
1226
1268
|
this.setAnimationSequence = function(sequence) {
|
|
1227
|
-
let
|
|
1228
|
-
let
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1269
|
+
let cumtime = 0;
|
|
1270
|
+
for (let i = 0; i < sequence.length; i++) {
|
|
1271
|
+
let anim_id = sequence[i];
|
|
1272
|
+
let anim = this.getAnimation(anim_id);
|
|
1273
|
+
anim.loop = (i == sequence.length - 1 ? THREE.LoopRepeat : THREE.LoopOnce);
|
|
1274
|
+
anim.clampWhenFinished = !(i == sequence.length - 1);
|
|
1232
1275
|
if (anim) {
|
|
1233
1276
|
let clip = anim.getClip();
|
|
1234
|
-
setTimeout(() =>
|
|
1235
|
-
|
|
1277
|
+
setTimeout(() => this.defaultanimation = anim_id, cumtime * 1000);
|
|
1278
|
+
cumtime += clip.duration;
|
|
1236
1279
|
}
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1280
|
+
}
|
|
1281
|
+
}
|
|
1282
|
+
this.dispatchEvent = function(event, target) {
|
|
1283
|
+
if (!event.element) event.element = target || this;
|
|
1284
|
+
if (!event.target) {
|
|
1285
|
+
event.target = target || event.element;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
var handlerfn = 'on' + event.type;
|
|
1289
|
+
if (handlerfn in this) {
|
|
1290
|
+
this.executeCallback(this[handlerfn], event);
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
// Bubble event up to parents, unless the event was thrown with bubbling disabled or an event handler called stopPropagation()
|
|
1294
|
+
let firedev = elation.events.fire(event);
|
|
1295
|
+
let returnValue = true;
|
|
1296
|
+
firedev.forEach(e => returnValue &= e.returnValue);
|
|
1297
|
+
if (event.bubbles !== false && returnValue && this.parent && this.parent.dispatchEvent) {
|
|
1298
|
+
event.element = this.parent;
|
|
1299
|
+
this.parent.dispatchEvent(event);
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
this.addEventListenerProxy = function(name, handler, bubble) {
|
|
1303
|
+
var eventobj = {
|
|
1304
|
+
target: handler,
|
|
1305
|
+
fn: function(ev) {
|
|
1306
|
+
var proxyev = elation.events.clone(ev, {
|
|
1307
|
+
target: ev.target.getProxyObject(),
|
|
1308
|
+
});
|
|
1309
|
+
// Bind stopPropagation and preventDefault functions to the real event
|
|
1310
|
+
proxyev.stopPropagation = elation.bind(ev, ev.stopPropagation),
|
|
1311
|
+
proxyev.preventDefault = elation.bind(ev, ev.preventDefault),
|
|
1312
|
+
handler(proxyev);
|
|
1313
|
+
}
|
|
1314
|
+
};
|
|
1315
|
+
if (!this.eventlistenerproxies[name]) this.eventlistenerproxies[name] = [];
|
|
1316
|
+
this.eventlistenerproxies[name].push(eventobj);
|
|
1317
|
+
|
|
1318
|
+
elation.events.add(this, name, eventobj.fn, bubble);
|
|
1319
|
+
}
|
|
1320
|
+
this.removeEventListenerProxy = function(name, handler, bubble) {
|
|
1321
|
+
if (this.eventlistenerproxies[name]) {
|
|
1322
|
+
for (var i = 0; i < this.eventlistenerproxies[name].length; i++) {
|
|
1323
|
+
var evproxy = this.eventlistenerproxies[name][i];
|
|
1324
|
+
if (evproxy.target === handler) {
|
|
1325
|
+
elation.events.remove(this, name, evproxy.fn, bubble);
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1239
1329
|
}
|
|
1240
1330
|
}, elation.engine.things.player);
|
|
1241
1331
|
});
|
package/scripts/janusweb.js
CHANGED
|
@@ -62,6 +62,7 @@ elation.require([
|
|
|
62
62
|
url: { type: 'string', default: false },
|
|
63
63
|
homepage: { type: 'string', default: "" },
|
|
64
64
|
corsproxy: { type: 'string', default: '' },
|
|
65
|
+
showui: { type: 'boolean', default: true },
|
|
65
66
|
shownavigation: { type: 'boolean', default: true },
|
|
66
67
|
showchat: { type: 'boolean', default: true },
|
|
67
68
|
datapath: { type: 'string', default: '/media/janusweb' },
|
|
@@ -177,7 +177,7 @@ console.log('[MultiplayerManager] set active room:', room, this.activeroom);
|
|
|
177
177
|
tmpMat.makeRotationFromQuaternion(player.properties.orientation);
|
|
178
178
|
tmpMat.extractBasis(tmpVecX, tmpVecY, tmpVecZ);
|
|
179
179
|
var ret = {
|
|
180
|
-
dir: (
|
|
180
|
+
dir: (tmpVecZ.x) + ' ' + (tmpVecZ.y) + ' ' + (tmpVecZ.z),
|
|
181
181
|
up_dir: '0 1 0',
|
|
182
182
|
//view_dir: this.tmpVecZ.toArray().join(' ')
|
|
183
183
|
};
|
package/scripts/object.js
CHANGED
|
@@ -1126,10 +1126,9 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
|
|
|
1126
1126
|
if (this.objects['3d']) {
|
|
1127
1127
|
this.traverseObjects(n => {
|
|
1128
1128
|
if (n.material) {
|
|
1129
|
-
n.material.color = this.properties.color;
|
|
1130
|
-
|
|
1131
1129
|
var m = (elation.utils.isArray(n.material) ? n.material : [n.material]);
|
|
1132
1130
|
for (var i = 0; i < m.length; i++) {
|
|
1131
|
+
m[i].color = this.properties.color;
|
|
1133
1132
|
m[i].opacity = this.opacity;
|
|
1134
1133
|
m[i].transparent = (textureasset && textureasset.hasalpha) || m[i].opacity < 1;
|
|
1135
1134
|
if (m[i].transparent) {
|
package/scripts/remoteplayer.js
CHANGED
|
@@ -41,12 +41,14 @@ elation.component.add('engine.things.remoteplayer', function() {
|
|
|
41
41
|
'janus': this.janus,
|
|
42
42
|
'room': this.room
|
|
43
43
|
});
|
|
44
|
+
/*
|
|
44
45
|
this.head = this.spawn('janusbase', this.properties.player_name + '_head', {
|
|
45
46
|
'position': [0,1.4,0],
|
|
46
47
|
'parent': this,
|
|
47
48
|
'janus': this.janus,
|
|
48
49
|
'room': this.room
|
|
49
50
|
});
|
|
51
|
+
*/
|
|
50
52
|
/*
|
|
51
53
|
this.face = this.head.spawn('maskgenerator', this.properties.player_name + '_mask', {
|
|
52
54
|
'seed': this.properties.player_name,
|
package/scripts/sound.js
CHANGED
|
@@ -17,7 +17,8 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
17
17
|
starttime: { type: 'float', default: 0.0, set: this.updateSound },
|
|
18
18
|
distancemodel: { type: 'string', default: 'inverse', set: this.updateSound },
|
|
19
19
|
rolloff: { type: 'float', default: 1.0, set: this.updateSound },
|
|
20
|
-
rect: { type: 'string', set: this.updateSound }
|
|
20
|
+
rect: { type: 'string', set: this.updateSound },
|
|
21
|
+
stream: { type: 'boolean', default: false}
|
|
21
22
|
});
|
|
22
23
|
this.playing = false;
|
|
23
24
|
//Object.defineProperty(this, 'playing', { get: function() { if (this.audio) return this.audio.isPlaying; return false; } });
|
|
@@ -86,22 +87,37 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
86
87
|
this.audio.onEnded = elation.bind(this, this.updatePlaying);
|
|
87
88
|
elation.events.add(this.audio.buffer, 'playing,pause,ended', elation.bind(this, this.updatePlaying));
|
|
88
89
|
if (src) {
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
if (this.stream) {
|
|
91
|
+
let audio = new Audio(src);
|
|
92
|
+
audio.src = src;
|
|
93
|
+
let source = audio.captureStream();
|
|
94
|
+
audio.addEventListener('playing', ev => {
|
|
95
|
+
this.audio.setMediaStreamSource(source);
|
|
96
|
+
console.log('ahh', audio, this.audio);
|
|
97
|
+
this.audio.connect();
|
|
98
|
+
//this.audio.play();
|
|
99
|
+
});
|
|
100
|
+
if (this.auto_play || sound.auto_play) {
|
|
101
|
+
audio.play();
|
|
93
102
|
}
|
|
94
103
|
} else {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (
|
|
98
|
-
|
|
99
|
-
this.audio.setBuffer(buffer);
|
|
100
|
-
if ((this.auto_play || this.singleshot || this.playStarted) && this.room == this.janus.currentroom) {
|
|
101
|
-
this.play();
|
|
102
|
-
}
|
|
104
|
+
if (soundcache[src]) {
|
|
105
|
+
this.audio.setBuffer(soundcache[src]);
|
|
106
|
+
if (this.auto_play || this.singleshot || this.playStarted) {
|
|
107
|
+
this.play();
|
|
103
108
|
}
|
|
104
|
-
}
|
|
109
|
+
} else {
|
|
110
|
+
var loader = new THREE.AudioLoader();
|
|
111
|
+
loader.load(src, elation.bind(this, function(buffer) {
|
|
112
|
+
if (buffer) {
|
|
113
|
+
soundcache[src] = buffer;
|
|
114
|
+
this.audio.setBuffer(buffer);
|
|
115
|
+
if ((this.auto_play || this.singleshot || this.playStarted) && this.room == this.janus.currentroom) {
|
|
116
|
+
this.play();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
105
121
|
}
|
|
106
122
|
} else if (sound && sound.buffer) {
|
|
107
123
|
soundcache[src] = sound.buffer;
|