janusweb 1.5.30 → 1.5.34

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 (84) hide show
  1. package/CHANGELOG +39 -0
  2. package/LICENSE +1 -1
  3. package/media/assets/janus-avatar-animations.glb +0 -0
  4. package/media/assets/janus-avatar-base.glb +0 -0
  5. package/media/assets/webui/apps/avatar/avatar.css +6 -2
  6. package/media/assets/webui/apps/avatar/avatar.js +99 -11
  7. package/media/assets/webui/apps/buttons/buttons.html +2 -2
  8. package/media/assets/webui/apps/buttons/buttons.js +3 -3
  9. package/media/assets/webui/apps/comms/comms.js +7 -4
  10. package/media/assets/webui/apps/comms/voip.js +133 -57
  11. package/media/assets/webui/apps/editor/codemirror/addon/hint/javascript-hint.js +162 -0
  12. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.css +36 -0
  13. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.js +529 -0
  14. package/media/assets/webui/apps/editor/codemirror/addon/hint/xml-hint.js +140 -0
  15. package/media/assets/webui/apps/editor/codemirror/keymap/vim.js +5734 -0
  16. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.css +350 -0
  17. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.js +9800 -0
  18. package/media/assets/webui/apps/editor/codemirror/lib/jmldark.css +33 -0
  19. package/media/assets/webui/apps/editor/codemirror/mode/css/css.js +864 -0
  20. package/media/assets/webui/apps/editor/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
  21. package/media/assets/webui/apps/editor/codemirror/mode/javascript/javascript.js +942 -0
  22. package/media/assets/webui/apps/editor/codemirror/mode/xml/xml.js +413 -0
  23. package/media/assets/webui/apps/editor/editor.css +3 -0
  24. package/media/assets/webui/apps/editor/editor.js +409 -9
  25. package/media/assets/webui/apps/editor/editor.json +6 -3
  26. package/media/assets/webui/apps/inventory/inventory.html +7 -4
  27. package/media/assets/webui/apps/inventory/inventory.js +2 -2
  28. package/media/assets/webui/apps/locomotion/teleporter.js +10 -9
  29. package/media/assets/webui/apps/navigation/navigation.js +12 -12
  30. package/media/assets/webui/apps/settings/settings.html +1 -1
  31. package/media/assets/webui/apps/vfs/browserfs/browserfs.js +8 -0
  32. package/media/assets/webui/apps/vfs/vfs.css +52 -0
  33. package/media/assets/webui/apps/vfs/vfs.js +452 -0
  34. package/media/assets/webui/apps/vfs/vfs.json +10 -0
  35. package/media/assets/webui/apps/virtualgamepad/virtualgamepad.js +9 -7
  36. package/media/assets/webui/apps/xrmenu/xrmenu.js +13 -4
  37. package/media/assets/webui/default.json +2 -1
  38. package/media/assets/webui/none.json +1 -0
  39. package/media/assets/webui/themes/default.css +29 -2
  40. package/media/assets.json +2 -1
  41. package/media/index.html +1 -1
  42. package/media/lib/draco/README.md +32 -0
  43. package/media/lib/draco/draco_decoder.js +52 -0
  44. package/media/lib/draco/draco_decoder.wasm +0 -0
  45. package/media/lib/draco/draco_encoder.js +33 -0
  46. package/media/lib/draco/draco_wasm_wrapper.js +104 -0
  47. package/media/lib/draco/gltf/draco_decoder.js +48 -0
  48. package/media/lib/draco/gltf/draco_decoder.wasm +0 -0
  49. package/media/lib/draco/gltf/draco_encoder.js +33 -0
  50. package/media/lib/draco/gltf/draco_wasm_wrapper.js +104 -0
  51. package/media/lib/physx/physx.release.js +21 -0
  52. package/media/lib/physx/physx.release.wasm +0 -0
  53. package/media/manifest.json +5 -5
  54. package/media/service-worker.js +7 -0
  55. package/package.json +2 -9
  56. package/scripts/client.js +67 -46
  57. package/scripts/config.js +2 -0
  58. package/scripts/elements/linesegments.js +10 -3
  59. package/scripts/external/JanusFireboxParser.js +1 -0
  60. package/scripts/image.js +7 -1
  61. package/scripts/janusbase.js +104 -43
  62. package/scripts/janusghost.js +314 -16
  63. package/scripts/januslight.js +11 -2
  64. package/scripts/janusparagraph.js +8 -6
  65. package/scripts/janusparticle.js +26 -16
  66. package/scripts/janusplayer.js +126 -37
  67. package/scripts/janusweb.js +26 -2
  68. package/scripts/janusxrplayer.js +5 -3
  69. package/scripts/multiplayermanager.js +6 -4
  70. package/scripts/object.js +246 -88
  71. package/scripts/portal.js +23 -14
  72. package/scripts/remoteplayer.js +1 -25
  73. package/scripts/room.js +199 -77
  74. package/scripts/sound.js +8 -6
  75. package/scripts/text.js +13 -5
  76. package/scripts/translators/janusvfs.js +20 -0
  77. package/scripts/video.js +1 -1
  78. package/scripts/websurface.js +17 -3
  79. package/utils/build.sh +3 -0
  80. package/utils/init.sh +2 -2
  81. package/scripts/chat.js +0 -80
  82. package/scripts/ui.js +0 -265
  83. package/scripts/urlbar.js +0 -93
  84. package/templates/janusweb.tpl +0 -3
package/scripts/text.js CHANGED
@@ -26,8 +26,9 @@ 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
- this.emptygeometry = new THREE.Geometry();
31
+ this.emptygeometry = new THREE.BufferGeometry();
31
32
  elation.events.add(this.engine, 'engine_frame', elation.bind(this, this.handleFrameUpdates));
32
33
  }
33
34
  this.createObject3D = function() {
@@ -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;
@@ -131,7 +133,7 @@ elation.require(['engine.things.label'], function() {
131
133
 
132
134
  let font = this.fontasset.getInstance();
133
135
 
134
- var geometry = new THREE.TextBufferGeometry( text, {
136
+ var geometry = new THREE.TextGeometry( text, {
135
137
  size: this.font_size,
136
138
  height: this.properties.thickness || this.font_size / 8,
137
139
  curveSegments: this.segments,
@@ -195,7 +197,7 @@ elation.require(['engine.things.label'], function() {
195
197
  }
196
198
  this.setMultilineText = function(text) {
197
199
  var lines = text.split('\n');
198
- var geometry = new THREE.Geometry();
200
+ var geometry = new THREE.BufferGeometry();
199
201
  var linematrix = new THREE.Matrix4();
200
202
  var lineoffset = 0;
201
203
  var lineheight = 0;
@@ -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,9 +81,12 @@ 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
- height = websurface.height || 768;
88
+ height = websurface.height || 768,
89
+ border = elation.utils.any(websurface.border, true);
84
90
 
85
91
  var iframe = elation.html.create('iframe');
86
92
  iframe.src = this.url;
@@ -93,12 +99,15 @@ elation.require(['engine.things.generic'], function() {
93
99
  iframe.style.width = width + 'px';
94
100
  iframe.style.height = height + 'px';
95
101
 
102
+ if (!border) {
103
+ iframe.style.border = 0;
104
+ }
105
+
96
106
  var obj = new THREE.CSS3DObject(div);
97
107
  obj.scale.set(1/width, 1/height, 1);
98
108
 
99
109
  this.iframe = iframe;
100
110
  this.domobj = obj;
101
- }
102
111
  }
103
112
  this.activate = function() {
104
113
  if (!this.active) {
@@ -162,6 +171,11 @@ setTimeout(elation.bind(this, function() {
162
171
  this.objects['3d'].remove(this.domobj);
163
172
  }
164
173
  }
174
+ this.updateURL = function() {
175
+ if (this.iframe) {
176
+ this.iframe.src = this.url;
177
+ }
178
+ }
165
179
  }, elation.engine.things.janusbase);
166
180
  });
167
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
@@ -1,7 +1,7 @@
1
1
  #!/bin/bash
2
2
 
3
3
  echo "Creating directory tree..."
4
- DEPENDENCYPATHS=$(npm ls -parseable)
4
+ DEPENDENCYPATHS=$(npm ls --all -parseable)
5
5
 
6
6
  declare -A dependencies
7
7
 
@@ -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
35
+ ./elation component enable elation engine physics share elements janusweb ui utils
36
36
  fi
37
37
  echo "done"
package/scripts/chat.js DELETED
@@ -1,80 +0,0 @@
1
- elation.requireCSS('janusweb.chat');
2
- elation.require(['ui.window', 'ui.list', 'ui.input', 'elation.collection'], function() {
3
- elation.template.add('janusweb.chat.message', '[{userId}] {message}');
4
-
5
- elation.component.add('janusweb.chat', function() {
6
- this.init = function() {
7
- this.args.title = 'Chat Log';
8
- this.args.bottom = true;
9
- this.args.resizable = false;
10
- this.args.controls = true;
11
- this.client = this.args.client;
12
- this.player = this.args.player || this.client.player;
13
- this.network = this.args.network;
14
-
15
- elation.janusweb.chat.extendclass.init.call(this);
16
-
17
- this.chatbutton = elation.ui.button({classname: 'janusweb_chat', label: 'Chat'});
18
- elation.events.add(this.chatbutton, 'ui_button_click', elation.bind(this, this.toggleChat));
19
- this.client.buttons.add('chat', this.chatbutton);
20
-
21
- this.messagecollection = elation.collection.indexed({index: 'timestamp'});
22
- var panel = elation.ui.panel_vertical({classname: 'janusweb_chat_panel'});
23
- this.messagelist = elation.ui.list({append: panel, classname: 'janusweb_chat_messages', itemcollection: this.messagecollection, attrs: {itemtemplate: 'janusweb.chat.message'}});
24
- this.input = elation.ui.input({
25
- append: panel,
26
- classname: 'janusweb_chat_input',
27
- placeholder: 'Press T to talk',
28
- events: {
29
- ui_input_accept: elation.bind(this, this.sendmessage),
30
- focus: elation.bind(this, this.focus),
31
- blur: elation.bind(this, this.blur),
32
- }
33
- });
34
-
35
- this.setcontent(panel);
36
- this.hide();
37
- }
38
- this.addmessage = function(msg) {
39
- if (!msg.timestamp) msg.timestamp = window.performance.now();
40
- var bottom = this.messagelist.isScrollAtBottom();
41
- if (elation.utils.isObject(msg.message)) {
42
- msg.message = msg.message.data;
43
- }
44
- this.messagecollection.add(msg);
45
- if (bottom) {
46
- this.messagelist.scrollToBottom();
47
- }
48
- this.refresh();
49
- }
50
- this.sendmessage = function() {
51
- this.network.send({'method': 'chat', data: this.input.value});
52
- var msg = {userId: 'me', message: this.input.value, self: true};
53
- this.addmessage(msg);
54
- elation.events.fire({element: this, type: 'janusweb_chat_send', data: msg});
55
- this.input.value = '';
56
- }
57
- this.focus = function() {
58
- if (this.input) {
59
- this.input.focus();
60
- }
61
- if (this.player) {
62
- this.player.disable();
63
- }
64
- }
65
- this.blur = function() {
66
- if (this.player) {
67
- this.player.enable();
68
- }
69
- }
70
- this.toggleChat = function() {
71
- if (this.hidden) {
72
- this.show();
73
- this.refresh();
74
- } else {
75
- this.hide();
76
- this.refresh();
77
- }
78
- }
79
- }, elation.ui.window);
80
- });
package/scripts/ui.js DELETED
@@ -1,265 +0,0 @@
1
- elation.require(['ui.all', 'janusweb.urlbar'], function() {
2
- elation.component.add('janusweb.ui.old', function() {
3
- this.init = function() {
4
- elation.janusweb.ui.navigation.extendclass.init.call(this);
5
-
6
- this.client = this.args.client;
7
- this.player = this.client.player;
8
- this.janusweb = this.client.janusweb;
9
-
10
- this.createUI();
11
- //this.createUI3D();
12
- }
13
- this.createUI = function() {
14
- this.navigation = elation.ui.panel({append: this, classname: 'janusweb_ui_navigation'})
15
- this.backbutton = elation.ui.button({append: this.navigation, label: '◀', events: { click: elation.bind(this.janusweb, this.janusweb.navigateBack) } });
16
- this.homebutton = elation.ui.button({append: this.navigation, label: '🏠', events: { click: elation.bind(this.janusweb, this.janusweb.navigateHome) } });
17
- this.urlbar = elation.janusweb.urlbar({
18
- append: this.navigation,
19
- label: '',
20
- value: this.janusweb.properties.url,
21
- janusweb: this.janusweb,
22
- client: this.client,
23
- events: {
24
- ui_input_accept: elation.bind(this, function(ev) { this.janusweb.setActiveRoom(ev.data); this.client.hideMenu(); this.player.enable(); }),
25
- focus: elation.bind(this, function(ev) { this.player.disable(); }),
26
- blur: elation.bind(this, function(ev) { this.player.enable(); }),
27
- }
28
- });
29
- }
30
-
31
- this.createUI3D = function() {
32
- var nav3d = this.janusweb.spawn('generic', 'janusweb_navigation_3d', { position: [0,1,5] });
33
- this.navigation3d = elation.ui.panel3d({append3d: nav3d, panelorientation: 'horizontal', classname: 'janusweb_ui_navigation'})
34
-
35
- this.backbutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '◀', events: { click: elation.bind(this.janusweb, this.janusweb.navigateBack) } });
36
- this.forwardbutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '▶', events: { click: elation.bind(this.janusweb, this.janusweb.navigateForward) } });
37
- this.homebutton3d = elation.ui.button3d({append3d: this.navigation3d, label: '🏠', events: { click: elation.bind(this.janusweb, this.janusweb.navigateHome) } });
38
- }
39
- this.enable = function() {
40
- elation.janusweb.ui.navigation.extendclass.enable.call(this);
41
- this.navigation.enable();
42
- }
43
- this.disable = function() {
44
- elation.janusweb.ui.navigation.extendclass.disable.call(this);
45
- this.navigation.disable();
46
- }
47
- }, elation.ui.base);
48
-
49
- /* base3d */
50
- elation.component.add('ui.base3d', function() {
51
- this.init = function() {
52
- var append3d = this.args.append3d;
53
- if (append3d.sceneobj) append3d = append3d.sceneobj;
54
- this.style = new elation.ui.style3d();
55
-
56
- if (append3d) {
57
- this.engine = append3d.engine;
58
- this.client = this.engine.client;
59
- this.sceneobj = this.create();
60
- if (this.sceneobj) {
61
- append3d.add(this.sceneobj);
62
- }
63
- }
64
- }
65
- this.create = function() {
66
- }
67
- this.dimensions = function() {
68
- if (this.sceneobj) {
69
- var bounds = this.sceneobj.getBoundingBox();
70
- }
71
- }
72
- }, elation.ui.base);
73
-
74
- /* panel */
75
- elation.component.add('ui.panel3d', function() {
76
- this.init = function() {
77
- elation.ui.panel3d.extendclass.init.call(this);
78
- }
79
- this.create = function() {
80
- return elation.engine.things.ui_panel({engine: this.client.engine, client: this.client, properties: this.args, id: Math.floor(Math.random() * 1e10), events: this.events});
81
- }
82
- }, elation.ui.base3d);
83
- elation.component.add('engine.things.ui_panel', function() {
84
- this.postinit = function() {
85
- elation.engine.things.ui_panel.extendclass.postinit.call(this);
86
- this.defineProperties({
87
- panelorientation: { type: 'string', default: 'vertical' }
88
- });
89
- elation.events.add(this, 'thing_add', elation.bind(this, this.update));
90
- }
91
- this.createObject3D = function() {
92
- var box = new THREE.BoxGeometry(1,1,1);
93
- var mat = new THREE.MeshBasicMaterial({color: 0xff0000, wireframe: true});
94
- var bbox = new THREE.Mesh(box, mat);
95
-
96
- this.geometry = box;
97
-
98
- var obj = new THREE.Object3D();
99
- obj.add(bbox);
100
- bbox.visible = false;
101
- return obj;
102
- }
103
- this.update = function() {
104
- var offset = [0,0,0];
105
- var size = new THREE.Vector3();
106
- var bounds = new THREE.Box3();
107
-
108
- // Use the 3d object's children since it's a regular array, in order of insertion
109
- for (var i = 0; i < this.objects['3d'].children.length; i++) {
110
- if (!this.objects['3d'].children[i].userData || !this.objects['3d'].children[i].userData.thing) continue;
111
- var child = this.objects['3d'].children[i].userData.thing;
112
- var dims = child.getBoundingBox();
113
- dims.size(size);
114
- child.position.x = offset[0];
115
- child.position.y = offset[1];
116
- child.position.z = offset[2];
117
-
118
- if (this.panelorientation == 'horizontal') {
119
- offset[0] += size.x;
120
- } else if (this.panelorientation == 'vertical') {
121
- offset[1] -= size.y;
122
- } else if (this.panelorientation == 'depth') {
123
- offset[2] += size.z;
124
- }
125
-
126
- var dims = child.getBoundingBox();
127
- bounds.expandByPoint(dims.min);
128
- bounds.expandByPoint(dims.max);
129
- }
130
- var worldpos = this.localToWorld(new THREE.Vector3(0,0,0));
131
- bounds.min.sub(worldpos);
132
- bounds.max.sub(worldpos);
133
- bounds.size(size);
134
- //this.objects['3d'].scale.set(size.x, size.y, size.z);
135
-
136
- this.geometry.vertices[0].set(bounds.max.x, bounds.max.y, bounds.max.z);
137
- this.geometry.vertices[1].set(bounds.max.x, bounds.max.y, bounds.min.z);
138
- this.geometry.vertices[2].set(bounds.max.x, bounds.min.y, bounds.max.z);
139
- this.geometry.vertices[3].set(bounds.max.x, bounds.min.y, bounds.min.z);
140
- this.geometry.vertices[4].set(bounds.min.x, bounds.max.y, bounds.min.z);
141
- this.geometry.vertices[5].set(bounds.min.x, bounds.max.y, bounds.max.z);
142
- this.geometry.vertices[6].set(bounds.min.x, bounds.min.y, bounds.min.z);
143
- this.geometry.vertices[7].set(bounds.min.x, bounds.min.y, bounds.max.z);
144
-
145
- if (this.geometry.boundingBox) {
146
- this.geometry.boundingBox.copy(bounds);
147
- } else {
148
- this.geometry.boundingBox = bounds;
149
- }
150
- }
151
- }, elation.engine.things.generic);
152
-
153
- /* button */
154
- elation.component.add('ui.button3d', function() {
155
- this.create = function() {
156
- return elation.engine.things.ui_button({engine: this.client.engine, client: this.client, properties: this.args, id: Math.floor(Math.random() * 1e10), events: this.events});
157
- }
158
- }, elation.ui.base3d);
159
- elation.component.add('engine.things.ui_button', function() {
160
- this.postinit = function() {
161
- elation.engine.things.ui_panel.extendclass.postinit.call(this);
162
- this.defineProperties({
163
- label: { type: 'string', default: '' },
164
- fontSize: { type: 'integer', default: 512 },
165
- font: { type: 'string', default: 'Open Sans Regular' },
166
- });
167
- elation.events.add(this, 'mouseover,mouseout,mousedown,mouseup,click', this);
168
- }
169
- this.createObject3D = function() {
170
- var box = new THREE.BoxGeometry(1,0.5,0.1);
171
- box.applyMatrix(new THREE.Matrix4().makeTranslation(0,0,.05));
172
- var mat = new THREE.MeshBasicMaterial({color: 0x0000ff, wireframe: true});
173
- var bbox = new THREE.Mesh(box, mat);
174
-
175
- var labelgen = this.getAssetWrapper();
176
- var label = labelgen.getLabel(this.label);
177
-
178
- var buttongeo = new THREE.BoxGeometry(0.8,.4,.1);
179
- var buttonmat = new THREE.MeshPhongMaterial({color: 0x999999, map: label});
180
- var sidemat = new THREE.MeshPhongMaterial({color: 0x999999});
181
- var button = new THREE.Mesh(buttongeo, new THREE.MeshFaceMaterial([sidemat, sidemat, sidemat, sidemat, buttonmat, sidemat]));
182
-
183
- this.geometry = buttongeo;
184
- this.material = buttonmat;
185
-
186
- var obj = new THREE.Object3D();
187
- bbox.visible = false;
188
- obj.add(bbox);
189
- obj.add(button);
190
-
191
- return obj;
192
- }
193
- this.createChildren = function() {
194
- }
195
- this.createForces = function() {
196
- this.geometry.computeBoundingBox();
197
- this.setCollider('box', this.geometry.boundingBox);
198
- }
199
-
200
- this.mouseover = function() {
201
- this.material.color.setHex(0xccffcc);
202
- }
203
- this.mouseout = function() {
204
- this.material.color.setHex(0x999999)
205
- }
206
- this.mousedown = function() {
207
- alert('e');
208
- this.scale.z = 0.5;
209
- }
210
- this.mouseup = function() {
211
- this.scale.z = 1.0;
212
- }
213
- this.getAssetWrapper = function() {
214
- var color = (this.properties.color instanceof THREE.Color ? this.properties.color : new THREE.Color(this.properties.color));
215
- if (!this.labelgen) {
216
- var genname = ['label2d', this.font, this.fontSize, color.getHexString()].join('_');
217
- var asset = elation.engine.assets.find('labelgen', genname);
218
- if (!asset) {
219
- asset = elation.engine.assets.get({
220
- assettype: 'labelgen',
221
- assetname: genname,
222
- color: '#' + color.getHexString(),
223
- font: this.font,
224
- fontSize: this.fontSize,
225
- outlineSize: 0
226
- });
227
- }
228
- this.labelgen = asset;
229
- }
230
- return this.labelgen;
231
- }
232
- }, elation.engine.things.generic);
233
-
234
- elation.define('ui.style3d', {
235
- margin: function() { },
236
- marginLeft: 0,
237
- marginRight: 0,
238
- marginTop: 0,
239
- marginBottom: 0,
240
- marginFront: 0,
241
- marginBack: 0,
242
-
243
- padding: function() { },
244
- paddingLeft: 0,
245
- paddingRight: 0,
246
- paddingTop: 0,
247
- paddingBottom: 0,
248
- paddingFront: 0,
249
- paddingBack: 0,
250
-
251
- width: 'auto',
252
- height: 'auto',
253
- depth: 'auto',
254
-
255
- border: function() { },
256
- borderWidth: 0,
257
- borderColor: 0xffffff,
258
- borderStyle: 'solid',
259
- borderRadius: 0,
260
-
261
- background: function() { },
262
- backgroundColor: 'trans',
263
- backgroundImage: null,
264
- });
265
- });
package/scripts/urlbar.js DELETED
@@ -1,93 +0,0 @@
1
- elation.require(['ui.input'], function() {
2
- elation.requireCSS('janusweb.urlbar');
3
-
4
- elation.component.add('janusweb.urlbar', function() {
5
- this.create = function() {
6
- this.janusweb = this.args.janusweb;
7
- this.client = this.args.client;
8
-
9
- this.indicator = elation.ui.indicator({ append: this, state: 'ready' });
10
- this.addclass('janusweb_urlbar');
11
-
12
- if (this.container instanceof HTMLInputElement) {
13
- this.inputelement = this.container;
14
- } else {
15
- var inputs = elation.find('input', this.container);
16
- if (inputs.length > 0) {
17
- this.inputelement = inputs[0];
18
- } else {
19
- this.inputelement = elation.html.create({tag: 'input', append: this.container});
20
- if (this.args.type) {
21
- this.inputelement.type = this.args.type;
22
- }
23
- }
24
- }
25
-
26
- this.progress = elation.ui.progressbar({ append: this, value: 0, classname: 'janusweb_urlbar_progress' });
27
- this.progress.hide();
28
-
29
- if (this.args.id) {
30
- this.inputelement.id = this.args.id;
31
- }
32
-
33
- elation.events.add(this.janusweb, 'room_change', elation.bind(this, this.updateCurrentURL));
34
- }
35
- this.updateCurrentURL = function() {
36
- this.value = this.janusweb.url;
37
- var room = this.janusweb.currentroom;
38
- elation.events.add(room, 'room_load_queued', elation.bind(this, this.updateStatus, 'queued'));
39
- elation.events.add(room, 'room_load_start', elation.bind(this, this.updateStatus, 'downloading'));
40
- elation.events.add(room, 'room_load_processing', elation.bind(this, this.updateStatus, 'processing'));
41
- elation.events.add(room, 'room_load_processed', elation.bind(this, this.updateRoomAssets));
42
- elation.events.add(room, 'room_load_complete', elation.bind(this, this.updateStatus, 'complete'));
43
-
44
- elation.events.add(room, 'room_load_progress', elation.bind(this, this.updateProgress));
45
-
46
- elation.events.add(room, 'room_add_asset', elation.bind(this, this.roomAddAsset));
47
- this.loading = {};
48
- this.progress.set(0);
49
- this.progress.show();
50
- }
51
- this.updateStatus = function(status, ev) {
52
- }
53
- this.updateRoomAssets = function(ev) {
54
- this.updateStatus('processed');
55
- var room = this.janusweb.currentroom;
56
- var assets = room.getActiveAssets();
57
- for (var type in assets) {
58
- for (var id in assets[type]) {
59
- var asset = assets[type][id];
60
- elation.events.add(asset, 'asset_load_progress', elation.bind(this, this.updateProgress));
61
- }
62
- }
63
- }
64
- this.roomAddAsset = function(ev) {
65
- var room = this.janusweb.currentroom;
66
- var asset = ev.data;
67
-
68
- if (!this.loading[asset.src]) {
69
- elation.events.add(asset, 'asset_load_progress', elation.bind(this, this.updateProgress));
70
- }
71
- }
72
- this.updateProgress = function(ev) {
73
- //console.log('room had some progress', this.loading);
74
- var progress = ev.data;
75
-
76
- var url = progress.src;
77
- if (!this.loading[url]) {
78
- this.loading[url] = progress;
79
- }
80
- this.loading[url].loaded = progress.loaded;
81
-
82
- var loaded = 0, total = 0, count = 0;
83
- for (var k in this.loading) {
84
- count++;
85
- loaded += this.loading[k].loaded;
86
- total += this.loading[k].total;
87
- }
88
- var percent = loaded / total;
89
- //console.log('room had some progress', count + ' files, ' + loaded + ' / ' + total + ' bytes, ' + percent.toFixed(2) + '%', url);
90
- this.progress.set(percent);
91
- }
92
- }, elation.ui.input);
93
- });
@@ -1,3 +0,0 @@
1
- {dependency name="janusweb.client"}
2
- <div data-elation-component="janusweb.client" data-elation-args.homepage="http://www.janusvr.com/index.html" id="default"></div>
3
- {set var="page.title"}JanusWeb{/set}