@xeokit/xeokit-sdk 2.4.0-alpha-21 → 2.4.0-alpha-23

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.
@@ -330,7 +330,7 @@ this._nextId=0;/**
330
330
  */},{key:"destroy",value:function destroy(){this._context=null;this._clear();if(this._id!==null){idMap.removeItem(this._id);this._id=null;}}},{key:"_clear",value:function _clear(){// Destroys DOM elements, clears menu data
331
331
  for(var _i2=0,len=this._menuList.length;_i2<len;_i2++){var menu=this._menuList[_i2];var menuElement=menu.menuElement;menuElement.parentElement.removeChild(menuElement);}this._itemsCfg=[];this._rootMenu=null;this._menuList=[];this._menuMap={};this._itemList=[];this._itemMap={};}},{key:"_parseItems",value:function _parseItems(itemsCfg){var _this2=this;// Parses "items" config into menu data
332
332
  var visitItems=function visitItems(itemsCfg){var menuId=_this2._getNextId();var menu=new Menu(menuId);for(var _i3=0,len=itemsCfg.length;_i3<len;_i3++){var itemsGroupCfg=itemsCfg[_i3];var group=new Group();menu.groups.push(group);var _loop=function _loop(j,lenj){var itemCfg=itemsGroupCfg[j];var subItemsCfg=itemCfg.items;var hasSubItems=subItemsCfg&&subItemsCfg.length>0;var itemId=_this2._getNextId();var getTitle=itemCfg.getTitle||function(){return itemCfg.title||"";};var doAction=itemCfg.doAction||itemCfg.callback||function(){};var getEnabled=itemCfg.getEnabled||function(){return true;};var getShown=itemCfg.getShown||function(){return true;};var item=new Item(itemId,getTitle,doAction,getEnabled,getShown);item.parentMenu=menu;group.items.push(item);if(hasSubItems){var subMenu=visitItems(subItemsCfg);item.subMenu=subMenu;subMenu.parentItem=item;}_this2._itemList.push(item);_this2._itemMap[item.id]=item;};for(var j=0,lenj=itemsGroupCfg.length;j<lenj;j++){_loop(j,lenj);}}_this2._menuList.push(menu);_this2._menuMap[menu.id]=menu;return menu;};this._rootMenu=visitItems(itemsCfg);}},{key:"_getNextId",value:function _getNextId(){// Returns a unique ID
333
- return"ContextMenu_"+this._id+""+this._nextId++;// Start ID with alpha chars to make a valid DOM element selector
333
+ return"ContextMenu_"+this._id+"_"+this._nextId++;// Start ID with alpha chars to make a valid DOM element selector
334
334
  }},{key:"_createUI",value:function _createUI(){var _this3=this;// Builds DOM elements for the entire menu tree
335
335
  var visitMenu=function visitMenu(menu){_this3._createMenuUI(menu);var groups=menu.groups;for(var _i4=0,len=groups.length;_i4<len;_i4++){var group=groups[_i4];var groupItems=group.items;for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var subMenu=item.subMenu;if(subMenu){visitMenu(subMenu);}}}};visitMenu(this._rootMenu);}},{key:"_createMenuUI",value:function _createMenuUI(menu){var _this4=this;// Builds DOM elements for a menu
336
336
  var groups=menu.groups;var html=[];html.push('<div class="xeokit-context-menu '+menu.id+'" style="z-index:300000; position: absolute;">');html.push('<ul>');if(groups){for(var _i5=0,len=groups.length;_i5<len;_i5++){var group=groups[_i5];var groupIdx=_i5;var groupLen=len;var groupItems=group.items;if(groupItems){for(var j=0,lenj=groupItems.length;j<lenj;j++){var item=groupItems[j];var itemSubMenu=item.subMenu;var actionTitle=item.title||"";if(itemSubMenu){html.push('<li id="'+item.id+'" class="xeokit-context-menu-item" style="'+(groupIdx===groupLen-1||j<lenj-1?'border-bottom: 0':'border-bottom: 1px solid black')+'">'+actionTitle+' [MORE]'+'</li>');}else{html.push('<li id="'+item.id+'" class="xeokit-context-menu-item" style="'+(groupIdx===groupLen-1||j<lenj-1?'border-bottom: 0':'border-bottom: 1px solid black')+'">'+actionTitle+'</li>');}}}}}html.push('</ul>');html.push('</div>');var htmlString=html.join("");document.body.insertAdjacentHTML('beforeend',htmlString);var menuElement=document.querySelector("."+menu.id);menu.menuElement=menuElement;menuElement.style["border-radius"]=4+"px";menuElement.style.display='none';menuElement.style["z-index"]=300000;menuElement.style.background="white";menuElement.style.border="1px solid black";menuElement.style["box-shadow"]="0 4px 5px 0 gray";menuElement.oncontextmenu=function(e){e.preventDefault();};// Bind event handlers
@@ -2405,7 +2405,7 @@ _this7._onEntityModelDestroyed=null;});}else{this._onEntityDestroyed=this._entit
2405
2405
  */},{key:"visible",get:function get(){return!!this._visible;}/**
2406
2406
  * Destroys this Marker.
2407
2407
  */},{key:"destroy",value:function destroy(){this.fire("destroyed",true);this.scene.camera.off(this._onCameraViewMatrix);this.scene.camera.off(this._onCameraProjMatrix);if(this._entity){if(this._onEntityDestroyed!==null){this._entity.off(this._onEntityDestroyed);}if(this._onEntityModelDestroyed!==null){this._entity.model.off(this._onEntityModelDestroyed);}}this._renderer.removeMarker(this);_get(_getPrototypeOf(Marker.prototype),"destroy",this).call(this);}}]);return Marker;}(Component);/** @private */var Wire=/*#__PURE__*/function(){function Wire(parentElement){var _this8=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Wire);this._color=cfg.color||"black";this._highlightClass="viewer-ruler-wire-highlighted";this._wire=document.createElement('div');this._wire.className+=this._wire.className?' viewer-ruler-wire':'viewer-ruler-wire';this._wireClickable=document.createElement('div');this._wireClickable.className+=this._wireClickable.className?' viewer-ruler-wire-clickable':'viewer-ruler-wire-clickable';this._thickness=cfg.thickness||1.0;this._thicknessClickable=cfg.thicknessClickable||6.0;var wire=this._wire;var wireStyle=wire.style;wireStyle.border="solid "+this._thickness+"px "+this._color;wireStyle.position="absolute";wireStyle["z-index"]=cfg.zIndex===undefined?"2000001":cfg.zIndex;wireStyle.width=0+"px";wireStyle.height=0+"px";wireStyle.visibility="visible";wireStyle.top=0+"px";wireStyle.left=0+"px";wireStyle['-webkit-transform-origin']="0 0";wireStyle['-moz-transform-origin']="0 0";wireStyle['-ms-transform-origin']="0 0";wireStyle['-o-transform-origin']="0 0";wireStyle['transform-origin']="0 0";wireStyle['-webkit-transform']='rotate(0deg)';wireStyle['-moz-transform']='rotate(0deg)';wireStyle['-ms-transform']='rotate(0deg)';wireStyle['-o-transform']='rotate(0deg)';wireStyle['transform']='rotate(0deg)';wireStyle["opacity"]=1.0;wireStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wire);var wireClickable=this._wireClickable;var wireClickableStyle=wireClickable.style;wireClickableStyle.border="solid "+this._thicknessClickable+"px "+this._color;wireClickableStyle.position="absolute";wireClickableStyle["z-index"]=cfg.zIndex===undefined?"2000002":cfg.zIndex+1;wireClickableStyle.width=0+"px";wireClickableStyle.height=0+"px";wireClickableStyle.visibility="visible";wireClickableStyle.top=0+"px";wireClickableStyle.left=0+"px";// wireClickableStyle["pointer-events"] = "none";
2408
- wireClickableStyle['-webkit-transform-origin']="0 0";wireClickableStyle['-moz-transform-origin']="0 0";wireClickableStyle['-ms-transform-origin']="0 0";wireClickableStyle['-o-transform-origin']="0 0";wireClickableStyle['transform-origin']="0 0";wireClickableStyle['-webkit-transform']='rotate(0deg)';wireClickableStyle['-moz-transform']='rotate(0deg)';wireClickableStyle['-ms-transform']='rotate(0deg)';wireClickableStyle['-o-transform']='rotate(0deg)';wireClickableStyle['transform']='rotate(0deg)';wireClickableStyle["opacity"]=0.0;wireClickableStyle["pointer-events"]="all";if(cfg.onContextMenu);parentElement.appendChild(wireClickable);if(cfg.onMouseOver){wireClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this8);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this8);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this8);});}if(cfg.onContextMenu){wireClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this8);event.preventDefault();});}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_createClass(Wire,[{key:"_visible",get:function get(){return this._wire.style.visibility==="visible";}},{key:"_update",value:function _update(){var length=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2)));var angle=Math.atan2(this._y2-this._y1,this._x2-this._x1)*180.0/Math.PI;var wireStyle=this._wire.style;wireStyle["width"]=Math.round(length)+'px';wireStyle["left"]=Math.round(this._x1)+'px';wireStyle["top"]=Math.round(this._y1)+'px';wireStyle['-webkit-transform']='rotate('+angle+'deg)';wireStyle['-moz-transform']='rotate('+angle+'deg)';wireStyle['-ms-transform']='rotate('+angle+'deg)';wireStyle['-o-transform']='rotate('+angle+'deg)';wireStyle['transform']='rotate('+angle+'deg)';var wireClickableStyle=this._wireClickable.style;wireClickableStyle["width"]=Math.round(length)+'px';wireClickableStyle["left"]=Math.round(this._x1)+'px';wireClickableStyle["top"]=Math.round(this._y1)+'px';wireClickableStyle['-webkit-transform']='rotate('+angle+'deg)';wireClickableStyle['-moz-transform']='rotate('+angle+'deg)';wireClickableStyle['-ms-transform']='rotate('+angle+'deg)';wireClickableStyle['-o-transform']='rotate('+angle+'deg)';wireClickableStyle['transform']='rotate('+angle+'deg)';}},{key:"setStartAndEnd",value:function setStartAndEnd(x1,y1,x2,y2){this._x1=x1;this._y1=y1;this._x2=x2;this._y2=y2;this._update();}},{key:"setColor",value:function setColor(color){this._color=color||"black";this._wire.style.border="solid "+this._thickness+"px "+this._color;}},{key:"setOpacity",value:function setOpacity(opacity){this._wire.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){visible=!!visible;if(this._visible===visible){return;}this._wire.style.visibility=visible?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._wireClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._wire.classList.add(this._highlightClass);}else{this._wire.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(visible){this._wire.parentElement.removeChild(this._wire);this._wireClickable.parentElement.removeChild(this._wireClickable);}}]);return Wire;}();/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this9=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Dot);this._highlightClass="viewer-ruler-dot-highlighted";this._x=0;this._y=0;this._visible=true;this._dot=document.createElement('div');this._dot.className+=this._dot.className?' viewer-ruler-dot':'viewer-ruler-dot';this._dotClickable=document.createElement('div');this._dotClickable.className+=this._dotClickable.className?' viewer-ruler-dot-clickable':'viewer-ruler-dot-clickable';var dot=this._dot;var dotStyle=dot.style;dotStyle["border-radius"]=25+"px";dotStyle.border="solid 2px white";dotStyle.background="lightgreen";dotStyle.position="absolute";dotStyle["z-index"]=cfg.zIndex===undefined?"40000005":cfg.zIndex;dotStyle.width=8+"px";dotStyle.height=8+"px";dotStyle.visibility=cfg.visible!==false?"visible":"hidden";dotStyle.top=0+"px";dotStyle.left=0+"px";dotStyle["box-shadow"]="0 2px 5px 0 #182A3D;";dotStyle["opacity"]=1.0;dotStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dot);var dotClickable=this._dotClickable;var dotClickableStyle=dotClickable.style;dotClickableStyle["border-radius"]=35+"px";dotClickableStyle.border="solid 10px white";dotClickableStyle.position="absolute";dotClickableStyle["z-index"]=cfg.zIndex===undefined?"40000007":cfg.zIndex+1;dotClickableStyle.width=8+"px";dotClickableStyle.height=8+"px";dotClickableStyle.visibility="visible";dotClickableStyle.top=0+"px";dotClickableStyle.left=0+"px";dotClickableStyle["opacity"]=0.0;dotClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dotClickable);if(cfg.onMouseOver){dotClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this9);});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this9);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this9);});}if(cfg.onContextMenu){dotClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this9);event.preventDefault();});}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_createClass(Dot,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var dotStyle=this._dot.style;dotStyle["left"]=Math.round(x)-4+'px';dotStyle["top"]=Math.round(y)-4+'px';var dotClickableStyle=this._dotClickable.style;dotClickableStyle["left"]=Math.round(x)-9+'px';dotClickableStyle["top"]=Math.round(y)-9+'px';}},{key:"setFillColor",value:function setFillColor(color){this._dot.style.background=color||"lightgreen";}},{key:"setBorderColor",value:function setBorderColor(color){this._dot.style.border="solid 2px"+(color||"black");}},{key:"setOpacity",value:function setOpacity(opacity){this._dot.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._dot.style.visibility=this._visible?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._dotClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._dot.classList.add(this._highlightClass);}else{this._dot.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(){this.setVisible(false);this._dot.parentElement.removeChild(this._dot);this._dotClickable.parentElement.removeChild(this._dotClickable);}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this10=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement('div');this._label.className+=this._label.className?' viewer-ruler-label':'viewer-ruler-label';var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this10);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this10);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this10);});}if(cfg.onContextMenu){label.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this10);event.preventDefault();});}}_createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"black";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=!!clickable?"all":"none";}},{key:"destroy",value:function destroy(){this._label.parentElement.removeChild(this._label);}}]);return Label;}();var originVec=math.vec3();var targetVec=math.vec3();/**
2408
+ wireClickableStyle['-webkit-transform-origin']="0 0";wireClickableStyle['-moz-transform-origin']="0 0";wireClickableStyle['-ms-transform-origin']="0 0";wireClickableStyle['-o-transform-origin']="0 0";wireClickableStyle['transform-origin']="0 0";wireClickableStyle['-webkit-transform']='rotate(0deg)';wireClickableStyle['-moz-transform']='rotate(0deg)';wireClickableStyle['-ms-transform']='rotate(0deg)';wireClickableStyle['-o-transform']='rotate(0deg)';wireClickableStyle['transform']='rotate(0deg)';wireClickableStyle["opacity"]=0.0;wireClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(wireClickable);if(cfg.onMouseOver){wireClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this8);});}if(cfg.onMouseLeave){wireClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this8);});}if(cfg.onMouseWheel){wireClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this8);});}if(cfg.onContextMenu){wireClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this8);event.preventDefault();});}this._x1=0;this._y1=0;this._x2=0;this._y2=0;this._update();}_createClass(Wire,[{key:"_visible",get:function get(){return this._wire.style.visibility==="visible";}},{key:"_update",value:function _update(){var length=Math.abs(Math.sqrt((this._x1-this._x2)*(this._x1-this._x2)+(this._y1-this._y2)*(this._y1-this._y2)));var angle=Math.atan2(this._y2-this._y1,this._x2-this._x1)*180.0/Math.PI;var wireStyle=this._wire.style;wireStyle["width"]=Math.round(length)+'px';wireStyle["left"]=Math.round(this._x1)+'px';wireStyle["top"]=Math.round(this._y1)+'px';wireStyle['-webkit-transform']='rotate('+angle+'deg)';wireStyle['-moz-transform']='rotate('+angle+'deg)';wireStyle['-ms-transform']='rotate('+angle+'deg)';wireStyle['-o-transform']='rotate('+angle+'deg)';wireStyle['transform']='rotate('+angle+'deg)';var wireClickableStyle=this._wireClickable.style;wireClickableStyle["width"]=Math.round(length)+'px';wireClickableStyle["left"]=Math.round(this._x1)+'px';wireClickableStyle["top"]=Math.round(this._y1)+'px';wireClickableStyle['-webkit-transform']='rotate('+angle+'deg)';wireClickableStyle['-moz-transform']='rotate('+angle+'deg)';wireClickableStyle['-ms-transform']='rotate('+angle+'deg)';wireClickableStyle['-o-transform']='rotate('+angle+'deg)';wireClickableStyle['transform']='rotate('+angle+'deg)';}},{key:"setStartAndEnd",value:function setStartAndEnd(x1,y1,x2,y2){this._x1=x1;this._y1=y1;this._x2=x2;this._y2=y2;this._update();}},{key:"setColor",value:function setColor(color){this._color=color||"black";this._wire.style.border="solid "+this._thickness+"px "+this._color;}},{key:"setOpacity",value:function setOpacity(opacity){this._wire.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){visible=!!visible;if(this._visible===visible){return;}this._wire.style.visibility=visible?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._wireClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._wire.classList.add(this._highlightClass);}else{this._wire.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(visible){if(this._wire.parentElement){this._wire.parentElement.removeChild(this._wire);}if(this._wireClickable.parentElement){this._wireClickable.parentElement.removeChild(this._wireClickable);}}}]);return Wire;}();/** @private */var Dot=/*#__PURE__*/function(){function Dot(parentElement){var _this9=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Dot);this._highlightClass="viewer-ruler-dot-highlighted";this._x=0;this._y=0;this._visible=true;this._dot=document.createElement('div');this._dot.className+=this._dot.className?' viewer-ruler-dot':'viewer-ruler-dot';this._dotClickable=document.createElement('div');this._dotClickable.className+=this._dotClickable.className?' viewer-ruler-dot-clickable':'viewer-ruler-dot-clickable';var dot=this._dot;var dotStyle=dot.style;dotStyle["border-radius"]=25+"px";dotStyle.border="solid 2px white";dotStyle.background="lightgreen";dotStyle.position="absolute";dotStyle["z-index"]=cfg.zIndex===undefined?"40000005":cfg.zIndex;dotStyle.width=8+"px";dotStyle.height=8+"px";dotStyle.visibility=cfg.visible!==false?"visible":"hidden";dotStyle.top=0+"px";dotStyle.left=0+"px";dotStyle["box-shadow"]="0 2px 5px 0 #182A3D;";dotStyle["opacity"]=1.0;dotStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dot);var dotClickable=this._dotClickable;var dotClickableStyle=dotClickable.style;dotClickableStyle["border-radius"]=35+"px";dotClickableStyle.border="solid 10px white";dotClickableStyle.position="absolute";dotClickableStyle["z-index"]=cfg.zIndex===undefined?"40000007":cfg.zIndex+1;dotClickableStyle.width=8+"px";dotClickableStyle.height=8+"px";dotClickableStyle.visibility="visible";dotClickableStyle.top=0+"px";dotClickableStyle.left=0+"px";dotClickableStyle["opacity"]=0.0;dotClickableStyle["pointer-events"]="none";if(cfg.onContextMenu);parentElement.appendChild(dotClickable);if(cfg.onMouseOver){dotClickable.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this9);});}if(cfg.onMouseLeave){dotClickable.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this9);});}if(cfg.onMouseWheel){dotClickable.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this9);});}if(cfg.onContextMenu){dotClickable.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this9);event.preventDefault();});}this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.borderColor);}_createClass(Dot,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var dotStyle=this._dot.style;dotStyle["left"]=Math.round(x)-4+'px';dotStyle["top"]=Math.round(y)-4+'px';var dotClickableStyle=this._dotClickable.style;dotClickableStyle["left"]=Math.round(x)-9+'px';dotClickableStyle["top"]=Math.round(y)-9+'px';}},{key:"setFillColor",value:function setFillColor(color){this._dot.style.background=color||"lightgreen";}},{key:"setBorderColor",value:function setBorderColor(color){this._dot.style.border="solid 2px"+(color||"black");}},{key:"setOpacity",value:function setOpacity(opacity){this._dot.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._dot.style.visibility=this._visible?"visible":"hidden";}},{key:"setClickable",value:function setClickable(clickable){this._dotClickable.style["pointer-events"]=!!clickable?"all":"none";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._dot.classList.add(this._highlightClass);}else{this._dot.classList.remove(this._highlightClass);}}},{key:"destroy",value:function destroy(){this.setVisible(false);if(this._dot.parentElement){this._dot.parentElement.removeChild(this._dot);}if(this._dotClickable.parentElement){this._dotClickable.parentElement.removeChild(this._dotClickable);}}}]);return Dot;}();/** @private */var Label=/*#__PURE__*/function(){function Label(parentElement){var _this10=this;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Label);this._highlightClass="viewer-ruler-label-highlighted";this._prefix=cfg.prefix||"";this._x=0;this._y=0;this._visible=true;this._culled=false;this._label=document.createElement('div');this._label.className+=this._label.className?' viewer-ruler-label':'viewer-ruler-label';var label=this._label;var style=label.style;style["border-radius"]=5+"px";style.color="white";style.padding="4px";style.border="solid 1px";style.background="lightgreen";style.position="absolute";style["z-index"]=cfg.zIndex===undefined?"5000005":cfg.zIndex;style.width="auto";style.height="auto";style.visibility="visible";style.top=0+"px";style.left=0+"px";style["pointer-events"]="all";style["opacity"]=1.0;if(cfg.onContextMenu);label.innerText="";parentElement.appendChild(label);this.setPos(cfg.x||0,cfg.y||0);this.setFillColor(cfg.fillColor);this.setBorderColor(cfg.fillColor);this.setText(cfg.text);if(cfg.onMouseOver){label.addEventListener('mouseover',function(event){cfg.onMouseOver(event,_this10);event.preventDefault();});}if(cfg.onMouseLeave){label.addEventListener('mouseleave',function(event){cfg.onMouseLeave(event,_this10);event.preventDefault();});}if(cfg.onMouseWheel){label.addEventListener('wheel',function(event){cfg.onMouseWheel(event,_this10);});}if(cfg.onContextMenu){label.addEventListener('contextmenu',function(event){cfg.onContextMenu(event,_this10);event.preventDefault();});}}_createClass(Label,[{key:"setPos",value:function setPos(x,y){this._x=x;this._y=y;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosOnWire",value:function setPosOnWire(x1,y1,x2,y2){var x=x1+(x2-x1)*0.5;var y=y1+(y2-y1)*0.5;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setPosBetweenWires",value:function setPosBetweenWires(x1,y1,x2,y2,x3,y3){var x=(x1+x2+x3)/3;var y=(y1+y2+y3)/3;var style=this._label.style;style["left"]=Math.round(x)-20+'px';style["top"]=Math.round(y)-12+'px';}},{key:"setText",value:function setText(text){this._label.innerHTML=this._prefix+(text||"");}},{key:"setFillColor",value:function setFillColor(color){this._fillColor=color||"lightgreen";this._label.style.background=this._fillColor;}},{key:"setBorderColor",value:function setBorderColor(color){this._borderColor=color||"black";this._label.style.border="solid 1px "+this._borderColor;}},{key:"setOpacity",value:function setOpacity(opacity){this._label.style.opacity=opacity;}},{key:"setVisible",value:function setVisible(visible){if(this._visible===visible){return;}this._visible=!!visible;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setCulled",value:function setCulled(culled){if(this._culled===culled){return;}this._culled=!!culled;this._label.style.visibility=this._visible&&!this._culled?"visible":"hidden";}},{key:"setHighlighted",value:function setHighlighted(highlighted){if(this._highlighted===highlighted){return;}this._highlighted=!!highlighted;if(this._highlighted){this._label.classList.add(this._highlightClass);}else{this._label.classList.remove(this._highlightClass);}}},{key:"setClickable",value:function setClickable(clickable){this._label.style["pointer-events"]=!!clickable?"all":"none";}},{key:"destroy",value:function destroy(){if(this._label.parentElement){this._label.parentElement.removeChild(this._label);}}}]);return Label;}();var originVec=math.vec3();var targetVec=math.vec3();/**
2409
2409
  * @desc Measures the angle indicated by three 3D points.
2410
2410
  *
2411
2411
  * See {@link AngleMeasurementsPlugin} for more info.
@@ -2414,7 +2414,7 @@ wireClickableStyle['-webkit-transform-origin']="0 0";wireClickableStyle['-moz-tr
2414
2414
  */function AngleMeasurement(plugin){var _this11;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurement);_this11=_super2.call(this,plugin.viewer.scene,cfg);/**
2415
2415
  * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurement.
2416
2416
  * @type {AngleMeasurementsPlugin}
2417
- */_this11.plugin=plugin;_this11._container=cfg.container;if(!_this11._container){throw"config missing: container";}_this11._color=cfg.color||plugin.defaultColor;var scene=_this11.plugin.viewer.scene;_this11._originMarker=new Marker(scene,cfg.origin);_this11._cornerMarker=new Marker(scene,cfg.corner);_this11._targetMarker=new Marker(scene,cfg.target);_this11._originWorld=math.vec3();_this11._cornerWorld=math.vec3();_this11._targetWorld=math.vec3();_this11._wp=new Float64Array(12);_this11._vp=new Float64Array(12);_this11._pp=new Float64Array(12);_this11._cp=new Int16Array(6);var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this11));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this11));}:null;var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this11));}:null;_this11._originDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._cornerDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._targetDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._originWire=new Wire(_this11._container,{color:_this11._color||"blue",thickness:1,zIndex:plugin.zIndex,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._targetWire=new Wire(_this11._container,{color:_this11._color||"red",thickness:1,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._angleLabel=new Label(_this11._container,{fillColor:_this11._color||"#00BBFF",prefix:"",text:"",zIndex:plugin.zIndex+2,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onContextMenu:onContextMenu});_this11._wpDirty=false;_this11._vpDirty=false;_this11._cpDirty=false;_this11._visible=false;_this11._originVisible=false;_this11._cornerVisible=false;_this11._targetVisible=false;_this11._originWireVisible=false;_this11._targetWireVisible=false;_this11._angleVisible=false;_this11._labelsVisible=false;_this11._clickable=false;_this11._originMarker.on("worldPos",function(value){_this11._originWorld.set(value||[0,0,0]);_this11._wpDirty=true;_this11._needUpdate(0);// No lag
2417
+ */_this11.plugin=plugin;_this11._container=cfg.container;if(!_this11._container){throw"config missing: container";}_this11._color=cfg.color||plugin.defaultColor;var scene=_this11.plugin.viewer.scene;_this11._originMarker=new Marker(scene,cfg.origin);_this11._cornerMarker=new Marker(scene,cfg.corner);_this11._targetMarker=new Marker(scene,cfg.target);_this11._originWorld=math.vec3();_this11._cornerWorld=math.vec3();_this11._targetWorld=math.vec3();_this11._wp=new Float64Array(12);_this11._vp=new Float64Array(12);_this11._pp=new Float64Array(12);_this11._cp=new Int16Array(6);var onMouseOver=cfg.onMouseOver?function(event){cfg.onMouseOver(event,_assertThisInitialized(_this11));}:null;var onMouseLeave=cfg.onMouseLeave?function(event){cfg.onMouseLeave(event,_assertThisInitialized(_this11));}:null;var onContextMenu=cfg.onContextMenu?function(event){cfg.onContextMenu(event,_assertThisInitialized(_this11));}:null;var onMouseWheel=function onMouseWheel(event){_this11.plugin.viewer.scene.canvas.canvas.dispatchEvent(new WheelEvent('wheel',event));};_this11._originDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._cornerDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._targetDot=new Dot(_this11._container,{fillColor:_this11._color,zIndex:plugin.zIndex!==undefined?plugin.zIndex+2:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._originWire=new Wire(_this11._container,{color:_this11._color||"blue",thickness:1,zIndex:plugin.zIndex,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._targetWire=new Wire(_this11._container,{color:_this11._color||"red",thickness:1,zIndex:plugin.zIndex!==undefined?plugin.zIndex+1:undefined,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._angleLabel=new Label(_this11._container,{fillColor:_this11._color||"#00BBFF",prefix:"",text:"",zIndex:plugin.zIndex+2,onMouseOver:onMouseOver,onMouseLeave:onMouseLeave,onMouseWheel:onMouseWheel,onContextMenu:onContextMenu});_this11._wpDirty=false;_this11._vpDirty=false;_this11._cpDirty=false;_this11._visible=false;_this11._originVisible=false;_this11._cornerVisible=false;_this11._targetVisible=false;_this11._originWireVisible=false;_this11._targetWireVisible=false;_this11._angleVisible=false;_this11._labelsVisible=false;_this11._clickable=false;_this11._originMarker.on("worldPos",function(value){_this11._originWorld.set(value||[0,0,0]);_this11._wpDirty=true;_this11._needUpdate(0);// No lag
2418
2418
  });_this11._cornerMarker.on("worldPos",function(value){_this11._cornerWorld.set(value||[0,0,0]);_this11._wpDirty=true;_this11._needUpdate(0);// No lag
2419
2419
  });_this11._targetMarker.on("worldPos",function(value){_this11._targetWorld.set(value||[0,0,0]);_this11._wpDirty=true;_this11._needUpdate(0);// No lag
2420
2420
  });_this11._onViewMatrix=scene.camera.on("viewMatrix",function(){_this11._vpDirty=true;_this11._needUpdate(0);// No lag
@@ -6611,7 +6611,7 @@ math.triangleNormal(a,b,c,worldNormal);}gotIntersect=true;}}}if(gotIntersect&&wo
6611
6611
  * @param {Scene} scene
6612
6612
  * @param {LodCullingManager} cullingManager
6613
6613
  */function attachFPSTracker(scene,cullingManager){if(!_attachedFPSTracker){_attachedFPSTracker=true;var MAX_NUM_TICKS=4;var tickTimeArray=new Array(MAX_NUM_TICKS);var numTick=0;var currentFPS=-1;var preRenderTime=Date.now();var deltaTime=0;// Apply LOD-culling before rendering the scene
6614
- scene.on("rendering",function(){if(currentFPS==-1){return;}// Call LOD-culling tasks
6614
+ scene.on("rendering",function(){if(currentFPS===-1){return;}// Call LOD-culling tasks
6615
6615
  for(var _i132=0,len=_fpsTrackingManagers.length;_i132<len;_i132++){_fpsTrackingManagers[_i132].applyLodCulling(currentFPS);}});// Once the scene has dispached the GL draw* commands, the rendering will
6616
6616
  // happen in asynchornous mode.
6617
6617
  // A way to measure the frame-rate, is the time that passes:
@@ -6681,7 +6681,7 @@ for(var _i134=0,len=_fpsTrackingManagers.length;_i134<len;_i134++){_fpsTrackingM
6681
6681
  * @type {number}
6682
6682
  */this.consecutiveFramesWithoutTargetFps=0;}/**
6683
6683
  * @param {DataTextureSceneModel} model
6684
- */_createClass(LodState,[{key:"initializeLodState",value:function initializeLodState(model){if(model._nodeList.length==0){return;}// const LOD_LEVELS = [ 2000, 600, 150, 80, 20 ];
6684
+ */_createClass(LodState,[{key:"initializeLodState",value:function initializeLodState(model){if(model._nodeList.length===0){return;}// const LOD_LEVELS = [ 2000, 600, 150, 80, 20 ];
6685
6685
  // const LOD_RESTORE_TIME = 600;
6686
6686
  // const LOD_TARGET_FPS = 20;
6687
6687
  var nodeList=model._nodeList;var nodesInLOD={};var triangleCountInLOD={};for(var _i135=0,len=nodeList.length;_i135<len;_i135++){var _node=nodeList[_i135];var lodLevel=void 0,_len28=void 0;for(lodLevel=0,_len28=this.triangleLODLevels.length;lodLevel<_len28;lodLevel++){if(_node.numTriangles>=this.triangleLODLevels[lodLevel]){break;}}var lodPolys=this.triangleLODLevels[lodLevel]||0;if(!(lodPolys in nodesInLOD)){nodesInLOD[lodPolys]=[];}nodesInLOD[lodPolys].push(_node);if(!(lodPolys in triangleCountInLOD)){triangleCountInLOD[lodPolys]=0;}triangleCountInLOD[lodPolys]+=_node.numTriangles;}this.nodesInLOD=nodesInLOD;this.triangleCountInLOD=triangleCountInLOD;}}]);return LodState;}();var LodCullingManager=/*#__PURE__*/function(){/**
@@ -6692,15 +6692,17 @@ var nodeList=model._nodeList;var nodesInLOD={};var triangleCountInLOD={};for(var
6692
6692
  * @type {DataTextureSceneModel}
6693
6693
  */this.model=model;/**
6694
6694
  * @private
6695
- */this.lodState=new LodState(lodLevels,targetFps);console.time("initializeLodState");this.lodState.initializeLodState(model);console.timeEnd("initializeLodState");attachFPSTracker(this.model.scene,this);}/**
6695
+ */this.lodState=new LodState(lodLevels,targetFps);// console.time ("initializeLodState");
6696
+ this.lodState.initializeLodState(model);// console.timeEnd ("initializeLodState");
6697
+ attachFPSTracker(this.model.scene,this);}/**
6696
6698
  * Cull any objects belonging to the current `LOD` level, and increase the `LOD` level.
6697
6699
  *
6698
6700
  * @private
6699
- */_createClass(LodCullingManager,[{key:"_increaseLODLevelIndex",value:function _increaseLODLevelIndex(){var lodState=this.lodState;if(lodState.lodLevelIndex==lodState.triangleLODLevels.length){return false;}var nodesInLOD=lodState.nodesInLOD[lodState.triangleLODLevels[lodState.lodLevelIndex]]||[];for(var _i136=0,len=nodesInLOD.length;_i136<len;_i136++){nodesInLOD[_i136].culledLOD=true;}lodState.lodLevelIndex++;return true;}/**
6701
+ */_createClass(LodCullingManager,[{key:"_increaseLODLevelIndex",value:function _increaseLODLevelIndex(){var lodState=this.lodState;if(lodState.lodLevelIndex===lodState.triangleLODLevels.length){return false;}var nodesInLOD=lodState.nodesInLOD[lodState.triangleLODLevels[lodState.lodLevelIndex]]||[];for(var _i136=0,len=nodesInLOD.length;_i136<len;_i136++){nodesInLOD[_i136].culledLOD=true;}lodState.lodLevelIndex++;return true;}/**
6700
6702
  * Un-cull any objects belonging to the current `LOD` level, and decrease the `LOD` level.
6701
6703
  *
6702
6704
  * @private
6703
- */},{key:"_decreaseLODLevelIndex",value:function _decreaseLODLevelIndex(){var lodState=this.lodState;if(lodState.lodLevelIndex==0){return false;}var nodesInLOD=lodState.nodesInLOD[lodState.triangleLODLevels[lodState.lodLevelIndex-1]]||[];for(var _i137=0,len=nodesInLOD.length;_i137<len;_i137++){nodesInLOD[_i137].culledLOD=false;}lodState.lodLevelIndex--;return true;}/**
6705
+ */},{key:"_decreaseLODLevelIndex",value:function _decreaseLODLevelIndex(){var lodState=this.lodState;if(lodState.lodLevelIndex===0){return false;}var nodesInLOD=lodState.nodesInLOD[lodState.triangleLODLevels[lodState.lodLevelIndex-1]]||[];for(var _i137=0,len=nodesInLOD.length;_i137<len;_i137++){nodesInLOD[_i137].culledLOD=false;}lodState.lodLevelIndex--;return true;}/**
6704
6706
  * Apply LOD culling.
6705
6707
  *
6706
6708
  * Will update LOD level, if needed, based in...
@@ -6711,7 +6713,13 @@ var nodeList=model._nodeList;var nodesInLOD={};var triangleCountInLOD={};for(var
6711
6713
  *
6712
6714
  * @param {number} currentFPS The current FPS (frames per second)
6713
6715
  * @returns {boolean} Whether the LOD level was changed. This is, if some object was culled/unculled
6714
- */},{key:"applyLodCulling",value:function applyLodCulling(currentFPS){var lodState=this.lodState;this.model;var retVal=false;if(currentFPS<lodState.targetFps){if(++lodState.consecutiveFramesWithoutTargetFps>0){lodState.consecutiveFramesWithoutTargetFps=0;retVal=this._increaseLODLevelIndex();}}else if(currentFPS>lodState.targetFps+4){if(++lodState.consecutiveFramesWithTargetFps>1){lodState.consecutiveFramesWithTargetFps=0;retVal=this._decreaseLODLevelIndex();}}if(retVal){console.log("LOD level = "+lodState.lodLevelIndex);}return retVal;}},{key:"resetLodCulling",value:function resetLodCulling(){this.model;var retVal=false;var decreasedLevel=false;do{retVal|=decreasedLevel=this._decreaseLODLevelIndex();}while(decreasedLevel);if(retVal){console.log("LOD resetted");}return retVal;}}]);return LodCullingManager;}();var module$1={};var exports$1={};(function(f){if(_typeof(exports$1)==="object"&&typeof module$1!=="undefined"){module$1.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.RBush3D=f();}})(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof require&&require,i=0;i<t.length;i++){o(t[i]);}return o;}return r;}()({1:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:true});var quickselect=require('quickselect');var nodePool=[];var freeNode=function freeNode(node){return nodePool.push(node);};var freeAllNode=function freeAllNode(node){if(node){freeNode(node);if(!isLeaf(node)){node.children.forEach(freeAllNode);}}};var allowNode=function allowNode(children){var node=nodePool.pop();if(node){node.children=children;node.height=1;node.leaf=true;node.minX=Infinity;node.minY=Infinity;node.minZ=Infinity;node.maxX=-Infinity;node.maxY=-Infinity;node.maxZ=-Infinity;}else{node={children:children,height:1,leaf:true,minX:Infinity,minY:Infinity,minZ:Infinity,maxX:-Infinity,maxY:-Infinity,maxZ:-Infinity};}return node;};var distNodePool=[];var freeDistNode=function freeDistNode(node){return distNodePool.push(node);};var allowDistNode=function allowDistNode(dist,node){var heapNode=distNodePool.pop();if(heapNode){heapNode.dist=dist;heapNode.node=node;}else{heapNode={dist:dist,node:node};}return heapNode;};var isLeaf=function isLeaf(node){return node.leaf;};var isLeafChild=function isLeafChild(node,child){return node.leaf;};var findItem=function findItem(item,items,equalsFn){if(!equalsFn)return items.indexOf(item);for(var i=0;i<items.length;i++){if(equalsFn(item,items[i]))return i;}return-1;};var calcBBox=function calcBBox(node){distBBox(node,0,node.children.length,node);};var distBBox=function distBBox(node,k,p,destNode){var dNode=destNode;if(dNode){dNode.minX=Infinity;dNode.minY=Infinity;dNode.minZ=Infinity;dNode.maxX=-Infinity;dNode.maxY=-Infinity;dNode.maxZ=-Infinity;}else{dNode=allowNode([]);}for(var i=k,child=void 0;i<p;i++){child=node.children[i];extend(dNode,child);}return dNode;};var extend=function extend(a,b){a.minX=Math.min(a.minX,b.minX);a.minY=Math.min(a.minY,b.minY);a.minZ=Math.min(a.minZ,b.minZ);a.maxX=Math.max(a.maxX,b.maxX);a.maxY=Math.max(a.maxY,b.maxY);a.maxZ=Math.max(a.maxZ,b.maxZ);return a;};var bboxVolume=function bboxVolume(a){return(a.maxX-a.minX)*(a.maxY-a.minY)*(a.maxZ-a.minZ);};var bboxMargin=function bboxMargin(a){return a.maxX-a.minX+(a.maxY-a.minY)+(a.maxZ-a.minZ);};var enlargedVolume=function enlargedVolume(a,b){var minX=Math.min(a.minX,b.minX),minY=Math.min(a.minY,b.minY),minZ=Math.min(a.minZ,b.minZ),maxX=Math.max(a.maxX,b.maxX),maxY=Math.max(a.maxY,b.maxY),maxZ=Math.max(a.maxZ,b.maxZ);return(maxX-minX)*(maxY-minY)*(maxZ-minZ);};var intersectionVolume=function intersectionVolume(a,b){var minX=Math.max(a.minX,b.minX),minY=Math.max(a.minY,b.minY),minZ=Math.max(a.minZ,b.minZ),maxX=Math.min(a.maxX,b.maxX),maxY=Math.min(a.maxY,b.maxY),maxZ=Math.min(a.maxZ,b.maxZ);return Math.max(0,maxX-minX)*Math.max(0,maxY-minY)*Math.max(0,maxZ-minZ);};var contains=function contains(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&a.minZ<=b.minZ&&b.maxX<=a.maxX&&b.maxY<=a.maxY&&b.maxZ<=a.maxZ;};exports.intersects=function(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.minZ<=a.maxZ&&b.maxX>=a.minX&&b.maxY>=a.minY&&b.maxZ>=a.minZ;};exports.boxRayIntersects=function(box,ox,oy,oz,idx,idy,idz){var tx0=(box.minX-ox)*idx;var tx1=(box.maxX-ox)*idx;var ty0=(box.minY-oy)*idy;var ty1=(box.maxY-oy)*idy;var tz0=(box.minZ-oz)*idz;var tz1=(box.maxZ-oz)*idz;var z0=Math.min(tz0,tz1);var z1=Math.max(tz0,tz1);var y0=Math.min(ty0,ty1);var y1=Math.max(ty0,ty1);var x0=Math.min(tx0,tx1);var x1=Math.max(tx0,tx1);var tmin=Math.max(0,x0,y0,z0);var tmax=Math.min(x1,y1,z1);return tmax>=tmin?tmin:Infinity;};var multiSelect=function multiSelect(arr,left,right,n,compare){var stack=[left,right];var mid;while(stack.length){right=stack.pop();left=stack.pop();if(right-left<=n)continue;mid=left+Math.ceil((right-left)/n/2)*n;quickselect(arr,mid,left,right,compare);stack.push(left,mid,mid,right);}};var compareMinX=function compareMinX(a,b){return a.minX-b.minX;};var compareMinY=function compareMinY(a,b){return a.minY-b.minY;};var compareMinZ=function compareMinZ(a,b){return a.minZ-b.minZ;};var RBush3D=function(){function RBush3D(maxEntries){if(maxEntries===void 0){maxEntries=16;}this.maxEntries=Math.max(maxEntries,8);this.minEntries=Math.max(4,Math.ceil(this.maxEntries*0.4));this.clear();}RBush3D.alloc=function(){return this.pool.pop()||new this();};RBush3D.free=function(rbush){rbush.clear();this.pool.push(rbush);};// Start of chipmunk
6716
+ */},{key:"applyLodCulling",value:function applyLodCulling(currentFPS){var lodState=this.lodState;this.model;var retVal=false;if(currentFPS<lodState.targetFps){if(++lodState.consecutiveFramesWithoutTargetFps>0){lodState.consecutiveFramesWithoutTargetFps=0;retVal=this._increaseLODLevelIndex();}}else if(currentFPS>lodState.targetFps+4){if(++lodState.consecutiveFramesWithTargetFps>1){lodState.consecutiveFramesWithTargetFps=0;retVal=this._decreaseLODLevelIndex();}}// if (retVal) {
6717
+ // console.log ("LOD level = " + lodState.lodLevelIndex);
6718
+ // }
6719
+ return retVal;}},{key:"resetLodCulling",value:function resetLodCulling(){this.model;var retVal=false;var decreasedLevel=false;do{retVal|=decreasedLevel=this._decreaseLODLevelIndex();}while(decreasedLevel);// if (retVal) {
6720
+ // console.log ("LOD resetted");
6721
+ // }
6722
+ return retVal;}}]);return LodCullingManager;}();var module$1={};var exports$1={};(function(f){if(_typeof(exports$1)==="object"&&typeof module$1!=="undefined"){module$1.exports=f();}else if(typeof define==="function"&&define.amd){define([],f);}else{var g;if(typeof window!=="undefined"){g=window;}else if(typeof global!=="undefined"){g=global;}else if(typeof self!=="undefined"){g=self;}else{g=this;}g.RBush3D=f();}})(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a;}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r);},p,p.exports,r,e,n,t);}return n[i].exports;}for(var u="function"==typeof require&&require,i=0;i<t.length;i++){o(t[i]);}return o;}return r;}()({1:[function(require,module,exports){Object.defineProperty(exports,"__esModule",{value:true});var quickselect=require('quickselect');var nodePool=[];var freeNode=function freeNode(node){return nodePool.push(node);};var freeAllNode=function freeAllNode(node){if(node){freeNode(node);if(!isLeaf(node)){node.children.forEach(freeAllNode);}}};var allowNode=function allowNode(children){var node=nodePool.pop();if(node){node.children=children;node.height=1;node.leaf=true;node.minX=Infinity;node.minY=Infinity;node.minZ=Infinity;node.maxX=-Infinity;node.maxY=-Infinity;node.maxZ=-Infinity;}else{node={children:children,height:1,leaf:true,minX:Infinity,minY:Infinity,minZ:Infinity,maxX:-Infinity,maxY:-Infinity,maxZ:-Infinity};}return node;};var distNodePool=[];var freeDistNode=function freeDistNode(node){return distNodePool.push(node);};var allowDistNode=function allowDistNode(dist,node){var heapNode=distNodePool.pop();if(heapNode){heapNode.dist=dist;heapNode.node=node;}else{heapNode={dist:dist,node:node};}return heapNode;};var isLeaf=function isLeaf(node){return node.leaf;};var isLeafChild=function isLeafChild(node,child){return node.leaf;};var findItem=function findItem(item,items,equalsFn){if(!equalsFn)return items.indexOf(item);for(var i=0;i<items.length;i++){if(equalsFn(item,items[i]))return i;}return-1;};var calcBBox=function calcBBox(node){distBBox(node,0,node.children.length,node);};var distBBox=function distBBox(node,k,p,destNode){var dNode=destNode;if(dNode){dNode.minX=Infinity;dNode.minY=Infinity;dNode.minZ=Infinity;dNode.maxX=-Infinity;dNode.maxY=-Infinity;dNode.maxZ=-Infinity;}else{dNode=allowNode([]);}for(var i=k,child=void 0;i<p;i++){child=node.children[i];extend(dNode,child);}return dNode;};var extend=function extend(a,b){a.minX=Math.min(a.minX,b.minX);a.minY=Math.min(a.minY,b.minY);a.minZ=Math.min(a.minZ,b.minZ);a.maxX=Math.max(a.maxX,b.maxX);a.maxY=Math.max(a.maxY,b.maxY);a.maxZ=Math.max(a.maxZ,b.maxZ);return a;};var bboxVolume=function bboxVolume(a){return(a.maxX-a.minX)*(a.maxY-a.minY)*(a.maxZ-a.minZ);};var bboxMargin=function bboxMargin(a){return a.maxX-a.minX+(a.maxY-a.minY)+(a.maxZ-a.minZ);};var enlargedVolume=function enlargedVolume(a,b){var minX=Math.min(a.minX,b.minX),minY=Math.min(a.minY,b.minY),minZ=Math.min(a.minZ,b.minZ),maxX=Math.max(a.maxX,b.maxX),maxY=Math.max(a.maxY,b.maxY),maxZ=Math.max(a.maxZ,b.maxZ);return(maxX-minX)*(maxY-minY)*(maxZ-minZ);};var intersectionVolume=function intersectionVolume(a,b){var minX=Math.max(a.minX,b.minX),minY=Math.max(a.minY,b.minY),minZ=Math.max(a.minZ,b.minZ),maxX=Math.min(a.maxX,b.maxX),maxY=Math.min(a.maxY,b.maxY),maxZ=Math.min(a.maxZ,b.maxZ);return Math.max(0,maxX-minX)*Math.max(0,maxY-minY)*Math.max(0,maxZ-minZ);};var contains=function contains(a,b){return a.minX<=b.minX&&a.minY<=b.minY&&a.minZ<=b.minZ&&b.maxX<=a.maxX&&b.maxY<=a.maxY&&b.maxZ<=a.maxZ;};exports.intersects=function(a,b){return b.minX<=a.maxX&&b.minY<=a.maxY&&b.minZ<=a.maxZ&&b.maxX>=a.minX&&b.maxY>=a.minY&&b.maxZ>=a.minZ;};exports.boxRayIntersects=function(box,ox,oy,oz,idx,idy,idz){var tx0=(box.minX-ox)*idx;var tx1=(box.maxX-ox)*idx;var ty0=(box.minY-oy)*idy;var ty1=(box.maxY-oy)*idy;var tz0=(box.minZ-oz)*idz;var tz1=(box.maxZ-oz)*idz;var z0=Math.min(tz0,tz1);var z1=Math.max(tz0,tz1);var y0=Math.min(ty0,ty1);var y1=Math.max(ty0,ty1);var x0=Math.min(tx0,tx1);var x1=Math.max(tx0,tx1);var tmin=Math.max(0,x0,y0,z0);var tmax=Math.min(x1,y1,z1);return tmax>=tmin?tmin:Infinity;};var multiSelect=function multiSelect(arr,left,right,n,compare){var stack=[left,right];var mid;while(stack.length){right=stack.pop();left=stack.pop();if(right-left<=n)continue;mid=left+Math.ceil((right-left)/n/2)*n;quickselect(arr,mid,left,right,compare);stack.push(left,mid,mid,right);}};var compareMinX=function compareMinX(a,b){return a.minX-b.minX;};var compareMinY=function compareMinY(a,b){return a.minY-b.minY;};var compareMinZ=function compareMinZ(a,b){return a.minZ-b.minZ;};var RBush3D=function(){function RBush3D(maxEntries){if(maxEntries===void 0){maxEntries=16;}this.maxEntries=Math.max(maxEntries,8);this.minEntries=Math.max(4,Math.ceil(this.maxEntries*0.4));this.clear();}RBush3D.alloc=function(){return this.pool.pop()||new this();};RBush3D.free=function(rbush){rbush.clear();this.pool.push(rbush);};// Start of chipmunk
6715
6723
  RBush3D.prototype.searchCustom=function(customIntersects,customContains){var node=this.data;var result=[];if(!customIntersects(node,isLeafChild(node)))return result;var nodesToSearch=[];while(node){for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];if(customIntersects(child,isLeafChild(node))){if(isLeafChild(node))result.push(child);else if(customContains(child))this._all(child,result);else nodesToSearch.push(child);}}node=nodesToSearch.pop();}return result;};RBush3D.prototype.analyzeTriangles=function(node){if(node===undefined){node=this.data;}var totalTriangles=0;if(isLeaf(node)){for(var i=0,len=node.children.length;i<len;i++){totalTriangles+=node.children[i].numTriangles;}}else{for(var i=0,len=node.children.length;i<len;i++){totalTriangles+=this.analyzeTriangles(node.children[i]);}}return node.totalTriangles=totalTriangles;};RBush3D.prototype.groupNodesByNumTrianglesThreshold=function(numTrianglesThreshold,node){if(node===undefined){this.analyzeTriangles();node=this.data;}var items=[];for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];items.push({item:child,triangles:child.totalTriangles||child.numTriangles});}items.sort(function(a,b){return-(a.item.triangles-b.item.triangles);});var retVal=[];var retValItem=[];var retValItemTris=0;for(var i=0,len=items.length;i<len;i++){var item=items[i];if(retValItemTris+item.triangles<numTrianglesThreshold){retValItem.push(item);retValItemTris+=item.triangles;continue;}if(retValItem.length){retVal.push(retValItem);retValItem=[];retValItemTris=0;}if(retValItemTris+item.triangles<numTrianglesThreshold){i--;continue;}if(isLeafChild(node,item.item)){retVal.push([item]);}else{var tmp=this.groupNodesByNumTrianglesThreshold(numTrianglesThreshold,item.item);var tmp2=[];var accum2=0;for(var j=0,len2=tmp.length;j<len2-1;j++){retVal.push(tmp[i]);}if(tmp.length>1){tmp=tmp[tmp.length-1];for(var j=0,len2=tmp.length;j<len2;j++){accum2=accum2+tmp[j].triangles;if(accum2<numTrianglesThreshold){tmp2.push(tmp[j]);}else{if(accum2==0){tmp2.push(tmp[j]);}retVal.push(tmp2);accum2=0;tmp2=[];}}tmp2.forEach(function(subItem){retValItem.push(subItem);retValItemTris+=subItem.triangles;});}}}if(retValItem.length){retVal.push(retValItem);}return retVal;};// End of chipmunk
6716
6724
  RBush3D.prototype.search=function(bbox){var node=this.data;var result=[];if(!exports.intersects(bbox,node))return result;var nodesToSearch=[];while(node){for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];if(exports.intersects(bbox,child)){if(isLeafChild(node))result.push(child);else if(contains(bbox,child))this._all(child,result);else nodesToSearch.push(child);}}node=nodesToSearch.pop();}return result;};RBush3D.prototype.collides=function(bbox){var node=this.data;if(!exports.intersects(bbox,node))return false;var nodesToSearch=[];while(node){for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];if(exports.intersects(bbox,child)){if(isLeafChild(node)||contains(bbox,child))return true;nodesToSearch.push(child);}}node=nodesToSearch.pop();}return false;};RBush3D.prototype.raycastInv=function(ox,oy,oz,idx,idy,idz,maxLen){if(maxLen===void 0){maxLen=Infinity;}var node=this.data;if(idx===Infinity&&idy===Infinity&&idz===Infinity)return allowDistNode(Infinity,undefined);if(exports.boxRayIntersects(node,ox,oy,oz,idx,idy,idz)===Infinity)return allowDistNode(Infinity,undefined);var heap=[allowDistNode(0,node)];var swap=function swap(a,b){var t=heap[a];heap[a]=heap[b];heap[b]=t;};var pop=function pop(){var top=heap[0];var newLen=heap.length-1;heap[0]=heap[newLen];heap.length=newLen;var idx=0;while(true){var left=idx<<1|1;if(left>=newLen)break;var right=left+1;if(right<newLen&&heap[right].dist<heap[left].dist){left=right;}if(heap[idx].dist<heap[left].dist)break;swap(idx,left);idx=left;}freeDistNode(top);return top.node;};var push=function push(dist,node){var idx=heap.length;heap.push(allowDistNode(dist,node));while(idx>0){var p=idx-1>>1;if(heap[p].dist<=heap[idx].dist)break;swap(idx,p);idx=p;}};var dist=maxLen;var result;while(heap.length&&heap[0].dist<dist){node=pop();for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];var d=exports.boxRayIntersects(child,ox,oy,oz,idx,idy,idz);if(!isLeafChild(node)){push(d,child);}else if(d<dist){if(d===0){return allowDistNode(d,child);}dist=d;result=child;}}}return allowDistNode(dist<maxLen?dist:Infinity,result);};RBush3D.prototype.raycast=function(ox,oy,oz,dx,dy,dz,maxLen){if(maxLen===void 0){maxLen=Infinity;}return this.raycastInv(ox,oy,oz,1/dx,1/dy,1/dz,maxLen);};RBush3D.prototype.all=function(){return this._all(this.data,[]);};RBush3D.prototype.load=function(data){if(!(data&&data.length))return this;if(data.length<this.minEntries){for(var i=0,len=data.length;i<len;i++){this.insert(data[i]);}return this;}var node=this.build(data.slice(),0,data.length-1,0);if(!this.data.children.length){this.data=node;}else if(this.data.height===node.height){this.splitRoot(this.data,node);}else{if(this.data.height<node.height){var tmpNode=this.data;this.data=node;node=tmpNode;}this._insert(node,this.data.height-node.height-1,true);}return this;};RBush3D.prototype.insert=function(item){if(item)this._insert(item,this.data.height-1);return this;};RBush3D.prototype.clear=function(){if(this.data){freeAllNode(this.data);}this.data=allowNode([]);return this;};RBush3D.prototype.remove=function(item,equalsFn){if(!item)return this;var node=this.data;var i=0;var goingUp=false;var index;var parent;var path=[];var indexes=[];while(node||path.length){if(!node){node=path.pop();i=indexes.pop();parent=path[path.length-1];goingUp=true;}if(isLeaf(node)){index=findItem(item,node.children,equalsFn);if(index!==-1){node.children.splice(index,1);path.push(node);this.condense(path);return this;}}if(!goingUp&&!isLeaf(node)&&contains(node,item)){path.push(node);indexes.push(i);i=0;parent=node;node=node.children[0];}else if(parent){i++;node=parent.children[i];goingUp=false;}else{node=undefined;}}return this;};RBush3D.prototype.toJSON=function(){return this.data;};RBush3D.prototype.fromJSON=function(data){freeAllNode(this.data);this.data=data;return this;};RBush3D.prototype.build=function(items,left,right,height){var N=right-left+1;var M=this.maxEntries;var node;if(N<=M){node=allowNode(items.slice(left,right+1));calcBBox(node);return node;}if(!height){height=Math.ceil(Math.log(N)/Math.log(M));M=Math.ceil(N/Math.pow(M,height-1));}node=allowNode([]);node.leaf=false;node.height=height;var N3=Math.ceil(N/M),N2=N3*Math.ceil(Math.pow(M,2/3)),N1=N3*Math.ceil(Math.pow(M,1/3));multiSelect(items,left,right,N1,compareMinX);for(var i=left;i<=right;i+=N1){var right2=Math.min(i+N1-1,right);multiSelect(items,i,right2,N2,compareMinY);for(var j=i;j<=right2;j+=N2){var right3=Math.min(j+N2-1,right2);multiSelect(items,j,right3,N3,compareMinZ);for(var k=j;k<=right3;k+=N3){var right4=Math.min(k+N3-1,right3);node.children.push(this.build(items,k,right4,height-1));}}}calcBBox(node);return node;};RBush3D.prototype._all=function(node,result){var nodesToSearch=[];while(node){if(isLeaf(node))result.push.apply(result,node.children);else nodesToSearch.push.apply(nodesToSearch,node.children);node=nodesToSearch.pop();}return result;};RBush3D.prototype.chooseSubtree=function(bbox,node,level,path){var minVolume;var minEnlargement;var targetNode;while(true){path.push(node);if(isLeaf(node)||path.length-1===level)break;minVolume=minEnlargement=Infinity;for(var i=0,len=node.children.length;i<len;i++){var child=node.children[i];var volume=bboxVolume(child);var enlargement=enlargedVolume(bbox,child)-volume;if(enlargement<minEnlargement){minEnlargement=enlargement;minVolume=volume<minVolume?volume:minVolume;targetNode=child;}else if(enlargement===minEnlargement){if(volume<minVolume){minVolume=volume;targetNode=child;}}}node=targetNode||node.children[0];}return node;};RBush3D.prototype.split=function(insertPath,level){var node=insertPath[level];var M=node.children.length;var m=this.minEntries;this.chooseSplitAxis(node,m,M);var splitIndex=this.chooseSplitIndex(node,m,M);var newNode=allowNode(node.children.splice(splitIndex,node.children.length-splitIndex));newNode.height=node.height;newNode.leaf=node.leaf;calcBBox(node);calcBBox(newNode);if(level)insertPath[level-1].children.push(newNode);else this.splitRoot(node,newNode);};RBush3D.prototype.splitRoot=function(node,newNode){this.data=allowNode([node,newNode]);this.data.height=node.height+1;this.data.leaf=false;calcBBox(this.data);};RBush3D.prototype.chooseSplitIndex=function(node,m,M){var minOverlap=Infinity;var minVolume=Infinity;var index;for(var i=m;i<=M-m;i++){var bbox1=distBBox(node,0,i);var bbox2=distBBox(node,i,M);var overlap=intersectionVolume(bbox1,bbox2);var volume=bboxVolume(bbox1)+bboxVolume(bbox2);if(overlap<minOverlap){minOverlap=overlap;index=i;minVolume=volume<minVolume?volume:minVolume;}else if(overlap===minOverlap){if(volume<minVolume){minVolume=volume;index=i;}}}return index;};RBush3D.prototype.chooseSplitAxis=function(node,m,M){var xMargin=this.allDistMargin(node,m,M,compareMinX);var yMargin=this.allDistMargin(node,m,M,compareMinY);var zMargin=this.allDistMargin(node,m,M,compareMinZ);if(xMargin<yMargin&&xMargin<zMargin){node.children.sort(compareMinX);}else if(yMargin<xMargin&&yMargin<zMargin){node.children.sort(compareMinY);}};RBush3D.prototype.allDistMargin=function(node,m,M,compare){node.children.sort(compare);var leftBBox=distBBox(node,0,m);var rightBBox=distBBox(node,M-m,M);var margin=bboxMargin(leftBBox)+bboxMargin(rightBBox);for(var i=m;i<M-m;i++){var child=node.children[i];extend(leftBBox,child);margin+=bboxMargin(leftBBox);}for(var i=M-m-1;i>=m;i--){var child=node.children[i];extend(rightBBox,child);margin+=bboxMargin(rightBBox);}return margin;};RBush3D.prototype.adjustParentBBoxes=function(bbox,path,level){for(var i=level;i>=0;i--){extend(path[i],bbox);}};RBush3D.prototype.condense=function(path){for(var i=path.length-1,siblings=void 0;i>=0;i--){if(path[i].children.length===0){if(i>0){siblings=path[i-1].children;siblings.splice(siblings.indexOf(path[i]),1);freeNode(path[i]);}else{this.clear();}}else{calcBBox(path[i]);}}};RBush3D.prototype._insert=function(item,level,isNode){var insertPath=[];var node=this.chooseSubtree(item,this.data,level,insertPath);node.children.push(item);extend(node,item);while(level>=0){if(insertPath[level].children.length>this.maxEntries){this.split(insertPath,level);level--;}else break;}this.adjustParentBBoxes(item,insertPath,level);};RBush3D.pool=[];return RBush3D;}();exports.RBush3D=RBush3D;},{"quickselect":2}],2:[function(require,module,exports){(function(global,factory){_typeof(exports)==='object'&&typeof module!=='undefined'?module.exports=factory():global.quickselect=factory();})(this,function(){function quickselect(arr,k,left,right,compare){quickselectStep(arr,k,left||0,right||arr.length-1,compare||defaultCompare);}function quickselectStep(arr,k,left,right,compare){while(right>left){if(right-left>600){var n=right-left+1;var m=k-left+1;var z=Math.log(n);var s=0.5*Math.exp(2*z/3);var sd=0.5*Math.sqrt(z*s*(n-s)/n)*(m-n/2<0?-1:1);var newLeft=Math.max(left,Math.floor(k-m*s/n+sd));var newRight=Math.min(right,Math.floor(k+(n-m)*s/n+sd));quickselectStep(arr,k,newLeft,newRight,compare);}var t=arr[k];var i=left;var j=right;swap(arr,left,k);if(compare(arr[right],t)>0)swap(arr,left,right);while(i<j){swap(arr,i,j);i++;j--;while(compare(arr[i],t)<0){i++;}while(compare(arr[j],t)>0){j--;}}if(compare(arr[left],t)===0)swap(arr,left,j);else{j++;swap(arr,j,right);}if(j<=k)left=j+1;if(k<=j)right=j-1;}}function swap(arr,i,j){var tmp=arr[i];arr[i]=arr[j];arr[j]=tmp;}function defaultCompare(a,b){return a<b?-1:a>b?1:0;}return quickselect;});},{}]},{},[1])(1);});var tmp0=module$1.exports.RBush3D;/**
6717
6725
  * @author https://github.com/tmarti, with support from https://tribia.com/
@@ -6910,12 +6918,13 @@ return retVal;}}]);return ViewFrustumCullingState;}();var ViewFrustumCullingMana
6910
6918
  * @param {Boolean} [cfg.edges=false] Indicates if the DataTextureSceneModel's edges are initially emphasized.
6911
6919
  * @param {Number[]} [cfg.colorize=[1.0,1.0,1.0]] DataTextureSceneModel's initial RGB colorize color, multiplies by the rendered fragment colors.
6912
6920
  * @param {Number} [cfg.opacity=1.0] DataTextureSceneModel's initial opacity factor, multiplies by the rendered fragment alpha.
6913
- * @param {Number} [cfg.backfaces=false] When we set this ````true````, then we force rendering of backfaces for this dataTexturePerformanceModel. When
6921
+ * @param {Number} [cfg.backfaces=false] When we set this ````true````, then we force rendering of backfaces for this DataTextureModel. When
6914
6922
  * we leave this ````false````, then we allow the Viewer to decide when to render backfaces. In that case, the
6915
6923
  * Viewer will hide backfaces on watertight meshes, show backfaces on open meshes, and always show backfaces on meshes when we slice them open with {@link SectionPlane}s.
6916
- * @param {Boolean} [cfg.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to this dataTexturePerformanceModel. SAO is configured by the Scene's {@link SAO} component.
6917
- * @param {Boolean} [cfg.pbrEnabled=false] Indicates if physically-based rendering (PBR) will apply to the dataTexturePerformanceModel. Only works when {@link Scene#pbrEnabled} is also ````true````.
6924
+ * @param {Boolean} [cfg.saoEnabled=true] Indicates if Scalable Ambient Obscurance (SAO) will apply to this DataTextureModel. SAO is configured by the Scene's {@link SAO} component.
6918
6925
  * @param {Number} [cfg.edgeThreshold=10] When xraying, highlighting, selecting or edging, this is the threshold angle between normals of adjacent triangles, below which their shared wireframe edge is not drawn.
6926
+ * @param {Number} [cfg.targetLodFps] Optional target LoD FPS. When provided, will enable LoD culling for this DataTextureModel, with the given target FPS.
6927
+ * @param {Boolean} [cfg.enableViewFrustumCulling=false] When true, will enable view frustum culling for the objects within this DataTextureModel.
6919
6928
  * @param {Boolean} [cfg.disableVertexWelding] Disable vertex welding when loading geometry into the GPU. Default is ```false```.
6920
6929
  * @param {Boolean} [cfg.disableIndexRebucketing] Disable index rebucketing when loading geometry into the GPU. Default is ```false```.
6921
6930
  */function DataTextureSceneModel(owner){var _this33;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DataTextureSceneModel);_this33=_super14.call(this,owner,cfg);if(!(_this33.scene.canvas.gl instanceof WebGL2RenderingContext)){throw"Using a DataTextureSceneModel requires the usage of webgl2";}/**
@@ -6971,7 +6980,7 @@ return retVal;}}]);return ViewFrustumCullingState;}();var ViewFrustumCullingMana
6971
6980
  */_this33.numClippableLayerPortions=0;/**
6972
6981
  * @private
6973
6982
  */_this33.numCulledLayerPortions=0;/** @private */_this33.numEntities=0;/** @private */_this33._numTriangles=0;_this33._edgeThreshold=cfg.edgeThreshold||10;_this33.visible=cfg.visible;_this33.culled=cfg.culled;_this33.pickable=cfg.pickable;_this33.clippable=cfg.clippable;_this33.collidable=cfg.collidable;_this33.castsShadow=cfg.castsShadow;_this33.receivesShadow=cfg.receivesShadow;_this33.xrayed=cfg.xrayed;_this33.highlighted=cfg.highlighted;_this33.selected=cfg.selected;_this33.edges=cfg.edges;_this33.colorize=cfg.colorize;_this33.opacity=cfg.opacity;_this33.backfaces=cfg.backfaces;// Build static matrix
6974
- _this33._origin=math.vec3(cfg.origin||[0,0,0]);_this33._position=math.vec3(cfg.position||[0,0,0]);_this33._rotation=math.vec3(cfg.rotation||[0,0,0]);_this33._quaternion=math.vec4(cfg.quaternion||[0,0,0,1]);if(cfg.rotation){math.eulerToQuaternion(_this33._rotation,"XYZ",_this33._quaternion);}_this33._scale=math.vec3(cfg.scale||[1,1,1]);_this33._worldMatrix=math.mat4();math.composeMat4(_this33._position,_this33._quaternion,_this33._scale,_this33._worldMatrix);_this33._worldNormalMatrix=math.mat4();math.inverseMat4(_this33._worldMatrix,_this33._worldNormalMatrix);math.transposeMat4(_this33._worldNormalMatrix);if(cfg.matrix||cfg.position||cfg.rotation||cfg.scale||cfg.quaternion){_this33._viewMatrix=math.mat4();_this33._viewNormalMatrix=math.mat4();_this33._viewMatrixDirty=true;_this33._worldMatrixNonIdentity=true;}_this33._opacity=1.0;_this33._colorize=[1,1,1];_this33._saoEnabled=cfg.saoEnabled!==false;_this33._pbrEnabled=!!cfg.pbrEnabled;_this33._isModel=cfg.isModel;if(_this33._isModel){_this33.scene._registerModel(_assertThisInitialized(_this33));}_this33._onCameraViewMatrix=_this33.scene.camera.on("matrix",function(){_this33._viewMatrixDirty=true;});return _this33;}//------------------------------------------------------------------------------------------------------------------
6983
+ _this33._origin=math.vec3(cfg.origin||[0,0,0]);_this33._position=math.vec3(cfg.position||[0,0,0]);_this33._rotation=math.vec3(cfg.rotation||[0,0,0]);_this33._quaternion=math.vec4(cfg.quaternion||[0,0,0,1]);if(cfg.rotation){math.eulerToQuaternion(_this33._rotation,"XYZ",_this33._quaternion);}_this33._scale=math.vec3(cfg.scale||[1,1,1]);_this33._worldMatrix=math.mat4();math.composeMat4(_this33._position,_this33._quaternion,_this33._scale,_this33._worldMatrix);_this33._worldNormalMatrix=math.mat4();math.inverseMat4(_this33._worldMatrix,_this33._worldNormalMatrix);math.transposeMat4(_this33._worldNormalMatrix);if(cfg.matrix||cfg.position||cfg.rotation||cfg.scale||cfg.quaternion){_this33._viewMatrix=math.mat4();_this33._viewNormalMatrix=math.mat4();_this33._viewMatrixDirty=true;_this33._worldMatrixNonIdentity=true;}_this33._opacity=1.0;_this33._colorize=[1,1,1];_this33._saoEnabled=cfg.saoEnabled!==false;_this33._pbrEnabled=false;_this33._isModel=cfg.isModel;if(_this33._isModel){_this33.scene._registerModel(_assertThisInitialized(_this33));}_this33._onCameraViewMatrix=_this33.scene.camera.on("matrix",function(){_this33._viewMatrixDirty=true;});return _this33;}//------------------------------------------------------------------------------------------------------------------
6975
6984
  // DataTextureSceneModel members
6976
6985
  //------------------------------------------------------------------------------------------------------------------
6977
6986
  /**
@@ -7243,7 +7252,7 @@ _this33._origin=math.vec3(cfg.origin||[0,0,0]);_this33._position=math.vec3(cfg.p
7243
7252
  */},{key:"saoEnabled",get:function get(){return this._saoEnabled;}/**
7244
7253
  * Gets if physically-based rendering (PBR) is enabled for this DataTextureSceneModel.
7245
7254
  *
7246
- * Only works when {@link Scene#pbrEnabled} is also true.
7255
+ * This will always be ````false````.
7247
7256
  *
7248
7257
  * @type {Boolean}
7249
7258
  */},{key:"pbrEnabled",get:function get(){return this._pbrEnabled;}/**
@@ -14512,7 +14521,7 @@ if(p===UnsignedInt248Type){return gl.UNSIGNED_INT_24_8;}if(p===RepeatWrapping){r
14512
14521
  *
14513
14522
  * @private
14514
14523
  */var Texture2D=/*#__PURE__*/function(){function Texture2D(_ref4){var gl=_ref4.gl,target=_ref4.target,format=_ref4.format,type=_ref4.type,wrapS=_ref4.wrapS,wrapT=_ref4.wrapT,wrapR=_ref4.wrapR,encoding=_ref4.encoding,preloadColor=_ref4.preloadColor,premultiplyAlpha=_ref4.premultiplyAlpha,flipY=_ref4.flipY;_classCallCheck(this,Texture2D);this.gl=gl;this.target=target||gl.TEXTURE_2D;this.format=format||RGBAFormat;this.type=type||UnsignedByteType;this.internalFormat=null;this.premultiplyAlpha=!!premultiplyAlpha;this.flipY=!!flipY;this.unpackAlignment=4;this.wrapS=wrapS||RepeatWrapping;this.wrapT=wrapT||RepeatWrapping;this.wrapR=wrapR||RepeatWrapping;this.encoding=encoding||sRGBEncoding;this.texture=gl.createTexture();if(preloadColor){this.setPreloadColor(preloadColor);// Prevents "there is no texture bound to the unit 0" error
14515
- }this.allocated=true;}_createClass(Texture2D,[{key:"setPreloadColor",value:function setPreloadColor(value){if(!value){color$2[0]=0;color$2[1]=0;color$2[2]=0;color$2[3]=255;}else{color$2[0]=Math.floor(value[0]*255);color$2[1]=Math.floor(value[1]*255);color$2[2]=Math.floor(value[2]*255);color$2[3]=Math.floor((value[3]!==undefined?value[3]:1)*255);}var gl=this.gl;gl.bindTexture(this.target,this.texture);if(this.target===gl.TEXTURE_CUBE_MAP){var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i264=0,len=faces.length;_i264<len;_i264++){gl.texImage2D(faces[_i264],0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$2);}}else{gl.texImage2D(this.target,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$2);}gl.bindTexture(this.target,null);}},{key:"setTarget",value:function setTarget(target){this.target=target||this.gl.TEXTURE_2D;}},{key:"setImage",value:function setImage(image){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}var generateMipMap=false;gl.bindTexture(this.target,this.texture);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var minFilter=convertConstant(gl,this.minFilter);gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){generateMipMap=true;}var magFilter=convertConstant(gl,this.magFilter);if(magFilter){gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);if(this.target===gl.TEXTURE_CUBE_MAP){if(utils.isArray(image)){var images=image;var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i265=0,len=faces.length;_i265<len;_i265++){gl.texImage2D(faces[_i265],0,glInternalFormat,glFormat,glType,images[_i265]);}}}else{gl.texImage2D(gl.TEXTURE_2D,0,glInternalFormat,glFormat,glType,image);}if(generateMipMap){gl.generateMipmap(this.target);}gl.bindTexture(this.target,null);}},{key:"setCompressedData",value:function setCompressedData(_ref5){var mipmaps=_ref5.mipmaps,_ref5$props=_ref5.props,props=_ref5$props===void 0?{}:_ref5$props;var gl=this.gl;var levels=mipmaps.length;// Cache props
14524
+ }this.allocated=true;}_createClass(Texture2D,[{key:"setPreloadColor",value:function setPreloadColor(value){if(!value){color$2[0]=0;color$2[1]=0;color$2[2]=0;color$2[3]=255;}else{color$2[0]=Math.floor(value[0]*255);color$2[1]=Math.floor(value[1]*255);color$2[2]=Math.floor(value[2]*255);color$2[3]=Math.floor((value[3]!==undefined?value[3]:1)*255);}var gl=this.gl;gl.bindTexture(this.target,this.texture);if(this.target===gl.TEXTURE_CUBE_MAP){var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i264=0,len=faces.length;_i264<len;_i264++){gl.texImage2D(faces[_i264],0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$2);}}else{gl.texImage2D(this.target,0,gl.RGBA,1,1,0,gl.RGBA,gl.UNSIGNED_BYTE,color$2);}gl.bindTexture(this.target,null);}},{key:"setTarget",value:function setTarget(target){this.target=target||this.gl.TEXTURE_2D;}},{key:"setImage",value:function setImage(image){var props=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}var generateMipMap=false;gl.bindTexture(this.target,this.texture);var bak1=gl.getParameter(gl.UNPACK_FLIP_Y_WEBGL);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);var bak2=gl.getParameter(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);var bak3=gl.getParameter(gl.UNPACK_ALIGNMENT);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);var bak4=gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var minFilter=convertConstant(gl,this.minFilter);gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){generateMipMap=true;}var magFilter=convertConstant(gl,this.magFilter);if(magFilter){gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);if(this.target===gl.TEXTURE_CUBE_MAP){if(utils.isArray(image)){var images=image;var faces=[gl.TEXTURE_CUBE_MAP_POSITIVE_X,gl.TEXTURE_CUBE_MAP_NEGATIVE_X,gl.TEXTURE_CUBE_MAP_POSITIVE_Y,gl.TEXTURE_CUBE_MAP_NEGATIVE_Y,gl.TEXTURE_CUBE_MAP_POSITIVE_Z,gl.TEXTURE_CUBE_MAP_NEGATIVE_Z];for(var _i265=0,len=faces.length;_i265<len;_i265++){gl.texImage2D(faces[_i265],0,glInternalFormat,glFormat,glType,images[_i265]);}}}else{gl.texImage2D(gl.TEXTURE_2D,0,glInternalFormat,glFormat,glType,image);}if(generateMipMap){gl.generateMipmap(this.target);}gl.bindTexture(this.target,null);gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,bak1);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,bak2);gl.pixelStorei(gl.UNPACK_ALIGNMENT,bak3);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,bak4);}},{key:"setCompressedData",value:function setCompressedData(_ref5){var mipmaps=_ref5.mipmaps,_ref5$props=_ref5.props,props=_ref5$props===void 0?{}:_ref5$props;var gl=this.gl;var levels=mipmaps.length;// Cache props
14516
14525
  if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}gl.activeTexture(gl.TEXTURE0+0);gl.bindTexture(this.target,this.texture);var supportsMips=mipmaps.length>1;gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}if(this.type===gl.TEXTURE_3D||this.type===gl.TEXTURE_2D_ARRAY){var wrapR=convertConstant(gl,this.wrapR);if(wrapR){gl.texParameteri(this.target,gl.TEXTURE_WRAP_R,wrapR);}gl.texParameteri(this.type,gl.TEXTURE_WRAP_R,wrapR);}if(supportsMips){gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,filterFallback(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,filterFallback(gl,this.magFilter));}else{gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,convertConstant(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,convertConstant(gl,this.magFilter));}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);gl.texStorage2D(gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(var _i266=0,len=mipmaps.length;_i266<len;_i266++){var mipmap=mipmaps[_i266];if(this.format!==RGBAFormat){if(glFormat!==null){gl.compressedTexSubImage2D(gl.TEXTURE_2D,_i266,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}else{console.warn('Attempt to load unsupported compressed texture format in .setCompressedData()');}}else{gl.texSubImage2D(gl.TEXTURE_2D,_i266,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}// if (generateMipMap) {
14517
14526
  // // gl.generateMipmap(this.target); // Only for roughness textures?
14518
14527
  // }
@@ -19279,7 +19288,7 @@ var _notNormalized3=false;var _normalized5=true;this._state.flagsBuf=new ArrayBu
19279
19288
  }}if(this._modelMatrixCol0.length>0){var _normalized6=false;this._state.modelMatrixCol0Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,gl.STATIC_DRAW,_normalized6);this._state.modelMatrixCol1Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,gl.STATIC_DRAW,_normalized6);this._state.modelMatrixCol2Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,gl.STATIC_DRAW,_normalized6);this._modelMatrixCol0=[];this._modelMatrixCol1=[];this._modelMatrixCol2=[];if(this._state.geometry.normalsBuf){this._state.modelNormalMatrixCol0Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol0),this._modelNormalMatrixCol0.length,4,gl.STATIC_DRAW,_normalized6);this._state.modelNormalMatrixCol1Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol1),this._modelNormalMatrixCol1.length,4,gl.STATIC_DRAW,_normalized6);this._state.modelNormalMatrixCol2Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelNormalMatrixCol2),this._modelNormalMatrixCol2.length,4,gl.STATIC_DRAW,_normalized6);this._modelNormalMatrixCol0=[];this._modelNormalMatrixCol1=[];this._modelNormalMatrixCol2=[];}}if(this._pickColors.length>0){var _normalized7=false;this._state.pickColorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,gl.STATIC_DRAW,_normalized7);this._pickColors=[];// Release memory
19280
19289
  }this._state.pbrSupported=!!state.metallicRoughnessBuf&&!!geometry.uvBuf&&!!geometry.normalsBuf&&!!textureSet&&!!textureSet.colorTexture&&!!textureSet.metallicRoughnessTexture;this._state.colorTextureSupported=!!geometry.uvBuf&&!!textureSet&&!!textureSet.colorTexture;this._finalized=true;}// The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.
19281
19290
  // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
19282
- },{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS$1.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS$1.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS$1.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS$1.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS$1.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS$1.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}if(flags&ENTITY_FLAGS$1.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS$1.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}this._setFlags(portionId,flags,meshTransparent);this._setFlags2(portionId,flags);}},{key:"setVisible",value:function setVisible(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setSelected",value:function setSelected(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setEdges",value:function setEdges(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}else{this._numEdgesLayerPortions--;this.model.numEdgesLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}},{key:"setCollidable",value:function setCollidable(portionId,flags){if(!this._finalized){throw"Not finalized";}}},{key:"setPickable",value:function setPickable(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}else{this._numPickableLayerPortions--;this.model.numPickableLayerPortions--;}this._setFlags2(portionId,flags,meshTransparent);}},{key:"setCulled",value:function setCulled(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}else{this._numCulledLayerPortions--;this.model.numCulledLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setColor",value:function setColor(portionId,color){// RGBA color is normalized as ints
19291
+ },{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS$1.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS$1.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS$1.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS$1.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS$1.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS$1.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}if(flags&ENTITY_FLAGS$1.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS$1.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}this._setFlags(portionId,flags,meshTransparent);this._setFlags2(portionId,flags);}},{key:"setVisible",value:function setVisible(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setSelected",value:function setSelected(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setEdges",value:function setEdges(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}else{this._numEdgesLayerPortions--;this.model.numEdgesLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}},{key:"setCollidable",value:function setCollidable(portionId,flags){if(!this._finalized){throw"Not finalized";}}},{key:"setPickable",value:function setPickable(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}else{this._numPickableLayerPortions--;this.model.numPickableLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setCulled",value:function setCulled(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS$1.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}else{this._numCulledLayerPortions--;this.model.numCulledLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setColor",value:function setColor(portionId,color){// RGBA color is normalized as ints
19283
19292
  if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8Vec4$2[1]=color[1];tempUint8Vec4$2[2]=color[2];tempUint8Vec4$2[3]=color[3];if(this._state.colorsBuf){this._state.colorsBuf.setData(tempUint8Vec4$2,portionId*4,4);}}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}// setMatrix(portionId, matrix) {
19284
19293
  //
19285
19294
  // if (!this._finalized) {
@@ -19525,7 +19534,7 @@ this._aFlags2.bindArrayBuffer(state.flags2Buf);}gl.uniform1f(this._uPointSize,po
19525
19534
  // renderPass = COLOR_OPAQUE
19526
19535
  // Only opaque objects can be occluders
19527
19536
  src.push("if (int(flags.x) != renderPass) {");src.push(" gl_Position = vec4(0.0, 0.0, 0.0, 0.0);");// Cull vertex
19528
- src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");}src.push(" gl_Position = clipPos;");if(pointsMaterial.perspectivePoints){src.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;");src.push("gl_PointSize = max(gl_PointSize, "+Math.floor(pointsMaterial.minPerspectivePointSize)+".0);");src.push("gl_PointSize = min(gl_PointSize, "+Math.floor(pointsMaterial.maxPerspectivePointSize)+".0);");}else{src.push("gl_PointSize = pointSize;");}src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push("// Points batching occlusion fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in vec4 vFlags2;");for(var _i438=0;_i438<sectionPlanesState.sectionPlanes.length;_i438++){src.push("uniform bool sectionPlaneActive"+_i438+";");src.push("uniform vec3 sectionPlanePos"+_i438+";");src.push("uniform vec3 sectionPlaneDir"+_i438+";");}}src.push("out vec4 outColor;");src.push("void main(void) {");if(scene.pointsMaterial.roundPoints){src.push(" vec2 cxy = 2.0 * gl_PointCoord - 1.0;");src.push(" float r = dot(cxy, cxy);");src.push(" if (r > 1.0) {");src.push(" discard;");src.push(" }");}if(clipping){src.push(" bool clippable = (float(vFlags2.x) > 0.0);");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i439=0;_i439<sectionPlanesState.sectionPlanes.length;_i439++){src.push(" if (sectionPlaneActive"+_i439+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i439+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i439+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); ");// Occluders are blue
19537
+ src.push(" } else {");src.push(" vec4 worldPosition = worldMatrix * (positionsDecodeMatrix * vec4(position, 1.0)); ");if(scene.entityOffsetsEnabled){src.push(" worldPosition.xyz = worldPosition.xyz + offset;");}src.push(" vec4 viewPosition = viewMatrix * worldPosition; ");if(clipping){src.push(" vWorldPosition = worldPosition;");src.push(" vFlags2 = flags2;");}src.push("vec4 clipPos = projMatrix * viewPosition;");if(scene.logarithmicDepthBufferEnabled){src.push("vFragDepth = 1.0 + clipPos.w;");}src.push(" gl_Position = clipPos;");if(pointsMaterial.perspectivePoints){src.push("gl_PointSize = (nearPlaneHeight * pointSize) / clipPos.w;");src.push("gl_PointSize = max(gl_PointSize, "+Math.floor(pointsMaterial.minPerspectivePointSize)+".0);");src.push("gl_PointSize = min(gl_PointSize, "+Math.floor(pointsMaterial.maxPerspectivePointSize)+".0);");}else{src.push("gl_PointSize = pointSize;");}src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:function _buildFragmentShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var clipping=sectionPlanesState.sectionPlanes.length>0;var src=[];src.push('#version 300 es');src.push("// Points batching occlusion fragment shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("#endif");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("in float vFragDepth;");}if(clipping){src.push("in vec4 vWorldPosition;");src.push("in vec4 vFlags2;");for(var _i438=0;_i438<sectionPlanesState.sectionPlanes.length;_i438++){src.push("uniform bool sectionPlaneActive"+_i438+";");src.push("uniform vec3 sectionPlanePos"+_i438+";");src.push("uniform vec3 sectionPlaneDir"+_i438+";");}}src.push("out vec4 outColor;");src.push("void main(void) {");if(scene.pointsMaterial.roundPoints){src.push(" vec2 cxy = 2.0 * gl_PointCoord - 1.0;");src.push(" float r = dot(cxy, cxy);");src.push(" if (r > 1.0) {");src.push(" discard;");src.push(" }");}if(clipping){src.push(" bool clippable = (float(vFlags2.x) > 0.0);");src.push(" if (clippable) {");src.push(" float dist = 0.0;");for(var _i439=0;_i439<sectionPlanesState.sectionPlanes.length;_i439++){src.push(" if (sectionPlaneActive"+_i439+") {");src.push(" dist += clamp(dot(-sectionPlaneDir"+_i439+".xyz, vWorldPosition.xyz - sectionPlanePos"+_i439+".xyz), 0.0, 1000.0);");src.push(" }");}src.push(" if (dist > 0.0) { discard; }");src.push(" }");}if(scene.logarithmicDepthBufferEnabled){src.push("gl_FragDepth = log2( vFragDepth ) * logDepthBufFC * 0.5;");}src.push(" outColor = vec4(0.0, 0.0, 1.0, 1.0); ");// Occluders are blue
19529
19538
  src.push("}");return src;}},{key:"webglContextRestored",value:function webglContextRestored(){this._program=null;}},{key:"destroy",value:function destroy(){if(this._program){this._program.destroy();}this._program=null;}}]);return PointsBatchingOcclusionRenderer;}();/**
19530
19539
  * @private
19531
19540
  */var PointsBatchingRenderers=/*#__PURE__*/function(){function PointsBatchingRenderers(scene){_classCallCheck(this,PointsBatchingRenderers);this._scene=scene;}_createClass(PointsBatchingRenderers,[{key:"_compile",value:function _compile(){if(this._colorRenderer&&!this._colorRenderer.getValid()){this._colorRenderer.destroy();this._colorRenderer=null;}if(this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()){this._silhouetteRenderer.destroy();this._silhouetteRenderer=null;}if(this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()){this._pickMeshRenderer.destroy();this._pickMeshRenderer=null;}if(this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()){this._pickDepthRenderer.destroy();this._pickDepthRenderer=null;}if(this._occlusionRenderer&&this._occlusionRenderer.getValid()===false){this._occlusionRenderer.destroy();this._occlusionRenderer=null;}}},{key:"colorRenderer",get:function get(){if(!this._colorRenderer){this._colorRenderer=new PointsBatchingColorRenderer(this._scene);}return this._colorRenderer;}},{key:"silhouetteRenderer",get:function get(){if(!this._silhouetteRenderer){this._silhouetteRenderer=new PointsBatchingSilhouetteRenderer(this._scene);}return this._silhouetteRenderer;}},{key:"pickMeshRenderer",get:function get(){if(!this._pickMeshRenderer){this._pickMeshRenderer=new PointsBatchingPickMeshRenderer(this._scene);}return this._pickMeshRenderer;}},{key:"pickDepthRenderer",get:function get(){if(!this._pickDepthRenderer){this._pickDepthRenderer=new PointsBatchingPickDepthRenderer(this._scene);}return this._pickDepthRenderer;}},{key:"occlusionRenderer",get:function get(){if(!this._occlusionRenderer){this._occlusionRenderer=new PointsBatchingOcclusionRenderer(this._scene);}return this._occlusionRenderer;}},{key:"_destroy",value:function _destroy(){if(this._colorRenderer){this._colorRenderer.destroy();}if(this._silhouetteRenderer){this._silhouetteRenderer.destroy();}if(this._pickMeshRenderer){this._pickMeshRenderer.destroy();}if(this._pickDepthRenderer){this._pickDepthRenderer.destroy();}if(this._occlusionRenderer){this._occlusionRenderer.destroy();}}}]);return PointsBatchingRenderers;}();var cachedRenderers$1={};/**
@@ -21911,7 +21920,7 @@ if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPo
21911
21920
  pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this93._timeout=setTimeout(function(){if(firstClickPickResult){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this93._clicks=0;},configs.doubleClickTimeFrame);}else{// Second click
21912
21921
  if(_this93._timeout!==null){window.clearTimeout(_this93._timeout);_this93._timeout=null;}pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo||doublePickedSubs||doublePickedSurfaceSubs;pickController.schedulePickSurface=pickController.schedulePickEntity&&doublePickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}if(configs.doublePickFlyTo){flyCameraTo(pickController.pickResult);if(!configs.firstPerson&&configs.followPointer){var pickedEntityAABB=pickController.pickResult.entity.aabb;var pickedEntityCenterPos=math.getAABB3Center(pickedEntityAABB);controllers.pivotController.setPivotPos(pickedEntityCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);if(configs.doublePickFlyTo){flyCameraTo();if(!configs.firstPerson&&configs.followPointer){var sceneAABB=scene.aabb;var sceneCenterPos=math.getAABB3Center(sceneAABB);controllers.pivotController.setPivotPos(sceneCenterPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}_this93._clicks=0;}},false);}_createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);return MousePickHandler;}();/**
21913
21922
  * @private
21914
- */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;var input=scene.input;var keyDownMap=[];var canvas=scene.canvas.canvas;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
21923
+ */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;var input=scene.input;var keyDownMap=[];var canvas=scene.canvas.canvas;var mouseMovedSinceLastKeyboardDolly=true;this._onSceneMouseMove=input.on("mousemove",function(){mouseMovedSinceLastKeyboardDolly=true;});this._onSceneKeyDown=input.on("keydown",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}keyDownMap[keyCode]=true;if(keyCode===input.KEY_SHIFT){canvas.style.cursor="move";}});this._onSceneKeyUp=input.on("keyup",function(keyCode){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}keyDownMap[keyCode]=false;if(keyCode===input.KEY_SHIFT){canvas.style.cursor=null;}});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
21915
21924
  // Keyboard rotation
21916
21925
  //-------------------------------------------------------------------------------------------------
21917
21926
  if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_POS,keyDownMap);var rotateYNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_Y_NEG,keyDownMap);var rotateXPos=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_POS,keyDownMap);var rotateXNeg=cameraControl._isKeyDownForAction(cameraControl.ROTATE_X_NEG,keyDownMap);var orbitDelta=elapsedSecs*configs.keyboardRotationRate;if(rotateYPos||rotateYNeg||rotateXPos||rotateXNeg){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(rotateYPos){updates.rotateDeltaY+=orbitDelta;}else if(rotateYNeg){updates.rotateDeltaY-=orbitDelta;}if(rotateXPos){updates.rotateDeltaX+=orbitDelta;}else if(rotateXNeg){updates.rotateDeltaX-=orbitDelta;}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}}}//-------------------------------------------------------------------------------------------------
@@ -23329,10 +23338,10 @@ var createObjectsParams=[];// List of params for metaobjects we'll create
23329
23338
  // Filter out the parameters we'll create
23330
23339
  for(var _i530=0,_len116=newObjects.length;_i530<_len116;_i530++){var newObject=newObjects[_i530];newObject.type;filteredObjectsParams.push(newObject);}// Build list of params for metaobjects we'll create
23331
23340
  for(var _i531=0,_len117=filteredObjectsParams.length;_i531<_len117;_i531++){var filteredObject=filteredObjectsParams[_i531];var existingObject=this.metaObjects[filteredObject.id];if(existingObject){existingObject.metaModels.push(metaModel);existingObjects.push(existingObject);continue;}createObjectsParams.push(filteredObject);}// Create metaobjects in the creation list, add them to list of existing metaobjects
23332
- for(var _i532=0,_len118=createObjectsParams.length;_i532<_len118;_i532++){var createObject=createObjectsParams[_i532];var type=createObject.type;var objectId=createObject.id;var originalSystemId=createObject.id;var _name5=createObject.name;var propertySets=[];if(createObject.propertySetIds&&createObject.propertySetIds.length>0){for(var _j4=0,lenj=createObject.propertySetIds.length;_j4<lenj;_j4++){var _propertySetId=createObject.propertySetIds[_j4];var _propertySet=metaModel.propertySets[_propertySetId];if(_propertySet){propertySets.push(_propertySet);}}}var parent=null;var children=null;var external=createObject.external;var metaObject=new MetaObject(metaModel,objectId,originalSystemId,_name5,type,propertySets,parent,children,external);metaObject._parentId=createObject.parent;this.metaObjects[objectId]=metaObject;(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[objectId]=metaObject;if(this._typeCounts[type]===undefined){this._typeCounts[type]=1;}else{this._typeCounts[type]++;}existingObjects.push(metaObject);if(createObject.parent===undefined||createObject.parent===null);}// Ensure that metaobjects in the existing metaobject list are all attached to their parents,
23341
+ for(var _i532=0,_len118=createObjectsParams.length;_i532<_len118;_i532++){var createObject=createObjectsParams[_i532];var type=createObject.type;var objectId=options.globalizeObjectIds?math.globalizeObjectId(modelId,createObject.id):createObject.id;var originalSystemId=createObject.id;var _name5=createObject.name;var propertySets=[];if(createObject.propertySetIds&&createObject.propertySetIds.length>0){for(var _j4=0,lenj=createObject.propertySetIds.length;_j4<lenj;_j4++){var _propertySetId=createObject.propertySetIds[_j4];var _propertySet=metaModel.propertySets[_propertySetId];if(_propertySet){propertySets.push(_propertySet);}}}var parent=null;var children=null;var external=createObject.external;var metaObject=new MetaObject(metaModel,objectId,originalSystemId,_name5,type,propertySets,parent,children,external);metaObject._parentId=createObject.parent;this.metaObjects[objectId]=metaObject;(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[objectId]=metaObject;if(this._typeCounts[type]===undefined){this._typeCounts[type]=1;}else{this._typeCounts[type]++;}existingObjects.push(metaObject);if(createObject.parent===undefined||createObject.parent===null);}// Ensure that metaobjects in the existing metaobject list are all attached to their parents,
23333
23342
  // or registered as root metaobjects
23334
- for(var _i533=0,_len119=existingObjects.length;_i533<_len119;_i533++){var _existingObject=existingObjects[_i533];var _objectId=_existingObject.id;if((_existingObject._parentId===undefined||_existingObject._parentId===null)&&!_existingObject.parent){metaModel.rootMetaObject=_existingObject;// Deprecated, and won't work for federated models
23335
- metaModel.rootMetaObjects[_objectId]=_existingObject;this.rootMetaObjects[_objectId]=_existingObject;}else if(_existingObject._parentId){var parentId=_existingObject._parentId;_existingObject._parentId=null;var parentMetaObject=this.metaObjects[parentId];if(parentMetaObject){_existingObject.parent=parentMetaObject;parentMetaObject.children=parentMetaObject.children||[];parentMetaObject.children.push(_existingObject);}}}this.fire("metaModelCreated",modelId);return metaModel;}/**
23343
+ for(var _i533=0,_len119=existingObjects.length;_i533<_len119;_i533++){var _existingObject=existingObjects[_i533];var _objectId=options.globalizeObjectIds?math.globalizeObjectId(modelId,_existingObject.id):_existingObject.id;if((_existingObject._parentId===undefined||_existingObject._parentId===null)&&!_existingObject.parent){metaModel.rootMetaObject=_existingObject;// Deprecated, and won't work for federated models
23344
+ metaModel.rootMetaObjects[_objectId]=_existingObject;this.rootMetaObjects[_objectId]=_existingObject;}else if(_existingObject._parentId){var parentId=options.globalizeObjectIds?math.globalizeObjectId(modelId,_existingObject._parentId):_existingObject._parentId;_existingObject._parentId=null;var parentMetaObject=this.metaObjects[parentId];if(parentMetaObject){_existingObject.parent=parentMetaObject;parentMetaObject.children=parentMetaObject.children||[];parentMetaObject.children.push(_existingObject);}}}this.fire("metaModelCreated",modelId);return metaModel;}/**
23336
23345
  * Removes a {@link MetaModel} from this MetaScene.
23337
23346
  *
23338
23347
  * Fires a "metaModelDestroyed" event with the value of the {@link MetaModel#id}.