@xeokit/xeokit-sdk 2.6.35 → 2.6.36
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 +1035 -362
- package/dist/xeokit-sdk.es.js +1035 -362
- package/dist/xeokit-sdk.es5.js +111 -82
- package/dist/xeokit-sdk.min.cjs.js +4 -4
- package/dist/xeokit-sdk.min.es.js +4 -4
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +21 -6
- package/src/plugins/DotBIMLoaderPlugin/DotBIMLoaderPlugin.js +9 -11
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +8 -0
- package/src/plugins/XKTLoaderPlugin/parsers/ParserV11.js +657 -0
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +3 -3
- package/src/plugins/lib/ui/index.js +1 -1
- package/src/viewer/Viewer.js +3 -0
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickDepthRenderer.js +10 -6
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickMeshRenderer.js +14 -8
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsFlatRenderer.js +13 -8
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesPickNormalsRenderer.js +7 -10
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesDepthRenderer.js +0 -11
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -10683,8 +10683,8 @@ class SceneModelEntity {
|
|
|
10683
10683
|
}
|
|
10684
10684
|
}
|
|
10685
10685
|
|
|
10686
|
-
const tempVec4a$
|
|
10687
|
-
const tempVec4b$
|
|
10686
|
+
const tempVec4a$b = math.vec4();
|
|
10687
|
+
const tempVec4b$7 = math.vec4();
|
|
10688
10688
|
|
|
10689
10689
|
|
|
10690
10690
|
/**
|
|
@@ -10843,12 +10843,12 @@ class Marker extends Component {
|
|
|
10843
10843
|
this.fire("viewPos", this._viewPos);
|
|
10844
10844
|
}
|
|
10845
10845
|
if (this._canvasPosDirty) {
|
|
10846
|
-
tempVec4a$
|
|
10847
|
-
tempVec4a$
|
|
10848
|
-
math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$
|
|
10846
|
+
tempVec4a$b.set(this._viewPos);
|
|
10847
|
+
tempVec4a$b[3] = 1.0;
|
|
10848
|
+
math.transformPoint4(this.scene.camera.projMatrix, tempVec4a$b, tempVec4b$7);
|
|
10849
10849
|
const aabb = this.scene.canvas.boundary;
|
|
10850
|
-
this._canvasPos[0] = Math.floor((1 + tempVec4b$
|
|
10851
|
-
this._canvasPos[1] = Math.floor((1 - tempVec4b$
|
|
10850
|
+
this._canvasPos[0] = Math.floor((1 + tempVec4b$7[0] / tempVec4b$7[3]) * aabb[2] / 2);
|
|
10851
|
+
this._canvasPos[1] = Math.floor((1 - tempVec4b$7[1] / tempVec4b$7[3]) * aabb[3] / 2);
|
|
10852
10852
|
this._canvasPosDirty = false;
|
|
10853
10853
|
this.fire("canvasPos", this._canvasPos);
|
|
10854
10854
|
}
|
|
@@ -11179,7 +11179,7 @@ function activateDraggableDot(dot, cfg) {
|
|
|
11179
11179
|
|
|
11180
11180
|
const onChange = event => {
|
|
11181
11181
|
const canvasPos = math.vec2([ event.clientX, event.clientY ]);
|
|
11182
|
-
transformToNode(canvas.ownerDocument.
|
|
11182
|
+
transformToNode(canvas.ownerDocument.documentElement, canvas, canvasPos);
|
|
11183
11183
|
onMove(canvasPos, pickWorldPos(canvasPos));
|
|
11184
11184
|
};
|
|
11185
11185
|
|
|
@@ -23516,8 +23516,8 @@ const tempVec3c$u = math.vec3();
|
|
|
23516
23516
|
const tempVec3d$d = math.vec3();
|
|
23517
23517
|
const tempVec3e$2 = math.vec3();
|
|
23518
23518
|
const tempVec3f$2 = math.vec3();
|
|
23519
|
-
const tempVec4a$
|
|
23520
|
-
const tempVec4b$
|
|
23519
|
+
const tempVec4a$a = math.vec4();
|
|
23520
|
+
const tempVec4b$6 = math.vec4();
|
|
23521
23521
|
const tempVec4c$2 = math.vec4();
|
|
23522
23522
|
const tempMat = math.mat4();
|
|
23523
23523
|
const tempMatb = math.mat4();
|
|
@@ -24382,8 +24382,8 @@ class Camera extends Component {
|
|
|
24382
24382
|
* @returns {[number, number]} the canvas position
|
|
24383
24383
|
*/
|
|
24384
24384
|
projectWorldPos(worldPos) {
|
|
24385
|
-
const _worldPos = tempVec4a$
|
|
24386
|
-
const viewPos = tempVec4b$
|
|
24385
|
+
const _worldPos = tempVec4a$a;
|
|
24386
|
+
const viewPos = tempVec4b$6;
|
|
24387
24387
|
const screenPos = tempVec4c$2;
|
|
24388
24388
|
_worldPos[0] = worldPos[0];
|
|
24389
24389
|
_worldPos[1] = worldPos[1];
|
|
@@ -53646,17 +53646,6 @@ class TrianglesDepthRenderer$1 extends TrianglesBatchingRenderer {
|
|
|
53646
53646
|
src.push("uniform vec3 sectionPlaneDir" + i + ";");
|
|
53647
53647
|
}
|
|
53648
53648
|
}
|
|
53649
|
-
src.push("const float packUpScale = 256. / 255.;");
|
|
53650
|
-
src.push("const float unpackDownscale = 255. / 256.;");
|
|
53651
|
-
src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");
|
|
53652
|
-
src.push("const vec4 unpackFactors = unpackDownscale / vec4( packFactors, 1. );");
|
|
53653
|
-
src.push("const float shiftRight8 = 1.0 / 256.;");
|
|
53654
|
-
|
|
53655
|
-
src.push("vec4 packDepthToRGBA( const in float v ) {");
|
|
53656
|
-
src.push(" vec4 r = vec4( fract( v * packFactors ), v );");
|
|
53657
|
-
src.push(" r.yzw -= r.xyz * shiftRight8;");
|
|
53658
|
-
src.push(" return r * packUpScale;");
|
|
53659
|
-
src.push("}");
|
|
53660
53649
|
src.push("in vec2 vHighPrecisionZW;");
|
|
53661
53650
|
src.push("out vec4 outColor;");
|
|
53662
53651
|
src.push("void main(void) {");
|
|
@@ -56190,7 +56179,7 @@ function octDecodeVec2(oct) { // Decode an oct-encoded normal
|
|
|
56190
56179
|
|
|
56191
56180
|
const tempMat4$1 = math.mat4();
|
|
56192
56181
|
const tempMat4b = math.mat4();
|
|
56193
|
-
const tempVec4a$
|
|
56182
|
+
const tempVec4a$9 = math.vec4([0, 0, 0, 1]);
|
|
56194
56183
|
|
|
56195
56184
|
const tempVec3a$z = math.vec3();
|
|
56196
56185
|
const tempVec3b$v = math.vec3();
|
|
@@ -56999,7 +56988,7 @@ class VBOBatchingTrianglesLayer {
|
|
|
56999
56988
|
const offsetX = origin[0] ;
|
|
57000
56989
|
const offsetY = origin[1] ;
|
|
57001
56990
|
const offsetZ = origin[2] ;
|
|
57002
|
-
const worldPos = tempVec4a$
|
|
56991
|
+
const worldPos = tempVec4a$9;
|
|
57003
56992
|
const sceneModelMatrix = this.model.matrix;
|
|
57004
56993
|
const positionsDecodeMatrix = state.positionsDecodeMatrix;
|
|
57005
56994
|
for (let i = 0, len = positions.length; i < len; i += 3) {
|
|
@@ -61362,7 +61351,7 @@ function getRenderers$6(scene) {
|
|
|
61362
61351
|
|
|
61363
61352
|
const tempUint8Vec4$2 = new Uint8Array(4);
|
|
61364
61353
|
const tempFloat32$2 = new Float32Array(1);
|
|
61365
|
-
const tempVec4a$
|
|
61354
|
+
const tempVec4a$8 = math.vec4([0, 0, 0, 1]);
|
|
61366
61355
|
const tempVec3fa$2 = new Float32Array(3);
|
|
61367
61356
|
|
|
61368
61357
|
const tempVec3a$w = math.vec3();
|
|
@@ -62066,7 +62055,7 @@ class VBOInstancingTrianglesLayer {
|
|
|
62066
62055
|
const offsetX = origin[0];
|
|
62067
62056
|
const offsetY = origin[1];
|
|
62068
62057
|
const offsetZ = origin[2];
|
|
62069
|
-
const worldPos = tempVec4a$
|
|
62058
|
+
const worldPos = tempVec4a$8;
|
|
62070
62059
|
const portionMatrix = portion.matrix;
|
|
62071
62060
|
const sceneModelMatrix = this.model.matrix;
|
|
62072
62061
|
const positionsDecodeMatrix = state.positionsDecodeMatrix;
|
|
@@ -72772,7 +72761,7 @@ const tempVec3b$i = math.vec3();
|
|
|
72772
72761
|
const tempVec3c$e = math.vec3();
|
|
72773
72762
|
math.vec3();
|
|
72774
72763
|
|
|
72775
|
-
const tempVec4a$
|
|
72764
|
+
const tempVec4a$7 = math.vec4();
|
|
72776
72765
|
|
|
72777
72766
|
const tempMat4a$c = math.mat4();
|
|
72778
72767
|
|
|
@@ -73051,11 +73040,11 @@ class DTXTrianglesColorRenderer {
|
|
|
73051
73040
|
if (saoEnabled) {
|
|
73052
73041
|
const viewportWidth = gl.drawingBufferWidth;
|
|
73053
73042
|
const viewportHeight = gl.drawingBufferHeight;
|
|
73054
|
-
tempVec4a$
|
|
73055
|
-
tempVec4a$
|
|
73056
|
-
tempVec4a$
|
|
73057
|
-
tempVec4a$
|
|
73058
|
-
gl.uniform4fv(this._uSAOParams, tempVec4a$
|
|
73043
|
+
tempVec4a$7[0] = viewportWidth;
|
|
73044
|
+
tempVec4a$7[1] = viewportHeight;
|
|
73045
|
+
tempVec4a$7[2] = sao.blendCutoff;
|
|
73046
|
+
tempVec4a$7[3] = sao.blendFactor;
|
|
73047
|
+
gl.uniform4fv(this._uSAOParams, tempVec4a$7);
|
|
73059
73048
|
this._program.bindTexture(this._uOcclusionTexture, frameCtx.occlusionTexture, 10);
|
|
73060
73049
|
}
|
|
73061
73050
|
}
|
|
@@ -74714,6 +74703,12 @@ class DTXTrianglesPickMeshRenderer {
|
|
|
74714
74703
|
const textureState = state.textureState;
|
|
74715
74704
|
const origin = dataTextureLayer._state.origin;
|
|
74716
74705
|
const {position, rotationMatrix, rotationMatrixConjugate} = model;
|
|
74706
|
+
|
|
74707
|
+
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
74708
|
+
const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
|
|
74709
|
+
const eye = frameCtx.pickOrigin || camera.eye;
|
|
74710
|
+
const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
|
|
74711
|
+
|
|
74717
74712
|
textureState.bindCommonTextures(
|
|
74718
74713
|
this._program,
|
|
74719
74714
|
this.uTexturePerObjectPositionsDecodeMatrix,
|
|
@@ -74740,24 +74735,24 @@ class DTXTrianglesPickMeshRenderer {
|
|
|
74740
74735
|
rtcOrigin[0] += position[0];
|
|
74741
74736
|
rtcOrigin[1] += position[1];
|
|
74742
74737
|
rtcOrigin[2] += position[2];
|
|
74743
|
-
rtcViewMatrix = createRTCViewMat(
|
|
74738
|
+
rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$8);
|
|
74744
74739
|
rtcCameraEye = tempVec3c$c;
|
|
74745
|
-
rtcCameraEye[0] =
|
|
74746
|
-
rtcCameraEye[1] =
|
|
74747
|
-
rtcCameraEye[2] =
|
|
74740
|
+
rtcCameraEye[0] = eye[0] - rtcOrigin[0];
|
|
74741
|
+
rtcCameraEye[1] = eye[1] - rtcOrigin[1];
|
|
74742
|
+
rtcCameraEye[2] = eye[2] - rtcOrigin[2];
|
|
74748
74743
|
} else {
|
|
74749
|
-
rtcViewMatrix =
|
|
74750
|
-
rtcCameraEye =
|
|
74744
|
+
rtcViewMatrix = viewMatrix;
|
|
74745
|
+
rtcCameraEye = eye;
|
|
74751
74746
|
}
|
|
74752
74747
|
gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
|
|
74753
74748
|
gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
|
|
74754
74749
|
gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
|
|
74755
74750
|
gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
|
|
74756
|
-
gl.uniformMatrix4fv(this._uProjMatrix, false,
|
|
74751
|
+
gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
|
|
74757
74752
|
gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
|
|
74758
74753
|
gl.uniform1i(this._uRenderPass, renderPass);
|
|
74759
74754
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
74760
|
-
const logDepthBufFC = 2.0 / (Math.log(
|
|
74755
|
+
const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
|
|
74761
74756
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
74762
74757
|
}
|
|
74763
74758
|
const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
|
|
@@ -75134,7 +75129,11 @@ class DTXTrianglesPickDepthRenderer {
|
|
|
75134
75129
|
const textureState = state.textureState;
|
|
75135
75130
|
const origin = dataTextureLayer._state.origin;
|
|
75136
75131
|
const {position, rotationMatrix, rotationMatrixConjugate} = model;
|
|
75132
|
+
|
|
75137
75133
|
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
75134
|
+
const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
|
|
75135
|
+
const eye = frameCtx.pickOrigin || camera.eye;
|
|
75136
|
+
const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
|
|
75138
75137
|
|
|
75139
75138
|
if (!this._program) {
|
|
75140
75139
|
this._allocate();
|
|
@@ -75174,15 +75173,15 @@ class DTXTrianglesPickDepthRenderer {
|
|
|
75174
75173
|
rtcOrigin[2] += position[2];
|
|
75175
75174
|
rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$7);
|
|
75176
75175
|
rtcCameraEye = tempVec3c$b;
|
|
75177
|
-
rtcCameraEye[0] =
|
|
75178
|
-
rtcCameraEye[1] =
|
|
75179
|
-
rtcCameraEye[2] =
|
|
75176
|
+
rtcCameraEye[0] = eye[0] - rtcOrigin[0];
|
|
75177
|
+
rtcCameraEye[1] = eye[1] - rtcOrigin[1];
|
|
75178
|
+
rtcCameraEye[2] = eye[2] - rtcOrigin[2];
|
|
75180
75179
|
frameCtx.snapPickOrigin[0] = rtcOrigin[0];
|
|
75181
75180
|
frameCtx.snapPickOrigin[1] = rtcOrigin[1];
|
|
75182
75181
|
frameCtx.snapPickOrigin[2] = rtcOrigin[2];
|
|
75183
75182
|
} else {
|
|
75184
75183
|
rtcViewMatrix = viewMatrix;
|
|
75185
|
-
rtcCameraEye =
|
|
75184
|
+
rtcCameraEye = eye;
|
|
75186
75185
|
frameCtx.snapPickOrigin[0] = 0;
|
|
75187
75186
|
frameCtx.snapPickOrigin[1] = 0;
|
|
75188
75187
|
frameCtx.snapPickOrigin[2] = 0;
|
|
@@ -75197,9 +75196,9 @@ class DTXTrianglesPickDepthRenderer {
|
|
|
75197
75196
|
gl.uniform1f(this._uPickZFar, frameCtx.pickZFar);
|
|
75198
75197
|
gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
|
|
75199
75198
|
gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
|
|
75200
|
-
gl.uniformMatrix4fv(this._uProjMatrix, false,
|
|
75199
|
+
gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
|
|
75201
75200
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
75202
|
-
const logDepthBufFC = 2.0 / (Math.log(
|
|
75201
|
+
const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
|
|
75203
75202
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
75204
75203
|
}
|
|
75205
75204
|
|
|
@@ -77709,6 +77708,11 @@ class DTXTrianglesPickNormalsFlatRenderer {
|
|
|
77709
77708
|
this._bindProgram(frameCtx, state);
|
|
77710
77709
|
}
|
|
77711
77710
|
|
|
77711
|
+
const viewMatrix = frameCtx.pickViewMatrix || camera.viewMatrix;
|
|
77712
|
+
const projMatrix = frameCtx.pickProjMatrix || camera.projMatrix;
|
|
77713
|
+
const eye = frameCtx.pickOrigin || camera.eye;
|
|
77714
|
+
const far = frameCtx.pickProjMatrix ? frameCtx.pickZFar : camera.project.far;
|
|
77715
|
+
|
|
77712
77716
|
textureState.bindCommonTextures(
|
|
77713
77717
|
this._program,
|
|
77714
77718
|
this.uTexturePerObjectPositionsDecodeMatrix,
|
|
@@ -77737,24 +77741,24 @@ class DTXTrianglesPickNormalsFlatRenderer {
|
|
|
77737
77741
|
rtcOrigin[0] += position[0];
|
|
77738
77742
|
rtcOrigin[1] += position[1];
|
|
77739
77743
|
rtcOrigin[2] += position[2];
|
|
77740
|
-
rtcViewMatrix = createRTCViewMat(
|
|
77744
|
+
rtcViewMatrix = createRTCViewMat(viewMatrix, rtcOrigin, tempMat4a$1);
|
|
77741
77745
|
rtcCameraEye = tempVec3c$5;
|
|
77742
|
-
rtcCameraEye[0] =
|
|
77743
|
-
rtcCameraEye[1] =
|
|
77744
|
-
rtcCameraEye[2] =
|
|
77746
|
+
rtcCameraEye[0] = eye[0] - rtcOrigin[0];
|
|
77747
|
+
rtcCameraEye[1] = eye[1] - rtcOrigin[1];
|
|
77748
|
+
rtcCameraEye[2] = eye[2] - rtcOrigin[2];
|
|
77745
77749
|
} else {
|
|
77746
|
-
rtcViewMatrix =
|
|
77747
|
-
rtcCameraEye =
|
|
77750
|
+
rtcViewMatrix = viewMatrix;
|
|
77751
|
+
rtcCameraEye = eye;
|
|
77748
77752
|
}
|
|
77749
77753
|
gl.uniform2fv(this._uPickClipPos, frameCtx.pickClipPos);
|
|
77750
77754
|
gl.uniform2f(this._uDrawingBufferSize, gl.drawingBufferWidth, gl.drawingBufferHeight);
|
|
77751
77755
|
gl.uniformMatrix4fv(this._uSceneModelMatrix, false, rotationMatrixConjugate);
|
|
77752
77756
|
gl.uniformMatrix4fv(this._uViewMatrix, false, rtcViewMatrix);
|
|
77753
|
-
gl.uniformMatrix4fv(this._uProjMatrix, false,
|
|
77757
|
+
gl.uniformMatrix4fv(this._uProjMatrix, false, projMatrix);
|
|
77754
77758
|
gl.uniform3fv(this._uCameraEyeRtc, rtcCameraEye);
|
|
77755
77759
|
gl.uniform1i(this._uRenderPass, renderPass);
|
|
77756
77760
|
if (scene.logarithmicDepthBufferEnabled) {
|
|
77757
|
-
const logDepthBufFC = 2.0 / (Math.log(
|
|
77761
|
+
const logDepthBufFC = 2.0 / (Math.log(far + 1.0) / Math.LN2);
|
|
77758
77762
|
gl.uniform1f(this._uLogDepthBufFC, logDepthBufFC);
|
|
77759
77763
|
}
|
|
77760
77764
|
const numAllocatedSectionPlanes = scene._sectionPlanesState.getNumAllocatedSectionPlanes();
|
|
@@ -79298,7 +79302,7 @@ const INDICES_EDGE_INDICES_ALIGNEMENT_SIZE = 8;
|
|
|
79298
79302
|
*/
|
|
79299
79303
|
const MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE = 10;
|
|
79300
79304
|
|
|
79301
|
-
const tempVec4a$
|
|
79305
|
+
const tempVec4a$6 = math.vec4();
|
|
79302
79306
|
const tempMat4a = new Float32Array(16);
|
|
79303
79307
|
const tempUint8Array4 = new Uint8Array(4);
|
|
79304
79308
|
const tempFloat32Array3 = new Float32Array(3);
|
|
@@ -80375,7 +80379,7 @@ class DTXTrianglesLayer {
|
|
|
80375
80379
|
const offsetX = origin[0] ;
|
|
80376
80380
|
const offsetY = origin[1] ;
|
|
80377
80381
|
const offsetZ = origin[2] ;
|
|
80378
|
-
const worldPos = tempVec4a$
|
|
80382
|
+
const worldPos = tempVec4a$6;
|
|
80379
80383
|
for (let i = 0, len = positions.length; i < len; i += 3) {
|
|
80380
80384
|
worldPos[0] = positions[i];
|
|
80381
80385
|
worldPos[1] = positions[i + 1];
|
|
@@ -90212,8 +90216,13 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
90212
90216
|
}
|
|
90213
90217
|
|
|
90214
90218
|
const touch = event.touches[0];
|
|
90215
|
-
|
|
90216
|
-
|
|
90219
|
+
|
|
90220
|
+
// Get the canvas's bounding rectangle
|
|
90221
|
+
const rect = canvas.getBoundingClientRect();
|
|
90222
|
+
|
|
90223
|
+
// Calculate the touch position relative to the canvas
|
|
90224
|
+
const touchX = touch.clientX - rect.left;
|
|
90225
|
+
const touchY = touch.clientY - rect.top;
|
|
90217
90226
|
|
|
90218
90227
|
touchStartCanvasPos.set([touchX, touchY]);
|
|
90219
90228
|
touchMoveCanvasPos.set([touchX, touchY]);
|
|
@@ -90421,9 +90430,14 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
90421
90430
|
}
|
|
90422
90431
|
|
|
90423
90432
|
const touch = event.touches[0];
|
|
90424
|
-
const touchX = touch.clientX;
|
|
90425
|
-
const touchY = touch.clientY;
|
|
90426
90433
|
|
|
90434
|
+
// Get the canvas's bounding rectangle
|
|
90435
|
+
const rect = canvas.getBoundingClientRect();
|
|
90436
|
+
|
|
90437
|
+
// Calculate the touch position relative to the canvas
|
|
90438
|
+
const touchX = touch.clientX - rect.left;
|
|
90439
|
+
const touchY = touch.clientY - rect.top;
|
|
90440
|
+
|
|
90427
90441
|
if (touch.identifier !== touchId) {
|
|
90428
90442
|
return;
|
|
90429
90443
|
}
|
|
@@ -90590,8 +90604,13 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
90590
90604
|
}
|
|
90591
90605
|
|
|
90592
90606
|
const touch = event.changedTouches[0];
|
|
90593
|
-
|
|
90594
|
-
|
|
90607
|
+
|
|
90608
|
+
// Get the canvas's bounding rectangle
|
|
90609
|
+
const rect = canvas.getBoundingClientRect();
|
|
90610
|
+
|
|
90611
|
+
// Calculate the touch position relative to the canvas
|
|
90612
|
+
const touchX = touch.clientX - rect.left;
|
|
90613
|
+
const touchY = touch.clientY - rect.top;
|
|
90595
90614
|
|
|
90596
90615
|
if (touch.identifier !== touchId) {
|
|
90597
90616
|
return;
|
|
@@ -96489,8 +96508,8 @@ const tempVec3a$7 = math.vec3();
|
|
|
96489
96508
|
const tempVec3b$4 = math.vec3();
|
|
96490
96509
|
const tempVec3c$3 = math.vec3();
|
|
96491
96510
|
|
|
96492
|
-
const tempVec4a$
|
|
96493
|
-
const tempVec4b$
|
|
96511
|
+
const tempVec4a$5 = math.vec4();
|
|
96512
|
+
const tempVec4b$5 = math.vec4();
|
|
96494
96513
|
const tempVec4c$1 = math.vec4();
|
|
96495
96514
|
|
|
96496
96515
|
/**
|
|
@@ -96529,7 +96548,7 @@ class PanController {
|
|
|
96529
96548
|
|
|
96530
96549
|
camera.ortho.scale = camera.ortho.scale - dollyDelta;
|
|
96531
96550
|
|
|
96532
|
-
const unprojectedWorldPos = this._unproject(targetCanvasPos, tempVec4a$
|
|
96551
|
+
const unprojectedWorldPos = this._unproject(targetCanvasPos, tempVec4a$5);
|
|
96533
96552
|
const offset = math.subVec3(unprojectedWorldPos, camera.eye, tempVec4c$1);
|
|
96534
96553
|
const moveVec = math.mulVec3Scalar(math.normalizeVec3(offset), -dollyDelta, []);
|
|
96535
96554
|
|
|
@@ -96556,12 +96575,12 @@ class PanController {
|
|
|
96556
96575
|
// - get the vector in which we're dollying;
|
|
96557
96576
|
// - add both vectors to camera eye and look.
|
|
96558
96577
|
|
|
96559
|
-
const worldPos1 = this._unproject(targetCanvasPos, tempVec4a$
|
|
96578
|
+
const worldPos1 = this._unproject(targetCanvasPos, tempVec4a$5);
|
|
96560
96579
|
|
|
96561
96580
|
camera.ortho.scale = camera.ortho.scale - dollyDelta;
|
|
96562
96581
|
camera.ortho._update(); // HACK
|
|
96563
96582
|
|
|
96564
|
-
const worldPos2 = this._unproject(targetCanvasPos, tempVec4b$
|
|
96583
|
+
const worldPos2 = this._unproject(targetCanvasPos, tempVec4b$5);
|
|
96565
96584
|
const offset = math.subVec3(worldPos2, worldPos1, tempVec4c$1);
|
|
96566
96585
|
const eyeLookMoveVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look, camera.eye, tempVec3a$7)), -dollyDelta, tempVec3b$4);
|
|
96567
96586
|
const moveVec = math.addVec3(offset, eyeLookMoveVec, tempVec3c$3);
|
|
@@ -96595,8 +96614,8 @@ const tempVec3a$6 = math.vec3();
|
|
|
96595
96614
|
const tempVec3b$3 = math.vec3();
|
|
96596
96615
|
const tempVec3c$2 = math.vec3();
|
|
96597
96616
|
|
|
96598
|
-
const tempVec4a$
|
|
96599
|
-
const tempVec4b$
|
|
96617
|
+
const tempVec4a$4 = math.vec4();
|
|
96618
|
+
const tempVec4b$4 = math.vec4();
|
|
96600
96619
|
const tempVec4c = math.vec4();
|
|
96601
96620
|
|
|
96602
96621
|
|
|
@@ -96849,8 +96868,8 @@ class PivotController {
|
|
|
96849
96868
|
const Pt4 = transposedProjectMat.subarray(12);
|
|
96850
96869
|
const D = [0, 0, -1.0, 1];
|
|
96851
96870
|
const screenZ = math.dotVec4(D, Pt3) / math.dotVec4(D, Pt4);
|
|
96852
|
-
const worldPos = tempVec4a$
|
|
96853
|
-
camera.project.unproject(canvasPos, screenZ, tempVec4b$
|
|
96871
|
+
const worldPos = tempVec4a$4;
|
|
96872
|
+
camera.project.unproject(canvasPos, screenZ, tempVec4b$4, tempVec4c, worldPos);
|
|
96854
96873
|
const eyeWorldPosVec = math.normalizeVec3(math.subVec3(worldPos, camera.eye, tempVec3a$6));
|
|
96855
96874
|
const posOnSphere = math.addVec3(camera.eye, math.mulVec3Scalar(eyeWorldPosVec, pivotShereRadius, tempVec3b$3), tempVec3c$2);
|
|
96856
96875
|
this.setPivotPos(posOnSphere);
|
|
@@ -110210,6 +110229,9 @@ class Viewer {
|
|
|
110210
110229
|
}
|
|
110211
110230
|
}
|
|
110212
110231
|
|
|
110232
|
+
// firing "rendering" is necessary to trigger DTX{Lines,Triangles}Layer::_uploadDeferredFlags
|
|
110233
|
+
this.scene.fire("rendering", { }, true);
|
|
110234
|
+
|
|
110213
110235
|
this.scene._renderer.renderSnapshot();
|
|
110214
110236
|
|
|
110215
110237
|
const imageDataURI = this.scene._renderer.readSnapshot(params);
|
|
@@ -128125,7 +128147,7 @@ if (!pako$9.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
|
128125
128147
|
pako$9 = pako$9.default;
|
|
128126
128148
|
}
|
|
128127
128149
|
|
|
128128
|
-
const decompressColor$
|
|
128150
|
+
const decompressColor$a = (function () {
|
|
128129
128151
|
const color2 = new Float32Array(3);
|
|
128130
128152
|
return function (color) {
|
|
128131
128153
|
color2[0] = color[0] / 255.0;
|
|
@@ -128169,7 +128191,7 @@ function inflate$9(deflatedData) {
|
|
|
128169
128191
|
};
|
|
128170
128192
|
}
|
|
128171
128193
|
|
|
128172
|
-
function load$
|
|
128194
|
+
function load$a(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
128173
128195
|
|
|
128174
128196
|
manifestCtx.getNextId();
|
|
128175
128197
|
|
|
@@ -128238,7 +128260,7 @@ function load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
128238
128260
|
const lastMesh = (j === (numMeshes - 1));
|
|
128239
128261
|
const meshId = entityId + ".mesh." + j;
|
|
128240
128262
|
|
|
128241
|
-
const color = decompressColor$
|
|
128263
|
+
const color = decompressColor$a(meshColors.subarray((j * 4), (j * 4) + 3));
|
|
128242
128264
|
const opacity = meshColors[(j * 4) + 3] / 255.0;
|
|
128243
128265
|
|
|
128244
128266
|
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
@@ -128270,7 +128292,7 @@ const ParserV1 = {
|
|
|
128270
128292
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
128271
128293
|
const deflatedData = extract$9(elements);
|
|
128272
128294
|
const inflatedData = inflate$9(deflatedData);
|
|
128273
|
-
load$
|
|
128295
|
+
load$a(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
128274
128296
|
}
|
|
128275
128297
|
};
|
|
128276
128298
|
|
|
@@ -128338,6 +128360,222 @@ function inflate$8(deflatedData) {
|
|
|
128338
128360
|
};
|
|
128339
128361
|
}
|
|
128340
128362
|
|
|
128363
|
+
const decompressColor$9 = (function () {
|
|
128364
|
+
const color2 = new Float32Array(3);
|
|
128365
|
+
return function (color) {
|
|
128366
|
+
color2[0] = color[0] / 255.0;
|
|
128367
|
+
color2[1] = color[1] / 255.0;
|
|
128368
|
+
color2[2] = color[2] / 255.0;
|
|
128369
|
+
return color2;
|
|
128370
|
+
};
|
|
128371
|
+
})();
|
|
128372
|
+
|
|
128373
|
+
function load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
128374
|
+
|
|
128375
|
+
const modelPartId = manifestCtx.getNextId();
|
|
128376
|
+
|
|
128377
|
+
sceneModel.positionsCompression = "precompressed";
|
|
128378
|
+
sceneModel.normalsCompression = "precompressed";
|
|
128379
|
+
|
|
128380
|
+
const positions = inflatedData.positions;
|
|
128381
|
+
const normals = inflatedData.normals;
|
|
128382
|
+
const indices = inflatedData.indices;
|
|
128383
|
+
const edgeIndices = inflatedData.edgeIndices;
|
|
128384
|
+
const meshPositions = inflatedData.meshPositions;
|
|
128385
|
+
const meshIndices = inflatedData.meshIndices;
|
|
128386
|
+
const meshEdgesIndices = inflatedData.meshEdgesIndices;
|
|
128387
|
+
const meshColors = inflatedData.meshColors;
|
|
128388
|
+
const entityIDs = JSON.parse(inflatedData.entityIDs);
|
|
128389
|
+
const entityMeshes = inflatedData.entityMeshes;
|
|
128390
|
+
const entityIsObjects = inflatedData.entityIsObjects;
|
|
128391
|
+
const entityMeshIds = inflatedData.entityMeshIds;
|
|
128392
|
+
const entityMatrices = inflatedData.entityMatrices;
|
|
128393
|
+
const entityUsesInstancing = inflatedData.entityUsesInstancing;
|
|
128394
|
+
|
|
128395
|
+
const numMeshes = meshPositions.length;
|
|
128396
|
+
const numEntities = entityMeshes.length;
|
|
128397
|
+
|
|
128398
|
+
const alreadyCreatedGeometries = {};
|
|
128399
|
+
|
|
128400
|
+
for (let i = 0; i < numEntities; i++) {
|
|
128401
|
+
|
|
128402
|
+
const xktEntityId = entityIDs [i];
|
|
128403
|
+
const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
|
|
128404
|
+
const metaObject = viewer.metaScene.metaObjects[entityId];
|
|
128405
|
+
const entityDefaults = {};
|
|
128406
|
+
const meshDefaults = {};
|
|
128407
|
+
const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);
|
|
128408
|
+
|
|
128409
|
+
if (metaObject) {
|
|
128410
|
+
if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
|
|
128411
|
+
continue;
|
|
128412
|
+
}
|
|
128413
|
+
if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
|
|
128414
|
+
continue;
|
|
128415
|
+
}
|
|
128416
|
+
const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
|
|
128417
|
+
if (props) {
|
|
128418
|
+
if (props.visible === false) {
|
|
128419
|
+
entityDefaults.visible = false;
|
|
128420
|
+
}
|
|
128421
|
+
if (props.pickable === false) {
|
|
128422
|
+
entityDefaults.pickable = false;
|
|
128423
|
+
}
|
|
128424
|
+
if (props.colorize) {
|
|
128425
|
+
meshDefaults.color = props.colorize;
|
|
128426
|
+
}
|
|
128427
|
+
if (props.opacity !== undefined && props.opacity !== null) {
|
|
128428
|
+
meshDefaults.opacity = props.opacity;
|
|
128429
|
+
}
|
|
128430
|
+
}
|
|
128431
|
+
} else {
|
|
128432
|
+
if (options.excludeUnclassifiedObjects) {
|
|
128433
|
+
continue;
|
|
128434
|
+
}
|
|
128435
|
+
}
|
|
128436
|
+
|
|
128437
|
+
const lastEntity = (i === numEntities - 1);
|
|
128438
|
+
|
|
128439
|
+
const meshIds = [];
|
|
128440
|
+
|
|
128441
|
+
for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {
|
|
128442
|
+
|
|
128443
|
+
const jj = entityMeshIds [j];
|
|
128444
|
+
|
|
128445
|
+
const lastMesh = (jj === (numMeshes - 1));
|
|
128446
|
+
const meshId = manifestCtx.getNextId();
|
|
128447
|
+
|
|
128448
|
+
const color = decompressColor$9(meshColors.subarray((jj * 4), (jj * 4) + 3));
|
|
128449
|
+
const opacity = meshColors[(jj * 4) + 3] / 255.0;
|
|
128450
|
+
|
|
128451
|
+
const tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
|
|
128452
|
+
const tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
|
|
128453
|
+
const tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);
|
|
128454
|
+
const tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);
|
|
128455
|
+
|
|
128456
|
+
if (entityUsesInstancing [i] === 1) {
|
|
128457
|
+
|
|
128458
|
+
const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;
|
|
128459
|
+
|
|
128460
|
+
if (!(geometryId in alreadyCreatedGeometries)) {
|
|
128461
|
+
|
|
128462
|
+
sceneModel.createGeometry({
|
|
128463
|
+
id: geometryId,
|
|
128464
|
+
positionsCompressed: tmpPositions,
|
|
128465
|
+
normalsCompressed: tmpNormals,
|
|
128466
|
+
indices: tmpIndices,
|
|
128467
|
+
edgeIndices: tmpEdgeIndices,
|
|
128468
|
+
primitive: "triangles",
|
|
128469
|
+
positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
|
|
128470
|
+
});
|
|
128471
|
+
|
|
128472
|
+
alreadyCreatedGeometries [geometryId] = true;
|
|
128473
|
+
}
|
|
128474
|
+
|
|
128475
|
+
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
128476
|
+
id: meshId,
|
|
128477
|
+
color: color,
|
|
128478
|
+
opacity: opacity,
|
|
128479
|
+
matrix: entityMatrix,
|
|
128480
|
+
geometryId,
|
|
128481
|
+
}));
|
|
128482
|
+
|
|
128483
|
+
meshIds.push(meshId);
|
|
128484
|
+
|
|
128485
|
+
} else {
|
|
128486
|
+
|
|
128487
|
+
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
128488
|
+
id: meshId,
|
|
128489
|
+
primitive: "triangles",
|
|
128490
|
+
positionsCompressed: tmpPositions,
|
|
128491
|
+
normalsCompressed: tmpNormals,
|
|
128492
|
+
indices: tmpIndices,
|
|
128493
|
+
edgeIndices: tmpEdgeIndices,
|
|
128494
|
+
positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
|
|
128495
|
+
color: color,
|
|
128496
|
+
opacity: opacity
|
|
128497
|
+
}));
|
|
128498
|
+
|
|
128499
|
+
meshIds.push(meshId);
|
|
128500
|
+
}
|
|
128501
|
+
}
|
|
128502
|
+
|
|
128503
|
+
if (meshIds.length) {
|
|
128504
|
+
|
|
128505
|
+
sceneModel.createEntity(utils.apply(entityDefaults, {
|
|
128506
|
+
id: entityId,
|
|
128507
|
+
isObject: (entityIsObjects [i] === 1),
|
|
128508
|
+
meshIds: meshIds
|
|
128509
|
+
}));
|
|
128510
|
+
}
|
|
128511
|
+
}
|
|
128512
|
+
}
|
|
128513
|
+
|
|
128514
|
+
/** @private */
|
|
128515
|
+
const ParserV2 = {
|
|
128516
|
+
version: 2,
|
|
128517
|
+
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
128518
|
+
const deflatedData = extract$8(elements);
|
|
128519
|
+
const inflatedData = inflate$8(deflatedData);
|
|
128520
|
+
load$9(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
128521
|
+
}
|
|
128522
|
+
};
|
|
128523
|
+
|
|
128524
|
+
/*
|
|
128525
|
+
|
|
128526
|
+
Parser for .XKT Format V3
|
|
128527
|
+
|
|
128528
|
+
.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
|
|
128529
|
+
|
|
128530
|
+
*/
|
|
128531
|
+
|
|
128532
|
+
let pako$7 = window.pako || p;
|
|
128533
|
+
if (!pako$7.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
128534
|
+
pako$7 = pako$7.default;
|
|
128535
|
+
}
|
|
128536
|
+
|
|
128537
|
+
function extract$7(elements) {
|
|
128538
|
+
return {
|
|
128539
|
+
positions: elements[0],
|
|
128540
|
+
normals: elements[1],
|
|
128541
|
+
indices: elements[2],
|
|
128542
|
+
edgeIndices: elements[3],
|
|
128543
|
+
meshPositions: elements[4],
|
|
128544
|
+
meshIndices: elements[5],
|
|
128545
|
+
meshEdgesIndices: elements[6],
|
|
128546
|
+
meshColors: elements[7],
|
|
128547
|
+
entityIDs: elements[8],
|
|
128548
|
+
entityMeshes: elements[9],
|
|
128549
|
+
entityIsObjects: elements[10],
|
|
128550
|
+
instancedPositionsDecodeMatrix: elements[11],
|
|
128551
|
+
batchedPositionsDecodeMatrix: elements[12],
|
|
128552
|
+
entityMeshIds: elements[13],
|
|
128553
|
+
entityMatrices: elements[14],
|
|
128554
|
+
entityUsesInstancing: elements[15]
|
|
128555
|
+
};
|
|
128556
|
+
}
|
|
128557
|
+
|
|
128558
|
+
function inflate$7(deflatedData) {
|
|
128559
|
+
return {
|
|
128560
|
+
positions: new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),
|
|
128561
|
+
normals: new Int8Array(pako$7.inflate(deflatedData.normals).buffer),
|
|
128562
|
+
indices: new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),
|
|
128563
|
+
edgeIndices: new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),
|
|
128564
|
+
meshPositions: new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),
|
|
128565
|
+
meshIndices: new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),
|
|
128566
|
+
meshEdgesIndices: new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),
|
|
128567
|
+
meshColors: new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),
|
|
128568
|
+
entityIDs: pako$7.inflate(deflatedData.entityIDs, {to: 'string'}),
|
|
128569
|
+
entityMeshes: new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),
|
|
128570
|
+
entityIsObjects: new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),
|
|
128571
|
+
instancedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),
|
|
128572
|
+
batchedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),
|
|
128573
|
+
entityMeshIds: new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),
|
|
128574
|
+
entityMatrices: new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),
|
|
128575
|
+
entityUsesInstancing: new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)
|
|
128576
|
+
};
|
|
128577
|
+
}
|
|
128578
|
+
|
|
128341
128579
|
const decompressColor$8 = (function () {
|
|
128342
128580
|
const color2 = new Float32Array(3);
|
|
128343
128581
|
return function (color) {
|
|
@@ -128373,222 +128611,6 @@ function load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
128373
128611
|
const numMeshes = meshPositions.length;
|
|
128374
128612
|
const numEntities = entityMeshes.length;
|
|
128375
128613
|
|
|
128376
|
-
const alreadyCreatedGeometries = {};
|
|
128377
|
-
|
|
128378
|
-
for (let i = 0; i < numEntities; i++) {
|
|
128379
|
-
|
|
128380
|
-
const xktEntityId = entityIDs [i];
|
|
128381
|
-
const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
|
|
128382
|
-
const metaObject = viewer.metaScene.metaObjects[entityId];
|
|
128383
|
-
const entityDefaults = {};
|
|
128384
|
-
const meshDefaults = {};
|
|
128385
|
-
const entityMatrix = entityMatrices.subarray((i * 16), (i * 16) + 16);
|
|
128386
|
-
|
|
128387
|
-
if (metaObject) {
|
|
128388
|
-
if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
|
|
128389
|
-
continue;
|
|
128390
|
-
}
|
|
128391
|
-
if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
|
|
128392
|
-
continue;
|
|
128393
|
-
}
|
|
128394
|
-
const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
|
|
128395
|
-
if (props) {
|
|
128396
|
-
if (props.visible === false) {
|
|
128397
|
-
entityDefaults.visible = false;
|
|
128398
|
-
}
|
|
128399
|
-
if (props.pickable === false) {
|
|
128400
|
-
entityDefaults.pickable = false;
|
|
128401
|
-
}
|
|
128402
|
-
if (props.colorize) {
|
|
128403
|
-
meshDefaults.color = props.colorize;
|
|
128404
|
-
}
|
|
128405
|
-
if (props.opacity !== undefined && props.opacity !== null) {
|
|
128406
|
-
meshDefaults.opacity = props.opacity;
|
|
128407
|
-
}
|
|
128408
|
-
}
|
|
128409
|
-
} else {
|
|
128410
|
-
if (options.excludeUnclassifiedObjects) {
|
|
128411
|
-
continue;
|
|
128412
|
-
}
|
|
128413
|
-
}
|
|
128414
|
-
|
|
128415
|
-
const lastEntity = (i === numEntities - 1);
|
|
128416
|
-
|
|
128417
|
-
const meshIds = [];
|
|
128418
|
-
|
|
128419
|
-
for (let j = entityMeshes [i], jlen = lastEntity ? entityMeshIds.length : entityMeshes [i + 1]; j < jlen; j++) {
|
|
128420
|
-
|
|
128421
|
-
const jj = entityMeshIds [j];
|
|
128422
|
-
|
|
128423
|
-
const lastMesh = (jj === (numMeshes - 1));
|
|
128424
|
-
const meshId = manifestCtx.getNextId();
|
|
128425
|
-
|
|
128426
|
-
const color = decompressColor$8(meshColors.subarray((jj * 4), (jj * 4) + 3));
|
|
128427
|
-
const opacity = meshColors[(jj * 4) + 3] / 255.0;
|
|
128428
|
-
|
|
128429
|
-
const tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
|
|
128430
|
-
const tmpNormals = normals.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
|
|
128431
|
-
const tmpIndices = indices.subarray(meshIndices [jj], lastMesh ? indices.length : meshIndices [jj + 1]);
|
|
128432
|
-
const tmpEdgeIndices = edgeIndices.subarray(meshEdgesIndices [jj], lastMesh ? edgeIndices.length : meshEdgesIndices [jj + 1]);
|
|
128433
|
-
|
|
128434
|
-
if (entityUsesInstancing [i] === 1) {
|
|
128435
|
-
|
|
128436
|
-
const geometryId = `${modelPartId}.geometry.${meshId}.${jj}`;
|
|
128437
|
-
|
|
128438
|
-
if (!(geometryId in alreadyCreatedGeometries)) {
|
|
128439
|
-
|
|
128440
|
-
sceneModel.createGeometry({
|
|
128441
|
-
id: geometryId,
|
|
128442
|
-
positionsCompressed: tmpPositions,
|
|
128443
|
-
normalsCompressed: tmpNormals,
|
|
128444
|
-
indices: tmpIndices,
|
|
128445
|
-
edgeIndices: tmpEdgeIndices,
|
|
128446
|
-
primitive: "triangles",
|
|
128447
|
-
positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
|
|
128448
|
-
});
|
|
128449
|
-
|
|
128450
|
-
alreadyCreatedGeometries [geometryId] = true;
|
|
128451
|
-
}
|
|
128452
|
-
|
|
128453
|
-
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
128454
|
-
id: meshId,
|
|
128455
|
-
color: color,
|
|
128456
|
-
opacity: opacity,
|
|
128457
|
-
matrix: entityMatrix,
|
|
128458
|
-
geometryId,
|
|
128459
|
-
}));
|
|
128460
|
-
|
|
128461
|
-
meshIds.push(meshId);
|
|
128462
|
-
|
|
128463
|
-
} else {
|
|
128464
|
-
|
|
128465
|
-
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
128466
|
-
id: meshId,
|
|
128467
|
-
primitive: "triangles",
|
|
128468
|
-
positionsCompressed: tmpPositions,
|
|
128469
|
-
normalsCompressed: tmpNormals,
|
|
128470
|
-
indices: tmpIndices,
|
|
128471
|
-
edgeIndices: tmpEdgeIndices,
|
|
128472
|
-
positionsDecodeMatrix: inflatedData.positionsDecodeMatrix,
|
|
128473
|
-
color: color,
|
|
128474
|
-
opacity: opacity
|
|
128475
|
-
}));
|
|
128476
|
-
|
|
128477
|
-
meshIds.push(meshId);
|
|
128478
|
-
}
|
|
128479
|
-
}
|
|
128480
|
-
|
|
128481
|
-
if (meshIds.length) {
|
|
128482
|
-
|
|
128483
|
-
sceneModel.createEntity(utils.apply(entityDefaults, {
|
|
128484
|
-
id: entityId,
|
|
128485
|
-
isObject: (entityIsObjects [i] === 1),
|
|
128486
|
-
meshIds: meshIds
|
|
128487
|
-
}));
|
|
128488
|
-
}
|
|
128489
|
-
}
|
|
128490
|
-
}
|
|
128491
|
-
|
|
128492
|
-
/** @private */
|
|
128493
|
-
const ParserV2 = {
|
|
128494
|
-
version: 2,
|
|
128495
|
-
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
128496
|
-
const deflatedData = extract$8(elements);
|
|
128497
|
-
const inflatedData = inflate$8(deflatedData);
|
|
128498
|
-
load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
128499
|
-
}
|
|
128500
|
-
};
|
|
128501
|
-
|
|
128502
|
-
/*
|
|
128503
|
-
|
|
128504
|
-
Parser for .XKT Format V3
|
|
128505
|
-
|
|
128506
|
-
.XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
|
|
128507
|
-
|
|
128508
|
-
*/
|
|
128509
|
-
|
|
128510
|
-
let pako$7 = window.pako || p;
|
|
128511
|
-
if (!pako$7.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
128512
|
-
pako$7 = pako$7.default;
|
|
128513
|
-
}
|
|
128514
|
-
|
|
128515
|
-
function extract$7(elements) {
|
|
128516
|
-
return {
|
|
128517
|
-
positions: elements[0],
|
|
128518
|
-
normals: elements[1],
|
|
128519
|
-
indices: elements[2],
|
|
128520
|
-
edgeIndices: elements[3],
|
|
128521
|
-
meshPositions: elements[4],
|
|
128522
|
-
meshIndices: elements[5],
|
|
128523
|
-
meshEdgesIndices: elements[6],
|
|
128524
|
-
meshColors: elements[7],
|
|
128525
|
-
entityIDs: elements[8],
|
|
128526
|
-
entityMeshes: elements[9],
|
|
128527
|
-
entityIsObjects: elements[10],
|
|
128528
|
-
instancedPositionsDecodeMatrix: elements[11],
|
|
128529
|
-
batchedPositionsDecodeMatrix: elements[12],
|
|
128530
|
-
entityMeshIds: elements[13],
|
|
128531
|
-
entityMatrices: elements[14],
|
|
128532
|
-
entityUsesInstancing: elements[15]
|
|
128533
|
-
};
|
|
128534
|
-
}
|
|
128535
|
-
|
|
128536
|
-
function inflate$7(deflatedData) {
|
|
128537
|
-
return {
|
|
128538
|
-
positions: new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),
|
|
128539
|
-
normals: new Int8Array(pako$7.inflate(deflatedData.normals).buffer),
|
|
128540
|
-
indices: new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),
|
|
128541
|
-
edgeIndices: new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),
|
|
128542
|
-
meshPositions: new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),
|
|
128543
|
-
meshIndices: new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),
|
|
128544
|
-
meshEdgesIndices: new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),
|
|
128545
|
-
meshColors: new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),
|
|
128546
|
-
entityIDs: pako$7.inflate(deflatedData.entityIDs, {to: 'string'}),
|
|
128547
|
-
entityMeshes: new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),
|
|
128548
|
-
entityIsObjects: new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),
|
|
128549
|
-
instancedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),
|
|
128550
|
-
batchedPositionsDecodeMatrix: new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),
|
|
128551
|
-
entityMeshIds: new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),
|
|
128552
|
-
entityMatrices: new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),
|
|
128553
|
-
entityUsesInstancing: new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)
|
|
128554
|
-
};
|
|
128555
|
-
}
|
|
128556
|
-
|
|
128557
|
-
const decompressColor$7 = (function () {
|
|
128558
|
-
const color2 = new Float32Array(3);
|
|
128559
|
-
return function (color) {
|
|
128560
|
-
color2[0] = color[0] / 255.0;
|
|
128561
|
-
color2[1] = color[1] / 255.0;
|
|
128562
|
-
color2[2] = color[2] / 255.0;
|
|
128563
|
-
return color2;
|
|
128564
|
-
};
|
|
128565
|
-
})();
|
|
128566
|
-
|
|
128567
|
-
function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
128568
|
-
|
|
128569
|
-
const modelPartId = manifestCtx.getNextId();
|
|
128570
|
-
|
|
128571
|
-
sceneModel.positionsCompression = "precompressed";
|
|
128572
|
-
sceneModel.normalsCompression = "precompressed";
|
|
128573
|
-
|
|
128574
|
-
const positions = inflatedData.positions;
|
|
128575
|
-
const normals = inflatedData.normals;
|
|
128576
|
-
const indices = inflatedData.indices;
|
|
128577
|
-
const edgeIndices = inflatedData.edgeIndices;
|
|
128578
|
-
const meshPositions = inflatedData.meshPositions;
|
|
128579
|
-
const meshIndices = inflatedData.meshIndices;
|
|
128580
|
-
const meshEdgesIndices = inflatedData.meshEdgesIndices;
|
|
128581
|
-
const meshColors = inflatedData.meshColors;
|
|
128582
|
-
const entityIDs = JSON.parse(inflatedData.entityIDs);
|
|
128583
|
-
const entityMeshes = inflatedData.entityMeshes;
|
|
128584
|
-
const entityIsObjects = inflatedData.entityIsObjects;
|
|
128585
|
-
const entityMeshIds = inflatedData.entityMeshIds;
|
|
128586
|
-
const entityMatrices = inflatedData.entityMatrices;
|
|
128587
|
-
const entityUsesInstancing = inflatedData.entityUsesInstancing;
|
|
128588
|
-
|
|
128589
|
-
const numMeshes = meshPositions.length;
|
|
128590
|
-
const numEntities = entityMeshes.length;
|
|
128591
|
-
|
|
128592
128614
|
const _alreadyCreatedGeometries = {};
|
|
128593
128615
|
|
|
128594
128616
|
for (let i = 0; i < numEntities; i++) {
|
|
@@ -128642,7 +128664,7 @@ function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
128642
128664
|
const lastMesh = (jj === (numMeshes - 1));
|
|
128643
128665
|
const meshId = `${modelPartId}.${entityId}.mesh.${jj}`;
|
|
128644
128666
|
|
|
128645
|
-
const color = decompressColor$
|
|
128667
|
+
const color = decompressColor$8(meshColors.subarray((jj * 4), (jj * 4) + 3));
|
|
128646
128668
|
const opacity = meshColors[(jj * 4) + 3] / 255.0;
|
|
128647
128669
|
|
|
128648
128670
|
var tmpPositions = positions.subarray(meshPositions [jj], lastMesh ? positions.length : meshPositions [jj + 1]);
|
|
@@ -128713,7 +128735,7 @@ const ParserV3 = {
|
|
|
128713
128735
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
128714
128736
|
const deflatedData = extract$7(elements);
|
|
128715
128737
|
const inflatedData = inflate$7(deflatedData);
|
|
128716
|
-
load$
|
|
128738
|
+
load$8(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
128717
128739
|
}
|
|
128718
128740
|
};
|
|
128719
128741
|
|
|
@@ -128771,7 +128793,7 @@ function inflate$6(deflatedData) {
|
|
|
128771
128793
|
};
|
|
128772
128794
|
}
|
|
128773
128795
|
|
|
128774
|
-
const decompressColor$
|
|
128796
|
+
const decompressColor$7 = (function () {
|
|
128775
128797
|
const color2 = new Float32Array(3);
|
|
128776
128798
|
return function (color) {
|
|
128777
128799
|
color2[0] = color[0] / 255.0;
|
|
@@ -128781,7 +128803,7 @@ const decompressColor$6 = (function () {
|
|
|
128781
128803
|
};
|
|
128782
128804
|
})();
|
|
128783
128805
|
|
|
128784
|
-
function load$
|
|
128806
|
+
function load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
128785
128807
|
|
|
128786
128808
|
const modelPartId = manifestCtx.getNextId();
|
|
128787
128809
|
|
|
@@ -128877,7 +128899,7 @@ function load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
128877
128899
|
const primitiveInstanceCount = primitiveInstanceCounts[orderedPrimitiveIndex];
|
|
128878
128900
|
const isInstancedPrimitive = (primitiveInstanceCount > 1);
|
|
128879
128901
|
|
|
128880
|
-
const color = decompressColor$
|
|
128902
|
+
const color = decompressColor$7(eachPrimitiveColor.subarray((orderedPrimitiveIndex * 4), (orderedPrimitiveIndex * 4) + 3));
|
|
128881
128903
|
const opacity = eachPrimitiveColor[(orderedPrimitiveIndex * 4) + 3] / 255.0;
|
|
128882
128904
|
|
|
128883
128905
|
const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [orderedPrimitiveIndex + 1]);
|
|
@@ -128987,7 +129009,7 @@ const ParserV4 = {
|
|
|
128987
129009
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
128988
129010
|
const deflatedData = extract$6(elements);
|
|
128989
129011
|
const inflatedData = inflate$6(deflatedData);
|
|
128990
|
-
load$
|
|
129012
|
+
load$7(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
128991
129013
|
}
|
|
128992
129014
|
};
|
|
128993
129015
|
|
|
@@ -129040,7 +129062,7 @@ function inflate$5(deflatedData) {
|
|
|
129040
129062
|
};
|
|
129041
129063
|
}
|
|
129042
129064
|
|
|
129043
|
-
const decompressColor$
|
|
129065
|
+
const decompressColor$6 = (function () {
|
|
129044
129066
|
const color2 = new Float32Array(3);
|
|
129045
129067
|
return function (color) {
|
|
129046
129068
|
color2[0] = color[0] / 255.0;
|
|
@@ -129050,7 +129072,7 @@ const decompressColor$5 = (function () {
|
|
|
129050
129072
|
};
|
|
129051
129073
|
})();
|
|
129052
129074
|
|
|
129053
|
-
function load$
|
|
129075
|
+
function load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
129054
129076
|
|
|
129055
129077
|
const modelPartId = manifestCtx.getNextId();
|
|
129056
129078
|
|
|
@@ -129119,7 +129141,7 @@ function load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
129119
129141
|
const primitiveInstanceCount = primitiveInstanceCounts[primitiveIndex];
|
|
129120
129142
|
const isInstancedPrimitive = (primitiveInstanceCount > 1);
|
|
129121
129143
|
|
|
129122
|
-
const color = decompressColor$
|
|
129144
|
+
const color = decompressColor$6(eachPrimitiveColor.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
|
|
129123
129145
|
const opacity = eachPrimitiveColor[(primitiveIndex * 4) + 3] / 255.0;
|
|
129124
129146
|
|
|
129125
129147
|
const primitivePositions = positions.subarray(eachPrimitivePositionsAndNormalsPortion [primitiveIndex], atLastPrimitive ? positions.length : eachPrimitivePositionsAndNormalsPortion [primitiveIndex + 1]);
|
|
@@ -129225,7 +129247,7 @@ const ParserV5 = {
|
|
|
129225
129247
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
129226
129248
|
const deflatedData = extract$5(elements);
|
|
129227
129249
|
const inflatedData = inflate$5(deflatedData);
|
|
129228
|
-
load$
|
|
129250
|
+
load$6(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
129229
129251
|
}
|
|
129230
129252
|
};
|
|
129231
129253
|
|
|
@@ -129288,7 +129310,7 @@ function inflate$4(deflatedData) {
|
|
|
129288
129310
|
};
|
|
129289
129311
|
}
|
|
129290
129312
|
|
|
129291
|
-
const decompressColor$
|
|
129313
|
+
const decompressColor$5 = (function () {
|
|
129292
129314
|
const floatColor = new Float32Array(3);
|
|
129293
129315
|
return function (intColor) {
|
|
129294
129316
|
floatColor[0] = intColor[0] / 255.0;
|
|
@@ -129298,7 +129320,7 @@ const decompressColor$4 = (function () {
|
|
|
129298
129320
|
};
|
|
129299
129321
|
})();
|
|
129300
129322
|
|
|
129301
|
-
function load$
|
|
129323
|
+
function load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
129302
129324
|
|
|
129303
129325
|
const modelPartId = manifestCtx.getNextId();
|
|
129304
129326
|
|
|
@@ -129446,7 +129468,7 @@ function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
129446
129468
|
const primitiveIndices = indices.subarray(eachPrimitiveIndicesPortion [primitiveIndex], atLastPrimitive ? indices.length : eachPrimitiveIndicesPortion [primitiveIndex + 1]);
|
|
129447
129469
|
const primitiveEdgeIndices = edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion [primitiveIndex], atLastPrimitive ? edgeIndices.length : eachPrimitiveEdgeIndicesPortion [primitiveIndex + 1]);
|
|
129448
129470
|
|
|
129449
|
-
const color = decompressColor$
|
|
129471
|
+
const color = decompressColor$5(eachPrimitiveColorAndOpacity.subarray((primitiveIndex * 4), (primitiveIndex * 4) + 3));
|
|
129450
129472
|
const opacity = eachPrimitiveColorAndOpacity[(primitiveIndex * 4) + 3] / 255.0;
|
|
129451
129473
|
|
|
129452
129474
|
const meshId = manifestCtx.getNextId();
|
|
@@ -129520,7 +129542,7 @@ const ParserV6 = {
|
|
|
129520
129542
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
129521
129543
|
const deflatedData = extract$4(elements);
|
|
129522
129544
|
const inflatedData = inflate$4(deflatedData);
|
|
129523
|
-
load$
|
|
129545
|
+
load$5(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
129524
129546
|
}
|
|
129525
129547
|
};
|
|
129526
129548
|
|
|
@@ -129618,7 +129640,7 @@ function inflate$3(deflatedData) {
|
|
|
129618
129640
|
};
|
|
129619
129641
|
}
|
|
129620
129642
|
|
|
129621
|
-
const decompressColor$
|
|
129643
|
+
const decompressColor$4 = (function () {
|
|
129622
129644
|
const floatColor = new Float32Array(3);
|
|
129623
129645
|
return function (intColor) {
|
|
129624
129646
|
floatColor[0] = intColor[0] / 255.0;
|
|
@@ -129639,7 +129661,7 @@ function convertColorsRGBToRGBA$1(colorsRGB) {
|
|
|
129639
129661
|
return colorsRGBA;
|
|
129640
129662
|
}
|
|
129641
129663
|
|
|
129642
|
-
function load$
|
|
129664
|
+
function load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
129643
129665
|
|
|
129644
129666
|
const modelPartId = manifestCtx.getNextId();
|
|
129645
129667
|
|
|
@@ -129790,7 +129812,7 @@ function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
129790
129812
|
|
|
129791
129813
|
const atLastGeometry = (geometryIndex === (numGeometries - 1));
|
|
129792
129814
|
|
|
129793
|
-
const meshColor = decompressColor$
|
|
129815
|
+
const meshColor = decompressColor$4(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
129794
129816
|
const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
|
|
129795
129817
|
const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
|
|
129796
129818
|
const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
|
|
@@ -129951,7 +129973,7 @@ const ParserV7 = {
|
|
|
129951
129973
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
129952
129974
|
const deflatedData = extract$3(elements);
|
|
129953
129975
|
const inflatedData = inflate$3(deflatedData);
|
|
129954
|
-
load$
|
|
129976
|
+
load$4(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
129955
129977
|
}
|
|
129956
129978
|
};
|
|
129957
129979
|
|
|
@@ -129966,8 +129988,8 @@ if (!pako$2.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
|
129966
129988
|
pako$2 = pako$2.default;
|
|
129967
129989
|
}
|
|
129968
129990
|
|
|
129969
|
-
const tempVec4a$
|
|
129970
|
-
const tempVec4b$
|
|
129991
|
+
const tempVec4a$3 = math.vec4();
|
|
129992
|
+
const tempVec4b$3 = math.vec4();
|
|
129971
129993
|
|
|
129972
129994
|
function extract$2(elements) {
|
|
129973
129995
|
|
|
@@ -130059,7 +130081,7 @@ function inflate$2(deflatedData) {
|
|
|
130059
130081
|
};
|
|
130060
130082
|
}
|
|
130061
130083
|
|
|
130062
|
-
const decompressColor$
|
|
130084
|
+
const decompressColor$3 = (function () {
|
|
130063
130085
|
const floatColor = new Float32Array(3);
|
|
130064
130086
|
return function (intColor) {
|
|
130065
130087
|
floatColor[0] = intColor[0] / 255.0;
|
|
@@ -130080,7 +130102,7 @@ function convertColorsRGBToRGBA(colorsRGB) {
|
|
|
130080
130102
|
return colorsRGBA;
|
|
130081
130103
|
}
|
|
130082
130104
|
|
|
130083
|
-
function load$
|
|
130105
|
+
function load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
130084
130106
|
|
|
130085
130107
|
const modelPartId = manifestCtx.getNextId();
|
|
130086
130108
|
|
|
@@ -130266,7 +130288,7 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
130266
130288
|
|
|
130267
130289
|
const atLastGeometry = (geometryIndex === (numGeometries - 1));
|
|
130268
130290
|
|
|
130269
|
-
const meshColor = decompressColor$
|
|
130291
|
+
const meshColor = decompressColor$3(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
130270
130292
|
const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
|
|
130271
130293
|
const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
|
|
130272
130294
|
const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
|
|
@@ -130355,15 +130377,15 @@ function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
130355
130377
|
const decompressedPositions = geometryArrays.decompressedPositions;
|
|
130356
130378
|
const positions = new Uint16Array(decompressedPositions.length);
|
|
130357
130379
|
for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
|
|
130358
|
-
tempVec4a$
|
|
130359
|
-
tempVec4a$
|
|
130360
|
-
tempVec4a$
|
|
130361
|
-
tempVec4a$
|
|
130362
|
-
math.transformVec4(meshMatrix, tempVec4a$
|
|
130363
|
-
geometryCompressionUtils.compressPosition(tempVec4b$
|
|
130364
|
-
positions[i + 0] = tempVec4a$
|
|
130365
|
-
positions[i + 1] = tempVec4a$
|
|
130366
|
-
positions[i + 2] = tempVec4a$
|
|
130380
|
+
tempVec4a$3[0] = decompressedPositions[i + 0];
|
|
130381
|
+
tempVec4a$3[1] = decompressedPositions[i + 1];
|
|
130382
|
+
tempVec4a$3[2] = decompressedPositions[i + 2];
|
|
130383
|
+
tempVec4a$3[3] = 1;
|
|
130384
|
+
math.transformVec4(meshMatrix, tempVec4a$3, tempVec4b$3);
|
|
130385
|
+
geometryCompressionUtils.compressPosition(tempVec4b$3, rtcAABB, tempVec4a$3);
|
|
130386
|
+
positions[i + 0] = tempVec4a$3[0];
|
|
130387
|
+
positions[i + 1] = tempVec4a$3[1];
|
|
130388
|
+
positions[i + 2] = tempVec4a$3[2];
|
|
130367
130389
|
}
|
|
130368
130390
|
|
|
130369
130391
|
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
@@ -130503,7 +130525,7 @@ const ParserV8 = {
|
|
|
130503
130525
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
130504
130526
|
const deflatedData = extract$2(elements);
|
|
130505
130527
|
const inflatedData = inflate$2(deflatedData);
|
|
130506
|
-
load$
|
|
130528
|
+
load$3(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
130507
130529
|
}
|
|
130508
130530
|
};
|
|
130509
130531
|
|
|
@@ -130518,8 +130540,8 @@ if (!pako$1.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
|
130518
130540
|
pako$1 = pako$1.default;
|
|
130519
130541
|
}
|
|
130520
130542
|
|
|
130521
|
-
const tempVec4a$
|
|
130522
|
-
const tempVec4b$
|
|
130543
|
+
const tempVec4a$2 = math.vec4();
|
|
130544
|
+
const tempVec4b$2 = math.vec4();
|
|
130523
130545
|
|
|
130524
130546
|
function extract$1(elements) {
|
|
130525
130547
|
|
|
@@ -130603,7 +130625,7 @@ function inflate$1(deflatedData) {
|
|
|
130603
130625
|
};
|
|
130604
130626
|
}
|
|
130605
130627
|
|
|
130606
|
-
const decompressColor$
|
|
130628
|
+
const decompressColor$2 = (function () {
|
|
130607
130629
|
const floatColor = new Float32Array(3);
|
|
130608
130630
|
return function (intColor) {
|
|
130609
130631
|
floatColor[0] = intColor[0] / 255.0;
|
|
@@ -130613,7 +130635,7 @@ const decompressColor$1 = (function () {
|
|
|
130613
130635
|
};
|
|
130614
130636
|
})();
|
|
130615
130637
|
|
|
130616
|
-
function load$
|
|
130638
|
+
function load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
130617
130639
|
|
|
130618
130640
|
const modelPartId = manifestCtx.getNextId();
|
|
130619
130641
|
|
|
@@ -130775,7 +130797,7 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
130775
130797
|
|
|
130776
130798
|
const atLastGeometry = (geometryIndex === (numGeometries - 1));
|
|
130777
130799
|
|
|
130778
|
-
const meshColor = decompressColor$
|
|
130800
|
+
const meshColor = decompressColor$2(eachMeshMaterial.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
130779
130801
|
const meshOpacity = eachMeshMaterial[(meshIndex * 6) + 3] / 255.0;
|
|
130780
130802
|
const meshMetallic = eachMeshMaterial[(meshIndex * 6) + 4] / 255.0;
|
|
130781
130803
|
const meshRoughness = eachMeshMaterial[(meshIndex * 6) + 5] / 255.0;
|
|
@@ -130862,15 +130884,15 @@ function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCt
|
|
|
130862
130884
|
const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;
|
|
130863
130885
|
|
|
130864
130886
|
for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
|
|
130865
|
-
tempVec4a$
|
|
130866
|
-
tempVec4a$
|
|
130867
|
-
tempVec4a$
|
|
130868
|
-
tempVec4a$
|
|
130869
|
-
math.transformVec4(meshMatrix, tempVec4a$
|
|
130870
|
-
geometryCompressionUtils.compressPosition(tempVec4b$
|
|
130871
|
-
transformedAndRecompressedPositions[i + 0] = tempVec4a$
|
|
130872
|
-
transformedAndRecompressedPositions[i + 1] = tempVec4a$
|
|
130873
|
-
transformedAndRecompressedPositions[i + 2] = tempVec4a$
|
|
130887
|
+
tempVec4a$2[0] = decompressedPositions[i + 0];
|
|
130888
|
+
tempVec4a$2[1] = decompressedPositions[i + 1];
|
|
130889
|
+
tempVec4a$2[2] = decompressedPositions[i + 2];
|
|
130890
|
+
tempVec4a$2[3] = 1;
|
|
130891
|
+
math.transformVec4(meshMatrix, tempVec4a$2, tempVec4b$2);
|
|
130892
|
+
geometryCompressionUtils.compressPosition(tempVec4b$2, rtcAABB, tempVec4a$2);
|
|
130893
|
+
transformedAndRecompressedPositions[i + 0] = tempVec4a$2[0];
|
|
130894
|
+
transformedAndRecompressedPositions[i + 1] = tempVec4a$2[1];
|
|
130895
|
+
transformedAndRecompressedPositions[i + 2] = tempVec4a$2[2];
|
|
130874
130896
|
}
|
|
130875
130897
|
|
|
130876
130898
|
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
@@ -131010,7 +131032,7 @@ const ParserV9 = {
|
|
|
131010
131032
|
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
131011
131033
|
const deflatedData = extract$1(elements);
|
|
131012
131034
|
const inflatedData = inflate$1(deflatedData);
|
|
131013
|
-
load$
|
|
131035
|
+
load$2(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
131014
131036
|
}
|
|
131015
131037
|
};
|
|
131016
131038
|
|
|
@@ -131023,10 +131045,10 @@ if (!pako.inflate) { // See https://github.com/nodeca/pako/issues/97
|
|
|
131023
131045
|
pako = pako.default;
|
|
131024
131046
|
}
|
|
131025
131047
|
|
|
131026
|
-
const tempVec4a = math.vec4();
|
|
131027
|
-
const tempVec4b = math.vec4();
|
|
131048
|
+
const tempVec4a$1 = math.vec4();
|
|
131049
|
+
const tempVec4b$1 = math.vec4();
|
|
131028
131050
|
|
|
131029
|
-
const NUM_TEXTURE_ATTRIBUTES = 9;
|
|
131051
|
+
const NUM_TEXTURE_ATTRIBUTES$1 = 9;
|
|
131030
131052
|
|
|
131031
131053
|
function extract(elements) {
|
|
131032
131054
|
|
|
@@ -131102,6 +131124,648 @@ function inflate(deflatedData) {
|
|
|
131102
131124
|
};
|
|
131103
131125
|
}
|
|
131104
131126
|
|
|
131127
|
+
const decompressColor$1 = (function () {
|
|
131128
|
+
const floatColor = new Float32Array(3);
|
|
131129
|
+
return function (intColor) {
|
|
131130
|
+
floatColor[0] = intColor[0] / 255.0;
|
|
131131
|
+
floatColor[1] = intColor[1] / 255.0;
|
|
131132
|
+
floatColor[2] = intColor[2] / 255.0;
|
|
131133
|
+
return floatColor;
|
|
131134
|
+
};
|
|
131135
|
+
})();
|
|
131136
|
+
|
|
131137
|
+
((function () {
|
|
131138
|
+
const canvas = document.createElement('canvas');
|
|
131139
|
+
const context = canvas.getContext('2d');
|
|
131140
|
+
return function (imagedata) {
|
|
131141
|
+
canvas.width = imagedata.width;
|
|
131142
|
+
canvas.height = imagedata.height;
|
|
131143
|
+
context.putImageData(imagedata, 0, 0);
|
|
131144
|
+
return canvas.toDataURL();
|
|
131145
|
+
};
|
|
131146
|
+
}))();
|
|
131147
|
+
|
|
131148
|
+
function load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx) {
|
|
131149
|
+
|
|
131150
|
+
const modelPartId = manifestCtx.getNextId();
|
|
131151
|
+
|
|
131152
|
+
const metadata = inflatedData.metadata;
|
|
131153
|
+
const textureData = inflatedData.textureData;
|
|
131154
|
+
const eachTextureDataPortion = inflatedData.eachTextureDataPortion;
|
|
131155
|
+
const eachTextureAttributes = inflatedData.eachTextureAttributes;
|
|
131156
|
+
const positions = inflatedData.positions;
|
|
131157
|
+
const normals = inflatedData.normals;
|
|
131158
|
+
const colors = inflatedData.colors;
|
|
131159
|
+
const uvs = inflatedData.uvs;
|
|
131160
|
+
const indices = inflatedData.indices;
|
|
131161
|
+
const edgeIndices = inflatedData.edgeIndices;
|
|
131162
|
+
const eachTextureSetTextures = inflatedData.eachTextureSetTextures;
|
|
131163
|
+
const matrices = inflatedData.matrices;
|
|
131164
|
+
const reusedGeometriesDecodeMatrix = inflatedData.reusedGeometriesDecodeMatrix;
|
|
131165
|
+
const eachGeometryPrimitiveType = inflatedData.eachGeometryPrimitiveType;
|
|
131166
|
+
const eachGeometryPositionsPortion = inflatedData.eachGeometryPositionsPortion;
|
|
131167
|
+
const eachGeometryNormalsPortion = inflatedData.eachGeometryNormalsPortion;
|
|
131168
|
+
const eachGeometryColorsPortion = inflatedData.eachGeometryColorsPortion;
|
|
131169
|
+
const eachGeometryUVsPortion = inflatedData.eachGeometryUVsPortion;
|
|
131170
|
+
const eachGeometryIndicesPortion = inflatedData.eachGeometryIndicesPortion;
|
|
131171
|
+
const eachGeometryEdgeIndicesPortion = inflatedData.eachGeometryEdgeIndicesPortion;
|
|
131172
|
+
const eachMeshGeometriesPortion = inflatedData.eachMeshGeometriesPortion;
|
|
131173
|
+
const eachMeshMatricesPortion = inflatedData.eachMeshMatricesPortion;
|
|
131174
|
+
const eachMeshTextureSet = inflatedData.eachMeshTextureSet;
|
|
131175
|
+
const eachMeshMaterialAttributes = inflatedData.eachMeshMaterialAttributes;
|
|
131176
|
+
const eachEntityId = inflatedData.eachEntityId;
|
|
131177
|
+
const eachEntityMeshesPortion = inflatedData.eachEntityMeshesPortion;
|
|
131178
|
+
const eachTileAABB = inflatedData.eachTileAABB;
|
|
131179
|
+
const eachTileEntitiesPortion = inflatedData.eachTileEntitiesPortion;
|
|
131180
|
+
|
|
131181
|
+
const numTextures = eachTextureDataPortion.length;
|
|
131182
|
+
const numTextureSets = eachTextureSetTextures.length / 5;
|
|
131183
|
+
const numGeometries = eachGeometryPositionsPortion.length;
|
|
131184
|
+
const numMeshes = eachMeshGeometriesPortion.length;
|
|
131185
|
+
const numEntities = eachEntityMeshesPortion.length;
|
|
131186
|
+
const numTiles = eachTileEntitiesPortion.length;
|
|
131187
|
+
|
|
131188
|
+
if (metaModel) {
|
|
131189
|
+
metaModel.loadData(metadata, {
|
|
131190
|
+
includeTypes: options.includeTypes,
|
|
131191
|
+
excludeTypes: options.excludeTypes,
|
|
131192
|
+
globalizeObjectIds: options.globalizeObjectIds
|
|
131193
|
+
}); // Can be empty
|
|
131194
|
+
}
|
|
131195
|
+
|
|
131196
|
+
// Create textures
|
|
131197
|
+
|
|
131198
|
+
for (let textureIndex = 0; textureIndex < numTextures; textureIndex++) {
|
|
131199
|
+
const atLastTexture = (textureIndex === (numTextures - 1));
|
|
131200
|
+
const textureDataPortionStart = eachTextureDataPortion[textureIndex];
|
|
131201
|
+
const textureDataPortionEnd = atLastTexture ? textureData.length : (eachTextureDataPortion[textureIndex + 1]);
|
|
131202
|
+
|
|
131203
|
+
const textureDataPortionSize = textureDataPortionEnd - textureDataPortionStart;
|
|
131204
|
+
const textureDataPortionExists = (textureDataPortionSize > 0);
|
|
131205
|
+
|
|
131206
|
+
const textureAttrBaseIdx = (textureIndex * NUM_TEXTURE_ATTRIBUTES$1);
|
|
131207
|
+
|
|
131208
|
+
const compressed = (eachTextureAttributes[textureAttrBaseIdx + 0] === 1);
|
|
131209
|
+
const mediaType = eachTextureAttributes[textureAttrBaseIdx + 1];
|
|
131210
|
+
eachTextureAttributes[textureAttrBaseIdx + 2];
|
|
131211
|
+
eachTextureAttributes[textureAttrBaseIdx + 3];
|
|
131212
|
+
const minFilter = eachTextureAttributes[textureAttrBaseIdx + 4];
|
|
131213
|
+
const magFilter = eachTextureAttributes[textureAttrBaseIdx + 5]; // LinearFilter | NearestFilter
|
|
131214
|
+
const wrapS = eachTextureAttributes[textureAttrBaseIdx + 6]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
131215
|
+
const wrapT = eachTextureAttributes[textureAttrBaseIdx + 7]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
131216
|
+
const wrapR = eachTextureAttributes[textureAttrBaseIdx + 8]; // ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
131217
|
+
|
|
131218
|
+
if (textureDataPortionExists) {
|
|
131219
|
+
|
|
131220
|
+
const imageDataSubarray = new Uint8Array(textureData.subarray(textureDataPortionStart, textureDataPortionEnd));
|
|
131221
|
+
const arrayBuffer = imageDataSubarray.buffer;
|
|
131222
|
+
const textureId = `${modelPartId}-texture-${textureIndex}`;
|
|
131223
|
+
|
|
131224
|
+
if (compressed) {
|
|
131225
|
+
|
|
131226
|
+
sceneModel.createTexture({
|
|
131227
|
+
id: textureId,
|
|
131228
|
+
buffers: [arrayBuffer],
|
|
131229
|
+
minFilter,
|
|
131230
|
+
magFilter,
|
|
131231
|
+
wrapS,
|
|
131232
|
+
wrapT,
|
|
131233
|
+
wrapR
|
|
131234
|
+
});
|
|
131235
|
+
|
|
131236
|
+
} else {
|
|
131237
|
+
|
|
131238
|
+
const mimeType = mediaType === JPEGMediaType ? "image/jpeg" : (mediaType === PNGMediaType ? "image/png" : "image/gif");
|
|
131239
|
+
const blob = new Blob([arrayBuffer], {type: mimeType});
|
|
131240
|
+
const urlCreator = window.URL || window.webkitURL;
|
|
131241
|
+
const imageUrl = urlCreator.createObjectURL(blob);
|
|
131242
|
+
const img = document.createElement('img');
|
|
131243
|
+
img.src = imageUrl;
|
|
131244
|
+
|
|
131245
|
+
sceneModel.createTexture({
|
|
131246
|
+
id: textureId,
|
|
131247
|
+
image: img,
|
|
131248
|
+
//mediaType,
|
|
131249
|
+
minFilter,
|
|
131250
|
+
magFilter,
|
|
131251
|
+
wrapS,
|
|
131252
|
+
wrapT,
|
|
131253
|
+
wrapR
|
|
131254
|
+
});
|
|
131255
|
+
}
|
|
131256
|
+
}
|
|
131257
|
+
}
|
|
131258
|
+
|
|
131259
|
+
// Create texture sets
|
|
131260
|
+
|
|
131261
|
+
for (let textureSetIndex = 0; textureSetIndex < numTextureSets; textureSetIndex++) {
|
|
131262
|
+
const eachTextureSetTexturesIndex = textureSetIndex * 5;
|
|
131263
|
+
const textureSetId = `${modelPartId}-textureSet-${textureSetIndex}`;
|
|
131264
|
+
const colorTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 0];
|
|
131265
|
+
const metallicRoughnessTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 1];
|
|
131266
|
+
const normalsTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 2];
|
|
131267
|
+
const emissiveTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 3];
|
|
131268
|
+
const occlusionTextureIndex = eachTextureSetTextures[eachTextureSetTexturesIndex + 4];
|
|
131269
|
+
sceneModel.createTextureSet({
|
|
131270
|
+
id: textureSetId,
|
|
131271
|
+
colorTextureId: colorTextureIndex >= 0 ? `${modelPartId}-texture-${colorTextureIndex}` : null,
|
|
131272
|
+
normalsTextureId: normalsTextureIndex >= 0 ? `${modelPartId}-texture-${normalsTextureIndex}` : null,
|
|
131273
|
+
metallicRoughnessTextureId: metallicRoughnessTextureIndex >= 0 ? `${modelPartId}-texture-${metallicRoughnessTextureIndex}` : null,
|
|
131274
|
+
emissiveTextureId: emissiveTextureIndex >= 0 ? `${modelPartId}-texture-${emissiveTextureIndex}` : null,
|
|
131275
|
+
occlusionTextureId: occlusionTextureIndex >= 0 ? `${modelPartId}-texture-${occlusionTextureIndex}` : null
|
|
131276
|
+
});
|
|
131277
|
+
}
|
|
131278
|
+
|
|
131279
|
+
// Count instances of each geometry
|
|
131280
|
+
|
|
131281
|
+
const geometryReuseCounts = new Uint32Array(numGeometries);
|
|
131282
|
+
|
|
131283
|
+
for (let meshIndex = 0; meshIndex < numMeshes; meshIndex++) {
|
|
131284
|
+
const geometryIndex = eachMeshGeometriesPortion[meshIndex];
|
|
131285
|
+
if (geometryReuseCounts[geometryIndex] !== undefined) {
|
|
131286
|
+
geometryReuseCounts[geometryIndex]++;
|
|
131287
|
+
} else {
|
|
131288
|
+
geometryReuseCounts[geometryIndex] = 1;
|
|
131289
|
+
}
|
|
131290
|
+
}
|
|
131291
|
+
|
|
131292
|
+
// Iterate over tiles
|
|
131293
|
+
|
|
131294
|
+
const tileCenter = math.vec3();
|
|
131295
|
+
const rtcAABB = math.AABB3();
|
|
131296
|
+
|
|
131297
|
+
const geometryArraysCache = {};
|
|
131298
|
+
|
|
131299
|
+
for (let tileIndex = 0; tileIndex < numTiles; tileIndex++) {
|
|
131300
|
+
|
|
131301
|
+
const lastTileIndex = (numTiles - 1);
|
|
131302
|
+
|
|
131303
|
+
const atLastTile = (tileIndex === lastTileIndex);
|
|
131304
|
+
|
|
131305
|
+
const firstTileEntityIndex = eachTileEntitiesPortion [tileIndex];
|
|
131306
|
+
const lastTileEntityIndex = atLastTile ? (numEntities - 1) : (eachTileEntitiesPortion[tileIndex + 1] - 1);
|
|
131307
|
+
|
|
131308
|
+
const tileAABBIndex = tileIndex * 6;
|
|
131309
|
+
const tileAABB = eachTileAABB.subarray(tileAABBIndex, tileAABBIndex + 6);
|
|
131310
|
+
|
|
131311
|
+
math.getAABB3Center(tileAABB, tileCenter);
|
|
131312
|
+
|
|
131313
|
+
rtcAABB[0] = tileAABB[0] - tileCenter[0];
|
|
131314
|
+
rtcAABB[1] = tileAABB[1] - tileCenter[1];
|
|
131315
|
+
rtcAABB[2] = tileAABB[2] - tileCenter[2];
|
|
131316
|
+
rtcAABB[3] = tileAABB[3] - tileCenter[0];
|
|
131317
|
+
rtcAABB[4] = tileAABB[4] - tileCenter[1];
|
|
131318
|
+
rtcAABB[5] = tileAABB[5] - tileCenter[2];
|
|
131319
|
+
|
|
131320
|
+
const tileDecodeMatrix = geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);
|
|
131321
|
+
|
|
131322
|
+
const geometryCreatedInTile = {};
|
|
131323
|
+
|
|
131324
|
+
// Iterate over each tile's entities
|
|
131325
|
+
|
|
131326
|
+
for (let tileEntityIndex = firstTileEntityIndex; tileEntityIndex <= lastTileEntityIndex; tileEntityIndex++) {
|
|
131327
|
+
|
|
131328
|
+
const xktEntityId = eachEntityId[tileEntityIndex];
|
|
131329
|
+
|
|
131330
|
+
const entityId = options.globalizeObjectIds ? math.globalizeObjectId(sceneModel.id, xktEntityId) : xktEntityId;
|
|
131331
|
+
|
|
131332
|
+
const finalTileEntityIndex = (numEntities - 1);
|
|
131333
|
+
const atLastTileEntity = (tileEntityIndex === finalTileEntityIndex);
|
|
131334
|
+
const firstMeshIndex = eachEntityMeshesPortion [tileEntityIndex];
|
|
131335
|
+
const lastMeshIndex = atLastTileEntity ? (eachMeshGeometriesPortion.length - 1) : (eachEntityMeshesPortion[tileEntityIndex + 1] - 1);
|
|
131336
|
+
|
|
131337
|
+
const meshIds = [];
|
|
131338
|
+
|
|
131339
|
+
const metaObject = viewer.metaScene.metaObjects[entityId];
|
|
131340
|
+
const entityDefaults = {};
|
|
131341
|
+
const meshDefaults = {};
|
|
131342
|
+
|
|
131343
|
+
if (metaObject) {
|
|
131344
|
+
|
|
131345
|
+
// Mask loading of object types
|
|
131346
|
+
|
|
131347
|
+
if (options.excludeTypesMap && metaObject.type && options.excludeTypesMap[metaObject.type]) {
|
|
131348
|
+
continue;
|
|
131349
|
+
}
|
|
131350
|
+
|
|
131351
|
+
if (options.includeTypesMap && metaObject.type && (!options.includeTypesMap[metaObject.type])) {
|
|
131352
|
+
continue;
|
|
131353
|
+
}
|
|
131354
|
+
|
|
131355
|
+
// Get initial property values for object types
|
|
131356
|
+
|
|
131357
|
+
const props = options.objectDefaults ? options.objectDefaults[metaObject.type] || options.objectDefaults["DEFAULT"] : null;
|
|
131358
|
+
|
|
131359
|
+
if (props) {
|
|
131360
|
+
if (props.visible === false) {
|
|
131361
|
+
entityDefaults.visible = false;
|
|
131362
|
+
}
|
|
131363
|
+
if (props.pickable === false) {
|
|
131364
|
+
entityDefaults.pickable = false;
|
|
131365
|
+
}
|
|
131366
|
+
if (props.colorize) {
|
|
131367
|
+
meshDefaults.color = props.colorize;
|
|
131368
|
+
}
|
|
131369
|
+
if (props.opacity !== undefined && props.opacity !== null) {
|
|
131370
|
+
meshDefaults.opacity = props.opacity;
|
|
131371
|
+
}
|
|
131372
|
+
if (props.metallic !== undefined && props.metallic !== null) {
|
|
131373
|
+
meshDefaults.metallic = props.metallic;
|
|
131374
|
+
}
|
|
131375
|
+
if (props.roughness !== undefined && props.roughness !== null) {
|
|
131376
|
+
meshDefaults.roughness = props.roughness;
|
|
131377
|
+
}
|
|
131378
|
+
}
|
|
131379
|
+
|
|
131380
|
+
} else {
|
|
131381
|
+
if (options.excludeUnclassifiedObjects) {
|
|
131382
|
+
continue;
|
|
131383
|
+
}
|
|
131384
|
+
}
|
|
131385
|
+
|
|
131386
|
+
// Iterate each entity's meshes
|
|
131387
|
+
|
|
131388
|
+
for (let meshIndex = firstMeshIndex; meshIndex <= lastMeshIndex; meshIndex++) {
|
|
131389
|
+
|
|
131390
|
+
const geometryIndex = eachMeshGeometriesPortion[meshIndex];
|
|
131391
|
+
const geometryReuseCount = geometryReuseCounts[geometryIndex];
|
|
131392
|
+
const isReusedGeometry = (geometryReuseCount > 1);
|
|
131393
|
+
|
|
131394
|
+
const atLastGeometry = (geometryIndex === (numGeometries - 1));
|
|
131395
|
+
|
|
131396
|
+
const textureSetIndex = eachMeshTextureSet[meshIndex];
|
|
131397
|
+
|
|
131398
|
+
const textureSetId = (textureSetIndex >= 0) ? `${modelPartId}-textureSet-${textureSetIndex}` : null;
|
|
131399
|
+
|
|
131400
|
+
const meshColor = decompressColor$1(eachMeshMaterialAttributes.subarray((meshIndex * 6), (meshIndex * 6) + 3));
|
|
131401
|
+
const meshOpacity = eachMeshMaterialAttributes[(meshIndex * 6) + 3] / 255.0;
|
|
131402
|
+
const meshMetallic = eachMeshMaterialAttributes[(meshIndex * 6) + 4] / 255.0;
|
|
131403
|
+
const meshRoughness = eachMeshMaterialAttributes[(meshIndex * 6) + 5] / 255.0;
|
|
131404
|
+
|
|
131405
|
+
const meshId = manifestCtx.getNextId();
|
|
131406
|
+
|
|
131407
|
+
if (isReusedGeometry) {
|
|
131408
|
+
|
|
131409
|
+
// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
|
|
131410
|
+
|
|
131411
|
+
const meshMatrixIndex = eachMeshMatricesPortion[meshIndex];
|
|
131412
|
+
const meshMatrix = matrices.slice(meshMatrixIndex, meshMatrixIndex + 16);
|
|
131413
|
+
|
|
131414
|
+
const geometryId = `${modelPartId}-geometry.${tileIndex}.${geometryIndex}`; // These IDs are local to the SceneModel
|
|
131415
|
+
|
|
131416
|
+
let geometryArrays = geometryArraysCache[geometryId];
|
|
131417
|
+
|
|
131418
|
+
if (!geometryArrays) {
|
|
131419
|
+
geometryArrays = {
|
|
131420
|
+
batchThisMesh: (!options.reuseGeometries)
|
|
131421
|
+
};
|
|
131422
|
+
const primitiveType = eachGeometryPrimitiveType[geometryIndex];
|
|
131423
|
+
let geometryValid = false;
|
|
131424
|
+
switch (primitiveType) {
|
|
131425
|
+
case 0:
|
|
131426
|
+
geometryArrays.primitiveName = "solid";
|
|
131427
|
+
geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131428
|
+
geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
|
|
131429
|
+
geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
|
|
131430
|
+
geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131431
|
+
geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
|
|
131432
|
+
geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
|
|
131433
|
+
break;
|
|
131434
|
+
case 1:
|
|
131435
|
+
geometryArrays.primitiveName = "surface";
|
|
131436
|
+
geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131437
|
+
geometryArrays.geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
|
|
131438
|
+
geometryArrays.geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
|
|
131439
|
+
geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131440
|
+
geometryArrays.geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
|
|
131441
|
+
geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
|
|
131442
|
+
break;
|
|
131443
|
+
case 2:
|
|
131444
|
+
geometryArrays.primitiveName = "points";
|
|
131445
|
+
geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131446
|
+
geometryArrays.geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);
|
|
131447
|
+
geometryValid = (geometryArrays.geometryPositions.length > 0);
|
|
131448
|
+
break;
|
|
131449
|
+
case 3:
|
|
131450
|
+
geometryArrays.primitiveName = "lines";
|
|
131451
|
+
geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131452
|
+
geometryArrays.geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131453
|
+
geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
|
|
131454
|
+
break;
|
|
131455
|
+
case 4:
|
|
131456
|
+
geometryArrays.primitiveName = "lines";
|
|
131457
|
+
geometryArrays.geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131458
|
+
geometryArrays.geometryIndices = lineStripToLines$1(
|
|
131459
|
+
geometryArrays.geometryPositions,
|
|
131460
|
+
indices.subarray(eachGeometryIndicesPortion [geometryIndex],
|
|
131461
|
+
atLastGeometry
|
|
131462
|
+
? indices.length
|
|
131463
|
+
: eachGeometryIndicesPortion [geometryIndex + 1]));
|
|
131464
|
+
geometryValid = (geometryArrays.geometryPositions.length > 0 && geometryArrays.geometryIndices.length > 0);
|
|
131465
|
+
break;
|
|
131466
|
+
default:
|
|
131467
|
+
continue;
|
|
131468
|
+
}
|
|
131469
|
+
|
|
131470
|
+
if (!geometryValid) {
|
|
131471
|
+
geometryArrays = null;
|
|
131472
|
+
}
|
|
131473
|
+
|
|
131474
|
+
if (geometryArrays) {
|
|
131475
|
+
if (geometryArrays.geometryPositions.length > 1000) ;
|
|
131476
|
+
if (geometryArrays.batchThisMesh) {
|
|
131477
|
+
geometryArrays.decompressedPositions = new Float32Array(geometryArrays.geometryPositions.length);
|
|
131478
|
+
geometryArrays.transformedAndRecompressedPositions = new Uint16Array(geometryArrays.geometryPositions.length);
|
|
131479
|
+
const geometryPositions = geometryArrays.geometryPositions;
|
|
131480
|
+
const decompressedPositions = geometryArrays.decompressedPositions;
|
|
131481
|
+
for (let i = 0, len = geometryPositions.length; i < len; i += 3) {
|
|
131482
|
+
decompressedPositions[i + 0] = geometryPositions[i + 0] * reusedGeometriesDecodeMatrix[0] + reusedGeometriesDecodeMatrix[12];
|
|
131483
|
+
decompressedPositions[i + 1] = geometryPositions[i + 1] * reusedGeometriesDecodeMatrix[5] + reusedGeometriesDecodeMatrix[13];
|
|
131484
|
+
decompressedPositions[i + 2] = geometryPositions[i + 2] * reusedGeometriesDecodeMatrix[10] + reusedGeometriesDecodeMatrix[14];
|
|
131485
|
+
}
|
|
131486
|
+
geometryArrays.geometryPositions = null;
|
|
131487
|
+
geometryArraysCache[geometryId] = geometryArrays;
|
|
131488
|
+
}
|
|
131489
|
+
}
|
|
131490
|
+
}
|
|
131491
|
+
|
|
131492
|
+
if (geometryArrays) {
|
|
131493
|
+
|
|
131494
|
+
if (geometryArrays.batchThisMesh) {
|
|
131495
|
+
|
|
131496
|
+
const decompressedPositions = geometryArrays.decompressedPositions;
|
|
131497
|
+
const transformedAndRecompressedPositions = geometryArrays.transformedAndRecompressedPositions;
|
|
131498
|
+
|
|
131499
|
+
for (let i = 0, len = decompressedPositions.length; i < len; i += 3) {
|
|
131500
|
+
tempVec4a$1[0] = decompressedPositions[i + 0];
|
|
131501
|
+
tempVec4a$1[1] = decompressedPositions[i + 1];
|
|
131502
|
+
tempVec4a$1[2] = decompressedPositions[i + 2];
|
|
131503
|
+
tempVec4a$1[3] = 1;
|
|
131504
|
+
math.transformVec4(meshMatrix, tempVec4a$1, tempVec4b$1);
|
|
131505
|
+
geometryCompressionUtils.compressPosition(tempVec4b$1, rtcAABB, tempVec4a$1);
|
|
131506
|
+
transformedAndRecompressedPositions[i + 0] = tempVec4a$1[0];
|
|
131507
|
+
transformedAndRecompressedPositions[i + 1] = tempVec4a$1[1];
|
|
131508
|
+
transformedAndRecompressedPositions[i + 2] = tempVec4a$1[2];
|
|
131509
|
+
}
|
|
131510
|
+
|
|
131511
|
+
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
131512
|
+
id: meshId,
|
|
131513
|
+
textureSetId,
|
|
131514
|
+
origin: tileCenter,
|
|
131515
|
+
primitive: geometryArrays.primitiveName,
|
|
131516
|
+
positionsCompressed: transformedAndRecompressedPositions,
|
|
131517
|
+
normalsCompressed: geometryArrays.geometryNormals,
|
|
131518
|
+
uv: geometryArrays.geometryUVs,
|
|
131519
|
+
colorsCompressed: geometryArrays.geometryColors,
|
|
131520
|
+
indices: geometryArrays.geometryIndices,
|
|
131521
|
+
edgeIndices: geometryArrays.geometryEdgeIndices,
|
|
131522
|
+
positionsDecodeMatrix: tileDecodeMatrix,
|
|
131523
|
+
color: meshColor,
|
|
131524
|
+
metallic: meshMetallic,
|
|
131525
|
+
roughness: meshRoughness,
|
|
131526
|
+
opacity: meshOpacity
|
|
131527
|
+
}));
|
|
131528
|
+
|
|
131529
|
+
meshIds.push(meshId);
|
|
131530
|
+
|
|
131531
|
+
} else {
|
|
131532
|
+
|
|
131533
|
+
if (!geometryCreatedInTile[geometryId]) {
|
|
131534
|
+
|
|
131535
|
+
sceneModel.createGeometry({
|
|
131536
|
+
id: geometryId,
|
|
131537
|
+
primitive: geometryArrays.primitiveName,
|
|
131538
|
+
positionsCompressed: geometryArrays.geometryPositions,
|
|
131539
|
+
normalsCompressed: geometryArrays.geometryNormals,
|
|
131540
|
+
uv: geometryArrays.geometryUVs,
|
|
131541
|
+
colorsCompressed: geometryArrays.geometryColors,
|
|
131542
|
+
indices: geometryArrays.geometryIndices,
|
|
131543
|
+
edgeIndices: geometryArrays.geometryEdgeIndices,
|
|
131544
|
+
positionsDecodeMatrix: reusedGeometriesDecodeMatrix
|
|
131545
|
+
});
|
|
131546
|
+
|
|
131547
|
+
geometryCreatedInTile[geometryId] = true;
|
|
131548
|
+
}
|
|
131549
|
+
|
|
131550
|
+
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
131551
|
+
id: meshId,
|
|
131552
|
+
geometryId,
|
|
131553
|
+
textureSetId,
|
|
131554
|
+
matrix: meshMatrix,
|
|
131555
|
+
color: meshColor,
|
|
131556
|
+
metallic: meshMetallic,
|
|
131557
|
+
roughness: meshRoughness,
|
|
131558
|
+
opacity: meshOpacity,
|
|
131559
|
+
origin: tileCenter
|
|
131560
|
+
}));
|
|
131561
|
+
|
|
131562
|
+
meshIds.push(meshId);
|
|
131563
|
+
}
|
|
131564
|
+
}
|
|
131565
|
+
|
|
131566
|
+
} else { // Do not reuse geometry
|
|
131567
|
+
|
|
131568
|
+
const primitiveType = eachGeometryPrimitiveType[geometryIndex];
|
|
131569
|
+
|
|
131570
|
+
let primitiveName;
|
|
131571
|
+
let geometryPositions;
|
|
131572
|
+
let geometryNormals;
|
|
131573
|
+
let geometryUVs;
|
|
131574
|
+
let geometryColors;
|
|
131575
|
+
let geometryIndices;
|
|
131576
|
+
let geometryEdgeIndices;
|
|
131577
|
+
let geometryValid = false;
|
|
131578
|
+
|
|
131579
|
+
switch (primitiveType) {
|
|
131580
|
+
case 0:
|
|
131581
|
+
primitiveName = "solid";
|
|
131582
|
+
geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131583
|
+
geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
|
|
131584
|
+
geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
|
|
131585
|
+
geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131586
|
+
geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
|
|
131587
|
+
geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
|
|
131588
|
+
break;
|
|
131589
|
+
case 1:
|
|
131590
|
+
primitiveName = "surface";
|
|
131591
|
+
geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131592
|
+
geometryNormals = normals.subarray(eachGeometryNormalsPortion [geometryIndex], atLastGeometry ? normals.length : eachGeometryNormalsPortion [geometryIndex + 1]);
|
|
131593
|
+
geometryUVs = uvs.subarray(eachGeometryUVsPortion [geometryIndex], atLastGeometry ? uvs.length : eachGeometryUVsPortion [geometryIndex + 1]);
|
|
131594
|
+
geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131595
|
+
geometryEdgeIndices = edgeIndices.subarray(eachGeometryEdgeIndicesPortion [geometryIndex], atLastGeometry ? edgeIndices.length : eachGeometryEdgeIndicesPortion [geometryIndex + 1]);
|
|
131596
|
+
geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
|
|
131597
|
+
break;
|
|
131598
|
+
case 2:
|
|
131599
|
+
primitiveName = "points";
|
|
131600
|
+
geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131601
|
+
geometryColors = colors.subarray(eachGeometryColorsPortion [geometryIndex], atLastGeometry ? colors.length : eachGeometryColorsPortion [geometryIndex + 1]);
|
|
131602
|
+
geometryValid = (geometryPositions.length > 0);
|
|
131603
|
+
break;
|
|
131604
|
+
case 3:
|
|
131605
|
+
primitiveName = "lines";
|
|
131606
|
+
geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131607
|
+
geometryIndices = indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry ? indices.length : eachGeometryIndicesPortion [geometryIndex + 1]);
|
|
131608
|
+
geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
|
|
131609
|
+
break;
|
|
131610
|
+
case 4:
|
|
131611
|
+
primitiveName = "lines";
|
|
131612
|
+
geometryPositions = positions.subarray(eachGeometryPositionsPortion [geometryIndex], atLastGeometry ? positions.length : eachGeometryPositionsPortion [geometryIndex + 1]);
|
|
131613
|
+
geometryIndices = lineStripToLines$1(
|
|
131614
|
+
geometryPositions,
|
|
131615
|
+
indices.subarray(eachGeometryIndicesPortion [geometryIndex], atLastGeometry
|
|
131616
|
+
? indices.length
|
|
131617
|
+
: eachGeometryIndicesPortion [geometryIndex + 1]));
|
|
131618
|
+
geometryValid = (geometryPositions.length > 0 && geometryIndices.length > 0);
|
|
131619
|
+
break;
|
|
131620
|
+
default:
|
|
131621
|
+
continue;
|
|
131622
|
+
}
|
|
131623
|
+
|
|
131624
|
+
if (geometryValid) {
|
|
131625
|
+
|
|
131626
|
+
sceneModel.createMesh(utils.apply(meshDefaults, {
|
|
131627
|
+
id: meshId,
|
|
131628
|
+
textureSetId,
|
|
131629
|
+
origin: tileCenter,
|
|
131630
|
+
primitive: primitiveName,
|
|
131631
|
+
positionsCompressed: geometryPositions,
|
|
131632
|
+
normalsCompressed: geometryNormals,
|
|
131633
|
+
uv: geometryUVs && geometryUVs.length > 0 ? geometryUVs : null,
|
|
131634
|
+
colorsCompressed: geometryColors,
|
|
131635
|
+
indices: geometryIndices,
|
|
131636
|
+
edgeIndices: geometryEdgeIndices,
|
|
131637
|
+
positionsDecodeMatrix: tileDecodeMatrix,
|
|
131638
|
+
color: meshColor,
|
|
131639
|
+
metallic: meshMetallic,
|
|
131640
|
+
roughness: meshRoughness,
|
|
131641
|
+
opacity: meshOpacity
|
|
131642
|
+
}));
|
|
131643
|
+
|
|
131644
|
+
meshIds.push(meshId);
|
|
131645
|
+
}
|
|
131646
|
+
}
|
|
131647
|
+
}
|
|
131648
|
+
|
|
131649
|
+
if (meshIds.length > 0) {
|
|
131650
|
+
|
|
131651
|
+
sceneModel.createEntity(utils.apply(entityDefaults, {
|
|
131652
|
+
id: entityId,
|
|
131653
|
+
isObject: true,
|
|
131654
|
+
meshIds: meshIds
|
|
131655
|
+
}));
|
|
131656
|
+
}
|
|
131657
|
+
}
|
|
131658
|
+
}
|
|
131659
|
+
}
|
|
131660
|
+
|
|
131661
|
+
function lineStripToLines$1(positions, indices) {
|
|
131662
|
+
const linesIndices = [];
|
|
131663
|
+
if (indices.length > 1) {
|
|
131664
|
+
for (let i = 0, len = indices.length - 1; i < len; i++) {
|
|
131665
|
+
linesIndices.push(indices[i]);
|
|
131666
|
+
linesIndices.push(indices[i + 1]);
|
|
131667
|
+
}
|
|
131668
|
+
} else if (positions.length > 1) {
|
|
131669
|
+
for (let i = 0, len = (positions.length / 3) - 1; i < len; i++) {
|
|
131670
|
+
linesIndices.push(i);
|
|
131671
|
+
linesIndices.push(i + 1);
|
|
131672
|
+
}
|
|
131673
|
+
}
|
|
131674
|
+
return linesIndices;
|
|
131675
|
+
}
|
|
131676
|
+
|
|
131677
|
+
/** @private */
|
|
131678
|
+
const ParserV10 = {
|
|
131679
|
+
version: 10,
|
|
131680
|
+
parse: function (viewer, options, elements, sceneModel, metaModel, manifestCtx) {
|
|
131681
|
+
const deflatedData = extract(elements);
|
|
131682
|
+
const inflatedData = inflate(deflatedData);
|
|
131683
|
+
load$1(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
131684
|
+
}
|
|
131685
|
+
};
|
|
131686
|
+
|
|
131687
|
+
/*
|
|
131688
|
+
Parser for .XKT Format V11
|
|
131689
|
+
*/
|
|
131690
|
+
|
|
131691
|
+
const tempVec4a = math.vec4();
|
|
131692
|
+
const tempVec4b = math.vec4();
|
|
131693
|
+
|
|
131694
|
+
const NUM_TEXTURE_ATTRIBUTES = 9;
|
|
131695
|
+
|
|
131696
|
+
function decodeData(arrayBuffer) {
|
|
131697
|
+
const requiresSwapFromLittleEndian = (function() {
|
|
131698
|
+
const buffer = new ArrayBuffer(2);
|
|
131699
|
+
new Uint16Array(buffer)[0] = 1;
|
|
131700
|
+
return new Uint8Array(buffer)[0] !== 1;
|
|
131701
|
+
})();
|
|
131702
|
+
|
|
131703
|
+
const nextArray = (function() {
|
|
131704
|
+
let i = 0;
|
|
131705
|
+
const dataView = new DataView(arrayBuffer);
|
|
131706
|
+
return function(type) {
|
|
131707
|
+
const idx = 1 + 2 * i++; // `1' for the version nr
|
|
131708
|
+
const byteOffset = dataView.getUint32(idx * 4, true);
|
|
131709
|
+
const byteLength = dataView.getUint32((idx + 1) * 4, true);
|
|
131710
|
+
|
|
131711
|
+
const BPE = type.BYTES_PER_ELEMENT;
|
|
131712
|
+
if (requiresSwapFromLittleEndian && (BPE > 1)) {
|
|
131713
|
+
const subarray = new Uint8Array(arrayBuffer, byteOffset, byteLength);
|
|
131714
|
+
const swaps = BPE / 2;
|
|
131715
|
+
const cnt = subarray.length / BPE;
|
|
131716
|
+
for (let b = 0; b < cnt; b++) {
|
|
131717
|
+
const offset = b * BPE;
|
|
131718
|
+
for (let j = 0; j < swaps; j++) {
|
|
131719
|
+
const i1 = offset + j;
|
|
131720
|
+
const i2 = offset - j + BPE - 1;
|
|
131721
|
+
const tmp = subarray[i1];
|
|
131722
|
+
subarray[i1] = subarray[i2];
|
|
131723
|
+
subarray[i2] = tmp;
|
|
131724
|
+
}
|
|
131725
|
+
}
|
|
131726
|
+
}
|
|
131727
|
+
|
|
131728
|
+
return new type(arrayBuffer, byteOffset, byteLength / BPE);
|
|
131729
|
+
};
|
|
131730
|
+
})();
|
|
131731
|
+
|
|
131732
|
+
const nextObject = (function() {
|
|
131733
|
+
const decoder = new TextDecoder();
|
|
131734
|
+
return () => JSON.parse(decoder.decode(nextArray(Uint8Array)));
|
|
131735
|
+
})();
|
|
131736
|
+
|
|
131737
|
+
return {
|
|
131738
|
+
metadata: nextObject(),
|
|
131739
|
+
textureData: nextArray(Uint8Array), // <<----------------------------- ??? ZIPPing to blame?
|
|
131740
|
+
eachTextureDataPortion: nextArray(Uint32Array),
|
|
131741
|
+
eachTextureAttributes: nextArray(Uint16Array),
|
|
131742
|
+
positions: nextArray(Uint16Array),
|
|
131743
|
+
normals: nextArray(Int8Array),
|
|
131744
|
+
colors: nextArray(Uint8Array),
|
|
131745
|
+
uvs: nextArray(Float32Array),
|
|
131746
|
+
indices: nextArray(Uint32Array),
|
|
131747
|
+
edgeIndices: nextArray(Uint32Array),
|
|
131748
|
+
eachTextureSetTextures: nextArray(Int32Array),
|
|
131749
|
+
matrices: nextArray(Float32Array),
|
|
131750
|
+
reusedGeometriesDecodeMatrix: nextArray(Float32Array),
|
|
131751
|
+
eachGeometryPrimitiveType: nextArray(Uint8Array),
|
|
131752
|
+
eachGeometryPositionsPortion: nextArray(Uint32Array),
|
|
131753
|
+
eachGeometryNormalsPortion: nextArray(Uint32Array),
|
|
131754
|
+
eachGeometryColorsPortion: nextArray(Uint32Array),
|
|
131755
|
+
eachGeometryUVsPortion: nextArray(Uint32Array),
|
|
131756
|
+
eachGeometryIndicesPortion: nextArray(Uint32Array),
|
|
131757
|
+
eachGeometryEdgeIndicesPortion: nextArray(Uint32Array),
|
|
131758
|
+
eachMeshGeometriesPortion: nextArray(Uint32Array),
|
|
131759
|
+
eachMeshMatricesPortion: nextArray(Uint32Array),
|
|
131760
|
+
eachMeshTextureSet: nextArray(Int32Array), // Can be -1
|
|
131761
|
+
eachMeshMaterialAttributes: nextArray(Uint8Array),
|
|
131762
|
+
eachEntityId: nextObject(),
|
|
131763
|
+
eachEntityMeshesPortion: nextArray(Uint32Array),
|
|
131764
|
+
eachTileAABB: nextArray(Float64Array),
|
|
131765
|
+
eachTileEntitiesPortion: nextArray(Uint32Array),
|
|
131766
|
+
};
|
|
131767
|
+
}
|
|
131768
|
+
|
|
131105
131769
|
const decompressColor = (function () {
|
|
131106
131770
|
const floatColor = new Float32Array(3);
|
|
131107
131771
|
return function (intColor) {
|
|
@@ -131653,11 +132317,15 @@ function lineStripToLines(positions, indices) {
|
|
|
131653
132317
|
}
|
|
131654
132318
|
|
|
131655
132319
|
/** @private */
|
|
131656
|
-
|
|
131657
|
-
|
|
131658
|
-
|
|
131659
|
-
|
|
131660
|
-
|
|
132320
|
+
// V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
|
|
132321
|
+
// To efficiently create typed arrays from this buffer,
|
|
132322
|
+
// each typed array's source data needs to be aligned with its element byte size.
|
|
132323
|
+
// This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
|
|
132324
|
+
// It is a different encoding than used in earlier versions, and requires different approach to parsing elements.
|
|
132325
|
+
const ParserV11 = {
|
|
132326
|
+
version: 11,
|
|
132327
|
+
parseArrayBuffer: function (viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx) {
|
|
132328
|
+
const inflatedData = decodeData(arrayBuffer);
|
|
131661
132329
|
load(viewer, options, inflatedData, sceneModel, metaModel, manifestCtx);
|
|
131662
132330
|
}
|
|
131663
132331
|
};
|
|
@@ -131674,6 +132342,7 @@ parsers[ParserV7.version] = ParserV7;
|
|
|
131674
132342
|
parsers[ParserV8.version] = ParserV8;
|
|
131675
132343
|
parsers[ParserV9.version] = ParserV9;
|
|
131676
132344
|
parsers[ParserV10.version] = ParserV10;
|
|
132345
|
+
parsers[ParserV11.version] = ParserV11;
|
|
131677
132346
|
|
|
131678
132347
|
/**
|
|
131679
132348
|
* {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
|
|
@@ -132791,6 +133460,12 @@ class XKTLoaderPlugin extends Plugin {
|
|
|
132791
133460
|
return;
|
|
132792
133461
|
}
|
|
132793
133462
|
// this.log("Loading .xkt V" + xktVersion);
|
|
133463
|
+
|
|
133464
|
+
if (parser.parseArrayBuffer) {
|
|
133465
|
+
parser.parseArrayBuffer(this.viewer, options, arrayBuffer, sceneModel, metaModel, manifestCtx);
|
|
133466
|
+
return;
|
|
133467
|
+
}
|
|
133468
|
+
|
|
132794
133469
|
const numElements = dataView.getUint32(4, true);
|
|
132795
133470
|
const elements = [];
|
|
132796
133471
|
let byteOffset = (numElements + 2) * 4;
|
|
@@ -139240,7 +139915,6 @@ class DotBIMLoaderPlugin extends Plugin {
|
|
|
139240
139915
|
const fileData = ctx.fileData;
|
|
139241
139916
|
const sceneModel = ctx.sceneModel;
|
|
139242
139917
|
|
|
139243
|
-
const dbMeshIndices = {};
|
|
139244
139918
|
const dbMeshLoaded = {};
|
|
139245
139919
|
|
|
139246
139920
|
const ifcProjectId = math.createUUID();
|
|
@@ -139278,17 +139952,14 @@ class DotBIMLoaderPlugin extends Plugin {
|
|
|
139278
139952
|
propertySets: []
|
|
139279
139953
|
};
|
|
139280
139954
|
|
|
139281
|
-
|
|
139282
|
-
const dbMesh = fileData.meshes[i];
|
|
139283
|
-
dbMeshIndices[dbMesh.mesh_id] = i;
|
|
139284
|
-
}
|
|
139285
|
-
|
|
139286
|
-
const parseDBMesh = (dbMeshId) => {
|
|
139955
|
+
const parseDBMesh = (dbMeshId, element) => {
|
|
139287
139956
|
if (dbMeshLoaded[dbMeshId]) {
|
|
139288
139957
|
return;
|
|
139289
139958
|
}
|
|
139290
|
-
|
|
139291
|
-
const dbMesh = fileData.meshes
|
|
139959
|
+
|
|
139960
|
+
const dbMesh = fileData.meshes.find(obj => {
|
|
139961
|
+
return obj.mesh_id === element.mesh_id;
|
|
139962
|
+
});
|
|
139292
139963
|
sceneModel.createGeometry({
|
|
139293
139964
|
id: dbMeshId,
|
|
139294
139965
|
primitive: "triangles",
|
|
@@ -139327,7 +139998,7 @@ class DotBIMLoaderPlugin extends Plugin {
|
|
|
139327
139998
|
|
|
139328
139999
|
if (element.face_colors === undefined) {
|
|
139329
140000
|
|
|
139330
|
-
parseDBMesh(dbMeshId);
|
|
140001
|
+
parseDBMesh(dbMeshId, element);
|
|
139331
140002
|
|
|
139332
140003
|
const meshId = `${objectId}-mesh`;
|
|
139333
140004
|
|
|
@@ -139370,7 +140041,9 @@ class DotBIMLoaderPlugin extends Plugin {
|
|
|
139370
140041
|
let faceColors = element.face_colors;
|
|
139371
140042
|
let coloredTrianglesDictionary = {};
|
|
139372
140043
|
let currentTriangleIndicesCount = 0;
|
|
139373
|
-
let dbMesh = fileData.meshes
|
|
140044
|
+
let dbMesh = fileData.meshes.find(obj => {
|
|
140045
|
+
return obj.mesh_id === element.mesh_id;
|
|
140046
|
+
});
|
|
139374
140047
|
for (let i = 0, len = faceColors.length; i < len; i+=4) {
|
|
139375
140048
|
let faceColor = [faceColors[i], faceColors[i+1], faceColors[i+2], faceColors[i+3]];
|
|
139376
140049
|
if (coloredTrianglesDictionary[faceColor] === undefined) {
|
|
@@ -139856,7 +140529,7 @@ const mousePointSelector = function(viewer, ray2WorldPos) {
|
|
|
139856
140529
|
const copyCanvasPos = (event, vec2) => {
|
|
139857
140530
|
vec2[0] = event.clientX;
|
|
139858
140531
|
vec2[1] = event.clientY;
|
|
139859
|
-
transformToNode(canvas.ownerDocument.
|
|
140532
|
+
transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
|
|
139860
140533
|
return vec2;
|
|
139861
140534
|
};
|
|
139862
140535
|
|
|
@@ -139931,7 +140604,7 @@ const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
|
|
|
139931
140604
|
const copyCanvasPos = (event, vec2) => {
|
|
139932
140605
|
vec2[0] = event.clientX;
|
|
139933
140606
|
vec2[1] = event.clientY;
|
|
139934
|
-
transformToNode(canvas.ownerDocument.
|
|
140607
|
+
transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
|
|
139935
140608
|
return vec2;
|
|
139936
140609
|
};
|
|
139937
140610
|
|
|
@@ -141225,7 +141898,7 @@ class ZoneTranslateControl extends Component {
|
|
|
141225
141898
|
const copyCanvasPos = (event, vec2) => {
|
|
141226
141899
|
vec2[0] = event.clientX;
|
|
141227
141900
|
vec2[1] = event.clientY;
|
|
141228
|
-
transformToNode(canvas.ownerDocument.
|
|
141901
|
+
transformToNode(canvas.ownerDocument.documentElement, canvas, vec2);
|
|
141229
141902
|
return vec2;
|
|
141230
141903
|
};
|
|
141231
141904
|
|