@xeokit/xeokit-sdk 2.4.0-alpha-62 → 2.4.0-alpha-65

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.
@@ -16176,7 +16176,8 @@ gl.uniformMatrix4fv(this._uPositionsDecodeMatrix,false,batchingLayer._state.posi
16176
16176
  }else{gl.drawArrays(gl.POINTS,0,state.positionsBuf.numItems);}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uPickInvisible=program.getLocation("pickInvisible");this._uPositionsDecodeMatrix=program.getLocation("positionsDecodeMatrix");this._uWorldMatrix=program.getLocation("worldMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i213=0,len=scene._sectionPlanesState.sectionPlanes.length;_i213<len;_i213++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i213),pos:program.getLocation("sectionPlanePos"+_i213),dir:program.getLocation("sectionPlaneDir"+_i213)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aFlags=program.getAttribute("flags");if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.sectionPlanes.length>0;scene.pointsMaterial._state;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("uniform bool pickInvisible;");src.push("uniform mat4 worldMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform mat4 positionsDecodeMatrix;");src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
16177
16177
  // renderPass = PICK
16178
16178
  src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
16179
- src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i214=0;_i214<sectionPlanesState.sectionPlanes.length;_i214++){src.push("uniform bool sectionPlaneActive"+_i214+";");src.push("uniform vec3 sectionPlanePos"+_i214+";");src.push("uniform vec3 sectionPlaneDir"+_i214+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return SnapBatchingDepthRenderer;}();/**
16179
+ src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
16180
+ src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// SnapBatchingDepthRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i214=0;_i214<sectionPlanesState.sectionPlanes.length;_i214++){src.push("uniform bool sectionPlaneActive"+_i214+";");src.push("uniform vec3 sectionPlanePos"+_i214+";");src.push("uniform vec3 sectionPlaneDir"+_i214+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return SnapBatchingDepthRenderer;}();/**
16180
16181
  * @private
16181
16182
  */var SnapBatchingRenderers=/*#__PURE__*/function(){function SnapBatchingRenderers(scene){_classCallCheck(this,SnapBatchingRenderers);this._scene=scene;}_createClass(SnapBatchingRenderers,[{key:"_compile",value:function _compile(){if(this._snapDepthBufInitRenderer&&!this._snapDepthBufInitRenderer.getValid()){this._snapDepthBufInitRenderer.destroy();this._snapDepthBufInitRenderer=null;}if(this._snapDepthRenderer&&!this._snapDepthRenderer.getValid()){this._snapDepthRenderer.destroy();this._snapDepthRenderer=null;}}},{key:"snapDepthBufInitRenderer",get:function get(){if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapBatchingDepthBufInitRenderer(this._scene,false);}return this._snapDepthBufInitRenderer;}},{key:"snapDepthRenderer",get:function get(){if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapBatchingDepthRenderer(this._scene);}return this._snapDepthRenderer;}},{key:"_destroy",value:function _destroy(){if(this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer.destroy();}if(this._snapDepthRenderer){this._snapDepthRenderer.destroy();}}}]);return SnapBatchingRenderers;}();var cachedRenderers$6={};/**
16182
16183
  * @private
@@ -16399,7 +16400,7 @@ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewp
16399
16400
  * @private
16400
16401
  */var SnapInstancingDepthBufInitRenderer=/*#__PURE__*/function(){function SnapInstancingDepthBufInitRenderer(scene){_classCallCheck(this,SnapInstancingDepthBufInitRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}_createClass(SnapInstancingDepthBufInitRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var state=instancingLayer._state;var origin=instancingLayer._state.origin;frameCtx.snapPickOrigin[0]=origin[0];frameCtx.snapPickOrigin[1]=origin[1];frameCtx.snapPickOrigin[2]=origin[2];var aabb=instancingLayer.aabb;var coordinateDivider=[math.safeInv(aabb[3]-aabb[0])*math.MAX_INT,math.safeInv(aabb[4]-aabb[1])*math.MAX_INT,math.safeInv(aabb[5]-aabb[2])*math.MAX_INT];frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateDivider[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateDivider[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateDivider[2]);if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var camera=scene.camera;var cameraEye=camera.eye;if(frameCtx.pickViewMatrix){cameraEye=frameCtx.pickOrigin||cameraEye;}var originCameraEye=[cameraEye[0]-origin[0],cameraEye[1]-origin[1],cameraEye[2]-origin[2]];gl.uniform3fv(this._uCameraEyeRtc,originCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateDivider);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var pickViewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;var rtcPickViewMatrix=origin?createRTCViewMat(pickViewMatrix,origin):pickViewMatrix;gl.uniformMatrix4fv(this._uViewMatrix,false,rtcPickViewMatrix);gl.uniformMatrix4fv(this._uWorldMatrix,false,model.worldMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix
16401
16402
  gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=instancingLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var sectionPlane=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos$1(sectionPlane.dist,sectionPlane.dir,origin,tempVec3a$o);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,sectionPlane.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,sectionPlane.dir);}}}}gl.uniformMatrix4fv(this._uPositionsDecodeMatrix,false,state.positionsDecodeMatrix);this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);gl.vertexAttribDivisor(this._aModelMatrixCol0.location,1);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,1);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,1);this._aPosition.bindArrayBuffer(state.positionsBuf);if(this._aFlags){this._aFlags.bindArrayBuffer(state.flagsBuf);gl.vertexAttribDivisor(this._aFlags.location,1);}if(this._aOffset){this._aOffset.bindArrayBuffer(state.offsetsBuf);gl.vertexAttribDivisor(this._aOffset.location,1);}state.indicesBuf.bind();gl.drawElementsInstanced(gl.TRIANGLES,state.indicesBuf.numItems,state.indicesBuf.itemType,0,state.numInstances);state.indicesBuf.unbind();// Cleanup
16402
- gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);if(this._aFlags){gl.vertexAttribDivisor(this._aFlags.location,0);}if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uPickInvisible=program.getLocation("pickInvisible");this._uPositionsDecodeMatrix=program.getLocation("positionsDecodeMatrix");this._uWorldMatrix=program.getLocation("worldMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i265=0,len=scene._sectionPlanesState.sectionPlanes.length;_i265<len;_i265++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i265),pos:program.getLocation("sectionPlanePos"+_i265),dir:program.getLocation("sectionPlaneDir"+_i265)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aFlags=program.getAttribute("flags");this._aModelMatrixCol0=program.getAttribute("modelMatrixCol0");this._aModelMatrixCol1=program.getAttribute("modelMatrixCol1");this._aModelMatrixCol2=program.getAttribute("modelMatrixCol2");if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Points instancing snap vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
16403
+ gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);if(this._aFlags){gl.vertexAttribDivisor(this._aFlags.location,0);}if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uPickInvisible=program.getLocation("pickInvisible");this._uPositionsDecodeMatrix=program.getLocation("positionsDecodeMatrix");this._uWorldMatrix=program.getLocation("worldMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i265=0,len=scene._sectionPlanesState.sectionPlanes.length;_i265<len;_i265++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i265),pos:program.getLocation("sectionPlanePos"+_i265),dir:program.getLocation("sectionPlaneDir"+_i265)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aFlags=program.getAttribute("flags");this._aModelMatrixCol0=program.getAttribute("modelMatrixCol0");this._aModelMatrixCol1=program.getAttribute("modelMatrixCol1");this._aModelMatrixCol2=program.getAttribute("modelMatrixCol2");if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthBufInitRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
16403
16404
  src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");src.push("uniform mat4 worldMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform mat4 positionsDecodeMatrix;");src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
16404
16405
  // renderPass = PICK
16405
16406
  src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
@@ -16409,11 +16410,12 @@ src.push("clipPos.xyzw *= tmp;");if(scene.logarithmicDepthBufferEnabled){src.pus
16409
16410
  */var SnapInstancingDepthRenderer=/*#__PURE__*/function(){function SnapInstancingDepthRenderer(scene){_classCallCheck(this,SnapInstancingDepthRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}_createClass(SnapInstancingDepthRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var state=instancingLayer._state;var origin=instancingLayer._state.origin;frameCtx.snapPickOrigin[0]=origin[0];frameCtx.snapPickOrigin[1]=origin[1];frameCtx.snapPickOrigin[2]=origin[2];var aabb=instancingLayer.aabb;var coordinateDivider=[math.safeInv(aabb[3]-aabb[0])*math.MAX_INT,math.safeInv(aabb[4]-aabb[1])*math.MAX_INT,math.safeInv(aabb[5]-aabb[2])*math.MAX_INT];frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateDivider[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateDivider[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateDivider[2]);if(!this._program){this._allocate(instancingLayer);if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var camera=scene.camera;var cameraEye=camera.eye;if(frameCtx.pickViewMatrix){cameraEye=frameCtx.pickOrigin||cameraEye;}var originCameraEye=[cameraEye[0]-origin[0],cameraEye[1]-origin[1],cameraEye[2]-origin[2]];gl.uniform3fv(this._uCameraEyeRtc,originCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateDivider);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var pickViewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;var rtcPickViewMatrix=origin?createRTCViewMat(pickViewMatrix,origin):pickViewMatrix;gl.uniformMatrix4fv(this._uViewMatrix,false,rtcPickViewMatrix);gl.uniformMatrix4fv(this._uWorldMatrix,false,model.worldMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix
16410
16411
  gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=instancingLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var sectionPlane=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos$1(sectionPlane.dist,sectionPlane.dir,origin,tempVec3a$n);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,sectionPlane.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,sectionPlane.dir);}}}}gl.uniformMatrix4fv(this._uPositionsDecodeMatrix,false,state.positionsDecodeMatrix);this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);gl.vertexAttribDivisor(this._aModelMatrixCol0.location,1);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,1);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,1);this._aPosition.bindArrayBuffer(state.positionsBuf);this._aFlags.bindArrayBuffer(state.flagsBuf);gl.vertexAttribDivisor(this._aFlags.location,1);if(this._aOffset){this._aOffset.bindArrayBuffer(state.offsetsBuf);gl.vertexAttribDivisor(this._aOffset.location,1);}if(frameCtx.snapMode==="edge"){state.edgeIndicesBuf.bind();gl.drawElementsInstanced(gl.LINES,state.edgeIndicesBuf.numItems,state.edgeIndicesBuf.itemType,0,state.numInstances);state.edgeIndicesBuf.unbind();// needed?
16411
16412
  }else{gl.drawArraysInstanced(gl.POINTS,0,state.positionsBuf.numItems,state.numInstances);}// Cleanup
16412
- gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);gl.vertexAttribDivisor(this._aFlags.location,0);if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uPickInvisible=program.getLocation("pickInvisible");this._uPositionsDecodeMatrix=program.getLocation("positionsDecodeMatrix");this._uWorldMatrix=program.getLocation("worldMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i268=0,len=scene._sectionPlanesState.sectionPlanes.length;_i268<len;_i268++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i268),pos:program.getLocation("sectionPlanePos"+_i268),dir:program.getLocation("sectionPlaneDir"+_i268)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aFlags=program.getAttribute("flags");this._aModelMatrixCol0=program.getAttribute("modelMatrixCol0");this._aModelMatrixCol1=program.getAttribute("modelMatrixCol1");this._aModelMatrixCol2=program.getAttribute("modelMatrixCol2");if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Points instancing snap vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
16413
+ gl.vertexAttribDivisor(this._aModelMatrixCol0.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol1.location,0);gl.vertexAttribDivisor(this._aModelMatrixCol2.location,0);gl.vertexAttribDivisor(this._aFlags.location,0);if(this._aOffset){gl.vertexAttribDivisor(this._aOffset.location,0);}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uPickInvisible=program.getLocation("pickInvisible");this._uPositionsDecodeMatrix=program.getLocation("positionsDecodeMatrix");this._uWorldMatrix=program.getLocation("worldMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i268=0,len=scene._sectionPlanesState.sectionPlanes.length;_i268<len;_i268++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i268),pos:program.getLocation("sectionPlanePos"+_i268),dir:program.getLocation("sectionPlaneDir"+_i268)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aFlags=program.getAttribute("flags");this._aModelMatrixCol0=program.getAttribute("modelMatrixCol0");this._aModelMatrixCol1=program.getAttribute("modelMatrixCol1");this._aModelMatrixCol2=program.getAttribute("modelMatrixCol2");if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this.uVectorA=program.getLocation("snapVectorA");this.uInverseVectorAB=program.getLocation("snapInvVectorAB");this._uLayerNumber=program.getLocation("layerNumber");this._uCoordinateScaler=program.getLocation("coordinateScaler");}},{key:"_bindProgram",value:function _bindProgram(){this._program.bind();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in float flags;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
16413
16414
  src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");src.push("uniform mat4 worldMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform mat4 positionsDecodeMatrix;");src.push("uniform vec3 uCameraEyeRtc;");src.push("uniform vec2 snapVectorA;");src.push("uniform vec2 snapInvVectorAB;");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("out float isPerspective;");}src.push("vec2 remapClipPos(vec2 clipPos) {");src.push(" float x = (clipPos.x - snapVectorA.x) * snapInvVectorAB.x;");src.push(" float y = (clipPos.y - snapVectorA.y) * snapInvVectorAB.y;");src.push(" return vec2(x, y);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out highp vec3 relativeToOriginPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
16414
16415
  // renderPass = PICK
16415
16416
  src.push("int pickFlag = int(flags) >> 12 & 0xF;");src.push("if (pickFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
16416
- src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Points instancing pick depth fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i269=0;_i269<sectionPlanesState.sectionPlanes.length;_i269++){src.push("uniform bool sectionPlaneActive"+_i269+";");src.push("uniform vec3 sectionPlanePos"+_i269+";");src.push("uniform vec3 sectionPlaneDir"+_i269+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i270=0;_i270<sectionPlanesState.sectionPlanes.length;_i270++){src.push("if (sectionPlaneActive"+_i270+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i270+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i270+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return SnapInstancingDepthRenderer;}();/**
16417
+ src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * vec4(position, 1.0); ");src.push(" worldPosition = worldMatrix * vec4(dot(worldPosition, modelMatrixCol0), dot(worldPosition, modelMatrixCol1), dot(worldPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags = flags;");}src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
16418
+ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// SnapInstancingDepthRenderer fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int layerNumber;");src.push("uniform vec3 coordinateScaler;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i269=0;_i269<sectionPlanesState.sectionPlanes.length;_i269++){src.push("uniform bool sectionPlaneActive"+_i269+";");src.push("uniform vec3 sectionPlanePos"+_i269+";");src.push("uniform vec3 sectionPlaneDir"+_i269+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = (int(vFlags) >> 16 & 0xF) == 1;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i270=0;_i270<sectionPlanesState.sectionPlanes.length;_i270++){src.push("if (sectionPlaneActive"+_i270+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i270+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i270+".xyz), 0.0, 1000.0);");src.push("}");}src.push("if (dist > 0.0) { discard; }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*coordinateScaler.xyz, layerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return SnapInstancingDepthRenderer;}();/**
16417
16419
  * @private
16418
16420
  */var SnapInstancingRenderers=/*#__PURE__*/function(){function SnapInstancingRenderers(scene){_classCallCheck(this,SnapInstancingRenderers);this._scene=scene;}_createClass(SnapInstancingRenderers,[{key:"_compile",value:function _compile(){if(this._snapDepthBufInitRenderer&&!this._snapDepthBufInitRenderer.getValid()){this._snapDepthBufInitRenderer.destroy();this._snapDepthBufInitRenderer=null;}if(this._snapDepthRenderer&&!this._snapDepthRenderer.getValid()){this._snapDepthRenderer.destroy();this._snapDepthRenderer=null;}}},{key:"snapDepthBufInitRenderer",get:function get(){if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapInstancingDepthBufInitRenderer(this._scene,false);}return this._snapDepthBufInitRenderer;}},{key:"snapDepthRenderer",get:function get(){if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapInstancingDepthRenderer(this._scene);}return this._snapDepthRenderer;}},{key:"_destroy",value:function _destroy(){if(this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer.destroy();}if(this._snapDepthRenderer){this._snapDepthRenderer.destroy();}}}]);return SnapInstancingRenderers;}();var cachedRenderers$4={};/**
16419
16421
  * @private
@@ -17388,7 +17390,8 @@ src.push("uvec4 flags = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(obj
17388
17390
  src.push("ivec4 packedVertexBase = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+4, objectIndexCoords.y), 0));");src.push("ivec4 packedEdgeIndexBaseOffset = ivec4(texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+6, objectIndexCoords.y), 0));");src.push("int edgeIndexBaseOffset = (packedEdgeIndexBaseOffset.r << 24) + (packedEdgeIndexBaseOffset.g << 16) + (packedEdgeIndexBaseOffset.b << 8) + packedEdgeIndexBaseOffset.a;");src.push("int h_index = (edgeIndex - edgeIndexBaseOffset) & 4095;");src.push("int v_index = (edgeIndex - edgeIndexBaseOffset) >> 12;");src.push("ivec3 vertexIndices = ivec3(texelFetch(uTexturePerPolygonIdEdgeIndices, ivec2(h_index, v_index), 0));");src.push("ivec3 uniqueVertexIndexes = vertexIndices + (packedVertexBase.r << 24) + (packedVertexBase.g << 16) + (packedVertexBase.b << 8) + packedVertexBase.a;");src.push("int indexPositionH = uniqueVertexIndexes[gl_VertexID % 2] & 4095;");src.push("int indexPositionV = uniqueVertexIndexes[gl_VertexID % 2] >> 12;");src.push("mat4 positionsDecodeMatrix = mat4 (texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+0, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+1, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+2, objectIndexCoords.y), 0), texelFetch (uTexturePerObjectIdPositionsDecodeMatrix, ivec2(objectIndexCoords.x*4+3, objectIndexCoords.y), 0));");// get flags & flags2
17389
17391
  src.push("uvec4 flags = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");src.push("uvec4 flags2 = texelFetch (uTexturePerObjectIdColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");// get position
17390
17392
  src.push("vec3 position = vec3(texelFetch(uTexturePerVertexIdCoordinates, ivec2(indexPositionH, indexPositionV), 0));");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");// get XYZ offset
17391
- src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2.r;");}src.push("vViewPosition = viewPosition;");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");src.push("vViewPosition = clipPos;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Triangles dataTexture pick depth fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int uLayerNumber;");src.push("uniform vec3 uCoordinateLayer;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i365=0,len=sectionPlanesState.sectionPlanes.length;_i365<len;_i365++){src.push("uniform bool sectionPlaneActive"+_i365+";");src.push("uniform vec3 sectionPlanePos"+_i365+";");src.push("uniform vec3 sectionPlaneDir"+_i365+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*uCoordinateLayer.xyz, uLayerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return TrianglesDataTextureSnapDepthRenderer;}();var tempVec3a$d=math.vec3();/**
17393
+ src.push("vec4 offset = vec4(texelFetch (uTexturePerObjectIdOffsets, objectIndexCoords, 0).rgb, 0.0);");src.push("worldPosition.xyz = worldPosition.xyz + offset.xyz;");src.push("relativeToOriginPosition = worldPosition.xyz;");src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2.r;");}src.push("vViewPosition = viewPosition;");src.push("vec4 clipPos = projMatrix * viewPosition;");src.push("float tmp = clipPos.w;");src.push("clipPos.xyzw /= tmp;");src.push("clipPos.xy = remapClipPos(clipPos.xy);");src.push("clipPos.xyzw *= tmp;");src.push("vViewPosition = clipPos;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}src.push("gl_Position = clipPos;");src.push("gl_PointSize = 1.0;");// Windows needs this?
17394
+ src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Triangles dataTexture pick depth fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("in float isPerspective;");src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}src.push("uniform int uLayerNumber;");src.push("uniform vec3 uCoordinateLayer;");if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i365=0,len=sectionPlanesState.sectionPlanes.length;_i365<len;_i365++){src.push("uniform bool sectionPlaneActive"+_i365+";");src.push("uniform vec3 sectionPlanePos"+_i365+";");src.push("uniform vec3 sectionPlaneDir"+_i365+";");}}src.push("in highp vec3 relativeToOriginPosition;");src.push("out highp ivec4 outCoords;");src.push("void main(void) {");if(clipping){src.push(" bool clippable = vFlags2 > 0u;");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var i=0;i<sectionPlanesState.sectionPlanes.length;i++){src.push(" if (sectionPlaneActive"+i+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+i+".xyz, vWorldPosition.xyz - sectionPlanePos"+i+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("outCoords = ivec4(relativeToOriginPosition.xyz*uCoordinateLayer.xyz, uLayerNumber);");src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return TrianglesDataTextureSnapDepthRenderer;}();var tempVec3a$d=math.vec3();/**
17392
17395
  * @private
17393
17396
  */var TrianglesDataTextureSnapDepthBufInitRenderer=/*#__PURE__*/function(){function TrianglesDataTextureSnapDepthBufInitRenderer(scene){_classCallCheck(this,TrianglesDataTextureSnapDepthBufInitRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}_createClass(TrianglesDataTextureSnapDepthBufInitRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){var model=dataTextureLayer.model;var scene=model.scene;var camera=scene.camera;/**
17394
17397
  * @type {WebGL2RenderingContext}
@@ -24753,7 +24756,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
24753
24756
  DEPRECATED
24754
24757
 
24755
24758
  */var pako$9=window.pako||p;if(!pako$9.inflate){// See https://github.com/nodeca/pako/issues/97
24756
- pako$9=pako$9["default"];}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i532=0;_i532<numEntities;_i532++){var xktEntityId=entityIDs[_i532];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i532===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i532],jlen=lastEntity?entityMeshes.length:entityMeshes[_i532+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=decompressColor$9(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i532]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$9(viewer,options,inflatedData,sceneModel);}};/*
24759
+ pako$9=pako$9["default"];}var decompressColor$9=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function extract$9(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11]};}function inflate$9(deflatedData){return{positions:new Uint16Array(pako$9.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$9.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$9.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$9.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$9.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$9.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$9.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$9.inflate(deflatedData.meshColors).buffer),entityIDs:pako$9.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$9.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$9.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$9.inflate(deflatedData.positionsDecodeMatrix).buffer)};}function load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;for(var _i532=0;_i532<numEntities;_i532++){var xktEntityId=entityIDs[_i532];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i532===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i532],jlen=lastEntity?entityMeshes.length:entityMeshes[_i532+1];j<jlen;j++){var lastMesh=j===numMeshes-1;var meshId=entityId+".mesh."+j;var _color6=decompressColor$9(meshColors.subarray(j*4,j*4+3));var _opacity=meshColors[j*4+3]/255.0;sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:positions.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),normalsCompressed:normals.subarray(meshPositions[j],lastMesh?positions.length:meshPositions[j+1]),indices:indices.subarray(meshIndices[j],lastMesh?indices.length:meshIndices[j+1]),edgeIndices:edgeIndices.subarray(meshEdgesIndices[j],lastMesh?edgeIndices.length:meshEdgesIndices[j+1]),positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color6,opacity:_opacity}));meshIds.push(meshId);}sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i532]===1,meshIds:meshIds}));}}/** @private */var ParserV1={version:1,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$9(elements);var inflatedData=inflate$9(deflatedData);load$9(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24757
24760
 
24758
24761
  Parser for .XKT Format V2
24759
24762
 
@@ -24762,21 +24765,21 @@ DEPRECATED
24762
24765
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24763
24766
 
24764
24767
  */var pako$8=window.pako||p;if(!pako$8.inflate){// See https://github.com/nodeca/pako/issues/97
24765
- pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$8=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i533=0;_i533<numEntities;_i533++){var xktEntityId=entityIDs[_i533];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i533*16,_i533*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i533===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i533],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i533+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.nextMeshId++;var _color7=decompressColor$8(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i533]===1){var geometryId="geometry."+jj;if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color7,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i533]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24768
+ pako$8=pako$8["default"];}function extract$8(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],positionsDecodeMatrix:elements[11],entityMeshIds:elements[12],entityMatrices:elements[13],entityUsesInstancing:elements[14]};}function inflate$8(deflatedData){return{positions:new Uint16Array(pako$8.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$8.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$8.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$8.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$8.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$8.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$8.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$8.inflate(deflatedData.meshColors).buffer),entityIDs:pako$8.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$8.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$8.inflate(deflatedData.entityIsObjects).buffer),positionsDecodeMatrix:new Float32Array(pako$8.inflate(deflatedData.positionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$8.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$8.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$8.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$8=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var alreadyCreatedGeometries={};for(var _i533=0;_i533<numEntities;_i533++){var xktEntityId=entityIDs[_i533];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i533*16,_i533*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i533===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i533],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i533+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=manifestCtx.getNextId();var _color7=decompressColor$8(meshColors.subarray(jj*4,jj*4+3));var _opacity2=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i533]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.positionsDecodeMatrix});alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color7,opacity:_opacity2,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.positionsDecodeMatrix,color:_color7,opacity:_opacity2}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i533]===1,meshIds:meshIds}));}}}/** @private */var ParserV2={version:2,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$8(elements);var inflatedData=inflate$8(deflatedData);load$8(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24766
24769
 
24767
24770
  Parser for .XKT Format V3
24768
24771
 
24769
24772
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24770
24773
 
24771
24774
  */var pako$7=window.pako||p;if(!pako$7.inflate){// See https://github.com/nodeca/pako/issues/97
24772
- pako$7=pako$7["default"];}function extract$7(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$7(deflatedData){return{positions:new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$7.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),entityIDs:pako$7.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$7=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i534=0;_i534<numEntities;_i534++){var xktEntityId=entityIDs[_i534];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i534*16,_i534*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i534===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i534],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i534+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId=entityId+".mesh."+jj;var _color8=decompressColor$7(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i534]===1){var geometryId="geometry."+jj;if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color8,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i534]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$7(elements);var inflatedData=inflate$7(deflatedData);load$7(viewer,options,inflatedData,sceneModel);}};/*
24775
+ pako$7=pako$7["default"];}function extract$7(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],meshPositions:elements[4],meshIndices:elements[5],meshEdgesIndices:elements[6],meshColors:elements[7],entityIDs:elements[8],entityMeshes:elements[9],entityIsObjects:elements[10],instancedPositionsDecodeMatrix:elements[11],batchedPositionsDecodeMatrix:elements[12],entityMeshIds:elements[13],entityMatrices:elements[14],entityUsesInstancing:elements[15]};}function inflate$7(deflatedData){return{positions:new Uint16Array(pako$7.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$7.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$7.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$7.inflate(deflatedData.edgeIndices).buffer),meshPositions:new Uint32Array(pako$7.inflate(deflatedData.meshPositions).buffer),meshIndices:new Uint32Array(pako$7.inflate(deflatedData.meshIndices).buffer),meshEdgesIndices:new Uint32Array(pako$7.inflate(deflatedData.meshEdgesIndices).buffer),meshColors:new Uint8Array(pako$7.inflate(deflatedData.meshColors).buffer),entityIDs:pako$7.inflate(deflatedData.entityIDs,{to:'string'}),entityMeshes:new Uint32Array(pako$7.inflate(deflatedData.entityMeshes).buffer),entityIsObjects:new Uint8Array(pako$7.inflate(deflatedData.entityIsObjects).buffer),instancedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.instancedPositionsDecodeMatrix).buffer),batchedPositionsDecodeMatrix:new Float32Array(pako$7.inflate(deflatedData.batchedPositionsDecodeMatrix).buffer),entityMeshIds:new Uint32Array(pako$7.inflate(deflatedData.entityMeshIds).buffer),entityMatrices:new Float32Array(pako$7.inflate(deflatedData.entityMatrices).buffer),entityUsesInstancing:new Uint8Array(pako$7.inflate(deflatedData.entityUsesInstancing).buffer)};}var decompressColor$7=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var meshPositions=inflatedData.meshPositions;var meshIndices=inflatedData.meshIndices;var meshEdgesIndices=inflatedData.meshEdgesIndices;var meshColors=inflatedData.meshColors;var entityIDs=JSON.parse(inflatedData.entityIDs);var entityMeshes=inflatedData.entityMeshes;var entityIsObjects=inflatedData.entityIsObjects;var entityMeshIds=inflatedData.entityMeshIds;var entityMatrices=inflatedData.entityMatrices;var entityUsesInstancing=inflatedData.entityUsesInstancing;var numMeshes=meshPositions.length;var numEntities=entityMeshes.length;var _alreadyCreatedGeometries={};for(var _i534=0;_i534<numEntities;_i534++){var xktEntityId=entityIDs[_i534];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};var entityMatrix=entityMatrices.subarray(_i534*16,_i534*16+16);if(metaObject){if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}var lastEntity=_i534===numEntities-1;var meshIds=[];for(var j=entityMeshes[_i534],jlen=lastEntity?entityMeshIds.length:entityMeshes[_i534+1];j<jlen;j++){var jj=entityMeshIds[j];var lastMesh=jj===numMeshes-1;var meshId="".concat(modelPartId,".").concat(entityId,".mesh.").concat(jj);var _color8=decompressColor$7(meshColors.subarray(jj*4,jj*4+3));var _opacity3=meshColors[jj*4+3]/255.0;var tmpPositions=positions.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpNormals=normals.subarray(meshPositions[jj],lastMesh?positions.length:meshPositions[jj+1]);var tmpIndices=indices.subarray(meshIndices[jj],lastMesh?indices.length:meshIndices[jj+1]);var tmpEdgeIndices=edgeIndices.subarray(meshEdgesIndices[jj],lastMesh?edgeIndices.length:meshEdgesIndices[jj+1]);if(entityUsesInstancing[_i534]===1){var geometryId="".concat(modelPartId,".geometry.").concat(meshId,".").concat(jj);if(!(geometryId in _alreadyCreatedGeometries)){sceneModel.createGeometry({id:geometryId,positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,primitive:"triangles",positionsDecodeMatrix:inflatedData.instancedPositionsDecodeMatrix});_alreadyCreatedGeometries[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,color:_color8,opacity:_opacity3,matrix:entityMatrix,geometryId:geometryId}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:tmpPositions,normalsCompressed:tmpNormals,indices:tmpIndices,edgeIndices:tmpEdgeIndices,positionsDecodeMatrix:inflatedData.batchedPositionsDecodeMatrix,color:_color8,opacity:_opacity3}));meshIds.push(meshId);}}if(meshIds.length){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:entityIsObjects[_i534]===1,meshIds:meshIds}));}}}/** @private */var ParserV3={version:3,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$7(elements);var inflatedData=inflate$7(deflatedData);load$7(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24773
24776
 
24774
24777
  Parser for .XKT Format V4
24775
24778
 
24776
24779
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24777
24780
 
24778
24781
  */var pako$6=window.pako||p;if(!pako$6.inflate){// See https://github.com/nodeca/pako/issues/97
24779
- pako$6=pako$6["default"];}function extract$6(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],decodeMatrices:elements[4],matrices:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveDecodeMatricesPortion:elements[9],eachPrimitiveColor:elements[10],primitiveInstances:elements[11],eachEntityId:elements[12],eachEntityPrimitiveInstancesPortion:elements[13],eachEntityMatricesPortion:elements[14],eachEntityMatrix:elements[15]};}function inflate$6(deflatedData){return{positions:new Uint16Array(pako$6.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$6.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$6.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$6.inflate(deflatedData.edgeIndices).buffer),decodeMatrices:new Float32Array(pako$6.inflate(deflatedData.decodeMatrices).buffer),matrices:new Float32Array(pako$6.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveDecodeMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveDecodeMatricesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$6.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$6.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$6.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$6=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var decodeMatrices=inflatedData.decodeMatrices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveDecodeMatricesPortion=inflatedData.eachPrimitiveDecodeMatricesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24782
+ pako$6=pako$6["default"];}function extract$6(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],decodeMatrices:elements[4],matrices:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveDecodeMatricesPortion:elements[9],eachPrimitiveColor:elements[10],primitiveInstances:elements[11],eachEntityId:elements[12],eachEntityPrimitiveInstancesPortion:elements[13],eachEntityMatricesPortion:elements[14],eachEntityMatrix:elements[15]};}function inflate$6(deflatedData){return{positions:new Uint16Array(pako$6.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$6.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$6.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$6.inflate(deflatedData.edgeIndices).buffer),decodeMatrices:new Float32Array(pako$6.inflate(deflatedData.decodeMatrices).buffer),matrices:new Float32Array(pako$6.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveDecodeMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachPrimitiveDecodeMatricesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$6.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$6.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$6.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$6.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$6=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="precompressed";sceneModel.normalsCompression="precompressed";var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var decodeMatrices=inflatedData.decodeMatrices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveDecodeMatricesPortion=inflatedData.eachPrimitiveDecodeMatricesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24780
24783
  var orderedPrimitiveIndexes=new Uint32Array(numPrimitives);// For each mesh, its index sorted into runs that share the same decode matrix
24781
24784
  var numEntities=eachEntityId.length;// Get lookup that orders primitives into runs that share the same decode matrices;
24782
24785
  // this is used to create meshes in batches that use the same decode matrix
@@ -24789,47 +24792,47 @@ var batchedPrimitiveEntityIndexes={};for(var entityIndex=0;entityIndex<numEntiti
24789
24792
  // matrix has changed since the last invocation of that method, hence why we need to order batched meshes
24790
24793
  // in runs like this.
24791
24794
  for(var _primitiveIndex3=0;_primitiveIndex3<numPrimitives;_primitiveIndex3++){var orderedPrimitiveIndex=orderedPrimitiveIndexes[_primitiveIndex3];var atLastPrimitive=orderedPrimitiveIndex===numPrimitives-1;var _primitiveInstanceCount=primitiveInstanceCounts[orderedPrimitiveIndex];var _isInstancedPrimitive=_primitiveInstanceCount>1;var _color9=decompressColor$6(eachPrimitiveColor.subarray(orderedPrimitiveIndex*4,orderedPrimitiveIndex*4+3));var _opacity4=eachPrimitiveColor[orderedPrimitiveIndex*4+3]/255.0;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[orderedPrimitiveIndex+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[orderedPrimitiveIndex],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[orderedPrimitiveIndex+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[orderedPrimitiveIndex],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[orderedPrimitiveIndex+1]);var primitiveDecodeMatrix=decodeMatrices.subarray(eachPrimitiveDecodeMatricesPortion[orderedPrimitiveIndex],eachPrimitiveDecodeMatricesPortion[orderedPrimitiveIndex]+16);if(_isInstancedPrimitive){// Primitive instanced by more than one entity, and has positions in Model-space
24792
- var geometryId="geometry"+orderedPrimitiveIndex;// These IDs are local to the SceneModel
24795
+ var geometryId="".concat(modelPartId,"-geometry.").concat(orderedPrimitiveIndex);// These IDs are local to the SceneModel
24793
24796
  sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:primitiveDecodeMatrix});}else{// Primitive is used only by one entity, and has positions pre-transformed into World-space
24794
- var meshId=orderedPrimitiveIndex;// These IDs are local to the SceneModel
24795
- var _entityIndex2=batchedPrimitiveEntityIndexes[orderedPrimitiveIndex];eachEntityId[_entityIndex2];var meshDefaults={};// TODO: get from lookup from entity IDs
24797
+ var meshId="".concat(modelPartId,"-").concat(orderedPrimitiveIndex);var _entityIndex2=batchedPrimitiveEntityIndexes[orderedPrimitiveIndex];eachEntityId[_entityIndex2];var meshDefaults={};// TODO: get from lookup from entity IDs
24796
24798
  sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:primitiveDecodeMatrix,color:_color9,opacity:_opacity4}));}}var countInstances=0;for(var _entityIndex3=0;_entityIndex3<numEntities;_entityIndex3++){var _lastEntityIndex=numEntities-1;var _atLastEntity=_entityIndex3===_lastEntityIndex;var entityId=eachEntityId[_entityIndex3];var _firstEntityPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[_entityIndex3];var _lastEntityPrimitiveInstanceIndex=_atLastEntity?eachEntityPrimitiveInstancesPortion[_lastEntityIndex]:eachEntityPrimitiveInstancesPortion[_entityIndex3+1];var meshIds=[];for(var _primitiveInstancesIndex=_firstEntityPrimitiveInstanceIndex;_primitiveInstancesIndex<_lastEntityPrimitiveInstanceIndex;_primitiveInstancesIndex++){var _primitiveIndex4=primitiveInstances[_primitiveInstancesIndex];var _primitiveInstanceCount2=primitiveInstanceCounts[_primitiveIndex4];var _isInstancedPrimitive2=_primitiveInstanceCount2>1;if(_isInstancedPrimitive2){var _meshDefaults={};// TODO: get from lookup from entity IDs
24797
- var _meshId="instance."+countInstances++;var _geometryId="geometry"+_primitiveIndex4;var matricesIndex=eachEntityMatricesPortion[_entityIndex3]*16;var _matrix4=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults,{id:_meshId,geometryId:_geometryId,matrix:_matrix4}));meshIds.push(_meshId);}else{meshIds.push(_primitiveIndex4);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24799
+ var _meshId="".concat(modelPartId,"-instance.").concat(countInstances++);var _geometryId="".concat(modelPartId,"-geometry.").concat(_primitiveIndex4);// These IDs are local to the SceneModel
24800
+ var matricesIndex=eachEntityMatricesPortion[_entityIndex3]*16;var _matrix4=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults,{id:_meshId,geometryId:_geometryId,matrix:_matrix4}));meshIds.push(_meshId);}else{meshIds.push(_primitiveIndex4);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24798
24801
  sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,///////////////// TODO: If metaobject exists
24799
- meshIds:meshIds}));}}}/** @private */var ParserV4={version:4,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$6(elements);var inflatedData=inflate$6(deflatedData);load$6(viewer,options,inflatedData,sceneModel);}};/*
24802
+ meshIds:meshIds}));}}}/** @private */var ParserV4={version:4,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$6(elements);var inflatedData=inflate$6(deflatedData);load$6(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24800
24803
 
24801
24804
  Parser for .XKT Format V5
24802
24805
 
24803
24806
  .XKT specifications: https://github.com/xeokit/xeokit-sdk/wiki/XKT-Format
24804
24807
 
24805
24808
  */var pako$5=window.pako||p;if(!pako$5.inflate){// See https://github.com/nodeca/pako/issues/97
24806
- pako$5=pako$5["default"];}function extract$5(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],eachPrimitivePositionsAndNormalsPortion:elements[5],eachPrimitiveIndicesPortion:elements[6],eachPrimitiveEdgeIndicesPortion:elements[7],eachPrimitiveColor:elements[8],primitiveInstances:elements[9],eachEntityId:elements[10],eachEntityPrimitiveInstancesPortion:elements[11],eachEntityMatricesPortion:elements[12]};}function inflate$5(deflatedData){return{positions:new Float32Array(pako$5.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$5.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$5.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$5.inflate(deflatedData.edgeIndices).buffer),matrices:new Float32Array(pako$5.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$5.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$5.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$5.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$5=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){sceneModel.positionsCompression="disabled";// Positions in XKT V4 are floats, which we never quantize, for precision with big models
24809
+ pako$5=pako$5["default"];}function extract$5(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],eachPrimitivePositionsAndNormalsPortion:elements[5],eachPrimitiveIndicesPortion:elements[6],eachPrimitiveEdgeIndicesPortion:elements[7],eachPrimitiveColor:elements[8],primitiveInstances:elements[9],eachEntityId:elements[10],eachEntityPrimitiveInstancesPortion:elements[11],eachEntityMatricesPortion:elements[12]};}function inflate$5(deflatedData){return{positions:new Float32Array(pako$5.inflate(deflatedData.positions).buffer),normals:new Int8Array(pako$5.inflate(deflatedData.normals).buffer),indices:new Uint32Array(pako$5.inflate(deflatedData.indices).buffer),edgeIndices:new Uint32Array(pako$5.inflate(deflatedData.edgeIndices).buffer),matrices:new Float32Array(pako$5.inflate(deflatedData.matrices).buffer),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion).buffer),eachPrimitiveIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveIndicesPortion).buffer),eachPrimitiveEdgeIndicesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachPrimitiveEdgeIndicesPortion).buffer),eachPrimitiveColor:new Uint8Array(pako$5.inflate(deflatedData.eachPrimitiveColor).buffer),primitiveInstances:new Uint32Array(pako$5.inflate(deflatedData.primitiveInstances).buffer),eachEntityId:pako$5.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityPrimitiveInstancesPortion).buffer),eachEntityMatricesPortion:new Uint32Array(pako$5.inflate(deflatedData.eachEntityMatricesPortion).buffer)};}var decompressColor$5=function(){var color2=new Float32Array(3);return function(color){color2[0]=color[0]/255.0;color2[1]=color[1]/255.0;color2[2]=color[2]/255.0;return color2;};}();function load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();sceneModel.positionsCompression="disabled";// Positions in XKT V4 are floats, which we never quantize, for precision with big models
24807
24810
  sceneModel.normalsCompression="precompressed";// Normals are oct-encoded though
24808
24811
  var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColor=inflatedData.eachPrimitiveColor;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var primitiveInstanceCounts=new Uint8Array(numPrimitives);// For each mesh, how many times it is instanced
24809
24812
  var numEntities=eachEntityId.length;// Count instances of each primitive
24810
24813
  for(var primitiveInstanceIndex=0;primitiveInstanceIndex<numPrimitiveInstances;primitiveInstanceIndex++){var primitiveIndex=primitiveInstances[primitiveInstanceIndex];primitiveInstanceCounts[primitiveIndex]++;}// Map batched primitives to the entities that will use them
24811
24814
  var batchedPrimitiveEntityIndexes={};for(var entityIndex=0;entityIndex<numEntities;entityIndex++){var lastEntityIndex=numEntities-1;var atLastEntity=entityIndex===lastEntityIndex;var firstEntityPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[entityIndex];var lastEntityPrimitiveInstanceIndex=atLastEntity?eachEntityPrimitiveInstancesPortion[lastEntityIndex]:eachEntityPrimitiveInstancesPortion[entityIndex+1];for(var primitiveInstancesIndex=firstEntityPrimitiveInstanceIndex;primitiveInstancesIndex<lastEntityPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex5=primitiveInstances[primitiveInstancesIndex];var primitiveInstanceCount=primitiveInstanceCounts[_primitiveIndex5];var isInstancedPrimitive=primitiveInstanceCount>1;if(!isInstancedPrimitive){batchedPrimitiveEntityIndexes[_primitiveIndex5]=entityIndex;}}}// Create geometries for instanced primitives and meshes for batched primitives.
24812
24815
  for(var _primitiveIndex6=0;_primitiveIndex6<numPrimitives;_primitiveIndex6++){var atLastPrimitive=_primitiveIndex6===numPrimitives-1;var _primitiveInstanceCount3=primitiveInstanceCounts[_primitiveIndex6];var _isInstancedPrimitive3=_primitiveInstanceCount3>1;var _color10=decompressColor$5(eachPrimitiveColor.subarray(_primitiveIndex6*4,_primitiveIndex6*4+3));var _opacity5=eachPrimitiveColor[_primitiveIndex6*4+3]/255.0;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex6+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex6],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex6+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex6],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex6+1]);if(_isInstancedPrimitive3){// Primitive instanced by more than one entity, and has positions in Model-space
24813
- var geometryId="geometry"+_primitiveIndex6;// These IDs are local to the SceneModel
24816
+ var geometryId="".concat(modelPartId,"-geometry.").concat(_primitiveIndex6);// These IDs are local to the SceneModel
24814
24817
  sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices});}else{// Primitive is used only by one entity, and has positions pre-transformed into World-space
24815
24818
  var meshId=_primitiveIndex6;// These IDs are local to the SceneModel
24816
24819
  var _entityIndex4=batchedPrimitiveEntityIndexes[_primitiveIndex6];eachEntityId[_entityIndex4];var meshDefaults={};// TODO: get from lookup from entity IDs
24817
24820
  sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,color:_color10,opacity:_opacity5}));}}var countInstances=0;for(var _entityIndex5=0;_entityIndex5<numEntities;_entityIndex5++){var _lastEntityIndex2=numEntities-1;var _atLastEntity2=_entityIndex5===_lastEntityIndex2;var entityId=eachEntityId[_entityIndex5];var _firstEntityPrimitiveInstanceIndex2=eachEntityPrimitiveInstancesPortion[_entityIndex5];var _lastEntityPrimitiveInstanceIndex2=_atLastEntity2?eachEntityPrimitiveInstancesPortion[_lastEntityIndex2]:eachEntityPrimitiveInstancesPortion[_entityIndex5+1];var meshIds=[];for(var _primitiveInstancesIndex2=_firstEntityPrimitiveInstanceIndex2;_primitiveInstancesIndex2<_lastEntityPrimitiveInstanceIndex2;_primitiveInstancesIndex2++){var _primitiveIndex7=primitiveInstances[_primitiveInstancesIndex2];var _primitiveInstanceCount4=primitiveInstanceCounts[_primitiveIndex7];var _isInstancedPrimitive4=_primitiveInstanceCount4>1;if(_isInstancedPrimitive4){var _meshDefaults2={};// TODO: get from lookup from entity IDs
24818
24821
  var _meshId2="instance."+countInstances++;var _geometryId2="geometry"+_primitiveIndex7;var matricesIndex=eachEntityMatricesPortion[_entityIndex5]*16;var _matrix5=matrices.subarray(matricesIndex,matricesIndex+16);sceneModel.createMesh(utils.apply(_meshDefaults2,{id:_meshId2,geometryId:_geometryId2,matrix:_matrix5}));meshIds.push(_meshId2);}else{meshIds.push(_primitiveIndex7);}}if(meshIds.length>0){var entityDefaults={};// TODO: get from lookup from entity IDs
24819
24822
  sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,///////////////// TODO: If metaobject exists
24820
- meshIds:meshIds}));}}}/** @private */var ParserV5={version:5,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$5(elements);var inflatedData=inflate$5(deflatedData);load$5(viewer,options,inflatedData,sceneModel);}};/*
24823
+ meshIds:meshIds}));}}}/** @private */var ParserV5={version:5,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$5(elements);var inflatedData=inflate$5(deflatedData);load$5(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24821
24824
 
24822
24825
  Parser for .XKT Format V6
24823
24826
 
24824
24827
  */var pako$4=window.pako||p;if(!pako$4.inflate){// See https://github.com/nodeca/pako/issues/97
24825
- pako$4=pako$4["default"];}function extract$4(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],reusedPrimitivesDecodeMatrix:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveColorAndOpacity:elements[9],primitiveInstances:elements[10],eachEntityId:elements[11],eachEntityPrimitiveInstancesPortion:elements[12],eachEntityMatricesPortion:elements[13],eachTileAABB:elements[14],eachTileEntitiesPortion:elements[15]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(inflate(deflatedData.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(inflate(deflatedData.primitiveInstances)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(inflate(deflatedData.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(inflate(deflatedData.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedPrimitivesDecodeMatrix=inflatedData.reusedPrimitivesDecodeMatrix;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColorAndOpacity=inflatedData.eachPrimitiveColorAndOpacity;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each primitive
24828
+ pako$4=pako$4["default"];}function extract$4(elements){return{positions:elements[0],normals:elements[1],indices:elements[2],edgeIndices:elements[3],matrices:elements[4],reusedPrimitivesDecodeMatrix:elements[5],eachPrimitivePositionsAndNormalsPortion:elements[6],eachPrimitiveIndicesPortion:elements[7],eachPrimitiveEdgeIndicesPortion:elements[8],eachPrimitiveColorAndOpacity:elements[9],primitiveInstances:elements[10],eachEntityId:elements[11],eachEntityPrimitiveInstancesPortion:elements[12],eachEntityMatricesPortion:elements[13],eachTileAABB:elements[14],eachTileEntitiesPortion:elements[15]};}function inflate$4(deflatedData){function inflate(array,options){return array.length===0?[]:pako$4.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedPrimitivesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedPrimitivesDecodeMatrix)),eachPrimitivePositionsAndNormalsPortion:new Uint32Array(inflate(deflatedData.eachPrimitivePositionsAndNormalsPortion)),eachPrimitiveIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveIndicesPortion)),eachPrimitiveEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachPrimitiveEdgeIndicesPortion)),eachPrimitiveColorAndOpacity:new Uint8Array(inflate(deflatedData.eachPrimitiveColorAndOpacity)),primitiveInstances:new Uint32Array(inflate(deflatedData.primitiveInstances)),eachEntityId:pako$4.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityPrimitiveInstancesPortion:new Uint32Array(inflate(deflatedData.eachEntityPrimitiveInstancesPortion)),eachEntityMatricesPortion:new Uint32Array(inflate(deflatedData.eachEntityMatricesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$4=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedPrimitivesDecodeMatrix=inflatedData.reusedPrimitivesDecodeMatrix;var eachPrimitivePositionsAndNormalsPortion=inflatedData.eachPrimitivePositionsAndNormalsPortion;var eachPrimitiveIndicesPortion=inflatedData.eachPrimitiveIndicesPortion;var eachPrimitiveEdgeIndicesPortion=inflatedData.eachPrimitiveEdgeIndicesPortion;var eachPrimitiveColorAndOpacity=inflatedData.eachPrimitiveColorAndOpacity;var primitiveInstances=inflatedData.primitiveInstances;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityPrimitiveInstancesPortion=inflatedData.eachEntityPrimitiveInstancesPortion;var eachEntityMatricesPortion=inflatedData.eachEntityMatricesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numPrimitives=eachPrimitivePositionsAndNormalsPortion.length;var numPrimitiveInstances=primitiveInstances.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each primitive
24826
24829
  var primitiveReuseCounts=new Uint32Array(numPrimitives);for(var primitiveInstanceIndex=0;primitiveInstanceIndex<numPrimitiveInstances;primitiveInstanceIndex++){var primitiveIndex=primitiveInstances[primitiveInstanceIndex];if(primitiveReuseCounts[primitiveIndex]!==undefined){primitiveReuseCounts[primitiveIndex]++;}else{primitiveReuseCounts[primitiveIndex]=1;}}// Iterate over tiles
24827
24830
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreated={};// Iterate over each tile's entities
24828
24831
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var entityMatrixIndex=eachEntityMatricesPortion[tileEntityIndex];var entityMatrix=matrices.slice(entityMatrixIndex,entityMatrixIndex+16);var _lastTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex;var firstPrimitiveInstanceIndex=eachEntityPrimitiveInstancesPortion[tileEntityIndex];var lastPrimitiveInstanceIndex=atLastTileEntity?primitiveInstances.length:eachEntityPrimitiveInstancesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24829
24832
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24830
24833
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's primitive instances
24831
- for(var primitiveInstancesIndex=firstPrimitiveInstanceIndex;primitiveInstancesIndex<lastPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex8=primitiveInstances[primitiveInstancesIndex];var primitiveReuseCount=primitiveReuseCounts[_primitiveIndex8];var isReusedPrimitive=primitiveReuseCount>1;var atLastPrimitive=_primitiveIndex8===numPrimitives-1;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex8],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex8+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex8],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex8+1]);var _color11=decompressColor$4(eachPrimitiveColorAndOpacity.subarray(_primitiveIndex8*4,_primitiveIndex8*4+3));var _opacity6=eachPrimitiveColorAndOpacity[_primitiveIndex8*4+3]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedPrimitive){// Create mesh for multi-use primitive - create (or reuse) geometry, create mesh using that geometry
24832
- var geometryId="geometry."+tileIndex+"."+_primitiveIndex8;// These IDs are local to the SceneModel
24834
+ for(var primitiveInstancesIndex=firstPrimitiveInstanceIndex;primitiveInstancesIndex<lastPrimitiveInstanceIndex;primitiveInstancesIndex++){var _primitiveIndex8=primitiveInstances[primitiveInstancesIndex];var primitiveReuseCount=primitiveReuseCounts[_primitiveIndex8];var isReusedPrimitive=primitiveReuseCount>1;var atLastPrimitive=_primitiveIndex8===numPrimitives-1;var primitivePositions=positions.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?positions.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveNormals=normals.subarray(eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8],atLastPrimitive?normals.length:eachPrimitivePositionsAndNormalsPortion[_primitiveIndex8+1]);var primitiveIndices=indices.subarray(eachPrimitiveIndicesPortion[_primitiveIndex8],atLastPrimitive?indices.length:eachPrimitiveIndicesPortion[_primitiveIndex8+1]);var primitiveEdgeIndices=edgeIndices.subarray(eachPrimitiveEdgeIndicesPortion[_primitiveIndex8],atLastPrimitive?edgeIndices.length:eachPrimitiveEdgeIndicesPortion[_primitiveIndex8+1]);var _color11=decompressColor$4(eachPrimitiveColorAndOpacity.subarray(_primitiveIndex8*4,_primitiveIndex8*4+3));var _opacity6=eachPrimitiveColorAndOpacity[_primitiveIndex8*4+3]/255.0;var meshId=manifestCtx.getNextId();if(isReusedPrimitive){// Create mesh for multi-use primitive - create (or reuse) geometry, create mesh using that geometry
24835
+ var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_primitiveIndex8);// These IDs are local to the SceneModel
24833
24836
  if(!geometryCreated[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:"triangles",positionsCompressed:primitivePositions,// normalsCompressed: primitiveNormals,
24834
24837
  indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:reusedPrimitivesDecodeMatrix});geometryCreated[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:entityMatrix,color:_color11,opacity:_opacity6}));meshIds.push(meshId);}else{sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:"triangles",positionsCompressed:primitivePositions,normalsCompressed:primitiveNormals,indices:primitiveIndices,edgeIndices:primitiveEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:_color11,opacity:_opacity6}));meshIds.push(meshId);}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV6={version:6,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$4(elements);var inflatedData=inflate$4(deflatedData);load$4(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24835
24838
 
@@ -24842,14 +24845,14 @@ indices:elements[3],edgeIndices:elements[4],// Transform matrices
24842
24845
  matrices:elements[5],reusedGeometriesDecodeMatrix:elements[6],// Geometries
24843
24846
  eachGeometryPrimitiveType:elements[7],eachGeometryPositionsPortion:elements[8],eachGeometryNormalsPortion:elements[9],eachGeometryColorsPortion:elements[10],eachGeometryIndicesPortion:elements[11],eachGeometryEdgeIndicesPortion:elements[12],// Meshes are grouped in runs that are shared by the same entities
24844
24847
  eachMeshGeometriesPortion:elements[13],eachMeshMatricesPortion:elements[14],eachMeshMaterial:elements[15],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24845
- eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$3.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$3=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i535=0,len=colorsRGB.length;_i535<len;_i535+=3){colorsRGBA.push(colorsRGB[_i535]);colorsRGBA.push(colorsRGB[_i535+1]);colorsRGBA.push(colorsRGB[_i535+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
24848
+ eachEntityId:elements[16],eachEntityMeshesPortion:elements[17],eachTileAABB:elements[18],eachTileEntitiesPortion:elements[19]};}function inflate$3(deflatedData){function inflate(array,options){return array.length===0?[]:pako$3.inflate(array,options).buffer;}return{positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:pako$3.inflate(deflatedData.eachEntityId,{to:'string'}),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$3=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA$1(colorsRGB){var colorsRGBA=[];for(var _i535=0,len=colorsRGB.length;_i535<len;_i535+=3){colorsRGBA.push(colorsRGB[_i535]);colorsRGBA.push(colorsRGB[_i535+1]);colorsRGBA.push(colorsRGB[_i535+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=JSON.parse(inflatedData.eachEntityId);var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityId.length;var numTiles=eachTileEntitiesPortion.length;// Count instances of each geometry
24846
24849
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24847
24850
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreated={};// Iterate over each tile's entities
24848
24851
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex2=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex2;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24849
24852
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24850
24853
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24851
- for(var _meshIndex2=firstMeshIndex;_meshIndex2<lastMeshIndex;_meshIndex2++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var meshColor=decompressColor$3(eachMeshMaterial.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterial[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24852
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex;// These IDs are local to the SceneModel
24854
+ for(var _meshIndex2=firstMeshIndex;_meshIndex2<lastMeshIndex;_meshIndex2++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var meshColor=decompressColor$3(eachMeshMaterial.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterial[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24855
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
24853
24856
  if(!geometryCreated[geometryId]){var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var geometryPositions=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;switch(primitiveType){case 0:primitiveName="solid";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 1:primitiveName="surface";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 2:primitiveName="points";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=convertColorsRGBToRGBA$1(colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]));break;case 3:primitiveName="lines";geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);break;default:continue;}sceneModel.createGeometry({id:geometryId,primitive:primitiveName,positionsCompressed:geometryPositions,normalsCompressed:geometryNormals,colors:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreated[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var _primitiveName=void 0;var _geometryPositions=void 0;var _geometryNormals=void 0;var _geometryColors=void 0;var _geometryIndices=void 0;var _geometryEdgeIndices=void 0;switch(_primitiveType){case 0:_primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 1:_primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);break;case 2:_primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryColors=convertColorsRGBToRGBA$1(colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]));break;case 3:_primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);_geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);break;default:continue;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:_primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:_geometryNormals,colors:_geometryColors,indices:_geometryIndices,edgeIndices:_geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV7={version:7,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$3(elements);var inflatedData=inflate$3(deflatedData);load$3(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24854
24857
 
24855
24858
  Parser for .XKT Format V8
@@ -24860,14 +24863,14 @@ types:elements[0],eachMetaObjectId:elements[1],eachMetaObjectType:elements[2],ea
24860
24863
  matrices:elements[10],reusedGeometriesDecodeMatrix:elements[11],// Geometries
24861
24864
  eachGeometryPrimitiveType:elements[12],eachGeometryPositionsPortion:elements[13],eachGeometryNormalsPortion:elements[14],eachGeometryColorsPortion:elements[15],eachGeometryIndicesPortion:elements[16],eachGeometryEdgeIndicesPortion:elements[17],// Meshes are grouped in runs that are shared by the same entities
24862
24865
  eachMeshGeometriesPortion:elements[18],eachMeshMatricesPortion:elements[19],eachMeshMaterial:elements[20],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24863
- eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$2(deflatedData){function inflate(array,options){return array.length===0?[]:pako$2.inflate(array,options).buffer;}return{types:pako$2.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$2.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$2.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$2=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i536=0,len=colorsRGB.length;_i536<len;_i536+=3){colorsRGBA.push(colorsRGB[_i536]);colorsRGBA.push(colorsRGB[_i536+1]);colorsRGBA.push(colorsRGB[_i536+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
24866
+ eachEntityMetaObject:elements[21],eachEntityMeshesPortion:elements[22],eachTileAABB:elements[23],eachTileEntitiesPortion:elements[24]};}function inflate$2(deflatedData){function inflate(array,options){return array.length===0?[]:pako$2.inflate(array,options).buffer;}return{types:pako$2.inflate(deflatedData.types,{to:'string'}),eachMetaObjectId:pako$2.inflate(deflatedData.eachMetaObjectId,{to:'string'}),eachMetaObjectType:new Uint32Array(inflate(deflatedData.eachMetaObjectType)),eachMetaObjectName:pako$2.inflate(deflatedData.eachMetaObjectName,{to:'string'}),eachMetaObjectParent:new Uint32Array(inflate(deflatedData.eachMetaObjectParent)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityMetaObject:new Uint32Array(inflate(deflatedData.eachEntityMetaObject)),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$2=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function convertColorsRGBToRGBA(colorsRGB){var colorsRGBA=[];for(var _i536=0,len=colorsRGB.length;_i536<len;_i536+=3){colorsRGBA.push(colorsRGB[_i536]);colorsRGBA.push(colorsRGB[_i536+1]);colorsRGBA.push(colorsRGB[_i536+2]);colorsRGBA.push(1.0);}return colorsRGBA;}function load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var types=JSON.parse(inflatedData.types);var eachMetaObjectId=JSON.parse(inflatedData.eachMetaObjectId);var eachMetaObjectType=inflatedData.eachMetaObjectType;var eachMetaObjectName=JSON.parse(inflatedData.eachMetaObjectName);var eachMetaObjectParent=inflatedData.eachMetaObjectParent;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityMetaObject=inflatedData.eachEntityMetaObject;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numMetaObjects=eachMetaObjectId.length;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMetaObject.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){var metaModelData={metaObjects:[]};for(var metaObjectIndex=0;metaObjectIndex<numMetaObjects;metaObjectIndex++){var metaObjectId=eachMetaObjectId[metaObjectIndex];var typeIndex=eachMetaObjectType[metaObjectIndex];var metaObjectType=types[typeIndex]||"default";var metaObjectName=eachMetaObjectName[metaObjectIndex];var metaObjectParentIndex=eachMetaObjectParent[metaObjectIndex];var metaObjectParentId=metaObjectParentIndex!==metaObjectIndex?eachMetaObjectId[metaObjectParentIndex]:null;metaModelData.metaObjects.push({id:metaObjectId,type:metaObjectType,name:metaObjectName,parent:metaObjectParentId});}metaModel.loadData(metaModelData,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});}// Count instances of each geometry
24864
24867
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24865
24868
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities:eachTileEntitiesPortion[tileIndex+1];var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24866
24869
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<lastTileEntityIndex;tileEntityIndex++){var xktMetaObjectIndex=eachEntityMetaObject[tileEntityIndex];var xktMetaObjectId=eachMetaObjectId[xktMetaObjectIndex];var xktEntityId=xktMetaObjectId;var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var _lastTileEntityIndex3=numEntities-1;var atLastTileEntity=tileEntityIndex===_lastTileEntityIndex3;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length:eachEntityMeshesPortion[tileEntityIndex+1];var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24867
24870
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24868
24871
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24869
- for(var _meshIndex3=firstMeshIndex;_meshIndex3<lastMeshIndex;_meshIndex3++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex3];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var meshColor=decompressColor$2(eachMeshMaterial.subarray(_meshIndex3*6,_meshIndex3*6+3));var meshOpacity=eachMeshMaterial[_meshIndex3*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex3*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex3*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24870
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex3];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex2;// These IDs are local to the SceneModel
24872
+ for(var _meshIndex3=firstMeshIndex;_meshIndex3<lastMeshIndex;_meshIndex3++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex3];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var meshColor=decompressColor$2(eachMeshMaterial.subarray(_meshIndex3*6,_meshIndex3*6+3));var meshOpacity=eachMeshMaterial[_meshIndex3*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex3*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex3*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24873
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex3];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex2);// These IDs are local to the SceneModel
24871
24874
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex2];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i537=0,len=geometryPositions.length;_i537<len;_i537+=3){decompressedPositions[_i537+0]=geometryPositions[_i537+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i537+1]=geometryPositions[_i537+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i537+2]=geometryPositions[_i537+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var _positions4=new Uint16Array(_decompressedPositions.length);for(var _i538=0,_len123=_decompressedPositions.length;_i538<_len123;_i538+=3){tempVec4a$2[0]=_decompressedPositions[_i538+0];tempVec4a$2[1]=_decompressedPositions[_i538+1];tempVec4a$2[2]=_decompressedPositions[_i538+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);_positions4[_i538+0]=tempVec4a$2[0];_positions4[_i538+1]=tempVec4a$2[1];_positions4[_i538+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:_positions4,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType2=eachGeometryPrimitiveType[_geometryIndex2];var primitiveName=void 0;var _geometryPositions2=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType2){case 0:primitiveName="solid";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryColors=convertColorsRGBToRGBA(colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]));_geometryValid=_geometryPositions2.length>0;break;case 3:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);_geometryValid=_geometryPositions2.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions2,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV8={version:8,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$2(elements);var inflatedData=inflate$2(deflatedData);load$2(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24872
24875
 
24873
24876
  Parser for .XKT Format V9
@@ -24878,36 +24881,36 @@ metadata:elements[0],positions:elements[1],normals:elements[2],colors:elements[3
24878
24881
  matrices:elements[6],reusedGeometriesDecodeMatrix:elements[7],// Geometries
24879
24882
  eachGeometryPrimitiveType:elements[8],eachGeometryPositionsPortion:elements[9],eachGeometryNormalsPortion:elements[10],eachGeometryColorsPortion:elements[11],eachGeometryIndicesPortion:elements[12],eachGeometryEdgeIndicesPortion:elements[13],// Meshes are grouped in runs that are shared by the same entities
24880
24883
  eachMeshGeometriesPortion:elements[14],eachMeshMatricesPortion:elements[15],eachMeshMaterial:elements[16],// Entity elements in the following arrays are grouped in runs that are shared by the same tiles
24881
- eachEntityId:elements[17],eachEntityMeshesPortion:elements[18],eachTileAABB:elements[19],eachTileEntitiesPortion:elements[20]};}function inflate$1(deflatedData){function inflate(array,options){return array.length===0?[]:pako$1.inflate(array,options).buffer;}return{metadata:JSON.parse(pako$1.inflate(deflatedData.metadata,{to:'string'})),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:JSON.parse(pako$1.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$1=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var metadata=inflatedData.metadata;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24884
+ eachEntityId:elements[17],eachEntityMeshesPortion:elements[18],eachTileAABB:elements[19],eachTileEntitiesPortion:elements[20]};}function inflate$1(deflatedData){function inflate(array,options){return array.length===0?[]:pako$1.inflate(array,options).buffer;}return{metadata:JSON.parse(pako$1.inflate(deflatedData.metadata,{to:'string'})),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshMaterial:new Uint8Array(inflate(deflatedData.eachMeshMaterial)),eachEntityId:JSON.parse(pako$1.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor$1=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();function load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshMaterial=inflatedData.eachMeshMaterial;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24882
24885
  }// Count instances of each geometry
24883
24886
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24884
24887
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24885
24888
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24886
24889
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24887
24890
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24888
- for(var _meshIndex4=firstMeshIndex;_meshIndex4<=lastMeshIndex;_meshIndex4++){var _geometryIndex3=eachMeshGeometriesPortion[_meshIndex4];var geometryReuseCount=geometryReuseCounts[_geometryIndex3];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex3===numGeometries-1;var meshColor=decompressColor$1(eachMeshMaterial.subarray(_meshIndex4*6,_meshIndex4*6+3));var meshOpacity=eachMeshMaterial[_meshIndex4*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex4*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex4*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24889
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex4];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex3;// These IDs are local to the SceneModel
24891
+ for(var _meshIndex4=firstMeshIndex;_meshIndex4<=lastMeshIndex;_meshIndex4++){var _geometryIndex3=eachMeshGeometriesPortion[_meshIndex4];var geometryReuseCount=geometryReuseCounts[_geometryIndex3];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex3===numGeometries-1;var meshColor=decompressColor$1(eachMeshMaterial.subarray(_meshIndex4*6,_meshIndex4*6+3));var meshOpacity=eachMeshMaterial[_meshIndex4*6+3]/255.0;var meshMetallic=eachMeshMaterial[_meshIndex4*6+4]/255.0;var meshRoughness=eachMeshMaterial[_meshIndex4*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24892
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex4];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex3);// These IDs are local to the SceneModel
24890
24893
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex3];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i539=0,len=geometryPositions.length;_i539<len;_i539+=3){decompressedPositions[_i539+0]=geometryPositions[_i539+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i539+1]=geometryPositions[_i539+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i539+2]=geometryPositions[_i539+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i540=0,_len124=_decompressedPositions2.length;_i540<_len124;_i540+=3){tempVec4a$1[0]=_decompressedPositions2[_i540+0];tempVec4a$1[1]=_decompressedPositions2[_i540+1];tempVec4a$1[2]=_decompressedPositions2[_i540+2];tempVec4a$1[3]=1;math.transformVec4(meshMatrix,tempVec4a$1,tempVec4b$1);geometryCompressionUtils.compressPosition(tempVec4b$1,rtcAABB,tempVec4a$1);transformedAndRecompressedPositions[_i540+0]=tempVec4a$1[0];transformedAndRecompressedPositions[_i540+1]=tempVec4a$1[1];transformedAndRecompressedPositions[_i540+2]=tempVec4a$1[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,origin:tileCenter,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}else{var _primitiveType3=eachGeometryPrimitiveType[_geometryIndex3];var primitiveName=void 0;var _geometryPositions3=void 0;var geometryNormals=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid2=false;switch(_primitiveType3){case 0:primitiveName="solid";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex3],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex3],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex3],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0;break;case 3:primitiveName="lines";_geometryPositions3=positions.subarray(eachGeometryPositionsPortion[_geometryIndex3],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex3+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex3],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex3+1]);_geometryValid2=_geometryPositions3.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid2){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions3,normalsCompressed:geometryNormals,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}/** @private */var ParserV9={version:9,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract$1(elements);var inflatedData=inflate$1(deflatedData);load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};/*
24891
24894
  Parser for .XKT Format V10
24892
24895
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
24893
24896
  pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:'string'})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
24894
24897
  eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),eachTextureAttributes:new Uint16Array(inflate(deflatedData.eachTextureAttributes)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),uvs:new Float32Array(inflate(deflatedData.uvs)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),eachTextureSetTextures:new Int32Array(inflate(deflatedData.eachTextureSetTextures)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryUVsPortion:new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshTextureSet:new Int32Array(inflate(deflatedData.eachMeshTextureSet)),// Can be -1
24895
- eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement('canvas');var context=canvas.getContext('2d');return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24898
+ eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:'string'})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement('canvas');var context=canvas.getContext('2d');return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata);// Can be empty
24896
24899
  }// Create textures
24897
24900
  for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;var mediaType=eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
24898
24901
  var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24899
24902
  var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24900
24903
  var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
24901
- if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="texture-".concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{var mimeType=mediaType===JPEGMediaType?"image/jpeg":mediaType===PNGMediaType?"image/png":"image/gif";var blob=new Blob([arrayBuffer],{type:mimeType});var urlCreator=window.URL||window.webkitURL;var imageUrl=urlCreator.createObjectURL(blob);var img=document.createElement('img');img.src=imageUrl;sceneModel.createTexture({id:textureId,image:img,//mediaType,
24904
+ if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="".concat(modelPartId,"-texture-").concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{var mimeType=mediaType===JPEGMediaType?"image/jpeg":mediaType===PNGMediaType?"image/png":"image/gif";var blob=new Blob([arrayBuffer],{type:mimeType});var urlCreator=window.URL||window.webkitURL;var imageUrl=urlCreator.createObjectURL(blob);var img=document.createElement('img');img.src=imageUrl;sceneModel.createTexture({id:textureId,image:img,//mediaType,
24902
24905
  minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
24903
- for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="textureSet-".concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"texture-".concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"texture-".concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"texture-".concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"texture-".concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"texture-".concat(occlusionTextureIndex):null});}// Count instances of each geometry
24906
+ for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="".concat(modelPartId,"-textureSet-").concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(occlusionTextureIndex):null});}// Count instances of each geometry
24904
24907
  var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
24905
24908
  var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
24906
24909
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xktEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xktEntityId):xktEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
24907
24910
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
24908
24911
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
24909
- for(var _meshIndex5=firstMeshIndex;_meshIndex5<=lastMeshIndex;_meshIndex5++){var _geometryIndex4=eachMeshGeometriesPortion[_meshIndex5];var geometryReuseCount=geometryReuseCounts[_geometryIndex4];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex4===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex5];var _textureSetId=_textureSetIndex>=0?"textureSet-".concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex5*6,_meshIndex5*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex5*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex5*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex5*6+5]/255.0;var meshId=manifestCtx.nextMeshId++;if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24910
- var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex5];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="geometry."+tileIndex+"."+_geometryIndex4;// These IDs are local to the SceneModel
24912
+ for(var _meshIndex5=firstMeshIndex;_meshIndex5<=lastMeshIndex;_meshIndex5++){var _geometryIndex4=eachMeshGeometriesPortion[_meshIndex5];var geometryReuseCount=geometryReuseCounts[_geometryIndex4];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex4===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex5];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex5*6,_meshIndex5*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex5*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex5*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex5*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
24913
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex5];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex4);// These IDs are local to the SceneModel
24911
24914
  var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex4];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i541=0,len=geometryPositions.length;_i541<len;_i541+=3){decompressedPositions[_i541+0]=geometryPositions[_i541+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i541+1]=geometryPositions[_i541+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i541+2]=geometryPositions[_i541+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions3=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i542=0,_len125=_decompressedPositions3.length;_i542<_len125;_i542+=3){tempVec4a[0]=_decompressedPositions3[_i542+0];tempVec4a[1]=_decompressedPositions3[_i542+1];tempVec4a[2]=_decompressedPositions3[_i542+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i542+0]=tempVec4a[0];transformedAndRecompressedPositions[_i542+1]=tempVec4a[1];transformedAndRecompressedPositions[_i542+2]=tempVec4a[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
24912
24915
  var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName=void 0;var _geometryPositions4=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid3=false;switch(_primitiveType4){case 0:primitiveName="solid";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex4],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex4+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex4],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex4],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex4],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0;break;case 3:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]);_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions4=positions.subarray(eachGeometryPositionsPortion[_geometryIndex4],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex4+1]);geometryIndices=lineStripToLines(_geometryPositions4,indices.subarray(eachGeometryIndicesPortion[_geometryIndex4],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex4+1]));_geometryValid3=_geometryPositions4.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid3){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions4,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i543=0,len=indices.length-1;_i543<len;_i543++){linesIndices.push(indices[_i543]);linesIndices.push(indices[_i543+1]);}}else if(positions.length>1){for(var _i544=0,_len126=positions.length/3-1;_i544<_len126;_i544++){linesIndices.push(_i544);linesIndices.push(_i544+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};var parsers={};parsers[ParserV1.version]=ParserV1;parsers[ParserV2.version]=ParserV2;parsers[ParserV3.version]=ParserV3;parsers[ParserV4.version]=ParserV4;parsers[ParserV5.version]=ParserV5;parsers[ParserV6.version]=ParserV6;parsers[ParserV7.version]=ParserV7;parsers[ParserV8.version]=ParserV8;parsers[ParserV9.version]=ParserV9;parsers[ParserV10.version]=ParserV10;/**
24913
24916
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XKT````* format.
@@ -25597,7 +25600,7 @@ var _primitiveType4=eachGeometryPrimitiveType[_geometryIndex4];var primitiveName
25597
25600
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
25598
25601
  sceneModel.finalize();metaModel.finalize();_this151.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this151.viewer.metaScene.destroyMetaModel(metaModel.id);});sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
25599
25602
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
25600
- });};var error=function error(errMsg){_this151.viewer.scene.canvas.spinner.processes--;_this151.error(errMsg);sceneModel.fire("error",errMsg);};var manifestCtx={nextMeshId:0};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this151._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this151._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this151._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this151._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this151._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this152=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this152._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i547=0;_i547<numElements;_i547++){var elementSize=dataView.getUint32((_i547+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
25603
+ });};var error=function error(errMsg){_this151.viewer.scene.canvas.spinner.processes--;_this151.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this151._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this151._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xkt,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xkt){this._parseModel(params.xkt,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc){var baseDir=getBaseDirectory(params.manifestSrc);var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=metaDataFiles.length){done();}else{_this151._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;loadNext();},error);}};loadNext();};var loadXKTs=function loadXKTs(xktFiles,done,error){var i=0;var loadNext=function loadNext(){if(i>=xktFiles.length){done();}else{_this151._dataSource.getXKT("".concat(baseDir).concat(xktFiles[i]),function(arrayBuffer){_this151._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);i++;loadNext();},error);}};loadNext();};this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xktFiles=manifestData.xktFiles;if(!xktFiles||xktFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXKTs(xktFiles,finish,error);},error);}else{loadXKTs(xktFiles,finish,error);}},error);}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this152=this;this._dataSource.getXKT(params.src,function(arrayBuffer){_this152._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);done();},error);}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){if(sceneModel.destroyed){return;}var dataView=new DataView(arrayBuffer);var dataArray=new Uint8Array(arrayBuffer);var xktVersion=dataView.getUint32(0,true);var parser=parsers[xktVersion];if(!parser){this.error("Unsupported .XKT file version: "+xktVersion+" - this XKTLoaderPlugin supports versions "+Object.keys(parsers));return;}this.log("Loading .xkt V"+xktVersion);var numElements=dataView.getUint32(4,true);var elements=[];var byteOffset=(numElements+2)*4;for(var _i547=0;_i547<numElements;_i547++){var elementSize=dataView.getUint32((_i547+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
25601
25604
  //
25602
25605
  // const metaModelId = sceneModel.id;
25603
25606
  //