@xeokit/xeokit-sdk 2.4.0-beta-1 → 2.4.0-beta-3
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.
- package/dist/xeokit-sdk.cjs.js +13 -13
- package/dist/xeokit-sdk.es.js +13 -13
- package/dist/xeokit-sdk.es5.js +22 -9
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/viewer/scene/model/SceneModel.js +12 -12
- package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +1 -1
- package/src/viewer/scene/model/MeshClusteringManager.js +0 -31
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -64785,7 +64785,7 @@ class TrianglesInstancingLayer {
|
|
|
64785
64785
|
*/
|
|
64786
64786
|
constructor(cfg) {
|
|
64787
64787
|
|
|
64788
|
-
|
|
64788
|
+
// console.info("Creating TrianglesInstancingLayer");
|
|
64789
64789
|
|
|
64790
64790
|
/**
|
|
64791
64791
|
* Owner model
|
|
@@ -81805,7 +81805,7 @@ class SceneModel extends Component {
|
|
|
81805
81805
|
this._dtxEnabled = this.scene.dtxEnabled && (cfg.dtxEnabled !== false);
|
|
81806
81806
|
|
|
81807
81807
|
this._enableVertexWelding = false; // Not needed for most objects, and very expensive, so disabled
|
|
81808
|
-
this._enableIndexBucketing =
|
|
81808
|
+
this._enableIndexBucketing = false; // Until fixed: https://github.com/xeokit/xeokit-sdk/issues/1204
|
|
81809
81809
|
|
|
81810
81810
|
this._vboBatchingLayerScratchMemory = getScratchMemory();
|
|
81811
81811
|
this._textureTranscoder = cfg.textureTranscoder || getKTX2TextureTranscoder(this.scene.viewer);
|
|
@@ -83625,7 +83625,7 @@ class SceneModel extends Component {
|
|
|
83625
83625
|
return dtxLayer;
|
|
83626
83626
|
}
|
|
83627
83627
|
}
|
|
83628
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
83628
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
83629
83629
|
dtxLayer = new TrianglesDataTextureLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()
|
|
83630
83630
|
this._dtxLayers[layerId] = dtxLayer;
|
|
83631
83631
|
this.layerList.push(dtxLayer);
|
|
@@ -83648,7 +83648,7 @@ class SceneModel extends Component {
|
|
|
83648
83648
|
while (!vboBatchingLayer) {
|
|
83649
83649
|
switch (cfg.primitive) {
|
|
83650
83650
|
case "triangles":
|
|
83651
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83651
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83652
83652
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83653
83653
|
model,
|
|
83654
83654
|
textureSet,
|
|
@@ -83663,7 +83663,7 @@ class SceneModel extends Component {
|
|
|
83663
83663
|
});
|
|
83664
83664
|
break;
|
|
83665
83665
|
case "solid":
|
|
83666
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83666
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83667
83667
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83668
83668
|
model,
|
|
83669
83669
|
textureSet,
|
|
@@ -83678,7 +83678,7 @@ class SceneModel extends Component {
|
|
|
83678
83678
|
});
|
|
83679
83679
|
break;
|
|
83680
83680
|
case "surface":
|
|
83681
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83681
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83682
83682
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83683
83683
|
model,
|
|
83684
83684
|
textureSet,
|
|
@@ -83693,7 +83693,7 @@ class SceneModel extends Component {
|
|
|
83693
83693
|
});
|
|
83694
83694
|
break;
|
|
83695
83695
|
case "lines":
|
|
83696
|
-
console.info(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
83696
|
+
// console.info(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
83697
83697
|
vboBatchingLayer = new LinesBatchingLayer({
|
|
83698
83698
|
model,
|
|
83699
83699
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -83705,7 +83705,7 @@ class SceneModel extends Component {
|
|
|
83705
83705
|
});
|
|
83706
83706
|
break;
|
|
83707
83707
|
case "points":
|
|
83708
|
-
console.info(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
83708
|
+
// console.info(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
83709
83709
|
vboBatchingLayer = new PointsBatchingLayer({
|
|
83710
83710
|
model,
|
|
83711
83711
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -83759,7 +83759,7 @@ class SceneModel extends Component {
|
|
|
83759
83759
|
while (!vboInstancingLayer) {
|
|
83760
83760
|
switch (geometry.primitive) {
|
|
83761
83761
|
case "triangles":
|
|
83762
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83762
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83763
83763
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83764
83764
|
model,
|
|
83765
83765
|
textureSet,
|
|
@@ -83770,7 +83770,7 @@ class SceneModel extends Component {
|
|
|
83770
83770
|
});
|
|
83771
83771
|
break;
|
|
83772
83772
|
case "solid":
|
|
83773
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83773
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83774
83774
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83775
83775
|
model,
|
|
83776
83776
|
textureSet,
|
|
@@ -83781,7 +83781,7 @@ class SceneModel extends Component {
|
|
|
83781
83781
|
});
|
|
83782
83782
|
break;
|
|
83783
83783
|
case "surface":
|
|
83784
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83784
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83785
83785
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83786
83786
|
model,
|
|
83787
83787
|
textureSet,
|
|
@@ -83792,7 +83792,7 @@ class SceneModel extends Component {
|
|
|
83792
83792
|
});
|
|
83793
83793
|
break;
|
|
83794
83794
|
case "lines":
|
|
83795
|
-
console.info(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
83795
|
+
// console.info(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
83796
83796
|
vboInstancingLayer = new LinesInstancingLayer({
|
|
83797
83797
|
model,
|
|
83798
83798
|
textureSet,
|
|
@@ -83802,7 +83802,7 @@ class SceneModel extends Component {
|
|
|
83802
83802
|
});
|
|
83803
83803
|
break;
|
|
83804
83804
|
case "points":
|
|
83805
|
-
console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
83805
|
+
// console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
83806
83806
|
vboInstancingLayer = new PointsInstancingLayer({
|
|
83807
83807
|
model,
|
|
83808
83808
|
textureSet,
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -64781,7 +64781,7 @@ class TrianglesInstancingLayer {
|
|
|
64781
64781
|
*/
|
|
64782
64782
|
constructor(cfg) {
|
|
64783
64783
|
|
|
64784
|
-
|
|
64784
|
+
// console.info("Creating TrianglesInstancingLayer");
|
|
64785
64785
|
|
|
64786
64786
|
/**
|
|
64787
64787
|
* Owner model
|
|
@@ -81801,7 +81801,7 @@ class SceneModel extends Component {
|
|
|
81801
81801
|
this._dtxEnabled = this.scene.dtxEnabled && (cfg.dtxEnabled !== false);
|
|
81802
81802
|
|
|
81803
81803
|
this._enableVertexWelding = false; // Not needed for most objects, and very expensive, so disabled
|
|
81804
|
-
this._enableIndexBucketing =
|
|
81804
|
+
this._enableIndexBucketing = false; // Until fixed: https://github.com/xeokit/xeokit-sdk/issues/1204
|
|
81805
81805
|
|
|
81806
81806
|
this._vboBatchingLayerScratchMemory = getScratchMemory();
|
|
81807
81807
|
this._textureTranscoder = cfg.textureTranscoder || getKTX2TextureTranscoder(this.scene.viewer);
|
|
@@ -83621,7 +83621,7 @@ class SceneModel extends Component {
|
|
|
83621
83621
|
return dtxLayer;
|
|
83622
83622
|
}
|
|
83623
83623
|
}
|
|
83624
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
83624
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
83625
83625
|
dtxLayer = new TrianglesDataTextureLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()
|
|
83626
83626
|
this._dtxLayers[layerId] = dtxLayer;
|
|
83627
83627
|
this.layerList.push(dtxLayer);
|
|
@@ -83644,7 +83644,7 @@ class SceneModel extends Component {
|
|
|
83644
83644
|
while (!vboBatchingLayer) {
|
|
83645
83645
|
switch (cfg.primitive) {
|
|
83646
83646
|
case "triangles":
|
|
83647
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83647
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83648
83648
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83649
83649
|
model,
|
|
83650
83650
|
textureSet,
|
|
@@ -83659,7 +83659,7 @@ class SceneModel extends Component {
|
|
|
83659
83659
|
});
|
|
83660
83660
|
break;
|
|
83661
83661
|
case "solid":
|
|
83662
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83662
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83663
83663
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83664
83664
|
model,
|
|
83665
83665
|
textureSet,
|
|
@@ -83674,7 +83674,7 @@ class SceneModel extends Component {
|
|
|
83674
83674
|
});
|
|
83675
83675
|
break;
|
|
83676
83676
|
case "surface":
|
|
83677
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83677
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
83678
83678
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
83679
83679
|
model,
|
|
83680
83680
|
textureSet,
|
|
@@ -83689,7 +83689,7 @@ class SceneModel extends Component {
|
|
|
83689
83689
|
});
|
|
83690
83690
|
break;
|
|
83691
83691
|
case "lines":
|
|
83692
|
-
console.info(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
83692
|
+
// console.info(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
83693
83693
|
vboBatchingLayer = new LinesBatchingLayer({
|
|
83694
83694
|
model,
|
|
83695
83695
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -83701,7 +83701,7 @@ class SceneModel extends Component {
|
|
|
83701
83701
|
});
|
|
83702
83702
|
break;
|
|
83703
83703
|
case "points":
|
|
83704
|
-
console.info(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
83704
|
+
// console.info(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
83705
83705
|
vboBatchingLayer = new PointsBatchingLayer({
|
|
83706
83706
|
model,
|
|
83707
83707
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -83755,7 +83755,7 @@ class SceneModel extends Component {
|
|
|
83755
83755
|
while (!vboInstancingLayer) {
|
|
83756
83756
|
switch (geometry.primitive) {
|
|
83757
83757
|
case "triangles":
|
|
83758
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83758
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83759
83759
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83760
83760
|
model,
|
|
83761
83761
|
textureSet,
|
|
@@ -83766,7 +83766,7 @@ class SceneModel extends Component {
|
|
|
83766
83766
|
});
|
|
83767
83767
|
break;
|
|
83768
83768
|
case "solid":
|
|
83769
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83769
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83770
83770
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83771
83771
|
model,
|
|
83772
83772
|
textureSet,
|
|
@@ -83777,7 +83777,7 @@ class SceneModel extends Component {
|
|
|
83777
83777
|
});
|
|
83778
83778
|
break;
|
|
83779
83779
|
case "surface":
|
|
83780
|
-
console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83780
|
+
// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
83781
83781
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
83782
83782
|
model,
|
|
83783
83783
|
textureSet,
|
|
@@ -83788,7 +83788,7 @@ class SceneModel extends Component {
|
|
|
83788
83788
|
});
|
|
83789
83789
|
break;
|
|
83790
83790
|
case "lines":
|
|
83791
|
-
console.info(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
83791
|
+
// console.info(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
83792
83792
|
vboInstancingLayer = new LinesInstancingLayer({
|
|
83793
83793
|
model,
|
|
83794
83794
|
textureSet,
|
|
@@ -83798,7 +83798,7 @@ class SceneModel extends Component {
|
|
|
83798
83798
|
});
|
|
83799
83799
|
break;
|
|
83800
83800
|
case "points":
|
|
83801
|
-
console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
83801
|
+
// console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
83802
83802
|
vboInstancingLayer = new PointsInstancingLayer({
|
|
83803
83803
|
model,
|
|
83804
83804
|
textureSet,
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -17103,7 +17103,8 @@ if(!this._snapDepthBufInitRenderer){this._snapDepthBufInitRenderer=new SnapInsta
|
|
|
17103
17103
|
* @param cfg.geometry
|
|
17104
17104
|
* @param cfg.textureSet
|
|
17105
17105
|
* @param cfg.origin
|
|
17106
|
-
*/function TrianglesInstancingLayer(cfg){_classCallCheck(this,TrianglesInstancingLayer)
|
|
17106
|
+
*/function TrianglesInstancingLayer(cfg){_classCallCheck(this,TrianglesInstancingLayer);// console.info("Creating TrianglesInstancingLayer");
|
|
17107
|
+
/**
|
|
17107
17108
|
* Owner model
|
|
17108
17109
|
* @type {VBOSceneModel}
|
|
17109
17110
|
*/this.model=cfg.model;/**
|
|
@@ -19612,7 +19613,8 @@ gl.RGB,gl.FLOAT,tempFloat32Array3);// gl.bindTexture (gl.TEXTURE_2D, null);
|
|
|
19612
19613
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
19613
19614
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
19614
19615
|
*/function SceneModel(owner){var _this93;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SceneModel);_this93=_super123.call(this,owner,cfg);_this93._dtxEnabled=_this93.scene.dtxEnabled&&cfg.dtxEnabled!==false;_this93._enableVertexWelding=false;// Not needed for most objects, and very expensive, so disabled
|
|
19615
|
-
_this93._enableIndexBucketing=
|
|
19616
|
+
_this93._enableIndexBucketing=false;// Until fixed: https://github.com/xeokit/xeokit-sdk/issues/1204
|
|
19617
|
+
_this93._vboBatchingLayerScratchMemory=getScratchMemory();_this93._textureTranscoder=cfg.textureTranscoder||getKTX2TextureTranscoder(_this93.scene.viewer);_this93._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this93._aabb=math.collapseAABB3();_this93._aabbDirty=true;_this93._quantizationRanges={};_this93._vboInstancingLayers={};_this93._vboBatchingLayers={};_this93._dtxLayers={};_this93._meshList=[];_this93.layerList=[];// For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second
|
|
19616
19618
|
_this93._entityList=[];_this93._geometries={};_this93._dtxBuckets={};// Geometries with optimizations used for data texture representation
|
|
19617
19619
|
_this93._textures={};_this93._textureSets={};_this93._meshes={};_this93._entities={};_this93._scheduledMeshes={};/** @private **/_this93.renderFlags=new RenderFlags();/**
|
|
19618
19620
|
* @private
|
|
@@ -20144,24 +20146,35 @@ if(cfg.textureSetId){cfg.textureSet=this._textureSets[cfg.textureSetId];// if (!
|
|
|
20144
20146
|
}// OBB - used for fast AABB calculation
|
|
20145
20147
|
createGeometryOBB(cfg.geometry);}}cfg.numPrimitives=this._getNumPrimitives(cfg);this._createMesh(cfg);}},{key:"_createMesh",value:function _createMesh(cfg){var mesh=new SceneModelMesh(this,cfg.id,cfg.color,cfg.opacity);mesh.pickId=this.scene._renderer.getPickID(mesh);var pickId=mesh.pickId;var a=pickId>>24&0xFF;var b=pickId>>16&0xFF;var g=pickId>>8&0xFF;var r=pickId&0xFF;cfg.pickColor=new Uint8Array([r,g,b,a]);// Quantized pick color
|
|
20146
20148
|
cfg.worldAABB=math.collapseAABB3();cfg.aabb=cfg.worldAABB;/// Hack for VBOInstancing layer
|
|
20147
|
-
cfg.solid=cfg.primitive==="solid";mesh.origin=math.vec3(cfg.origin);switch(cfg.type){case DTX:mesh.layer=this._getDTXLayer(cfg);break;case VBO_BATCHED:mesh.layer=this._getVBOBatchingLayer(cfg);break;case VBO_INSTANCED:mesh.layer=this._getVBOInstancingLayer(cfg);break;}mesh.portionId=mesh.layer.createPortion(cfg);mesh.aabb=cfg.worldAABB;mesh.numPrimitives=cfg.numPrimitives;math.expandAABB3(this._aabb,mesh.aabb);this._meshes[cfg.id]=mesh;this._meshList.push(mesh);}},{key:"_getNumPrimitives",value:function _getNumPrimitives(cfg){var countIndices=0;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;switch(primitive){case"triangles":case"solid":case"surface":switch(cfg.type){case DTX:for(var _i388=0,len=cfg.buckets.length;_i388<len;_i388++){countIndices+=cfg.buckets[_i388].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/3);case"points":switch(cfg.type){case DTX:for(var _i389=0,_len91=cfg.buckets.length;_i389<_len91;_i389++){countIndices+=cfg.buckets[_i389].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:var geometry=cfg.geometry;countIndices+=geometry.positions?geometry.positions.length:geometry.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i390=0,_len92=cfg.buckets.length;_i390<_len92;_i390++){countIndices+=cfg.buckets[_i390].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/2);}return 0;}},{key:"_getDTXLayer",value:function _getDTXLayer(cfg){var origin=cfg.origin;var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]));var dtxLayer=this._dtxLayers[layerId];if(dtxLayer){if(!dtxLayer.canCreatePortion(cfg)){dtxLayer.finalize();delete this._dtxLayers[layerId];dtxLayer=null;}else{return dtxLayer;}}console.info(
|
|
20148
|
-
|
|
20149
|
+
cfg.solid=cfg.primitive==="solid";mesh.origin=math.vec3(cfg.origin);switch(cfg.type){case DTX:mesh.layer=this._getDTXLayer(cfg);break;case VBO_BATCHED:mesh.layer=this._getVBOBatchingLayer(cfg);break;case VBO_INSTANCED:mesh.layer=this._getVBOInstancingLayer(cfg);break;}mesh.portionId=mesh.layer.createPortion(cfg);mesh.aabb=cfg.worldAABB;mesh.numPrimitives=cfg.numPrimitives;math.expandAABB3(this._aabb,mesh.aabb);this._meshes[cfg.id]=mesh;this._meshList.push(mesh);}},{key:"_getNumPrimitives",value:function _getNumPrimitives(cfg){var countIndices=0;var primitive=cfg.geometry?cfg.geometry.primitive:cfg.primitive;switch(primitive){case"triangles":case"solid":case"surface":switch(cfg.type){case DTX:for(var _i388=0,len=cfg.buckets.length;_i388<len;_i388++){countIndices+=cfg.buckets[_i388].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/3);case"points":switch(cfg.type){case DTX:for(var _i389=0,_len91=cfg.buckets.length;_i389<_len91;_i389++){countIndices+=cfg.buckets[_i389].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:var geometry=cfg.geometry;countIndices+=geometry.positions?geometry.positions.length:geometry.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i390=0,_len92=cfg.buckets.length;_i390<_len92;_i390++){countIndices+=cfg.buckets[_i390].indices.length;}break;case VBO_BATCHED:countIndices+=cfg.indices.length;break;case VBO_INSTANCED:countIndices+=cfg.geometry.indices.length;break;}return Math.round(countIndices/2);}return 0;}},{key:"_getDTXLayer",value:function _getDTXLayer(cfg){var origin=cfg.origin;var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]));var dtxLayer=this._dtxLayers[layerId];if(dtxLayer){if(!dtxLayer.canCreatePortion(cfg)){dtxLayer.finalize();delete this._dtxLayers[layerId];dtxLayer=null;}else{return dtxLayer;}}// console.info(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
20150
|
+
dtxLayer=new TrianglesDataTextureLayer(this,{layerIndex:0,origin:origin});// layerIndex is set in #finalize()
|
|
20151
|
+
this._dtxLayers[layerId]=dtxLayer;this.layerList.push(dtxLayer);return dtxLayer;}},{key:"_getVBOBatchingLayer",value:function _getVBOBatchingLayer(cfg){var model=this;var origin=cfg.origin;var positionsDecodeHash=cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary?this._createHashStringFromMatrix(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary):"-";var textureSetId=cfg.textureSetId||"-";var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(cfg.primitive,".").concat(positionsDecodeHash,".").concat(textureSetId);var vboBatchingLayer=this._vboBatchingLayers[layerId];if(vboBatchingLayer){return vboBatchingLayer;}var textureSet=cfg.textureSet;while(!vboBatchingLayer){switch(cfg.primitive){case"triangles":// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
20152
|
+
vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
20149
20153
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
20150
20154
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
20151
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"solid"
|
|
20155
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"solid":// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
20156
|
+
vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
20152
20157
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
20153
20158
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
20154
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"surface"
|
|
20159
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"surface":// console.info(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
20160
|
+
vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
20155
20161
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
20156
20162
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
20157
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"lines"
|
|
20163
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"lines":// console.info(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
20164
|
+
vboBatchingLayer=new LinesBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
20158
20165
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
20159
20166
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
20160
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize});break;case"points"
|
|
20167
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize});break;case"points":// console.info(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
20168
|
+
vboBatchingLayer=new PointsBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
20161
20169
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
20162
20170
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
20163
20171
|
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize});break;}var lenPositions=cfg.positionsCompressed?cfg.positionsCompressed.length:cfg.positions.length;var canCreatePortion=cfg.primitive==="points"?vboBatchingLayer.canCreatePortion(lenPositions):vboBatchingLayer.canCreatePortion(lenPositions,cfg.indices.length);if(!canCreatePortion){vboBatchingLayer.finalize();delete this._vboBatchingLayers[layerId];vboBatchingLayer=null;}}this._vboBatchingLayers[layerId]=vboBatchingLayer;this.layerList.push(vboBatchingLayer);return vboBatchingLayer;}},{key:"_createHashStringFromMatrix",value:function _createHashStringFromMatrix(matrix){var matrixString=matrix.join('');var hash=0;for(var _i391=0;_i391<matrixString.length;_i391++){var _char=matrixString.charCodeAt(_i391);hash=(hash<<5)-hash+_char;hash|=0;// Convert to 32-bit integer
|
|
20164
|
-
}var hashString=(hash>>>0).toString(16);return hashString;}},{key:"_getVBOInstancingLayer",value:function _getVBOInstancingLayer(cfg){var model=this;var origin=cfg.origin;var textureSetId=cfg.textureSetId||"-";var geometryId=cfg.geometryId;var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(textureSetId,".").concat(geometryId);var vboInstancingLayer=this._vboInstancingLayers[layerId];if(vboInstancingLayer){return vboInstancingLayer;}var textureSet=cfg.textureSet;var geometry=cfg.geometry;while(!vboInstancingLayer){switch(geometry.primitive){case"triangles"
|
|
20172
|
+
}var hashString=(hash>>>0).toString(16);return hashString;}},{key:"_getVBOInstancingLayer",value:function _getVBOInstancingLayer(cfg){var model=this;var origin=cfg.origin;var textureSetId=cfg.textureSetId||"-";var geometryId=cfg.geometryId;var layerId="".concat(Math.round(origin[0]),".").concat(Math.round(origin[1]),".").concat(Math.round(origin[2]),".").concat(textureSetId,".").concat(geometryId);var vboInstancingLayer=this._vboInstancingLayers[layerId];if(vboInstancingLayer){return vboInstancingLayer;}var textureSet=cfg.textureSet;var geometry=cfg.geometry;while(!vboInstancingLayer){switch(geometry.primitive){case"triangles":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
20173
|
+
vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"solid":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
20174
|
+
vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:true});break;case"surface":// console.info(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
20175
|
+
vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"lines":// console.info(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
20176
|
+
vboInstancingLayer=new LinesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;case"points":// console.info(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
20177
|
+
vboInstancingLayer=new PointsInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;}// const lenPositions = geometry.positionsCompressed.length;
|
|
20165
20178
|
// if (!vboInstancingLayer.canCreatePortion(lenPositions, geometry.indices.length)) { // FIXME: indices should be optional
|
|
20166
20179
|
// vboInstancingLayer.finalize();
|
|
20167
20180
|
// delete this._vboInstancingLayers[layerId];
|