@xtctwins/tctwins-core 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/tctwins-core.es5.js +308 -300
- package/dist/tctwins-core.min.es5.js +3 -3
- package/package.json +1 -1
package/dist/tctwins-core.es5.js
CHANGED
|
@@ -5255,7 +5255,8 @@ document.addEventListener("dblclick",this._dblClickListener=function(e){if(!_thi
|
|
|
5255
5255
|
_this31.mouseDownLeft=false;_this31.mouseDownRight=false;break;case 2:// Middle/both buttons
|
|
5256
5256
|
_this31.mouseDownMiddle=false;break;case 3:// Right button
|
|
5257
5257
|
_this31.mouseDownLeft=false;_this31.mouseDownRight=false;break;}if("touches"in e){_this31._getTouchCanvasPos(e);}else{_this31._getMouseCanvasPos(e);}_this31.fire("dblclick",_this31.mouseCanvasPos,true);if(_this31.mouseover){e.preventDefault();}});var tickifedMouseMoveFn=this.scene.tickify(function(){return _this31.fire("mousemove",_this31.mouseCanvasPos,true);});this.scene.tickify(function(){return _this31.fire("touchmove",_this31.touchCanvasPos,true);});//mousemove
|
|
5258
|
-
this.element.addEventListener("mousemove",this._mouseMoveListener=function(e){if(!_this31.enabled){return;}_this31._getMouseCanvasPos(e);tickifedMouseMoveFn();if(_this31.mouseover){e.preventDefault();}});var tickifiedMouseWheelFn=this.scene.tickify(function(delta){_this31.fire("mousewheel",delta,true);});var wheelSpeed=40;this.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>2000){var rate=parseInt((maxV+minV)/2)/250;wheelSpeed=rate*40;}if(minV<10){var _rate=parseInt((maxV+minV)/2*10000)/10000/
|
|
5258
|
+
this.element.addEventListener("mousemove",this._mouseMoveListener=function(e){if(!_this31.enabled){return;}_this31._getMouseCanvasPos(e);tickifedMouseMoveFn();if(_this31.mouseover){e.preventDefault();}});var tickifiedMouseWheelFn=this.scene.tickify(function(delta){_this31.fire("mousewheel",delta,true);});var wheelSpeed=40;this.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>2000){var rate=parseInt((maxV+minV)/2)/250;wheelSpeed=rate*40;}if((minV+maxV)/2<10){if(maxV<14){var _rate=parseInt((maxV+minV)/2*10000)/10000/500;wheelSpeed=_rate*40;}}if((minV+maxV)/2<0.1){var _rate2=parseInt((maxV+minV)/2*10000)/10000/250;wheelSpeed=_rate2*40;}// console.log("wheelSpeed:", wheelSpeed)
|
|
5259
|
+
});//wheel
|
|
5259
5260
|
this.element.addEventListener("wheel",this._mouseWheelListener=function(e,d){if(!_this31.enabled){return;}var delta=-e.deltaY*wheelSpeed;tickifiedMouseWheelFn(delta);},{passive:true});//mousedown
|
|
5260
5261
|
this.element.addEventListener("mousedown",this._mouseDownListener=function(e){if(!_this31.enabled){return;}switch(e.which){case 1:// Left button
|
|
5261
5262
|
_this31.mouseDownLeft=true;break;case 2:// Middle/both buttons
|
|
@@ -12807,8 +12808,8 @@ if(p===UnsignedInt248Type){return gl.UNSIGNED_INT_24_8;}if(p===RepeatWrapping){r
|
|
|
12807
12808
|
* @desc A low-level component that represents a 2D WebGL texture.
|
|
12808
12809
|
*
|
|
12809
12810
|
* @private
|
|
12810
|
-
*/var Texture2D=/*#__PURE__*/function(){function Texture2D(_ref4){var gl=_ref4.gl,target=_ref4.target,format=_ref4.format,type=_ref4.type,wrapS=_ref4.wrapS,wrapT=_ref4.wrapT,wrapR=_ref4.wrapR,encoding=_ref4.encoding,preloadColor=_ref4.preloadColor,premultiplyAlpha=_ref4.premultiplyAlpha,flipY=_ref4.flipY;_classCallCheck(this,Texture2D);this.gl=gl;this.target=target||gl.TEXTURE_2D;this.format=format||RGBAFormat;this.type=type||UnsignedByteType;this.internalFormat=null;this.premultiplyAlpha=!!premultiplyAlpha;this.flipY=!!flipY;this.unpackAlignment=4;this.wrapS=wrapS||RepeatWrapping;this.wrapT=wrapT||RepeatWrapping;this.wrapR=wrapR||RepeatWrapping;this.encoding=encoding||sRGBEncoding;this.texture=gl.createTexture();if(preloadColor){this.setPreloadColor(preloadColor);// Prevents "there is no texture bound to the unit 0" error
|
|
12811
|
-
}this.allocated=true;}return _createClass(Texture2D,[{key:"setPreloadColor",value:function setPreloadColor(value){if(!value){color$4[0]=0;color$4[1]=0;color$4[2]=0;color$4[3]=255;}else{color$4[0]=Math.floor(value[0]*255);color$4[1]=Math.floor(value[1]*255);color$4[2]=Math.floor(value[2]*255);color$4[3]=Math.floor((value[3]!==undefined?value[3]:1)*255);}var gl=this.gl;gl.bindTexture(this.target,this.texture);if(this.target===gl.TEXTURE_CUBE_MAP){var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i148=0,len=faces.length;_i148<len;_i148++){gl.texImage2D(faces[_i148],0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$4);}}else{gl.texImage2D(this.target,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$4);}gl.bindTexture(this.target,null);}},{key:"setTarget",value:function setTarget(target){this.target=target||this.gl.TEXTURE_2D;}},{key:"setImage",value:function setImage(image){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}var generateMipMap=false;gl.bindTexture(this.target,this.texture);var bak1=gl.getParameter(gl.UNPACK_FLIP_Y_WEBGL);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);var bak2=gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var bak3=gl.getParameter(gl.UNPACK_ALIGNMENT);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);var bak4=gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var minFilter=convertConstant(gl,this.minFilter);gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){generateMipMap=true;}var magFilter=convertConstant(gl,this.magFilter);if(magFilter){gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);if(this.target===gl.TEXTURE_CUBE_MAP){if(utils.isArray(image)){var images=image;var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i149=0,len=faces.length;_i149<len;_i149++){gl.texImage2D(faces[_i149],0,glInternalFormat,glFormat,glType,images[_i149]);}}}else{gl.texImage2D(gl.TEXTURE_2D,0,glInternalFormat,glFormat,glType,image);}if(generateMipMap){gl.generateMipmap(this.target);}gl.bindTexture(this.target,null);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,bak1);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,bak2);gl.pixelStorei(gl.UNPACK_ALIGNMENT,bak3);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,bak4);}},{key:"setCompressedData",value:function setCompressedData(_ref5){var mipmaps=_ref5.mipmaps,_ref5$props=_ref5.props,props=_ref5$props===void 0?{}:_ref5$props;var gl=this.gl;var levels=mipmaps.length;// Cache props
|
|
12811
|
+
*/var Texture2D=/*#__PURE__*/function(){function Texture2D(_ref4){var gl=_ref4.gl,target=_ref4.target,format=_ref4.format,type=_ref4.type,wrapS=_ref4.wrapS,wrapT=_ref4.wrapT,wrapR=_ref4.wrapR,encoding=_ref4.encoding,preloadColor=_ref4.preloadColor,premultiplyAlpha=_ref4.premultiplyAlpha,flipY=_ref4.flipY;var scene=arguments.length>1&&arguments[1]!==undefined?arguments[1]:null;_classCallCheck(this,Texture2D);this.gl=gl;this.target=target||gl.TEXTURE_2D;this.format=format||RGBAFormat;this.type=type||UnsignedByteType;this.internalFormat=null;this.premultiplyAlpha=!!premultiplyAlpha;this.flipY=!!flipY;this.unpackAlignment=4;this.wrapS=wrapS||RepeatWrapping;this.wrapT=wrapT||RepeatWrapping;this.wrapR=wrapR||RepeatWrapping;this.encoding=encoding||sRGBEncoding;this.texture=gl.createTexture();this.scene=scene;if(preloadColor){this.setPreloadColor(preloadColor);// Prevents "there is no texture bound to the unit 0" error
|
|
12812
|
+
}this.allocated=true;}return _createClass(Texture2D,[{key:"setPreloadColor",value:function setPreloadColor(value){if(!value){color$4[0]=0;color$4[1]=0;color$4[2]=0;color$4[3]=255;}else{color$4[0]=Math.floor(value[0]*255);color$4[1]=Math.floor(value[1]*255);color$4[2]=Math.floor(value[2]*255);color$4[3]=Math.floor((value[3]!==undefined?value[3]:1)*255);}var gl=this.gl;gl.bindTexture(this.target,this.texture);if(this.target===gl.TEXTURE_CUBE_MAP){var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i148=0,len=faces.length;_i148<len;_i148++){gl.texImage2D(faces[_i148],0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$4);}}else{gl.texImage2D(this.target,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$4);}gl.bindTexture(this.target,null);}},{key:"setTarget",value:function setTarget(target){this.target=target||this.gl.TEXTURE_2D;}},{key:"setImageBuffer",value:function setImageBuffer(arrayBuffer){var _this59=this;var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var blob=new Blob([arrayBuffer],{type:"image/jpeg"});createImageBitmap(blob).then(function(imgBitMap){_this59.setImage(imgBitMap,props);_this59.scene&&_this59.scene._renderer.render({force:true});});}},{key:"setImage",value:function setImage(image){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}var generateMipMap=false;gl.bindTexture(this.target,this.texture);var bak1=gl.getParameter(gl.UNPACK_FLIP_Y_WEBGL);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);var bak2=gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var bak3=gl.getParameter(gl.UNPACK_ALIGNMENT);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);var bak4=gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var minFilter=convertConstant(gl,this.minFilter);gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){generateMipMap=true;}var magFilter=convertConstant(gl,this.magFilter);if(magFilter){gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);if(this.target===gl.TEXTURE_CUBE_MAP){if(utils.isArray(image)){var images=image;var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i149=0,len=faces.length;_i149<len;_i149++){gl.texImage2D(faces[_i149],0,glInternalFormat,glFormat,glType,images[_i149]);}}}else{gl.texImage2D(gl.TEXTURE_2D,0,glInternalFormat,glFormat,glType,image);}if(generateMipMap){gl.generateMipmap(this.target);}gl.bindTexture(this.target,null);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,bak1);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,bak2);gl.pixelStorei(gl.UNPACK_ALIGNMENT,bak3);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,bak4);}},{key:"setCompressedData",value:function setCompressedData(_ref5){var mipmaps=_ref5.mipmaps,_ref5$props=_ref5.props,props=_ref5$props===void 0?{}:_ref5$props;var gl=this.gl;var levels=mipmaps.length;// Cache props
|
|
12812
12813
|
if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}gl.activeTexture(gl.TEXTURE0+0);gl.bindTexture(this.target,this.texture);var supportsMips=mipmaps.length>1;gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}if(this.type===gl.TEXTURE_3D||this.type===gl.TEXTURE_2D_ARRAY){var wrapR=convertConstant(gl,this.wrapR);if(wrapR){gl.texParameteri(this.target,gl.TEXTURE_WRAP_R,wrapR);}gl.texParameteri(this.type,gl.TEXTURE_WRAP_R,wrapR);}if(supportsMips){gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,filterFallback(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,filterFallback(gl,this.magFilter));}else{gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,convertConstant(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,convertConstant(gl,this.magFilter));}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);gl.texStorage2D(gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(var _i150=0,len=mipmaps.length;_i150<len;_i150++){var mipmap=mipmaps[_i150];if(this.format!==RGBAFormat){if(glFormat!==null){gl.compressedTexSubImage2D(gl.TEXTURE_2D,_i150,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}else{console.warn('Attempt to load unsupported compressed texture format in .setCompressedData()');}}else{gl.texSubImage2D(gl.TEXTURE_2D,_i150,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}// if (generateMipMap) {
|
|
12813
12814
|
// // gl.generateMipmap(this.target); // Only for roughness textures?
|
|
12814
12815
|
// }
|
|
@@ -12876,13 +12877,13 @@ gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(prop
|
|
|
12876
12877
|
* @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
|
|
12877
12878
|
* @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
|
|
12878
12879
|
* @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
|
|
12879
|
-
*/function Texture(owner){var
|
|
12880
|
-
|
|
12881
|
-
|
|
12882
|
-
|
|
12883
|
-
if(cfg.src){
|
|
12884
|
-
}else if(cfg.image){
|
|
12885
|
-
}stats.memory.textures++;return
|
|
12880
|
+
*/function Texture(owner){var _this60;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Texture);_this60=_callSuper(this,Texture,[owner,cfg]);_this60._state=new RenderState({texture:new Texture2D({gl:_this60.scene.canvas.gl}),matrix:math.identityMat4(),hasMatrix:cfg.translate&&(cfg.translate[0]!==0||cfg.translate[1]!==0)||!!cfg.rotate||cfg.scale&&(cfg.scale[0]!==0||cfg.scale[1]!==0),minFilter:_this60._checkMinFilter(cfg.minFilter||1008),magFilter:_this60._checkMagFilter(cfg.magFilter||1006),wrapS:_this60._checkWrapS(cfg.wrapS||1000),wrapT:_this60._checkWrapT(cfg.wrapT||1000),flipY:_this60._checkFlipY(cfg.flipY||1000),encoding:_this60._checkEncoding(cfg.encoding)});// Data source
|
|
12881
|
+
_this60._src=null;_this60._image=null;// Transformation
|
|
12882
|
+
_this60._translate=math.vec2([0,0]);_this60._scale=math.vec2([1,1]);_this60._rotate=math.vec2([0,0]);_this60._matrixDirty=false;// Transform
|
|
12883
|
+
_this60.translate=cfg.translate;_this60.scale=cfg.scale;_this60.rotate=cfg.rotate;// Data source
|
|
12884
|
+
if(cfg.src){_this60.src=cfg.src;// Image file
|
|
12885
|
+
}else if(cfg.image){_this60.image=cfg.image;// Image object
|
|
12886
|
+
}stats.memory.textures++;return _this60;}_inherits(Texture,_Component24);return _createClass(Texture,[{key:"type",get:/**
|
|
12886
12887
|
@private
|
|
12887
12888
|
*/function get(){return"Texture";}},{key:"_checkMinFilter",value:function _checkMinFilter(value){value=value||LinearMipMapLinearFilter;if(value!==LinearFilter&&value!==LinearMipMapNearestFilter&&value!==LinearMipMapLinearFilter&&value!==NearestMipMapLinearFilter&&value!==NearestMipMapNearestFilter){this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, "+"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.");value=LinearMipMapLinearFilter;}return value;}},{key:"_checkMagFilter",value:function _checkMagFilter(value){value=value||LinearFilter;if(value!==LinearFilter&&value!==NearestFilter){this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");value=LinearFilter;}return value;}},{key:"_checkWrapS",value:function _checkWrapS(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkWrapT",value:function _checkWrapT(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{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._state.texture=new Texture2D({gl:this.scene.canvas.gl});if(this._image){this.image=this._image;}else if(this._src){this.src=this._src;}}},{key:"_update",value:function _update(){var state=this._state;if(this._matrixDirty){var _matrix;var t;if(this._translate[0]!==0||this._translate[1]!==0){_matrix=math.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix);}if(this._scale[0]!==1||this._scale[1]!==1){t=math.scalingMat4v([this._scale[0],this._scale[1],1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(this._rotate!==0){t=math.rotationMat4v(this._rotate*0.0174532925,[0,0,1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(_matrix){state.matrix=_matrix;}this._matrixDirty=false;}this.glRedraw();}/**
|
|
12888
12889
|
* Sets an HTML DOM Image object to source this Texture from.
|
|
@@ -13091,7 +13092,7 @@ v edgeBias: 0.2,
|
|
|
13091
13092
|
* @param {Number} [cfg.edgeBias=0] Bias at the edge.
|
|
13092
13093
|
* @param {Number} [cfg.centerBias=1] Bias at the center.
|
|
13093
13094
|
* @param {Number} [cfg.power=0] The power.
|
|
13094
|
-
*/function Fresnel(owner){var
|
|
13095
|
+
*/function Fresnel(owner){var _this61;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Fresnel);_this61=_callSuper(this,Fresnel,[owner,cfg]);_this61._state=new RenderState({edgeColor:math.vec3([0,0,0]),centerColor:math.vec3([1,1,1]),edgeBias:0,centerBias:1,power:1});_this61.edgeColor=cfg.edgeColor;_this61.centerColor=cfg.centerColor;_this61.edgeBias=cfg.edgeBias;_this61.centerBias=cfg.centerBias;_this61.power=cfg.power;return _this61;}/**
|
|
13095
13096
|
* Sets the Fresnel's edge color.
|
|
13096
13097
|
*
|
|
13097
13098
|
* Default value is ````[0.0, 0.0, 0.0]````.
|
|
@@ -13203,15 +13204,15 @@ v edgeBias: 0.2,
|
|
|
13203
13204
|
* @param {Number[]} [cfg.colors] Vertex colors.
|
|
13204
13205
|
* @param {Number[]} [cfg.indices] Indices array.
|
|
13205
13206
|
* @param {Number} [cfg.edgeThreshold=10] When autogenerating edges for supporting {@link Drawable#edges}, this indicates the threshold angle (in degrees) between the face normals of adjacent triangles below which the edge is discarded.
|
|
13206
|
-
*/function VBOGeometry(owner){var
|
|
13207
|
+
*/function VBOGeometry(owner){var _this62;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,VBOGeometry);_this62=_callSuper(this,VBOGeometry,[owner,cfg]);_this62._state=new RenderState({// Arrays for emphasis effects are got from xeokit.GeometryLite friend methods
|
|
13207
13208
|
compressGeometry:true,primitive:null,// WebGL enum
|
|
13208
13209
|
primitiveName:null,// String
|
|
13209
13210
|
positionsDecodeMatrix:null,// Set when compressGeometry == true
|
|
13210
13211
|
uvDecodeMatrix:null,// Set when compressGeometry == true
|
|
13211
|
-
positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""});
|
|
13212
|
-
}if(!cfg.indices){
|
|
13212
|
+
positionsBuf:null,normalsBuf:null,colorsbuf:null,uvBuf:null,indicesBuf:null,hash:""});_this62._numTriangles=0;_this62._edgeThreshold=cfg.edgeThreshold||10.0;_this62._aabb=null;_this62._obb=math.OBB3();var state=_this62._state;var gl=_this62.scene.canvas.gl;cfg.primitive=cfg.primitive||"triangles";switch(cfg.primitive){case"points":state.primitive=gl.POINTS;state.primitiveName=cfg.primitive;break;case"lines":state.primitive=gl.LINES;state.primitiveName=cfg.primitive;break;case"line-loop":state.primitive=gl.LINE_LOOP;state.primitiveName=cfg.primitive;break;case"line-strip":state.primitive=gl.LINE_STRIP;state.primitiveName=cfg.primitive;break;case"triangles":state.primitive=gl.TRIANGLES;state.primitiveName=cfg.primitive;break;case"triangle-strip":state.primitive=gl.TRIANGLE_STRIP;state.primitiveName=cfg.primitive;break;case"triangle-fan":state.primitive=gl.TRIANGLE_FAN;state.primitiveName=cfg.primitive;break;default:_this62.error("Unsupported value for 'primitive': '"+cfg.primitive+"' - supported values are 'points', 'lines', 'line-loop', 'line-strip', 'triangles', "+"'triangle-strip' and 'triangle-fan'. Defaulting to 'triangles'.");state.primitive=gl.TRIANGLES;state.primitiveName=cfg.primitive;}if(!cfg.positions){_this62.error("Config expected: positions");return _possibleConstructorReturn(_this62);// TODO: Recover?
|
|
13213
|
+
}if(!cfg.indices){_this62.error("Config expected: indices");return _possibleConstructorReturn(_this62);// TODO: Recover?
|
|
13213
13214
|
}var positions;{var positionsDecodeMatrix=cfg.positionsDecodeMatrix;if(positionsDecodeMatrix);else{// Uncompressed positions
|
|
13214
|
-
var bounds=geometryCompressionUtils.getPositionsBounds(cfg.positions);var result=geometryCompressionUtils.compressPositions(cfg.positions,bounds.min,bounds.max);positions=result.quantized;state.positionsDecodeMatrix=result.decodeMatrix;state.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,positions,positions.length,3,gl.STATIC_DRAW);memoryStats.positions+=state.positionsBuf.numItems;math.positions3ToAABB3(cfg.positions,
|
|
13215
|
+
var bounds=geometryCompressionUtils.getPositionsBounds(cfg.positions);var result=geometryCompressionUtils.compressPositions(cfg.positions,bounds.min,bounds.max);positions=result.quantized;state.positionsDecodeMatrix=result.decodeMatrix;state.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,positions,positions.length,3,gl.STATIC_DRAW);memoryStats.positions+=state.positionsBuf.numItems;math.positions3ToAABB3(cfg.positions,_this62._aabb);math.positions3ToAABB3(positions,tempAABB$1,state.positionsDecodeMatrix);math.AABB3ToOBB3(tempAABB$1,_this62._obb);}}if(cfg.colors){var colors=cfg.colors.constructor===Float32Array?cfg.colors:new Float32Array(cfg.colors);state.colorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,colors,colors.length,4,gl.STATIC_DRAW);memoryStats.colors+=state.colorsBuf.numItems;}if(cfg.uv){var _bounds2=geometryCompressionUtils.getUVBounds(cfg.uv);var _result2=geometryCompressionUtils.compressUVs(cfg.uv,_bounds2.min,_bounds2.max);var uv=_result2.quantized;state.uvDecodeMatrix=_result2.decodeMatrix;state.uvBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,uv,uv.length,2,gl.STATIC_DRAW);memoryStats.uvs+=state.uvBuf.numItems;}if(cfg.normals){var normals=geometryCompressionUtils.compressNormals(cfg.normals);var normalized=state.compressGeometry;state.normalsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,normals,normals.length,3,gl.STATIC_DRAW,normalized);memoryStats.normals+=state.normalsBuf.numItems;}{var indices=cfg.indices.constructor===Uint32Array||cfg.indices.constructor===Uint16Array?cfg.indices:new Uint32Array(cfg.indices);state.indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,indices,indices.length,1,gl.STATIC_DRAW);memoryStats.indices+=state.indicesBuf.numItems;var edgeIndices=buildEdgeIndices(positions,indices,state.positionsDecodeMatrix,_this62._edgeThreshold);_this62._edgeIndicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,edgeIndices,edgeIndices.length,1,gl.STATIC_DRAW);if(_this62._state.primitiveName==="triangles"){_this62._numTriangles=cfg.indices.length/3;}}_this62._buildHash();memoryStats.meshes++;return _this62;}_inherits(VBOGeometry,_Geometry2);return _createClass(VBOGeometry,[{key:"type",get:/**
|
|
13215
13216
|
@private
|
|
13216
13217
|
*/function get(){return"VBOGeometry";}/**
|
|
13217
13218
|
* @private
|
|
@@ -14032,7 +14033,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
14032
14033
|
* @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.
|
|
14033
14034
|
* @param {String} [cfg.imageData] Image data as a base64 encoded string.
|
|
14034
14035
|
* @param {String} [cfg.type="jpg"] Image MIME type. Accepted values are "jpg" and "png". Default is "jpg". Normally only needed with ````image```` or ````imageData````. Automatically inferred from file extension of ````src````, if the file has a recognized extension.
|
|
14035
|
-
*/function Bitmap(owner){var
|
|
14036
|
+
*/function Bitmap(owner){var _this63;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Bitmap);_this63=_callSuper(this,Bitmap,[owner,cfg]);_this63._type=cfg.type||(cfg.src?cfg.src.split(".").pop():null)||"jpg";_this63._pos=math.vec3(cfg.pos||[0,0,0]);_this63._up=math.vec3(cfg.up||[0,1,0]);_this63._normal=math.vec3(cfg.normal||[0,0,1]);_this63._height=cfg.height||1.0;_this63._origin=math.vec3();_this63._rtcPos=math.vec3();_this63._imageSize=math.vec2();_this63._texture=new Texture(_this63,{flipY:true});_this63._image=new Image();if(_this63._type!=="jpg"&&_this63._type!=="png"){_this63.error("Unsupported type - defaulting to \"jpg\"");_this63._type="jpg";}_this63._node=new Node$1(_this63,{matrix:math.inverseMat4(math.lookAtMat4v(_this63._pos,math.subVec3(_this63._pos,_this63._normal,math.mat4()),_this63._up,math.mat4())),children:[_this63._bitmapMesh=new Mesh(_this63,{scale:[1,1,1],rotation:[-90,0,0],collidable:cfg.collidable,pickable:cfg.pickable,opacity:cfg.opacity,clippable:cfg.clippable,geometry:new ReadableGeometry(_this63,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:2,zSegments:2})),material:new PhongMaterial(_this63,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this63._texture,emissiveMap:_this63._texture,backfaces:true})})]});if(cfg.image){_this63.image=cfg.image;}else if(cfg.src){_this63.src=cfg.src;}else if(cfg.imageData){_this63.imageData=cfg.imageData;}_this63.scene._bitmapCreated(_this63);return _this63;}/**
|
|
14036
14037
|
* Sets if this ````Bitmap```` is visible or not.
|
|
14037
14038
|
*
|
|
14038
14039
|
* Default value is ````true````.
|
|
@@ -14082,7 +14083,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
14082
14083
|
* You may also need to set {@link Bitmap#type}, if you want to read the image data with {@link Bitmap#imageData}.
|
|
14083
14084
|
*
|
|
14084
14085
|
* @type {String}
|
|
14085
|
-
*/,set:function set(src){var
|
|
14086
|
+
*/,set:function set(src){var _this64=this;if(src){this._image.onload=function(){_this64._texture.image=_this64._image;_this64._imageSize[0]=_this64._image.width;_this64._imageSize[1]=_this64._image.height;_this64._updateBitmapMeshScale();};this._image.src=src;var ext=src.split(".").pop();switch(ext){case"jpeg":case"jpg":this._type="jpg";break;case"png":this._type="png";}}}},{key:"imageData",get:/**
|
|
14086
14087
|
* Gets the image file path that the ````Bitmap````'s image is sourced from, if set.
|
|
14087
14088
|
*
|
|
14088
14089
|
* Returns null if not set.
|
|
@@ -14098,7 +14099,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
14098
14099
|
* Default is "jpg".
|
|
14099
14100
|
*
|
|
14100
14101
|
* @type {String}
|
|
14101
|
-
*/,set:function set(imageData){var
|
|
14102
|
+
*/,set:function set(imageData){var _this65=this;this._image.onload=function(){_this65._texture.image=image;_this65._imageSize[0]=image.width;_this65._imageSize[1]=image.height;_this65._updateBitmapMeshScale();};this._image.src=imageData;}},{key:"type",get:/**
|
|
14102
14103
|
* Gets the MIME type of this Bitmap.
|
|
14103
14104
|
*
|
|
14104
14105
|
* @type {String}
|
|
@@ -15563,18 +15564,18 @@ dataTextureRamStats$1.numberOfLayers++;this._layerNumber=numLayers$1++;this.sort
|
|
|
15563
15564
|
this.layerIndex=cfg.layerIndex;// Index of this DTXLinesLayer in {@link SceneModel#_layerList}.
|
|
15564
15565
|
this._renderers=getRenderers$1(model.scene);this.model=model;this._buffer=new DTXLinesBuffer();this._dataTextureState=new DTXLinesState();this._dataTextureGenerator=new DTXLinesTextureFactory();this._state=new RenderState({origin:math.vec3(cfg.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0});this._numPortions=0;// These counts are used to avoid unnecessary render passes
|
|
15565
15566
|
this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numSelectedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numClippableLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;this._subPortions=[];this._portionToSubPortionsMap=[];this._bucketGeometries={};this._meshes=[];this._aabb=math.collapseAABB3();this.aabbDirty=true;this._numUpdatesInFrame=0;this._finalized=false;}return _createClass(DTXLinesLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i314=0,len=this._meshes.length;_i314<len;_i314++){math.expandAABB3(this._aabb,this._meshes[_i314].aabb);}this.aabbDirty=false;}return this._aabb;}},{key:"canCreatePortion",value:function canCreatePortion(portionCfg){if(this._finalized){throw"Already finalized";}var numNewPortions=portionCfg.buckets.length;if(this._numPortions+numNewPortions>MAX_NUMBER_OF_OBJECTS_IN_LAYER$1){dataTextureRamStats$1.cannotCreatePortion.because10BitsObjectId++;}var retVal=this._numPortions+numNewPortions<=MAX_NUMBER_OF_OBJECTS_IN_LAYER$1;var bucketIndex=0;// TODO: Is this a bug?
|
|
15566
|
-
var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var alreadyHasPortionGeometry=this._bucketGeometries[bucketGeometryId];if(!alreadyHasPortionGeometry){var maxIndicesOfAnyBits=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);var numVertices=0;var _numIndices=0;portionCfg.buckets.forEach(function(bucket){numVertices+=bucket.positionsCompressed.length/3;_numIndices+=bucket.indices.length/2;});if(this._state.numVertices+numVertices>MAX_DATA_TEXTURE_HEIGHT$1*4096||maxIndicesOfAnyBits+_numIndices>MAX_DATA_TEXTURE_HEIGHT$1*4096){dataTextureRamStats$1.cannotCreatePortion.becauseTextureSize++;}retVal&&(retVal=this._state.numVertices+numVertices<=MAX_DATA_TEXTURE_HEIGHT$1*4096&&maxIndicesOfAnyBits+_numIndices<=MAX_DATA_TEXTURE_HEIGHT$1*4096);}return retVal;}},{key:"createPortion",value:function createPortion(mesh,portionCfg){var
|
|
15567
|
-
portionCfg.buckets.forEach(function(bucket,bucketIndex){var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var bucketGeometry=
|
|
15568
|
-
var subPortionId=
|
|
15567
|
+
var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var alreadyHasPortionGeometry=this._bucketGeometries[bucketGeometryId];if(!alreadyHasPortionGeometry){var maxIndicesOfAnyBits=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);var numVertices=0;var _numIndices=0;portionCfg.buckets.forEach(function(bucket){numVertices+=bucket.positionsCompressed.length/3;_numIndices+=bucket.indices.length/2;});if(this._state.numVertices+numVertices>MAX_DATA_TEXTURE_HEIGHT$1*4096||maxIndicesOfAnyBits+_numIndices>MAX_DATA_TEXTURE_HEIGHT$1*4096){dataTextureRamStats$1.cannotCreatePortion.becauseTextureSize++;}retVal&&(retVal=this._state.numVertices+numVertices<=MAX_DATA_TEXTURE_HEIGHT$1*4096&&maxIndicesOfAnyBits+_numIndices<=MAX_DATA_TEXTURE_HEIGHT$1*4096);}return retVal;}},{key:"createPortion",value:function createPortion(mesh,portionCfg){var _this66=this;if(this._finalized){throw"Already finalized";}var subPortionIds=[];// const portionAABB = portionCfg.worldAABB;
|
|
15568
|
+
portionCfg.buckets.forEach(function(bucket,bucketIndex){var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var bucketGeometry=_this66._bucketGeometries[bucketGeometryId];if(!bucketGeometry){bucketGeometry=_this66._createBucketGeometry(portionCfg,bucket);_this66._bucketGeometries[bucketGeometryId]=bucketGeometry;}// const subPortionAABB = math.collapseAABB3(tempAABB3b);
|
|
15569
|
+
var subPortionId=_this66._createSubPortion(portionCfg,bucketGeometry,bucket);//math.expandAABB3(portionAABB, subPortionAABB);
|
|
15569
15570
|
subPortionIds.push(subPortionId);});var portionId=this._portionToSubPortionsMap.length;this._portionToSubPortionsMap.push(subPortionIds);this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"_createBucketGeometry",value:function _createBucketGeometry(portionCfg,bucket){if(bucket.indices){var alignedIndicesLen=Math.ceil(bucket.indices.length/2/INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1)*INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1*2;dataTextureRamStats$1.overheadSizeAlignementIndices+=2*(alignedIndicesLen-bucket.indices.length);var alignedIndices=new Uint32Array(alignedIndicesLen);alignedIndices.fill(0);alignedIndices.set(bucket.indices);bucket.indices=alignedIndices;}var positionsCompressed=bucket.positionsCompressed;var indices=bucket.indices;var buffer=this._buffer;buffer.positionsCompressed.push(positionsCompressed);var vertexBase=buffer.lenPositionsCompressed/3;var numVertices=positionsCompressed.length/3;buffer.lenPositionsCompressed+=positionsCompressed.length;var indicesBase;var numLines=0;if(indices){numLines=indices.length/2;var indicesBuffer;if(numVertices<=1<<8){indicesBuffer=buffer.indices8Bits;indicesBase=buffer.lenIndices8Bits/2;buffer.lenIndices8Bits+=indices.length;}else if(numVertices<=1<<16){indicesBuffer=buffer.indices16Bits;indicesBase=buffer.lenIndices16Bits/2;buffer.lenIndices16Bits+=indices.length;}else{indicesBuffer=buffer.indices32Bits;indicesBase=buffer.lenIndices32Bits/2;buffer.lenIndices32Bits+=indices.length;}indicesBuffer.push(indices);}this._state.numVertices+=numVertices;dataTextureRamStats$1.numberOfGeometries++;var bucketGeometry={vertexBase:vertexBase,numVertices:numVertices,numLines:numLines,indicesBase:indicesBase};return bucketGeometry;}},{key:"_createSubPortion",value:function _createSubPortion(portionCfg,bucketGeometry){var color=portionCfg.color;var colors=portionCfg.colors;var opacity=portionCfg.opacity;var meshMatrix=portionCfg.meshMatrix;var pickColor=portionCfg.pickColor;var buffer=this._buffer;var state=this._state;buffer.perObjectPositionsDecodeMatrices.push(portionCfg.positionsDecodeMatrix);buffer.perObjectInstancePositioningMatrices.push(meshMatrix||DEFAULT_MATRIX$2);buffer.perObjectSolid.push(!!portionCfg.solid);if(colors){buffer.perObjectColors.push([colors[0]*255,colors[1]*255,colors[2]*255,255]);}else if(color){// Color is pre-quantized by SceneModel
|
|
15570
15571
|
buffer.perObjectColors.push([color[0],color[1],color[2],opacity]);}buffer.perObjectPickColors.push(pickColor);buffer.perObjectVertexBases.push(bucketGeometry.vertexBase);{var currentNumIndices;if(bucketGeometry.numVertices<=1<<8){currentNumIndices=state.numIndices8Bits;}else if(bucketGeometry.numVertices<=1<<16){currentNumIndices=state.numIndices16Bits;}else{currentNumIndices=state.numIndices32Bits;}buffer.perObjectIndexBaseOffsets.push(currentNumIndices/2-bucketGeometry.indicesBase);}var subPortionId=this._subPortions.length;if(bucketGeometry.numLines>0){var _numIndices2=bucketGeometry.numLines*2;var indicesPortionIdBuffer;if(bucketGeometry.numVertices<=1<<8){indicesPortionIdBuffer=buffer.perLineNumberPortionId8Bits;state.numIndices8Bits+=_numIndices2;dataTextureRamStats$1.totalLines8Bits+=bucketGeometry.numLines;}else if(bucketGeometry.numVertices<=1<<16){indicesPortionIdBuffer=buffer.perLineNumberPortionId16Bits;state.numIndices16Bits+=_numIndices2;dataTextureRamStats$1.totalLines16Bits+=bucketGeometry.numLines;}else{indicesPortionIdBuffer=buffer.perLineNumberPortionId32Bits;state.numIndices32Bits+=_numIndices2;dataTextureRamStats$1.totalLines32Bits+=bucketGeometry.numLines;}dataTextureRamStats$1.totalLines+=bucketGeometry.numLines;for(var _i315=0;_i315<bucketGeometry.numLines;_i315+=INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1){indicesPortionIdBuffer.push(subPortionId);}}this._subPortions.push({// vertsBase: vertsIndex,
|
|
15571
15572
|
numVertices:bucketGeometry.numLines});this._numPortions++;dataTextureRamStats$1.numberOfPortions++;return subPortionId;}/**
|
|
15572
15573
|
* Builds data textures from the appended geometries and loads them into the GPU.
|
|
15573
15574
|
*
|
|
15574
15575
|
* No more portions can then be created.
|
|
15575
|
-
*/},{key:"finalize",value:function finalize(){var
|
|
15576
|
+
*/},{key:"finalize",value:function finalize(){var _this67=this;if(this._finalized){return;}var state=this._state;var textureState=this._dataTextureState;var gl=this.model.scene.canvas.gl;var buffer=this._buffer;state.gl=gl;textureState.texturePerObjectColorsAndFlags=this._dataTextureGenerator.generateTextureForColorsAndFlags(gl,buffer.perObjectColors,buffer.perObjectPickColors,buffer.perObjectVertexBases,buffer.perObjectIndexBaseOffsets,buffer.perObjectSolid);textureState.texturePerObjectInstanceMatrices=this._dataTextureGenerator.generateTextureForInstancingMatrices(gl,buffer.perObjectInstancePositioningMatrices);textureState.texturePerObjectPositionsDecodeMatrix=this._dataTextureGenerator.generateTextureForPositionsDecodeMatrices(gl,buffer.perObjectPositionsDecodeMatrices);textureState.texturePerVertexIdCoordinates=this._dataTextureGenerator.generateTextureForPositions(gl,buffer.positionsCompressed,buffer.lenPositionsCompressed);textureState.texturePerLineIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId8Bits);textureState.texturePerLineIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId16Bits);textureState.texturePerLineIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId32Bits);if(buffer.lenIndices8Bits>0){textureState.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}textureState.finalize();// Free up memory
|
|
15576
15577
|
this._buffer=null;this._bucketGeometries={};this._finalized=true;this._deferredSetFlagsDirty=false;//
|
|
15577
|
-
this._onSceneRendering=this.model.scene.on("rendering",function(){if(
|
|
15578
|
+
this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this67._deferredSetFlagsDirty){_this67._uploadDeferredFlags();}_this67._numUpdatesInFrame=0;});}},{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=true;this._setFlags(portionId,flags,meshTransparent,deferred);this._setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._setDeferredFlags();this._setDeferredFlags2();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}/**
|
|
15578
15579
|
* This will _start_ a "set-flags transaction".
|
|
15579
15580
|
*
|
|
15580
15581
|
* After invoking this method, calling setFlags/setFlags2 will not update
|
|
@@ -16225,9 +16226,9 @@ var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==
|
|
|
16225
16226
|
* @param portionCfg.worldAABB Flat float AABB World-space AABB
|
|
16226
16227
|
* @param portionCfg.pickColor Quantized pick color
|
|
16227
16228
|
* @returns {number} Portion ID
|
|
16228
|
-
*/},{key:"createPortion",value:function createPortion(mesh,portionCfg){var
|
|
16229
|
-
portionCfg.buckets.forEach(function(bucket,bucketIndex){var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var bucketGeometry=
|
|
16230
|
-
var subPortionId=
|
|
16229
|
+
*/},{key:"createPortion",value:function createPortion(mesh,portionCfg){var _this68=this;if(this._finalized){throw"Already finalized";}var subPortionIds=[];// const portionAABB = portionCfg.worldAABB;
|
|
16230
|
+
portionCfg.buckets.forEach(function(bucket,bucketIndex){var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var bucketGeometry=_this68._bucketGeometries[bucketGeometryId];if(!bucketGeometry){bucketGeometry=_this68._createBucketGeometry(portionCfg,bucket);_this68._bucketGeometries[bucketGeometryId]=bucketGeometry;}// const subPortionAABB = math.collapseAABB3(tempAABB3b);
|
|
16231
|
+
var subPortionId=_this68._createSubPortion(portionCfg,bucketGeometry,bucket);//math.expandAABB3(portionAABB, subPortionAABB);
|
|
16231
16232
|
subPortionIds.push(subPortionId);});var portionId=this._portionToSubPortionsMap.length;this._portionToSubPortionsMap.push(subPortionIds);this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"_createBucketGeometry",value:function _createBucketGeometry(portionCfg,bucket){// Indices alignement
|
|
16232
16233
|
// This will make every mesh consume a multiple of INDICES_EDGE_INDICES_ALIGNEMENT_SIZE
|
|
16233
16234
|
// array items for storing the triangles of the mesh, and it supports:
|
|
@@ -16247,9 +16248,9 @@ numVertices:bucketGeometry.numTriangles});this._numPortions++;dataTextureRamStat
|
|
|
16247
16248
|
* Builds data textures from the appended geometries and loads them into the GPU.
|
|
16248
16249
|
*
|
|
16249
16250
|
* No more portions can then be created.
|
|
16250
|
-
*/},{key:"finalize",value:function finalize(){var
|
|
16251
|
+
*/},{key:"finalize",value:function finalize(){var _this69=this;if(this._finalized){return;}var state=this._state;var textureState=this._dtxState;var gl=this.model.scene.canvas.gl;var buffer=this._buffer;state.gl=gl;textureState.texturePerObjectColorsAndFlags=this._dtxTextureFactory.createTextureForColorsAndFlags(gl,buffer.perObjectColors,buffer.perObjectPickColors,buffer.perObjectVertexBases,buffer.perObjectIndexBaseOffsets,buffer.perObjectEdgeIndexBaseOffsets,buffer.perObjectSolid);textureState.texturePerObjectInstanceMatrices=this._dtxTextureFactory.createTextureForInstancingMatrices(gl,buffer.perObjectInstancePositioningMatrices);textureState.texturePerObjectPositionsDecodeMatrix=this._dtxTextureFactory.createTextureForPositionsDecodeMatrices(gl,buffer.perObjectPositionsDecodeMatrices);textureState.texturePerVertexIdCoordinates=this._dtxTextureFactory.createTextureForPositions(gl,buffer.positionsCompressed,buffer.lenPositionsCompressed);textureState.texturePerPolygonIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId8Bits);textureState.texturePerPolygonIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId16Bits);textureState.texturePerPolygonIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId32Bits);if(buffer.perEdgeNumberPortionId8Bits.length>0){textureState.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId8Bits);}if(buffer.perEdgeNumberPortionId16Bits.length>0){textureState.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId16Bits);}if(buffer.perEdgeNumberPortionId32Bits.length>0){textureState.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId32Bits);}if(buffer.lenIndices8Bits>0){textureState.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}if(buffer.lenEdgeIndices8Bits>0){textureState.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(gl,buffer.edgeIndices8Bits,buffer.lenEdgeIndices8Bits);}if(buffer.lenEdgeIndices16Bits>0){textureState.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(gl,buffer.edgeIndices16Bits,buffer.lenEdgeIndices16Bits);}if(buffer.lenEdgeIndices32Bits>0){textureState.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(gl,buffer.edgeIndices32Bits,buffer.lenEdgeIndices32Bits);}textureState.finalize();// Free up memory
|
|
16251
16252
|
this._buffer=null;this._bucketGeometries={};this._finalized=true;this._deferredSetFlagsDirty=false;//
|
|
16252
|
-
this._onSceneRendering=this.model.scene.on("rendering",function(){if(
|
|
16253
|
+
this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this69._deferredSetFlagsDirty){_this69._uploadDeferredFlags();}_this69._numUpdatesInFrame=0;});}},{key:"isEmpty",value:function isEmpty(){return this._numPortions===0;}},{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=true;this._setFlags(portionId,flags,meshTransparent,deferred);this._setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._setDeferredFlags();this._setDeferredFlags2();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}else{this._numEdgesLayerPortions--;this.model.numEdgesLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}/**
|
|
16253
16254
|
* This will _start_ a "set-flags transaction".
|
|
16254
16255
|
*
|
|
16255
16256
|
* After invoking this method, calling setFlags/setFlags2 will not update
|
|
@@ -16403,16 +16404,16 @@ gl.RGBA,gl.FLOAT,tempMat4a);// gl.bindTexture (gl.TEXTURE_2D, null);
|
|
|
16403
16404
|
*/this.texture=cfg.texture;}/**
|
|
16404
16405
|
* @private
|
|
16405
16406
|
*/return _createClass(SceneModelTexture,[{key:"destroy",value:function destroy(){if(this.texture){this.texture.destroy();this.texture=null;}}}]);}();var Cache$1={enabled:false,files:{},add:function add(key,file){if(this.enabled===false){return;}this.files[key]=file;},get:function get(key){if(this.enabled===false){return;}return this.files[key];},remove:function remove(key){delete this.files[key];},clear:function clear(){this.files={};}};var LoadingManager=/*#__PURE__*/function(){function LoadingManager(onLoad,onProgress,onError){_classCallCheck(this,LoadingManager);this.isLoading=false;this.itemsLoaded=0;this.itemsTotal=0;this.urlModifier=undefined;this.handlers=[];this.onStart=undefined;this.onLoad=onLoad;this.onProgress=onProgress;this.onError=onError;}return _createClass(LoadingManager,[{key:"itemStart",value:function itemStart(url){this.itemsTotal++;if(this.isLoading===false){if(this.onStart!==undefined){this.onStart(url,this.itemsLoaded,this.itemsTotal);}}this.isLoading=true;}},{key:"itemEnd",value:function itemEnd(url){this.itemsLoaded++;if(this.onProgress!==undefined){this.onProgress(url,this.itemsLoaded,this.itemsTotal);}if(this.itemsLoaded===this.itemsTotal){this.isLoading=false;if(this.onLoad!==undefined){this.onLoad();}}}},{key:"itemError",value:function itemError(url){if(this.onError!==undefined){this.onError(url);}}},{key:"resolveURL",value:function resolveURL(url){if(this.urlModifier){return this.urlModifier(url);}return url;}},{key:"setURLModifier",value:function setURLModifier(transform){this.urlModifier=transform;return this;}},{key:"addHandler",value:function addHandler(regex,loader){this.handlers.push(regex,loader);return this;}},{key:"removeHandler",value:function removeHandler(regex){var index=this.handlers.indexOf(regex);if(index!==-1){this.handlers.splice(index,2);}return this;}},{key:"getHandler",value:function getHandler(file){for(var _i372=0,_l2=this.handlers.length;_i372<_l2;_i372+=2){var regex=this.handlers[_i372];var loader=this.handlers[_i372+1];if(regex.global)regex.lastIndex=0;// see #17920
|
|
16406
|
-
if(regex.test(file)){return loader;}}return null;}}]);}();var DefaultLoadingManager=new LoadingManager();var Loader=/*#__PURE__*/function(){function Loader(manager){_classCallCheck(this,Loader);this.manager=manager!==undefined?manager:DefaultLoadingManager;this.crossOrigin='anonymous';this.withCredentials=false;this.path='';this.resourcePath='';this.requestHeader={};}return _createClass(Loader,[{key:"load",value:function load(/* url, onLoad, onProgress, onError */){}},{key:"loadAsync",value:function loadAsync(url,onProgress){var scope=this;return new Promise(function(resolve,reject){scope.load(url,resolve,onProgress,reject);});}},{key:"parse",value:function parse(/* data */){}},{key:"setCrossOrigin",value:function setCrossOrigin(crossOrigin){this.crossOrigin=crossOrigin;return this;}},{key:"setWithCredentials",value:function setWithCredentials(value){this.withCredentials=value;return this;}},{key:"setPath",value:function setPath(path){this.path=path;return this;}},{key:"setResourcePath",value:function setResourcePath(resourcePath){this.resourcePath=resourcePath;return this;}},{key:"setRequestHeader",value:function setRequestHeader(requestHeader){this.requestHeader=requestHeader;return this;}}]);}();var loading={};var FileLoader=/*#__PURE__*/function(_Loader){function FileLoader(manager){_classCallCheck(this,FileLoader);return _callSuper(this,FileLoader,[manager]);}_inherits(FileLoader,_Loader);return _createClass(FileLoader,[{key:"load",value:function load(url,onLoad,onProgress,onError){var
|
|
16407
|
+
if(regex.test(file)){return loader;}}return null;}}]);}();var DefaultLoadingManager=new LoadingManager();var Loader=/*#__PURE__*/function(){function Loader(manager){_classCallCheck(this,Loader);this.manager=manager!==undefined?manager:DefaultLoadingManager;this.crossOrigin='anonymous';this.withCredentials=false;this.path='';this.resourcePath='';this.requestHeader={};}return _createClass(Loader,[{key:"load",value:function load(/* url, onLoad, onProgress, onError */){}},{key:"loadAsync",value:function loadAsync(url,onProgress){var scope=this;return new Promise(function(resolve,reject){scope.load(url,resolve,onProgress,reject);});}},{key:"parse",value:function parse(/* data */){}},{key:"setCrossOrigin",value:function setCrossOrigin(crossOrigin){this.crossOrigin=crossOrigin;return this;}},{key:"setWithCredentials",value:function setWithCredentials(value){this.withCredentials=value;return this;}},{key:"setPath",value:function setPath(path){this.path=path;return this;}},{key:"setResourcePath",value:function setResourcePath(resourcePath){this.resourcePath=resourcePath;return this;}},{key:"setRequestHeader",value:function setRequestHeader(requestHeader){this.requestHeader=requestHeader;return this;}}]);}();var loading={};var FileLoader=/*#__PURE__*/function(_Loader){function FileLoader(manager){_classCallCheck(this,FileLoader);return _callSuper(this,FileLoader,[manager]);}_inherits(FileLoader,_Loader);return _createClass(FileLoader,[{key:"load",value:function load(url,onLoad,onProgress,onError){var _this70=this;if(url===undefined){url='';}if(this.path!==undefined){url=this.path+url;}url=this.manager.resolveURL(url);var cached=Cache$1.get(url);if(cached!==undefined){this.manager.itemStart(url);core.scheduleTask(function(){if(onLoad){onLoad(cached);}_this70.manager.itemEnd(url);},0);return cached;}if(loading[url]!==undefined){loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});return;}loading[url]=[];loading[url].push({onLoad:onLoad,onProgress:onProgress,onError:onError});var req=new Request(url,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?'include':'same-origin'});var mimeType=this.mimeType;var responseType=this.responseType;fetch(req).then(function(response){if(response.status===200||response.status===0){// Some browsers return HTTP Status 0 when using non-http protocol
|
|
16407
16408
|
// e.g. 'file://' or 'data://'. Handle as success.
|
|
16408
16409
|
if(response.status===0){console.warn('FileLoader: HTTP Status 0 received.');}if(typeof ReadableStream==='undefined'||response.body.getReader===undefined){return response;}var callbacks=loading[url];var reader=response.body.getReader();var contentLength=response.headers.get('Content-Length');var total=contentLength?parseInt(contentLength):0;var lengthComputable=total!==0;var loaded=0;var stream=new ReadableStream({start:function start(controller){readData();function readData(){reader.read().then(function(_ref10){var done=_ref10.done,value=_ref10.value;if(done){controller.close();}else{loaded+=value.byteLength;var event=new ProgressEvent('progress',{lengthComputable:lengthComputable,loaded:loaded,total:total});for(var _i373=0,il=callbacks.length;_i373<il;_i373++){var callback=callbacks[_i373];if(callback.onProgress){callback.onProgress(event);}}controller.enqueue(value);readData();}});}}});return new Response(stream);}else{throw Error("fetch for \"".concat(response.url,"\" responded with ").concat(response.status,": ").concat(response.statusText));}}).then(function(response){switch(responseType){case'arraybuffer':return response.arrayBuffer();case'blob':return response.blob();case'document':return response.text().then(function(text){var parser=new DOMParser();return parser.parseFromString(text,mimeType);});case'json':return response.json();default:if(mimeType===undefined){return response.text();}else{// sniff encoding
|
|
16409
16410
|
var re=/charset="?([^;"\s]*)"?/i;var exec=re.exec(mimeType);var label=exec&&exec[1]?exec[1].toLowerCase():undefined;var decoder=new TextDecoder(label);return response.arrayBuffer().then(function(ab){return decoder.decode(ab);});}}}).then(function(data){// Add to cache only on HTTP success, so that we do not cache
|
|
16410
16411
|
// error response bodies as proper responses to requests.
|
|
16411
16412
|
Cache$1.add(url,data);var callbacks=loading[url];delete loading[url];for(var _i374=0,il=callbacks.length;_i374<il;_i374++){var callback=callbacks[_i374];if(callback.onLoad){callback.onLoad(data);}}})["catch"](function(err){// Abort errors and other errors are handled the same
|
|
16412
16413
|
var callbacks=loading[url];if(callbacks===undefined){// When onLoad was called and url was deleted in `loading`
|
|
16413
|
-
|
|
16414
|
+
_this70.manager.itemError(url);throw err;}delete loading[url];for(var _i375=0,il=callbacks.length;_i375<il;_i375++){var callback=callbacks[_i375];if(callback.onError){callback.onError(err);}}_this70.manager.itemError(url);})["finally"](function(){_this70.manager.itemEnd(url);});this.manager.itemStart(url);}},{key:"setResponseType",value:function setResponseType(value){this.responseType=value;return this;}},{key:"setMimeType",value:function setMimeType(value){this.mimeType=value;return this;}}]);}(Loader);/**
|
|
16414
16415
|
* @author Deepkolos / https://github.com/deepkolos
|
|
16415
|
-
*/var WorkerPool$1=/*#__PURE__*/function(){function WorkerPool$1(){var pool=arguments.length>0&&arguments[0]!==undefined?arguments[0]:4;_classCallCheck(this,WorkerPool$1);this.pool=pool;this.queue=[];this.workers=[];this.workersResolve=[];this.workerStatus=0;}return _createClass(WorkerPool$1,[{key:"_initWorker",value:function _initWorker(workerId){if(!this.workers[workerId]){var worker=this.workerCreator();worker.addEventListener('message',this._onMessage.bind(this,workerId));this.workers[workerId]=worker;}}},{key:"_getIdleWorker",value:function _getIdleWorker(){for(var _i376=0;_i376<this.pool;_i376++)if(!(this.workerStatus&1<<_i376))return _i376;return-1;}},{key:"_onMessage",value:function _onMessage(workerId,msg){var resolve=this.workersResolve[workerId];resolve&&resolve(msg);if(this.queue.length){var _this$queue$shift=this.queue.shift(),_resolve=_this$queue$shift.resolve,_msg=_this$queue$shift.msg,transfer=_this$queue$shift.transfer;this.workersResolve[workerId]=_resolve;this.workers[workerId].postMessage(_msg,transfer);}else{this.workerStatus^=1<<workerId;}}},{key:"setWorkerCreator",value:function setWorkerCreator(workerCreator){this.workerCreator=workerCreator;}},{key:"setWorkerLimit",value:function setWorkerLimit(pool){this.pool=pool;}},{key:"postMessage",value:function postMessage(msg,transfer){var
|
|
16416
|
+
*/var WorkerPool$1=/*#__PURE__*/function(){function WorkerPool$1(){var pool=arguments.length>0&&arguments[0]!==undefined?arguments[0]:4;_classCallCheck(this,WorkerPool$1);this.pool=pool;this.queue=[];this.workers=[];this.workersResolve=[];this.workerStatus=0;}return _createClass(WorkerPool$1,[{key:"_initWorker",value:function _initWorker(workerId){if(!this.workers[workerId]){var worker=this.workerCreator();worker.addEventListener('message',this._onMessage.bind(this,workerId));this.workers[workerId]=worker;}}},{key:"_getIdleWorker",value:function _getIdleWorker(){for(var _i376=0;_i376<this.pool;_i376++)if(!(this.workerStatus&1<<_i376))return _i376;return-1;}},{key:"_onMessage",value:function _onMessage(workerId,msg){var resolve=this.workersResolve[workerId];resolve&&resolve(msg);if(this.queue.length){var _this$queue$shift=this.queue.shift(),_resolve=_this$queue$shift.resolve,_msg=_this$queue$shift.msg,transfer=_this$queue$shift.transfer;this.workersResolve[workerId]=_resolve;this.workers[workerId].postMessage(_msg,transfer);}else{this.workerStatus^=1<<workerId;}}},{key:"setWorkerCreator",value:function setWorkerCreator(workerCreator){this.workerCreator=workerCreator;}},{key:"setWorkerLimit",value:function setWorkerLimit(pool){this.pool=pool;}},{key:"postMessage",value:function postMessage(msg,transfer){var _this71=this;return new Promise(function(resolve){var workerId=_this71._getIdleWorker();if(workerId!==-1){_this71._initWorker(workerId);_this71.workerStatus|=1<<workerId;_this71.workersResolve[workerId]=resolve;_this71.workers[workerId].postMessage(msg,transfer);}else{_this71.queue.push({resolve:resolve,msg:msg,transfer:transfer});}});}},{key:"destroy",value:function destroy(){this.workers.forEach(function(worker){return worker.terminate();});this.workersResolve.length=0;this.workers.length=0;this.queue.length=0;this.workerStatus=0;}}]);}();var KTX2TransferSRGB=2;var KTX2_ALPHA_PREMULTIPLIED=1;var activeTranscoders=0;/**
|
|
16416
16417
|
* Transcodes texture data from KTX2.
|
|
16417
16418
|
*
|
|
16418
16419
|
* ## Overview
|
|
@@ -16628,14 +16629,14 @@ _this69.manager.itemError(url);throw err;}delete loading[url];for(var _i375=0,il
|
|
|
16628
16629
|
* then our KTX2TextureTranscoder will load it from ````https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/```` by
|
|
16629
16630
|
* default. Therefore, make sure your application is connected to the internet if you wish to use the default transcoder path.
|
|
16630
16631
|
* @param {Number} [workerLimit] The maximum number of Workers to use for transcoding.
|
|
16631
|
-
*/function KTX2TextureTranscoder(_ref11){var viewer=_ref11.viewer,transcoderPath=_ref11.transcoderPath,workerLimit=_ref11.workerLimit;_classCallCheck(this,KTX2TextureTranscoder);this._transcoderPath=transcoderPath||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/";this._transcoderBinary=null;this._transcoderPending=null;this._workerPool=new WorkerPool$1();this._workerSourceURL="";if(workerLimit){this._workerPool.setWorkerLimit(workerLimit);}var viewerCapabilities=viewer.capabilities;this._workerConfig={astcSupported:viewerCapabilities.astcSupported,etc1Supported:viewerCapabilities.etc1Supported,etc2Supported:viewerCapabilities.etc2Supported,dxtSupported:viewerCapabilities.dxtSupported,bptcSupported:viewerCapabilities.bptcSupported,pvrtcSupported:viewerCapabilities.pvrtcSupported};this._supportedFileTypes=["xkt2"];}return _createClass(KTX2TextureTranscoder,[{key:"_init",value:function _init(){var
|
|
16632
|
+
*/function KTX2TextureTranscoder(_ref11){var viewer=_ref11.viewer,transcoderPath=_ref11.transcoderPath,workerLimit=_ref11.workerLimit;_classCallCheck(this,KTX2TextureTranscoder);this._transcoderPath=transcoderPath||"https://cdn.jsdelivr.net/npm/@xeokit/xeokit-sdk/dist/basis/";this._transcoderBinary=null;this._transcoderPending=null;this._workerPool=new WorkerPool$1();this._workerSourceURL="";if(workerLimit){this._workerPool.setWorkerLimit(workerLimit);}var viewerCapabilities=viewer.capabilities;this._workerConfig={astcSupported:viewerCapabilities.astcSupported,etc1Supported:viewerCapabilities.etc1Supported,etc2Supported:viewerCapabilities.etc2Supported,dxtSupported:viewerCapabilities.dxtSupported,bptcSupported:viewerCapabilities.bptcSupported,pvrtcSupported:viewerCapabilities.pvrtcSupported};this._supportedFileTypes=["xkt2"];}return _createClass(KTX2TextureTranscoder,[{key:"_init",value:function _init(){var _this72=this;if(!this._transcoderPending){var jsLoader=new FileLoader();jsLoader.setPath(this._transcoderPath);jsLoader.setWithCredentials(this.withCredentials);var jsContent=jsLoader.loadAsync("basis_transcoder.js");var binaryLoader=new FileLoader();binaryLoader.setPath(this._transcoderPath);binaryLoader.setResponseType("arraybuffer");binaryLoader.setWithCredentials(this.withCredentials);var binaryContent=binaryLoader.loadAsync("basis_transcoder.wasm");this._transcoderPending=Promise.all([jsContent,binaryContent]).then(function(_ref12){var _ref13=_slicedToArray(_ref12,2),jsContent=_ref13[0],binaryContent=_ref13[1];var fn=KTX2TextureTranscoder.BasisWorker.toString();var body=["/* constants */","let _EngineFormat = "+JSON.stringify(KTX2TextureTranscoder.EngineFormat),"let _TranscoderFormat = "+JSON.stringify(KTX2TextureTranscoder.TranscoderFormat),"let _BasisFormat = "+JSON.stringify(KTX2TextureTranscoder.BasisFormat),"/* basis_transcoder.js */",jsContent,"/* worker */",fn.substring(fn.indexOf("{")+1,fn.lastIndexOf("}"))].join("\n");_this72._workerSourceURL=URL.createObjectURL(new Blob([body]));_this72._transcoderBinary=binaryContent;_this72._workerPool.setWorkerCreator(function(){var worker=new Worker(_this72._workerSourceURL);var transcoderBinary=_this72._transcoderBinary.slice(0);worker.postMessage({type:"init",config:_this72._workerConfig,transcoderBinary:transcoderBinary},[transcoderBinary]);return worker;});});if(activeTranscoders>0){console.warn("KTX2TextureTranscoder: Multiple active KTX2TextureTranscoder may cause performance issues."+" Use a single KTX2TextureTranscoder instance, or call .dispose() on old instances.");}activeTranscoders++;}return this._transcoderPending;}/**
|
|
16632
16633
|
* Transcodes texture data from transcoded buffers into a {@link Texture2D}.
|
|
16633
16634
|
*
|
|
16634
16635
|
* @param {ArrayBuffer[]} buffers Transcoded texture data. Given as an array of buffers so that we can support multi-image textures, such as cube maps.
|
|
16635
16636
|
* @param {*} config Transcoding options.
|
|
16636
16637
|
* @param {Texture2D} texture The texture to load.
|
|
16637
16638
|
* @returns {Promise} Resolves when the texture has loaded.
|
|
16638
|
-
*/},{key:"transcode",value:function transcode(buffers,texture){var
|
|
16639
|
+
*/},{key:"transcode",value:function transcode(buffers,texture){var _this73=this;var config=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{};return new Promise(function(resolve,reject){var taskConfig=config;_this73._init().then(function(){return _this73._workerPool.postMessage({type:"transcode",buffers:buffers,taskConfig:taskConfig},buffers);}).then(function(e){var transcodeResult=e.data;var mipmaps=transcodeResult.mipmaps,width=transcodeResult.width,height=transcodeResult.height,format=transcodeResult.format,type=transcodeResult.type,error=transcodeResult.error,dfdTransferFn=transcodeResult.dfdTransferFn,dfdFlags=transcodeResult.dfdFlags;if(type==="error"){return reject(error);}texture.setCompressedData({mipmaps:mipmaps,props:{format:format,minFilter:mipmaps.length===1?LinearFilter:LinearMipmapLinearFilter,magFilter:mipmaps.length===1?LinearFilter:LinearMipmapLinearFilter,encoding:dfdTransferFn===KTX2TransferSRGB?sRGBEncoding:LinearEncoding,premultiplyAlpha:!!(dfdFlags&KTX2_ALPHA_PREMULTIPLIED)}});resolve();});});}/**
|
|
16639
16640
|
* Destroys this KTX2TextureTranscoder
|
|
16640
16641
|
*/},{key:"destroy",value:function destroy(){URL.revokeObjectURL(this._workerSourceURL);this._workerPool.destroy();activeTranscoders--;}}]);}();/**
|
|
16641
16642
|
* @private
|
|
@@ -17913,37 +17914,37 @@ return this;}/**
|
|
|
17913
17914
|
* @param {Number} [cfg.renderOrder=0] Specifies the rendering order for this SceneModel. This is used to control the order in which
|
|
17914
17915
|
* SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
|
|
17915
17916
|
* render pass.
|
|
17916
|
-
*/function SceneModel(owner){var
|
|
17917
|
-
|
|
17918
|
-
|
|
17919
|
-
|
|
17920
|
-
|
|
17917
|
+
*/function SceneModel(owner){var _this74;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SceneModel);_this74=_callSuper(this,SceneModel,[owner,cfg]);_this74.renderOrder=cfg.renderOrder||0;_this74._dtxEnabled=_this74.scene.dtxEnabled&&cfg.dtxEnabled!==false;_this74._enableVertexWelding=false;// Not needed for most objects, and very expensive, so disabled
|
|
17918
|
+
_this74._enableIndexBucketing=false;// Until fixed: https://github.com/xeokit/xeokit-sdk/issues/1204
|
|
17919
|
+
_this74._vboBatchingLayerScratchMemory=getScratchMemory();_this74._textureTranscoder=cfg.textureTranscoder||getKTX2TextureTranscoder(_this74.scene.viewer);_this74._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this74._aabb=math.collapseAABB3();_this74._aabbDirty=true;_this74._aabbUpdate=false;_this74._exceptionIds=[];_this74._quantizationRanges={};_this74._vboInstancingLayers={};_this74._vboBatchingLayers={};_this74._dtxLayers={};_this74._meshList=[];_this74.layerList=[];// For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second
|
|
17920
|
+
_this74._layersToFinalize=[];_this74._entityList=[];_this74._entitiesToFinalize=[];_this74._geometries={};_this74._dtxBuckets={};// Geometries with optimizations used for data texture representation
|
|
17921
|
+
_this74._textures={};_this74._textureSets={};_this74._transforms={};_this74._meshes={};_this74._unusedMeshes={};_this74._entities={};_this74._scheduledMeshes={};_this74._meshesCfgsBeforeMeshCreation={};/** @private **/_this74.renderFlags=new RenderFlags();/**
|
|
17921
17922
|
* @private
|
|
17922
|
-
*/
|
|
17923
|
+
*/_this74.numGeometries=0;// Number of geometries created with createGeometry()
|
|
17923
17924
|
// These counts are used to avoid unnecessary render passes
|
|
17924
17925
|
// They are incremented or decremented exclusively by BatchingLayer and InstancingLayer
|
|
17925
17926
|
/**
|
|
17926
17927
|
* @private
|
|
17927
|
-
*/
|
|
17928
|
+
*/_this74.numPortions=0;/**
|
|
17928
17929
|
* @private
|
|
17929
|
-
*/
|
|
17930
|
+
*/_this74.numVisibleLayerPortions=0;/**
|
|
17930
17931
|
* @private
|
|
17931
|
-
*/
|
|
17932
|
+
*/_this74.numTransparentLayerPortions=0;/**
|
|
17932
17933
|
* @private
|
|
17933
|
-
*/
|
|
17934
|
+
*/_this74.numXRayedLayerPortions=0;/**
|
|
17934
17935
|
* @private
|
|
17935
|
-
*/
|
|
17936
|
+
*/_this74.numHighlightedLayerPortions=0;/**
|
|
17936
17937
|
* @private
|
|
17937
|
-
*/
|
|
17938
|
+
*/_this74.numSelectedLayerPortions=0;/**
|
|
17938
17939
|
* @private
|
|
17939
|
-
*/
|
|
17940
|
+
*/_this74.numEdgesLayerPortions=0;/**
|
|
17940
17941
|
* @private
|
|
17941
|
-
*/
|
|
17942
|
+
*/_this74.numPickableLayerPortions=0;/**
|
|
17942
17943
|
* @private
|
|
17943
|
-
*/
|
|
17944
|
+
*/_this74.numClippableLayerPortions=0;/**
|
|
17944
17945
|
* @private
|
|
17945
|
-
*/
|
|
17946
|
-
|
|
17946
|
+
*/_this74.numCulledLayerPortions=0;_this74.numEntities=0;_this74._numTriangles=0;_this74._numLines=0;_this74._numPoints=0;_this74._layersFinalized=false;_this74._edgeThreshold=cfg.edgeThreshold||10;// Build static matrix
|
|
17947
|
+
_this74._origin=math.vec3(cfg.origin||[0,0,0]);_this74._position=math.vec3(cfg.position||[0,0,0]);_this74._rotation=math.vec3(cfg.rotation||[0,0,0]);_this74._quaternion=math.vec4(cfg.quaternion||[0,0,0,1]);_this74._conjugateQuaternion=math.vec4(cfg.quaternion||[0,0,0,1]);if(cfg.rotation){math.eulerToQuaternion(_this74._rotation,"XYZ",_this74._quaternion);}_this74._scale=math.vec3(cfg.scale||[1,1,1]);_this74._worldRotationMatrix=math.mat4();_this74._worldRotationMatrixConjugate=math.mat4();_this74._matrix=math.mat4();_this74._matrixDirty=true;_this74._rebuildMatrices();_this74._worldNormalMatrix=math.mat4();math.inverseMat4(_this74._matrix,_this74._worldNormalMatrix);math.transposeMat4(_this74._worldNormalMatrix);if(cfg.matrix||cfg.position||cfg.rotation||cfg.scale||cfg.quaternion){_this74._viewMatrix=math.mat4();_this74._viewNormalMatrix=math.mat4();_this74._viewMatrixDirty=true;_this74._matrixNonIdentity=true;}_this74._opacity=1.0;_this74._colorize=[1,1,1];_this74._saoEnabled=cfg.saoEnabled!==false;_this74._pbrEnabled=cfg.pbrEnabled!==false;_this74._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this74._isModel=cfg.isModel;if(_this74._isModel){_this74.scene._registerModel(_this74);}_this74._onCameraViewMatrix=_this74.scene.camera.on("matrix",function(){_this74._viewMatrixDirty=true;});_this74._meshesWithDirtyMatrices=[];_this74._numMeshesWithDirtyMatrices=0;_this74._onTick=_this74.scene.on("tick",function(){while(_this74._numMeshesWithDirtyMatrices>0){_this74._meshesWithDirtyMatrices[--_this74._numMeshesWithDirtyMatrices]._updateMatrix();}});_this74._createDefaultTextureSet();_this74.visible=cfg.visible;_this74.culled=cfg.culled;_this74.pickable=cfg.pickable;_this74.clippable=cfg.clippable;_this74.collidable=cfg.collidable;_this74.castsShadow=cfg.castsShadow;_this74.receivesShadow=cfg.receivesShadow;_this74.xrayed=cfg.xrayed;_this74.highlighted=cfg.highlighted;_this74.selected=cfg.selected;_this74.edges=cfg.edges;_this74.colorize=cfg.colorize;_this74.opacity=cfg.opacity;_this74.backfaces=cfg.backfaces;return _this74;}_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,
|
|
17947
17948
|
// which contains empty default textures filled with color
|
|
17948
17949
|
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]})
|
|
17949
17950
|
})});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]
|
|
@@ -18392,15 +18393,14 @@ cfg.normals=null;}this._geometries[cfg.id]=cfg;this._numTriangles+=cfg.indices?M
|
|
|
18392
18393
|
* @param {Number} [cfg.wrapR=RepeatWrapping] Wrap parameter for texture coordinate *R*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
|
|
18393
18394
|
* @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
|
|
18394
18395
|
* @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
|
|
18395
|
-
*/},{key:"createTexture",value:function createTexture(cfg){var
|
|
18396
|
-
encoding:encoding});if(cfg.preloadColor){texture.setPreloadColor(cfg.preloadColor);}if(cfg.image){// Ignore transcoder for Images
|
|
18396
|
+
*/},{key:"createTexture",value:function createTexture(cfg){var _this75=this;var textureId=cfg.id;if(textureId===undefined||textureId===null){this.error("[createTexture] Config missing: id");return;}if(this._textures[textureId]){this.error("[createTexture] Texture already created: "+textureId);return;}if(!cfg.src&&!cfg.image&&!cfg.imageBuffer&&!cfg.buffers){this.error("[createTexture] Param expected: `src`, `image' or 'buffers'");return null;}var minFilter=cfg.minFilter||LinearMipmapLinearFilter;if(minFilter!==LinearFilter&&minFilter!==LinearMipMapNearestFilter&&minFilter!==LinearMipmapLinearFilter&&minFilter!==NearestMipMapLinearFilter&&minFilter!==NearestMipMapNearestFilter){this.error("[createTexture] Unsupported value for 'minFilter' - \n supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, \n NearestMipMapLinearFilter and LinearMipmapLinearFilter. Defaulting to LinearMipmapLinearFilter.");minFilter=LinearMipmapLinearFilter;}var magFilter=cfg.magFilter||LinearFilter;if(magFilter!==LinearFilter&&magFilter!==NearestFilter){this.error("[createTexture] Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");magFilter=LinearFilter;}var wrapS=cfg.wrapS||RepeatWrapping;if(wrapS!==ClampToEdgeWrapping&&wrapS!==MirroredRepeatWrapping&&wrapS!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapS=RepeatWrapping;}var wrapT=cfg.wrapT||RepeatWrapping;if(wrapT!==ClampToEdgeWrapping&&wrapT!==MirroredRepeatWrapping&&wrapT!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapT=RepeatWrapping;}var wrapR=cfg.wrapR||RepeatWrapping;if(wrapR!==ClampToEdgeWrapping&&wrapR!==MirroredRepeatWrapping&&wrapR!==RepeatWrapping){this.error("[createTexture] Unsupported value for 'wrapR' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");wrapR=RepeatWrapping;}var encoding=cfg.encoding||LinearEncoding;if(encoding!==LinearEncoding&&encoding!==sRGBEncoding){this.error("[createTexture] Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");encoding=LinearEncoding;}var texture=new Texture2D({gl:this.scene.canvas.gl,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:encoding},this.scene);if(cfg.preloadColor){texture.setPreloadColor(cfg.preloadColor);}if(cfg.image){// Ignore transcoder for Images
|
|
18397
18397
|
var _image2=cfg.image;_image2.crossOrigin="Anonymous";if(_image2.compressed){// see `parsedImage` in @loaders.gl/gltf/src/lib/parsers/parse-gltf.ts
|
|
18398
18398
|
// NOTE: @loaders.gl in its current version discards potential mipmaps, leaving only a single one
|
|
18399
|
-
var data=_image2.data;texture.setCompressedData({mipmaps:data,props:{format:data[0].format,minFilter:minFilter,magFilter:magFilter}});}else{texture.setImage(_image2,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:cfg.flipY,encoding:encoding});}}else if(cfg.src){var ext=cfg.src.split(".").pop();switch(ext// Don't transcode recognized image file types
|
|
18400
|
-
|
|
18399
|
+
var data=_image2.data;texture.setCompressedData({mipmaps:data,props:{format:data[0].format,minFilter:minFilter,magFilter:magFilter}});}else{texture.setImage(_image2,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:cfg.flipY,encoding:encoding});}}else if(cfg.imageBuffer){texture.setImageBuffer(cfg.imageBuffer,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:false,encoding:encoding});}else if(cfg.src){var ext=cfg.src.split(".").pop();switch(ext){// Don't transcode recognized image file types
|
|
18400
|
+
case"jpeg":case"jpg":case"png":case"gif":var _image3=new Image();_image3.onload=function(){texture.setImage(_image3,{minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,flipY:cfg.flipY,encoding:encoding});_this75.glRedraw();};_image3.src=cfg.src;// URL or Base64 string
|
|
18401
18401
|
break;default:// Assume other file types need transcoding
|
|
18402
|
-
if(!this._textureTranscoder){this.error("[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('".concat(ext,"')"));}else{utils.loadArraybuffer(cfg.src,function(arrayBuffer){if(!arrayBuffer.byteLength){
|
|
18403
|
-
if(!this._textureTranscoder){this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option");}else{this._textureTranscoder.transcode(cfg.buffers,texture).then(function(){
|
|
18402
|
+
if(!this._textureTranscoder){this.error("[createTexture] Can't create texture from 'src' - SceneModel needs to be configured with a TextureTranscoder for this file type ('".concat(ext,"')"));}else{utils.loadArraybuffer(cfg.src,function(arrayBuffer){if(!arrayBuffer.byteLength){_this75.error("[createTexture] Can't create texture from 'src': file data is zero length");return;}_this75._textureTranscoder.transcode([arrayBuffer],texture).then(function(){_this75.glRedraw();});},function(errMsg){this.error("[createTexture] Can't create texture from 'src': ".concat(errMsg));});}break;}}else if(cfg.buffers){// Buffers implicitly require transcoding
|
|
18403
|
+
if(!this._textureTranscoder){this.error("[createTexture] Can't create texture from 'buffers' - SceneModel needs to be configured with a TextureTranscoder for this option");}else{this._textureTranscoder.transcode(cfg.buffers,texture).then(function(){_this75.glRedraw();});}}this._textures[textureId]=new SceneModelTexture({id:textureId,texture:texture});}/**
|
|
18404
18404
|
* Creates a texture set within this SceneModel.
|
|
18405
18405
|
*
|
|
18406
18406
|
* * Stores the new {@link SceneModelTextureSet} in {@link SceneModel#textureSets}.
|
|
@@ -18420,7 +18420,10 @@ if(!this._textureTranscoder){this.error("[createTexture] Can't create texture fr
|
|
|
18420
18420
|
* @param {*} [cfg.emissiveTextureId] ID of *RGBA* emissive map texture, with emissive color in *RGB*.
|
|
18421
18421
|
* @param {*} [cfg.occlusionTextureId] ID of *RGBA* occlusion map texture, with occlusion factor in *R*.
|
|
18422
18422
|
* @returns {SceneModelTransform} The new texture set.
|
|
18423
|
-
*/},{key:"createTextureSet",value:function createTextureSet(cfg){var textureSetId=cfg.id;if(textureSetId===undefined||textureSetId===null){this.error("[createTextureSet] Config missing: id");return;}if(this._textureSets[textureSetId]){this.error("[createTextureSet] Texture set already created: ".concat(textureSetId));return;}var colorTexture;if(cfg.colorTextureId!==undefined&&cfg.colorTextureId!==null){colorTexture=this._textures[cfg.colorTextureId];if(!colorTexture){
|
|
18423
|
+
*/},{key:"createTextureSet",value:function createTextureSet(cfg){var textureSetId=cfg.id;if(textureSetId===undefined||textureSetId===null){this.error("[createTextureSet] Config missing: id");return;}if(this._textureSets[textureSetId]){this.error("[createTextureSet] Texture set already created: ".concat(textureSetId));return;}var colorTexture;if(cfg.colorTextureId!==undefined&&cfg.colorTextureId!==null){colorTexture=this._textures[cfg.colorTextureId];if(!colorTexture){// this.error(
|
|
18424
|
+
// `[createTextureSet] Texture not found: ${cfg.colorTextureId} - ensure that you create it first with createTexture()`
|
|
18425
|
+
// );
|
|
18426
|
+
return;}}else{colorTexture=this._textures[DEFAULT_COLOR_TEXTURE_ID];}var metallicRoughnessTexture;if(cfg.metallicRoughnessTextureId!==undefined&&cfg.metallicRoughnessTextureId!==null){metallicRoughnessTexture=this._textures[cfg.metallicRoughnessTextureId];if(!metallicRoughnessTexture){this.error("[createTextureSet] Texture not found: ".concat(cfg.metallicRoughnessTextureId," - ensure that you create it first with createTexture()"));return;}}else{metallicRoughnessTexture=this._textures[DEFAULT_METAL_ROUGH_TEXTURE_ID];}var normalsTexture;if(cfg.normalsTextureId!==undefined&&cfg.normalsTextureId!==null){normalsTexture=this._textures[cfg.normalsTextureId];if(!normalsTexture){this.error("[createTextureSet] Texture not found: ".concat(cfg.normalsTextureId," - ensure that you create it first with createTexture()"));return;}}else{normalsTexture=this._textures[DEFAULT_NORMALS_TEXTURE_ID];}var emissiveTexture;if(cfg.emissiveTextureId!==undefined&&cfg.emissiveTextureId!==null){emissiveTexture=this._textures[cfg.emissiveTextureId];if(!emissiveTexture){this.error("[createTextureSet] Texture not found: ".concat(cfg.emissiveTextureId," - ensure that you create it first with createTexture()"));return;}}else{emissiveTexture=this._textures[DEFAULT_EMISSIVE_TEXTURE_ID];}var occlusionTexture;if(cfg.occlusionTextureId!==undefined&&cfg.occlusionTextureId!==null){occlusionTexture=this._textures[cfg.occlusionTextureId];if(!occlusionTexture){this.error("[createTextureSet] Texture not found: ".concat(cfg.occlusionTextureId," - ensure that you create it first with createTexture()"));return;}}else{occlusionTexture=this._textures[DEFAULT_OCCLUSION_TEXTURE_ID];}var textureSet=new SceneModelTextureSet({id:textureSetId,model:this,colorTexture:colorTexture,alphaCutoff:cfg.alphaCutoff,metallicRoughnessTexture:metallicRoughnessTexture,normalsTexture:normalsTexture,emissiveTexture:emissiveTexture,occlusionTexture:occlusionTexture});this._textureSets[textureSetId]=textureSet;return textureSet;}/**
|
|
18424
18427
|
* Creates a new {@link SceneModelTransform} within this SceneModel.
|
|
18425
18428
|
*
|
|
18426
18429
|
* * Stores the new {@link SceneModelTransform} in {@link SceneModel#transforms}.
|
|
@@ -18476,7 +18479,7 @@ if(!this._textureTranscoder){this.error("[createTexture] Can't create texture fr
|
|
|
18476
18479
|
* @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
18477
18480
|
* @returns {SceneModelMesh} The new mesh.
|
|
18478
18481
|
*/},{key:"createMesh",value:function createMesh(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createMesh] SceneModel.createMesh() config missing: id");return false;}if(this._meshes[cfg.id]){this.error("[createMesh] SceneModel already has a mesh with this ID: ".concat(cfg.id));return false;}var instancing=cfg.geometryId!==undefined;var batching=!instancing;if(batching){// Batched geometry
|
|
18479
|
-
if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("Unsupported value for 'primitive': '".concat(primitive,"' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'."));return false;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)");return false;}if(cfg.positions&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary)){this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return false;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return false;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");return false;}if(!cfg.buckets&&!cfg.indices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){
|
|
18482
|
+
if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("Unsupported value for 'primitive': '".concat(primitive,"' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'."));return false;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)");return false;}if(cfg.positions&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary)){this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return false;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return false;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");return false;}var numPositions=(cfg.positions||cfg.positionsCompressed).length/3;if(!cfg.buckets&&!cfg.indices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){cfg.indices=this._createDefaultIndices(numPositions);}if(!cfg.buckets&&!cfg.indices&&cfg.primitive!=="points"){cfg.indices=this._createDefaultIndices(numIndices);this.error("Param expected: indices (required for '".concat(cfg.primitive,"' primitive type)"));return false;}if((cfg.matrix||cfg.position||cfg.rotation||cfg.scale)&&(cfg.positionsCompressed||cfg.positionsDecodeBoundary)){this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'");return false;}var useDTX=!!this._dtxEnabled&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")&&!cfg.textureSetId;cfg.origin=cfg.origin?math.addVec3(this._origin,cfg.origin,math.vec3()):this._origin;// MATRIX - optional for batching
|
|
18480
18483
|
if(cfg.matrix){cfg.meshMatrix=cfg.matrix;}else if(cfg.scale||cfg.rotation||cfg.position||cfg.quaternion){var _scale3=cfg.scale||DEFAULT_SCALE;var _position=cfg.position||DEFAULT_POSITION;if(cfg.rotation){math.eulerToQuaternion(cfg.rotation,"XYZ",tempQuaternion);cfg.meshMatrix=math.composeMat4(_position,tempQuaternion,_scale3,math.mat4());}else{cfg.meshMatrix=math.composeMat4(_position,cfg.quaternion||DEFAULT_QUATERNION,_scale3,math.mat4());}}if(cfg.positionsDecodeBoundary){cfg.positionsDecodeMatrix=createPositionsDecodeMatrix(cfg.positionsDecodeBoundary,math.mat4());}if(useDTX){// DTX
|
|
18481
18484
|
cfg.type=DTX;// NPR
|
|
18482
18485
|
cfg.color=cfg.color?new Uint8Array([Math.floor(cfg.color[0]*255),Math.floor(cfg.color[1]*255),Math.floor(cfg.color[2]*255)]):defaultCompressedColor;cfg.opacity=cfg.opacity!==undefined&&cfg.opacity!==null?Math.floor(cfg.opacity*255):255;// RTC
|
|
@@ -18491,7 +18494,13 @@ if(cfg.positions){var _rtcPositions=[];var _rtcNeeded=worldToRTCPositions(cfg.po
|
|
|
18491
18494
|
}math.expandAABB3Points3(_aabb5,cfg.positions);cfg.aabb=_aabb5;}else{var _aabb6=math.collapseAABB3();math.expandAABB3Points3(_aabb6,cfg.positionsCompressed);geometryCompressionUtils.decompressAABB(_aabb6,cfg.positionsDecodeMatrix);cfg.aabb=_aabb6;}if(cfg.meshMatrix){math.AABB3ToOBB3(cfg.aabb,tempOBB3);math.transformOBB3(cfg.meshMatrix,tempOBB3);math.OBB3ToAABB3(tempOBB3,cfg.aabb);}// EDGES
|
|
18492
18495
|
if(!cfg.buckets&&!cfg.edgeIndices&&(cfg.primitive==="triangles"||cfg.primitive==="solid"||cfg.primitive==="surface")){if(cfg.positions){cfg.edgeIndices=buildEdgeIndices(cfg.positions,cfg.indices,null,2.0);}else{cfg.edgeIndices=buildEdgeIndices(cfg.positionsCompressed,cfg.indices,cfg.positionsDecodeMatrix,2.0);}}// TEXTURE
|
|
18493
18496
|
// cfg.textureSetId = cfg.textureSetId || DEFAULT_TEXTURE_SET_ID;
|
|
18494
|
-
if(cfg.textureSetId){cfg.textureSet=this._textureSets[cfg.textureSetId]
|
|
18497
|
+
if(cfg.textureSetId){cfg.textureSet=this._textureSets[cfg.textureSetId];// if (!cfg.textureSet) {
|
|
18498
|
+
// this.error(
|
|
18499
|
+
// `[createMesh] Texture set not found: ${cfg.textureSetId} - ensure that you create it first with createTextureSet()`
|
|
18500
|
+
// );
|
|
18501
|
+
// return false;
|
|
18502
|
+
// }
|
|
18503
|
+
}}}else{// INSTANCING
|
|
18495
18504
|
if(cfg.positions||cfg.positionsCompressed||cfg.indices||cfg.edgeIndices||cfg.normals||cfg.normalsCompressed||cfg.uv||cfg.uvCompressed||cfg.positionsDecodeMatrix){this.error("Mesh geometry parameters not expected when instancing a geometry (not expected: positions, positionsCompressed, indices, edgeIndices, normals, normalsCompressed, uv, uvCompressed, positionsDecodeMatrix)");return false;}cfg.geometry=this._geometries[cfg.geometryId];if(!cfg.geometry){this.error("[createMesh] Geometry not found: ".concat(cfg.geometryId," - ensure that you create it first with createGeometry()"));return false;}cfg.origin=cfg.origin?math.addVec3(this._origin,cfg.origin,math.vec3()):this._origin;cfg.positionsDecodeMatrix=cfg.geometry.positionsDecodeMatrix;if(cfg.transformId){// TRANSFORM
|
|
18496
18505
|
cfg.transform=this._transforms[cfg.transformId];if(!cfg.transform){this.error("[createMesh] Transform not found: ".concat(cfg.transformId," - ensure that you create it first with createTransform()"));return false;}cfg.aabb=cfg.geometry.aabb;}else{// MATRIX
|
|
18497
18506
|
if(cfg.matrix){cfg.meshMatrix=cfg.matrix;}else if(cfg.scale||cfg.rotation||cfg.position||cfg.quaternion){var _scale4=cfg.scale||DEFAULT_SCALE;var _position2=cfg.position||DEFAULT_POSITION;if(cfg.rotation){math.eulerToQuaternion(cfg.rotation,"XYZ",tempQuaternion);cfg.meshMatrix=math.composeMat4(_position2,tempQuaternion,_scale4,math.mat4());}else{cfg.meshMatrix=math.composeMat4(_position2,cfg.quaternion||DEFAULT_QUATERNION,_scale4,math.mat4());}}math.AABB3ToOBB3(cfg.geometry.aabb,tempOBB3);math.transformOBB3(cfg.meshMatrix,tempOBB3);cfg.aabb=math.OBB3ToAABB3(tempOBB3,math.AABB3());}var _useDTX=!!this._dtxEnabled&&(cfg.geometry.primitive==="triangles"||cfg.geometry.primitive==="solid"||cfg.geometry.primitive==="surface")&&!cfg.textureSetId;if(_useDTX){// DTX
|
|
@@ -18693,8 +18702,8 @@ var _uniquifyPositions=uniquifyPositions({positionsCompressed:geometry.positions
|
|
|
18693
18702
|
* @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.
|
|
18694
18703
|
* @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
|
|
18695
18704
|
* @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
|
|
18696
|
-
*/function LineSet(owner){var
|
|
18697
|
-
});
|
|
18705
|
+
*/function LineSet(owner){var _this76;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this76=_callSuper(this,LineSet,[owner,cfg]);_this76._positions=cfg.positions||[];if(cfg.indices){_this76._indices=cfg.indices;}else{_this76._indices=[];for(var _i449=0,len=_this76._positions.length/3-1;_i449<len;_i449+=2){_this76._indices.push(_i449);_this76._indices.push(_i449+1);}}_this76._sceneModel=new SceneModel(_this76,{isModel:false// Don't register in Scene.models
|
|
18706
|
+
});_this76._sceneModel.createMesh({id:"linesMesh",primitive:"lines",positions:_this76._positions,indices:_this76._indices});_this76._sceneModel.createEntity({meshIds:["linesMesh"],visible:cfg.visible,clippable:cfg.clippable,collidable:cfg.collidable});_this76._sceneModel.finalize();_this76.scene._lineSetCreated(_this76);return _this76;}/**
|
|
18698
18707
|
* Sets if this ````LineSet```` is visible.
|
|
18699
18708
|
*
|
|
18700
18709
|
* Default value is ````true````.
|
|
@@ -19022,15 +19031,15 @@ this.scene._lineSetDestroyed(this);}}]);}(Component);var tempVec3$4=math.vec3();
|
|
|
19022
19031
|
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
19023
19032
|
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
|
19024
19033
|
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
|
19025
|
-
*/function BCFViewpointsPlugin(viewer){var
|
|
19034
|
+
*/function BCFViewpointsPlugin(viewer){var _this77;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,BCFViewpointsPlugin);_this77=_callSuper(this,BCFViewpointsPlugin,["BCFViewpoints",viewer,cfg]);/**
|
|
19026
19035
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
19027
19036
|
* @property originatingSystem
|
|
19028
19037
|
* @type {string}
|
|
19029
|
-
*/
|
|
19038
|
+
*/_this77.originatingSystem=cfg.originatingSystem||"tctwins.io";/**
|
|
19030
19039
|
* Identifies the authoring tool to include in BCF viewpoints saved by this plugin.
|
|
19031
19040
|
* @property authoringTool
|
|
19032
19041
|
* @type {string}
|
|
19033
|
-
*/
|
|
19042
|
+
*/_this77.authoringTool=cfg.authoringTool||"tctwins.io";return _this77;}/**
|
|
19034
19043
|
* Saves viewer state to a BCF viewpoint.
|
|
19035
19044
|
*
|
|
19036
19045
|
* See ````BCFViewpointsPlugin```` class comments for more info.
|
|
@@ -19049,7 +19058,7 @@ this.scene._lineSetDestroyed(this);}}]);}(Component);var tempVec3$4=math.vec3();
|
|
|
19049
19058
|
* objects in the viewpoint will be visible.
|
|
19050
19059
|
* @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
|
|
19051
19060
|
* @returns {*} BCF JSON viewpoint object
|
|
19052
|
-
*/_inherits(BCFViewpointsPlugin,_Plugin4);return _createClass(BCFViewpointsPlugin,[{key:"getViewpoint",value:function getViewpoint(){var
|
|
19061
|
+
*/_inherits(BCFViewpointsPlugin,_Plugin4);return _createClass(BCFViewpointsPlugin,[{key:"getViewpoint",value:function getViewpoint(){var _this78=this;var options=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var scene=this.viewer.scene;var camera=scene.camera;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;var bcfViewpoint={};// Camera
|
|
19053
19062
|
var lookDirection=math.normalizeVec3(math.subVec3(camera.look,camera.eye,math.vec3()));var eye=camera.eye;var up=camera.up;if(camera.yUp){// BCF is Z up
|
|
19054
19063
|
lookDirection=YToZ(lookDirection);eye=YToZ(eye);up=YToZ(up);}var camera_view_point=xyzArrayToObject(math.addVec3(eye,realWorldOffset));if(camera.projection==="ortho"){bcfViewpoint.orthogonal_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),view_to_world_scale:camera.ortho.scale};}else{bcfViewpoint.perspective_camera={camera_view_point:camera_view_point,camera_direction:xyzArrayToObject(lookDirection),camera_up_vector:xyzArrayToObject(up),field_of_view:camera.perspective.fov};}// Section planes
|
|
19055
19064
|
var sectionPlanes=scene.sectionPlanes;for(var id in sectionPlanes){if(sectionPlanes.hasOwnProperty(id)){var _sectionPlane27=sectionPlanes[id];if(!_sectionPlane27.active){continue;}var location=_sectionPlane27.pos;var _direction=void 0;if(reverseClippingPlanes){_direction=math.negateVec3(_sectionPlane27.dir,math.vec3());}else{_direction=_sectionPlane27.dir;}if(camera.yUp){// BCF is Z up
|
|
@@ -19058,7 +19067,7 @@ var lineSets=scene.lineSets;for(var _id2 in lineSets){if(lineSets.hasOwnProperty
|
|
|
19058
19067
|
var bitmaps=scene.bitmaps;for(var _id3 in bitmaps){if(bitmaps.hasOwnProperty(_id3)){var bitmap=bitmaps[_id3];var _location=bitmap.pos;var normal=bitmap.normal;var _up=bitmap.up;if(camera.yUp){// BCF is Z up
|
|
19059
19068
|
_location=YToZ(_location);normal=YToZ(normal);_up=YToZ(_up);}math.addVec3(_location,realWorldOffset);if(!bcfViewpoint.bitmaps){bcfViewpoint.bitmaps=[];}bcfViewpoint.bitmaps.push({bitmap_type:bitmap.type,bitmap_data:bitmap.imageData,location:xyzArrayToObject(_location),normal:xyzArrayToObject(normal),up:xyzArrayToObject(_up),height:bitmap.height});}}// Entity states
|
|
19060
19069
|
bcfViewpoint.components={view_setup_hints:{spaces_visible:!!options.spacesVisible,space_boundaries_visible:!!options.spaceBoundariesVisible,openings_visible:!!options.openingsVisible,spaces_translucent:!!options.spaces_translucent,space_boundaries_translucent:!!options.space_boundaries_translucent,openings_translucent:!!options.openings_translucent},visibility:{}};var opacityObjectIds=new Set(scene.opacityObjectIds);var xrayedObjectIds=new Set(scene.xrayedObjectIds);var colorizedObjectIds=new Set(scene.colorizedObjectIds);var coloringMap=Object.values(scene.objects).filter(function(entity){return opacityObjectIds.has(entity.id)||colorizedObjectIds.has(entity.id)||xrayedObjectIds.has(entity.id);}).reduce(function(coloringMap,entity){var color=colorizeToRGB(entity.colorize);var alpha;if(entity.xrayed){if(scene.xrayMaterial.fillAlpha===0.0&&scene.xrayMaterial.edgeAlpha!==0.0){// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
19061
|
-
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:
|
|
19070
|
+
alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).toString(16).padStart(2,"0");color=alpha+color;}else if(opacityObjectIds.has(entity.id)){alpha=Math.round(entity.opacity*255).toString(16).padStart(2,"0");color=alpha+color;}if(!coloringMap[color]){coloringMap[color]=[];}var objectId=entity.id;var originalSystemId=entity.originalSystemId;var component={ifc_guid:originalSystemId,originating_system:_this78.originatingSystem};if(originalSystemId!==objectId){component.authoring_tool_id=objectId;}coloringMap[color].push(component);return coloringMap;},{});var coloringArray=Object.entries(coloringMap).map(function(_ref14){var _ref15=_slicedToArray(_ref14,2),color=_ref15[0],components=_ref15[1];return{color:color,components:components};});bcfViewpoint.components.coloring=coloringArray;var objectIds=scene.objectIds;var visibleObjects=scene.visibleObjects;var visibleObjectIds=scene.visibleObjectIds;var invisibleObjectIds=objectIds.filter(function(id){return!visibleObjects[id];});var selectedObjectIds=scene.selectedObjectIds;if(options.defaultInvisible||visibleObjectIds.length<invisibleObjectIds.length){bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(visibleObjectIds);bcfViewpoint.components.visibility.default_visibility=false;}else{bcfViewpoint.components.visibility.exceptions=this._createBCFComponents(invisibleObjectIds);bcfViewpoint.components.visibility.default_visibility=true;}bcfViewpoint.components.selection=this._createBCFComponents(selectedObjectIds);bcfViewpoint.components.translucency=this._createBCFComponents(scene.xrayedObjectIds);if(options.snapshot!==false){bcfViewpoint.snapshot={snapshot_type:"png",snapshot_data:this.viewer.getSnapshot({format:"png"})};}return bcfViewpoint;}},{key:"_createBCFComponents",value:function _createBCFComponents(objectIds){var scene=this.viewer.scene;var components=[];for(var _i451=0,len=objectIds.length;_i451<len;_i451++){var objectId=objectIds[_i451];var entity=scene.objects[objectId];if(entity){var component={ifc_guid:entity.originalSystemId,originating_system:this.originatingSystem};if(entity.originalSystemId!==objectId){component.authoring_tool_id=objectId;}components.push(component);}}return components;}/**
|
|
19062
19071
|
* Sets viewer state to the given BCF viewpoint.
|
|
19063
19072
|
*
|
|
19064
19073
|
* Note that xeokit's {@link Camera#look} is the **point-of-interest**, whereas the BCF ````camera_direction```` is a
|
|
@@ -19080,9 +19089,9 @@ alpha=0.1;}else{alpha=scene.xrayMaterial.fillAlpha;}alpha=Math.round(alpha*255).
|
|
|
19080
19089
|
* @param {Boolean} [options.reverseClippingPlanes=false] When ````true````, clipping planes are reversed (https://github.com/buildingSMART/BCF-XML/issues/193)
|
|
19081
19090
|
* @param {Boolean} [options.updateCompositeObjects=false] When ````true````, then when visibility and selection updates refer to composite objects (eg. an IfcBuildingStorey),
|
|
19082
19091
|
* then this method will apply the updates to objects within those composites.
|
|
19083
|
-
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var
|
|
19092
|
+
*/},{key:"setViewpoint",value:function setViewpoint(bcfViewpoint){var _this79=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!bcfViewpoint){return;}var viewer=this.viewer;var scene=viewer.scene;var camera=scene.camera;var rayCast=options.rayCast!==false;var immediate=options.immediate!==false;var reset=options.reset!==false;var realWorldOffset=scene.realWorldOffset;var reverseClippingPlanes=options.reverseClippingPlanes===true;scene.clearSectionPlanes();if(bcfViewpoint.clipping_planes&&bcfViewpoint.clipping_planes.length>0){bcfViewpoint.clipping_planes.forEach(function(e){var pos=xyzObjectToArray(e.location,tempVec3$4);var dir=xyzObjectToArray(e.direction,tempVec3$4);if(reverseClippingPlanes){math.negateVec3(dir);}math.subVec3(pos,realWorldOffset);if(camera.yUp){pos=ZToY(pos);dir=ZToY(dir);}new SectionPlane(scene,{pos:pos,dir:dir});});}scene.clearLines();if(bcfViewpoint.lines&&bcfViewpoint.lines.length>0){var positions=[];var indices=[];var _i452=0;bcfViewpoint.lines.forEach(function(e){if(!e.start_point){return;}if(!e.end_point){return;}positions.push(e.start_point.x);positions.push(e.start_point.y);positions.push(e.start_point.z);positions.push(e.end_point.x);positions.push(e.end_point.y);positions.push(e.end_point.z);indices.push(_i452++);indices.push(_i452++);});new LineSet(scene,{positions:positions,indices:indices,clippable:false,collidable:true});}scene.clearBitmaps();if(bcfViewpoint.bitmaps&&bcfViewpoint.bitmaps.length>0){bcfViewpoint.bitmaps.forEach(function(e){var bitmap_type=e.bitmap_type||"jpg";// "jpg" | "png"
|
|
19084
19093
|
var bitmap_data=e.bitmap_data;// base64
|
|
19085
|
-
var location=xyzObjectToArray(e.location,tempVec3a$6);var normal=xyzObjectToArray(e.normal,tempVec3b$5);var up=xyzObjectToArray(e.up,tempVec3c$3);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return
|
|
19094
|
+
var location=xyzObjectToArray(e.location,tempVec3a$6);var normal=xyzObjectToArray(e.normal,tempVec3b$5);var up=xyzObjectToArray(e.up,tempVec3c$3);var height=e.height||1;if(!bitmap_type){return;}if(!bitmap_data){return;}if(!location){return;}if(!normal){return;}if(!up){return;}if(camera.yUp){location=ZToY(location);normal=ZToY(normal);up=ZToY(up);}new Bitmap(scene,{src:bitmap_data,type:bitmap_type,pos:location,normal:normal,up:up,clippable:false,collidable:true,height:height});});}if(reset){scene.setObjectsXRayed(scene.xrayedObjectIds,false);scene.setObjectsHighlighted(scene.highlightedObjectIds,false);scene.setObjectsSelected(scene.selectedObjectIds,false);}if(bcfViewpoint.components){if(bcfViewpoint.components.visibility){if(!bcfViewpoint.components.visibility.default_visibility){scene.setObjectsVisible(scene.objectIds,false);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.visible=true;});});}}else{scene.setObjectsVisible(scene.objectIds,true);if(bcfViewpoint.components.visibility.exceptions){bcfViewpoint.components.visibility.exceptions.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.visible=false;});});}}var view_setup_hints=bcfViewpoint.components.view_setup_hints;if(view_setup_hints){if(view_setup_hints.spaces_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),false);}if(view_setup_hints.spaces_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"),true);}if(view_setup_hints.space_boundaries_visible!==undefined);if(view_setup_hints.openings_visible===false){scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}if(view_setup_hints.space_boundaries_translucent!==undefined);if(view_setup_hints.openings_translucent!==undefined){scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcOpening"),true);}}}if(bcfViewpoint.components.selection){scene.setObjectsSelected(scene.selectedObjectIds,false);bcfViewpoint.components.selection.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.selected=true;});});}if(bcfViewpoint.components.translucency){scene.setObjectsXRayed(scene.xrayedObjectIds,false);bcfViewpoint.components.translucency.forEach(function(component){return _this79._withBCFComponent(options,component,function(entity){return entity.xrayed=true;});});}if(bcfViewpoint.components.coloring){bcfViewpoint.components.coloring.forEach(function(coloring){var color=coloring.color;var alpha=0;var alphaDefined=false;if(color.length===8){alpha=parseInt(color.substring(0,2),16)/256;if(alpha<=1.0&&alpha>=0.95){alpha=1.0;}color=color.substring(2);alphaDefined=true;}var colorize=[parseInt(color.substring(0,2),16)/256,parseInt(color.substring(2,4),16)/256,parseInt(color.substring(4,6),16)/256];coloring.components.map(function(component){return _this79._withBCFComponent(options,component,function(entity){entity.colorize=colorize;if(alphaDefined){entity.opacity=alpha;}});});});}}if(bcfViewpoint.perspective_camera||bcfViewpoint.orthogonal_camera){var eye;var look;var up;var projection;if(bcfViewpoint.perspective_camera){eye=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_view_point,tempVec3$4);look=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_direction,tempVec3$4);up=xyzObjectToArray(bcfViewpoint.perspective_camera.camera_up_vector,tempVec3$4);camera.perspective.fov=bcfViewpoint.perspective_camera.field_of_view;projection="perspective";}else{eye=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_view_point,tempVec3$4);look=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_direction,tempVec3$4);up=xyzObjectToArray(bcfViewpoint.orthogonal_camera.camera_up_vector,tempVec3$4);camera.ortho.scale=bcfViewpoint.orthogonal_camera.view_to_world_scale;projection="ortho";}math.subVec3(eye,realWorldOffset);if(camera.yUp){eye=ZToY(eye);look=ZToY(look);up=ZToY(up);}if(rayCast){var hit=scene.pick({pickSurface:true,// <<------ This causes picking to find the intersection point on the entity
|
|
19086
19095
|
origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3$4);}else{look=math.addVec3(eye,look,tempVec3$4);}if(immediate){camera.eye=eye;camera.look=look;camera.up=up;camera.projection=projection;}else{viewer.cameraFlight.flyTo({eye:eye,look:look,up:up,duration:options.duration,projection:projection});}}}},{key:"_withBCFComponent",value:function _withBCFComponent(options,component,callback){var viewer=this.viewer;var scene=viewer.scene;if(component.authoring_tool_id&&component.originating_system===this.originatingSystem){var id=component.authoring_tool_id;var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var metaObject=viewer.metaScene.metaObjects[id];if(metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);return;}}}if(component.ifc_guid){var originalSystemId=component.ifc_guid;var _entity2=scene.objects[originalSystemId];if(_entity2){callback(_entity2);return;}if(options.updateCompositeObjects){var _metaObject=viewer.metaScene.metaObjects[originalSystemId];if(_metaObject){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(originalSystemId),callback);return;}}Object.keys(scene.models).forEach(function(modelId){var id=math.globalizeObjectId(modelId,originalSystemId);var entity=scene.objects[id];if(entity){callback(entity);return;}if(options.updateCompositeObjects){var _metaObject2=viewer.metaScene.metaObjects[id];if(_metaObject2){scene.withObjects(viewer.metaScene.getObjectIDsInSubtree(id),callback);}}});}}},{key:"getUUID",value:function getUUID(){return math.createUUID();}/**
|
|
19087
19096
|
* Destroys this BCFViewpointsPlugin.
|
|
19088
19097
|
*/},{key:"destroy",value:function destroy(){_superPropGet(BCFViewpointsPlugin,"destroy",this,3)([]);}}]);}(Plugin);function xyzArrayToObject(arr){return{x:arr[0],y:arr[1],z:arr[2]};}function xyzObjectToArray(xyz,arry){arry=new Float64Array(3);arry[0]=xyz.x;arry[1]=xyz.y;arry[2]=xyz.z;return arry;}function YToZ(vec){return new Float64Array([vec[0],-vec[2],vec[1]]);}function ZToY(vec){return new Float64Array([vec[0],vec[2],-vec[1]]);}function colorizeToRGB(color){var rgb="";rgb+=Math.round(color[0]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[1]*255).toString(16).padStart(2,"0");rgb+=Math.round(color[2]*255).toString(16).padStart(2,"0");return rgb;}var distVec3=math.vec3();var lengthWire=function lengthWire(x1,y1,x2,y2){var a=x1-x2;var b=y1-y2;return Math.sqrt(a*a+b*b);};/**
|
|
@@ -19091,15 +19100,15 @@ origin:eye,direction:look});look=hit?hit.worldPos:math.addVec3(eye,look,tempVec3
|
|
|
19091
19100
|
* See {@link DistanceMeasurementsPlugin} for more info.
|
|
19092
19101
|
*/var DistanceMeasurement=/*#__PURE__*/function(_Component29){/**
|
|
19093
19102
|
* @private
|
|
19094
|
-
*/function DistanceMeasurement(plugin){var
|
|
19103
|
+
*/function DistanceMeasurement(plugin){var _this80;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurement);_this80=_callSuper(this,DistanceMeasurement,[plugin.viewer.scene,cfg]);/**
|
|
19095
19104
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurement.
|
|
19096
19105
|
* @type {DistanceMeasurementsPlugin}
|
|
19097
|
-
*/
|
|
19098
|
-
thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});
|
|
19099
|
-
});
|
|
19100
|
-
});
|
|
19101
|
-
});
|
|
19102
|
-
});
|
|
19106
|
+
*/_this80.plugin=plugin;_this80._container=cfg.container;if(!_this80._container){throw"config missing: container";}_this80._eventSubs={};_this80._color=cfg.color?cfg.color:plugin.defaultColor;_this80._borderColor=plugin.defaultColor?plugin.defaultColor:"white";var scene=_this80.plugin.viewer.scene;_this80._originMarker=new Marker(scene,cfg.origin);_this80._targetMarker=new Marker(scene,cfg.target);_this80._originWorld=math.vec3();_this80._targetWorld=math.vec3();_this80._wp=new Float64Array(24);_this80._vp=new Float64Array(24);_this80._pp=new Float64Array(24);_this80._cp=new Float64Array(8);_this80._xAxisLabelCulled=false;_this80._yAxisLabelCulled=false;_this80._zAxisLabelCulled=false;var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_this80);_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseover",event));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_this80);_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseleave",event));}:null;var onMouseClick=cfg.onMouseClick?function(event){cfg.onMouseClick(event,_this80);_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("click",event));}:null;var onTouchStart=cfg.onTouchStart?function(event){cfg.onTouchStart(event,_this80);event.preventDefault();_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("touchstart",event));}:null;var onMouseDown=function onMouseDown(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousedown",event));};var onMouseUp=function onMouseUp(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mouseup",event));};var onMouseMove=function onMouseMove(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new MouseEvent("mousemove",event));};var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_this80);}:null;var onMouseWheel=function onMouseWheel(event){_this80.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent("wheel",event));};_this80._originDot=new Dot(_this80._container,{fillColor:_this80._color,borderColor:_this80._borderColor,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._targetDot=new Dot(_this80._container,{fillColor:_this80._color,borderColor:_this80._borderColor,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthWire=new Wire(_this80._container,{color:_this80._color,thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._lengthLabel=new Label(_this80._container,{fillColor:_this80._color||"#0065FC",prefix:"",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+4:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisWire=new Wire(_this80._container,{color:"#FF0000",//red
|
|
19107
|
+
thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisWire=new Wire(_this80._container,{color:"green",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisWire=new Wire(_this80._container,{color:"blue",thickness:1,thicknessClickable:6,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._xAxisLabel=new Label(_this80._container,{fillColor:"red",prefix:"X",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._yAxisLabel=new Label(_this80._container,{fillColor:"green",prefix:"Y",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._zAxisLabel=new Label(_this80._container,{fillColor:"blue",prefix:"Z",text:"",zIndex:plugin.zIndex!==undefined?plugin.zIndex+3:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onMouseDown:onMouseDown,onMouseClick:onMouseClick,onTouchStart:onTouchStart,onMouseUp:onMouseUp,onMouseMove:onMouseMove,onContextMenu:onContextMenu});_this80._wpDirty=false;_this80._vpDirty=false;_this80._cpDirty=false;_this80._sectionPlanesDirty=true;_this80._visible=false;_this80._originVisible=false;_this80._targetVisible=false;_this80._wireVisible=false;_this80._axisVisible=false;_this80._xAxisVisible=false;_this80._yAxisVisible=false;_this80._zAxisVisible=false;_this80._axisEnabled=true;_this80._labelsVisible=false;_this80._labelsOnWires=false;_this80._clickable=false;_this80._originMarker.on("worldPos",function(value){_this80._originWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
19108
|
+
});_this80._targetMarker.on("worldPos",function(value){_this80._targetWorld.set(value||[0,0,0]);_this80._wpDirty=true;_this80._needUpdate(0);// No lag
|
|
19109
|
+
});_this80._onViewMatrix=scene.camera.on("viewMatrix",function(){_this80._vpDirty=true;_this80._needUpdate(0);// No lag
|
|
19110
|
+
});_this80._onProjMatrix=scene.camera.on("projMatrix",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onCanvasBoundary=scene.canvas.on("boundary",function(){_this80._cpDirty=true;_this80._needUpdate(0);// No lag
|
|
19111
|
+
});_this80._onMetricsUnits=scene.metrics.on("units",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsScale=scene.metrics.on("scale",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onMetricsOrigin=scene.metrics.on("origin",function(){_this80._cpDirty=true;_this80._needUpdate();});_this80._onSectionPlaneUpdated=scene.on("sectionPlaneUpdated",function(){_this80._sectionPlanesDirty=true;_this80._needUpdate();});_this80.precision=cfg.precision!==undefined?cfg.precision:2;_this80.approximate=cfg.approximate!==undefined?cfg.approximate:true;_this80.visible=cfg.visible;_this80.originVisible=cfg.originVisible;_this80.targetVisible=cfg.targetVisible;_this80.wireVisible=cfg.wireVisible;_this80.axisVisible=cfg.axisVisible;_this80.xAxisVisible=cfg.xAxisVisible;_this80.yAxisVisible=cfg.yAxisVisible;_this80.zAxisVisible=cfg.zAxisVisible;_this80.labelsVisible=cfg.labelsVisible;_this80.labelsOnWires=cfg.labelsOnWires;_this80._xLabel=null;_this80._yLabel=null;_this80._zLabel=null;return _this80;}_inherits(DistanceMeasurement,_Component29);return _createClass(DistanceMeasurement,[{key:"_update",value:function _update(){if(!this._visible){return;}var scene=this.plugin.viewer.scene;if(this._wpDirty){this._wp[0]=this._originWorld[0];this._wp[1]=this._originWorld[1];this._wp[2]=this._originWorld[2];this._wp[3]=1.0;this._wp[4]=this._targetWorld[0];this._wp[5]=this._originWorld[1];this._wp[6]=this._originWorld[2];this._wp[7]=1.0;this._wp[8]=this._targetWorld[0];this._wp[9]=this._targetWorld[1];this._wp[10]=this._originWorld[2];this._wp[11]=1.0;this._wp[12]=this._targetWorld[0];this._wp[13]=this._targetWorld[1];this._wp[14]=this._targetWorld[2];this._wp[15]=1.0;this._wpDirty=false;this._vpDirty=true;}if(this._vpDirty){math.transformPositions4(scene.camera.viewMatrix,this._wp,this._vp);this._vp[3]=1.0;this._vp[7]=1.0;this._vp[11]=1.0;this._vp[15]=1.0;this._vpDirty=false;this._cpDirty=true;}if(this._sectionPlanesDirty){if(this._isSliced(this._originWorld)||this._isSliced(this._targetWorld)){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setCulled(true);this._yAxisWire.setCulled(true);this._zAxisWire.setCulled(true);this._lengthWire.setCulled(true);this._originDot.setCulled(true);this._targetDot.setCulled(true);return;}else{this._xAxisLabel.setCulled(false);this._yAxisLabel.setCulled(false);this._zAxisLabel.setCulled(false);this._lengthLabel.setCulled(false);this._xAxisWire.setCulled(false);this._yAxisWire.setCulled(false);this._zAxisWire.setCulled(false);this._lengthWire.setCulled(false);this._originDot.setCulled(false);this._targetDot.setCulled(false);}this._sectionPlanesDirty=true;}var near=-0.3;var vpz1=this._originMarker.viewPos[2];var vpz2=this._targetMarker.viewPos[2];if(vpz1>near||vpz2>near){this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);this._lengthLabel.setCulled(true);this._xAxisWire.setVisible(false);this._yAxisWire.setVisible(false);this._zAxisWire.setVisible(false);this._lengthWire.setVisible(false);this._originDot.setVisible(false);this._targetDot.setVisible(false);return;}if(this._cpDirty){math.transformPositions4(scene.camera.project.matrix,this._vp,this._pp);var pp=this._pp;var cp=this._cp;var canvas=scene.canvas.canvas;var offsets=canvas.getBoundingClientRect();var containerOffsets=this._container.getBoundingClientRect();var top=offsets.top-containerOffsets.top;var left=offsets.left-containerOffsets.left;var aabb=scene.canvas.boundary;var canvasWidth=aabb[2];var canvasHeight=aabb[3];var j=0;var metrics=this.plugin.viewer.scene.metrics;var _scale5=metrics.scale;var units=metrics.units;var unitInfo=metrics.unitsInfo[units];var unitAbbrev=unitInfo.abbrev;for(var i=0,len=pp.length;i<len;i+=4){cp[j]=left+Math.floor((1+pp[i+0]/pp[i+3])*canvasWidth/2);cp[j+1]=top+Math.floor((1-pp[i+1]/pp[i+3])*canvasHeight/2);j+=2;}this._originDot.setPos(cp[0],cp[1]);this._targetDot.setPos(cp[6],cp[7]);this._lengthWire.setStartAndEnd(cp[0],cp[1],cp[6],cp[7]);this._xAxisWire.setStartAndEnd(cp[0],cp[1],cp[2],cp[3]);this._yAxisWire.setStartAndEnd(cp[2],cp[3],cp[4],cp[5]);this._zAxisWire.setStartAndEnd(cp[4],cp[5],cp[6],cp[7]);if(!this.labelsVisible){this._lengthLabel.setCulled(true);this._xAxisLabel.setCulled(true);this._yAxisLabel.setCulled(true);this._zAxisLabel.setCulled(true);}else{this._lengthLabel.setPosOnWire(cp[0],cp[1],cp[6],cp[7]);if(this.labelsOnWires){this._xAxisLabel.setPosOnWire(cp[0],cp[1],cp[2],cp[3]);this._yAxisLabel.setPosOnWire(cp[2],cp[3],cp[4],cp[5]);this._zAxisLabel.setPosOnWire(cp[4],cp[5],cp[6],cp[7]);}else{var labelOffset=35;var currentLabelOffset=labelOffset;this._xAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._yAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);currentLabelOffset+=labelOffset;this._zAxisLabel.setPosOnWire(cp[0],cp[1]+currentLabelOffset,cp[6],cp[7]+currentLabelOffset);}var tilde=this._approximate?" ":" = ";this._length=Math.abs(math.lenVec3(math.subVec3(this._targetWorld,this._originWorld,distVec3)));this._lengthLabel.setText(tilde+(this._length*_scale5).toFixed(this._precision)+unitAbbrev);var xAxisCanvasLength=Math.abs(lengthWire(cp[0],cp[1],cp[2],cp[3]));var yAxisCanvasLength=Math.abs(lengthWire(cp[2],cp[3],cp[4],cp[5]));var zAxisCanvasLength=Math.abs(lengthWire(cp[4],cp[5],cp[6],cp[7]));var labelMinAxisLength=this.plugin.labelMinAxisLength;if(this.labelsOnWires){this._xAxisLabelCulled=xAxisCanvasLength<labelMinAxisLength;this._yAxisLabelCulled=yAxisCanvasLength<labelMinAxisLength;this._zAxisLabelCulled=zAxisCanvasLength<labelMinAxisLength;}else{this._xAxisLabelCulled=false;this._yAxisLabelCulled=false;this._zAxisLabelCulled=false;}if(!this._xAxisLabelCulled){this._xLabel=Math.abs((this._targetWorld[0]-this._originWorld[0])*_scale5).toFixed(this._precision);this._xAxisLabel.setText(tilde+this._xLabel+unitAbbrev);this._xAxisLabel.setCulled(!this.axisVisible);}else{this._xAxisLabel.setCulled(true);}if(!this._yAxisLabelCulled){this._yLabel=Math.abs((this._targetWorld[1]-this._originWorld[1])*_scale5).toFixed(this._precision);this._yAxisLabel.setText(tilde+this._yLabel+unitAbbrev);this._yAxisLabel.setCulled(!this.axisVisible);}else{this._yAxisLabel.setCulled(true);}if(!this._zAxisLabelCulled){this._zLabel=Math.abs((this._targetWorld[2]-this._originWorld[2])*_scale5).toFixed(this._precision);this._zAxisLabel.setText(tilde+this._zLabel+unitAbbrev);this._zAxisLabel.setCulled(!this.axisVisible);}else{this._zAxisLabel.setCulled(true);}}// this._xAxisLabel.setVisible(this.axisVisible && this.xAxisVisible);
|
|
19103
19112
|
// this._yAxisLabel.setVisible(this.axisVisible && this.yAxisVisible);
|
|
19104
19113
|
// this._zAxisLabel.setVisible(this.axisVisible && this.zAxisVisible);
|
|
19105
19114
|
// this._lengthLabel.setVisible(false);
|
|
@@ -19346,7 +19355,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19346
19355
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
19347
19356
|
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
19348
19357
|
* @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
|
|
19349
|
-
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var
|
|
19358
|
+
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_callSuper(this,DistanceMeasurementsMouseControl,[distanceMeasurementsPlugin.viewer.scene]);_this81.cfg=cfg;_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._activate=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);_this81._offsetX=cfg._offsetX|0;_this81._offsetY=cfg._offsetY|0;return _this81;}_inherits(DistanceMeasurementsMouseControl,_DistanceMeasurements);return _createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistancePivotMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){this._markerDiv.parentNode.removeChild(this._markerDiv);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
19350
19359
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
|
|
19351
19360
|
* @type {DistanceMeasurementsPlugin}
|
|
19352
19361
|
*/this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
|
|
@@ -19382,7 +19391,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19382
19391
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
19383
19392
|
*/function get(){return this._snapping;},set:function set(snapping){this._snapping=snapping;}},{key:"mouseState",get:function get(){return this._mouseState;}/**
|
|
19384
19393
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
19385
|
-
*/,set:function set(state){this._mouseState=state;}},{key:"activate",value:function activate(){var
|
|
19394
|
+
*/,set:function set(state){this._mouseState=state;}},{key:"activate",value:function activate(){var _this82=this;if(this._activate){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var hover=false;distanceMeasurementsPlugin.on("mouseOver",function(e){hover=true;});distanceMeasurementsPlugin.on("mouseLeave",function(e){hover=false;});distanceMeasurementsPlugin.on("measureDelete",function(e){hover=false;});distanceMeasurementsPlugin.on("measurementDestroyed",function(e){});var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;var hoverOn=function hoverOn(event){if(!_this82._active){return;}if(hover)return;var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=scrollLeft;var canvasTopEdge=scrollTop;_this82._markerDiv.style.marginLeft="".concat(_this82._offsetX+canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.marginTop="".concat(_this82._offsetY+canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.marginLeft="-10000px";_this82._markerDiv.style.marginTop="-10000px";}};this._onHoverSnapOrSurface=cameraControl.on("hoverSnapOrSurface",function(event){if(_this82._snapping){hoverOn(event);}});this._onHoverSurface=cameraControl.on("hoverSurface",function(event){if(!_this82._snapping){hoverOn(event);}});canvas.addEventListener("mousedown",this._onMouseDown=function(e){if(!_this82._active){return;}if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(!_this82._active){return;}if(hover)return;if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},precision:distanceMeasurementsPlugin.precision,approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this.markerHidden=function(e){if(!_this82._markerDiv)return;if(e.target!==canvas){_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";}};document.addEventListener("mousemove",this.markerHidden);var hoverOff=function hoverOff(event){if(!_this82._active){return;}if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.marginLeft="-100px";_this82._markerDiv.style.marginTop="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";};this._onHoverSnapOrSurfaceOff=cameraControl.on("hoverSnapOrSurfaceOff",function(event){if(_this82._snapping){hoverOff(event);}});this._onHoverOff=cameraControl.on("hoverOff",function(event){if(!_this82._snapping){hoverOff(event);}});this._activate=true;}/**
|
|
19386
19395
|
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
19387
19396
|
*
|
|
19388
19397
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
@@ -19675,7 +19684,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19675
19684
|
* @param {number} [cfg.zIndex] If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels).
|
|
19676
19685
|
* @param {boolean} [cfg.defaultLabelsOnWires=true] The default value of the DistanceMeasurements `labelsOnWires` property.
|
|
19677
19686
|
* @param {PointerCircle} [cfg.pointerLens] A PointerLens to help the user position the pointer. This can be shared with other plugins.
|
|
19678
|
-
*/function DistanceMeasurementsPlugin(viewer){var
|
|
19687
|
+
*/function DistanceMeasurementsPlugin(viewer){var _this83;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsPlugin);_this83=_callSuper(this,DistanceMeasurementsPlugin,["DistanceMeasurements",viewer]);_this83._pointerLens=cfg.pointerLens;_this83._container=cfg.container||viewer.viewerElement||document.body;_this83._defaultControl=null;_this83._measurements={};_this83.labelMinAxisLength=cfg.labelMinAxisLength;_this83.defaultVisible=cfg.defaultVisible!==false;_this83.defaultOriginVisible=cfg.defaultOriginVisible!==false;_this83.defaultTargetVisible=cfg.defaultTargetVisible!==false;_this83.defaultWireVisible=cfg.defaultWireVisible!==false;_this83.defaultLabelsVisible=cfg.defaultLabelsVisible!==false;_this83.defaultAxisVisible=cfg.defaultAxisVisible!==false;_this83.defaultXAxisVisible=cfg.defaultXAxisVisible!==false;_this83.defaultYAxisVisible=cfg.defaultYAxisVisible!==false;_this83.defaultZAxisVisible=cfg.defaultZAxisVisible!==false;_this83.defaultLabelsOnWires=cfg.defaultLabelsOnWires!==false;_this83.defaultColor=cfg.defaultColor!==undefined?cfg.defaultColor:"#0065fc";_this83.zIndex=cfg.zIndex||10000;_this83.precision=cfg.precision!==undefined?cfg.precision:2;_this83._onMouseOver=function(event,measurement){_this83.fire("mouseOver",{plugin:_this83,distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onMouseLeave=function(event,measurement){_this83.fire("mouseLeave",{plugin:_this83,distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onMouseClick=function(event,measurement){_this83.fire("clickMeasure",{plugin:_this83,distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onTouchStart=function(event,measurement){_this83.fire("touchMeasure",{plugin:_this83,distanceMeasurement:measurement,measurement:measurement,event:event});};_this83._onContextMenu=function(event,measurement){_this83.fire("contextMenu",{plugin:_this83,distanceMeasurement:measurement,measurement:measurement,event:event});};return _this83;}/**
|
|
19679
19688
|
* 设置精度
|
|
19680
19689
|
* @param {number} precision
|
|
19681
19690
|
*/_inherits(DistanceMeasurementsPlugin,_Plugin5);return _createClass(DistanceMeasurementsPlugin,[{key:"precision",get:function get(){return this._precision;}/**
|
|
@@ -19734,7 +19743,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19734
19743
|
* @param {string} [params.color] The color of the length dot, wire and label.
|
|
19735
19744
|
* @param {Boolean} [params.labelsOnWires=true] Determines if labels will be set on wires or one below the other.
|
|
19736
19745
|
* @returns {DistanceMeasurement} The new {@link DistanceMeasurement}.
|
|
19737
|
-
*/,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"createMeasurement",value:function createMeasurement(){var
|
|
19746
|
+
*/,set:function set(labelMinAxisLength){if(labelMinAxisLength<1){this.error("labelMinAxisLength must be >= 1; defaulting to 25");labelMinAxisLength=25;}this._labelMinAxisLength=labelMinAxisLength||25;}},{key:"createMeasurement",value:function createMeasurement(){var _this84=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(this.viewer.scene.components[params.id]){this.error("Viewer scene component with this ID already exists: "+params.id);delete params.id;}var origin=params.origin;var target=params.target;var measurement=new DistanceMeasurement(this,{id:params.id,plugin:this,container:this._container,origin:{entity:origin.entity,worldPos:origin.worldPos},target:{entity:target.entity,worldPos:target.worldPos},borderColor:params.borderColor,color:params.color,visible:params.visible,originVisible:params.originVisible,targetVisible:params.targetVisible,wireVisible:params.wireVisible,axisVisible:params.axisVisible!==false&&this.defaultAxisVisible!==false,xAxisVisible:params.xAxisVisible!==false&&this.defaultXAxisVisible!==false,yAxisVisible:params.yAxisVisible!==false&&this.defaultYAxisVisible!==false,zAxisVisible:params.zAxisVisible!==false&&this.defaultZAxisVisible!==false,labelsVisible:params.labelsVisible!==false&&this.defaultLabelsVisible!==false,labelsOnWires:params.labelsOnWires!==false&&this.defaultLabelsOnWires!==false,onMouseOver:this._onMouseOver,onMouseLeave:this._onMouseLeave,onMouseClick:this._onMouseClick,onTouchStart:this._onTouchStart,onContextMenu:this._onContextMenu,precision:this._precision});this._measurements[measurement.id]=measurement;measurement.on("destroyed",function(){delete _this84._measurements[measurement.id];});this.fire("measurementCreated",measurement);return measurement;}/**
|
|
19738
19747
|
* Destroys a {@link DistanceMeasurement}.
|
|
19739
19748
|
*
|
|
19740
19749
|
* @param {String} id ID of DistanceMeasurement to destroy.
|
|
@@ -19772,8 +19781,8 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19772
19781
|
* @param {boolean} [cfg.snapToVertex=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsTouchControl.
|
|
19773
19782
|
* @param {_offsetX} [cfg._offsetX] _offsetX of the mouse
|
|
19774
19783
|
* @param {_offsetY} [cfg._offsetY] _offsetY of the mouse
|
|
19775
|
-
*/function DistanceMeasurementsTouchControl(distanceMeasurementsPlugin){var
|
|
19776
|
-
|
|
19784
|
+
*/function DistanceMeasurementsTouchControl(distanceMeasurementsPlugin){var _this85;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsTouchControl);_this85=_callSuper(this,DistanceMeasurementsTouchControl,[distanceMeasurementsPlugin.viewer.scene]);_this85.pointerLens=cfg.pointerLens;// this.PointerLens = new PointerLens(distanceMeasurementsPlugin.viewer, { active: true });
|
|
19785
|
+
_this85.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"distanceMeasure_Circle"});_this85._active=false;_this85._activate=false;_this85._initMarkerDiv();_this85._currentDistanceMeasurement=null;_this85._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this85._onCanvasTouchStart=null;_this85._onCanvasTouchEnd=null;_this85._longTouchTimeoutMs=300;_this85._snapping=cfg.snapping!==false;_this85._snapToEdge=cfg.snapping!==false;_this85._snapToVertex=cfg.snapping!==false;_this85._touchState=WAITING_FOR_ORIGIN_TOUCH_START;_this85._attachPlugin(distanceMeasurementsPlugin,cfg);_this85._offsetX=cfg._offsetX|0;_this85._offsetY=cfg._offsetY|0;return _this85;}_inherits(DistanceMeasurementsTouchControl,_DistanceMeasurements2);return _createClass(DistanceMeasurementsTouchControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement("div");markerDiv.setAttribute("id","myDistanceMeasureTouchMarker");var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.margin="-200px -200px";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this.markerDiv){this.markerDiv.parentNode.removeChild(this.markerDiv);this.markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){/**
|
|
19777
19786
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsTouchControl.
|
|
19778
19787
|
* @type {DistanceMeasurementsPlugin}
|
|
19779
19788
|
*/this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
|
|
@@ -19808,42 +19817,42 @@ _this84.pointerCircle=new PointerCircle(distanceMeasurementsPlugin.viewer,{id:"d
|
|
|
19808
19817
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
19809
19818
|
*/function get(){return this._snapping;},set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"touchState",get:function get(){return this._touchState;}/**
|
|
19810
19819
|
* Activates this DistanceMeasurementsTouchControl, ready to respond to input.
|
|
19811
|
-
*/,set:function set(state){this._touchState=state;}},{key:"activate",value:function activate(){var
|
|
19812
|
-
cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapping:
|
|
19820
|
+
*/,set:function set(state){this._touchState=state;}},{key:"activate",value:function activate(){var _this86=this;if(this._activate){return;}var plugin=this.plugin;var scene=this.scene;var canvas=scene.canvas.canvas;this.pointerLens;var pointerWorldPos=math.vec3();var touchTolerance=20;var longTouchTimeout=null;this._touchState=WAITING_FOR_ORIGIN_TOUCH_START;var touchStartCanvasPos=math.vec2();var touchMoveCanvasPos=math.vec2();var touchEndCanvasPos=math.vec2();var touchId=null;var disableCameraNavigation=function disableCameraNavigation(){_this86.plugin.viewer.cameraControl.active=false;};var enableCameraNavigation=function enableCameraNavigation(){_this86.plugin.viewer.cameraControl.active=true;};var cancel=function cancel(){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}if(_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement.destroy();_this86._currentDistanceMeasurement=null;}enableCameraNavigation();_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;};canvas.addEventListener("touchstart",this._onCanvasTouchStart=function(event){if(!_this86._active){return;}if(!event.isTrusted)return;var currentNumTouches=event.touches.length;if(currentNumTouches!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;touchStartCanvasPos.set([touchX+_this86.offsetX,touchY+_this86.offsetY]);touchMoveCanvasPos.set([touchX+_this86.offsetX,touchY+_this86.offsetY]);switch(_this86._touchState){case WAITING_FOR_ORIGIN_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
|
|
19821
|
+
cancel();return;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapping:_this86._snapping,snapToEdge:_this86._snapping});if(snapPickResult&&snapPickResult.snapped){pointerWorldPos.set(snapPickResult.worldPos);_this86.pointerCircle.start(snapPickResult.snappedCanvasPos);}else{var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){pointerWorldPos.set(pickResult.worldPos);_this86.pointerCircle.start(pickResult.canvasPos);}else{return;}}longTouchTimeout=setTimeout(function(){if(currentNumTouches!==1||touchMoveCanvasPos[0]>touchStartCanvasPos[0]+touchTolerance||touchMoveCanvasPos[0]<touchStartCanvasPos[0]-touchTolerance||touchMoveCanvasPos[1]>touchStartCanvasPos[1]+touchTolerance||touchMoveCanvasPos[1]<touchStartCanvasPos[1]-touchTolerance){return;// Has moved
|
|
19813
19822
|
}// Long touch
|
|
19814
|
-
if(
|
|
19815
|
-
if(!
|
|
19823
|
+
if(_this86.pointerLens){_this86.pointerLens.visible=true;_this86.pointerLens.canvasPos=touchStartCanvasPos;_this86.pointerLens.cursorPos=touchStartCanvasPos;}if(_this86.pointerLens){_this86.pointerLens.canvasPos=touchMoveCanvasPos;_this86.pointerLens.snapped=false;}if(_this86.pointerLens){_this86.pointerLens.cursorPos=snapPickResult.canvasPos;_this86.pointerLens.snapped=true;}// pointerWorldPos.set(snapPickResult.snappedWorldPos);
|
|
19824
|
+
if(!_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos,entity:snapPickResult.entity},target:{worldPos:pointerWorldPos,entity:snapPickResult.entity},precision:plugin.precision});_this86._currentDistanceMeasurement.labelsVisible=false;_this86._currentDistanceMeasurement.xAxisVisible=false;_this86._currentDistanceMeasurement.yAxisVisible=false;_this86._currentDistanceMeasurement.zAxisVisible=false;_this86._currentDistanceMeasurement.wireVisible=false;_this86._currentDistanceMeasurement.originVisible=true;_this86._currentDistanceMeasurement.targetVisible=false;_this86._currentDistanceMeasurement.clickable=false;}else{_this86._currentDistanceMeasurement.origin.worldPos=pointerWorldPos;}_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);// if (this.pointerLens) {
|
|
19816
19825
|
// this.pointerLens.cursorPos = pickResult.canvasPos;
|
|
19817
19826
|
// this.pointerLens.snapped = false;
|
|
19818
19827
|
// }
|
|
19819
|
-
|
|
19820
|
-
disableCameraNavigation();},
|
|
19828
|
+
_this86._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
19829
|
+
disableCameraNavigation();},_this86._longTouchTimeoutMs);_this86._touchState=WAITING_FOR_ORIGIN_QUICK_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
19821
19830
|
touchId=touch.identifier;break;case WAITING_FOR_TARGET_TOUCH_START:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
|
|
19822
19831
|
clearTimeout(longTouchTimeout);longTouchTimeout=null;return;}if(currentNumTouches===1){// One finger down
|
|
19823
19832
|
longTouchTimeout=setTimeout(function(){longTouchTimeout=null;if(currentNumTouches!==1||touchMoveCanvasPos[0]>touchStartCanvasPos[0]+touchTolerance||touchMoveCanvasPos[0]<touchStartCanvasPos[0]-touchTolerance||touchMoveCanvasPos[1]>touchStartCanvasPos[1]+touchTolerance||touchMoveCanvasPos[1]<touchStartCanvasPos[1]-touchTolerance){// Has moved
|
|
19824
19833
|
return;}// Long touch
|
|
19825
|
-
if(
|
|
19826
|
-
disableCameraNavigation();},
|
|
19827
|
-
}touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}
|
|
19828
|
-
return;}},{passive:true});canvas.addEventListener("touchmove",function(event){if(!
|
|
19834
|
+
if(_this86.pointerLens){_this86.pointerLens.visible=true;_this86.pointerLens.canvasPos=touchStartCanvasPos;_this86.pointerLens.snapped=false;}var snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this86._snapping,snapToEdge:_this86._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this86.pointerLens){_this86.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this86.pointerLens.snapped=true;}_this86.pointerCircle.start(snapPickResult.snappedCanvasPos);pointerWorldPos.set(snapPickResult.worldPos);_this86._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this86._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this86._currentDistanceMeasurement.targetVisible=true;_this86._currentDistanceMeasurement.wireVisible=true;_this86._currentDistanceMeasurement.labelsVisible=true;_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);}else{var _pickResult6=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult6&&_pickResult6.worldPos){if(_this86.pointerLens){_this86.pointerLens.cursorPos=_pickResult6.canvasPos;_this86.pointerLens.snapped=false;}_this86.pointerCircle.start(_pickResult6.canvasPos);pointerWorldPos.set(_pickResult6.worldPos);_this86._currentDistanceMeasurement.target.worldPos=_pickResult6.worldPos;_this86._currentDistanceMeasurement.target.entity=_pickResult6.entity;_this86._currentDistanceMeasurement.targetVisible=true;_this86._currentDistanceMeasurement.wireVisible=true;_this86._currentDistanceMeasurement.labelsVisible=true;_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);}else{if(_this86.pointerLens){_this86.pointerLens.cursorPos=null;_this86.pointerLens.snapped=false;}}}_this86._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
19835
|
+
disableCameraNavigation();},_this86._longTouchTimeoutMs);_this86._touchState=WAITING_FOR_TARGET_QUICK_TOUCH_END;// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_QUICK_TOUCH_END")
|
|
19836
|
+
}touchId=touch.identifier;break;default:if(longTouchTimeout!==null){clearTimeout(longTouchTimeout);longTouchTimeout=null;}_this86._touchState=TOUCH_CANCELING;// console.log("touchstart: this._touchState= default -> TOUCH_CANCELING")
|
|
19837
|
+
return;}},{passive:true});canvas.addEventListener("touchmove",function(event){if(!_this86._active){return;}_this86.pointerCircle.stop();var currentNumTouches=event.touches.length;if(currentNumTouches!==1||event.changedTouches.length!==1){if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}return;}var touch=event.touches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}touchMoveCanvasPos.set([touchX+_this86.offsetX,touchY+_this86.offsetY]);var snapPickResult;var pickResult;switch(_this86._touchState){case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this86.pointerLens){_this86.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this86._snapping,snapToEdge:_this86._snapping});if(snapPickResult&&snapPickResult.snapped){if(_this86.pointerLens){_this86.pointerLens.snappedCanvasPos=snapPickResult.snappedCanvasPos;_this86.pointerLens.snapped=true;}pointerWorldPos.set(snapPickResult.worldPos);if(!_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},target:{worldPos:snapPickResult.worldPos,entity:snapPickResult.entity},precision:plugin.precision});_this86._currentDistanceMeasurement.labelsVisible=false;_this86._currentDistanceMeasurement.xAxisVisible=false;_this86._currentDistanceMeasurement.yAxisVisible=false;_this86._currentDistanceMeasurement.zAxisVisible=false;_this86._currentDistanceMeasurement.wireVisible=false;_this86._currentDistanceMeasurement.originVisible=true;_this86._currentDistanceMeasurement.targetVisible=false;_this86._currentDistanceMeasurement.clickable=false;}else{_this86._currentDistanceMeasurement.origin.worldPos=snapPickResult.worldPos;}_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this86.pointerLens){_this86.pointerLens.cursorPos=pickResult.canvasPos;_this86.pointerLens.snapped=false;}pointerWorldPos.set(pickResult.worldPos);if(!_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this86._currentDistanceMeasurement.labelsVisible=false;_this86._currentDistanceMeasurement.xAxisVisible=false;_this86._currentDistanceMeasurement.yAxisVisible=false;_this86._currentDistanceMeasurement.zAxisVisible=false;_this86._currentDistanceMeasurement.wireVisible=false;_this86._currentDistanceMeasurement.originVisible=true;_this86._currentDistanceMeasurement.targetVisible=false;_this86._currentDistanceMeasurement.clickable=false;}else{_this86._currentDistanceMeasurement.origin.worldPos=pickResult.worldPos;}_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);}else{if(_this86.pointerLens){_this86.pointerLens.cursorPos=null;_this86.pointerLens.snapped=false;}}}_this86._touchState=WAITING_FOR_ORIGIN_LONG_TOUCH_END;// console.log("touchmove: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
19829
19838
|
break;// case WAITING_FOR_TARGET_TOUCH_START:
|
|
19830
19839
|
// this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
19831
19840
|
// console.log("touchmove: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_TOUCH_START")
|
|
19832
19841
|
// break;
|
|
19833
19842
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:if(currentNumTouches!==1&&longTouchTimeout!==null){// Two or more fingers down
|
|
19834
|
-
clearTimeout(longTouchTimeout);longTouchTimeout=null;if(
|
|
19835
|
-
return;}if(
|
|
19836
|
-
case WAITING_FOR_ORIGIN_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){
|
|
19837
|
-
|
|
19838
|
-
}else{if(
|
|
19843
|
+
clearTimeout(longTouchTimeout);longTouchTimeout=null;if(_this86.pointerLens){_this86.pointerLens.visible=false;}_this86._touchState=TOUCH_CANCELING;// console.log("touchmove: this._touchState= QUICK_TOUCH_FINDING_TARGET -> TOUCH_CANCELING")
|
|
19844
|
+
return;}if(_this86.pointerLens){_this86.pointerLens.canvasPos=touchMoveCanvasPos;}snapPickResult=scene.pick({canvasPos:touchMoveCanvasPos,snapToVertex:_this86._snapping,snapToEdge:_this86._snapping});if(snapPickResult&&snapPickResult.worldPos){if(_this86.pointerLens){_this86.pointerLens.cursorPos=snapPickResult.snappedCanvasPos;_this86.pointerLens.snapped=true;}_this86._currentDistanceMeasurement.target.worldPos=snapPickResult.worldPos;_this86._currentDistanceMeasurement.target.entity=snapPickResult.entity;_this86._currentDistanceMeasurement.targetVisible=true;_this86._currentDistanceMeasurement.wireVisible=true;_this86._currentDistanceMeasurement.labelsVisible=true;}else{pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){if(_this86.pointerLens){_this86.pointerLens.cursorPos=pickResult.canvasPos;_this86.pointerLens.snapped=false;}_this86._currentDistanceMeasurement.target.worldPos=pickResult.worldPos;_this86._currentDistanceMeasurement.target.entity=pickResult.entity;_this86._currentDistanceMeasurement.targetVisible=true;_this86._currentDistanceMeasurement.wireVisible=true;_this86._currentDistanceMeasurement.labelsVisible=true;}}_this86._touchState=WAITING_FOR_TARGET_LONG_TOUCH_END;break;}},{passive:true});canvas.addEventListener("touchend",this._onCanvasTouchEnd=function(event){if(!_this86._active){return;}_this86.pointerCircle.stop();var numChangedTouches=event.changedTouches.length;if(numChangedTouches!==1){return;}var touch=event.changedTouches[0];var touchX=touch.clientX;var touchY=touch.clientY;if(touch.identifier!==touchId){return;}if(longTouchTimeout){clearTimeout(longTouchTimeout);longTouchTimeout=null;}touchEndCanvasPos.set([touchX,touchY]);switch(_this86._touchState){//等待起点短按
|
|
19845
|
+
case WAITING_FOR_ORIGIN_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;return;}var pickResult=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(pickResult&&pickResult.worldPos){_this86._currentDistanceMeasurement=plugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pickResult.worldPos,entity:pickResult.entity},target:{worldPos:pickResult.worldPos,entity:pickResult.entity},precision:plugin.precision});_this86._currentDistanceMeasurement.labelsVisible=false;_this86._currentDistanceMeasurement.xAxisVisible=false;_this86._currentDistanceMeasurement.yAxisVisible=false;_this86._currentDistanceMeasurement.zAxisVisible=false;_this86._currentDistanceMeasurement.wireVisible=false;_this86._currentDistanceMeasurement.originVisible=true;_this86._currentDistanceMeasurement.targetVisible=false;// this._currentDistanceMeasurement.clickable = false;
|
|
19846
|
+
_this86._touchState=WAITING_FOR_TARGET_TOUCH_START;_this86.distanceMeasurementsPlugin.fire("measurementStart",_this86._currentDistanceMeasurement);// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19847
|
+
}else{if(_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement.destroy();}_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19839
19848
|
}}enableCameraNavigation();break;//起点长按
|
|
19840
|
-
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(
|
|
19841
|
-
}else{
|
|
19849
|
+
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:if(_this86.pointerLens){_this86.pointerLens.visible=false;}if(!_this86._currentDistanceMeasurement){if(_this86.pointerLens){_this86.pointerLens.snapped=false;_this86.pointerLens.visible=false;}_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (no measurement) -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19850
|
+
}else{_this86._touchState=WAITING_FOR_TARGET_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
19842
19851
|
}enableCameraNavigation();break;//终点短按
|
|
19843
|
-
case WAITING_FOR_TARGET_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){
|
|
19852
|
+
case WAITING_FOR_TARGET_QUICK_TOUCH_END:{if(numChangedTouches!==1||touchX>touchStartCanvasPos[0]+touchTolerance||touchX<touchStartCanvasPos[0]-touchTolerance||touchY>touchStartCanvasPos[1]+touchTolerance||touchY<touchStartCanvasPos[1]-touchTolerance){_this86._touchState=WAITING_FOR_TARGET_TOUCH_START;return;}var _pickResult7=scene.pick({canvasPos:touchMoveCanvasPos,pickSurface:true});if(_pickResult7&&_pickResult7.worldPos){_this86._currentDistanceMeasurement.target.worldPos=_pickResult7.worldPos;_this86._currentDistanceMeasurement.target.entity=_pickResult7.entity;_this86._currentDistanceMeasurement.targetVisible=true;_this86._currentDistanceMeasurement.wireVisible=true;_this86._currentDistanceMeasurement.labelsVisible=true;_this86._currentDistanceMeasurement.clickable=true;_this86.distanceMeasurementsPlugin.fire("measurementEnd",_this86._currentDistanceMeasurement);_this86._currentDistanceMeasurement=null;}else{if(_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement.destroy();_this86._currentDistanceMeasurement=null;}}_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19844
19853
|
}enableCameraNavigation();break;//终点长按
|
|
19845
|
-
case WAITING_FOR_TARGET_LONG_TOUCH_END:if(
|
|
19846
|
-
}else{
|
|
19854
|
+
case WAITING_FOR_TARGET_LONG_TOUCH_END:if(_this86.pointerLens){_this86.pointerLens.visible=false;}if(!_this86._currentDistanceMeasurement||!_this86._currentDistanceMeasurement.targetVisible){if(_this86._currentDistanceMeasurement){_this86._currentDistanceMeasurement.destroy();_this86._currentDistanceMeasurement=null;}_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END (no target found) -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19855
|
+
}else{_this86._currentDistanceMeasurement.clickable=true;_this86.distanceMeasurementsPlugin.fire("measurementEnd",_this86._currentDistanceMeasurement);_this86._currentDistanceMeasurement=null;_this86._touchState=WAITING_FOR_ORIGIN_TOUCH_START;// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
19847
19856
|
}enableCameraNavigation();break;}},{passive:true});canvas.addEventListener("touchcancel",this._onCanvasTouchEnd);this._activate=true;}/**
|
|
19848
19857
|
* Deactivates this DistanceMeasurementsTouchControl, making it unresponsive to input.
|
|
19849
19858
|
*
|
|
@@ -20178,7 +20187,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
|
|
|
20178
20187
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Curve}, generated automatically when omitted.
|
|
20179
20188
|
* @param {Object} [cfg] Configs for this Curve.
|
|
20180
20189
|
* @param {Number} [cfg.t=0] Current position on this Curve, in range between ````0..1````.
|
|
20181
|
-
*/function Curve(owner){var
|
|
20190
|
+
*/function Curve(owner){var _this87;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Curve);_this87=_callSuper(this,Curve,[owner,cfg]);_this87.t=cfg.t;return _this87;}/**
|
|
20182
20191
|
* Sets the progress along this Curve.
|
|
20183
20192
|
*
|
|
20184
20193
|
* Automatically clamps to range ````[0..1]````.
|
|
@@ -20233,7 +20242,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
20233
20242
|
* @param {Array} [cfg.points=[]] Control points on this SplineCurve.
|
|
20234
20243
|
* @param {Number} [cfg.t=0] Current position on this SplineCurve, in range between 0..1.
|
|
20235
20244
|
* @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
|
|
20236
|
-
*/function SplineCurve(owner){var
|
|
20245
|
+
*/function SplineCurve(owner){var _this88;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SplineCurve);_this88=_callSuper(this,SplineCurve,[owner,cfg]);_this88.points=cfg.points;_this88.t=cfg.t;return _this88;}/**
|
|
20237
20246
|
* Sets the control points on this SplineCurve.
|
|
20238
20247
|
*
|
|
20239
20248
|
* Default value is ````[]````.
|
|
@@ -20280,7 +20289,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
20280
20289
|
* @param [cfg] {*} Configuration
|
|
20281
20290
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
20282
20291
|
* @param {{t:Number, eye:Object, look:Object, up: Object}[]} [cfg.frames] Initial sequence of frames.
|
|
20283
|
-
*/function CameraPath(owner){var
|
|
20292
|
+
*/function CameraPath(owner){var _this89;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPath);_this89=_callSuper(this,CameraPath,[owner,cfg]);_this89._frames=[];_this89._eyeCurve=new SplineCurve(_this89);_this89._lookCurve=new SplineCurve(_this89);_this89._upCurve=new SplineCurve(_this89);if(cfg.frames){_this89.addFrames(cfg.frames);_this89.smoothFrameTimes(1);}return _this89;}/**
|
|
20284
20293
|
* Gets the camera frames in this CameraPath.
|
|
20285
20294
|
*
|
|
20286
20295
|
* @returns {{t:Number, eye:Object, look:Object, up: Object}[]} The frames on this CameraPath.
|
|
@@ -20425,7 +20434,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
20425
20434
|
*/var CameraFlightAnimation=/*#__PURE__*/function(_Component33){/**
|
|
20426
20435
|
@constructor
|
|
20427
20436
|
@private
|
|
20428
|
-
*/function CameraFlightAnimation(owner){var
|
|
20437
|
+
*/function CameraFlightAnimation(owner){var _this90;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraFlightAnimation);_this90=_callSuper(this,CameraFlightAnimation,[owner,cfg]);_this90._look1=math.vec3();_this90._eye1=math.vec3();_this90._up1=math.vec3();_this90._look2=math.vec3();_this90._eye2=math.vec3();_this90._up2=math.vec3();_this90._orthoScale1=1;_this90._orthoScale2=1;_this90._flying=false;_this90._flyEyeLookUp=false;_this90._flyingEye=false;_this90._flyingLook=false;_this90._callback=null;_this90._callbackScope=null;_this90._time1=null;_this90._time2=null;_this90.easing=cfg.easing!==false;_this90.duration=cfg.duration;_this90.fit=cfg.fit;_this90.fitFOV=cfg.fitFOV;_this90.trail=cfg.trail;return _this90;}/**
|
|
20429
20438
|
* Flies the {@link Camera} to a target.
|
|
20430
20439
|
*
|
|
20431
20440
|
* * When the target is a boundary, the {@link Camera} will fly towards the target and stop when the target fills most of the canvas.
|
|
@@ -20620,7 +20629,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
|
|
|
20620
20629
|
* @param {*} [cfg] Configuration
|
|
20621
20630
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
20622
20631
|
* @param {CameraPath} [cfg.eyeCurve] A {@link CameraPath} that defines the path of a {@link Camera}.
|
|
20623
|
-
*/function CameraPathAnimation(owner){var
|
|
20632
|
+
*/function CameraPathAnimation(owner){var _this91;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraPathAnimation);_this91=_callSuper(this,CameraPathAnimation,[owner,cfg]);_this91._cameraFlightAnimation=new CameraFlightAnimation(_this91);_this91._t=0;_this91.state=CameraPathAnimation.SCRUBBING;_this91._playingFromT=0;_this91._playingToT=0;_this91._playingRate=cfg.playingRate||1.0;_this91._playingDir=1.0;_this91._lastTime=null;_this91.cameraPath=cfg.cameraPath;_this91._tick=_this91.scene.on("tick",_this91._updateT,_this91);return _this91;}_inherits(CameraPathAnimation,_Component34);return _createClass(CameraPathAnimation,[{key:"type",get:/**
|
|
20624
20633
|
* Returns "CameraPathAnimation".
|
|
20625
20634
|
*
|
|
20626
20635
|
* @private
|
|
@@ -20801,7 +20810,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
|
|
|
20801
20810
|
* @param {Number} [cfg.opacity=1.0] ````ImagePlane````'s initial opacity factor, multiplies by the rendered fragment alpha.
|
|
20802
20811
|
* @param {String} [cfg.src] URL of image. Accepted file types are PNG and JPEG.
|
|
20803
20812
|
* @param {HTMLImageElement} [cfg.image] An ````HTMLImageElement```` to source the image from. Overrides ````src````.
|
|
20804
|
-
*/function ImagePlane(owner){var
|
|
20813
|
+
*/function ImagePlane(owner){var _this92;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ImagePlane);_this92=_callSuper(this,ImagePlane,[owner,cfg]);_this92._src=null;_this92._image=null;_this92._pos=math.vec3();_this92._origin=math.vec3();_this92._rtcPos=math.vec3();_this92._dir=math.vec3();_this92._size=1.0;_this92._imageSize=math.vec2();_this92._texture=new Texture(_this92);_this92._plane=new Mesh(_this92,{geometry:new ReadableGeometry(_this92,buildPlaneGeometry({center:[0,0,0],xSize:1,zSize:1,xSegments:10,zSegments:10})),material:new PhongMaterial(_this92,{diffuse:[0,0,0],ambient:[0,0,0],specular:[0,0,0],diffuseMap:_this92._texture,emissiveMap:_this92._texture,backfaces:true}),clippable:cfg.clippable});_this92._grid=new Mesh(_this92,{geometry:new ReadableGeometry(_this92,buildGridGeometry({size:1,divisions:10})),material:new PhongMaterial(_this92,{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});_this92._node=new Node$1(_this92,{rotation:[0,0,0],position:[0,0,0],scale:[1,1,1],clippable:false,children:[_this92._plane,_this92._grid]});_this92._gridVisible=false;_this92.visible=true;_this92.gridVisible=cfg.gridVisible;_this92.position=cfg.position;_this92.rotation=cfg.rotation;_this92.dir=cfg.dir;_this92.size=cfg.size;_this92.collidable=cfg.collidable;_this92.clippable=cfg.clippable;_this92.pickable=cfg.pickable;_this92.opacity=cfg.opacity;if(cfg.image){_this92.image=cfg.image;}else{_this92.src=cfg.src;}return _this92;}/**
|
|
20805
20814
|
* Sets if this ````ImagePlane```` is visible or not.
|
|
20806
20815
|
*
|
|
20807
20816
|
* Default value is ````true````.
|
|
@@ -20859,7 +20868,7 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
|
|
|
20859
20868
|
* Default value is ````[0, 0, 0]````.
|
|
20860
20869
|
*
|
|
20861
20870
|
* @param {Number[]} value New position.
|
|
20862
|
-
*/,set:function set(src){var
|
|
20871
|
+
*/,set:function set(src){var _this93=this;this._src=src;if(this._src){this._image=null;var _image4=new Image();_image4.onload=function(){_this93._texture.image=_image4;_this93._imageSize[0]=_image4.width;_this93._imageSize[1]=_image4.height;_this93._updatePlaneSizeFromImage();};_image4.src=this._src;}}},{key:"position",get:/**
|
|
20863
20872
|
* Gets the World-space position of this ````ImagePlane````.
|
|
20864
20873
|
*
|
|
20865
20874
|
* Default value is ````[0, 0, 0]````.
|
|
@@ -21055,9 +21064,9 @@ t/=d;return-c*t*(t-2)+b;}},{key:"_easeInCubic",value:function _easeInCubic(t,b,c
|
|
|
21055
21064
|
* @param {Number} [cfg.quadraticAttenuation=0]Quadratic attenuation factor.
|
|
21056
21065
|
* @param {String} [cfg.space="view"]The coordinate system this PointLight is defined in - "view" or "world".
|
|
21057
21066
|
* @param {Boolean} [cfg.castsShadow=false] Flag which indicates if this PointLight casts a castsShadow.
|
|
21058
|
-
*/function PointLight(owner){var
|
|
21067
|
+
*/function PointLight(owner){var _this94;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,PointLight);_this94=_callSuper(this,PointLight,[owner,cfg]);var self=_this94;_this94._shadowRenderBuf=null;_this94._shadowViewMatrix=null;_this94._shadowProjMatrix=null;_this94._shadowViewMatrixDirty=true;_this94._shadowProjMatrixDirty=true;var camera=_this94.scene.camera;var canvas=_this94.scene.canvas;_this94._onCameraViewMatrix=camera.on("viewMatrix",function(){_this94._shadowViewMatrixDirty=true;});_this94._onCameraProjMatrix=camera.on("projMatrix",function(){_this94._shadowProjMatrixDirty=true;});_this94._onCanvasBoundary=canvas.on("boundary",function(){_this94._shadowProjMatrixDirty=true;});_this94._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
|
|
21059
21068
|
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
|
|
21060
|
-
}return self._shadowRenderBuf;}});
|
|
21069
|
+
}return self._shadowRenderBuf;}});_this94.pos=cfg.pos;_this94.color=cfg.color;_this94.intensity=cfg.intensity;_this94.constantAttenuation=cfg.constantAttenuation;_this94.linearAttenuation=cfg.linearAttenuation;_this94.quadraticAttenuation=cfg.quadraticAttenuation;_this94.castsShadow=cfg.castsShadow;_this94.scene._lightCreated(_this94);return _this94;}/**
|
|
21061
21070
|
* Sets the position of this PointLight.
|
|
21062
21071
|
*
|
|
21063
21072
|
* This will be either World- or View-space, depending on the value of {@link PointLight#space}.
|
|
@@ -21159,7 +21168,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
|
|
|
21159
21168
|
* @param {String[]} [cfg.src=null] Paths to six image files to load into this CubeTexture.
|
|
21160
21169
|
* @param {Boolean} [cfg.flipY=false] Flips this CubeTexture's source data along its vertical axis when true.
|
|
21161
21170
|
* @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
|
|
21162
|
-
*/function CubeTexture(owner){var
|
|
21171
|
+
*/function CubeTexture(owner){var _this95;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubeTexture);_this95=_callSuper(this,CubeTexture,[owner,cfg]);var gl=_this95.scene.canvas.gl;_this95._state=new RenderState({texture:new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP}),flipY:_this95._checkFlipY(cfg.minFilter),encoding:_this95._checkEncoding(cfg.encoding),minFilter:LinearMipmapLinearFilter,magFilter:LinearFilter,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping,mipmaps:true});_this95._src=cfg.src;_this95._images=[];_this95._loadSrc(cfg.src);stats.memory.textures++;return _this95;}_inherits(CubeTexture,_Component36);return _createClass(CubeTexture,[{key:"type",get:/**
|
|
21163
21172
|
@private
|
|
21164
21173
|
*/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) {
|
|
21165
21174
|
// this._state.texture = new xeokit.renderer.Texture2D(gl, gl.TEXTURE_CUBE_MAP);
|
|
@@ -21219,7 +21228,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
|
|
|
21219
21228
|
* @param {String[]} [cfg.src=null] Paths to six image files to load into this ReflectionMap.
|
|
21220
21229
|
* @param {Boolean} [cfg.flipY=false] Flips this ReflectionMap's source data along its vertical axis when true.
|
|
21221
21230
|
* @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
|
|
21222
|
-
*/function ReflectionMap(owner){var
|
|
21231
|
+
*/function ReflectionMap(owner){var _this96;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ReflectionMap);_this96=_callSuper(this,ReflectionMap,[owner,cfg]);_this96.scene._lightsState.addReflectionMap(_this96._state);_this96.scene._reflectionMapCreated(_this96);return _this96;}/**
|
|
21223
21232
|
* Destroys this ReflectionMap.
|
|
21224
21233
|
*/_inherits(ReflectionMap,_CubeTexture);return _createClass(ReflectionMap,[{key:"type",get:/**
|
|
21225
21234
|
@private
|
|
@@ -21275,7 +21284,7 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
|
|
|
21275
21284
|
* @param {String[]} [cfg.src=null] Paths to six image files to load into this LightMap.
|
|
21276
21285
|
* @param {Boolean} [cfg.flipY=false] Flips this LightMap's source data along its vertical axis when true.
|
|
21277
21286
|
* @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
|
|
21278
|
-
*/function LightMap(owner){var
|
|
21287
|
+
*/function LightMap(owner){var _this97;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LightMap);_this97=_callSuper(this,LightMap,[owner,cfg]);_this97.scene._lightMapCreated(_this97);return _this97;}_inherits(LightMap,_CubeTexture2);return _createClass(LightMap,[{key:"type",get:/**
|
|
21279
21288
|
@private
|
|
21280
21289
|
*/function get(){return"LightMap";}},{key:"destroy",value:function destroy(){_superPropGet(LightMap,"destroy",this,3)([]);this.scene._lightMapDestroyed(this);}}]);}(CubeTexture);/**
|
|
21281
21290
|
* A {@link Marker} with a billboarded and textured quad attached to it.
|
|
@@ -21328,10 +21337,10 @@ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadS
|
|
|
21328
21337
|
* @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this SpriteMarker. See the {@link SpriteMarker#image} property for more info.
|
|
21329
21338
|
* @param {Boolean} [cfg.flipY=false] Flips this SpriteMarker's texture image along its vertical axis when true.
|
|
21330
21339
|
* @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
21331
|
-
*/function SpriteMarker(owner){var
|
|
21332
|
-
});
|
|
21340
|
+
*/function SpriteMarker(owner){var _this98;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SpriteMarker);_this98=_callSuper(this,SpriteMarker,[owner,{entity:cfg.entity,occludable:cfg.occludable,worldPos:cfg.worldPos}]);_this98._occluded=false;_this98._visible=true;_this98._src=null;_this98._image=null;_this98._pos=math.vec3();_this98._origin=math.vec3();_this98._rtcPos=math.vec3();_this98._dir=math.vec3();_this98._size=1.0;_this98._imageSize=math.vec2();_this98._texture=new Texture(_this98,{src:cfg.src});_this98._geometry=new ReadableGeometry(_this98,{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
|
|
21341
|
+
});_this98._mesh=new Mesh(_this98,{geometry:_this98._geometry,material:new PhongMaterial(_this98,{ambient:[0.9,0.3,0.9],shininess:30,diffuseMap:_this98._texture,backfaces:true}),scale:[1,1,1],// Note: by design, scale does not work with billboard
|
|
21333
21342
|
position:cfg.worldPos,rotation:[90,0,0],billboard:"spherical",occluder:false// Don't occlude SpriteMarkers or Annotations
|
|
21334
|
-
});
|
|
21343
|
+
});_this98.visible=true;_this98.collidable=cfg.collidable;_this98.clippable=cfg.clippable;_this98.pickable=cfg.pickable;_this98.opacity=cfg.opacity;_this98.size=cfg.size;if(cfg.image){_this98.image=cfg.image;}else{_this98.src=cfg.src;}return _this98;}_inherits(SpriteMarker,_Marker2);return _createClass(SpriteMarker,[{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
|
|
21335
21344
|
this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_superPropGet(SpriteMarker,"_setVisible",this,3)([visible]);}/**
|
|
21336
21345
|
* Sets if this ````SpriteMarker```` is visible or not.
|
|
21337
21346
|
*
|
|
@@ -21379,7 +21388,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
21379
21388
|
* Default value is ````1.0````.
|
|
21380
21389
|
*
|
|
21381
21390
|
* @param {Number} size New World-space size of the ````SpriteMarker````.
|
|
21382
|
-
*/,set:function set(src){var
|
|
21391
|
+
*/,set:function set(src){var _this99=this;this._src=src;if(this._src){this._image=null;var _image5=new Image();_image5.onload=function(){_this99._texture.image=_image5;_this99._imageSize[0]=_image5.width;_this99._imageSize[1]=_image5.height;_this99._updatePlaneSizeFromImage();};_image5.src=this._src;}}},{key:"size",get:/**
|
|
21383
21392
|
* Gets the World-space size of the longest edge of the ````SpriteMarker````.
|
|
21384
21393
|
*
|
|
21385
21394
|
* Returns {Number} World-space size of the ````SpriteMarker````.
|
|
@@ -21703,7 +21712,7 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
21703
21712
|
* @param {Number[]} [cfg.v2=[0,0,0]] The middle control point.
|
|
21704
21713
|
* @param {Number[]} [cfg.v3=[0,0,0]] The ending point.
|
|
21705
21714
|
* @param {Number} [cfg.t=0] Current position on this CubicBezierCurve, in range between 0..1.
|
|
21706
|
-
*/function CubicBezierCurve(owner){var
|
|
21715
|
+
*/function CubicBezierCurve(owner){var _this100;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CubicBezierCurve);_this100=_callSuper(this,CubicBezierCurve,[owner,cfg]);_this100.v0=cfg.v0;_this100.v1=cfg.v1;_this100.v2=cfg.v2;_this100.v3=cfg.v3;_this100.t=cfg.t;return _this100;}/**
|
|
21707
21716
|
* Sets the starting point on this CubicBezierCurve.
|
|
21708
21717
|
*
|
|
21709
21718
|
* Default value is ````[0.0, 0.0, 0.0]````
|
|
@@ -21792,12 +21801,12 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
21792
21801
|
* @param {String} [cfg.id] Optional ID, unique among all components in the parent {@link Scene}, generated automatically when omitted.
|
|
21793
21802
|
* @param {String []} [cfg.paths=[]] IDs or instances of {{#crossLink "path"}}{{/crossLink}} subtypes to add to this Path.
|
|
21794
21803
|
* @param {Number} [cfg.t=0] Current position on this Path, in range between 0..1.
|
|
21795
|
-
*/function Path(owner){var
|
|
21796
|
-
|
|
21797
|
-
|
|
21798
|
-
|
|
21799
|
-
|
|
21800
|
-
return
|
|
21804
|
+
*/function Path(owner){var _this101;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Path);_this101=_callSuper(this,Path,[owner,cfg]);_this101._cachedLengths=[];_this101._dirty=true;_this101._curves=[];// Array of child Curve components
|
|
21805
|
+
_this101._t=0;_this101._dirtySubs=[];// Subscriptions to "dirty" events from child Curve components
|
|
21806
|
+
_this101._destroyedSubs=[];// Subscriptions to "destroyed" events from child Curve components
|
|
21807
|
+
_this101.curves=cfg.curves||[];// Add initial curves
|
|
21808
|
+
_this101.t=cfg.t;// Set initial progress
|
|
21809
|
+
return _this101;}/**
|
|
21801
21810
|
* Adds a {@link Curve} to this Path.
|
|
21802
21811
|
*
|
|
21803
21812
|
* @param {Curve} curve The {@link Curve} to add.
|
|
@@ -21862,7 +21871,7 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
|
|
|
21862
21871
|
* @param {Number[]} [cfg.v1=[0,0,0]] The middle control point.
|
|
21863
21872
|
* @param {Number[]} [cfg.v2=[0,0,0]] The end point.
|
|
21864
21873
|
* @param {Number[]} [cfg.t=0] Current position on this QuadraticBezierCurve, in range between ````0..1````.
|
|
21865
|
-
*/function QuadraticBezierCurve(owner){var
|
|
21874
|
+
*/function QuadraticBezierCurve(owner){var _this102;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,QuadraticBezierCurve);_this102=_callSuper(this,QuadraticBezierCurve,[owner,cfg]);_this102.v0=cfg.v0;_this102.v1=cfg.v1;_this102.v2=cfg.v2;_this102.t=cfg.t;return _this102;}/**
|
|
21866
21875
|
* Sets the starting point on this QuadraticBezierCurve.
|
|
21867
21876
|
*
|
|
21868
21877
|
* Default value is ````[0.0, 0.0, 0.0]````.
|
|
@@ -21946,13 +21955,13 @@ var id=curve;curve=this.scene.components[id];if(!curve){this.error("Component no
|
|
|
21946
21955
|
* @param {Boolean} [cfg.active=true] Indicates whether or not this SectionBox is active.
|
|
21947
21956
|
* @param {Number[]} [cfg.pos=[0,0,0]] World-space position of the SectionBox.
|
|
21948
21957
|
* @param {Number[]} [cfg.dir=[0,0,-1]] Vector perpendicular to the plane surface, indicating the SectionBox plane orientation.
|
|
21949
|
-
*/function SectionBox(owner){var
|
|
21958
|
+
*/function SectionBox(owner){var _this103;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionBox);_this103=_callSuper(this,SectionBox,[owner,cfg]);_this103._state=new RenderState({active:true,pos:math.vec3(),dir:math.vec3(),dist:0});_this103.active=cfg.active?cfg.active:true;_this103.pickable=cfg.pickable?cfg.pickable:false;_this103.enableClip=cfg.enableClip?cfg.enableClip:true;_this103.controlIdName=cfg.controlIdName?cfg.controlIdName:"";_this103.lineBox=cfg.lineBox?cfg.lineBox:null;_this103.visible=false;_this103.planes=[];_this103.boxRanges=[];_this103.scene._sectionBoxCreated(_this103);_this103._initBoxPlanes();return _this103;}_inherits(SectionBox,_Component37);return _createClass(SectionBox,[{key:"type",get:/**
|
|
21950
21959
|
@private
|
|
21951
|
-
*/function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var
|
|
21960
|
+
*/function get(){return"SectionBox";}},{key:"_initBoxPlanes",value:function _initBoxPlanes(){var _this104=this;var self=this;var aabb=this.scene.aabb;var center=this.scene.center;var xRange=aabb[3]-aabb[0];//前后
|
|
21952
21961
|
var yRange=aabb[4]-aabb[1];//上下
|
|
21953
21962
|
var zRange=aabb[5]-aabb[2];//左右
|
|
21954
21963
|
// let offset = 0.21;
|
|
21955
|
-
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(_i465){
|
|
21964
|
+
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(_i465){_this104.boxRanges.push(getPos(_i465));var dir=getDir(_i465);var sectionPlane=new SectionPlane(_this104.scene,{active:_this104.active,controlId:_this104.controlIdName+_i465.toString(),planeId:_i465,box:self,dir:dir,pos:getPos(_i465),enableClip:_this104.enableClip,pickable:_this104.pickable});_this104.planes.push(sectionPlane);if(_i465==5){_this104.lineBox._maxRange=_this104.boxRanges;}sectionPlane.on("pos",function(pos){if(pos==_this104.boxRanges[_i465])return;if(_this104.boxRanges.length<6)return;_this104.lineBox.updateBox(sectionPlane.dir,_this104.boxRanges);});};for(var _i465=0;_i465<6;_i465++){_loop2(_i465);}}/**
|
|
21956
21965
|
* Sets if this SectionBox is active or not.
|
|
21957
21966
|
*
|
|
21958
21967
|
* Default value is ````true````.
|
|
@@ -21986,7 +21995,7 @@ var offset=0;function getPos(num){var rateDis;switch(num){case 0:rateDis=1*xRang
|
|
|
21986
21995
|
* @param {String} [cfg.encoding="linear"] Texture encoding format. See the {@link Texture#encoding} property for more info.
|
|
21987
21996
|
* @param {Number} [cfg.size=1000] Size of this Skybox, given as the distance from the center at ````[0,0,0]```` to each face.
|
|
21988
21997
|
* @param {Boolean} [cfg.active=true] True when this Skybox is visible.
|
|
21989
|
-
*/function Skybox(owner){var
|
|
21998
|
+
*/function Skybox(owner){var _this105;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Skybox);_this105=_callSuper(this,Skybox,[owner,cfg]);_this105._skyboxMesh=new Mesh(_this105,{geometry:new ReadableGeometry(_this105,{// Box-shaped geometry
|
|
21990
21999
|
primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 front
|
|
21991
22000
|
1,1,1,1,-1,1,1,-1,-1,1,1,-1,// v0-v3-v4-v5 right
|
|
21992
22001
|
1,1,1,1,1,-1,-1,1,-1,-1,1,1,// v0-v5-v6-v1 top
|
|
@@ -21994,10 +22003,10 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
|
|
|
21994
22003
|
-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
|
|
21995
22004
|
1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
|
|
21996
22005
|
],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
|
|
21997
|
-
rotation:[0,-90,0],material:new PhongMaterial(
|
|
22006
|
+
rotation:[0,-90,0],material:new PhongMaterial(_this105,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this105,{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
|
|
21998
22007
|
}),// stationary: true,
|
|
21999
|
-
visible:false,pickable:false,clippable:false,collidable:false});
|
|
22000
|
-
|
|
22008
|
+
visible:false,pickable:false,clippable:false,collidable:false});_this105.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
|
|
22009
|
+
_this105.active=cfg.active;return _this105;}/**
|
|
22001
22010
|
* Sets the size of this Skybox, given as the distance from the center at [0,0,0] to each face.
|
|
22002
22011
|
*
|
|
22003
22012
|
* Default value is ````1000````.
|
|
@@ -22062,10 +22071,10 @@ var eyeTargetVec=math.subVec3(optionalTargetWorldPos,camera.eye,tempVec3a$4);var
|
|
|
22062
22071
|
var worldPos1=this._unproject(targetCanvasPos,tempVec4a$2);camera.ortho.scale=camera.ortho.scale-dollyDelta;camera.ortho._update();// HACK
|
|
22063
22072
|
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(){/**
|
|
22064
22073
|
* @private
|
|
22065
|
-
*/function PivotController(scene,configs){var
|
|
22074
|
+
*/function PivotController(scene,configs){var _this106=this;_classCallCheck(this,PivotController);// Pivot math by: http://www.derschmale.com/
|
|
22066
22075
|
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
|
|
22067
22076
|
this._pivoting=false;// True while pivoting
|
|
22068
|
-
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(){
|
|
22077
|
+
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(){_this106._cameraDirty=true;});this._onProjMatrix=this._scene.camera.on("projMatrix",function(){_this106._cameraDirty=true;});this._onTick=this._scene.on("tick",function(){_this106.updatePivotElement();_this106.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
|
|
22069
22078
|
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();}}}/**
|
|
22070
22079
|
* Sets the HTML DOM element that will represent the pivot position.
|
|
22071
22080
|
*
|
|
@@ -22166,41 +22175,41 @@ pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},t
|
|
|
22166
22175
|
*/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;// 点击键盘切换相机方向
|
|
22167
22176
|
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);}}]);}();/**
|
|
22168
22177
|
* @private
|
|
22169
|
-
*/var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var
|
|
22178
|
+
*/var MousePickHandler=/*#__PURE__*/function(){function MousePickHandler(scene,controllers,configs,states,updates){var _this107=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
|
|
22170
22179
|
var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({// look: pos,
|
|
22171
22180
|
// eye: xeokit.math.addVec3(pos, diff, []),
|
|
22172
22181
|
// up: camera.up,
|
|
22173
22182
|
aabb:aabb});// TODO: Option to back off to fit AABB in view
|
|
22174
22183
|
}else{// Fly to fit target boundary in view
|
|
22175
|
-
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(
|
|
22176
|
-
entity:scene.objects[
|
|
22177
|
-
|
|
22178
|
-
cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(
|
|
22179
|
-
entity:scene.objects[
|
|
22184
|
+
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(_this107._lastPickedEntityId!==pickedEntityId){if(_this107._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
|
|
22185
|
+
entity:scene.objects[_this107._lastPickedEntityId]},true);}cameraControl.fire("hoverEnter",pickController.pickResult,true);// Hovering over a new entity
|
|
22186
|
+
_this107._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
|
|
22187
|
+
cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this107._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
|
|
22188
|
+
entity:scene.objects[_this107._lastPickedEntityId]},true);_this107._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
|
|
22180
22189
|
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) {
|
|
22181
22190
|
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
|
|
22182
22191
|
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) {
|
|
22183
22192
|
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(e.which===1){// Left button
|
|
22184
22193
|
var pickResult=pickController.pickResult;if(pickResult&&pickResult.worldPos){pivotController.setCanvasPivotPos(states.pointerCanvasPos);// pivotController.startPivot(); // 显示pivot
|
|
22185
|
-
cameraControl.fire("mouseDownEntity",pickController.pickResult,true);
|
|
22194
|
+
cameraControl.fire("mouseDownEntity",pickController.pickResult,true);_this107._lastClickedWorldPos=pickResult.worldPos;}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{if(_this107._lastClickedWorldPos){pivotController.setPivotPos(_this107._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
|
|
22186
22195
|
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
|
|
22187
|
-
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);}}
|
|
22188
|
-
return;}
|
|
22189
|
-
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;
|
|
22190
|
-
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);}
|
|
22191
|
-
if(
|
|
22196
|
+
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);}}_this107._clicks=0;// clickedEntity = null;
|
|
22197
|
+
return;}_this107._clicks++;if(_this107._clicks===1){// First click
|
|
22198
|
+
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this107._timeout=setTimeout(function(){if(firstClickPickResult&&firstClickPickResult.worldPos){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);// if (configs.followPointer) {
|
|
22199
|
+
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);}_this107._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
|
|
22200
|
+
if(_this107._timeout!==null){window.clearTimeout(_this107._timeout);_this107._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();}}}}_this107._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;}}}]);}();/**
|
|
22192
22201
|
* @private
|
|
22193
|
-
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var
|
|
22202
|
+
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this108=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;}});//碰撞停止
|
|
22194
22203
|
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;//-------------------------------------------------------------------------------------------------
|
|
22195
22204
|
// Keyboard rotation
|
|
22196
22205
|
//-------------------------------------------------------------------------------------------------
|
|
22197
|
-
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*
|
|
22206
|
+
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*_this108._movespeedList[_this108._movespeed];}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta*_this108._movespeedList[_this108._movespeed];}if(rotateXPos){updates.rotateDeltaX+=orbitDelta*_this108._movespeedList[_this108._movespeed];}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta*_this108._movespeedList[_this108._movespeed];}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
|
|
22198
22207
|
// Keyboard panning
|
|
22199
22208
|
//-------------------------------------------------------------------------------------------------
|
|
22200
|
-
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*
|
|
22201
|
-
var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(
|
|
22209
|
+
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*_this108._movespeedList[_this108._movespeed];}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this108._movespeedList[_this108._movespeed];}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
|
|
22210
|
+
var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this108._movespeed<_this108._movespeedList.length-1){_this108._movespeed+=1;}_this108._cameraControl.fire("personModeSpeedUp",_this108._movespeedList[_this108._movespeed]);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this108._movespeed>0){_this108._movespeed-=1;}_this108._cameraControl.fire("personModeSpeedDown",_this108._movespeedList[_this108._movespeed]);enableSetSpeedDown=false;}}//判断是否能用
|
|
22202
22211
|
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
|
|
22203
|
-
var panDelta=
|
|
22212
|
+
var panDelta=_this108._movespeedList[_this108._movespeed]*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
|
|
22204
22213
|
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
|
|
22205
22214
|
var EPSILON=0.001;var tempVec3$1=math.vec3();/**
|
|
22206
22215
|
* Handles camera updates on each "tick" that were scheduled by the various controllers.
|
|
@@ -22239,11 +22248,11 @@ if(Math.abs(updates.panDeltaX)<EPSILON*dynamicEPSILON){updates.panDeltaX=0;}if(M
|
|
|
22239
22248
|
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
|
|
22240
22249
|
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);}}]);}();/**
|
|
22241
22250
|
* @private
|
|
22242
|
-
*/var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var
|
|
22251
|
+
*/var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){var _this109=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;_this109.canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,_this109.canvas,states.pointerCanvasPos);});this.canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,_this109.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
|
|
22243
22252
|
//因此暂时在此加判断
|
|
22244
22253
|
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;};/**
|
|
22245
22254
|
* @private
|
|
22246
|
-
*/var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var
|
|
22255
|
+
*/var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this110=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);
|
|
22247
22256
|
pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
22248
22257
|
}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i466=0,len=touches.length;_i466<len;++_i466){getCanvasPosFromEvent$1(touches[_i466],lastCanvasTouchPosList[_i466]);}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;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
|
|
22249
22258
|
return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
|
|
@@ -22254,7 +22263,7 @@ return;}if(numTouches===1){getCanvasPosFromEvent$1(touches[0],tapCanvasPos0);//-
|
|
|
22254
22263
|
//-----------------------------------------------------------------------------------------------
|
|
22255
22264
|
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
|
|
22256
22265
|
var camera=scene.camera;// We use only canvasHeight here so that aspect ratio does not distort speed
|
|
22257
|
-
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*
|
|
22266
|
+
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*_this110._panspeed;updates.panDeltaY+=yPanDelta*targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;}else{updates.panDeltaX+=0.5*camera.ortho.scale*(xPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;updates.panDeltaY+=0.5*camera.ortho.scale*(yPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;}}else{// if (!absorbTinyFirstDrag) {
|
|
22258
22267
|
updates.rotateDeltaY-=xPanDelta/canvasWidth*(configs.dragRotationRate*1.0);// Full horizontal rotation
|
|
22259
22268
|
updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// Half vertical rotation
|
|
22260
22269
|
// } else {
|
|
@@ -22269,8 +22278,8 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
|
|
|
22269
22278
|
// }
|
|
22270
22279
|
// }
|
|
22271
22280
|
}}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
|
|
22272
|
-
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*
|
|
22273
|
-
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*
|
|
22281
|
+
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*_this110._dollyspeed;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
|
|
22282
|
+
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*_this110._panspeed;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate*_this110._panspeed;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate*_this110._panspeed;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i467=0;_i467<numTouches;++_i467){getCanvasPosFromEvent$1(touches[_i467],lastCanvasTouchPosList[_i467]);}});}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;};/**
|
|
22274
22283
|
* @private
|
|
22275
22284
|
*/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
|
|
22276
22285
|
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
|
|
@@ -22751,81 +22760,81 @@ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=
|
|
|
22751
22760
|
*/var CameraControl=/*#__PURE__*/function(_Component39){/**
|
|
22752
22761
|
* @private
|
|
22753
22762
|
* @constructor
|
|
22754
|
-
*/function CameraControl(owner){var
|
|
22763
|
+
*/function CameraControl(owner){var _this111;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,CameraControl);_this111=_callSuper(this,CameraControl,[owner,cfg]);/**
|
|
22755
22764
|
* Identifies the XX action.
|
|
22756
22765
|
* @final
|
|
22757
22766
|
* @type {Number}
|
|
22758
|
-
*/
|
|
22767
|
+
*/_this111.PAN_LEFT=0;/**
|
|
22759
22768
|
* Identifies the XX action.
|
|
22760
22769
|
* @final
|
|
22761
22770
|
* @type {Number}
|
|
22762
|
-
*/
|
|
22771
|
+
*/_this111.PAN_RIGHT=1;/**
|
|
22763
22772
|
* Identifies the XX action.
|
|
22764
22773
|
* @final
|
|
22765
22774
|
* @type {Number}
|
|
22766
|
-
*/
|
|
22775
|
+
*/_this111.PAN_UP=2;/**
|
|
22767
22776
|
* Identifies the XX action.
|
|
22768
22777
|
* @final
|
|
22769
22778
|
* @type {Number}
|
|
22770
|
-
*/
|
|
22779
|
+
*/_this111.PAN_DOWN=3;/**
|
|
22771
22780
|
* Identifies the XX action.
|
|
22772
22781
|
* @final
|
|
22773
22782
|
* @type {Number}
|
|
22774
|
-
*/
|
|
22783
|
+
*/_this111.PAN_FORWARDS=4;/**
|
|
22775
22784
|
* Identifies the XX action.
|
|
22776
22785
|
* @final
|
|
22777
22786
|
* @type {Number}
|
|
22778
|
-
*/
|
|
22787
|
+
*/_this111.PAN_BACKWARDS=5;/**
|
|
22779
22788
|
* Identifies the XX action.
|
|
22780
22789
|
* @final
|
|
22781
22790
|
* @type {Number}
|
|
22782
|
-
*/
|
|
22791
|
+
*/_this111.ROTATE_X_POS=6;/**
|
|
22783
22792
|
* Identifies the XX action.
|
|
22784
22793
|
* @final
|
|
22785
22794
|
* @type {Number}
|
|
22786
|
-
*/
|
|
22795
|
+
*/_this111.ROTATE_X_NEG=7;/**
|
|
22787
22796
|
* Identifies the XX action.
|
|
22788
22797
|
* @final
|
|
22789
22798
|
* @type {Number}
|
|
22790
|
-
*/
|
|
22799
|
+
*/_this111.ROTATE_Y_POS=8;/**
|
|
22791
22800
|
* Identifies the XX action.
|
|
22792
22801
|
* @final
|
|
22793
22802
|
* @type {Number}
|
|
22794
|
-
*/
|
|
22803
|
+
*/_this111.ROTATE_Y_NEG=9;/**
|
|
22795
22804
|
* Identifies the XX action.
|
|
22796
22805
|
* @final
|
|
22797
22806
|
* @type {Number}
|
|
22798
|
-
*/
|
|
22807
|
+
*/_this111.DOLLY_FORWARDS=10;/**
|
|
22799
22808
|
* Identifies the XX action.
|
|
22800
22809
|
* @final
|
|
22801
22810
|
* @type {Number}
|
|
22802
|
-
*/
|
|
22811
|
+
*/_this111.DOLLY_BACKWARDS=11;/**
|
|
22803
22812
|
* Identifies the XX action.
|
|
22804
22813
|
* @final
|
|
22805
22814
|
* @type {Number}
|
|
22806
|
-
*/
|
|
22815
|
+
*/_this111.AXIS_VIEW_RIGHT=12;/**
|
|
22807
22816
|
* Identifies the XX action.
|
|
22808
22817
|
* @final
|
|
22809
22818
|
* @type {Number}
|
|
22810
|
-
*/
|
|
22819
|
+
*/_this111.AXIS_VIEW_BACK=13;/**
|
|
22811
22820
|
* Identifies the XX action.
|
|
22812
22821
|
* @final
|
|
22813
22822
|
* @type {Number}
|
|
22814
|
-
*/
|
|
22823
|
+
*/_this111.AXIS_VIEW_LEFT=14;/**
|
|
22815
22824
|
* Identifies the XX action.
|
|
22816
22825
|
* @final
|
|
22817
22826
|
* @type {Number}
|
|
22818
|
-
*/
|
|
22827
|
+
*/_this111.AXIS_VIEW_FRONT=15;/**
|
|
22819
22828
|
* Identifies the XX action.
|
|
22820
22829
|
* @final
|
|
22821
22830
|
* @type {Number}
|
|
22822
|
-
*/
|
|
22831
|
+
*/_this111.AXIS_VIEW_TOP=16;/**
|
|
22823
22832
|
* Identifies the XX action.
|
|
22824
22833
|
* @final
|
|
22825
22834
|
* @type {Number}
|
|
22826
|
-
*/
|
|
22827
|
-
|
|
22828
|
-
|
|
22835
|
+
*/_this111.AXIS_VIEW_BOTTOM=17;_this111.SPEED_UP=107;_this111.SPEED_DOWN=109;_this111._keyMap={};// Maps key codes to the above actions
|
|
22836
|
+
_this111.scene.canvas.canvas.oncontextmenu=function(e){e.preventDefault();};// User-settable CameraControl configurations
|
|
22837
|
+
_this111.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);_this111.mouseWheelDollyRate=mouseRate/maxV*100;}}if(maxV>50&&maxV<100){var keyRate=parseInt(maxV/20)*2;_this111.keyboardDollyRate=keyRate*15;_this111.keyboardPanRate=keyRate*1.5;}if(maxV>100&&maxV<600){var _keyRate=parseInt(maxV/50)*4;_this111.keyboardDollyRate=_keyRate*15;_this111.keyboardPanRate=_keyRate*1.5;}if(maxV>600){var _keyRate2=parseInt(maxV/100)*8;_this111.keyboardDollyRate=_keyRate2*15;_this111.keyboardPanRate=_keyRate2*1.5;}if(minV==0){var rate=parseInt((maxV+0.0001)/2*100000)/100000;_this111.mouseWheelDollyRate=rate*100;_this111.keyboardDollyRate=rate*10;_this111.keyboardPanRate=rate*1.0;return;}if((minV+maxV)/2<10){var _rate3=parseInt((maxV+minV)/2*10000)/10000/4;_this111.mouseWheelDollyRate=_rate3*100;_this111.keyboardDollyRate=_rate3*10;_this111.keyboardPanRate=_rate3*1.0;}if((minV+maxV)/2<0.1){var _rate4=parseInt((maxV+minV)/2*10000)/10000;_this111.mouseWheelDollyRate=_rate4*100;_this111.keyboardDollyRate=_rate4*10;_this111.keyboardPanRate=_rate4*1.0;}});_this111._configs={// Private
|
|
22829
22838
|
longTapTimeout:600,// Millisecs
|
|
22830
22839
|
longTapRadius:5,// Pixels
|
|
22831
22840
|
// General
|
|
@@ -22833,13 +22842,13 @@ active:true,keyboardLayout:"qwerty",navMode:"orbit",planView:false,firstPerson:f
|
|
|
22833
22842
|
dragRotationRate:360.0,keyboardRotationRate:90.0,rotationInertia:0.0,// Panning
|
|
22834
22843
|
keyboardPanRate:1.0,touchPanRate:1.0,panInertia:0.5,// Dollying
|
|
22835
22844
|
keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:0.2,dollyInertia:0,dollyProximityThreshold:30.0,dollyMinSpeed:0.04};// Current runtime state of the CameraControl
|
|
22836
|
-
|
|
22837
|
-
|
|
22838
|
-
var scene=
|
|
22839
|
-
|
|
22840
|
-
|
|
22841
|
-
|
|
22842
|
-
}else{
|
|
22845
|
+
_this111._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
|
|
22846
|
+
_this111._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
|
|
22847
|
+
var scene=_this111.scene;_this111._controllers={cameraControl:_this111,pickController:new PickController(_this111,_this111._configs),pivotController:new PivotController(scene,_this111._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this111,{duration:0.5})};// Input event handlers
|
|
22848
|
+
_this111._handlers=[new MouseMiscHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates),new TouchPanRotateAndDollyHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates,_this111),new MousePanRotateDollyHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates),new KeyboardAxisViewHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates),new MousePickHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates),new TouchPickHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates),new KeyboardPanRotateDollyHandler(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates,_this111)];// Applies scheduled updates to the Camera on each Scene "tick" event
|
|
22849
|
+
_this111._cameraUpdater=new CameraUpdater(_this111.scene,_this111._controllers,_this111._configs,_this111._states,_this111._updates);// Set initial user configurations
|
|
22850
|
+
_this111.navMode=cfg.navMode;if(cfg.planView){_this111.planView=cfg.planView;}_this111.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this111.keyboardLayout=cfg.keyboardLayout;// Deprecated
|
|
22851
|
+
}else{_this111.keyMap=cfg.keyMap;}_this111.doublePickFlyTo=cfg.doublePickFlyTo;_this111.panRightClick=cfg.panRightClick;_this111.active=cfg.active;_this111.followPointer=cfg.followPointer;_this111.rotationInertia=cfg.rotationInertia;_this111.keyboardPanRate=cfg.keyboardPanRate;_this111.touchPanRate=cfg.touchPanRate;_this111.keyboardRotationRate=cfg.keyboardRotationRate;_this111.dragRotationRate=cfg.dragRotationRate;_this111.touchDollyRate=cfg.touchDollyRate;_this111.dollyInertia=cfg.dollyInertia;_this111.dollyProximityThreshold=cfg.dollyProximityThreshold;_this111.dollyMinSpeed=cfg.dollyMinSpeed;_this111.panInertia=cfg.panInertia;_this111.pointerEnabled=true;_this111.keyboardDollyRate=cfg.keyboardDollyRate;_this111.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this111._moveRate=1;_this111.scene.on("tick",function(){if(!(_this111._goLeft||_this111._goRight||_this111._goUp||_this111._goDown||_this111._goForward||_this111._goBackward)){return;}if(_this111._goRight){_this111._updates.panDeltaX+=-0.1*_this111._moveRate;}else if(_this111._goLeft){_this111._updates.panDeltaX+=0.1*_this111._moveRate;}if(_this111._goUp){_this111._updates.panDeltaY+=0.1*_this111._moveRate;}else if(_this111._goDown){_this111._updates.panDeltaY+=-0.1*_this111._moveRate;}if(_this111._goForward){_this111._updates.panDeltaZ+=-0.1*_this111._moveRate;}else if(_this111._goBackward){_this111._updates.panDeltaZ+=+0.1*_this111._moveRate;}});return _this111;}/**
|
|
22843
22852
|
* 停止漫游
|
|
22844
22853
|
*/_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;}/**
|
|
22845
22854
|
* 设置触屏缩放速率
|
|
@@ -24181,7 +24190,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
24181
24190
|
* configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
|
|
24182
24191
|
* 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
|
|
24183
24192
|
* your expected usage.
|
|
24184
|
-
*/function Viewer(cfg){var
|
|
24193
|
+
*/function Viewer(cfg){var _this112=this;_classCallCheck(this,Viewer);this.container=cfg.viewerElement;/**
|
|
24185
24194
|
* The Viewer's current language setting.
|
|
24186
24195
|
* @property language
|
|
24187
24196
|
* @deprecated
|
|
@@ -24226,7 +24235,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
24226
24235
|
* @property cameraControl
|
|
24227
24236
|
* @type {CameraControl}
|
|
24228
24237
|
*/this.cameraControl=new CameraControl(this.scene,{// panToPointer: true,
|
|
24229
|
-
snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){
|
|
24238
|
+
snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary",function(event){_this112.cameraControl.updatePivotElement();});this._plugins=[];/**
|
|
24230
24239
|
* Subscriptions to events sent with {@link fire}.
|
|
24231
24240
|
* @private
|
|
24232
24241
|
*/this._eventSubs={};}/**
|
|
@@ -24347,7 +24356,7 @@ _scale6=_i490==0?snapshotCanvas.width/_containerElement.clientWidth:1;off=math.v
|
|
|
24347
24356
|
*/)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
|
|
24348
24357
|
* Destroys this Viewer.
|
|
24349
24358
|
*/},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
|
|
24350
|
-
if(plugins.length>0){for(var _i491=0,len=plugins.length;_i491<len;_i491++){var plugin=plugins[_i491];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$2=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 VERSION$8="3.4.14";function assert$4(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$1=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[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 _this112=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){_this112._resolve=resolve;_this112._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$4(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$4(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$4(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$4(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$4(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$1?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 _this113=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){_this113.onError(new Error('No data received'));}else{_this113.onMessage(event.data);}};worker.onerror=function(error){_this113.onError(_this113._getErrorFromErrorEvent(error));_this113.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this114=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){_this114.onMessage(data);});worker.on('error',function(error){_this114.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$1||typeof Worker$1!=='undefined'&&!isBrowser$1;}}]);}();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 _this115=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){_this115.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this115;});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$4(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$8;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}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$7="3.4.14";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(libraryUrl){var moduleName,options,_args5=arguments;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:moduleName=_args5.length>1&&_args5[1]!==undefined?_args5[1]:null;options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context12.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context12.abrupt("return",_context12.sent);case 7:case"end":return _context12.stop();}},_callee9);}));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$1){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$4(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$7,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x9){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:if(!libraryUrl.endsWith('wasm')){_context13.next=7;break;}_context13.next=3;return fetch(libraryUrl);case 3:_response=_context13.sent;_context13.next=6;return _response.arrayBuffer();case 6:return _context13.abrupt("return",_context13.sent);case 7:if(isBrowser$1){_context13.next=20;break;}_context13.prev=8;_context13.t0=node&&requireFromFile;if(!_context13.t0){_context13.next=14;break;}_context13.next=13;return requireFromFile(libraryUrl);case 13:_context13.t0=_context13.sent;case 14:return _context13.abrupt("return",_context13.t0);case 17:_context13.prev=17;_context13.t1=_context13["catch"](8);return _context13.abrupt("return",null);case 20:if(!isWorker){_context13.next=22;break;}return _context13.abrupt("return",importScripts(libraryUrl));case 22:_context13.next=24;return fetch(libraryUrl);case 24:response=_context13.sent;_context13.next=27;return response.text();case 27:scriptSource=_context13.sent;return _context13.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context13.stop();}},_callee10,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$1){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;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$1&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x10,_x11,_x12,_x13,_x14){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.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||{}));_context14.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context14.sent;job.postMessage('process',{input:data,options:options,context:context});_context14.next=12;return job.result;case 12:result=_context14.sent;_context14.next=15;return result.result;case 15:return _context14.abrupt("return",_context14.sent);case 16:case"end":return _context14.stop();}},_callee11);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x15,_x16,_x17,_x18){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:_context15.t0=type;_context15.next=_context15.t0==='done'?3:_context15.t0==='error'?5:_context15.t0==='process'?7:20;break;case 3:job.done(payload);return _context15.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context15.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context15.prev=8;_context15.next=11;return parseOnMainThread(input,options);case 11:result=_context15.sent;job.postMessage('done',{id:id,result:result});_context15.next=19;break;case 15:_context15.prev=15;_context15.t1=_context15["catch"](8);message=_context15.t1 instanceof Error?_context15.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context15.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context15.stop();}},_callee12,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}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 _i492=0;_i492<length;_i492++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i492));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}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 _i493=0;_i493<array1.length;++_i493){if(array1[_i493]!==array2[_i493]){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 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$5(byteLength>=0);assert$5(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 concatenateArrayBuffersAsync(_x19){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context16.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context16.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context16.sent).done)){_context16.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context16.next=5;break;case 13:_context16.next=19;break;case 15:_context16.prev=15;_context16.t0=_context16["catch"](3);_didIteratorError=true;_iteratorError=_context16.t0;case 19:_context16.prev=19;_context16.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context16.next=24;break;}_context16.next=24;return _iterator["return"]();case 24:_context16.prev=24;if(!_didIteratorError){_context16.next=27;break;}throw _iteratorError;case 27:return _context16.finish(24);case 28:return _context16.finish(19);case 29:return _context16.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context16.stop();}},_callee13,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(_x20){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:if(!isResponse(resource)){_context17.next=2;break;}return _context17.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;}_context17.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context17.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 _context17.abrupt("return",response);case 16:case"end":return _context17.stop();}},_callee14);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x21){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(response){var message;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:if(response.ok){_context18.next=5;break;}_context18.next=3;return getResponseError(response);case 3:message=_context18.sent;throw new Error(message);case 5:case"end":return _context18.stop();}},_callee15);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x22){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context19.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context19.next=11;break;}_context19.t0=text;_context19.t1=" ";_context19.next=9;return response.text();case 9:_context19.t2=_context19.sent;text=_context19.t0+=_context19.t1.concat.call(_context19.t1,_context19.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context19.next=17;break;case 15:_context19.prev=15;_context19.t3=_context19["catch"](1);case 17:return _context19.abrupt("return",message);case 18:case"end":return _context19.stop();}},_callee16,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x23){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context20.next=3;break;}return _context20.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context20.next=8;break;}blobSlice=resource.slice(0,5);_context20.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 _context20.abrupt("return",_context20.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context20.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context20.abrupt("return","data:base64,".concat(_base));case 12:return _context20.abrupt("return",null);case 13:case"end":return _context20.stop();}},_callee17);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i494=0;_i494<bytes.byteLength;_i494++){binary+=String.fromCharCode(bytes[_i494]);}return btoa(binary);}function fetchFile(_x24,_x25){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:if(!(typeof url==='string')){_context21.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;}_context21.next=6;return fetch(url,fetchOptions);case 6:return _context21.abrupt("return",_context21.sent);case 7:_context21.next=9;return makeResponse(url);case 9:return _context21.abrupt("return",_context21.sent);case 10:case"end":return _context21.stop();}},_callee18);}));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(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var window_=globalThis.window||globalThis.self||globalThis.global;var process_=globalThis.process||{};var VERSION$6=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser();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';this.storage=void 0;this.id=void 0;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={}));var BACKGROUND_INCREMENT=10;function getColor(color){if(typeof color!=='string'){return color;}color=color.toUpperCase();return COLOR[color]||COLOR.WHITE;}function addColor(string,color,background){if(!isBrowser&&typeof string==='string'){if(color){var colorCode=getColor(color);string="\x1B[".concat(colorCode,"m").concat(string,"\x1B[39m");}if(background){var _colorCode=getColor(background);string="\x1B[".concat(_colorCode+BACKGROUND_INCREMENT,"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 object=obj;var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;var value=object[key];if(typeof value==='function'){if(!predefined.find(function(name){return key===name;})){object[key]=value.bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser()&&window_.performance){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()?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_LOG_CONFIGURATION={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;this.id=void 0;this.VERSION=VERSION$6;this._startTs=getHiResTimestamp();this._deltaTs=getHiResTimestamp();this._storage=void 0;this.userData={};this.LOG_THROTTLE_TIMEOUT=0;this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_LOG_CONFIGURATION);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$3(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){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()?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$3(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once&&tag){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;}}]);}();Log.VERSION=VERSION$6;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$3(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$3(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$2,_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$5(loader,'null loader');assert$5(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(_x26){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data){var loaders,options,context,loader,_args15=arguments;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:loaders=_args15.length>1&&_args15[1]!==undefined?_args15[1]:[];options=_args15.length>2?_args15[2]:undefined;context=_args15.length>3?_args15[3]:undefined;if(validHTTPResponse(data)){_context22.next=5;break;}return _context22.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context22.next=8;break;}return _context22.abrupt("return",loader);case 8:if(!isBlob(data)){_context22.next=13;break;}_context22.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context22.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context22.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context22.abrupt("return",loader);case 16:case"end":return _context22.stop();}},_callee19);}));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(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(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$1(data,byteOffset,test.length);return test===magic;default:return false;}}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 _i495=0;_i495<length;_i495++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i495));}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$2?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(_x27,_x28,_x29){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context23.next=3;break;}return _context23.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context23.next=7;break;}_context23.next=6;return makeResponse(data);case 6:data=_context23.sent;case 7:if(!isResponse(data)){_context23.next=21;break;}response=data;_context23.next=11;return checkResponse(response);case 11:if(!loader.binary){_context23.next=17;break;}_context23.next=14;return response.arrayBuffer();case 14:_context23.t0=_context23.sent;_context23.next=20;break;case 17:_context23.next=19;return response.text();case 19:_context23.t0=_context23.sent;case 20:return _context23.abrupt("return",_context23.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context23.next=24;break;}return _context23.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context23.stop();}},_callee20);}));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(_x30,_x31,_x32,_x33){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:assert$4(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context24.next=4;return data;case 4:data=_context24.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context24.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context24.sent;if(loader){_context24.next=14;break;}return _context24.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context24.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context24.abrupt("return",_context24.sent);case 19:case"end":return _context24.stop();}},_callee21);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x34,_x35,_x36,_x37){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.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};}_context25.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context25.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context25.next=8;break;}options.dataType='text';return _context25.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context25.next=12;break;}_context25.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context25.abrupt("return",_context25.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context25.next=16;break;}_context25.next=15;return loader.parseText(data,options,context,loader);case 15:return _context25.abrupt("return",_context25.sent);case 16:if(!loader.parse){_context25.next=20;break;}_context25.next=19;return loader.parse(data,options,context,loader);case 19:return _context25.abrupt("return",_context25.sent);case 20:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context25.stop();}},_callee22);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.4.14";var VERSION$4="3.4.14";var VERSION$3="3.4.14";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/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('basis_transcoder.js','textures',options);case 5:_context27.t1=_context27.sent;_context27.next=8;return loadLibrary('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(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context29.t1=_context29.sent;_context29.next=8;return loadLibrary(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$1?'basis':'basis-nodejs',module:'textures',version:VERSION$4,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$2="3.4.14";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$2?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 _i496=0;_i496<headerBytes.length;++_i496){if(headerBytes[_i496]!==buffer[_i496+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 _i497=0xffe0;_i497<0xfff0;++_i497){tableMarkers.add(_i497);}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$2,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$2?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$2(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$2(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$2(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$2(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$2(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$2(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$2(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$2(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 _i498=0;_i498<data.length;++_i498){var ch=data.charCodeAt(_i498);result[_i498]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i499=0;_i499<data.length;++_i499){result[write++]=result[_i499]<60?wasmpack[result[_i499]]:(result[_i499]-60)*64+result[++_i499];}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});var VERSION$1="3.4.14";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$1?'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 _i500=0;_i500<len;_i500+=3){var x=positions[_i500];var y=positions[_i500+1];var _z4=positions[_i500+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 _i501=0;_i501<this.fields.length;++_i501){if(!this.fields[_i501].compareTo(other.fields[_i501])){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 _i502=0,_columnNames=columnNames;_i502<_columnNames.length;_i502++){var _name6=_columnNames[_i502];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 _this116=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 _this116.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 _this117;_classCallCheck(this,Int);_this117=_callSuper(this,Int);_defineProperty(_this117,"isSigned",void 0);_defineProperty(_this117,"bitWidth",void 0);_this117.isSigned=isSigned;_this117.bitWidth=bitWidth;return _this117;}_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 _this118;_classCallCheck(this,Float);_this118=_callSuper(this,Float);_defineProperty(_this118,"precision",void 0);_this118.precision=precision;return _this118;}_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 _this119;_classCallCheck(this,FixedSizeList);_this119=_callSuper(this,FixedSizeList);_defineProperty(_this119,"listSize",void 0);_defineProperty(_this119,"children",void 0);_this119.listSize=listSize;_this119.children=[child];return _this119;}_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 _i503=0,_Object$values=Object.values(loaderData.attributes);_i503<_Object$values.length;_i503++){var loaderAttribute=_Object$values[_i503];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 _i504=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i504<_Object$entries4.length;_i504++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i504],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 _this120=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 _this120.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 _this121=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 _this121.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 _i505=0;_i505<numValues;_i505++){intArray[_i505]=dracoArray.GetValue(_i505);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i506=0;_i506<numValues;_i506++){intArray[_i506]=dracoArray.GetValue(_i506);}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(_x67){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(options){var modules;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.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);}_context42.next=4;return loadDecoderPromise;case 4:return _context42.abrupt("return",_context42.sent);case 5:case"end":return _context42.stop();}},_callee39);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x68){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:_context43.t0=options.draco&&options.draco.decoderType;_context43.next=_context43.t0==='js'?3:_context43.t0==='wasm'?7:7;break;case 3:_context43.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context43.sent;return _context43.abrupt("break",21);case 7:_context43.t1=Promise;_context43.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context43.t2=_context43.sent;_context43.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context43.t3=_context43.sent;_context43.t4=[_context43.t2,_context43.t3];_context43.next=17;return _context43.t1.all.call(_context43.t1,_context43.t4);case 17:_yield$Promise$all5=_context43.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;_context43.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context43.abrupt("return",_context43.sent);case 25:case"end":return _context43.stop();}},_callee40);}));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$1?'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(_x69,_x70){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:_context44.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context44.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context44.prev=5;return _context44.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context44.prev=7;dracoParser.destroy();return _context44.finish(7);case 10:case"end":return _context44.stop();}},_callee41,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(_x71,_x72,_x73){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator43,_step43,_primitive6;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context45.next=2;break;}return _context45.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();}_context45.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context45.stop();}},_callee42);}));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 _mesh3=_step25.value;compressMesh(_mesh3,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x74,_x75,_x76,_x77){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i603,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context46.next=3;break;}return _context46.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'];_context46.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context46.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i603=0,_Object$entries5=Object.entries(decodedAttributes);_i603<_Object$entries5.length;_i603++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i603],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 _context46.stop();}},_callee43);}));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,_mesh4,_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;}_mesh4=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh4.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 _i507=0;_i507<a.length;++_i507){if(!_equals(a[_i507],b[_i507])){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 _i508=0;_i508<this.ELEMENTS;++_i508){this[_i508]=array[_i508+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 _i509=0;_i509<this.ELEMENTS;++_i509){targetArray[offset+_i509]=this[_i509];}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 _i510=0;_i510<this.ELEMENTS;++_i510){string+=(_i510>0?', ':'')+formatValue(this[_i510],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 _i511=0;_i511<this.ELEMENTS;++_i511){if(!_equals(this[_i511],array[_i511])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i512=0;_i512<this.ELEMENTS;++_i512){if(this[_i512]!==array[_i512]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i513=0;_i513<this.ELEMENTS;++_i513){this[_i513]=-this[_i513];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i514=0;_i514<this.ELEMENTS;++_i514){var ai=a[_i514];this[_i514]=ai+t*(b[_i514]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i515=0;_i515<this.ELEMENTS;++_i515){this[_i515]=Math.min(vector[_i515],this[_i515]);}return this.check();}},{key:"max",value:function max(vector){for(var _i516=0;_i516<this.ELEMENTS;++_i516){this[_i516]=Math.max(vector[_i516],this[_i516]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i517=0;_i517<this.ELEMENTS;++_i517){this[_i517]=Math.min(Math.max(this[_i517],minVector[_i517]),maxVector[_i517]);}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 _i518=0,_vectors=vectors;_i518<_vectors.length;_i518++){var vector=_vectors[_i518];for(var _i519=0;_i519<this.ELEMENTS;++_i519){this[_i519]+=vector[_i519];}}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 _i520=0,_vectors2=vectors;_i520<_vectors2.length;_i520++){var vector=_vectors2[_i520];for(var _i521=0;_i521<this.ELEMENTS;++_i521){this[_i521]-=vector[_i521];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]*=_scale7;}}else{for(var _i523=0;_i523<this.ELEMENTS&&_i523<_scale7.length;++_i523){this[_i523]*=_scale7[_i523];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i524=0;_i524<this.ELEMENTS;++_i524){this[_i524]*=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 _i525=0;_i525<this.ELEMENTS;++_i525){valid=valid&&Number.isFinite(this[_i525]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i526=0;_i526<this.ELEMENTS;++_i526){this[_i526]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i528=0;_i528<this.ELEMENTS;++_i528){this[_i528]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(Math.max(this[_i529],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 _i530=0;_i530<v.length;++_i530){if(!Number.isFinite(v[_i530])){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 _i531=0;_i531<this.ELEMENTS;++_i531){length+=this[_i531]*this[_i531];}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 _i532=0;_i532<this.ELEMENTS;++_i532){var dist=this[_i532]-mathArray[_i532];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i533=0;_i533<this.ELEMENTS;++_i533){product+=this[_i533]*mathArray[_i533];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i534=0;_i534<this.ELEMENTS;++_i534){this[_i534]/=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 _i535=0,_vectors3=vectors;_i535<_vectors3.length;_i535++){var vector=_vectors3[_i535];for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=vector[_i536];}}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 _i537=0,_vectors4=vectors;_i537<_vectors4.length;_i537++){var vector=_vectors4[_i537];for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]/=vector[_i538];}}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);/**
|
|
24359
|
+
if(plugins.length>0){for(var _i491=0,len=plugins.length;_i491<len;_i491++){var plugin=plugins[_i491];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();function assert$5(condition,message){if(!condition){throw new Error(message||'loader assertion failed.');}}var isBrowser$2=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 VERSION$8="3.4.14";function assert$4(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$1=(typeof process==="undefined"?"undefined":_typeof2(process))!=='object'||String(process)!=='[object process]'||process.browser;var isWorker=typeof importScripts==='function';var isMobile=typeof window!=='undefined'&&typeof window.orientation!=='undefined';var matches=typeof process!=='undefined'&&process.version&&/v([0-9]*)/.exec(process.version);matches&&parseFloat(matches[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 _this113=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){_this113._resolve=resolve;_this113._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$4(this.isRunning);this.isRunning=false;this._resolve(value);}},{key:"error",value:function error(_error){assert$4(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$4(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$4(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$4(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$1?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 _this114=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){_this114.onError(new Error('No data received'));}else{_this114.onMessage(event.data);}};worker.onerror=function(error){_this114.onError(_this114._getErrorFromErrorEvent(error));_this114.terminated=true;};worker.onmessageerror=function(event){return console.error(event);};return worker;}},{key:"_createNodeWorker",value:function _createNodeWorker(){var _this115=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){_this115.onMessage(data);});worker.on('error',function(error){_this115.onError(error);});worker.on('exit',function(code){});return worker;}}],[{key:"isSupported",value:function isSupported(){return typeof Worker!=='undefined'&&isBrowser$1||typeof Worker$1!=='undefined'&&!isBrowser$1;}}]);}();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 _this116=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){_this116.jobQueue.push({name:name,onMessage:onMessage,onError:onError,onStart:onStart});return _this116;});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$4(url);return url;}function validateWorkerVersion(worker){var coreVersion=arguments.length>1&&arguments[1]!==undefined?arguments[1]:VERSION$8;assert$4(worker,'no worker provided');var workerVersion=worker.version;if(!coreVersion||!workerVersion){return false;}return true;}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$7="3.4.14";var loadLibraryPromises={};function loadLibrary(_x8){return _loadLibrary.apply(this,arguments);}function _loadLibrary(){_loadLibrary=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(libraryUrl){var moduleName,options,_args5=arguments;return _regeneratorRuntime().wrap(function _callee9$(_context12){while(1)switch(_context12.prev=_context12.next){case 0:moduleName=_args5.length>1&&_args5[1]!==undefined?_args5[1]:null;options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};if(moduleName){libraryUrl=getLibraryUrl(libraryUrl,moduleName,options);}loadLibraryPromises[libraryUrl]=loadLibraryPromises[libraryUrl]||loadLibraryFromFile(libraryUrl);_context12.next=6;return loadLibraryPromises[libraryUrl];case 6:return _context12.abrupt("return",_context12.sent);case 7:case"end":return _context12.stop();}},_callee9);}));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$1){return"modules/".concat(moduleName,"/dist/libs/").concat(library);}if(options.CDN){assert$4(options.CDN.startsWith('http'));return"".concat(options.CDN,"/").concat(moduleName,"@").concat(VERSION$7,"/dist/libs/").concat(library);}if(isWorker){return"../src/libs/".concat(library);}return"modules/".concat(moduleName,"/src/libs/").concat(library);}function loadLibraryFromFile(_x9){return _loadLibraryFromFile.apply(this,arguments);}function _loadLibraryFromFile(){_loadLibraryFromFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(libraryUrl){var _response,response,scriptSource;return _regeneratorRuntime().wrap(function _callee10$(_context13){while(1)switch(_context13.prev=_context13.next){case 0:if(!libraryUrl.endsWith('wasm')){_context13.next=7;break;}_context13.next=3;return fetch(libraryUrl);case 3:_response=_context13.sent;_context13.next=6;return _response.arrayBuffer();case 6:return _context13.abrupt("return",_context13.sent);case 7:if(isBrowser$1){_context13.next=20;break;}_context13.prev=8;_context13.t0=node&&requireFromFile;if(!_context13.t0){_context13.next=14;break;}_context13.next=13;return requireFromFile(libraryUrl);case 13:_context13.t0=_context13.sent;case 14:return _context13.abrupt("return",_context13.t0);case 17:_context13.prev=17;_context13.t1=_context13["catch"](8);return _context13.abrupt("return",null);case 20:if(!isWorker){_context13.next=22;break;}return _context13.abrupt("return",importScripts(libraryUrl));case 22:_context13.next=24;return fetch(libraryUrl);case 24:response=_context13.sent;_context13.next=27;return response.text();case 27:scriptSource=_context13.sent;return _context13.abrupt("return",loadLibraryFromString(scriptSource,libraryUrl));case 29:case"end":return _context13.stop();}},_callee10,null,[[8,17]]);}));return _loadLibraryFromFile.apply(this,arguments);}function loadLibraryFromString(scriptSource,id){if(!isBrowser$1){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;}function canParseWithWorker(loader,options){if(!WorkerFarm.isSupported()){return false;}if(!isBrowser$1&&!(options!==null&&options!==void 0&&options._nodeWorkers)){return false;}return loader.worker&&(options===null||options===void 0?void 0:options.worker);}function parseWithWorker(_x10,_x11,_x12,_x13,_x14){return _parseWithWorker.apply(this,arguments);}function _parseWithWorker(){_parseWithWorker=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(loader,data,options,context,parseOnMainThread){var name,url,workerFarm,workerPool,job,result;return _regeneratorRuntime().wrap(function _callee11$(_context14){while(1)switch(_context14.prev=_context14.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||{}));_context14.next=8;return workerPool.startJob('process-on-worker',onMessage.bind(null,parseOnMainThread));case 8:job=_context14.sent;job.postMessage('process',{input:data,options:options,context:context});_context14.next=12;return job.result;case 12:result=_context14.sent;_context14.next=15;return result.result;case 15:return _context14.abrupt("return",_context14.sent);case 16:case"end":return _context14.stop();}},_callee11);}));return _parseWithWorker.apply(this,arguments);}function onMessage(_x15,_x16,_x17,_x18){return _onMessage2.apply(this,arguments);}function _onMessage2(){_onMessage2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee12(parseOnMainThread,job,type,payload){var id,input,options,result,message;return _regeneratorRuntime().wrap(function _callee12$(_context15){while(1)switch(_context15.prev=_context15.next){case 0:_context15.t0=type;_context15.next=_context15.t0==='done'?3:_context15.t0==='error'?5:_context15.t0==='process'?7:20;break;case 3:job.done(payload);return _context15.abrupt("break",21);case 5:job.error(new Error(payload.error));return _context15.abrupt("break",21);case 7:id=payload.id,input=payload.input,options=payload.options;_context15.prev=8;_context15.next=11;return parseOnMainThread(input,options);case 11:result=_context15.sent;job.postMessage('done',{id:id,result:result});_context15.next=19;break;case 15:_context15.prev=15;_context15.t1=_context15["catch"](8);message=_context15.t1 instanceof Error?_context15.t1.message:'unknown error';job.postMessage('error',{id:id,error:message});case 19:return _context15.abrupt("break",21);case 20:console.warn("parse-with-worker unknown message ".concat(type));case 21:case"end":return _context15.stop();}},_callee12,null,[[8,15]]);}));return _onMessage2.apply(this,arguments);}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 _i492=0;_i492<length;_i492++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i492));}return magic;}function parseJSON(string){try{return JSON.parse(string);}catch(_){throw new Error("Failed to parse JSON from data starting with \"".concat(getFirstCharacters$1(string),"\""));}}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 _i493=0;_i493<array1.length;++_i493){if(array1[_i493]!==array2[_i493]){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 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$5(byteLength>=0);assert$5(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 concatenateArrayBuffersAsync(_x19){return _concatenateArrayBuffersAsync.apply(this,arguments);}function _concatenateArrayBuffersAsync(){_concatenateArrayBuffersAsync=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee13(asyncIterator){var arrayBuffers,_iteratorAbruptCompletion,_didIteratorError,_iteratorError,_iterator,_step,chunk;return _regeneratorRuntime().wrap(function _callee13$(_context16){while(1)switch(_context16.prev=_context16.next){case 0:arrayBuffers=[];_iteratorAbruptCompletion=false;_didIteratorError=false;_context16.prev=3;_iterator=_asyncIterator(asyncIterator);case 5:_context16.next=7;return _iterator.next();case 7:if(!(_iteratorAbruptCompletion=!(_step=_context16.sent).done)){_context16.next=13;break;}chunk=_step.value;arrayBuffers.push(chunk);case 10:_iteratorAbruptCompletion=false;_context16.next=5;break;case 13:_context16.next=19;break;case 15:_context16.prev=15;_context16.t0=_context16["catch"](3);_didIteratorError=true;_iteratorError=_context16.t0;case 19:_context16.prev=19;_context16.prev=20;if(!(_iteratorAbruptCompletion&&_iterator["return"]!=null)){_context16.next=24;break;}_context16.next=24;return _iterator["return"]();case 24:_context16.prev=24;if(!_didIteratorError){_context16.next=27;break;}throw _iteratorError;case 27:return _context16.finish(24);case 28:return _context16.finish(19);case 29:return _context16.abrupt("return",concatenateArrayBuffers.apply(void 0,arrayBuffers));case 30:case"end":return _context16.stop();}},_callee13,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(_x20){return _makeResponse.apply(this,arguments);}function _makeResponse(){_makeResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee14(resource){var headers,contentLength,url,type,initialDataUrl,response;return _regeneratorRuntime().wrap(function _callee14$(_context17){while(1)switch(_context17.prev=_context17.next){case 0:if(!isResponse(resource)){_context17.next=2;break;}return _context17.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;}_context17.next=10;return getInitialDataUrl(resource);case 10:initialDataUrl=_context17.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 _context17.abrupt("return",response);case 16:case"end":return _context17.stop();}},_callee14);}));return _makeResponse.apply(this,arguments);}function checkResponse(_x21){return _checkResponse.apply(this,arguments);}function _checkResponse(){_checkResponse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee15(response){var message;return _regeneratorRuntime().wrap(function _callee15$(_context18){while(1)switch(_context18.prev=_context18.next){case 0:if(response.ok){_context18.next=5;break;}_context18.next=3;return getResponseError(response);case 3:message=_context18.sent;throw new Error(message);case 5:case"end":return _context18.stop();}},_callee15);}));return _checkResponse.apply(this,arguments);}function getResponseError(_x22){return _getResponseError.apply(this,arguments);}function _getResponseError(){_getResponseError=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee16(response){var message,contentType,text;return _regeneratorRuntime().wrap(function _callee16$(_context19){while(1)switch(_context19.prev=_context19.next){case 0:message="Failed to fetch resource ".concat(response.url," (").concat(response.status,"): ");_context19.prev=1;contentType=response.headers.get('Content-Type');text=response.statusText;if(!contentType.includes('application/json')){_context19.next=11;break;}_context19.t0=text;_context19.t1=" ";_context19.next=9;return response.text();case 9:_context19.t2=_context19.sent;text=_context19.t0+=_context19.t1.concat.call(_context19.t1,_context19.t2);case 11:message+=text;message=message.length>60?"".concat(message.slice(0,60),"..."):message;_context19.next=17;break;case 15:_context19.prev=15;_context19.t3=_context19["catch"](1);case 17:return _context19.abrupt("return",message);case 18:case"end":return _context19.stop();}},_callee16,null,[[1,15]]);}));return _getResponseError.apply(this,arguments);}function getInitialDataUrl(_x23){return _getInitialDataUrl.apply(this,arguments);}function _getInitialDataUrl(){_getInitialDataUrl=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee17(resource){var INITIAL_DATA_LENGTH,blobSlice,slice,_base;return _regeneratorRuntime().wrap(function _callee17$(_context20){while(1)switch(_context20.prev=_context20.next){case 0:INITIAL_DATA_LENGTH=5;if(!(typeof resource==='string')){_context20.next=3;break;}return _context20.abrupt("return","data:,".concat(resource.slice(0,INITIAL_DATA_LENGTH)));case 3:if(!(resource instanceof Blob)){_context20.next=8;break;}blobSlice=resource.slice(0,5);_context20.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 _context20.abrupt("return",_context20.sent);case 8:if(!(resource instanceof ArrayBuffer)){_context20.next=12;break;}slice=resource.slice(0,INITIAL_DATA_LENGTH);_base=arrayBufferToBase64(slice);return _context20.abrupt("return","data:base64,".concat(_base));case 12:return _context20.abrupt("return",null);case 13:case"end":return _context20.stop();}},_callee17);}));return _getInitialDataUrl.apply(this,arguments);}function arrayBufferToBase64(buffer){var binary='';var bytes=new Uint8Array(buffer);for(var _i494=0;_i494<bytes.byteLength;_i494++){binary+=String.fromCharCode(bytes[_i494]);}return btoa(binary);}function fetchFile(_x24,_x25){return _fetchFile.apply(this,arguments);}function _fetchFile(){_fetchFile=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee18(url,options){var fetchOptions;return _regeneratorRuntime().wrap(function _callee18$(_context21){while(1)switch(_context21.prev=_context21.next){case 0:if(!(typeof url==='string')){_context21.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;}_context21.next=6;return fetch(url,fetchOptions);case 6:return _context21.abrupt("return",_context21.sent);case 7:_context21.next=9;return makeResponse(url);case 9:return _context21.abrupt("return",_context21.sent);case 10:case"end":return _context21.stop();}},_callee18);}));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(){var isNode=(typeof process==="undefined"?"undefined":_typeof2(process))==='object'&&String(process)==='[object process]'&&!process.browser;return!isNode||isElectron();}var window_=globalThis.window||globalThis.self||globalThis.global;var process_=globalThis.process||{};var VERSION$6=typeof __VERSION__!=='undefined'?__VERSION__:'untranspiled source';isBrowser();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';this.storage=void 0;this.id=void 0;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={}));var BACKGROUND_INCREMENT=10;function getColor(color){if(typeof color!=='string'){return color;}color=color.toUpperCase();return COLOR[color]||COLOR.WHITE;}function addColor(string,color,background){if(!isBrowser&&typeof string==='string'){if(color){var colorCode=getColor(color);string="\x1B[".concat(colorCode,"m").concat(string,"\x1B[39m");}if(background){var _colorCode=getColor(background);string="\x1B[".concat(_colorCode+BACKGROUND_INCREMENT,"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 object=obj;var _iterator7=_createForOfIteratorHelper(propNames),_step7;try{var _loop3=function _loop3(){var key=_step7.value;var value=object[key];if(typeof value==='function'){if(!predefined.find(function(name){return key===name;})){object[key]=value.bind(obj);}}};for(_iterator7.s();!(_step7=_iterator7.n()).done;){_loop3();}}catch(err){_iterator7.e(err);}finally{_iterator7.f();}}function assert$3(condition,message){if(!condition){throw new Error(message||'Assertion failed');}}function getHiResTimestamp(){var timestamp;if(isBrowser()&&window_.performance){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()?console.debug||console.log:console.log,log:console.log,info:console.info,warn:console.warn,error:console.error};var DEFAULT_LOG_CONFIGURATION={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;this.id=void 0;this.VERSION=VERSION$6;this._startTs=getHiResTimestamp();this._deltaTs=getHiResTimestamp();this._storage=void 0;this.userData={};this.LOG_THROTTLE_TIMEOUT=0;this.id=id;this.userData={};this._storage=new LocalStorage("__probe-".concat(this.id,"__"),DEFAULT_LOG_CONFIGURATION);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$3(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){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()?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$3(method);opts.total=this.getTotal();opts.delta=this.getDelta();this._deltaTs=getHiResTimestamp();var tag=opts.tag||opts.message;if(opts.once&&tag){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;}}]);}();Log.VERSION=VERSION$6;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$3(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$3(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$2,_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$5(loader,'null loader');assert$5(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(_x26){return _selectLoader.apply(this,arguments);}function _selectLoader(){_selectLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(data){var loaders,options,context,loader,_args15=arguments;return _regeneratorRuntime().wrap(function _callee19$(_context22){while(1)switch(_context22.prev=_context22.next){case 0:loaders=_args15.length>1&&_args15[1]!==undefined?_args15[1]:[];options=_args15.length>2?_args15[2]:undefined;context=_args15.length>3?_args15[3]:undefined;if(validHTTPResponse(data)){_context22.next=5;break;}return _context22.abrupt("return",null);case 5:loader=selectLoaderSync(data,loaders,_objectSpread(_objectSpread({},options),{},{nothrow:true}),context);if(!loader){_context22.next=8;break;}return _context22.abrupt("return",loader);case 8:if(!isBlob(data)){_context22.next=13;break;}_context22.next=11;return data.slice(0,10).arrayBuffer();case 11:data=_context22.sent;loader=selectLoaderSync(data,loaders,options,context);case 13:if(!(!loader&&!(options!==null&&options!==void 0&&options.nothrow))){_context22.next=15;break;}throw new Error(getNoValidLoaderMessage(data));case 15:return _context22.abrupt("return",loader);case 16:case"end":return _context22.stop();}},_callee19);}));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(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(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$1(data,byteOffset,test.length);return test===magic;default:return false;}}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 _i495=0;_i495<length;_i495++){magic+=String.fromCharCode(dataView.getUint8(byteOffset+_i495));}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$2?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(_x27,_x28,_x29){return _getArrayBufferOrStringFromData.apply(this,arguments);}function _getArrayBufferOrStringFromData(){_getArrayBufferOrStringFromData=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee20(data,loader,options){var isArrayBuffer,response;return _regeneratorRuntime().wrap(function _callee20$(_context23){while(1)switch(_context23.prev=_context23.next){case 0:isArrayBuffer=data instanceof ArrayBuffer||ArrayBuffer.isView(data);if(!(typeof data==='string'||isArrayBuffer)){_context23.next=3;break;}return _context23.abrupt("return",getArrayBufferOrStringFromDataSync(data,loader));case 3:if(!isBlob(data)){_context23.next=7;break;}_context23.next=6;return makeResponse(data);case 6:data=_context23.sent;case 7:if(!isResponse(data)){_context23.next=21;break;}response=data;_context23.next=11;return checkResponse(response);case 11:if(!loader.binary){_context23.next=17;break;}_context23.next=14;return response.arrayBuffer();case 14:_context23.t0=_context23.sent;_context23.next=20;break;case 17:_context23.next=19;return response.text();case 19:_context23.t0=_context23.sent;case 20:return _context23.abrupt("return",_context23.t0);case 21:if(isReadableStream(data)){data=makeIterator(data,options);}if(!(isIterable(data)||isAsyncIterable(data))){_context23.next=24;break;}return _context23.abrupt("return",concatenateArrayBuffersAsync(data));case 24:throw new Error(ERR_DATA);case 25:case"end":return _context23.stop();}},_callee20);}));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(_x30,_x31,_x32,_x33){return _parse$.apply(this,arguments);}function _parse$(){_parse$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee21(data,loaders,options,context){var url,typedLoaders,candidateLoaders,loader;return _regeneratorRuntime().wrap(function _callee21$(_context24){while(1)switch(_context24.prev=_context24.next){case 0:assert$4(!context||_typeof2(context)==='object');if(loaders&&!Array.isArray(loaders)&&!isLoaderObject(loaders)){context=undefined;options=loaders;loaders=undefined;}_context24.next=4;return data;case 4:data=_context24.sent;options=options||{};url=getResourceUrl(data);typedLoaders=loaders;candidateLoaders=getLoadersFromContext(typedLoaders,context);_context24.next=11;return selectLoader(data,candidateLoaders,options);case 11:loader=_context24.sent;if(loader){_context24.next=14;break;}return _context24.abrupt("return",null);case 14:options=normalizeOptions(options,loader,candidateLoaders,url);context=getLoaderContext({url:url,parse:parse$2,loaders:candidateLoaders},options,context||null);_context24.next=18;return parseWithLoader(loader,data,options,context);case 18:return _context24.abrupt("return",_context24.sent);case 19:case"end":return _context24.stop();}},_callee21);}));return _parse$.apply(this,arguments);}function parseWithLoader(_x34,_x35,_x36,_x37){return _parseWithLoader.apply(this,arguments);}function _parseWithLoader(){_parseWithLoader=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee22(loader,data,options,context){var response,ok,redirected,status,statusText,type,url,headers;return _regeneratorRuntime().wrap(function _callee22$(_context25){while(1)switch(_context25.prev=_context25.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};}_context25.next=4;return getArrayBufferOrStringFromData(data,loader,options);case 4:data=_context25.sent;if(!(loader.parseTextSync&&typeof data==='string')){_context25.next=8;break;}options.dataType='text';return _context25.abrupt("return",loader.parseTextSync(data,options,context,loader));case 8:if(!canParseWithWorker(loader,options)){_context25.next=12;break;}_context25.next=11;return parseWithWorker(loader,data,options,context,parse$2);case 11:return _context25.abrupt("return",_context25.sent);case 12:if(!(loader.parseText&&typeof data==='string')){_context25.next=16;break;}_context25.next=15;return loader.parseText(data,options,context,loader);case 15:return _context25.abrupt("return",_context25.sent);case 16:if(!loader.parse){_context25.next=20;break;}_context25.next=19;return loader.parse(data,options,context,loader);case 19:return _context25.abrupt("return",_context25.sent);case 20:assert$4(!loader.parseSync);throw new Error("".concat(loader.id," loader - no parser found and worker is disabled"));case 22:case"end":return _context25.stop();}},_callee22);}));return _parseWithLoader.apply(this,arguments);}var VERSION$5="3.4.14";var VERSION$4="3.4.14";var VERSION$3="3.4.14";var BASIS_CDN_ENCODER_WASM="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/dist/libs/basis_encoder.wasm");var BASIS_CDN_ENCODER_JS="https://unpkg.com/@loaders.gl/textures@".concat(VERSION$3,"/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('basis_transcoder.js','textures',options);case 5:_context27.t1=_context27.sent;_context27.next=8;return loadLibrary('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(BASIS_CDN_ENCODER_JS,'textures',options);case 5:_context29.t1=_context29.sent;_context29.next=8;return loadLibrary(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$1?'basis':'basis-nodejs',module:'textures',version:VERSION$4,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$2="3.4.14";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$2?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 _i496=0;_i496<headerBytes.length;++_i496){if(headerBytes[_i496]!==buffer[_i496+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 _i497=0xffe0;_i497<0xfff0;++_i497){tableMarkers.add(_i497);}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$2,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$2?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$2(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$2(bufferView);var bufferIndex=bufferView.buffer;var binChunk=buffers[bufferIndex];assert$2(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$2(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$2(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$2(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$2(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$2(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 _i498=0;_i498<data.length;++_i498){var ch=data.charCodeAt(_i498);result[_i498]=ch>96?ch-71:ch>64?ch-65:ch>47?ch+4:ch>46?63:62;}var write=0;for(var _i499=0;_i499<data.length;++_i499){result[write++]=result[_i499]<60?wasmpack[result[_i499]]:(result[_i499]-60)*64+result[++_i499];}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});var VERSION$1="3.4.14";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$1?'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 _i500=0;_i500<len;_i500+=3){var x=positions[_i500];var y=positions[_i500+1];var _z4=positions[_i500+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 _i501=0;_i501<this.fields.length;++_i501){if(!this.fields[_i501].compareTo(other.fields[_i501])){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 _i502=0,_columnNames=columnNames;_i502<_columnNames.length;_i502++){var _name6=_columnNames[_i502];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 _this117=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 _this117.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 _this118;_classCallCheck(this,Int);_this118=_callSuper(this,Int);_defineProperty(_this118,"isSigned",void 0);_defineProperty(_this118,"bitWidth",void 0);_this118.isSigned=isSigned;_this118.bitWidth=bitWidth;return _this118;}_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 _this119;_classCallCheck(this,Float);_this119=_callSuper(this,Float);_defineProperty(_this119,"precision",void 0);_this119.precision=precision;return _this119;}_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 _this120;_classCallCheck(this,FixedSizeList);_this120=_callSuper(this,FixedSizeList);_defineProperty(_this120,"listSize",void 0);_defineProperty(_this120,"children",void 0);_this120.listSize=listSize;_this120.children=[child];return _this120;}_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 _i503=0,_Object$values=Object.values(loaderData.attributes);_i503<_Object$values.length;_i503++){var loaderAttribute=_Object$values[_i503];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 _i504=0,_Object$entries4=Object.entries(options.extraAttributes||{});_i504<_Object$entries4.length;_i504++){var _Object$entries4$_i=_slicedToArray(_Object$entries4[_i504],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 _this121=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 _this121.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 _this122=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 _this122.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 _i505=0;_i505<numValues;_i505++){intArray[_i505]=dracoArray.GetValue(_i505);}return intArray;}function getUint32Array(dracoArray){var numValues=dracoArray.size();var intArray=new Int32Array(numValues);for(var _i506=0;_i506<numValues;_i506++){intArray[_i506]=dracoArray.GetValue(_i506);}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(_x67){return _loadDracoDecoderModule.apply(this,arguments);}function _loadDracoDecoderModule(){_loadDracoDecoderModule=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee39(options){var modules;return _regeneratorRuntime().wrap(function _callee39$(_context42){while(1)switch(_context42.prev=_context42.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);}_context42.next=4;return loadDecoderPromise;case 4:return _context42.abrupt("return",_context42.sent);case 5:case"end":return _context42.stop();}},_callee39);}));return _loadDracoDecoderModule.apply(this,arguments);}function loadDracoDecoder(_x68){return _loadDracoDecoder.apply(this,arguments);}function _loadDracoDecoder(){_loadDracoDecoder=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee40(options){var DracoDecoderModule,wasmBinary,_yield$Promise$all5,_yield$Promise$all6;return _regeneratorRuntime().wrap(function _callee40$(_context43){while(1)switch(_context43.prev=_context43.next){case 0:_context43.t0=options.draco&&options.draco.decoderType;_context43.next=_context43.t0==='js'?3:_context43.t0==='wasm'?7:7;break;case 3:_context43.next=5;return loadLibrary(DRACO_JS_DECODER_URL,'draco',options);case 5:DracoDecoderModule=_context43.sent;return _context43.abrupt("break",21);case 7:_context43.t1=Promise;_context43.next=10;return loadLibrary(DRACO_WASM_WRAPPER_URL,'draco',options);case 10:_context43.t2=_context43.sent;_context43.next=13;return loadLibrary(DRACO_WASM_DECODER_URL,'draco',options);case 13:_context43.t3=_context43.sent;_context43.t4=[_context43.t2,_context43.t3];_context43.next=17;return _context43.t1.all.call(_context43.t1,_context43.t4);case 17:_yield$Promise$all5=_context43.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;_context43.next=24;return initializeDracoDecoder(DracoDecoderModule,wasmBinary);case 24:return _context43.abrupt("return",_context43.sent);case 25:case"end":return _context43.stop();}},_callee40);}));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$1?'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(_x69,_x70){return _parse$2.apply(this,arguments);}function _parse$2(){_parse$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee41(arrayBuffer,options){var _yield$loadDracoDecod,draco,dracoParser;return _regeneratorRuntime().wrap(function _callee41$(_context44){while(1)switch(_context44.prev=_context44.next){case 0:_context44.next=2;return loadDracoDecoderModule(options);case 2:_yield$loadDracoDecod=_context44.sent;draco=_yield$loadDracoDecod.draco;dracoParser=new DracoParser(draco);_context44.prev=5;return _context44.abrupt("return",dracoParser.parseSync(arrayBuffer,options===null||options===void 0?void 0:options.draco));case 7:_context44.prev=7;dracoParser.destroy();return _context44.finish(7);case 10:case"end":return _context44.stop();}},_callee41,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(_x71,_x72,_x73){return _decode$2.apply(this,arguments);}function _decode$2(){_decode$2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee42(gltfData,options,context){var _options$gltf,scenegraph,promises,_iterator43,_step43,_primitive6;return _regeneratorRuntime().wrap(function _callee42$(_context45){while(1)switch(_context45.prev=_context45.next){case 0:if(options!==null&&options!==void 0&&(_options$gltf=options.gltf)!==null&&_options$gltf!==void 0&&_options$gltf.decompressMeshes){_context45.next=2;break;}return _context45.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();}_context45.next=8;return Promise.all(promises);case 8:scenegraph.removeExtension(KHR_DRACO_MESH_COMPRESSION);case 9:case"end":return _context45.stop();}},_callee42);}));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 _mesh3=_step25.value;compressMesh(_mesh3,options);scenegraph.addRequiredExtension(KHR_DRACO_MESH_COMPRESSION);}}catch(err){_iterator25.e(err);}finally{_iterator25.f();}}function decompressPrimitive(_x74,_x75,_x76,_x77){return _decompressPrimitive.apply(this,arguments);}function _decompressPrimitive(){_decompressPrimitive=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee43(scenegraph,primitive,options,context){var dracoExtension,buffer,bufferCopy,parse,dracoOptions,decodedData,decodedAttributes,_i603,_Object$entries5,_Object$entries5$_i,attributeName,decodedAttribute,accessorIndex,accessor;return _regeneratorRuntime().wrap(function _callee43$(_context46){while(1)switch(_context46.prev=_context46.next){case 0:dracoExtension=scenegraph.getObjectExtension(primitive,KHR_DRACO_MESH_COMPRESSION);if(dracoExtension){_context46.next=3;break;}return _context46.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'];_context46.next=10;return parse(bufferCopy,DracoLoader,dracoOptions,context);case 10:decodedData=_context46.sent;decodedAttributes=getGLTFAccessors(decodedData.attributes);for(_i603=0,_Object$entries5=Object.entries(decodedAttributes);_i603<_Object$entries5.length;_i603++){_Object$entries5$_i=_slicedToArray(_Object$entries5[_i603],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 _context46.stop();}},_callee43);}));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,_mesh4,_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;}_mesh4=_step26.value;_iterator27=_createForOfIteratorHelper(_mesh4.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 _i507=0;_i507<a.length;++_i507){if(!_equals(a[_i507],b[_i507])){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 _i508=0;_i508<this.ELEMENTS;++_i508){this[_i508]=array[_i508+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 _i509=0;_i509<this.ELEMENTS;++_i509){targetArray[offset+_i509]=this[_i509];}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 _i510=0;_i510<this.ELEMENTS;++_i510){string+=(_i510>0?', ':'')+formatValue(this[_i510],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 _i511=0;_i511<this.ELEMENTS;++_i511){if(!_equals(this[_i511],array[_i511])){return false;}}return true;}},{key:"exactEquals",value:function exactEquals(array){if(!array||this.length!==array.length){return false;}for(var _i512=0;_i512<this.ELEMENTS;++_i512){if(this[_i512]!==array[_i512]){return false;}}return true;}},{key:"negate",value:function negate(){for(var _i513=0;_i513<this.ELEMENTS;++_i513){this[_i513]=-this[_i513];}return this.check();}},{key:"lerp",value:function lerp(a,b,t){if(t===undefined){return this.lerp(this,a,b);}for(var _i514=0;_i514<this.ELEMENTS;++_i514){var ai=a[_i514];this[_i514]=ai+t*(b[_i514]-ai);}return this.check();}},{key:"min",value:function min(vector){for(var _i515=0;_i515<this.ELEMENTS;++_i515){this[_i515]=Math.min(vector[_i515],this[_i515]);}return this.check();}},{key:"max",value:function max(vector){for(var _i516=0;_i516<this.ELEMENTS;++_i516){this[_i516]=Math.max(vector[_i516],this[_i516]);}return this.check();}},{key:"clamp",value:function clamp(minVector,maxVector){for(var _i517=0;_i517<this.ELEMENTS;++_i517){this[_i517]=Math.min(Math.max(this[_i517],minVector[_i517]),maxVector[_i517]);}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 _i518=0,_vectors=vectors;_i518<_vectors.length;_i518++){var vector=_vectors[_i518];for(var _i519=0;_i519<this.ELEMENTS;++_i519){this[_i519]+=vector[_i519];}}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 _i520=0,_vectors2=vectors;_i520<_vectors2.length;_i520++){var vector=_vectors2[_i520];for(var _i521=0;_i521<this.ELEMENTS;++_i521){this[_i521]-=vector[_i521];}}return this.check();}},{key:"scale",value:function scale(_scale7){if(typeof _scale7==='number'){for(var _i522=0;_i522<this.ELEMENTS;++_i522){this[_i522]*=_scale7;}}else{for(var _i523=0;_i523<this.ELEMENTS&&_i523<_scale7.length;++_i523){this[_i523]*=_scale7[_i523];}}return this.check();}},{key:"multiplyByScalar",value:function multiplyByScalar(scalar){for(var _i524=0;_i524<this.ELEMENTS;++_i524){this[_i524]*=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 _i525=0;_i525<this.ELEMENTS;++_i525){valid=valid&&Number.isFinite(this[_i525]);}return valid;}},{key:"sub",value:function sub(a){return this.subtract(a);}},{key:"setScalar",value:function setScalar(a){for(var _i526=0;_i526<this.ELEMENTS;++_i526){this[_i526]=a;}return this.check();}},{key:"addScalar",value:function addScalar(a){for(var _i527=0;_i527<this.ELEMENTS;++_i527){this[_i527]+=a;}return this.check();}},{key:"subScalar",value:function subScalar(a){return this.addScalar(-a);}},{key:"multiplyScalar",value:function multiplyScalar(scalar){for(var _i528=0;_i528<this.ELEMENTS;++_i528){this[_i528]*=scalar;}return this.check();}},{key:"divideScalar",value:function divideScalar(a){return this.multiplyByScalar(1/a);}},{key:"clampScalar",value:function clampScalar(min,max){for(var _i529=0;_i529<this.ELEMENTS;++_i529){this[_i529]=Math.min(Math.max(this[_i529],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 _i530=0;_i530<v.length;++_i530){if(!Number.isFinite(v[_i530])){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 _i531=0;_i531<this.ELEMENTS;++_i531){length+=this[_i531]*this[_i531];}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 _i532=0;_i532<this.ELEMENTS;++_i532){var dist=this[_i532]-mathArray[_i532];length+=dist*dist;}return checkNumber(length);}},{key:"dot",value:function dot(mathArray){var product=0;for(var _i533=0;_i533<this.ELEMENTS;++_i533){product+=this[_i533]*mathArray[_i533];}return checkNumber(product);}},{key:"normalize",value:function normalize(){var length=this.magnitude();if(length!==0){for(var _i534=0;_i534<this.ELEMENTS;++_i534){this[_i534]/=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 _i535=0,_vectors3=vectors;_i535<_vectors3.length;_i535++){var vector=_vectors3[_i535];for(var _i536=0;_i536<this.ELEMENTS;++_i536){this[_i536]*=vector[_i536];}}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 _i537=0,_vectors4=vectors;_i537<_vectors4.length;_i537++){var vector=_vectors4[_i537];for(var _i538=0;_i538<this.ELEMENTS;++_i538){this[_i538]/=vector[_i538];}}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);/**
|
|
24351
24360
|
* Common utilities
|
|
24352
24361
|
* @module glMatrix
|
|
24353
24362
|
*/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);};/**
|
|
@@ -24472,7 +24481,7 @@ out[0]=r[0]+b[0];out[1]=r[1]+b[1];out[2]=r[2]+b[2];return out;}/**
|
|
|
24472
24481
|
* @param {Object} [arg] additional argument to pass to fn
|
|
24473
24482
|
* @returns {Array} a
|
|
24474
24483
|
* @function
|
|
24475
|
-
*/(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
|
|
24484
|
+
*/(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 _this123;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);_this123=_callSuper(this,Vector3,[-0,-0,-0]);if(arguments.length===1&&isArray(x)){_this123.copy(x);}else{if(config.debug){checkNumber(x);checkNumber(y);checkNumber(z);}_this123[0]=x;_this123[1]=y;_this123[2]=z;}return _this123;}_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 _i539=0;_i539<this.ELEMENTS;++_i539){string+=" ".concat(this[_i539]);}}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 _i540=0;_i540<this.RANK;++_i540){result[_i540]=this[firstIndex+_i540];}return result;}},{key:"setColumn",value:function setColumn(columnIndex,columnVector){var firstIndex=columnIndex*this.RANK;for(var _i541=0;_i541<this.RANK;++_i541){this[firstIndex+_i541]=columnVector[_i541];}return this;}}]);}(MathArray);/**
|
|
24476
24485
|
* Transpose the values of a mat3
|
|
24477
24486
|
*
|
|
24478
24487
|
* @param {mat3} out the receiving matrix
|
|
@@ -24526,7 +24535,7 @@ var det=a00*b01+a01*b11+a02*b21;if(!det){return null;}det=1.0/det;out[0]=b01*det
|
|
|
24526
24535
|
* @param {ReadonlyQuat} q Quaternion to create matrix from
|
|
24527
24536
|
*
|
|
24528
24537
|
* @returns {mat3} out
|
|
24529
|
-
*/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 _this123;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);_this123=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this123.copy(array);}else if(args.length>0){_this123.copy([array].concat(args));}else{_this123.identity();}return _this123;}_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(_x78,_x79){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options){var gltfScenegraph,extension,materials,_i604;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context47.next=4;break;}return _context47.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i604=0;_i604<materials.length;_i604++){transformTexCoords(_i604,gltfData);}case 6:case"end":return _context47.stop();}},_callee44);}));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 _mesh5=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh5.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 _i542=0;_i542<accessor.count;_i542++){var uv=new ArrayType(arrayBuffer,byteOffset+_i542*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i542*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(_x80){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData){var gltfScenegraph,json,extension,_iterator44,_step44,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.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 _context48.stop();}},_callee45);}));return _decode$4.apply(this,arguments);}function encode$2(_x81){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData){var gltfScenegraph,json,extension,_iterator45,_step45,light,_node11;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$2(!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 _context49.stop();}},_callee46);}));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(_x82){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData){var gltfScenegraph,json,_iterator46,_step46,material,extension;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.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 _context50.stop();}},_callee47);}));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(_x83){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,techniques,_iterator47,_step47,material,materialExtension;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_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 _context51.stop();}},_callee48);}));return _decode$6.apply(this,arguments);}function encode(_x84,_x85){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData,options){return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:case"end":return _context52.stop();}},_callee49);}));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(_x86){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context53.stop();}},_callee50);}));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(_x87){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltf){var options,context,extensions,_iterator48,_step48,extension,_extension$decode,_args47=arguments;return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:options=_args47.length>1&&_args47[1]!==undefined?_args47[1]:{};context=_args47.length>2?_args47[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator48=_createForOfIteratorHelper(extensions);_context54.prev=4;_iterator48.s();case 6:if((_step48=_iterator48.n()).done){_context54.next=12;break;}extension=_step48.value;_context54.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context54.next=6;break;case 12:_context54.next=17;break;case 14:_context54.prev=14;_context54.t0=_context54["catch"](4);_iterator48.e(_context54.t0);case 17:_context54.prev=17;_iterator48.f();return _context54.finish(17);case 20:case"end":return _context54.stop();}},_callee51,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 _mesh6=_step34.value;this._convertMeshIds(_mesh6);}}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 _this124=this;if(node.children){node.children=node.children.map(function(child){return _this124._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this124._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this125=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this125._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$2(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 _this126=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this126._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this126._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this126._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this126._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this126._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this126._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this126._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this126._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this126._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this126._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 _this127=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this127.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this128=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this128.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=_this128.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 _this129=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]=_this129.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this129.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this129.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 _i543=0;_i543<count;_i543++){var elementOffset=byteOffset+_i543*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i543*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$5(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$5(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$5(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(_x88,_x89){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args48=arguments;return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:byteOffset=_args48.length>2&&_args48[2]!==undefined?_args48[2]:0;options=_args48.length>3?_args48[3]:undefined;context=_args48.length>4?_args48[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)){_context55.next=10;break;}_context55.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);_context55.next=15;return Promise.all(promises);case 15:return _context55.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 _context55.stop();}},_callee52);}));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$2(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$2(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(_x90,_x91,_x92){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltf,options,context){var buffers,_i605,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:buffers=gltf.json.buffers||[];_i605=0;case 2:if(!(_i605<buffers.length)){_context56.next=22;break;}buffer=buffers[_i605];if(!buffer.uri){_context56.next=18;break;}_fetch=context.fetch;assert$2(_fetch);uri=resolveUrl(buffer.uri,options);_context56.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=_context56.sent;_context56.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=_context56.sent;gltf.buffers[_i605]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context56.next=19;break;case 18:if(gltf.buffers[_i605]===null){gltf.buffers[_i605]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i605;_context56.next=2;break;case 22:case"end":return _context56.stop();}},_callee53);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x93,_x94,_x95){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf,options,context){var imageIndices,images,promises,_iterator49,_step49,imageIndex;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.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();}_context57.next=7;return Promise.all(promises);case 7:return _context57.abrupt("return",_context57.sent);case 8:case"end":return _context57.stop();}},_callee54);}));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(_x96,_x97,_x98,_x99,_x100){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context58.next=10;break;}uri=resolveUrl(image.uri,options);_context58.next=5;return fetch(uri);case 5:response=_context58.sent;_context58.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context58.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$2(arrayBuffer,'glTF image has no data');_context58.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context58.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 _context58.stop();}},_callee55);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$5,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(_x101){return _parse.apply(this,arguments);}/**
|
|
24538
|
+
*/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 _this124;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);_this124=_callSuper(this,Matrix3,[-0,-0,-0,-0,-0,-0,-0,-0,-0]);if(arguments.length===1&&Array.isArray(array)){_this124.copy(array);}else if(args.length>0){_this124.copy([array].concat(args));}else{_this124.identity();}return _this124;}_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(_x78,_x79){return _decode$3.apply(this,arguments);}function _decode$3(){_decode$3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee44(gltfData,options){var gltfScenegraph,extension,materials,_i604;return _regeneratorRuntime().wrap(function _callee44$(_context47){while(1)switch(_context47.prev=_context47.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);extension=gltfScenegraph.getExtension(EXT_MESHOPT_TRANSFORM);if(extension){_context47.next=4;break;}return _context47.abrupt("return");case 4:materials=gltfData.json.materials||[];for(_i604=0;_i604<materials.length;_i604++){transformTexCoords(_i604,gltfData);}case 6:case"end":return _context47.stop();}},_callee44);}));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 _mesh5=_step28.value;var _iterator29=_createForOfIteratorHelper(_mesh5.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 _i542=0;_i542<accessor.count;_i542++){var uv=new ArrayType(arrayBuffer,byteOffset+_i542*elementAddressScale,2);scratchVector.set(uv[0],uv[1],1);scratchVector.transformByMatrix3(matrix);result.set([scratchVector[0],scratchVector[1]],_i542*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(_x80){return _decode$4.apply(this,arguments);}function _decode$4(){_decode$4=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee45(gltfData){var gltfScenegraph,json,extension,_iterator44,_step44,_node10,nodeExtension;return _regeneratorRuntime().wrap(function _callee45$(_context48){while(1)switch(_context48.prev=_context48.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 _context48.stop();}},_callee45);}));return _decode$4.apply(this,arguments);}function encode$2(_x81){return _encode$.apply(this,arguments);}function _encode$(){_encode$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee46(gltfData){var gltfScenegraph,json,extension,_iterator45,_step45,light,_node11;return _regeneratorRuntime().wrap(function _callee46$(_context49){while(1)switch(_context49.prev=_context49.next){case 0:gltfScenegraph=new GLTFScenegraph(gltfData);json=gltfScenegraph.json;if(json.lights){extension=gltfScenegraph.addExtension(KHR_LIGHTS_PUNCTUAL);assert$2(!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 _context49.stop();}},_callee46);}));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(_x82){return _decode$5.apply(this,arguments);}function _decode$5(){_decode$5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee47(gltfData){var gltfScenegraph,json,_iterator46,_step46,material,extension;return _regeneratorRuntime().wrap(function _callee47$(_context50){while(1)switch(_context50.prev=_context50.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 _context50.stop();}},_callee47);}));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(_x83){return _decode$6.apply(this,arguments);}function _decode$6(){_decode$6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee48(gltfData){var gltfScenegraph,json,extension,techniques,_iterator47,_step47,material,materialExtension;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_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 _context51.stop();}},_callee48);}));return _decode$6.apply(this,arguments);}function encode(_x84,_x85){return _encode.apply(this,arguments);}function _encode(){_encode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee49(gltfData,options){return _regeneratorRuntime().wrap(function _callee49$(_context52){while(1)switch(_context52.prev=_context52.next){case 0:case"end":return _context52.stop();}},_callee49);}));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(_x86){return _decode.apply(this,arguments);}function _decode(){_decode=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee50(gltfData){var scenegraph;return _regeneratorRuntime().wrap(function _callee50$(_context53){while(1)switch(_context53.prev=_context53.next){case 0:scenegraph=new GLTFScenegraph(gltfData);decodeExtFeatureMetadata(scenegraph);case 2:case"end":return _context53.stop();}},_callee50);}));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(_x87){return _decodeExtensions.apply(this,arguments);}function _decodeExtensions(){_decodeExtensions=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee51(gltf){var options,context,extensions,_iterator48,_step48,extension,_extension$decode,_args47=arguments;return _regeneratorRuntime().wrap(function _callee51$(_context54){while(1)switch(_context54.prev=_context54.next){case 0:options=_args47.length>1&&_args47[1]!==undefined?_args47[1]:{};context=_args47.length>2?_args47[2]:undefined;extensions=EXTENSIONS.filter(function(extension){return useExtension(extension.name,options);});_iterator48=_createForOfIteratorHelper(extensions);_context54.prev=4;_iterator48.s();case 6:if((_step48=_iterator48.n()).done){_context54.next=12;break;}extension=_step48.value;_context54.next=10;return(_extension$decode=extension.decode)===null||_extension$decode===void 0?void 0:_extension$decode.call(extension,gltf,options,context);case 10:_context54.next=6;break;case 12:_context54.next=17;break;case 14:_context54.prev=14;_context54.t0=_context54["catch"](4);_iterator48.e(_context54.t0);case 17:_context54.prev=17;_iterator48.f();return _context54.finish(17);case 20:case"end":return _context54.stop();}},_callee51,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 _mesh6=_step34.value;this._convertMeshIds(_mesh6);}}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 _this125=this;if(node.children){node.children=node.children.map(function(child){return _this125._convertIdToIndex(child,'node');});}if(node.meshes){node.meshes=node.meshes.map(function(mesh){return _this125._convertIdToIndex(mesh,'mesh');});}}},{key:"_convertSceneIds",value:function _convertSceneIds(scene){var _this126=this;if(scene.nodes){scene.nodes=scene.nodes.map(function(node){return _this126._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$2(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 _this127=this;if(json.bufferViews){json.bufferViews=json.bufferViews.map(function(bufView,i){return _this127._resolveBufferView(bufView,i);});}if(json.images){json.images=json.images.map(function(image,i){return _this127._resolveImage(image,i);});}if(json.samplers){json.samplers=json.samplers.map(function(sampler,i){return _this127._resolveSampler(sampler,i);});}if(json.textures){json.textures=json.textures.map(function(texture,i){return _this127._resolveTexture(texture,i);});}if(json.accessors){json.accessors=json.accessors.map(function(accessor,i){return _this127._resolveAccessor(accessor,i);});}if(json.materials){json.materials=json.materials.map(function(material,i){return _this127._resolveMaterial(material,i);});}if(json.meshes){json.meshes=json.meshes.map(function(mesh,i){return _this127._resolveMesh(mesh,i);});}if(json.nodes){json.nodes=json.nodes.map(function(node,i){return _this127._resolveNode(node,i);});}if(json.skins){json.skins=json.skins.map(function(skin,i){return _this127._resolveSkin(skin,i);});}if(json.scenes){json.scenes=json.scenes.map(function(scene,i){return _this127._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 _this128=this;scene.id=scene.id||"scene-".concat(index);scene.nodes=(scene.nodes||[]).map(function(node){return _this128.getNode(node);});return scene;}},{key:"_resolveNode",value:function _resolveNode(node,index){var _this129=this;node.id=node.id||"node-".concat(index);if(node.children){node.children=node.children.map(function(child){return _this129.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=_this129.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 _this130=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]=_this130.getAccessor(attributes[attribute]);}if(primitive.indices!==undefined){primitive.indices=_this130.getAccessor(primitive.indices);}if(primitive.material!==undefined){primitive.material=_this130.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 _i543=0;_i543<count;_i543++){var elementOffset=byteOffset+_i543*byteStride;result.set(new Uint8Array(buffer.arrayBuffer.slice(elementOffset,elementOffset+bytesPerElement)),_i543*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$5(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$5(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$5(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(_x88,_x89){return _parseGLTF$.apply(this,arguments);}function _parseGLTF$(){_parseGLTF$=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee52(gltf,arrayBufferOrString){var _options$gltf,_options$gltf2,_options$gltf3,_options$gltf4,byteOffset,options,context,promises,_promise,promise,_args48=arguments;return _regeneratorRuntime().wrap(function _callee52$(_context55){while(1)switch(_context55.prev=_context55.next){case 0:byteOffset=_args48.length>2&&_args48[2]!==undefined?_args48[2]:0;options=_args48.length>3?_args48[3]:undefined;context=_args48.length>4?_args48[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)){_context55.next=10;break;}_context55.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);_context55.next=15;return Promise.all(promises);case 15:return _context55.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 _context55.stop();}},_callee52);}));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$2(glb.type==='glTF',"Invalid GLB magic string ".concat(glb.type));gltf._glb=glb;gltf.json=glb.json;}else{assert$2(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(_x90,_x91,_x92){return _loadBuffers.apply(this,arguments);}function _loadBuffers(){_loadBuffers=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee53(gltf,options,context){var buffers,_i605,buffer,_context$fetch,_response$arrayBuffer,_fetch,uri,response,arrayBuffer;return _regeneratorRuntime().wrap(function _callee53$(_context56){while(1)switch(_context56.prev=_context56.next){case 0:buffers=gltf.json.buffers||[];_i605=0;case 2:if(!(_i605<buffers.length)){_context56.next=22;break;}buffer=buffers[_i605];if(!buffer.uri){_context56.next=18;break;}_fetch=context.fetch;assert$2(_fetch);uri=resolveUrl(buffer.uri,options);_context56.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=_context56.sent;_context56.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=_context56.sent;gltf.buffers[_i605]={arrayBuffer:arrayBuffer,byteOffset:0,byteLength:arrayBuffer.byteLength};delete buffer.uri;_context56.next=19;break;case 18:if(gltf.buffers[_i605]===null){gltf.buffers[_i605]={arrayBuffer:new ArrayBuffer(buffer.byteLength),byteOffset:0,byteLength:buffer.byteLength};}case 19:++_i605;_context56.next=2;break;case 22:case"end":return _context56.stop();}},_callee53);}));return _loadBuffers.apply(this,arguments);}function loadImages(_x93,_x94,_x95){return _loadImages.apply(this,arguments);}function _loadImages(){_loadImages=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee54(gltf,options,context){var imageIndices,images,promises,_iterator49,_step49,imageIndex;return _regeneratorRuntime().wrap(function _callee54$(_context57){while(1)switch(_context57.prev=_context57.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();}_context57.next=7;return Promise.all(promises);case 7:return _context57.abrupt("return",_context57.sent);case 8:case"end":return _context57.stop();}},_callee54);}));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(_x96,_x97,_x98,_x99,_x100){return _loadImage.apply(this,arguments);}function _loadImage(){_loadImage=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee55(gltf,image,index,options,context){var fetch,parse,arrayBuffer,uri,response,array,parsedImage;return _regeneratorRuntime().wrap(function _callee55$(_context58){while(1)switch(_context58.prev=_context58.next){case 0:fetch=context.fetch,parse=context.parse;if(!(image.uri&&!image.hasOwnProperty('bufferView'))){_context58.next=10;break;}uri=resolveUrl(image.uri,options);_context58.next=5;return fetch(uri);case 5:response=_context58.sent;_context58.next=8;return response.arrayBuffer();case 8:arrayBuffer=_context58.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$2(arrayBuffer,'glTF image has no data');_context58.next=14;return parse(arrayBuffer,[ImageLoader,BasisLoader],{mimeType:image.mimeType,basis:options.basis||{format:selectSupportedBasisFormat()}},context);case 14:parsedImage=_context58.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 _context58.stop();}},_callee55);}));return _loadImage.apply(this,arguments);}var GLTFLoader={name:'glTF',id:'gltf',module:'gltf',version:VERSION$5,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(_x101){return _parse.apply(this,arguments);}/**
|
|
24530
24539
|
* @private
|
|
24531
24540
|
*/function _parse(){_parse=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee56(arrayBuffer){var options,context,_options2,_options2$byteOffset,byteOffset,gltf,_args52=arguments;return _regeneratorRuntime().wrap(function _callee56$(_context59){while(1)switch(_context59.prev=_context59.next){case 0:options=_args52.length>1&&_args52[1]!==undefined?_args52[1]:{};context=_args52.length>2?_args52[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={};_context59.next=8;return parseGLTF$1(gltf,arrayBuffer,byteOffset,options,context);case 8:return _context59.abrupt("return",_context59.sent);case 9:case"end":return _context59.stop();}},_callee56);}));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
|
|
24532
24541
|
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
|
|
@@ -24728,7 +24737,7 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
|
|
|
24728
24737
|
* @param {String} [cfg.id="GLTFLoader"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
24729
24738
|
* @param {Object} [cfg.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
24730
24739
|
* @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.
|
|
24731
|
-
*/function GLTFLoaderPlugin(viewer){var
|
|
24740
|
+
*/function GLTFLoaderPlugin(viewer){var _this131;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,GLTFLoaderPlugin);_this131=_callSuper(this,GLTFLoaderPlugin,["GLTFLoader",viewer,cfg]);_this131._sceneModelLoader=new GLTFSceneModelLoader(_this131,cfg);_this131.dataSource=cfg.dataSource;_this131.objectDefaults=cfg.objectDefaults;return _this131;}/**
|
|
24732
24741
|
* Sets a custom data source through which the GLTFLoaderPlugin can load metadata, glTF and binary attachments.
|
|
24733
24742
|
*
|
|
24734
24743
|
* Default value is {@link GLTFDefaultDataSource}, which loads via an XMLHttpRequest.
|
|
@@ -24780,9 +24789,9 @@ if(rtcNeeded){meshCfg.origin=origin;}ctx.sceneModel.createMesh(meshCfg);meshIds.
|
|
|
24780
24789
|
* @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
|
|
24781
24790
|
* @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.
|
|
24782
24791
|
* @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}
|
|
24783
|
-
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var
|
|
24792
|
+
*/,set:function set(value){this._objectDefaults=value||IFCObjectDefaults;}},{key:"load",value:function load(){var _this132=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
|
|
24784
24793
|
if(!params.src&&!params.gltf){this.error("load() param expected: src or gltf");return sceneModel;// Return new empty model
|
|
24785
|
-
}if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){
|
|
24794
|
+
}if(params.metaModelSrc||params.metaModelJSON){var processMetaModelJSON=function processMetaModelJSON(metaModelJSON){_this132.viewer.metaScene.createMetaModel(modelId,metaModelJSON,{});_this132.viewer.scene.canvas.spinner.processes--;if(params.src){_this132._sceneModelLoader.load(_this132,params.src,metaModelJSON,params,sceneModel);}else{_this132._sceneModelLoader.parse(_this132,params.gltf,metaModelJSON,params,sceneModel);}};if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this.viewer.scene.canvas.spinner.processes++;this._dataSource.getMetaModel(metaModelSrc,function(metaModelJSON){_this132.viewer.scene.canvas.spinner.processes--;processMetaModelJSON(metaModelJSON);},function(errMsg){_this132.error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));_this132.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(){_this132.viewer.metaScene.destroyMetaModel(modelId);});return sceneModel;}/**
|
|
24786
24795
|
* Destroys this GLTFLoaderPlugin.
|
|
24787
24796
|
*/},{key:"destroy",value:function destroy(){_superPropGet(GLTFLoaderPlugin,"destroy",this,3)([]);}}]);}(Plugin);/**
|
|
24788
24797
|
* @private
|
|
@@ -24913,14 +24922,14 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
|
|
|
24913
24922
|
* @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.
|
|
24914
24923
|
* @param {Boolean} [cfg.isProjectNorth] sets whether the NavCube switches between true north and project north - using the project north offset angle.
|
|
24915
24924
|
* @param {number} [cfg.projectNorthOffsetAngle] sets the NavCube project north offset angle - when the {@link isProjectNorth} is true.
|
|
24916
|
-
*/function NavCubePlugin(viewer){var
|
|
24917
|
-
}catch(error){
|
|
24918
|
-
navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;
|
|
24925
|
+
*/function NavCubePlugin(viewer){var _this133;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this133=_callSuper(this,NavCubePlugin,["NavCube",viewer,cfg]);viewer.navCube=_this133;var visible=true;try{_this133._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});_this133._navCubeCanvas=_this133._navCubeScene.canvas.canvas;_this133._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
|
|
24926
|
+
}catch(error){_this133.error(error);return _possibleConstructorReturn(_this133);}var navCubeScene=_this133._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"});_this133._navCubeCamera=navCubeScene.camera;_this133._navCubeCamera.ortho.scale=7.0;_this133._navCubeCamera.ortho.near=0.1;_this133._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
|
|
24927
|
+
navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this133._zUp=Boolean(viewer.camera.zUp);var self=_this133;_this133.mousedown=false;_this133.mouseover=false;_this133.setIsProjectNorth(cfg.isProjectNorth);_this133.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this133.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;});_this133._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
|
|
24919
24928
|
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
|
|
24920
|
-
self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);self._navCubeCamera.up=up*(viewerNormalUp?1:-1);}};}();
|
|
24929
|
+
self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);self._navCubeCamera.up=up*(viewerNormalUp?1:-1);}};}();_this133._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this133._cubeSampler=new Texture(navCubeScene,{image:_this133._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this133._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:_this133._cubeSampler,emissiveMap:_this133._cubeSampler}),visible:!!visible,edges:true});_this133._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});_this133._onCameraMatrix=viewer.camera.on("matrix",_this133._synchCamera);_this133._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this133._zUp=true;_this133._cubeTextureCanvas.setZUp();_this133._repaint();_this133._synchCamera();}else if(viewer.camera.yUp){_this133._zUp=false;_this133._cubeTextureCanvas.setYUp();_this133._repaint();_this133._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this133._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this133._synchProjection){_this133._navCubeCamera.perspective.fov=fov;}});_this133._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this133._synchProjection){_this133._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
|
|
24921
24930
|
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";
|
|
24922
24931
|
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";
|
|
24923
|
-
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=
|
|
24932
|
+
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=_this133.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);}};}();}_this133._onUpdated=viewer.localeService.on("updated",function(){_this133._cubeTextureCanvas.clear();_this133._repaint();});_this133.setVisible(cfg.visible);_this133.setCameraFitFOV(cfg.cameraFitFOV);_this133.setCameraFly(cfg.cameraFly);_this133.setCameraFlyDuration(cfg.cameraFlyDuration);_this133.setFitVisible(cfg.fitVisible);_this133.setSynchProjection(cfg.synchProjection);return _this133;}_inherits(NavCubePlugin,_Plugin7);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId){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,function(){// document.body.style.cursor = "pointer";
|
|
24924
24933
|
});}}}},{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
|
|
24925
24934
|
break;}}},{key:"_repaint",value:function _repaint(){var image=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=image;this._cubeMesh.material.emissiveMap.image=image;}/**
|
|
24926
24935
|
* Sets if the NavCube is visible.
|
|
@@ -25033,7 +25042,7 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
|
|
|
25033
25042
|
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
|
25034
25043
|
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
|
25035
25044
|
* @private
|
|
25036
|
-
*/return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var
|
|
25045
|
+
*/return _createClass(Control,[{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this134=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(){_this134._setPos(_this134._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this134._ignoreNextSectionPlaneDirUpdate){_this134._setDir(_this134._sectionPlane.dir);}else{_this134._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
|
|
25037
25046
|
* Gets the {@link SectionPlane} controlled by this Control.
|
|
25038
25047
|
* @returns {SectionPlane} The SectionPlane.
|
|
25039
25048
|
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
@@ -25164,10 +25173,10 @@ yAxisArrow:rootNode.addChild(new Mesh(rootNode,{geometry:shapes.arrowHead,materi
|
|
|
25164
25173
|
//----------------------------------------------------------------------------------------------------------
|
|
25165
25174
|
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
|
|
25166
25175
|
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
|
|
25167
|
-
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
|
|
25176
|
+
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 _this135=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.
|
|
25168
25177
|
var dragAction=null;// Action we're doing while we drag an arrow or hoop.
|
|
25169
25178
|
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
|
|
25170
|
-
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,
|
|
25179
|
+
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,_this135._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){// 如果有触摸事件,使用第一个触摸点的坐标
|
|
25171
25180
|
canvasPos[0]=event.touches[0].pageX;canvasPos[1]=event.touches[0].pageY;}else{// 否则,假设是鼠标事件
|
|
25172
25181
|
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
|
|
25173
25182
|
var planeNormal=getTranslationPlane(worldAxis,fromMouse,toMouse);getPointerPlaneIntersect(fromMouse,planeNormal,p1,1);// Ensure plane moves closer to camera so angles become workable
|
|
@@ -25177,25 +25186,25 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
|
|
|
25177
25186
|
var rayO=camera.eye;// The direction
|
|
25178
25187
|
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25179
25188
|
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);// << ---
|
|
25180
|
-
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(!
|
|
25189
|
+
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(!_this135._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this135._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this135._displayMeshes.xAxisHandle.id:affordanceMesh=_this135._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this135._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this135._displayMeshes.yShaftHandle.id:affordanceMesh=_this135._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this135._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this135._displayMeshes.zAxisHandle.id:affordanceMesh=_this135._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this135._displayMeshes.xCurveHandle.id:affordanceMesh=_this135._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this135._displayMeshes.yCurveHandle.id:affordanceMesh=_this135._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
|
|
25181
25190
|
// affordanceMesh = this._affordanceMeshes.zHoop;
|
|
25182
25191
|
// nextDragAction = DRAG_ACTIONS.zRotate;
|
|
25183
25192
|
// break;
|
|
25184
25193
|
default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25185
|
-
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!
|
|
25186
|
-
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25187
|
-
down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];
|
|
25188
|
-
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!
|
|
25189
|
-
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!
|
|
25190
|
-
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!
|
|
25194
|
+
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this135._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
|
|
25195
|
+
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this135._visible||!grabbed)return;_this135._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
|
|
25196
|
+
down=true;var canvasPos=getClickCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this135.plugin.fire("clickPlaneStart");break;}});//mousemove
|
|
25197
|
+
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this135._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
|
|
25198
|
+
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this135._visible)return;_this135._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this135.plugin.fire("clickPlaneEnd");});//wheel
|
|
25199
|
+
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this135._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(!_this135._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this135._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this135._displayMeshes.xAxisHandle.id:affordanceMesh=_this135._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this135._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this135._displayMeshes.yShaftHandle.id:affordanceMesh=_this135._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this135._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this135._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this135._displayMeshes.zAxisHandle.id:affordanceMesh=_this135._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this135._displayMeshes.xCurveHandle.id:affordanceMesh=_this135._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this135._displayMeshes.yCurveHandle.id:affordanceMesh=_this135._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
|
|
25191
25200
|
// affordanceMesh = this._affordanceMeshes.zHoop;
|
|
25192
25201
|
// nextDragAction = DRAG_ACTIONS.zRotate;
|
|
25193
25202
|
// break;
|
|
25194
25203
|
default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25195
25204
|
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
|
|
25196
|
-
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25197
|
-
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!
|
|
25198
|
-
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
25205
|
+
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this135._visible||!grabbed)return;_this135._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this135.plugin.fire("touchPlaneStart");});//touchmove
|
|
25206
|
+
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this135._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
|
|
25207
|
+
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this135._visible)return;_this135._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this135.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);/**
|
|
25199
25208
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
25200
25209
|
*
|
|
25201
25210
|
* @private
|
|
@@ -25428,7 +25437,7 @@ geometry:shapes.hoop,material:materials.blue,highlighted:true,highlightMaterial:
|
|
|
25428
25437
|
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
|
25429
25438
|
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
|
25430
25439
|
* @private
|
|
25431
|
-
*/},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var
|
|
25440
|
+
*/},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var _this136=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(){_this136._setPos(_this136._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this136._ignoreNextSectionPlaneDirUpdate){_this136._setDir(_this136._sectionPlane.dir);}else{_this136._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
|
|
25432
25441
|
* Gets the {@link SectionPlane} controlled by this Control.
|
|
25433
25442
|
* @returns {SectionPlane} The SectionPlane.
|
|
25434
25443
|
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
@@ -25456,10 +25465,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
|
|
|
25456
25465
|
* Sets if this Control is culled. This is called by SectionPlanesPlugin to
|
|
25457
25466
|
* temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
|
|
25458
25467
|
* @param culled
|
|
25459
|
-
*/},{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
|
|
25468
|
+
*/},{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 _this137=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.
|
|
25460
25469
|
var dragAction=null;// Action we're doing while we drag an arrow or hoop.
|
|
25461
25470
|
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
|
|
25462
|
-
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,
|
|
25471
|
+
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,_this137._pos,_tempVec3a2)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = 0.07 * worldSize;
|
|
25463
25472
|
// rootNode.scale = [size, size, size];
|
|
25464
25473
|
lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
|
|
25465
25474
|
// rootNode.scale = [size, size, size];
|
|
@@ -25473,24 +25482,24 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
|
|
|
25473
25482
|
var rayO=camera.eye;// The direction
|
|
25474
25483
|
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25475
25484
|
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);// << ---
|
|
25476
|
-
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(!
|
|
25485
|
+
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(!_this137._visible){return;}if(down){return;}grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this137._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this137._displayMeshes.xAxisHandle.id:affordanceMesh=_this137._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this137._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this137._displayMeshes.yShaftHandle.id:affordanceMesh=_this137._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this137._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this137._displayMeshes.zAxisHandle.id:affordanceMesh=_this137._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this137._displayMeshes.xCurveHandle.id:affordanceMesh=_this137._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this137._displayMeshes.yCurveHandle.id:affordanceMesh=_this137._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
|
|
25477
25486
|
// affordanceMesh = this._affordanceMeshes.zHoop;
|
|
25478
25487
|
// nextDragAction = DRAG_ACTIONS.zRotate;
|
|
25479
25488
|
// break;
|
|
25480
25489
|
default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25481
|
-
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!
|
|
25482
|
-
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25483
|
-
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!
|
|
25484
|
-
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!
|
|
25485
|
-
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!
|
|
25490
|
+
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this137._visible){return;}if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
|
|
25491
|
+
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this137._visible||!grabbed)return;_this137._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];_this137.plugin.fire("clickPlaneStart");break;}});//mousemove
|
|
25492
|
+
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this137._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
|
|
25493
|
+
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this137._visible)return;_this137._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this137.plugin.fire("clickPlaneEnd");});//wheel
|
|
25494
|
+
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!_this137._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(!_this137._visible||down||grabbed)return;grabbed=false;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this137._displayMeshes.xAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this137._displayMeshes.xAxisHandle.id:affordanceMesh=_this137._affordanceMeshes.xAxisArrow;nextDragAction=DRAG_ACTIONS.xTranslate;break;case _this137._displayMeshes.yAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this137._displayMeshes.yShaftHandle.id:affordanceMesh=_this137._affordanceMeshes.yAxisArrow;nextDragAction=DRAG_ACTIONS.yTranslate;break;case _this137._displayMeshes.zAxisArrowHandle.id:affordanceMesh=_this137._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this137._displayMeshes.zAxisHandle.id:affordanceMesh=_this137._affordanceMeshes.zAxisArrow;nextDragAction=DRAG_ACTIONS.zTranslate;break;case _this137._displayMeshes.xCurveHandle.id:affordanceMesh=_this137._affordanceMeshes.xHoop;nextDragAction=DRAG_ACTIONS.xRotate;break;case _this137._displayMeshes.yCurveHandle.id:affordanceMesh=_this137._affordanceMeshes.yHoop;nextDragAction=DRAG_ACTIONS.yRotate;break;// case this._displayMeshes.zCurveHandle.id:
|
|
25486
25495
|
// affordanceMesh = this._affordanceMeshes.zHoop;
|
|
25487
25496
|
// nextDragAction = DRAG_ACTIONS.zRotate;
|
|
25488
25497
|
// break;
|
|
25489
25498
|
default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25490
25499
|
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});//touchstart
|
|
25491
|
-
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25492
|
-
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!
|
|
25493
|
-
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
25500
|
+
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this137._visible||!grabbed)return;_this137._viewer.cameraControl.pointerEnabled=false;down=true;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this137.plugin.fire("touchPlaneStart");});//touchmove
|
|
25501
|
+
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this137._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
|
|
25502
|
+
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this137._visible)return;_this137._viewer.cameraControl.pointerEnabled=true;if(lastAffordanceMesh){lastAffordanceMesh.visible=false;}lastAffordanceMesh=null;nextDragAction=DRAG_ACTIONS.none;down=false;grabbed=false;_this137.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);/**
|
|
25494
25503
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
25495
25504
|
*
|
|
25496
25505
|
* @private
|
|
@@ -25562,7 +25571,7 @@ width/2,-height/2,0.012,// 右下角
|
|
|
25562
25571
|
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
|
25563
25572
|
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
|
25564
25573
|
* @private
|
|
25565
|
-
*/},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var
|
|
25574
|
+
*/},{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.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(){_this138._setPos(_this138._sectionPlane.pos);});this._onSectionPlaneDir=sectionPlane.on("dir",function(){if(!_this138._ignoreNextSectionPlaneDirUpdate){_this138._setDir(_this138._sectionPlane.dir);}else{_this138._ignoreNextSectionPlaneDirUpdate=false;}});}}/**
|
|
25566
25575
|
* Gets the {@link SectionPlane} controlled by this Control.
|
|
25567
25576
|
* @returns {SectionPlane} The SectionPlane.
|
|
25568
25577
|
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
@@ -25590,7 +25599,7 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
|
|
|
25590
25599
|
* Sets if this Control is culled. This is called by SectionPlanesPlugin to
|
|
25591
25600
|
* temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
|
|
25592
25601
|
* @param culled
|
|
25593
|
-
*/},{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
|
|
25602
|
+
*/},{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 _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};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.
|
|
25594
25603
|
var dragAction=null;// Action we're doing while we drag an arrow or hoop.
|
|
25595
25604
|
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]);
|
|
25596
25605
|
// let lastDist = -1;
|
|
@@ -25617,14 +25626,14 @@ var dragTranslateSectionPlane=function(){var p1=math.vec3();var p2=math.vec3();v
|
|
|
25617
25626
|
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
|
|
25618
25627
|
var rayO=camera.eye;// The direction
|
|
25619
25628
|
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25620
|
-
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(!
|
|
25621
|
-
}if(affordanceMesh){affordanceMesh.visible=true;}lastAffordanceMesh=affordanceMesh;grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!
|
|
25622
|
-
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25629
|
+
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(!_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.plane.id:affordanceMesh=_this139._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25630
|
+
}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;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
|
|
25631
|
+
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
|
|
25623
25632
|
down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
|
|
25624
|
-
dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];
|
|
25625
|
-
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!
|
|
25626
|
-
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!
|
|
25627
|
-
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!
|
|
25633
|
+
dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this139.plugin.fire("clickPlaneStart");break;}});//mousemove
|
|
25634
|
+
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;}lastCanvasPos[0]=x;lastCanvasPos[1]=y;});//mouseup
|
|
25635
|
+
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this139._visible)return;_this139._viewer.cameraControl.pointerEnabled=true;if(!down){return;}down=false;grabbed=false;_this139.plugin.fire("clickPlaneEnd");});//wheel
|
|
25636
|
+
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;}});}}},{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);/**
|
|
25628
25637
|
* Controls a {@link SectionPlane} with mouse and touch input.
|
|
25629
25638
|
*
|
|
25630
25639
|
* @private
|
|
@@ -25707,7 +25716,7 @@ width/2,-height/2,0.02,// 右下角
|
|
|
25707
25716
|
* SectionPlanesPlugin keeps SectionPlaneControls in a reuse pool.
|
|
25708
25717
|
* Call with a null or undefined value to disconnect the Control ffrom whatever SectionPlane it was assigned to.
|
|
25709
25718
|
* @private
|
|
25710
|
-
*/},{key:"_setSectionPlane",value:function _setSectionPlane(sectionPlane){var
|
|
25719
|
+
*/},{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.id;this._setPos(sectionPlane.pos);this._setDir(sectionPlane.dir);this._sectionPlane=sectionPlane;sectionPlane.control=this;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;}});}}/**
|
|
25711
25720
|
* Gets the {@link SectionPlane} controlled by this Control.
|
|
25712
25721
|
* @returns {SectionPlane} The SectionPlane.
|
|
25713
25722
|
*/},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
|
|
@@ -25735,10 +25744,10 @@ posRate=Math.max(0,Math.min(100,posRate));return parseInt(posRate);}/** @private
|
|
|
25735
25744
|
* Sets if this Control is culled. This is called by SectionPlanesPlugin to
|
|
25736
25745
|
* temporarily hide the Control while a snapshot is being taken by Viewer#getSnapshot().
|
|
25737
25746
|
* @param culled
|
|
25738
|
-
*/},{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
|
|
25747
|
+
*/},{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};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.
|
|
25739
25748
|
var dragAction=null;// Action we're doing while we drag an arrow or hoop.
|
|
25740
25749
|
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
|
|
25741
|
-
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,
|
|
25750
|
+
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,_this141._pos,_tempVec3a3)));if(dist!==lastDist){if(camera.projection==="perspective"){Math.tan(camera.perspective.fov*math.DEGTORAD)*dist;// const size = this._controlSize * worldSize;
|
|
25742
25751
|
// rootNode.scale = [size, size, size];
|
|
25743
25752
|
lastDist=dist;}}if(camera.projection==="ortho"){camera.ortho.scale/10;// const size = worldSize;
|
|
25744
25753
|
// rootNode.scale = [size, size, size];
|
|
@@ -25751,23 +25760,23 @@ math.inverseMat4(matrix);math.transformVec4(matrix,dir,dir);math.mulVec4Scalar(d
|
|
|
25751
25760
|
var rayO=camera.eye;// The direction
|
|
25752
25761
|
math.subVec4(dir,rayO,dir);var origin=self._sectionPlane.pos;// Plane origin:
|
|
25753
25762
|
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;
|
|
25754
|
-
this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!
|
|
25763
|
+
this._onCameraControlHover=this._viewer.cameraControl.on("hoverEnter",function(hit){if(!_this141._visible){return;}if(down){return;}grabbed=false;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.plane.id:// affordanceMesh = this._affordanceMeshes.plane;
|
|
25755
25764
|
nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25756
|
-
}grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!
|
|
25757
|
-
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25765
|
+
}grabbed=true;});this._onCameraControlHoverLeave=this._viewer.cameraControl.on("hoverOut",function(hit){if(!_this141._visible){return;}nextDragAction=DRAG_ACTIONS.none;grabbed=false;});//mousedown
|
|
25766
|
+
canvas.addEventListener("mousedown",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed)return;_this141._viewer.cameraControl.pointerEnabled=false;switch(e.which){case 1:// Left button
|
|
25758
25767
|
down=true;var canvasPos=getClickCoordsWithinElement(e);//获取鼠标点击对应坐标
|
|
25759
|
-
dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];
|
|
25760
|
-
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!
|
|
25761
|
-
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!
|
|
25762
|
-
canvas.addEventListener("wheel",this._canvasWheelListener=function(e){if(!
|
|
25768
|
+
dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("clickPlaneStart");break;}});//mousemove
|
|
25769
|
+
canvas.addEventListener("mousemove",this._canvasMouseMoveListener=function(e){if(!_this141._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
|
|
25770
|
+
canvas.addEventListener("mouseup",this._canvasMouseUpListener=function(e){if(!_this141._visible)return;_this141._viewer.cameraControl.pointerEnabled=true;if(!down){return;}switch(e.which){}down=false;grabbed=false;_this141.plugin.fire("clickPlaneEnd");});//wheel
|
|
25771
|
+
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;var affordanceMesh;var meshId=hit.entity.id;switch(meshId){case _this141._displayMeshes.plane.id:affordanceMesh=_this141._affordanceMeshes.plane;nextDragAction=DRAG_ACTIONS.zTranslate;break;default:nextDragAction=DRAG_ACTIONS.none;return;// Not clicked an arrow or hoop
|
|
25763
25772
|
}if(affordanceMesh){affordanceMesh.visible=true;}grabbed=true;down=true;});//touchstart
|
|
25764
|
-
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!
|
|
25765
|
-
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!
|
|
25766
|
-
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
25773
|
+
canvas.addEventListener("touchstart",this._canvasMouseDownListener=function(e){e.preventDefault();if(!_this141._visible||!grabbed||!down)return;_this141._viewer.cameraControl.pointerEnabled=false;var canvasPos=getTouchCoordsWithinElement(e);dragAction=nextDragAction;lastCanvasPos[0]=canvasPos[0];lastCanvasPos[1]=canvasPos[1];_this141.plugin.fire("touchPlaneStart");});//touchmove
|
|
25774
|
+
canvas.addEventListener("touchmove",this._canvasMouseMoveListener=function(e){if(!_this141._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
|
|
25775
|
+
canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!_this141._visible)return;if(grabbed)_this141._viewer.cameraControl.pointerEnabled=true;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={};}}]);}();/**
|
|
25767
25776
|
* Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
|
|
25768
25777
|
*
|
|
25769
25778
|
* @private
|
|
25770
|
-
*/var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var
|
|
25779
|
+
*/var Plane=/*#__PURE__*/function(){/** @private */function Plane(overview,overviewScene,sectionPlane){var _this142=this;_classCallCheck(this,Plane);/**
|
|
25771
25780
|
* The ID of this SectionPlanesOverviewPlane.
|
|
25772
25781
|
*
|
|
25773
25782
|
* @type {String}
|
|
@@ -25775,7 +25784,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
|
25775
25784
|
* The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
|
|
25776
25785
|
*
|
|
25777
25786
|
* @type {SectionPlane}
|
|
25778
|
-
*/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=
|
|
25787
|
+
*/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=_this142._sectionPlane.scene.center;var negDir=[-_this142._sectionPlane.dir[0],-_this142._sectionPlane.dir[1],-_this142._sectionPlane.dir[2]];math.subVec3(origin,_this142._sectionPlane.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec,_this142._sectionPlane.dir,_quat);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this142._mesh.quaternion=quaternion;_this142._mesh.position=pos3;};this._onSectionPlanePos=this._sectionPlane.on("pos",update);this._onSectionPlaneDir=this._sectionPlane.on("dir",update);// update();
|
|
25779
25788
|
}this._highlighted=false;this._selected=false;}/**
|
|
25780
25789
|
* Sets if this SectionPlanesOverviewPlane is highlighted.
|
|
25781
25790
|
*
|
|
@@ -25801,7 +25810,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
|
25801
25810
|
* Renders a 3D plane within an {@link Overview} to indicate its {@link SectionPlane}'s current position and orientation.
|
|
25802
25811
|
*
|
|
25803
25812
|
* @private
|
|
25804
|
-
*/var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var
|
|
25813
|
+
*/var Box=/*#__PURE__*/function(){/** @private */function Box(overview,overviewScene,sectionBox){var _this143=this;_classCallCheck(this,Box);/**
|
|
25805
25814
|
* The ID of this SectionPlanesOverviewPlane.
|
|
25806
25815
|
*
|
|
25807
25816
|
* @type {String}
|
|
@@ -25809,7 +25818,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
|
25809
25818
|
* The {@link SectionPlane} represented by this SectionPlanesOverviewPlane.
|
|
25810
25819
|
*
|
|
25811
25820
|
* @type {SectionPlane}
|
|
25812
|
-
*/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=
|
|
25821
|
+
*/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=_this143._sectionBox.scene.center;var negDir=[-_this143._sectionBox.dir[0],-_this143._sectionBox.dir[1],-_this143._sectionBox.dir[2]];math.subVec3(origin,_this143._sectionBox.pos,vec);var dist=-math.dotVec3(negDir,vec);math.normalizeVec3(negDir);math.mulVec3Scalar(negDir,dist,pos2);var quaternion=math.vec3PairToQuaternion(_zeroVec2,_this143._sectionBox.dir,_quat2);pos3[0]=pos2[0]*0.1;pos3[1]=pos2[1]*0.1;pos3[2]=pos2[2]*0.1;_this143._mesh.quaternion=quaternion;_this143._mesh.position=pos3;};this._onSectionPlanePos=this._sectionBox.on("pos",update);this._onSectionPlaneDir=this._sectionBox.on("dir",update);// update();
|
|
25813
25822
|
}this._highlighted=false;this._selected=false;}/**
|
|
25814
25823
|
* Sets if this SectionPlanesOverviewPlane is highlighted.
|
|
25815
25824
|
*
|
|
@@ -25842,7 +25851,7 @@ canvas.addEventListener("touchend",this._canvasTouchEndListener=function(e){if(!
|
|
|
25842
25851
|
* @private
|
|
25843
25852
|
*/var Overview=/*#__PURE__*/function(){/**
|
|
25844
25853
|
* @private
|
|
25845
|
-
*/function Overview(plugin,cfg){var
|
|
25854
|
+
*/function Overview(plugin,cfg){var _this144=this;_classCallCheck(this,Overview);if(!cfg.onHoverEnterPlane||!cfg.onHoverLeavePlane||!cfg.onClickedNothing||!cfg.onClickedPlane){throw"Missing config(s): onHoverEnterPlane, onHoverLeavePlane, onClickedNothing || onClickedPlane";}/**
|
|
25846
25855
|
* The {@link SectionPlanesPlugin} that owns this SectionPlanesOverview.
|
|
25847
25856
|
*
|
|
25848
25857
|
* @type {SectionPlanesPlugin}
|
|
@@ -25855,12 +25864,12 @@ this._canvas=cfg.overviewCanvas;//----------------------------------------------
|
|
|
25855
25864
|
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;//--------------------------------------------------------------------------------------------------------------
|
|
25856
25865
|
// Synchronize overview scene camera with viewer camera
|
|
25857
25866
|
//--------------------------------------------------------------------------------------------------------------
|
|
25858
|
-
{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=
|
|
25867
|
+
{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=_this144._viewer.camera.eye;var look=_this144._viewer.camera.look;var up=_this144._viewer.camera.up;math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,_eyeLookVec3)),7);if(_this144._zUp){// +Z up
|
|
25859
25868
|
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
|
|
25860
|
-
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){
|
|
25869
|
+
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){_this144._scene.camera.perspective.fov=fov;});//--------------------------------------------------------------------------------------------------------------
|
|
25861
25870
|
// Bind overview canvas events
|
|
25862
25871
|
//--------------------------------------------------------------------------------------------------------------
|
|
25863
|
-
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=
|
|
25872
|
+
{var hoveredEntity=null;this._onInputMouseMove=this._scene.input.on("mousemove",function(coords){var hit=_this144._scene.pick({canvasPos:coords});if(hit){if(!hoveredEntity||hit.entity.id!==hoveredEntity.id){if(hoveredEntity){var _plane=_this144._planes[hoveredEntity.id];if(_plane){_this144._onHoverLeavePlane(hoveredEntity.id);}}hoveredEntity=hit.entity;var plane=_this144._planes[hoveredEntity.id];if(plane){_this144._onHoverEnterPlane(hoveredEntity.id);}}}else{if(hoveredEntity){_this144._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}}});this._scene.canvas.canvas.addEventListener("mouseup",this._onCanvasMouseUp=function(){if(hoveredEntity){var plane=_this144._planes[hoveredEntity.id];if(plane){_this144._onClickedPlane(hoveredEntity.id);}}else{_this144._onClickedNothing();}});this._scene.canvas.canvas.addEventListener("mouseout",this._onCanvasMouseOut=function(){if(hoveredEntity){_this144._onHoverLeavePlane(hoveredEntity.id);hoveredEntity=null;}});}//--------------------------------------------------------------------------------------------------------------
|
|
25864
25873
|
// Configure overview
|
|
25865
25874
|
//--------------------------------------------------------------------------------------------------------------
|
|
25866
25875
|
this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSectionPlane()
|
|
@@ -25979,10 +25988,10 @@ var newgeo=buildBoxLinesGeometry({center:center,xSize:(a>0?a:-1*a)*num+0.2,ySize
|
|
|
25979
25988
|
* @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
25980
25989
|
* @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
|
|
25981
25990
|
* @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
|
|
25982
|
-
*/function SectionPlanesPlugin(viewer){var
|
|
25991
|
+
*/function SectionPlanesPlugin(viewer){var _this145;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this145=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this145._freeControls=[];_this145._controlBox=null;_this145._singleCtrlBox=null;_this145._sectionWay=null;_this145._sectionPlanes=viewer.scene.sectionPlanes;_this145._controls={};_this145._currentControl=null;_this145._shownControlId=null;_this145._shownControlIds=[];_this145._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){_this145.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this145._overview=new Overview(_this145,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this145._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this145._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this145.getShownControl()===id){_this145.hideControl();return;}_this145.showControl(id);var sectionPlane=_this145.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB.set(_this145.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];_this145.viewer.cameraFlight.flyTo({aabb:tempAABB,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this145.hideControl();}});}}_this145._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
|
|
25983
25992
|
// instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
|
|
25984
25993
|
// by BCFViewpointsPlugin#loadViewpoint().
|
|
25985
|
-
|
|
25994
|
+
_this145._sectionPlaneCreated(sectionPlane);});_this145._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this145._controlBox=sectionBox;});_this145.controlset=cfg.controlset;return _this145;}/**
|
|
25986
25995
|
* Sets if the overview canvas is visible.
|
|
25987
25996
|
*
|
|
25988
25997
|
* @param {Boolean} visible Whether or not the overview canvas is visible.
|
|
@@ -26008,7 +26017,7 @@ _this144._sectionPlaneCreated(sectionPlane);});_this144._onSceneSectionBoxCreate
|
|
|
26008
26017
|
*/},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&¶ms.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,
|
|
26009
26018
|
// which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
|
|
26010
26019
|
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;}//剖切面创建后,创建一个控制器
|
|
26011
|
-
},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var
|
|
26020
|
+
},{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this146=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(){_this146._sectionPlaneDestroyed(sectionPlane);});}/**
|
|
26012
26021
|
* 设置是否是触屏模式
|
|
26013
26022
|
* @param {boolean} touch
|
|
26014
26023
|
*/},{key:"isTouch",set:function set(touch){this._isTouch=touch;if(touch===true)this.sectionWay="plane";else this.sectionWay=this._sectionWay?this._sectionWay:"control";}/**
|
|
@@ -26393,7 +26402,7 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
|
|
|
26393
26402
|
* @param {Object} cfg Plugin configuration.
|
|
26394
26403
|
* @param {String} [cfg.id="StoreyViews"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
26395
26404
|
* @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.
|
|
26396
|
-
*/function StoreyViewsPlugin(viewer){var
|
|
26405
|
+
*/function StoreyViewsPlugin(viewer){var _this147;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,StoreyViewsPlugin);_this147=_callSuper(this,StoreyViewsPlugin,["StoreyViews",viewer]);_this147._objectsMemento=new ObjectsMemento();_this147._cameraMemento=new CameraMemento();/**
|
|
26397
26406
|
* A {@link Storey} for each ````IfcBuildingStorey```.
|
|
26398
26407
|
*
|
|
26399
26408
|
* There will be a {@link Storey} for every existing {@link MetaObject} whose {@link MetaObject#type} equals "IfcBuildingStorey".
|
|
@@ -26401,13 +26410,13 @@ for(var _id4 in this._controls){if(this._controls.hasOwnProperty(_id4)){this._co
|
|
|
26401
26410
|
* These are created and destroyed automatically as models are loaded and destroyed.
|
|
26402
26411
|
*
|
|
26403
26412
|
* @type {{String:Storey}}
|
|
26404
|
-
*/
|
|
26413
|
+
*/_this147.storeys={};/**
|
|
26405
26414
|
* A set of {@link Storey}s for each {@link MetaModel}.
|
|
26406
26415
|
*
|
|
26407
26416
|
* These are created and destroyed automatically as models are loaded and destroyed.
|
|
26408
26417
|
*
|
|
26409
26418
|
* @type {{String: {String:Storey}}}
|
|
26410
|
-
*/
|
|
26419
|
+
*/_this147.modelStoreys={};_this147._fitStoreyMaps=!!cfg.fitStoreyMaps;_this147._onModelLoaded=_this147.viewer.scene.on("modelLoaded",function(modelId){_this147._registerModelStoreys(modelId);_this147.fire("storeys",_this147.storeys);});return _this147;}_inherits(StoreyViewsPlugin,_Plugin9);return _createClass(StoreyViewsPlugin,[{key:"_registerModelStoreys",value:function _registerModelStoreys(modelId){var _this148=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 _i551=0,len=storeyIds.length;_i551<len;_i551++){var storeyId=storeyIds[_i551];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(){_this148._deregisterModelStoreys(modelId);_this148.fire("storeys",_this148.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];}}/**
|
|
26411
26420
|
* 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
|
|
26412
26421
|
* floor map images. If false, each floor map image will display the model's extents, ensuring a consistent scale across all images.
|
|
26413
26422
|
* @returns {*|boolean}
|
|
@@ -26548,7 +26557,7 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
26548
26557
|
* });
|
|
26549
26558
|
*
|
|
26550
26559
|
* @class SkyboxesPlugin
|
|
26551
|
-
*/var SkyboxesPlugin=/*#__PURE__*/function(_Plugin10){function SkyboxesPlugin(viewer){var
|
|
26560
|
+
*/var SkyboxesPlugin=/*#__PURE__*/function(_Plugin10){function SkyboxesPlugin(viewer){var _this149;_classCallCheck(this,SkyboxesPlugin);_this149=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this149.skyboxes={};_this149._active=false;return _this149;}/**
|
|
26552
26561
|
* @private
|
|
26553
26562
|
*/_inherits(SkyboxesPlugin,_Plugin10);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
|
|
26554
26563
|
Creates a skybox.
|
|
@@ -26923,13 +26932,13 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
26923
26932
|
* vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
|
|
26924
26933
|
* @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.
|
|
26925
26934
|
* @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
|
|
26926
|
-
*/function TreeViewPlugin(viewer){var
|
|
26935
|
+
*/function TreeViewPlugin(viewer){var _this150;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this150=_callSuper(this,TreeViewPlugin,["TreeViewPlugin",viewer]);/**
|
|
26927
26936
|
* Contains messages for any errors found while last rebuilding this TreeView.
|
|
26928
26937
|
* @type {String[]}
|
|
26929
|
-
*/
|
|
26938
|
+
*/_this150.errors=[];/**
|
|
26930
26939
|
* True if errors were found generating this TreeView.
|
|
26931
26940
|
* @type {boolean}
|
|
26932
|
-
*/
|
|
26941
|
+
*/_this150.valid=true;// const containerElement =
|
|
26933
26942
|
// cfg.containerElement || document.getElementById(cfg.containerElementId);
|
|
26934
26943
|
// if (!(containerElement instanceof HTMLElement)) {
|
|
26935
26944
|
// this.error(
|
|
@@ -26937,23 +26946,23 @@ imagePos[0]=Math.floor(storeyMap.width-(worldPos[0]-xmin)*ratioX);imagePos[1]=Ma
|
|
|
26937
26946
|
// );
|
|
26938
26947
|
// return;
|
|
26939
26948
|
// }
|
|
26940
|
-
for(var _i553=0;;_i553++){if(!treeViews[_i553]){treeViews[_i553]=
|
|
26941
|
-
|
|
26942
|
-
|
|
26943
|
-
|
|
26944
|
-
|
|
26949
|
+
for(var _i553=0;;_i553++){if(!treeViews[_i553]){treeViews[_i553]=_this150;_this150._index=_i553;_this150._id="tree-".concat(_i553);break;}}// this._containerElement = containerElement;
|
|
26950
|
+
_this150._metaModels={};_this150._autoAddModels=cfg.autoAddModels!==false;_this150._autoExpandDepth=cfg.autoExpandDepth||0;_this150._sortNodes=cfg.sortNodes!==false;_this150._viewer=viewer;_this150._rootElement=null;_this150._muteSceneEvents=false;_this150._muteTreeEvents=false;_this150._rootNodes=[];_this150._objectNodes={};// Object ID -> Node
|
|
26951
|
+
_this150._nodeNodes={};// Node ID -> Node
|
|
26952
|
+
_this150._rootNames={};// Node ID -> Root name
|
|
26953
|
+
_this150._sortNodes=cfg.sortNodes;_this150._pruneEmptyNodes=cfg.pruneEmptyNodes;_this150._showListItemElementId=null;// this._renderService = cfg.renderService || new RenderService();
|
|
26945
26954
|
// if (!this._renderService) {
|
|
26946
26955
|
// throw new Error('TreeViewPlugin: no render service set');
|
|
26947
26956
|
// }
|
|
26948
26957
|
// this._containerElement.oncontextmenu = (e) => {
|
|
26949
26958
|
// e.preventDefault();
|
|
26950
26959
|
// };
|
|
26951
|
-
|
|
26952
|
-
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}
|
|
26960
|
+
_this150._onObjectVisibility=_this150._viewer.scene.on("objectVisibility",function(entity){if(_this150._muteSceneEvents){return;}var objectId=entity.id;var node=_this150._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
26961
|
+
}var visible=entity.visible;var updated=visible!==node.checked;if(!updated){return;}_this150._muteTreeEvents=true;node.checked=visible;if(visible){node.numVisibleEntities++;}else{node.numVisibleEntities--;}// this._renderService.setCheckbox(node.nodeId, visible);
|
|
26953
26962
|
var parent=node.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities++;}else{parent.numVisibleEntities--;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
|
|
26954
|
-
parent=parent.parent;}
|
|
26955
|
-
}
|
|
26956
|
-
|
|
26963
|
+
parent=parent.parent;}_this150._muteTreeEvents=false;});_this150._onObjectXrayed=_this150._viewer.scene.on("objectXRayed",function(entity){if(_this150._muteSceneEvents){return;}var objectId=entity.id;var node=_this150._objectNodes[objectId];if(!node){return;// Not in this tree
|
|
26964
|
+
}_this150._muteTreeEvents=true;var xrayed=entity.xrayed;var updated=xrayed!==node.xrayed;if(!updated){return;}node.xrayed=xrayed;// this._renderService.setXRayed(node.nodeId, xrayed);
|
|
26965
|
+
_this150._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
|
|
26957
26966
|
// this.switchExpandHandler(event)
|
|
26958
26967
|
// };
|
|
26959
26968
|
// this._switchCollapseHandler = (event) => {
|
|
@@ -26962,7 +26971,7 @@ _this149._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
|
|
|
26962
26971
|
// this._checkboxChangeHandler = (event) => {
|
|
26963
26972
|
// this.checkboxChangeHandler(event)
|
|
26964
26973
|
// };
|
|
26965
|
-
|
|
26974
|
+
_this150._hierarchy=cfg.hierarchy||"containment";_this150._autoExpandDepth=cfg.autoExpandDepth||0;if(_this150._autoAddModels){var modelIds=Object.keys(_this150.viewer.metaScene.metaModels);for(var _i554=0,len=modelIds.length;_i554<len;_i554++){var modelId=modelIds[_i554];var metaModel=_this150.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this150.addModel(modelId);}}_this150.viewer.scene.on("modelLoaded",function(modelId){if(_this150.viewer.metaScene.metaModels[modelId]){_this150.addModel(modelId);}});}_this150.hierarchy=cfg.hierarchy;return _this150;}//展开点击事件
|
|
26966
26975
|
_inherits(TreeViewPlugin,_Plugin11);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
|
|
26967
26976
|
this.fire("ExpandHandler",event);}//收起点击事件
|
|
26968
26977
|
},{key:"switchCollapseHandler",value:function switchCollapseHandler(event){event.preventDefault();event.stopPropagation();// const switchElement = event.target;
|
|
@@ -27073,12 +27082,12 @@ return true;}/**
|
|
|
27073
27082
|
* @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
|
|
27074
27083
|
* and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
|
|
27075
27084
|
* name. This option allows to override that name when it is not suitable as a display name.
|
|
27076
|
-
*/},{key:"addModel",value:function addModel(modelId){var
|
|
27085
|
+
*/},{key:"addModel",value:function addModel(modelId){var _this151=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
|
|
27077
27086
|
// return;
|
|
27078
27087
|
// }
|
|
27079
27088
|
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);
|
|
27080
27089
|
// return;
|
|
27081
|
-
}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){
|
|
27090
|
+
}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this151.removeModel(model.id);});this._createNodes();}/**
|
|
27082
27091
|
* Removes a model from this tree view.
|
|
27083
27092
|
*
|
|
27084
27093
|
* Does nothing if model not currently in tree view.
|
|
@@ -27247,12 +27256,12 @@ var title2=node2.title.toUpperCase();if(title1<title2){return-1;}if(title1>title
|
|
|
27247
27256
|
*/var ObjectCullStates=/*#__PURE__*/function(){/**
|
|
27248
27257
|
* @private
|
|
27249
27258
|
* @param scene
|
|
27250
|
-
*/function ObjectCullStates(scene){var
|
|
27259
|
+
*/function ObjectCullStates(scene){var _this152=this;_classCallCheck(this,ObjectCullStates);this._scene=scene;this._objects=[];// Array of all Entity instances that represent objects
|
|
27251
27260
|
this._objectsViewCulled=[];// A flag for each object to indicate its view-cull status
|
|
27252
27261
|
this._objectsDetailCulled=[];// A flag for each object to indicate its detail-cull status
|
|
27253
27262
|
this._objectsChanged=[];// A flag for each object, set whenever its cull status has changed since last _applyChanges()
|
|
27254
27263
|
this._objectsChangedList=[];// A list of objects whose cull status has changed, applied and cleared by _applyChanges()
|
|
27255
|
-
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){
|
|
27264
|
+
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){_this152._addModel(model);}});this._onTick=scene.on("tick",function(){if(_this152._dirty){_this152._build();}_this152._applyChanges();});}return _createClass(ObjectCullStates,[{key:"_addModel",value:function _addModel(model){var _this153=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this153._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 _i564=0;_i564<this._numObjects;_i564++){this._objects[_i564]=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 _i565=0;_i565<this._lenObjectsChangedList;_i565++){var objectIdx=this._objectsChangedList[_i565];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;}}/**
|
|
27256
27265
|
* Array of {@link Entity} instances that represent objects in the {@link Scene}.
|
|
27257
27266
|
*
|
|
27258
27267
|
* ObjectCullStates rebuilds this from {@link Scene#objects} whenever ````Scene```` fires a ````modelLoaded```` event.
|
|
@@ -27319,8 +27328,8 @@ var kdTreeDimLength=new Float32Array(3);/**
|
|
|
27319
27328
|
* @param {Object} cfg Plugin configuration.
|
|
27320
27329
|
* @param {String} [cfg.id="ViewCull"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
27321
27330
|
* @param {Number} [cfg.maxTreeDepth=8] Maximum depth of the kd-tree.
|
|
27322
|
-
*/function ViewCullPlugin(viewer){var
|
|
27323
|
-
|
|
27331
|
+
*/function ViewCullPlugin(viewer){var _this154;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,ViewCullPlugin);_this154=_callSuper(this,ViewCullPlugin,["ViewCull",viewer]);_this154._objectCullStates=getObjectCullStates(viewer.scene);// Combines updates from multiple culling systems for its Scene's Entities
|
|
27332
|
+
_this154._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;_this154._modelInfos={};_this154._frustum=new Frustum$1();_this154._kdRoot=null;_this154._frustumDirty=false;_this154._kdTreeDirty=false;_this154._insideView=false;_this154.enabled=cfg.enabled;var camera=viewer.scene.camera;_this154._onViewMatrix=viewer.scene.camera.on("viewMatrix",function(){_this154._frustumDirty=true;});_this154._onProjMatrix=viewer.scene.camera.on("projMatMatrix",function(){_this154._frustumDirty=true;});_this154._onModelLoaded=viewer.scene.on("modelLoaded",function(modelId){var model=_this154.viewer.scene.models[modelId];if(model){_this154._addModel(model);}});_this154._onSceneTick=viewer.scene.on("tick",function(){if(_this154._enabled)_this154._doCull();_this154.insideView=_this154.isBoxInFrustum(_this154.extractFrustumPlanes(camera.projMatrix,camera.viewMatrix),viewer.scene.aabb);});return _this154;}//包围盒和视锥相交测试
|
|
27324
27333
|
_inherits(ViewCullPlugin,_Plugin12);return _createClass(ViewCullPlugin,[{key:"isBoxInFrustum",value:function isBoxInFrustum(frustumPlanes,aabb){for(var _i566=0;_i566<6;_i566++){var plane=frustumPlanes[_i566];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;}//视锥计算
|
|
27325
27334
|
},{key:"extractFrustumPlanes",value:function extractFrustumPlanes(projectionMatrix,viewMatrix){var combinedMatrix=math.identityMat4();math.mulMat4(projectionMatrix,viewMatrix,combinedMatrix);var planes=[];for(var _i567=0;_i567<6;_i567++){planes.push(math.identityMat4());}// Left plane
|
|
27326
27335
|
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
|
|
@@ -27336,7 +27345,7 @@ planes[5][0]=combinedMatrix[3]-combinedMatrix[2];planes[5][1]=combinedMatrix[7]-
|
|
|
27336
27345
|
* Gets whether view culling is enabled.
|
|
27337
27346
|
*
|
|
27338
27347
|
* @retutns {Boolean} Whether view culling is enabled.
|
|
27339
|
-
*/function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var
|
|
27348
|
+
*/function get(){return this._enabled;},set:function set(enabled){this._enabled=enabled;}},{key:"_addModel",value:function _addModel(model){var _this155=this;var modelInfo={model:model,onDestroyed:model.on("destroyed",function(){_this155._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;
|
|
27340
27349
|
kdNode.intersects=intersects;}var culled=intersects===Frustum$1.OUTSIDE;var objects=kdNode.objects;if(objects&&objects.length>0){for(var _i569=0,len=objects.length;_i569<len;_i569++){var objectIdx=objects[_i569];this._objectCullStates.setObjectViewCulled(objectIdx,culled);}}if(kdNode.left){this._visitKDNode(kdNode.left,intersects);}if(kdNode.right){this._visitKDNode(kdNode.right,intersects);}}/**
|
|
27341
27350
|
* @private
|
|
27342
27351
|
*/},{key:"send",value:function send(name,value){}/**
|
|
@@ -27370,12 +27379,11 @@ eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPorti
|
|
|
27370
27379
|
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
|
|
27371
27380
|
if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
|
|
27372
27381
|
}// Create textures
|
|
27373
|
-
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;
|
|
27382
|
+
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
|
|
27374
27383
|
var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
27375
27384
|
var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
27376
27385
|
var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
27377
|
-
if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="".concat(modelPartId,"-texture-").concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{
|
|
27378
|
-
minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
|
|
27386
|
+
if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="".concat(modelPartId,"-texture-").concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{sceneModel.createTexture({id:textureId,imageBuffer:arrayBuffer,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
|
|
27379
27387
|
for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="".concat(modelPartId,"-textureSet-").concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(occlusionTextureIndex):null});}// Count instances of each geometry
|
|
27380
27388
|
var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
|
|
27381
27389
|
var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
|
|
@@ -27385,7 +27393,7 @@ var props=options.objectDefaults?options.objectDefaults[metaObject.type]||option
|
|
|
27385
27393
|
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
|
|
27386
27394
|
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
|
|
27387
27395
|
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 _i578=0,len=geometryPositions.length;_i578<len;_i578+=3){decompressedPositions[_i578+0]=geometryPositions[_i578+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i578+1]=geometryPositions[_i578+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i578+2]=geometryPositions[_i578+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 _i579=0,_len109=_decompressedPositions.length;_i579<_len109;_i579+=3){tempVec4a[0]=_decompressedPositions[_i579+0];tempVec4a[1]=_decompressedPositions[_i579+1];tempVec4a[2]=_decompressedPositions[_i579+2];tempVec4a[3]=1;math.transformVec4(meshMatrix,tempVec4a,tempVec4b);geometryCompressionUtils.compressPosition(tempVec4b,rtcAABB,tempVec4a);transformedAndRecompressedPositions[_i579+0]=tempVec4a[0];transformedAndRecompressedPositions[_i579+1]=tempVec4a[1];transformedAndRecompressedPositions[_i579+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
|
|
27388
|
-
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,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 _i580=0,len=indices.length-1;_i580<len;_i580++){linesIndices.push(indices[_i580]);linesIndices.push(indices[_i580+1]);}}else if(positions.length>1){for(var _i581=0,_len110=positions.length/3-1;_i581<_len110;_i581++){linesIndices.push(_i581);linesIndices.push(_i581+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;
|
|
27396
|
+
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 _i580=0,len=indices.length-1;_i580<len;_i580++){linesIndices.push(indices[_i580]);linesIndices.push(indices[_i580+1]);}}else if(positions.length>1){for(var _i581=0,_len110=positions.length/3-1;_i581<_len110;_i581++){linesIndices.push(_i581);linesIndices.push(_i581+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;
|
|
27389
27397
|
// parsers[ParserV2.version] = ParserV2;
|
|
27390
27398
|
// parsers[ParserV3.version] = ParserV3;
|
|
27391
27399
|
// parsers[ParserV4.version] = ParserV4;
|
|
@@ -27972,7 +27980,7 @@ parsers[ParserV10.version]=ParserV10;/**
|
|
|
27972
27980
|
* and faster rendering speed. It's recommended to keep this somewhere roughly between ````50000```` and ````50000000```.
|
|
27973
27981
|
* @param {KTX2TextureTranscoder} [cfg.textureTranscoder] Transcoder used internally to transcode KTX2
|
|
27974
27982
|
* textures within the XTC. Only required when the XTC is version 10 or later, and contains KTX2 textures.
|
|
27975
|
-
*/function XTCLoaderPlugin(viewer){var
|
|
27983
|
+
*/function XTCLoaderPlugin(viewer){var _this156;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,XTCLoaderPlugin);_this156=_callSuper(this,XTCLoaderPlugin,["XTCLoader",viewer,cfg]);_this156._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this156.textureTranscoder=cfg.textureTranscoder;_this156.dataSource=cfg.dataSource;_this156.objectDefaults=cfg.objectDefaults;_this156.includeTypes=cfg.includeTypes;_this156.excludeTypes=cfg.excludeTypes;_this156.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;_this156.reuseGeometries=cfg.reuseGeometries;return _this156;}/**
|
|
27976
27984
|
* Gets the ````.xtc```` format versions supported by this XTCLoaderPlugin/
|
|
27977
27985
|
* @returns {string[]}
|
|
27978
27986
|
*/_inherits(XTCLoaderPlugin,_Plugin13);return _createClass(XTCLoaderPlugin,[{key:"supportedVersions",get:function get(){return Object.keys(parsers);}/**
|
|
@@ -28149,14 +28157,14 @@ parsers[ParserV10.version]=ParserV10;/**
|
|
|
28149
28157
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
28150
28158
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
28151
28159
|
* @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}.
|
|
28152
|
-
*/},{key:"load",value:function load(){var
|
|
28160
|
+
*/},{key:"load",value:function load(){var _this157=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
|
|
28153
28161
|
}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&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i582=0,len=includeTypes.length;_i582<len;_i582++){options.includeTypesMap[includeTypes[_i582]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i583=0,_len111=excludeTypes.length;_i583<_len111;_i583++){options.excludeTypesMap[excludeTypes[_i583]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&¶ms.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
|
|
28154
28162
|
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);
|
|
28155
|
-
sceneModel.finalize();metaModel.finalize();
|
|
28163
|
+
sceneModel.finalize();metaModel.finalize();_this157.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this157.viewer.metaScene.destroyMetaModel(metaModel.id);});_this157.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
|
|
28156
28164
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
28157
|
-
});};var error=function error(errMsg){
|
|
28158
|
-
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){
|
|
28159
|
-
var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{
|
|
28165
|
+
});};var error=function error(errMsg){_this157.viewer.scene.canvas.spinner.processes--;_this157.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
|
|
28166
|
+
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){_this157._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this157._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{_this157._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this157.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{_this157._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this157._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx);sceneModel.preFinalize();i++;_this157.scheduleTask(_loadNext2,200);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
|
|
28167
|
+
var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this157._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this157._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this157.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 _this158=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this158._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,_i584,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(_i584=0;_i584<numElements;_i584++){elementSize=dataView.getUint32((_i584+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(_x102,_x103,_x104,_x105,_x106,_x107){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this159=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this159.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this159.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()
|
|
28160
28168
|
});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) {
|
|
28161
28169
|
//
|
|
28162
28170
|
// const metaModelId = sceneModel.id;
|
|
@@ -28576,7 +28584,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
|
|
|
28576
28584
|
* @param {String[]} [cfg.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
28577
28585
|
* @param {String[]} [cfg.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
28578
28586
|
* @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}.
|
|
28579
|
-
*/function WebIFCLoaderPlugin(viewer){var
|
|
28587
|
+
*/function WebIFCLoaderPlugin(viewer){var _this160;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,WebIFCLoaderPlugin);_this160=_callSuper(this,WebIFCLoaderPlugin,["ifcLoader",viewer,cfg]);_this160.dataSource=cfg.dataSource;_this160.objectDefaults=cfg.objectDefaults;_this160.includeTypes=cfg.includeTypes;_this160.excludeTypes=cfg.excludeTypes;_this160.excludeUnclassifiedObjects=cfg.excludeUnclassifiedObjects;if(cfg.WebIFC){_this160._webIFC=cfg.WebIFC;_this160._ifcAPI=cfg.IfcAPI;_this160.webIfcFroMOutside=true;}// else {
|
|
28580
28588
|
// this._webIFC = WebIFC;
|
|
28581
28589
|
// this.webIfcFroMOutside = false;
|
|
28582
28590
|
// this._ifcAPI = new this._webIFC.IfcAPI();
|
|
@@ -28592,7 +28600,7 @@ var isBase64=!!dataUriRegexResult[2];var data=dataUriRegexResult[3];data=window.
|
|
|
28592
28600
|
// this.error(e);
|
|
28593
28601
|
// });
|
|
28594
28602
|
// }
|
|
28595
|
-
return
|
|
28603
|
+
return _this160;}/**
|
|
28596
28604
|
* Gets the ````IFC```` format versions supported by this WebIFCLoaderPlugin.
|
|
28597
28605
|
* @returns {string[]}
|
|
28598
28606
|
*/_inherits(WebIFCLoaderPlugin,_Plugin14);return _createClass(WebIFCLoaderPlugin,[{key:"supportedVersions",get:function get(){return["2x3","4"];}/**
|
|
@@ -28737,13 +28745,13 @@ return _this159;}/**
|
|
|
28737
28745
|
// sceneModel.fire("error", e);
|
|
28738
28746
|
// }
|
|
28739
28747
|
// });
|
|
28740
|
-
return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var
|
|
28748
|
+
return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this161=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this161._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this161.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&¶ms.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) {},
|
|
28741
28749
|
nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i587=0,len=options.includeTypes.length;_i587<len;_i587++){ctx.includeTypes[options.includeTypes[_i587]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i588=0,_len113=options.excludeTypes.length;_i588<_len113;_i588++){ctx.excludeTypes[options.excludeTypes[_i588]]=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
|
|
28742
28750
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
28743
|
-
});}},{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
|
|
28744
|
-
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=
|
|
28751
|
+
});}},{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 _this162=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i589=0;_i589<lines.size();_i589++){var relID=lines.get(_i589);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=_this162._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this162._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 _i590=0;_i590<lines.size();_i590++){var relID=lines.get(_i590);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 _i591=0,len=props.length;_i591<len;_i591++){var prop=props[_i591];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 _i592=0,_len114=relatedObjects.length;_i592<_len114;_i592++){var relatedObject=relatedObjects[_i592];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 _this163=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
28752
|
+
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this163._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=_this163._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this163._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this163._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
28745
28753
|
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
|
|
28746
|
-
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=
|
|
28754
|
+
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=_this163._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=_this163._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this163._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this163._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
28747
28755
|
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
|
|
28748
28756
|
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);/**
|
|
28749
28757
|
* Default data access strategy for {@link LASLoaderPlugin}.
|
|
@@ -28910,7 +28918,7 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
28910
28918
|
* @param {Boolean} [cfg.rotateX=false] Whether to rotate the LAS point positions 90 degrees. Applied after "center".
|
|
28911
28919
|
* @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".
|
|
28912
28920
|
* @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".
|
|
28913
|
-
*/function LASLoaderPlugin(viewer){var
|
|
28921
|
+
*/function LASLoaderPlugin(viewer){var _this164;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LASLoaderPlugin);_this164=_callSuper(this,LASLoaderPlugin,["lasLoader",viewer,cfg]);_this164.dataSource=cfg.dataSource;_this164.skip=cfg.skip;_this164.fp64=cfg.fp64;_this164.colorDepth=cfg.colorDepth;_this164.center=cfg.center;_this164.rotate=cfg.rotate;_this164.rotateX=cfg.rotateX;_this164.transform=cfg.transform;return _this164;}/**
|
|
28914
28922
|
* Gets the custom data source through which the LASLoaderPlugin can load LAS files.
|
|
28915
28923
|
*
|
|
28916
28924
|
* Default value is {@link LASDefaultDataSource}, which loads via HTTP.
|
|
@@ -29037,8 +29045,8 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29037
29045
|
* @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````.
|
|
29038
29046
|
* @param {Object} [params.stats] Collects model statistics.
|
|
29039
29047
|
* @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}.
|
|
29040
|
-
*/},{key:"load",value:function load(){var
|
|
29041
|
-
}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--;
|
|
29048
|
+
*/},{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;}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
|
|
29049
|
+
}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--;_this165.error(errMsg);sceneModel.fire("error",errMsg);});}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this166=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getLAS(params.src,function(arrayBuffer){_this166._parseModel(arrayBuffer,params,options,sceneModel).then(function(){spinner.processes--;},function(errMsg){spinner.processes--;_this166.error(errMsg);sceneModel.fire("error",errMsg);});},function(errMsg){spinner.processes--;_this166.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){var _this167=this;var readPositions=function readPositions(attributesPosition){var positionsValue=attributesPosition.value;if(_this167._center){var centerPos=math.vec3();var numPoints=positionsValue.length;for(var _i594=0,len=positionsValue.length;_i594<len;_i594+=3){centerPos[0]+=positionsValue[_i594+0];centerPos[1]+=positionsValue[_i594+1];centerPos[2]+=positionsValue[_i594+2];}centerPos[0]/=numPoints;centerPos[1]/=numPoints;centerPos[2]/=numPoints;for(var _i595=0,_len115=positionsValue.length;_i595<_len115;_i595+=3){positionsValue[_i595+0]-=centerPos[0];positionsValue[_i595+1]-=centerPos[1];positionsValue[_i595+2]-=centerPos[2];}}if(_this167._rotateX){if(positionsValue){for(var _i596=0,_len116=positionsValue.length;_i596<_len116;_i596+=3){var temp=positionsValue[_i596+1];positionsValue[_i596+1]=positionsValue[_i596+2];positionsValue[_i596+2]=temp;}}}if(_this167._rotate){var quaternion=math.identityQuaternion();var mat=math.mat4();math.eulerToQuaternion(_this167._rotate,"XYZ",quaternion);math.quaternionToRotationMat4(quaternion,mat);var pos=math.vec3();for(var _i597=0,_len117=positionsValue.length;_i597<_len117;_i597+=3){pos[0]=positionsValue[_i597+0];pos[1]=positionsValue[_i597+1];pos[2]=positionsValue[_i597+2];math.transformPoint3(mat,pos,pos);positionsValue[_i597+0]=pos[0];positionsValue[_i597+1]=pos[1];positionsValue[_i597+2]=pos[2];}}if(_this167._transform){var _mat=math.mat4(_this167._transform);var _pos=math.vec3();for(var _i598=0,_len118=positionsValue.length;_i598<_len118;_i598+=3){_pos[0]=positionsValue[_i598+0];_pos[1]=positionsValue[_i598+1];_pos[2]=positionsValue[_i598+2];math.transformPoint3(_mat,_pos,_pos);positionsValue[_i598+0]=_pos[0];positionsValue[_i598+1]=_pos[1];positionsValue[_i598+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 _i599=0,j=0,k=0,len=intensities.length;_i599<len;_i599++,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[_i599]/65536*255);}return colorsCompressed;}function readIntensities(attributesIntensity){var intensities=attributesIntensity.value;var colorsCompressedSize=intensities.length*4;var colorsCompressed=new Uint8Array(colorsCompressedSize);for(var _i600=0,j=0,k=0,len=intensities.length;_i600<len;_i600++,k+=3,j+=4){colorsCompressed[j+0]=0;colorsCompressed[j+1]=0;colorsCompressed[j+2]=0;colorsCompressed[j+3]=Math.round(intensities[_i600]/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 _i601=0,len=pointsChunks.length;_i601<len;_i601++){var meshId="pointsMesh".concat(_i601);meshIds.push(meshId);sceneModel.createMesh({id:meshId,primitive:"points",positions:pointsChunks[_i601],colorsCompressed:_i601<colorsChunks.length?colorsChunks[_i601]:null});}/*
|
|
29042
29050
|
const pointsChunks = chunkArray(positionsValue, MAX_VERTICES * 3);
|
|
29043
29051
|
const colorsChunks = chunkArray(colorsCompressed, MAX_VERTICES * 4);
|
|
29044
29052
|
const meshIds = [];
|
|
@@ -29061,6 +29069,6 @@ var headerBlockItems=[{item:'FileSignature',format:'char',size:4},{item:'FileSou
|
|
|
29061
29069
|
geometryId
|
|
29062
29070
|
});
|
|
29063
29071
|
}
|
|
29064
|
-
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;
|
|
29072
|
+
*/var pointsObjectId=params.entityId||math.createUUID();sceneModel.createEntity({id:pointsObjectId,meshIds:meshIds,isObject:true});sceneModel.finalize();if(params.metaModelJSON){var metaModelId=sceneModel.id;_this167.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;_this167.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
|
|
29065
29073
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
29066
29074
|
});resolve();});}catch(e){sceneModel.finalize();reject(e);}});}}]);}(Plugin);function chunkArray(array,chunkSize){if(chunkSize>=array.length){return[array];}var result=[];for(var _i602=0;_i602<array.length;_i602+=chunkSize){result.push(array.slice(_i602,_i602+chunkSize));}return result;}export{AlphaFormat,AmbientLight,AngleMeasurementsControl,AngleMeasurementsMouseControl,AngleMeasurementsPlugin,AngleMeasurementsTouchControl,AnnotationsPlugin,AxisGizmoPlugin,BCFViewpointsPlugin,Bitmap,ByteType,CameraMemento,CameraPath,CameraPathAnimation,Canvas,ClampToEdgeWrapping,Component,CompressedMediaType,Configs,CubicBezierCurve,Curve,DefaultLoadingManager,DepthFormat,DepthStencilFormat,DirLight,DistanceMeasurementsControl,DistanceMeasurementsMouseControl,DistanceMeasurementsPlugin,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,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};
|