@xtctwins/tctwins-core 1.1.7 → 1.1.9

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.
@@ -3045,7 +3045,7 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointer
3045
3045
  * The {@link AnnotationsPlugin} this Annotation was created by.
3046
3046
  * @type {AnnotationsPlugin}
3047
3047
  */_this20.plugin=cfg.plugin;_this20._container=cfg.container;if(!_this20._container){throw"config missing: container";}if(!cfg.markerElement&&!cfg.markerHTML){throw"config missing: need either markerElement or markerHTML";}if(!cfg.labelElement&&!cfg.labelHTML){throw"config missing: need either labelElement or labelHTML";}_this20._htmlDirty=false;if(cfg.markerElement){_this20._marker=cfg.markerElement;_this20._marker.addEventListener("click",_this20._onMouseClickedExternalMarker=function(){_this20.plugin.fire("markerClicked",_this20);});_this20._marker.addEventListener("dblclick",_this20._onMouseDblClickedExternalMarker=function(){_this20.plugin.fire("markerDoubleClicked",_this20);});_this20._marker.addEventListener("mouseenter",_this20._onMouseEnterExternalMarker=function(){_this20.plugin.fire("markerMouseEnter",_this20);});_this20._marker.addEventListener("mouseleave",_this20._onMouseLeaveExternalMarker=function(){_this20.plugin.fire("markerMouseLeave",_this20);});_this20._markerExternal=true;// Don't destroy marker when destroying Annotation
3048
- }else{_this20._markerHTML=cfg.markerHTML;_this20._htmlDirty=true;_this20._markerExternal=false;}if(cfg.labelElement){_this20._label=cfg.labelElement;_this20._labelExternal=true;// Don't destroy marker when destroying Annotation
3048
+ }else{_this20._markerHTML=cfg.markerHTML;_this20._htmlDirty=true;_this20._markerExternal=false;}if(cfg.labelElement){_this20._label=cfg.labelElement;_this20._label.addEventListener("click",function(){_this20.plugin.fire("labelClicked",_this20);});_this20._labelExternal=true;// Don't destroy marker when destroying Annotation
3049
3049
  }else{_this20._labelHTML=cfg.labelHTML;_this20._htmlDirty=true;_this20._labelExternal=false;}_this20._markerShown=!!cfg.markerShown;_this20._labelShown=!!cfg.labelShown;_this20._values=cfg.values||{};_this20._layoutDirty=true;_this20._visibilityDirty=true;_this20._buildHTML();_this20._onTick=_this20.scene.on("tick",function(){if(_this20._htmlDirty){_this20._buildHTML();_this20._htmlDirty=false;_this20._layoutDirty=true;_this20._visibilityDirty=true;}if(_this20._layoutDirty||_this20._visibilityDirty){if(_this20._markerShown||_this20._labelShown){_this20._updatePosition();_this20._layoutDirty=false;}}if(_this20._visibilityDirty){_this20._marker.style.visibility=_this20.visible&&_this20._markerShown?"visible":"hidden";_this20._label.style.visibility=_this20.visible&&_this20._markerShown&&_this20._labelShown?"visible":"hidden";_this20._visibilityDirty=false;}});_this20.on("canvasPos",function(){_this20._layoutDirty=true;});_this20.on("visible",function(){_this20._visibilityDirty=true;});_this20.setMarkerShown(cfg.markerShown!==false);_this20.setLabelShown(cfg.labelShown);/**
3050
3050
  * Optional World-space position for {@link Camera#eye}, used when this Annotation is associated with a {@link Camera} position.
3051
3051
  *
@@ -3074,7 +3074,7 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END$1:if(_this17.pointerLens){_this17.pointer
3074
3074
  * @private
3075
3075
  */_inherits(Annotation,_Marker);return _createClass(Annotation,[{key:"_buildHTML",value:function _buildHTML(){var _this21=this;if(!this._markerExternal){if(this._marker){this._container.removeChild(this._marker);this._marker=null;}var markerHTML=this._markerHTML||"<p></p>";// Make marker
3076
3076
  if(utils.isArray(markerHTML)){markerHTML=markerHTML.join("");}markerHTML=this._renderTemplate(markerHTML.trim());var markerFragment=document.createRange().createContextualFragment(markerHTML);this._marker=markerFragment.firstChild;this._container.appendChild(this._marker);this._marker.style.visibility=this._markerShown?"visible":"hidden";this._marker.addEventListener("click",function(){_this21.plugin.fire("markerClicked",_this21);});this._marker.addEventListener("dblclick",function(){_this21.plugin.fire("markerDoubleClicked",_this21);});this._marker.addEventListener("mouseenter",function(){_this21.plugin.fire("markerMouseEnter",_this21);});this._marker.addEventListener("mouseleave",function(){_this21.plugin.fire("markerMouseLeave",_this21);});this._marker.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}if(!this._labelExternal){if(this._label){this._container.removeChild(this._label);this._label=null;}var labelHTML=this._labelHTML||"<p></p>";// Make label
3077
- if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML.trim());var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}}/**
3077
+ if(utils.isArray(labelHTML)){labelHTML=labelHTML.join("");}labelHTML=this._renderTemplate(labelHTML.trim());var labelFragment=document.createRange().createContextualFragment(labelHTML);this._label=labelFragment.firstChild;this._container.appendChild(this._label);this._label.style.visibility=this._markerShown&&this._labelShown?"visible":"hidden";this._label.addEventListener("click",function(){_this21.plugin.fire("labelClicked",_this21);});this._label.addEventListener("wheel",function(event){_this21.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));});}}/**
3078
3078
  * @private
3079
3079
  */},{key:"_updatePosition",value:function _updatePosition(){var boundary=this.scene.canvas.boundary;var left=boundary[0];var top=boundary[1];var canvasPos=this.canvasPos;this._marker.style.left=Math.floor(left+canvasPos[0])-12+"px";this._marker.style.top=Math.floor(top+canvasPos[1])-12+"px";this._marker.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;var offsetX=20;var offsetY=-17;this._label.style.left=20+Math.floor(left+canvasPos[0]+offsetX)+"px";this._label.style.top=Math.floor(top+canvasPos[1]+offsetY)+"px";this._label.style["z-index"]=90005+Math.floor(this._viewPos[2])+1;}/**
3080
3080
  * @private
@@ -14657,9 +14657,9 @@ PICK:11};var defaultColor$2=new Float32Array([1,1,1,1]);var edgesDefaultColor=ne
14657
14657
  * Should be overrided by subclasses if it does not only "depend" on section planes state.
14658
14658
  * @returns { string }
14659
14659
  */return _createClass(VBORenderer,[{key:"_getHash",value:function _getHash(){return this._scene._sectionPlanesState.getHash();}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){return[""];}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){return[""];}},{key:"_addMatricesUniformBlockLines",value:function _addMatricesUniformBlockLines(src){var normals=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;src.push("uniform Matrices {");src.push(" mat4 worldMatrix;");src.push(" mat4 viewMatrix;");src.push(" mat4 projMatrix;");src.push(" mat4 positionsDecodeMatrix;");if(normals){src.push(" mat4 worldNormalMatrix;");src.push(" mat4 viewNormalMatrix;");}src.push("};");return src;}},{key:"_addRemapClipPosLines",value:function _addRemapClipPosLines(src){var viewportSize=arguments.length>1&&arguments[1]!==undefined?arguments[1]:1;src.push("uniform vec2 drawingBufferSize;");src.push("uniform vec2 pickClipPos;");src.push("vec4 remapClipPos(vec4 clipPos) {");src.push(" clipPos.xy /= clipPos.w;");if(viewportSize===1){src.push(" clipPos.xy = (clipPos.xy - pickClipPos) * drawingBufferSize;");}else{src.push(" clipPos.xy = (clipPos.xy - pickClipPos) * (drawingBufferSize / float(".concat(viewportSize,"));"));}src.push(" clipPos.xy *= clipPos.w;");src.push(" return clipPos;");src.push("}");return src;}},{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"setSectionPlanesStateUniforms",value:function setSectionPlanesStateUniforms(layer){var scene=this._scene;var gl=scene.canvas.gl;var model=layer.model,layerIndex=layer.layerIndex;var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var _sectionPlane12=sectionPlanes[sectionPlaneIndex];var origin=layer._state.origin;if(origin){var rtcSectionPlanePos=getPlaneRTCPos(_sectionPlane12.dist,_sectionPlane12.dir,origin,tempVec3a$z,model.matrix);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,_sectionPlane12.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,_sectionPlane12.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;var lightsState=scene._lightsState;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._uColor=program.getLocation("color");if(!this._uColor){// some shader may have color as attribute, in this case the uniform must be renamed silhouetteColor
14660
- this._uColor=program.getLocation("silhouetteColor");}this._uUVDecodeMatrix=program.getLocation("uvDecodeMatrix");this._uPickInvisible=program.getLocation("pickInvisible");this._uGammaFactor=program.getLocation("gammaFactor");gl.uniformBlockBinding(program.handle,gl.getUniformBlockIndex(program.handle,"Matrices"),this._matricesUniformBlockBufferBindingPoint);this._uShadowViewMatrix=program.getLocation("shadowViewMatrix");this._uShadowProjMatrix=program.getLocation("shadowProjMatrix");if(scene.logarithmicDepthBufferEnabled){this._uZFar=program.getLocation("zFar");}this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];// TODO add a gard to prevent light params if not affected by light ?
14660
+ this._uColor=program.getLocation("silhouetteColor");}this._uUVDecodeMatrix=program.getLocation("uvDecodeMatrix");this._uPickInvisible=program.getLocation("pickInvisible");this._uGammaFactor=program.getLocation("gammaFactor");this._uBrightness=program.getLocation("brightness");gl.uniformBlockBinding(program.handle,gl.getUniformBlockIndex(program.handle,"Matrices"),this._matricesUniformBlockBufferBindingPoint);this._uShadowViewMatrix=program.getLocation("shadowViewMatrix");this._uShadowProjMatrix=program.getLocation("shadowProjMatrix");if(scene.logarithmicDepthBufferEnabled){this._uZFar=program.getLocation("zFar");}this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];// TODO add a gard to prevent light params if not affected by light ?
14661
14661
  var lights=lightsState.lights;var light;for(var _i160=0,len=lights.length;_i160<len;_i160++){light=lights[_i160];switch(light.type){case"dir":this._uLightColor[_i160]=program.getLocation("lightColor"+_i160);this._uLightPos[_i160]=null;this._uLightDir[_i160]=program.getLocation("lightDir"+_i160);break;case"point":this._uLightColor[_i160]=program.getLocation("lightColor"+_i160);this._uLightPos[_i160]=program.getLocation("lightPos"+_i160);this._uLightDir[_i160]=null;this._uLightAttenuation[_i160]=program.getLocation("lightAttenuation"+_i160);break;case"spot":this._uLightColor[_i160]=program.getLocation("lightColor"+_i160);this._uLightPos[_i160]=program.getLocation("lightPos"+_i160);this._uLightDir[_i160]=program.getLocation("lightDir"+_i160);this._uLightAttenuation[_i160]=program.getLocation("lightAttenuation"+_i160);break;}}if(lightsState.reflectionMaps.length>0){this._uReflectionMap="reflectionMap";}if(lightsState.lightMaps.length>0){this._uLightMap="lightMap";}this._uSectionPlanes=[];for(var _i161=0,_len22=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i161<_len22;_i161++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i161),pos:program.getLocation("sectionPlanePos"+_i161),dir:program.getLocation("sectionPlaneDir"+_i161)});}this._aPosition=program.getAttribute("position");this._aOffset=program.getAttribute("offset");this._aNormal=program.getAttribute("normal");this._aUV=program.getAttribute("uv");this._aColor=program.getAttribute("color");this._aMetallicRoughness=program.getAttribute("metallicRoughness");this._aFlags=program.getAttribute("flags");this._aPickColor=program.getAttribute("pickColor");this._uPickZNear=program.getLocation("pickZNear");this._uPickZFar=program.getLocation("pickZFar");this._uPickClipPos=program.getLocation("pickClipPos");this._uDrawingBufferSize=program.getLocation("drawingBufferSize");this._uColorMap="uColorMap";this._uMetallicRoughMap="uMetallicRoughMap";this._uEmissiveMap="uEmissiveMap";this._uNormalMap="uNormalMap";this._uAOMap="uAOMap";this._aModelMatrixCol0=program.getAttribute("modelMatrixCol0");this._aModelMatrixCol1=program.getAttribute("modelMatrixCol1");this._aModelMatrixCol2=program.getAttribute("modelMatrixCol2");this._aModelNormalMatrixCol0=program.getAttribute("modelNormalMatrixCol0");this._aModelNormalMatrixCol1=program.getAttribute("modelNormalMatrixCol1");this._aModelNormalMatrixCol2=program.getAttribute("modelNormalMatrixCol2");if(this._instancing){this._aModelMatrix=program.getAttribute("modelMatrix");}if(this._withSAO){this._uOcclusionTexture="uOcclusionTexture";this._uSAOParams=program.getLocation("uSAOParams");}if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}if(scene.pointsMaterial._state.filterIntensity){this._uIntensityRange=program.getLocation("intensityRange");}this._uPointSize=program.getLocation("pointSize");this._uNearPlaneHeight=program.getLocation("nearPlaneHeight");}},{key:"_bindProgram",value:function _bindProgram(frameCtx){var scene=this._scene;var gl=scene.canvas.gl;var program=this._program;var lightsState=scene._lightsState;var lights=lightsState.lights;program.bind();frameCtx.textureUnit=0;if(this._uLightAmbient){gl.uniform4fv(this._uLightAmbient,lightsState.getAmbientColorAndIntensity());}if(this._uGammaFactor){gl.uniform1f(this._uGammaFactor,scene.gammaFactor);}for(var _i162=0,len=lights.length;_i162<len;_i162++){var light=lights[_i162];if(this._uLightColor[_i162]){gl.uniform4f(this._uLightColor[_i162],light.color[0],light.color[1],light.color[2],light.intensity);}if(this._uLightPos[_i162]){gl.uniform3fv(this._uLightPos[_i162],light.pos);if(this._uLightAttenuation[_i162]){gl.uniform1f(this._uLightAttenuation[_i162],light.attenuation);}}if(this._uLightDir[_i162]){gl.uniform3fv(this._uLightDir[_i162],light.dir);}}}},{key:"_makeVAO",value:function _makeVAO(state){var gl=this._scene.canvas.gl;var vao=gl.createVertexArray();gl.bindVertexArray(vao);if(this._instancing){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);if(this._aModelNormalMatrixCol0){this._aModelNormalMatrixCol0.bindArrayBuffer(state.modelNormalMatrixCol0Buf);gl.vertexAttribDivisor(this._aModelNormalMatrixCol0.location,1);}if(this._aModelNormalMatrixCol1){this._aModelNormalMatrixCol1.bindArrayBuffer(state.modelNormalMatrixCol1Buf);gl.vertexAttribDivisor(this._aModelNormalMatrixCol1.location,1);}if(this._aModelNormalMatrixCol2){this._aModelNormalMatrixCol2.bindArrayBuffer(state.modelNormalMatrixCol2Buf);gl.vertexAttribDivisor(this._aModelNormalMatrixCol2.location,1);}}else if(state.modelMatrixCol0Buf){// Batching path: per-vertex matrix attributes (divisor=0, one per vertex)
14662
- this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);if(this._aModelNormalMatrixCol0&&state.modelNormalMatrixCol0Buf){this._aModelNormalMatrixCol0.bindArrayBuffer(state.modelNormalMatrixCol0Buf);this._aModelNormalMatrixCol1.bindArrayBuffer(state.modelNormalMatrixCol1Buf);this._aModelNormalMatrixCol2.bindArrayBuffer(state.modelNormalMatrixCol2Buf);}}this._aPosition.bindArrayBuffer(state.positionsBuf);if(this._aUV){this._aUV.bindArrayBuffer(state.uvBuf);}if(this._aNormal){this._aNormal.bindArrayBuffer(state.normalsBuf);}if(this._aMetallicRoughness){this._aMetallicRoughness.bindArrayBuffer(state.metallicRoughnessBuf);if(this._instancing){gl.vertexAttribDivisor(this._aMetallicRoughness.location,1);}}if(this._aColor){this._aColor.bindArrayBuffer(state.colorsBuf);if(this._instancing&&state.colorsBuf){gl.vertexAttribDivisor(this._aColor.location,1);}}if(this._aFlags){this._aFlags.bindArrayBuffer(state.flagsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aFlags.location,1);}}if(this._aOffset){this._aOffset.bindArrayBuffer(state.offsetsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aOffset.location,1);}}if(this._aPickColor){this._aPickColor.bindArrayBuffer(state.pickColorsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aPickColor.location,1);}}if(this._instancing){if(this._edges){state.edgeIndicesBuf.bind();}else{if(state.indicesBuf){state.indicesBuf.bind();}}}else{if(this._edges){state.edgeIndicesBuf.bind();}else{if(state.indicesBuf){state.indicesBuf.bind();}}}return vao;}},{key:"drawLayer",value:function drawLayer(frameCtx,layer,renderPass){var _ref7=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{},_ref7$colorUniform=_ref7.colorUniform,colorUniform=_ref7$colorUniform===void 0?false:_ref7$colorUniform,_ref7$incrementDrawSt=_ref7.incrementDrawState,incrementDrawState=_ref7$incrementDrawSt===void 0?false:_ref7$incrementDrawSt;var maxTextureUnits=WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;var scene=this._scene;var gl=scene.canvas.gl;var state=layer._state,model=layer.model;var textureSet=state.textureSet,origin=state.origin,positionsDecodeMatrix=state.positionsDecodeMatrix;var lightsState=scene._lightsState;var pointsMaterial=scene.pointsMaterial;var camera=model.scene.camera;var viewNormalMatrix=camera.viewNormalMatrix,project=camera.project;var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate,worldNormalMatrix=model.worldNormalMatrix;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx);}if(this._vaoCache.has(layer)){gl.bindVertexArray(this._vaoCache.get(layer));}else{this._vaoCache.set(layer,this._makeVAO(state));}var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrixConjugate,0);var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$z;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$s);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];this._matricesUniformBlockBufferData.set(createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$r),offset+=mat4Size);}else{this._matricesUniformBlockBufferData.set(viewMatrix,offset+=mat4Size);}this._matricesUniformBlockBufferData.set(frameCtx.pickProjMatrix||project.matrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(positionsDecodeMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(worldNormalMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(viewNormalMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);gl.uniform1i(this._uRenderPass,renderPass);this.setSectionPlanesStateUniforms(layer);if(scene.logarithmicDepthBufferEnabled){if(this._uLogDepthBufFC){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix?
14662
+ this._aModelMatrixCol0.bindArrayBuffer(state.modelMatrixCol0Buf);this._aModelMatrixCol1.bindArrayBuffer(state.modelMatrixCol1Buf);this._aModelMatrixCol2.bindArrayBuffer(state.modelMatrixCol2Buf);if(this._aModelNormalMatrixCol0&&state.modelNormalMatrixCol0Buf){this._aModelNormalMatrixCol0.bindArrayBuffer(state.modelNormalMatrixCol0Buf);this._aModelNormalMatrixCol1.bindArrayBuffer(state.modelNormalMatrixCol1Buf);this._aModelNormalMatrixCol2.bindArrayBuffer(state.modelNormalMatrixCol2Buf);}}this._aPosition.bindArrayBuffer(state.positionsBuf);if(this._aUV){this._aUV.bindArrayBuffer(state.uvBuf);}if(this._aNormal){this._aNormal.bindArrayBuffer(state.normalsBuf);}if(this._aMetallicRoughness){this._aMetallicRoughness.bindArrayBuffer(state.metallicRoughnessBuf);if(this._instancing){gl.vertexAttribDivisor(this._aMetallicRoughness.location,1);}}if(this._aColor){this._aColor.bindArrayBuffer(state.colorsBuf);if(this._instancing&&state.colorsBuf){gl.vertexAttribDivisor(this._aColor.location,1);}}if(this._aFlags){this._aFlags.bindArrayBuffer(state.flagsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aFlags.location,1);}}if(this._aOffset){this._aOffset.bindArrayBuffer(state.offsetsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aOffset.location,1);}}if(this._aPickColor){this._aPickColor.bindArrayBuffer(state.pickColorsBuf);if(this._instancing){gl.vertexAttribDivisor(this._aPickColor.location,1);}}if(this._instancing){if(this._edges){state.edgeIndicesBuf.bind();}else{if(state.indicesBuf){state.indicesBuf.bind();}}}else{if(this._edges){state.edgeIndicesBuf.bind();}else{if(state.indicesBuf){state.indicesBuf.bind();}}}return vao;}},{key:"drawLayer",value:function drawLayer(frameCtx,layer,renderPass){var _ref7=arguments.length>3&&arguments[3]!==undefined?arguments[3]:{},_ref7$colorUniform=_ref7.colorUniform,colorUniform=_ref7$colorUniform===void 0?false:_ref7$colorUniform,_ref7$incrementDrawSt=_ref7.incrementDrawState,incrementDrawState=_ref7$incrementDrawSt===void 0?false:_ref7$incrementDrawSt;var maxTextureUnits=WEBGL_INFO.MAX_TEXTURE_IMAGE_UNITS;var scene=this._scene;var gl=scene.canvas.gl;var state=layer._state,model=layer.model;var textureSet=state.textureSet,origin=state.origin,positionsDecodeMatrix=state.positionsDecodeMatrix;var lightsState=scene._lightsState;var pointsMaterial=scene.pointsMaterial;var camera=model.scene.camera;var viewNormalMatrix=camera.viewNormalMatrix,project=camera.project;var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate,worldNormalMatrix=model.worldNormalMatrix;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx);}if(this._vaoCache.has(layer)){gl.bindVertexArray(this._vaoCache.get(layer));}else{this._vaoCache.set(layer,this._makeVAO(state));}var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrixConjugate,0);var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$z;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$s);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];this._matricesUniformBlockBufferData.set(createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$r),offset+=mat4Size);}else{this._matricesUniformBlockBufferData.set(viewMatrix,offset+=mat4Size);}this._matricesUniformBlockBufferData.set(frameCtx.pickProjMatrix||project.matrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(positionsDecodeMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(worldNormalMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(viewNormalMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);gl.uniform1i(this._uRenderPass,renderPass);if(this._uBrightness){gl.uniform1f(this._uBrightness,model._brightness!==undefined?model._brightness:1.0);}this.setSectionPlanesStateUniforms(layer);if(scene.logarithmicDepthBufferEnabled){if(this._uLogDepthBufFC){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix?
14663
14663
  gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}if(this._uZFar){gl.uniform1f(this._uZFar,scene.camera.project.far);}}if(this._uPickInvisible){gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);}if(this._uPickZNear){gl.uniform1f(this._uPickZNear,frameCtx.pickZNear);}if(this._uPickZFar){gl.uniform1f(this._uPickZFar,frameCtx.pickZFar);}if(this._uPickClipPos){gl.uniform2fv(this._uPickClipPos,frameCtx.pickClipPos);}if(this._uDrawingBufferSize){gl.uniform2f(this._uDrawingBufferSize,gl.drawingBufferWidth,gl.drawingBufferHeight);}if(this._uUVDecodeMatrix){gl.uniformMatrix3fv(this._uUVDecodeMatrix,false,state.uvDecodeMatrix);}if(this._uIntensityRange&&pointsMaterial.filterIntensity){gl.uniform2f(this._uIntensityRange,pointsMaterial.minIntensity,pointsMaterial.maxIntensity);}if(this._uPointSize){gl.uniform1f(this._uPointSize,pointsMaterial.pointSize);}if(this._uNearPlaneHeight){var nearPlaneHeight=scene.camera.projection==="ortho"?1.0:gl.drawingBufferHeight/(2*Math.tan(0.5*scene.camera.perspective.fov*Math.PI/180.0));gl.uniform1f(this._uNearPlaneHeight,nearPlaneHeight);}if(textureSet){var colorTexture=textureSet.colorTexture,metallicRoughnessTexture=textureSet.metallicRoughnessTexture,emissiveTexture=textureSet.emissiveTexture,normalsTexture=textureSet.normalsTexture,occlusionTexture=textureSet.occlusionTexture;if(this._uColorMap&&colorTexture){this._program.bindTexture(this._uColorMap,colorTexture.texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;}if(this._uMetallicRoughMap&&metallicRoughnessTexture){this._program.bindTexture(this._uMetallicRoughMap,metallicRoughnessTexture.texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;}if(this._uEmissiveMap&&emissiveTexture){this._program.bindTexture(this._uEmissiveMap,emissiveTexture.texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;}if(this._uNormalMap&&normalsTexture){this._program.bindTexture(this._uNormalMap,normalsTexture.texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;}if(this._uAOMap&&occlusionTexture){this._program.bindTexture(this._uAOMap,occlusionTexture.texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;}}if(lightsState.reflectionMaps.length>0&&lightsState.reflectionMaps[0].texture&&this._uReflectionMap){this._program.bindTexture(this._uReflectionMap,lightsState.reflectionMaps[0].texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;frameCtx.bindTexture++;}if(lightsState.lightMaps.length>0&&lightsState.lightMaps[0].texture&&this._uLightMap){this._program.bindTexture(this._uLightMap,lightsState.lightMaps[0].texture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;frameCtx.bindTexture++;}if(this._withSAO){var sao=scene.sao;var saoEnabled=sao.possible;if(saoEnabled){var viewportWidth=gl.drawingBufferWidth;var viewportHeight=gl.drawingBufferHeight;tempVec4[0]=viewportWidth;tempVec4[1]=viewportHeight;tempVec4[2]=sao.blendCutoff;tempVec4[3]=sao.blendFactor;gl.uniform4fv(this._uSAOParams,tempVec4);this._program.bindTexture(this._uOcclusionTexture,frameCtx.occlusionTexture,frameCtx.textureUnit);frameCtx.textureUnit=(frameCtx.textureUnit+1)%maxTextureUnits;frameCtx.bindTexture++;}}if(colorUniform){var colorKey=this._edges?"edgeColor":"fillColor";var alphaKey=this._edges?"edgeAlpha":"fillAlpha";if(renderPass===RENDER_PASSES["".concat(this._edges?"EDGES":"SILHOUETTE","_XRAYED")]){var material=scene.xrayMaterial._state;var _color3=material[colorKey];var alpha=material[alphaKey];gl.uniform4f(this._uColor,_color3[0],_color3[1],_color3[2],alpha);}else if(renderPass===RENDER_PASSES["".concat(this._edges?"EDGES":"SILHOUETTE","_HIGHLIGHTED")]){var _material=scene.highlightMaterial._state;var _color4=_material[colorKey];var _alpha=_material[alphaKey];gl.uniform4f(this._uColor,_color4[0],_color4[1],_color4[2],_alpha);}else if(renderPass===RENDER_PASSES["".concat(this._edges?"EDGES":"SILHOUETTE","_SELECTED")]){var _material2=scene.selectedMaterial._state;var _color5=_material2[colorKey];var _alpha2=_material2[alphaKey];gl.uniform4f(this._uColor,_color5[0],_color5[1],_color5[2],_alpha2);}else{gl.uniform4fv(this._uColor,this._edges?edgesDefaultColor:defaultColor$2);}}this._draw({state:state,frameCtx:frameCtx,incrementDrawState:incrementDrawState});gl.bindVertexArray(null);}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;stats.memory.programs--;}}]);}();/**
14664
14664
  * @private
14665
14665
  */var TrianglesBatchingRenderer=/*#__PURE__*/function(_VBORenderer){function TrianglesBatchingRenderer(scene,withSAO){var _ref8=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},_ref8$edges=_ref8.edges,edges=_ref8$edges===void 0?false:_ref8$edges;_classCallCheck(this,TrianglesBatchingRenderer);return _callSuper(this,TrianglesBatchingRenderer,[scene,withSAO,{instancing:false,edges:edges}]);}_inherits(TrianglesBatchingRenderer,_VBORenderer);return _createClass(TrianglesBatchingRenderer,[{key:"_draw",value:function _draw(drawCfg){var gl=this._scene.canvas.gl;var state=drawCfg.state,frameCtx=drawCfg.frameCtx,incrementDrawState=drawCfg.incrementDrawState;if(this._edges){gl.drawElements(gl.LINES,state.edgeIndicesBuf.numItems,state.edgeIndicesBuf.itemType,0);}else{var count=frameCtx.pickElementsCount||state.indicesBuf.numItems;var offset=frameCtx.pickElementsOffset?frameCtx.pickElementsOffset*state.indicesBuf.itemByteSize:0;gl.drawElements(gl.TRIANGLES,count,state.indicesBuf.itemType,offset);if(incrementDrawState){frameCtx.drawElements++;}}}}]);}(VBORenderer);/**
@@ -14667,16 +14667,16 @@ gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}if(this._uZFar){gl.uniform1f(t
14667
14667
  */var TrianglesColorRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen){function TrianglesColorRenderer$1(){_classCallCheck(this,TrianglesColorRenderer$1);return _callSuper(this,TrianglesColorRenderer$1,arguments);}_inherits(TrianglesColorRenderer$1,_TrianglesBatchingRen);return _createClass(TrianglesColorRenderer$1,[{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"drawLayer",value:function drawLayer(frameCtx,layer,renderPass){_superPropGet(TrianglesColorRenderer$1,"drawLayer",this,3)([frameCtx,layer,renderPass,{incrementDrawState:true}]);}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");src.push("in vec3 normal;");src.push("in vec4 color;");src.push("in float flags;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in vec4 modelNormalMatrixCol0;");src.push("in vec4 modelNormalMatrixCol1;");src.push("in vec4 modelNormalMatrixCol2;");this._addMatricesUniformBlockLines(src,true);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("uniform vec4 lightAmbient;");for(var _i163=0,len=lightsState.lights.length;_i163<len;_i163++){light=lightsState.lights[_i163];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i163+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i163+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i163+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i163+";");src.push("uniform vec3 lightDir"+_i163+";");}}src.push("vec3 octDecode(vec2 oct) {");src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
14668
14668
  // renderPass = COLOR_OPAQUE
14669
14669
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
14670
- src.push("} else {");src.push("vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push("vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0); ");src.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i164=0,_len23=lightsState.lights.length;_i164<_len23;_i164++){light=lightsState.lights[_i164];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i164+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i164+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i164+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i164+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i164+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i164+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i164+".rgb * lightColor"+_i164+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i165=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i165<len;_i165++){src.push("uniform bool sectionPlaneActive"+_i165+";");src.push("uniform vec3 sectionPlanePos"+_i165+";");src.push("uniform vec3 sectionPlaneDir"+_i165+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i166=0,_len24=sectionPlanesState.getNumAllocatedSectionPlanes();_i166<_len24;_i166++){src.push("if (sectionPlaneActive"+_i166+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i166+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i166+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14670
+ src.push("} else {");src.push("vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push("vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0);");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0); ");src.push("vec3 viewNormal = normalize((viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i164=0,_len23=lightsState.lights.length;_i164<_len23;_i164++){light=lightsState.lights[_i164];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i164+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i164+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i164+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i164+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i164+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i164+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i164+".rgb * lightColor"+_i164+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching draw 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i165=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i165<len;_i165++){src.push("uniform bool sectionPlaneActive"+_i165+";");src.push("uniform vec3 sectionPlanePos"+_i165+";");src.push("uniform vec3 sectionPlaneDir"+_i165+";");}}src.push("uniform float brightness;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i166=0,_len24=sectionPlanesState.getNumAllocatedSectionPlanes();_i166<_len24;_i166++){src.push("if (sectionPlaneActive"+_i166+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i166+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i166+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14671
14671
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
14672
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");}else{src.push(" outColor = vColor;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14672
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");}else{src.push(" outColor = vColor;");}src.push("outColor.rgb *= brightness;");src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14673
14673
  * @private
14674
14674
  */var TrianglesFlatColorRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen2){function TrianglesFlatColorRenderer$1(){_classCallCheck(this,TrianglesFlatColorRenderer$1);return _callSuper(this,TrianglesFlatColorRenderer$1,arguments);}_inherits(TrianglesFlatColorRenderer$1,_TrianglesBatchingRen2);return _createClass(TrianglesFlatColorRenderer$1,[{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching flat-shading draw vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");src.push("in vec4 color;");src.push("in float flags;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._addMatricesUniformBlockLines(src);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;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vViewPosition;");src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
14675
14675
  // renderPass = COLOR_OPAQUE
14676
14676
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
14677
- src.push("} else {");src.push("vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push("vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching flat-shading draw 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i167=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i167<len;_i167++){src.push("uniform bool sectionPlaneActive"+_i167+";");src.push("uniform vec3 sectionPlanePos"+_i167+";");src.push("uniform vec3 sectionPlaneDir"+_i167+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i168=0,_len25=lightsState.lights.length;_i168<_len25;_i168++){var light=lightsState.lights[_i168];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i168+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i168+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i168+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i168+";");src.push("uniform vec3 lightDir"+_i168+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i169=0,_len26=sectionPlanesState.getNumAllocatedSectionPlanes();_i169<_len26;_i169++){src.push("if (sectionPlaneActive"+_i169+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i169+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i169+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var _i170=0,_len27=lightsState.lights.length;_i170<_len27;_i170++){var _light4=lightsState.lights[_i170];if(_light4.type==="ambient"){continue;}if(_light4.type==="dir"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i170+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i170+", 0.0)).xyz);");}}else if(_light4.type==="point"){if(_light4.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i170+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i170+", 0.0)).xyz);");}}else if(_light4.type==="spot"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i170+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i170+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i170+".rgb * lightColor"+_i170+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14677
+ src.push("} else {");src.push("vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push("vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching flat-shading draw 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i167=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i167<len;_i167++){src.push("uniform bool sectionPlaneActive"+_i167+";");src.push("uniform vec3 sectionPlanePos"+_i167+";");src.push("uniform vec3 sectionPlaneDir"+_i167+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");src.push("uniform float brightness;");for(var _i168=0,_len25=lightsState.lights.length;_i168<_len25;_i168++){var light=lightsState.lights[_i168];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i168+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i168+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i168+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i168+";");src.push("uniform vec3 lightDir"+_i168+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i169=0,_len26=sectionPlanesState.getNumAllocatedSectionPlanes();_i169<_len26;_i169++){src.push("if (sectionPlaneActive"+_i169+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i169+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i169+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var _i170=0,_len27=lightsState.lights.length;_i170<_len27;_i170++){var _light4=lightsState.lights[_i170];if(_light4.type==="ambient"){continue;}if(_light4.type==="dir"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i170+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i170+", 0.0)).xyz);");}}else if(_light4.type==="point"){if(_light4.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i170+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i170+", 0.0)).xyz);");}}else if(_light4.type==="spot"){if(_light4.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i170+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i170+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i170+".rgb * lightColor"+_i170+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14678
14678
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
14679
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14679
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}src.push("outColor.rgb *= brightness;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14680
14680
  * @private
14681
14681
  */var TrianglesSilhouetteRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen3){function TrianglesSilhouetteRenderer$1(){_classCallCheck(this,TrianglesSilhouetteRenderer$1);return _callSuper(this,TrianglesSilhouetteRenderer$1,arguments);}_inherits(TrianglesSilhouetteRenderer$1,_TrianglesBatchingRen3);return _createClass(TrianglesSilhouetteRenderer$1,[{key:"drawLayer",value:function drawLayer(frameCtx,batchingLayer,renderPass){_superPropGet(TrianglesSilhouetteRenderer$1,"drawLayer",this,3)([frameCtx,batchingLayer,renderPass,{colorUniform:true}]);}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching silhouette vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in float flags;");src.push("in vec4 color;");this._addMatricesUniformBlockLines(src);src.push("uniform vec4 silhouetteColor;");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;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// silhouetteFlag = NOT_RENDERED | SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | SILHOUETTE_XRAYED
14682
14682
  // renderPass = SILHOUETTE_HIGHLIGHTED | SILHOUETTE_SELECTED | | SILHOUETTE_XRAYED
@@ -14748,12 +14748,12 @@ src.push("};");// IRRADIANCE EVALUATION
14748
14748
  src.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {");src.push(" float r = ggxRoughness + 0.0001;");src.push(" return (2.0 / (r * r) - 2.0);");src.push("}");src.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {");src.push(" float maxMIPLevelScalar = float( maxMIPLevel );");src.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );");src.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );");src.push("}");if(lightsState.reflectionMaps.length>0){src.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {");src.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);");//TODO: a random factor - fix this
14749
14749
  src.push(" vec3 envMapColor = sRGBToLinear(texture(reflectionMap, reflectVec, mipLevel)).rgb;");src.push(" return envMapColor;");src.push("}");}// SPECULAR BRDF EVALUATION
14750
14750
  src.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {");src.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );");src.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;");src.push("}");src.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" return 1.0 / ( gl * gv );");src.push("}");src.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" return 0.5 / max( gv + gl, EPSILON );");src.push("}");src.push("float D_GGX(const in float alpha, const in float dotNH) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;");src.push(" return RECIPROCAL_PI * a2 / ( denom * denom);");src.push("}");src.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {");src.push(" float alpha = ( roughness * roughness );");src.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );");src.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );");src.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );");src.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );");src.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );");src.push(" vec3 F = F_Schlick( specularColor, dotLH );");src.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );");src.push(" float D = D_GGX( alpha, dotNH );");src.push(" return F * (G * D);");src.push("}");src.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {");src.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));");src.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);");src.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);");src.push(" vec4 r = roughness * c0 + c1;");src.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;");src.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;");src.push(" return specularColor * AB.x + AB.y;");src.push("}");if(lightsState.lightMaps.length>0||lightsState.reflectionMaps.length>0){src.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");if(lightsState.lightMaps.length>0){src.push(" vec3 irradiance = sRGBToLinear(texture(lightMap, geometry.worldNormal)).rgb;");src.push(" irradiance *= PI;");src.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;");}if(lightsState.reflectionMaps.length>0){src.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);");src.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);");src.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);");src.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);");src.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);");src.push(" reflectedLight.specular += radiance * specularBRDFContrib;");}src.push("}");}// MAIN LIGHTING COMPUTATION FUNCTION
14751
- src.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");src.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));");src.push(" vec3 irradiance = dotNL * incidentLight.color * PI;");src.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);");src.push("}");src.push("out vec4 outColor;");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 _i185=0,_len31=sectionPlanesState.getNumAllocatedSectionPlanes();_i185<_len31;_i185++){src.push("if (sectionPlaneActive"+_i185+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i185+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i185+".xyz), 0.0, 1000.0);");src.push("}");}if(clippingCaps){src.push(" if (dist > (0.002 * vClipPosition.w)) {");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" return;");src.push("}");}else{src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");}src.push("}");}src.push("IncidentLight light;");src.push("Material material;");src.push("Geometry geometry;");src.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));");src.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));");src.push("float opacity = float(vColor.a) / 255.0;");src.push("vec3 baseColor = rgb;");src.push("float specularF0 = 1.0;");src.push("float metallic = float(vMetallicRoughness.r) / 255.0;");src.push("float roughness = float(vMetallicRoughness.g) / 255.0;");src.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;");src.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));");src.push("baseColor *= colorTexel.rgb;");// src.push("opacity *= colorTexel.a;");
14751
+ src.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");src.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));");src.push(" vec3 irradiance = dotNL * incidentLight.color * PI;");src.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);");src.push("}");src.push("out vec4 outColor;");src.push("uniform float brightness;");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 _i185=0,_len31=sectionPlanesState.getNumAllocatedSectionPlanes();_i185<_len31;_i185++){src.push("if (sectionPlaneActive"+_i185+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i185+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i185+".xyz), 0.0, 1000.0);");src.push("}");}if(clippingCaps){src.push(" if (dist > (0.002 * vClipPosition.w)) {");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" return;");src.push("}");}else{src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");}src.push("}");}src.push("IncidentLight light;");src.push("Material material;");src.push("Geometry geometry;");src.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));");src.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));");src.push("float opacity = float(vColor.a) / 255.0;");src.push("vec3 baseColor = rgb;");src.push("float specularF0 = 1.0;");src.push("float metallic = float(vMetallicRoughness.r) / 255.0;");src.push("float roughness = float(vMetallicRoughness.g) / 255.0;");src.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;");src.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));");src.push("baseColor *= colorTexel.rgb;");// src.push("opacity *= colorTexel.a;");
14752
14752
  src.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;");src.push("metallic *= metalRoughTexel.b;");src.push("roughness *= metalRoughTexel.g;");src.push("vec3 viewNormal = perturbNormal2Arb(vViewPosition.xyz, normalize(vViewNormal), vUV );");src.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);");src.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);");src.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);");src.push("geometry.position = vViewPosition.xyz;");src.push("geometry.viewNormal = -normalize(viewNormal);");src.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);");if(lightsState.lightMaps.length>0){src.push("geometry.worldNormal = normalize(vWorldNormal);");}if(lightsState.lightMaps.length>0||lightsState.reflectionMaps.length>0){src.push("computePBRLightMapping(geometry, material, reflectedLight);");}for(var _i186=0,_len32=lightsState.lights.length;_i186<_len32;_i186++){var _light5=lightsState.lights[_i186];if(_light5.type==="ambient"){continue;}if(_light5.type==="dir"){if(_light5.space==="view"){src.push("light.direction = normalize(lightDir"+_i186+");");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightDir"+_i186+", 0.0)).xyz);");}}else if(_light5.type==="point"){if(_light5.space==="view"){src.push("light.direction = normalize(lightPos"+_i186+" - vViewPosition.xyz);");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightPos"+_i186+", 0.0)).xyz);");}}else if(_light5.type==="spot"){if(_light5.space==="view"){src.push("light.direction = normalize(lightDir"+_i186+");");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightDir"+_i186+", 0.0)).xyz);");}}else{continue;}src.push("light.color = lightColor"+_i186+".rgb * lightColor"+_i186+".a;");// a is intensity
14753
14753
  src.push("computePBRLighting(light, geometry, material, reflectedLight);");}src.push("vec3 emissiveColor = sRGBToLinear(texture(uEmissiveMap, vUV)).rgb;");// TODO: correct gamma function
14754
14754
  src.push("float aoFactor = texture(uAOMap, vUV).r;");src.push("vec3 outgoingLight = (lightAmbient.rgb * lightAmbient.a * baseColor * opacity * rgb) + (reflectedLight.diffuse) + (reflectedLight.specular) + emissiveColor;");src.push("vec4 fragColor;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14755
14755
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
14756
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" fragColor = vec4(outgoingLight.rgb * ambient * aoFactor, opacity);");}else{src.push(" fragColor = vec4(outgoingLight.rgb * aoFactor, opacity);");}if(gammaOutput){src.push("fragColor = linearToGamma(fragColor, gammaFactor);");}src.push("outColor = fragColor;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14756
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" fragColor = vec4(outgoingLight.rgb * ambient * aoFactor, opacity);");}else{src.push(" fragColor = vec4(outgoingLight.rgb * aoFactor, opacity);");}if(gammaOutput){src.push("fragColor = linearToGamma(fragColor, gammaFactor);");}src.push("outColor = fragColor;");src.push("outColor.rgb *= brightness;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);/**
14757
14757
  * @private
14758
14758
  */var TrianglesPickNormalsFlatRenderer$1=/*#__PURE__*/function(_TrianglesBatchingRen13){function TrianglesPickNormalsFlatRenderer$1(){_classCallCheck(this,TrianglesPickNormalsFlatRenderer$1);return _callSuper(this,TrianglesPickNormalsFlatRenderer$1,arguments);}_inherits(TrianglesPickNormalsFlatRenderer$1,_TrianglesBatchingRen13);return _createClass(TrianglesPickNormalsFlatRenderer$1,[{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var clipping=scene._sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching pick flat normals vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in float flags;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);this._addRemapClipPosLines(src,3);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("out vec4 vWorldPosition;");if(clipping){src.push("out float vFlags;");}src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
14759
14759
  // renderPass = PICK
@@ -14764,9 +14764,9 @@ src.push(" } else {");src.push(" vec4 localPosition = positionsDecodeMatri
14764
14764
  // renderPass = COLOR_OPAQUE
14765
14765
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
14766
14766
  src.push("} else {");src.push("vec4 localPosition = positionsDecodeMatrix * vec4(position, 1.0);");src.push("vec4 worldPosition = worldMatrix * vec4(dot(localPosition, modelMatrixCol0), dot(localPosition, modelMatrixCol1), dot(localPosition, modelMatrixCol2), 1.0); ");if(scene.entityOffsetsEnabled){src.push("worldPosition.xyz = worldPosition.xyz + offset;");}src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var gammaOutput=scene.gammaOutput;// If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
14767
- var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching color texture 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 sampler2D uColorMap;");if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i188=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i188<len;_i188++){src.push("uniform bool sectionPlaneActive"+_i188+";");src.push("uniform vec3 sectionPlanePos"+_i188+";");src.push("uniform vec3 sectionPlaneDir"+_i188+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i189=0,_len33=lightsState.lights.length;_i189<_len33;_i189++){var light=lightsState.lights[_i189];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i189+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i189+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i189+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i189+";");src.push("uniform vec3 lightDir"+_i189+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");src.push("out vec4 outColor;");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 _i190=0,_len34=sectionPlanesState.getNumAllocatedSectionPlanes();_i190<_len34;_i190++){src.push("if (sectionPlaneActive"+_i190+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i190+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i190+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var _i191=0,_len35=lightsState.lights.length;_i191<_len35;_i191++){var _light6=lightsState.lights[_i191];if(_light6.type==="ambient"){continue;}if(_light6.type==="dir"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i191+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i191+", 0.0)).xyz);");}}else if(_light6.type==="point"){if(_light6.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i191+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i191+", 0.0)).xyz);");}}else if(_light6.type==="spot"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i191+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i191+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i191+".rgb * lightColor"+_i191+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(gammaOutput){src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");}else{src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");}src.push("float opacity = color.a;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14767
+ var lightsState=scene._lightsState;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Triangles batching color texture 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 sampler2D uColorMap;");if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}src.push("uniform float gammaFactor;");src.push("uniform float brightness;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i188=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i188<len;_i188++){src.push("uniform bool sectionPlaneActive"+_i188+";");src.push("uniform vec3 sectionPlanePos"+_i188+";");src.push("uniform vec3 sectionPlaneDir"+_i188+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(var _i189=0,_len33=lightsState.lights.length;_i189<_len33;_i189++){var light=lightsState.lights[_i189];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i189+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i189+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i189+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i189+";");src.push("uniform vec3 lightDir"+_i189+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");src.push("out vec4 outColor;");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 _i190=0,_len34=sectionPlanesState.getNumAllocatedSectionPlanes();_i190<_len34;_i190++){src.push("if (sectionPlaneActive"+_i190+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i190+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i190+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(var _i191=0,_len35=lightsState.lights.length;_i191<_len35;_i191++){var _light6=lightsState.lights[_i191];if(_light6.type==="ambient"){continue;}if(_light6.type==="dir"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i191+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i191+", 0.0)).xyz);");}}else if(_light6.type==="point"){if(_light6.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i191+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i191+", 0.0)).xyz);");}}else if(_light6.type==="spot"){if(_light6.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i191+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i191+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i191+".rgb * lightColor"+_i191+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(gammaOutput){src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");}else{src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");}src.push("float opacity = color.a;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
14768
14768
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
14769
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(colorTexel.rgb, opacity);");}if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);var tempVec3a$y=math.vec3();var tempVec3b$w=math.vec3();var tempVec3c$r=math.vec3();var tempVec3d$c=math.vec3();var tempMat4a$q=math.mat4();/**
14769
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(colorTexel.rgb, opacity);");}src.push("outColor.rgb *= brightness;");if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesBatchingRenderer);var tempVec3a$y=math.vec3();var tempVec3b$w=math.vec3();var tempVec3c$r=math.vec3();var tempVec3d$c=math.vec3();var tempMat4a$q=math.mat4();/**
14770
14770
  * @private
14771
14771
  */var TrianglesSnapInitRenderer$1=/*#__PURE__*/function(_VBORenderer2){function TrianglesSnapInitRenderer$1(){_classCallCheck(this,TrianglesSnapInitRenderer$1);return _callSuper(this,TrianglesSnapInitRenderer$1,arguments);}_inherits(TrianglesSnapInitRenderer$1,_VBORenderer2);return _createClass(TrianglesSnapInitRenderer$1,[{key:"drawLayer",value:function drawLayer(frameCtx,batchingLayer,renderPass){if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=batchingLayer.model;var scene=model.scene;var camera=scene.camera;var gl=scene.canvas.gl;var state=batchingLayer._state;var origin=batchingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;var aabb=batchingLayer.aabb;// Per-layer AABB for best RTC accuracy
14772
14772
  var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(batchingLayer)){gl.bindVertexArray(this._vaoCache.get(batchingLayer));}else{this._vaoCache.set(batchingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$y;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$w;if(origin){var rotatedOrigin=tempVec3c$r;math.transformPoint3(rotationMatrix,origin,rotatedOrigin);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$q);rtcCameraEye=tempVec3d$c;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrixConjugate,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);// TODO: Far from pick project matrix?
@@ -15008,17 +15008,17 @@ math.triangleNormal(a,b,c,worldNormal);}gotIntersect=true;}}}if(gotIntersect&&wo
15008
15008
  src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("in vec4 modelNormalMatrixCol0;");src.push("in vec4 modelNormalMatrixCol1;");src.push("in vec4 modelNormalMatrixCol2;");this._addMatricesUniformBlockLines(src,true);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("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("vec3 octDecode(vec2 oct) {");src.push(" vec3 v = vec3(oct.xy, 1.0 - abs(oct.x) - abs(oct.y));");src.push(" if (v.z < 0.0) {");src.push(" v.xy = (1.0 - abs(v.yx)) * vec2(v.x >= 0.0 ? 1.0 : -1.0, v.y >= 0.0 ? 1.0 : -1.0);");src.push(" }");src.push(" return normalize(v);");src.push("}");if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
15009
15009
  // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
15010
15010
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
15011
- 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("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);");src.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i224=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i224<len;_i224++){src.push("uniform bool sectionPlaneActive"+_i224+";");src.push("uniform vec3 sectionPlanePos"+_i224+";");src.push("uniform vec3 sectionPlaneDir"+_i224+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i225=0,_len45=sectionPlanesState.getNumAllocatedSectionPlanes();_i225<_len45;_i225++){src.push("if (sectionPlaneActive"+_i225+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i225+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i225+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15011
+ 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("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec4 modelNormal = vec4(octDecode(normal.xy), 0.0); ");src.push("vec4 worldNormal = worldNormalMatrix * vec4(dot(modelNormal, modelNormalMatrixCol0), dot(modelNormal, modelNormalMatrixCol1), dot(modelNormal, modelNormalMatrixCol2), 0.0);");src.push("vec3 viewNormal = normalize(vec4(viewNormalMatrix * worldNormal).xyz);");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(i=0,len=lightsState.lights.length;i<len;i++){light=lightsState.lights[i];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec3 rgb = (vec3(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0));");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i224=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i224<len;_i224++){src.push("uniform bool sectionPlaneActive"+_i224+";");src.push("uniform vec3 sectionPlanePos"+_i224+";");src.push("uniform vec3 sectionPlaneDir"+_i224+";");}}src.push("uniform float brightness;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i225=0,_len45=sectionPlanesState.getNumAllocatedSectionPlanes();_i225<_len45;_i225++){src.push("if (sectionPlaneActive"+_i225+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i225+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i225+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15012
15012
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
15013
- if(this._withSAO){src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");}else{src.push(" outColor = vColor;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15013
+ if(this._withSAO){src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");}else{src.push(" outColor = vColor;");}src.push("outColor.rgb *= brightness;");src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15014
15014
  * @private
15015
15015
  */var TrianglesFlatColorRenderer=/*#__PURE__*/function(_TrianglesInstancingR2){function TrianglesFlatColorRenderer(){_classCallCheck(this,TrianglesFlatColorRenderer);return _callSuper(this,TrianglesFlatColorRenderer,arguments);}_inherits(TrianglesFlatColorRenderer,_TrianglesInstancingR2);return _createClass(TrianglesFlatColorRenderer,[{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry flat-shading drawing vertex shader");src.push("uniform int renderPass;");src.push("in vec3 position;");src.push("in vec4 color;");src.push("in float flags;");if(scene.entityOffsetsEnabled){src.push("in vec3 offset;");}src.push("in vec4 modelMatrixCol0;");// Modeling matrix
15016
15016
  src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._addMatricesUniformBlockLines(src);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;");}if(clipping){src.push("out vec4 vWorldPosition;");src.push("out float vFlags;");}src.push("out vec4 vViewPosition;");src.push("out vec4 vColor;");src.push("void main(void) {");// colorFlag = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
15017
15017
  // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
15018
15018
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
15019
- 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("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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 lightsState=scene._lightsState;var i;var len;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry flat-shading drawing 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i226=0,_len46=sectionPlanesState.getNumAllocatedSectionPlanes();_i226<_len46;_i226++){src.push("uniform bool sectionPlaneActive"+_i226+";");src.push("uniform vec3 sectionPlanePos"+_i226+";");src.push("uniform vec3 sectionPlaneDir"+_i226+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){var light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i227=0,_len47=sectionPlanesState.getNumAllocatedSectionPlanes();_i227<_len47;_i227++){src.push("if (sectionPlaneActive"+_i227+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i227+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i227+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(i=0,len=lightsState.lights.length;i<len;i++){var _light7=lightsState.lights[i];if(_light7.type==="ambient"){continue;}if(_light7.type==="dir"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(_light7.type==="point"){if(_light7.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(_light7.type==="spot"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15019
+ 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("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}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 lightsState=scene._lightsState;var i;var len;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry flat-shading drawing 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i226=0,_len46=sectionPlanesState.getNumAllocatedSectionPlanes();_i226<_len46;_i226++){src.push("uniform bool sectionPlaneActive"+_i226+";");src.push("uniform vec3 sectionPlanePos"+_i226+";");src.push("uniform vec3 sectionPlaneDir"+_i226+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");src.push("uniform float brightness;");for(i=0,len=lightsState.lights.length;i<len;i++){var light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i227=0,_len47=sectionPlanesState.getNumAllocatedSectionPlanes();_i227<_len47;_i227++){src.push("if (sectionPlaneActive"+_i227+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i227+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i227+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(i=0,len=lightsState.lights.length;i<len;i++){var _light7=lightsState.lights[i];if(_light7.type==="ambient"){continue;}if(_light7.type==="dir"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(_light7.type==="point"){if(_light7.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(_light7.type==="spot"){if(_light7.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec4 fragColor = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15020
15020
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
15021
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15021
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(fragColor.rgb * ambient, 1.0);");}else{src.push(" outColor = fragColor;");}src.push("outColor.rgb *= brightness;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15022
15022
  * @private
15023
15023
  */var TrianglesSilhouetteRenderer=/*#__PURE__*/function(_TrianglesInstancingR3){function TrianglesSilhouetteRenderer(){_classCallCheck(this,TrianglesSilhouetteRenderer);return _callSuper(this,TrianglesSilhouetteRenderer,arguments);}_inherits(TrianglesSilhouetteRenderer,_TrianglesInstancingR3);return _createClass(TrianglesSilhouetteRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){// TODO color uniform true ???
15024
15024
  _superPropGet(TrianglesSilhouetteRenderer,"drawLayer",this,3)([frameCtx,instancingLayer,renderPass,{colorUniform:true}]);}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing silhouette vertex shader");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 color;");src.push("in vec4 modelMatrixCol0;");// Modeling matrix
@@ -15095,12 +15095,12 @@ src.push("};");// IRRADIANCE EVALUATION
15095
15095
  src.push("float GGXRoughnessToBlinnExponent(const in float ggxRoughness) {");src.push(" float r = ggxRoughness + 0.0001;");src.push(" return (2.0 / (r * r) - 2.0);");src.push("}");src.push("float getSpecularMIPLevel(const in float blinnShininessExponent, const in int maxMIPLevel) {");src.push(" float maxMIPLevelScalar = float( maxMIPLevel );");src.push(" float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( ( blinnShininessExponent * blinnShininessExponent ) + 1.0 );");src.push(" return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );");src.push("}");if(lightsState.reflectionMaps.length>0){src.push("vec3 getLightProbeIndirectRadiance(const in vec3 reflectVec, const in float blinnShininessExponent, const in int maxMIPLevel) {");src.push(" float mipLevel = 0.5 * getSpecularMIPLevel(blinnShininessExponent, maxMIPLevel);");//TODO: a random factor - fix this
15096
15096
  src.push(" vec3 envMapColor = "+TEXTURE_DECODE_FUNCS[lightsState.reflectionMaps[0].encoding]+"(texture(reflectionMap, reflectVec, mipLevel)).rgb;");src.push(" return envMapColor;");src.push("}");}// SPECULAR BRDF EVALUATION
15097
15097
  src.push("vec3 F_Schlick(const in vec3 specularColor, const in float dotLH) {");src.push(" float fresnel = exp2( ( -5.55473 * dotLH - 6.98316 ) * dotLH );");src.push(" return ( 1.0 - specularColor ) * fresnel + specularColor;");src.push("}");src.push("float G_GGX_Smith(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gl = dotNL + sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" float gv = dotNV + sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" return 1.0 / ( gl * gv );");src.push("}");src.push("float G_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * ( dotNV * dotNV ) );");src.push(" float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * ( dotNL * dotNL ) );");src.push(" return 0.5 / max( gv + gl, EPSILON );");src.push("}");src.push("float D_GGX(const in float alpha, const in float dotNH) {");src.push(" float a2 = ( alpha * alpha );");src.push(" float denom = ( dotNH * dotNH) * ( a2 - 1.0 ) + 1.0;");src.push(" return RECIPROCAL_PI * a2 / ( denom * denom);");src.push("}");src.push("vec3 BRDF_Specular_GGX(const in IncidentLight incidentLight, const in Geometry geometry, const in vec3 specularColor, const in float roughness) {");src.push(" float alpha = ( roughness * roughness );");src.push(" vec3 halfDir = normalize( incidentLight.direction + geometry.viewEyeDir );");src.push(" float dotNL = saturate( dot( geometry.viewNormal, incidentLight.direction ) );");src.push(" float dotNV = saturate( dot( geometry.viewNormal, geometry.viewEyeDir ) );");src.push(" float dotNH = saturate( dot( geometry.viewNormal, halfDir ) );");src.push(" float dotLH = saturate( dot( incidentLight.direction, halfDir ) );");src.push(" vec3 F = F_Schlick( specularColor, dotLH );");src.push(" float G = G_GGX_SmithCorrelated( alpha, dotNL, dotNV );");src.push(" float D = D_GGX( alpha, dotNH );");src.push(" return F * (G * D);");src.push("}");src.push("vec3 BRDF_Specular_GGX_Environment(const in Geometry geometry, const in vec3 specularColor, const in float roughness) {");src.push(" float dotNV = saturate(dot(geometry.viewNormal, geometry.viewEyeDir));");src.push(" const vec4 c0 = vec4( -1, -0.0275, -0.572, 0.022);");src.push(" const vec4 c1 = vec4( 1, 0.0425, 1.04, -0.04);");src.push(" vec4 r = roughness * c0 + c1;");src.push(" float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;");src.push(" vec2 AB = vec2(-1.04, 1.04) * a004 + r.zw;");src.push(" return specularColor * AB.x + AB.y;");src.push("}");if(lightsState.lightMaps.length>0||lightsState.reflectionMaps.length>0){src.push("void computePBRLightMapping(const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");if(lightsState.lightMaps.length>0){src.push(" vec3 irradiance = "+TEXTURE_DECODE_FUNCS[lightsState.lightMaps[0].encoding]+"(texture(lightMap, geometry.worldNormal)).rgb;");src.push(" irradiance *= PI;");src.push(" vec3 diffuseBRDFContrib = (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.diffuse += irradiance * diffuseBRDFContrib;");}if(lightsState.reflectionMaps.length>0){src.push(" vec3 reflectVec = reflect(geometry.viewEyeDir, geometry.viewNormal);");src.push(" reflectVec = inverseTransformDirection(reflectVec, viewMatrix);");src.push(" float blinnExpFromRoughness = GGXRoughnessToBlinnExponent(material.specularRoughness);");src.push(" vec3 radiance = getLightProbeIndirectRadiance(reflectVec, blinnExpFromRoughness, 8);");src.push(" vec3 specularBRDFContrib = BRDF_Specular_GGX_Environment(geometry, material.specularColor, material.specularRoughness);");src.push(" reflectedLight.specular += radiance * specularBRDFContrib;");}src.push("}");}// MAIN LIGHTING COMPUTATION FUNCTION
15098
- src.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");src.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));");src.push(" vec3 irradiance = dotNL * incidentLight.color * PI;");src.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);");src.push("}");src.push("out vec4 outColor;");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 _i247=0,_len54=sectionPlanesState.getNumAllocatedSectionPlanes();_i247<_len54;_i247++){src.push("if (sectionPlaneActive"+_i247+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i247+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i247+".xyz), 0.0, 1000.0);");src.push("}");}if(clippingCaps){src.push(" if (dist > (0.002 * vClipPosition.w)) {");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" return;");src.push("}");}else{src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");}src.push("}");}src.push("IncidentLight light;");src.push("Material material;");src.push("Geometry geometry;");src.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));");src.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));");src.push("float opacity = float(vColor.a) / 255.0;");src.push("vec3 baseColor = rgb;");src.push("float specularF0 = 1.0;");src.push("float metallic = float(vMetallicRoughness.r) / 255.0;");src.push("float roughness = float(vMetallicRoughness.g) / 255.0;");src.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;");src.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));");src.push("baseColor *= colorTexel.rgb;");// src.push("opacity = colorTexel.a;");
15098
+ src.push("void computePBRLighting(const in IncidentLight incidentLight, const in Geometry geometry, const in Material material, inout ReflectedLight reflectedLight) {");src.push(" float dotNL = saturate(dot(geometry.viewNormal, incidentLight.direction));");src.push(" vec3 irradiance = dotNL * incidentLight.color * PI;");src.push(" reflectedLight.diffuse += irradiance * (RECIPROCAL_PI * material.diffuseColor);");src.push(" reflectedLight.specular += irradiance * BRDF_Specular_GGX(incidentLight, geometry, material.specularColor, material.specularRoughness);");src.push("}");src.push("out vec4 outColor;");src.push("uniform float brightness;");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 _i247=0,_len54=sectionPlanesState.getNumAllocatedSectionPlanes();_i247<_len54;_i247++){src.push("if (sectionPlaneActive"+_i247+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i247+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i247+".xyz), 0.0, 1000.0);");src.push("}");}if(clippingCaps){src.push(" if (dist > (0.002 * vClipPosition.w)) {");src.push(" discard;");src.push(" }");src.push(" if (dist > 0.0) { ");src.push(" outColor=vec4(1.0, 0.0, 0.0, 1.0);");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" return;");src.push("}");}else{src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");}src.push("}");}src.push("IncidentLight light;");src.push("Material material;");src.push("Geometry geometry;");src.push("ReflectedLight reflectedLight = ReflectedLight(vec3(0.0,0.0,0.0), vec3(0.0,0.0,0.0));");src.push("vec3 rgb = (vec3(float(vColor.r) / 255.0, float(vColor.g) / 255.0, float(vColor.b) / 255.0));");src.push("float opacity = float(vColor.a) / 255.0;");src.push("vec3 baseColor = rgb;");src.push("float specularF0 = 1.0;");src.push("float metallic = float(vMetallicRoughness.r) / 255.0;");src.push("float roughness = float(vMetallicRoughness.g) / 255.0;");src.push("float dielectricSpecular = 0.16 * specularF0 * specularF0;");src.push("vec4 colorTexel = sRGBToLinear(texture(uColorMap, vUV));");src.push("baseColor *= colorTexel.rgb;");// src.push("opacity = colorTexel.a;");
15099
15099
  src.push("vec3 metalRoughTexel = texture(uMetallicRoughMap, vUV).rgb;");src.push("metallic *= metalRoughTexel.b;");src.push("roughness *= metalRoughTexel.g;");src.push("vec3 viewNormal = perturbNormal2Arb( vViewPosition.xyz, normalize(vViewNormal), vUV );");src.push("material.diffuseColor = baseColor * (1.0 - dielectricSpecular) * (1.0 - metallic);");src.push("material.specularRoughness = clamp(roughness, 0.04, 1.0);");src.push("material.specularColor = mix(vec3(dielectricSpecular), baseColor, metallic);");src.push("geometry.position = vViewPosition.xyz;");src.push("geometry.viewNormal = -normalize(viewNormal);");src.push("geometry.viewEyeDir = normalize(vViewPosition.xyz);");if(lightsState.lightMaps.length>0){src.push("geometry.worldNormal = normalize(vWorldNormal);");}if(lightsState.lightMaps.length>0||lightsState.reflectionMaps.length>0){src.push("computePBRLightMapping(geometry, material, reflectedLight);");}for(var _i248=0,_len55=lightsState.lights.length;_i248<_len55;_i248++){var _light8=lightsState.lights[_i248];if(_light8.type==="ambient"){continue;}if(_light8.type==="dir"){if(_light8.space==="view"){src.push("light.direction = normalize(lightDir"+_i248+");");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightDir"+_i248+", 0.0)).xyz);");}}else if(_light8.type==="point"){if(_light8.space==="view"){src.push("light.direction = normalize(lightPos"+_i248+" - vViewPosition.xyz);");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightPos"+_i248+", 0.0)).xyz);");}}else if(_light8.type==="spot"){if(_light8.space==="view"){src.push("light.direction = normalize(lightDir"+_i248+");");}else{src.push("light.direction = normalize((viewMatrix * vec4(lightDir"+_i248+", 0.0)).xyz);");}}else{continue;}src.push("light.color = lightColor"+_i248+".rgb * lightColor"+_i248+".a;");// a is intensity
15100
15100
  src.push("computePBRLighting(light, geometry, material, reflectedLight);");}src.push("vec3 emissiveColor = sRGBToLinear(texture(uEmissiveMap, vUV)).rgb;");// TODO: correct gamma function
15101
15101
  src.push("vec3 outgoingLight = (lightAmbient.rgb * lightAmbient.a * baseColor * opacity * rgb) + (reflectedLight.diffuse) + (reflectedLight.specular) + emissiveColor;");src.push("vec4 fragColor;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15102
15102
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
15103
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" fragColor = vec4(outgoingLight.rgb * ambient, opacity);");}else{src.push(" fragColor = vec4(outgoingLight.rgb, opacity);");}if(gammaOutput){src.push("fragColor = linearToGamma(fragColor, gammaFactor);");}src.push("outColor = fragColor;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15103
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" fragColor = vec4(outgoingLight.rgb * ambient, opacity);");}else{src.push(" fragColor = vec4(outgoingLight.rgb, opacity);");}if(gammaOutput){src.push("fragColor = linearToGamma(fragColor, gammaFactor);");}src.push("outColor = fragColor;");src.push("outColor.rgb *= brightness;");if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);/**
15104
15104
  * @private
15105
15105
  */var TrianglesPickNormalsFlatRenderer=/*#__PURE__*/function(_TrianglesInstancingR13){function TrianglesPickNormalsFlatRenderer(){_classCallCheck(this,TrianglesPickNormalsFlatRenderer);return _callSuper(this,TrianglesPickNormalsFlatRenderer,arguments);}_inherits(TrianglesPickNormalsFlatRenderer,_TrianglesInstancingR13);return _createClass(TrianglesPickNormalsFlatRenderer,[{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry normals vertex shader");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
15106
15106
  src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");src.push("uniform bool pickInvisible;");this._addMatricesUniformBlockLines(src);this._addRemapClipPosLines(src,3);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;");}if(clipping){src.push("out float vFlags;");}src.push("out vec4 vWorldPosition;");src.push("void main(void) {");// pickFlag = NOT_RENDERED | PICK
@@ -15113,9 +15113,9 @@ src.push("in vec4 modelMatrixCol1;");src.push("in vec4 modelMatrixCol2;");this._
15113
15113
  // renderPass = COLOR_OPAQUE | COLOR_TRANSPARENT
15114
15114
  src.push("int colorFlag = int(flags) & 0xF;");src.push("if (colorFlag != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
15115
15115
  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("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vViewPosition = viewPosition;");src.push("vColor = vec4(float(color.r) / 255.0, float(color.g) / 255.0, float(color.b) / 255.0, float(color.a) / 255.0);");src.push("vUV = (uvDecodeMatrix * vec3(uv, 1.0)).xy;");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags = flags;");}src.push("gl_Position = clipPos;");src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var gammaOutput=scene.gammaOutput;// If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is false.
15116
- var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var i;var len;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing 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 sampler2D uColorMap;");if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}src.push("uniform float gammaFactor;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i250=0,_len56=sectionPlanesState.getNumAllocatedSectionPlanes();_i250<_len56;_i250++){src.push("uniform bool sectionPlaneActive"+_i250+";");src.push("uniform vec3 sectionPlanePos"+_i250+";");src.push("uniform vec3 sectionPlaneDir"+_i250+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){var light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");src.push("out vec4 outColor;");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 _i251=0,_len57=sectionPlanesState.getNumAllocatedSectionPlanes();_i251<_len57;_i251++){src.push("if (sectionPlaneActive"+_i251+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i251+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i251+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(i=0,len=lightsState.lights.length;i<len;i++){var _light9=lightsState.lights[i];if(_light9.type==="ambient"){continue;}if(_light9.type==="dir"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(_light9.type==="point"){if(_light9.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(_light9.type==="spot"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(gammaOutput){src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");}else{src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");}src.push("float opacity = color.a;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15116
+ var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var i;var len;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// Instancing geometry drawing 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 sampler2D uColorMap;");if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}src.push("uniform float gammaFactor;");src.push("uniform float brightness;");src.push("vec4 linearToLinear( in vec4 value ) {");src.push(" return value;");src.push("}");src.push("vec4 sRGBToLinear( in vec4 value ) {");src.push(" return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.w );");src.push("}");src.push("vec4 gammaToLinear( in vec4 value) {");src.push(" return vec4( pow( value.xyz, vec3( gammaFactor ) ), value.w );");src.push("}");if(gammaOutput){src.push("vec4 linearToGamma( in vec4 value, in float gammaFactor ) {");src.push(" return vec4( pow( value.xyz, vec3( 1.0 / gammaFactor ) ), value.w );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in float vFlags;");for(var _i250=0,_len56=sectionPlanesState.getNumAllocatedSectionPlanes();_i250<_len56;_i250++){src.push("uniform bool sectionPlaneActive"+_i250+";");src.push("uniform vec3 sectionPlanePos"+_i250+";");src.push("uniform vec3 sectionPlaneDir"+_i250+";");}}this._addMatricesUniformBlockLines(src);src.push("uniform vec4 lightAmbient;");for(i=0,len=lightsState.lights.length;i<len;i++){var light=lightsState.lights[i];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+i+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+i+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+i+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+i+";");src.push("uniform vec3 lightDir"+i+";");}}src.push("in vec4 vViewPosition;");src.push("in vec4 vColor;");src.push("in vec2 vUV;");src.push("out vec4 outColor;");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 _i251=0,_len57=sectionPlanesState.getNumAllocatedSectionPlanes();_i251<_len57;_i251++){src.push("if (sectionPlaneActive"+_i251+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i251+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i251+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");src.push("vec3 xTangent = dFdx( vViewPosition.xyz );");src.push("vec3 yTangent = dFdy( vViewPosition.xyz );");src.push("vec3 viewNormal = normalize( cross( xTangent, yTangent ) );");for(i=0,len=lightsState.lights.length;i<len;i++){var _light9=lightsState.lights[i];if(_light9.type==="ambient"){continue;}if(_light9.type==="dir"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else if(_light9.type==="point"){if(_light9.space==="view"){src.push("viewLightDir = -normalize(lightPos"+i+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+i+", 0.0)).xyz);");}}else if(_light9.type==="spot"){if(_light9.space==="view"){src.push("viewLightDir = normalize(lightDir"+i+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+i+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+i+".rgb * lightColor"+i+".a);");}src.push("vec4 color = vec4((lightAmbient.rgb * lightAmbient.a * vColor.rgb) + (reflectedColor * vColor.rgb), vColor.a);");if(gammaOutput){src.push("vec4 colorTexel = color * sRGBToLinear(texture(uColorMap, vUV));");}else{src.push("vec4 colorTexel = color * texture(uColorMap, vUV);");}src.push("float opacity = color.a;");if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
15117
15117
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
15118
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb, opacity);");}if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);var tempVec3a$v=math.vec3();var tempVec3b$t=math.vec3();var tempVec3c$o=math.vec3();var tempVec3d$9=math.vec3();var tempMat4a$o=math.mat4();/**
15118
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb * ambient, opacity);");}else{src.push(" outColor = vec4(vColor.rgb * colorTexel.rgb, opacity);");}src.push("outColor.rgb *= brightness;");if(gammaOutput){src.push("outColor = linearToGamma(outColor, gammaFactor);");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push("}");return src;}}]);}(TrianglesInstancingRenderer);var tempVec3a$v=math.vec3();var tempVec3b$t=math.vec3();var tempVec3c$o=math.vec3();var tempVec3d$9=math.vec3();var tempMat4a$o=math.mat4();/**
15119
15119
  * @private
15120
15120
  */var TrianglesSnapInitRenderer=/*#__PURE__*/function(_VBORenderer5){function TrianglesSnapInitRenderer(scene){_classCallCheck(this,TrianglesSnapInitRenderer);return _callSuper(this,TrianglesSnapInitRenderer,[scene,false,{instancing:true}]);}_inherits(TrianglesSnapInitRenderer,_VBORenderer5);return _createClass(TrianglesSnapInitRenderer,[{key:"drawLayer",value:function drawLayer(frameCtx,instancingLayer,renderPass){if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram();}var model=instancingLayer.model;var scene=model.scene;var gl=scene.canvas.gl;var camera=scene.camera;var state=instancingLayer._state;var origin=instancingLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;var aabb=instancingLayer.aabb;// Per-layer AABB for best RTC accuracy
15121
15121
  var viewMatrix=frameCtx.pickViewMatrix||camera.viewMatrix;if(this._vaoCache.has(instancingLayer)){gl.bindVertexArray(this._vaoCache.get(instancingLayer));}else{this._vaoCache.set(instancingLayer,this._makeVAO(state));}var coordinateScaler=tempVec3a$v;coordinateScaler[0]=math.safeInv(aabb[3]-aabb[0])*math.MAX_INT;coordinateScaler[1]=math.safeInv(aabb[4]-aabb[1])*math.MAX_INT;coordinateScaler[2]=math.safeInv(aabb[5]-aabb[2])*math.MAX_INT;frameCtx.snapPickCoordinateScale[0]=math.safeInv(coordinateScaler[0]);frameCtx.snapPickCoordinateScale[1]=math.safeInv(coordinateScaler[1]);frameCtx.snapPickCoordinateScale[2]=math.safeInv(coordinateScaler[2]);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3b$t;if(origin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3c$o);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$o);rtcCameraEye=tempVec3d$9;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];frameCtx.snapPickOrigin[0]=rtcOrigin[0];frameCtx.snapPickOrigin[1]=rtcOrigin[1];frameCtx.snapPickOrigin[2]=rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;frameCtx.snapPickOrigin[0]=0;frameCtx.snapPickOrigin[1]=0;frameCtx.snapPickOrigin[2]=0;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform2fv(this.uVectorA,frameCtx.snapVectorA);gl.uniform2fv(this.uInverseVectorAB,frameCtx.snapInvVectorAB);gl.uniform1i(this._uLayerNumber,frameCtx.snapPickLayerNumber);gl.uniform3fv(this._uCoordinateScaler,coordinateScaler);gl.uniform1i(this._uRenderPass,renderPass);gl.uniform1i(this._uPickInvisible,frameCtx.pickInvisible);var offset=0;var mat4Size=4*4;this._matricesUniformBlockBufferData.set(rotationMatrixConjugate,0);this._matricesUniformBlockBufferData.set(rtcViewMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(camera.projMatrix,offset+=mat4Size);this._matricesUniformBlockBufferData.set(state.positionsDecodeMatrix,offset+=mat4Size);gl.bindBuffer(gl.UNIFORM_BUFFER,this._matricesUniformBlockBuffer);gl.bufferData(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferData,gl.DYNAMIC_DRAW);gl.bindBufferBase(gl.UNIFORM_BUFFER,this._matricesUniformBlockBufferBindingPoint,this._matricesUniformBlockBuffer);{var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}this.setSectionPlanesStateUniforms(instancingLayer);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);if(this._aFlags){this._aFlags.bindArrayBuffer(state.flagsBuf);gl.vertexAttribDivisor(this._aFlags.location,1);}state.indicesBuf.bind();gl.drawElementsInstanced(gl.TRIANGLES,state.indicesBuf.numItems,state.indicesBuf.itemType,0,state.numInstances);state.indicesBuf.unbind();// Cleanup
@@ -16060,10 +16060,10 @@ gl.RGBA,gl.FLOAT,tempMat4a$d);// gl.bindTexture (gl.TEXTURE_2D, null);
16060
16060
  // }
16061
16061
  }},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(renderFlags,frameCtx){}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(renderFlags,frameCtx){}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(renderFlags,frameCtx){}},{key:"drawEdgesSelected",value:function drawEdgesSelected(renderFlags,frameCtx){}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(renderFlags,frameCtx){}},{key:"drawOcclusion",value:function drawOcclusion(renderFlags,frameCtx){}},{key:"drawShadow",value:function drawShadow(renderFlags,frameCtx){}},{key:"setPickMatrices",value:function setPickMatrices(pickViewMatrix,pickProjMatrix){}},{key:"drawPickMesh",value:function drawPickMesh(renderFlags,frameCtx){}},{key:"drawPickDepths",value:function drawPickDepths(renderFlags,frameCtx){}},{key:"drawSnapInit",value:function drawSnapInit(renderFlags,frameCtx){}},{key:"drawSnap",value:function drawSnap(renderFlags,frameCtx){}},{key:"drawPickNormals",value:function drawPickNormals(renderFlags,frameCtx){}},{key:"destroy",value:function destroy(){if(this._destroyed){return;}var state=this._state;this.model.scene.off(this._onSceneRendering);state.destroy();this._destroyed=true;}}]);}();var tempVec3a$j=math.vec3();var tempVec3b$h=math.vec3();var tempVec3c$d=math.vec3();math.vec3();var tempVec4a$3=math.vec4();var tempMat4a$c=math.mat4();/**
16062
16062
  * @private
16063
- */var DTXTrianglesColorRenderer=/*#__PURE__*/function(){function DTXTrianglesColorRenderer(scene,withSAO){_classCallCheck(this,DTXTrianglesColorRenderer);this._scene=scene;this._withSAO=withSAO;this._hash=this._getHash();this._allocate();}return _createClass(DTXTrianglesColorRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){var scene=this._scene;var camera=scene.camera;var model=dataTextureLayer.model;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx,state);}textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$j;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3b$h);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(camera.viewMatrix,rtcOrigin,tempMat4a$c);rtcCameraEye=tempVec3c$d;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=camera.viewMatrix;rtcCameraEye=camera.eye;}gl.uniformMatrix4fv(this._uSceneModelMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var _sectionPlane14=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(_sectionPlane14.dist,_sectionPlane14.dir,origin,tempVec3a$j,model.matrix);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,_sectionPlane14.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,_sectionPlane14.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
16063
+ */var DTXTrianglesColorRenderer=/*#__PURE__*/function(){function DTXTrianglesColorRenderer(scene,withSAO){_classCallCheck(this,DTXTrianglesColorRenderer);this._scene=scene;this._withSAO=withSAO;this._hash=this._getHash();this._allocate();}return _createClass(DTXTrianglesColorRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){var scene=this._scene;var camera=scene.camera;var model=dataTextureLayer.model;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx,state);}textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$j;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3b$h);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(camera.viewMatrix,rtcOrigin,tempMat4a$c);rtcCameraEye=tempVec3c$d;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=camera.viewMatrix;rtcCameraEye=camera.eye;}gl.uniformMatrix4fv(this._uSceneModelMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);if(this._uBrightness){gl.uniform1f(this._uBrightness,model._brightness!==undefined?model._brightness:1.0);}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var _sectionPlane14=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(_sectionPlane14.dist,_sectionPlane14.dir,origin,tempVec3a$j,model.matrix);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,_sectionPlane14.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,_sectionPlane14.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
16064
16064
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices
16065
16065
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices16Bits);}if(state.numIndices32Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32// 32 bits indices
16066
- );gl.drawArrays(gl.TRIANGLES,0,state.numIndices32Bits);}frameCtx.drawElements++;}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;var lightsState=scene._lightsState;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;console.error(this.errors);return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];var lights=lightsState.lights;var light;for(var _i335=0,len=lights.length;_i335<len;_i335++){light=lights[_i335];switch(light.type){case"dir":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=null;this._uLightDir[_i335]=program.getLocation("lightDir"+_i335);break;case"point":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=program.getLocation("lightPos"+_i335);this._uLightDir[_i335]=null;this._uLightAttenuation[_i335]=program.getLocation("lightAttenuation"+_i335);break;case"spot":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=program.getLocation("lightPos"+_i335);this._uLightDir[_i335]=program.getLocation("lightDir"+_i335);this._uLightAttenuation[_i335]=program.getLocation("lightAttenuation"+_i335);break;}}this._uSceneModelMatrix=program.getLocation("sceneModelMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i336=0,_len72=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i336<_len72;_i336++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i336),pos:program.getLocation("sectionPlanePos"+_i336),dir:program.getLocation("sectionPlaneDir"+_i336)});}if(this._withSAO){this._uOcclusionTexture="uOcclusionTexture";this._uSAOParams=program.getLocation("uSAOParams");}if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uTexturePerObjectPositionsDecodeMatrix="uObjectPerObjectPositionsDecodeMatrix";this.uTexturePerObjectColorsAndFlags="uObjectPerObjectColorsAndFlags";this._uTexturePerVertexIdCoordinates="uTexturePerVertexIdCoordinates";this._uTexturePerPolygonIdNormals="uTexturePerPolygonIdNormals";this._uTexturePerPolygonIdIndices="uTexturePerPolygonIdIndices";this._uTexturePerPolygonIdPortionIds="uTexturePerPolygonIdPortionIds";this._uTexturePerObjectMatrix="uTexturePerObjectMatrix";this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");}},{key:"_bindProgram",value:function _bindProgram(frameCtx){var scene=this._scene;var gl=scene.canvas.gl;var program=this._program;var lights=scene._lightsState.lights;var project=scene.camera.project;program.bind();if(this._uLightAmbient){gl.uniform4fv(this._uLightAmbient,scene._lightsState.getAmbientColorAndIntensity());}for(var _i337=0,len=lights.length;_i337<len;_i337++){var light=lights[_i337];if(this._uLightColor[_i337]){gl.uniform4f(this._uLightColor[_i337],light.color[0],light.color[1],light.color[2],light.intensity);}if(this._uLightPos[_i337]){gl.uniform3fv(this._uLightPos[_i337],light.pos);if(this._uLightAttenuation[_i337]){gl.uniform1f(this._uLightAttenuation[_i337],light.attenuation);}}if(this._uLightDir[_i337]){gl.uniform3fv(this._uLightDir[_i337],light.dir);}}if(this._withSAO){var sao=scene.sao;var saoEnabled=sao.possible;if(saoEnabled){var viewportWidth=gl.drawingBufferWidth;var viewportHeight=gl.drawingBufferHeight;tempVec4a$3[0]=viewportWidth;tempVec4a$3[1]=viewportHeight;tempVec4a$3[2]=sao.blendCutoff;tempVec4a$3[3]=sao.blendFactor;gl.uniform4fv(this._uSAOParams,tempVec4a$3);this._program.bindTexture(this._uOcclusionTexture,frameCtx.occlusionTexture,10);}}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(project.far+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}}},{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 lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer 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("uniform mat4 sceneModelMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");src.push("uniform highp sampler2D uTexturePerObjectMatrix;");src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");src.push("uniform vec3 uCameraEyeRtc;");src.push("vec3 positions[3];");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("uniform vec4 lightAmbient;");for(var _i338=0,len=lightsState.lights.length;_i338<len;_i338++){light=lightsState.lights[_i338];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i338+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i338+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i338+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i338+";");src.push("uniform vec3 lightDir"+_i338+";");}}if(clipping){src.push("out vec4 vWorldPosition;");src.push("flat out uint vFlags2;");}src.push("out vec4 vColor;");src.push("void main(void) {");// constants
16066
+ );gl.drawArrays(gl.TRIANGLES,0,state.numIndices32Bits);}frameCtx.drawElements++;}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;var lightsState=scene._lightsState;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;console.error(this.errors);return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];var lights=lightsState.lights;var light;for(var _i335=0,len=lights.length;_i335<len;_i335++){light=lights[_i335];switch(light.type){case"dir":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=null;this._uLightDir[_i335]=program.getLocation("lightDir"+_i335);break;case"point":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=program.getLocation("lightPos"+_i335);this._uLightDir[_i335]=null;this._uLightAttenuation[_i335]=program.getLocation("lightAttenuation"+_i335);break;case"spot":this._uLightColor[_i335]=program.getLocation("lightColor"+_i335);this._uLightPos[_i335]=program.getLocation("lightPos"+_i335);this._uLightDir[_i335]=program.getLocation("lightDir"+_i335);this._uLightAttenuation[_i335]=program.getLocation("lightAttenuation"+_i335);break;}}this._uSceneModelMatrix=program.getLocation("sceneModelMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i336=0,_len72=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i336<_len72;_i336++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i336),pos:program.getLocation("sectionPlanePos"+_i336),dir:program.getLocation("sectionPlaneDir"+_i336)});}if(this._withSAO){this._uOcclusionTexture="uOcclusionTexture";this._uSAOParams=program.getLocation("uSAOParams");}if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uTexturePerObjectPositionsDecodeMatrix="uObjectPerObjectPositionsDecodeMatrix";this.uTexturePerObjectColorsAndFlags="uObjectPerObjectColorsAndFlags";this._uTexturePerVertexIdCoordinates="uTexturePerVertexIdCoordinates";this._uTexturePerPolygonIdNormals="uTexturePerPolygonIdNormals";this._uTexturePerPolygonIdIndices="uTexturePerPolygonIdIndices";this._uTexturePerPolygonIdPortionIds="uTexturePerPolygonIdPortionIds";this._uTexturePerObjectMatrix="uTexturePerObjectMatrix";this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");this._uBrightness=program.getLocation("brightness");}},{key:"_bindProgram",value:function _bindProgram(frameCtx){var scene=this._scene;var gl=scene.canvas.gl;var program=this._program;var lights=scene._lightsState.lights;var project=scene.camera.project;program.bind();if(this._uLightAmbient){gl.uniform4fv(this._uLightAmbient,scene._lightsState.getAmbientColorAndIntensity());}for(var _i337=0,len=lights.length;_i337<len;_i337++){var light=lights[_i337];if(this._uLightColor[_i337]){gl.uniform4f(this._uLightColor[_i337],light.color[0],light.color[1],light.color[2],light.intensity);}if(this._uLightPos[_i337]){gl.uniform3fv(this._uLightPos[_i337],light.pos);if(this._uLightAttenuation[_i337]){gl.uniform1f(this._uLightAttenuation[_i337],light.attenuation);}}if(this._uLightDir[_i337]){gl.uniform3fv(this._uLightDir[_i337],light.dir);}}if(this._withSAO){var sao=scene.sao;var saoEnabled=sao.possible;if(saoEnabled){var viewportWidth=gl.drawingBufferWidth;var viewportHeight=gl.drawingBufferHeight;tempVec4a$3[0]=viewportWidth;tempVec4a$3[1]=viewportHeight;tempVec4a$3[2]=sao.blendCutoff;tempVec4a$3[3]=sao.blendFactor;gl.uniform4fv(this._uSAOParams,tempVec4a$3);this._program.bindTexture(this._uOcclusionTexture,frameCtx.occlusionTexture,10);}}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(project.far+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}}},{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 lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer 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("uniform mat4 sceneModelMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");src.push("uniform highp sampler2D uTexturePerObjectMatrix;");src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");src.push("uniform vec3 uCameraEyeRtc;");src.push("vec3 positions[3];");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("uniform vec4 lightAmbient;");for(var _i338=0,len=lightsState.lights.length;_i338<len;_i338++){light=lightsState.lights[_i338];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i338+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i338+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i338+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i338+";");src.push("uniform vec3 lightDir"+_i338+";");}}if(clipping){src.push("out vec4 vWorldPosition;");src.push("flat out uint vFlags2;");}src.push("out vec4 vColor;");src.push("void main(void) {");// constants
16067
16067
  src.push("int polygonIndex = gl_VertexID / 3;");// get packed object-id
16068
16068
  src.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;");src.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;");src.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);");src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");// get flags & flags2
16069
16069
  src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");// flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
@@ -16074,10 +16074,10 @@ src.push("} else {");src.push("ivec4 packedVertexBase = ivec4(texelFetch (uObjec
16074
16074
  src.push(" return;");src.push("};");src.push("vec3 normal = normalize(cross(positions[2] - positions[0], positions[1] - positions[0]));");src.push("vec3 position;");src.push("position = positions[gl_VertexID % 3];");src.push("vec3 viewNormal = -normalize((transpose(inverse(viewMatrix*objectDecodeAndInstanceMatrix)) * vec4(normal,1)).xyz);");// when the geometry is not solid, if needed, flip the triangle winding
16075
16075
  src.push("if (solid != 1u) {");src.push("if (isPerspectiveMatrix(projMatrix)) {");src.push("vec3 uCameraEyeRtcInQuantizedSpace = (inverse(sceneModelMatrix * objectDecodeAndInstanceMatrix) * vec4(uCameraEyeRtc, 1)).xyz;");// src.push("vColor = vec4(vec3(1, -1, 0)*dot(normalize(position.xyz - uCameraEyeRtcInQuantizedSpace), normal), 1);")
16076
16076
  src.push("if (dot(position.xyz - uCameraEyeRtcInQuantizedSpace, normal) < 0.0) {");src.push("position = positions[2 - (gl_VertexID % 3)];");src.push("viewNormal = -viewNormal;");src.push("}");src.push("} else {");// src.push("vColor = vec4(vec3(1, -1, 0)*viewNormal.z, 1);")
16077
- src.push("if (viewNormal.z < 0.0) {");src.push("position = positions[2 - (gl_VertexID % 3)];");src.push("viewNormal = -viewNormal;");src.push("}");src.push("}");src.push("}");src.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); ");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i339=0,_len73=lightsState.lights.length;_i339<_len73;_i339++){light=lightsState.lights[_i339];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i339+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i339+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i339+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i339+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i339+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i339+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i339+".rgb * lightColor"+_i339+".a);");}src.push("vec3 rgb = vec3(color.rgb) / 255.0;");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags2 = flags2.r;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i340=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i340<len;_i340++){src.push("uniform bool sectionPlaneActive"+_i340+";");src.push("uniform vec3 sectionPlanePos"+_i340+";");src.push("uniform vec3 sectionPlaneDir"+_i340+";");}}src.push("in vec4 vColor;");src.push("out vec4 outColor;");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 _i341=0,_len74=sectionPlanesState.getNumAllocatedSectionPlanes();_i341<_len74;_i341++){src.push("if (sectionPlaneActive"+_i341+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i341+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i341+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");//src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
16077
+ src.push("if (viewNormal.z < 0.0) {");src.push("position = positions[2 - (gl_VertexID % 3)];");src.push("viewNormal = -viewNormal;");src.push("}");src.push("}");src.push("}");src.push("vec4 worldPosition = sceneModelMatrix * ((objectDecodeAndInstanceMatrix * vec4(position, 1.0))); ");src.push("vec4 viewPosition = viewMatrix * worldPosition; ");src.push("vec3 reflectedColor = vec3(0.0, 0.0, 0.0);");src.push("vec3 viewLightDir = vec3(0.0, 0.0, -1.0);");src.push("float lambertian = 1.0;");for(var _i339=0,_len73=lightsState.lights.length;_i339<_len73;_i339++){light=lightsState.lights[_i339];if(light.type==="ambient"){continue;}if(light.type==="dir"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i339+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i339+", 0.0)).xyz);");}}else if(light.type==="point"){if(light.space==="view"){src.push("viewLightDir = -normalize(lightPos"+_i339+" - viewPosition.xyz);");}else{src.push("viewLightDir = -normalize((viewMatrix * vec4(lightPos"+_i339+", 0.0)).xyz);");}}else if(light.type==="spot"){if(light.space==="view"){src.push("viewLightDir = normalize(lightDir"+_i339+");");}else{src.push("viewLightDir = normalize((viewMatrix * vec4(lightDir"+_i339+", 0.0)).xyz);");}}else{continue;}src.push("lambertian = max(dot(-viewNormal, viewLightDir), 0.0);");src.push("reflectedColor += lambertian * (lightColor"+_i339+".rgb * lightColor"+_i339+".a);");}src.push("vec3 rgb = vec3(color.rgb) / 255.0;");src.push("vColor = vec4((lightAmbient.rgb * lightAmbient.a * rgb) + (reflectedColor * rgb), float(color.a) / 255.0);");src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");src.push("isPerspective = float (isPerspectiveMatrix(projMatrix));");}if(clipping){src.push("vWorldPosition = worldPosition;");src.push("vFlags2 = flags2.r;");}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.getNumAllocatedSectionPlanes()>0;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer 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;");}if(this._withSAO){src.push("uniform sampler2D uOcclusionTexture;");src.push("uniform vec4 uSAOParams;");src.push("const float packUpscale = 256. / 255.;");src.push("const float unpackDownScale = 255. / 256.;");src.push("const vec3 packFactors = vec3( 256. * 256. * 256., 256. * 256., 256. );");src.push("const vec4 unPackFactors = unpackDownScale / vec4( packFactors, 1. );");src.push("float unpackRGBToFloat( const in vec4 v ) {");src.push(" return dot( v, unPackFactors );");src.push("}");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("flat in uint vFlags2;");for(var _i340=0,len=sectionPlanesState.getNumAllocatedSectionPlanes();_i340<len;_i340++){src.push("uniform bool sectionPlaneActive"+_i340+";");src.push("uniform vec3 sectionPlanePos"+_i340+";");src.push("uniform vec3 sectionPlaneDir"+_i340+";");}}src.push("in vec4 vColor;");src.push("uniform float brightness;");src.push("out vec4 outColor;");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 _i341=0,_len74=sectionPlanesState.getNumAllocatedSectionPlanes();_i341<_len74;_i341++){src.push("if (sectionPlaneActive"+_i341+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i341+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i341+".xyz), 0.0, 1000.0);");src.push("}");}src.push(" if (dist > 0.0) { ");src.push(" discard;");src.push(" }");src.push("}");}if(scene.logarithmicDepthBufferEnabled){src.push(" gl_FragDepth = isPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;");//src.push(" gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");
16078
16078
  }if(this._withSAO){// Doing SAO blend in the main solid fill draw shader just so that edge lines can be drawn over the top
16079
16079
  // Would be more efficient to defer this, then render lines later, using same depth buffer for Z-reject
16080
- src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient, 1.0);");}else{src.push(" outColor = vColor;");}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;}}]);}();var defaultColor$1=new Float32Array([1,1,1]);var tempVec3a$i=math.vec3();var tempVec3b$g=math.vec3();var tempVec3c$c=math.vec3();math.vec3();var tempMat4a$b=math.mat4();/**
16080
+ src.push(" float viewportWidth = uSAOParams[0];");src.push(" float viewportHeight = uSAOParams[1];");src.push(" float blendCutoff = uSAOParams[2];");src.push(" float blendFactor = uSAOParams[3];");src.push(" vec2 uv = vec2(gl_FragCoord.x / viewportWidth, gl_FragCoord.y / viewportHeight);");src.push(" float ambient = smoothstep(blendCutoff, 1.0, unpackRGBToFloat(texture(uOcclusionTexture, uv))) * blendFactor;");src.push(" outColor = vec4(vColor.rgb * ambient * brightness, 1.0);");}else{src.push(" outColor = vec4(vColor.rgb * brightness, vColor.a);");}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;}}]);}();var defaultColor$1=new Float32Array([1,1,1]);var tempVec3a$i=math.vec3();var tempVec3b$g=math.vec3();var tempVec3c$c=math.vec3();math.vec3();var tempMat4a$b=math.mat4();/**
16081
16081
  * @private
16082
16082
  */var DTXTrianglesSilhouetteRenderer=/*#__PURE__*/function(){function DTXTrianglesSilhouetteRenderer(scene,primitiveType){_classCallCheck(this,DTXTrianglesSilhouetteRenderer);this._scene=scene;this._hash=this._getHash();this._allocate();}return _createClass(DTXTrianglesSilhouetteRenderer,[{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 scene=this._scene;var camera=scene.camera;var model=dataTextureLayer.model;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;var viewMatrix=camera.viewMatrix;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx,state);}textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;if(origin||position[0]!==0||position[1]!==0||position[2]!==0){var rtcOrigin=tempVec3a$i;if(origin){var rotatedOrigin=tempVec3b$g;math.transformPoint3(rotationMatrix,origin,rotatedOrigin);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(viewMatrix,rtcOrigin,tempMat4a$b);rtcCameraEye=tempVec3c$c;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=viewMatrix;rtcCameraEye=camera.eye;}gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);gl.uniformMatrix4fv(this._uWorldMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);if(renderPass===RENDER_PASSES.SILHOUETTE_XRAYED){var material=scene.xrayMaterial._state;var fillColor=material.fillColor;var fillAlpha=material.fillAlpha;gl.uniform4f(this._uColor,fillColor[0],fillColor[1],fillColor[2],fillAlpha);}else if(renderPass===RENDER_PASSES.SILHOUETTE_HIGHLIGHTED){var _material3=scene.highlightMaterial._state;var _fillColor=_material3.fillColor;var _fillAlpha=_material3.fillAlpha;gl.uniform4f(this._uColor,_fillColor[0],_fillColor[1],_fillColor[2],_fillAlpha);}else if(renderPass===RENDER_PASSES.SILHOUETTE_SELECTED){var _material4=scene.selectedMaterial._state;var _fillColor2=_material4.fillColor;var _fillAlpha2=_material4.fillAlpha;gl.uniform4f(this._uColor,_fillColor2[0],_fillColor2[1],_fillColor2[2],_fillAlpha2);}else{gl.uniform4fv(this._uColor,defaultColor$1);}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var _sectionPlane15=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(_sectionPlane15.dist,_sectionPlane15.dir,origin,tempVec3a$i,model.matrix);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,_sectionPlane15.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,_sectionPlane15.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
16083
16083
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices
@@ -18309,7 +18309,11 @@ _this76._textures={};_this76._textureSets={};_this76._transforms={};_this76._mes
18309
18309
  */_this76.numClippableLayerPortions=0;/**
18310
18310
  * @private
18311
18311
  */_this76.numCulledLayerPortions=0;_this76.numEntities=0;_this76._numTriangles=0;_this76._numLines=0;_this76._numPoints=0;_this76._layersFinalized=false;_this76._edgeThreshold=cfg.edgeThreshold||10;// Build static matrix
18312
- _this76._origin=math.vec3(cfg.origin||[0,0,0]);_this76._position=math.vec3(cfg.position||[0,0,0]);_this76._rotation=math.vec3(cfg.rotation||[0,0,0]);_this76._quaternion=math.vec4(cfg.quaternion||[0,0,0,1]);_this76._conjugateQuaternion=math.vec4(cfg.quaternion||[0,0,0,1]);if(cfg.rotation){math.eulerToQuaternion(_this76._rotation,"XYZ",_this76._quaternion);}_this76._scale=math.vec3(cfg.scale||[1,1,1]);_this76._worldRotationMatrix=math.mat4();_this76._worldRotationMatrixConjugate=math.mat4();_this76._matrix=math.mat4();_this76._matrixDirty=true;_this76._rebuildMatrices();_this76._worldNormalMatrix=math.mat4();math.inverseMat4(_this76._matrix,_this76._worldNormalMatrix);math.transposeMat4(_this76._worldNormalMatrix);if(cfg.matrix||cfg.position||cfg.rotation||cfg.scale||cfg.quaternion){_this76._viewMatrix=math.mat4();_this76._viewNormalMatrix=math.mat4();_this76._viewMatrixDirty=true;_this76._matrixNonIdentity=true;}_this76._opacity=1.0;_this76._colorize=[1,1,1];_this76._saoEnabled=cfg.saoEnabled!==false;_this76._pbrEnabled=cfg.pbrEnabled!==false;_this76._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this76._isModel=cfg.isModel;if(_this76._isModel){_this76.scene._registerModel(_this76);}_this76._onCameraViewMatrix=_this76.scene.camera.on("matrix",function(){_this76._viewMatrixDirty=true;});_this76._meshesWithDirtyMatrices=[];_this76._numMeshesWithDirtyMatrices=0;_this76._onTick=_this76.scene.on("tick",function(){while(_this76._numMeshesWithDirtyMatrices>0){_this76._meshesWithDirtyMatrices[--_this76._numMeshesWithDirtyMatrices]._updateMatrix();}});_this76._createDefaultTextureSet();_this76.visible=cfg.visible;_this76.culled=cfg.culled;_this76.pickable=cfg.pickable;_this76.clippable=cfg.clippable;_this76.collidable=cfg.collidable;_this76.castsShadow=cfg.castsShadow;_this76.receivesShadow=cfg.receivesShadow;_this76.xrayed=cfg.xrayed;_this76.highlighted=cfg.highlighted;_this76.selected=cfg.selected;_this76.edges=cfg.edges;_this76.colorize=cfg.colorize;_this76.opacity=cfg.opacity;_this76.backfaces=cfg.backfaces;return _this76;}_inherits(SceneModel,_Component27);return _createClass(SceneModel,[{key:"_meshMatrixDirty",value:function _meshMatrixDirty(mesh){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=mesh;}},{key:"_createDefaultTextureSet",value:function _createDefaultTextureSet(){// Every SceneModelMesh gets at least the default TextureSet,
18312
+ _this76._origin=math.vec3(cfg.origin||[0,0,0]);_this76._position=math.vec3(cfg.position||[0,0,0]);_this76._rotation=math.vec3(cfg.rotation||[0,0,0]);_this76._quaternion=math.vec4(cfg.quaternion||[0,0,0,1]);_this76._conjugateQuaternion=math.vec4(cfg.quaternion||[0,0,0,1]);if(cfg.rotation){math.eulerToQuaternion(_this76._rotation,"XYZ",_this76._quaternion);}_this76._scale=math.vec3(cfg.scale||[1,1,1]);_this76._worldRotationMatrix=math.mat4();_this76._worldRotationMatrixConjugate=math.mat4();_this76._matrix=math.mat4();_this76._matrixDirty=true;_this76._rebuildMatrices();_this76._worldNormalMatrix=math.mat4();math.inverseMat4(_this76._matrix,_this76._worldNormalMatrix);math.transposeMat4(_this76._worldNormalMatrix);if(cfg.matrix||cfg.position||cfg.rotation||cfg.scale||cfg.quaternion){_this76._viewMatrix=math.mat4();_this76._viewNormalMatrix=math.mat4();_this76._viewMatrixDirty=true;_this76._matrixNonIdentity=true;}_this76._opacity=1.0;_this76._colorize=[1,1,1];/**
18313
+ * @private
18314
+ * Brightness factor for this SceneModel. Applied per-frame as a shader
18315
+ * uniform in the main color render passes (textured and untextured).
18316
+ */_this76._brightness=cfg.brightness!==undefined?cfg.brightness:1.0;_this76._saoEnabled=cfg.saoEnabled!==false;_this76._pbrEnabled=cfg.pbrEnabled!==false;_this76._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this76._isModel=cfg.isModel;if(_this76._isModel){_this76.scene._registerModel(_this76);}_this76._onCameraViewMatrix=_this76.scene.camera.on("matrix",function(){_this76._viewMatrixDirty=true;});_this76._meshesWithDirtyMatrices=[];_this76._numMeshesWithDirtyMatrices=0;_this76._onTick=_this76.scene.on("tick",function(){while(_this76._numMeshesWithDirtyMatrices>0){_this76._meshesWithDirtyMatrices[--_this76._numMeshesWithDirtyMatrices]._updateMatrix();}});_this76._createDefaultTextureSet();_this76.visible=cfg.visible;_this76.culled=cfg.culled;_this76.pickable=cfg.pickable;_this76.clippable=cfg.clippable;_this76.collidable=cfg.collidable;_this76.castsShadow=cfg.castsShadow;_this76.receivesShadow=cfg.receivesShadow;_this76.xrayed=cfg.xrayed;_this76.highlighted=cfg.highlighted;_this76.selected=cfg.selected;_this76.edges=cfg.edges;_this76.colorize=cfg.colorize;_this76.opacity=cfg.opacity;_this76.backfaces=cfg.backfaces;return _this76;}_inherits(SceneModel,_Component27);return _createClass(SceneModel,[{key:"_meshMatrixDirty",value:function _meshMatrixDirty(mesh){this._meshesWithDirtyMatrices[this._numMeshesWithDirtyMatrices++]=mesh;}},{key:"_createDefaultTextureSet",value:function _createDefaultTextureSet(){// Every SceneModelMesh gets at least the default TextureSet,
18313
18317
  // which contains empty default textures filled with color
18314
18318
  var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,texture:new Texture2D({gl:this.scene.canvas.gl,preloadColor:[1,1,1,1]// [r, g, b, a]})
18315
18319
  })});var defaultMetalRoughTexture=new SceneModelTexture({id:DEFAULT_METAL_ROUGH_TEXTURE_ID,texture:new Texture2D({gl:this.scene.canvas.gl,preloadColor:[0,1,1,1]// [unused, roughness, metalness, unused]
@@ -18642,6 +18646,21 @@ var defaultColorTexture=new SceneModelTexture({id:DEFAULT_COLOR_TEXTURE_ID,textu
18642
18646
  *
18643
18647
  * @type {Number}
18644
18648
  */,set:function set(opacity){this._opacity=opacity;for(var _i426=0,len=this._entityList.length;_i426<len;_i426++){this._entityList[_i426].opacity=opacity;}}/**
18649
+ * Gets the brightness factor for this SceneModel.
18650
+ *
18651
+ * A factor > 1 brightens the model, < 1 darkens. Default is ````1.0````.
18652
+ *
18653
+ * @type {Number}
18654
+ */},{key:"brightness",get:function get(){return this._brightness;}/**
18655
+ * Sets the brightness factor for this SceneModel.
18656
+ *
18657
+ * Multiplies by the rendered fragment colors of the model's main color render
18658
+ * passes, for both textured and untextured meshes. Applied in the render
18659
+ * pipeline, so it can be freely changed at any time. A factor > 1 brightens,
18660
+ * < 1 darkens. Default is ````1.0````.
18661
+ *
18662
+ * @type {Number}
18663
+ */,set:function set(brightness){if(brightness===this._brightness)return;this._brightness=brightness;this.glRedraw();}/**
18645
18664
  * Gets if this SceneModel casts a shadow.
18646
18665
  *
18647
18666
  * @type {Boolean}
@@ -20281,6 +20300,243 @@ case WAITING_FOR_TARGET_LONG_TOUCH_END:if(_this88.pointerLens){_this88.pointerLe
20281
20300
  *
20282
20301
  * Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
20283
20302
  */},{key:"destroy",value:function destroy(){this.deactivate();this._destroyMarkerDiv();_superPropGet(DistanceMeasurementsSimulateMouseControl,"destroy",this,3)([]);}}]);}(DistanceMeasurementsControl);/**
20303
+ * {@link Viewer} plugin that makes interaction smoother with large models, by temporarily switching
20304
+ * the Viewer to faster, lower-quality rendering modes whenever we interact.
20305
+ *
20306
+ * [<img src="https://xeokit.io/img/docs/FastNavPlugin/FastNavPlugin.gif">](https://xeokit.github.io/xeokit-sdk/examples/#performance_FastNavPlugin)
20307
+ *
20308
+ * FastNavPlugin works by hiding specified Viewer rendering features, and optionally scaling the Viewer's canvas
20309
+ * resolution, whenever we interact with the Viewer. Then, once we've finished interacting, FastNavPlugin restores those
20310
+ * rendering features and the original canvas scale, after a configured delay.
20311
+ *
20312
+ * Depending on how we configure FastNavPlugin, we essentially switch to a smooth-rendering low-quality view while
20313
+ * interacting, then return to the normal higher-quality view after we stop, following an optional delay.
20314
+ *
20315
+ * Down-scaling the canvas resolution gives particularly good results. For example, scaling by ````0.5```` means that
20316
+ * we're rendering a quarter of the pixels while interacting, which can make the Viewer noticeably smoother with big models.
20317
+ *
20318
+ * The screen capture above shows FastNavPlugin in action. In this example, whenever we move the Camera or resize the Canvas,
20319
+ * FastNavPlugin switches off enhanced edges and ambient shadows (SAO), and down-scales the canvas, making it slightly
20320
+ * blurry. When ````0.5```` seconds passes with no interaction, the plugin shows edges and SAO again, and restores the
20321
+ * original canvas scale.
20322
+ *
20323
+ * # Usage
20324
+ *
20325
+ * In the example below, we'll create a {@link Viewer}, add a {@link FastNavPlugin}, then use an {@link XTCLoaderPlugin} to load a model.
20326
+ *
20327
+ * Whenever we interact with the Viewer, our FastNavPlugin will:
20328
+ *
20329
+ * * hide edges,
20330
+ * * hide ambient shadows (SAO),
20331
+ * * hide physically-based materials (switching to non-PBR),
20332
+ * * hide transparent objects, and
20333
+ * * scale the canvas resolution by 0.5, causing the GPU to render 75% less pixels.
20334
+ * <br>
20335
+ *
20336
+ * We'll also configure a 0.5 second delay before we transition back to high-quality each time we stop ineracting, so that we're
20337
+ * not continually flipping between low and high quality as we interact. Since we're only rendering ambient shadows when not interacting, we'll also treat ourselves
20338
+ * to expensive, high-quality SAO settings, that we wouldn't normally configure for an interactive SAO effect.
20339
+ *
20340
+ * * [[Run this example](https://xeokit.github.io/xeokit-sdk/examples/#performance_FastNavPlugin)]
20341
+ *
20342
+ * ````javascript
20343
+ * import {Viewer, XTCLoaderPlugin, FastNavPlugin} from "xeokit-sdk.es.js";
20344
+ *
20345
+ * // Create a Viewer with PBR and SAO enabled
20346
+ *
20347
+ * const viewer = new Viewer({
20348
+ * canvasId: "myCanvas",
20349
+ * transparent: true,
20350
+ * pbr: true, // Enable physically-based rendering for Viewer
20351
+ * sao: true // Enable ambient shadows for Viewer
20352
+ * });
20353
+ *
20354
+ * viewer.scene.camera.eye = [-66.26, 105.84, -281.92];
20355
+ * viewer.scene.camera.look = [42.45, 49.62, -43.59];
20356
+ * viewer.scene.camera.up = [0.05, 0.95, 0.15];
20357
+ *
20358
+ * // Higher-quality SAO settings
20359
+ *
20360
+ * viewer.scene.sao.enabled = true;
20361
+ * viewer.scene.sao.numSamples = 60;
20362
+ * viewer.scene.sao.kernelRadius = 170;
20363
+ *
20364
+ * // Install a FastNavPlugin
20365
+ *
20366
+ * new FastNavPlugin(viewer, {
20367
+ * hideEdges: true, // Don't show edges while we interact (default is true)
20368
+ * hideSAO: true, // Don't show ambient shadows while we interact (default is true)
20369
+ * hideColorTexture: true, // No color textures while we interact (default is true)
20370
+ * hidePBR: true, // No physically-based rendering while we interact (default is true)
20371
+ * hideTransparentObjects: true, // Hide transparent objects while we interact (default is false)
20372
+ * scaleCanvasResolution: true, // Scale canvas resolution while we interact (default is false)
20373
+ * scaleCanvasResolutionFactor: 0.5, // Factor by which we scale canvas resolution when we interact (default is 0.6)
20374
+ * delayBeforeRestore: true, // When we stop interacting, delay before restoring normal render (default is true)
20375
+ * delayBeforeRestoreSeconds: 0.5 // The delay duration, in seconds (default is 0.5)
20376
+ * });
20377
+ *
20378
+ * // Load a BIM model from XTC
20379
+ *
20380
+ * const xtcLoader = new XTCLoaderPlugin(viewer);
20381
+ *
20382
+ * const model = xtcLoader.load({
20383
+ * id: "myModel",
20384
+ * src: "./models/xtc/HolterTower.xtc",
20385
+ * sao: true, // Enable ambient shadows for this model
20386
+ * pbr: true // Enable physically-based rendering for this model
20387
+ * });
20388
+ * ````
20389
+ *
20390
+ * @class FastNavPlugin
20391
+ */var FastNavPlugin=/*#__PURE__*/function(_Plugin6){/**
20392
+ * @constructor
20393
+ * @param {Viewer} viewer The Viewer.
20394
+ * @param {Object} cfg FastNavPlugin configuration.
20395
+ * @param {String} [cfg.id="FastNav"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
20396
+ * @param {Boolean} [cfg.hideColorTexture=true] Whether to temporarily hide color textures whenever we interact with the Viewer.
20397
+ * @param {Boolean} [cfg.hidePBR=true] Whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20398
+ * @param {Boolean} [cfg.hideSAO=true] Whether to temporarily hide scalable ambient occlusion (SAO) whenever we interact with the Viewer.
20399
+ * @param {Boolean} [cfg.hideEdges=true] Whether to temporarily hide edges whenever we interact with the Viewer.
20400
+ * @param {Boolean} [cfg.hideTransparentObjects=false] Whether to temporarily hide transparent objects whenever we interact with the Viewer.
20401
+ * @param {Number} [cfg.scaleCanvasResolution=false] Whether to temporarily down-scale the canvas resolution whenever we interact with the Viewer.
20402
+ * @param {Number} [cfg.scaleCanvasResolutionFactor=0.6] The factor by which we downscale the canvas resolution whenever we interact with the Viewer.
20403
+ * @param {Boolean} [cfg.delayBeforeRestore=true] Whether to temporarily have a delay before restoring normal rendering after we stop interacting with the Viewer.
20404
+ * @param {Number} [cfg.delayBeforeRestoreSeconds=0.5] Delay in seconds before restoring normal rendering after we stop interacting with the Viewer.
20405
+ */function FastNavPlugin(viewer){var _this91;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,FastNavPlugin);_this91=_callSuper(this,FastNavPlugin,["FastNav",viewer]);_this91._hideColorTexture=cfg.hideColorTexture!==false;_this91._hidePBR=cfg.hidePBR!==false;_this91._hideSAO=cfg.hideSAO!==false;_this91._hideEdges=cfg.hideEdges!==false;_this91._hideTransparentObjects=!!cfg.hideTransparentObjects;_this91._scaleCanvasResolution=!!cfg.scaleCanvasResolution;_this91._scaleCanvasResolutionFactor=cfg.scaleCanvasResolutionFactor||0.6;_this91._delayBeforeRestore=cfg.delayBeforeRestore!==false;_this91._delayBeforeRestoreSeconds=cfg.delayBeforeRestoreSeconds||0.5;var timer=_this91._delayBeforeRestoreSeconds*1000;var fastMode=false;var switchToLowQuality=function switchToLowQuality(){timer=_this91._delayBeforeRestoreSeconds*1000;if(!fastMode){viewer.scene._renderer.setColorTextureEnabled(!_this91._hideColorTexture);viewer.scene._renderer.setPBREnabled(!_this91._hidePBR);viewer.scene._renderer.setSAOEnabled(!_this91._hideSAO);viewer.scene._renderer.setTransparentEnabled(!_this91._hideTransparentObjects);viewer.scene._renderer.setEdgesEnabled(!_this91._hideEdges);if(_this91._scaleCanvasResolution){viewer.scene.canvas.resolutionScale=_this91._scaleCanvasResolutionFactor;}else{viewer.scene.canvas.resolutionScale=1;}fastMode=true;}};var switchToHighQuality=function switchToHighQuality(){viewer.scene.canvas.resolutionScale=1;viewer.scene._renderer.setEdgesEnabled(true);viewer.scene._renderer.setColorTextureEnabled(true);viewer.scene._renderer.setPBREnabled(true);viewer.scene._renderer.setSAOEnabled(true);viewer.scene._renderer.setTransparentEnabled(true);fastMode=false;};_this91._onCanvasBoundary=viewer.scene.canvas.on("boundary",switchToLowQuality);_this91._onCameraMatrix=viewer.scene.camera.on("matrix",switchToLowQuality);_this91._onSceneTick=viewer.scene.on("tick",function(tickEvent){if(!fastMode){return;}timer-=tickEvent.deltaTime;if(!_this91._delayBeforeRestore||timer<=0){switchToHighQuality();}});var down=false;_this91._onSceneMouseDown=viewer.scene.input.on("mousedown",function(){down=true;});_this91._onSceneMouseUp=viewer.scene.input.on("mouseup",function(){down=false;});_this91._onSceneMouseMove=viewer.scene.input.on("mousemove",function(){if(!down){return;}switchToLowQuality();});return _this91;}/**
20406
+ * Gets whether to temporarily hide color textures whenever we interact with the Viewer.
20407
+ *
20408
+ * Default is ````true````.
20409
+ *
20410
+ * @return {Boolean} ````true```` if hiding color textures.
20411
+ */_inherits(FastNavPlugin,_Plugin6);return _createClass(FastNavPlugin,[{key:"hideColorTexture",get:function get(){return this._hideColorTexture;}/**
20412
+ * Sets whether to temporarily hide color textures whenever we interact with the Viewer.
20413
+ *
20414
+ * Default is ````true````.
20415
+ *
20416
+ * @param {Boolean} hideColorTexture ````true```` to hide color textures.
20417
+ */,set:function set(hideColorTexture){this._hideColorTexture=hideColorTexture;}/**
20418
+ * Gets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20419
+ *
20420
+ * Default is ````true````.
20421
+ *
20422
+ * @return {Boolean} ````true```` if hiding PBR.
20423
+ */},{key:"hidePBR",get:function get(){return this._hidePBR;}/**
20424
+ * Sets whether to temporarily hide physically-based rendering (PBR) whenever we interact with the Viewer.
20425
+ *
20426
+ * Default is ````true````.
20427
+ *
20428
+ * @param {Boolean} hidePBR ````true```` to hide PBR.
20429
+ */,set:function set(hidePBR){this._hidePBR=hidePBR;}/**
20430
+ * Gets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.
20431
+ *
20432
+ * Default is ````true````.
20433
+ *
20434
+ * @return {Boolean} ````true```` if hiding SAO.
20435
+ */},{key:"hideSAO",get:function get(){return this._hideSAO;}/**
20436
+ * Sets whether to temporarily hide scalable ambient shadows (SAO) whenever we interact with the Viewer.
20437
+ *
20438
+ * Default is ````true````.
20439
+ *
20440
+ * @param {Boolean} hideSAO ````true```` to hide SAO.
20441
+ */,set:function set(hideSAO){this._hideSAO=hideSAO;}/**
20442
+ * Gets whether to temporarily hide edges whenever we interact with the Viewer.
20443
+ *
20444
+ * Default is ````true````.
20445
+ *
20446
+ * @return {Boolean} ````true```` if hiding edges.
20447
+ */},{key:"hideEdges",get:function get(){return this._hideEdges;}/**
20448
+ * Sets whether to temporarily hide edges whenever we interact with the Viewer.
20449
+ *
20450
+ * Default is ````true````.
20451
+ *
20452
+ * @param {Boolean} hideEdges ````true```` to hide edges.
20453
+ */,set:function set(hideEdges){this._hideEdges=hideEdges;}/**
20454
+ * Gets whether to temporarily hide transparent objects whenever we interact with the Viewer.
20455
+ *
20456
+ * Does not hide X-rayed, selected, highlighted objects.
20457
+ *
20458
+ * Default is ````false````.
20459
+ *
20460
+ * @return {Boolean} ````true```` if hiding transparent objects.
20461
+ */},{key:"hideTransparentObjects",get:function get(){return this._hideTransparentObjects;}/**
20462
+ * Sets whether to temporarily hide transparent objects whenever we interact with the Viewer.
20463
+ *
20464
+ * Does not hide X-rayed, selected, highlighted objects.
20465
+ *
20466
+ * Default is ````false````.
20467
+ *
20468
+ * @param {Boolean} hideTransparentObjects ````true```` to hide transparent objects.
20469
+ */,set:function set(hideTransparentObjects){this._hideTransparentObjects=hideTransparentObjects!==false;}/**
20470
+ * Gets whether to temporarily scale the canvas resolution whenever we interact with the Viewer.
20471
+ *
20472
+ * Default is ````false````.
20473
+ *
20474
+ * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.
20475
+ *
20476
+ * @return {Boolean} ````true```` if scaling the canvas resolution.
20477
+ */},{key:"scaleCanvasResolution",get:function get(){return this._scaleCanvasResolution;}/**
20478
+ * Sets whether to temporarily scale the canvas resolution whenever we interact with the Viewer.
20479
+ *
20480
+ * Default is ````false````.
20481
+ *
20482
+ * The scaling factor is configured via {@link FastNavPlugin#scaleCanvasResolutionFactor}.
20483
+ *
20484
+ * @param {Boolean} scaleCanvasResolution ````true```` to scale the canvas resolution.
20485
+ */,set:function set(scaleCanvasResolution){this._scaleCanvasResolution=scaleCanvasResolution;}/**
20486
+ * Gets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.
20487
+ *
20488
+ * Default is ````0.6````.
20489
+ *
20490
+ * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.
20491
+ *
20492
+ * @return {Number} Factor by which we scale the canvas resolution.
20493
+ */},{key:"scaleCanvasResolutionFactor",get:function get(){return this._scaleCanvasResolutionFactor;}/**
20494
+ * Sets the factor by which we temporarily scale the canvas resolution when we interact with the viewer.
20495
+ *
20496
+ * Accepted range is ````[0.0 .. 1.0]````.
20497
+ *
20498
+ * Default is ````0.6````.
20499
+ *
20500
+ * Enable canvas resolution scaling by setting {@link FastNavPlugin#scaleCanvasResolution} ````true````.
20501
+ *
20502
+ * @param {Number} scaleCanvasResolutionFactor Factor by which we scale the canvas resolution.
20503
+ */,set:function set(scaleCanvasResolutionFactor){this._scaleCanvasResolutionFactor=scaleCanvasResolutionFactor||0.6;}/**
20504
+ * Gets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.
20505
+ *
20506
+ * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.
20507
+ *
20508
+ * Default is ````true````.
20509
+ *
20510
+ * @return {Boolean} Whether to have a delay.
20511
+ */},{key:"delayBeforeRestore",get:function get(){return this._delayBeforeRestore;}/**
20512
+ * Sets whether to have a delay before restoring normal rendering after we stop interacting with the Viewer.
20513
+ *
20514
+ * The delay duration is configured via {@link FastNavPlugin#delayBeforeRestoreSeconds}.
20515
+ *
20516
+ * Default is ````true````.
20517
+ *
20518
+ * @param {Boolean} delayBeforeRestore Whether to have a delay.
20519
+ */,set:function set(delayBeforeRestore){this._delayBeforeRestore=delayBeforeRestore;}/**
20520
+ * Gets the delay before restoring normal rendering after we stop interacting with the Viewer.
20521
+ *
20522
+ * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.
20523
+ *
20524
+ * Default is ````0.5```` seconds.
20525
+ *
20526
+ * @return {Number} Delay in seconds.
20527
+ */},{key:"delayBeforeRestoreSeconds",get:function get(){return this._delayBeforeRestoreSeconds;}/**
20528
+ * Sets the delay before restoring normal rendering after we stop interacting with the Viewer.
20529
+ *
20530
+ * The delay is enabled when {@link FastNavPlugin#delayBeforeRestore} is ````true````.
20531
+ *
20532
+ * Default is ````0.5```` seconds.
20533
+ *
20534
+ * @param {Number} delayBeforeRestoreSeconds Delay in seconds.
20535
+ */,set:function set(delayBeforeRestoreSeconds){this._delayBeforeRestoreSeconds=delayBeforeRestoreSeconds!==null&&delayBeforeRestoreSeconds!==undefined?delayBeforeRestoreSeconds:0.5;}/**
20536
+ * @private
20537
+ */},{key:"send",value:function send(name,value){}/**
20538
+ * Destroys this plugin.
20539
+ */},{key:"destroy",value:function destroy(){this.viewer.scene.camera.off(this._onCameraMatrix);this.viewer.scene.canvas.off(this._onCanvasBoundary);this.viewer.scene.input.off(this._onSceneMouseDown);this.viewer.scene.input.off(this._onSceneMouseUp);this.viewer.scene.input.off(this._onSceneMouseMove);this.viewer.scene.off(this._onSceneTick);_superPropGet(FastNavPlugin,"destroy",this,3)([]);}}]);}(Plugin);/**
20284
20540
  * Default data access strategy for {@link GLTFLoaderPlugin}.
20285
20541
  *
20286
20542
  * This just loads assets using XMLHttpRequest.
@@ -20602,7 +20858,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
20602
20858
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Curve}, generated automatically when omitted.
20603
20859
  * @param {Object} [cfg] Configs for this Curve.
20604
20860
  * @param {Number} [cfg.t=0] Current position on this Curve, in range between ````0..1````.
20605
- */function Curve(owner){var _this91;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Curve);_this91=_callSuper(this,Curve,[owner,cfg]);_this91.t=cfg.t;return _this91;}/**
20861
+ */function Curve(owner){var _this92;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Curve);_this92=_callSuper(this,Curve,[owner,cfg]);_this92.t=cfg.t;return _this92;}/**
20606
20862
  * Sets the progress along this Curve.
20607
20863
  *
20608
20864
  * Automatically clamps to range ````[0..1]````.
@@ -20657,7 +20913,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20657
20913
  * @param {Array} [cfg.points=[]] Control points on this SplineCurve.
20658
20914
  * @param {Number} [cfg.t=0] Current position on this SplineCurve, in range between 0..1.
20659
20915
  * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
20660
- */function SplineCurve(owner){var _this92;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SplineCurve);_this92=_callSuper(this,SplineCurve,[owner,cfg]);_this92.points=cfg.points;_this92.t=cfg.t;return _this92;}/**
20916
+ */function SplineCurve(owner){var _this93;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SplineCurve);_this93=_callSuper(this,SplineCurve,[owner,cfg]);_this93.points=cfg.points;_this93.t=cfg.t;return _this93;}/**
20661
20917
  * Sets the control points on this SplineCurve.
20662
20918
  *
20663
20919
  * Default value is ````[]````.
@@ -20704,7 +20960,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20704
20960
  * @param [cfg] {*} Configuration
20705
20961
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
20706
20962
  * @param {{t:Number, eye:Object, look:Object, up: Object}[]} [cfg.frames] Initial sequence of frames.
20707
- */function CameraPath(owner){var _this93;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPath);_this93=_callSuper(this,CameraPath,[owner,cfg]);_this93._frames=[];_this93._eyeCurve=new SplineCurve(_this93);_this93._lookCurve=new SplineCurve(_this93);_this93._upCurve=new SplineCurve(_this93);if(cfg.frames){_this93.addFrames(cfg.frames);_this93.smoothFrameTimes(1);}return _this93;}/**
20963
+ */function CameraPath(owner){var _this94;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPath);_this94=_callSuper(this,CameraPath,[owner,cfg]);_this94._frames=[];_this94._eyeCurve=new SplineCurve(_this94);_this94._lookCurve=new SplineCurve(_this94);_this94._upCurve=new SplineCurve(_this94);if(cfg.frames){_this94.addFrames(cfg.frames);_this94.smoothFrameTimes(1);}return _this94;}/**
20708
20964
  * Gets the camera frames in this CameraPath.
20709
20965
  *
20710
20966
  * @returns {{t:Number, eye:Object, look:Object, up: Object}[]} The frames on this CameraPath.
@@ -20849,7 +21105,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20849
21105
  */var CameraFlightAnimation=/*#__PURE__*/function(_Component33){/**
20850
21106
  @constructor
20851
21107
  @private
20852
- */function CameraFlightAnimation(owner){var _this94;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraFlightAnimation);_this94=_callSuper(this,CameraFlightAnimation,[owner,cfg]);_this94._look1=math.vec3();_this94._eye1=math.vec3();_this94._up1=math.vec3();_this94._look2=math.vec3();_this94._eye2=math.vec3();_this94._up2=math.vec3();_this94._orthoScale1=1;_this94._orthoScale2=1;_this94._flying=false;_this94._flyEyeLookUp=false;_this94._flyingEye=false;_this94._flyingLook=false;_this94._callback=null;_this94._callbackScope=null;_this94._time1=null;_this94._time2=null;_this94.easing=cfg.easing!==false;_this94.duration=cfg.duration;_this94.fit=cfg.fit;_this94.fitFOV=cfg.fitFOV;_this94.trail=cfg.trail;return _this94;}/**
21108
+ */function CameraFlightAnimation(owner){var _this95;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraFlightAnimation);_this95=_callSuper(this,CameraFlightAnimation,[owner,cfg]);_this95._look1=math.vec3();_this95._eye1=math.vec3();_this95._up1=math.vec3();_this95._look2=math.vec3();_this95._eye2=math.vec3();_this95._up2=math.vec3();_this95._orthoScale1=1;_this95._orthoScale2=1;_this95._flying=false;_this95._flyEyeLookUp=false;_this95._flyingEye=false;_this95._flyingLook=false;_this95._callback=null;_this95._callbackScope=null;_this95._time1=null;_this95._time2=null;_this95.easing=cfg.easing!==false;_this95.duration=cfg.duration;_this95.fit=cfg.fit;_this95.fitFOV=cfg.fitFOV;_this95.trail=cfg.trail;return _this95;}/**
20853
21109
  * Flies the {@link Camera} to a target.
20854
21110
  *
20855
21111
  * * When the target is a boundary, the {@link Camera} will fly towards the target and stop when the target fills most of the canvas.
@@ -21044,7 +21300,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21044
21300
  * @param {*} [cfg] Configuration
21045
21301
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
21046
21302
  * @param {CameraPath} [cfg.eyeCurve] A {@link CameraPath} that defines the path of a {@link Camera}.
21047
- */function CameraPathAnimation(owner){var _this95;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPathAnimation);_this95=_callSuper(this,CameraPathAnimation,[owner,cfg]);_this95._cameraFlightAnimation=new CameraFlightAnimation(_this95);_this95._t=0;_this95.state=CameraPathAnimation.SCRUBBING;_this95._playingFromT=0;_this95._playingToT=0;_this95._playingRate=cfg.playingRate||1.0;_this95._playingDir=1.0;_this95._lastTime=null;_this95.cameraPath=cfg.cameraPath;_this95._tick=_this95.scene.on("tick",_this95._updateT,_this95);return _this95;}_inherits(CameraPathAnimation,_Component34);return _createClass(CameraPathAnimation,[{key:"type",get:/**
21303
+ */function CameraPathAnimation(owner){var _this96;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPathAnimation);_this96=_callSuper(this,CameraPathAnimation,[owner,cfg]);_this96._cameraFlightAnimation=new CameraFlightAnimation(_this96);_this96._t=0;_this96.state=CameraPathAnimation.SCRUBBING;_this96._playingFromT=0;_this96._playingToT=0;_this96._playingRate=cfg.playingRate||1.0;_this96._playingDir=1.0;_this96._lastTime=null;_this96.cameraPath=cfg.cameraPath;_this96._tick=_this96.scene.on("tick",_this96._updateT,_this96);return _this96;}_inherits(CameraPathAnimation,_Component34);return _createClass(CameraPathAnimation,[{key:"type",get:/**
21048
21304
  * Returns "CameraPathAnimation".
21049
21305
  *
21050
21306
  * @private
@@ -21225,7 +21481,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21225
21481
  * @param {Number} [cfg.opacity=1.0] ````ImagePlane````'s initial opacity factor, multiplies by the rendered fragment alpha.
21226
21482
  * @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.
21227
21483
  * @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.
21228
- */function ImagePlane(owner){var _this96;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ImagePlane);_this96=_callSuper(this,ImagePlane,[owner,cfg]);_this96._src=null;_this96._image=null;_this96._pos=math.vec3();_this96._origin=math.vec3();_this96._rtcPos=math.vec3();_this96._dir=math.vec3();_this96._size=1.0;_this96._imageSize=math.vec2();_this96._texture=new Texture(_this96);_this96._plane=new Mesh(_this96,{geometry:new ReadableGeometry(_this96,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new PhongMaterial(_this96,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this96._texture,emissiveMap:_this96._texture,backfaces:true}),clippable:cfg.clippable});_this96._grid=new Mesh(_this96,{geometry:new ReadableGeometry(_this96,buildGridGeometry({size:1,divisions:10})),material:new PhongMaterial(_this96,{diffuse:[0.0,0.0,0.0],ambient:[0.0,0.0,0.0],emissive:[0.2,0.8,0.2]}),position:[0,0.001,0.0],clippable:cfg.clippable});_this96._node=new Node$1(_this96,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:false,children:[_this96._plane,_this96._grid]});_this96._gridVisible=false;_this96.visible=true;_this96.gridVisible=cfg.gridVisible;_this96.position=cfg.position;_this96.rotation=cfg.rotation;_this96.dir=cfg.dir;_this96.size=cfg.size;_this96.collidable=cfg.collidable;_this96.clippable=cfg.clippable;_this96.pickable=cfg.pickable;_this96.opacity=cfg.opacity;if(cfg.image){_this96.image=cfg.image;}else{_this96.src=cfg.src;}return _this96;}/**
21484
+ */function ImagePlane(owner){var _this97;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ImagePlane);_this97=_callSuper(this,ImagePlane,[owner,cfg]);_this97._src=null;_this97._image=null;_this97._pos=math.vec3();_this97._origin=math.vec3();_this97._rtcPos=math.vec3();_this97._dir=math.vec3();_this97._size=1.0;_this97._imageSize=math.vec2();_this97._texture=new Texture(_this97);_this97._plane=new Mesh(_this97,{geometry:new ReadableGeometry(_this97,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new PhongMaterial(_this97,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this97._texture,emissiveMap:_this97._texture,backfaces:true}),clippable:cfg.clippable});_this97._grid=new Mesh(_this97,{geometry:new ReadableGeometry(_this97,buildGridGeometry({size:1,divisions:10})),material:new PhongMaterial(_this97,{diffuse:[0.0,0.0,0.0],ambient:[0.0,0.0,0.0],emissive:[0.2,0.8,0.2]}),position:[0,0.001,0.0],clippable:cfg.clippable});_this97._node=new Node$1(_this97,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:false,children:[_this97._plane,_this97._grid]});_this97._gridVisible=false;_this97.visible=true;_this97.gridVisible=cfg.gridVisible;_this97.position=cfg.position;_this97.rotation=cfg.rotation;_this97.dir=cfg.dir;_this97.size=cfg.size;_this97.collidable=cfg.collidable;_this97.clippable=cfg.clippable;_this97.pickable=cfg.pickable;_this97.opacity=cfg.opacity;if(cfg.image){_this97.image=cfg.image;}else{_this97.src=cfg.src;}return _this97;}/**
21229
21485
  * Sets if this ````ImagePlane```` is visible or not.
21230
21486
  *
21231
21487
  * Default value is ````true````.
@@ -21283,7 +21539,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21283
21539
  * Default value is ````[0, 0, 0]````.
21284
21540
  *
21285
21541
  * @param {Number[]} value New position.
21286
- */,set:function set(src){var _this97=this;this._src=src;if(this._src){this._image=null;var _image4=new Image();_image4.onload=function(){_this97._texture.image=_image4;_this97._imageSize[0]=_image4.width;_this97._imageSize[1]=_image4.height;_this97._updatePlaneSizeFromImage();};_image4.src=this._src;}}},{key:"position",get:/**
21542
+ */,set:function set(src){var _this98=this;this._src=src;if(this._src){this._image=null;var _image4=new Image();_image4.onload=function(){_this98._texture.image=_image4;_this98._imageSize[0]=_image4.width;_this98._imageSize[1]=_image4.height;_this98._updatePlaneSizeFromImage();};_image4.src=this._src;}}},{key:"position",get:/**
21287
21543
  * Gets the World-space position of this ````ImagePlane````.
21288
21544
  *
21289
21545
  * Default value is ````[0, 0, 0]````.
@@ -21479,9 +21735,9 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
21479
21735
  * @param {Number} [cfg.quadraticAttenuation=0]Quadratic attenuation factor.
21480
21736
  * @param {String} [cfg.space="view"]The coordinate system this PointLight is defined in - "view" or "world".
21481
21737
  * @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this PointLight casts a castsShadow.
21482
- */function PointLight(owner){var _this98;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,PointLight);_this98=_callSuper(this,PointLight,[owner,cfg]);var self=_this98;_this98._shadowRenderBuf=null;_this98._shadowViewMatrix=null;_this98._shadowProjMatrix=null;_this98._shadowViewMatrixDirty=true;_this98._shadowProjMatrixDirty=true;var camera=_this98.scene.camera;var canvas=_this98.scene.canvas;_this98._onCameraViewMatrix=camera.on("viewMatrix",function(){_this98._shadowViewMatrixDirty=true;});_this98._onCameraProjMatrix=camera.on("projMatrix",function(){_this98._shadowProjMatrixDirty=true;});_this98._onCanvasBoundary=canvas.on("boundary",function(){_this98._shadowProjMatrixDirty=true;});_this98._state=new RenderState({type:"point",pos:math.vec3([1.0,1.0,1.0]),color:math.vec3([0.7,0.7,0.8]),intensity:1.0,attenuation:[0.0,0.0,0.0],space:cfg.space||"view",castsShadow:false,getShadowViewMatrix:function getShadowViewMatrix(){if(self._shadowViewMatrixDirty){if(!self._shadowViewMatrix){self._shadowViewMatrix=math.identityMat4();}var eye=self._state.pos;var look=camera.look;var up=camera.up;math.lookAtMat4v(eye,look,up,self._shadowViewMatrix);self._shadowViewMatrixDirty=false;}return self._shadowViewMatrix;},getShadowProjMatrix:function getShadowProjMatrix(){if(self._shadowProjMatrixDirty){// TODO: Set when canvas resizes
21738
+ */function PointLight(owner){var _this99;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,PointLight);_this99=_callSuper(this,PointLight,[owner,cfg]);var self=_this99;_this99._shadowRenderBuf=null;_this99._shadowViewMatrix=null;_this99._shadowProjMatrix=null;_this99._shadowViewMatrixDirty=true;_this99._shadowProjMatrixDirty=true;var camera=_this99.scene.camera;var canvas=_this99.scene.canvas;_this99._onCameraViewMatrix=camera.on("viewMatrix",function(){_this99._shadowViewMatrixDirty=true;});_this99._onCameraProjMatrix=camera.on("projMatrix",function(){_this99._shadowProjMatrixDirty=true;});_this99._onCanvasBoundary=canvas.on("boundary",function(){_this99._shadowProjMatrixDirty=true;});_this99._state=new RenderState({type:"point",pos:math.vec3([1.0,1.0,1.0]),color:math.vec3([0.7,0.7,0.8]),intensity:1.0,attenuation:[0.0,0.0,0.0],space:cfg.space||"view",castsShadow:false,getShadowViewMatrix:function getShadowViewMatrix(){if(self._shadowViewMatrixDirty){if(!self._shadowViewMatrix){self._shadowViewMatrix=math.identityMat4();}var eye=self._state.pos;var look=camera.look;var up=camera.up;math.lookAtMat4v(eye,look,up,self._shadowViewMatrix);self._shadowViewMatrixDirty=false;}return self._shadowViewMatrix;},getShadowProjMatrix:function getShadowProjMatrix(){if(self._shadowProjMatrixDirty){// TODO: Set when canvas resizes
21483
21739
  if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _canvas4=self.scene.canvas.canvas;math.perspectiveMat4(70*(Math.PI/180.0),_canvas4.clientWidth/_canvas4.clientHeight,0.1,500.0,self._shadowProjMatrix);self._shadowProjMatrixDirty=false;}return self._shadowProjMatrix;},getShadowRenderBuf:function getShadowRenderBuf(){if(!self._shadowRenderBuf){self._shadowRenderBuf=new RenderBuffer(self.scene.canvas.canvas,self.scene.canvas.gl,{size:[1024,1024]});// Super old mobile devices have a limit of 1024x1024 textures
21484
- }return self._shadowRenderBuf;}});_this98.pos=cfg.pos;_this98.color=cfg.color;_this98.intensity=cfg.intensity;_this98.constantAttenuation=cfg.constantAttenuation;_this98.linearAttenuation=cfg.linearAttenuation;_this98.quadraticAttenuation=cfg.quadraticAttenuation;_this98.castsShadow=cfg.castsShadow;_this98.scene._lightCreated(_this98);return _this98;}/**
21740
+ }return self._shadowRenderBuf;}});_this99.pos=cfg.pos;_this99.color=cfg.color;_this99.intensity=cfg.intensity;_this99.constantAttenuation=cfg.constantAttenuation;_this99.linearAttenuation=cfg.linearAttenuation;_this99.quadraticAttenuation=cfg.quadraticAttenuation;_this99.castsShadow=cfg.castsShadow;_this99.scene._lightCreated(_this99);return _this99;}/**
21485
21741
  * Sets the position of this PointLight.
21486
21742
  *
21487
21743
  * This will be either World- or View-space, depending on the value of {@link PointLight#space}.
@@ -21583,7 +21839,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
21583
21839
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this CubeTexture.
21584
21840
  * @param {Boolean} [cfg.flipY=false] Flips this CubeTexture's source data along its vertical axis when true.
21585
21841
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21586
- */function CubeTexture(owner){var _this99;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this99=_callSuper(this,CubeTexture,[owner,cfg]);var gl=_this99.scene.canvas.gl;_this99._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this99._checkFlipY(cfg.minFilter),encoding:_this99._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this99._src=cfg.src;_this99._images=[];_this99._loadSrc(cfg.src);stats.memory.textures++;return _this99;}_inherits(CubeTexture,_Component36);return _createClass(CubeTexture,[{key:"type",get:/**
21842
+ */function CubeTexture(owner){var _this100;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this100=_callSuper(this,CubeTexture,[owner,cfg]);var gl=_this100.scene.canvas.gl;_this100._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this100._checkFlipY(cfg.minFilter),encoding:_this100._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this100._src=cfg.src;_this100._images=[];_this100._loadSrc(cfg.src);stats.memory.textures++;return _this100;}_inherits(CubeTexture,_Component36);return _createClass(CubeTexture,[{key:"type",get:/**
21587
21843
  @private
21588
21844
  */function get(){return"CubeTexture";}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this.scene.canvas.gl;this._state.texture=null;// if (this._images.length > 0) {
21589
21845
  // this._state.texture = new xeokit.renderer.Texture2D(gl, gl.TEXTURE_CUBE_MAP);
@@ -21643,7 +21899,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21643
21899
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this ReflectionMap.
21644
21900
  * @param {Boolean} [cfg.flipY=false] Flips this ReflectionMap's source data along its vertical axis when true.
21645
21901
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21646
- */function ReflectionMap(owner){var _this100;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ReflectionMap);_this100=_callSuper(this,ReflectionMap,[owner,cfg]);_this100.scene._lightsState.addReflectionMap(_this100._state);_this100.scene._reflectionMapCreated(_this100);return _this100;}/**
21902
+ */function ReflectionMap(owner){var _this101;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ReflectionMap);_this101=_callSuper(this,ReflectionMap,[owner,cfg]);_this101.scene._lightsState.addReflectionMap(_this101._state);_this101.scene._reflectionMapCreated(_this101);return _this101;}/**
21647
21903
  * Destroys this ReflectionMap.
21648
21904
  */_inherits(ReflectionMap,_CubeTexture);return _createClass(ReflectionMap,[{key:"type",get:/**
21649
21905
  @private
@@ -21699,7 +21955,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21699
21955
  * @param {String[]} [cfg.src=null] Paths to six image files to load into this LightMap.
21700
21956
  * @param {Boolean} [cfg.flipY=false] Flips this LightMap's source data along its vertical axis when true.
21701
21957
  * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
21702
- */function LightMap(owner){var _this101;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LightMap);_this101=_callSuper(this,LightMap,[owner,cfg]);_this101.scene._lightMapCreated(_this101);return _this101;}_inherits(LightMap,_CubeTexture2);return _createClass(LightMap,[{key:"type",get:/**
21958
+ */function LightMap(owner){var _this102;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LightMap);_this102=_callSuper(this,LightMap,[owner,cfg]);_this102.scene._lightMapCreated(_this102);return _this102;}_inherits(LightMap,_CubeTexture2);return _createClass(LightMap,[{key:"type",get:/**
21703
21959
  @private
21704
21960
  */function get(){return"LightMap";}},{key:"destroy",value:function destroy(){_superPropGet(LightMap,"destroy",this,3)([]);this.scene._lightMapDestroyed(this);}}]);}(CubeTexture);/**
21705
21961
  * A {@link Marker} with a billboarded and textured quad attached to it.
@@ -21752,10 +22008,10 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
21752
22008
  * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this SpriteMarker. See the {@link SpriteMarker#image} property for more info.
21753
22009
  * @param {Boolean} [cfg.flipY=false] Flips this SpriteMarker's texture image along its vertical axis when true.
21754
22010
  * @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
21755
- */function SpriteMarker(owner){var _this102;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SpriteMarker);_this102=_callSuper(this,SpriteMarker,[owner,{entity:cfg.entity,occludable:cfg.occludable,worldPos:cfg.worldPos}]);_this102._occluded=false;_this102._visible=true;_this102._src=null;_this102._image=null;_this102._pos=math.vec3();_this102._origin=math.vec3();_this102._rtcPos=math.vec3();_this102._dir=math.vec3();_this102._size=1.0;_this102._imageSize=math.vec2();_this102._texture=new Texture(_this102,{src:cfg.src});_this102._geometry=new ReadableGeometry(_this102,{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]// Ensure these will be front-faces
21756
- });_this102._mesh=new Mesh(_this102,{geometry:_this102._geometry,material:new PhongMaterial(_this102,{ambient:[0.9,0.3,0.9],shininess:30,diffuseMap:_this102._texture,backfaces:true}),scale:[1,1,1],// Note: by design, scale does not work with billboard
22011
+ */function SpriteMarker(owner){var _this103;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SpriteMarker);_this103=_callSuper(this,SpriteMarker,[owner,{entity:cfg.entity,occludable:cfg.occludable,worldPos:cfg.worldPos}]);_this103._occluded=false;_this103._visible=true;_this103._src=null;_this103._image=null;_this103._pos=math.vec3();_this103._origin=math.vec3();_this103._rtcPos=math.vec3();_this103._dir=math.vec3();_this103._size=1.0;_this103._imageSize=math.vec2();_this103._texture=new Texture(_this103,{src:cfg.src});_this103._geometry=new ReadableGeometry(_this103,{primitive:"triangles",positions:[3,3,0,-3,3,0,-3,-3,0,3,-3,0],normals:[-1,0,0,-1,0,0,-1,0,0,-1,0,0],uv:[1,-1,0,-1,0,0,1,0],indices:[0,1,2,0,2,3]// Ensure these will be front-faces
22012
+ });_this103._mesh=new Mesh(_this103,{geometry:_this103._geometry,material:new PhongMaterial(_this103,{ambient:[0.9,0.3,0.9],shininess:30,diffuseMap:_this103._texture,backfaces:true}),scale:[1,1,1],// Note: by design, scale does not work with billboard
21757
22013
  position:cfg.worldPos,rotation:[90,0,0],billboard:"spherical",occluder:false// Don't occlude SpriteMarkers or Annotations
21758
- });_this102.visible=true;_this102.collidable=cfg.collidable;_this102.clippable=cfg.clippable;_this102.pickable=cfg.pickable;_this102.opacity=cfg.opacity;_this102.size=cfg.size;if(cfg.image){_this102.image=cfg.image;}else{_this102.src=cfg.src;}return _this102;}_inherits(SpriteMarker,_Marker2);return _createClass(SpriteMarker,[{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
22014
+ });_this103.visible=true;_this103.collidable=cfg.collidable;_this103.clippable=cfg.clippable;_this103.pickable=cfg.pickable;_this103.opacity=cfg.opacity;_this103.size=cfg.size;if(cfg.image){_this103.image=cfg.image;}else{_this103.src=cfg.src;}return _this103;}_inherits(SpriteMarker,_Marker2);return _createClass(SpriteMarker,[{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
21759
22015
  this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_superPropGet(SpriteMarker,"_setVisible",this,3)([visible]);}/**
21760
22016
  * Sets if this ````SpriteMarker```` is visible or not.
21761
22017
  *
@@ -21803,7 +22059,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
21803
22059
  * Default value is ````1.0````.
21804
22060
  *
21805
22061
  * @param {Number} size New World-space size of the ````SpriteMarker````.
21806
- */,set:function set(src){var _this103=this;this._src=src;if(this._src){this._image=null;var _image5=new Image();_image5.onload=function(){_this103._texture.image=_image5;_this103._imageSize[0]=_image5.width;_this103._imageSize[1]=_image5.height;_this103._updatePlaneSizeFromImage();};_image5.src=this._src;}}},{key:"size",get:/**
22062
+ */,set:function set(src){var _this104=this;this._src=src;if(this._src){this._image=null;var _image5=new Image();_image5.onload=function(){_this104._texture.image=_image5;_this104._imageSize[0]=_image5.width;_this104._imageSize[1]=_image5.height;_this104._updatePlaneSizeFromImage();};_image5.src=this._src;}}},{key:"size",get:/**
21807
22063
  * Gets the World-space size of the longest edge of the ````SpriteMarker````.
21808
22064
  *
21809
22065
  * Returns {Number} World-space size of the ````SpriteMarker````.
@@ -22127,7 +22383,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
22127
22383
  * @param {Number[]} [cfg.v2=[0,0,0]] The middle control point.
22128
22384
  * @param {Number[]} [cfg.v3=[0,0,0]] The ending point.
22129
22385
  * @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
22130
- */function CubicBezierCurve(owner){var _this104;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubicBezierCurve);_this104=_callSuper(this,CubicBezierCurve,[owner,cfg]);_this104.v0=cfg.v0;_this104.v1=cfg.v1;_this104.v2=cfg.v2;_this104.v3=cfg.v3;_this104.t=cfg.t;return _this104;}/**
22386
+ */function CubicBezierCurve(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubicBezierCurve);_this105=_callSuper(this,CubicBezierCurve,[owner,cfg]);_this105.v0=cfg.v0;_this105.v1=cfg.v1;_this105.v2=cfg.v2;_this105.v3=cfg.v3;_this105.t=cfg.t;return _this105;}/**
22131
22387
  * Sets the starting point on this CubicBezierCurve.
22132
22388
  *
22133
22389
  * Default value is ````[0.0, 0.0, 0.0]````
@@ -22216,12 +22472,12 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
22216
22472
  * @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
22217
22473
  * @param {String []} [cfg.paths=[]] IDs or instances of {{#crossLink "path"}}{{/crossLink}} subtypes to add to this Path.
22218
22474
  * @param {Number} [cfg.t=0] Current position on this Path, in range between 0..1.
22219
- */function Path(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Path);_this105=_callSuper(this,Path,[owner,cfg]);_this105._cachedLengths=[];_this105._dirty=true;_this105._curves=[];// Array of child Curve components
22220
- _this105._t=0;_this105._dirtySubs=[];// Subscriptions to "dirty" events from child Curve components
22221
- _this105._destroyedSubs=[];// Subscriptions to "destroyed" events from child Curve components
22222
- _this105.curves=cfg.curves||[];// Add initial curves
22223
- _this105.t=cfg.t;// Set initial progress
22224
- return _this105;}/**
22475
+ */function Path(owner){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Path);_this106=_callSuper(this,Path,[owner,cfg]);_this106._cachedLengths=[];_this106._dirty=true;_this106._curves=[];// Array of child Curve components
22476
+ _this106._t=0;_this106._dirtySubs=[];// Subscriptions to "dirty" events from child Curve components
22477
+ _this106._destroyedSubs=[];// Subscriptions to "destroyed" events from child Curve components
22478
+ _this106.curves=cfg.curves||[];// Add initial curves
22479
+ _this106.t=cfg.t;// Set initial progress
22480
+ return _this106;}/**
22225
22481
  * Adds a {@link Curve} to this Path.
22226
22482
  *
22227
22483
  * @param {Curve} curve The {@link Curve} to add.
@@ -22286,7 +22542,7 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
22286
22542
  * @param {Number[]} [cfg.v1=[0,0,0]] The middle control point.
22287
22543
  * @param {Number[]} [cfg.v2=[0,0,0]] The end point.
22288
22544
  * @param {Number[]} [cfg.t=0] Current position on this QuadraticBezierCurve, in range between ````0..1````.
22289
- */function QuadraticBezierCurve(owner){var _this106;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,QuadraticBezierCurve);_this106=_callSuper(this,QuadraticBezierCurve,[owner,cfg]);_this106.v0=cfg.v0;_this106.v1=cfg.v1;_this106.v2=cfg.v2;_this106.t=cfg.t;return _this106;}/**
22545
+ */function QuadraticBezierCurve(owner){var _this107;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,QuadraticBezierCurve);_this107=_callSuper(this,QuadraticBezierCurve,[owner,cfg]);_this107.v0=cfg.v0;_this107.v1=cfg.v1;_this107.v2=cfg.v2;_this107.t=cfg.t;return _this107;}/**
22290
22546
  * Sets the starting point on this QuadraticBezierCurve.
22291
22547
  *
22292
22548
  * Default value is ````[0.0, 0.0, 0.0]````.
@@ -22370,13 +22626,13 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
22370
22626
  * @param {Boolean} [cfg.active=true] Indicates whether or not this SectionBox is active.
22371
22627
  * @param {Number[]} [cfg.pos=[0,0,0]] World-space position of the SectionBox.
22372
22628
  * @param {Number[]} [cfg.dir=[0,0,-1]] Vector perpendicular to the plane surface, indicating the SectionBox plane orientation.
22373
- */function SectionBox(owner){var _this107;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionBox);_this107=_callSuper(this,SectionBox,[owner,cfg]);_this107._state=new RenderState({active:true,pos:math.vec3(),dir:math.vec3(),dist:0});_this107.active=cfg.active?cfg.active:true;_this107.pickable=cfg.pickable?cfg.pickable:false;_this107.enableClip=cfg.enableClip?cfg.enableClip:true;_this107.controlIdName=cfg.controlIdName?cfg.controlIdName:"";_this107.lineBox=cfg.lineBox?cfg.lineBox:null;_this107.visible=false;_this107.planes=[];_this107.boxRanges=[];_this107.scene._sectionBoxCreated(_this107);_this107._initBoxPlanes();return _this107;}_inherits(SectionBox,_Component37);return _createClass(SectionBox,[{key:"type",get:/**
22629
+ */function SectionBox(owner){var _this108;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionBox);_this108=_callSuper(this,SectionBox,[owner,cfg]);_this108._state=new RenderState({active:true,pos:math.vec3(),dir:math.vec3(),dist:0});_this108.active=cfg.active?cfg.active:true;_this108.pickable=cfg.pickable?cfg.pickable:false;_this108.enableClip=cfg.enableClip?cfg.enableClip:true;_this108.controlIdName=cfg.controlIdName?cfg.controlIdName:"";_this108.lineBox=cfg.lineBox?cfg.lineBox:null;_this108.visible=false;_this108.planes=[];_this108.boxRanges=[];_this108.scene._sectionBoxCreated(_this108);_this108._initBoxPlanes();return _this108;}_inherits(SectionBox,_Component37);return _createClass(SectionBox,[{key:"type",get:/**
22374
22630
  @private
22375
- */function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var _this108=this;var self=this;var aabb=this.scene.aabb;var center=this.scene.center;var xRange=aabb[3]-aabb[0];//前后
22631
+ */function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var _this109=this;var self=this;var aabb=this.scene.aabb;var center=this.scene.center;var xRange=aabb[3]-aabb[0];//前后
22376
22632
  var yRange=aabb[4]-aabb[1];//上下
22377
22633
  var zRange=aabb[5]-aabb[2];//左右
22378
22634
  // let offset = 0.21;
22379
- var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRange+offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 1:rateDis=1*yRange+offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 2:rateDis=1*zRange+offset;return[center[0],center[1],center[2]-zRange/2+rateDis];case 3:rateDis=0*xRange-offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 4:rateDis=0*yRange-offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 5:rateDis=0*zRange-offset;return[center[0],center[1],center[2]-zRange/2+rateDis];}}function getDir(num){switch(num){case 0:return[-1,0,0];case 1:return[0,-1,0];case 2:return[0,0,-1];case 3:return[1,0,0];case 4:return[0,1,0];case 5:return[0,0,1];}}var _loop2=function _loop2(_i479){_this108.boxRanges.push(getPos(_i479));var dir=getDir(_i479);var sectionPlane=new SectionPlane(_this108.scene,{active:_this108.active,controlId:_this108.controlIdName+_i479.toString(),planeId:_i479,box:self,dir:dir,pos:getPos(_i479),enableClip:_this108.enableClip,pickable:_this108.pickable});_this108.planes.push(sectionPlane);if(_i479==5){_this108.lineBox._maxRange=_this108.boxRanges;}sectionPlane.on("pos",function(pos){if(pos==_this108.boxRanges[_i479])return;if(_this108.boxRanges.length<6)return;_this108.lineBox.updateBox(sectionPlane.dir,_this108.boxRanges);});};for(var _i479=0;_i479<6;_i479++){_loop2(_i479);}}/**
22635
+ var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRange+offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 1:rateDis=1*yRange+offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 2:rateDis=1*zRange+offset;return[center[0],center[1],center[2]-zRange/2+rateDis];case 3:rateDis=0*xRange-offset;return[center[0]-xRange/2+rateDis,center[1],center[2]];case 4:rateDis=0*yRange-offset;return[center[0],center[1]-yRange/2+rateDis,center[2]];case 5:rateDis=0*zRange-offset;return[center[0],center[1],center[2]-zRange/2+rateDis];}}function getDir(num){switch(num){case 0:return[-1,0,0];case 1:return[0,-1,0];case 2:return[0,0,-1];case 3:return[1,0,0];case 4:return[0,1,0];case 5:return[0,0,1];}}var _loop2=function _loop2(_i479){_this109.boxRanges.push(getPos(_i479));var dir=getDir(_i479);var sectionPlane=new SectionPlane(_this109.scene,{active:_this109.active,controlId:_this109.controlIdName+_i479.toString(),planeId:_i479,box:self,dir:dir,pos:getPos(_i479),enableClip:_this109.enableClip,pickable:_this109.pickable});_this109.planes.push(sectionPlane);if(_i479==5){_this109.lineBox._maxRange=_this109.boxRanges;}sectionPlane.on("pos",function(pos){if(pos==_this109.boxRanges[_i479])return;if(_this109.boxRanges.length<6)return;_this109.lineBox.updateBox(sectionPlane.dir,_this109.boxRanges);});};for(var _i479=0;_i479<6;_i479++){_loop2(_i479);}}/**
22380
22636
  * Sets if this SectionBox is active or not.
22381
22637
  *
22382
22638
  * Default value is ````true````.
@@ -22410,7 +22666,7 @@ var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRang
22410
22666
  * @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
22411
22667
  * @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
22412
22668
  * @param {Boolean} [cfg.active=true] True when this Skybox is visible.
22413
- */function Skybox(owner){var _this109;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Skybox);_this109=_callSuper(this,Skybox,[owner,cfg]);_this109._skyboxMesh=new Mesh(_this109,{geometry:new ReadableGeometry(_this109,{// Box-shaped geometry
22669
+ */function Skybox(owner){var _this110;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Skybox);_this110=_callSuper(this,Skybox,[owner,cfg]);_this110._skyboxMesh=new Mesh(_this110,{geometry:new ReadableGeometry(_this110,{// Box-shaped geometry
22414
22670
  primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 front
22415
22671
  1,1,1,1,-1,1,1,-1,-1,1,1,-1,// v0-v3-v4-v5 right
22416
22672
  1,1,1,1,1,-1,-1,1,-1,-1,1,1,// v0-v5-v6-v1 top
@@ -22418,10 +22674,10 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
22418
22674
  -1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
22419
22675
  1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
22420
22676
  ],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:true,scale:[2000,2000,2000],// Overridden when we initialize the 'size' property, below
22421
- rotation:[0,-90,0],material:new PhongMaterial(_this109,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this109,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
22677
+ rotation:[0,-90,0],material:new PhongMaterial(_this110,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this110,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
22422
22678
  }),// stationary: true,
22423
- visible:false,pickable:false,clippable:false,collidable:false});_this109.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
22424
- _this109.active=cfg.active;return _this109;}/**
22679
+ visible:false,pickable:false,clippable:false,collidable:false});_this110.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
22680
+ _this110.active=cfg.active;return _this110;}/**
22425
22681
  * Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.
22426
22682
  *
22427
22683
  * Default value is ````1000````.
@@ -22486,10 +22742,10 @@ var eyeTargetVec=math.subVec3(optionalTargetWorldPos,camera.eye,tempVec3a$4);var
22486
22742
  var worldPos1=this._unproject(targetCanvasPos,tempVec4a$2);camera.ortho.scale=camera.ortho.scale-dollyDelta;camera.ortho._update();// HACK
22487
22743
  var worldPos2=this._unproject(targetCanvasPos,tempVec4b$2);var _offset=math.subVec3(worldPos2,worldPos1,tempVec4c$1);var eyeLookMoveVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(camera.look,camera.eye,tempVec3a$4)),-dollyDelta,tempVec3b$3);var _moveVec=math.addVec3(_offset,eyeLookMoveVec,tempVec3c$2);camera.eye=[camera.eye[0]-_moveVec[0],camera.eye[1]-_moveVec[1],camera.eye[2]-_moveVec[2]];camera.look=[camera.look[0]-_moveVec[0],camera.look[1]-_moveVec[1],camera.look[2]-_moveVec[2]];}return dolliedThroughSurface;}},{key:"_unproject",value:function _unproject(canvasPos,worldPos){var camera=this._scene.camera;var transposedProjectMat=camera.project.transposedMatrix;var Pt3=transposedProjectMat.subarray(8,12);var Pt4=transposedProjectMat.subarray(12);var D=[0,0,-1.0,1];var screenZ=math.dotVec4(D,Pt3)/math.dotVec4(D,Pt4);camera.project.unproject(canvasPos,screenZ,screenPos,viewPos,worldPos);return worldPos;}},{key:"destroy",value:function destroy(){}}]);}();var tempVec3a$3=math.vec3();var tempVec3b$2=math.vec3();var tempVec3c$1=math.vec3();var tempVec4a$1=math.vec4();var tempVec4b$1=math.vec4();var tempVec4c=math.vec4();/** @private */var PivotController=/*#__PURE__*/function(){/**
22488
22744
  * @private
22489
- */function PivotController(scene,configs){var _this110=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
22745
+ */function PivotController(scene,configs){var _this111=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
22490
22746
  this._scene=scene;this._configs=configs;this._pivotWorldPos=math.vec3();this._cameraOffset=math.vec3();this._azimuth=0;this._polar=0;this._radius=0;this._pivotPosSet=false;// Initially false, true as soon as _pivotWorldPos has been set to some value
22491
22747
  this._pivoting=false;// True while pivoting
22492
- this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this110._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this110._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this110.updatePivotElement();_this110.updatePivotSphere();});}return _createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"getPointScreenPos",value:function getPointScreenPos(pos){var camera=this._scene.camera;var canvas=this._scene.canvas;var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];var pos11=math.vec4();var pos22=math.vec4();var screenPos=math.vec2();math.transformPoint3(camera.viewMatrix,pos,pos11);math.transformPoint4(camera.projMatrix,pos,pos22);screenPos[0]=Math.floor((1+pos22[0]/pos22[3])*canvasWidth/2);screenPos[1]=Math.floor((1-pos22[1]/pos22[3])*canvasHeight/2);return screenPos;}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
22748
+ this._shown=false;this._pivotSphereEnabled=false;this._pivotSphere=null;this._pivotSphereSize=1;this._pivotSphereGeometry=null;this._pivotSphereMaterial=null;this._rtcCenter=math.vec3();this._rtcPos=math.vec3();this._pivotViewPos=math.vec4();this._pivotProjPos=math.vec4();this._pivotCanvasPos=math.vec2();this._cameraDirty=true;this._onViewMatrix=this._scene.camera.on("viewMatrix",function(){_this111._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this111._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this111.updatePivotElement();_this111.updatePivotSphere();});}return _createClass(PivotController,[{key:"createPivotSphere",value:function createPivotSphere(){var currentPos=this.getPivotPos();var cameraPos=math.vec3();math.decomposeMat4(math.inverseMat4(this._scene.viewer.camera.viewMatrix,math.mat4()),cameraPos,math.vec4(),math.vec3());var length=math.distVec3(cameraPos,currentPos);var radius=Math.tan(Math.PI/500)*length*this._pivotSphereSize;if(this._scene.camera.projection=="ortho"){radius/=this._scene.camera.ortho.scale/2;}worldToRTCPos(currentPos,this._rtcCenter,this._rtcPos);this._pivotSphereGeometry=new VBOGeometry(this._scene,buildSphereGeometry({radius:radius}));this._pivotSphere=new Mesh(this._scene,{geometry:this._pivotSphereGeometry,material:this._pivotSphereMaterial,pickable:false,position:this._rtcPos,rtcCenter:this._rtcCenter});}},{key:"destroyPivotSphere",value:function destroyPivotSphere(){if(this._pivotSphere){this._pivotSphere.destroy();this._pivotSphere=null;}if(this._pivotSphereGeometry){this._pivotSphereGeometry.destroy();this._pivotSphereGeometry=null;}}},{key:"getPointScreenPos",value:function getPointScreenPos(pos){var camera=this._scene.camera;var canvas=this._scene.canvas;var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];var pos11=math.vec4();var pos22=math.vec4();var screenPos=math.vec2();math.transformPoint3(camera.viewMatrix,pos,pos11);math.transformPoint4(camera.projMatrix,pos,pos22);screenPos[0]=Math.floor((1+pos22[0]/pos22[3])*canvasWidth/2);screenPos[1]=Math.floor((1-pos22[1]/pos22[3])*canvasHeight/2);return screenPos;}},{key:"updatePivotElement",value:function updatePivotElement(){var camera=this._scene.camera;var canvas=this._scene.canvas;if(this._pivoting&&this._cameraDirty){math.transformPoint3(camera.viewMatrix,this.getPivotPos(),this._pivotViewPos);this._pivotViewPos[3]=1;math.transformPoint4(camera.projMatrix,this._pivotViewPos,this._pivotProjPos);var canvasAABB=canvas.boundary;var canvasWidth=canvasAABB[2];var canvasHeight=canvasAABB[3];this._pivotCanvasPos[0]=Math.floor((1+this._pivotProjPos[0]/this._pivotProjPos[3])*canvasWidth/2);this._pivotCanvasPos[1]=Math.floor((1-this._pivotProjPos[1]/this._pivotProjPos[3])*canvasHeight/2);// data-textures: avoid to do continuous DOM layout calculations
22493
22749
  var canvasBoundingRect=canvas._lastBoundingClientRect;var canvasElem=canvas.canvas;canvasBoundingRect=canvas._lastBoundingClientRect=canvasElem.getBoundingClientRect();if(this._pivotElement){this._pivotElement.style.left=Math.floor(canvasBoundingRect.left+this._pivotCanvasPos[0])-this._pivotElement.clientWidth/2+window.scrollX;this._pivotElement.style.top=Math.floor(canvasBoundingRect.top+this._pivotCanvasPos[1])-this._pivotElement.clientHeight/2+window.scrollY;}this._cameraDirty=false;}}},{key:"updatePivotSphere",value:function updatePivotSphere(){if(this._pivoting&&this._pivotSphere){worldToRTCPos(this.getPivotPos(),this._rtcCenter,this._rtcPos);if(!math.compareVec3(this._rtcPos,this._pivotSphere.position)){this.destroyPivotSphere();this.createPivotSphere();}}}/**
22494
22750
  * Sets the HTML DOM element that will represent the pivot position.
22495
22751
  *
@@ -22590,41 +22846,41 @@ pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},t
22590
22846
  */var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;this.input=scene.input;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;// 点击键盘切换相机方向
22591
22847
  if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b$1),tempVec3c));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a$2),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b$1)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}return _createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this.input.off(this._onSceneKeyDown);}}]);}();/**
22592
22848
  * @private
22593
- */var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this111=this;_classCallCheck(this,MousePickHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var cameraControl=controllers.cameraControl;this._clicks=0;this._timeout=null;this._lastPickedEntityId=null;this._lastClickedWorldPos=null;var leftDown=false;var rightDown=false;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult&&pickResult.entity?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
22849
+ */var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this112=this;_classCallCheck(this,MousePickHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var cameraControl=controllers.cameraControl;this._clicks=0;this._timeout=null;this._lastPickedEntityId=null;this._lastClickedWorldPos=null;var leftDown=false;var rightDown=false;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult&&pickResult.entity?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
22594
22850
  var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({// look: pos,
22595
22851
  // eye: xeokit.math.addVec3(pos, diff, []),
22596
22852
  // up: camera.up,
22597
22853
  aabb:aabb});// TODO: Option to back off to fit AABB in view
22598
22854
  }else{// Fly to fit target boundary in view
22599
- controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction2=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction2);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction2,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this111._lastPickedEntityId!==pickedEntityId){if(_this111._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22600
- entity:scene.objects[_this111._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
22601
- _this111._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
22602
- cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this111._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22603
- entity:scene.objects[_this111._lastPickedEntityId]},true);_this111._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
22855
+ controllers.cameraFlight.flyTo({aabb:aabb});}};var tickifiedMouseMoveFn=scene.tickify(this._canvasMouseMoveHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}if(leftDown||rightDown){return;}if(cameraControl.hasSubs("rayMove")){var origin=math.vec3();var _direction2=math.vec3();math.canvasPosToWorldRay(scene.canvas.canvas,scene.camera.viewMatrix,scene.camera.projMatrix,scene.camera.projection,states.pointerCanvasPos,origin,_direction2);cameraControl.fire("rayMove",{canvasPos:states.pointerCanvasPos,ray:{origin:origin,direction:_direction2,canvasPos:states.pointerCanvasPos}},true);}var hoverSubs=cameraControl.hasSubs("hover");var hoverEnterSubs=cameraControl.hasSubs("hoverEnter");var hoverOutSubs=cameraControl.hasSubs("hoverOut");var hoverOffSubs=cameraControl.hasSubs("hoverOff");var hoverSurfaceSubs=cameraControl.hasSubs("hoverSurface");var hoverSnapOrSurfaceSubs=cameraControl.hasSubs("hoverSnapOrSurface");if(hoverSubs||hoverEnterSubs||hoverOutSubs||hoverOffSubs||hoverSurfaceSubs||hoverSnapOrSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=hoverSurfaceSubs;pickController.scheduleSnapOrPick=hoverSnapOrSurfaceSubs;pickController.update();if(pickController.pickResult){if(pickController.pickResult.entity){var pickedEntityId=pickController.pickResult.entity.id;if(_this112._lastPickedEntityId!==pickedEntityId){if(_this112._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22856
+ entity:scene.objects[_this112._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
22857
+ _this112._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
22858
+ cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this112._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
22859
+ entity:scene.objects[_this112._lastPickedEntityId]},true);_this112._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
22604
22860
  canvasPos:pickController.pickCursorPos},true);}}});this.canvas.addEventListener("mousemove",tickifiedMouseMoveFn);this.canvas.addEventListener("dblclick",this._canvasDblClickHandler=function(e){states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
22605
22861
  pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();}var pickResult=pickController.pickResult;if(pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);}});this.canvas.addEventListener("mousedown",this._canvasMouseDownHandler=function(e){if(e.which===1){leftDown=true;}if(e.which===3){rightDown=true;}var leftButtonDown=e.which===1;if(!leftButtonDown){return;}if(!(configs.active&&configs.pointerEnabled)){return;}// Left mouse button down to start pivoting
22606
22862
  states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(!configs.firstPerson&&configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
22607
22863
  pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(e.which===1){// Left button
22608
22864
  var pickResult=pickController.pickResult;if(pickResult&&pickResult.worldPos){pivotController.setCanvasPivotPos(states.pointerCanvasPos);// pivotController.startPivot(); // 显示pivot
22609
- cameraControl.fire("mouseDownEntity",pickController.pickResult,true);_this111._lastClickedWorldPos=pickResult.worldPos;}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{if(_this111._lastClickedWorldPos){pivotController.setPivotPos(_this111._lastClickedWorldPos);}else{pivotController.setPivotPos(scene.camera.look);}}pivotController.startPivot();cameraControl.fire("mouseDownNothing",pickController.pickResult,true);}}}});document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(e.which===1){leftDown=false;}if(e.which===3){rightDown=false;}if(pivotController.getPivoting()){pivotController.endPivot();}});this.canvas.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var leftButtonUp=e.which===1;if(!leftButtonUp){return;}// Left mouse button up to possibly pick or double-pick
22865
+ cameraControl.fire("mouseDownEntity",pickController.pickResult,true);_this112._lastClickedWorldPos=pickResult.worldPos;}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{if(_this112._lastClickedWorldPos){pivotController.setPivotPos(_this112._lastClickedWorldPos);}else{pivotController.setPivotPos(scene.camera.look);}}pivotController.startPivot();cameraControl.fire("mouseDownNothing",pickController.pickResult,true);}}}});document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(e.which===1){leftDown=false;}if(e.which===3){rightDown=false;}if(pivotController.getPivoting()){pivotController.endPivot();}});this.canvas.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var leftButtonUp=e.which===1;if(!leftButtonUp){return;}// Left mouse button up to possibly pick or double-pick
22610
22866
  pivotController.hidePivot();if(Math.abs(e.clientX-states.mouseDownClientX)>3||Math.abs(e.clientY-states.mouseDownClientY)>3){return;}var pickedSubs=cameraControl.hasSubs("picked");var pickedNothingSubs=cameraControl.hasSubs("pickedNothing");var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");var doublePickedSubs=cameraControl.hasSubs("doublePicked");var doublePickedSurfaceSubs=cameraControl.hasSubs("doublePickedSurface");var doublePickedNothingSubs=cameraControl.hasSubs("doublePickedNothing");if(!configs.doublePickFlyTo&&!doublePickedSubs&&!doublePickedSurfaceSubs&&!doublePickedNothingSubs){// Avoid the single/double click differentiation timeout
22611
- if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("picked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}}_this111._clicks=0;// clickedEntity = null;
22612
- return;}_this111._clicks++;if(_this111._clicks===1){// First click
22613
- pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this111._timeout=setTimeout(function(){if(firstClickPickResult&&firstClickPickResult.worldPos){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);// if (configs.followPointer) {
22614
- if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this111._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
22615
- if(_this111._timeout!==null){window.clearTimeout(_this111._timeout);_this111._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this111._clicks=0;}},false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
22867
+ if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("picked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}}_this112._clicks=0;// clickedEntity = null;
22868
+ return;}_this112._clicks++;if(_this112._clicks===1){// First click
22869
+ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this112._timeout=setTimeout(function(){if(firstClickPickResult&&firstClickPickResult.worldPos){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);// if (configs.followPointer) {
22870
+ if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this112._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
22871
+ if(_this112._timeout!==null){window.clearTimeout(_this112._timeout);_this112._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this112._clicks=0;}},false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
22616
22872
  * @private
22617
- */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this112=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;this._cameraControl=cameraControl;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=6;this._movespeedList=[0.02,0.05,0.1,0.2,0.3,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,8.0,10.0,12.0,16.0,24.0,32.0];var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}if(keyCode===input.KEY_EQUAL_SIGN){if(!enableSetSpeedUp){enableSetSpeedUp=true;}}if(keyCode===input.KEY_DASH){if(!enableSetSpeedDown){enableSetSpeedDown=true;}}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
22873
+ */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this113=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;this._cameraControl=cameraControl;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=6;this._movespeedList=[0.02,0.05,0.1,0.2,0.3,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,8.0,10.0,12.0,16.0,24.0,32.0];var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}if(keyCode===input.KEY_EQUAL_SIGN){if(!enableSetSpeedUp){enableSetSpeedUp=true;}}if(keyCode===input.KEY_DASH){if(!enableSetSpeedDown){enableSetSpeedDown=true;}}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
22618
22874
  var enableForward=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableForward=!collideWithEntity;});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
22619
22875
  // Keyboard rotation
22620
22876
  //-------------------------------------------------------------------------------------------------
22621
- if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta*_this112._movespeedList[_this112._movespeed];}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this112._movespeedList[_this112._movespeed];}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this112._movespeedList[_this112._movespeed];}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this112._movespeedList[_this112._movespeed];}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
22877
+ if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta*_this113._movespeedList[_this113._movespeed];}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this113._movespeedList[_this113._movespeed];}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this113._movespeedList[_this113._movespeed];}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this113._movespeedList[_this113._movespeed];}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
22622
22878
  // Keyboard panning
22623
22879
  //-------------------------------------------------------------------------------------------------
22624
- if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta*_this112._movespeedList[_this112._movespeed];}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this112._movespeedList[_this112._movespeed];}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
22625
- var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this112._movespeed<_this112._movespeedList.length-1){_this112._movespeed+=1;}_this112._cameraControl.fire("personModeSpeedUp",_this112._movespeedList[_this112._movespeed]);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this112._movespeed>0){_this112._movespeed-=1;}_this112._cameraControl.fire("personModeSpeedDown",_this112._movespeedList[_this112._movespeed]);enableSetSpeedDown=false;}}//判断是否能用
22880
+ if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta*_this113._movespeedList[_this113._movespeed];}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this113._movespeedList[_this113._movespeed];}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
22881
+ var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this113._movespeed<_this113._movespeedList.length-1){_this113._movespeed+=1;}_this113._cameraControl.fire("personModeSpeedUp",_this113._movespeedList[_this113._movespeed]);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this113._movespeed>0){_this113._movespeed-=1;}_this113._cameraControl.fire("personModeSpeedDown",_this113._movespeedList[_this113._movespeed]);enableSetSpeedDown=false;}}//判断是否能用
22626
22882
  var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);// const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate
22627
- var panDelta=_this112._movespeedList[_this112._movespeed]*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
22883
+ var panDelta=_this113._movespeedList[_this113._movespeed]*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
22628
22884
  if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}return _createClass(KeyboardPanRotateDollyHandler,[{key:"movespeed",get:function get(){return this._movespeed;},set:function set(value){this._movespeed=value;}},{key:"moveRate",get:function get(){return this._movespeedList[this._movespeed];}},{key:"speedUp",value:function speedUp(){if(this._movespeed<this._movespeedList.length-1){this._movespeed+=1;}this._cameraControl.fire("personModeSpeedUp",this._movespeedList[this._movespeed]);}},{key:"speedDown",value:function speedDown(){if(this._movespeed>0){this._movespeed-=1;}this._cameraControl.fire("personModeSpeedDown",this._movespeedList[this._movespeed]);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this.input.off(this._onSceneMouseMove);this.input.off(this._onSceneKeyDown);this.input.off(this._onSceneKeyUp);}}]);}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
22629
22885
  var EPSILON=0.001;var tempVec3$1=math.vec3();/**
22630
22886
  * Handles camera updates on each "tick" that were scheduled by the various controllers.
@@ -22663,13 +22919,13 @@ if(Math.abs(updates.panDeltaX)<EPSILON*dynamicEPSILON){updates.panDeltaX=0;}if(M
22663
22919
  if(dollyDeltaForDist!==0){if(dollyDeltaForDist<0){cursorType="zoom-in";}else{cursorType="zoom-out";}if(configs.firstPerson){var _verticalEye;var _verticalLook;if(configs.constrainVertical){if(camera.xUp){_verticalEye=camera.eye[0];_verticalLook=camera.look[0];}else if(camera.yUp){_verticalEye=camera.eye[1];_verticalLook=camera.look[1];}else if(camera.zUp){_verticalEye=camera.eye[2];_verticalLook=camera.look[2];}}if(configs.followPointer){var dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.pan([0,0,dollyDeltaForDist]);camera.ortho.scale=camera.ortho.scale-dollyDeltaForDist;}if(configs.constrainVertical){var _eye=camera.eye;var _look=camera.look;if(camera.xUp){_eye[0]=_verticalEye;_look[0]=_verticalLook;}else if(camera.yUp){_eye[1]=_verticalEye;_look[1]=_verticalLook;}else if(camera.zUp){_eye[2]=_verticalEye;_look[2]=_verticalLook;}camera.eye=_eye;camera.look=_look;}}else if(configs.planView){if(configs.followPointer){var _dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}else{// Orbiting
22664
22920
  if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface2){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}updates.dollyDelta*=configs.dollyInertia;}pickController.fireEvents();if(!viewer.navCube.MOUSEDOWN&&!viewer.navCube.MOUSEOVER){document.body.style.cursor=cursorType;}});}return _createClass(CameraUpdater,[{key:"destroy",value:function destroy(){this._scene.off(this._onTick);}}]);}();/**
22665
22921
  * @private
22666
- */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this113=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this113.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this113.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this113.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
22922
+ */var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this114=this;_classCallCheck(this,MouseMiscHandler);this._scene=scene;this.canvas=this._scene.canvas.canvas;this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});this.canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;_this114.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this114.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this114.canvas,states.pointerCanvasPos);states.mouseover=true;});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}return _createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){//网络问题导致的模型加载失败等情况时,如果切换模型,会找不到canvas
22667
22923
  //因此暂时在此加判断
22668
22924
  if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);}document.removeEventListener("mousemove",this._mouseMoveHandler);}}]);}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),x=_canvas$getBoundingCl.x,y=_canvas$getBoundingCl.y;canvasPos[0]=event.clientX-x;canvasPos[1]=event.clientY-y;}return canvasPos;}var getCanvasPosFromEvent$1=function getCanvasPosFromEvent$1(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22669
22925
  * @private
22670
- */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this114=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
22926
+ */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this115=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
22671
22927
  pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
22672
- }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i480=0,len=touches.length;_i480<len;++_i480){getCanvasPosFromEvent$1(touches[_i480],lastCanvasTouchPosList[_i480]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this114._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22928
+ }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i480=0,len=touches.length;_i480<len;++_i480){getCanvasPosFromEvent$1(touches[_i480],lastCanvasTouchPosList[_i480]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this115._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22673
22929
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
22674
22930
  var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
22675
22931
  // We don't want to rotate in this case (weird behavior)
@@ -22678,7 +22934,7 @@ return;}if(numTouches===1){getCanvasPosFromEvent$1(touches[0],tapCanvasPos0);//-
22678
22934
  //-----------------------------------------------------------------------------------------------
22679
22935
  math.subVec2(tapCanvasPos0,lastCanvasTouchPosList[0],touch0Vec);var xPanDelta=touch0Vec[0];var yPanDelta=touch0Vec[1];if(states.longTouchTimeout!==null&&(Math.abs(xPanDelta)>configs.longTapRadius||Math.abs(yPanDelta)>configs.longTapRadius)){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}if(configs.planView){// No rotating in plan-view mode
22680
22936
  var camera=scene.camera;// We use only canvasHeight here so that aspect ratio does not distort speed
22681
- if(camera.projection==="perspective"){var depth=Math.abs(scene.camera.eyeLookDist);var targetDistance=depth*Math.tan(camera.perspective.fov/2*Math.PI/180.0);updates.panDeltaX+=xPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;updates.panDeltaY+=yPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;}else{updates.panDeltaX+=0.5*camera.ortho.scale*(xPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;updates.panDeltaY+=0.5*camera.ortho.scale*(yPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;}}else{// if (!absorbTinyFirstDrag) {
22937
+ if(camera.projection==="perspective"){var depth=Math.abs(scene.camera.eyeLookDist);var targetDistance=depth*Math.tan(camera.perspective.fov/2*Math.PI/180.0);updates.panDeltaX+=xPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;updates.panDeltaY+=yPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;}else{updates.panDeltaX+=0.5*camera.ortho.scale*(xPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;updates.panDeltaY+=0.5*camera.ortho.scale*(yPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;}}else{// if (!absorbTinyFirstDrag) {
22682
22938
  updates.rotateDeltaY-=xPanDelta/canvasWidth*(configs.dragRotationRate*1.0);// Full horizontal rotation
22683
22939
  updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// Half vertical rotation
22684
22940
  // } else {
@@ -22693,8 +22949,8 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
22693
22949
  // }
22694
22950
  // }
22695
22951
  }}else if(numTouches===2){pivotController.hidePivot();var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,tapCanvasPos1);var lastMiddleTouch=math.geometricMeanVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var currentMiddleTouch=math.geometricMeanVec2(tapCanvasPos0,tapCanvasPos1);var touchDelta=math.vec2();math.subVec2(lastMiddleTouch,currentMiddleTouch,touchDelta);var _xPanDelta=touchDelta[0];var _yPanDelta=touchDelta[1];var _camera2=scene.camera;// Dollying
22696
- var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate*_this114._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
22697
- if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this114._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this114._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i481=0;_i481<numTouches;++_i481){getCanvasPosFromEvent$1(touches[_i481],lastCanvasTouchPosList[_i481]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"dollyspeed",get:function get(){return this._dollyspeed;},set:function set(speed){if(speed<=0)return;this._dollyspeed=+speed.toFixed(1);this._cameraControl.fire("touchDollySpeed",this._dollyspeed);}},{key:"panspeed",get:function get(){return this._panspeed;},set:function set(speed){if(speed<=0)return;this._panspeed=+speed.toFixed(1);this._cameraControl.fire("touchPanSpeed",this._panspeed);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22952
+ var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate*_this115._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
22953
+ if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this115._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this115._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i481=0;_i481<numTouches;++_i481){getCanvasPosFromEvent$1(touches[_i481],lastCanvasTouchPosList[_i481]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"dollyspeed",get:function get(){return this._dollyspeed;},set:function set(speed){if(speed<=0)return;this._dollyspeed=+speed.toFixed(1);this._cameraControl.fire("touchDollySpeed",this._dollyspeed);}},{key:"panspeed",get:function get(){return this._panspeed;},set:function set(speed){if(speed<=0)return;this._panspeed=+speed.toFixed(1);this._cameraControl.fire("touchPanSpeed",this._panspeed);}},{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
22698
22954
  * @private
22699
22955
  */var TouchPickHandler=/*#__PURE__*/function(){function TouchPickHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPickHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var touchStartTime;var activeTouches=[];var tapStartPos=new Float32Array(2);var tapStartTime=-1;var lastTapTime=-1;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
22700
22956
  var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({aabb:aabb});// TODO: Option to back off to fit AABB in view
@@ -23175,81 +23431,81 @@ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=
23175
23431
  */var CameraControl=/*#__PURE__*/function(_Component39){/**
23176
23432
  * @private
23177
23433
  * @constructor
23178
- */function CameraControl(owner){var _this115;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this115=_callSuper(this,CameraControl,[owner,cfg]);/**
23434
+ */function CameraControl(owner){var _this116;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this116=_callSuper(this,CameraControl,[owner,cfg]);/**
23179
23435
  * Identifies the XX action.
23180
23436
  * @final
23181
23437
  * @type {Number}
23182
- */_this115.PAN_LEFT=0;/**
23438
+ */_this116.PAN_LEFT=0;/**
23183
23439
  * Identifies the XX action.
23184
23440
  * @final
23185
23441
  * @type {Number}
23186
- */_this115.PAN_RIGHT=1;/**
23442
+ */_this116.PAN_RIGHT=1;/**
23187
23443
  * Identifies the XX action.
23188
23444
  * @final
23189
23445
  * @type {Number}
23190
- */_this115.PAN_UP=2;/**
23446
+ */_this116.PAN_UP=2;/**
23191
23447
  * Identifies the XX action.
23192
23448
  * @final
23193
23449
  * @type {Number}
23194
- */_this115.PAN_DOWN=3;/**
23450
+ */_this116.PAN_DOWN=3;/**
23195
23451
  * Identifies the XX action.
23196
23452
  * @final
23197
23453
  * @type {Number}
23198
- */_this115.PAN_FORWARDS=4;/**
23454
+ */_this116.PAN_FORWARDS=4;/**
23199
23455
  * Identifies the XX action.
23200
23456
  * @final
23201
23457
  * @type {Number}
23202
- */_this115.PAN_BACKWARDS=5;/**
23458
+ */_this116.PAN_BACKWARDS=5;/**
23203
23459
  * Identifies the XX action.
23204
23460
  * @final
23205
23461
  * @type {Number}
23206
- */_this115.ROTATE_X_POS=6;/**
23462
+ */_this116.ROTATE_X_POS=6;/**
23207
23463
  * Identifies the XX action.
23208
23464
  * @final
23209
23465
  * @type {Number}
23210
- */_this115.ROTATE_X_NEG=7;/**
23466
+ */_this116.ROTATE_X_NEG=7;/**
23211
23467
  * Identifies the XX action.
23212
23468
  * @final
23213
23469
  * @type {Number}
23214
- */_this115.ROTATE_Y_POS=8;/**
23470
+ */_this116.ROTATE_Y_POS=8;/**
23215
23471
  * Identifies the XX action.
23216
23472
  * @final
23217
23473
  * @type {Number}
23218
- */_this115.ROTATE_Y_NEG=9;/**
23474
+ */_this116.ROTATE_Y_NEG=9;/**
23219
23475
  * Identifies the XX action.
23220
23476
  * @final
23221
23477
  * @type {Number}
23222
- */_this115.DOLLY_FORWARDS=10;/**
23478
+ */_this116.DOLLY_FORWARDS=10;/**
23223
23479
  * Identifies the XX action.
23224
23480
  * @final
23225
23481
  * @type {Number}
23226
- */_this115.DOLLY_BACKWARDS=11;/**
23482
+ */_this116.DOLLY_BACKWARDS=11;/**
23227
23483
  * Identifies the XX action.
23228
23484
  * @final
23229
23485
  * @type {Number}
23230
- */_this115.AXIS_VIEW_RIGHT=12;/**
23486
+ */_this116.AXIS_VIEW_RIGHT=12;/**
23231
23487
  * Identifies the XX action.
23232
23488
  * @final
23233
23489
  * @type {Number}
23234
- */_this115.AXIS_VIEW_BACK=13;/**
23490
+ */_this116.AXIS_VIEW_BACK=13;/**
23235
23491
  * Identifies the XX action.
23236
23492
  * @final
23237
23493
  * @type {Number}
23238
- */_this115.AXIS_VIEW_LEFT=14;/**
23494
+ */_this116.AXIS_VIEW_LEFT=14;/**
23239
23495
  * Identifies the XX action.
23240
23496
  * @final
23241
23497
  * @type {Number}
23242
- */_this115.AXIS_VIEW_FRONT=15;/**
23498
+ */_this116.AXIS_VIEW_FRONT=15;/**
23243
23499
  * Identifies the XX action.
23244
23500
  * @final
23245
23501
  * @type {Number}
23246
- */_this115.AXIS_VIEW_TOP=16;/**
23502
+ */_this116.AXIS_VIEW_TOP=16;/**
23247
23503
  * Identifies the XX action.
23248
23504
  * @final
23249
23505
  * @type {Number}
23250
- */_this115.AXIS_VIEW_BOTTOM=17;_this115.SPEED_UP=107;_this115.SPEED_DOWN=109;_this115._keyMap={};// Maps key codes to the above actions
23251
- _this115.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
23252
- _this115.scene.on("aabb",function(aabb){var x=aabb[3]-aabb[0];var y=aabb[4]-aabb[1];var z=aabb[5]-aabb[2];var maxV=Math.max(x,y,z);var minV=Math.min(x,y,z);if(maxV>100){if(minV>20){var mouseRate=parseInt((maxV+minV)/2);_this115.mouseWheelDollyRate=mouseRate/maxV*100;}}if(maxV>50&&maxV<100){var keyRate=parseInt(maxV/20)*2;_this115.keyboardDollyRate=keyRate*15;_this115.keyboardPanRate=keyRate*1.5;}if(maxV>100&&maxV<600){var _keyRate=parseInt(maxV/50)*4;_this115.keyboardDollyRate=_keyRate*15;_this115.keyboardPanRate=_keyRate*1.5;}if(maxV>600){var _keyRate2=parseInt(maxV/100)*8;_this115.keyboardDollyRate=_keyRate2*15;_this115.keyboardPanRate=_keyRate2*1.5;}if(minV==0){var rate=parseInt((maxV+0.0001)/2*100000)/100000;_this115.mouseWheelDollyRate=rate*100;_this115.keyboardDollyRate=rate*10;_this115.keyboardPanRate=rate*1.0;return;}if((minV+maxV)/2<10){var _rate3=parseInt((maxV+minV)/2*10000)/10000/4;_this115.mouseWheelDollyRate=_rate3*100;_this115.keyboardDollyRate=_rate3*10;_this115.keyboardPanRate=_rate3*1.0;}if((minV+maxV)/2<0.1){var _rate4=parseInt((maxV+minV)/2*10000)/10000;_this115.mouseWheelDollyRate=_rate4*100;_this115.keyboardDollyRate=_rate4*10;_this115.keyboardPanRate=_rate4*1.0;}});_this115._configs={// Private
23506
+ */_this116.AXIS_VIEW_BOTTOM=17;_this116.SPEED_UP=107;_this116.SPEED_DOWN=109;_this116._keyMap={};// Maps key codes to the above actions
23507
+ _this116.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
23508
+ _this116.scene.on("aabb",function(aabb){var x=aabb[3]-aabb[0];var y=aabb[4]-aabb[1];var z=aabb[5]-aabb[2];var maxV=Math.max(x,y,z);var minV=Math.min(x,y,z);if(maxV>100){if(minV>20){var mouseRate=parseInt((maxV+minV)/2);_this116.mouseWheelDollyRate=mouseRate/maxV*100;}}if(maxV>50&&maxV<100){var keyRate=parseInt(maxV/20)*2;_this116.keyboardDollyRate=keyRate*15;_this116.keyboardPanRate=keyRate*1.5;}if(maxV>100&&maxV<600){var _keyRate=parseInt(maxV/50)*4;_this116.keyboardDollyRate=_keyRate*15;_this116.keyboardPanRate=_keyRate*1.5;}if(maxV>600){var _keyRate2=parseInt(maxV/100)*8;_this116.keyboardDollyRate=_keyRate2*15;_this116.keyboardPanRate=_keyRate2*1.5;}if(minV==0){var rate=parseInt((maxV+0.0001)/2*100000)/100000;_this116.mouseWheelDollyRate=rate*100;_this116.keyboardDollyRate=rate*10;_this116.keyboardPanRate=rate*1.0;return;}if((minV+maxV)/2<10){var _rate3=parseInt((maxV+minV)/2*10000)/10000/4;_this116.mouseWheelDollyRate=_rate3*100;_this116.keyboardDollyRate=_rate3*10;_this116.keyboardPanRate=_rate3*1.0;}if((minV+maxV)/2<0.1){var _rate4=parseInt((maxV+minV)/2*10000)/10000;_this116.mouseWheelDollyRate=_rate4*100;_this116.keyboardDollyRate=_rate4*10;_this116.keyboardPanRate=_rate4*1.0;}});_this116._configs={// Private
23253
23509
  longTapTimeout:600,// Millisecs
23254
23510
  longTapRadius:5,// Pixels
23255
23511
  // General
@@ -23257,13 +23513,13 @@ active:true,keyboardLayout:"qwerty",navMode:"orbit",planView:false,firstPerson:f
23257
23513
  dragRotationRate:360.0,keyboardRotationRate:90.0,rotationInertia:0.0,// Panning
23258
23514
  keyboardPanRate:1.0,touchPanRate:1.0,panInertia:0.5,// Dollying
23259
23515
  keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:0.2,dollyInertia:0,dollyProximityThreshold:30.0,dollyMinSpeed:0.04};// Current runtime state of the CameraControl
23260
- _this115._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
23261
- _this115._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
23262
- var scene=_this115.scene;_this115._controllers={cameraControl:_this115,pickController:new PickController(_this115,_this115._configs),pivotController:new PivotController(scene,_this115._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this115,{duration:0.5})};// Input event handlers
23263
- _this115._handlers=[new MouseMiscHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new TouchPanRotateAndDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates,_this115),new MousePanRotateDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new KeyboardAxisViewHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new MousePickHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new TouchPickHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates),new KeyboardPanRotateDollyHandler(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates,_this115)];// Applies scheduled updates to the Camera on each Scene "tick" event
23264
- _this115._cameraUpdater=new CameraUpdater(_this115.scene,_this115._controllers,_this115._configs,_this115._states,_this115._updates);// Set initial user configurations
23265
- _this115.navMode=cfg.navMode;if(cfg.planView){_this115.planView=cfg.planView;}_this115.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this115.keyboardLayout=cfg.keyboardLayout;// Deprecated
23266
- }else{_this115.keyMap=cfg.keyMap;}_this115.doublePickFlyTo=cfg.doublePickFlyTo;_this115.panRightClick=cfg.panRightClick;_this115.active=cfg.active;_this115.followPointer=cfg.followPointer;_this115.rotationInertia=cfg.rotationInertia;_this115.keyboardPanRate=cfg.keyboardPanRate;_this115.touchPanRate=cfg.touchPanRate;_this115.keyboardRotationRate=cfg.keyboardRotationRate;_this115.dragRotationRate=cfg.dragRotationRate;_this115.touchDollyRate=cfg.touchDollyRate;_this115.dollyInertia=cfg.dollyInertia;_this115.dollyProximityThreshold=cfg.dollyProximityThreshold;_this115.dollyMinSpeed=cfg.dollyMinSpeed;_this115.panInertia=cfg.panInertia;_this115.pointerEnabled=true;_this115.keyboardDollyRate=cfg.keyboardDollyRate;_this115.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this115._moveRate=1;_this115.scene.on("tick",function(){if(!(_this115._goLeft||_this115._goRight||_this115._goUp||_this115._goDown||_this115._goForward||_this115._goBackward)){return;}if(_this115._goRight){_this115._updates.panDeltaX+=-0.1*_this115._moveRate;}else if(_this115._goLeft){_this115._updates.panDeltaX+=0.1*_this115._moveRate;}if(_this115._goUp){_this115._updates.panDeltaY+=0.1*_this115._moveRate;}else if(_this115._goDown){_this115._updates.panDeltaY+=-0.1*_this115._moveRate;}if(_this115._goForward){_this115._updates.panDeltaZ+=-0.1*_this115._moveRate;}else if(_this115._goBackward){_this115._updates.panDeltaZ+=+0.1*_this115._moveRate;}});return _this115;}/**
23516
+ _this116._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
23517
+ _this116._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
23518
+ var scene=_this116.scene;_this116._controllers={cameraControl:_this116,pickController:new PickController(_this116,_this116._configs),pivotController:new PivotController(scene,_this116._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this116,{duration:0.5})};// Input event handlers
23519
+ _this116._handlers=[new MouseMiscHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new TouchPanRotateAndDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates,_this116),new MousePanRotateDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new KeyboardAxisViewHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new MousePickHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new TouchPickHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates),new KeyboardPanRotateDollyHandler(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates,_this116)];// Applies scheduled updates to the Camera on each Scene "tick" event
23520
+ _this116._cameraUpdater=new CameraUpdater(_this116.scene,_this116._controllers,_this116._configs,_this116._states,_this116._updates);// Set initial user configurations
23521
+ _this116.navMode=cfg.navMode;if(cfg.planView){_this116.planView=cfg.planView;}_this116.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this116.keyboardLayout=cfg.keyboardLayout;// Deprecated
23522
+ }else{_this116.keyMap=cfg.keyMap;}_this116.doublePickFlyTo=cfg.doublePickFlyTo;_this116.panRightClick=cfg.panRightClick;_this116.active=cfg.active;_this116.followPointer=cfg.followPointer;_this116.rotationInertia=cfg.rotationInertia;_this116.keyboardPanRate=cfg.keyboardPanRate;_this116.touchPanRate=cfg.touchPanRate;_this116.keyboardRotationRate=cfg.keyboardRotationRate;_this116.dragRotationRate=cfg.dragRotationRate;_this116.touchDollyRate=cfg.touchDollyRate;_this116.dollyInertia=cfg.dollyInertia;_this116.dollyProximityThreshold=cfg.dollyProximityThreshold;_this116.dollyMinSpeed=cfg.dollyMinSpeed;_this116.panInertia=cfg.panInertia;_this116.pointerEnabled=true;_this116.keyboardDollyRate=cfg.keyboardDollyRate;_this116.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this116._moveRate=1;_this116.scene.on("tick",function(){if(!(_this116._goLeft||_this116._goRight||_this116._goUp||_this116._goDown||_this116._goForward||_this116._goBackward)){return;}if(_this116._goRight){_this116._updates.panDeltaX+=-0.1*_this116._moveRate;}else if(_this116._goLeft){_this116._updates.panDeltaX+=0.1*_this116._moveRate;}if(_this116._goUp){_this116._updates.panDeltaY+=0.1*_this116._moveRate;}else if(_this116._goDown){_this116._updates.panDeltaY+=-0.1*_this116._moveRate;}if(_this116._goForward){_this116._updates.panDeltaZ+=-0.1*_this116._moveRate;}else if(_this116._goBackward){_this116._updates.panDeltaZ+=+0.1*_this116._moveRate;}});return _this116;}/**
23267
23523
  * 停止漫游
23268
23524
  */_inherits(CameraControl,_Component39);return _createClass(CameraControl,[{key:"setdirectionChangeCancel",value:function setdirectionChangeCancel(){this._goLeft=false;this._goRight=false;this._goUp=false;this._goDown=false;this._goForward=false;this._goBackward=false;}/**
23269
23525
  * 设置触屏缩放速率
@@ -24602,7 +24858,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
24602
24858
  * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
24603
24859
  * responsiveness. It is important to consider that each SectionPlane impacts rendering performance, so it is recommended to set this value to a quantity that aligns with
24604
24860
  * your expected usage.
24605
- */function Viewer(cfg){var _this116=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
24861
+ */function Viewer(cfg){var _this117=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
24606
24862
  * The Viewer's current language setting.
24607
24863
  * @property language
24608
24864
  * @deprecated
@@ -24647,7 +24903,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
24647
24903
  * @property cameraControl
24648
24904
  * @type {CameraControl}
24649
24905
  */this.cameraControl=new CameraControl(this.scene,{// panToPointer: true,
24650
- snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this116.cameraControl.updatePivotElement();});this._plugins=[];/**
24906
+ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this117.cameraControl.updatePivotElement();});this._plugins=[];/**
24651
24907
  * Subscriptions to events sent with {@link fire}.
24652
24908
  * @private
24653
24909
  */this._eventSubs={};}/**
@@ -24775,7 +25031,7 @@ _scale6=_i504==0?snapshotCanvas.width/_containerElement.clientWidth:1;off=math.v
24775
25031
  */)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
24776
25032
  * Destroys this Viewer.
24777
25033
  */},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
24778
- if(plugins.length>0){for(var _i505=0,len=plugins.length;_i505<len;_i505++){var plugin=plugins[_i505];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$9(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$5=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$4=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$4&&parseFloat(matches$4[1])||0;var VERSION$9="3.4.15";function assert$8(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var isBrowser$4=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches$3=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$3&&parseFloat(matches$3[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:String(i);}function _defineProperty(obj,key,value){key=toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this117=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this117._resolve=resolve;_this117._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$8(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$8(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$8(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$8(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$8(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$4?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this118=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this118.onError(new Error('No data received'));}else{_this118.onMessage(event.data);}};worker.onerror=function(error){_this118.onError(_this118._getErrorFromErrorEvent(error));_this118.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this119=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this119.onMessage(data);});worker.on('error',function(error){_this119.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$4||typeof Worker$1!=='undefined'&&!isBrowser$4;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name){var _this120=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this120.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this120;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}},_callee3,this,[[12,,15,18]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator4=_createForOfIteratorHelper(this.workerPools.values()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var workerPool=_step4.value;workerPool.destroy();}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator5=_createForOfIteratorHelper(this.workerPools.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var workerPool=_step5.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$8(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$9;assert$8(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$4&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x8,_x9,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context12.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context12.sent;job.postMessage('process',{input:data,options:options,context:context});_context12.next=12;return job.result;case 12:result=_context12.sent;_context12.next=15;return result.result;case 15:return _context12.abrupt("return",_context12.sent);case 16:case"end":return _context12.stop();}},_callee9);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:_context13.t0=type;_context13.next=_context13.t0==='done'?3:_context13.t0==='error'?5:_context13.t0==='process'?7:20;break;case 3:job.done(payload);return _context13.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context13.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context13.prev=8;_context13.next=11;return parseOnMainThread(input,options);case 11:result=_context13.sent;job.postMessage('done',{id:id,result:result});_context13.next=19;break;case 15:_context13.prev=15;_context13.t1=_context13["catch"](8);message=_context13.t1 instanceof Error?_context13.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context13.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context13.stop();}},_callee10,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i506=0;_i506<array1.length;++_i506){if(array1[_i506]!==array2[_i506]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator6=_createForOfIteratorHelper(sourceArrays),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var sourceArray=_step6.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return result.buffer;}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context14.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context14.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context14.sent).done)){_context14.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context14.next=5;break;case 13:_context14.next=19;break;case 15:_context14.prev=15;_context14.t0=_context14["catch"](3);_didIteratorError=true;_iteratorError=_context14.t0;case 19:_context14.prev=19;_context14.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context14.next=24;break;}_context14.next=24;return _iterator["return"]();case 24:_context14.prev=24;if(!_didIteratorError){_context14.next=27;break;}throw _iteratorError;case 27:return _context14.finish(24);case 28:return _context14.finish(19);case 29:return _context14.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context14.stop();}},_callee11,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:if(!isResponse(resource)){_context15.next=2;break;}return _context15.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context15.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context15.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context15.abrupt("return",response);case 16:case"end":return _context15.stop();}},_callee12);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(response){var message;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:if(response.ok){_context16.next=5;break;}_context16.next=3;return getResponseError(response);case 3:message=_context16.sent;throw new Error(message);case 5:case"end":return _context16.stop();}},_callee13);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context17.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context17.next=11;break;}_context17.t0=text;_context17.t1=" ";_context17.next=9;return response.text();case 9:_context17.t2=_context17.sent;text=_context17.t0+=_context17.t1.concat.call(_context17.t1,_context17.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context17.next=17;break;case 15:_context17.prev=15;_context17.t3=_context17["catch"](1);case 17:return _context17.abrupt("return",message);case 18:case"end":return _context17.stop();}},_callee14,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context18.next=3;break;}return _context18.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context18.next=8;break;}blobSlice=resource.slice(0,5);_context18.next=7;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 7:return _context18.abrupt("return",_context18.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context18.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context18.abrupt("return","data:base64,".concat(_base));case 12:return _context18.abrupt("return",null);case 13:case"end":return _context18.stop();}},_callee15);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i507=0;_i507<bytes.byteLength;_i507++){binary+=String.fromCharCode(bytes[_i507]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:if(!(typeof url==='string')){_context19.next=7;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context19.next=6;return fetch(url,fetchOptions);case 6:return _context19.abrupt("return",_context19.sent);case 7:_context19.next=9;return makeResponse(url);case 9:return _context19.abrupt("return",_context19.sent);case 10:case"end":return _context19.stop();}},_callee16);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser$3(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals$2={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals$2.window||globals$2.self||globals$2.global;var process_=globals$2.process||{};var VERSION$8=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser$3();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser$3&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$7(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser$3&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser$3?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$8);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$7(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser$3?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$7(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$8);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$7(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$7(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$5,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$9(loader,'null loader');assert$9(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(data){var loaders,options,context,loader,_args13=arguments;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:loaders=_args13.length>1&&_args13[1]!==undefined?_args13[1]:[];options=_args13.length>2?_args13[2]:undefined;context=_args13.length>3?_args13[3]:undefined;if(validHTTPResponse(data)){_context20.next=5;break;}return _context20.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context20.next=8;break;}return _context20.abrupt("return",loader);case 8:if(!isBlob(data)){_context20.next=13;break;}_context20.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context20.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context20.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context20.abrupt("return",loader);case 16:case"end":return _context20.stop();}},_callee17);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters$1(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters$1(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;normalizeLoader(loader);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;var _iterator12=_createForOfIteratorHelper(loader.extensions),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loaderExtension=_step12.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator13=_createForOfIteratorHelper(loaders),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loader=_step13.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$2(data,byteOffset,test.length);return test===magic;default:return false;}}function getFirstCharacters$1(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i508=0;_i508<length;_i508++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i508));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regeneratorRuntime().wrap(function makeStringIterator$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 3:if(!(offset<string.length)){_context5.next=11;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.next=9;return textEncoder.encode(chunk);case 9:_context5.next=3;break;case 11:case"end":return _context5.stop();}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regeneratorRuntime().wrap(function _callee4$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 2:if(!(byteOffset<arrayBuffer.byteLength)){_context6.next=13;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.next=11;return chunk;case 11:_context6.next=2;break;case 13:case"end":return _context6.stop();}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regeneratorRuntime().wrap(function _callee5$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 2:if(!(offset<blob.size)){_context7.next=12;break;}end=offset+chunkSize;_context7.next=6;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 6:chunk=_context7.sent;offset=end;_context7.next=10;return chunk;case 10:_context7.next=2;break;case 12:case"end":return _context7.stop();}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$5?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value;return _regeneratorRuntime().wrap(function _callee6$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:reader=stream.getReader();_context8.prev=1;case 2:if(!true){_context8.next=16;break;}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.next=7;return _awaitAsyncGenerator(currentBatchPromise);case 7:_yield$_awaitAsyncGen=_context8.sent;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.next=12;break;}return _context8.abrupt("return");case 12:_context8.next=14;return toArrayBuffer(value);case 14:_context8.next=2;break;case 16:_context8.next=21;break;case 18:_context8.prev=18;_context8.t0=_context8["catch"](1);reader.releaseLock();case 21:case"end":return _context8.stop();}},_callee6,null,[[1,18]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk;return _regeneratorRuntime().wrap(function _callee7$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.prev=2;_iterator2=_asyncIterator(stream);case 4:_context9.next=6;return _awaitAsyncGenerator(_iterator2.next());case 6:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.sent).done)){_context9.next=13;break;}chunk=_step2.value;_context9.next=10;return toArrayBuffer(chunk);case 10:_iteratorAbruptCompletion2=false;_context9.next=4;break;case 13:_context9.next=19;break;case 15:_context9.prev=15;_context9.t0=_context9["catch"](2);_didIteratorError2=true;_iteratorError2=_context9.t0;case 19:_context9.prev=19;_context9.prev=20;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.next=24;break;}_context9.next=24;return _awaitAsyncGenerator(_iterator2["return"]());case 24:_context9.prev=24;if(!_didIteratorError2){_context9.next=27;break;}throw _iteratorError2;case 27:return _context9.finish(24);case 28:return _context9.finish(19);case 29:case"end":return _context9.stop();}},_callee7,null,[[2,15,19,29],[20,,24,28]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context21.next=3;break;}return _context21.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context21.next=7;break;}_context21.next=6;return makeResponse(data);case 6:data=_context21.sent;case 7:if(!isResponse(data)){_context21.next=21;break;}response=data;_context21.next=11;return checkResponse(response);case 11:if(!loader.binary){_context21.next=17;break;}_context21.next=14;return response.arrayBuffer();case 14:_context21.t0=_context21.sent;_context21.next=20;break;case 17:_context21.next=19;return response.text();case 19:_context21.t0=_context21.sent;case 20:return _context21.abrupt("return",_context21.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context21.next=24;break;}return _context21.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context21.stop();}},_callee18);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:assert$8(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context22.next=4;return data;case 4:data=_context22.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context22.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context22.sent;if(loader){_context22.next=14;break;}return _context22.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context22.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context22.abrupt("return",_context22.sent);case 19:case"end":return _context22.stop();}},_callee19);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:validateWorkerVersion(loader);if(isResponse(data)){response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context23.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context23.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context23.next=8;break;}options.dataType='text';return _context23.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context23.next=12;break;}_context23.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context23.abrupt("return",_context23.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context23.next=16;break;}_context23.next=15;return loader.parseText(data,options,context,loader);case 15:return _context23.abrupt("return",_context23.sent);case 16:if(!loader.parse){_context23.next=20;break;}_context23.next=19;return loader.parse(data,options,context,loader);case 19:return _context23.abrupt("return",_context23.sent);case 20:assert$8(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context23.stop();}},_callee20);}));return _parseWithLoader.apply(this,arguments);}var VERSION$7="3.4.15";function assert$6(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_$1=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$2=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker$1=typeof importScripts==='function';var matches$2=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$2&&parseFloat(matches$2[1])||0;var readFileAsArrayBuffer$1=null;var readFileAsText$1=null;var requireFromFile$1=null;var requireFromString$1=null;var node$1=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer$1,readFileAsText:readFileAsText$1,requireFromFile:requireFromFile$1,requireFromString:requireFromString$1});var VERSION$6="3.4.15";var loadLibraryPromises$1={};function loadLibrary$1(_x36){return _loadLibrary$.apply(this,arguments);}function _loadLibrary$(){_loadLibrary$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(libraryUrl){var moduleName,options,_args17=arguments;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:moduleName=_args17.length>1&&_args17[1]!==undefined?_args17[1]:null;options=_args17.length>2&&_args17[2]!==undefined?_args17[2]:{};if(moduleName){libraryUrl=getLibraryUrl$1(libraryUrl,moduleName,options);}loadLibraryPromises$1[libraryUrl]=loadLibraryPromises$1[libraryUrl]||loadLibraryFromFile$1(libraryUrl);_context24.next=6;return loadLibraryPromises$1[libraryUrl];case 6:return _context24.abrupt("return",_context24.sent);case 7:case"end":return _context24.stop();}},_callee21);}));return _loadLibrary$.apply(this,arguments);}function getLibraryUrl$1(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$2){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$6(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$6,"/dist/libs/").concat(library);}if(isWorker$1){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile$1(_x37){return _loadLibraryFromFile$.apply(this,arguments);}function _loadLibraryFromFile$(){_loadLibraryFromFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:if(!libraryUrl.endsWith('wasm')){_context25.next=7;break;}_context25.next=3;return fetch(libraryUrl);case 3:_response=_context25.sent;_context25.next=6;return _response.arrayBuffer();case 6:return _context25.abrupt("return",_context25.sent);case 7:if(isBrowser$2){_context25.next=20;break;}_context25.prev=8;_context25.t0=node$1&&requireFromFile$1;if(!_context25.t0){_context25.next=14;break;}_context25.next=13;return requireFromFile$1(libraryUrl);case 13:_context25.t0=_context25.sent;case 14:return _context25.abrupt("return",_context25.t0);case 17:_context25.prev=17;_context25.t1=_context25["catch"](8);return _context25.abrupt("return",null);case 20:if(!isWorker$1){_context25.next=22;break;}return _context25.abrupt("return",importScripts(libraryUrl));case 22:_context25.next=24;return fetch(libraryUrl);case 24:response=_context25.sent;_context25.next=27;return response.text();case 27:scriptSource=_context25.sent;return _context25.abrupt("return",loadLibraryFromString$1(scriptSource,libraryUrl));case 29:case"end":return _context25.stop();}},_callee22,null,[[8,17]]);}));return _loadLibraryFromFile$.apply(this,arguments);}function loadLibraryFromString$1(scriptSource,id){if(!isBrowser$2){return requireFromString$1;}if(isWorker$1){eval.call(global_$1,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x38){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(options){var modules;return _regeneratorRuntime().wrap(function _callee23$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:modules=options.modules||{};if(!modules.basis){_context26.next=3;break;}return _context26.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context26.next=6;return loadBasisTranscoderPromise;case 6:return _context26.abrupt("return",_context26.sent);case 7:case"end":return _context26.stop();}},_callee23);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x39){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee24$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:BASIS=null;wasmBinary=null;_context27.t0=Promise;_context27.next=5;return loadLibrary$1('basis_transcoder.js','textures',options);case 5:_context27.t1=_context27.sent;_context27.next=8;return loadLibrary$1('basis_transcoder.wasm','textures',options);case 8:_context27.t2=_context27.sent;_context27.t3=[_context27.t1,_context27.t2];_context27.next=12;return _context27.t0.all.call(_context27.t0,_context27.t3);case 12:_yield$Promise$all=_context27.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context27.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context27.abrupt("return",_context27.sent);case 20:case"end":return _context27.stop();}},_callee24);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x40){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(options){var modules;return _regeneratorRuntime().wrap(function _callee25$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context28.next=3;break;}return _context28.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context28.next=6;return loadBasisEncoderPromise;case 6:return _context28.abrupt("return",_context28.sent);case 7:case"end":return _context28.stop();}},_callee25);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x41){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee26$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context29.t0=Promise;_context29.next=5;return loadLibrary$1(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context29.t1=_context29.sent;_context29.next=8;return loadLibrary$1(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context29.t2=_context29.sent;_context29.t3=[_context29.t1,_context29.t2];_context29.next=12;return _context29.t0.all.call(_context29.t0,_context29.t3);case 12:_yield$Promise$all3=_context29.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context29.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context29.abrupt("return",_context29.sent);case 20:case"end":return _context29.stop();}},_callee26);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator15=_createForOfIteratorHelper(BROWSER_PREFIXES),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var prefix=_step15.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}return formats;}function getWebGLContext(){try{var _canvas6=document.createElement('canvas');return _canvas6.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x42,_x43){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile;return _regeneratorRuntime().wrap(function _callee27$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:if(!(options.basis.containerFormat==='auto')){_context30.next=11;break;}if(!isKTX(data)){_context30.next=6;break;}_context30.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context30.sent;return _context30.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context30.next=8;return loadBasisTrascoderModule(options);case 8:_yield$loadBasisTrasc=_context30.sent;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context30.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context30.t0=options.basis.module;_context30.next=_context30.t0==='encoder'?14:_context30.t0==='transcoder'?22:22;break;case 14:_context30.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context30.sent;_context30.t1=options.basis.containerFormat;_context30.next=_context30.t1==='ktx2'?20:_context30.t1==='basis'?21:21;break;case 20:return _context30.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context30.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context30.next=24;return loadBasisTrascoderModule(options);case 24:_yield$loadBasisTrasc2=_context30.sent;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context30.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context30.stop();}},_callee27);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$2?'basis':'basis-nodejs',module:'textures',version:VERSION$5,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$3="3.4.15";function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$1=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$1?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas7=document.createElement('canvas');var context=_canvas7.getContext('2d');if(!context){throw new Error('getImageData');}_canvas7.width=image.width;_canvas7.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee28$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context31.prev=3;_context31.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context31.abrupt("return",_context31.sent);case 7:_context31.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context31.finish(7);case 10:case"end":return _context31.stop();}},_callee28,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x47,_x48){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(url,options){var image;return _regeneratorRuntime().wrap(function _callee29$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context32.next=6;break;}_context32.next=5;return image.decode();case 5:return _context32.abrupt("return",image);case 6:_context32.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 8:return _context32.abrupt("return",_context32.sent);case 9:case"end":return _context32.stop();}},_callee29);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x49,_x50,_x51){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee30$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:if(!isSVG(url)){_context33.next=7;break;}_context33.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context33.sent;blob=_image7;_context33.next=8;break;case 7:blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context33.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context33.abrupt("return",_context33.sent);case 12:case"end":return _context33.stop();}},_callee30);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x52){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(blob){var imagebitmapOptions,_args27=arguments;return _regeneratorRuntime().wrap(function _callee31$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:imagebitmapOptions=_args27.length>1&&_args27[1]!==undefined?_args27[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context34.next=13;break;}_context34.prev=3;_context34.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context34.abrupt("return",_context34.sent);case 9:_context34.prev=9;_context34.t0=_context34["catch"](3);console.warn(_context34.t0);imagebitmapOptionsSupported=false;case 13:_context34.next=15;return createImageBitmap(blob);case 15:return _context34.abrupt("return",_context34.sent);case 16:case"end":return _context34.stop();}},_callee31,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i509=0;_i509<headerBytes.length;++_i509){if(headerBytes[_i509]!==buffer[_i509+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i510=0xffe0;_i510<0xfff0;++_i510){tableMarkers.add(_i510);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x53,_x54){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regeneratorRuntime().wrap(function _callee32$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context35.next=5;return _parseImageNode(arrayBuffer,mimeType);case 5:return _context35.abrupt("return",_context35.sent);case 6:case"end":return _context35.stop();}},_callee32);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x55,_x56,_x57){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image;return _regeneratorRuntime().wrap(function _callee33$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_context36.t0=loadType;_context36.next=_context36.t0==='imagebitmap'?8:_context36.t0==='image'?12:_context36.t0==='data'?16:20;break;case 8:_context36.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context36.sent;return _context36.abrupt("break",21);case 12:_context36.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context36.sent;return _context36.abrupt("break",21);case 16:_context36.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context36.sent;return _context36.abrupt("break",21);case 20:assert$5(false);case 21:if(imageType==='data'){image=getImageData(image);}return _context36.abrupt("return",image);case 23:case"end":return _context36.stop();}},_callee33);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$3,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$1?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i511=0;_i511<length;_i511++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i511));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters(string),"\""));}}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$4(byteLength>=0);assert$4(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function assert$3(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$3(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$3(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$3(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator16=_createForOfIteratorHelper(this.sourceBuffers||[]),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var sourceBuffer=_step16.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator17=_createForOfIteratorHelper(initValues),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var value=_step17.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x58,_x59,_x60,_x61,_x62){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(target,count,size,source,mode){var filter,instance,_args30=arguments;return _regeneratorRuntime().wrap(function _callee34$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:filter=_args30.length>5&&_args30[5]!==undefined?_args30[5]:'NONE';_context37.next=3;return loadWasmInstance();case 3:instance=_context37.sent;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context37.stop();}},_callee34);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(){return _regeneratorRuntime().wrap(function _callee35$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context38.abrupt("return",wasmPromise);case 2:case"end":return _context38.stop();}},_callee35);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(){var wasm,result;return _regeneratorRuntime().wrap(function _callee36$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context39.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context39.sent;_context39.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context39.abrupt("return",result.instance);case 8:case"end":return _context39.stop();}},_callee36);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i512=0;_i512<data.length;++_i512){var ch=data.charCodeAt(_i512);result[_i512]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i513=0;_i513<data.length;++_i513){result[write++]=result[_i513]<60?wasmpack[result[_i513]]:(result[_i513]-60)*64+result[++_i513];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x63,_x64){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(gltfData,options){var _options$gltf,scenegraph,promises,_iterator42,_step42,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee37$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context40.next=3;break;}return _context40.abrupt("return");case 3:promises=[];_iterator42=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){bufferViewIndex=_step42.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}_context40.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context40.stop();}},_callee37);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x65,_x66){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee38$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context41.next=9;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context41.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:return _context41.abrupt("return",result);case 9:return _context41.abrupt("return",null);case 10:case"end":return _context41.stop();}},_callee38);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator18=_createForOfIteratorHelper(json.textures||[]),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var texture=_step18.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});function assert$2(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_=globals.global||globals.self||globals.window||{};var isBrowser=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$2="3.4.15";var loadLibraryPromises={};function loadLibrary(_x67){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(libraryUrl){var moduleName,options,_args35=arguments;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:moduleName=_args35.length>1&&_args35[1]!==undefined?_args35[1]:null;options=_args35.length>2&&_args35[2]!==undefined?_args35[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context42.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context42.abrupt("return",_context42.sent);case 7:case"end":return _context42.stop();}},_callee39);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$2(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$2,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x68){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(libraryUrl){var _response2,response,scriptSource;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:if(!libraryUrl.endsWith('wasm')){_context43.next=7;break;}_context43.next=3;return fetch(libraryUrl);case 3:_response2=_context43.sent;_context43.next=6;return _response2.arrayBuffer();case 6:return _context43.abrupt("return",_context43.sent);case 7:if(isBrowser){_context43.next=20;break;}_context43.prev=8;_context43.t0=node&&requireFromFile;if(!_context43.t0){_context43.next=14;break;}_context43.next=13;return requireFromFile(libraryUrl);case 13:_context43.t0=_context43.sent;case 14:return _context43.abrupt("return",_context43.t0);case 17:_context43.prev=17;_context43.t1=_context43["catch"](8);return _context43.abrupt("return",null);case 20:if(!isWorker){_context43.next=22;break;}return _context43.abrupt("return",importScripts(libraryUrl));case 22:_context43.next=24;return fetch(libraryUrl);case 24:response=_context43.sent;_context43.next=27;return response.text();case 27:scriptSource=_context43.sent;return _context43.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context43.stop();}},_callee40,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i514=0;_i514<len;_i514+=3){var x=positions[_i514];var y=positions[_i514+1];var _z4=positions[_i514+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i515=0;_i515<this.fields.length;++_i515){if(!this.fields[_i515].compareTo(other.fields[_i515])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i516=0,_columnNames=columnNames;_i516<_columnNames.length;_i516++){var _name6=_columnNames[_i516];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this121=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this121.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator20=_createForOfIteratorHelper(this.fields),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var field=_step20.value;fieldMap[field.name]=field;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}var _iterator21=_createForOfIteratorHelper(fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _field=_step21.value;fieldMap[_field.name]=_field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var field=_step22.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this122;_classCallCheck(this,Int);_this122=_callSuper(this,Int);_defineProperty(_this122,"isSigned",void 0);_defineProperty(_this122,"bitWidth",void 0);_this122.isSigned=isSigned;_this122.bitWidth=bitWidth;return _this122;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this123;_classCallCheck(this,Float);_this123=_callSuper(this,Float);_defineProperty(_this123,"precision",void 0);_this123.precision=precision;return _this123;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this124;_classCallCheck(this,FixedSizeList);_this124=_callSuper(this,FixedSizeList);_defineProperty(_this124,"listSize",void 0);_defineProperty(_this124,"children",void 0);_this124.listSize=listSize;_this124.children=[child];return _this124;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i517=0,_Object$values=Object.values(loaderData.attributes);_i517<_Object$values.length;_i517++){var loaderAttribute=_Object$values[_i517];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i518=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i518<_Object$entries4.length;_i518++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i518],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator23=_createForOfIteratorHelper(skipAttributes),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var dracoAttributeName=_step23.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this125=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this125.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this126=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this126.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i519=0;_i519<numValues;_i519++){intArray[_i519]=dracoArray.GetValue(_i519);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i520=0;_i520<numValues;_i520++){intArray[_i520]=dracoArray.GetValue(_i520);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x69){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(options){var modules;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context44.next=4;return loadDecoderPromise;case 4:return _context44.abrupt("return",_context44.sent);case 5:case"end":return _context44.stop();}},_callee41);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x70){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:_context45.t0=options.draco&&options.draco.decoderType;_context45.next=_context45.t0==='js'?3:_context45.t0==='wasm'?7:7;break;case 3:_context45.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context45.sent;return _context45.abrupt("break",21);case 7:_context45.t1=Promise;_context45.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context45.t2=_context45.sent;_context45.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context45.t3=_context45.sent;_context45.t4=[_context45.t2,_context45.t3];_context45.next=17;return _context45.t1.all.call(_context45.t1,_context45.t4);case 17:_yield$Promise$all5=_context45.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 21:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context45.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context45.abrupt("return",_context45.sent);case 25:case"end":return _context45.stop();}},_callee42);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}}));});}({id:isBrowser?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x71,_x72){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:_context46.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context46.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context46.prev=5;return _context46.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context46.prev=7;dracoParser.destroy();return _context46.finish(7);case 10:case"end":return _context46.stop();}},_callee43,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator24=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _primitive=_step24.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}function decode$5(_x73,_x74,_x75){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator43,_step43,_primitive6;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context47.next=2;break;}return _context47.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator43=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){_primitive6=_step43.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}_context47.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context47.stop();}},_callee44);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _mesh4=_step25.value;compressMesh(_mesh4,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x76,_x77,_x78,_x79){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i633,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context48.next=3;break;}return _context48.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context48.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context48.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i633=0,_Object$entries5=Object.entries(decodedAttributes);_i633<_Object$entries5.length;_i633++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i633],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 16:case"end":return _context48.stop();}},_callee45);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator26,_step26,_mesh5,_iterator27,_step27,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator26.s();case 3:if((_step26=_iterator26.n()).done){_context10.next=24;break;}_mesh5=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh5.primitives);_context10.prev=6;_iterator27.s();case 8:if((_step27=_iterator27.n()).done){_context10.next=14;break;}_primitive2=_step27.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator27.e(_context10.t0);case 19:_context10.prev=19;_iterator27.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator26.e(_context10.t1);case 29:_context10.prev=29;_iterator26.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}},_marked2,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref17=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref17$precision=_ref17.precision,precision=_ref17$precision===void 0?config.precision:_ref17$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i521=0;_i521<a.length;++_i521){if(!_equals(a[_i521],b[_i521])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]=array[_i522+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i523=0;_i523<this.ELEMENTS;++_i523){targetArray[offset+_i523]=this[_i523];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i524=0;_i524<this.ELEMENTS;++_i524){string+=(_i524>0?', ':'')+formatValue(this[_i524],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i525=0;_i525<this.ELEMENTS;++_i525){if(!_equals(this[_i525],array[_i525])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i526=0;_i526<this.ELEMENTS;++_i526){if(this[_i526]!==array[_i526]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]=-this[_i527];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i528=0;_i528<this.ELEMENTS;++_i528){var ai=a[_i528];this[_i528]=ai+t*(b[_i528]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(vector[_i529],this[_i529]);}return this.check();}},{key:"max",value:function max(vector){for(var _i530=0;_i530<this.ELEMENTS;++_i530){this[_i530]=Math.max(vector[_i530],this[_i530]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i531=0;_i531<this.ELEMENTS;++_i531){this[_i531]=Math.min(Math.max(this[_i531],minVector[_i531]),maxVector[_i531]);}return this.check();}},{key:"add",value:function add(){for(var _len101=arguments.length,vectors=new Array(_len101),_key8=0;_key8<_len101;_key8++){vectors[_key8]=arguments[_key8];}for(var _i532=0,_vectors=vectors;_i532<_vectors.length;_i532++){var vector=_vectors[_i532];for(var _i533=0;_i533<this.ELEMENTS;++_i533){this[_i533]+=vector[_i533];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len102=arguments.length,vectors=new Array(_len102),_key9=0;_key9<_len102;_key9++){vectors[_key9]=arguments[_key9];}for(var _i534=0,_vectors2=vectors;_i534<_vectors2.length;_i534++){var vector=_vectors2[_i534];for(var _i535=0;_i535<this.ELEMENTS;++_i535){this[_i535]-=vector[_i535];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=_scale7;}}else{for(var _i537=0;_i537<this.ELEMENTS&&_i537<_scale7.length;++_i537){this[_i537]*=_scale7[_i537];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i539=0;_i539<this.ELEMENTS;++_i539){valid=valid&&Number.isFinite(this[_i539]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i540=0;_i540<this.ELEMENTS;++_i540){this[_i540]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i541=0;_i541<this.ELEMENTS;++_i541){this[_i541]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i542=0;_i542<this.ELEMENTS;++_i542){this[_i542]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i543=0;_i543<this.ELEMENTS;++_i543){this[_i543]=Math.min(Math.max(this[_i543],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i544=0;_i544<v.length;++_i544){if(!Number.isFinite(v[_i544])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i545=0;_i545<this.ELEMENTS;++_i545){length+=this[_i545]*this[_i545];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i546=0;_i546<this.ELEMENTS;++_i546){var dist=this[_i546]-mathArray[_i546];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i547=0;_i547<this.ELEMENTS;++_i547){product+=this[_i547]*mathArray[_i547];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i548=0;_i548<this.ELEMENTS;++_i548){this[_i548]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len103=arguments.length,vectors=new Array(_len103),_key10=0;_key10<_len103;_key10++){vectors[_key10]=arguments[_key10];}for(var _i549=0,_vectors3=vectors;_i549<_vectors3.length;_i549++){var vector=_vectors3[_i549];for(var _i550=0;_i550<this.ELEMENTS;++_i550){this[_i550]*=vector[_i550];}}return this.check();}},{key:"divide",value:function divide(){for(var _len104=arguments.length,vectors=new Array(_len104),_key11=0;_key11<_len104;_key11++){vectors[_key11]=arguments[_key11];}for(var _i551=0,_vectors4=vectors;_i551<_vectors4.length;_i551++){var vector=_vectors4[_i551];for(var _i552=0;_i552<this.ELEMENTS;++_i552){this[_i552]/=vector[_i552];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
25034
+ if(plugins.length>0){for(var _i505=0,len=plugins.length;_i505<len;_i505++){var plugin=plugins[_i505];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$9(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$5=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$4=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$4&&parseFloat(matches$4[1])||0;var VERSION$9="3.4.15";function assert$8(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var isBrowser$4=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches$3=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$3&&parseFloat(matches$3[1])||0;function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function toPropertyKey(t){var i=toPrimitive(t,"string");return"symbol"==_typeof(i)?i:String(i);}function _defineProperty(obj,key,value){key=toPropertyKey(key);if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}var WorkerJob=/*#__PURE__*/function(){function WorkerJob(jobName,workerThread){var _this118=this;_classCallCheck(this,WorkerJob);_defineProperty(this,"name",void 0);_defineProperty(this,"workerThread",void 0);_defineProperty(this,"isRunning",true);_defineProperty(this,"result",void 0);_defineProperty(this,"_resolve",function(){});_defineProperty(this,"_reject",function(){});this.name=jobName;this.workerThread=workerThread;this.result=new Promise(function(resolve,reject){_this118._resolve=resolve;_this118._reject=reject;});}return _createClass(WorkerJob,[{key:"postMessage",value:function postMessage(type,payload){this.workerThread.postMessage({source:'loaders.gl',type:type,payload:payload});}},{key:"done",value:function done(value){assert$8(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$8(this.isRunning);this.isRunning=false;this._reject(_error);}}]);}();var Worker$1=/*#__PURE__*/function(){function Worker$1(){_classCallCheck(this,Worker$1);}return _createClass(Worker$1,[{key:"terminate",value:function terminate(){}}]);}();var workerURLCache=new Map();function getLoadableWorkerURL(props){assert$8(props.source&&!props.url||!props.source&&props.url);var workerURL=workerURLCache.get(props.source||props.url);if(!workerURL){if(props.url){workerURL=getLoadableWorkerURLFromURL(props.url);workerURLCache.set(props.url,workerURL);}if(props.source){workerURL=getLoadableWorkerURLFromSource(props.source);workerURLCache.set(props.source,workerURL);}}assert$8(workerURL);return workerURL;}function getLoadableWorkerURLFromURL(url){if(!url.startsWith('http')){return url;}var workerSource=buildScriptSource(url);return getLoadableWorkerURLFromSource(workerSource);}function getLoadableWorkerURLFromSource(workerSource){var blob=new Blob([workerSource],{type:'application/javascript'});return URL.createObjectURL(blob);}function buildScriptSource(workerUrl){return"try {\n importScripts('".concat(workerUrl,"');\n} catch (error) {\n console.error(error);\n throw error;\n}");}function getTransferList(object){var recursive=arguments.length>1&&arguments[1]!==undefined?arguments[1]:true;var transfers=arguments.length>2?arguments[2]:undefined;var transfersSet=transfers||new Set();if(!object);else if(isTransferable(object)){transfersSet.add(object);}else if(isTransferable(object.buffer)){transfersSet.add(object.buffer);}else if(ArrayBuffer.isView(object));else if(recursive&&_typeof2(object)==='object'){for(var key in object){getTransferList(object[key],recursive,transfersSet);}}return transfers===undefined?Array.from(transfersSet):[];}function isTransferable(object){if(!object){return false;}if(object instanceof ArrayBuffer){return true;}if(typeof MessagePort!=='undefined'&&object instanceof MessagePort){return true;}if(typeof ImageBitmap!=='undefined'&&object instanceof ImageBitmap){return true;}if(typeof OffscreenCanvas!=='undefined'&&object instanceof OffscreenCanvas){return true;}return false;}var NOOP=function NOOP(){};var WorkerThread=/*#__PURE__*/function(){function WorkerThread(props){_classCallCheck(this,WorkerThread);_defineProperty(this,"name",void 0);_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"terminated",false);_defineProperty(this,"worker",void 0);_defineProperty(this,"onMessage",void 0);_defineProperty(this,"onError",void 0);_defineProperty(this,"_loadableURL",'');var name=props.name,source=props.source,url=props.url;assert$8(source||url);this.name=name;this.source=source;this.url=url;this.onMessage=NOOP;this.onError=function(error){return console.log(error);};this.worker=isBrowser$4?this._createBrowserWorker():this._createNodeWorker();}return _createClass(WorkerThread,[{key:"destroy",value:function destroy(){this.onMessage=NOOP;this.onError=NOOP;this.worker.terminate();this.terminated=true;}},{key:"isRunning",get:function get(){return Boolean(this.onMessage);}},{key:"postMessage",value:function postMessage(data,transferList){transferList=transferList||getTransferList(data);this.worker.postMessage(data,transferList);}},{key:"_getErrorFromErrorEvent",value:function _getErrorFromErrorEvent(event){var message='Failed to load ';message+="worker ".concat(this.name," from ").concat(this.url,". ");if(event.message){message+="".concat(event.message," in ");}if(event.lineno){message+=":".concat(event.lineno,":").concat(event.colno);}return new Error(message);}},{key:"_createBrowserWorker",value:function _createBrowserWorker(){var _this119=this;this._loadableURL=getLoadableWorkerURL({source:this.source,url:this.url});var worker=new Worker(this._loadableURL,{name:this.name});worker.onmessage=function(event){if(!event.data){_this119.onError(new Error('No data received'));}else{_this119.onMessage(event.data);}};worker.onerror=function(error){_this119.onError(_this119._getErrorFromErrorEvent(error));_this119.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this120=this;var worker;if(this.url){var absolute=this.url.includes(':/')||this.url.startsWith('/');var url=absolute?this.url:"./".concat(this.url);worker=new Worker$1(url,{eval:false});}else if(this.source){worker=new Worker$1(this.source,{eval:true});}else{throw new Error('no worker');}worker.on('message',function(data){_this120.onMessage(data);});worker.on('error',function(error){_this120.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$4||typeof Worker$1!=='undefined'&&!isBrowser$4;}}]);}();var WorkerPool=/*#__PURE__*/function(){function WorkerPool(props){_classCallCheck(this,WorkerPool);_defineProperty(this,"name",'unnamed');_defineProperty(this,"source",void 0);_defineProperty(this,"url",void 0);_defineProperty(this,"maxConcurrency",1);_defineProperty(this,"maxMobileConcurrency",1);_defineProperty(this,"onDebug",function(){});_defineProperty(this,"reuseWorkers",true);_defineProperty(this,"props",{});_defineProperty(this,"jobQueue",[]);_defineProperty(this,"idleQueue",[]);_defineProperty(this,"count",0);_defineProperty(this,"isDestroyed",false);this.source=props.source;this.url=props.url;this.setProps(props);}return _createClass(WorkerPool,[{key:"destroy",value:function destroy(){this.idleQueue.forEach(function(worker){return worker.destroy();});this.isDestroyed=true;}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);if(props.name!==undefined){this.name=props.name;}if(props.maxConcurrency!==undefined){this.maxConcurrency=props.maxConcurrency;}if(props.maxMobileConcurrency!==undefined){this.maxMobileConcurrency=props.maxMobileConcurrency;}if(props.reuseWorkers!==undefined){this.reuseWorkers=props.reuseWorkers;}if(props.onDebug!==undefined){this.onDebug=props.onDebug;}}},{key:"startJob",value:function(){var _startJob=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(name){var _this121=this;var onMessage,onError,startPromise,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:onMessage=_args2.length>1&&_args2[1]!==undefined?_args2[1]:function(job,type,data){return job.done(data);};onError=_args2.length>2&&_args2[2]!==undefined?_args2[2]:function(job,error){return job.error(error);};startPromise=new Promise(function(onStart){_this121.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this121;});this._startQueuedJob();_context3.next=6;return startPromise;case 6:return _context3.abrupt("return",_context3.sent);case 7:case"end":return _context3.stop();}},_callee2,this);}));function startJob(_x7){return _startJob.apply(this,arguments);}return startJob;}()},{key:"_startQueuedJob",value:function(){var _startQueuedJob2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var workerThread,queuedJob,job;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(this.jobQueue.length){_context4.next=2;break;}return _context4.abrupt("return");case 2:workerThread=this._getAvailableWorker();if(workerThread){_context4.next=5;break;}return _context4.abrupt("return");case 5:queuedJob=this.jobQueue.shift();if(!queuedJob){_context4.next=18;break;}this.onDebug({message:'Starting job',name:queuedJob.name,workerThread:workerThread,backlog:this.jobQueue.length});job=new WorkerJob(queuedJob.name,workerThread);workerThread.onMessage=function(data){return queuedJob.onMessage(job,data.type,data.payload);};workerThread.onError=function(error){return queuedJob.onError(job,error);};queuedJob.onStart(job);_context4.prev=12;_context4.next=15;return job.result;case 15:_context4.prev=15;this.returnWorkerToQueue(workerThread);return _context4.finish(15);case 18:case"end":return _context4.stop();}},_callee3,this,[[12,,15,18]]);}));function _startQueuedJob(){return _startQueuedJob2.apply(this,arguments);}return _startQueuedJob;}()},{key:"returnWorkerToQueue",value:function returnWorkerToQueue(worker){var shouldDestroyWorker=this.isDestroyed||!this.reuseWorkers||this.count>this._getMaxConcurrency();if(shouldDestroyWorker){worker.destroy();this.count--;}else{this.idleQueue.push(worker);}if(!this.isDestroyed){this._startQueuedJob();}}},{key:"_getAvailableWorker",value:function _getAvailableWorker(){if(this.idleQueue.length>0){return this.idleQueue.shift()||null;}if(this.count<this._getMaxConcurrency()){this.count++;var _name5="".concat(this.name.toLowerCase()," (#").concat(this.count," of ").concat(this.maxConcurrency,")");return new WorkerThread({name:_name5,source:this.source,url:this.url});}return null;}},{key:"_getMaxConcurrency",value:function _getMaxConcurrency(){return isMobile?this.maxMobileConcurrency:this.maxConcurrency;}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}}]);}();var DEFAULT_PROPS={maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:true,onDebug:function onDebug(){}};var WorkerFarm=/*#__PURE__*/function(){function WorkerFarm(props){_classCallCheck(this,WorkerFarm);_defineProperty(this,"props",void 0);_defineProperty(this,"workerPools",new Map());this.props=_objectSpread({},DEFAULT_PROPS);this.setProps(props);this.workerPools=new Map();}return _createClass(WorkerFarm,[{key:"destroy",value:function destroy(){var _iterator4=_createForOfIteratorHelper(this.workerPools.values()),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var workerPool=_step4.value;workerPool.destroy();}}catch(err){_iterator4.e(err);}finally{_iterator4.f();}this.workerPools=new Map();}},{key:"setProps",value:function setProps(props){this.props=_objectSpread(_objectSpread({},this.props),props);var _iterator5=_createForOfIteratorHelper(this.workerPools.values()),_step5;try{for(_iterator5.s();!(_step5=_iterator5.n()).done;){var workerPool=_step5.value;workerPool.setProps(this._getWorkerPoolProps());}}catch(err){_iterator5.e(err);}finally{_iterator5.f();}}},{key:"getWorkerPool",value:function getWorkerPool(options){var name=options.name,source=options.source,url=options.url;var workerPool=this.workerPools.get(name);if(!workerPool){workerPool=new WorkerPool({name:name,source:source,url:url});workerPool.setProps(this._getWorkerPoolProps());this.workerPools.set(name,workerPool);}return workerPool;}},{key:"_getWorkerPoolProps",value:function _getWorkerPoolProps(){return{maxConcurrency:this.props.maxConcurrency,maxMobileConcurrency:this.props.maxMobileConcurrency,reuseWorkers:this.props.reuseWorkers,onDebug:this.props.onDebug};}}],[{key:"isSupported",value:function isSupported(){return WorkerThread.isSupported();}},{key:"getWorkerFarm",value:function getWorkerFarm(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};WorkerFarm._workerFarm=WorkerFarm._workerFarm||new WorkerFarm({});WorkerFarm._workerFarm.setProps(props);return WorkerFarm._workerFarm;}}]);}();_defineProperty(WorkerFarm,"_workerFarm",void 0);var NPM_TAG='latest';function getWorkerURL(worker){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var workerOptions=options[worker.id]||{};var workerFile="".concat(worker.id,"-worker.js");var url=workerOptions.workerUrl;if(!url&&worker.id==='compression'){url=options.workerUrl;}if(options._workerType==='test'){url="modules/".concat(worker.module,"/dist/").concat(workerFile);}if(!url){var version=worker.version;if(version==='latest'){version=NPM_TAG;}var versionTag=version?"@".concat(version):'';url="https://unpkg.com/@loaders.gl/".concat(worker.module).concat(versionTag,"/dist/").concat(workerFile);}assert$8(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$9;assert$8(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$4&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x8,_x9,_x10,_x11,_x12){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:name=loader.id;url=getWorkerURL(loader,options);workerFarm=WorkerFarm.getWorkerFarm(options);workerPool=workerFarm.getWorkerPool({name:name,url:url});options=JSON.parse(JSON.stringify(options));context=JSON.parse(JSON.stringify(context||{}));_context13.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context13.sent;job.postMessage('process',{input:data,options:options,context:context});_context13.next=12;return job.result;case 12:result=_context13.sent;_context13.next=15;return result.result;case 15:return _context13.abrupt("return",_context13.sent);case 16:case"end":return _context13.stop();}},_callee10);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x13,_x14,_x15,_x16){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.next){case 0:_context14.t0=type;_context14.next=_context14.t0==='done'?3:_context14.t0==='error'?5:_context14.t0==='process'?7:20;break;case 3:job.done(payload);return _context14.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context14.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context14.prev=8;_context14.next=11;return parseOnMainThread(input,options);case 11:result=_context14.sent;job.postMessage('done',{id:id,result:result});_context14.next=19;break;case 15:_context14.prev=15;_context14.t1=_context14["catch"](8);message=_context14.t1 instanceof Error?_context14.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context14.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context14.stop();}},_callee11,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}function compareArrayBuffers(arrayBuffer1,arrayBuffer2,byteLength){byteLength=byteLength||arrayBuffer1.byteLength;if(arrayBuffer1.byteLength<byteLength||arrayBuffer2.byteLength<byteLength){return false;}var array1=new Uint8Array(arrayBuffer1);var array2=new Uint8Array(arrayBuffer2);for(var _i506=0;_i506<array1.length;++_i506){if(array1[_i506]!==array2[_i506]){return false;}}return true;}function concatenateArrayBuffers(){for(var _len=arguments.length,sources=new Array(_len),_key=0;_key<_len;_key++){sources[_key]=arguments[_key];}var sourceArrays=sources.map(function(source2){return source2 instanceof ArrayBuffer?new Uint8Array(source2):source2;});var byteLength=sourceArrays.reduce(function(length,typedArray){return length+typedArray.byteLength;},0);var result=new Uint8Array(byteLength);var offset=0;var _iterator6=_createForOfIteratorHelper(sourceArrays),_step6;try{for(_iterator6.s();!(_step6=_iterator6.n()).done;){var sourceArray=_step6.value;result.set(sourceArray,offset);offset+=sourceArray.byteLength;}}catch(err){_iterator6.e(err);}finally{_iterator6.f();}return result.buffer;}function concatenateArrayBuffersAsync(_x17){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context15.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context15.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context15.sent).done)){_context15.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context15.next=5;break;case 13:_context15.next=19;break;case 15:_context15.prev=15;_context15.t0=_context15["catch"](3);_didIteratorError=true;_iteratorError=_context15.t0;case 19:_context15.prev=19;_context15.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context15.next=24;break;}_context15.next=24;return _iterator["return"]();case 24:_context15.prev=24;if(!_didIteratorError){_context15.next=27;break;}throw _iteratorError;case 27:return _context15.finish(24);case 28:return _context15.finish(19);case 29:return _context15.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context15.stop();}},_callee12,null,[[3,15,19,29],[20,,24,28]]);}));return _concatenateArrayBuffersAsync.apply(this,arguments);}var pathPrefix='';var fileAliases={};function resolvePath(filename){for(var alias in fileAliases){if(filename.startsWith(alias)){var replacement=fileAliases[alias];filename=filename.replace(alias,replacement);}}if(!filename.startsWith('http://')&&!filename.startsWith('https://')){filename="".concat(pathPrefix).concat(filename);}return filename;}function toArrayBuffer$1(buffer){return buffer;}function isBuffer$1(value){return value&&_typeof2(value)==='object'&&value.isBuffer;}function toArrayBuffer(data){if(isBuffer$1(data)){return toArrayBuffer$1(data);}if(data instanceof ArrayBuffer){return data;}if(ArrayBuffer.isView(data)){if(data.byteOffset===0&&data.byteLength===data.buffer.byteLength){return data.buffer;}return data.buffer.slice(data.byteOffset,data.byteOffset+data.byteLength);}if(typeof data==='string'){var text=data;var uint8Array=new TextEncoder().encode(text);return uint8Array.buffer;}if(data&&_typeof2(data)==='object'&&data._toArrayBuffer){return data._toArrayBuffer();}throw new Error('toArrayBuffer');}function filename(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(slashIndex+1):'';}function dirname(url){var slashIndex=url?url.lastIndexOf('/'):-1;return slashIndex>=0?url.substr(0,slashIndex):'';}var isBoolean=function isBoolean(x){return typeof x==='boolean';};var isFunction=function isFunction(x){return typeof x==='function';};var isObject=function isObject(x){return x!==null&&_typeof2(x)==='object';};var isPureObject=function isPureObject(x){return isObject(x)&&x.constructor==={}.constructor;};var isIterable=function isIterable(x){return x&&typeof x[Symbol.iterator]==='function';};var isAsyncIterable=function isAsyncIterable(x){return x&&typeof x[Symbol.asyncIterator]==='function';};var isResponse=function isResponse(x){return typeof Response!=='undefined'&&x instanceof Response||x&&x.arrayBuffer&&x.text&&x.json;};var isBlob=function isBlob(x){return typeof Blob!=='undefined'&&x instanceof Blob;};var isBuffer=function isBuffer(x){return x&&_typeof2(x)==='object'&&x.isBuffer;};var isReadableDOMStream=function isReadableDOMStream(x){return typeof ReadableStream!=='undefined'&&x instanceof ReadableStream||isObject(x)&&isFunction(x.tee)&&isFunction(x.cancel)&&isFunction(x.getReader);};var isReadableNodeStream=function isReadableNodeStream(x){return isObject(x)&&isFunction(x.read)&&isFunction(x.pipe)&&isBoolean(x.readable);};var isReadableStream=function isReadableStream(x){return isReadableDOMStream(x)||isReadableNodeStream(x);};var DATA_URL_PATTERN=/^data:([-\w.]+\/[-\w.+]+)(;|,)/;var MIME_TYPE_PATTERN=/^([-\w.]+\/[-\w.+]+)/;function parseMIMEType(mimeString){var matches=MIME_TYPE_PATTERN.exec(mimeString);if(matches){return matches[1];}return mimeString;}function parseMIMETypeFromURL(url){var matches=DATA_URL_PATTERN.exec(url);if(matches){return matches[1];}return'';}var QUERY_STRING_PATTERN=/\?.*/;function extractQueryString(url){var matches=url.match(QUERY_STRING_PATTERN);return matches&&matches[0];}function stripQueryString(url){return url.replace(QUERY_STRING_PATTERN,'');}function getResourceUrl(resource){if(isResponse(resource)){var response=resource;return response.url;}if(isBlob(resource)){var blob=resource;return blob.name||'';}if(typeof resource==='string'){return resource;}return'';}function getResourceMIMEType(resource){if(isResponse(resource)){var response=resource;var contentTypeHeader=response.headers.get('content-type')||'';var noQueryUrl=stripQueryString(response.url);return parseMIMEType(contentTypeHeader)||parseMIMETypeFromURL(noQueryUrl);}if(isBlob(resource)){var blob=resource;return blob.type||'';}if(typeof resource==='string'){return parseMIMETypeFromURL(resource);}return'';}function getResourceContentLength(resource){if(isResponse(resource)){var response=resource;return response.headers['content-length']||-1;}if(isBlob(resource)){var blob=resource;return blob.size;}if(typeof resource==='string'){return resource.length;}if(resource instanceof ArrayBuffer){return resource.byteLength;}if(ArrayBuffer.isView(resource)){return resource.byteLength;}return-1;}function makeResponse(_x18){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:if(!isResponse(resource)){_context16.next=2;break;}return _context16.abrupt("return",resource);case 2:headers={};contentLength=getResourceContentLength(resource);if(contentLength>=0){headers['content-length']=String(contentLength);}url=getResourceUrl(resource);type=getResourceMIMEType(resource);if(type){headers['content-type']=type;}_context16.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context16.sent;if(initialDataUrl){headers['x-first-bytes']=initialDataUrl;}if(typeof resource==='string'){resource=new TextEncoder().encode(resource);}response=new Response(resource,{headers:headers});Object.defineProperty(response,'url',{value:url});return _context16.abrupt("return",response);case 16:case"end":return _context16.stop();}},_callee13);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x19){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(response){var message;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:if(response.ok){_context17.next=5;break;}_context17.next=3;return getResponseError(response);case 3:message=_context17.sent;throw new Error(message);case 5:case"end":return _context17.stop();}},_callee14);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x20){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context18.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context18.next=11;break;}_context18.t0=text;_context18.t1=" ";_context18.next=9;return response.text();case 9:_context18.t2=_context18.sent;text=_context18.t0+=_context18.t1.concat.call(_context18.t1,_context18.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context18.next=17;break;case 15:_context18.prev=15;_context18.t3=_context18["catch"](1);case 17:return _context18.abrupt("return",message);case 18:case"end":return _context18.stop();}},_callee15,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x21){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context19.next=3;break;}return _context19.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context19.next=8;break;}blobSlice=resource.slice(0,5);_context19.next=7;return new Promise(function(resolve){var reader=new FileReader();reader.onload=function(event){var _event$target;return resolve(event===null||event===void 0?void 0:(_event$target=event.target)===null||_event$target===void 0?void 0:_event$target.result);};reader.readAsDataURL(blobSlice);});case 7:return _context19.abrupt("return",_context19.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context19.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context19.abrupt("return","data:base64,".concat(_base));case 12:return _context19.abrupt("return",null);case 13:case"end":return _context19.stop();}},_callee16);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i507=0;_i507<bytes.byteLength;_i507++){binary+=String.fromCharCode(bytes[_i507]);}return btoa(binary);}function fetchFile(_x22,_x23){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:if(!(typeof url==='string')){_context20.next=7;break;}url=resolvePath(url);fetchOptions=options;if(options!==null&&options!==void 0&&options.fetch&&typeof(options===null||options===void 0?void 0:options.fetch)!=='function'){fetchOptions=options.fetch;}_context20.next=6;return fetch(url,fetchOptions);case 6:return _context20.abrupt("return",_context20.sent);case 7:_context20.next=9;return makeResponse(url);case 9:return _context20.abrupt("return",_context20.sent);case 10:case"end":return _context20.stop();}},_callee17);}));return _fetchFile.apply(this,arguments);}function isElectron(mockUserAgent){if(typeof window!=='undefined'&&_typeof2(window.process)==='object'&&window.process.type==='renderer'){return true;}if(typeof process!=='undefined'&&_typeof2(process.versions)==='object'&&Boolean(process.versions['electron'])){return true;}var realUserAgent=(typeof navigator==="undefined"?"undefined":_typeof2(navigator))==='object'&&typeof navigator.userAgent==='string'&&navigator.userAgent;var userAgent=mockUserAgent||realUserAgent;if(userAgent&&userAgent.indexOf('Electron')>=0){return true;}return false;}function isBrowser$3(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var globals$2={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document,process:(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&process};var window_=globals$2.window||globals$2.self||globals$2.global;var process_=globals$2.process||{};var VERSION$8=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser$3();function getStorage(type){try{var storage=window[type];var x='__storage_test__';storage.setItem(x,x);storage.removeItem(x);return storage;}catch(e){return null;}}var LocalStorage=/*#__PURE__*/function(){function LocalStorage(id,defaultConfig){_classCallCheck(this,LocalStorage);var type=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'sessionStorage';_defineProperty(this,"storage",void 0);_defineProperty(this,"id",void 0);_defineProperty(this,"config",void 0);this.storage=getStorage(type);this.id=id;this.config=defaultConfig;this._loadConfiguration();}return _createClass(LocalStorage,[{key:"getConfiguration",value:function getConfiguration(){return this.config;}},{key:"setConfiguration",value:function setConfiguration(configuration){Object.assign(this.config,configuration);if(this.storage){var serialized=JSON.stringify(this.config);this.storage.setItem(this.id,serialized);}}},{key:"_loadConfiguration",value:function _loadConfiguration(){var configuration={};if(this.storage){var serializedConfiguration=this.storage.getItem(this.id);configuration=serializedConfiguration?JSON.parse(serializedConfiguration):{};}Object.assign(this.config,configuration);return this;}}]);}();function formatTime(ms){var formatted;if(ms<10){formatted="".concat(ms.toFixed(2),"ms");}else if(ms<100){formatted="".concat(ms.toFixed(1),"ms");}else if(ms<1000){formatted="".concat(ms.toFixed(0),"ms");}else{formatted="".concat((ms/1000).toFixed(2),"s");}return formatted;}function leftPad(string){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:8;var padLength=Math.max(length-string.length,0);return"".concat(' '.repeat(padLength)).concat(string);}function formatImage(image,message,scale){var maxWidth=arguments.length>3&&arguments[3]!==undefined?arguments[3]:600;var imageUrl=image.src.replace(/\(/g,'%28').replace(/\)/g,'%29');if(image.width>maxWidth){scale=Math.min(scale,maxWidth/image.width);}var width=image.width*scale;var height=image.height*scale;var style=['font-size:1px;',"padding:".concat(Math.floor(height/2),"px ").concat(Math.floor(width/2),"px;"),"line-height:".concat(height,"px;"),"background:url(".concat(imageUrl,");"),"background-size:".concat(width,"px ").concat(height,"px;"),'color:transparent;'].join('');return["".concat(message," %c+"),style];}var COLOR;(function(COLOR){COLOR[COLOR["BLACK"]=30]="BLACK";COLOR[COLOR["RED"]=31]="RED";COLOR[COLOR["GREEN"]=32]="GREEN";COLOR[COLOR["YELLOW"]=33]="YELLOW";COLOR[COLOR["BLUE"]=34]="BLUE";COLOR[COLOR["MAGENTA"]=35]="MAGENTA";COLOR[COLOR["CYAN"]=36]="CYAN";COLOR[COLOR["WHITE"]=37]="WHITE";COLOR[COLOR["BRIGHT_BLACK"]=90]="BRIGHT_BLACK";COLOR[COLOR["BRIGHT_RED"]=91]="BRIGHT_RED";COLOR[COLOR["BRIGHT_GREEN"]=92]="BRIGHT_GREEN";COLOR[COLOR["BRIGHT_YELLOW"]=93]="BRIGHT_YELLOW";COLOR[COLOR["BRIGHT_BLUE"]=94]="BRIGHT_BLUE";COLOR[COLOR["BRIGHT_MAGENTA"]=95]="BRIGHT_MAGENTA";COLOR[COLOR["BRIGHT_CYAN"]=96]="BRIGHT_CYAN";COLOR[COLOR["BRIGHT_WHITE"]=97]="BRIGHT_WHITE";})(COLOR||(COLOR={}));function getColor(color){return typeof color==='string'?COLOR[color.toUpperCase()]||COLOR.WHITE:color;}function addColor(string,color,background){if(!isBrowser$3&&typeof string==='string'){if(color){color=getColor(color);string="\x1B[".concat(color,"m").concat(string,"\x1B[39m");}if(background){color=getColor(background);string="\x1B[".concat(background+10,"m").concat(string,"\x1B[49m");}}return string;}function autobind(obj){var predefined=arguments.length>1&&arguments[1]!==undefined?arguments[1]:['constructor'];var proto=Object.getPrototypeOf(obj);var propNames=Object.getOwnPropertyNames(proto);var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;if(typeof obj[key]==='function'){if(!predefined.find(function(name){return key===name;})){obj[key]=obj[key].bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$7(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser$3&&'performance'in window_){var _window$performance,_window$performance$n;timestamp=window_===null||window_===void 0?void 0:(_window$performance=window_.performance)===null||_window$performance===void 0?void 0:(_window$performance$n=_window$performance.now)===null||_window$performance$n===void 0?void 0:_window$performance$n.call(_window$performance);}else if('hrtime'in process_){var _process$hrtime;var timeParts=process_===null||process_===void 0?void 0:(_process$hrtime=process_.hrtime)===null||_process$hrtime===void 0?void 0:_process$hrtime.call(process_);timestamp=timeParts[0]*1000+timeParts[1]/1e6;}else{timestamp=Date.now();}return timestamp;}var originalConsole={debug:isBrowser$3?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_SETTINGS={enabled:true,level:0};function noop(){}var cache={};var ONCE={once:true};var Log=/*#__PURE__*/function(){function Log(){_classCallCheck(this,Log);var _ref16=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{id:''},id=_ref16.id;_defineProperty(this,"id",void 0);_defineProperty(this,"VERSION",VERSION$8);_defineProperty(this,"_startTs",getHiResTimestamp());_defineProperty(this,"_deltaTs",getHiResTimestamp());_defineProperty(this,"_storage",void 0);_defineProperty(this,"userData",{});_defineProperty(this,"LOG_THROTTLE_TIMEOUT",0);this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_SETTINGS);this.timeStamp("".concat(this.id," started"));autobind(this);Object.seal(this);}return _createClass(Log,[{key:"level",get:function get(){return this.getLevel();},set:function set(newLevel){this.setLevel(newLevel);}},{key:"isEnabled",value:function isEnabled(){return this._storage.config.enabled;}},{key:"getLevel",value:function getLevel(){return this._storage.config.level;}},{key:"getTotal",value:function getTotal(){return Number((getHiResTimestamp()-this._startTs).toPrecision(10));}},{key:"getDelta",value:function getDelta(){return Number((getHiResTimestamp()-this._deltaTs).toPrecision(10));}},{key:"priority",get:function get(){return this.level;},set:function set(newPriority){this.level=newPriority;}},{key:"getPriority",value:function getPriority(){return this.level;}},{key:"enable",value:function enable(){var enabled=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;this._storage.setConfiguration({enabled:enabled});return this;}},{key:"setLevel",value:function setLevel(level){this._storage.setConfiguration({level:level});return this;}},{key:"get",value:function get(setting){return this._storage.config[setting];}},{key:"set",value:function set(setting,value){this._storage.setConfiguration(_defineProperty2({},setting,value));}},{key:"settings",value:function settings(){if(console.table){console.table(this._storage.config);}else{console.log(this._storage.config);}}},{key:"assert",value:function assert(condition,message){assert$7(condition,message);}},{key:"warn",value:function warn(message){return this._getLogFunction(0,message,originalConsole.warn,arguments,ONCE);}},{key:"error",value:function error(message){return this._getLogFunction(0,message,originalConsole.error,arguments);}},{key:"deprecated",value:function deprecated(oldUsage,newUsage){return this.warn("`".concat(oldUsage,"` is deprecated and will be removed in a later version. Use `").concat(newUsage,"` instead"));}},{key:"removed",value:function removed(oldUsage,newUsage){return this.error("`".concat(oldUsage,"` has been removed. Use `").concat(newUsage,"` instead"));}},{key:"probe",value:function probe(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.log,arguments,{time:true,once:true});}},{key:"log",value:function log(logLevel,message){return this._getLogFunction(logLevel,message,originalConsole.debug,arguments);}},{key:"info",value:function info(logLevel,message){return this._getLogFunction(logLevel,message,console.info,arguments);}},{key:"once",value:function once(logLevel,message){for(var _len=arguments.length,args=new Array(_len>2?_len-2:0),_key=2;_key<_len;_key++){args[_key-2]=arguments[_key];}return this._getLogFunction(logLevel,message,originalConsole.debug||originalConsole.info,arguments,ONCE);}},{key:"table",value:function table(logLevel,_table,columns){if(_table){return this._getLogFunction(logLevel,_table,console.table||noop,columns&&[columns],{tag:getTableHeader(_table)});}return noop;}},{key:"image",value:function image(_ref){var logLevel=_ref.logLevel,priority=_ref.priority,image=_ref.image,_ref$message=_ref.message,message=_ref$message===void 0?'':_ref$message,_ref$scale=_ref.scale,scale=_ref$scale===void 0?1:_ref$scale;if(!this._shouldLog(logLevel||priority)){return noop;}return isBrowser$3?logImageInBrowser({image:image,message:message,scale:scale}):logImageInNode();}},{key:"time",value:function time(logLevel,message){return this._getLogFunction(logLevel,message,console.time?console.time:console.info);}},{key:"timeEnd",value:function timeEnd(logLevel,message){return this._getLogFunction(logLevel,message,console.timeEnd?console.timeEnd:console.info);}},{key:"timeStamp",value:function timeStamp(logLevel,message){return this._getLogFunction(logLevel,message,console.timeStamp||noop);}},{key:"group",value:function group(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{collapsed:false};var options=normalizeArguments({logLevel:logLevel,message:message,opts:opts});var collapsed=opts.collapsed;options.method=(collapsed?console.groupCollapsed:console.group)||console.info;return this._getLogFunction(options);}},{key:"groupCollapsed",value:function groupCollapsed(logLevel,message){var opts=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return this.group(logLevel,message,Object.assign({},opts,{collapsed:true}));}},{key:"groupEnd",value:function groupEnd(logLevel){return this._getLogFunction(logLevel,'',console.groupEnd||noop);}},{key:"withGroup",value:function withGroup(logLevel,message,func){this.group(logLevel,message)();try{func();}finally{this.groupEnd(logLevel)();}}},{key:"trace",value:function trace(){if(console.trace){console.trace();}}},{key:"_shouldLog",value:function _shouldLog(logLevel){return this.isEnabled()&&this.getLevel()>=normalizeLogLevel(logLevel);}},{key:"_getLogFunction",value:function _getLogFunction(logLevel,message,method,args,opts){if(this._shouldLog(logLevel)){var _method;opts=normalizeArguments({logLevel:logLevel,message:message,args:args,opts:opts});method=method||opts.method;assert$7(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once){if(!cache[tag]){cache[tag]=getHiResTimestamp();}else{return noop;}}message=decorateMessage(this.id,opts.message,opts);return(_method=method).bind.apply(_method,[console,message].concat(_toConsumableArray(opts.args)));}return noop;}}]);}();_defineProperty(Log,"VERSION",VERSION$8);function normalizeLogLevel(logLevel){if(!logLevel){return 0;}var resolvedLevel;switch(_typeof2(logLevel)){case'number':resolvedLevel=logLevel;break;case'object':resolvedLevel=logLevel.logLevel||logLevel.priority||0;break;default:return 0;}assert$7(Number.isFinite(resolvedLevel)&&resolvedLevel>=0);return resolvedLevel;}function normalizeArguments(opts){var logLevel=opts.logLevel,message=opts.message;opts.logLevel=normalizeLogLevel(logLevel);var args=opts.args?Array.from(opts.args):[];while(args.length&&args.shift()!==message){}switch(_typeof2(logLevel)){case'string':case'function':if(message!==undefined){args.unshift(message);}opts.message=logLevel;break;case'object':Object.assign(opts,logLevel);break;}if(typeof opts.message==='function'){opts.message=opts.message();}var messageType=_typeof2(opts.message);assert$7(messageType==='string'||messageType==='object');return Object.assign(opts,{args:args},opts.opts);}function decorateMessage(id,message,opts){if(typeof message==='string'){var _time=opts.time?leftPad(formatTime(opts.total)):'';message=opts.time?"".concat(id,": ").concat(_time," ").concat(message):"".concat(id,": ").concat(message);message=addColor(message,opts.color,opts.background);}return message;}function logImageInNode(_ref2){console.warn('removed');return noop;}function logImageInBrowser(_ref3){var image=_ref3.image,_ref3$message=_ref3.message,message=_ref3$message===void 0?'':_ref3$message,_ref3$scale=_ref3.scale,scale=_ref3$scale===void 0?1:_ref3$scale;if(typeof image==='string'){var img=new Image();img.onload=function(){var _console;var args=formatImage(img,message,scale);(_console=console).log.apply(_console,_toConsumableArray(args));};img.src=image;return noop;}var element=image.nodeName||'';if(element.toLowerCase()==='img'){var _console2;(_console2=console).log.apply(_console2,_toConsumableArray(formatImage(image,message,scale)));return noop;}if(element.toLowerCase()==='canvas'){var _img=new Image();_img.onload=function(){var _console3;return(_console3=console).log.apply(_console3,_toConsumableArray(formatImage(_img,message,scale)));};_img.src=image.toDataURL();return noop;}return noop;}function getTableHeader(table){for(var key in table){for(var title in table[key]){return title||'untitled';}}return'empty';}var probeLog=new Log({id:'loaders.gl'});var NullLog=/*#__PURE__*/function(){function NullLog(){_classCallCheck(this,NullLog);}return _createClass(NullLog,[{key:"log",value:function log(){return function(){};}},{key:"info",value:function info(){return function(){};}},{key:"warn",value:function warn(){return function(){};}},{key:"error",value:function error(){return function(){};}}]);}();var ConsoleLog=/*#__PURE__*/function(){function ConsoleLog(){_classCallCheck(this,ConsoleLog);_defineProperty(this,"console",void 0);this.console=console;}return _createClass(ConsoleLog,[{key:"log",value:function log(){var _this$console$log;for(var _len=arguments.length,args=new Array(_len),_key=0;_key<_len;_key++){args[_key]=arguments[_key];}return(_this$console$log=this.console.log).bind.apply(_this$console$log,[this.console].concat(args));}},{key:"info",value:function info(){var _this$console$info;for(var _len2=arguments.length,args=new Array(_len2),_key2=0;_key2<_len2;_key2++){args[_key2]=arguments[_key2];}return(_this$console$info=this.console.info).bind.apply(_this$console$info,[this.console].concat(args));}},{key:"warn",value:function warn(){var _this$console$warn;for(var _len3=arguments.length,args=new Array(_len3),_key3=0;_key3<_len3;_key3++){args[_key3]=arguments[_key3];}return(_this$console$warn=this.console.warn).bind.apply(_this$console$warn,[this.console].concat(args));}},{key:"error",value:function error(){var _this$console$error;for(var _len4=arguments.length,args=new Array(_len4),_key4=0;_key4<_len4;_key4++){args[_key4]=arguments[_key4];}return(_this$console$error=this.console.error).bind.apply(_this$console$error,[this.console].concat(args));}}]);}();var DEFAULT_LOADER_OPTIONS={fetch:null,mimeType:undefined,nothrow:false,log:new ConsoleLog(),CDN:'https://unpkg.com/@loaders.gl',worker:true,maxConcurrency:3,maxMobileConcurrency:1,reuseWorkers:isBrowser$5,_nodeWorkers:false,_workerType:'',limit:0,_limitMB:0,batchSize:'auto',batchDebounceMs:0,metadata:false,transforms:[]};var REMOVED_LOADER_OPTIONS={"throws":'nothrow',dataType:'(no longer used)',uri:'baseUri',method:'fetch.method',headers:'fetch.headers',body:'fetch.body',mode:'fetch.mode',credentials:'fetch.credentials',cache:'fetch.cache',redirect:'fetch.redirect',referrer:'fetch.referrer',referrerPolicy:'fetch.referrerPolicy',integrity:'fetch.integrity',keepalive:'fetch.keepalive',signal:'fetch.signal'};function getGlobalLoaderState(){globalThis.loaders=globalThis.loaders||{};var loaders=globalThis.loaders;loaders._state=loaders._state||{};return loaders._state;}var getGlobalLoaderOptions=function getGlobalLoaderOptions(){var state=getGlobalLoaderState();state.globalOptions=state.globalOptions||_objectSpread({},DEFAULT_LOADER_OPTIONS);return state.globalOptions;};function normalizeOptions(options,loader,loaders,url){loaders=loaders||[];loaders=Array.isArray(loaders)?loaders:[loaders];validateOptions(options,loaders);return normalizeOptionsInternal(loader,options,url);}function validateOptions(options,loaders){validateOptionsObject(options,null,DEFAULT_LOADER_OPTIONS,REMOVED_LOADER_OPTIONS,loaders);var _iterator8=_createForOfIteratorHelper(loaders),_step8;try{for(_iterator8.s();!(_step8=_iterator8.n()).done;){var loader=_step8.value;var idOptions=options&&options[loader.id]||{};var loaderOptions=loader.options&&loader.options[loader.id]||{};var deprecatedOptions=loader.deprecatedOptions&&loader.deprecatedOptions[loader.id]||{};validateOptionsObject(idOptions,loader.id,loaderOptions,deprecatedOptions,loaders);}}catch(err){_iterator8.e(err);}finally{_iterator8.f();}}function validateOptionsObject(options,id,defaultOptions,deprecatedOptions,loaders){var loaderName=id||'Top level';var prefix=id?"".concat(id,"."):'';for(var key in options){var isSubOptions=!id&&isObject(options[key]);var isBaseUriOption=key==='baseUri'&&!id;var isWorkerUrlOption=key==='workerUrl'&&id;if(!(key in defaultOptions)&&!isBaseUriOption&&!isWorkerUrlOption){if(key in deprecatedOptions){probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' no longer supported, use '").concat(deprecatedOptions[key],"'"))();}else if(!isSubOptions){var suggestion=findSimilarOption(key,loaders);probeLog.warn("".concat(loaderName," loader option '").concat(prefix).concat(key,"' not recognized. ").concat(suggestion))();}}}}function findSimilarOption(optionKey,loaders){var lowerCaseOptionKey=optionKey.toLowerCase();var bestSuggestion='';var _iterator9=_createForOfIteratorHelper(loaders),_step9;try{for(_iterator9.s();!(_step9=_iterator9.n()).done;){var loader=_step9.value;for(var key in loader.options){if(optionKey===key){return"Did you mean '".concat(loader.id,".").concat(key,"'?");}var lowerCaseKey=key.toLowerCase();var isPartialMatch=lowerCaseOptionKey.startsWith(lowerCaseKey)||lowerCaseKey.startsWith(lowerCaseOptionKey);if(isPartialMatch){bestSuggestion=bestSuggestion||"Did you mean '".concat(loader.id,".").concat(key,"'?");}}}}catch(err){_iterator9.e(err);}finally{_iterator9.f();}return bestSuggestion;}function normalizeOptionsInternal(loader,options,url){var loaderDefaultOptions=loader.options||{};var mergedOptions=_objectSpread({},loaderDefaultOptions);addUrlOptions(mergedOptions,url);if(mergedOptions.log===null){mergedOptions.log=new NullLog();}mergeNestedFields(mergedOptions,getGlobalLoaderOptions());mergeNestedFields(mergedOptions,options);return mergedOptions;}function mergeNestedFields(mergedOptions,options){for(var key in options){if(key in options){var value=options[key];if(isPureObject(value)&&isPureObject(mergedOptions[key])){mergedOptions[key]=_objectSpread(_objectSpread({},mergedOptions[key]),options[key]);}else{mergedOptions[key]=options[key];}}}}function addUrlOptions(options,url){if(url&&!('baseUri'in options)){options.baseUri=url;}}function isLoaderObject(loader){var _loader;if(!loader){return false;}if(Array.isArray(loader)){loader=loader[0];}var hasExtensions=Array.isArray((_loader=loader)===null||_loader===void 0?void 0:_loader.extensions);return hasExtensions;}function normalizeLoader(loader){var _loader2,_loader3;assert$9(loader,'null loader');assert$9(isLoaderObject(loader),'invalid loader');var options;if(Array.isArray(loader)){options=loader[1];loader=loader[0];loader=_objectSpread(_objectSpread({},loader),{},{options:_objectSpread(_objectSpread({},loader.options),options)});}if((_loader2=loader)!==null&&_loader2!==void 0&&_loader2.parseTextSync||(_loader3=loader)!==null&&_loader3!==void 0&&_loader3.parseText){loader.text=true;}if(!loader.text){loader.binary=true;}return loader;}var getGlobalLoaderRegistry=function getGlobalLoaderRegistry(){var state=getGlobalLoaderState();state.loaderRegistry=state.loaderRegistry||[];return state.loaderRegistry;};function getRegisteredLoaders(){return getGlobalLoaderRegistry();}var log=new Log({id:'loaders.gl'});var EXT_PATTERN=/\.([^.]+)$/;function selectLoader(_x24){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(data){var loaders,options,context,loader,_args14=arguments;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:loaders=_args14.length>1&&_args14[1]!==undefined?_args14[1]:[];options=_args14.length>2?_args14[2]:undefined;context=_args14.length>3?_args14[3]:undefined;if(validHTTPResponse(data)){_context21.next=5;break;}return _context21.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context21.next=8;break;}return _context21.abrupt("return",loader);case 8:if(!isBlob(data)){_context21.next=13;break;}_context21.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context21.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context21.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context21.abrupt("return",loader);case 16:case"end":return _context21.stop();}},_callee18);}));return _selectLoader.apply(this,arguments);}function selectLoaderSync(data){var loaders=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];var options=arguments.length>2?arguments[2]:undefined;var context=arguments.length>3?arguments[3]:undefined;if(!validHTTPResponse(data)){return null;}if(loaders&&!Array.isArray(loaders)){return normalizeLoader(loaders);}var candidateLoaders=[];if(loaders){candidateLoaders=candidateLoaders.concat(loaders);}if(!(options!==null&&options!==void 0&&options.ignoreRegisteredLoaders)){var _candidateLoaders;(_candidateLoaders=candidateLoaders).push.apply(_candidateLoaders,_toConsumableArray(getRegisteredLoaders()));}normalizeLoaders(candidateLoaders);var loader=selectLoaderInternal(data,candidateLoaders,options,context);if(!loader&&!(options!==null&&options!==void 0&&options.nothrow)){throw new Error(getNoValidLoaderMessage(data));}return loader;}function selectLoaderInternal(data,loaders,options,context){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var testUrl=stripQueryString(url)||(context===null||context===void 0?void 0:context.url);var loader=null;var reason='';if(options!==null&&options!==void 0&&options.mimeType){loader=findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.mimeType);reason="match forced by supplied MIME type ".concat(options===null||options===void 0?void 0:options.mimeType);}loader=loader||findLoaderByUrl(loaders,testUrl);reason=reason||(loader?"matched url ".concat(testUrl):'');loader=loader||findLoaderByMIMEType(loaders,type);reason=reason||(loader?"matched MIME type ".concat(type):'');loader=loader||findLoaderByInitialBytes(loaders,data);reason=reason||(loader?"matched initial data ".concat(getFirstCharacters$1(data)):'');loader=loader||findLoaderByMIMEType(loaders,options===null||options===void 0?void 0:options.fallbackMimeType);reason=reason||(loader?"matched fallback MIME type ".concat(type):'');if(reason){var _loader;log.log(1,"selectLoader selected ".concat((_loader=loader)===null||_loader===void 0?void 0:_loader.name,": ").concat(reason,"."));}return loader;}function validHTTPResponse(data){if(data instanceof Response){if(data.status===204){return false;}}return true;}function getNoValidLoaderMessage(data){var url=getResourceUrl(data);var type=getResourceMIMEType(data);var message='No valid loader found (';message+=url?"".concat(filename(url),", "):'no url provided, ';message+="MIME type: ".concat(type?"\"".concat(type,"\""):'not provided',", ");var firstCharacters=data?getFirstCharacters$1(data):'';message+=firstCharacters?" first bytes: \"".concat(firstCharacters,"\""):'first bytes: not available';message+=')';return message;}function normalizeLoaders(loaders){var _iterator10=_createForOfIteratorHelper(loaders),_step10;try{for(_iterator10.s();!(_step10=_iterator10.n()).done;){var loader=_step10.value;normalizeLoader(loader);}}catch(err){_iterator10.e(err);}finally{_iterator10.f();}}function findLoaderByUrl(loaders,url){var match=url&&EXT_PATTERN.exec(url);var extension=match&&match[1];return extension?findLoaderByExtension(loaders,extension):null;}function findLoaderByExtension(loaders,extension){extension=extension.toLowerCase();var _iterator11=_createForOfIteratorHelper(loaders),_step11;try{for(_iterator11.s();!(_step11=_iterator11.n()).done;){var loader=_step11.value;var _iterator12=_createForOfIteratorHelper(loader.extensions),_step12;try{for(_iterator12.s();!(_step12=_iterator12.n()).done;){var loaderExtension=_step12.value;if(loaderExtension.toLowerCase()===extension){return loader;}}}catch(err){_iterator12.e(err);}finally{_iterator12.f();}}}catch(err){_iterator11.e(err);}finally{_iterator11.f();}return null;}function findLoaderByMIMEType(loaders,mimeType){var _iterator13=_createForOfIteratorHelper(loaders),_step13;try{for(_iterator13.s();!(_step13=_iterator13.n()).done;){var loader=_step13.value;if(loader.mimeTypes&&loader.mimeTypes.includes(mimeType)){return loader;}if(mimeType==="application/x.".concat(loader.id)){return loader;}}}catch(err){_iterator13.e(err);}finally{_iterator13.f();}return null;}function findLoaderByInitialBytes(loaders,data){if(!data){return null;}var _iterator14=_createForOfIteratorHelper(loaders),_step14;try{for(_iterator14.s();!(_step14=_iterator14.n()).done;){var loader=_step14.value;if(typeof data==='string'){if(testDataAgainstText(data,loader)){return loader;}}else if(ArrayBuffer.isView(data)){if(testDataAgainstBinary(data.buffer,data.byteOffset,loader)){return loader;}}else if(data instanceof ArrayBuffer){var byteOffset=0;if(testDataAgainstBinary(data,byteOffset,loader)){return loader;}}}}catch(err){_iterator14.e(err);}finally{_iterator14.f();}return null;}function testDataAgainstText(data,loader){if(loader.testText){return loader.testText(data);}var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return data.startsWith(test);});}function testDataAgainstBinary(data,byteOffset,loader){var tests=Array.isArray(loader.tests)?loader.tests:[loader.tests];return tests.some(function(test){return testBinary(data,byteOffset,loader,test);});}function testBinary(data,byteOffset,loader,test){if(test instanceof ArrayBuffer){return compareArrayBuffers(test,data,test.byteLength);}switch(_typeof2(test)){case'function':return test(data,loader);case'string':var magic=getMagicString$2(data,byteOffset,test.length);return test===magic;default:return false;}}function getFirstCharacters$1(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$2(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$2(data,byteOffset,length);}return'';}function getMagicString$2(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i508=0;_i508<length;_i508++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i508));}return magic;}var DEFAULT_CHUNK_SIZE$2=256*1024;function makeStringIterator(string,options){var chunkSize,offset,textEncoder,chunkLength,chunk;return _regeneratorRuntime().wrap(function makeStringIterator$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE$2;offset=0;textEncoder=new TextEncoder();case 3:if(!(offset<string.length)){_context5.next=11;break;}chunkLength=Math.min(string.length-offset,chunkSize);chunk=string.slice(offset,offset+chunkLength);offset+=chunkLength;_context5.next=9;return textEncoder.encode(chunk);case 9:_context5.next=3;break;case 11:case"end":return _context5.stop();}},_marked);}var DEFAULT_CHUNK_SIZE$1=256*1024;function makeArrayBufferIterator(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _options$chunkSize,chunkSize,byteOffset,chunkByteLength,chunk,sourceArray,_chunkArray;return _regeneratorRuntime().wrap(function _callee4$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_options$chunkSize=options.chunkSize,chunkSize=_options$chunkSize===void 0?DEFAULT_CHUNK_SIZE$1:_options$chunkSize;byteOffset=0;case 2:if(!(byteOffset<arrayBuffer.byteLength)){_context6.next=13;break;}chunkByteLength=Math.min(arrayBuffer.byteLength-byteOffset,chunkSize);chunk=new ArrayBuffer(chunkByteLength);sourceArray=new Uint8Array(arrayBuffer,byteOffset,chunkByteLength);_chunkArray=new Uint8Array(chunk);_chunkArray.set(sourceArray);byteOffset+=chunkByteLength;_context6.next=11;return chunk;case 11:_context6.next=2;break;case 13:case"end":return _context6.stop();}},_callee4);})();}var DEFAULT_CHUNK_SIZE=1024*1024;function makeBlobIterator(_x,_x2){return _makeBlobIterator.apply(this,arguments);}function _makeBlobIterator(){_makeBlobIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(blob,options){var chunkSize,offset,end,chunk;return _regeneratorRuntime().wrap(function _callee5$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:chunkSize=(options===null||options===void 0?void 0:options.chunkSize)||DEFAULT_CHUNK_SIZE;offset=0;case 2:if(!(offset<blob.size)){_context7.next=12;break;}end=offset+chunkSize;_context7.next=6;return _awaitAsyncGenerator(blob.slice(offset,end).arrayBuffer());case 6:chunk=_context7.sent;offset=end;_context7.next=10;return chunk;case 10:_context7.next=2;break;case 12:case"end":return _context7.stop();}},_callee5);}));return _makeBlobIterator.apply(this,arguments);}function makeStreamIterator(stream,options){return isBrowser$5?makeBrowserStreamIterator(stream,options):makeNodeStreamIterator(stream);}function makeBrowserStreamIterator(_x3,_x4){return _makeBrowserStreamIterator.apply(this,arguments);}function _makeBrowserStreamIterator(){_makeBrowserStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(stream,options){var reader,nextBatchPromise,currentBatchPromise,_yield$_awaitAsyncGen,done,value;return _regeneratorRuntime().wrap(function _callee6$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:reader=stream.getReader();_context8.prev=1;case 2:if(!true){_context8.next=16;break;}currentBatchPromise=nextBatchPromise||reader.read();if(options!==null&&options!==void 0&&options._streamReadAhead){nextBatchPromise=reader.read();}_context8.next=7;return _awaitAsyncGenerator(currentBatchPromise);case 7:_yield$_awaitAsyncGen=_context8.sent;done=_yield$_awaitAsyncGen.done;value=_yield$_awaitAsyncGen.value;if(!done){_context8.next=12;break;}return _context8.abrupt("return");case 12:_context8.next=14;return toArrayBuffer(value);case 14:_context8.next=2;break;case 16:_context8.next=21;break;case 18:_context8.prev=18;_context8.t0=_context8["catch"](1);reader.releaseLock();case 21:case"end":return _context8.stop();}},_callee6,null,[[1,18]]);}));return _makeBrowserStreamIterator.apply(this,arguments);}function makeNodeStreamIterator(_x5,_x6){return _makeNodeStreamIterator.apply(this,arguments);}function _makeNodeStreamIterator(){_makeNodeStreamIterator=_wrapAsyncGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(stream,options){var _iteratorAbruptCompletion2,_didIteratorError2,_iteratorError2,_iterator2,_step2,chunk;return _regeneratorRuntime().wrap(function _callee7$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_iteratorAbruptCompletion2=false;_didIteratorError2=false;_context9.prev=2;_iterator2=_asyncIterator(stream);case 4:_context9.next=6;return _awaitAsyncGenerator(_iterator2.next());case 6:if(!(_iteratorAbruptCompletion2=!(_step2=_context9.sent).done)){_context9.next=13;break;}chunk=_step2.value;_context9.next=10;return toArrayBuffer(chunk);case 10:_iteratorAbruptCompletion2=false;_context9.next=4;break;case 13:_context9.next=19;break;case 15:_context9.prev=15;_context9.t0=_context9["catch"](2);_didIteratorError2=true;_iteratorError2=_context9.t0;case 19:_context9.prev=19;_context9.prev=20;if(!(_iteratorAbruptCompletion2&&_iterator2["return"]!=null)){_context9.next=24;break;}_context9.next=24;return _awaitAsyncGenerator(_iterator2["return"]());case 24:_context9.prev=24;if(!_didIteratorError2){_context9.next=27;break;}throw _iteratorError2;case 27:return _context9.finish(24);case 28:return _context9.finish(19);case 29:case"end":return _context9.stop();}},_callee7,null,[[2,15,19,29],[20,,24,28]]);}));return _makeNodeStreamIterator.apply(this,arguments);}function makeIterator(data,options){if(typeof data==='string'){return makeStringIterator(data,options);}if(data instanceof ArrayBuffer){return makeArrayBufferIterator(data,options);}if(isBlob(data)){return makeBlobIterator(data,options);}if(isReadableStream(data)){return makeStreamIterator(data,options);}if(isResponse(data)){var response=data;return makeStreamIterator(response.body,options);}throw new Error('makeIterator');}var ERR_DATA='Cannot convert supplied data type';function getArrayBufferOrStringFromDataSync(data,loader,options){if(loader.text&&typeof data==='string'){return data;}if(isBuffer(data)){data=data.buffer;}if(data instanceof ArrayBuffer){var arrayBuffer=data;if(loader.text&&!loader.binary){var textDecoder=new TextDecoder('utf8');return textDecoder.decode(arrayBuffer);}return arrayBuffer;}if(ArrayBuffer.isView(data)){if(loader.text&&!loader.binary){var _textDecoder=new TextDecoder('utf8');return _textDecoder.decode(data);}var _arrayBuffer=data.buffer;var byteLength=data.byteLength||data.length;if(data.byteOffset!==0||byteLength!==_arrayBuffer.byteLength){_arrayBuffer=_arrayBuffer.slice(data.byteOffset,data.byteOffset+byteLength);}return _arrayBuffer;}throw new Error(ERR_DATA);}function getArrayBufferOrStringFromData(_x25,_x26,_x27){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context22.next=3;break;}return _context22.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context22.next=7;break;}_context22.next=6;return makeResponse(data);case 6:data=_context22.sent;case 7:if(!isResponse(data)){_context22.next=21;break;}response=data;_context22.next=11;return checkResponse(response);case 11:if(!loader.binary){_context22.next=17;break;}_context22.next=14;return response.arrayBuffer();case 14:_context22.t0=_context22.sent;_context22.next=20;break;case 17:_context22.next=19;return response.text();case 19:_context22.t0=_context22.sent;case 20:return _context22.abrupt("return",_context22.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context22.next=24;break;}return _context22.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context22.stop();}},_callee19);}));return _getArrayBufferOrStringFromData.apply(this,arguments);}function getFetchFunction(options,context){var globalOptions=getGlobalLoaderOptions();var fetchOptions=options||globalOptions;if(typeof fetchOptions.fetch==='function'){return fetchOptions.fetch;}if(isObject(fetchOptions.fetch)){return function(url){return fetchFile(url,fetchOptions);};}if(context!==null&&context!==void 0&&context.fetch){return context===null||context===void 0?void 0:context.fetch;}return fetchFile;}function getLoaderContext(context,options,parentContext){if(parentContext){return parentContext;}var newContext=_objectSpread({fetch:getFetchFunction(options,context)},context);if(newContext.url){var baseUrl=stripQueryString(newContext.url);newContext.baseUrl=baseUrl;newContext.queryString=extractQueryString(newContext.url);newContext.filename=filename(baseUrl);newContext.baseUrl=dirname(baseUrl);}if(!Array.isArray(newContext.loaders)){newContext.loaders=null;}return newContext;}function getLoadersFromContext(loaders,context){if(!context&&loaders&&!Array.isArray(loaders)){return loaders;}var candidateLoaders;if(loaders){candidateLoaders=Array.isArray(loaders)?loaders:[loaders];}if(context&&context.loaders){var contextLoaders=Array.isArray(context.loaders)?context.loaders:[context.loaders];candidateLoaders=candidateLoaders?[].concat(_toConsumableArray(candidateLoaders),_toConsumableArray(contextLoaders)):contextLoaders;}return candidateLoaders&&candidateLoaders.length?candidateLoaders:null;}function parse$2(_x28,_x29,_x30,_x31){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:assert$8(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context23.next=4;return data;case 4:data=_context23.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context23.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context23.sent;if(loader){_context23.next=14;break;}return _context23.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context23.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context23.abrupt("return",_context23.sent);case 19:case"end":return _context23.stop();}},_callee20);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x32,_x33,_x34,_x35){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:validateWorkerVersion(loader);if(isResponse(data)){response=data;ok=response.ok,redirected=response.redirected,status=response.status,statusText=response.statusText,type=response.type,url=response.url;headers=Object.fromEntries(response.headers.entries());context.response={headers:headers,ok:ok,redirected:redirected,status:status,statusText:statusText,type:type,url:url};}_context24.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context24.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context24.next=8;break;}options.dataType='text';return _context24.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context24.next=12;break;}_context24.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context24.abrupt("return",_context24.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context24.next=16;break;}_context24.next=15;return loader.parseText(data,options,context,loader);case 15:return _context24.abrupt("return",_context24.sent);case 16:if(!loader.parse){_context24.next=20;break;}_context24.next=19;return loader.parse(data,options,context,loader);case 19:return _context24.abrupt("return",_context24.sent);case 20:assert$8(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context24.stop();}},_callee21);}));return _parseWithLoader.apply(this,arguments);}var VERSION$7="3.4.15";function assert$6(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals$1={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_$1=globals$1.global||globals$1.self||globals$1.window||{};var isBrowser$2=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker$1=typeof importScripts==='function';var matches$2=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$2&&parseFloat(matches$2[1])||0;var readFileAsArrayBuffer$1=null;var readFileAsText$1=null;var requireFromFile$1=null;var requireFromString$1=null;var node$1=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer$1,readFileAsText:readFileAsText$1,requireFromFile:requireFromFile$1,requireFromString:requireFromString$1});var VERSION$6="3.4.15";var loadLibraryPromises$1={};function loadLibrary$1(_x36){return _loadLibrary$.apply(this,arguments);}function _loadLibrary$(){_loadLibrary$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(libraryUrl){var moduleName,options,_args18=arguments;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.next){case 0:moduleName=_args18.length>1&&_args18[1]!==undefined?_args18[1]:null;options=_args18.length>2&&_args18[2]!==undefined?_args18[2]:{};if(moduleName){libraryUrl=getLibraryUrl$1(libraryUrl,moduleName,options);}loadLibraryPromises$1[libraryUrl]=loadLibraryPromises$1[libraryUrl]||loadLibraryFromFile$1(libraryUrl);_context25.next=6;return loadLibraryPromises$1[libraryUrl];case 6:return _context25.abrupt("return",_context25.sent);case 7:case"end":return _context25.stop();}},_callee22);}));return _loadLibrary$.apply(this,arguments);}function getLibraryUrl$1(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser$2){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$6(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$6,"/dist/libs/").concat(library);}if(isWorker$1){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile$1(_x37){return _loadLibraryFromFile$.apply(this,arguments);}function _loadLibraryFromFile$(){_loadLibraryFromFile$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee23(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee23$(_context26){while(1)switch(_context26.prev=_context26.next){case 0:if(!libraryUrl.endsWith('wasm')){_context26.next=7;break;}_context26.next=3;return fetch(libraryUrl);case 3:_response=_context26.sent;_context26.next=6;return _response.arrayBuffer();case 6:return _context26.abrupt("return",_context26.sent);case 7:if(isBrowser$2){_context26.next=20;break;}_context26.prev=8;_context26.t0=node$1&&requireFromFile$1;if(!_context26.t0){_context26.next=14;break;}_context26.next=13;return requireFromFile$1(libraryUrl);case 13:_context26.t0=_context26.sent;case 14:return _context26.abrupt("return",_context26.t0);case 17:_context26.prev=17;_context26.t1=_context26["catch"](8);return _context26.abrupt("return",null);case 20:if(!isWorker$1){_context26.next=22;break;}return _context26.abrupt("return",importScripts(libraryUrl));case 22:_context26.next=24;return fetch(libraryUrl);case 24:response=_context26.sent;_context26.next=27;return response.text();case 27:scriptSource=_context26.sent;return _context26.abrupt("return",loadLibraryFromString$1(scriptSource,libraryUrl));case 29:case"end":return _context26.stop();}},_callee23,null,[[8,17]]);}));return _loadLibraryFromFile$.apply(this,arguments);}function loadLibraryFromString$1(scriptSource,id){if(!isBrowser$2){return requireFromString$1;}if(isWorker$1){eval.call(global_$1,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$5="3.4.15";var VERSION$4="3.4.15";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$4,"/dist/libs/basis_encoder.js");var loadBasisTranscoderPromise;function loadBasisTrascoderModule(_x38){return _loadBasisTrascoderModule.apply(this,arguments);}function _loadBasisTrascoderModule(){_loadBasisTrascoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee24(options){var modules;return _regeneratorRuntime().wrap(function _callee24$(_context27){while(1)switch(_context27.prev=_context27.next){case 0:modules=options.modules||{};if(!modules.basis){_context27.next=3;break;}return _context27.abrupt("return",modules.basis);case 3:loadBasisTranscoderPromise=loadBasisTranscoderPromise||loadBasisTrascoder(options);_context27.next=6;return loadBasisTranscoderPromise;case 6:return _context27.abrupt("return",_context27.sent);case 7:case"end":return _context27.stop();}},_callee24);}));return _loadBasisTrascoderModule.apply(this,arguments);}function loadBasisTrascoder(_x39){return _loadBasisTrascoder.apply(this,arguments);}function _loadBasisTrascoder(){_loadBasisTrascoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee25(options){var BASIS,wasmBinary,_yield$Promise$all,_yield$Promise$all2;return _regeneratorRuntime().wrap(function _callee25$(_context28){while(1)switch(_context28.prev=_context28.next){case 0:BASIS=null;wasmBinary=null;_context28.t0=Promise;_context28.next=5;return loadLibrary$1('basis_transcoder.js','textures',options);case 5:_context28.t1=_context28.sent;_context28.next=8;return loadLibrary$1('basis_transcoder.wasm','textures',options);case 8:_context28.t2=_context28.sent;_context28.t3=[_context28.t1,_context28.t2];_context28.next=12;return _context28.t0.all.call(_context28.t0,_context28.t3);case 12:_yield$Promise$all=_context28.sent;_yield$Promise$all2=_slicedToArray(_yield$Promise$all,2);BASIS=_yield$Promise$all2[0];wasmBinary=_yield$Promise$all2[1];BASIS=BASIS||globalThis.BASIS;_context28.next=19;return initializeBasisTrascoderModule(BASIS,wasmBinary);case 19:return _context28.abrupt("return",_context28.sent);case 20:case"end":return _context28.stop();}},_callee25);}));return _loadBasisTrascoder.apply(this,arguments);}function initializeBasisTrascoderModule(BasisModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisModule(options).then(function(module){var BasisFile=module.BasisFile,initializeBasis=module.initializeBasis;initializeBasis();resolve({BasisFile:BasisFile});});});}var loadBasisEncoderPromise;function loadBasisEncoderModule(_x40){return _loadBasisEncoderModule.apply(this,arguments);}function _loadBasisEncoderModule(){_loadBasisEncoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee26(options){var modules;return _regeneratorRuntime().wrap(function _callee26$(_context29){while(1)switch(_context29.prev=_context29.next){case 0:modules=options.modules||{};if(!modules.basisEncoder){_context29.next=3;break;}return _context29.abrupt("return",modules.basisEncoder);case 3:loadBasisEncoderPromise=loadBasisEncoderPromise||loadBasisEncoder(options);_context29.next=6;return loadBasisEncoderPromise;case 6:return _context29.abrupt("return",_context29.sent);case 7:case"end":return _context29.stop();}},_callee26);}));return _loadBasisEncoderModule.apply(this,arguments);}function loadBasisEncoder(_x41){return _loadBasisEncoder.apply(this,arguments);}function _loadBasisEncoder(){_loadBasisEncoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee27(options){var BASIS_ENCODER,wasmBinary,_yield$Promise$all3,_yield$Promise$all4;return _regeneratorRuntime().wrap(function _callee27$(_context30){while(1)switch(_context30.prev=_context30.next){case 0:BASIS_ENCODER=null;wasmBinary=null;_context30.t0=Promise;_context30.next=5;return loadLibrary$1(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context30.t1=_context30.sent;_context30.next=8;return loadLibrary$1(BASIS_CDN_ENCODER_WASM,'textures',options);case 8:_context30.t2=_context30.sent;_context30.t3=[_context30.t1,_context30.t2];_context30.next=12;return _context30.t0.all.call(_context30.t0,_context30.t3);case 12:_yield$Promise$all3=_context30.sent;_yield$Promise$all4=_slicedToArray(_yield$Promise$all3,2);BASIS_ENCODER=_yield$Promise$all4[0];wasmBinary=_yield$Promise$all4[1];BASIS_ENCODER=BASIS_ENCODER||globalThis.BASIS;_context30.next=19;return initializeBasisEncoderModule(BASIS_ENCODER,wasmBinary);case 19:return _context30.abrupt("return",_context30.sent);case 20:case"end":return _context30.stop();}},_callee27);}));return _loadBasisEncoder.apply(this,arguments);}function initializeBasisEncoderModule(BasisEncoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){BasisEncoderModule(options).then(function(module){var BasisFile=module.BasisFile,KTX2File=module.KTX2File,initializeBasis=module.initializeBasis,BasisEncoder=module.BasisEncoder;initializeBasis();resolve({BasisFile:BasisFile,KTX2File:KTX2File,BasisEncoder:BasisEncoder});});});}var GL_EXTENSIONS_CONSTANTS={COMPRESSED_RGB_S3TC_DXT1_EXT:0x83f0,COMPRESSED_RGBA_S3TC_DXT1_EXT:0x83f1,COMPRESSED_RGBA_S3TC_DXT3_EXT:0x83f2,COMPRESSED_RGBA_S3TC_DXT5_EXT:0x83f3,COMPRESSED_R11_EAC:0x9270,COMPRESSED_SIGNED_R11_EAC:0x9271,COMPRESSED_RG11_EAC:0x9272,COMPRESSED_SIGNED_RG11_EAC:0x9273,COMPRESSED_RGB8_ETC2:0x9274,COMPRESSED_RGBA8_ETC2_EAC:0x9275,COMPRESSED_SRGB8_ETC2:0x9276,COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:0x9277,COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9278,COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:0x9279,COMPRESSED_RGB_PVRTC_4BPPV1_IMG:0x8c00,COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:0x8c02,COMPRESSED_RGB_PVRTC_2BPPV1_IMG:0x8c01,COMPRESSED_RGBA_PVRTC_2BPPV1_IMG:0x8c03,COMPRESSED_RGB_ETC1_WEBGL:0x8d64,COMPRESSED_RGB_ATC_WEBGL:0x8c92,COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL:0x8c93,COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL:0x87ee,COMPRESSED_RGBA_ASTC_4X4_KHR:0x93b0,COMPRESSED_RGBA_ASTC_5X4_KHR:0x93b1,COMPRESSED_RGBA_ASTC_5X5_KHR:0x93b2,COMPRESSED_RGBA_ASTC_6X5_KHR:0x93b3,COMPRESSED_RGBA_ASTC_6X6_KHR:0x93b4,COMPRESSED_RGBA_ASTC_8X5_KHR:0x93b5,COMPRESSED_RGBA_ASTC_8X6_KHR:0x93b6,COMPRESSED_RGBA_ASTC_8X8_KHR:0x93b7,COMPRESSED_RGBA_ASTC_10X5_KHR:0x93b8,COMPRESSED_RGBA_ASTC_10X6_KHR:0x93b9,COMPRESSED_RGBA_ASTC_10X8_KHR:0x93ba,COMPRESSED_RGBA_ASTC_10X10_KHR:0x93bb,COMPRESSED_RGBA_ASTC_12X10_KHR:0x93bc,COMPRESSED_RGBA_ASTC_12X12_KHR:0x93bd,COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR:0x93d0,COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR:0x93d1,COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR:0x93d2,COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR:0x93d3,COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR:0x93d4,COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR:0x93d5,COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR:0x93d6,COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR:0x93d7,COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR:0x93d8,COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR:0x93d9,COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR:0x93da,COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR:0x93db,COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR:0x93dc,COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR:0x93dd,COMPRESSED_RED_RGTC1_EXT:0x8dbb,COMPRESSED_SIGNED_RED_RGTC1_EXT:0x8dbc,COMPRESSED_RED_GREEN_RGTC2_EXT:0x8dbd,COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT:0x8dbe,COMPRESSED_SRGB_S3TC_DXT1_EXT:0x8c4c,COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:0x8c4d,COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT:0x8c4e,COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:0x8c4f};var BROWSER_PREFIXES=['','WEBKIT_','MOZ_'];var WEBGL_EXTENSIONS={WEBGL_compressed_texture_s3tc:'dxt',WEBGL_compressed_texture_s3tc_srgb:'dxt-srgb',WEBGL_compressed_texture_etc1:'etc1',WEBGL_compressed_texture_etc:'etc2',WEBGL_compressed_texture_pvrtc:'pvrtc',WEBGL_compressed_texture_atc:'atc',WEBGL_compressed_texture_astc:'astc',EXT_texture_compression_rgtc:'rgtc'};var formats=null;function getSupportedGPUTextureFormats(gl){if(!formats){gl=gl||getWebGLContext()||undefined;formats=new Set();var _iterator15=_createForOfIteratorHelper(BROWSER_PREFIXES),_step15;try{for(_iterator15.s();!(_step15=_iterator15.n()).done;){var prefix=_step15.value;for(var extension in WEBGL_EXTENSIONS){if(gl&&gl.getExtension("".concat(prefix).concat(extension))){var gpuTextureFormat=WEBGL_EXTENSIONS[extension];formats.add(gpuTextureFormat);}}}}catch(err){_iterator15.e(err);}finally{_iterator15.f();}}return formats;}function getWebGLContext(){try{var _canvas6=document.createElement('canvas');return _canvas6.getContext('webgl');}catch(error){return null;}}var n,i,s,a,r,o,l,f;!function(t){t[t.NONE=0]="NONE",t[t.BASISLZ=1]="BASISLZ",t[t.ZSTD=2]="ZSTD",t[t.ZLIB=3]="ZLIB";}(n||(n={})),function(t){t[t.BASICFORMAT=0]="BASICFORMAT";}(i||(i={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ETC1S=163]="ETC1S",t[t.UASTC=166]="UASTC";}(s||(s={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.SRGB=1]="SRGB";}(a||(a={})),function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.LINEAR=1]="LINEAR",t[t.SRGB=2]="SRGB",t[t.ITU=3]="ITU",t[t.NTSC=4]="NTSC",t[t.SLOG=5]="SLOG",t[t.SLOG2=6]="SLOG2";}(r||(r={})),function(t){t[t.ALPHA_STRAIGHT=0]="ALPHA_STRAIGHT",t[t.ALPHA_PREMULTIPLIED=1]="ALPHA_PREMULTIPLIED";}(o||(o={})),function(t){t[t.RGB=0]="RGB",t[t.RRR=3]="RRR",t[t.GGG=4]="GGG",t[t.AAA=15]="AAA";}(l||(l={})),function(t){t[t.RGB=0]="RGB",t[t.RGBA=3]="RGBA",t[t.RRR=4]="RRR",t[t.RRRG=5]="RRRG";}(f||(f={}));var KTX2_ID=[0xab,0x4b,0x54,0x58,0x20,0x32,0x30,0xbb,0x0d,0x0a,0x1a,0x0a];function isKTX(data){var id=new Uint8Array(data);var notKTX=id.byteLength<KTX2_ID.length||id[0]!==KTX2_ID[0]||id[1]!==KTX2_ID[1]||id[2]!==KTX2_ID[2]||id[3]!==KTX2_ID[3]||id[4]!==KTX2_ID[4]||id[5]!==KTX2_ID[5]||id[6]!==KTX2_ID[6]||id[7]!==KTX2_ID[7]||id[8]!==KTX2_ID[8]||id[9]!==KTX2_ID[9]||id[10]!==KTX2_ID[10]||id[11]!==KTX2_ID[11];return!notKTX;}var OutputFormat={etc1:{basisFormat:0,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_ETC1_WEBGL},etc2:{basisFormat:1,compressed:true},bc1:{basisFormat:2,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_S3TC_DXT1_EXT},bc3:{basisFormat:3,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_S3TC_DXT5_EXT},bc4:{basisFormat:4,compressed:true},bc5:{basisFormat:5,compressed:true},'bc7-m6-opaque-only':{basisFormat:6,compressed:true},'bc7-m5':{basisFormat:7,compressed:true},'pvrtc1-4-rgb':{basisFormat:8,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGB_PVRTC_4BPPV1_IMG},'pvrtc1-4-rgba':{basisFormat:9,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG},'astc-4x4':{basisFormat:10,compressed:true,format:GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4X4_KHR},'atc-rgb':{basisFormat:11,compressed:true},'atc-rgba-interpolated-alpha':{basisFormat:12,compressed:true},rgba32:{basisFormat:13,compressed:false},rgb565:{basisFormat:14,compressed:false},bgr565:{basisFormat:15,compressed:false},rgba4444:{basisFormat:16,compressed:false}};function parseBasis(_x42,_x43){return _parseBasis.apply(this,arguments);}function _parseBasis(){_parseBasis=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee28(data,options){var fileConstructors,_yield$loadBasisTrasc,BasisFile,_fileConstructors,_yield$loadBasisTrasc2,_BasisFile;return _regeneratorRuntime().wrap(function _callee28$(_context31){while(1)switch(_context31.prev=_context31.next){case 0:if(!(options.basis.containerFormat==='auto')){_context31.next=11;break;}if(!isKTX(data)){_context31.next=6;break;}_context31.next=4;return loadBasisEncoderModule(options);case 4:fileConstructors=_context31.sent;return _context31.abrupt("return",parseKTX2File(fileConstructors.KTX2File,data,options));case 6:_context31.next=8;return loadBasisTrascoderModule(options);case 8:_yield$loadBasisTrasc=_context31.sent;BasisFile=_yield$loadBasisTrasc.BasisFile;return _context31.abrupt("return",parseBasisFile(BasisFile,data,options));case 11:_context31.t0=options.basis.module;_context31.next=_context31.t0==='encoder'?14:_context31.t0==='transcoder'?22:22;break;case 14:_context31.next=16;return loadBasisEncoderModule(options);case 16:_fileConstructors=_context31.sent;_context31.t1=options.basis.containerFormat;_context31.next=_context31.t1==='ktx2'?20:_context31.t1==='basis'?21:21;break;case 20:return _context31.abrupt("return",parseKTX2File(_fileConstructors.KTX2File,data,options));case 21:return _context31.abrupt("return",parseBasisFile(_fileConstructors.BasisFile,data,options));case 22:_context31.next=24;return loadBasisTrascoderModule(options);case 24:_yield$loadBasisTrasc2=_context31.sent;_BasisFile=_yield$loadBasisTrasc2.BasisFile;return _context31.abrupt("return",parseBasisFile(_BasisFile,data,options));case 27:case"end":return _context31.stop();}},_callee28);}));return _parseBasis.apply(this,arguments);}function parseBasisFile(BasisFile,data,options){var basisFile=new BasisFile(new Uint8Array(data));try{if(!basisFile.startTranscoding()){throw new Error('Failed to start basis transcoding');}var imageCount=basisFile.getNumImages();var images=[];for(var imageIndex=0;imageIndex<imageCount;imageIndex++){var levelsCount=basisFile.getNumLevels(imageIndex);var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeImage(basisFile,imageIndex,levelIndex,options));}images.push(levels);}return images;}finally{basisFile.close();basisFile["delete"]();}}function transcodeImage(basisFile,imageIndex,levelIndex,options){var width=basisFile.getImageWidth(imageIndex,levelIndex);var height=basisFile.getImageHeight(imageIndex,levelIndex);var hasAlpha=basisFile.getHasAlpha();var _getBasisOptions=getBasisOptions(options,hasAlpha),compressed=_getBasisOptions.compressed,format=_getBasisOptions.format,basisFormat=_getBasisOptions.basisFormat;var decodedSize=basisFile.getImageTranscodedSizeInBytes(imageIndex,levelIndex,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!basisFile.transcodeImage(decodedData,imageIndex,levelIndex,basisFormat,0,0)){throw new Error('failed to start Basis transcoding');}return{width:width,height:height,data:decodedData,compressed:compressed,format:format,hasAlpha:hasAlpha};}function parseKTX2File(KTX2File,data,options){var ktx2File=new KTX2File(new Uint8Array(data));try{if(!ktx2File.startTranscoding()){throw new Error('failed to start KTX2 transcoding');}var levelsCount=ktx2File.getLevels();var levels=[];for(var levelIndex=0;levelIndex<levelsCount;levelIndex++){levels.push(transcodeKTX2Image(ktx2File,levelIndex,options));break;}return[levels];}finally{ktx2File.close();ktx2File["delete"]();}}function transcodeKTX2Image(ktx2File,levelIndex,options){var _ktx2File$getImageLev=ktx2File.getImageLevelInfo(levelIndex,0,0),alphaFlag=_ktx2File$getImageLev.alphaFlag,height=_ktx2File$getImageLev.height,width=_ktx2File$getImageLev.width;var _getBasisOptions2=getBasisOptions(options,alphaFlag),compressed=_getBasisOptions2.compressed,format=_getBasisOptions2.format,basisFormat=_getBasisOptions2.basisFormat;var decodedSize=ktx2File.getImageTranscodedSizeInBytes(levelIndex,0,0,basisFormat);var decodedData=new Uint8Array(decodedSize);if(!ktx2File.transcodeImage(decodedData,levelIndex,0,0,basisFormat,0,-1,-1)){throw new Error('Failed to transcode KTX2 image');}return{width:width,height:height,data:decodedData,compressed:compressed,levelSize:decodedSize,hasAlpha:alphaFlag,format:format};}function getBasisOptions(options,hasAlpha){var format=options&&options.basis&&options.basis.format;if(format==='auto'){format=selectSupportedBasisFormat();}if(_typeof2(format)==='object'){format=hasAlpha?format.alpha:format.noAlpha;}format=format.toLowerCase();return OutputFormat[format];}function selectSupportedBasisFormat(){var supportedFormats=getSupportedGPUTextureFormats();if(supportedFormats.has('astc')){return'astc-4x4';}else if(supportedFormats.has('dxt')){return{alpha:'bc3',noAlpha:'bc1'};}else if(supportedFormats.has('pvrtc')){return{alpha:'pvrtc1-4-rgba',noAlpha:'pvrtc1-4-rgb'};}else if(supportedFormats.has('etc1')){return'etc1';}else if(supportedFormats.has('etc2')){return'etc2';}return'rgb565';}var BasisWorkerLoader={name:'Basis',id:isBrowser$2?'basis':'basis-nodejs',module:'textures',version:VERSION$5,worker:true,extensions:['basis','ktx2'],mimeTypes:['application/octet-stream','image/ktx2'],tests:['sB'],binary:true,options:{basis:{format:'auto',libraryPath:'libs/',containerFormat:'auto',module:'transcoder'}}};var BasisLoader=_objectSpread(_objectSpread({},BasisWorkerLoader),{},{parse:parseBasis});var VERSION$3="3.4.15";function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$1=Boolean((typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser);var matches$1=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches$1&&parseFloat(matches$1[1])||0;var _parseImageNode=globalThis._parseImageNode;var IMAGE_SUPPORTED=typeof Image!=='undefined';var IMAGE_BITMAP_SUPPORTED=typeof ImageBitmap!=='undefined';var NODE_IMAGE_SUPPORTED=Boolean(_parseImageNode);var DATA_SUPPORTED=isBrowser$1?true:NODE_IMAGE_SUPPORTED;function isImageTypeSupported(type){switch(type){case'auto':return IMAGE_BITMAP_SUPPORTED||IMAGE_SUPPORTED||DATA_SUPPORTED;case'imagebitmap':return IMAGE_BITMAP_SUPPORTED;case'image':return IMAGE_SUPPORTED;case'data':return DATA_SUPPORTED;default:throw new Error("@loaders.gl/images: image ".concat(type," not supported in this environment"));}}function getDefaultImageType(){if(IMAGE_BITMAP_SUPPORTED){return'imagebitmap';}if(IMAGE_SUPPORTED){return'image';}if(DATA_SUPPORTED){return'data';}throw new Error('Install \'@loaders.gl/polyfills\' to parse images under Node.js');}function getImageType(image){var format=getImageTypeOrNull(image);if(!format){throw new Error('Not an image');}return format;}function getImageData(image){switch(getImageType(image)){case'data':return image;case'image':case'imagebitmap':var _canvas7=document.createElement('canvas');var context=_canvas7.getContext('2d');if(!context){throw new Error('getImageData');}_canvas7.width=image.width;_canvas7.height=image.height;context.drawImage(image,0,0);return context.getImageData(0,0,image.width,image.height);default:throw new Error('getImageData');}}function getImageTypeOrNull(image){if(typeof ImageBitmap!=='undefined'&&image instanceof ImageBitmap){return'imagebitmap';}if(typeof Image!=='undefined'&&image instanceof Image){return'image';}if(image&&_typeof2(image)==='object'&&image.data&&image.width&&image.height){return'data';}return null;}var SVG_DATA_URL_PATTERN=/^data:image\/svg\+xml/;var SVG_URL_PATTERN=/\.svg((\?|#).*)?$/;function isSVG(url){return url&&(SVG_DATA_URL_PATTERN.test(url)||SVG_URL_PATTERN.test(url));}function getBlobOrSVGDataUrl(arrayBuffer,url){if(isSVG(url)){var textDecoder=new TextDecoder();var xmlText=textDecoder.decode(arrayBuffer);try{if(typeof unescape==='function'&&typeof encodeURIComponent==='function'){xmlText=unescape(encodeURIComponent(xmlText));}}catch(error){throw new Error(error.message);}var src="data:image/svg+xml;base64,".concat(btoa(xmlText));return src;}return getBlob(arrayBuffer,url);}function getBlob(arrayBuffer,url){if(isSVG(url)){throw new Error('SVG cannot be parsed directly to imagebitmap');}return new Blob([new Uint8Array(arrayBuffer)]);}function parseToImage(_x44,_x45,_x46){return _parseToImage.apply(this,arguments);}function _parseToImage(){_parseToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee29(arrayBuffer,options,url){var blobOrDataUrl,URL,objectUrl;return _regeneratorRuntime().wrap(function _callee29$(_context32){while(1)switch(_context32.prev=_context32.next){case 0:blobOrDataUrl=getBlobOrSVGDataUrl(arrayBuffer,url);URL=self.URL||self.webkitURL;objectUrl=typeof blobOrDataUrl!=='string'&&URL.createObjectURL(blobOrDataUrl);_context32.prev=3;_context32.next=6;return loadToImage(objectUrl||blobOrDataUrl,options);case 6:return _context32.abrupt("return",_context32.sent);case 7:_context32.prev=7;if(objectUrl){URL.revokeObjectURL(objectUrl);}return _context32.finish(7);case 10:case"end":return _context32.stop();}},_callee29,null,[[3,,7,10]]);}));return _parseToImage.apply(this,arguments);}function loadToImage(_x47,_x48){return _loadToImage.apply(this,arguments);}function _loadToImage(){_loadToImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(url,options){var image;return _regeneratorRuntime().wrap(function _callee30$(_context33){while(1)switch(_context33.prev=_context33.next){case 0:image=new Image();image.src=url;if(!(options.image&&options.image.decode&&image.decode)){_context33.next=6;break;}_context33.next=5;return image.decode();case 5:return _context33.abrupt("return",image);case 6:_context33.next=8;return new Promise(function(resolve,reject){try{image.onload=function(){return resolve(image);};image.onerror=function(err){return reject(new Error("Could not load image ".concat(url,": ").concat(err)));};}catch(error){reject(error);}});case 8:return _context33.abrupt("return",_context33.sent);case 9:case"end":return _context33.stop();}},_callee30);}));return _loadToImage.apply(this,arguments);}var EMPTY_OBJECT={};var imagebitmapOptionsSupported=true;function parseToImageBitmap(_x49,_x50,_x51){return _parseToImageBitmap.apply(this,arguments);}function _parseToImageBitmap(){_parseToImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee31(arrayBuffer,options,url){var blob,_image7,imagebitmapOptions;return _regeneratorRuntime().wrap(function _callee31$(_context34){while(1)switch(_context34.prev=_context34.next){case 0:if(!isSVG(url)){_context34.next=7;break;}_context34.next=3;return parseToImage(arrayBuffer,options,url);case 3:_image7=_context34.sent;blob=_image7;_context34.next=8;break;case 7:blob=getBlob(arrayBuffer,url);case 8:imagebitmapOptions=options&&options.imagebitmap;_context34.next=11;return safeCreateImageBitmap(blob,imagebitmapOptions);case 11:return _context34.abrupt("return",_context34.sent);case 12:case"end":return _context34.stop();}},_callee31);}));return _parseToImageBitmap.apply(this,arguments);}function safeCreateImageBitmap(_x52){return _safeCreateImageBitmap.apply(this,arguments);}function _safeCreateImageBitmap(){_safeCreateImageBitmap=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee32(blob){var imagebitmapOptions,_args28=arguments;return _regeneratorRuntime().wrap(function _callee32$(_context35){while(1)switch(_context35.prev=_context35.next){case 0:imagebitmapOptions=_args28.length>1&&_args28[1]!==undefined?_args28[1]:null;if(isEmptyObject(imagebitmapOptions)||!imagebitmapOptionsSupported){imagebitmapOptions=null;}if(!imagebitmapOptions){_context35.next=13;break;}_context35.prev=3;_context35.next=6;return createImageBitmap(blob,imagebitmapOptions);case 6:return _context35.abrupt("return",_context35.sent);case 9:_context35.prev=9;_context35.t0=_context35["catch"](3);console.warn(_context35.t0);imagebitmapOptionsSupported=false;case 13:_context35.next=15;return createImageBitmap(blob);case 15:return _context35.abrupt("return",_context35.sent);case 16:case"end":return _context35.stop();}},_callee32,null,[[3,9]]);}));return _safeCreateImageBitmap.apply(this,arguments);}function isEmptyObject(object){for(var key in object||EMPTY_OBJECT){return false;}return true;}function getISOBMFFMediaType(buffer){if(!checkString(buffer,'ftyp',4)){return null;}if((buffer[8]&0x60)===0x00){return null;}return decodeMajorBrand(buffer);}function decodeMajorBrand(buffer){var brandMajor=getUTF8String(buffer,8,12).replace('\0',' ').trim();switch(brandMajor){case'avif':case'avis':return{extension:'avif',mimeType:'image/avif'};default:return null;}}function getUTF8String(array,start,end){return String.fromCharCode.apply(String,_toConsumableArray(array.slice(start,end)));}function stringToBytes(string){return _toConsumableArray(string).map(function(character){return character.charCodeAt(0);});}function checkString(buffer,header){var offset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var headerBytes=stringToBytes(header);for(var _i509=0;_i509<headerBytes.length;++_i509){if(headerBytes[_i509]!==buffer[_i509+offset]){return false;}}return true;}var BIG_ENDIAN=false;var LITTLE_ENDIAN=true;function getBinaryImageMetadata(binaryData){var dataView=toDataView(binaryData);return getPngMetadata(dataView)||getJpegMetadata(dataView)||getGifMetadata(dataView)||getBmpMetadata(dataView)||getISOBMFFMetadata(dataView);}function getISOBMFFMetadata(binaryData){var buffer=new Uint8Array(binaryData instanceof DataView?binaryData.buffer:binaryData);var mediaType=getISOBMFFMediaType(buffer);if(!mediaType){return null;}return{mimeType:mediaType.mimeType,width:0,height:0};}function getPngMetadata(binaryData){var dataView=toDataView(binaryData);var isPng=dataView.byteLength>=24&&dataView.getUint32(0,BIG_ENDIAN)===0x89504e47;if(!isPng){return null;}return{mimeType:'image/png',width:dataView.getUint32(16,BIG_ENDIAN),height:dataView.getUint32(20,BIG_ENDIAN)};}function getGifMetadata(binaryData){var dataView=toDataView(binaryData);var isGif=dataView.byteLength>=10&&dataView.getUint32(0,BIG_ENDIAN)===0x47494638;if(!isGif){return null;}return{mimeType:'image/gif',width:dataView.getUint16(6,LITTLE_ENDIAN),height:dataView.getUint16(8,LITTLE_ENDIAN)};}function getBmpMetadata(binaryData){var dataView=toDataView(binaryData);var isBmp=dataView.byteLength>=14&&dataView.getUint16(0,BIG_ENDIAN)===0x424d&&dataView.getUint32(2,LITTLE_ENDIAN)===dataView.byteLength;if(!isBmp){return null;}return{mimeType:'image/bmp',width:dataView.getUint32(18,LITTLE_ENDIAN),height:dataView.getUint32(22,LITTLE_ENDIAN)};}function getJpegMetadata(binaryData){var dataView=toDataView(binaryData);var isJpeg=dataView.byteLength>=3&&dataView.getUint16(0,BIG_ENDIAN)===0xffd8&&dataView.getUint8(2)===0xff;if(!isJpeg){return null;}var _getJpegMarkers=getJpegMarkers(),tableMarkers=_getJpegMarkers.tableMarkers,sofMarkers=_getJpegMarkers.sofMarkers;var i=2;while(i+9<dataView.byteLength){var marker=dataView.getUint16(i,BIG_ENDIAN);if(sofMarkers.has(marker)){return{mimeType:'image/jpeg',height:dataView.getUint16(i+5,BIG_ENDIAN),width:dataView.getUint16(i+7,BIG_ENDIAN)};}if(!tableMarkers.has(marker)){return null;}i+=2;i+=dataView.getUint16(i,BIG_ENDIAN);}return null;}function getJpegMarkers(){var tableMarkers=new Set([0xffdb,0xffc4,0xffcc,0xffdd,0xfffe]);for(var _i510=0xffe0;_i510<0xfff0;++_i510){tableMarkers.add(_i510);}var sofMarkers=new Set([0xffc0,0xffc1,0xffc2,0xffc3,0xffc5,0xffc6,0xffc7,0xffc9,0xffca,0xffcb,0xffcd,0xffce,0xffcf,0xffde]);return{tableMarkers:tableMarkers,sofMarkers:sofMarkers};}function toDataView(data){if(data instanceof DataView){return data;}if(ArrayBuffer.isView(data)){return new DataView(data.buffer);}if(data instanceof ArrayBuffer){return new DataView(data);}throw new Error('toDataView');}function parseToNodeImage(_x53,_x54){return _parseToNodeImage.apply(this,arguments);}function _parseToNodeImage(){_parseToNodeImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee33(arrayBuffer,options){var _ref23,mimeType,_parseImageNode;return _regeneratorRuntime().wrap(function _callee33$(_context36){while(1)switch(_context36.prev=_context36.next){case 0:_ref23=getBinaryImageMetadata(arrayBuffer)||{},mimeType=_ref23.mimeType;_parseImageNode=globalThis._parseImageNode;assert$5(_parseImageNode);_context36.next=5;return _parseImageNode(arrayBuffer,mimeType);case 5:return _context36.abrupt("return",_context36.sent);case 6:case"end":return _context36.stop();}},_callee33);}));return _parseToNodeImage.apply(this,arguments);}function parseImage(_x55,_x56,_x57){return _parseImage.apply(this,arguments);}function _parseImage(){_parseImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee34(arrayBuffer,options,context){var imageOptions,imageType,_ref24,url,loadType,image;return _regeneratorRuntime().wrap(function _callee34$(_context37){while(1)switch(_context37.prev=_context37.next){case 0:options=options||{};imageOptions=options.image||{};imageType=imageOptions.type||'auto';_ref24=context||{},url=_ref24.url;loadType=getLoadableImageType(imageType);_context37.t0=loadType;_context37.next=_context37.t0==='imagebitmap'?8:_context37.t0==='image'?12:_context37.t0==='data'?16:20;break;case 8:_context37.next=10;return parseToImageBitmap(arrayBuffer,options,url);case 10:image=_context37.sent;return _context37.abrupt("break",21);case 12:_context37.next=14;return parseToImage(arrayBuffer,options,url);case 14:image=_context37.sent;return _context37.abrupt("break",21);case 16:_context37.next=18;return parseToNodeImage(arrayBuffer);case 18:image=_context37.sent;return _context37.abrupt("break",21);case 20:assert$5(false);case 21:if(imageType==='data'){image=getImageData(image);}return _context37.abrupt("return",image);case 23:case"end":return _context37.stop();}},_callee34);}));return _parseImage.apply(this,arguments);}function getLoadableImageType(type){switch(type){case'auto':case'data':return getDefaultImageType();default:isImageTypeSupported(type);return type;}}var EXTENSIONS$1=['png','jpg','jpeg','gif','webp','bmp','ico','svg','avif'];var MIME_TYPES=['image/png','image/jpeg','image/gif','image/webp','image/avif','image/bmp','image/vnd.microsoft.icon','image/svg+xml'];var DEFAULT_IMAGE_LOADER_OPTIONS={image:{type:'auto',decode:true}};var ImageLoader={id:'image',module:'images',name:'Images',version:VERSION$3,mimeTypes:MIME_TYPES,extensions:EXTENSIONS$1,parse:parseImage,tests:[function(arrayBuffer){return Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)));}],options:DEFAULT_IMAGE_LOADER_OPTIONS};var mimeTypeSupportedSync={};function isImageFormatSupported(mimeType){if(mimeTypeSupportedSync[mimeType]===undefined){var supported=isBrowser$1?checkBrowserImageFormatSupport(mimeType):checkNodeImageFormatSupport(mimeType);mimeTypeSupportedSync[mimeType]=supported;}return mimeTypeSupportedSync[mimeType];}function checkNodeImageFormatSupport(mimeType){var NODE_FORMAT_SUPPORT=['image/png','image/jpeg','image/gif'];var _parseImageNode=globalThis._parseImageNode,_globalThis$_imageFor=globalThis._imageFormatsNode,_imageFormatsNode=_globalThis$_imageFor===void 0?NODE_FORMAT_SUPPORT:_globalThis$_imageFor;return Boolean(_parseImageNode)&&_imageFormatsNode.includes(mimeType);}function checkBrowserImageFormatSupport(mimeType){switch(mimeType){case'image/avif':case'image/webp':return testBrowserImageFormatSupport(mimeType);default:return true;}}function testBrowserImageFormatSupport(mimeType){try{var element=document.createElement('canvas');var dataURL=element.toDataURL(mimeType);return dataURL.indexOf("data:".concat(mimeType))===0;}catch(_unused){return false;}}function assert$4(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}function getFirstCharacters(data){var length=arguments.length>1&&arguments[1]!==undefined?arguments[1]:5;if(typeof data==='string'){return data.slice(0,length);}else if(ArrayBuffer.isView(data)){return getMagicString$1(data.buffer,data.byteOffset,length);}else if(data instanceof ArrayBuffer){var byteOffset=0;return getMagicString$1(data,byteOffset,length);}return'';}function getMagicString$1(arrayBuffer,byteOffset,length){if(arrayBuffer.byteLength<=byteOffset+length){return'';}var dataView=new DataView(arrayBuffer);var magic='';for(var _i511=0;_i511<length;_i511++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i511));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters(string),"\""));}}function sliceArrayBuffer(arrayBuffer,byteOffset,byteLength){var subArray=byteLength!==undefined?new Uint8Array(arrayBuffer).subarray(byteOffset,byteOffset+byteLength):new Uint8Array(arrayBuffer).subarray(byteOffset);var arrayCopy=new Uint8Array(subArray);return arrayCopy.buffer;}function padToNBytes(byteLength,padding){assert$4(byteLength>=0);assert$4(padding>0);return byteLength+(padding-1)&~(padding-1);}function copyToArray(source,target,targetOffset){var sourceArray;if(source instanceof ArrayBuffer){sourceArray=new Uint8Array(source);}else{var srcByteOffset=source.byteOffset;var srcByteLength=source.byteLength;sourceArray=new Uint8Array(source.buffer||source.arrayBuffer,srcByteOffset,srcByteLength);}target.set(sourceArray,targetOffset);return targetOffset+padToNBytes(sourceArray.byteLength,4);}function assert$3(condition,message){if(!condition){throw new Error(message||'assert failed: gltf');}}function resolveUrl(url,options){var absolute=url.startsWith('data:')||url.startsWith('http:')||url.startsWith('https:');if(absolute){return url;}var baseUrl=options.baseUri||options.uri;if(!baseUrl){throw new Error("'baseUri' must be provided to resolve relative url ".concat(url));}return baseUrl.substr(0,baseUrl.lastIndexOf('/')+1)+url;}function getTypedArrayForBufferView(json,buffers,bufferViewIndex){var bufferView=json.bufferViews[bufferViewIndex];assert$3(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}var TYPES=['SCALAR','VEC2','VEC3','VEC4'];var ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT=[[Int8Array,5120],[Uint8Array,5121],[Int16Array,5122],[Uint16Array,5123],[Uint32Array,5125],[Float32Array,5126],[Float64Array,5130]];var ARRAY_TO_COMPONENT_TYPE=new Map(ARRAY_CONSTRUCTOR_TO_WEBGL_CONSTANT);var ATTRIBUTE_TYPE_TO_COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array};function getAccessorTypeFromSize(size){var type=TYPES[size-1];return type||TYPES[0];}function getComponentTypeFromArray(typedArray){var componentType=ARRAY_TO_COMPONENT_TYPE.get(typedArray.constructor);if(!componentType){throw new Error('Illegal typed array');}return componentType;}function getAccessorArrayTypeAndLength(accessor,bufferView){var ArrayType=ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[accessor.componentType];var components=ATTRIBUTE_TYPE_TO_COMPONENTS[accessor.type];var bytesPerComponent=ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[accessor.componentType];var length=accessor.count*components;var byteLength=accessor.count*components*bytesPerComponent;assert$3(byteLength>=0&&byteLength<=bufferView.byteLength);return{ArrayType:ArrayType,length:length,byteLength:byteLength};}var DEFAULT_GLTF_JSON={asset:{version:'2.0',generator:'loaders.gl'},buffers:[]};var GLTFScenegraph=/*#__PURE__*/function(){function GLTFScenegraph(gltf){_classCallCheck(this,GLTFScenegraph);_defineProperty(this,"gltf",void 0);_defineProperty(this,"sourceBuffers",void 0);_defineProperty(this,"byteLength",void 0);this.gltf=gltf||{json:_objectSpread({},DEFAULT_GLTF_JSON),buffers:[]};this.sourceBuffers=[];this.byteLength=0;if(this.gltf.buffers&&this.gltf.buffers[0]){this.byteLength=this.gltf.buffers[0].byteLength;this.sourceBuffers=[this.gltf.buffers[0]];}}return _createClass(GLTFScenegraph,[{key:"json",get:function get(){return this.gltf.json;}},{key:"getApplicationData",value:function getApplicationData(key){var data=this.json[key];return data;}},{key:"getExtraData",value:function getExtraData(key){var extras=this.json.extras||{};return extras[key];}},{key:"getExtension",value:function getExtension(extensionName){var isExtension=this.getUsedExtensions().find(function(name){return name===extensionName;});var extensions=this.json.extensions||{};return isExtension?extensions[extensionName]||true:null;}},{key:"getRequiredExtension",value:function getRequiredExtension(extensionName){var isRequired=this.getRequiredExtensions().find(function(name){return name===extensionName;});return isRequired?this.getExtension(extensionName):null;}},{key:"getRequiredExtensions",value:function getRequiredExtensions(){return this.json.extensionsRequired||[];}},{key:"getUsedExtensions",value:function getUsedExtensions(){return this.json.extensionsUsed||[];}},{key:"getRemovedExtensions",value:function getRemovedExtensions(){return this.json.extensionsRemoved||[];}},{key:"getObjectExtension",value:function getObjectExtension(object,extensionName){var extensions=object.extensions||{};return extensions[extensionName];}},{key:"getScene",value:function getScene(index){return this.getObject('scenes',index);}},{key:"getNode",value:function getNode(index){return this.getObject('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this.getObject('skins',index);}},{key:"getMesh",value:function getMesh(index){return this.getObject('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this.getObject('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this.getObject('accessors',index);}},{key:"getTexture",value:function getTexture(index){return this.getObject('textures',index);}},{key:"getSampler",value:function getSampler(index){return this.getObject('samplers',index);}},{key:"getImage",value:function getImage(index){return this.getObject('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this.getObject('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this.getObject('buffers',index);}},{key:"getObject",value:function getObject(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){throw new Error("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"getTypedArrayForBufferView",value:function getTypedArrayForBufferView(bufferView){bufferView=this.getBufferView(bufferView);var bufferIndex=bufferView.buffer;var binChunk=this.gltf.buffers[bufferIndex];assert$3(binChunk);var byteOffset=(bufferView.byteOffset||0)+binChunk.byteOffset;return new Uint8Array(binChunk.arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"getTypedArrayForAccessor",value:function getTypedArrayForAccessor(accessor){accessor=this.getAccessor(accessor);var bufferView=this.getBufferView(accessor.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var _getAccessorArrayType=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType.ArrayType,length=_getAccessorArrayType.length;var byteOffset=bufferView.byteOffset+accessor.byteOffset;return new ArrayType(arrayBuffer,byteOffset,length);}},{key:"getTypedArrayForImageData",value:function getTypedArrayForImageData(image){image=this.getAccessor(image);var bufferView=this.getBufferView(image.bufferView);var buffer=this.getBuffer(bufferView.buffer);var arrayBuffer=buffer.data;var byteOffset=bufferView.byteOffset||0;return new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);}},{key:"addApplicationData",value:function addApplicationData(key,data){this.json[key]=data;return this;}},{key:"addExtraData",value:function addExtraData(key,data){this.json.extras=this.json.extras||{};this.json.extras[key]=data;return this;}},{key:"addObjectExtension",value:function addObjectExtension(object,extensionName,data){object.extensions=object.extensions||{};object.extensions[extensionName]=data;this.registerUsedExtension(extensionName);return this;}},{key:"setObjectExtension",value:function setObjectExtension(object,extensionName,data){var extensions=object.extensions||{};extensions[extensionName]=data;}},{key:"removeObjectExtension",value:function removeObjectExtension(object,extensionName){var extensions=object.extensions||{};var extension=extensions[extensionName];delete extensions[extensionName];return extension;}},{key:"addExtension",value:function addExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.json.extensions=this.json.extensions||{};this.json.extensions[extensionName]=extensionData;this.registerUsedExtension(extensionName);return extensionData;}},{key:"addRequiredExtension",value:function addRequiredExtension(extensionName){var extensionData=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};assert$3(extensionData);this.addExtension(extensionName,extensionData);this.registerRequiredExtension(extensionName);return extensionData;}},{key:"registerUsedExtension",value:function registerUsedExtension(extensionName){this.json.extensionsUsed=this.json.extensionsUsed||[];if(!this.json.extensionsUsed.find(function(ext){return ext===extensionName;})){this.json.extensionsUsed.push(extensionName);}}},{key:"registerRequiredExtension",value:function registerRequiredExtension(extensionName){this.registerUsedExtension(extensionName);this.json.extensionsRequired=this.json.extensionsRequired||[];if(!this.json.extensionsRequired.find(function(ext){return ext===extensionName;})){this.json.extensionsRequired.push(extensionName);}}},{key:"removeExtension",value:function removeExtension(extensionName){if(!this.getExtension(extensionName)){return;}if(this.json.extensionsRequired){this._removeStringFromArray(this.json.extensionsRequired,extensionName);}if(this.json.extensionsUsed){this._removeStringFromArray(this.json.extensionsUsed,extensionName);}if(this.json.extensions){delete this.json.extensions[extensionName];}if(!Array.isArray(this.json.extensionsRemoved)){this.json.extensionsRemoved=[];}var extensionsRemoved=this.json.extensionsRemoved;if(!extensionsRemoved.includes(extensionName)){extensionsRemoved.push(extensionName);}}},{key:"setDefaultScene",value:function setDefaultScene(sceneIndex){this.json.scene=sceneIndex;}},{key:"addScene",value:function addScene(scene){var nodeIndices=scene.nodeIndices;this.json.scenes=this.json.scenes||[];this.json.scenes.push({nodes:nodeIndices});return this.json.scenes.length-1;}},{key:"addNode",value:function addNode(node){var meshIndex=node.meshIndex,matrix=node.matrix;this.json.nodes=this.json.nodes||[];var nodeData={mesh:meshIndex};if(matrix){nodeData.matrix=matrix;}this.json.nodes.push(nodeData);return this.json.nodes.length-1;}},{key:"addMesh",value:function addMesh(mesh){var attributes=mesh.attributes,indices=mesh.indices,material=mesh.material,_mesh$mode=mesh.mode,mode=_mesh$mode===void 0?4:_mesh$mode;var accessors=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessors,mode:mode}]};if(indices){var indicesAccessor=this._addIndices(indices);glTFMesh.primitives[0].indices=indicesAccessor;}if(Number.isFinite(material)){glTFMesh.primitives[0].material=material;}this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addPointCloud",value:function addPointCloud(attributes){var accessorIndices=this._addAttributes(attributes);var glTFMesh={primitives:[{attributes:accessorIndices,mode:0}]};this.json.meshes=this.json.meshes||[];this.json.meshes.push(glTFMesh);return this.json.meshes.length-1;}},{key:"addImage",value:function addImage(imageData,mimeTypeOpt){var metadata=getBinaryImageMetadata(imageData);var mimeType=mimeTypeOpt||(metadata===null||metadata===void 0?void 0:metadata.mimeType);var bufferViewIndex=this.addBufferView(imageData);var glTFImage={bufferView:bufferViewIndex,mimeType:mimeType};this.json.images=this.json.images||[];this.json.images.push(glTFImage);return this.json.images.length-1;}},{key:"addBufferView",value:function addBufferView(buffer){var byteLength=buffer.byteLength;assert$3(Number.isFinite(byteLength));this.sourceBuffers=this.sourceBuffers||[];this.sourceBuffers.push(buffer);var glTFBufferView={buffer:0,byteOffset:this.byteLength,byteLength:byteLength};this.byteLength+=padToNBytes(byteLength,4);this.json.bufferViews=this.json.bufferViews||[];this.json.bufferViews.push(glTFBufferView);return this.json.bufferViews.length-1;}},{key:"addAccessor",value:function addAccessor(bufferViewIndex,accessor){var glTFAccessor={bufferView:bufferViewIndex,type:getAccessorTypeFromSize(accessor.size),componentType:accessor.componentType,count:accessor.count,max:accessor.max,min:accessor.min};this.json.accessors=this.json.accessors||[];this.json.accessors.push(glTFAccessor);return this.json.accessors.length-1;}},{key:"addBinaryBuffer",value:function addBinaryBuffer(sourceBuffer){var accessor=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{size:3};var bufferViewIndex=this.addBufferView(sourceBuffer);var minMax={min:accessor.min,max:accessor.max};if(!minMax.min||!minMax.max){minMax=this._getAccessorMinMax(sourceBuffer,accessor.size);}var accessorDefaults={size:accessor.size,componentType:getComponentTypeFromArray(sourceBuffer),count:Math.round(sourceBuffer.length/accessor.size),min:minMax.min,max:minMax.max};return this.addAccessor(bufferViewIndex,Object.assign(accessorDefaults,accessor));}},{key:"addTexture",value:function addTexture(texture){var imageIndex=texture.imageIndex;var glTFTexture={source:imageIndex};this.json.textures=this.json.textures||[];this.json.textures.push(glTFTexture);return this.json.textures.length-1;}},{key:"addMaterial",value:function addMaterial(pbrMaterialInfo){this.json.materials=this.json.materials||[];this.json.materials.push(pbrMaterialInfo);return this.json.materials.length-1;}},{key:"createBinaryChunk",value:function createBinaryChunk(){var _this$json,_this$json$buffers;this.gltf.buffers=[];var totalByteLength=this.byteLength;var arrayBuffer=new ArrayBuffer(totalByteLength);var targetArray=new Uint8Array(arrayBuffer);var dstByteOffset=0;var _iterator16=_createForOfIteratorHelper(this.sourceBuffers||[]),_step16;try{for(_iterator16.s();!(_step16=_iterator16.n()).done;){var sourceBuffer=_step16.value;dstByteOffset=copyToArray(sourceBuffer,targetArray,dstByteOffset);}}catch(err){_iterator16.e(err);}finally{_iterator16.f();}if((_this$json=this.json)!==null&&_this$json!==void 0&&(_this$json$buffers=_this$json.buffers)!==null&&_this$json$buffers!==void 0&&_this$json$buffers[0]){this.json.buffers[0].byteLength=totalByteLength;}else{this.json.buffers=[{byteLength:totalByteLength}];}this.gltf.binary=arrayBuffer;this.sourceBuffers=[arrayBuffer];}},{key:"_removeStringFromArray",value:function _removeStringFromArray(array,string){var found=true;while(found){var index=array.indexOf(string);if(index>-1){array.splice(index,1);}else{found=false;}}}},{key:"_addAttributes",value:function _addAttributes(){var attributes=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var result={};for(var attributeKey in attributes){var attributeData=attributes[attributeKey];var attrName=this._getGltfAttributeName(attributeKey);var accessor=this.addBinaryBuffer(attributeData.value,attributeData);result[attrName]=accessor;}return result;}},{key:"_addIndices",value:function _addIndices(indices){return this.addBinaryBuffer(indices,{size:1});}},{key:"_getGltfAttributeName",value:function _getGltfAttributeName(attributeName){switch(attributeName.toLowerCase()){case'position':case'positions':case'vertices':return'POSITION';case'normal':case'normals':return'NORMAL';case'color':case'colors':return'COLOR_0';case'texcoord':case'texcoords':return'TEXCOORD_0';default:return attributeName;}}},{key:"_getAccessorMinMax",value:function _getAccessorMinMax(buffer,size){var result={min:null,max:null};if(buffer.length<size){return result;}result.min=[];result.max=[];var initValues=buffer.subarray(0,size);var _iterator17=_createForOfIteratorHelper(initValues),_step17;try{for(_iterator17.s();!(_step17=_iterator17.n()).done;){var value=_step17.value;result.min.push(value);result.max.push(value);}}catch(err){_iterator17.e(err);}finally{_iterator17.f();}for(var index=size;index<buffer.length;index+=size){for(var componentIndex=0;componentIndex<size;componentIndex++){result.min[0+componentIndex]=Math.min(result.min[0+componentIndex],buffer[index+componentIndex]);result.max[0+componentIndex]=Math.max(result.max[0+componentIndex],buffer[index+componentIndex]);}}return result;}}]);}();var wasm_base='B9h9z9tFBBBF8fL9gBB9gLaaaaaFa9gEaaaB9gFaFa9gEaaaFaEMcBFFFGGGEIIILF9wFFFLEFBFKNFaFCx/IFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBF8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBGy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBEn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBIi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBKI9z9iqlBOc+x8ycGBM/qQFTa8jUUUUBCU/EBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAGTkUUUBRNCUoBAG9uC/wgBZHKCUGAKCUG9JyRVAECFJRICBRcGXEXAcAF9PQFAVAFAclAcAVJAF9JyRMGXGXAG9FQBAMCbJHKC9wZRSAKCIrCEJCGrRQANCUGJRfCBRbAIRTEXGXAOATlAQ9PQBCBRISEMATAQJRIGXAS9FQBCBRtCBREEXGXAOAIlCi9PQBCBRISLMANCU/CBJAEJRKGXGXGXGXGXATAECKrJ2BBAtCKZrCEZfIBFGEBMAKhB83EBAKCNJhB83EBSEMAKAI2BIAI2BBHmCKrHYAYCE6HYy86BBAKCFJAICIJAYJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCGJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCEJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCIJAYAmJHY2BBAI2BFHmCKrHPAPCE6HPy86BBAKCLJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCKJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCOJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCNJAYAmJHY2BBAI2BGHmCKrHPAPCE6HPy86BBAKCVJAYAPJHY2BBAmCIrCEZHPAPCE6HPy86BBAKCcJAYAPJHY2BBAmCGrCEZHPAPCE6HPy86BBAKCMJAYAPJHY2BBAmCEZHmAmCE6Hmy86BBAKCSJAYAmJHm2BBAI2BEHICKrHYAYCE6HYy86BBAKCQJAmAYJHm2BBAICIrCEZHYAYCE6HYy86BBAKCfJAmAYJHm2BBAICGrCEZHYAYCE6HYy86BBAKCbJAmAYJHK2BBAICEZHIAICE6HIy86BBAKAIJRISGMAKAI2BNAI2BBHmCIrHYAYCb6HYy86BBAKCFJAICNJAYJHY2BBAmCbZHmAmCb6Hmy86BBAKCGJAYAmJHm2BBAI2BFHYCIrHPAPCb6HPy86BBAKCEJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCIJAmAYJHm2BBAI2BGHYCIrHPAPCb6HPy86BBAKCLJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCKJAmAYJHm2BBAI2BEHYCIrHPAPCb6HPy86BBAKCOJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCNJAmAYJHm2BBAI2BIHYCIrHPAPCb6HPy86BBAKCVJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCcJAmAYJHm2BBAI2BLHYCIrHPAPCb6HPy86BBAKCMJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCSJAmAYJHm2BBAI2BKHYCIrHPAPCb6HPy86BBAKCQJAmAPJHm2BBAYCbZHYAYCb6HYy86BBAKCfJAmAYJHm2BBAI2BOHICIrHYAYCb6HYy86BBAKCbJAmAYJHK2BBAICbZHIAICb6HIy86BBAKAIJRISFMAKAI8pBB83BBAKCNJAICNJ8pBB83BBAICTJRIMAtCGJRtAECTJHEAS9JQBMMGXAIQBCBRISEMGXAM9FQBANAbJ2BBRtCBRKAfREEXAEANCU/CBJAKJ2BBHTCFrCBATCFZl9zAtJHt86BBAEAGJREAKCFJHKAM9HQBMMAfCFJRfAIRTAbCFJHbAG9HQBMMABAcAG9sJANCUGJAMAG9sTkUUUBpANANCUGJAMCaJAG9sJAGTkUUUBpMAMCBAIyAcJRcAIQBMC9+RKSFMCBC99AOAIlAGCAAGCA9Ly6yRKMALCU/EBJ8kUUUUBAKM+OmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUFT+JUUUBpALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM+lLKFaF99GaG99FaG99GXGXAGCI9HQBAF9FQFEXGXGX9DBBB8/9DBBB+/ABCGJHG1BB+yAB1BBHE+yHI+L+TABCFJHL1BBHK+yHO+L+THN9DBBBB9gHVyAN9DBB/+hANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE86BBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG86BBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG86BBABCIJRBAFCaJHFQBSGMMAF9FQBEXGXGX9DBBB8/9DBBB+/ABCIJHG8uFB+yAB8uFBHE+yHI+L+TABCGJHL8uFBHK+yHO+L+THN9DBBBB9gHVyAN9DB/+g6ANAN+U9DBBBBANAVyHcAc+MHMAECa3yAI+SHIAI+UAcAMAKCa3yAO+SHcAc+U+S+S+R+VHO+U+SHN+L9DBBB9P9d9FQBAN+oRESFMCUUUU94REMAGAE87FBGXGX9DBBB8/9DBBB+/Ac9DBBBB9gyAcAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMALAG87FBGXGX9DBBB8/9DBBB+/AI9DBBBB9gyAIAO+U+SHN+L9DBBB9P9d9FQBAN+oRGSFMCUUUU94RGMABAG87FBABCNJRBAFCaJHFQBMMM/SEIEaE99EaF99GXAF9FQBCBREABRIEXGXGX9D/zI818/AICKJ8uFBHLCEq+y+VHKAI8uFB+y+UHO9DB/+g6+U9DBBB8/9DBBB+/AO9DBBBB9gy+SHN+L9DBBB9P9d9FQBAN+oRVSFMCUUUU94RVMAICIJ8uFBRcAICGJ8uFBRMABALCFJCEZAEqCFWJAV87FBGXGXAKAM+y+UHN9DB/+g6+U9DBBB8/9DBBB+/AN9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRMSFMCUUUU94RMMABALCGJCEZAEqCFWJAM87FBGXGXAKAc+y+UHK9DB/+g6+U9DBBB8/9DBBB+/AK9DBBBB9gy+SHS+L9DBBB9P9d9FQBAS+oRcSFMCUUUU94RcMABALCaJCEZAEqCFWJAc87FBGXGX9DBBU8/AOAO+U+TANAN+U+TAKAK+U+THO9DBBBBAO9DBBBB9gy+R9DB/+g6+U9DBBB8/+SHO+L9DBBB9P9d9FQBAO+oRcSFMCUUUU94RcMABALCEZAEqCFWJAc87FBAICNJRIAECIJREAFCaJHFQBMMM9JBGXAGCGrAF9sHF9FQBEXABAB8oGBHGCNWCN91+yAGCi91CnWCUUU/8EJ+++U84GBABCIJRBAFCaJHFQBMMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEM/lFFFaGXGXAFABqCEZ9FQBABRESFMGXGXAGCT9PQBABRESFMABREEXAEAF8oGBjGBAECIJAFCIJ8oGBjGBAECNJAFCNJ8oGBjGBAECSJAFCSJ8oGBjGBAECTJREAFCTJRFAGC9wJHGCb9LQBMMAGCI9JQBEXAEAF8oGBjGBAFCIJRFAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF2BB86BBAECFJREAFCFJRFAGCaJHGQBMMABMoFFGaGXGXABCEZ9FQBABRESFMAFCgFZC+BwsN9sRIGXGXAGCT9PQBABRESFMABREEXAEAIjGBAECSJAIjGBAECNJAIjGBAECIJAIjGBAECTJREAGC9wJHGCb9LQBMMAGCI9JQBEXAEAIjGBAECIJREAGC98JHGCE9LQBMMGXAG9FQBEXAEAF86BBAECFJREAGCaJHGQBMMABMMMFBCUNMIT9kBB';var wasm_simd='B9h9z9tFBBBF8dL9gBB9gLaaaaaFa9gEaaaB9gGaaB9gFaFaEQSBBFBFFGEGEGIILF9wFFFLEFBFKNFaFCx/aFMO/LFVK9tv9t9vq95GBt9f9f939h9z9t9f9j9h9s9s9f9jW9vq9zBBp9tv9z9o9v9wW9f9kv9j9v9kv9WvqWv94h919m9mvqBG8Z9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv94h919m9mvqBIy9tv9z9o9v9wW9f9kv9j9v9kv9J9u9kv949TvZ91v9u9jvBLn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9P9jWBKi9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9R919hWBNn9tv9z9o9v9wW9f9kv9j9v9kv69p9sWvq9F949wBcI9z9iqlBMc/j9JSIBTEM9+FLa8jUUUUBCTlRBCBRFEXCBRGCBREEXABCNJAGJAECUaAFAGrCFZHIy86BBAEAIJREAGCFJHGCN9HQBMAFCx+YUUBJAE86BBAFCEWCxkUUBJAB8pEN83EBAFCFJHFCUG9HQBMMkRIbaG97FaK978jUUUUBCU/KBlHL8kUUUUBC9+RKGXAGCFJAI9LQBCaRKAE2BBC+gF9HQBALAEAIJHOAGlAG/8cBBCUoBAG9uC/wgBZHKCUGAKCUG9JyRNAECFJRKCBRVGXEXAVAF9PQFANAFAVlAVANJAF9JyRcGXGXAG9FQBAcCbJHIC9wZHMCE9sRSAMCFWRQAICIrCEJCGrRfCBRbEXAKRTCBRtGXEXGXAOATlAf9PQBCBRKSLMALCU/CBJAtAM9sJRmATAfJRKCBREGXAMCoB9JQBAOAKlC/gB9JQBCBRIEXAmAIJREGXGXGXGXGXATAICKrJ2BBHYCEZfIBFGEBMAECBDtDMIBSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIBAKCTJRKMGXGXGXGXGXAYCGrCEZfIBFGEBMAECBDtDMITSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMITAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMITAKCTJRKMGXGXGXGXGXAYCIrCEZfIBFGEBMAECBDtDMIASEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIAAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAEAKDBBBDMIAAKCTJRKMGXGXGXGXGXAYCKrfIBFGEBMAECBDtDMI8wSEMAEAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCIJAnDeBJAYCx+YUUBJ2BBJRKSGMAEAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBAYCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HYCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMI8wAKCNJAnDeBJAYCx+YUUBJ2BBJRKSFMAEAKDBBBDMI8wAKCTJRKMAICoBJREAICUFJAM9LQFAERIAOAKlC/fB9LQBMMGXAEAM9PQBAECErRIEXGXAOAKlCi9PQBCBRKSOMAmAEJRYGXGXGXGXGXATAECKrJ2BBAICKZrCEZfIBFGEBMAYCBDtDMIBSEMAYAKDBBIAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnHPCGD+MFAPDQBTFtGmEYIPLdKeOnC0+G+MiDtD9OHdCEDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCIJAnDeBJAeCx+YUUBJ2BBJRKSGMAYAKDBBNAKDBBBHPCID+MFAPDQBTFtGmEYIPLdKeOnC+P+e+8/4BDtD9OHdCbDbD8jHPD8dBhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBAeCx+YUUBJDBBBHnAnDQBBBBBBBBBBBBBBBBAPD8dFhUg/8/4/w/goB9+h84k7HeCEWCxkUUBJDBEBD9uDQBFGEILKOTtmYPdenDfAdAPD9SDMIBAKCNJAnDeBJAeCx+YUUBJ2BBJRKSFMAYAKDBBBDMIBAKCTJRKMAICGJRIAECTJHEAM9JQBMMGXAK9FQBAKRTAtCFJHtCI6QGSFMMCBRKSEMGXAM9FQBALCUGJAbJREALAbJDBGBRnCBRYEXAEALCU/CBJAYJHIDBIBHdCFD9tAdCFDbHPD9OD9hD9RHdAIAMJDBIBHiCFD9tAiAPD9OD9hD9RHiDQBTFtGmEYIPLdKeOnH8ZAIAQJDBIBHpCFD9tApAPD9OD9hD9RHpAIASJDBIBHyCFD9tAyAPD9OD9hD9RHyDQBTFtGmEYIPLdKeOnH8cDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGEAnD9uHnDyBjGBAEAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnA8ZA8cDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNiV8ZcpMyS8cQ8df8eb8fHdApAyDQNiV8ZcpMyS8cQ8df8eb8fHiDQBFTtGEmYILPdKOenHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJHIAnAdAiDQNVi8ZcMpySQ8c8dfb8e8fHPAPDQBFGEBFGEBFGEBFGED9uHnDyBjGBAIAGJHIAnAPAPDQILKOILKOILKOILKOD9uHnDyBjGBAIAGJHIAnAPAPDQNVcMNVcMNVcMNVcMD9uHnDyBjGBAIAGJHIAnAPAPDQSQfbSQfbSQfbSQfbD9uHnDyBjGBAIAGJREAYCTJHYAM9JQBMMAbCIJHbAG9JQBMMABAVAG9sJALCUGJAcAG9s/8cBBALALCUGJAcCaJAG9sJAG/8cBBMAcCBAKyAVJRVAKQBMC9+RKSFMCBC99AOAKlAGCAAGCA9Ly6yRKMALCU/KBJ8kUUUUBAKMNBT+BUUUBM+KmFTa8jUUUUBCoFlHL8kUUUUBC9+RKGXAFCE9uHOCtJAI9LQBCaRKAE2BBHNC/wFZC/gF9HQBANCbZHVCF9LQBALCoBJCgFCUF/8MBALC84Jha83EBALC8wJha83EBALC8oJha83EBALCAJha83EBALCiJha83EBALCTJha83EBALha83ENALha83EBAEAIJC9wJRcAECFJHNAOJRMGXAF9FQBCQCbAVCF6yRSABRECBRVCBRQCBRfCBRICBRKEXGXAMAcuQBC9+RKSEMGXGXAN2BBHOC/vF9LQBALCoBJAOCIrCa9zAKJCbZCEWJHb8oGIRTAb8oGBRtGXAOCbZHbAS9PQBALAOCa9zAIJCbZCGWJ8oGBAVAbyROAb9FRbGXGXAGCG9HQBABAt87FBABCIJAO87FBABCGJAT87FBSFMAEAtjGBAECNJAOjGBAECIJATjGBMAVAbJRVALCoBJAKCEWJHmAOjGBAmATjGIALAICGWJAOjGBALCoBJAKCFJCbZHKCEWJHTAtjGBATAOjGIAIAbJRIAKCFJRKSGMGXGXAbCb6QBAQAbJAbC989zJCFJRQSFMAM1BBHbCgFZROGXGXAbCa9MQBAMCFJRMSFMAM1BFHbCgBZCOWAOCgBZqROGXAbCa9MQBAMCGJRMSFMAM1BGHbCgBZCfWAOqROGXAbCa9MQBAMCEJRMSFMAM1BEHbCgBZCdWAOqROGXAbCa9MQBAMCIJRMSFMAM2BIC8cWAOqROAMCLJRMMAOCFrCBAOCFZl9zAQJRQMGXGXAGCG9HQBABAt87FBABCIJAQ87FBABCGJAT87FBSFMAEAtjGBAECNJAQjGBAECIJATjGBMALCoBJAKCEWJHOAQjGBAOATjGIALAICGWJAQjGBALCoBJAKCFJCbZHKCEWJHOAtjGBAOAQjGIAICFJRIAKCFJRKSFMGXAOCDF9LQBALAIAcAOCbZJ2BBHbCIrHTlCbZCGWJ8oGBAVCFJHtATyROALAIAblCbZCGWJ8oGBAtAT9FHmJHtAbCbZHTyRbAT9FRTGXGXAGCG9HQBABAV87FBABCIJAb87FBABCGJAO87FBSFMAEAVjGBAECNJAbjGBAECIJAOjGBMALAICGWJAVjGBALCoBJAKCEWJHYAOjGBAYAVjGIALAICFJHICbZCGWJAOjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAIAmJCbZHICGWJAbjGBALCoBJAKCGJCbZHKCEWJHOAVjGBAOAbjGIAKCFJRKAIATJRIAtATJRVSFMAVCBAM2BBHYyHTAOC/+F6HPJROAYCbZRtGXGXAYCIrHmQBAOCFJRbSFMAORbALAIAmlCbZCGWJ8oGBROMGXGXAtQBAbCFJRVSFMAbRVALAIAYlCbZCGWJ8oGBRbMGXGXAP9FQBAMCFJRYSFMAM1BFHYCgFZRTGXGXAYCa9MQBAMCGJRYSFMAM1BGHYCgBZCOWATCgBZqRTGXAYCa9MQBAMCEJRYSFMAM1BEHYCgBZCfWATqRTGXAYCa9MQBAMCIJRYSFMAM1BIHYCgBZCdWATqRTGXAYCa9MQBAMCLJRYSFMAMCKJRYAM2BLC8cWATqRTMATCFrCBATCFZl9zAQJHQRTMGXGXAmCb6QBAYRPSFMAY1BBHMCgFZROGXGXAMCa9MQBAYCFJRPSFMAY1BFHMCgBZCOWAOCgBZqROGXAMCa9MQBAYCGJRPSFMAY1BGHMCgBZCfWAOqROGXAMCa9MQBAYCEJRPSFMAY1BEHMCgBZCdWAOqROGXAMCa9MQBAYCIJRPSFMAYCLJRPAY2BIC8cWAOqROMAOCFrCBAOCFZl9zAQJHQROMGXGXAtCb6QBAPRMSFMAP1BBHMCgFZRbGXGXAMCa9MQBAPCFJRMSFMAP1BFHMCgBZCOWAbCgBZqRbGXAMCa9MQBAPCGJRMSFMAP1BGHMCgBZCfWAbqRbGXAMCa9MQBAPCEJRMSFMAP1BEHMCgBZCdWAbqRbGXAMCa9MQBAPCIJRMSFMAPCLJRMAP2BIC8cWAbqRbMAbCFrCBAbCFZl9zAQJHQRbMGXGXAGCG9HQBABAT87FBABCIJAb87FBABCGJAO87FBSFMAEATjGBAECNJAbjGBAECIJAOjGBMALCoBJAKCEWJHYAOjGBAYATjGIALAICGWJATjGBALCoBJAKCFJCbZCEWJHYAbjGBAYAOjGIALAICFJHICbZCGWJAOjGBALCoBJAKCGJCbZCEWJHOATjGBAOAbjGIALAIAm9FAmCb6qJHICbZCGWJAbjGBAIAt9FAtCb6qJRIAKCEJRKMANCFJRNABCKJRBAECSJREAKCbZRKAICbZRIAfCEJHfAF9JQBMMCBC99AMAc6yRKMALCoFJ8kUUUUBAKM/tIFGa8jUUUUBCTlRLC9+RKGXAFCLJAI9LQBCaRKAE2BBC/+FZC/QF9HQBALhB83ENAECFJRKAEAIJC98JREGXAF9FQBGXAGCG6QBEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMALCNJAICFZCGWqHGAICGrCBAICFrCFZl9zAG8oGBJHIjGBABAIjGBABCIJRBAFCaJHFQBSGMMEXGXAKAE9JQBC9+bMAK1BBHGCgFZRIGXGXAGCa9MQBAKCFJRKSFMAK1BFHGCgBZCOWAICgBZqRIGXAGCa9MQBAKCGJRKSFMAK1BGHGCgBZCfWAIqRIGXAGCa9MQBAKCEJRKSFMAK1BEHGCgBZCdWAIqRIGXAGCa9MQBAKCIJRKSFMAK2BIC8cWAIqRIAKCLJRKMABAICGrCBAICFrCFZl9zALCNJAICFZCGWqHI8oGBJHG87FBAIAGjGBABCGJRBAFCaJHFQBMMCBC99AKAE6yRKMAKM/xLGEaK978jUUUUBCAlHE8kUUUUBGXGXAGCI9HQBGXAFC98ZHI9FQBABRGCBRLEXAGAGDBBBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMBBAGCTJRGALCIJHLAI9JQBMMAIAF9PQFAEAFCEZHLCGWHGqCBCTAGl/8MBAEABAICGWJHIAG/8cBBGXAL9FQBAEAEDBIBHKCiD+rFCiD+sFD/6FHOAKCND+rFCiD+sFD/6FAOD/gFAKCTD+rFCiD+sFD/6FHND/gFD/kFD/lFHVCBDtD+2FHcAOCUUUU94DtHMD9OD9RD/kFHO9DBB/+hDYAOAOD/mFAVAVD/mFANAcANAMD9OD9RD/kFHOAOD/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHcD/kFCgFDtD9OAKCUUU94DtD9OD9QAOAND/mFAcD/kFCND+rFCU/+EDtD9OD9QAVAND/mFAcD/kFCTD+rFCUU/8ODtD9OD9QDMIBMAIAEAG/8cBBSFMABAFC98ZHGT+HUUUBAGAF9PQBAEAFCEZHICEWHLJCBCAALl/8MBAEABAGCEWJHGAL/8cBBAEAIT+HUUUBAGAEAL/8cBBMAECAJ8kUUUUBM+yEGGaO97GXAF9FQBCBRGEXABCTJHEAEDBBBHICBDtHLCUU98D8cFCUU98D8cEHKD9OABDBBBHOAIDQILKOSQfbPden8c8d8e8fCggFDtD9OD/6FAOAIDQBFGENVcMTtmYi8ZpyHICTD+sFD/6FHND/gFAICTD+rFCTD+sFD/6FHVD/gFD/kFD/lFHI9DB/+g6DYAVAIALD+2FHLAVCUUUU94DtHcD9OD9RD/kFHVAVD/mFAIAID/mFANALANAcD9OD9RD/kFHIAID/mFD/kFD/kFD/jFD/nFHND/mF9DBBX9LDYHLD/kFCTD+rFAVAND/mFALD/kFCggEDtD9OD9QHVAIAND/mFALD/kFCaDbCBDnGCBDnECBDnKCBDnOCBDncCBDnMCBDnfCBDnbD9OHIDQNVi8ZcMpySQ8c8dfb8e8fD9QDMBBABAOAKD9OAVAIDQBFTtGEmYILPdKOenD9QDMBBABCAJRBAGCIJHGAF9JQBMMM94FEa8jUUUUBCAlHE8kUUUUBABAFC98ZHIT+JUUUBGXAIAF9PQBAEAFCEZHLCEWHFJCBCAAFl/8MBAEABAICEWJHBAF/8cBBAEALT+JUUUBABAEAF/8cBBMAECAJ8kUUUUBM/hEIGaF97FaL978jUUUUBCTlRGGXAF9FQBCBREEXAGABDBBBHIABCTJHLDBBBHKDQILKOSQfbPden8c8d8e8fHOCTD+sFHNCID+rFDMIBAB9DBBU8/DY9D/zI818/DYANCEDtD9QD/6FD/nFHNAIAKDQBFGENVcMTtmYi8ZpyHICTD+rFCTD+sFD/6FD/mFHKAKD/mFANAICTD+sFD/6FD/mFHVAVD/mFANAOCTD+rFCTD+sFD/6FD/mFHOAOD/mFD/kFD/kFD/lFCBDtD+4FD/jF9DB/+g6DYHND/mF9DBBX9LDYHID/kFCggEDtHcD9OAVAND/mFAID/kFCTD+rFD9QHVAOAND/mFAID/kFCTD+rFAKAND/mFAID/kFAcD9OD9QHNDQBFTtGEmYILPdKOenHID8dBAGDBIBDyB+t+J83EBABCNJAID8dFAGDBIBDyF+t+J83EBALAVANDQNVi8ZcMpySQ8c8dfb8e8fHND8dBAGDBIBDyG+t+J83EBABCiJAND8dFAGDBIBDyE+t+J83EBABCAJRBAECIJHEAF9JQBMMM/3FGEaF978jUUUUBCoBlREGXAGCGrAF9sHIC98ZHL9FQBCBRGABRFEXAFAFDBBBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMBBAFCTJRFAGCIJHGAL9JQBMMGXALAI9PQBAEAICEZHGCGWHFqCBCoBAFl/8MBAEABALCGWJHLAF/8cBBGXAG9FQBAEAEDBIBHKCND+rFCND+sFD/6FAKCiD+sFCnD+rFCUUU/8EDtD+uFD/mFDMIBMALAEAF/8cBBMM9TFEaCBCB8oGUkUUBHFABCEJC98ZJHBjGUkUUBGXGXAB8/BCTWHGuQBCaREABAGlCggEJCTrXBCa6QFMAFREMAEMMMFBCUNMIT9tBB';var detector=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]);var wasmpack=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);var FILTERS={0:'',1:'meshopt_decodeFilterOct',2:'meshopt_decodeFilterQuat',3:'meshopt_decodeFilterExp',NONE:'',OCTAHEDRAL:'meshopt_decodeFilterOct',QUATERNION:'meshopt_decodeFilterQuat',EXPONENTIAL:'meshopt_decodeFilterExp'};var DECODERS={0:'meshopt_decodeVertexBuffer',1:'meshopt_decodeIndexBuffer',2:'meshopt_decodeIndexSequence',ATTRIBUTES:'meshopt_decodeVertexBuffer',TRIANGLES:'meshopt_decodeIndexBuffer',INDICES:'meshopt_decodeIndexSequence'};function meshoptDecodeGltfBuffer(_x58,_x59,_x60,_x61,_x62){return _meshoptDecodeGltfBuffer.apply(this,arguments);}function _meshoptDecodeGltfBuffer(){_meshoptDecodeGltfBuffer=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee35(target,count,size,source,mode){var filter,instance,_args31=arguments;return _regeneratorRuntime().wrap(function _callee35$(_context38){while(1)switch(_context38.prev=_context38.next){case 0:filter=_args31.length>5&&_args31[5]!==undefined?_args31[5]:'NONE';_context38.next=3;return loadWasmInstance();case 3:instance=_context38.sent;decode$7(instance,instance.exports[DECODERS[mode]],target,count,size,source,instance.exports[FILTERS[filter||'NONE']]);case 5:case"end":return _context38.stop();}},_callee35);}));return _meshoptDecodeGltfBuffer.apply(this,arguments);}var wasmPromise;function loadWasmInstance(){return _loadWasmInstance.apply(this,arguments);}function _loadWasmInstance(){_loadWasmInstance=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee36(){return _regeneratorRuntime().wrap(function _callee36$(_context39){while(1)switch(_context39.prev=_context39.next){case 0:if(!wasmPromise){wasmPromise=loadWasmModule();}return _context39.abrupt("return",wasmPromise);case 2:case"end":return _context39.stop();}},_callee36);}));return _loadWasmInstance.apply(this,arguments);}function loadWasmModule(){return _loadWasmModule.apply(this,arguments);}function _loadWasmModule(){_loadWasmModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee37(){var wasm,result;return _regeneratorRuntime().wrap(function _callee37$(_context40){while(1)switch(_context40.prev=_context40.next){case 0:wasm=wasm_base;if(WebAssembly.validate(detector)){wasm=wasm_simd;console.log('Warning: meshopt_decoder is using experimental SIMD support');}_context40.next=4;return WebAssembly.instantiate(unpack(wasm),{});case 4:result=_context40.sent;_context40.next=7;return result.instance.exports.__wasm_call_ctors();case 7:return _context40.abrupt("return",result.instance);case 8:case"end":return _context40.stop();}},_callee37);}));return _loadWasmModule.apply(this,arguments);}function unpack(data){var result=new Uint8Array(data.length);for(var _i512=0;_i512<data.length;++_i512){var ch=data.charCodeAt(_i512);result[_i512]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i513=0;_i513<data.length;++_i513){result[write++]=result[_i513]<60?wasmpack[result[_i513]]:(result[_i513]-60)*64+result[++_i513];}return result.buffer.slice(0,write);}function decode$7(instance,fun,target,count,size,source,filter){var sbrk=instance.exports.sbrk;var count4=count+3&~3;var tp=sbrk(count4*size);var sp=sbrk(source.length);var heap=new Uint8Array(instance.exports.memory.buffer);heap.set(source,sp);var res=fun(tp,count,size,sp,source.length);if(res===0&&filter){filter(tp,count4,size);}target.set(heap.subarray(tp,tp+count*size));sbrk(tp-sbrk(0));if(res!==0){throw new Error("Malformed buffer data: ".concat(res));}}var EXT_MESHOPT_COMPRESSION='EXT_meshopt_compression';var name$8=EXT_MESHOPT_COMPRESSION;function decode$6(_x63,_x64){return _decode$.apply(this,arguments);}function _decode$(){_decode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee38(gltfData,options){var _options$gltf,scenegraph,promises,_iterator44,_step44,bufferViewIndex;return _regeneratorRuntime().wrap(function _callee38$(_context41){while(1)switch(_context41.prev=_context41.next){case 0:scenegraph=new GLTFScenegraph(gltfData);if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context41.next=3;break;}return _context41.abrupt("return");case 3:promises=[];_iterator44=_createForOfIteratorHelper(gltfData.json.bufferViews||[]);try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){bufferViewIndex=_step44.value;promises.push(decodeMeshoptBufferView(scenegraph,bufferViewIndex));}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}_context41.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(EXT_MESHOPT_COMPRESSION);case 9:case"end":return _context41.stop();}},_callee38);}));return _decode$.apply(this,arguments);}function decodeMeshoptBufferView(_x65,_x66){return _decodeMeshoptBufferView.apply(this,arguments);}function _decodeMeshoptBufferView(){_decodeMeshoptBufferView=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(scenegraph,bufferView){var meshoptExtension,_meshoptExtension$byt,byteOffset,_meshoptExtension$byt2,byteLength,byteStride,count,mode,_meshoptExtension$fil,filter,bufferIndex,buffer,source,result;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.next){case 0:meshoptExtension=scenegraph.getObjectExtension(bufferView,EXT_MESHOPT_COMPRESSION);if(!meshoptExtension){_context42.next=9;break;}_meshoptExtension$byt=meshoptExtension.byteOffset,byteOffset=_meshoptExtension$byt===void 0?0:_meshoptExtension$byt,_meshoptExtension$byt2=meshoptExtension.byteLength,byteLength=_meshoptExtension$byt2===void 0?0:_meshoptExtension$byt2,byteStride=meshoptExtension.byteStride,count=meshoptExtension.count,mode=meshoptExtension.mode,_meshoptExtension$fil=meshoptExtension.filter,filter=_meshoptExtension$fil===void 0?'NONE':_meshoptExtension$fil,bufferIndex=meshoptExtension.buffer;buffer=scenegraph.gltf.buffers[bufferIndex];source=new Uint8Array(buffer.arrayBuffer,buffer.byteOffset+byteOffset,byteLength);result=new Uint8Array(scenegraph.gltf.buffers[bufferView.buffer].arrayBuffer,bufferView.byteOffset,bufferView.byteLength);_context42.next=8;return meshoptDecodeGltfBuffer(result,count,byteStride,source,mode,filter);case 8:return _context42.abrupt("return",result);case 9:return _context42.abrupt("return",null);case 10:case"end":return _context42.stop();}},_callee39);}));return _decodeMeshoptBufferView.apply(this,arguments);}var EXT_meshopt_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$8,decode:decode$6});var EXT_TEXTURE_WEBP='EXT_texture_webp';var name$7=EXT_TEXTURE_WEBP;function preprocess$3(gltfData,options){var scenegraph=new GLTFScenegraph(gltfData);if(!isImageFormatSupported('image/webp')){if(scenegraph.getRequiredExtensions().includes(EXT_TEXTURE_WEBP)){throw new Error("gltf: Required extension ".concat(EXT_TEXTURE_WEBP," not supported by browser"));}return;}var json=scenegraph.json;var _iterator18=_createForOfIteratorHelper(json.textures||[]),_step18;try{for(_iterator18.s();!(_step18=_iterator18.n()).done;){var texture=_step18.value;var extension=scenegraph.getObjectExtension(texture,EXT_TEXTURE_WEBP);if(extension){texture.source=extension.source;}scenegraph.removeObjectExtension(texture,EXT_TEXTURE_WEBP);}}catch(err){_iterator18.e(err);}finally{_iterator18.f();}scenegraph.removeExtension(EXT_TEXTURE_WEBP);}var EXT_texture_webp=/*#__PURE__*/Object.freeze({__proto__:null,name:name$7,preprocess:preprocess$3});var KHR_TEXTURE_BASISU='KHR_texture_basisu';var name$6=KHR_TEXTURE_BASISU;function preprocess$2(gltfData,options){var scene=new GLTFScenegraph(gltfData);var json=scene.json;var _iterator19=_createForOfIteratorHelper(json.textures||[]),_step19;try{for(_iterator19.s();!(_step19=_iterator19.n()).done;){var texture=_step19.value;var extension=scene.getObjectExtension(texture,KHR_TEXTURE_BASISU);if(extension){texture.source=extension.source;}scene.removeObjectExtension(texture,KHR_TEXTURE_BASISU);}}catch(err){_iterator19.e(err);}finally{_iterator19.f();}scene.removeExtension(KHR_TEXTURE_BASISU);}var KHR_texture_basisu=/*#__PURE__*/Object.freeze({__proto__:null,name:name$6,preprocess:preprocess$2});function assert$2(condition,message){if(!condition){throw new Error(message||'loaders.gl assertion failed.');}}var globals={self:typeof self!=='undefined'&&self,window:typeof window!=='undefined'&&window,global:typeof global!=='undefined'&&global,document:typeof document!=='undefined'&&document};var global_=globals.global||globals.self||globals.window||{};var isBrowser=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[1])||0;var readFileAsArrayBuffer=null;var readFileAsText=null;var requireFromFile=null;var requireFromString=null;var node=/*#__PURE__*/Object.freeze({__proto__:null,readFileAsArrayBuffer:readFileAsArrayBuffer,readFileAsText:readFileAsText,requireFromFile:requireFromFile,requireFromString:requireFromString});var VERSION$2="3.4.15";var loadLibraryPromises={};function loadLibrary(_x67){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(libraryUrl){var moduleName,options,_args36=arguments;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:moduleName=_args36.length>1&&_args36[1]!==undefined?_args36[1]:null;options=_args36.length>2&&_args36[2]!==undefined?_args36[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context43.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context43.abrupt("return",_context43.sent);case 7:case"end":return _context43.stop();}},_callee40);}));return _loadLibrary.apply(this,arguments);}function getLibraryUrl(library,moduleName,options){if(library.startsWith('http')){return library;}var modules=options.modules||{};if(modules[library]){return modules[library];}if(!isBrowser){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$2(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$2,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x68){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(libraryUrl){var _response2,response,scriptSource;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:if(!libraryUrl.endsWith('wasm')){_context44.next=7;break;}_context44.next=3;return fetch(libraryUrl);case 3:_response2=_context44.sent;_context44.next=6;return _response2.arrayBuffer();case 6:return _context44.abrupt("return",_context44.sent);case 7:if(isBrowser){_context44.next=20;break;}_context44.prev=8;_context44.t0=node&&requireFromFile;if(!_context44.t0){_context44.next=14;break;}_context44.next=13;return requireFromFile(libraryUrl);case 13:_context44.t0=_context44.sent;case 14:return _context44.abrupt("return",_context44.t0);case 17:_context44.prev=17;_context44.t1=_context44["catch"](8);return _context44.abrupt("return",null);case 20:if(!isWorker){_context44.next=22;break;}return _context44.abrupt("return",importScripts(libraryUrl));case 22:_context44.next=24;return fetch(libraryUrl);case 24:response=_context44.sent;_context44.next=27;return response.text();case 27:scriptSource=_context44.sent;return _context44.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context44.stop();}},_callee41,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser){return requireFromString;}if(isWorker){eval.call(global_,scriptSource);return null;}var script=document.createElement('script');script.id=id;try{script.appendChild(document.createTextNode(scriptSource));}catch(e){script.text=scriptSource;}document.body.appendChild(script);return null;}var VERSION$1="3.4.15";var DEFAULT_DRACO_OPTIONS={draco:{decoderType:(typeof WebAssembly==="undefined"?"undefined":_typeof2(WebAssembly))==='object'?'wasm':'js',libraryPath:'libs/',extraAttributes:{},attributeNameEntry:undefined}};var DracoLoader$1={name:'Draco',id:isBrowser?'draco':'draco-nodejs',module:'draco',shapes:['mesh'],version:VERSION$1,worker:true,extensions:['drc'],mimeTypes:['application/octet-stream'],binary:true,tests:['DRACO'],options:DEFAULT_DRACO_OPTIONS};function getMeshBoundingBox(attributes){var minX=Infinity;var minY=Infinity;var minZ=Infinity;var maxX=-Infinity;var maxY=-Infinity;var maxZ=-Infinity;var positions=attributes.POSITION?attributes.POSITION.value:[];var len=positions&&positions.length;for(var _i514=0;_i514<len;_i514+=3){var x=positions[_i514];var y=positions[_i514+1];var _z4=positions[_i514+2];minX=x<minX?x:minX;minY=y<minY?y:minY;minZ=_z4<minZ?_z4:minZ;maxX=x>maxX?x:maxX;maxY=y>maxY?y:maxY;maxZ=_z4>maxZ?_z4:maxZ;}return[[minX,minY,minZ],[maxX,maxY,maxZ]];}function assert$1(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var Schema=/*#__PURE__*/function(){function Schema(fields,metadata){_classCallCheck(this,Schema);_defineProperty(this,"fields",void 0);_defineProperty(this,"metadata",void 0);assert$1(Array.isArray(fields));checkNames(fields);this.fields=fields;this.metadata=metadata||new Map();}return _createClass(Schema,[{key:"compareTo",value:function compareTo(other){if(this.metadata!==other.metadata){return false;}if(this.fields.length!==other.fields.length){return false;}for(var _i515=0;_i515<this.fields.length;++_i515){if(!this.fields[_i515].compareTo(other.fields[_i515])){return false;}}return true;}},{key:"select",value:function select(){var nameMap=Object.create(null);for(var _len=arguments.length,columnNames=new Array(_len),_key=0;_key<_len;_key++){columnNames[_key]=arguments[_key];}for(var _i516=0,_columnNames=columnNames;_i516<_columnNames.length;_i516++){var _name6=_columnNames[_i516];nameMap[_name6]=true;}var selectedFields=this.fields.filter(function(field){return nameMap[field.name];});return new Schema(selectedFields,this.metadata);}},{key:"selectAt",value:function selectAt(){var _this122=this;for(var _len2=arguments.length,columnIndices=new Array(_len2),_key2=0;_key2<_len2;_key2++){columnIndices[_key2]=arguments[_key2];}var selectedFields=columnIndices.map(function(index){return _this122.fields[index];}).filter(Boolean);return new Schema(selectedFields,this.metadata);}},{key:"assign",value:function assign(schemaOrFields){var fields;var metadata=this.metadata;if(schemaOrFields instanceof Schema){var otherSchema=schemaOrFields;fields=otherSchema.fields;metadata=mergeMaps(mergeMaps(new Map(),this.metadata),otherSchema.metadata);}else{fields=schemaOrFields;}var fieldMap=Object.create(null);var _iterator20=_createForOfIteratorHelper(this.fields),_step20;try{for(_iterator20.s();!(_step20=_iterator20.n()).done;){var field=_step20.value;fieldMap[field.name]=field;}}catch(err){_iterator20.e(err);}finally{_iterator20.f();}var _iterator21=_createForOfIteratorHelper(fields),_step21;try{for(_iterator21.s();!(_step21=_iterator21.n()).done;){var _field=_step21.value;fieldMap[_field.name]=_field;}}catch(err){_iterator21.e(err);}finally{_iterator21.f();}var mergedFields=Object.values(fieldMap);return new Schema(mergedFields,metadata);}}]);}();function checkNames(fields){var usedNames={};var _iterator22=_createForOfIteratorHelper(fields),_step22;try{for(_iterator22.s();!(_step22=_iterator22.n()).done;){var field=_step22.value;if(usedNames[field.name]){console.warn('Schema: duplicated field name',field.name,field);}usedNames[field.name]=true;}}catch(err){_iterator22.e(err);}finally{_iterator22.f();}}function mergeMaps(m1,m2){return new Map([].concat(_toConsumableArray(m1||new Map()),_toConsumableArray(m2||new Map())));}var Field=/*#__PURE__*/function(){function Field(name,type){_classCallCheck(this,Field);var nullable=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;var metadata=arguments.length>3&&arguments[3]!==undefined?arguments[3]:new Map();_defineProperty(this,"name",void 0);_defineProperty(this,"type",void 0);_defineProperty(this,"nullable",void 0);_defineProperty(this,"metadata",void 0);this.name=name;this.type=type;this.nullable=nullable;this.metadata=metadata;}return _createClass(Field,[{key:"typeId",get:function get(){return this.type&&this.type.typeId;}},{key:"clone",value:function clone(){return new Field(this.name,this.type,this.nullable,this.metadata);}},{key:"compareTo",value:function compareTo(other){return this.name===other.name&&this.type===other.type&&this.nullable===other.nullable&&this.metadata===other.metadata;}},{key:"toString",value:function toString(){return"".concat(this.type).concat(this.nullable?', nullable':'').concat(this.metadata?", metadata: ".concat(this.metadata):'');}}]);}();var Type=function(Type){Type[Type["NONE"]=0]="NONE";Type[Type["Null"]=1]="Null";Type[Type["Int"]=2]="Int";Type[Type["Float"]=3]="Float";Type[Type["Binary"]=4]="Binary";Type[Type["Utf8"]=5]="Utf8";Type[Type["Bool"]=6]="Bool";Type[Type["Decimal"]=7]="Decimal";Type[Type["Date"]=8]="Date";Type[Type["Time"]=9]="Time";Type[Type["Timestamp"]=10]="Timestamp";Type[Type["Interval"]=11]="Interval";Type[Type["List"]=12]="List";Type[Type["Struct"]=13]="Struct";Type[Type["Union"]=14]="Union";Type[Type["FixedSizeBinary"]=15]="FixedSizeBinary";Type[Type["FixedSizeList"]=16]="FixedSizeList";Type[Type["Map"]=17]="Map";Type[Type["Dictionary"]=-1]="Dictionary";Type[Type["Int8"]=-2]="Int8";Type[Type["Int16"]=-3]="Int16";Type[Type["Int32"]=-4]="Int32";Type[Type["Int64"]=-5]="Int64";Type[Type["Uint8"]=-6]="Uint8";Type[Type["Uint16"]=-7]="Uint16";Type[Type["Uint32"]=-8]="Uint32";Type[Type["Uint64"]=-9]="Uint64";Type[Type["Float16"]=-10]="Float16";Type[Type["Float32"]=-11]="Float32";Type[Type["Float64"]=-12]="Float64";Type[Type["DateDay"]=-13]="DateDay";Type[Type["DateMillisecond"]=-14]="DateMillisecond";Type[Type["TimestampSecond"]=-15]="TimestampSecond";Type[Type["TimestampMillisecond"]=-16]="TimestampMillisecond";Type[Type["TimestampMicrosecond"]=-17]="TimestampMicrosecond";Type[Type["TimestampNanosecond"]=-18]="TimestampNanosecond";Type[Type["TimeSecond"]=-19]="TimeSecond";Type[Type["TimeMillisecond"]=-20]="TimeMillisecond";Type[Type["TimeMicrosecond"]=-21]="TimeMicrosecond";Type[Type["TimeNanosecond"]=-22]="TimeNanosecond";Type[Type["DenseUnion"]=-23]="DenseUnion";Type[Type["SparseUnion"]=-24]="SparseUnion";Type[Type["IntervalDayTime"]=-25]="IntervalDayTime";Type[Type["IntervalYearMonth"]=-26]="IntervalYearMonth";return Type;}({});var _Symbol$toStringTag,_Symbol$toStringTag2,_Symbol$toStringTag7;var DataType=/*#__PURE__*/function(){function DataType(){_classCallCheck(this,DataType);}return _createClass(DataType,[{key:"typeId",get:function get(){return Type.NONE;}},{key:"compareTo",value:function compareTo(other){return this===other;}}],[{key:"isNull",value:function isNull(x){return x&&x.typeId===Type.Null;}},{key:"isInt",value:function isInt(x){return x&&x.typeId===Type.Int;}},{key:"isFloat",value:function isFloat(x){return x&&x.typeId===Type.Float;}},{key:"isBinary",value:function isBinary(x){return x&&x.typeId===Type.Binary;}},{key:"isUtf8",value:function isUtf8(x){return x&&x.typeId===Type.Utf8;}},{key:"isBool",value:function isBool(x){return x&&x.typeId===Type.Bool;}},{key:"isDecimal",value:function isDecimal(x){return x&&x.typeId===Type.Decimal;}},{key:"isDate",value:function isDate(x){return x&&x.typeId===Type.Date;}},{key:"isTime",value:function isTime(x){return x&&x.typeId===Type.Time;}},{key:"isTimestamp",value:function isTimestamp(x){return x&&x.typeId===Type.Timestamp;}},{key:"isInterval",value:function isInterval(x){return x&&x.typeId===Type.Interval;}},{key:"isList",value:function isList(x){return x&&x.typeId===Type.List;}},{key:"isStruct",value:function isStruct(x){return x&&x.typeId===Type.Struct;}},{key:"isUnion",value:function isUnion(x){return x&&x.typeId===Type.Union;}},{key:"isFixedSizeBinary",value:function isFixedSizeBinary(x){return x&&x.typeId===Type.FixedSizeBinary;}},{key:"isFixedSizeList",value:function isFixedSizeList(x){return x&&x.typeId===Type.FixedSizeList;}},{key:"isMap",value:function isMap(x){return x&&x.typeId===Type.Map;}},{key:"isDictionary",value:function isDictionary(x){return x&&x.typeId===Type.Dictionary;}}]);}();_Symbol$toStringTag=Symbol.toStringTag;var Int=/*#__PURE__*/function(_DataType,_Symbol$toStringTag3){function Int(isSigned,bitWidth){var _this123;_classCallCheck(this,Int);_this123=_callSuper(this,Int);_defineProperty(_this123,"isSigned",void 0);_defineProperty(_this123,"bitWidth",void 0);_this123.isSigned=isSigned;_this123.bitWidth=bitWidth;return _this123;}_inherits(Int,_DataType);return _createClass(Int,[{key:"typeId",get:function get(){return Type.Int;}},{key:_Symbol$toStringTag3,get:function get(){return'Int';}},{key:"toString",value:function toString(){return"".concat(this.isSigned?'I':'Ui',"nt").concat(this.bitWidth);}}]);}(DataType,_Symbol$toStringTag);var Int8=/*#__PURE__*/function(_Int){function Int8(){_classCallCheck(this,Int8);return _callSuper(this,Int8,[true,8]);}_inherits(Int8,_Int);return _createClass(Int8);}(Int);var Int16=/*#__PURE__*/function(_Int2){function Int16(){_classCallCheck(this,Int16);return _callSuper(this,Int16,[true,16]);}_inherits(Int16,_Int2);return _createClass(Int16);}(Int);var Int32=/*#__PURE__*/function(_Int3){function Int32(){_classCallCheck(this,Int32);return _callSuper(this,Int32,[true,32]);}_inherits(Int32,_Int3);return _createClass(Int32);}(Int);var Uint8=/*#__PURE__*/function(_Int4){function Uint8(){_classCallCheck(this,Uint8);return _callSuper(this,Uint8,[false,8]);}_inherits(Uint8,_Int4);return _createClass(Uint8);}(Int);var Uint16=/*#__PURE__*/function(_Int5){function Uint16(){_classCallCheck(this,Uint16);return _callSuper(this,Uint16,[false,16]);}_inherits(Uint16,_Int5);return _createClass(Uint16);}(Int);var Uint32=/*#__PURE__*/function(_Int6){function Uint32(){_classCallCheck(this,Uint32);return _callSuper(this,Uint32,[false,32]);}_inherits(Uint32,_Int6);return _createClass(Uint32);}(Int);var Precision={HALF:16,SINGLE:32,DOUBLE:64};_Symbol$toStringTag2=Symbol.toStringTag;var Float=/*#__PURE__*/function(_DataType2,_Symbol$toStringTag4){function Float(precision){var _this124;_classCallCheck(this,Float);_this124=_callSuper(this,Float);_defineProperty(_this124,"precision",void 0);_this124.precision=precision;return _this124;}_inherits(Float,_DataType2);return _createClass(Float,[{key:"typeId",get:function get(){return Type.Float;}},{key:_Symbol$toStringTag4,get:function get(){return'Float';}},{key:"toString",value:function toString(){return"Float".concat(this.precision);}}]);}(DataType,_Symbol$toStringTag2);var Float32=/*#__PURE__*/function(_Float){function Float32(){_classCallCheck(this,Float32);return _callSuper(this,Float32,[Precision.SINGLE]);}_inherits(Float32,_Float);return _createClass(Float32);}(Float);var Float64=/*#__PURE__*/function(_Float2){function Float64(){_classCallCheck(this,Float64);return _callSuper(this,Float64,[Precision.DOUBLE]);}_inherits(Float64,_Float2);return _createClass(Float64);}(Float);_Symbol$toStringTag7=Symbol.toStringTag;var FixedSizeList=/*#__PURE__*/function(_DataType3,_Symbol$toStringTag5){function FixedSizeList(listSize,child){var _this125;_classCallCheck(this,FixedSizeList);_this125=_callSuper(this,FixedSizeList);_defineProperty(_this125,"listSize",void 0);_defineProperty(_this125,"children",void 0);_this125.listSize=listSize;_this125.children=[child];return _this125;}_inherits(FixedSizeList,_DataType3);return _createClass(FixedSizeList,[{key:"typeId",get:function get(){return Type.FixedSizeList;}},{key:"valueType",get:function get(){return this.children[0].type;}},{key:"valueField",get:function get(){return this.children[0];}},{key:_Symbol$toStringTag5,get:function get(){return'FixedSizeList';}},{key:"toString",value:function toString(){return"FixedSizeList[".concat(this.listSize,"]<").concat(this.valueType,">");}}]);}(DataType,_Symbol$toStringTag7);function getArrowTypeFromTypedArray(array){switch(array.constructor){case Int8Array:return new Int8();case Uint8Array:return new Uint8();case Int16Array:return new Int16();case Uint16Array:return new Uint16();case Int32Array:return new Int32();case Uint32Array:return new Uint32();case Float32Array:return new Float32();case Float64Array:return new Float64();default:throw new Error('array type not supported');}}function deduceMeshField(attributeName,attribute,optionalMetadata){var type=getArrowTypeFromTypedArray(attribute.value);var metadata=optionalMetadata?optionalMetadata:makeMeshAttributeMetadata(attribute);var field=new Field(attributeName,new FixedSizeList(attribute.size,new Field('value',type)),false,metadata);return field;}function makeMeshAttributeMetadata(attribute){var result=new Map();if('byteOffset'in attribute){result.set('byteOffset',attribute.byteOffset.toString(10));}if('byteStride'in attribute){result.set('byteStride',attribute.byteStride.toString(10));}if('normalized'in attribute){result.set('normalized',attribute.normalized.toString());}return result;}function getDracoSchema(attributes,loaderData,indices){var metadataMap=makeMetadata(loaderData.metadata);var fields=[];var namedLoaderDataAttributes=transformAttributesLoaderData(loaderData.attributes);for(var attributeName in attributes){var attribute=attributes[attributeName];var field=getArrowFieldFromAttribute(attributeName,attribute,namedLoaderDataAttributes[attributeName]);fields.push(field);}if(indices){var indicesField=getArrowFieldFromAttribute('indices',indices);fields.push(indicesField);}return new Schema(fields,metadataMap);}function transformAttributesLoaderData(loaderData){var result={};for(var key in loaderData){var dracoAttribute=loaderData[key];result[dracoAttribute.name||'undefined']=dracoAttribute;}return result;}function getArrowFieldFromAttribute(attributeName,attribute,loaderData){var metadataMap=loaderData?makeMetadata(loaderData.metadata):undefined;var field=deduceMeshField(attributeName,attribute,metadataMap);return field;}function makeMetadata(metadata){var metadataMap=new Map();for(var key in metadata){metadataMap.set("".concat(key,".string"),JSON.stringify(metadata[key]));}return metadataMap;}var DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP={POSITION:'POSITION',NORMAL:'NORMAL',COLOR:'COLOR_0',TEX_COORD:'TEXCOORD_0'};var DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP={1:Int8Array,2:Uint8Array,3:Int16Array,4:Uint16Array,5:Int32Array,6:Uint32Array,9:Float32Array};var INDEX_ITEM_SIZE=4;var DracoParser=/*#__PURE__*/function(){function DracoParser(draco){_classCallCheck(this,DracoParser);_defineProperty(this,"draco",void 0);_defineProperty(this,"decoder",void 0);_defineProperty(this,"metadataQuerier",void 0);this.draco=draco;this.decoder=new this.draco.Decoder();this.metadataQuerier=new this.draco.MetadataQuerier();}return _createClass(DracoParser,[{key:"destroy",value:function destroy(){this.draco.destroy(this.decoder);this.draco.destroy(this.metadataQuerier);}},{key:"parseSync",value:function parseSync(arrayBuffer){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var buffer=new this.draco.DecoderBuffer();buffer.Init(new Int8Array(arrayBuffer),arrayBuffer.byteLength);this._disableAttributeTransforms(options);var geometry_type=this.decoder.GetEncodedGeometryType(buffer);var dracoGeometry=geometry_type===this.draco.TRIANGULAR_MESH?new this.draco.Mesh():new this.draco.PointCloud();try{var dracoStatus;switch(geometry_type){case this.draco.TRIANGULAR_MESH:dracoStatus=this.decoder.DecodeBufferToMesh(buffer,dracoGeometry);break;case this.draco.POINT_CLOUD:dracoStatus=this.decoder.DecodeBufferToPointCloud(buffer,dracoGeometry);break;default:throw new Error('DRACO: Unknown geometry type.');}if(!dracoStatus.ok()||!dracoGeometry.ptr){var message="DRACO decompression failed: ".concat(dracoStatus.error_msg());throw new Error(message);}var loaderData=this._getDracoLoaderData(dracoGeometry,geometry_type,options);var geometry=this._getMeshData(dracoGeometry,loaderData,options);var boundingBox=getMeshBoundingBox(geometry.attributes);var schema=getDracoSchema(geometry.attributes,loaderData,geometry.indices);var data=_objectSpread(_objectSpread({loader:'draco',loaderData:loaderData,header:{vertexCount:dracoGeometry.num_points(),boundingBox:boundingBox}},geometry),{},{schema:schema});return data;}finally{this.draco.destroy(buffer);if(dracoGeometry){this.draco.destroy(dracoGeometry);}}}},{key:"_getDracoLoaderData",value:function _getDracoLoaderData(dracoGeometry,geometry_type,options){var metadata=this._getTopLevelMetadata(dracoGeometry);var attributes=this._getDracoAttributes(dracoGeometry,options);return{geometry_type:geometry_type,num_attributes:dracoGeometry.num_attributes(),num_points:dracoGeometry.num_points(),num_faces:dracoGeometry instanceof this.draco.Mesh?dracoGeometry.num_faces():0,metadata:metadata,attributes:attributes};}},{key:"_getDracoAttributes",value:function _getDracoAttributes(dracoGeometry,options){var dracoAttributes={};for(var attributeId=0;attributeId<dracoGeometry.num_attributes();attributeId++){var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attributeId);var metadata=this._getAttributeMetadata(dracoGeometry,attributeId);dracoAttributes[dracoAttribute.unique_id()]={unique_id:dracoAttribute.unique_id(),attribute_type:dracoAttribute.attribute_type(),data_type:dracoAttribute.data_type(),num_components:dracoAttribute.num_components(),byte_offset:dracoAttribute.byte_offset(),byte_stride:dracoAttribute.byte_stride(),normalized:dracoAttribute.normalized(),attribute_index:attributeId,metadata:metadata};var quantization=this._getQuantizationTransform(dracoAttribute,options);if(quantization){dracoAttributes[dracoAttribute.unique_id()].quantization_transform=quantization;}var octahedron=this._getOctahedronTransform(dracoAttribute,options);if(octahedron){dracoAttributes[dracoAttribute.unique_id()].octahedron_transform=octahedron;}}return dracoAttributes;}},{key:"_getMeshData",value:function _getMeshData(dracoGeometry,loaderData,options){var attributes=this._getMeshAttributes(loaderData,dracoGeometry,options);var positionAttribute=attributes.POSITION;if(!positionAttribute){throw new Error('DRACO: No position attribute found.');}if(dracoGeometry instanceof this.draco.Mesh){switch(options.topology){case'triangle-strip':return{topology:'triangle-strip',mode:4,attributes:attributes,indices:{value:this._getTriangleStripIndices(dracoGeometry),size:1}};case'triangle-list':default:return{topology:'triangle-list',mode:5,attributes:attributes,indices:{value:this._getTriangleListIndices(dracoGeometry),size:1}};}}return{topology:'point-list',mode:0,attributes:attributes};}},{key:"_getMeshAttributes",value:function _getMeshAttributes(loaderData,dracoGeometry,options){var attributes={};for(var _i517=0,_Object$values=Object.values(loaderData.attributes);_i517<_Object$values.length;_i517++){var loaderAttribute=_Object$values[_i517];var attributeName=this._deduceAttributeName(loaderAttribute,options);loaderAttribute.name=attributeName;var _this$_getAttributeVa=this._getAttributeValues(dracoGeometry,loaderAttribute),value=_this$_getAttributeVa.value,size=_this$_getAttributeVa.size;attributes[attributeName]={value:value,size:size,byteOffset:loaderAttribute.byte_offset,byteStride:loaderAttribute.byte_stride,normalized:loaderAttribute.normalized};}return attributes;}},{key:"_getTriangleListIndices",value:function _getTriangleListIndices(dracoGeometry){var numFaces=dracoGeometry.num_faces();var numIndices=numFaces*3;var byteLength=numIndices*INDEX_ITEM_SIZE;var ptr=this.draco._malloc(byteLength);try{this.decoder.GetTrianglesUInt32Array(dracoGeometry,byteLength,ptr);return new Uint32Array(this.draco.HEAPF32.buffer,ptr,numIndices).slice();}finally{this.draco._free(ptr);}}},{key:"_getTriangleStripIndices",value:function _getTriangleStripIndices(dracoGeometry){var dracoArray=new this.draco.DracoInt32Array();try{this.decoder.GetTriangleStripsFromMesh(dracoGeometry,dracoArray);return getUint32Array(dracoArray);}finally{this.draco.destroy(dracoArray);}}},{key:"_getAttributeValues",value:function _getAttributeValues(dracoGeometry,attribute){var TypedArrayCtor=DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];var numComponents=attribute.num_components;var numPoints=dracoGeometry.num_points();var numValues=numPoints*numComponents;var byteLength=numValues*TypedArrayCtor.BYTES_PER_ELEMENT;var dataType=getDracoDataType(this.draco,TypedArrayCtor);var value;var ptr=this.draco._malloc(byteLength);try{var dracoAttribute=this.decoder.GetAttribute(dracoGeometry,attribute.attribute_index);this.decoder.GetAttributeDataArrayForAllPoints(dracoGeometry,dracoAttribute,dataType,byteLength,ptr);value=new TypedArrayCtor(this.draco.HEAPF32.buffer,ptr,numValues).slice();}finally{this.draco._free(ptr);}return{value:value,size:numComponents};}},{key:"_deduceAttributeName",value:function _deduceAttributeName(attribute,options){var uniqueId=attribute.unique_id;for(var _i518=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i518<_Object$entries4.length;_i518++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i518],2),attributeName=_Object$entries4$_i[0],attributeUniqueId=_Object$entries4$_i[1];if(attributeUniqueId===uniqueId){return attributeName;}}var thisAttributeType=attribute.attribute_type;for(var dracoAttributeConstant in DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP){var attributeType=this.draco[dracoAttributeConstant];if(attributeType===thisAttributeType){return DRACO_TO_GLTF_ATTRIBUTE_NAME_MAP[dracoAttributeConstant];}}var entryName=options.attributeNameEntry||'name';if(attribute.metadata[entryName]){return attribute.metadata[entryName].string;}return"CUSTOM_ATTRIBUTE_".concat(uniqueId);}},{key:"_getTopLevelMetadata",value:function _getTopLevelMetadata(dracoGeometry){var dracoMetadata=this.decoder.GetMetadata(dracoGeometry);return this._getDracoMetadata(dracoMetadata);}},{key:"_getAttributeMetadata",value:function _getAttributeMetadata(dracoGeometry,attributeId){var dracoMetadata=this.decoder.GetAttributeMetadata(dracoGeometry,attributeId);return this._getDracoMetadata(dracoMetadata);}},{key:"_getDracoMetadata",value:function _getDracoMetadata(dracoMetadata){if(!dracoMetadata||!dracoMetadata.ptr){return{};}var result={};var numEntries=this.metadataQuerier.NumEntries(dracoMetadata);for(var entryIndex=0;entryIndex<numEntries;entryIndex++){var entryName=this.metadataQuerier.GetEntryName(dracoMetadata,entryIndex);result[entryName]=this._getDracoMetadataField(dracoMetadata,entryName);}return result;}},{key:"_getDracoMetadataField",value:function _getDracoMetadataField(dracoMetadata,entryName){var dracoArray=new this.draco.DracoInt32Array();try{this.metadataQuerier.GetIntEntryArray(dracoMetadata,entryName,dracoArray);var intArray=getInt32Array(dracoArray);return{"int":this.metadataQuerier.GetIntEntry(dracoMetadata,entryName),string:this.metadataQuerier.GetStringEntry(dracoMetadata,entryName),"double":this.metadataQuerier.GetDoubleEntry(dracoMetadata,entryName),intArray:intArray};}finally{this.draco.destroy(dracoArray);}}},{key:"_disableAttributeTransforms",value:function _disableAttributeTransforms(options){var _options$quantizedAtt=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt===void 0?[]:_options$quantizedAtt,_options$octahedronAt=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt===void 0?[]:_options$octahedronAt;var skipAttributes=[].concat(_toConsumableArray(quantizedAttributes),_toConsumableArray(octahedronAttributes));var _iterator23=_createForOfIteratorHelper(skipAttributes),_step23;try{for(_iterator23.s();!(_step23=_iterator23.n()).done;){var dracoAttributeName=_step23.value;this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);}}catch(err){_iterator23.e(err);}finally{_iterator23.f();}}},{key:"_getQuantizationTransform",value:function _getQuantizationTransform(dracoAttribute,options){var _this126=this;var _options$quantizedAtt2=options.quantizedAttributes,quantizedAttributes=_options$quantizedAtt2===void 0?[]:_options$quantizedAtt2;var attribute_type=dracoAttribute.attribute_type();var skip=quantizedAttributes.map(function(type){return _this126.decoder[type];}).includes(attribute_type);if(skip){var _transform2=new this.draco.AttributeQuantizationTransform();try{if(_transform2.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform2.quantization_bits(),range:_transform2.range(),min_values:new Float32Array([1,2,3]).map(function(i){return _transform2.min_value(i);})};}}finally{this.draco.destroy(_transform2);}}return null;}},{key:"_getOctahedronTransform",value:function _getOctahedronTransform(dracoAttribute,options){var _this127=this;var _options$octahedronAt2=options.octahedronAttributes,octahedronAttributes=_options$octahedronAt2===void 0?[]:_options$octahedronAt2;var attribute_type=dracoAttribute.attribute_type();var octahedron=octahedronAttributes.map(function(type){return _this127.decoder[type];}).includes(attribute_type);if(octahedron){var _transform3=new this.draco.AttributeQuantizationTransform();try{if(_transform3.InitFromAttribute(dracoAttribute)){return{quantization_bits:_transform3.quantization_bits()};}}finally{this.draco.destroy(_transform3);}}return null;}}]);}();function getDracoDataType(draco,attributeType){switch(attributeType){case Float32Array:return draco.DT_FLOAT32;case Int8Array:return draco.DT_INT8;case Int16Array:return draco.DT_INT16;case Int32Array:return draco.DT_INT32;case Uint8Array:return draco.DT_UINT8;case Uint16Array:return draco.DT_UINT16;case Uint32Array:return draco.DT_UINT32;default:return draco.DT_INVALID;}}function getInt32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i519=0;_i519<numValues;_i519++){intArray[_i519]=dracoArray.GetValue(_i519);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i520=0;_i520<numValues;_i520++){intArray[_i520]=dracoArray.GetValue(_i520);}return intArray;}var DRACO_DECODER_VERSION='1.5.5';var STATIC_DECODER_URL="https://www.gstatic.com/draco/versioned/decoders/".concat(DRACO_DECODER_VERSION);var DRACO_JS_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.js");var DRACO_WASM_WRAPPER_URL="".concat(STATIC_DECODER_URL,"/draco_wasm_wrapper.js");var DRACO_WASM_DECODER_URL="".concat(STATIC_DECODER_URL,"/draco_decoder.wasm");var loadDecoderPromise;function loadDracoDecoderModule(_x69){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(options){var modules;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:modules=options.modules||{};if(modules.draco3d){loadDecoderPromise=loadDecoderPromise||modules.draco3d.createDecoderModule({}).then(function(draco){return{draco:draco};});}else{loadDecoderPromise=loadDecoderPromise||loadDracoDecoder(options);}_context45.next=4;return loadDecoderPromise;case 4:return _context45.abrupt("return",_context45.sent);case 5:case"end":return _context45.stop();}},_callee42);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x70){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:_context46.t0=options.draco&&options.draco.decoderType;_context46.next=_context46.t0==='js'?3:_context46.t0==='wasm'?7:7;break;case 3:_context46.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context46.sent;return _context46.abrupt("break",21);case 7:_context46.t1=Promise;_context46.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context46.t2=_context46.sent;_context46.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context46.t3=_context46.sent;_context46.t4=[_context46.t2,_context46.t3];_context46.next=17;return _context46.t1.all.call(_context46.t1,_context46.t4);case 17:_yield$Promise$all5=_context46.sent;_yield$Promise$all6=_slicedToArray(_yield$Promise$all5,2);DracoDecoderModule=_yield$Promise$all6[0];wasmBinary=_yield$Promise$all6[1];case 21:DracoDecoderModule=DracoDecoderModule||globalThis.DracoDecoderModule;_context46.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context46.abrupt("return",_context46.sent);case 25:case"end":return _context46.stop();}},_callee43);}));return _loadDracoDecoder.apply(this,arguments);}function initializeDracoDecoder(DracoDecoderModule,wasmBinary){var options={};if(wasmBinary){options.wasmBinary=wasmBinary;}return new Promise(function(resolve){DracoDecoderModule(_objectSpread(_objectSpread({},options),{},{onModuleLoaded:function onModuleLoaded(draco){return resolve({draco:draco});}}));});}({id:isBrowser?'draco-writer':'draco-writer-nodejs',name:'Draco compressed geometry writer',module:'draco',version:VERSION$1,worker:true,options:{draco:{},source:null}});var DracoLoader=_objectSpread(_objectSpread({},DracoLoader$1),{},{parse:parse$1});function parse$1(_x71,_x72){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:_context47.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context47.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context47.prev=5;return _context47.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context47.prev=7;dracoParser.destroy();return _context47.finish(7);case 10:case"end":return _context47.stop();}},_callee44,null,[[5,,7,10]]);}));return _parse$2.apply(this,arguments);}function getGLTFAccessors(attributes){var accessors={};for(var _name7 in attributes){var attribute=attributes[_name7];if(_name7!=='indices'){var glTFAccessor=getGLTFAccessor(attribute);accessors[_name7]=glTFAccessor;}}return accessors;}function getGLTFAccessor(attribute){var _getAccessorData=getAccessorData(attribute),buffer=_getAccessorData.buffer,size=_getAccessorData.size,count=_getAccessorData.count;var glTFAccessor={value:buffer,size:size,byteOffset:0,count:count,type:getAccessorTypeFromSize(size),componentType:getComponentTypeFromArray(buffer)};return glTFAccessor;}function getAccessorData(attribute){var buffer=attribute;var size=1;var count=0;if(attribute&&attribute.value){buffer=attribute.value;size=attribute.size||1;}if(buffer){if(!ArrayBuffer.isView(buffer)){buffer=toTypedArray(buffer,Float32Array);}count=buffer.length/size;}return{buffer:buffer,size:size,count:count};}function toTypedArray(array,ArrayType){var convertTypedArrays=arguments.length>2&&arguments[2]!==undefined?arguments[2]:false;if(!array){return null;}if(Array.isArray(array)){return new ArrayType(array);}if(convertTypedArrays&&!(array instanceof ArrayType)){return new ArrayType(array);}return array;}var KHR_DRACO_MESH_COMPRESSION='KHR_draco_mesh_compression';var name$5=KHR_DRACO_MESH_COMPRESSION;function preprocess$1(gltfData,options,context){var scenegraph=new GLTFScenegraph(gltfData);var _iterator24=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph)),_step24;try{for(_iterator24.s();!(_step24=_iterator24.n()).done;){var _primitive=_step24.value;if(scenegraph.getObjectExtension(_primitive,KHR_DRACO_MESH_COMPRESSION));}}catch(err){_iterator24.e(err);}finally{_iterator24.f();}}function decode$5(_x73,_x74,_x75){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator45,_step45,_primitive6;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context48.next=2;break;}return _context48.abrupt("return");case 2:scenegraph=new GLTFScenegraph(gltfData);promises=[];_iterator45=_createForOfIteratorHelper(makeMeshPrimitiveIterator(scenegraph));try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){_primitive6=_step45.value;if(scenegraph.getObjectExtension(_primitive6,KHR_DRACO_MESH_COMPRESSION)){promises.push(decompressPrimitive(scenegraph,_primitive6,options,context));}}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}_context48.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context48.stop();}},_callee45);}));return _decode$2.apply(this,arguments);}function encode$3(gltfData){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var scenegraph=new GLTFScenegraph(gltfData);var _iterator25=_createForOfIteratorHelper(scenegraph.json.meshes||[]),_step25;try{for(_iterator25.s();!(_step25=_iterator25.n()).done;){var _mesh4=_step25.value;compressMesh(_mesh4,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x76,_x77,_x78,_x79){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i637,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context49.next=3;break;}return _context49.abrupt("return");case 3:buffer=scenegraph.getTypedArrayForBufferView(dracoExtension.bufferView);bufferCopy=sliceArrayBuffer(buffer.buffer,buffer.byteOffset);parse=context.parse;dracoOptions=_objectSpread({},options);delete dracoOptions['3d-tiles'];_context49.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context49.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i637=0,_Object$entries5=Object.entries(decodedAttributes);_i637<_Object$entries5.length;_i637++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i637],2),attributeName=_Object$entries5$_i[0],decodedAttribute=_Object$entries5$_i[1];if(attributeName in primitive.attributes){accessorIndex=primitive.attributes[attributeName];accessor=scenegraph.getAccessor(accessorIndex);if(accessor!==null&&accessor!==void 0&&accessor.min&&accessor!==null&&accessor!==void 0&&accessor.max){decodedAttribute.min=accessor.min;decodedAttribute.max=accessor.max;}}}primitive.attributes=decodedAttributes;if(decodedData.indices){primitive.indices=getGLTFAccessor(decodedData.indices);}checkPrimitive(primitive);case 16:case"end":return _context49.stop();}},_callee46);}));return _decompressPrimitive.apply(this,arguments);}function compressMesh(attributes,indices){var _context$parseSync;var mode=arguments.length>2&&arguments[2]!==undefined?arguments[2]:4;var options=arguments.length>3?arguments[3]:undefined;var context=arguments.length>4?arguments[4]:undefined;if(!options.DracoWriter){throw new Error('options.gltf.DracoWriter not provided');}var compressedData=options.DracoWriter.encodeSync({attributes:attributes});var decodedData=context===null||context===void 0?void 0:(_context$parseSync=context.parseSync)===null||_context$parseSync===void 0?void 0:_context$parseSync.call(context,{attributes:attributes});var fauxAccessors=options._addFauxAttributes(decodedData.attributes);var bufferViewIndex=options.addBufferView(compressedData);var glTFMesh={primitives:[{attributes:fauxAccessors,mode:mode,extensions:_defineProperty2({},KHR_DRACO_MESH_COMPRESSION,{bufferView:bufferViewIndex,attributes:fauxAccessors})}]};return glTFMesh;}function checkPrimitive(primitive){if(!primitive.attributes&&Object.keys(primitive.attributes).length>0){throw new Error('glTF: Empty primitive detected: Draco decompression failure?');}}function makeMeshPrimitiveIterator(scenegraph){var _iterator26,_step26,_mesh5,_iterator27,_step27,_primitive2;return _regeneratorRuntime().wrap(function makeMeshPrimitiveIterator$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_iterator26=_createForOfIteratorHelper(scenegraph.json.meshes||[]);_context10.prev=1;_iterator26.s();case 3:if((_step26=_iterator26.n()).done){_context10.next=24;break;}_mesh5=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh5.primitives);_context10.prev=6;_iterator27.s();case 8:if((_step27=_iterator27.n()).done){_context10.next=14;break;}_primitive2=_step27.value;_context10.next=12;return _primitive2;case 12:_context10.next=8;break;case 14:_context10.next=19;break;case 16:_context10.prev=16;_context10.t0=_context10["catch"](6);_iterator27.e(_context10.t0);case 19:_context10.prev=19;_iterator27.f();return _context10.finish(19);case 22:_context10.next=3;break;case 24:_context10.next=29;break;case 26:_context10.prev=26;_context10.t1=_context10["catch"](1);_iterator26.e(_context10.t1);case 29:_context10.prev=29;_iterator26.f();return _context10.finish(29);case 32:case"end":return _context10.stop();}},_marked2,null,[[1,26,29,32],[6,16,19,22]]);}var KHR_draco_mesh_compression=/*#__PURE__*/Object.freeze({__proto__:null,name:name$5,preprocess:preprocess$1,decode:decode$5,encode:encode$3});function assert(condition,message){if(!condition){throw new Error("math.gl assertion ".concat(message));}}var config={EPSILON:1e-12,debug:false,precision:4,printTypes:false,printDegrees:false,printRowMajor:true};function formatValue(value){var _ref17=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},_ref17$precision=_ref17.precision,precision=_ref17$precision===void 0?config.precision:_ref17$precision;value=round(value);return"".concat(parseFloat(value.toPrecision(precision)));}function isArray(value){return Array.isArray(value)||ArrayBuffer.isView(value)&&!(value instanceof DataView);}function _equals(a,b,epsilon){var oldEpsilon=config.EPSILON;if(epsilon){config.EPSILON=epsilon;}try{if(a===b){return true;}if(isArray(a)&&isArray(b)){if(a.length!==b.length){return false;}for(var _i521=0;_i521<a.length;++_i521){if(!_equals(a[_i521],b[_i521])){return false;}}return true;}if(a&&a.equals){return a.equals(b);}if(b&&b.equals){return b.equals(a);}if(typeof a==='number'&&typeof b==='number'){return Math.abs(a-b)<=config.EPSILON*Math.max(1,Math.abs(a),Math.abs(b));}return false;}finally{config.EPSILON=oldEpsilon;}}function round(value){return Math.round(value/config.EPSILON)*config.EPSILON;}function _extendableBuiltin(cls){function ExtendableBuiltin(){var instance=Reflect.construct(cls,Array.from(arguments));Object.setPrototypeOf(instance,Object.getPrototypeOf(this));return instance;}ExtendableBuiltin.prototype=Object.create(cls.prototype,{constructor:{value:cls,enumerable:false,writable:true,configurable:true}});if(Object.setPrototypeOf){Object.setPrototypeOf(ExtendableBuiltin,cls);}else{ExtendableBuiltin.__proto__=cls;}return ExtendableBuiltin;}var MathArray=/*#__PURE__*/function(_extendableBuiltin2){function MathArray(){_classCallCheck(this,MathArray);return _callSuper(this,MathArray,arguments);}_inherits(MathArray,_extendableBuiltin2);return _createClass(MathArray,[{key:"clone",value:function clone(){return new this.constructor().copy(this);}},{key:"fromArray",value:function fromArray(array){var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]=array[_i522+offset];}return this.check();}},{key:"toArray",value:function toArray(){var targetArray=arguments.length>0&&arguments[0]!==undefined?arguments[0]:[];var offset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;for(var _i523=0;_i523<this.ELEMENTS;++_i523){targetArray[offset+_i523]=this[_i523];}return targetArray;}},{key:"from",value:function from(arrayOrObject){return Array.isArray(arrayOrObject)?this.copy(arrayOrObject):this.fromObject(arrayOrObject);}},{key:"to",value:function to(arrayOrObject){if(arrayOrObject===this){return this;}return isArray(arrayOrObject)?this.toArray(arrayOrObject):this.toObject(arrayOrObject);}},{key:"toTarget",value:function toTarget(target){return target?this.to(target):this;}},{key:"toFloat32Array",value:function toFloat32Array(){return new Float32Array(this);}},{key:"toString",value:function toString(){return this.formatString(config);}},{key:"formatString",value:function formatString(opts){var string='';for(var _i524=0;_i524<this.ELEMENTS;++_i524){string+=(_i524>0?', ':'')+formatValue(this[_i524],opts);}return"".concat(opts.printTypes?this.constructor.name:'',"[").concat(string,"]");}},{key:"equals",value:function equals(array){if(!array||this.length!==array.length){return false;}for(var _i525=0;_i525<this.ELEMENTS;++_i525){if(!_equals(this[_i525],array[_i525])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i526=0;_i526<this.ELEMENTS;++_i526){if(this[_i526]!==array[_i526]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]=-this[_i527];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i528=0;_i528<this.ELEMENTS;++_i528){var ai=a[_i528];this[_i528]=ai+t*(b[_i528]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(vector[_i529],this[_i529]);}return this.check();}},{key:"max",value:function max(vector){for(var _i530=0;_i530<this.ELEMENTS;++_i530){this[_i530]=Math.max(vector[_i530],this[_i530]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i531=0;_i531<this.ELEMENTS;++_i531){this[_i531]=Math.min(Math.max(this[_i531],minVector[_i531]),maxVector[_i531]);}return this.check();}},{key:"add",value:function add(){for(var _len101=arguments.length,vectors=new Array(_len101),_key8=0;_key8<_len101;_key8++){vectors[_key8]=arguments[_key8];}for(var _i532=0,_vectors=vectors;_i532<_vectors.length;_i532++){var vector=_vectors[_i532];for(var _i533=0;_i533<this.ELEMENTS;++_i533){this[_i533]+=vector[_i533];}}return this.check();}},{key:"subtract",value:function subtract(){for(var _len102=arguments.length,vectors=new Array(_len102),_key9=0;_key9<_len102;_key9++){vectors[_key9]=arguments[_key9];}for(var _i534=0,_vectors2=vectors;_i534<_vectors2.length;_i534++){var vector=_vectors2[_i534];for(var _i535=0;_i535<this.ELEMENTS;++_i535){this[_i535]-=vector[_i535];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=_scale7;}}else{for(var _i537=0;_i537<this.ELEMENTS&&_i537<_scale7.length;++_i537){this[_i537]*=_scale7[_i537];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]*=scalar;}return this.check();}},{key:"check",value:function check(){if(config.debug&&!this.validate()){throw new Error("math.gl: ".concat(this.constructor.name," some fields set to invalid numbers'"));}return this;}},{key:"validate",value:function validate(){var valid=this.length===this.ELEMENTS;for(var _i539=0;_i539<this.ELEMENTS;++_i539){valid=valid&&Number.isFinite(this[_i539]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i540=0;_i540<this.ELEMENTS;++_i540){this[_i540]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i541=0;_i541<this.ELEMENTS;++_i541){this[_i541]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i542=0;_i542<this.ELEMENTS;++_i542){this[_i542]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i543=0;_i543<this.ELEMENTS;++_i543){this[_i543]=Math.min(Math.max(this[_i543],min),max);}return this.check();}},{key:"elements",get:function get(){return this;}}]);}(_extendableBuiltin(Array));function validateVector(v,length){if(v.length!==length){return false;}for(var _i544=0;_i544<v.length;++_i544){if(!Number.isFinite(v[_i544])){return false;}}return true;}function checkNumber(value){if(!Number.isFinite(value)){throw new Error("Invalid number ".concat(value));}return value;}function checkVector(v,length){var callerName=arguments.length>2&&arguments[2]!==undefined?arguments[2]:'';if(config.debug&&!validateVector(v,length)){throw new Error("math.gl: ".concat(callerName," some fields set to invalid numbers'"));}return v;}var Vector=/*#__PURE__*/function(_MathArray){function Vector(){_classCallCheck(this,Vector);return _callSuper(this,Vector,arguments);}_inherits(Vector,_MathArray);return _createClass(Vector,[{key:"x",get:function get(){return this[0];},set:function set(value){this[0]=checkNumber(value);}},{key:"y",get:function get(){return this[1];},set:function set(value){this[1]=checkNumber(value);}},{key:"len",value:function len(){return Math.sqrt(this.lengthSquared());}},{key:"magnitude",value:function magnitude(){return this.len();}},{key:"lengthSquared",value:function lengthSquared(){var length=0;for(var _i545=0;_i545<this.ELEMENTS;++_i545){length+=this[_i545]*this[_i545];}return length;}},{key:"magnitudeSquared",value:function magnitudeSquared(){return this.lengthSquared();}},{key:"distance",value:function distance(mathArray){return Math.sqrt(this.distanceSquared(mathArray));}},{key:"distanceSquared",value:function distanceSquared(mathArray){var length=0;for(var _i546=0;_i546<this.ELEMENTS;++_i546){var dist=this[_i546]-mathArray[_i546];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i547=0;_i547<this.ELEMENTS;++_i547){product+=this[_i547]*mathArray[_i547];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i548=0;_i548<this.ELEMENTS;++_i548){this[_i548]/=length;}}return this.check();}},{key:"multiply",value:function multiply(){for(var _len103=arguments.length,vectors=new Array(_len103),_key10=0;_key10<_len103;_key10++){vectors[_key10]=arguments[_key10];}for(var _i549=0,_vectors3=vectors;_i549<_vectors3.length;_i549++){var vector=_vectors3[_i549];for(var _i550=0;_i550<this.ELEMENTS;++_i550){this[_i550]*=vector[_i550];}}return this.check();}},{key:"divide",value:function divide(){for(var _len104=arguments.length,vectors=new Array(_len104),_key11=0;_key11<_len104;_key11++){vectors[_key11]=arguments[_key11];}for(var _i551=0,_vectors4=vectors;_i551<_vectors4.length;_i551++){var vector=_vectors4[_i551];for(var _i552=0;_i552<this.ELEMENTS;++_i552){this[_i552]/=vector[_i552];}}return this.check();}},{key:"lengthSq",value:function lengthSq(){return this.lengthSquared();}},{key:"distanceTo",value:function distanceTo(vector){return this.distance(vector);}},{key:"distanceToSquared",value:function distanceToSquared(vector){return this.distanceSquared(vector);}},{key:"getComponent",value:function getComponent(i){assert(i>=0&&i<this.ELEMENTS,'index is out of range');return checkNumber(this[i]);}},{key:"setComponent",value:function setComponent(i,value){assert(i>=0&&i<this.ELEMENTS,'index is out of range');this[i]=value;return this.check();}},{key:"addVectors",value:function addVectors(a,b){return this.copy(a).add(b);}},{key:"subVectors",value:function subVectors(a,b){return this.copy(a).subtract(b);}},{key:"multiplyVectors",value:function multiplyVectors(a,b){return this.copy(a).multiply(b);}},{key:"addScaledVector",value:function addScaledVector(a,b){return this.add(new this.constructor(a).multiplyScalar(b));}}]);}(MathArray);/**
24779
25035
  * Common utilities
24780
25036
  * @module glMatrix
24781
25037
  */var ARRAY_TYPE=typeof Float32Array!=='undefined'?Float32Array:Array;if(!Math.hypot)Math.hypot=function(){var y=0,i=arguments.length;while(i--){y+=arguments[i]*arguments[i];}return Math.sqrt(y);};/**
@@ -24900,7 +25156,7 @@ out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out;}/**
24900
25156
  * @param {Object} [arg] additional argument to pass to fn
24901
25157
  * @returns {Array} a
24902
25158
  * @function
24903
- */(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this127;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this127=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this127.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this127[0]=x;_this127[1]=y;_this127[2]=z;}return _this127;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref19){var radians=_ref19.radians,_ref19$origin=_ref19.origin,origin=_ref19$origin===void 0?ORIGIN:_ref19$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref20){var radians=_ref20.radians,_ref20$origin=_ref20.origin,origin=_ref20$origin===void 0?ORIGIN:_ref20$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i553=0;_i553<this.ELEMENTS;++_i553){string+=" ".concat(this[_i553]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}},{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}},{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i554=0;_i554<this.RANK;++_i554){result[_i554]=this[firstIndex+_i554];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i555=0;_i555<this.RANK;++_i555){this[firstIndex+_i555]=columnVector[_i555];}return this;}}]);}(MathArray);/**
25159
+ */(function(){var vec=create();return function(a,stride,offset,count,fn,arg){var i,l;if(!stride){stride=3;}if(!offset){offset=0;}if(count){l=Math.min(count*stride+offset,a.length);}else{l=a.length;}for(i=offset;i<l;i+=stride){vec[0]=a[i];vec[1]=a[i+1];vec[2]=a[i+2];fn(vec,vec,arg);a[i]=vec[0];a[i+1]=vec[1];a[i+2]=vec[2];}return a;};})();var ORIGIN=[0,0,0];var ZERO;var Vector3=/*#__PURE__*/function(_Vector){function Vector3(){var _this128;var x=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var y=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var z=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;_classCallCheck(this,Vector3);_this128=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this128.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this128[0]=x;_this128[1]=y;_this128[2]=z;}return _this128;}_inherits(Vector3,_Vector);return _createClass(Vector3,[{key:"set",value:function set(x,y,z){this[0]=x;this[1]=y;this[2]=z;return this.check();}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];return this.check();}},{key:"fromObject",value:function fromObject(object){if(config.debug){checkNumber(object.x);checkNumber(object.y);checkNumber(object.z);}this[0]=object.x;this[1]=object.y;this[2]=object.z;return this.check();}},{key:"toObject",value:function toObject(object){object.x=this[0];object.y=this[1];object.z=this[2];return object;}},{key:"ELEMENTS",get:function get(){return 3;}},{key:"z",get:function get(){return this[2];},set:function set(value){this[2]=checkNumber(value);}},{key:"angle",value:function angle(vector){return _angle3(this,vector);}},{key:"cross",value:function cross(vector){_cross(this,this,vector);return this.check();}},{key:"rotateX",value:function rotateX(_ref18){var radians=_ref18.radians,_ref18$origin=_ref18.origin,origin=_ref18$origin===void 0?ORIGIN:_ref18$origin;_rotateX(this,this,origin,radians);return this.check();}},{key:"rotateY",value:function rotateY(_ref19){var radians=_ref19.radians,_ref19$origin=_ref19.origin,origin=_ref19$origin===void 0?ORIGIN:_ref19$origin;_rotateY(this,this,origin,radians);return this.check();}},{key:"rotateZ",value:function rotateZ(_ref20){var radians=_ref20.radians,_ref20$origin=_ref20.origin,origin=_ref20$origin===void 0?ORIGIN:_ref20$origin;_rotateZ(this,this,origin,radians);return this.check();}},{key:"transform",value:function transform(matrix4){return this.transformAsPoint(matrix4);}},{key:"transformAsPoint",value:function transformAsPoint(matrix4){transformMat4(this,this,matrix4);return this.check();}},{key:"transformAsVector",value:function transformAsVector(matrix4){vec3_transformMat4AsVector(this,this,matrix4);return this.check();}},{key:"transformByMatrix3",value:function transformByMatrix3(matrix3){transformMat3(this,this,matrix3);return this.check();}},{key:"transformByMatrix2",value:function transformByMatrix2(matrix2){vec3_transformMat2(this,this,matrix2);return this.check();}},{key:"transformByQuaternion",value:function transformByQuaternion(quaternion){transformQuat(this,this,quaternion);return this.check();}}],[{key:"ZERO",get:function get(){if(!ZERO){ZERO=new Vector3(0,0,0);Object.freeze(ZERO);}return ZERO;}}]);}(Vector);var Matrix=/*#__PURE__*/function(_MathArray2){function Matrix(){_classCallCheck(this,Matrix);return _callSuper(this,Matrix,arguments);}_inherits(Matrix,_MathArray2);return _createClass(Matrix,[{key:"toString",value:function toString(){var string='[';if(config.printRowMajor){string+='row-major:';for(var row=0;row<this.RANK;++row){for(var col=0;col<this.RANK;++col){string+=" ".concat(this[col*this.RANK+row]);}}}else{string+='column-major:';for(var _i553=0;_i553<this.ELEMENTS;++_i553){string+=" ".concat(this[_i553]);}}string+=']';return string;}},{key:"getElementIndex",value:function getElementIndex(row,col){return col*this.RANK+row;}},{key:"getElement",value:function getElement(row,col){return this[col*this.RANK+row];}},{key:"setElement",value:function setElement(row,col,value){this[col*this.RANK+row]=checkNumber(value);return this;}},{key:"getColumn",value:function getColumn(columnIndex){var result=arguments.length>1&&arguments[1]!==undefined?arguments[1]:new Array(this.RANK).fill(-0);var firstIndex=columnIndex*this.RANK;for(var _i554=0;_i554<this.RANK;++_i554){result[_i554]=this[firstIndex+_i554];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i555=0;_i555<this.RANK;++_i555){this[firstIndex+_i555]=columnVector[_i555];}return this;}}]);}(MathArray);/**
24904
25160
  * Transpose the values of a mat3
24905
25161
  *
24906
25162
  * @param {mat3} out the receiving matrix
@@ -24954,9 +25210,9 @@ var det=a00*b01+a01*b11+a02*b21;if(!det){return null;}det=1.0/det;out[0]=b01*det
24954
25210
  * @param {ReadonlyQuat} q Quaternion to create matrix from
24955
25211
  *
24956
25212
  * @returns {mat3} out
24957
- */function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this128;for(var _len105=arguments.length,args=new Array(_len105>1?_len105-1:0),_key12=1;_key12<_len105;_key12++){args[_key12-1]=arguments[_key12];}_classCallCheck(this,Matrix3);_this128=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this128.copy(array);}else if(args.length>0){_this128.copy([array].concat(args));}else{_this128.identity();}return _this128;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x80,_x81){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData,options){var gltfScenegraph,extension,materials,_i634;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context49.next=4;break;}return _context49.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i634=0;_i634<materials.length;_i634++){transformTexCoords(_i634,gltfData);}case 6:case"end":return _context49.stop();}},_callee46);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator28=_createForOfIteratorHelper(meshes),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _mesh6=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh6.primitives),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _primitive3=_step29.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref21=_slicedToArray(_ref,2),original=_ref21[0],newTexCoord=_ref21[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i556=0;_i556<accessor.count;_i556++){var uv=new ArrayType(arrayBuffer,byteOffset+_i556*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i556*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x82){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData){var gltfScenegraph,json,extension,_iterator44,_step44,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator44=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator44.s();!(_step44=_iterator44.n()).done;){_node10=_step44.value;nodeExtension=gltfScenegraph.getObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node10.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator44.e(err);}finally{_iterator44.f();}case 6:case"end":return _context50.stop();}},_callee47);}));return _decode$4.apply(this,arguments);}function encode$2(_x83){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,_iterator45,_step45,light,_node11;return _regeneratorRuntime().wrap(function _callee48$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$3(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator45=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator45.s();!(_step45=_iterator45.n()).done;){light=_step45.value;_node11=light.node;gltfScenegraph.addObjectExtension(_node11,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator45.e(err);}finally{_iterator45.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context51.stop();}},_callee48);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x84){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData){var gltfScenegraph,json,_iterator46,_step46,material,extension;return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator46=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){material=_step46.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context52.stop();}},_callee49);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator30=_createForOfIteratorHelper(json.materials||[]),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var material=_step30.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x85){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var gltfScenegraph,json,extension,techniques,_iterator47,_step47,material,materialExtension;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator47=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){material=_step47.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context53.stop();}},_callee50);}));return _decode$6.apply(this,arguments);}function encode(_x86,_x87){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltfData,options){return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:case"end":return _context54.stop();}},_callee51);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x88){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context55.stop();}},_callee52);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator31=_createForOfIteratorHelper(extensions),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var extension=_step31.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}function decodeExtensions(_x89){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltf){var options,context,extensions,_iterator48,_step48,extension,_extension$decode,_args49=arguments;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:options=_args49.length>1&&_args49[1]!==undefined?_args49[1]:{};context=_args49.length>2?_args49[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator48=_createForOfIteratorHelper(extensions);_context56.prev=4;_iterator48.s();case 6:if((_step48=_iterator48.n()).done){_context56.next=12;break;}extension=_step48.value;_context56.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context56.next=6;break;case 12:_context56.next=17;break;case 14:_context56.prev=14;_context56.t0=_context56["catch"](4);_iterator48.e(_context56.t0);case 17:_context56.prev=17;_iterator48.f();return _context56.finish(17);case 20:case"end":return _context56.stop();}},_callee53,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator32=_createForOfIteratorHelper(json.images||[]),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _image6=_step32.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator33=_createForOfIteratorHelper(json.textures),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var texture=_step33.value;this._convertTextureIds(texture);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.meshes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _mesh7=_step34.value;this._convertMeshIds(_mesh7);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.nodes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node4=_step35.value;this._convertNodeIds(_node4);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.scenes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node5=_step36.value;this._convertSceneIds(_node5);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator37=_createForOfIteratorHelper(mesh.primitives),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _primitive4=_step37.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this129=this;if(node.children){node.children=node.children.map(function(child){return _this129._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this129._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this130=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this130._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator38=_createForOfIteratorHelper(json[topLevelArrayName]),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var object=_step38.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator39=_createForOfIteratorHelper(this.json.buffers),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var buffer=_step39.value;delete buffer.type;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator40=_createForOfIteratorHelper(json.materials),_step40;try{var _loop4=function _loop4(){var material=_step40.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator40.s();!(_step40=_iterator40.n()).done;){_loop4();}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$3(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this131=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this131._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this131._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this131._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this131._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this131._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this131._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this131._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this131._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this131._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this131._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this132=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this132.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this133=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this133.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this133.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this134=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this134.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this134.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this134.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i557=0;_i557<count;_i557++){var elementOffset=byteOffset+_i557*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i557*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$4(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x90,_x91){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args50=arguments;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:byteOffset=_args50.length>2&&_args50[2]!==undefined?_args50[2]:0;options=_args50.length>3?_args50[3]:undefined;context=_args50.length>4?_args50[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context57.next=10;break;}_context57.next=10;return loadBuffers(gltf,options,context);case 10:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context57.next=15;return Promise.all(promises);case 15:return _context57.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context57.stop();}},_callee54);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$3(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$3(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x92,_x93,_x94){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,options,context){var buffers,_i635,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:buffers=gltf.json.buffers||[];_i635=0;case 2:if(!(_i635<buffers.length)){_context58.next=22;break;}buffer=buffers[_i635];if(!buffer.uri){_context58.next=18;break;}_fetch=context.fetch;assert$3(_fetch);uri=resolveUrl(buffer.uri,options);_context58.next=10;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 10:response=_context58.sent;_context58.next=13;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 13:arrayBuffer=_context58.sent;gltf.buffers[_i635]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context58.next=19;break;case 18:if(gltf.buffers[_i635]===null){gltf.buffers[_i635]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i635;_context58.next=2;break;case 22:case"end":return _context58.stop();}},_callee55);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x95,_x96,_x97){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(gltf,options,context){var imageIndices,images,promises,_iterator49,_step49,imageIndex;return _regeneratorRuntime().wrap(function _callee56$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator49=_createForOfIteratorHelper(imageIndices);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){imageIndex=_step49.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}_context59.next=7;return Promise.all(promises);case 7:return _context59.abrupt("return",_context59.sent);case 8:case"end":return _context59.stop();}},_callee56);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator41=_createForOfIteratorHelper(textures),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var texture=_step41.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return Array.from(imageIndices).sort();}function loadImage(_x98,_x99,_x100,_x101,_x102){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee57$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context60.next=10;break;}uri=resolveUrl(image.uri,options);_context60.next=5;return fetch(uri);case 5:response=_context60.sent;_context60.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context60.sent;image.bufferView={data:arrayBuffer};case 10:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$3(arrayBuffer,'glTF image has no data');_context60.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context60.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 18:case"end":return _context60.stop();}},_callee57);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$7,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x103){return _parse.apply(this,arguments);}/**
25213
+ */function fromQuat(out,q){var x=q[0],y=q[1],z=q[2],w=q[3];var x2=x+x;var y2=y+y;var z2=z+z;var xx=x*x2;var yx=y*x2;var yy=y*y2;var zx=z*x2;var zy=z*y2;var zz=z*z2;var wx=w*x2;var wy=w*y2;var wz=w*z2;out[0]=1-yy-zz;out[3]=yx-wz;out[6]=zx+wy;out[1]=yx+wz;out[4]=1-xx-zz;out[7]=zy-wx;out[2]=zx-wy;out[5]=zy+wx;out[8]=1-xx-yy;return out;}var INDICES;(function(INDICES){INDICES[INDICES["COL0ROW0"]=0]="COL0ROW0";INDICES[INDICES["COL0ROW1"]=1]="COL0ROW1";INDICES[INDICES["COL0ROW2"]=2]="COL0ROW2";INDICES[INDICES["COL1ROW0"]=3]="COL1ROW0";INDICES[INDICES["COL1ROW1"]=4]="COL1ROW1";INDICES[INDICES["COL1ROW2"]=5]="COL1ROW2";INDICES[INDICES["COL2ROW0"]=6]="COL2ROW0";INDICES[INDICES["COL2ROW1"]=7]="COL2ROW1";INDICES[INDICES["COL2ROW2"]=8]="COL2ROW2";})(INDICES||(INDICES={}));var IDENTITY_MATRIX=Object.freeze([1,0,0,0,1,0,0,0,1]);var Matrix3=/*#__PURE__*/function(_Matrix){function Matrix3(array){var _this129;for(var _len105=arguments.length,args=new Array(_len105>1?_len105-1:0),_key12=1;_key12<_len105;_key12++){args[_key12-1]=arguments[_key12];}_classCallCheck(this,Matrix3);_this129=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this129.copy(array);}else if(args.length>0){_this129.copy([array].concat(args));}else{_this129.identity();}return _this129;}_inherits(Matrix3,_Matrix);return _createClass(Matrix3,[{key:"ELEMENTS",get:function get(){return 9;}},{key:"RANK",get:function get(){return 3;}},{key:"INDICES",get:function get(){return INDICES;}},{key:"copy",value:function copy(array){this[0]=array[0];this[1]=array[1];this[2]=array[2];this[3]=array[3];this[4]=array[4];this[5]=array[5];this[6]=array[6];this[7]=array[7];this[8]=array[8];return this.check();}},{key:"identity",value:function identity(){return this.copy(IDENTITY_MATRIX);}},{key:"fromObject",value:function fromObject(object){return this.check();}},{key:"fromQuaternion",value:function fromQuaternion(q){fromQuat(this,q);return this.check();}},{key:"set",value:function set(m00,m10,m20,m01,m11,m21,m02,m12,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"setRowMajor",value:function setRowMajor(m00,m01,m02,m10,m11,m12,m20,m21,m22){this[0]=m00;this[1]=m10;this[2]=m20;this[3]=m01;this[4]=m11;this[5]=m21;this[6]=m02;this[7]=m12;this[8]=m22;return this.check();}},{key:"determinant",value:function determinant(){return _determinant(this);}},{key:"transpose",value:function transpose(){_transpose(this,this);return this.check();}},{key:"invert",value:function invert(){_invert(this,this);return this.check();}},{key:"multiplyLeft",value:function multiplyLeft(a){multiply(this,a,this);return this.check();}},{key:"multiplyRight",value:function multiplyRight(a){multiply(this,this,a);return this.check();}},{key:"rotate",value:function rotate(radians){_rotate(this,this,radians);return this.check();}},{key:"scale",value:function scale(factor){if(Array.isArray(factor)){_scale8(this,this,factor);}else{_scale8(this,this,[factor,factor]);}return this.check();}},{key:"translate",value:function translate(vec){_translate(this,this,vec);return this.check();}},{key:"transform",value:function transform(vector,result){var out;switch(vector.length){case 2:out=transformMat3$1(result||[-0,-0],vector,this);break;case 3:out=transformMat3(result||[-0,-0,-0],vector,this);break;case 4:out=vec4_transformMat3(result||[-0,-0,-0,-0],vector,this);break;default:throw new Error('Illegal vector');}checkVector(out,vector.length);return out;}},{key:"transformVector",value:function transformVector(vector,result){return this.transform(vector,result);}},{key:"transformVector2",value:function transformVector2(vector,result){return this.transform(vector,result);}},{key:"transformVector3",value:function transformVector3(vector,result){return this.transform(vector,result);}}],[{key:"IDENTITY",get:function get(){return getIdentityMatrix();}},{key:"ZERO",get:function get(){return getZeroMatrix();}}]);}(Matrix);var ZERO_MATRIX3;var IDENTITY_MATRIX3;function getZeroMatrix(){if(!ZERO_MATRIX3){ZERO_MATRIX3=new Matrix3([0,0,0,0,0,0,0,0,0]);Object.freeze(ZERO_MATRIX3);}return ZERO_MATRIX3;}function getIdentityMatrix(){if(!IDENTITY_MATRIX3){IDENTITY_MATRIX3=new Matrix3();Object.freeze(IDENTITY_MATRIX3);}return IDENTITY_MATRIX3;}var COMPONENTS$1={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES$1={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var EXT_MESHOPT_TRANSFORM='KHR_texture_transform';var name$4=EXT_MESHOPT_TRANSFORM;var scratchVector=new Vector3();var scratchRotationMatrix=new Matrix3();var scratchScaleMatrix=new Matrix3();function decode$4(_x80,_x81){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData,options){var gltfScenegraph,extension,materials,_i638;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context50.next=4;break;}return _context50.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i638=0;_i638<materials.length;_i638++){transformTexCoords(_i638,gltfData);}case 6:case"end":return _context50.stop();}},_callee47);}));return _decode$3.apply(this,arguments);}function transformTexCoords(materialIndex,gltfData){var _gltfData$json$materi,_material$pbrMetallic,_material$pbrMetallic2;var processedTexCoords=[];var material=(_gltfData$json$materi=gltfData.json.materials)===null||_gltfData$json$materi===void 0?void 0:_gltfData$json$materi[materialIndex];var baseColorTexture=material===null||material===void 0?void 0:(_material$pbrMetallic=material.pbrMetallicRoughness)===null||_material$pbrMetallic===void 0?void 0:_material$pbrMetallic.baseColorTexture;if(baseColorTexture){transformPrimitives(gltfData,materialIndex,baseColorTexture,processedTexCoords);}var emisiveTexture=material===null||material===void 0?void 0:material.emissiveTexture;if(emisiveTexture){transformPrimitives(gltfData,materialIndex,emisiveTexture,processedTexCoords);}var normalTexture=material===null||material===void 0?void 0:material.normalTexture;if(normalTexture){transformPrimitives(gltfData,materialIndex,normalTexture,processedTexCoords);}var occlusionTexture=material===null||material===void 0?void 0:material.occlusionTexture;if(occlusionTexture){transformPrimitives(gltfData,materialIndex,occlusionTexture,processedTexCoords);}var metallicRoughnessTexture=material===null||material===void 0?void 0:(_material$pbrMetallic2=material.pbrMetallicRoughness)===null||_material$pbrMetallic2===void 0?void 0:_material$pbrMetallic2.metallicRoughnessTexture;if(metallicRoughnessTexture){transformPrimitives(gltfData,materialIndex,metallicRoughnessTexture,processedTexCoords);}}function transformPrimitives(gltfData,materialIndex,texture,processedTexCoords){var transformParameters=getTransformParameters(texture,processedTexCoords);if(!transformParameters){return;}var meshes=gltfData.json.meshes||[];var _iterator28=_createForOfIteratorHelper(meshes),_step28;try{for(_iterator28.s();!(_step28=_iterator28.n()).done;){var _mesh6=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh6.primitives),_step29;try{for(_iterator29.s();!(_step29=_iterator29.n()).done;){var _primitive3=_step29.value;var material=_primitive3.material;if(Number.isFinite(material)&&materialIndex===material){transformPrimitive(gltfData,_primitive3,transformParameters);}}}catch(err){_iterator29.e(err);}finally{_iterator29.f();}}}catch(err){_iterator28.e(err);}finally{_iterator28.f();}}function getTransformParameters(texture,processedTexCoords){var _texture$extensions;var textureInfo=(_texture$extensions=texture.extensions)===null||_texture$extensions===void 0?void 0:_texture$extensions[EXT_MESHOPT_TRANSFORM];var _texture$texCoord=texture.texCoord,originalTexCoord=_texture$texCoord===void 0?0:_texture$texCoord;var _textureInfo$texCoord=textureInfo.texCoord,texCoord=_textureInfo$texCoord===void 0?originalTexCoord:_textureInfo$texCoord;var isProcessed=processedTexCoords.findIndex(function(_ref){var _ref21=_slicedToArray(_ref,2),original=_ref21[0],newTexCoord=_ref21[1];return original===originalTexCoord&&newTexCoord===texCoord;})!==-1;if(!isProcessed){var _matrix2=makeTransformationMatrix(textureInfo);if(originalTexCoord!==texCoord){texture.texCoord=texCoord;}processedTexCoords.push([originalTexCoord,texCoord]);return{originalTexCoord:originalTexCoord,texCoord:texCoord,matrix:_matrix2};}return null;}function transformPrimitive(gltfData,primitive,transformParameters){var originalTexCoord=transformParameters.originalTexCoord,texCoord=transformParameters.texCoord,matrix=transformParameters.matrix;var texCoordAccessor=primitive.attributes["TEXCOORD_".concat(originalTexCoord)];if(Number.isFinite(texCoordAccessor)){var _gltfData$json$access;var accessor=(_gltfData$json$access=gltfData.json.accessors)===null||_gltfData$json$access===void 0?void 0:_gltfData$json$access[texCoordAccessor];if(accessor&&accessor.bufferView){var _gltfData$json$buffer;var bufferView=(_gltfData$json$buffer=gltfData.json.bufferViews)===null||_gltfData$json$buffer===void 0?void 0:_gltfData$json$buffer[accessor.bufferView];if(bufferView){var _gltfData$buffers$buf=gltfData.buffers[bufferView.buffer],arrayBuffer=_gltfData$buffers$buf.arrayBuffer,bufferByteOffset=_gltfData$buffers$buf.byteOffset;var byteOffset=(bufferByteOffset||0)+(accessor.byteOffset||0)+(bufferView.byteOffset||0);var _getAccessorArrayType2=getAccessorArrayTypeAndLength(accessor,bufferView),ArrayType=_getAccessorArrayType2.ArrayType,length=_getAccessorArrayType2.length;var bytes=BYTES$1[accessor.componentType];var components=COMPONENTS$1[accessor.type];var elementAddressScale=bufferView.byteStride||bytes*components;var result=new Float32Array(length);for(var _i556=0;_i556<accessor.count;_i556++){var uv=new ArrayType(arrayBuffer,byteOffset+_i556*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i556*components);}if(originalTexCoord===texCoord){updateGltf(accessor,bufferView,gltfData.buffers,result);}else{createAttribute(texCoord,accessor,primitive,gltfData,result);}}}}}function updateGltf(accessor,bufferView,buffers,newTexCoordArray){accessor.componentType=5126;buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});bufferView.buffer=buffers.length-1;bufferView.byteLength=newTexCoordArray.buffer.byteLength;bufferView.byteOffset=0;delete bufferView.byteStride;}function createAttribute(newTexCoord,originalAccessor,primitive,gltfData,newTexCoordArray){gltfData.buffers.push({arrayBuffer:newTexCoordArray.buffer,byteOffset:0,byteLength:newTexCoordArray.buffer.byteLength});var bufferViews=gltfData.json.bufferViews;if(!bufferViews){return;}bufferViews.push({buffer:gltfData.buffers.length-1,byteLength:newTexCoordArray.buffer.byteLength,byteOffset:0});var accessors=gltfData.json.accessors;if(!accessors){return;}accessors.push({bufferView:(bufferViews===null||bufferViews===void 0?void 0:bufferViews.length)-1,byteOffset:0,componentType:5126,count:originalAccessor.count,type:'VEC2'});primitive.attributes["TEXCOORD_".concat(newTexCoord)]=accessors.length-1;}function makeTransformationMatrix(extensionData){var _extensionData$offset=extensionData.offset,offset=_extensionData$offset===void 0?[0,0]:_extensionData$offset,_extensionData$rotati=extensionData.rotation,rotation=_extensionData$rotati===void 0?0:_extensionData$rotati,_extensionData$scale=extensionData.scale,scale=_extensionData$scale===void 0?[1,1]:_extensionData$scale;var translationMatirx=new Matrix3().set(1,0,0,0,1,0,offset[0],offset[1],1);var rotationMatirx=scratchRotationMatrix.set(Math.cos(rotation),Math.sin(rotation),0,-Math.sin(rotation),Math.cos(rotation),0,0,0,1);var scaleMatrix=scratchScaleMatrix.set(scale[0],0,0,0,scale[1],0,0,0,1);return translationMatirx.multiplyRight(rotationMatirx).multiplyRight(scaleMatrix);}var KHR_texture_transform=/*#__PURE__*/Object.freeze({__proto__:null,name:name$4,decode:decode$4});var KHR_LIGHTS_PUNCTUAL='KHR_lights_punctual';var name$3=KHR_LIGHTS_PUNCTUAL;function decode$3(_x82){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,_iterator46,_step46,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee48$(_context51){while(1)switch(_context51.prev=_context51.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_LIGHTS_PUNCTUAL);if(extension){gltfScenegraph.json.lights=extension.lights;gltfScenegraph.removeExtension(KHR_LIGHTS_PUNCTUAL);}_iterator46=_createForOfIteratorHelper(json.nodes||[]);try{for(_iterator46.s();!(_step46=_iterator46.n()).done;){_node10=_step46.value;nodeExtension=gltfScenegraph.getObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);if(nodeExtension){_node10.light=nodeExtension.light;}gltfScenegraph.removeObjectExtension(_node10,KHR_LIGHTS_PUNCTUAL);}}catch(err){_iterator46.e(err);}finally{_iterator46.f();}case 6:case"end":return _context51.stop();}},_callee48);}));return _decode$4.apply(this,arguments);}function encode$2(_x83){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData){var gltfScenegraph,json,extension,_iterator47,_step47,light,_node11;return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$3(!extension.lights);extension.lights=json.lights;delete json.lights;}if(gltfScenegraph.json.lights){_iterator47=_createForOfIteratorHelper(gltfScenegraph.json.lights);try{for(_iterator47.s();!(_step47=_iterator47.n()).done;){light=_step47.value;_node11=light.node;gltfScenegraph.addObjectExtension(_node11,KHR_LIGHTS_PUNCTUAL,light);}}catch(err){_iterator47.e(err);}finally{_iterator47.f();}delete gltfScenegraph.json.lights;}case 4:case"end":return _context52.stop();}},_callee49);}));return _encode$.apply(this,arguments);}var KHR_lights_punctual=/*#__PURE__*/Object.freeze({__proto__:null,name:name$3,decode:decode$3,encode:encode$2});var KHR_MATERIALS_UNLIT='KHR_materials_unlit';var name$2=KHR_MATERIALS_UNLIT;function decode$2(_x84){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var gltfScenegraph,json,_iterator48,_step48,material,extension;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;_iterator48=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator48.s();!(_step48=_iterator48.n()).done;){material=_step48.value;extension=material.extensions&&material.extensions.KHR_materials_unlit;if(extension){material.unlit=true;}gltfScenegraph.removeObjectExtension(material,KHR_MATERIALS_UNLIT);}}catch(err){_iterator48.e(err);}finally{_iterator48.f();}gltfScenegraph.removeExtension(KHR_MATERIALS_UNLIT);case 5:case"end":return _context53.stop();}},_callee50);}));return _decode$5.apply(this,arguments);}function encode$1(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;if(gltfScenegraph.materials){var _iterator30=_createForOfIteratorHelper(json.materials||[]),_step30;try{for(_iterator30.s();!(_step30=_iterator30.n()).done;){var material=_step30.value;if(material.unlit){delete material.unlit;gltfScenegraph.addObjectExtension(material,KHR_MATERIALS_UNLIT,{});gltfScenegraph.addExtension(KHR_MATERIALS_UNLIT);}}}catch(err){_iterator30.e(err);}finally{_iterator30.f();}}}var KHR_materials_unlit=/*#__PURE__*/Object.freeze({__proto__:null,name:name$2,decode:decode$2,encode:encode$1});var KHR_TECHNIQUES_WEBGL='KHR_techniques_webgl';var name$1=KHR_TECHNIQUES_WEBGL;function decode$1(_x85){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltfData){var gltfScenegraph,json,extension,techniques,_iterator49,_step49,material,materialExtension;return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;extension=gltfScenegraph.getExtension(KHR_TECHNIQUES_WEBGL);if(extension){techniques=resolveTechniques(extension,gltfScenegraph);_iterator49=_createForOfIteratorHelper(json.materials||[]);try{for(_iterator49.s();!(_step49=_iterator49.n()).done;){material=_step49.value;materialExtension=gltfScenegraph.getObjectExtension(material,KHR_TECHNIQUES_WEBGL);if(materialExtension){material.technique=Object.assign({},materialExtension,techniques[materialExtension.technique]);material.technique.values=resolveValues(material.technique,gltfScenegraph);}gltfScenegraph.removeObjectExtension(material,KHR_TECHNIQUES_WEBGL);}}catch(err){_iterator49.e(err);}finally{_iterator49.f();}gltfScenegraph.removeExtension(KHR_TECHNIQUES_WEBGL);}case 4:case"end":return _context54.stop();}},_callee51);}));return _decode$6.apply(this,arguments);}function encode(_x86,_x87){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltfData,options){return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:case"end":return _context55.stop();}},_callee52);}));return _encode.apply(this,arguments);}function resolveTechniques(techniquesExtension,gltfScenegraph){var _techniquesExtension$=techniquesExtension.programs,programs=_techniquesExtension$===void 0?[]:_techniquesExtension$,_techniquesExtension$2=techniquesExtension.shaders,shaders=_techniquesExtension$2===void 0?[]:_techniquesExtension$2,_techniquesExtension$3=techniquesExtension.techniques,techniques=_techniquesExtension$3===void 0?[]:_techniquesExtension$3;var textDecoder=new TextDecoder();shaders.forEach(function(shader){if(Number.isFinite(shader.bufferView)){shader.code=textDecoder.decode(gltfScenegraph.getTypedArrayForBufferView(shader.bufferView));}else{throw new Error('KHR_techniques_webgl: no shader code');}});programs.forEach(function(program){program.fragmentShader=shaders[program.fragmentShader];program.vertexShader=shaders[program.vertexShader];});techniques.forEach(function(technique){technique.program=programs[technique.program];});return techniques;}function resolveValues(technique,gltfScenegraph){var values=Object.assign({},technique.values);Object.keys(technique.uniforms||{}).forEach(function(uniform){if(technique.uniforms[uniform].value&&!(uniform in values)){values[uniform]=technique.uniforms[uniform].value;}});Object.keys(values).forEach(function(uniform){if(_typeof2(values[uniform])==='object'&&values[uniform].index!==undefined){values[uniform].texture=gltfScenegraph.getTexture(values[uniform].index);}});return values;}var KHR_techniques_webgl=/*#__PURE__*/Object.freeze({__proto__:null,name:name$1,decode:decode$1,encode:encode});var EXT_FEATURE_METADATA='EXT_feature_metadata';var name=EXT_FEATURE_METADATA;function decode(_x88){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context56.stop();}},_callee53);}));return _decode.apply(this,arguments);}function decodeExtFeatureMetadata(scenegraph){var _extension$schema;var extension=scenegraph.getExtension(EXT_FEATURE_METADATA);var schemaClasses=extension===null||extension===void 0?void 0:(_extension$schema=extension.schema)===null||_extension$schema===void 0?void 0:_extension$schema.classes;var featureTables=extension===null||extension===void 0?void 0:extension.featureTables;var featureTextures=extension===null||extension===void 0?void 0:extension.featureTextures;if(featureTextures){console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');}if(schemaClasses&&featureTables){for(var schemaName in schemaClasses){var schemaClass=schemaClasses[schemaName];var featureTable=findFeatureTableByName(featureTables,schemaName);if(featureTable){handleFeatureTableProperties(scenegraph,featureTable,schemaClass);}}}}function handleFeatureTableProperties(scenegraph,featureTable,schemaClass){for(var propertyName in schemaClass.properties){var _featureTable$propert;var schemaProperty=schemaClass.properties[propertyName];var featureTableProperty=featureTable===null||featureTable===void 0?void 0:(_featureTable$propert=featureTable.properties)===null||_featureTable$propert===void 0?void 0:_featureTable$propert[propertyName];var numberOfFeatures=featureTable.count;if(featureTableProperty){var data=getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty);featureTableProperty.data=data;}}}function getPropertyDataFromBinarySource(scenegraph,schemaProperty,numberOfFeatures,featureTableProperty){var bufferView=featureTableProperty.bufferView;var data=scenegraph.getTypedArrayForBufferView(bufferView);switch(schemaProperty.type){case'STRING':{var stringOffsetBufferView=featureTableProperty.stringOffsetBufferView;var offsetsData=scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);data=getStringAttributes(data,offsetsData,numberOfFeatures);break;}}return data;}function findFeatureTableByName(featureTables,schemaClassName){for(var featureTableName in featureTables){var featureTable=featureTables[featureTableName];if(featureTable["class"]===schemaClassName){return featureTable;}}return null;}function getStringAttributes(data,offsetsData,stringsCount){var stringsArray=[];var textDecoder=new TextDecoder('utf8');var stringOffset=0;var bytesPerStringSize=4;for(var index=0;index<stringsCount;index++){var stringByteSize=offsetsData[(index+1)*bytesPerStringSize]-offsetsData[index*bytesPerStringSize];var stringData=data.subarray(stringOffset,stringByteSize+stringOffset);var stringAttribute=textDecoder.decode(stringData);stringsArray.push(stringAttribute);stringOffset+=stringByteSize;}return stringsArray;}var EXT_feature_metadata=/*#__PURE__*/Object.freeze({__proto__:null,name:name,decode:decode});var EXTENSIONS=[EXT_meshopt_compression,EXT_texture_webp,KHR_texture_basisu,KHR_draco_mesh_compression,KHR_lights_punctual,KHR_materials_unlit,KHR_techniques_webgl,KHR_texture_transform,EXT_feature_metadata];function preprocessExtensions(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var context=arguments.length>2?arguments[2]:undefined;var extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});var _iterator31=_createForOfIteratorHelper(extensions),_step31;try{for(_iterator31.s();!(_step31=_iterator31.n()).done;){var extension=_step31.value;var _extension$preprocess;(_extension$preprocess=extension.preprocess)===null||_extension$preprocess===void 0?void 0:_extension$preprocess.call(extension,gltf,options,context);}}catch(err){_iterator31.e(err);}finally{_iterator31.f();}}function decodeExtensions(_x89){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf){var options,context,extensions,_iterator50,_step50,extension,_extension$decode,_args50=arguments;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.next){case 0:options=_args50.length>1&&_args50[1]!==undefined?_args50[1]:{};context=_args50.length>2?_args50[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator50=_createForOfIteratorHelper(extensions);_context57.prev=4;_iterator50.s();case 6:if((_step50=_iterator50.n()).done){_context57.next=12;break;}extension=_step50.value;_context57.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context57.next=6;break;case 12:_context57.next=17;break;case 14:_context57.prev=14;_context57.t0=_context57["catch"](4);_iterator50.e(_context57.t0);case 17:_context57.prev=17;_iterator50.f();return _context57.finish(17);case 20:case"end":return _context57.stop();}},_callee54,null,[[4,14,17,20]]);}));return _decodeExtensions.apply(this,arguments);}function useExtension(extensionName,options){var _options$gltf;var excludes=(options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.excludeExtensions)||{};var exclude=extensionName in excludes&&!excludes[extensionName];return!exclude;}var KHR_BINARY_GLTF='KHR_binary_glTF';function preprocess(gltfData){var gltfScenegraph=new GLTFScenegraph(gltfData);var json=gltfScenegraph.json;var _iterator32=_createForOfIteratorHelper(json.images||[]),_step32;try{for(_iterator32.s();!(_step32=_iterator32.n()).done;){var _image6=_step32.value;var extension=gltfScenegraph.getObjectExtension(_image6,KHR_BINARY_GLTF);if(extension){Object.assign(_image6,extension);}gltfScenegraph.removeObjectExtension(_image6,KHR_BINARY_GLTF);}}catch(err){_iterator32.e(err);}finally{_iterator32.f();}if(json.buffers&&json.buffers[0]){delete json.buffers[0].uri;}gltfScenegraph.removeExtension(KHR_BINARY_GLTF);}var GLTF_ARRAYS={accessors:'accessor',animations:'animation',buffers:'buffer',bufferViews:'bufferView',images:'image',materials:'material',meshes:'mesh',nodes:'node',samplers:'sampler',scenes:'scene',skins:'skin',textures:'texture'};var GLTF_KEYS={accessor:'accessors',animations:'animation',buffer:'buffers',bufferView:'bufferViews',image:'images',material:'materials',mesh:'meshes',node:'nodes',sampler:'samplers',scene:'scenes',skin:'skins',texture:'textures'};var GLTFV1Normalizer=/*#__PURE__*/function(){function GLTFV1Normalizer(){_classCallCheck(this,GLTFV1Normalizer);_defineProperty(this,"idToIndexMap",{animations:{},accessors:{},buffers:{},bufferViews:{},images:{},materials:{},meshes:{},nodes:{},samplers:{},scenes:{},skins:{},textures:{}});_defineProperty(this,"json",void 0);}return _createClass(GLTFV1Normalizer,[{key:"normalize",value:function normalize(gltf,options){this.json=gltf.json;var json=gltf.json;switch(json.asset&&json.asset.version){case'2.0':return;case undefined:case'1.0':break;default:console.warn("glTF: Unknown version ".concat(json.asset.version));return;}if(!options.normalize){throw new Error('glTF v1 is not supported.');}console.warn('Converting glTF v1 to glTF v2 format. This is experimental and may fail.');this._addAsset(json);this._convertTopLevelObjectsToArrays(json);preprocess(gltf);this._convertObjectIdsToArrayIndices(json);this._updateObjects(json);this._updateMaterial(json);}},{key:"_addAsset",value:function _addAsset(json){json.asset=json.asset||{};json.asset.version='2.0';json.asset.generator=json.asset.generator||'Normalized to glTF 2.0 by loaders.gl';}},{key:"_convertTopLevelObjectsToArrays",value:function _convertTopLevelObjectsToArrays(json){for(var arrayName in GLTF_ARRAYS){this._convertTopLevelObjectToArray(json,arrayName);}}},{key:"_convertTopLevelObjectToArray",value:function _convertTopLevelObjectToArray(json,mapName){var objectMap=json[mapName];if(!objectMap||Array.isArray(objectMap)){return;}json[mapName]=[];for(var id in objectMap){var object=objectMap[id];object.id=object.id||id;var index=json[mapName].length;json[mapName].push(object);this.idToIndexMap[mapName][id]=index;}}},{key:"_convertObjectIdsToArrayIndices",value:function _convertObjectIdsToArrayIndices(json){for(var arrayName in GLTF_ARRAYS){this._convertIdsToIndices(json,arrayName);}if('scene'in json){json.scene=this._convertIdToIndex(json.scene,'scene');}var _iterator33=_createForOfIteratorHelper(json.textures),_step33;try{for(_iterator33.s();!(_step33=_iterator33.n()).done;){var texture=_step33.value;this._convertTextureIds(texture);}}catch(err){_iterator33.e(err);}finally{_iterator33.f();}var _iterator34=_createForOfIteratorHelper(json.meshes),_step34;try{for(_iterator34.s();!(_step34=_iterator34.n()).done;){var _mesh7=_step34.value;this._convertMeshIds(_mesh7);}}catch(err){_iterator34.e(err);}finally{_iterator34.f();}var _iterator35=_createForOfIteratorHelper(json.nodes),_step35;try{for(_iterator35.s();!(_step35=_iterator35.n()).done;){var _node4=_step35.value;this._convertNodeIds(_node4);}}catch(err){_iterator35.e(err);}finally{_iterator35.f();}var _iterator36=_createForOfIteratorHelper(json.scenes),_step36;try{for(_iterator36.s();!(_step36=_iterator36.n()).done;){var _node5=_step36.value;this._convertSceneIds(_node5);}}catch(err){_iterator36.e(err);}finally{_iterator36.f();}}},{key:"_convertTextureIds",value:function _convertTextureIds(texture){if(texture.source){texture.source=this._convertIdToIndex(texture.source,'image');}}},{key:"_convertMeshIds",value:function _convertMeshIds(mesh){var _iterator37=_createForOfIteratorHelper(mesh.primitives),_step37;try{for(_iterator37.s();!(_step37=_iterator37.n()).done;){var _primitive4=_step37.value;var attributes=_primitive4.attributes,indices=_primitive4.indices,material=_primitive4.material;for(var attributeName in attributes){attributes[attributeName]=this._convertIdToIndex(attributes[attributeName],'accessor');}if(indices){_primitive4.indices=this._convertIdToIndex(indices,'accessor');}if(material){_primitive4.material=this._convertIdToIndex(material,'material');}}}catch(err){_iterator37.e(err);}finally{_iterator37.f();}}},{key:"_convertNodeIds",value:function _convertNodeIds(node){var _this130=this;if(node.children){node.children=node.children.map(function(child){return _this130._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this130._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this131=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this131._convertIdToIndex(node,'node');});}}},{key:"_convertIdsToIndices",value:function _convertIdsToIndices(json,topLevelArrayName){if(!json[topLevelArrayName]){console.warn("gltf v1: json doesn't contain attribute ".concat(topLevelArrayName));json[topLevelArrayName]=[];}var _iterator38=_createForOfIteratorHelper(json[topLevelArrayName]),_step38;try{for(_iterator38.s();!(_step38=_iterator38.n()).done;){var object=_step38.value;for(var key in object){var id=object[key];var index=this._convertIdToIndex(id,key);object[key]=index;}}}catch(err){_iterator38.e(err);}finally{_iterator38.f();}}},{key:"_convertIdToIndex",value:function _convertIdToIndex(id,key){var arrayName=GLTF_KEYS[key];if(arrayName in this.idToIndexMap){var index=this.idToIndexMap[arrayName][id];if(!Number.isFinite(index)){throw new Error("gltf v1: failed to resolve ".concat(key," with id ").concat(id));}return index;}return id;}},{key:"_updateObjects",value:function _updateObjects(json){var _iterator39=_createForOfIteratorHelper(this.json.buffers),_step39;try{for(_iterator39.s();!(_step39=_iterator39.n()).done;){var buffer=_step39.value;delete buffer.type;}}catch(err){_iterator39.e(err);}finally{_iterator39.f();}}},{key:"_updateMaterial",value:function _updateMaterial(json){var _iterator40=_createForOfIteratorHelper(json.materials),_step40;try{var _loop4=function _loop4(){var material=_step40.value;material.pbrMetallicRoughness={baseColorFactor:[1,1,1,1],metallicFactor:1,roughnessFactor:1};var textureId=((_material$values=material.values)===null||_material$values===void 0?void 0:_material$values.tex)||((_material$values2=material.values)===null||_material$values2===void 0?void 0:_material$values2.texture2d_0)||((_material$values3=material.values)===null||_material$values3===void 0?void 0:_material$values3.diffuseTex);var textureIndex=json.textures.findIndex(function(texture){return texture.id===textureId;});if(textureIndex!==-1){material.pbrMetallicRoughness.baseColorTexture={index:textureIndex};}},_material$values,_material$values2,_material$values3;for(_iterator40.s();!(_step40=_iterator40.n()).done;){_loop4();}}catch(err){_iterator40.e(err);}finally{_iterator40.f();}}}]);}();function normalizeGLTFV1(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return new GLTFV1Normalizer().normalize(gltf,options);}var COMPONENTS={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16};var BYTES={5120:1,5121:1,5122:2,5123:2,5125:4,5126:4};var GL_SAMPLER={TEXTURE_MAG_FILTER:0x2800,TEXTURE_MIN_FILTER:0x2801,TEXTURE_WRAP_S:0x2802,TEXTURE_WRAP_T:0x2803,REPEAT:0x2901,LINEAR:0x2601,NEAREST_MIPMAP_LINEAR:0x2702};var SAMPLER_PARAMETER_GLTF_TO_GL={magFilter:GL_SAMPLER.TEXTURE_MAG_FILTER,minFilter:GL_SAMPLER.TEXTURE_MIN_FILTER,wrapS:GL_SAMPLER.TEXTURE_WRAP_S,wrapT:GL_SAMPLER.TEXTURE_WRAP_T};var DEFAULT_SAMPLER=_defineProperty2(_defineProperty2(_defineProperty2(_defineProperty2({},GL_SAMPLER.TEXTURE_MAG_FILTER,GL_SAMPLER.LINEAR),GL_SAMPLER.TEXTURE_MIN_FILTER,GL_SAMPLER.NEAREST_MIPMAP_LINEAR),GL_SAMPLER.TEXTURE_WRAP_S,GL_SAMPLER.REPEAT),GL_SAMPLER.TEXTURE_WRAP_T,GL_SAMPLER.REPEAT);function getBytesFromComponentType(componentType){return BYTES[componentType];}function getSizeFromAccessorType(type){return COMPONENTS[type];}var GLTFPostProcessor=/*#__PURE__*/function(){function GLTFPostProcessor(){_classCallCheck(this,GLTFPostProcessor);_defineProperty(this,"baseUri",'');_defineProperty(this,"json",{});_defineProperty(this,"buffers",[]);_defineProperty(this,"images",[]);}return _createClass(GLTFPostProcessor,[{key:"postProcess",value:function postProcess(gltf){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var json=gltf.json,_gltf$buffers=gltf.buffers,buffers=_gltf$buffers===void 0?[]:_gltf$buffers,_gltf$images=gltf.images,images=_gltf$images===void 0?[]:_gltf$images,_gltf$baseUri=gltf.baseUri,baseUri=_gltf$baseUri===void 0?'':_gltf$baseUri;assert$3(json);this.baseUri=baseUri;this.json=json;this.buffers=buffers;this.images=images;this._resolveTree(this.json,options);return this.json;}},{key:"_resolveTree",value:function _resolveTree(json){var _this132=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this132._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this132._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this132._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this132._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this132._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this132._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this132._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this132._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this132._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this132._resolveScene(scene,i);});}if(json.scene!==undefined){json.scene=json.scenes[this.json.scene];}}},{key:"getScene",value:function getScene(index){return this._get('scenes',index);}},{key:"getNode",value:function getNode(index){return this._get('nodes',index);}},{key:"getSkin",value:function getSkin(index){return this._get('skins',index);}},{key:"getMesh",value:function getMesh(index){return this._get('meshes',index);}},{key:"getMaterial",value:function getMaterial(index){return this._get('materials',index);}},{key:"getAccessor",value:function getAccessor(index){return this._get('accessors',index);}},{key:"getCamera",value:function getCamera(index){return null;}},{key:"getTexture",value:function getTexture(index){return this._get('textures',index);}},{key:"getSampler",value:function getSampler(index){return this._get('samplers',index);}},{key:"getImage",value:function getImage(index){return this._get('images',index);}},{key:"getBufferView",value:function getBufferView(index){return this._get('bufferViews',index);}},{key:"getBuffer",value:function getBuffer(index){return this._get('buffers',index);}},{key:"_get",value:function _get(array,index){if(_typeof2(index)==='object'){return index;}var object=this.json[array]&&this.json[array][index];if(!object){console.warn("glTF file error: Could not find ".concat(array,"[").concat(index,"]"));}return object;}},{key:"_resolveScene",value:function _resolveScene(scene,index){var _this133=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this133.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this134=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this134.getNode(child);});}if(node.mesh!==undefined){node.mesh=this.getMesh(node.mesh);}else if(node.meshes!==undefined&&node.meshes.length){node.mesh=node.meshes.reduce(function(accum,meshIndex){var mesh=_this134.getMesh(meshIndex);accum.id=mesh.id;accum.primitives=accum.primitives.concat(mesh.primitives);return accum;},{primitives:[]});}if(node.camera!==undefined){node.camera=this.getCamera(node.camera);}if(node.skin!==undefined){node.skin=this.getSkin(node.skin);}return node;}},{key:"_resolveSkin",value:function _resolveSkin(skin,index){skin.id=skin.id||"skin-".concat(index);skin.inverseBindMatrices=this.getAccessor(skin.inverseBindMatrices);return skin;}},{key:"_resolveMesh",value:function _resolveMesh(mesh,index){var _this135=this;mesh.id=mesh.id||"mesh-".concat(index);if(mesh.primitives){mesh.primitives=mesh.primitives.map(function(primitive){primitive=_objectSpread({},primitive);var attributes=primitive.attributes;primitive.attributes={};for(var attribute in attributes){primitive.attributes[attribute]=_this135.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this135.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this135.getMaterial(primitive.material);}return primitive;});}return mesh;}},{key:"_resolveMaterial",value:function _resolveMaterial(material,index){material.id=material.id||"material-".concat(index);if(material.normalTexture){material.normalTexture=_objectSpread({},material.normalTexture);material.normalTexture.texture=this.getTexture(material.normalTexture.index);}if(material.occlusionTexture){material.occlustionTexture=_objectSpread({},material.occlustionTexture);material.occlusionTexture.texture=this.getTexture(material.occlusionTexture.index);}if(material.emissiveTexture){material.emmisiveTexture=_objectSpread({},material.emmisiveTexture);material.emissiveTexture.texture=this.getTexture(material.emissiveTexture.index);}if(!material.emissiveFactor){material.emissiveFactor=material.emmisiveTexture?[1,1,1]:[0,0,0];}if(material.pbrMetallicRoughness){material.pbrMetallicRoughness=_objectSpread({},material.pbrMetallicRoughness);var mr=material.pbrMetallicRoughness;if(mr.baseColorTexture){mr.baseColorTexture=_objectSpread({},mr.baseColorTexture);mr.baseColorTexture.texture=this.getTexture(mr.baseColorTexture.index);}if(mr.metallicRoughnessTexture){mr.metallicRoughnessTexture=_objectSpread({},mr.metallicRoughnessTexture);mr.metallicRoughnessTexture.texture=this.getTexture(mr.metallicRoughnessTexture.index);}}return material;}},{key:"_resolveAccessor",value:function _resolveAccessor(accessor,index){accessor.id=accessor.id||"accessor-".concat(index);if(accessor.bufferView!==undefined){accessor.bufferView=this.getBufferView(accessor.bufferView);}accessor.bytesPerComponent=getBytesFromComponentType(accessor.componentType);accessor.components=getSizeFromAccessorType(accessor.type);accessor.bytesPerElement=accessor.bytesPerComponent*accessor.components;if(accessor.bufferView){var buffer=accessor.bufferView.buffer;var _getAccessorArrayType3=getAccessorArrayTypeAndLength(accessor,accessor.bufferView),ArrayType=_getAccessorArrayType3.ArrayType,byteLength=_getAccessorArrayType3.byteLength;var byteOffset=(accessor.bufferView.byteOffset||0)+(accessor.byteOffset||0)+buffer.byteOffset;var cutBuffer=buffer.arrayBuffer.slice(byteOffset,byteOffset+byteLength);if(accessor.bufferView.byteStride){cutBuffer=this._getValueFromInterleavedBuffer(buffer,byteOffset,accessor.bufferView.byteStride,accessor.bytesPerElement,accessor.count);}accessor.value=new ArrayType(cutBuffer);}return accessor;}},{key:"_getValueFromInterleavedBuffer",value:function _getValueFromInterleavedBuffer(buffer,byteOffset,byteStride,bytesPerElement,count){var result=new Uint8Array(count*bytesPerElement);for(var _i557=0;_i557<count;_i557++){var elementOffset=byteOffset+_i557*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i557*bytesPerElement);}return result.buffer;}},{key:"_resolveTexture",value:function _resolveTexture(texture,index){texture.id=texture.id||"texture-".concat(index);texture.sampler='sampler'in texture?this.getSampler(texture.sampler):DEFAULT_SAMPLER;texture.source=this.getImage(texture.source);return texture;}},{key:"_resolveSampler",value:function _resolveSampler(sampler,index){sampler.id=sampler.id||"sampler-".concat(index);sampler.parameters={};for(var key in sampler){var glEnum=this._enumSamplerParameter(key);if(glEnum!==undefined){sampler.parameters[glEnum]=sampler[key];}}return sampler;}},{key:"_enumSamplerParameter",value:function _enumSamplerParameter(key){return SAMPLER_PARAMETER_GLTF_TO_GL[key];}},{key:"_resolveImage",value:function _resolveImage(image,index){image.id=image.id||"image-".concat(index);if(image.bufferView!==undefined){image.bufferView=this.getBufferView(image.bufferView);}var preloadedImage=this.images[index];if(preloadedImage){image.image=preloadedImage;}return image;}},{key:"_resolveBufferView",value:function _resolveBufferView(bufferView,index){var bufferIndex=bufferView.buffer;var result=_objectSpread(_objectSpread({id:"bufferView-".concat(index)},bufferView),{},{buffer:this.buffers[bufferIndex]});var arrayBuffer=this.buffers[bufferIndex].arrayBuffer;var byteOffset=this.buffers[bufferIndex].byteOffset||0;if('byteOffset'in bufferView){byteOffset+=bufferView.byteOffset;}result.data=new Uint8Array(arrayBuffer,byteOffset,bufferView.byteLength);return result;}},{key:"_resolveCamera",value:function _resolveCamera(camera,index){camera.id=camera.id||"camera-".concat(index);if(camera.perspective);if(camera.orthographic);return camera;}}]);}();function postProcessGLTF(gltf,options){return new GLTFPostProcessor().postProcess(gltf,options);}var MAGIC_glTF=0x676c5446;var GLB_FILE_HEADER_SIZE=12;var GLB_CHUNK_HEADER_SIZE=8;var GLB_CHUNK_TYPE_JSON=0x4e4f534a;var GLB_CHUNK_TYPE_BIN=0x004e4942;var GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED=0;var GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED=1;var GLB_V1_CONTENT_FORMAT_JSON=0x0;var LE=true;function getMagicString(dataView){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;return"".concat(String.fromCharCode(dataView.getUint8(byteOffset+0))).concat(String.fromCharCode(dataView.getUint8(byteOffset+1))).concat(String.fromCharCode(dataView.getUint8(byteOffset+2))).concat(String.fromCharCode(dataView.getUint8(byteOffset+3)));}function isGLB(arrayBuffer){var byteOffset=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var options=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};var dataView=new DataView(arrayBuffer);var _options$magic=options.magic,magic=_options$magic===void 0?MAGIC_glTF:_options$magic;var magic1=dataView.getUint32(byteOffset,false);return magic1===magic||magic1===MAGIC_glTF;}function parseGLBSync(glb,arrayBuffer){var byteOffset=arguments.length>2&&arguments[2]!==undefined?arguments[2]:0;var dataView=new DataView(arrayBuffer);var type=getMagicString(dataView,byteOffset+0);var version=dataView.getUint32(byteOffset+4,LE);var byteLength=dataView.getUint32(byteOffset+8,LE);Object.assign(glb,{header:{byteOffset:byteOffset,byteLength:byteLength,hasBinChunk:false},type:type,version:version,json:{},binChunks:[]});byteOffset+=GLB_FILE_HEADER_SIZE;switch(glb.version){case 1:return parseGLBV1(glb,dataView,byteOffset);case 2:return parseGLBV2(glb,dataView,byteOffset,{});default:throw new Error("Invalid GLB version ".concat(glb.version,". Only supports v1 and v2."));}}function parseGLBV1(glb,dataView,byteOffset){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);var contentLength=dataView.getUint32(byteOffset+0,LE);var contentFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;assert$4(contentFormat===GLB_V1_CONTENT_FORMAT_JSON);parseJSONChunk(glb,dataView,byteOffset,contentLength);byteOffset+=contentLength;byteOffset+=parseBINChunk(glb,dataView,byteOffset,glb.header.byteLength);return byteOffset;}function parseGLBV2(glb,dataView,byteOffset,options){assert$4(glb.header.byteLength>GLB_FILE_HEADER_SIZE+GLB_CHUNK_HEADER_SIZE);parseGLBChunksSync(glb,dataView,byteOffset,options);return byteOffset+glb.header.byteLength;}function parseGLBChunksSync(glb,dataView,byteOffset,options){while(byteOffset+8<=glb.header.byteLength){var chunkLength=dataView.getUint32(byteOffset+0,LE);var chunkFormat=dataView.getUint32(byteOffset+4,LE);byteOffset+=GLB_CHUNK_HEADER_SIZE;switch(chunkFormat){case GLB_CHUNK_TYPE_JSON:parseJSONChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_BIN:parseBINChunk(glb,dataView,byteOffset,chunkLength);break;case GLB_CHUNK_TYPE_JSON_XVIZ_DEPRECATED:if(!options.strict){parseJSONChunk(glb,dataView,byteOffset,chunkLength);}break;case GLB_CHUNK_TYPE_BIX_XVIZ_DEPRECATED:if(!options.strict){parseBINChunk(glb,dataView,byteOffset,chunkLength);}break;}byteOffset+=padToNBytes(chunkLength,4);}return byteOffset;}function parseJSONChunk(glb,dataView,byteOffset,chunkLength){var jsonChunk=new Uint8Array(dataView.buffer,byteOffset,chunkLength);var textDecoder=new TextDecoder('utf8');var jsonText=textDecoder.decode(jsonChunk);glb.json=JSON.parse(jsonText);return padToNBytes(chunkLength,4);}function parseBINChunk(glb,dataView,byteOffset,chunkLength){glb.header.hasBinChunk=true;glb.binChunks.push({byteOffset:byteOffset,byteLength:chunkLength,arrayBuffer:dataView.buffer});return padToNBytes(chunkLength,4);}function parseGLTF$1(_x90,_x91){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args51=arguments;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:byteOffset=_args51.length>2&&_args51[2]!==undefined?_args51[2]:0;options=_args51.length>3?_args51[3]:undefined;context=_args51.length>4?_args51[4]:undefined;parseGLTFContainerSync(gltf,arrayBufferOrString,byteOffset,options);normalizeGLTFV1(gltf,{normalize:options===null||options===void 0?void 0:(_options$gltf=options.gltf)===null||_options$gltf===void 0?void 0:_options$gltf.normalize});preprocessExtensions(gltf,options,context);promises=[];if(!(options!==null&&options!==void 0&&(_options$gltf2=options.gltf)!==null&&_options$gltf2!==void 0&&_options$gltf2.loadBuffers&&gltf.json.buffers)){_context58.next=10;break;}_context58.next=10;return loadBuffers(gltf,options,context);case 10:if(options!==null&&options!==void 0&&(_options$gltf3=options.gltf)!==null&&_options$gltf3!==void 0&&_options$gltf3.loadImages){_promise=loadImages(gltf,options,context);promises.push(_promise);}promise=decodeExtensions(gltf,options,context);promises.push(promise);_context58.next=15;return Promise.all(promises);case 15:return _context58.abrupt("return",options!==null&&options!==void 0&&(_options$gltf4=options.gltf)!==null&&_options$gltf4!==void 0&&_options$gltf4.postProcess?postProcessGLTF(gltf,options):gltf);case 16:case"end":return _context58.stop();}},_callee55);}));return _parseGLTF$.apply(this,arguments);}function parseGLTFContainerSync(gltf,data,byteOffset,options){if(options.uri){gltf.baseUri=options.uri;}if(data instanceof ArrayBuffer&&!isGLB(data,byteOffset,options)){var textDecoder=new TextDecoder();data=textDecoder.decode(data);}if(typeof data==='string'){gltf.json=parseJSON(data);}else if(data instanceof ArrayBuffer){var glb={};byteOffset=parseGLBSync(glb,data,byteOffset,options.glb);assert$3(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$3(false,'GLTF: must be ArrayBuffer or string');}var buffers=gltf.json.buffers||[];gltf.buffers=new Array(buffers.length).fill(null);if(gltf._glb&&gltf._glb.header.hasBinChunk){var binChunks=gltf._glb.binChunks;gltf.buffers[0]={arrayBuffer:binChunks[0].arrayBuffer,byteOffset:binChunks[0].byteOffset,byteLength:binChunks[0].byteLength};}var images=gltf.json.images||[];gltf.images=new Array(images.length).fill({});}function loadBuffers(_x92,_x93,_x94){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(gltf,options,context){var buffers,_i639,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee56$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:buffers=gltf.json.buffers||[];_i639=0;case 2:if(!(_i639<buffers.length)){_context59.next=22;break;}buffer=buffers[_i639];if(!buffer.uri){_context59.next=18;break;}_fetch=context.fetch;assert$3(_fetch);uri=resolveUrl(buffer.uri,options);_context59.next=10;return context===null||context===void 0?void 0:(_context$fetch=context.fetch)===null||_context$fetch===void 0?void 0:_context$fetch.call(context,uri);case 10:response=_context59.sent;_context59.next=13;return response===null||response===void 0?void 0:(_response$arrayBuffer=response.arrayBuffer)===null||_response$arrayBuffer===void 0?void 0:_response$arrayBuffer.call(response);case 13:arrayBuffer=_context59.sent;gltf.buffers[_i639]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context59.next=19;break;case 18:if(gltf.buffers[_i639]===null){gltf.buffers[_i639]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i639;_context59.next=2;break;case 22:case"end":return _context59.stop();}},_callee56);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x95,_x96,_x97){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee57(gltf,options,context){var imageIndices,images,promises,_iterator51,_step51,imageIndex;return _regeneratorRuntime().wrap(function _callee57$(_context60){while(1)switch(_context60.prev=_context60.next){case 0:imageIndices=getReferencesImageIndices(gltf);images=gltf.json.images||[];promises=[];_iterator51=_createForOfIteratorHelper(imageIndices);try{for(_iterator51.s();!(_step51=_iterator51.n()).done;){imageIndex=_step51.value;promises.push(loadImage(gltf,images[imageIndex],imageIndex,options,context));}}catch(err){_iterator51.e(err);}finally{_iterator51.f();}_context60.next=7;return Promise.all(promises);case 7:return _context60.abrupt("return",_context60.sent);case 8:case"end":return _context60.stop();}},_callee57);}));return _loadImages.apply(this,arguments);}function getReferencesImageIndices(gltf){var imageIndices=new Set();var textures=gltf.json.textures||[];var _iterator41=_createForOfIteratorHelper(textures),_step41;try{for(_iterator41.s();!(_step41=_iterator41.n()).done;){var texture=_step41.value;if(texture.source!==undefined){imageIndices.add(texture.source);}}}catch(err){_iterator41.e(err);}finally{_iterator41.f();}return Array.from(imageIndices).sort();}function loadImage(_x98,_x99,_x100,_x101,_x102){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee58$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context61.next=10;break;}uri=resolveUrl(image.uri,options);_context61.next=5;return fetch(uri);case 5:response=_context61.sent;_context61.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context61.sent;image.bufferView={data:arrayBuffer};case 10:if(Number.isFinite(image.bufferView)){array=getTypedArrayForBufferView(gltf.json,gltf.buffers,image.bufferView);arrayBuffer=sliceArrayBuffer(array.buffer,array.byteOffset,array.byteLength);}assert$3(arrayBuffer,'glTF image has no data');_context61.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context61.sent;if(parsedImage&&parsedImage[0]){parsedImage={compressed:true,mipmaps:false,width:parsedImage[0].width,height:parsedImage[0].height,data:parsedImage[0]};}gltf.images=gltf.images||[];gltf.images[index]=parsedImage;case 18:case"end":return _context61.stop();}},_callee58);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$7,extensions:['gltf','glb'],mimeTypes:['model/gltf+json','model/gltf-binary'],text:true,binary:true,tests:['glTF'],parse:parse,options:{gltf:{normalize:true,loadBuffers:true,loadImages:true,decompressMeshes:true,postProcess:true},log:console},deprecatedOptions:{fetchImages:'gltf.loadImages',createImages:'gltf.loadImages',decompress:'gltf.decompressMeshes',postProcess:'gltf.postProcess',gltf:{decompress:'gltf.decompressMeshes'}}};function parse(_x103){return _parse.apply(this,arguments);}/**
24958
25214
  * @private
24959
- */function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee58(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args54=arguments;return _regeneratorRuntime().wrap(function _callee58$(_context61){while(1)switch(_context61.prev=_context61.next){case 0:options=_args54.length>1&&_args54[1]!==undefined?_args54[1]:{};context=_args54.length>2?_args54[2]:undefined;options=_objectSpread(_objectSpread({},GLTFLoader.options),options);options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context61.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context61.abrupt("return",_context61.sent);case 9:case"end":return _context61.stop();}},_callee58);}));return _parse.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}return _createClass(GLTFSceneModelLoader,[{key:"load",value:function load(plugin,src,metaModelJSON,options,sceneModel,ok,error){options=options||{};loadGLTF(plugin,src,metaModelJSON,options,sceneModel,function(){core.scheduleTask(function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
25215
+ */function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee59(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args55=arguments;return _regeneratorRuntime().wrap(function _callee59$(_context62){while(1)switch(_context62.prev=_context62.next){case 0:options=_args55.length>1&&_args55[1]!==undefined?_args55[1]:{};context=_args55.length>2?_args55[2]:undefined;options=_objectSpread(_objectSpread({},GLTFLoader.options),options);options.gltf=_objectSpread(_objectSpread({},GLTFLoader.options.gltf),options.gltf);_options2=options,_options2$byteOffset=_options2.byteOffset,byteOffset=_options2$byteOffset===void 0?0:_options2$byteOffset;gltf={};_context62.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context62.abrupt("return",_context62.sent);case 9:case"end":return _context62.stop();}},_callee59);}));return _parse.apply(this,arguments);}var GLTFSceneModelLoader=/*#__PURE__*/function(){function GLTFSceneModelLoader(cfg){_classCallCheck(this,GLTFSceneModelLoader);}return _createClass(GLTFSceneModelLoader,[{key:"load",value:function load(plugin,src,metaModelJSON,options,sceneModel,ok,error){options=options||{};loadGLTF(plugin,src,metaModelJSON,options,sceneModel,function(){core.scheduleTask(function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
24960
25216
  sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.error(msg);if(error){error(msg);}sceneModel.fire("error",msg);});}},{key:"parse",value:function parse(plugin,gltf,metaModelJSON,options,sceneModel,ok,error){options=options||{};parseGLTF(plugin,"",gltf,metaModelJSON,options,sceneModel,function(){sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
24961
25217
  sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);}();function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split(".").pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
24962
25218
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
@@ -25148,7 +25404,7 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25148
25404
  * });
25149
25405
  * ````
25150
25406
  * @class GLTFLoaderPlugin
25151
- */var GLTFLoaderPlugin=/*#__PURE__*/function(_Plugin6){/**
25407
+ */var GLTFLoaderPlugin=/*#__PURE__*/function(_Plugin7){/**
25152
25408
  * @constructor
25153
25409
  *
25154
25410
  * @param {Viewer} viewer The Viewer.
@@ -25156,13 +25412,13 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25156
25412
  * @param {String} [cfg.id="GLTFLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
25157
25413
  * @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
25158
25414
  * @param {Object} [cfg.dataSource] A custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments. Defaults to an instance of {@link GLTFDefaultDataSource}, which loads over HTTP.
25159
- */function GLTFLoaderPlugin(viewer){var _this135;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,GLTFLoaderPlugin);_this135=_callSuper(this,GLTFLoaderPlugin,["GLTFLoader",viewer,cfg]);_this135._sceneModelLoader=new GLTFSceneModelLoader(_this135,cfg);_this135.dataSource=cfg.dataSource;_this135.objectDefaults=cfg.objectDefaults;return _this135;}/**
25415
+ */function GLTFLoaderPlugin(viewer){var _this136;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,GLTFLoaderPlugin);_this136=_callSuper(this,GLTFLoaderPlugin,["GLTFLoader",viewer,cfg]);_this136._sceneModelLoader=new GLTFSceneModelLoader(_this136,cfg);_this136.dataSource=cfg.dataSource;_this136.objectDefaults=cfg.objectDefaults;return _this136;}/**
25160
25416
  * Sets a custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.
25161
25417
  *
25162
25418
  * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.
25163
25419
  *
25164
25420
  * @type {Object}
25165
- */_inherits(GLTFLoaderPlugin,_Plugin6);return _createClass(GLTFLoaderPlugin,[{key:"dataSource",get:/**
25421
+ */_inherits(GLTFLoaderPlugin,_Plugin7);return _createClass(GLTFLoaderPlugin,[{key:"dataSource",get:/**
25166
25422
  * Gets the custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.
25167
25423
  *
25168
25424
  * Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.
@@ -25199,6 +25455,7 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25199
25455
  * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) is enabled for the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````
25200
25456
  * @param {Boolean} [params.pbrEnabled=true] Indicates if physically-based rendering (PBR) is enabled for the model. Overrides ````colorTextureEnabled````. Only works when {@link Scene#pbrEnabled} is also ````true````.
25201
25457
  * @param {Boolean} [params.colorTextureEnabled=true] Indicates if base color texture rendering is enabled for the model. Overridden by ````pbrEnabled````. Only works when {@link Scene#colorTextureEnabled} is also ````true````.
25458
+ * @param {Number} [params.brightness=1.0] Brightness factor applied to the model's base vertex color on finalize. A value > 1 brightens the model (e.g. ````1.4```` to compensate for texture double-multiplication on GLB files), < 1 darkens. Only affects this model, not the whole scene.
25202
25459
  * @param {Boolean} [params.backfaces=true] When true, always show backfaces, even on objects for which the glTF material is single-sided. When false, only show backfaces on geometries whenever the glTF material is double-sided.
25203
25460
  * @param {Number} [params.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
25204
25461
  * @param {Boolean} [params.dtxEnabled=true] When ````true```` (default) use data textures (DTX), where appropriate, to
@@ -25208,9 +25465,9 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
25208
25465
  * @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
25209
25466
  * @param {Boolean} [params.globalizeObjectIds=false] Indicates whether to globalize each {@link Entity#id} and {@link MetaObject#id}, in case you need to prevent ID clashes with other models.
25210
25467
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
25211
- */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this136=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
25468
+ */,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this137=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
25212
25469
  if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");return sceneModel;// Return new empty model
25213
- }if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){_this136.viewer.metaScene.createMetaModel(modelId,metaModelJSON,{});_this136.viewer.scene.canvas.spinner.processes--;if(params.src){_this136._sceneModelLoader.load(_this136,params.src,metaModelJSON,params,sceneModel);}else{_this136._sceneModelLoader.parse(_this136,params.gltf,metaModelJSON,params,sceneModel);}};if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getMetaModel(metaModelSrc,function(metaModelJSON){_this136.viewer.scene.canvas.spinner.processes--;processMetaModelJSON(metaModelJSON);},function(errMsg){_this136.error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));_this136.viewer.scene.canvas.spinner.processes--;});}else if(params.metaModelJSON){processMetaModelJSON(params.metaModelJSON);}}else{if(params.src){this._sceneModelLoader.load(this,params.src,null,params,sceneModel);}else{this._sceneModelLoader.parse(this,params.gltf,null,params,sceneModel);}}sceneModel.once("destroyed",function(){_this136.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
25470
+ }if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){_this137.viewer.metaScene.createMetaModel(modelId,metaModelJSON,{});_this137.viewer.scene.canvas.spinner.processes--;if(params.src){_this137._sceneModelLoader.load(_this137,params.src,metaModelJSON,params,sceneModel);}else{_this137._sceneModelLoader.parse(_this137,params.gltf,metaModelJSON,params,sceneModel);}};if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getMetaModel(metaModelSrc,function(metaModelJSON){_this137.viewer.scene.canvas.spinner.processes--;processMetaModelJSON(metaModelJSON);},function(errMsg){_this137.error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));_this137.viewer.scene.canvas.spinner.processes--;});}else if(params.metaModelJSON){processMetaModelJSON(params.metaModelJSON);}}else{if(params.src){this._sceneModelLoader.load(this,params.src,null,params,sceneModel);}else{this._sceneModelLoader.parse(this,params.gltf,null,params,sceneModel);}}sceneModel.once("destroyed",function(){_this137.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
25214
25471
  * Destroys this GLTFLoaderPlugin.
25215
25472
  */},{key:"destroy",value:function destroy(){_superPropGet(GLTFLoaderPlugin,"destroy",this,3)([]);}}]);}(Plugin);/**
25216
25473
  * @private
@@ -25314,7 +25571,7 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
25314
25571
  * edges: true
25315
25572
  * });
25316
25573
  * ````
25317
- */var NavCubePlugin=/*#__PURE__*/function(_Plugin7){/**
25574
+ */var NavCubePlugin=/*#__PURE__*/function(_Plugin8){/**
25318
25575
  * @constructor
25319
25576
  * @param {Viewer} viewer The {@link Viewer}.
25320
25577
  * @param {Object} cfg NavCubePlugin configuration.
@@ -25341,14 +25598,14 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
25341
25598
  * @param {Boolean} [cfg.synchProjection=false] Sets whether the NavCube switches between perspective and orthographic projections in synchrony with the {@link Camera}. When ````false````, the NavCube will always be rendered with perspective projection.
25342
25599
  * @param {Boolean} [cfg.isProjectNorth] sets whether the NavCube switches between true north and project north - using the project north offset angle.
25343
25600
  * @param {number} [cfg.projectNorthOffsetAngle] sets the NavCube project north offset angle - when the {@link isProjectNorth} is true.
25344
- */function NavCubePlugin(viewer){var _this137;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this137=_callSuper(this,NavCubePlugin,["NavCube",viewer,cfg]);viewer.navCube=_this137;var visible=true;try{_this137._navCubeScene=new Scene(viewer,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,transparent:true,spinnerElementId:"navcube_spinner",edgesEnabled:true,contextAttr:{antialias:true},resolutionScale:window.devicePixelRatio,worldAxis:viewer.scene.camera.worldAxis});_this137._navCubeCanvas=_this137._navCubeScene.canvas.canvas;_this137._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
25345
- }catch(error){_this137.error(error);return _possibleConstructorReturn(_this137);}var navCubeScene=_this137._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:0.8,space:"view"});_this137._navCubeCamera=navCubeScene.camera;_this137._navCubeCamera.ortho.scale=7.0;_this137._navCubeCamera.ortho.near=0.1;_this137._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
25346
- navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this137._zUp=Boolean(viewer.camera.zUp);var self=_this137;_this137.mousedown=false;_this137.mouseover=false;_this137.setIsProjectNorth(cfg.isProjectNorth);_this137.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this137.rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();return function(dir,vec,dest){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,dest);};}();var viewerNormalUp=false;viewer.scene.on("aabb",function(){viewerNormalUp=viewer.scene.camera.normalUp;});_this137._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._isProjectNorth&&self._projectNorthOffsetAngle){eyeLookVec=rotateTrueNorth(-1,eyeLookVec,tempVec3a$1);up=rotateTrueNorth(-1,up,tempVec3b);}if(self._zUp){// +Z up
25601
+ */function NavCubePlugin(viewer){var _this138;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this138=_callSuper(this,NavCubePlugin,["NavCube",viewer,cfg]);viewer.navCube=_this138;var visible=true;try{_this138._navCubeScene=new Scene(viewer,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,transparent:true,spinnerElementId:"navcube_spinner",edgesEnabled:true,contextAttr:{antialias:true},resolutionScale:window.devicePixelRatio,worldAxis:viewer.scene.camera.worldAxis});_this138._navCubeCanvas=_this138._navCubeScene.canvas.canvas;_this138._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
25602
+ }catch(error){_this138.error(error);return _possibleConstructorReturn(_this138);}var navCubeScene=_this138._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:0.8,space:"view"});_this138._navCubeCamera=navCubeScene.camera;_this138._navCubeCamera.ortho.scale=7.0;_this138._navCubeCamera.ortho.near=0.1;_this138._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
25603
+ navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this138._zUp=Boolean(viewer.camera.zUp);var self=_this138;_this138.mousedown=false;_this138.mouseover=false;_this138.setIsProjectNorth(cfg.isProjectNorth);_this138.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this138.rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();return function(dir,vec,dest){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,dest);};}();var viewerNormalUp=false;viewer.scene.on("aabb",function(){viewerNormalUp=viewer.scene.camera.normalUp;});_this138._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._isProjectNorth&&self._projectNorthOffsetAngle){eyeLookVec=rotateTrueNorth(-1,eyeLookVec,tempVec3a$1);up=rotateTrueNorth(-1,up,tempVec3b);}if(self._zUp){// +Z up
25347
25604
  math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);math.transformVec3(matrix,up,upCube);self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);self._navCubeCamera.up=math.transformPoint3(matrix,up,upCube);}else{// +Y up
25348
- self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);if(viewerNormalUp){self._navCubeCamera.up=up;}else{self._navCubeCamera.up=math.mulVec3Scalar(up,-1);}}};}();_this137._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this137._cubeSampler=new Texture(navCubeScene,{image:_this137._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this137._cubeMesh=new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new PhongMaterial(navCubeScene,{diffuse:[0.4,0.4,0.4],specular:[0.4,0.4,0.4],emissive:[0.6,0.6,0.6],diffuseMap:_this137._cubeSampler,emissiveMap:_this137._cubeSampler}),visible:!!visible,edges:true});_this137._shadow=cfg.shadowVisible===false?null:new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,buildCylinderGeometry({center:[0,0,0],radiusTop:0.001,radiusBottom:1.4,height:0.01,radialSegments:20,heightSegments:1,openEnded:true})),material:new PhongMaterial(navCubeScene,{diffuse:[0.0,0.0,0.0],specular:[0,0,0],emissive:[0.0,0.0,0.0],alpha:0.5}),position:[0,-1.5,0],visible:!!visible,pickable:false,backfaces:false});_this137._onCameraMatrix=viewer.camera.on("matrix",_this137._synchCamera);_this137._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this137._zUp=true;_this137._cubeTextureCanvas.setZUp();_this137._repaint();_this137._synchCamera();}else if(viewer.camera.yUp){_this137._zUp=false;_this137._cubeTextureCanvas.setYUp();_this137._repaint();_this137._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this137._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this137._synchProjection){_this137._navCubeCamera.perspective.fov=fov;}});_this137._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this137._synchProjection){_this137._navCubeCamera.projection=projection==="ortho"||projection==="perspective"?projection:"perspective";}});var lastAreaId=-1;function actionMove(posX,posY){var yawInc=(posX-lastX)*-sensitivity;var pitchInc=(posY-lastY)*-sensitivity;viewer.camera.orbitYaw(yawInc);viewer.camera.orbitPitch(-pitchInc);lastX=posX;lastY=posY;}function getCoordsWithinElement(event){var coords=[0,0];if(!event){event=window.event;coords[0]=event.x;coords[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}coords[0]=event.pageX-totalOffsetLeft;coords[1]=event.pageY-totalOffsetTop;}return coords;}{var downX=null;var downY=null;var down=false;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=false;});self._navCubeCanvas.addEventListener("mousedown",self._onMouseDown=function(e){if(e.which!==1){return;}downX=e.x;downY=e.y;lastX=e.clientX;lastY=e.clientY;var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos});if(hit){down=true;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25605
+ self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);if(viewerNormalUp){self._navCubeCamera.up=up;}else{self._navCubeCamera.up=math.mulVec3Scalar(up,-1);}}};}();_this138._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this138._cubeSampler=new Texture(navCubeScene,{image:_this138._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this138._cubeMesh=new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,1,1,-1,-1,1,-1,-1,1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new PhongMaterial(navCubeScene,{diffuse:[0.4,0.4,0.4],specular:[0.4,0.4,0.4],emissive:[0.6,0.6,0.6],diffuseMap:_this138._cubeSampler,emissiveMap:_this138._cubeSampler}),visible:!!visible,edges:true});_this138._shadow=cfg.shadowVisible===false?null:new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,buildCylinderGeometry({center:[0,0,0],radiusTop:0.001,radiusBottom:1.4,height:0.01,radialSegments:20,heightSegments:1,openEnded:true})),material:new PhongMaterial(navCubeScene,{diffuse:[0.0,0.0,0.0],specular:[0,0,0],emissive:[0.0,0.0,0.0],alpha:0.5}),position:[0,-1.5,0],visible:!!visible,pickable:false,backfaces:false});_this138._onCameraMatrix=viewer.camera.on("matrix",_this138._synchCamera);_this138._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this138._zUp=true;_this138._cubeTextureCanvas.setZUp();_this138._repaint();_this138._synchCamera();}else if(viewer.camera.yUp){_this138._zUp=false;_this138._cubeTextureCanvas.setYUp();_this138._repaint();_this138._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this138._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this138._synchProjection){_this138._navCubeCamera.perspective.fov=fov;}});_this138._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this138._synchProjection){_this138._navCubeCamera.projection=projection==="ortho"||projection==="perspective"?projection:"perspective";}});var lastAreaId=-1;function actionMove(posX,posY){var yawInc=(posX-lastX)*-sensitivity;var pitchInc=(posY-lastY)*-sensitivity;viewer.camera.orbitYaw(yawInc);viewer.camera.orbitPitch(-pitchInc);lastX=posX;lastY=posY;}function getCoordsWithinElement(event){var coords=[0,0];if(!event){event=window.event;coords[0]=event.x;coords[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}coords[0]=event.pageX-totalOffsetLeft;coords[1]=event.pageY-totalOffsetTop;}return coords;}{var downX=null;var downY=null;var down=false;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=false;});self._navCubeCanvas.addEventListener("mousedown",self._onMouseDown=function(e){if(e.which!==1){return;}downX=e.x;downY=e.y;lastX=e.clientX;lastY=e.clientY;var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos});if(hit){down=true;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25349
25606
  return;}down=false;self.MOUSEDOWN=false;if(downX===null){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId>=0){// document.body.style.cursor = "pointer";
25350
25607
  if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);lastAreaId=areaId;self._repaint();if(e.x<downX-3||e.x>downX+3||e.y<downY-3||e.y>downY+3){return;}var dir=self._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=self._cubeTextureCanvas.getAreaUp(areaId);if(self._isProjectNorth&&self._projectNorthOffsetAngle){dir=rotateTrueNorth(+1,dir,tempVec3a$1);up=rotateTrueNorth(+1,up,tempVec3b);}flyTo(dir,up,function(){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}// document.body.style.cursor = "pointer";
25351
- if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=_this137.flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this137._onUpdated=viewer.localeService.on("updated",function(){_this137._cubeTextureCanvas.clear();_this137._repaint();});_this137.setVisible(cfg.visible);_this137.setCameraFitFOV(cfg.cameraFitFOV);_this137.setCameraFly(cfg.cameraFly);_this137.setCameraFlyDuration(cfg.cameraFlyDuration);_this137.setFitVisible(cfg.fitVisible);_this137.setSynchProjection(cfg.synchProjection);return _this137;}_inherits(NavCubePlugin,_Plugin7);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId,ok){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,ok);}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25608
+ if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=_this138.flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this138._onUpdated=viewer.localeService.on("updated",function(){_this138._cubeTextureCanvas.clear();_this138._repaint();});_this138.setVisible(cfg.visible);_this138.setCameraFitFOV(cfg.cameraFitFOV);_this138.setCameraFly(cfg.cameraFly);_this138.setCameraFlyDuration(cfg.cameraFlyDuration);_this138.setFitVisible(cfg.fitVisible);_this138.setSynchProjection(cfg.synchProjection);return _this138;}_inherits(NavCubePlugin,_Plugin8);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId,ok){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,ok);}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25352
25609
  break;}}},{key:"_repaint",value:function _repaint(){var image=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=image;this._cubeMesh.material.emissiveMap.image=image;}/**
25353
25610
  * Sets if the NavCube is visible.
25354
25611
  *
@@ -25460,7 +25717,7 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
25460
25717
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
25461
25718
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
25462
25719
  * @private
25463
- */return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this138=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this138._setPos(_this138._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this138._ignoreNextSectionPlaneDirUpdate){_this138._setDir(_this138._sectionPlane.dir);}else{_this138._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25720
+ */return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this139=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this139._setPos(_this139._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this139._ignoreNextSectionPlaneDirUpdate){_this139._setDir(_this139._sectionPlane.dir);}else{_this139._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25464
25721
  * Gets the {@link SectionPlane} controlled by this Control.
25465
25722
  * @returns {SectionPlane} The SectionPlane.
25466
25723
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -25591,10 +25848,10 @@ yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,materi
25591
25848
  //----------------------------------------------------------------------------------------------------------
25592
25849
  zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrowHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zShaft:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axis,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:false,collidable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisHandle:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.axisHandle,material:materials.pickable,matrix:function(){var translate=math.translateMat4c(0,radius/2,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),clippable:false,pickable:true,collidable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};this._affordanceMeshes={planeFrame:rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildTorusGeometry({center:[0,0,0],radius:2,tube:tubeRadius,radialSegments:4,tubeSegments:4,arc:Math.PI*2.0})),material:new PhongMaterial(rootNode,{ambient:[1,1,1],diffuse:[0,0,0],emissive:[1,1,0]}),highlighted:true,highlightMaterial:new EmphasisMaterial(rootNode,{edges:false,filled:true,fillColor:[1,1,0],fillAlpha:1.0}),pickable:false,collidable:false,clippable:false,visible:false,scale:[1,1,1],rotation:[0,0,45],isObject:false}),NO_STATE_INHERIT),xHoop:rootNode.addChild(new Mesh(rootNode,{// Full
25593
25850
  geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var rotate2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var rotate1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate1,rotate2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{// Blue hoop about Z-axis
25594
- geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this139=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25851
+ geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var translate=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var rotate=math.rotationMat4v(-90*math.DEGTORAD,[0.8,0,0],math.identityMat4());return math.mulMat4(rotate,translate,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}},{key:"_bindEvents",value:function _bindEvents(){var _this140=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25595
25852
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
25596
25853
  var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
25597
- var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this139._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){// 如果有触摸事件,使用第一个触摸点的坐标
25854
+ var _tempVec3a=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this140._pos,_tempVec3a)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;var size=0.07*worldSize;rootNode.scale=[size,size,size];lastDist=dist;}}if(camera.projection==="ortho"){var _worldSize=camera.ortho.scale/10;var _size=_worldSize;rootNode.scale=[_size,_size,_size];lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){// 如果有触摸事件,使用第一个触摸点的坐标
25598
25855
  canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{// 否则,假设是鼠标事件
25599
25856
  var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(self._rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2])){math.cross3Vec3(worldAxis,[0,1,0],planeNormal);}else{math.cross3Vec3(worldAxis,[1,0,0],planeNormal);}math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;self._rootNode.position=self._pos;if(self._sectionPlane){self._sectionPlane.pos=self._pos;}};}();var dragRotateSectionPlane=function(){var p1=math.vec4();var p2=math.vec4();var c=math.vec4();var worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){// Find intersections with view plane and project down to origin
25600
25857
  var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);// Ensure plane moves closer to camera so angles become workable
@@ -25604,25 +25861,25 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
25604
25861
  var rayO=camera.eye;// The direction
25605
25862
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
25606
25863
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();var rotateSectionPlane=function(){var dir=math.vec3();var mat=math.mat4();return function(){if(self.sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
25607
- math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this139._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this139._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.xAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.yShaftHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.zAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.xCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this139._displayMeshes.yCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25864
+ math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this140._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this140._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.xAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.yShaftHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.zAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.xCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this140._displayMeshes.yCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25608
25865
  // affordanceMesh = this._affordanceMeshes.zHoop;
25609
25866
  // nextDragAction = DRAG_ACTIONS.zRotate;
25610
25867
  // break;
25611
25868
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25612
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this139._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25613
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this139._visible||!grabbed)return;_this139._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
25614
- down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this139.plugin.fire("clickPlaneStart");break;}});//mousemove
25615
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this139._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25616
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this139._visible)return;_this139._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this139.plugin.fire("clickPlaneEnd");});//wheel
25617
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this139._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this139._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this139._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.xAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this139._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.yShaftHandle.id:affordanceMesh=_this139._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this139._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.zAxisHandle.id:affordanceMesh=_this139._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this139._displayMeshes.xCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this139._displayMeshes.yCurveHandle.id:affordanceMesh=_this139._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25869
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this140._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25870
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this140._visible||!grabbed)return;_this140._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
25871
+ down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this140.plugin.fire("clickPlaneStart");break;}});//mousemove
25872
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this140._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25873
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this140._visible)return;_this140._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this140.plugin.fire("clickPlaneEnd");});//wheel
25874
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this140._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this140._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this140._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.xAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this140._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.yShaftHandle.id:affordanceMesh=_this140._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this140._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.zAxisHandle.id:affordanceMesh=_this140._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this140._displayMeshes.xCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this140._displayMeshes.yCurveHandle.id:affordanceMesh=_this140._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25618
25875
  // affordanceMesh = this._affordanceMeshes.zHoop;
25619
25876
  // nextDragAction = DRAG_ACTIONS.zRotate;
25620
25877
  // break;
25621
25878
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25622
25879
  }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
25623
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this139._visible||!grabbed)return;_this139._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this139.plugin.fire("touchPlaneStart");});//touchmove
25624
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this139._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25625
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this139._visible)return;_this139._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this139.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$2=new Float64Array([0,0,1]);var quat$2=new Float64Array(4);/**
25880
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this140._visible||!grabbed)return;_this140._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this140.plugin.fire("touchPlaneStart");});//touchmove
25881
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this140._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25882
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this140._visible)return;_this140._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this140.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$2=new Float64Array([0,0,1]);var quat$2=new Float64Array(4);/**
25626
25883
  * Controls a {@link SectionPlane} with mouse and touch input.
25627
25884
  *
25628
25885
  * @private
@@ -25855,7 +26112,7 @@ geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:
25855
26112
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
25856
26113
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
25857
26114
  * @private
25858
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this140=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this140._setPos(_this140._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this140._ignoreNextSectionPlaneDirUpdate){_this140._setDir(_this140._sectionPlane.dir);}else{_this140._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26115
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this141=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this141._setPos(_this141._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this141._ignoreNextSectionPlaneDirUpdate){_this141._setDir(_this141._sectionPlane.dir);}else{_this141._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25859
26116
  * Gets the {@link SectionPlane} controlled by this Control.
25860
26117
  * @returns {SectionPlane} The SectionPlane.
25861
26118
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -25883,10 +26140,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
25883
26140
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
25884
26141
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
25885
26142
  * @param culled
25886
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this141=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26143
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this142=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};var rootNode=this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
25887
26144
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
25888
26145
  var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
25889
- var _tempVec3a2=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this141._pos,_tempVec3a2)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = 0.07 * worldSize;
26146
+ var _tempVec3a2=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this142._pos,_tempVec3a2)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = 0.07 * worldSize;
25890
26147
  // rootNode.scale = [size, size, size];
25891
26148
  lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
25892
26149
  // rootNode.scale = [size, size, size];
@@ -25900,24 +26157,24 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
25900
26157
  var rayO=camera.eye;// The direction
25901
26158
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
25902
26159
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();var rotateSectionPlane=function(){var dir=math.vec3();var mat=math.mat4();return function(){if(self.sectionPlane){math.quaternionToMat4(rootNode.quaternion,mat);// << ---
25903
- math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this141._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.xAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.yShaftHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.zAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.xCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this141._displayMeshes.yCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
26160
+ math.transformVec3(mat,[0,0,1],dir);self._setSectionPlaneDir(dir);}};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this142._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this142._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.xAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.yShaftHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.zAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.xCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this142._displayMeshes.yCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25904
26161
  // affordanceMesh = this._affordanceMeshes.zHoop;
25905
26162
  // nextDragAction = DRAG_ACTIONS.zRotate;
25906
26163
  // break;
25907
26164
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25908
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this141._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
25909
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed)return;_this141._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("clickPlaneStart");break;}});//mousemove
25910
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this141._visible){return;}if(!down||!grabbed){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
25911
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this141._visible)return;_this141._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this141.plugin.fire("clickPlaneEnd");});//wheel
25912
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this141._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this141._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.xAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this141._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.yShaftHandle.id:affordanceMesh=_this141._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this141._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.zAxisHandle.id:affordanceMesh=_this141._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this141._displayMeshes.xCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this141._displayMeshes.yCurveHandle.id:affordanceMesh=_this141._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
26165
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this142._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26166
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this142._visible||!grabbed)return;_this142._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this142.plugin.fire("clickPlaneStart");break;}});//mousemove
26167
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this142._visible){return;}if(!down||!grabbed){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26168
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this142._visible)return;_this142._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this142.plugin.fire("clickPlaneEnd");});//wheel
26169
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this142._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this142._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this142._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.xAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this142._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.yShaftHandle.id:affordanceMesh=_this142._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this142._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.zAxisHandle.id:affordanceMesh=_this142._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this142._displayMeshes.xCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this142._displayMeshes.yCurveHandle.id:affordanceMesh=_this142._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
25913
26170
  // affordanceMesh = this._affordanceMeshes.zHoop;
25914
26171
  // nextDragAction = DRAG_ACTIONS.zRotate;
25915
26172
  // break;
25916
26173
  default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
25917
26174
  }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
25918
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed)return;_this141._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("touchPlaneStart");});//touchmove
25919
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this141._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
25920
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this141._visible)return;_this141._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this141.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$1=new Float64Array([0,0,1]);var quat$1=new Float64Array(4);/**
26175
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this142._visible||!grabbed)return;_this142._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this142.plugin.fire("touchPlaneStart");});//touchmove
26176
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this142._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26177
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this142._visible)return;_this142._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this142.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec$1=new Float64Array([0,0,1]);var quat$1=new Float64Array(4);/**
25921
26178
  * Controls a {@link SectionPlane} with mouse and touch input.
25922
26179
  *
25923
26180
  * @private
@@ -25989,7 +26246,7 @@ width/2,-height/2,0.012,// 右下角
25989
26246
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
25990
26247
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
25991
26248
  * @private
25992
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this142=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this.dir=sectionPlane.dir;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this142._setPos(_this142._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this142._ignoreNextSectionPlaneDirUpdate){_this142._setDir(_this142._sectionPlane.dir);}else{_this142._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26249
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this143=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.controlId;this.dir=sectionPlane.dir;this._createNodes();this._bindEvents();this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this143._setPos(_this143._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this143._ignoreNextSectionPlaneDirUpdate){_this143._setDir(_this143._sectionPlane.dir);}else{_this143._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
25993
26250
  * Gets the {@link SectionPlane} controlled by this Control.
25994
26251
  * @returns {SectionPlane} The SectionPlane.
25995
26252
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -26017,7 +26274,7 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
26017
26274
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
26018
26275
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
26019
26276
  * @param culled
26020
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this143=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26277
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this144=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26021
26278
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
26022
26279
  var lastCanvasPos=math.vec2();this.lastCanvasPos=lastCanvasPos;var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});// const tempVec3a = math.vec3([0, 0, 0]);
26023
26280
  // let lastDist = -1;
@@ -26044,14 +26301,14 @@ var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();v
26044
26301
  math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);// This is now point A on the ray in world space
26045
26302
  var rayO=camera.eye;// The direction
26046
26303
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
26047
- var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this143._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this143._displayMeshes.plane.id:affordanceMesh=_this143._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26048
- }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this143._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26049
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this143._visible||!grabbed)return;_this143._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26304
+ var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this144._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this144._displayMeshes.plane.id:affordanceMesh=_this144._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26305
+ }if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this144._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26306
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this144._visible||!grabbed)return;_this144._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26050
26307
  down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
26051
- dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this143.plugin.fire("clickPlaneStart");break;}});//mousemove
26052
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this143._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26053
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this143._visible)return;_this143._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this143.plugin.fire("clickPlaneEnd");});//wheel
26054
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this143._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26308
+ dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this144.plugin.fire("clickPlaneStart");break;}});//mousemove
26309
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this144._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26310
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this144._visible)return;_this144._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this144.plugin.fire("clickPlaneEnd");});//wheel
26311
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this144._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();var zeroVec=new Float64Array([0,0,1]);var quat=new Float64Array(4);/**
26055
26312
  * Controls a {@link SectionPlane} with mouse and touch input.
26056
26313
  *
26057
26314
  * @private
@@ -26134,7 +26391,7 @@ width/2,-height/2,0.02,// 右下角
26134
26391
  * SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
26135
26392
  * Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
26136
26393
  * @private
26137
- */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this144=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this144._setPos(_this144._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this144._ignoreNextSectionPlaneDirUpdate){_this144._setDir(_this144._sectionPlane.dir);}else{_this144._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26394
+ */},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this145=this;if(this._sectionPlane){this._sectionPlane.off(this._onSectionPlanePos);this._sectionPlane.off(this._onSectionPlaneDir);this._onSectionPlanePos=null;this._onSectionPlaneDir=null;this._sectionPlane=null;}if(sectionPlane){this.id=sectionPlane.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;this._onSectionPlanePos=sectionPlane.on("pos",function(){_this145._setPos(_this145._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this145._ignoreNextSectionPlaneDirUpdate){_this145._setDir(_this145._sectionPlane.dir);}else{_this145._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
26138
26395
  * Gets the {@link SectionPlane} controlled by this Control.
26139
26396
  * @returns {SectionPlane} The SectionPlane.
26140
26397
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
@@ -26162,10 +26419,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
26162
26419
  * Sets if this Control is culled. This is called by SectionPlanesPlugin to
26163
26420
  * temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
26164
26421
  * @param culled
26165
- */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this145=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26422
+ */},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id)){this._displayMeshes[id].culled=culled;}}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id)){this._affordanceMeshes[id].culled=culled;}}}}},{key:"_bindEvents",value:function _bindEvents(){var _this146=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5};this._rootNode;var nextDragAction=null;// As we hover grabbed an arrow or hoop, self is the action we would do if we then dragged it.
26166
26423
  var dragAction=null;// Action we're doing while we drag an arrow or hoop.
26167
26424
  var lastCanvasPos=math.vec2();this.lastCanvasPos=lastCanvasPos;var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;{// Keep gizmo screen size constant
26168
- var _tempVec3a3=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this145._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = this._controlSize * worldSize;
26425
+ var _tempVec3a3=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this146._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = this._controlSize * worldSize;
26169
26426
  // rootNode.scale = [size, size, size];
26170
26427
  lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
26171
26428
  // rootNode.scale = [size, size, size];
@@ -26178,23 +26435,23 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
26178
26435
  var rayO=camera.eye;// The direction
26179
26436
  math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
26180
26437
  var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();{var down=false;// var lastAffordanceMesh;
26181
- this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this145._visible){return;}if(down){return;}grabbed=false;var meshId=hit.entity.id;switch(meshId){case _this145._displayMeshes.plane.id:// affordanceMesh = this._affordanceMeshes.plane;
26438
+ this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this146._visible){return;}if(down){return;}grabbed=false;var meshId=hit.entity.id;switch(meshId){case _this146._displayMeshes.plane.id:// affordanceMesh = this._affordanceMeshes.plane;
26182
26439
  nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26183
- }grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this145._visible){return;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26184
- canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this145._visible||!grabbed)return;_this145._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26440
+ }grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this146._visible){return;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
26441
+ canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this146._visible||!grabbed)return;_this146._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
26185
26442
  down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
26186
- dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this145.plugin.fire("clickPlaneStart");break;}});//mousemove
26187
- canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this145._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26188
- canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this145._visible)return;_this145._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this145.plugin.fire("clickPlaneEnd");});//wheel
26189
- canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this145._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this145._visible||down||grabbed)return;var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this145._displayMeshes.plane.id:affordanceMesh=_this145._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26443
+ dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this146.plugin.fire("clickPlaneStart");break;}});//mousemove
26444
+ canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this146._visible){return;}if(!down){return;}var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
26445
+ canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this146._visible)return;_this146._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this146.plugin.fire("clickPlaneEnd");});//wheel
26446
+ canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this146._visible){return;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}});this._onCameraControlHover=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this146._visible||down||grabbed)return;var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this146._displayMeshes.plane.id:affordanceMesh=_this146._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
26190
26447
  }if(affordanceMesh){affordanceMesh.visible=true;}grabbed=true;down=true;});//touchstart
26191
- canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this145._visible||!grabbed||!down)return;_this145._viewer.cameraControl.pointerEnabled=false;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this145.plugin.fire("touchPlaneStart");});//touchmove
26192
- canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this145._visible||!down||!grabbed)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26193
- canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this145._visible)return;if(grabbed)_this145._viewer.cameraControl.pointerEnabled=true;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this145.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();/**
26448
+ canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this146._visible||!grabbed||!down)return;_this146._viewer.cameraControl.pointerEnabled=false;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this146.plugin.fire("touchPlaneStart");});//touchmove
26449
+ canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this146._visible||!down||!grabbed)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0];var y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslateSectionPlane(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslateSectionPlane(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslateSectionPlane(zBaseAxis,lastCanvasPos,canvasPos);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//touchend
26450
+ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this146._visible)return;if(grabbed)_this146._viewer.cameraControl.pointerEnabled=true;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this146.plugin.fire("touchPlaneEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}},{key:"_destroy",value:function _destroy(){this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("wheel",this._canvasWheelListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);}},{key:"_destroyNodes",value:function _destroyNodes(){this._setSectionPlane(null);this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};}}]);}();/**
26194
26451
  * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
26195
26452
  *
26196
26453
  * @private
26197
- */var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this146=this;_classCallCheck(this,Plane);/**
26454
+ */var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this147=this;_classCallCheck(this,Plane);/**
26198
26455
  * The ID of this SectionPlanesOverviewPlane.
26199
26456
  *
26200
26457
  * @type {String}
@@ -26202,7 +26459,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26202
26459
  * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
26203
26460
  *
26204
26461
  * @type {SectionPlane}
26205
- */this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this146._sectionPlane.scene.center;var negDir=[-_this146._sectionPlane.dir[0],-_this146._sectionPlane.dir[1],-_this146._sectionPlane.dir[2]];math.subVec3(origin,_this146._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this146._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this146._mesh.quaternion=quaternion;_this146._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
26462
+ */this._sectionPlane=sectionPlane;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:.5,ySize:.5,zSize:.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec=math.vec3([0,0,1]);var _quat=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this147._sectionPlane.scene.center;var negDir=[-_this147._sectionPlane.dir[0],-_this147._sectionPlane.dir[1],-_this147._sectionPlane.dir[2]];math.subVec3(origin,_this147._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this147._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this147._mesh.quaternion=quaternion;_this147._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
26206
26463
  }this._highlighted=false;this._selected=false;}/**
26207
26464
  * Sets if this SectionPlanesOverviewPlane is highlighted.
26208
26465
  *
@@ -26228,7 +26485,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26228
26485
  * Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
26229
26486
  *
26230
26487
  * @private
26231
- */var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var _this147=this;_classCallCheck(this,Box);/**
26488
+ */var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var _this148=this;_classCallCheck(this,Box);/**
26232
26489
  * The ID of this SectionPlanesOverviewPlane.
26233
26490
  *
26234
26491
  * @type {String}
@@ -26236,7 +26493,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26236
26493
  * The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
26237
26494
  *
26238
26495
  * @type {SectionPlane}
26239
- */this._sectionBox=sectionBox;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:0.5,ySize:0.5,zSize:0.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this147._sectionBox.scene.center;var negDir=[-_this147._sectionBox.dir[0],-_this147._sectionBox.dir[1],-_this147._sectionBox.dir[2]];math.subVec3(origin,_this147._sectionBox.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this147._sectionBox.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this147._mesh.quaternion=quaternion;_this147._mesh.position=pos3;};this._onSectionPlanePos=this._sectionBox.on("pos",update);this._onSectionPlaneDir=this._sectionBox.on("dir",update);// update();
26496
+ */this._sectionBox=sectionBox;this._mesh=new Mesh(overviewScene,{id:sectionPlane.id,geometry:new ReadableGeometry(overviewScene,buildBoxGeometry({xSize:0.5,ySize:0.5,zSize:0.001})),material:new PhongMaterial(overviewScene,{emissive:[1,1,1],diffuse:[0,0,0],backfaces:false}),edgeMaterial:new EdgeMaterial(overviewScene,{edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlightMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0.5,1,0.5],fillAlpha:0.7,edges:true,edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),selectedMaterial:new EmphasisMaterial(overviewScene,{fill:true,fillColor:[0,0,1],fillAlpha:0.7,edges:true,edgeColor:[1.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1}),highlighted:true,scale:[3,3,3],position:[0,0,0],rotation:[0,0,0],opacity:0.3,edges:true});{var vec=math.vec3([0,0,0]);var pos2=math.vec3();var _zeroVec2=math.vec3([0,0,1]);var _quat2=math.vec4(4);var pos3=math.vec3();var update=function update(){var origin=_this148._sectionBox.scene.center;var negDir=[-_this148._sectionBox.dir[0],-_this148._sectionBox.dir[1],-_this148._sectionBox.dir[2]];math.subVec3(origin,_this148._sectionBox.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this148._sectionBox.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this148._mesh.quaternion=quaternion;_this148._mesh.position=pos3;};this._onSectionPlanePos=this._sectionBox.on("pos",update);this._onSectionPlaneDir=this._sectionBox.on("dir",update);// update();
26240
26497
  }this._highlighted=false;this._selected=false;}/**
26241
26498
  * Sets if this SectionPlanesOverviewPlane is highlighted.
26242
26499
  *
@@ -26269,7 +26526,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
26269
26526
  * @private
26270
26527
  */var Overview=/*#__PURE__*/function(){/**
26271
26528
  * @private
26272
- */function Overview(plugin,cfg){var _this148=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
26529
+ */function Overview(plugin,cfg){var _this149=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
26273
26530
  * The {@link SectionPlanesPlugin} that owns this SectionPlanesOverview.
26274
26531
  *
26275
26532
  * @type {SectionPlanesPlugin}
@@ -26282,12 +26539,12 @@ this._canvas=cfg.overviewCanvas;//----------------------------------------------
26282
26539
  this._scene=new Scene(this._viewer,{canvasId:this._canvas.id,transparent:true,spinnerElementId:"overviewer_spinner"});this._scene.clearLights();new DirLight(this._scene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(this._scene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});this._scene.camera;this._scene.camera.perspective.fov=70;this._zUp=false;//--------------------------------------------------------------------------------------------------------------
26283
26540
  // Synchronize overview scene camera with viewer camera
26284
26541
  //--------------------------------------------------------------------------------------------------------------
26285
- {var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this148._viewer.camera.eye;var look=_this148._viewer.camera.look;var up=_this148._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this148._zUp){// +Z up
26542
+ {var camera=this._scene.camera;var _matrix3=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var _eyeLookVec3=math.vec3();var eyeLookVecOverview=math.vec3();var upOverview=math.vec3();this._synchCamera=function(){var eye=_this149._viewer.camera.eye;var look=_this149._viewer.camera.look;var up=_this149._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this149._zUp){// +Z up
26286
26543
  math.transformVec3(_matrix3,_eyeLookVec3,eyeLookVecOverview);math.transformVec3(_matrix3,up,upOverview);camera.look=[0,0,0];camera.eye=math.transformVec3(_matrix3,_eyeLookVec3,eyeLookVecOverview);camera.up=math.transformPoint3(_matrix3,up,upOverview);}else{// +Y up
26287
- camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this148._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
26544
+ camera.look=[0,0,0];camera.eye=_eyeLookVec3;camera.up=up;}};}this._onViewerCameraMatrix=this._viewer.camera.on("matrix",this._synchCamera);this._onViewerCameraWorldAxis=this._viewer.camera.on("worldAxis",this._synchCamera);this._onViewerCameraFOV=this._viewer.camera.perspective.on("fov",function(fov){_this149._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
26288
26545
  // Bind overview canvas events
26289
26546
  //--------------------------------------------------------------------------------------------------------------
26290
- {var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this148._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this148._planes[hoveredEntity.id];if(_plane){_this148._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this148._planes[hoveredEntity.id];if(plane){_this148._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this148._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this148._planes[hoveredEntity.id];if(plane){_this148._onClickedPlane(hoveredEntity.id);}}else{_this148._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this148._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
26547
+ {var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this149._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this149._planes[hoveredEntity.id];if(_plane){_this149._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this149._planes[hoveredEntity.id];if(plane){_this149._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this149._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this149._planes[hoveredEntity.id];if(plane){_this149._onClickedPlane(hoveredEntity.id);}}else{_this149._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this149._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
26291
26548
  // Configure overview
26292
26549
  //--------------------------------------------------------------------------------------------------------------
26293
26550
  this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSectionPlane()
@@ -26399,21 +26656,21 @@ var newgeo=buildBoxLinesGeometry({center:center,xSize:(a>0?a:-1*a)*num+0.2,ySize
26399
26656
  * mySectionPlane2.pos = [11.0, 6.0, -12];
26400
26657
  * mySectionPlane2.dir = [0.4, 0.0, 0.5];
26401
26658
  * ````
26402
- */var SectionPlanesPlugin=/*#__PURE__*/function(_Plugin8){/**
26659
+ */var SectionPlanesPlugin=/*#__PURE__*/function(_Plugin9){/**
26403
26660
  * @constructor
26404
26661
  * @param {Viewer} viewer The Viewer.
26405
26662
  * @param {Object} cfg Plugin configuration.
26406
26663
  * @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
26407
26664
  * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
26408
26665
  * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
26409
- */function SectionPlanesPlugin(viewer){var _this149;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this149=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this149._freeControls=[];_this149._controlBox=null;_this149._singleCtrlBox=null;_this149._sectionWay=null;_this149._sectionPlanes=viewer.scene.sectionPlanes;_this149._controls={};_this149._currentControl=null;_this149._shownControlId=null;_this149._shownControlIds=[];_this149._boxPlaneConfig={id:"",planeId:-1,enableClip:false,controlFillColor:[3,9,9]};if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this149.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this149._overview=new Overview(_this149,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this149._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this149._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this149.getShownControl()===id){_this149.hideControl();return;}_this149.showControl(id);var sectionPlane=_this149.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this149.viewer.scene.aabb);math.getAABB3Center(tempAABB,tempVec3);tempAABB[0]+=sectionPlanePos[0]-tempVec3[0];tempAABB[1]+=sectionPlanePos[1]-tempVec3[1];tempAABB[2]+=sectionPlanePos[2]-tempVec3[2];tempAABB[3]+=sectionPlanePos[0]-tempVec3[0];tempAABB[4]+=sectionPlanePos[1]-tempVec3[1];tempAABB[5]+=sectionPlanePos[2]-tempVec3[2];_this149.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this149.hideControl();}});}}_this149._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
26666
+ */function SectionPlanesPlugin(viewer){var _this150;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this150=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this150._freeControls=[];_this150._controlBox=null;_this150._singleCtrlBox=null;_this150._sectionWay=null;_this150._sectionPlanes=viewer.scene.sectionPlanes;_this150._controls={};_this150._currentControl=null;_this150._shownControlId=null;_this150._shownControlIds=[];_this150._boxPlaneConfig={id:"",planeId:-1,enableClip:false,controlFillColor:[3,9,9]};if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this150.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this150._overview=new Overview(_this150,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this150._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this150._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this150.getShownControl()===id){_this150.hideControl();return;}_this150.showControl(id);var sectionPlane=_this150.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this150.viewer.scene.aabb);math.getAABB3Center(tempAABB,tempVec3);tempAABB[0]+=sectionPlanePos[0]-tempVec3[0];tempAABB[1]+=sectionPlanePos[1]-tempVec3[1];tempAABB[2]+=sectionPlanePos[2]-tempVec3[2];tempAABB[3]+=sectionPlanePos[0]-tempVec3[0];tempAABB[4]+=sectionPlanePos[1]-tempVec3[1];tempAABB[5]+=sectionPlanePos[2]-tempVec3[2];_this150.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this150.hideControl();}});}}_this150._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
26410
26667
  // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
26411
26668
  // by BCFViewpointsPlugin#loadViewpoint().
26412
- _this149._sectionPlaneCreated(sectionPlane);});_this149._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this149._controlBox=sectionBox;});_this149.controlset=cfg.controlset;return _this149;}/**
26669
+ _this150._sectionPlaneCreated(sectionPlane);});_this150._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this150._controlBox=sectionBox;});_this150.controlset=cfg.controlset;return _this150;}/**
26413
26670
  * Sets if the overview canvas is visible.
26414
26671
  *
26415
26672
  * @param {Boolean} visible Whether or not the overview canvas is visible.
26416
- */_inherits(SectionPlanesPlugin,_Plugin8);return _createClass(SectionPlanesPlugin,[{key:"setOverviewVisible",value:function setOverviewVisible(visible){if(this._overview){this._overview.setVisible(visible);}}/**
26673
+ */_inherits(SectionPlanesPlugin,_Plugin9);return _createClass(SectionPlanesPlugin,[{key:"setOverviewVisible",value:function setOverviewVisible(visible){if(this._overview){this._overview.setVisible(visible);}}/**
26417
26674
  * Gets if the overview canvas is visible.
26418
26675
  *
26419
26676
  * @return {Boolean} True when the overview canvas is visible.
@@ -26435,7 +26692,7 @@ _this149._sectionPlaneCreated(sectionPlane);});_this149._onSceneSectionBoxCreate
26435
26692
  */},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&&params.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
26436
26693
  // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
26437
26694
  var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}},{key:"createSectionBox",value:function createSectionBox(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._sectionWay="box";var lineBox=new LineBox(this);var sectionBox=new SectionBox(this.viewer.scene,{id:"sectionBox",active:true,controlIdName:"sectionBoxPlane_",lineBox:lineBox});return sectionBox;}},{key:"createSectionSingle",value:function createSectionSingle(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};this._sectionWay="box";var sectionBox=new SectionBox(this.viewer.scene,{id:"sectionBox",active:true,pickable:false,enableClip:false,controlIdName:"sectionBoxPlane_"});return sectionBox;}//剖切面创建后,创建一个控制器
26438
- },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this150=this;var newControl;switch(this._sectionWay){case"plane":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingPlane(this,this._controlsConfig);break;case"box":this._boxPlaneConfig.enableClip=sectionPlane.enableClip;this._boxPlaneConfig.pickable=sectionPlane.pickable;this._boxPlaneConfig.controlFillColor=sectionPlane.controlFillColor;newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingBoxPlane(this,this._boxPlaneConfig);break;case"singleCtrl":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingSinglePlane(this,this.controlset);break;default:newControl=new Control(this);break;}var control=newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;if(sectionPlane.box==null){this._controls[sectionPlane.id]=control;}if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this150._sectionPlaneDestroyed(sectionPlane);});}/**
26695
+ },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this151=this;var newControl;switch(this._sectionWay){case"plane":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingPlane(this,this._controlsConfig);break;case"box":this._boxPlaneConfig.enableClip=sectionPlane.enableClip;this._boxPlaneConfig.pickable=sectionPlane.pickable;this._boxPlaneConfig.controlFillColor=sectionPlane.controlFillColor;newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingBoxPlane(this,this._boxPlaneConfig);break;case"singleCtrl":newControl=this._freeControls.length>0?this._freeControls.pop():new ClippingSinglePlane(this,this.controlset);break;default:newControl=new Control(this);break;}var control=newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;if(sectionPlane.box==null){this._controls[sectionPlane.id]=control;}if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this151._sectionPlaneDestroyed(sectionPlane);});}/**
26439
26696
  * 设置是否是触屏模式
26440
26697
  * @param {boolean} touch
26441
26698
  */},{key:"isTouch",set:function set(touch){this._isTouch=touch;if(touch===true)this.sectionWay="plane";else this.sectionWay=this._sectionWay?this._sectionWay:"control";}/**
@@ -26813,14 +27070,14 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26813
27070
  * pickResult.entity.highlighted = true;
26814
27071
  * }
26815
27072
  * ````
26816
- */var StoreyViewsPlugin=/*#__PURE__*/function(_Plugin9){/**
27073
+ */var StoreyViewsPlugin=/*#__PURE__*/function(_Plugin10){/**
26817
27074
  * @constructor
26818
27075
  *
26819
27076
  * @param {Viewer} viewer The Viewer.
26820
27077
  * @param {Object} cfg Plugin configuration.
26821
27078
  * @param {String} [cfg.id="StoreyViews"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
26822
27079
  * @param {Boolean} [cfg.fitStoreyMaps=false] If enabled, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different floor map images. If disabled, each floor map image will display the model's extents, ensuring a consistent scale across all images.
26823
- */function StoreyViewsPlugin(viewer){var _this151;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this151=_callSuper(this,StoreyViewsPlugin,["StoreyViews",viewer]);_this151._objectsMemento=new ObjectsMemento();_this151._cameraMemento=new CameraMemento();/**
27080
+ */function StoreyViewsPlugin(viewer){var _this152;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this152=_callSuper(this,StoreyViewsPlugin,["StoreyViews",viewer]);_this152._objectsMemento=new ObjectsMemento();_this152._cameraMemento=new CameraMemento();/**
26824
27081
  * A {@link Storey} for each ````IfcBuildingStorey```.
26825
27082
  *
26826
27083
  * There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals "IfcBuildingStorey".
@@ -26828,13 +27085,13 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
26828
27085
  * These are created and destroyed automatically as models are loaded and destroyed.
26829
27086
  *
26830
27087
  * @type {{String:Storey}}
26831
- */_this151.storeys={};/**
27088
+ */_this152.storeys={};/**
26832
27089
  * A set of {@link Storey}s for each {@link MetaModel}.
26833
27090
  *
26834
27091
  * These are created and destroyed automatically as models are loaded and destroyed.
26835
27092
  *
26836
27093
  * @type {{String: {String:Storey}}}
26837
- */_this151.modelStoreys={};_this151._fitStoreyMaps=!!cfg.fitStoreyMaps;_this151._onModelLoaded=_this151.viewer.scene.on("modelLoaded",function(modelId){_this151._registerModelStoreys(modelId);_this151.fire("storeys",_this151.storeys);});return _this151;}_inherits(StoreyViewsPlugin,_Plugin9);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this152=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i565=0,len=storeyIds.length;_i565<len;_i565++){var storeyId=storeyIds[_i565];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this152._deregisterModelStoreys(modelId);_this152.fire("storeys",_this152.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
27094
+ */_this152.modelStoreys={};_this152._fitStoreyMaps=!!cfg.fitStoreyMaps;_this152._onModelLoaded=_this152.viewer.scene.on("modelLoaded",function(modelId){_this152._registerModelStoreys(modelId);_this152.fire("storeys",_this152.storeys);});return _this152;}_inherits(StoreyViewsPlugin,_Plugin10);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this153=this;var viewer=this.viewer;var scene=viewer.scene;var metaScene=viewer.metaScene;var metaModel=metaScene.metaModels[modelId];var model=scene.models[modelId];if(!metaModel||!metaModel.rootMetaObjects){return;}var rootMetaObjects=metaModel.rootMetaObjects;for(var j=0,lenj=rootMetaObjects.length;j<lenj;j++){var storeyIds=rootMetaObjects[j].getObjectIDsInSubtreeByType(["IfcBuildingStorey"]);for(var _i565=0,len=storeyIds.length;_i565<len;_i565++){var storeyId=storeyIds[_i565];var metaObject=metaScene.metaObjects[storeyId];var childObjectIds=metaObject.getObjectIDsInSubtree();var storeyAABB=scene.getAABB(childObjectIds);var numObjects=Math.random()>0.5?childObjectIds.length:0;var storey=new Storey(this,model.aabb,storeyAABB,modelId,storeyId,numObjects);storey._onModelDestroyed=model.once("destroyed",function(){_this153._deregisterModelStoreys(modelId);_this153.fire("storeys",_this153.storeys);});this.storeys[storeyId]=storey;if(!this.modelStoreys[modelId]){this.modelStoreys[modelId]={};}this.modelStoreys[modelId][storeyId]=storey;}}}},{key:"_deregisterModelStoreys",value:function _deregisterModelStoreys(modelId){var storeys=this.modelStoreys[modelId];if(storeys){var scene=this.viewer.scene;for(var storyObjectId in storeys){if(storeys.hasOwnProperty(storyObjectId)){var storey=storeys[storyObjectId];var model=scene.models[storey.modelId];if(model){model.off(storey._onModelDestroyed);}delete this.storeys[storyObjectId];}}delete this.modelStoreys[modelId];}}/**
26838
27095
  * When true, the elements of each floor map image will be proportionally resized to encompass the entire image. This leads to varying scales among different
26839
27096
  * floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
26840
27097
  * @returns {*|boolean}
@@ -26975,9 +27232,9 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
26975
27232
  * });
26976
27233
  *
26977
27234
  * @class SkyboxesPlugin
26978
- */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin10){function SkyboxesPlugin(viewer){var _this153;_classCallCheck(this,SkyboxesPlugin);_this153=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this153.skyboxes={};_this153._active=false;return _this153;}/**
27235
+ */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin11){function SkyboxesPlugin(viewer){var _this154;_classCallCheck(this,SkyboxesPlugin);_this154=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this154.skyboxes={};_this154._active=false;return _this154;}/**
26979
27236
  * @private
26980
- */_inherits(SkyboxesPlugin,_Plugin10);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
27237
+ */_inherits(SkyboxesPlugin,_Plugin11);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
26981
27238
  Creates a skybox.
26982
27239
 
26983
27240
  @param {String} id Unique ID to assign to the skybox.
@@ -27335,7 +27592,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27335
27592
  * ````
27336
27593
  *
27337
27594
  * @class TreeViewPlugin
27338
- */var TreeViewPlugin=/*#__PURE__*/function(_Plugin11){/**
27595
+ */var TreeViewPlugin=/*#__PURE__*/function(_Plugin12){/**
27339
27596
  * @constructor
27340
27597
  *
27341
27598
  * @param {Viewer} viewer The Viewer.
@@ -27350,13 +27607,13 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27350
27607
  * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
27351
27608
  * @param {Boolean} [cfg.pruneEmptyNodes=true] When true, will not contain nodes that don't have content in the {@link Scene}. These are nodes whose {@link MetaObject}s don't have {@link Entity}s.
27352
27609
  * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
27353
- */function TreeViewPlugin(viewer){var _this154;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this154=_callSuper(this,TreeViewPlugin,["TreeViewPlugin",viewer]);/**
27610
+ */function TreeViewPlugin(viewer){var _this155;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this155=_callSuper(this,TreeViewPlugin,["TreeViewPlugin",viewer]);/**
27354
27611
  * Contains messages for any errors found while last rebuilding this TreeView.
27355
27612
  * @type {String[]}
27356
- */_this154.errors=[];/**
27613
+ */_this155.errors=[];/**
27357
27614
  * True if errors were found generating this TreeView.
27358
27615
  * @type {boolean}
27359
- */_this154.valid=true;// const containerElement =
27616
+ */_this155.valid=true;// const containerElement =
27360
27617
  // cfg.containerElement || document.getElementById(cfg.containerElementId);
27361
27618
  // if (!(containerElement instanceof HTMLElement)) {
27362
27619
  // this.error(
@@ -27364,23 +27621,23 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
27364
27621
  // );
27365
27622
  // return;
27366
27623
  // }
27367
- for(var _i567=0;;_i567++){if(!treeViews[_i567]){treeViews[_i567]=_this154;_this154._index=_i567;_this154._id="tree-".concat(_i567);break;}}// this._containerElement = containerElement;
27368
- _this154._metaModels={};_this154._autoAddModels=cfg.autoAddModels!==false;_this154._autoExpandDepth=cfg.autoExpandDepth||0;_this154._sortNodes=cfg.sortNodes!==false;_this154._viewer=viewer;_this154._rootElement=null;_this154._muteSceneEvents=false;_this154._muteTreeEvents=false;_this154._rootNodes=[];_this154._objectNodes={};// Object ID -> Node
27369
- _this154._nodeNodes={};// Node ID -> Node
27370
- _this154._rootNames={};// Node ID -> Root name
27371
- _this154._sortNodes=cfg.sortNodes;_this154._pruneEmptyNodes=cfg.pruneEmptyNodes;_this154._showListItemElementId=null;// this._renderService = cfg.renderService || new RenderService();
27624
+ for(var _i567=0;;_i567++){if(!treeViews[_i567]){treeViews[_i567]=_this155;_this155._index=_i567;_this155._id="tree-".concat(_i567);break;}}// this._containerElement = containerElement;
27625
+ _this155._metaModels={};_this155._autoAddModels=cfg.autoAddModels!==false;_this155._autoExpandDepth=cfg.autoExpandDepth||0;_this155._sortNodes=cfg.sortNodes!==false;_this155._viewer=viewer;_this155._rootElement=null;_this155._muteSceneEvents=false;_this155._muteTreeEvents=false;_this155._rootNodes=[];_this155._objectNodes={};// Object ID -> Node
27626
+ _this155._nodeNodes={};// Node ID -> Node
27627
+ _this155._rootNames={};// Node ID -> Root name
27628
+ _this155._sortNodes=cfg.sortNodes;_this155._pruneEmptyNodes=cfg.pruneEmptyNodes;_this155._showListItemElementId=null;// this._renderService = cfg.renderService || new RenderService();
27372
27629
  // if (!this._renderService) {
27373
27630
  // throw new Error('TreeViewPlugin: no render service set');
27374
27631
  // }
27375
27632
  // this._containerElement.oncontextmenu = (e) => {
27376
27633
  // e.preventDefault();
27377
27634
  // };
27378
- _this154._onObjectVisibility=_this154._viewer.scene.on("objectVisibility",function(entity){if(_this154._muteSceneEvents){return;}var objectId=entity.id;var node=_this154._objectNodes[objectId];if(!node){return;// Not in this tree
27379
- }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this154._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}// this._renderService.setCheckbox(node.nodeId, visible);
27635
+ _this155._onObjectVisibility=_this155._viewer.scene.on("objectVisibility",function(entity){if(_this155._muteSceneEvents){return;}var objectId=entity.id;var node=_this155._objectNodes[objectId];if(!node){return;// Not in this tree
27636
+ }var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this155._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}// this._renderService.setCheckbox(node.nodeId, visible);
27380
27637
  var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
27381
- parent=parent.parent;}_this154._muteTreeEvents=false;});_this154._onObjectXrayed=_this154._viewer.scene.on("objectXRayed",function(entity){if(_this154._muteSceneEvents){return;}var objectId=entity.id;var node=_this154._objectNodes[objectId];if(!node){return;// Not in this tree
27382
- }_this154._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;// this._renderService.setXRayed(node.nodeId, xrayed);
27383
- _this154._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27638
+ parent=parent.parent;}_this155._muteTreeEvents=false;});_this155._onObjectXrayed=_this155._viewer.scene.on("objectXRayed",function(entity){if(_this155._muteSceneEvents){return;}var objectId=entity.id;var node=_this155._objectNodes[objectId];if(!node){return;// Not in this tree
27639
+ }_this155._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;// this._renderService.setXRayed(node.nodeId, xrayed);
27640
+ _this155._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27384
27641
  // this.switchExpandHandler(event)
27385
27642
  // };
27386
27643
  // this._switchCollapseHandler = (event) => {
@@ -27389,8 +27646,8 @@ _this154._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27389
27646
  // this._checkboxChangeHandler = (event) => {
27390
27647
  // this.checkboxChangeHandler(event)
27391
27648
  // };
27392
- _this154._hierarchy=cfg.hierarchy||"containment";_this154._autoExpandDepth=cfg.autoExpandDepth||0;if(_this154._autoAddModels){var modelIds=Object.keys(_this154.viewer.metaScene.metaModels);for(var _i568=0,len=modelIds.length;_i568<len;_i568++){var modelId=modelIds[_i568];var metaModel=_this154.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this154.addModel(modelId);}}_this154.viewer.scene.on("modelLoaded",function(modelId){if(_this154.viewer.metaScene.metaModels[modelId]){_this154.addModel(modelId);}});}return _this154;}//展开点击事件
27393
- _inherits(TreeViewPlugin,_Plugin11);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
27649
+ _this155._hierarchy=cfg.hierarchy||"containment";_this155._autoExpandDepth=cfg.autoExpandDepth||0;if(_this155._autoAddModels){var modelIds=Object.keys(_this155.viewer.metaScene.metaModels);for(var _i568=0,len=modelIds.length;_i568<len;_i568++){var modelId=modelIds[_i568];var metaModel=_this155.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this155.addModel(modelId);}}_this155.viewer.scene.on("modelLoaded",function(modelId){if(_this155.viewer.metaScene.metaModels[modelId]){_this155.addModel(modelId);}});}return _this155;}//展开点击事件
27650
+ _inherits(TreeViewPlugin,_Plugin12);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
27394
27651
  this.fire("ExpandHandler",event);}//收起点击事件
27395
27652
  },{key:"switchCollapseHandler",value:function switchCollapseHandler(event){event.preventDefault();event.stopPropagation();// const switchElement = event.target;
27396
27653
  // this._collapseSwitchElement(switchElement);
@@ -27501,11 +27758,11 @@ return true;}/**
27501
27758
  * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
27502
27759
  * and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
27503
27760
  * name. This option allows to override that name when it is not suitable as a display name.
27504
- */},{key:"addModel",value:function addModel(modelId){var _this155=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
27761
+ */},{key:"addModel",value:function addModel(modelId){var _this156=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
27505
27762
  // return;
27506
27763
  // }
27507
27764
  var model=this.viewer.scene.models[modelId];if(!model){throw"Model not found: "+modelId;}var metaModel=this.viewer.metaScene.metaModels[modelId];if(!metaModel){this.error("MetaModel not found: "+modelId);return;}if(this._metaModels[modelId]){this._metaModels[modelId]=null;// this.warn("Model already added: " + modelId);
27508
- return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this155.removeModel(model.id);});this._createNodes();}/**
27765
+ return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this156.removeModel(model.id);});this._createNodes();}/**
27509
27766
  * Removes a model from this tree view.
27510
27767
  *
27511
27768
  * Does nothing if model not currently in tree view.
@@ -27674,12 +27931,12 @@ var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title
27674
27931
  */var ObjectCullStates=/*#__PURE__*/function(){/**
27675
27932
  * @private
27676
27933
  * @param scene
27677
- */function ObjectCullStates(scene){var _this156=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
27934
+ */function ObjectCullStates(scene){var _this157=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
27678
27935
  this._objectsViewCulled=[];// A flag for each object to indicate its view-cull status
27679
27936
  this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
27680
27937
  this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
27681
27938
  this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
27682
- this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this156._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this156._dirty){_this156._build();}_this156._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this157=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this157._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i578=0;_i578<this._numObjects;_i578++){this._objects[_i578]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i579=0;_i579<this._lenObjectsChangedList;_i579++){var objectIdx=this._objectsChangedList[_i579];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
27939
+ this._modelInfos={};this._numObjects=0;this._lenObjectsChangedList=0;this._dirty=true;this._onModelLoaded=scene.on("modelLoaded",function(modelId){var model=scene.models[modelId];if(model){_this157._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this157._dirty){_this157._build();}_this157._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this158=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this158._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._dirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._dirty=true;}}},{key:"_build",value:function _build(){if(!this._dirty){return;}this._applyChanges();var objects=this._scene.objects;for(var _i578=0;_i578<this._numObjects;_i578++){this._objects[_i578]=null;}this._numObjects=0;for(var objectId in objects){var entity=objects[objectId];this._objects[this._numObjects++]=entity;}this._lenObjectsChangedList=0;this._dirty=false;}},{key:"_applyChanges",value:function _applyChanges(){if(this._lenObjectsChangedList>0){for(var _i579=0;_i579<this._lenObjectsChangedList;_i579++){var objectIdx=this._objectsChangedList[_i579];var object=this._objects[objectIdx];var viewCulled=this._objectsViewCulled[objectIdx];var detailCulled=this._objectsDetailCulled[objectIdx];var culled=viewCulled||detailCulled;object.culled=culled;this._objectsChanged[objectIdx]=false;}this._lenObjectsChangedList=0;}}/**
27683
27940
  * Array of {@link Entity} instances that represent objects in the {@link Scene}.
27684
27941
  *
27685
27942
  * ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
@@ -27740,15 +27997,15 @@ var kdTreeDimLength=new Float32Array(3);/**
27740
27997
  * src: "./models/xtc/OTCConferenceCenter.xtc"
27741
27998
  * });
27742
27999
  * ````
27743
- */var ViewCullPlugin=/*#__PURE__*/function(_Plugin12){/**
28000
+ */var ViewCullPlugin=/*#__PURE__*/function(_Plugin13){/**
27744
28001
  * @constructor
27745
28002
  * @param {Viewer} viewer The Viewer.
27746
28003
  * @param {Object} cfg Plugin configuration.
27747
28004
  * @param {String} [cfg.id="ViewCull"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
27748
28005
  * @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.
27749
- */function ViewCullPlugin(viewer){var _this158;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this158=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this158._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
27750
- _this158._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this158._modelInfos={};_this158._frustum=new Frustum$1();_this158._kdRoot=null;_this158._frustumDirty=false;_this158._kdTreeDirty=false;_this158._insideView=false;_this158.enabled=cfg.enabled;var camera=viewer.scene.camera;_this158._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this158._frustumDirty=true;});_this158._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this158._frustumDirty=true;});_this158._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this158.viewer.scene.models[modelId];if(model){_this158._addModel(model);}});_this158._onSceneTick=viewer.scene.on("tick",function(){if(_this158._enabled)_this158._doCull();_this158.insideView=_this158.isBoxInFrustum(_this158.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this158;}//包围盒和视锥相交测试
27751
- _inherits(ViewCullPlugin,_Plugin12);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i580=0;_i580<6;_i580++){var plane=frustumPlanes[_i580];var _p4=[plane[0]>0?aabb[3]:aabb[0],plane[1]>0?aabb[4]:aabb[1],plane[2]>0?aabb[5]:aabb[2]];if(plane[0]*_p4[0]+plane[1]*_p4[1]+plane[2]*_p4[2]+plane[3]<0){return false;}}return true;}//视锥计算
28006
+ */function ViewCullPlugin(viewer){var _this159;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this159=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this159._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
28007
+ _this159._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this159._modelInfos={};_this159._frustum=new Frustum$1();_this159._kdRoot=null;_this159._frustumDirty=false;_this159._kdTreeDirty=false;_this159._insideView=false;_this159.enabled=cfg.enabled;var camera=viewer.scene.camera;_this159._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this159._frustumDirty=true;});_this159._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this159._frustumDirty=true;});_this159._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this159.viewer.scene.models[modelId];if(model){_this159._addModel(model);}});_this159._onSceneTick=viewer.scene.on("tick",function(){if(_this159._enabled)_this159._doCull();_this159.insideView=_this159.isBoxInFrustum(_this159.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this159;}//包围盒和视锥相交测试
28008
+ _inherits(ViewCullPlugin,_Plugin13);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i580=0;_i580<6;_i580++){var plane=frustumPlanes[_i580];var _p4=[plane[0]>0?aabb[3]:aabb[0],plane[1]>0?aabb[4]:aabb[1],plane[2]>0?aabb[5]:aabb[2]];if(plane[0]*_p4[0]+plane[1]*_p4[1]+plane[2]*_p4[2]+plane[3]<0){return false;}}return true;}//视锥计算
27752
28009
  },{key:"extractFrustumPlanes",value:function extractFrustumPlanes(projectionMatrix,viewMatrix){var combinedMatrix=math.identityMat4();math.mulMat4(projectionMatrix,viewMatrix,combinedMatrix);var planes=[];for(var _i581=0;_i581<6;_i581++){planes.push(math.identityMat4());}// Left plane
27753
28010
  planes[0][0]=combinedMatrix[3]+combinedMatrix[0];planes[0][1]=combinedMatrix[7]+combinedMatrix[4];planes[0][2]=combinedMatrix[11]+combinedMatrix[8];planes[0][3]=combinedMatrix[15]+combinedMatrix[12];// Right plane
27754
28011
  planes[1][0]=combinedMatrix[3]-combinedMatrix[0];planes[1][1]=combinedMatrix[7]-combinedMatrix[4];planes[1][2]=combinedMatrix[11]-combinedMatrix[8];planes[1][3]=combinedMatrix[15]-combinedMatrix[12];// Bottom plane
@@ -27763,7 +28020,7 @@ planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-
27763
28020
  * Gets whether view culling is enabled.
27764
28021
  *
27765
28022
  * @retutns {Boolean} Whether view culling is enabled.
27766
- */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this159=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this159._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);// this.insideView = intersects == 0 || intersects == 1;
28023
+ */function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this160=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this160._removeModel(model);})};this._modelInfos[model.id]=modelInfo;this._kdTreeDirty=true;}},{key:"_removeModel",value:function _removeModel(model){var modelInfo=this._modelInfos[model.id];if(modelInfo){modelInfo.model.off(modelInfo.onDestroyed);delete this._modelInfos[model.id];this._kdTreeDirty=true;}}},{key:"_doCull",value:function _doCull(){var cullDirty=this._frustumDirty||this._kdTreeDirty;if(this._frustumDirty){this._buildFrustum();}if(this._kdTreeDirty){this._buildKDTree();}if(cullDirty){var kdNode=this._kdRoot;if(kdNode){this._visitKDNode(kdNode);}}}},{key:"_buildFrustum",value:function _buildFrustum(){var camera=this.viewer.scene.camera;setFrustum(this._frustum,camera.viewMatrix,camera.projMatrix);this._frustumDirty=false;}},{key:"_buildKDTree",value:function _buildKDTree(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;if(this._kdRoot);this._kdRoot={aabb:scene.getAABB(),intersection:Frustum$1.INTERSECT};for(var objectIdx=0,len=this._objectCullStates.numObjects;objectIdx<len;objectIdx++){var entity=this._objectCullStates.objects[objectIdx];this._insertEntityIntoKDTree(this._kdRoot,entity,objectIdx,depth+1);}this._kdTreeDirty=false;}},{key:"_insertEntityIntoKDTree",value:function _insertEntityIntoKDTree(kdNode,entity,objectIdx,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);return;}if(kdNode.left){if(math.containsAABB3(kdNode.left.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(kdNode.right){if(math.containsAABB3(kdNode.right.aabb,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}var nodeAABB=kdNode.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!kdNode.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.left={aabb:aabbLeft,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntityIntoKDTree(kdNode.left,entity,objectIdx,depth+1);return;}}if(!kdNode.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;kdNode.right={aabb:aabbRight,intersection:Frustum$1.INTERSECT};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntityIntoKDTree(kdNode.right,entity,objectIdx,depth+1);return;}}kdNode.objects=kdNode.objects||[];kdNode.objects.push(objectIdx);math.expandAABB3(kdNode.aabb,entityAABB);}},{key:"_visitKDNode",value:function _visitKDNode(kdNode){var intersects=arguments.length>1&&arguments[1]!==undefined?arguments[1]:Frustum$1.INTERSECT;if(intersects!==Frustum$1.INTERSECT&&kdNode.intersects===intersects){return;}if(intersects===Frustum$1.INTERSECT){intersects=frustumIntersectsAABB3(this._frustum,kdNode.aabb);// this.insideView = intersects == 0 || intersects == 1;
27767
28024
  kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i583=0,len=objects.length;_i583<len;_i583++){var objectIdx=objects[_i583];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
27768
28025
  * @private
27769
28026
  */},{key:"send",value:function send(name,value){}/**
@@ -27792,9 +28049,29 @@ kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var obje
27792
28049
  var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.decodeURIComponent(data);if(isBase64){data=window.atob(data);}try{var buffer=new ArrayBuffer(data.length);var view=new Uint8Array(buffer);for(var i=0;i<data.length;i++){view[i]=data.charCodeAt(i);}ok(buffer);}catch(errMsg){error(errMsg);}}else{var request=new XMLHttpRequest();request.open("GET",src,true);request.responseType="arraybuffer";request.onreadystatechange=function(){if(request.readyState===4){if(request.status===200){ok(request.response);}else{error("getXTC error : "+request.response);}}};request.send(null);}}}]);}();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof2(exports))&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a7=i;_a7<s;_a7++)t=t>>>8^n[255&(t^e[_a7])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i584=-1;if(_i584=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i584<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i585=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i585>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i585-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i585),a.pending),a.pending+=_i585,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i586=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i586&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i586,_i586)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i586=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i586&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i586,_i586)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i587=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i587&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i587,_i587)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i587=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i587&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i587,_i587));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i588=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i588&&4!==_i588||(a.status=bt),1===_i588||3===_i588)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i588&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e7);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a8=e.shift();if(_a8){if("object"!=_typeof2(_a8))throw new TypeError(_a8+"must be non-object");for(var _e8 in _a8)Ht(_a8,_e8)&&(t[_e8]=_a8[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a9=0,_i589=t.length;_a9<_i589;_a9++)e+=t[_a9].length;var a=new Uint8Array(e);for(var _e9=0,_i590=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i590),_i590+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++)Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e10=t[i++];if(_e10<128){s[n++]=_e10;continue;}var _r6=Yt[_e10];if(_r6>4)s[n++]=65533,i+=_r6-1;else{for(_e10&=2===_r6?31:3===_r6?15:7;_r6>1&&i<a;)_e10=_e10<<6|63&t[i++],_r6--;_r6>1?s[n++]=65533:_e10<65536?s[n++]=_e10:(_e10-=65536,s[n++]=55296|_e10>>10&1023,s[n++]=56320|1023&_e10);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i591=0;_i591<e;_i591++)a+=String.fromCharCode(t[_i591]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e11=0;for(;_e11<144;)t.lens[_e11++]=8;for(;_e11<256;)t.lens[_e11++]=9;for(;_e11<280;)t.lens[_e11++]=7;for(;_e11<288;)t.lens[_e11++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e11=0;_e11<32;)t.lens[_e11++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e12=a.next_out-_t6,_n5=Xt(a.output,_t6);a.next_out=_e12,a.avail_out=i-_e12,_e12&&a.output.set(a.output.subarray(_t6,_t6+_e12),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
27793
28050
  Parser for .XTC Format V10
27794
28051
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
27795
- 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?
27796
- 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
27797
- 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))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}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;// Metadata
28052
+ pako=pako["default"];}var tempVec4a=math.vec4();var tempVec4b=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;/**
28053
+ * Ordered element schema for .XTC V10.
28054
+ *
28055
+ * Each entry: [elementName, TypedArrayConstructor | "json"]
28056
+ *
28057
+ * The order MUST match the element order within the XTC binary. "json" elements are
28058
+ * deflated JSON strings, everything else is a deflated binary buffer.
28059
+ *
28060
+ * Shared by the synchronous inflate path and the Web Worker inflate path, so that
28061
+ * both reconstruct identical inflated-data objects.
28062
+ */var ELEMENT_SPECS=[["metadata","json"],["textureData",Uint8Array],["eachTextureDataPortion",Uint32Array],["eachTextureAttributes",Uint16Array],["positions",Uint16Array],["normals",Int8Array],["colors",Uint8Array],["uvs",Float32Array],["indices",Uint32Array],["edgeIndices",Uint32Array],["eachTextureSetTextures",Int32Array],["matrices",Float32Array],["reusedGeometriesDecodeMatrix",Float32Array],["eachGeometryPrimitiveType",Uint8Array],["eachGeometryPositionsPortion",Uint32Array],["eachGeometryNormalsPortion",Uint32Array],["eachGeometryColorsPortion",Uint32Array],["eachGeometryUVsPortion",Uint32Array],["eachGeometryIndicesPortion",Uint32Array],["eachGeometryEdgeIndicesPortion",Uint32Array],["eachMeshGeometriesPortion",Uint32Array],["eachMeshMatricesPortion",Uint32Array],["eachMeshTextureSet",Int32Array],["eachMeshMaterialAttributes",Uint8Array],["eachEntityId","json"],["eachEntityMeshesPortion",Uint32Array],["eachTileAABB",Float64Array],["eachTileEntitiesPortion",Uint32Array]];function extract(elements){var deflatedData={};for(var _i592=0;_i592<ELEMENT_SPECS.length;_i592++){deflatedData[ELEMENT_SPECS[_i592][0]]=elements[_i592];}return deflatedData;}function inflate(deflatedData){var inflatedData={};for(var _i593=0;_i593<ELEMENT_SPECS.length;_i593++){var spec=ELEMENT_SPECS[_i593];var _name8=spec[0];var type=spec[1];var deflated=deflatedData[_name8];if(type==="json"){inflatedData[_name8]=JSON.parse(pako.inflate(deflated,{to:"string"}));}else{inflatedData[_name8]=new type(deflated.length===0?[]:pako.inflate(deflated).buffer);}}return inflatedData;}/**
28063
+ * Builds transfer-friendly descriptors of the deflated elements, so the whole XTC
28064
+ * ArrayBuffer can be transferred to a Web Worker which then inflates each segment.
28065
+ *
28066
+ * @param {Uint8Array[]} elements Deflated elements extracted from the XTC binary.
28067
+ * @returns {{name: string, byteOffset: number, byteLength: number, json: boolean}[]}
28068
+ */function getDeflatedSegments(elements){var segments=[];for(var _i594=0;_i594<ELEMENT_SPECS.length;_i594++){var view=elements[_i594];segments.push({name:ELEMENT_SPECS[_i594][0],byteOffset:view.byteOffset,byteLength:view.byteLength,json:ELEMENT_SPECS[_i594][1]==="json"});}return segments;}/**
28069
+ * Reconstructs the inflated-data object from the results posted back by the inflate worker.
28070
+ *
28071
+ * @param {(ArrayBuffer|string)[]} results Inflated results in ELEMENT_SPECS order -
28072
+ * ArrayBuffers for binary elements, strings for "json" elements.
28073
+ * @returns {*} The same inflated-data structure produced by the synchronous inflate path.
28074
+ */function wrapInflatedResults(results){var inflatedData={};for(var _i595=0;_i595<ELEMENT_SPECS.length;_i595++){var spec=ELEMENT_SPECS[_i595];var _name9=spec[0];var type=spec[1];var result=results[_i595];inflatedData[_name9]=type==="json"?JSON.parse(result):new type(result);}return inflatedData;}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}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;// Metadata
27798
28075
  if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
27799
28076
  }// Create textures
27800
28077
  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;eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
@@ -27810,8 +28087,54 @@ if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.
27810
28087
  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
27811
28088
  for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex*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
27812
28089
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
27813
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+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 _i592=0,len=geometryPositions.length;_i592<len;_i592+=3){decompressedPositions[_i592+0]=geometryPositions[_i592+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i592+1]=geometryPositions[_i592+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i592+2]=geometryPositions[_i592+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i593=0,_len109=_decompressedPositions.length;_i593<_len109;_i593+=3){tempVec4a[0]=_decompressedPositions[_i593+0];tempVec4a[1]=_decompressedPositions[_i593+1];tempVec4a[2]=_decompressedPositions[_i593+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i593+0]=tempVec4a[0];transformedAndRecompressedPositions[_i593+1]=tempVec4a[1];transformedAndRecompressedPositions[_i593+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
27814
- var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;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]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;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]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;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]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,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 _i594=0,len=indices.length-1;_i594<len;_i594++){linesIndices.push(indices[_i594]);linesIndices.push(indices[_i594+1]);}}else if(positions.length>1){for(var _i595=0,_len110=positions.length/3-1;_i595<_len110;_i595++){linesIndices.push(_i595);linesIndices.push(_i595+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);},inflateMetadata:inflateMetadata};var parsers={};// parsers[ParserV1.version] = ParserV1;
28090
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+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 _i596=0,len=geometryPositions.length;_i596<len;_i596+=3){decompressedPositions[_i596+0]=geometryPositions[_i596+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i596+1]=geometryPositions[_i596+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i596+2]=geometryPositions[_i596+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i597=0,_len109=_decompressedPositions.length;_i597<_len109;_i597+=3){tempVec4a[0]=_decompressedPositions[_i597+0];tempVec4a[1]=_decompressedPositions[_i597+1];tempVec4a[2]=_decompressedPositions[_i597+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i597+0]=tempVec4a[0];transformedAndRecompressedPositions[_i597+1]=tempVec4a[1];transformedAndRecompressedPositions[_i597+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
28091
+ var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;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]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;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]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;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]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices&&geometryIndices.length>0?geometryIndices:null,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 _i598=0,len=indices.length-1;_i598<len;_i598++){linesIndices.push(indices[_i598]);linesIndices.push(indices[_i598+1]);}}else if(positions.length>1){for(var _i599=0,_len110=positions.length/3-1;_i599<_len110;_i599++){linesIndices.push(_i599);linesIndices.push(_i599+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);},/**
28092
+ * Parses a model from already-inflated data (eg. inflated within a Web Worker).
28093
+ */parseInflated:function parseInflated(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},getDeflatedSegments:getDeflatedSegments,wrapInflatedResults:wrapInflatedResults,inflateMetadata:inflateMetadata};/**
28094
+ * Web Worker based geometry inflater for {@link XTCLoaderPlugin}.
28095
+ *
28096
+ * Moves the CPU-intensive pako inflation of .XTC geometry elements off the main thread,
28097
+ * keeping the page responsive while large models load. The whole XTC ArrayBuffer is
28098
+ * transferred (not copied) into the worker, which also releases the compressed data
28099
+ * from the main thread's memory as early as possible.
28100
+ *
28101
+ * The worker is created from an inline Blob (same pattern as the metadata inflate worker
28102
+ * in XTCLoaderPlugin) and loads pako via importScripts(). When pako cannot be loaded
28103
+ * (eg. offline environment), the handshake fails and XTCLoaderPlugin falls back to
28104
+ * synchronous main-thread inflation.
28105
+ *
28106
+ * @private
28107
+ */ /**
28108
+ * Default URL of the pako library loaded into the worker via importScripts().
28109
+ * Version matches the bundled parsers/lib/pako.js (2.1.0).
28110
+ * Can be overridden through XTCLoaderPlugin cfg.pakoUrl, eg. with a locally hosted copy.
28111
+ */var DEFAULT_PAKO_URL="https://cdnjs.cloudflare.com/ajax/libs/pako/2.1.0/pako.min.js";function buildWorkerSource(pakoUrl){return"\n\t\tvar pakoReady = false;\n\t\ttry {\n\t\t\tself.importScripts(".concat(JSON.stringify(pakoUrl),");\n\t\t\tpakoReady = !!(self.pako && self.pako.inflate);\n\t\t} catch (err) {\n\t\t\tpakoReady = false;\n\t\t}\n\n\t\tself.onmessage = function (e) {\n\t\t\tvar msg = e.data;\n\t\t\tif (msg.cmd === \"ping\") {\n\t\t\t\tself.postMessage({ cmd: \"pong\", pakoReady: pakoReady });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (msg.cmd !== \"inflate\") {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (!pakoReady) {\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, error: \"pako unavailable in worker\" });\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tvar fileBytes = new Uint8Array(msg.buffer);\n\t\t\t\tvar segments = msg.segments;\n\t\t\t\tvar results = new Array(segments.length);\n\t\t\t\tvar transferables = [];\n\t\t\t\tfor (var i = 0; i < segments.length; i++) {\n\t\t\t\t\tvar seg = segments[i];\n\t\t\t\t\tif (seg.byteLength === 0) {\n\t\t\t\t\t\tresults[i] = seg.json ? \"\" : new ArrayBuffer(0);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar deflated = fileBytes.subarray(seg.byteOffset, seg.byteOffset + seg.byteLength);\n\t\t\t\t\tif (seg.json) {\n\t\t\t\t\t\tresults[i] = self.pako.inflate(deflated, { to: \"string\" });\n\t\t\t\t\t} else {\n\t\t\t\t\t\tvar inflated = self.pako.inflate(deflated);\n\t\t\t\t\t\tvar buffer = (inflated.byteOffset === 0 && inflated.byteLength === inflated.buffer.byteLength)\n\t\t\t\t\t\t\t? inflated.buffer\n\t\t\t\t\t\t\t: inflated.slice().buffer;\n\t\t\t\t\t\tresults[i] = buffer;\n\t\t\t\t\t\ttransferables.push(buffer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, results: results }, transferables);\n\t\t\t} catch (err) {\n\t\t\t\tself.postMessage({ cmd: \"inflated\", id: msg.id, error: String((err && err.message) || err) });\n\t\t\t}\n\t\t};\n\t");}/**
28112
+ * Thin promise-based wrapper around the inline inflate Worker.
28113
+ *
28114
+ * @private
28115
+ */var XTCInflateWorker=/*#__PURE__*/function(){/**
28116
+ * @param {String} [pakoUrl] URL of the pako library to importScripts() within the worker.
28117
+ */function XTCInflateWorker(pakoUrl){var _this161=this;_classCallCheck(this,XTCInflateWorker);var source=buildWorkerSource(pakoUrl||DEFAULT_PAKO_URL);var blob=new Blob([source],{type:"application/javascript"});this._workerUrl=URL.createObjectURL(blob);this._worker=new Worker(this._workerUrl);this._nextRequestId=0;this._requests=new Map();// requestId -> {resolve, reject}
28118
+ this._onPong=null;this._onPongError=null;this._worker.onmessage=function(e){var msg=e.data;if(msg.cmd==="pong"){if(_this161._onPong){var onPong=_this161._onPong;_this161._onPong=null;_this161._onPongError=null;onPong(msg.pakoReady);}return;}if(msg.cmd==="inflated"){var request=_this161._requests.get(msg.id);if(request){_this161._requests["delete"](msg.id);if(msg.error){request.reject(new Error(msg.error));}else{request.resolve(msg.results);}}}};this._worker.onerror=function(e){var err=new Error(e.message||"XTC inflate worker error");if(_this161._onPongError){var onPongError=_this161._onPongError;_this161._onPong=null;_this161._onPongError=null;onPongError(err);}var _iterator42=_createForOfIteratorHelper(_this161._requests.values()),_step42;try{for(_iterator42.s();!(_step42=_iterator42.n()).done;){var request=_step42.value;request.reject(err);}}catch(err){_iterator42.e(err);}finally{_iterator42.f();}_this161._requests.clear();};}/**
28119
+ * Verifies that the worker booted and pako is available within it.
28120
+ * Rejects on timeout or when pako could not be loaded.
28121
+ *
28122
+ * @param {Number} [timeoutMs=15000] Handshake timeout - first load may fetch pako from a CDN.
28123
+ * @returns {Promise<void>}
28124
+ */return _createClass(XTCInflateWorker,[{key:"init",value:function init(){var _this162=this;var timeoutMs=arguments.length>0&&arguments[0]!==undefined?arguments[0]:15000;return new Promise(function(resolve,reject){var timer=setTimeout(function(){_this162._onPong=null;_this162._onPongError=null;reject(new Error("XTC inflate worker handshake timeout"));},timeoutMs);_this162._onPong=function(pakoReady){clearTimeout(timer);if(pakoReady){resolve();}else{reject(new Error("pako failed to load in XTC inflate worker"));}};_this162._onPongError=function(err){clearTimeout(timer);reject(err);};_this162._worker.postMessage({cmd:"ping"});});}/**
28125
+ * Inflates the given segments of an XTC file within the worker.
28126
+ *
28127
+ * NOTE: arrayBuffer is TRANSFERRED to the worker and becomes unusable (detached)
28128
+ * on the calling thread.
28129
+ *
28130
+ * @param {ArrayBuffer} arrayBuffer The whole XTC file buffer.
28131
+ * @param {{name: string, byteOffset: number, byteLength: number, json: boolean}[]} segments
28132
+ * Deflated element descriptors, as built by ParserV10.getDeflatedSegments().
28133
+ * @returns {Promise<(ArrayBuffer|string)[]>} Inflated results in segment order -
28134
+ * ArrayBuffers for binary elements, strings for JSON elements.
28135
+ */},{key:"inflate",value:function inflate(arrayBuffer,segments){var _this163=this;return new Promise(function(resolve,reject){var id=_this163._nextRequestId++;_this163._requests.set(id,{resolve:resolve,reject:reject});_this163._worker.postMessage({cmd:"inflate",id:id,buffer:arrayBuffer,segments:segments},[arrayBuffer]);});}/**
28136
+ * Terminates the worker and rejects all pending requests.
28137
+ */},{key:"destroy",value:function destroy(){var _iterator43=_createForOfIteratorHelper(this._requests.values()),_step43;try{for(_iterator43.s();!(_step43=_iterator43.n()).done;){var request=_step43.value;request.reject(new Error("XTC inflate worker destroyed"));}}catch(err){_iterator43.e(err);}finally{_iterator43.f();}this._requests.clear();this._onPong=null;this._onPongError=null;this._worker.terminate();URL.revokeObjectURL(this._workerUrl);}}]);}();var parsers={};// parsers[ParserV1.version] = ParserV1;
27815
28138
  // parsers[ParserV2.version] = ParserV2;
27816
28139
  // parsers[ParserV3.version] = ParserV3;
27817
28140
  // parsers[ParserV4.version] = ParserV4;
@@ -28376,7 +28699,7 @@ parsers[ParserV10.version]=ParserV10;/**
28376
28699
  * ````
28377
28700
  *
28378
28701
  * @class XTCLoaderPlugin
28379
- */var XTCLoaderPlugin=/*#__PURE__*/function(_Plugin13){/**
28702
+ */var XTCLoaderPlugin=/*#__PURE__*/function(_Plugin14){/**
28380
28703
  * @constructor
28381
28704
  *
28382
28705
  * @param {Viewer} viewer The Viewer.
@@ -28398,10 +28721,10 @@ parsers[ParserV10.version]=ParserV10;/**
28398
28721
  * and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.
28399
28722
  * @param {KTX2TextureTranscoder} [cfg.textureTranscoder] Transcoder used internally to transcode KTX2
28400
28723
  * textures within the XTC. Only required when the XTC is version 10 or later, and contains KTX2 textures.
28401
- */function XTCLoaderPlugin(viewer){var _this160;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XTCLoaderPlugin);_this160=_callSuper(this,XTCLoaderPlugin,["XTCLoader",viewer,cfg]);_this160._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this160.textureTranscoder=cfg.textureTranscoder;_this160.dataSource=cfg.dataSource;_this160.objectDefaults=cfg.objectDefaults;_this160.includeTypes=cfg.includeTypes;_this160.excludeTypes=cfg.excludeTypes;_this160.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this160.reuseGeometries=cfg.reuseGeometries;return _this160;}/**
28724
+ */function XTCLoaderPlugin(viewer){var _this164;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XTCLoaderPlugin);_this164=_callSuper(this,XTCLoaderPlugin,["XTCLoader",viewer,cfg]);_this164._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this164.textureTranscoder=cfg.textureTranscoder;_this164.dataSource=cfg.dataSource;_this164.objectDefaults=cfg.objectDefaults;_this164.includeTypes=cfg.includeTypes;_this164.excludeTypes=cfg.excludeTypes;_this164.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this164.reuseGeometries=cfg.reuseGeometries;_this164._inflateWorkerEnabled=cfg.inflateWorkerEnabled!==false;_this164._pakoUrl=cfg.pakoUrl;_this164._inflateWorker=null;_this164._inflateWorkerUnavailable=false;return _this164;}/**
28402
28725
  * Gets the ````.xtc```` format versions supported by this XTCLoaderPlugin/
28403
28726
  * @returns {string[]}
28404
- */_inherits(XTCLoaderPlugin,_Plugin13);return _createClass(XTCLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
28727
+ */_inherits(XTCLoaderPlugin,_Plugin14);return _createClass(XTCLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
28405
28728
  * Gets the texture transcoder.
28406
28729
  *
28407
28730
  * @type {TextureTranscoder}
@@ -28561,6 +28884,7 @@ parsers[ParserV10.version]=ParserV10;/**
28561
28884
  * @param {Boolean} [params.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) is enabled for the model. SAO is configured by the Scene's {@link SAO} component. Only works when {@link SAO#enabled} is also ````true````
28562
28885
  * @param {Boolean} [params.pbrEnabled=true] Indicates if physically-based rendering (PBR) is enabled for the model. Overrides ````colorTextureEnabled````. Only works when {@link Scene#pbrEnabled} is also ````true````.
28563
28886
  * @param {Boolean} [params.colorTextureEnabled=true] Indicates if base color texture rendering is enabled for the model. Overridden by ````pbrEnabled````. Only works when {@link Scene#colorTextureEnabled} is also ````true````.
28887
+ * @param {Number} [params.brightness=1.0] Brightness factor applied to the model's base vertex color on finalize. A value > 1 brightens the model (e.g. ````1.4```` to compensate for texture double-multiplication on GLB files), < 1 darkens. Only affects this model, not the whole scene.
28564
28888
  * @param {Number} [params.backfaces=false] When we set this ````true````, then we force rendering of backfaces for the model. When
28565
28889
  * we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the
28566
28890
  * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
@@ -28575,14 +28899,27 @@ parsers[ParserV10.version]=ParserV10;/**
28575
28899
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
28576
28900
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
28577
28901
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
28578
- */},{key:"load",value:function load(){var _this161=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
28579
- }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i596=0,len=includeTypes.length;_i596<len;_i596++){options.includeTypesMap[includeTypes[_i596]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i597=0,_len111=excludeTypes.length;_i597<_len111;_i597++){options.excludeTypesMap[excludeTypes[_i597]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
28902
+ */},{key:"load",value:function load(){var _this165=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
28903
+ }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i600=0,len=includeTypes.length;_i600<len;_i600++){options.includeTypesMap[includeTypes[_i600]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i601=0,_len111=excludeTypes.length;_i601<_len111;_i601++){options.excludeTypesMap[excludeTypes[_i601]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
28580
28904
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
28581
- sceneModel.finalize();metaModel.finalize();_this161.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this161.viewer.metaScene.destroyMetaModel(metaModel.id);});_this161.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
28905
+ sceneModel.finalize();metaModel.finalize();_this165.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this165.viewer.metaScene.destroyMetaModel(metaModel.id);});_this165.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
28582
28906
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
28583
- });};var error=function error(errMsg){_this161.viewer.scene.canvas.spinner.processes--;_this161.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
28584
- 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){_this161._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this161._parseModel(params.xtc,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.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this161._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this161.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this161._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this161._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx);sceneModel.preFinalize();i++;_this161.scheduleTask(_loadNext2,200);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
28585
- var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this161._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this161._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this161.scheduleTask(_loadNext3,100);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this162=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this162._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i598,elementSize;return _regeneratorRuntime().wrap(function _callee8$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:if(!sceneModel.destroyed){_context11.next=2;break;}return _context11.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context11.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context11.abrupt("return");case 9:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i598=0;_i598<numElements;_i598++){elementSize=dataView.getUint32((_i598+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 15:case"end":return _context11.stop();}},_callee8,this);}));function _parseModel(_x104,_x105,_x106,_x107,_x108,_x109){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this163=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this163.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this163.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28907
+ });};var error=function error(errMsg){_this165.viewer.scene.canvas.spinner.processes--;_this165.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
28908
+ 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){_this165._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this165._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}},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.xtc,params,options,sceneModel,null,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx).then(finish)["catch"](function(err){return error("load(): Failed to parse model '".concat(modelId,"' - ").concat(err&&err.message||err));});}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this165._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this165.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this165._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx).then(function(){sceneModel.preFinalize();i++;_this165.scheduleTask(_loadNext2,200);})["catch"](error);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
28909
+ var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this165._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx).then(function(){sceneModel.preFinalize();i++;_this165.scheduleTask(_loadNext3,100);})["catch"](error);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this166=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this166._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx).then(function(){sceneModel.preFinalize();done();})["catch"](error);},error);}/**
28910
+ * Gets the shared geometry inflate worker, creating and verifying it on first use.
28911
+ *
28912
+ * Returns `null` when worker-based inflation is disabled or unavailable (eg. pako
28913
+ * could not be loaded within the worker) - callers then fall back to synchronous
28914
+ * main-thread inflation.
28915
+ *
28916
+ * @returns {Promise<XTCInflateWorker|null>}
28917
+ * @private
28918
+ */},{key:"_getInflateWorker",value:(function(){var _getInflateWorker2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(){var inflateWorker;return _regeneratorRuntime().wrap(function _callee8$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:if(!(!this._inflateWorkerEnabled||this._inflateWorkerUnavailable)){_context11.next=2;break;}return _context11.abrupt("return",null);case 2:if(this._inflateWorker){_context11.next=16;break;}inflateWorker=new XTCInflateWorker(this._pakoUrl);_context11.prev=4;_context11.next=7;return inflateWorker.init();case 7:_context11.next=15;break;case 9:_context11.prev=9;_context11.t0=_context11["catch"](4);this.log("XTC geometry inflate worker unavailable, falling back to synchronous inflation: "+(_context11.t0&&_context11.t0.message||_context11.t0));inflateWorker.destroy();this._inflateWorkerUnavailable=true;return _context11.abrupt("return",null);case 15:this._inflateWorker=inflateWorker;case 16:return _context11.abrupt("return",this._inflateWorker);case 17:case"end":return _context11.stop();}},_callee8,this,[[4,9]]);}));function _getInflateWorker(){return _getInflateWorker2.apply(this,arguments);}return _getInflateWorker;}())},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i602,elementSize,inflateWorker,segments,results,inflatedData;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:if(!sceneModel.destroyed){_context12.next=2;break;}return _context12.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context12.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context12.abrupt("return");case 9:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i602=0;_i602<numElements;_i602++){elementSize=dataView.getUint32((_i602+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}if(!(parser.parseInflated&&parser.getDeflatedSegments)){_context12.next=30;break;}_context12.next=17;return this._getInflateWorker();case 17:inflateWorker=_context12.sent;if(!inflateWorker){_context12.next=30;break;}if(!sceneModel.destroyed){_context12.next=21;break;}return _context12.abrupt("return");case 21:segments=parser.getDeflatedSegments(elements);// NOTE: arrayBuffer is transferred into the worker (detached on this thread),
28919
+ // which also releases the compressed file data from main-thread memory early.
28920
+ _context12.next=24;return inflateWorker.inflate(arrayBuffer,segments);case 24:results=_context12.sent;if(!sceneModel.destroyed){_context12.next=27;break;}return _context12.abrupt("return");case 27:inflatedData=parser.wrapInflatedResults(results);parser.parseInflated(this.viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);return _context12.abrupt("return");case 30:parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 31:case"end":return _context12.stop();}},_callee9,this);}));function _parseModel(_x104,_x105,_x106,_x107,_x108,_x109){return _parseModel2.apply(this,arguments);}return _parseModel;}()/**
28921
+ * Destroys this XTCLoaderPlugin, terminating the shared inflate worker if it exists.
28922
+ */},{key:"destroy",value:function destroy(){if(this._inflateWorker){this._inflateWorker.destroy();this._inflateWorker=null;}_superPropGet(XTCLoaderPlugin,"destroy",this,3)([]);}},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this167=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this167.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this167.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
28586
28923
  });worker.onmessage=function(e){if(force){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});}else{plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});}};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
28587
28924
  //
28588
28925
  // const metaModelId = sceneModel.id;
@@ -28990,7 +29327,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
28990
29327
  *
28991
29328
  * @class WebIFCLoaderPlugin
28992
29329
  * @since 2.0.13
28993
- */var WebIFCLoaderPlugin=/*#__PURE__*/function(_Plugin14){/**
29330
+ */var WebIFCLoaderPlugin=/*#__PURE__*/function(_Plugin15){/**
28994
29331
  * @constructor
28995
29332
  *
28996
29333
  * @param {Viewer} viewer The Viewer.
@@ -29002,7 +29339,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
29002
29339
  * @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
29003
29340
  * @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
29004
29341
  * @param {Boolean} [cfg.excludeUnclassifiedObjects=false] When loading metadata and this is ````true````, will only load {@link Entity}s that have {@link MetaObject}s (that are not excluded). This is useful when we don't want Entitys in the Scene that are not represented within IFC navigation components, such as {@link TreeViewPlugin}.
29005
- */function WebIFCLoaderPlugin(viewer){var _this164;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this164=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this164.dataSource=cfg.dataSource;_this164.objectDefaults=cfg.objectDefaults;_this164.includeTypes=cfg.includeTypes;_this164.excludeTypes=cfg.excludeTypes;_this164.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this164._webIFC=cfg.WebIFC;_this164._ifcAPI=cfg.IfcAPI;_this164.webIfcFroMOutside=true;}// else {
29342
+ */function WebIFCLoaderPlugin(viewer){var _this168;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this168=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this168.dataSource=cfg.dataSource;_this168.objectDefaults=cfg.objectDefaults;_this168.includeTypes=cfg.includeTypes;_this168.excludeTypes=cfg.excludeTypes;_this168.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this168._webIFC=cfg.WebIFC;_this168._ifcAPI=cfg.IfcAPI;_this168.webIfcFroMOutside=true;}// else {
29006
29343
  // this._webIFC = WebIFC;
29007
29344
  // this.webIfcFroMOutside = false;
29008
29345
  // this._ifcAPI = new this._webIFC.IfcAPI();
@@ -29018,10 +29355,10 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
29018
29355
  // this.error(e);
29019
29356
  // });
29020
29357
  // }
29021
- return _this164;}/**
29358
+ return _this168;}/**
29022
29359
  * Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.
29023
29360
  * @returns {string[]}
29024
- */_inherits(WebIFCLoaderPlugin,_Plugin14);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
29361
+ */_inherits(WebIFCLoaderPlugin,_Plugin15);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
29025
29362
  * Gets the custom data source through which the WebIFCLoaderPlugin can load IFC files.
29026
29363
  *
29027
29364
  * Default value is {@link WebIFCDefaultDataSource}, which loads via HTTP.
@@ -29151,7 +29488,7 @@ return _this164;}/**
29151
29488
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
29152
29489
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
29153
29490
  */},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
29154
- }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i599=0,len=includeTypes.length;_i599<len;_i599++){options.includeTypesMap[includeTypes[_i599]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i600=0,_len112=excludeTypes.length;_i600<_len112;_i600++){options.excludeTypesMap[excludeTypes[_i600]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
29491
+ }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i603=0,len=includeTypes.length;_i603<len;_i603++){options.includeTypesMap[includeTypes[_i603]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i604=0,_len112=excludeTypes.length;_i604<_len112;_i604++){options.excludeTypesMap[excludeTypes[_i604]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
29155
29492
  // try {
29156
29493
  // if (params.src) {
29157
29494
  // this._loadModel(params.src, params, options, sceneModel);
@@ -29163,13 +29500,13 @@ return _this164;}/**
29163
29500
  // sceneModel.fire("error", e);
29164
29501
  // }
29165
29502
  // });
29166
- return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this165=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this165._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this165.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
29167
- nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i601=0,len=options.includeTypes.length;_i601<len;_i601++){ctx.includeTypes[options.includeTypes[_i601]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i602=0,_len113=options.excludeTypes.length;_i602<_len113;_i602++){ctx.excludeTypes[options.excludeTypes[_i602]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29503
+ return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this169=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this169._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this169.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
29504
+ nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i605=0,len=options.includeTypes.length;_i605<len;_i605++){ctx.includeTypes[options.includeTypes[_i605]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i606=0,_len113=options.excludeTypes.length;_i606<_len113;_i606++){ctx.excludeTypes[options.excludeTypes[_i606]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29168
29505
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29169
- });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this166=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i603=0;_i603<lines.size();_i603++){var relID=lines.get(_i603);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this166._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this166._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i604=0;_i604<lines.size();_i604++){var relID=lines.get(_i604);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i605=0,len=props.length;_i605<len;_i605++){var prop=props[_i605];var _name8=prop.Name;var nominalValue=prop.NominalValue;if(_name8&&nominalValue){var property={name:_name8.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i606=0,_len114=relatedObjects.length;_i606<_len114;_i606++){var relatedObject=relatedObjects[_i606];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this167=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
29170
- var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this167._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this167._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this167._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this167._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29506
+ });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this170=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i607=0;_i607<lines.size();_i607++){var relID=lines.get(_i607);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this170._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this170._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i608=0;_i608<lines.size();_i608++){var relID=lines.get(_i608);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i609=0,len=props.length;_i609<len;_i609++){var prop=props[_i609];var _name10=prop.Name;var nominalValue=prop.NominalValue;if(_name10&&nominalValue){var property={name:_name10.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i610=0,_len114=relatedObjects.length;_i610<_len114;_i610++){var relatedObject=relatedObjects[_i610];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this171=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
29507
+ var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this171._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this171._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this171._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this171._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29171
29508
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l3=0,lenk=vertexData.length/6;k<lenk;k++,_l3+=3){positions[_l3+0]=vertexData[k*6+0];positions[_l3+1]=vertexData[k*6+1];positions[_l3+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l4=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l4+=3){normals[_l4+0]=vertexData[_k2*6+3];normals[_l4+1]=vertexData[_k2*6+4];normals[_l4+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
29172
- origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this167._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this167._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this167._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this167._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29509
+ origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this171._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this171._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this171._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this171._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
29173
29510
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,_l5=0,lenk=vertexData.length/6;k<lenk;k++,_l5+=3){positions[_l5+0]=vertexData[k*6+0];positions[_l5+1]=vertexData[k*6+1];positions[_l5+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k3=0,_l6=0,_lenk2=vertexData.length/6;_k3<_lenk2;_k3++,_l6+=3){normals[_l6+0]=vertexData[_k3*6+3];normals[_l6+1]=vertexData[_k3*6+4];normals[_l6+2]=vertexData[_k3*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
29174
29511
  origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w<1?placedGeometry.color.w:0.1});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});}}]);}(Plugin);/**
29175
29512
  * A 3D gizmo control for interactively editing object transforms (translate / rotate / scale).
@@ -29184,12 +29521,12 @@ this._rotationState={};// { [entityId]: { quat: Float64Array, center: number[] }
29184
29521
  // Animation state
29185
29522
  this._animRAF=null;this._createNodes();this._bindEvents();}return _createClass(TransformControl,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._batchedRotEntries=[];if(this._targetIds.length>0){this._setPos(this._getCentroid());}// Reset gizmo rotation to world-aligned on new target selection
29186
29523
  this._rootNode.quaternion=[0,0,0,1];// Build batched entries for targets whose meshes have no transform (batching layer)
29187
- this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var _i607=0,len=this._targetIds.length;_i607<len;_i607++){var id=this._targetIds[_i607];var entity=scene._findObjectEntity(id);if(!entity||!entity.meshes)continue;// Restore persisted rotation state, or create fresh
29524
+ this._buildBatchedEntries();}},{key:"_buildBatchedEntries",value:function _buildBatchedEntries(){var scene=this._scene;for(var _i611=0,len=this._targetIds.length;_i611<len;_i611++){var id=this._targetIds[_i611];var entity=scene._findObjectEntity(id);if(!entity||!entity.meshes)continue;// Restore persisted rotation state, or create fresh
29188
29525
  var state=this._rotationState[id];if(!state){var _localCenter=[0,0,0];state={quat:math.vec4([0,0,0,1]),center:_localCenter};this._rotationState[id]=state;}// Update center each time (object may have moved)
29189
29526
  var localCenter=[0,0,0];for(var j=0,mlen=entity.meshes.length;j<mlen;j++){var _mesh8=entity.meshes[j];if(!_mesh8.transform&&_mesh8.layer&&typeof _mesh8.layer.setMatrix==="function"){var portion=_mesh8.layer._portions&&_mesh8.layer._portions[_mesh8.portionId];if(portion&&portion.aabb){var _a10=portion.aabb;localCenter[0]=(_a10[0]+_a10[3])/2;localCenter[1]=(_a10[1]+_a10[4])/2;localCenter[2]=(_a10[2]+_a10[5])/2;}state.center=localCenter.slice();this._batchedRotEntries.push({entityId:id,mesh:_mesh8,layer:_mesh8.layer,portionId:_mesh8.portionId,quat:state.quat,// shared reference — persists across rebuilds
29190
- center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var _i608=0,len=this._targetIds.length;_i608<len;_i608++){var id=this._targetIds[_i608];// Try AABB center first (world-space)
29527
+ center:state.center});}}}}},{key:"_getCentroid",value:function _getCentroid(){var scene=this._scene;var sx=0,sy=0,sz=0,count=0;for(var _i612=0,len=this._targetIds.length;_i612<len;_i612++){var id=this._targetIds[_i612];// Try AABB center first (world-space)
29191
29528
  var aabb=scene.getObjectAABB(id);if(aabb){sx+=(aabb[0]+aabb[3])/2;sy+=(aabb[1]+aabb[4])/2;sz+=(aabb[2]+aabb[5])/2;// Account for entity offset — SceneModelEntity AABB does not include offset
29192
- var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this168=this;var keys=Object.keys(this._displayMeshes);for(var _i609=0,_keys=keys;_i609<_keys.length;_i609++){var k=_keys[_i609];if(this._displayMeshes[k])this._displayMeshes[k].visible=false;}if(!this._visible)return;var s=function s(n){if(_this168._displayMeshes[n])_this168._displayMeshes[n].visible=true;};// Translate handles
29529
+ var entity=scene._findObjectEntity(id);if(entity&&entity.offset){sx+=entity.offset[0];sy+=entity.offset[1];sz+=entity.offset[2];}count++;}else{var _entity3=scene._findObjectEntity(id);if(_entity3&&_entity3.worldMatrix){sx+=_entity3.worldMatrix[12];sy+=_entity3.worldMatrix[13];sz+=_entity3.worldMatrix[14];count++;}}}if(count===0)return[0,0,0];return[sx/count,sy/count,sz/count];}},{key:"_setPos",value:function _setPos(xyz){this._pos.set(xyz);worldToRTCPos(this._pos,this._origin,this._rtcPos);this._rootNode.origin=this._origin;this._rootNode.position=this._rtcPos;}},{key:"setPosition",value:function setPosition(pos){this._setPos(pos);}},{key:"setVisible",value:function setVisible(){var visible=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;if(this._visible===visible)return;this._visible=visible;this._syncModeVisibility();}},{key:"getVisible",value:function getVisible(){return this._visible;}},{key:"setCulled",value:function setCulled(culled){var id;for(id in this._displayMeshes){if(this._displayMeshes.hasOwnProperty(id))this._displayMeshes[id].culled=culled;}if(!culled){for(id in this._affordanceMeshes){if(this._affordanceMeshes.hasOwnProperty(id))this._affordanceMeshes[id].culled=culled;}}}},{key:"_syncModeVisibility",value:function _syncModeVisibility(){var _this172=this;var keys=Object.keys(this._displayMeshes);for(var _i613=0,_keys=keys;_i613<_keys.length;_i613++){var k=_keys[_i613];if(this._displayMeshes[k])this._displayMeshes[k].visible=false;}if(!this._visible)return;var s=function s(n){if(_this172._displayMeshes[n])_this172._displayMeshes[n].visible=true;};// Translate handles
29193
29530
  s("center");s("xAxis");s("xAxisArrow");s("xAxisArrowHandle");s("xAxisHandle");s("yShaft");s("yAxisArrow");s("yAxisArrowHandle");s("yShaftHandle");s("zShaft");s("zAxisArrow");s("zAxisArrowHandle");s("zAxisHandle");// Rotate handles
29194
29531
  s("xCurve");s("xCurveHandle");s("xCurveArrow1");s("xCurveArrow2");s("yCurve");s("yCurveHandle");s("yCurveArrow1");s("yCurveArrow2");s("zCurve");s("zCurveHandle");s("zCurveArrow1");s("zCurveArrow2");// // Scale handles
29195
29532
  // s("xScaleBox");
@@ -29210,23 +29547,23 @@ this._displayMeshes.zAxisArrow=rootNode.addChild(new Mesh(rootNode,{geometry:sha
29210
29547
  this._displayMeshes.zCurve=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curve,material:materials.blue,matrix:math.rotationMat4v(math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.curveHandle,material:materials.pickable,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveArrow1=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var t=math.translateMat4c(0.8,0.07,0,math.identityMat4());var s=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var r=math.rotationMat4v(180*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(t,s,math.identityMat4()),r,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zCurveArrow2=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,material:materials.blue,matrix:function(){var t=math.translateMat4c(0.05,0.8,0,math.identityMat4());var s=math.scaleMat4v([0.6,0.6,0.6],math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(math.mulMat4(t,s,math.identityMat4()),r,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Scale boxes
29211
29548
  this._displayMeshes.xScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.xScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.yScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.green,position:[0,radius+0.1,0],pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.yScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,position:[0,radius+0.1,0],pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.zScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.scaleBox,material:materials.pickable,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.uniformScaleBox=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.uniformScaleBox,material:materials.yellow,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);this._displayMeshes.uniformScaleBoxHandle=rootNode.addChild(new Mesh(rootNode,{geometry:shapes.uniformScaleBox,material:materials.pickable,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Center
29212
29549
  this._displayMeshes.center=rootNode.addChild(new Mesh(rootNode,{geometry:new ReadableGeometry(rootNode,buildSphereGeometry({radius:0.05})),material:materials.center,pickable:true,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT);// Affordance meshes
29213
- this._affordanceMeshes={xHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var r2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var r1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r1,r2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:math.translateMat4c(0,radius+0.1,0,math.identityMat4()),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}/* ======================== EVENT BINDING ======================== */},{key:"_bindEvents",value:function _bindEvents(){var _this169=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5,xScale:6,yScale:7,zScale:8,uniformScale:9};var rootNode=this._rootNode;var nextDragAction=DRAG_ACTIONS.none;var dragAction=DRAG_ACTIONS.none;var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;/* keep gizmo screen size constant */{var _tempVec3a4=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){lastDist=-1;});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){lastDist=-1;});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this169._pos,_tempVec3a4)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;rootNode.scale=[0.07*worldSize,0.07*worldSize,0.07*worldSize];}if(camera.projection==="ortho"){rootNode.scale=[camera.ortho.scale/10,camera.ortho.scale/10,camera.ortho.scale/10];}lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;return canvasPos;}var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2]))math.cross3Vec3(worldAxis,[0,1,0],planeNormal);else math.cross3Vec3(worldAxis,[1,0,0],planeNormal);math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();/* ── Drag translate entities ── */var dragTranslate=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;// Update root node using RTC coordinates (convert world -> RTC)
29214
- self._setPos(self._pos);self._applyEntityTranslation(worldAxis,dot*0.6);};}();/* ── Drag rotate entities ── */var dragRotate=function(){var p1=math.vec4(),p2=math.vec4(),c=math.vec4(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);var dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0)incDegrees=-incDegrees;rootNode.rotate(baseAxis,incDegrees);self._applyEntityRotation(baseAxis,incDegrees);};}();/* ── Drag scale entities ── */var dragScale=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse,uniform){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);var factor=1.0+dot*2.0;if(uniform){self._applyEntityScale([factor,factor,factor]);}else{var axisVec=[1,1,1];if(baseAxis===xBaseAxis)axisVec[0]=factor;else if(baseAxis===yBaseAxis)axisVec[1]=factor;else if(baseAxis===zBaseAxis)axisVec[2]=factor;else axisVec[0]=axisVec[1]=axisVec[2]=factor;self._applyEntityScale(axisVec);}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);var rayO=camera.eye;math.subVec4(dir,rayO,dir);var origin=self._pos;var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();/* ── Hover + mouse/touch events ── */{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this169._visible||down)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this169._displayMeshes.xAxisArrow.id:case _this169._displayMeshes.xAxisArrowHandle.id:case _this169._displayMeshes.xAxis.id:case _this169._displayMeshes.xAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this169._displayMeshes.yAxisArrow.id:case _this169._displayMeshes.yAxisArrowHandle.id:case _this169._displayMeshes.yShaft.id:case _this169._displayMeshes.yShaftHandle.id:affordanceMesh=_this169._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this169._displayMeshes.zAxisArrow.id:case _this169._displayMeshes.zAxisArrowHandle.id:case _this169._displayMeshes.zShaft.id:case _this169._displayMeshes.zAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this169._displayMeshes.xCurve.id:case _this169._displayMeshes.xCurveHandle.id:case _this169._displayMeshes.xCurveArrow1.id:case _this169._displayMeshes.xCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this169._displayMeshes.yCurve.id:case _this169._displayMeshes.yCurveHandle.id:case _this169._displayMeshes.yCurveArrow1.id:case _this169._displayMeshes.yCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this169._displayMeshes.zCurve.id:case _this169._displayMeshes.zCurveHandle.id:case _this169._displayMeshes.zCurveArrow1.id:case _this169._displayMeshes.zCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this169._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this169._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this169._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this169._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(){if(!_this169._visible)return;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this169._visible||!grabbed)return;_this169._viewer.cameraControl.pointerEnabled=false;if(e.which===1){down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this169.plugin.fire("editStart");}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this169._visible||!down)return;var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this169._visible)return;_this169._viewer.cameraControl.pointerEnabled=true;if(!down)return;if(e.which===1){down=false;grabbed=false;_this169.plugin.fire("editEnd");}});/* Touch hover */this._onCameraControlTouch=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this169._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this169._displayMeshes.xAxisArrow.id:case _this169._displayMeshes.xAxisArrowHandle.id:case _this169._displayMeshes.xAxis.id:case _this169._displayMeshes.xAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this169._displayMeshes.yAxisArrow.id:case _this169._displayMeshes.yAxisArrowHandle.id:case _this169._displayMeshes.yShaft.id:case _this169._displayMeshes.yShaftHandle.id:affordanceMesh=_this169._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this169._displayMeshes.zAxisArrow.id:case _this169._displayMeshes.zAxisArrowHandle.id:case _this169._displayMeshes.zShaft.id:case _this169._displayMeshes.zAxisHandle.id:affordanceMesh=_this169._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this169._displayMeshes.xCurve.id:case _this169._displayMeshes.xCurveHandle.id:case _this169._displayMeshes.xCurveArrow1.id:case _this169._displayMeshes.xCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this169._displayMeshes.yCurve.id:case _this169._displayMeshes.yCurveHandle.id:case _this169._displayMeshes.yCurveArrow1.id:case _this169._displayMeshes.yCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this169._displayMeshes.zCurve.id:case _this169._displayMeshes.zCurveHandle.id:case _this169._displayMeshes.zCurveArrow1.id:case _this169._displayMeshes.zCurveArrow2.id:affordanceMesh=_this169._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this169._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this169._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this169._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this169._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});canvas.addEventListener("touchstart",this._canvasTouchStartListener=function(e){e.preventDefault();if(!_this169._visible||!grabbed)return;_this169._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this169.plugin.fire("editStart");});canvas.addEventListener("touchmove",this._canvasTouchMoveListener=function(e){if(!_this169._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this169._visible)return;_this169._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this169.plugin.fire("editEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}/* ======================== ENTITY UPDATE ======================== */ // ── Public programmatic API ──
29550
+ this._affordanceMeshes={xHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.red,highlighted:true,highlightMaterial:materials.highlightRed,matrix:function(){var r2=math.rotationMat4v(90*math.DEGTORAD,[0,1,0],math.identityMat4());var r1=math.rotationMat4v(270*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r1,r2,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.green,highlighted:true,highlightMaterial:materials.highlightGreen,rotation:[-90,0,0],pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zHoop:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:materials.highlightBlue,matrix:math.rotationMat4v(180*math.DEGTORAD,[1,0,0],math.identityMat4()),pickable:false,collidable:false,clippable:false,backfaces:true,visible:false,isObject:false}),NO_STATE_INHERIT),xAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.red,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(-90*math.DEGTORAD,[0,0,1],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.green,matrix:math.translateMat4c(0,radius+0.1,0,math.identityMat4()),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT),zAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHeadBig,material:materials.blue,matrix:function(){var t=math.translateMat4c(0,radius+0.1,0,math.identityMat4());var r=math.rotationMat4v(90*math.DEGTORAD,[1,0,0],math.identityMat4());return math.mulMat4(r,t,math.identityMat4());}(),pickable:false,collidable:false,clippable:false,visible:false,isObject:false}),NO_STATE_INHERIT)};}/* ======================== EVENT BINDING ======================== */},{key:"_bindEvents",value:function _bindEvents(){var _this173=this;var self=this;var grabbed=false;var DRAG_ACTIONS={none:-1,xTranslate:0,yTranslate:1,zTranslate:2,xRotate:3,yRotate:4,zRotate:5,xScale:6,yScale:7,zScale:8,uniformScale:9};var rootNode=this._rootNode;var nextDragAction=DRAG_ACTIONS.none;var dragAction=DRAG_ACTIONS.none;var lastCanvasPos=math.vec2();var xBaseAxis=math.vec3([1,0,0]);var yBaseAxis=math.vec3([0,1,0]);var zBaseAxis=math.vec3([0,0,1]);var canvas=this._viewer.scene.canvas.canvas;var camera=this._viewer.camera;var scene=this._viewer.scene;/* keep gizmo screen size constant */{var _tempVec3a4=math.vec3([0,0,0]);var lastDist=-1;this._onCameraViewMatrix=scene.camera.on("viewMatrix",function(){lastDist=-1;});this._onCameraProjMatrix=scene.camera.on("projMatrix",function(){lastDist=-1;});this._onSceneTick=scene.on("tick",function(){var dist=Math.abs(math.lenVec3(math.subVec3(scene.camera.eye,_this173._pos,_tempVec3a4)));if(dist!==lastDist){if(camera.projection==="perspective"){var worldSize=Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;rootNode.scale=[0.07*worldSize,0.07*worldSize,0.07*worldSize];}if(camera.projection==="ortho"){rootNode.scale=[camera.ortho.scale/10,camera.ortho.scale/10,camera.ortho.scale/10];}lastDist=dist;}});}var getClickCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;return canvasPos;}var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;return canvasPos;};}();var getTouchCoordsWithinElement=function(){var canvasPos=new Float64Array(2);return function(event){if(!event){event=window.event;}if(event.touches&&event.touches.length){canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{var element=event.target;var totalOffsetLeft=0,totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};}();var localToWorldVec=function(){var mat=math.mat4();return function(localVec,worldVec){math.quaternionToMat4(rootNode.quaternion,mat);math.transformVec3(mat,localVec,worldVec);math.normalizeVec3(worldVec);return worldVec;};}();var getTranslationPlane=function(){var planeNormal=math.vec3();return function(worldAxis){var absX=Math.abs(worldAxis[0]);if(absX>Math.abs(worldAxis[1])&&absX>Math.abs(worldAxis[2]))math.cross3Vec3(worldAxis,[0,1,0],planeNormal);else math.cross3Vec3(worldAxis,[1,0,0],planeNormal);math.cross3Vec3(planeNormal,worldAxis,planeNormal);math.normalizeVec3(planeNormal);return planeNormal;};}();/* ── Drag translate entities ── */var dragTranslate=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);self._pos[0]+=worldAxis[0]*dot*0.6;self._pos[1]+=worldAxis[1]*dot*0.6;self._pos[2]+=worldAxis[2]*dot*0.6;// Update root node using RTC coordinates (convert world -> RTC)
29551
+ self._setPos(self._pos);self._applyEntityTranslation(worldAxis,dot*0.6);};}();/* ── Drag rotate entities ── */var dragRotate=function(){var p1=math.vec4(),p2=math.vec4(),c=math.vec4(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse){localToWorldVec(baseAxis,worldAxis);var hasData=getPointerPlaneIntersect(fromMouse,worldAxis,p1)&&getPointerPlaneIntersect(toMouse,worldAxis,p2);if(!hasData){var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);getPointerPlaneIntersect(toMouse,planeNormal,p2,1);var dot=math.dotVec3(p1,worldAxis);p1[0]-=dot*worldAxis[0];p1[1]-=dot*worldAxis[1];p1[2]-=dot*worldAxis[2];dot=math.dotVec3(p2,worldAxis);p2[0]-=dot*worldAxis[0];p2[1]-=dot*worldAxis[1];p2[2]-=dot*worldAxis[2];}math.normalizeVec3(p1);math.normalizeVec3(p2);var dot=math.dotVec3(p1,p2);dot=math.clamp(dot,-1.0,1.0);var incDegrees=Math.acos(dot)*math.RADTODEG;math.cross3Vec3(p1,p2,c);if(math.dotVec3(c,worldAxis)<0.0)incDegrees=-incDegrees;rootNode.rotate(baseAxis,incDegrees);self._applyEntityRotation(baseAxis,incDegrees);};}();/* ── Drag scale entities ── */var dragScale=function(){var p1=math.vec3(),p2=math.vec3(),worldAxis=math.vec4();return function(baseAxis,fromMouse,toMouse,uniform){localToWorldVec(baseAxis,worldAxis);var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1);getPointerPlaneIntersect(toMouse,planeNormal,p2);math.subVec3(p2,p1);var dot=math.dotVec3(p2,worldAxis);var factor=1.0+dot*2.0;if(uniform){self._applyEntityScale([factor,factor,factor]);}else{var axisVec=[1,1,1];if(baseAxis===xBaseAxis)axisVec[0]=factor;else if(baseAxis===yBaseAxis)axisVec[1]=factor;else if(baseAxis===zBaseAxis)axisVec[2]=factor;else axisVec[0]=axisVec[1]=axisVec[2]=factor;self._applyEntityScale(axisVec);}};}();var getPointerPlaneIntersect=function(){var dir=math.vec4([0,0,0,1]);var matrix=math.mat4();return function(mouse,axis,dest,offset){offset=offset||0;dir[0]=mouse[0]/canvas.width*2.0-1.0;dir[1]=-(mouse[1]/canvas.height*2.0-1.0);dir[2]=0.0;dir[3]=1.0;math.mulMat4(camera.projMatrix,camera.viewMatrix,matrix);math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(dir,1.0/dir[3]);var rayO=camera.eye;math.subVec4(dir,rayO,dir);var origin=self._pos;var d=-math.dotVec3(origin,axis)-offset;var dot=math.dotVec3(axis,dir);if(Math.abs(dot)>0.005){var t=-(math.dotVec3(axis,rayO)+d)/dot;math.mulVec3Scalar(dir,t,dest);math.addVec3(dest,rayO);math.subVec3(dest,origin,dest);return true;}return false;};}();/* ── Hover + mouse/touch events ── */{var down=false;var lastAffordanceMesh;this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this173._visible||down)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this173._displayMeshes.xAxisArrow.id:case _this173._displayMeshes.xAxisArrowHandle.id:case _this173._displayMeshes.xAxis.id:case _this173._displayMeshes.xAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this173._displayMeshes.yAxisArrow.id:case _this173._displayMeshes.yAxisArrowHandle.id:case _this173._displayMeshes.yShaft.id:case _this173._displayMeshes.yShaftHandle.id:affordanceMesh=_this173._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this173._displayMeshes.zAxisArrow.id:case _this173._displayMeshes.zAxisArrowHandle.id:case _this173._displayMeshes.zShaft.id:case _this173._displayMeshes.zAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this173._displayMeshes.xCurve.id:case _this173._displayMeshes.xCurveHandle.id:case _this173._displayMeshes.xCurveArrow1.id:case _this173._displayMeshes.xCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this173._displayMeshes.yCurve.id:case _this173._displayMeshes.yCurveHandle.id:case _this173._displayMeshes.yCurveArrow1.id:case _this173._displayMeshes.yCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this173._displayMeshes.zCurve.id:case _this173._displayMeshes.zCurveHandle.id:case _this173._displayMeshes.zCurveArrow1.id:case _this173._displayMeshes.zCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this173._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this173._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this173._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this173._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(){if(!_this173._visible)return;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this173._visible||!grabbed)return;_this173._viewer.cameraControl.pointerEnabled=false;if(e.which===1){down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this173.plugin.fire("editStart");}});canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this173._visible||!down)return;var canvasPos=getClickCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this173._visible)return;_this173._viewer.cameraControl.pointerEnabled=true;if(!down)return;if(e.which===1){down=false;grabbed=false;_this173.plugin.fire("editEnd");}});/* Touch hover */this._onCameraControlTouch=this._viewer.cameraControl.on("touchEntity",function(hit){if(!_this173._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this173._displayMeshes.xAxisArrow.id:case _this173._displayMeshes.xAxisArrowHandle.id:case _this173._displayMeshes.xAxis.id:case _this173._displayMeshes.xAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this173._displayMeshes.yAxisArrow.id:case _this173._displayMeshes.yAxisArrowHandle.id:case _this173._displayMeshes.yShaft.id:case _this173._displayMeshes.yShaftHandle.id:affordanceMesh=_this173._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this173._displayMeshes.zAxisArrow.id:case _this173._displayMeshes.zAxisArrowHandle.id:case _this173._displayMeshes.zShaft.id:case _this173._displayMeshes.zAxisHandle.id:affordanceMesh=_this173._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this173._displayMeshes.xCurve.id:case _this173._displayMeshes.xCurveHandle.id:case _this173._displayMeshes.xCurveArrow1.id:case _this173._displayMeshes.xCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this173._displayMeshes.yCurve.id:case _this173._displayMeshes.yCurveHandle.id:case _this173._displayMeshes.yCurveArrow1.id:case _this173._displayMeshes.yCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;case _this173._displayMeshes.zCurve.id:case _this173._displayMeshes.zCurveHandle.id:case _this173._displayMeshes.zCurveArrow1.id:case _this173._displayMeshes.zCurveArrow2.id:affordanceMesh=_this173._affordanceMeshes.zHoop;nextDragAction=DRAG_ACTIONS.zRotate;break;case _this173._displayMeshes.xScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.xScale;break;case _this173._displayMeshes.yScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.yScale;break;case _this173._displayMeshes.zScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.zScale;break;case _this173._displayMeshes.uniformScaleBoxHandle.id:affordanceMesh=null;nextDragAction=DRAG_ACTIONS.uniformScale;break;default:nextDragAction=DRAG_ACTIONS.none;return;}if(affordanceMesh)affordanceMesh.visible=true;lastAffordanceMesh=affordanceMesh;grabbed=true;});canvas.addEventListener("touchstart",this._canvasTouchStartListener=function(e){e.preventDefault();if(!_this173._visible||!grabbed)return;_this173._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this173.plugin.fire("editStart");});canvas.addEventListener("touchmove",this._canvasTouchMoveListener=function(e){if(!_this173._visible||!down)return;var canvasPos=getTouchCoordsWithinElement(e);var x=canvasPos[0],y=canvasPos[1];switch(dragAction){case DRAG_ACTIONS.xTranslate:dragTranslate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yTranslate:dragTranslate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zTranslate:dragTranslate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xRotate:dragRotate(xBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.yRotate:dragRotate(yBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.zRotate:dragRotate(zBaseAxis,lastCanvasPos,canvasPos);break;case DRAG_ACTIONS.xScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.yScale:dragScale(yBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.zScale:dragScale(zBaseAxis,lastCanvasPos,canvasPos,false);break;case DRAG_ACTIONS.uniformScale:dragScale(xBaseAxis,lastCanvasPos,canvasPos,true);break;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this173._visible)return;_this173._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this173.plugin.fire("editEnd");});canvas.addEventListener("touchcancel",this._canvasTouchEndListener);}}/* ======================== ENTITY UPDATE ======================== */ // ── Public programmatic API ──
29215
29552
  /** @param {number[]} delta World-space translation [dx, dy, dz] */},{key:"translate",value:function translate(delta){this._pos[0]+=delta[0];this._pos[1]+=delta[1];this._pos[2]+=delta[2];this._setPos(this._pos);this._applyEntityTranslationRaw(delta);}/** @param {number[]} axis Rotation axis [x, y, z] (normalized)
29216
- * @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this170=this;for(var _i610=0,len=this._batchedRotEntries.length;_i610<len;_i610++){var entry=this._batchedRotEntries[_i610];entry.quat.set(quat);var rotMat=math.mat4();math.quaternionToMat4(quat,rotMat);var toOrigin=math.translationMat4v([-entry.center[0],-entry.center[1],-entry.center[2]],math.mat4());var fromOrigin=math.translationMat4v(entry.center,math.mat4());var pivotRot=math.mulMat4(fromOrigin,math.mulMat4(rotMat,toOrigin,math.mat4()),math.mat4());entry.layer.setMatrix(entry.portionId,pivotRot);}// For instanced entries
29217
- var _loop5=function _loop5(){var id=_this170._targetIds[_i611];if(_this170._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29218
- _this170._scene.setObjectsQuaternion([id],quat);};for(var _i611=0,_len115=this._targetIds.length;_i611<_len115;_i611++){if(_loop5())continue;}// Sync gizmo orientation
29219
- this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this171=this;var _loop6=function _loop6(){var id=_this171._targetIds[_i612];if(_this171._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29220
- _this171._scene.setObjectsScale([id],scale);};for(var _i612=0,len=this._targetIds.length;_i612<len;_i612++){if(_loop6())continue;}}/** @returns {number[]} Current centroid position [x, y, z] */},{key:"getPosition",value:function getPosition(){return[this._pos[0],this._pos[1],this._pos[2]];}/** @returns {number[]|null} Accumulated rotation quaternion [x,y,z,w] or null */},{key:"getRotation",value:function getRotation(){if(this._batchedRotEntries.length>0){var q=this._batchedRotEntries[0].quat;return[q[0],q[1],q[2],q[3]];}if(this._targetIds.length>0){var _q2=this._scene.getObjectQuaternion(this._targetIds[0]);if(_q2)return _q2;}return null;}/** Reset all transforms to identity on current targets */},{key:"resetTransform",value:function resetTransform(){var _this172=this;// Reset batched entries to identity (no rotation, no pivot shift)
29221
- for(var _i613=0,len=this._batchedRotEntries.length;_i613<len;_i613++){var entry=this._batchedRotEntries[_i613];entry.quat.set([0,0,0,1]);entry.layer.setMatrix(entry.portionId,math.identityMat4());}// Also clear persisted state
29222
- for(var _i614=0,_len116=this._targetIds.length;_i614<_len116;_i614++){var state=this._rotationState[this._targetIds[_i614]];if(state)state.quat.set([0,0,0,1]);}// Reset instanced entries
29223
- var _loop7=function _loop7(){var id=_this172._targetIds[_i615];if(_this172._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29224
- _this172._scene.setObjectsQuaternion([id],[0,0,0,1]);_this172._scene.setObjectsScale([id],[1,1,1]);};for(var _i615=0,_len117=this._targetIds.length;_i615<_len117;_i615++){if(_loop7())continue;}this._rootNode.quaternion=[0,0,0,1];}/** Start continuous rotation animation around an axis.
29553
+ * @param {number} degrees Rotation angle in degrees */},{key:"rotate",value:function rotate(axis,degrees){this._rootNode.rotate(axis,degrees);this._applyEntityRotation(axis,degrees);}/** @param {number[]} quat Absolute rotation quaternion [x, y, z, w] */},{key:"setRotation",value:function setRotation(quat){var _this174=this;for(var _i614=0,len=this._batchedRotEntries.length;_i614<len;_i614++){var entry=this._batchedRotEntries[_i614];entry.quat.set(quat);var rotMat=math.mat4();math.quaternionToMat4(quat,rotMat);var toOrigin=math.translationMat4v([-entry.center[0],-entry.center[1],-entry.center[2]],math.mat4());var fromOrigin=math.translationMat4v(entry.center,math.mat4());var pivotRot=math.mulMat4(fromOrigin,math.mulMat4(rotMat,toOrigin,math.mat4()),math.mat4());entry.layer.setMatrix(entry.portionId,pivotRot);}// For instanced entries
29554
+ var _loop5=function _loop5(){var id=_this174._targetIds[_i615];if(_this174._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29555
+ _this174._scene.setObjectsQuaternion([id],quat);};for(var _i615=0,_len115=this._targetIds.length;_i615<_len115;_i615++){if(_loop5())continue;}// Sync gizmo orientation
29556
+ this._rootNode.quaternion=[quat[0],quat[1],quat[2],quat[3]];}/** @param {number[]} scale Scale factors [sx, sy, sz] */},{key:"setScale",value:function setScale(scale){var _this175=this;var _loop6=function _loop6(){var id=_this175._targetIds[_i616];if(_this175._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29557
+ _this175._scene.setObjectsScale([id],scale);};for(var _i616=0,len=this._targetIds.length;_i616<len;_i616++){if(_loop6())continue;}}/** @returns {number[]} Current centroid position [x, y, z] */},{key:"getPosition",value:function getPosition(){return[this._pos[0],this._pos[1],this._pos[2]];}/** @returns {number[]|null} Accumulated rotation quaternion [x,y,z,w] or null */},{key:"getRotation",value:function getRotation(){if(this._batchedRotEntries.length>0){var q=this._batchedRotEntries[0].quat;return[q[0],q[1],q[2],q[3]];}if(this._targetIds.length>0){var _q2=this._scene.getObjectQuaternion(this._targetIds[0]);if(_q2)return _q2;}return null;}/** Reset all transforms to identity on current targets */},{key:"resetTransform",value:function resetTransform(){var _this176=this;// Reset batched entries to identity (no rotation, no pivot shift)
29558
+ for(var _i617=0,len=this._batchedRotEntries.length;_i617<len;_i617++){var entry=this._batchedRotEntries[_i617];entry.quat.set([0,0,0,1]);entry.layer.setMatrix(entry.portionId,math.identityMat4());}// Also clear persisted state
29559
+ for(var _i618=0,_len116=this._targetIds.length;_i618<_len116;_i618++){var state=this._rotationState[this._targetIds[_i618]];if(state)state.quat.set([0,0,0,1]);}// Reset instanced entries
29560
+ var _loop7=function _loop7(){var id=_this176._targetIds[_i619];if(_this176._batchedRotEntries.some(function(e){return e.entityId===id;}))return 1;// continue
29561
+ _this176._scene.setObjectsQuaternion([id],[0,0,0,1]);_this176._scene.setObjectsScale([id],[1,1,1]);};for(var _i619=0,_len117=this._targetIds.length;_i619<_len117;_i619++){if(_loop7())continue;}this._rootNode.quaternion=[0,0,0,1];}/** Start continuous rotation animation around an axis.
29225
29562
  * @param {number[]} axis — normalized axis [x, y, z]
29226
29563
  * @param {number} degreesPerSec — rotation speed in degrees per second
29227
29564
  * @param {number} [duration] — optional max duration in seconds, omit for infinite */},{key:"animateRotation",value:function animateRotation(axis,degreesPerSec,duration){this.stopAnimation();var self=this;var startTime=performance.now();var lastTime=startTime;var _loop8=function loop(now){var elapsed=(now-startTime)/1000;if(duration&&elapsed>=duration){self.stopAnimation();return;}var dt=Math.min((now-lastTime)/1000,0.1);lastTime=now;var deg=degreesPerSec*dt;self._rootNode.rotate(axis,deg);self._applyEntityRotation(axis,deg);self._animRAF=requestAnimationFrame(_loop8);};this._animRAF=requestAnimationFrame(_loop8);}/** Stop any running rotation animation. */},{key:"stopAnimation",value:function stopAnimation(){if(this._animRAF){cancelAnimationFrame(this._animRAF);this._animRAF=null;}}/** Check if animation is running. @returns {boolean} */},{key:"isAnimating",value:function isAnimating(){return!!this._animRAF;}// ── Internal helpers ──
29228
- },{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var _i616=0,len=this._targetIds.length;_i616<len;_i616++){var id=this._targetIds[_i616];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p5=entity.position;scene.setObjectsPosition([id],[_p5[0]+delta[0],_p5[1]+delta[1],_p5[2]+delta[2]]);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;scene.setObjectsOffset([id],[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]]);}}}},{key:"_applyEntityTranslation",value:function _applyEntityTranslation(worldAxis,dot){var scene=this._scene;var delta=[worldAxis[0]*dot,worldAxis[1]*dot,worldAxis[2]*dot];for(var _i617=0,len=this._targetIds.length;_i617<len;_i617++){var id=this._targetIds[_i617];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p6=entity.position;var newPos=[_p6[0]+delta[0],_p6[1]+delta[1],_p6[2]+delta[2]];scene.setObjectsPosition([id],newPos);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;var newOff=[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]];scene.setObjectsOffset([id],newOff);}}}},{key:"_applyEntityRotation",value:function _applyEntityRotation(baseAxis,degrees){var _this173=this;var scene=this._scene;var quatDelta=math.vec4();math.angleAxisToQuaternion([baseAxis[0],baseAxis[1],baseAxis[2],degrees*math.DEGTORAD],quatDelta);// --- Batched meshes: direct layer.setMatrix ---
29229
- for(var _i618=0,len=this._batchedRotEntries.length;_i618<len;_i618++){var entry=this._batchedRotEntries[_i618];var newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate for correct direction
29565
+ },{key:"_applyEntityTranslationRaw",value:function _applyEntityTranslationRaw(delta){var scene=this._scene;for(var _i620=0,len=this._targetIds.length;_i620<len;_i620++){var id=this._targetIds[_i620];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p5=entity.position;scene.setObjectsPosition([id],[_p5[0]+delta[0],_p5[1]+delta[1],_p5[2]+delta[2]]);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;scene.setObjectsOffset([id],[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]]);}}}},{key:"_applyEntityTranslation",value:function _applyEntityTranslation(worldAxis,dot){var scene=this._scene;var delta=[worldAxis[0]*dot,worldAxis[1]*dot,worldAxis[2]*dot];for(var _i621=0,len=this._targetIds.length;_i621<len;_i621++){var id=this._targetIds[_i621];var entity=scene._findObjectEntity(id);if(entity&&entity.position){var _p6=entity.position;var newPos=[_p6[0]+delta[0],_p6[1]+delta[1],_p6[2]+delta[2]];scene.setObjectsPosition([id],newPos);}else if(entity&&entity.matrix){var m=entity.matrix.slice();m[12]+=delta[0];m[13]+=delta[1];m[14]+=delta[2];scene.setObjectsMatrix([id],m);}else if(entity&&entity.offset){var off=entity.offset;var newOff=[off[0]+delta[0],off[1]+delta[1],off[2]+delta[2]];scene.setObjectsOffset([id],newOff);}}}},{key:"_applyEntityRotation",value:function _applyEntityRotation(baseAxis,degrees){var _this177=this;var scene=this._scene;var quatDelta=math.vec4();math.angleAxisToQuaternion([baseAxis[0],baseAxis[1],baseAxis[2],degrees*math.DEGTORAD],quatDelta);// --- Batched meshes: direct layer.setMatrix ---
29566
+ for(var _i622=0,len=this._batchedRotEntries.length;_i622<len;_i622++){var entry=this._batchedRotEntries[_i622];var newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate for correct direction
29230
29567
  math.mulQuaternions(entry.quat,quatDelta,newQ);entry.quat.set(newQ);// Compose pivot rotation manually: T(center) * R * T(-center)
29231
29568
  var rotMat=math.mat4();math.quaternionToMat4(entry.quat,rotMat);var cx=entry.center[0],cy=entry.center[1],cz=entry.center[2];// M = T(c) * R * T(-c), built manually in column-major
29232
29569
  var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
@@ -29235,15 +29572,15 @@ var m=math.identityMat4();// Apply T(-center) to rotation matrix: R' = R * T(-c)
29235
29572
  var rx=rotMat[0],ry=rotMat[1],rz=rotMat[2];var r0x=rotMat[4],r0y=rotMat[5],r0z=rotMat[6];var r1x=rotMat[8],r1y=rotMat[9],r1z=rotMat[10];// result = T(c) * (R * T(-c))
29236
29573
  m[12]=cx+rx*-cx+r0x*-cy+r1x*-cz;m[13]=cy+ry*-cx+r0y*-cy+r1y*-cz;m[14]=cz+rz*-cx+r0z*-cy+r1z*-cz;// Rotation part (upper 3x3) stays the same
29237
29574
  m[0]=rotMat[0];m[4]=rotMat[4];m[8]=rotMat[8];m[1]=rotMat[1];m[5]=rotMat[5];m[9]=rotMat[9];m[2]=rotMat[2];m[6]=rotMat[6];m[10]=rotMat[10];entry.layer.setMatrix(entry.portionId,m);}// --- Instanced meshes: existing flow via entity quaternion ---
29238
- var _loop9=function _loop9(){var id=_this173._targetIds[_i619];var entity=scene._findObjectEntity(id);if(!entity)return 0;// continue
29575
+ var _loop9=function _loop9(){var id=_this177._targetIds[_i623];var entity=scene._findObjectEntity(id);if(!entity)return 0;// continue
29239
29576
  // Skip if already handled via batched entry
29240
- if(_this173._batchedRotEntries.some(function(e){return e.entityId===id;}))return 0;// continue
29577
+ if(_this177._batchedRotEntries.some(function(e){return e.entityId===id;}))return 0;// continue
29241
29578
  // Ensure entity has a SceneModelTransform for rotation
29242
- if(!entity.quaternion&&!entity.rotation){_this173._ensureEntityTransform(entity);}if(entity.quaternion){var _newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate
29243
- math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret;for(var _i619=0,_len118=this._targetIds.length;_i619<_len118;_i619++){_ret=_loop9();if(_ret===0)continue;}}},{key:"_applyEntityScale",value:function _applyEntityScale(factors){var scene=this._scene;for(var _i620=0,len=this._targetIds.length;_i620<len;_i620++){var id=this._targetIds[_i620];// Ensure entity has a transform before scaling
29579
+ if(!entity.quaternion&&!entity.rotation){_this177._ensureEntityTransform(entity);}if(entity.quaternion){var _newQ=math.vec4();// Post-multiply (existing * delta) — same order as Node.rotate
29580
+ math.mulQuaternions(entity.quaternion,quatDelta,_newQ);scene.setObjectsQuaternion([id],[_newQ[0],_newQ[1],_newQ[2],_newQ[3]]);}else if(entity.rotation){var _r7=entity.rotation;var delta=[0,0,0];if(Math.abs(baseAxis[0])>0.9)delta[0]=degrees;else if(Math.abs(baseAxis[1])>0.9)delta[1]=degrees;else if(Math.abs(baseAxis[2])>0.9)delta[2]=degrees;scene.setObjectsRotation([id],[_r7[0]+delta[0],_r7[1]+delta[1],_r7[2]+delta[2]]);}},_ret;for(var _i623=0,_len118=this._targetIds.length;_i623<_len118;_i623++){_ret=_loop9();if(_ret===0)continue;}}},{key:"_applyEntityScale",value:function _applyEntityScale(factors){var scene=this._scene;for(var _i624=0,len=this._targetIds.length;_i624<len;_i624++){var id=this._targetIds[_i624];// Ensure entity has a transform before scaling
29244
29581
  var _s2=scene.getObjectScale(id);if(!_s2){var entity=scene._findObjectEntity(id);if(entity){this._ensureEntityTransform(entity);}_s2=scene.getObjectScale(id);}if(_s2){scene.setObjectsScale([id],[Math.max(0.01,_s2[0]*factors[0]),Math.max(0.01,_s2[1]*factors[1]),Math.max(0.01,_s2[2]*factors[2])]);}}}},{key:"_ensureEntityTransform",value:function _ensureEntityTransform(entity){// Only for instanced meshes — batched meshes are handled via _batchedRotEntries
29245
29582
  if(!entity.meshes||entity.meshes.length===0)return;var model=entity.model;if(!model||!model.createTransform)return;// Check if any mesh has a render layer that supports setMatrix AND already has a transform
29246
- var hasMatrixCapableLayer=false;for(var _i621=0,len=entity.meshes.length;_i621<len;_i621++){var m=entity.meshes[_i621];if(m&&m.layer&&typeof m.layer.setMatrix==="function"&&m.transform){hasMatrixCapableLayer=true;break;}}if(!hasMatrixCapableLayer)return;var offset=entity.offset;for(var _i622=0,_len119=entity.meshes.length;_i622<_len119;_i622++){var _mesh9=entity.meshes[_i622];if(_mesh9&&!_mesh9.transform&&_mesh9.layer&&typeof _mesh9.layer.setMatrix==="function"){var transformId="__edit_xform_".concat(_mesh9.id||entity.id,"_").concat(_i622);var _transform4=model.createTransform({id:transformId,position:[offset[0],offset[1],offset[2]],quaternion:[0,0,0,1],scale:[1,1,1]});if(_transform4){_transform4._addMesh(_mesh9);}}}entity.offset=[0,0,0];}/* ======================== DESTROY ======================== */},{key:"destroy",value:function destroy(){this.stopAnimation();this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);cameraControl.off(this._onCameraControlTouch);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("touchstart",this._canvasTouchStartListener);canvas.removeEventListener("touchmove",this._canvasTouchMoveListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);}},{key:"_destroyNodes",value:function _destroyNodes(){this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};this._targetIds=[];this._batchedRotEntries=[];this._rotationState={};}}]);}();/**
29583
+ var hasMatrixCapableLayer=false;for(var _i625=0,len=entity.meshes.length;_i625<len;_i625++){var m=entity.meshes[_i625];if(m&&m.layer&&typeof m.layer.setMatrix==="function"&&m.transform){hasMatrixCapableLayer=true;break;}}if(!hasMatrixCapableLayer)return;var offset=entity.offset;for(var _i626=0,_len119=entity.meshes.length;_i626<_len119;_i626++){var _mesh9=entity.meshes[_i626];if(_mesh9&&!_mesh9.transform&&_mesh9.layer&&typeof _mesh9.layer.setMatrix==="function"){var transformId="__edit_xform_".concat(_mesh9.id||entity.id,"_").concat(_i626);var _transform4=model.createTransform({id:transformId,position:[offset[0],offset[1],offset[2]],quaternion:[0,0,0,1],scale:[1,1,1]});if(_transform4){_transform4._addMesh(_mesh9);}}}entity.offset=[0,0,0];}/* ======================== DESTROY ======================== */},{key:"destroy",value:function destroy(){this.stopAnimation();this._unbindEvents();this._destroyNodes();}},{key:"_unbindEvents",value:function _unbindEvents(){var viewer=this._viewer;var scene=viewer.scene;var canvas=scene.canvas.canvas;var camera=viewer.camera;var cameraControl=viewer.cameraControl;scene.off(this._onSceneTick);camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);cameraControl.off(this._onCameraControlHover);cameraControl.off(this._onCameraControlHoverLeave);cameraControl.off(this._onCameraControlTouch);canvas.removeEventListener("mousedown",this._canvasMouseDownListener);canvas.removeEventListener("mousemove",this._canvasMouseMoveListener);canvas.removeEventListener("mouseup",this._canvasMouseUpListener);canvas.removeEventListener("touchstart",this._canvasTouchStartListener);canvas.removeEventListener("touchmove",this._canvasTouchMoveListener);canvas.removeEventListener("touchend",this._canvasTouchEndListener);canvas.removeEventListener("touchcancel",this._canvasTouchEndListener);}},{key:"_destroyNodes",value:function _destroyNodes(){this._rootNode.destroy();this._displayMeshes={};this._affordanceMeshes={};this._targetIds=[];this._batchedRotEntries=[];this._rotationState={};}}]);}();/**
29247
29584
  * ObjectEditPlugin — interactive 3D transform controls (translate / rotate / scale) plus
29248
29585
  * quick colorize, x-ray, and hide for model components.
29249
29586
  *
@@ -29311,7 +29648,7 @@ var hasMatrixCapableLayer=false;for(var _i621=0,len=entity.meshes.length;_i621<l
29311
29648
  * matrix attributes. No manual promotion needed.
29312
29649
  * - The gizmo auto-scales to maintain constant screen size regardless of camera distance.
29313
29650
  * - `setTargets` resets accumulated rotation to identity for batched meshes.
29314
- */var ObjectEditPlugin=/*#__PURE__*/function(_Plugin15){function ObjectEditPlugin(viewer){var _this174;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ObjectEditPlugin);_this174=_callSuper(this,ObjectEditPlugin,["ObjectEdit",viewer]);_this174._control=new TransformControl(_this174);_this174._targetIds=[];return _this174;}_inherits(ObjectEditPlugin,_Plugin15);return _createClass(ObjectEditPlugin,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._control.setTargets(this._targetIds);}},{key:"getTargets",value:function getTargets(){return this._targetIds;}},{key:"showControl",value:function showControl(){this._control.setVisible(true);this.fire("controlVisible",true);}},{key:"hideControl",value:function hideControl(){this._control.setVisible(false);this.fire("controlVisible",false);}},{key:"isControlVisible",value:function isControlVisible(){return this._control.getVisible();}/** Colorize selected entities. @param {number[]} rgb — [r,g,b] each 0..1 */},{key:"colorize",value:function colorize(rgb){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsColorized(this._targetIds,rgb);this.fire("colorized",rgb);}/** Toggle x-ray on selected entities. @param {boolean} on */},{key:"setXRayed",value:function setXRayed(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsXRayed(this._targetIds,on);this.fire("xrayed",on);}/** Toggle visibility of selected entities. @param {boolean} on */},{key:"setHidden",value:function setHidden(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsVisible(this._targetIds,!on);this.fire("hidden",on);}},{key:"setPosition",value:function setPosition(pos){this._control.setPosition(pos);}},{key:"setCulled",value:function setCulled(culled){this._control.setCulled(culled);}// ── Programmatic transform API ──
29651
+ */var ObjectEditPlugin=/*#__PURE__*/function(_Plugin16){function ObjectEditPlugin(viewer){var _this178;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ObjectEditPlugin);_this178=_callSuper(this,ObjectEditPlugin,["ObjectEdit",viewer]);_this178._control=new TransformControl(_this178);_this178._targetIds=[];return _this178;}_inherits(ObjectEditPlugin,_Plugin16);return _createClass(ObjectEditPlugin,[{key:"setTargets",value:function setTargets(ids){this._targetIds=ids||[];this._control.setTargets(this._targetIds);}},{key:"getTargets",value:function getTargets(){return this._targetIds;}},{key:"showControl",value:function showControl(){this._control.setVisible(true);this.fire("controlVisible",true);}},{key:"hideControl",value:function hideControl(){this._control.setVisible(false);this.fire("controlVisible",false);}},{key:"isControlVisible",value:function isControlVisible(){return this._control.getVisible();}/** Colorize selected entities. @param {number[]} rgb — [r,g,b] each 0..1 */},{key:"colorize",value:function colorize(rgb){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsColorized(this._targetIds,rgb);this.fire("colorized",rgb);}/** Toggle x-ray on selected entities. @param {boolean} on */},{key:"setXRayed",value:function setXRayed(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsXRayed(this._targetIds,on);this.fire("xrayed",on);}/** Toggle visibility of selected entities. @param {boolean} on */},{key:"setHidden",value:function setHidden(on){if(this._targetIds.length===0)return;this.viewer.scene.setObjectsVisible(this._targetIds,!on);this.fire("hidden",on);}},{key:"setPosition",value:function setPosition(pos){this._control.setPosition(pos);}},{key:"setCulled",value:function setCulled(culled){this._control.setCulled(culled);}// ── Programmatic transform API ──
29315
29652
  /** Translate selected objects by world-space delta.
29316
29653
  * @param {number[]} delta — [dx, dy, dz] */},{key:"translate",value:function translate(delta){this._control.translate(delta);this.fire("translated",delta);}/** Rotate selected objects incrementally around an axis.
29317
29654
  * @param {number[]} axis — normalized axis [x, y, z]
@@ -29340,7 +29677,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29340
29677
  * @private
29341
29678
  * @param arrayBuffer
29342
29679
  * @returns {{}}
29343
- */var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop10=function _loop10(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop10();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i623=0;_i623<buf.length;++_i623){view[_i623]=buf[_i623];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
29680
+ */var loadLASHeader=function loadLASHeader(arrayBuffer){var currentByte=0;var numOfVarLenRecords=0;var projectionStart=0;var dataView=new DataView(arrayBuffer);var buffer=new Uint8Array(6000);var getGeoKeys=function getGeoKeys(geoRecord){if(geoRecord===undefined){return undefined;}var projectionEnd=projectionStart+geoRecord["RecordLengthAfterHeader"];var geoTag=buffer.slice(projectionStart,projectionEnd);var arrayBuffer=bufferFlipper(geoTag);var dataView=new DataView(arrayBuffer);var byteCount=6;var numberOfKeys=Number(dataView.getUint16(byteCount,true));var geoKeys=[];while(numberOfKeys--){var keyTmp={};keyTmp.key=dataView.getUint16(byteCount+=2,true);keyTmp.tiffTagLocation=dataView.getUint16(byteCount+=2,true);keyTmp.count=dataView.getUint16(byteCount+=2,true);keyTmp.valueOffset=dataView.getUint16(byteCount+=2,true);geoKeys.push(keyTmp);}var projRecord=geoKeys.find(function(x){return x.key===3072;});if(projRecord&&projRecord.hasOwnProperty('valueOffset')){var epsg=projRecord.valueOffset;{return epsg;}}return undefined;};var getValue=function getValue(_ref22){var item=_ref22.item,format=_ref22.format,size=_ref22.size;var str,array;switch(format){case'char':array=new Uint8Array(arrayBuffer,currentByte,size);currentByte+=size;str=uint8arrayToString(array);return[item,str];case'uShort':str=dataView.getUint16(currentByte,true);currentByte+=size;return[item,str];case'uLong':str=dataView.getUint32(currentByte,true);if(item==='NumberOfVariableLengthRecords'){numOfVarLenRecords=str;}currentByte+=size;return[item,str];case'uChar':str=dataView.getUint8(currentByte);currentByte+=size;return[item,str];case'double':str=dataView.getFloat64(currentByte,true);currentByte+=size;return[item,str];default:currentByte+=size;}};var getValues=function getValues(){var publicHeaderBlock={};headerBlockItems.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));if(myObj!==undefined){if(myObj[0]==='FileSignature'&&myObj[1]!=='LASF'){throw new Error('Ivalid FileSignature. Is this a LAS/LAZ file');}publicHeaderBlock[myObj[0]]=myObj[1];}});var variableRecords=[];var variableLengthRecords=numOfVarLenRecords;var _loop10=function _loop10(){var variableObj={};variableLengthRecord.forEach(function(obj){var myObj=getValue(_objectSpread({},obj));variableObj[myObj[0]]=myObj[1];if(myObj[0]==='UserId'&&myObj[1]==='LASF_Projection'){projectionStart=currentByte-18+54;}});variableRecords.push(variableObj);};while(variableLengthRecords--){_loop10();}var geoRecord=variableRecords.find(function(x){return x.UserId==='LASF_Projection';});var epsg=getGeoKeys(geoRecord);if(epsg){publicHeaderBlock['epsg']=epsg;}return publicHeaderBlock;};return getValues();};var bufferFlipper=function bufferFlipper(buf){var ab=new ArrayBuffer(buf.length);var view=new Uint8Array(ab);for(var _i627=0;_i627<buf.length;++_i627){view[_i627]=buf[_i627];}return ab;};var uint8arrayToString=function uint8arrayToString(array){var str='';array.forEach(function(item){var c=String.fromCharCode(item);if(c!=="\0"){str+=c;}});return str.trim();};var MAX_VERTICES=500000;// TODO: Rough estimate
29344
29681
  /**
29345
29682
  * {@link Viewer} plugin that loads lidar point cloud geometry from LAS files.
29346
29683
  *
@@ -29477,7 +29814,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29477
29814
  *
29478
29815
  * @class LASLoaderPlugin
29479
29816
  * @since 2.0.17
29480
- */var LASLoaderPlugin=/*#__PURE__*/function(_Plugin16){/**
29817
+ */var LASLoaderPlugin=/*#__PURE__*/function(_Plugin17){/**
29481
29818
  * @constructor
29482
29819
  *
29483
29820
  * @param {Viewer} viewer The Viewer.
@@ -29491,13 +29828,13 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29491
29828
  * @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
29492
29829
  * @param {Number[]} [cfg.rotate=[0,0,0]] Rotations to immediately apply to the LAS points, given as Euler angles in degrees, for each of the X, Y and Z axis. Rotation is applied after "center" and "rotateX".
29493
29830
  * @param {Number[]} [cfg.transform] 4x4 transform matrix to immediately apply to the LAS points. This is applied after "center", "rotateX" and "rotate". Typically used instead of "rotateX" and "rotate".
29494
- */function LASLoaderPlugin(viewer){var _this175;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this175=_callSuper(this,LASLoaderPlugin,["lasLoader",viewer,cfg]);_this175.dataSource=cfg.dataSource;_this175.skip=cfg.skip;_this175.fp64=cfg.fp64;_this175.colorDepth=cfg.colorDepth;_this175.center=cfg.center;_this175.rotate=cfg.rotate;_this175.rotateX=cfg.rotateX;_this175.transform=cfg.transform;return _this175;}/**
29831
+ */function LASLoaderPlugin(viewer){var _this179;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this179=_callSuper(this,LASLoaderPlugin,["lasLoader",viewer,cfg]);_this179.dataSource=cfg.dataSource;_this179.skip=cfg.skip;_this179.fp64=cfg.fp64;_this179.colorDepth=cfg.colorDepth;_this179.center=cfg.center;_this179.rotate=cfg.rotate;_this179.rotateX=cfg.rotateX;_this179.transform=cfg.transform;return _this179;}/**
29495
29832
  * Gets the custom data source through which the LASLoaderPlugin can load LAS files.
29496
29833
  *
29497
29834
  * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
29498
29835
  *
29499
29836
  * @type {Object}
29500
- */_inherits(LASLoaderPlugin,_Plugin16);return _createClass(LASLoaderPlugin,[{key:"dataSource",get:function get(){return this._dataSource;}/**
29837
+ */_inherits(LASLoaderPlugin,_Plugin17);return _createClass(LASLoaderPlugin,[{key:"dataSource",get:function get(){return this._dataSource;}/**
29501
29838
  * Sets a custom data source through which the LASLoaderPlugin can load LAS files.
29502
29839
  *
29503
29840
  * Default value is {@link LASDefaultDataSource}, which loads via HTTP.
@@ -29618,8 +29955,8 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29618
29955
  * @param {Number[]} [params.matrix=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]] The model's world transform matrix. Overrides the position, scale and rotation parameters. Relative to ````origin````.
29619
29956
  * @param {Object} [params.stats] Collects model statistics.
29620
29957
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
29621
- */},{key:"load",value:function load(){var _this176=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
29622
- }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this176.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this177=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this177._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this177.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this177.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this178=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this178._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i624=0,len=positionsValue.length;_i624<len;_i624+=3){centerPos[0]+=positionsValue[_i624+0];centerPos[1]+=positionsValue[_i624+1];centerPos[2]+=positionsValue[_i624+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i625=0,_len120=positionsValue.length;_i625<_len120;_i625+=3){positionsValue[_i625+0]-=centerPos[0];positionsValue[_i625+1]-=centerPos[1];positionsValue[_i625+2]-=centerPos[2];}}if(_this178._rotateX){if(positionsValue){for(var _i626=0,_len121=positionsValue.length;_i626<_len121;_i626+=3){var temp=positionsValue[_i626+1];positionsValue[_i626+1]=positionsValue[_i626+2];positionsValue[_i626+2]=temp;}}}if(_this178._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this178._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i627=0,_len122=positionsValue.length;_i627<_len122;_i627+=3){pos[0]=positionsValue[_i627+0];pos[1]=positionsValue[_i627+1];pos[2]=positionsValue[_i627+2];math.transformPoint3(mat,pos,pos);positionsValue[_i627+0]=pos[0];positionsValue[_i627+1]=pos[1];positionsValue[_i627+2]=pos[2];}}if(_this178._transform){var _mat=math.mat4(_this178._transform);var _pos=math.vec3();for(var _i628=0,_len123=positionsValue.length;_i628<_len123;_i628+=3){_pos[0]=positionsValue[_i628+0];_pos[1]=positionsValue[_i628+1];_pos[2]=positionsValue[_i628+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i628+0]=_pos[0];positionsValue[_i628+1]=_pos[1];positionsValue[_i628+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i629=0,j=0,k=0,len=intensities.length;_i629<len;_i629++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i629]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i630=0,j=0,k=0,len=intensities.length;_i630<len;_i630++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i630]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$2(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i631=0,len=pointsChunks.length;_i631<len;_i631++){var meshId="pointsMesh".concat(_i631);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i631],colorsCompressed:_i631<colorsChunks.length?colorsChunks[_i631]:null});}/*
29958
+ */},{key:"load",value:function load(){var _this180=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{maxGeometryBatchSize:MAX_VERTICES,isModel:true}));if(!params.src&&!params.las){this.error("load() param expected: src or las");return sceneModel;// Return new empty model
29959
+ }var options={las:{skip:this._skip,fp64:this._fp64,colorDepth:this._colorDepth}};if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._parseModel(params.las,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this180.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this181=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this181._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this181.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this181.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this182=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this182._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i628=0,len=positionsValue.length;_i628<len;_i628+=3){centerPos[0]+=positionsValue[_i628+0];centerPos[1]+=positionsValue[_i628+1];centerPos[2]+=positionsValue[_i628+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i629=0,_len120=positionsValue.length;_i629<_len120;_i629+=3){positionsValue[_i629+0]-=centerPos[0];positionsValue[_i629+1]-=centerPos[1];positionsValue[_i629+2]-=centerPos[2];}}if(_this182._rotateX){if(positionsValue){for(var _i630=0,_len121=positionsValue.length;_i630<_len121;_i630+=3){var temp=positionsValue[_i630+1];positionsValue[_i630+1]=positionsValue[_i630+2];positionsValue[_i630+2]=temp;}}}if(_this182._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this182._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i631=0,_len122=positionsValue.length;_i631<_len122;_i631+=3){pos[0]=positionsValue[_i631+0];pos[1]=positionsValue[_i631+1];pos[2]=positionsValue[_i631+2];math.transformPoint3(mat,pos,pos);positionsValue[_i631+0]=pos[0];positionsValue[_i631+1]=pos[1];positionsValue[_i631+2]=pos[2];}}if(_this182._transform){var _mat=math.mat4(_this182._transform);var _pos=math.vec3();for(var _i632=0,_len123=positionsValue.length;_i632<_len123;_i632+=3){_pos[0]=positionsValue[_i632+0];_pos[1]=positionsValue[_i632+1];_pos[2]=positionsValue[_i632+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i632+0]=_pos[0];positionsValue[_i632+1]=_pos[1];positionsValue[_i632+2]=_pos[2];}}return positionsValue;};function readColorsAndIntensities(attributesColor,attributesIntensity){var colors=attributesColor.value;var colorSize=attributesColor.size;var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i633=0,j=0,k=0,len=intensities.length;_i633<len;_i633++,k+=colorSize,j+=4){colorsCompressed[j+0]=colors[k+0];colorsCompressed[j+1]=colors[k+1];colorsCompressed[j+2]=colors[k+2];colorsCompressed[j+3]=Math.round(intensities[_i633]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i634=0,j=0,k=0,len=intensities.length;_i634<len;_i634++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i634]/65536*255);}return colorsCompressed;}return new Promise(function(resolve,reject){if(sceneModel.destroyed){reject();return;}var stats=params.stats||{};stats.sourceFormat="LAS";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;try{var lasHeader=loadLASHeader(arrayBuffer);parse$2(arrayBuffer,LASLoader,options).then(function(parsedData){var attributes=parsedData.attributes;var loaderData=parsedData.loaderData;var pointsFormatId=loaderData.pointsFormatId!==undefined?loaderData.pointsFormatId:-1;if(!attributes.POSITION){sceneModel.finalize();reject("No positions found in file");return;}var positionsValue;var colorsCompressed;switch(pointsFormatId){case 0:positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 1:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readIntensities(attributes.intensity);break;case 2:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;case 3:if(!attributes.intensity){sceneModel.finalize();reject("No positions found in file");return;}positionsValue=readPositions(attributes.POSITION);colorsCompressed=readColorsAndIntensities(attributes.COLOR_0,attributes.intensity);break;}var pointsChunks=chunkArray(positionsValue,MAX_VERTICES*3);var colorsChunks=chunkArray(colorsCompressed,MAX_VERTICES*4);var meshIds=[];for(var _i635=0,len=pointsChunks.length;_i635<len;_i635++){var meshId="pointsMesh".concat(_i635);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i635],colorsCompressed:_i635<colorsChunks.length?colorsChunks[_i635]:null});}/*
29623
29960
  const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
29624
29961
  const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
29625
29962
  const meshIds = [];
@@ -29642,6 +29979,6 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
29642
29979
  geometryId
29643
29980
  });
29644
29981
  }
29645
- */var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this178.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this178.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29982
+ */var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this182.viewer.metaScene.createMetaModel(metaModelId,params.metaModelJSON,options);}else if(params.loadMetadata!==false){var rootMetaObjectId=math.createUUID();var metadata={projectId:"",author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[{id:rootMetaObjectId,name:"Model",type:"Model"},{id:pointsObjectId,name:"PointCloud (LAS)",type:"PointCloud",parent:rootMetaObjectId,attributes:lasHeader||{}}],propertySets:[]};var _metaModelId=sceneModel.id;_this182.viewer.metaScene.createMetaModel(_metaModelId,metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
29646
29983
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
29647
- });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i632=0;_i632<array.length;_i632+=chunkSize){result.push(array.slice(_i632,_i632+chunkSize));}return result;}export{AlphaFormat,AmbientLight,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsSimulateMouseControl,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,Canvas,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsSimulateMouseControl,DistanceMeasurementsTouchControl,EdgeMaterial,EmphasisMaterial,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,ObjectEditPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,Plugin,PointLight,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,Renderer$1 as Renderer,RepeatWrapping,Scene,SceneModel,SceneModelMesh,SceneModelTransform,SectionBox,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XTCDefaultDataSource,XTCLoaderPlugin,buildBoxGeometry,buildBoxLinesGeometry,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions};
29984
+ });resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i636=0;_i636<array.length;_i636+=chunkSize){result.push(array.slice(_i636,_i636+chunkSize));}return result;}export{AlphaFormat,AmbientLight,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsSimulateMouseControl,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,Canvas,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,DistanceMeasurementsSimulateMouseControl,DistanceMeasurementsTouchControl,EdgeMaterial,EmphasisMaterial,FastNavPlugin,FloatType,Fresnel,Frustum$1 as Frustum,FrustumPlane,GIFMediaType,GLTFDefaultDataSource,GLTFLoaderPlugin,HalfFloatType,ImagePlane,IntType,JPEGMediaType,KTX2TextureTranscoder,LASLoaderPlugin,LambertMaterial,LightMap,LineSet,LinearEncoding,LinearFilter,LinearMipMapLinearFilter,LinearMipMapNearestFilter,LinearMipmapLinearFilter,LinearMipmapNearestFilter,Loader,LoadingManager,LocaleService,LuminanceAlphaFormat,LuminanceFormat,Map$1 as Map,Marker,Mesh,MetallicMaterial,MirroredRepeatWrapping,ModelMemento,NavCubePlugin,NearestFilter,NearestMipMapLinearFilter,NearestMipMapNearestFilter,NearestMipmapLinearFilter,NearestMipmapNearestFilter,Node$1 as Node,ObjectEditPlugin,ObjectsKdTree3,ObjectsMemento,PNGMediaType,Path,PerformanceModel,PhongMaterial,Plugin,PointLight,PointerLens,QuadraticBezierCurve,Queue,RGBAFormat,RGBAIntegerFormat,RGBA_ASTC_10x10_Format,RGBA_ASTC_10x5_Format,RGBA_ASTC_10x6_Format,RGBA_ASTC_10x8_Format,RGBA_ASTC_12x10_Format,RGBA_ASTC_12x12_Format,RGBA_ASTC_4x4_Format,RGBA_ASTC_5x4_Format,RGBA_ASTC_5x5_Format,RGBA_ASTC_6x5_Format,RGBA_ASTC_6x6_Format,RGBA_ASTC_8x5_Format,RGBA_ASTC_8x6_Format,RGBA_ASTC_8x8_Format,RGBA_BPTC_Format,RGBA_ETC2_EAC_Format,RGBA_PVRTC_2BPPV1_Format,RGBA_PVRTC_4BPPV1_Format,RGBA_S3TC_DXT1_Format,RGBA_S3TC_DXT3_Format,RGBA_S3TC_DXT5_Format,RGBFormat,RGB_ETC1_Format,RGB_ETC2_Format,RGB_PVRTC_2BPPV1_Format,RGB_PVRTC_4BPPV1_Format,RGB_S3TC_DXT1_Format,RGFormat,RGIntegerFormat,ReadableGeometry,RedFormat,RedIntegerFormat,ReflectionMap,Renderer$1 as Renderer,RepeatWrapping,Scene,SceneModel,SceneModelMesh,SceneModelTransform,SectionBox,SectionPlane,SectionPlanesPlugin,ShortType,Skybox,SkyboxesPlugin,SpecularMaterial,SplineCurve,SpriteMarker,StoreyViewsPlugin,Texture,TextureTranscoder,TreeViewPlugin,UnsignedByteType,UnsignedInt248Type,UnsignedIntType,UnsignedShort4444Type,UnsignedShort5551Type,UnsignedShortType,VBOGeometry,ViewCullPlugin,Viewer,WebIFCLoaderPlugin,WorkerPool$1 as WorkerPool,XTCDefaultDataSource,XTCLoaderPlugin,buildBoxGeometry,buildBoxLinesGeometry,buildCylinderGeometry,buildGridGeometry,buildLineGeometry,buildPlaneGeometry,buildPolylineGeometry,buildPolylineGeometryFromCurve,buildSphereGeometry,buildTorusGeometry,buildVectorTextGeometry,createRTCViewMat,frustumIntersectsAABB3,getKTX2TextureTranscoder,getPlaneRTCPos,load3DSGeometry,loadOBJGeometry,math,rtcToWorldPos,sRGBEncoding,setFrustum,stats,utils,worldToRTCPos,worldToRTCPositions};