@xeokit/xeokit-sdk 2.6.65 → 2.6.66

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.
@@ -1307,7 +1307,7 @@ class PointerLens {
1307
1307
  let doublePrecision = true;
1308
1308
  let FloatArrayType = doublePrecision ? Float64Array : Float32Array;
1309
1309
 
1310
- const tempVec3a$N = new FloatArrayType(3);
1310
+ const tempVec3a$O = new FloatArrayType(3);
1311
1311
 
1312
1312
  const tempMat1 = new FloatArrayType(16);
1313
1313
  const tempMat2 = new FloatArrayType(16);
@@ -6677,10 +6677,10 @@ math.buildEdgeIndices = (function () {
6677
6677
  */
6678
6678
  math.planeClipsPositions3 = function (pos, dir, positions, numElementsPerPosition = 3) {
6679
6679
  for (let i = 0, len = positions.length; i < len; i += numElementsPerPosition) {
6680
- tempVec3a$N[0] = positions[i + 0] - pos[0];
6681
- tempVec3a$N[1] = positions[i + 1] - pos[1];
6682
- tempVec3a$N[2] = positions[i + 2] - pos[2];
6683
- let dotProduct = tempVec3a$N[0] * dir[0] + tempVec3a$N[1] * dir[1] + tempVec3a$N[2] * dir[2];
6680
+ tempVec3a$O[0] = positions[i + 0] - pos[0];
6681
+ tempVec3a$O[1] = positions[i + 1] - pos[1];
6682
+ tempVec3a$O[2] = positions[i + 2] - pos[2];
6683
+ let dotProduct = tempVec3a$O[0] * dir[0] + tempVec3a$O[1] * dir[1] + tempVec3a$O[2] * dir[2];
6684
6684
  if (dotProduct < 0) {
6685
6685
  return true;
6686
6686
  }
@@ -8560,8 +8560,8 @@ class Component {
8560
8560
  }
8561
8561
  }
8562
8562
 
8563
- const tempVec3a$M = math.vec3();
8564
- const tempVec3b$A = math.vec3();
8563
+ const tempVec3a$N = math.vec3();
8564
+ const tempVec3b$B = math.vec3();
8565
8565
  const tempMat4a$s = math.mat4();
8566
8566
 
8567
8567
  /**
@@ -8638,8 +8638,8 @@ function frustumIntersectsAABB3(frustum, aabb) {
8638
8638
 
8639
8639
  let ret = Frustum$1.INSIDE;
8640
8640
 
8641
- const min = tempVec3a$M;
8642
- const max = tempVec3b$A;
8641
+ const min = tempVec3a$N;
8642
+ const max = tempVec3b$B;
8643
8643
 
8644
8644
  min[0] = aabb[0];
8645
8645
  min[1] = aabb[1];
@@ -9274,7 +9274,7 @@ class PointerCircle {
9274
9274
  }
9275
9275
 
9276
9276
  /**
9277
- * Stop the shricking circle and hide it.
9277
+ * Stop the shrinking circle and hide it.
9278
9278
  */
9279
9279
  stop() {
9280
9280
  if (this._destroyed) {
@@ -10258,7 +10258,7 @@ class Wire {
10258
10258
  }
10259
10259
  }
10260
10260
 
10261
- const tempVec3a$L = math.vec3();
10261
+ const tempVec3a$M = math.vec3();
10262
10262
  const tempVec4$1 = math.vec4();
10263
10263
 
10264
10264
  /**
@@ -10339,7 +10339,7 @@ function worldToRTCPos(worldPos, rtcCenter, rtcPos) {
10339
10339
  */
10340
10340
  function worldToRTCPositions(worldPositions, rtcPositions, rtcCenter, cellSize = 1000) {
10341
10341
 
10342
- const center = math.getPositionsCenter(worldPositions, tempVec3a$L);
10342
+ const center = math.getPositionsCenter(worldPositions, tempVec3a$M);
10343
10343
 
10344
10344
  const rtcCenterX = Math.round(center[0] / cellSize) * cellSize;
10345
10345
  const rtcCenterY = Math.round(center[1] / cellSize) * cellSize;
@@ -10393,7 +10393,7 @@ function getPlaneRTCPos(dist, dir, rtcOrigin, rtcPlanePos, originMatrix) {
10393
10393
  ? (tempVec4$1.set(rtcOrigin, 0), tempVec4$1[3] = 1, math.mulMat4v4(originMatrix, tempVec4$1, tempVec4$1))
10394
10394
  : rtcOrigin);
10395
10395
  const rtcCenterToPlaneDist = math.dotVec3(dir, rtcCenter) + dist;
10396
- const dirNormalized = math.normalizeVec3(dir, tempVec3a$L);
10396
+ const dirNormalized = math.normalizeVec3(dir, tempVec3a$M);
10397
10397
  math.mulVec3Scalar(dirNormalized, -rtcCenterToPlaneDist, rtcPlanePos);
10398
10398
  return rtcPlanePos;
10399
10399
  }
@@ -11181,7 +11181,7 @@ class SceneModelEntity {
11181
11181
  }
11182
11182
  }
11183
11183
 
11184
- const tempVec4a$b = math.vec4();
11184
+ const tempVec4a$c = math.vec4();
11185
11185
  const tempVec4b$7 = math.vec4();
11186
11186
 
11187
11187
 
@@ -11341,9 +11341,9 @@ class Marker extends Component {
11341
11341
  this.fire("viewPos", this._viewPos);
11342
11342
  }
11343
11343
  if (this._canvasPosDirty) {
11344
- tempVec4a$b.set(this._viewPos);
11345
- tempVec4a$b[3] = 1.0;
11346
- math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$b, tempVec4b$7);
11344
+ tempVec4a$c.set(this._viewPos);
11345
+ tempVec4a$c[3] = 1.0;
11346
+ math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$c, tempVec4b$7);
11347
11347
  const aabb = this.scene.canvas.boundary;
11348
11348
  this._canvasPos[0] = Math.floor((1 + tempVec4b$7[0] / tempVec4b$7[3]) * aabb[2] / 2);
11349
11349
  this._canvasPos[1] = Math.floor((1 - tempVec4b$7[1] / tempVec4b$7[3]) * aabb[3] / 2);
@@ -14738,8 +14738,8 @@ class AngleMeasurementEditTouchControl extends AngleMeasurementEditControl {
14738
14738
  }
14739
14739
  }
14740
14740
 
14741
- const tempVec3a$K = math.vec3();
14742
- const tempVec3b$z = math.vec3();
14741
+ const tempVec3a$L = math.vec3();
14742
+ const tempVec3b$A = math.vec3();
14743
14743
  const tempVec3c$v = math.vec3();
14744
14744
 
14745
14745
  /**
@@ -14988,9 +14988,9 @@ class Annotation extends Marker {
14988
14988
  if (!pickResult.worldPos || !pickResult.worldNormal) {
14989
14989
  this.error("Param 'pickResult' does not have both worldPos and worldNormal");
14990
14990
  } else {
14991
- const normalizedWorldNormal = math.normalizeVec3(pickResult.worldNormal, tempVec3a$K);
14991
+ const normalizedWorldNormal = math.normalizeVec3(pickResult.worldNormal, tempVec3a$L);
14992
14992
  const offset = (this.plugin && this.plugin.surfaceOffset) || 0;
14993
- const offsetVec = math.mulVec3Scalar(normalizedWorldNormal, offset, tempVec3b$z);
14993
+ const offsetVec = math.mulVec3Scalar(normalizedWorldNormal, offset, tempVec3b$A);
14994
14994
  const offsetWorldPos = math.addVec3(pickResult.worldPos, offsetVec, tempVec3c$v);
14995
14995
  this.entity = pickResult.entity;
14996
14996
  this.worldPos = offsetWorldPos;
@@ -17860,7 +17860,7 @@ class OcclusionLayer {
17860
17860
  const MARKER_COLOR = math.vec3([1.0, 0.0, 0.0]);
17861
17861
  const POINT_SIZE = 20;
17862
17862
 
17863
- const tempVec3a$J = math.vec3();
17863
+ const tempVec3a$K = math.vec3();
17864
17864
 
17865
17865
  /**
17866
17866
  * Manages occlusion testing. Private member of a Renderer.
@@ -18199,7 +18199,7 @@ class OcclusionTester {
18199
18199
  gl.uniform1i(sectionPlaneUniforms.active, active ? 1 : 0);
18200
18200
  if (active) {
18201
18201
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
18202
- gl.uniform3fv(sectionPlaneUniforms.pos, getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$J));
18202
+ gl.uniform3fv(sectionPlaneUniforms.pos, getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$K));
18203
18203
  gl.uniform3fv(sectionPlaneUniforms.dir, sectionPlane.dir);
18204
18204
  }
18205
18205
  }
@@ -20299,6 +20299,9 @@ const Renderer$1 = function (scene, options) {
20299
20299
  pickProjMatrix = scene.camera.projMatrix;
20300
20300
  projection = scene.camera.projection;
20301
20301
 
20302
+ nearAndFar[0] = scene.camera.project.near;
20303
+ nearAndFar[1] = scene.camera.project.far;
20304
+
20302
20305
  pickResult.canvasPos = params.canvasPos;
20303
20306
 
20304
20307
  } else {
@@ -20312,6 +20315,9 @@ const Renderer$1 = function (scene, options) {
20312
20315
  pickProjMatrix = scene.camera.projMatrix;
20313
20316
  projection = scene.camera.projection;
20314
20317
 
20318
+ nearAndFar[0] = scene.camera.project.near;
20319
+ nearAndFar[1] = scene.camera.project.far;
20320
+
20315
20321
  } else {
20316
20322
 
20317
20323
  worldRayOrigin.set(params.origin || [0, 0, 0]);
@@ -20331,6 +20337,9 @@ const Renderer$1 = function (scene, options) {
20331
20337
  pickProjMatrix = scene.camera.ortho.matrix;
20332
20338
  projection = "ortho";
20333
20339
 
20340
+ nearAndFar[0] = scene.camera.ortho.near;
20341
+ nearAndFar[1] = scene.camera.ortho.far;
20342
+
20334
20343
  pickResult.origin = worldRayOrigin;
20335
20344
  pickResult.direction = worldRayDir;
20336
20345
  }
@@ -20385,9 +20394,6 @@ const Renderer$1 = function (scene, options) {
20385
20394
 
20386
20395
  if (pickable.canPickWorldPos && pickable.canPickWorldPos()) {
20387
20396
 
20388
- nearAndFar[0] = scene.camera.project.near;
20389
- nearAndFar[1] = scene.camera.project.far;
20390
-
20391
20397
  gpuPickWorldPos(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, nearAndFar, pickResult);
20392
20398
 
20393
20399
  if (params.pickSurfaceNormal !== false) {
@@ -23805,12 +23811,12 @@ class CustomProjection extends Component {
23805
23811
  }
23806
23812
 
23807
23813
  const tempVec3$6 = math.vec3();
23808
- const tempVec3b$y = math.vec3();
23814
+ const tempVec3b$z = math.vec3();
23809
23815
  const tempVec3c$u = math.vec3();
23810
23816
  const tempVec3d$d = math.vec3();
23811
23817
  const tempVec3e$2 = math.vec3();
23812
23818
  const tempVec3f$2 = math.vec3();
23813
- const tempVec4a$a = math.vec4();
23819
+ const tempVec4a$b = math.vec4();
23814
23820
  const tempVec4b$6 = math.vec4();
23815
23821
  const tempVec4c$2 = math.vec4();
23816
23822
  const tempMat = math.mat4();
@@ -24118,7 +24124,7 @@ class Camera extends Component {
24118
24124
  orbitYaw(angleInc) {
24119
24125
  let lookEyeVec = math.subVec3(this._eye, this._look, tempVec3$6);
24120
24126
  math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
24121
- lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b$y);
24127
+ lookEyeVec = math.transformPoint3(tempMat, lookEyeVec, tempVec3b$z);
24122
24128
  this.eye = math.addVec3(this._look, lookEyeVec, tempVec3c$u); // Set eye position as 'look' plus 'eye' vector
24123
24129
  this.up = math.transformPoint3(tempMat, this._up, tempVec3d$d); // Rotate 'up' vector
24124
24130
  }
@@ -24136,7 +24142,7 @@ class Camera extends Component {
24136
24142
  }
24137
24143
  }
24138
24144
  let eye2 = math.subVec3(this._eye, this._look, tempVec3$6);
24139
- const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b$y), math.normalizeVec3(this._up, tempVec3c$u));
24145
+ const left = math.cross3Vec3(math.normalizeVec3(eye2, tempVec3b$z), math.normalizeVec3(this._up, tempVec3c$u));
24140
24146
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
24141
24147
  eye2 = math.transformPoint3(tempMat, eye2, tempVec3d$d);
24142
24148
  this.up = math.transformPoint3(tempMat, this._up, tempVec3e$2);
@@ -24151,7 +24157,7 @@ class Camera extends Component {
24151
24157
  yaw(angleInc) {
24152
24158
  let look2 = math.subVec3(this._look, this._eye, tempVec3$6);
24153
24159
  math.rotationMat4v(angleInc * 0.0174532925, this._gimbalLock ? this._worldUp : this._up, tempMat);
24154
- look2 = math.transformPoint3(tempMat, look2, tempVec3b$y);
24160
+ look2 = math.transformPoint3(tempMat, look2, tempVec3b$z);
24155
24161
  this.look = math.addVec3(look2, this._eye, tempVec3c$u);
24156
24162
  if (this._gimbalLock) {
24157
24163
  this.up = math.transformPoint3(tempMat, this._up, tempVec3d$d);
@@ -24171,7 +24177,7 @@ class Camera extends Component {
24171
24177
  }
24172
24178
  }
24173
24179
  let look2 = math.subVec3(this._look, this._eye, tempVec3$6);
24174
- const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b$y), math.normalizeVec3(this._up, tempVec3c$u));
24180
+ const left = math.cross3Vec3(math.normalizeVec3(look2, tempVec3b$z), math.normalizeVec3(this._up, tempVec3c$u));
24175
24181
  math.rotationMat4v(angleInc * 0.0174532925, left, tempMat);
24176
24182
  this.up = math.transformPoint3(tempMat, this._up, tempVec3f$2);
24177
24183
  look2 = math.transformPoint3(tempMat, look2, tempVec3d$d);
@@ -24188,7 +24194,7 @@ class Camera extends Component {
24188
24194
  const vec = [0, 0, 0];
24189
24195
  let v;
24190
24196
  if (pan[0] !== 0) {
24191
- const left = math.cross3Vec3(math.normalizeVec3(eye2, []), math.normalizeVec3(this._up, tempVec3b$y));
24197
+ const left = math.cross3Vec3(math.normalizeVec3(eye2, []), math.normalizeVec3(this._up, tempVec3b$z));
24192
24198
  v = math.mulVec3Scalar(left, pan[0]);
24193
24199
  vec[0] += v[0];
24194
24200
  vec[1] += v[1];
@@ -24217,7 +24223,7 @@ class Camera extends Component {
24217
24223
  */
24218
24224
  zoom(delta) {
24219
24225
  const vec = math.subVec3(this._eye, this._look, tempVec3$6);
24220
- const lenLook = Math.abs(math.lenVec3(vec, tempVec3b$y));
24226
+ const lenLook = Math.abs(math.lenVec3(vec, tempVec3b$z));
24221
24227
  const newLenLook = Math.abs(lenLook + delta);
24222
24228
  if (newLenLook < 0.5) {
24223
24229
  return;
@@ -24676,7 +24682,7 @@ class Camera extends Component {
24676
24682
  * @returns {[number, number]} the canvas position
24677
24683
  */
24678
24684
  projectWorldPos(worldPos) {
24679
- const _worldPos = tempVec4a$a;
24685
+ const _worldPos = tempVec4a$b;
24680
24686
  const viewPos = tempVec4b$6;
24681
24687
  const screenPos = tempVec4c$2;
24682
24688
  _worldPos[0] = worldPos[0];
@@ -34761,7 +34767,7 @@ function buildFragmentDraw(mesh) {
34761
34767
  * @author xeolabs / https://github.com/xeolabs
34762
34768
  */
34763
34769
 
34764
- const tempVec3a$I = math.vec3();
34770
+ const tempVec3a$J = math.vec3();
34765
34771
 
34766
34772
  const ids$2 = new Map$1({});
34767
34773
 
@@ -34863,7 +34869,7 @@ DrawRenderer.prototype.drawMesh = function (frameCtx, mesh) {
34863
34869
  if (active) {
34864
34870
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
34865
34871
  if (origin) {
34866
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$I);
34872
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$J);
34867
34873
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
34868
34874
  } else {
34869
34875
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36009,7 +36015,7 @@ function buildFragment$5(mesh) {
36009
36015
 
36010
36016
  const ids$1 = new Map$1({});
36011
36017
 
36012
- const tempVec3a$H = math.vec3();
36018
+ const tempVec3a$I = math.vec3();
36013
36019
 
36014
36020
  /**
36015
36021
  * @private
@@ -36096,7 +36102,7 @@ EmphasisFillRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
36096
36102
  if (active) {
36097
36103
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
36098
36104
  if (origin) {
36099
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$H);
36105
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$I);
36100
36106
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
36101
36107
  } else {
36102
36108
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36440,7 +36446,7 @@ function buildFragment$4(mesh) {
36440
36446
 
36441
36447
  const ids = new Map$1({});
36442
36448
 
36443
- const tempVec3a$G = math.vec3();
36449
+ const tempVec3a$H = math.vec3();
36444
36450
 
36445
36451
  /**
36446
36452
  * @private
@@ -36526,7 +36532,7 @@ EmphasisEdgesRenderer.prototype.drawMesh = function (frameCtx, mesh, mode) {
36526
36532
  if (active) {
36527
36533
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
36528
36534
  if (origin) {
36529
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$G);
36535
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$H);
36530
36536
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
36531
36537
  } else {
36532
36538
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -36839,7 +36845,7 @@ function buildFragment$3(mesh) {
36839
36845
  * @author xeolabs / https://github.com/xeolabs
36840
36846
  */
36841
36847
 
36842
- const tempVec3a$F = math.vec3();
36848
+ const tempVec3a$G = math.vec3();
36843
36849
 
36844
36850
  // No ID, because there is exactly one PickMeshRenderer per scene
36845
36851
 
@@ -36926,7 +36932,7 @@ PickMeshRenderer.prototype.drawMesh = function (frameCtx, mesh) {
36926
36932
  if (active) {
36927
36933
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
36928
36934
  if (origin) {
36929
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$F);
36935
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$G);
36930
36936
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
36931
36937
  } else {
36932
36938
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -37178,7 +37184,7 @@ function buildFragment$2(mesh) {
37178
37184
  * @author xeolabs / https://github.com/xeolabs
37179
37185
  */
37180
37186
 
37181
- const tempVec3a$E = math.vec3();
37187
+ const tempVec3a$F = math.vec3();
37182
37188
 
37183
37189
  /**
37184
37190
  * @private
@@ -37273,7 +37279,7 @@ PickTriangleRenderer.prototype.drawMesh = function (frameCtx, mesh) {
37273
37279
  if (active) {
37274
37280
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
37275
37281
  if (origin) {
37276
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$E);
37282
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$F);
37277
37283
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
37278
37284
  } else {
37279
37285
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -37522,7 +37528,7 @@ function buildFragment$1(mesh) {
37522
37528
  * @author xeolabs / https://github.com/xeolabs
37523
37529
  */
37524
37530
 
37525
- const tempVec3a$D = math.vec3();
37531
+ const tempVec3a$E = math.vec3();
37526
37532
 
37527
37533
  // No ID, because there is exactly one PickMeshRenderer per scene
37528
37534
 
@@ -37637,7 +37643,7 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
37637
37643
  if (active) {
37638
37644
  const sectionPlane = sectionPlanes[sectionPlaneIndex];
37639
37645
  if (origin) {
37640
- const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$D);
37646
+ const rtcSectionPlanePos = getPlaneRTCPos(sectionPlane.dist, sectionPlane.dir, origin, tempVec3a$E);
37641
37647
  gl.uniform3fv(sectionPlaneUniforms.pos, rtcSectionPlanePos);
37642
37648
  } else {
37643
37649
  gl.uniform3fv(sectionPlaneUniforms.pos, sectionPlane.pos);
@@ -42882,7 +42888,12 @@ class AxisGizmoPlugin extends Plugin {
42882
42888
  }
42883
42889
  }
42884
42890
 
42885
- math.vec3();
42891
+ const tempVec3a$D = math.vec3();
42892
+ const tempVec3b$y = math.vec3();
42893
+ const tempVec4a$a = math.vec4();
42894
+ const front = math.vec3([0, 0, -1]);
42895
+ const back = math.vec3([0, 0, 1]);
42896
+ const up = math.vec3([0, 1, 0]);
42886
42897
 
42887
42898
  /**
42888
42899
  * @desc An arbitrarily-aligned World-space clipping plane.
@@ -42954,6 +42965,8 @@ class SectionPlane extends Component {
42954
42965
  this._state = new RenderState({
42955
42966
  active: true,
42956
42967
  pos: math.vec3(),
42968
+ quaternion: math.vec4(),
42969
+ roll: 0,
42957
42970
  dir: math.vec3(),
42958
42971
  dist: 0
42959
42972
  });
@@ -43015,6 +43028,59 @@ class SectionPlane extends Component {
43015
43028
  return this._state.pos;
43016
43029
  }
43017
43030
 
43031
+ /**
43032
+ * Sets the quaternion of this SectionPlane's plane.
43033
+ *
43034
+ * Default value is ````[0, -1, 0, 0]````.
43035
+ *
43036
+ * @param {Number[]} value New quaternion.
43037
+ */
43038
+ set quaternion(value) {
43039
+ this._state.quaternion.set(value || [0, 0, 0, -1]);
43040
+ math.vec3ApplyQuaternion(this._state.quaternion, back, this._state.dir);
43041
+ const quatUp = math.vec3ApplyQuaternion(this._state.quaternion, up, tempVec3a$D);
43042
+ const dirOnlyQ = math.vec3PairToQuaternion(back, this._state.dir, tempVec4a$a);
43043
+ const dirOnlyUp = math.vec3ApplyQuaternion(dirOnlyQ, up, tempVec3b$y);
43044
+ const angle = Math.acos(Math.min(1, math.dotVec3(quatUp, dirOnlyUp)));
43045
+ const sign = Math.sign(math.dotVec3(this._state.dir, math.cross3Vec3(quatUp, dirOnlyUp, tempVec3b$y)));
43046
+ this._state.roll = sign * angle;
43047
+ this._onDirUpdated();
43048
+ }
43049
+
43050
+ /**
43051
+ * Gets the quaternion of this SectionPlane's plane.
43052
+ *
43053
+ * Default value is ````[0, -1, 0, 0]````.
43054
+ *
43055
+ * @returns {Number[]} value Current quaternion.
43056
+ */
43057
+ get quaternion() {
43058
+ return this._state.quaternion;
43059
+ }
43060
+
43061
+ /**
43062
+ * Sets the roll of this SectionPlane's plane.
43063
+ *
43064
+ * Default value is ````0````.
43065
+ *
43066
+ * @param {Number[]} value New roll.
43067
+ */
43068
+ set roll(value) {
43069
+ this._state.roll = value || 0;
43070
+ this._onDirRollUpdated();
43071
+ }
43072
+
43073
+ /**
43074
+ * Gets the roll of this SectionPlane's plane.
43075
+ *
43076
+ * Default value is ````0````.
43077
+ *
43078
+ * @returns {Number[]} value Current roll.
43079
+ */
43080
+ get roll() {
43081
+ return this._state.roll;
43082
+ }
43083
+
43018
43084
  /**
43019
43085
  * Sets the direction of this SectionPlane's plane.
43020
43086
  *
@@ -43023,7 +43089,25 @@ class SectionPlane extends Component {
43023
43089
  * @param {Number[]} value New direction.
43024
43090
  */
43025
43091
  set dir(value) {
43026
- this._state.dir.set(value || [0, 0, -1]);
43092
+ this._state.dir.set(value || front);
43093
+ this._onDirRollUpdated();
43094
+ }
43095
+
43096
+ _onDirRollUpdated() {
43097
+ math.vec3PairToQuaternion(back, this._state.dir, this._state.quaternion);
43098
+
43099
+ tempVec4a$a[0] = 0;
43100
+ tempVec4a$a[1] = 0;
43101
+ tempVec4a$a[2] = -1;
43102
+ tempVec4a$a[3] = this._state.roll;
43103
+ math.angleAxisToQuaternion(tempVec4a$a, tempVec4a$a);
43104
+
43105
+ math.mulQuaternions(this._state.quaternion, tempVec4a$a, this._state.quaternion);
43106
+
43107
+ this._onDirUpdated();
43108
+ }
43109
+
43110
+ _onDirUpdated() {
43027
43111
  this._state.dist = (-math.dotVec3(this._state.pos, this._state.dir));
43028
43112
  this.glRedraw();
43029
43113
  this.fire("dir", this._state.dir);
@@ -52680,7 +52764,10 @@ class TrianglesColorRenderer$1 extends TrianglesBatchingRenderer {
52680
52764
  }
52681
52765
 
52682
52766
  if (scene.logarithmicDepthBufferEnabled) {
52683
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
52767
+ src.push(" float dx = dFdx(vFragDepth);");
52768
+ src.push(" float dy = dFdy(vFragDepth);");
52769
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
52770
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
52684
52771
  }
52685
52772
 
52686
52773
  if (this._withSAO) {
@@ -58031,7 +58118,10 @@ class TrianglesColorRenderer extends TrianglesInstancingRenderer {
58031
58118
  }
58032
58119
 
58033
58120
  if (scene.logarithmicDepthBufferEnabled) {
58034
- src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");
58121
+ src.push(" float dx = dFdx(vFragDepth);");
58122
+ src.push(" float dy = dFdy(vFragDepth);");
58123
+ src.push(" float diff = sqrt(dx*dx+dy*dy);");
58124
+ src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth + diff ) * logDepthBufFC * 0.5;");
58035
58125
  }
58036
58126
 
58037
58127
  // Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
@@ -84476,6 +84566,7 @@ class SceneModel extends Component {
84476
84566
  set matrix(value) {
84477
84567
  this._matrix.set(value || DEFAULT_MATRIX);
84478
84568
  math.decomposeMat4(this._matrix, this._position, this._quaternion, this._scale);
84569
+ math.quaternionToEuler(this._quaternion, "XYZ", this._rotation);
84479
84570
  this._matrixDirty = false;
84480
84571
  this._setWorldMatrixDirty();
84481
84572
  this._sceneModelDirty();
@@ -93251,7 +93342,7 @@ CameraPathAnimation.PLAYING_TO = 3;
93251
93342
  const tempVec3$3 = math.vec3();
93252
93343
  const tempVec3b$5 = math.vec3();
93253
93344
  math.vec3();
93254
- const zeroVec$2 = math.vec3([0, -1, 0]);
93345
+ const zeroVec$1 = math.vec3([0, -1, 0]);
93255
93346
  const tempQuat = math.vec4([0, 0, 0, 1]);
93256
93347
 
93257
93348
  /**
@@ -93678,7 +93769,7 @@ class ImagePlane extends Component {
93678
93769
 
93679
93770
  math.normalizeVec3(negDir);
93680
93771
  math.mulVec3Scalar(negDir, dist, tempVec3b$5);
93681
- math.vec3PairToQuaternion(zeroVec$2, dir, tempQuat);
93772
+ math.vec3PairToQuaternion(zeroVec$1, dir, tempQuat);
93682
93773
 
93683
93774
  this._node.quaternion = tempQuat;
93684
93775
  }
@@ -120717,9 +120808,6 @@ class OBJLoaderPlugin extends Plugin {
120717
120808
  }
120718
120809
  }
120719
120810
 
120720
- const zeroVec$1 = new Float64Array([0, 0, 1]);
120721
- const quat$1 = new Float64Array(4);
120722
-
120723
120811
  /**
120724
120812
  * Controls a {@link SectionPlane} with mouse and touch input.
120725
120813
  *
@@ -120837,15 +120925,13 @@ class Control {
120837
120925
  });
120838
120926
 
120839
120927
  const handlers = { };
120840
- const addAxis = (rgb, axisDirection, hoopDirection) => {
120928
+ const addAxis = (rgb, hoopRot) => {
120929
+ math.mulVec3Scalar(rgb, -1, math.vec3());
120841
120930
  const material = colorMaterial(rgb);
120842
120931
 
120843
- const rotateToHorizontal = math.rotationMat4v(270 * math.DEGTORAD, [1, 0, 0], math.identityMat4());
120844
- const hoopRotation = math.quaternionToRotationMat4(math.vec3PairToQuaternion([ 0, 1, 0 ], hoopDirection), math.identityMat4());
120845
- const hoopMatrix = math.mulMat4(hoopRotation, rotateToHorizontal, math.identityMat4());
120846
-
120932
+ const hoopMatrix = math.quaternionToRotationMat4(hoopRot, math.identityMat4());
120933
+ math.mulMat4(math.rotationMat4v(Math.PI, [0,1,0], math.mat4()), hoopMatrix, hoopMatrix);
120847
120934
  const scale = math.scaleMat4v([0.6, 0.6, 0.6], math.identityMat4());
120848
-
120849
120935
  const scaledArrowMatrix = (t, matR) => {
120850
120936
  const matT = math.translateMat4v(t, math.identityMat4());
120851
120937
  const ret = math.identityMat4();
@@ -120914,7 +121000,8 @@ class Control {
120914
121000
  }), NO_STATE_INHERIT);
120915
121001
 
120916
121002
 
120917
- const axisRotation = math.quaternionToRotationMat4(math.vec3PairToQuaternion([ 0, 1, 0 ], axisDirection), math.identityMat4());
121003
+ const axisRotation = math.quaternionToRotationMat4(math.vec3PairToQuaternion([ 0, 1, 0 ], rgb), math.identityMat4());
121004
+ math.mulMat4(math.rotationMat4v(Math.PI, [0,1,0], math.mat4()), axisRotation, axisRotation);
120918
121005
 
120919
121006
  const translatedAxisMatrix = (yOffset) => math.mulMat4(axisRotation, math.translateMat4c(0, yOffset, 0, math.identityMat4()), math.identityMat4());
120920
121007
  const arrowMatrix = translatedAxisMatrix(arrowLength + .1);
@@ -121043,7 +121130,7 @@ class Control {
121043
121130
  rootNode.rotate(rgb, (rotation - lastRotation) * 180 / Math.PI);
121044
121131
  if (this._sectionPlane) {
121045
121132
  ignoreNextSectionPlaneDirUpdate = true;
121046
- this._sectionPlane.dir = math.vec3ApplyQuaternion(rootNode.quaternion, [0, 0, 1], tempVec3);
121133
+ this._sectionPlane.quaternion = rootNode.quaternion;
121047
121134
  }
121048
121135
  lastRotation = rotation;
121049
121136
  };
@@ -121157,9 +121244,9 @@ class Control {
121157
121244
  //
121158
121245
  //----------------------------------------------------------------------------------------------------------
121159
121246
 
121160
- addAxis([1,0,0], [ 1, 0, 0 ], [ 1, 0, 0 ]),
121161
- addAxis([0,1,0], [ 0, -1, 0 ], [ 0, 1, 0 ]),
121162
- addAxis([0,0,1], [ 0, 0, -1 ], [ 0, 0, -1 ])
121247
+ addAxis([1,0,0], math.vec3PairToQuaternion([1,0,0], [0,0,1])),
121248
+ addAxis([0,1,0], math.eulerToQuaternion([90,0,0], "XYZ")),
121249
+ addAxis([0,0,1], math.identityQuaternion())
121163
121250
  ];
121164
121251
 
121165
121252
  const cleanups = [ ];
@@ -121297,7 +121384,7 @@ class Control {
121297
121384
  this.id = sectionPlane.id;
121298
121385
  this._sectionPlane = sectionPlane;
121299
121386
  const setPosFromSectionPlane = () => setPos(sectionPlane.pos);
121300
- const setDirFromSectionPlane = () => rootNode.quaternion = math.vec3PairToQuaternion(zeroVec$1, sectionPlane.dir, quat$1);
121387
+ const setDirFromSectionPlane = () => rootNode.quaternion = sectionPlane.quaternion;
121301
121388
  setPosFromSectionPlane();
121302
121389
  setDirFromSectionPlane();
121303
121390
  const onSectionPlanePos = sectionPlane.on("pos", setPosFromSectionPlane);