@xeokit/xeokit-sdk 2.6.35 → 2.6.37

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.
@@ -10687,8 +10687,8 @@ class SceneModelEntity {
10687
10687
  }
10688
10688
  }
10689
10689
 
10690
- const tempVec4a$a = math.vec4();
10691
- const tempVec4b$6 = math.vec4();
10690
+ const tempVec4a$b = math.vec4();
10691
+ const tempVec4b$7 = math.vec4();
10692
10692
 
10693
10693
 
10694
10694
  /**
@@ -10847,12 +10847,12 @@ class Marker extends Component {
10847
10847
  this.fire("viewPos", this._viewPos);
10848
10848
  }
10849
10849
  if (this._canvasPosDirty) {
10850
- tempVec4a$a.set(this._viewPos);
10851
- tempVec4a$a[3] = 1.0;
10852
- math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$a, tempVec4b$6);
10850
+ tempVec4a$b.set(this._viewPos);
10851
+ tempVec4a$b[3] = 1.0;
10852
+ math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$b, tempVec4b$7);
10853
10853
  const aabb = this.scene.canvas.boundary;
10854
- this._canvasPos[0] = Math.floor((1 + tempVec4b$6[0] / tempVec4b$6[3]) * aabb[2] / 2);
10855
- this._canvasPos[1] = Math.floor((1 - tempVec4b$6[1] / tempVec4b$6[3]) * aabb[3] / 2);
10854
+ this._canvasPos[0] = Math.floor((1 + tempVec4b$7[0] / tempVec4b$7[3]) * aabb[2] / 2);
10855
+ this._canvasPos[1] = Math.floor((1 - tempVec4b$7[1] / tempVec4b$7[3]) * aabb[3] / 2);
10856
10856
  this._canvasPosDirty = false;
10857
10857
  this.fire("canvasPos", this._canvasPos);
10858
10858
  }
@@ -11183,7 +11183,7 @@ function activateDraggableDot(dot, cfg) {
11183
11183
 
11184
11184
  const onChange = event => {
11185
11185
  const canvasPos = math.vec2([ event.clientX, event.clientY ]);
11186
- transformToNode(canvas.ownerDocument.body, canvas, canvasPos);
11186
+ transformToNode(canvas.ownerDocument.documentElement, canvas, canvasPos);
11187
11187
  onMove(canvasPos, pickWorldPos(canvasPos));
11188
11188
  };
11189
11189
 
@@ -23520,8 +23520,8 @@ const tempVec3c$u = math.vec3();
23520
23520
  const tempVec3d$d = math.vec3();
23521
23521
  const tempVec3e$2 = math.vec3();
23522
23522
  const tempVec3f$2 = math.vec3();
23523
- const tempVec4a$9 = math.vec4();
23524
- const tempVec4b$5 = math.vec4();
23523
+ const tempVec4a$a = math.vec4();
23524
+ const tempVec4b$6 = math.vec4();
23525
23525
  const tempVec4c$2 = math.vec4();
23526
23526
  const tempMat = math.mat4();
23527
23527
  const tempMatb = math.mat4();
@@ -24386,8 +24386,8 @@ class Camera extends Component {
24386
24386
  * @returns {[number, number]} the canvas position
24387
24387
  */
24388
24388
  projectWorldPos(worldPos) {
24389
- const _worldPos = tempVec4a$9;
24390
- const viewPos = tempVec4b$5;
24389
+ const _worldPos = tempVec4a$a;
24390
+ const viewPos = tempVec4b$6;
24391
24391
  const screenPos = tempVec4c$2;
24392
24392
  _worldPos[0] = worldPos[0];
24393
24393
  _worldPos[1] = worldPos[1];
@@ -53650,17 +53650,6 @@ class TrianglesDepthRenderer$1 extends TrianglesBatchingRenderer {
53650
53650
  src.push("uniform vec3 sectionPlaneDir" + i + ";");
53651
53651
  }
53652
53652
  }
53653
- src.push("const float packUpScale = 256. / 255.;");
53654
- src.push("const float unpackDownscale = 255. / 256.;");
53655
- src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");
53656
- src.push("const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );");
53657
- src.push("const float shiftRight8 = 1.0 / 256.;");
53658
-
53659
- src.push("vec4 packDepthToRGBA( const in float v ) {");
53660
- src.push(" vec4 r = vec4( fract( v * packFactors ), v );");
53661
- src.push(" r.yzw -= r.xyz * shiftRight8;");
53662
- src.push(" return r * packUpScale;");
53663
- src.push("}");
53664
53653
  src.push("in vec2 vHighPrecisionZW;");
53665
53654
  src.push("out vec4 outColor;");
53666
53655
  src.push("void main(void) {");
@@ -56194,7 +56183,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
56194
56183
 
56195
56184
  const tempMat4$1 = math.mat4();
56196
56185
  const tempMat4b = math.mat4();
56197
- const tempVec4a$8 = math.vec4([0, 0, 0, 1]);
56186
+ const tempVec4a$9 = math.vec4([0, 0, 0, 1]);
56198
56187
 
56199
56188
  const tempVec3a$z = math.vec3();
56200
56189
  const tempVec3b$v = math.vec3();
@@ -57003,7 +56992,7 @@ class VBOBatchingTrianglesLayer {
57003
56992
  const offsetX = origin[0] ;
57004
56993
  const offsetY = origin[1] ;
57005
56994
  const offsetZ = origin[2] ;
57006
- const worldPos = tempVec4a$8;
56995
+ const worldPos = tempVec4a$9;
57007
56996
  const sceneModelMatrix = this.model.matrix;
57008
56997
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
57009
56998
  for (let i = 0, len = positions.length; i < len; i += 3) {
@@ -61366,7 +61355,7 @@ function getRenderers$6(scene) {
61366
61355
 
61367
61356
  const tempUint8Vec4$2 = new Uint8Array(4);
61368
61357
  const tempFloat32$2 = new Float32Array(1);
61369
- const tempVec4a$7 = math.vec4([0, 0, 0, 1]);
61358
+ const tempVec4a$8 = math.vec4([0, 0, 0, 1]);
61370
61359
  const tempVec3fa$2 = new Float32Array(3);
61371
61360
 
61372
61361
  const tempVec3a$w = math.vec3();
@@ -62070,7 +62059,7 @@ class VBOInstancingTrianglesLayer {
62070
62059
  const offsetX = origin[0];
62071
62060
  const offsetY = origin[1];
62072
62061
  const offsetZ = origin[2];
62073
- const worldPos = tempVec4a$7;
62062
+ const worldPos = tempVec4a$8;
62074
62063
  const portionMatrix = portion.matrix;
62075
62064
  const sceneModelMatrix = this.model.matrix;
62076
62065
  const positionsDecodeMatrix = state.positionsDecodeMatrix;
@@ -72776,7 +72765,7 @@ const tempVec3b$i = math.vec3();
72776
72765
  const tempVec3c$e = math.vec3();
72777
72766
  math.vec3();
72778
72767
 
72779
- const tempVec4a$6 = math.vec4();
72768
+ const tempVec4a$7 = math.vec4();
72780
72769
 
72781
72770
  const tempMat4a$c = math.mat4();
72782
72771
 
@@ -73055,11 +73044,11 @@ class DTXTrianglesColorRenderer {
73055
73044
  if (saoEnabled) {
73056
73045
  const viewportWidth = gl.drawingBufferWidth;
73057
73046
  const viewportHeight = gl.drawingBufferHeight;
73058
- tempVec4a$6[0] = viewportWidth;
73059
- tempVec4a$6[1] = viewportHeight;
73060
- tempVec4a$6[2] = sao.blendCutoff;
73061
- tempVec4a$6[3] = sao.blendFactor;
73062
- gl.uniform4fv(this._uSAOParams, tempVec4a$6);
73047
+ tempVec4a$7[0] = viewportWidth;
73048
+ tempVec4a$7[1] = viewportHeight;
73049
+ tempVec4a$7[2] = sao.blendCutoff;
73050
+ tempVec4a$7[3] = sao.blendFactor;
73051
+ gl.uniform4fv(this._uSAOParams, tempVec4a$7);
73063
73052
  this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 10);
73064
73053
  }
73065
73054
  }
@@ -74718,6 +74707,12 @@ class DTXTrianglesPickMeshRenderer {
74718
74707
  const textureState = state.textureState;
74719
74708
  const origin = dataTextureLayer._state.origin;
74720
74709
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
74710
+
74711
+ const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
74712
+ const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
74713
+ const eye = frameCtx.pickOrigin || camera.eye;
74714
+ const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
74715
+
74721
74716
  textureState.bindCommonTextures(
74722
74717
  this._program,
74723
74718
  this.uTexturePerObjectPositionsDecodeMatrix,
@@ -74744,24 +74739,24 @@ class DTXTrianglesPickMeshRenderer {
74744
74739
  rtcOrigin[0] += position[0];
74745
74740
  rtcOrigin[1] += position[1];
74746
74741
  rtcOrigin[2] += position[2];
74747
- rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a$8);
74742
+ rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$8);
74748
74743
  rtcCameraEye = tempVec3c$c;
74749
- rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
74750
- rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
74751
- rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
74744
+ rtcCameraEye[0] = eye[0] - rtcOrigin[0];
74745
+ rtcCameraEye[1] = eye[1] - rtcOrigin[1];
74746
+ rtcCameraEye[2] = eye[2] - rtcOrigin[2];
74752
74747
  } else {
74753
- rtcViewMatrix = camera.viewMatrix;
74754
- rtcCameraEye = camera.eye;
74748
+ rtcViewMatrix = viewMatrix;
74749
+ rtcCameraEye = eye;
74755
74750
  }
74756
74751
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
74757
74752
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
74758
74753
  gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
74759
74754
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
74760
- gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
74755
+ gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
74761
74756
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
74762
74757
  gl.uniform1i(this._uRenderPass, renderPass);
74763
74758
  if (scene.logarithmicDepthBufferEnabled) {
74764
- const logDepthBufFC = 2.0 / (Math.log(camera.project.far + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
74759
+ const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
74765
74760
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
74766
74761
  }
74767
74762
  const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
@@ -75138,7 +75133,11 @@ class DTXTrianglesPickDepthRenderer {
75138
75133
  const textureState = state.textureState;
75139
75134
  const origin = dataTextureLayer._state.origin;
75140
75135
  const {position, rotationMatrix, rotationMatrixConjugate} = model;
75136
+
75141
75137
  const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
75138
+ const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
75139
+ const eye = frameCtx.pickOrigin || camera.eye;
75140
+ const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
75142
75141
 
75143
75142
  if (!this._program) {
75144
75143
  this._allocate();
@@ -75178,15 +75177,15 @@ class DTXTrianglesPickDepthRenderer {
75178
75177
  rtcOrigin[2] += position[2];
75179
75178
  rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$7);
75180
75179
  rtcCameraEye = tempVec3c$b;
75181
- rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
75182
- rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
75183
- rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
75180
+ rtcCameraEye[0] = eye[0] - rtcOrigin[0];
75181
+ rtcCameraEye[1] = eye[1] - rtcOrigin[1];
75182
+ rtcCameraEye[2] = eye[2] - rtcOrigin[2];
75184
75183
  frameCtx.snapPickOrigin[0] = rtcOrigin[0];
75185
75184
  frameCtx.snapPickOrigin[1] = rtcOrigin[1];
75186
75185
  frameCtx.snapPickOrigin[2] = rtcOrigin[2];
75187
75186
  } else {
75188
75187
  rtcViewMatrix = viewMatrix;
75189
- rtcCameraEye = camera.eye;
75188
+ rtcCameraEye = eye;
75190
75189
  frameCtx.snapPickOrigin[0] = 0;
75191
75190
  frameCtx.snapPickOrigin[1] = 0;
75192
75191
  frameCtx.snapPickOrigin[2] = 0;
@@ -75201,9 +75200,9 @@ class DTXTrianglesPickDepthRenderer {
75201
75200
  gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);
75202
75201
  gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
75203
75202
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
75204
- gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix);
75203
+ gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
75205
75204
  if (scene.logarithmicDepthBufferEnabled) {
75206
- const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2); // TODO: Far from pick project matrix?
75205
+ const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
75207
75206
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
75208
75207
  }
75209
75208
 
@@ -77713,6 +77712,11 @@ class DTXTrianglesPickNormalsFlatRenderer {
77713
77712
  this._bindProgram(frameCtx, state);
77714
77713
  }
77715
77714
 
77715
+ const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
77716
+ const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
77717
+ const eye = frameCtx.pickOrigin || camera.eye;
77718
+ const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
77719
+
77716
77720
  textureState.bindCommonTextures(
77717
77721
  this._program,
77718
77722
  this.uTexturePerObjectPositionsDecodeMatrix,
@@ -77741,24 +77745,24 @@ class DTXTrianglesPickNormalsFlatRenderer {
77741
77745
  rtcOrigin[0] += position[0];
77742
77746
  rtcOrigin[1] += position[1];
77743
77747
  rtcOrigin[2] += position[2];
77744
- rtcViewMatrix = createRTCViewMat(camera.viewMatrix, rtcOrigin, tempMat4a$1);
77748
+ rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$1);
77745
77749
  rtcCameraEye = tempVec3c$5;
77746
- rtcCameraEye[0] = camera.eye[0] - rtcOrigin[0];
77747
- rtcCameraEye[1] = camera.eye[1] - rtcOrigin[1];
77748
- rtcCameraEye[2] = camera.eye[2] - rtcOrigin[2];
77750
+ rtcCameraEye[0] = eye[0] - rtcOrigin[0];
77751
+ rtcCameraEye[1] = eye[1] - rtcOrigin[1];
77752
+ rtcCameraEye[2] = eye[2] - rtcOrigin[2];
77749
77753
  } else {
77750
- rtcViewMatrix = camera.viewMatrix; // TODO: make pickMatrix
77751
- rtcCameraEye = camera.eye;
77754
+ rtcViewMatrix = viewMatrix;
77755
+ rtcCameraEye = eye;
77752
77756
  }
77753
77757
  gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
77754
77758
  gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
77755
77759
  gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
77756
77760
  gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
77757
- gl.uniformMatrix4fv(this._uProjMatrix, false, camera.projMatrix); // TODO: pickProjMatrix
77761
+ gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
77758
77762
  gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
77759
77763
  gl.uniform1i(this._uRenderPass, renderPass);
77760
77764
  if (scene.logarithmicDepthBufferEnabled) {
77761
- const logDepthBufFC = 2.0 / (Math.log(frameCtx.pickZFar + 1.0) / Math.LN2);
77765
+ const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
77762
77766
  gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
77763
77767
  }
77764
77768
  const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
@@ -79302,7 +79306,7 @@ const INDICES_EDGE_INDICES_ALIGNEMENT_SIZE = 8;
79302
79306
  */
79303
79307
  const MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE = 10;
79304
79308
 
79305
- const tempVec4a$5 = math.vec4();
79309
+ const tempVec4a$6 = math.vec4();
79306
79310
  const tempMat4a = new Float32Array(16);
79307
79311
  const tempUint8Array4 = new Uint8Array(4);
79308
79312
  const tempFloat32Array3 = new Float32Array(3);
@@ -80379,7 +80383,7 @@ class DTXTrianglesLayer {
80379
80383
  const offsetX = origin[0] ;
80380
80384
  const offsetY = origin[1] ;
80381
80385
  const offsetZ = origin[2] ;
80382
- const worldPos = tempVec4a$5;
80386
+ const worldPos = tempVec4a$6;
80383
80387
  for (let i = 0, len = positions.length; i < len; i += 3) {
80384
80388
  worldPos[0] = positions[i];
80385
80389
  worldPos[1] = positions[i + 1];
@@ -90216,8 +90220,13 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
90216
90220
  }
90217
90221
 
90218
90222
  const touch = event.touches[0];
90219
- const touchX = touch.clientX;
90220
- const touchY = touch.clientY;
90223
+
90224
+ // Get the canvas's bounding rectangle
90225
+ const rect = canvas.getBoundingClientRect();
90226
+
90227
+ // Calculate the touch position relative to the canvas
90228
+ const touchX = touch.clientX - rect.left;
90229
+ const touchY = touch.clientY - rect.top;
90221
90230
 
90222
90231
  touchStartCanvasPos.set([touchX, touchY]);
90223
90232
  touchMoveCanvasPos.set([touchX, touchY]);
@@ -90425,9 +90434,14 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
90425
90434
  }
90426
90435
 
90427
90436
  const touch = event.touches[0];
90428
- const touchX = touch.clientX;
90429
- const touchY = touch.clientY;
90430
90437
 
90438
+ // Get the canvas's bounding rectangle
90439
+ const rect = canvas.getBoundingClientRect();
90440
+
90441
+ // Calculate the touch position relative to the canvas
90442
+ const touchX = touch.clientX - rect.left;
90443
+ const touchY = touch.clientY - rect.top;
90444
+
90431
90445
  if (touch.identifier !== touchId) {
90432
90446
  return;
90433
90447
  }
@@ -90594,8 +90608,13 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
90594
90608
  }
90595
90609
 
90596
90610
  const touch = event.changedTouches[0];
90597
- const touchX = touch.clientX;
90598
- const touchY = touch.clientY;
90611
+
90612
+ // Get the canvas's bounding rectangle
90613
+ const rect = canvas.getBoundingClientRect();
90614
+
90615
+ // Calculate the touch position relative to the canvas
90616
+ const touchX = touch.clientX - rect.left;
90617
+ const touchY = touch.clientY - rect.top;
90599
90618
 
90600
90619
  if (touch.identifier !== touchId) {
90601
90620
  return;
@@ -96493,8 +96512,8 @@ const tempVec3a$7 = math.vec3();
96493
96512
  const tempVec3b$4 = math.vec3();
96494
96513
  const tempVec3c$3 = math.vec3();
96495
96514
 
96496
- const tempVec4a$4 = math.vec4();
96497
- const tempVec4b$4 = math.vec4();
96515
+ const tempVec4a$5 = math.vec4();
96516
+ const tempVec4b$5 = math.vec4();
96498
96517
  const tempVec4c$1 = math.vec4();
96499
96518
 
96500
96519
  /**
@@ -96533,7 +96552,7 @@ class PanController {
96533
96552
 
96534
96553
  camera.ortho.scale = camera.ortho.scale - dollyDelta;
96535
96554
 
96536
- const unprojectedWorldPos = this._unproject(targetCanvasPos, tempVec4a$4);
96555
+ const unprojectedWorldPos = this._unproject(targetCanvasPos, tempVec4a$5);
96537
96556
  const offset = math.subVec3(unprojectedWorldPos, camera.eye, tempVec4c$1);
96538
96557
  const moveVec = math.mulVec3Scalar(math.normalizeVec3(offset), -dollyDelta, []);
96539
96558
 
@@ -96560,12 +96579,12 @@ class PanController {
96560
96579
  // - get the vector in which we're dollying;
96561
96580
  // - add both vectors to camera eye and look.
96562
96581
 
96563
- const worldPos1 = this._unproject(targetCanvasPos, tempVec4a$4);
96582
+ const worldPos1 = this._unproject(targetCanvasPos, tempVec4a$5);
96564
96583
 
96565
96584
  camera.ortho.scale = camera.ortho.scale - dollyDelta;
96566
96585
  camera.ortho._update(); // HACK
96567
96586
 
96568
- const worldPos2 = this._unproject(targetCanvasPos, tempVec4b$4);
96587
+ const worldPos2 = this._unproject(targetCanvasPos, tempVec4b$5);
96569
96588
  const offset = math.subVec3(worldPos2, worldPos1, tempVec4c$1);
96570
96589
  const eyeLookMoveVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look, camera.eye, tempVec3a$7)), -dollyDelta, tempVec3b$4);
96571
96590
  const moveVec = math.addVec3(offset, eyeLookMoveVec, tempVec3c$3);
@@ -96599,8 +96618,8 @@ const tempVec3a$6 = math.vec3();
96599
96618
  const tempVec3b$3 = math.vec3();
96600
96619
  const tempVec3c$2 = math.vec3();
96601
96620
 
96602
- const tempVec4a$3 = math.vec4();
96603
- const tempVec4b$3 = math.vec4();
96621
+ const tempVec4a$4 = math.vec4();
96622
+ const tempVec4b$4 = math.vec4();
96604
96623
  const tempVec4c = math.vec4();
96605
96624
 
96606
96625
 
@@ -96853,8 +96872,8 @@ class PivotController {
96853
96872
  const Pt4 = transposedProjectMat.subarray(12);
96854
96873
  const D = [0, 0, -1.0, 1];
96855
96874
  const screenZ = math.dotVec4(D, Pt3) / math.dotVec4(D, Pt4);
96856
- const worldPos = tempVec4a$3;
96857
- camera.project.unproject(canvasPos, screenZ, tempVec4b$3, tempVec4c, worldPos);
96875
+ const worldPos = tempVec4a$4;
96876
+ camera.project.unproject(canvasPos, screenZ, tempVec4b$4, tempVec4c, worldPos);
96858
96877
  const eyeWorldPosVec = math.normalizeVec3(math.subVec3(worldPos, camera.eye, tempVec3a$6));
96859
96878
  const posOnSphere = math.addVec3(camera.eye, math.mulVec3Scalar(eyeWorldPosVec, pivotShereRadius, tempVec3b$3), tempVec3c$2);
96860
96879
  this.setPivotPos(posOnSphere);
@@ -110214,6 +110233,9 @@ class Viewer {
110214
110233
  }
110215
110234
  }
110216
110235
 
110236
+ // firing "rendering" is necessary to trigger DTX{Lines,Triangles}Layer::_uploadDeferredFlags
110237
+ this.scene.fire("rendering", { }, true);
110238
+
110217
110239
  this.scene._renderer.renderSnapshot();
110218
110240
 
110219
110241
  const imageDataURI = this.scene._renderer.readSnapshot(params);
@@ -128129,7 +128151,7 @@ if (!pako$9.inflate) { // See https://github.com/nodeca/pako/issues/97
128129
128151
  pako$9 = pako$9.default;
128130
128152
  }
128131
128153
 
128132
- const decompressColor$9 = (function () {
128154
+ const decompressColor$a = (function () {
128133
128155
  const color2 = new Float32Array(3);
128134
128156
  return function (color) {
128135
128157
  color2[0] = color[0] / 255.0;
@@ -128173,7 +128195,7 @@ function inflate$9(deflatedData) {
128173
128195
  };
128174
128196
  }
128175
128197
 
128176
- function load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128198
+ function load$a(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128177
128199
 
128178
128200
  manifestCtx.getNextId();
128179
128201
 
@@ -128242,7 +128264,7 @@ function load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
128242
128264
  const lastMesh = (j === (numMeshes - 1));
128243
128265
  const meshId = entityId + ".mesh." + j;
128244
128266
 
128245
- const color = decompressColor$9(meshColors.subarray((j * 4), (j * 4) + 3));
128267
+ const color = decompressColor$a(meshColors.subarray((j * 4), (j * 4) + 3));
128246
128268
  const opacity = meshColors[(j * 4) + 3] / 255.0;
128247
128269
 
128248
128270
  sceneModel.createMesh(utils.apply(meshDefaults, {
@@ -128274,7 +128296,7 @@ const ParserV1 = {
128274
128296
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
128275
128297
  const deflatedData = extract$9(elements);
128276
128298
  const inflatedData = inflate$9(deflatedData);
128277
- load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128299
+ load$a(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128278
128300
  }
128279
128301
  };
128280
128302
 
@@ -128342,6 +128364,222 @@ function inflate$8(deflatedData) {
128342
128364
  };
128343
128365
  }
128344
128366
 
128367
+ const decompressColor$9 = (function () {
128368
+ const color2 = new Float32Array(3);
128369
+ return function (color) {
128370
+ color2[0] = color[0] / 255.0;
128371
+ color2[1] = color[1] / 255.0;
128372
+ color2[2] = color[2] / 255.0;
128373
+ return color2;
128374
+ };
128375
+ })();
128376
+
128377
+ function load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128378
+
128379
+ const modelPartId = manifestCtx.getNextId();
128380
+
128381
+ sceneModel.positionsCompression = "precompressed";
128382
+ sceneModel.normalsCompression = "precompressed";
128383
+
128384
+ const positions = inflatedData.positions;
128385
+ const normals = inflatedData.normals;
128386
+ const indices = inflatedData.indices;
128387
+ const edgeIndices = inflatedData.edgeIndices;
128388
+ const meshPositions = inflatedData.meshPositions;
128389
+ const meshIndices = inflatedData.meshIndices;
128390
+ const meshEdgesIndices = inflatedData.meshEdgesIndices;
128391
+ const meshColors = inflatedData.meshColors;
128392
+ const entityIDs = JSON.parse(inflatedData.entityIDs);
128393
+ const entityMeshes = inflatedData.entityMeshes;
128394
+ const entityIsObjects = inflatedData.entityIsObjects;
128395
+ const entityMeshIds = inflatedData.entityMeshIds;
128396
+ const entityMatrices = inflatedData.entityMatrices;
128397
+ const entityUsesInstancing = inflatedData.entityUsesInstancing;
128398
+
128399
+ const numMeshes = meshPositions.length;
128400
+ const numEntities = entityMeshes.length;
128401
+
128402
+ const alreadyCreatedGeometries = {};
128403
+
128404
+ for (let i = 0; i < numEntities; i++) {
128405
+
128406
+ const xktEntityId = entityIDs [i];
128407
+ const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
128408
+ const metaObject = viewer.metaScene.metaObjects[entityId];
128409
+ const entityDefaults = {};
128410
+ const meshDefaults = {};
128411
+ const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);
128412
+
128413
+ if (metaObject) {
128414
+ if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
128415
+ continue;
128416
+ }
128417
+ if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
128418
+ continue;
128419
+ }
128420
+ const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
128421
+ if (props) {
128422
+ if (props.visible === false) {
128423
+ entityDefaults.visible = false;
128424
+ }
128425
+ if (props.pickable === false) {
128426
+ entityDefaults.pickable = false;
128427
+ }
128428
+ if (props.colorize) {
128429
+ meshDefaults.color = props.colorize;
128430
+ }
128431
+ if (props.opacity !== undefined && props.opacity !== null) {
128432
+ meshDefaults.opacity = props.opacity;
128433
+ }
128434
+ }
128435
+ } else {
128436
+ if (options.excludeUnclassifiedObjects) {
128437
+ continue;
128438
+ }
128439
+ }
128440
+
128441
+ const lastEntity = (i === numEntities - 1);
128442
+
128443
+ const meshIds = [];
128444
+
128445
+ for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {
128446
+
128447
+ const jj = entityMeshIds [j];
128448
+
128449
+ const lastMesh = (jj === (numMeshes - 1));
128450
+ const meshId = manifestCtx.getNextId();
128451
+
128452
+ const color = decompressColor$9(meshColors.subarray((jj * 4), (jj * 4) + 3));
128453
+ const opacity = meshColors[(jj * 4) + 3] / 255.0;
128454
+
128455
+ const tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
128456
+ const tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
128457
+ const tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);
128458
+ const tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);
128459
+
128460
+ if (entityUsesInstancing [i] === 1) {
128461
+
128462
+ const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;
128463
+
128464
+ if (!(geometryId in alreadyCreatedGeometries)) {
128465
+
128466
+ sceneModel.createGeometry({
128467
+ id: geometryId,
128468
+ positionsCompressed: tmpPositions,
128469
+ normalsCompressed: tmpNormals,
128470
+ indices: tmpIndices,
128471
+ edgeIndices: tmpEdgeIndices,
128472
+ primitive: "triangles",
128473
+ positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
128474
+ });
128475
+
128476
+ alreadyCreatedGeometries [geometryId] = true;
128477
+ }
128478
+
128479
+ sceneModel.createMesh(utils.apply(meshDefaults, {
128480
+ id: meshId,
128481
+ color: color,
128482
+ opacity: opacity,
128483
+ matrix: entityMatrix,
128484
+ geometryId,
128485
+ }));
128486
+
128487
+ meshIds.push(meshId);
128488
+
128489
+ } else {
128490
+
128491
+ sceneModel.createMesh(utils.apply(meshDefaults, {
128492
+ id: meshId,
128493
+ primitive: "triangles",
128494
+ positionsCompressed: tmpPositions,
128495
+ normalsCompressed: tmpNormals,
128496
+ indices: tmpIndices,
128497
+ edgeIndices: tmpEdgeIndices,
128498
+ positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
128499
+ color: color,
128500
+ opacity: opacity
128501
+ }));
128502
+
128503
+ meshIds.push(meshId);
128504
+ }
128505
+ }
128506
+
128507
+ if (meshIds.length) {
128508
+
128509
+ sceneModel.createEntity(utils.apply(entityDefaults, {
128510
+ id: entityId,
128511
+ isObject: (entityIsObjects [i] === 1),
128512
+ meshIds: meshIds
128513
+ }));
128514
+ }
128515
+ }
128516
+ }
128517
+
128518
+ /** @private */
128519
+ const ParserV2 = {
128520
+ version: 2,
128521
+ parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
128522
+ const deflatedData = extract$8(elements);
128523
+ const inflatedData = inflate$8(deflatedData);
128524
+ load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128525
+ }
128526
+ };
128527
+
128528
+ /*
128529
+
128530
+ Parser for .XKT Format V3
128531
+
128532
+ .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
128533
+
128534
+ */
128535
+
128536
+ let pako$7 = window.pako || p;
128537
+ if (!pako$7.inflate) { // See https://github.com/nodeca/pako/issues/97
128538
+ pako$7 = pako$7.default;
128539
+ }
128540
+
128541
+ function extract$7(elements) {
128542
+ return {
128543
+ positions: elements[0],
128544
+ normals: elements[1],
128545
+ indices: elements[2],
128546
+ edgeIndices: elements[3],
128547
+ meshPositions: elements[4],
128548
+ meshIndices: elements[5],
128549
+ meshEdgesIndices: elements[6],
128550
+ meshColors: elements[7],
128551
+ entityIDs: elements[8],
128552
+ entityMeshes: elements[9],
128553
+ entityIsObjects: elements[10],
128554
+ instancedPositionsDecodeMatrix: elements[11],
128555
+ batchedPositionsDecodeMatrix: elements[12],
128556
+ entityMeshIds: elements[13],
128557
+ entityMatrices: elements[14],
128558
+ entityUsesInstancing: elements[15]
128559
+ };
128560
+ }
128561
+
128562
+ function inflate$7(deflatedData) {
128563
+ return {
128564
+ positions: new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),
128565
+ normals: new Int8Array(pako$7.inflate(deflatedData.normals).buffer),
128566
+ indices: new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),
128567
+ edgeIndices: new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),
128568
+ meshPositions: new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),
128569
+ meshIndices: new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),
128570
+ meshEdgesIndices: new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),
128571
+ meshColors: new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),
128572
+ entityIDs: pako$7.inflate(deflatedData.entityIDs, {to: 'string'}),
128573
+ entityMeshes: new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),
128574
+ entityIsObjects: new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),
128575
+ instancedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),
128576
+ batchedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),
128577
+ entityMeshIds: new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),
128578
+ entityMatrices: new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),
128579
+ entityUsesInstancing: new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)
128580
+ };
128581
+ }
128582
+
128345
128583
  const decompressColor$8 = (function () {
128346
128584
  const color2 = new Float32Array(3);
128347
128585
  return function (color) {
@@ -128377,222 +128615,6 @@ function load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
128377
128615
  const numMeshes = meshPositions.length;
128378
128616
  const numEntities = entityMeshes.length;
128379
128617
 
128380
- const alreadyCreatedGeometries = {};
128381
-
128382
- for (let i = 0; i < numEntities; i++) {
128383
-
128384
- const xktEntityId = entityIDs [i];
128385
- const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
128386
- const metaObject = viewer.metaScene.metaObjects[entityId];
128387
- const entityDefaults = {};
128388
- const meshDefaults = {};
128389
- const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);
128390
-
128391
- if (metaObject) {
128392
- if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
128393
- continue;
128394
- }
128395
- if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
128396
- continue;
128397
- }
128398
- const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
128399
- if (props) {
128400
- if (props.visible === false) {
128401
- entityDefaults.visible = false;
128402
- }
128403
- if (props.pickable === false) {
128404
- entityDefaults.pickable = false;
128405
- }
128406
- if (props.colorize) {
128407
- meshDefaults.color = props.colorize;
128408
- }
128409
- if (props.opacity !== undefined && props.opacity !== null) {
128410
- meshDefaults.opacity = props.opacity;
128411
- }
128412
- }
128413
- } else {
128414
- if (options.excludeUnclassifiedObjects) {
128415
- continue;
128416
- }
128417
- }
128418
-
128419
- const lastEntity = (i === numEntities - 1);
128420
-
128421
- const meshIds = [];
128422
-
128423
- for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {
128424
-
128425
- const jj = entityMeshIds [j];
128426
-
128427
- const lastMesh = (jj === (numMeshes - 1));
128428
- const meshId = manifestCtx.getNextId();
128429
-
128430
- const color = decompressColor$8(meshColors.subarray((jj * 4), (jj * 4) + 3));
128431
- const opacity = meshColors[(jj * 4) + 3] / 255.0;
128432
-
128433
- const tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
128434
- const tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
128435
- const tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);
128436
- const tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);
128437
-
128438
- if (entityUsesInstancing [i] === 1) {
128439
-
128440
- const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;
128441
-
128442
- if (!(geometryId in alreadyCreatedGeometries)) {
128443
-
128444
- sceneModel.createGeometry({
128445
- id: geometryId,
128446
- positionsCompressed: tmpPositions,
128447
- normalsCompressed: tmpNormals,
128448
- indices: tmpIndices,
128449
- edgeIndices: tmpEdgeIndices,
128450
- primitive: "triangles",
128451
- positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
128452
- });
128453
-
128454
- alreadyCreatedGeometries [geometryId] = true;
128455
- }
128456
-
128457
- sceneModel.createMesh(utils.apply(meshDefaults, {
128458
- id: meshId,
128459
- color: color,
128460
- opacity: opacity,
128461
- matrix: entityMatrix,
128462
- geometryId,
128463
- }));
128464
-
128465
- meshIds.push(meshId);
128466
-
128467
- } else {
128468
-
128469
- sceneModel.createMesh(utils.apply(meshDefaults, {
128470
- id: meshId,
128471
- primitive: "triangles",
128472
- positionsCompressed: tmpPositions,
128473
- normalsCompressed: tmpNormals,
128474
- indices: tmpIndices,
128475
- edgeIndices: tmpEdgeIndices,
128476
- positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
128477
- color: color,
128478
- opacity: opacity
128479
- }));
128480
-
128481
- meshIds.push(meshId);
128482
- }
128483
- }
128484
-
128485
- if (meshIds.length) {
128486
-
128487
- sceneModel.createEntity(utils.apply(entityDefaults, {
128488
- id: entityId,
128489
- isObject: (entityIsObjects [i] === 1),
128490
- meshIds: meshIds
128491
- }));
128492
- }
128493
- }
128494
- }
128495
-
128496
- /** @private */
128497
- const ParserV2 = {
128498
- version: 2,
128499
- parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
128500
- const deflatedData = extract$8(elements);
128501
- const inflatedData = inflate$8(deflatedData);
128502
- load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128503
- }
128504
- };
128505
-
128506
- /*
128507
-
128508
- Parser for .XKT Format V3
128509
-
128510
- .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
128511
-
128512
- */
128513
-
128514
- let pako$7 = window.pako || p;
128515
- if (!pako$7.inflate) { // See https://github.com/nodeca/pako/issues/97
128516
- pako$7 = pako$7.default;
128517
- }
128518
-
128519
- function extract$7(elements) {
128520
- return {
128521
- positions: elements[0],
128522
- normals: elements[1],
128523
- indices: elements[2],
128524
- edgeIndices: elements[3],
128525
- meshPositions: elements[4],
128526
- meshIndices: elements[5],
128527
- meshEdgesIndices: elements[6],
128528
- meshColors: elements[7],
128529
- entityIDs: elements[8],
128530
- entityMeshes: elements[9],
128531
- entityIsObjects: elements[10],
128532
- instancedPositionsDecodeMatrix: elements[11],
128533
- batchedPositionsDecodeMatrix: elements[12],
128534
- entityMeshIds: elements[13],
128535
- entityMatrices: elements[14],
128536
- entityUsesInstancing: elements[15]
128537
- };
128538
- }
128539
-
128540
- function inflate$7(deflatedData) {
128541
- return {
128542
- positions: new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),
128543
- normals: new Int8Array(pako$7.inflate(deflatedData.normals).buffer),
128544
- indices: new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),
128545
- edgeIndices: new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),
128546
- meshPositions: new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),
128547
- meshIndices: new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),
128548
- meshEdgesIndices: new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),
128549
- meshColors: new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),
128550
- entityIDs: pako$7.inflate(deflatedData.entityIDs, {to: 'string'}),
128551
- entityMeshes: new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),
128552
- entityIsObjects: new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),
128553
- instancedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),
128554
- batchedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),
128555
- entityMeshIds: new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),
128556
- entityMatrices: new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),
128557
- entityUsesInstancing: new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)
128558
- };
128559
- }
128560
-
128561
- const decompressColor$7 = (function () {
128562
- const color2 = new Float32Array(3);
128563
- return function (color) {
128564
- color2[0] = color[0] / 255.0;
128565
- color2[1] = color[1] / 255.0;
128566
- color2[2] = color[2] / 255.0;
128567
- return color2;
128568
- };
128569
- })();
128570
-
128571
- function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128572
-
128573
- const modelPartId = manifestCtx.getNextId();
128574
-
128575
- sceneModel.positionsCompression = "precompressed";
128576
- sceneModel.normalsCompression = "precompressed";
128577
-
128578
- const positions = inflatedData.positions;
128579
- const normals = inflatedData.normals;
128580
- const indices = inflatedData.indices;
128581
- const edgeIndices = inflatedData.edgeIndices;
128582
- const meshPositions = inflatedData.meshPositions;
128583
- const meshIndices = inflatedData.meshIndices;
128584
- const meshEdgesIndices = inflatedData.meshEdgesIndices;
128585
- const meshColors = inflatedData.meshColors;
128586
- const entityIDs = JSON.parse(inflatedData.entityIDs);
128587
- const entityMeshes = inflatedData.entityMeshes;
128588
- const entityIsObjects = inflatedData.entityIsObjects;
128589
- const entityMeshIds = inflatedData.entityMeshIds;
128590
- const entityMatrices = inflatedData.entityMatrices;
128591
- const entityUsesInstancing = inflatedData.entityUsesInstancing;
128592
-
128593
- const numMeshes = meshPositions.length;
128594
- const numEntities = entityMeshes.length;
128595
-
128596
128618
  const _alreadyCreatedGeometries = {};
128597
128619
 
128598
128620
  for (let i = 0; i < numEntities; i++) {
@@ -128646,7 +128668,7 @@ function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
128646
128668
  const lastMesh = (jj === (numMeshes - 1));
128647
128669
  const meshId = `${modelPartId}.${entityId}.mesh.${jj}`;
128648
128670
 
128649
- const color = decompressColor$7(meshColors.subarray((jj * 4), (jj * 4) + 3));
128671
+ const color = decompressColor$8(meshColors.subarray((jj * 4), (jj * 4) + 3));
128650
128672
  const opacity = meshColors[(jj * 4) + 3] / 255.0;
128651
128673
 
128652
128674
  var tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
@@ -128717,7 +128739,7 @@ const ParserV3 = {
128717
128739
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
128718
128740
  const deflatedData = extract$7(elements);
128719
128741
  const inflatedData = inflate$7(deflatedData);
128720
- load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128742
+ load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128721
128743
  }
128722
128744
  };
128723
128745
 
@@ -128775,7 +128797,7 @@ function inflate$6(deflatedData) {
128775
128797
  };
128776
128798
  }
128777
128799
 
128778
- const decompressColor$6 = (function () {
128800
+ const decompressColor$7 = (function () {
128779
128801
  const color2 = new Float32Array(3);
128780
128802
  return function (color) {
128781
128803
  color2[0] = color[0] / 255.0;
@@ -128785,7 +128807,7 @@ const decompressColor$6 = (function () {
128785
128807
  };
128786
128808
  })();
128787
128809
 
128788
- function load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128810
+ function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
128789
128811
 
128790
128812
  const modelPartId = manifestCtx.getNextId();
128791
128813
 
@@ -128881,7 +128903,7 @@ function load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
128881
128903
  const primitiveInstanceCount = primitiveInstanceCounts[orderedPrimitiveIndex];
128882
128904
  const isInstancedPrimitive = (primitiveInstanceCount > 1);
128883
128905
 
128884
- const color = decompressColor$6(eachPrimitiveColor.subarray((orderedPrimitiveIndex * 4), (orderedPrimitiveIndex * 4) + 3));
128906
+ const color = decompressColor$7(eachPrimitiveColor.subarray((orderedPrimitiveIndex * 4), (orderedPrimitiveIndex * 4) + 3));
128885
128907
  const opacity = eachPrimitiveColor[(orderedPrimitiveIndex * 4) + 3] / 255.0;
128886
128908
 
128887
128909
  const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex + 1]);
@@ -128991,7 +129013,7 @@ const ParserV4 = {
128991
129013
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
128992
129014
  const deflatedData = extract$6(elements);
128993
129015
  const inflatedData = inflate$6(deflatedData);
128994
- load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129016
+ load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
128995
129017
  }
128996
129018
  };
128997
129019
 
@@ -129044,7 +129066,7 @@ function inflate$5(deflatedData) {
129044
129066
  };
129045
129067
  }
129046
129068
 
129047
- const decompressColor$5 = (function () {
129069
+ const decompressColor$6 = (function () {
129048
129070
  const color2 = new Float32Array(3);
129049
129071
  return function (color) {
129050
129072
  color2[0] = color[0] / 255.0;
@@ -129054,7 +129076,7 @@ const decompressColor$5 = (function () {
129054
129076
  };
129055
129077
  })();
129056
129078
 
129057
- function load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129079
+ function load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129058
129080
 
129059
129081
  const modelPartId = manifestCtx.getNextId();
129060
129082
 
@@ -129123,7 +129145,7 @@ function load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
129123
129145
  const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];
129124
129146
  const isInstancedPrimitive = (primitiveInstanceCount > 1);
129125
129147
 
129126
- const color = decompressColor$5(eachPrimitiveColor.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
129148
+ const color = decompressColor$6(eachPrimitiveColor.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
129127
129149
  const opacity = eachPrimitiveColor[(primitiveIndex * 4) + 3] / 255.0;
129128
129150
 
129129
129151
  const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);
@@ -129229,7 +129251,7 @@ const ParserV5 = {
129229
129251
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
129230
129252
  const deflatedData = extract$5(elements);
129231
129253
  const inflatedData = inflate$5(deflatedData);
129232
- load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129254
+ load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129233
129255
  }
129234
129256
  };
129235
129257
 
@@ -129292,7 +129314,7 @@ function inflate$4(deflatedData) {
129292
129314
  };
129293
129315
  }
129294
129316
 
129295
- const decompressColor$4 = (function () {
129317
+ const decompressColor$5 = (function () {
129296
129318
  const floatColor = new Float32Array(3);
129297
129319
  return function (intColor) {
129298
129320
  floatColor[0] = intColor[0] / 255.0;
@@ -129302,7 +129324,7 @@ const decompressColor$4 = (function () {
129302
129324
  };
129303
129325
  })();
129304
129326
 
129305
- function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129327
+ function load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129306
129328
 
129307
129329
  const modelPartId = manifestCtx.getNextId();
129308
129330
 
@@ -129450,7 +129472,7 @@ function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
129450
129472
  const primitiveIndices = indices.subarray(eachPrimitiveIndicesPortion [primitiveIndex], atLastPrimitive ? indices.length : eachPrimitiveIndicesPortion [primitiveIndex + 1]);
129451
129473
  const primitiveEdgeIndices = edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion [primitiveIndex], atLastPrimitive ? edgeIndices.length : eachPrimitiveEdgeIndicesPortion [primitiveIndex + 1]);
129452
129474
 
129453
- const color = decompressColor$4(eachPrimitiveColorAndOpacity.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
129475
+ const color = decompressColor$5(eachPrimitiveColorAndOpacity.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
129454
129476
  const opacity = eachPrimitiveColorAndOpacity[(primitiveIndex * 4) + 3] / 255.0;
129455
129477
 
129456
129478
  const meshId = manifestCtx.getNextId();
@@ -129524,7 +129546,7 @@ const ParserV6 = {
129524
129546
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
129525
129547
  const deflatedData = extract$4(elements);
129526
129548
  const inflatedData = inflate$4(deflatedData);
129527
- load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129549
+ load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129528
129550
  }
129529
129551
  };
129530
129552
 
@@ -129622,7 +129644,7 @@ function inflate$3(deflatedData) {
129622
129644
  };
129623
129645
  }
129624
129646
 
129625
- const decompressColor$3 = (function () {
129647
+ const decompressColor$4 = (function () {
129626
129648
  const floatColor = new Float32Array(3);
129627
129649
  return function (intColor) {
129628
129650
  floatColor[0] = intColor[0] / 255.0;
@@ -129643,7 +129665,7 @@ function convertColorsRGBToRGBA$1(colorsRGB) {
129643
129665
  return colorsRGBA;
129644
129666
  }
129645
129667
 
129646
- function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129668
+ function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
129647
129669
 
129648
129670
  const modelPartId = manifestCtx.getNextId();
129649
129671
 
@@ -129794,7 +129816,7 @@ function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
129794
129816
 
129795
129817
  const atLastGeometry = (geometryIndex === (numGeometries - 1));
129796
129818
 
129797
- const meshColor = decompressColor$3(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
129819
+ const meshColor = decompressColor$4(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
129798
129820
  const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
129799
129821
  const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
129800
129822
  const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
@@ -129955,7 +129977,7 @@ const ParserV7 = {
129955
129977
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
129956
129978
  const deflatedData = extract$3(elements);
129957
129979
  const inflatedData = inflate$3(deflatedData);
129958
- load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129980
+ load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
129959
129981
  }
129960
129982
  };
129961
129983
 
@@ -129970,8 +129992,8 @@ if (!pako$2.inflate) { // See https://github.com/nodeca/pako/issues/97
129970
129992
  pako$2 = pako$2.default;
129971
129993
  }
129972
129994
 
129973
- const tempVec4a$2 = math.vec4();
129974
- const tempVec4b$2 = math.vec4();
129995
+ const tempVec4a$3 = math.vec4();
129996
+ const tempVec4b$3 = math.vec4();
129975
129997
 
129976
129998
  function extract$2(elements) {
129977
129999
 
@@ -130063,7 +130085,7 @@ function inflate$2(deflatedData) {
130063
130085
  };
130064
130086
  }
130065
130087
 
130066
- const decompressColor$2 = (function () {
130088
+ const decompressColor$3 = (function () {
130067
130089
  const floatColor = new Float32Array(3);
130068
130090
  return function (intColor) {
130069
130091
  floatColor[0] = intColor[0] / 255.0;
@@ -130084,7 +130106,7 @@ function convertColorsRGBToRGBA(colorsRGB) {
130084
130106
  return colorsRGBA;
130085
130107
  }
130086
130108
 
130087
- function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
130109
+ function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
130088
130110
 
130089
130111
  const modelPartId = manifestCtx.getNextId();
130090
130112
 
@@ -130270,7 +130292,7 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
130270
130292
 
130271
130293
  const atLastGeometry = (geometryIndex === (numGeometries - 1));
130272
130294
 
130273
- const meshColor = decompressColor$2(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
130295
+ const meshColor = decompressColor$3(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
130274
130296
  const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
130275
130297
  const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
130276
130298
  const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
@@ -130359,15 +130381,15 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
130359
130381
  const decompressedPositions = geometryArrays.decompressedPositions;
130360
130382
  const positions = new Uint16Array(decompressedPositions.length);
130361
130383
  for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
130362
- tempVec4a$2[0] = decompressedPositions[i + 0];
130363
- tempVec4a$2[1] = decompressedPositions[i + 1];
130364
- tempVec4a$2[2] = decompressedPositions[i + 2];
130365
- tempVec4a$2[3] = 1;
130366
- math.transformVec4(meshMatrix, tempVec4a$2, tempVec4b$2);
130367
- geometryCompressionUtils.compressPosition(tempVec4b$2, rtcAABB, tempVec4a$2);
130368
- positions[i + 0] = tempVec4a$2[0];
130369
- positions[i + 1] = tempVec4a$2[1];
130370
- positions[i + 2] = tempVec4a$2[2];
130384
+ tempVec4a$3[0] = decompressedPositions[i + 0];
130385
+ tempVec4a$3[1] = decompressedPositions[i + 1];
130386
+ tempVec4a$3[2] = decompressedPositions[i + 2];
130387
+ tempVec4a$3[3] = 1;
130388
+ math.transformVec4(meshMatrix, tempVec4a$3, tempVec4b$3);
130389
+ geometryCompressionUtils.compressPosition(tempVec4b$3, rtcAABB, tempVec4a$3);
130390
+ positions[i + 0] = tempVec4a$3[0];
130391
+ positions[i + 1] = tempVec4a$3[1];
130392
+ positions[i + 2] = tempVec4a$3[2];
130371
130393
  }
130372
130394
 
130373
130395
  sceneModel.createMesh(utils.apply(meshDefaults, {
@@ -130507,7 +130529,7 @@ const ParserV8 = {
130507
130529
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
130508
130530
  const deflatedData = extract$2(elements);
130509
130531
  const inflatedData = inflate$2(deflatedData);
130510
- load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
130532
+ load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
130511
130533
  }
130512
130534
  };
130513
130535
 
@@ -130522,8 +130544,8 @@ if (!pako$1.inflate) { // See https://github.com/nodeca/pako/issues/97
130522
130544
  pako$1 = pako$1.default;
130523
130545
  }
130524
130546
 
130525
- const tempVec4a$1 = math.vec4();
130526
- const tempVec4b$1 = math.vec4();
130547
+ const tempVec4a$2 = math.vec4();
130548
+ const tempVec4b$2 = math.vec4();
130527
130549
 
130528
130550
  function extract$1(elements) {
130529
130551
 
@@ -130607,7 +130629,7 @@ function inflate$1(deflatedData) {
130607
130629
  };
130608
130630
  }
130609
130631
 
130610
- const decompressColor$1 = (function () {
130632
+ const decompressColor$2 = (function () {
130611
130633
  const floatColor = new Float32Array(3);
130612
130634
  return function (intColor) {
130613
130635
  floatColor[0] = intColor[0] / 255.0;
@@ -130617,7 +130639,7 @@ const decompressColor$1 = (function () {
130617
130639
  };
130618
130640
  })();
130619
130641
 
130620
- function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
130642
+ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
130621
130643
 
130622
130644
  const modelPartId = manifestCtx.getNextId();
130623
130645
 
@@ -130779,7 +130801,7 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
130779
130801
 
130780
130802
  const atLastGeometry = (geometryIndex === (numGeometries - 1));
130781
130803
 
130782
- const meshColor = decompressColor$1(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
130804
+ const meshColor = decompressColor$2(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
130783
130805
  const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
130784
130806
  const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
130785
130807
  const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
@@ -130866,15 +130888,15 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
130866
130888
  const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;
130867
130889
 
130868
130890
  for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
130869
- tempVec4a$1[0] = decompressedPositions[i + 0];
130870
- tempVec4a$1[1] = decompressedPositions[i + 1];
130871
- tempVec4a$1[2] = decompressedPositions[i + 2];
130872
- tempVec4a$1[3] = 1;
130873
- math.transformVec4(meshMatrix, tempVec4a$1, tempVec4b$1);
130874
- geometryCompressionUtils.compressPosition(tempVec4b$1, rtcAABB, tempVec4a$1);
130875
- transformedAndRecompressedPositions[i + 0] = tempVec4a$1[0];
130876
- transformedAndRecompressedPositions[i + 1] = tempVec4a$1[1];
130877
- transformedAndRecompressedPositions[i + 2] = tempVec4a$1[2];
130891
+ tempVec4a$2[0] = decompressedPositions[i + 0];
130892
+ tempVec4a$2[1] = decompressedPositions[i + 1];
130893
+ tempVec4a$2[2] = decompressedPositions[i + 2];
130894
+ tempVec4a$2[3] = 1;
130895
+ math.transformVec4(meshMatrix, tempVec4a$2, tempVec4b$2);
130896
+ geometryCompressionUtils.compressPosition(tempVec4b$2, rtcAABB, tempVec4a$2);
130897
+ transformedAndRecompressedPositions[i + 0] = tempVec4a$2[0];
130898
+ transformedAndRecompressedPositions[i + 1] = tempVec4a$2[1];
130899
+ transformedAndRecompressedPositions[i + 2] = tempVec4a$2[2];
130878
130900
  }
130879
130901
 
130880
130902
  sceneModel.createMesh(utils.apply(meshDefaults, {
@@ -131014,7 +131036,7 @@ const ParserV9 = {
131014
131036
  parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
131015
131037
  const deflatedData = extract$1(elements);
131016
131038
  const inflatedData = inflate$1(deflatedData);
131017
- load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
131039
+ load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
131018
131040
  }
131019
131041
  };
131020
131042
 
@@ -131027,10 +131049,10 @@ if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
131027
131049
  pako = pako.default;
131028
131050
  }
131029
131051
 
131030
- const tempVec4a = math.vec4();
131031
- const tempVec4b = math.vec4();
131052
+ const tempVec4a$1 = math.vec4();
131053
+ const tempVec4b$1 = math.vec4();
131032
131054
 
131033
- const NUM_TEXTURE_ATTRIBUTES = 9;
131055
+ const NUM_TEXTURE_ATTRIBUTES$1 = 9;
131034
131056
 
131035
131057
  function extract(elements) {
131036
131058
 
@@ -131106,6 +131128,648 @@ function inflate(deflatedData) {
131106
131128
  };
131107
131129
  }
131108
131130
 
131131
+ const decompressColor$1 = (function () {
131132
+ const floatColor = new Float32Array(3);
131133
+ return function (intColor) {
131134
+ floatColor[0] = intColor[0] / 255.0;
131135
+ floatColor[1] = intColor[1] / 255.0;
131136
+ floatColor[2] = intColor[2] / 255.0;
131137
+ return floatColor;
131138
+ };
131139
+ })();
131140
+
131141
+ ((function () {
131142
+ const canvas = document.createElement('canvas');
131143
+ const context = canvas.getContext('2d');
131144
+ return function (imagedata) {
131145
+ canvas.width = imagedata.width;
131146
+ canvas.height = imagedata.height;
131147
+ context.putImageData(imagedata, 0, 0);
131148
+ return canvas.toDataURL();
131149
+ };
131150
+ }))();
131151
+
131152
+ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
131153
+
131154
+ const modelPartId = manifestCtx.getNextId();
131155
+
131156
+ const metadata = inflatedData.metadata;
131157
+ const textureData = inflatedData.textureData;
131158
+ const eachTextureDataPortion = inflatedData.eachTextureDataPortion;
131159
+ const eachTextureAttributes = inflatedData.eachTextureAttributes;
131160
+ const positions = inflatedData.positions;
131161
+ const normals = inflatedData.normals;
131162
+ const colors = inflatedData.colors;
131163
+ const uvs = inflatedData.uvs;
131164
+ const indices = inflatedData.indices;
131165
+ const edgeIndices = inflatedData.edgeIndices;
131166
+ const eachTextureSetTextures = inflatedData.eachTextureSetTextures;
131167
+ const matrices = inflatedData.matrices;
131168
+ const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;
131169
+ const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;
131170
+ const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;
131171
+ const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;
131172
+ const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;
131173
+ const eachGeometryUVsPortion = inflatedData.eachGeometryUVsPortion;
131174
+ const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;
131175
+ const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;
131176
+ const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;
131177
+ const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;
131178
+ const eachMeshTextureSet = inflatedData.eachMeshTextureSet;
131179
+ const eachMeshMaterialAttributes = inflatedData.eachMeshMaterialAttributes;
131180
+ const eachEntityId = inflatedData.eachEntityId;
131181
+ const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;
131182
+ const eachTileAABB = inflatedData.eachTileAABB;
131183
+ const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;
131184
+
131185
+ const numTextures = eachTextureDataPortion.length;
131186
+ const numTextureSets = eachTextureSetTextures.length / 5;
131187
+ const numGeometries = eachGeometryPositionsPortion.length;
131188
+ const numMeshes = eachMeshGeometriesPortion.length;
131189
+ const numEntities = eachEntityMeshesPortion.length;
131190
+ const numTiles = eachTileEntitiesPortion.length;
131191
+
131192
+ if (metaModel) {
131193
+ metaModel.loadData(metadata, {
131194
+ includeTypes: options.includeTypes,
131195
+ excludeTypes: options.excludeTypes,
131196
+ globalizeObjectIds: options.globalizeObjectIds
131197
+ }); // Can be empty
131198
+ }
131199
+
131200
+ // Create textures
131201
+
131202
+ for (let textureIndex = 0; textureIndex < numTextures; textureIndex++) {
131203
+ const atLastTexture = (textureIndex === (numTextures - 1));
131204
+ const textureDataPortionStart = eachTextureDataPortion[textureIndex];
131205
+ const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]);
131206
+
131207
+ const textureDataPortionSize = textureDataPortionEnd - textureDataPortionStart;
131208
+ const textureDataPortionExists = (textureDataPortionSize > 0);
131209
+
131210
+ const textureAttrBaseIdx = (textureIndex * NUM_TEXTURE_ATTRIBUTES$1);
131211
+
131212
+ const compressed = (eachTextureAttributes[textureAttrBaseIdx + 0] === 1);
131213
+ const mediaType = eachTextureAttributes[textureAttrBaseIdx + 1];
131214
+ eachTextureAttributes[textureAttrBaseIdx + 2];
131215
+ eachTextureAttributes[textureAttrBaseIdx + 3];
131216
+ const minFilter = eachTextureAttributes[textureAttrBaseIdx + 4];
131217
+ const magFilter = eachTextureAttributes[textureAttrBaseIdx + 5]; // LinearFilter | NearestFilter
131218
+ const wrapS = eachTextureAttributes[textureAttrBaseIdx + 6]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
131219
+ const wrapT = eachTextureAttributes[textureAttrBaseIdx + 7]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
131220
+ const wrapR = eachTextureAttributes[textureAttrBaseIdx + 8]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
131221
+
131222
+ if (textureDataPortionExists) {
131223
+
131224
+ const imageDataSubarray = new Uint8Array(textureData.subarray(textureDataPortionStart, textureDataPortionEnd));
131225
+ const arrayBuffer = imageDataSubarray.buffer;
131226
+ const textureId = `${modelPartId}-texture-${textureIndex}`;
131227
+
131228
+ if (compressed) {
131229
+
131230
+ sceneModel.createTexture({
131231
+ id: textureId,
131232
+ buffers: [arrayBuffer],
131233
+ minFilter,
131234
+ magFilter,
131235
+ wrapS,
131236
+ wrapT,
131237
+ wrapR
131238
+ });
131239
+
131240
+ } else {
131241
+
131242
+ const mimeType = mediaType === JPEGMediaType ? "image/jpeg" : (mediaType === PNGMediaType ? "image/png" : "image/gif");
131243
+ const blob = new Blob([arrayBuffer], {type: mimeType});
131244
+ const urlCreator = window.URL || window.webkitURL;
131245
+ const imageUrl = urlCreator.createObjectURL(blob);
131246
+ const img = document.createElement('img');
131247
+ img.src = imageUrl;
131248
+
131249
+ sceneModel.createTexture({
131250
+ id: textureId,
131251
+ image: img,
131252
+ //mediaType,
131253
+ minFilter,
131254
+ magFilter,
131255
+ wrapS,
131256
+ wrapT,
131257
+ wrapR
131258
+ });
131259
+ }
131260
+ }
131261
+ }
131262
+
131263
+ // Create texture sets
131264
+
131265
+ for (let textureSetIndex = 0; textureSetIndex < numTextureSets; textureSetIndex++) {
131266
+ const eachTextureSetTexturesIndex = textureSetIndex * 5;
131267
+ const textureSetId = `${modelPartId}-textureSet-${textureSetIndex}`;
131268
+ const colorTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 0];
131269
+ const metallicRoughnessTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 1];
131270
+ const normalsTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 2];
131271
+ const emissiveTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 3];
131272
+ const occlusionTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 4];
131273
+ sceneModel.createTextureSet({
131274
+ id: textureSetId,
131275
+ colorTextureId: colorTextureIndex >= 0 ? `${modelPartId}-texture-${colorTextureIndex}` : null,
131276
+ normalsTextureId: normalsTextureIndex >= 0 ? `${modelPartId}-texture-${normalsTextureIndex}` : null,
131277
+ metallicRoughnessTextureId: metallicRoughnessTextureIndex >= 0 ? `${modelPartId}-texture-${metallicRoughnessTextureIndex}` : null,
131278
+ emissiveTextureId: emissiveTextureIndex >= 0 ? `${modelPartId}-texture-${emissiveTextureIndex}` : null,
131279
+ occlusionTextureId: occlusionTextureIndex >= 0 ? `${modelPartId}-texture-${occlusionTextureIndex}` : null
131280
+ });
131281
+ }
131282
+
131283
+ // Count instances of each geometry
131284
+
131285
+ const geometryReuseCounts = new Uint32Array(numGeometries);
131286
+
131287
+ for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {
131288
+ const geometryIndex = eachMeshGeometriesPortion[meshIndex];
131289
+ if (geometryReuseCounts[geometryIndex] !== undefined) {
131290
+ geometryReuseCounts[geometryIndex]++;
131291
+ } else {
131292
+ geometryReuseCounts[geometryIndex] = 1;
131293
+ }
131294
+ }
131295
+
131296
+ // Iterate over tiles
131297
+
131298
+ const tileCenter = math.vec3();
131299
+ const rtcAABB = math.AABB3();
131300
+
131301
+ const geometryArraysCache = {};
131302
+
131303
+ for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {
131304
+
131305
+ const lastTileIndex = (numTiles - 1);
131306
+
131307
+ const atLastTile = (tileIndex === lastTileIndex);
131308
+
131309
+ const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];
131310
+ const lastTileEntityIndex = atLastTile ? (numEntities - 1) : (eachTileEntitiesPortion[tileIndex + 1] - 1);
131311
+
131312
+ const tileAABBIndex = tileIndex * 6;
131313
+ const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);
131314
+
131315
+ math.getAABB3Center(tileAABB, tileCenter);
131316
+
131317
+ rtcAABB[0] = tileAABB[0] - tileCenter[0];
131318
+ rtcAABB[1] = tileAABB[1] - tileCenter[1];
131319
+ rtcAABB[2] = tileAABB[2] - tileCenter[2];
131320
+ rtcAABB[3] = tileAABB[3] - tileCenter[0];
131321
+ rtcAABB[4] = tileAABB[4] - tileCenter[1];
131322
+ rtcAABB[5] = tileAABB[5] - tileCenter[2];
131323
+
131324
+ const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);
131325
+
131326
+ const geometryCreatedInTile = {};
131327
+
131328
+ // Iterate over each tile's entities
131329
+
131330
+ for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex <= lastTileEntityIndex; tileEntityIndex++) {
131331
+
131332
+ const xktEntityId = eachEntityId[tileEntityIndex];
131333
+
131334
+ const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
131335
+
131336
+ const finalTileEntityIndex = (numEntities - 1);
131337
+ const atLastTileEntity = (tileEntityIndex === finalTileEntityIndex);
131338
+ const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];
131339
+ const lastMeshIndex = atLastTileEntity ? (eachMeshGeometriesPortion.length - 1) : (eachEntityMeshesPortion[tileEntityIndex + 1] - 1);
131340
+
131341
+ const meshIds = [];
131342
+
131343
+ const metaObject = viewer.metaScene.metaObjects[entityId];
131344
+ const entityDefaults = {};
131345
+ const meshDefaults = {};
131346
+
131347
+ if (metaObject) {
131348
+
131349
+ // Mask loading of object types
131350
+
131351
+ if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
131352
+ continue;
131353
+ }
131354
+
131355
+ if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
131356
+ continue;
131357
+ }
131358
+
131359
+ // Get initial property values for object types
131360
+
131361
+ const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
131362
+
131363
+ if (props) {
131364
+ if (props.visible === false) {
131365
+ entityDefaults.visible = false;
131366
+ }
131367
+ if (props.pickable === false) {
131368
+ entityDefaults.pickable = false;
131369
+ }
131370
+ if (props.colorize) {
131371
+ meshDefaults.color = props.colorize;
131372
+ }
131373
+ if (props.opacity !== undefined && props.opacity !== null) {
131374
+ meshDefaults.opacity = props.opacity;
131375
+ }
131376
+ if (props.metallic !== undefined && props.metallic !== null) {
131377
+ meshDefaults.metallic = props.metallic;
131378
+ }
131379
+ if (props.roughness !== undefined && props.roughness !== null) {
131380
+ meshDefaults.roughness = props.roughness;
131381
+ }
131382
+ }
131383
+
131384
+ } else {
131385
+ if (options.excludeUnclassifiedObjects) {
131386
+ continue;
131387
+ }
131388
+ }
131389
+
131390
+ // Iterate each entity's meshes
131391
+
131392
+ for (let meshIndex = firstMeshIndex; meshIndex <= lastMeshIndex; meshIndex++) {
131393
+
131394
+ const geometryIndex = eachMeshGeometriesPortion[meshIndex];
131395
+ const geometryReuseCount = geometryReuseCounts[geometryIndex];
131396
+ const isReusedGeometry = (geometryReuseCount > 1);
131397
+
131398
+ const atLastGeometry = (geometryIndex === (numGeometries - 1));
131399
+
131400
+ const textureSetIndex = eachMeshTextureSet[meshIndex];
131401
+
131402
+ const textureSetId = (textureSetIndex >= 0) ? `${modelPartId}-textureSet-${textureSetIndex}` : null;
131403
+
131404
+ const meshColor = decompressColor$1(eachMeshMaterialAttributes.subarray((meshIndex * 6), (meshIndex * 6) + 3));
131405
+ const meshOpacity = eachMeshMaterialAttributes[(meshIndex * 6) + 3] / 255.0;
131406
+ const meshMetallic = eachMeshMaterialAttributes[(meshIndex * 6) + 4] / 255.0;
131407
+ const meshRoughness = eachMeshMaterialAttributes[(meshIndex * 6) + 5] / 255.0;
131408
+
131409
+ const meshId = manifestCtx.getNextId();
131410
+
131411
+ if (isReusedGeometry) {
131412
+
131413
+ // Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
131414
+
131415
+ const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];
131416
+ const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);
131417
+
131418
+ const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel
131419
+
131420
+ let geometryArrays = geometryArraysCache[geometryId];
131421
+
131422
+ if (!geometryArrays) {
131423
+ geometryArrays = {
131424
+ batchThisMesh: (!options.reuseGeometries)
131425
+ };
131426
+ const primitiveType = eachGeometryPrimitiveType[geometryIndex];
131427
+ let geometryValid = false;
131428
+ switch (primitiveType) {
131429
+ case 0:
131430
+ geometryArrays.primitiveName = "solid";
131431
+ geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131432
+ geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
131433
+ geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
131434
+ geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131435
+ geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
131436
+ geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
131437
+ break;
131438
+ case 1:
131439
+ geometryArrays.primitiveName = "surface";
131440
+ geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131441
+ geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
131442
+ geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
131443
+ geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131444
+ geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
131445
+ geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
131446
+ break;
131447
+ case 2:
131448
+ geometryArrays.primitiveName = "points";
131449
+ geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131450
+ geometryArrays.geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);
131451
+ geometryValid = (geometryArrays.geometryPositions.length > 0);
131452
+ break;
131453
+ case 3:
131454
+ geometryArrays.primitiveName = "lines";
131455
+ geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131456
+ geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131457
+ geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
131458
+ break;
131459
+ case 4:
131460
+ geometryArrays.primitiveName = "lines";
131461
+ geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131462
+ geometryArrays.geometryIndices = lineStripToLines$1(
131463
+ geometryArrays.geometryPositions,
131464
+ indices.subarray(eachGeometryIndicesPortion [geometryIndex],
131465
+ atLastGeometry
131466
+ ? indices.length
131467
+ : eachGeometryIndicesPortion [geometryIndex + 1]));
131468
+ geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
131469
+ break;
131470
+ default:
131471
+ continue;
131472
+ }
131473
+
131474
+ if (!geometryValid) {
131475
+ geometryArrays = null;
131476
+ }
131477
+
131478
+ if (geometryArrays) {
131479
+ if (geometryArrays.geometryPositions.length > 1000) ;
131480
+ if (geometryArrays.batchThisMesh) {
131481
+ geometryArrays.decompressedPositions = new Float32Array(geometryArrays.geometryPositions.length);
131482
+ geometryArrays.transformedAndRecompressedPositions = new Uint16Array(geometryArrays.geometryPositions.length);
131483
+ const geometryPositions = geometryArrays.geometryPositions;
131484
+ const decompressedPositions = geometryArrays.decompressedPositions;
131485
+ for (let i = 0, len = geometryPositions.length; i < len; i += 3) {
131486
+ decompressedPositions[i + 0] = geometryPositions[i + 0] * reusedGeometriesDecodeMatrix[0] + reusedGeometriesDecodeMatrix[12];
131487
+ decompressedPositions[i + 1] = geometryPositions[i + 1] * reusedGeometriesDecodeMatrix[5] + reusedGeometriesDecodeMatrix[13];
131488
+ decompressedPositions[i + 2] = geometryPositions[i + 2] * reusedGeometriesDecodeMatrix[10] + reusedGeometriesDecodeMatrix[14];
131489
+ }
131490
+ geometryArrays.geometryPositions = null;
131491
+ geometryArraysCache[geometryId] = geometryArrays;
131492
+ }
131493
+ }
131494
+ }
131495
+
131496
+ if (geometryArrays) {
131497
+
131498
+ if (geometryArrays.batchThisMesh) {
131499
+
131500
+ const decompressedPositions = geometryArrays.decompressedPositions;
131501
+ const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;
131502
+
131503
+ for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
131504
+ tempVec4a$1[0] = decompressedPositions[i + 0];
131505
+ tempVec4a$1[1] = decompressedPositions[i + 1];
131506
+ tempVec4a$1[2] = decompressedPositions[i + 2];
131507
+ tempVec4a$1[3] = 1;
131508
+ math.transformVec4(meshMatrix, tempVec4a$1, tempVec4b$1);
131509
+ geometryCompressionUtils.compressPosition(tempVec4b$1, rtcAABB, tempVec4a$1);
131510
+ transformedAndRecompressedPositions[i + 0] = tempVec4a$1[0];
131511
+ transformedAndRecompressedPositions[i + 1] = tempVec4a$1[1];
131512
+ transformedAndRecompressedPositions[i + 2] = tempVec4a$1[2];
131513
+ }
131514
+
131515
+ sceneModel.createMesh(utils.apply(meshDefaults, {
131516
+ id: meshId,
131517
+ textureSetId,
131518
+ origin: tileCenter,
131519
+ primitive: geometryArrays.primitiveName,
131520
+ positionsCompressed: transformedAndRecompressedPositions,
131521
+ normalsCompressed: geometryArrays.geometryNormals,
131522
+ uv: geometryArrays.geometryUVs,
131523
+ colorsCompressed: geometryArrays.geometryColors,
131524
+ indices: geometryArrays.geometryIndices,
131525
+ edgeIndices: geometryArrays.geometryEdgeIndices,
131526
+ positionsDecodeMatrix: tileDecodeMatrix,
131527
+ color: meshColor,
131528
+ metallic: meshMetallic,
131529
+ roughness: meshRoughness,
131530
+ opacity: meshOpacity
131531
+ }));
131532
+
131533
+ meshIds.push(meshId);
131534
+
131535
+ } else {
131536
+
131537
+ if (!geometryCreatedInTile[geometryId]) {
131538
+
131539
+ sceneModel.createGeometry({
131540
+ id: geometryId,
131541
+ primitive: geometryArrays.primitiveName,
131542
+ positionsCompressed: geometryArrays.geometryPositions,
131543
+ normalsCompressed: geometryArrays.geometryNormals,
131544
+ uv: geometryArrays.geometryUVs,
131545
+ colorsCompressed: geometryArrays.geometryColors,
131546
+ indices: geometryArrays.geometryIndices,
131547
+ edgeIndices: geometryArrays.geometryEdgeIndices,
131548
+ positionsDecodeMatrix: reusedGeometriesDecodeMatrix
131549
+ });
131550
+
131551
+ geometryCreatedInTile[geometryId] = true;
131552
+ }
131553
+
131554
+ sceneModel.createMesh(utils.apply(meshDefaults, {
131555
+ id: meshId,
131556
+ geometryId,
131557
+ textureSetId,
131558
+ matrix: meshMatrix,
131559
+ color: meshColor,
131560
+ metallic: meshMetallic,
131561
+ roughness: meshRoughness,
131562
+ opacity: meshOpacity,
131563
+ origin: tileCenter
131564
+ }));
131565
+
131566
+ meshIds.push(meshId);
131567
+ }
131568
+ }
131569
+
131570
+ } else { // Do not reuse geometry
131571
+
131572
+ const primitiveType = eachGeometryPrimitiveType[geometryIndex];
131573
+
131574
+ let primitiveName;
131575
+ let geometryPositions;
131576
+ let geometryNormals;
131577
+ let geometryUVs;
131578
+ let geometryColors;
131579
+ let geometryIndices;
131580
+ let geometryEdgeIndices;
131581
+ let geometryValid = false;
131582
+
131583
+ switch (primitiveType) {
131584
+ case 0:
131585
+ primitiveName = "solid";
131586
+ geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131587
+ geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
131588
+ geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
131589
+ geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131590
+ geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
131591
+ geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
131592
+ break;
131593
+ case 1:
131594
+ primitiveName = "surface";
131595
+ geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131596
+ geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
131597
+ geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
131598
+ geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131599
+ geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
131600
+ geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
131601
+ break;
131602
+ case 2:
131603
+ primitiveName = "points";
131604
+ geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131605
+ geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);
131606
+ geometryValid = (geometryPositions.length > 0);
131607
+ break;
131608
+ case 3:
131609
+ primitiveName = "lines";
131610
+ geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131611
+ geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
131612
+ geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
131613
+ break;
131614
+ case 4:
131615
+ primitiveName = "lines";
131616
+ geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
131617
+ geometryIndices = lineStripToLines$1(
131618
+ geometryPositions,
131619
+ indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry
131620
+ ? indices.length
131621
+ : eachGeometryIndicesPortion [geometryIndex + 1]));
131622
+ geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
131623
+ break;
131624
+ default:
131625
+ continue;
131626
+ }
131627
+
131628
+ if (geometryValid) {
131629
+
131630
+ sceneModel.createMesh(utils.apply(meshDefaults, {
131631
+ id: meshId,
131632
+ textureSetId,
131633
+ origin: tileCenter,
131634
+ primitive: primitiveName,
131635
+ positionsCompressed: geometryPositions,
131636
+ normalsCompressed: geometryNormals,
131637
+ uv: geometryUVs && geometryUVs.length > 0 ? geometryUVs : null,
131638
+ colorsCompressed: geometryColors,
131639
+ indices: geometryIndices,
131640
+ edgeIndices: geometryEdgeIndices,
131641
+ positionsDecodeMatrix: tileDecodeMatrix,
131642
+ color: meshColor,
131643
+ metallic: meshMetallic,
131644
+ roughness: meshRoughness,
131645
+ opacity: meshOpacity
131646
+ }));
131647
+
131648
+ meshIds.push(meshId);
131649
+ }
131650
+ }
131651
+ }
131652
+
131653
+ if (meshIds.length > 0) {
131654
+
131655
+ sceneModel.createEntity(utils.apply(entityDefaults, {
131656
+ id: entityId,
131657
+ isObject: true,
131658
+ meshIds: meshIds
131659
+ }));
131660
+ }
131661
+ }
131662
+ }
131663
+ }
131664
+
131665
+ function lineStripToLines$1(positions, indices) {
131666
+ const linesIndices = [];
131667
+ if (indices.length > 1) {
131668
+ for (let i = 0, len = indices.length - 1; i < len; i++) {
131669
+ linesIndices.push(indices[i]);
131670
+ linesIndices.push(indices[i + 1]);
131671
+ }
131672
+ } else if (positions.length > 1) {
131673
+ for (let i = 0, len = (positions.length / 3) - 1; i < len; i++) {
131674
+ linesIndices.push(i);
131675
+ linesIndices.push(i + 1);
131676
+ }
131677
+ }
131678
+ return linesIndices;
131679
+ }
131680
+
131681
+ /** @private */
131682
+ const ParserV10 = {
131683
+ version: 10,
131684
+ parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
131685
+ const deflatedData = extract(elements);
131686
+ const inflatedData = inflate(deflatedData);
131687
+ load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
131688
+ }
131689
+ };
131690
+
131691
+ /*
131692
+ Parser for .XKT Format V11
131693
+ */
131694
+
131695
+ const tempVec4a = math.vec4();
131696
+ const tempVec4b = math.vec4();
131697
+
131698
+ const NUM_TEXTURE_ATTRIBUTES = 9;
131699
+
131700
+ function decodeData(arrayBuffer) {
131701
+ const requiresSwapFromLittleEndian = (function() {
131702
+ const buffer = new ArrayBuffer(2);
131703
+ new Uint16Array(buffer)[0] = 1;
131704
+ return new Uint8Array(buffer)[0] !== 1;
131705
+ })();
131706
+
131707
+ const nextArray = (function() {
131708
+ let i = 0;
131709
+ const dataView = new DataView(arrayBuffer);
131710
+ return function(type) {
131711
+ const idx = 1 + 2 * i++; // `1' for the version nr
131712
+ const byteOffset = dataView.getUint32(idx * 4, true);
131713
+ const byteLength = dataView.getUint32((idx + 1) * 4, true);
131714
+
131715
+ const BPE = type.BYTES_PER_ELEMENT;
131716
+ if (requiresSwapFromLittleEndian && (BPE > 1)) {
131717
+ const subarray = new Uint8Array(arrayBuffer, byteOffset, byteLength);
131718
+ const swaps = BPE / 2;
131719
+ const cnt = subarray.length / BPE;
131720
+ for (let b = 0; b < cnt; b++) {
131721
+ const offset = b * BPE;
131722
+ for (let j = 0; j < swaps; j++) {
131723
+ const i1 = offset + j;
131724
+ const i2 = offset - j + BPE - 1;
131725
+ const tmp = subarray[i1];
131726
+ subarray[i1] = subarray[i2];
131727
+ subarray[i2] = tmp;
131728
+ }
131729
+ }
131730
+ }
131731
+
131732
+ return new type(arrayBuffer, byteOffset, byteLength / BPE);
131733
+ };
131734
+ })();
131735
+
131736
+ const nextObject = (function() {
131737
+ const decoder = new TextDecoder();
131738
+ return () => JSON.parse(decoder.decode(nextArray(Uint8Array)));
131739
+ })();
131740
+
131741
+ return {
131742
+ metadata: nextObject(),
131743
+ textureData: nextArray(Uint8Array), // <<----------------------------- ??? ZIPPing to blame?
131744
+ eachTextureDataPortion: nextArray(Uint32Array),
131745
+ eachTextureAttributes: nextArray(Uint16Array),
131746
+ positions: nextArray(Uint16Array),
131747
+ normals: nextArray(Int8Array),
131748
+ colors: nextArray(Uint8Array),
131749
+ uvs: nextArray(Float32Array),
131750
+ indices: nextArray(Uint32Array),
131751
+ edgeIndices: nextArray(Uint32Array),
131752
+ eachTextureSetTextures: nextArray(Int32Array),
131753
+ matrices: nextArray(Float32Array),
131754
+ reusedGeometriesDecodeMatrix: nextArray(Float32Array),
131755
+ eachGeometryPrimitiveType: nextArray(Uint8Array),
131756
+ eachGeometryPositionsPortion: nextArray(Uint32Array),
131757
+ eachGeometryNormalsPortion: nextArray(Uint32Array),
131758
+ eachGeometryColorsPortion: nextArray(Uint32Array),
131759
+ eachGeometryUVsPortion: nextArray(Uint32Array),
131760
+ eachGeometryIndicesPortion: nextArray(Uint32Array),
131761
+ eachGeometryEdgeIndicesPortion: nextArray(Uint32Array),
131762
+ eachMeshGeometriesPortion: nextArray(Uint32Array),
131763
+ eachMeshMatricesPortion: nextArray(Uint32Array),
131764
+ eachMeshTextureSet: nextArray(Int32Array), // Can be -1
131765
+ eachMeshMaterialAttributes: nextArray(Uint8Array),
131766
+ eachEntityId: nextObject(),
131767
+ eachEntityMeshesPortion: nextArray(Uint32Array),
131768
+ eachTileAABB: nextArray(Float64Array),
131769
+ eachTileEntitiesPortion: nextArray(Uint32Array),
131770
+ };
131771
+ }
131772
+
131109
131773
  const decompressColor = (function () {
131110
131774
  const floatColor = new Float32Array(3);
131111
131775
  return function (intColor) {
@@ -131657,11 +132321,15 @@ function lineStripToLines(positions, indices) {
131657
132321
  }
131658
132322
 
131659
132323
  /** @private */
131660
- const ParserV10 = {
131661
- version: 10,
131662
- parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
131663
- const deflatedData = extract(elements);
131664
- const inflatedData = inflate(deflatedData);
132324
+ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
132325
+ // To efficiently create typed arrays from this buffer,
132326
+ // each typed array's source data needs to be aligned with its element byte size.
132327
+ // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
132328
+ // It is a different encoding than used in earlier versions, and requires different approach to parsing elements.
132329
+ const ParserV11 = {
132330
+ version: 11,
132331
+ parseArrayBuffer: function (viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx) {
132332
+ const inflatedData = decodeData(arrayBuffer);
131665
132333
  load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
131666
132334
  }
131667
132335
  };
@@ -131678,6 +132346,7 @@ parsers[ParserV7.version] = ParserV7;
131678
132346
  parsers[ParserV8.version] = ParserV8;
131679
132347
  parsers[ParserV9.version] = ParserV9;
131680
132348
  parsers[ParserV10.version] = ParserV10;
132349
+ parsers[ParserV11.version] = ParserV11;
131681
132350
 
131682
132351
  /**
131683
132352
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
@@ -132795,6 +133464,12 @@ class XKTLoaderPlugin extends Plugin {
132795
133464
  return;
132796
133465
  }
132797
133466
  // this.log("Loading .xkt V" + xktVersion);
133467
+
133468
+ if (parser.parseArrayBuffer) {
133469
+ parser.parseArrayBuffer(this.viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx);
133470
+ return;
133471
+ }
133472
+
132798
133473
  const numElements = dataView.getUint32(4, true);
132799
133474
  const elements = [];
132800
133475
  let byteOffset = (numElements + 2) * 4;
@@ -139244,7 +139919,6 @@ class DotBIMLoaderPlugin extends Plugin {
139244
139919
  const fileData = ctx.fileData;
139245
139920
  const sceneModel = ctx.sceneModel;
139246
139921
 
139247
- const dbMeshIndices = {};
139248
139922
  const dbMeshLoaded = {};
139249
139923
 
139250
139924
  const ifcProjectId = math.createUUID();
@@ -139282,17 +139956,14 @@ class DotBIMLoaderPlugin extends Plugin {
139282
139956
  propertySets: []
139283
139957
  };
139284
139958
 
139285
- for (let i = 0, len = fileData.meshes.length; i < len; i++) {
139286
- const dbMesh = fileData.meshes[i];
139287
- dbMeshIndices[dbMesh.mesh_id] = i;
139288
- }
139289
-
139290
- const parseDBMesh = (dbMeshId) => {
139959
+ const parseDBMesh = (dbMeshId, element) => {
139291
139960
  if (dbMeshLoaded[dbMeshId]) {
139292
139961
  return;
139293
139962
  }
139294
- const dbMeshIndex = dbMeshIndices[dbMeshId];
139295
- const dbMesh = fileData.meshes[dbMeshIndex];
139963
+
139964
+ const dbMesh = fileData.meshes.find(obj => {
139965
+ return obj.mesh_id === element.mesh_id;
139966
+ });
139296
139967
  sceneModel.createGeometry({
139297
139968
  id: dbMeshId,
139298
139969
  primitive: "triangles",
@@ -139331,7 +140002,7 @@ class DotBIMLoaderPlugin extends Plugin {
139331
140002
 
139332
140003
  if (element.face_colors === undefined) {
139333
140004
 
139334
- parseDBMesh(dbMeshId);
140005
+ parseDBMesh(dbMeshId, element);
139335
140006
 
139336
140007
  const meshId = `${objectId}-mesh`;
139337
140008
 
@@ -139374,7 +140045,9 @@ class DotBIMLoaderPlugin extends Plugin {
139374
140045
  let faceColors = element.face_colors;
139375
140046
  let coloredTrianglesDictionary = {};
139376
140047
  let currentTriangleIndicesCount = 0;
139377
- let dbMesh = fileData.meshes[element.mesh_id];
140048
+ let dbMesh = fileData.meshes.find(obj => {
140049
+ return obj.mesh_id === element.mesh_id;
140050
+ });
139378
140051
  for (let i = 0, len = faceColors.length; i < len; i+=4) {
139379
140052
  let faceColor = [faceColors[i], faceColors[i+1], faceColors[i+2], faceColors[i+3]];
139380
140053
  if (coloredTrianglesDictionary[faceColor] === undefined) {
@@ -139860,7 +140533,7 @@ const mousePointSelector = function(viewer, ray2WorldPos) {
139860
140533
  const copyCanvasPos = (event, vec2) => {
139861
140534
  vec2[0] = event.clientX;
139862
140535
  vec2[1] = event.clientY;
139863
- transformToNode(canvas.ownerDocument.body, canvas, vec2);
140536
+ transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
139864
140537
  return vec2;
139865
140538
  };
139866
140539
 
@@ -139935,7 +140608,7 @@ const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
139935
140608
  const copyCanvasPos = (event, vec2) => {
139936
140609
  vec2[0] = event.clientX;
139937
140610
  vec2[1] = event.clientY;
139938
- transformToNode(canvas.ownerDocument.body, canvas, vec2);
140611
+ transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
139939
140612
  return vec2;
139940
140613
  };
139941
140614
 
@@ -141229,7 +141902,7 @@ class ZoneTranslateControl extends Component {
141229
141902
  const copyCanvasPos = (event, vec2) => {
141230
141903
  vec2[0] = event.clientX;
141231
141904
  vec2[1] = event.clientY;
141232
- transformToNode(canvas.ownerDocument.body, canvas, vec2);
141905
+ transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
141233
141906
  return vec2;
141234
141907
  };
141235
141908