@xeokit/xeokit-sdk 2.4.2-beta-37 → 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
@@ -56327,6 +56327,7 @@ class SceneModelMesh {
56327
56327
 
56328
56328
  _sceneModelDirty() {
56329
56329
  this._aabbWorldDirty = true;
56330
+ this.layer.aabbDirty = true;
56330
56331
  }
56331
56332
 
56332
56333
  _transformDirty() {
@@ -56336,6 +56337,7 @@ class SceneModelMesh {
56336
56337
  this._matrixUpdateScheduled = true;
56337
56338
  }
56338
56339
  this._aabbWorldDirty = true;
56340
+ this.layer.aabbDirty = true;
56339
56341
  if (this.entity) {
56340
56342
  this.entity._transformDirty();
56341
56343
  }
@@ -60659,7 +60661,7 @@ class SnapBatchingDepthBufInitRenderer extends VBOSceneModelRenderer {
60659
60661
  const state = batchingLayer._state;
60660
60662
  const origin = batchingLayer._state.origin;
60661
60663
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
60662
- const aabb = model.aabb;
60664
+ const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
60663
60665
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60664
60666
 
60665
60667
  if (this._vaoCache.has(batchingLayer)) {
@@ -60968,7 +60970,7 @@ class SnapBatchingDepthRenderer extends VBOSceneModelRenderer{
60968
60970
  const state = batchingLayer._state;
60969
60971
  const origin = batchingLayer._state.origin;
60970
60972
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
60971
- const aabb = model.aabb;
60973
+ const aabb = batchingLayer.aabb; // Per-layer AABB for best RTC accuracy
60972
60974
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
60973
60975
 
60974
60976
  if (this._vaoCache.has(batchingLayer)) {
@@ -61415,9 +61417,12 @@ class TrianglesBatchingLayer {
61415
61417
 
61416
61418
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
61417
61419
  this._portions = [];
61418
-
61420
+ this._meshes = [];
61419
61421
  this._numVerts = 0;
61420
61422
 
61423
+ this._aabb = math.collapseAABB3();
61424
+ this.aabbDirty = true;
61425
+
61421
61426
  this._finalized = false;
61422
61427
 
61423
61428
  if (cfg.positionsDecodeMatrix) {
@@ -61448,6 +61453,16 @@ class TrianglesBatchingLayer {
61448
61453
  this.solid = !!cfg.solid;
61449
61454
  }
61450
61455
 
61456
+ get aabb() {
61457
+ if (this.aabbDirty) {
61458
+ math.collapseAABB3(this._aabb);
61459
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
61460
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
61461
+ }
61462
+ this.aabbDirty = false;
61463
+ }
61464
+ }
61465
+
61451
61466
  /**
61452
61467
  * Tests if there is room for another portion in this TrianglesBatchingLayer.
61453
61468
  *
@@ -61467,6 +61482,7 @@ class TrianglesBatchingLayer {
61467
61482
  *
61468
61483
  * Gives the portion the specified geometry, color and matrix.
61469
61484
  *
61485
+ * @param mesh The SceneModelMesh that owns the portion
61470
61486
  * @param cfg.positions Flat float Local-space positions array.
61471
61487
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix
61472
61488
  * @param [cfg.normals] Flat float normals array.
@@ -61485,7 +61501,7 @@ class TrianglesBatchingLayer {
61485
61501
  * @param cfg.pickColor Quantized pick color
61486
61502
  * @returns {number} Portion ID
61487
61503
  */
61488
- createPortion(cfg) {
61504
+ createPortion(mesh, cfg) {
61489
61505
 
61490
61506
  if (this._finalized) {
61491
61507
  throw "Already finalized";
@@ -61524,8 +61540,7 @@ class TrianglesBatchingLayer {
61524
61540
  for (let i = 0, len = positionsCompressed.length; i < len; i++) {
61525
61541
  buffer.positions.push(positionsCompressed[i]);
61526
61542
  }
61527
- }
61528
- else {
61543
+ } else {
61529
61544
  if (!positions) {
61530
61545
  throw "positions expected";
61531
61546
  }
@@ -61642,13 +61657,10 @@ class TrianglesBatchingLayer {
61642
61657
  }
61643
61658
 
61644
61659
  this._portions.push(portion);
61645
-
61646
61660
  this._numPortions++;
61647
-
61648
61661
  this.model.numPortions++;
61649
-
61650
61662
  this._numVerts += portion.numVerts;
61651
-
61663
+ this._meshes.push(mesh);
61652
61664
  return portionId;
61653
61665
  }
61654
61666
 
@@ -65666,7 +65678,7 @@ class SnapInstancingDepthBufInitRenderer extends VBOSceneModelRenderer {
65666
65678
  const state = instancingLayer._state;
65667
65679
  const origin = instancingLayer._state.origin;
65668
65680
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
65669
- const aabb = model.aabb;
65681
+ const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
65670
65682
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
65671
65683
 
65672
65684
  if (this._vaoCache.has(instancingLayer)) {
@@ -66002,7 +66014,7 @@ class SnapInstancingDepthRenderer extends VBOSceneModelRenderer {
66002
66014
  const state = instancingLayer._state;
66003
66015
  const origin = instancingLayer._state.origin;
66004
66016
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
66005
- const aabb = model.aabb;
66017
+ const aabb = instancingLayer.aabb; // Per-layer AABB for best RTC accuracy
66006
66018
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
66007
66019
 
66008
66020
  if (this._vaoCache.has(instancingLayer)) {
@@ -66483,6 +66495,10 @@ class TrianglesInstancingLayer {
66483
66495
  this._modelNormalMatrixCol2 = [];
66484
66496
 
66485
66497
  this._portions = [];
66498
+ this._meshes = [];
66499
+
66500
+ this._aabb = math.collapseAABB3();
66501
+ this.aabbDirty = true;
66486
66502
 
66487
66503
  if (cfg.origin) {
66488
66504
  this._state.origin.set(cfg.origin);
@@ -66503,6 +66519,17 @@ class TrianglesInstancingLayer {
66503
66519
  this.numIndices = cfg.geometry.numIndices;
66504
66520
  }
66505
66521
 
66522
+ get aabb() {
66523
+ if (this.aabbDirty) {
66524
+ math.collapseAABB3(this._aabb);
66525
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
66526
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
66527
+ }
66528
+ this.aabbDirty = false;
66529
+ }
66530
+ return this._aabb;
66531
+ }
66532
+
66506
66533
  /**
66507
66534
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
66508
66535
  *
@@ -66510,6 +66537,7 @@ class TrianglesInstancingLayer {
66510
66537
  *
66511
66538
  * Gives the portion the specified color and matrix.
66512
66539
  *
66540
+ * @param mesh The SceneModelMesh that owns the portion
66513
66541
  * @param cfg Portion params
66514
66542
  * @param cfg.color Color [0..255,0..255,0..255]
66515
66543
  * @param cfg.metallic Metalness factor [0..255]
@@ -66520,7 +66548,7 @@ class TrianglesInstancingLayer {
66520
66548
  * @param cfg.pickColor Quantized pick color
66521
66549
  * @returns {number} Portion ID.
66522
66550
  */
66523
- createPortion(cfg) {
66551
+ createPortion(mesh, cfg) {
66524
66552
 
66525
66553
  const color = cfg.color;
66526
66554
  const metallic = cfg.metallic;
@@ -66612,7 +66640,7 @@ class TrianglesInstancingLayer {
66612
66640
 
66613
66641
  this._numPortions++;
66614
66642
  this.model.numPortions++;
66615
-
66643
+ this._meshes.push(mesh);
66616
66644
  return portionId;
66617
66645
  }
66618
66646
 
@@ -67918,9 +67946,12 @@ class LinesBatchingLayer {
67918
67946
 
67919
67947
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
67920
67948
  this._portions = [];
67921
-
67949
+ this._meshes = [];
67922
67950
  this._numVerts = 0;
67923
67951
 
67952
+ this._aabb = math.collapseAABB3();
67953
+ this.aabbDirty = true;
67954
+
67924
67955
  this._finalized = false;
67925
67956
 
67926
67957
  if (cfg.positionsDecodeMatrix) {
@@ -67941,6 +67972,17 @@ class LinesBatchingLayer {
67941
67972
  this.aabb = math.collapseAABB3();
67942
67973
  }
67943
67974
 
67975
+ get aabb() {
67976
+ if (this.aabbDirty) {
67977
+ math.collapseAABB3(this._aabb);
67978
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
67979
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
67980
+ }
67981
+ this.aabbDirty = false;
67982
+ }
67983
+ return this._aabb;
67984
+ }
67985
+
67944
67986
  /**
67945
67987
  * Tests if there is room for another portion in this LinesBatchingLayer.
67946
67988
  *
@@ -67960,6 +68002,7 @@ class LinesBatchingLayer {
67960
68002
  *
67961
68003
  * Gives the portion the specified geometry, color and matrix.
67962
68004
  *
68005
+ * @param mesh The SceneModelMesh that owns the portion
67963
68006
  * @param cfg.positions Flat float Local-space positions array.
67964
68007
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with TrianglesBatchingLayer positionsDecodeMatrix
67965
68008
  * @param cfg.indices Flat int indices array.
@@ -67970,7 +68013,7 @@ class LinesBatchingLayer {
67970
68013
  * @param cfg.pickColor Quantized pick color
67971
68014
  * @returns {number} Portion ID
67972
68015
  */
67973
- createPortion(cfg) {
68016
+ createPortion(mesh, cfg) {
67974
68017
 
67975
68018
  if (this._finalized) {
67976
68019
  throw "Already finalized";
@@ -68047,6 +68090,8 @@ class LinesBatchingLayer {
68047
68090
 
68048
68091
  this._numVerts += numVerts;
68049
68092
 
68093
+ this._meshes.push(mesh);
68094
+
68050
68095
  return portionId;
68051
68096
  }
68052
68097
 
@@ -68959,6 +69004,10 @@ class LinesInstancingLayer {
68959
69004
  this._modelMatrixCol2 = [];
68960
69005
 
68961
69006
  this._portions = [];
69007
+ this._meshes = [];
69008
+
69009
+ this._aabb = math.collapseAABB3();
69010
+ this.aabbDirty = true;
68962
69011
 
68963
69012
  if (cfg.origin) {
68964
69013
  this._state.origin = math.vec3(cfg.origin);
@@ -68967,6 +69016,17 @@ class LinesInstancingLayer {
68967
69016
  this._finalized = false;
68968
69017
  }
68969
69018
 
69019
+ get aabb() {
69020
+ if (this.aabbDirty) {
69021
+ math.collapseAABB3(this._aabb);
69022
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
69023
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
69024
+ }
69025
+ this.aabbDirty = false;
69026
+ }
69027
+ return this._aabb;
69028
+ }
69029
+
68970
69030
  /**
68971
69031
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
68972
69032
  *
@@ -68974,13 +69034,14 @@ class LinesInstancingLayer {
68974
69034
  *
68975
69035
  * Gives the portion the specified color and matrix.
68976
69036
  *
69037
+ * @param mesh The SceneModelMesh that owns the portion
68977
69038
  * @param cfg Portion params
68978
69039
  * @param cfg.color Color [0..255,0..255,0..255]
68979
69040
  * @param cfg.opacity Opacity [0..255].
68980
69041
  * @param cfg.meshMatrix Flat float 4x4 matrix.
68981
69042
  * @returns {number} Portion ID.
68982
69043
  */
68983
- createPortion(cfg) {
69044
+ createPortion(mesh, cfg) {
68984
69045
 
68985
69046
  const color = cfg.color;
68986
69047
  const opacity = cfg.opacity;
@@ -69029,6 +69090,8 @@ class LinesInstancingLayer {
69029
69090
  this._numPortions++;
69030
69091
  this.model.numPortions++;
69031
69092
 
69093
+ this._meshes.push(mesh);
69094
+
69032
69095
  return portionId;
69033
69096
  }
69034
69097
 
@@ -70446,6 +70509,10 @@ class PointsBatchingLayer {
70446
70509
 
70447
70510
  this._modelAABB = math.collapseAABB3(); // Model-space AABB
70448
70511
  this._portions = [];
70512
+ this._meshes = [];
70513
+
70514
+ this._aabb = math.collapseAABB3();
70515
+ this.aabbDirty = true;
70449
70516
 
70450
70517
  this._finalized = false;
70451
70518
 
@@ -70467,6 +70534,17 @@ class PointsBatchingLayer {
70467
70534
  this.aabb = math.collapseAABB3();
70468
70535
  }
70469
70536
 
70537
+ get aabb() {
70538
+ if (this.aabbDirty) {
70539
+ math.collapseAABB3(this._aabb);
70540
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
70541
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
70542
+ }
70543
+ this.aabbDirty = false;
70544
+ }
70545
+ return this._aabb;
70546
+ }
70547
+
70470
70548
  /**
70471
70549
  * Tests if there is room for another portion in this PointsBatchingLayer.
70472
70550
  *
@@ -70485,6 +70563,7 @@ class PointsBatchingLayer {
70485
70563
  *
70486
70564
  * Gives the portion the specified geometry, color and matrix.
70487
70565
  *
70566
+ * @param mesh The SceneModelMesh that owns the portion
70488
70567
  * @param cfg.positions Flat float Local-space positions array.
70489
70568
  * @param cfg.positionsCompressed Flat quantized positions array - decompressed with PointsBatchingLayer positionsDecodeMatrix
70490
70569
  * @param [cfg.colorsCompressed] Quantized RGB colors [0..255,0..255,0..255,0..255]
@@ -70495,7 +70574,7 @@ class PointsBatchingLayer {
70495
70574
  * @param cfg.pickColor Quantized pick color
70496
70575
  * @returns {number} Portion ID
70497
70576
  */
70498
- createPortion(cfg) {
70577
+ createPortion(mesh, cfg) {
70499
70578
 
70500
70579
  if (this._finalized) {
70501
70580
  throw "Already finalized";
@@ -70506,7 +70585,7 @@ class PointsBatchingLayer {
70506
70585
  const color = cfg.color;
70507
70586
  const colorsCompressed = cfg.colorsCompressed;
70508
70587
  const colors = cfg.colors;
70509
- const pickColor = cfg.pickColor;
70588
+ const pickColor = cfg.pickColor;
70510
70589
 
70511
70590
  const buffer = this._buffer;
70512
70591
  const positionsIndex = buffer.positions.length;
@@ -70595,7 +70674,7 @@ class PointsBatchingLayer {
70595
70674
 
70596
70675
  this._numPortions++;
70597
70676
  this.model.numPortions++;
70598
-
70677
+ this._meshes.push(mesh);
70599
70678
  return portionId;
70600
70679
  }
70601
70680
 
@@ -70859,7 +70938,7 @@ class PointsBatchingLayer {
70859
70938
  let colorFlag;
70860
70939
  if (!visible || culled || xrayed
70861
70940
  || (highlighted && !this.model.scene.highlightMaterial.glowThrough)
70862
- || (selected && !this.model.scene.selectedMaterial.glowThrough) ) {
70941
+ || (selected && !this.model.scene.selectedMaterial.glowThrough)) {
70863
70942
  colorFlag = RENDER_PASSES.NOT_RENDERED;
70864
70943
  } else {
70865
70944
  if (transparent) {
@@ -70893,7 +70972,7 @@ class PointsBatchingLayer {
70893
70972
  // no edges
70894
70973
  vertFlag |= pickFlag << 12;
70895
70974
  vertFlag |= clippableFlag << 16;
70896
-
70975
+
70897
70976
  tempArray[i] = vertFlag;
70898
70977
  }
70899
70978
 
@@ -72353,10 +72432,24 @@ class PointsInstancingLayer {
72353
72432
  this._modelMatrixCol2 = [];
72354
72433
 
72355
72434
  this._portions = [];
72435
+ this._meshes = [];
72436
+ this._aabb = math.collapseAABB3();
72437
+ this.aabbDirty = true;
72356
72438
 
72357
72439
  this._finalized = false;
72358
72440
  }
72359
72441
 
72442
+ get aabb() {
72443
+ if (this.aabbDirty) {
72444
+ math.collapseAABB3(this._aabb);
72445
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
72446
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
72447
+ }
72448
+ this.aabbDirty = false;
72449
+ }
72450
+ return this._aabb;
72451
+ }
72452
+
72360
72453
  /**
72361
72454
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
72362
72455
  *
@@ -72364,13 +72457,14 @@ class PointsInstancingLayer {
72364
72457
  *
72365
72458
  * Gives the portion the specified color and matrix.
72366
72459
  *
72460
+ * @param mesh The SceneModelMesh that owns the portion
72367
72461
  * @param cfg Portion params
72368
72462
  * @param cfg.meshMatrix Flat float 4x4 matrix.
72369
72463
  * @param [cfg.worldMatrix] Flat float 4x4 matrix.
72370
72464
  * @param cfg.pickColor Quantized pick color
72371
72465
  * @returns {number} Portion ID.
72372
72466
  */
72373
- createPortion(cfg) {
72467
+ createPortion(mesh, cfg) {
72374
72468
 
72375
72469
  const meshMatrix = cfg.meshMatrix;
72376
72470
  const pickColor = cfg.pickColor;
@@ -72414,7 +72508,7 @@ class PointsInstancingLayer {
72414
72508
 
72415
72509
  this._numPortions++;
72416
72510
  this.model.numPortions++;
72417
-
72511
+ this._meshes.push(mesh);
72418
72512
  return portionId;
72419
72513
  }
72420
72514
 
@@ -77373,7 +77467,7 @@ class TrianglesDataTextureSnapDepthRenderer {
77373
77467
  const textureState = state.textureState;
77374
77468
  const origin = dataTextureLayer._state.origin;
77375
77469
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
77376
- const aabb = dataTextureLayer.aabb;
77470
+ const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
77377
77471
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
77378
77472
 
77379
77473
  const coordinateScaler = tempVec3a$e;
@@ -77791,7 +77885,7 @@ class TrianglesDataTextureSnapDepthBufInitRenderer {
77791
77885
  const textureState = state.textureState;
77792
77886
  const origin = dataTextureLayer._state.origin;
77793
77887
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
77794
- const aabb = dataTextureLayer.aabb;
77888
+ const aabb = dataTextureLayer.aabb; // Per-layer AABB for best RTC accuracy
77795
77889
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
77796
77890
 
77797
77891
  const coordinateScaler = tempVec3a$d;
@@ -81143,10 +81237,13 @@ class TrianglesDataTextureLayer {
81143
81237
 
81144
81238
  this._bucketGeometries = {};
81145
81239
 
81240
+ this._meshes = [];
81241
+
81146
81242
  /**
81147
81243
  * The axis-aligned World-space boundary of this TrianglesDataTextureLayer's positions.
81148
81244
  */
81149
- this.aabb = math.collapseAABB3();
81245
+ this._aabb = math.collapseAABB3();
81246
+ this.aabbDirty = true;
81150
81247
 
81151
81248
  /**
81152
81249
  * The number of updates in the current frame;
@@ -81156,6 +81253,17 @@ class TrianglesDataTextureLayer {
81156
81253
  this._finalized = false;
81157
81254
  }
81158
81255
 
81256
+ get aabb() {
81257
+ if (this.aabbDirty) {
81258
+ math.collapseAABB3(this._aabb);
81259
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
81260
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
81261
+ }
81262
+ this.aabbDirty = false;
81263
+ }
81264
+ return this._aabb;
81265
+ }
81266
+
81159
81267
  /**
81160
81268
  * Returns whether the ```TrianglesDataTextureLayer``` has room for more portions.
81161
81269
  *
@@ -81200,6 +81308,7 @@ class TrianglesDataTextureLayer {
81200
81308
  *
81201
81309
  * Gives the portion the specified geometry, color and matrix.
81202
81310
  *
81311
+ * @param mesh The SceneModelMesh that owns the portion
81203
81312
  * @param portionCfg.positionsCompressed Flat float Local-space positionsCompressed array.
81204
81313
  * @param [portionCfg.normals] Flat float normals array.
81205
81314
  * @param [portionCfg.colors] Flat float colors array.
@@ -81214,12 +81323,12 @@ class TrianglesDataTextureLayer {
81214
81323
  * @param portionCfg.pickColor Quantized pick color
81215
81324
  * @returns {number} Portion ID
81216
81325
  */
81217
- createPortion(portionCfg) {
81326
+ createPortion(mesh, portionCfg) {
81218
81327
  if (this._finalized) {
81219
81328
  throw "Already finalized";
81220
81329
  }
81221
81330
  const subPortionIds = [];
81222
- // const portionAABB = portionCfg.worldAABB;
81331
+ // const portionAABB = portionCfg.worldAABB;
81223
81332
  portionCfg.buckets.forEach((bucket, bucketIndex) => {
81224
81333
  const bucketGeometryId = portionCfg.geometryId !== undefined && portionCfg.geometryId !== null
81225
81334
  ? `${portionCfg.geometryId}#${bucketIndex}`
@@ -81229,7 +81338,7 @@ class TrianglesDataTextureLayer {
81229
81338
  bucketGeometry = this._createBucketGeometry(portionCfg, bucket);
81230
81339
  this._bucketGeometries[bucketGeometryId] = bucketGeometry;
81231
81340
  }
81232
- // const subPortionAABB = math.collapseAABB3(tempAABB3b);
81341
+ // const subPortionAABB = math.collapseAABB3(tempAABB3b);
81233
81342
  const subPortionId = this._createSubPortion(portionCfg, bucketGeometry, bucket);
81234
81343
  //math.expandAABB3(portionAABB, subPortionAABB);
81235
81344
  subPortionIds.push(subPortionId);
@@ -81247,6 +81356,7 @@ class TrianglesDataTextureLayer {
81247
81356
  const portionId = this._portionToSubPortionsMap.length;
81248
81357
  this._portionToSubPortionsMap.push(subPortionIds);
81249
81358
  this.model.numPortions++;
81359
+ this._meshes.push(mesh);
81250
81360
  return portionId;
81251
81361
  }
81252
81362
 
@@ -81351,7 +81461,7 @@ class TrianglesDataTextureLayer {
81351
81461
  numEdges,
81352
81462
  indicesBase,
81353
81463
  edgeIndicesBase,
81354
- // aabb,
81464
+ // aabb,
81355
81465
  obb: null // Lazy-created in _createSubPortion if needed
81356
81466
  };
81357
81467
 
@@ -81531,7 +81641,7 @@ class TrianglesDataTextureLayer {
81531
81641
  textureState.texturePerVertexIdCoordinates = this._dataTextureGenerator.generateTextureForPositions(
81532
81642
  gl,
81533
81643
  buffer.positionsCompressed,
81534
- buffer.lenPositionsCompressed );
81644
+ buffer.lenPositionsCompressed);
81535
81645
 
81536
81646
  textureState.texturePerPolygonIdPortionIds8Bits = this._dataTextureGenerator.generateTextureForPackedPortionIds(
81537
81647
  gl,
@@ -82112,7 +82222,7 @@ class TrianglesDataTextureLayer {
82112
82222
  const textureState = this._dataTextureState;
82113
82223
  const gl = this.model.scene.canvas.gl;
82114
82224
  tempMat4a.set(matrix);
82115
- textureState.texturePerObjectInstanceMatrices._textureData.set(tempMat4a, subPortionId*16);
82225
+ textureState.texturePerObjectInstanceMatrices._textureData.set(tempMat4a, subPortionId * 16);
82116
82226
  if (this._deferredSetFlagsActive) {
82117
82227
  this._deferredSetFlagsDirty = true;
82118
82228
  return;
@@ -82135,7 +82245,7 @@ class TrianglesDataTextureLayer {
82135
82245
  );
82136
82246
  // gl.bindTexture (gl.TEXTURE_2D, null);
82137
82247
  }
82138
-
82248
+
82139
82249
  // ---------------------- COLOR RENDERING -----------------------------------
82140
82250
 
82141
82251
  drawColorOpaque(renderFlags, frameCtx) {
@@ -85819,7 +85929,7 @@ class SceneModel extends Component {
85819
85929
  if (cfg.transform) {
85820
85930
  cfg.meshMatrix = cfg.transform.worldMatrix;
85821
85931
  }
85822
- mesh.portionId = mesh.layer.createPortion(cfg);
85932
+ mesh.portionId = mesh.layer.createPortion(mesh, cfg);
85823
85933
  this._meshes[cfg.id] = mesh;
85824
85934
  this._meshList.push(mesh);
85825
85935
  return mesh;