@xeokit/xeokit-sdk 2.4.2-beta-41 → 2.4.2-beta-43

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.
@@ -17445,7 +17445,7 @@ src.push(" }");src.push("}");return src;}},{key:"_buildFragmentShader",value:fu
17445
17445
  // when user first begins interacting with the viewer.
17446
17446
  if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapBatchingDepthBufInitRenderer(this._scene,false);}if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapBatchingDepthRenderer(this._scene);}}},{key:"snapDepthBufInitRenderer",get:function get(){if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapBatchingDepthBufInitRenderer(this._scene,false);}return this._snapDepthBufInitRenderer;}},{key:"snapDepthRenderer",get:function get(){if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapBatchingDepthRenderer(this._scene);}return this._snapDepthRenderer;}},{key:"_destroy",value:function _destroy(){if(this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer.destroy();}if(this._snapDepthRenderer){this._snapDepthRenderer.destroy();}}}]);return SnapBatchingRenderers;}();var cachedRenderers$6={};/**
17447
17447
  * @private
17448
- */function getSnapBatchingRenderers(scene){var sceneId=scene.id;var batchingRenderers=cachedRenderers$6[sceneId];if(!batchingRenderers){batchingRenderers=new SnapBatchingRenderers(scene);cachedRenderers$6[sceneId]=batchingRenderers;batchingRenderers._compile();batchingRenderers.eagerCreateRenders();scene.on("compile",function(){batchingRenderers._compile();batchingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$6[sceneId];batchingRenderers._destroy();});}return batchingRenderers;}var tempMat4$1=math.mat4();var tempMat4b=math.mat4();var tempVec4a$7=math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.OBB3();var tempVec3a$o=math.vec3();var tempVec3b$k=math.vec3();var tempVec3c$h=math.vec3();var tempVec3d$6=math.vec3();var tempVec3e$1=math.vec3();var tempVec3f$1=math.vec3();var tempVec3g$1=math.vec3();/**
17448
+ */function getSnapBatchingRenderers(scene){var sceneId=scene.id;var batchingRenderers=cachedRenderers$6[sceneId];if(!batchingRenderers){batchingRenderers=new SnapBatchingRenderers(scene);cachedRenderers$6[sceneId]=batchingRenderers;batchingRenderers._compile();batchingRenderers.eagerCreateRenders();scene.on("compile",function(){batchingRenderers._compile();batchingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$6[sceneId];batchingRenderers._destroy();});}return batchingRenderers;}var tempMat4$1=math.mat4();var tempMat4b=math.mat4();var tempVec4a$7=math.vec4([0,0,0,1]);var tempVec3a$o=math.vec3();var tempVec3b$k=math.vec3();var tempVec3c$h=math.vec3();var tempVec3d$6=math.vec3();var tempVec3e$1=math.vec3();var tempVec3f$1=math.vec3();var tempVec3g$1=math.vec3();/**
17449
17449
  * @private
17450
17450
  */var TrianglesBatchingLayer=/*#__PURE__*/function(){/**
17451
17451
  * @param model
@@ -17473,9 +17473,6 @@ if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapBatch
17473
17473
  });// These counts are used to avoid unnecessary render passes
17474
17474
  this._numPortions=0;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._modelAABB=math.collapseAABB3();// Model-space AABB
17475
17475
  this._portions=[];this._meshes=[];this._numVerts=0;this._aabb=math.collapseAABB3();this.aabbDirty=true;this._finalized=false;if(cfg.positionsDecodeMatrix){this._state.positionsDecodeMatrix=math.mat4(cfg.positionsDecodeMatrix);}if(cfg.uvDecodeMatrix){this._state.uvDecodeMatrix=math.mat3(cfg.uvDecodeMatrix);this._preCompressedUVsExpected=true;}else{this._preCompressedUVsExpected=false;}if(cfg.origin){this._state.origin.set(cfg.origin);}/**
17476
- * The axis-aligned World-space boundary of this TrianglesBatchingLayer's positions.
17477
- * @type {*|Float64Array}
17478
- */this.aabb=math.collapseAABB3();/**
17479
17476
  * When true, this layer contains solid triangle meshes, otherwise this layer contains surface triangle meshes
17480
17477
  * @type {boolean}
17481
17478
  */this.solid=!!cfg.solid;}_createClass(TrianglesBatchingLayer,[{key:"aabb",get:function get(){if(this.aabbDirty){math.collapseAABB3(this._aabb);for(var _i205=0,len=this._meshes.length;_i205<len;_i205++){math.expandAABB3(this._aabb,this._meshes[_i205].aabb);}this.aabbDirty=false;}}/**
@@ -17690,7 +17687,7 @@ src.push("}");src.push("}");return src;}},{key:"_buildFragmentShader",value:func
17690
17687
  // when user first begins interacting with the viewer.
17691
17688
  if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapInstancingDepthBufInitRenderer(this._scene,false);}if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapInstancingDepthRenderer(this._scene);}}},{key:"snapDepthBufInitRenderer",get:function get(){if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapInstancingDepthBufInitRenderer(this._scene,false);}return this._snapDepthBufInitRenderer;}},{key:"snapDepthRenderer",get:function get(){if(!this._snapDepthRenderer){this._snapDepthRenderer=new SnapInstancingDepthRenderer(this._scene);}return this._snapDepthRenderer;}},{key:"_destroy",value:function _destroy(){if(this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer.destroy();}if(this._snapDepthRenderer){this._snapDepthRenderer.destroy();}}}]);return SnapInstancingRenderers;}();var cachedRenderers$4={};/**
17692
17689
  * @private
17693
- */function getSnapInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$4[sceneId];if(!instancingRenderers){instancingRenderers=new SnapInstancingRenderers(scene);cachedRenderers$4[sceneId]=instancingRenderers;instancingRenderers._compile();instancingRenderers.eagerCreateRenders();scene.on("compile",function(){instancingRenderers._compile();instancingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$4[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$2=new Uint8Array(4);var tempFloat32$2=new Float32Array(1);var tempVec4a$6=math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);var tempVec3fa$2=new Float32Array(3);var tempVec3a$l=math.vec3();var tempVec3b$h=math.vec3();var tempVec3c$e=math.vec3();var tempVec3d$3=math.vec3();var tempVec3e=math.vec3();var tempVec3f=math.vec3();var tempVec3g=math.vec3();var tempFloat32Vec4$2=new Float32Array(4);/**
17690
+ */function getSnapInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$4[sceneId];if(!instancingRenderers){instancingRenderers=new SnapInstancingRenderers(scene);cachedRenderers$4[sceneId]=instancingRenderers;instancingRenderers._compile();instancingRenderers.eagerCreateRenders();scene.on("compile",function(){instancingRenderers._compile();instancingRenderers.eagerCreateRenders();});scene.on("destroyed",function(){delete cachedRenderers$4[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempFloat32$2=new Float32Array(1);var tempVec4a$6=math.vec4([0,0,0,1]);var tempVec3fa$2=new Float32Array(3);var tempVec3a$l=math.vec3();var tempVec3b$h=math.vec3();var tempVec3c$e=math.vec3();var tempVec3d$3=math.vec3();var tempVec3e=math.vec3();var tempVec3f=math.vec3();var tempVec3g=math.vec3();var tempFloat32Vec4$2=new Float32Array(4);/**
17694
17691
  * @private
17695
17692
  */var TrianglesInstancingLayer=/*#__PURE__*/function(){/**
17696
17693
  * @param cfg
@@ -17756,7 +17753,7 @@ if(geometry.colorsCompressed&&geometry.colorsCompressed.length>0){var colorsComp
17756
17753
  }state.pbrSupported=!!state.metallicRoughnessBuf&&!!state.uvBuf&&!!state.normalsBuf&&!!textureSet&&!!textureSet.colorTexture&&!!textureSet.metallicRoughnessTexture;state.colorTextureSupported=!!state.uvBuf&&!!textureSet&&!!textureSet.colorTexture;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.
17757
17754
  // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
17758
17755
  },{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
17759
- if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8Vec4$2[1]=color[1];tempUint8Vec4$2[2]=color[2];tempUint8Vec4$2[3]=color[3];if(this._state.colorsBuf){this._state.colorsBuf.setData(tempUint8Vec4$2,portionId*4);}}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}// setMatrix(portionId, matrix) {
17756
+ if(!this._finalized){throw"Not finalized";}tempUint8Vec4[0]=color[0];tempUint8Vec4[1]=color[1];tempUint8Vec4[2]=color[2];tempUint8Vec4[3]=color[3];if(this._state.colorsBuf){this._state.colorsBuf.setData(tempUint8Vec4,portionId*4);}}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}// setMatrix(portionId, matrix) {
17760
17757
  //
17761
17758
  // if (!this._finalized) {
17762
17759
  // throw "Not finalized";
@@ -17830,7 +17827,7 @@ src.push("} else {");src.push(" vec4 worldPosition = worldMatrix * (positio
17830
17827
  */function getBatchingRenderers(scene){var sceneId=scene.id;var batchingRenderers=cachedRenderers$3[sceneId];if(!batchingRenderers){batchingRenderers=new LinesBatchingRenderers(scene);cachedRenderers$3[sceneId]=batchingRenderers;batchingRenderers._compile();scene.on("compile",function(){batchingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers$3[sceneId];batchingRenderers._destroy();});}return batchingRenderers;}/**
17831
17828
  * @private
17832
17829
  */var LinesBatchingBuffer=/*#__PURE__*/_createClass(function LinesBatchingBuffer(){var maxGeometryBatchSize=arguments.length>0&&arguments[0]!==undefined?arguments[0]:5000000;_classCallCheck(this,LinesBatchingBuffer);if(maxGeometryBatchSize>5000000){maxGeometryBatchSize=5000000;}this.maxVerts=maxGeometryBatchSize;this.maxIndices=maxGeometryBatchSize*3;// Rough rule-of-thumb
17833
- this.positions=[];this.colors=[];this.offsets=[];this.indices=[];});math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.OBB3();/**
17830
+ this.positions=[];this.colors=[];this.offsets=[];this.indices=[];});/**
17834
17831
  * @private
17835
17832
  */var LinesBatchingLayer=/*#__PURE__*/function(){/**
17836
17833
  * @param model
@@ -17900,7 +17897,7 @@ src.push("} else {");src.push("vec4 worldPosition = positionsDecodeMatrix * vec4
17900
17897
  * @private
17901
17898
  */var LinesInstancingRenderers=/*#__PURE__*/function(){function LinesInstancingRenderers(scene){_classCallCheck(this,LinesInstancingRenderers);this._scene=scene;}_createClass(LinesInstancingRenderers,[{key:"_compile",value:function _compile(){if(this._colorRenderer&&!this._colorRenderer.getValid()){this._colorRenderer.destroy();this._colorRenderer=null;}if(this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()){this._silhouetteRenderer.destroy();this._silhouetteRenderer=null;}}},{key:"colorRenderer",get:function get(){if(!this._colorRenderer){this._colorRenderer=new LinesInstancingColorRenderer(this._scene);}return this._colorRenderer;}},{key:"silhouetteRenderer",get:function get(){if(!this._silhouetteRenderer){this._silhouetteRenderer=new LinesInstancingSilhouetteRenderer(this._scene);}return this._silhouetteRenderer;}},{key:"_destroy",value:function _destroy(){if(this._colorRenderer){this._colorRenderer.destroy();}if(this._silhouetteRenderer){this._silhouetteRenderer.destroy();}}}]);return LinesInstancingRenderers;}();var cachedRenderers$2={};/**
17902
17899
  * @private
17903
- */function getInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$2[sceneId];if(!instancingRenderers){instancingRenderers=new LinesInstancingRenderers(scene);cachedRenderers$2[sceneId]=instancingRenderers;instancingRenderers._compile();scene.on("compile",function(){instancingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers$2[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$1=new Uint8Array(4);var tempFloat32$1=new Float32Array(1);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);var tempVec3fa$1=new Float32Array(3);var tempFloat32Vec4$1=new Float32Array(4);/**
17900
+ */function getInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers$2[sceneId];if(!instancingRenderers){instancingRenderers=new LinesInstancingRenderers(scene);cachedRenderers$2[sceneId]=instancingRenderers;instancingRenderers._compile();scene.on("compile",function(){instancingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers$2[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$2=new Uint8Array(4);var tempFloat32$1=new Float32Array(1);var tempVec3fa$1=new Float32Array(3);var tempFloat32Vec4$1=new Float32Array(4);/**
17904
17901
  * @private
17905
17902
  */var LinesInstancingLayer=/*#__PURE__*/function(){/**
17906
17903
  * @param cfg
@@ -17946,7 +17943,7 @@ var _notNormalized6=false;this._state.flagsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,n
17946
17943
  }}if(this._modelMatrixCol0.length>0){var normalized=false;this._state.modelMatrixCol0Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol0),this._modelMatrixCol0.length,4,gl.STATIC_DRAW,normalized);this._state.modelMatrixCol1Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol1),this._modelMatrixCol1.length,4,gl.STATIC_DRAW,normalized);this._state.modelMatrixCol2Buf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float32Array(this._modelMatrixCol2),this._modelMatrixCol2.length,4,gl.STATIC_DRAW,normalized);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.
17947
17944
  // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
17948
17945
  },{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
17949
- 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);}/**
17946
+ if(!this._finalized){throw"Not finalized";}tempUint8Vec4$2[0]=color[0];tempUint8Vec4$2[1]=color[1];tempUint8Vec4$2[2]=color[2];tempUint8Vec4$2[3]=color[3];this._state.colorsBuf.setData(tempUint8Vec4$2,portionId*4,4);}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}/**
17950
17947
  * 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.
17951
17948
  */},{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
17952
17949
  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){////////////////////////////////////////
@@ -17995,7 +17992,7 @@ src.push("}");return src;}}]);return PointsBatchingOcclusionRenderer;}(VBOSceneM
17995
17992
  */function getPointsBatchingRenderers(scene){var sceneId=scene.id;var renderers=cachedRenderers$1[sceneId];if(!renderers){renderers=new PointsBatchingRenderers(scene);cachedRenderers$1[sceneId]=renderers;renderers._compile();scene.on("compile",function(){renderers._compile();});scene.on("destroyed",function(){delete cachedRenderers$1[sceneId];renderers._destroy();});}return renderers;}/**
17996
17993
  * @private
17997
17994
  */var PointsBatchingBuffer=/*#__PURE__*/_createClass(function PointsBatchingBuffer(){var maxGeometryBatchSize=arguments.length>0&&arguments[0]!==undefined?arguments[0]:5000000;_classCallCheck(this,PointsBatchingBuffer);if(maxGeometryBatchSize>5000000){maxGeometryBatchSize=5000000;}this.maxVerts=maxGeometryBatchSize;this.maxIndices=maxGeometryBatchSize*3;// Rough rule-of-thumb
17998
- this.positions=[];this.colors=[];this.intensities=[];this.pickColors=[];this.offsets=[];});math.vec4();math.vec4();math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.OBB3();/**
17995
+ this.positions=[];this.colors=[];this.intensities=[];this.pickColors=[];this.offsets=[];});/**
17999
17996
  * @private
18000
17997
  */var PointsBatchingLayer=/*#__PURE__*/function(){/**
18001
17998
  * @param model
@@ -18103,7 +18100,7 @@ src.push("} else {");src.push(" vec4 worldPosition = positionsDecodeMatrix * ve
18103
18100
  * @private
18104
18101
  */var PointsInstancingRenderers=/*#__PURE__*/function(){function PointsInstancingRenderers(scene){_classCallCheck(this,PointsInstancingRenderers);this._scene=scene;}_createClass(PointsInstancingRenderers,[{key:"_compile",value:function _compile(){if(this._colorRenderer&&!this._colorRenderer.getValid()){this._colorRenderer.destroy();this._colorRenderer=null;}if(this._depthRenderer&&!this._depthRenderer.getValid()){this._depthRenderer.destroy();this._depthRenderer=null;}if(this._silhouetteRenderer&&!this._silhouetteRenderer.getValid()){this._silhouetteRenderer.destroy();this._silhouetteRenderer=null;}if(this._pickMeshRenderer&&!this._pickMeshRenderer.getValid()){this._pickMeshRenderer.destroy();this._pickMeshRenderer=null;}if(this._pickDepthRenderer&&!this._pickDepthRenderer.getValid()){this._pickDepthRenderer.destroy();this._pickDepthRenderer=null;}if(this._occlusionRenderer&&this._occlusionRenderer.getValid()===false){this._occlusionRenderer.destroy();this._occlusionRenderer=null;}if(this._shadowRenderer&&!this._shadowRenderer.getValid()){this._shadowRenderer.destroy();this._shadowRenderer=null;}}},{key:"colorRenderer",get:function get(){if(!this._colorRenderer){this._colorRenderer=new PointsInstancingColorRenderer(this._scene,false);}return this._colorRenderer;}},{key:"silhouetteRenderer",get:function get(){if(!this._silhouetteRenderer){this._silhouetteRenderer=new PointsInstancingSilhouetteRenderer(this._scene);}return this._silhouetteRenderer;}},{key:"depthRenderer",get:function get(){if(!this._depthRenderer){this._depthRenderer=new PointsInstancingDepthRenderer(this._scene);}return this._depthRenderer;}},{key:"pickMeshRenderer",get:function get(){if(!this._pickMeshRenderer){this._pickMeshRenderer=new PointsInstancingPickMeshRenderer(this._scene);}return this._pickMeshRenderer;}},{key:"pickDepthRenderer",get:function get(){if(!this._pickDepthRenderer){this._pickDepthRenderer=new PointsInstancingPickDepthRenderer(this._scene);}return this._pickDepthRenderer;}},{key:"occlusionRenderer",get:function get(){if(!this._occlusionRenderer){this._occlusionRenderer=new PointsInstancingOcclusionRenderer(this._scene);}return this._occlusionRenderer;}},{key:"shadowRenderer",get:function get(){if(!this._shadowRenderer){this._shadowRenderer=new PointsInstancingShadowRenderer(this._scene);}return this._shadowRenderer;}},{key:"_destroy",value:function _destroy(){if(this._colorRenderer){this._colorRenderer.destroy();}if(this._depthRenderer){this._depthRenderer.destroy();}if(this._silhouetteRenderer){this._silhouetteRenderer.destroy();}if(this._pickMeshRenderer){this._pickMeshRenderer.destroy();}if(this._pickDepthRenderer){this._pickDepthRenderer.destroy();}if(this._occlusionRenderer){this._occlusionRenderer.destroy();}if(this._shadowRenderer){this._shadowRenderer.destroy();}}}]);return PointsInstancingRenderers;}();var cachedRenderers={};/**
18105
18102
  * @private
18106
- */function getPointsInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers[sceneId];if(!instancingRenderers){instancingRenderers=new PointsInstancingRenderers(scene);cachedRenderers[sceneId]=instancingRenderers;instancingRenderers._compile();scene.on("compile",function(){instancingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4=new Uint8Array(4);var tempFloat32=new Float32Array(1);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);var tempVec3fa=new Float32Array(3);var tempFloat32Vec4=new Float32Array(4);/**
18103
+ */function getPointsInstancingRenderers(scene){var sceneId=scene.id;var instancingRenderers=cachedRenderers[sceneId];if(!instancingRenderers){instancingRenderers=new PointsInstancingRenderers(scene);cachedRenderers[sceneId]=instancingRenderers;instancingRenderers._compile();scene.on("compile",function(){instancingRenderers._compile();});scene.on("destroyed",function(){delete cachedRenderers[sceneId];instancingRenderers._destroy();});}return instancingRenderers;}var tempUint8Vec4$1=new Uint8Array(4);var tempFloat32=new Float32Array(1);var tempVec3fa=new Float32Array(3);var tempFloat32Vec4=new Float32Array(4);/**
18107
18104
  * @private
18108
18105
  */var PointsInstancingLayer=/*#__PURE__*/function(){/**
18109
18106
  * @param cfg
@@ -18149,7 +18146,7 @@ var notNormalized=false;state.flagsBuf=new ArrayBuf(gl,gl.ARRAY_BUFFER,new Float
18149
18146
  }state.geometry=null;this._finalized=true;}// The following setters are called by VBOSceneModelMesh, in turn called by VBOSceneModelNode, only after the layer is finalized.
18150
18147
  // It's important that these are called after finalize() in order to maintain integrity of counts like _numVisibleLayerPortions etc.
18151
18148
  },{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
18152
- if(!this._finalized){throw"Not finalized";}tempUint8Vec4[0]=color[0];tempUint8Vec4[1]=color[1];tempUint8Vec4[2]=color[2];this._state.colorsBuf.setData(tempUint8Vec4,portionId*3);}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}// setMatrix(portionId, matrix) {
18149
+ if(!this._finalized){throw"Not finalized";}tempUint8Vec4$1[0]=color[0];tempUint8Vec4$1[1]=color[1];tempUint8Vec4$1[2]=color[2];this._state.colorsBuf.setData(tempUint8Vec4$1,portionId*3);}},{key:"setTransparent",value:function setTransparent(portionId,flags,transparent){if(transparent){this._numTransparentLayerPortions++;this.model.numTransparentLayerPortions++;}else{this._numTransparentLayerPortions--;this.model.numTransparentLayerPortions--;}this._setFlags(portionId,flags,transparent);}// setMatrix(portionId, matrix) {
18153
18150
  ////////////////////////////////////////
18154
18151
  // TODO: Update portion matrix
18155
18152
  ////////////////////////////////////////
@@ -19053,7 +19050,7 @@ texArray.set(positionDecodeMatrices[_i366],_i366*16);}var texture=gl.createTextu
19053
19050
  */var INDICES_EDGE_INDICES_ALIGNEMENT_SIZE=8;/**
19054
19051
  * Number of maximum allowed per-object flags update per render frame
19055
19052
  * before switching to batch update mode.
19056
- */var MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE=10;math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);math.vec4([0,0,0,1]);var tempMat4a=new Float32Array(16);var tempUint8Array4=new Uint8Array(4);var tempFloat32Array3=new Float32Array(3);math.AABB3();var numLayers=0;var DEFAULT_MATRIX$1=math.identityMat4();/**
19053
+ */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();/**
19057
19054
  * @private
19058
19055
  */var TrianglesDataTextureLayer=/*#__PURE__*/function(){function TrianglesDataTextureLayer(model,cfg){_classCallCheck(this,TrianglesDataTextureLayer);dataTextureRamStats.numberOfLayers++;this._layerNumber=numLayers++;this.sortId="TriDTX-".concat(this._layerNumber);// State sorting key.
19059
19056
  this.layerIndex=cfg.layerIndex;// Index of this TrianglesDataTextureLayer in {@link SceneModel#_layerList}.
@@ -19101,17 +19098,7 @@ var bucketGeometryId=portionCfg.geometryId!==undefined&&portionCfg.geometryId!==
19101
19098
  */},{key:"createPortion",value:function createPortion(mesh,portionCfg){var _this96=this;if(this._finalized){throw"Already finalized";}var subPortionIds=[];// const portionAABB = portionCfg.worldAABB;
19102
19099
  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=_this96._bucketGeometries[bucketGeometryId];if(!bucketGeometry){bucketGeometry=_this96._createBucketGeometry(portionCfg,bucket);_this96._bucketGeometries[bucketGeometryId]=bucketGeometry;}// const subPortionAABB = math.collapseAABB3(tempAABB3b);
19103
19100
  var subPortionId=_this96._createSubPortion(portionCfg,bucketGeometry,bucket);//math.expandAABB3(portionAABB, subPortionAABB);
19104
- subPortionIds.push(subPortionId);});// const origin = this._state.origin;
19105
- // if (origin[0] !== 0 || origin[1] !== 0 || origin[2] !== 0) {
19106
- // portionAABB[0] += origin[0];
19107
- // portionAABB[1] += origin[1];
19108
- // portionAABB[2] += origin[2];
19109
- // portionAABB[3] += origin[0];
19110
- // portionAABB[4] += origin[1];
19111
- // portionAABB[5] += origin[2];
19112
- // }
19113
- // math.expandAABB3(this.aabb, portionAABB);
19114
- 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
19101
+ 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
19115
19102
  // This will make every mesh consume a multiple of INDICES_EDGE_INDICES_ALIGNEMENT_SIZE
19116
19103
  // array items for storing the triangles of the mesh, and it supports:
19117
19104
  // - a memory optimization of factor INDICES_EDGE_INDICES_ALIGNEMENT_SIZE
@@ -19123,44 +19110,15 @@ if(bucket.indices){var alignedIndicesLen=Math.ceil(bucket.indices.length/3/INDIC
19123
19110
  // - a memory optimization of factor INDICES_EDGE_INDICES_ALIGNEMENT_SIZE
19124
19111
  // - in exchange for a small RAM overhead
19125
19112
  // (by adding some padding until a size that is multiple of INDICES_EDGE_INDICES_ALIGNEMENT_SIZE)
19126
- if(bucket.edgeIndices){var alignedEdgeIndicesLen=Math.ceil(bucket.edgeIndices.length/2/INDICES_EDGE_INDICES_ALIGNEMENT_SIZE)*INDICES_EDGE_INDICES_ALIGNEMENT_SIZE*2;dataTextureRamStats.overheadSizeAlignementEdgeIndices+=2*(alignedEdgeIndicesLen-bucket.edgeIndices.length);var alignedEdgeIndices=new Uint32Array(alignedEdgeIndicesLen);alignedEdgeIndices.fill(0);alignedEdgeIndices.set(bucket.edgeIndices);bucket.edgeIndices=alignedEdgeIndices;}var positionsCompressed=bucket.positionsCompressed;var indices=bucket.indices;var edgeIndices=bucket.edgeIndices;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 numTriangles=0;if(indices){numTriangles=indices.length/3;var indicesBuffer;if(numVertices<=1<<8){indicesBuffer=buffer.indices8Bits;indicesBase=buffer.lenIndices8Bits/3;buffer.lenIndices8Bits+=indices.length;}else if(numVertices<=1<<16){indicesBuffer=buffer.indices16Bits;indicesBase=buffer.lenIndices16Bits/3;buffer.lenIndices16Bits+=indices.length;}else{indicesBuffer=buffer.indices32Bits;indicesBase=buffer.lenIndices32Bits/3;buffer.lenIndices32Bits+=indices.length;}indicesBuffer.push(indices);}var edgeIndicesBase;var numEdges=0;if(edgeIndices){numEdges=edgeIndices.length/2;var edgeIndicesBuffer;if(numVertices<=1<<8){edgeIndicesBuffer=buffer.edgeIndices8Bits;edgeIndicesBase=buffer.lenEdgeIndices8Bits/2;buffer.lenEdgeIndices8Bits+=edgeIndices.length;}else if(numVertices<=1<<16){edgeIndicesBuffer=buffer.edgeIndices16Bits;edgeIndicesBase=buffer.lenEdgeIndices16Bits/2;buffer.lenEdgeIndices16Bits+=edgeIndices.length;}else{edgeIndicesBuffer=buffer.edgeIndices32Bits;edgeIndicesBase=buffer.lenEdgeIndices32Bits/2;buffer.lenEdgeIndices32Bits+=edgeIndices.length;}edgeIndicesBuffer.push(edgeIndices);}this._state.numVertices+=numVertices;dataTextureRamStats.numberOfGeometries++;// const aabb = math.collapseAABB3();
19127
- // math.expandAABB3Points3(aabb, bucket.positionsCompressed);
19128
- // geometryCompressionUtils.decompressAABB(aabb, portionCfg.positionsDecodeMatrix);
19129
- var bucketGeometry={vertexBase:vertexBase,numVertices:numVertices,numTriangles:numTriangles,numEdges:numEdges,indicesBase:indicesBase,edgeIndicesBase:edgeIndicesBase,// aabb,
19130
- obb:null// Lazy-created in _createSubPortion if needed
19131
- };return bucketGeometry;}},{key:"_createSubPortion",value:function _createSubPortion(portionCfg,bucketGeometry,bucket,subPortionAABB){var color=portionCfg.color;portionCfg.metallic;portionCfg.roughness;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$1);// if (meshMatrix) { // NB: SceneModel world matrix is used in shaders and SceneModelMesh.aabb
19132
- //
19133
- // if (!bucketGeometry.obb) {
19134
- // bucketGeometry.obb = math.AABB3ToOBB3(bucketGeometry.aabb);
19135
- // }
19136
- // const geometryOBB = bucketGeometry.obb;
19137
- // for (let i = 0, len = geometryOBB.length; i < len; i += 4) {
19138
- // tempVec4a[0] = geometryOBB[i + 0];
19139
- // tempVec4a[1] = geometryOBB[i + 1];
19140
- // tempVec4a[2] = geometryOBB[i + 2];
19141
- // tempVec4a[3] = 1.0;
19142
- // if (meshMatrix) {
19143
- // math.transformPoint4(meshMatrix, tempVec4a, tempVec4b);
19144
- // }
19145
- // math.expandAABB3Point3(subPortionAABB, tempVec4b);
19146
- // }
19147
- // } else {
19148
- // math.expandAABB3(subPortionAABB, bucketGeometry.aabb);
19149
- // }
19150
- 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
19113
+ if(bucket.edgeIndices){var alignedEdgeIndicesLen=Math.ceil(bucket.edgeIndices.length/2/INDICES_EDGE_INDICES_ALIGNEMENT_SIZE)*INDICES_EDGE_INDICES_ALIGNEMENT_SIZE*2;dataTextureRamStats.overheadSizeAlignementEdgeIndices+=2*(alignedEdgeIndicesLen-bucket.edgeIndices.length);var alignedEdgeIndices=new Uint32Array(alignedEdgeIndicesLen);alignedEdgeIndices.fill(0);alignedEdgeIndices.set(bucket.edgeIndices);bucket.edgeIndices=alignedEdgeIndices;}var positionsCompressed=bucket.positionsCompressed;var indices=bucket.indices;var edgeIndices=bucket.edgeIndices;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 numTriangles=0;if(indices){numTriangles=indices.length/3;var indicesBuffer;if(numVertices<=1<<8){indicesBuffer=buffer.indices8Bits;indicesBase=buffer.lenIndices8Bits/3;buffer.lenIndices8Bits+=indices.length;}else if(numVertices<=1<<16){indicesBuffer=buffer.indices16Bits;indicesBase=buffer.lenIndices16Bits/3;buffer.lenIndices16Bits+=indices.length;}else{indicesBuffer=buffer.indices32Bits;indicesBase=buffer.lenIndices32Bits/3;buffer.lenIndices32Bits+=indices.length;}indicesBuffer.push(indices);}var edgeIndicesBase;var numEdges=0;if(edgeIndices){numEdges=edgeIndices.length/2;var edgeIndicesBuffer;if(numVertices<=1<<8){edgeIndicesBuffer=buffer.edgeIndices8Bits;edgeIndicesBase=buffer.lenEdgeIndices8Bits/2;buffer.lenEdgeIndices8Bits+=edgeIndices.length;}else if(numVertices<=1<<16){edgeIndicesBuffer=buffer.edgeIndices16Bits;edgeIndicesBase=buffer.lenEdgeIndices16Bits/2;buffer.lenEdgeIndices16Bits+=edgeIndices.length;}else{edgeIndicesBuffer=buffer.edgeIndices32Bits;edgeIndicesBase=buffer.lenEdgeIndices32Bits/2;buffer.lenEdgeIndices32Bits+=edgeIndices.length;}edgeIndicesBuffer.push(edgeIndices);}this._state.numVertices+=numVertices;dataTextureRamStats.numberOfGeometries++;var bucketGeometry={vertexBase:vertexBase,numVertices:numVertices,numTriangles:numTriangles,numEdges:numEdges,indicesBase:indicesBase,edgeIndicesBase:edgeIndicesBase,obb:null// Lazy-created in _createSubPortion if needed
19114
+ };return bucketGeometry;}},{key:"_createSubPortion",value:function _createSubPortion(portionCfg,bucketGeometry,bucket,subPortionAABB){var color=portionCfg.color;portionCfg.metallic;portionCfg.roughness;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$1);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
19151
19115
  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 numIndices=bucketGeometry.numTriangles*3;var indicesPortionIdBuffer;if(bucketGeometry.numVertices<=1<<8){indicesPortionIdBuffer=buffer.perTriangleNumberPortionId8Bits;state.numIndices8Bits+=numIndices;dataTextureRamStats.totalPolygons8Bits+=bucketGeometry.numTriangles;}else if(bucketGeometry.numVertices<=1<<16){indicesPortionIdBuffer=buffer.perTriangleNumberPortionId16Bits;state.numIndices16Bits+=numIndices;dataTextureRamStats.totalPolygons16Bits+=bucketGeometry.numTriangles;}else{indicesPortionIdBuffer=buffer.perTriangleNumberPortionId32Bits;state.numIndices32Bits+=numIndices;dataTextureRamStats.totalPolygons32Bits+=bucketGeometry.numTriangles;}dataTextureRamStats.totalPolygons+=bucketGeometry.numTriangles;for(var _i375=0;_i375<bucketGeometry.numTriangles;_i375+=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 _i376=0;_i376<bucketGeometry.numEdges;_i376+=INDICES_EDGE_INDICES_ALIGNEMENT_SIZE){edgeIndicesPortionIdBuffer.push(subPortionId);}}// buffer.perObjectOffsets.push([0, 0, 0]);
19152
19116
  this._subPortions.push({// vertsBase: vertsIndex,
19153
19117
  numVertices:bucketGeometry.numTriangles});this._numPortions++;dataTextureRamStats.numberOfPortions++;return subPortionId;}/**
19154
19118
  * Builds data textures from the appended geometries and loads them into the GPU.
19155
19119
  *
19156
19120
  * No more portions can then be created.
19157
- */},{key:"finalize",value:function finalize(){var _this97=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.perObjectEdgeIndexBaseOffsets,buffer.perObjectSolid);textureState.texturePerObjectInstanceMatrices=this._dataTextureGenerator.generateTextureForInstancingMatrices(gl,buffer.perObjectInstancePositioningMatrices);textureState.texturePerObjectPositionsDecodeMatrix=this._dataTextureGenerator.generateTextureForPositionsDecodeMatrices(gl,buffer.perObjectPositionsDecodeMatrices);// const positionsCompressed = new Uint16Array(buffer.lenPositionsCompressed);
19158
- // for (let i = 0, j = 0, len = buffer.positionsCompressed.length; i < len; i++) {
19159
- // const pc = buffer.positionsCompressed[i];
19160
- // positionsCompressed.set(pc, j);
19161
- // j += pc.length;
19162
- // }
19163
- textureState.texturePerVertexIdCoordinates=this._dataTextureGenerator.generateTextureForPositions(gl,buffer.positionsCompressed,buffer.lenPositionsCompressed);textureState.texturePerPolygonIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId8Bits);textureState.texturePerPolygonIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId16Bits);textureState.texturePerPolygonIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId32Bits);if(buffer.perEdgeNumberPortionId8Bits.length>0){textureState.texturePerEdgeIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId8Bits);}if(buffer.perEdgeNumberPortionId16Bits.length>0){textureState.texturePerEdgeIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId16Bits);}if(buffer.perEdgeNumberPortionId32Bits.length>0){textureState.texturePerEdgeIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId32Bits);}if(buffer.lenIndices8Bits>0){textureState.texturePerPolygonIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerPolygonIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerPolygonIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}if(buffer.lenEdgeIndices8Bits>0){textureState.texturePerPolygonIdEdgeIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitsEdgeIndices(gl,buffer.edgeIndices8Bits,buffer.lenEdgeIndices8Bits);}if(buffer.lenEdgeIndices16Bits>0){textureState.texturePerPolygonIdEdgeIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitsEdgeIndices(gl,buffer.edgeIndices16Bits,buffer.lenEdgeIndices16Bits);}if(buffer.lenEdgeIndices32Bits>0){textureState.texturePerPolygonIdEdgeIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitsEdgeIndices(gl,buffer.edgeIndices32Bits,buffer.lenEdgeIndices32Bits);}textureState.finalize();// Free up memory
19121
+ */},{key:"finalize",value:function finalize(){var _this97=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.perObjectEdgeIndexBaseOffsets,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.texturePerPolygonIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId8Bits);textureState.texturePerPolygonIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId16Bits);textureState.texturePerPolygonIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perTriangleNumberPortionId32Bits);if(buffer.perEdgeNumberPortionId8Bits.length>0){textureState.texturePerEdgeIdPortionIds8Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId8Bits);}if(buffer.perEdgeNumberPortionId16Bits.length>0){textureState.texturePerEdgeIdPortionIds16Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId16Bits);}if(buffer.perEdgeNumberPortionId32Bits.length>0){textureState.texturePerEdgeIdPortionIds32Bits=this._dataTextureGenerator.generateTextureForPackedPortionIds(gl,buffer.perEdgeNumberPortionId32Bits);}if(buffer.lenIndices8Bits>0){textureState.texturePerPolygonIdIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitIndices(gl,buffer.indices8Bits,buffer.lenIndices8Bits);}if(buffer.lenIndices16Bits>0){textureState.texturePerPolygonIdIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitIndices(gl,buffer.indices16Bits,buffer.lenIndices16Bits);}if(buffer.lenIndices32Bits>0){textureState.texturePerPolygonIdIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitIndices(gl,buffer.indices32Bits,buffer.lenIndices32Bits);}if(buffer.lenEdgeIndices8Bits>0){textureState.texturePerPolygonIdEdgeIndices8Bits=this._dataTextureGenerator.generateTextureFor8BitsEdgeIndices(gl,buffer.edgeIndices8Bits,buffer.lenEdgeIndices8Bits);}if(buffer.lenEdgeIndices16Bits>0){textureState.texturePerPolygonIdEdgeIndices16Bits=this._dataTextureGenerator.generateTextureFor16BitsEdgeIndices(gl,buffer.edgeIndices16Bits,buffer.lenEdgeIndices16Bits);}if(buffer.lenEdgeIndices32Bits>0){textureState.texturePerPolygonIdEdgeIndices32Bits=this._dataTextureGenerator.generateTextureFor32BitsEdgeIndices(gl,buffer.edgeIndices32Bits,buffer.lenEdgeIndices32Bits);}textureState.finalize();// Free up memory
19164
19122
  this._buffer=null;this._bucketGeometries={};this._finalized=true;this._deferredSetFlagsDirty=false;//
19165
19123
  this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this97._deferredSetFlagsDirty){_this97._uploadDeferredFlags();}_this97._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);}/**
19166
19124
  * This will _start_ a "set-flags transaction".
@@ -19181,7 +19139,7 @@ this._onSceneRendering=this.model.scene.on("rendering",function(){if(_this97._de
19181
19139
  *
19182
19140
  * Invoking this method will update the colors+flags texture data with new
19183
19141
  * flags/flags2 set since the previous invocation of `_beginDeferredFlags`.
19184
- */},{key:"_uploadDeferredFlags",value:function _uploadDeferredFlags(){console.info("_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
19142
+ */},{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
19185
19143
  0,// xoffset
19186
19144
  0,// yoffset
19187
19145
  textureState.texturePerObjectColorsAndFlags._textureWidth,// width
@@ -19212,7 +19170,7 @@ var f0;if(!visible||culled||xrayed){// Highlight & select are layered on top of
19212
19170
  f0=RENDER_PASSES.NOT_RENDERED;}else{if(transparent){f0=RENDER_PASSES.COLOR_TRANSPARENT;}else{f0=RENDER_PASSES.COLOR_OPAQUE;}}// Silhouette
19213
19171
  var f1;if(!visible||culled){f1=RENDER_PASSES.NOT_RENDERED;}else if(selected){f1=RENDER_PASSES.SILHOUETTE_SELECTED;}else if(highlighted){f1=RENDER_PASSES.SILHOUETTE_HIGHLIGHTED;}else if(xrayed){f1=RENDER_PASSES.SILHOUETTE_XRAYED;}else{f1=RENDER_PASSES.NOT_RENDERED;}// Edges
19214
19172
  var f2=0;if(!visible||culled){f2=RENDER_PASSES.NOT_RENDERED;}else if(selected){f2=RENDER_PASSES.EDGES_SELECTED;}else if(highlighted){f2=RENDER_PASSES.EDGES_HIGHLIGHTED;}else if(xrayed){f2=RENDER_PASSES.EDGES_XRAYED;}else if(edges){if(transparent){f2=RENDER_PASSES.EDGES_COLOR_TRANSPARENT;}else{f2=RENDER_PASSES.EDGES_COLOR_OPAQUE;}}else{f2=RENDER_PASSES.NOT_RENDERED;}// Pick
19215
- var f3=visible&&pickable?RENDER_PASSES.PICK:RENDER_PASSES.NOT_RENDERED;var textureState=this._dataTextureState;var gl=this.model.scene.canvas.gl;tempUint8Array4[0]=f0;tempUint8Array4[1]=f1;tempUint8Array4[2]=f2;tempUint8Array4[3]=f3;// object flags
19173
+ var f3=visible&&!culled&&pickable?RENDER_PASSES.PICK:RENDER_PASSES.NOT_RENDERED;var textureState=this._dataTextureState;var gl=this.model.scene.canvas.gl;tempUint8Array4[0]=f0;tempUint8Array4[1]=f1;tempUint8Array4[2]=f2;tempUint8Array4[3]=f3;// object flags
19216
19174
  textureState.texturePerObjectColorsAndFlags._textureData.set(tempUint8Array4,subPortionId*32+8);if(this._deferredSetFlagsActive||deferred){this._deferredSetFlagsDirty=true;return;}if(++this._numUpdatesInFrame>=MAX_OBJECT_UPDATES_IN_FRAME_WITHOUT_BATCHED_UPDATE){this._beginDeferredFlags();// Subsequent flags updates now deferred
19217
19175
  }gl.bindTexture(gl.TEXTURE_2D,textureState.texturePerObjectColorsAndFlags._texture);gl.texSubImage2D(gl.TEXTURE_2D,0,// level
19218
19176
  subPortionId%512*8+2,// xoffset
@@ -19395,7 +19353,7 @@ return this;}/**
19395
19353
  * Translates the SceneModelTransform along the local Z-axis by the given increment.
19396
19354
  *
19397
19355
  * @param {Number} distance Distance to translate along the Z-axis.
19398
- */},{key:"translateZ",value:function translateZ(distance){this._position[2]+=distance;this._setLocalMatrixDirty();this._model.glRedraw();return this;}},{key:"_setLocalMatrixDirty",value:function _setLocalMatrixDirty(){this._localMatrixDirty=true;this._transformDirty();}},{key:"_transformDirty",value:function _transformDirty(){this._worldMatrixDirty=true;for(var _i382=0,len=this._childTransforms.length;_i382<len;_i382++){var childTransform=this._childTransforms[_i382];childTransform._transformDirty();if(childTransform._meshes&&childTransform._meshes.length>0){var meshes=childTransform._meshes;for(var j=0,lenj=meshes.length;j<lenj;j++){meshes[j]._transformDirty();}}}if(this._meshes&&this._meshes.length>0){var _meshes=this._meshes;for(var _j3=0,_lenj2=_meshes.length;_j3<_lenj2;_j3++){_meshes[_j3]._transformDirty();}}}},{key:"_buildWorldMatrix",value:function _buildWorldMatrix(){var localMatrix=this.matrix;if(!this._parentTransform){for(var _i383=0,len=localMatrix.length;_i383<len;_i383++){this._worldMatrix[_i383]=localMatrix[_i383];}}else{math.mulMat4(this._parentTransform.worldMatrix,localMatrix,this._worldMatrix);}this._worldMatrixDirty=false;}},{key:"_setSubtreeAABBsDirty",value:function _setSubtreeAABBsDirty(sceneTransform){sceneTransform._aabbDirty=true;if(sceneTransform._childTransforms){for(var _i384=0,len=sceneTransform._childTransforms.length;_i384<len;_i384++){this._setSubtreeAABBsDirty(sceneTransform._childTransforms[_i384]);}}}}]);return SceneModelTransform;}();var tempVec3a$8=math.vec3();math.mat4();var tempOBB3=math.OBB3();var DEFAULT_SCALE=math.vec3([1,1,1]);var DEFAULT_POSITION=math.vec3([0,0,0]);var DEFAULT_ROTATION=math.vec3([0,0,0]);var DEFAULT_QUATERNION=math.identityQuaternion();var DEFAULT_MATRIX=math.identityMat4();var DEFAULT_COLOR_TEXTURE_ID="defaultColorTexture";var DEFAULT_METAL_ROUGH_TEXTURE_ID="defaultMetalRoughTexture";var DEFAULT_NORMALS_TEXTURE_ID="defaultNormalsTexture";var DEFAULT_EMISSIVE_TEXTURE_ID="defaultEmissiveTexture";var DEFAULT_OCCLUSION_TEXTURE_ID="defaultOcclusionTexture";var DEFAULT_TEXTURE_SET_ID="defaultTextureSet";var defaultCompressedColor=new Uint8Array([255,255,255]);var VBO_INSTANCED=0;var VBO_BATCHED=1;var DTX=2;/**
19356
+ */},{key:"translateZ",value:function translateZ(distance){this._position[2]+=distance;this._setLocalMatrixDirty();this._model.glRedraw();return this;}},{key:"_setLocalMatrixDirty",value:function _setLocalMatrixDirty(){this._localMatrixDirty=true;this._transformDirty();}},{key:"_transformDirty",value:function _transformDirty(){this._worldMatrixDirty=true;for(var _i382=0,len=this._childTransforms.length;_i382<len;_i382++){var childTransform=this._childTransforms[_i382];childTransform._transformDirty();if(childTransform._meshes&&childTransform._meshes.length>0){var meshes=childTransform._meshes;for(var j=0,lenj=meshes.length;j<lenj;j++){meshes[j]._transformDirty();}}}if(this._meshes&&this._meshes.length>0){var _meshes=this._meshes;for(var _j3=0,_lenj2=_meshes.length;_j3<_lenj2;_j3++){_meshes[_j3]._transformDirty();}}}},{key:"_buildWorldMatrix",value:function _buildWorldMatrix(){var localMatrix=this.matrix;if(!this._parentTransform){for(var _i383=0,len=localMatrix.length;_i383<len;_i383++){this._worldMatrix[_i383]=localMatrix[_i383];}}else{math.mulMat4(this._parentTransform.worldMatrix,localMatrix,this._worldMatrix);}this._worldMatrixDirty=false;}},{key:"_setSubtreeAABBsDirty",value:function _setSubtreeAABBsDirty(sceneTransform){sceneTransform._aabbDirty=true;if(sceneTransform._childTransforms){for(var _i384=0,len=sceneTransform._childTransforms.length;_i384<len;_i384++){this._setSubtreeAABBsDirty(sceneTransform._childTransforms[_i384]);}}}}]);return SceneModelTransform;}();var tempVec3a$8=math.vec3();var tempOBB3=math.OBB3();var DEFAULT_SCALE=math.vec3([1,1,1]);var DEFAULT_POSITION=math.vec3([0,0,0]);var DEFAULT_ROTATION=math.vec3([0,0,0]);var DEFAULT_QUATERNION=math.identityQuaternion();var DEFAULT_MATRIX=math.identityMat4();var DEFAULT_COLOR_TEXTURE_ID="defaultColorTexture";var DEFAULT_METAL_ROUGH_TEXTURE_ID="defaultMetalRoughTexture";var DEFAULT_NORMALS_TEXTURE_ID="defaultNormalsTexture";var DEFAULT_EMISSIVE_TEXTURE_ID="defaultEmissiveTexture";var DEFAULT_OCCLUSION_TEXTURE_ID="defaultOcclusionTexture";var DEFAULT_TEXTURE_SET_ID="defaultTextureSet";var defaultCompressedColor=new Uint8Array([255,255,255]);var VBO_INSTANCED=0;var VBO_BATCHED=1;var DTX=2;/**
19399
19357
  * @desc A high-performance model representation for efficient rendering and low memory usage.
19400
19358
  *
19401
19359
  * # Examples