@xtctwins/tctwins-bimx-viewer 0.1.18 → 0.1.20
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.
|
@@ -2191,7 +2191,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
|
|
|
2191
2191
|
* Default value is ````[0,0,0]````.
|
|
2192
2192
|
*
|
|
2193
2193
|
* @type {Number[]}
|
|
2194
|
-
*/,set:function set(offset){if(offset){this._offset[0]=offset[0];this._offset[1]=offset[1];this._offset[2]=offset[2];}else{this._offset[0]=0;this._offset[1]=0;this._offset[2]=0;}for(var _i28=0,len=this.meshes.length;_i28<len;_i28++){this.meshes[_i28]._setOffset(this._offset);}this._aabbDirty=true;this.model._aabbDirty=true;this.scene._aabbDirty=true;this.scene._objectOffsetUpdated(this,offset);this.model.glRedraw();}},{key:"saoEnabled",get:function get(){return this.model.saoEnabled;}},{key:"getEachVertex",value:function getEachVertex(callback){for(var _i29=0,len=this.meshes.length;_i29<len;_i29++){this.meshes[_i29].getEachVertex(callback);}}},{key:"_getFlag",value:function _getFlag(flag){return!!(this._flags&flag);}},{key:"_finalize",value:function _finalize(){var scene=this.model.scene;if(this._isObject){if(this.visible){scene._objectVisibilityUpdated(this);}if(this.highlighted){scene._objectHighlightedUpdated(this);}if(this.xrayed){scene._objectXRayedUpdated(this);}if(this.selected){scene._objectSelectedUpdated(this);}}for(var _i30=0,len=this.meshes.length;_i30<len;_i30++){this.meshes[_i30]._finalize(this._flags);}}},{key:"_finalize2",value:function _finalize2(){for(var _i31=0,len=this.meshes.length;_i31<len;_i31++){this.meshes[_i31]._finalize2();}}},{key:"_destroy",value:function _destroy(){var scene=this.model.scene;if(this._isObject){scene._deregisterObject(this);if(this.visible){scene._deRegisterVisibleObject(this);}if(this.xrayed){scene._deRegisterXRayedObject(this);}if(this.selected){scene._deRegisterSelectedObject(this);}if(this.highlighted){scene._deRegisterHighlightedObject(this);}if(this._colorizeUpdated){this.scene._deRegisterColorizedObject(this);}if(this._opacityUpdated){this.scene._deRegisterOpacityObject(this);}if(this._offset&&(this._offset[0]!==0||this._offset[1]!==0||this._offset[2]!==0)){this.scene._deRegisterOffsetObject(this);}}for(var _i32=0,len=this.meshes.length;_i32<len;_i32++){this.meshes[_i32]._destroy();}scene._aabbDirty=true;}}]);}();var tempVec4a$
|
|
2194
|
+
*/,set:function set(offset){if(offset){this._offset[0]=offset[0];this._offset[1]=offset[1];this._offset[2]=offset[2];}else{this._offset[0]=0;this._offset[1]=0;this._offset[2]=0;}for(var _i28=0,len=this.meshes.length;_i28<len;_i28++){this.meshes[_i28]._setOffset(this._offset);}this._aabbDirty=true;this.model._aabbDirty=true;this.scene._aabbDirty=true;this.scene._objectOffsetUpdated(this,offset);this.model.glRedraw();}},{key:"saoEnabled",get:function get(){return this.model.saoEnabled;}},{key:"getEachVertex",value:function getEachVertex(callback){for(var _i29=0,len=this.meshes.length;_i29<len;_i29++){this.meshes[_i29].getEachVertex(callback);}}},{key:"_getFlag",value:function _getFlag(flag){return!!(this._flags&flag);}},{key:"_finalize",value:function _finalize(){var scene=this.model.scene;if(this._isObject){if(this.visible){scene._objectVisibilityUpdated(this);}if(this.highlighted){scene._objectHighlightedUpdated(this);}if(this.xrayed){scene._objectXRayedUpdated(this);}if(this.selected){scene._objectSelectedUpdated(this);}}for(var _i30=0,len=this.meshes.length;_i30<len;_i30++){this.meshes[_i30]._finalize(this._flags);}}},{key:"_finalize2",value:function _finalize2(){for(var _i31=0,len=this.meshes.length;_i31<len;_i31++){this.meshes[_i31]._finalize2();}}},{key:"_destroy",value:function _destroy(){var scene=this.model.scene;if(this._isObject){scene._deregisterObject(this);if(this.visible){scene._deRegisterVisibleObject(this);}if(this.xrayed){scene._deRegisterXRayedObject(this);}if(this.selected){scene._deRegisterSelectedObject(this);}if(this.highlighted){scene._deRegisterHighlightedObject(this);}if(this._colorizeUpdated){this.scene._deRegisterColorizedObject(this);}if(this._opacityUpdated){this.scene._deRegisterOpacityObject(this);}if(this._offset&&(this._offset[0]!==0||this._offset[1]!==0||this._offset[2]!==0)){this.scene._deRegisterOffsetObject(this);}}for(var _i32=0,len=this.meshes.length;_i32<len;_i32++){this.meshes[_i32]._destroy();}scene._aabbDirty=true;}}]);}();var tempVec4a$7=math.vec4();var tempVec4b$4=math.vec4();/**
|
|
2195
2195
|
* @desc Tracks the World, View and Canvas coordinates, and visibility, of a position within a {@link Scene}.
|
|
2196
2196
|
*
|
|
2197
2197
|
* ## Position
|
|
@@ -2305,7 +2305,7 @@ if(lastOpacityQuantized===opacityQuantized){return;}}else{opacityQuantized=255.0
|
|
|
2305
2305
|
* @param {Boolean} [cfg.occludable=false] Indicates whether or not this Marker is hidden (ie. {@link Marker#visible} is ````false```` whenever occluded by {@link Entity}s in the {@link Scene}.
|
|
2306
2306
|
* @param {Number[]} [cfg.worldPos=[0,0,0]] World-space 3D Marker position.
|
|
2307
2307
|
*/function Marker(owner,cfg){var _this5;_classCallCheck(this,Marker);_this5=_callSuper(this,Marker,[owner,cfg]);_this5._entity=null;_this5._visible=null;_this5._worldPos=math.vec3();_this5._origin=math.vec3();_this5._rtcPos=math.vec3();_this5._viewPos=math.vec3();_this5._canvasPos=math.vec2();_this5._occludable=false;_this5._onCameraViewMatrix=_this5.scene.camera.on("matrix",function(){_this5._viewPosDirty=true;_this5._needUpdate();});_this5._onCameraProjMatrix=_this5.scene.camera.on("projMatrix",function(){_this5._canvasPosDirty=true;_this5._needUpdate();});_this5._onEntityDestroyed=null;_this5._onEntityModelDestroyed=null;_this5._renderer.addMarker(_this5);_this5.entity=cfg.entity;_this5.worldPos=cfg.worldPos;_this5.occludable=cfg.occludable;return _this5;}_inherits(Marker,_Component);return _createClass(Marker,[{key:"_update",value:function _update(){// this._needUpdate() schedules this for next tick
|
|
2308
|
-
if(this._viewPosDirty){math.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos);this._viewPosDirty=false;this._canvasPosDirty=true;this.fire("viewPos",this._viewPos);}if(this._canvasPosDirty){tempVec4a$
|
|
2308
|
+
if(this._viewPosDirty){math.transformPoint3(this.scene.camera.viewMatrix,this._worldPos,this._viewPos);this._viewPosDirty=false;this._canvasPosDirty=true;this.fire("viewPos",this._viewPos);}if(this._canvasPosDirty){tempVec4a$7.set(this._viewPos);tempVec4a$7[3]=1.0;math.transformPoint4(this.scene.camera.projMatrix,tempVec4a$7,tempVec4b$4);var aabb=this.scene.canvas.boundary;this._canvasPos[0]=Math.floor((1+tempVec4b$4[0]/tempVec4b$4[3])*aabb[2]/2);this._canvasPos[1]=Math.floor((1-tempVec4b$4[1]/tempVec4b$4[3])*aabb[3]/2);this._canvasPosDirty=false;this.fire("canvasPos",this._canvasPos);}}},{key:"_setVisible",value:function _setVisible(visible){// Called by VisibilityTester and this._entity.on("destroyed"..)
|
|
2309
2309
|
if(this._visible===visible);this._visible=visible;this.fire("visible",this._visible);}/**
|
|
2310
2310
|
* Sets the {@link Entity} this Marker is associated with.
|
|
2311
2311
|
*
|
|
@@ -4698,7 +4698,8 @@ _this30._lodManagerList[_i44].resetLodCulling();}}sceneTick++;});}/**
|
|
|
4698
4698
|
if(cfg.elementId){// Custom spinner element supplied
|
|
4699
4699
|
_this31._element=document.getElementById(cfg.elementId);if(!_this31._element){_this31._createDefaultSpinner(cfg.elementId);}else{_this31._adjustPosition();}}else{_this31._createDefaultSpinner("engine_spinner");}_this31.processes=0;return _this31;}_inherits(Spinner,_Component7);return _createClass(Spinner,[{key:"type",get:/**
|
|
4700
4700
|
@private
|
|
4701
|
-
*/function get(){return"Spinner";}},{key:"visible",get:function get(){return this._element.style["visibility"]==="visible";},set:function set(visible){visible?this._element.style["visibility"]="visible":this._element.style["visibility"]="hidden";}/** @private */},{key:"_createDefaultSpinner",value:function _createDefaultSpinner(elementId){console.log("_createDefaultSpinner");
|
|
4701
|
+
*/function get(){return"Spinner";}},{key:"visible",get:function get(){return this._element.style["visibility"]==="visible";},set:function set(visible){visible?this._element.style["visibility"]="visible":this._element.style["visibility"]="hidden";}/** @private */},{key:"_createDefaultSpinner",value:function _createDefaultSpinner(elementId){// console.log("_createDefaultSpinner");
|
|
4702
|
+
this._injectDefaultCSS();var element=document.createElement("div");element.setAttribute("id",elementId);var style=element.style;style["z-index"]="9000";style.position="absolute";element.innerHTML='<div class="sk-fading-circle">\
|
|
4702
4703
|
<div class="sk-circle1 sk-circle"></div>\
|
|
4703
4704
|
<div class="sk-circle2 sk-circle"></div>\
|
|
4704
4705
|
<div class="sk-circle3 sk-circle"></div>\
|
|
@@ -6709,7 +6710,7 @@ _this42.left=cfg.left;_this42.right=cfg.right;_this42.bottom=cfg.bottom;_this42.
|
|
|
6709
6710
|
* @param {Number[]} worldPos Outputs un-projected 3D World-space coordinates.
|
|
6710
6711
|
*/},{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
|
|
6711
6712
|
*
|
|
6712
|
-
*/},{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$
|
|
6713
|
+
*/},{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();/**
|
|
6713
6714
|
* @desc Manages viewing and projection transforms for its {@link Scene}.
|
|
6714
6715
|
*
|
|
6715
6716
|
* * One Camera per {@link Scene}
|
|
@@ -7151,7 +7152,7 @@ this.fire("dirty");this.fire("projection",this._projectionType);this.fire("projM
|
|
|
7151
7152
|
*
|
|
7152
7153
|
* @param {[number, number, number]} worldPos
|
|
7153
7154
|
* @returns {[number, number]} the canvas position
|
|
7154
|
-
*/},{key:"projectWorldPos",value:function projectWorldPos(worldPos){var _worldPos=tempVec4a$
|
|
7155
|
+
*/},{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;}/**
|
|
7155
7156
|
* Destroys this Camera.
|
|
7156
7157
|
*/},{key:"destroy",value:function destroy(){_superPropGet(Camera,"destroy",this,3)([]);this._state.destroy();}}]);}(Component);/**
|
|
7157
7158
|
* @desc A dynamic light source within a {@link Scene}.
|
|
@@ -15355,7 +15356,7 @@ best=oct=octEncodeVec3(worldNormal,"floor","floor");dec=octDecodeVec2(oct);curre
|
|
|
15355
15356
|
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))]);}/**
|
|
15356
15357
|
* @private
|
|
15357
15358
|
*/function octDecodeVec2(oct){// Decode an oct-encoded normal
|
|
15358
|
-
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$
|
|
15359
|
+
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();/**
|
|
15359
15360
|
* @private
|
|
15360
15361
|
*/var VBOBatchingTrianglesLayer=/*#__PURE__*/function(){/**
|
|
15361
15362
|
* @param model
|
|
@@ -15369,7 +15370,8 @@ 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
|
|
|
15369
15370
|
* @param cfg.scratchMemory
|
|
15370
15371
|
* @param cfg.textureSet
|
|
15371
15372
|
* @param cfg.solid
|
|
15372
|
-
*/function VBOBatchingTrianglesLayer(cfg){_classCallCheck(this,VBOBatchingTrianglesLayer)
|
|
15373
|
+
*/function VBOBatchingTrianglesLayer(cfg){_classCallCheck(this,VBOBatchingTrianglesLayer);// console.info("Creating VBOBatchingTrianglesLayer");
|
|
15374
|
+
/**
|
|
15373
15375
|
* Owner model
|
|
15374
15376
|
* @type {VBOSceneModel}
|
|
15375
15377
|
*/this.model=cfg.model;/**
|
|
@@ -15429,7 +15431,7 @@ var flagsLength=buffer.positions.length/3;var flags=new Float32Array(flagsLength
|
|
|
15429
15431
|
* 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.
|
|
15430
15432
|
*/},{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
|
|
15431
15433
|
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
|
|
15432
|
-
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$
|
|
15434
|
+
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 -----------------------------------
|
|
15433
15435
|
},{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 --------------
|
|
15434
15436
|
},{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
|
|
15435
15437
|
}}},{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
|
|
@@ -15594,7 +15596,7 @@ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:func
|
|
|
15594
15596
|
if(!this._silhouetteRenderer){// Used for highlighting and selection
|
|
15595
15597
|
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={};/**
|
|
15596
15598
|
* @private
|
|
15597
|
-
*/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$
|
|
15599
|
+
*/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);/**
|
|
15598
15600
|
* @private
|
|
15599
15601
|
*/var VBOInstancingTrianglesLayer=/*#__PURE__*/function(){/**
|
|
15600
15602
|
* @param cfg
|
|
@@ -15603,7 +15605,8 @@ this._silhouetteRenderer=new TrianglesSilhouetteRenderer(this._scene);}if(!this.
|
|
|
15603
15605
|
* @param cfg.geometry
|
|
15604
15606
|
* @param cfg.textureSet
|
|
15605
15607
|
* @param cfg.origin
|
|
15606
|
-
*/function VBOInstancingTrianglesLayer(cfg){_classCallCheck(this,VBOInstancingTrianglesLayer)
|
|
15608
|
+
*/function VBOInstancingTrianglesLayer(cfg){_classCallCheck(this,VBOInstancingTrianglesLayer);// console.info("Creating VBOInstancingTrianglesLayer");
|
|
15609
|
+
/**
|
|
15607
15610
|
* Owner model
|
|
15608
15611
|
* @type {VBOSceneModel}
|
|
15609
15612
|
*/this.model=cfg.model;/**
|
|
@@ -15691,7 +15694,7 @@ if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8
|
|
|
15691
15694
|
/**
|
|
15692
15695
|
* 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.
|
|
15693
15696
|
*/},{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
|
|
15694
|
-
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$
|
|
15697
|
+
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";}////////////////////////////////////////
|
|
15695
15698
|
// TODO: Update portion matrix
|
|
15696
15699
|
////////////////////////////////////////
|
|
15697
15700
|
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 -----------------------------------
|
|
@@ -15767,7 +15770,8 @@ this.positions=[];this.colors=[];this.offsets=[];this.indices=[];});/**
|
|
|
15767
15770
|
* @param cfg.maxGeometryBatchSize
|
|
15768
15771
|
* @param cfg.origin
|
|
15769
15772
|
* @param cfg.scratchMemory
|
|
15770
|
-
*/function VBOBatchingLinesLayer(cfg){_classCallCheck(this,VBOBatchingLinesLayer)
|
|
15773
|
+
*/function VBOBatchingLinesLayer(cfg){_classCallCheck(this,VBOBatchingLinesLayer);// console.info("Creating VBOBatchingLinesLayer");
|
|
15774
|
+
/**
|
|
15771
15775
|
* Index of this LinesBatchingLayer in {@link VBOSceneModel#_layerList}.
|
|
15772
15776
|
* @type {Number}
|
|
15773
15777
|
*/this.layerIndex=cfg.layerIndex;this._renderers=getRenderers$5(cfg.model.scene);this.model=cfg.model;this._buffer=new VBOBatchingLinesBuffer(cfg.maxGeometryBatchSize);this._scratchMemory=cfg.scratchMemory;this._state=new RenderState({positionsBuf:null,offsetsBuf:null,colorsBuf:null,flagsBuf:null,indicesBuf:null,positionsDecodeMatrix:math.mat4(),origin:null});// These counts are used to avoid unnecessary render passes
|
|
@@ -15877,52 +15881,53 @@ function getSnapInstancingRenderers(scene) {
|
|
|
15877
15881
|
*/var tempUint8Vec4$1=new Uint8Array(4);var tempFloat32$1=new Float32Array(1);var tempVec3fa$1=new Float32Array(3);var tempFloat32Vec4$1=new Float32Array(4);/**
|
|
15878
15882
|
* @private
|
|
15879
15883
|
*/var VBOInstancingLinesLayer=/*#__PURE__*/function(){/**
|
|
15880
|
-
|
|
15881
|
-
|
|
15882
|
-
|
|
15883
|
-
|
|
15884
|
-
|
|
15885
|
-
|
|
15886
|
-
|
|
15887
|
-
|
|
15888
|
-
|
|
15889
|
-
|
|
15890
|
-
|
|
15891
|
-
|
|
15892
|
-
|
|
15893
|
-
|
|
15894
|
-
|
|
15895
|
-
|
|
15896
|
-
|
|
15897
|
-
|
|
15898
|
-
|
|
15884
|
+
* @param cfg
|
|
15885
|
+
* @param cfg.layerIndex
|
|
15886
|
+
* @param cfg.model
|
|
15887
|
+
* @param cfg.geometry
|
|
15888
|
+
* @param cfg.material
|
|
15889
|
+
* @param cfg.origin
|
|
15890
|
+
*/function VBOInstancingLinesLayer(cfg){_classCallCheck(this,VBOInstancingLinesLayer);// console.info("VBOInstancingLinesLayer");
|
|
15891
|
+
/**
|
|
15892
|
+
* Owner model
|
|
15893
|
+
* @type {VBOSceneModel}
|
|
15894
|
+
*/this.model=cfg.model;/**
|
|
15895
|
+
* Shared material
|
|
15896
|
+
* @type {VBOSceneModelGeometry}
|
|
15897
|
+
*/this.material=cfg.material;/**
|
|
15898
|
+
* State sorting key.
|
|
15899
|
+
* @type {string}
|
|
15900
|
+
*/this.sortId="LinesInstancingLayer";/**
|
|
15901
|
+
* Index of this InstancingLayer in VBOSceneModel#_layerList
|
|
15902
|
+
* @type {Number}
|
|
15903
|
+
*/this.layerIndex=cfg.layerIndex;this._renderers=getRenderers$4(cfg.model.scene);this._aabb=math.collapseAABB3();this._state=new RenderState({obb:math.OBB3(),numInstances:0,origin:null,geometry:cfg.geometry,positionsDecodeMatrix:cfg.geometry.positionsDecodeMatrix,// So we can null the geometry for GC
|
|
15899
15904
|
positionsBuf:null,colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null});// These counts are used to avoid unnecessary render passes
|
|
15900
15905
|
this._numPortions=0;this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numSelectedLayerPortions=0;this._numClippableLayerPortions=0;this._numEdgesLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;/** @private */this.numIndices=cfg.geometry.numIndices;// Vertex arrays
|
|
15901
15906
|
this._colors=[];this._offsets=[];// Modeling matrix per instance, array for each column
|
|
15902
15907
|
this._modelMatrixCol0=[];this._modelMatrixCol1=[];this._modelMatrixCol2=[];this._portions=[];this._meshes=[];this._aabb=math.collapseAABB3();this.aabbDirty=true;if(cfg.origin){this._state.origin=math.vec3(cfg.origin);}this._finalized=false;}return _createClass(VBOInstancingLinesLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i283=0,len=this._meshes.length;_i283<len;_i283++){math.expandAABB3(this._aabb,this._meshes[_i283].aabb);}this.aabbDirty=false;}return this._aabb;}/**
|
|
15903
|
-
|
|
15904
|
-
|
|
15905
|
-
|
|
15906
|
-
|
|
15907
|
-
|
|
15908
|
-
|
|
15909
|
-
|
|
15910
|
-
|
|
15911
|
-
|
|
15912
|
-
|
|
15913
|
-
|
|
15914
|
-
|
|
15915
|
-
|
|
15908
|
+
* Creates a new portion within this InstancingLayer, returns the new portion ID.
|
|
15909
|
+
*
|
|
15910
|
+
* The portion will instance this InstancingLayer's geometry.
|
|
15911
|
+
*
|
|
15912
|
+
* Gives the portion the specified color and matrix.
|
|
15913
|
+
*
|
|
15914
|
+
* @param mesh The SceneModelMesh that owns the portion
|
|
15915
|
+
* @param cfg Portion params
|
|
15916
|
+
* @param cfg.color Color [0..255,0..255,0..255]
|
|
15917
|
+
* @param cfg.opacity Opacity [0..255].
|
|
15918
|
+
* @param cfg.meshMatrix Flat float 4x4 matrix.
|
|
15919
|
+
* @returns {number} Portion ID.
|
|
15920
|
+
*/},{key:"createPortion",value:function createPortion(mesh,cfg){var color=cfg.color;var opacity=cfg.opacity;var meshMatrix=cfg.meshMatrix;if(this._finalized){throw"Already finalized";}var r=color[0];// Color is pre-quantized by VBOSceneModel
|
|
15916
15921
|
var g=color[1];var b=color[2];color[3];this._colors.push(r);this._colors.push(g);this._colors.push(b);this._colors.push(opacity);if(this.model.scene.entityOffsetsEnabled){this._offsets.push(0);this._offsets.push(0);this._offsets.push(0);}this._modelMatrixCol0.push(meshMatrix[0]);this._modelMatrixCol0.push(meshMatrix[4]);this._modelMatrixCol0.push(meshMatrix[8]);this._modelMatrixCol0.push(meshMatrix[12]);this._modelMatrixCol1.push(meshMatrix[1]);this._modelMatrixCol1.push(meshMatrix[5]);this._modelMatrixCol1.push(meshMatrix[9]);this._modelMatrixCol1.push(meshMatrix[13]);this._modelMatrixCol2.push(meshMatrix[2]);this._modelMatrixCol2.push(meshMatrix[6]);this._modelMatrixCol2.push(meshMatrix[10]);this._modelMatrixCol2.push(meshMatrix[14]);this._state.numInstances++;var portionId=this._portions.length;this._portions.push({});this._numPortions++;this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"finalize",value:function finalize(){if(this._finalized){throw"Already finalized";}var gl=this.model.scene.canvas.gl;var state=this._state;var geometry=state.geometry;var colorsLength=this._colors.length;var flagsLength=colorsLength/4;if(colorsLength>0){var notNormalized=false;this._state.colorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Uint8Array(this._colors),this._colors.length,4,gl.DYNAMIC_DRAW,notNormalized);this._colors=[];// Release memory
|
|
15917
|
-
}if(flagsLength>0){// Because we only build flags arrays here,
|
|
15922
|
+
}if(flagsLength>0){// Because we only build flags arrays here,
|
|
15918
15923
|
// get their length from the colors array
|
|
15919
15924
|
var _notNormalized6=false;this._state.flagsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(flagsLength),flagsLength,1,gl.DYNAMIC_DRAW,_notNormalized6);}if(this.model.scene.entityOffsetsEnabled){if(this._offsets.length>0){var _notNormalized7=false;this._state.offsetsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,gl.DYNAMIC_DRAW,_notNormalized7);this._offsets=[];// Release memory
|
|
15920
15925
|
}}if(geometry.colorsCompressed&&geometry.colorsCompressed.length>0){var colorsCompressed=new Uint8Array(geometry.colorsCompressed);var _notNormalized8=false;state.colorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,colorsCompressed,colorsCompressed.length,4,gl.STATIC_DRAW,_notNormalized8);}if(geometry.positionsCompressed&&geometry.positionsCompressed.length>0){var normalized=false;state.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,geometry.positionsCompressed,geometry.positionsCompressed.length,3,gl.STATIC_DRAW,normalized);state.positionsDecodeMatrix=math.mat4(geometry.positionsDecodeMatrix);}if(geometry.indices&&geometry.indices.length>0){state.indicesBuf=new ArrayBuf(gl,gl.ELEMENT_ARRAY_BUFFER,new Uint32Array(geometry.indices),geometry.indices.length,1,gl.STATIC_DRAW);state.numIndices=geometry.indices.length;}if(this._modelMatrixCol0.length>0){var _normalized7=false;this._state.modelMatrixCol0Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,gl.STATIC_DRAW,_normalized7);this._state.modelMatrixCol1Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,gl.STATIC_DRAW,_normalized7);this._state.modelMatrixCol2Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,gl.STATIC_DRAW,_normalized7);this._modelMatrixCol0=[];this._modelMatrixCol1=[];this._modelMatrixCol2=[];}this._state.geometry=null;this._finalized=true;}// The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.
|
|
15921
15926
|
// It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
|
|
15922
15927
|
},{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setVisible",value:function setVisible(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setSelected",value:function setSelected(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setEdges",value:function setEdges(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}else{this._numEdgesLayerPortions--;this.model.numEdgesLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags(portionId,flags);}},{key:"setCollidable",value:function setCollidable(portionId,flags){if(!this._finalized){throw"Not finalized";}}},{key:"setPickable",value:function setPickable(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}else{this._numPickableLayerPortions--;this.model.numPickableLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setCulled",value:function setCulled(portionId,flags,meshTransparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}else{this._numCulledLayerPortions--;this.model.numCulledLayerPortions--;}this._setFlags(portionId,flags,meshTransparent);}},{key:"setColor",value:function setColor(portionId,color){// RGBA color is normalized as ints
|
|
15923
15928
|
if(!this._finalized){throw"Not finalized";}tempUint8Vec4$1[0]=color[0];tempUint8Vec4$1[1]=color[1];tempUint8Vec4$1[2]=color[2];tempUint8Vec4$1[3]=color[3];this._state.colorsBuf.setData(tempUint8Vec4$1,portionId*4,4);}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}/**
|
|
15924
|
-
|
|
15925
|
-
|
|
15929
|
+
* 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.
|
|
15930
|
+
*/},{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)?255:0;var vertFlag=0;vertFlag|=colorFlag;vertFlag|=silhouetteFlag<<4;vertFlag|=edgeFlag<<8;vertFlag|=pickFlag<<12;vertFlag|=clippableFlag<<16;tempFloat32$1[0]=vertFlag;this._state.flagsBuf.setData(tempFloat32$1,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
|
|
15926
15931
|
return;}tempVec3fa$1[0]=offset[0];tempVec3fa$1[1]=offset[1];tempVec3fa$1[2]=offset[2];this._state.offsetsBuf.setData(tempVec3fa$1,portionId*3,3);}},{key:"setMatrix",value:function setMatrix(portionId,matrix){////////////////////////////////////////
|
|
15927
15932
|
// TODO: Update portion matrix
|
|
15928
15933
|
////////////////////////////////////////
|
|
@@ -16005,7 +16010,8 @@ this.positions=[];this.colors=[];this.intensities=[];this.pickColors=[];this.off
|
|
|
16005
16010
|
* @param cfg.maxGeometryBatchSize
|
|
16006
16011
|
* @param cfg.origin
|
|
16007
16012
|
* @param cfg.scratchMemory
|
|
16008
|
-
*/function VBOBatchingPointsLayer(cfg){_classCallCheck(this,VBOBatchingPointsLayer)
|
|
16013
|
+
*/function VBOBatchingPointsLayer(cfg){_classCallCheck(this,VBOBatchingPointsLayer);// console.info("Creating VBOBatchingPointsLayer");
|
|
16014
|
+
/**
|
|
16009
16015
|
* Owner model
|
|
16010
16016
|
* @type {VBOSceneModel}
|
|
16011
16017
|
*/this.model=cfg.model;/**
|
|
@@ -16126,43 +16132,44 @@ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:func
|
|
|
16126
16132
|
*/function getRenderers$2(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$1[sceneId];if(!instancingRenderers){instancingRenderers=new VBOInstancingPointsRenderers(scene);cachedRenderers$1[sceneId]=instancingRenderers;instancingRenderers._compile();scene.on("compile",function(){instancingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers$1[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4=new Uint8Array(4);var tempFloat32=new Float32Array(1);var tempVec3fa=new Float32Array(3);var tempFloat32Vec4=new Float32Array(4);/**
|
|
16127
16133
|
* @private
|
|
16128
16134
|
*/var VBOInstancingPointsLayer=/*#__PURE__*/function(){/**
|
|
16129
|
-
|
|
16130
|
-
|
|
16131
|
-
|
|
16132
|
-
|
|
16133
|
-
|
|
16134
|
-
|
|
16135
|
-
|
|
16136
|
-
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
|
|
16142
|
-
|
|
16143
|
-
|
|
16144
|
-
|
|
16145
|
-
|
|
16146
|
-
|
|
16147
|
-
|
|
16135
|
+
* @param cfg
|
|
16136
|
+
* @param cfg.layerIndex
|
|
16137
|
+
* @param cfg.model
|
|
16138
|
+
* @param cfg.geometry
|
|
16139
|
+
* @param cfg.material
|
|
16140
|
+
* @param cfg.origin
|
|
16141
|
+
*/function VBOInstancingPointsLayer(cfg){_classCallCheck(this,VBOInstancingPointsLayer);// console.info("VBOInstancingPointsLayer");
|
|
16142
|
+
/**
|
|
16143
|
+
* Owner model
|
|
16144
|
+
* @type {VBOSceneModel}
|
|
16145
|
+
*/this.model=cfg.model;/**
|
|
16146
|
+
* Shared material
|
|
16147
|
+
* @type {VBOSceneModelGeometry}
|
|
16148
|
+
*/this.material=cfg.material;/**
|
|
16149
|
+
* State sorting key.
|
|
16150
|
+
* @type {string}
|
|
16151
|
+
*/this.sortId="PointsInstancingLayer";/**
|
|
16152
|
+
* Index of this InstancingLayer in VBOSceneModel#_layerList
|
|
16153
|
+
* @type {Number}
|
|
16154
|
+
*/this.layerIndex=cfg.layerIndex;this._renderers=getRenderers$2(cfg.model.scene);this._aabb=math.collapseAABB3();this._state=new RenderState({obb:math.OBB3(),numInstances:0,origin:cfg.origin?math.vec3(cfg.origin):null,geometry:cfg.geometry,positionsDecodeMatrix:cfg.geometry.positionsDecodeMatrix,// So we can null the geometry for GC
|
|
16148
16155
|
colorsBuf:null,flagsBuf:null,offsetsBuf:null,modelMatrixCol0Buf:null,modelMatrixCol1Buf:null,modelMatrixCol2Buf:null,pickColorsBuf:null});// These counts are used to avoid unnecessary render passes
|
|
16149
16156
|
this._numPortions=0;this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numSelectedLayerPortions=0;this._numClippableLayerPortions=0;this._numEdgesLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;/** @private */this.numIndices=cfg.geometry.numIndices;// Per-instance arrays
|
|
16150
16157
|
this._pickColors=[];this._offsets=[];// Modeling matrix per instance, array for each column
|
|
16151
16158
|
this._modelMatrixCol0=[];this._modelMatrixCol1=[];this._modelMatrixCol2=[];this._portions=[];this._meshes=[];this._aabb=math.collapseAABB3();this.aabbDirty=true;this._finalized=false;}return _createClass(VBOInstancingPointsLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i319=0,len=this._meshes.length;_i319<len;_i319++){math.expandAABB3(this._aabb,this._meshes[_i319].aabb);}this.aabbDirty=false;}return this._aabb;}/**
|
|
16152
|
-
|
|
16153
|
-
|
|
16154
|
-
|
|
16155
|
-
|
|
16156
|
-
|
|
16157
|
-
|
|
16158
|
-
|
|
16159
|
-
|
|
16160
|
-
|
|
16161
|
-
|
|
16162
|
-
|
|
16163
|
-
|
|
16164
|
-
|
|
16165
|
-
this._pickColors.push(pickColor[0]);this._pickColors.push(pickColor[1]);this._pickColors.push(pickColor[2]);this._pickColors.push(pickColor[3]);this._state.numInstances++;var portionId=this._portions.length;this._portions.push({});this._numPortions++;this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"finalize",value:function finalize(){if(this._finalized){throw"Already finalized";}var gl=this.model.scene.canvas.gl;var flagsLength=this._pickColors.length/4;var state=this._state;var geometry=state.geometry;if(flagsLength>0){// Because we only build flags arrays here,
|
|
16159
|
+
* Creates a new portion within this InstancingLayer, returns the new portion ID.
|
|
16160
|
+
*
|
|
16161
|
+
* The portion will instance this InstancingLayer's geometry.
|
|
16162
|
+
*
|
|
16163
|
+
* Gives the portion the specified color and matrix.
|
|
16164
|
+
*
|
|
16165
|
+
* @param mesh The SceneModelMesh that owns the portion
|
|
16166
|
+
* @param cfg Portion params
|
|
16167
|
+
* @param cfg.meshMatrix Flat float 4x4 matrix.
|
|
16168
|
+
* @param [cfg.worldMatrix] Flat float 4x4 matrix.
|
|
16169
|
+
* @param cfg.pickColor Quantized pick color
|
|
16170
|
+
* @returns {number} Portion ID.
|
|
16171
|
+
*/},{key:"createPortion",value:function createPortion(mesh,cfg){var meshMatrix=cfg.meshMatrix;var pickColor=cfg.pickColor;if(this._finalized){throw"Already finalized";}if(this.model.scene.entityOffsetsEnabled){this._offsets.push(0);this._offsets.push(0);this._offsets.push(0);}this._modelMatrixCol0.push(meshMatrix[0]);this._modelMatrixCol0.push(meshMatrix[4]);this._modelMatrixCol0.push(meshMatrix[8]);this._modelMatrixCol0.push(meshMatrix[12]);this._modelMatrixCol1.push(meshMatrix[1]);this._modelMatrixCol1.push(meshMatrix[5]);this._modelMatrixCol1.push(meshMatrix[9]);this._modelMatrixCol1.push(meshMatrix[13]);this._modelMatrixCol2.push(meshMatrix[2]);this._modelMatrixCol2.push(meshMatrix[6]);this._modelMatrixCol2.push(meshMatrix[10]);this._modelMatrixCol2.push(meshMatrix[14]);// Per-instance pick colors
|
|
16172
|
+
this._pickColors.push(pickColor[0]);this._pickColors.push(pickColor[1]);this._pickColors.push(pickColor[2]);this._pickColors.push(pickColor[3]);this._state.numInstances++;var portionId=this._portions.length;this._portions.push({});this._numPortions++;this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"finalize",value:function finalize(){if(this._finalized){throw"Already finalized";}var gl=this.model.scene.canvas.gl;var flagsLength=this._pickColors.length/4;var state=this._state;var geometry=state.geometry;if(flagsLength>0){// Because we only build flags arrays here,
|
|
16166
16173
|
// get their length from the colors array
|
|
16167
16174
|
var notNormalized=false;state.flagsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(flagsLength),flagsLength,1,gl.DYNAMIC_DRAW,notNormalized);}if(this.model.scene.entityOffsetsEnabled){if(this._offsets.length>0){var _notNormalized9=false;state.offsetsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._offsets),this._offsets.length,3,gl.DYNAMIC_DRAW,_notNormalized9);this._offsets=[];// Release memory
|
|
16168
16175
|
}}if(geometry.positionsCompressed&&geometry.positionsCompressed.length>0){var normalized=false;state.positionsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,geometry.positionsCompressed,geometry.positionsCompressed.length,3,gl.STATIC_DRAW,normalized);state.positionsDecodeMatrix=math.mat4(geometry.positionsDecodeMatrix);}if(geometry.colorsCompressed&&geometry.colorsCompressed.length>0){var colorsCompressed=new Uint8Array(geometry.colorsCompressed);var _notNormalized10=false;state.colorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,colorsCompressed,colorsCompressed.length,4,gl.STATIC_DRAW,_notNormalized10);}if(this._modelMatrixCol0.length>0){var _normalized9=false;state.modelMatrixCol0Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,gl.STATIC_DRAW,_normalized9);state.modelMatrixCol1Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,gl.STATIC_DRAW,_normalized9);state.modelMatrixCol2Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,gl.STATIC_DRAW,_normalized9);this._modelMatrixCol0=[];this._modelMatrixCol1=[];this._modelMatrixCol2=[];}if(this._pickColors.length>0){var _normalized10=false;state.pickColorsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Uint8Array(this._pickColors),this._pickColors.length,4,gl.STATIC_DRAW,_normalized10);this._pickColors=[];// Release memory
|
|
@@ -16202,8 +16209,8 @@ if(!this._finalized){throw"Not finalized";}tempUint8Vec4[0]=color[0];tempUint8Ve
|
|
|
16202
16209
|
// this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);
|
|
16203
16210
|
// }
|
|
16204
16211
|
/**
|
|
16205
|
-
|
|
16206
|
-
|
|
16212
|
+
* 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.
|
|
16213
|
+
*/},{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)?255:0;var vertFlag=0;vertFlag|=colorFlag;vertFlag|=silhouetteFlag<<4;vertFlag|=edgeFlag<<8;vertFlag|=pickFlag<<12;vertFlag|=clippableFlag<<16;tempFloat32[0]=vertFlag;this._state.flagsBuf.setData(tempFloat32,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
|
|
16207
16214
|
return;}tempVec3fa[0]=offset[0];tempVec3fa[1]=offset[1];tempVec3fa[2]=offset[2];this._state.offsetsBuf.setData(tempVec3fa,portionId*3);}},{key:"setMatrix",value:function setMatrix(portionId,matrix){if(!this._finalized){throw"Not finalized";}var offset=portionId*4;tempFloat32Vec4[0]=matrix[0];tempFloat32Vec4[1]=matrix[4];tempFloat32Vec4[2]=matrix[8];tempFloat32Vec4[3]=matrix[12];this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4,offset);tempFloat32Vec4[0]=matrix[1];tempFloat32Vec4[1]=matrix[5];tempFloat32Vec4[2]=matrix[9];tempFloat32Vec4[3]=matrix[13];this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4,offset);tempFloat32Vec4[0]=matrix[2];tempFloat32Vec4[1]=matrix[6];tempFloat32Vec4[2]=matrix[10];tempFloat32Vec4[3]=matrix[14];this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4,offset);}// ---------------------- NORMAL RENDERING -----------------------------------
|
|
16208
16215
|
},{key:"drawColorOpaque",value:function drawColorOpaque(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===this._numPortions||this._numXRayedLayerPortions===this._numPortions){return;}if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_OPAQUE);}}},{key:"drawColorTransparent",value:function drawColorTransparent(renderFlags,frameCtx){if(this._numCulledLayerPortions===this._numPortions||this._numVisibleLayerPortions===0||this._numTransparentLayerPortions===0||this._numXRayedLayerPortions===this._numPortions){return;}if(this._renderers.colorRenderer){this._renderers.colorRenderer.drawLayer(frameCtx,this,RENDER_PASSES.COLOR_TRANSPARENT);}}// -- RENDERING SAO POST EFFECT TARGETS ----------------------------------------------------------------------------
|
|
16209
16216
|
},{key:"drawDepth",value:function drawDepth(renderFlags,frameCtx){}},{key:"drawNormals",value:function drawNormals(renderFlags,frameCtx){}// ---------------------- EMPHASIS RENDERING -----------------------------------
|
|
@@ -16371,7 +16378,8 @@ texArray.set(positionDecodeMatrices[_i325],_i325*16);}var texture=gl.createTextu
|
|
|
16371
16378
|
* @returns {BindableDataTexture}
|
|
16372
16379
|
*/},{key:"generateTextureForPackedPortionIds",value:function generateTextureForPackedPortionIds(gl,portionIdsArray){if(portionIdsArray.length===0){return{texture:null,textureHeight:0};}var lenArray=portionIdsArray.length;var textureWidth=4096;var textureHeight=Math.ceil(lenArray/textureWidth);if(textureHeight===0){throw"texture height===0";}var texArraySize=textureWidth*textureHeight;var texArray=new Uint16Array(texArraySize);texArray.set(portionIdsArray,0);dataTextureRamStats$1.sizeDataTexturePortionIds+=texArray.byteLength;dataTextureRamStats$1.numberOfTextures++;var texture=gl.createTexture();gl.bindTexture(gl.TEXTURE_2D,texture);gl.texStorage2D(gl.TEXTURE_2D,1,gl.R16UI,textureWidth,textureHeight);gl.texSubImage2D(gl.TEXTURE_2D,0,0,0,textureWidth,textureHeight,gl.RED_INTEGER,gl.UNSIGNED_SHORT,texArray,0);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MAG_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_MIN_FILTER,gl.NEAREST);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_S,gl.CLAMP_TO_EDGE);gl.texParameteri(gl.TEXTURE_2D,gl.TEXTURE_WRAP_T,gl.CLAMP_TO_EDGE);gl.bindTexture(gl.TEXTURE_2D,null);return new BindableDataTexture(gl,texture,textureWidth,textureHeight);}}]);}();var configs$1=new Configs();var MAX_NUMBER_OF_OBJECTS_IN_LAYER$1=1<<16;var MAX_DATA_TEXTURE_HEIGHT$1=configs$1.maxDataTextureHeight;var INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1=8;var MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE$1=10;var tempMat4a$d=new Float32Array(16);var tempUint8Array4$1=new Uint8Array(4);var tempFloat32Array3$1=new Float32Array(3);var numLayers$1=0;var DEFAULT_MATRIX$2=math.identityMat4();/**
|
|
16373
16380
|
* @private
|
|
16374
|
-
*/var DTXLinesLayer=/*#__PURE__*/function(){function DTXLinesLayer(model,cfg){_classCallCheck(this,DTXLinesLayer)
|
|
16381
|
+
*/var DTXLinesLayer=/*#__PURE__*/function(){function DTXLinesLayer(model,cfg){_classCallCheck(this,DTXLinesLayer);// console.info("Creating DTXLinesLayer");
|
|
16382
|
+
dataTextureRamStats$1.numberOfLayers++;this._layerNumber=numLayers$1++;this.sortId="TriDTX-".concat(this._layerNumber);// State sorting key.
|
|
16375
16383
|
this.layerIndex=cfg.layerIndex;// Index of this DTXLinesLayer in {@link SceneModel#_layerList}.
|
|
16376
16384
|
this._renderers=getRenderers$1(model.scene);this.model=model;this._buffer=new DTXLinesBuffer();this._dataTextureState=new DTXLinesState();this._dataTextureGenerator=new DTXLinesTextureFactory();this._state=new RenderState({origin:math.vec3(cfg.origin),textureState:this._dataTextureState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numVertices:0});this._numPortions=0;// These counts are used to avoid unnecessary render passes
|
|
16377
16385
|
this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numSelectedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numClippableLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;this._subPortions=[];this._portionToSubPortionsMap=[];this._bucketGeometries={};this._meshes=[];this._aabb=math.collapseAABB3();this.aabbDirty=true;this._numUpdatesInFrame=0;this._finalized=false;}return _createClass(DTXLinesLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i330=0,len=this._meshes.length;_i330<len;_i330++){math.expandAABB3(this._aabb,this._meshes[_i330].aabb);}this.aabbDirty=false;}return this._aabb;}},{key:"canCreatePortion",value:function canCreatePortion(portionCfg){if(this._finalized){throw"Already finalized";}var numNewPortions=portionCfg.buckets.length;if(this._numPortions+numNewPortions>MAX_NUMBER_OF_OBJECTS_IN_LAYER$1){dataTextureRamStats$1.cannotCreatePortion.because10BitsObjectId++;}var retVal=this._numPortions+numNewPortions<=MAX_NUMBER_OF_OBJECTS_IN_LAYER$1;var bucketIndex=0;// TODO: Is this a bug?
|
|
@@ -16381,31 +16389,31 @@ var subPortionId=_this82._createSubPortion(portionCfg,bucketGeometry,bucket);//m
|
|
|
16381
16389
|
subPortionIds.push(subPortionId);});var portionId=this._portionToSubPortionsMap.length;this._portionToSubPortionsMap.push(subPortionIds);this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"_createBucketGeometry",value:function _createBucketGeometry(portionCfg,bucket){if(bucket.indices){var alignedIndicesLen=Math.ceil(bucket.indices.length/2/INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1)*INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1*2;dataTextureRamStats$1.overheadSizeAlignementIndices+=2*(alignedIndicesLen-bucket.indices.length);var alignedIndices=new Uint32Array(alignedIndicesLen);alignedIndices.fill(0);alignedIndices.set(bucket.indices);bucket.indices=alignedIndices;}var positionsCompressed=bucket.positionsCompressed;var indices=bucket.indices;var buffer=this._buffer;buffer.positionsCompressed.push(positionsCompressed);var vertexBase=buffer.lenPositionsCompressed/3;var numVertices=positionsCompressed.length/3;buffer.lenPositionsCompressed+=positionsCompressed.length;var indicesBase;var numLines=0;if(indices){numLines=indices.length/2;var indicesBuffer;if(numVertices<=1<<8){indicesBuffer=buffer.indices8Bits;indicesBase=buffer.lenIndices8Bits/2;buffer.lenIndices8Bits+=indices.length;}else if(numVertices<=1<<16){indicesBuffer=buffer.indices16Bits;indicesBase=buffer.lenIndices16Bits/2;buffer.lenIndices16Bits+=indices.length;}else{indicesBuffer=buffer.indices32Bits;indicesBase=buffer.lenIndices32Bits/2;buffer.lenIndices32Bits+=indices.length;}indicesBuffer.push(indices);}this._state.numVertices+=numVertices;dataTextureRamStats$1.numberOfGeometries++;var bucketGeometry={vertexBase:vertexBase,numVertices:numVertices,numLines:numLines,indicesBase:indicesBase};return bucketGeometry;}},{key:"_createSubPortion",value:function _createSubPortion(portionCfg,bucketGeometry){var color=portionCfg.color;var colors=portionCfg.colors;var opacity=portionCfg.opacity;var meshMatrix=portionCfg.meshMatrix;var pickColor=portionCfg.pickColor;var buffer=this._buffer;var state=this._state;buffer.perObjectPositionsDecodeMatrices.push(portionCfg.positionsDecodeMatrix);buffer.perObjectInstancePositioningMatrices.push(meshMatrix||DEFAULT_MATRIX$2);buffer.perObjectSolid.push(!!portionCfg.solid);if(colors){buffer.perObjectColors.push([colors[0]*255,colors[1]*255,colors[2]*255,255]);}else if(color){// Color is pre-quantized by SceneModel
|
|
16382
16390
|
buffer.perObjectColors.push([color[0],color[1],color[2],opacity]);}buffer.perObjectPickColors.push(pickColor);buffer.perObjectVertexBases.push(bucketGeometry.vertexBase);{var currentNumIndices;if(bucketGeometry.numVertices<=1<<8){currentNumIndices=state.numIndices8Bits;}else if(bucketGeometry.numVertices<=1<<16){currentNumIndices=state.numIndices16Bits;}else{currentNumIndices=state.numIndices32Bits;}buffer.perObjectIndexBaseOffsets.push(currentNumIndices/2-bucketGeometry.indicesBase);}var subPortionId=this._subPortions.length;if(bucketGeometry.numLines>0){var _numIndices2=bucketGeometry.numLines*2;var indicesPortionIdBuffer;if(bucketGeometry.numVertices<=1<<8){indicesPortionIdBuffer=buffer.perLineNumberPortionId8Bits;state.numIndices8Bits+=_numIndices2;dataTextureRamStats$1.totalLines8Bits+=bucketGeometry.numLines;}else if(bucketGeometry.numVertices<=1<<16){indicesPortionIdBuffer=buffer.perLineNumberPortionId16Bits;state.numIndices16Bits+=_numIndices2;dataTextureRamStats$1.totalLines16Bits+=bucketGeometry.numLines;}else{indicesPortionIdBuffer=buffer.perLineNumberPortionId32Bits;state.numIndices32Bits+=_numIndices2;dataTextureRamStats$1.totalLines32Bits+=bucketGeometry.numLines;}dataTextureRamStats$1.totalLines+=bucketGeometry.numLines;for(var _i331=0;_i331<bucketGeometry.numLines;_i331+=INDICES_EDGE_INDICES_ALIGNEMENT_SIZE$1){indicesPortionIdBuffer.push(subPortionId);}}this._subPortions.push({// vertsBase: vertsIndex,
|
|
16383
16391
|
numVertices:bucketGeometry.numLines});this._numPortions++;dataTextureRamStats$1.numberOfPortions++;return subPortionId;}/**
|
|
16384
|
-
|
|
16385
|
-
|
|
16386
|
-
|
|
16387
|
-
|
|
16392
|
+
* Builds data textures from the appended geometries and loads them into the GPU.
|
|
16393
|
+
*
|
|
16394
|
+
* No more portions can then be created.
|
|
16395
|
+
*/},{key:"finalize",value:function finalize(){var _this83=this;if(this._finalized){return;}var state=this._state;var textureState=this._dataTextureState;var gl=this.model.scene.canvas.gl;var buffer=this._buffer;state.gl=gl;textureState.texturePerObjectColorsAndFlags=this._dataTextureGenerator.generateTextureForColorsAndFlags(gl,buffer.perObjectColors,buffer.perObjectPickColors,buffer.perObjectVertexBases,buffer.perObjectIndexBaseOffsets,buffer.perObjectSolid);textureState.texturePerObjectInstanceMatrices=this._dataTextureGenerator.generateTextureForInstancingMatrices(gl,buffer.perObjectInstancePositioningMatrices);textureState.texturePerObjectPositionsDecodeMatrix=this._dataTextureGenerator.generateTextureForPositionsDecodeMatrices(gl,buffer.perObjectPositionsDecodeMatrices);textureState.texturePerVertexIdCoordinates=this._dataTextureGenerator.generateTextureForPositions(gl,buffer.positionsCompressed,buffer.lenPositionsCompressed);textureState.texturePerLineIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId8Bits);textureState.texturePerLineIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId16Bits);textureState.texturePerLineIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perLineNumberPortionId32Bits);if(buffer.lenIndices8Bits>0){textureState.texturePerLineIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerLineIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerLineIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}textureState.finalize();// Free up memory
|
|
16388
16396
|
this._buffer=null;this._bucketGeometries={};this._finalized=true;this._deferredSetFlagsDirty=false;//
|
|
16389
16397
|
this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this83._deferredSetFlagsDirty){_this83._uploadDeferredFlags();}_this83._numUpdatesInFrame=0;});}},{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=true;this._setFlags(portionId,flags,meshTransparent,deferred);this._setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._setDeferredFlags();this._setDeferredFlags2();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}/**
|
|
16390
|
-
|
|
16391
|
-
|
|
16392
|
-
|
|
16393
|
-
|
|
16394
|
-
|
|
16395
|
-
|
|
16396
|
-
|
|
16397
|
-
|
|
16398
|
-
|
|
16399
|
-
|
|
16400
|
-
|
|
16401
|
-
|
|
16402
|
-
|
|
16403
|
-
|
|
16404
|
-
|
|
16405
|
-
|
|
16406
|
-
|
|
16407
|
-
|
|
16408
|
-
|
|
16398
|
+
* This will _start_ a "set-flags transaction".
|
|
16399
|
+
*
|
|
16400
|
+
* After invoking this method, calling setFlags/setFlags2 will not update
|
|
16401
|
+
* the colors+flags texture but only store the new flags/flag2 in the
|
|
16402
|
+
* colors+flags texture data array.
|
|
16403
|
+
*
|
|
16404
|
+
* After invoking this method, and when all desired setFlags/setFlags2 have
|
|
16405
|
+
* been called on needed portions of the layer, invoke `_uploadDeferredFlags`
|
|
16406
|
+
* to actually upload the data array into the texture.
|
|
16407
|
+
*
|
|
16408
|
+
* In massive "set-flags" scenarios like VFC or LOD mechanisms, the combination of
|
|
16409
|
+
* `_beginDeferredFlags` + `_uploadDeferredFlags`brings a speed-up of
|
|
16410
|
+
* up to 80x when e.g. objects are massively (un)culled 🚀.
|
|
16411
|
+
*/},{key:"_beginDeferredFlags",value:function _beginDeferredFlags(){this._deferredSetFlagsActive=true;}/**
|
|
16412
|
+
* This will _commit_ a "set-flags transaction".
|
|
16413
|
+
*
|
|
16414
|
+
* Invoking this method will update the colors+flags texture data with new
|
|
16415
|
+
* flags/flags2 set since the previous invocation of `_beginDeferredFlags`.
|
|
16416
|
+
*/},{key:"_uploadDeferredFlags",value:function _uploadDeferredFlags(){this._deferredSetFlagsActive=false;if(!this._deferredSetFlagsDirty){return;}this._deferredSetFlagsDirty=false;var gl=this.model.scene.canvas.gl;var textureState=this._dataTextureState;gl.bindTexture(gl.TEXTURE_2D,textureState.texturePerObjectColorsAndFlags._texture);gl.texSubImage2D(gl.TEXTURE_2D,0,// level
|
|
16409
16417
|
0,// xoffset
|
|
16410
16418
|
0,// yoffset
|
|
16411
16419
|
textureState.texturePerObjectColorsAndFlags._textureWidth,// width
|
|
@@ -16504,12 +16512,12 @@ gl.RGBA,gl.FLOAT,tempMat4a$d);// gl.bindTexture (gl.TEXTURE_2D, null);
|
|
|
16504
16512
|
// if (this._renderers.silhouetteRenderer) {
|
|
16505
16513
|
// this._renderers.silhouetteRenderer.drawLayer(frameCtx, this, RENDER_PASSES.SILHOUETTE_SELECTED);
|
|
16506
16514
|
// }
|
|
16507
|
-
}},{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$
|
|
16515
|
+
}},{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();/**
|
|
16508
16516
|
* @private
|
|
16509
16517
|
*/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
|
|
16510
16518
|
);gl.drawArrays(gl.TRIANGLES,0,state.numIndices8Bits);}if(state.numIndices16Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,16// 16 bits indices
|
|
16511
16519
|
);gl.drawArrays(gl.TRIANGLES,0,state.numIndices16Bits);}if(state.numIndices32Bits>0){textureState.bindTriangleIndicesTextures(this._program,this._uTexturePerPolygonIdPortionIds,this._uTexturePerPolygonIdIndices,32// 32 bits indices
|
|
16512
|
-
);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$
|
|
16520
|
+
);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
|
|
16513
16521
|
src.push("int polygonIndex = gl_VertexID / 3;");// get packed object-id
|
|
16514
16522
|
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
|
|
16515
16523
|
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
|
|
@@ -16993,50 +17001,51 @@ texArray.set(positionDecodeMatrices[_i372],_i372*16);}var texture=gl.createTextu
|
|
|
16993
17001
|
* before switching to batch update mode.
|
|
16994
17002
|
*/var MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE=10;var tempMat4a=new Float32Array(16);var tempUint8Array4=new Uint8Array(4);var tempFloat32Array3=new Float32Array(3);var numLayers=0;var DEFAULT_MATRIX$1=math.identityMat4();/**
|
|
16995
17003
|
* @private
|
|
16996
|
-
*/var DTXTrianglesLayer=/*#__PURE__*/function(){function DTXTrianglesLayer(model,cfg){_classCallCheck(this,DTXTrianglesLayer)
|
|
17004
|
+
*/var DTXTrianglesLayer=/*#__PURE__*/function(){function DTXTrianglesLayer(model,cfg){_classCallCheck(this,DTXTrianglesLayer);// console.info("Creating DTXTrianglesLayer");
|
|
17005
|
+
dataTextureRamStats.numberOfLayers++;this._layerNumber=numLayers++;this.sortId="TriDTX-".concat(this._layerNumber);// State sorting key.
|
|
16997
17006
|
this.layerIndex=cfg.layerIndex;// Index of this TrianglesDataTextureLayer in {@link SceneModel#_layerList}.
|
|
16998
17007
|
this._renderers=getRenderers(model.scene);this.model=model;this._buffer=new DTXTrianglesBuffer();this._dtxState=new DTXTrianglesState();this._dtxTextureFactory=new DTXTrianglesTextureFactory();this._state=new RenderState({origin:math.vec3(cfg.origin),metallicRoughnessBuf:null,textureState:this._dtxState,numIndices8Bits:0,numIndices16Bits:0,numIndices32Bits:0,numEdgeIndices8Bits:0,numEdgeIndices16Bits:0,numEdgeIndices32Bits:0,numVertices:0});this._numPortions=0;// These counts are used to avoid unnecessary render passes
|
|
16999
17008
|
this._numVisibleLayerPortions=0;this._numTransparentLayerPortions=0;this._numXRayedLayerPortions=0;this._numSelectedLayerPortions=0;this._numHighlightedLayerPortions=0;this._numClippableLayerPortions=0;this._numEdgesLayerPortions=0;this._numPickableLayerPortions=0;this._numCulledLayerPortions=0;this._subPortions=[];/**
|
|
17000
|
-
|
|
17001
|
-
|
|
17002
|
-
|
|
17003
|
-
|
|
17004
|
-
|
|
17005
|
-
|
|
17006
|
-
|
|
17007
|
-
|
|
17008
|
-
|
|
17009
|
-
|
|
17010
|
-
|
|
17011
|
-
|
|
17012
|
-
|
|
17013
|
-
|
|
17014
|
-
|
|
17015
|
-
|
|
17016
|
-
|
|
17017
|
-
|
|
17018
|
-
|
|
17019
|
-
|
|
17009
|
+
* Due to `index rebucketting` process in ```prepareMeshGeometry``` function, it's possible that a single
|
|
17010
|
+
* portion is expanded to more than 1 real sub-portion.
|
|
17011
|
+
*
|
|
17012
|
+
* This Array tracks the mapping between:
|
|
17013
|
+
*
|
|
17014
|
+
* - external `portionIds` as seen by consumers of this class.
|
|
17015
|
+
* - internal `sub-portionIds` actually managed by this class.
|
|
17016
|
+
*
|
|
17017
|
+
* The outer index of this array is the externally seen `portionId`.
|
|
17018
|
+
* The inner value of the array, are `sub-portionIds` corresponding to the `portionId`.
|
|
17019
|
+
*/this._portionToSubPortionsMap=[];this._bucketGeometries={};this._meshes=[];/**
|
|
17020
|
+
* The axis-aligned World-space boundary of this TrianglesDataTextureLayer's positions.
|
|
17021
|
+
*/this._aabb=math.collapseAABB3();this.aabbDirty=true;/**
|
|
17022
|
+
* The number of updates in the current frame;
|
|
17023
|
+
*/this._numUpdatesInFrame=0;this._finalized=false;}return _createClass(DTXTrianglesLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i380=0,len=this._meshes.length;_i380<len;_i380++){math.expandAABB3(this._aabb,this._meshes[_i380].aabb);}this.aabbDirty=false;}return this._aabb;}/**
|
|
17024
|
+
* Returns whether the ```TrianglesDataTextureLayer``` has room for more portions.
|
|
17025
|
+
*
|
|
17026
|
+
* @param {object} portionCfg An object containing the geometrical data (`positions`, `indices`, `edgeIndices`) for the portion.
|
|
17027
|
+
* @returns {Boolean} Wheter the requested portion can be created
|
|
17028
|
+
*/},{key:"canCreatePortion",value:function canCreatePortion(portionCfg){if(this._finalized){throw"Already finalized";}var numNewPortions=portionCfg.buckets.length;if(this._numPortions+numNewPortions>MAX_NUMBER_OF_OBJECTS_IN_LAYER){dataTextureRamStats.cannotCreatePortion.because10BitsObjectId++;}var retVal=this._numPortions+numNewPortions<=MAX_NUMBER_OF_OBJECTS_IN_LAYER;var bucketIndex=0;// TODO: Is this a bug?
|
|
17020
17029
|
var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var alreadyHasPortionGeometry=this._bucketGeometries[bucketGeometryId];if(!alreadyHasPortionGeometry){var maxIndicesOfAnyBits=Math.max(this._state.numIndices8Bits,this._state.numIndices16Bits,this._state.numIndices32Bits);var numVertices=0;var _numIndices3=0;portionCfg.buckets.forEach(function(bucket){numVertices+=bucket.positionsCompressed.length/3;_numIndices3+=bucket.indices.length/3;});if(this._state.numVertices+numVertices>MAX_DATA_TEXTURE_HEIGHT*4096||maxIndicesOfAnyBits+_numIndices3>MAX_DATA_TEXTURE_HEIGHT*4096){dataTextureRamStats.cannotCreatePortion.becauseTextureSize++;}retVal&&(retVal=this._state.numVertices+numVertices<=MAX_DATA_TEXTURE_HEIGHT*4096&&maxIndicesOfAnyBits+_numIndices3<=MAX_DATA_TEXTURE_HEIGHT*4096);}return retVal;}/**
|
|
17021
|
-
|
|
17022
|
-
|
|
17023
|
-
|
|
17024
|
-
|
|
17025
|
-
|
|
17026
|
-
|
|
17027
|
-
|
|
17028
|
-
|
|
17029
|
-
|
|
17030
|
-
|
|
17031
|
-
|
|
17032
|
-
|
|
17033
|
-
|
|
17034
|
-
|
|
17035
|
-
|
|
17036
|
-
|
|
17037
|
-
|
|
17038
|
-
|
|
17039
|
-
|
|
17030
|
+
* Creates a new portion within this TrianglesDataTextureLayer, returns the new portion ID.
|
|
17031
|
+
*
|
|
17032
|
+
* Gives the portion the specified geometry, color and matrix.
|
|
17033
|
+
*
|
|
17034
|
+
* @param mesh The SceneModelMesh that owns the portion
|
|
17035
|
+
* @param portionCfg.positionsCompressed Flat float Local-space positionsCompressed array.
|
|
17036
|
+
* @param [portionCfg.normals] Flat float normals array.
|
|
17037
|
+
* @param [portionCfg.colors] Flat float colors array.
|
|
17038
|
+
* @param portionCfg.indices Flat int indices array.
|
|
17039
|
+
* @param [portionCfg.edgeIndices] Flat int edges indices array.
|
|
17040
|
+
* @param portionCfg.color Quantized RGB color [0..255,0..255,0..255,0..255]
|
|
17041
|
+
* @param portionCfg.metallic Metalness factor [0..255]
|
|
17042
|
+
* @param portionCfg.roughness Roughness factor [0..255]
|
|
17043
|
+
* @param portionCfg.opacity Opacity [0..255]
|
|
17044
|
+
* @param [portionCfg.meshMatrix] Flat float 4x4 matrix - transforms the portion within the coordinate system that's local to the SceneModel
|
|
17045
|
+
* @param portionCfg.worldAABB Flat float AABB World-space AABB
|
|
17046
|
+
* @param portionCfg.pickColor Quantized pick color
|
|
17047
|
+
* @returns {number} Portion ID
|
|
17048
|
+
*/},{key:"createPortion",value:function createPortion(mesh,portionCfg){var _this84=this;if(this._finalized){throw"Already finalized";}var subPortionIds=[];// const portionAABB = portionCfg.worldAABB;
|
|
17040
17049
|
portionCfg.buckets.forEach(function(bucket,bucketIndex){var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==null?"".concat(portionCfg.geometryId,"#").concat(bucketIndex):"".concat(portionCfg.id,"#").concat(bucketIndex);var bucketGeometry=_this84._bucketGeometries[bucketGeometryId];if(!bucketGeometry){bucketGeometry=_this84._createBucketGeometry(portionCfg,bucket);_this84._bucketGeometries[bucketGeometryId]=bucketGeometry;}// const subPortionAABB = math.collapseAABB3(tempAABB3b);
|
|
17041
17050
|
var subPortionId=_this84._createSubPortion(portionCfg,bucketGeometry,bucket);//math.expandAABB3(portionAABB, subPortionAABB);
|
|
17042
17051
|
subPortionIds.push(subPortionId);});var portionId=this._portionToSubPortionsMap.length;this._portionToSubPortionsMap.push(subPortionIds);this.model.numPortions++;this._meshes.push(mesh);return portionId;}},{key:"_createBucketGeometry",value:function _createBucketGeometry(portionCfg,bucket){// Indices alignement
|
|
@@ -17055,31 +17064,31 @@ if(bucket.edgeIndices){var alignedEdgeIndicesLen=Math.ceil(bucket.edgeIndices.le
|
|
|
17055
17064
|
buffer.perObjectColors.push([color[0],color[1],color[2],opacity]);}buffer.perObjectPickColors.push(pickColor);buffer.perObjectVertexBases.push(bucketGeometry.vertexBase);{var currentNumIndices;if(bucketGeometry.numVertices<=1<<8){currentNumIndices=state.numIndices8Bits;}else if(bucketGeometry.numVertices<=1<<16){currentNumIndices=state.numIndices16Bits;}else{currentNumIndices=state.numIndices32Bits;}buffer.perObjectIndexBaseOffsets.push(currentNumIndices/3-bucketGeometry.indicesBase);}{var currentNumEdgeIndices;if(bucketGeometry.numVertices<=1<<8){currentNumEdgeIndices=state.numEdgeIndices8Bits;}else if(bucketGeometry.numVertices<=1<<16){currentNumEdgeIndices=state.numEdgeIndices16Bits;}else{currentNumEdgeIndices=state.numEdgeIndices32Bits;}buffer.perObjectEdgeIndexBaseOffsets.push(currentNumEdgeIndices/2-bucketGeometry.edgeIndicesBase);}var subPortionId=this._subPortions.length;if(bucketGeometry.numTriangles>0){var _numIndices4=bucketGeometry.numTriangles*3;var indicesPortionIdBuffer;if(bucketGeometry.numVertices<=1<<8){indicesPortionIdBuffer=buffer.perTriangleNumberPortionId8Bits;state.numIndices8Bits+=_numIndices4;dataTextureRamStats.totalPolygons8Bits+=bucketGeometry.numTriangles;}else if(bucketGeometry.numVertices<=1<<16){indicesPortionIdBuffer=buffer.perTriangleNumberPortionId16Bits;state.numIndices16Bits+=_numIndices4;dataTextureRamStats.totalPolygons16Bits+=bucketGeometry.numTriangles;}else{indicesPortionIdBuffer=buffer.perTriangleNumberPortionId32Bits;state.numIndices32Bits+=_numIndices4;dataTextureRamStats.totalPolygons32Bits+=bucketGeometry.numTriangles;}dataTextureRamStats.totalPolygons+=bucketGeometry.numTriangles;for(var _i381=0;_i381<bucketGeometry.numTriangles;_i381+=INDICES_EDGE_INDICES_ALIGNEMENT_SIZE){indicesPortionIdBuffer.push(subPortionId);}}if(bucketGeometry.numEdges>0){var numEdgeIndices=bucketGeometry.numEdges*2;var edgeIndicesPortionIdBuffer;if(bucketGeometry.numVertices<=1<<8){edgeIndicesPortionIdBuffer=buffer.perEdgeNumberPortionId8Bits;state.numEdgeIndices8Bits+=numEdgeIndices;dataTextureRamStats.totalEdges8Bits+=bucketGeometry.numEdges;}else if(bucketGeometry.numVertices<=1<<16){edgeIndicesPortionIdBuffer=buffer.perEdgeNumberPortionId16Bits;state.numEdgeIndices16Bits+=numEdgeIndices;dataTextureRamStats.totalEdges16Bits+=bucketGeometry.numEdges;}else{edgeIndicesPortionIdBuffer=buffer.perEdgeNumberPortionId32Bits;state.numEdgeIndices32Bits+=numEdgeIndices;dataTextureRamStats.totalEdges32Bits+=bucketGeometry.numEdges;}dataTextureRamStats.totalEdges+=bucketGeometry.numEdges;for(var _i382=0;_i382<bucketGeometry.numEdges;_i382+=INDICES_EDGE_INDICES_ALIGNEMENT_SIZE){edgeIndicesPortionIdBuffer.push(subPortionId);}}// buffer.perObjectOffsets.push([0, 0, 0]);
|
|
17056
17065
|
this._subPortions.push({// vertsBase: vertsIndex,
|
|
17057
17066
|
numVertices:bucketGeometry.numTriangles});this._numPortions++;dataTextureRamStats.numberOfPortions++;return subPortionId;}/**
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17067
|
+
* Builds data textures from the appended geometries and loads them into the GPU.
|
|
17068
|
+
*
|
|
17069
|
+
* No more portions can then be created.
|
|
17070
|
+
*/},{key:"finalize",value:function finalize(){var _this85=this;if(this._finalized){return;}var state=this._state;var textureState=this._dtxState;var gl=this.model.scene.canvas.gl;var buffer=this._buffer;state.gl=gl;textureState.texturePerObjectColorsAndFlags=this._dtxTextureFactory.createTextureForColorsAndFlags(gl,buffer.perObjectColors,buffer.perObjectPickColors,buffer.perObjectVertexBases,buffer.perObjectIndexBaseOffsets,buffer.perObjectEdgeIndexBaseOffsets,buffer.perObjectSolid);textureState.texturePerObjectInstanceMatrices=this._dtxTextureFactory.createTextureForInstancingMatrices(gl,buffer.perObjectInstancePositioningMatrices);textureState.texturePerObjectPositionsDecodeMatrix=this._dtxTextureFactory.createTextureForPositionsDecodeMatrices(gl,buffer.perObjectPositionsDecodeMatrices);textureState.texturePerVertexIdCoordinates=this._dtxTextureFactory.createTextureForPositions(gl,buffer.positionsCompressed,buffer.lenPositionsCompressed);textureState.texturePerPolygonIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId8Bits);textureState.texturePerPolygonIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId16Bits);textureState.texturePerPolygonIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId32Bits);if(buffer.perEdgeNumberPortionId8Bits.length>0){textureState.texturePerEdgeIdPortionIds8Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId8Bits);}if(buffer.perEdgeNumberPortionId16Bits.length>0){textureState.texturePerEdgeIdPortionIds16Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId16Bits);}if(buffer.perEdgeNumberPortionId32Bits.length>0){textureState.texturePerEdgeIdPortionIds32Bits=this._dtxTextureFactory.createTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId32Bits);}if(buffer.lenIndices8Bits>0){textureState.texturePerPolygonIdIndices8Bits=this._dtxTextureFactory.createTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerPolygonIdIndices16Bits=this._dtxTextureFactory.createTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerPolygonIdIndices32Bits=this._dtxTextureFactory.createTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}if(buffer.lenEdgeIndices8Bits>0){textureState.texturePerPolygonIdEdgeIndices8Bits=this._dtxTextureFactory.createTextureFor8BitsEdgeIndices(gl,buffer.edgeIndices8Bits,buffer.lenEdgeIndices8Bits);}if(buffer.lenEdgeIndices16Bits>0){textureState.texturePerPolygonIdEdgeIndices16Bits=this._dtxTextureFactory.createTextureFor16BitsEdgeIndices(gl,buffer.edgeIndices16Bits,buffer.lenEdgeIndices16Bits);}if(buffer.lenEdgeIndices32Bits>0){textureState.texturePerPolygonIdEdgeIndices32Bits=this._dtxTextureFactory.createTextureFor32BitsEdgeIndices(gl,buffer.edgeIndices32Bits,buffer.lenEdgeIndices32Bits);}textureState.finalize();// Free up memory
|
|
17062
17071
|
this._buffer=null;this._bucketGeometries={};this._finalized=true;this._deferredSetFlagsDirty=false;//
|
|
17063
17072
|
this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this85._deferredSetFlagsDirty){_this85._uploadDeferredFlags();}_this85._numUpdatesInFrame=0;});}},{key:"isEmpty",value:function isEmpty(){return this._numPortions===0;}},{key:"initFlags",value:function initFlags(portionId,flags,meshTransparent){if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions++;this.model.numCulledLayerPortions++;}if(meshTransparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}var deferred=true;this._setFlags(portionId,flags,meshTransparent,deferred);this._setFlags2(portionId,flags,deferred);}},{key:"flushInitFlags",value:function flushInitFlags(){this._setDeferredFlags();this._setDeferredFlags2();}},{key:"setVisible",value:function setVisible(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.VISIBLE){this._numVisibleLayerPortions++;this.model.numVisibleLayerPortions++;}else{this._numVisibleLayerPortions--;this.model.numVisibleLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setHighlighted",value:function setHighlighted(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.HIGHLIGHTED){this._numHighlightedLayerPortions++;this.model.numHighlightedLayerPortions++;}else{this._numHighlightedLayerPortions--;this.model.numHighlightedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setXRayed",value:function setXRayed(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.XRAYED){this._numXRayedLayerPortions++;this.model.numXRayedLayerPortions++;}else{this._numXRayedLayerPortions--;this.model.numXRayedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setSelected",value:function setSelected(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.SELECTED){this._numSelectedLayerPortions++;this.model.numSelectedLayerPortions++;}else{this._numSelectedLayerPortions--;this.model.numSelectedLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setEdges",value:function setEdges(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.EDGES){this._numEdgesLayerPortions++;this.model.numEdgesLayerPortions++;}else{this._numEdgesLayerPortions--;this.model.numEdgesLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setClippable",value:function setClippable(portionId,flags){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CLIPPABLE){this._numClippableLayerPortions++;this.model.numClippableLayerPortions++;}else{this._numClippableLayerPortions--;this.model.numClippableLayerPortions--;}this._setFlags2(portionId,flags);}/**
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
|
|
17076
|
-
|
|
17077
|
-
|
|
17078
|
-
|
|
17079
|
-
|
|
17080
|
-
|
|
17081
|
-
|
|
17082
|
-
|
|
17073
|
+
* This will _start_ a "set-flags transaction".
|
|
17074
|
+
*
|
|
17075
|
+
* After invoking this method, calling setFlags/setFlags2 will not update
|
|
17076
|
+
* the colors+flags texture but only store the new flags/flag2 in the
|
|
17077
|
+
* colors+flags texture data array.
|
|
17078
|
+
*
|
|
17079
|
+
* After invoking this method, and when all desired setFlags/setFlags2 have
|
|
17080
|
+
* been called on needed portions of the layer, invoke `_uploadDeferredFlags`
|
|
17081
|
+
* to actually upload the data array into the texture.
|
|
17082
|
+
*
|
|
17083
|
+
* In massive "set-flags" scenarios like VFC or LOD mechanisms, the combination of
|
|
17084
|
+
* `_beginDeferredFlags` + `_uploadDeferredFlags`brings a speed-up of
|
|
17085
|
+
* up to 80x when e.g. objects are massively (un)culled 🚀.
|
|
17086
|
+
*/},{key:"_beginDeferredFlags",value:function _beginDeferredFlags(){this._deferredSetFlagsActive=true;}/**
|
|
17087
|
+
* This will _commit_ a "set-flags transaction".
|
|
17088
|
+
*
|
|
17089
|
+
* Invoking this method will update the colors+flags texture data with new
|
|
17090
|
+
* flags/flags2 set since the previous invocation of `_beginDeferredFlags`.
|
|
17091
|
+
*/},{key:"_uploadDeferredFlags",value:function _uploadDeferredFlags(){this._deferredSetFlagsActive=false;if(!this._deferredSetFlagsDirty){return;}this._deferredSetFlagsDirty=false;var gl=this.model.scene.canvas.gl;var textureState=this._dtxState;gl.bindTexture(gl.TEXTURE_2D,textureState.texturePerObjectColorsAndFlags._texture);gl.texSubImage2D(gl.TEXTURE_2D,0,// level
|
|
17083
17092
|
0,// xoffset
|
|
17084
17093
|
0,// yoffset
|
|
17085
17094
|
textureState.texturePerObjectColorsAndFlags._textureWidth,// width
|
|
@@ -17098,8 +17107,10 @@ gl.RGBA_INTEGER,gl.UNSIGNED_BYTE,textureState.texturePerObjectColorsAndFlags._te
|
|
|
17098
17107
|
// );
|
|
17099
17108
|
}},{key:"setCulled",value:function setCulled(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.CULLED){this._numCulledLayerPortions+=this._portionToSubPortionsMap[portionId].length;this.model.numCulledLayerPortions++;}else{this._numCulledLayerPortions-=this._portionToSubPortionsMap[portionId].length;this.model.numCulledLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setCollidable",value:function setCollidable(portionId,flags){if(!this._finalized){throw"Not finalized";}}},{key:"setPickable",value:function setPickable(portionId,flags,transparent){if(!this._finalized){throw"Not finalized";}if(flags&ENTITY_FLAGS.PICKABLE){this._numPickableLayerPortions++;this.model.numPickableLayerPortions++;}else{this._numPickableLayerPortions--;this.model.numPickableLayerPortions--;}this._setFlags(portionId,flags,transparent);}},{key:"setColor",value:function setColor(portionId,color){var subPortionIds=this._portionToSubPortionsMap[portionId];for(var _i383=0,len=subPortionIds.length;_i383<len;_i383++){this._subPortionSetColor(subPortionIds[_i383],color);}}},{key:"_subPortionSetColor",value:function _subPortionSetColor(subPortionId,color){if(!this._finalized){throw"Not finalized";}// Color
|
|
17100
17109
|
var textureState=this._dtxState;var gl=this.model.scene.canvas.gl;tempUint8Array4[0]=color[0];tempUint8Array4[1]=color[1];tempUint8Array4[2]=color[2];tempUint8Array4[3]=color[3];// object colors
|
|
17101
|
-
textureState.texturePerObjectColorsAndFlags._textureData.set(tempUint8Array4,subPortionId*32);if(this._deferredSetFlagsActive){console.info("_subPortionSetColor defer");
|
|
17102
|
-
|
|
17110
|
+
textureState.texturePerObjectColorsAndFlags._textureData.set(tempUint8Array4,subPortionId*32);if(this._deferredSetFlagsActive){// console.info("_subPortionSetColor defer");
|
|
17111
|
+
this._deferredSetFlagsDirty=true;return;}if(++this._numUpdatesInFrame>=MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE){this._beginDeferredFlags();// Subsequent flags updates now deferred
|
|
17112
|
+
}// console.info("_subPortionSetColor write through");
|
|
17113
|
+
gl.bindTexture(gl.TEXTURE_2D,textureState.texturePerObjectColorsAndFlags._texture);gl.texSubImage2D(gl.TEXTURE_2D,0,// level
|
|
17103
17114
|
subPortionId%512*8,// xoffset
|
|
17104
17115
|
Math.floor(subPortionId/512),// yoffset
|
|
17105
17116
|
1,// width
|
|
@@ -19750,33 +19761,11 @@ if(metaModelData.propertySets){for(var _i469=0,_len95=metaModelData.propertySets
|
|
|
19750
19761
|
*/var IFCObjectDefaults={DEFAULT:{}};/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */!function(t,e){"object"==(typeof exports==="undefined"?"undefined":_typeof(exports))&&"undefined"!="object"?e(exports):"function"==typeof define&&__webpack_require__.amdO?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).pako={});}(undefined,function(t){function e(t){var e=t.length;for(;--e>=0;)t[e]=0;}var a=256,i=286,n=30,s=15,r=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),o=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),l=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),h=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=new Array(576);e(d);var _=new Array(60);e(_);var f=new Array(512);e(f);var c=new Array(256);e(c);var u=new Array(29);e(u);var w=new Array(n);function m(t,e,a,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=a,this.elems=i,this.max_length=n,this.has_stree=t&&t.length;}var b,g,p;function k(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e;}e(w);var v=function v(t){return t<256?f[t]:f[256+(t>>>7)];},y=function y(t,e){t.pending_buf[t.pending++]=255&e,t.pending_buf[t.pending++]=e>>>8&255;},x=function x(t,e,a){t.bi_valid>16-a?(t.bi_buf|=e<<t.bi_valid&65535,y(t,t.bi_buf),t.bi_buf=e>>16-t.bi_valid,t.bi_valid+=a-16):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=a);},z=function z(t,e,a){x(t,a[2*e],a[2*e+1]);},A=function A(t,e){var a=0;do{a|=1&t,t>>>=1,a<<=1;}while(--e>0);return a>>>1;},E=function E(t,e,a){var i=new Array(16);var n,r,o=0;for(n=1;n<=s;n++)o=o+a[n-1]<<1,i[n]=o;for(r=0;r<=e;r++){var _e2=t[2*r+1];0!==_e2&&(t[2*r]=A(i[_e2]++,_e2));}},R=function R(t){var e;for(e=0;e<i;e++)t.dyn_ltree[2*e]=0;for(e=0;e<n;e++)t.dyn_dtree[2*e]=0;for(e=0;e<19;e++)t.bl_tree[2*e]=0;t.dyn_ltree[512]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0;},Z=function Z(t){t.bi_valid>8?y(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0;},U=function U(t,e,a,i){var n=2*e,s=2*a;return t[n]<t[s]||t[n]===t[s]&&i[e]<=i[a];},S=function S(t,e,a){var i=t.heap[a];var n=a<<1;for(;n<=t.heap_len&&(n<t.heap_len&&U(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!U(e,i,t.heap[n],t.depth));)t.heap[a]=t.heap[n],a=n,n<<=1;t.heap[a]=i;},D=function D(t,e,i){var n,s,l,h,d=0;if(0!==t.sym_next)do{n=255&t.pending_buf[t.sym_buf+d++],n+=(255&t.pending_buf[t.sym_buf+d++])<<8,s=t.pending_buf[t.sym_buf+d++],0===n?z(t,s,e):(l=c[s],z(t,l+a+1,e),h=r[l],0!==h&&(s-=u[l],x(t,s,h)),n--,l=v(n),z(t,l,i),h=o[l],0!==h&&(n-=w[l],x(t,n,h)));}while(d<t.sym_next);z(t,256,e);},T=function T(t,e){var a=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,r=e.stat_desc.elems;var o,l,h,d=-1;for(t.heap_len=0,t.heap_max=573,o=0;o<r;o++)0!==a[2*o]?(t.heap[++t.heap_len]=d=o,t.depth[o]=0):a[2*o+1]=0;for(;t.heap_len<2;)h=t.heap[++t.heap_len]=d<2?++d:0,a[2*h]=1,t.depth[h]=0,t.opt_len--,n&&(t.static_len-=i[2*h+1]);for(e.max_code=d,o=t.heap_len>>1;o>=1;o--)S(t,a,o);h=r;do{o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],S(t,a,1),l=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=l,a[2*h]=a[2*o]+a[2*l],t.depth[h]=(t.depth[o]>=t.depth[l]?t.depth[o]:t.depth[l])+1,a[2*o+1]=a[2*l+1]=h,t.heap[1]=h++,S(t,a,1);}while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],function(t,e){var a=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,r=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,l=e.stat_desc.extra_base,h=e.stat_desc.max_length;var d,_,f,c,u,w,m=0;for(c=0;c<=s;c++)t.bl_count[c]=0;for(a[2*t.heap[t.heap_max]+1]=0,d=t.heap_max+1;d<573;d++)_=t.heap[d],c=a[2*a[2*_+1]+1]+1,c>h&&(c=h,m++),a[2*_+1]=c,_>i||(t.bl_count[c]++,u=0,_>=l&&(u=o[_-l]),w=a[2*_],t.opt_len+=w*(c+u),r&&(t.static_len+=w*(n[2*_+1]+u)));if(0!==m){do{for(c=h-1;0===t.bl_count[c];)c--;t.bl_count[c]--,t.bl_count[c+1]+=2,t.bl_count[h]--,m-=2;}while(m>0);for(c=h;0!==c;c--)for(_=t.bl_count[c];0!==_;)f=t.heap[--d],f>i||(a[2*f+1]!==c&&(t.opt_len+=(c-a[2*f+1])*a[2*f],a[2*f+1]=c),_--);}}(t,e),E(a,d,t.bl_count);},O=function O(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),e[2*(a+1)+1]=65535,i=0;i<=a;i++)n=r,r=e[2*(i+1)+1],++o<l&&n===r||(o<h?t.bl_tree[2*n]+=o:0!==n?(n!==s&&t.bl_tree[2*n]++,t.bl_tree[32]++):o<=10?t.bl_tree[34]++:t.bl_tree[36]++,o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4));},I=function I(t,e,a){var i,n,s=-1,r=e[1],o=0,l=7,h=4;for(0===r&&(l=138,h=3),i=0;i<=a;i++)if(n=r,r=e[2*(i+1)+1],!(++o<l&&n===r)){if(o<h)do{z(t,n,t.bl_tree);}while(0!=--o);else 0!==n?(n!==s&&(z(t,n,t.bl_tree),o--),z(t,16,t.bl_tree),x(t,o-3,2)):o<=10?(z(t,17,t.bl_tree),x(t,o-3,3)):(z(t,18,t.bl_tree),x(t,o-11,7));o=0,s=n,0===r?(l=138,h=3):n===r?(l=6,h=3):(l=7,h=4);}};var F=!1;var L=function L(t,e,a,i){x(t,0+(i?1:0),3),Z(t),y(t,a),y(t,~a),a&&t.pending_buf.set(t.window.subarray(e,e+a),t.pending),t.pending+=a;};var N=function N(t,e,i,n){var s,r,o=0;t.level>0?(2===t.strm.data_type&&(t.strm.data_type=function(t){var e,i=4093624447;for(e=0;e<=31;e++,i>>>=1)if(1&i&&0!==t.dyn_ltree[2*e])return 0;if(0!==t.dyn_ltree[18]||0!==t.dyn_ltree[20]||0!==t.dyn_ltree[26])return 1;for(e=32;e<a;e++)if(0!==t.dyn_ltree[2*e])return 1;return 0;}(t)),T(t,t.l_desc),T(t,t.d_desc),o=function(t){var e;for(O(t,t.dyn_ltree,t.l_desc.max_code),O(t,t.dyn_dtree,t.d_desc.max_code),T(t,t.bl_desc),e=18;e>=3&&0===t.bl_tree[2*h[e]+1];e--);return t.opt_len+=3*(e+1)+5+5+4,e;}(t),s=t.opt_len+3+7>>>3,r=t.static_len+3+7>>>3,r<=s&&(s=r)):s=r=i+5,i+4<=s&&-1!==e?L(t,e,i,n):4===t.strategy||r===s?(x(t,2+(n?1:0),3),D(t,d,_)):(x(t,4+(n?1:0),3),function(t,e,a,i){var n;for(x(t,e-257,5),x(t,a-1,5),x(t,i-4,4),n=0;n<i;n++)x(t,t.bl_tree[2*h[n]+1],3);I(t,t.dyn_ltree,e-1),I(t,t.dyn_dtree,a-1);}(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),D(t,t.dyn_ltree,t.dyn_dtree)),R(t),n&&Z(t);},B={_tr_init:function _tr_init(t){F||(function(){var t,e,a,h,k;var v=new Array(16);for(a=0,h=0;h<28;h++)for(u[h]=a,t=0;t<1<<r[h];t++)c[a++]=h;for(c[a-1]=h,k=0,h=0;h<16;h++)for(w[h]=k,t=0;t<1<<o[h];t++)f[k++]=h;for(k>>=7;h<n;h++)for(w[h]=k<<7,t=0;t<1<<o[h]-7;t++)f[256+k++]=h;for(e=0;e<=s;e++)v[e]=0;for(t=0;t<=143;)d[2*t+1]=8,t++,v[8]++;for(;t<=255;)d[2*t+1]=9,t++,v[9]++;for(;t<=279;)d[2*t+1]=7,t++,v[7]++;for(;t<=287;)d[2*t+1]=8,t++,v[8]++;for(E(d,287,v),t=0;t<n;t++)_[2*t+1]=5,_[2*t]=A(t,5);b=new m(d,r,257,i,s),g=new m(_,o,0,n,s),p=new m(new Array(0),l,0,19,7);}(),F=!0),t.l_desc=new k(t.dyn_ltree,b),t.d_desc=new k(t.dyn_dtree,g),t.bl_desc=new k(t.bl_tree,p),t.bi_buf=0,t.bi_valid=0,R(t);},_tr_stored_block:L,_tr_flush_block:N,_tr_tally:function _tr_tally(t,e,i){return t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=i,0===e?t.dyn_ltree[2*i]++:(t.matches++,e--,t.dyn_ltree[2*(c[i]+a+1)]++,t.dyn_dtree[2*v(e)]++),t.sym_next===t.sym_end;},_tr_align:function _tr_align(t){x(t,2,3),z(t,256,d),function(t){16===t.bi_valid?(y(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=255&t.bi_buf,t.bi_buf>>=8,t.bi_valid-=8);}(t);}};var C=function C(t,e,a,i){var n=65535&t|0,s=t>>>16&65535|0,r=0;for(;0!==a;){r=a>2e3?2e3:a,a-=r;do{n=n+e[i++]|0,s=s+n|0;}while(--r);n%=65521,s%=65521;}return n|s<<16|0;};var M=new Uint32Array(function(){var t,e=[];for(var a=0;a<256;a++){t=a;for(var i=0;i<8;i++)t=1&t?3988292384^t>>>1:t>>>1;e[a]=t;}return e;}());var H=function H(t,e,a,i){var n=M,s=i+a;t^=-1;for(var _a6=i;_a6<s;_a6++)t=t>>>8^n[255&(t^e[_a6])];return-1^t;},j={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},K={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var P=B._tr_init,Y=B._tr_stored_block,G=B._tr_flush_block,X=B._tr_tally,W=B._tr_align,q=K.Z_NO_FLUSH,J=K.Z_PARTIAL_FLUSH,Q=K.Z_FULL_FLUSH,V=K.Z_FINISH,$=K.Z_BLOCK,tt=K.Z_OK,et=K.Z_STREAM_END,at=K.Z_STREAM_ERROR,it=K.Z_DATA_ERROR,nt=K.Z_BUF_ERROR,st=K.Z_DEFAULT_COMPRESSION,rt=K.Z_FILTERED,ot=K.Z_HUFFMAN_ONLY,lt=K.Z_RLE,ht=K.Z_FIXED,dt=K.Z_DEFAULT_STRATEGY,_t=K.Z_UNKNOWN,ft=K.Z_DEFLATED,ct=258,ut=262,wt=42,mt=113,bt=666,gt=function gt(t,e){return t.msg=j[e],e;},pt=function pt(t){return 2*t-(t>4?9:0);},kt=function kt(t){var e=t.length;for(;--e>=0;)t[e]=0;},vt=function vt(t){var e,a,i,n=t.w_size;e=t.hash_size,i=e;do{a=t.head[--i],t.head[i]=a>=n?a-n:0;}while(--e);e=n,i=e;do{a=t.prev[--i],t.prev[i]=a>=n?a-n:0;}while(--e);};var yt=function yt(t,e,a){return(e<<t.hash_shift^a)&t.hash_mask;};var xt=function xt(t){var e=t.state;var a=e.pending;a>t.avail_out&&(a=t.avail_out),0!==a&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+a),t.next_out),t.next_out+=a,e.pending_out+=a,t.total_out+=a,t.avail_out-=a,e.pending-=a,0===e.pending&&(e.pending_out=0));},zt=function zt(t,e){G(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,xt(t.strm);},At=function At(t,e){t.pending_buf[t.pending++]=e;},Et=function Et(t,e){t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=255&e;},Rt=function Rt(t,e,a,i){var n=t.avail_in;return n>i&&(n=i),0===n?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),a),1===t.state.wrap?t.adler=C(t.adler,e,n,a):2===t.state.wrap&&(t.adler=H(t.adler,e,n,a)),t.next_in+=n,t.total_in+=n,n);},Zt=function Zt(t,e){var a,i,n=t.max_chain_length,s=t.strstart,r=t.prev_length,o=t.nice_match;var l=t.strstart>t.w_size-ut?t.strstart-(t.w_size-ut):0,h=t.window,d=t.w_mask,_=t.prev,f=t.strstart+ct;var c=h[s+r-1],u=h[s+r];t.prev_length>=t.good_match&&(n>>=2),o>t.lookahead&&(o=t.lookahead);do{if(a=e,h[a+r]===u&&h[a+r-1]===c&&h[a]===h[s]&&h[++a]===h[s+1]){s+=2,a++;do{}while(h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&h[++s]===h[++a]&&s<f);if(i=ct-(f-s),s=f-ct,i>r){if(t.match_start=e,r=i,i>=o)break;c=h[s+r-1],u=h[s+r];}}}while((e=_[e&d])>l&&0!=--n);return r<=t.lookahead?r:t.lookahead;},Ut=function Ut(t){var e=t.w_size;var a,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-ut)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),vt(t),i+=e),0===t.strm.avail_in)break;if(a=Rt(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=a,t.lookahead+t.insert>=3)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=yt(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=yt(t,t.ins_h,t.window[n+3-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<3)););}while(t.lookahead<ut&&0!==t.strm.avail_in);},St=function St(t,e){var a,i,n,s=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,r=0,o=t.strm.avail_in;do{if(a=65535,n=t.bi_valid+42>>3,t.strm.avail_out<n)break;if(n=t.strm.avail_out-n,i=t.strstart-t.block_start,a>i+t.strm.avail_in&&(a=i+t.strm.avail_in),a>n&&(a=n),a<s&&(0===a&&e!==V||e===q||a!==i+t.strm.avail_in))break;r=e===V&&a===i+t.strm.avail_in?1:0,Y(t,0,0,r),t.pending_buf[t.pending-4]=a,t.pending_buf[t.pending-3]=a>>8,t.pending_buf[t.pending-2]=~a,t.pending_buf[t.pending-1]=~a>>8,xt(t.strm),i&&(i>a&&(i=a),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,a-=i),a&&(Rt(t.strm,t.strm.output,t.strm.next_out,a),t.strm.next_out+=a,t.strm.avail_out-=a,t.strm.total_out+=a);}while(0===r);return o-=t.strm.avail_in,o&&(o>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=o&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-o,t.strm.next_in),t.strstart),t.strstart+=o,t.insert+=o>t.w_size-t.insert?t.w_size-t.insert:o),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),r?4:e!==q&&e!==V&&0===t.strm.avail_in&&t.strstart===t.block_start?2:(n=t.window_size-t.strstart,t.strm.avail_in>n&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,n+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),n>t.strm.avail_in&&(n=t.strm.avail_in),n&&(Rt(t.strm,t.window,t.strstart,n),t.strstart+=n,t.insert+=n>t.w_size-t.insert?t.w_size-t.insert:n),t.high_water<t.strstart&&(t.high_water=t.strstart),n=t.bi_valid+42>>3,n=t.pending_buf_size-n>65535?65535:t.pending_buf_size-n,s=n>t.w_size?t.w_size:n,i=t.strstart-t.block_start,(i>=s||(i||e===V)&&e!==q&&0===t.strm.avail_in&&i<=n)&&(a=i>n?n:i,r=e===V&&0===t.strm.avail_in&&a===i?1:0,Y(t,t.block_start,a,r),t.block_start+=a,xt(t.strm)),r?3:1);},Dt=function Dt(t,e){var a,i;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),0!==a&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a)),t.match_length>=3){if(i=X(t,t.strstart-t.match_start,t.match_length-3),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=3){t.match_length--;do{t.strstart++,t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;}while(0!=--t.match_length);t.strstart++;}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=yt(t,t.ins_h,t.window[t.strstart+1]);}else i=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;},Tt=function Tt(t,e){var a,i,n;for(;;){if(t.lookahead<ut){if(Ut(t),t.lookahead<ut&&e===q)return 1;if(0===t.lookahead)break;}if(a=0,t.lookahead>=3&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=2,0!==a&&t.prev_length<t.max_lazy_match&&t.strstart-a<=t.w_size-ut&&(t.match_length=Zt(t,a),t.match_length<=5&&(t.strategy===rt||3===t.match_length&&t.strstart-t.match_start>4096)&&(t.match_length=2)),t.prev_length>=3&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-3,i=X(t,t.strstart-1-t.prev_match,t.prev_length-3),t.lookahead-=t.prev_length-1,t.prev_length-=2;do{++t.strstart<=n&&(t.ins_h=yt(t,t.ins_h,t.window[t.strstart+3-1]),a=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);}while(0!=--t.prev_length);if(t.match_available=0,t.match_length=2,t.strstart++,i&&(zt(t,!1),0===t.strm.avail_out))return 1;}else if(t.match_available){if(i=X(t,0,t.window[t.strstart-1]),i&&zt(t,!1),t.strstart++,t.lookahead--,0===t.strm.avail_out)return 1;}else t.match_available=1,t.strstart++,t.lookahead--;}return t.match_available&&(i=X(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<2?t.strstart:2,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;};function Ot(t,e,a,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=a,this.max_chain=i,this.func=n;}var It=[new Ot(0,0,0,0,St),new Ot(4,4,8,4,Dt),new Ot(4,5,16,8,Dt),new Ot(4,6,32,32,Dt),new Ot(4,4,16,16,Tt),new Ot(8,16,32,32,Tt),new Ot(8,16,128,128,Tt),new Ot(8,32,128,256,Tt),new Ot(32,128,258,1024,Tt),new Ot(32,258,258,4096,Tt)];function Ft(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=ft,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),kt(this.dyn_ltree),kt(this.dyn_dtree),kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),kt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0;}var Lt=function Lt(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.status!==wt&&57!==e.status&&69!==e.status&&73!==e.status&&91!==e.status&&103!==e.status&&e.status!==mt&&e.status!==bt?1:0;},Nt=function Nt(t){if(Lt(t))return gt(t,at);t.total_in=t.total_out=0,t.data_type=_t;var e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=2===e.wrap?57:e.wrap?wt:mt,t.adler=2===e.wrap?0:1,e.last_flush=-2,P(e),tt;},Bt=function Bt(t){var e=Nt(t);var a;return e===tt&&((a=t.state).window_size=2*a.w_size,kt(a.head),a.max_lazy_match=It[a.level].max_lazy,a.good_match=It[a.level].good_length,a.nice_match=It[a.level].nice_length,a.max_chain_length=It[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),e;},Ct=function Ct(t,e,a,i,n,s){if(!t)return at;var r=1;if(e===st&&(e=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||a!==ft||i<8||i>15||e<0||e>9||s<0||s>ht||8===i&&1!==r)return gt(t,at);8===i&&(i=9);var o=new Ft();return t.state=o,o.strm=t,o.status=wt,o.wrap=r,o.gzhead=null,o.w_bits=i,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+3-1)/3),o.window=new Uint8Array(2*o.w_size),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=4*o.lit_bufsize,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=3*(o.lit_bufsize-1),o.level=e,o.strategy=s,o.method=a,Bt(t);};var Mt={deflateInit:function deflateInit(t,e){return Ct(t,e,ft,15,8,dt);},deflateInit2:Ct,deflateReset:Bt,deflateResetKeep:Nt,deflateSetHeader:function deflateSetHeader(t,e){return Lt(t)||2!==t.state.wrap?at:(t.state.gzhead=e,tt);},deflate:function deflate(t,e){if(Lt(t)||e>$||e<0)return t?gt(t,at):at;var a=t.state;if(!t.output||0!==t.avail_in&&!t.input||a.status===bt&&e!==V)return gt(t,0===t.avail_out?nt:at);var i=a.last_flush;if(a.last_flush=e,0!==a.pending){if(xt(t),0===t.avail_out)return a.last_flush=-1,tt;}else if(0===t.avail_in&&pt(e)<=pt(i)&&e!==V)return gt(t,nt);if(a.status===bt&&0!==t.avail_in)return gt(t,nt);if(a.status===wt&&0===a.wrap&&(a.status=mt),a.status===wt){var _e3=ft+(a.w_bits-8<<4)<<8,_i470=-1;if(_i470=a.strategy>=ot||a.level<2?0:a.level<6?1:6===a.level?2:3,_e3|=_i470<<6,0!==a.strstart&&(_e3|=32),_e3+=31-_e3%31,Et(a,_e3),0!==a.strstart&&(Et(a,t.adler>>>16),Et(a,65535&t.adler)),t.adler=1,a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(57===a.status)if(t.adler=0,At(a,31),At(a,139),At(a,8),a.gzhead)At(a,(a.gzhead.text?1:0)+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),At(a,255&a.gzhead.time),At(a,a.gzhead.time>>8&255),At(a,a.gzhead.time>>16&255),At(a,a.gzhead.time>>24&255),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,255&a.gzhead.os),a.gzhead.extra&&a.gzhead.extra.length&&(At(a,255&a.gzhead.extra.length),At(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(t.adler=H(t.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=69;else if(At(a,0),At(a,0),At(a,0),At(a,0),At(a,0),At(a,9===a.level?2:a.strategy>=ot||a.level<2?4:0),At(a,3),a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;if(69===a.status){if(a.gzhead.extra){var _e4=a.pending,_i471=(65535&a.gzhead.extra.length)-a.gzindex;for(;a.pending+_i471>a.pending_buf_size;){var _n=a.pending_buf_size-a.pending;if(a.pending_buf.set(a.gzhead.extra.subarray(a.gzindex,a.gzindex+_n),a.pending),a.pending=a.pending_buf_size,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex+=_n,xt(t),0!==a.pending)return a.last_flush=-1,tt;_e4=0,_i471-=_n;}var _n2=new Uint8Array(a.gzhead.extra);a.pending_buf.set(_n2.subarray(a.gzindex,a.gzindex+_i471),a.pending),a.pending+=_i471,a.gzhead.hcrc&&a.pending>_e4&&(t.adler=H(t.adler,a.pending_buf,a.pending-_e4,_e4)),a.gzindex=0;}a.status=73;}if(73===a.status){if(a.gzhead.name){var _e5,_i472=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i472&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i472,_i472)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i472=0;}_e5=a.gzindex<a.gzhead.name.length?255&a.gzhead.name.charCodeAt(a.gzindex++):0,At(a,_e5);}while(0!==_e5);a.gzhead.hcrc&&a.pending>_i472&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i472,_i472)),a.gzindex=0;}a.status=91;}if(91===a.status){if(a.gzhead.comment){var _e6,_i473=a.pending;do{if(a.pending===a.pending_buf_size){if(a.gzhead.hcrc&&a.pending>_i473&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i473,_i473)),xt(t),0!==a.pending)return a.last_flush=-1,tt;_i473=0;}_e6=a.gzindex<a.gzhead.comment.length?255&a.gzhead.comment.charCodeAt(a.gzindex++):0,At(a,_e6);}while(0!==_e6);a.gzhead.hcrc&&a.pending>_i473&&(t.adler=H(t.adler,a.pending_buf,a.pending-_i473,_i473));}a.status=103;}if(103===a.status){if(a.gzhead.hcrc){if(a.pending+2>a.pending_buf_size&&(xt(t),0!==a.pending))return a.last_flush=-1,tt;At(a,255&t.adler),At(a,t.adler>>8&255),t.adler=0;}if(a.status=mt,xt(t),0!==a.pending)return a.last_flush=-1,tt;}if(0!==t.avail_in||0!==a.lookahead||e!==q&&a.status!==bt){var _i474=0===a.level?St(a,e):a.strategy===ot?function(t,e){var a;for(;;){if(0===t.lookahead&&(Ut(t),0===t.lookahead)){if(e===q)return 1;break;}if(t.match_length=0,a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):a.strategy===lt?function(t,e){var a,i,n,s;var r=t.window;for(;;){if(t.lookahead<=ct){if(Ut(t),t.lookahead<=ct&&e===q)return 1;if(0===t.lookahead)break;}if(t.match_length=0,t.lookahead>=3&&t.strstart>0&&(n=t.strstart-1,i=r[n],i===r[++n]&&i===r[++n]&&i===r[++n])){s=t.strstart+ct;do{}while(i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&i===r[++n]&&n<s);t.match_length=ct-(s-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead);}if(t.match_length>=3?(a=X(t,1,t.match_length-3),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(a=X(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),a&&(zt(t,!1),0===t.strm.avail_out))return 1;}return t.insert=0,e===V?(zt(t,!0),0===t.strm.avail_out?3:4):t.sym_next&&(zt(t,!1),0===t.strm.avail_out)?1:2;}(a,e):It[a.level].func(a,e);if(3!==_i474&&4!==_i474||(a.status=bt),1===_i474||3===_i474)return 0===t.avail_out&&(a.last_flush=-1),tt;if(2===_i474&&(e===J?W(a):e!==$&&(Y(a,0,0,!1),e===Q&&(kt(a.head),0===a.lookahead&&(a.strstart=0,a.block_start=0,a.insert=0))),xt(t),0===t.avail_out))return a.last_flush=-1,tt;}return e!==V?tt:a.wrap<=0?et:(2===a.wrap?(At(a,255&t.adler),At(a,t.adler>>8&255),At(a,t.adler>>16&255),At(a,t.adler>>24&255),At(a,255&t.total_in),At(a,t.total_in>>8&255),At(a,t.total_in>>16&255),At(a,t.total_in>>24&255)):(Et(a,t.adler>>>16),Et(a,65535&t.adler)),xt(t),a.wrap>0&&(a.wrap=-a.wrap),0!==a.pending?tt:et);},deflateEnd:function deflateEnd(t){if(Lt(t))return at;var e=t.state.status;return t.state=null,e===mt?gt(t,it):tt;},deflateSetDictionary:function deflateSetDictionary(t,e){var a=e.length;if(Lt(t))return at;var i=t.state,n=i.wrap;if(2===n||1===n&&i.status!==wt||i.lookahead)return at;if(1===n&&(t.adler=C(t.adler,e,a,0)),i.wrap=0,a>=i.w_size){0===n&&(kt(i.head),i.strstart=0,i.block_start=0,i.insert=0);var _t2=new Uint8Array(i.w_size);_t2.set(e.subarray(a-i.w_size,a),0),e=_t2,a=i.w_size;}var s=t.avail_in,r=t.next_in,o=t.input;for(t.avail_in=a,t.next_in=0,t.input=e,Ut(i);i.lookahead>=3;){var _t3=i.strstart,_e7=i.lookahead-2;do{i.ins_h=yt(i,i.ins_h,i.window[_t3+3-1]),i.prev[_t3&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=_t3,_t3++;}while(--_e7);i.strstart=_t3,i.lookahead=2,Ut(i);}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,t.next_in=r,t.input=o,t.avail_in=s,i.wrap=n,tt;},deflateInfo:"pako deflate (from Nodeca project)"};var Ht=function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e);};var jt=function jt(t){var e=Array.prototype.slice.call(arguments,1);for(;e.length;){var _a7=e.shift();if(_a7){if("object"!=_typeof(_a7))throw new TypeError(_a7+"must be non-object");for(var _e8 in _a7)Ht(_a7,_e8)&&(t[_e8]=_a7[_e8]);}}return t;},Kt=function Kt(t){var e=0;for(var _a8=0,_i475=t.length;_a8<_i475;_a8++)e+=t[_a8].length;var a=new Uint8Array(e);for(var _e9=0,_i476=0,_n3=t.length;_e9<_n3;_e9++){var _n4=t[_e9];a.set(_n4,_i476),_i476+=_n4.length;}return a;};var Pt=!0;try{String.fromCharCode.apply(null,new Uint8Array(1));}catch(t){Pt=!1;}var Yt=new Uint8Array(256);for(var _t4=0;_t4<256;_t4++)Yt[_t4]=_t4>=252?6:_t4>=248?5:_t4>=240?4:_t4>=224?3:_t4>=192?2:1;Yt[254]=Yt[254]=1;var Gt=function Gt(t){if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);var e,a,i,n,s,r=t.length,o=0;for(n=0;n<r;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),o+=a<128?1:a<2048?2:a<65536?3:4;for(e=new Uint8Array(o),s=0,n=0;s<o;n++)a=t.charCodeAt(n),55296==(64512&a)&&n+1<r&&(i=t.charCodeAt(n+1),56320==(64512&i)&&(a=65536+(a-55296<<10)+(i-56320),n++)),a<128?e[s++]=a:a<2048?(e[s++]=192|a>>>6,e[s++]=128|63&a):a<65536?(e[s++]=224|a>>>12,e[s++]=128|a>>>6&63,e[s++]=128|63&a):(e[s++]=240|a>>>18,e[s++]=128|a>>>12&63,e[s++]=128|a>>>6&63,e[s++]=128|63&a);return e;},Xt=function Xt(t,e){var a=e||t.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));var i,n;var s=new Array(2*a);for(n=0,i=0;i<a;){var _e10=t[i++];if(_e10<128){s[n++]=_e10;continue;}var _r2=Yt[_e10];if(_r2>4)s[n++]=65533,i+=_r2-1;else{for(_e10&=2===_r2?31:3===_r2?15:7;_r2>1&&i<a;)_e10=_e10<<6|63&t[i++],_r2--;_r2>1?s[n++]=65533:_e10<65536?s[n++]=_e10:(_e10-=65536,s[n++]=55296|_e10>>10&1023,s[n++]=56320|1023&_e10);}}return function(t,e){if(e<65534&&t.subarray&&Pt)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));var a="";for(var _i477=0;_i477<e;_i477++)a+=String.fromCharCode(t[_i477]);return a;}(s,n);},Wt=function Wt(t,e){(e=e||t.length)>t.length&&(e=t.length);var a=e-1;for(;a>=0&&128==(192&t[a]);)a--;return a<0||0===a?e:a+Yt[t[a]]>e?a:e;};var qt=function qt(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0;};var Jt=Object.prototype.toString,Qt=K.Z_NO_FLUSH,Vt=K.Z_SYNC_FLUSH,$t=K.Z_FULL_FLUSH,te=K.Z_FINISH,ee=K.Z_OK,ae=K.Z_STREAM_END,ie=K.Z_DEFAULT_COMPRESSION,ne=K.Z_DEFAULT_STRATEGY,se=K.Z_DEFLATED;function re(t){this.options=jt({level:ie,method:se,chunkSize:16384,windowBits:15,memLevel:8,strategy:ne},t||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=Mt.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(a!==ee)throw new Error(j[a]);if(e.header&&Mt.deflateSetHeader(this.strm,e.header),e.dictionary){var _t5;if(_t5="string"==typeof e.dictionary?Gt(e.dictionary):"[object ArrayBuffer]"===Jt.call(e.dictionary)?new Uint8Array(e.dictionary):e.dictionary,a=Mt.deflateSetDictionary(this.strm,_t5),a!==ee)throw new Error(j[a]);this._dict_set=!0;}}function oe(t,e){var a=new re(e);if(a.push(t,!0),a.err)throw a.msg||j[a.err];return a.result;}re.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize;var n,s;if(this.ended)return!1;for(s=e===~~e?e:!0===e?te:Qt,"string"==typeof t?a.input=Gt(t):"[object ArrayBuffer]"===Jt.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;)if(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),(s===Vt||s===$t)&&a.avail_out<=6)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else{if(n=Mt.deflate(a,s),n===ae)return a.next_out>0&&this.onData(a.output.subarray(0,a.next_out)),n=Mt.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ee;if(0!==a.avail_out){if(s>0&&a.next_out>0)this.onData(a.output.subarray(0,a.next_out)),a.avail_out=0;else if(0===a.avail_in)break;}else this.onData(a.output);}return!0;},re.prototype.onData=function(t){this.chunks.push(t);},re.prototype.onEnd=function(t){t===ee&&(this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var le={Deflate:re,deflate:oe,deflateRaw:function deflateRaw(t,e){return(e=e||{}).raw=!0,oe(t,e);},gzip:function gzip(t,e){return(e=e||{}).gzip=!0,oe(t,e);},constants:K};var he=16209;var de=function de(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z,A;var E=t.state;a=t.next_in,z=t.input,i=a+(t.avail_in-5),n=t.next_out,A=t.output,s=n-(e-t.avail_out),r=n+(t.avail_out-257),o=E.dmax,l=E.wsize,h=E.whave,d=E.wnext,_=E.window,f=E.hold,c=E.bits,u=E.lencode,w=E.distcode,m=(1<<E.lenbits)-1,b=(1<<E.distbits)-1;t:do{c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=u[f&m];e:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,0===p)A[n++]=65535&g;else{if(!(16&p)){if(0==(64&p)){g=u[(65535&g)+(f&(1<<p)-1)];continue e;}if(32&p){E.mode=16191;break t;}t.msg="invalid literal/length code",E.mode=he;break t;}k=65535&g,p&=15,p&&(c<p&&(f+=z[a++]<<c,c+=8),k+=f&(1<<p)-1,f>>>=p,c-=p),c<15&&(f+=z[a++]<<c,c+=8,f+=z[a++]<<c,c+=8),g=w[f&b];a:for(;;){if(p=g>>>24,f>>>=p,c-=p,p=g>>>16&255,!(16&p)){if(0==(64&p)){g=w[(65535&g)+(f&(1<<p)-1)];continue a;}t.msg="invalid distance code",E.mode=he;break t;}if(v=65535&g,p&=15,c<p&&(f+=z[a++]<<c,c+=8,c<p&&(f+=z[a++]<<c,c+=8)),v+=f&(1<<p)-1,v>o){t.msg="invalid distance too far back",E.mode=he;break t;}if(f>>>=p,c-=p,p=n-s,v>p){if(p=v-p,p>h&&E.sane){t.msg="invalid distance too far back",E.mode=he;break t;}if(y=0,x=_,0===d){if(y+=l-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}else if(d<p){if(y+=l+d-p,p-=d,p<k){k-=p;do{A[n++]=_[y++];}while(--p);if(y=0,d<k){p=d,k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}}}else if(y+=d-p,p<k){k-=p;do{A[n++]=_[y++];}while(--p);y=n-v,x=A;}for(;k>2;)A[n++]=x[y++],A[n++]=x[y++],A[n++]=x[y++],k-=3;k&&(A[n++]=x[y++],k>1&&(A[n++]=x[y++]));}else{y=n-v;do{A[n++]=A[y++],A[n++]=A[y++],A[n++]=A[y++],k-=3;}while(k>2);k&&(A[n++]=A[y++],k>1&&(A[n++]=A[y++]));}break;}}break;}}while(a<i&&n<r);k=c>>3,a-=k,c-=k<<3,f&=(1<<c)-1,t.next_in=a,t.next_out=n,t.avail_in=a<i?i-a+5:5-(a-i),t.avail_out=n<r?r-n+257:257-(n-r),E.hold=f,E.bits=c;};var _e=15,fe=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),ce=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ue=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),we=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var me=function me(t,e,a,i,n,s,r,o){var l=o.bits;var h,d,_,f,c,u,w=0,m=0,b=0,g=0,p=0,k=0,v=0,y=0,x=0,z=0,A=null;var E=new Uint16Array(16),R=new Uint16Array(16);var Z,U,S,D=null;for(w=0;w<=_e;w++)E[w]=0;for(m=0;m<i;m++)E[e[a+m]]++;for(p=l,g=_e;g>=1&&0===E[g];g--);if(p>g&&(p=g),0===g)return n[s++]=20971520,n[s++]=20971520,o.bits=1,0;for(b=1;b<g&&0===E[b];b++);for(p<b&&(p=b),y=1,w=1;w<=_e;w++)if(y<<=1,y-=E[w],y<0)return-1;if(y>0&&(0===t||1!==g))return-1;for(R[1]=0,w=1;w<_e;w++)R[w+1]=R[w]+E[w];for(m=0;m<i;m++)0!==e[a+m]&&(r[R[e[a+m]]++]=m);if(0===t?(A=D=r,u=20):1===t?(A=fe,D=ce,u=257):(A=ue,D=we,u=0),z=0,m=0,w=b,c=s,k=p,v=0,_=-1,x=1<<p,f=x-1,1===t&&x>852||2===t&&x>592)return 1;for(;;){Z=w-v,r[m]+1<u?(U=0,S=r[m]):r[m]>=u?(U=D[r[m]-u],S=A[r[m]-u]):(U=96,S=0),h=1<<w-v,d=1<<k,b=d;do{d-=h,n[c+(z>>v)+d]=Z<<24|U<<16|S|0;}while(0!==d);for(h=1<<w-1;z&h;)h>>=1;if(0!==h?(z&=h-1,z+=h):z=0,m++,0==--E[w]){if(w===g)break;w=e[a+r[m]];}if(w>p&&(z&f)!==_){for(0===v&&(v=p),c+=b,k=w-v,y=1<<k;k+v<g&&(y-=E[k+v],!(y<=0));)k++,y<<=1;if(x+=1<<k,1===t&&x>852||2===t&&x>592)return 1;_=z&f,n[_]=p<<24|k<<16|c-s|0;}}return 0!==z&&(n[c+z]=w-v<<24|64<<16|0),o.bits=p,0;};var be=K.Z_FINISH,ge=K.Z_BLOCK,pe=K.Z_TREES,ke=K.Z_OK,ve=K.Z_STREAM_END,ye=K.Z_NEED_DICT,xe=K.Z_STREAM_ERROR,ze=K.Z_DATA_ERROR,Ae=K.Z_MEM_ERROR,Ee=K.Z_BUF_ERROR,Re=K.Z_DEFLATED,Ze=16180,Ue=16190,Se=16191,De=16192,Te=16194,Oe=16199,Ie=16200,Fe=16206,Le=16209,Ne=function Ne(t){return(t>>>24&255)+(t>>>8&65280)+((65280&t)<<8)+((255&t)<<24);};function Be(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0;}var Ce=function Ce(t){if(!t)return 1;var e=t.state;return!e||e.strm!==t||e.mode<Ze||e.mode>16211?1:0;},Me=function Me(t){if(Ce(t))return xe;var e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=1&e.wrap),e.mode=Ze,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(852),e.distcode=e.distdyn=new Int32Array(592),e.sane=1,e.back=-1,ke;},He=function He(t){if(Ce(t))return xe;var e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,Me(t);},je=function je(t,e){var a;if(Ce(t))return xe;var i=t.state;return e<0?(a=0,e=-e):(a=5+(e>>4),e<48&&(e&=15)),e&&(e<8||e>15)?xe:(null!==i.window&&i.wbits!==e&&(i.window=null),i.wrap=a,i.wbits=e,He(t));},Ke=function Ke(t,e){if(!t)return xe;var a=new Be();t.state=a,a.strm=t,a.window=null,a.mode=Ze;var i=je(t,e);return i!==ke&&(t.state=null),i;};var Pe,Ye,Ge=!0;var Xe=function Xe(t){if(Ge){Pe=new Int32Array(512),Ye=new Int32Array(32);var _e11=0;for(;_e11<144;)t.lens[_e11++]=8;for(;_e11<256;)t.lens[_e11++]=9;for(;_e11<280;)t.lens[_e11++]=7;for(;_e11<288;)t.lens[_e11++]=8;for(me(1,t.lens,0,288,Pe,0,t.work,{bits:9}),_e11=0;_e11<32;)t.lens[_e11++]=5;me(2,t.lens,0,32,Ye,0,t.work,{bits:5}),Ge=!1;}t.lencode=Pe,t.lenbits=9,t.distcode=Ye,t.distbits=5;},We=function We(t,e,a,i){var n;var s=t.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(e.subarray(a-s.wsize,a),0),s.wnext=0,s.whave=s.wsize):(n=s.wsize-s.wnext,n>i&&(n=i),s.window.set(e.subarray(a-i,a-i+n),s.wnext),(i-=n)?(s.window.set(e.subarray(a-i,a),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=n,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=n))),0;};var qe={inflateReset:He,inflateReset2:je,inflateResetKeep:Me,inflateInit:function inflateInit(t){return Ke(t,15);},inflateInit2:Ke,inflate:function inflate(t,e){var a,i,n,s,r,o,l,h,d,_,f,c,u,w,m,b,g,p,k,v,y,x,z=0;var A=new Uint8Array(4);var E,R;var Z=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ce(t)||!t.output||!t.input&&0!==t.avail_in)return xe;a=t.state,a.mode===Se&&(a.mode=De),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,_=o,f=l,x=ke;t:for(;;)switch(a.mode){case Ze:if(0===a.wrap){a.mode=De;break;}for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(2&a.wrap&&35615===h){0===a.wbits&&(a.wbits=15),a.check=0,A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0),h=0,d=0,a.mode=16181;break;}if(a.head&&(a.head.done=!1),!(1&a.wrap)||(((255&h)<<8)+(h>>8))%31){t.msg="incorrect header check",a.mode=Le;break;}if((15&h)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(h>>>=4,d-=4,y=8+(15&h),0===a.wbits&&(a.wbits=y),y>15||y>a.wbits){t.msg="invalid window size",a.mode=Le;break;}a.dmax=1<<a.wbits,a.flags=0,t.adler=a.check=1,a.mode=512&h?16189:Se,h=0,d=0;break;case 16181:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.flags=h,(255&a.flags)!==Re){t.msg="unknown compression method",a.mode=Le;break;}if(57344&a.flags){t.msg="unknown header flags set",a.mode=Le;break;}a.head&&(a.head.text=h>>8&1),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16182;case 16182:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.time=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,a.check=H(a.check,A,4,0)),h=0,d=0,a.mode=16183;case 16183:for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.head&&(a.head.xflags=255&h,a.head.os=h>>8),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0,a.mode=16184;case 16184:if(1024&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length=h,a.head&&(a.head.extra_len=h),512&a.flags&&4&a.wrap&&(A[0]=255&h,A[1]=h>>>8&255,a.check=H(a.check,A,2,0)),h=0,d=0;}else a.head&&(a.head.extra=null);a.mode=16185;case 16185:if(1024&a.flags&&(c=a.length,c>o&&(c=o),c&&(a.head&&(y=a.head.extra_len-a.length,a.head.extra||(a.head.extra=new Uint8Array(a.head.extra_len)),a.head.extra.set(i.subarray(s,s+c),y)),512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,a.length-=c),a.length))break t;a.length=0,a.mode=16186;case 16186:if(2048&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.name+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.name=null);a.length=0,a.mode=16187;case 16187:if(4096&a.flags){if(0===o)break t;c=0;do{y=i[s+c++],a.head&&y&&a.length<65536&&(a.head.comment+=String.fromCharCode(y));}while(y&&c<o);if(512&a.flags&&4&a.wrap&&(a.check=H(a.check,i,c,s)),o-=c,s+=c,y)break t;}else a.head&&(a.head.comment=null);a.mode=16188;case 16188:if(512&a.flags){for(;d<16;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(65535&a.check)){t.msg="header crc mismatch",a.mode=Le;break;}h=0,d=0;}a.head&&(a.head.hcrc=a.flags>>9&1,a.head.done=!0),t.adler=a.check=0,a.mode=Se;break;case 16189:for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}t.adler=a.check=Ne(h),h=0,d=0,a.mode=Ue;case Ue:if(0===a.havedict)return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,ye;t.adler=a.check=1,a.mode=Se;case Se:if(e===ge||e===pe)break t;case De:if(a.last){h>>>=7&d,d-=7&d,a.mode=Fe;break;}for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}switch(a.last=1&h,h>>>=1,d-=1,3&h){case 0:a.mode=16193;break;case 1:if(Xe(a),a.mode=Oe,e===pe){h>>>=2,d-=2;break t;}break;case 2:a.mode=16196;break;case 3:t.msg="invalid block type",a.mode=Le;}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if((65535&h)!=(h>>>16^65535)){t.msg="invalid stored block lengths",a.mode=Le;break;}if(a.length=65535&h,h=0,d=0,a.mode=Te,e===pe)break t;case Te:a.mode=16195;case 16195:if(c=a.length,c){if(c>o&&(c=o),c>l&&(c=l),0===c)break t;n.set(i.subarray(s,s+c),r),o-=c,s+=c,l-=c,r+=c,a.length-=c;break;}a.mode=Se;break;case 16196:for(;d<14;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(a.nlen=257+(31&h),h>>>=5,d-=5,a.ndist=1+(31&h),h>>>=5,d-=5,a.ncode=4+(15&h),h>>>=4,d-=4,a.nlen>286||a.ndist>30){t.msg="too many length or distance symbols",a.mode=Le;break;}a.have=0,a.mode=16197;case 16197:for(;a.have<a.ncode;){for(;d<3;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.lens[Z[a.have++]]=7&h,h>>>=3,d-=3;}for(;a.have<19;)a.lens[Z[a.have++]]=0;if(a.lencode=a.lendyn,a.lenbits=7,E={bits:a.lenbits},x=me(0,a.lens,0,19,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid code lengths set",a.mode=Le;break;}a.have=0,a.mode=16198;case 16198:for(;a.have<a.nlen+a.ndist;){for(;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(g<16)h>>>=m,d-=m,a.lens[a.have++]=g;else{if(16===g){for(R=m+2;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(h>>>=m,d-=m,0===a.have){t.msg="invalid bit length repeat",a.mode=Le;break;}y=a.lens[a.have-1],c=3+(3&h),h>>>=2,d-=2;}else if(17===g){for(R=m+3;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=3+(7&h),h>>>=3,d-=3;}else{for(R=m+7;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=m,d-=m,y=0,c=11+(127&h),h>>>=7,d-=7;}if(a.have+c>a.nlen+a.ndist){t.msg="invalid bit length repeat",a.mode=Le;break;}for(;c--;)a.lens[a.have++]=y;}}if(a.mode===Le)break;if(0===a.lens[256]){t.msg="invalid code -- missing end-of-block",a.mode=Le;break;}if(a.lenbits=9,E={bits:a.lenbits},x=me(1,a.lens,0,a.nlen,a.lencode,0,a.work,E),a.lenbits=E.bits,x){t.msg="invalid literal/lengths set",a.mode=Le;break;}if(a.distbits=6,a.distcode=a.distdyn,E={bits:a.distbits},x=me(2,a.lens,a.nlen,a.ndist,a.distcode,0,a.work,E),a.distbits=E.bits,x){t.msg="invalid distances set",a.mode=Le;break;}if(a.mode=Oe,e===pe)break t;case Oe:a.mode=Ie;case Ie:if(o>=6&&l>=258){t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,de(t,f),r=t.next_out,n=t.output,l=t.avail_out,s=t.next_in,i=t.input,o=t.avail_in,h=a.hold,d=a.bits,a.mode===Se&&(a.back=-1);break;}for(a.back=0;z=a.lencode[h&(1<<a.lenbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(b&&0==(240&b)){for(p=m,k=b,v=g;z=a.lencode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,a.length=g,0===b){a.mode=16205;break;}if(32&b){a.back=-1,a.mode=Se;break;}if(64&b){t.msg="invalid literal/length code",a.mode=Le;break;}a.extra=15&b,a.mode=16201;case 16201:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.length+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}a.was=a.length,a.mode=16202;case 16202:for(;z=a.distcode[h&(1<<a.distbits)-1],m=z>>>24,b=z>>>16&255,g=65535&z,!(m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(0==(240&b)){for(p=m,k=b,v=g;z=a.distcode[v+((h&(1<<p+k)-1)>>p)],m=z>>>24,b=z>>>16&255,g=65535&z,!(p+m<=d);){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}h>>>=p,d-=p,a.back+=p;}if(h>>>=m,d-=m,a.back+=m,64&b){t.msg="invalid distance code",a.mode=Le;break;}a.offset=g,a.extra=15&b,a.mode=16203;case 16203:if(a.extra){for(R=a.extra;d<R;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}a.offset+=h&(1<<a.extra)-1,h>>>=a.extra,d-=a.extra,a.back+=a.extra;}if(a.offset>a.dmax){t.msg="invalid distance too far back",a.mode=Le;break;}a.mode=16204;case 16204:if(0===l)break t;if(c=f-l,a.offset>c){if(c=a.offset-c,c>a.whave&&a.sane){t.msg="invalid distance too far back",a.mode=Le;break;}c>a.wnext?(c-=a.wnext,u=a.wsize-c):u=a.wnext-c,c>a.length&&(c=a.length),w=a.window;}else w=n,u=r-a.offset,c=a.length;c>l&&(c=l),l-=c,a.length-=c;do{n[r++]=w[u++];}while(--c);0===a.length&&(a.mode=Ie);break;case 16205:if(0===l)break t;n[r++]=a.length,l--,a.mode=Ie;break;case Fe:if(a.wrap){for(;d<32;){if(0===o)break t;o--,h|=i[s++]<<d,d+=8;}if(f-=l,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,r-f):C(a.check,n,f,r-f)),f=l,4&a.wrap&&(a.flags?h:Ne(h))!==a.check){t.msg="incorrect data check",a.mode=Le;break;}h=0,d=0;}a.mode=16207;case 16207:if(a.wrap&&a.flags){for(;d<32;){if(0===o)break t;o--,h+=i[s++]<<d,d+=8;}if(4&a.wrap&&h!==(4294967295&a.total)){t.msg="incorrect length check",a.mode=Le;break;}h=0,d=0;}a.mode=16208;case 16208:x=ve;break t;case Le:x=ze;break t;case 16210:return Ae;default:return xe;}return t.next_out=r,t.avail_out=l,t.next_in=s,t.avail_in=o,a.hold=h,a.bits=d,(a.wsize||f!==t.avail_out&&a.mode<Le&&(a.mode<Fe||e!==be))&&We(t,t.output,t.next_out,f-t.avail_out),_-=t.avail_in,f-=t.avail_out,t.total_in+=_,t.total_out+=f,a.total+=f,4&a.wrap&&f&&(t.adler=a.check=a.flags?H(a.check,n,f,t.next_out-f):C(a.check,n,f,t.next_out-f)),t.data_type=a.bits+(a.last?64:0)+(a.mode===Se?128:0)+(a.mode===Oe||a.mode===Te?256:0),(0===_&&0===f||e===be)&&x===ke&&(x=Ee),x;},inflateEnd:function inflateEnd(t){if(Ce(t))return xe;var e=t.state;return e.window&&(e.window=null),t.state=null,ke;},inflateGetHeader:function inflateGetHeader(t,e){if(Ce(t))return xe;var a=t.state;return 0==(2&a.wrap)?xe:(a.head=e,e.done=!1,ke);},inflateSetDictionary:function inflateSetDictionary(t,e){var a=e.length;var i,n,s;return Ce(t)?xe:(i=t.state,0!==i.wrap&&i.mode!==Ue?xe:i.mode===Ue&&(n=1,n=C(n,e,a,0),n!==i.check)?ze:(s=We(t,e,a,a),s?(i.mode=16210,Ae):(i.havedict=1,ke)));},inflateInfo:"pako inflate (from Nodeca project)"};var Je=function Je(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1;};var Qe=Object.prototype.toString,Ve=K.Z_NO_FLUSH,$e=K.Z_FINISH,ta=K.Z_OK,ea=K.Z_STREAM_END,aa=K.Z_NEED_DICT,ia=K.Z_STREAM_ERROR,na=K.Z_DATA_ERROR,sa=K.Z_MEM_ERROR;function ra(t){this.options=jt({chunkSize:65536,windowBits:15,to:""},t||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,0===e.windowBits&&(e.windowBits=-15)),!(e.windowBits>=0&&e.windowBits<16)||t&&t.windowBits||(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&0==(15&e.windowBits)&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new qt(),this.strm.avail_out=0;var a=qe.inflateInit2(this.strm,e.windowBits);if(a!==ta)throw new Error(j[a]);if(this.header=new Je(),qe.inflateGetHeader(this.strm,this.header),e.dictionary&&("string"==typeof e.dictionary?e.dictionary=Gt(e.dictionary):"[object ArrayBuffer]"===Qe.call(e.dictionary)&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(a=qe.inflateSetDictionary(this.strm,e.dictionary),a!==ta)))throw new Error(j[a]);}function oa(t,e){var a=new ra(e);if(a.push(t),a.err)throw a.msg||j[a.err];return a.result;}ra.prototype.push=function(t,e){var a=this.strm,i=this.options.chunkSize,n=this.options.dictionary;var s,r,o;if(this.ended)return!1;for(r=e===~~e?e:!0===e?$e:Ve,"[object ArrayBuffer]"===Qe.call(t)?a.input=new Uint8Array(t):a.input=t,a.next_in=0,a.avail_in=a.input.length;;){for(0===a.avail_out&&(a.output=new Uint8Array(i),a.next_out=0,a.avail_out=i),s=qe.inflate(a,r),s===aa&&n&&(s=qe.inflateSetDictionary(a,n),s===ta?s=qe.inflate(a,r):s===na&&(s=aa));a.avail_in>0&&s===ea&&a.state.wrap>0&&0!==t[a.next_in];)qe.inflateReset(a),s=qe.inflate(a,r);switch(s){case ia:case na:case aa:case sa:return this.onEnd(s),this.ended=!0,!1;}if(o=a.avail_out,a.next_out&&(0===a.avail_out||s===ea))if("string"===this.options.to){var _t6=Wt(a.output,a.next_out),_e12=a.next_out-_t6,_n5=Xt(a.output,_t6);a.next_out=_e12,a.avail_out=i-_e12,_e12&&a.output.set(a.output.subarray(_t6,_t6+_e12),0),this.onData(_n5);}else this.onData(a.output.length===a.next_out?a.output:a.output.subarray(0,a.next_out));if(s!==ta||0!==o){if(s===ea)return s=qe.inflateEnd(this.strm),this.onEnd(s),this.ended=!0,!0;if(0===a.avail_in)break;}}return!0;},ra.prototype.onData=function(t){this.chunks.push(t);},ra.prototype.onEnd=function(t){t===ta&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=Kt(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg;};var la={Inflate:ra,inflate:oa,inflateRaw:function inflateRaw(t,e){return(e=e||{}).raw=!0,oa(t,e);},ungzip:oa,constants:K};var ha=le.Deflate,da=le.deflate,_a=le.deflateRaw,fa=le.gzip,ca=la.Inflate,ua=la.inflate,wa=la.inflateRaw,ma=la.ungzip;var ba=ha,ga=da,pa=_a,ka=fa,va=ca,ya=ua,xa=wa,za=ma,Aa=K,Ea={Deflate:ba,deflate:ga,deflateRaw:pa,gzip:ka,Inflate:va,inflate:ya,inflateRaw:xa,ungzip:za,constants:Aa};t.Deflate=ba,t.Inflate=va,t.constants=Aa,t["default"]=Ea,t.deflate=ga,t.deflateRaw=pa,t.gzip=ka,t.inflate=ya,t.inflateRaw=xa,t.ungzip=za,Object.defineProperty(t,"__esModule",{value:!0});});var p=/*#__PURE__*/Object.freeze({__proto__:null});/*
|
|
19751
19762
|
Parser for .XTC Format V10
|
|
19752
19763
|
*/var pako=window.pako||p;if(!pako.inflate){// See https://github.com/nodeca/pako/issues/97
|
|
19753
|
-
pako=pako["default"];}var tempVec4a$
|
|
19764
|
+
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?
|
|
19754
19765
|
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
|
|
19755
|
-
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
|
|
19766
|
+
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
|
|
19756
19767
|
if(metaModel){metaModel.loadData(metadata,{includeTypes:options.includeTypes,excludeTypes:options.excludeTypes,globalizeObjectIds:options.globalizeObjectIds});// Can be empty
|
|
19757
19768
|
}// Create textures
|
|
19758
|
-
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
|
|
19759
|
-
var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
19760
|
-
var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
19761
|
-
var wrapR=eachTextureAttributes[textureAttrBaseIdx+8];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
19762
|
-
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,
|
|
19763
|
-
minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR});}}}// Create texture sets
|
|
19764
|
-
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
|
|
19765
|
-
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
|
|
19766
|
-
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
|
|
19767
|
-
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
|
|
19768
|
-
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
|
|
19769
|
-
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
|
|
19770
|
-
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
|
|
19771
|
-
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
|
|
19772
|
-
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
|
|
19773
|
-
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};/*
|
|
19774
|
-
Parser for .XTC Format V11
|
|
19775
|
-
*/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
|
|
19776
|
-
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?
|
|
19777
|
-
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
|
|
19778
|
-
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
|
|
19779
|
-
}// Create textures
|
|
19780
19769
|
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
|
|
19781
19770
|
var wrapS=eachTextureAttributes[textureAttrBaseIdx+6];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
19782
19771
|
var wrapT=eachTextureAttributes[textureAttrBaseIdx+7];// ClampToEdgeWrapping | MirroredRepeatWrapping | RepeatWrapping
|
|
@@ -19789,15 +19778,10 @@ var tileCenter=math.vec3();var rtcAABB=math.AABB3();var geometryArraysCache={};f
|
|
|
19789
19778
|
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
|
|
19790
19779
|
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
|
|
19791
19780
|
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
|
|
19792
|
-
for(var
|
|
19793
|
-
var meshMatrixIndex=eachMeshMatricesPortion[
|
|
19794
|
-
var geometryArrays=geometryArraysCache[geometryId];if(!geometryArrays){geometryArrays={batchThisMesh:!options.reuseGeometries};var primitiveType=eachGeometryPrimitiveType[
|
|
19795
|
-
var
|
|
19796
|
-
// To efficiently create typed arrays from this buffer,
|
|
19797
|
-
// each typed array's source data needs to be aligned with its element byte size.
|
|
19798
|
-
// This sometimes requires padding subarrays inside the single Uint8Array, so the byteOffset needs to be stored alongside element count.
|
|
19799
|
-
// It is a different encoding than used in earlier versions, and requires different approach to parsing elements.
|
|
19800
|
-
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;
|
|
19781
|
+
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
|
|
19782
|
+
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
|
|
19783
|
+
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
|
|
19784
|
+
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;
|
|
19801
19785
|
// parsers[ParserV2.version] = ParserV2;
|
|
19802
19786
|
// parsers[ParserV3.version] = ParserV3;
|
|
19803
19787
|
// parsers[ParserV4.version] = ParserV4;
|
|
@@ -19806,7 +19790,7 @@ var ParserV11={version:11,parseArrayBuffer:function parseArrayBuffer(viewer,opti
|
|
|
19806
19790
|
// parsers[ParserV7.version] = ParserV7;
|
|
19807
19791
|
// parsers[ParserV8.version] = ParserV8;
|
|
19808
19792
|
// parsers[ParserV9.version] = ParserV9;
|
|
19809
|
-
parsers[ParserV10.version]=ParserV10
|
|
19793
|
+
parsers[ParserV10.version]=ParserV10;/**
|
|
19810
19794
|
* {@link Viewer} plugin that loads models from xeokit's optimized *````.XTC````* format.
|
|
19811
19795
|
*
|
|
19812
19796
|
* <a href="https://xeokit.github.io/xeokit-sdk/examples/#loading_XTC_OTCConferenceCenter"><img src="http://xeokit.io/img/docs/XTCLoaderPlugin/XTCLoaderPlugin.png"></a>
|
|
@@ -20560,18 +20544,15 @@ parsers[ParserV10.version]=ParserV10;parsers[ParserV11.version]=ParserV11;/**
|
|
|
20560
20544
|
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
|
|
20561
20545
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
20562
20546
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
20563
|
-
* @param {Number} [params.renderOrder=0] Specifies the rendering order for the model. This is used to control the order in which
|
|
20564
|
-
* SceneModels are drawn when they have transparent objects, to give control over the order in which those objects are blended within the transparent
|
|
20565
|
-
* render pass.
|
|
20566
20547
|
* @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}.
|
|
20567
20548
|
*/},{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
|
|
20568
|
-
}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&¶ms.reuseGeometries!==undefined?params.reuseGeometries:this._reuseGeometries!==false;if(includeTypes){options.includeTypesMap={};for(var
|
|
20549
|
+
}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&¶ms.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&¶ms.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
|
|
20569
20550
|
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);
|
|
20570
20551
|
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
|
|
20571
20552
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
20572
20553
|
});};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++);}};//模型文件
|
|
20573
20554
|
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
|
|
20574
|
-
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,
|
|
20555
|
+
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()
|
|
20575
20556
|
});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) {
|
|
20576
20557
|
//
|
|
20577
20558
|
// const metaModelId = sceneModel.id;
|
|
@@ -20910,7 +20891,7 @@ subs[subId]={callback:callback};this._eventSubEvents[subId]=event;var value=this
|
|
|
20910
20891
|
*
|
|
20911
20892
|
* @param {String} subId Subscription ID
|
|
20912
20893
|
*/},{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
|
|
20913
|
-
}}}]);}();function resolvePath(key,json){if(json[key]){return json[key];}var parts=key.split(".");var obj=json;for(var
|
|
20894
|
+
}}}]);}();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];});}/**
|
|
20914
20895
|
* @desc Abstract base class for curve classes.
|
|
20915
20896
|
*/var Curve=/*#__PURE__*/function(_Component28){/**
|
|
20916
20897
|
* @constructor
|
|
@@ -21055,7 +21036,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
21055
21036
|
* 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.
|
|
21056
21037
|
*
|
|
21057
21038
|
* @param {{t:Number, eye:Object, look:Object, up: Object}[]} frames Frames to add to this CameraPath.
|
|
21058
|
-
*/},{key:"addFrames",value:function addFrames(frames){var frame;for(var
|
|
21039
|
+
*/},{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);}}/**
|
|
21059
21040
|
* Sets the position of the {@link Camera} to a position interpolated within this CameraPath at the given time instant.
|
|
21060
21041
|
*
|
|
21061
21042
|
* @param {Number} t Time instant.
|
|
@@ -21071,7 +21052,7 @@ comparison=arcLengths[i]-targetArcLength;if(comparison<0){low=i+1;}else if(compa
|
|
|
21071
21052
|
* when animated by {@link CameraPathAnimation}, the {@link Camera} will move along the path at a constant rate.
|
|
21072
21053
|
*
|
|
21073
21054
|
* @param {Number} duration The total duration for this CameraPath.
|
|
21074
|
-
*/},{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
|
|
21055
|
+
*/},{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;}}/**
|
|
21075
21056
|
* Removes all frames from this CameraPath.
|
|
21076
21057
|
*/},{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();/**
|
|
21077
21058
|
* @desc Jumps or flies the {@link Scene}'s {@link Camera} to a given target.
|
|
@@ -21765,7 +21746,7 @@ var positions=K3D.edit.unwrap(m.i_verts,m.c_verts,3);var normals=K3D.edit.unwrap
|
|
|
21765
21746
|
* @param {Number} [cfg.size=1] Dimension on the X and Z-axis.
|
|
21766
21747
|
* @param {Number} [cfg.divisions=1] Number of divisions on X and Z axis..
|
|
21767
21748
|
* @returns {Object} Configuration for a {@link Geometry} subtype.
|
|
21768
|
-
*/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
|
|
21749
|
+
*/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});}/**
|
|
21769
21750
|
* @desc Creates a plane-shaped {@link Geometry}.
|
|
21770
21751
|
*
|
|
21771
21752
|
* ## Usage
|
|
@@ -23587,7 +23568,7 @@ v edgeBias: 0.2,
|
|
|
23587
23568
|
* @param {Number[]} [cfg.color=[0,0,0]] The color of this ````LineSet````. This is both emissive and diffuse.
|
|
23588
23569
|
* @param {Boolean} [cfg.visible=true] Indicates whether or not this ````LineSet```` is visible.
|
|
23589
23570
|
* @param {Number} [cfg.opacity=1.0] ````LineSet````'s initial opacity factor.
|
|
23590
|
-
*/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
|
|
23571
|
+
*/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
|
|
23591
23572
|
});_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;}/**
|
|
23592
23573
|
* Sets if this ````LineSet```` is visible.
|
|
23593
23574
|
*
|
|
@@ -23810,7 +23791,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
|
|
|
23810
23791
|
* @returns {Boolean} ````true```` if this PointLight casts shadows.
|
|
23811
23792
|
*/function get(){return this._state.castsShadow;}/**
|
|
23812
23793
|
* Destroys this PointLight.
|
|
23813
|
-
*/,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
|
|
23794
|
+
*/,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;}/**
|
|
23814
23795
|
* @desc A cube texture map.
|
|
23815
23796
|
*/var CubeTexture=/*#__PURE__*/function(_Component36){/**
|
|
23816
23797
|
* @constructor
|
|
@@ -23827,7 +23808,7 @@ if(!self._shadowProjMatrix){self._shadowProjMatrix=math.identityMat4();}var _can
|
|
|
23827
23808
|
// this._state.texture.setImage(this._images, this._state);
|
|
23828
23809
|
// this._state.texture.setProps(this._state);
|
|
23829
23810
|
// } else
|
|
23830
|
-
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(
|
|
23811
|
+
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);}}/**
|
|
23831
23812
|
* Destroys this CubeTexture
|
|
23832
23813
|
*
|
|
23833
23814
|
*/},{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);/**
|
|
@@ -24183,14 +24164,14 @@ this._occluded=!visible;this._mesh.visible=this._visible&&!this._occluded;_super
|
|
|
24183
24164
|
* @param {boolean} [mask.pickable] Saves {@link Entity#pickable} values when ````true````.
|
|
24184
24165
|
* @param {boolean} [mask.colorize] Saves {@link Entity#colorize} values when ````true````.
|
|
24185
24166
|
* @param {boolean} [mask.opacity] Saves {@link Entity#opacity} values when ````true````.
|
|
24186
|
-
*/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
|
|
24167
|
+
*/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++;}}/**
|
|
24187
24168
|
* Restores a {@link Scene}'s {@link Entity}'s to their state previously captured with {@link ModelMemento#saveObjects}.
|
|
24188
24169
|
*
|
|
24189
24170
|
* Assumes that the model has not been destroyed or modified since saving.
|
|
24190
24171
|
*
|
|
24191
24172
|
* @param {Scene} scene The scene that was given to {@link ModelMemento#saveObjects}.
|
|
24192
24173
|
* @param {MetaModel} metaModel The metamodel that was given to {@link ModelMemento#saveObjects}.
|
|
24193
|
-
*/},{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
|
|
24174
|
+
*/},{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];}}}}]);}();/**
|
|
24194
24175
|
* @desc A {@link Curve} along which a 3D position can be animated.
|
|
24195
24176
|
*
|
|
24196
24177
|
* * As shown in the diagram below, a CubicBezierCurve is defined by four control points.
|
|
@@ -24680,14 +24661,17 @@ entity:scene.objects[_this124._lastPickedEntityId]},true);}cameraControl.fire("h
|
|
|
24680
24661
|
_this124._lastPickedEntityId=pickedEntityId;}}cameraControl.fire("hover",pickController.pickResult,true);if(pickController.pickResult.worldPos||pickController.pickResult.snappedWorldPos){// Hovering the surface of an entity
|
|
24681
24662
|
cameraControl.fire("hoverSurface",pickController.pickResult,true);}}else{if(_this124._lastPickedEntityId!==undefined){cameraControl.fire("hoverOut",{// Hovered off an entity
|
|
24682
24663
|
entity:scene.objects[_this124._lastPickedEntityId]},true);_this124._lastPickedEntityId=undefined;}cameraControl.fire("hoverOff",{// Not hovering on any entity
|
|
24683
|
-
canvasPos:pickController.pickCursorPos},true);}}});this.canvas.addEventListener("mousemove",tickifiedMouseMoveFn);this.canvas.addEventListener("dblclick",this._canvasDblClickHandler=function(e){states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(
|
|
24684
|
-
|
|
24664
|
+
canvasPos:pickController.pickCursorPos},true);}}});this.canvas.addEventListener("mousemove",tickifiedMouseMoveFn);this.canvas.addEventListener("dblclick",this._canvasDblClickHandler=function(e){states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
|
|
24665
|
+
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();}var pickResult=pickController.pickResult;if(pickResult){cameraControl.fire("doublePicked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("doublePickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("doublePickedNothing",{canvasPos:states.pointerCanvasPos},true);}});this.canvas.addEventListener("mousedown",this._canvasMouseDownHandler=function(e){if(e.which===1){leftDown=true;}if(e.which===3){rightDown=true;}var leftButtonDown=e.which===1;if(!leftButtonDown){return;}if(!(configs.active&&configs.pointerEnabled)){return;}// Left mouse button down to start pivoting
|
|
24666
|
+
states.mouseDownClientX=e.clientX;states.mouseDownClientY=e.clientY;states.mouseDownCursorX=states.pointerCanvasPos[0];states.mouseDownCursorY=states.pointerCanvasPos[1];if(!configs.firstPerson&&configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
|
|
24667
|
+
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(e.which===1){// Left button
|
|
24685
24668
|
var pickResult=pickController.pickResult;if(pickResult&&pickResult.worldPos){pivotController.setCanvasPivotPos(states.pointerCanvasPos);cameraControl.fire("mouseDownEntity",pickController.pickResult,true);}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{pivotController.setPivotPos(scene.camera.look);}pivotController.startPivot();cameraControl.fire("mouseDownNothing",pickController.pickResult,true);}}}});document.addEventListener("mouseup",this._documentMouseUpHandler=function(e){if(e.which===1){leftDown=false;}if(e.which===3){rightDown=false;}if(pivotController.getPivoting()){pivotController.endPivot();}});this.canvas.addEventListener("mouseup",this._canvasMouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}var leftButtonUp=e.which===1;if(!leftButtonUp){return;}// Left mouse button up to possibly pick or double-pick
|
|
24686
24669
|
pivotController.hidePivot();if(Math.abs(e.clientX-states.mouseDownClientX)>3||Math.abs(e.clientY-states.mouseDownClientY)>3){return;}var pickedSubs=cameraControl.hasSubs("picked");var pickedNothingSubs=cameraControl.hasSubs("pickedNothing");var pickedSurfaceSubs=cameraControl.hasSubs("pickedSurface");var doublePickedSubs=cameraControl.hasSubs("doublePicked");var doublePickedSurfaceSubs=cameraControl.hasSubs("doublePickedSurface");var doublePickedNothingSubs=cameraControl.hasSubs("doublePickedNothing");if(!configs.doublePickFlyTo&&!doublePickedSubs&&!doublePickedSurfaceSubs&&!doublePickedNothingSubs){// Avoid the single/double click differentiation timeout
|
|
24687
24670
|
if(pickedSubs||pickedNothingSubs||pickedSurfaceSubs){pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=true;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();if(pickController.pickResult){cameraControl.fire("picked",pickController.pickResult,true);if(pickController.pickedSurface){cameraControl.fire("pickedSurface",pickController.pickResult,true);}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}}_this124._clicks=0;return;}// this._clicks++;
|
|
24688
24671
|
// if (this._clicks === 1) {
|
|
24689
24672
|
// First click
|
|
24690
|
-
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this124._timeout=setTimeout(function(){if(firstClickPickResult){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);if(
|
|
24673
|
+
pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePickEntity=configs.doublePickFlyTo;pickController.schedulePickSurface=pickedSurfaceSubs;pickController.update();var firstClickPickResult=pickController.pickResult;var firstClickPickSurface=pickController.pickedSurface;_this124._timeout=setTimeout(function(){if(firstClickPickResult){cameraControl.fire("picked",firstClickPickResult,true);if(firstClickPickSurface){cameraControl.fire("pickedSurface",firstClickPickResult,true);if(configs.followPointer){// if (!configs.firstPerson && configs.followPointer) {
|
|
24674
|
+
controllers.pivotController.setPivotPos(firstClickPickResult.worldPos);if(controllers.pivotController.startPivot()){controllers.pivotController.showPivot();}}}}else{cameraControl.fire("pickedNothing",{canvasPos:states.pointerCanvasPos},true);}_this124._clicks=0;},configs.doubleClickTimeFrame);// }
|
|
24691
24675
|
// else {
|
|
24692
24676
|
// // Second click
|
|
24693
24677
|
// if (this._timeout !== null) {
|
|
@@ -24738,7 +24722,7 @@ pickController.pickCursorPos=states.pointerCanvasPos;pickController.schedulePick
|
|
|
24738
24722
|
// }
|
|
24739
24723
|
},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;}}}]);}();/**
|
|
24740
24724
|
* @private
|
|
24741
|
-
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,
|
|
24725
|
+
*/var KeyboardPanRotateDollyHandler=/*#__PURE__*/function(){function KeyboardPanRotateDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this125=this;_classCallCheck(this,KeyboardPanRotateDollyHandler);this._scene=scene;this._updates=updates;this._cameraControl=cameraControl;var input=scene.input;this.input=input;var keyDownMap=[];this._movespeed=1;var canvas=scene.canvas.canvas;var enableSetSpeedUp=false;var enableSetSpeedDown=false;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";}if(keyCode===input.KEY_EQUAL_SIGN){if(!enableSetSpeedUp){enableSetSpeedUp=true;console.log("KEY_EQUAL_SIGN",enableSetSpeedUp);}}if(keyCode===input.KEY_DASH){if(!enableSetSpeedDown){enableSetSpeedDown=true;console.log("KEY_DASH",enableSetSpeedDown);}}});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();}if(keyCode===input.KEY_ADD){enableSetSpeedUp=false;}if(keyCode===input.KEY_SUBTRACT){enableSetSpeedDown=false;}});//碰撞停止
|
|
24742
24726
|
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;//-------------------------------------------------------------------------------------------------
|
|
24743
24727
|
// Keyboard rotation
|
|
24744
24728
|
//-------------------------------------------------------------------------------------------------
|
|
@@ -24746,10 +24730,10 @@ if(!configs.planView){var rotateYPos=cameraControl._isKeyDownForAction(cameraCon
|
|
|
24746
24730
|
// Keyboard panning
|
|
24747
24731
|
//-------------------------------------------------------------------------------------------------
|
|
24748
24732
|
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*_this125._movespeed;}else if(dollyBackwards){updates.dollyDelta+=dollyDelta*_this125._movespeed;}if(mouseMovedSinceLastKeyboardDolly){states.followPointerDirty=true;mouseMovedSinceLastKeyboardDolly=false;}}}// 调整移动速度
|
|
24749
|
-
var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this125._movespeed
|
|
24733
|
+
var speedUP=cameraControl._isKeyDownForAction(cameraControl.SPEED_UP,keyDownMap);var speedDown=cameraControl._isKeyDownForAction(cameraControl.SPEED_DOWN,keyDownMap);if(speedUP||speedDown){if(enableSetSpeedUp){if(_this125._movespeed<=2.5){if(_this125._movespeed==0.2){_this125._movespeed+=0.3;}else if(_this125._movespeed==0.5||_this125._movespeed==1||_this125._movespeed==1.5||_this125._movespeed==2){_this125._movespeed+=0.5;}else if(_this125._movespeed==2.5){_this125._movespeed+=1.5;}}else{_this125._movespeed=4;}_this125._cameraControl.fire("personModeSpeedUp",_this125._movespeed);enableSetSpeedUp=false;}if(enableSetSpeedDown){if(_this125._movespeed==4){_this125._movespeed-=1.5;}if(_this125._movespeed==1||_this125._movespeed==1.5||_this125._movespeed==2||_this125._movespeed==2.5){_this125._movespeed-=0.5;}else{_this125._movespeed=0.2;}_this125._cameraControl.fire("personModeSpeedDown",_this125._movespeed);enableSetSpeedDown=false;}}//判断是否能用
|
|
24750
24734
|
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);// const panDelta = (keyDownMap[input.KEY_ALT] ? 0.3 : 1.0) * elapsedSecs * configs.keyboardPanRate; // ALT for slower pan rate
|
|
24751
24735
|
var panDelta=_this125._movespeed*elapsedSecs*configs.keyboardPanRate;// ALT for slower pan rate
|
|
24752
|
-
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:"movespeed",get:function get(){return this._movespeed;},set:function set(value){this._movespeed=value;}},{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
|
|
24736
|
+
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:"movespeed",get:function get(){return this._movespeed;},set:function set(value){this._movespeed=value;}},{key:"speedUp",value:function speedUp(){if(this._movespeed<=2.5){if(this._movespeed==0.2){this._movespeed+=0.3;}else if(this._movespeed==0.5||this._movespeed==1||this._movespeed==1.5||this._movespeed==2){this._movespeed+=0.5;}else if(this._movespeed==2.5){this._movespeed+=1.5;}else if(this._movespee==4){this._movespeed+=4;}}else{this._movespeed=8;}this._cameraControl.fire("personModeSpeedUp",this._movespeed);}},{key:"speedDown",value:function speedDown(){if(this._movespeed==8){this._movespeed-=4;}else if(this._movespeed==4){this._movespeed-=1.5;}else if(this._movespeed==1||this._movespeed==1.5||this._movespeed==2||this._movespeed==2.5){this._movespeed-=0.5;}else{this._movespeed=0.2;}this._cameraControl.fire("personModeSpeedDown",this._movespeed);}},{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
|
|
24753
24737
|
var EPSILON=0.001;var tempVec3=math.vec3();/**
|
|
24754
24738
|
* Handles camera updates on each "tick" that were scheduled by the various controllers.
|
|
24755
24739
|
*
|
|
@@ -24792,7 +24776,7 @@ if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEn
|
|
|
24792
24776
|
* @private
|
|
24793
24777
|
*/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);
|
|
24794
24778
|
pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
|
|
24795
|
-
}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var
|
|
24779
|
+
}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
|
|
24796
24780
|
return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
|
|
24797
24781
|
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
|
|
24798
24782
|
// We don't want to rotate in this case (weird behavior)
|
|
@@ -24817,7 +24801,7 @@ updates.rotateDeltaX+=yPanDelta/canvasHeight*(configs.dragRotationRate*1.5);// H
|
|
|
24817
24801
|
// }
|
|
24818
24802
|
}}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
|
|
24819
24803
|
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
|
|
24820
|
-
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
|
|
24804
|
+
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;};/**
|
|
24821
24805
|
* @private
|
|
24822
24806
|
*/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
|
|
24823
24807
|
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
|
|
@@ -24826,7 +24810,7 @@ controllers.cameraFlight.flyTo({aabb:aabb});}};this.canvas.addEventListener("tou
|
|
|
24826
24810
|
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
|
|
24827
24811
|
pagePos:[Math.round(rightClickPageX),Math.round(rightClickPageY)],canvasPos:[Math.round(rightClickClientX),Math.round(rightClickClientY)],event:e},true);states.longTouchTimeout=null;},configs.longTapTimeout);//////////
|
|
24828
24812
|
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;}///////////
|
|
24829
|
-
while(activeTouches.length<touches.length){activeTouches.push(new Float32Array(2));}for(var
|
|
24813
|
+
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
|
|
24830
24814
|
if(touches.length===0&&changedTouches.length===1){if(tapStartTime>-1&¤tTime-tapStartTime<TAP_INTERVAL){// Double-tap
|
|
24831
24815
|
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);
|
|
24832
24816
|
cameraControl.fire("touchDoublePicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("doublePickedSurface", pickController.pickResult);
|
|
@@ -24834,7 +24818,7 @@ cameraControl.fire("touchDoublePickedSurface",pickController.pickResult);}if(con
|
|
|
24834
24818
|
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);
|
|
24835
24819
|
cameraControl.fire("touchPicked",pickController.pickResult);if(pickController.pickedSurface){// cameraControl.fire("pickedSurface", pickController.pickResult);
|
|
24836
24820
|
cameraControl.fire("touchPickedSurface",pickController.pickResult);}}else{// cameraControl.fire("pickedNothing");
|
|
24837
|
-
cameraControl.fire("touchPickedNothing");}lastTapTime=currentTime;}tapStartTime=-1;}}activeTouches.length=touches.length;for(var
|
|
24821
|
+
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
|
|
24838
24822
|
// tapStartTime = -1;
|
|
24839
24823
|
// lastTapTime = -1;
|
|
24840
24824
|
}},{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;/**
|
|
@@ -25383,7 +25367,7 @@ keyboardDollyRate:10,mouseWheelDollyRate:100,touchDollyRate:0.2,dollyInertia:0,d
|
|
|
25383
25367
|
_this127._states={pointerCanvasPos:math.vec2(),mouseover:false,followPointerDirty:true,mouseDownClientX:0,mouseDownClientY:0,mouseDownCursorX:0,mouseDownCursorY:0,touchStartTime:null,touchEndTime:null,activeTouches:[],tapStartPos:math.vec2(),tapStartTime:-1,lastTapTime:-1,longTouchTimeout:null};// Updates for CameraUpdater to process on next Scene "tick" event
|
|
25384
25368
|
_this127._updates={rotateDeltaX:0,rotateDeltaY:0,panDeltaX:0,panDeltaY:0,panDeltaZ:0,dollyDelta:0};// Controllers to assist input event handlers with controlling the Camera
|
|
25385
25369
|
var scene=_this127.scene;_this127._controllers={cameraControl:_this127,pickController:new PickController(_this127,_this127._configs),pivotController:new PivotController(scene,_this127._configs),panController:new PanController(scene),cameraFlight:new CameraFlightAnimation(_this127,{duration:0.5})};// Input event handlers
|
|
25386
|
-
_this127._handlers=[new MouseMiscHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPanRotateAndDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardAxisViewHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardPanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates)];// Applies scheduled updates to the Camera on each Scene "tick" event
|
|
25370
|
+
_this127._handlers=[new MouseMiscHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPanRotateAndDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardAxisViewHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new MousePickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new TouchPickHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates),new KeyboardPanRotateDollyHandler(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates,_this127)];// Applies scheduled updates to the Camera on each Scene "tick" event
|
|
25387
25371
|
_this127._cameraUpdater=new CameraUpdater(_this127.scene,_this127._controllers,_this127._configs,_this127._states,_this127._updates);// Set initial user configurations
|
|
25388
25372
|
_this127.navMode=cfg.navMode;if(cfg.planView){_this127.planView=cfg.planView;}_this127.constrainVertical=cfg.constrainVertical;if(cfg.keyboardLayout){_this127.keyboardLayout=cfg.keyboardLayout;// Deprecated
|
|
25389
25373
|
}else{_this127.keyMap=cfg.keyMap;}_this127.doublePickFlyTo=cfg.doublePickFlyTo;_this127.panRightClick=cfg.panRightClick;_this127.active=cfg.active;_this127.followPointer=cfg.followPointer;_this127.rotationInertia=cfg.rotationInertia;_this127.keyboardPanRate=cfg.keyboardPanRate;_this127.touchPanRate=cfg.touchPanRate;_this127.keyboardRotationRate=cfg.keyboardRotationRate;_this127.dragRotationRate=cfg.dragRotationRate;_this127.touchDollyRate=cfg.touchDollyRate;_this127.dollyInertia=cfg.dollyInertia;_this127.dollyProximityThreshold=cfg.dollyProximityThreshold;_this127.dollyMinSpeed=cfg.dollyMinSpeed;_this127.panInertia=cfg.panInertia;_this127.pointerEnabled=true;_this127.keyboardDollyRate=cfg.keyboardDollyRate;_this127.mouseWheelDollyRate=cfg.mouseWheelDollyRate;_this127._moveRate=1;_this127.scene.on("tick",function(){if(!(_this127._goLeft||_this127._goRight||_this127._goUp||_this127._goDown||_this127._goForward||_this127._goBackward)){return;}if(_this127._goRight){_this127._updates.panDeltaX+=-0.1*_this127._moveRate;}else if(_this127._goLeft){_this127._updates.panDeltaX+=0.1*_this127._moveRate;}if(_this127._goUp){_this127._updates.panDeltaY+=0.1*_this127._moveRate;}else if(_this127._goDown){_this127._updates.panDeltaY+=-0.1*_this127._moveRate;}if(_this127._goForward){_this127._updates.panDeltaZ+=-0.1*_this127._moveRate;}else if(_this127._goBackward){_this127._updates.panDeltaZ+=+0.1*_this127._moveRate;}});return _this127;}/**
|
|
@@ -25391,10 +25375,10 @@ _this127.navMode=cfg.navMode;if(cfg.planView){_this127.planView=cfg.planView;}_t
|
|
|
25391
25375
|
*/_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;}/**
|
|
25392
25376
|
* 设置漫游移动速率
|
|
25393
25377
|
* @param {number} rate
|
|
25394
|
-
*/},{key:"moveRate",get:function get(){return this._moveRate;}/**
|
|
25378
|
+
*/},{key:"moveRate",get:function get(){return this._moveRate;},set:function set(rate){this._moveRate=rate;this._handlers[6].movespeed=rate;}},{key:"speedUp",value:function speedUp(){this._handlers[6].speedUp();this._moveRate=this._handlers[6].moveRate;}},{key:"speedDown",value:function speedDown(){this._handlers[6].speedDown();this._moveRate=this._handlers[6].moveRate;}/**
|
|
25395
25379
|
* 漫游向右
|
|
25396
25380
|
* @param {boolean} go
|
|
25397
|
-
|
|
25381
|
+
*/},{key:"goRight",set:function set(go){this._goRight=go;}/**
|
|
25398
25382
|
* 漫游向左
|
|
25399
25383
|
* @param {boolean} go
|
|
25400
25384
|
*/},{key:"goLeft",set:function set(go){this._goLeft=go;}/**
|
|
@@ -25430,7 +25414,7 @@ case"qwerty":keyMap[this.PAN_UP]=[input.KEY_E];keyMap[this.PAN_DOWN]=[input.KEY_
|
|
|
25430
25414
|
// keyMap[this.ROTATE_Y_NEG] = [input.KEY_RIGHT_ARROW];
|
|
25431
25415
|
// keyMap[this.ROTATE_X_NEG] = [input.KEY_UP_ARROW];
|
|
25432
25416
|
// keyMap[this.ROTATE_X_POS] = [input.KEY_DOWN_ARROW];
|
|
25433
|
-
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];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];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]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];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];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];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
|
|
25417
|
+
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];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];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]=[input.KEY_J];keyMap[this.PAN_FORWARDS]=[input.KEY_K];keyMap[this.DOLLY_FORWARDS]=[input.KEY_Z];keyMap[this.DOLLY_BACKWARDS]=[input.KEY_S];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];keyMap[this.SPEED_UP]=[input.KEY_EQUAL_SIGN];keyMap[this.SPEED_DOWN]=[input.KEY_DASH];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;}/**
|
|
25434
25418
|
* Sets the HTMl element to represent the pivot point when {@link CameraControl#followPointer} is true.
|
|
25435
25419
|
*
|
|
25436
25420
|
* See class comments for an example.
|
|
@@ -25527,7 +25511,7 @@ keyMap[this.AXIS_VIEW_RIGHT]=[input.KEY_NUM_1];keyMap[this.AXIS_VIEW_BACK]=[inpu
|
|
|
25527
25511
|
* See class comments for more info.
|
|
25528
25512
|
*
|
|
25529
25513
|
* @param {Boolean} value Set ````true```` to enable the Camera to follow the pointer.
|
|
25530
|
-
*/,set:function set(value){this._reset();this._configs.pointerEnabled=!!value;}},{key:"_reset",value:function _reset(){for(var
|
|
25514
|
+
*/,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:/**
|
|
25531
25515
|
* Sets whether the {@link Camera} follows the mouse/touch pointer.
|
|
25532
25516
|
*
|
|
25533
25517
|
* In orbiting mode, the Camera will orbit about the pointer, and will dolly to and from the pointer.
|
|
@@ -25917,7 +25901,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
|
|
|
25917
25901
|
*/function get(){return this._configs.doubleClickTimeFrame;}/**
|
|
25918
25902
|
* Destroys this ````CameraControl````.
|
|
25919
25903
|
* @private
|
|
25920
|
-
*/,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
|
|
25904
|
+
*/,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);/**
|
|
25921
25905
|
* @desc Metadata corresponding to a {@link Scene}.
|
|
25922
25906
|
*
|
|
25923
25907
|
* * Located in {@link Viewer#metaScene}.
|
|
@@ -25966,7 +25950,7 @@ value=value||"qwerty";if(value!=="qwerty"&&value!=="azerty"){this.error("Unsuppo
|
|
|
25966
25950
|
*
|
|
25967
25951
|
* @param {String} event Event name
|
|
25968
25952
|
* @param {Object} value Event parameters
|
|
25969
|
-
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var
|
|
25953
|
+
*/},{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);}}}/**
|
|
25970
25954
|
* Unsubscribes from an event fired at this Viewer.
|
|
25971
25955
|
* @param event
|
|
25972
25956
|
*/},{key:"off",value:function off(event){// TODO
|
|
@@ -25997,12 +25981,12 @@ metaScene:this,id:modelId,projectId:metaModelData.projectId||"none",revisionId:m
|
|
|
25997
25981
|
*
|
|
25998
25982
|
* @param {String} metaModelId ID of the target {@link MetaModel}.
|
|
25999
25983
|
*/},{key:"destroyMetaModel",value:function destroyMetaModel(metaModelId){var metaModel=this.metaModels[metaModelId];if(!metaModel){return;}// Remove global PropertySets
|
|
26000
|
-
if(metaModel.propertySets){for(var
|
|
25984
|
+
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
|
|
26001
25985
|
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
|
|
26002
|
-
if(metaModel.metaObjects){for(var
|
|
25986
|
+
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
|
|
26003
25987
|
delete this.metaObjects[id];if(!metaObject.parent){delete this.rootMetaObjects[id];}}}}// Re-link entire MetaObject parent/child hierarchy
|
|
26004
25988
|
for(var objectId in this.metaObjects){var _metaObject=this.metaObjects[objectId];if(_metaObject.children){_metaObject.children=[];}// Re-link each MetaObject's property sets
|
|
26005
|
-
if(_metaObject.propertySets){_metaObject.propertySets=[];}if(_metaObject.propertySetIds){for(var
|
|
25989
|
+
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
|
|
26006
25990
|
// for (let objectId in this.metaObjects) {
|
|
26007
25991
|
// const metaObject = this.metaObjects[objectId];
|
|
26008
25992
|
// metaObject.metaModels = [];
|
|
@@ -26024,7 +26008,7 @@ this.fire("metaModelDestroyed",metaModelId);}/**
|
|
|
26024
26008
|
*
|
|
26025
26009
|
* @param {String[]} types The array of type name.
|
|
26026
26010
|
* @returns {String[]} Array of {@link MetaObject#id}s.
|
|
26027
|
-
*/},{key:"getObjectIDsByTypes",value:function getObjectIDsByTypes(types){var metaObjects=[];for(var
|
|
26011
|
+
*/},{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;}/**
|
|
26028
26012
|
* Gets the {@link MetaObject#id}s of the {@link MetaObject}s within the given subtree.
|
|
26029
26013
|
*
|
|
26030
26014
|
* @param {String} id ID of the root {@link MetaObject} of the given subtree.
|
|
@@ -26485,7 +26469,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
|
|
|
26485
26469
|
*
|
|
26486
26470
|
* @param {String} event Event name
|
|
26487
26471
|
* @param {Object} value Event parameters
|
|
26488
|
-
*/},{key:"fire",value:function fire(event,value){var subs=this._eventSubs[event];if(subs){for(var
|
|
26472
|
+
*/},{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);}}}/**
|
|
26489
26473
|
* Unsubscribes from an event fired at this Viewer.
|
|
26490
26474
|
* @param event
|
|
26491
26475
|
*/},{key:"off",value:function off(event){// TODO
|
|
@@ -26505,12 +26489,12 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
|
|
|
26505
26489
|
* Uninstalls a Plugin, clearing content from it first.
|
|
26506
26490
|
*
|
|
26507
26491
|
* @private
|
|
26508
|
-
*/},{key:"removePlugin",value:function removePlugin(plugin){for(var
|
|
26492
|
+
*/},{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;}}}/**
|
|
26509
26493
|
* Sends a message to installed Plugins.
|
|
26510
26494
|
*
|
|
26511
26495
|
* The message can optionally be accompanied by a value.
|
|
26512
26496
|
* @private
|
|
26513
|
-
*/},{key:"sendToPlugins",value:function sendToPlugins(name,value){for(var
|
|
26497
|
+
*/},{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);}}}/**
|
|
26514
26498
|
* @private
|
|
26515
26499
|
* @deprecated
|
|
26516
26500
|
*/},{key:"clear",value:function clear(){throw'Viewer#clear() no longer implemented - use \'#sendToPlugins("clear") instead';}/**
|
|
@@ -26541,7 +26525,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
|
|
|
26541
26525
|
* @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
|
|
26542
26526
|
* @returns {String} String-encoded image data URI.
|
|
26543
26527
|
*/},{key:"getSnapshot",value:function getSnapshot(){var params=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var needFinishSnapshot=!this._snapshotBegun;var resize=params.width!==undefined&¶ms.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
|
|
26544
|
-
}var captured={};for(var
|
|
26528
|
+
}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;}/**
|
|
26545
26529
|
* Gets a snapshot of this Viewer's {@link Scene} as a Base64-encoded image which includes
|
|
26546
26530
|
* the HTML elements created by various plugins.
|
|
26547
26531
|
*
|
|
@@ -26566,7 +26550,7 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
|
|
|
26566
26550
|
* @param {String} [params.format="jpeg"] Desired format; "jpeg", "png" or "bmp".
|
|
26567
26551
|
* @param {Boolean} [params.includeGizmos=false] When true, will include gizmos like {@link SectionPlane} in the snapshot.
|
|
26568
26552
|
* @returns {Promise} Promise which returns a string-encoded image data URI.
|
|
26569
|
-
*/},{key:"getSnapshotWithPlugins",value:(function(){var _getSnapshotWithPlugins=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var params,needFinishSnapshot,resize,canvas,saveWidth,saveHeight,snapshotWidth,snapshotHeight,snapshotCanvas,pluginToCapture,pluginContainerElements,
|
|
26553
|
+
*/},{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
|
|
26570
26554
|
// HTMLCanvas element, scaled to the target snapshot size, then
|
|
26571
26555
|
// use html2canvas to render each plugin's container element into
|
|
26572
26556
|
// that HTMLCanvas. Finally, we save the HTMLCanvas to a bitmap.
|
|
@@ -26576,8 +26560,8 @@ snapRadius:cfg.snapRadius,doublePickFlyTo:true});this.scene.canvas.on("boundary"
|
|
|
26576
26560
|
// canvas ourselves, in order to allow the Viewer to render the
|
|
26577
26561
|
// right amount of pixels, for a sharper image.
|
|
26578
26562
|
needFinishSnapshot=!this._snapshotBegun;resize=params.width!==undefined&¶ms.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
|
|
26579
|
-
}this.scene._renderer.renderSnapshot();snapshotCanvas=this.scene._renderer.readSnapshotAsCanvas();if(resize){canvas.width=saveWidth;canvas.height=saveHeight;this.scene.glRedraw();}pluginToCapture={};pluginContainerElements=[];for(
|
|
26580
|
-
plugin=this._plugins[
|
|
26563
|
+
}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
|
|
26564
|
+
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;}()/**
|
|
26581
26565
|
* Exits snapshot mode.
|
|
26582
26566
|
*
|
|
26583
26567
|
* Switches rendering back to the main canvas.
|
|
@@ -26585,7 +26569,7 @@ plugin=this._plugins[_i516];if(plugin.getContainerElement){containerElement=plug
|
|
|
26585
26569
|
*/)},{key:"endSnapshot",value:function endSnapshot(){if(!this._snapshotBegun){return;}this.scene._renderer.endSnapshot();this.scene._renderer.render({force:true});this._snapshotBegun=false;}/**
|
|
26586
26570
|
* Destroys this Viewer.
|
|
26587
26571
|
*/},{key:"destroy",value:function destroy(callback){var plugins=this._plugins.slice();// Array will modify as we delete plugins
|
|
26588
|
-
if(plugins.length>0){for(var
|
|
26572
|
+
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);}}]);}();/**
|
|
26589
26573
|
* {@link Viewer} plugin that uses [web-ifc](https://github.com/tomvandig/web-ifc) to load BIM models directly from IFC files.
|
|
26590
26574
|
*
|
|
26591
26575
|
* <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>
|
|
@@ -27094,7 +27078,7 @@ return _this129;}/**
|
|
|
27094
27078
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
27095
27079
|
* @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}.
|
|
27096
27080
|
*/},{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
|
|
27097
|
-
}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
|
|
27081
|
+
}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", () => {
|
|
27098
27082
|
// try {
|
|
27099
27083
|
// if (params.src) {
|
|
27100
27084
|
// this._loadModel(params.src, params, options, sceneModel);
|
|
@@ -27107,9 +27091,9 @@ return _this129;}/**
|
|
|
27107
27091
|
// }
|
|
27108
27092
|
// });
|
|
27109
27093
|
return sceneModel;}},{key:"_loadModel",value:function _loadModel(src,params,options,sceneModel){var _this130=this;var spinner=this.viewer.scene.canvas.spinner;spinner.processes++;this._dataSource.getIFC(params.src,function(arrayBuffer){_this130._parseModel(arrayBuffer,params,options,sceneModel);spinner.processes--;},function(errMsg){spinner.processes--;_this130.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&¶ms.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) {},
|
|
27110
|
-
nextId:0,stats:stats};if(loadMetadata){if(options.includeTypes){ctx.includeTypes={};for(var
|
|
27094
|
+
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
|
|
27111
27095
|
sceneModel.fire("loaded",true,false);// Don't forget the event, for late subscribers
|
|
27112
|
-
});}},{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 _this131=this;var lines=this._ifcAPI.GetLineIDsWithType(ctx.modelID,type);for(var
|
|
27096
|
+
});}},{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 _this131=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=_this131._ifcAPI.GetLine(ctx.modelID,element2.value);if(ifcElement==null)return;_this131._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 _this132=this;this.log("start parse geometry");this._ifcAPI.StreamAllMeshes(ctx.modelID,function(flatMesh){// TODO: Can we do geometry reuse with web-ifc?
|
|
27113
27097
|
var flatMeshExpressID=flatMesh.expressID;var placedGeometries=flatMesh.geometries;var meshIds=[];var properties=_this132._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=_this132._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this132._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this132._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
27114
27098
|
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
|
|
27115
27099
|
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=_this132._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=_this132._ifcAPI.GetGeometry(ctx.modelID,placedGeometry.geometryExpressID);var vertexData=_this132._ifcAPI.GetVertexArray(geometry.GetVertexData(),geometry.GetVertexDataSize());var indices=_this132._ifcAPI.GetIndexArray(geometry.GetIndexData(),geometry.GetIndexDataSize());// De-interleave vertex arrays
|
|
@@ -76004,6 +75988,12 @@ class FirstPersonMode extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
|
|
|
76004
75988
|
cameraControl.navMode = "orbit";
|
|
76005
75989
|
cameraControl.followPointer = true;
|
|
76006
75990
|
this.cameraControl = cameraControl;
|
|
75991
|
+
cameraControl.on("personModeSpeedUp", (speedNum) => {
|
|
75992
|
+
parent.eventTrigger.emit("personModeSpeedUp", speedNum);
|
|
75993
|
+
});
|
|
75994
|
+
cameraControl.on("personModeSpeedDown", (speedNum) => {
|
|
75995
|
+
parent.eventTrigger.emit("personModeSpeedDown", speedNum);
|
|
75996
|
+
});
|
|
76007
75997
|
this.on("active", (active) => {
|
|
76008
75998
|
cameraControlNavModeMediator.setFirstPersonModeActive(active);
|
|
76009
75999
|
if (active) {
|
|
@@ -76031,6 +76021,12 @@ class FirstPersonMode extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
|
|
|
76031
76021
|
this.goForward = false;
|
|
76032
76022
|
this.goBackward = false;
|
|
76033
76023
|
}
|
|
76024
|
+
speedUp() {
|
|
76025
|
+
this.cameraControl.speedUp();
|
|
76026
|
+
}
|
|
76027
|
+
speedDown() {
|
|
76028
|
+
this.cameraControl.speedDown();
|
|
76029
|
+
}
|
|
76034
76030
|
/**
|
|
76035
76031
|
* 设置漫游移动速率
|
|
76036
76032
|
* @param {number} rate
|
|
@@ -76038,6 +76034,9 @@ class FirstPersonMode extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
|
|
|
76038
76034
|
set moveRate(rate) {
|
|
76039
76035
|
this.cameraControl.moveRate = rate;
|
|
76040
76036
|
}
|
|
76037
|
+
get moveRate() {
|
|
76038
|
+
return this.cameraControl.moveRate;
|
|
76039
|
+
}
|
|
76041
76040
|
/**
|
|
76042
76041
|
* 漫游向右
|
|
76043
76042
|
* @param {boolean} go
|
|
@@ -76249,12 +76248,16 @@ class MeasureTool extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
|
|
|
76249
76248
|
}
|
|
76250
76249
|
_initEventHandle() {
|
|
76251
76250
|
this.eventTrigger.on("clickAngleMeasure", () => {
|
|
76251
|
+
if (!this._active)
|
|
76252
|
+
return;
|
|
76252
76253
|
if (!this.getActiveByType("angle")) {
|
|
76253
76254
|
this.setActiveByType("angle", true);
|
|
76254
76255
|
this.measureDistanceTool.refreshMouseState();
|
|
76255
76256
|
}
|
|
76256
76257
|
});
|
|
76257
76258
|
this.eventTrigger.on("clickDistanceMeasure", () => {
|
|
76259
|
+
if (!this._active)
|
|
76260
|
+
return;
|
|
76258
76261
|
if (!this.getActiveByType("distance")) {
|
|
76259
76262
|
this.setActiveByType("distance", true);
|
|
76260
76263
|
this.measureAngleTool.refreshMouseState();
|