@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.es.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
|
/** @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$
|
|
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$
|
|
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
|
-
|
|
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$
|
|
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$
|
|
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$
|
|
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$
|
|
34881
|
-
modelNormalMatrixCol: instancing && instancing.hasModelNormalMat && iota$
|
|
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$
|
|
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
|
|
|
@@ -59087,26 +59073,18 @@ class CameraUpdater {
|
|
|
59087
59073
|
|
|
59088
59074
|
if (updates.rotateDeltaY !== 0 || updates.rotateDeltaX !== 0) {
|
|
59089
59075
|
|
|
59090
|
-
if (
|
|
59091
|
-
pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
|
|
59092
|
-
pivotController.showPivot();
|
|
59093
|
-
|
|
59094
|
-
} else {
|
|
59095
|
-
|
|
59076
|
+
if (configs.firstPerson) {
|
|
59096
59077
|
if (updates.rotateDeltaX !== 0) {
|
|
59097
|
-
|
|
59098
|
-
camera.pitch(-updates.rotateDeltaX);
|
|
59099
|
-
} else {
|
|
59100
|
-
camera.orbitPitch(updates.rotateDeltaX);
|
|
59101
|
-
}
|
|
59078
|
+
camera.pitch(-updates.rotateDeltaX);
|
|
59102
59079
|
}
|
|
59103
|
-
|
|
59104
59080
|
if (updates.rotateDeltaY !== 0) {
|
|
59105
|
-
|
|
59106
|
-
|
|
59107
|
-
|
|
59108
|
-
|
|
59109
|
-
|
|
59081
|
+
camera.yaw(updates.rotateDeltaY);
|
|
59082
|
+
}
|
|
59083
|
+
}
|
|
59084
|
+
else {
|
|
59085
|
+
if (configs.followPointer && pivotController.getPivoting()){
|
|
59086
|
+
pivotController.continuePivot(updates.rotateDeltaY, updates.rotateDeltaX);
|
|
59087
|
+
pivotController.showPivot();
|
|
59110
59088
|
}
|
|
59111
59089
|
}
|
|
59112
59090
|
|
|
@@ -104791,7 +104769,7 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
104791
104769
|
* @param {Viewer} viewer The Viewer.
|
|
104792
104770
|
* @param {Object} [cfg] Plugin configuration.
|
|
104793
104771
|
* @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
104794
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
104772
|
+
* @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}.
|
|
104795
104773
|
* @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
|
|
104796
104774
|
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
|
|
104797
104775
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
@@ -106834,7 +106812,7 @@ class AnnotationsPlugin extends Plugin {
|
|
|
106834
106812
|
* @param {String} [cfg.id="Annotations"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
106835
106813
|
* @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````.
|
|
106836
106814
|
* @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````.
|
|
106837
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
106815
|
+
* @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}.
|
|
106838
106816
|
* @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.
|
|
106839
106817
|
* @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of
|
|
106840
106818
|
* its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.
|
|
@@ -109778,7 +109756,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
109778
109756
|
* @param {Object} [cfg] Plugin configuration.
|
|
109779
109757
|
* @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
109780
109758
|
* @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
|
|
109781
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
109759
|
+
* @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}.
|
|
109782
109760
|
* @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
|
|
109783
109761
|
* @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
|
|
109784
109762
|
* @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
|
|
@@ -111520,6 +111498,13 @@ function getBasePath$1(src) {
|
|
|
111520
111498
|
return (i !== 0) ? src.substring(0, i + 1) : "";
|
|
111521
111499
|
}
|
|
111522
111500
|
|
|
111501
|
+
const iota = n => {
|
|
111502
|
+
const ret = [ ];
|
|
111503
|
+
for (let i = 0; i < n; ++i)
|
|
111504
|
+
ret.push(i);
|
|
111505
|
+
return ret;
|
|
111506
|
+
};
|
|
111507
|
+
|
|
111523
111508
|
/**
|
|
111524
111509
|
* @private
|
|
111525
111510
|
*/
|
|
@@ -112083,6 +112068,51 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112083
112068
|
meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
|
|
112084
112069
|
meshCfg.opacity = 1.0;
|
|
112085
112070
|
}
|
|
112071
|
+
const POSITION = primitive.attributes.POSITION;
|
|
112072
|
+
if (!POSITION) {
|
|
112073
|
+
continue;
|
|
112074
|
+
}
|
|
112075
|
+
meshCfg.localPositions = POSITION.value;
|
|
112076
|
+
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112077
|
+
if (primitive.attributes.NORMAL) {
|
|
112078
|
+
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112079
|
+
}
|
|
112080
|
+
if (primitive.attributes.TEXCOORD_0) {
|
|
112081
|
+
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112082
|
+
}
|
|
112083
|
+
if (primitive.indices) {
|
|
112084
|
+
meshCfg.indices = primitive.indices.value;
|
|
112085
|
+
}
|
|
112086
|
+
if (matrix) {
|
|
112087
|
+
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112088
|
+
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112089
|
+
meshCfg.positions.set(meshCfg.localPositions);
|
|
112090
|
+
}
|
|
112091
|
+
const linearize = closeLoop => {
|
|
112092
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112093
|
+
const len = indices.length;
|
|
112094
|
+
const cnt = closeLoop ? len : (len - 1);
|
|
112095
|
+
const linesIndices = new Uint32Array(cnt * 2);
|
|
112096
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112097
|
+
const idx = i * 2;
|
|
112098
|
+
linesIndices[idx] = indices[i];
|
|
112099
|
+
linesIndices[idx+1] = indices[(i+1) % len];
|
|
112100
|
+
}
|
|
112101
|
+
meshCfg.indices = linesIndices;
|
|
112102
|
+
};
|
|
112103
|
+
const triangularize = getFirstPoint => {
|
|
112104
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112105
|
+
const len = indices.length;
|
|
112106
|
+
const cnt = len - 2;
|
|
112107
|
+
const trianglesIndices = new Uint32Array(cnt * 3);
|
|
112108
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112109
|
+
const idx = i * 3;
|
|
112110
|
+
trianglesIndices[idx] = getFirstPoint(indices, i);
|
|
112111
|
+
trianglesIndices[idx+1] = indices[(i+1) % len];
|
|
112112
|
+
trianglesIndices[idx+2] = indices[(i+2) % len];
|
|
112113
|
+
}
|
|
112114
|
+
meshCfg.indices = trianglesIndices;
|
|
112115
|
+
};
|
|
112086
112116
|
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
112087
112117
|
switch (primitive.mode) {
|
|
112088
112118
|
case 0: // POINTS
|
|
@@ -112093,42 +112123,26 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112093
112123
|
break;
|
|
112094
112124
|
case 2: // LINE_LOOP
|
|
112095
112125
|
meshCfg.primitive = "lines";
|
|
112126
|
+
linearize(true);
|
|
112096
112127
|
break;
|
|
112097
112128
|
case 3: // LINE_STRIP
|
|
112098
112129
|
meshCfg.primitive = "lines";
|
|
112130
|
+
linearize(false);
|
|
112099
112131
|
break;
|
|
112100
112132
|
case 4: // TRIANGLES
|
|
112101
112133
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112102
112134
|
break;
|
|
112103
112135
|
case 5: // TRIANGLE_STRIP
|
|
112104
112136
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112137
|
+
triangularize((indices, i) => indices[i]);
|
|
112105
112138
|
break;
|
|
112106
112139
|
case 6: // TRIANGLE_FAN
|
|
112107
112140
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112141
|
+
triangularize((indices, i) => indices[0]);
|
|
112108
112142
|
break;
|
|
112109
112143
|
default:
|
|
112110
112144
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112111
112145
|
}
|
|
112112
|
-
const POSITION = primitive.attributes.POSITION;
|
|
112113
|
-
if (!POSITION) {
|
|
112114
|
-
continue;
|
|
112115
|
-
}
|
|
112116
|
-
meshCfg.localPositions = POSITION.value;
|
|
112117
|
-
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112118
|
-
if (primitive.attributes.NORMAL) {
|
|
112119
|
-
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112120
|
-
}
|
|
112121
|
-
if (primitive.attributes.TEXCOORD_0) {
|
|
112122
|
-
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112123
|
-
}
|
|
112124
|
-
if (primitive.indices) {
|
|
112125
|
-
meshCfg.indices = primitive.indices.value;
|
|
112126
|
-
}
|
|
112127
|
-
if (matrix) {
|
|
112128
|
-
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112129
|
-
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112130
|
-
meshCfg.positions.set(meshCfg.localPositions);
|
|
112131
|
-
}
|
|
112132
112146
|
const origin = math.vec3();
|
|
112133
112147
|
const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
|
|
112134
112148
|
if (rtcNeeded) {
|
|
@@ -127250,6 +127264,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127250
127264
|
* @param {ArrayBuffer} [params.xkt] The *````.xkt````* file data, as an alternative to the ````src```` parameter.
|
|
127251
127265
|
* @param {String} [params.metaModelSrc] Path or URL to an optional metadata file, as an alternative to the ````metaModelData```` parameter.
|
|
127252
127266
|
* @param {*} [params.metaModelData] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
127267
|
+
* @param {Boolean} [params.loadIntoMetaScene=true] Whether to load metadata into MetaScene, otherwise expose as SceneModel::metadata.
|
|
127253
127268
|
* @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
|
|
127254
127269
|
* multiple XKT files. See [tutorial](https://xeokit.io/blog/automatically-splitting-large-models-for-better-performance) for more info.
|
|
127255
127270
|
* @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
|
|
@@ -127345,10 +127360,30 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127345
127360
|
|
|
127346
127361
|
const modelId = sceneModel.id; // In case ID was auto-generated
|
|
127347
127362
|
|
|
127348
|
-
const
|
|
127349
|
-
|
|
127350
|
-
|
|
127351
|
-
|
|
127363
|
+
const loadIntoMetaScene = (! ("loadIntoMetaScene" in params)) || params.loadIntoMetaScene;
|
|
127364
|
+
const metaModel = (loadIntoMetaScene
|
|
127365
|
+
? new MetaModel({
|
|
127366
|
+
id: modelId,
|
|
127367
|
+
metaScene: this.viewer.metaScene
|
|
127368
|
+
})
|
|
127369
|
+
: (function() {
|
|
127370
|
+
let firstMetadata = null;
|
|
127371
|
+
let modelMetadata = null;
|
|
127372
|
+
return {
|
|
127373
|
+
loadData: metadata => {
|
|
127374
|
+
if (! firstMetadata) {
|
|
127375
|
+
firstMetadata = metadata;
|
|
127376
|
+
} else {
|
|
127377
|
+
if (! modelMetadata) {
|
|
127378
|
+
modelMetadata = { };
|
|
127379
|
+
Object.entries(firstMetadata).forEach(([ k, v ]) => modelMetadata[k] = Array.isArray(v) ? v.slice(0) : v);
|
|
127380
|
+
}
|
|
127381
|
+
Object.entries(metadata).forEach(([ k, v ]) => { if (Array.isArray(v)) { v.forEach(e => modelMetadata[k].push(e)); } });
|
|
127382
|
+
}
|
|
127383
|
+
},
|
|
127384
|
+
finalize: () => sceneModel.metadata = modelMetadata || firstMetadata
|
|
127385
|
+
};
|
|
127386
|
+
})());
|
|
127352
127387
|
|
|
127353
127388
|
this.viewer.scene.canvas.spinner.processes++;
|
|
127354
127389
|
|
|
@@ -127361,7 +127396,7 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
127361
127396
|
metaModel.finalize();
|
|
127362
127397
|
this.viewer.scene.canvas.spinner.processes--;
|
|
127363
127398
|
sceneModel.once("destroyed", () => {
|
|
127364
|
-
this.viewer.metaScene.destroyMetaModel(metaModel.id);
|
|
127399
|
+
loadIntoMetaScene && this.viewer.metaScene.destroyMetaModel(metaModel.id);
|
|
127365
127400
|
});
|
|
127366
127401
|
this.scheduleTask(() => {
|
|
127367
127402
|
if (sceneModel.destroyed) {
|