@xeokit/xeokit-sdk 2.6.108 → 2.6.111
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.
- package/dist/xeokit-sdk.cjs.js +111 -76
- package/dist/xeokit-sdk.es.js +111 -76
- package/dist/xeokit-sdk.es5.js +1576 -1565
- package/dist/xeokit-sdk.min.cjs.js +7 -7
- package/dist/xeokit-sdk.min.es.js +8 -8
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +10 -30
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.js +1 -1
- package/src/plugins/AnnotationsPlugin/AnnotationsPlugin.js +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +56 -20
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +26 -5
- package/src/viewer/scene/CameraControl/lib/CameraUpdater.js +9 -17
- package/src/viewer/scene/model/SceneModel.js +1 -1
- package/src/viewer/scene/model/layer/DTXLayer.js +0 -11
- package/src/viewer/scene/model/layer/Layer.js +1 -3
- package/src/viewer/scene/model/layer/VBOLayer.js +0 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +1 -1
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/XKTLoaderPlugin/XKTLoaderPlugin.d.ts +2 -0
- package/types/plugins/lib/ui/index.d.ts +4 -4
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* xeokit-sdk v2.6.
|
|
3
|
-
* Commit:
|
|
4
|
-
* Built: 2026-
|
|
2
|
+
* xeokit-sdk v2.6.111
|
|
3
|
+
* Commit: f70838c6581084cf8401daf800ff7c14582ec11a
|
|
4
|
+
* Built: 2026-05-27T11:07:01.143Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
if (typeof window !== 'undefined') {
|
|
8
|
-
window.__XEOKIT__ = { version: '2.6.
|
|
8
|
+
window.__XEOKIT__ = { version: '2.6.111', commit: 'f70838c6581084cf8401daf800ff7c14582ec11a', built: '2026-05-27T11:07:01.143Z' };
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -20737,7 +20737,7 @@ const tempVec3a$f = math.vec3();
|
|
|
20737
20737
|
const tempVec4$3 = math.vec4();
|
|
20738
20738
|
const TEXTURE_DECODE_FUNCS = { [sRGBEncoding]: "sRGBToLinear" };
|
|
20739
20739
|
|
|
20740
|
-
const iota$
|
|
20740
|
+
const iota$4 = function(n) {
|
|
20741
20741
|
const ret = [ ];
|
|
20742
20742
|
for (let i = 0; i < n; ++i) ret.push(i);
|
|
20743
20743
|
return ret;
|
|
@@ -20936,7 +20936,7 @@ const createProgramVariablesState = function() {
|
|
|
20936
20936
|
|
|
20937
20937
|
const sectionPlanesState = cfg.sectionPlanesState;
|
|
20938
20938
|
const getClippingDistance = sectionPlanesState && (function() {
|
|
20939
|
-
const allocatedUniforms = iota$
|
|
20939
|
+
const allocatedUniforms = iota$4(sectionPlanesState.getNumAllocatedSectionPlanes()).map(i => {
|
|
20940
20940
|
const sectionPlaneUniform = (type, postfix, getValue) => {
|
|
20941
20941
|
return programVariables.createUniform(type, `sectionPlane${postfix}${i}`, (set, state) => {
|
|
20942
20942
|
const sectionPlanes = sectionPlanesState.sectionPlanes;
|
|
@@ -32539,9 +32539,7 @@ class Layer {
|
|
|
32539
32539
|
}
|
|
32540
32540
|
|
|
32541
32541
|
drawEdgesColorOpaque(renderFlags, frameCtx) {
|
|
32542
|
-
|
|
32543
|
-
this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
|
|
32544
|
-
}
|
|
32542
|
+
this.__drawVertexEdges(renderFlags, frameCtx, RENDER_PASSES.EDGES_COLOR_OPAQUE);
|
|
32545
32543
|
}
|
|
32546
32544
|
|
|
32547
32545
|
drawEdgesColorTransparent(renderFlags, frameCtx) {
|
|
@@ -32832,7 +32830,7 @@ class Configs {
|
|
|
32832
32830
|
}
|
|
32833
32831
|
}
|
|
32834
32832
|
|
|
32835
|
-
const iota$
|
|
32833
|
+
const iota$3 = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
32836
32834
|
|
|
32837
32835
|
const dataTextureRamStats = {
|
|
32838
32836
|
sizeDataColorsAndFlags: 0,
|
|
@@ -33414,17 +33412,6 @@ class DTXLayer extends Layer {
|
|
|
33414
33412
|
};
|
|
33415
33413
|
|
|
33416
33414
|
return {
|
|
33417
|
-
edgesColorOpaqueAllowed: () => {
|
|
33418
|
-
if (scene.logarithmicDepthBufferEnabled) {
|
|
33419
|
-
if (!scene._loggedWarning) {
|
|
33420
|
-
console.log("Edge enhancement for SceneModel data texture layers currently disabled with logarithmic depth buffer");
|
|
33421
|
-
scene._loggedWarning = true;
|
|
33422
|
-
}
|
|
33423
|
-
return false;
|
|
33424
|
-
} else {
|
|
33425
|
-
return true;
|
|
33426
|
-
}
|
|
33427
|
-
},
|
|
33428
33415
|
sortId: sortId,
|
|
33429
33416
|
setClippableFlags: setFlags2,
|
|
33430
33417
|
setFlags: (portionId, flags, transparent, deferred = false) => {
|
|
@@ -33661,7 +33648,7 @@ const makeDTXRenderingAttributes = function(programVariables, isTriangle) {
|
|
|
33661
33648
|
geometryParameters: {
|
|
33662
33649
|
attributes: {
|
|
33663
33650
|
color: colorA,
|
|
33664
|
-
flags: iota$
|
|
33651
|
+
flags: iota$3(4).map(i => `int(flags[${i}])`),
|
|
33665
33652
|
metallicRoughness: null,
|
|
33666
33653
|
normal: {
|
|
33667
33654
|
view: viewNormal,
|
|
@@ -33953,7 +33940,7 @@ const tempVec3g = math.vec3();
|
|
|
33953
33940
|
const tempUint8Array4 = new Uint8Array(4);
|
|
33954
33941
|
const matricesUniformBlockBufferData = new Float32Array(4 * 4 * 6); // there is 6 mat4
|
|
33955
33942
|
|
|
33956
|
-
const iota$
|
|
33943
|
+
const iota$2 = function(n) {
|
|
33957
33944
|
const ret = [ ];
|
|
33958
33945
|
for (let i = 0; i < n; ++i) ret.push(i);
|
|
33959
33946
|
return ret;
|
|
@@ -34500,7 +34487,6 @@ class VBOLayer extends Layer {
|
|
|
34500
34487
|
|
|
34501
34488
|
const solid = (primitive === "solid");
|
|
34502
34489
|
return {
|
|
34503
|
-
edgesColorOpaqueAllowed: () => true,
|
|
34504
34490
|
solid: solid,
|
|
34505
34491
|
sortId: (((primitive === "points") ? "Points" : ((primitive === "lines") ? "Lines" : "Triangles"))
|
|
34506
34492
|
+ (instancing ? "Instancing" : "Batching") + "Layer" +
|
|
@@ -34881,8 +34867,8 @@ const makeVBORenderingAttributes = function(programVariables, instancing, entity
|
|
|
34881
34867
|
metallicRoughness: createAttribute("vec2", "metallicRoughness"),
|
|
34882
34868
|
flags: createAttribute("float", "flagsA"),
|
|
34883
34869
|
offset: entityOffsetsEnabled && createAttribute("vec3", "offset"),
|
|
34884
|
-
modelMatrixCol: instancing && iota$
|
|
34885
|
-
modelNormalMatrixCol: instancing && instancing.hasModelNormalMat && iota$
|
|
34870
|
+
modelMatrixCol: instancing && iota$2(3).map(i => createAttribute("vec4", "modelMatrixCol" + i)),
|
|
34871
|
+
modelNormalMatrixCol: instancing && instancing.hasModelNormalMat && iota$2(3).map(i => createAttribute("vec4", "modelNormalMatrixCol" + i))
|
|
34886
34872
|
};
|
|
34887
34873
|
|
|
34888
34874
|
const uvA = lazyShaderVariable("aUv");
|
|
@@ -34913,7 +34899,7 @@ const makeVBORenderingAttributes = function(programVariables, instancing, entity
|
|
|
34913
34899
|
geometryParameters: {
|
|
34914
34900
|
attributes: {
|
|
34915
34901
|
color: attributes.color,
|
|
34916
|
-
flags: iota$
|
|
34902
|
+
flags: iota$2(4).map(i => ({ toString: () => `(int(${attributes.flags}) >> ${i * 4} & 0xF)` })),
|
|
34917
34903
|
metallicRoughness: attributes.metallicRoughness,
|
|
34918
34904
|
normal: {
|
|
34919
34905
|
view: viewNormal,
|
|
@@ -40724,7 +40710,7 @@ class SceneModel extends Component {
|
|
|
40724
40710
|
const positionsDecodeHash = posDecode ? this._createHashStringFromMatrix(posDecode) : "-";
|
|
40725
40711
|
const textureSetId = cfg.textureSetId || "-";
|
|
40726
40712
|
const geometryId = instancing ? cfg.geometryId : "-";
|
|
40727
|
-
const layerId = (instancing ? "instancing" : "batching") + `.${Math.round(origin[0])}.${Math.round(origin[1])}.${Math.round(origin[2])}.${primitive}.${positionsDecodeHash}.${textureSetId}.${geometryId}`;
|
|
40713
|
+
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" : "-"}`;
|
|
40728
40714
|
|
|
40729
40715
|
if ((! instancing) && (layerId in this._vboLayers)) {
|
|
40730
40716
|
const layer = this._vboLayers[layerId];
|
|
@@ -47135,9 +47121,9 @@ class OcclusionTester {
|
|
|
47135
47121
|
|
|
47136
47122
|
const vec3_0 = math.vec3([0,0,0]);
|
|
47137
47123
|
|
|
47138
|
-
const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47124
|
+
const iota$1 = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47139
47125
|
|
|
47140
|
-
const tempPlanes = iota(6).map(() => math.vec4());
|
|
47126
|
+
const tempPlanes = iota$1(6).map(() => math.vec4());
|
|
47141
47127
|
const tempVec4 = math.vec4();
|
|
47142
47128
|
|
|
47143
47129
|
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]);
|
|
@@ -47468,7 +47454,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
47468
47454
|
const sampleOffsetsHor = createSampleOffsets([1, 0]);
|
|
47469
47455
|
|
|
47470
47456
|
const gaussian = (i, stdDev) => Math.exp(-(i * i) / (2.0 * (stdDev * stdDev))) / (Math.sqrt(2.0 * Math.PI) * stdDev);
|
|
47471
|
-
const sampleWeights = new Float32Array(iota(KERNEL_RADIUS + 1).map(i => gaussian(i, blurStdDev))); // TODO: Optimize
|
|
47457
|
+
const sampleWeights = new Float32Array(iota$1(KERNEL_RADIUS + 1).map(i => gaussian(i, blurStdDev))); // TODO: Optimize
|
|
47472
47458
|
|
|
47473
47459
|
const programVariablesState = createProgramVariablesState();
|
|
47474
47460
|
|
|
@@ -59091,26 +59077,18 @@ class CameraUpdater {
|
|
|
59091
59077
|
|
|
59092
59078
|
if (updates.rotateDeltaY !== 0 || updates.rotateDeltaX !== 0) {
|
|
59093
59079
|
|
|
59094
|
-
if (
|
|
59095
|
-
pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
|
|
59096
|
-
pivotController.showPivot();
|
|
59097
|
-
|
|
59098
|
-
} else {
|
|
59099
|
-
|
|
59080
|
+
if (configs.firstPerson) {
|
|
59100
59081
|
if (updates.rotateDeltaX !== 0) {
|
|
59101
|
-
|
|
59102
|
-
camera.pitch(-updates.rotateDeltaX);
|
|
59103
|
-
} else {
|
|
59104
|
-
camera.orbitPitch(updates.rotateDeltaX);
|
|
59105
|
-
}
|
|
59082
|
+
camera.pitch(-updates.rotateDeltaX);
|
|
59106
59083
|
}
|
|
59107
|
-
|
|
59108
59084
|
if (updates.rotateDeltaY !== 0) {
|
|
59109
|
-
|
|
59110
|
-
|
|
59111
|
-
|
|
59112
|
-
|
|
59113
|
-
|
|
59085
|
+
camera.yaw(updates.rotateDeltaY);
|
|
59086
|
+
}
|
|
59087
|
+
}
|
|
59088
|
+
else {
|
|
59089
|
+
if (configs.followPointer && pivotController.getPivoting()){
|
|
59090
|
+
pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
|
|
59091
|
+
pivotController.showPivot();
|
|
59114
59092
|
}
|
|
59115
59093
|
}
|
|
59116
59094
|
|
|
@@ -104795,7 +104773,7 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
104795
104773
|
* @param {Viewer} viewer The Viewer.
|
|
104796
104774
|
* @param {Object} [cfg] Plugin configuration.
|
|
104797
104775
|
* @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
104798
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
104776
|
+
* @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}.
|
|
104799
104777
|
* @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
|
|
104800
104778
|
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
|
|
104801
104779
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
@@ -106838,7 +106816,7 @@ class AnnotationsPlugin extends Plugin {
|
|
|
106838
106816
|
* @param {String} [cfg.id="Annotations"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
106839
106817
|
* @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````.
|
|
106840
106818
|
* @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````.
|
|
106841
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
106819
|
+
* @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}.
|
|
106842
106820
|
* @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.
|
|
106843
106821
|
* @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of
|
|
106844
106822
|
* its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.
|
|
@@ -109782,7 +109760,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
109782
109760
|
* @param {Object} [cfg] Plugin configuration.
|
|
109783
109761
|
* @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
109784
109762
|
* @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
|
|
109785
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
109763
|
+
* @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}.
|
|
109786
109764
|
* @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
|
|
109787
109765
|
* @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
|
|
109788
109766
|
* @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
|
|
@@ -111524,6 +111502,13 @@ function getBasePath$1(src) {
|
|
|
111524
111502
|
return (i !== 0) ? src.substring(0, i + 1) : "";
|
|
111525
111503
|
}
|
|
111526
111504
|
|
|
111505
|
+
const iota = n => {
|
|
111506
|
+
const ret = [ ];
|
|
111507
|
+
for (let i = 0; i < n; ++i)
|
|
111508
|
+
ret.push(i);
|
|
111509
|
+
return ret;
|
|
111510
|
+
};
|
|
111511
|
+
|
|
111527
111512
|
/**
|
|
111528
111513
|
* @private
|
|
111529
111514
|
*/
|
|
@@ -112087,6 +112072,51 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112087
112072
|
meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
|
|
112088
112073
|
meshCfg.opacity = 1.0;
|
|
112089
112074
|
}
|
|
112075
|
+
const POSITION = primitive.attributes.POSITION;
|
|
112076
|
+
if (!POSITION) {
|
|
112077
|
+
continue;
|
|
112078
|
+
}
|
|
112079
|
+
meshCfg.localPositions = POSITION.value;
|
|
112080
|
+
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112081
|
+
if (primitive.attributes.NORMAL) {
|
|
112082
|
+
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112083
|
+
}
|
|
112084
|
+
if (primitive.attributes.TEXCOORD_0) {
|
|
112085
|
+
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112086
|
+
}
|
|
112087
|
+
if (primitive.indices) {
|
|
112088
|
+
meshCfg.indices = primitive.indices.value;
|
|
112089
|
+
}
|
|
112090
|
+
if (matrix) {
|
|
112091
|
+
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112092
|
+
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112093
|
+
meshCfg.positions.set(meshCfg.localPositions);
|
|
112094
|
+
}
|
|
112095
|
+
const linearize = closeLoop => {
|
|
112096
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112097
|
+
const len = indices.length;
|
|
112098
|
+
const cnt = closeLoop ? len : (len - 1);
|
|
112099
|
+
const linesIndices = new Uint32Array(cnt * 2);
|
|
112100
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112101
|
+
const idx = i * 2;
|
|
112102
|
+
linesIndices[idx] = indices[i];
|
|
112103
|
+
linesIndices[idx+1] = indices[(i+1) % len];
|
|
112104
|
+
}
|
|
112105
|
+
meshCfg.indices = linesIndices;
|
|
112106
|
+
};
|
|
112107
|
+
const triangularize = getFirstPoint => {
|
|
112108
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112109
|
+
const len = indices.length;
|
|
112110
|
+
const cnt = len - 2;
|
|
112111
|
+
const trianglesIndices = new Uint32Array(cnt * 3);
|
|
112112
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112113
|
+
const idx = i * 3;
|
|
112114
|
+
trianglesIndices[idx] = getFirstPoint(indices, i);
|
|
112115
|
+
trianglesIndices[idx+1] = indices[(i+1) % len];
|
|
112116
|
+
trianglesIndices[idx+2] = indices[(i+2) % len];
|
|
112117
|
+
}
|
|
112118
|
+
meshCfg.indices = trianglesIndices;
|
|
112119
|
+
};
|
|
112090
112120
|
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
112091
112121
|
switch (primitive.mode) {
|
|
112092
112122
|
case 0: // POINTS
|
|
@@ -112097,42 +112127,26 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112097
112127
|
break;
|
|
112098
112128
|
case 2: // LINE_LOOP
|
|
112099
112129
|
meshCfg.primitive = "lines";
|
|
112130
|
+
linearize(true);
|
|
112100
112131
|
break;
|
|
112101
112132
|
case 3: // LINE_STRIP
|
|
112102
112133
|
meshCfg.primitive = "lines";
|
|
112134
|
+
linearize(false);
|
|
112103
112135
|
break;
|
|
112104
112136
|
case 4: // TRIANGLES
|
|
112105
112137
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112106
112138
|
break;
|
|
112107
112139
|
case 5: // TRIANGLE_STRIP
|
|
112108
112140
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112141
|
+
triangularize((indices, i) => indices[i]);
|
|
112109
112142
|
break;
|
|
112110
112143
|
case 6: // TRIANGLE_FAN
|
|
112111
112144
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112145
|
+
triangularize((indices, i) => indices[0]);
|
|
112112
112146
|
break;
|
|
112113
112147
|
default:
|
|
112114
112148
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112115
112149
|
}
|
|
112116
|
-
const POSITION = primitive.attributes.POSITION;
|
|
112117
|
-
if (!POSITION) {
|
|
112118
|
-
continue;
|
|
112119
|
-
}
|
|
112120
|
-
meshCfg.localPositions = POSITION.value;
|
|
112121
|
-
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112122
|
-
if (primitive.attributes.NORMAL) {
|
|
112123
|
-
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112124
|
-
}
|
|
112125
|
-
if (primitive.attributes.TEXCOORD_0) {
|
|
112126
|
-
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112127
|
-
}
|
|
112128
|
-
if (primitive.indices) {
|
|
112129
|
-
meshCfg.indices = primitive.indices.value;
|
|
112130
|
-
}
|
|
112131
|
-
if (matrix) {
|
|
112132
|
-
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112133
|
-
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112134
|
-
meshCfg.positions.set(meshCfg.localPositions);
|
|
112135
|
-
}
|
|
112136
112150
|
const origin = math.vec3();
|
|
112137
112151
|
const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
|
|
112138
112152
|
if (rtcNeeded) {
|
|
@@ -127254,6 +127268,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127254
127268
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
127255
127269
|
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
127256
127270
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
127271
|
+
* @param {Boolean} [params.loadIntoMetaScene=true] Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata.
|
|
127257
127272
|
* @param {String} [params.manifestSrc] Path or URL to a JSON manifest file that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
127258
127273
|
* multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.
|
|
127259
127274
|
* @param {Object} [params.manifest] A JSON manifest object (as an alternative to a path or URL) that provides paths to ````.xkt```` files to load as parts of the model. Use this option to load models that have been split into
|
|
@@ -127349,10 +127364,30 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127349
127364
|
|
|
127350
127365
|
const modelId = sceneModel.id; // In case ID was auto-generated
|
|
127351
127366
|
|
|
127352
|
-
const
|
|
127353
|
-
|
|
127354
|
-
|
|
127355
|
-
|
|
127367
|
+
const loadIntoMetaScene = (! ("loadIntoMetaScene" in params)) || params.loadIntoMetaScene;
|
|
127368
|
+
const metaModel = (loadIntoMetaScene
|
|
127369
|
+
? new MetaModel({
|
|
127370
|
+
id: modelId,
|
|
127371
|
+
metaScene: this.viewer.metaScene
|
|
127372
|
+
})
|
|
127373
|
+
: (function() {
|
|
127374
|
+
let firstMetadata = null;
|
|
127375
|
+
let modelMetadata = null;
|
|
127376
|
+
return {
|
|
127377
|
+
loadData: metadata => {
|
|
127378
|
+
if (! firstMetadata) {
|
|
127379
|
+
firstMetadata = metadata;
|
|
127380
|
+
} else {
|
|
127381
|
+
if (! modelMetadata) {
|
|
127382
|
+
modelMetadata = { };
|
|
127383
|
+
Object.entries(firstMetadata).forEach(([ k, v ]) => modelMetadata[k] = Array.isArray(v) ? v.slice(0) : v);
|
|
127384
|
+
}
|
|
127385
|
+
Object.entries(metadata).forEach(([ k, v ]) => { if (Array.isArray(v)) { v.forEach(e => modelMetadata[k].push(e)); } });
|
|
127386
|
+
}
|
|
127387
|
+
},
|
|
127388
|
+
finalize: () => sceneModel.metadata = modelMetadata || firstMetadata
|
|
127389
|
+
};
|
|
127390
|
+
})());
|
|
127356
127391
|
|
|
127357
127392
|
this.viewer.scene.canvas.spinner.processes++;
|
|
127358
127393
|
|
|
@@ -127365,7 +127400,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127365
127400
|
metaModel.finalize();
|
|
127366
127401
|
this.viewer.scene.canvas.spinner.processes--;
|
|
127367
127402
|
sceneModel.once("destroyed", () => {
|
|
127368
|
-
this.viewer.metaScene.destroyMetaModel(metaModel.id);
|
|
127403
|
+
loadIntoMetaScene && this.viewer.metaScene.destroyMetaModel(metaModel.id);
|
|
127369
127404
|
});
|
|
127370
127405
|
this.scheduleTask(() => {
|
|
127371
127406
|
if (sceneModel.destroyed) {
|