janusweb 1.5.52 → 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/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.52",
4
+ "version": "1.5.53",
5
5
  "main": "scripts/janusweb.js",
6
6
  "author": "James Baicoianu",
7
7
  "license": "MIT",
package/scripts/object.js CHANGED
@@ -648,7 +648,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
648
648
  let shader = this.getAsset('shader', this.shader_id);
649
649
  if (shader) {
650
650
  shadermaterial = shader.getInstance();
651
- shadermaterial.uniforms = this.room.parseShaderUniforms(shader.uniforms);
651
+ elation.utils.merge(this.room.parseShaderUniforms(shader.uniforms), shadermaterial.uniforms);
652
652
  shadermaterial.side = this.sidemap[this.properties.cull_face];
653
653
  shadermaterial.shadowSide = shadowside
654
654
  shadermaterial.receiveShadow = this.shadow && this.shadow_receive;
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
- let shader = this.getAsset('shader', this.shader_id);
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,8 +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
- mat.map = thumb;
127
- mat.map.encoding = THREE.sRGBEncoding;
129
+ thumb.encoding = THREE.sRGBEncoding;
130
+ if (shader) {
131
+ mat.uniforms.iChannel0.value = thumb;
132
+ } else {
133
+ mat.map = thumb;
134
+ }
128
135
  if (asset.loaded) {
129
136
  if (asset.hasalpha) {
130
137
  mat.transparent = true;
@@ -149,6 +156,8 @@ elation.require(['janusweb.janusbase'], function() {
149
156
  mat.polygonOffsetFactor = -1;
150
157
  mat.polygonOffsetUnits = -4;
151
158
 
159
+ this.portalmaterial = mat;
160
+
152
161
  return mat;
153
162
  }
154
163
  this.adjustAspectRatio = function(image) {
@@ -505,6 +514,7 @@ elation.require(['janusweb.janusbase'], function() {
505
514
  this.janus.network.unsubscribe(this.portalroom);
506
515
  }
507
516
  this.updateGeometry = function() {
517
+ if (!this.created) return;
508
518
  var thickness = 0.05 * this.size.z;
509
519
  var offset = ((thickness / 2) / this.properties.scale.z) * 2;
510
520
  var box;