janusweb 1.5.49 → 1.5.51
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/comms/comms.js +2 -2
- package/package.json +2 -1
- package/scripts/client.js +6 -6
- package/scripts/janusbase.js +1 -0
- package/scripts/janusghost.js +45 -36
- package/scripts/object.js +2 -2
- package/scripts/room.js +9 -7
- package/utils/clean-build.sh +4 -0
|
@@ -99,7 +99,7 @@ elation.elements.define('janus-comms-userlist', class extends elation.elements.u
|
|
|
99
99
|
this.userlist_friends = this.elements.userlist_friends;
|
|
100
100
|
this.usermarkers = {};
|
|
101
101
|
|
|
102
|
-
elation.events.add(this.janusweb, 'room_load_start', (ev) => { this.updateRoom(ev.data); });
|
|
102
|
+
elation.events.add(this.janusweb, 'room_load_start', (ev) => { this.updateRoom(ev.data || ev.element); });
|
|
103
103
|
elation.events.add(this.janusweb.network, 'janusweb_user_joined,janusweb_user_left,janusweb_user_disconnected', (ev) => this.updateUsers());
|
|
104
104
|
setTimeout(() => {
|
|
105
105
|
//this.updateUsers();
|
|
@@ -209,7 +209,7 @@ 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.
|
|
212
|
+
elation.events.add(this.janusweb, 'room_load_start', (ev) => { this.updateRoom(ev.element); });
|
|
213
213
|
// FIXME - first element with the current design is a <detail> element, but this is fragile if that changes
|
|
214
214
|
this.elements[0].addEventListener('toggle', (ev) => this.elements.chatinput.focus());
|
|
215
215
|
this.updateRoom(room);
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "janusweb",
|
|
3
3
|
"description": "Web client for JanusVR worlds",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.51",
|
|
5
5
|
"main": "scripts/janusweb.js",
|
|
6
6
|
"author": "James Baicoianu",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"postinstall": "./utils/init.sh",
|
|
10
|
+
"clean": "./utils/clean-build.sh",
|
|
10
11
|
"build": "./utils/build.sh",
|
|
11
12
|
"postversion": "git push origin v`npm view janusweb version`",
|
|
12
13
|
"test": "./utils/activate.sh && ./node_modules/.bin/karma start tests/karma.conf.js --single-run",
|
package/scripts/client.js
CHANGED
|
@@ -9,9 +9,9 @@ elation.require(['elements.elements', 'elements', 'engine.engine', 'engine.asset
|
|
|
9
9
|
var rootdir = elation.utils.any(args.rootdir, elation.config.get('dependencies.rootdir'), document.location.pathname);
|
|
10
10
|
var path = elation.utils.any(args.path, elation.config.get('dependencies.path'), '/');
|
|
11
11
|
var homepage = elation.utils.any(args.homepage, elation.config.get('janusweb.homepage'), document.location.href);
|
|
12
|
-
var corsproxy = elation.utils.any(args.corsproxy, elation.config.get('engine.assets.corsproxy'), document.location.href);
|
|
12
|
+
var corsproxy = elation.utils.any(args.corsproxy && args.corsproxy != 'false', elation.config.get('engine.assets.corsproxy'), document.location.href);
|
|
13
13
|
var container = elation.utils.any(args.container, document.body);
|
|
14
|
-
var fullsize = elation.utils.any(args.fullsize, container == document.body);
|
|
14
|
+
var fullsize = elation.utils.any(args.fullsize && args.fullsize != 'false', container == document.body);
|
|
15
15
|
|
|
16
16
|
if (elation.config.get('serviceworker.enabled') && 'serviceWorker' in navigator) {
|
|
17
17
|
var workerscript = elation.config.get('serviceworker.script', 'service-worker.js');
|
|
@@ -65,11 +65,11 @@ 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"),
|
|
69
|
-
shownavigation: (args.shownavigation && args.shownavigation != "false"),
|
|
68
|
+
showui: elation.utils.any(args.showui && args.showui != "false", true),
|
|
69
|
+
shownavigation: elation.utils.any(args.shownavigation && args.shownavigation != "false", true),
|
|
70
70
|
uiconfig: args.uiconfig,
|
|
71
|
-
showchat: elation.utils.any(args.showchat, true),
|
|
72
|
-
usevoip: elation.utils.any(args.usevoip, false),
|
|
71
|
+
showchat: elation.utils.any(args.showchat && args.showchat != 'false', true),
|
|
72
|
+
usevoip: elation.utils.any(args.usevoip && args.usevoip != 'false', false),
|
|
73
73
|
resolution: args.resolution,
|
|
74
74
|
fullsize: fullsize,
|
|
75
75
|
url: args.url,
|
package/scripts/janusbase.js
CHANGED
|
@@ -52,6 +52,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
|
|
|
52
52
|
hasposition: { type: 'boolean', default: true },
|
|
53
53
|
gazetime: { type: 'float' },
|
|
54
54
|
static: { type: 'boolean', default: false },
|
|
55
|
+
isinternal: { type: 'boolean', default: false },
|
|
55
56
|
ongazeenter: { type: 'callback' },
|
|
56
57
|
ongazeleave: { type: 'callback' },
|
|
57
58
|
ongazeprogress: { type: 'callback' },
|
package/scripts/janusghost.js
CHANGED
|
@@ -38,6 +38,9 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
38
38
|
if (dist < maxdist) {
|
|
39
39
|
diffuseColor.a = clamp(((dist - mindist) / (maxdist - mindist)), 0., 1.);
|
|
40
40
|
}
|
|
41
|
+
if (diffuseColor.a <= 1e-4) {
|
|
42
|
+
discard;
|
|
43
|
+
}
|
|
41
44
|
`;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -124,6 +127,7 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
124
127
|
this.shoulders = this.createObject('object', {
|
|
125
128
|
'js_id': this.properties.player_id + '_shoulders',
|
|
126
129
|
'pos': V(0, 1.0, 0),
|
|
130
|
+
'isinternal': true,
|
|
127
131
|
});
|
|
128
132
|
}
|
|
129
133
|
this.setGhostAssets = function(assets) {
|
|
@@ -234,23 +238,13 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
234
238
|
//pos: headpos.clone().negate(),
|
|
235
239
|
//orientation: new THREE.Quaternion().setFromEuler(new THREE.Euler(0, Math.PI, 0)),
|
|
236
240
|
//rotation: V(0, 180, 0),
|
|
237
|
-
lighting: this.lighting,
|
|
238
|
-
//cull_face: 'none'
|
|
239
|
-
opacity: 0.9999,
|
|
240
|
-
renderorder: this.renderorder || 100,
|
|
241
|
-
shader_chunk_replace: (this.lighting ? {
|
|
242
|
-
'color_fragment': 'color_fragment_discard_close',
|
|
243
|
-
} : {}),
|
|
244
241
|
});
|
|
242
|
+
this.applyAvatarMaterial(this.face, 1);
|
|
245
243
|
this.face.start();
|
|
246
244
|
} else {
|
|
247
245
|
this.face = headid;
|
|
248
246
|
this.face.lighting = this.lighting;
|
|
249
|
-
this.face
|
|
250
|
-
this.face.renderorder = this.renderorder || 100;
|
|
251
|
-
this.face.shader_chunk_replace = (this.lighting ? {
|
|
252
|
-
'color_fragment': 'color_fragment_discard_close',
|
|
253
|
-
} : {});
|
|
247
|
+
this.applyAvatarMaterial(this.face, 1);
|
|
254
248
|
this.head.appendChild(headid);
|
|
255
249
|
this.face.start();
|
|
256
250
|
}
|
|
@@ -289,12 +283,9 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
289
283
|
rotation: V(0, 180, 0),
|
|
290
284
|
lighting: this.lighting,
|
|
291
285
|
//cull_face: 'none'
|
|
292
|
-
|
|
293
|
-
renderorder: this.renderorder || 100,
|
|
294
|
-
shader_chunk_replace: (this.lighting ? {
|
|
295
|
-
'color_fragment': 'color_fragment_discard_close',
|
|
296
|
-
} : {}),
|
|
286
|
+
isinternal: true,
|
|
297
287
|
});
|
|
288
|
+
this.applyAvatarMaterial(this.body, 0);
|
|
298
289
|
} else {
|
|
299
290
|
this.body = bodyid;
|
|
300
291
|
this.appendChild(bodyid);
|
|
@@ -302,22 +293,10 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
302
293
|
if (pos) this.body.pos = pos;
|
|
303
294
|
this.body.start();
|
|
304
295
|
if (scale && this.body) this.body.scale.fromArray(scale);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
if (this.
|
|
308
|
-
|
|
309
|
-
this.loadAnimations();
|
|
310
|
-
if (this.animation_extras) {
|
|
311
|
-
this.loadAnimationExtras();
|
|
312
|
-
}
|
|
313
|
-
} else {
|
|
314
|
-
elation.events.add(this.body.modelasset, 'asset_load_complete', () => {
|
|
315
|
-
this.loadAnimations();
|
|
316
|
-
if (this.animation_extras) {
|
|
317
|
-
this.loadAnimationExtras();
|
|
318
|
-
}
|
|
319
|
-
});
|
|
320
|
-
}
|
|
296
|
+
elation.events.add(this.body.modelasset, 'asset_load', ev => {
|
|
297
|
+
this.loadAnimations();
|
|
298
|
+
if (this.animation_extras) {
|
|
299
|
+
this.loadAnimationExtras();
|
|
321
300
|
}
|
|
322
301
|
// FIXME - this prevents avatars from being culled, which prevents our default mesh from disappearing but also means we lose out on possible performance optimizations in rooms with lots of avatars
|
|
323
302
|
this.objects['3d'].traverse(n => {
|
|
@@ -448,7 +427,11 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
448
427
|
} else {
|
|
449
428
|
let armature = sourcecontainer.getObjectByName('Armature') || sourcecontainer;
|
|
450
429
|
newclip.tracks.forEach(track => {
|
|
451
|
-
track.name = track.name.replace('mixamorig', '');
|
|
430
|
+
//track.name = track.name.replace('mixamorig:', '');
|
|
431
|
+
let idx = track.name.indexOf(':');
|
|
432
|
+
if (idx > -1) {
|
|
433
|
+
track.name = track.name.substr(idx + 1);
|
|
434
|
+
}
|
|
452
435
|
let p = track.name.split('.');
|
|
453
436
|
if (p[1] == 'position') {
|
|
454
437
|
for (let i = 0; i < track.values.length / 3; i++) {
|
|
@@ -701,19 +684,36 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
701
684
|
this.setBody(false);
|
|
702
685
|
}
|
|
703
686
|
if (ghostdef._children) {
|
|
687
|
+
let potentialAttachments = [];
|
|
704
688
|
for (var type in ghostdef._children) {
|
|
705
689
|
for (var i = 0; i < ghostdef._children[type].length; i++) {
|
|
706
690
|
let js_id = ghostdef._children[type][i].js_id;
|
|
707
|
-
delete ghostdef._children[type][i].js_id;
|
|
691
|
+
//delete ghostdef._children[type][i].js_id;
|
|
692
|
+
ghostdef._children[type][i].isinternal = true;
|
|
708
693
|
let childobj = this.createObject(type, ghostdef._children[type][i]);
|
|
709
694
|
this.ghostchildren.push(childobj);
|
|
710
695
|
if (js_id == 'head') {
|
|
711
696
|
this.setHead(childobj, headpos, ghostdef.scale);
|
|
712
697
|
} else if (js_id == 'body') {
|
|
713
698
|
this.setBody(childobj, ghostdef.scale, ghostdef.pos);
|
|
699
|
+
} else {
|
|
700
|
+
potentialAttachments.push(childobj);
|
|
701
|
+
this.applyAvatarMaterial(childobj, 2);
|
|
702
|
+
childobj.traverse(obj => {
|
|
703
|
+
this.applyAvatarMaterial(obj, 3);
|
|
704
|
+
});
|
|
714
705
|
}
|
|
715
706
|
}
|
|
716
707
|
}
|
|
708
|
+
this.body.addEventListener('load', ev => {
|
|
709
|
+
for (let i = 0; i < potentialAttachments.length; i++) {
|
|
710
|
+
let obj = potentialAttachments[i];
|
|
711
|
+
if (obj.js_id in this.body.parts) {
|
|
712
|
+
this.body.parts[obj.js_id].add(obj);
|
|
713
|
+
this.applyAvatarMaterial(obj, 3);
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
717
|
}
|
|
718
718
|
}
|
|
719
719
|
}
|
|
@@ -723,7 +723,8 @@ elation.require(['janusweb.janusbase', 'engine.things.leapmotion'], function() {
|
|
|
723
723
|
'position': [0,1.0,0],
|
|
724
724
|
'parent': this,
|
|
725
725
|
'janus': this.janus,
|
|
726
|
-
'room': this.room
|
|
726
|
+
'room': this.room,
|
|
727
|
+
'isinternal': true,
|
|
727
728
|
});
|
|
728
729
|
}
|
|
729
730
|
if (!this.hands) {
|
|
@@ -894,5 +895,13 @@ return;
|
|
|
894
895
|
}
|
|
895
896
|
return this._proxyobject;
|
|
896
897
|
}
|
|
898
|
+
this.applyAvatarMaterial = function(obj, renderorderOffset=0) {
|
|
899
|
+
if (this.lighting && obj.lighting) {
|
|
900
|
+
obj.transparent = true;
|
|
901
|
+
if (obj.opacity == 1) obj.opacity = 0.9999;
|
|
902
|
+
if (!obj.renderorder) obj.renderorder = this.renderorder + renderorderOffset;
|
|
903
|
+
obj.shader_chunk_replace = { 'color_fragment': 'color_fragment_discard_close' };
|
|
904
|
+
}
|
|
905
|
+
}
|
|
897
906
|
}, elation.engine.things.janusbase);
|
|
898
907
|
});
|
package/scripts/object.js
CHANGED
|
@@ -44,7 +44,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
|
|
|
44
44
|
lmap_id: { type: 'string', set: this.updateMaterial, comment: 'Lightmap texture ID' },
|
|
45
45
|
video_id: { type: 'string', set: this.updateVideo, comment: 'Video texture ID' },
|
|
46
46
|
shader_id: { type: 'string', set: this.updateMaterial, comment: 'Shader ID' },
|
|
47
|
-
shader_chunk_replace: { type: 'object' },
|
|
47
|
+
shader_chunk_replace: { type: 'object', set: this.updateMaterial },
|
|
48
48
|
url: { type: 'string', set: this.updateWebsurfaceURL },
|
|
49
49
|
loop: { type: 'boolean' },
|
|
50
50
|
websurface_id: { type: 'string', set: this.updateWebsurface, comment: 'WebSurface ID' },
|
|
@@ -109,7 +109,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
|
|
|
109
109
|
object = this.object;
|
|
110
110
|
setTimeout(() => { this.handleLoad(); this.assignTextures(); }, 100);
|
|
111
111
|
} else if (this.janusid) {
|
|
112
|
-
var asset = this.getAsset('model', this.janusid, true);
|
|
112
|
+
var asset = this.modelasset = this.getAsset('model', this.janusid, true);
|
|
113
113
|
this.dispatchEvent({type: 'loadstart'});
|
|
114
114
|
if (asset) {
|
|
115
115
|
if (asset.loaded) {
|
package/scripts/room.js
CHANGED
|
@@ -840,7 +840,7 @@ elation.require([
|
|
|
840
840
|
}
|
|
841
841
|
this.createLights();
|
|
842
842
|
}
|
|
843
|
-
this.createRoomObjects = function(roomdata, parent) {
|
|
843
|
+
this.createRoomObjects = function(roomdata, parent, isinternal) {
|
|
844
844
|
var room = roomdata.room,
|
|
845
845
|
assets = roomdata.assets || [];
|
|
846
846
|
|
|
@@ -853,6 +853,7 @@ elation.require([
|
|
|
853
853
|
if (exclude.indexOf(k) == -1) {
|
|
854
854
|
roomdata[k].forEach(elation.bind(this, function(n) {
|
|
855
855
|
n.persist = true;
|
|
856
|
+
n.isinternal = isinternal;
|
|
856
857
|
this.createObject(k, n, parent);
|
|
857
858
|
}));
|
|
858
859
|
}
|
|
@@ -1373,16 +1374,17 @@ elation.require([
|
|
|
1373
1374
|
if (this.jsobjects[objectargs.js_id]) {
|
|
1374
1375
|
objectargs.js_id = objectargs.js_id + '_' + window.uniqueId();
|
|
1375
1376
|
}
|
|
1376
|
-
var object = parentobj.spawn(realtype,
|
|
1377
|
-
|
|
1378
|
-
|
|
1377
|
+
var object = parentobj.spawn(realtype, (parentobj.js_id || room.roomid) + '_' + objectargs.js_id, objectargs),
|
|
1378
|
+
proxyobj = object.getProxyObject(customElement);
|
|
1379
|
+
if (proxyobj && objectargs.js_id && !objectargs.isinternal && (parentobj == this || 'js_id' in args)) {
|
|
1380
|
+
this.jsobjects[objectargs.js_id] = proxyobj;
|
|
1379
1381
|
}
|
|
1380
1382
|
|
|
1381
1383
|
if (realtype == 'janussound') {
|
|
1382
1384
|
this.sounds[objectargs.sound_id] = object;
|
|
1383
1385
|
this.sounds[objectargs.js_id] = object;
|
|
1384
1386
|
|
|
1385
|
-
|
|
1387
|
+
proxyobj.addEventListener('sound_delayed', (ev) => this.handleDelayedSound(ev));
|
|
1386
1388
|
}
|
|
1387
1389
|
if (realtype == 'janusvideo') {
|
|
1388
1390
|
this.videos[objectargs.video_id] = object;
|
|
@@ -1408,14 +1410,14 @@ elation.require([
|
|
|
1408
1410
|
}
|
|
1409
1411
|
children[k] = objs;
|
|
1410
1412
|
}
|
|
1411
|
-
this.createRoomObjects(children,
|
|
1413
|
+
this.createRoomObjects(children, proxyobj, objectargs.isinternal);
|
|
1412
1414
|
}
|
|
1413
1415
|
|
|
1414
1416
|
if (this.enabled && !skipstart) {
|
|
1415
1417
|
object.start();
|
|
1416
1418
|
}
|
|
1417
1419
|
|
|
1418
|
-
return
|
|
1420
|
+
return proxyobj;
|
|
1419
1421
|
}
|
|
1420
1422
|
this.appendChild = function(obj) {
|
|
1421
1423
|
var proxyobj = obj
|