janusweb 1.5.33 → 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 (46) hide show
  1. package/CHANGELOG +39 -0
  2. package/media/assets/webui/apps/avatar/avatar.js +2 -1
  3. package/media/assets/webui/apps/comms/voip.js +2 -4
  4. package/media/assets/webui/apps/editor/codemirror/addon/hint/javascript-hint.js +162 -0
  5. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.css +36 -0
  6. package/media/assets/webui/apps/editor/codemirror/addon/hint/show-hint.js +529 -0
  7. package/media/assets/webui/apps/editor/codemirror/addon/hint/xml-hint.js +140 -0
  8. package/media/assets/webui/apps/editor/codemirror/keymap/vim.js +5734 -0
  9. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.css +350 -0
  10. package/media/assets/webui/apps/editor/codemirror/lib/codemirror.js +9800 -0
  11. package/media/assets/webui/apps/editor/codemirror/lib/jmldark.css +33 -0
  12. package/media/assets/webui/apps/editor/codemirror/mode/css/css.js +864 -0
  13. package/media/assets/webui/apps/editor/codemirror/mode/htmlmixed/htmlmixed.js +153 -0
  14. package/media/assets/webui/apps/editor/codemirror/mode/javascript/javascript.js +942 -0
  15. package/media/assets/webui/apps/editor/codemirror/mode/xml/xml.js +413 -0
  16. package/media/assets/webui/apps/editor/editor.css +3 -0
  17. package/media/assets/webui/apps/editor/editor.js +407 -9
  18. package/media/assets/webui/apps/editor/editor.json +6 -3
  19. package/media/assets/webui/apps/inventory/inventory.js +1 -1
  20. package/media/assets/webui/apps/locomotion/teleporter.js +1 -1
  21. package/media/assets/webui/apps/navigation/navigation.js +12 -12
  22. package/media/assets/webui/apps/vfs/browserfs/browserfs.js +8 -0
  23. package/media/assets/webui/apps/vfs/vfs.css +52 -0
  24. package/media/assets/webui/apps/vfs/vfs.js +452 -0
  25. package/media/assets/webui/apps/vfs/vfs.json +10 -0
  26. package/media/assets/webui/default.json +2 -1
  27. package/media/assets/webui/themes/default.css +29 -2
  28. package/package.json +2 -9
  29. package/scripts/client.js +64 -44
  30. package/scripts/elements/linesegments.js +5 -2
  31. package/scripts/janusbase.js +21 -9
  32. package/scripts/janusghost.js +0 -1
  33. package/scripts/janusparagraph.js +5 -3
  34. package/scripts/janusparticle.js +11 -12
  35. package/scripts/janusplayer.js +2 -2
  36. package/scripts/janusweb.js +21 -2
  37. package/scripts/janusxrplayer.js +3 -0
  38. package/scripts/multiplayermanager.js +3 -3
  39. package/scripts/object.js +159 -82
  40. package/scripts/portal.js +2 -3
  41. package/scripts/room.js +86 -44
  42. package/scripts/sound.js +0 -1
  43. package/scripts/text.js +10 -2
  44. package/scripts/translators/janusvfs.js +20 -0
  45. package/scripts/video.js +1 -1
  46. package/scripts/websurface.js +11 -2
package/scripts/object.js CHANGED
@@ -5,6 +5,36 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
5
5
  'front': THREE.BackSide,
6
6
  'none': THREE.DoubleSide
7
7
  };
8
+ this.depthFuncMap = {
9
+ 'never': THREE.NeverDepth,
10
+ 'always': THREE.AlwaysDepth,
11
+ 'equal': THREE.EqualDepth,
12
+ 'less': THREE.LessDepth,
13
+ 'lessequal': THREE.LessEqualDepth,
14
+ 'greaterequal': THREE.GreaterEqualDepth,
15
+ 'greater': THREE.GreaterDepth,
16
+ 'notequal': THREE.NotEqualDepth,
17
+ };
18
+ this.blendModeMap = {
19
+ 'normal': THREE.NormalBlending,
20
+ 'no': THREE.NoBlending,
21
+ 'additive': THREE.AdditiveBlending,
22
+ 'subtractive': THREE.SubtractiveBlending,
23
+ 'multiply': THREE.MultiplyBlending,
24
+ 'custom': THREE.CustomBlending,
25
+ };
26
+ this.blendFactorsMap = {
27
+ 'zero': THREE.ZeroFactor,
28
+ 'one': THREE.OneFactor,
29
+ 'src_color': THREE.SrcColorFactor,
30
+ 'dst_color': THREE.DstColorFactor,
31
+ 'src_alpha': THREE.SrcAlphaFactor,
32
+ 'dst_alpha': THREE.DstAlphaFactor,
33
+ 'one_minus_src_color': THREE.OneMinusSrcColorFactor,
34
+ 'one_minus_src_alpha': THREE.OneMinusSrcAlphaFactor,
35
+ 'one_minus_dst_color': THREE.OneMinusDstColorFactor,
36
+ 'one_minus_dst_alpha': THREE.OneMinusDstAlphaFactor,
37
+ };
8
38
  this.postinit = function() {
9
39
  elation.engine.things.janusobject.extendclass.postinit.call(this);
10
40
  this.defineProperties({
@@ -15,7 +45,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
15
45
  video_id: { type: 'string', set: this.updateVideo, comment: 'Video texture ID' },
16
46
  shader_id: { type: 'string', set: this.updateMaterial, comment: 'Shader ID' },
17
47
  shader_chunk_replace: { type: 'object' },
18
- url: { type: 'string' },
48
+ url: { type: 'string', set: this.updateWebsurfaceURL },
19
49
  loop: { type: 'boolean' },
20
50
  websurface_id: { type: 'string', set: this.updateWebsurface, comment: 'WebSurface ID' },
21
51
  shadow: { type: 'boolean', default: true, set: this.updateMaterial },
@@ -26,10 +56,14 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
26
56
  lights: { type: 'boolean', default: false, comment: 'Load lights from model' },
27
57
  lighting: { type: 'boolean', default: true, set: this.updateMaterial, comment: 'Object reacts to scene lighting' },
28
58
  cull_face: { type: 'string', default: 'back', set: this.updateMaterial, comment: 'Hide face sides (back, front, or none)' },
29
- blend_src: { type: 'string', default: 'src_alpha', set: this.updateMaterial, comment: 'Blend mode (source)' },
30
- blend_dest: { type: 'string', default: 'one_minus_src_alpha', set: this.updateMaterial, comment: 'Blend mode (destination)' },
59
+ blend_src: { type: 'string', set: this.updateMaterial, comment: 'Blend mode (source)' },
60
+ blend_dest: { type: 'string', set: this.updateMaterial, comment: 'Blend mode (destination)' },
61
+ blend_mode: { type: 'string', default: 'normal', set: this.updateMaterial, comment: 'Blend mode' },
31
62
  depth_write: { type: 'boolean', default: null, set: this.updateMaterial },
32
63
  depth_test: { type: 'boolean', default: null, set: this.updateMaterial },
64
+ depth_offset: { type: 'float', default: null, set: this.updateMaterial },
65
+ depth_func: { type: 'string', default: null, set: this.updateMaterial },
66
+ color_write: { type: 'boolean', default: null, set: this.updateMaterial },
33
67
  envmap_id: { type: 'string', set: this.updateMaterial, comment: 'Environment map texture ID (overrides skybox reflections)' },
34
68
  normalmap_id: { type: 'string', set: this.updateMaterial, comment: 'Normal map texture ID' },
35
69
  bumpmap_id: { type: 'string', set: this.updateMaterial, comment: 'Bumpmap texture ID' },
@@ -185,7 +219,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
185
219
  var videoasset = this.getAsset('video', videoid);
186
220
  if (videoasset) {
187
221
  this.videoasset = videoasset;
188
- texture = videoasset.getInstance();
222
+ let texture = videoasset.getInstance();
189
223
  if (!texture.image) {
190
224
  videoasset.load();
191
225
  }
@@ -237,6 +271,8 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
237
271
  url = this.room.baseurl + url;
238
272
  }
239
273
  this.url = url;
274
+ } else {
275
+ this.url = this.websurface_id;
240
276
  }
241
277
  /*
242
278
  this.pickable = false;
@@ -274,6 +310,11 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
274
310
  if (n.material) n.material = blankmaterial;
275
311
  });
276
312
  }
313
+ this.updateWebsurfaceURL = function() {
314
+ if (this.websurface) {
315
+ this.websurface.url = this.url;
316
+ }
317
+ }
277
318
  this.setTextureDirty = function() {
278
319
  this.textureNeedsUpdate = true;
279
320
  }
@@ -315,7 +356,11 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
315
356
  blend_src = false,
316
357
  blend_dest = false,
317
358
  side = this.sidemap[this.properties.cull_face],
318
- textureasset;
359
+ textureasset,
360
+ lightmaptextureasset,
361
+ emissivetextureasset,
362
+ roughnesstextureasset,
363
+ metalnesstextureasset;
319
364
 
320
365
  this.textureNeedsUpdate = false;
321
366
 
@@ -362,10 +407,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
362
407
  if (textureasset) {
363
408
  texture = textureasset.getInstance();
364
409
  this.textureasset = textureasset;
365
- if (!this.assetloadhandlers[image_id]) {
366
- this.assetloadhandlers[image_id] = true;
410
+ if (!this.assetloadhandlers[texture.uuid]) {
411
+ this.assetloadhandlers[texture.uuid] = true;
367
412
  elation.events.add(textureasset, 'asset_load', this.refresh);
368
- elation.events.add(texture, 'update', this.refresh);
413
+ elation.events.add(texture, 'asset_update', this.refresh);
369
414
  }
370
415
 
371
416
  //texture.offset.copy(this.texture_offset);
@@ -391,10 +436,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
391
436
  let normaltextureasset = this.getAsset('image', normal_image_id, true);
392
437
  if (normaltextureasset) {
393
438
  textureNormal = normaltextureasset.getInstance();
394
- if (!this.assetloadhandlers[normal_image_id]) {
395
- this.assetloadhandlers[normal_image_id] = true;
439
+ if (!this.assetloadhandlers[textureNormal.uuid]) {
440
+ this.assetloadhandlers[textureNormal.uuid] = true;
396
441
  elation.events.add(textureNormal, 'asset_load', elation.bind(this, this.refresh));
397
- elation.events.add(textureNormal, 'update', elation.bind(this, this.refresh));
442
+ elation.events.add(textureNormal, 'asset_update', elation.bind(this, this.refresh));
398
443
  }
399
444
 
400
445
  if (normaltextureasset.sbs3d) {
@@ -413,10 +458,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
413
458
  let bumptextureasset = this.getAsset('image', bump_image_id, true);
414
459
  if (bumptextureasset) {
415
460
  textureBump = bumptextureasset.getInstance();
416
- if (!this.assetloadhandlers[bump_image_id]) {
417
- this.assetloadhandlers[bump_image_id] = true;
461
+ if (!this.assetloadhandlers[textureBump.uuid]) {
462
+ this.assetloadhandlers[textureBump.uuid] = true;
418
463
  elation.events.add(bumptextureasset, 'asset_load', elation.bind(this, this.refresh));
419
- elation.events.add(textureBump, 'update', elation.bind(this, this.refresh));
464
+ elation.events.add(textureBump, 'asset_update', elation.bind(this, this.refresh));
420
465
  }
421
466
  if (bumptextureasset.sbs3d) {
422
467
  textureBump.repeat.set(0.5, 1);
@@ -434,10 +479,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
434
479
  let alphatextureasset = this.getAsset('image', alpha_image_id, true);
435
480
  if (alphatextureasset) {
436
481
  textureAlpha = alphatextureasset.getInstance();
437
- if (!this.assetloadhandlers[alpha_image_id]) {
438
- this.assetloadhandlers[alpha_image_id] = true;
482
+ if (!this.assetloadhandlers[textureAlpha.uuid]) {
483
+ this.assetloadhandlers[textureAlpha.uuid] = true;
439
484
  elation.events.add(alphatextureasset, 'asset_load', elation.bind(this, this.refresh));
440
- elation.events.add(textureAlpha, 'update', elation.bind(this, this.refresh));
485
+ elation.events.add(textureAlpha, 'asset_update', elation.bind(this, this.refresh));
441
486
  }
442
487
  if (alphatextureasset.sbs3d) {
443
488
  textureAlpha.repeat.set(0.5, 1);
@@ -455,10 +500,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
455
500
  }
456
501
  if (displacementtextureasset) {
457
502
  textureDisplacement = displacementtextureasset.getInstance();
458
- if (!this.assetloadhandlers[displacement_image_id]) {
459
- this.assetloadhandlers[displacement_image_id] = true;
503
+ if (!this.assetloadhandlers[textureDisplacement.uuid]) {
504
+ this.assetloadhandlers[textureDisplacement.uuid] = true;
460
505
  elation.events.add(displacementtextureasset, 'asset_load', elation.bind(this, this.refresh));
461
- elation.events.add(textureDisplacement, 'update', elation.bind(this, this.refresh));
506
+ elation.events.add(textureDisplacement, 'asset_update', elation.bind(this, this.refresh));
462
507
  }
463
508
  if (displacementtextureasset.sbs3d) {
464
509
  textureDisplacement.repeat.set(0.5, 1);
@@ -476,10 +521,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
476
521
  lightmaptextureasset = this.getAsset('image', lightmap_image_id);
477
522
  if (lightmaptextureasset) {
478
523
  textureLightmap = lightmaptextureasset.getInstance();
479
- if (!this.assetloadhandlers[lightmap_image_id]) {
480
- this.assetloadhandlers[lightmap_image_id] = true;
524
+ if (!this.assetloadhandlers[textureLightmap.uuid]) {
525
+ this.assetloadhandlers[textureLightmap.uuid] = true;
481
526
  elation.events.add(lightmaptextureasset, 'asset_load', elation.bind(this, this.setTextureDirty));
482
- elation.events.add(textureLightmap, 'update', elation.bind(this, this.refresh));
527
+ elation.events.add(textureLightmap, 'asset_update', elation.bind(this, this.refresh));
483
528
  }
484
529
 
485
530
  if (textureLightmap) {
@@ -494,10 +539,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
494
539
  }
495
540
  if (emissivetextureasset) {
496
541
  textureEmissive = emissivetextureasset.getInstance();
497
- if (!this.assetloadhandlers[emissive_image_id]) {
498
- this.assetloadhandlers[emissive_image_id] = true;
542
+ if (!this.assetloadhandlers[textureEmissive.uuid]) {
543
+ this.assetloadhandlers[textureEmissive.uuid] = true;
499
544
  elation.events.add(emissivetextureasset, 'asset_load', elation.bind(this, this.setTextureDirty));
500
- elation.events.add(textureEmissive, 'update', elation.bind(this, this.refresh));
545
+ elation.events.add(textureEmissive, 'asset_update', elation.bind(this, this.refresh));
501
546
  }
502
547
 
503
548
  if (textureEmissive) {
@@ -509,10 +554,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
509
554
  roughnesstextureasset = this.getAsset('image', roughness_image_id);
510
555
  if (roughnesstextureasset) {
511
556
  textureRoughness = roughnesstextureasset.getInstance();
512
- if (!this.assetloadhandlers[roughness_image_id]) {
513
- this.assetloadhandlers[roughness_image_id] = true;
557
+ if (!this.assetloadhandlers[textureRoughness.uuid]) {
558
+ this.assetloadhandlers[textureRoughness.uuid] = true;
514
559
  elation.events.add(roughnesstextureasset, 'asset_load', elation.bind(this, this.setTextureDirty));
515
- elation.events.add(textureRoughness, 'update', elation.bind(this, this.refresh));
560
+ elation.events.add(textureRoughness, 'asset_update', elation.bind(this, this.refresh));
516
561
  }
517
562
 
518
563
  if (textureRoughness) {
@@ -524,10 +569,10 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
524
569
  metalnesstextureasset = this.getAsset('image', metalness_image_id);
525
570
  if (metalnesstextureasset) {
526
571
  textureMetalness = metalnesstextureasset.getInstance();
527
- if (!this.assetloadhandlers[metalness_image_id]) {
528
- this.assetloadhandlers[metalness_image_id] = true;
572
+ if (!this.assetloadhandlers[textureMetalness.uuid]) {
573
+ this.assetloadhandlers[textureMetalness.uuid] = true;
529
574
  elation.events.add(metalnesstextureasset, 'asset_load', elation.bind(this, this.setTextureDirty));
530
- elation.events.add(textureMetalness, 'update', elation.bind(this, this.refresh));
575
+ elation.events.add(textureMetalness, 'asset_update', elation.bind(this, this.refresh));
531
576
  }
532
577
 
533
578
  if (textureMetalness) {
@@ -567,18 +612,7 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
567
612
  //color.setRGB(col.x, col.y, col.z);
568
613
  }
569
614
  */
570
- var srcfactors = {
571
- 'zero': THREE.ZeroFactor,
572
- 'one': THREE.OneFactor,
573
- 'src_color': THREE.SrcColorFactor,
574
- 'dst_color': THREE.DstColorFactor,
575
- 'src_alpha': THREE.SrcAlphaFactor,
576
- 'dst_alpha': THREE.DstAlphaFactor,
577
- 'one_minus_src_color': THREE.OneMinusSrcColorFactor,
578
- 'one_minus_src_alpha': THREE.OneMinusSrcAlphaFactor,
579
- 'one_minus_dst_color': THREE.OneMinusDstColorFactor,
580
- 'one_minus_dst_alpha': THREE.OneMinusDstAlphaFactor,
581
- }
615
+ let srcfactors = this.blendFactorsMap;
582
616
  if (srcfactors[this.properties.blend_src]) {
583
617
  blend_src = srcfactors[this.properties.blend_src];
584
618
  }
@@ -619,6 +653,9 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
619
653
  if (this.depth_test !== null) {
620
654
  shadermaterial.depthTest = this.depth_test;
621
655
  }
656
+ if (this.color_write !== null) {
657
+ shadermaterial.colorWrite = this.color_write;
658
+ }
622
659
  this.traverseObjects((n) => {
623
660
  if (n.material) {
624
661
  if (Array.isArray(n.material)) {
@@ -685,13 +722,16 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
685
722
  //if (!color) m.color.setHex(0xffffff);
686
723
  m.map = texture;
687
724
  texture.encoding = THREE.sRGBEncoding;
688
- elation.events.add(texture, 'asset_update', (ev) => {
689
- m.map = ev.data;
690
- this.updateTextureOffsets();
691
- this.refresh();
692
- });
725
+ if (false && !this.assetloadhandlers[texture.uuid]) {
726
+ this.assetloadhandlers[texture.uuid] = true;
727
+ elation.events.add(texture, 'asset_update', (ev) => {
728
+ m.map = ev.data;
729
+ this.updateTextureOffsets();
730
+ this.refresh();
731
+ });
732
+ }
693
733
 
694
- m.transparent = (textureasset && textureasset.hasalpha) || m.opacity < 1;
734
+ m.transparent = (this.transparent !== null ? this.transparent : (textureasset && textureasset.hasalpha) || m.opacity < 1);
695
735
  } else if (m.map && m.map.sourceFile) {
696
736
  var imagesrc = m.map.sourceFile;
697
737
  var asset = this.getAsset('image', imagesrc, true);
@@ -702,18 +742,21 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
702
742
  }
703
743
  m.map = asset.getInstance();
704
744
  m.map.encoding = THREE.sRGBEncoding;
705
- elation.events.add(m.map, 'asset_update', elation.bind(this, function(ev) {
706
- m.map = ev.data;
707
- this.updateTextureOffsets();
708
- }));
709
- elation.events.add(asset, 'asset_load', elation.bind(this, function(m, asset, ev) {
710
- if (asset.hasalpha && !m.transparent) {
711
- m.transparent = true;
712
- m.alphaTest = this.alphatest;
713
- //m.needsUpdate = true;
714
- }
715
- this.refresh();
716
- }, m, asset));
745
+ if (!this.assetloadhandlers[m.map.uuid]) {
746
+ this.assetloadhandlers[m.map.uuid] = true;
747
+ elation.events.add(m.map, 'asset_update', elation.bind(this, function(ev) {
748
+ m.map = ev.data;
749
+ this.updateTextureOffsets();
750
+ }));
751
+ elation.events.add(asset, 'asset_load', elation.bind(this, function(m, asset, ev) {
752
+ if (asset.hasalpha && !m.transparent) {
753
+ m.transparent = true;
754
+ m.alphaTest = this.alphatest;
755
+ //m.needsUpdate = true;
756
+ }
757
+ this.refresh();
758
+ }, m, asset));
759
+ }
717
760
  }
718
761
  if (m.map) {
719
762
  this.assignTextureParameters(m.map, modelasset, asset);
@@ -725,11 +768,14 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
725
768
  if (asset) {
726
769
  m.normalMap = asset.getInstance();
727
770
  m.normalMap = asset.getInstance();
728
- elation.events.add(m.normalMap, 'asset_update', elation.bind(this, function(ev) {
729
- m.normalMap = ev.data; this.refresh();
730
- this.updateTextureOffsets();
731
- }));
732
- elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
771
+ if (!this.assetloadhandlers[m.normalMap.uuid]) {
772
+ this.assetloadhandlers[m.normalMap.uuid] = true;
773
+ elation.events.add(m.normalMap, 'asset_update', elation.bind(this, function(ev) {
774
+ m.normalMap = ev.data; this.refresh();
775
+ this.updateTextureOffsets();
776
+ }));
777
+ elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
778
+ }
733
779
  }
734
780
  } else if (textureBump) {
735
781
  m.bumpMap = textureBump;
@@ -740,13 +786,16 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
740
786
  if (asset) {
741
787
  m.normalMap = asset.getInstance();
742
788
  m.normalMap = asset.getInstance();
743
- elation.events.add(m.bumpMap, 'asset_update', elation.bind(this, function(ev) {
744
- m.normalMap = ev.data; this.refresh();
745
- m.normalMap.offset.copy(this.texture_offset);
746
- m.normalMap.repeat.copy(this.texture_repeat);
747
- m.normalMap.rotation = this.texture_rotation * THREE.Math.DEG2RAD;
748
- }));
749
- elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
789
+ if (!this.assetloadhandlers[m.normalMap.uuid]) {
790
+ this.assetloadhandlers[m.normalMap.uuid] = true;
791
+ elation.events.add(m.bumpMap, 'asset_update', elation.bind(this, function(ev) {
792
+ m.normalMap = ev.data; this.refresh();
793
+ m.normalMap.offset.copy(this.texture_offset);
794
+ m.normalMap.repeat.copy(this.texture_repeat);
795
+ m.normalMap.rotation = this.texture_rotation * THREE.Math.DEG2RAD;
796
+ }));
797
+ elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
798
+ }
750
799
  }
751
800
  }
752
801
  if (textureNormal) {
@@ -756,8 +805,11 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
756
805
  var asset = this.getAsset('image', imagesrc, {id: imagesrc, src: imagesrc, hasalpha: false});
757
806
  if (asset) {
758
807
  m.normalMap = asset.getInstance();
759
- elation.events.add(m.normalMap, 'asset_update', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
760
- elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
808
+ if (!this.assetloadhandlers[m.normalMap.uuid]) {
809
+ this.assetloadhandlers[m.normalMap.uuid] = true;
810
+ elation.events.add(m.normalMap, 'asset_update', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
811
+ elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.normalMap = ev.data; this.refresh(); }));
812
+ }
761
813
  }
762
814
  }
763
815
 
@@ -766,14 +818,20 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
766
818
  m.lightMap = textureLightmap;
767
819
  } else {
768
820
  }
769
- elation.events.add(textureLightmap, 'asset_update', elation.bind(m, function(ev) { m.lightMap = ev.data; this.refresh(); }));
821
+ if (!this.assetloadhandlers[m.lightMap.uuid]) {
822
+ this.assetloadhandlers[m.lightMap.uuid] = true;
823
+ elation.events.add(textureLightmap, 'asset_update', elation.bind(m, function(ev) { m.lightMap = ev.data; this.refresh(); }));
824
+ }
770
825
  } else if (m.lightMap) {
771
826
  var imagesrc = m.lightMap.sourceFile;
772
- var asset = this.getAsset('image', imagesrc, {id: imagesrc, src: imagesrc, hasalpha: false});
773
- if (asset) {
774
- m.lightMap = asset.getInstance();
775
- elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.lightMap = ev.data; this.refresh();}));
776
- elation.events.add(m.lightMap, 'asset_update', elation.bind(this, function(ev) { m.lightMap = ev.data; this.refresh(); }));
827
+ if (!this.assetloadhandlers[m.lightMap.uuid]) {
828
+ this.assetloadhandlers[m.lightMap.uuid] = true;
829
+ var asset = this.getAsset('image', imagesrc, {id: imagesrc, src: imagesrc, hasalpha: false});
830
+ if (asset) {
831
+ m.lightMap = asset.getInstance();
832
+ elation.events.add(asset, 'asset_load', elation.bind(this, function(ev) { m.lightMap = ev.data; this.refresh();}));
833
+ elation.events.add(m.lightMap, 'asset_update', elation.bind(this, function(ev) { m.lightMap = ev.data; this.refresh(); }));
834
+ }
777
835
  }
778
836
  }
779
837
  if (textureDisplacement) {
@@ -831,6 +889,21 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
831
889
  if (this.depth_test !== null) {
832
890
  m.depthTest = this.depth_test;
833
891
  }
892
+ if (this.depth_func !== null) {
893
+ m.depthFunc = this.depthFuncMap[this.depth_func];
894
+ } else {
895
+ m.depthFunc = this.depthFuncMap['lessequal'];
896
+ }
897
+ if (this.depth_offset !== null) {
898
+ m.polygonOffset = true;
899
+ m.polygonOffsetUnits = 1;
900
+ m.polygonOffsetFactor = -this.depth_offset;
901
+ } else {
902
+ m.polygonOffset = false;
903
+ }
904
+ if (this.color_write !== null) {
905
+ m.colorWrite = this.color_write;
906
+ }
834
907
  // If our diffuse texture has an alpha channel, set up a customDepthMaterial / customDistanceMaterial to allow shadows to work
835
908
  if (m.map) { //this.shadow && m.transparent && m.map) {
836
909
  if (!n.customDepthMaterial) {
@@ -1361,8 +1434,12 @@ elation.require(['janusweb.janusbase', 'janusweb.websurface'], function() {
1361
1434
  cull_face: [ 'property', 'cull_face' ],
1362
1435
  blend_src: [ 'property', 'blend_src' ],
1363
1436
  blend_dest: [ 'property', 'blend_dest' ],
1437
+ blend_mode: [ 'property', 'blend_mode' ],
1364
1438
  depth_write: [ 'property', 'depth_write' ],
1365
1439
  depth_test: [ 'property', 'depth_test' ],
1440
+ depth_offset: [ 'property', 'depth_offset' ],
1441
+ depth_func: [ 'property', 'depth_func' ],
1442
+ color_write: [ 'property', 'color_write' ],
1366
1443
 
1367
1444
  wireframe: [ 'property', 'wireframe'],
1368
1445
  fog: [ 'property', 'fog'],
package/scripts/portal.js CHANGED
@@ -2,13 +2,12 @@ elation.require(['janusweb.janusbase'], function() {
2
2
  elation.component.add('engine.things.janusportal', function() {
3
3
  this.postinit = function() {
4
4
  this.defineProperties({
5
- 'url': { type: 'string' },
5
+ 'url': { type: 'string', set: this.updateTitle },
6
6
  'title': { type: 'string' },
7
7
  'janus': { type: 'object' },
8
8
  'room': { type: 'object' },
9
9
  //'color': { type: 'color', default: new THREE.Color(0xffffff), set: this.updateMaterial },
10
10
  'size': { type: 'vector3', default: new THREE.Vector3(1.4,2.2,1), set: this.updateGeometry },
11
- 'url': { type: 'string', set: this.updateTitle },
12
11
  'open': { type: 'boolean', default: false },
13
12
  'collision_id': { type: 'string', default: 'cube', set: this.updateCollider },
14
13
  'collision_scale': { type: 'vector3', set: this.updateCollider },
@@ -333,7 +332,7 @@ elation.require(['janusweb.janusbase'], function() {
333
332
  console.log('load that room', this.portalroom);
334
333
 
335
334
  var scene = new THREE.Scene();
336
- scene.background = this.portalroom.skyboxtexture
335
+ scene.background = this.portalroom.skyboxtexture;
337
336
  scene.add(this.portalroom.objects['3d']);
338
337
  this.scene = scene;
339
338
  this.scene.updateMatrixWorld(true);