@xeokit/xeokit-sdk 2.4.0-alpha-5 → 2.4.0-alpha-7

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.
@@ -8212,7 +8212,7 @@ const tempIntRGB$1 = new Uint16Array([0, 0, 0]);
8212
8212
  /**
8213
8213
  * @private
8214
8214
  */
8215
- class VBOSceneModelNode$1 {
8215
+ class VBOSceneModelNode {
8216
8216
 
8217
8217
  /**
8218
8218
  * @private
@@ -9263,7 +9263,7 @@ class Marker extends Component {
9263
9263
  }
9264
9264
  this._entity = entity;
9265
9265
  if (this._entity) {
9266
- if (this._entity instanceof VBOSceneModelNode$1) {
9266
+ if (this._entity instanceof VBOSceneModelNode) {
9267
9267
  this._onEntityModelDestroyed = this._entity.model.on("destroyed", () => { // VBOSceneModelNode does not fire events, and cannot exist beyond its VBOSceneModel
9268
9268
  this._entity = null; // Marker now may become visible, if it was synched to invisible Entity
9269
9269
  this._onEntityModelDestroyed = null;
@@ -9474,6 +9474,7 @@ class Wire {
9474
9474
  wireStyle['-o-transform'] = 'rotate(0deg)';
9475
9475
  wireStyle['transform'] = 'rotate(0deg)';
9476
9476
  wireStyle["opacity"] = 1.0;
9477
+ wireStyle["pointer-events"] = "none";
9477
9478
  if (cfg.onContextMenu) ;
9478
9479
 
9479
9480
  parentElement.appendChild(wire);
@@ -9641,7 +9642,7 @@ class Dot {
9641
9642
  dotStyle.left = 0 + "px";
9642
9643
  dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
9643
9644
  dotStyle["opacity"] = 1.0;
9644
- dotStyle["pointer-events"] = "all";
9645
+ dotStyle["pointer-events"] = "none";
9645
9646
  if (cfg.onContextMenu) ;
9646
9647
  parentElement.appendChild(dot);
9647
9648
 
@@ -9719,7 +9720,6 @@ class Dot {
9719
9720
 
9720
9721
  setClickable(clickable) {
9721
9722
  this._dotClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
9722
- this._dot.style["pointer-events"] = (!!clickable) ? "all" : "none";
9723
9723
  }
9724
9724
 
9725
9725
  setHighlighted(highlighted) {
@@ -15105,7 +15105,9 @@ class SAOOcclusionRenderer {
15105
15105
 
15106
15106
  const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);
15107
15107
  const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);
15108
- const indices = new Uint8Array([0, 1, 2, 0, 2, 3]);
15108
+
15109
+ // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures
15110
+ const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);
15109
15111
 
15110
15112
  this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);
15111
15113
  this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);
@@ -15341,7 +15343,9 @@ class SAODepthLimitedBlurRenderer {
15341
15343
 
15342
15344
  const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);
15343
15345
  const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);
15344
- const indices = new Uint8Array([0, 1, 2, 0, 2, 3]);
15346
+
15347
+ // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures
15348
+ const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);
15345
15349
 
15346
15350
  this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);
15347
15351
  this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);
@@ -16211,7 +16215,7 @@ var buildEdgeIndices = (function () {
16211
16215
  * @private
16212
16216
  * @implements Pickable
16213
16217
  */
16214
- class VBOSceneModelMesh$1 {
16218
+ class DataTextureSceneModelMesh {
16215
16219
 
16216
16220
  constructor(model, id, color, opacity, layer = null, portionId = 0) {
16217
16221
 
@@ -16227,9 +16231,9 @@ class VBOSceneModelMesh$1 {
16227
16231
  this.model = model;
16228
16232
 
16229
16233
  /**
16230
- * The VBOSceneModelNode that contains this PerformanceModelMesh.
16234
+ * The DataTextureSceneModelNode that contains this PerformanceModelMesh.
16231
16235
  *
16232
- * A PerformanceModelMesh always belongs to exactly one VBOSceneModelNode.
16236
+ * A PerformanceModelMesh always belongs to exactly one DataTextureSceneModelNode.
16233
16237
  *
16234
16238
  * @property object
16235
16239
  * @type {VBOSceneModelNode}
@@ -16238,9 +16242,9 @@ class VBOSceneModelMesh$1 {
16238
16242
  this.object = null;
16239
16243
 
16240
16244
  /**
16241
- * The VBOSceneModelNode that contains this PerformanceModelMesh.
16245
+ * The DataTextureSceneModelNode that contains this PerformanceModelMesh.
16242
16246
  *
16243
- * A PerformanceModelMesh always belongs to exactly one VBOSceneModelNode.
16247
+ * A PerformanceModelMesh always belongs to exactly one DataTextureSceneModelNode.
16244
16248
  *
16245
16249
  * @property object
16246
16250
  * @type {VBOSceneModelNode}
@@ -16288,7 +16292,7 @@ class VBOSceneModelMesh$1 {
16288
16292
  this.numTriangles = 0;
16289
16293
 
16290
16294
  /**
16291
- * 3D origin of the VBOSceneModelMesh's vertex positions, if they are in relative-to-center (RTC) coordinates.
16295
+ * 3D origin of the DataTextureSceneModelMesh's vertex positions, if they are in relative-to-center (RTC) coordinates.
16292
16296
  *
16293
16297
  * When this is defined, then the positions are RTC, which means that they are relative to this position.
16294
16298
  *
@@ -16506,7 +16510,7 @@ const tempIntRGB = new Uint16Array([0, 0, 0]);
16506
16510
  /**
16507
16511
  * @private
16508
16512
  */
16509
- class VBOSceneModelNode {
16513
+ class DataTextureSceneModelNode {
16510
16514
 
16511
16515
  /**
16512
16516
  * @private
@@ -16516,7 +16520,7 @@ class VBOSceneModelNode {
16516
16520
  this._isObject = isObject;
16517
16521
 
16518
16522
  /**
16519
- * The {@link Scene} that contains this VBOSceneModelNode.
16523
+ * The {@link Scene} that contains this DataTextureSceneModelNode.
16520
16524
  *
16521
16525
  * @property scene
16522
16526
  * @type {Scene}
@@ -16525,7 +16529,7 @@ class VBOSceneModelNode {
16525
16529
  this.scene = model.scene;
16526
16530
 
16527
16531
  /**
16528
- * The VBOSceneModel that contains this VBOSceneModelNode.
16532
+ * The VBOSceneModel that contains this DataTextureSceneModelNode.
16529
16533
  * @property model
16530
16534
  * @type {VBOSceneModel}
16531
16535
  * @final
@@ -16533,7 +16537,7 @@ class VBOSceneModelNode {
16533
16537
  this.model = model;
16534
16538
 
16535
16539
  /**
16536
- * The PerformanceModelMesh instances contained by this VBOSceneModelNode
16540
+ * The PerformanceModelMesh instances contained by this DataTextureSceneModelNode
16537
16541
  * @property meshes
16538
16542
  * @type {{Array of PerformanceModelMesh}}
16539
16543
  * @final
@@ -16549,7 +16553,7 @@ class VBOSceneModelNode {
16549
16553
  }
16550
16554
 
16551
16555
  /**
16552
- * ID of this VBOSceneModelNode, unique within the {@link Scene}.
16556
+ * ID of this DataTextureSceneModelNode, unique within the {@link Scene}.
16553
16557
  * @property id
16554
16558
  * @type {String|Number}
16555
16559
  * @final
@@ -16587,7 +16591,7 @@ class VBOSceneModelNode {
16587
16591
  //------------------------------------------------------------------------------------------------------------------
16588
16592
 
16589
16593
  /**
16590
- * Returns true to indicate that VBOSceneModelNode is an {@link Entity}.
16594
+ * Returns true to indicate that DataTextureSceneModelNode is an {@link Entity}.
16591
16595
  * @type {Boolean}
16592
16596
  */
16593
16597
  get isEntity() {
@@ -16595,7 +16599,7 @@ class VBOSceneModelNode {
16595
16599
  }
16596
16600
 
16597
16601
  /**
16598
- * Always returns ````false```` because a VBOSceneModelNode can never represent a model.
16602
+ * Always returns ````false```` because a DataTextureSceneModelNode can never represent a model.
16599
16603
  *
16600
16604
  * @type {Boolean}
16601
16605
  */
@@ -16604,9 +16608,9 @@ class VBOSceneModelNode {
16604
16608
  }
16605
16609
 
16606
16610
  /**
16607
- * Returns ````true```` if this VBOSceneModelNode represents an object.
16611
+ * Returns ````true```` if this DataTextureSceneModelNode represents an object.
16608
16612
  *
16609
- * When ````true```` the VBOSceneModelNode will be registered by {@link VBOSceneModelNode#id} in
16613
+ * When ````true```` the DataTextureSceneModelNode will be registered by {@link DataTextureSceneModelNode#id} in
16610
16614
  * {@link Scene#objects} and may also have a {@link MetaObject} with matching {@link MetaObject#id}.
16611
16615
  *
16612
16616
  * @type {Boolean}
@@ -16616,7 +16620,7 @@ class VBOSceneModelNode {
16616
16620
  }
16617
16621
 
16618
16622
  /**
16619
- * World-space 3D axis-aligned bounding box (AABB) of this VBOSceneModelNode.
16623
+ * World-space 3D axis-aligned bounding box (AABB) of this DataTextureSceneModelNode.
16620
16624
  *
16621
16625
  * Represented by a six-element Float64Array containing the min/max extents of the
16622
16626
  * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
@@ -16628,7 +16632,7 @@ class VBOSceneModelNode {
16628
16632
  }
16629
16633
 
16630
16634
  /**
16631
- * The approximate number of triangles in this VBOSceneModelNode.
16635
+ * The approximate number of triangles in this DataTextureSceneModelNode.
16632
16636
  *
16633
16637
  * @type {Number}
16634
16638
  */
@@ -16637,12 +16641,12 @@ class VBOSceneModelNode {
16637
16641
  }
16638
16642
 
16639
16643
  /**
16640
- * Gets if this VBOSceneModelNode is visible.
16644
+ * Gets if this DataTextureSceneModelNode is visible.
16641
16645
  *
16642
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16646
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16643
16647
  *
16644
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#visible} are ````true```` the VBOSceneModelNode will be
16645
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#visibleObjects}.
16648
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#visible} are ````true```` the DataTextureSceneModelNode will be
16649
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#visibleObjects}.
16646
16650
  *
16647
16651
  * @type {Boolean}
16648
16652
  */
@@ -16651,12 +16655,12 @@ class VBOSceneModelNode {
16651
16655
  }
16652
16656
 
16653
16657
  /**
16654
- * Sets if this VBOSceneModelNode is visible.
16658
+ * Sets if this DataTextureSceneModelNode is visible.
16655
16659
  *
16656
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16660
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16657
16661
  *
16658
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#visible} are ````true```` the VBOSceneModelNode will be
16659
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#visibleObjects}.
16662
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#visible} are ````true```` the DataTextureSceneModelNode will be
16663
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#visibleObjects}.
16660
16664
  *
16661
16665
  * @type {Boolean}
16662
16666
  */
@@ -16679,10 +16683,10 @@ class VBOSceneModelNode {
16679
16683
  }
16680
16684
 
16681
16685
  /**
16682
- * Gets if this VBOSceneModelNode is highlighted.
16686
+ * Gets if this DataTextureSceneModelNode is highlighted.
16683
16687
  *
16684
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#highlighted} are ````true```` the VBOSceneModelNode will be
16685
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#highlightedObjects}.
16688
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#highlighted} are ````true```` the DataTextureSceneModelNode will be
16689
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#highlightedObjects}.
16686
16690
  *
16687
16691
  * @type {Boolean}
16688
16692
  */
@@ -16691,10 +16695,10 @@ class VBOSceneModelNode {
16691
16695
  }
16692
16696
 
16693
16697
  /**
16694
- * Sets if this VBOSceneModelNode is highlighted.
16698
+ * Sets if this DataTextureSceneModelNode is highlighted.
16695
16699
  *
16696
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#highlighted} are ````true```` the VBOSceneModelNode will be
16697
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#highlightedObjects}.
16700
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#highlighted} are ````true```` the DataTextureSceneModelNode will be
16701
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#highlightedObjects}.
16698
16702
  *
16699
16703
  * @type {Boolean}
16700
16704
  */
@@ -16717,10 +16721,10 @@ class VBOSceneModelNode {
16717
16721
  }
16718
16722
 
16719
16723
  /**
16720
- * Gets if this VBOSceneModelNode is xrayed.
16724
+ * Gets if this DataTextureSceneModelNode is xrayed.
16721
16725
  *
16722
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#xrayed} are ````true```` the VBOSceneModelNode will be
16723
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#xrayedObjects}.
16726
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#xrayed} are ````true```` the DataTextureSceneModelNode will be
16727
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#xrayedObjects}.
16724
16728
  *
16725
16729
  * @type {Boolean}
16726
16730
  */
@@ -16729,10 +16733,10 @@ class VBOSceneModelNode {
16729
16733
  }
16730
16734
 
16731
16735
  /**
16732
- * Sets if this VBOSceneModelNode is xrayed.
16736
+ * Sets if this DataTextureSceneModelNode is xrayed.
16733
16737
  *
16734
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#xrayed} are ````true```` the VBOSceneModelNode will be
16735
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#xrayedObjects}.
16738
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#xrayed} are ````true```` the DataTextureSceneModelNode will be
16739
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#xrayedObjects}.
16736
16740
  *
16737
16741
  * @type {Boolean}
16738
16742
  */
@@ -16755,10 +16759,10 @@ class VBOSceneModelNode {
16755
16759
  }
16756
16760
 
16757
16761
  /**
16758
- * Sets if this VBOSceneModelNode is selected.
16762
+ * Sets if this DataTextureSceneModelNode is selected.
16759
16763
  *
16760
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#selected} are ````true```` the VBOSceneModelNode will be
16761
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#selectedObjects}.
16764
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#selected} are ````true```` the DataTextureSceneModelNode will be
16765
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#selectedObjects}.
16762
16766
  *
16763
16767
  * @type {Boolean}
16764
16768
  */
@@ -16767,10 +16771,10 @@ class VBOSceneModelNode {
16767
16771
  }
16768
16772
 
16769
16773
  /**
16770
- * Gets if this VBOSceneModelNode is selected.
16774
+ * Gets if this DataTextureSceneModelNode is selected.
16771
16775
  *
16772
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#selected} are ````true```` the VBOSceneModelNode will be
16773
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#selectedObjects}.
16776
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#selected} are ````true```` the DataTextureSceneModelNode will be
16777
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#selectedObjects}.
16774
16778
  *
16775
16779
  * @type {Boolean}
16776
16780
  */
@@ -16793,7 +16797,7 @@ class VBOSceneModelNode {
16793
16797
  }
16794
16798
 
16795
16799
  /**
16796
- * Gets if this VBOSceneModelNode's edges are enhanced.
16800
+ * Gets if this DataTextureSceneModelNode's edges are enhanced.
16797
16801
  *
16798
16802
  * @type {Boolean}
16799
16803
  */
@@ -16802,7 +16806,7 @@ class VBOSceneModelNode {
16802
16806
  }
16803
16807
 
16804
16808
  /**
16805
- * Sets if this VBOSceneModelNode's edges are enhanced.
16809
+ * Sets if this DataTextureSceneModelNode's edges are enhanced.
16806
16810
  *
16807
16811
  * @type {Boolean}
16808
16812
  */
@@ -16840,9 +16844,9 @@ class VBOSceneModelNode {
16840
16844
  }
16841
16845
 
16842
16846
  /**
16843
- * Gets if this VBOSceneModelNode is culled.
16847
+ * Gets if this DataTextureSceneModelNode is culled.
16844
16848
  *
16845
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16849
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16846
16850
  *
16847
16851
  * @type {Boolean}
16848
16852
  */
@@ -16852,9 +16856,9 @@ class VBOSceneModelNode {
16852
16856
  }
16853
16857
 
16854
16858
  /**
16855
- * Sets if this VBOSceneModelNode is culled.
16859
+ * Sets if this DataTextureSceneModelNode is culled.
16856
16860
  *
16857
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16861
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16858
16862
  *
16859
16863
  * @type {Boolean}
16860
16864
  */
@@ -16882,7 +16886,7 @@ class VBOSceneModelNode {
16882
16886
  }
16883
16887
 
16884
16888
  /**
16885
- * Gets if this VBOSceneModelNode is clippable.
16889
+ * Gets if this DataTextureSceneModelNode is clippable.
16886
16890
  *
16887
16891
  * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
16888
16892
  *
@@ -16893,7 +16897,7 @@ class VBOSceneModelNode {
16893
16897
  }
16894
16898
 
16895
16899
  /**
16896
- * Sets if this VBOSceneModelNode is clippable.
16900
+ * Sets if this DataTextureSceneModelNode is clippable.
16897
16901
  *
16898
16902
  * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
16899
16903
  *
@@ -16915,7 +16919,7 @@ class VBOSceneModelNode {
16915
16919
  }
16916
16920
 
16917
16921
  /**
16918
- * Gets if this VBOSceneModelNode is included in boundary calculations.
16922
+ * Gets if this DataTextureSceneModelNode is included in boundary calculations.
16919
16923
  *
16920
16924
  * @type {Boolean}
16921
16925
  */
@@ -16924,7 +16928,7 @@ class VBOSceneModelNode {
16924
16928
  }
16925
16929
 
16926
16930
  /**
16927
- * Sets if this VBOSceneModelNode is included in boundary calculations.
16931
+ * Sets if this DataTextureSceneModelNode is included in boundary calculations.
16928
16932
  *
16929
16933
  * @type {Boolean}
16930
16934
  */
@@ -16943,7 +16947,7 @@ class VBOSceneModelNode {
16943
16947
  }
16944
16948
 
16945
16949
  /**
16946
- * Gets if this VBOSceneModelNode is pickable.
16950
+ * Gets if this DataTextureSceneModelNode is pickable.
16947
16951
  *
16948
16952
  * Picking is done via calls to {@link Scene#pick}.
16949
16953
  *
@@ -16954,7 +16958,7 @@ class VBOSceneModelNode {
16954
16958
  }
16955
16959
 
16956
16960
  /**
16957
- * Sets if this VBOSceneModelNode is pickable.
16961
+ * Sets if this DataTextureSceneModelNode is pickable.
16958
16962
  *
16959
16963
  * Picking is done via calls to {@link Scene#pick}.
16960
16964
  *
@@ -16975,7 +16979,7 @@ class VBOSceneModelNode {
16975
16979
  }
16976
16980
 
16977
16981
  /**
16978
- * Gets the VBOSceneModelNode's RGB colorize color.
16982
+ * Gets the DataTextureSceneModelNode's RGB colorize color.
16979
16983
  *
16980
16984
  * Each element of the color is in range ````[0..1]````.
16981
16985
  *
@@ -16993,7 +16997,7 @@ class VBOSceneModelNode {
16993
16997
  }
16994
16998
 
16995
16999
  /**
16996
- * Sets the VBOSceneModelNode's RGB colorize color.
17000
+ * Sets the DataTextureSceneModelNode's RGB colorize color.
16997
17001
  *
16998
17002
  * Each element of the color is in range ````[0..1]````.
16999
17003
  *
@@ -17021,7 +17025,7 @@ class VBOSceneModelNode {
17021
17025
  }
17022
17026
 
17023
17027
  /**
17024
- * Gets the VBOSceneModelNode's opacity factor.
17028
+ * Gets the DataTextureSceneModelNode's opacity factor.
17025
17029
  *
17026
17030
  * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
17027
17031
  *
@@ -17036,7 +17040,7 @@ class VBOSceneModelNode {
17036
17040
  }
17037
17041
 
17038
17042
  /**
17039
- * Sets the VBOSceneModelNode's opacity factor, multiplies by the VBOSceneModelNode's rendered fragment alphas.
17043
+ * Sets the DataTextureSceneModelNode's opacity factor, multiplies by the DataTextureSceneModelNode's rendered fragment alphas.
17040
17044
  *
17041
17045
  * This is a factor in range ````[0..1]````.
17042
17046
  *
@@ -17076,7 +17080,7 @@ class VBOSceneModelNode {
17076
17080
  }
17077
17081
 
17078
17082
  /**
17079
- * Gets the VBOSceneModelNode's 3D World-space offset.
17083
+ * Gets the DataTextureSceneModelNode's 3D World-space offset.
17080
17084
  *
17081
17085
  * Default value is ````[0,0,0]````.
17082
17086
  *
@@ -17087,9 +17091,9 @@ class VBOSceneModelNode {
17087
17091
  }
17088
17092
 
17089
17093
  /**
17090
- * Sets the VBOSceneModelNode's 3D World-space offset.
17094
+ * Sets the DataTextureSceneModelNode's 3D World-space offset.
17091
17095
  *
17092
- * The offset dynamically translates the VBOSceneModelNode in World-space.
17096
+ * The offset dynamically translates the DataTextureSceneModelNode in World-space.
17093
17097
  *
17094
17098
  * Default value is ````[0, 0, 0]````.
17095
17099
  *
@@ -17123,7 +17127,7 @@ class VBOSceneModelNode {
17123
17127
  }
17124
17128
 
17125
17129
  /**
17126
- * Gets if this VBOSceneModelNode casts shadows.
17130
+ * Gets if this DataTextureSceneModelNode casts shadows.
17127
17131
  *
17128
17132
  * @type {Boolean}
17129
17133
  */
@@ -17132,7 +17136,7 @@ class VBOSceneModelNode {
17132
17136
  }
17133
17137
 
17134
17138
  /**
17135
- * Sets if to this VBOSceneModelNode casts shadows.
17139
+ * Sets if to this DataTextureSceneModelNode casts shadows.
17136
17140
  *
17137
17141
  * @type {Boolean}
17138
17142
  */
@@ -17141,7 +17145,7 @@ class VBOSceneModelNode {
17141
17145
  }
17142
17146
 
17143
17147
  /**
17144
- * Whether or not this VBOSceneModelNode can have shadows cast upon it
17148
+ * Whether or not this DataTextureSceneModelNode can have shadows cast upon it
17145
17149
  *
17146
17150
  * @type {Boolean}
17147
17151
  */
@@ -17150,7 +17154,7 @@ class VBOSceneModelNode {
17150
17154
  }
17151
17155
 
17152
17156
  /**
17153
- * Whether or not this VBOSceneModelNode can have shadows cast upon it
17157
+ * Whether or not this DataTextureSceneModelNode can have shadows cast upon it
17154
17158
  *
17155
17159
  * @type {Boolean}
17156
17160
  */
@@ -17159,7 +17163,7 @@ class VBOSceneModelNode {
17159
17163
  }
17160
17164
 
17161
17165
  /**
17162
- * Gets if Scalable Ambient Obscurance (SAO) will apply to this VBOSceneModelNode.
17166
+ * Gets if Scalable Ambient Obscurance (SAO) will apply to this DataTextureSceneModelNode.
17163
17167
  *
17164
17168
  * SAO is configured by the Scene's {@link SAO} component.
17165
17169
  *
@@ -17233,68 +17237,6 @@ class VBOSceneModelNode {
17233
17237
 
17234
17238
  }
17235
17239
 
17236
- /**
17237
- * Provides scratch memory for methods like TrianglesBatchingLayer setFlags() and setColors(),
17238
- * so they don't need to allocate temporary arrays that need garbage collection.
17239
- *
17240
- * @private
17241
- */
17242
- class ScratchMemory$1 {
17243
-
17244
- constructor() {
17245
- this._uint8Arrays = {};
17246
- this._float32Arrays = {};
17247
- }
17248
-
17249
- _clear() {
17250
- this._uint8Arrays = {};
17251
- this._float32Arrays = {};
17252
- }
17253
-
17254
- getUInt8Array(len) {
17255
- let uint8Array = this._uint8Arrays[len];
17256
- if (!uint8Array) {
17257
- uint8Array = new Uint8Array(len);
17258
- this._uint8Arrays[len] = uint8Array;
17259
- }
17260
- return uint8Array;
17261
- }
17262
-
17263
- getFloat32Array(len) {
17264
- let float32Array = this._float32Arrays[len];
17265
- if (!float32Array) {
17266
- float32Array = new Float32Array(len);
17267
- this._float32Arrays[len] = float32Array;
17268
- }
17269
- return float32Array;
17270
- }
17271
- }
17272
-
17273
- const batchingLayerScratchMemory$1 = new ScratchMemory$1();
17274
-
17275
- let countUsers$1 = 0;
17276
-
17277
- /**
17278
- * @private
17279
- */
17280
- function getScratchMemory$1() {
17281
- countUsers$1++;
17282
- return batchingLayerScratchMemory$1;
17283
- }
17284
-
17285
- /**
17286
- * @private
17287
- */
17288
- function putScratchMemory$1() {
17289
- if (countUsers$1 === 0) {
17290
- return;
17291
- }
17292
- countUsers$1--;
17293
- if (countUsers$1 === 0) {
17294
- batchingLayerScratchMemory$1._clear();
17295
- }
17296
- }
17297
-
17298
17240
  /**
17299
17241
  * @private
17300
17242
  */
@@ -19891,7 +19833,7 @@ class TrianglesDataTextureColorRenderer {
19891
19833
  tempVec4$9[2] = sao.blendCutoff;
19892
19834
  tempVec4$9[3] = sao.blendFactor;
19893
19835
  gl.uniform4fv(this._uSAOParams, tempVec4$9);
19894
- this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 0);
19836
+ this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 10);
19895
19837
  }
19896
19838
  }
19897
19839
 
@@ -19991,15 +19933,6 @@ class TrianglesDataTextureColorRenderer {
19991
19933
 
19992
19934
  src.push("void main(void) {");
19993
19935
 
19994
- // camera matrices
19995
- src.push ("mat4 viewMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 0), 0));");
19996
- src.push ("mat4 viewNormalMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 1), 0));");
19997
- src.push ("mat4 projMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 2), 0));");
19998
-
19999
- // model matrices
20000
- src.push ("mat4 worldMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 0), 0), texelFetch (uTextureModelMatrices, ivec2(1, 0), 0), texelFetch (uTextureModelMatrices, ivec2(2, 0), 0), texelFetch (uTextureModelMatrices, ivec2(3, 0), 0));");
20001
- src.push ("mat4 worldNormalMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 1), 0), texelFetch (uTextureModelMatrices, ivec2(1, 1), 0), texelFetch (uTextureModelMatrices, ivec2(2, 1), 0), texelFetch (uTextureModelMatrices, ivec2(3, 1), 0));");
20002
-
20003
19936
  // constants
20004
19937
  src.push("int polygonIndex = gl_VertexID / 3;");
20005
19938
 
@@ -20022,6 +19955,15 @@ class TrianglesDataTextureColorRenderer {
20022
19955
  src.push(" return;"); // Cull vertex
20023
19956
  src.push("} else {");
20024
19957
 
19958
+ // camera matrices
19959
+ src.push ("mat4 viewMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 0), 0));");
19960
+ src.push ("mat4 viewNormalMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 1), 0));");
19961
+ src.push ("mat4 projMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 2), 0));");
19962
+
19963
+ // model matrices
19964
+ src.push ("mat4 worldMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 0), 0), texelFetch (uTextureModelMatrices, ivec2(1, 0), 0), texelFetch (uTextureModelMatrices, ivec2(2, 0), 0), texelFetch (uTextureModelMatrices, ivec2(3, 0), 0));");
19965
+ src.push ("mat4 worldNormalMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 1), 0), texelFetch (uTextureModelMatrices, ivec2(1, 1), 0), texelFetch (uTextureModelMatrices, ivec2(2, 1), 0), texelFetch (uTextureModelMatrices, ivec2(3, 1), 0));");
19966
+
20025
19967
  // get vertex base
20026
19968
  src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"); // chipmunk
20027
19969
 
@@ -20222,7 +20164,7 @@ class TrianglesDataTextureColorRenderer {
20222
20164
  src.push(" float blendCutoff = uSAOParams[2];");
20223
20165
  src.push(" float blendFactor = uSAOParams[3];");
20224
20166
  src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
20225
- src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture2D(uOcclusionTexture, uv))) * blendFactor;");
20167
+ src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
20226
20168
  src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");
20227
20169
  } else {
20228
20170
  src.push(" outColor = vColor;");
@@ -23080,6 +23022,7 @@ class TrianglesDataTextureOcclusionRenderer {
23080
23022
  }
23081
23023
  }
23082
23024
 
23025
+ math.vec4();
23083
23026
  const tempVec3a$17 = math.vec3();
23084
23027
 
23085
23028
  /**
@@ -23102,12 +23045,12 @@ class TrianglesDataTextureDepthRenderer {
23102
23045
  }
23103
23046
 
23104
23047
  drawLayer(frameCtx, dataTextureLayer, renderPass) {
23105
-
23106
- const model = dataTextureLayer.model;
23107
- const scene = model.scene;
23048
+ const scene = this._scene;
23108
23049
  const camera = scene.camera;
23050
+ const model = dataTextureLayer.model;
23109
23051
  const gl = scene.canvas.gl;
23110
23052
  const state = dataTextureLayer._state;
23053
+ const textureState = state.textureState;
23111
23054
  const origin = dataTextureLayer._state.origin;
23112
23055
 
23113
23056
  if (!this._program) {
@@ -23119,13 +23062,38 @@ class TrianglesDataTextureDepthRenderer {
23119
23062
 
23120
23063
  if (frameCtx.lastProgramId !== this._program.id) {
23121
23064
  frameCtx.lastProgramId = this._program.id;
23122
- this._bindProgram();
23065
+ this._bindProgram(frameCtx, state);
23123
23066
  }
23067
+
23068
+ textureState.bindCommonTextures (
23069
+ this._program,
23070
+ this._uTexturePerObjectIdPositionsDecodeMatrix,
23071
+ this._uTexturePerVertexIdCoordinates,
23072
+ this._uTexturePerObjectIdColorsAndFlags,
23073
+ this._uTextureCameraMatrices,
23074
+ this._uTextureModelMatrices,
23075
+ this._uTexturePerObjectIdOffsets
23076
+ );
23124
23077
 
23125
- gl.uniform1i(this._uRenderPass, renderPass);
23078
+ let cameraEye = camera.eye;
23126
23079
 
23127
- gl.uniformMatrix4fv(this._uWorldMatrix, false, model.worldMatrix);
23128
- gl.uniformMatrix4fv(this._uViewMatrix, false, (origin) ? createRTCViewMat(camera.viewMatrix, origin) : camera.viewMatrix);
23080
+ if (frameCtx.pickViewMatrix) {
23081
+ textureState.bindPickCameraTexture (
23082
+ this._program,
23083
+ this._uTextureCameraMatrices
23084
+ );
23085
+ cameraEye = frameCtx.pickOrigin || cameraEye;
23086
+ }
23087
+
23088
+ const originCameraEye = [
23089
+ cameraEye[0] - origin[0],
23090
+ cameraEye[1] - origin[1],
23091
+ cameraEye[2] - origin[2],
23092
+ ];
23093
+
23094
+ gl.uniform3fv(this._uCameraEyeRtc, originCameraEye);
23095
+
23096
+ gl.uniform1i(this._uRenderPass, renderPass);
23129
23097
 
23130
23098
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
23131
23099
  if (numSectionPlanes > 0) {
@@ -23151,23 +23119,43 @@ class TrianglesDataTextureDepthRenderer {
23151
23119
  }
23152
23120
  }
23153
23121
 
23154
- gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, dataTextureLayer._state.positionsDecodeMatrix);
23155
-
23156
- this._aPosition.bindArrayBuffer(state.positionsBuf);
23122
+ if (state.numIndices8Bits > 0)
23123
+ {
23124
+ textureState.bindTriangleIndicesTextures(
23125
+ this._program,
23126
+ this._uTexturePerPolygonIdPortionIds,
23127
+ this._uTexturePerPolygonIdIndices,
23128
+ 8 // 8 bits indices
23129
+ );
23157
23130
 
23158
- if (this._aOffset) {
23159
- this._aOffset.bindArrayBuffer(state.offsetsBuf);
23131
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
23160
23132
  }
23161
23133
 
23162
- this._aFlags.bindArrayBuffer(state.flagsBuf);
23134
+ if (state.numIndices16Bits > 0)
23135
+ {
23136
+ textureState.bindTriangleIndicesTextures(
23137
+ this._program,
23138
+ this._uTexturePerPolygonIdPortionIds,
23139
+ this._uTexturePerPolygonIdIndices,
23140
+ 16 // 16 bits indices
23141
+ );
23163
23142
 
23164
- if (this._aFlags2) {
23165
- this._aFlags2.bindArrayBuffer(state.flags2Buf);
23143
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
23166
23144
  }
23145
+
23146
+ if (state.numIndices32Bits > 0)
23147
+ {
23148
+ textureState.bindTriangleIndicesTextures(
23149
+ this._program,
23150
+ this._uTexturePerPolygonIdPortionIds,
23151
+ this._uTexturePerPolygonIdIndices,
23152
+ 32 // 32 bits indices
23153
+ );
23167
23154
 
23168
- state.indicesBuf.bind();
23155
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
23156
+ }
23169
23157
 
23170
- gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);
23158
+ frameCtx.drawElements++;
23171
23159
  }
23172
23160
 
23173
23161
  _allocate() {
@@ -23199,23 +23187,30 @@ class TrianglesDataTextureDepthRenderer {
23199
23187
  });
23200
23188
  }
23201
23189
 
23202
- this._aPosition = program.getAttribute("position");
23203
- this._aOffset = program.getAttribute("offset");
23204
- this._aFlags = program.getAttribute("flags");
23205
- this._aFlags2 = program.getAttribute("flags2");
23206
-
23207
23190
  if (scene.logarithmicDepthBufferEnabled) {
23208
23191
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
23209
23192
  }
23193
+
23194
+ this._uTexturePerObjectIdPositionsDecodeMatrix = "uTexturePerObjectIdPositionsDecodeMatrix"; // chipmunk
23195
+ this._uTexturePerObjectIdColorsAndFlags = "uTexturePerObjectIdColorsAndFlags"; // chipmunk
23196
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates"; // chipmunk
23197
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals"; // chipmunk
23198
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices"; // chipmunk
23199
+ this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds"; // chipmunk
23200
+ this._uTextureCameraMatrices = "uTextureCameraMatrices"; // chipmunk
23201
+ this._uTextureModelMatrices = "uTextureModelMatrices"; // chipmunk
23202
+ this._uTexturePerObjectIdOffsets = "uTexturePerObjectIdOffsets"; // chipmunk
23203
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc"); // chipmunk
23210
23204
  }
23211
23205
 
23212
- _bindProgram() {
23206
+ _bindProgram(frameCtx) {
23213
23207
 
23214
23208
  const scene = this._scene;
23215
23209
  const gl = scene.canvas.gl;
23210
+ const program = this._program;
23216
23211
  const project = scene.camera.project;
23217
23212
 
23218
- this._program.bind();
23213
+ program.bind();
23219
23214
 
23220
23215
  gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);
23221
23216
 
@@ -23234,131 +23229,240 @@ class TrianglesDataTextureDepthRenderer {
23234
23229
 
23235
23230
  _buildVertexShader() {
23236
23231
  const scene = this._scene;
23237
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
23232
+ const sectionPlanesState = scene._sectionPlanesState;
23233
+ scene._lightsState;
23234
+ const clipping = sectionPlanesState.sectionPlanes.length > 0;
23238
23235
  const src = [];
23239
- src.push("// Triangles dataTexture depth vertex shader");
23240
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23241
- src.push("#extension GL_EXT_frag_depth : enable");
23242
- }
23236
+ src.push("#version 300 es");
23237
+ src.push("// Triangles dataTexture draw vertex shader");
23238
+
23239
+ src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
23240
+ src.push("precision highp float;");
23241
+ src.push("precision highp int;");
23242
+ src.push("precision highp usampler2D;");
23243
+ src.push("precision highp isampler2D;");
23244
+ src.push("precision highp sampler2D;");
23245
+ src.push("#else");
23246
+ src.push("precision mediump float;");
23247
+ src.push("precision mediump int;");
23248
+ src.push("precision mediump usampler2D;");
23249
+ src.push("precision mediump isampler2D;");
23250
+ src.push("precision mediump sampler2D;");
23251
+ src.push("#endif");
23252
+
23243
23253
  src.push("uniform int renderPass;");
23244
- src.push("attribute vec3 position;");
23254
+
23245
23255
  if (scene.entityOffsetsEnabled) {
23246
- src.push("attribute vec3 offset;");
23256
+ src.push("in vec3 offset;");
23247
23257
  }
23248
- src.push("attribute vec4 flags;");
23249
- src.push("attribute vec4 flags2;");
23250
- src.push("uniform mat4 worldMatrix;");
23251
- src.push("uniform mat4 viewMatrix;");
23252
- src.push("uniform mat4 projMatrix;");
23253
- src.push("uniform mat4 positionsDecodeMatrix;");
23258
+
23259
+ // src.push("uniform sampler2D uOcclusionTexture;"); // chipmunk
23260
+
23261
+ src.push("uniform highp sampler2D uTexturePerObjectIdPositionsDecodeMatrix;"); // chipmunk
23262
+ src.push("uniform lowp usampler2D uTexturePerObjectIdColorsAndFlags;"); // chipmunk
23263
+ src.push("uniform highp sampler2D uTexturePerObjectIdOffsets;"); // chipmunk
23264
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"); // chipmunk
23265
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"); // chipmunk
23266
+ src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"); // chipmunk
23267
+ src.push("uniform highp sampler2D uTextureCameraMatrices;"); // chipmunk
23268
+ src.push("uniform highp sampler2D uTextureModelMatrices;"); // chipmunk
23269
+ src.push("uniform vec3 uCameraEyeRtc;"); // chipmunk
23270
+
23271
+ src.push("vec3 positions[3];");
23272
+
23254
23273
  if (scene.logarithmicDepthBufferEnabled) {
23255
23274
  src.push("uniform float logDepthBufFC;");
23256
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23257
- src.push("varying float vFragDepth;");
23258
- }
23259
- src.push("bool isPerspectiveMatrix(mat4 m) {");
23260
- src.push(" return (m[2][3] == - 1.0);");
23261
- src.push("}");
23262
- src.push("varying float isPerspective;");
23275
+ src.push("out float vFragDepth;");
23276
+ src.push("out float isPerspective;");
23263
23277
  }
23278
+
23279
+ src.push("bool isPerspectiveMatrix(mat4 m) {");
23280
+ src.push(" return (m[2][3] == - 1.0);");
23281
+ src.push("}");
23282
+
23283
+ src.push("out highp vec2 vHighPrecisionZW;");
23284
+
23264
23285
  if (clipping) {
23265
- src.push("varying vec4 vWorldPosition;");
23266
- src.push("varying vec4 vFlags2;");
23286
+ src.push("out vec4 vWorldPosition;");
23287
+ src.push("flat out uint vFlags2;");
23267
23288
  }
23268
- src.push("varying vec2 vHighPrecisionZW;");
23289
+
23269
23290
  src.push("void main(void) {");
23270
23291
 
23292
+ // constants
23293
+ src.push("int polygonIndex = gl_VertexID / 3;");
23294
+
23295
+ // get packed object-id
23296
+ src.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;");
23297
+ src.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;");
23298
+
23299
+ src.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);");
23300
+ src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
23301
+
23302
+ // get flags & flags2
23303
+ src.push("uvec4 flags = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"); // chipmunk
23304
+ src.push("uvec4 flags2 = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"); // chipmunk
23305
+
23271
23306
  // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
23272
23307
  // renderPass = COLOR_OPAQUE
23273
23308
 
23274
23309
  src.push(`if (int(flags.x) != renderPass) {`);
23275
- src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"); // Cull vertex
23276
- src.push(" } else {");
23277
- src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");
23278
- if (scene.entityOffsetsEnabled) {
23279
- src.push(" worldPosition.xyz = worldPosition.xyz + offset;");
23280
- }
23281
- src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
23282
- if (clipping) {
23283
- src.push(" vWorldPosition = worldPosition;");
23284
- src.push(" vFlags2 = flags2;");
23285
- }
23310
+ src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
23311
+ src.push(" return;"); // Cull vertex
23312
+ src.push("} else {");
23313
+
23314
+ // camera matrices
23315
+ src.push ("mat4 viewMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 0), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 0), 0));");
23316
+ src.push ("mat4 viewNormalMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 1), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 1), 0));");
23317
+ src.push ("mat4 projMatrix = mat4 (texelFetch (uTextureCameraMatrices, ivec2(0, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(1, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(2, 2), 0), texelFetch (uTextureCameraMatrices, ivec2(3, 2), 0));");
23318
+
23319
+ // model matrices
23320
+ src.push ("mat4 worldMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 0), 0), texelFetch (uTextureModelMatrices, ivec2(1, 0), 0), texelFetch (uTextureModelMatrices, ivec2(2, 0), 0), texelFetch (uTextureModelMatrices, ivec2(3, 0), 0));");
23321
+ src.push ("mat4 worldNormalMatrix = mat4 (texelFetch (uTextureModelMatrices, ivec2(0, 1), 0), texelFetch (uTextureModelMatrices, ivec2(1, 1), 0), texelFetch (uTextureModelMatrices, ivec2(2, 1), 0), texelFetch (uTextureModelMatrices, ivec2(3, 1), 0));");
23322
+
23323
+ // get vertex base
23324
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"); // chipmunk
23325
+
23326
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"); // chipmunk
23327
+
23328
+ src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
23329
+
23330
+ src.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;");
23331
+ src.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;");
23332
+
23333
+ src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
23334
+ src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
23335
+
23336
+ src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
23337
+ src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
23338
+
23339
+ src.push("mat4 positionsDecodeMatrix = mat4 (texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0));");
23340
+ src.push("mat4 entityMatrix = mat4 (texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0));");
23341
+
23342
+ src.push("positionsDecodeMatrix = entityMatrix * positionsDecodeMatrix;");
23343
+
23344
+ src.push("uint solid = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"); // chipmunk
23345
+
23346
+ // get position
23347
+ src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
23348
+ src.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));");
23349
+ src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
23350
+
23351
+ // get color
23352
+ src.push("uvec4 color = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"); // chipmunk
23353
+
23354
+ src.push(`if (color.a == 0u) {`);
23355
+ src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
23356
+ src.push(" return;");
23357
+ src.push("};");
23358
+
23359
+ // get normal
23360
+ src.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));");
23361
+
23362
+ src.push("vec3 position;");
23363
+ src.push("position = positions[gl_VertexID % 3];");
23364
+
23365
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*positionsDecodeMatrix)) * vec4(normal,1)).xyz);");
23366
+
23367
+ // when the geometry is not solid, if needed, flip the triangle winding
23368
+ src.push("if (solid != 1u) {");
23369
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
23370
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(worldMatrix * positionsDecodeMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
23371
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
23372
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
23373
+ src.push("viewNormal = -viewNormal;");
23374
+ src.push("}");
23375
+ src.push("} else {");
23376
+ src.push("if (viewNormal.z < 0.0) {");
23377
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
23378
+ src.push("viewNormal = -viewNormal;");
23379
+ src.push("}");
23380
+ src.push("}");
23381
+ src.push("}");
23382
+
23383
+ src.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");
23384
+
23385
+ // get XYZ offset
23386
+ src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
23387
+
23388
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
23389
+
23390
+ src.push("vec4 viewPosition = viewMatrix * worldPosition; ");
23391
+
23286
23392
  src.push("vec4 clipPos = projMatrix * viewPosition;");
23287
23393
  if (scene.logarithmicDepthBufferEnabled) {
23288
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23289
- src.push("vFragDepth = 1.0 + clipPos.w;");
23290
- } else {
23291
- src.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;");
23292
- src.push("clipPos.z *= clipPos.w;");
23293
- }
23394
+ src.push("vFragDepth = 1.0 + clipPos.w;");
23294
23395
  src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
23295
23396
  }
23397
+ if (clipping) {
23398
+ src.push("vWorldPosition = worldPosition;");
23399
+ src.push("vFlags2 = flags2.r;");
23400
+ }
23296
23401
  src.push("gl_Position = clipPos;");
23297
23402
  src.push("vHighPrecisionZW = gl_Position.zw;");
23298
- src.push(" }");
23299
23403
  src.push("}");
23404
+
23405
+ src.push("}");
23406
+
23300
23407
  return src;
23301
23408
  }
23302
23409
 
23303
23410
  _buildFragmentShader() {
23304
23411
  const scene = this._scene;
23305
23412
  const sectionPlanesState = scene._sectionPlanesState;
23306
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
23413
+ const clipping = sectionPlanesState.sectionPlanes.length > 0;
23307
23414
  const src = [];
23308
- src.push("// Triangles dataTexture depth fragment shader");
23309
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23310
- src.push("#extension GL_EXT_frag_depth : enable");
23311
- }
23415
+ src.push ('#version 300 es');
23416
+ src.push("// Triangles dataTexture draw fragment shader");
23417
+ src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
23312
23418
  src.push("precision highp float;");
23313
23419
  src.push("precision highp int;");
23314
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23315
- src.push("varying float isPerspective;");
23420
+ src.push("#else");
23421
+ src.push("precision mediump float;");
23422
+ src.push("precision mediump int;");
23423
+ src.push("#endif");
23424
+
23425
+ src.push("in highp vec2 vHighPrecisionZW;");
23426
+ src.push("out vec4 outColor;");
23427
+
23428
+ if (scene.logarithmicDepthBufferEnabled) {
23429
+ src.push("in float isPerspective;");
23316
23430
  src.push("uniform float logDepthBufFC;");
23317
- src.push("varying float vFragDepth;");
23431
+ src.push("in float vFragDepth;");
23318
23432
  }
23319
23433
  if (clipping) {
23320
- src.push("varying vec4 vWorldPosition;");
23321
- src.push("varying vec4 vFlags2;");
23322
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
23434
+ src.push("in vec4 vWorldPosition;");
23435
+ src.push("flat in uint vFlags2;");
23436
+ for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
23323
23437
  src.push("uniform bool sectionPlaneActive" + i + ";");
23324
23438
  src.push("uniform vec3 sectionPlanePos" + i + ";");
23325
23439
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
23326
23440
  }
23327
23441
  }
23328
- src.push("const float packUpScale = 256. / 255.;");
23329
- src.push("const float unpackDownscale = 255. / 256.;");
23330
- src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");
23331
- src.push("const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );");
23332
- src.push("const float shiftRight8 = 1.0 / 256.;");
23333
-
23334
- src.push("vec4 packDepthToRGBA( const in float v ) {");
23335
- src.push(" vec4 r = vec4( fract( v * packFactors ), v );");
23336
- src.push(" r.yzw -= r.xyz * shiftRight8;");
23337
- src.push(" return r * packUpScale;");
23338
- src.push("}");
23339
- src.push("varying vec2 vHighPrecisionZW;");
23340
23442
  src.push("void main(void) {");
23443
+
23341
23444
  if (clipping) {
23342
- src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
23445
+ src.push(" bool clippable = vFlags2 > 0u;");
23343
23446
  src.push(" if (clippable) {");
23344
- src.push(" float dist = 0.0;");
23345
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
23346
- src.push(" if (sectionPlaneActive" + i + ") {");
23347
- src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
23348
- src.push(" }");
23447
+ src.push(" float dist = 0.0;");
23448
+ for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
23449
+ src.push("if (sectionPlaneActive" + i + ") {");
23450
+ src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
23451
+ src.push("}");
23349
23452
  }
23350
- src.push(" if (dist > 0.0) { discard; }");
23351
- src.push(" }");
23453
+ src.push(" if (dist > 0.0) { ");
23454
+ src.push(" discard;");
23455
+ src.push(" }");
23456
+ src.push("}");
23352
23457
  }
23353
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23354
- src.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
23458
+
23459
+ if (scene.logarithmicDepthBufferEnabled) {
23460
+ // src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
23461
+ src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
23355
23462
  }
23356
23463
  src.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;");
23357
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["WEBGL_depth_texture"]) {
23358
- src.push(" gl_FragColor = vec4(vec3(1.0 - fragCoordZ), 1.0); ");
23359
- } else {
23360
- src.push(" gl_FragColor = packDepthToRGBA(fragCoordZ); "); // Must be linear depth
23361
- }
23464
+ src.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); ");
23465
+ // src.push(" outColor = vec4(1.0, 1.0, 1.0, 1.0); ");
23362
23466
  src.push("}");
23363
23467
  return src;
23364
23468
  }
@@ -23372,7 +23476,6 @@ class TrianglesDataTextureDepthRenderer {
23372
23476
  this._program.destroy();
23373
23477
  }
23374
23478
  this._program = null;
23375
- stats.memory.programs--;
23376
23479
  }
23377
23480
  }
23378
23481
 
@@ -27544,7 +27647,6 @@ class TrianglesDataTextureLayer {
27544
27647
  * @param cfg.layerIndex
27545
27648
  * @param cfg.positionsDecodeMatrix
27546
27649
  * @param cfg.origin
27547
- * @param cfg.scratchMemory
27548
27650
  */
27549
27651
  constructor(model, cfg) {
27550
27652
  this._layerNumber = _numberOfLayers++;
@@ -27565,7 +27667,6 @@ class TrianglesDataTextureLayer {
27565
27667
  this._dataTextureRenderers = getDataTextureRenderers(model.scene);
27566
27668
  this.model = model;
27567
27669
  this._buffer = new TrianglesDataTextureBuffer();
27568
- this._scratchMemory = cfg.scratchMemory;
27569
27670
 
27570
27671
  /**
27571
27672
  * @type {DataTextureState}
@@ -29218,40 +29319,49 @@ class TrianglesDataTextureLayer {
29218
29319
  *
29219
29320
  * @returns {object} The mesh information enrichened with `.preparedBuckets` key.
29220
29321
  */
29221
- function prepareMeshGeometry (geometryCfg) {
29322
+ function prepareMeshGeometry (geometryCfg, enableVertexWelding, enableIndexRebucketing) {
29222
29323
  let uniquePositions, uniqueIndices, uniqueEdgeIndices;
29223
29324
 
29224
- [
29225
- uniquePositions,
29226
- uniqueIndices,
29227
- uniqueEdgeIndices,
29228
- ] = uniquifyPositions ({
29229
- positions: geometryCfg.positions,
29230
- indices: geometryCfg.indices,
29231
- edgeIndices: geometryCfg.edgeIndices
29232
- });
29325
+ if (enableVertexWelding) {
29326
+ [
29327
+ uniquePositions,
29328
+ uniqueIndices,
29329
+ uniqueEdgeIndices,
29330
+ ] = uniquifyPositions ({
29331
+ positions: geometryCfg.positions,
29332
+ indices: geometryCfg.indices,
29333
+ edgeIndices: geometryCfg.edgeIndices
29334
+ });
29335
+ } else {
29336
+ uniquePositions = geometryCfg.positions;
29337
+ uniqueIndices = geometryCfg.indices;
29338
+ uniqueEdgeIndices = geometryCfg.edgeIndices;
29339
+ }
29233
29340
 
29234
- let numUniquePositions = uniquePositions.length / 3;
29341
+ let buckets;
29235
29342
 
29236
- let buckets = rebucketPositions (
29237
- {
29343
+ if (enableIndexRebucketing) {
29344
+ let numUniquePositions = uniquePositions.length / 3;
29345
+
29346
+ buckets = rebucketPositions (
29347
+ {
29348
+ positions: uniquePositions,
29349
+ indices: uniqueIndices,
29350
+ edgeIndices: uniqueEdgeIndices,
29351
+ },
29352
+ (numUniquePositions > (1<< 16)) ? 16 : 8,
29353
+ // true
29354
+ );
29355
+ } else {
29356
+ buckets = [{
29238
29357
  positions: uniquePositions,
29239
29358
  indices: uniqueIndices,
29240
29359
  edgeIndices: uniqueEdgeIndices,
29241
- },
29242
- (numUniquePositions > (1<< 16)) ? 16 : 8,
29243
- // true
29244
- );
29360
+ }];
29361
+ }
29245
29362
 
29246
29363
  geometryCfg.preparedBuckets = buckets;
29247
29364
 
29248
- // chipmunk
29249
- // geometryCfg.preparedBuckets = [{
29250
- // positions: uniquePositions,
29251
- // indices: uniqueIndices,
29252
- // edgeIndices: uniqueEdgeIndices,
29253
- // }];
29254
-
29255
29365
  return geometryCfg;
29256
29366
  }
29257
29367
 
@@ -29598,7 +29708,7 @@ function attachFPSTracker (scene, cullingManager) {
29598
29708
  * - key: the number of triangles allowed for the objects in the bucket.
29599
29709
  * - value: all PerformanceNodes that have the number of triangles or more.
29600
29710
  *
29601
- * @type {Map<number, Array<VBOSceneModelNode>>}
29711
+ * @type {Map<number, Array<DataTextureSceneModelNode>>}
29602
29712
  */
29603
29713
  this.nodesInLOD = {};
29604
29714
 
@@ -31479,7 +31589,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31479
31589
  this._camera = model.scene.camera;
31480
31590
  }
31481
31591
 
31482
- this._ensureFrustumPropsUpdated ();
31592
+ this._ensureFrustumPropsUpdated (model);
31483
31593
 
31484
31594
  this._initializeCullingDataIfNeeded (model);
31485
31595
 
@@ -31532,7 +31642,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31532
31642
  });
31533
31643
 
31534
31644
  /**
31535
- * @type {Array<VBOSceneModelNode>}
31645
+ * @type {Array<DataTextureSceneModelNode>}
31536
31646
  * @private
31537
31647
  */
31538
31648
  this._internalNodesList = internalNodesList;
@@ -31658,9 +31768,11 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31658
31768
  }
31659
31769
 
31660
31770
  /**
31771
+ * @param {DataTextureSceneModel} model
31772
+ *
31661
31773
  * @private
31662
31774
  */
31663
- _ensureFrustumPropsUpdated ()
31775
+ _ensureFrustumPropsUpdated (model)
31664
31776
  {
31665
31777
  // Assuming "min" for fovAxis
31666
31778
  const min = Math.min (
@@ -31689,10 +31801,33 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31689
31801
  // return;
31690
31802
  // }
31691
31803
 
31804
+ // Adjust camera eye/look to take into account the `model.worldMatrix`:
31805
+ // - the entities' AABBs don't take it into account
31806
+ // - and they can't, since `model.worldMatrix` is dynamic
31807
+ // So, instead of transformating the positions of the r*tree's AABBs,
31808
+ // apply the inverse transform to the camera eye/look, since the culling
31809
+ // result is equivalent.
31810
+ const invWorldMatrix = math.inverseMat4(
31811
+ model.worldMatrix,
31812
+ math.mat4()
31813
+ );
31814
+
31815
+ const modelCamEye = math.transformVec3(
31816
+ this._camera.eye,
31817
+ invWorldMatrix,
31818
+ [ 0, 0, 0 ]
31819
+ );
31820
+
31821
+ const modelCamLook = math.transformVec3(
31822
+ this._camera.look,
31823
+ invWorldMatrix,
31824
+ [ 0, 0, 0 ]
31825
+ );
31826
+
31692
31827
  this._frustumProps.forward = math.normalizeVec3 (
31693
31828
  math.subVec3 (
31694
- this._camera.look,
31695
- this._camera.eye,
31829
+ modelCamLook,
31830
+ modelCamEye,
31696
31831
  [ 0, 0, 0]
31697
31832
  ),
31698
31833
  [ 0, 0, 0]
@@ -31712,7 +31847,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31712
31847
  [ 0, 0, 0 ]
31713
31848
  );
31714
31849
 
31715
- this._frustumProps.eye = this._camera.eye.slice ();
31850
+ this._frustumProps.eye = modelCamEye.slice ();
31716
31851
 
31717
31852
  this._frustumProps.CAM_FACTOR_1 = this._frustumProps.fov / 2 * this._frustumProps.wMultiply / _180_DIV_MATH_PI;
31718
31853
  this._frustumProps.CAM_FACTOR_2 = this._frustumProps.fov / 2 * this._frustumProps.hMultiply / _180_DIV_MATH_PI;
@@ -31983,6 +32118,8 @@ class DataTextureSceneModel extends Component {
31983
32118
  * @param {Boolean} [cfg.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to this dataTexturePerformanceModel. SAO is configured by the Scene's {@link SAO} component.
31984
32119
  * @param {Boolean} [cfg.pbrEnabled=false] Indicates if physically-based rendering (PBR) will apply to the dataTexturePerformanceModel. Only works when {@link Scene#pbrEnabled} is also ````true````.
31985
32120
  * @param {Number} [cfg.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
32121
+ * @param {Boolean} [cfg.disableVertexWelding] Disable vertex welding when loading geometry into the GPU. Default is ```false```.
32122
+ * @param {Boolean} [cfg.disableIndexRebucketing] Disable index rebucketing when loading geometry into the GPU. Default is ```false```.
31986
32123
  */
31987
32124
  constructor(owner, cfg = {}) {
31988
32125
  super(owner, cfg);
@@ -31991,6 +32128,24 @@ class DataTextureSceneModel extends Component {
31991
32128
  throw "Using a DataTextureSceneModel requires the usage of webgl2";
31992
32129
  }
31993
32130
 
32131
+ /**
32132
+ * Enable welding vertices when loading geometry into the ```TrianglesDataTextureLayer```.
32133
+ *
32134
+ * The welding is applied per-geometry.
32135
+ *
32136
+ * @type {Boolean}
32137
+ */
32138
+ this._enableVertexWelding = !cfg.disableVertexWelding;
32139
+
32140
+ /**
32141
+ * Enable demotion of index bitness then loading geometry into the ```TrianglesDataTextureLayer```.
32142
+ *
32143
+ * The rebucketing is applied per-geometry.
32144
+ *
32145
+ * @type {Boolean}
32146
+ */
32147
+ this._enableIndexRebucketing = !cfg.disableIndexRebucketing;
32148
+
31994
32149
  this._targetLodFps = cfg.targetLodFps;
31995
32150
 
31996
32151
  if (cfg.enableViewFrustumCulling) {
@@ -32009,7 +32164,7 @@ class DataTextureSceneModel extends Component {
32009
32164
  this._layerList = [];
32010
32165
 
32011
32166
  /**
32012
- * @type {Array<VBOSceneModelNode>}
32167
+ * @type {Array<DataTextureSceneModelNode>}
32013
32168
  */
32014
32169
  this._nodeList = [];
32015
32170
 
@@ -32022,15 +32177,13 @@ class DataTextureSceneModel extends Component {
32022
32177
 
32023
32178
  this._preparedInstancingGeometries = {};
32024
32179
 
32025
- this._scratchMemory = getScratchMemory$1();
32026
-
32027
32180
  /**
32028
- * @type {Map<string, VBOSceneModelMesh>}
32181
+ * @type {Map<string, DataTextureSceneModelMesh>}
32029
32182
  */
32030
32183
  this._meshes = {};
32031
32184
 
32032
32185
  /**
32033
- * @type {Map<string, VBOSceneModelNode>}
32186
+ * @type {Map<string, DataTextureSceneModelNode>}
32034
32187
  */
32035
32188
  this._nodes = {};
32036
32189
 
@@ -32146,7 +32299,7 @@ class DataTextureSceneModel extends Component {
32146
32299
  this._opacity = 1.0;
32147
32300
  this._colorize = [1, 1, 1];
32148
32301
 
32149
- this._saoEnabled = false;
32302
+ this._saoEnabled = (cfg.saoEnabled !== false);
32150
32303
 
32151
32304
  this._pbrEnabled = (!!cfg.pbrEnabled);
32152
32305
 
@@ -33042,7 +33195,11 @@ class DataTextureSceneModel extends Component {
33042
33195
 
33043
33196
  geometryCfg.edgeIndices = edgeIndices;
33044
33197
 
33045
- preparedGeometryCfg = prepareMeshGeometry (geometryCfg);
33198
+ preparedGeometryCfg = prepareMeshGeometry (
33199
+ geometryCfg,
33200
+ this._enableVertexWelding,
33201
+ this._enableIndexRebucketing
33202
+ );
33046
33203
 
33047
33204
  if (instancing) {
33048
33205
  this._preparedInstancingGeometries[geometryId] = preparedGeometryCfg;
@@ -33064,7 +33221,6 @@ class DataTextureSceneModel extends Component {
33064
33221
  {
33065
33222
  layer = new TrianglesDataTextureLayer(this, {
33066
33223
  layerIndex: 0, // This is set in #finalize()
33067
- scratchMemory: this._scratchMemory,
33068
33224
 
33069
33225
  // chipmunk
33070
33226
  // positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
@@ -33083,7 +33239,7 @@ class DataTextureSceneModel extends Component {
33083
33239
  const metallic = (cfg.metallic !== undefined && cfg.metallic !== null) ? Math.floor(cfg.metallic * 255) : 0;
33084
33240
  const roughness = (cfg.roughness !== undefined && cfg.roughness !== null) ? Math.floor(cfg.roughness * 255) : 255;
33085
33241
 
33086
- const mesh = new VBOSceneModelMesh$1(this, id, color, opacity);
33242
+ const mesh = new DataTextureSceneModelMesh(this, id, color, opacity);
33087
33243
 
33088
33244
  const pickId = mesh.pickId;
33089
33245
 
@@ -33326,7 +33482,7 @@ class DataTextureSceneModel extends Component {
33326
33482
  }
33327
33483
  }
33328
33484
 
33329
- const node = new VBOSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
33485
+ const node = new DataTextureSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
33330
33486
  this._nodeList.push(node);
33331
33487
  this._nodes[id] = node;
33332
33488
  this.numEntities++;
@@ -33739,7 +33895,7 @@ class DataTextureSceneModel extends Component {
33739
33895
  }
33740
33896
 
33741
33897
  /**
33742
- * Called by VBOSceneModelMesh.drawPickDepths()
33898
+ * Called by DataTextureSceneModelMesh.drawPickDepths()
33743
33899
  * @private
33744
33900
  */
33745
33901
  drawPickDepths(frameCtx) {
@@ -33754,7 +33910,7 @@ class DataTextureSceneModel extends Component {
33754
33910
  }
33755
33911
 
33756
33912
  /**
33757
- * Called by VBOSceneModelMesh.drawPickNormals()
33913
+ * Called by DataTextureSceneModelMesh.drawPickNormals()
33758
33914
  * @private
33759
33915
  */
33760
33916
  drawPickNormals(frameCtx) {
@@ -33787,7 +33943,6 @@ class DataTextureSceneModel extends Component {
33787
33943
  if (this._isModel) {
33788
33944
  this.scene._deregisterModel(this);
33789
33945
  }
33790
- putScratchMemory$1();
33791
33946
  super.destroy();
33792
33947
  }
33793
33948
  }
@@ -62922,7 +63077,7 @@ class DistanceMeasurement extends Component {
62922
63077
  }
62923
63078
 
62924
63079
  /**
62925
- * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
63080
+ * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events, or ignore mouse events altogether.
62926
63081
  *
62927
63082
  * @type {Boolean}
62928
63083
  */
@@ -97015,7 +97170,7 @@ ${cfg.uv && cfg.uv.length > 0 ? 1 : 0}-${cfg.uvCompressed && cfg.uvCompressed.le
97015
97170
  math.expandAABB3(aabb, meshes[i].aabb);
97016
97171
  }
97017
97172
  }
97018
- const node = new VBOSceneModelNode$1(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
97173
+ const node = new VBOSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
97019
97174
  this._nodeList.push(node);
97020
97175
  this._nodes[id] = node;
97021
97176
  this.numEntities++;
@@ -131491,6 +131646,8 @@ class XKTLoaderPlugin extends Plugin {
131491
131646
  origin: params.origin,
131492
131647
  targetLodFps: params.useDataTextures.targetLodFps || false,
131493
131648
  enableViewFrustumCulling: params.useDataTextures.enableViewFrustumCulling || false,
131649
+ disableVertexWelding: params.useDataTextures.disableVertexWelding || false,
131650
+ disableIndexRebucketing: params.useDataTextures.disableIndexRebucketing || false,
131494
131651
  }));
131495
131652
  } else {
131496
131653
  sceneModel = new VBOSceneModel(this.viewer.scene, utils.apply(params, {