@xeokit/xeokit-sdk 2.4.2-beta-38 → 2.4.2-beta-39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (22) hide show
  1. package/dist/xeokit-sdk.cjs.js +145 -35
  2. package/dist/xeokit-sdk.es.js +145 -35
  3. package/dist/xeokit-sdk.es5.js +262 -249
  4. package/dist/xeokit-sdk.min.cjs.js +2 -2
  5. package/dist/xeokit-sdk.min.es.js +2 -2
  6. package/dist/xeokit-sdk.min.es5.js +3 -3
  7. package/package.json +1 -1
  8. package/src/viewer/scene/model/SceneModel.js +1 -1
  9. package/src/viewer/scene/model/SceneModelMesh.js +2 -0
  10. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureLayer.js +24 -9
  11. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +1 -1
  12. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +1 -1
  13. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingLayer.js +19 -3
  14. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingLayer.js +19 -1
  15. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingLayer.js +21 -6
  16. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingLayer.js +17 -2
  17. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +1 -1
  18. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +1 -1
  19. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +1 -1
  20. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +1 -1
  21. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingLayer.js +18 -8
  22. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +18 -2
@@ -56331,6 +56331,7 @@ class SceneModelMesh {
56331
56331
 
56332
56332
  _sceneModelDirty() {
56333
56333
  this._aabbWorldDirty = true;
56334
+ this.layer.aabbDirty = true;
56334
56335
  }
56335
56336
 
56336
56337
  _transformDirty() {
@@ -56340,6 +56341,7 @@ class SceneModelMesh {
56340
56341
  this._matrixUpdateScheduled = true;
56341
56342
  }
56342
56343
  this._aabbWorldDirty = true;
56344
+ this.layer.aabbDirty = true;
56343
56345
  if (this.entity) {
56344
56346
  this.entity._transformDirty();
56345
56347
  }
@@ -60663,7 +60665,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60663
60665
  const state = batchingLayer._state;
60664
60666
  const origin = batchingLayer._state.origin;
60665
60667
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
60666
- const aabb = model.aabb;
60668
+ const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
60667
60669
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60668
60670
 
60669
60671
  if (this._vaoCache.has(batchingLayer)) {
@@ -60972,7 +60974,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60972
60974
  const state = batchingLayer._state;
60973
60975
  const origin = batchingLayer._state.origin;
60974
60976
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
60975
- const aabb = model.aabb;
60977
+ const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
60976
60978
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60977
60979
 
60978
60980
  if (this._vaoCache.has(batchingLayer)) {
@@ -61419,9 +61421,12 @@ class TrianglesBatchingLayer {
61419
61421
 
61420
61422
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
61421
61423
  this._portions = [];
61422
-
61424
+ this._meshes = [];
61423
61425
  this._numVerts = 0;
61424
61426
 
61427
+ this._aabb = math.collapseAABB3();
61428
+ this.aabbDirty = true;
61429
+
61425
61430
  this._finalized = false;
61426
61431
 
61427
61432
  if (cfg.positionsDecodeMatrix) {
@@ -61452,6 +61457,16 @@ class TrianglesBatchingLayer {
61452
61457
  this.solid = !!cfg.solid;
61453
61458
  }
61454
61459
 
61460
+ get aabb() {
61461
+ if (this.aabbDirty) {
61462
+ math.collapseAABB3(this._aabb);
61463
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
61464
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
61465
+ }
61466
+ this.aabbDirty = false;
61467
+ }
61468
+ }
61469
+
61455
61470
  /**
61456
61471
  * Tests if there is room for another portion in this TrianglesBatchingLayer.
61457
61472
  *
@@ -61471,6 +61486,7 @@ class TrianglesBatchingLayer {
61471
61486
  *
61472
61487
  * Gives the portion the specified geometry, color and matrix.
61473
61488
  *
61489
+ * @param mesh The SceneModelMesh that owns the portion
61474
61490
  * @param cfg.positions Flat float Local-space positions array.
61475
61491
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix
61476
61492
  * @param [cfg.normals] Flat float normals array.
@@ -61489,7 +61505,7 @@ class TrianglesBatchingLayer {
61489
61505
  * @param cfg.pickColor Quantized pick color
61490
61506
  * @returns {number} Portion ID
61491
61507
  */
61492
- createPortion(cfg) {
61508
+ createPortion(mesh, cfg) {
61493
61509
 
61494
61510
  if (this._finalized) {
61495
61511
  throw "Already finalized";
@@ -61528,8 +61544,7 @@ class TrianglesBatchingLayer {
61528
61544
  for (let i = 0, len = positionsCompressed.length; i < len; i++) {
61529
61545
  buffer.positions.push(positionsCompressed[i]);
61530
61546
  }
61531
- }
61532
- else {
61547
+ } else {
61533
61548
  if (!positions) {
61534
61549
  throw "positions expected";
61535
61550
  }
@@ -61646,13 +61661,10 @@ class TrianglesBatchingLayer {
61646
61661
  }
61647
61662
 
61648
61663
  this._portions.push(portion);
61649
-
61650
61664
  this._numPortions++;
61651
-
61652
61665
  this.model.numPortions++;
61653
-
61654
61666
  this._numVerts += portion.numVerts;
61655
-
61667
+ this._meshes.push(mesh);
61656
61668
  return portionId;
61657
61669
  }
61658
61670
 
@@ -65670,7 +65682,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65670
65682
  const state = instancingLayer._state;
65671
65683
  const origin = instancingLayer._state.origin;
65672
65684
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
65673
- const aabb = model.aabb;
65685
+ const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
65674
65686
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
65675
65687
 
65676
65688
  if (this._vaoCache.has(instancingLayer)) {
@@ -66006,7 +66018,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66006
66018
  const state = instancingLayer._state;
66007
66019
  const origin = instancingLayer._state.origin;
66008
66020
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
66009
- const aabb = model.aabb;
66021
+ const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
66010
66022
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
66011
66023
 
66012
66024
  if (this._vaoCache.has(instancingLayer)) {
@@ -66487,6 +66499,10 @@ class TrianglesInstancingLayer {
66487
66499
  this._modelNormalMatrixCol2 = [];
66488
66500
 
66489
66501
  this._portions = [];
66502
+ this._meshes = [];
66503
+
66504
+ this._aabb = math.collapseAABB3();
66505
+ this.aabbDirty = true;
66490
66506
 
66491
66507
  if (cfg.origin) {
66492
66508
  this._state.origin.set(cfg.origin);
@@ -66507,6 +66523,17 @@ class TrianglesInstancingLayer {
66507
66523
  this.numIndices = cfg.geometry.numIndices;
66508
66524
  }
66509
66525
 
66526
+ get aabb() {
66527
+ if (this.aabbDirty) {
66528
+ math.collapseAABB3(this._aabb);
66529
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
66530
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
66531
+ }
66532
+ this.aabbDirty = false;
66533
+ }
66534
+ return this._aabb;
66535
+ }
66536
+
66510
66537
  /**
66511
66538
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
66512
66539
  *
@@ -66514,6 +66541,7 @@ class TrianglesInstancingLayer {
66514
66541
  *
66515
66542
  * Gives the portion the specified color and matrix.
66516
66543
  *
66544
+ * @param mesh The SceneModelMesh that owns the portion
66517
66545
  * @param cfg Portion params
66518
66546
  * @param cfg.color Color [0..255,0..255,0..255]
66519
66547
  * @param cfg.metallic Metalness factor [0..255]
@@ -66524,7 +66552,7 @@ class TrianglesInstancingLayer {
66524
66552
  * @param cfg.pickColor Quantized pick color
66525
66553
  * @returns {number} Portion ID.
66526
66554
  */
66527
- createPortion(cfg) {
66555
+ createPortion(mesh, cfg) {
66528
66556
 
66529
66557
  const color = cfg.color;
66530
66558
  const metallic = cfg.metallic;
@@ -66616,7 +66644,7 @@ class TrianglesInstancingLayer {
66616
66644
 
66617
66645
  this._numPortions++;
66618
66646
  this.model.numPortions++;
66619
-
66647
+ this._meshes.push(mesh);
66620
66648
  return portionId;
66621
66649
  }
66622
66650
 
@@ -67922,9 +67950,12 @@ class LinesBatchingLayer {
67922
67950
 
67923
67951
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
67924
67952
  this._portions = [];
67925
-
67953
+ this._meshes = [];
67926
67954
  this._numVerts = 0;
67927
67955
 
67956
+ this._aabb = math.collapseAABB3();
67957
+ this.aabbDirty = true;
67958
+
67928
67959
  this._finalized = false;
67929
67960
 
67930
67961
  if (cfg.positionsDecodeMatrix) {
@@ -67945,6 +67976,17 @@ class LinesBatchingLayer {
67945
67976
  this.aabb = math.collapseAABB3();
67946
67977
  }
67947
67978
 
67979
+ get aabb() {
67980
+ if (this.aabbDirty) {
67981
+ math.collapseAABB3(this._aabb);
67982
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
67983
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
67984
+ }
67985
+ this.aabbDirty = false;
67986
+ }
67987
+ return this._aabb;
67988
+ }
67989
+
67948
67990
  /**
67949
67991
  * Tests if there is room for another portion in this LinesBatchingLayer.
67950
67992
  *
@@ -67964,6 +68006,7 @@ class LinesBatchingLayer {
67964
68006
  *
67965
68007
  * Gives the portion the specified geometry, color and matrix.
67966
68008
  *
68009
+ * @param mesh The SceneModelMesh that owns the portion
67967
68010
  * @param cfg.positions Flat float Local-space positions array.
67968
68011
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix
67969
68012
  * @param cfg.indices Flat int indices array.
@@ -67974,7 +68017,7 @@ class LinesBatchingLayer {
67974
68017
  * @param cfg.pickColor Quantized pick color
67975
68018
  * @returns {number} Portion ID
67976
68019
  */
67977
- createPortion(cfg) {
68020
+ createPortion(mesh, cfg) {
67978
68021
 
67979
68022
  if (this._finalized) {
67980
68023
  throw "Already finalized";
@@ -68051,6 +68094,8 @@ class LinesBatchingLayer {
68051
68094
 
68052
68095
  this._numVerts += numVerts;
68053
68096
 
68097
+ this._meshes.push(mesh);
68098
+
68054
68099
  return portionId;
68055
68100
  }
68056
68101
 
@@ -68963,6 +69008,10 @@ class LinesInstancingLayer {
68963
69008
  this._modelMatrixCol2 = [];
68964
69009
 
68965
69010
  this._portions = [];
69011
+ this._meshes = [];
69012
+
69013
+ this._aabb = math.collapseAABB3();
69014
+ this.aabbDirty = true;
68966
69015
 
68967
69016
  if (cfg.origin) {
68968
69017
  this._state.origin = math.vec3(cfg.origin);
@@ -68971,6 +69020,17 @@ class LinesInstancingLayer {
68971
69020
  this._finalized = false;
68972
69021
  }
68973
69022
 
69023
+ get aabb() {
69024
+ if (this.aabbDirty) {
69025
+ math.collapseAABB3(this._aabb);
69026
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
69027
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
69028
+ }
69029
+ this.aabbDirty = false;
69030
+ }
69031
+ return this._aabb;
69032
+ }
69033
+
68974
69034
  /**
68975
69035
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
68976
69036
  *
@@ -68978,13 +69038,14 @@ class LinesInstancingLayer {
68978
69038
  *
68979
69039
  * Gives the portion the specified color and matrix.
68980
69040
  *
69041
+ * @param mesh The SceneModelMesh that owns the portion
68981
69042
  * @param cfg Portion params
68982
69043
  * @param cfg.color Color [0..255,0..255,0..255]
68983
69044
  * @param cfg.opacity Opacity [0..255].
68984
69045
  * @param cfg.meshMatrix Flat float 4x4 matrix.
68985
69046
  * @returns {number} Portion ID.
68986
69047
  */
68987
- createPortion(cfg) {
69048
+ createPortion(mesh, cfg) {
68988
69049
 
68989
69050
  const color = cfg.color;
68990
69051
  const opacity = cfg.opacity;
@@ -69033,6 +69094,8 @@ class LinesInstancingLayer {
69033
69094
  this._numPortions++;
69034
69095
  this.model.numPortions++;
69035
69096
 
69097
+ this._meshes.push(mesh);
69098
+
69036
69099
  return portionId;
69037
69100
  }
69038
69101
 
@@ -70450,6 +70513,10 @@ class PointsBatchingLayer {
70450
70513
 
70451
70514
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
70452
70515
  this._portions = [];
70516
+ this._meshes = [];
70517
+
70518
+ this._aabb = math.collapseAABB3();
70519
+ this.aabbDirty = true;
70453
70520
 
70454
70521
  this._finalized = false;
70455
70522
 
@@ -70471,6 +70538,17 @@ class PointsBatchingLayer {
70471
70538
  this.aabb = math.collapseAABB3();
70472
70539
  }
70473
70540
 
70541
+ get aabb() {
70542
+ if (this.aabbDirty) {
70543
+ math.collapseAABB3(this._aabb);
70544
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
70545
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
70546
+ }
70547
+ this.aabbDirty = false;
70548
+ }
70549
+ return this._aabb;
70550
+ }
70551
+
70474
70552
  /**
70475
70553
  * Tests if there is room for another portion in this PointsBatchingLayer.
70476
70554
  *
@@ -70489,6 +70567,7 @@ class PointsBatchingLayer {
70489
70567
  *
70490
70568
  * Gives the portion the specified geometry, color and matrix.
70491
70569
  *
70570
+ * @param mesh The SceneModelMesh that owns the portion
70492
70571
  * @param cfg.positions Flat float Local-space positions array.
70493
70572
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with PointsBatchingLayer positionsDecodeMatrix
70494
70573
  * @param [cfg.colorsCompressed] Quantized RGB colors [0..255,0..255,0..255,0..255]
@@ -70499,7 +70578,7 @@ class PointsBatchingLayer {
70499
70578
  * @param cfg.pickColor Quantized pick color
70500
70579
  * @returns {number} Portion ID
70501
70580
  */
70502
- createPortion(cfg) {
70581
+ createPortion(mesh, cfg) {
70503
70582
 
70504
70583
  if (this._finalized) {
70505
70584
  throw "Already finalized";
@@ -70510,7 +70589,7 @@ class PointsBatchingLayer {
70510
70589
  const color = cfg.color;
70511
70590
  const colorsCompressed = cfg.colorsCompressed;
70512
70591
  const colors = cfg.colors;
70513
- const pickColor = cfg.pickColor;
70592
+ const pickColor = cfg.pickColor;
70514
70593
 
70515
70594
  const buffer = this._buffer;
70516
70595
  const positionsIndex = buffer.positions.length;
@@ -70599,7 +70678,7 @@ class PointsBatchingLayer {
70599
70678
 
70600
70679
  this._numPortions++;
70601
70680
  this.model.numPortions++;
70602
-
70681
+ this._meshes.push(mesh);
70603
70682
  return portionId;
70604
70683
  }
70605
70684
 
@@ -70863,7 +70942,7 @@ class PointsBatchingLayer {
70863
70942
  let colorFlag;
70864
70943
  if (!visible || culled || xrayed
70865
70944
  || (highlighted && !this.model.scene.highlightMaterial.glowThrough)
70866
- || (selected && !this.model.scene.selectedMaterial.glowThrough) ) {
70945
+ || (selected && !this.model.scene.selectedMaterial.glowThrough)) {
70867
70946
  colorFlag = RENDER_PASSES.NOT_RENDERED;
70868
70947
  } else {
70869
70948
  if (transparent) {
@@ -70897,7 +70976,7 @@ class PointsBatchingLayer {
70897
70976
  // no edges
70898
70977
  vertFlag |= pickFlag << 12;
70899
70978
  vertFlag |= clippableFlag << 16;
70900
-
70979
+
70901
70980
  tempArray[i] = vertFlag;
70902
70981
  }
70903
70982
 
@@ -72357,10 +72436,24 @@ class PointsInstancingLayer {
72357
72436
  this._modelMatrixCol2 = [];
72358
72437
 
72359
72438
  this._portions = [];
72439
+ this._meshes = [];
72440
+ this._aabb = math.collapseAABB3();
72441
+ this.aabbDirty = true;
72360
72442
 
72361
72443
  this._finalized = false;
72362
72444
  }
72363
72445
 
72446
+ get aabb() {
72447
+ if (this.aabbDirty) {
72448
+ math.collapseAABB3(this._aabb);
72449
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
72450
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
72451
+ }
72452
+ this.aabbDirty = false;
72453
+ }
72454
+ return this._aabb;
72455
+ }
72456
+
72364
72457
  /**
72365
72458
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
72366
72459
  *
@@ -72368,13 +72461,14 @@ class PointsInstancingLayer {
72368
72461
  *
72369
72462
  * Gives the portion the specified color and matrix.
72370
72463
  *
72464
+ * @param mesh The SceneModelMesh that owns the portion
72371
72465
  * @param cfg Portion params
72372
72466
  * @param cfg.meshMatrix Flat float 4x4 matrix.
72373
72467
  * @param [cfg.worldMatrix] Flat float 4x4 matrix.
72374
72468
  * @param cfg.pickColor Quantized pick color
72375
72469
  * @returns {number} Portion ID.
72376
72470
  */
72377
- createPortion(cfg) {
72471
+ createPortion(mesh, cfg) {
72378
72472
 
72379
72473
  const meshMatrix = cfg.meshMatrix;
72380
72474
  const pickColor = cfg.pickColor;
@@ -72418,7 +72512,7 @@ class PointsInstancingLayer {
72418
72512
 
72419
72513
  this._numPortions++;
72420
72514
  this.model.numPortions++;
72421
-
72515
+ this._meshes.push(mesh);
72422
72516
  return portionId;
72423
72517
  }
72424
72518
 
@@ -77377,7 +77471,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77377
77471
  const textureState = state.textureState;
77378
77472
  const origin = dataTextureLayer._state.origin;
77379
77473
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
77380
- const aabb = model.aabb;
77474
+ const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
77381
77475
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
77382
77476
 
77383
77477
  const coordinateScaler = tempVec3a$e;
@@ -77795,7 +77889,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77795
77889
  const textureState = state.textureState;
77796
77890
  const origin = dataTextureLayer._state.origin;
77797
77891
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
77798
- const aabb = model.aabb;
77892
+ const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
77799
77893
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
77800
77894
 
77801
77895
  const coordinateScaler = tempVec3a$d;
@@ -81147,10 +81241,13 @@ class TrianglesDataTextureLayer {
81147
81241
 
81148
81242
  this._bucketGeometries = {};
81149
81243
 
81244
+ this._meshes = [];
81245
+
81150
81246
  /**
81151
81247
  * The axis-aligned World-space boundary of this TrianglesDataTextureLayer's positions.
81152
81248
  */
81153
- this.aabb = math.collapseAABB3();
81249
+ this._aabb = math.collapseAABB3();
81250
+ this.aabbDirty = true;
81154
81251
 
81155
81252
  /**
81156
81253
  * The number of updates in the current frame;
@@ -81160,6 +81257,17 @@ class TrianglesDataTextureLayer {
81160
81257
  this._finalized = false;
81161
81258
  }
81162
81259
 
81260
+ get aabb() {
81261
+ if (this.aabbDirty) {
81262
+ math.collapseAABB3(this._aabb);
81263
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
81264
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
81265
+ }
81266
+ this.aabbDirty = false;
81267
+ }
81268
+ return this._aabb;
81269
+ }
81270
+
81163
81271
  /**
81164
81272
  * Returns whether the ```TrianglesDataTextureLayer``` has room for more portions.
81165
81273
  *
@@ -81204,6 +81312,7 @@ class TrianglesDataTextureLayer {
81204
81312
  *
81205
81313
  * Gives the portion the specified geometry, color and matrix.
81206
81314
  *
81315
+ * @param mesh The SceneModelMesh that owns the portion
81207
81316
  * @param portionCfg.positionsCompressed Flat float Local-space positionsCompressed array.
81208
81317
  * @param [portionCfg.normals] Flat float normals array.
81209
81318
  * @param [portionCfg.colors] Flat float colors array.
@@ -81218,12 +81327,12 @@ class TrianglesDataTextureLayer {
81218
81327
  * @param portionCfg.pickColor Quantized pick color
81219
81328
  * @returns {number} Portion ID
81220
81329
  */
81221
- createPortion(portionCfg) {
81330
+ createPortion(mesh, portionCfg) {
81222
81331
  if (this._finalized) {
81223
81332
  throw "Already finalized";
81224
81333
  }
81225
81334
  const subPortionIds = [];
81226
- // const portionAABB = portionCfg.worldAABB;
81335
+ // const portionAABB = portionCfg.worldAABB;
81227
81336
  portionCfg.buckets.forEach((bucket, bucketIndex) => {
81228
81337
  const bucketGeometryId = portionCfg.geometryId !== undefined && portionCfg.geometryId !== null
81229
81338
  ? `${portionCfg.geometryId}#${bucketIndex}`
@@ -81233,7 +81342,7 @@ class TrianglesDataTextureLayer {
81233
81342
  bucketGeometry = this._createBucketGeometry(portionCfg, bucket);
81234
81343
  this._bucketGeometries[bucketGeometryId] = bucketGeometry;
81235
81344
  }
81236
- // const subPortionAABB = math.collapseAABB3(tempAABB3b);
81345
+ // const subPortionAABB = math.collapseAABB3(tempAABB3b);
81237
81346
  const subPortionId = this._createSubPortion(portionCfg, bucketGeometry, bucket);
81238
81347
  //math.expandAABB3(portionAABB, subPortionAABB);
81239
81348
  subPortionIds.push(subPortionId);
@@ -81251,6 +81360,7 @@ class TrianglesDataTextureLayer {
81251
81360
  const portionId = this._portionToSubPortionsMap.length;
81252
81361
  this._portionToSubPortionsMap.push(subPortionIds);
81253
81362
  this.model.numPortions++;
81363
+ this._meshes.push(mesh);
81254
81364
  return portionId;
81255
81365
  }
81256
81366
 
@@ -81355,7 +81465,7 @@ class TrianglesDataTextureLayer {
81355
81465
  numEdges,
81356
81466
  indicesBase,
81357
81467
  edgeIndicesBase,
81358
- // aabb,
81468
+ // aabb,
81359
81469
  obb: null // Lazy-created in _createSubPortion if needed
81360
81470
  };
81361
81471
 
@@ -81535,7 +81645,7 @@ class TrianglesDataTextureLayer {
81535
81645
  textureState.texturePerVertexIdCoordinates = this._dataTextureGenerator.generateTextureForPositions(
81536
81646
  gl,
81537
81647
  buffer.positionsCompressed,
81538
- buffer.lenPositionsCompressed );
81648
+ buffer.lenPositionsCompressed);
81539
81649
 
81540
81650
  textureState.texturePerPolygonIdPortionIds8Bits = this._dataTextureGenerator.generateTextureForPackedPortionIds(
81541
81651
  gl,
@@ -82116,7 +82226,7 @@ class TrianglesDataTextureLayer {
82116
82226
  const textureState = this._dataTextureState;
82117
82227
  const gl = this.model.scene.canvas.gl;
82118
82228
  tempMat4a.set(matrix);
82119
- textureState.texturePerObjectInstanceMatrices._textureData.set(tempMat4a, subPortionId*16);
82229
+ textureState.texturePerObjectInstanceMatrices._textureData.set(tempMat4a, subPortionId * 16);
82120
82230
  if (this._deferredSetFlagsActive) {
82121
82231
  this._deferredSetFlagsDirty = true;
82122
82232
  return;
@@ -82139,7 +82249,7 @@ class TrianglesDataTextureLayer {
82139
82249
  );
82140
82250
  // gl.bindTexture (gl.TEXTURE_2D, null);
82141
82251
  }
82142
-
82252
+
82143
82253
  // ---------------------- COLOR RENDERING -----------------------------------
82144
82254
 
82145
82255
  drawColorOpaque(renderFlags, frameCtx) {
@@ -85823,7 +85933,7 @@ class SceneModel extends Component {
85823
85933
  if (cfg.transform) {
85824
85934
  cfg.meshMatrix = cfg.transform.worldMatrix;
85825
85935
  }
85826
- mesh.portionId = mesh.layer.createPortion(cfg);
85936
+ mesh.portionId = mesh.layer.createPortion(mesh, cfg);
85827
85937
  this._meshes[cfg.id] = mesh;
85828
85938
  this._meshList.push(mesh);
85829
85939
  return mesh;