@xtctwins/tctwins-bimx-viewer 0.1.13 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1301,21 +1301,21 @@ var kdTreeDimLength=new Float32Array(3);/**
1301
1301
  * We can then traverse the k-d nodes, starting at {@link ObjectsKdTree3#root}, to find
1302
1302
  * the contained Entities.
1303
1303
  */var ObjectsKdTree3=/*#__PURE__*/function(){/**
1304
- * Creates an ObjectsKdTree3.
1305
- *
1306
- * @param {*} cfg Configuration
1307
- * @param {Viewer} cfg.viewer The Viewer that provides the {@link Entity}s in this ObjectsKdTree3.
1308
- * @param {number} [cfg.maxTreeDepth=15] Optional maximum depth for the k-d tree.
1309
- */function ObjectsKdTree3(cfg){var _this3=this;_classCallCheck(this,ObjectsKdTree3);if(!cfg){throw"Parameter expected: cfg";}if(!cfg.viewer){throw"Parameter expected: cfg.viewer";}this.viewer=cfg.viewer;this._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;this._root=null;this._needsRebuild=true;this._onModelLoaded=this.viewer.scene.on("modelLoaded",function(modelId){_this3._needsRebuild=true;});this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",function(modelId){_this3._needsRebuild=true;});}/**
1310
- * Gets the root ObjectsKdTree3 node.
1311
- *
1312
- * Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3
1313
- * if {@link Entity}s have been created or removed in the {@link Viewer} since the last time it was accessed.
1314
- */return _createClass(ObjectsKdTree3,[{key:"root",get:function get(){if(this._needsRebuild){this._rebuild();}return this._root;}},{key:"_rebuild",value:function _rebuild(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;this._root={aabb:scene.getAABB()};for(var objectId in scene.objects){var entity=scene.objects[objectId];this._insertEntity(this._root,entity,depth+1);}this._needsRebuild=false;}},{key:"_insertEntity",value:function _insertEntity(node,entity,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){node.entities=node.entities||[];node.entities.push(entity);return;}if(node.left){if(math.containsAABB3(node.left.aabb,entityAABB)){this._insertEntity(node.left,entity,depth+1);return;}}if(node.right){if(math.containsAABB3(node.right.aabb,entityAABB)){this._insertEntity(node.right,entity,depth+1);return;}}var nodeAABB=node.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!node.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;node.left={aabb:aabbLeft};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntity(node.left,entity,depth+1);return;}}if(!node.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;node.right={aabb:aabbRight};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntity(node.right,entity,depth+1);return;}}node.entities=node.entities||[];node.entities.push(entity);}/**
1315
- * Destroys this ObjectsKdTree3.
1316
- *
1317
- * Does not destroy the {@link Viewer} given to the constructor of the ObjectsKdTree3.
1318
- */},{key:"destroy",value:function destroy(){var scene=this.viewer.scene;scene.off(this._onModelLoaded);scene.off(this._onModelUnloaded);this._root=null;this._needsRebuild=true;}}]);}();/** @private */var Map=/*#__PURE__*/function(){function Map(items,baseId){_classCallCheck(this,Map);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
1304
+ * Creates an ObjectsKdTree3.
1305
+ *
1306
+ * @param {*} cfg Configuration
1307
+ * @param {Viewer} cfg.viewer The Viewer that provides the {@link Entity}s in this ObjectsKdTree3.
1308
+ * @param {number} [cfg.maxTreeDepth=15] Optional maximum depth for the k-d tree.
1309
+ */function ObjectsKdTree3(cfg){var _this3=this;_classCallCheck(this,ObjectsKdTree3);if(!cfg){throw"Parameter expected: cfg";}if(!cfg.viewer){throw"Parameter expected: cfg.viewer";}this.viewer=cfg.viewer;this._maxTreeDepth=cfg.maxTreeDepth||MAX_KD_TREE_DEPTH;this._root=null;this._needsRebuild=true;this._onModelLoaded=this.viewer.scene.on("modelLoaded",function(modelId){_this3._needsRebuild=true;});this._onModelUnloaded=this.viewer.scene.on("modelUnloaded",function(modelId){_this3._needsRebuild=true;});this.viewer.scene.aabb.on("aabb",function(){_this3._needsRebuild=true;});}/**
1310
+ * Gets the root ObjectsKdTree3 node.
1311
+ *
1312
+ * Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3
1313
+ * if {@link Entity}s have been created or removed in the {@link Viewer} since the last time it was accessed.
1314
+ */return _createClass(ObjectsKdTree3,[{key:"root",get:function get(){if(this._needsRebuild){this._rebuild();}return this._root;}},{key:"_rebuild",value:function _rebuild(){var viewer=this.viewer;var scene=viewer.scene;var depth=0;this._root={aabb:scene.getAABB()};for(var objectId in scene.objects){var entity=scene.objects[objectId];this._insertEntity(this._root,entity,depth+1);}this._needsRebuild=false;}},{key:"_insertEntity",value:function _insertEntity(node,entity,depth){var entityAABB=entity.aabb;if(depth>=this._maxTreeDepth){node.entities=node.entities||[];node.entities.push(entity);return;}if(node.left){if(math.containsAABB3(node.left.aabb,entityAABB)){this._insertEntity(node.left,entity,depth+1);return;}}if(node.right){if(math.containsAABB3(node.right.aabb,entityAABB)){this._insertEntity(node.right,entity,depth+1);return;}}var nodeAABB=node.aabb;kdTreeDimLength[0]=nodeAABB[3]-nodeAABB[0];kdTreeDimLength[1]=nodeAABB[4]-nodeAABB[1];kdTreeDimLength[2]=nodeAABB[5]-nodeAABB[2];var dim=0;if(kdTreeDimLength[1]>kdTreeDimLength[dim]){dim=1;}if(kdTreeDimLength[2]>kdTreeDimLength[dim]){dim=2;}if(!node.left){var aabbLeft=nodeAABB.slice();aabbLeft[dim+3]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;node.left={aabb:aabbLeft};if(math.containsAABB3(aabbLeft,entityAABB)){this._insertEntity(node.left,entity,depth+1);return;}}if(!node.right){var aabbRight=nodeAABB.slice();aabbRight[dim]=(nodeAABB[dim]+nodeAABB[dim+3])/2.0;node.right={aabb:aabbRight};if(math.containsAABB3(aabbRight,entityAABB)){this._insertEntity(node.right,entity,depth+1);return;}}node.entities=node.entities||[];node.entities.push(entity);}/**
1315
+ * Destroys this ObjectsKdTree3.
1316
+ *
1317
+ * Does not destroy the {@link Viewer} given to the constructor of the ObjectsKdTree3.
1318
+ */},{key:"destroy",value:function destroy(){var scene=this.viewer.scene;scene.off(this._onModelLoaded);scene.off(this._onModelUnloaded);this._root=null;this._needsRebuild=true;}}]);}();/** @private */var Map=/*#__PURE__*/function(){function Map(items,baseId){_classCallCheck(this,Map);this.items=items||[];this._lastUniqueId=(baseId||0)+1;}/**
1319
1319
  * Usage:
1320
1320
  *
1321
1321
  * id = myMap.addItem("foo") // ID internally generated
@@ -2191,7 +2191,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
2191
2191
  * Default value is ````[0,0,0]````.
2192
2192
  *
2193
2193
  * @type {Number[]}
2194
- */,set:function set(offset){if(offset){this._offset[0]=offset[0];this._offset[1]=offset[1];this._offset[2]=offset[2];}else{this._offset[0]=0;this._offset[1]=0;this._offset[2]=0;}for(var _i28=0,len=this.meshes.length;_i28<len;_i28++){this.meshes[_i28]._setOffset(this._offset);}this._aabbDirty=true;this.model._aabbDirty=true;this.scene._aabbDirty=true;this.scene._objectOffsetUpdated(this,offset);this.model.glRedraw();}},{key:"saoEnabled",get:function get(){return this.model.saoEnabled;}},{key:"getEachVertex",value:function getEachVertex(callback){for(var _i29=0,len=this.meshes.length;_i29<len;_i29++){this.meshes[_i29].getEachVertex(callback);}}},{key:"_getFlag",value:function _getFlag(flag){return!!(this._flags&flag);}},{key:"_finalize",value:function _finalize(){var scene=this.model.scene;if(this._isObject){if(this.visible){scene._objectVisibilityUpdated(this);}if(this.highlighted){scene._objectHighlightedUpdated(this);}if(this.xrayed){scene._objectXRayedUpdated(this);}if(this.selected){scene._objectSelectedUpdated(this);}}for(var _i30=0,len=this.meshes.length;_i30<len;_i30++){this.meshes[_i30]._finalize(this._flags);}}},{key:"_finalize2",value:function _finalize2(){for(var _i31=0,len=this.meshes.length;_i31<len;_i31++){this.meshes[_i31]._finalize2();}}},{key:"_destroy",value:function _destroy(){var scene=this.model.scene;if(this._isObject){scene._deregisterObject(this);if(this.visible){scene._deRegisterVisibleObject(this);}if(this.xrayed){scene._deRegisterXRayedObject(this);}if(this.selected){scene._deRegisterSelectedObject(this);}if(this.highlighted){scene._deRegisterHighlightedObject(this);}if(this._colorizeUpdated){this.scene._deRegisterColorizedObject(this);}if(this._opacityUpdated){this.scene._deRegisterOpacityObject(this);}if(this._offset&&(this._offset[0]!==0||this._offset[1]!==0||this._offset[2]!==0)){this.scene._deRegisterOffsetObject(this);}}for(var _i32=0,len=this.meshes.length;_i32<len;_i32++){this.meshes[_i32]._destroy();}scene._aabbDirty=true;}}]);}();var tempVec4a$7=math.vec4();var tempVec4b$4=math.vec4();/**
2194
+ */,set:function set(offset){if(offset){this._offset[0]=offset[0];this._offset[1]=offset[1];this._offset[2]=offset[2];}else{this._offset[0]=0;this._offset[1]=0;this._offset[2]=0;}for(var _i28=0,len=this.meshes.length;_i28<len;_i28++){this.meshes[_i28]._setOffset(this._offset);}this._aabbDirty=true;this.model._aabbDirty=true;this.scene._aabbDirty=true;this.scene._objectOffsetUpdated(this,offset);this.model.glRedraw();}},{key:"saoEnabled",get:function get(){return this.model.saoEnabled;}},{key:"getEachVertex",value:function getEachVertex(callback){for(var _i29=0,len=this.meshes.length;_i29<len;_i29++){this.meshes[_i29].getEachVertex(callback);}}},{key:"_getFlag",value:function _getFlag(flag){return!!(this._flags&flag);}},{key:"_finalize",value:function _finalize(){var scene=this.model.scene;if(this._isObject){if(this.visible){scene._objectVisibilityUpdated(this);}if(this.highlighted){scene._objectHighlightedUpdated(this);}if(this.xrayed){scene._objectXRayedUpdated(this);}if(this.selected){scene._objectSelectedUpdated(this);}}for(var _i30=0,len=this.meshes.length;_i30<len;_i30++){this.meshes[_i30]._finalize(this._flags);}}},{key:"_finalize2",value:function _finalize2(){for(var _i31=0,len=this.meshes.length;_i31<len;_i31++){this.meshes[_i31]._finalize2();}}},{key:"_destroy",value:function _destroy(){var scene=this.model.scene;if(this._isObject){scene._deregisterObject(this);if(this.visible){scene._deRegisterVisibleObject(this);}if(this.xrayed){scene._deRegisterXRayedObject(this);}if(this.selected){scene._deRegisterSelectedObject(this);}if(this.highlighted){scene._deRegisterHighlightedObject(this);}if(this._colorizeUpdated){this.scene._deRegisterColorizedObject(this);}if(this._opacityUpdated){this.scene._deRegisterOpacityObject(this);}if(this._offset&&(this._offset[0]!==0||this._offset[1]!==0||this._offset[2]!==0)){this.scene._deRegisterOffsetObject(this);}}for(var _i32=0,len=this.meshes.length;_i32<len;_i32++){this.meshes[_i32]._destroy();}scene._aabbDirty=true;}}]);}();var tempVec4a$8=math.vec4();var tempVec4b$5=math.vec4();/**
2195
2195
  * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.
2196
2196
  *
2197
2197
  * ## Position
@@ -2305,7 +2305,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
2305
2305
  * @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.
2306
2306
  * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.
2307
2307
  */function Marker(owner,cfg){var _this5;_classCallCheck(this,Marker);_this5=_callSuper(this,Marker,[owner,cfg]);_this5._entity=null;_this5._visible=null;_this5._worldPos=math.vec3();_this5._origin=math.vec3();_this5._rtcPos=math.vec3();_this5._viewPos=math.vec3();_this5._canvasPos=math.vec2();_this5._occludable=false;_this5._onCameraViewMatrix=_this5.scene.camera.on("matrix",function(){_this5._viewPosDirty=true;_this5._needUpdate();});_this5._onCameraProjMatrix=_this5.scene.camera.on("projMatrix",function(){_this5._canvasPosDirty=true;_this5._needUpdate();});_this5._onEntityDestroyed=null;_this5._onEntityModelDestroyed=null;_this5._renderer.addMarker(_this5);_this5.entity=cfg.entity;_this5.worldPos=cfg.worldPos;_this5.occludable=cfg.occludable;return _this5;}_inherits(Marker,_Component);return _createClass(Marker,[{key:"_update",value:function _update(){// this._needUpdate() schedules this for next tick
2308
- if(this._viewPosDirty){math.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos);this._viewPosDirty=false;this._canvasPosDirty=true;this.fire("viewPos",this._viewPos);}if(this._canvasPosDirty){tempVec4a$7.set(this._viewPos);tempVec4a$7[3]=1.0;math.transformPoint4(this.scene.camera.projMatrix,tempVec4a$7,tempVec4b$4);var aabb=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+tempVec4b$4[0]/tempVec4b$4[3])*aabb[2]/2);this._canvasPos[1]=Math.floor((1-tempVec4b$4[1]/tempVec4b$4[3])*aabb[3]/2);this._canvasPosDirty=false;this.fire("canvasPos",this._canvasPos);}}},{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
2308
+ if(this._viewPosDirty){math.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos);this._viewPosDirty=false;this._canvasPosDirty=true;this.fire("viewPos",this._viewPos);}if(this._canvasPosDirty){tempVec4a$8.set(this._viewPos);tempVec4a$8[3]=1.0;math.transformPoint4(this.scene.camera.projMatrix,tempVec4a$8,tempVec4b$5);var aabb=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+tempVec4b$5[0]/tempVec4b$5[3])*aabb[2]/2);this._canvasPos[1]=Math.floor((1-tempVec4b$5[1]/tempVec4b$5[3])*aabb[3]/2);this._canvasPosDirty=false;this.fire("canvasPos",this._canvasPos);}}},{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
2309
2309
  if(this._visible===visible);this._visible=visible;this.fire("visible",this._visible);}/**
2310
2310
  * Sets the {@link Entity} this Marker is associated with.
2311
2311
  *
@@ -5484,679 +5484,679 @@ this._occlusionTester.unbindRenderBuf();}};/**
5484
5484
  */this.endSnapshot=function(){if(!snapshotBound){return;}var snapshotBuffer=renderBufferManager.getRenderBuffer("snapshot");snapshotBuffer.unbind();snapshotBound=false;};/**
5485
5485
  * Destroys this renderer.
5486
5486
  * @private
5487
- */this.destroy=function(){drawableTypeInfo={};drawables={};renderBufferManager.destroy();saoOcclusionRenderer.destroy();saoDepthLimitedBlurRenderer.destroy();if(this._occlusionTester){this._occlusionTester.destroy();}};};/**
5488
- * @desc Meditates mouse, touch and keyboard events for various interaction controls.
5489
- *
5490
- * Ordinarily, you would only use this component as a utility to help manage input events and state for your
5491
- * own custom input handlers.
5492
- *
5493
- * * Located at {@link Scene#input}
5494
- * * Used by (at least) {@link CameraControl}
5495
- *
5496
- * ## Usage
5497
- *
5498
- * Subscribing to mouse events on the canvas:
5499
- *
5500
- * ````javascript
5501
- * import {Viewer} from "xeokit-sdk.es.js";
5502
- *
5503
- * const viewer = new Viewer({
5504
- * canvasId: "myCanvas"
5505
- * });
5506
- *
5507
- * const input = viewer.scene.input;
5508
- *
5509
- * const onMouseDown = input.on("mousedown", (canvasCoords) => {
5510
- * console.log("Mouse down at: x=" + canvasCoords[0] + ", y=" + coords[1]);
5511
- * });
5512
- *
5513
- * const onMouseUp = input.on("mouseup", (canvasCoords) => {
5514
- * console.log("Mouse up at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5515
- * });
5516
- *
5517
- * const onMouseClicked = input.on("mouseclicked", (canvasCoords) => {
5518
- * console.log("Mouse clicked at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5519
- * });
5520
- *
5521
- * const onDblClick = input.on("dblclick", (canvasCoords) => {
5522
- * console.log("Double-click at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5523
- * });
5524
- * ````
5525
- *
5526
- * Subscribing to keyboard events on the canvas:
5527
- *
5528
- * ````javascript
5529
- * const onKeyDown = input.on("keydown", (keyCode) => {
5530
- * switch (keyCode) {
5531
- * case this.KEY_A:
5532
- * console.log("The 'A' key is down");
5533
- * break;
5534
- *
5535
- * case this.KEY_B:
5536
- * console.log("The 'B' key is down");
5537
- * break;
5538
- *
5539
- * case this.KEY_C:
5540
- * console.log("The 'C' key is down");
5541
- * break;
5542
- *
5543
- * default:
5544
- * console.log("Some other key is down");
5545
- * }
5546
- * });
5547
- *
5548
- * const onKeyUp = input.on("keyup", (keyCode) => {
5549
- * switch (keyCode) {
5550
- * case this.KEY_A:
5551
- * console.log("The 'A' key is up");
5552
- * break;
5553
- *
5554
- * case this.KEY_B:
5555
- * console.log("The 'B' key is up");
5556
- * break;
5557
- *
5558
- * case this.KEY_C:
5559
- * console.log("The 'C' key is up");
5560
- * break;
5561
- *
5562
- * default:
5563
- * console.log("Some other key is up");
5564
- * }
5565
- * });
5566
- * ````
5567
- *
5568
- * Checking if keys are down:
5569
- *
5570
- * ````javascript
5571
- * const isCtrlDown = input.ctrlDown;
5572
- * const isAltDown = input.altDown;
5573
- * const shiftDown = input.shiftDown;
5574
- * //...
5575
- *
5576
- * const isAKeyDown = input.keyDown[input.KEY_A];
5577
- * const isBKeyDown = input.keyDown[input.KEY_B];
5578
- * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];
5579
- * //...
5580
- *
5581
- * ````
5582
- * Unsubscribing from events:
5583
- *
5584
- * ````javascript
5585
- * input.off(onMouseDown);
5586
- * input.off(onMouseUp);
5587
- * //...
5588
- * ````
5589
- *
5590
- * ## Disabling all events
5591
- *
5592
- * Event handling is enabled by default.
5593
- *
5594
- * To disable all events:
5595
- *
5596
- * ````javascript
5597
- * myViewer.scene.input.setEnabled(false);
5598
- * ````
5599
- * To enable all events again:
5600
- *
5601
- * ````javascript
5602
- * myViewer.scene.input.setEnabled(true);
5603
- * ````
5604
- *
5605
- * ## Disabling keyboard input
5606
- *
5607
- * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need
5608
- * to disable keyboard control, so that other UI elements can get those events.
5609
- *
5610
- * To disable keyboard events:
5611
- *
5612
- * ````javascript
5613
- * myViewer.scene.input.setKeyboardEnabled(false);
5614
- * ````
5615
- *
5616
- * To enable keyboard events again:
5617
- *
5618
- * ````javascript
5619
- * myViewer.scene.input.setKeyboardEnabled(true)
5620
- * ````
5621
- */var Input=/*#__PURE__*/function(_Component9){/**
5622
- * @private
5623
- */function Input(owner){var _this37;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Input);_this37=_callSuper(this,Input,[owner,cfg]);/**
5624
- * Code for the BACKSPACE key.
5625
- * @property KEY_BACKSPACE
5626
- * @final
5627
- * @type {Number}
5628
- */_this37.KEY_BACKSPACE=8;/**
5629
- * Code for the TAB key.
5630
- * @property KEY_TAB
5631
- * @final
5632
- * @type {Number}
5633
- */_this37.KEY_TAB=9;/**
5634
- * Code for the ENTER key.
5635
- * @property KEY_ENTER
5636
- * @final
5637
- * @type {Number}
5638
- */_this37.KEY_ENTER=13;/**
5639
- * Code for the SHIFT key.
5640
- * @property KEY_SHIFT
5641
- * @final
5642
- * @type {Number}
5643
- */_this37.KEY_SHIFT=16;/**
5644
- * Code for the CTRL key.
5645
- * @property KEY_CTRL
5646
- * @final
5647
- * @type {Number}
5648
- */_this37.KEY_CTRL=17;/**
5649
- * Code for the ALT key.
5650
- * @property KEY_ALT
5651
- * @final
5652
- * @type {Number}
5653
- */_this37.KEY_ALT=18;/**
5654
- * Code for the PAUSE_BREAK key.
5655
- * @property KEY_PAUSE_BREAK
5656
- * @final
5657
- * @type {Number}
5658
- */_this37.KEY_PAUSE_BREAK=19;/**
5659
- * Code for the CAPS_LOCK key.
5660
- * @property KEY_CAPS_LOCK
5661
- * @final
5662
- * @type {Number}
5663
- */_this37.KEY_CAPS_LOCK=20;/**
5664
- * Code for the ESCAPE key.
5665
- * @property KEY_ESCAPE
5666
- * @final
5667
- * @type {Number}
5668
- */_this37.KEY_ESCAPE=27;/**
5669
- * Code for the PAGE_UP key.
5670
- * @property KEY_PAGE_UP
5671
- * @final
5672
- * @type {Number}
5673
- */_this37.KEY_PAGE_UP=33;/**
5674
- * Code for the PAGE_DOWN key.
5675
- * @property KEY_PAGE_DOWN
5676
- * @final
5677
- * @type {Number}
5678
- */_this37.KEY_PAGE_DOWN=34;/**
5679
- * Code for the END key.
5680
- * @property KEY_END
5681
- * @final
5682
- * @type {Number}
5683
- */_this37.KEY_END=35;/**
5684
- * Code for the HOME key.
5685
- * @property KEY_HOME
5686
- * @final
5687
- * @type {Number}
5688
- */_this37.KEY_HOME=36;/**
5689
- * Code for the LEFT_ARROW key.
5690
- * @property KEY_LEFT_ARROW
5691
- * @final
5692
- * @type {Number}
5693
- */_this37.KEY_LEFT_ARROW=37;/**
5694
- * Code for the UP_ARROW key.
5695
- * @property KEY_UP_ARROW
5696
- * @final
5697
- * @type {Number}
5698
- */_this37.KEY_UP_ARROW=38;/**
5699
- * Code for the RIGHT_ARROW key.
5700
- * @property KEY_RIGHT_ARROW
5701
- * @final
5702
- * @type {Number}
5703
- */_this37.KEY_RIGHT_ARROW=39;/**
5704
- * Code for the DOWN_ARROW key.
5705
- * @property KEY_DOWN_ARROW
5706
- * @final
5707
- * @type {Number}
5708
- */_this37.KEY_DOWN_ARROW=40;/**
5709
- * Code for the INSERT key.
5710
- * @property KEY_INSERT
5711
- * @final
5712
- * @type {Number}
5713
- */_this37.KEY_INSERT=45;/**
5714
- * Code for the DELETE key.
5715
- * @property KEY_DELETE
5716
- * @final
5717
- * @type {Number}
5718
- */_this37.KEY_DELETE=46;/**
5719
- * Code for the 0 key.
5720
- * @property KEY_NUM_0
5721
- * @final
5722
- * @type {Number}
5723
- */_this37.KEY_NUM_0=48;/**
5724
- * Code for the 1 key.
5725
- * @property KEY_NUM_1
5726
- * @final
5727
- * @type {Number}
5728
- */_this37.KEY_NUM_1=49;/**
5729
- * Code for the 2 key.
5730
- * @property KEY_NUM_2
5731
- * @final
5732
- * @type {Number}
5733
- */_this37.KEY_NUM_2=50;/**
5734
- * Code for the 3 key.
5735
- * @property KEY_NUM_3
5736
- * @final
5737
- * @type {Number}
5738
- */_this37.KEY_NUM_3=51;/**
5739
- * Code for the 4 key.
5740
- * @property KEY_NUM_4
5741
- * @final
5742
- * @type {Number}
5743
- */_this37.KEY_NUM_4=52;/**
5744
- * Code for the 5 key.
5745
- * @property KEY_NUM_5
5746
- * @final
5747
- * @type {Number}
5748
- */_this37.KEY_NUM_5=53;/**
5749
- * Code for the 6 key.
5750
- * @property KEY_NUM_6
5751
- * @final
5752
- * @type {Number}
5753
- */_this37.KEY_NUM_6=54;/**
5754
- * Code for the 7 key.
5755
- * @property KEY_NUM_7
5756
- * @final
5757
- * @type {Number}
5758
- */_this37.KEY_NUM_7=55;/**
5759
- * Code for the 8 key.
5760
- * @property KEY_NUM_8
5761
- * @final
5762
- * @type {Number}
5763
- */_this37.KEY_NUM_8=56;/**
5764
- * Code for the 9 key.
5765
- * @property KEY_NUM_9
5766
- * @final
5767
- * @type {Number}
5768
- */_this37.KEY_NUM_9=57;/**
5769
- * Code for the A key.
5770
- * @property KEY_A
5771
- * @final
5772
- * @type {Number}
5773
- */_this37.KEY_A=65;/**
5774
- * Code for the B key.
5775
- * @property KEY_B
5776
- * @final
5777
- * @type {Number}
5778
- */_this37.KEY_B=66;/**
5779
- * Code for the C key.
5780
- * @property KEY_C
5781
- * @final
5782
- * @type {Number}
5783
- */_this37.KEY_C=67;/**
5784
- * Code for the D key.
5785
- * @property KEY_D
5786
- * @final
5787
- * @type {Number}
5788
- */_this37.KEY_D=68;/**
5789
- * Code for the E key.
5790
- * @property KEY_E
5791
- * @final
5792
- * @type {Number}
5793
- */_this37.KEY_E=69;/**
5794
- * Code for the F key.
5795
- * @property KEY_F
5796
- * @final
5797
- * @type {Number}
5798
- */_this37.KEY_F=70;/**
5799
- * Code for the G key.
5800
- * @property KEY_G
5801
- * @final
5802
- * @type {Number}
5803
- */_this37.KEY_G=71;/**
5804
- * Code for the H key.
5805
- * @property KEY_H
5806
- * @final
5807
- * @type {Number}
5808
- */_this37.KEY_H=72;/**
5809
- * Code for the I key.
5810
- * @property KEY_I
5811
- * @final
5812
- * @type {Number}
5813
- */_this37.KEY_I=73;/**
5814
- * Code for the J key.
5815
- * @property KEY_J
5816
- * @final
5817
- * @type {Number}
5818
- */_this37.KEY_J=74;/**
5819
- * Code for the K key.
5820
- * @property KEY_K
5821
- * @final
5822
- * @type {Number}
5823
- */_this37.KEY_K=75;/**
5824
- * Code for the L key.
5825
- * @property KEY_L
5826
- * @final
5827
- * @type {Number}
5828
- */_this37.KEY_L=76;/**
5829
- * Code for the M key.
5830
- * @property KEY_M
5831
- * @final
5832
- * @type {Number}
5833
- */_this37.KEY_M=77;/**
5834
- * Code for the N key.
5835
- * @property KEY_N
5836
- * @final
5837
- * @type {Number}
5838
- */_this37.KEY_N=78;/**
5839
- * Code for the O key.
5840
- * @property KEY_O
5841
- * @final
5842
- * @type {Number}
5843
- */_this37.KEY_O=79;/**
5844
- * Code for the P key.
5845
- * @property KEY_P
5846
- * @final
5847
- * @type {Number}
5848
- */_this37.KEY_P=80;/**
5849
- * Code for the Q key.
5850
- * @property KEY_Q
5851
- * @final
5852
- * @type {Number}
5853
- */_this37.KEY_Q=81;/**
5854
- * Code for the R key.
5855
- * @property KEY_R
5856
- * @final
5857
- * @type {Number}
5858
- */_this37.KEY_R=82;/**
5859
- * Code for the S key.
5860
- * @property KEY_S
5861
- * @final
5862
- * @type {Number}
5863
- */_this37.KEY_S=83;/**
5864
- * Code for the T key.
5865
- * @property KEY_T
5866
- * @final
5867
- * @type {Number}
5868
- */_this37.KEY_T=84;/**
5869
- * Code for the U key.
5870
- * @property KEY_U
5871
- * @final
5872
- * @type {Number}
5873
- */_this37.KEY_U=85;/**
5874
- * Code for the V key.
5875
- * @property KEY_V
5876
- * @final
5877
- * @type {Number}
5878
- */_this37.KEY_V=86;/**
5879
- * Code for the W key.
5880
- * @property KEY_W
5881
- * @final
5882
- * @type {Number}
5883
- */_this37.KEY_W=87;/**
5884
- * Code for the X key.
5885
- * @property KEY_X
5886
- * @final
5887
- * @type {Number}
5888
- */_this37.KEY_X=88;/**
5889
- * Code for the Y key.
5890
- * @property KEY_Y
5891
- * @final
5892
- * @type {Number}
5893
- */_this37.KEY_Y=89;/**
5894
- * Code for the Z key.
5895
- * @property KEY_Z
5896
- * @final
5897
- * @type {Number}
5898
- */_this37.KEY_Z=90;/**
5899
- * Code for the LEFT_WINDOW key.
5900
- * @property KEY_LEFT_WINDOW
5901
- * @final
5902
- * @type {Number}
5903
- */_this37.KEY_LEFT_WINDOW=91;/**
5904
- * Code for the RIGHT_WINDOW key.
5905
- * @property KEY_RIGHT_WINDOW
5906
- * @final
5907
- * @type {Number}
5908
- */_this37.KEY_RIGHT_WINDOW=92;/**
5909
- * Code for the SELECT key.
5910
- * @property KEY_SELECT
5911
- * @final
5912
- * @type {Number}
5913
- */_this37.KEY_SELECT_KEY=93;/**
5914
- * Code for the number pad 0 key.
5915
- * @property KEY_NUMPAD_0
5916
- * @final
5917
- * @type {Number}
5918
- */_this37.KEY_NUMPAD_0=96;/**
5919
- * Code for the number pad 1 key.
5920
- * @property KEY_NUMPAD_1
5921
- * @final
5922
- * @type {Number}
5923
- */_this37.KEY_NUMPAD_1=97;/**
5924
- * Code for the number pad 2 key.
5925
- * @property KEY_NUMPAD 2
5926
- * @final
5927
- * @type {Number}
5928
- */_this37.KEY_NUMPAD_2=98;/**
5929
- * Code for the number pad 3 key.
5930
- * @property KEY_NUMPAD_3
5931
- * @final
5932
- * @type {Number}
5933
- */_this37.KEY_NUMPAD_3=99;/**
5934
- * Code for the number pad 4 key.
5935
- * @property KEY_NUMPAD_4
5936
- * @final
5937
- * @type {Number}
5938
- */_this37.KEY_NUMPAD_4=100;/**
5939
- * Code for the number pad 5 key.
5940
- * @property KEY_NUMPAD_5
5941
- * @final
5942
- * @type {Number}
5943
- */_this37.KEY_NUMPAD_5=101;/**
5944
- * Code for the number pad 6 key.
5945
- * @property KEY_NUMPAD_6
5946
- * @final
5947
- * @type {Number}
5948
- */_this37.KEY_NUMPAD_6=102;/**
5949
- * Code for the number pad 7 key.
5950
- * @property KEY_NUMPAD_7
5951
- * @final
5952
- * @type {Number}
5953
- */_this37.KEY_NUMPAD_7=103;/**
5954
- * Code for the number pad 8 key.
5955
- * @property KEY_NUMPAD_8
5956
- * @final
5957
- * @type {Number}
5958
- */_this37.KEY_NUMPAD_8=104;/**
5959
- * Code for the number pad 9 key.
5960
- * @property KEY_NUMPAD_9
5961
- * @final
5962
- * @type {Number}
5963
- */_this37.KEY_NUMPAD_9=105;/**
5964
- * Code for the MULTIPLY key.
5965
- * @property KEY_MULTIPLY
5966
- * @final
5967
- * @type {Number}
5968
- */_this37.KEY_MULTIPLY=106;/**
5969
- * Code for the ADD key.
5970
- * @property KEY_ADD
5971
- * @final
5972
- * @type {Number}
5973
- */_this37.KEY_ADD=107;/**
5974
- * Code for the SUBTRACT key.
5975
- * @property KEY_SUBTRACT
5976
- * @final
5977
- * @type {Number}
5978
- */_this37.KEY_SUBTRACT=109;/**
5979
- * Code for the DECIMAL POINT key.
5980
- * @property KEY_DECIMAL_POINT
5981
- * @final
5982
- * @type {Number}
5983
- */_this37.KEY_DECIMAL_POINT=110;/**
5984
- * Code for the DIVIDE key.
5985
- * @property KEY_DIVIDE
5986
- * @final
5987
- * @type {Number}
5988
- */_this37.KEY_DIVIDE=111;/**
5989
- * Code for the F1 key.
5990
- * @property KEY_F1
5991
- * @final
5992
- * @type {Number}
5993
- */_this37.KEY_F1=112;/**
5994
- * Code for the F2 key.
5995
- * @property KEY_F2
5996
- * @final
5997
- * @type {Number}
5998
- */_this37.KEY_F2=113;/**
5999
- * Code for the F3 key.
6000
- * @property KEY_F3
6001
- * @final
6002
- * @type {Number}
6003
- */_this37.KEY_F3=114;/**
6004
- * Code for the F4 key.
6005
- * @property KEY_F4
6006
- * @final
6007
- * @type {Number}
6008
- */_this37.KEY_F4=115;/**
6009
- * Code for the F5 key.
6010
- * @property KEY_F5
6011
- * @final
6012
- * @type {Number}
6013
- */_this37.KEY_F5=116;/**
6014
- * Code for the F6 key.
6015
- * @property KEY_F6
6016
- * @final
6017
- * @type {Number}
6018
- */_this37.KEY_F6=117;/**
6019
- * Code for the F7 key.
6020
- * @property KEY_F7
6021
- * @final
6022
- * @type {Number}
6023
- */_this37.KEY_F7=118;/**
6024
- * Code for the F8 key.
6025
- * @property KEY_F8
6026
- * @final
6027
- * @type {Number}
6028
- */_this37.KEY_F8=119;/**
6029
- * Code for the F9 key.
6030
- * @property KEY_F9
6031
- * @final
6032
- * @type {Number}
6033
- */_this37.KEY_F9=120;/**
6034
- * Code for the F10 key.
6035
- * @property KEY_F10
6036
- * @final
6037
- * @type {Number}
6038
- */_this37.KEY_F10=121;/**
6039
- * Code for the F11 key.
6040
- * @property KEY_F11
6041
- * @final
6042
- * @type {Number}
6043
- */_this37.KEY_F11=122;/**
6044
- * Code for the F12 key.
6045
- * @property KEY_F12
6046
- * @final
6047
- * @type {Number}
6048
- */_this37.KEY_F12=123;/**
6049
- * Code for the NUM_LOCK key.
6050
- * @property KEY_NUM_LOCK
6051
- * @final
6052
- * @type {Number}
6053
- */_this37.KEY_NUM_LOCK=144;/**
6054
- * Code for the SCROLL_LOCK key.
6055
- * @property KEY_SCROLL_LOCK
6056
- * @final
6057
- * @type {Number}
6058
- */_this37.KEY_SCROLL_LOCK=145;/**
6059
- * Code for the SEMI_COLON key.
6060
- * @property KEY_SEMI_COLON
6061
- * @final
6062
- * @type {Number}
6063
- */_this37.KEY_SEMI_COLON=186;/**
6064
- * Code for the EQUAL_SIGN key.
6065
- * @property KEY_EQUAL_SIGN
6066
- * @final
6067
- * @type {Number}
6068
- */_this37.KEY_EQUAL_SIGN=187;/**
6069
- * Code for the COMMA key.
6070
- * @property KEY_COMMA
6071
- * @final
6072
- * @type {Number}
6073
- */_this37.KEY_COMMA=188;/**
6074
- * Code for the DASH key.
6075
- * @property KEY_DASH
6076
- * @final
6077
- * @type {Number}
6078
- */_this37.KEY_DASH=189;/**
6079
- * Code for the PERIOD key.
6080
- * @property KEY_PERIOD
6081
- * @final
6082
- * @type {Number}
6083
- */_this37.KEY_PERIOD=190;/**
6084
- * Code for the FORWARD_SLASH key.
6085
- * @property KEY_FORWARD_SLASH
6086
- * @final
6087
- * @type {Number}
6088
- */_this37.KEY_FORWARD_SLASH=191;/**
6089
- * Code for the GRAVE_ACCENT key.
6090
- * @property KEY_GRAVE_ACCENT
6091
- * @final
6092
- * @type {Number}
6093
- */_this37.KEY_GRAVE_ACCENT=192;/**
6094
- * Code for the OPEN_BRACKET key.
6095
- * @property KEY_OPEN_BRACKET
6096
- * @final
6097
- * @type {Number}
6098
- */_this37.KEY_OPEN_BRACKET=219;/**
6099
- * Code for the BACK_SLASH key.
6100
- * @property KEY_BACK_SLASH
6101
- * @final
6102
- * @type {Number}
6103
- */_this37.KEY_BACK_SLASH=220;/**
6104
- * Code for the CLOSE_BRACKET key.
6105
- * @property KEY_CLOSE_BRACKET
6106
- * @final
6107
- * @type {Number}
6108
- */_this37.KEY_CLOSE_BRACKET=221;/**
6109
- * Code for the SINGLE_QUOTE key.
6110
- * @property KEY_SINGLE_QUOTE
6111
- * @final
6112
- * @type {Number}
6113
- */_this37.KEY_SINGLE_QUOTE=222;/**
6114
- * Code for the SPACE key.
6115
- * @property KEY_SPACE
6116
- * @final
6117
- * @type {Number}
6118
- */_this37.KEY_SPACE=32;/**
6119
- * The canvas element that mouse and keyboards are bound to.
6120
- *
6121
- * @final
6122
- * @type {HTMLCanvasElement}
6123
- */_this37.element=cfg.element;/** True whenever ALT key is down.
6124
- *
6125
- * @type {boolean}
6126
- */_this37.altDown=false;/** True whenever CTRL key is down.
6127
- *
6128
- * @type {boolean}
6129
- */_this37.ctrlDown=false;/** True whenever left mouse button is down.
6130
- *
6131
- * @type {boolean}
6132
- */_this37.mouseDownLeft=false;/**
6133
- * True whenever middle mouse button is down.
6134
- *
6135
- * @type {boolean}
6136
- */_this37.mouseDownMiddle=false;/**
6137
- * True whenever the right mouse button is down.
6138
- *
6139
- * @type {boolean}
6140
- */_this37.mouseDownRight=false;/**
6141
- * Flag for each key that's down.
6142
- *
6143
- * @type {boolean[]}
6144
- */_this37.keyDown=[];/** True while input enabled
6145
- *
6146
- * @type {boolean}
6147
- */_this37.enabled=true;/** True while keyboard input is enabled.
6148
- *
6149
- * Default value is ````true````.
6150
- *
6151
- * {@link CameraControl} will not respond to keyboard events while this is ````false````.
6152
- *
6153
- * @type {boolean}
6154
- */_this37.keyboardEnabled=true;/** True while the mouse is over the canvas.
6155
- *
6156
- * @type {boolean}
6157
- */_this37.mouseover=false;/**
6158
- * Current mouse position within the canvas.
6159
- * @type {Number[]}
5487
+ */this.destroy=function(){drawableTypeInfo={};drawables={};renderBufferManager.destroy();saoOcclusionRenderer.destroy();saoDepthLimitedBlurRenderer.destroy();if(this._occlusionTester){this._occlusionTester.destroy();}};};/**
5488
+ * @desc Meditates mouse, touch and keyboard events for various interaction controls.
5489
+ *
5490
+ * Ordinarily, you would only use this component as a utility to help manage input events and state for your
5491
+ * own custom input handlers.
5492
+ *
5493
+ * * Located at {@link Scene#input}
5494
+ * * Used by (at least) {@link CameraControl}
5495
+ *
5496
+ * ## Usage
5497
+ *
5498
+ * Subscribing to mouse events on the canvas:
5499
+ *
5500
+ * ````javascript
5501
+ * import {Viewer} from "xeokit-sdk.es.js";
5502
+ *
5503
+ * const viewer = new Viewer({
5504
+ * canvasId: "myCanvas"
5505
+ * });
5506
+ *
5507
+ * const input = viewer.scene.input;
5508
+ *
5509
+ * const onMouseDown = input.on("mousedown", (canvasCoords) => {
5510
+ * console.log("Mouse down at: x=" + canvasCoords[0] + ", y=" + coords[1]);
5511
+ * });
5512
+ *
5513
+ * const onMouseUp = input.on("mouseup", (canvasCoords) => {
5514
+ * console.log("Mouse up at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5515
+ * });
5516
+ *
5517
+ * const onMouseClicked = input.on("mouseclicked", (canvasCoords) => {
5518
+ * console.log("Mouse clicked at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5519
+ * });
5520
+ *
5521
+ * const onDblClick = input.on("dblclick", (canvasCoords) => {
5522
+ * console.log("Double-click at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5523
+ * });
5524
+ * ````
5525
+ *
5526
+ * Subscribing to keyboard events on the canvas:
5527
+ *
5528
+ * ````javascript
5529
+ * const onKeyDown = input.on("keydown", (keyCode) => {
5530
+ * switch (keyCode) {
5531
+ * case this.KEY_A:
5532
+ * console.log("The 'A' key is down");
5533
+ * break;
5534
+ *
5535
+ * case this.KEY_B:
5536
+ * console.log("The 'B' key is down");
5537
+ * break;
5538
+ *
5539
+ * case this.KEY_C:
5540
+ * console.log("The 'C' key is down");
5541
+ * break;
5542
+ *
5543
+ * default:
5544
+ * console.log("Some other key is down");
5545
+ * }
5546
+ * });
5547
+ *
5548
+ * const onKeyUp = input.on("keyup", (keyCode) => {
5549
+ * switch (keyCode) {
5550
+ * case this.KEY_A:
5551
+ * console.log("The 'A' key is up");
5552
+ * break;
5553
+ *
5554
+ * case this.KEY_B:
5555
+ * console.log("The 'B' key is up");
5556
+ * break;
5557
+ *
5558
+ * case this.KEY_C:
5559
+ * console.log("The 'C' key is up");
5560
+ * break;
5561
+ *
5562
+ * default:
5563
+ * console.log("Some other key is up");
5564
+ * }
5565
+ * });
5566
+ * ````
5567
+ *
5568
+ * Checking if keys are down:
5569
+ *
5570
+ * ````javascript
5571
+ * const isCtrlDown = input.ctrlDown;
5572
+ * const isAltDown = input.altDown;
5573
+ * const shiftDown = input.shiftDown;
5574
+ * //...
5575
+ *
5576
+ * const isAKeyDown = input.keyDown[input.KEY_A];
5577
+ * const isBKeyDown = input.keyDown[input.KEY_B];
5578
+ * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];
5579
+ * //...
5580
+ *
5581
+ * ````
5582
+ * Unsubscribing from events:
5583
+ *
5584
+ * ````javascript
5585
+ * input.off(onMouseDown);
5586
+ * input.off(onMouseUp);
5587
+ * //...
5588
+ * ````
5589
+ *
5590
+ * ## Disabling all events
5591
+ *
5592
+ * Event handling is enabled by default.
5593
+ *
5594
+ * To disable all events:
5595
+ *
5596
+ * ````javascript
5597
+ * myViewer.scene.input.setEnabled(false);
5598
+ * ````
5599
+ * To enable all events again:
5600
+ *
5601
+ * ````javascript
5602
+ * myViewer.scene.input.setEnabled(true);
5603
+ * ````
5604
+ *
5605
+ * ## Disabling keyboard input
5606
+ *
5607
+ * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need
5608
+ * to disable keyboard control, so that other UI elements can get those events.
5609
+ *
5610
+ * To disable keyboard events:
5611
+ *
5612
+ * ````javascript
5613
+ * myViewer.scene.input.setKeyboardEnabled(false);
5614
+ * ````
5615
+ *
5616
+ * To enable keyboard events again:
5617
+ *
5618
+ * ````javascript
5619
+ * myViewer.scene.input.setKeyboardEnabled(true)
5620
+ * ````
5621
+ */var Input=/*#__PURE__*/function(_Component9){/**
5622
+ * @private
5623
+ */function Input(owner){var _this37;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Input);_this37=_callSuper(this,Input,[owner,cfg]);/**
5624
+ * Code for the BACKSPACE key.
5625
+ * @property KEY_BACKSPACE
5626
+ * @final
5627
+ * @type {Number}
5628
+ */_this37.KEY_BACKSPACE=8;/**
5629
+ * Code for the TAB key.
5630
+ * @property KEY_TAB
5631
+ * @final
5632
+ * @type {Number}
5633
+ */_this37.KEY_TAB=9;/**
5634
+ * Code for the ENTER key.
5635
+ * @property KEY_ENTER
5636
+ * @final
5637
+ * @type {Number}
5638
+ */_this37.KEY_ENTER=13;/**
5639
+ * Code for the SHIFT key.
5640
+ * @property KEY_SHIFT
5641
+ * @final
5642
+ * @type {Number}
5643
+ */_this37.KEY_SHIFT=16;/**
5644
+ * Code for the CTRL key.
5645
+ * @property KEY_CTRL
5646
+ * @final
5647
+ * @type {Number}
5648
+ */_this37.KEY_CTRL=17;/**
5649
+ * Code for the ALT key.
5650
+ * @property KEY_ALT
5651
+ * @final
5652
+ * @type {Number}
5653
+ */_this37.KEY_ALT=18;/**
5654
+ * Code for the PAUSE_BREAK key.
5655
+ * @property KEY_PAUSE_BREAK
5656
+ * @final
5657
+ * @type {Number}
5658
+ */_this37.KEY_PAUSE_BREAK=19;/**
5659
+ * Code for the CAPS_LOCK key.
5660
+ * @property KEY_CAPS_LOCK
5661
+ * @final
5662
+ * @type {Number}
5663
+ */_this37.KEY_CAPS_LOCK=20;/**
5664
+ * Code for the ESCAPE key.
5665
+ * @property KEY_ESCAPE
5666
+ * @final
5667
+ * @type {Number}
5668
+ */_this37.KEY_ESCAPE=27;/**
5669
+ * Code for the PAGE_UP key.
5670
+ * @property KEY_PAGE_UP
5671
+ * @final
5672
+ * @type {Number}
5673
+ */_this37.KEY_PAGE_UP=33;/**
5674
+ * Code for the PAGE_DOWN key.
5675
+ * @property KEY_PAGE_DOWN
5676
+ * @final
5677
+ * @type {Number}
5678
+ */_this37.KEY_PAGE_DOWN=34;/**
5679
+ * Code for the END key.
5680
+ * @property KEY_END
5681
+ * @final
5682
+ * @type {Number}
5683
+ */_this37.KEY_END=35;/**
5684
+ * Code for the HOME key.
5685
+ * @property KEY_HOME
5686
+ * @final
5687
+ * @type {Number}
5688
+ */_this37.KEY_HOME=36;/**
5689
+ * Code for the LEFT_ARROW key.
5690
+ * @property KEY_LEFT_ARROW
5691
+ * @final
5692
+ * @type {Number}
5693
+ */_this37.KEY_LEFT_ARROW=37;/**
5694
+ * Code for the UP_ARROW key.
5695
+ * @property KEY_UP_ARROW
5696
+ * @final
5697
+ * @type {Number}
5698
+ */_this37.KEY_UP_ARROW=38;/**
5699
+ * Code for the RIGHT_ARROW key.
5700
+ * @property KEY_RIGHT_ARROW
5701
+ * @final
5702
+ * @type {Number}
5703
+ */_this37.KEY_RIGHT_ARROW=39;/**
5704
+ * Code for the DOWN_ARROW key.
5705
+ * @property KEY_DOWN_ARROW
5706
+ * @final
5707
+ * @type {Number}
5708
+ */_this37.KEY_DOWN_ARROW=40;/**
5709
+ * Code for the INSERT key.
5710
+ * @property KEY_INSERT
5711
+ * @final
5712
+ * @type {Number}
5713
+ */_this37.KEY_INSERT=45;/**
5714
+ * Code for the DELETE key.
5715
+ * @property KEY_DELETE
5716
+ * @final
5717
+ * @type {Number}
5718
+ */_this37.KEY_DELETE=46;/**
5719
+ * Code for the 0 key.
5720
+ * @property KEY_NUM_0
5721
+ * @final
5722
+ * @type {Number}
5723
+ */_this37.KEY_NUM_0=48;/**
5724
+ * Code for the 1 key.
5725
+ * @property KEY_NUM_1
5726
+ * @final
5727
+ * @type {Number}
5728
+ */_this37.KEY_NUM_1=49;/**
5729
+ * Code for the 2 key.
5730
+ * @property KEY_NUM_2
5731
+ * @final
5732
+ * @type {Number}
5733
+ */_this37.KEY_NUM_2=50;/**
5734
+ * Code for the 3 key.
5735
+ * @property KEY_NUM_3
5736
+ * @final
5737
+ * @type {Number}
5738
+ */_this37.KEY_NUM_3=51;/**
5739
+ * Code for the 4 key.
5740
+ * @property KEY_NUM_4
5741
+ * @final
5742
+ * @type {Number}
5743
+ */_this37.KEY_NUM_4=52;/**
5744
+ * Code for the 5 key.
5745
+ * @property KEY_NUM_5
5746
+ * @final
5747
+ * @type {Number}
5748
+ */_this37.KEY_NUM_5=53;/**
5749
+ * Code for the 6 key.
5750
+ * @property KEY_NUM_6
5751
+ * @final
5752
+ * @type {Number}
5753
+ */_this37.KEY_NUM_6=54;/**
5754
+ * Code for the 7 key.
5755
+ * @property KEY_NUM_7
5756
+ * @final
5757
+ * @type {Number}
5758
+ */_this37.KEY_NUM_7=55;/**
5759
+ * Code for the 8 key.
5760
+ * @property KEY_NUM_8
5761
+ * @final
5762
+ * @type {Number}
5763
+ */_this37.KEY_NUM_8=56;/**
5764
+ * Code for the 9 key.
5765
+ * @property KEY_NUM_9
5766
+ * @final
5767
+ * @type {Number}
5768
+ */_this37.KEY_NUM_9=57;/**
5769
+ * Code for the A key.
5770
+ * @property KEY_A
5771
+ * @final
5772
+ * @type {Number}
5773
+ */_this37.KEY_A=65;/**
5774
+ * Code for the B key.
5775
+ * @property KEY_B
5776
+ * @final
5777
+ * @type {Number}
5778
+ */_this37.KEY_B=66;/**
5779
+ * Code for the C key.
5780
+ * @property KEY_C
5781
+ * @final
5782
+ * @type {Number}
5783
+ */_this37.KEY_C=67;/**
5784
+ * Code for the D key.
5785
+ * @property KEY_D
5786
+ * @final
5787
+ * @type {Number}
5788
+ */_this37.KEY_D=68;/**
5789
+ * Code for the E key.
5790
+ * @property KEY_E
5791
+ * @final
5792
+ * @type {Number}
5793
+ */_this37.KEY_E=69;/**
5794
+ * Code for the F key.
5795
+ * @property KEY_F
5796
+ * @final
5797
+ * @type {Number}
5798
+ */_this37.KEY_F=70;/**
5799
+ * Code for the G key.
5800
+ * @property KEY_G
5801
+ * @final
5802
+ * @type {Number}
5803
+ */_this37.KEY_G=71;/**
5804
+ * Code for the H key.
5805
+ * @property KEY_H
5806
+ * @final
5807
+ * @type {Number}
5808
+ */_this37.KEY_H=72;/**
5809
+ * Code for the I key.
5810
+ * @property KEY_I
5811
+ * @final
5812
+ * @type {Number}
5813
+ */_this37.KEY_I=73;/**
5814
+ * Code for the J key.
5815
+ * @property KEY_J
5816
+ * @final
5817
+ * @type {Number}
5818
+ */_this37.KEY_J=74;/**
5819
+ * Code for the K key.
5820
+ * @property KEY_K
5821
+ * @final
5822
+ * @type {Number}
5823
+ */_this37.KEY_K=75;/**
5824
+ * Code for the L key.
5825
+ * @property KEY_L
5826
+ * @final
5827
+ * @type {Number}
5828
+ */_this37.KEY_L=76;/**
5829
+ * Code for the M key.
5830
+ * @property KEY_M
5831
+ * @final
5832
+ * @type {Number}
5833
+ */_this37.KEY_M=77;/**
5834
+ * Code for the N key.
5835
+ * @property KEY_N
5836
+ * @final
5837
+ * @type {Number}
5838
+ */_this37.KEY_N=78;/**
5839
+ * Code for the O key.
5840
+ * @property KEY_O
5841
+ * @final
5842
+ * @type {Number}
5843
+ */_this37.KEY_O=79;/**
5844
+ * Code for the P key.
5845
+ * @property KEY_P
5846
+ * @final
5847
+ * @type {Number}
5848
+ */_this37.KEY_P=80;/**
5849
+ * Code for the Q key.
5850
+ * @property KEY_Q
5851
+ * @final
5852
+ * @type {Number}
5853
+ */_this37.KEY_Q=81;/**
5854
+ * Code for the R key.
5855
+ * @property KEY_R
5856
+ * @final
5857
+ * @type {Number}
5858
+ */_this37.KEY_R=82;/**
5859
+ * Code for the S key.
5860
+ * @property KEY_S
5861
+ * @final
5862
+ * @type {Number}
5863
+ */_this37.KEY_S=83;/**
5864
+ * Code for the T key.
5865
+ * @property KEY_T
5866
+ * @final
5867
+ * @type {Number}
5868
+ */_this37.KEY_T=84;/**
5869
+ * Code for the U key.
5870
+ * @property KEY_U
5871
+ * @final
5872
+ * @type {Number}
5873
+ */_this37.KEY_U=85;/**
5874
+ * Code for the V key.
5875
+ * @property KEY_V
5876
+ * @final
5877
+ * @type {Number}
5878
+ */_this37.KEY_V=86;/**
5879
+ * Code for the W key.
5880
+ * @property KEY_W
5881
+ * @final
5882
+ * @type {Number}
5883
+ */_this37.KEY_W=87;/**
5884
+ * Code for the X key.
5885
+ * @property KEY_X
5886
+ * @final
5887
+ * @type {Number}
5888
+ */_this37.KEY_X=88;/**
5889
+ * Code for the Y key.
5890
+ * @property KEY_Y
5891
+ * @final
5892
+ * @type {Number}
5893
+ */_this37.KEY_Y=89;/**
5894
+ * Code for the Z key.
5895
+ * @property KEY_Z
5896
+ * @final
5897
+ * @type {Number}
5898
+ */_this37.KEY_Z=90;/**
5899
+ * Code for the LEFT_WINDOW key.
5900
+ * @property KEY_LEFT_WINDOW
5901
+ * @final
5902
+ * @type {Number}
5903
+ */_this37.KEY_LEFT_WINDOW=91;/**
5904
+ * Code for the RIGHT_WINDOW key.
5905
+ * @property KEY_RIGHT_WINDOW
5906
+ * @final
5907
+ * @type {Number}
5908
+ */_this37.KEY_RIGHT_WINDOW=92;/**
5909
+ * Code for the SELECT key.
5910
+ * @property KEY_SELECT
5911
+ * @final
5912
+ * @type {Number}
5913
+ */_this37.KEY_SELECT_KEY=93;/**
5914
+ * Code for the number pad 0 key.
5915
+ * @property KEY_NUMPAD_0
5916
+ * @final
5917
+ * @type {Number}
5918
+ */_this37.KEY_NUMPAD_0=96;/**
5919
+ * Code for the number pad 1 key.
5920
+ * @property KEY_NUMPAD_1
5921
+ * @final
5922
+ * @type {Number}
5923
+ */_this37.KEY_NUMPAD_1=97;/**
5924
+ * Code for the number pad 2 key.
5925
+ * @property KEY_NUMPAD 2
5926
+ * @final
5927
+ * @type {Number}
5928
+ */_this37.KEY_NUMPAD_2=98;/**
5929
+ * Code for the number pad 3 key.
5930
+ * @property KEY_NUMPAD_3
5931
+ * @final
5932
+ * @type {Number}
5933
+ */_this37.KEY_NUMPAD_3=99;/**
5934
+ * Code for the number pad 4 key.
5935
+ * @property KEY_NUMPAD_4
5936
+ * @final
5937
+ * @type {Number}
5938
+ */_this37.KEY_NUMPAD_4=100;/**
5939
+ * Code for the number pad 5 key.
5940
+ * @property KEY_NUMPAD_5
5941
+ * @final
5942
+ * @type {Number}
5943
+ */_this37.KEY_NUMPAD_5=101;/**
5944
+ * Code for the number pad 6 key.
5945
+ * @property KEY_NUMPAD_6
5946
+ * @final
5947
+ * @type {Number}
5948
+ */_this37.KEY_NUMPAD_6=102;/**
5949
+ * Code for the number pad 7 key.
5950
+ * @property KEY_NUMPAD_7
5951
+ * @final
5952
+ * @type {Number}
5953
+ */_this37.KEY_NUMPAD_7=103;/**
5954
+ * Code for the number pad 8 key.
5955
+ * @property KEY_NUMPAD_8
5956
+ * @final
5957
+ * @type {Number}
5958
+ */_this37.KEY_NUMPAD_8=104;/**
5959
+ * Code for the number pad 9 key.
5960
+ * @property KEY_NUMPAD_9
5961
+ * @final
5962
+ * @type {Number}
5963
+ */_this37.KEY_NUMPAD_9=105;/**
5964
+ * Code for the MULTIPLY key.
5965
+ * @property KEY_MULTIPLY
5966
+ * @final
5967
+ * @type {Number}
5968
+ */_this37.KEY_MULTIPLY=106;/**
5969
+ * Code for the ADD key.
5970
+ * @property KEY_ADD
5971
+ * @final
5972
+ * @type {Number}
5973
+ */_this37.KEY_ADD=107;/**
5974
+ * Code for the SUBTRACT key.
5975
+ * @property KEY_SUBTRACT
5976
+ * @final
5977
+ * @type {Number}
5978
+ */_this37.KEY_SUBTRACT=109;/**
5979
+ * Code for the DECIMAL POINT key.
5980
+ * @property KEY_DECIMAL_POINT
5981
+ * @final
5982
+ * @type {Number}
5983
+ */_this37.KEY_DECIMAL_POINT=110;/**
5984
+ * Code for the DIVIDE key.
5985
+ * @property KEY_DIVIDE
5986
+ * @final
5987
+ * @type {Number}
5988
+ */_this37.KEY_DIVIDE=111;/**
5989
+ * Code for the F1 key.
5990
+ * @property KEY_F1
5991
+ * @final
5992
+ * @type {Number}
5993
+ */_this37.KEY_F1=112;/**
5994
+ * Code for the F2 key.
5995
+ * @property KEY_F2
5996
+ * @final
5997
+ * @type {Number}
5998
+ */_this37.KEY_F2=113;/**
5999
+ * Code for the F3 key.
6000
+ * @property KEY_F3
6001
+ * @final
6002
+ * @type {Number}
6003
+ */_this37.KEY_F3=114;/**
6004
+ * Code for the F4 key.
6005
+ * @property KEY_F4
6006
+ * @final
6007
+ * @type {Number}
6008
+ */_this37.KEY_F4=115;/**
6009
+ * Code for the F5 key.
6010
+ * @property KEY_F5
6011
+ * @final
6012
+ * @type {Number}
6013
+ */_this37.KEY_F5=116;/**
6014
+ * Code for the F6 key.
6015
+ * @property KEY_F6
6016
+ * @final
6017
+ * @type {Number}
6018
+ */_this37.KEY_F6=117;/**
6019
+ * Code for the F7 key.
6020
+ * @property KEY_F7
6021
+ * @final
6022
+ * @type {Number}
6023
+ */_this37.KEY_F7=118;/**
6024
+ * Code for the F8 key.
6025
+ * @property KEY_F8
6026
+ * @final
6027
+ * @type {Number}
6028
+ */_this37.KEY_F8=119;/**
6029
+ * Code for the F9 key.
6030
+ * @property KEY_F9
6031
+ * @final
6032
+ * @type {Number}
6033
+ */_this37.KEY_F9=120;/**
6034
+ * Code for the F10 key.
6035
+ * @property KEY_F10
6036
+ * @final
6037
+ * @type {Number}
6038
+ */_this37.KEY_F10=121;/**
6039
+ * Code for the F11 key.
6040
+ * @property KEY_F11
6041
+ * @final
6042
+ * @type {Number}
6043
+ */_this37.KEY_F11=122;/**
6044
+ * Code for the F12 key.
6045
+ * @property KEY_F12
6046
+ * @final
6047
+ * @type {Number}
6048
+ */_this37.KEY_F12=123;/**
6049
+ * Code for the NUM_LOCK key.
6050
+ * @property KEY_NUM_LOCK
6051
+ * @final
6052
+ * @type {Number}
6053
+ */_this37.KEY_NUM_LOCK=144;/**
6054
+ * Code for the SCROLL_LOCK key.
6055
+ * @property KEY_SCROLL_LOCK
6056
+ * @final
6057
+ * @type {Number}
6058
+ */_this37.KEY_SCROLL_LOCK=145;/**
6059
+ * Code for the SEMI_COLON key.
6060
+ * @property KEY_SEMI_COLON
6061
+ * @final
6062
+ * @type {Number}
6063
+ */_this37.KEY_SEMI_COLON=186;/**
6064
+ * Code for the EQUAL_SIGN key.
6065
+ * @property KEY_EQUAL_SIGN
6066
+ * @final
6067
+ * @type {Number}
6068
+ */_this37.KEY_EQUAL_SIGN=187;/**
6069
+ * Code for the COMMA key.
6070
+ * @property KEY_COMMA
6071
+ * @final
6072
+ * @type {Number}
6073
+ */_this37.KEY_COMMA=188;/**
6074
+ * Code for the DASH key.
6075
+ * @property KEY_DASH
6076
+ * @final
6077
+ * @type {Number}
6078
+ */_this37.KEY_DASH=189;/**
6079
+ * Code for the PERIOD key.
6080
+ * @property KEY_PERIOD
6081
+ * @final
6082
+ * @type {Number}
6083
+ */_this37.KEY_PERIOD=190;/**
6084
+ * Code for the FORWARD_SLASH key.
6085
+ * @property KEY_FORWARD_SLASH
6086
+ * @final
6087
+ * @type {Number}
6088
+ */_this37.KEY_FORWARD_SLASH=191;/**
6089
+ * Code for the GRAVE_ACCENT key.
6090
+ * @property KEY_GRAVE_ACCENT
6091
+ * @final
6092
+ * @type {Number}
6093
+ */_this37.KEY_GRAVE_ACCENT=192;/**
6094
+ * Code for the OPEN_BRACKET key.
6095
+ * @property KEY_OPEN_BRACKET
6096
+ * @final
6097
+ * @type {Number}
6098
+ */_this37.KEY_OPEN_BRACKET=219;/**
6099
+ * Code for the BACK_SLASH key.
6100
+ * @property KEY_BACK_SLASH
6101
+ * @final
6102
+ * @type {Number}
6103
+ */_this37.KEY_BACK_SLASH=220;/**
6104
+ * Code for the CLOSE_BRACKET key.
6105
+ * @property KEY_CLOSE_BRACKET
6106
+ * @final
6107
+ * @type {Number}
6108
+ */_this37.KEY_CLOSE_BRACKET=221;/**
6109
+ * Code for the SINGLE_QUOTE key.
6110
+ * @property KEY_SINGLE_QUOTE
6111
+ * @final
6112
+ * @type {Number}
6113
+ */_this37.KEY_SINGLE_QUOTE=222;/**
6114
+ * Code for the SPACE key.
6115
+ * @property KEY_SPACE
6116
+ * @final
6117
+ * @type {Number}
6118
+ */_this37.KEY_SPACE=32;/**
6119
+ * The canvas element that mouse and keyboards are bound to.
6120
+ *
6121
+ * @final
6122
+ * @type {HTMLCanvasElement}
6123
+ */_this37.element=cfg.element;/** True whenever ALT key is down.
6124
+ *
6125
+ * @type {boolean}
6126
+ */_this37.altDown=false;/** True whenever CTRL key is down.
6127
+ *
6128
+ * @type {boolean}
6129
+ */_this37.ctrlDown=false;/** True whenever left mouse button is down.
6130
+ *
6131
+ * @type {boolean}
6132
+ */_this37.mouseDownLeft=false;/**
6133
+ * True whenever middle mouse button is down.
6134
+ *
6135
+ * @type {boolean}
6136
+ */_this37.mouseDownMiddle=false;/**
6137
+ * True whenever the right mouse button is down.
6138
+ *
6139
+ * @type {boolean}
6140
+ */_this37.mouseDownRight=false;/**
6141
+ * Flag for each key that's down.
6142
+ *
6143
+ * @type {boolean[]}
6144
+ */_this37.keyDown=[];/** True while input enabled
6145
+ *
6146
+ * @type {boolean}
6147
+ */_this37.enabled=true;/** True while keyboard input is enabled.
6148
+ *
6149
+ * Default value is ````true````.
6150
+ *
6151
+ * {@link CameraControl} will not respond to keyboard events while this is ````false````.
6152
+ *
6153
+ * @type {boolean}
6154
+ */_this37.keyboardEnabled=true;/** True while the mouse is over the canvas.
6155
+ *
6156
+ * @type {boolean}
6157
+ */_this37.mouseover=false;/**
6158
+ * Current mouse position within the canvas.
6159
+ * @type {Number[]}
6160
6160
  */_this37.mouseCanvasPos=math.vec2();_this37.touchCanvasPos=math.vec2();_this37._keyboardEventsElement=cfg.keyboardEventsElement||document;_this37._bindEvents();return _this37;}_inherits(Input,_Component9);return _createClass(Input,[{key:"_bindEvents",value:function _bindEvents(){var _this38=this;if(this._eventsBound){return;}//keydown
6161
6161
  this._keyboardEventsElement.addEventListener("keydown",this._keyDownListener=function(e){if(!_this38.enabled||!_this38.keyboardEnabled){return;}if(e.target.tagName!=="INPUT"&&e.target.tagName!=="TEXTAREA"){if(e.keyCode===_this38.KEY_CTRL){_this38.ctrlDown=true;}else if(e.keyCode===_this38.KEY_ALT){_this38.altDown=true;}else if(e.keyCode===_this38.KEY_SHIFT){_this38.shiftDown=true;}_this38.keyDown[e.keyCode]=true;_this38.fire("keydown",e.keyCode,true);}},false);//keyup
6162
6162
  this._keyboardEventsElement.addEventListener("keyup",this._keyUpListener=function(e){if(!_this38.enabled||!_this38.keyboardEnabled){return;}if(e.target.tagName!=="INPUT"&&e.target.tagName!=="TEXTAREA"){if(e.keyCode===_this38.KEY_CTRL){_this38.ctrlDown=false;}else if(e.keyCode===_this38.KEY_ALT){_this38.altDown=false;}else if(e.keyCode===_this38.KEY_SHIFT){_this38.shiftDown=false;}_this38.keyDown[e.keyCode]=false;_this38.fire("keyup",e.keyCode,true);}});//mouseenter
@@ -6187,36 +6187,36 @@ this.element.addEventListener("touchmove",this._touchMoveListener=function(e){if
6187
6187
  tickifedMouseMoveFn();});// mouseclicked / touch
6188
6188
  {var downX;var downY;// Tolerance between down and up positions for a mouse click
6189
6189
  var tolerance=2;this.on("mousedown",function(params){downX=params[0];downY=params[1];});this.on("mouseup",function(params){if(downX>=params[0]-tolerance&&downX<=params[0]+tolerance&&downY>=params[1]-tolerance&&downY<=params[1]+tolerance){_this38.fire("mouseclicked",params,true);}});this.on("touchstart",function(params){downX=params[0];downY=params[1];});this.on("touchend",function(params){if(downX>=params[0]-tolerance&&downX<=params[0]+tolerance&&downY>=params[1]-tolerance&&downY<=params[1]+tolerance){_this38.fire("touchclicked",params,true);}});}this._eventsBound=true;}},{key:"_unbindEvents",value:function _unbindEvents(){if(!this._eventsBound){return;}this._keyboardEventsElement.removeEventListener("keydown",this._keyDownListener);this._keyboardEventsElement.removeEventListener("keyup",this._keyUpListener);this.element.removeEventListener("mouseenter",this._mouseEnterListener);this.element.removeEventListener("mouseleave",this._mouseLeaveListener);this.element.removeEventListener("mousedown",this._mouseDownListener);document.removeEventListener("mouseup",this._mouseDownListener);document.removeEventListener("click",this._clickListener);document.removeEventListener("dblclick",this._dblClickListener);this.element.removeEventListener("mousemove",this._mouseMoveListener);this.element.removeEventListener("wheel",this._mouseWheelListener);this.element.removeEventListener("touchstart",this._touchDownListener);document.removeEventListener("touchend",this._touchUpListener);document.removeEventListener("touchcancel",this._touchUpListener);this.element.removeEventListener("touchmove",this._touchMoveListener);if(window.OrientationChangeEvent){window.removeEventListener("orientationchange",this._orientationchangedListener);}if(window.DeviceMotionEvent){window.removeEventListener("devicemotion",this._deviceMotionListener);}if(window.DeviceOrientationEvent){window.removeEventListener("deviceorientation",this._deviceOrientListener);}this._eventsBound=false;}},{key:"_getMouseCanvasPos",value:function _getMouseCanvasPos(event){if(!event){event=window.event;this.mouseCanvasPos[0]=event.x;this.mouseCanvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}this.mouseCanvasPos[0]=event.pageX-totalOffsetLeft;this.mouseCanvasPos[1]=event.pageY-totalOffsetTop;}}},{key:"_getTouchCanvasPos",value:function _getTouchCanvasPos(event){if(!event||!event.touches||event.touches.length===0){return;}var touch=event.touches[0];// 获取第一个触摸点的信息
6190
- var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}this.mouseCanvasPos[0]=touch.pageX-totalOffsetLeft;this.mouseCanvasPos[1]=touch.pageY-totalOffsetTop;}/**
6191
- * Sets whether input handlers are enabled.
6192
- *
6193
- * Default value is ````true````.
6194
- *
6195
- * @param {Boolean} enable Indicates if input handlers are enabled.
6196
- */},{key:"setEnabled",value:function setEnabled(enable){if(this.enabled!==enable){this.fire("enabled",this.enabled=enable);}}/**
6197
- * Gets whether input handlers are enabled.
6198
- *
6199
- * Default value is ````true````.
6200
- *
6201
- * @returns {Boolean} Indicates if input handlers are enabled.
6202
- */},{key:"getEnabled",value:function getEnabled(){return this.enabled;}/**
6203
- * Sets whether or not keyboard input is enabled.
6204
- *
6205
- * Default value is ````true````.
6206
- *
6207
- * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6208
- *
6209
- * @param {Boolean} value Indicates whether keyboard input is enabled.
6210
- */},{key:"setKeyboardEnabled",value:function setKeyboardEnabled(value){this.keyboardEnabled=value;}/**
6211
- * Gets whether keyboard input is enabled.
6212
- *
6213
- * Default value is ````true````.
6214
- *
6215
- * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6216
- *
6217
- * @returns {Boolean} Returns whether keyboard input is enabled.
6218
- */},{key:"getKeyboardEnabled",value:function getKeyboardEnabled(){return this.keyboardEnabled;}/**
6219
- * @private
6190
+ var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}this.mouseCanvasPos[0]=touch.pageX-totalOffsetLeft;this.mouseCanvasPos[1]=touch.pageY-totalOffsetTop;}/**
6191
+ * Sets whether input handlers are enabled.
6192
+ *
6193
+ * Default value is ````true````.
6194
+ *
6195
+ * @param {Boolean} enable Indicates if input handlers are enabled.
6196
+ */},{key:"setEnabled",value:function setEnabled(enable){if(this.enabled!==enable){this.fire("enabled",this.enabled=enable);}}/**
6197
+ * Gets whether input handlers are enabled.
6198
+ *
6199
+ * Default value is ````true````.
6200
+ *
6201
+ * @returns {Boolean} Indicates if input handlers are enabled.
6202
+ */},{key:"getEnabled",value:function getEnabled(){return this.enabled;}/**
6203
+ * Sets whether or not keyboard input is enabled.
6204
+ *
6205
+ * Default value is ````true````.
6206
+ *
6207
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6208
+ *
6209
+ * @param {Boolean} value Indicates whether keyboard input is enabled.
6210
+ */},{key:"setKeyboardEnabled",value:function setKeyboardEnabled(value){this.keyboardEnabled=value;}/**
6211
+ * Gets whether keyboard input is enabled.
6212
+ *
6213
+ * Default value is ````true````.
6214
+ *
6215
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6216
+ *
6217
+ * @returns {Boolean} Returns whether keyboard input is enabled.
6218
+ */},{key:"getKeyboardEnabled",value:function getKeyboardEnabled(){return this.keyboardEnabled;}/**
6219
+ * @private
6220
6220
  */},{key:"destroy",value:function destroy(){_superPropGet(Input,"destroy",this,3)([]);this._unbindEvents();}}]);}(Component);var ids$3=new Map({});/**
6221
6221
  * @desc Represents a chunk of state changes applied by the {@link Scene}'s renderer while it renders a frame.
6222
6222
  *
@@ -6703,7 +6703,7 @@ _this42.left=cfg.left;_this42.right=cfg.right;_this42.bottom=cfg.bottom;_this42.
6703
6703
  * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.
6704
6704
  */},{key:"unproject",value:function unproject(canvasPos,screenZ,screenPos,viewPos,worldPos){var canvas=this.scene.canvas.canvas;var halfCanvasWidth=canvas.offsetWidth/2.0;var halfCanvasHeight=canvas.offsetHeight/2.0;screenPos[0]=(canvasPos[0]-halfCanvasWidth)/halfCanvasWidth;screenPos[1]=(canvasPos[1]-halfCanvasHeight)/halfCanvasHeight;screenPos[2]=screenZ;screenPos[3]=1.0;math.mulMat4v4(this.inverseMatrix,screenPos,viewPos);math.mulVec3Scalar(viewPos,1.0/viewPos[3]);viewPos[3]=1.0;viewPos[1]*=-1;math.mulMat4v4(this.camera.inverseViewMatrix,viewPos,worldPos);return worldPos;}/** @private
6705
6705
  *
6706
- */},{key:"destroy",value:function destroy(){_superPropGet(CustomProjection,"destroy",this,3)([]);this._state.destroy();}}]);}(Component);var tempVec3$4=math.vec3();var tempVec3b$w=math.vec3();var tempVec3c$s=math.vec3();var tempVec3d$d=math.vec3();var tempVec3e$2=math.vec3();var tempVec3f$2=math.vec3();var tempVec4a$6=math.vec4();var tempVec4b$3=math.vec4();var tempVec4c$2=math.vec4();var tempMat=math.mat4();var tempMatb=math.mat4();var eyeLookVec=math.vec3();var eyeLookVecNorm=math.vec3();var eyeLookOffset=math.vec3();var offsetEye=math.vec3();/**
6706
+ */},{key:"destroy",value:function destroy(){_superPropGet(CustomProjection,"destroy",this,3)([]);this._state.destroy();}}]);}(Component);var tempVec3$4=math.vec3();var tempVec3b$w=math.vec3();var tempVec3c$s=math.vec3();var tempVec3d$d=math.vec3();var tempVec3e$2=math.vec3();var tempVec3f$2=math.vec3();var tempVec4a$7=math.vec4();var tempVec4b$4=math.vec4();var tempVec4c$2=math.vec4();var tempMat=math.mat4();var tempMatb=math.mat4();var eyeLookVec=math.vec3();var eyeLookVecNorm=math.vec3();var eyeLookOffset=math.vec3();var offsetEye=math.vec3();/**
6707
6707
  * @desc Manages viewing and projection transforms for its {@link Scene}.
6708
6708
  *
6709
6709
  * * One Camera per {@link Scene}
@@ -7145,7 +7145,7 @@ this.fire("dirty");this.fire("projection",this._projectionType);this.fire("projM
7145
7145
  *
7146
7146
  * @param {[number, number, number]} worldPos
7147
7147
  * @returns {[number, number]} the canvas position
7148
- */},{key:"projectWorldPos",value:function projectWorldPos(worldPos){var _worldPos=tempVec4a$6;var viewPos=tempVec4b$3;var screenPos=tempVec4c$2;_worldPos[0]=worldPos[0];_worldPos[1]=worldPos[1];_worldPos[2]=worldPos[2];_worldPos[3]=1;math.mulMat4v4(this.viewMatrix,_worldPos,viewPos);math.mulMat4v4(this.projMatrix,viewPos,screenPos);math.mulVec3Scalar(screenPos,1.0/screenPos[3]);screenPos[3]=1.0;screenPos[1]*=-1;var canvas=this.scene.canvas.canvas;var halfCanvasWidth=canvas.offsetWidth/2.0;var halfCanvasHeight=canvas.offsetHeight/2.0;var canvasPos=[screenPos[0]*halfCanvasWidth+halfCanvasWidth,screenPos[1]*halfCanvasHeight+halfCanvasHeight];return canvasPos;}/**
7148
+ */},{key:"projectWorldPos",value:function projectWorldPos(worldPos){var _worldPos=tempVec4a$7;var viewPos=tempVec4b$4;var screenPos=tempVec4c$2;_worldPos[0]=worldPos[0];_worldPos[1]=worldPos[1];_worldPos[2]=worldPos[2];_worldPos[3]=1;math.mulMat4v4(this.viewMatrix,_worldPos,viewPos);math.mulMat4v4(this.projMatrix,viewPos,screenPos);math.mulVec3Scalar(screenPos,1.0/screenPos[3]);screenPos[3]=1.0;screenPos[1]*=-1;var canvas=this.scene.canvas.canvas;var halfCanvasWidth=canvas.offsetWidth/2.0;var halfCanvasHeight=canvas.offsetHeight/2.0;var canvasPos=[screenPos[0]*halfCanvasWidth+halfCanvasWidth,screenPos[1]*halfCanvasHeight+halfCanvasHeight];return canvasPos;}/**
7149
7149
  * Destroys this Camera.
7150
7150
  */},{key:"destroy",value:function destroy(){_superPropGet(Camera,"destroy",this,3)([]);this._state.destroy();}}]);}(Component);/**
7151
7151
  * @desc A dynamic light source within a {@link Scene}.
@@ -8163,7 +8163,7 @@ if(this._normalMap){hash.push("/nm");if(this._normalMap.hasMatrix){hash.push("/m
8163
8163
  * @type {String}
8164
8164
  */function get(){return this._state.frontface?"ccw":"cw";}/**
8165
8165
  * Destroys this PhongMaterial.
8166
- */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8166
+ */,set:function set(value){value=value!=="cw";if(this._state.frontface===value){return;}this._state.frontface=value;this.glRedraw();}},{key:"destroy",value:function destroy(){_superPropGet(PhongMaterial,"destroy",this,3)([]);this._state.destroy();}}]);}(Material);var PRESETS$3={"default":{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultWhiteBG:{fill:true,fillColor:[1,1,1],fillAlpha:0.6,edgeColor:[0.2,0.2,0.2],edgeAlpha:1.0,edgeWidth:1},defaultLightBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.2,0.2,0.2],edgeAlpha:0.5,edgeWidth:1},defaultDarkBG:{fill:true,fillColor:[0.4,0.4,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.5,0.5,0.5],edgeAlpha:0.5,edgeWidth:1},phosphorous:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.4,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:2},sunset:{fill:true,fillColor:[0.9,0.9,0.6],fillAlpha:0.2,edges:true,edgeColor:[0.9,0.9,0.9],edgeAlpha:0.5,edgeWidth:1},vectorscope:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:0.7,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:2},battlezone:{fill:true,fillColor:[0.0,0.0,0.0],fillAlpha:1.0,edges:true,edgeColor:[0.2,1.0,0.2],edgeAlpha:1,edgeWidth:3},xraylightblue:{fill:true,fillColor:[0.2,0.3,0.4],fillAlpha:0.2,edges:true,edgeColor:[0.1,0.2,0.3],edgeAlpha:1.0,edgeWidth:1},blueHighlight:{fill:true,fillColor:[0.6,0.7,0.8],fillAlpha:0.2,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},greenSelected:{fill:true,fillColor:[0.0,1.0,0.0],fillAlpha:0.5,edges:true,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},blueSelected:{fill:true,fillColor:[0.2,0.6,0.9],fillAlpha:0.3,edges:false,edgeColor:[1.0,1.0,1.0],edgeAlpha:1.0,edgeWidth:1},gamegrid:{fill:true,fillColor:[0.2,0.2,0.7],fillAlpha:0.9,edges:true,edgeColor:[0.4,0.4,1.6],edgeAlpha:0.8,edgeWidth:3}};/**
8167
8167
  * Configures the appearance of {@link Entity}s when they are xrayed, highlighted or selected.
8168
8168
  *
8169
8169
  * * XRay an {@link Entity} by setting {@link Entity#xrayed} ````true````.
@@ -9584,7 +9584,7 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
9584
9584
  * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
9585
9585
  */function Scene(viewer){var _this57;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Scene);_this57=_callSuper(this,Scene,[null,cfg]);var canvas=cfg.canvasElement||document.getElementById(cfg.canvasId);if(!(canvas instanceof HTMLCanvasElement)){throw"Mandatory config expected: valid canvasId or canvasElement";}/**
9586
9586
  * @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
9587
- */_this57._tickifiedFunctions={};_this57._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this57._edgesEnabled=!!cfg.edgesEnabled;_this57._aabbDirty=true;_this57._aabbUpdate=false;/**
9587
+ */_this57._tickifiedFunctions={};_this57._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this57._edgesEnabled=!!cfg.edgesEnabled;_this57._aabbDirty=true;_this57._aabbUpdate=false;_this57._collideWithEntity=false;/**
9588
9588
  * The {@link Viewer} this Scene belongs to.
9589
9589
  * @type {Viewer}
9590
9590
  */_this57.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
@@ -10108,7 +10108,7 @@ dontClear:true});}/**
10108
10108
  * {@link Mesh}s are highlighted while {@link Mesh#highlighted} is ````true````.
10109
10109
  *
10110
10110
  * @type {EmphasisMaterial}
10111
- */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"greenSelected",dontClear:true});}/**
10111
+ */},{key:"selectedMaterial",get:function get(){return this.components["default.selectedMaterial"]||new EmphasisMaterial(this,{id:"default.selectedMaterial",preset:"blueSelected",dontClear:true});}/**
10112
10112
  * Gets the default {@link EdgeMaterial} for this Scene.
10113
10113
  *
10114
10114
  * Has {@link EdgeMaterial#id} set to "default.edgeMaterial".
@@ -11644,224 +11644,224 @@ if(p===UnsignedInt248Type){return gl.UNSIGNED_INT_24_8;}if(p===RepeatWrapping){r
11644
11644
  if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.flipY!==undefined){this.flipY=props.flipY;}if(props.premultiplyAlpha!==undefined){this.premultiplyAlpha=props.premultiplyAlpha;}if(props.unpackAlignment!==undefined){this.unpackAlignment=props.unpackAlignment;}if(props.minFilter!==undefined){this.minFilter=props.minFilter;}if(props.magFilter!==undefined){this.magFilter=props.magFilter;}if(props.wrapS!==undefined){this.wrapS=props.wrapS;}if(props.wrapT!==undefined){this.wrapT=props.wrapT;}if(props.wrapR!==undefined){this.wrapR=props.wrapR;}gl.activeTexture(gl.TEXTURE0+0);gl.bindTexture(this.target,this.texture);var supportsMips=mipmaps.length>1;gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,this.flipY);gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,this.premultiplyAlpha);gl.pixelStorei(gl.UNPACK_ALIGNMENT,this.unpackAlignment);gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL,gl.NONE);var wrapS=convertConstant(gl,this.wrapS);if(wrapS){gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}var wrapT=convertConstant(gl,this.wrapT);if(wrapT){gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}if(this.type===gl.TEXTURE_3D||this.type===gl.TEXTURE_2D_ARRAY){var wrapR=convertConstant(gl,this.wrapR);if(wrapR){gl.texParameteri(this.target,gl.TEXTURE_WRAP_R,wrapR);}gl.texParameteri(this.type,gl.TEXTURE_WRAP_R,wrapR);}if(supportsMips){gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,filterFallback(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,filterFallback(gl,this.magFilter));}else{gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,convertConstant(gl,this.minFilter));gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,convertConstant(gl,this.magFilter));}var glFormat=convertConstant(gl,this.format,this.encoding);var glType=convertConstant(gl,this.type);var glInternalFormat=getInternalFormat(gl,this.internalFormat,glFormat,glType,this.encoding,false);gl.texStorage2D(gl.TEXTURE_2D,levels,glInternalFormat,mipmaps[0].width,mipmaps[0].height);for(var _i127=0,len=mipmaps.length;_i127<len;_i127++){var mipmap=mipmaps[_i127];if(this.format!==RGBAFormat){if(glFormat!==null){gl.compressedTexSubImage2D(gl.TEXTURE_2D,_i127,0,0,mipmap.width,mipmap.height,glFormat,mipmap.data);}else{console.warn('Attempt to load unsupported compressed texture format in .setCompressedData()');}}else{gl.texSubImage2D(gl.TEXTURE_2D,_i127,0,0,mipmap.width,mipmap.height,glFormat,glType,mipmap.data);}}// if (generateMipMap) {
11645
11645
  // // gl.generateMipmap(this.target); // Only for roughness textures?
11646
11646
  // }
11647
- gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.minFilter;gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11648
- * @desc A 2D texture map.
11649
- *
11650
- * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11651
- * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11652
- * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11653
- *
11654
- * ## Usage
11655
- *
11656
- * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11657
- *
11658
- * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11659
- * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11660
- * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11661
- *
11662
- * [[Run this example](/examples/#materials_Texture)]
11663
- *
11664
- * ```` javascript
11665
- * import {Viewer, Mesh, buildTorusGeometry,
11666
- * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11667
- *
11668
- * const viewer = new Viewer({
11669
- * canvasId: "myCanvas"
11670
- * });
11671
- *
11672
- * viewer.camera.eye = [0, 0, 5];
11673
- * viewer.camera.look = [0, 0, 0];
11674
- * viewer.camera.up = [0, 1, 0];
11675
- *
11676
- * new Mesh(viewer.scene, {
11677
- * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11678
- * center: [0, 0, 0],
11679
- * radius: 1.5,
11680
- * tube: 0.5,
11681
- * radialSegments: 32,
11682
- * tubeSegments: 24,
11683
- * arc: Math.PI * 2.0
11684
- * }),
11685
- * material: new PhongMaterial(viewer.scene, {
11686
- * ambient: [0.9, 0.3, 0.9],
11687
- * shininess: 30,
11688
- * diffuseMap: new Texture(viewer.scene, {
11689
- * src: "textures/diffuse/uvGrid2.jpg"
11690
- * })
11691
- * })
11692
- * });
11693
- *````
11694
- */var Texture=/*#__PURE__*/function(_Component23){/**
11695
- * @constructor
11696
- * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11697
- * @param {*} [cfg] Configs
11698
- * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11699
- * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11700
- * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11701
- * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11702
- * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11703
- * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11704
- * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11705
- * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11706
- * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11707
- * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11708
- * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11709
- * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11710
- * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11647
+ gl.bindTexture(this.target,null);}},{key:"setProps",value:function setProps(props){var gl=this.gl;gl.bindTexture(this.target,this.texture);this._uploadProps(props);gl.bindTexture(this.target,null);}},{key:"_uploadProps",value:function _uploadProps(props){var gl=this.gl;if(props.format!==undefined){this.format=props.format;}if(props.internalFormat!==undefined){this.internalFormat=props.internalFormat;}if(props.encoding!==undefined){this.encoding=props.encoding;}if(props.type!==undefined){this.type=props.type;}if(props.minFilter!==undefined){var minFilter=convertConstant(gl,props.minFilter);if(minFilter){this.minFilter=props.minFilter;gl.texParameteri(this.target,gl.TEXTURE_MIN_FILTER,minFilter);if(minFilter===gl.NEAREST_MIPMAP_NEAREST||minFilter===gl.LINEAR_MIPMAP_NEAREST||minFilter===gl.NEAREST_MIPMAP_LINEAR||minFilter===gl.LINEAR_MIPMAP_LINEAR){gl.generateMipmap(this.target);}}}if(props.magFilter!==undefined){var magFilter=convertConstant(gl,props.magFilter);if(magFilter){this.magFilter=props.magFilter;gl.texParameteri(this.target,gl.TEXTURE_MAG_FILTER,magFilter);}}if(props.wrapS!==undefined){var wrapS=convertConstant(gl,props.wrapS);if(wrapS){this.wrapS=props.wrapS;gl.texParameteri(this.target,gl.TEXTURE_WRAP_S,wrapS);}}if(props.wrapT!==undefined){var wrapT=convertConstant(gl,props.wrapT);if(wrapT){this.wrapT=props.wrapT;gl.texParameteri(this.target,gl.TEXTURE_WRAP_T,wrapT);}}}},{key:"bind",value:function bind(unit){if(!this.allocated){return;}if(this.texture){var _gl2=this.gl;_gl2.activeTexture(_gl2["TEXTURE"+unit]);_gl2.bindTexture(this.target,this.texture);return true;}return false;}},{key:"unbind",value:function unbind(unit){if(!this.allocated){return;}if(this.texture){var _gl3=this.gl;_gl3.activeTexture(_gl3["TEXTURE"+unit]);_gl3.bindTexture(this.target,null);}}},{key:"destroy",value:function destroy(){if(!this.allocated){return;}if(this.texture){this.gl.deleteTexture(this.texture);this.texture=null;}}}]);}();function getInternalFormat(gl,internalFormatName,glFormat,glType,encoding){var isVideoTexture=arguments.length>5&&arguments[5]!==undefined?arguments[5]:false;if(internalFormatName!==null){if(gl[internalFormatName]!==undefined){return gl[internalFormatName];}console.warn('Attempt to use non-existing WebGL internal format \''+internalFormatName+'\'');}var internalFormat=glFormat;if(glFormat===gl.RED){if(glType===gl.FLOAT)internalFormat=gl.R32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.R16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.R8;}if(glFormat===gl.RG){if(glType===gl.FLOAT)internalFormat=gl.RG32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RG16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=gl.RG8;}if(glFormat===gl.RGBA){if(glType===gl.FLOAT)internalFormat=gl.RGBA32F;if(glType===gl.HALF_FLOAT)internalFormat=gl.RGBA16F;if(glType===gl.UNSIGNED_BYTE)internalFormat=encoding===sRGBEncoding&&isVideoTexture===false?gl.SRGB8_ALPHA8:gl.RGBA8;if(glType===gl.UNSIGNED_SHORT_4_4_4_4)internalFormat=gl.RGBA4;if(glType===gl.UNSIGNED_SHORT_5_5_5_1)internalFormat=gl.RGB5_A1;}if(internalFormat===gl.R16F||internalFormat===gl.R32F||internalFormat===gl.RG16F||internalFormat===gl.RG32F||internalFormat===gl.RGBA16F||internalFormat===gl.RGBA32F){getExtension(gl,'EXT_color_buffer_float');}return internalFormat;}function filterFallback(gl,f){if(f===NearestFilter||f===NearestMipmapNearestFilter||f===NearestMipmapLinearFilter){return gl.NEAREST;}return gl.LINEAR;}function ensureImageSizePowerOfTwo$1(image){if(!isPowerOfTwo$1(image.width)||!isPowerOfTwo$1(image.height)){var _canvas3=document.createElement("canvas");_canvas3.width=nextHighestPowerOfTwo$1(image.width);_canvas3.height=nextHighestPowerOfTwo$1(image.height);var ctx=_canvas3.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas3.width,_canvas3.height);image=_canvas3;}return image;}function isPowerOfTwo$1(x){return(x&x-1)===0;}function nextHighestPowerOfTwo$1(x){--x;for(var _i128=1;_i128<32;_i128<<=1){x=x|x>>_i128;}return x+1;}/**
11648
+ * @desc A 2D texture map.
11649
+ *
11650
+ * * Textures are attached to {@link Material}s, which are attached to {@link Mesh}es.
11651
+ * * To create a Texture from an image file, set {@link Texture#src} to the image file path.
11652
+ * * To create a Texture from an HTMLImageElement, set the Texture's {@link Texture#image} to the HTMLImageElement.
11653
+ *
11654
+ * ## Usage
11655
+ *
11656
+ * In this example we have a Mesh with a {@link PhongMaterial} which applies diffuse {@link Texture}, and a {@link buildTorusGeometry} which builds a {@link ReadableGeometry}.
11657
+ *
11658
+ * Note that xeokit will ignore {@link PhongMaterial#diffuse} and {@link PhongMaterial#specular}, since we override those
11659
+ * with {@link PhongMaterial#diffuseMap} and {@link PhongMaterial#specularMap}. The {@link Texture} pixel colors directly
11660
+ * provide the diffuse and specular components for each fragment across the {@link ReadableGeometry} surface.
11661
+ *
11662
+ * [[Run this example](/examples/#materials_Texture)]
11663
+ *
11664
+ * ```` javascript
11665
+ * import {Viewer, Mesh, buildTorusGeometry,
11666
+ * ReadableGeometry, PhongMaterial, Texture} from "xeokit-sdk.es.js";
11667
+ *
11668
+ * const viewer = new Viewer({
11669
+ * canvasId: "myCanvas"
11670
+ * });
11671
+ *
11672
+ * viewer.camera.eye = [0, 0, 5];
11673
+ * viewer.camera.look = [0, 0, 0];
11674
+ * viewer.camera.up = [0, 1, 0];
11675
+ *
11676
+ * new Mesh(viewer.scene, {
11677
+ * geometry: new ReadableGeometry(viewer.scene, buildTorusGeometry({
11678
+ * center: [0, 0, 0],
11679
+ * radius: 1.5,
11680
+ * tube: 0.5,
11681
+ * radialSegments: 32,
11682
+ * tubeSegments: 24,
11683
+ * arc: Math.PI * 2.0
11684
+ * }),
11685
+ * material: new PhongMaterial(viewer.scene, {
11686
+ * ambient: [0.9, 0.3, 0.9],
11687
+ * shininess: 30,
11688
+ * diffuseMap: new Texture(viewer.scene, {
11689
+ * src: "textures/diffuse/uvGrid2.jpg"
11690
+ * })
11691
+ * })
11692
+ * });
11693
+ *````
11694
+ */var Texture=/*#__PURE__*/function(_Component23){/**
11695
+ * @constructor
11696
+ * @param {Component} owner Owner component. When destroyed, the owner will destroy this Texture as well.
11697
+ * @param {*} [cfg] Configs
11698
+ * @param {String} [cfg.id] Optional ID for this Texture, unique among all components in the parent scene, generated automatically when omitted.
11699
+ * @param {String} [cfg.src=null] Path to image file to load into this Texture. See the {@link Texture#src} property for more info.
11700
+ * @param {HTMLImageElement} [cfg.image=null] HTML Image object to load into this Texture. See the {@link Texture#image} property for more info.
11701
+ * @param {Number} [cfg.minFilter=LinearMipmapLinearFilter] How the texture is sampled when a texel covers less than one pixel.
11702
+ * Supported values are {@link LinearMipmapLinearFilter}, {@link LinearMipMapNearestFilter}, {@link NearestMipMapNearestFilter}, {@link NearestMipMapLinearFilter} and {@link LinearMipMapLinearFilter}.
11703
+ * @param {Number} [cfg.magFilter=LinearFilter] How the texture is sampled when a texel covers more than one pixel. Supported values are {@link LinearFilter} and {@link NearestFilter}.
11704
+ * @param {Number} [cfg.wrapS=RepeatWrapping] Wrap parameter for texture coordinate *S*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}.
11705
+ * @param {Number} [cfg.wrapT=RepeatWrapping] Wrap parameter for texture coordinate *T*. Supported values are {@link ClampToEdgeWrapping}, {@link MirroredRepeatWrapping} and {@link RepeatWrapping}..
11706
+ * @param {Boolean} [cfg.flipY=false] Flips this Texture's source data along its vertical axis when ````true````.
11707
+ * @param {Number} [cfg.encoding=LinearEncoding] Encoding format. Supported values are {@link LinearEncoding} and {@link sRGBEncoding}.
11708
+ * @param {Number[]} [cfg.translate=[0,0]] 2D translation vector that will be added to texture's *S* and *T* coordinates.
11709
+ * @param {Number[]} [cfg.scale=[1,1]] 2D scaling vector that will be applied to texture's *S* and *T* coordinates.
11710
+ * @param {Number} [cfg.rotate=0] Rotation, in degrees, that will be applied to texture's *S* and *T* coordinates.
11711
11711
  */function Texture(owner){var _this59;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Texture);_this59=_callSuper(this,Texture,[owner,cfg]);_this59._state=new RenderState({texture:new Texture2D({gl:_this59.scene.canvas.gl}),matrix:math.identityMat4(),hasMatrix:cfg.translate&&(cfg.translate[0]!==0||cfg.translate[1]!==0)||!!cfg.rotate||cfg.scale&&(cfg.scale[0]!==0||cfg.scale[1]!==0),minFilter:_this59._checkMinFilter(cfg.minFilter||1008),magFilter:_this59._checkMagFilter(cfg.magFilter||1006),wrapS:_this59._checkWrapS(cfg.wrapS||1000),wrapT:_this59._checkWrapT(cfg.wrapT||1000),flipY:_this59._checkFlipY(cfg.flipY||1000),encoding:_this59._checkEncoding(cfg.encoding)});// Data source
11712
11712
  _this59._src=null;_this59._image=null;// Transformation
11713
11713
  _this59._translate=math.vec2([0,0]);_this59._scale=math.vec2([1,1]);_this59._rotate=math.vec2([0,0]);_this59._matrixDirty=false;// Transform
11714
11714
  _this59.translate=cfg.translate;_this59.scale=cfg.scale;_this59.rotate=cfg.rotate;// Data source
11715
11715
  if(cfg.src){_this59.src=cfg.src;// Image file
11716
11716
  }else if(cfg.image){_this59.image=cfg.image;// Image object
11717
- }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11718
- @private
11719
- */function get(){return"Texture";}},{key:"_checkMinFilter",value:function _checkMinFilter(value){value=value||LinearMipMapLinearFilter;if(value!==LinearFilter&&value!==LinearMipMapNearestFilter&&value!==LinearMipMapLinearFilter&&value!==NearestMipMapLinearFilter&&value!==NearestMipMapNearestFilter){this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, "+"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.");value=LinearMipMapLinearFilter;}return value;}},{key:"_checkMagFilter",value:function _checkMagFilter(value){value=value||LinearFilter;if(value!==LinearFilter&&value!==NearestFilter){this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");value=LinearFilter;}return value;}},{key:"_checkWrapS",value:function _checkWrapS(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkWrapT",value:function _checkWrapT(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this._state.texture=new Texture2D({gl:this.scene.canvas.gl});if(this._image){this.image=this._image;}else if(this._src){this.src=this._src;}}},{key:"_update",value:function _update(){var state=this._state;if(this._matrixDirty){var _matrix;var t;if(this._translate[0]!==0||this._translate[1]!==0){_matrix=math.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix);}if(this._scale[0]!==1||this._scale[1]!==1){t=math.scalingMat4v([this._scale[0],this._scale[1],1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(this._rotate!==0){t=math.rotationMat4v(this._rotate*0.0174532925,[0,0,1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(_matrix){state.matrix=_matrix;}this._matrixDirty=false;}this.glRedraw();}/**
11720
- * Sets an HTML DOM Image object to source this Texture from.
11721
- *
11722
- * Sets {@link Texture#src} null.
11723
- *
11724
- * @type {HTMLImageElement}
11725
- */},{key:"image",get:/**
11726
- * Gets HTML DOM Image object this Texture is sourced from, if any.
11727
- *
11728
- * Returns null if not set.
11729
- *
11730
- * @type {HTMLImageElement}
11731
- */function get(){return this._image;}/**
11732
- * Sets path to an image file to source this Texture from.
11733
- *
11734
- * Sets {@link Texture#image} null.
11735
- *
11736
- * @type {String}
11737
- */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11738
- * Gets path to the image file this Texture from, if any.
11739
- *
11740
- * Returns null if not set.
11741
- *
11742
- * @type {String}
11743
- */function get(){return this._src;}/**
11744
- * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11745
- *
11746
- * Default value is ````[0, 0]````.
11747
- *
11748
- * @type {Number[]}
11749
- */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11750
- * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
- *
11752
- * Default value is ````[0, 0]````.
11753
- *
11754
- * @type {Number[]}
11755
- */function get(){return this._translate;}/**
11756
- * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11757
- *
11758
- * Default value is ````[1, 1]````.
11759
- *
11760
- * @type {Number[]}
11761
- */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11762
- * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
- *
11764
- * Default value is ````[1, 1]````.
11765
- *
11766
- * @type {Number[]}
11767
- */function get(){return this._scale;}/**
11768
- * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11769
- *
11770
- * Default value is ````0````.
11771
- *
11772
- * @type {Number}
11773
- */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11774
- * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
- *
11776
- * Default value is ````0````.
11777
- *
11778
- * @type {Number}
11779
- */function get(){return this._rotate;}/**
11780
- * Gets how this Texture is sampled when a texel covers less than one pixel.
11781
- *
11782
- * Options are:
11783
- *
11784
- * * NearestFilter - Uses the value of the texture element that is nearest
11785
- * (in Manhattan distance) to the center of the pixel being textured.
11786
- *
11787
- * * LinearFilter - Uses the weighted average of the four texture elements that are
11788
- * closest to the center of the pixel being textured.
11789
- *
11790
- * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11791
- * size of the pixel being textured and uses the "nearest" criterion (the texture
11792
- * element nearest to the center of the pixel) to produce a texture value.
11793
- *
11794
- * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11795
- * the pixel being textured and uses the "linear" criterion (a weighted average of the
11796
- * four texture elements that are closest to the center of the pixel) to produce a
11797
- * texture value.
11798
- *
11799
- * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11800
- * match the size of the pixel being textured and uses the "nearest" criterion
11801
- * (the texture element nearest to the center of the pixel) to produce a texture
11802
- * value from each mipmap. The final texture value is a weighted average of those two
11803
- * values.
11804
- *
11805
- * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11806
- * of the pixel being textured and uses the "linear" criterion (a weighted average
11807
- * of the four texture elements that are closest to the center of the pixel) to
11808
- * produce a texture value from each mipmap. The final texture value is a weighted
11809
- * average of those two values.
11810
- *
11811
- * Default value is LinearMipMapLinearFilter.
11812
- *
11813
- * @type {Number}
11814
- */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11815
- * Gets how this Texture is sampled when a texel covers more than one pixel.
11816
- *
11817
- * * NearestFilter - Uses the value of the texture element that is nearest
11818
- * (in Manhattan distance) to the center of the pixel being textured.
11819
- * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11820
- * closest to the center of the pixel being textured.
11821
- *
11822
- * Default value is LinearMipMapLinearFilter.
11823
- *
11824
- * @type {Number}
11825
- */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11826
- * Gets the wrap parameter for this Texture's *S* coordinate.
11827
- *
11828
- * Values can be:
11829
- *
11830
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11831
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11832
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11833
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11834
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11835
- * fractional part, thereby creating a repeating pattern.
11836
- *
11837
- * Default value is RepeatWrapping.
11838
- *
11839
- * @type {Number}
11840
- */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11841
- * Gets the wrap parameter for this Texture's *T* coordinate.
11842
- *
11843
- * Values can be:
11844
- *
11845
- * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11846
- * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11847
- * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11848
- * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11849
- * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11850
- * fractional part, thereby creating a repeating pattern.
11851
- *
11852
- * Default value is RepeatWrapping.
11853
- *
11854
- * @type {Number}
11855
- */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11856
- * Gets if this Texture's source data is flipped along its vertical axis.
11857
- *
11858
- * @type {Number}
11859
- */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11860
- * Gets the Texture's encoding format.
11861
- *
11862
- * @type {Number}
11863
- */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11864
- * Destroys this Texture
11717
+ }stats.memory.textures++;return _this59;}_inherits(Texture,_Component23);return _createClass(Texture,[{key:"type",get:/**
11718
+ @private
11719
+ */function get(){return"Texture";}},{key:"_checkMinFilter",value:function _checkMinFilter(value){value=value||LinearMipMapLinearFilter;if(value!==LinearFilter&&value!==LinearMipMapNearestFilter&&value!==LinearMipMapLinearFilter&&value!==NearestMipMapLinearFilter&&value!==NearestMipMapNearestFilter){this.error("Unsupported value for 'minFilter' - supported values are LinearFilter, LinearMipMapNearestFilter, NearestMipMapNearestFilter, "+"NearestMipMapLinearFilter and LinearMipMapLinearFilter. Defaulting to LinearMipMapLinearFilter.");value=LinearMipMapLinearFilter;}return value;}},{key:"_checkMagFilter",value:function _checkMagFilter(value){value=value||LinearFilter;if(value!==LinearFilter&&value!==NearestFilter){this.error("Unsupported value for 'magFilter' - supported values are LinearFilter and NearestFilter. Defaulting to LinearFilter.");value=LinearFilter;}return value;}},{key:"_checkWrapS",value:function _checkWrapS(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapS' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkWrapT",value:function _checkWrapT(value){value=value||RepeatWrapping;if(value!==ClampToEdgeWrapping&&value!==MirroredRepeatWrapping&&value!==RepeatWrapping){this.error("Unsupported value for 'wrapT' - supported values are ClampToEdgeWrapping, MirroredRepeatWrapping and RepeatWrapping. Defaulting to RepeatWrapping.");value=RepeatWrapping;}return value;}},{key:"_checkFlipY",value:function _checkFlipY(value){return!!value;}},{key:"_checkEncoding",value:function _checkEncoding(value){value=value||LinearEncoding;if(value!==LinearEncoding&&value!==sRGBEncoding){this.error("Unsupported value for 'encoding' - supported values are LinearEncoding and sRGBEncoding. Defaulting to LinearEncoding.");value=LinearEncoding;}return value;}},{key:"_webglContextRestored",value:function _webglContextRestored(){this._state.texture=new Texture2D({gl:this.scene.canvas.gl});if(this._image){this.image=this._image;}else if(this._src){this.src=this._src;}}},{key:"_update",value:function _update(){var state=this._state;if(this._matrixDirty){var _matrix;var t;if(this._translate[0]!==0||this._translate[1]!==0){_matrix=math.translationMat4v([this._translate[0],this._translate[1],0],this._state.matrix);}if(this._scale[0]!==1||this._scale[1]!==1){t=math.scalingMat4v([this._scale[0],this._scale[1],1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(this._rotate!==0){t=math.rotationMat4v(this._rotate*0.0174532925,[0,0,1]);_matrix=_matrix?math.mulMat4(_matrix,t):t;}if(_matrix){state.matrix=_matrix;}this._matrixDirty=false;}this.glRedraw();}/**
11720
+ * Sets an HTML DOM Image object to source this Texture from.
11721
+ *
11722
+ * Sets {@link Texture#src} null.
11723
+ *
11724
+ * @type {HTMLImageElement}
11725
+ */},{key:"image",get:/**
11726
+ * Gets HTML DOM Image object this Texture is sourced from, if any.
11727
+ *
11728
+ * Returns null if not set.
11729
+ *
11730
+ * @type {HTMLImageElement}
11731
+ */function get(){return this._image;}/**
11732
+ * Sets path to an image file to source this Texture from.
11733
+ *
11734
+ * Sets {@link Texture#image} null.
11735
+ *
11736
+ * @type {String}
11737
+ */,set:function set(value){this._image=ensureImageSizePowerOfTwo$1(value);this._image.crossOrigin="Anonymous";this._state.texture.setImage(this._image,this._state);this._src=null;this.glRedraw();}},{key:"src",get:/**
11738
+ * Gets path to the image file this Texture from, if any.
11739
+ *
11740
+ * Returns null if not set.
11741
+ *
11742
+ * @type {String}
11743
+ */function get(){return this._src;}/**
11744
+ * Sets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11745
+ *
11746
+ * Default value is ````[0, 0]````.
11747
+ *
11748
+ * @type {Number[]}
11749
+ */,set:function set(src){this.scene.loading++;this.scene.canvas.spinner.processes++;var self=this;var image=new Image();image.onload=function(){image=ensureImageSizePowerOfTwo$1(image);self._state.texture.setImage(image,self._state);self.scene.loading--;self.glRedraw();self.scene.canvas.spinner.processes--;};image.src=src;this._src=src;this._image=null;}},{key:"translate",get:/**
11750
+ * Gets the 2D translation vector added to this Texture's *S* and *T* UV coordinates.
11751
+ *
11752
+ * Default value is ````[0, 0]````.
11753
+ *
11754
+ * @type {Number[]}
11755
+ */function get(){return this._translate;}/**
11756
+ * Sets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11757
+ *
11758
+ * Default value is ````[1, 1]````.
11759
+ *
11760
+ * @type {Number[]}
11761
+ */,set:function set(value){this._translate.set(value||[0,0]);this._matrixDirty=true;this._needUpdate();}},{key:"scale",get:/**
11762
+ * Gets the 2D scaling vector that will be applied to this Texture's *S* and *T* UV coordinates.
11763
+ *
11764
+ * Default value is ````[1, 1]````.
11765
+ *
11766
+ * @type {Number[]}
11767
+ */function get(){return this._scale;}/**
11768
+ * Sets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11769
+ *
11770
+ * Default value is ````0````.
11771
+ *
11772
+ * @type {Number}
11773
+ */,set:function set(value){this._scale.set(value||[1,1]);this._matrixDirty=true;this._needUpdate();}},{key:"rotate",get:/**
11774
+ * Gets the rotation angles, in degrees, that will be applied to this Texture's *S* and *T* UV coordinates.
11775
+ *
11776
+ * Default value is ````0````.
11777
+ *
11778
+ * @type {Number}
11779
+ */function get(){return this._rotate;}/**
11780
+ * Gets how this Texture is sampled when a texel covers less than one pixel.
11781
+ *
11782
+ * Options are:
11783
+ *
11784
+ * * NearestFilter - Uses the value of the texture element that is nearest
11785
+ * (in Manhattan distance) to the center of the pixel being textured.
11786
+ *
11787
+ * * LinearFilter - Uses the weighted average of the four texture elements that are
11788
+ * closest to the center of the pixel being textured.
11789
+ *
11790
+ * * NearestMipMapNearestFilter - Chooses the mipmap that most closely matches the
11791
+ * size of the pixel being textured and uses the "nearest" criterion (the texture
11792
+ * element nearest to the center of the pixel) to produce a texture value.
11793
+ *
11794
+ * * LinearMipMapNearestFilter - Chooses the mipmap that most closely matches the size of
11795
+ * the pixel being textured and uses the "linear" criterion (a weighted average of the
11796
+ * four texture elements that are closest to the center of the pixel) to produce a
11797
+ * texture value.
11798
+ *
11799
+ * * NearestMipMapLinearFilter - Chooses the two mipmaps that most closely
11800
+ * match the size of the pixel being textured and uses the "nearest" criterion
11801
+ * (the texture element nearest to the center of the pixel) to produce a texture
11802
+ * value from each mipmap. The final texture value is a weighted average of those two
11803
+ * values.
11804
+ *
11805
+ * * LinearMipMapLinearFilter - (default) - Chooses the two mipmaps that most closely match the size
11806
+ * of the pixel being textured and uses the "linear" criterion (a weighted average
11807
+ * of the four texture elements that are closest to the center of the pixel) to
11808
+ * produce a texture value from each mipmap. The final texture value is a weighted
11809
+ * average of those two values.
11810
+ *
11811
+ * Default value is LinearMipMapLinearFilter.
11812
+ *
11813
+ * @type {Number}
11814
+ */,set:function set(value){value=value||0;if(this._rotate===value){return;}this._rotate=value;this._matrixDirty=true;this._needUpdate();}},{key:"minFilter",get:function get(){return this._state.minFilter;}/**
11815
+ * Gets how this Texture is sampled when a texel covers more than one pixel.
11816
+ *
11817
+ * * NearestFilter - Uses the value of the texture element that is nearest
11818
+ * (in Manhattan distance) to the center of the pixel being textured.
11819
+ * * LinearFilter - (default) - Uses the weighted average of the four texture elements that are
11820
+ * closest to the center of the pixel being textured.
11821
+ *
11822
+ * Default value is LinearMipMapLinearFilter.
11823
+ *
11824
+ * @type {Number}
11825
+ */},{key:"magFilter",get:function get(){return this._state.magFilter;}/**
11826
+ * Gets the wrap parameter for this Texture's *S* coordinate.
11827
+ *
11828
+ * Values can be:
11829
+ *
11830
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11831
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11832
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11833
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11834
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11835
+ * fractional part, thereby creating a repeating pattern.
11836
+ *
11837
+ * Default value is RepeatWrapping.
11838
+ *
11839
+ * @type {Number}
11840
+ */},{key:"wrapS",get:function get(){return this._state.wrapS;}/**
11841
+ * Gets the wrap parameter for this Texture's *T* coordinate.
11842
+ *
11843
+ * Values can be:
11844
+ *
11845
+ * * ClampToEdgeWrapping - causes *S* coordinates to be clamped to the size of the texture.
11846
+ * * MirroredRepeatWrapping - causes the *S* coordinate to be set to the fractional part of the texture coordinate
11847
+ * if the integer part of *S* is even; if the integer part of *S* is odd, then the *S* texture coordinate is
11848
+ * set to *1 - frac ⁡ S* , where *frac ⁡ S* represents the fractional part of *S*.
11849
+ * * RepeatWrapping - (default) - causes the integer part of the *S* coordinate to be ignored; xeokit uses only the
11850
+ * fractional part, thereby creating a repeating pattern.
11851
+ *
11852
+ * Default value is RepeatWrapping.
11853
+ *
11854
+ * @type {Number}
11855
+ */},{key:"wrapT",get:function get(){return this._state.wrapT;}/**
11856
+ * Gets if this Texture's source data is flipped along its vertical axis.
11857
+ *
11858
+ * @type {Number}
11859
+ */},{key:"flipY",get:function get(){return this._state.flipY;}/**
11860
+ * Gets the Texture's encoding format.
11861
+ *
11862
+ * @type {Number}
11863
+ */},{key:"encoding",get:function get(){return this._state.encoding;}/**
11864
+ * Destroys this Texture
11865
11865
  */},{key:"destroy",value:function destroy(){_superPropGet(Texture,"destroy",this,3)([]);if(this._state.texture){this._state.texture.destroy();}this._state.destroy();stats.memory.textures--;}}]);}(Component);/**
11866
11866
  * @desc Creates a cylinder-shaped {@link Geometry}.
11867
11867
  *
@@ -13529,7 +13529,7 @@ this.setVisible(cfg.overviewVisible);}/** Called by SectionPlanesPlugin#createSe
13529
13529
  * @param {String} [cfg.id="SectionPlanes"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
13530
13530
  * @param {String} [cfg.overviewCanvasId] ID of a canvas element to display the overview.
13531
13531
  * @param {String} [cfg.overviewVisible=true] Initial visibility of the overview canvas.
13532
- */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13532
+ */function SectionPlanesPlugin(viewer){var _this73;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SectionPlanesPlugin);_this73=_callSuper(this,SectionPlanesPlugin,["SectionPlanes",viewer]);_this73._freeControls=[];_this73._sectionPlanes=viewer.scene.sectionPlanes;_this73._controls={};_this73._currentControl=null;_this73._shownControlId=null;_this73._shownControlIds=[];if(cfg.overviewCanvasId!==null&&cfg.overviewCanvasId!==undefined){var overviewCanvas=document.getElementById(cfg.overviewCanvasId);if(!overviewCanvas){_this73.warn("Can't find overview canvas: '"+cfg.overviewCanvasId+"' - will create plugin without overview");}else{_this73._overview=new Overview(_this73,{overviewCanvas:overviewCanvas,visible:cfg.overviewVisible,onHoverEnterPlane:function onHoverEnterPlane(id){_this73._overview.setPlaneHighlighted(id,true);},onHoverLeavePlane:function onHoverLeavePlane(id){_this73._overview.setPlaneHighlighted(id,false);},onClickedPlane:function onClickedPlane(id){if(_this73.getShownControl()===id){_this73.hideControl();return;}_this73.showControl(id);var sectionPlane=_this73.sectionPlanes[id];var sectionPlanePos=sectionPlane.pos;tempAABB$1.set(_this73.viewer.scene.aabb);math.getAABB3Center(tempAABB$1,tempVec3$3);tempAABB$1[0]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[1]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[2]+=sectionPlanePos[2]-tempVec3$3[2];tempAABB$1[3]+=sectionPlanePos[0]-tempVec3$3[0];tempAABB$1[4]+=sectionPlanePos[1]-tempVec3$3[1];tempAABB$1[5]+=sectionPlanePos[2]-tempVec3$3[2];_this73.viewer.cameraFlight.flyTo({aabb:tempAABB$1,fitFOV:65});},onClickedNothing:function onClickedNothing(){_this73.hideControl();}});}}_this73._onSceneSectionPlaneCreated=viewer.scene.on("sectionPlaneCreated",function(sectionPlane){// SectionPlane created, either via SectionPlanesPlugin#createSectionPlane(), or by directly
13533
13533
  // instantiating a SectionPlane independently of SectionPlanesPlugin, which can be done
13534
13534
  // by BCFViewpointsPlugin#loadViewpoint().
13535
13535
  _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=viewer.scene.on("sectionBoxCreated",function(sectionBox){_this73._sectionBoxCreated(sectionBox);});return _this73;}/**
@@ -13558,7 +13558,7 @@ _this73._sectionPlaneCreated(sectionPlane);});_this73._onSceneSectionBoxCreated=
13558
13558
  */},{key:"createSectionPlane",value:function createSectionPlane(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id!==undefined&&params.id!==null&&this.viewer.scene.components[params.id]){this.error("Viewer component with this ID already exists: "+params.id);delete params.id;}// Note that SectionPlane constructor fires "sectionPlaneCreated" on the Scene,
13559
13559
  // which SectionPlanesPlugin handles and calls #_sectionPlaneCreated to create gizmo and add to overview canvas.
13560
13560
  var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos,dir:params.dir,active:true});return sectionPlane;}//剖切面创建后,创建一个控制器
13561
- },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13561
+ },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){var _this74=this;var newControl;switch(this._sectionWay){case"plane":newControl=new ClippingPlane(this,this._controlsConfig);break;default:newControl=new Control$1(this);break;}var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionPlane(sectionPlane);control.setVisible(true);sectionPlane.control=control;this._currentControl=control;this._controls[sectionPlane.id]=control;if(this._overview){this._overview.addSectionPlane(sectionPlane);}sectionPlane.once("destroyed",function(){_this74._sectionPlaneDestroyed(sectionPlane);});}//剖切盒创建后,创建一个控制器
13562
13562
  },{key:"_sectionBoxCreated",value:function _sectionBoxCreated(sectionBox){var _this75=this;var newControl;newControl=new ClippingBox(this,this._controlsConfig);var control=this._freeControls.length>0?this._freeControls.pop():newControl;control._setSectionBox(sectionBox);control.setVisible(true);this._currentControl=control;this._controls[sectionBox.id]=control;if(this._overview){this._overview.setSectionBox(sectionBox);}sectionBox.once("destroyed",function(){_this75._sectionPlaneDestroyed(sectionBox);});}/**
13563
13563
  * 设置是否是触屏模式
13564
13564
  * @param {boolean} touch
@@ -13591,7 +13591,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13591
13591
  * Shows the 3D editing gizmo for a {@link SectionPlane}.
13592
13592
  *
13593
13593
  * @param {String} id ID of the {@link SectionPlane}.
13594
- */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}this.hideControl();control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;}/**
13594
+ */},{key:"showControl",value:function showControl(id){var control=this._controls[id];if(!control){this.error("Control not found: "+id);return;}this.hideControl();control.setVisible(true);if(this._overview){this._overview.setPlaneSelected(id,true);}this._shownControlId=id;this._shownControlIds=[id];}/**
13595
13595
  * 设置剖切对象的尺寸
13596
13596
  * @param {*} size
13597
13597
  */},{key:"setControlsSize",value:function setControlsSize(size){for(var id in this._controls){this._controls[id].controlSize=size;}}/**
@@ -13605,13 +13605,13 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13605
13605
  * Returns ````null```` when the editing gizmo is not shown.
13606
13606
  *
13607
13607
  * @returns {String} ID of the the {@link SectionPlane} that the 3D editing gizmo is shown for, if shown, else ````null````.
13608
- */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}/**
13608
+ */},{key:"getShownControl",value:function getShownControl(){return this._shownControlId;}},{key:"getShownControls",value:function getShownControls(){return this._shownControlIds;}},{key:"showAllControl",value:function showAllControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._shownControlIds.push(id);this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}}/**
13609
13609
  * Hides the 3D {@link SectionPlane} editing gizmo if shown.
13610
- */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;}/**
13610
+ */},{key:"hideControl",value:function hideControl(){for(var id in this._controls){if(this._controls.hasOwnProperty(id)){this._controls[id].setVisible(false);if(this._overview){this._overview.setPlaneSelected(id,false);}}}this._shownControlId=null;this._shownControlIds=[];}/**
13611
13611
  * Destroys a {@link SectionPlane} created by this SectionPlanesPlugin.
13612
13612
  *
13613
13613
  * @param {String} id ID of the {@link SectionPlane}.
13614
- */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13614
+ */},{key:"destroySectionPlane",value:function destroySectionPlane(id){var sectionPlane=this.viewer.scene.sectionPlanes[id];if(!sectionPlane){this.error("SectionPlane not found: "+id);return;}this._sectionPlaneDestroyed(sectionPlane);sectionPlane.destroy();if(id===this._shownControlId){this._shownControlId=null;this._shownControlIds=[];}}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){if(this._overview){this._overview.removeSectionPlane(sectionPlane);}var control=this._controls[sectionPlane.id];if(!control){return;}control.setVisible(false);control._setSectionPlane(null);delete this._controls[sectionPlane.id];this._freeControls.push(control);}/**
13615
13615
  * Destroys all {@link SectionPlane}s created by this SectionPlanesPlugin.
13616
13616
  */},{key:"clear",value:function clear(){var ids=Object.keys(this._sectionPlanes);for(var i=0,len=ids.length;i<len;i++){this.destroySectionPlane(ids[i]);}}/**
13617
13617
  * @private
@@ -14206,7 +14206,7 @@ primitive:"triangles",positions:[1,1,1,-1,1,1,-1,-1,1,1,-1,1,// v0-v1-v2-v3 fron
14206
14206
  -1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,// v7-v4-v3-v2 bottom
14207
14207
  1,-1,-1,-1,-1,-1,-1,1,-1,1,1,-1// v4-v7-v6-v5 back
14208
14208
  ],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.5,0,0.5,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),background:true,scale:[2000,2000,2000],// Overridden when we initialize the 'size' property, below
14209
- rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{scale:cfg.scale,src:cfg.src,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
14209
+ rotation:[0,-90,0],material:new PhongMaterial(_this78,{ambient:[0,0,0],diffuse:[0,0,0],specular:[0,0,0],emissive:[1,1,1],emissiveMap:new Texture(_this78,{scale:cfg.scale,src:cfg.src,image:cfg.image,flipY:true,wrapS:1000,wrapT:1000,encoding:cfg.encoding||"sRGB"}),backfaces:true// Show interior faces of our skybox geometry
14210
14210
  }),// stationary: true,
14211
14211
  visible:false,pickable:false,clippable:false,collidable:false});_this78.size=cfg.size;// Sets 'xyz' property on the Mesh's Scale transform
14212
14212
  _this78.active=cfg.active;return _this78;}/**
@@ -14287,7 +14287,7 @@ _this78.active=cfg.active;return _this78;}/**
14287
14287
  * });
14288
14288
  *
14289
14289
  * @class SkyboxesPlugin
14290
- */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin7){function SkyboxesPlugin(viewer){var _this79;_classCallCheck(this,SkyboxesPlugin);_this79=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this79.skyboxes={};_this79._active=true;return _this79;}/**
14290
+ */var SkyboxesPlugin=/*#__PURE__*/function(_Plugin7){function SkyboxesPlugin(viewer){var _this79;_classCallCheck(this,SkyboxesPlugin);_this79=_callSuper(this,SkyboxesPlugin,["skyboxes",viewer]);_this79.skyboxes={};_this79._active=false;return _this79;}/**
14291
14291
  * @private
14292
14292
  */_inherits(SkyboxesPlugin,_Plugin7);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
14293
14293
  Creates a skybox.
@@ -14296,16 +14296,18 @@ _this78.active=cfg.active;return _this78;}/**
14296
14296
  @param {Object} params Skybox configuration.
14297
14297
  @param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
14298
14298
  @returns {Skybox} The new skybox.
14299
- */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,pos:params.pos,dir:params.dir,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}},{key:"active",get:function get(){return this._active;}/**
14299
+ */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}if(!params.src&&!params.image){this.error("No legal skybox image or src: "+id);return this;}if(params.src){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}else if(params.image){var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,image:params.image,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14300
+ * 设置开启天空盒
14301
+ */},{key:"active",get:function get(){return this._active;},set:function set(active){this._active=active;for(var _i158=0;_i158<this.skyboxes.length;_i158++)this.skyboxes[_i158].active=active;}},{key:"getSkyBoxById",value:function getSkyBoxById(id){return this.skyboxes[id];}/**
14300
14302
  Destroys a skybox.
14301
14303
  @param id
14302
- */,set:function set(active){this._active=active;for(var _i158=0;_i158<this.skyboxes.length;_i158++)this.skyboxes[_i158].active=active;}},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
14304
+ */},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
14303
14305
  Destroys all skyboxes.
14304
- */},{key:"clear",value:function clear(){var ids=Object.keys(this.viewer.scene.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14306
+ */},{key:"clear",value:function clear(){var ids=Object.keys(this.skyboxes);for(var i=0,len=ids.length;i<len;i++){this.destroySkybox(ids[i]);}}/**
14305
14307
  * Destroys this plugin.
14306
14308
  *
14307
14309
  * Clears skyboxes from the Viewer first.
14308
- */},{key:"destroy",value:function destroy(){this.clear();_superPropGet(SkyboxesPlugin,"clear",this,3)([]);}}]);}(Plugin);var treeViews=[];/**
14310
+ */},{key:"destroy",value:function destroy(){this.clear();}}]);}(Plugin);var treeViews=[];/**
14309
14311
  * @desc A {@link Viewer} plugin that provides an HTML tree view to navigate the IFC elements in models.
14310
14312
  * <br>
14311
14313
  *
@@ -15347,7 +15349,7 @@ best=oct=octEncodeVec3(worldNormal,"floor","floor");dec=octDecodeVec2(oct);curre
15347
15349
  var x=p[0]/(Math.abs(p[0])+Math.abs(p[1])+Math.abs(p[2]));var y=p[1]/(Math.abs(p[0])+Math.abs(p[1])+Math.abs(p[2]));if(p[2]<0){var tempx=x;var tempy=y;tempx=(1-Math.abs(y))*(x>=0?1:-1);tempy=(1-Math.abs(x))*(y>=0?1:-1);x=tempx;y=tempy;}return new Int8Array([Math[xfunc](x*127.5+(x<0?-1:0)),Math[yfunc](y*127.5+(y<0?-1:0))]);}/**
15348
15350
  * @private
15349
15351
  */function octDecodeVec2(oct){// Decode an oct-encoded normal
15350
- var x=oct[0];var y=oct[1];x/=x<0?127:128;y/=y<0?127:128;var z=1-Math.abs(x)-Math.abs(y);if(z<0){x=(1-Math.abs(y))*(x>=0?1:-1);y=(1-Math.abs(x))*(y>=0?1:-1);}var length=Math.sqrt(x*x+y*y+z*z);return[x/length,y/length,z/length];}var tempMat4=math.mat4();var tempMat4b=math.mat4();var tempVec4a$5=math.vec4([0,0,0,1]);var tempVec3a$t=math.vec3();var tempVec3b$s=math.vec3();var tempVec3c$o=math.vec3();var tempVec3d$a=math.vec3();var tempVec3e$1=math.vec3();var tempVec3f$1=math.vec3();var tempVec3g$1=math.vec3();/**
15352
+ var x=oct[0];var y=oct[1];x/=x<0?127:128;y/=y<0?127:128;var z=1-Math.abs(x)-Math.abs(y);if(z<0){x=(1-Math.abs(y))*(x>=0?1:-1);y=(1-Math.abs(x))*(y>=0?1:-1);}var length=Math.sqrt(x*x+y*y+z*z);return[x/length,y/length,z/length];}var tempMat4=math.mat4();var tempMat4b=math.mat4();var tempVec4a$6=math.vec4([0,0,0,1]);var tempVec3a$t=math.vec3();var tempVec3b$s=math.vec3();var tempVec3c$o=math.vec3();var tempVec3d$a=math.vec3();var tempVec3e$1=math.vec3();var tempVec3f$1=math.vec3();var tempVec3g$1=math.vec3();/**
15351
15353
  * @private
15352
15354
  */var VBOBatchingTrianglesLayer=/*#__PURE__*/function(){/**
15353
15355
  * @param model
@@ -15421,7 +15423,7 @@ var flagsLength=buffer.positions.length/3;var flags=new Float32Array(flagsLength
15421
15423
  * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.
15422
15424
  */},{key:"_setFlags",value:function _setFlags(portionId,flags,transparent){var deferred=arguments.length>3&&arguments[3]!==undefined?arguments[3]:false;if(!this._finalized){throw"Not finalized";}var portionsIdx=portionId;var portion=this._portions[portionsIdx];var vertsBaseIndex=portion.vertsBaseIndex;var numVerts=portion.numVerts;var firstFlag=vertsBaseIndex;var lenFlags=numVerts;var visible=!!(flags&ENTITY_FLAGS.VISIBLE);var xrayed=!!(flags&ENTITY_FLAGS.XRAYED);var highlighted=!!(flags&ENTITY_FLAGS.HIGHLIGHTED);var selected=!!(flags&ENTITY_FLAGS.SELECTED);var edges=!!(flags&ENTITY_FLAGS.EDGES);var pickable=!!(flags&ENTITY_FLAGS.PICKABLE);var culled=!!(flags&ENTITY_FLAGS.CULLED);var colorFlag;if(!visible||culled||xrayed||highlighted&&!this.model.scene.highlightMaterial.glowThrough||selected&&!this.model.scene.selectedMaterial.glowThrough){colorFlag=RENDER_PASSES.NOT_RENDERED;}else{if(transparent){colorFlag=RENDER_PASSES.COLOR_TRANSPARENT;}else{colorFlag=RENDER_PASSES.COLOR_OPAQUE;}}var silhouetteFlag;if(!visible||culled){silhouetteFlag=RENDER_PASSES.NOT_RENDERED;}else if(selected){silhouetteFlag=RENDER_PASSES.SILHOUETTE_SELECTED;}else if(highlighted){silhouetteFlag=RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;}else if(xrayed){silhouetteFlag=RENDER_PASSES.SILHOUETTE_XRAYED;}else{silhouetteFlag=RENDER_PASSES.NOT_RENDERED;}var edgeFlag=0;if(!visible||culled){edgeFlag=RENDER_PASSES.NOT_RENDERED;}else if(selected){edgeFlag=RENDER_PASSES.EDGES_SELECTED;}else if(highlighted){edgeFlag=RENDER_PASSES.EDGES_HIGHLIGHTED;}else if(xrayed){edgeFlag=RENDER_PASSES.EDGES_XRAYED;}else if(edges){if(transparent){edgeFlag=RENDER_PASSES.EDGES_COLOR_TRANSPARENT;}else{edgeFlag=RENDER_PASSES.EDGES_COLOR_OPAQUE;}}else{edgeFlag=RENDER_PASSES.NOT_RENDERED;}var pickFlag=visible&&!culled&&pickable?RENDER_PASSES.PICK:RENDER_PASSES.NOT_RENDERED;var clippableFlag=!!(flags&ENTITY_FLAGS.CLIPPABLE)?1:0;if(deferred){// Avoid zillions of individual WebGL bufferSubData calls - buffer them to apply in one shot
15423
15425
  if(!this._deferredFlagValues){this._deferredFlagValues=new Float32Array(this._numVerts);}for(var _i221=firstFlag,len=firstFlag+lenFlags;_i221<len;_i221++){var vertFlag=0;vertFlag|=colorFlag;vertFlag|=silhouetteFlag<<4;vertFlag|=edgeFlag<<8;vertFlag|=pickFlag<<12;vertFlag|=clippableFlag<<16;this._deferredFlagValues[_i221]=vertFlag;}}else if(this._state.flagsBuf){var tempArray=this._scratchMemory.getFloat32Array(lenFlags);for(var _i222=0;_i222<lenFlags;_i222++){var _vertFlag=0;_vertFlag|=colorFlag;_vertFlag|=silhouetteFlag<<4;_vertFlag|=edgeFlag<<8;_vertFlag|=pickFlag<<12;_vertFlag|=clippableFlag<<16;tempArray[_i222]=_vertFlag;}this._state.flagsBuf.setData(tempArray,firstFlag,lenFlags);}}},{key:"_setDeferredFlags",value:function _setDeferredFlags(){if(this._deferredFlagValues){this._state.flagsBuf.setData(this._deferredFlagValues);this._deferredFlagValues=null;}}},{key:"setOffset",value:function setOffset(portionId,offset){if(!this._finalized){throw"Not finalized";}if(!this.model.scene.entityOffsetsEnabled){this.model.error("Entity#offset not enabled for this Viewer");// See Viewer entityOffsetsEnabled
15424
- return;}var portionsIdx=portionId;var portion=this._portions[portionsIdx];var vertsBaseIndex=portion.vertsBaseIndex;var numVerts=portion.numVerts;var firstOffset=vertsBaseIndex*3;var lenOffsets=numVerts*3;var tempArray=this._scratchMemory.getFloat32Array(lenOffsets);var x=offset[0];var y=offset[1];var z=offset[2];for(var _i223=0;_i223<lenOffsets;_i223+=3){tempArray[_i223+0]=x;tempArray[_i223+1]=y;tempArray[_i223+2]=z;}if(this._state.offsetsBuf){this._state.offsetsBuf.setData(tempArray,firstOffset,lenOffsets);}if(this.model.scene.pickSurfacePrecisionEnabled){portion.offset[0]=offset[0];portion.offset[1]=offset[1];portion.offset[2]=offset[2];}}},{key:"getEachVertex",value:function getEachVertex(portionId,callback){if(!this.model.scene.pickSurfacePrecisionEnabled){return;}var state=this._state;var portion=this._portions[portionId];if(!portion){this.model.error("portion not found: "+portionId);return;}var positions=portion.quantizedPositions;var origin=state.origin;var offset=portion.offset;var offsetX=origin[0]+offset[0];var offsetY=origin[1]+offset[1];var offsetZ=origin[2]+offset[2];var worldPos=tempVec4a$5;for(var _i224=0,len=positions.length;_i224<len;_i224+=3){worldPos[0]=positions[_i224];worldPos[1]=positions[_i224+1];worldPos[2]=positions[_i224+2];worldPos[3]=1.0;math.decompressPosition(worldPos,state.positionsDecodeMatrix);math.transformPoint4(this.model.worldMatrix,worldPos);worldPos[0]+=offsetX;worldPos[1]+=offsetY;worldPos[2]+=offsetZ;callback(worldPos);}}},{key:"getElementsCountAndOffset",value:function getElementsCountAndOffset(portionId){var count=null;var offset=null;var portion=this._portions[portionId];if(portion){count=portion.numIndices;offset=portion.indicesBaseIndex;}return{count:count,offset:offset};}// ---------------------- COLOR RENDERING -----------------------------------
15426
+ return;}var portionsIdx=portionId;var portion=this._portions[portionsIdx];var vertsBaseIndex=portion.vertsBaseIndex;var numVerts=portion.numVerts;var firstOffset=vertsBaseIndex*3;var lenOffsets=numVerts*3;var tempArray=this._scratchMemory.getFloat32Array(lenOffsets);var x=offset[0];var y=offset[1];var z=offset[2];for(var _i223=0;_i223<lenOffsets;_i223+=3){tempArray[_i223+0]=x;tempArray[_i223+1]=y;tempArray[_i223+2]=z;}if(this._state.offsetsBuf){this._state.offsetsBuf.setData(tempArray,firstOffset,lenOffsets);}if(this.model.scene.pickSurfacePrecisionEnabled){portion.offset[0]=offset[0];portion.offset[1]=offset[1];portion.offset[2]=offset[2];}}},{key:"getEachVertex",value:function getEachVertex(portionId,callback){if(!this.model.scene.pickSurfacePrecisionEnabled){return;}var state=this._state;var portion=this._portions[portionId];if(!portion){this.model.error("portion not found: "+portionId);return;}var positions=portion.quantizedPositions;var origin=state.origin;var offset=portion.offset;var offsetX=origin[0]+offset[0];var offsetY=origin[1]+offset[1];var offsetZ=origin[2]+offset[2];var worldPos=tempVec4a$6;for(var _i224=0,len=positions.length;_i224<len;_i224+=3){worldPos[0]=positions[_i224];worldPos[1]=positions[_i224+1];worldPos[2]=positions[_i224+2];worldPos[3]=1.0;math.decompressPosition(worldPos,state.positionsDecodeMatrix);math.transformPoint4(this.model.worldMatrix,worldPos);worldPos[0]+=offsetX;worldPos[1]+=offsetY;worldPos[2]+=offsetZ;callback(worldPos);}}},{key:"getElementsCountAndOffset",value:function getElementsCountAndOffset(portionId){var count=null;var offset=null;var portion=this._portions[portionId];if(portion){count=portion.numIndices;offset=portion.indicesBaseIndex;}return{count:count,offset:offset};}// ---------------------- COLOR RENDERING -----------------------------------
15425
15427
  },{key:"drawColorOpaque",value:function drawColorOpaque(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(frameCtx.withSAO&&this.model.saoEnabled){if(frameCtx.pbrEnabled&&this.model.pbrEnabled&&this._state.pbrSupported){if(this._renderers.pbrRendererWithSAO){this._renderers.pbrRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else if(frameCtx.colorTextureEnabled&&this.model.colorTextureEnabled&&this._state.colorTextureSupported){if(this._renderers.colorTextureRendererWithSAO){this._renderers.colorTextureRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else if(this._state.normalsBuf){if(this._renderers.colorRendererWithSAO){this._renderers.colorRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else{if(this._renderers.flatColorRendererWithSAO){this._renderers.flatColorRendererWithSAO.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}}else{if(frameCtx.pbrEnabled&&this.model.pbrEnabled&&this._state.pbrSupported){if(this._renderers.pbrRenderer){this._renderers.pbrRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else if(frameCtx.colorTextureEnabled&&this.model.colorTextureEnabled&&this._state.colorTextureSupported){if(this._renderers.colorTextureRenderer){this._renderers.colorTextureRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else if(this._state.normalsBuf){if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}else{if(this._renderers.flatColorRenderer){this._renderers.flatColorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}}}},{key:"_updateBackfaceCull",value:function _updateBackfaceCull(renderFlags,frameCtx){var backfaces=this.model.backfaces||!this.solid||renderFlags.sectioned;if(frameCtx.backfaces!==backfaces){var _gl4=frameCtx.gl;if(backfaces){_gl4.disable(_gl4.CULL_FACE);}else{_gl4.enable(_gl4.CULL_FACE);}frameCtx.backfaces=backfaces;}}},{key:"drawColorTransparent",value:function drawColorTransparent(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===0||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(frameCtx.pbrEnabled&&this.model.pbrEnabled&&this._state.pbrSupported){if(this._renderers.pbrRenderer){this._renderers.pbrRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}else if(frameCtx.colorTextureEnabled&&this.model.colorTextureEnabled&&this._state.colorTextureSupported){if(this._renderers.colorTextureRenderer){this._renderers.colorTextureRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}else if(this._state.normalsBuf){if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}else{if(this._renderers.flatColorRenderer){this._renderers.flatColorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}}// ---------------------- RENDERING SAO POST EFFECT TARGETS --------------
15426
15428
  },{key:"drawDepth",value:function drawDepth(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.depthRenderer){this._renderers.depthRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);// Assume whatever post-effect uses depth (eg SAO) does not apply to transparent objects
15427
15429
  }}},{key:"drawNormals",value:function drawNormals(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}this._updateBackfaceCull(renderFlags,frameCtx);if(this._renderers.normalsRenderer){this._renderers.normalsRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);// Assume whatever post-effect uses normals (eg SAO) does not apply to transparent objects
@@ -15586,7 +15588,7 @@ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:func
15586
15588
  if(!this._silhouetteRenderer){// Used for highlighting and selection
15587
15589
  this._silhouetteRenderer=new TrianglesSilhouetteRenderer(this._scene);}if(!this._pickMeshRenderer){this._pickMeshRenderer=new TrianglesPickMeshRenderer(this._scene);}if(!this._pickDepthRenderer){this._pickDepthRenderer=new TrianglesPickDepthRenderer(this._scene);}if(!this._snapInitRenderer){this._snapInitRenderer=new TrianglesSnapInitRenderer(this._scene,false);}if(!this._snapRenderer){this._snapRenderer=new TrianglesSnapRenderer(this._scene);}}},{key:"colorRenderer",get:function get(){if(!this._colorRenderer){this._colorRenderer=new TrianglesColorRenderer(this._scene,false);}return this._colorRenderer;}},{key:"colorRendererWithSAO",get:function get(){if(!this._colorRendererWithSAO){this._colorRendererWithSAO=new TrianglesColorRenderer(this._scene,true);}return this._colorRendererWithSAO;}},{key:"flatColorRenderer",get:function get(){if(!this._flatColorRenderer){this._flatColorRenderer=new TrianglesFlatColorRenderer(this._scene,false);}return this._flatColorRenderer;}},{key:"flatColorRendererWithSAO",get:function get(){if(!this._flatColorRendererWithSAO){this._flatColorRendererWithSAO=new TrianglesFlatColorRenderer(this._scene,true);}return this._flatColorRendererWithSAO;}},{key:"pbrRenderer",get:function get(){if(!this._pbrRenderer){this._pbrRenderer=new TrianglesPBRRenderer(this._scene,false);}return this._pbrRenderer;}},{key:"pbrRendererWithSAO",get:function get(){if(!this._pbrRendererWithSAO){this._pbrRendererWithSAO=new TrianglesPBRRenderer(this._scene,true);}return this._pbrRendererWithSAO;}},{key:"colorTextureRenderer",get:function get(){if(!this._colorTextureRenderer){this._colorTextureRenderer=new TrianglesColorTextureRenderer(this._scene,false);}return this._colorTextureRenderer;}},{key:"colorTextureRendererWithSAO",get:function get(){if(!this._colorTextureRendererWithSAO){this._colorTextureRendererWithSAO=new TrianglesColorTextureRenderer(this._scene,true);}return this._colorTextureRendererWithSAO;}},{key:"silhouetteRenderer",get:function get(){if(!this._silhouetteRenderer){this._silhouetteRenderer=new TrianglesSilhouetteRenderer(this._scene);}return this._silhouetteRenderer;}},{key:"depthRenderer",get:function get(){if(!this._depthRenderer){this._depthRenderer=new TrianglesDepthRenderer(this._scene);}return this._depthRenderer;}},{key:"normalsRenderer",get:function get(){if(!this._normalsRenderer){this._normalsRenderer=new TrianglesNormalsRenderer(this._scene);}return this._normalsRenderer;}},{key:"edgesRenderer",get:function get(){if(!this._edgesRenderer){this._edgesRenderer=new EdgesEmphasisRenderer(this._scene);}return this._edgesRenderer;}},{key:"edgesColorRenderer",get:function get(){if(!this._edgesColorRenderer){this._edgesColorRenderer=new EdgesColorRenderer(this._scene);}return this._edgesColorRenderer;}},{key:"pickMeshRenderer",get:function get(){if(!this._pickMeshRenderer){this._pickMeshRenderer=new TrianglesPickMeshRenderer(this._scene);}return this._pickMeshRenderer;}},{key:"pickNormalsRenderer",get:function get(){if(!this._pickNormalsRenderer){this._pickNormalsRenderer=new TrianglesPickNormalsRenderer(this._scene);}return this._pickNormalsRenderer;}},{key:"pickNormalsFlatRenderer",get:function get(){if(!this._pickNormalsFlatRenderer){this._pickNormalsFlatRenderer=new TrianglesPickNormalsFlatRenderer(this._scene);}return this._pickNormalsFlatRenderer;}},{key:"pickDepthRenderer",get:function get(){if(!this._pickDepthRenderer){this._pickDepthRenderer=new TrianglesPickDepthRenderer(this._scene);}return this._pickDepthRenderer;}},{key:"occlusionRenderer",get:function get(){if(!this._occlusionRenderer){this._occlusionRenderer=new TrianglesOcclusionRenderer(this._scene);}return this._occlusionRenderer;}},{key:"shadowRenderer",get:function get(){if(!this._shadowRenderer){this._shadowRenderer=new TrianglesShadowRenderer(this._scene);}return this._shadowRenderer;}},{key:"snapInitRenderer",get:function get(){if(!this._snapInitRenderer){this._snapInitRenderer=new TrianglesSnapInitRenderer(this._scene,false);}return this._snapInitRenderer;}},{key:"snapRenderer",get:function get(){if(!this._snapRenderer){this._snapRenderer=new TrianglesSnapRenderer(this._scene);}return this._snapRenderer;}},{key:"_destroy",value:function _destroy(){if(this._colorRenderer){this._colorRenderer.destroy();}if(this._colorRendererWithSAO){this._colorRendererWithSAO.destroy();}if(this._flatColorRenderer){this._flatColorRenderer.destroy();}if(this._flatColorRendererWithSAO){this._flatColorRendererWithSAO.destroy();}if(this._pbrRenderer){this._pbrRenderer.destroy();}if(this._pbrRendererWithSAO){this._pbrRendererWithSAO.destroy();}if(this._colorTextureRenderer){this._colorTextureRenderer.destroy();}if(this._colorTextureRendererWithSAO){this._colorTextureRendererWithSAO.destroy();}if(this._depthRenderer){this._depthRenderer.destroy();}if(this._normalsRenderer){this._normalsRenderer.destroy();}if(this._silhouetteRenderer){this._silhouetteRenderer.destroy();}if(this._edgesRenderer){this._edgesRenderer.destroy();}if(this._edgesColorRenderer){this._edgesColorRenderer.destroy();}if(this._pickMeshRenderer){this._pickMeshRenderer.destroy();}if(this._pickDepthRenderer){this._pickDepthRenderer.destroy();}if(this._pickNormalsRenderer){this._pickNormalsRenderer.destroy();}if(this._pickNormalsFlatRenderer){this._pickNormalsFlatRenderer.destroy();}if(this._occlusionRenderer){this._occlusionRenderer.destroy();}if(this._shadowRenderer){this._shadowRenderer.destroy();}if(this._snapInitRenderer){this._snapInitRenderer.destroy();}if(this._snapRenderer){this._snapRenderer.destroy();}}}]);}();var cachedRenderers$5={};/**
15588
15590
  * @private
15589
- */function getRenderers$6(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$5[sceneId];if(!instancingRenderers){instancingRenderers=new Renderers(scene);cachedRenderers$5[sceneId]=instancingRenderers;instancingRenderers._compile();instancingRenderers.eagerCreateRenders();scene.on("compile",function(){instancingRenderers._compile();instancingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$5[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$2=new Uint8Array(4);var tempFloat32$2=new Float32Array(1);var tempVec4a$4=math.vec4([0,0,0,1]);var tempVec3fa$2=new Float32Array(3);var tempVec3a$q=math.vec3();var tempVec3b$p=math.vec3();var tempVec3c$l=math.vec3();var tempVec3d$7=math.vec3();var tempVec3e=math.vec3();var tempVec3f=math.vec3();var tempVec3g=math.vec3();var tempFloat32Vec4$2=new Float32Array(4);/**
15591
+ */function getRenderers$6(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$5[sceneId];if(!instancingRenderers){instancingRenderers=new Renderers(scene);cachedRenderers$5[sceneId]=instancingRenderers;instancingRenderers._compile();instancingRenderers.eagerCreateRenders();scene.on("compile",function(){instancingRenderers._compile();instancingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$5[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$2=new Uint8Array(4);var tempFloat32$2=new Float32Array(1);var tempVec4a$5=math.vec4([0,0,0,1]);var tempVec3fa$2=new Float32Array(3);var tempVec3a$q=math.vec3();var tempVec3b$p=math.vec3();var tempVec3c$l=math.vec3();var tempVec3d$7=math.vec3();var tempVec3e=math.vec3();var tempVec3f=math.vec3();var tempVec3g=math.vec3();var tempFloat32Vec4$2=new Float32Array(4);/**
15590
15592
  * @private
15591
15593
  */var VBOInstancingTrianglesLayer=/*#__PURE__*/function(){/**
15592
15594
  * @param cfg
@@ -15683,7 +15685,7 @@ if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8
15683
15685
  /**
15684
15686
  * flags are 4bits values encoded on a 32bit base. color flag on the first 4 bits, silhouette flag on the next 4 bits and so on for edge, pick and clippable.
15685
15687
  */},{key:"_setFlags",value:function _setFlags(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}var visible=!!(flags&ENTITY_FLAGS.VISIBLE);var xrayed=!!(flags&ENTITY_FLAGS.XRAYED);var highlighted=!!(flags&ENTITY_FLAGS.HIGHLIGHTED);var selected=!!(flags&ENTITY_FLAGS.SELECTED);var edges=!!(flags&ENTITY_FLAGS.EDGES);var pickable=!!(flags&ENTITY_FLAGS.PICKABLE);var culled=!!(flags&ENTITY_FLAGS.CULLED);var colorFlag;if(!visible||culled||xrayed||highlighted&&!this.model.scene.highlightMaterial.glowThrough||selected&&!this.model.scene.selectedMaterial.glowThrough){colorFlag=RENDER_PASSES.NOT_RENDERED;}else{if(meshTransparent){colorFlag=RENDER_PASSES.COLOR_TRANSPARENT;}else{colorFlag=RENDER_PASSES.COLOR_OPAQUE;}}var silhouetteFlag;if(!visible||culled){silhouetteFlag=RENDER_PASSES.NOT_RENDERED;}else if(selected){silhouetteFlag=RENDER_PASSES.SILHOUETTE_SELECTED;}else if(highlighted){silhouetteFlag=RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;}else if(xrayed){silhouetteFlag=RENDER_PASSES.SILHOUETTE_XRAYED;}else{silhouetteFlag=RENDER_PASSES.NOT_RENDERED;}var edgeFlag=0;if(!visible||culled){edgeFlag=RENDER_PASSES.NOT_RENDERED;}else if(selected){edgeFlag=RENDER_PASSES.EDGES_SELECTED;}else if(highlighted){edgeFlag=RENDER_PASSES.EDGES_HIGHLIGHTED;}else if(xrayed){edgeFlag=RENDER_PASSES.EDGES_XRAYED;}else if(edges){if(meshTransparent){edgeFlag=RENDER_PASSES.EDGES_COLOR_TRANSPARENT;}else{edgeFlag=RENDER_PASSES.EDGES_COLOR_OPAQUE;}}else{edgeFlag=RENDER_PASSES.NOT_RENDERED;}var pickFlag=visible&&!culled&&pickable?RENDER_PASSES.PICK:RENDER_PASSES.NOT_RENDERED;var clippableFlag=!!(flags&ENTITY_FLAGS.CLIPPABLE)?1:0;var vertFlag=0;vertFlag|=colorFlag;vertFlag|=silhouetteFlag<<4;vertFlag|=edgeFlag<<8;vertFlag|=pickFlag<<12;vertFlag|=clippableFlag<<16;tempFloat32$2[0]=vertFlag;if(this._state.flagsBuf){this._state.flagsBuf.setData(tempFloat32$2,portionId);}}},{key:"setOffset",value:function setOffset(portionId,offset){if(!this._finalized){throw"Not finalized";}if(!this.model.scene.entityOffsetsEnabled){this.model.error("Entity#offset not enabled for this Viewer");// See Viewer entityOffsetsEnabled
15686
- return;}tempVec3fa$2[0]=offset[0];tempVec3fa$2[1]=offset[1];tempVec3fa$2[2]=offset[2];if(this._state.offsetsBuf){this._state.offsetsBuf.setData(tempVec3fa$2,portionId*3);}}},{key:"getEachVertex",value:function getEachVertex(portionId,callback){if(!this.model.scene.pickSurfacePrecisionEnabled){return false;}var state=this._state;var geometry=state.geometry;var portion=this._portions[portionId];if(!portion){this.model.error("portion not found: "+portionId);return;}var positions=geometry.quantizedPositions;var origin=state.origin;var offset=portion.offset;var offsetX=origin[0]+offset[0];var offsetY=origin[1]+offset[1];var offsetZ=origin[2]+offset[2];var worldPos=tempVec4a$4;var portionMatrix=portion.matrix;var sceneModelPatrix=this.model.sceneModelMatrix;var positionsDecodeMatrix=state.positionsDecodeMatrix;for(var _i259=0,len=positions.length;_i259<len;_i259+=3){worldPos[0]=positions[_i259];worldPos[1]=positions[_i259+1];worldPos[2]=positions[_i259+2];math.decompressPosition(worldPos,positionsDecodeMatrix);math.transformPoint3(portionMatrix,worldPos);math.transformPoint3(sceneModelPatrix,worldPos);worldPos[0]+=offsetX;worldPos[1]+=offsetY;worldPos[2]+=offsetZ;callback(worldPos);}}},{key:"setMatrix",value:function setMatrix(portionId,matrix){if(!this._finalized){throw"Not finalized";}////////////////////////////////////////
15688
+ return;}tempVec3fa$2[0]=offset[0];tempVec3fa$2[1]=offset[1];tempVec3fa$2[2]=offset[2];if(this._state.offsetsBuf){this._state.offsetsBuf.setData(tempVec3fa$2,portionId*3);}}},{key:"getEachVertex",value:function getEachVertex(portionId,callback){if(!this.model.scene.pickSurfacePrecisionEnabled){return false;}var state=this._state;var geometry=state.geometry;var portion=this._portions[portionId];if(!portion){this.model.error("portion not found: "+portionId);return;}var positions=geometry.quantizedPositions;var origin=state.origin;var offset=portion.offset;var offsetX=origin[0]+offset[0];var offsetY=origin[1]+offset[1];var offsetZ=origin[2]+offset[2];var worldPos=tempVec4a$5;var portionMatrix=portion.matrix;var sceneModelPatrix=this.model.sceneModelMatrix;var positionsDecodeMatrix=state.positionsDecodeMatrix;for(var _i259=0,len=positions.length;_i259<len;_i259+=3){worldPos[0]=positions[_i259];worldPos[1]=positions[_i259+1];worldPos[2]=positions[_i259+2];math.decompressPosition(worldPos,positionsDecodeMatrix);math.transformPoint3(portionMatrix,worldPos);math.transformPoint3(sceneModelPatrix,worldPos);worldPos[0]+=offsetX;worldPos[1]+=offsetY;worldPos[2]+=offsetZ;callback(worldPos);}}},{key:"setMatrix",value:function setMatrix(portionId,matrix){if(!this._finalized){throw"Not finalized";}////////////////////////////////////////
15687
15689
  // TODO: Update portion matrix
15688
15690
  ////////////////////////////////////////
15689
15691
  var offset=portionId*4;tempFloat32Vec4$2[0]=matrix[0];tempFloat32Vec4$2[1]=matrix[4];tempFloat32Vec4$2[2]=matrix[8];tempFloat32Vec4$2[3]=matrix[12];this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4$2,offset);tempFloat32Vec4$2[0]=matrix[1];tempFloat32Vec4$2[1]=matrix[5];tempFloat32Vec4$2[2]=matrix[9];tempFloat32Vec4$2[3]=matrix[13];this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4$2,offset);tempFloat32Vec4$2[0]=matrix[2];tempFloat32Vec4$2[1]=matrix[6];tempFloat32Vec4$2[2]=matrix[10];tempFloat32Vec4$2[3]=matrix[14];this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4$2,offset);}// ---------------------- COLOR RENDERING -----------------------------------
@@ -16496,12 +16498,12 @@ gl.RGBA,gl.FLOAT,tempMat4a$d);// gl.bindTexture (gl.TEXTURE_2D, null);
16496
16498
  // if (this._renderers.silhouetteRenderer) {
16497
16499
  // this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
16498
16500
  // }
16499
- }},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(renderFlags,frameCtx){}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(renderFlags,frameCtx){}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(renderFlags,frameCtx){}},{key:"drawEdgesSelected",value:function drawEdgesSelected(renderFlags,frameCtx){}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(renderFlags,frameCtx){}},{key:"drawOcclusion",value:function drawOcclusion(renderFlags,frameCtx){}},{key:"drawShadow",value:function drawShadow(renderFlags,frameCtx){}},{key:"setPickMatrices",value:function setPickMatrices(pickViewMatrix,pickProjMatrix){}},{key:"drawPickMesh",value:function drawPickMesh(renderFlags,frameCtx){}},{key:"drawPickDepths",value:function drawPickDepths(renderFlags,frameCtx){}},{key:"drawSnapInit",value:function drawSnapInit(renderFlags,frameCtx){}},{key:"drawSnap",value:function drawSnap(renderFlags,frameCtx){}},{key:"drawPickNormals",value:function drawPickNormals(renderFlags,frameCtx){}},{key:"destroy",value:function destroy(){if(this._destroyed){return;}var state=this._state;this.model.scene.off(this._onSceneRendering);state.destroy();this._destroyed=true;}}]);}();var tempVec3a$g=math.vec3();var tempVec3b$f=math.vec3();var tempVec3c$c=math.vec3();math.vec3();var tempVec4a$3=math.vec4();var tempMat4a$c=math.mat4();/**
16501
+ }},{key:"drawEdgesColorOpaque",value:function drawEdgesColorOpaque(renderFlags,frameCtx){}},{key:"drawEdgesColorTransparent",value:function drawEdgesColorTransparent(renderFlags,frameCtx){}},{key:"drawEdgesHighlighted",value:function drawEdgesHighlighted(renderFlags,frameCtx){}},{key:"drawEdgesSelected",value:function drawEdgesSelected(renderFlags,frameCtx){}},{key:"drawEdgesXRayed",value:function drawEdgesXRayed(renderFlags,frameCtx){}},{key:"drawOcclusion",value:function drawOcclusion(renderFlags,frameCtx){}},{key:"drawShadow",value:function drawShadow(renderFlags,frameCtx){}},{key:"setPickMatrices",value:function setPickMatrices(pickViewMatrix,pickProjMatrix){}},{key:"drawPickMesh",value:function drawPickMesh(renderFlags,frameCtx){}},{key:"drawPickDepths",value:function drawPickDepths(renderFlags,frameCtx){}},{key:"drawSnapInit",value:function drawSnapInit(renderFlags,frameCtx){}},{key:"drawSnap",value:function drawSnap(renderFlags,frameCtx){}},{key:"drawPickNormals",value:function drawPickNormals(renderFlags,frameCtx){}},{key:"destroy",value:function destroy(){if(this._destroyed){return;}var state=this._state;this.model.scene.off(this._onSceneRendering);state.destroy();this._destroyed=true;}}]);}();var tempVec3a$g=math.vec3();var tempVec3b$f=math.vec3();var tempVec3c$c=math.vec3();math.vec3();var tempVec4a$4=math.vec4();var tempMat4a$c=math.mat4();/**
16500
16502
  * @private
16501
16503
  */var DTXTrianglesColorRenderer=/*#__PURE__*/function(){function DTXTrianglesColorRenderer(scene,withSAO){_classCallCheck(this,DTXTrianglesColorRenderer);this._scene=scene;this._withSAO=withSAO;this._hash=this._getHash();this._allocate();}return _createClass(DTXTrianglesColorRenderer,[{key:"getValid",value:function getValid(){return this._hash===this._getHash();}},{key:"_getHash",value:function _getHash(){var scene=this._scene;return[scene._lightsState.getHash(),scene._sectionPlanesState.getHash(),this._withSAO?"sao":"nosao"].join(";");}},{key:"drawLayer",value:function drawLayer(frameCtx,dataTextureLayer,renderPass){var scene=this._scene;var camera=scene.camera;var model=dataTextureLayer.model;var gl=scene.canvas.gl;var state=dataTextureLayer._state;var textureState=state.textureState;var origin=dataTextureLayer._state.origin;var position=model.position,rotationMatrix=model.rotationMatrix,rotationMatrixConjugate=model.rotationMatrixConjugate;if(!this._program){this._allocate();if(this.errors){return;}}if(frameCtx.lastProgramId!==this._program.id){frameCtx.lastProgramId=this._program.id;this._bindProgram(frameCtx,state);}textureState.bindCommonTextures(this._program,this.uTexturePerObjectPositionsDecodeMatrix,this._uTexturePerVertexIdCoordinates,this.uTexturePerObjectColorsAndFlags,this._uTexturePerObjectMatrix);var rtcViewMatrix;var rtcCameraEye;var gotOrigin=origin[0]!==0||origin[1]!==0||origin[2]!==0;var gotPosition=position[0]!==0||position[1]!==0||position[2]!==0;if(gotOrigin||gotPosition){var rtcOrigin=tempVec3a$g;if(gotOrigin){var rotatedOrigin=math.transformPoint3(rotationMatrix,origin,tempVec3b$f);rtcOrigin[0]=rotatedOrigin[0];rtcOrigin[1]=rotatedOrigin[1];rtcOrigin[2]=rotatedOrigin[2];}else{rtcOrigin[0]=0;rtcOrigin[1]=0;rtcOrigin[2]=0;}rtcOrigin[0]+=position[0];rtcOrigin[1]+=position[1];rtcOrigin[2]+=position[2];rtcViewMatrix=createRTCViewMat(camera.viewMatrix,rtcOrigin,tempMat4a$c);rtcCameraEye=tempVec3c$c;rtcCameraEye[0]=camera.eye[0]-rtcOrigin[0];rtcCameraEye[1]=camera.eye[1]-rtcOrigin[1];rtcCameraEye[2]=camera.eye[2]-rtcOrigin[2];}else{rtcViewMatrix=camera.viewMatrix;rtcCameraEye=camera.eye;}gl.uniformMatrix4fv(this._uSceneModelMatrix,false,rotationMatrixConjugate);gl.uniformMatrix4fv(this._uViewMatrix,false,rtcViewMatrix);gl.uniformMatrix4fv(this._uProjMatrix,false,camera.projMatrix);gl.uniform3fv(this._uCameraEyeRtc,rtcCameraEye);gl.uniform1i(this._uRenderPass,renderPass);if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(frameCtx.pickZFar+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}var numAllocatedSectionPlanes=scene._sectionPlanesState.getNumAllocatedSectionPlanes();var numSectionPlanes=scene._sectionPlanesState.sectionPlanes.length;if(numAllocatedSectionPlanes>0){var sectionPlanes=scene._sectionPlanesState.sectionPlanes;var baseIndex=dataTextureLayer.layerIndex*numSectionPlanes;var renderFlags=model.renderFlags;for(var sectionPlaneIndex=0;sectionPlaneIndex<numAllocatedSectionPlanes;sectionPlaneIndex++){var sectionPlaneUniforms=this._uSectionPlanes[sectionPlaneIndex];if(sectionPlaneUniforms){if(sectionPlaneIndex<numSectionPlanes){var active=renderFlags.sectionPlanesActivePerLayer[baseIndex+sectionPlaneIndex];gl.uniform1i(sectionPlaneUniforms.active,active?1:0);if(active){var _sectionPlane16=sectionPlanes[sectionPlaneIndex];if(origin){var rtcSectionPlanePos=getPlaneRTCPos(_sectionPlane16.dist,_sectionPlane16.dir,origin,tempVec3a$g);gl.uniform3fv(sectionPlaneUniforms.pos,rtcSectionPlanePos);}else{gl.uniform3fv(sectionPlaneUniforms.pos,_sectionPlane16.pos);}gl.uniform3fv(sectionPlaneUniforms.dir,_sectionPlane16.dir);}}else{gl.uniform1i(sectionPlaneUniforms.active,0);}}}}if(state.numIndices8Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,8// 8 bits indices
16502
16504
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices
16503
16505
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices16Bits);}if(state.numIndices32Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32// 32 bits indices
16504
- );gl.drawArrays(gl.TRIANGLES,0,state.numIndices32Bits);}frameCtx.drawElements++;}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;var lightsState=scene._lightsState;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;console.error(this.errors);return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];var lights=lightsState.lights;var light;for(var _i337=0,len=lights.length;_i337<len;_i337++){light=lights[_i337];switch(light.type){case"dir":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=null;this._uLightDir[_i337]=program.getLocation("lightDir"+_i337);break;case"point":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=program.getLocation("lightPos"+_i337);this._uLightDir[_i337]=null;this._uLightAttenuation[_i337]=program.getLocation("lightAttenuation"+_i337);break;case"spot":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=program.getLocation("lightPos"+_i337);this._uLightDir[_i337]=program.getLocation("lightDir"+_i337);this._uLightAttenuation[_i337]=program.getLocation("lightAttenuation"+_i337);break;}}this._uSceneModelMatrix=program.getLocation("sceneModelMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i338=0,_len71=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i338<_len71;_i338++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i338),pos:program.getLocation("sectionPlanePos"+_i338),dir:program.getLocation("sectionPlaneDir"+_i338)});}if(this._withSAO){this._uOcclusionTexture="uOcclusionTexture";this._uSAOParams=program.getLocation("uSAOParams");}if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uTexturePerObjectPositionsDecodeMatrix="uObjectPerObjectPositionsDecodeMatrix";this.uTexturePerObjectColorsAndFlags="uObjectPerObjectColorsAndFlags";this._uTexturePerVertexIdCoordinates="uTexturePerVertexIdCoordinates";this._uTexturePerPolygonIdNormals="uTexturePerPolygonIdNormals";this._uTexturePerPolygonIdIndices="uTexturePerPolygonIdIndices";this._uTexturePerPolygonIdPortionIds="uTexturePerPolygonIdPortionIds";this._uTexturePerObjectMatrix="uTexturePerObjectMatrix";this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");}},{key:"_bindProgram",value:function _bindProgram(frameCtx){var scene=this._scene;var gl=scene.canvas.gl;var program=this._program;var lights=scene._lightsState.lights;var project=scene.camera.project;program.bind();if(this._uLightAmbient){gl.uniform4fv(this._uLightAmbient,scene._lightsState.getAmbientColorAndIntensity());}for(var _i339=0,len=lights.length;_i339<len;_i339++){var light=lights[_i339];if(this._uLightColor[_i339]){gl.uniform4f(this._uLightColor[_i339],light.color[0],light.color[1],light.color[2],light.intensity);}if(this._uLightPos[_i339]){gl.uniform3fv(this._uLightPos[_i339],light.pos);if(this._uLightAttenuation[_i339]){gl.uniform1f(this._uLightAttenuation[_i339],light.attenuation);}}if(this._uLightDir[_i339]){gl.uniform3fv(this._uLightDir[_i339],light.dir);}}if(this._withSAO){var sao=scene.sao;var saoEnabled=sao.possible;if(saoEnabled){var viewportWidth=gl.drawingBufferWidth;var viewportHeight=gl.drawingBufferHeight;tempVec4a$3[0]=viewportWidth;tempVec4a$3[1]=viewportHeight;tempVec4a$3[2]=sao.blendCutoff;tempVec4a$3[3]=sao.blendFactor;gl.uniform4fv(this._uSAOParams,tempVec4a$3);this._program.bindTexture(this._uOcclusionTexture,frameCtx.occlusionTexture,10);}}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(project.far+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("uniform mat4 sceneModelMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");src.push("uniform highp sampler2D uTexturePerObjectMatrix;");src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");src.push("uniform vec3 uCameraEyeRtc;");src.push("vec3 positions[3];");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("uniform vec4 lightAmbient;");for(var _i340=0,len=lightsState.lights.length;_i340<len;_i340++){light=lightsState.lights[_i340];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i340+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i340+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i340+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i340+";");src.push("uniform vec3 lightDir"+_i340+";");}}if(clipping){src.push("out vec4 vWorldPosition;");src.push("flat out uint vFlags2;");}src.push("out vec4 vColor;");src.push("void main(void) {");// constants
16506
+ );gl.drawArrays(gl.TRIANGLES,0,state.numIndices32Bits);}frameCtx.drawElements++;}},{key:"_allocate",value:function _allocate(){var scene=this._scene;var gl=scene.canvas.gl;var lightsState=scene._lightsState;this._program=new Program(gl,this._buildShader());if(this._program.errors){this.errors=this._program.errors;console.error(this.errors);return;}var program=this._program;this._uRenderPass=program.getLocation("renderPass");this._uLightAmbient=program.getLocation("lightAmbient");this._uLightColor=[];this._uLightDir=[];this._uLightPos=[];this._uLightAttenuation=[];var lights=lightsState.lights;var light;for(var _i337=0,len=lights.length;_i337<len;_i337++){light=lights[_i337];switch(light.type){case"dir":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=null;this._uLightDir[_i337]=program.getLocation("lightDir"+_i337);break;case"point":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=program.getLocation("lightPos"+_i337);this._uLightDir[_i337]=null;this._uLightAttenuation[_i337]=program.getLocation("lightAttenuation"+_i337);break;case"spot":this._uLightColor[_i337]=program.getLocation("lightColor"+_i337);this._uLightPos[_i337]=program.getLocation("lightPos"+_i337);this._uLightDir[_i337]=program.getLocation("lightDir"+_i337);this._uLightAttenuation[_i337]=program.getLocation("lightAttenuation"+_i337);break;}}this._uSceneModelMatrix=program.getLocation("sceneModelMatrix");this._uViewMatrix=program.getLocation("viewMatrix");this._uProjMatrix=program.getLocation("projMatrix");this._uSectionPlanes=[];for(var _i338=0,_len71=scene._sectionPlanesState.getNumAllocatedSectionPlanes();_i338<_len71;_i338++){this._uSectionPlanes.push({active:program.getLocation("sectionPlaneActive"+_i338),pos:program.getLocation("sectionPlanePos"+_i338),dir:program.getLocation("sectionPlaneDir"+_i338)});}if(this._withSAO){this._uOcclusionTexture="uOcclusionTexture";this._uSAOParams=program.getLocation("uSAOParams");}if(scene.logarithmicDepthBufferEnabled){this._uLogDepthBufFC=program.getLocation("logDepthBufFC");}this.uTexturePerObjectPositionsDecodeMatrix="uObjectPerObjectPositionsDecodeMatrix";this.uTexturePerObjectColorsAndFlags="uObjectPerObjectColorsAndFlags";this._uTexturePerVertexIdCoordinates="uTexturePerVertexIdCoordinates";this._uTexturePerPolygonIdNormals="uTexturePerPolygonIdNormals";this._uTexturePerPolygonIdIndices="uTexturePerPolygonIdIndices";this._uTexturePerPolygonIdPortionIds="uTexturePerPolygonIdPortionIds";this._uTexturePerObjectMatrix="uTexturePerObjectMatrix";this._uCameraEyeRtc=program.getLocation("uCameraEyeRtc");}},{key:"_bindProgram",value:function _bindProgram(frameCtx){var scene=this._scene;var gl=scene.canvas.gl;var program=this._program;var lights=scene._lightsState.lights;var project=scene.camera.project;program.bind();if(this._uLightAmbient){gl.uniform4fv(this._uLightAmbient,scene._lightsState.getAmbientColorAndIntensity());}for(var _i339=0,len=lights.length;_i339<len;_i339++){var light=lights[_i339];if(this._uLightColor[_i339]){gl.uniform4f(this._uLightColor[_i339],light.color[0],light.color[1],light.color[2],light.intensity);}if(this._uLightPos[_i339]){gl.uniform3fv(this._uLightPos[_i339],light.pos);if(this._uLightAttenuation[_i339]){gl.uniform1f(this._uLightAttenuation[_i339],light.attenuation);}}if(this._uLightDir[_i339]){gl.uniform3fv(this._uLightDir[_i339],light.dir);}}if(this._withSAO){var sao=scene.sao;var saoEnabled=sao.possible;if(saoEnabled){var viewportWidth=gl.drawingBufferWidth;var viewportHeight=gl.drawingBufferHeight;tempVec4a$4[0]=viewportWidth;tempVec4a$4[1]=viewportHeight;tempVec4a$4[2]=sao.blendCutoff;tempVec4a$4[3]=sao.blendFactor;gl.uniform4fv(this._uSAOParams,tempVec4a$4);this._program.bindTexture(this._uOcclusionTexture,frameCtx.occlusionTexture,10);}}if(scene.logarithmicDepthBufferEnabled){var logDepthBufFC=2.0/(Math.log(project.far+1.0)/Math.LN2);gl.uniform1f(this._uLogDepthBufFC,logDepthBufFC);}}},{key:"_buildShader",value:function _buildShader(){return{vertex:this._buildVertexShader(),fragment:this._buildFragmentShader()};}},{key:"_buildVertexShader",value:function _buildVertexShader(){var scene=this._scene;var sectionPlanesState=scene._sectionPlanesState;var lightsState=scene._lightsState;var clipping=sectionPlanesState.getNumAllocatedSectionPlanes()>0;var light;var src=[];src.push("#version 300 es");src.push("// TrianglesDataTextureColorRenderer vertex shader");src.push("#ifdef GL_FRAGMENT_PRECISION_HIGH");src.push("precision highp float;");src.push("precision highp int;");src.push("precision highp usampler2D;");src.push("precision highp isampler2D;");src.push("precision highp sampler2D;");src.push("#else");src.push("precision mediump float;");src.push("precision mediump int;");src.push("precision mediump usampler2D;");src.push("precision mediump isampler2D;");src.push("precision mediump sampler2D;");src.push("#endif");src.push("uniform int renderPass;");src.push("uniform mat4 sceneModelMatrix;");src.push("uniform mat4 viewMatrix;");src.push("uniform mat4 projMatrix;");src.push("uniform highp sampler2D uObjectPerObjectPositionsDecodeMatrix;");src.push("uniform highp sampler2D uTexturePerObjectMatrix;");src.push("uniform lowp usampler2D uObjectPerObjectColorsAndFlags;");src.push("uniform mediump usampler2D uTexturePerVertexIdCoordinates;");src.push("uniform highp usampler2D uTexturePerPolygonIdIndices;");src.push("uniform mediump usampler2D uTexturePerPolygonIdPortionIds;");src.push("uniform vec3 uCameraEyeRtc;");src.push("vec3 positions[3];");if(scene.logarithmicDepthBufferEnabled){src.push("uniform float logDepthBufFC;");src.push("out float vFragDepth;");src.push("out float isPerspective;");}src.push("bool isPerspectiveMatrix(mat4 m) {");src.push(" return (m[2][3] == - 1.0);");src.push("}");src.push("uniform vec4 lightAmbient;");for(var _i340=0,len=lightsState.lights.length;_i340<len;_i340++){light=lightsState.lights[_i340];if(light.type==="ambient"){continue;}src.push("uniform vec4 lightColor"+_i340+";");if(light.type==="dir"){src.push("uniform vec3 lightDir"+_i340+";");}if(light.type==="point"){src.push("uniform vec3 lightPos"+_i340+";");}if(light.type==="spot"){src.push("uniform vec3 lightPos"+_i340+";");src.push("uniform vec3 lightDir"+_i340+";");}}if(clipping){src.push("out vec4 vWorldPosition;");src.push("flat out uint vFlags2;");}src.push("out vec4 vColor;");src.push("void main(void) {");// constants
16505
16507
  src.push("int polygonIndex = gl_VertexID / 3;");// get packed object-id
16506
16508
  src.push("int h_packed_object_id_index = (polygonIndex >> 3) & 4095;");src.push("int v_packed_object_id_index = (polygonIndex >> 3) >> 12;");src.push("int objectIndex = int(texelFetch(uTexturePerPolygonIdPortionIds, ivec2(h_packed_object_id_index, v_packed_object_id_index), 0).r);");src.push("ivec2 objectIndexCoords = ivec2(objectIndex % 512, objectIndex / 512);");// get flags & flags2
16507
16509
  src.push("uvec4 flags = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+2, objectIndexCoords.y), 0);");src.push("uvec4 flags2 = texelFetch (uObjectPerObjectColorsAndFlags, ivec2(objectIndexCoords.x*8+3, objectIndexCoords.y), 0);");// flags.x = NOT_RENDERED | COLOR_OPAQUE | COLOR_TRANSPARENT
@@ -19742,12 +19744,12 @@ if(metaModelData.propertySets){for(var _i469=0,_len95=metaModelData.propertySets
19742
19744
  */var IFCObjectDefaults={DEFAULT:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof(exports))&&"undefined"!="object"?e(exports):"function"==typeof define&&__webpack_require__.amdO?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a6=i;_a6<s;_a6++)t=t>>>8^n[255&(t^e[_a6])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i470=-1;if(_i470=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i470<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i471=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i471>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i471-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i471),a.pending),a.pending+=_i471,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i472=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i472&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i472,_i472)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i472=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i472&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i472,_i472)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i473=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i473&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i473,_i473)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i473=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i473&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i473,_i473));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i474=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i474&&4!==_i474||(a.status=bt),1===_i474||3===_i474)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i474&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e7);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a7=e.shift();if(_a7){if("object"!=_typeof(_a7))throw new TypeError(_a7+"must be non-object");for(var _e8 in _a7)Ht(_a7,_e8)&&(t[_e8]=_a7[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a8=0,_i475=t.length;_a8<_i475;_a8++)e+=t[_a8].length;var a=new Uint8Array(e);for(var _e9=0,_i476=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i476),_i476+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++)Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e10=t[i++];if(_e10<128){s[n++]=_e10;continue;}var _r2=Yt[_e10];if(_r2>4)s[n++]=65533,i+=_r2-1;else{for(_e10&=2===_r2?31:3===_r2?15:7;_r2>1&&i<a;)_e10=_e10<<6|63&t[i++],_r2--;_r2>1?s[n++]=65533:_e10<65536?s[n++]=_e10:(_e10-=65536,s[n++]=55296|_e10>>10&1023,s[n++]=56320|1023&_e10);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i477=0;_i477<e;_i477++)a+=String.fromCharCode(t[_i477]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e11=0;for(;_e11<144;)t.lens[_e11++]=8;for(;_e11<256;)t.lens[_e11++]=9;for(;_e11<280;)t.lens[_e11++]=7;for(;_e11<288;)t.lens[_e11++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e11=0;_e11<32;)t.lens[_e11++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e12=a.next_out-_t6,_n5=Xt(a.output,_t6);a.next_out=_e12,a.avail_out=i-_e12,_e12&&a.output.set(a.output.subarray(_t6,_t6+_e12),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
19743
19745
  Parser for .XTC Format V10
19744
19746
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
19745
- pako=pako["default"];}var tempVec4a$2=math.vec4();var tempVec4b$2=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:"string"})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
19747
+ pako=pako["default"];}var tempVec4a$3=math.vec4();var tempVec4b$3=math.vec4();var NUM_TEXTURE_ATTRIBUTES$1=9;function extract(elements){var i=0;return{metadata:elements[i++],textureData:elements[i++],eachTextureDataPortion:elements[i++],eachTextureAttributes:elements[i++],positions:elements[i++],normals:elements[i++],colors:elements[i++],uvs:elements[i++],indices:elements[i++],edgeIndices:elements[i++],eachTextureSetTextures:elements[i++],matrices:elements[i++],reusedGeometriesDecodeMatrix:elements[i++],eachGeometryPrimitiveType:elements[i++],eachGeometryPositionsPortion:elements[i++],eachGeometryNormalsPortion:elements[i++],eachGeometryColorsPortion:elements[i++],eachGeometryUVsPortion:elements[i++],eachGeometryIndicesPortion:elements[i++],eachGeometryEdgeIndicesPortion:elements[i++],eachMeshGeometriesPortion:elements[i++],eachMeshMatricesPortion:elements[i++],eachMeshTextureSet:elements[i++],eachMeshMaterialAttributes:elements[i++],eachEntityId:elements[i++],eachEntityMeshesPortion:elements[i++],eachTileAABB:elements[i++],eachTileEntitiesPortion:elements[i++]};}function inflate(deflatedData){function inflate(array,options){return array.length===0?[]:pako.inflate(array,options).buffer;}return{metadata:JSON.parse(pako.inflate(deflatedData.metadata,{to:"string"})),textureData:new Uint8Array(inflate(deflatedData.textureData)),// <<----------------------------- ??? ZIPPing to blame?
19746
19748
  eachTextureDataPortion:new Uint32Array(inflate(deflatedData.eachTextureDataPortion)),eachTextureAttributes:new Uint16Array(inflate(deflatedData.eachTextureAttributes)),positions:new Uint16Array(inflate(deflatedData.positions)),normals:new Int8Array(inflate(deflatedData.normals)),colors:new Uint8Array(inflate(deflatedData.colors)),uvs:new Float32Array(inflate(deflatedData.uvs)),indices:new Uint32Array(inflate(deflatedData.indices)),edgeIndices:new Uint32Array(inflate(deflatedData.edgeIndices)),eachTextureSetTextures:new Int32Array(inflate(deflatedData.eachTextureSetTextures)),matrices:new Float32Array(inflate(deflatedData.matrices)),reusedGeometriesDecodeMatrix:new Float32Array(inflate(deflatedData.reusedGeometriesDecodeMatrix)),eachGeometryPrimitiveType:new Uint8Array(inflate(deflatedData.eachGeometryPrimitiveType)),eachGeometryPositionsPortion:new Uint32Array(inflate(deflatedData.eachGeometryPositionsPortion)),eachGeometryNormalsPortion:new Uint32Array(inflate(deflatedData.eachGeometryNormalsPortion)),eachGeometryColorsPortion:new Uint32Array(inflate(deflatedData.eachGeometryColorsPortion)),eachGeometryUVsPortion:new Uint32Array(inflate(deflatedData.eachGeometryUVsPortion)),eachGeometryIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryIndicesPortion)),eachGeometryEdgeIndicesPortion:new Uint32Array(inflate(deflatedData.eachGeometryEdgeIndicesPortion)),eachMeshGeometriesPortion:new Uint32Array(inflate(deflatedData.eachMeshGeometriesPortion)),eachMeshMatricesPortion:new Uint32Array(inflate(deflatedData.eachMeshMatricesPortion)),eachMeshTextureSet:new Int32Array(inflate(deflatedData.eachMeshTextureSet)),// Can be -1
19747
- eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;// Metadata
19749
+ eachMeshMaterialAttributes:new Uint8Array(inflate(deflatedData.eachMeshMaterialAttributes)),eachEntityId:JSON.parse(pako.inflate(deflatedData.eachEntityId,{to:"string"})),eachEntityMeshesPortion:new Uint32Array(inflate(deflatedData.eachEntityMeshesPortion)),eachTileAABB:new Float64Array(inflate(deflatedData.eachTileAABB)),eachTileEntitiesPortion:new Uint32Array(inflate(deflatedData.eachTileEntitiesPortion))};}function inflateMetadata(deflatedData){return JSON.parse(pako.inflate(deflatedData,{to:"string"}));}var decompressColor$1=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;// Metadata
19748
19750
  if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
19749
19751
  }// Create textures
19750
- for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;var mediaType=eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
19752
+ for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES$1;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;var mediaType=eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
19751
19753
  var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19752
19754
  var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19753
19755
  var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
@@ -19759,10 +19761,37 @@ var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};f
19759
19761
  for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xtcEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xtcEntityId):xtcEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
19760
19762
  if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
19761
19763
  var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
19762
- for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
19764
+ for(var _meshIndex=firstMeshIndex;_meshIndex<=lastMeshIndex;_meshIndex++){var _geometryIndex=eachMeshGeometriesPortion[_meshIndex];var geometryReuseCount=geometryReuseCounts[_geometryIndex];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex===numGeometries-1;var _textureSetIndex=eachMeshTextureSet[_meshIndex];var _textureSetId=_textureSetIndex>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex):null;var meshColor=decompressColor$1(eachMeshMaterialAttributes.subarray(_meshIndex*6,_meshIndex*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
19763
19765
  var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex);// These IDs are local to the SceneModel
19764
- var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i478=0,len=geometryPositions.length;_i478<len;_i478+=3){decompressedPositions[_i478+0]=geometryPositions[_i478+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i478+1]=geometryPositions[_i478+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i478+2]=geometryPositions[_i478+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i479=0,_len96=_decompressedPositions.length;_i479<_len96;_i479+=3){tempVec4a$2[0]=_decompressedPositions[_i479+0];tempVec4a$2[1]=_decompressedPositions[_i479+1];tempVec4a$2[2]=_decompressedPositions[_i479+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i479+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i479+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i479+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
19765
- var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i480=0,len=indices.length-1;_i480<len;_i480++){linesIndices.push(indices[_i480]);linesIndices.push(indices[_i480+1]);}}else if(positions.length>1){for(var _i481=0,_len97=positions.length/3-1;_i481<_len97;_i481++){linesIndices.push(_i481);linesIndices.push(_i481+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},inflateMetadata:inflateMetadata};var parsers={};// parsers[ParserV1.version] = ParserV1;
19766
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryArrays.geometryIndices=lineStripToLines$1(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i478=0,len=geometryPositions.length;_i478<len;_i478+=3){decompressedPositions[_i478+0]=geometryPositions[_i478+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i478+1]=geometryPositions[_i478+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i478+2]=geometryPositions[_i478+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i479=0,_len96=_decompressedPositions.length;_i479<_len96;_i479+=3){tempVec4a$3[0]=_decompressedPositions[_i479+0];tempVec4a$3[1]=_decompressedPositions[_i479+1];tempVec4a$3[2]=_decompressedPositions[_i479+2];tempVec4a$3[3]=1;math.transformVec4(meshMatrix,tempVec4a$3,tempVec4b$3);geometryCompressionUtils.compressPosition(tempVec4b$3,rtcAABB,tempVec4a$3);transformedAndRecompressedPositions[_i479+0]=tempVec4a$3[0];transformedAndRecompressedPositions[_i479+1]=tempVec4a$3[1];transformedAndRecompressedPositions[_i479+2]=tempVec4a$3[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
19767
+ var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=void 0;var _geometryPositions=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid=false;switch(_primitiveType){case 0:primitiveName="solid";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0;break;case 3:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]);_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex+1]);geometryIndices=lineStripToLines$1(_geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex+1]));_geometryValid=_geometryPositions.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines$1(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i480=0,len=indices.length-1;_i480<len;_i480++){linesIndices.push(indices[_i480]);linesIndices.push(indices[_i480+1]);}}else if(positions.length>1){for(var _i481=0,_len97=positions.length/3-1;_i481<_len97;_i481++){linesIndices.push(_i481);linesIndices.push(_i481+1);}}return linesIndices;}/** @private */var ParserV10={version:10,parse:function parse(viewer,options,elements,sceneModel,metaModel,manifestCtx){var deflatedData=extract(elements);var inflatedData=inflate(deflatedData);load$1(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);},inflateMetadata:inflateMetadata};/*
19768
+ Parser for .XTC Format V11
19769
+ */var tempVec4a$2=math.vec4();var tempVec4b$2=math.vec4();var NUM_TEXTURE_ATTRIBUTES=9;function decodeData(arrayBuffer){var requiresSwapFromLittleEndian=function(){var buffer=new ArrayBuffer(2);new Uint16Array(buffer)[0]=1;return new Uint8Array(buffer)[0]!==1;}();var nextArray=function(){var i=0;var dataView=new DataView(arrayBuffer);return function(type){var idx=1+2*i++;// `1' for the version nr
19770
+ var byteOffset=dataView.getUint32(idx*4,true);var byteLength=dataView.getUint32((idx+1)*4,true);var BPE=type.BYTES_PER_ELEMENT;if(requiresSwapFromLittleEndian&&BPE>1){var subarray=new Uint8Array(arrayBuffer,byteOffset,byteLength);var swaps=BPE/2;var cnt=subarray.length/BPE;for(var b=0;b<cnt;b++){var offset=b*BPE;for(var j=0;j<swaps;j++){var i1=offset+j;var i2=offset-j+BPE-1;var tmp=subarray[i1];subarray[i1]=subarray[i2];subarray[i2]=tmp;}}}return new type(arrayBuffer,byteOffset,byteLength/BPE);};}();var nextObject=function(){var decoder=new TextDecoder();return function(){return JSON.parse(decoder.decode(nextArray(Uint8Array)));};}();return{metadata:nextObject(),textureData:nextArray(Uint8Array),// <<----------------------------- ??? ZIPPing to blame?
19771
+ eachTextureDataPortion:nextArray(Uint32Array),eachTextureAttributes:nextArray(Uint16Array),positions:nextArray(Uint16Array),normals:nextArray(Int8Array),colors:nextArray(Uint8Array),uvs:nextArray(Float32Array),indices:nextArray(Uint32Array),edgeIndices:nextArray(Uint32Array),eachTextureSetTextures:nextArray(Int32Array),matrices:nextArray(Float32Array),reusedGeometriesDecodeMatrix:nextArray(Float32Array),eachGeometryPrimitiveType:nextArray(Uint8Array),eachGeometryPositionsPortion:nextArray(Uint32Array),eachGeometryNormalsPortion:nextArray(Uint32Array),eachGeometryColorsPortion:nextArray(Uint32Array),eachGeometryUVsPortion:nextArray(Uint32Array),eachGeometryIndicesPortion:nextArray(Uint32Array),eachGeometryEdgeIndicesPortion:nextArray(Uint32Array),eachMeshGeometriesPortion:nextArray(Uint32Array),eachMeshMatricesPortion:nextArray(Uint32Array),eachMeshTextureSet:nextArray(Int32Array),// Can be -1
19772
+ eachMeshMaterialAttributes:nextArray(Uint8Array),eachEntityId:nextObject(),eachEntityMeshesPortion:nextArray(Uint32Array),eachTileAABB:nextArray(Float64Array),eachTileEntitiesPortion:nextArray(Uint32Array)};}var decompressColor=function(){var floatColor=new Float32Array(3);return function(intColor){floatColor[0]=intColor[0]/255.0;floatColor[1]=intColor[1]/255.0;floatColor[2]=intColor[2]/255.0;return floatColor;};}();(function(){var canvas=document.createElement("canvas");var context=canvas.getContext("2d");return function(imagedata){canvas.width=imagedata.width;canvas.height=imagedata.height;context.putImageData(imagedata,0,0);return canvas.toDataURL();};})();function load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx){var modelPartId=manifestCtx.getNextId();var metadata=inflatedData.metadata;var textureData=inflatedData.textureData;var eachTextureDataPortion=inflatedData.eachTextureDataPortion;var eachTextureAttributes=inflatedData.eachTextureAttributes;var positions=inflatedData.positions;var normals=inflatedData.normals;var colors=inflatedData.colors;var uvs=inflatedData.uvs;var indices=inflatedData.indices;var edgeIndices=inflatedData.edgeIndices;var eachTextureSetTextures=inflatedData.eachTextureSetTextures;var matrices=inflatedData.matrices;var reusedGeometriesDecodeMatrix=inflatedData.reusedGeometriesDecodeMatrix;var eachGeometryPrimitiveType=inflatedData.eachGeometryPrimitiveType;var eachGeometryPositionsPortion=inflatedData.eachGeometryPositionsPortion;var eachGeometryNormalsPortion=inflatedData.eachGeometryNormalsPortion;var eachGeometryColorsPortion=inflatedData.eachGeometryColorsPortion;var eachGeometryUVsPortion=inflatedData.eachGeometryUVsPortion;var eachGeometryIndicesPortion=inflatedData.eachGeometryIndicesPortion;var eachGeometryEdgeIndicesPortion=inflatedData.eachGeometryEdgeIndicesPortion;var eachMeshGeometriesPortion=inflatedData.eachMeshGeometriesPortion;var eachMeshMatricesPortion=inflatedData.eachMeshMatricesPortion;var eachMeshTextureSet=inflatedData.eachMeshTextureSet;var eachMeshMaterialAttributes=inflatedData.eachMeshMaterialAttributes;var eachEntityId=inflatedData.eachEntityId;var eachEntityMeshesPortion=inflatedData.eachEntityMeshesPortion;var eachTileAABB=inflatedData.eachTileAABB;var eachTileEntitiesPortion=inflatedData.eachTileEntitiesPortion;var numTextures=eachTextureDataPortion.length;var numTextureSets=eachTextureSetTextures.length/5;var numGeometries=eachGeometryPositionsPortion.length;var numMeshes=eachMeshGeometriesPortion.length;var numEntities=eachEntityMeshesPortion.length;var numTiles=eachTileEntitiesPortion.length;if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
19773
+ }// Create textures
19774
+ for(var textureIndex=0;textureIndex<numTextures;textureIndex++){var atLastTexture=textureIndex===numTextures-1;var textureDataPortionStart=eachTextureDataPortion[textureIndex];var textureDataPortionEnd=atLastTexture?textureData.length:eachTextureDataPortion[textureIndex+1];var textureDataPortionSize=textureDataPortionEnd-textureDataPortionStart;var textureDataPortionExists=textureDataPortionSize>0;var textureAttrBaseIdx=textureIndex*NUM_TEXTURE_ATTRIBUTES;var compressed=eachTextureAttributes[textureAttrBaseIdx+0]===1;var mediaType=eachTextureAttributes[textureAttrBaseIdx+1];eachTextureAttributes[textureAttrBaseIdx+2];eachTextureAttributes[textureAttrBaseIdx+3];var minFilter=eachTextureAttributes[textureAttrBaseIdx+4];var magFilter=eachTextureAttributes[textureAttrBaseIdx+5];// LinearFilter | NearestFilter
19775
+ var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19776
+ var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19777
+ var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19778
+ if(textureDataPortionExists){var imageDataSubarray=new Uint8Array(textureData.subarray(textureDataPortionStart,textureDataPortionEnd));var arrayBuffer=imageDataSubarray.buffer;var textureId="".concat(modelPartId,"-texture-").concat(textureIndex);if(compressed){sceneModel.createTexture({id:textureId,buffers:[arrayBuffer],minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}else{var mimeType=mediaType===JPEGMediaType?"image/jpeg":mediaType===PNGMediaType?"image/png":"image/gif";var blob=new Blob([arrayBuffer],{type:mimeType});var urlCreator=window.URL||window.webkitURL;var imageUrl=urlCreator.createObjectURL(blob);var img=document.createElement("img");img.src=imageUrl;sceneModel.createTexture({id:textureId,image:img,//mediaType,
19779
+ minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
19780
+ for(var textureSetIndex=0;textureSetIndex<numTextureSets;textureSetIndex++){var eachTextureSetTexturesIndex=textureSetIndex*5;var textureSetId="".concat(modelPartId,"-textureSet-").concat(textureSetIndex);var colorTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+0];var metallicRoughnessTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+1];var normalsTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+2];var emissiveTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+3];var occlusionTextureIndex=eachTextureSetTextures[eachTextureSetTexturesIndex+4];sceneModel.createTextureSet({id:textureSetId,colorTextureId:colorTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(colorTextureIndex):null,normalsTextureId:normalsTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(normalsTextureIndex):null,metallicRoughnessTextureId:metallicRoughnessTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(metallicRoughnessTextureIndex):null,emissiveTextureId:emissiveTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(emissiveTextureIndex):null,occlusionTextureId:occlusionTextureIndex>=0?"".concat(modelPartId,"-texture-").concat(occlusionTextureIndex):null});}// Count instances of each geometry
19781
+ var geometryReuseCounts=new Uint32Array(numGeometries);for(var meshIndex=0;meshIndex<numMeshes;meshIndex++){var geometryIndex=eachMeshGeometriesPortion[meshIndex];if(geometryReuseCounts[geometryIndex]!==undefined){geometryReuseCounts[geometryIndex]++;}else{geometryReuseCounts[geometryIndex]=1;}}// Iterate over tiles
19782
+ var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};for(var tileIndex=0;tileIndex<numTiles;tileIndex++){var lastTileIndex=numTiles-1;var atLastTile=tileIndex===lastTileIndex;var firstTileEntityIndex=eachTileEntitiesPortion[tileIndex];var lastTileEntityIndex=atLastTile?numEntities-1:eachTileEntitiesPortion[tileIndex+1]-1;var tileAABBIndex=tileIndex*6;var tileAABB=eachTileAABB.subarray(tileAABBIndex,tileAABBIndex+6);math.getAABB3Center(tileAABB,tileCenter);rtcAABB[0]=tileAABB[0]-tileCenter[0];rtcAABB[1]=tileAABB[1]-tileCenter[1];rtcAABB[2]=tileAABB[2]-tileCenter[2];rtcAABB[3]=tileAABB[3]-tileCenter[0];rtcAABB[4]=tileAABB[4]-tileCenter[1];rtcAABB[5]=tileAABB[5]-tileCenter[2];var tileDecodeMatrix=geometryCompressionUtils.createPositionsDecodeMatrix(rtcAABB);var geometryCreatedInTile={};// Iterate over each tile's entities
19783
+ for(var tileEntityIndex=firstTileEntityIndex;tileEntityIndex<=lastTileEntityIndex;tileEntityIndex++){var xtcEntityId=eachEntityId[tileEntityIndex];var entityId=options.globalizeObjectIds?math.globalizeObjectId(sceneModel.id,xtcEntityId):xtcEntityId;var finalTileEntityIndex=numEntities-1;var atLastTileEntity=tileEntityIndex===finalTileEntityIndex;var firstMeshIndex=eachEntityMeshesPortion[tileEntityIndex];var lastMeshIndex=atLastTileEntity?eachMeshGeometriesPortion.length-1:eachEntityMeshesPortion[tileEntityIndex+1]-1;var meshIds=[];var metaObject=viewer.metaScene.metaObjects[entityId];var entityDefaults={};var meshDefaults={};if(metaObject){// Mask loading of object types
19784
+ if(options.excludeTypesMap&&metaObject.type&&options.excludeTypesMap[metaObject.type]){continue;}if(options.includeTypesMap&&metaObject.type&&!options.includeTypesMap[metaObject.type]){continue;}// Get initial property values for object types
19785
+ var props=options.objectDefaults?options.objectDefaults[metaObject.type]||options.objectDefaults["DEFAULT"]:null;if(props){if(props.visible===false){entityDefaults.visible=false;}if(props.pickable===false){entityDefaults.pickable=false;}if(props.colorize){meshDefaults.color=props.colorize;}if(props.opacity!==undefined&&props.opacity!==null){meshDefaults.opacity=props.opacity;}if(props.metallic!==undefined&&props.metallic!==null){meshDefaults.metallic=props.metallic;}if(props.roughness!==undefined&&props.roughness!==null){meshDefaults.roughness=props.roughness;}}}else{if(options.excludeUnclassifiedObjects){continue;}}// Iterate each entity's meshes
19786
+ for(var _meshIndex2=firstMeshIndex;_meshIndex2<=lastMeshIndex;_meshIndex2++){var _geometryIndex2=eachMeshGeometriesPortion[_meshIndex2];var geometryReuseCount=geometryReuseCounts[_geometryIndex2];var isReusedGeometry=geometryReuseCount>1;var atLastGeometry=_geometryIndex2===numGeometries-1;var _textureSetIndex2=eachMeshTextureSet[_meshIndex2];var _textureSetId2=_textureSetIndex2>=0?"".concat(modelPartId,"-textureSet-").concat(_textureSetIndex2):null;var meshColor=decompressColor(eachMeshMaterialAttributes.subarray(_meshIndex2*6,_meshIndex2*6+3));var meshOpacity=eachMeshMaterialAttributes[_meshIndex2*6+3]/255.0;var meshMetallic=eachMeshMaterialAttributes[_meshIndex2*6+4]/255.0;var meshRoughness=eachMeshMaterialAttributes[_meshIndex2*6+5]/255.0;var meshId=manifestCtx.getNextId();if(isReusedGeometry){// Create mesh for multi-use geometry - create (or reuse) geometry, create mesh using that geometry
19787
+ var meshMatrixIndex=eachMeshMatricesPortion[_meshIndex2];var meshMatrix=matrices.slice(meshMatrixIndex,meshMatrixIndex+16);var geometryId="".concat(modelPartId,"-geometry.").concat(tileIndex,".").concat(_geometryIndex2);// These IDs are local to the SceneModel
19788
+ var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[_geometryIndex2];var geometryValid=false;switch(primitiveType){case 0:geometryArrays.primitiveName="solid";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex2],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 1:geometryArrays.primitiveName="surface";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryArrays.geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex2],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryArrays.geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 2:geometryArrays.primitiveName="points";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0;break;case 3:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;case 4:geometryArrays.primitiveName="lines";geometryArrays.geometryPositions=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryArrays.geometryIndices=lineStripToLines(geometryArrays.geometryPositions,indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]));geometryValid=geometryArrays.geometryPositions.length>0&&geometryArrays.geometryIndices.length>0;break;default:continue;}if(!geometryValid){geometryArrays=null;}if(geometryArrays){if(geometryArrays.geometryPositions.length>1000);if(geometryArrays.batchThisMesh){geometryArrays.decompressedPositions=new Float32Array(geometryArrays.geometryPositions.length);geometryArrays.transformedAndRecompressedPositions=new Uint16Array(geometryArrays.geometryPositions.length);var geometryPositions=geometryArrays.geometryPositions;var decompressedPositions=geometryArrays.decompressedPositions;for(var _i482=0,len=geometryPositions.length;_i482<len;_i482+=3){decompressedPositions[_i482+0]=geometryPositions[_i482+0]*reusedGeometriesDecodeMatrix[0]+reusedGeometriesDecodeMatrix[12];decompressedPositions[_i482+1]=geometryPositions[_i482+1]*reusedGeometriesDecodeMatrix[5]+reusedGeometriesDecodeMatrix[13];decompressedPositions[_i482+2]=geometryPositions[_i482+2]*reusedGeometriesDecodeMatrix[10]+reusedGeometriesDecodeMatrix[14];}geometryArrays.geometryPositions=null;geometryArraysCache[geometryId]=geometryArrays;}}}if(geometryArrays){if(geometryArrays.batchThisMesh){var _decompressedPositions2=geometryArrays.decompressedPositions;var transformedAndRecompressedPositions=geometryArrays.transformedAndRecompressedPositions;for(var _i483=0,_len98=_decompressedPositions2.length;_i483<_len98;_i483+=3){tempVec4a$2[0]=_decompressedPositions2[_i483+0];tempVec4a$2[1]=_decompressedPositions2[_i483+1];tempVec4a$2[2]=_decompressedPositions2[_i483+2];tempVec4a$2[3]=1;math.transformVec4(meshMatrix,tempVec4a$2,tempVec4b$2);geometryCompressionUtils.compressPosition(tempVec4b$2,rtcAABB,tempVec4a$2);transformedAndRecompressedPositions[_i483+0]=tempVec4a$2[0];transformedAndRecompressedPositions[_i483+1]=tempVec4a$2[1];transformedAndRecompressedPositions[_i483+2]=tempVec4a$2[2];}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:geometryArrays.primitiveName,positionsCompressed:transformedAndRecompressedPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}else{if(!geometryCreatedInTile[geometryId]){sceneModel.createGeometry({id:geometryId,primitive:geometryArrays.primitiveName,positionsCompressed:geometryArrays.geometryPositions,normalsCompressed:geometryArrays.geometryNormals,uv:geometryArrays.geometryUVs,colorsCompressed:geometryArrays.geometryColors,indices:geometryArrays.geometryIndices,edgeIndices:geometryArrays.geometryEdgeIndices,positionsDecodeMatrix:reusedGeometriesDecodeMatrix});geometryCreatedInTile[geometryId]=true;}sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,geometryId:geometryId,textureSetId:_textureSetId2,matrix:meshMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity,origin:tileCenter}));meshIds.push(meshId);}}}else{// Do not reuse geometry
19789
+ var _primitiveType2=eachGeometryPrimitiveType[_geometryIndex2];var primitiveName=void 0;var _geometryPositions2=void 0;var geometryNormals=void 0;var geometryUVs=void 0;var geometryColors=void 0;var geometryIndices=void 0;var geometryEdgeIndices=void 0;var _geometryValid2=false;switch(_primitiveType2){case 0:primitiveName="solid";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex2],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid2=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 1:primitiveName="surface";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryNormals=normals.subarray(eachGeometryNormalsPortion[_geometryIndex2],atLastGeometry?normals.length:eachGeometryNormalsPortion[_geometryIndex2+1]);geometryUVs=uvs.subarray(eachGeometryUVsPortion[_geometryIndex2],atLastGeometry?uvs.length:eachGeometryUVsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);geometryEdgeIndices=edgeIndices.subarray(eachGeometryEdgeIndicesPortion[_geometryIndex2],atLastGeometry?edgeIndices.length:eachGeometryEdgeIndicesPortion[_geometryIndex2+1]);_geometryValid2=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 2:primitiveName="points";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryColors=colors.subarray(eachGeometryColorsPortion[_geometryIndex2],atLastGeometry?colors.length:eachGeometryColorsPortion[_geometryIndex2+1]);_geometryValid2=_geometryPositions2.length>0;break;case 3:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]);_geometryValid2=_geometryPositions2.length>0&&geometryIndices.length>0;break;case 4:primitiveName="lines";_geometryPositions2=positions.subarray(eachGeometryPositionsPortion[_geometryIndex2],atLastGeometry?positions.length:eachGeometryPositionsPortion[_geometryIndex2+1]);geometryIndices=lineStripToLines(_geometryPositions2,indices.subarray(eachGeometryIndicesPortion[_geometryIndex2],atLastGeometry?indices.length:eachGeometryIndicesPortion[_geometryIndex2+1]));_geometryValid2=_geometryPositions2.length>0&&geometryIndices.length>0;break;default:continue;}if(_geometryValid2){sceneModel.createMesh(utils.apply(meshDefaults,{id:meshId,textureSetId:_textureSetId2,origin:tileCenter,primitive:primitiveName,positionsCompressed:_geometryPositions2,normalsCompressed:geometryNormals,uv:geometryUVs&&geometryUVs.length>0?geometryUVs:null,colorsCompressed:geometryColors,indices:geometryIndices,edgeIndices:geometryEdgeIndices,positionsDecodeMatrix:tileDecodeMatrix,color:meshColor,metallic:meshMetallic,roughness:meshRoughness,opacity:meshOpacity}));meshIds.push(meshId);}}}if(meshIds.length>0){sceneModel.createEntity(utils.apply(entityDefaults,{id:entityId,isObject:true,meshIds:meshIds}));}}}}function lineStripToLines(positions,indices){var linesIndices=[];if(indices.length>1){for(var _i484=0,len=indices.length-1;_i484<len;_i484++){linesIndices.push(indices[_i484]);linesIndices.push(indices[_i484+1]);}}else if(positions.length>1){for(var _i485=0,_len99=positions.length/3-1;_i485<_len99;_i485++){linesIndices.push(_i485);linesIndices.push(_i485+1);}}return linesIndices;}/** @private */ // V11 uses a single uncompressed Uint8Array buffer to store arrays of different types.
19790
+ // To efficiently create typed arrays from this buffer,
19791
+ // each typed array's source data needs to be aligned with its element byte size.
19792
+ // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
19793
+ // It is a different encoding than used in earlier versions, and requires different approach to parsing elements.
19794
+ var ParserV11={version:11,parseArrayBuffer:function parseArrayBuffer(viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx){var inflatedData=decodeData(arrayBuffer);load(viewer,options,inflatedData,sceneModel,metaModel,manifestCtx);}};var parsers={};// parsers[ParserV1.version] = ParserV1;
19766
19795
  // parsers[ParserV2.version] = ParserV2;
19767
19796
  // parsers[ParserV3.version] = ParserV3;
19768
19797
  // parsers[ParserV4.version] = ParserV4;
@@ -19771,7 +19800,7 @@ var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=v
19771
19800
  // parsers[ParserV7.version] = ParserV7;
19772
19801
  // parsers[ParserV8.version] = ParserV8;
19773
19802
  // parsers[ParserV9.version] = ParserV9;
19774
- parsers[ParserV10.version]=ParserV10;/**
19803
+ parsers[ParserV10.version]=ParserV10;parsers[ParserV11.version]=ParserV11;/**
19775
19804
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XTC````* format.
19776
19805
  *
19777
19806
  * <a href="https://xeokit.github.io/xeokit-sdk/examples/#loading_XTC_OTCConferenceCenter"><img src="http://xeokit.io/img/docs/XTCLoaderPlugin/XTCLoaderPlugin.png"></a>
@@ -20525,15 +20554,18 @@ parsers[ParserV10.version]=ParserV10;/**
20525
20554
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
20526
20555
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
20527
20556
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
20557
+ * @param {Number} [params.renderOrder=0] Specifies the rendering order for the model. This is used to control the order in which
20558
+ * SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
20559
+ * render pass.
20528
20560
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
20529
20561
  */},{key:"load",value:function load(){var _this93=this;var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}if(!params.src&&!params.xtc&&!params.manifestSrc&&!params.manifest){this.error("load() param expected: src, xtc, manifestSrc or manifestData");return sceneModel;// Return new empty model
20530
- }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i482=0,len=includeTypes.length;_i482<len;_i482++){options.includeTypesMap[includeTypes[_i482]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i483=0,_len98=excludeTypes.length;_i483<_len98;_i483++){options.excludeTypesMap[excludeTypes[_i483]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled}));var modelId=sceneModel.id;// In case ID was auto-generated
20562
+ }var options={};var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;options.reuseGeometries=params.reuseGeometries!==null&&params.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var _i486=0,len=includeTypes.length;_i486<len;_i486++){options.includeTypesMap[includeTypes[_i486]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i487=0,_len100=excludeTypes.length;_i487<_len100;_i487++){options.excludeTypesMap[excludeTypes[_i487]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined&&params.globalizeObjectIds!==null?!!params.globalizeObjectIds:this._globalizeObjectIds;var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true,textureTranscoder:this._textureTranscoder,maxGeometryBatchSize:this._maxGeometryBatchSize,origin:params.origin,disableVertexWelding:params.disableVertexWelding||false,disableIndexRebucketing:params.disableIndexRebucketing||false,dtxEnabled:params.dtxEnabled,renderOrder:params.renderOrder}));var modelId=sceneModel.id;// In case ID was auto-generated
20531
20563
  var metaModel=new MetaModel({metaScene:this.viewer.metaScene,id:modelId});this.viewer.scene.canvas.spinner.processes++;var finish=function finish(){if(sceneModel.destroyed){return;}// this._createDefaultMetaModelIfNeeded(sceneModel, params, options);
20532
20564
  sceneModel.finalize();metaModel.finalize();_this93.viewer.scene.canvas.spinner.processes--;sceneModel.once("destroyed",function(){_this93.viewer.metaScene.destroyMetaModel(metaModel.id);});_this93.scheduleTask(function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
20533
20565
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
20534
20566
  });};var error=function error(errMsg){_this93.viewer.scene.canvas.spinner.processes--;_this93.error(errMsg);sceneModel.fire("error",errMsg);};var nextId=0;var manifestCtx={getNextId:function getNextId(){return"".concat(modelId,".").concat(nextId++);}};//模型文件
20535
20567
  if(params.metaModelSrc||params.metaModelData){if(params.metaModelSrc){var metaModelSrc=params.metaModelSrc;this._dataSource.getMetaModel(metaModelSrc,function(metaModelData){if(sceneModel.destroyed){return;}metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){_this93._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{_this93._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}},function(errMsg){error("load(): Failed to load model metadata for model '".concat(modelId," from '").concat(metaModelSrc,"' - ").concat(errMsg));});}else if(params.metaModelData){metaModel.loadData(params.metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});if(params.src){this._loadModel(params.src,params,options,sceneModel,null,manifestCtx,finish,error);}else{this._parseModel(params.xtc,params,options,sceneModel,null,manifestCtx);finish();}}}else{if(params.src){this._loadModel(params.src,params,options,sceneModel,metaModel,manifestCtx,finish,error);}else if(params.xtc){this._parseModel(params.xtc,params,options,sceneModel,metaModel,manifestCtx);finish();}else if(params.manifestSrc||params.manifest){var baseDir=params.manifestSrc?getBaseDirectory(params.manifestSrc):"";var loadJSONs=function loadJSONs(metaDataFiles,done,error){var i=0;var _loadNext=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=metaDataFiles.length){done();}else{_this93._dataSource.getMetaModel("".concat(baseDir).concat(metaDataFiles[i]),function(metaModelData){metaModel.loadData(metaModelData,{includeTypes:includeTypes,excludeTypes:excludeTypes,globalizeObjectIds:options.globalizeObjectIds});i++;_this93.scheduleTask(_loadNext,200);},error);}};_loadNext();};var loadXTCs_excludeTheirMetaModels=function loadXTCs_excludeTheirMetaModels(xtcFiles,done,error){var i=0;var _loadNext2=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this93._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this93._parseModel(arrayBuffer,params,options,sceneModel,null/* Ignore metamodel in XTC */,manifestCtx);sceneModel.preFinalize();i++;_this93.scheduleTask(_loadNext2,200);},error);}};_loadNext2();};var loadXTCs_includeTheirMetaModels=function loadXTCs_includeTheirMetaModels(xtcFiles,done,error){// Load XTCs, parse metamodels from the XTC
20536
- var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this93._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this93._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this93.scheduleTask(_loadNext3,100);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this94=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this94._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i484,elementSize;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!sceneModel.destroyed){_context2.next=2;break;}return _context2.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context2.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context2.abrupt("return");case 9:this.log("Loading .xtc V"+xtcVersion);numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i484=0;_i484<numElements;_i484++){elementSize=dataView.getUint32((_i484+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 15:case"end":return _context2.stop();}},_callee,this);}));function _parseModel(_x,_x2,_x3,_x4,_x5,_x6){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this95=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this95.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this95.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
20568
+ var i=0;var _loadNext3=function loadNext(){if(sceneModel.destroyed){done();}else if(i>=xtcFiles.length){done();}else{_this93._dataSource.getXTC("".concat(baseDir).concat(xtcFiles[i]),function(arrayBuffer){_this93._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();i++;_this93.scheduleTask(_loadNext3,200);},error);}};_loadNext3();};if(params.manifest){var manifestData=params.manifest;var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}}else{this._dataSource.getManifest(params.manifestSrc,function(manifestData){if(sceneModel.destroyed){return;}var xtcFiles=manifestData.xtcFiles;if(!xtcFiles||xtcFiles.length===0){error("load(): Failed to load model manifest - manifest not valid");return;}var metaModelFiles=manifestData.metaModelFiles;if(metaModelFiles){loadJSONs(metaModelFiles,function(){loadXTCs_excludeTheirMetaModels(xtcFiles,finish,error);},error);}else{loadXTCs_includeTheirMetaModels(xtcFiles,finish,error);}},error);}}}return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel,metaModel,manifestCtx,done,error){var _this94=this;this._dataSource.getXTC(params.src,function(arrayBuffer){_this94._parseModel(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx);sceneModel.preFinalize();done();},error);}},{key:"_parseModel",value:function(){var _parseModel2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(arrayBuffer,params,options,sceneModel,metaModel,manifestCtx){var dataView,dataArray,xtcVersion,parser,numElements,elements,byteOffset,_i488,elementSize;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:if(!sceneModel.destroyed){_context2.next=2;break;}return _context2.abrupt("return");case 2:dataView=new DataView(arrayBuffer);dataArray=new Uint8Array(arrayBuffer);xtcVersion=dataView.getUint32(0,true);parser=parsers[xtcVersion];if(parser){_context2.next=9;break;}this.error("Unsupported .XTC file version: "+xtcVersion+" - this XTCLoaderPlugin supports versions "+Object.keys(parsers));return _context2.abrupt("return");case 9:if(!parser.parseArrayBuffer){_context2.next=12;break;}parser.parseArrayBuffer(this.viewer,options,arrayBuffer,sceneModel,metaModel,manifestCtx);return _context2.abrupt("return");case 12:numElements=dataView.getUint32(4,true);elements=[];byteOffset=(numElements+2)*4;for(_i488=0;_i488<numElements;_i488++){elementSize=dataView.getUint32((_i488+2)*4,true);elements.push(dataArray.subarray(byteOffset,byteOffset+elementSize));byteOffset+=elementSize;}parser.parse(this.viewer,options,elements,sceneModel,metaModel,manifestCtx);case 17:case"end":return _context2.stop();}},_callee,this);}));function _parseModel(_x,_x2,_x3,_x4,_x5,_x6){return _parseModel2.apply(this,arguments);}return _parseModel;}()},{key:"loadMetadata",value:function loadMetadata(metaModel,deflatedMetadata,force,done){var _this95=this;metaModel._finalized=false;try{{this._workerInflate(metaModel,deflatedMetadata,force,function(worker){worker.terminate();_this95.fire("metaLoaded",{result:"success",metaModel:metaModel});if(typeof done==="function")done();},function(worker,error){worker.terminate();_this95.fire("metaLoaded",{result:"failed",message:error,metaModel:metaModel});});}}catch(error){this.fire("metaloaded",{result:error,metaModel:metaModel});}}},{key:"_workerInflate",value:function _workerInflate(metaModel,buffer,force,done,err){var plugin=this;var worker=createInlineWorker();worker.postMessage({buffer:buffer// executionTime: new Date().getTime()
20537
20569
  });worker.onmessage=function(e){if(force){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});}else{plugin.fire("metaLoading",function(){metaModel.loadData(e.data.metaJson,function(){metaModel.finalize();if(typeof done==="function")done(worker);else worker.terminate();},function(e){if(typeof err==="function")err(worker,e);});});}};worker.onerror=function(e){if(typeof err==="function")err(worker,e.message);worker.terminate();};}// _createDefaultMetaModelIfNeeded(sceneModel, params, options) {
20538
20570
  //
20539
20571
  // const metaModelId = sceneModel.id;
@@ -20872,7 +20904,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
20872
20904
  *
20873
20905
  * @param {String} subId Subscription ID
20874
20906
  */},{key:"off",value:function off(subId){if(subId===undefined||subId===null){return;}if(!this._eventSubEvents){return;}var event=this._eventSubEvents[subId];if(event){delete this._eventSubEvents[subId];var subs=this._eventSubs[event];if(subs){delete subs[subId];}this._eventSubIDMap.removeItem(subId);// Release subId
20875
- }}}]);}();function resolvePath(key,json){if(json[key]){return json[key];}var parts=key.split(".");var obj=json;for(var _i485=0,len=parts.length;obj&&_i485<len;_i485++){var part=parts[_i485];obj=obj[part];}return obj;}function vsprintf(msg){var args=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return msg.replace(/\{\{|\}\}|\{(\d+)\}/g,function(m,n){if(m==="{{"){return"{";}if(m==="}}"){return"}";}return args[n];});}/**
20907
+ }}}]);}();function resolvePath(key,json){if(json[key]){return json[key];}var parts=key.split(".");var obj=json;for(var _i489=0,len=parts.length;obj&&_i489<len;_i489++){var part=parts[_i489];obj=obj[part];}return obj;}function vsprintf(msg){var args=arguments.length>1&&arguments[1]!==undefined?arguments[1]:[];return msg.replace(/\{\{|\}\}|\{(\d+)\}/g,function(m,n){if(m==="{{"){return"{";}if(m==="}}"){return"}";}return args[n];});}/**
20876
20908
  * @desc Abstract base class for curve classes.
20877
20909
  */var Curve=/*#__PURE__*/function(_Component28){/**
20878
20910
  * @constructor
@@ -21017,7 +21049,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
21017
21049
  * Adds multiple frames to this CameraPath, each frame specified as a set of values for eye, look and up vectors at a given time instant.
21018
21050
  *
21019
21051
  * @param {{t:Number, eye:Object, look:Object, up: Object}[]} frames Frames to add to this CameraPath.
21020
- */},{key:"addFrames",value:function addFrames(frames){var frame;for(var _i486=0,len=frames.length;_i486<len;_i486++){frame=frames[_i486];this.addFrame(frame.t||0,frame.eye,frame.look,frame.up);}}/**
21052
+ */},{key:"addFrames",value:function addFrames(frames){var frame;for(var _i490=0,len=frames.length;_i490<len;_i490++){frame=frames[_i490];this.addFrame(frame.t||0,frame.eye,frame.look,frame.up);}}/**
21021
21053
  * Sets the position of the {@link Camera} to a position interpolated within this CameraPath at the given time instant.
21022
21054
  *
21023
21055
  * @param {Number} t Time instant.
@@ -21033,7 +21065,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
21033
21065
  * when animated by {@link CameraPathAnimation}, the {@link Camera} will move along the path at a constant rate.
21034
21066
  *
21035
21067
  * @param {Number} duration The total duration for this CameraPath.
21036
- */},{key:"smoothFrameTimes",value:function smoothFrameTimes(duration){var numFrames=this._frames.length;if(numFrames===0){return;}var vec=math.vec3();var totalLen=0;this._frames[0].t=0;var lens=[];for(var _i487=1,len=this._frames.length;_i487<len;_i487++){var lenVec=math.lenVec3(math.subVec3(this._frames[_i487].eye,this._frames[_i487-1].eye,vec));lens[_i487]=lenVec;totalLen+=lenVec;}for(var _i488=1,_len99=this._frames.length;_i488<_len99;_i488++){var interFrameRate=lens[_i488]/totalLen*duration;this._frames[_i488].t=this._frames[_i488-1].t+interFrameRate;}}/**
21068
+ */},{key:"smoothFrameTimes",value:function smoothFrameTimes(duration){var numFrames=this._frames.length;if(numFrames===0){return;}var vec=math.vec3();var totalLen=0;this._frames[0].t=0;var lens=[];for(var _i491=1,len=this._frames.length;_i491<len;_i491++){var lenVec=math.lenVec3(math.subVec3(this._frames[_i491].eye,this._frames[_i491-1].eye,vec));lens[_i491]=lenVec;totalLen+=lenVec;}for(var _i492=1,_len101=this._frames.length;_i492<_len101;_i492++){var interFrameRate=lens[_i492]/totalLen*duration;this._frames[_i492].t=this._frames[_i492-1].t+interFrameRate;}}/**
21037
21069
  * Removes all frames from this CameraPath.
21038
21070
  */},{key:"clearFrames",value:function clearFrames(){this._frames=[];this._eyeCurve.points=[];this._lookCurve.points=[];this._upCurve.points=[];}}]);}(Component);var tempVec3$2=math.vec3();var newLook=math.vec3();var newEye=math.vec3();var newUp=math.vec3();var newLookEyeVec=math.vec3();/**
21039
21071
  * @desc Jumps or flies the {@link Scene}'s {@link Camera} to a given target.
@@ -21727,7 +21759,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
21727
21759
  * @param {Number} [cfg.size=1] Dimension on the X and Z-axis.
21728
21760
  * @param {Number} [cfg.divisions=1] Number of divisions on X and Z axis..
21729
21761
  * @returns {Object} Configuration for a {@link Geometry} subtype.
21730
- */function buildGridGeometry(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var size=cfg.size||1;if(size<0){console.error("negative size not allowed - will invert");size*=-1;}var divisions=cfg.divisions||1;if(divisions<0){console.error("negative divisions not allowed - will invert");divisions*=-1;}if(divisions<1){divisions=1;}size=size||10;divisions=divisions||10;var step=size/divisions;var halfSize=size/2;var positions=[];var indices=[];var l=0;for(var _i489=0,j=0,k=-halfSize;_i489<=divisions;_i489++,k+=step){positions.push(-halfSize);positions.push(0);positions.push(k);positions.push(halfSize);positions.push(0);positions.push(k);positions.push(k);positions.push(0);positions.push(-halfSize);positions.push(k);positions.push(0);positions.push(halfSize);indices.push(l++);indices.push(l++);indices.push(l++);indices.push(l++);}return utils.apply(cfg,{primitive:"lines",positions:positions,indices:indices});}/**
21762
+ */function buildGridGeometry(){var cfg=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var size=cfg.size||1;if(size<0){console.error("negative size not allowed - will invert");size*=-1;}var divisions=cfg.divisions||1;if(divisions<0){console.error("negative divisions not allowed - will invert");divisions*=-1;}if(divisions<1){divisions=1;}size=size||10;divisions=divisions||10;var step=size/divisions;var halfSize=size/2;var positions=[];var indices=[];var l=0;for(var _i493=0,j=0,k=-halfSize;_i493<=divisions;_i493++,k+=step){positions.push(-halfSize);positions.push(0);positions.push(k);positions.push(halfSize);positions.push(0);positions.push(k);positions.push(k);positions.push(0);positions.push(-halfSize);positions.push(k);positions.push(0);positions.push(halfSize);indices.push(l++);indices.push(l++);indices.push(l++);indices.push(l++);}return utils.apply(cfg,{primitive:"lines",positions:positions,indices:indices});}/**
21731
21763
  * @desc Creates a plane-shaped {@link Geometry}.
21732
21764
  *
21733
21765
  * ## Usage
@@ -23549,7 +23581,7 @@ v edgeBias: 0.2,
23549
23581
  * @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.
23550
23582
  * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
23551
23583
  * @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
23552
- */function LineSet(owner){var _this111;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this111=_callSuper(this,LineSet,[owner,cfg]);_this111._positions=cfg.positions||[];if(cfg.indices){_this111._indices=cfg.indices;}else{_this111._indices=[];for(var _i490=0,len=_this111._positions.length/3-1;_i490<len;_i490+=2){_this111._indices.push(_i490);_this111._indices.push(_i490+1);}}_this111._sceneModel=new SceneModel(_this111,{isModel:false// Don't register in Scene.models
23584
+ */function LineSet(owner){var _this111;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,LineSet);_this111=_callSuper(this,LineSet,[owner,cfg]);_this111._positions=cfg.positions||[];if(cfg.indices){_this111._indices=cfg.indices;}else{_this111._indices=[];for(var _i494=0,len=_this111._positions.length/3-1;_i494<len;_i494+=2){_this111._indices.push(_i494);_this111._indices.push(_i494+1);}}_this111._sceneModel=new SceneModel(_this111,{isModel:false// Don't register in Scene.models
23553
23585
  });_this111._sceneModel.createMesh({id:"linesMesh",primitive:"lines",positions:_this111._positions,indices:_this111._indices});_this111._sceneModel.createEntity({meshIds:["linesMesh"],visible:cfg.visible,clippable:cfg.clippable,collidable:cfg.collidable});_this111._sceneModel.finalize();_this111.scene._lineSetCreated(_this111);return _this111;}/**
23554
23586
  * Sets if this ````LineSet```` is visible.
23555
23587
  *
@@ -23772,7 +23804,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
23772
23804
  * @returns {Boolean} ````true```` if this PointLight casts shadows.
23773
23805
  */function get(){return this._state.castsShadow;}/**
23774
23806
  * Destroys this PointLight.
23775
- */,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_superPropGet(PointLight,"destroy",this,3)([]);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas5=document.createElement("canvas");_canvas5.width=nextHighestPowerOfTwo(image.width);_canvas5.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas5.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas5.width,_canvas5.height);image=_canvas5;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var _i491=1;_i491<32;_i491<<=1){x=x|x>>_i491;}return x+1;}/**
23807
+ */,set:function set(castsShadow){castsShadow=!!castsShadow;if(this._state.castsShadow===castsShadow){return;}this._state.castsShadow=castsShadow;this._shadowViewMatrixDirty=true;this.glRedraw();}},{key:"destroy",value:function destroy(){var camera=this.scene.camera;var canvas=this.scene.canvas;camera.off(this._onCameraViewMatrix);camera.off(this._onCameraProjMatrix);canvas.off(this._onCanvasBoundary);_superPropGet(PointLight,"destroy",this,3)([]);this._state.destroy();if(this._shadowRenderBuf){this._shadowRenderBuf.destroy();}this.scene._lightDestroyed(this);this.glRedraw();}}]);}(Light);function ensureImageSizePowerOfTwo(image){if(!isPowerOfTwo(image.width)||!isPowerOfTwo(image.height)){var _canvas5=document.createElement("canvas");_canvas5.width=nextHighestPowerOfTwo(image.width);_canvas5.height=nextHighestPowerOfTwo(image.height);var ctx=_canvas5.getContext("2d");ctx.drawImage(image,0,0,image.width,image.height,0,0,_canvas5.width,_canvas5.height);image=_canvas5;}return image;}function isPowerOfTwo(x){return(x&x-1)===0;}function nextHighestPowerOfTwo(x){--x;for(var _i495=1;_i495<32;_i495<<=1){x=x|x>>_i495;}return x+1;}/**
23776
23808
  * @desc A cube texture map.
23777
23809
  */var CubeTexture=/*#__PURE__*/function(_Component36){/**
23778
23810
  * @constructor
@@ -23789,7 +23821,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
23789
23821
  // this._state.texture.setImage(this._images, this._state);
23790
23822
  // this._state.texture.setProps(this._state);
23791
23823
  // } else
23792
- if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop=function _loop(_i492){var image=new Image();image.onload=function(){var _image=image;var index=_i492;return function(){if(loadFailed){return;}_image=ensureImageSizePowerOfTwo(_image);self._images[index]=_image;numLoaded++;if(numLoaded===6){var texture=self._state.texture;if(!texture){texture=new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP});self._state.texture=texture;}texture.setImage(self._images,self._state);self.fire("loaded",self._src,false);self.glRedraw();}};}();image.onerror=function(){loadFailed=true;};image.src=src[_i492];};for(var _i492=0;_i492<src.length;_i492++){_loop(_i492);}}/**
23824
+ if(this._src){this._loadSrc(this._src);}}},{key:"_loadSrc",value:function _loadSrc(src){var self=this;var gl=this.scene.canvas.gl;this._images=[];var loadFailed=false;var numLoaded=0;var _loop=function _loop(_i496){var image=new Image();image.onload=function(){var _image=image;var index=_i496;return function(){if(loadFailed){return;}_image=ensureImageSizePowerOfTwo(_image);self._images[index]=_image;numLoaded++;if(numLoaded===6){var texture=self._state.texture;if(!texture){texture=new Texture2D({gl:gl,target:gl.TEXTURE_CUBE_MAP});self._state.texture=texture;}texture.setImage(self._images,self._state);self.fire("loaded",self._src,false);self.glRedraw();}};}();image.onerror=function(){loadFailed=true;};image.src=src[_i496];};for(var _i496=0;_i496<src.length;_i496++){_loop(_i496);}}/**
23793
23825
  * Destroys this CubeTexture
23794
23826
  *
23795
23827
  */},{key:"destroy",value:function destroy(){_superPropGet(CubeTexture,"destroy",this,3)([]);if(this._state.texture){this._state.texture.destroy();}stats.memory.textures--;this._state.destroy();}}]);}(Component);/**
@@ -24145,14 +24177,14 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
24145
24177
  * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
24146
24178
  * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
24147
24179
  * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
24148
- */return _createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i493=0,len=metaObjects.length;_i493<len;_i493++){var metaObject=metaObjects[_i493];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){this.objectsVisible[_i493]=object.visible;}if(edges){this.objectsEdges[_i493]=object.edges;}if(xrayed){this.objectsXrayed[_i493]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i493]=object.highlighted;}if(selected){this.objectsSelected[_i493]=object.selected;}if(clippable){this.objectsClippable[_i493]=object.clippable;}if(pickable){this.objectsPickable[_i493]=object.pickable;}if(colorize){var objectColor=object.colorize;this.objectsColorize[_i493*3+0]=objectColor[0];this.objectsColorize[_i493*3+1]=objectColor[1];this.objectsColorize[_i493*3+2]=objectColor[2];}if(opacity){this.objectsOpacity[_i493]=object.opacity;}this.numObjects++;}}/**
24180
+ */return _createClass(ModelMemento,[{key:"saveObjects",value:function saveObjects(scene,metaModel,mask){this.numObjects=0;this._mask=mask?utils.apply(mask,{}):null;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i497=0,len=metaObjects.length;_i497<len;_i497++){var metaObject=metaObjects[_i497];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){this.objectsVisible[_i497]=object.visible;}if(edges){this.objectsEdges[_i497]=object.edges;}if(xrayed){this.objectsXrayed[_i497]=object.xrayed;}if(highlighted){this.objectsHighlighted[_i497]=object.highlighted;}if(selected){this.objectsSelected[_i497]=object.selected;}if(clippable){this.objectsClippable[_i497]=object.clippable;}if(pickable){this.objectsPickable[_i497]=object.pickable;}if(colorize){var objectColor=object.colorize;this.objectsColorize[_i497*3+0]=objectColor[0];this.objectsColorize[_i497*3+1]=objectColor[1];this.objectsColorize[_i497*3+2]=objectColor[2];}if(opacity){this.objectsOpacity[_i497]=object.opacity;}this.numObjects++;}}/**
24149
24181
  * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.
24150
24182
  *
24151
24183
  * Assumes that the model has not been destroyed or modified since saving.
24152
24184
  *
24153
24185
  * @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.
24154
24186
  * @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.
24155
- */},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i494=0,len=metaObjects.length;_i494<len;_i494++){var metaObject=metaObjects[_i494];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){object.visible=this.objectsVisible[_i494];}if(edges){object.edges=this.objectsEdges[_i494];}if(xrayed){object.xrayed=this.objectsXrayed[_i494];}if(highlighted){object.highlighted=this.objectsHighlighted[_i494];}if(selected){object.selected=this.objectsSelected[_i494];}if(clippable){object.clippable=this.objectsClippable[_i494];}if(pickable){object.pickable=this.objectsPickable[_i494];}if(colorize){color$2[0]=this.objectsColorize[_i494*3+0];color$2[1]=this.objectsColorize[_i494*3+1];color$2[2]=this.objectsColorize[_i494*3+2];object.colorize=color$2;}if(opacity){object.opacity=this.objectsOpacity[_i494];}}}}]);}();/**
24187
+ */},{key:"restoreObjects",value:function restoreObjects(scene,metaModel){var mask=this._mask;var visible=!mask||mask.visible;var edges=!mask||mask.edges;var xrayed=!mask||mask.xrayed;var highlighted=!mask||mask.highlighted;var selected=!mask||mask.selected;var clippable=!mask||mask.clippable;var pickable=!mask||mask.pickable;var colorize=!mask||mask.colorize;var opacity=!mask||mask.opacity;var metaObjects=metaModel.metaObjects;var objects=scene.objects;for(var _i498=0,len=metaObjects.length;_i498<len;_i498++){var metaObject=metaObjects[_i498];var objectId=metaObject.id;var object=objects[objectId];if(!object){continue;}if(visible){object.visible=this.objectsVisible[_i498];}if(edges){object.edges=this.objectsEdges[_i498];}if(xrayed){object.xrayed=this.objectsXrayed[_i498];}if(highlighted){object.highlighted=this.objectsHighlighted[_i498];}if(selected){object.selected=this.objectsSelected[_i498];}if(clippable){object.clippable=this.objectsClippable[_i498];}if(pickable){object.pickable=this.objectsPickable[_i498];}if(colorize){color$2[0]=this.objectsColorize[_i498*3+0];color$2[1]=this.objectsColorize[_i498*3+1];color$2[2]=this.objectsColorize[_i498*3+2];object.colorize=color$2;}if(opacity){object.opacity=this.objectsOpacity[_i498];}}}}]);}();/**
24156
24188
  * @desc A {@link Curve} along which a 3D position can be animated.
24157
24189
  *
24158
24190
  * * As shown in the diagram below, a CubicBezierCurve is defined by four control points.
@@ -24632,7 +24664,7 @@ mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;case 2:// M
24632
24664
  mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;case 3:// Right button
24633
24665
  mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;}});this.canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}switch(e.which){case 3:// Right button
24634
24666
  getCanvasPosFromEvent$3(e,canvasPos);var x=canvasPos[0];var y=canvasPos[1];if(Math.abs(x-lastXDown)<3&&Math.abs(y-lastYDown)<3){controllers.cameraControl.fire("rightClick",{// For context menus
24635
- pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},true);}break;}_this123.canvas.style.removeProperty("cursor");});this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){if(!(configs.active&&configs.pointerEnabled)){return;}});var maxElapsed=1/20;var minElapsed=1/60;var secsNowLast=null;this.canvas.addEventListener("wheel",this._mouseWheelHandler=function(e){e.preventDefault();if(!(configs.active&&configs.pointerEnabled)){return;}var secsNow=performance.now()/1000.0;var secsElapsed=secsNowLast!==null?secsNow-secsNowLast:0;secsNowLast=secsNow;if(secsElapsed>maxElapsed){secsElapsed=maxElapsed;}if(secsElapsed<minElapsed){secsElapsed=minElapsed;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}var normalizedDelta=delta/Math.abs(delta);updates.dollyDelta+=-normalizedDelta*secsElapsed*configs.mouseWheelDollyRate;if(mouseMovedOnCanvasSinceLastWheel){states.followPointerDirty=true;mouseMovedOnCanvasSinceLastWheel=false;}});}return _createClass(MousePanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("wheel",this._mouseWheelHandler);}document.removeEventListener("keydown",this._documentKeyDownHandler);document.removeEventListener("keyup",this._documentKeyUpHandler);document.removeEventListener("mousemove",this._documentMouseMoveHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);}}]);}();var center=math.vec3();var tempVec3a=math.vec3();var tempVec3b=math.vec3();var tempVec3c=math.vec3();var tempVec3d=math.vec3();var tempCameraTarget={eye:math.vec3(),look:math.vec3(),up:math.vec3()};/**
24667
+ pagePos:[Math.round(e.pageX),Math.round(e.pageY)],canvasPos:canvasPos,event:e},true);}break;}_this123.canvas.style.removeProperty("cursor");});this.canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){if(!(configs.active&&configs.pointerEnabled)){return;}});var maxElapsed=1/20;var minElapsed=1/60;var secsNowLast=null;var enableMove=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableMove=!collideWithEntity;});this.canvas.addEventListener("wheel",this._mouseWheelHandler=function(e){e.preventDefault();if(!(configs.active&&configs.pointerEnabled)){return;}if(e.deltaY<0&&!enableMove)return;var secsNow=performance.now()/1000.0;var secsElapsed=secsNowLast!==null?secsNow-secsNowLast:0;secsNowLast=secsNow;if(secsElapsed>maxElapsed){secsElapsed=maxElapsed;}if(secsElapsed<minElapsed){secsElapsed=minElapsed;}var delta=Math.max(-1,Math.min(1,-e.deltaY*40));if(delta===0){return;}var normalizedDelta=delta/Math.abs(delta);updates.dollyDelta+=-normalizedDelta*secsElapsed*configs.mouseWheelDollyRate;if(mouseMovedOnCanvasSinceLastWheel){states.followPointerDirty=true;mouseMovedOnCanvasSinceLastWheel=false;}});}return _createClass(MousePanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousedown",this._mouseDownHandler);this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mouseup",this._mouseUpHandler);this.canvas.removeEventListener("mouseenter",this._mouseEnterHandler);this.canvas.removeEventListener("wheel",this._mouseWheelHandler);}document.removeEventListener("keydown",this._documentKeyDownHandler);document.removeEventListener("keyup",this._documentKeyUpHandler);document.removeEventListener("mousemove",this._documentMouseMoveHandler);document.removeEventListener("mouseup",this._documentMouseUpHandler);}}]);}();var center=math.vec3();var tempVec3a=math.vec3();var tempVec3b=math.vec3();var tempVec3c=math.vec3();var tempVec3d=math.vec3();var tempCameraTarget={eye:math.vec3(),look:math.vec3(),up:math.vec3()};/**
24636
24668
  * @private
24637
24669
  */var KeyboardAxisViewHandler=/*#__PURE__*/function(){function KeyboardAxisViewHandler(scene,controllers,configs,states){_classCallCheck(this,KeyboardAxisViewHandler);this._scene=scene;this.input=scene.input;var cameraControl=controllers.cameraControl;var camera=scene.camera;this._onSceneKeyDown=scene.input.on("keydown",function(){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var axisViewRight=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_RIGHT);var axisViewBack=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BACK);var axisViewLeft=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_LEFT);var axisViewFront=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_FRONT);var axisViewTop=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_TOP);var axisViewBottom=cameraControl._isKeyDownForAction(cameraControl.AXIS_VIEW_BOTTOM);if(!axisViewRight&&!axisViewBack&&!axisViewLeft&&!axisViewFront&&!axisViewTop&&!axisViewBottom){return;}var aabb=scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var perspectiveDist=Math.abs(diag/Math.tan(controllers.cameraFlight.fitFOV*math.DEGTORAD));var orthoScale=diag*1.1;tempCameraTarget.orthoScale=orthoScale;if(axisViewRight){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewBack){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewLeft){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldRight,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewFront){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldForward,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(camera.worldUp);}else if(axisViewTop){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,1,tempVec3b),tempVec3c));}else if(axisViewBottom){tempCameraTarget.eye.set(math.addVec3(center,math.mulVec3Scalar(camera.worldUp,-perspectiveDist,tempVec3a),tempVec3d));tempCameraTarget.look.set(center);tempCameraTarget.up.set(math.normalizeVec3(math.mulVec3Scalar(camera.worldForward,-1,tempVec3b)));}if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.setPivotPos(center);}if(controllers.cameraFlight.duration>0){controllers.cameraFlight.flyTo(tempCameraTarget,function(){if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}});}else{controllers.cameraFlight.jumpTo(tempCameraTarget);if(controllers.pivotController.getPivoting()&&configs.followPointer){controllers.pivotController.showPivot();}}});}return _createClass(KeyboardAxisViewHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this.input.off(this._onSceneKeyDown);}}]);}();/**
24638
24670
  * @private
@@ -24699,13 +24731,13 @@ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePick
24699
24731
  // }
24700
24732
  },false);}return _createClass(MousePickHandler,[{key:"reset",value:function reset(){this._clicks=0;this._lastPickedEntityId=null;if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("mousemove",this._canvasMouseMoveHandler);this.canvas.removeEventListener("mousedown",this._canvasMouseDownHandler);this.canvas.removeEventListener("dblclick",this._canvasDblClickHandler);this.canvas.removeEventListener("mouseup",this._canvasMouseUpHandler);}document.removeEventListener("mouseup",this._documentMouseUpHandler);if(this._timeout){window.clearTimeout(this._timeout);this._timeout=null;}}}]);}();/**
24701
24733
  * @private
24702
- */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;var input=scene.input;this.input=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;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}});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;//-------------------------------------------------------------------------------------------------
24734
+ */var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;var input=scene.input;this.input=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;}if(controllers.pivotController.getPivoting()){controllers.pivotController.endPivot();}});var enableForward=true;this._scene.on("collideWithEntity",function(collideWithEntity){enableForward=!collideWithEntity;});this._onTick=scene.on("tick",function(e){if(!(configs.active&&configs.pointerEnabled)||!scene.input.keyboardEnabled){return;}if(!states.mouseover){return;}var cameraControl=controllers.cameraControl;var elapsedSecs=e.deltaTime/1000.0;//-------------------------------------------------------------------------------------------------
24703
24735
  // Keyboard rotation
24704
24736
  //-------------------------------------------------------------------------------------------------
24705
24737
  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();}}}//-------------------------------------------------------------------------------------------------
24706
24738
  // Keyboard panning
24707
24739
  //-------------------------------------------------------------------------------------------------
24708
- if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){updates.dollyDelta-=dollyDelta;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);var panDelta=(keyDownMap[input.KEY_ALT]?0.3:1.0)*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
24740
+ if(!keyDownMap[input.KEY_CTRL]&&!keyDownMap[input.KEY_ALT]){var dollyBackwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_BACKWARDS,keyDownMap);var dollyForwards=cameraControl._isKeyDownForAction(cameraControl.DOLLY_FORWARDS,keyDownMap);if(dollyBackwards||dollyForwards){var dollyDelta=elapsedSecs*configs.keyboardDollyRate;if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(dollyForwards){if(!enableForward)return;updates.dollyDelta-=dollyDelta;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}var panForwards=cameraControl._isKeyDownForAction(cameraControl.PAN_FORWARDS,keyDownMap);var panBackwards=cameraControl._isKeyDownForAction(cameraControl.PAN_BACKWARDS,keyDownMap);var panLeft=cameraControl._isKeyDownForAction(cameraControl.PAN_LEFT,keyDownMap);var panRight=cameraControl._isKeyDownForAction(cameraControl.PAN_RIGHT,keyDownMap);var panUp=cameraControl._isKeyDownForAction(cameraControl.PAN_UP,keyDownMap);var panDown=cameraControl._isKeyDownForAction(cameraControl.PAN_DOWN,keyDownMap);var panDelta=(keyDownMap[input.KEY_ALT]?0.3:1.0)*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
24709
24741
  if(panForwards||panBackwards||panLeft||panRight||panUp||panDown){if(!configs.firstPerson&&configs.followPointer){controllers.pivotController.startPivot();}if(panDown){updates.panDeltaY+=panDelta;}else if(panUp){updates.panDeltaY+=-panDelta;}if(panRight){updates.panDeltaX+=-panDelta;}else if(panLeft){updates.panDeltaX+=panDelta;}if(panBackwards){updates.panDeltaZ+=panDelta;}else if(panForwards){updates.panDeltaZ+=-panDelta;}}});}return _createClass(KeyboardPanRotateDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){this._scene.off(this._onTick);this.input.off(this._onSceneMouseMove);this.input.off(this._onSceneKeyDown);this.input.off(this._onSceneKeyUp);}}]);}();var SCALE_DOLLY_EACH_FRAME=1;// Recalculate dolly speed for eye->target distance on each Nth frame
24710
24742
  var EPSILON=0.001;var tempVec3=math.vec3();/**
24711
24743
  * Handles camera updates on each "tick" that were scheduled by the various controllers.
@@ -24749,7 +24781,7 @@ if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEn
24749
24781
  * @private
24750
24782
  */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
24751
24783
  pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
24752
- }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i495=0,len=touches.length;_i495<len;++_i495){getCanvasPosFromEvent$1(touches[_i495],lastCanvasTouchPosList[_i495]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
24784
+ }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i499=0,len=touches.length;_i499<len;++_i499){getCanvasPosFromEvent$1(touches[_i499],lastCanvasTouchPosList[_i499]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
24753
24785
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
24754
24786
  var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
24755
24787
  // We don't want to rotate in this case (weird behavior)
@@ -24774,7 +24806,7 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
24774
24806
  // }
24775
24807
  }}else if(numTouches===2){pivotController.hidePivot();var touch0=touches[0];var touch1=touches[1];getCanvasPosFromEvent$1(touch0,tapCanvasPos0);getCanvasPosFromEvent$1(touch1,tapCanvasPos1);var lastMiddleTouch=math.geometricMeanVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var currentMiddleTouch=math.geometricMeanVec2(tapCanvasPos0,tapCanvasPos1);var touchDelta=math.vec2();math.subVec2(lastMiddleTouch,currentMiddleTouch,touchDelta);var _xPanDelta=touchDelta[0];var _yPanDelta=touchDelta[1];var _camera2=scene.camera;// Dollying
24776
24808
  var d1=math.distVec2([touch0.pageX,touch0.pageY],[touch1.pageX,touch1.pageY]);var d2=math.distVec2(lastCanvasTouchPosList[0],lastCanvasTouchPosList[1]);var dollyDelta=(d2-d1)*configs.touchDollyRate;updates.dollyDelta=dollyDelta;if(Math.abs(dollyDelta)<1.0){// We use only canvasHeight here so that aspect ratio does not distort speed
24777
- if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i496=0;_i496<numTouches;++_i496){getCanvasPosFromEvent$1(touches[_i496],lastCanvasTouchPosList[_i496]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
24809
+ if(_camera2.projection==="perspective"){var pickedWorldPos=pickController.pickResult?pickController.pickResult.worldPos:scene.center;var _depth=Math.abs(math.lenVec3(math.subVec3(pickedWorldPos,scene.camera.eye,[])));var _targetDistance=_depth*Math.tan(_camera2.perspective.fov/2*Math.PI/180.0);updates.panDeltaX-=_xPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;updates.panDeltaY-=_yPanDelta*_targetDistance/canvasHeight*configs.touchPanRate;}else{updates.panDeltaX-=0.5*_camera2.ortho.scale*(_xPanDelta/canvasHeight)*configs.touchPanRate;updates.panDeltaY-=0.5*_camera2.ortho.scale*(_yPanDelta/canvasHeight)*configs.touchPanRate;}}states.pointerCanvasPos=currentMiddleTouch;}for(var _i500=0;_i500<numTouches;++_i500){getCanvasPosFromEvent$1(touches[_i500],lastCanvasTouchPosList[_i500]);}});}return _createClass(TouchPanRotateAndDollyHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchmove",this._canvasTouchMoveHandler);}this._scene.off(this._onTick);}}]);}();var TAP_INTERVAL=150;var DBL_TAP_INTERVAL=325;var TAP_DISTANCE_THRESHOLD=1000;var getCanvasPosFromEvent=function getCanvasPosFromEvent(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
24778
24810
  * @private
24779
24811
  */var TouchPickHandler=/*#__PURE__*/function(){function TouchPickHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPickHandler);this._scene=scene;var pickController=controllers.pickController;var cameraControl=controllers.cameraControl;var touchStartTime;var activeTouches=[];var tapStartPos=new Float32Array(2);var tapStartTime=-1;var lastTapTime=-1;this.canvas=this._scene.canvas.canvas;var flyCameraTo=function flyCameraTo(pickResult){var pos;if(pickResult&&pickResult.worldPos){pos=pickResult.worldPos;}var aabb=pickResult?pickResult.entity.aabb:scene.aabb;if(pos){// Fly to look at point, don't change eye->look dist
24780
24812
  var camera=scene.camera;math.subVec3(camera.eye,camera.look,[]);controllers.cameraFlight.flyTo({aabb:aabb});// TODO: Option to back off to fit AABB in view
@@ -24783,7 +24815,7 @@ controllers.cameraFlight.flyTo({aabb:aabb});}};this.canvas.addEventListener("tou
24783
24815
  var rightClickClientX=tapStartPos[0];var rightClickClientY=tapStartPos[1];var rightClickPageX=touches[0].pageX;var rightClickPageY=touches[0].pageY;states.longTouchTimeout=setTimeout(function(){controllers.cameraControl.fire("rightClick",{// For context menus
24784
24816
  pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);states.longTouchTimeout=null;},configs.longTapTimeout);//////////
24785
24817
  var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");getCanvasPosFromEvent(touches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("touchEntity",pickController.pickResult);if(pickController.pickedSurface){cameraControl.fire("touchSurface",pickController.pickResult);}}else{cameraControl.fire("touchNothing");}}else{tapStartTime=-1;}///////////
24786
- while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i497=0,len=touches.length;_i497<len;++_i497){getCanvasPosFromEvent(touches[_i497],activeTouches[_i497]);}activeTouches.length=touches.length;},{passive:true});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
24818
+ while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var _i501=0,len=touches.length;_i501<len;++_i501){getCanvasPosFromEvent(touches[_i501],activeTouches[_i501]);}activeTouches.length=touches.length;},{passive:true});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var currentTime=Date.now();var touches=e.touches;var changedTouches=e.changedTouches;var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");if(states.longTouchTimeout!==null){clearTimeout(states.longTouchTimeout);states.longTouchTimeout=null;}// process tap
24787
24819
  if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&&currentTime-tapStartTime<TAP_INTERVAL){// Double-tap
24788
24820
  if(lastTapTime>-1&&tapStartTime-lastTapTime<DBL_TAP_INTERVAL){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("doublePicked", pickController.pickResult);
24789
24821
  cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("doublePickedSurface", pickController.pickResult);
@@ -24791,7 +24823,7 @@ cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(con
24791
24823
  else if(math.distVec2(activeTouches[0],tapStartPos)<TAP_DISTANCE_THRESHOLD){getCanvasPosFromEvent(changedTouches[0],pickController.pickCursorPos);pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){pickController.pickResult.touchInput=true;// cameraControl.fire("picked", pickController.pickResult);
24792
24824
  cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("pickedSurface", pickController.pickResult);
24793
24825
  cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{// cameraControl.fire("pickedNothing");
24794
- cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i498=0,len=touches.length;_i498<len;++_i498){activeTouches[_i498][0]=touches[_i498].pageX;activeTouches[_i498][1]=touches[_i498].pageY;}e.stopPropagation();},{passive:true});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);}return _createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
24826
+ cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var _i502=0,len=touches.length;_i502<len;++_i502){activeTouches[_i502][0]=touches[_i502].pageX;activeTouches[_i502][1]=touches[_i502].pageY;}e.stopPropagation();},{passive:true});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);}return _createClass(TouchPickHandler,[{key:"reset",value:function reset(){// TODO
24795
24827
  // tapStartTime = -1;
24796
24828
  // lastTapTime = -1;
24797
24829
  }},{key:"destroy",value:function destroy(){if(this.canvas!=null){this.canvas.removeEventListener("touchstart",this._canvasTouchStartHandler);this.canvas.removeEventListener("touchend",this._canvasTouchEndHandler);this.canvas.removeEventListener("touchcancel",this._canvasTouchEndHandler);}}}]);}();var DEFAULT_SNAP_PICK_RADIUS=20;var DEFAULT_SNAP_VERTEX=true;var DEFAULT_SNAP_EDGE=true;/**
@@ -25351,10 +25383,10 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25351
25383
  */_inherits(CameraControl,_Component38);return _createClass(CameraControl,[{key:"setdirectionChangeCancel",value:function setdirectionChangeCancel(){this._goLeft=false;this._goRight=false;this._goUp=false;this._goDown=false;this._goForward=false;this._goBackward=false;}/**
25352
25384
  * 设置漫游移动速率
25353
25385
  * @param {number} rate
25354
- */},{key:"moveRate",set:function set(rate){this._moveRate=rate;}/**
25386
+ */},{key:"moveRate",get:function get(){return this._moveRate;}/**
25355
25387
  * 漫游向右
25356
25388
  * @param {boolean} go
25357
- */},{key:"goRight",set:function set(go){this._goRight=go;}/**
25389
+ */,set:function set(rate){this._moveRate=rate;}},{key:"goRight",set:function set(go){this._goRight=go;}/**
25358
25390
  * 漫游向左
25359
25391
  * @param {boolean} go
25360
25392
  */},{key:"goLeft",set:function set(go){this._goLeft=go;}/**
@@ -25386,7 +25418,7 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25386
25418
  * @param keyDownMap
25387
25419
  * @private
25388
25420
  */,set:function set(value){value=value||"qwerty";if(utils.isString(value)){var input=this.scene.input;var keyMap={};switch(value){default:this.error("Unsupported value for 'keyMap': "+value+" defaulting to 'qwerty'");// Intentional fall-through to "qwerty"
25389
- case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i499=0,len=keys.length;_i499<len;_i499++){var key=keys[_i499];if(keyDownMap[key]){return true;}}return false;}/**
25421
+ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_Z];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_W,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_Q,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;case"azerty":keyMap[this.PAN_LEFT]=[input.KEY_Q];keyMap[this.PAN_RIGHT]=[input.KEY_D];keyMap[this.PAN_UP]=[input.KEY_W];keyMap[this.PAN_DOWN]=[input.KEY_X];keyMap[this.PAN_BACKWARDS]=[];keyMap[this.PAN_FORWARDS]=[];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z,input.KEY_ADD];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S,input.KEY_SUBTRACT];keyMap[this.ROTATE_X_POS]=[input.KEY_DOWN_ARROW];keyMap[this.ROTATE_X_NEG]=[input.KEY_UP_ARROW];keyMap[this.ROTATE_Y_POS]=[input.KEY_A,input.KEY_LEFT_ARROW];keyMap[this.ROTATE_Y_NEG]=[input.KEY_E,input.KEY_RIGHT_ARROW];keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[input.KEY_NUM_2];keyMap[this.AXIS_VIEW_LEFT]=[input.KEY_NUM_3];keyMap[this.AXIS_VIEW_FRONT]=[input.KEY_NUM_4];keyMap[this.AXIS_VIEW_TOP]=[input.KEY_NUM_5];keyMap[this.AXIS_VIEW_BOTTOM]=[input.KEY_NUM_6];break;}this._keyMap=keyMap;}else{var _keyMap=value;this._keyMap=_keyMap;}}},{key:"_isKeyDownForAction",value:function _isKeyDownForAction(action,keyDownMap){var keys=this._keyMap[action];if(!keys){return false;}if(!keyDownMap){keyDownMap=this.scene.input.keyDown;}for(var _i503=0,len=keys.length;_i503<len;_i503++){var key=keys[_i503];if(keyDownMap[key]){return true;}}return false;}/**
25390
25422
  * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
25391
25423
  *
25392
25424
  * See class comments for an example.
@@ -25483,7 +25515,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
25483
25515
  * See class comments for more info.
25484
25516
  *
25485
25517
  * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
25486
- */,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i500=0,len=this._handlers.length;_i500<len;_i500++){var handler=this._handlers[_i500];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
25518
+ */,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var _i504=0,len=this._handlers.length;_i504<len;_i504++){var handler=this._handlers[_i504];if(handler.reset){handler.reset();}}this._updates.panDeltaX=0;this._updates.panDeltaY=0;this._updates.rotateDeltaX=0;this._updates.rotateDeltaY=0;this._updates.dolyDelta=0;}},{key:"followPointer",get:/**
25487
25519
  * Sets whether the {@link Camera} follows the mouse/touch pointer.
25488
25520
  *
25489
25521
  * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
@@ -25873,7 +25905,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
25873
25905
  */function get(){return this._configs.doubleClickTimeFrame;}/**
25874
25906
  * Destroys this ````CameraControl````.
25875
25907
  * @private
25876
- */,set:function set(value){this._configs.doubleClickTimeFrame=value!==undefined&&value!==null?value:250;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_superPropGet(CameraControl,"destroy",this,3)([]);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i501=0,len=this._handlers.length;_i501<len;_i501++){var handler=this._handlers[_i501];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i502=0,len=this._controllers.length;_i502<len;_i502++){var controller=this._controllers[_i502];if(controller.destroy){controller.destroy();}}}}]);}(Component);/**
25908
+ */,set:function set(value){this._configs.doubleClickTimeFrame=value!==undefined&&value!==null?value:250;}},{key:"destroy",value:function destroy(){this._destroyHandlers();this._destroyControllers();this._cameraUpdater.destroy();_superPropGet(CameraControl,"destroy",this,3)([]);}},{key:"_destroyHandlers",value:function _destroyHandlers(){for(var _i505=0,len=this._handlers.length;_i505<len;_i505++){var handler=this._handlers[_i505];if(handler.destroy){handler.destroy();}}}},{key:"_destroyControllers",value:function _destroyControllers(){for(var _i506=0,len=this._controllers.length;_i506<len;_i506++){var controller=this._controllers[_i506];if(controller.destroy){controller.destroy();}}}}]);}(Component);/**
25877
25909
  * @desc Metadata corresponding to a {@link Scene}.
25878
25910
  *
25879
25911
  * * Located in {@link Viewer#metaScene}.
@@ -25922,7 +25954,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
25922
25954
  *
25923
25955
  * @param {String} event Event name
25924
25956
  * @param {Object} value Event parameters
25925
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i503=0,len=subs.length;_i503<len;_i503++){subs[_i503](value);}}}/**
25957
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i507=0,len=subs.length;_i507<len;_i507++){subs[_i507](value);}}}/**
25926
25958
  * Unsubscribes from an event fired at this Viewer.
25927
25959
  * @param event
25928
25960
  */},{key:"off",value:function off(event){// TODO
@@ -25953,12 +25985,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
25953
25985
  *
25954
25986
  * @param {String} metaModelId ID of the target {@link MetaModel}.
25955
25987
  */},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
25956
- if(metaModel.propertySets){for(var _i504=0,len=metaModel.propertySets.length;_i504<len;_i504++){var propertySet=metaModel.propertySets[_i504];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
25988
+ if(metaModel.propertySets){for(var _i508=0,len=metaModel.propertySets.length;_i508<len;_i508++){var propertySet=metaModel.propertySets[_i508];if(propertySet.metaModels.length===1&&propertySet.metaModels[0].id===metaModelId){// Property set owned only by this model, delete
25957
25989
  delete this.propertySets[propertySet.id];}else{var newMetaModels=[];for(var j=0,lenj=propertySet.metaModels.length;j<lenj;j++){if(propertySet.metaModels[j].id!==metaModelId){newMetaModels.push(propertySet.metaModels[j]);}}propertySet.metaModels=newMetaModels;}}}// Remove MetaObjects
25958
- if(metaModel.metaObjects){for(var _i505=0,_len100=metaModel.metaObjects.length;_i505<_len100;_i505++){var metaObject=metaModel.metaObjects[_i505];metaObject.type;var id=metaObject.id;if(metaObject.metaModels.length===1&&metaObject.metaModels[0].id===metaModelId){// MetaObject owned only by this model, delete
25990
+ if(metaModel.metaObjects){for(var _i509=0,_len102=metaModel.metaObjects.length;_i509<_len102;_i509++){var metaObject=metaModel.metaObjects[_i509];metaObject.type;var id=metaObject.id;if(metaObject.metaModels.length===1&&metaObject.metaModels[0].id===metaModelId){// MetaObject owned only by this model, delete
25959
25991
  delete this.metaObjects[id];if(!metaObject.parent){delete this.rootMetaObjects[id];}}}}// Re-link entire MetaObject parent/child hierarchy
25960
25992
  for(var objectId in this.metaObjects){var _metaObject=this.metaObjects[objectId];if(_metaObject.children){_metaObject.children=[];}// Re-link each MetaObject's property sets
25961
- if(_metaObject.propertySets){_metaObject.propertySets=[];}if(_metaObject.propertySetIds){for(var _i506=0,_len101=_metaObject.propertySetIds.length;_i506<_len101;_i506++){var propertySetId=_metaObject.propertySetIds[_i506];var _propertySet=this.propertySets[propertySetId];_metaObject.propertySets.push(_propertySet);}}}this.metaObjectsByType={};for(var _objectId in this.metaObjects){var _metaObject2=this.metaObjects[_objectId];var type=_metaObject2.type;if(_metaObject2.children){_metaObject2.children=null;}(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[_objectId]=_metaObject2;}for(var _objectId2 in this.metaObjects){var _metaObject3=this.metaObjects[_objectId2];if(_metaObject3.parentId){var parentMetaObject=this.metaObjects[_metaObject3.parentId];if(parentMetaObject){_metaObject3.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject3);}}}delete this.metaModels[metaModelId];// Relink MetaObjects to their MetaModels
25993
+ if(_metaObject.propertySets){_metaObject.propertySets=[];}if(_metaObject.propertySetIds){for(var _i510=0,_len103=_metaObject.propertySetIds.length;_i510<_len103;_i510++){var propertySetId=_metaObject.propertySetIds[_i510];var _propertySet=this.propertySets[propertySetId];_metaObject.propertySets.push(_propertySet);}}}this.metaObjectsByType={};for(var _objectId in this.metaObjects){var _metaObject2=this.metaObjects[_objectId];var type=_metaObject2.type;if(_metaObject2.children){_metaObject2.children=null;}(this.metaObjectsByType[type]||(this.metaObjectsByType[type]={}))[_objectId]=_metaObject2;}for(var _objectId2 in this.metaObjects){var _metaObject3=this.metaObjects[_objectId2];if(_metaObject3.parentId){var parentMetaObject=this.metaObjects[_metaObject3.parentId];if(parentMetaObject){_metaObject3.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(_metaObject3);}}}delete this.metaModels[metaModelId];// Relink MetaObjects to their MetaModels
25962
25994
  // for (let objectId in this.metaObjects) {
25963
25995
  // const metaObject = this.metaObjects[objectId];
25964
25996
  // metaObject.metaModels = [];
@@ -25980,7 +26012,7 @@ this.fire("metaModelDestroyed",metaModelId);}/**
25980
26012
  *
25981
26013
  * @param {String[]} types The array of type name.
25982
26014
  * @returns {String[]} Array of {@link MetaObject#id}s.
25983
- */},{key:"getObjectIDsByTypes",value:function getObjectIDsByTypes(types){var metaObjects=[];for(var _i507=0;_i507<types.length;_i507++){var type=types[_i507];metaObjects=metaObjects.concat(this.getObjectIDsByType(type));}return metaObjects;}/**
26015
+ */},{key:"getObjectIDsByTypes",value:function getObjectIDsByTypes(types){var metaObjects=[];for(var _i511=0;_i511<types.length;_i511++){var type=types[_i511];metaObjects=metaObjects.concat(this.getObjectIDsByType(type));}return metaObjects;}/**
25984
26016
  * Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the given subtree.
25985
26017
  *
25986
26018
  * @param {String} id ID of the root {@link MetaObject} of the given subtree.
@@ -26441,7 +26473,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26441
26473
  *
26442
26474
  * @param {String} event Event name
26443
26475
  * @param {Object} value Event parameters
26444
- */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i508=0,len=subs.length;_i508<len;_i508++){subs[_i508](value);}}}/**
26476
+ */},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var _i512=0,len=subs.length;_i512<len;_i512++){subs[_i512](value);}}}/**
26445
26477
  * Unsubscribes from an event fired at this Viewer.
26446
26478
  * @param event
26447
26479
  */},{key:"off",value:function off(event){// TODO
@@ -26461,12 +26493,12 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26461
26493
  * Uninstalls a Plugin, clearing content from it first.
26462
26494
  *
26463
26495
  * @private
26464
- */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i509=0,len=this._plugins.length;_i509<len;_i509++){var _p2=this._plugins[_i509];if(_p2===plugin){if(_p2.clear){_p2.clear();}this._plugins.splice(_i509,1);return;}}}/**
26496
+ */},{key:"removePlugin",value:function removePlugin(plugin){for(var _i513=0,len=this._plugins.length;_i513<len;_i513++){var _p2=this._plugins[_i513];if(_p2===plugin){if(_p2.clear){_p2.clear();}this._plugins.splice(_i513,1);return;}}}/**
26465
26497
  * Sends a message to installed Plugins.
26466
26498
  *
26467
26499
  * The message can optionally be accompanied by a value.
26468
26500
  * @private
26469
- */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i510=0,len=this._plugins.length;_i510<len;_i510++){var _p3=this._plugins[_i510];if(_p3.send){_p3.send(name,value);}}}/**
26501
+ */},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var _i514=0,len=this._plugins.length;_i514<len;_i514++){var _p3=this._plugins[_i514];if(_p3.send){_p3.send(name,value);}}}/**
26470
26502
  * @private
26471
26503
  * @deprecated
26472
26504
  */},{key:"clear",value:function clear(){throw'Viewer#clear() no longer implemented - use \'#sendToPlugins("clear") instead';}/**
@@ -26497,7 +26529,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26497
26529
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
26498
26530
  * @returns {String} String-encoded image data URI.
26499
26531
  */},{key:"getSnapshot",value:function getSnapshot(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var needFinishSnapshot=!this._snapshotBegun;var resize=params.width!==undefined&&params.height!==undefined;var canvas=this.scene.canvas.canvas;var saveWidth=canvas.clientWidth;var saveHeight=canvas.clientHeight;var width=params.width?Math.floor(params.width):canvas.width;var height=params.height?Math.floor(params.height):canvas.height;if(resize){canvas.width=width;canvas.height=height;}if(!this._snapshotBegun){this.beginSnapshot({width:width,height:height});}if(!params.includeGizmos){this.sendToPlugins("snapshotStarting");// Tells plugins to hide things that shouldn't be in snapshot
26500
- }var captured={};for(var _i511=0,len=this._plugins.length;_i511<len;_i511++){var plugin=this._plugins[_i511];if(plugin.getContainerElement){var container=plugin.getContainerElement();if(container!==document.body){if(!captured[container.id]){captured[container.id]=true;html2canvas(container).then(function(canvas){document.body.appendChild(canvas);});}}}}this.scene._renderer.renderSnapshot();var imageDataURI=this.scene._renderer.readSnapshot(params);if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return imageDataURI;}/**
26532
+ }var captured={};for(var _i515=0,len=this._plugins.length;_i515<len;_i515++){var plugin=this._plugins[_i515];if(plugin.getContainerElement){var container=plugin.getContainerElement();if(container!==document.body){if(!captured[container.id]){captured[container.id]=true;html2canvas(container).then(function(canvas){document.body.appendChild(canvas);});}}}}this.scene._renderer.renderSnapshot();var imageDataURI=this.scene._renderer.readSnapshot(params);if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return imageDataURI;}/**
26501
26533
  * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
26502
26534
  * the HTML elements created by various plugins.
26503
26535
  *
@@ -26522,7 +26554,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26522
26554
  * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
26523
26555
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
26524
26556
  * @returns {Promise} Promise which returns a string-encoded image data URI.
26525
- */},{key:"getSnapshotWithPlugins",value:(function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var params,needFinishSnapshot,resize,canvas,saveWidth,saveHeight,snapshotWidth,snapshotHeight,snapshotCanvas,pluginToCapture,pluginContainerElements,_i512,len,plugin,containerElement,_i513,_len102,_containerElement,format,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:params=_args2.length>0&&_args2[0]!==undefined?_args2[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
26557
+ */},{key:"getSnapshotWithPlugins",value:(function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var params,needFinishSnapshot,resize,canvas,saveWidth,saveHeight,snapshotWidth,snapshotHeight,snapshotCanvas,pluginToCapture,pluginContainerElements,_i516,len,plugin,containerElement,_i517,_len104,_containerElement,format,_args2=arguments;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:params=_args2.length>0&&_args2[0]!==undefined?_args2[0]:{};// We use gl.readPixels to get the WebGL canvas snapshot in a new
26526
26558
  // HTMLCanvas element, scaled to the target snapshot size, then
26527
26559
  // use html2canvas to render each plugin's container element into
26528
26560
  // that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
@@ -26532,8 +26564,8 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26532
26564
  // canvas ourselves, in order to allow the Viewer to render the
26533
26565
  // right amount of pixels, for a sharper image.
26534
26566
  needFinishSnapshot=!this._snapshotBegun;resize=params.width!==undefined&&params.height!==undefined;canvas=this.scene.canvas.canvas;saveWidth=canvas.clientWidth;saveHeight=canvas.clientHeight;snapshotWidth=params.width?Math.floor(params.width):canvas.width;snapshotHeight=params.height?Math.floor(params.height):canvas.height;if(resize){canvas.width=snapshotWidth;canvas.height=snapshotHeight;}if(!this._snapshotBegun){this.beginSnapshot();}if(!params.includeGizmos){this.sendToPlugins("snapshotStarting");// Tells plugins to hide things that shouldn't be in snapshot
26535
- }this.scene._renderer.renderSnapshot();snapshotCanvas=this.scene._renderer.readSnapshotAsCanvas();if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}pluginToCapture={};pluginContainerElements=[];for(_i512=0,len=this._plugins.length;_i512<len;_i512++){// Find plugin container elements
26536
- plugin=this._plugins[_i512];if(plugin.getContainerElement){containerElement=plugin.getContainerElement();if(containerElement!==document.body){if(!pluginToCapture[containerElement.id]){pluginToCapture[containerElement.id]=true;pluginContainerElements.push(containerElement);}}}}_i513=0,_len102=pluginContainerElements.length;case 18:if(!(_i513<_len102)){_context3.next=25;break;}_containerElement=pluginContainerElements[_i513];_context3.next=22;return html2canvas(_containerElement,{canvas:snapshotCanvas,backgroundColor:null,scale:snapshotCanvas.width/_containerElement.clientWidth});case 22:_i513++;_context3.next=18;break;case 25:if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}format=params.format||"png";if(format!=="jpeg"&&format!=="png"&&format!=="bmp"){console.error("Unsupported image format: '"+format+"' - supported types are 'jpeg', 'bmp' and 'png' - defaulting to 'png'");format="png";}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return _context3.abrupt("return",snapshotCanvas.toDataURL("image/".concat(format)));case 32:case"end":return _context3.stop();}},_callee2,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
26567
+ }this.scene._renderer.renderSnapshot();snapshotCanvas=this.scene._renderer.readSnapshotAsCanvas();if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}pluginToCapture={};pluginContainerElements=[];for(_i516=0,len=this._plugins.length;_i516<len;_i516++){// Find plugin container elements
26568
+ plugin=this._plugins[_i516];if(plugin.getContainerElement){containerElement=plugin.getContainerElement();if(containerElement!==document.body){if(!pluginToCapture[containerElement.id]){pluginToCapture[containerElement.id]=true;pluginContainerElements.push(containerElement);}}}}_i517=0,_len104=pluginContainerElements.length;case 18:if(!(_i517<_len104)){_context3.next=25;break;}_containerElement=pluginContainerElements[_i517];_context3.next=22;return html2canvas(_containerElement,{canvas:snapshotCanvas,backgroundColor:null,scale:snapshotCanvas.width/_containerElement.clientWidth});case 22:_i517++;_context3.next=18;break;case 25:if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}format=params.format||"png";if(format!=="jpeg"&&format!=="png"&&format!=="bmp"){console.error("Unsupported image format: '"+format+"' - supported types are 'jpeg', 'bmp' and 'png' - defaulting to 'png'");format="png";}if(!params.includeGizmos){this.sendToPlugins("snapshotFinished");}if(needFinishSnapshot){this.endSnapshot();}return _context3.abrupt("return",snapshotCanvas.toDataURL("image/".concat(format)));case 32:case"end":return _context3.stop();}},_callee2,this);}));function getSnapshotWithPlugins(){return _getSnapshotWithPlugins.apply(this,arguments);}return getSnapshotWithPlugins;}()/**
26537
26569
  * Exits snapshot mode.
26538
26570
  *
26539
26571
  * Switches rendering back to the main canvas.
@@ -26541,7 +26573,7 @@ plugin=this._plugins[_i512];if(plugin.getContainerElement){containerElement=plug
26541
26573
  */)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
26542
26574
  * Destroys this Viewer.
26543
26575
  */},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
26544
- if(plugins.length>0){for(var _i514=0,len=plugins.length;_i514<len;_i514++){var plugin=plugins[_i514];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();/**
26576
+ if(plugins.length>0){for(var _i518=0,len=plugins.length;_i518<len;_i518++){var plugin=plugins[_i518];plugin.destroy();}}this.cameraControl.destroy();this.scene.destroy(callback);}}]);}();/**
26545
26577
  * {@link Viewer} plugin that uses [web-ifc](https://github.com/tomvandig/web-ifc) to load BIM models directly from IFC files.
26546
26578
  *
26547
26579
  * <a href="https://xeokit.github.io/xeokit-sdk/examples/index.html#BIMOffline_WebIFCLoaderPlugin_Duplex"><img src="https://xeokit.io/img/docs/WebIFCLoaderPlugin/WebIFCLoaderPlugin.png"></a>
@@ -27050,7 +27082,7 @@ return _this128;}/**
27050
27082
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
27051
27083
  * @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}.
27052
27084
  */},{key:"load",value:function load(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};if(params.id&&this.viewer.scene.components[params.id]){this.error("Component with this ID already exists in viewer: "+params.id+" - will autogenerate this ID");delete params.id;}var sceneModel=new SceneModel(this.viewer.scene,utils.apply(params,{isModel:true}));if(!params.src&&!params.ifc){this.error("load() param expected: src or IFC");return sceneModel;// Return new empty model
27053
- }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i515=0,len=includeTypes.length;_i515<len;_i515++){options.includeTypesMap[includeTypes[_i515]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i516=0,_len103=excludeTypes.length;_i516<_len103;_i516++){options.excludeTypesMap[excludeTypes[_i516]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
27085
+ }var options={autoNormals:true};if(params.loadMetadata!==false){var includeTypes=params.includeTypes||this._includeTypes;var excludeTypes=params.excludeTypes||this._excludeTypes;var objectDefaults=params.objectDefaults||this._objectDefaults;if(includeTypes){options.includeTypesMap={};for(var _i519=0,len=includeTypes.length;_i519<len;_i519++){options.includeTypesMap[includeTypes[_i519]]=true;}}if(excludeTypes){options.excludeTypesMap={};for(var _i520=0,_len105=excludeTypes.length;_i520<_len105;_i520++){options.excludeTypesMap[excludeTypes[_i520]]=true;}}if(objectDefaults){options.objectDefaults=objectDefaults;}options.excludeUnclassifiedObjects=params.excludeUnclassifiedObjects!==undefined?!!params.excludeUnclassifiedObjects:this._excludeUnclassifiedObjects;options.globalizeObjectIds=params.globalizeObjectIds!==undefined?!!params.globalizeObjectIds:this._globalizeObjectIds;}if(this.webIfcFroMOutside)try{if(params.src){this._loadModel(params.src,params,options,sceneModel);}else{this._parseModel(params.ifc,params,options,sceneModel);}}catch(e){this.error(e);sceneModel.fire("error",e);}// this.on("initialized", () => {
27054
27086
  // try {
27055
27087
  // if (params.src) {
27056
27088
  // this._loadModel(params.src, params, options, sceneModel);
@@ -27063,9 +27095,9 @@ return _this128;}/**
27063
27095
  // }
27064
27096
  // });
27065
27097
  return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this129=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this129._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this129.error(errMsg);sceneModel.fire("error",errMsg);});}},{key:"_parseModel",value:function _parseModel(arrayBuffer,params,options,sceneModel){if(sceneModel.destroyed){return;}var stats=params.stats||{};stats.sourceFormat="IFC";stats.schemaVersion="";stats.title="";stats.author="";stats.created="";stats.numMetaObjects=0;stats.numPropertySets=0;stats.numObjects=0;stats.numGeometries=0;stats.numTriangles=0;stats.numVertices=0;if(this.webIfcFroMOutside){if(!this._ifcAPI){throw"WebIFCLoaderPlugin has no WebIFC instance configured - please inject via WebIFCLoaderPlugin constructor";}}else{if(options.wasmPath){this._ifcAPI.SetWasmPath(options.wasmPath);}}var dataArray=new Uint8Array(arrayBuffer);var modelID=this._ifcAPI.OpenModel(dataArray);var modelSchema=this._ifcAPI.GetModelSchema(modelID);var lines=this._ifcAPI.GetLineIDsWithType(modelID,this._webIFC.IFCPROJECT);var ifcProjectId=lines.get(0);var loadMetadata=params.loadMetadata!==false;var useOutsideMetadata=params.metadata!==undefined&&params.metadata!==null;var outMetadata;if(useOutsideMetadata){outMetadata=params.metadata;}else outMetadata=null;var metadata=loadMetadata?{id:"",projectId:""+ifcProjectId,author:"",createdAt:"",schema:"",creatingApplication:"",metaObjects:[],propertySets:[]}:outMetadata;var ctx={ifcProjectId:ifcProjectId,modelID:modelID,modelSchema:modelSchema,sceneModel:sceneModel,loadMetadata:loadMetadata,metadata:metadata,metaObjects:useOutsideMetadata?sceneModel.metaObjects:{},options:options,// log: function (msg) {},
27066
- nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i517=0,len=options.includeTypes.length;_i517<len;_i517++){ctx.includeTypes[options.includeTypes[_i517]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i518=0,_len104=options.excludeTypes.length;_i518<_len104;_i518++){ctx.excludeTypes[options.excludeTypes[_i518]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
27098
+ nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var _i521=0,len=options.includeTypes.length;_i521<len;_i521++){ctx.includeTypes[options.includeTypes[_i521]]=true;}}if(options.excludeTypes){ctx.excludeTypes={};for(var _i522=0,_len106=options.excludeTypes.length;_i522<_len106;_i522++){ctx.excludeTypes[options.excludeTypes[_i522]]=true;}}this._parseMetaObjects(ctx);this._parsePropertySets(ctx);}this._parseGeometry(ctx);sceneModel.finalize();if(loadMetadata||useOutsideMetadata){var metaModelId=sceneModel.id;this.viewer.metaScene.createMetaModel(metaModelId,ctx.metadata,options);}sceneModel.scene.once("tick",function(){if(sceneModel.destroyed){return;}sceneModel.scene.fire("modelLoaded",sceneModel.id);// FIXME: Assumes listeners know order of these two events
27067
27099
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
27068
- });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this130=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i519=0;_i519<lines.size();_i519++){var relID=lines.get(_i519);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this130._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this130._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i520=0;_i520<lines.size();_i520++){var relID=lines.get(_i520);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i521=0,len=props.length;_i521<len;_i521++){var prop=props[_i521];var name=prop.Name;var nominalValue=prop.NominalValue;if(name&&nominalValue){var property={name:name.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i522=0,_len105=relatedObjects.length;_i522<_len105;_i522++){var relatedObject=relatedObjects[_i522];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this131=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
27100
+ });}},{key:"_parseMetaObjects",value:function _parseMetaObjects(ctx){var ifcProject=this._ifcAPI.GetLine(ctx.modelID,ctx.ifcProjectId);this._parseSpatialChildren(ctx,ifcProject);}},{key:"_parseSpatialChildren",value:function _parseSpatialChildren(ctx,ifcElement,parentMetaObjectId){var metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);if(ctx.includeTypes&&!ctx.includeTypes[metaObjectType]){return;}if(ctx.excludeTypes&&ctx.excludeTypes[metaObjectType]){return;}this._createMetaObject(ctx,ifcElement,parentMetaObjectId);var metaObjectId=ifcElement.GlobalId.value;this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingObject","RelatedObjects",this._webIFC.IFCRELAGGREGATES,metaObjectId);this._parseRelatedItemsOfType(ctx,ifcElement.expressID,"RelatingStructure","RelatedElements",this._webIFC.IFCRELCONTAINEDINSPATIALSTRUCTURE,metaObjectId);}},{key:"_createMetaObject",value:function _createMetaObject(ctx,ifcElement,parentMetaObjectId){var id=ifcElement.GlobalId.value;var metaObjectType;if(this.webIfcFroMOutside)metaObjectType=this._ifcAPI.GetNameFromTypeCode(ifcElement.type);else metaObjectType=ifcElement.__proto__.constructor.name;var metaObjectName=ifcElement.Name&&ifcElement.Name.value!==""?ifcElement.Name.value:metaObjectType;var metaObject={id:id,name:metaObjectName,type:metaObjectType,parent:parentMetaObjectId};ctx.metadata.metaObjects.push(metaObject);ctx.metaObjects[id]=metaObject;ctx.stats.numMetaObjects++;}},{key:"_parseRelatedItemsOfType",value:function _parseRelatedItemsOfType(ctx,id,relation,related,type,parentMetaObjectId){var _this130=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var _i523=0;_i523<lines.size();_i523++){var relID=lines.get(_i523);var rel=this._ifcAPI.GetLine(ctx.modelID,relID);if(rel==null)return;var relatedItems=rel[relation];var foundElement=false;if(Array.isArray(relatedItems)){var values=relatedItems.map(function(item){return item.value;});foundElement=values.includes(id);}else{foundElement=relatedItems.value===id;}if(foundElement){var element=rel[related];if(!Array.isArray(element)){var ifcElement=this._ifcAPI.GetLine(ctx.modelID,element.value);if(ifcElement==null)return;this._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);}else{element.forEach(function(element2){var ifcElement=_this130._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this130._parseSpatialChildren(ctx,ifcElement,parentMetaObjectId);});}}}}},{key:"_parsePropertySets",value:function _parsePropertySets(ctx){this.log("start parse property...");var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,this._webIFC.IFCRELDEFINESBYPROPERTIES);for(var _i524=0;_i524<lines.size();_i524++){var relID=lines.get(_i524);var rel=this._ifcAPI.GetLine(ctx.modelID,relID,true);if(rel){var relatingPropertyDefinition=rel.RelatingPropertyDefinition;if(!relatingPropertyDefinition){continue;}var propertySetId=relatingPropertyDefinition.GlobalId.value;var props=relatingPropertyDefinition.HasProperties;if(props&&props.length>0){var propertySetType="Default";var propertySetName=relatingPropertyDefinition.Name.value;var properties=[];for(var _i525=0,len=props.length;_i525<len;_i525++){var prop=props[_i525];var name=prop.Name;var nominalValue=prop.NominalValue;if(name&&nominalValue){var property={name:name.value,type:nominalValue.type,value:nominalValue.value,valueType:nominalValue.valueType};if(prop.Description){property.description=prop.Description.value;}else if(nominalValue.description){property.description=nominalValue.description;}properties.push(property);}}var propertySet={id:propertySetId,type:propertySetType,name:propertySetName,properties:properties};ctx.metadata.propertySets.push(propertySet);ctx.stats.numPropertySets++;var relatedObjects=rel.RelatedObjects;if(!relatedObjects||relatedObjects.length===0){return;}for(var _i526=0,_len107=relatedObjects.length;_i526<_len107;_i526++){var relatedObject=relatedObjects[_i526];var metaObjectId=relatedObject.GlobalId.value;var metaObject=ctx.metaObjects[metaObjectId];if(metaObject){if(!metaObject.propertySetIds){metaObject.propertySetIds=[];}metaObject.propertySetIds.push(propertySetId);}}}}}}},{key:"_parseGeometry",value:function _parseGeometry(ctx){var _this131=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
27069
27101
  var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this131._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;if(ctx.loadMetadata){var metaObjectId=globalId;var metaObject=ctx.metaObjects[metaObjectId];if(ctx.includeTypes&&(!metaObject||!ctx.includeTypes[metaObject.type])){return;}if(ctx.excludeTypes&&(!metaObject||ctx.excludeTypes[metaObject.type])){return;}}var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this131._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this131._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this131._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
27070
27102
  var positions=new Float64Array(vertexData.length/2);var normals=new Float32Array(vertexData.length/2);for(var k=0,l=0,lenk=vertexData.length/6;k<lenk;k++,l+=3){positions[l+0]=vertexData[k*6+0];positions[l+1]=vertexData[k*6+1];positions[l+2]=vertexData[k*6+2];}matrix.set(placedGeometry.flatTransformation);math.transformPositions3(matrix,positions);var rtcNeeded=worldToRTCPositions(positions,positions,origin);if(!ctx.options.autoNormals){for(var _k2=0,_l2=0,_lenk=vertexData.length/6;_k2<_lenk;_k2++,_l2+=3){normals[_l2+0]=vertexData[_k2*6+3];normals[_l2+1]=vertexData[_k2*6+4];normals[_l2+2]=vertexData[_k2*6+5];}}ctx.stats.numGeometries++;ctx.stats.numVertices+=positions.length/3;ctx.stats.numTriangles+=indices.length/3;var meshId="mesh"+ctx.nextId++;ctx.sceneModel.createMesh({id:meshId,primitive:"triangles",// TODO
27071
27103
  origin:rtcNeeded?origin:null,positions:positions,normals:ctx.options.autoNormals?null:normals,indices:indices,color:[placedGeometry.color.x,placedGeometry.color.y,placedGeometry.color.z],opacity:placedGeometry.color.w});meshIds.push(meshId);}var entityId=ctx.options.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,globalId):globalId;ctx.sceneModel.createEntity({id:entityId,meshIds:meshIds,isObject:true});ctx.stats.numObjects++;});this._ifcAPI.StreamAllMeshesWithTypes(ctx.modelID,[3856911033],function(mesh,index,total){var flatMeshExpressID=mesh.expressID;var properties=_this131._ifcAPI.GetLine(ctx.modelID,flatMeshExpressID);if(properties==null)return;var globalId=properties.GlobalId.value;var placedGeometries=mesh.geometries;var meshIds=[];var matrix=math.mat4();var origin=math.vec3();for(var j=0,lenj=placedGeometries.size();j<lenj;j++){var placedGeometry=placedGeometries.get(j);var geometry=_this131._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this131._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this131._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
@@ -69703,6 +69735,7 @@ __webpack_require__.r(__webpack_exports__);
69703
69735
  /* harmony import */ var _toolbar_MeasureTool__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./toolbar/MeasureTool */ "./src/toolbar/MeasureTool.ts");
69704
69736
  /* harmony import */ var _toolbar_CommentsTool__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./toolbar/CommentsTool */ "./src/toolbar/CommentsTool.ts");
69705
69737
  /* harmony import */ var _server_Server__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./server/Server */ "./src/server/Server.ts");
69738
+ /* harmony import */ var _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./toolbar/SkyBoxTool */ "./src/toolbar/SkyBoxTool.ts");
69706
69739
  var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
69707
69740
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
69708
69741
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -69734,6 +69767,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
69734
69767
 
69735
69768
 
69736
69769
 
69770
+
69737
69771
  /**
69738
69772
  * 核心模型视图窗口
69739
69773
  * @type {BIMViewer}
@@ -69864,6 +69898,9 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69864
69898
  // this._objectsKdTree3 = new ObjectsKdTree3({
69865
69899
  // viewer
69866
69900
  // });
69901
+ if (cfg.skyBoxImage || cfg.skyBoxSrc) {
69902
+ this._skyBoxTool = new _toolbar_SkyBoxTool__WEBPACK_IMPORTED_MODULE_21__["default"](this, { skyBoxImage: cfg.skyBoxImage, skyBoxSrc: cfg.skyBoxSrc });
69903
+ }
69867
69904
  // this._customizeViewer();
69868
69905
  this._modelsExplorer = new _explorer_ModelsExplorer__WEBPACK_IMPORTED_MODULE_11__["default"](this, {
69869
69906
  enableEditModels: false,
@@ -70335,8 +70372,14 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70335
70372
  * @param {Function} error Callback invoked on failure, into which the error message string is passed.
70336
70373
  */
70337
70374
  loadModel(modelId, modelBuffer, done = () => { }, error = () => { }) {
70375
+ if (!this._multiModel) {
70376
+ this._projectId = modelId;
70377
+ }
70338
70378
  this._modelsExplorer.loadModel(modelId, modelBuffer, done, error);
70339
70379
  }
70380
+ unloadModel(modelId) {
70381
+ this._modelsExplorer.unloadModel(modelId);
70382
+ }
70340
70383
  /**
70341
70384
  * 单独加载元数据
70342
70385
  * @param deflatedMetadata
@@ -70429,9 +70472,22 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70429
70472
  };
70430
70473
  return modelInfo;
70431
70474
  }
70475
+ /**
70476
+ * 获取指定元模型对象
70477
+ * @param modelId
70478
+ * @returns
70479
+ */
70432
70480
  getMetaModel(modelId) {
70433
70481
  return this.viewer.metaScene.metaModels[modelId];
70434
70482
  }
70483
+ /**
70484
+ * 获取指定场景模型对象
70485
+ * @param modelId
70486
+ * @returns
70487
+ */
70488
+ getSceneModel(modelId) {
70489
+ return this.viewer.scene.models[modelId];
70490
+ }
70435
70491
  //------------------------------------------------------------------------------------------------------------------
70436
70492
  // 视图设置
70437
70493
  //------------------------------------------------------------------------------------------------------------------
@@ -70796,6 +70852,8 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70796
70852
  this.measureAngleTool.destroy();
70797
70853
  this._annotationTool.destroy();
70798
70854
  this._commentsTool.destroy();
70855
+ if (this._skyBoxTool)
70856
+ this._skyBoxTool.destroy();
70799
70857
  this._modelsExplorer.destroy();
70800
70858
  this._classesExplorer.destroy();
70801
70859
  this._objectsExplorer.destroy();
@@ -71315,6 +71373,23 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71315
71373
  SetShowSpaceModeActive(active = !this._showSpacesMode.getActive(), callback = () => { }) {
71316
71374
  this._showSpacesMode.setActive(active, callback);
71317
71375
  }
71376
+ /**
71377
+ * 显示天空盒开关
71378
+ * @param active
71379
+ * @param callback
71380
+ */
71381
+ SetSkyBoxToolActive(active, callback = () => { }) {
71382
+ if (!this._skyBoxTool)
71383
+ return;
71384
+ if (active == undefined) {
71385
+ this._skyBoxTool.setActive(!this._skyBoxTool.getActive());
71386
+ }
71387
+ else {
71388
+ this._skyBoxTool.setActive(active);
71389
+ }
71390
+ if (callback)
71391
+ callback(this._sectionTool.getActive());
71392
+ }
71318
71393
  /// ///////////////功能对象/////////////////////
71319
71394
  /**
71320
71395
  * 漫游
@@ -71400,6 +71475,12 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71400
71475
  get navCubeMode() {
71401
71476
  return this._navCubeMode;
71402
71477
  }
71478
+ /**
71479
+ * 天空盒工具对象
71480
+ */
71481
+ get skyBoxTool() {
71482
+ return this._skyBoxTool;
71483
+ }
71403
71484
  /// //////////////////导航//////////////////////////
71404
71485
  /**
71405
71486
  * 设置相机方向
@@ -71461,6 +71542,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71461
71542
  done = sizeOrCallback;
71462
71543
  const { orbitYawCamera } = this;
71463
71544
  const { viewer } = this;
71545
+ const modelId = this._projectId;
71464
71546
  const canvas = document.createElement("canvas");
71465
71547
  const ctx = canvas.getContext("2d");
71466
71548
  const canvasWidth = size * 15;
@@ -71517,7 +71599,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71517
71599
  }
71518
71600
  cameraEnable(true);
71519
71601
  if (done)
71520
- done(imageData);
71602
+ done({ modelId, imageData });
71521
71603
  return imageData;
71522
71604
  }
71523
71605
  (() => __awaiter(this, void 0, void 0, function* () {
@@ -76551,7 +76633,7 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76551
76633
  }
76552
76634
  // this.setPointerLensVisible(false);
76553
76635
  // this.setPointerLensActive(false);
76554
- this.clear();
76636
+ // this.clear();
76555
76637
  }
76556
76638
  /**
76557
76639
  * destroy测量插件对象
@@ -76935,7 +77017,7 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76935
77017
  }
76936
77018
  // this.setPointerLensVisible(false);
76937
77019
  // this.setPointerLensActive(false);
76938
- this.clear();
77020
+ // this.clear();
76939
77021
  }
76940
77022
  /**
76941
77023
  * destroy测量插件对象
@@ -77287,10 +77369,6 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77287
77369
  this._isTouch = false;
77288
77370
  this.on("active", (active) => {
77289
77371
  if (active) {
77290
- // this._onHover = this.viewer.cameraControl.on("hover", (hoverResult: any) => {
77291
- // if (!hoverResult.entity) {
77292
- // }
77293
- // });
77294
77372
  }
77295
77373
  else {
77296
77374
  this.clear();
@@ -77493,6 +77571,7 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77493
77571
  for (const section in sectionPlanes) {
77494
77572
  const sectionPlane = sectionPlanes[section];
77495
77573
  sectionPlane.active = false;
77574
+ this.hideControl();
77496
77575
  }
77497
77576
  }
77498
77577
  /**
@@ -77506,8 +77585,8 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77506
77585
  */
77507
77586
  showControl() {
77508
77587
  const sectionPlanes = this.getSectionPlanes();
77509
- for (const plane in sectionPlanes) {
77510
- this._sectionPlanesPlugin.showControl(plane);
77588
+ for (const id in sectionPlanes) {
77589
+ sectionPlanes[id].control.setVisible(true);
77511
77590
  }
77512
77591
  }
77513
77592
  /**
@@ -77624,6 +77703,54 @@ class ShowSpacesMode extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"]
77624
77703
  }
77625
77704
 
77626
77705
 
77706
+ /***/ }),
77707
+
77708
+ /***/ "./src/toolbar/SkyBoxTool.ts":
77709
+ /*!***********************************!*\
77710
+ !*** ./src/toolbar/SkyBoxTool.ts ***!
77711
+ \***********************************/
77712
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77713
+
77714
+ __webpack_require__.r(__webpack_exports__);
77715
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
77716
+ /* harmony export */ "default": () => (/* binding */ SkyBoxTool)
77717
+ /* harmony export */ });
77718
+ /* harmony import */ var _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @xtctwins/tctwins-core */ "./node_modules/@xtctwins/tctwins-core/dist/tctwins-core.es5.js");
77719
+ /* harmony import */ var _Controller__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Controller */ "./src/Controller.ts");
77720
+
77721
+
77722
+ class SkyBoxTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77723
+ constructor(parent, cfg = {}) {
77724
+ super(parent, cfg);
77725
+ this.skyboxesPlugin = new _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.SkyboxesPlugin(this.viewer);
77726
+ this.on("active", (active) => {
77727
+ this.setSkyBoxActiveById();
77728
+ });
77729
+ this.createSkyBox(cfg);
77730
+ }
77731
+ createSkyBox(cfg) {
77732
+ const { skyBoxImage } = cfg;
77733
+ const { skyBoxSrc } = cfg;
77734
+ this.skyboxesPlugin.createSkybox("skybox1", {
77735
+ src: skyBoxSrc,
77736
+ image: skyBoxImage,
77737
+ size: 9000,
77738
+ scale: [1, 1],
77739
+ active: false
77740
+ });
77741
+ }
77742
+ setSkyBoxActiveById(id = "skybox1", active = !this.getSkyBoxById(id).active) {
77743
+ this.skyboxesPlugin.setSkyBoxActiveById(id, active);
77744
+ }
77745
+ getSkyBoxById(id = "skybox1") {
77746
+ return this.skyboxesPlugin.getSkyBoxById(id);
77747
+ }
77748
+ destroy() {
77749
+ this.skyboxesPlugin.destroy();
77750
+ }
77751
+ }
77752
+
77753
+
77627
77754
  /***/ }),
77628
77755
 
77629
77756
  /***/ "./src/toolbar/ThreeDMode.ts":