@xtctwins/tctwins-bimx-viewer 0.1.14 → 0.1.16

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.
@@ -8163,7 +8163,7 @@ if(this._normalMap){hash.push("/nm");if(this._normalMap.hasMatrix){hash.push("/m
8163
8163
  * @type {String}
8164
8164
  */function get(){return this._state.frontface?"ccw":"cw";}/**
8165
8165
  * Destroys this PhongMaterial.
8166
- */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8166
+ */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},blueSelected:{fill:true,fillColor:[0.2,0.6,0.9],fillAlpha:0.3,edges:false,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8167
8167
  * Configures the appearance of {@link Entity}s when they are xrayed, highlighted or selected.
8168
8168
  *
8169
8169
  * * XRay an {@link Entity} by setting {@link Entity#xrayed} ````true````.
@@ -10108,7 +10108,7 @@ dontClear:true});}/**
10108
10108
  * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
10109
10109
  *
10110
10110
  * @type {EmphasisMaterial}
10111
- */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
10111
+ */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"blueSelected",dontClear:true});}/**
10112
10112
  * Gets the default {@link EdgeMaterial} for this Scene.
10113
10113
  *
10114
10114
  * Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
@@ -11644,224 +11644,224 @@ if(p===UnsignedInt248Type){return gl.UNSIGNED_INT_24_8;}if(p===RepeatWrapping){r
11644
11644
  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 _i127=0,len=mipmaps.length;_i127<len;_i127++){var mipmap=mipmaps[_i127];if(this.format!==RGBAFormat){if(glFormat!==null){gl.compressedTexSubImage2D(gl.TEXTURE_2D,_i127,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,_i127,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}// if (generateMipMap) {
11645
11645
  // // gl.generateMipmap(this.target); // Only for roughness textures?
11646
11646
  // }
11647
- gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){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.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.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){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11648
- * @desc A 2D texture map.
11649
- *
11650
- * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11651
- * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11652
- * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11653
- *
11654
- * ## Usage
11655
- *
11656
- * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11657
- *
11658
- * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11659
- * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11660
- * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11661
- *
11662
- * [[Run this example](/examples/#materials_Texture)]
11663
- *
11664
- * ```` javascript
11665
- * import {Viewer, Mesh, buildTorusGeometry,
11666
- * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11667
- *
11668
- * const viewer = new Viewer({
11669
- * canvasId: "myCanvas"
11670
- * });
11671
- *
11672
- * viewer.camera.eye = [0, 0, 5];
11673
- * viewer.camera.look = [0, 0, 0];
11674
- * viewer.camera.up = [0, 1, 0];
11675
- *
11676
- * new Mesh(viewer.scene, {
11677
- * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11678
- * center: [0, 0, 0],
11679
- * radius: 1.5,
11680
- * tube: 0.5,
11681
- * radialSegments: 32,
11682
- * tubeSegments: 24,
11683
- * arc: Math.PI * 2.0
11684
- * }),
11685
- * material: new PhongMaterial(viewer.scene, {
11686
- * ambient: [0.9, 0.3, 0.9],
11687
- * shininess: 30,
11688
- * diffuseMap: new Texture(viewer.scene, {
11689
- * src: "textures/diffuse/uvGrid2.jpg"
11690
- * })
11691
- * })
11692
- * });
11693
- *````
11694
- */var Texture=/*#__PURE__*/function(_Component23){/**
11695
- * @constructor
11696
- * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11697
- * @param {*} [cfg] Configs
11698
- * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11699
- * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11700
- * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11701
- * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11702
- * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11703
- * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11704
- * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11705
- * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11706
- * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11707
- * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11708
- * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11709
- * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11710
- * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11647
+ gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){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.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.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){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11648
+ * @desc A 2D texture map.
11649
+ *
11650
+ * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11651
+ * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11652
+ * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11653
+ *
11654
+ * ## Usage
11655
+ *
11656
+ * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11657
+ *
11658
+ * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11659
+ * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11660
+ * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11661
+ *
11662
+ * [[Run this example](/examples/#materials_Texture)]
11663
+ *
11664
+ * ```` javascript
11665
+ * import {Viewer, Mesh, buildTorusGeometry,
11666
+ * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11667
+ *
11668
+ * const viewer = new Viewer({
11669
+ * canvasId: "myCanvas"
11670
+ * });
11671
+ *
11672
+ * viewer.camera.eye = [0, 0, 5];
11673
+ * viewer.camera.look = [0, 0, 0];
11674
+ * viewer.camera.up = [0, 1, 0];
11675
+ *
11676
+ * new Mesh(viewer.scene, {
11677
+ * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11678
+ * center: [0, 0, 0],
11679
+ * radius: 1.5,
11680
+ * tube: 0.5,
11681
+ * radialSegments: 32,
11682
+ * tubeSegments: 24,
11683
+ * arc: Math.PI * 2.0
11684
+ * }),
11685
+ * material: new PhongMaterial(viewer.scene, {
11686
+ * ambient: [0.9, 0.3, 0.9],
11687
+ * shininess: 30,
11688
+ * diffuseMap: new Texture(viewer.scene, {
11689
+ * src: "textures/diffuse/uvGrid2.jpg"
11690
+ * })
11691
+ * })
11692
+ * });
11693
+ *````
11694
+ */var Texture=/*#__PURE__*/function(_Component23){/**
11695
+ * @constructor
11696
+ * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11697
+ * @param {*} [cfg] Configs
11698
+ * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11699
+ * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11700
+ * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11701
+ * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11702
+ * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11703
+ * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11704
+ * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11705
+ * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11706
+ * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11707
+ * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11708
+ * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11709
+ * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11710
+ * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11711
11711
  */function Texture(owner){var _this59;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Texture);_this59=_callSuper(this,Texture,[owner,cfg]);_this59._state=new RenderState({texture:new Texture2D({gl:_this59.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:_this59._checkMinFilter(cfg.minFilter||1008),magFilter:_this59._checkMagFilter(cfg.magFilter||1006),wrapS:_this59._checkWrapS(cfg.wrapS||1000),wrapT:_this59._checkWrapT(cfg.wrapT||1000),flipY:_this59._checkFlipY(cfg.flipY||1000),encoding:_this59._checkEncoding(cfg.encoding)});// Data source
11712
11712
  _this59._src=null;_this59._image=null;// Transformation
11713
11713
  _this59._translate=math.vec2([0,0]);_this59._scale=math.vec2([1,1]);_this59._rotate=math.vec2([0,0]);_this59._matrixDirty=false;// Transform
11714
11714
  _this59.translate=cfg.translate;_this59.scale=cfg.scale;_this59.rotate=cfg.rotate;// Data source
11715
11715
  if(cfg.src){_this59.src=cfg.src;// Image file
11716
11716
  }else if(cfg.image){_this59.image=cfg.image;// Image object
11717
- }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11718
- @private
11719
- */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();}/**
11720
- * Sets an HTML DOM Image object to source this Texture from.
11721
- *
11722
- * Sets {@link Texture#src} null.
11723
- *
11724
- * @type {HTMLImageElement}
11725
- */},{key:"image",get:/**
11726
- * Gets HTML DOM Image object this Texture is sourced from, if any.
11727
- *
11728
- * Returns null if not set.
11729
- *
11730
- * @type {HTMLImageElement}
11731
- */function get(){return this._image;}/**
11732
- * Sets path to an image file to source this Texture from.
11733
- *
11734
- * Sets {@link Texture#image} null.
11735
- *
11736
- * @type {String}
11737
- */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11738
- * Gets path to the image file this Texture from, if any.
11739
- *
11740
- * Returns null if not set.
11741
- *
11742
- * @type {String}
11743
- */function get(){return this._src;}/**
11744
- * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11745
- *
11746
- * Default value is ````[0, 0]````.
11747
- *
11748
- * @type {Number[]}
11749
- */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11750
- * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
- *
11752
- * Default value is ````[0, 0]````.
11753
- *
11754
- * @type {Number[]}
11755
- */function get(){return this._translate;}/**
11756
- * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11757
- *
11758
- * Default value is ````[1, 1]````.
11759
- *
11760
- * @type {Number[]}
11761
- */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11762
- * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
- *
11764
- * Default value is ````[1, 1]````.
11765
- *
11766
- * @type {Number[]}
11767
- */function get(){return this._scale;}/**
11768
- * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11769
- *
11770
- * Default value is ````0````.
11771
- *
11772
- * @type {Number}
11773
- */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11774
- * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
- *
11776
- * Default value is ````0````.
11777
- *
11778
- * @type {Number}
11779
- */function get(){return this._rotate;}/**
11780
- * Gets how this Texture is sampled when a texel covers less than one pixel.
11781
- *
11782
- * Options are:
11783
- *
11784
- * * NearestFilter - Uses the value of the texture element that is nearest
11785
- * (in Manhattan distance) to the center of the pixel being textured.
11786
- *
11787
- * * LinearFilter - Uses the weighted average of the four texture elements that are
11788
- * closest to the center of the pixel being textured.
11789
- *
11790
- * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11791
- * size of the pixel being textured and uses the "nearest" criterion (the texture
11792
- * element nearest to the center of the pixel) to produce a texture value.
11793
- *
11794
- * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11795
- * the pixel being textured and uses the "linear" criterion (a weighted average of the
11796
- * four texture elements that are closest to the center of the pixel) to produce a
11797
- * texture value.
11798
- *
11799
- * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11800
- * match the size of the pixel being textured and uses the "nearest" criterion
11801
- * (the texture element nearest to the center of the pixel) to produce a texture
11802
- * value from each mipmap. The final texture value is a weighted average of those two
11803
- * values.
11804
- *
11805
- * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11806
- * of the pixel being textured and uses the "linear" criterion (a weighted average
11807
- * of the four texture elements that are closest to the center of the pixel) to
11808
- * produce a texture value from each mipmap. The final texture value is a weighted
11809
- * average of those two values.
11810
- *
11811
- * Default value is LinearMipMapLinearFilter.
11812
- *
11813
- * @type {Number}
11814
- */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11815
- * Gets how this Texture is sampled when a texel covers more than one pixel.
11816
- *
11817
- * * NearestFilter - Uses the value of the texture element that is nearest
11818
- * (in Manhattan distance) to the center of the pixel being textured.
11819
- * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11820
- * closest to the center of the pixel being textured.
11821
- *
11822
- * Default value is LinearMipMapLinearFilter.
11823
- *
11824
- * @type {Number}
11825
- */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11826
- * Gets the wrap parameter for this Texture's *S* coordinate.
11827
- *
11828
- * Values can be:
11829
- *
11830
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11831
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11832
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11833
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11834
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11835
- * fractional part, thereby creating a repeating pattern.
11836
- *
11837
- * Default value is RepeatWrapping.
11838
- *
11839
- * @type {Number}
11840
- */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11841
- * Gets the wrap parameter for this Texture's *T* coordinate.
11842
- *
11843
- * Values can be:
11844
- *
11845
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11846
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11847
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11848
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11849
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11850
- * fractional part, thereby creating a repeating pattern.
11851
- *
11852
- * Default value is RepeatWrapping.
11853
- *
11854
- * @type {Number}
11855
- */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11856
- * Gets if this Texture's source data is flipped along its vertical axis.
11857
- *
11858
- * @type {Number}
11859
- */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11860
- * Gets the Texture's encoding format.
11861
- *
11862
- * @type {Number}
11863
- */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11864
- * Destroys this Texture
11717
+ }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11718
+ @private
11719
+ */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();}/**
11720
+ * Sets an HTML DOM Image object to source this Texture from.
11721
+ *
11722
+ * Sets {@link Texture#src} null.
11723
+ *
11724
+ * @type {HTMLImageElement}
11725
+ */},{key:"image",get:/**
11726
+ * Gets HTML DOM Image object this Texture is sourced from, if any.
11727
+ *
11728
+ * Returns null if not set.
11729
+ *
11730
+ * @type {HTMLImageElement}
11731
+ */function get(){return this._image;}/**
11732
+ * Sets path to an image file to source this Texture from.
11733
+ *
11734
+ * Sets {@link Texture#image} null.
11735
+ *
11736
+ * @type {String}
11737
+ */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11738
+ * Gets path to the image file this Texture from, if any.
11739
+ *
11740
+ * Returns null if not set.
11741
+ *
11742
+ * @type {String}
11743
+ */function get(){return this._src;}/**
11744
+ * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11745
+ *
11746
+ * Default value is ````[0, 0]````.
11747
+ *
11748
+ * @type {Number[]}
11749
+ */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11750
+ * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
+ *
11752
+ * Default value is ````[0, 0]````.
11753
+ *
11754
+ * @type {Number[]}
11755
+ */function get(){return this._translate;}/**
11756
+ * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11757
+ *
11758
+ * Default value is ````[1, 1]````.
11759
+ *
11760
+ * @type {Number[]}
11761
+ */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11762
+ * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
+ *
11764
+ * Default value is ````[1, 1]````.
11765
+ *
11766
+ * @type {Number[]}
11767
+ */function get(){return this._scale;}/**
11768
+ * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11769
+ *
11770
+ * Default value is ````0````.
11771
+ *
11772
+ * @type {Number}
11773
+ */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11774
+ * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
+ *
11776
+ * Default value is ````0````.
11777
+ *
11778
+ * @type {Number}
11779
+ */function get(){return this._rotate;}/**
11780
+ * Gets how this Texture is sampled when a texel covers less than one pixel.
11781
+ *
11782
+ * Options are:
11783
+ *
11784
+ * * NearestFilter - Uses the value of the texture element that is nearest
11785
+ * (in Manhattan distance) to the center of the pixel being textured.
11786
+ *
11787
+ * * LinearFilter - Uses the weighted average of the four texture elements that are
11788
+ * closest to the center of the pixel being textured.
11789
+ *
11790
+ * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11791
+ * size of the pixel being textured and uses the "nearest" criterion (the texture
11792
+ * element nearest to the center of the pixel) to produce a texture value.
11793
+ *
11794
+ * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11795
+ * the pixel being textured and uses the "linear" criterion (a weighted average of the
11796
+ * four texture elements that are closest to the center of the pixel) to produce a
11797
+ * texture value.
11798
+ *
11799
+ * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11800
+ * match the size of the pixel being textured and uses the "nearest" criterion
11801
+ * (the texture element nearest to the center of the pixel) to produce a texture
11802
+ * value from each mipmap. The final texture value is a weighted average of those two
11803
+ * values.
11804
+ *
11805
+ * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11806
+ * of the pixel being textured and uses the "linear" criterion (a weighted average
11807
+ * of the four texture elements that are closest to the center of the pixel) to
11808
+ * produce a texture value from each mipmap. The final texture value is a weighted
11809
+ * average of those two values.
11810
+ *
11811
+ * Default value is LinearMipMapLinearFilter.
11812
+ *
11813
+ * @type {Number}
11814
+ */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11815
+ * Gets how this Texture is sampled when a texel covers more than one pixel.
11816
+ *
11817
+ * * NearestFilter - Uses the value of the texture element that is nearest
11818
+ * (in Manhattan distance) to the center of the pixel being textured.
11819
+ * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11820
+ * closest to the center of the pixel being textured.
11821
+ *
11822
+ * Default value is LinearMipMapLinearFilter.
11823
+ *
11824
+ * @type {Number}
11825
+ */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11826
+ * Gets the wrap parameter for this Texture's *S* coordinate.
11827
+ *
11828
+ * Values can be:
11829
+ *
11830
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11831
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11832
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11833
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11834
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11835
+ * fractional part, thereby creating a repeating pattern.
11836
+ *
11837
+ * Default value is RepeatWrapping.
11838
+ *
11839
+ * @type {Number}
11840
+ */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11841
+ * Gets the wrap parameter for this Texture's *T* coordinate.
11842
+ *
11843
+ * Values can be:
11844
+ *
11845
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11846
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11847
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11848
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11849
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11850
+ * fractional part, thereby creating a repeating pattern.
11851
+ *
11852
+ * Default value is RepeatWrapping.
11853
+ *
11854
+ * @type {Number}
11855
+ */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11856
+ * Gets if this Texture's source data is flipped along its vertical axis.
11857
+ *
11858
+ * @type {Number}
11859
+ */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11860
+ * Gets the Texture's encoding format.
11861
+ *
11862
+ * @type {Number}
11863
+ */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11864
+ * Destroys this Texture
11865
11865
  */},{key:"destroy",value:function destroy(){_superPropGet(Texture,"destroy",this,3)([]);if(this._state.texture){this._state.texture.destroy();}this._state.destroy();stats.memory.textures--;}}]);}(Component);/**
11866
11866
  * @desc Creates a cylinder-shaped {@link Geometry}.
11867
11867
  *
@@ -13529,7 +13529,7 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
13529
13529
  * @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
13530
13530
  * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
13531
13531
  * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
13532
- */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13532
+ */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;_this73._shownControlIds=[];if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13533
13533
  // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
13534
13534
  // by BCFViewpointsPlugin#loadViewpoint().
13535
13535
  _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this73._sectionBoxCreated(sectionBox);});return _this73;}/**
@@ -13558,7 +13558,7 @@ _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=
13558
13558
  */},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&&params.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
13559
13559
  // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
13560
13560
  var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}//剖切面创建后,创建一个控制器
13561
- },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13561
+ },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13562
13562
  },{key:"_sectionBoxCreated",value:function _sectionBoxCreated(sectionBox){var _this75=this;var newControl;newControl=new ClippingBox(this,this._controlsConfig);var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionBox(sectionBox);control.setVisible(true);this._currentControl=control;this._controls[sectionBox.id]=control;if(this._overview){this._overview.setSectionBox(sectionBox);}sectionBox.once("destroyed",function(){_this75._sectionPlaneDestroyed(sectionBox);});}/**
13563
13563
  * 设置是否是触屏模式
13564
13564
  * @param {boolean} touch
@@ -13591,7 +13591,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13591
13591
  * Shows the 3D editing gizmo for a {@link SectionPlane}.
13592
13592
  *
13593
13593
  * @param {String} id ID of the {@link SectionPlane}.
13594
- */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}this.hideControl();control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;}/**
13594
+ */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}this.hideControl();control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;this._shownControlIds=[id];}/**
13595
13595
  * 设置剖切对象的尺寸
13596
13596
  * @param {*} size
13597
13597
  */},{key:"setControlsSize",value:function setControlsSize(size){for(var id in this._controls){this._controls[id].controlSize=size;}}/**
@@ -13605,13 +13605,13 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13605
13605
  * Returns ````null```` when the editing gizmo is not shown.
13606
13606
  *
13607
13607
  * @returns {String} ID of the the {@link SectionPlane} that the 3D editing gizmo is shown for, if shown, else ````null````.
13608
- */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}/**
13608
+ */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}},{key:"getShownControls",value:function getShownControls(){return this._shownControlIds;}},{key:"showAllControl",value:function showAllControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._shownControlIds.push(id);this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}}/**
13609
13609
  * Hides the 3D {@link SectionPlane} editing gizmo if shown.
13610
- */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;}/**
13610
+ */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;this._shownControlIds=[];}/**
13611
13611
  * Destroys a {@link SectionPlane} created by this SectionPlanesPlugin.
13612
13612
  *
13613
13613
  * @param {String} id ID of the {@link SectionPlane}.
13614
- */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13614
+ */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;this._shownControlIds=[];}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13615
13615
  * Destroys all {@link SectionPlane}s created by this SectionPlanesPlugin.
13616
13616
  */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var i=0,len=ids.length;i<len;i++){this.destroySectionPlane(ids[i]);}}/**
13617
13617
  * @private
@@ -14206,7 +14206,7 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
14206
14206
  -1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
14207
14207
  1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
14208
14208
  ],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
14209
- rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{scale:cfg.scale,src:cfg.src,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
14209
+ rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{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
14210
14210
  }),// stationary: true,
14211
14211
  visible:false,pickable:false,clippable:false,collidable:false});_this78.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
14212
14212
  _this78.active=cfg.active;return _this78;}/**
@@ -14296,18 +14296,18 @@ _this78.active=cfg.active;return _this78;}/**
14296
14296
  @param {Object} params Skybox configuration.
14297
14297
  @param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
14298
14298
  @returns {Skybox} The new skybox.
14299
- */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14299
+ */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}if(!params.src&&!params.image){this.error("No legal skybox image or src: "+id);return this;}if(params.src){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}else if(params.image){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,image:params.image,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14300
14300
  * 设置开启天空盒
14301
14301
  */},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;for(var _i158=0;_i158<this.skyboxes.length;_i158++)this.skyboxes[_i158].active=active;}},{key:"getSkyBoxById",value:function getSkyBoxById(id){return this.skyboxes[id];}/**
14302
14302
  Destroys a skybox.
14303
14303
  @param id
14304
14304
  */},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
14305
14305
  Destroys all skyboxes.
14306
- */},{key:"clear",value:function clear(){var ids=Object.keys(this.viewer.scene.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14306
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14307
14307
  * Destroys this plugin.
14308
14308
  *
14309
14309
  * Clears skyboxes from the Viewer first.
14310
- */},{key:"destroy",value:function destroy(){this.clear();_superPropGet(SkyboxesPlugin,"clear",this,3)([]);}}]);}(Plugin);var treeViews=[];/**
14310
+ */},{key:"destroy",value:function destroy(){this.clear();}}]);}(Plugin);var treeViews=[];/**
14311
14311
  * @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.
14312
14312
  * <br>
14313
14313
  *
@@ -69898,9 +69898,9 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69898
69898
  // this._objectsKdTree3 = new ObjectsKdTree3({
69899
69899
  // viewer
69900
69900
  // });
69901
- this._skyBoxTool = new _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__["default"](this, {
69902
- src: cfg.skyBoxSrc
69903
- });
69901
+ if (cfg.skyBoxImage || cfg.skyBoxSrc) {
69902
+ this._skyBoxTool = new _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__["default"](this, { skyBoxImage: cfg.skyBoxImage, skyBoxSrc: cfg.skyBoxSrc });
69903
+ }
69904
69904
  // this._customizeViewer();
69905
69905
  this._modelsExplorer = new _explorer_ModelsExplorer__WEBPACK_IMPORTED_MODULE_11__["default"](this, {
69906
69906
  enableEditModels: false,
@@ -70372,8 +70372,14 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70372
70372
  * @param {Function} error Callback invoked on failure, into which the error message string is passed.
70373
70373
  */
70374
70374
  loadModel(modelId, modelBuffer, done = () => { }, error = () => { }) {
70375
+ if (!this._multiModel) {
70376
+ this._projectId = modelId;
70377
+ }
70375
70378
  this._modelsExplorer.loadModel(modelId, modelBuffer, done, error);
70376
70379
  }
70380
+ unloadModel(modelId) {
70381
+ this._modelsExplorer.unloadModel(modelId);
70382
+ }
70377
70383
  /**
70378
70384
  * 单独加载元数据
70379
70385
  * @param deflatedMetadata
@@ -70466,9 +70472,22 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70466
70472
  };
70467
70473
  return modelInfo;
70468
70474
  }
70475
+ /**
70476
+ * 获取指定元模型对象
70477
+ * @param modelId
70478
+ * @returns
70479
+ */
70469
70480
  getMetaModel(modelId) {
70470
70481
  return this.viewer.metaScene.metaModels[modelId];
70471
70482
  }
70483
+ /**
70484
+ * 获取指定场景模型对象
70485
+ * @param modelId
70486
+ * @returns
70487
+ */
70488
+ getSceneModel(modelId) {
70489
+ return this.viewer.scene.models[modelId];
70490
+ }
70472
70491
  //------------------------------------------------------------------------------------------------------------------
70473
70492
  // 视图设置
70474
70493
  //------------------------------------------------------------------------------------------------------------------
@@ -70833,7 +70852,8 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70833
70852
  this.measureAngleTool.destroy();
70834
70853
  this._annotationTool.destroy();
70835
70854
  this._commentsTool.destroy();
70836
- this._skyBoxTool.destroy();
70855
+ if (this._skyBoxTool)
70856
+ this._skyBoxTool.destroy();
70837
70857
  this._modelsExplorer.destroy();
70838
70858
  this._classesExplorer.destroy();
70839
70859
  this._objectsExplorer.destroy();
@@ -71358,8 +71378,15 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71358
71378
  * @param active
71359
71379
  * @param callback
71360
71380
  */
71361
- SetSkyBoxToolActive(active = !this._skyBoxTool.getActive(), callback = () => { }) {
71362
- this._skyBoxTool.setActive(active);
71381
+ SetSkyBoxToolActive(active, callback = () => { }) {
71382
+ if (!this._skyBoxTool)
71383
+ return;
71384
+ if (active == undefined) {
71385
+ this._skyBoxTool.setActive(!this._skyBoxTool.getActive());
71386
+ }
71387
+ else {
71388
+ this._skyBoxTool.setActive(active);
71389
+ }
71363
71390
  if (callback)
71364
71391
  callback(this._sectionTool.getActive());
71365
71392
  }
@@ -71515,6 +71542,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71515
71542
  done = sizeOrCallback;
71516
71543
  const { orbitYawCamera } = this;
71517
71544
  const { viewer } = this;
71545
+ const modelId = this._projectId;
71518
71546
  const canvas = document.createElement("canvas");
71519
71547
  const ctx = canvas.getContext("2d");
71520
71548
  const canvasWidth = size * 15;
@@ -71571,7 +71599,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71571
71599
  }
71572
71600
  cameraEnable(true);
71573
71601
  if (done)
71574
- done(imageData);
71602
+ done({ modelId, imageData });
71575
71603
  return imageData;
71576
71604
  }
71577
71605
  (() => __awaiter(this, void 0, void 0, function* () {
@@ -76605,7 +76633,7 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76605
76633
  }
76606
76634
  // this.setPointerLensVisible(false);
76607
76635
  // this.setPointerLensActive(false);
76608
- this.clear();
76636
+ // this.clear();
76609
76637
  }
76610
76638
  /**
76611
76639
  * destroy测量插件对象
@@ -76989,7 +77017,7 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76989
77017
  }
76990
77018
  // this.setPointerLensVisible(false);
76991
77019
  // this.setPointerLensActive(false);
76992
- this.clear();
77020
+ // this.clear();
76993
77021
  }
76994
77022
  /**
76995
77023
  * destroy测量插件对象
@@ -77341,10 +77369,6 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77341
77369
  this._isTouch = false;
77342
77370
  this.on("active", (active) => {
77343
77371
  if (active) {
77344
- // this._onHover = this.viewer.cameraControl.on("hover", (hoverResult: any) => {
77345
- // if (!hoverResult.entity) {
77346
- // }
77347
- // });
77348
77372
  }
77349
77373
  else {
77350
77374
  this.clear();
@@ -77547,6 +77571,7 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77547
77571
  for (const section in sectionPlanes) {
77548
77572
  const sectionPlane = sectionPlanes[section];
77549
77573
  sectionPlane.active = false;
77574
+ this.hideControl();
77550
77575
  }
77551
77576
  }
77552
77577
  /**
@@ -77560,8 +77585,8 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77560
77585
  */
77561
77586
  showControl() {
77562
77587
  const sectionPlanes = this.getSectionPlanes();
77563
- for (const plane in sectionPlanes) {
77564
- this._sectionPlanesPlugin.showControl(plane);
77588
+ for (const id in sectionPlanes) {
77589
+ sectionPlanes[id].control.setVisible(true);
77565
77590
  }
77566
77591
  }
77567
77592
  /**
@@ -77697,17 +77722,22 @@ __webpack_require__.r(__webpack_exports__);
77697
77722
  class SkyBoxTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77698
77723
  constructor(parent, cfg = {}) {
77699
77724
  super(parent, cfg);
77700
- const skyBoxImgSrc = cfg.src;
77701
77725
  this.skyboxesPlugin = new _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.SkyboxesPlugin(this.viewer);
77726
+ this.on("active", (active) => {
77727
+ this.setSkyBoxActiveById();
77728
+ });
77729
+ this.createSkyBox(cfg);
77730
+ }
77731
+ createSkyBox(cfg) {
77732
+ const { skyBoxImage } = cfg;
77733
+ const { skyBoxSrc } = cfg;
77702
77734
  this.skyboxesPlugin.createSkybox("skybox1", {
77703
- src: skyBoxImgSrc,
77735
+ src: skyBoxSrc,
77736
+ image: skyBoxImage,
77704
77737
  size: 9000,
77705
77738
  scale: [1, 1],
77706
77739
  active: false
77707
77740
  });
77708
- this.on("active", (active) => {
77709
- this.setSkyBoxActiveById();
77710
- });
77711
77741
  }
77712
77742
  setSkyBoxActiveById(id = "skybox1", active = !this.getSkyBoxById(id).active) {
77713
77743
  this.skyboxesPlugin.setSkyBoxActiveById(id, active);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "0.1.13";
2
+ export const VERSION = "0.1.15";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "0.1.13";
2
+ export const VERSION = "0.1.15";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtctwins/tctwins-bimx-viewer",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "private": false,
5
5
  "description": "BIM viewer built on xtctwins",
6
6
  "main": "./dist/tctwins-bimx-viewer.min.es.js",
@@ -28,7 +28,7 @@
28
28
  "@types/ali-oss": "^6.16.11",
29
29
  "@typescript-eslint/eslint-plugin": "^6.14.0",
30
30
  "@typescript-eslint/parser": "^6.14.0",
31
- "@xtctwins/tctwins-core": "^1.0.46",
31
+ "@xtctwins/tctwins-core": "^1.0.48",
32
32
  "ali-oss": "^6.18.1",
33
33
  "autoprefixer": "^9.8.6",
34
34
  "axios": "^1.6.5",
@@ -39,7 +39,7 @@ export default class BIMXViewer extends Controller {
39
39
  protected _measureTool: MeasureTool;
40
40
  protected _sectionTool: SectionTool;
41
41
  protected _commentsTool: CommentsTool;
42
- protected _skyBoxTool: SkyBoxTool;
42
+ protected _skyBoxTool: SkyBoxTool | undefined;
43
43
  protected _showSpacesMode: ShowSpacesMode;
44
44
  protected _navCubeMode: NavCubeMode;
45
45
  protected _objectColorSource?: string;
@@ -139,6 +139,7 @@ export default class BIMXViewer extends Controller {
139
139
  * @param {Function} error Callback invoked on failure, into which the error message string is passed.
140
140
  */
141
141
  loadModel(modelId: string, modelBuffer: ArrayBuffer, done?: (result?: any) => void, error?: (errorMsg: string) => void): void;
142
+ unloadModel(modelId: string): void;
142
143
  /**
143
144
  * 单独加载元数据
144
145
  * @param deflatedMetadata
@@ -179,7 +180,18 @@ export default class BIMXViewer extends Controller {
179
180
  objectCount: string | number;
180
181
  propertySetCount: string | number;
181
182
  };
183
+ /**
184
+ * 获取指定元模型对象
185
+ * @param modelId
186
+ * @returns
187
+ */
182
188
  getMetaModel(modelId: string): import("@xtctwins/tctwins-core").MetaModel;
189
+ /**
190
+ * 获取指定场景模型对象
191
+ * @param modelId
192
+ * @returns
193
+ */
194
+ getSceneModel(modelId: string): import("@xtctwins/tctwins-core").SceneModel;
183
195
  protected _withObjectsInSubtree(objectIds: string[], callback?: (content?: any) => void): void;
184
196
  /**
185
197
  * Flies the camera to fit the given object in view.
@@ -616,7 +628,7 @@ export default class BIMXViewer extends Controller {
616
628
  /**
617
629
  * 天空盒工具对象
618
630
  */
619
- get skyBoxTool(): SkyBoxTool;
631
+ get skyBoxTool(): SkyBoxTool | undefined;
620
632
  /**
621
633
  * 设置相机方向
622
634
  * @param {number} dirNum
@@ -3,6 +3,7 @@ import Controller from "../Controller";
3
3
  export default class SkyBoxTool extends Controller {
4
4
  skyboxesPlugin: SkyboxesPlugin;
5
5
  constructor(parent: any, cfg?: any);
6
+ createSkyBox(cfg: any): void;
6
7
  setSkyBoxActiveById(id?: string, active?: boolean): void;
7
8
  getSkyBoxById(id?: string): any;
8
9
  destroy(): void;