@xeokit/xeokit-sdk 2.6.107 → 2.6.109

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.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * xeokit-sdk v2.6.107
3
- * Commit: a1558d52a694d6b8435eb85661f0d13b0a1a6fea
4
- * Built: 2026-03-12T09:08:30.647Z
2
+ * xeokit-sdk v2.6.109
3
+ * Commit: 3796b67f0bbcca7382160e5030522506fb49a54e
4
+ * Built: 2026-05-08T06:25:43.604Z
5
5
  */
6
6
 
7
7
  if (typeof window !== 'undefined') {
8
- window.__XEOKIT__ = { version: '2.6.107', commit: 'a1558d52a694d6b8435eb85661f0d13b0a1a6fea', built: '2026-03-12T09:08:30.647Z' };
8
+ window.__XEOKIT__ = { version: '2.6.109', commit: '3796b67f0bbcca7382160e5030522506fb49a54e', built: '2026-05-08T06:25:43.604Z' };
9
9
  }
10
10
 
11
11
  /** @private */
@@ -20733,7 +20733,7 @@ const tempVec3a$f = math.vec3();
20733
20733
  const tempVec4$3 = math.vec4();
20734
20734
  const TEXTURE_DECODE_FUNCS = { [sRGBEncoding]: "sRGBToLinear" };
20735
20735
 
20736
- const iota$3 = function(n) {
20736
+ const iota$4 = function(n) {
20737
20737
  const ret = [ ];
20738
20738
  for (let i = 0; i < n; ++i) ret.push(i);
20739
20739
  return ret;
@@ -20932,7 +20932,7 @@ const createProgramVariablesState = function() {
20932
20932
 
20933
20933
  const sectionPlanesState = cfg.sectionPlanesState;
20934
20934
  const getClippingDistance = sectionPlanesState && (function() {
20935
- const allocatedUniforms = iota$3(sectionPlanesState.getNumAllocatedSectionPlanes()).map(i => {
20935
+ const allocatedUniforms = iota$4(sectionPlanesState.getNumAllocatedSectionPlanes()).map(i => {
20936
20936
  const sectionPlaneUniform = (type, postfix, getValue) => {
20937
20937
  return programVariables.createUniform(type, `sectionPlane${postfix}${i}`, (set, state) => {
20938
20938
  const sectionPlanes = sectionPlanesState.sectionPlanes;
@@ -32535,9 +32535,7 @@ class Layer {
32535
32535
  }
32536
32536
 
32537
32537
  drawEdgesColorOpaque(renderFlags, frameCtx) {
32538
- if (this._compiledPortions.edgesColorOpaqueAllowed()) {
32539
- this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
32540
- }
32538
+ this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
32541
32539
  }
32542
32540
 
32543
32541
  drawEdgesColorTransparent(renderFlags, frameCtx) {
@@ -32828,7 +32826,7 @@ class Configs {
32828
32826
  }
32829
32827
  }
32830
32828
 
32831
- const iota$2 = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
32829
+ const iota$3 = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
32832
32830
 
32833
32831
  const dataTextureRamStats = {
32834
32832
  sizeDataColorsAndFlags: 0,
@@ -33410,17 +33408,6 @@ class DTXLayer extends Layer {
33410
33408
  };
33411
33409
 
33412
33410
  return {
33413
- edgesColorOpaqueAllowed: () => {
33414
- if (scene.logarithmicDepthBufferEnabled) {
33415
- if (!scene._loggedWarning) {
33416
- console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer");
33417
- scene._loggedWarning = true;
33418
- }
33419
- return false;
33420
- } else {
33421
- return true;
33422
- }
33423
- },
33424
33411
  sortId: sortId,
33425
33412
  setClippableFlags: setFlags2,
33426
33413
  setFlags: (portionId, flags, transparent, deferred = false) => {
@@ -33657,7 +33644,7 @@ const makeDTXRenderingAttributes = function(programVariables, isTriangle) {
33657
33644
  geometryParameters: {
33658
33645
  attributes: {
33659
33646
  color: colorA,
33660
- flags: iota$2(4).map(i => `int(flags[${i}])`),
33647
+ flags: iota$3(4).map(i => `int(flags[${i}])`),
33661
33648
  metallicRoughness: null,
33662
33649
  normal: {
33663
33650
  view: viewNormal,
@@ -33949,7 +33936,7 @@ const tempVec3g = math.vec3();
33949
33936
  const tempUint8Array4 = new Uint8Array(4);
33950
33937
  const matricesUniformBlockBufferData = new Float32Array(4 * 4 * 6); // there is 6 mat4
33951
33938
 
33952
- const iota$1 = function(n) {
33939
+ const iota$2 = function(n) {
33953
33940
  const ret = [ ];
33954
33941
  for (let i = 0; i < n; ++i) ret.push(i);
33955
33942
  return ret;
@@ -34496,7 +34483,6 @@ class VBOLayer extends Layer {
34496
34483
 
34497
34484
  const solid = (primitive === "solid");
34498
34485
  return {
34499
- edgesColorOpaqueAllowed: () => true,
34500
34486
  solid: solid,
34501
34487
  sortId: (((primitive === "points") ? "Points" : ((primitive === "lines") ? "Lines" : "Triangles"))
34502
34488
  + (instancing ? "Instancing" : "Batching") + "Layer" +
@@ -34877,8 +34863,8 @@ const makeVBORenderingAttributes = function(programVariables, instancing, entity
34877
34863
  metallicRoughness: createAttribute("vec2", "metallicRoughness"),
34878
34864
  flags: createAttribute("float", "flagsA"),
34879
34865
  offset: entityOffsetsEnabled && createAttribute("vec3", "offset"),
34880
- modelMatrixCol: instancing && iota$1(3).map(i => createAttribute("vec4", "modelMatrixCol" + i)),
34881
- modelNormalMatrixCol: instancing && instancing.hasModelNormalMat && iota$1(3).map(i => createAttribute("vec4", "modelNormalMatrixCol" + i))
34866
+ modelMatrixCol: instancing && iota$2(3).map(i => createAttribute("vec4", "modelMatrixCol" + i)),
34867
+ modelNormalMatrixCol: instancing && instancing.hasModelNormalMat && iota$2(3).map(i => createAttribute("vec4", "modelNormalMatrixCol" + i))
34882
34868
  };
34883
34869
 
34884
34870
  const uvA = lazyShaderVariable("aUv");
@@ -34909,7 +34895,7 @@ const makeVBORenderingAttributes = function(programVariables, instancing, entity
34909
34895
  geometryParameters: {
34910
34896
  attributes: {
34911
34897
  color: attributes.color,
34912
- flags: iota$1(4).map(i => ({ toString: () => `(int(${attributes.flags}) >> ${i * 4} & 0xF)` })),
34898
+ flags: iota$2(4).map(i => ({ toString: () => `(int(${attributes.flags}) >> ${i * 4} & 0xF)` })),
34913
34899
  metallicRoughness: attributes.metallicRoughness,
34914
34900
  normal: {
34915
34901
  view: viewNormal,
@@ -40720,7 +40706,7 @@ class SceneModel extends Component {
40720
40706
  const positionsDecodeHash = posDecode ? this._createHashStringFromMatrix(posDecode) : "-";
40721
40707
  const textureSetId = cfg.textureSetId || "-";
40722
40708
  const geometryId = instancing ? cfg.geometryId : "-";
40723
- const layerId = (instancing ? "instancing" : "batching") + `.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${primitive}.${positionsDecodeHash}.${textureSetId}.${geometryId}`;
40709
+ const layerId = (instancing ? "instancing" : "batching") + `.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${primitive}.${positionsDecodeHash}.${textureSetId}.${geometryId}.${((cfg.normalsCompressed || cfg.normals || [ ]).length > 0) ? "n" : "-"}`;
40724
40710
 
40725
40711
  if ((! instancing) && (layerId in this._vboLayers)) {
40726
40712
  const layer = this._vboLayers[layerId];
@@ -47131,9 +47117,9 @@ class OcclusionTester {
47131
47117
 
47132
47118
  const vec3_0 = math.vec3([0,0,0]);
47133
47119
 
47134
- const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
47120
+ const iota$1 = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
47135
47121
 
47136
- const tempPlanes = iota(6).map(() => math.vec4());
47122
+ const tempPlanes = iota$1(6).map(() => math.vec4());
47137
47123
  const tempVec4 = math.vec4();
47138
47124
 
47139
47125
  const bitShiftScreenZ = math.vec4([1.0 / (256.0 * 256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0]);
@@ -47464,7 +47450,7 @@ const Renderer$1 = function (scene, options) {
47464
47450
  const sampleOffsetsHor = createSampleOffsets([1, 0]);
47465
47451
 
47466
47452
  const gaussian = (i, stdDev) => Math.exp(-(i * i) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev);
47467
- const sampleWeights = new Float32Array(iota(KERNEL_RADIUS + 1).map(i => gaussian(i, blurStdDev))); // TODO: Optimize
47453
+ const sampleWeights = new Float32Array(iota$1(KERNEL_RADIUS + 1).map(i => gaussian(i, blurStdDev))); // TODO: Optimize
47468
47454
 
47469
47455
  const programVariablesState = createProgramVariablesState();
47470
47456
 
@@ -62767,6 +62753,20 @@ class MetaScene {
62767
62753
  return metaModel;
62768
62754
  }
62769
62755
 
62756
+ /**
62757
+ * Destroys this MetaScene.
62758
+ */
62759
+ _destroy() {
62760
+ this.viewer = null;
62761
+ this.scene = null;
62762
+ this.metaModels = {};
62763
+ this.propertySets = {};
62764
+ this.metaObjects = {};
62765
+ this.metaObjectsByType = {};
62766
+ this.rootMetaObjects = {};
62767
+ this._eventSubs = {};
62768
+ }
62769
+
62770
62770
  /**
62771
62771
  * Removes a {@link MetaModel} from this MetaScene.
62772
62772
  *
@@ -101821,10 +101821,25 @@ class Label3D {
101821
101821
  this.__visible = true;
101822
101822
 
101823
101823
  this._updatePos = () => {
101824
- toClipSpace(camera, this._start, tmpVec4a);
101825
- math.mulVec4Scalar(tmpVec4a, 1.0 / tmpVec4a[3]);
101826
- toCanvasSpace(scene.canvas.canvas, parentElement, tmpVec4a, tmpVec2a);
101827
- this._label.setPos(tmpVec2a[0], tmpVec2a[1]);
101824
+ const p0 = tmpVec4a;
101825
+ toClipSpace(camera, this._start, p0);
101826
+ math.mulVec3Scalar(p0, 1.0 / p0[3]);
101827
+
101828
+ const outsideFrustum = ((p0[3] < 0)
101829
+ ||
101830
+ (p0[0] < -1) || (p0[0] > 1)
101831
+ ||
101832
+ (p0[1] < -1) || (p0[1] > 1)
101833
+ ||
101834
+ (p0[2] < -1) || (p0[2] > 1));
101835
+ const culled = outsideFrustum || scene._sectionPlanesState.sectionPlanes.some(
101836
+ plane => plane.active && (math.dotVec3(plane.dir, math.subVec3(plane.pos, this._start, tmpVec3a$2)) > 0));
101837
+
101838
+ this._label.setCulled(culled);
101839
+ if (! culled) {
101840
+ toCanvasSpace(scene.canvas.canvas, parentElement, p0, tmpVec2a);
101841
+ this._label.setPos(tmpVec2a[0], tmpVec2a[1]);
101842
+ }
101828
101843
  };
101829
101844
 
101830
101845
  const setPosOnWire = (p0, p1, yOff) => {
@@ -103336,6 +103351,7 @@ class Viewer {
103336
103351
  const plugin = plugins[i];
103337
103352
  plugin.destroy();
103338
103353
  }
103354
+ this.metaScene._destroy();
103339
103355
  this.scene.destroy();
103340
103356
  }
103341
103357
  }
@@ -104761,7 +104777,7 @@ class AngleMeasurementsPlugin extends Plugin {
104761
104777
  * @param {Viewer} viewer The Viewer.
104762
104778
  * @param {Object} [cfg] Plugin configuration.
104763
104779
  * @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
104764
- * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
104780
+ * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
104765
104781
  * @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
104766
104782
  * @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
104767
104783
  * @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
@@ -106804,7 +106820,7 @@ class AnnotationsPlugin extends Plugin {
106804
106820
  * @param {String} [cfg.id="Annotations"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
106805
106821
  * @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````.
106806
106822
  * @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````.
106807
- * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
106823
+ * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
106808
106824
  * @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.
106809
106825
  * @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of
106810
106826
  * its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.
@@ -109748,7 +109764,7 @@ class DistanceMeasurementsPlugin extends Plugin {
109748
109764
  * @param {Object} [cfg] Plugin configuration.
109749
109765
  * @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
109750
109766
  * @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
109751
- * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````.
109767
+ * @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body````, but different element should be specified to capture it with {@link Viewer.getSnapshotWithPlugins}.
109752
109768
  * @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
109753
109769
  * @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
109754
109770
  * @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
@@ -111490,6 +111506,13 @@ function getBasePath$1(src) {
111490
111506
  return (i !== 0) ? src.substring(0, i + 1) : "";
111491
111507
  }
111492
111508
 
111509
+ const iota = n => {
111510
+ const ret = [ ];
111511
+ for (let i = 0; i < n; ++i)
111512
+ ret.push(i);
111513
+ return ret;
111514
+ };
111515
+
111493
111516
  /**
111494
111517
  * @private
111495
111518
  */
@@ -112053,6 +112076,51 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
112053
112076
  meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
112054
112077
  meshCfg.opacity = 1.0;
112055
112078
  }
112079
+ const POSITION = primitive.attributes.POSITION;
112080
+ if (!POSITION) {
112081
+ continue;
112082
+ }
112083
+ meshCfg.localPositions = POSITION.value;
112084
+ meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
112085
+ if (primitive.attributes.NORMAL) {
112086
+ meshCfg.normals = primitive.attributes.NORMAL.value;
112087
+ }
112088
+ if (primitive.attributes.TEXCOORD_0) {
112089
+ meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
112090
+ }
112091
+ if (primitive.indices) {
112092
+ meshCfg.indices = primitive.indices.value;
112093
+ }
112094
+ if (matrix) {
112095
+ math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
112096
+ } else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
112097
+ meshCfg.positions.set(meshCfg.localPositions);
112098
+ }
112099
+ const linearize = closeLoop => {
112100
+ const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
112101
+ const len = indices.length;
112102
+ const cnt = closeLoop ? len : (len - 1);
112103
+ const linesIndices = new Uint32Array(cnt * 2);
112104
+ for (let i = 0; i < cnt; ++i) {
112105
+ const idx = i * 2;
112106
+ linesIndices[idx] = indices[i];
112107
+ linesIndices[idx+1] = indices[(i+1) % len];
112108
+ }
112109
+ meshCfg.indices = linesIndices;
112110
+ };
112111
+ const triangularize = getFirstPoint => {
112112
+ const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
112113
+ const len = indices.length;
112114
+ const cnt = len - 2;
112115
+ const trianglesIndices = new Uint32Array(cnt * 3);
112116
+ for (let i = 0; i < cnt; ++i) {
112117
+ const idx = i * 3;
112118
+ trianglesIndices[idx] = getFirstPoint(indices, i);
112119
+ trianglesIndices[idx+1] = indices[(i+1) % len];
112120
+ trianglesIndices[idx+2] = indices[(i+2) % len];
112121
+ }
112122
+ meshCfg.indices = trianglesIndices;
112123
+ };
112056
112124
  const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
112057
112125
  switch (primitive.mode) {
112058
112126
  case 0: // POINTS
@@ -112063,42 +112131,26 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
112063
112131
  break;
112064
112132
  case 2: // LINE_LOOP
112065
112133
  meshCfg.primitive = "lines";
112134
+ linearize(true);
112066
112135
  break;
112067
112136
  case 3: // LINE_STRIP
112068
112137
  meshCfg.primitive = "lines";
112138
+ linearize(false);
112069
112139
  break;
112070
112140
  case 4: // TRIANGLES
112071
112141
  meshCfg.primitive = backfaces ? "triangles" : "solid";
112072
112142
  break;
112073
112143
  case 5: // TRIANGLE_STRIP
112074
112144
  meshCfg.primitive = backfaces ? "triangles" : "solid";
112145
+ triangularize((indices, i) => indices[i]);
112075
112146
  break;
112076
112147
  case 6: // TRIANGLE_FAN
112077
112148
  meshCfg.primitive = backfaces ? "triangles" : "solid";
112149
+ triangularize((indices, i) => indices[0]);
112078
112150
  break;
112079
112151
  default:
112080
112152
  meshCfg.primitive = backfaces ? "triangles" : "solid";
112081
112153
  }
112082
- const POSITION = primitive.attributes.POSITION;
112083
- if (!POSITION) {
112084
- continue;
112085
- }
112086
- meshCfg.localPositions = POSITION.value;
112087
- meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
112088
- if (primitive.attributes.NORMAL) {
112089
- meshCfg.normals = primitive.attributes.NORMAL.value;
112090
- }
112091
- if (primitive.attributes.TEXCOORD_0) {
112092
- meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
112093
- }
112094
- if (primitive.indices) {
112095
- meshCfg.indices = primitive.indices.value;
112096
- }
112097
- if (matrix) {
112098
- math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
112099
- } else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
112100
- meshCfg.positions.set(meshCfg.localPositions);
112101
- }
112102
112154
  const origin = math.vec3();
112103
112155
  const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
112104
112156
  if (rtcNeeded) {