@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.
- package/dist/xeokit-sdk.cjs.js +110 -58
- package/dist/xeokit-sdk.es.js +110 -58
- package/dist/xeokit-sdk.es5.js +1575 -1563
- 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 +7 -27
- 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/lib/ui/index.js +19 -4
- package/src/viewer/Viewer.js +1 -0
- package/src/viewer/metadata/MetaScene.js +14 -0
- 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/extras/index.d.ts +1 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/AnnotationsPlugin/AnnotationsPlugin.d.ts +11 -6
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +1 -1
- package/types/plugins/lib/ui/index.d.ts +8 -3
- package/types/viewer/Plugin.d.ts +8 -1
- package/types/viewer/scene/Entity.d.ts +19 -0
- package/types/viewer/scene/input/input.d.ts +1 -1
- package/types/viewer/scene/math/math.d.ts +30 -5
- package/types/viewer/scene/scene/Scene.d.ts +8 -0
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.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.
|
|
8
|
+
window.__XEOKIT__ = { version: '2.6.109', commit: '3796b67f0bbcca7382160e5030522506fb49a54e', built: '2026-05-08T06:25:43.604Z' };
|
|
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
|
|
|
@@ -62771,6 +62757,20 @@ class MetaScene {
|
|
|
62771
62757
|
return metaModel;
|
|
62772
62758
|
}
|
|
62773
62759
|
|
|
62760
|
+
/**
|
|
62761
|
+
* Destroys this MetaScene.
|
|
62762
|
+
*/
|
|
62763
|
+
_destroy() {
|
|
62764
|
+
this.viewer = null;
|
|
62765
|
+
this.scene = null;
|
|
62766
|
+
this.metaModels = {};
|
|
62767
|
+
this.propertySets = {};
|
|
62768
|
+
this.metaObjects = {};
|
|
62769
|
+
this.metaObjectsByType = {};
|
|
62770
|
+
this.rootMetaObjects = {};
|
|
62771
|
+
this._eventSubs = {};
|
|
62772
|
+
}
|
|
62773
|
+
|
|
62774
62774
|
/**
|
|
62775
62775
|
* Removes a {@link MetaModel} from this MetaScene.
|
|
62776
62776
|
*
|
|
@@ -101825,10 +101825,25 @@ class Label3D {
|
|
|
101825
101825
|
this.__visible = true;
|
|
101826
101826
|
|
|
101827
101827
|
this._updatePos = () => {
|
|
101828
|
-
|
|
101829
|
-
|
|
101830
|
-
|
|
101831
|
-
|
|
101828
|
+
const p0 = tmpVec4a;
|
|
101829
|
+
toClipSpace(camera, this._start, p0);
|
|
101830
|
+
math.mulVec3Scalar(p0, 1.0 / p0[3]);
|
|
101831
|
+
|
|
101832
|
+
const outsideFrustum = ((p0[3] < 0)
|
|
101833
|
+
||
|
|
101834
|
+
(p0[0] < -1) || (p0[0] > 1)
|
|
101835
|
+
||
|
|
101836
|
+
(p0[1] < -1) || (p0[1] > 1)
|
|
101837
|
+
||
|
|
101838
|
+
(p0[2] < -1) || (p0[2] > 1));
|
|
101839
|
+
const culled = outsideFrustum || scene._sectionPlanesState.sectionPlanes.some(
|
|
101840
|
+
plane => plane.active && (math.dotVec3(plane.dir, math.subVec3(plane.pos, this._start, tmpVec3a$2)) > 0));
|
|
101841
|
+
|
|
101842
|
+
this._label.setCulled(culled);
|
|
101843
|
+
if (! culled) {
|
|
101844
|
+
toCanvasSpace(scene.canvas.canvas, parentElement, p0, tmpVec2a);
|
|
101845
|
+
this._label.setPos(tmpVec2a[0], tmpVec2a[1]);
|
|
101846
|
+
}
|
|
101832
101847
|
};
|
|
101833
101848
|
|
|
101834
101849
|
const setPosOnWire = (p0, p1, yOff) => {
|
|
@@ -103340,6 +103355,7 @@ class Viewer {
|
|
|
103340
103355
|
const plugin = plugins[i];
|
|
103341
103356
|
plugin.destroy();
|
|
103342
103357
|
}
|
|
103358
|
+
this.metaScene._destroy();
|
|
103343
103359
|
this.scene.destroy();
|
|
103344
103360
|
}
|
|
103345
103361
|
}
|
|
@@ -104765,7 +104781,7 @@ class AngleMeasurementsPlugin extends Plugin {
|
|
|
104765
104781
|
* @param {Viewer} viewer The Viewer.
|
|
104766
104782
|
* @param {Object} [cfg] Plugin configuration.
|
|
104767
104783
|
* @param {String} [cfg.id="AngleMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
104768
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
104784
|
+
* @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}.
|
|
104769
104785
|
* @param {string} [cfg.defaultColor=null] The default color of the dots, wire and label.
|
|
104770
104786
|
* @param {boolean} [cfg.defaultLabelsVisible=true] The default value of {@link AngleMeasurement.labelsVisible}.
|
|
104771
104787
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
@@ -106808,7 +106824,7 @@ class AnnotationsPlugin extends Plugin {
|
|
|
106808
106824
|
* @param {String} [cfg.id="Annotations"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
106809
106825
|
* @param {String} [cfg.markerHTML] HTML text template for Annotation markers. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````markerElementId````.
|
|
106810
106826
|
* @param {String} [cfg.labelHTML] HTML text template for Annotation labels. Defaults to ````<div></div>````. Ignored on {@link Annotation}s configured with a ````labelElementId````.
|
|
106811
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
106827
|
+
* @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}.
|
|
106812
106828
|
* @param {{String:(String|Number)}} [cfg.values={}] Map of default values to insert into the HTML templates for the marker and label.
|
|
106813
106829
|
* @param {Number} [cfg.surfaceOffset=0.3] The amount by which each {@link Annotation} is offset from the surface of
|
|
106814
106830
|
* its {@link Entity} when we create the Annotation by supplying a {@link PickResult} to {@link AnnotationsPlugin#createAnnotation}.
|
|
@@ -109752,7 +109768,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
109752
109768
|
* @param {Object} [cfg] Plugin configuration.
|
|
109753
109769
|
* @param {String} [cfg.id="DistanceMeasurements"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
109754
109770
|
* @param {Number} [cfg.labelMinAxisLength=25] The minimum length, in pixels, of an axis wire beyond which its label is shown.
|
|
109755
|
-
* @param {HTMLElement} [cfg.container] Container DOM element for markers and labels. Defaults to ````document.body
|
|
109771
|
+
* @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}.
|
|
109756
109772
|
* @param {boolean} [cfg.defaultVisible=true] The default value of the DistanceMeasurements `visible` property.
|
|
109757
109773
|
* @param {boolean} [cfg.defaultOriginVisible=true] The default value of the DistanceMeasurements `originVisible` property.
|
|
109758
109774
|
* @param {boolean} [cfg.defaultTargetVisible=true] The default value of the DistanceMeasurements `targetVisible` property.
|
|
@@ -111494,6 +111510,13 @@ function getBasePath$1(src) {
|
|
|
111494
111510
|
return (i !== 0) ? src.substring(0, i + 1) : "";
|
|
111495
111511
|
}
|
|
111496
111512
|
|
|
111513
|
+
const iota = n => {
|
|
111514
|
+
const ret = [ ];
|
|
111515
|
+
for (let i = 0; i < n; ++i)
|
|
111516
|
+
ret.push(i);
|
|
111517
|
+
return ret;
|
|
111518
|
+
};
|
|
111519
|
+
|
|
111497
111520
|
/**
|
|
111498
111521
|
* @private
|
|
111499
111522
|
*/
|
|
@@ -112057,6 +112080,51 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112057
112080
|
meshCfg.color = new Float32Array([1.0, 1.0, 1.0]);
|
|
112058
112081
|
meshCfg.opacity = 1.0;
|
|
112059
112082
|
}
|
|
112083
|
+
const POSITION = primitive.attributes.POSITION;
|
|
112084
|
+
if (!POSITION) {
|
|
112085
|
+
continue;
|
|
112086
|
+
}
|
|
112087
|
+
meshCfg.localPositions = POSITION.value;
|
|
112088
|
+
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112089
|
+
if (primitive.attributes.NORMAL) {
|
|
112090
|
+
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112091
|
+
}
|
|
112092
|
+
if (primitive.attributes.TEXCOORD_0) {
|
|
112093
|
+
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112094
|
+
}
|
|
112095
|
+
if (primitive.indices) {
|
|
112096
|
+
meshCfg.indices = primitive.indices.value;
|
|
112097
|
+
}
|
|
112098
|
+
if (matrix) {
|
|
112099
|
+
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112100
|
+
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112101
|
+
meshCfg.positions.set(meshCfg.localPositions);
|
|
112102
|
+
}
|
|
112103
|
+
const linearize = closeLoop => {
|
|
112104
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112105
|
+
const len = indices.length;
|
|
112106
|
+
const cnt = closeLoop ? len : (len - 1);
|
|
112107
|
+
const linesIndices = new Uint32Array(cnt * 2);
|
|
112108
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112109
|
+
const idx = i * 2;
|
|
112110
|
+
linesIndices[idx] = indices[i];
|
|
112111
|
+
linesIndices[idx+1] = indices[(i+1) % len];
|
|
112112
|
+
}
|
|
112113
|
+
meshCfg.indices = linesIndices;
|
|
112114
|
+
};
|
|
112115
|
+
const triangularize = getFirstPoint => {
|
|
112116
|
+
const indices = meshCfg.indices || iota(meshCfg.localPositions.length / 3);
|
|
112117
|
+
const len = indices.length;
|
|
112118
|
+
const cnt = len - 2;
|
|
112119
|
+
const trianglesIndices = new Uint32Array(cnt * 3);
|
|
112120
|
+
for (let i = 0; i < cnt; ++i) {
|
|
112121
|
+
const idx = i * 3;
|
|
112122
|
+
trianglesIndices[idx] = getFirstPoint(indices, i);
|
|
112123
|
+
trianglesIndices[idx+1] = indices[(i+1) % len];
|
|
112124
|
+
trianglesIndices[idx+2] = indices[(i+2) % len];
|
|
112125
|
+
}
|
|
112126
|
+
meshCfg.indices = trianglesIndices;
|
|
112127
|
+
};
|
|
112060
112128
|
const backfaces = ((ctx.backfaces !== false) || (material && material.doubleSided !== false));
|
|
112061
112129
|
switch (primitive.mode) {
|
|
112062
112130
|
case 0: // POINTS
|
|
@@ -112067,42 +112135,26 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112067
112135
|
break;
|
|
112068
112136
|
case 2: // LINE_LOOP
|
|
112069
112137
|
meshCfg.primitive = "lines";
|
|
112138
|
+
linearize(true);
|
|
112070
112139
|
break;
|
|
112071
112140
|
case 3: // LINE_STRIP
|
|
112072
112141
|
meshCfg.primitive = "lines";
|
|
112142
|
+
linearize(false);
|
|
112073
112143
|
break;
|
|
112074
112144
|
case 4: // TRIANGLES
|
|
112075
112145
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112076
112146
|
break;
|
|
112077
112147
|
case 5: // TRIANGLE_STRIP
|
|
112078
112148
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112149
|
+
triangularize((indices, i) => indices[i]);
|
|
112079
112150
|
break;
|
|
112080
112151
|
case 6: // TRIANGLE_FAN
|
|
112081
112152
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112153
|
+
triangularize((indices, i) => indices[0]);
|
|
112082
112154
|
break;
|
|
112083
112155
|
default:
|
|
112084
112156
|
meshCfg.primitive = backfaces ? "triangles" : "solid";
|
|
112085
112157
|
}
|
|
112086
|
-
const POSITION = primitive.attributes.POSITION;
|
|
112087
|
-
if (!POSITION) {
|
|
112088
|
-
continue;
|
|
112089
|
-
}
|
|
112090
|
-
meshCfg.localPositions = POSITION.value;
|
|
112091
|
-
meshCfg.positions = new Float64Array(meshCfg.localPositions.length);
|
|
112092
|
-
if (primitive.attributes.NORMAL) {
|
|
112093
|
-
meshCfg.normals = primitive.attributes.NORMAL.value;
|
|
112094
|
-
}
|
|
112095
|
-
if (primitive.attributes.TEXCOORD_0) {
|
|
112096
|
-
meshCfg.uv = primitive.attributes.TEXCOORD_0.value;
|
|
112097
|
-
}
|
|
112098
|
-
if (primitive.indices) {
|
|
112099
|
-
meshCfg.indices = primitive.indices.value;
|
|
112100
|
-
}
|
|
112101
|
-
if (matrix) {
|
|
112102
|
-
math.transformPositions3(matrix, meshCfg.localPositions, meshCfg.positions);
|
|
112103
|
-
} else { // eqiv to math.transformPositions3(math.identityMat4(), meshCfg.localPositions, meshCfg.positions);
|
|
112104
|
-
meshCfg.positions.set(meshCfg.localPositions);
|
|
112105
|
-
}
|
|
112106
112158
|
const origin = math.vec3();
|
|
112107
112159
|
const rtcNeeded = worldToRTCPositions(meshCfg.positions, meshCfg.positions, origin); // Small cellsize guarantees better accuracy
|
|
112108
112160
|
if (rtcNeeded) {
|