@xtctwins/tctwins-core 1.0.12 → 1.0.14

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.
@@ -4589,7 +4589,7 @@ return imageDataCache;}},{key:"unbind",value:function unbind(){var gl=this.gl;gl
4589
4589
  * @type {WebGL2RenderingContext}
4590
4590
  */var gl=scene.canvas.gl;var canvasTransparent=!!options.transparent;var alphaDepthMask=options.alphaDepthMask;var pickIDs=new Map$1({});var drawableTypeInfo={};var drawables={};var drawableListDirty=true;var stateSortDirty=true;var imageDirty=true;var transparentEnabled=true;var edgesEnabled=!!options.edgesEnabled;var saoEnabled=true;var pbrEnabled=true;var colorTextureEnabled=true;var renderBufferManager=new RenderBufferManager(scene);var snapshotBound=false;var saoOcclusionRenderer=new SAOOcclusionRenderer(scene);var saoDepthLimitedBlurRenderer=new SAODepthLimitedBlurRenderer(scene);this.scene=scene;this._occlusionTester=null;// Lazy-created in #addMarker()
4591
4591
  this.capabilities={astcSupported:!!getExtension(gl,'WEBGL_compressed_texture_astc'),etc1Supported:true,// WebGL2
4592
- etc2Supported:!!getExtension(gl,'WEBGL_compressed_texture_etc'),dxtSupported:!!getExtension(gl,'WEBGL_compressed_texture_s3tc'),bptcSupported:!!getExtension(gl,'EXT_texture_compression_bptc'),pvrtcSupported:!!(getExtension(gl,'WEBGL_compressed_texture_pvrtc')||getExtension(gl,'WEBKIT_WEBGL_compressed_texture_pvrtc'))};this.setTransparentEnabled=function(enabled){transparentEnabled=enabled;imageDirty=true;};this.setEdgesEnabled=function(enabled){edgesEnabled=enabled;imageDirty=true;};this.setSAOEnabled=function(enabled){saoEnabled=enabled;imageDirty=true;};this.setPBREnabled=function(enabled){pbrEnabled=enabled;imageDirty=true;};this.setColorTextureEnabled=function(enabled){colorTextureEnabled=enabled;imageDirty=true;};this.needStateSort=function(){stateSortDirty=true;};this.shadowsDirty=function(){};this.imageDirty=function(){imageDirty=true;};this.webglContextLost=function(){};this.webglContextRestored=function(gl){// renderBufferManager.webglContextRestored(gl);
4592
+ etc2Supported:!!getExtension(gl,'WEBGL_compressed_texture_etc'),dxtSupported:!!getExtension(gl,'WEBGL_compressed_texture_s3tc'),bptcSupported:!!getExtension(gl,'EXT_texture_compression_bptc'),pvrtcSupported:!!(getExtension(gl,'WEBGL_compressed_texture_pvrtc')||getExtension(gl,'WEBKIT_WEBGL_compressed_texture_pvrtc'))};this.setTransparentEnabled=function(enabled){transparentEnabled=enabled;canvasTransparent=enabled;imageDirty=true;};this.setEdgesEnabled=function(enabled){edgesEnabled=enabled;imageDirty=true;};this.setSAOEnabled=function(enabled){saoEnabled=enabled;imageDirty=true;};this.setPBREnabled=function(enabled){pbrEnabled=enabled;imageDirty=true;};this.setColorTextureEnabled=function(enabled){colorTextureEnabled=enabled;imageDirty=true;};this.needStateSort=function(){stateSortDirty=true;};this.shadowsDirty=function(){};this.imageDirty=function(){imageDirty=true;};this.webglContextLost=function(){};this.webglContextRestored=function(gl){// renderBufferManager.webglContextRestored(gl);
4593
4593
  saoOcclusionRenderer.init();saoDepthLimitedBlurRenderer.init();imageDirty=true;};/**
4594
4594
  * Inserts a drawable into this renderer.
4595
4595
  * @private
@@ -4605,7 +4605,7 @@ saoOcclusionRenderer.init();saoDepthLimitedBlurRenderer.init();imageDirty=true;}
4605
4605
  */this.putPickID=function(pickID){pickIDs.removeItem(pickID);};/**
4606
4606
  * Clears the canvas.
4607
4607
  * @private
4608
- */this.clear=function(params){gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(1,1,1,1);}else{var _backgroundColor=scene.canvas.backgroundColorFromAmbientLight?this.lights.getAmbientColorAndIntensity():scene.canvas.backgroundColor;gl.clearColor(_backgroundColor[0],_backgroundColor[1],_backgroundColor[2],1.0);}gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);};/**
4608
+ */this.clear=function(params){gl.viewport(0,0,gl.drawingBufferWidth,gl.drawingBufferHeight);if(canvasTransparent){gl.clearColor(1,1,1,0);}else{var _backgroundColor=scene.canvas.backgroundColorFromAmbientLight?this.lights.getAmbientColorAndIntensity():scene.canvas.backgroundColor;gl.clearColor(_backgroundColor[0],_backgroundColor[1],_backgroundColor[2],1.0);}gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);};/**
4609
4609
  * Returns true if the next call to render() will draw something
4610
4610
  * @returns {Boolean}
4611
4611
  */this.needsRender=function(){var needsRender=imageDirty||drawableListDirty||stateSortDirty;return needsRender;};/**
@@ -8817,28 +8817,28 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
8817
8817
  *
8818
8818
  * @class Scene
8819
8819
  */var Scene=/*#__PURE__*/function(_Component20){_inherits(Scene,_Component20);var _super33=_createSuper(Scene);/**
8820
+ * @private
8821
+ * @constructor
8822
+ * @param {Viewer} viewer The Viewer this Scene belongs to.
8823
+ * @param {Object} cfg Scene configuration.
8824
+ * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
8825
+ * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
8826
+ * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
8827
+ * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
8828
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
8829
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
8830
+ * responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
8831
+ * your expected usage.
8832
+ * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
8833
+ */function Scene(viewer){var _this52;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this52=_super33.call(this,null,cfg);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
8834
+ * @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
8835
+ */_this52._tickifiedFunctions={};_this52._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this52._edgesEnabled=!!cfg.edgesEnabled;_this52._aabbDirty=true;/**
8836
+ * The {@link Viewer} this Scene belongs to.
8837
+ * @type {Viewer}
8838
+ */_this52.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
8820
8839
  * @private
8821
- * @constructor
8822
- * @param {Viewer} viewer The Viewer this Scene belongs to.
8823
- * @param {Object} cfg Scene configuration.
8824
- * @param {String} [cfg.canvasId] ID of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasElement is mandatory. When both values are given, the element reference is always preferred to the ID.
8825
- * @param {HTMLCanvasElement} [cfg.canvasElement] Reference of an existing HTML canvas for the {@link Scene#canvas} - either this or canvasId is mandatory. When both values are given, the element reference is always preferred to the ID.
8826
- * @param {HTMLElement} [cfg.keyboardEventsElement] Optional reference to HTML element on which key events should be handled. Defaults to the HTML Document.
8827
- * @param {number} [cfg.numCachedSectionPlanes=0] Enhances the efficiency of SectionPlane creation by proactively allocating Viewer resources for a specified quantity
8828
- * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
8829
- * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
8830
- * responsiveness. It is important to consider that each SectionPlane imposes rendering performance, so it is recommended to set this value to a quantity that aligns with
8831
- * your expected usage.
8832
- * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
8833
- */function Scene(viewer){var _this52;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this52=_super33.call(this,null,cfg);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
8834
- * @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
8835
- */_this52._tickifiedFunctions={};var transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;var edgesEnabled=!!cfg.edgesEnabled;_this52._aabbDirty=true;/**
8836
- * The {@link Viewer} this Scene belongs to.
8837
- * @type {Viewer}
8838
- */_this52.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
8839
- * @private
8840
- * @type {number}
8841
- */_this52.occlusionTestCountdown=0;/**
8840
+ * @type {number}
8841
+ */_this52.occlusionTestCountdown=0;/**
8842
8842
  The number of models currently loading.
8843
8843
 
8844
8844
  @property loading
@@ -8851,158 +8851,157 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
8851
8851
  @final
8852
8852
  @type {Number}
8853
8853
  */_this52.startTime=new Date().getTime();/**
8854
- * Map of {@link Entity}s that represent models.
8855
- *
8856
- * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isModel} is ````true````.
8857
- *
8858
- * @property models
8859
- * @final
8860
- * @type {{String:Entity}}
8861
- */_this52.models={};/**
8862
- * Map of {@link Entity}s that represents objects.
8863
- *
8864
- * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isObject} is ````true````.
8865
- *
8866
- * @property objects
8867
- * @final
8868
- * @type {{String:Entity}}
8869
- */_this52.objects={};_this52._numObjects=0;/**
8870
- * Map of currently visible {@link Entity}s that represent objects.
8871
- *
8872
- * An Entity represents an object if {@link Entity#isObject} is ````true````, and is visible when {@link Entity#visible} is true.
8873
- *
8874
- * @property visibleObjects
8875
- * @final
8876
- * @type {{String:Object}}
8877
- */_this52.visibleObjects={};_this52._numVisibleObjects=0;/**
8878
- * Map of currently xrayed {@link Entity}s that represent objects.
8879
- *
8880
- * An Entity represents an object if {@link Entity#isObject} is ````true````, and is xrayed when {@link Entity#xrayed} is true.
8881
- *
8882
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8883
- *
8884
- * @property xrayedObjects
8885
- * @final
8886
- * @type {{String:Object}}
8887
- */_this52.xrayedObjects={};_this52._numXRayedObjects=0;/**
8888
- * Map of currently highlighted {@link Entity}s that represent objects.
8889
- *
8890
- * An Entity represents an object if {@link Entity#isObject} is ````true```` is true, and is highlighted when {@link Entity#highlighted} is true.
8891
- *
8892
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8893
- *
8894
- * @property highlightedObjects
8895
- * @final
8896
- * @type {{String:Object}}
8897
- */_this52.highlightedObjects={};_this52._numHighlightedObjects=0;/**
8898
- * Map of currently selected {@link Entity}s that represent objects.
8899
- *
8900
- * An Entity represents an object if {@link Entity#isObject} is true, and is selected while {@link Entity#selected} is true.
8901
- *
8902
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8903
- *
8904
- * @property selectedObjects
8905
- * @final
8906
- * @type {{String:Object}}
8907
- */_this52.selectedObjects={};_this52._numSelectedObjects=0;/**
8908
- * Map of currently colorized {@link Entity}s that represent objects.
8909
- *
8910
- * An Entity represents an object if {@link Entity#isObject} is ````true````.
8911
- *
8912
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8913
- *
8914
- * @property colorizedObjects
8915
- * @final
8916
- * @type {{String:Object}}
8917
- */_this52.colorizedObjects={};_this52._numColorizedObjects=0;/**
8918
- * Map of {@link Entity}s that represent objects whose opacity was updated.
8919
- *
8920
- * An Entity represents an object if {@link Entity#isObject} is ````true````.
8921
- *
8922
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8923
- *
8924
- * @property opacityObjects
8925
- * @final
8926
- * @type {{String:Object}}
8927
- */_this52.opacityObjects={};_this52._numOpacityObjects=0;/**
8928
- * Map of {@link Entity}s that represent objects whose {@link Entity#offset}s were updated.
8929
- *
8930
- * An Entity represents an object if {@link Entity#isObject} is ````true````.
8931
- *
8932
- * Each {@link Entity} is mapped here by {@link Entity#id}.
8933
- *
8934
- * @property offsetObjects
8935
- * @final
8936
- * @type {{String:Object}}
8937
- */_this52.offsetObjects={};_this52._numOffsetObjects=0;// Cached ID arrays, lazy-rebuilt as needed when stale after map updates
8854
+ * Map of {@link Entity}s that represent models.
8855
+ *
8856
+ * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isModel} is ````true````.
8857
+ *
8858
+ * @property models
8859
+ * @final
8860
+ * @type {{String:Entity}}
8861
+ */_this52.models={};/**
8862
+ * Map of {@link Entity}s that represents objects.
8863
+ *
8864
+ * Each {@link Entity} is mapped here by {@link Entity#id} when {@link Entity#isObject} is ````true````.
8865
+ *
8866
+ * @property objects
8867
+ * @final
8868
+ * @type {{String:Entity}}
8869
+ */_this52.objects={};_this52._numObjects=0;/**
8870
+ * Map of currently visible {@link Entity}s that represent objects.
8871
+ *
8872
+ * An Entity represents an object if {@link Entity#isObject} is ````true````, and is visible when {@link Entity#visible} is true.
8873
+ *
8874
+ * @property visibleObjects
8875
+ * @final
8876
+ * @type {{String:Object}}
8877
+ */_this52.visibleObjects={};_this52._numVisibleObjects=0;/**
8878
+ * Map of currently xrayed {@link Entity}s that represent objects.
8879
+ *
8880
+ * An Entity represents an object if {@link Entity#isObject} is ````true````, and is xrayed when {@link Entity#xrayed} is true.
8881
+ *
8882
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8883
+ *
8884
+ * @property xrayedObjects
8885
+ * @final
8886
+ * @type {{String:Object}}
8887
+ */_this52.xrayedObjects={};_this52._numXRayedObjects=0;/**
8888
+ * Map of currently highlighted {@link Entity}s that represent objects.
8889
+ *
8890
+ * An Entity represents an object if {@link Entity#isObject} is ````true```` is true, and is highlighted when {@link Entity#highlighted} is true.
8891
+ *
8892
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8893
+ *
8894
+ * @property highlightedObjects
8895
+ * @final
8896
+ * @type {{String:Object}}
8897
+ */_this52.highlightedObjects={};_this52._numHighlightedObjects=0;/**
8898
+ * Map of currently selected {@link Entity}s that represent objects.
8899
+ *
8900
+ * An Entity represents an object if {@link Entity#isObject} is true, and is selected while {@link Entity#selected} is true.
8901
+ *
8902
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8903
+ *
8904
+ * @property selectedObjects
8905
+ * @final
8906
+ * @type {{String:Object}}
8907
+ */_this52.selectedObjects={};_this52._numSelectedObjects=0;/**
8908
+ * Map of currently colorized {@link Entity}s that represent objects.
8909
+ *
8910
+ * An Entity represents an object if {@link Entity#isObject} is ````true````.
8911
+ *
8912
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8913
+ *
8914
+ * @property colorizedObjects
8915
+ * @final
8916
+ * @type {{String:Object}}
8917
+ */_this52.colorizedObjects={};_this52._numColorizedObjects=0;/**
8918
+ * Map of {@link Entity}s that represent objects whose opacity was updated.
8919
+ *
8920
+ * An Entity represents an object if {@link Entity#isObject} is ````true````.
8921
+ *
8922
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8923
+ *
8924
+ * @property opacityObjects
8925
+ * @final
8926
+ * @type {{String:Object}}
8927
+ */_this52.opacityObjects={};_this52._numOpacityObjects=0;/**
8928
+ * Map of {@link Entity}s that represent objects whose {@link Entity#offset}s were updated.
8929
+ *
8930
+ * An Entity represents an object if {@link Entity#isObject} is ````true````.
8931
+ *
8932
+ * Each {@link Entity} is mapped here by {@link Entity#id}.
8933
+ *
8934
+ * @property offsetObjects
8935
+ * @final
8936
+ * @type {{String:Object}}
8937
+ */_this52.offsetObjects={};_this52._numOffsetObjects=0;// Cached ID arrays, lazy-rebuilt as needed when stale after map updates
8938
8938
  /**
8939
8939
  Lazy-regenerated ID lists.
8940
8940
  */_this52._modelIds=null;_this52._objectIds=null;_this52._visibleObjectIds=null;_this52._xrayedObjectIds=null;_this52._highlightedObjectIds=null;_this52._selectedObjectIds=null;_this52._colorizedObjectIds=null;_this52._opacityObjectIds=null;_this52._offsetObjectIds=null;_this52._collidables={};// Components that contribute to the Scene AABB
8941
8941
  _this52._compilables={};// Components that require shader compilation
8942
8942
  _this52._needRecompile=false;/**
8943
- * For each {@link Component} type, a map of IDs to {@link Component} instances of that type.
8944
- *
8945
- * @type {{String:{String:Component}}}
8946
- */_this52.types={};/**
8947
- * The {@link Component}s within this Scene, each mapped to its {@link Component#id}.
8948
- *
8949
- * *@type {{String:Component}}
8950
- */_this52.components={};/**
8951
- * The {@link SectionPlane}s in this Scene, each mapped to its {@link SectionPlane#id}.
8952
- *
8953
- * @type {{String:SectionPlane}}
8954
- */_this52.sectionPlanes={};/**
8955
- * The {@link Light}s in this Scene, each mapped to its {@link Light#id}.
8956
- *
8957
- * @type {{String:Light}}
8958
- */_this52.lights={};/**
8959
- * The {@link LightMap}s in this Scene, each mapped to its {@link LightMap#id}.
8960
- *
8961
- * @type {{String:LightMap}}
8962
- */_this52.lightMaps={};/**
8963
- * The {@link ReflectionMap}s in this Scene, each mapped to its {@link ReflectionMap#id}.
8964
- *
8965
- * @type {{String:ReflectionMap}}
8966
- */_this52.reflectionMaps={};/**
8967
- * The {@link Bitmap}s in this Scene, each mapped to its {@link Bitmap#id}.
8968
- *
8969
- * @type {{String:Bitmap}}
8970
- */_this52.bitmaps={};/**
8971
- * The {@link LineSet}s in this Scene, each mapped to its {@link LineSet#id}.
8972
- *
8973
- * @type {{String:LineSet}}
8974
- */_this52.lineSets={};/**
8975
- * The real world offset for this Scene
8976
- *
8977
- * @type {Number[]}
8978
- */_this52.realWorldOffset=cfg.realWorldOffset||new Float64Array([0,0,0]);/**
8979
- * Manages the HTML5 canvas for this Scene.
8980
- *
8981
- * @type {Canvas}
8982
- */_this52.canvas=new Canvas(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
8983
- canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:transparent,webgl2:cfg.webgl2!==false,contextAttr:cfg.contextAttr||{},backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,premultipliedAlpha:cfg.premultipliedAlpha});_this52.canvas.on("boundary",function(){_this52.glRedraw();});_this52.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this52._renderer=new Renderer$1(_assertThisInitialized(_this52),{transparent:transparent,alphaDepthMask:alphaDepthMask,edgesEnabled:edgesEnabled});_this52._sectionPlanesState=new function(){this.sectionPlanes=[];this.clippingCaps=false;this._numCachedSectionPlanes=0;var hash=null;this.getHash=function(){if(hash){return hash;}var numAllocatedSectionPlanes=this.getNumAllocatedSectionPlanes();var sectionPlanes=this.sectionPlanes;if(numAllocatedSectionPlanes===0){return this.hash=";";}var hashParts=[];for(var _i80=0,len=numAllocatedSectionPlanes;_i80<len;_i80++){sectionPlanes[_i80];hashParts.push("cp");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addSectionPlane=function(sectionPlane){this.sectionPlanes.push(sectionPlane);hash=null;};this.removeSectionPlane=function(sectionPlane){for(var _i81=0,len=this.sectionPlanes.length;_i81<len;_i81++){if(this.sectionPlanes[_i81].id===sectionPlane.id){this.sectionPlanes.splice(_i81,1);hash=null;return;}}};this.setNumCachedSectionPlanes=function(numCachedSectionPlanes){this._numCachedSectionPlanes=numCachedSectionPlanes;hash=null;};this.getNumCachedSectionPlanes=function(){return this._numCachedSectionPlanes;};this.getNumAllocatedSectionPlanes=function(){var num=this.sectionPlanes.length;return num>this._numCachedSectionPlanes?num:this._numCachedSectionPlanes;};}();_this52._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this52._lightsState=new function(){var DEFAULT_AMBIENT=math.vec4([0,0,0,0]);var ambientColorIntensity=math.vec4();this.lights=[];this.reflectionMaps=[];this.lightMaps=[];var hash=null;var ambientLight=null;this.getHash=function(){if(hash){return hash;}var hashParts=[];var lights=this.lights;var light;for(var _i82=0,len=lights.length;_i82<len;_i82++){light=lights[_i82];hashParts.push("/");hashParts.push(light.type);hashParts.push(light.space==="world"?"w":"v");if(light.castsShadow){hashParts.push("sh");}}if(this.lightMaps.length>0){hashParts.push("/lm");}if(this.reflectionMaps.length>0){hashParts.push("/rm");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addLight=function(state){this.lights.push(state);ambientLight=null;hash=null;};this.removeLight=function(state){for(var _i83=0,len=this.lights.length;_i83<len;_i83++){var light=this.lights[_i83];if(light.id===state.id){this.lights.splice(_i83,1);if(ambientLight&&ambientLight.id===state.id){ambientLight=null;}hash=null;return;}}};this.addReflectionMap=function(state){this.reflectionMaps.push(state);hash=null;};this.removeReflectionMap=function(state){for(var _i84=0,len=this.reflectionMaps.length;_i84<len;_i84++){if(this.reflectionMaps[_i84].id===state.id){this.reflectionMaps.splice(_i84,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i85=0,len=this.lightMaps.length;_i85<len;_i85++){if(this.lightMaps[_i85].id===state.id){this.lightMaps.splice(_i85,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i86=0,len=this.lights.length;_i86<len;_i86++){var light=this.lights[_i86];if(light.type==="ambient"){ambientLight=light;break;}}}if(ambientLight){var _color2=ambientLight.color;var intensity=ambientLight.intensity;ambientColorIntensity[0]=_color2[0];ambientColorIntensity[1]=_color2[1];ambientColorIntensity[2]=_color2[2];ambientColorIntensity[3]=intensity;return ambientColorIntensity;}else{return DEFAULT_AMBIENT;}};}();/**
8984
- * Publishes input events that occur on this Scene's canvas.
8985
- *
8986
- * @property input
8987
- * @type {Input}
8988
- * @final
8989
- */_this52.input=new Input(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
8943
+ * For each {@link Component} type, a map of IDs to {@link Component} instances of that type.
8944
+ *
8945
+ * @type {{String:{String:Component}}}
8946
+ */_this52.types={};/**
8947
+ * The {@link Component}s within this Scene, each mapped to its {@link Component#id}.
8948
+ *
8949
+ * *@type {{String:Component}}
8950
+ */_this52.components={};/**
8951
+ * The {@link SectionPlane}s in this Scene, each mapped to its {@link SectionPlane#id}.
8952
+ *
8953
+ * @type {{String:SectionPlane}}
8954
+ */_this52.sectionPlanes={};/**
8955
+ * The {@link Light}s in this Scene, each mapped to its {@link Light#id}.
8956
+ *
8957
+ * @type {{String:Light}}
8958
+ */_this52.lights={};/**
8959
+ * The {@link LightMap}s in this Scene, each mapped to its {@link LightMap#id}.
8960
+ *
8961
+ * @type {{String:LightMap}}
8962
+ */_this52.lightMaps={};/**
8963
+ * The {@link ReflectionMap}s in this Scene, each mapped to its {@link ReflectionMap#id}.
8964
+ *
8965
+ * @type {{String:ReflectionMap}}
8966
+ */_this52.reflectionMaps={};/**
8967
+ * The {@link Bitmap}s in this Scene, each mapped to its {@link Bitmap#id}.
8968
+ *
8969
+ * @type {{String:Bitmap}}
8970
+ */_this52.bitmaps={};/**
8971
+ * The {@link LineSet}s in this Scene, each mapped to its {@link LineSet#id}.
8972
+ *
8973
+ * @type {{String:LineSet}}
8974
+ */_this52.lineSets={};/**
8975
+ * The real world offset for this Scene
8976
+ *
8977
+ * @type {Number[]}
8978
+ */_this52.realWorldOffset=cfg.realWorldOffset||new Float64Array([0,0,0]);/**
8979
+ * Manages the HTML5 canvas for this Scene.
8980
+ *
8981
+ * @type {Canvas}
8982
+ */_this52.canvas=new Canvas(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
8983
+ canvas:canvas,spinnerElementId:cfg.spinnerElementId,transparent:_this52._transparent,webgl2:cfg.webgl2!==false,contextAttr:cfg.contextAttr||{},backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,premultipliedAlpha:cfg.premultipliedAlpha});_this52.canvas.on("boundary",function(){_this52.glRedraw();});_this52.canvas.on("webglContextFailed",function(){alert("xeokit failed to find WebGL!");});_this52._renderer=new Renderer$1(_assertThisInitialized(_this52),{transparent:_this52._transparent,alphaDepthMask:alphaDepthMask,edgesEnabled:_this52._edgesEnabled});_this52._sectionPlanesState=new function(){this.sectionPlanes=[];this.clippingCaps=false;this._numCachedSectionPlanes=0;var hash=null;this.getHash=function(){if(hash){return hash;}var numAllocatedSectionPlanes=this.getNumAllocatedSectionPlanes();var sectionPlanes=this.sectionPlanes;if(numAllocatedSectionPlanes===0){return this.hash=";";}var hashParts=[];for(var _i80=0,len=numAllocatedSectionPlanes;_i80<len;_i80++){sectionPlanes[_i80];hashParts.push("cp");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addSectionPlane=function(sectionPlane){this.sectionPlanes.push(sectionPlane);hash=null;};this.removeSectionPlane=function(sectionPlane){for(var _i81=0,len=this.sectionPlanes.length;_i81<len;_i81++){if(this.sectionPlanes[_i81].id===sectionPlane.id){this.sectionPlanes.splice(_i81,1);hash=null;return;}}};this.setNumCachedSectionPlanes=function(numCachedSectionPlanes){this._numCachedSectionPlanes=numCachedSectionPlanes;hash=null;};this.getNumCachedSectionPlanes=function(){return this._numCachedSectionPlanes;};this.getNumAllocatedSectionPlanes=function(){var num=this.sectionPlanes.length;return num>this._numCachedSectionPlanes?num:this._numCachedSectionPlanes;};}();_this52._sectionPlanesState.setNumCachedSectionPlanes(cfg.numCachedSectionPlanes||0);_this52._lightsState=new function(){var DEFAULT_AMBIENT=math.vec4([0,0,0,0]);var ambientColorIntensity=math.vec4();this.lights=[];this.reflectionMaps=[];this.lightMaps=[];var hash=null;var ambientLight=null;this.getHash=function(){if(hash){return hash;}var hashParts=[];var lights=this.lights;var light;for(var _i82=0,len=lights.length;_i82<len;_i82++){light=lights[_i82];hashParts.push("/");hashParts.push(light.type);hashParts.push(light.space==="world"?"w":"v");if(light.castsShadow){hashParts.push("sh");}}if(this.lightMaps.length>0){hashParts.push("/lm");}if(this.reflectionMaps.length>0){hashParts.push("/rm");}hashParts.push(";");hash=hashParts.join("");return hash;};this.addLight=function(state){this.lights.push(state);ambientLight=null;hash=null;};this.removeLight=function(state){for(var _i83=0,len=this.lights.length;_i83<len;_i83++){var light=this.lights[_i83];if(light.id===state.id){this.lights.splice(_i83,1);if(ambientLight&&ambientLight.id===state.id){ambientLight=null;}hash=null;return;}}};this.addReflectionMap=function(state){this.reflectionMaps.push(state);hash=null;};this.removeReflectionMap=function(state){for(var _i84=0,len=this.reflectionMaps.length;_i84<len;_i84++){if(this.reflectionMaps[_i84].id===state.id){this.reflectionMaps.splice(_i84,1);hash=null;return;}}};this.addLightMap=function(state){this.lightMaps.push(state);hash=null;};this.removeLightMap=function(state){for(var _i85=0,len=this.lightMaps.length;_i85<len;_i85++){if(this.lightMaps[_i85].id===state.id){this.lightMaps.splice(_i85,1);hash=null;return;}}};this.getAmbientColorAndIntensity=function(){if(!ambientLight){for(var _i86=0,len=this.lights.length;_i86<len;_i86++){var light=this.lights[_i86];if(light.type==="ambient"){ambientLight=light;break;}}}if(ambientLight){var _color2=ambientLight.color;var intensity=ambientLight.intensity;ambientColorIntensity[0]=_color2[0];ambientColorIntensity[1]=_color2[1];ambientColorIntensity[2]=_color2[2];ambientColorIntensity[3]=intensity;return ambientColorIntensity;}else{return DEFAULT_AMBIENT;}};}();/**
8984
+ * Publishes input events that occur on this Scene's canvas.
8985
+ * @property input
8986
+ * @type {Input}
8987
+ * @final
8988
+ */_this52.input=new Input(_assertThisInitialized(_this52),{dontClear:true,// Never destroy this component with Scene#clear();
8990
8989
  element:_this52.canvas.canvas,keyboardEventsElement:cfg.keyboardEventsElement});/**
8991
- * Configures this Scene's units of measurement and coordinate mapping between Real-space and World-space 3D coordinate systems.
8992
- *
8993
- * @property metrics
8994
- * @type {Metrics}
8995
- * @final
8996
- */_this52.metrics=new Metrics(_assertThisInitialized(_this52),{units:cfg.units,scale:cfg.scale,origin:cfg.origin});/** Configures Scalable Ambient Obscurance (SAO) for this Scene.
8997
- * @type {SAO}
8998
- * @final
8999
- */_this52.sao=new SAO(_assertThisInitialized(_this52),{enabled:cfg.saoEnabled});_this52.ticksPerRender=cfg.ticksPerRender;_this52.ticksPerOcclusionTest=cfg.ticksPerOcclusionTest;_this52.passes=cfg.passes;_this52.clearEachPass=cfg.clearEachPass;_this52.gammaInput=cfg.gammaInput;_this52.gammaOutput=cfg.gammaOutput;_this52.gammaFactor=cfg.gammaFactor;_this52._entityOffsetsEnabled=!!cfg.entityOffsetsEnabled;_this52._logarithmicDepthBufferEnabled=!!cfg.logarithmicDepthBufferEnabled;_this52._dtxEnabled=cfg.dtxEnabled!==false;_this52._pbrEnabled=!!cfg.pbrEnabled;_this52._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this52._dtxEnabled=!!cfg.dtxEnabled;// Register Scene on xeokit
8990
+ * Configures this Scene's units of measurement and coordinate mapping between Real-space and World-space 3D coordinate systems.
8991
+ *
8992
+ * @property metrics
8993
+ * @type {Metrics}
8994
+ * @final
8995
+ */_this52.metrics=new Metrics(_assertThisInitialized(_this52),{units:cfg.units,scale:cfg.scale,origin:cfg.origin});/** Configures Scalable Ambient Obscurance (SAO) for this Scene.
8996
+ * @type {SAO}
8997
+ * @final
8998
+ */_this52.sao=new SAO(_assertThisInitialized(_this52),{enabled:cfg.saoEnabled});_this52.ticksPerRender=cfg.ticksPerRender;_this52.ticksPerOcclusionTest=cfg.ticksPerOcclusionTest;_this52.passes=cfg.passes;_this52.clearEachPass=cfg.clearEachPass;_this52.gammaInput=cfg.gammaInput;_this52.gammaOutput=cfg.gammaOutput;_this52.gammaFactor=cfg.gammaFactor;_this52._entityOffsetsEnabled=!!cfg.entityOffsetsEnabled;_this52._logarithmicDepthBufferEnabled=!!cfg.logarithmicDepthBufferEnabled;_this52._dtxEnabled=cfg.dtxEnabled!==false;_this52._pbrEnabled=!!cfg.pbrEnabled;_this52._colorTextureEnabled=cfg.colorTextureEnabled!==false;_this52._dtxEnabled=!!cfg.dtxEnabled;// Register Scene on xeokit
9000
8999
  // Do this BEFORE we add components below
9001
9000
  core._addScene(_assertThisInitialized(_this52));_this52._initDefaults();// Global components
9002
9001
  _this52._viewport=new Viewport(_assertThisInitialized(_this52),{id:"default.viewport",autoBoundary:true,dontClear:true// Never destroy this component with Scene#clear();
9003
9002
  });_this52._camera=new Camera(_assertThisInitialized(_this52),{id:"default.camera",dontClear:true// Never destroy this component with Scene#clear();
9004
9003
  });// Default lights
9005
- new AmbientLight(_assertThisInitialized(_this52),{color:[1.0,1.0,1.0],intensity:0.7});new DirLight(_assertThisInitialized(_this52),{dir:[0.8,-.5,-0.5],color:[0.67,0.67,1.0],intensity:0.7,space:"world"});new DirLight(_assertThisInitialized(_this52),{dir:[-0.8,-1.0,0.5],color:[1,1,.9],intensity:0.9,space:"world"});_this52._camera.on("dirty",function(){_this52._renderer.imageDirty();});return _this52;}_createClass(Scene,[{key:"type",get:/**
9004
+ new AmbientLight(_assertThisInitialized(_this52),{color:[1.0,1.0,1.0],intensity:0.7});new DirLight(_assertThisInitialized(_this52),{dir:[0.8,-0.5,-0.5],color:[0.67,0.67,1.0],intensity:0.7,space:"world"});new DirLight(_assertThisInitialized(_this52),{dir:[-0.8,-1.0,0.5],color:[1,1,0.9],intensity:0.9,space:"world"});_this52._camera.on("dirty",function(){_this52._renderer.imageDirty();});return _this52;}_createClass(Scene,[{key:"type",get:/**
9006
9005
  @private
9007
9006
  */function get(){return"Scene";}},{key:"_initDefaults",value:function _initDefaults(){this.geometry;this.material;this.xrayMaterial;this.edgeMaterial;this.selectedMaterial;this.highlightMaterial;}},{key:"_addComponent",value:function _addComponent(component){if(component.id){// Manual ID
9008
9007
  if(this.components[component.id]){this.error("Component "+utils.inQuotes(component.id)+" already exists in Scene - ignoring ID, will randomly-generate instead");component.id=null;}}if(!component.id){// Auto ID
@@ -9033,352 +9032,369 @@ if(notify){this.fire("objectSelected",entity,true);}}},{key:"_deRegisterSelected
9033
9032
  }},{key:"_webglContextLost",value:function _webglContextLost(){// this.loading++;
9034
9033
  this.canvas.spinner.processes++;for(var id in this.components){if(this.components.hasOwnProperty(id)){var component=this.components[id];if(component._webglContextLost){component._webglContextLost();}}}this._renderer.webglContextLost();}},{key:"_webglContextRestored",value:function _webglContextRestored(){var gl=this.canvas.gl;for(var id in this.components){if(this.components.hasOwnProperty(id)){var component=this.components[id];if(component._webglContextRestored){component._webglContextRestored(gl);}}}this._renderer.webglContextRestored(gl);//this.loading--;
9035
9034
  this.canvas.spinner.processes--;}/**
9036
- * Returns the capabilities of this Scene.
9037
- *
9038
- * @private
9039
- * @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}
9040
- */},{key:"capabilities",get:function get(){return this._renderer.capabilities;}/**
9041
- * Whether {@link Entity#offset} is enabled.
9042
- *
9043
- * This is set via the {@link Viewer} constructor and is ````false```` by default.
9044
- *
9045
- * @returns {Boolean} True if {@link Entity#offset} is enabled.
9046
- */},{key:"entityOffsetsEnabled",get:function get(){return this._entityOffsetsEnabled;}/**
9047
- * Whether precision surface picking is enabled.
9048
- *
9049
- * This is set via the {@link Viewer} constructor and is ````false```` by default.
9050
- *
9051
- * The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
9052
- *
9053
- * Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer.
9054
- *
9055
- * @returns {Boolean} True if precision picking is enabled.
9056
- */},{key:"pickSurfacePrecisionEnabled",get:function get(){return false;// Removed
9035
+ * Returns the capabilities of this Scene.
9036
+ *
9037
+ * @private
9038
+ * @returns {{astcSupported: boolean, etc1Supported: boolean, pvrtcSupported: boolean, etc2Supported: boolean, dxtSupported: boolean, bptcSupported: boolean}}
9039
+ */},{key:"capabilities",get:function get(){return this._renderer.capabilities;}/**
9040
+ * Whether {@link Entity#offset} is enabled.
9041
+ *
9042
+ * This is set via the {@link Viewer} constructor and is ````false```` by default.
9043
+ *
9044
+ * @returns {Boolean} True if {@link Entity#offset} is enabled.
9045
+ */},{key:"entityOffsetsEnabled",get:function get(){return this._entityOffsetsEnabled;}/**
9046
+ * Whether precision surface picking is enabled.
9047
+ *
9048
+ * This is set via the {@link Viewer} constructor and is ````false```` by default.
9049
+ *
9050
+ * The ````pickSurfacePrecision```` option for ````Scene#pick```` only works if this is set ````true````.
9051
+ *
9052
+ * Note that when ````true````, this configuration will increase the amount of browser memory used by the Viewer.
9053
+ *
9054
+ * @returns {Boolean} True if precision picking is enabled.
9055
+ */},{key:"pickSurfacePrecisionEnabled",get:function get(){return false;// Removed
9057
9056
  }/**
9058
- * Whether logarithmic depth buffer is enabled.
9059
- *
9060
- * This is set via the {@link Viewer} constructor and is ````false```` by default.
9061
- *
9062
- * @returns {Boolean} True if logarithmic depth buffer is enabled.
9063
- */},{key:"logarithmicDepthBufferEnabled",get:function get(){return this._logarithmicDepthBufferEnabled;}/**
9064
- * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
9065
- *
9066
- * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
9067
- * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
9068
- * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
9069
- * 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
9070
- * your expected usage.
9071
- *
9072
- * Default is ````0````.
9073
- */},{key:"numCachedSectionPlanes",get:/**
9074
- * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
9075
- *
9076
- * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
9077
- * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
9078
- * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
9079
- * 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
9080
- * your expected usage.
9081
- *
9082
- * Default is ````0````.
9083
- *
9084
- * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
9085
- */function get(){return this._sectionPlanesState.getNumCachedSectionPlanes();}/**
9086
- * Sets whether physically-based rendering is enabled.
9087
- *
9088
- * Default is ````false````.
9089
- */,set:function set(numCachedSectionPlanes){numCachedSectionPlanes=numCachedSectionPlanes||0;if(this._sectionPlanesState.getNumCachedSectionPlanes()!==numCachedSectionPlanes){this._sectionPlanesState.setNumCachedSectionPlanes(numCachedSectionPlanes);this._needRecompile=true;this.glRedraw();}}},{key:"pbrEnabled",get:/**
9090
- * Gets whether physically-based rendering is enabled.
9091
- *
9092
- * Default is ````false````.
9093
- *
9094
- * @returns {Boolean} True if quality rendering is enabled.
9095
- */function get(){return this._pbrEnabled;}/**
9096
- * Sets whether data texture scene representation (DTX) is enabled for the {@link Scene}.
9097
- *
9098
- * Even when enabled, DTX will only work if supported.
9099
- *
9100
- * Default value is ````false````.
9101
- *
9102
- * @type {Boolean}
9103
- */,set:function set(pbrEnabled){this._pbrEnabled=!!pbrEnabled;this.glRedraw();}},{key:"dtxEnabled",get:/**
9104
- * Gets whether data texture-based scene representation (DTX) is enabled for the {@link Scene}.
9105
- *
9106
- * Even when enabled, DTX will only apply if supported.
9107
- *
9108
- * Default value is ````false````.
9109
- *
9110
- * @type {Boolean}
9111
- */function get(){return this._dtxEnabled;}/**
9112
- * set showedges enable
9113
- */,set:function set(value){value=!!value;if(this._dtxEnabled===value){return;}this._dtxEnabled=value;}},{key:"setEdgesEnabled",value:function setEdgesEnabled(edgesEnabled){this._renderer.setEdgesEnabled(edgesEnabled);}/**
9114
- * Sets whether basic color texture rendering is enabled.
9115
- *
9116
- * Default is ````true````.
9117
- *
9118
- * @returns {Boolean} True if basic color texture rendering is enabled.
9119
- */},{key:"colorTextureEnabled",get:/**
9120
- * Gets whether basic color texture rendering is enabled.
9121
- *
9122
- * Default is ````true````.
9123
- *
9124
- * @returns {Boolean} True if basic color texture rendering is enabled.
9125
- */function get(){return this._colorTextureEnabled;}/**
9126
- * Performs an occlusion test on all {@link Marker}s in this {@link Scene}.
9127
- *
9128
- * Sets each {@link Marker#visible} ````true```` if the Marker is currently not occluded by any opaque {@link Entity}s
9129
- * in the Scene, or ````false```` if an Entity is occluding it.
9130
- */,set:function set(colorTextureEnabled){this._colorTextureEnabled=!!colorTextureEnabled;this.glRedraw();}},{key:"doOcclusionTest",value:function doOcclusionTest(){if(this._needRecompile){this._recompile();this._needRecompile=false;}this._renderer.doOcclusionTest();}/**
9131
- * Renders a single frame of this Scene.
9132
- *
9133
- * The Scene will periodically render itself after any updates, but you can call this method to force a render
9134
- * if required.
9135
- *
9136
- * @param {Boolean} [forceRender=false] Forces a render when true, otherwise only renders if something has changed in this Scene
9137
- * since the last render.
9138
- */},{key:"render",value:function render(forceRender){if(forceRender){core.runTasks();}var renderEvent={sceneId:null,pass:0};if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(!forceRender&&!this._renderer.needsRender()){return;}renderEvent.sceneId=this.id;var passes=this._passes;var clearEachPass=this._clearEachPass;var pass;var clear;for(pass=0;pass<passes;pass++){renderEvent.pass=pass;/**
9139
- * Fired when about to render a frame for a Scene.
9140
- *
9141
- * @event rendering
9142
- * @param {String} sceneID The ID of this Scene.
9143
- * @param {Number} pass Index of the pass we are about to render (see {@link Scene#passes}).
9144
- */this.fire("rendering",renderEvent,true);clear=clearEachPass||pass===0;this._renderer.render({pass:pass,clear:clear,force:forceRender});/**
9145
- * Fired when we have just rendered a frame for a Scene.
9146
- *
9147
- * @event rendering
9148
- * @param {String} sceneID The ID of this Scene.
9149
- * @param {Number} pass Index of the pass we rendered (see {@link Scene#passes}).
9150
- */this.fire("rendered",renderEvent,true);}this._saveAmbientColor();}/**
9151
- * @private
9152
- */},{key:"compile",value:function compile(){if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}}},{key:"_recompile",value:function _recompile(){for(var id in this._compilables){if(this._compilables.hasOwnProperty(id)){this._compilables[id].compile();}}this._renderer.shadowsDirty();this.fire("compile",this,true);}},{key:"_saveAmbientColor",value:function _saveAmbientColor(){var canvas=this.canvas;if(!canvas.transparent&&!canvas.backgroundImage&&!canvas.backgroundColor){var ambientColorIntensity=this._lightsState.getAmbientColorAndIntensity();if(!this._lastAmbientColor||this._lastAmbientColor[0]!==ambientColorIntensity[0]||this._lastAmbientColor[1]!==ambientColorIntensity[1]||this._lastAmbientColor[2]!==ambientColorIntensity[2]||this._lastAmbientColor[3]!==ambientColorIntensity[3]){canvas.backgroundColor=ambientColorIntensity;if(!this._lastAmbientColor){this._lastAmbientColor=math.vec4([0,0,0,1]);}this._lastAmbientColor.set(ambientColorIntensity);}}else{this._lastAmbientColor=null;}}/**
9153
- * Gets the IDs of the {@link Entity}s in {@link Scene#models}.
9154
- *
9155
- * @type {String[]}
9156
- */},{key:"modelIds",get:function get(){if(!this._modelIds){this._modelIds=Object.keys(this.models);}return this._modelIds;}/**
9157
- * Gets the number of {@link Entity}s in {@link Scene#objects}.
9158
- *
9159
- * @type {Number}
9160
- */},{key:"numObjects",get:function get(){return this._numObjects;}/**
9161
- * Gets the IDs of the {@link Entity}s in {@link Scene#objects}.
9162
- *
9163
- * @type {String[]}
9164
- */},{key:"objectIds",get:function get(){if(!this._objectIds){this._objectIds=Object.keys(this.objects);}return this._objectIds;}/**
9165
- * Gets the number of {@link Entity}s in {@link Scene#visibleObjects}.
9166
- *
9167
- * @type {Number}
9168
- */},{key:"numVisibleObjects",get:function get(){return this._numVisibleObjects;}/**
9169
- * Gets the IDs of the {@link Entity}s in {@link Scene#visibleObjects}.
9170
- *
9171
- * @type {String[]}
9172
- */},{key:"visibleObjectIds",get:function get(){if(!this._visibleObjectIds){this._visibleObjectIds=Object.keys(this.visibleObjects);}return this._visibleObjectIds;}/**
9173
- * Gets the number of {@link Entity}s in {@link Scene#xrayedObjects}.
9174
- *
9175
- * @type {Number}
9176
- */},{key:"numXRayedObjects",get:function get(){return this._numXRayedObjects;}/**
9177
- * Gets the IDs of the {@link Entity}s in {@link Scene#xrayedObjects}.
9178
- *
9179
- * @type {String[]}
9180
- */},{key:"xrayedObjectIds",get:function get(){if(!this._xrayedObjectIds){this._xrayedObjectIds=Object.keys(this.xrayedObjects);}return this._xrayedObjectIds;}/**
9181
- * Gets the number of {@link Entity}s in {@link Scene#highlightedObjects}.
9182
- *
9183
- * @type {Number}
9184
- */},{key:"numHighlightedObjects",get:function get(){return this._numHighlightedObjects;}/**
9185
- * Gets the IDs of the {@link Entity}s in {@link Scene#highlightedObjects}.
9186
- *
9187
- * @type {String[]}
9188
- */},{key:"highlightedObjectIds",get:function get(){if(!this._highlightedObjectIds){this._highlightedObjectIds=Object.keys(this.highlightedObjects);}return this._highlightedObjectIds;}/**
9189
- * Gets the number of {@link Entity}s in {@link Scene#selectedObjects}.
9190
- *
9191
- * @type {Number}
9192
- */},{key:"numSelectedObjects",get:function get(){return this._numSelectedObjects;}/**
9193
- * Gets the IDs of the {@link Entity}s in {@link Scene#selectedObjects}.
9194
- *
9195
- * @type {String[]}
9196
- */},{key:"selectedObjectIds",get:function get(){if(!this._selectedObjectIds){this._selectedObjectIds=Object.keys(this.selectedObjects);}return this._selectedObjectIds;}/**
9197
- * Gets the number of {@link Entity}s in {@link Scene#colorizedObjects}.
9198
- *
9199
- * @type {Number}
9200
- */},{key:"numColorizedObjects",get:function get(){return this._numColorizedObjects;}/**
9201
- * Gets the IDs of the {@link Entity}s in {@link Scene#colorizedObjects}.
9202
- *
9203
- * @type {String[]}
9204
- */},{key:"colorizedObjectIds",get:function get(){if(!this._colorizedObjectIds){this._colorizedObjectIds=Object.keys(this.colorizedObjects);}return this._colorizedObjectIds;}/**
9205
- * Gets the IDs of the {@link Entity}s in {@link Scene#opacityObjects}.
9206
- *
9207
- * @type {String[]}
9208
- */},{key:"opacityObjectIds",get:function get(){if(!this._opacityObjectIds){this._opacityObjectIds=Object.keys(this.opacityObjects);}return this._opacityObjectIds;}/**
9209
- * Gets the IDs of the {@link Entity}s in {@link Scene#offsetObjects}.
9210
- *
9211
- * @type {String[]}
9212
- */},{key:"offsetObjectIds",get:function get(){if(!this._offsetObjectIds){this._offsetObjectIds=Object.keys(this.offsetObjects);}return this._offsetObjectIds;}/**
9213
- * Sets the number of "ticks" that happen between each render or this Scene.
9214
- *
9215
- * Default value is ````1````.
9216
- *
9217
- * @type {Number}
9218
- */},{key:"ticksPerRender",get:/**
9219
- * Gets the number of "ticks" that happen between each render or this Scene.
9220
- *
9221
- * Default value is ````1````.
9222
- *
9223
- * @type {Number}
9224
- */function get(){return this._ticksPerRender;}/**
9225
- * Sets the number of "ticks" that happen between occlusion testing for {@link Marker}s.
9226
- *
9227
- * Default value is ````20````.
9228
- *
9229
- * @type {Number}
9230
- */,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerRender': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._ticksPerRender){return;}this._ticksPerRender=value;}},{key:"ticksPerOcclusionTest",get:/**
9231
- * Gets the number of "ticks" that happen between each render of this Scene.
9232
- *
9233
- * Default value is ````1````.
9234
- *
9235
- * @type {Number}
9236
- */function get(){return this._ticksPerOcclusionTest;}/**
9237
- * Sets the number of times this Scene renders per frame.
9238
- *
9239
- * Default value is ````1````.
9240
- *
9241
- * @type {Number}
9242
- */,set:function set(value){if(value===undefined||value===null){value=20;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerOcclusionTest': '"+value+"' - should be an integer greater than zero.");value=20;}if(value===this._ticksPerOcclusionTest){return;}this._ticksPerOcclusionTest=value;}},{key:"passes",get:/**
9243
- * Gets the number of times this Scene renders per frame.
9244
- *
9245
- * Default value is ````1````.
9246
- *
9247
- * @type {Number}
9248
- */function get(){return this._passes;}/**
9249
- * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
9250
- *
9251
- * Default value is ````false````.
9252
- *
9253
- * @type {Boolean}
9254
- */,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'passes': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._passes){return;}this._passes=value;this.glRedraw();}},{key:"clearEachPass",get:/**
9255
- * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
9256
- *
9257
- * Default value is ````false````.
9258
- *
9259
- * @type {Boolean}
9260
- */function get(){return this._clearEachPass;}/**
9261
- * Sets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
9262
- *
9263
- * Default value is ````false````.
9264
- *
9265
- * @type {Boolean}
9266
- */,set:function set(value){value=!!value;if(value===this._clearEachPass){return;}this._clearEachPass=value;this.glRedraw();}},{key:"gammaInput",get:/**
9267
- * Gets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
9268
- *
9269
- * Default value is ````false````.
9270
- *
9271
- * @type {Boolean}
9272
- */function get(){return this._renderer.gammaInput;}/**
9273
- * Sets whether or not to render pixels with pre-multiplied gama.
9274
- *
9275
- * Default value is ````false````.
9276
- *
9277
- * @type {Boolean}
9278
- */,set:function set(value){value=value!==false;if(value===this._renderer.gammaInput){return;}this._renderer.gammaInput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaOutput",get:/**
9279
- * Gets whether or not to render pixels with pre-multiplied gama.
9280
- *
9281
- * Default value is ````true````.
9282
- *
9283
- * @type {Boolean}
9284
- */function get(){return this._renderer.gammaOutput;}/**
9285
- * Sets the gamma factor to use when {@link Scene#gammaOutput} is set true.
9286
- *
9287
- * Default value is ````2.2````.
9288
- *
9289
- * @type {Number}
9290
- */,set:function set(value){value=!!value;if(value===this._renderer.gammaOutput){return;}this._renderer.gammaOutput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaFactor",get:/**
9291
- * Gets the gamma factor to use when {@link Scene#gammaOutput} is set true.
9292
- *
9293
- * Default value is ````2.2````.
9294
- *
9295
- * @type {Number}
9296
- */function get(){return this._renderer.gammaFactor;}/**
9297
- * Gets the default {@link Geometry} for this Scene, which is a {@link ReadableGeometry} with a unit-sized box shape.
9298
- *
9299
- * Has {@link ReadableGeometry#id} set to "default.geometry".
9300
- *
9301
- * {@link Mesh}s in this Scene have {@link Mesh#geometry} set to this {@link ReadableGeometry} by default.
9302
- *
9303
- * @type {ReadableGeometry}
9304
- */,set:function set(value){value=value===undefined||value===null?2.2:value;if(value===this._renderer.gammaFactor){return;}this._renderer.gammaFactor=value;this.glRedraw();}},{key:"geometry",get:function get(){return this.components["default.geometry"]||buildBoxGeometry(ReadableGeometry);}/**
9305
- * Gets the default {@link Material} for this Scene, which is a {@link PhongMaterial}.
9306
- *
9307
- * Has {@link PhongMaterial#id} set to "default.material".
9308
- *
9309
- * {@link Mesh}s in this Scene have {@link Mesh#material} set to this {@link PhongMaterial} by default.
9310
- *
9311
- * @type {PhongMaterial}
9312
- */},{key:"material",get:function get(){return this.components["default.material"]||new PhongMaterial(this,{id:"default.material",emissive:[0.4,0.4,0.4],// Visible by default on geometry without normals
9057
+ * Whether logarithmic depth buffer is enabled.
9058
+ *
9059
+ * This is set via the {@link Viewer} constructor and is ````false```` by default.
9060
+ *
9061
+ * @returns {Boolean} True if logarithmic depth buffer is enabled.
9062
+ */},{key:"logarithmicDepthBufferEnabled",get:function get(){return this._logarithmicDepthBufferEnabled;}/**
9063
+ * Sets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
9064
+ *
9065
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
9066
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
9067
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
9068
+ * 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
9069
+ * your expected usage.
9070
+ *
9071
+ * Default is ````0````.
9072
+ */},{key:"numCachedSectionPlanes",get:/**
9073
+ * Gets the number of {@link SectionPlane}s for which this Scene pre-caches resources.
9074
+ *
9075
+ * This property enhances the efficiency of SectionPlane creation by proactively allocating and caching Viewer resources for a specified quantity
9076
+ * of SectionPlanes. Introducing this parameter streamlines the initial creation speed of SectionPlanes, particularly up to the designated quantity. This parameter internally
9077
+ * configures renderer logic for the specified number of SectionPlanes, eliminating the need for setting up logic with each SectionPlane creation and thereby enhancing
9078
+ * 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
9079
+ * your expected usage.
9080
+ *
9081
+ * Default is ````0````.
9082
+ *
9083
+ * @returns {number} The number of {@link SectionPlane}s for which this Scene pre-caches resources.
9084
+ */function get(){return this._sectionPlanesState.getNumCachedSectionPlanes();}/**
9085
+ * Sets whether physically-based rendering is enabled.
9086
+ *
9087
+ * Default is ````false````.
9088
+ */,set:function set(numCachedSectionPlanes){numCachedSectionPlanes=numCachedSectionPlanes||0;if(this._sectionPlanesState.getNumCachedSectionPlanes()!==numCachedSectionPlanes){this._sectionPlanesState.setNumCachedSectionPlanes(numCachedSectionPlanes);this._needRecompile=true;this.glRedraw();}}},{key:"pbrEnabled",get:/**
9089
+ * Gets whether physically-based rendering is enabled.
9090
+ *
9091
+ * Default is ````false````.
9092
+ *
9093
+ * @returns {Boolean} True if quality rendering is enabled.
9094
+ */function get(){return this._pbrEnabled;}/**
9095
+ * Sets whether data texture scene representation (DTX) is enabled for the {@link Scene}.
9096
+ *
9097
+ * Even when enabled, DTX will only work if supported.
9098
+ *
9099
+ * Default value is ````false````.
9100
+ *
9101
+ * @type {Boolean}
9102
+ */,set:function set(pbrEnabled){this._pbrEnabled=!!pbrEnabled;this.glRedraw();}},{key:"dtxEnabled",get:/**
9103
+ * Gets whether data texture-based scene representation (DTX) is enabled for the {@link Scene}.
9104
+ *
9105
+ * Even when enabled, DTX will only apply if supported.
9106
+ *
9107
+ * Default value is ````false````.
9108
+ *
9109
+ * @type {Boolean}
9110
+ */function get(){return this._dtxEnabled;}/**
9111
+ * set showedges enable
9112
+ * @param {boolean} edgesEnabled
9113
+ */,set:function set(value){value=!!value;if(this._dtxEnabled===value){return;}this._dtxEnabled=value;}},{key:"edgesEnabled",get:/**
9114
+ * @param {boolean} trans
9115
+ */function get(){return this._edgesEnabled;}/**
9116
+ * set whether transparent of canvas background
9117
+ * @param {boolean} trans
9118
+ */,set:function set(edgesEnabled){edgesEnabled=!!edgesEnabled;if(this._edgesEnabled===edgesEnabled){return;}this._edgesEnabled=edgesEnabled;this._renderer.setEdgesEnabled(edgesEnabled);}},{key:"backgroundTransparent",get:/**
9119
+ * @returns {boolean} backgroundTransparent
9120
+ */function get(){return this._transparent;}/**
9121
+ * set background color
9122
+ * @param {[]} color
9123
+ */,set:function set(trans){trans=!!trans;// if (this._transparent == trans) {
9124
+ // return;
9125
+ // }
9126
+ this._transparent=trans;this._renderer.setTransparentEnabled(trans);}},{key:"backgroundColor",get:/**
9127
+ * return backgroundColor
9128
+ * @returns {boolean} backgroundColor
9129
+ */function get(){return this.canvas.backgroundColor();}/**
9130
+ * Sets whether basic color texture rendering is enabled.
9131
+ *
9132
+ * Default is ````true````.
9133
+ *
9134
+ * @returns {Boolean} True if basic color texture rendering is enabled.
9135
+ */,set:function set(color){this.canvas.backgroundColor=color;this._renderer.render({force:true});}},{key:"colorTextureEnabled",get:/**
9136
+ * Gets whether basic color texture rendering is enabled.
9137
+ *
9138
+ * Default is ````true````.
9139
+ *
9140
+ * @returns {Boolean} True if basic color texture rendering is enabled.
9141
+ */function get(){return this._colorTextureEnabled;}/**
9142
+ * Performs an occlusion test on all {@link Marker}s in this {@link Scene}.
9143
+ *
9144
+ * Sets each {@link Marker#visible} ````true```` if the Marker is currently not occluded by any opaque {@link Entity}s
9145
+ * in the Scene, or ````false```` if an Entity is occluding it.
9146
+ */,set:function set(colorTextureEnabled){this._colorTextureEnabled=!!colorTextureEnabled;this.glRedraw();}},{key:"doOcclusionTest",value:function doOcclusionTest(){if(this._needRecompile){this._recompile();this._needRecompile=false;}this._renderer.doOcclusionTest();}/**
9147
+ * Renders a single frame of this Scene.
9148
+ *
9149
+ * The Scene will periodically render itself after any updates, but you can call this method to force a render
9150
+ * if required.
9151
+ *
9152
+ * @param {Boolean} [forceRender=false] Forces a render when true, otherwise only renders if something has changed in this Scene
9153
+ * since the last render.
9154
+ */},{key:"render",value:function render(forceRender){if(forceRender){core.runTasks();}var renderEvent={sceneId:null,pass:0};if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(!forceRender&&!this._renderer.needsRender()){return;}renderEvent.sceneId=this.id;var passes=this._passes;var clearEachPass=this._clearEachPass;var pass;var clear;for(pass=0;pass<passes;pass++){renderEvent.pass=pass;/**
9155
+ * Fired when about to render a frame for a Scene.
9156
+ *
9157
+ * @event rendering
9158
+ * @param {String} sceneID The ID of this Scene.
9159
+ * @param {Number} pass Index of the pass we are about to render (see {@link Scene#passes}).
9160
+ */this.fire("rendering",renderEvent,true);clear=clearEachPass||pass===0;this._renderer.render({pass:pass,clear:clear,force:forceRender});/**
9161
+ * Fired when we have just rendered a frame for a Scene.
9162
+ *
9163
+ * @event rendering
9164
+ * @param {String} sceneID The ID of this Scene.
9165
+ * @param {Number} pass Index of the pass we rendered (see {@link Scene#passes}).
9166
+ */this.fire("rendered",renderEvent,true);}this._saveAmbientColor();}/**
9167
+ * @private
9168
+ */},{key:"compile",value:function compile(){if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}}},{key:"_recompile",value:function _recompile(){for(var id in this._compilables){if(this._compilables.hasOwnProperty(id)){this._compilables[id].compile();}}this._renderer.shadowsDirty();this.fire("compile",this,true);}},{key:"_saveAmbientColor",value:function _saveAmbientColor(){var canvas=this.canvas;if(!canvas.transparent&&!canvas.backgroundImage&&!canvas.backgroundColor){var ambientColorIntensity=this._lightsState.getAmbientColorAndIntensity();if(!this._lastAmbientColor||this._lastAmbientColor[0]!==ambientColorIntensity[0]||this._lastAmbientColor[1]!==ambientColorIntensity[1]||this._lastAmbientColor[2]!==ambientColorIntensity[2]||this._lastAmbientColor[3]!==ambientColorIntensity[3]){canvas.backgroundColor=ambientColorIntensity;if(!this._lastAmbientColor){this._lastAmbientColor=math.vec4([0,0,0,1]);}this._lastAmbientColor.set(ambientColorIntensity);}}else{this._lastAmbientColor=null;}}/**
9169
+ * Gets the IDs of the {@link Entity}s in {@link Scene#models}.
9170
+ *
9171
+ * @type {String[]}
9172
+ */},{key:"modelIds",get:function get(){if(!this._modelIds){this._modelIds=Object.keys(this.models);}return this._modelIds;}/**
9173
+ * Gets the number of {@link Entity}s in {@link Scene#objects}.
9174
+ *
9175
+ * @type {Number}
9176
+ */},{key:"numObjects",get:function get(){return this._numObjects;}/**
9177
+ * Gets the IDs of the {@link Entity}s in {@link Scene#objects}.
9178
+ *
9179
+ * @type {String[]}
9180
+ */},{key:"objectIds",get:function get(){if(!this._objectIds){this._objectIds=Object.keys(this.objects);}return this._objectIds;}/**
9181
+ * Gets the number of {@link Entity}s in {@link Scene#visibleObjects}.
9182
+ *
9183
+ * @type {Number}
9184
+ */},{key:"numVisibleObjects",get:function get(){return this._numVisibleObjects;}/**
9185
+ * Gets the IDs of the {@link Entity}s in {@link Scene#visibleObjects}.
9186
+ *
9187
+ * @type {String[]}
9188
+ */},{key:"visibleObjectIds",get:function get(){if(!this._visibleObjectIds){this._visibleObjectIds=Object.keys(this.visibleObjects);}return this._visibleObjectIds;}/**
9189
+ * Gets the number of {@link Entity}s in {@link Scene#xrayedObjects}.
9190
+ *
9191
+ * @type {Number}
9192
+ */},{key:"numXRayedObjects",get:function get(){return this._numXRayedObjects;}/**
9193
+ * Gets the IDs of the {@link Entity}s in {@link Scene#xrayedObjects}.
9194
+ *
9195
+ * @type {String[]}
9196
+ */},{key:"xrayedObjectIds",get:function get(){if(!this._xrayedObjectIds){this._xrayedObjectIds=Object.keys(this.xrayedObjects);}return this._xrayedObjectIds;}/**
9197
+ * Gets the number of {@link Entity}s in {@link Scene#highlightedObjects}.
9198
+ *
9199
+ * @type {Number}
9200
+ */},{key:"numHighlightedObjects",get:function get(){return this._numHighlightedObjects;}/**
9201
+ * Gets the IDs of the {@link Entity}s in {@link Scene#highlightedObjects}.
9202
+ *
9203
+ * @type {String[]}
9204
+ */},{key:"highlightedObjectIds",get:function get(){if(!this._highlightedObjectIds){this._highlightedObjectIds=Object.keys(this.highlightedObjects);}return this._highlightedObjectIds;}/**
9205
+ * Gets the number of {@link Entity}s in {@link Scene#selectedObjects}.
9206
+ *
9207
+ * @type {Number}
9208
+ */},{key:"numSelectedObjects",get:function get(){return this._numSelectedObjects;}/**
9209
+ * Gets the IDs of the {@link Entity}s in {@link Scene#selectedObjects}.
9210
+ *
9211
+ * @type {String[]}
9212
+ */},{key:"selectedObjectIds",get:function get(){if(!this._selectedObjectIds){this._selectedObjectIds=Object.keys(this.selectedObjects);}return this._selectedObjectIds;}/**
9213
+ * Gets the number of {@link Entity}s in {@link Scene#colorizedObjects}.
9214
+ *
9215
+ * @type {Number}
9216
+ */},{key:"numColorizedObjects",get:function get(){return this._numColorizedObjects;}/**
9217
+ * Gets the IDs of the {@link Entity}s in {@link Scene#colorizedObjects}.
9218
+ *
9219
+ * @type {String[]}
9220
+ */},{key:"colorizedObjectIds",get:function get(){if(!this._colorizedObjectIds){this._colorizedObjectIds=Object.keys(this.colorizedObjects);}return this._colorizedObjectIds;}/**
9221
+ * Gets the IDs of the {@link Entity}s in {@link Scene#opacityObjects}.
9222
+ *
9223
+ * @type {String[]}
9224
+ */},{key:"opacityObjectIds",get:function get(){if(!this._opacityObjectIds){this._opacityObjectIds=Object.keys(this.opacityObjects);}return this._opacityObjectIds;}/**
9225
+ * Gets the IDs of the {@link Entity}s in {@link Scene#offsetObjects}.
9226
+ *
9227
+ * @type {String[]}
9228
+ */},{key:"offsetObjectIds",get:function get(){if(!this._offsetObjectIds){this._offsetObjectIds=Object.keys(this.offsetObjects);}return this._offsetObjectIds;}/**
9229
+ * Sets the number of "ticks" that happen between each render or this Scene.
9230
+ *
9231
+ * Default value is ````1````.
9232
+ *
9233
+ * @type {Number}
9234
+ */},{key:"ticksPerRender",get:/**
9235
+ * Gets the number of "ticks" that happen between each render or this Scene.
9236
+ *
9237
+ * Default value is ````1````.
9238
+ *
9239
+ * @type {Number}
9240
+ */function get(){return this._ticksPerRender;}/**
9241
+ * Sets the number of "ticks" that happen between occlusion testing for {@link Marker}s.
9242
+ *
9243
+ * Default value is ````20````.
9244
+ *
9245
+ * @type {Number}
9246
+ */,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerRender': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._ticksPerRender){return;}this._ticksPerRender=value;}},{key:"ticksPerOcclusionTest",get:/**
9247
+ * Gets the number of "ticks" that happen between each render of this Scene.
9248
+ *
9249
+ * Default value is ````1````.
9250
+ *
9251
+ * @type {Number}
9252
+ */function get(){return this._ticksPerOcclusionTest;}/**
9253
+ * Sets the number of times this Scene renders per frame.
9254
+ *
9255
+ * Default value is ````1````.
9256
+ *
9257
+ * @type {Number}
9258
+ */,set:function set(value){if(value===undefined||value===null){value=20;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'ticksPerOcclusionTest': '"+value+"' - should be an integer greater than zero.");value=20;}if(value===this._ticksPerOcclusionTest){return;}this._ticksPerOcclusionTest=value;}},{key:"passes",get:/**
9259
+ * Gets the number of times this Scene renders per frame.
9260
+ *
9261
+ * Default value is ````1````.
9262
+ *
9263
+ * @type {Number}
9264
+ */function get(){return this._passes;}/**
9265
+ * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
9266
+ *
9267
+ * Default value is ````false````.
9268
+ *
9269
+ * @type {Boolean}
9270
+ */,set:function set(value){if(value===undefined||value===null){value=1;}else if(!utils.isNumeric(value)||value<=0){this.error("Unsupported value for 'passes': '"+value+"' - should be an integer greater than zero.");value=1;}if(value===this._passes){return;}this._passes=value;this.glRedraw();}},{key:"clearEachPass",get:/**
9271
+ * When {@link Scene#passes} is greater than ````1````, indicates whether or not to clear the canvas before each pass (````true````) or just before the first pass (````false````).
9272
+ *
9273
+ * Default value is ````false````.
9274
+ *
9275
+ * @type {Boolean}
9276
+ */function get(){return this._clearEachPass;}/**
9277
+ * Sets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
9278
+ *
9279
+ * Default value is ````false````.
9280
+ *
9281
+ * @type {Boolean}
9282
+ */,set:function set(value){value=!!value;if(value===this._clearEachPass){return;}this._clearEachPass=value;this.glRedraw();}},{key:"gammaInput",get:/**
9283
+ * Gets whether or not {@link Scene} should expect all {@link Texture}s and colors to have pre-multiplied gamma.
9284
+ *
9285
+ * Default value is ````false````.
9286
+ *
9287
+ * @type {Boolean}
9288
+ */function get(){return this._renderer.gammaInput;}/**
9289
+ * Sets whether or not to render pixels with pre-multiplied gama.
9290
+ *
9291
+ * Default value is ````false````.
9292
+ *
9293
+ * @type {Boolean}
9294
+ */,set:function set(value){value=value!==false;if(value===this._renderer.gammaInput){return;}this._renderer.gammaInput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaOutput",get:/**
9295
+ * Gets whether or not to render pixels with pre-multiplied gama.
9296
+ *
9297
+ * Default value is ````true````.
9298
+ *
9299
+ * @type {Boolean}
9300
+ */function get(){return this._renderer.gammaOutput;}/**
9301
+ * Sets the gamma factor to use when {@link Scene#gammaOutput} is set true.
9302
+ *
9303
+ * Default value is ````2.2````.
9304
+ *
9305
+ * @type {Number}
9306
+ */,set:function set(value){value=!!value;if(value===this._renderer.gammaOutput){return;}this._renderer.gammaOutput=value;this._needRecompile=true;this.glRedraw();}},{key:"gammaFactor",get:/**
9307
+ * Gets the gamma factor to use when {@link Scene#gammaOutput} is set true.
9308
+ *
9309
+ * Default value is ````2.2````.
9310
+ *
9311
+ * @type {Number}
9312
+ */function get(){return this._renderer.gammaFactor;}/**
9313
+ * Gets the default {@link Geometry} for this Scene, which is a {@link ReadableGeometry} with a unit-sized box shape.
9314
+ *
9315
+ * Has {@link ReadableGeometry#id} set to "default.geometry".
9316
+ *
9317
+ * {@link Mesh}s in this Scene have {@link Mesh#geometry} set to this {@link ReadableGeometry} by default.
9318
+ *
9319
+ * @type {ReadableGeometry}
9320
+ */,set:function set(value){value=value===undefined||value===null?2.2:value;if(value===this._renderer.gammaFactor){return;}this._renderer.gammaFactor=value;this.glRedraw();}},{key:"geometry",get:function get(){return this.components["default.geometry"]||buildBoxGeometry(ReadableGeometry);}/**
9321
+ * Gets the default {@link Material} for this Scene, which is a {@link PhongMaterial}.
9322
+ *
9323
+ * Has {@link PhongMaterial#id} set to "default.material".
9324
+ *
9325
+ * {@link Mesh}s in this Scene have {@link Mesh#material} set to this {@link PhongMaterial} by default.
9326
+ *
9327
+ * @type {PhongMaterial}
9328
+ */},{key:"material",get:function get(){return this.components["default.material"]||new PhongMaterial(this,{id:"default.material",emissive:[0.4,0.4,0.4],// Visible by default on geometry without normals
9313
9329
  dontClear:true});}/**
9314
- * Gets the default xraying {@link EmphasisMaterial} for this Scene.
9315
- *
9316
- * Has {@link EmphasisMaterial#id} set to "default.xrayMaterial".
9317
- *
9318
- * {@link Mesh}s in this Scene have {@link Mesh#xrayMaterial} set to this {@link EmphasisMaterial} by default.
9319
- *
9320
- * {@link Mesh}s are xrayed while {@link Mesh#xrayed} is ````true````.
9321
- *
9322
- * @type {EmphasisMaterial}
9323
- */},{key:"xrayMaterial",get:function get(){return this.components["default.xrayMaterial"]||new EmphasisMaterial(this,{id:"default.xrayMaterial",preset:"sepia",dontClear:true});}/**
9324
- * Gets the default highlight {@link EmphasisMaterial} for this Scene.
9325
- *
9326
- * Has {@link EmphasisMaterial#id} set to "default.highlightMaterial".
9327
- *
9328
- * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
9329
- *
9330
- * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
9331
- *
9332
- * @type {EmphasisMaterial}
9333
- */},{key:"highlightMaterial",get:function get(){return this.components["default.highlightMaterial"]||new EmphasisMaterial(this,{id:"default.highlightMaterial",preset:"yellowHighlight",dontClear:true});}/**
9334
- * Gets the default selection {@link EmphasisMaterial} for this Scene.
9335
- *
9336
- * Has {@link EmphasisMaterial#id} set to "default.selectedMaterial".
9337
- *
9338
- * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
9339
- *
9340
- * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
9341
- *
9342
- * @type {EmphasisMaterial}
9343
- */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
9344
- * Gets the default {@link EdgeMaterial} for this Scene.
9345
- *
9346
- * Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
9347
- *
9348
- * {@link Mesh}s in this Scene have {@link Mesh#edgeMaterial} set to this {@link EdgeMaterial} by default.
9349
- *
9350
- * {@link Mesh}s have their edges emphasized while {@link Mesh#edges} is ````true````.
9351
- *
9352
- * @type {EdgeMaterial}
9353
- */},{key:"edgeMaterial",get:function get(){return this.components["default.edgeMaterial"]||new EdgeMaterial(this,{id:"default.edgeMaterial",preset:"default",edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1,dontClear:true});}/**
9354
- * Gets the {@link PointsMaterial} for this Scene.
9355
- *
9356
- * @type {PointsMaterial}
9357
- */},{key:"pointsMaterial",get:function get(){return this.components["default.pointsMaterial"]||new PointsMaterial(this,{id:"default.pointsMaterial",preset:"default",dontClear:true});}/**
9358
- * Gets the {@link LinesMaterial} for this Scene.
9359
- *
9360
- * @type {LinesMaterial}
9361
- */},{key:"linesMaterial",get:function get(){return this.components["default.linesMaterial"]||new LinesMaterial(this,{id:"default.linesMaterial",preset:"default",dontClear:true});}/**
9362
- * Gets the {@link Viewport} for this Scene.
9363
- *
9364
- * @type Viewport
9365
- */},{key:"viewport",get:function get(){return this._viewport;}/**
9366
- * Gets the {@link Camera} for this Scene.
9367
- *
9368
- * @type {Camera}
9369
- */},{key:"camera",get:function get(){return this._camera;}/**
9370
- * Gets the World-space 3D center of this Scene.
9371
- *
9372
- *@type {Number[]}
9373
- */},{key:"center",get:function get(){if(this._aabbDirty||!this._center){if(!this._center||!this._center){this._center=math.vec3();}var aabb=this.aabb;this._center[0]=(aabb[0]+aabb[3])/2;this._center[1]=(aabb[1]+aabb[4])/2;this._center[2]=(aabb[2]+aabb[5])/2;}return this._center;}/**
9374
- * Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.
9375
- *
9376
- * The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
9377
- *
9378
- * When the Scene has no content, will be ````[-100,-100,-100,100,100,100]````.
9379
- *
9380
- * @type {Number[]}
9381
- */},{key:"aabb",get:function get(){if(this._aabbDirty){if(!this._aabb){this._aabb=math.AABB3();}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var aabb;var collidables=this._collidables;var collidable;var valid=false;for(var collidableId in collidables){if(collidables.hasOwnProperty(collidableId)){collidable=collidables[collidableId];if(collidable.collidable===false){continue;}aabb=collidable.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}}if(!valid){xmin=-100;ymin=-100;zmin=-100;xmax=100;ymax=100;zmax=100;}this._aabb[0]=xmin;this._aabb[1]=ymin;this._aabb[2]=zmin;this._aabb[3]=xmax;this._aabb[4]=ymax;this._aabb[5]=zmax;this._aabbDirty=false;}return this._aabb;}},{key:"_setAABBDirty",value:function _setAABBDirty(){//if (!this._aabbDirty) {
9330
+ * Gets the default xraying {@link EmphasisMaterial} for this Scene.
9331
+ *
9332
+ * Has {@link EmphasisMaterial#id} set to "default.xrayMaterial".
9333
+ *
9334
+ * {@link Mesh}s in this Scene have {@link Mesh#xrayMaterial} set to this {@link EmphasisMaterial} by default.
9335
+ *
9336
+ * {@link Mesh}s are xrayed while {@link Mesh#xrayed} is ````true````.
9337
+ *
9338
+ * @type {EmphasisMaterial}
9339
+ */},{key:"xrayMaterial",get:function get(){return this.components["default.xrayMaterial"]||new EmphasisMaterial(this,{id:"default.xrayMaterial",preset:"sepia",dontClear:true});}/**
9340
+ * Gets the default highlight {@link EmphasisMaterial} for this Scene.
9341
+ *
9342
+ * Has {@link EmphasisMaterial#id} set to "default.highlightMaterial".
9343
+ *
9344
+ * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
9345
+ *
9346
+ * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
9347
+ *
9348
+ * @type {EmphasisMaterial}
9349
+ */},{key:"highlightMaterial",get:function get(){return this.components["default.highlightMaterial"]||new EmphasisMaterial(this,{id:"default.highlightMaterial",preset:"yellowHighlight",dontClear:true});}/**
9350
+ * Gets the default selection {@link EmphasisMaterial} for this Scene.
9351
+ *
9352
+ * Has {@link EmphasisMaterial#id} set to "default.selectedMaterial".
9353
+ *
9354
+ * {@link Mesh}s in this Scene have {@link Mesh#highlightMaterial} set to this {@link EmphasisMaterial} by default.
9355
+ *
9356
+ * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
9357
+ *
9358
+ * @type {EmphasisMaterial}
9359
+ */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
9360
+ * Gets the default {@link EdgeMaterial} for this Scene.
9361
+ *
9362
+ * Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
9363
+ *
9364
+ * {@link Mesh}s in this Scene have {@link Mesh#edgeMaterial} set to this {@link EdgeMaterial} by default.
9365
+ *
9366
+ * {@link Mesh}s have their edges emphasized while {@link Mesh#edges} is ````true````.
9367
+ *
9368
+ * @type {EdgeMaterial}
9369
+ */},{key:"edgeMaterial",get:function get(){return this.components["default.edgeMaterial"]||new EdgeMaterial(this,{id:"default.edgeMaterial",preset:"default",edgeColor:[0.0,0.0,0.0],edgeAlpha:1.0,edgeWidth:1,dontClear:true});}/**
9370
+ * Gets the {@link PointsMaterial} for this Scene.
9371
+ *
9372
+ * @type {PointsMaterial}
9373
+ */},{key:"pointsMaterial",get:function get(){return this.components["default.pointsMaterial"]||new PointsMaterial(this,{id:"default.pointsMaterial",preset:"default",dontClear:true});}/**
9374
+ * Gets the {@link LinesMaterial} for this Scene.
9375
+ *
9376
+ * @type {LinesMaterial}
9377
+ */},{key:"linesMaterial",get:function get(){return this.components["default.linesMaterial"]||new LinesMaterial(this,{id:"default.linesMaterial",preset:"default",dontClear:true});}/**
9378
+ * Gets the {@link Viewport} for this Scene.
9379
+ *
9380
+ * @type Viewport
9381
+ */},{key:"viewport",get:function get(){return this._viewport;}/**
9382
+ * Gets the {@link Camera} for this Scene.
9383
+ *
9384
+ * @type {Camera}
9385
+ */},{key:"camera",get:function get(){return this._camera;}/**
9386
+ * Gets the World-space 3D center of this Scene.
9387
+ *
9388
+ *@type {Number[]}
9389
+ */},{key:"center",get:function get(){if(this._aabbDirty||!this._center){if(!this._center||!this._center){this._center=math.vec3();}var aabb=this.aabb;this._center[0]=(aabb[0]+aabb[3])/2;this._center[1]=(aabb[1]+aabb[4])/2;this._center[2]=(aabb[2]+aabb[5])/2;}return this._center;}/**
9390
+ * Gets the World-space axis-aligned 3D boundary (AABB) of this Scene.
9391
+ *
9392
+ * The AABB is represented by a six-element Float64Array containing the min/max extents of the axis-aligned volume, ie. ````[xmin, ymin,zmin,xmax,ymax, zmax]````.
9393
+ *
9394
+ * When the Scene has no content, will be ````[-100,-100,-100,100,100,100]````.
9395
+ *
9396
+ * @type {Number[]}
9397
+ */},{key:"aabb",get:function get(){if(this._aabbDirty){if(!this._aabb){this._aabb=math.AABB3();}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var aabb;var collidables=this._collidables;var collidable;var valid=false;for(var collidableId in collidables){if(collidables.hasOwnProperty(collidableId)){collidable=collidables[collidableId];if(collidable.collidable===false){continue;}aabb=collidable.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}}if(!valid){xmin=-100;ymin=-100;zmin=-100;xmax=100;ymax=100;zmax=100;}this._aabb[0]=xmin;this._aabb[1]=ymin;this._aabb[2]=zmin;this._aabb[3]=xmax;this._aabb[4]=ymax;this._aabb[5]=zmax;this._aabbDirty=false;}return this._aabb;}},{key:"_setAABBDirty",value:function _setAABBDirty(){//if (!this._aabbDirty) {
9382
9398
  this._aabbDirty=true;this.fire("boundary");// }
9383
9399
  }/**
9384
9400
  * Attempts to pick an {@link Entity} in this Scene.
@@ -9493,166 +9509,166 @@ if(!params.canvasPos&&!params.matrix&&(!params.origin||!params.direction)){this.
9493
9509
  if(includeEntities){params.includeEntityIds=getEntityIDMap(this,includeEntities);}var excludeEntities=params.excludeEntities||params.exclude;// Backwards compat
9494
9510
  if(excludeEntities){params.excludeEntityIds=getEntityIDMap(this,excludeEntities);}if(this._needRecompile){this._recompile();this._renderer.imageDirty();this._needRecompile=false;}if(params.snapToEdge||params.snapToVertex){pickResult=this._renderer.snapPick(params.canvasPos,params.snapRadius||30,params.snapToVertex,params.snapToEdge,pickResult);}else{pickResult=this._renderer.pick(params,pickResult);}if(pickResult){if(pickResult.entity&&pickResult.entity.fire){pickResult.entity.fire("picked",pickResult);// TODO: SceneModelEntity doesn't fire events
9495
9511
  }}return pickResult;}/**
9496
- * @param {Object} params Picking parameters.
9497
- * @param {Number[]} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the **origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position, directly along the negative View-space Z-axis.
9498
- * @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels
9499
- * @param {boolean} [params.snapToVertex=true] Whether to snap to vertex.
9500
- * @param {boolean} [params.snapToEdge=true] Whether to snap to edge.
9501
- * @deprecated
9502
- */},{key:"snapPick",value:function snapPick(params){if(undefined===this._warnSnapPickDeprecated){this._warnSnapPickDeprecated=true;this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead");}return this._renderer.snapPick(params.canvasPos,params.snapRadius||30,params.snapToVertex,params.snapToEdge);}/**
9503
- * Destroys all non-default {@link Component}s in this Scene.
9504
- */},{key:"clear",value:function clear(){var component;for(var id in this.components){if(this.components.hasOwnProperty(id)){component=this.components[id];if(!component._dontClear){// Don't destroy components like Camera, Input, Viewport etc.
9512
+ * @param {Object} params Picking parameters.
9513
+ * @param {Number[]} [params.canvasPos] Canvas-space coordinates. When ray-picking, this will override the **origin** and ** direction** parameters and will cause the ray to be fired through the canvas at this position, directly along the negative View-space Z-axis.
9514
+ * @param {Number} [params.snapRadius=30] The snap radius, in canvas pixels
9515
+ * @param {boolean} [params.snapToVertex=true] Whether to snap to vertex.
9516
+ * @param {boolean} [params.snapToEdge=true] Whether to snap to edge.
9517
+ * @deprecated
9518
+ */},{key:"snapPick",value:function snapPick(params){if(undefined===this._warnSnapPickDeprecated){this._warnSnapPickDeprecated=true;this.warn("Scene.snapPick() is deprecated since v2.4.2 - use Scene.pick() instead");}return this._renderer.snapPick(params.canvasPos,params.snapRadius||30,params.snapToVertex,params.snapToEdge);}/**
9519
+ * Destroys all non-default {@link Component}s in this Scene.
9520
+ */},{key:"clear",value:function clear(){var component;for(var id in this.components){if(this.components.hasOwnProperty(id)){component=this.components[id];if(!component._dontClear){// Don't destroy components like Camera, Input, Viewport etc.
9505
9521
  component.destroy();}}}}/**
9506
- * Destroys all {@link Light}s in this Scene..
9507
- */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i87=0,len=ids.length;_i87<len;_i87++){this.lights[ids[_i87]].destroy();}}/**
9508
- * Destroys all {@link SectionPlane}s in this Scene.
9509
- */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i88=0,len=ids.length;_i88<len;_i88++){this.sectionPlanes[ids[_i88]].destroy();}}/**
9510
- * Destroys all {@link Line}s in this Scene.
9511
- */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i89=0,len=ids.length;_i89<len;_i89++){this.bitmaps[ids[_i89]].destroy();}}/**
9512
- * Destroys all {@link Line}s in this Scene.
9513
- */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i90=0,len=ids.length;_i90<len;_i90++){this.lineSets[ids[_i90]].destroy();}}/**
9514
- * Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.
9515
- *
9516
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9517
- *
9518
- * Each {@link Entity} on which {@link Entity#isObject} is registered by {@link Entity#id} in {@link Scene#visibleObjects}.
9519
- *
9520
- * Each {@link Entity} is only included in the AABB when {@link Entity#collidable} is ````true````.
9521
- *
9522
- * @param {String[]} ids Array of {@link Entity#id} values.
9523
- * @returns {[Number, Number, Number, Number, Number, Number]} An axis-aligned World-space bounding box, given as elements ````[xmin, ymin, zmin, xmax, ymax, zmax]````.
9524
- */},{key:"getAABB",value:function getAABB(ids){if(ids===undefined){return this.aabb;}if(utils.isString(ids)){var entity=this.objects[ids];if(entity&&entity.aabb){// A Component subclass with an AABB
9522
+ * Destroys all {@link Light}s in this Scene..
9523
+ */},{key:"clearLights",value:function clearLights(){var ids=Object.keys(this.lights);for(var _i87=0,len=ids.length;_i87<len;_i87++){this.lights[ids[_i87]].destroy();}}/**
9524
+ * Destroys all {@link SectionPlane}s in this Scene.
9525
+ */},{key:"clearSectionPlanes",value:function clearSectionPlanes(){var ids=Object.keys(this.sectionPlanes);for(var _i88=0,len=ids.length;_i88<len;_i88++){this.sectionPlanes[ids[_i88]].destroy();}}/**
9526
+ * Destroys all {@link Line}s in this Scene.
9527
+ */},{key:"clearBitmaps",value:function clearBitmaps(){var ids=Object.keys(this.bitmaps);for(var _i89=0,len=ids.length;_i89<len;_i89++){this.bitmaps[ids[_i89]].destroy();}}/**
9528
+ * Destroys all {@link Line}s in this Scene.
9529
+ */},{key:"clearLines",value:function clearLines(){var ids=Object.keys(this.lineSets);for(var _i90=0,len=ids.length;_i90<len;_i90++){this.lineSets[ids[_i90]].destroy();}}/**
9530
+ * Gets the collective axis-aligned boundary (AABB) of a batch of {@link Entity}s that represent objects.
9531
+ *
9532
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9533
+ *
9534
+ * Each {@link Entity} on which {@link Entity#isObject} is registered by {@link Entity#id} in {@link Scene#visibleObjects}.
9535
+ *
9536
+ * Each {@link Entity} is only included in the AABB when {@link Entity#collidable} is ````true````.
9537
+ *
9538
+ * @param {String[]} ids Array of {@link Entity#id} values.
9539
+ * @returns {[Number, Number, Number, Number, Number, Number]} An axis-aligned World-space bounding box, given as elements ````[xmin, ymin, zmin, xmax, ymax, zmax]````.
9540
+ */},{key:"getAABB",value:function getAABB(ids){if(ids===undefined){return this.aabb;}if(utils.isString(ids)){var entity=this.objects[ids];if(entity&&entity.aabb){// A Component subclass with an AABB
9525
9541
  return entity.aabb;}ids=[ids];// Must be an entity type
9526
9542
  }if(ids.length===0){return this.aabb;}var xmin=math.MAX_DOUBLE;var ymin=math.MAX_DOUBLE;var zmin=math.MAX_DOUBLE;var xmax=math.MIN_DOUBLE;var ymax=math.MIN_DOUBLE;var zmax=math.MIN_DOUBLE;var valid;this.withObjects(ids,function(entity){if(entity.collidable){var aabb=entity.aabb;if(aabb[0]<xmin){xmin=aabb[0];}if(aabb[1]<ymin){ymin=aabb[1];}if(aabb[2]<zmin){zmin=aabb[2];}if(aabb[3]>xmax){xmax=aabb[3];}if(aabb[4]>ymax){ymax=aabb[4];}if(aabb[5]>zmax){zmax=aabb[5];}valid=true;}});if(valid){var aabb2=math.AABB3();aabb2[0]=xmin;aabb2[1]=ymin;aabb2[2]=zmin;aabb2[3]=xmax;aabb2[4]=ymax;aabb2[5]=zmax;return aabb2;}else{return this.aabb;// Scene AABB
9527
9543
  }}/**
9528
- * Batch-updates {@link Entity#visible} on {@link Entity}s that represent objects.
9529
- *
9530
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9531
- *
9532
- * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#visible} are ````true```` is
9533
- * registered by {@link Entity#id} in {@link Scene#visibleObjects}.
9534
- *
9535
- * @param {String[]} ids Array of {@link Entity#id} values.
9536
- * @param {Boolean} visible Whether or not to set visible.
9537
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9538
- */},{key:"setObjectsVisible",value:function setObjectsVisible(ids,visible){return this.withObjects(ids,function(entity){var changed=entity.visible!==visible;entity.visible=visible;return changed;});}/**
9539
- * Batch-updates {@link Entity#collidable} on {@link Entity}s that represent objects.
9540
- *
9541
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9542
- *
9543
- * @param {String[]} ids Array of {@link Entity#id} values.
9544
- * @param {Boolean} collidable Whether or not to set collidable.
9545
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9546
- */},{key:"setObjectsCollidable",value:function setObjectsCollidable(ids,collidable){return this.withObjects(ids,function(entity){var changed=entity.collidable!==collidable;entity.collidable=collidable;return changed;});}/**
9547
- * Batch-updates {@link Entity#culled} on {@link Entity}s that represent objects.
9548
- *
9549
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9550
- *
9551
- * @param {String[]} ids Array of {@link Entity#id} values.
9552
- * @param {Boolean} culled Whether or not to cull.
9553
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9554
- */},{key:"setObjectsCulled",value:function setObjectsCulled(ids,culled){return this.withObjects(ids,function(entity){var changed=entity.culled!==culled;entity.culled=culled;return changed;});}/**
9555
- * Batch-updates {@link Entity#selected} on {@link Entity}s that represent objects.
9556
- *
9557
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9558
- *
9559
- * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#selected} are ````true```` is
9560
- * registered by {@link Entity#id} in {@link Scene#selectedObjects}.
9561
- *
9562
- * @param {String[]} ids Array of {@link Entity#id} values.
9563
- * @param {Boolean} selected Whether or not to select.
9564
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9565
- */},{key:"setObjectsSelected",value:function setObjectsSelected(ids,selected){return this.withObjects(ids,function(entity){var changed=entity.selected!==selected;entity.selected=selected;return changed;});}/**
9566
- * Batch-updates {@link Entity#highlighted} on {@link Entity}s that represent objects.
9567
- *
9568
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9569
- *
9570
- * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#highlighted} are ````true```` is
9571
- * registered by {@link Entity#id} in {@link Scene#highlightedObjects}.
9572
- *
9573
- * @param {String[]} ids Array of {@link Entity#id} values.
9574
- * @param {Boolean} highlighted Whether or not to highlight.
9575
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9576
- */},{key:"setObjectsHighlighted",value:function setObjectsHighlighted(ids,highlighted){return this.withObjects(ids,function(entity){var changed=entity.highlighted!==highlighted;entity.highlighted=highlighted;return changed;});}/**
9577
- * Batch-updates {@link Entity#xrayed} on {@link Entity}s that represent objects.
9578
- *
9579
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9580
- *
9581
- * @param {String[]} ids Array of {@link Entity#id} values.
9582
- * @param {Boolean} xrayed Whether or not to xray.
9583
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9584
- */},{key:"setObjectsXRayed",value:function setObjectsXRayed(ids,xrayed){return this.withObjects(ids,function(entity){var changed=entity.xrayed!==xrayed;entity.xrayed=xrayed;return changed;});}/**
9585
- * Batch-updates {@link Entity#edges} on {@link Entity}s that represent objects.
9586
- *
9587
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9588
- *
9589
- * @param {String[]} ids Array of {@link Entity#id} values.
9590
- * @param {Boolean} edges Whether or not to show edges.
9591
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9592
- */},{key:"setObjectsEdges",value:function setObjectsEdges(ids,edges){return this.withObjects(ids,function(entity){var changed=entity.edges!==edges;entity.edges=edges;return changed;});}/**
9593
- * Batch-updates {@link Entity#colorize} on {@link Entity}s that represent objects.
9594
- *
9595
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9596
- *
9597
- * @param {String[]} ids Array of {@link Entity#id} values.
9598
- * @param {Number[]} [colorize=(1,1,1)] RGB colorize factors, multiplied by the rendered pixel colors.
9599
- * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
9600
- */},{key:"setObjectsColorized",value:function setObjectsColorized(ids,colorize){return this.withObjects(ids,function(entity){entity.colorize=colorize;});}/**
9601
- * Batch-updates {@link Entity#opacity} on {@link Entity}s that represent objects.
9602
- *
9603
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9604
- *
9605
- * @param {String[]} ids Array of {@link Entity#id} values.
9606
- * @param {Number} [opacity=1.0] Opacity factor, multiplied by the rendered pixel alphas.
9607
- * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
9608
- */},{key:"setObjectsOpacity",value:function setObjectsOpacity(ids,opacity){return this.withObjects(ids,function(entity){var changed=entity.opacity!==opacity;entity.opacity=opacity;return changed;});}/**
9609
- * Batch-updates {@link Entity#pickable} on {@link Entity}s that represent objects.
9610
- *
9611
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9612
- *
9613
- * @param {String[]} ids Array of {@link Entity#id} values.
9614
- * @param {Boolean} pickable Whether or not to set pickable.
9615
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9616
- */},{key:"setObjectsPickable",value:function setObjectsPickable(ids,pickable){return this.withObjects(ids,function(entity){var changed=entity.pickable!==pickable;entity.pickable=pickable;return changed;});}/**
9617
- * Batch-updates {@link Entity#offset} on {@link Entity}s that represent objects.
9618
- *
9619
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9620
- *
9621
- * @param {String[]} ids Array of {@link Entity#id} values.
9622
- * @param {Number[]} [offset] 3D offset vector.
9623
- */},{key:"setObjectsOffset",value:function setObjectsOffset(ids,offset){this.withObjects(ids,function(entity){entity.offset=offset;});}/**
9624
- * Iterates with a callback over {@link Entity}s that represent objects.
9625
- *
9626
- * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9627
- *
9628
- * @param {String[]} ids Array of {@link Entity#id} values.
9629
- * @param {Function} callback Callback to execute on eacn {@link Entity}.
9630
- * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9631
- */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i91=0,len=ids.length;_i91<len;_i91++){var id=ids[_i91];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i92=0,_len9=modelIds.length;_i92<_len9;_i92++){var modelId=modelIds[_i92];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
9632
- * This method will "tickify" the provided `cb` function.
9633
- *
9634
- * This means, the function will be wrapped so:
9635
- *
9636
- * - it runs time-aligned to scene ticks
9637
- * - it runs maximum once per scene-tick
9638
- *
9639
- * @param {Function} cb The function to tickify
9640
- * @returns {Function}
9641
- */},{key:"tickify",value:function tickify(cb){var cbString=cb.toString();/**
9642
- * Check if the function is already tickified, and if so return the cached one.
9643
- */if(cbString in this._tickifiedFunctions){return this._tickifiedFunctions[cbString].wrapperFunc;}var alreadyRun=0;var needToRun=0;var lastArgs;/**
9644
- * The provided `cb` function is replaced with a "set-dirty" function
9645
- *
9646
- * @type {Function}
9647
- */var wrapperFunc=function wrapperFunc(){for(var _len10=arguments.length,args=new Array(_len10),_key7=0;_key7<_len10;_key7++){args[_key7]=arguments[_key7];}lastArgs=args;needToRun++;};/**
9648
- * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
9649
- *
9650
- * This will make it run time-aligned to the scene tick.
9651
- */var tickSubId=this.on("tick",function(){var tmp=needToRun;if(tmp>alreadyRun){alreadyRun=tmp;cb.apply(void 0,_toConsumableArray(lastArgs));}});/**
9652
- * And, store the list of subscribers.
9653
- */this._tickifiedFunctions[cbString]={tickSubId:tickSubId,wrapperFunc:wrapperFunc};return wrapperFunc;}/**
9654
- * Destroys this Scene.
9655
- */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Scene.prototype),"destroy",this).call(this);for(var id in this.components){if(this.components.hasOwnProperty(id)){this.components[id].destroy();}}this.canvas.gl=null;// Memory leak prevention
9544
+ * Batch-updates {@link Entity#visible} on {@link Entity}s that represent objects.
9545
+ *
9546
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9547
+ *
9548
+ * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#visible} are ````true```` is
9549
+ * registered by {@link Entity#id} in {@link Scene#visibleObjects}.
9550
+ *
9551
+ * @param {String[]} ids Array of {@link Entity#id} values.
9552
+ * @param {Boolean} visible Whether or not to set visible.
9553
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9554
+ */},{key:"setObjectsVisible",value:function setObjectsVisible(ids,visible){return this.withObjects(ids,function(entity){var changed=entity.visible!==visible;entity.visible=visible;return changed;});}/**
9555
+ * Batch-updates {@link Entity#collidable} on {@link Entity}s that represent objects.
9556
+ *
9557
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9558
+ *
9559
+ * @param {String[]} ids Array of {@link Entity#id} values.
9560
+ * @param {Boolean} collidable Whether or not to set collidable.
9561
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9562
+ */},{key:"setObjectsCollidable",value:function setObjectsCollidable(ids,collidable){return this.withObjects(ids,function(entity){var changed=entity.collidable!==collidable;entity.collidable=collidable;return changed;});}/**
9563
+ * Batch-updates {@link Entity#culled} on {@link Entity}s that represent objects.
9564
+ *
9565
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9566
+ *
9567
+ * @param {String[]} ids Array of {@link Entity#id} values.
9568
+ * @param {Boolean} culled Whether or not to cull.
9569
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9570
+ */},{key:"setObjectsCulled",value:function setObjectsCulled(ids,culled){return this.withObjects(ids,function(entity){var changed=entity.culled!==culled;entity.culled=culled;return changed;});}/**
9571
+ * Batch-updates {@link Entity#selected} on {@link Entity}s that represent objects.
9572
+ *
9573
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9574
+ *
9575
+ * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#selected} are ````true```` is
9576
+ * registered by {@link Entity#id} in {@link Scene#selectedObjects}.
9577
+ *
9578
+ * @param {String[]} ids Array of {@link Entity#id} values.
9579
+ * @param {Boolean} selected Whether or not to select.
9580
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9581
+ */},{key:"setObjectsSelected",value:function setObjectsSelected(ids,selected){return this.withObjects(ids,function(entity){var changed=entity.selected!==selected;entity.selected=selected;return changed;});}/**
9582
+ * Batch-updates {@link Entity#highlighted} on {@link Entity}s that represent objects.
9583
+ *
9584
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9585
+ *
9586
+ * Each {@link Entity} on which both {@link Entity#isObject} and {@link Entity#highlighted} are ````true```` is
9587
+ * registered by {@link Entity#id} in {@link Scene#highlightedObjects}.
9588
+ *
9589
+ * @param {String[]} ids Array of {@link Entity#id} values.
9590
+ * @param {Boolean} highlighted Whether or not to highlight.
9591
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9592
+ */},{key:"setObjectsHighlighted",value:function setObjectsHighlighted(ids,highlighted){return this.withObjects(ids,function(entity){var changed=entity.highlighted!==highlighted;entity.highlighted=highlighted;return changed;});}/**
9593
+ * Batch-updates {@link Entity#xrayed} on {@link Entity}s that represent objects.
9594
+ *
9595
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9596
+ *
9597
+ * @param {String[]} ids Array of {@link Entity#id} values.
9598
+ * @param {Boolean} xrayed Whether or not to xray.
9599
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9600
+ */},{key:"setObjectsXRayed",value:function setObjectsXRayed(ids,xrayed){return this.withObjects(ids,function(entity){var changed=entity.xrayed!==xrayed;entity.xrayed=xrayed;return changed;});}/**
9601
+ * Batch-updates {@link Entity#edges} on {@link Entity}s that represent objects.
9602
+ *
9603
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9604
+ *
9605
+ * @param {String[]} ids Array of {@link Entity#id} values.
9606
+ * @param {Boolean} edges Whether or not to show edges.
9607
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9608
+ */},{key:"setObjectsEdges",value:function setObjectsEdges(ids,edges){return this.withObjects(ids,function(entity){var changed=entity.edges!==edges;entity.edges=edges;return changed;});}/**
9609
+ * Batch-updates {@link Entity#colorize} on {@link Entity}s that represent objects.
9610
+ *
9611
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9612
+ *
9613
+ * @param {String[]} ids Array of {@link Entity#id} values.
9614
+ * @param {Number[]} [colorize=(1,1,1)] RGB colorize factors, multiplied by the rendered pixel colors.
9615
+ * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
9616
+ */},{key:"setObjectsColorized",value:function setObjectsColorized(ids,colorize){return this.withObjects(ids,function(entity){entity.colorize=colorize;});}/**
9617
+ * Batch-updates {@link Entity#opacity} on {@link Entity}s that represent objects.
9618
+ *
9619
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9620
+ *
9621
+ * @param {String[]} ids Array of {@link Entity#id} values.
9622
+ * @param {Number} [opacity=1.0] Opacity factor, multiplied by the rendered pixel alphas.
9623
+ * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
9624
+ */},{key:"setObjectsOpacity",value:function setObjectsOpacity(ids,opacity){return this.withObjects(ids,function(entity){var changed=entity.opacity!==opacity;entity.opacity=opacity;return changed;});}/**
9625
+ * Batch-updates {@link Entity#pickable} on {@link Entity}s that represent objects.
9626
+ *
9627
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9628
+ *
9629
+ * @param {String[]} ids Array of {@link Entity#id} values.
9630
+ * @param {Boolean} pickable Whether or not to set pickable.
9631
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9632
+ */},{key:"setObjectsPickable",value:function setObjectsPickable(ids,pickable){return this.withObjects(ids,function(entity){var changed=entity.pickable!==pickable;entity.pickable=pickable;return changed;});}/**
9633
+ * Batch-updates {@link Entity#offset} on {@link Entity}s that represent objects.
9634
+ *
9635
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9636
+ *
9637
+ * @param {String[]} ids Array of {@link Entity#id} values.
9638
+ * @param {Number[]} [offset] 3D offset vector.
9639
+ */},{key:"setObjectsOffset",value:function setObjectsOffset(ids,offset){this.withObjects(ids,function(entity){entity.offset=offset;});}/**
9640
+ * Iterates with a callback over {@link Entity}s that represent objects.
9641
+ *
9642
+ * An {@link Entity} represents an object when {@link Entity#isObject} is ````true````.
9643
+ *
9644
+ * @param {String[]} ids Array of {@link Entity#id} values.
9645
+ * @param {Function} callback Callback to execute on eacn {@link Entity}.
9646
+ * @returns {Boolean} True if any {@link Entity}s were updated, else false if all updates were redundant and not applied.
9647
+ */},{key:"withObjects",value:function withObjects(ids,callback){if(utils.isString(ids)){ids=[ids];}var changed=false;for(var _i91=0,len=ids.length;_i91<len;_i91++){var id=ids[_i91];var entity=this.objects[id];if(entity){changed=callback(entity)||changed;}else{var modelIds=this.modelIds;for(var _i92=0,_len9=modelIds.length;_i92<_len9;_i92++){var modelId=modelIds[_i92];var globalObjectId=math.globalizeObjectId(modelId,id);entity=this.objects[globalObjectId];if(entity){changed=callback(entity)||changed;}}}}return changed;}/**
9648
+ * This method will "tickify" the provided `cb` function.
9649
+ *
9650
+ * This means, the function will be wrapped so:
9651
+ *
9652
+ * - it runs time-aligned to scene ticks
9653
+ * - it runs maximum once per scene-tick
9654
+ *
9655
+ * @param {Function} cb The function to tickify
9656
+ * @returns {Function}
9657
+ */},{key:"tickify",value:function tickify(cb){var cbString=cb.toString();/**
9658
+ * Check if the function is already tickified, and if so return the cached one.
9659
+ */if(cbString in this._tickifiedFunctions){return this._tickifiedFunctions[cbString].wrapperFunc;}var alreadyRun=0;var needToRun=0;var lastArgs;/**
9660
+ * The provided `cb` function is replaced with a "set-dirty" function
9661
+ *
9662
+ * @type {Function}
9663
+ */var wrapperFunc=function wrapperFunc(){for(var _len10=arguments.length,args=new Array(_len10),_key7=0;_key7<_len10;_key7++){args[_key7]=arguments[_key7];}lastArgs=args;needToRun++;};/**
9664
+ * An each scene tick, if the "dirty-flag" is set, run the `cb` function.
9665
+ *
9666
+ * This will make it run time-aligned to the scene tick.
9667
+ */var tickSubId=this.on("tick",function(){var tmp=needToRun;if(tmp>alreadyRun){alreadyRun=tmp;cb.apply(void 0,_toConsumableArray(lastArgs));}});/**
9668
+ * And, store the list of subscribers.
9669
+ */this._tickifiedFunctions[cbString]={tickSubId:tickSubId,wrapperFunc:wrapperFunc};return wrapperFunc;}/**
9670
+ * Destroys this Scene.
9671
+ */},{key:"destroy",value:function destroy(){_get(_getPrototypeOf(Scene.prototype),"destroy",this).call(this);for(var id in this.components){if(this.components.hasOwnProperty(id)){this.components[id].destroy();}}this.canvas.gl=null;// Memory leak prevention
9656
9672
  this.components=null;this.models=null;this.objects=null;this.visibleObjects=null;this.xrayedObjects=null;this.highlightedObjects=null;this.selectedObjects=null;this.colorizedObjects=null;this.opacityObjects=null;this.sectionPlanes=null;this.lights=null;this.lightMaps=null;this.reflectionMaps=null;this._objectIds=null;this._visibleObjectIds=null;this._xrayedObjectIds=null;this._highlightedObjectIds=null;this._selectedObjectIds=null;this._colorizedObjectIds=null;this.types=null;this.components=null;this.canvas=null;this._renderer=null;this.input=null;this._viewport=null;this._camera=null;}}]);return Scene;}(Component);/**
9657
9673
  * Texture wrapping mode in which the texture repeats to infinity.
9658
9674
  */var RepeatWrapping=1000;/**
@@ -26401,27 +26417,27 @@ addMesh(modelNode,positions,normals,colors,material,options);}function addMesh(m
26401
26417
  *
26402
26418
  * @class TreeViewPlugin
26403
26419
  */var TreeViewPlugin=/*#__PURE__*/function(_Plugin15){_inherits(TreeViewPlugin,_Plugin15);var _super161=_createSuper(TreeViewPlugin);/**
26404
- * @constructor
26405
- *
26406
- * @param {Viewer} viewer The Viewer.
26407
- * @param {*} cfg Plugin configuration.
26408
- * @param {String} [cfg.containerElementId] ID of an existing HTML element to contain the TreeViewPlugin - either this or containerElement is mandatory. When both values are given, the element reference is always preferred to the ID.
26409
- * @param {HTMLElement} cfg.containerElement DOM element to contain the TreeViewPlugin.
26410
- * @param {Boolean} [cfg.autoAddModels=true] When ````true```` (default), will automatically add each model as it's created. Set this ````false```` if you want to manually add models using {@link TreeViewPlugin#addModel} instead.
26411
- * @param {Number} [cfg.autoExpandDepth] Optional depth to which to initially expand the tree.
26412
- * @param {String} [cfg.hierarchy="containment"] How to organize the tree nodes: "containment", "storeys" or "types". See the class documentation for details.
26413
- * @param {Boolean} [cfg.sortNodes=true] When true, will sort the children of each node. For a "storeys" hierarchy, the
26414
- * ````IfcBuildingStorey```` nodes will be ordered spatially, from the highest storey down to the lowest, on the
26415
- * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
26416
- * @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.
26417
- * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
26418
- */function TreeViewPlugin(viewer){var _this145;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this145=_super161.call(this,"TreeViewPlugin",viewer);/**
26419
- * Contains messages for any errors found while last rebuilding this TreeView.
26420
- * @type {String[]}
26421
- */_this145.errors=[];/**
26422
- * True if errors were found generating this TreeView.
26423
- * @type {boolean}
26424
- */_this145.valid=true;// const containerElement =
26420
+ * @constructor
26421
+ *
26422
+ * @param {Viewer} viewer The Viewer.
26423
+ * @param {*} cfg Plugin configuration.
26424
+ * @param {String} [cfg.containerElementId] ID of an existing HTML element to contain the TreeViewPlugin - either this or containerElement is mandatory. When both values are given, the element reference is always preferred to the ID.
26425
+ * @param {HTMLElement} cfg.containerElement DOM element to contain the TreeViewPlugin.
26426
+ * @param {Boolean} [cfg.autoAddModels=true] When ````true```` (default), will automatically add each model as it's created. Set this ````false```` if you want to manually add models using {@link TreeViewPlugin#addModel} instead.
26427
+ * @param {Number} [cfg.autoExpandDepth] Optional depth to which to initially expand the tree.
26428
+ * @param {String} [cfg.hierarchy="containment"] How to organize the tree nodes: "containment", "storeys" or "types". See the class documentation for details.
26429
+ * @param {Boolean} [cfg.sortNodes=true] When true, will sort the children of each node. For a "storeys" hierarchy, the
26430
+ * ````IfcBuildingStorey```` nodes will be ordered spatially, from the highest storey down to the lowest, on the
26431
+ * vertical World axis. For all hierarchy types, other node types will be ordered in the ascending alphanumeric order of their titles.
26432
+ * @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.
26433
+ * @param {RenderService} [cfg.renderService] Optional {@link RenderService} to use. Defaults to the {@link TreeViewPlugin}'s default {@link RenderService}.
26434
+ */function TreeViewPlugin(viewer){var _this145;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,TreeViewPlugin);_this145=_super161.call(this,"TreeViewPlugin",viewer);/**
26435
+ * Contains messages for any errors found while last rebuilding this TreeView.
26436
+ * @type {String[]}
26437
+ */_this145.errors=[];/**
26438
+ * True if errors were found generating this TreeView.
26439
+ * @type {boolean}
26440
+ */_this145.valid=true;// const containerElement =
26425
26441
  // cfg.containerElement || document.getElementById(cfg.containerElementId);
26426
26442
  // if (!(containerElement instanceof HTMLElement)) {
26427
26443
  // this.error(
@@ -26462,29 +26478,36 @@ this.fire("ExpandHandler",event);}//收起点击事件
26462
26478
  this.fire("CollapseHandler",event);}//勾选框点击事件
26463
26479
  },{key:"checkboxChangeHandler",value:function checkboxChangeHandler(event){this.fire("checkBoxChanged",event);if(this._muteTreeEvents){return;}this._muteSceneEvents=true;var checkbox=event.target;//勾选框html对象
26464
26480
  var visible=checkbox.checked;//获取勾选状态
26465
- var nodeId=checkbox.id.replace('checkbox-','');//获取勾选框对应节点id
26481
+ var nodeId=checkbox.id.replace("checkbox-","");//获取勾选框对应节点id
26466
26482
  var checkedNode=this._nodeNodes[nodeId];var objects=this._viewer.scene.objects;var numUpdated=0;this._withNodeTree(checkedNode,function(node){var objectId=node.objectId;var entity=objects[objectId];var isLeaf=node.children.length===0;node.numVisibleEntities=visible?node.numEntities:0;if(isLeaf&&visible!==node.checked){numUpdated++;}node.checked=visible;setCheckbox(node.nodeId,visible);if(entity){entity.visible=visible;}function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}});var parent=checkedNode.parent;while(parent){parent.checked=visible;if(visible){parent.numVisibleEntities+=numUpdated;}else{parent.numVisibleEntities-=numUpdated;}// this._renderService.setCheckbox(parent.nodeId, (parent.numVisibleEntities > 0));
26467
- parent=parent.parent;}this._muteSceneEvents=false;}/**
26468
- * Sets how the nodes are organized within this tree view.
26469
- *
26470
- * Accepted values are:
26471
- *
26472
- * * "containment" - organizes the nodes to indicate the containment hierarchy of the IFC objects.
26473
- * * "types" - groups the nodes within their IFC types.
26474
- * * "storeys" - groups the nodes within ````IfcBuildingStoreys```` and sub-groups them by their IFC types.
26475
- *
26476
- * <br>
26477
- * This can be updated dynamically.
26478
- *
26479
- * Default value is "containment".
26480
- *
26481
- * @type {String}
26482
- */},{key:"hierarchy",get:/**
26483
- * Gets how the nodes are organized within this tree view.
26484
- *
26485
- * @type {String}
26486
- */function get(){return this._hierarchy;}//创建根节点tree---------11111111111111111
26487
- ,set:function set(hierarchy){hierarchy=hierarchy||"containment";if(hierarchy!=="containment"&&hierarchy!=="storeys"&&hierarchy!=="types"){this.error("Unsupported value for `hierarchy' - defaulting to 'containment'");hierarchy="containment";}if(this._hierarchy===hierarchy){return;}this._hierarchy=hierarchy;this._createNodes();}},{key:"_createNodes",value:function _createNodes(){if(this._rootElement){this._rootElement.parentNode.removeChild(this._rootElement);this._rootElement=null;}this._rootNodes=[];this._objectNodes={};this._nodeNodes={};this._validate();if(this.valid||this._hierarchy!=="storeys"){this._createEnabledNodes();}}//创建节点tree----------222222222222222222
26483
+ setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}this._muteSceneEvents=false;function setCheckbox(nodeId,checked){var checkbox=document.getElementById("checkbox-".concat(nodeId));if(checkbox){if(checked!==checkbox.checked){checkbox.checked=checked;}}}}/**
26484
+ * Sets how the nodes are organized within this tree view.
26485
+ *
26486
+ * Accepted values are:
26487
+ *
26488
+ * * "containment" - organizes the nodes to indicate the containment hierarchy of the IFC objects.
26489
+ * * "types" - groups the nodes within their IFC types.
26490
+ * * "storeys" - groups the nodes within ````IfcBuildingStoreys```` and sub-groups them by their IFC types.
26491
+ *
26492
+ * <br>
26493
+ * This can be updated dynamically.
26494
+ *
26495
+ * Default value is "containment".
26496
+ *
26497
+ * @type {String}
26498
+ */},{key:"hierarchy",get:/**
26499
+ * Gets how the nodes are organized within this tree view.
26500
+ *
26501
+ * @type {String}
26502
+ */function get(){return this._hierarchy;}/**
26503
+ * get _muteTreeEvents
26504
+ * @type {boolean}
26505
+ */,set:function set(hierarchy){hierarchy=hierarchy||"containment";if(hierarchy!=="containment"&&hierarchy!=="storeys"&&hierarchy!=="types"){this.error("Unsupported value for `hierarchy' - defaulting to 'containment'");hierarchy="containment";}if(this._hierarchy===hierarchy){return;}this._hierarchy=hierarchy;this._createNodes();}},{key:"muteTreeEvents",get:function get(){return this._muteTreeEvents;}/**
26506
+ * set _muteTreeEvents
26507
+ */,set:function set(mute){this._muteTreeEvents=mute;}/**
26508
+ * 获取nodeNodes
26509
+ */},{key:"nodeNodes",get:function get(){return this._nodeNodes;}//创建根节点tree---------11111111111111111
26510
+ },{key:"_createNodes",value:function _createNodes(){if(this._rootElement){this._rootElement.parentNode.removeChild(this._rootElement);this._rootElement=null;}this._rootNodes=[];this._objectNodes={};this._nodeNodes={};this._validate();if(this.valid||this._hierarchy!=="storeys"){this._createEnabledNodes();}}//创建节点tree----------222222222222222222
26488
26511
  },{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();//同步scene和metaScene中的内容
26489
26512
  this.fire("nodeNodes_Created",this._nodeNodes);this.fire("rootNodes_Created",this._rootNodes);this.fire("objectNodes_Created",this._objectNodes);// this._createTrees(); //创建html tree
26490
26513
  // this.expandToDepth(this._autoExpandDepth); //展开几层与否
@@ -26546,46 +26569,46 @@ while(parent){parent.numEntities++;if(visible){parent.numVisibleEntities++;paren
26546
26569
  // }
26547
26570
  // }
26548
26571
  return true;}/**
26549
- * Adds a model to this tree view.
26550
- *
26551
- * The model will be automatically removed when destroyed.
26552
- *
26553
- * To automatically add each model as it's created, instead of manually calling this method each time,
26554
- * provide a ````autoAddModels: true```` to the TreeViewPlugin constructor.
26555
- *
26556
- * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
26557
- * @param {Object} [options] Options for model in the tree view.
26558
- * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
26559
- * and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
26560
- * name. This option allows to override that name when it is not suitable as a display name.
26561
- */},{key:"addModel",value:function addModel(modelId){var _this146=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
26572
+ * Adds a model to this tree view.
26573
+ *
26574
+ * The model will be automatically removed when destroyed.
26575
+ *
26576
+ * To automatically add each model as it's created, instead of manually calling this method each time,
26577
+ * provide a ````autoAddModels: true```` to the TreeViewPlugin constructor.
26578
+ *
26579
+ * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
26580
+ * @param {Object} [options] Options for model in the tree view.
26581
+ * @param {String} [options.rootName] Optional display name for the root node. Ordinary, for "containment"
26582
+ * and "storeys" hierarchy types, the tree would derive the root node name from the model's "IfcProject" element
26583
+ * name. This option allows to override that name when it is not suitable as a display name.
26584
+ */},{key:"addModel",value:function addModel(modelId){var _this146=this;var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};// if (!this._containerElement) {
26562
26585
  // return;
26563
26586
  // }
26564
26587
  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.warn("Model already added: "+modelId);return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this146.removeModel(model.id);});this._createNodes();}/**
26565
- * Removes a model from this tree view.
26566
- *
26567
- * Does nothing if model not currently in tree view.
26568
- *
26569
- * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
26570
- */},{key:"removeModel",value:function removeModel(modelId){// if (!this._containerElement) {
26588
+ * Removes a model from this tree view.
26589
+ *
26590
+ * Does nothing if model not currently in tree view.
26591
+ *
26592
+ * @param {String} modelId ID of a model {@link Entity} in {@link Scene#models}.
26593
+ */},{key:"removeModel",value:function removeModel(modelId){// if (!this._containerElement) {
26571
26594
  // return;
26572
26595
  // }
26573
26596
  var metaModel=this._metaModels[modelId];if(!metaModel){return;}if(this._rootNames[modelId]){delete this._rootNames[modelId];}delete this._metaModels[modelId];this._createNodes();}/**
26574
- * Highlights the tree view node that represents the given object {@link Entity}.
26575
- *
26576
- * This causes the tree view to collapse, then expand to reveal the node, then highlight the node.
26577
- *
26578
- * If a node is previously highlighted, de-highlights that node and collapses the tree first.
26579
- *
26580
- * Note that if the TreeViewPlugin was configured with ````pruneEmptyNodes: true```` (default configuration), then the
26581
- * node won't exist in the tree if it has no Entitys in the {@link Scene}. in that case, nothing will happen.
26582
- *
26583
- * Within the DOM, the node is represented by an ````<li>```` element. This method will add a ````.highlighted-node```` class to
26584
- * the element to make it appear highlighted, removing that class when de-highlighting it again. See the CSS rules
26585
- * in the TreeViewPlugin examples for an example of that class.
26586
- *
26587
- * @param {String} objectId ID of the {@link Entity}.
26588
- */},{key:"showNode",value:function showNode(objectId){this.unShowNode();var node=this._objectNodes[objectId];if(!node){return;// Node may not exist for the given object if (this._pruneEmptyNodes == true)
26597
+ * Highlights the tree view node that represents the given object {@link Entity}.
26598
+ *
26599
+ * This causes the tree view to collapse, then expand to reveal the node, then highlight the node.
26600
+ *
26601
+ * If a node is previously highlighted, de-highlights that node and collapses the tree first.
26602
+ *
26603
+ * Note that if the TreeViewPlugin was configured with ````pruneEmptyNodes: true```` (default configuration), then the
26604
+ * node won't exist in the tree if it has no Entitys in the {@link Scene}. in that case, nothing will happen.
26605
+ *
26606
+ * Within the DOM, the node is represented by an ````<li>```` element. This method will add a ````.highlighted-node```` class to
26607
+ * the element to make it appear highlighted, removing that class when de-highlighting it again. See the CSS rules
26608
+ * in the TreeViewPlugin examples for an example of that class.
26609
+ *
26610
+ * @param {String} objectId ID of the {@link Entity}.
26611
+ */},{key:"showNode",value:function showNode(objectId){this.unShowNode();var node=this._objectNodes[objectId];if(!node){return;// Node may not exist for the given object if (this._pruneEmptyNodes == true)
26589
26612
  }var nodeId=node.nodeId;var parent=node.parent;while(parent){parent=parent.parent;}// for (let i = 0, len = path.length; i < len; i++) {
26590
26613
  // const switchElement = this._renderService.getSwitchElement(
26591
26614
  // path[i].nodeId
@@ -26596,19 +26619,19 @@ var metaModel=this._metaModels[modelId];if(!metaModel){return;}if(this._rootName
26596
26619
  // }
26597
26620
  // this._renderService.setHighlighted(nodeId, true);
26598
26621
  this._showListItemElementId=nodeId;}/**
26599
- * De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
26600
- *
26601
- * Does nothing if no node is currently shown.
26602
- *
26603
- * If the node is currently scrolled into view, keeps the node in view.
26604
- */},{key:"unShowNode",value:function unShowNode(){if(!this._showListItemElementId){return;}// this._renderService.setHighlighted(this._showListItemElementId, false);
26622
+ * De-highlights the node previously shown with {@link TreeViewPlugin#showNode}.
26623
+ *
26624
+ * Does nothing if no node is currently shown.
26625
+ *
26626
+ * If the node is currently scrolled into view, keeps the node in view.
26627
+ */},{key:"unShowNode",value:function unShowNode(){if(!this._showListItemElementId){return;}// this._renderService.setHighlighted(this._showListItemElementId, false);
26605
26628
  this._showListItemElementId=null;}/**
26606
- * Expands the tree to the given depth.
26607
- *
26608
- * Collapses the tree first.
26609
- *
26610
- * @param {Number} depth Depth to expand to.
26611
- */ // expandToDepth(depth) {
26629
+ * Expands the tree to the given depth.
26630
+ *
26631
+ * Collapses the tree first.
26632
+ *
26633
+ * @param {Number} depth Depth to expand to.
26634
+ */ // expandToDepth(depth) {
26612
26635
  // this.collapse();
26613
26636
  // const expand = (node, countDepth) => {
26614
26637
  // if (countDepth === depth) {
@@ -26630,8 +26653,8 @@ this._showListItemElementId=null;}/**
26630
26653
  // }
26631
26654
  // }
26632
26655
  /**
26633
- * Closes all the nodes in the tree.
26634
- */ // collapse() {
26656
+ * Closes all the nodes in the tree.
26657
+ */ // collapse() {
26635
26658
  // for (let i = 0, len = this._rootNodes.length; i < len; i++) {
26636
26659
  // const rootNode = this._rootNodes[i];
26637
26660
  // const objectId = rootNode.objectId;
@@ -26639,23 +26662,23 @@ this._showListItemElementId=null;}/**
26639
26662
  // }
26640
26663
  // }
26641
26664
  /**
26642
- * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
26643
- * node in depth-first pre-order.
26644
- *
26645
- * @param {TreeViewNode} node Root of the subtree.
26646
- * @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
26647
- */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i570=0,len=children.length;_i570<len;_i570++){this.withNodeTree(children[_i570],callback);}}//遍历树指定节点下的子节点
26665
+ * Iterates over a subtree of the tree view's {@link TreeViewNode}s, calling the given callback for each
26666
+ * node in depth-first pre-order.
26667
+ *
26668
+ * @param {TreeViewNode} node Root of the subtree.
26669
+ * @param {Function} callback Callback called at each {@link TreeViewNode}, with the TreeViewNode given as the argument.
26670
+ */},{key:"withNodeTree",value:function withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i570=0,len=children.length;_i570<len;_i570++){this.withNodeTree(children[_i570],callback);}}//遍历树指定节点下的子节点
26648
26671
  },{key:"_withNodeTree",value:function _withNodeTree(node,callback){callback(node);var children=node.children;if(!children){return;}for(var _i571=0,len=children.length;_i571<len;_i571++){this._withNodeTree(children[_i571],callback);}}/**
26649
- * 获取指定id节点的children
26650
- * @param {*} nodeId
26651
- * @returns node Children[]
26652
- */},{key:"getChildrenById",value:function getChildrenById(nodeId){return this._nodeNodes[nodeId].children;}/**
26653
- * 获取指定id的节点
26654
- * @param {*} nodeId
26655
- * @returns
26656
- */},{key:"getNodeById",value:function getNodeById(nodeId){return this._nodeNodes[nodeId];}/**
26657
- * Destroys this TreeViewPlugin.
26658
- */},{key:"destroy",value:function destroy(){// if (!this._containerElement) {
26672
+ * 获取指定id节点的children
26673
+ * @param {*} nodeId
26674
+ * @returns node Children[]
26675
+ */},{key:"getChildrenById",value:function getChildrenById(nodeId){return this._nodeNodes[nodeId].children;}/**
26676
+ * 获取指定id的节点
26677
+ * @param {*} nodeId
26678
+ * @returns
26679
+ */},{key:"getNodeById",value:function getNodeById(nodeId){return this._nodeNodes[nodeId];}/**
26680
+ * Destroys this TreeViewPlugin.
26681
+ */},{key:"destroy",value:function destroy(){// if (!this._containerElement) {
26659
26682
  // return;
26660
26683
  // }
26661
26684
  this._metaModels={};if(this._rootElement&&!this._destroyed){this._rootElement.parentNode.removeChild(this._rootElement);this._viewer.scene.off(this._onObjectVisibility);this._destroyed=true;}delete treeViews[this._index];_get(_getPrototypeOf(TreeViewPlugin.prototype),"destroy",this).call(this);}},{key:"_findEmptyNodes",value:function _findEmptyNodes(){var rootMetaObjects=this._viewer.metaScene.rootMetaObjects;for(var objectId in rootMetaObjects){this._findEmptyNodes2(rootMetaObjects[objectId]);}}},{key:"_findEmptyNodes2",value:function _findEmptyNodes2(metaObject){var countEntities=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var viewer=this.viewer;var scene=viewer.scene;var children=metaObject.children;var objectId=metaObject.id;var entity=scene.objects[objectId];metaObject._countEntities=0;if(entity){metaObject._countEntities++;}if(children){for(var _i572=0,len=children.length;_i572<len;_i572++){var childMetaObject=children[_i572];childMetaObject._countEntities=this._findEmptyNodes2(childMetaObject);metaObject._countEntities+=childMetaObject._countEntities;}}return metaObject._countEntities;}},{key:"_doSortNodes",value:function _doSortNodes(){for(var _i573=0,len=this._rootNodes.length;_i573<len;_i573++){var rootNode=this._rootNodes[_i573];this._sortChildren(rootNode);}}},{key:"_sortChildren",value:function _sortChildren(node){var children=node.children;if(!children||children.length===0){return;}if(this._hierarchy==="storeys"&&node.type==="IfcBuilding"){// Assumes that children of an IfcBuilding will always be IfcBuildingStoreys