@xeokit/xeokit-sdk 2.4.0-alpha-101 → 2.4.0-alpha-105

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.
@@ -11026,6 +11026,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
11026
11026
  if (mouseHovering) {
11027
11027
  this._currentAngleMeasurement.targetVisible = true;
11028
11028
  this._currentAngleMeasurement.angleVisible = true;
11029
+ this._currentAngleMeasurement.clickable = true;
11029
11030
  this.angleMeasurementsPlugin.fire("measurementEnd", this._currentAngleMeasurement);
11030
11031
  this._currentAngleMeasurement = null;
11031
11032
  this._mouseState = MOUSE_FINDING_ORIGIN;
@@ -45983,7 +45984,10 @@ class Bitmap extends Component {
45983
45984
  this._rtcPos = math.vec3();
45984
45985
  this._imageSize = math.vec2();
45985
45986
 
45986
- this._texture = new Texture(this);
45987
+ this._texture = new Texture(this, {
45988
+ flipY: true
45989
+ });
45990
+
45987
45991
  this._image = new Image();
45988
45992
 
45989
45993
  if (this._type !== "jpg" && this._type !== "png") {
@@ -46356,6 +46360,116 @@ class Bitmap extends Component {
46356
46360
  }
46357
46361
  }
46358
46362
 
46363
+ const tempVec3a$v = math.vec3();
46364
+ const tempVec3b$q = math.vec3();
46365
+ const tempMat4a$h = math.mat4();
46366
+
46367
+ /**
46368
+ * @private
46369
+ */
46370
+ class FrustumPlane {
46371
+
46372
+ constructor() {
46373
+ this.normal = math.vec3();
46374
+ this.offset = 0;
46375
+ this.testVertex = math.vec3();
46376
+ }
46377
+
46378
+ set(nx, ny, nz, offset) {
46379
+ const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
46380
+ this.normal[0] = nx * s;
46381
+ this.normal[1] = ny * s;
46382
+ this.normal[2] = nz * s;
46383
+ this.offset = offset * s;
46384
+ this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
46385
+ this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
46386
+ this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
46387
+ }
46388
+ }
46389
+
46390
+ /**
46391
+ * @private
46392
+ */
46393
+ class Frustum {
46394
+ constructor() {
46395
+ this.planes = [
46396
+ new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
46397
+ new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
46398
+ ];
46399
+ }
46400
+ }
46401
+
46402
+ Frustum.INSIDE = 0;
46403
+ Frustum.INTERSECT = 1;
46404
+ Frustum.OUTSIDE = 2;
46405
+
46406
+ /** @private */
46407
+ function setFrustum(frustum, viewMat, projMat) {
46408
+
46409
+ const m = math.mulMat4(projMat, viewMat, tempMat4a$h);
46410
+
46411
+ const m0 = m[0];
46412
+ const m1 = m[1];
46413
+ const m2 = m[2];
46414
+ const m3 = m[3];
46415
+ const m4 = m[4];
46416
+ const m5 = m[5];
46417
+ const m6 = m[6];
46418
+ const m7 = m[7];
46419
+ const m8 = m[8];
46420
+ const m9 = m[9];
46421
+ const m10 = m[10];
46422
+ const m11 = m[11];
46423
+ const m12 = m[12];
46424
+ const m13 = m[13];
46425
+ const m14 = m[14];
46426
+ const m15 = m[15];
46427
+
46428
+ frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
46429
+ frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
46430
+ frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
46431
+ frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
46432
+ frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
46433
+ frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
46434
+ }
46435
+
46436
+ /** @private */
46437
+ function frustumIntersectsAABB3(frustum, aabb) {
46438
+
46439
+ let ret = Frustum.INSIDE;
46440
+
46441
+ const min = tempVec3a$v;
46442
+ const max = tempVec3b$q;
46443
+
46444
+ min[0] = aabb[0];
46445
+ min[1] = aabb[1];
46446
+ min[2] = aabb[2];
46447
+ max[0] = aabb[3];
46448
+ max[1] = aabb[4];
46449
+ max[2] = aabb[5];
46450
+
46451
+ const bminmax = [min, max];
46452
+
46453
+ for (let i = 0; i < 6; ++i) {
46454
+ const plane = frustum.planes[i];
46455
+ if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
46456
+ (plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
46457
+ (plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
46458
+ (plane.offset)) < 0.0) {
46459
+ return Frustum.OUTSIDE;
46460
+ }
46461
+
46462
+ if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
46463
+ (plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
46464
+ (plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
46465
+ (plane.offset)) < 0.0) {
46466
+ ret = Frustum.INTERSECT;
46467
+ }
46468
+ }
46469
+
46470
+ return ret;
46471
+ }
46472
+
46359
46473
  /**
46360
46474
  * A set of 3D line segments.
46361
46475
  *
@@ -46430,8 +46544,10 @@ class LineSet extends Component {
46430
46544
  super(owner, cfg);
46431
46545
 
46432
46546
  this._positions = cfg.positions || [];
46433
-
46434
- this._origin = math.vec3(cfg.origin || [0, 0, 0]);
46547
+ const rtcPositions = new Float32Array(this._positions.length);
46548
+ const rtcCenter = math.vec3();
46549
+ const cellSize = 100;
46550
+ const rtcNeeded = worldToRTCPositions(this._positions, new Float32Array(this._positions.length), rtcCenter, cellSize);
46435
46551
 
46436
46552
  if (cfg.indices) {
46437
46553
  this._indices = cfg.indices;
@@ -46449,9 +46565,9 @@ class LineSet extends Component {
46449
46565
  collidable: cfg.collidable,
46450
46566
  geometry: new VBOGeometry(this, {
46451
46567
  primitive: "lines",
46452
- positions: this._positions,
46568
+ positions: rtcNeeded ? rtcPositions : this._positions,
46453
46569
  indices: this._indices,
46454
- origin: cfg.origin
46570
+ origin: rtcNeeded ? rtcCenter : null
46455
46571
  }),
46456
46572
  material: new PhongMaterial(this, {
46457
46573
  diffuse: cfg.color || [0, 0, 0],
@@ -46514,8 +46630,8 @@ class LineSet extends Component {
46514
46630
  }
46515
46631
 
46516
46632
  const tempVec3$5 = math.vec3();
46517
- const tempVec3a$v = math.vec3();
46518
- const tempVec3b$q = math.vec3();
46633
+ const tempVec3a$u = math.vec3();
46634
+ const tempVec3b$p = math.vec3();
46519
46635
  const tempVec3c$m = math.vec3();
46520
46636
 
46521
46637
  /**
@@ -47195,8 +47311,8 @@ class BCFViewpointsPlugin extends Plugin {
47195
47311
  bcfViewpoint.bitmaps.forEach(function (e) {
47196
47312
  const bitmap_type = e.bitmap_type || "jpg"; // "jpg" | "png"
47197
47313
  const bitmap_data = e.bitmap_data; // base64
47198
- let location = xyzObjectToArray(e.location, tempVec3a$v);
47199
- let normal = xyzObjectToArray(e.normal, tempVec3b$q);
47314
+ let location = xyzObjectToArray(e.location, tempVec3a$u);
47315
+ let normal = xyzObjectToArray(e.normal, tempVec3b$p);
47200
47316
  let up = xyzObjectToArray(e.up, tempVec3c$m);
47201
47317
  let height = e.height || 1;
47202
47318
  if (!bitmap_type) {
@@ -50592,7 +50708,7 @@ class SplineCurve extends Curve {
50592
50708
  }
50593
50709
  }
50594
50710
 
50595
- const tempVec3a$u = math.vec3();
50711
+ const tempVec3a$t = math.vec3();
50596
50712
 
50597
50713
  /**
50598
50714
  * @desc Defines a sequence of frames along which a {@link CameraPathAnimation} can animate a {@link Camera}.
@@ -50724,9 +50840,9 @@ class CameraPath extends Component {
50724
50840
  t = t / (this._frames[this._frames.length - 1].t - this._frames[0].t);
50725
50841
  t = t < 0.0 ? 0.0 : (t > 1.0 ? 1.0 : t);
50726
50842
 
50727
- camera.eye = this._eyeCurve.getPoint(t, tempVec3a$u);
50728
- camera.look = this._lookCurve.getPoint(t, tempVec3a$u);
50729
- camera.up = this._upCurve.getPoint(t, tempVec3a$u);
50843
+ camera.eye = this._eyeCurve.getPoint(t, tempVec3a$t);
50844
+ camera.look = this._lookCurve.getPoint(t, tempVec3a$t);
50845
+ camera.up = this._upCurve.getPoint(t, tempVec3a$t);
50730
50846
  }
50731
50847
 
50732
50848
  /**
@@ -51765,7 +51881,7 @@ CameraPathAnimation.PLAYING = 2;
51765
51881
  CameraPathAnimation.PLAYING_TO = 3;
51766
51882
 
51767
51883
  const tempVec3$3 = math.vec3();
51768
- const tempVec3b$p = math.vec3();
51884
+ const tempVec3b$o = math.vec3();
51769
51885
  math.vec3();
51770
51886
  const zeroVec$2 = math.vec3([0, -1, 0]);
51771
51887
  const tempQuat = math.vec4([0, 0, 0, 1]);
@@ -52193,7 +52309,7 @@ class ImagePlane extends Component {
52193
52309
  const dist = -math.dotVec3(negDir, tempVec3$3);
52194
52310
 
52195
52311
  math.normalizeVec3(negDir);
52196
- math.mulVec3Scalar(negDir, dist, tempVec3b$p);
52312
+ math.mulVec3Scalar(negDir, dist, tempVec3b$o);
52197
52313
  math.vec3PairToQuaternion(zeroVec$2, dir, tempQuat);
52198
52314
 
52199
52315
  this._node.quaternion = tempQuat;
@@ -53359,116 +53475,6 @@ class SpriteMarker extends Marker {
53359
53475
  }
53360
53476
  }
53361
53477
 
53362
- const tempVec3a$t = math.vec3();
53363
- const tempVec3b$o = math.vec3();
53364
- const tempMat4a$h = math.mat4();
53365
-
53366
- /**
53367
- * @private
53368
- */
53369
- class FrustumPlane {
53370
-
53371
- constructor() {
53372
- this.normal = math.vec3();
53373
- this.offset = 0;
53374
- this.testVertex = math.vec3();
53375
- }
53376
-
53377
- set(nx, ny, nz, offset) {
53378
- const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
53379
- this.normal[0] = nx * s;
53380
- this.normal[1] = ny * s;
53381
- this.normal[2] = nz * s;
53382
- this.offset = offset * s;
53383
- this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
53384
- this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
53385
- this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
53386
- }
53387
- }
53388
-
53389
- /**
53390
- * @private
53391
- */
53392
- class Frustum {
53393
- constructor() {
53394
- this.planes = [
53395
- new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
53396
- new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
53397
- ];
53398
- }
53399
- }
53400
-
53401
- Frustum.INSIDE = 0;
53402
- Frustum.INTERSECT = 1;
53403
- Frustum.OUTSIDE = 2;
53404
-
53405
- /** @private */
53406
- function setFrustum(frustum, viewMat, projMat) {
53407
-
53408
- const m = math.mulMat4(projMat, viewMat, tempMat4a$h);
53409
-
53410
- const m0 = m[0];
53411
- const m1 = m[1];
53412
- const m2 = m[2];
53413
- const m3 = m[3];
53414
- const m4 = m[4];
53415
- const m5 = m[5];
53416
- const m6 = m[6];
53417
- const m7 = m[7];
53418
- const m8 = m[8];
53419
- const m9 = m[9];
53420
- const m10 = m[10];
53421
- const m11 = m[11];
53422
- const m12 = m[12];
53423
- const m13 = m[13];
53424
- const m14 = m[14];
53425
- const m15 = m[15];
53426
-
53427
- frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
53428
- frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
53429
- frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
53430
- frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
53431
- frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
53432
- frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
53433
- }
53434
-
53435
- /** @private */
53436
- function frustumIntersectsAABB3(frustum, aabb) {
53437
-
53438
- let ret = Frustum.INSIDE;
53439
-
53440
- const min = tempVec3a$t;
53441
- const max = tempVec3b$o;
53442
-
53443
- min[0] = aabb[0];
53444
- min[1] = aabb[1];
53445
- min[2] = aabb[2];
53446
- max[0] = aabb[3];
53447
- max[1] = aabb[4];
53448
- max[2] = aabb[5];
53449
-
53450
- const bminmax = [min, max];
53451
-
53452
- for (let i = 0; i < 6; ++i) {
53453
- const plane = frustum.planes[i];
53454
- if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
53455
- (plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
53456
- (plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
53457
- (plane.offset)) < 0.0) {
53458
- return Frustum.OUTSIDE;
53459
- }
53460
-
53461
- if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
53462
- (plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
53463
- (plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
53464
- (plane.offset)) < 0.0) {
53465
- ret = Frustum.INTERSECT;
53466
- }
53467
- }
53468
-
53469
- return ret;
53470
- }
53471
-
53472
53478
  /**
53473
53479
  * @desc Saves and restores the state of a {@link Scene}'s {@link Camera}.
53474
53480
  *
@@ -73271,9 +73277,9 @@ class TrianglesDataTextureColorRenderer {
73271
73277
 
73272
73278
  src.push("uniform int renderPass;");
73273
73279
 
73274
- if (scene.entityOffsetsEnabled) {
73275
- src.push("in vec3 offset;");
73276
- }
73280
+ // if (scene.entityOffsetsEnabled) {
73281
+ // src.push("in vec3 offset;");
73282
+ // }
73277
73283
 
73278
73284
  src.push("uniform mat4 sceneModelWorldMatrix;");
73279
73285
  src.push("uniform mat4 viewMatrix;");
@@ -74039,7 +74045,6 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
74039
74045
 
74040
74046
  const tempVec3a$i = math.vec3();
74041
74047
  const tempVec3b$e = math.vec3();
74042
- math.vec3();
74043
74048
  const tempVec3d$8 = math.vec3();
74044
74049
  const tempMat4a$9 = math.mat4();
74045
74050
 
@@ -74102,8 +74107,7 @@ class TrianglesDataTextureEdgesRenderer {
74102
74107
  if (gotOrigin || gotPosition) {
74103
74108
  const rtcOrigin = tempVec3a$i;
74104
74109
  if (gotOrigin) {
74105
- const rotatedOrigin = tempVec3b$e;
74106
- math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
74110
+ const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b$e);
74107
74111
  rtcOrigin[0] = rotatedOrigin[0];
74108
74112
  rtcOrigin[1] = rotatedOrigin[1];
74109
74113
  rtcOrigin[2] = rotatedOrigin[2];
@@ -74285,9 +74289,9 @@ class TrianglesDataTextureEdgesRenderer {
74285
74289
 
74286
74290
  src.push("uniform int renderPass;");
74287
74291
 
74288
- if (scene.entityOffsetsEnabled) {
74289
- src.push("in vec3 offset;");
74290
- }
74292
+ // if (scene.entityOffsetsEnabled) {
74293
+ // src.push("in vec3 offset;");
74294
+ // }
74291
74295
 
74292
74296
  src.push("uniform mat4 sceneModelWorldMatrix;");
74293
74297
  src.push("uniform mat4 viewMatrix;");
@@ -74372,7 +74376,7 @@ class TrianglesDataTextureEdgesRenderer {
74372
74376
  // get XYZ offset
74373
74377
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74374
74378
 
74375
- src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74379
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");
74376
74380
 
74377
74381
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74378
74382
 
@@ -74522,8 +74526,7 @@ class TrianglesDataTextureEdgesColorRenderer {
74522
74526
  if (gotOrigin || gotPosition) {
74523
74527
  const rtcOrigin = tempVec3a$h;
74524
74528
  if (gotOrigin) {
74525
- const rotatedOrigin = tempVec3b$d;
74526
- math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
74529
+ const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b$d);
74527
74530
  rtcOrigin[0] = rotatedOrigin[0];
74528
74531
  rtcOrigin[1] = rotatedOrigin[1];
74529
74532
  rtcOrigin[2] = rotatedOrigin[2];
@@ -74790,7 +74793,7 @@ class TrianglesDataTextureEdgesColorRenderer {
74790
74793
  // get XYZ offset
74791
74794
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74792
74795
 
74793
- // src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74796
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74794
74797
 
74795
74798
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74796
74799
 
@@ -82917,7 +82920,7 @@ class SceneModel extends Component {
82917
82920
  cfg.primitive = "triangles";
82918
82921
  }
82919
82922
  if (cfg.primitive !== "points" && cfg.primitive !== "lines" && cfg.primitive !== "triangles" && cfg.primitive !== "solid" && cfg.primitive !== "surface") {
82920
- this.error(`[createGeometry] Unsupported value for 'primitive': '${primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
82923
+ this.error(`[createGeometry] Unsupported value for 'primitive': '${cfg.primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
82921
82924
  return;
82922
82925
  }
82923
82926
  if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {
@@ -85867,12 +85870,13 @@ class MousePickHandler {
85867
85870
  }
85868
85871
 
85869
85872
  const hoverSubs = cameraControl.hasSubs("hover");
85873
+ const hoverEnterSubs = cameraControl.hasSubs("hoverEnter");
85870
85874
  const hoverOutSubs = cameraControl.hasSubs("hoverOut");
85871
85875
  const hoverOffSubs = cameraControl.hasSubs("hoverOff");
85872
85876
  const hoverSurfaceSubs = cameraControl.hasSubs("hoverSurface");
85873
85877
  const hoverSnapOrSurfaceSubs = cameraControl.hasSubs("hoverSnapOrSurface");
85874
85878
 
85875
- if (hoverSubs || hoverOutSubs || hoverOffSubs || hoverSurfaceSubs || hoverSnapOrSurfaceSubs) {
85879
+ if (hoverSubs || hoverEnterSubs || hoverOutSubs || hoverOffSubs || hoverSurfaceSubs || hoverSnapOrSurfaceSubs) {
85876
85880
 
85877
85881
  pickController.pickCursorPos = states.pointerCanvasPos;
85878
85882
  pickController.schedulePickEntity = true;