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

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 (24) hide show
  1. package/dist/xeokit-sdk.cjs.js +162 -40
  2. package/dist/xeokit-sdk.es.js +162 -40
  3. package/dist/xeokit-sdk.es5.js +264 -251
  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 +2 -2
  7. package/package.json +1 -1
  8. package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +10 -5
  9. package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +7 -0
  10. package/src/viewer/scene/model/SceneModel.js +1 -1
  11. package/src/viewer/scene/model/SceneModelMesh.js +2 -0
  12. package/src/viewer/scene/model/dtx/triangles/TrianglesDataTextureLayer.js +24 -9
  13. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthBufInitRenderer.js +1 -1
  14. package/src/viewer/scene/model/dtx/triangles/renderers/TrianglesDataTextureSnapDepthRenderer.js +1 -1
  15. package/src/viewer/scene/model/vbo/linesBatching/LinesBatchingLayer.js +19 -3
  16. package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingLayer.js +19 -1
  17. package/src/viewer/scene/model/vbo/pointsBatching/PointsBatchingLayer.js +21 -6
  18. package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingLayer.js +17 -2
  19. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthBufInitRenderer.js +1 -1
  20. package/src/viewer/scene/model/vbo/snapBatching/SnapBatchingDepthRenderer.js +1 -1
  21. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthBufInitRenderer.js +1 -1
  22. package/src/viewer/scene/model/vbo/snapInstancing/SnapInstancingDepthRenderer.js +1 -1
  23. package/src/viewer/scene/model/vbo/trianglesBatching/TrianglesBatchingLayer.js +18 -8
  24. package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +18 -2
@@ -121,6 +121,10 @@ class TrianglesInstancingLayer {
121
121
  this._modelNormalMatrixCol2 = [];
122
122
 
123
123
  this._portions = [];
124
+ this._meshes = [];
125
+
126
+ this._aabb = math.collapseAABB3();
127
+ this.aabbDirty = true;
124
128
 
125
129
  if (cfg.origin) {
126
130
  this._state.origin.set(cfg.origin);
@@ -141,6 +145,17 @@ class TrianglesInstancingLayer {
141
145
  this.numIndices = cfg.geometry.numIndices;
142
146
  }
143
147
 
148
+ get aabb() {
149
+ if (this.aabbDirty) {
150
+ math.collapseAABB3(this._aabb);
151
+ for (let i = 0, len = this._meshes.length; i < len; i++) {
152
+ math.expandAABB3(this._aabb, this._meshes[i].aabb);
153
+ }
154
+ this.aabbDirty = false;
155
+ }
156
+ return this._aabb;
157
+ }
158
+
144
159
  /**
145
160
  * Creates a new portion within this InstancingLayer, returns the new portion ID.
146
161
  *
@@ -148,6 +163,7 @@ class TrianglesInstancingLayer {
148
163
  *
149
164
  * Gives the portion the specified color and matrix.
150
165
  *
166
+ * @param mesh The SceneModelMesh that owns the portion
151
167
  * @param cfg Portion params
152
168
  * @param cfg.color Color [0..255,0..255,0..255]
153
169
  * @param cfg.metallic Metalness factor [0..255]
@@ -158,7 +174,7 @@ class TrianglesInstancingLayer {
158
174
  * @param cfg.pickColor Quantized pick color
159
175
  * @returns {number} Portion ID.
160
176
  */
161
- createPortion(cfg) {
177
+ createPortion(mesh, cfg) {
162
178
 
163
179
  const color = cfg.color;
164
180
  const metallic = cfg.metallic;
@@ -250,7 +266,7 @@ class TrianglesInstancingLayer {
250
266
 
251
267
  this._numPortions++;
252
268
  this.model.numPortions++;
253
-
269
+ this._meshes.push(mesh);
254
270
  return portionId;
255
271
  }
256
272