@xeokit/xeokit-sdk 2.2.2 → 2.2.5-beta

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.
@@ -2716,30 +2716,6 @@ const math = {
2716
2716
  * @param z
2717
2717
  * @param m
2718
2718
  */
2719
- OLDtranslateMat4c(x, y, z, m) {
2720
-
2721
- const m12 = m[12];
2722
- m[0] += m12 * x;
2723
- m[4] += m12 * y;
2724
- m[8] += m12 * z;
2725
-
2726
- const m13 = m[13];
2727
- m[1] += m13 * x;
2728
- m[5] += m13 * y;
2729
- m[9] += m13 * z;
2730
-
2731
- const m14 = m[14];
2732
- m[2] += m14 * x;
2733
- m[6] += m14 * y;
2734
- m[10] += m14 * z;
2735
-
2736
- const m15 = m[15];
2737
- m[3] += m15 * x;
2738
- m[7] += m15 * y;
2739
- m[11] += m15 * z;
2740
-
2741
- return m;
2742
- },
2743
2719
 
2744
2720
  translateMat4c(x, y, z, m) {
2745
2721
 
@@ -8165,6 +8141,8 @@ class PerformanceNode {
8165
8141
  this._offsetAABB = math.AABB3(aabb);
8166
8142
 
8167
8143
  this._offset = math.vec3();
8144
+ this._colorizeUpdated = false;
8145
+ this._opacityUpdated = false;
8168
8146
 
8169
8147
  if (this._isObject) {
8170
8148
  model.scene._registerObject(this);
@@ -8577,6 +8555,7 @@ class PerformanceNode {
8577
8555
  if (this._isObject) {
8578
8556
  const colorized = (!!color);
8579
8557
  this.scene._objectColorizeUpdated(this, colorized);
8558
+ this._colorizeUpdated = colorized;
8580
8559
  }
8581
8560
  this.model.glRedraw();
8582
8561
  }
@@ -8631,6 +8610,7 @@ class PerformanceNode {
8631
8610
  }
8632
8611
  if (this._isObject) {
8633
8612
  this.scene._objectOpacityUpdated(this, opacityUpdated);
8613
+ this._opacityUpdated = opacityUpdated;
8634
8614
  }
8635
8615
  this.model.glRedraw();
8636
8616
  }
@@ -8777,8 +8757,12 @@ class PerformanceNode {
8777
8757
  if (this.highlighted) {
8778
8758
  scene._objectHighlightedUpdated(this);
8779
8759
  }
8780
- this.scene._objectColorizeUpdated(this, false);
8781
- this.scene._objectOpacityUpdated(this, false);
8760
+ if (this._opacityUpdated) {
8761
+ this.scene._objectColorizeUpdated(this, false);
8762
+ }
8763
+ if (this._opacityUpdated) {
8764
+ this.scene._objectOpacityUpdated(this, false);
8765
+ }
8782
8766
  this.scene._objectOffsetUpdated(this, false);
8783
8767
  }
8784
8768
  for (let i = 0, len = this.meshes.length; i < len; i++) {
@@ -12146,7 +12130,7 @@ class Canvas extends Component {
12146
12130
  * @event boundary
12147
12131
  * @param value The property's new value
12148
12132
  */
12149
- if (!newResolutionScale) {
12133
+ if (!newResolutionScale || newCanvasSize) {
12150
12134
  this.fire("boundary", boundary);
12151
12135
  }
12152
12136
 
@@ -15974,7 +15958,9 @@ const Renderer = function (scene, options) {
15974
15958
 
15975
15959
  if (highlightedFillOpaqueBinLen > 0 || highlightedEdgesOpaqueBinLen > 0) {
15976
15960
  frameCtx.lastProgramId = null;
15977
- gl.clear(gl.DEPTH_BUFFER_BIT);
15961
+ if ( scene.highlightMaterial.glowThrough) {
15962
+ gl.clear(gl.DEPTH_BUFFER_BIT);
15963
+ }
15978
15964
  if (highlightedEdgesOpaqueBinLen > 0) {
15979
15965
  for (i = 0; i < highlightedEdgesOpaqueBinLen; i++) {
15980
15966
  highlightedEdgesOpaqueBin[i].drawEdgesHighlighted(frameCtx);
@@ -15989,17 +15975,17 @@ const Renderer = function (scene, options) {
15989
15975
 
15990
15976
  if (highlightedFillTransparentBinLen > 0 || highlightedEdgesTransparentBinLen > 0 || highlightedFillOpaqueBinLen > 0) {
15991
15977
  frameCtx.lastProgramId = null;
15992
- gl.clear(gl.DEPTH_BUFFER_BIT);
15993
- gl.enable(gl.CULL_FACE);
15978
+ if (scene.selectedMaterial.glowThrough) {
15979
+ gl.clear(gl.DEPTH_BUFFER_BIT);
15980
+ }
15994
15981
  gl.enable(gl.BLEND);
15995
-
15996
15982
  if (canvasTransparent) {
15997
15983
  gl.blendEquation(gl.FUNC_ADD);
15998
15984
  gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
15999
15985
  } else {
16000
15986
  gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
16001
15987
  }
16002
-
15988
+ gl.enable(gl.CULL_FACE);
16003
15989
  if (highlightedEdgesTransparentBinLen > 0) {
16004
15990
  for (i = 0; i < highlightedEdgesTransparentBinLen; i++) {
16005
15991
  highlightedEdgesTransparentBin[i].drawEdgesHighlighted(frameCtx);
@@ -16015,7 +16001,9 @@ const Renderer = function (scene, options) {
16015
16001
 
16016
16002
  if (selectedFillOpaqueBinLen > 0 || selectedEdgesOpaqueBinLen > 0) {
16017
16003
  frameCtx.lastProgramId = null;
16018
- gl.clear(gl.DEPTH_BUFFER_BIT);
16004
+ if (scene.selectedMaterial.glowThrough) {
16005
+ gl.clear(gl.DEPTH_BUFFER_BIT);
16006
+ }
16019
16007
  if (selectedEdgesOpaqueBinLen > 0) {
16020
16008
  for (i = 0; i < selectedEdgesOpaqueBinLen; i++) {
16021
16009
  selectedEdgesOpaqueBin[i].drawEdgesSelected(frameCtx);
@@ -16030,10 +16018,11 @@ const Renderer = function (scene, options) {
16030
16018
 
16031
16019
  if (selectedFillTransparentBinLen > 0 || selectedEdgesTransparentBinLen > 0) {
16032
16020
  frameCtx.lastProgramId = null;
16033
- gl.clear(gl.DEPTH_BUFFER_BIT);
16021
+ if (scene.selectedMaterial.glowThrough) {
16022
+ gl.clear(gl.DEPTH_BUFFER_BIT);
16023
+ }
16034
16024
  gl.enable(gl.CULL_FACE);
16035
16025
  gl.enable(gl.BLEND);
16036
-
16037
16026
  if (canvasTransparent) {
16038
16027
  gl.blendEquation(gl.FUNC_ADD);
16039
16028
  gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
@@ -23178,6 +23167,7 @@ class EmphasisMaterial extends Material {
23178
23167
  * @param {Number} [cfg.edgeWidth=1] Width of xray edges, in pixels.
23179
23168
  * @param {String} [cfg.preset] Selects a preset EmphasisMaterial configuration - see {@link EmphasisMaterial#presets}.
23180
23169
  * @param {Boolean} [cfg.backfaces=false] Whether to render geometry backfaces when emphasising.
23170
+ * @param {Boolean} [cfg.glowThrough=true] Whether to make the emphasized object appear to float on top of other objects, as if it were "glowing through" them.
23181
23171
  */
23182
23172
  constructor(owner, cfg = {}) {
23183
23173
 
@@ -23192,7 +23182,8 @@ class EmphasisMaterial extends Material {
23192
23182
  edgeColor: null,
23193
23183
  edgeAlpha: null,
23194
23184
  edgeWidth: null,
23195
- backfaces: true
23185
+ backfaces: true,
23186
+ glowThrough: true
23196
23187
  });
23197
23188
 
23198
23189
  this._preset = "default";
@@ -23223,6 +23214,9 @@ class EmphasisMaterial extends Material {
23223
23214
  if (cfg.backfaces !== undefined) {
23224
23215
  this.backfaces = cfg.backfaces;
23225
23216
  }
23217
+ if (cfg.glowThrough !== undefined) {
23218
+ this.glowThrough = cfg.glowThrough;
23219
+ }
23226
23220
  } else {
23227
23221
  this.fill = cfg.fill;
23228
23222
  this.fillColor = cfg.fillColor;
@@ -23232,6 +23226,7 @@ class EmphasisMaterial extends Material {
23232
23226
  this.edgeAlpha = cfg.edgeAlpha;
23233
23227
  this.edgeWidth = cfg.edgeWidth;
23234
23228
  this.backfaces = cfg.backfaces;
23229
+ this.glowThrough = cfg.glowThrough;
23235
23230
  }
23236
23231
  }
23237
23232
 
@@ -23453,7 +23448,7 @@ class EmphasisMaterial extends Material {
23453
23448
  }
23454
23449
 
23455
23450
  /**
23456
- * Sets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````..
23451
+ * Sets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````.
23457
23452
  *
23458
23453
  * Default is ````false````.
23459
23454
  *
@@ -23469,9 +23464,9 @@ class EmphasisMaterial extends Material {
23469
23464
  }
23470
23465
 
23471
23466
  /**
23472
- * Gets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````..
23467
+ * Gets whether to render backfaces when {@link EmphasisMaterial#fill} is ````true````.
23473
23468
  *
23474
- * Default is ````false````.
23469
+ * Default is ````true````.
23475
23470
  *
23476
23471
  * @type {Boolean}
23477
23472
  */
@@ -23479,6 +23474,35 @@ class EmphasisMaterial extends Material {
23479
23474
  return this._state.backfaces;
23480
23475
  }
23481
23476
 
23477
+ /**
23478
+ * Sets whether to render emphasized objects over the top of other objects, as if they were "glowing through".
23479
+ *
23480
+ * Default is ````true````.
23481
+ *
23482
+ * Note: updating this property will not affect the appearance of objects that are already emphasized.
23483
+ *
23484
+ * @type {Boolean}
23485
+ */
23486
+ set glowThrough(value) {
23487
+ value = (value !== false);
23488
+ if (this._state.glowThrough === value) {
23489
+ return;
23490
+ }
23491
+ this._state.glowThrough = value;
23492
+ this.glRedraw();
23493
+ }
23494
+
23495
+ /**
23496
+ * Sets whether to render emphasized objects over the top of other objects, as if they were "glowing through".
23497
+ *
23498
+ * Default is ````true````.
23499
+ *
23500
+ * @type {Boolean}
23501
+ */
23502
+ get glowThrough() {
23503
+ return this._state.glowThrough;
23504
+ }
23505
+
23482
23506
  /**
23483
23507
  * Selects a preset EmphasisMaterial configuration.
23484
23508
  *
@@ -23503,6 +23527,7 @@ class EmphasisMaterial extends Material {
23503
23527
  this.edgeColor = preset.edgeColor;
23504
23528
  this.edgeAlpha = preset.edgeAlpha;
23505
23529
  this.edgeWidth = preset.edgeWidth;
23530
+ this.glowThrough = preset.glowThrough;
23506
23531
  this._preset = value;
23507
23532
  }
23508
23533
 
@@ -27386,7 +27411,7 @@ class Scene extends Component {
27386
27411
  * registered by {@link Entity#id} in {@link Scene#visibleObjects}.
27387
27412
  *
27388
27413
  * @param {String[]} ids Array of {@link Entity#id} values.
27389
- * @param {Boolean} visible Whether or not to cull.
27414
+ * @param {Boolean} visible Whether or not to set visible.
27390
27415
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
27391
27416
  */
27392
27417
  setObjectsVisible(ids, visible) {
@@ -27403,7 +27428,7 @@ class Scene extends Component {
27403
27428
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
27404
27429
  *
27405
27430
  * @param {String[]} ids Array of {@link Entity#id} values.
27406
- * @param {Boolean} collidable Whether or not to cull.
27431
+ * @param {Boolean} collidable Whether or not to set collidable.
27407
27432
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
27408
27433
  */
27409
27434
  setObjectsCollidable(ids, collidable) {
@@ -27424,7 +27449,7 @@ class Scene extends Component {
27424
27449
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
27425
27450
  */
27426
27451
  setObjectsCulled(ids, culled) {
27427
- return this.withObjects(ids, this.objects, entity => {
27452
+ return this.withObjects(ids, entity => {
27428
27453
  const changed = (entity.culled !== culled);
27429
27454
  entity.culled = culled;
27430
27455
  return changed;
@@ -27440,7 +27465,7 @@ class Scene extends Component {
27440
27465
  * registered by {@link Entity#id} in {@link Scene#selectedObjects}.
27441
27466
  *
27442
27467
  * @param {String[]} ids Array of {@link Entity#id} values.
27443
- * @param {Boolean} selected Whether or not to highlight.
27468
+ * @param {Boolean} selected Whether or not to select.
27444
27469
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
27445
27470
  */
27446
27471
  setObjectsSelected(ids, selected) {
@@ -27476,9 +27501,6 @@ class Scene extends Component {
27476
27501
  *
27477
27502
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
27478
27503
  *
27479
- * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#xrayed} are ````true```` is
27480
- * registered by {@link Entity#id} in {@link Scene#xrayedObjects}.
27481
- *
27482
27504
  * @param {String[]} ids Array of {@link Entity#id} values.
27483
27505
  * @param {Boolean} xrayed Whether or not to xray.
27484
27506
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
@@ -27546,7 +27568,7 @@ class Scene extends Component {
27546
27568
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
27547
27569
  *
27548
27570
  * @param {String[]} ids Array of {@link Entity#id} values.
27549
- * @param {Boolean} pickable Whether or not to enable picking.
27571
+ * @param {Boolean} pickable Whether or not to set pickable.
27550
27572
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
27551
27573
  */
27552
27574
  setObjectsPickable(ids, pickable) {
@@ -27572,13 +27594,10 @@ class Scene extends Component {
27572
27594
  }
27573
27595
 
27574
27596
  /**
27575
- * Iterates with a callback over {@link Entity#visible} on {@link Entity}s that represent objects.
27597
+ * Iterates with a callback over {@link Entity}s that represent objects.
27576
27598
  *
27577
27599
  * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
27578
27600
  *
27579
- * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#visible} are ````true```` is
27580
- * registered by {@link Entity#id} in {@link Scene#visibleObjects}.
27581
- *
27582
27601
  * @param {String[]} ids Array of {@link Entity#id} values.
27583
27602
  * @param {Function} callback Callback to execute on eacn {@link Entity}.
27584
27603
  * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
@@ -46549,7 +46568,7 @@ class TrianglesBatchingLayer {
46549
46568
  // Color
46550
46569
 
46551
46570
  let f0;
46552
- if (!visible || culled || xrayed) { // Highlight & select are layered on top of color - not mutually exclusive
46571
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
46553
46572
  f0 = RENDER_PASSES.NOT_RENDERED;
46554
46573
  } else {
46555
46574
  if (transparent) {
@@ -53666,7 +53685,7 @@ class TrianglesInstancingLayer {
53666
53685
  // Normal fill
53667
53686
 
53668
53687
  let f0;
53669
- if (!visible || culled || xrayed) { // Highlight & select are layered on top of color - not mutually exclusive
53688
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
53670
53689
  f0 = RENDER_PASSES.NOT_RENDERED;
53671
53690
  } else {
53672
53691
  if (meshTransparent) {
@@ -55416,7 +55435,7 @@ class LinesBatchingLayer {
55416
55435
  // Color
55417
55436
 
55418
55437
  let f0;
55419
- if (!visible || culled || xrayed) {
55438
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
55420
55439
  f0 = RENDER_PASSES.NOT_RENDERED;
55421
55440
  } else {
55422
55441
  if (transparent) {
@@ -56883,7 +56902,7 @@ class LinesInstancingLayer {
56883
56902
  // Normal fill
56884
56903
 
56885
56904
  let f0;
56886
- if (!visible || culled || xrayed) {
56905
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
56887
56906
  f0 = RENDER_PASSES.NOT_RENDERED;
56888
56907
  } else {
56889
56908
  if (meshTransparent) {
@@ -59449,7 +59468,7 @@ class PointsBatchingLayer {
59449
59468
  // Normal fill
59450
59469
 
59451
59470
  let f0;
59452
- if (!visible || culled || xrayed) {
59471
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
59453
59472
  f0 = RENDER_PASSES.NOT_RENDERED;
59454
59473
  } else {
59455
59474
  if (transparent) {
@@ -62842,7 +62861,7 @@ class PointsInstancingLayer {
62842
62861
  // Normal fill
62843
62862
 
62844
62863
  let f0;
62845
- if (!visible || culled || xrayed) {
62864
+ if (!visible || culled || xrayed || (highlighted && !this.model.scene.highlightMaterial.glowThrough) || (selected && !this.model.scene.selectedMaterial.glowThrough)) { // Highlight & select are layered on top of color - not mutually exclusive
62846
62865
  f0 = RENDER_PASSES.NOT_RENDERED;
62847
62866
  } else {
62848
62867
  if (meshTransparent) {