janusweb 1.5.51 → 1.5.53
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/css/janusweb.css +7 -0
- package/media/assets/webui/apps/avatar/avatar.js +49 -15
- package/media/assets/webui/apps/comms/comms.js +12 -1
- package/media/assets/webui/apps/comms/external/naf-shim.js +7 -2
- package/media/assets/webui/apps/comms/status.html +2 -2
- package/media/assets/webui/apps/comms/voip.css +53 -8
- package/media/assets/webui/apps/comms/voip.js +193 -77
- package/media/assets/webui/apps/editor/editor.css +5 -0
- package/media/assets/webui/apps/editor/editor.js +12 -1
- package/media/assets/webui/apps/locomotion/teleporter.js +4 -3
- package/media/assets/webui/apps/settings/settings.js +1 -1
- package/media/assets/webui/themes/default.css +93 -2
- package/package.json +1 -1
- package/scripts/client.js +42 -19
- package/scripts/elements/linesegments.js +1 -1
- package/scripts/external/JanusClientConnection.js +5 -2
- package/scripts/external/JanusFireboxParser.js +1 -0
- package/scripts/janusbase.js +8 -1
- package/scripts/janusghost.js +11 -9
- package/scripts/januslight.js +4 -1
- package/scripts/janusparticle.js +1 -0
- package/scripts/janusplayer.js +47 -20
- package/scripts/multiplayermanager.js +2 -0
- package/scripts/object.js +2 -2
- package/scripts/parts.js +5 -1
- package/scripts/portal.js +13 -2
- package/scripts/room.js +45 -5
package/scripts/portal.js
CHANGED
|
@@ -38,6 +38,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
38
38
|
this.lastactivatetime = 0;
|
|
39
39
|
}
|
|
40
40
|
this.createObject3D = function() {
|
|
41
|
+
this.created = true;
|
|
41
42
|
this.objects['3d'] = new THREE.Object3D();
|
|
42
43
|
this.updateGeometry();
|
|
43
44
|
return this.objects['3d'];
|
|
@@ -99,13 +100,15 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
this.createMaterial = function() {
|
|
103
|
+
if (this.portalmaterial) return this.portalmaterial;
|
|
102
104
|
var matargs = {
|
|
103
105
|
color: 0xdddddd,
|
|
104
106
|
side: THREE.DoubleSide,
|
|
105
107
|
};
|
|
106
108
|
var mat;
|
|
109
|
+
let shader = false;
|
|
107
110
|
if (this.shader_id) {
|
|
108
|
-
|
|
111
|
+
shader = this.getAsset('shader', this.shader_id);
|
|
109
112
|
//console.log('shader', this.shader_id, shader);
|
|
110
113
|
if (shader) {
|
|
111
114
|
let shadermaterial = shader.getInstance();
|
|
@@ -123,7 +126,12 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
123
126
|
var asset = this.getAsset('image', this.thumb_id);
|
|
124
127
|
if (asset) var thumb = asset.getInstance();
|
|
125
128
|
if (thumb) {
|
|
126
|
-
|
|
129
|
+
thumb.encoding = THREE.sRGBEncoding;
|
|
130
|
+
if (shader) {
|
|
131
|
+
mat.uniforms.iChannel0.value = thumb;
|
|
132
|
+
} else {
|
|
133
|
+
mat.map = thumb;
|
|
134
|
+
}
|
|
127
135
|
if (asset.loaded) {
|
|
128
136
|
if (asset.hasalpha) {
|
|
129
137
|
mat.transparent = true;
|
|
@@ -148,6 +156,8 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
148
156
|
mat.polygonOffsetFactor = -1;
|
|
149
157
|
mat.polygonOffsetUnits = -4;
|
|
150
158
|
|
|
159
|
+
this.portalmaterial = mat;
|
|
160
|
+
|
|
151
161
|
return mat;
|
|
152
162
|
}
|
|
153
163
|
this.adjustAspectRatio = function(image) {
|
|
@@ -504,6 +514,7 @@ elation.require(['janusweb.janusbase'], function() {
|
|
|
504
514
|
this.janus.network.unsubscribe(this.portalroom);
|
|
505
515
|
}
|
|
506
516
|
this.updateGeometry = function() {
|
|
517
|
+
if (!this.created) return;
|
|
507
518
|
var thickness = 0.05 * this.size.z;
|
|
508
519
|
var offset = ((thickness / 2) / this.properties.scale.z) * 2;
|
|
509
520
|
var box;
|
package/scripts/room.js
CHANGED
|
@@ -81,7 +81,7 @@ elation.require([
|
|
|
81
81
|
'server': { type: 'string' },
|
|
82
82
|
'port': { type: 'int' },
|
|
83
83
|
'rate': { type: 'int', default: 200 },
|
|
84
|
-
'voip': { type: 'string', default: '
|
|
84
|
+
'voip': { type: 'string', default: 'janus' },
|
|
85
85
|
'voipid': { type: 'string' },
|
|
86
86
|
'voiprange': { type: 'float', default: 1 },
|
|
87
87
|
'voipserver': { type: 'string', default: 'voip.janusxr.org' },
|
|
@@ -93,7 +93,10 @@ elation.require([
|
|
|
93
93
|
'onload': { type: 'string' },
|
|
94
94
|
'sync': { type: 'boolean', default: false },
|
|
95
95
|
'pointerlock': { type: 'boolean', default: true, set: this.updatePointerLock },
|
|
96
|
-
'players': { type: 'object', get: this.getRoomPlayers }
|
|
96
|
+
'players': { type: 'object', get: this.getRoomPlayers },
|
|
97
|
+
'defaultview': { type: 'string' },
|
|
98
|
+
'showavatar': { type: 'bool', default: true, set: this.updateAvatarVisibility },
|
|
99
|
+
'spawnradius': { type: 'float', default: 0 },
|
|
97
100
|
});
|
|
98
101
|
|
|
99
102
|
if (!roomTranslators) {
|
|
@@ -229,6 +232,11 @@ elation.require([
|
|
|
229
232
|
this.updateToneMapping();
|
|
230
233
|
this.setNearFar();
|
|
231
234
|
this.setPlayerPosition();
|
|
235
|
+
if (typeof player != 'undefined' && this.defaultview && this.defaultview != player.cameraview) {
|
|
236
|
+
player.setCameraView(this.defaultview);
|
|
237
|
+
}
|
|
238
|
+
this.updateAvatarVisibility();
|
|
239
|
+
|
|
232
240
|
elation.events.fire({element: this, type: 'room_active', data: this});
|
|
233
241
|
}
|
|
234
242
|
this.setPlayerPosition = function(pos, orientation) {
|
|
@@ -258,14 +266,22 @@ elation.require([
|
|
|
258
266
|
document.location.hash = hash;
|
|
259
267
|
}
|
|
260
268
|
let spawnpoint = this.getSpawnpoint();
|
|
261
|
-
player
|
|
262
|
-
|
|
269
|
+
if (typeof player != 'undefined') {
|
|
270
|
+
player.startposition.copy(spawnpoint.position);
|
|
271
|
+
player.startorientation.copy(spawnpoint.orientation);
|
|
272
|
+
}
|
|
263
273
|
}
|
|
264
274
|
this.getSpawnpoint = function(referrer) {
|
|
265
275
|
let spawnpoint = {
|
|
266
276
|
position: this.spawnpoint.position,
|
|
267
277
|
orientation: this.spawnpoint.quaternion,
|
|
268
278
|
};
|
|
279
|
+
if (this.spawnradius) {
|
|
280
|
+
let dist = Math.random() * this.spawnradius,
|
|
281
|
+
angle = Math.random() * 2 * Math.PI;
|
|
282
|
+
spawnpoint.position.x += Math.sin(angle) * dist;
|
|
283
|
+
spawnpoint.position.z += Math.cos(angle) * dist;
|
|
284
|
+
}
|
|
269
285
|
if (referrer) {
|
|
270
286
|
let links = this.getObjectsByTagName('link');
|
|
271
287
|
for (let i = 0; i < links.length; i++) {
|
|
@@ -981,6 +997,12 @@ elation.require([
|
|
|
981
997
|
this.flying = elation.utils.any(room.flying, true);
|
|
982
998
|
this.teleport = elation.utils.any(room.teleport, true);
|
|
983
999
|
this.pointerlock = elation.utils.any(room.pointerlock, true);
|
|
1000
|
+
this.defaultview = elation.utils.any(room.defaultview, null);
|
|
1001
|
+
this.showavatar = elation.utils.any(room.showavatar, true);
|
|
1002
|
+
if ('spawnradius' in room) this.spawnradius = room.spawnradius;
|
|
1003
|
+
if (typeof player != 'undefined' && this.defaultview && this.defaultview != player.cameraview) {
|
|
1004
|
+
player.setCameraView(this.defaultview);
|
|
1005
|
+
}
|
|
984
1006
|
//if (room.col) this.properties.col = room.col;
|
|
985
1007
|
|
|
986
1008
|
this.properties.walk_speed = room.walk_speed || 1.8;
|
|
@@ -1374,7 +1396,7 @@ elation.require([
|
|
|
1374
1396
|
if (this.jsobjects[objectargs.js_id]) {
|
|
1375
1397
|
objectargs.js_id = objectargs.js_id + '_' + window.uniqueId();
|
|
1376
1398
|
}
|
|
1377
|
-
var object = parentobj.spawn(realtype, (parentobj.js_id
|
|
1399
|
+
var object = parentobj.spawn(realtype, room.roomid + (parentobj.js_id ? '_' + parentobj.js_id : '') + '_' + objectargs.js_id, objectargs),
|
|
1378
1400
|
proxyobj = object.getProxyObject(customElement);
|
|
1379
1401
|
if (proxyobj && objectargs.js_id && !objectargs.isinternal && (parentobj == this || 'js_id' in args)) {
|
|
1380
1402
|
this.jsobjects[objectargs.js_id] = proxyobj;
|
|
@@ -2131,6 +2153,8 @@ elation.require([
|
|
|
2131
2153
|
voiprange: ['property', 'voiprange'],
|
|
2132
2154
|
voipserver: ['property', 'voipserver'],
|
|
2133
2155
|
players: ['property', 'players'],
|
|
2156
|
+
defaultview: ['property', 'defaultview'],
|
|
2157
|
+
showavatar: ['property', 'showavatar'],
|
|
2134
2158
|
|
|
2135
2159
|
localToWorld: ['function', 'localToWorld'],
|
|
2136
2160
|
worldToLocal: ['function', 'worldToLocal'],
|
|
@@ -2852,6 +2876,9 @@ console.log('dispatch to parent', event, this, event.target);
|
|
|
2852
2876
|
gain.gain.cancelScheduledValues(ctx.currentTime);
|
|
2853
2877
|
gain.gain.linearRampToValueAtTime(gain.gain.value, ctx.currentTime);
|
|
2854
2878
|
gain.gain.linearRampToValueAtTime(value, ctx.currentTime + time);
|
|
2879
|
+
if (gain.gain.value == 0) {
|
|
2880
|
+
gain.gain.value = .01;
|
|
2881
|
+
}
|
|
2855
2882
|
}
|
|
2856
2883
|
}
|
|
2857
2884
|
this.fadeAudioOut = function(time=4, value=0) {
|
|
@@ -3004,6 +3031,19 @@ console.log('unknown material', mat);
|
|
|
3004
3031
|
}
|
|
3005
3032
|
return players;
|
|
3006
3033
|
}
|
|
3034
|
+
this.updateAvatarVisibility = function() {
|
|
3035
|
+
if (typeof player != 'undefined' && player.ghost) {
|
|
3036
|
+
if (this.showavatar) {
|
|
3037
|
+
player.ghost.visible = true;
|
|
3038
|
+
if (player.ghost.body) player.ghost.body.visible = true;
|
|
3039
|
+
if (player.ghost.head) player.ghost.head.visible = true;
|
|
3040
|
+
} else {
|
|
3041
|
+
player.ghost.visible = false;
|
|
3042
|
+
if (player.ghost.body) player.ghost.body.visible = false;
|
|
3043
|
+
if (player.ghost.head) player.ghost.head.visible = false;
|
|
3044
|
+
}
|
|
3045
|
+
}
|
|
3046
|
+
}
|
|
3007
3047
|
}, elation.engine.things.generic);
|
|
3008
3048
|
});
|
|
3009
3049
|
|