@xtctwins/tctwins-core 1.0.46 → 1.0.47

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.
@@ -1125,21 +1125,21 @@ var kdTreeDimLength=new Float32Array(3);/**
1125
1125
  * We can then traverse the k-d nodes, starting at {@link ObjectsKdTree3#root}, to find
1126
1126
  * the contained Entities.
1127
1127
  */var ObjectsKdTree3=/*#__PURE__*/function(){/**
1128
- * Creates an ObjectsKdTree3.
1129
- *
1130
- * @param {*} cfg Configuration
1131
- * @param {Viewer} cfg.viewer The Viewer that provides the {@link Entity}s in this ObjectsKdTree3.
1132
- * @param {number} [cfg.maxTreeDepth=15] Optional maximum depth for the k-d tree.
1133
- */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;});}/**
1134
- * Gets the root ObjectsKdTree3 node.
1135
- *
1136
- * Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3
1137
- * if {@link Entity}s have been created or removed in the {@link Viewer} since the last time it was accessed.
1138
- */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);}/**
1139
- * Destroys this ObjectsKdTree3.
1140
- *
1141
- * Does not destroy the {@link Viewer} given to the constructor of the ObjectsKdTree3.
1142
- */},{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;}/**
1128
+ * Creates an ObjectsKdTree3.
1129
+ *
1130
+ * @param {*} cfg Configuration
1131
+ * @param {Viewer} cfg.viewer The Viewer that provides the {@link Entity}s in this ObjectsKdTree3.
1132
+ * @param {number} [cfg.maxTreeDepth=15] Optional maximum depth for the k-d tree.
1133
+ */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;});}/**
1134
+ * Gets the root ObjectsKdTree3 node.
1135
+ *
1136
+ * Each time this accessor is accessed, it will lazy-rebuild the ObjectsKdTree3
1137
+ * if {@link Entity}s have been created or removed in the {@link Viewer} since the last time it was accessed.
1138
+ */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);}/**
1139
+ * Destroys this ObjectsKdTree3.
1140
+ *
1141
+ * Does not destroy the {@link Viewer} given to the constructor of the ObjectsKdTree3.
1142
+ */},{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;}/**
1143
1143
  * Usage:
1144
1144
  *
1145
1145
  * id = myMap.addItem("foo") // ID internally generated
@@ -2015,7 +2015,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
2015
2015
  * Default value is ````[0,0,0]````.
2016
2016
  *
2017
2017
  * @type {Number[]}
2018
- */,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();/**
2018
+ */,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();/**
2019
2019
  * @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.
2020
2020
  *
2021
2021
  * ## Position
@@ -2129,7 +2129,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
2129
2129
  * @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}.
2130
2130
  * @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.
2131
2131
  */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
2132
- 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"..)
2132
+ 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"..)
2133
2133
  if(this._visible===visible);this._visible=visible;this.fire("visible",this._visible);}/**
2134
2134
  * Sets the {@link Entity} this Marker is associated with.
2135
2135
  *
@@ -5308,679 +5308,679 @@ this._occlusionTester.unbindRenderBuf();}};/**
5308
5308
  */this.endSnapshot=function(){if(!snapshotBound){return;}var snapshotBuffer=renderBufferManager.getRenderBuffer("snapshot");snapshotBuffer.unbind();snapshotBound=false;};/**
5309
5309
  * Destroys this renderer.
5310
5310
  * @private
5311
- */this.destroy=function(){drawableTypeInfo={};drawables={};renderBufferManager.destroy();saoOcclusionRenderer.destroy();saoDepthLimitedBlurRenderer.destroy();if(this._occlusionTester){this._occlusionTester.destroy();}};};/**
5312
- * @desc Meditates mouse, touch and keyboard events for various interaction controls.
5313
- *
5314
- * Ordinarily, you would only use this component as a utility to help manage input events and state for your
5315
- * own custom input handlers.
5316
- *
5317
- * * Located at {@link Scene#input}
5318
- * * Used by (at least) {@link CameraControl}
5319
- *
5320
- * ## Usage
5321
- *
5322
- * Subscribing to mouse events on the canvas:
5323
- *
5324
- * ````javascript
5325
- * import {Viewer} from "xeokit-sdk.es.js";
5326
- *
5327
- * const viewer = new Viewer({
5328
- * canvasId: "myCanvas"
5329
- * });
5330
- *
5331
- * const input = viewer.scene.input;
5332
- *
5333
- * const onMouseDown = input.on("mousedown", (canvasCoords) => {
5334
- * console.log("Mouse down at: x=" + canvasCoords[0] + ", y=" + coords[1]);
5335
- * });
5336
- *
5337
- * const onMouseUp = input.on("mouseup", (canvasCoords) => {
5338
- * console.log("Mouse up at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5339
- * });
5340
- *
5341
- * const onMouseClicked = input.on("mouseclicked", (canvasCoords) => {
5342
- * console.log("Mouse clicked at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5343
- * });
5344
- *
5345
- * const onDblClick = input.on("dblclick", (canvasCoords) => {
5346
- * console.log("Double-click at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5347
- * });
5348
- * ````
5349
- *
5350
- * Subscribing to keyboard events on the canvas:
5351
- *
5352
- * ````javascript
5353
- * const onKeyDown = input.on("keydown", (keyCode) => {
5354
- * switch (keyCode) {
5355
- * case this.KEY_A:
5356
- * console.log("The 'A' key is down");
5357
- * break;
5358
- *
5359
- * case this.KEY_B:
5360
- * console.log("The 'B' key is down");
5361
- * break;
5362
- *
5363
- * case this.KEY_C:
5364
- * console.log("The 'C' key is down");
5365
- * break;
5366
- *
5367
- * default:
5368
- * console.log("Some other key is down");
5369
- * }
5370
- * });
5371
- *
5372
- * const onKeyUp = input.on("keyup", (keyCode) => {
5373
- * switch (keyCode) {
5374
- * case this.KEY_A:
5375
- * console.log("The 'A' key is up");
5376
- * break;
5377
- *
5378
- * case this.KEY_B:
5379
- * console.log("The 'B' key is up");
5380
- * break;
5381
- *
5382
- * case this.KEY_C:
5383
- * console.log("The 'C' key is up");
5384
- * break;
5385
- *
5386
- * default:
5387
- * console.log("Some other key is up");
5388
- * }
5389
- * });
5390
- * ````
5391
- *
5392
- * Checking if keys are down:
5393
- *
5394
- * ````javascript
5395
- * const isCtrlDown = input.ctrlDown;
5396
- * const isAltDown = input.altDown;
5397
- * const shiftDown = input.shiftDown;
5398
- * //...
5399
- *
5400
- * const isAKeyDown = input.keyDown[input.KEY_A];
5401
- * const isBKeyDown = input.keyDown[input.KEY_B];
5402
- * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];
5403
- * //...
5404
- *
5405
- * ````
5406
- * Unsubscribing from events:
5407
- *
5408
- * ````javascript
5409
- * input.off(onMouseDown);
5410
- * input.off(onMouseUp);
5411
- * //...
5412
- * ````
5413
- *
5414
- * ## Disabling all events
5415
- *
5416
- * Event handling is enabled by default.
5417
- *
5418
- * To disable all events:
5419
- *
5420
- * ````javascript
5421
- * myViewer.scene.input.setEnabled(false);
5422
- * ````
5423
- * To enable all events again:
5424
- *
5425
- * ````javascript
5426
- * myViewer.scene.input.setEnabled(true);
5427
- * ````
5428
- *
5429
- * ## Disabling keyboard input
5430
- *
5431
- * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need
5432
- * to disable keyboard control, so that other UI elements can get those events.
5433
- *
5434
- * To disable keyboard events:
5435
- *
5436
- * ````javascript
5437
- * myViewer.scene.input.setKeyboardEnabled(false);
5438
- * ````
5439
- *
5440
- * To enable keyboard events again:
5441
- *
5442
- * ````javascript
5443
- * myViewer.scene.input.setKeyboardEnabled(true)
5444
- * ````
5445
- */var Input=/*#__PURE__*/function(_Component9){/**
5446
- * @private
5447
- */function Input(owner){var _this37;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Input);_this37=_callSuper(this,Input,[owner,cfg]);/**
5448
- * Code for the BACKSPACE key.
5449
- * @property KEY_BACKSPACE
5450
- * @final
5451
- * @type {Number}
5452
- */_this37.KEY_BACKSPACE=8;/**
5453
- * Code for the TAB key.
5454
- * @property KEY_TAB
5455
- * @final
5456
- * @type {Number}
5457
- */_this37.KEY_TAB=9;/**
5458
- * Code for the ENTER key.
5459
- * @property KEY_ENTER
5460
- * @final
5461
- * @type {Number}
5462
- */_this37.KEY_ENTER=13;/**
5463
- * Code for the SHIFT key.
5464
- * @property KEY_SHIFT
5465
- * @final
5466
- * @type {Number}
5467
- */_this37.KEY_SHIFT=16;/**
5468
- * Code for the CTRL key.
5469
- * @property KEY_CTRL
5470
- * @final
5471
- * @type {Number}
5472
- */_this37.KEY_CTRL=17;/**
5473
- * Code for the ALT key.
5474
- * @property KEY_ALT
5475
- * @final
5476
- * @type {Number}
5477
- */_this37.KEY_ALT=18;/**
5478
- * Code for the PAUSE_BREAK key.
5479
- * @property KEY_PAUSE_BREAK
5480
- * @final
5481
- * @type {Number}
5482
- */_this37.KEY_PAUSE_BREAK=19;/**
5483
- * Code for the CAPS_LOCK key.
5484
- * @property KEY_CAPS_LOCK
5485
- * @final
5486
- * @type {Number}
5487
- */_this37.KEY_CAPS_LOCK=20;/**
5488
- * Code for the ESCAPE key.
5489
- * @property KEY_ESCAPE
5490
- * @final
5491
- * @type {Number}
5492
- */_this37.KEY_ESCAPE=27;/**
5493
- * Code for the PAGE_UP key.
5494
- * @property KEY_PAGE_UP
5495
- * @final
5496
- * @type {Number}
5497
- */_this37.KEY_PAGE_UP=33;/**
5498
- * Code for the PAGE_DOWN key.
5499
- * @property KEY_PAGE_DOWN
5500
- * @final
5501
- * @type {Number}
5502
- */_this37.KEY_PAGE_DOWN=34;/**
5503
- * Code for the END key.
5504
- * @property KEY_END
5505
- * @final
5506
- * @type {Number}
5507
- */_this37.KEY_END=35;/**
5508
- * Code for the HOME key.
5509
- * @property KEY_HOME
5510
- * @final
5511
- * @type {Number}
5512
- */_this37.KEY_HOME=36;/**
5513
- * Code for the LEFT_ARROW key.
5514
- * @property KEY_LEFT_ARROW
5515
- * @final
5516
- * @type {Number}
5517
- */_this37.KEY_LEFT_ARROW=37;/**
5518
- * Code for the UP_ARROW key.
5519
- * @property KEY_UP_ARROW
5520
- * @final
5521
- * @type {Number}
5522
- */_this37.KEY_UP_ARROW=38;/**
5523
- * Code for the RIGHT_ARROW key.
5524
- * @property KEY_RIGHT_ARROW
5525
- * @final
5526
- * @type {Number}
5527
- */_this37.KEY_RIGHT_ARROW=39;/**
5528
- * Code for the DOWN_ARROW key.
5529
- * @property KEY_DOWN_ARROW
5530
- * @final
5531
- * @type {Number}
5532
- */_this37.KEY_DOWN_ARROW=40;/**
5533
- * Code for the INSERT key.
5534
- * @property KEY_INSERT
5535
- * @final
5536
- * @type {Number}
5537
- */_this37.KEY_INSERT=45;/**
5538
- * Code for the DELETE key.
5539
- * @property KEY_DELETE
5540
- * @final
5541
- * @type {Number}
5542
- */_this37.KEY_DELETE=46;/**
5543
- * Code for the 0 key.
5544
- * @property KEY_NUM_0
5545
- * @final
5546
- * @type {Number}
5547
- */_this37.KEY_NUM_0=48;/**
5548
- * Code for the 1 key.
5549
- * @property KEY_NUM_1
5550
- * @final
5551
- * @type {Number}
5552
- */_this37.KEY_NUM_1=49;/**
5553
- * Code for the 2 key.
5554
- * @property KEY_NUM_2
5555
- * @final
5556
- * @type {Number}
5557
- */_this37.KEY_NUM_2=50;/**
5558
- * Code for the 3 key.
5559
- * @property KEY_NUM_3
5560
- * @final
5561
- * @type {Number}
5562
- */_this37.KEY_NUM_3=51;/**
5563
- * Code for the 4 key.
5564
- * @property KEY_NUM_4
5565
- * @final
5566
- * @type {Number}
5567
- */_this37.KEY_NUM_4=52;/**
5568
- * Code for the 5 key.
5569
- * @property KEY_NUM_5
5570
- * @final
5571
- * @type {Number}
5572
- */_this37.KEY_NUM_5=53;/**
5573
- * Code for the 6 key.
5574
- * @property KEY_NUM_6
5575
- * @final
5576
- * @type {Number}
5577
- */_this37.KEY_NUM_6=54;/**
5578
- * Code for the 7 key.
5579
- * @property KEY_NUM_7
5580
- * @final
5581
- * @type {Number}
5582
- */_this37.KEY_NUM_7=55;/**
5583
- * Code for the 8 key.
5584
- * @property KEY_NUM_8
5585
- * @final
5586
- * @type {Number}
5587
- */_this37.KEY_NUM_8=56;/**
5588
- * Code for the 9 key.
5589
- * @property KEY_NUM_9
5590
- * @final
5591
- * @type {Number}
5592
- */_this37.KEY_NUM_9=57;/**
5593
- * Code for the A key.
5594
- * @property KEY_A
5595
- * @final
5596
- * @type {Number}
5597
- */_this37.KEY_A=65;/**
5598
- * Code for the B key.
5599
- * @property KEY_B
5600
- * @final
5601
- * @type {Number}
5602
- */_this37.KEY_B=66;/**
5603
- * Code for the C key.
5604
- * @property KEY_C
5605
- * @final
5606
- * @type {Number}
5607
- */_this37.KEY_C=67;/**
5608
- * Code for the D key.
5609
- * @property KEY_D
5610
- * @final
5611
- * @type {Number}
5612
- */_this37.KEY_D=68;/**
5613
- * Code for the E key.
5614
- * @property KEY_E
5615
- * @final
5616
- * @type {Number}
5617
- */_this37.KEY_E=69;/**
5618
- * Code for the F key.
5619
- * @property KEY_F
5620
- * @final
5621
- * @type {Number}
5622
- */_this37.KEY_F=70;/**
5623
- * Code for the G key.
5624
- * @property KEY_G
5625
- * @final
5626
- * @type {Number}
5627
- */_this37.KEY_G=71;/**
5628
- * Code for the H key.
5629
- * @property KEY_H
5630
- * @final
5631
- * @type {Number}
5632
- */_this37.KEY_H=72;/**
5633
- * Code for the I key.
5634
- * @property KEY_I
5635
- * @final
5636
- * @type {Number}
5637
- */_this37.KEY_I=73;/**
5638
- * Code for the J key.
5639
- * @property KEY_J
5640
- * @final
5641
- * @type {Number}
5642
- */_this37.KEY_J=74;/**
5643
- * Code for the K key.
5644
- * @property KEY_K
5645
- * @final
5646
- * @type {Number}
5647
- */_this37.KEY_K=75;/**
5648
- * Code for the L key.
5649
- * @property KEY_L
5650
- * @final
5651
- * @type {Number}
5652
- */_this37.KEY_L=76;/**
5653
- * Code for the M key.
5654
- * @property KEY_M
5655
- * @final
5656
- * @type {Number}
5657
- */_this37.KEY_M=77;/**
5658
- * Code for the N key.
5659
- * @property KEY_N
5660
- * @final
5661
- * @type {Number}
5662
- */_this37.KEY_N=78;/**
5663
- * Code for the O key.
5664
- * @property KEY_O
5665
- * @final
5666
- * @type {Number}
5667
- */_this37.KEY_O=79;/**
5668
- * Code for the P key.
5669
- * @property KEY_P
5670
- * @final
5671
- * @type {Number}
5672
- */_this37.KEY_P=80;/**
5673
- * Code for the Q key.
5674
- * @property KEY_Q
5675
- * @final
5676
- * @type {Number}
5677
- */_this37.KEY_Q=81;/**
5678
- * Code for the R key.
5679
- * @property KEY_R
5680
- * @final
5681
- * @type {Number}
5682
- */_this37.KEY_R=82;/**
5683
- * Code for the S key.
5684
- * @property KEY_S
5685
- * @final
5686
- * @type {Number}
5687
- */_this37.KEY_S=83;/**
5688
- * Code for the T key.
5689
- * @property KEY_T
5690
- * @final
5691
- * @type {Number}
5692
- */_this37.KEY_T=84;/**
5693
- * Code for the U key.
5694
- * @property KEY_U
5695
- * @final
5696
- * @type {Number}
5697
- */_this37.KEY_U=85;/**
5698
- * Code for the V key.
5699
- * @property KEY_V
5700
- * @final
5701
- * @type {Number}
5702
- */_this37.KEY_V=86;/**
5703
- * Code for the W key.
5704
- * @property KEY_W
5705
- * @final
5706
- * @type {Number}
5707
- */_this37.KEY_W=87;/**
5708
- * Code for the X key.
5709
- * @property KEY_X
5710
- * @final
5711
- * @type {Number}
5712
- */_this37.KEY_X=88;/**
5713
- * Code for the Y key.
5714
- * @property KEY_Y
5715
- * @final
5716
- * @type {Number}
5717
- */_this37.KEY_Y=89;/**
5718
- * Code for the Z key.
5719
- * @property KEY_Z
5720
- * @final
5721
- * @type {Number}
5722
- */_this37.KEY_Z=90;/**
5723
- * Code for the LEFT_WINDOW key.
5724
- * @property KEY_LEFT_WINDOW
5725
- * @final
5726
- * @type {Number}
5727
- */_this37.KEY_LEFT_WINDOW=91;/**
5728
- * Code for the RIGHT_WINDOW key.
5729
- * @property KEY_RIGHT_WINDOW
5730
- * @final
5731
- * @type {Number}
5732
- */_this37.KEY_RIGHT_WINDOW=92;/**
5733
- * Code for the SELECT key.
5734
- * @property KEY_SELECT
5735
- * @final
5736
- * @type {Number}
5737
- */_this37.KEY_SELECT_KEY=93;/**
5738
- * Code for the number pad 0 key.
5739
- * @property KEY_NUMPAD_0
5740
- * @final
5741
- * @type {Number}
5742
- */_this37.KEY_NUMPAD_0=96;/**
5743
- * Code for the number pad 1 key.
5744
- * @property KEY_NUMPAD_1
5745
- * @final
5746
- * @type {Number}
5747
- */_this37.KEY_NUMPAD_1=97;/**
5748
- * Code for the number pad 2 key.
5749
- * @property KEY_NUMPAD 2
5750
- * @final
5751
- * @type {Number}
5752
- */_this37.KEY_NUMPAD_2=98;/**
5753
- * Code for the number pad 3 key.
5754
- * @property KEY_NUMPAD_3
5755
- * @final
5756
- * @type {Number}
5757
- */_this37.KEY_NUMPAD_3=99;/**
5758
- * Code for the number pad 4 key.
5759
- * @property KEY_NUMPAD_4
5760
- * @final
5761
- * @type {Number}
5762
- */_this37.KEY_NUMPAD_4=100;/**
5763
- * Code for the number pad 5 key.
5764
- * @property KEY_NUMPAD_5
5765
- * @final
5766
- * @type {Number}
5767
- */_this37.KEY_NUMPAD_5=101;/**
5768
- * Code for the number pad 6 key.
5769
- * @property KEY_NUMPAD_6
5770
- * @final
5771
- * @type {Number}
5772
- */_this37.KEY_NUMPAD_6=102;/**
5773
- * Code for the number pad 7 key.
5774
- * @property KEY_NUMPAD_7
5775
- * @final
5776
- * @type {Number}
5777
- */_this37.KEY_NUMPAD_7=103;/**
5778
- * Code for the number pad 8 key.
5779
- * @property KEY_NUMPAD_8
5780
- * @final
5781
- * @type {Number}
5782
- */_this37.KEY_NUMPAD_8=104;/**
5783
- * Code for the number pad 9 key.
5784
- * @property KEY_NUMPAD_9
5785
- * @final
5786
- * @type {Number}
5787
- */_this37.KEY_NUMPAD_9=105;/**
5788
- * Code for the MULTIPLY key.
5789
- * @property KEY_MULTIPLY
5790
- * @final
5791
- * @type {Number}
5792
- */_this37.KEY_MULTIPLY=106;/**
5793
- * Code for the ADD key.
5794
- * @property KEY_ADD
5795
- * @final
5796
- * @type {Number}
5797
- */_this37.KEY_ADD=107;/**
5798
- * Code for the SUBTRACT key.
5799
- * @property KEY_SUBTRACT
5800
- * @final
5801
- * @type {Number}
5802
- */_this37.KEY_SUBTRACT=109;/**
5803
- * Code for the DECIMAL POINT key.
5804
- * @property KEY_DECIMAL_POINT
5805
- * @final
5806
- * @type {Number}
5807
- */_this37.KEY_DECIMAL_POINT=110;/**
5808
- * Code for the DIVIDE key.
5809
- * @property KEY_DIVIDE
5810
- * @final
5811
- * @type {Number}
5812
- */_this37.KEY_DIVIDE=111;/**
5813
- * Code for the F1 key.
5814
- * @property KEY_F1
5815
- * @final
5816
- * @type {Number}
5817
- */_this37.KEY_F1=112;/**
5818
- * Code for the F2 key.
5819
- * @property KEY_F2
5820
- * @final
5821
- * @type {Number}
5822
- */_this37.KEY_F2=113;/**
5823
- * Code for the F3 key.
5824
- * @property KEY_F3
5825
- * @final
5826
- * @type {Number}
5827
- */_this37.KEY_F3=114;/**
5828
- * Code for the F4 key.
5829
- * @property KEY_F4
5830
- * @final
5831
- * @type {Number}
5832
- */_this37.KEY_F4=115;/**
5833
- * Code for the F5 key.
5834
- * @property KEY_F5
5835
- * @final
5836
- * @type {Number}
5837
- */_this37.KEY_F5=116;/**
5838
- * Code for the F6 key.
5839
- * @property KEY_F6
5840
- * @final
5841
- * @type {Number}
5842
- */_this37.KEY_F6=117;/**
5843
- * Code for the F7 key.
5844
- * @property KEY_F7
5845
- * @final
5846
- * @type {Number}
5847
- */_this37.KEY_F7=118;/**
5848
- * Code for the F8 key.
5849
- * @property KEY_F8
5850
- * @final
5851
- * @type {Number}
5852
- */_this37.KEY_F8=119;/**
5853
- * Code for the F9 key.
5854
- * @property KEY_F9
5855
- * @final
5856
- * @type {Number}
5857
- */_this37.KEY_F9=120;/**
5858
- * Code for the F10 key.
5859
- * @property KEY_F10
5860
- * @final
5861
- * @type {Number}
5862
- */_this37.KEY_F10=121;/**
5863
- * Code for the F11 key.
5864
- * @property KEY_F11
5865
- * @final
5866
- * @type {Number}
5867
- */_this37.KEY_F11=122;/**
5868
- * Code for the F12 key.
5869
- * @property KEY_F12
5870
- * @final
5871
- * @type {Number}
5872
- */_this37.KEY_F12=123;/**
5873
- * Code for the NUM_LOCK key.
5874
- * @property KEY_NUM_LOCK
5875
- * @final
5876
- * @type {Number}
5877
- */_this37.KEY_NUM_LOCK=144;/**
5878
- * Code for the SCROLL_LOCK key.
5879
- * @property KEY_SCROLL_LOCK
5880
- * @final
5881
- * @type {Number}
5882
- */_this37.KEY_SCROLL_LOCK=145;/**
5883
- * Code for the SEMI_COLON key.
5884
- * @property KEY_SEMI_COLON
5885
- * @final
5886
- * @type {Number}
5887
- */_this37.KEY_SEMI_COLON=186;/**
5888
- * Code for the EQUAL_SIGN key.
5889
- * @property KEY_EQUAL_SIGN
5890
- * @final
5891
- * @type {Number}
5892
- */_this37.KEY_EQUAL_SIGN=187;/**
5893
- * Code for the COMMA key.
5894
- * @property KEY_COMMA
5895
- * @final
5896
- * @type {Number}
5897
- */_this37.KEY_COMMA=188;/**
5898
- * Code for the DASH key.
5899
- * @property KEY_DASH
5900
- * @final
5901
- * @type {Number}
5902
- */_this37.KEY_DASH=189;/**
5903
- * Code for the PERIOD key.
5904
- * @property KEY_PERIOD
5905
- * @final
5906
- * @type {Number}
5907
- */_this37.KEY_PERIOD=190;/**
5908
- * Code for the FORWARD_SLASH key.
5909
- * @property KEY_FORWARD_SLASH
5910
- * @final
5911
- * @type {Number}
5912
- */_this37.KEY_FORWARD_SLASH=191;/**
5913
- * Code for the GRAVE_ACCENT key.
5914
- * @property KEY_GRAVE_ACCENT
5915
- * @final
5916
- * @type {Number}
5917
- */_this37.KEY_GRAVE_ACCENT=192;/**
5918
- * Code for the OPEN_BRACKET key.
5919
- * @property KEY_OPEN_BRACKET
5920
- * @final
5921
- * @type {Number}
5922
- */_this37.KEY_OPEN_BRACKET=219;/**
5923
- * Code for the BACK_SLASH key.
5924
- * @property KEY_BACK_SLASH
5925
- * @final
5926
- * @type {Number}
5927
- */_this37.KEY_BACK_SLASH=220;/**
5928
- * Code for the CLOSE_BRACKET key.
5929
- * @property KEY_CLOSE_BRACKET
5930
- * @final
5931
- * @type {Number}
5932
- */_this37.KEY_CLOSE_BRACKET=221;/**
5933
- * Code for the SINGLE_QUOTE key.
5934
- * @property KEY_SINGLE_QUOTE
5935
- * @final
5936
- * @type {Number}
5937
- */_this37.KEY_SINGLE_QUOTE=222;/**
5938
- * Code for the SPACE key.
5939
- * @property KEY_SPACE
5940
- * @final
5941
- * @type {Number}
5942
- */_this37.KEY_SPACE=32;/**
5943
- * The canvas element that mouse and keyboards are bound to.
5944
- *
5945
- * @final
5946
- * @type {HTMLCanvasElement}
5947
- */_this37.element=cfg.element;/** True whenever ALT key is down.
5948
- *
5949
- * @type {boolean}
5950
- */_this37.altDown=false;/** True whenever CTRL key is down.
5951
- *
5952
- * @type {boolean}
5953
- */_this37.ctrlDown=false;/** True whenever left mouse button is down.
5954
- *
5955
- * @type {boolean}
5956
- */_this37.mouseDownLeft=false;/**
5957
- * True whenever middle mouse button is down.
5958
- *
5959
- * @type {boolean}
5960
- */_this37.mouseDownMiddle=false;/**
5961
- * True whenever the right mouse button is down.
5962
- *
5963
- * @type {boolean}
5964
- */_this37.mouseDownRight=false;/**
5965
- * Flag for each key that's down.
5966
- *
5967
- * @type {boolean[]}
5968
- */_this37.keyDown=[];/** True while input enabled
5969
- *
5970
- * @type {boolean}
5971
- */_this37.enabled=true;/** True while keyboard input is enabled.
5972
- *
5973
- * Default value is ````true````.
5974
- *
5975
- * {@link CameraControl} will not respond to keyboard events while this is ````false````.
5976
- *
5977
- * @type {boolean}
5978
- */_this37.keyboardEnabled=true;/** True while the mouse is over the canvas.
5979
- *
5980
- * @type {boolean}
5981
- */_this37.mouseover=false;/**
5982
- * Current mouse position within the canvas.
5983
- * @type {Number[]}
5311
+ */this.destroy=function(){drawableTypeInfo={};drawables={};renderBufferManager.destroy();saoOcclusionRenderer.destroy();saoDepthLimitedBlurRenderer.destroy();if(this._occlusionTester){this._occlusionTester.destroy();}};};/**
5312
+ * @desc Meditates mouse, touch and keyboard events for various interaction controls.
5313
+ *
5314
+ * Ordinarily, you would only use this component as a utility to help manage input events and state for your
5315
+ * own custom input handlers.
5316
+ *
5317
+ * * Located at {@link Scene#input}
5318
+ * * Used by (at least) {@link CameraControl}
5319
+ *
5320
+ * ## Usage
5321
+ *
5322
+ * Subscribing to mouse events on the canvas:
5323
+ *
5324
+ * ````javascript
5325
+ * import {Viewer} from "xeokit-sdk.es.js";
5326
+ *
5327
+ * const viewer = new Viewer({
5328
+ * canvasId: "myCanvas"
5329
+ * });
5330
+ *
5331
+ * const input = viewer.scene.input;
5332
+ *
5333
+ * const onMouseDown = input.on("mousedown", (canvasCoords) => {
5334
+ * console.log("Mouse down at: x=" + canvasCoords[0] + ", y=" + coords[1]);
5335
+ * });
5336
+ *
5337
+ * const onMouseUp = input.on("mouseup", (canvasCoords) => {
5338
+ * console.log("Mouse up at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5339
+ * });
5340
+ *
5341
+ * const onMouseClicked = input.on("mouseclicked", (canvasCoords) => {
5342
+ * console.log("Mouse clicked at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5343
+ * });
5344
+ *
5345
+ * const onDblClick = input.on("dblclick", (canvasCoords) => {
5346
+ * console.log("Double-click at: x=" + canvasCoords[0] + ", y=" + canvasCoords[1]);
5347
+ * });
5348
+ * ````
5349
+ *
5350
+ * Subscribing to keyboard events on the canvas:
5351
+ *
5352
+ * ````javascript
5353
+ * const onKeyDown = input.on("keydown", (keyCode) => {
5354
+ * switch (keyCode) {
5355
+ * case this.KEY_A:
5356
+ * console.log("The 'A' key is down");
5357
+ * break;
5358
+ *
5359
+ * case this.KEY_B:
5360
+ * console.log("The 'B' key is down");
5361
+ * break;
5362
+ *
5363
+ * case this.KEY_C:
5364
+ * console.log("The 'C' key is down");
5365
+ * break;
5366
+ *
5367
+ * default:
5368
+ * console.log("Some other key is down");
5369
+ * }
5370
+ * });
5371
+ *
5372
+ * const onKeyUp = input.on("keyup", (keyCode) => {
5373
+ * switch (keyCode) {
5374
+ * case this.KEY_A:
5375
+ * console.log("The 'A' key is up");
5376
+ * break;
5377
+ *
5378
+ * case this.KEY_B:
5379
+ * console.log("The 'B' key is up");
5380
+ * break;
5381
+ *
5382
+ * case this.KEY_C:
5383
+ * console.log("The 'C' key is up");
5384
+ * break;
5385
+ *
5386
+ * default:
5387
+ * console.log("Some other key is up");
5388
+ * }
5389
+ * });
5390
+ * ````
5391
+ *
5392
+ * Checking if keys are down:
5393
+ *
5394
+ * ````javascript
5395
+ * const isCtrlDown = input.ctrlDown;
5396
+ * const isAltDown = input.altDown;
5397
+ * const shiftDown = input.shiftDown;
5398
+ * //...
5399
+ *
5400
+ * const isAKeyDown = input.keyDown[input.KEY_A];
5401
+ * const isBKeyDown = input.keyDown[input.KEY_B];
5402
+ * const isShiftKeyDown = input.keyDown[input.KEY_SHIFT];
5403
+ * //...
5404
+ *
5405
+ * ````
5406
+ * Unsubscribing from events:
5407
+ *
5408
+ * ````javascript
5409
+ * input.off(onMouseDown);
5410
+ * input.off(onMouseUp);
5411
+ * //...
5412
+ * ````
5413
+ *
5414
+ * ## Disabling all events
5415
+ *
5416
+ * Event handling is enabled by default.
5417
+ *
5418
+ * To disable all events:
5419
+ *
5420
+ * ````javascript
5421
+ * myViewer.scene.input.setEnabled(false);
5422
+ * ````
5423
+ * To enable all events again:
5424
+ *
5425
+ * ````javascript
5426
+ * myViewer.scene.input.setEnabled(true);
5427
+ * ````
5428
+ *
5429
+ * ## Disabling keyboard input
5430
+ *
5431
+ * When the mouse is over the canvas, the canvas will consume keyboard events. Therefore, sometimes we need
5432
+ * to disable keyboard control, so that other UI elements can get those events.
5433
+ *
5434
+ * To disable keyboard events:
5435
+ *
5436
+ * ````javascript
5437
+ * myViewer.scene.input.setKeyboardEnabled(false);
5438
+ * ````
5439
+ *
5440
+ * To enable keyboard events again:
5441
+ *
5442
+ * ````javascript
5443
+ * myViewer.scene.input.setKeyboardEnabled(true)
5444
+ * ````
5445
+ */var Input=/*#__PURE__*/function(_Component9){/**
5446
+ * @private
5447
+ */function Input(owner){var _this37;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,Input);_this37=_callSuper(this,Input,[owner,cfg]);/**
5448
+ * Code for the BACKSPACE key.
5449
+ * @property KEY_BACKSPACE
5450
+ * @final
5451
+ * @type {Number}
5452
+ */_this37.KEY_BACKSPACE=8;/**
5453
+ * Code for the TAB key.
5454
+ * @property KEY_TAB
5455
+ * @final
5456
+ * @type {Number}
5457
+ */_this37.KEY_TAB=9;/**
5458
+ * Code for the ENTER key.
5459
+ * @property KEY_ENTER
5460
+ * @final
5461
+ * @type {Number}
5462
+ */_this37.KEY_ENTER=13;/**
5463
+ * Code for the SHIFT key.
5464
+ * @property KEY_SHIFT
5465
+ * @final
5466
+ * @type {Number}
5467
+ */_this37.KEY_SHIFT=16;/**
5468
+ * Code for the CTRL key.
5469
+ * @property KEY_CTRL
5470
+ * @final
5471
+ * @type {Number}
5472
+ */_this37.KEY_CTRL=17;/**
5473
+ * Code for the ALT key.
5474
+ * @property KEY_ALT
5475
+ * @final
5476
+ * @type {Number}
5477
+ */_this37.KEY_ALT=18;/**
5478
+ * Code for the PAUSE_BREAK key.
5479
+ * @property KEY_PAUSE_BREAK
5480
+ * @final
5481
+ * @type {Number}
5482
+ */_this37.KEY_PAUSE_BREAK=19;/**
5483
+ * Code for the CAPS_LOCK key.
5484
+ * @property KEY_CAPS_LOCK
5485
+ * @final
5486
+ * @type {Number}
5487
+ */_this37.KEY_CAPS_LOCK=20;/**
5488
+ * Code for the ESCAPE key.
5489
+ * @property KEY_ESCAPE
5490
+ * @final
5491
+ * @type {Number}
5492
+ */_this37.KEY_ESCAPE=27;/**
5493
+ * Code for the PAGE_UP key.
5494
+ * @property KEY_PAGE_UP
5495
+ * @final
5496
+ * @type {Number}
5497
+ */_this37.KEY_PAGE_UP=33;/**
5498
+ * Code for the PAGE_DOWN key.
5499
+ * @property KEY_PAGE_DOWN
5500
+ * @final
5501
+ * @type {Number}
5502
+ */_this37.KEY_PAGE_DOWN=34;/**
5503
+ * Code for the END key.
5504
+ * @property KEY_END
5505
+ * @final
5506
+ * @type {Number}
5507
+ */_this37.KEY_END=35;/**
5508
+ * Code for the HOME key.
5509
+ * @property KEY_HOME
5510
+ * @final
5511
+ * @type {Number}
5512
+ */_this37.KEY_HOME=36;/**
5513
+ * Code for the LEFT_ARROW key.
5514
+ * @property KEY_LEFT_ARROW
5515
+ * @final
5516
+ * @type {Number}
5517
+ */_this37.KEY_LEFT_ARROW=37;/**
5518
+ * Code for the UP_ARROW key.
5519
+ * @property KEY_UP_ARROW
5520
+ * @final
5521
+ * @type {Number}
5522
+ */_this37.KEY_UP_ARROW=38;/**
5523
+ * Code for the RIGHT_ARROW key.
5524
+ * @property KEY_RIGHT_ARROW
5525
+ * @final
5526
+ * @type {Number}
5527
+ */_this37.KEY_RIGHT_ARROW=39;/**
5528
+ * Code for the DOWN_ARROW key.
5529
+ * @property KEY_DOWN_ARROW
5530
+ * @final
5531
+ * @type {Number}
5532
+ */_this37.KEY_DOWN_ARROW=40;/**
5533
+ * Code for the INSERT key.
5534
+ * @property KEY_INSERT
5535
+ * @final
5536
+ * @type {Number}
5537
+ */_this37.KEY_INSERT=45;/**
5538
+ * Code for the DELETE key.
5539
+ * @property KEY_DELETE
5540
+ * @final
5541
+ * @type {Number}
5542
+ */_this37.KEY_DELETE=46;/**
5543
+ * Code for the 0 key.
5544
+ * @property KEY_NUM_0
5545
+ * @final
5546
+ * @type {Number}
5547
+ */_this37.KEY_NUM_0=48;/**
5548
+ * Code for the 1 key.
5549
+ * @property KEY_NUM_1
5550
+ * @final
5551
+ * @type {Number}
5552
+ */_this37.KEY_NUM_1=49;/**
5553
+ * Code for the 2 key.
5554
+ * @property KEY_NUM_2
5555
+ * @final
5556
+ * @type {Number}
5557
+ */_this37.KEY_NUM_2=50;/**
5558
+ * Code for the 3 key.
5559
+ * @property KEY_NUM_3
5560
+ * @final
5561
+ * @type {Number}
5562
+ */_this37.KEY_NUM_3=51;/**
5563
+ * Code for the 4 key.
5564
+ * @property KEY_NUM_4
5565
+ * @final
5566
+ * @type {Number}
5567
+ */_this37.KEY_NUM_4=52;/**
5568
+ * Code for the 5 key.
5569
+ * @property KEY_NUM_5
5570
+ * @final
5571
+ * @type {Number}
5572
+ */_this37.KEY_NUM_5=53;/**
5573
+ * Code for the 6 key.
5574
+ * @property KEY_NUM_6
5575
+ * @final
5576
+ * @type {Number}
5577
+ */_this37.KEY_NUM_6=54;/**
5578
+ * Code for the 7 key.
5579
+ * @property KEY_NUM_7
5580
+ * @final
5581
+ * @type {Number}
5582
+ */_this37.KEY_NUM_7=55;/**
5583
+ * Code for the 8 key.
5584
+ * @property KEY_NUM_8
5585
+ * @final
5586
+ * @type {Number}
5587
+ */_this37.KEY_NUM_8=56;/**
5588
+ * Code for the 9 key.
5589
+ * @property KEY_NUM_9
5590
+ * @final
5591
+ * @type {Number}
5592
+ */_this37.KEY_NUM_9=57;/**
5593
+ * Code for the A key.
5594
+ * @property KEY_A
5595
+ * @final
5596
+ * @type {Number}
5597
+ */_this37.KEY_A=65;/**
5598
+ * Code for the B key.
5599
+ * @property KEY_B
5600
+ * @final
5601
+ * @type {Number}
5602
+ */_this37.KEY_B=66;/**
5603
+ * Code for the C key.
5604
+ * @property KEY_C
5605
+ * @final
5606
+ * @type {Number}
5607
+ */_this37.KEY_C=67;/**
5608
+ * Code for the D key.
5609
+ * @property KEY_D
5610
+ * @final
5611
+ * @type {Number}
5612
+ */_this37.KEY_D=68;/**
5613
+ * Code for the E key.
5614
+ * @property KEY_E
5615
+ * @final
5616
+ * @type {Number}
5617
+ */_this37.KEY_E=69;/**
5618
+ * Code for the F key.
5619
+ * @property KEY_F
5620
+ * @final
5621
+ * @type {Number}
5622
+ */_this37.KEY_F=70;/**
5623
+ * Code for the G key.
5624
+ * @property KEY_G
5625
+ * @final
5626
+ * @type {Number}
5627
+ */_this37.KEY_G=71;/**
5628
+ * Code for the H key.
5629
+ * @property KEY_H
5630
+ * @final
5631
+ * @type {Number}
5632
+ */_this37.KEY_H=72;/**
5633
+ * Code for the I key.
5634
+ * @property KEY_I
5635
+ * @final
5636
+ * @type {Number}
5637
+ */_this37.KEY_I=73;/**
5638
+ * Code for the J key.
5639
+ * @property KEY_J
5640
+ * @final
5641
+ * @type {Number}
5642
+ */_this37.KEY_J=74;/**
5643
+ * Code for the K key.
5644
+ * @property KEY_K
5645
+ * @final
5646
+ * @type {Number}
5647
+ */_this37.KEY_K=75;/**
5648
+ * Code for the L key.
5649
+ * @property KEY_L
5650
+ * @final
5651
+ * @type {Number}
5652
+ */_this37.KEY_L=76;/**
5653
+ * Code for the M key.
5654
+ * @property KEY_M
5655
+ * @final
5656
+ * @type {Number}
5657
+ */_this37.KEY_M=77;/**
5658
+ * Code for the N key.
5659
+ * @property KEY_N
5660
+ * @final
5661
+ * @type {Number}
5662
+ */_this37.KEY_N=78;/**
5663
+ * Code for the O key.
5664
+ * @property KEY_O
5665
+ * @final
5666
+ * @type {Number}
5667
+ */_this37.KEY_O=79;/**
5668
+ * Code for the P key.
5669
+ * @property KEY_P
5670
+ * @final
5671
+ * @type {Number}
5672
+ */_this37.KEY_P=80;/**
5673
+ * Code for the Q key.
5674
+ * @property KEY_Q
5675
+ * @final
5676
+ * @type {Number}
5677
+ */_this37.KEY_Q=81;/**
5678
+ * Code for the R key.
5679
+ * @property KEY_R
5680
+ * @final
5681
+ * @type {Number}
5682
+ */_this37.KEY_R=82;/**
5683
+ * Code for the S key.
5684
+ * @property KEY_S
5685
+ * @final
5686
+ * @type {Number}
5687
+ */_this37.KEY_S=83;/**
5688
+ * Code for the T key.
5689
+ * @property KEY_T
5690
+ * @final
5691
+ * @type {Number}
5692
+ */_this37.KEY_T=84;/**
5693
+ * Code for the U key.
5694
+ * @property KEY_U
5695
+ * @final
5696
+ * @type {Number}
5697
+ */_this37.KEY_U=85;/**
5698
+ * Code for the V key.
5699
+ * @property KEY_V
5700
+ * @final
5701
+ * @type {Number}
5702
+ */_this37.KEY_V=86;/**
5703
+ * Code for the W key.
5704
+ * @property KEY_W
5705
+ * @final
5706
+ * @type {Number}
5707
+ */_this37.KEY_W=87;/**
5708
+ * Code for the X key.
5709
+ * @property KEY_X
5710
+ * @final
5711
+ * @type {Number}
5712
+ */_this37.KEY_X=88;/**
5713
+ * Code for the Y key.
5714
+ * @property KEY_Y
5715
+ * @final
5716
+ * @type {Number}
5717
+ */_this37.KEY_Y=89;/**
5718
+ * Code for the Z key.
5719
+ * @property KEY_Z
5720
+ * @final
5721
+ * @type {Number}
5722
+ */_this37.KEY_Z=90;/**
5723
+ * Code for the LEFT_WINDOW key.
5724
+ * @property KEY_LEFT_WINDOW
5725
+ * @final
5726
+ * @type {Number}
5727
+ */_this37.KEY_LEFT_WINDOW=91;/**
5728
+ * Code for the RIGHT_WINDOW key.
5729
+ * @property KEY_RIGHT_WINDOW
5730
+ * @final
5731
+ * @type {Number}
5732
+ */_this37.KEY_RIGHT_WINDOW=92;/**
5733
+ * Code for the SELECT key.
5734
+ * @property KEY_SELECT
5735
+ * @final
5736
+ * @type {Number}
5737
+ */_this37.KEY_SELECT_KEY=93;/**
5738
+ * Code for the number pad 0 key.
5739
+ * @property KEY_NUMPAD_0
5740
+ * @final
5741
+ * @type {Number}
5742
+ */_this37.KEY_NUMPAD_0=96;/**
5743
+ * Code for the number pad 1 key.
5744
+ * @property KEY_NUMPAD_1
5745
+ * @final
5746
+ * @type {Number}
5747
+ */_this37.KEY_NUMPAD_1=97;/**
5748
+ * Code for the number pad 2 key.
5749
+ * @property KEY_NUMPAD 2
5750
+ * @final
5751
+ * @type {Number}
5752
+ */_this37.KEY_NUMPAD_2=98;/**
5753
+ * Code for the number pad 3 key.
5754
+ * @property KEY_NUMPAD_3
5755
+ * @final
5756
+ * @type {Number}
5757
+ */_this37.KEY_NUMPAD_3=99;/**
5758
+ * Code for the number pad 4 key.
5759
+ * @property KEY_NUMPAD_4
5760
+ * @final
5761
+ * @type {Number}
5762
+ */_this37.KEY_NUMPAD_4=100;/**
5763
+ * Code for the number pad 5 key.
5764
+ * @property KEY_NUMPAD_5
5765
+ * @final
5766
+ * @type {Number}
5767
+ */_this37.KEY_NUMPAD_5=101;/**
5768
+ * Code for the number pad 6 key.
5769
+ * @property KEY_NUMPAD_6
5770
+ * @final
5771
+ * @type {Number}
5772
+ */_this37.KEY_NUMPAD_6=102;/**
5773
+ * Code for the number pad 7 key.
5774
+ * @property KEY_NUMPAD_7
5775
+ * @final
5776
+ * @type {Number}
5777
+ */_this37.KEY_NUMPAD_7=103;/**
5778
+ * Code for the number pad 8 key.
5779
+ * @property KEY_NUMPAD_8
5780
+ * @final
5781
+ * @type {Number}
5782
+ */_this37.KEY_NUMPAD_8=104;/**
5783
+ * Code for the number pad 9 key.
5784
+ * @property KEY_NUMPAD_9
5785
+ * @final
5786
+ * @type {Number}
5787
+ */_this37.KEY_NUMPAD_9=105;/**
5788
+ * Code for the MULTIPLY key.
5789
+ * @property KEY_MULTIPLY
5790
+ * @final
5791
+ * @type {Number}
5792
+ */_this37.KEY_MULTIPLY=106;/**
5793
+ * Code for the ADD key.
5794
+ * @property KEY_ADD
5795
+ * @final
5796
+ * @type {Number}
5797
+ */_this37.KEY_ADD=107;/**
5798
+ * Code for the SUBTRACT key.
5799
+ * @property KEY_SUBTRACT
5800
+ * @final
5801
+ * @type {Number}
5802
+ */_this37.KEY_SUBTRACT=109;/**
5803
+ * Code for the DECIMAL POINT key.
5804
+ * @property KEY_DECIMAL_POINT
5805
+ * @final
5806
+ * @type {Number}
5807
+ */_this37.KEY_DECIMAL_POINT=110;/**
5808
+ * Code for the DIVIDE key.
5809
+ * @property KEY_DIVIDE
5810
+ * @final
5811
+ * @type {Number}
5812
+ */_this37.KEY_DIVIDE=111;/**
5813
+ * Code for the F1 key.
5814
+ * @property KEY_F1
5815
+ * @final
5816
+ * @type {Number}
5817
+ */_this37.KEY_F1=112;/**
5818
+ * Code for the F2 key.
5819
+ * @property KEY_F2
5820
+ * @final
5821
+ * @type {Number}
5822
+ */_this37.KEY_F2=113;/**
5823
+ * Code for the F3 key.
5824
+ * @property KEY_F3
5825
+ * @final
5826
+ * @type {Number}
5827
+ */_this37.KEY_F3=114;/**
5828
+ * Code for the F4 key.
5829
+ * @property KEY_F4
5830
+ * @final
5831
+ * @type {Number}
5832
+ */_this37.KEY_F4=115;/**
5833
+ * Code for the F5 key.
5834
+ * @property KEY_F5
5835
+ * @final
5836
+ * @type {Number}
5837
+ */_this37.KEY_F5=116;/**
5838
+ * Code for the F6 key.
5839
+ * @property KEY_F6
5840
+ * @final
5841
+ * @type {Number}
5842
+ */_this37.KEY_F6=117;/**
5843
+ * Code for the F7 key.
5844
+ * @property KEY_F7
5845
+ * @final
5846
+ * @type {Number}
5847
+ */_this37.KEY_F7=118;/**
5848
+ * Code for the F8 key.
5849
+ * @property KEY_F8
5850
+ * @final
5851
+ * @type {Number}
5852
+ */_this37.KEY_F8=119;/**
5853
+ * Code for the F9 key.
5854
+ * @property KEY_F9
5855
+ * @final
5856
+ * @type {Number}
5857
+ */_this37.KEY_F9=120;/**
5858
+ * Code for the F10 key.
5859
+ * @property KEY_F10
5860
+ * @final
5861
+ * @type {Number}
5862
+ */_this37.KEY_F10=121;/**
5863
+ * Code for the F11 key.
5864
+ * @property KEY_F11
5865
+ * @final
5866
+ * @type {Number}
5867
+ */_this37.KEY_F11=122;/**
5868
+ * Code for the F12 key.
5869
+ * @property KEY_F12
5870
+ * @final
5871
+ * @type {Number}
5872
+ */_this37.KEY_F12=123;/**
5873
+ * Code for the NUM_LOCK key.
5874
+ * @property KEY_NUM_LOCK
5875
+ * @final
5876
+ * @type {Number}
5877
+ */_this37.KEY_NUM_LOCK=144;/**
5878
+ * Code for the SCROLL_LOCK key.
5879
+ * @property KEY_SCROLL_LOCK
5880
+ * @final
5881
+ * @type {Number}
5882
+ */_this37.KEY_SCROLL_LOCK=145;/**
5883
+ * Code for the SEMI_COLON key.
5884
+ * @property KEY_SEMI_COLON
5885
+ * @final
5886
+ * @type {Number}
5887
+ */_this37.KEY_SEMI_COLON=186;/**
5888
+ * Code for the EQUAL_SIGN key.
5889
+ * @property KEY_EQUAL_SIGN
5890
+ * @final
5891
+ * @type {Number}
5892
+ */_this37.KEY_EQUAL_SIGN=187;/**
5893
+ * Code for the COMMA key.
5894
+ * @property KEY_COMMA
5895
+ * @final
5896
+ * @type {Number}
5897
+ */_this37.KEY_COMMA=188;/**
5898
+ * Code for the DASH key.
5899
+ * @property KEY_DASH
5900
+ * @final
5901
+ * @type {Number}
5902
+ */_this37.KEY_DASH=189;/**
5903
+ * Code for the PERIOD key.
5904
+ * @property KEY_PERIOD
5905
+ * @final
5906
+ * @type {Number}
5907
+ */_this37.KEY_PERIOD=190;/**
5908
+ * Code for the FORWARD_SLASH key.
5909
+ * @property KEY_FORWARD_SLASH
5910
+ * @final
5911
+ * @type {Number}
5912
+ */_this37.KEY_FORWARD_SLASH=191;/**
5913
+ * Code for the GRAVE_ACCENT key.
5914
+ * @property KEY_GRAVE_ACCENT
5915
+ * @final
5916
+ * @type {Number}
5917
+ */_this37.KEY_GRAVE_ACCENT=192;/**
5918
+ * Code for the OPEN_BRACKET key.
5919
+ * @property KEY_OPEN_BRACKET
5920
+ * @final
5921
+ * @type {Number}
5922
+ */_this37.KEY_OPEN_BRACKET=219;/**
5923
+ * Code for the BACK_SLASH key.
5924
+ * @property KEY_BACK_SLASH
5925
+ * @final
5926
+ * @type {Number}
5927
+ */_this37.KEY_BACK_SLASH=220;/**
5928
+ * Code for the CLOSE_BRACKET key.
5929
+ * @property KEY_CLOSE_BRACKET
5930
+ * @final
5931
+ * @type {Number}
5932
+ */_this37.KEY_CLOSE_BRACKET=221;/**
5933
+ * Code for the SINGLE_QUOTE key.
5934
+ * @property KEY_SINGLE_QUOTE
5935
+ * @final
5936
+ * @type {Number}
5937
+ */_this37.KEY_SINGLE_QUOTE=222;/**
5938
+ * Code for the SPACE key.
5939
+ * @property KEY_SPACE
5940
+ * @final
5941
+ * @type {Number}
5942
+ */_this37.KEY_SPACE=32;/**
5943
+ * The canvas element that mouse and keyboards are bound to.
5944
+ *
5945
+ * @final
5946
+ * @type {HTMLCanvasElement}
5947
+ */_this37.element=cfg.element;/** True whenever ALT key is down.
5948
+ *
5949
+ * @type {boolean}
5950
+ */_this37.altDown=false;/** True whenever CTRL key is down.
5951
+ *
5952
+ * @type {boolean}
5953
+ */_this37.ctrlDown=false;/** True whenever left mouse button is down.
5954
+ *
5955
+ * @type {boolean}
5956
+ */_this37.mouseDownLeft=false;/**
5957
+ * True whenever middle mouse button is down.
5958
+ *
5959
+ * @type {boolean}
5960
+ */_this37.mouseDownMiddle=false;/**
5961
+ * True whenever the right mouse button is down.
5962
+ *
5963
+ * @type {boolean}
5964
+ */_this37.mouseDownRight=false;/**
5965
+ * Flag for each key that's down.
5966
+ *
5967
+ * @type {boolean[]}
5968
+ */_this37.keyDown=[];/** True while input enabled
5969
+ *
5970
+ * @type {boolean}
5971
+ */_this37.enabled=true;/** True while keyboard input is enabled.
5972
+ *
5973
+ * Default value is ````true````.
5974
+ *
5975
+ * {@link CameraControl} will not respond to keyboard events while this is ````false````.
5976
+ *
5977
+ * @type {boolean}
5978
+ */_this37.keyboardEnabled=true;/** True while the mouse is over the canvas.
5979
+ *
5980
+ * @type {boolean}
5981
+ */_this37.mouseover=false;/**
5982
+ * Current mouse position within the canvas.
5983
+ * @type {Number[]}
5984
5984
  */_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
5985
5985
  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
5986
5986
  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
@@ -6011,36 +6011,36 @@ this.element.addEventListener("touchmove",this._touchMoveListener=function(e){if
6011
6011
  tickifedMouseMoveFn();});// mouseclicked / touch
6012
6012
  {var downX;var downY;// Tolerance between down and up positions for a mouse click
6013
6013
  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];// 获取第一个触摸点的信息
6014
- 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;}/**
6015
- * Sets whether input handlers are enabled.
6016
- *
6017
- * Default value is ````true````.
6018
- *
6019
- * @param {Boolean} enable Indicates if input handlers are enabled.
6020
- */},{key:"setEnabled",value:function setEnabled(enable){if(this.enabled!==enable){this.fire("enabled",this.enabled=enable);}}/**
6021
- * Gets whether input handlers are enabled.
6022
- *
6023
- * Default value is ````true````.
6024
- *
6025
- * @returns {Boolean} Indicates if input handlers are enabled.
6026
- */},{key:"getEnabled",value:function getEnabled(){return this.enabled;}/**
6027
- * Sets whether or not keyboard input is enabled.
6028
- *
6029
- * Default value is ````true````.
6030
- *
6031
- * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6032
- *
6033
- * @param {Boolean} value Indicates whether keyboard input is enabled.
6034
- */},{key:"setKeyboardEnabled",value:function setKeyboardEnabled(value){this.keyboardEnabled=value;}/**
6035
- * Gets whether keyboard input is enabled.
6036
- *
6037
- * Default value is ````true````.
6038
- *
6039
- * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6040
- *
6041
- * @returns {Boolean} Returns whether keyboard input is enabled.
6042
- */},{key:"getKeyboardEnabled",value:function getKeyboardEnabled(){return this.keyboardEnabled;}/**
6043
- * @private
6014
+ 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;}/**
6015
+ * Sets whether input handlers are enabled.
6016
+ *
6017
+ * Default value is ````true````.
6018
+ *
6019
+ * @param {Boolean} enable Indicates if input handlers are enabled.
6020
+ */},{key:"setEnabled",value:function setEnabled(enable){if(this.enabled!==enable){this.fire("enabled",this.enabled=enable);}}/**
6021
+ * Gets whether input handlers are enabled.
6022
+ *
6023
+ * Default value is ````true````.
6024
+ *
6025
+ * @returns {Boolean} Indicates if input handlers are enabled.
6026
+ */},{key:"getEnabled",value:function getEnabled(){return this.enabled;}/**
6027
+ * Sets whether or not keyboard input is enabled.
6028
+ *
6029
+ * Default value is ````true````.
6030
+ *
6031
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6032
+ *
6033
+ * @param {Boolean} value Indicates whether keyboard input is enabled.
6034
+ */},{key:"setKeyboardEnabled",value:function setKeyboardEnabled(value){this.keyboardEnabled=value;}/**
6035
+ * Gets whether keyboard input is enabled.
6036
+ *
6037
+ * Default value is ````true````.
6038
+ *
6039
+ * {@link CameraControl} will not respond to keyboard events while this is set ````false````.
6040
+ *
6041
+ * @returns {Boolean} Returns whether keyboard input is enabled.
6042
+ */},{key:"getKeyboardEnabled",value:function getKeyboardEnabled(){return this.keyboardEnabled;}/**
6043
+ * @private
6044
6044
  */},{key:"destroy",value:function destroy(){_superPropGet(Input,"destroy",this,3)([]);this._unbindEvents();}}]);}(Component);var ids$3=new Map({});/**
6045
6045
  * @desc Represents a chunk of state changes applied by the {@link Scene}'s renderer while it renders a frame.
6046
6046
  *
@@ -6527,7 +6527,7 @@ _this42.left=cfg.left;_this42.right=cfg.right;_this42.bottom=cfg.bottom;_this42.
6527
6527
  * @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.
6528
6528
  */},{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
6529
6529
  *
6530
- */},{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();/**
6530
+ */},{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();/**
6531
6531
  * @desc Manages viewing and projection transforms for its {@link Scene}.
6532
6532
  *
6533
6533
  * * One Camera per {@link Scene}
@@ -6969,7 +6969,7 @@ this.fire("dirty");this.fire("projection",this._projectionType);this.fire("projM
6969
6969
  *
6970
6970
  * @param {[number, number, number]} worldPos
6971
6971
  * @returns {[number, number]} the canvas position
6972
- */},{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;}/**
6972
+ */},{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;}/**
6973
6973
  * Destroys this Camera.
6974
6974
  */},{key:"destroy",value:function destroy(){_superPropGet(Camera,"destroy",this,3)([]);this._state.destroy();}}]);}(Component);/**
6975
6975
  * @desc A dynamic light source within a {@link Scene}.
@@ -9408,7 +9408,7 @@ function getEntityIDMap(scene,entityIds){var map={};var entityId;var entity;for(
9408
9408
  * @throws {String} Throws an exception when both canvasId or canvasElement are missing or they aren't pointing to a valid HTMLCanvasElement.
9409
9409
  */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";}/**
9410
9410
  * @type {{[key: string]: {wrapperFunc: Function, tickSubId: string}}}
9411
- */_this57._tickifiedFunctions={};_this57._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this57._edgesEnabled=!!cfg.edgesEnabled;_this57._aabbDirty=true;_this57._aabbUpdate=false;/**
9411
+ */_this57._tickifiedFunctions={};_this57._transparent=!!cfg.transparent;var alphaDepthMask=!!cfg.alphaDepthMask;_this57._edgesEnabled=!!cfg.edgesEnabled;_this57._aabbDirty=true;_this57._aabbUpdate=false;_this57._collideWithEntity=false;/**
9412
9412
  * The {@link Viewer} this Scene belongs to.
9413
9413
  * @type {Viewer}
9414
9414
  */_this57.viewer=viewer;/** Decremented each frame, triggers occlusion test for occludable {@link Marker}s when zero.
@@ -14111,7 +14111,7 @@ _this78.active=cfg.active;return _this78;}/**
14111
14111
  * });
14112
14112
  *
14113
14113
  * @class SkyboxesPlugin
14114
- */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;}/**
14114
+ */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;}/**
14115
14115
  * @private
14116
14116
  */_inherits(SkyboxesPlugin,_Plugin7);return _createClass(SkyboxesPlugin,[{key:"send",value:function send(name,value){switch(name){case"clear":this.clear();break;}}/**
14117
14117
  Creates a skybox.
@@ -14120,10 +14120,12 @@ _this78.active=cfg.active;return _this78;}/**
14120
14120
  @param {Object} params Skybox configuration.
14121
14121
  @param {Boolean} [params.active=true] Whether the skybox plane is initially active. Only skyboxes while this is true.
14122
14122
  @returns {Skybox} The new skybox.
14123
- */},{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;}/**
14123
+ */},{key:"createSkybox",value:function createSkybox(id,params){if(this.viewer.scene.components[id]){this.error("Component with this ID already exists: "+id);return this;}var skybox=new Skybox(this.viewer.scene,{id:id,size:params.size,scale:params.scale,src:params.src,active:params.active,encoding:3000});this.skyboxes[id]=skybox;return skybox;}},{key:"setSkyBoxActiveById",value:function setSkyBoxActiveById(id,active){this.skyboxes[id].active=active;}/**
14124
+ * 设置开启天空盒
14125
+ */},{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];}/**
14124
14126
  Destroys a skybox.
14125
14127
  @param id
14126
- */,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();}/**
14128
+ */},{key:"destroySkybox",value:function destroySkybox(id){var skybox=this.skyboxes[id];if(!skybox){this.error("Skybox not found: "+id);return;}skybox.destroy();}/**
14127
14129
  Destroys all skyboxes.
14128
14130
  */},{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]);}}/**
14129
14131
  * Destroys this plugin.
@@ -15171,7 +15173,7 @@ best=oct=octEncodeVec3(worldNormal,"floor","floor");dec=octDecodeVec2(oct);curre
15171
15173
  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))]);}/**
15172
15174
  * @private
15173
15175
  */function octDecodeVec2(oct){// Decode an oct-encoded normal
15174
- 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();/**
15176
+ 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();/**
15175
15177
  * @private
15176
15178
  */var VBOBatchingTrianglesLayer=/*#__PURE__*/function(){/**
15177
15179
  * @param model
@@ -15245,7 +15247,7 @@ var flagsLength=buffer.positions.length/3;var flags=new Float32Array(flagsLength
15245
15247
  * 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.
15246
15248
  */},{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
15247
15249
  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
15248
- 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 -----------------------------------
15250
+ 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 -----------------------------------
15249
15251
  },{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 --------------
15250
15252
  },{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
15251
15253
  }}},{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
@@ -15410,7 +15412,7 @@ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:func
15410
15412
  if(!this._silhouetteRenderer){// Used for highlighting and selection
15411
15413
  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={};/**
15412
15414
  * @private
15413
- */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);/**
15415
+ */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);/**
15414
15416
  * @private
15415
15417
  */var VBOInstancingTrianglesLayer=/*#__PURE__*/function(){/**
15416
15418
  * @param cfg
@@ -15507,7 +15509,7 @@ if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8
15507
15509
  /**
15508
15510
  * 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.
15509
15511
  */},{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
15510
- 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";}////////////////////////////////////////
15512
+ 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";}////////////////////////////////////////
15511
15513
  // TODO: Update portion matrix
15512
15514
  ////////////////////////////////////////
15513
15515
  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 -----------------------------------
@@ -16320,12 +16322,12 @@ gl.RGBA,gl.FLOAT,tempMat4a$d);// gl.bindTexture (gl.TEXTURE_2D, null);
16320
16322
  // if (this._renderers.silhouetteRenderer) {
16321
16323
  // this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
16322
16324
  // }
16323
- }},{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();/**
16325
+ }},{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();/**
16324
16326
  * @private
16325
16327
  */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
16326
16328
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices
16327
16329
  );gl.drawArrays(gl.TRIANGLES,0,state.numIndices16Bits);}if(state.numIndices32Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32// 32 bits indices
16328
- );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
16330
+ );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
16329
16331
  src.push("int polygonIndex = gl_VertexID / 3;");// get packed object-id
16330
16332
  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
16331
16333
  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
@@ -19566,12 +19568,12 @@ if(metaModelData.propertySets){for(var _i469=0,_len95=metaModelData.propertySets
19566
19568
  */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"!=typeof module?e(exports):"function"==typeof define&&define.amd?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});/*
19567
19569
  Parser for .XTC Format V10
19568
19570
  */var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
19569
- 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?
19571
+ 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?
19570
19572
  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
19571
- 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
19573
+ 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
19572
19574
  if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
19573
19575
  }// Create textures
19574
- 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
19576
+ 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
19575
19577
  var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19576
19578
  var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19577
19579
  var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
@@ -19583,10 +19585,37 @@ var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};f
19583
19585
  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
19584
19586
  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
19585
19587
  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
19586
- 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
19588
+ 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
19587
19589
  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
19588
- 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
19589
- 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;
19590
+ 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
19591
+ 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};/*
19592
+ Parser for .XTC Format V11
19593
+ */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
19594
+ 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?
19595
+ 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
19596
+ 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
19597
+ }// Create textures
19598
+ 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
19599
+ var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19600
+ var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19601
+ var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
19602
+ 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,
19603
+ minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
19604
+ 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
19605
+ 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
19606
+ 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
19607
+ 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
19608
+ 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
19609
+ 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
19610
+ 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
19611
+ 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
19612
+ 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
19613
+ 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.
19614
+ // To efficiently create typed arrays from this buffer,
19615
+ // each typed array's source data needs to be aligned with its element byte size.
19616
+ // This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
19617
+ // It is a different encoding than used in earlier versions, and requires different approach to parsing elements.
19618
+ 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;
19590
19619
  // parsers[ParserV2.version] = ParserV2;
19591
19620
  // parsers[ParserV3.version] = ParserV3;
19592
19621
  // parsers[ParserV4.version] = ParserV4;
@@ -19595,7 +19624,7 @@ var _primitiveType=eachGeometryPrimitiveType[_geometryIndex];var primitiveName=v
19595
19624
  // parsers[ParserV7.version] = ParserV7;
19596
19625
  // parsers[ParserV8.version] = ParserV8;
19597
19626
  // parsers[ParserV9.version] = ParserV9;
19598
- parsers[ParserV10.version]=ParserV10;/**
19627
+ parsers[ParserV10.version]=ParserV10;parsers[ParserV11.version]=ParserV11;/**
19599
19628
  * {@link Viewer} plugin that loads models from xeokit's optimized *````.XTC````* format.
19600
19629
  *
19601
19630
  * <a href="https://xeokit.github.io/xeokit-sdk/examples/#loading_XTC_OTCConferenceCenter"><img src="http://xeokit.io/img/docs/XTCLoaderPlugin/XTCLoaderPlugin.png"></a>
@@ -20349,15 +20378,18 @@ parsers[ParserV10.version]=ParserV10;/**
20349
20378
  * represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
20350
20379
  * to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
20351
20380
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
20381
+ * @param {Number} [params.renderOrder=0] Specifies the rendering order for the model. This is used to control the order in which
20382
+ * SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
20383
+ * render pass.
20352
20384
  * @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}.
20353
20385
  */},{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
20354
- }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
20386
+ }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
20355
20387
  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);
20356
20388
  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
20357
20389
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
20358
20390
  });};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++);}};//模型文件
20359
20391
  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
20360
- 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()
20392
+ 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()
20361
20393
  });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) {
20362
20394
  //
20363
20395
  // const metaModelId = sceneModel.id;
@@ -20696,7 +20728,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
20696
20728
  *
20697
20729
  * @param {String} subId Subscription ID
20698
20730
  */},{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
20699
- }}}]);}();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];});}/**
20731
+ }}}]);}();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];});}/**
20700
20732
  * @desc Abstract base class for curve classes.
20701
20733
  */var Curve=/*#__PURE__*/function(_Component28){/**
20702
20734
  * @constructor
@@ -20841,7 +20873,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20841
20873
  * 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.
20842
20874
  *
20843
20875
  * @param {{t:Number, eye:Object, look:Object, up: Object}[]} frames Frames to add to this CameraPath.
20844
- */},{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);}}/**
20876
+ */},{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);}}/**
20845
20877
  * Sets the position of the {@link Camera} to a position interpolated within this CameraPath at the given time instant.
20846
20878
  *
20847
20879
  * @param {Number} t Time instant.
@@ -20857,7 +20889,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
20857
20889
  * when animated by {@link CameraPathAnimation}, the {@link Camera} will move along the path at a constant rate.
20858
20890
  *
20859
20891
  * @param {Number} duration The total duration for this CameraPath.
20860
- */},{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;}}/**
20892
+ */},{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;}}/**
20861
20893
  * Removes all frames from this CameraPath.
20862
20894
  */},{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();/**
20863
20895
  * @desc Jumps or flies the {@link Scene}'s {@link Camera} to a given target.
@@ -21551,7 +21583,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
21551
21583
  * @param {Number} [cfg.size=1] Dimension on the X and Z-axis.
21552
21584
  * @param {Number} [cfg.divisions=1] Number of divisions on X and Z axis..
21553
21585
  * @returns {Object} Configuration for a {@link Geometry} subtype.
21554
- */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});}/**
21586
+ */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});}/**
21555
21587
  * @desc Creates a plane-shaped {@link Geometry}.
21556
21588
  *
21557
21589
  * ## Usage
@@ -23373,7 +23405,7 @@ v edgeBias: 0.2,
23373
23405
  * @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.
23374
23406
  * @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
23375
23407
  * @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
23376
- */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
23408
+ */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
23377
23409
  });_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;}/**
23378
23410
  * Sets if this ````LineSet```` is visible.
23379
23411
  *
@@ -23596,7 +23628,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
23596
23628
  * @returns {Boolean} ````true```` if this PointLight casts shadows.
23597
23629
  */function get(){return this._state.castsShadow;}/**
23598
23630
  * Destroys this PointLight.
23599
- */,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;}/**
23631
+ */,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;}/**
23600
23632
  * @desc A cube texture map.
23601
23633
  */var CubeTexture=/*#__PURE__*/function(_Component36){/**
23602
23634
  * @constructor
@@ -23613,7 +23645,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
23613
23645
  // this._state.texture.setImage(this._images, this._state);
23614
23646
  // this._state.texture.setProps(this._state);
23615
23647
  // } else
23616
- 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);}}/**
23648
+ 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);}}/**
23617
23649
  * Destroys this CubeTexture
23618
23650
  *
23619
23651
  */},{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);/**
@@ -23969,14 +24001,14 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
23969
24001
  * @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
23970
24002
  * @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
23971
24003
  * @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
23972
- */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++;}}/**
24004
+ */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++;}}/**
23973
24005
  * Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.
23974
24006
  *
23975
24007
  * Assumes that the model has not been destroyed or modified since saving.
23976
24008
  *
23977
24009
  * @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.
23978
24010
  * @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.
23979
- */},{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];}}}}]);}();/**
24011
+ */},{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];}}}}]);}();/**
23980
24012
  * @desc A {@link Curve} along which a 3D position can be animated.
23981
24013
  *
23982
24014
  * * As shown in the diagram below, a CubicBezierCurve is defined by four control points.
@@ -24456,7 +24488,7 @@ mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;case 2:// M
24456
24488
  mouseDownLeft=false;mouseDownMiddle=false;mouseDownRight=false;break;case 3:// Right button
24457
24489
  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
24458
24490
  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
24459
- 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()};/**
24491
+ 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()};/**
24460
24492
  * @private
24461
24493
  */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);}}]);}();/**
24462
24494
  * @private
@@ -24523,13 +24555,13 @@ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePick
24523
24555
  // }
24524
24556
  },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;}}}]);}();/**
24525
24557
  * @private
24526
- */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;//-------------------------------------------------------------------------------------------------
24558
+ */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;//-------------------------------------------------------------------------------------------------
24527
24559
  // Keyboard rotation
24528
24560
  //-------------------------------------------------------------------------------------------------
24529
24561
  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();}}}//-------------------------------------------------------------------------------------------------
24530
24562
  // Keyboard panning
24531
24563
  //-------------------------------------------------------------------------------------------------
24532
- 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
24564
+ 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
24533
24565
  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
24534
24566
  var EPSILON=0.001;var tempVec3=math.vec3();/**
24535
24567
  * Handles camera updates on each "tick" that were scheduled by the various controllers.
@@ -24573,7 +24605,7 @@ if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEn
24573
24605
  * @private
24574
24606
  */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);
24575
24607
  pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
24576
- }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
24608
+ }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
24577
24609
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
24578
24610
  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
24579
24611
  // We don't want to rotate in this case (weird behavior)
@@ -24598,7 +24630,7 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
24598
24630
  // }
24599
24631
  }}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
24600
24632
  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
24601
- 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;};/**
24633
+ 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;};/**
24602
24634
  * @private
24603
24635
  */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
24604
24636
  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
@@ -24607,7 +24639,7 @@ controllers.cameraFlight.flyTo({aabb:aabb});}};this.canvas.addEventListener("tou
24607
24639
  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
24608
24640
  pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);states.longTouchTimeout=null;},configs.longTapTimeout);//////////
24609
24641
  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;}///////////
24610
- 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
24642
+ 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
24611
24643
  if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&&currentTime-tapStartTime<TAP_INTERVAL){// Double-tap
24612
24644
  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);
24613
24645
  cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("doublePickedSurface", pickController.pickResult);
@@ -24615,7 +24647,7 @@ cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(con
24615
24647
  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);
24616
24648
  cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("pickedSurface", pickController.pickResult);
24617
24649
  cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{// cameraControl.fire("pickedNothing");
24618
- 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
24650
+ 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
24619
24651
  // tapStartTime = -1;
24620
24652
  // lastTapTime = -1;
24621
24653
  }},{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;/**
@@ -25175,10 +25207,10 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25175
25207
  */_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;}/**
25176
25208
  * 设置漫游移动速率
25177
25209
  * @param {number} rate
25178
- */},{key:"moveRate",set:function set(rate){this._moveRate=rate;}/**
25210
+ */},{key:"moveRate",get:function get(){return this._moveRate;}/**
25179
25211
  * 漫游向右
25180
25212
  * @param {boolean} go
25181
- */},{key:"goRight",set:function set(go){this._goRight=go;}/**
25213
+ */,set:function set(rate){this._moveRate=rate;}},{key:"goRight",set:function set(go){this._goRight=go;}/**
25182
25214
  * 漫游向左
25183
25215
  * @param {boolean} go
25184
25216
  */},{key:"goLeft",set:function set(go){this._goLeft=go;}/**
@@ -25210,7 +25242,7 @@ return;}if(_this126._goRight){_this126._updates.panDeltaX+=-0.1*_this126._moveRa
25210
25242
  * @param keyDownMap
25211
25243
  * @private
25212
25244
  */,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"
25213
- 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;}/**
25245
+ 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;}/**
25214
25246
  * Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
25215
25247
  *
25216
25248
  * See class comments for an example.
@@ -25307,7 +25339,7 @@ case"qwerty":keyMap[this.PAN_LEFT]=[input.KEY_A];keyMap[this.PAN_RIGHT]=[input.K
25307
25339
  * See class comments for more info.
25308
25340
  *
25309
25341
  * @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
25310
- */,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:/**
25342
+ */,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:/**
25311
25343
  * Sets whether the {@link Camera} follows the mouse/touch pointer.
25312
25344
  *
25313
25345
  * In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
@@ -25697,7 +25729,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
25697
25729
  */function get(){return this._configs.doubleClickTimeFrame;}/**
25698
25730
  * Destroys this ````CameraControl````.
25699
25731
  * @private
25700
- */,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);/**
25732
+ */,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);/**
25701
25733
  * @desc Metadata corresponding to a {@link Scene}.
25702
25734
  *
25703
25735
  * * Located in {@link Viewer#metaScene}.
@@ -25746,7 +25778,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
25746
25778
  *
25747
25779
  * @param {String} event Event name
25748
25780
  * @param {Object} value Event parameters
25749
- */},{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);}}}/**
25781
+ */},{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);}}}/**
25750
25782
  * Unsubscribes from an event fired at this Viewer.
25751
25783
  * @param event
25752
25784
  */},{key:"off",value:function off(event){// TODO
@@ -25777,12 +25809,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
25777
25809
  *
25778
25810
  * @param {String} metaModelId ID of the target {@link MetaModel}.
25779
25811
  */},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
25780
- 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
25812
+ 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
25781
25813
  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
25782
- 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
25814
+ 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
25783
25815
  delete this.metaObjects[id];if(!metaObject.parent){delete this.rootMetaObjects[id];}}}}// Re-link entire MetaObject parent/child hierarchy
25784
25816
  for(var objectId in this.metaObjects){var _metaObject=this.metaObjects[objectId];if(_metaObject.children){_metaObject.children=[];}// Re-link each MetaObject's property sets
25785
- 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
25817
+ 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
25786
25818
  // for (let objectId in this.metaObjects) {
25787
25819
  // const metaObject = this.metaObjects[objectId];
25788
25820
  // metaObject.metaModels = [];
@@ -25804,7 +25836,7 @@ this.fire("metaModelDestroyed",metaModelId);}/**
25804
25836
  *
25805
25837
  * @param {String[]} types The array of type name.
25806
25838
  * @returns {String[]} Array of {@link MetaObject#id}s.
25807
- */},{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;}/**
25839
+ */},{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;}/**
25808
25840
  * Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the given subtree.
25809
25841
  *
25810
25842
  * @param {String} id ID of the root {@link MetaObject} of the given subtree.
@@ -26265,7 +26297,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26265
26297
  *
26266
26298
  * @param {String} event Event name
26267
26299
  * @param {Object} value Event parameters
26268
- */},{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);}}}/**
26300
+ */},{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);}}}/**
26269
26301
  * Unsubscribes from an event fired at this Viewer.
26270
26302
  * @param event
26271
26303
  */},{key:"off",value:function off(event){// TODO
@@ -26285,12 +26317,12 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26285
26317
  * Uninstalls a Plugin, clearing content from it first.
26286
26318
  *
26287
26319
  * @private
26288
- */},{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;}}}/**
26320
+ */},{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;}}}/**
26289
26321
  * Sends a message to installed Plugins.
26290
26322
  *
26291
26323
  * The message can optionally be accompanied by a value.
26292
26324
  * @private
26293
- */},{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);}}}/**
26325
+ */},{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);}}}/**
26294
26326
  * @private
26295
26327
  * @deprecated
26296
26328
  */},{key:"clear",value:function clear(){throw'Viewer#clear() no longer implemented - use \'#sendToPlugins("clear") instead';}/**
@@ -26321,7 +26353,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26321
26353
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
26322
26354
  * @returns {String} String-encoded image data URI.
26323
26355
  */},{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
26324
- }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;}/**
26356
+ }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;}/**
26325
26357
  * Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
26326
26358
  * the HTML elements created by various plugins.
26327
26359
  *
@@ -26346,7 +26378,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26346
26378
  * @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
26347
26379
  * @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
26348
26380
  * @returns {Promise} Promise which returns a string-encoded image data URI.
26349
- */},{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
26381
+ */},{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
26350
26382
  // HTMLCanvas element, scaled to the target snapshot size, then
26351
26383
  // use html2canvas to render each plugin's container element into
26352
26384
  // that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
@@ -26356,8 +26388,8 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
26356
26388
  // canvas ourselves, in order to allow the Viewer to render the
26357
26389
  // right amount of pixels, for a sharper image.
26358
26390
  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
26359
- }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
26360
- 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;}()/**
26391
+ }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
26392
+ 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;}()/**
26361
26393
  * Exits snapshot mode.
26362
26394
  *
26363
26395
  * Switches rendering back to the main canvas.
@@ -26365,7 +26397,7 @@ plugin=this._plugins[_i512];if(plugin.getContainerElement){containerElement=plug
26365
26397
  */)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
26366
26398
  * Destroys this Viewer.
26367
26399
  */},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
26368
- 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);}}]);}();/**
26400
+ 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);}}]);}();/**
26369
26401
  * {@link Viewer} plugin that uses [web-ifc](https://github.com/tomvandig/web-ifc) to load BIM models directly from IFC files.
26370
26402
  *
26371
26403
  * <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>
@@ -26874,7 +26906,7 @@ return _this128;}/**
26874
26906
  * primitives. Only works while {@link DTX#enabled} is also ````true````.
26875
26907
  * @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}.
26876
26908
  */},{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
26877
- }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", () => {
26909
+ }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", () => {
26878
26910
  // try {
26879
26911
  // if (params.src) {
26880
26912
  // this._loadModel(params.src, params, options, sceneModel);
@@ -26887,9 +26919,9 @@ return _this128;}/**
26887
26919
  // }
26888
26920
  // });
26889
26921
  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) {},
26890
- 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
26922
+ 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
26891
26923
  sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
26892
- });}},{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?
26924
+ });}},{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?
26893
26925
  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
26894
26926
  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
26895
26927
  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