@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.
@@ -11030,6 +11030,7 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
11030
11030
  if (mouseHovering) {
11031
11031
  this._currentAngleMeasurement.targetVisible = true;
11032
11032
  this._currentAngleMeasurement.angleVisible = true;
11033
+ this._currentAngleMeasurement.clickable = true;
11033
11034
  this.angleMeasurementsPlugin.fire("measurementEnd", this._currentAngleMeasurement);
11034
11035
  this._currentAngleMeasurement = null;
11035
11036
  this._mouseState = MOUSE_FINDING_ORIGIN;
@@ -45987,7 +45988,10 @@ class Bitmap extends Component {
45987
45988
  this._rtcPos = math.vec3();
45988
45989
  this._imageSize = math.vec2();
45989
45990
 
45990
- this._texture = new Texture(this);
45991
+ this._texture = new Texture(this, {
45992
+ flipY: true
45993
+ });
45994
+
45991
45995
  this._image = new Image();
45992
45996
 
45993
45997
  if (this._type !== "jpg" && this._type !== "png") {
@@ -46360,6 +46364,116 @@ class Bitmap extends Component {
46360
46364
  }
46361
46365
  }
46362
46366
 
46367
+ const tempVec3a$v = math.vec3();
46368
+ const tempVec3b$q = math.vec3();
46369
+ const tempMat4a$h = math.mat4();
46370
+
46371
+ /**
46372
+ * @private
46373
+ */
46374
+ class FrustumPlane {
46375
+
46376
+ constructor() {
46377
+ this.normal = math.vec3();
46378
+ this.offset = 0;
46379
+ this.testVertex = math.vec3();
46380
+ }
46381
+
46382
+ set(nx, ny, nz, offset) {
46383
+ const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
46384
+ this.normal[0] = nx * s;
46385
+ this.normal[1] = ny * s;
46386
+ this.normal[2] = nz * s;
46387
+ this.offset = offset * s;
46388
+ this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
46389
+ this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
46390
+ this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
46391
+ }
46392
+ }
46393
+
46394
+ /**
46395
+ * @private
46396
+ */
46397
+ class Frustum {
46398
+ constructor() {
46399
+ this.planes = [
46400
+ new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
46401
+ new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
46402
+ ];
46403
+ }
46404
+ }
46405
+
46406
+ Frustum.INSIDE = 0;
46407
+ Frustum.INTERSECT = 1;
46408
+ Frustum.OUTSIDE = 2;
46409
+
46410
+ /** @private */
46411
+ function setFrustum(frustum, viewMat, projMat) {
46412
+
46413
+ const m = math.mulMat4(projMat, viewMat, tempMat4a$h);
46414
+
46415
+ const m0 = m[0];
46416
+ const m1 = m[1];
46417
+ const m2 = m[2];
46418
+ const m3 = m[3];
46419
+ const m4 = m[4];
46420
+ const m5 = m[5];
46421
+ const m6 = m[6];
46422
+ const m7 = m[7];
46423
+ const m8 = m[8];
46424
+ const m9 = m[9];
46425
+ const m10 = m[10];
46426
+ const m11 = m[11];
46427
+ const m12 = m[12];
46428
+ const m13 = m[13];
46429
+ const m14 = m[14];
46430
+ const m15 = m[15];
46431
+
46432
+ frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
46433
+ frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
46434
+ frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
46435
+ frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
46436
+ frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
46437
+ frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
46438
+ }
46439
+
46440
+ /** @private */
46441
+ function frustumIntersectsAABB3(frustum, aabb) {
46442
+
46443
+ let ret = Frustum.INSIDE;
46444
+
46445
+ const min = tempVec3a$v;
46446
+ const max = tempVec3b$q;
46447
+
46448
+ min[0] = aabb[0];
46449
+ min[1] = aabb[1];
46450
+ min[2] = aabb[2];
46451
+ max[0] = aabb[3];
46452
+ max[1] = aabb[4];
46453
+ max[2] = aabb[5];
46454
+
46455
+ const bminmax = [min, max];
46456
+
46457
+ for (let i = 0; i < 6; ++i) {
46458
+ const plane = frustum.planes[i];
46459
+ if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
46460
+ (plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
46461
+ (plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
46462
+ (plane.offset)) < 0.0) {
46463
+ return Frustum.OUTSIDE;
46464
+ }
46465
+
46466
+ if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
46467
+ (plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
46468
+ (plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
46469
+ (plane.offset)) < 0.0) {
46470
+ ret = Frustum.INTERSECT;
46471
+ }
46472
+ }
46473
+
46474
+ return ret;
46475
+ }
46476
+
46363
46477
  /**
46364
46478
  * A set of 3D line segments.
46365
46479
  *
@@ -46434,8 +46548,10 @@ class LineSet extends Component {
46434
46548
  super(owner, cfg);
46435
46549
 
46436
46550
  this._positions = cfg.positions || [];
46437
-
46438
- this._origin = math.vec3(cfg.origin || [0, 0, 0]);
46551
+ const rtcPositions = new Float32Array(this._positions.length);
46552
+ const rtcCenter = math.vec3();
46553
+ const cellSize = 100;
46554
+ const rtcNeeded = worldToRTCPositions(this._positions, new Float32Array(this._positions.length), rtcCenter, cellSize);
46439
46555
 
46440
46556
  if (cfg.indices) {
46441
46557
  this._indices = cfg.indices;
@@ -46453,9 +46569,9 @@ class LineSet extends Component {
46453
46569
  collidable: cfg.collidable,
46454
46570
  geometry: new VBOGeometry(this, {
46455
46571
  primitive: "lines",
46456
- positions: this._positions,
46572
+ positions: rtcNeeded ? rtcPositions : this._positions,
46457
46573
  indices: this._indices,
46458
- origin: cfg.origin
46574
+ origin: rtcNeeded ? rtcCenter : null
46459
46575
  }),
46460
46576
  material: new PhongMaterial(this, {
46461
46577
  diffuse: cfg.color || [0, 0, 0],
@@ -46518,8 +46634,8 @@ class LineSet extends Component {
46518
46634
  }
46519
46635
 
46520
46636
  const tempVec3$5 = math.vec3();
46521
- const tempVec3a$v = math.vec3();
46522
- const tempVec3b$q = math.vec3();
46637
+ const tempVec3a$u = math.vec3();
46638
+ const tempVec3b$p = math.vec3();
46523
46639
  const tempVec3c$m = math.vec3();
46524
46640
 
46525
46641
  /**
@@ -47199,8 +47315,8 @@ class BCFViewpointsPlugin extends Plugin {
47199
47315
  bcfViewpoint.bitmaps.forEach(function (e) {
47200
47316
  const bitmap_type = e.bitmap_type || "jpg"; // "jpg" | "png"
47201
47317
  const bitmap_data = e.bitmap_data; // base64
47202
- let location = xyzObjectToArray(e.location, tempVec3a$v);
47203
- let normal = xyzObjectToArray(e.normal, tempVec3b$q);
47318
+ let location = xyzObjectToArray(e.location, tempVec3a$u);
47319
+ let normal = xyzObjectToArray(e.normal, tempVec3b$p);
47204
47320
  let up = xyzObjectToArray(e.up, tempVec3c$m);
47205
47321
  let height = e.height || 1;
47206
47322
  if (!bitmap_type) {
@@ -50596,7 +50712,7 @@ class SplineCurve extends Curve {
50596
50712
  }
50597
50713
  }
50598
50714
 
50599
- const tempVec3a$u = math.vec3();
50715
+ const tempVec3a$t = math.vec3();
50600
50716
 
50601
50717
  /**
50602
50718
  * @desc Defines a sequence of frames along which a {@link CameraPathAnimation} can animate a {@link Camera}.
@@ -50728,9 +50844,9 @@ class CameraPath extends Component {
50728
50844
  t = t / (this._frames[this._frames.length - 1].t - this._frames[0].t);
50729
50845
  t = t < 0.0 ? 0.0 : (t > 1.0 ? 1.0 : t);
50730
50846
 
50731
- camera.eye = this._eyeCurve.getPoint(t, tempVec3a$u);
50732
- camera.look = this._lookCurve.getPoint(t, tempVec3a$u);
50733
- camera.up = this._upCurve.getPoint(t, tempVec3a$u);
50847
+ camera.eye = this._eyeCurve.getPoint(t, tempVec3a$t);
50848
+ camera.look = this._lookCurve.getPoint(t, tempVec3a$t);
50849
+ camera.up = this._upCurve.getPoint(t, tempVec3a$t);
50734
50850
  }
50735
50851
 
50736
50852
  /**
@@ -51769,7 +51885,7 @@ CameraPathAnimation.PLAYING = 2;
51769
51885
  CameraPathAnimation.PLAYING_TO = 3;
51770
51886
 
51771
51887
  const tempVec3$3 = math.vec3();
51772
- const tempVec3b$p = math.vec3();
51888
+ const tempVec3b$o = math.vec3();
51773
51889
  math.vec3();
51774
51890
  const zeroVec$2 = math.vec3([0, -1, 0]);
51775
51891
  const tempQuat = math.vec4([0, 0, 0, 1]);
@@ -52197,7 +52313,7 @@ class ImagePlane extends Component {
52197
52313
  const dist = -math.dotVec3(negDir, tempVec3$3);
52198
52314
 
52199
52315
  math.normalizeVec3(negDir);
52200
- math.mulVec3Scalar(negDir, dist, tempVec3b$p);
52316
+ math.mulVec3Scalar(negDir, dist, tempVec3b$o);
52201
52317
  math.vec3PairToQuaternion(zeroVec$2, dir, tempQuat);
52202
52318
 
52203
52319
  this._node.quaternion = tempQuat;
@@ -53363,116 +53479,6 @@ class SpriteMarker extends Marker {
53363
53479
  }
53364
53480
  }
53365
53481
 
53366
- const tempVec3a$t = math.vec3();
53367
- const tempVec3b$o = math.vec3();
53368
- const tempMat4a$h = math.mat4();
53369
-
53370
- /**
53371
- * @private
53372
- */
53373
- class FrustumPlane {
53374
-
53375
- constructor() {
53376
- this.normal = math.vec3();
53377
- this.offset = 0;
53378
- this.testVertex = math.vec3();
53379
- }
53380
-
53381
- set(nx, ny, nz, offset) {
53382
- const s = 1.0 / Math.sqrt(nx * nx + ny * ny + nz * nz);
53383
- this.normal[0] = nx * s;
53384
- this.normal[1] = ny * s;
53385
- this.normal[2] = nz * s;
53386
- this.offset = offset * s;
53387
- this.testVertex[0] = (this.normal[0] >= 0.0) ? 1 : 0;
53388
- this.testVertex[1] = (this.normal[1] >= 0.0) ? 1 : 0;
53389
- this.testVertex[2] = (this.normal[2] >= 0.0) ? 1 : 0;
53390
- }
53391
- }
53392
-
53393
- /**
53394
- * @private
53395
- */
53396
- class Frustum {
53397
- constructor() {
53398
- this.planes = [
53399
- new FrustumPlane(), new FrustumPlane(), new FrustumPlane(),
53400
- new FrustumPlane(), new FrustumPlane(), new FrustumPlane()
53401
- ];
53402
- }
53403
- }
53404
-
53405
- Frustum.INSIDE = 0;
53406
- Frustum.INTERSECT = 1;
53407
- Frustum.OUTSIDE = 2;
53408
-
53409
- /** @private */
53410
- function setFrustum(frustum, viewMat, projMat) {
53411
-
53412
- const m = math.mulMat4(projMat, viewMat, tempMat4a$h);
53413
-
53414
- const m0 = m[0];
53415
- const m1 = m[1];
53416
- const m2 = m[2];
53417
- const m3 = m[3];
53418
- const m4 = m[4];
53419
- const m5 = m[5];
53420
- const m6 = m[6];
53421
- const m7 = m[7];
53422
- const m8 = m[8];
53423
- const m9 = m[9];
53424
- const m10 = m[10];
53425
- const m11 = m[11];
53426
- const m12 = m[12];
53427
- const m13 = m[13];
53428
- const m14 = m[14];
53429
- const m15 = m[15];
53430
-
53431
- frustum.planes[0].set(m3 - m0, m7 - m4, m11 - m8, m15 - m12);
53432
- frustum.planes[1].set(m3 + m0, m7 + m4, m11 + m8, m15 + m12);
53433
- frustum.planes[2].set(m3 - m1, m7 - m5, m11 - m9, m15 - m13);
53434
- frustum.planes[3].set(m3 + m1, m7 + m5, m11 + m9, m15 + m13);
53435
- frustum.planes[4].set(m3 - m2, m7 - m6, m11 - m10, m15 - m14);
53436
- frustum.planes[5].set(m3 + m2, m7 + m6, m11 + m10, m15 + m14);
53437
- }
53438
-
53439
- /** @private */
53440
- function frustumIntersectsAABB3(frustum, aabb) {
53441
-
53442
- let ret = Frustum.INSIDE;
53443
-
53444
- const min = tempVec3a$t;
53445
- const max = tempVec3b$o;
53446
-
53447
- min[0] = aabb[0];
53448
- min[1] = aabb[1];
53449
- min[2] = aabb[2];
53450
- max[0] = aabb[3];
53451
- max[1] = aabb[4];
53452
- max[2] = aabb[5];
53453
-
53454
- const bminmax = [min, max];
53455
-
53456
- for (let i = 0; i < 6; ++i) {
53457
- const plane = frustum.planes[i];
53458
- if (((plane.normal[0] * bminmax[plane.testVertex[0]][0]) +
53459
- (plane.normal[1] * bminmax[plane.testVertex[1]][1]) +
53460
- (plane.normal[2] * bminmax[plane.testVertex[2]][2]) +
53461
- (plane.offset)) < 0.0) {
53462
- return Frustum.OUTSIDE;
53463
- }
53464
-
53465
- if (((plane.normal[0] * bminmax[1 - plane.testVertex[0]][0]) +
53466
- (plane.normal[1] * bminmax[1 - plane.testVertex[1]][1]) +
53467
- (plane.normal[2] * bminmax[1 - plane.testVertex[2]][2]) +
53468
- (plane.offset)) < 0.0) {
53469
- ret = Frustum.INTERSECT;
53470
- }
53471
- }
53472
-
53473
- return ret;
53474
- }
53475
-
53476
53482
  /**
53477
53483
  * @desc Saves and restores the state of a {@link Scene}'s {@link Camera}.
53478
53484
  *
@@ -73275,9 +73281,9 @@ class TrianglesDataTextureColorRenderer {
73275
73281
 
73276
73282
  src.push("uniform int renderPass;");
73277
73283
 
73278
- if (scene.entityOffsetsEnabled) {
73279
- src.push("in vec3 offset;");
73280
- }
73284
+ // if (scene.entityOffsetsEnabled) {
73285
+ // src.push("in vec3 offset;");
73286
+ // }
73281
73287
 
73282
73288
  src.push("uniform mat4 sceneModelWorldMatrix;");
73283
73289
  src.push("uniform mat4 viewMatrix;");
@@ -74043,7 +74049,6 @@ const defaultColor = new Float32Array([0, 0, 0, 1]);
74043
74049
 
74044
74050
  const tempVec3a$i = math.vec3();
74045
74051
  const tempVec3b$e = math.vec3();
74046
- math.vec3();
74047
74052
  const tempVec3d$8 = math.vec3();
74048
74053
  const tempMat4a$9 = math.mat4();
74049
74054
 
@@ -74106,8 +74111,7 @@ class TrianglesDataTextureEdgesRenderer {
74106
74111
  if (gotOrigin || gotPosition) {
74107
74112
  const rtcOrigin = tempVec3a$i;
74108
74113
  if (gotOrigin) {
74109
- const rotatedOrigin = tempVec3b$e;
74110
- math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
74114
+ const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b$e);
74111
74115
  rtcOrigin[0] = rotatedOrigin[0];
74112
74116
  rtcOrigin[1] = rotatedOrigin[1];
74113
74117
  rtcOrigin[2] = rotatedOrigin[2];
@@ -74289,9 +74293,9 @@ class TrianglesDataTextureEdgesRenderer {
74289
74293
 
74290
74294
  src.push("uniform int renderPass;");
74291
74295
 
74292
- if (scene.entityOffsetsEnabled) {
74293
- src.push("in vec3 offset;");
74294
- }
74296
+ // if (scene.entityOffsetsEnabled) {
74297
+ // src.push("in vec3 offset;");
74298
+ // }
74295
74299
 
74296
74300
  src.push("uniform mat4 sceneModelWorldMatrix;");
74297
74301
  src.push("uniform mat4 viewMatrix;");
@@ -74376,7 +74380,7 @@ class TrianglesDataTextureEdgesRenderer {
74376
74380
  // get XYZ offset
74377
74381
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74378
74382
 
74379
- src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74383
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz + vec3(110.0,50.0, 10.0);");
74380
74384
 
74381
74385
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74382
74386
 
@@ -74526,8 +74530,7 @@ class TrianglesDataTextureEdgesColorRenderer {
74526
74530
  if (gotOrigin || gotPosition) {
74527
74531
  const rtcOrigin = tempVec3a$h;
74528
74532
  if (gotOrigin) {
74529
- const rotatedOrigin = tempVec3b$d;
74530
- math.transformPoint3(rotationMatrix, origin, rotatedOrigin);
74533
+ const rotatedOrigin = math.transformPoint3(rotationMatrix, origin, tempVec3b$d);
74531
74534
  rtcOrigin[0] = rotatedOrigin[0];
74532
74535
  rtcOrigin[1] = rotatedOrigin[1];
74533
74536
  rtcOrigin[2] = rotatedOrigin[2];
@@ -74794,7 +74797,7 @@ class TrianglesDataTextureEdgesColorRenderer {
74794
74797
  // get XYZ offset
74795
74798
  src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");
74796
74799
 
74797
- // src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74800
+ src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");
74798
74801
 
74799
74802
  src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");
74800
74803
 
@@ -82921,7 +82924,7 @@ class SceneModel extends Component {
82921
82924
  cfg.primitive = "triangles";
82922
82925
  }
82923
82926
  if (cfg.primitive !== "points" && cfg.primitive !== "lines" && cfg.primitive !== "triangles" && cfg.primitive !== "solid" && cfg.primitive !== "surface") {
82924
- this.error(`[createGeometry] Unsupported value for 'primitive': '${primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
82927
+ this.error(`[createGeometry] Unsupported value for 'primitive': '${cfg.primitive}' - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'. Defaulting to 'triangles'.`);
82925
82928
  return;
82926
82929
  }
82927
82930
  if (!cfg.positions && !cfg.positionsCompressed && !cfg.buckets) {
@@ -85871,12 +85874,13 @@ class MousePickHandler {
85871
85874
  }
85872
85875
 
85873
85876
  const hoverSubs = cameraControl.hasSubs("hover");
85877
+ const hoverEnterSubs = cameraControl.hasSubs("hoverEnter");
85874
85878
  const hoverOutSubs = cameraControl.hasSubs("hoverOut");
85875
85879
  const hoverOffSubs = cameraControl.hasSubs("hoverOff");
85876
85880
  const hoverSurfaceSubs = cameraControl.hasSubs("hoverSurface");
85877
85881
  const hoverSnapOrSurfaceSubs = cameraControl.hasSubs("hoverSnapOrSurface");
85878
85882
 
85879
- if (hoverSubs || hoverOutSubs || hoverOffSubs || hoverSurfaceSubs || hoverSnapOrSurfaceSubs) {
85883
+ if (hoverSubs || hoverEnterSubs || hoverOutSubs || hoverOffSubs || hoverSurfaceSubs || hoverSnapOrSurfaceSubs) {
85880
85884
 
85881
85885
  pickController.pickCursorPos = states.pointerCanvasPos;
85882
85886
  pickController.schedulePickEntity = true;