@xeokit/xeokit-sdk 2.6.103 → 2.6.105-XCD-439-transparent-issues
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 +102 -21
- package/dist/xeokit-sdk.es.js +102 -21
- package/dist/xeokit-sdk.es5.js +28 -25
- package/dist/xeokit-sdk.min.cjs.js +7 -7
- package/dist/xeokit-sdk.min.es.js +7 -7
- package/dist/xeokit-sdk.min.es5.js +6 -6
- package/package.json +7 -6
- package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +1 -0
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +45 -4
- package/src/viewer/Viewer.js +3 -1
- package/src/viewer/scene/scene/Scene.js +2 -1
- package/src/viewer/scene/webgl/Renderer.js +36 -0
- package/types/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.d.ts +2 -0
- package/types/viewer/Viewer.d.ts +2 -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.105-XCD-439-transparent-issues
|
|
3
|
+
* Commit: 20c5d5219328db0e2a6ebfd88bbfc44eb0367962
|
|
4
|
+
* Built: 2026-02-02T17:00:01.808Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
if (typeof window !== 'undefined') {
|
|
8
|
-
window.__XEOKIT__ = { version: '2.6.
|
|
8
|
+
window.__XEOKIT__ = { version: '2.6.105-XCD-439-transparent-issues', commit: '20c5d5219328db0e2a6ebfd88bbfc44eb0367962', built: '2026-02-02T17:00:01.808Z' };
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
'use strict';
|
|
@@ -11423,7 +11423,7 @@ class CameraPath extends Component {
|
|
|
11423
11423
|
}
|
|
11424
11424
|
}
|
|
11425
11425
|
|
|
11426
|
-
const tempVec3$
|
|
11426
|
+
const tempVec3$9 = math.vec3();
|
|
11427
11427
|
const newLook = math.vec3();
|
|
11428
11428
|
const newEye = math.vec3();
|
|
11429
11429
|
const newUp = math.vec3();
|
|
@@ -11685,7 +11685,7 @@ class CameraFlightAnimation extends Component {
|
|
|
11685
11685
|
|
|
11686
11686
|
this._look2 = poi || aabbCenter;
|
|
11687
11687
|
|
|
11688
|
-
const eyeLookVec = math.subVec3(this._eye1, this._look1, tempVec3$
|
|
11688
|
+
const eyeLookVec = math.subVec3(this._eye1, this._look1, tempVec3$9);
|
|
11689
11689
|
const eyeLookVecNorm = math.normalizeVec3(eyeLookVec);
|
|
11690
11690
|
const diag = poi ? math.getAABB3DiagPoint(aabb, poi) : math.getAABB3Diag(aabb);
|
|
11691
11691
|
const fitFOV = params.fitFOV || this._fitFOV;
|
|
@@ -11844,12 +11844,12 @@ class CameraFlightAnimation extends Component {
|
|
|
11844
11844
|
dist = Math.abs((diag) / Math.tan((params.fitFOV || this._fitFOV) * math.DEGTORAD));
|
|
11845
11845
|
|
|
11846
11846
|
} else {
|
|
11847
|
-
dist = math.lenVec3(math.subVec3(camera.eye, camera.look, tempVec3$
|
|
11847
|
+
dist = math.lenVec3(math.subVec3(camera.eye, camera.look, tempVec3$9));
|
|
11848
11848
|
}
|
|
11849
11849
|
|
|
11850
11850
|
math.mulVec3Scalar(newLookEyeVec, dist);
|
|
11851
11851
|
|
|
11852
|
-
camera.eye = math.addVec3(newLook, newLookEyeVec, tempVec3$
|
|
11852
|
+
camera.eye = math.addVec3(newLook, newLookEyeVec, tempVec3$9);
|
|
11853
11853
|
camera.look = newLook;
|
|
11854
11854
|
|
|
11855
11855
|
this.scene.camera.ortho.scale = diag * 1.1;
|
|
@@ -26516,7 +26516,7 @@ class Texture extends Component {
|
|
|
26516
26516
|
}
|
|
26517
26517
|
}
|
|
26518
26518
|
|
|
26519
|
-
const tempVec3$
|
|
26519
|
+
const tempVec3$8 = math.vec3();
|
|
26520
26520
|
const tempVec3b$a = math.vec3();
|
|
26521
26521
|
math.vec3();
|
|
26522
26522
|
const zeroVec$1 = math.vec3([0, -1, 0]);
|
|
@@ -26940,9 +26940,9 @@ class ImagePlane extends Component {
|
|
|
26940
26940
|
const origin = this.scene.center;
|
|
26941
26941
|
const negDir = [-this._dir[0], -this._dir[1], -this._dir[2]];
|
|
26942
26942
|
|
|
26943
|
-
math.subVec3(origin, this.position, tempVec3$
|
|
26943
|
+
math.subVec3(origin, this.position, tempVec3$8);
|
|
26944
26944
|
|
|
26945
|
-
const dist = -math.dotVec3(negDir, tempVec3$
|
|
26945
|
+
const dist = -math.dotVec3(negDir, tempVec3$8);
|
|
26946
26946
|
|
|
26947
26947
|
math.normalizeVec3(negDir);
|
|
26948
26948
|
math.mulVec3Scalar(negDir, dist, tempVec3b$a);
|
|
@@ -31953,7 +31953,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31953
31953
|
};
|
|
31954
31954
|
|
|
31955
31955
|
const tempVec2 = math.vec2();
|
|
31956
|
-
const tempVec3$
|
|
31956
|
+
const tempVec3$7 = math.vec3();
|
|
31957
31957
|
const tempVec4$1 = math.vec4();
|
|
31958
31958
|
const tempMat4$2 = math.mat4();
|
|
31959
31959
|
const vec3zero = math.vec3([0,0,0]);
|
|
@@ -32190,7 +32190,7 @@ const getRenderers = (function() {
|
|
|
32190
32190
|
const origin = layer.origin;
|
|
32191
32191
|
const model = layer.model;
|
|
32192
32192
|
const viewParams = frameCtx.viewParams;
|
|
32193
|
-
const rtcOrigin = tempVec3$
|
|
32193
|
+
const rtcOrigin = tempVec3$7;
|
|
32194
32194
|
math.transformPoint3(model.matrix, origin, rtcOrigin);
|
|
32195
32195
|
|
|
32196
32196
|
const viewMatrix = viewParams.viewMatrix;
|
|
@@ -32930,7 +32930,7 @@ const INDICES_EDGE_INDICES_ALIGNEMENT_SIZE = 8;
|
|
|
32930
32930
|
*/
|
|
32931
32931
|
const MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE = 10;
|
|
32932
32932
|
|
|
32933
|
-
const tempVec3$
|
|
32933
|
+
const tempVec3$6 = math.vec3();
|
|
32934
32934
|
const tempVec3a$e = math.vec3();
|
|
32935
32935
|
const tempVec4a$b = math.vec4();
|
|
32936
32936
|
math.vec4();
|
|
@@ -33501,7 +33501,7 @@ class DTXLayer extends Layer {
|
|
|
33501
33501
|
setInputValue(layerTypeInputs.worldMatrix, model.rotationMatrix);
|
|
33502
33502
|
setInputValue(layerTypeInputs.viewMatrix, viewState.viewMatrix);
|
|
33503
33503
|
setInputValue(layerTypeInputs.projMatrix, viewState.projMatrix);
|
|
33504
|
-
const rtcOrigin = math.transformPoint3(model.matrix, origin, tempVec3$
|
|
33504
|
+
const rtcOrigin = math.transformPoint3(model.matrix, origin, tempVec3$6);
|
|
33505
33505
|
setInputValue(layerTypeInputs.uCameraEyeRtc, math.subVec3(viewState.eye, rtcOrigin, tempVec3a$e));
|
|
33506
33506
|
setInputValue(layerTypeInputs.perObjPosDecode, texturePerObjectPositionsDecodeMatrix);
|
|
33507
33507
|
setInputValue(layerTypeInputs.perVertIdCoords, texturePerVertexIdCoordinates);
|
|
@@ -47147,6 +47147,7 @@ const vec3_0 = math.vec3([0,0,0]);
|
|
|
47147
47147
|
const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47148
47148
|
|
|
47149
47149
|
const tempPlanes = iota(6).map(() => math.vec4());
|
|
47150
|
+
const tempVec3$5 = math.vec3();
|
|
47150
47151
|
const tempVec4 = math.vec4();
|
|
47151
47152
|
|
|
47152
47153
|
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]);
|
|
@@ -48139,6 +48140,40 @@ const Renderer$1 = function (scene, options) {
|
|
|
48139
48140
|
if (normalFillTransparentBinLen > 0 || normalEdgesTransparentBinLen > 0) {
|
|
48140
48141
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
48141
48142
|
}
|
|
48143
|
+
|
|
48144
|
+
if (options.sortAllTransparent) {
|
|
48145
|
+
const eye = frameCtx.viewParams.eye;
|
|
48146
|
+
normalFillTransparentBin.length = normalFillTransparentBinLen; // normalFillTransparentBin reused by renderDrawables calls, so needs to be truncated if necessary
|
|
48147
|
+
|
|
48148
|
+
const transparentDrawables = [ ];
|
|
48149
|
+
const appendTransparentDrawable = (d, draw) => {
|
|
48150
|
+
math.getAABB3Center(d.aabb, tempVec3$5);
|
|
48151
|
+
transparentDrawables.push({ draw: draw, distSq: math.distVec3(eye, math.getAABB3Center(d.aabb, tempVec3$5)) });
|
|
48152
|
+
};
|
|
48153
|
+
iota(normalEdgesTransparentBinLen).forEach(i => {
|
|
48154
|
+
const d = normalEdgesTransparentBin[i];
|
|
48155
|
+
appendTransparentDrawable(d, () => d.drawEdgesColorTransparent(frameCtx));
|
|
48156
|
+
});
|
|
48157
|
+
|
|
48158
|
+
iota(normalFillTransparentBinLen).forEach(i => {
|
|
48159
|
+
const d = normalFillTransparentBin[i];
|
|
48160
|
+
appendTransparentDrawable(d, () => d.drawColorTransparent(frameCtx));
|
|
48161
|
+
});
|
|
48162
|
+
|
|
48163
|
+
iota(xrayEdgesTransparentBinLen).forEach(i => {
|
|
48164
|
+
const d = xrayEdgesTransparentBin[i];
|
|
48165
|
+
appendTransparentDrawable(d, () => d.drawEdgesXRayed(frameCtx));
|
|
48166
|
+
});
|
|
48167
|
+
|
|
48168
|
+
iota(xrayedFillTransparentBinLen).forEach(i => {
|
|
48169
|
+
const d = xrayedFillTransparentBin[i];
|
|
48170
|
+
appendTransparentDrawable(d, () => d.drawSilhouetteXRayed(frameCtx));
|
|
48171
|
+
});
|
|
48172
|
+
|
|
48173
|
+
transparentDrawables.sort((a, b) => b.distSq - a.distSq).forEach(d => d.draw());
|
|
48174
|
+
|
|
48175
|
+
} else {
|
|
48176
|
+
|
|
48142
48177
|
if (normalEdgesTransparentBinLen > 0) {
|
|
48143
48178
|
for (i = 0; i < normalEdgesTransparentBinLen; i++) {
|
|
48144
48179
|
drawable = normalEdgesTransparentBin[i];
|
|
@@ -48173,6 +48208,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
48173
48208
|
xrayedFillTransparentBin[i].drawSilhouetteXRayed(frameCtx);
|
|
48174
48209
|
}
|
|
48175
48210
|
}
|
|
48211
|
+
}
|
|
48176
48212
|
|
|
48177
48213
|
gl.disable(gl.BLEND);
|
|
48178
48214
|
if (!alphaDepthMask) {
|
|
@@ -55011,7 +55047,8 @@ class Scene extends Component {
|
|
|
55011
55047
|
|
|
55012
55048
|
this._renderer = new Renderer$1(this, {
|
|
55013
55049
|
transparent: transparent,
|
|
55014
|
-
alphaDepthMask: alphaDepthMask
|
|
55050
|
+
alphaDepthMask: alphaDepthMask,
|
|
55051
|
+
sortAllTransparent: cfg.sortAllTransparent
|
|
55015
55052
|
});
|
|
55016
55053
|
|
|
55017
55054
|
this._sectionPlanesState = new (function () {
|
|
@@ -102923,6 +102960,7 @@ class Viewer {
|
|
|
102923
102960
|
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
102924
102961
|
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
102925
102962
|
* your expected usage.
|
|
102963
|
+
* @param {Boolean} [cfg.sortAllTransparent=false] Whether to sort all transparent objects by their distance from the camera, before drawing on the scene.
|
|
102926
102964
|
*/
|
|
102927
102965
|
constructor(cfg) {
|
|
102928
102966
|
|
|
@@ -102982,7 +103020,8 @@ class Viewer {
|
|
|
102982
103020
|
colorTextureEnabled: (cfg.colorTextureEnabled !== false),
|
|
102983
103021
|
dtxEnabled: (!!cfg.dtxEnabled),
|
|
102984
103022
|
markerZOffset: cfg.markerZOffset,
|
|
102985
|
-
numCachedSectionPlanes: cfg.numCachedSectionPlanes
|
|
103023
|
+
numCachedSectionPlanes: cfg.numCachedSectionPlanes,
|
|
103024
|
+
sortAllTransparent: cfg.sortAllTransparent
|
|
102986
103025
|
});
|
|
102987
103026
|
|
|
102988
103027
|
/**
|
|
@@ -111609,6 +111648,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, er
|
|
|
111609
111648
|
numObjects: 0,
|
|
111610
111649
|
nodes: [],
|
|
111611
111650
|
nextId: 0,
|
|
111651
|
+
entityPerMesh: options.entityPerMesh,
|
|
111612
111652
|
log: (msg) => {
|
|
111613
111653
|
plugin.log(msg);
|
|
111614
111654
|
}
|
|
@@ -111896,6 +111936,49 @@ function loadDefaultScene(ctx) {
|
|
|
111896
111936
|
});
|
|
111897
111937
|
})(nodes);
|
|
111898
111938
|
|
|
111939
|
+
if (ctx.entityPerMesh) {
|
|
111940
|
+
const sceneIds = new Set();
|
|
111941
|
+
(function createSceneMeshesAndEntities(nodes, parentId, parentMatrix, dep) {
|
|
111942
|
+
return nodes.reduce(
|
|
111943
|
+
(hadMesh, node) => {
|
|
111944
|
+
const baseId = node.name ?? "Node";
|
|
111945
|
+
const maybeGlobalize = id => ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, id) : id;
|
|
111946
|
+
let entityId = maybeGlobalize(baseId);
|
|
111947
|
+
let nextPostfixId = 1;
|
|
111948
|
+
while (ctx.sceneModel.objects[entityId] || sceneIds.has(entityId)) {
|
|
111949
|
+
entityId = maybeGlobalize(`${baseId}.${(nextPostfixId++).toString().padStart(4, "0")}`);
|
|
111950
|
+
}
|
|
111951
|
+
sceneIds.add(entityId);
|
|
111952
|
+
const matrix = parseNodeMatrix(node, parentMatrix);
|
|
111953
|
+
|
|
111954
|
+
const meshEntity = node.mesh && (function() {
|
|
111955
|
+
const meshIds = [ ];
|
|
111956
|
+
parseNodeMesh(node, ctx, matrix, meshIds);
|
|
111957
|
+
return (meshIds.length > 0) && ctx.sceneModel.createEntity({
|
|
111958
|
+
id: entityId,
|
|
111959
|
+
meshIds: meshIds,
|
|
111960
|
+
isObject: true
|
|
111961
|
+
});
|
|
111962
|
+
})();
|
|
111963
|
+
|
|
111964
|
+
const hasMesh = (node.children && createSceneMeshesAndEntities(node.children, entityId, matrix)) || meshEntity;
|
|
111965
|
+
|
|
111966
|
+
if (hasMesh && ctx.autoMetaModel) {
|
|
111967
|
+
ctx.metaObjects.push({
|
|
111968
|
+
id: entityId,
|
|
111969
|
+
name: entityId,
|
|
111970
|
+
type: "Default",
|
|
111971
|
+
parent: parentId
|
|
111972
|
+
});
|
|
111973
|
+
}
|
|
111974
|
+
|
|
111975
|
+
return hadMesh || hasMesh;
|
|
111976
|
+
},
|
|
111977
|
+
false);
|
|
111978
|
+
})(nodes, ctx.sceneModel.id, null);
|
|
111979
|
+
return;
|
|
111980
|
+
}
|
|
111981
|
+
|
|
111899
111982
|
// Create a SceneMesh for each mesh primitive, and a SceneModelEntity for the root node and each named node.
|
|
111900
111983
|
const meshIdsStack = [];
|
|
111901
111984
|
let meshIds = null;
|
|
@@ -111937,7 +112020,7 @@ function loadDefaultScene(ctx) {
|
|
|
111937
112020
|
ctx.metaObjects.push({
|
|
111938
112021
|
id: entityId,
|
|
111939
112022
|
type: "Default",
|
|
111940
|
-
name:
|
|
112023
|
+
name: nodeName ? nodeName : "Node",
|
|
111941
112024
|
parent: ctx.sceneModel.id
|
|
111942
112025
|
});
|
|
111943
112026
|
}
|
|
@@ -112008,9 +112091,6 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112008
112091
|
if (numPrimitives > 0) {
|
|
112009
112092
|
for (let i = 0; i < numPrimitives; i++) {
|
|
112010
112093
|
const primitive = mesh.primitives[i];
|
|
112011
|
-
if (primitive.mode < 4) {
|
|
112012
|
-
continue;
|
|
112013
|
-
}
|
|
112014
112094
|
const meshCfg = {
|
|
112015
112095
|
id: ctx.sceneModel.id + "." + ctx.numObjects++
|
|
112016
112096
|
};
|
|
@@ -112420,6 +112500,7 @@ class GLTFLoaderPlugin extends Plugin {
|
|
|
112420
112500
|
* @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
|
|
112421
112501
|
* @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
|
|
112422
112502
|
* @param {*} [params.parseOptions={}] Options to pass to loaders.gl parse method, eg. ````{ gltf: { excludeExtensions: { "KHR_texture_transform": false } } }````.
|
|
112503
|
+
* @param {Boolean} [params.entityPerMesh=false] Create an entity for each mesh, instead of grouping leaf meshes under their common entity.
|
|
112423
112504
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
112424
112505
|
*/
|
|
112425
112506
|
load(params = {}) {
|
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.105-XCD-439-transparent-issues
|
|
3
|
+
* Commit: 20c5d5219328db0e2a6ebfd88bbfc44eb0367962
|
|
4
|
+
* Built: 2026-02-02T17:00:01.808Z
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
if (typeof window !== 'undefined') {
|
|
8
|
-
window.__XEOKIT__ = { version: '2.6.
|
|
8
|
+
window.__XEOKIT__ = { version: '2.6.105-XCD-439-transparent-issues', commit: '20c5d5219328db0e2a6ebfd88bbfc44eb0367962', built: '2026-02-02T17:00:01.808Z' };
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
/** @private */
|
|
@@ -11419,7 +11419,7 @@ class CameraPath extends Component {
|
|
|
11419
11419
|
}
|
|
11420
11420
|
}
|
|
11421
11421
|
|
|
11422
|
-
const tempVec3$
|
|
11422
|
+
const tempVec3$9 = math.vec3();
|
|
11423
11423
|
const newLook = math.vec3();
|
|
11424
11424
|
const newEye = math.vec3();
|
|
11425
11425
|
const newUp = math.vec3();
|
|
@@ -11681,7 +11681,7 @@ class CameraFlightAnimation extends Component {
|
|
|
11681
11681
|
|
|
11682
11682
|
this._look2 = poi || aabbCenter;
|
|
11683
11683
|
|
|
11684
|
-
const eyeLookVec = math.subVec3(this._eye1, this._look1, tempVec3$
|
|
11684
|
+
const eyeLookVec = math.subVec3(this._eye1, this._look1, tempVec3$9);
|
|
11685
11685
|
const eyeLookVecNorm = math.normalizeVec3(eyeLookVec);
|
|
11686
11686
|
const diag = poi ? math.getAABB3DiagPoint(aabb, poi) : math.getAABB3Diag(aabb);
|
|
11687
11687
|
const fitFOV = params.fitFOV || this._fitFOV;
|
|
@@ -11840,12 +11840,12 @@ class CameraFlightAnimation extends Component {
|
|
|
11840
11840
|
dist = Math.abs((diag) / Math.tan((params.fitFOV || this._fitFOV) * math.DEGTORAD));
|
|
11841
11841
|
|
|
11842
11842
|
} else {
|
|
11843
|
-
dist = math.lenVec3(math.subVec3(camera.eye, camera.look, tempVec3$
|
|
11843
|
+
dist = math.lenVec3(math.subVec3(camera.eye, camera.look, tempVec3$9));
|
|
11844
11844
|
}
|
|
11845
11845
|
|
|
11846
11846
|
math.mulVec3Scalar(newLookEyeVec, dist);
|
|
11847
11847
|
|
|
11848
|
-
camera.eye = math.addVec3(newLook, newLookEyeVec, tempVec3$
|
|
11848
|
+
camera.eye = math.addVec3(newLook, newLookEyeVec, tempVec3$9);
|
|
11849
11849
|
camera.look = newLook;
|
|
11850
11850
|
|
|
11851
11851
|
this.scene.camera.ortho.scale = diag * 1.1;
|
|
@@ -26512,7 +26512,7 @@ class Texture extends Component {
|
|
|
26512
26512
|
}
|
|
26513
26513
|
}
|
|
26514
26514
|
|
|
26515
|
-
const tempVec3$
|
|
26515
|
+
const tempVec3$8 = math.vec3();
|
|
26516
26516
|
const tempVec3b$a = math.vec3();
|
|
26517
26517
|
math.vec3();
|
|
26518
26518
|
const zeroVec$1 = math.vec3([0, -1, 0]);
|
|
@@ -26936,9 +26936,9 @@ class ImagePlane extends Component {
|
|
|
26936
26936
|
const origin = this.scene.center;
|
|
26937
26937
|
const negDir = [-this._dir[0], -this._dir[1], -this._dir[2]];
|
|
26938
26938
|
|
|
26939
|
-
math.subVec3(origin, this.position, tempVec3$
|
|
26939
|
+
math.subVec3(origin, this.position, tempVec3$8);
|
|
26940
26940
|
|
|
26941
|
-
const dist = -math.dotVec3(negDir, tempVec3$
|
|
26941
|
+
const dist = -math.dotVec3(negDir, tempVec3$8);
|
|
26942
26942
|
|
|
26943
26943
|
math.normalizeVec3(negDir);
|
|
26944
26944
|
math.mulVec3Scalar(negDir, dist, tempVec3b$a);
|
|
@@ -31949,7 +31949,7 @@ const SnapProgram = function(programVariables, geometry, isSnapInit, isPoints) {
|
|
|
31949
31949
|
};
|
|
31950
31950
|
|
|
31951
31951
|
const tempVec2 = math.vec2();
|
|
31952
|
-
const tempVec3$
|
|
31952
|
+
const tempVec3$7 = math.vec3();
|
|
31953
31953
|
const tempVec4$1 = math.vec4();
|
|
31954
31954
|
const tempMat4$2 = math.mat4();
|
|
31955
31955
|
const vec3zero = math.vec3([0,0,0]);
|
|
@@ -32186,7 +32186,7 @@ const getRenderers = (function() {
|
|
|
32186
32186
|
const origin = layer.origin;
|
|
32187
32187
|
const model = layer.model;
|
|
32188
32188
|
const viewParams = frameCtx.viewParams;
|
|
32189
|
-
const rtcOrigin = tempVec3$
|
|
32189
|
+
const rtcOrigin = tempVec3$7;
|
|
32190
32190
|
math.transformPoint3(model.matrix, origin, rtcOrigin);
|
|
32191
32191
|
|
|
32192
32192
|
const viewMatrix = viewParams.viewMatrix;
|
|
@@ -32926,7 +32926,7 @@ const INDICES_EDGE_INDICES_ALIGNEMENT_SIZE = 8;
|
|
|
32926
32926
|
*/
|
|
32927
32927
|
const MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE = 10;
|
|
32928
32928
|
|
|
32929
|
-
const tempVec3$
|
|
32929
|
+
const tempVec3$6 = math.vec3();
|
|
32930
32930
|
const tempVec3a$e = math.vec3();
|
|
32931
32931
|
const tempVec4a$b = math.vec4();
|
|
32932
32932
|
math.vec4();
|
|
@@ -33497,7 +33497,7 @@ class DTXLayer extends Layer {
|
|
|
33497
33497
|
setInputValue(layerTypeInputs.worldMatrix, model.rotationMatrix);
|
|
33498
33498
|
setInputValue(layerTypeInputs.viewMatrix, viewState.viewMatrix);
|
|
33499
33499
|
setInputValue(layerTypeInputs.projMatrix, viewState.projMatrix);
|
|
33500
|
-
const rtcOrigin = math.transformPoint3(model.matrix, origin, tempVec3$
|
|
33500
|
+
const rtcOrigin = math.transformPoint3(model.matrix, origin, tempVec3$6);
|
|
33501
33501
|
setInputValue(layerTypeInputs.uCameraEyeRtc, math.subVec3(viewState.eye, rtcOrigin, tempVec3a$e));
|
|
33502
33502
|
setInputValue(layerTypeInputs.perObjPosDecode, texturePerObjectPositionsDecodeMatrix);
|
|
33503
33503
|
setInputValue(layerTypeInputs.perVertIdCoords, texturePerVertexIdCoordinates);
|
|
@@ -47143,6 +47143,7 @@ const vec3_0 = math.vec3([0,0,0]);
|
|
|
47143
47143
|
const iota = (n) => { const ret = [ ]; for (let i = 0; i < n; ++i) ret.push(i); return ret; };
|
|
47144
47144
|
|
|
47145
47145
|
const tempPlanes = iota(6).map(() => math.vec4());
|
|
47146
|
+
const tempVec3$5 = math.vec3();
|
|
47146
47147
|
const tempVec4 = math.vec4();
|
|
47147
47148
|
|
|
47148
47149
|
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]);
|
|
@@ -48135,6 +48136,40 @@ const Renderer$1 = function (scene, options) {
|
|
|
48135
48136
|
if (normalFillTransparentBinLen > 0 || normalEdgesTransparentBinLen > 0) {
|
|
48136
48137
|
gl.blendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA);
|
|
48137
48138
|
}
|
|
48139
|
+
|
|
48140
|
+
if (options.sortAllTransparent) {
|
|
48141
|
+
const eye = frameCtx.viewParams.eye;
|
|
48142
|
+
normalFillTransparentBin.length = normalFillTransparentBinLen; // normalFillTransparentBin reused by renderDrawables calls, so needs to be truncated if necessary
|
|
48143
|
+
|
|
48144
|
+
const transparentDrawables = [ ];
|
|
48145
|
+
const appendTransparentDrawable = (d, draw) => {
|
|
48146
|
+
math.getAABB3Center(d.aabb, tempVec3$5);
|
|
48147
|
+
transparentDrawables.push({ draw: draw, distSq: math.distVec3(eye, math.getAABB3Center(d.aabb, tempVec3$5)) });
|
|
48148
|
+
};
|
|
48149
|
+
iota(normalEdgesTransparentBinLen).forEach(i => {
|
|
48150
|
+
const d = normalEdgesTransparentBin[i];
|
|
48151
|
+
appendTransparentDrawable(d, () => d.drawEdgesColorTransparent(frameCtx));
|
|
48152
|
+
});
|
|
48153
|
+
|
|
48154
|
+
iota(normalFillTransparentBinLen).forEach(i => {
|
|
48155
|
+
const d = normalFillTransparentBin[i];
|
|
48156
|
+
appendTransparentDrawable(d, () => d.drawColorTransparent(frameCtx));
|
|
48157
|
+
});
|
|
48158
|
+
|
|
48159
|
+
iota(xrayEdgesTransparentBinLen).forEach(i => {
|
|
48160
|
+
const d = xrayEdgesTransparentBin[i];
|
|
48161
|
+
appendTransparentDrawable(d, () => d.drawEdgesXRayed(frameCtx));
|
|
48162
|
+
});
|
|
48163
|
+
|
|
48164
|
+
iota(xrayedFillTransparentBinLen).forEach(i => {
|
|
48165
|
+
const d = xrayedFillTransparentBin[i];
|
|
48166
|
+
appendTransparentDrawable(d, () => d.drawSilhouetteXRayed(frameCtx));
|
|
48167
|
+
});
|
|
48168
|
+
|
|
48169
|
+
transparentDrawables.sort((a, b) => b.distSq - a.distSq).forEach(d => d.draw());
|
|
48170
|
+
|
|
48171
|
+
} else {
|
|
48172
|
+
|
|
48138
48173
|
if (normalEdgesTransparentBinLen > 0) {
|
|
48139
48174
|
for (i = 0; i < normalEdgesTransparentBinLen; i++) {
|
|
48140
48175
|
drawable = normalEdgesTransparentBin[i];
|
|
@@ -48169,6 +48204,7 @@ const Renderer$1 = function (scene, options) {
|
|
|
48169
48204
|
xrayedFillTransparentBin[i].drawSilhouetteXRayed(frameCtx);
|
|
48170
48205
|
}
|
|
48171
48206
|
}
|
|
48207
|
+
}
|
|
48172
48208
|
|
|
48173
48209
|
gl.disable(gl.BLEND);
|
|
48174
48210
|
if (!alphaDepthMask) {
|
|
@@ -55007,7 +55043,8 @@ class Scene extends Component {
|
|
|
55007
55043
|
|
|
55008
55044
|
this._renderer = new Renderer$1(this, {
|
|
55009
55045
|
transparent: transparent,
|
|
55010
|
-
alphaDepthMask: alphaDepthMask
|
|
55046
|
+
alphaDepthMask: alphaDepthMask,
|
|
55047
|
+
sortAllTransparent: cfg.sortAllTransparent
|
|
55011
55048
|
});
|
|
55012
55049
|
|
|
55013
55050
|
this._sectionPlanesState = new (function () {
|
|
@@ -102919,6 +102956,7 @@ class Viewer {
|
|
|
102919
102956
|
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
102920
102957
|
* responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
|
|
102921
102958
|
* your expected usage.
|
|
102959
|
+
* @param {Boolean} [cfg.sortAllTransparent=false] Whether to sort all transparent objects by their distance from the camera, before drawing on the scene.
|
|
102922
102960
|
*/
|
|
102923
102961
|
constructor(cfg) {
|
|
102924
102962
|
|
|
@@ -102978,7 +103016,8 @@ class Viewer {
|
|
|
102978
103016
|
colorTextureEnabled: (cfg.colorTextureEnabled !== false),
|
|
102979
103017
|
dtxEnabled: (!!cfg.dtxEnabled),
|
|
102980
103018
|
markerZOffset: cfg.markerZOffset,
|
|
102981
|
-
numCachedSectionPlanes: cfg.numCachedSectionPlanes
|
|
103019
|
+
numCachedSectionPlanes: cfg.numCachedSectionPlanes,
|
|
103020
|
+
sortAllTransparent: cfg.sortAllTransparent
|
|
102982
103021
|
});
|
|
102983
103022
|
|
|
102984
103023
|
/**
|
|
@@ -111605,6 +111644,7 @@ function parseGLTF(plugin, src, gltf, metaModelJSON, options, sceneModel, ok, er
|
|
|
111605
111644
|
numObjects: 0,
|
|
111606
111645
|
nodes: [],
|
|
111607
111646
|
nextId: 0,
|
|
111647
|
+
entityPerMesh: options.entityPerMesh,
|
|
111608
111648
|
log: (msg) => {
|
|
111609
111649
|
plugin.log(msg);
|
|
111610
111650
|
}
|
|
@@ -111892,6 +111932,49 @@ function loadDefaultScene(ctx) {
|
|
|
111892
111932
|
});
|
|
111893
111933
|
})(nodes);
|
|
111894
111934
|
|
|
111935
|
+
if (ctx.entityPerMesh) {
|
|
111936
|
+
const sceneIds = new Set();
|
|
111937
|
+
(function createSceneMeshesAndEntities(nodes, parentId, parentMatrix, dep) {
|
|
111938
|
+
return nodes.reduce(
|
|
111939
|
+
(hadMesh, node) => {
|
|
111940
|
+
const baseId = node.name ?? "Node";
|
|
111941
|
+
const maybeGlobalize = id => ctx.globalizeObjectIds ? math.globalizeObjectId(ctx.sceneModel.id, id) : id;
|
|
111942
|
+
let entityId = maybeGlobalize(baseId);
|
|
111943
|
+
let nextPostfixId = 1;
|
|
111944
|
+
while (ctx.sceneModel.objects[entityId] || sceneIds.has(entityId)) {
|
|
111945
|
+
entityId = maybeGlobalize(`${baseId}.${(nextPostfixId++).toString().padStart(4, "0")}`);
|
|
111946
|
+
}
|
|
111947
|
+
sceneIds.add(entityId);
|
|
111948
|
+
const matrix = parseNodeMatrix(node, parentMatrix);
|
|
111949
|
+
|
|
111950
|
+
const meshEntity = node.mesh && (function() {
|
|
111951
|
+
const meshIds = [ ];
|
|
111952
|
+
parseNodeMesh(node, ctx, matrix, meshIds);
|
|
111953
|
+
return (meshIds.length > 0) && ctx.sceneModel.createEntity({
|
|
111954
|
+
id: entityId,
|
|
111955
|
+
meshIds: meshIds,
|
|
111956
|
+
isObject: true
|
|
111957
|
+
});
|
|
111958
|
+
})();
|
|
111959
|
+
|
|
111960
|
+
const hasMesh = (node.children && createSceneMeshesAndEntities(node.children, entityId, matrix)) || meshEntity;
|
|
111961
|
+
|
|
111962
|
+
if (hasMesh && ctx.autoMetaModel) {
|
|
111963
|
+
ctx.metaObjects.push({
|
|
111964
|
+
id: entityId,
|
|
111965
|
+
name: entityId,
|
|
111966
|
+
type: "Default",
|
|
111967
|
+
parent: parentId
|
|
111968
|
+
});
|
|
111969
|
+
}
|
|
111970
|
+
|
|
111971
|
+
return hadMesh || hasMesh;
|
|
111972
|
+
},
|
|
111973
|
+
false);
|
|
111974
|
+
})(nodes, ctx.sceneModel.id, null);
|
|
111975
|
+
return;
|
|
111976
|
+
}
|
|
111977
|
+
|
|
111895
111978
|
// Create a SceneMesh for each mesh primitive, and a SceneModelEntity for the root node and each named node.
|
|
111896
111979
|
const meshIdsStack = [];
|
|
111897
111980
|
let meshIds = null;
|
|
@@ -111933,7 +112016,7 @@ function loadDefaultScene(ctx) {
|
|
|
111933
112016
|
ctx.metaObjects.push({
|
|
111934
112017
|
id: entityId,
|
|
111935
112018
|
type: "Default",
|
|
111936
|
-
name:
|
|
112019
|
+
name: nodeName ? nodeName : "Node",
|
|
111937
112020
|
parent: ctx.sceneModel.id
|
|
111938
112021
|
});
|
|
111939
112022
|
}
|
|
@@ -112004,9 +112087,6 @@ function parseNodeMesh(node, ctx, matrix, meshIds) {
|
|
|
112004
112087
|
if (numPrimitives > 0) {
|
|
112005
112088
|
for (let i = 0; i < numPrimitives; i++) {
|
|
112006
112089
|
const primitive = mesh.primitives[i];
|
|
112007
|
-
if (primitive.mode < 4) {
|
|
112008
|
-
continue;
|
|
112009
|
-
}
|
|
112010
112090
|
const meshCfg = {
|
|
112011
112091
|
id: ctx.sceneModel.id + "." + ctx.numObjects++
|
|
112012
112092
|
};
|
|
@@ -112416,6 +112496,7 @@ class GLTFLoaderPlugin extends Plugin {
|
|
|
112416
112496
|
* @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
|
|
112417
112497
|
* @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
|
|
112418
112498
|
* @param {*} [params.parseOptions={}] Options to pass to loaders.gl parse method, eg. ````{ gltf: { excludeExtensions: { "KHR_texture_transform": false } } }````.
|
|
112499
|
+
* @param {Boolean} [params.entityPerMesh=false] Create an entity for each mesh, instead of grouping leaf meshes under their common entity.
|
|
112419
112500
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
112420
112501
|
*/
|
|
112421
112502
|
load(params = {}) {
|