janusweb 1.5.32 → 1.5.36

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.
Files changed (56) hide show
  1. package/CHANGELOG +39 -0
  2. package/media/assets/webui/apps/avatar/avatar.js +2 -1
  3. package/media/assets/webui/apps/buttons/buttons.html +2 -2
  4. package/media/assets/webui/apps/buttons/buttons.js +2 -2
  5. package/media/assets/webui/apps/comms/voip.js +2 -4
  6. package/media/assets/webui/apps/editor/codemirror/addon/hint/javascript-hint.js +162 -0
  7. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.css +36 -0
  8. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.js +529 -0
  9. package/media/assets/webui/apps/editor/codemirror/addon/hint/xml-hint.js +140 -0
  10. package/media/assets/webui/apps/editor/codemirror/keymap/vim.js +5734 -0
  11. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.css +350 -0
  12. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.js +9800 -0
  13. package/media/assets/webui/apps/editor/codemirror/lib/jmldark.css +33 -0
  14. package/media/assets/webui/apps/editor/codemirror/mode/css/css.js +864 -0
  15. package/media/assets/webui/apps/editor/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
  16. package/media/assets/webui/apps/editor/codemirror/mode/javascript/javascript.js +942 -0
  17. package/media/assets/webui/apps/editor/codemirror/mode/xml/xml.js +413 -0
  18. package/media/assets/webui/apps/editor/editor.css +3 -0
  19. package/media/assets/webui/apps/editor/editor.js +407 -9
  20. package/media/assets/webui/apps/editor/editor.json +6 -3
  21. package/media/assets/webui/apps/inventory/inventory.js +2 -2
  22. package/media/assets/webui/apps/locomotion/teleporter.js +8 -7
  23. package/media/assets/webui/apps/navigation/navigation.js +12 -12
  24. package/media/assets/webui/apps/vfs/browserfs/browserfs.js +8 -0
  25. package/media/assets/webui/apps/vfs/vfs.css +52 -0
  26. package/media/assets/webui/apps/vfs/vfs.js +452 -0
  27. package/media/assets/webui/apps/vfs/vfs.json +10 -0
  28. package/media/assets/webui/default.json +2 -1
  29. package/media/assets/webui/themes/default.css +29 -2
  30. package/media/lib/physx/physx.release.js +21 -0
  31. package/media/lib/physx/physx.release.wasm +0 -0
  32. package/media/manifest.json +5 -5
  33. package/media/service-worker.js +7 -0
  34. package/package.json +2 -9
  35. package/scripts/client.js +65 -45
  36. package/scripts/config.js +2 -0
  37. package/scripts/elements/linesegments.js +5 -2
  38. package/scripts/image.js +7 -1
  39. package/scripts/janusbase.js +28 -11
  40. package/scripts/janusghost.js +4 -3
  41. package/scripts/janusparagraph.js +5 -3
  42. package/scripts/janusparticle.js +25 -14
  43. package/scripts/janusplayer.js +25 -10
  44. package/scripts/janusweb.js +22 -3
  45. package/scripts/janusxrplayer.js +4 -1
  46. package/scripts/multiplayermanager.js +3 -3
  47. package/scripts/object.js +172 -82
  48. package/scripts/portal.js +12 -10
  49. package/scripts/room.js +113 -54
  50. package/scripts/sound.js +0 -1
  51. package/scripts/text.js +10 -2
  52. package/scripts/translators/janusvfs.js +20 -0
  53. package/scripts/video.js +1 -1
  54. package/scripts/websurface.js +11 -2
  55. package/utils/build.sh +3 -0
  56. package/utils/init.sh +1 -1
package/scripts/room.js CHANGED
@@ -3,7 +3,7 @@ elation.require([
3
3
  'engine.things.generic', 'engine.things.label', 'engine.things.skybox',
4
4
  'janusweb.object', 'janusweb.portal', 'janusweb.image', 'janusweb.video', 'janusweb.text', 'janusweb.janusparagraph',
5
5
  'janusweb.sound', 'janusweb.januslight', 'janusweb.janusparticle', 'janusweb.janusghost',
6
- 'janusweb.translators.bookmarks', 'janusweb.translators.reddit', 'janusweb.translators.error', 'janusweb.translators.blank', 'janusweb.translators.default', 'janusweb.translators.dat'
6
+ 'janusweb.translators.bookmarks', 'janusweb.translators.reddit', 'janusweb.translators.error', 'janusweb.translators.blank', 'janusweb.translators.default', 'janusweb.translators.dat', 'janusweb.translators.janusvfs'
7
7
  ], function() {
8
8
  elation.component.add('engine.things.janusroom', function() {
9
9
  this.postinit = function() {
@@ -27,13 +27,13 @@ elation.require([
27
27
  'baseurl': { type: 'string', default: false },
28
28
  'source': { type: 'string' },
29
29
  'skybox': { type: 'boolean', default: true, set: this.toggleSkybox },
30
- 'skybox_equi': { type: 'string' },
31
- 'skybox_left': { type: 'string' },
32
- 'skybox_right': { type: 'string' },
33
- 'skybox_up': { type: 'string' },
34
- 'skybox_down': { type: 'string' },
35
- 'skybox_front': { type: 'string' },
36
- 'skybox_back': { type: 'string' },
30
+ 'skybox_equi': { type: 'string', set: this.setSkybox },
31
+ 'skybox_left_id': { type: 'string', set: this.setSkybox },
32
+ 'skybox_right_id': { type: 'string', set: this.setSkybox },
33
+ 'skybox_up_id': { type: 'string', set: this.setSkybox },
34
+ 'skybox_down_id': { type: 'string', set: this.setSkybox },
35
+ 'skybox_front_id': { type: 'string', set: this.setSkybox },
36
+ 'skybox_back_id': { type: 'string', set: this.setSkybox },
37
37
  'cubemap_irradiance_id': { type: 'string' },
38
38
  'cubemap_radiance_id': { type: 'string' },
39
39
  'fog': { type: 'boolean', default: false, set: this.setFog },
@@ -76,12 +76,13 @@ elation.require([
76
76
  'className': { type: 'string', default: '', set: this.setClassName },
77
77
  'gazetime': { type: 'float', default: 1000 },
78
78
  'selfavatar': { type: 'boolean', default: false },
79
- 'requirescripts': { type: 'string' },
79
+ 'requires': { type: 'string' },
80
80
  'onload': { type: 'string' },
81
81
  'sync': { type: 'boolean', default: false },
82
82
  'pointerlock': { type: 'boolean', default: true },
83
83
  });
84
84
  this.translators = {
85
+ '^janus-vfs:': elation.janusweb.translators.janusvfs({janus: this.janus}),
85
86
  '^about:blank$': elation.janusweb.translators.blank({janus: this.janus}),
86
87
  '^bookmarks$': elation.janusweb.translators.bookmarks({janus: this.janus}),
87
88
  '^dat:': elation.janusweb.translators.dat({janus: this.janus}),
@@ -296,31 +297,32 @@ elation.require([
296
297
  }
297
298
  if (this.skyboxtexture) {
298
299
  this.skyboxobj.setTexture(this.skyboxtexture);
299
- return;
300
+ //return;
300
301
  }
301
302
 
302
- var hasSkybox = (this.skybox_left || this.skybox_right || this.skybox_top || this.skybox_bottom || this.skybox_left || this.skybox_right) != undefined;
303
+ var hasSkybox = (this.skybox_left_id || this.skybox_right_id || this.skybox_top_id || this.skybox_bottom_id || this.skybox_left_id || this.skybox_right_id) != undefined;
304
+ var assets = [];
303
305
  if (this.skybox_equi) {
304
306
  let equi = this.getAsset('image', this.skybox_equi);
305
- var assets = [];
306
307
  elation.events.add(equi, 'asset_load', ev => {
307
308
  this.skyboxtexture = ev.target._texture;
308
309
  if (this.janus.currentroom === this) {
309
310
  this.skyboxobj.setTexture(this.skyboxtexture);
310
311
  }
311
312
  });
313
+ equi.getInstance();
312
314
  } else if (hasSkybox) {
313
- var assets = [
314
- this.getAsset('image', this.skybox_right || 'black'),
315
- this.getAsset('image', this.skybox_left || 'black'),
316
- this.getAsset('image', this.skybox_up || 'black'),
317
- this.getAsset('image', this.skybox_down || 'black'),
318
- this.getAsset('image', this.skybox_front || 'black'),
319
- this.getAsset('image', this.skybox_back || 'black')
315
+ assets = [
316
+ this.getAsset('image', this.skybox_right_id || 'black'),
317
+ this.getAsset('image', this.skybox_left_id || 'black'),
318
+ this.getAsset('image', this.skybox_up_id || 'black'),
319
+ this.getAsset('image', this.skybox_down_id || 'black'),
320
+ this.getAsset('image', this.skybox_front_id || 'black'),
321
+ this.getAsset('image', this.skybox_back_id || 'black')
320
322
  ];
321
323
  } else {
322
324
  var skyboxname = 'dayskybox';
323
- var assets = [
325
+ assets = [
324
326
  this.getAsset('image', skyboxname + '_right'),
325
327
  this.getAsset('image', skyboxname + '_left'),
326
328
  this.getAsset('image', skyboxname + '_up'),
@@ -412,6 +414,7 @@ elation.require([
412
414
  if (this.janus.currentroom === this) {
413
415
  this.skyboxobj.setTexture(this.skyboxtexture);
414
416
  }
417
+ elation.events.fire({element: this, type: 'skybox_update'});
415
418
  return true;
416
419
  }
417
420
  }
@@ -704,11 +707,12 @@ elation.require([
704
707
  this.fullsource = data;
705
708
  var titlere = /<title>([\s\S]*?)<\/title>/mi;
706
709
  var re = /<fireboxroom>[\s\S]*?<\/fireboxroom>/mi;
710
+ var re2 = /<janus-viewer[^>]*>[\s\S]*?<\/janus-viewer>/mi;
707
711
  var mtitle = data.match(titlere);
708
712
  var parsed = {
709
713
  title: 'Untitled Room',
710
714
  source: false
711
- }
715
+ };
712
716
  if (mtitle) {
713
717
  parsed.title = mtitle[1];
714
718
  this.setTitle(mtitle[1]);
@@ -718,15 +722,56 @@ elation.require([
718
722
  var m = data.match(re);
719
723
  if (m) {
720
724
  parsed.source = m[0];
725
+ } else {
726
+ let m2 = data.match(re2);
727
+ if (m2) {
728
+ parsed.source = m2[0].replaceAll('janus-viewer', 'fireboxroom');
729
+ }
721
730
  }
722
731
  return parsed;
723
732
  }
733
+ this.updateSource = function(source) {
734
+ var datapath = elation.config.get('janusweb.datapath', '/media/janusweb');
735
+ try {
736
+ var roomdata = this.janus.parser.parse(source, this.baseurl, datapath);
737
+ } catch (e) {
738
+ }
739
+ console.log('updated roomdata!', roomdata);
740
+ if (roomdata && roomdata.room) {
741
+ for (let k in roomdata.room) {
742
+ let val = roomdata.room[k];
743
+ if (val !== null && room[k] != val) {
744
+ console.log('update room value', k, room[k], val);
745
+ room[k] = val;
746
+ }
747
+ }
748
+ if (roomdata.object) {
749
+ for (let i = 0; i < roomdata.object.length; i++) {
750
+ let objdata = roomdata.object[i];
751
+ let roomobj = room.objects[objdata.js_id];
752
+ if (roomobj) {
753
+ for (let k in objdata) {
754
+ let val = objdata[k];
755
+ if (roomobj[k] != objdata[k] && val !== null) {
756
+ roomobj[k] = val;
757
+ }
758
+ }
759
+ } else {
760
+ objdata.persist = true;
761
+ this.createObject('object', objdata);
762
+ }
763
+ }
764
+ }
765
+ }
766
+ }
724
767
 
725
768
  this.loadRoomAssets = function(roomdata) {
726
769
  if (roomdata && roomdata.assets && roomdata.assets.assetlist && roomdata.assets.assetlist.length > 0) {
727
770
  var assetlist = roomdata.assets.assetlist;
728
771
  if (roomdata.assets.websurfaces) {
729
772
  elation.utils.merge(roomdata.assets.websurfaces, this.websurfaces);
773
+ if (!this.roomassets.websurface) this.roomassets.websurface = {};
774
+ elation.utils.merge(roomdata.assets.websurfaces, this.roomassets.websurface);
730
775
  }
731
776
 
732
777
  if (roomdata.assets.ghosts) {
@@ -859,12 +904,12 @@ elation.require([
859
904
 
860
905
  if (typeof room.skybox != 'undefined') this.properties.skybox = room.skybox;
861
906
  if (room.skybox_equi) this.properties.skybox_equi = room.skybox_equi;
862
- if (room.skybox_left_id) this.properties.skybox_left = room.skybox_left_id;
863
- if (room.skybox_right_id) this.properties.skybox_right = room.skybox_right_id;
864
- if (room.skybox_up_id) this.properties.skybox_up = room.skybox_up_id;
865
- if (room.skybox_down_id) this.properties.skybox_down = room.skybox_down_id;
866
- if (room.skybox_front_id) this.properties.skybox_front = room.skybox_front_id;
867
- if (room.skybox_back_id) this.properties.skybox_back = room.skybox_back_id;
907
+ if (room.skybox_left_id) this.properties.skybox_left_id = room.skybox_left_id;
908
+ if (room.skybox_right_id) this.properties.skybox_right_id = room.skybox_right_id;
909
+ if (room.skybox_up_id) this.properties.skybox_up_id = room.skybox_up_id;
910
+ if (room.skybox_down_id) this.properties.skybox_down_id = room.skybox_down_id;
911
+ if (room.skybox_front_id) this.properties.skybox_front_id = room.skybox_front_id;
912
+ if (room.skybox_back_id) this.properties.skybox_back_id = room.skybox_back_id;
868
913
 
869
914
  if (room.cubemap_radiance_id) this.properties.cubemap_radiance_id = room.cubemap_radiance_id;
870
915
  if (room.cubemap_irradiance_id) this.properties.cubemap_irradiance_id = room.cubemap_irradiance_id;
@@ -926,10 +971,12 @@ elation.require([
926
971
  this.pendingScriptMap = {};
927
972
  this.loadScripts(assets.scripts);
928
973
  }
929
- if (room.require) {
974
+
975
+ let requires = room.requires || room.require;
976
+ if (requires) {
930
977
  let roomproxy = this.getProxyObject();
931
- roomproxy.require(room.require);
932
- this.requirescripts = room.require;
978
+ roomproxy.require(requires);
979
+ this.requires = requires;
933
980
  }
934
981
  }
935
982
  this.applyingEdits = false;
@@ -958,6 +1005,10 @@ elation.require([
958
1005
  if (!this.pendingScriptMap[s.src]) {
959
1006
  this.pendingScripts++;
960
1007
  this.pendingScriptMap[s.src] = true;;
1008
+ elation.events.add(scriptasset, 'asset_error', (ev) => {
1009
+ console.error('Failed to load Janus room script', scriptasset);
1010
+ this.doScriptOnload();
1011
+ });
961
1012
  elation.events.add(script, 'asset_load', () => {
962
1013
  script.onload = () => this.doScriptOnload();
963
1014
  document.head.appendChild(script);
@@ -993,9 +1044,9 @@ elation.require([
993
1044
  elation.events.add(window, 'click', this.onClick);
994
1045
  elation.events.add(window, 'keydown', this.onKeyDown);
995
1046
  elation.events.add(window, 'keyup', this.onKeyUp);
996
- elation.events.add(this.engine.client.container, 'mousedown,touchstart', this.onMouseDown);
997
- elation.events.add(this.engine.client.container, 'mouseup,touchend', this.onMouseUp);
998
- elation.events.add(this.engine.client.container, 'mousemove', this.onMouseMove);
1047
+ //elation.events.add(this, 'mousedown,touchstart', this.onMouseDown);
1048
+ //elation.events.add(this, 'mouseup,touchend', this.onMouseUp);
1049
+ //elation.events.add(this, 'mousemove', this.onMouseMove);
999
1050
  elation.events.add(this, 'click', this.onObjectClick);
1000
1051
  /*
1001
1052
  elation.events.add(this, 'dragenter', this.handleDragOver);
@@ -1274,7 +1325,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1274
1325
  objectargs.ghost_id = args.id;
1275
1326
  //objectargs.ghost_scale = args.scale;
1276
1327
  //objectargs.scale = new THREE.Vector3(1,1,1);
1277
- objectargs.orientation = new THREE.Quaternion()
1328
+ objectargs.orientation = new THREE.Quaternion();
1278
1329
  break;
1279
1330
  }
1280
1331
  //console.log('spawn it', realtype, args, objectargs);
@@ -1393,6 +1444,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1393
1444
  hasalpha: args.hasalpha,
1394
1445
  maxsize: args.maxsize,
1395
1446
  preload: args.preload,
1447
+ proxy: args.proxy,
1396
1448
  baseurl: this.baseurl
1397
1449
  };
1398
1450
  assetlist.push(assetargs);
@@ -1433,6 +1485,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1433
1485
  format: args.format,
1434
1486
  hls: args.hls,
1435
1487
  preload: args.preload,
1488
+ proxy: args.proxy,
1436
1489
  baseurl: this.baseurl
1437
1490
  });
1438
1491
  } else if (args.video) {
@@ -1461,11 +1514,14 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1461
1514
  src: src,
1462
1515
  buffer: args.buffer,
1463
1516
  rate: args.rate,
1517
+ proxy: args.proxy,
1464
1518
  baseurl: this.baseurl
1465
1519
  });
1466
1520
  } else if (type == 'websurface') {
1467
1521
  if (args.id) {
1468
1522
  this.websurfaces[args.id] = args;
1523
+ if (!this.roomassets.websurface) this.roomassets.websurface = {};
1524
+ this.roomassets.websurface[args.id] = args;
1469
1525
  }
1470
1526
  } else if (type == 'script') {
1471
1527
  var src = (args.src.match(/^file:/) ? args.src.replace(/^file:/, datapath) : args.src);
@@ -1510,7 +1566,8 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1510
1566
  tex0: args.tex || args.tex0 || srcparts[1],
1511
1567
  tex1: args.tex1 || srcparts[2],
1512
1568
  tex2: args.tex2 || srcparts[3],
1513
- tex3: args.tex3 || srcparts[4]
1569
+ tex3: args.tex3 || srcparts[4],
1570
+ proxy: args.proxy,
1514
1571
  });
1515
1572
  } else if (type == 'ghost') {
1516
1573
  var src = (args.src.match(/^file:/) ? args.src.replace(/^file:/, datapath) : args.src);
@@ -1766,17 +1823,17 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1766
1823
  if (this.applyingEdits) return;
1767
1824
 
1768
1825
  let thing = ev.target,
1769
- js_id = thing.js_id;
1826
+ js_id = thing.properties.js_id;
1770
1827
 
1771
1828
  if (!js_id) return;
1772
1829
 
1773
1830
  let proxy = this.jsobjects[js_id];
1774
1831
  if (proxy) {
1775
- if (proxy.sync) {
1832
+ if (thing.properties.sync) {
1776
1833
  if (!this.appliedchanges[js_id]) {
1777
1834
  this.changes[js_id] = proxy;
1778
1835
  }
1779
- proxy.sync = proxy.autosync;
1836
+ thing.properties.sync = proxy.autosync;
1780
1837
  }
1781
1838
  }
1782
1839
  }
@@ -1993,7 +2050,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
1993
2050
  locked: ['property', 'locked'],
1994
2051
  private: ['property', 'private'],
1995
2052
  selfavatar: ['property', 'selfavatar'],
1996
- requirescripts:['property', 'requirescripts'],
2053
+ requires: ['property', 'requires'],
1997
2054
  pos: ['property', 'spawnpoint.position'],
1998
2055
  sync: ['property', 'sync'],
1999
2056
  js_id: ['property', 'roomid'],
@@ -2001,12 +2058,12 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
2001
2058
 
2002
2059
  skybox: ['property', 'skybox'],
2003
2060
  skybox_equi: ['property', 'skybox_equi'],
2004
- skybox_left_id: ['property', 'skybox_left'],
2005
- skybox_right_id:['property', 'skybox_right'],
2006
- skybox_up_id: ['property', 'skybox_up'],
2007
- skybox_down_id: ['property', 'skybox_down'],
2008
- skybox_front_id:['property', 'skybox_front'],
2009
- skybox_back_id: ['property', 'skybox_back'],
2061
+ skybox_left_id: ['property', 'skybox_left_id'],
2062
+ skybox_right_id:['property', 'skybox_right_id'],
2063
+ skybox_up_id: ['property', 'skybox_up_id'],
2064
+ skybox_down_id: ['property', 'skybox_down_id'],
2065
+ skybox_front_id:['property', 'skybox_front_id'],
2066
+ skybox_back_id: ['property', 'skybox_back_id'],
2010
2067
 
2011
2068
  pendingScripts: ['property', 'pendingScripts'],
2012
2069
  pendingCustomElements: ['property', 'pendingCustomElements'],
@@ -2060,10 +2117,10 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
2060
2117
  onColliderEnter: ['callback', 'janus_room_collider_enter'],
2061
2118
  onColliderExit: ['callback', 'janus_room_collider_exit'],
2062
2119
  onClick: ['callback', 'click,touchstart', 'engine.client.container'],
2063
- onMouseDown: ['callback', 'janus_room_mousedown'],
2064
- onMouseUp: ['callback', 'janus_room_mouseup'],
2065
- onMouseMove: ['callback', 'janus_room_mousemove'],
2066
- onMouseDrag: ['callback', 'janus_room_mousedrag'],
2120
+ onMouseDown: ['callback', 'mousedown'],
2121
+ onMouseUp: ['callback', 'mouseup'],
2122
+ onMouseMove: ['callback', 'mousemove'],
2123
+ onMouseDrag: ['callback', 'mousedrag'],
2067
2124
  onKeyDown: ['callback', 'janus_room_keydown'],
2068
2125
  onKeyUp: ['callback', 'janus_room_keyup']
2069
2126
  });
@@ -2097,7 +2154,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
2097
2154
  var real = this.getObjectFromProxy(change);
2098
2155
  if (real) {
2099
2156
  var xmltype = typemap[real.type] || 'Object';
2100
- xmlnode = xmldoc.createElement(xmltype);
2157
+ let xmlnode = xmldoc.createElement(xmltype);
2101
2158
 
2102
2159
  var attrs = Object.keys(change);
2103
2160
  for (var i = 0; i < attrs.length; i++) {
@@ -2292,7 +2349,9 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
2292
2349
  var asset = this.roomassets[type][assetname];
2293
2350
 
2294
2351
  let defaultasset = (janus.assetpack.assetmap[type] ? janus.assetpack.assetmap[type][assetname] : undefined);
2295
- if (assetname != asset.src && asset !== defaultasset) {
2352
+ if (type == 'script') {
2353
+ assetsrc += ' <assetscript src="' + asset.src + '" />\n';
2354
+ } else if (assetname != asset.src && asset !== defaultasset) {
2296
2355
  assetsrc += ' <asset' + (assettypemap[type] || type) + ' id="' + assetname + '" src="' + asset.src + '" />\n';
2297
2356
  }
2298
2357
  }
@@ -2309,7 +2368,7 @@ console.log('connect room audio to graph', this.audionodes.gain, this.audionodes
2309
2368
  val = elation.utils.arrayget(this.properties, def[1]);
2310
2369
 
2311
2370
  if (k == 'url' || !propdef) continue;
2312
- if (k == 'requirescripts') k = 'require';
2371
+ if (k == 'requires') k = 'require';
2313
2372
 
2314
2373
  let defaultval = propdef.default;
2315
2374
  if (val instanceof THREE.Vector2) {
@@ -2594,7 +2653,7 @@ console.log('dispatch to parent', event, this, event.target);
2594
2653
  if (!url) url = this.url;
2595
2654
  if (url[0] == '/') {
2596
2655
  url = this.baseurl.replace(/^(https?:\/\/[^\/]+)\/.*$/, '$1') + url;
2597
- } else if (!url.match(/https?:\/\//i)) {
2656
+ } else if (!url.match(/:\/\//i)) {
2598
2657
  url = this.baseurl + url;
2599
2658
  }
2600
2659
  return url;
@@ -2675,7 +2734,7 @@ console.log('dispatch to parent', event, this, event.target);
2675
2734
  this.fadeAudioOut = function(time=4, value=0) {
2676
2735
  if (this.audionodes) {
2677
2736
  let gain = this.audionodes.gain,
2678
- ctx = this.audionodes.listener.context;
2737
+ ctx = this.audionodes.listener.context,
2679
2738
  currentgain = gain.gain.value;
2680
2739
 
2681
2740
  gain.gain.cancelScheduledValues(ctx.currentTime);
package/scripts/sound.js CHANGED
@@ -223,7 +223,6 @@ elation.require(['janusweb.janusbase'], function() {
223
223
  playing: [ 'property', 'playing', 'sound.isPlaying'],
224
224
  pitch: [ 'property', 'pitch'],
225
225
  auto_play: [ 'property', 'auto_play'],
226
- playing: [ 'property', 'playing'],
227
226
  play: [ 'function', 'play'],
228
227
  pause: [ 'function', 'pause'],
229
228
  stop: [ 'function', 'stop'],
package/scripts/text.js CHANGED
@@ -26,6 +26,7 @@ elation.require(['engine.things.label'], function() {
26
26
  'roughness': { type: 'float', default: null, min: 0, max: 1, set: this.updateMaterial, comment: 'Material roughness value' },
27
27
  'metalness': { type: 'float', default: null, set: this.updateMaterial, comment: 'Material metalness value' },
28
28
  'envmap_id': { type: 'string', set: this.updateMaterial, comment: 'Environment map texture ID (overrides skybox reflections)' },
29
+ 'wireframe': { type: 'boolean', default: false, set: this.updateMaterial, comment: 'Wireframe rendering' },
29
30
  });
30
31
  this.emptygeometry = new THREE.BufferGeometry();
31
32
  elation.events.add(this.engine, 'engine_frame', elation.bind(this, this.handleFrameUpdates));
@@ -91,7 +92,8 @@ elation.require(['engine.things.label'], function() {
91
92
  emissive: this.properties.emissive,
92
93
  flatShading: false,
93
94
  depthTest: this.properties.depthTest,
94
- reflectivity: .5
95
+ reflectivity: .5,
96
+ wireframe: this.wireframe,
95
97
  };
96
98
  if (this.room.pbr) {
97
99
  matargs.roughness = this.roughness;
@@ -219,7 +221,6 @@ elation.require(['engine.things.label'], function() {
219
221
  text: [ 'property', 'text'],
220
222
  col: [ 'property', 'color'],
221
223
  emissive: [ 'property', 'emissive'],
222
- font: [ 'property', 'font'],
223
224
  bevel: [ 'property', 'bevel'],
224
225
  bevel_thickness: [ 'property', 'bevel_thickness'],
225
226
  bevel_size: [ 'property', 'bevel_size'],
@@ -228,6 +229,13 @@ elation.require(['engine.things.label'], function() {
228
229
  roughness: [ 'property', 'roughness'],
229
230
  metalness: [ 'property', 'metalness'],
230
231
  envmap_id: [ 'property', 'envmap_id'],
232
+ font: [ 'property', 'font'],
233
+ font_size: [ 'property', 'font_size'],
234
+ font_scale: [ 'property', 'font_scale'],
235
+ align: [ 'property', 'align'],
236
+ verticalalign: [ 'property', 'verticalalign'],
237
+ zalign: [ 'property', 'zalign'],
238
+ wireframe: [ 'property', 'wireframe'],
231
239
  };
232
240
  }
233
241
  return this._proxyobject;
@@ -0,0 +1,20 @@
1
+ elation.require([], function() {
2
+ elation.component.add('janusweb.translators.janusvfs', function() {
3
+ this.exec = function(args) {
4
+ return new Promise(async function(resolve, reject) {
5
+ setTimeout(async () => {
6
+ elation.engine.assetdownloader.fetchURL(args.url).then((ev) => {
7
+ let decoder = new TextDecoder('utf-8');
8
+ let src = decoder.decode(ev.target.data);
9
+ elation.events.fire({element: room._target, type: 'room_load_processing'});
10
+ room.loadFromSource(src);
11
+ resolve({room: { }, source: src});
12
+ }).catch((err) => {
13
+ console.log('oh no', err);
14
+ reject();
15
+ });
16
+ }, 1000);
17
+ });
18
+ }
19
+ });
20
+ });
package/scripts/video.js CHANGED
@@ -32,7 +32,7 @@ elation.require(['janusweb.janusbase'], function() {
32
32
  if (camera.name) {
33
33
  texture.setEye(camera.name);
34
34
  }
35
- }
35
+ };
36
36
  }
37
37
  return mesh;
38
38
  } else {
@@ -5,6 +5,7 @@ elation.require(['engine.things.generic'], function() {
5
5
  this.defineProperties({
6
6
  websurface_id: { type: 'string' },
7
7
  image_id: { type: 'string' },
8
+ url: { type: 'string', set: this.updateURL },
8
9
  color: { type: 'color', default: 0xffffff },
9
10
  hovercolor: { type: 'color', default: 0x009900 },
10
11
  activecolor: { type: 'color', default: 0x00ff00 }
@@ -27,6 +28,8 @@ elation.require(['engine.things.generic'], function() {
27
28
  // and hope that most sites are running both.
28
29
 
29
30
  this.url = url.replace(/^http:/, 'https:');
31
+ } else {
32
+ this.url = this.websurface_id;
30
33
  }
31
34
 
32
35
  // FIXME - binding of member functions should happen at object creation
@@ -78,7 +81,9 @@ elation.require(['engine.things.generic'], function() {
78
81
  }
79
82
  this.createObjectDOM = function() {
80
83
  var websurface = this.room.websurfaces[this.properties.websurface_id];
81
- if (websurface) {
84
+ if (!websurface) {
85
+ websurface = {};
86
+ }
82
87
  var width = websurface.width || 1024,
83
88
  height = websurface.height || 768,
84
89
  border = elation.utils.any(websurface.border, true);
@@ -103,7 +108,6 @@ elation.require(['engine.things.generic'], function() {
103
108
 
104
109
  this.iframe = iframe;
105
110
  this.domobj = obj;
106
- }
107
111
  }
108
112
  this.activate = function() {
109
113
  if (!this.active) {
@@ -167,6 +171,11 @@ setTimeout(elation.bind(this, function() {
167
171
  this.objects['3d'].remove(this.domobj);
168
172
  }
169
173
  }
174
+ this.updateURL = function() {
175
+ if (this.iframe) {
176
+ this.iframe.src = this.url;
177
+ }
178
+ }
170
179
  }, elation.engine.things.janusbase);
171
180
  });
172
181
 
package/utils/build.sh CHANGED
@@ -42,6 +42,9 @@ fi
42
42
  if [ ! -f "$BUILDDIR/manifest.json" ] || [ ! "$BUILDDIR/media/manifest.json" -ef "$BUILDDIR/manifest.json" ]; then
43
43
  mv "$BUILDDIR/media/manifest.json" "$BUILDDIR/"
44
44
  fi
45
+ if [ ! -f "$BUILDDIR/service-worker.js" ] || [ ! "$BUILDDIR/media/service-worker.js" -ef "$BUILDDIR/service-worker.js" ]; then
46
+ mv "$BUILDDIR/media/service-worker.js" "$BUILDDIR/"
47
+ fi
45
48
 
46
49
  if [ -e elation ] && [ -e elation/components/janusweb ]; then
47
50
  echo 'Building from project-local elation directory'
package/utils/init.sh CHANGED
@@ -32,6 +32,6 @@ if [ ! -d elation ]; then
32
32
 
33
33
  cd ..
34
34
  ./elation web init
35
- ./elation component enable engine physics share elements janusweb utils
35
+ ./elation component enable elation engine physics share elements janusweb ui utils
36
36
  fi
37
37
  echo "done"