@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.
@@ -8208,7 +8208,7 @@ const tempIntRGB$1 = new Uint16Array([0, 0, 0]);
8208
8208
  /**
8209
8209
  * @private
8210
8210
  */
8211
- class VBOSceneModelNode$1 {
8211
+ class VBOSceneModelNode {
8212
8212
 
8213
8213
  /**
8214
8214
  * @private
@@ -9259,7 +9259,7 @@ class Marker extends Component {
9259
9259
  }
9260
9260
  this._entity = entity;
9261
9261
  if (this._entity) {
9262
- if (this._entity instanceof VBOSceneModelNode$1) {
9262
+ if (this._entity instanceof VBOSceneModelNode) {
9263
9263
  this._onEntityModelDestroyed = this._entity.model.on("destroyed", () => { // VBOSceneModelNode does not fire events, and cannot exist beyond its VBOSceneModel
9264
9264
  this._entity = null; // Marker now may become visible, if it was synched to invisible Entity
9265
9265
  this._onEntityModelDestroyed = null;
@@ -9470,6 +9470,7 @@ class Wire {
9470
9470
  wireStyle['-o-transform'] = 'rotate(0deg)';
9471
9471
  wireStyle['transform'] = 'rotate(0deg)';
9472
9472
  wireStyle["opacity"] = 1.0;
9473
+ wireStyle["pointer-events"] = "none";
9473
9474
  if (cfg.onContextMenu) ;
9474
9475
 
9475
9476
  parentElement.appendChild(wire);
@@ -9637,7 +9638,7 @@ class Dot {
9637
9638
  dotStyle.left = 0 + "px";
9638
9639
  dotStyle["box-shadow"] = "0 2px 5px 0 #182A3D;";
9639
9640
  dotStyle["opacity"] = 1.0;
9640
- dotStyle["pointer-events"] = "all";
9641
+ dotStyle["pointer-events"] = "none";
9641
9642
  if (cfg.onContextMenu) ;
9642
9643
  parentElement.appendChild(dot);
9643
9644
 
@@ -9715,7 +9716,6 @@ class Dot {
9715
9716
 
9716
9717
  setClickable(clickable) {
9717
9718
  this._dotClickable.style["pointer-events"] = (!!clickable) ? "all" : "none";
9718
- this._dot.style["pointer-events"] = (!!clickable) ? "all" : "none";
9719
9719
  }
9720
9720
 
9721
9721
  setHighlighted(highlighted) {
@@ -15101,7 +15101,9 @@ class SAOOcclusionRenderer {
15101
15101
 
15102
15102
  const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);
15103
15103
  const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);
15104
- const indices = new Uint8Array([0, 1, 2, 0, 2, 3]);
15104
+
15105
+ // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures
15106
+ const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);
15105
15107
 
15106
15108
  this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);
15107
15109
  this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);
@@ -15337,7 +15339,9 @@ class SAODepthLimitedBlurRenderer {
15337
15339
 
15338
15340
  const uv = new Float32Array([1, 1, 0, 1, 0, 0, 1, 0]);
15339
15341
  const positions = new Float32Array([1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0]);
15340
- const indices = new Uint8Array([0, 1, 2, 0, 2, 3]);
15342
+
15343
+ // Mitigation: if Uint8Array is used, the geometry is corrupted on OSX when using Chrome with data-textures
15344
+ const indices = new Uint32Array([0, 1, 2, 0, 2, 3]);
15341
15345
 
15342
15346
  this._positionsBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, positions, positions.length, 3, gl.STATIC_DRAW);
15343
15347
  this._uvBuf = new ArrayBuf(gl, gl.ARRAY_BUFFER, uv, uv.length, 2, gl.STATIC_DRAW);
@@ -16207,7 +16211,7 @@ var buildEdgeIndices = (function () {
16207
16211
  * @private
16208
16212
  * @implements Pickable
16209
16213
  */
16210
- class VBOSceneModelMesh$1 {
16214
+ class DataTextureSceneModelMesh {
16211
16215
 
16212
16216
  constructor(model, id, color, opacity, layer = null, portionId = 0) {
16213
16217
 
@@ -16223,9 +16227,9 @@ class VBOSceneModelMesh$1 {
16223
16227
  this.model = model;
16224
16228
 
16225
16229
  /**
16226
- * The VBOSceneModelNode that contains this PerformanceModelMesh.
16230
+ * The DataTextureSceneModelNode that contains this PerformanceModelMesh.
16227
16231
  *
16228
- * A PerformanceModelMesh always belongs to exactly one VBOSceneModelNode.
16232
+ * A PerformanceModelMesh always belongs to exactly one DataTextureSceneModelNode.
16229
16233
  *
16230
16234
  * @property object
16231
16235
  * @type {VBOSceneModelNode}
@@ -16234,9 +16238,9 @@ class VBOSceneModelMesh$1 {
16234
16238
  this.object = null;
16235
16239
 
16236
16240
  /**
16237
- * The VBOSceneModelNode that contains this PerformanceModelMesh.
16241
+ * The DataTextureSceneModelNode that contains this PerformanceModelMesh.
16238
16242
  *
16239
- * A PerformanceModelMesh always belongs to exactly one VBOSceneModelNode.
16243
+ * A PerformanceModelMesh always belongs to exactly one DataTextureSceneModelNode.
16240
16244
  *
16241
16245
  * @property object
16242
16246
  * @type {VBOSceneModelNode}
@@ -16284,7 +16288,7 @@ class VBOSceneModelMesh$1 {
16284
16288
  this.numTriangles = 0;
16285
16289
 
16286
16290
  /**
16287
- * 3D origin of the VBOSceneModelMesh's vertex positions, if they are in relative-to-center (RTC) coordinates.
16291
+ * 3D origin of the DataTextureSceneModelMesh's vertex positions, if they are in relative-to-center (RTC) coordinates.
16288
16292
  *
16289
16293
  * When this is defined, then the positions are RTC, which means that they are relative to this position.
16290
16294
  *
@@ -16502,7 +16506,7 @@ const tempIntRGB = new Uint16Array([0, 0, 0]);
16502
16506
  /**
16503
16507
  * @private
16504
16508
  */
16505
- class VBOSceneModelNode {
16509
+ class DataTextureSceneModelNode {
16506
16510
 
16507
16511
  /**
16508
16512
  * @private
@@ -16512,7 +16516,7 @@ class VBOSceneModelNode {
16512
16516
  this._isObject = isObject;
16513
16517
 
16514
16518
  /**
16515
- * The {@link Scene} that contains this VBOSceneModelNode.
16519
+ * The {@link Scene} that contains this DataTextureSceneModelNode.
16516
16520
  *
16517
16521
  * @property scene
16518
16522
  * @type {Scene}
@@ -16521,7 +16525,7 @@ class VBOSceneModelNode {
16521
16525
  this.scene = model.scene;
16522
16526
 
16523
16527
  /**
16524
- * The VBOSceneModel that contains this VBOSceneModelNode.
16528
+ * The VBOSceneModel that contains this DataTextureSceneModelNode.
16525
16529
  * @property model
16526
16530
  * @type {VBOSceneModel}
16527
16531
  * @final
@@ -16529,7 +16533,7 @@ class VBOSceneModelNode {
16529
16533
  this.model = model;
16530
16534
 
16531
16535
  /**
16532
- * The PerformanceModelMesh instances contained by this VBOSceneModelNode
16536
+ * The PerformanceModelMesh instances contained by this DataTextureSceneModelNode
16533
16537
  * @property meshes
16534
16538
  * @type {{Array of PerformanceModelMesh}}
16535
16539
  * @final
@@ -16545,7 +16549,7 @@ class VBOSceneModelNode {
16545
16549
  }
16546
16550
 
16547
16551
  /**
16548
- * ID of this VBOSceneModelNode, unique within the {@link Scene}.
16552
+ * ID of this DataTextureSceneModelNode, unique within the {@link Scene}.
16549
16553
  * @property id
16550
16554
  * @type {String|Number}
16551
16555
  * @final
@@ -16583,7 +16587,7 @@ class VBOSceneModelNode {
16583
16587
  //------------------------------------------------------------------------------------------------------------------
16584
16588
 
16585
16589
  /**
16586
- * Returns true to indicate that VBOSceneModelNode is an {@link Entity}.
16590
+ * Returns true to indicate that DataTextureSceneModelNode is an {@link Entity}.
16587
16591
  * @type {Boolean}
16588
16592
  */
16589
16593
  get isEntity() {
@@ -16591,7 +16595,7 @@ class VBOSceneModelNode {
16591
16595
  }
16592
16596
 
16593
16597
  /**
16594
- * Always returns ````false```` because a VBOSceneModelNode can never represent a model.
16598
+ * Always returns ````false```` because a DataTextureSceneModelNode can never represent a model.
16595
16599
  *
16596
16600
  * @type {Boolean}
16597
16601
  */
@@ -16600,9 +16604,9 @@ class VBOSceneModelNode {
16600
16604
  }
16601
16605
 
16602
16606
  /**
16603
- * Returns ````true```` if this VBOSceneModelNode represents an object.
16607
+ * Returns ````true```` if this DataTextureSceneModelNode represents an object.
16604
16608
  *
16605
- * When ````true```` the VBOSceneModelNode will be registered by {@link VBOSceneModelNode#id} in
16609
+ * When ````true```` the DataTextureSceneModelNode will be registered by {@link DataTextureSceneModelNode#id} in
16606
16610
  * {@link Scene#objects} and may also have a {@link MetaObject} with matching {@link MetaObject#id}.
16607
16611
  *
16608
16612
  * @type {Boolean}
@@ -16612,7 +16616,7 @@ class VBOSceneModelNode {
16612
16616
  }
16613
16617
 
16614
16618
  /**
16615
- * World-space 3D axis-aligned bounding box (AABB) of this VBOSceneModelNode.
16619
+ * World-space 3D axis-aligned bounding box (AABB) of this DataTextureSceneModelNode.
16616
16620
  *
16617
16621
  * Represented by a six-element Float64Array containing the min/max extents of the
16618
16622
  * axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
@@ -16624,7 +16628,7 @@ class VBOSceneModelNode {
16624
16628
  }
16625
16629
 
16626
16630
  /**
16627
- * The approximate number of triangles in this VBOSceneModelNode.
16631
+ * The approximate number of triangles in this DataTextureSceneModelNode.
16628
16632
  *
16629
16633
  * @type {Number}
16630
16634
  */
@@ -16633,12 +16637,12 @@ class VBOSceneModelNode {
16633
16637
  }
16634
16638
 
16635
16639
  /**
16636
- * Gets if this VBOSceneModelNode is visible.
16640
+ * Gets if this DataTextureSceneModelNode is visible.
16637
16641
  *
16638
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16642
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16639
16643
  *
16640
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#visible} are ````true```` the VBOSceneModelNode will be
16641
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#visibleObjects}.
16644
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#visible} are ````true```` the DataTextureSceneModelNode will be
16645
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#visibleObjects}.
16642
16646
  *
16643
16647
  * @type {Boolean}
16644
16648
  */
@@ -16647,12 +16651,12 @@ class VBOSceneModelNode {
16647
16651
  }
16648
16652
 
16649
16653
  /**
16650
- * Sets if this VBOSceneModelNode is visible.
16654
+ * Sets if this DataTextureSceneModelNode is visible.
16651
16655
  *
16652
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16656
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16653
16657
  *
16654
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#visible} are ````true```` the VBOSceneModelNode will be
16655
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#visibleObjects}.
16658
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#visible} are ````true```` the DataTextureSceneModelNode will be
16659
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#visibleObjects}.
16656
16660
  *
16657
16661
  * @type {Boolean}
16658
16662
  */
@@ -16675,10 +16679,10 @@ class VBOSceneModelNode {
16675
16679
  }
16676
16680
 
16677
16681
  /**
16678
- * Gets if this VBOSceneModelNode is highlighted.
16682
+ * Gets if this DataTextureSceneModelNode is highlighted.
16679
16683
  *
16680
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#highlighted} are ````true```` the VBOSceneModelNode will be
16681
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#highlightedObjects}.
16684
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#highlighted} are ````true```` the DataTextureSceneModelNode will be
16685
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#highlightedObjects}.
16682
16686
  *
16683
16687
  * @type {Boolean}
16684
16688
  */
@@ -16687,10 +16691,10 @@ class VBOSceneModelNode {
16687
16691
  }
16688
16692
 
16689
16693
  /**
16690
- * Sets if this VBOSceneModelNode is highlighted.
16694
+ * Sets if this DataTextureSceneModelNode is highlighted.
16691
16695
  *
16692
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#highlighted} are ````true```` the VBOSceneModelNode will be
16693
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#highlightedObjects}.
16696
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#highlighted} are ````true```` the DataTextureSceneModelNode will be
16697
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#highlightedObjects}.
16694
16698
  *
16695
16699
  * @type {Boolean}
16696
16700
  */
@@ -16713,10 +16717,10 @@ class VBOSceneModelNode {
16713
16717
  }
16714
16718
 
16715
16719
  /**
16716
- * Gets if this VBOSceneModelNode is xrayed.
16720
+ * Gets if this DataTextureSceneModelNode is xrayed.
16717
16721
  *
16718
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#xrayed} are ````true```` the VBOSceneModelNode will be
16719
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#xrayedObjects}.
16722
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#xrayed} are ````true```` the DataTextureSceneModelNode will be
16723
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#xrayedObjects}.
16720
16724
  *
16721
16725
  * @type {Boolean}
16722
16726
  */
@@ -16725,10 +16729,10 @@ class VBOSceneModelNode {
16725
16729
  }
16726
16730
 
16727
16731
  /**
16728
- * Sets if this VBOSceneModelNode is xrayed.
16732
+ * Sets if this DataTextureSceneModelNode is xrayed.
16729
16733
  *
16730
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#xrayed} are ````true```` the VBOSceneModelNode will be
16731
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#xrayedObjects}.
16734
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#xrayed} are ````true```` the DataTextureSceneModelNode will be
16735
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#xrayedObjects}.
16732
16736
  *
16733
16737
  * @type {Boolean}
16734
16738
  */
@@ -16751,10 +16755,10 @@ class VBOSceneModelNode {
16751
16755
  }
16752
16756
 
16753
16757
  /**
16754
- * Sets if this VBOSceneModelNode is selected.
16758
+ * Sets if this DataTextureSceneModelNode is selected.
16755
16759
  *
16756
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#selected} are ````true```` the VBOSceneModelNode will be
16757
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#selectedObjects}.
16760
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#selected} are ````true```` the DataTextureSceneModelNode will be
16761
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#selectedObjects}.
16758
16762
  *
16759
16763
  * @type {Boolean}
16760
16764
  */
@@ -16763,10 +16767,10 @@ class VBOSceneModelNode {
16763
16767
  }
16764
16768
 
16765
16769
  /**
16766
- * Gets if this VBOSceneModelNode is selected.
16770
+ * Gets if this DataTextureSceneModelNode is selected.
16767
16771
  *
16768
- * When both {@link VBOSceneModelNode#isObject} and {@link VBOSceneModelNode#selected} are ````true```` the VBOSceneModelNode will be
16769
- * registered by {@link VBOSceneModelNode#id} in {@link Scene#selectedObjects}.
16772
+ * When both {@link DataTextureSceneModelNode#isObject} and {@link DataTextureSceneModelNode#selected} are ````true```` the DataTextureSceneModelNode will be
16773
+ * registered by {@link DataTextureSceneModelNode#id} in {@link Scene#selectedObjects}.
16770
16774
  *
16771
16775
  * @type {Boolean}
16772
16776
  */
@@ -16789,7 +16793,7 @@ class VBOSceneModelNode {
16789
16793
  }
16790
16794
 
16791
16795
  /**
16792
- * Gets if this VBOSceneModelNode's edges are enhanced.
16796
+ * Gets if this DataTextureSceneModelNode's edges are enhanced.
16793
16797
  *
16794
16798
  * @type {Boolean}
16795
16799
  */
@@ -16798,7 +16802,7 @@ class VBOSceneModelNode {
16798
16802
  }
16799
16803
 
16800
16804
  /**
16801
- * Sets if this VBOSceneModelNode's edges are enhanced.
16805
+ * Sets if this DataTextureSceneModelNode's edges are enhanced.
16802
16806
  *
16803
16807
  * @type {Boolean}
16804
16808
  */
@@ -16836,9 +16840,9 @@ class VBOSceneModelNode {
16836
16840
  }
16837
16841
 
16838
16842
  /**
16839
- * Gets if this VBOSceneModelNode is culled.
16843
+ * Gets if this DataTextureSceneModelNode is culled.
16840
16844
  *
16841
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16845
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16842
16846
  *
16843
16847
  * @type {Boolean}
16844
16848
  */
@@ -16848,9 +16852,9 @@ class VBOSceneModelNode {
16848
16852
  }
16849
16853
 
16850
16854
  /**
16851
- * Sets if this VBOSceneModelNode is culled.
16855
+ * Sets if this DataTextureSceneModelNode is culled.
16852
16856
  *
16853
- * Only rendered when {@link VBOSceneModelNode#visible} is ````true```` and {@link VBOSceneModelNode#culled} is ````false````.
16857
+ * Only rendered when {@link DataTextureSceneModelNode#visible} is ````true```` and {@link DataTextureSceneModelNode#culled} is ````false````.
16854
16858
  *
16855
16859
  * @type {Boolean}
16856
16860
  */
@@ -16878,7 +16882,7 @@ class VBOSceneModelNode {
16878
16882
  }
16879
16883
 
16880
16884
  /**
16881
- * Gets if this VBOSceneModelNode is clippable.
16885
+ * Gets if this DataTextureSceneModelNode is clippable.
16882
16886
  *
16883
16887
  * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
16884
16888
  *
@@ -16889,7 +16893,7 @@ class VBOSceneModelNode {
16889
16893
  }
16890
16894
 
16891
16895
  /**
16892
- * Sets if this VBOSceneModelNode is clippable.
16896
+ * Sets if this DataTextureSceneModelNode is clippable.
16893
16897
  *
16894
16898
  * Clipping is done by the {@link SectionPlane}s in {@link Scene#sectionPlanes}.
16895
16899
  *
@@ -16911,7 +16915,7 @@ class VBOSceneModelNode {
16911
16915
  }
16912
16916
 
16913
16917
  /**
16914
- * Gets if this VBOSceneModelNode is included in boundary calculations.
16918
+ * Gets if this DataTextureSceneModelNode is included in boundary calculations.
16915
16919
  *
16916
16920
  * @type {Boolean}
16917
16921
  */
@@ -16920,7 +16924,7 @@ class VBOSceneModelNode {
16920
16924
  }
16921
16925
 
16922
16926
  /**
16923
- * Sets if this VBOSceneModelNode is included in boundary calculations.
16927
+ * Sets if this DataTextureSceneModelNode is included in boundary calculations.
16924
16928
  *
16925
16929
  * @type {Boolean}
16926
16930
  */
@@ -16939,7 +16943,7 @@ class VBOSceneModelNode {
16939
16943
  }
16940
16944
 
16941
16945
  /**
16942
- * Gets if this VBOSceneModelNode is pickable.
16946
+ * Gets if this DataTextureSceneModelNode is pickable.
16943
16947
  *
16944
16948
  * Picking is done via calls to {@link Scene#pick}.
16945
16949
  *
@@ -16950,7 +16954,7 @@ class VBOSceneModelNode {
16950
16954
  }
16951
16955
 
16952
16956
  /**
16953
- * Sets if this VBOSceneModelNode is pickable.
16957
+ * Sets if this DataTextureSceneModelNode is pickable.
16954
16958
  *
16955
16959
  * Picking is done via calls to {@link Scene#pick}.
16956
16960
  *
@@ -16971,7 +16975,7 @@ class VBOSceneModelNode {
16971
16975
  }
16972
16976
 
16973
16977
  /**
16974
- * Gets the VBOSceneModelNode's RGB colorize color.
16978
+ * Gets the DataTextureSceneModelNode's RGB colorize color.
16975
16979
  *
16976
16980
  * Each element of the color is in range ````[0..1]````.
16977
16981
  *
@@ -16989,7 +16993,7 @@ class VBOSceneModelNode {
16989
16993
  }
16990
16994
 
16991
16995
  /**
16992
- * Sets the VBOSceneModelNode's RGB colorize color.
16996
+ * Sets the DataTextureSceneModelNode's RGB colorize color.
16993
16997
  *
16994
16998
  * Each element of the color is in range ````[0..1]````.
16995
16999
  *
@@ -17017,7 +17021,7 @@ class VBOSceneModelNode {
17017
17021
  }
17018
17022
 
17019
17023
  /**
17020
- * Gets the VBOSceneModelNode's opacity factor.
17024
+ * Gets the DataTextureSceneModelNode's opacity factor.
17021
17025
  *
17022
17026
  * This is a factor in range ````[0..1]```` which multiplies by the rendered fragment alphas.
17023
17027
  *
@@ -17032,7 +17036,7 @@ class VBOSceneModelNode {
17032
17036
  }
17033
17037
 
17034
17038
  /**
17035
- * Sets the VBOSceneModelNode's opacity factor, multiplies by the VBOSceneModelNode's rendered fragment alphas.
17039
+ * Sets the DataTextureSceneModelNode's opacity factor, multiplies by the DataTextureSceneModelNode's rendered fragment alphas.
17036
17040
  *
17037
17041
  * This is a factor in range ````[0..1]````.
17038
17042
  *
@@ -17072,7 +17076,7 @@ class VBOSceneModelNode {
17072
17076
  }
17073
17077
 
17074
17078
  /**
17075
- * Gets the VBOSceneModelNode's 3D World-space offset.
17079
+ * Gets the DataTextureSceneModelNode's 3D World-space offset.
17076
17080
  *
17077
17081
  * Default value is ````[0,0,0]````.
17078
17082
  *
@@ -17083,9 +17087,9 @@ class VBOSceneModelNode {
17083
17087
  }
17084
17088
 
17085
17089
  /**
17086
- * Sets the VBOSceneModelNode's 3D World-space offset.
17090
+ * Sets the DataTextureSceneModelNode's 3D World-space offset.
17087
17091
  *
17088
- * The offset dynamically translates the VBOSceneModelNode in World-space.
17092
+ * The offset dynamically translates the DataTextureSceneModelNode in World-space.
17089
17093
  *
17090
17094
  * Default value is ````[0, 0, 0]````.
17091
17095
  *
@@ -17119,7 +17123,7 @@ class VBOSceneModelNode {
17119
17123
  }
17120
17124
 
17121
17125
  /**
17122
- * Gets if this VBOSceneModelNode casts shadows.
17126
+ * Gets if this DataTextureSceneModelNode casts shadows.
17123
17127
  *
17124
17128
  * @type {Boolean}
17125
17129
  */
@@ -17128,7 +17132,7 @@ class VBOSceneModelNode {
17128
17132
  }
17129
17133
 
17130
17134
  /**
17131
- * Sets if to this VBOSceneModelNode casts shadows.
17135
+ * Sets if to this DataTextureSceneModelNode casts shadows.
17132
17136
  *
17133
17137
  * @type {Boolean}
17134
17138
  */
@@ -17137,7 +17141,7 @@ class VBOSceneModelNode {
17137
17141
  }
17138
17142
 
17139
17143
  /**
17140
- * Whether or not this VBOSceneModelNode can have shadows cast upon it
17144
+ * Whether or not this DataTextureSceneModelNode can have shadows cast upon it
17141
17145
  *
17142
17146
  * @type {Boolean}
17143
17147
  */
@@ -17146,7 +17150,7 @@ class VBOSceneModelNode {
17146
17150
  }
17147
17151
 
17148
17152
  /**
17149
- * Whether or not this VBOSceneModelNode can have shadows cast upon it
17153
+ * Whether or not this DataTextureSceneModelNode can have shadows cast upon it
17150
17154
  *
17151
17155
  * @type {Boolean}
17152
17156
  */
@@ -17155,7 +17159,7 @@ class VBOSceneModelNode {
17155
17159
  }
17156
17160
 
17157
17161
  /**
17158
- * Gets if Scalable Ambient Obscurance (SAO) will apply to this VBOSceneModelNode.
17162
+ * Gets if Scalable Ambient Obscurance (SAO) will apply to this DataTextureSceneModelNode.
17159
17163
  *
17160
17164
  * SAO is configured by the Scene's {@link SAO} component.
17161
17165
  *
@@ -17229,68 +17233,6 @@ class VBOSceneModelNode {
17229
17233
 
17230
17234
  }
17231
17235
 
17232
- /**
17233
- * Provides scratch memory for methods like TrianglesBatchingLayer setFlags() and setColors(),
17234
- * so they don't need to allocate temporary arrays that need garbage collection.
17235
- *
17236
- * @private
17237
- */
17238
- class ScratchMemory$1 {
17239
-
17240
- constructor() {
17241
- this._uint8Arrays = {};
17242
- this._float32Arrays = {};
17243
- }
17244
-
17245
- _clear() {
17246
- this._uint8Arrays = {};
17247
- this._float32Arrays = {};
17248
- }
17249
-
17250
- getUInt8Array(len) {
17251
- let uint8Array = this._uint8Arrays[len];
17252
- if (!uint8Array) {
17253
- uint8Array = new Uint8Array(len);
17254
- this._uint8Arrays[len] = uint8Array;
17255
- }
17256
- return uint8Array;
17257
- }
17258
-
17259
- getFloat32Array(len) {
17260
- let float32Array = this._float32Arrays[len];
17261
- if (!float32Array) {
17262
- float32Array = new Float32Array(len);
17263
- this._float32Arrays[len] = float32Array;
17264
- }
17265
- return float32Array;
17266
- }
17267
- }
17268
-
17269
- const batchingLayerScratchMemory$1 = new ScratchMemory$1();
17270
-
17271
- let countUsers$1 = 0;
17272
-
17273
- /**
17274
- * @private
17275
- */
17276
- function getScratchMemory$1() {
17277
- countUsers$1++;
17278
- return batchingLayerScratchMemory$1;
17279
- }
17280
-
17281
- /**
17282
- * @private
17283
- */
17284
- function putScratchMemory$1() {
17285
- if (countUsers$1 === 0) {
17286
- return;
17287
- }
17288
- countUsers$1--;
17289
- if (countUsers$1 === 0) {
17290
- batchingLayerScratchMemory$1._clear();
17291
- }
17292
- }
17293
-
17294
17236
  /**
17295
17237
  * @private
17296
17238
  */
@@ -19887,7 +19829,7 @@ class TrianglesDataTextureColorRenderer {
19887
19829
  tempVec4$9[2] = sao.blendCutoff;
19888
19830
  tempVec4$9[3] = sao.blendFactor;
19889
19831
  gl.uniform4fv(this._uSAOParams, tempVec4$9);
19890
- this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 0);
19832
+ this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 10);
19891
19833
  }
19892
19834
  }
19893
19835
 
@@ -19987,15 +19929,6 @@ class TrianglesDataTextureColorRenderer {
19987
19929
 
19988
19930
  src.push("void main(void) {");
19989
19931
 
19990
- // camera matrices
19991
- 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));");
19992
- 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));");
19993
- 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));");
19994
-
19995
- // model matrices
19996
- 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));");
19997
- 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));");
19998
-
19999
19932
  // constants
20000
19933
  src.push("int polygonIndex = gl_VertexID / 3;");
20001
19934
 
@@ -20018,6 +19951,15 @@ class TrianglesDataTextureColorRenderer {
20018
19951
  src.push(" return;"); // Cull vertex
20019
19952
  src.push("} else {");
20020
19953
 
19954
+ // camera matrices
19955
+ 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));");
19956
+ 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));");
19957
+ 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));");
19958
+
19959
+ // model matrices
19960
+ 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));");
19961
+ 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));");
19962
+
20021
19963
  // get vertex base
20022
19964
  src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"); // chipmunk
20023
19965
 
@@ -20218,7 +20160,7 @@ class TrianglesDataTextureColorRenderer {
20218
20160
  src.push(" float blendCutoff = uSAOParams[2];");
20219
20161
  src.push(" float blendFactor = uSAOParams[3];");
20220
20162
  src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");
20221
- src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture2D(uOcclusionTexture, uv))) * blendFactor;");
20163
+ src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");
20222
20164
  src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");
20223
20165
  } else {
20224
20166
  src.push(" outColor = vColor;");
@@ -23076,6 +23018,7 @@ class TrianglesDataTextureOcclusionRenderer {
23076
23018
  }
23077
23019
  }
23078
23020
 
23021
+ math.vec4();
23079
23022
  const tempVec3a$17 = math.vec3();
23080
23023
 
23081
23024
  /**
@@ -23098,12 +23041,12 @@ class TrianglesDataTextureDepthRenderer {
23098
23041
  }
23099
23042
 
23100
23043
  drawLayer(frameCtx, dataTextureLayer, renderPass) {
23101
-
23102
- const model = dataTextureLayer.model;
23103
- const scene = model.scene;
23044
+ const scene = this._scene;
23104
23045
  const camera = scene.camera;
23046
+ const model = dataTextureLayer.model;
23105
23047
  const gl = scene.canvas.gl;
23106
23048
  const state = dataTextureLayer._state;
23049
+ const textureState = state.textureState;
23107
23050
  const origin = dataTextureLayer._state.origin;
23108
23051
 
23109
23052
  if (!this._program) {
@@ -23115,13 +23058,38 @@ class TrianglesDataTextureDepthRenderer {
23115
23058
 
23116
23059
  if (frameCtx.lastProgramId !== this._program.id) {
23117
23060
  frameCtx.lastProgramId = this._program.id;
23118
- this._bindProgram();
23061
+ this._bindProgram(frameCtx, state);
23119
23062
  }
23063
+
23064
+ textureState.bindCommonTextures (
23065
+ this._program,
23066
+ this._uTexturePerObjectIdPositionsDecodeMatrix,
23067
+ this._uTexturePerVertexIdCoordinates,
23068
+ this._uTexturePerObjectIdColorsAndFlags,
23069
+ this._uTextureCameraMatrices,
23070
+ this._uTextureModelMatrices,
23071
+ this._uTexturePerObjectIdOffsets
23072
+ );
23120
23073
 
23121
- gl.uniform1i(this._uRenderPass, renderPass);
23074
+ let cameraEye = camera.eye;
23122
23075
 
23123
- gl.uniformMatrix4fv(this._uWorldMatrix, false, model.worldMatrix);
23124
- gl.uniformMatrix4fv(this._uViewMatrix, false, (origin) ? createRTCViewMat(camera.viewMatrix, origin) : camera.viewMatrix);
23076
+ if (frameCtx.pickViewMatrix) {
23077
+ textureState.bindPickCameraTexture (
23078
+ this._program,
23079
+ this._uTextureCameraMatrices
23080
+ );
23081
+ cameraEye = frameCtx.pickOrigin || cameraEye;
23082
+ }
23083
+
23084
+ const originCameraEye = [
23085
+ cameraEye[0] - origin[0],
23086
+ cameraEye[1] - origin[1],
23087
+ cameraEye[2] - origin[2],
23088
+ ];
23089
+
23090
+ gl.uniform3fv(this._uCameraEyeRtc, originCameraEye);
23091
+
23092
+ gl.uniform1i(this._uRenderPass, renderPass);
23125
23093
 
23126
23094
  const numSectionPlanes = scene._sectionPlanesState.sectionPlanes.length;
23127
23095
  if (numSectionPlanes > 0) {
@@ -23147,23 +23115,43 @@ class TrianglesDataTextureDepthRenderer {
23147
23115
  }
23148
23116
  }
23149
23117
 
23150
- gl.uniformMatrix4fv(this._uPositionsDecodeMatrix, false, dataTextureLayer._state.positionsDecodeMatrix);
23151
-
23152
- this._aPosition.bindArrayBuffer(state.positionsBuf);
23118
+ if (state.numIndices8Bits > 0)
23119
+ {
23120
+ textureState.bindTriangleIndicesTextures(
23121
+ this._program,
23122
+ this._uTexturePerPolygonIdPortionIds,
23123
+ this._uTexturePerPolygonIdIndices,
23124
+ 8 // 8 bits indices
23125
+ );
23153
23126
 
23154
- if (this._aOffset) {
23155
- this._aOffset.bindArrayBuffer(state.offsetsBuf);
23127
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices8Bits);
23156
23128
  }
23157
23129
 
23158
- this._aFlags.bindArrayBuffer(state.flagsBuf);
23130
+ if (state.numIndices16Bits > 0)
23131
+ {
23132
+ textureState.bindTriangleIndicesTextures(
23133
+ this._program,
23134
+ this._uTexturePerPolygonIdPortionIds,
23135
+ this._uTexturePerPolygonIdIndices,
23136
+ 16 // 16 bits indices
23137
+ );
23159
23138
 
23160
- if (this._aFlags2) {
23161
- this._aFlags2.bindArrayBuffer(state.flags2Buf);
23139
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices16Bits);
23162
23140
  }
23141
+
23142
+ if (state.numIndices32Bits > 0)
23143
+ {
23144
+ textureState.bindTriangleIndicesTextures(
23145
+ this._program,
23146
+ this._uTexturePerPolygonIdPortionIds,
23147
+ this._uTexturePerPolygonIdIndices,
23148
+ 32 // 32 bits indices
23149
+ );
23163
23150
 
23164
- state.indicesBuf.bind();
23151
+ gl.drawArrays(gl.TRIANGLES, 0, state.numIndices32Bits);
23152
+ }
23165
23153
 
23166
- gl.drawElements(gl.TRIANGLES, state.indicesBuf.numItems, state.indicesBuf.itemType, 0);
23154
+ frameCtx.drawElements++;
23167
23155
  }
23168
23156
 
23169
23157
  _allocate() {
@@ -23195,23 +23183,30 @@ class TrianglesDataTextureDepthRenderer {
23195
23183
  });
23196
23184
  }
23197
23185
 
23198
- this._aPosition = program.getAttribute("position");
23199
- this._aOffset = program.getAttribute("offset");
23200
- this._aFlags = program.getAttribute("flags");
23201
- this._aFlags2 = program.getAttribute("flags2");
23202
-
23203
23186
  if (scene.logarithmicDepthBufferEnabled) {
23204
23187
  this._uLogDepthBufFC = program.getLocation("logDepthBufFC");
23205
23188
  }
23189
+
23190
+ this._uTexturePerObjectIdPositionsDecodeMatrix = "uTexturePerObjectIdPositionsDecodeMatrix"; // chipmunk
23191
+ this._uTexturePerObjectIdColorsAndFlags = "uTexturePerObjectIdColorsAndFlags"; // chipmunk
23192
+ this._uTexturePerVertexIdCoordinates = "uTexturePerVertexIdCoordinates"; // chipmunk
23193
+ this._uTexturePerPolygonIdNormals = "uTexturePerPolygonIdNormals"; // chipmunk
23194
+ this._uTexturePerPolygonIdIndices = "uTexturePerPolygonIdIndices"; // chipmunk
23195
+ this._uTexturePerPolygonIdPortionIds = "uTexturePerPolygonIdPortionIds"; // chipmunk
23196
+ this._uTextureCameraMatrices = "uTextureCameraMatrices"; // chipmunk
23197
+ this._uTextureModelMatrices = "uTextureModelMatrices"; // chipmunk
23198
+ this._uTexturePerObjectIdOffsets = "uTexturePerObjectIdOffsets"; // chipmunk
23199
+ this._uCameraEyeRtc = program.getLocation("uCameraEyeRtc"); // chipmunk
23206
23200
  }
23207
23201
 
23208
- _bindProgram() {
23202
+ _bindProgram(frameCtx) {
23209
23203
 
23210
23204
  const scene = this._scene;
23211
23205
  const gl = scene.canvas.gl;
23206
+ const program = this._program;
23212
23207
  const project = scene.camera.project;
23213
23208
 
23214
- this._program.bind();
23209
+ program.bind();
23215
23210
 
23216
23211
  gl.uniformMatrix4fv(this._uProjMatrix, false, project.matrix);
23217
23212
 
@@ -23230,131 +23225,240 @@ class TrianglesDataTextureDepthRenderer {
23230
23225
 
23231
23226
  _buildVertexShader() {
23232
23227
  const scene = this._scene;
23233
- const clipping = scene._sectionPlanesState.sectionPlanes.length > 0;
23228
+ const sectionPlanesState = scene._sectionPlanesState;
23229
+ scene._lightsState;
23230
+ const clipping = sectionPlanesState.sectionPlanes.length > 0;
23234
23231
  const src = [];
23235
- src.push("// Triangles dataTexture depth vertex shader");
23236
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23237
- src.push("#extension GL_EXT_frag_depth : enable");
23238
- }
23232
+ src.push("#version 300 es");
23233
+ src.push("// Triangles dataTexture draw vertex shader");
23234
+
23235
+ src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
23236
+ src.push("precision highp float;");
23237
+ src.push("precision highp int;");
23238
+ src.push("precision highp usampler2D;");
23239
+ src.push("precision highp isampler2D;");
23240
+ src.push("precision highp sampler2D;");
23241
+ src.push("#else");
23242
+ src.push("precision mediump float;");
23243
+ src.push("precision mediump int;");
23244
+ src.push("precision mediump usampler2D;");
23245
+ src.push("precision mediump isampler2D;");
23246
+ src.push("precision mediump sampler2D;");
23247
+ src.push("#endif");
23248
+
23239
23249
  src.push("uniform int renderPass;");
23240
- src.push("attribute vec3 position;");
23250
+
23241
23251
  if (scene.entityOffsetsEnabled) {
23242
- src.push("attribute vec3 offset;");
23252
+ src.push("in vec3 offset;");
23243
23253
  }
23244
- src.push("attribute vec4 flags;");
23245
- src.push("attribute vec4 flags2;");
23246
- src.push("uniform mat4 worldMatrix;");
23247
- src.push("uniform mat4 viewMatrix;");
23248
- src.push("uniform mat4 projMatrix;");
23249
- src.push("uniform mat4 positionsDecodeMatrix;");
23254
+
23255
+ // src.push("uniform sampler2D uOcclusionTexture;"); // chipmunk
23256
+
23257
+ src.push("uniform highp sampler2D uTexturePerObjectIdPositionsDecodeMatrix;"); // chipmunk
23258
+ src.push("uniform lowp usampler2D uTexturePerObjectIdColorsAndFlags;"); // chipmunk
23259
+ src.push("uniform highp sampler2D uTexturePerObjectIdOffsets;"); // chipmunk
23260
+ src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;"); // chipmunk
23261
+ src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;"); // chipmunk
23262
+ src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;"); // chipmunk
23263
+ src.push("uniform highp sampler2D uTextureCameraMatrices;"); // chipmunk
23264
+ src.push("uniform highp sampler2D uTextureModelMatrices;"); // chipmunk
23265
+ src.push("uniform vec3 uCameraEyeRtc;"); // chipmunk
23266
+
23267
+ src.push("vec3 positions[3];");
23268
+
23250
23269
  if (scene.logarithmicDepthBufferEnabled) {
23251
23270
  src.push("uniform float logDepthBufFC;");
23252
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23253
- src.push("varying float vFragDepth;");
23254
- }
23255
- src.push("bool isPerspectiveMatrix(mat4 m) {");
23256
- src.push(" return (m[2][3] == - 1.0);");
23257
- src.push("}");
23258
- src.push("varying float isPerspective;");
23271
+ src.push("out float vFragDepth;");
23272
+ src.push("out float isPerspective;");
23259
23273
  }
23274
+
23275
+ src.push("bool isPerspectiveMatrix(mat4 m) {");
23276
+ src.push(" return (m[2][3] == - 1.0);");
23277
+ src.push("}");
23278
+
23279
+ src.push("out highp vec2 vHighPrecisionZW;");
23280
+
23260
23281
  if (clipping) {
23261
- src.push("varying vec4 vWorldPosition;");
23262
- src.push("varying vec4 vFlags2;");
23282
+ src.push("out vec4 vWorldPosition;");
23283
+ src.push("flat out uint vFlags2;");
23263
23284
  }
23264
- src.push("varying vec2 vHighPrecisionZW;");
23285
+
23265
23286
  src.push("void main(void) {");
23266
23287
 
23288
+ // constants
23289
+ src.push("int polygonIndex = gl_VertexID / 3;");
23290
+
23291
+ // get packed object-id
23292
+ src.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;");
23293
+ src.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;");
23294
+
23295
+ src.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);");
23296
+ src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");
23297
+
23298
+ // get flags & flags2
23299
+ src.push("uvec4 flags = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);"); // chipmunk
23300
+ src.push("uvec4 flags2 = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);"); // chipmunk
23301
+
23267
23302
  // flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
23268
23303
  // renderPass = COLOR_OPAQUE
23269
23304
 
23270
23305
  src.push(`if (int(flags.x) != renderPass) {`);
23271
- src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);"); // Cull vertex
23272
- src.push(" } else {");
23273
- src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");
23274
- if (scene.entityOffsetsEnabled) {
23275
- src.push(" worldPosition.xyz = worldPosition.xyz + offset;");
23276
- }
23277
- src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
23278
- if (clipping) {
23279
- src.push(" vWorldPosition = worldPosition;");
23280
- src.push(" vFlags2 = flags2;");
23281
- }
23306
+ src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
23307
+ src.push(" return;"); // Cull vertex
23308
+ src.push("} else {");
23309
+
23310
+ // camera matrices
23311
+ 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));");
23312
+ 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));");
23313
+ 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));");
23314
+
23315
+ // model matrices
23316
+ 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));");
23317
+ 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));");
23318
+
23319
+ // get vertex base
23320
+ src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));"); // chipmunk
23321
+
23322
+ src.push("ivec4 packedIndexBaseOffset = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+5, objectIndexCoords.y), 0));"); // chipmunk
23323
+
23324
+ src.push("int indexBaseOffset = (packedIndexBaseOffset.r << 24) + (packedIndexBaseOffset.g << 16) + (packedIndexBaseOffset.b << 8) + packedIndexBaseOffset.a;");
23325
+
23326
+ src.push("int h_index = (polygonIndex - indexBaseOffset) & 4095;");
23327
+ src.push("int v_index = (polygonIndex - indexBaseOffset) >> 12;");
23328
+
23329
+ src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdIndices, ivec2(h_index, v_index), 0));");
23330
+ src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");
23331
+
23332
+ src.push("ivec3 indexPositionH = uniqueVertexIndexes & 4095;");
23333
+ src.push("ivec3 indexPositionV = uniqueVertexIndexes >> 12;");
23334
+
23335
+ 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));");
23336
+ 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));");
23337
+
23338
+ src.push("positionsDecodeMatrix = entityMatrix * positionsDecodeMatrix;");
23339
+
23340
+ src.push("uint solid = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+7, objectIndexCoords.y), 0).r;"); // chipmunk
23341
+
23342
+ // get position
23343
+ src.push("positions[0] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.r, indexPositionV.r), 0));");
23344
+ src.push("positions[1] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.g, indexPositionV.g), 0));");
23345
+ src.push("positions[2] = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH.b, indexPositionV.b), 0));");
23346
+
23347
+ // get color
23348
+ src.push("uvec4 color = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+0, objectIndexCoords.y), 0);"); // chipmunk
23349
+
23350
+ src.push(`if (color.a == 0u) {`);
23351
+ src.push(" gl_Position = vec4(3.0, 3.0, 3.0, 1.0);"); // Cull vertex
23352
+ src.push(" return;");
23353
+ src.push("};");
23354
+
23355
+ // get normal
23356
+ src.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));");
23357
+
23358
+ src.push("vec3 position;");
23359
+ src.push("position = positions[gl_VertexID % 3];");
23360
+
23361
+ src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*positionsDecodeMatrix)) * vec4(normal,1)).xyz);");
23362
+
23363
+ // when the geometry is not solid, if needed, flip the triangle winding
23364
+ src.push("if (solid != 1u) {");
23365
+ src.push("if (isPerspectiveMatrix(projMatrix)) {");
23366
+ src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(worldMatrix * positionsDecodeMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");
23367
+ src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");
23368
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
23369
+ src.push("viewNormal = -viewNormal;");
23370
+ src.push("}");
23371
+ src.push("} else {");
23372
+ src.push("if (viewNormal.z < 0.0) {");
23373
+ src.push("position = positions[2 - (gl_VertexID % 3)];");
23374
+ src.push("viewNormal = -viewNormal;");
23375
+ src.push("}");
23376
+ src.push("}");
23377
+ src.push("}");
23378
+
23379
+ src.push("vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");
23380
+
23381
+ // get XYZ offset
23382
+ src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
23383
+
23384
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
23385
+
23386
+ src.push("vec4 viewPosition = viewMatrix * worldPosition; ");
23387
+
23282
23388
  src.push("vec4 clipPos = projMatrix * viewPosition;");
23283
23389
  if (scene.logarithmicDepthBufferEnabled) {
23284
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23285
- src.push("vFragDepth = 1.0 + clipPos.w;");
23286
- } else {
23287
- src.push("clipPos.z = log2( max( 1e-6, clipPos.w + 1.0 ) ) * logDepthBufFC - 1.0;");
23288
- src.push("clipPos.z *= clipPos.w;");
23289
- }
23390
+ src.push("vFragDepth = 1.0 + clipPos.w;");
23290
23391
  src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");
23291
23392
  }
23393
+ if (clipping) {
23394
+ src.push("vWorldPosition = worldPosition;");
23395
+ src.push("vFlags2 = flags2.r;");
23396
+ }
23292
23397
  src.push("gl_Position = clipPos;");
23293
23398
  src.push("vHighPrecisionZW = gl_Position.zw;");
23294
- src.push(" }");
23295
23399
  src.push("}");
23400
+
23401
+ src.push("}");
23402
+
23296
23403
  return src;
23297
23404
  }
23298
23405
 
23299
23406
  _buildFragmentShader() {
23300
23407
  const scene = this._scene;
23301
23408
  const sectionPlanesState = scene._sectionPlanesState;
23302
- const clipping = (sectionPlanesState.sectionPlanes.length > 0);
23409
+ const clipping = sectionPlanesState.sectionPlanes.length > 0;
23303
23410
  const src = [];
23304
- src.push("// Triangles dataTexture depth fragment shader");
23305
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23306
- src.push("#extension GL_EXT_frag_depth : enable");
23307
- }
23411
+ src.push ('#version 300 es');
23412
+ src.push("// Triangles dataTexture draw fragment shader");
23413
+ src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");
23308
23414
  src.push("precision highp float;");
23309
23415
  src.push("precision highp int;");
23310
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23311
- src.push("varying float isPerspective;");
23416
+ src.push("#else");
23417
+ src.push("precision mediump float;");
23418
+ src.push("precision mediump int;");
23419
+ src.push("#endif");
23420
+
23421
+ src.push("in highp vec2 vHighPrecisionZW;");
23422
+ src.push("out vec4 outColor;");
23423
+
23424
+ if (scene.logarithmicDepthBufferEnabled) {
23425
+ src.push("in float isPerspective;");
23312
23426
  src.push("uniform float logDepthBufFC;");
23313
- src.push("varying float vFragDepth;");
23427
+ src.push("in float vFragDepth;");
23314
23428
  }
23315
23429
  if (clipping) {
23316
- src.push("varying vec4 vWorldPosition;");
23317
- src.push("varying vec4 vFlags2;");
23318
- for (let i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
23430
+ src.push("in vec4 vWorldPosition;");
23431
+ src.push("flat in uint vFlags2;");
23432
+ for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
23319
23433
  src.push("uniform bool sectionPlaneActive" + i + ";");
23320
23434
  src.push("uniform vec3 sectionPlanePos" + i + ";");
23321
23435
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
23322
23436
  }
23323
23437
  }
23324
- src.push("const float packUpScale = 256. / 255.;");
23325
- src.push("const float unpackDownscale = 255. / 256.;");
23326
- src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");
23327
- src.push("const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );");
23328
- src.push("const float shiftRight8 = 1.0 / 256.;");
23329
-
23330
- src.push("vec4 packDepthToRGBA( const in float v ) {");
23331
- src.push(" vec4 r = vec4( fract( v * packFactors ), v );");
23332
- src.push(" r.yzw -= r.xyz * shiftRight8;");
23333
- src.push(" return r * packUpScale;");
23334
- src.push("}");
23335
- src.push("varying vec2 vHighPrecisionZW;");
23336
23438
  src.push("void main(void) {");
23439
+
23337
23440
  if (clipping) {
23338
- src.push(" bool clippable = (float(vFlags2.x) > 0.0);");
23441
+ src.push(" bool clippable = vFlags2 > 0u;");
23339
23442
  src.push(" if (clippable) {");
23340
- src.push(" float dist = 0.0;");
23341
- for (var i = 0; i < sectionPlanesState.sectionPlanes.length; i++) {
23342
- src.push(" if (sectionPlaneActive" + i + ") {");
23343
- src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
23344
- src.push(" }");
23443
+ src.push(" float dist = 0.0;");
23444
+ for (let i = 0, len = sectionPlanesState.sectionPlanes.length; i < len; i++) {
23445
+ src.push("if (sectionPlaneActive" + i + ") {");
23446
+ src.push(" dist += clamp(dot(-sectionPlaneDir" + i + ".xyz, vWorldPosition.xyz - sectionPlanePos" + i + ".xyz), 0.0, 1000.0);");
23447
+ src.push("}");
23345
23448
  }
23346
- src.push(" if (dist > 0.0) { discard; }");
23347
- src.push(" }");
23449
+ src.push(" if (dist > 0.0) { ");
23450
+ src.push(" discard;");
23451
+ src.push(" }");
23452
+ src.push("}");
23348
23453
  }
23349
- if (scene.logarithmicDepthBufferEnabled && WEBGL_INFO.SUPPORTED_EXTENSIONS["EXT_frag_depth"]) {
23350
- src.push(" gl_FragDepthEXT = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
23454
+
23455
+ if (scene.logarithmicDepthBufferEnabled) {
23456
+ // src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
23457
+ src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
23351
23458
  }
23352
23459
  src.push("float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5;");
23353
- if (WEBGL_INFO.SUPPORTED_EXTENSIONS["WEBGL_depth_texture"]) {
23354
- src.push(" gl_FragColor = vec4(vec3(1.0 - fragCoordZ), 1.0); ");
23355
- } else {
23356
- src.push(" gl_FragColor = packDepthToRGBA(fragCoordZ); "); // Must be linear depth
23357
- }
23460
+ src.push(" outColor = vec4(vec3(1.0 - fragCoordZ), 1.0); ");
23461
+ // src.push(" outColor = vec4(1.0, 1.0, 1.0, 1.0); ");
23358
23462
  src.push("}");
23359
23463
  return src;
23360
23464
  }
@@ -23368,7 +23472,6 @@ class TrianglesDataTextureDepthRenderer {
23368
23472
  this._program.destroy();
23369
23473
  }
23370
23474
  this._program = null;
23371
- stats.memory.programs--;
23372
23475
  }
23373
23476
  }
23374
23477
 
@@ -27540,7 +27643,6 @@ class TrianglesDataTextureLayer {
27540
27643
  * @param cfg.layerIndex
27541
27644
  * @param cfg.positionsDecodeMatrix
27542
27645
  * @param cfg.origin
27543
- * @param cfg.scratchMemory
27544
27646
  */
27545
27647
  constructor(model, cfg) {
27546
27648
  this._layerNumber = _numberOfLayers++;
@@ -27561,7 +27663,6 @@ class TrianglesDataTextureLayer {
27561
27663
  this._dataTextureRenderers = getDataTextureRenderers(model.scene);
27562
27664
  this.model = model;
27563
27665
  this._buffer = new TrianglesDataTextureBuffer();
27564
- this._scratchMemory = cfg.scratchMemory;
27565
27666
 
27566
27667
  /**
27567
27668
  * @type {DataTextureState}
@@ -29214,40 +29315,49 @@ class TrianglesDataTextureLayer {
29214
29315
  *
29215
29316
  * @returns {object} The mesh information enrichened with `.preparedBuckets` key.
29216
29317
  */
29217
- function prepareMeshGeometry (geometryCfg) {
29318
+ function prepareMeshGeometry (geometryCfg, enableVertexWelding, enableIndexRebucketing) {
29218
29319
  let uniquePositions, uniqueIndices, uniqueEdgeIndices;
29219
29320
 
29220
- [
29221
- uniquePositions,
29222
- uniqueIndices,
29223
- uniqueEdgeIndices,
29224
- ] = uniquifyPositions ({
29225
- positions: geometryCfg.positions,
29226
- indices: geometryCfg.indices,
29227
- edgeIndices: geometryCfg.edgeIndices
29228
- });
29321
+ if (enableVertexWelding) {
29322
+ [
29323
+ uniquePositions,
29324
+ uniqueIndices,
29325
+ uniqueEdgeIndices,
29326
+ ] = uniquifyPositions ({
29327
+ positions: geometryCfg.positions,
29328
+ indices: geometryCfg.indices,
29329
+ edgeIndices: geometryCfg.edgeIndices
29330
+ });
29331
+ } else {
29332
+ uniquePositions = geometryCfg.positions;
29333
+ uniqueIndices = geometryCfg.indices;
29334
+ uniqueEdgeIndices = geometryCfg.edgeIndices;
29335
+ }
29229
29336
 
29230
- let numUniquePositions = uniquePositions.length / 3;
29337
+ let buckets;
29231
29338
 
29232
- let buckets = rebucketPositions (
29233
- {
29339
+ if (enableIndexRebucketing) {
29340
+ let numUniquePositions = uniquePositions.length / 3;
29341
+
29342
+ buckets = rebucketPositions (
29343
+ {
29344
+ positions: uniquePositions,
29345
+ indices: uniqueIndices,
29346
+ edgeIndices: uniqueEdgeIndices,
29347
+ },
29348
+ (numUniquePositions > (1<< 16)) ? 16 : 8,
29349
+ // true
29350
+ );
29351
+ } else {
29352
+ buckets = [{
29234
29353
  positions: uniquePositions,
29235
29354
  indices: uniqueIndices,
29236
29355
  edgeIndices: uniqueEdgeIndices,
29237
- },
29238
- (numUniquePositions > (1<< 16)) ? 16 : 8,
29239
- // true
29240
- );
29356
+ }];
29357
+ }
29241
29358
 
29242
29359
  geometryCfg.preparedBuckets = buckets;
29243
29360
 
29244
- // chipmunk
29245
- // geometryCfg.preparedBuckets = [{
29246
- // positions: uniquePositions,
29247
- // indices: uniqueIndices,
29248
- // edgeIndices: uniqueEdgeIndices,
29249
- // }];
29250
-
29251
29361
  return geometryCfg;
29252
29362
  }
29253
29363
 
@@ -29594,7 +29704,7 @@ function attachFPSTracker (scene, cullingManager) {
29594
29704
  * - key: the number of triangles allowed for the objects in the bucket.
29595
29705
  * - value: all PerformanceNodes that have the number of triangles or more.
29596
29706
  *
29597
- * @type {Map<number, Array<VBOSceneModelNode>>}
29707
+ * @type {Map<number, Array<DataTextureSceneModelNode>>}
29598
29708
  */
29599
29709
  this.nodesInLOD = {};
29600
29710
 
@@ -31475,7 +31585,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31475
31585
  this._camera = model.scene.camera;
31476
31586
  }
31477
31587
 
31478
- this._ensureFrustumPropsUpdated ();
31588
+ this._ensureFrustumPropsUpdated (model);
31479
31589
 
31480
31590
  this._initializeCullingDataIfNeeded (model);
31481
31591
 
@@ -31528,7 +31638,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31528
31638
  });
31529
31639
 
31530
31640
  /**
31531
- * @type {Array<VBOSceneModelNode>}
31641
+ * @type {Array<DataTextureSceneModelNode>}
31532
31642
  * @private
31533
31643
  */
31534
31644
  this._internalNodesList = internalNodesList;
@@ -31654,9 +31764,11 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31654
31764
  }
31655
31765
 
31656
31766
  /**
31767
+ * @param {DataTextureSceneModel} model
31768
+ *
31657
31769
  * @private
31658
31770
  */
31659
- _ensureFrustumPropsUpdated ()
31771
+ _ensureFrustumPropsUpdated (model)
31660
31772
  {
31661
31773
  // Assuming "min" for fovAxis
31662
31774
  const min = Math.min (
@@ -31685,10 +31797,33 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31685
31797
  // return;
31686
31798
  // }
31687
31799
 
31800
+ // Adjust camera eye/look to take into account the `model.worldMatrix`:
31801
+ // - the entities' AABBs don't take it into account
31802
+ // - and they can't, since `model.worldMatrix` is dynamic
31803
+ // So, instead of transformating the positions of the r*tree's AABBs,
31804
+ // apply the inverse transform to the camera eye/look, since the culling
31805
+ // result is equivalent.
31806
+ const invWorldMatrix = math.inverseMat4(
31807
+ model.worldMatrix,
31808
+ math.mat4()
31809
+ );
31810
+
31811
+ const modelCamEye = math.transformVec3(
31812
+ this._camera.eye,
31813
+ invWorldMatrix,
31814
+ [ 0, 0, 0 ]
31815
+ );
31816
+
31817
+ const modelCamLook = math.transformVec3(
31818
+ this._camera.look,
31819
+ invWorldMatrix,
31820
+ [ 0, 0, 0 ]
31821
+ );
31822
+
31688
31823
  this._frustumProps.forward = math.normalizeVec3 (
31689
31824
  math.subVec3 (
31690
- this._camera.look,
31691
- this._camera.eye,
31825
+ modelCamLook,
31826
+ modelCamEye,
31692
31827
  [ 0, 0, 0]
31693
31828
  ),
31694
31829
  [ 0, 0, 0]
@@ -31708,7 +31843,7 @@ const VISIBILITY_CHECK_ENVOLVES_V = (1 << 14);
31708
31843
  [ 0, 0, 0 ]
31709
31844
  );
31710
31845
 
31711
- this._frustumProps.eye = this._camera.eye.slice ();
31846
+ this._frustumProps.eye = modelCamEye.slice ();
31712
31847
 
31713
31848
  this._frustumProps.CAM_FACTOR_1 = this._frustumProps.fov / 2 * this._frustumProps.wMultiply / _180_DIV_MATH_PI;
31714
31849
  this._frustumProps.CAM_FACTOR_2 = this._frustumProps.fov / 2 * this._frustumProps.hMultiply / _180_DIV_MATH_PI;
@@ -31979,6 +32114,8 @@ class DataTextureSceneModel extends Component {
31979
32114
  * @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.
31980
32115
  * @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````.
31981
32116
  * @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.
32117
+ * @param {Boolean} [cfg.disableVertexWelding] Disable vertex welding when loading geometry into the GPU. Default is ```false```.
32118
+ * @param {Boolean} [cfg.disableIndexRebucketing] Disable index rebucketing when loading geometry into the GPU. Default is ```false```.
31982
32119
  */
31983
32120
  constructor(owner, cfg = {}) {
31984
32121
  super(owner, cfg);
@@ -31987,6 +32124,24 @@ class DataTextureSceneModel extends Component {
31987
32124
  throw "Using a DataTextureSceneModel requires the usage of webgl2";
31988
32125
  }
31989
32126
 
32127
+ /**
32128
+ * Enable welding vertices when loading geometry into the ```TrianglesDataTextureLayer```.
32129
+ *
32130
+ * The welding is applied per-geometry.
32131
+ *
32132
+ * @type {Boolean}
32133
+ */
32134
+ this._enableVertexWelding = !cfg.disableVertexWelding;
32135
+
32136
+ /**
32137
+ * Enable demotion of index bitness then loading geometry into the ```TrianglesDataTextureLayer```.
32138
+ *
32139
+ * The rebucketing is applied per-geometry.
32140
+ *
32141
+ * @type {Boolean}
32142
+ */
32143
+ this._enableIndexRebucketing = !cfg.disableIndexRebucketing;
32144
+
31990
32145
  this._targetLodFps = cfg.targetLodFps;
31991
32146
 
31992
32147
  if (cfg.enableViewFrustumCulling) {
@@ -32005,7 +32160,7 @@ class DataTextureSceneModel extends Component {
32005
32160
  this._layerList = [];
32006
32161
 
32007
32162
  /**
32008
- * @type {Array<VBOSceneModelNode>}
32163
+ * @type {Array<DataTextureSceneModelNode>}
32009
32164
  */
32010
32165
  this._nodeList = [];
32011
32166
 
@@ -32018,15 +32173,13 @@ class DataTextureSceneModel extends Component {
32018
32173
 
32019
32174
  this._preparedInstancingGeometries = {};
32020
32175
 
32021
- this._scratchMemory = getScratchMemory$1();
32022
-
32023
32176
  /**
32024
- * @type {Map<string, VBOSceneModelMesh>}
32177
+ * @type {Map<string, DataTextureSceneModelMesh>}
32025
32178
  */
32026
32179
  this._meshes = {};
32027
32180
 
32028
32181
  /**
32029
- * @type {Map<string, VBOSceneModelNode>}
32182
+ * @type {Map<string, DataTextureSceneModelNode>}
32030
32183
  */
32031
32184
  this._nodes = {};
32032
32185
 
@@ -32142,7 +32295,7 @@ class DataTextureSceneModel extends Component {
32142
32295
  this._opacity = 1.0;
32143
32296
  this._colorize = [1, 1, 1];
32144
32297
 
32145
- this._saoEnabled = false;
32298
+ this._saoEnabled = (cfg.saoEnabled !== false);
32146
32299
 
32147
32300
  this._pbrEnabled = (!!cfg.pbrEnabled);
32148
32301
 
@@ -33038,7 +33191,11 @@ class DataTextureSceneModel extends Component {
33038
33191
 
33039
33192
  geometryCfg.edgeIndices = edgeIndices;
33040
33193
 
33041
- preparedGeometryCfg = prepareMeshGeometry (geometryCfg);
33194
+ preparedGeometryCfg = prepareMeshGeometry (
33195
+ geometryCfg,
33196
+ this._enableVertexWelding,
33197
+ this._enableIndexRebucketing
33198
+ );
33042
33199
 
33043
33200
  if (instancing) {
33044
33201
  this._preparedInstancingGeometries[geometryId] = preparedGeometryCfg;
@@ -33060,7 +33217,6 @@ class DataTextureSceneModel extends Component {
33060
33217
  {
33061
33218
  layer = new TrianglesDataTextureLayer(this, {
33062
33219
  layerIndex: 0, // This is set in #finalize()
33063
- scratchMemory: this._scratchMemory,
33064
33220
 
33065
33221
  // chipmunk
33066
33222
  // positionsDecodeMatrix: cfg.positionsDecodeMatrix, // Can be undefined
@@ -33079,7 +33235,7 @@ class DataTextureSceneModel extends Component {
33079
33235
  const metallic = (cfg.metallic !== undefined && cfg.metallic !== null) ? Math.floor(cfg.metallic * 255) : 0;
33080
33236
  const roughness = (cfg.roughness !== undefined && cfg.roughness !== null) ? Math.floor(cfg.roughness * 255) : 255;
33081
33237
 
33082
- const mesh = new VBOSceneModelMesh$1(this, id, color, opacity);
33238
+ const mesh = new DataTextureSceneModelMesh(this, id, color, opacity);
33083
33239
 
33084
33240
  const pickId = mesh.pickId;
33085
33241
 
@@ -33322,7 +33478,7 @@ class DataTextureSceneModel extends Component {
33322
33478
  }
33323
33479
  }
33324
33480
 
33325
- const node = new VBOSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
33481
+ const node = new DataTextureSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
33326
33482
  this._nodeList.push(node);
33327
33483
  this._nodes[id] = node;
33328
33484
  this.numEntities++;
@@ -33735,7 +33891,7 @@ class DataTextureSceneModel extends Component {
33735
33891
  }
33736
33892
 
33737
33893
  /**
33738
- * Called by VBOSceneModelMesh.drawPickDepths()
33894
+ * Called by DataTextureSceneModelMesh.drawPickDepths()
33739
33895
  * @private
33740
33896
  */
33741
33897
  drawPickDepths(frameCtx) {
@@ -33750,7 +33906,7 @@ class DataTextureSceneModel extends Component {
33750
33906
  }
33751
33907
 
33752
33908
  /**
33753
- * Called by VBOSceneModelMesh.drawPickNormals()
33909
+ * Called by DataTextureSceneModelMesh.drawPickNormals()
33754
33910
  * @private
33755
33911
  */
33756
33912
  drawPickNormals(frameCtx) {
@@ -33783,7 +33939,6 @@ class DataTextureSceneModel extends Component {
33783
33939
  if (this._isModel) {
33784
33940
  this.scene._deregisterModel(this);
33785
33941
  }
33786
- putScratchMemory$1();
33787
33942
  super.destroy();
33788
33943
  }
33789
33944
  }
@@ -62918,7 +63073,7 @@ class DistanceMeasurement extends Component {
62918
63073
  }
62919
63074
 
62920
63075
  /**
62921
- * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events.
63076
+ * Sets if the wires, dots ad labels will fire "mouseOver" "mouseLeave" and "contextMenu" events, or ignore mouse events altogether.
62922
63077
  *
62923
63078
  * @type {Boolean}
62924
63079
  */
@@ -97011,7 +97166,7 @@ ${cfg.uv && cfg.uv.length > 0 ? 1 : 0}-${cfg.uvCompressed && cfg.uvCompressed.le
97011
97166
  math.expandAABB3(aabb, meshes[i].aabb);
97012
97167
  }
97013
97168
  }
97014
- const node = new VBOSceneModelNode$1(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
97169
+ const node = new VBOSceneModelNode(this, cfg.isObject, id, meshes, flags, aabb); // Internally sets PerformanceModelMesh#parent to this PerformanceModelNode
97015
97170
  this._nodeList.push(node);
97016
97171
  this._nodes[id] = node;
97017
97172
  this.numEntities++;
@@ -131487,6 +131642,8 @@ class XKTLoaderPlugin extends Plugin {
131487
131642
  origin: params.origin,
131488
131643
  targetLodFps: params.useDataTextures.targetLodFps || false,
131489
131644
  enableViewFrustumCulling: params.useDataTextures.enableViewFrustumCulling || false,
131645
+ disableVertexWelding: params.useDataTextures.disableVertexWelding || false,
131646
+ disableIndexRebucketing: params.useDataTextures.disableIndexRebucketing || false,
131490
131647
  }));
131491
131648
  } else {
131492
131649
  sceneModel = new VBOSceneModel(this.viewer.scene, utils.apply(params, {