janusweb 1.5.53 → 1.5.54

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.
@@ -103,7 +103,7 @@ this.debug.style.zIndex = '1000';
103
103
  janus.engine.systems.render.renderer.domElement.addEventListener('touchstart', (ev) => {
104
104
  this.show();
105
105
  this.reset();
106
- if (!player.enabled) player.enable();
106
+ if (room.pointerlock && !player.enabled) player.enable();
107
107
  });
108
108
  }
109
109
  }
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.53",
4
+ "version": "1.5.54",
5
5
  "main": "scripts/janusweb.js",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
@@ -210,17 +210,18 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
210
210
  });
211
211
  var collider = colliderasset.getInstance();
212
212
  this.collidermesh = collider;
213
- if (collider.userData.loaded) {
213
+
214
+ if (colliderasset.state == 'complete') {
214
215
  //this.colliders.add(collider);
215
216
  processMeshCollider(collider);
216
217
  } else {
217
218
  let meshColliderLoaded = false;
218
- elation.events.add(collider, 'asset_load', elation.bind(this, function(ev) {
219
+ elation.events.add(collider, 'asset_load', ev => {
219
220
  if (!meshColliderLoaded) {
220
221
  processMeshCollider(collider);
221
222
  }
222
223
  meshColliderLoaded = true;
223
- }) );
224
+ });
224
225
  }
225
226
  }
226
227
  }
@@ -440,6 +441,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
440
441
  executeCallback: ['function', 'executeCallback'],
441
442
  isEqual: ['function', 'isEqual'],
442
443
  addClass: ['function', 'addClass'],
444
+ getElementsByClassName: ['function', 'getElementsByClassName'],
443
445
  removeClass: ['function', 'removeClass'],
444
446
  hasClass: ['function', 'hasClass'],
445
447
  raycast: ['function', 'raycast'],
@@ -1218,7 +1220,7 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
1218
1220
  if (el.tag == tag) {
1219
1221
  elements.push(el);
1220
1222
  }
1221
- el.getElementsByTagName(tagname, elements);
1223
+ if (el.getElementsByTagName) el.getElementsByTagName(tagname, elements);
1222
1224
  };
1223
1225
  return elements;
1224
1226
  }
@@ -1243,6 +1245,19 @@ elation.require(['engine.things.generic', 'utils.template', 'janusweb.parts'], f
1243
1245
  }
1244
1246
  return false;
1245
1247
  }
1248
+ this.getElementsByClassName = function(classname) {
1249
+ var objects = [];
1250
+ for (var k in this.children) {
1251
+ let child = this.children[k];
1252
+ if (child.hasClass && child.hasClass(classname)) {
1253
+ objects.push(child.getProxyObject());
1254
+ }
1255
+ if (child.getElementsByClassName) {
1256
+ objects.push(...child.getElementsByClassName(classname));
1257
+ }
1258
+ }
1259
+ return objects;
1260
+ }
1246
1261
  this.setLayers = function(layers) {
1247
1262
  // TODO - this system is experimental, and probably isn't quite ready for use
1248
1263
  // It should be extended to have named layers, rather than expecting the
@@ -1432,6 +1447,8 @@ console.log('clone', props);
1432
1447
  let obj1 = ev.data.bodies[0].object, obj2 = ev.data.bodies[1].object,
1433
1448
  other = (obj1 == this ? obj2 : obj1);
1434
1449
 
1450
+ if (!(obj1.collidable && obj2.collidable)) return;
1451
+
1435
1452
  let events = elation.events.fire({type: 'collide', element: this, data: {
1436
1453
  other: (typeof other.getProxyObject == 'function' ? other.getProxyObject() : other),
1437
1454
  collision: ev.data
@@ -47,6 +47,8 @@ elation.require(['janusweb.janusbase'], function() {
47
47
  rand_accel: { type: 'vector3', default: [0, 0, 0]},
48
48
  rand_col: { type: 'vector3', default: [0, 0, 0]},
49
49
  rand_scale: { type: 'vector3', default: [0, 0, 0]},
50
+ speed_min: { type: 'float', default: null },
51
+ speed_max: { type: 'float', default: null },
50
52
  loop: { type: 'bool', default: true, set: this.updateParticles },
51
53
  refreshrate: { type: 'int', default: 30 },
52
54
  blend_src: { type: 'string', default: 'src_alpha', set: this.updateMaterial },
@@ -438,6 +440,14 @@ elation.require(['janusweb.janusbase'], function() {
438
440
  vel.y += randomInRange(rand_vel.y);
439
441
  vel.z += randomInRange(rand_vel.z);
440
442
  }
443
+
444
+ let speed = vel.length();
445
+ if (this.speed_min !== null && speed < this.speed_min) {
446
+ vel.normalize().multiplyScalar(this.speed_min);
447
+ } else if (this.speed_max !== null && speed > this.speed_max) {
448
+ vel.normalize().multiplyScalar(this.speed_max);
449
+ }
450
+
441
451
  if (rand_accel.lengthSq() > 0) {
442
452
  accel.x += randomInRange(rand_accel.x);
443
453
  accel.y += randomInRange(rand_accel.y);
package/scripts/object.js CHANGED
@@ -67,6 +67,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
67
67
  color_write: { type: 'boolean', default: null, set: this.updateMaterial },
68
68
  envmap_id: { type: 'string', set: this.updateMaterial, comment: 'Environment map texture ID (overrides skybox reflections)' },
69
69
  normalmap_id: { type: 'string', set: this.updateMaterial, comment: 'Normal map texture ID' },
70
+ normal_scale: { type: 'integer', set: this.updateMaterial, default: 1, comment: 'Normal scale' },
70
71
  bumpmap_id: { type: 'string', set: this.updateMaterial, comment: 'Bumpmap texture ID' },
71
72
  bumpmap_scale: { type: 'float', default: 1.0, set: this.updateMaterial, comment: 'Bumpmap scale' },
72
73
  alphamap_id: { type: 'string', set: this.updateMaterial, comment: 'Alpha map texture ID' },
@@ -796,6 +797,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
796
797
  elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
797
798
  }
798
799
  }
800
+ m.normalScale.set(this.normal_scale, this.normal_scale);
799
801
  } else if (textureBump) {
800
802
  m.bumpMap = textureBump;
801
803
  m.bumpScale = this.bumpmap_scale;
@@ -818,6 +820,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
818
820
  }
819
821
  if (textureNormal) {
820
822
  m.normalMap = textureNormal;
823
+ m.normalScale.set(this.normal_scale, this.normal_scale);
821
824
  } else if (m.normalMap) {
822
825
  var imagesrc = m.normalMap.sourceFile;
823
826
  var asset = this.getAsset('image', imagesrc, {id: imagesrc, src: imagesrc, hasalpha: false, srgb: false});
@@ -829,6 +832,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
829
832
  elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
830
833
  }
831
834
  }
835
+ m.normalScale.set(this.normal_scale, this.normal_scale);
832
836
  }
833
837
 
834
838
  if (textureLightmap && textureLightmap.image) {
@@ -1473,6 +1477,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
1473
1477
  envmap_id: [ 'property', 'envmap_id'],
1474
1478
  websurface_id: [ 'property', 'websurface_id'],
1475
1479
  normalmap_id: [ 'property', 'normalmap_id'],
1480
+ normal_scale: [ 'property', 'normal_scale'],
1476
1481
  alphamap_id: [ 'property', 'alphamap_id'],
1477
1482
  displacementmap_id: [ 'property', 'displacementmap_id'],
1478
1483
  displacementmap_scale: [ 'property', 'displacementmap_scale'],
package/scripts/room.js CHANGED
@@ -958,6 +958,7 @@ elation.require([
958
958
  if (room.skybox_down_id) this.properties.skybox_down_id = room.skybox_down_id;
959
959
  if (room.skybox_front_id) this.properties.skybox_front_id = room.skybox_front_id;
960
960
  if (room.skybox_back_id) this.properties.skybox_back_id = room.skybox_back_id;
961
+ if (typeof room.skybox_intensity != 'undefined') this.skybox_intensity = room.skybox_intensity;
961
962
 
962
963
  if (room.cubemap_radiance_id) this.properties.cubemap_radiance_id = room.cubemap_radiance_id;
963
964
  if (room.cubemap_irradiance_id) this.properties.cubemap_irradiance_id = room.cubemap_irradiance_id;
@@ -1498,6 +1499,7 @@ elation.require([
1498
1499
  tex_linear: args.tex_linear,
1499
1500
  sbs3d: args.sbs3d,
1500
1501
  ou3d: args.ou3d,
1502
+ equi: args.equi,
1501
1503
  reverse3d: args.reverse3d,
1502
1504
  hasalpha: args.hasalpha,
1503
1505
  maxsize: args.maxsize,
@@ -1962,6 +1964,9 @@ elation.require([
1962
1964
  if (this.jsobjects[k].hasClass(classname)) {
1963
1965
  objects.push(this.jsobjects[k]);
1964
1966
  }
1967
+ if (this.jsobjects[k].getElementsByClassName) {
1968
+ objects.push(...this.jsobjects[k].getElementsByClassName(classname));
1969
+ }
1965
1970
  }
1966
1971
  return objects;
1967
1972
  }
@@ -2181,6 +2186,10 @@ elation.require([
2181
2186
  getBoundingSphere: ['function', 'getBoundingSphere'],
2182
2187
  getBoundingBox: ['function', 'getBoundingBox'],
2183
2188
 
2189
+ getElementsByTagName: ['function', 'getObjectsByTagName'],
2190
+ getElementsByClassName:['function', 'getObjectsByClassName'],
2191
+ getElementById: ['function', 'getObjectById'],
2192
+
2184
2193
  registerElement: ['function', 'registerElement'],
2185
2194
  extendElement: ['function', 'extendElement'],
2186
2195
  addEventListener: ['function', 'addEventListenerProxy'],