@xeokit/xeokit-sdk 2.4.0-alpha-56 → 2.4.0-alpha-58
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
CHANGED
|
@@ -46096,8 +46096,6 @@ class SceneModel extends Component {
|
|
|
46096
46096
|
|
|
46097
46097
|
super(owner, cfg);
|
|
46098
46098
|
|
|
46099
|
-
console.log("Creating SceneModel");
|
|
46100
|
-
|
|
46101
46099
|
this._dtxEnabled = this.scene.dtxEnabled && (cfg.dtxEnabled !== false);
|
|
46102
46100
|
|
|
46103
46101
|
this._enableVertexWelding = false; // Not needed for most objects, and very expensive, so disabled
|
|
@@ -47429,7 +47427,7 @@ class SceneModel extends Component {
|
|
|
47429
47427
|
|
|
47430
47428
|
// Batched geometry
|
|
47431
47429
|
|
|
47432
|
-
const useDTX = !!this._dtxEnabled;
|
|
47430
|
+
const useDTX = !!this._dtxEnabled;
|
|
47433
47431
|
|
|
47434
47432
|
if (cfg.primitive === undefined || cfg.primitive === null) {
|
|
47435
47433
|
cfg.primitive = "triangles";
|
|
@@ -47769,6 +47767,7 @@ class SceneModel extends Component {
|
|
|
47769
47767
|
return dtxLayer;
|
|
47770
47768
|
}
|
|
47771
47769
|
}
|
|
47770
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
47772
47771
|
dtxLayer = new TrianglesDataTextureLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()
|
|
47773
47772
|
this._dtxLayers[layerId] = dtxLayer;
|
|
47774
47773
|
this._layerList.push(dtxLayer);
|
|
@@ -47791,6 +47790,7 @@ class SceneModel extends Component {
|
|
|
47791
47790
|
while (!vboBatchingLayer) {
|
|
47792
47791
|
switch (cfg.primitive) {
|
|
47793
47792
|
case "triangles":
|
|
47793
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47794
47794
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47795
47795
|
model,
|
|
47796
47796
|
textureSet,
|
|
@@ -47805,6 +47805,7 @@ class SceneModel extends Component {
|
|
|
47805
47805
|
});
|
|
47806
47806
|
break;
|
|
47807
47807
|
case "solid":
|
|
47808
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47808
47809
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47809
47810
|
model,
|
|
47810
47811
|
textureSet,
|
|
@@ -47819,6 +47820,7 @@ class SceneModel extends Component {
|
|
|
47819
47820
|
});
|
|
47820
47821
|
break;
|
|
47821
47822
|
case "surface":
|
|
47823
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47822
47824
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47823
47825
|
model,
|
|
47824
47826
|
textureSet,
|
|
@@ -47833,6 +47835,7 @@ class SceneModel extends Component {
|
|
|
47833
47835
|
});
|
|
47834
47836
|
break;
|
|
47835
47837
|
case "lines":
|
|
47838
|
+
console.log(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
47836
47839
|
vboBatchingLayer = new LinesBatchingLayer({
|
|
47837
47840
|
model,
|
|
47838
47841
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -47844,6 +47847,7 @@ class SceneModel extends Component {
|
|
|
47844
47847
|
});
|
|
47845
47848
|
break;
|
|
47846
47849
|
case "points":
|
|
47850
|
+
console.log(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
47847
47851
|
vboBatchingLayer = new PointsBatchingLayer({
|
|
47848
47852
|
model,
|
|
47849
47853
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -47897,6 +47901,7 @@ class SceneModel extends Component {
|
|
|
47897
47901
|
while (!vboInstancingLayer) {
|
|
47898
47902
|
switch (geometry.primitive) {
|
|
47899
47903
|
case "triangles":
|
|
47904
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47900
47905
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47901
47906
|
model,
|
|
47902
47907
|
textureSet,
|
|
@@ -47907,6 +47912,7 @@ class SceneModel extends Component {
|
|
|
47907
47912
|
});
|
|
47908
47913
|
break;
|
|
47909
47914
|
case "solid":
|
|
47915
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47910
47916
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47911
47917
|
model,
|
|
47912
47918
|
textureSet,
|
|
@@ -47917,6 +47923,7 @@ class SceneModel extends Component {
|
|
|
47917
47923
|
});
|
|
47918
47924
|
break;
|
|
47919
47925
|
case "surface":
|
|
47926
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47920
47927
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47921
47928
|
model,
|
|
47922
47929
|
textureSet,
|
|
@@ -47927,6 +47934,7 @@ class SceneModel extends Component {
|
|
|
47927
47934
|
});
|
|
47928
47935
|
break;
|
|
47929
47936
|
case "lines":
|
|
47937
|
+
console.log(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
47930
47938
|
vboInstancingLayer = new LinesInstancingLayer({
|
|
47931
47939
|
model,
|
|
47932
47940
|
textureSet,
|
|
@@ -47936,6 +47944,7 @@ class SceneModel extends Component {
|
|
|
47936
47944
|
});
|
|
47937
47945
|
break;
|
|
47938
47946
|
case "points":
|
|
47947
|
+
console.log(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
47939
47948
|
vboInstancingLayer = new PointsInstancingLayer({
|
|
47940
47949
|
model,
|
|
47941
47950
|
textureSet,
|
|
@@ -99444,6 +99453,10 @@ class Viewer {
|
|
|
99444
99453
|
* @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
|
|
99445
99454
|
* @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
|
|
99446
99455
|
* @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
|
|
99456
|
+
* @param {Boolean} [cfg.dtxEnabled=false] Whether to enable data texture-based (DTX) scene representation within the Viewer. When this is true, the Viewer will use data textures to
|
|
99457
|
+
* store geometry on the GPU for triangle meshes that don't have textures. This gives a much lower memory footprint for these types of model element. This mode may not perform well on low-end GPUs that are optimized
|
|
99458
|
+
* to use textures to hold geometry data. Works great on most medium/high-end GPUs found in desktop computers, including the nVIDIA and Intel HD chipsets. Set this false to use the default vertex buffer object (VBO)
|
|
99459
|
+
* mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
|
|
99447
99460
|
*/
|
|
99448
99461
|
constructor(cfg) {
|
|
99449
99462
|
|
|
@@ -99500,7 +99513,10 @@ class Viewer {
|
|
|
99500
99513
|
pickSurfacePrecisionEnabled: (!!cfg.pickSurfacePrecisionEnabled),
|
|
99501
99514
|
logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
|
|
99502
99515
|
pbrEnabled: (!!cfg.pbrEnabled),
|
|
99503
|
-
|
|
99516
|
+
lodEnabled: (!!cfg.lodEnabled),
|
|
99517
|
+
vfcCulling: (!!cfg.vfcEnabled),
|
|
99518
|
+
colorTextureEnabled: (cfg.colorTextureEnabled !== false),
|
|
99519
|
+
dtxEnabled: (!!cfg.dtxEnabled)
|
|
99504
99520
|
});
|
|
99505
99521
|
|
|
99506
99522
|
/**
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -46092,8 +46092,6 @@ class SceneModel extends Component {
|
|
|
46092
46092
|
|
|
46093
46093
|
super(owner, cfg);
|
|
46094
46094
|
|
|
46095
|
-
console.log("Creating SceneModel");
|
|
46096
|
-
|
|
46097
46095
|
this._dtxEnabled = this.scene.dtxEnabled && (cfg.dtxEnabled !== false);
|
|
46098
46096
|
|
|
46099
46097
|
this._enableVertexWelding = false; // Not needed for most objects, and very expensive, so disabled
|
|
@@ -47425,7 +47423,7 @@ class SceneModel extends Component {
|
|
|
47425
47423
|
|
|
47426
47424
|
// Batched geometry
|
|
47427
47425
|
|
|
47428
|
-
const useDTX = !!this._dtxEnabled;
|
|
47426
|
+
const useDTX = !!this._dtxEnabled;
|
|
47429
47427
|
|
|
47430
47428
|
if (cfg.primitive === undefined || cfg.primitive === null) {
|
|
47431
47429
|
cfg.primitive = "triangles";
|
|
@@ -47765,6 +47763,7 @@ class SceneModel extends Component {
|
|
|
47765
47763
|
return dtxLayer;
|
|
47766
47764
|
}
|
|
47767
47765
|
}
|
|
47766
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesDataTextureLayer`);
|
|
47768
47767
|
dtxLayer = new TrianglesDataTextureLayer(this, {layerIndex: 0, origin}); // layerIndex is set in #finalize()
|
|
47769
47768
|
this._dtxLayers[layerId] = dtxLayer;
|
|
47770
47769
|
this._layerList.push(dtxLayer);
|
|
@@ -47787,6 +47786,7 @@ class SceneModel extends Component {
|
|
|
47787
47786
|
while (!vboBatchingLayer) {
|
|
47788
47787
|
switch (cfg.primitive) {
|
|
47789
47788
|
case "triangles":
|
|
47789
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47790
47790
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47791
47791
|
model,
|
|
47792
47792
|
textureSet,
|
|
@@ -47801,6 +47801,7 @@ class SceneModel extends Component {
|
|
|
47801
47801
|
});
|
|
47802
47802
|
break;
|
|
47803
47803
|
case "solid":
|
|
47804
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47804
47805
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47805
47806
|
model,
|
|
47806
47807
|
textureSet,
|
|
@@ -47815,6 +47816,7 @@ class SceneModel extends Component {
|
|
|
47815
47816
|
});
|
|
47816
47817
|
break;
|
|
47817
47818
|
case "surface":
|
|
47819
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesBatchingLayer`);
|
|
47818
47820
|
vboBatchingLayer = new TrianglesBatchingLayer({
|
|
47819
47821
|
model,
|
|
47820
47822
|
textureSet,
|
|
@@ -47829,6 +47831,7 @@ class SceneModel extends Component {
|
|
|
47829
47831
|
});
|
|
47830
47832
|
break;
|
|
47831
47833
|
case "lines":
|
|
47834
|
+
console.log(`[SceneModel ${this.id}]: creating LinesBatchingLayer`);
|
|
47832
47835
|
vboBatchingLayer = new LinesBatchingLayer({
|
|
47833
47836
|
model,
|
|
47834
47837
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -47840,6 +47843,7 @@ class SceneModel extends Component {
|
|
|
47840
47843
|
});
|
|
47841
47844
|
break;
|
|
47842
47845
|
case "points":
|
|
47846
|
+
console.log(`[SceneModel ${this.id}]: creating PointsBatchingLayer`);
|
|
47843
47847
|
vboBatchingLayer = new PointsBatchingLayer({
|
|
47844
47848
|
model,
|
|
47845
47849
|
layerIndex: 0, // This is set in #finalize()
|
|
@@ -47893,6 +47897,7 @@ class SceneModel extends Component {
|
|
|
47893
47897
|
while (!vboInstancingLayer) {
|
|
47894
47898
|
switch (geometry.primitive) {
|
|
47895
47899
|
case "triangles":
|
|
47900
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47896
47901
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47897
47902
|
model,
|
|
47898
47903
|
textureSet,
|
|
@@ -47903,6 +47908,7 @@ class SceneModel extends Component {
|
|
|
47903
47908
|
});
|
|
47904
47909
|
break;
|
|
47905
47910
|
case "solid":
|
|
47911
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47906
47912
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47907
47913
|
model,
|
|
47908
47914
|
textureSet,
|
|
@@ -47913,6 +47919,7 @@ class SceneModel extends Component {
|
|
|
47913
47919
|
});
|
|
47914
47920
|
break;
|
|
47915
47921
|
case "surface":
|
|
47922
|
+
console.log(`[SceneModel ${this.id}]: creating TrianglesInstancingLayer`);
|
|
47916
47923
|
vboInstancingLayer = new TrianglesInstancingLayer({
|
|
47917
47924
|
model,
|
|
47918
47925
|
textureSet,
|
|
@@ -47923,6 +47930,7 @@ class SceneModel extends Component {
|
|
|
47923
47930
|
});
|
|
47924
47931
|
break;
|
|
47925
47932
|
case "lines":
|
|
47933
|
+
console.log(`[SceneModel ${this.id}]: creating LinesInstancingLayer`);
|
|
47926
47934
|
vboInstancingLayer = new LinesInstancingLayer({
|
|
47927
47935
|
model,
|
|
47928
47936
|
textureSet,
|
|
@@ -47932,6 +47940,7 @@ class SceneModel extends Component {
|
|
|
47932
47940
|
});
|
|
47933
47941
|
break;
|
|
47934
47942
|
case "points":
|
|
47943
|
+
console.log(`[SceneModel ${this.id}]: creating PointsInstancingLayer`);
|
|
47935
47944
|
vboInstancingLayer = new PointsInstancingLayer({
|
|
47936
47945
|
model,
|
|
47937
47946
|
textureSet,
|
|
@@ -99440,6 +99449,10 @@ class Viewer {
|
|
|
99440
99449
|
* @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
|
|
99441
99450
|
* @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
|
|
99442
99451
|
* @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
|
|
99452
|
+
* @param {Boolean} [cfg.dtxEnabled=false] Whether to enable data texture-based (DTX) scene representation within the Viewer. When this is true, the Viewer will use data textures to
|
|
99453
|
+
* store geometry on the GPU for triangle meshes that don't have textures. This gives a much lower memory footprint for these types of model element. This mode may not perform well on low-end GPUs that are optimized
|
|
99454
|
+
* to use textures to hold geometry data. Works great on most medium/high-end GPUs found in desktop computers, including the nVIDIA and Intel HD chipsets. Set this false to use the default vertex buffer object (VBO)
|
|
99455
|
+
* mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
|
|
99443
99456
|
*/
|
|
99444
99457
|
constructor(cfg) {
|
|
99445
99458
|
|
|
@@ -99496,7 +99509,10 @@ class Viewer {
|
|
|
99496
99509
|
pickSurfacePrecisionEnabled: (!!cfg.pickSurfacePrecisionEnabled),
|
|
99497
99510
|
logarithmicDepthBufferEnabled: (!!cfg.logarithmicDepthBufferEnabled),
|
|
99498
99511
|
pbrEnabled: (!!cfg.pbrEnabled),
|
|
99499
|
-
|
|
99512
|
+
lodEnabled: (!!cfg.lodEnabled),
|
|
99513
|
+
vfcCulling: (!!cfg.vfcEnabled),
|
|
99514
|
+
colorTextureEnabled: (cfg.colorTextureEnabled !== false),
|
|
99515
|
+
dtxEnabled: (!!cfg.dtxEnabled)
|
|
99500
99516
|
});
|
|
99501
99517
|
|
|
99502
99518
|
/**
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -7348,7 +7348,7 @@ gl.RGB,gl.FLOAT,tempFloat32Array3);// gl.bindTexture (gl.TEXTURE_2D, null);
|
|
|
7348
7348
|
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
|
|
7349
7349
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
7350
7350
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
7351
|
-
*/function SceneModel(owner){var _this32;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SceneModel);_this32=_super65.call(this,owner,cfg);
|
|
7351
|
+
*/function SceneModel(owner){var _this32;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,SceneModel);_this32=_super65.call(this,owner,cfg);_this32._dtxEnabled=_this32.scene.dtxEnabled&&cfg.dtxEnabled!==false;_this32._enableVertexWelding=false;// Not needed for most objects, and very expensive, so disabled
|
|
7352
7352
|
_this32._enableIndexBucketing=true;_this32._vboBatchingLayerScratchMemory=getScratchMemory();_this32._textureTranscoder=cfg.textureTranscoder||getKTX2TextureTranscoder(_this32.scene.viewer);_this32._maxGeometryBatchSize=cfg.maxGeometryBatchSize;_this32._aabb=math.collapseAABB3();_this32._aabbDirty=false;_this32._quantizationRanges={};_this32._vboInstancingLayers={};_this32._vboBatchingLayers={};_this32._dtxLayers={};_this32._layerList=[];// For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second
|
|
7353
7353
|
_this32._entityList=[];_this32._geometries={};_this32._dtxBuckets={};// Geometries with optimizations used for data texture representation
|
|
7354
7354
|
_this32._textures={};_this32._textureSets={};_this32._meshes={};_this32._entities={};_this32._scheduledMeshes={};/** @private **/_this32.renderFlags=new RenderFlags();/**
|
|
@@ -7809,8 +7809,7 @@ if(!this._textureTranscoder){this.error("[createTexture] Can't create texture fr
|
|
|
7809
7809
|
* @param {Number} [cfg.metallic=0] Metallic factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
7810
7810
|
* @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
7811
7811
|
*/},{key:"createMesh",value:function createMesh(cfg){if(cfg.id===undefined||cfg.id===null){this.error("[createMesh] SceneModel.createMesh() config missing: id");return;}if(this._scheduledMeshes[cfg.id]){this.error("[createMesh] SceneModel already has a mesh with this ID: ".concat(cfg.id));return;}var instancing=cfg.geometryId!==undefined;var batching=!instancing;cfg.sceneModelMatrix=this._sceneModelMatrixNonIdentity?this._sceneModelMatrix:null;if(batching){// Batched geometry
|
|
7812
|
-
var useDTX=!!this._dtxEnabled
|
|
7813
|
-
if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("Unsupported value for 'primitive': '".concat(primitive,"' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'."));return;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)");return null;}if(cfg.positions&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary)){this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return null;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return null;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");return null;}if(!cfg.buckets&&!cfg.indices&&cfg.primitive!=="points"){this.error("Param expected: indices (required for '".concat(cfg.primitive,"' primitive type)"));return null;}if((cfg.matrix||cfg.position||cfg.rotation||cfg.scale)&&(cfg.positionsCompressed||cfg.positionsDecodeBoundary)){this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'");return null;}cfg.origin=cfg.origin?math.addVec3(this._origin,cfg.origin,math.vec3()):this._origin;// MATRIX - optional for batching
|
|
7812
|
+
var useDTX=!!this._dtxEnabled;if(cfg.primitive===undefined||cfg.primitive===null){cfg.primitive="triangles";}if(cfg.primitive!=="points"&&cfg.primitive!=="lines"&&cfg.primitive!=="triangles"&&cfg.primitive!=="solid"&&cfg.primitive!=="surface"){this.error("Unsupported value for 'primitive': '".concat(primitive,"' ('geometryId' is absent) - supported values are 'points', 'lines', 'triangles', 'solid' and 'surface'."));return;}if(!cfg.positions&&!cfg.positionsCompressed&&!cfg.buckets){this.error("Param expected: 'positions', 'positionsCompressed' or `buckets` ('geometryId' is absent)");return null;}if(cfg.positions&&(cfg.positionsDecodeMatrix||cfg.positionsDecodeBoundary)){this.error("Illegal params: 'positions' not expected with 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return null;}if(cfg.positionsCompressed&&!cfg.positionsDecodeMatrix&&!cfg.positionsDecodeBoundary){this.error("Param expected: 'positionsCompressed' should be accompanied by 'positionsDecodeMatrix'/'positionsDecodeBoundary' ('geometryId' is absent)");return null;}if(cfg.uvCompressed&&!cfg.uvDecodeMatrix){this.error("Param expected: 'uvCompressed' should be accompanied by `uvDecodeMatrix` ('geometryId' is absent)");return null;}if(!cfg.buckets&&!cfg.indices&&cfg.primitive!=="points"){this.error("Param expected: indices (required for '".concat(cfg.primitive,"' primitive type)"));return null;}if((cfg.matrix||cfg.position||cfg.rotation||cfg.scale)&&(cfg.positionsCompressed||cfg.positionsDecodeBoundary)){this.error("Unexpected params: 'matrix', 'rotation', 'scale', 'position' not allowed with 'positionsCompressed'");return null;}cfg.origin=cfg.origin?math.addVec3(this._origin,cfg.origin,math.vec3()):this._origin;// MATRIX - optional for batching
|
|
7814
7813
|
if(cfg.matrix){cfg.meshMatrix=cfg.matrix;}else if(cfg.scale||cfg.rotation||cfg.position){var _scale=cfg.scale||DEFAULT_SCALE;var _position=cfg.position||DEFAULT_POSITION;var rotation=cfg.rotation||DEFAULT_ROTATION;math.eulerToQuaternion(rotation,"XYZ",DEFAULT_QUATERNION);cfg.meshMatrix=math.composeMat4(_position,DEFAULT_QUATERNION,_scale,math.mat4());}if(cfg.positionsDecodeBoundary){cfg.positionsDecodeMatrix=createPositionsDecodeMatrix(cfg.positionsDecodeBoundary,math.mat4());}if(useDTX){// DTX
|
|
7815
7814
|
cfg.type=DTX;// NPR
|
|
7816
7815
|
cfg.color=cfg.color?new Uint8Array([Math.floor(cfg.color[0]*255),Math.floor(cfg.color[1]*255),Math.floor(cfg.color[2]*255)]):defaultCompressedColor;cfg.opacity=cfg.opacity!==undefined&&cfg.opacity!==null?Math.floor(cfg.opacity*255):255;// RTC
|
|
@@ -7841,24 +7840,24 @@ if(cfg.textureSetId){cfg.textureSet=this._textureSets[cfg.textureSetId];// if (!
|
|
|
7841
7840
|
createGeometryOBB(cfg.geometry);}}cfg.numPrimitives=this._getNumPrimitives(cfg);if(this._vfcManager&&!this._vfcManager.finalized){this._vfcManager.addMesh(cfg);// Deferred so VFC manager can cluster meshes for GPU cache locality
|
|
7842
7841
|
}else{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
|
|
7843
7842
|
cfg.worldAABB=math.collapseAABB3();cfg.aabb=cfg.worldAABB;/// Hack for VBOInstancing layer
|
|
7844
|
-
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;}},{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 _i298=0,len=cfg.buckets.length;_i298<len;_i298++){countIndices+=cfg.buckets[_i298].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 _i299=0,_len81=cfg.buckets.length;_i299<_len81;_i299++){countIndices+=cfg.buckets[_i299].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i300=0,_len82=cfg.buckets.length;_i300<_len82;_i300++){countIndices+=cfg.buckets[_i300].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;}}dtxLayer=new TrianglesDataTextureLayer(this,{layerIndex:0,origin:origin});// layerIndex is set in #finalize()
|
|
7845
|
-
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":vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7843
|
+
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;}},{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 _i298=0,len=cfg.buckets.length;_i298<len;_i298++){countIndices+=cfg.buckets[_i298].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 _i299=0,_len81=cfg.buckets.length;_i299<_len81;_i299++){countIndices+=cfg.buckets[_i299].positionsCompressed.length;}break;case VBO_BATCHED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;case VBO_INSTANCED:countIndices+=cfg.positions?cfg.positions.length:cfg.positionsCompressed.length;break;}return Math.round(countIndices);case"lines":case"line-strip":switch(cfg.type){case DTX:for(var _i300=0,_len82=cfg.buckets.length;_i300<_len82;_i300++){countIndices+=cfg.buckets[_i300].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.log("[SceneModel ".concat(this.id,"]: creating TrianglesDataTextureLayer"));dtxLayer=new TrianglesDataTextureLayer(this,{layerIndex:0,origin:origin});// layerIndex is set in #finalize()
|
|
7844
|
+
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.log("[SceneModel ".concat(this.id,"]: creating TrianglesBatchingLayer"));vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7846
7845
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
7847
7846
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
7848
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"solid":vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7847
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"solid":console.log("[SceneModel ".concat(this.id,"]: creating TrianglesBatchingLayer"));vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7849
7848
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
7850
7849
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
7851
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"surface":vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7850
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"surface":console.log("[SceneModel ".concat(this.id,"]: creating TrianglesBatchingLayer"));vboBatchingLayer=new TrianglesBatchingLayer({model:model,textureSet:textureSet,layerIndex:0,// This is set in #finalize()
|
|
7852
7851
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
7853
7852
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
7854
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"lines":vboBatchingLayer=new LinesBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
7853
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize,solid:cfg.primitive==="solid",autoNormals:true});break;case"lines":console.log("[SceneModel ".concat(this.id,"]: creating LinesBatchingLayer"));vboBatchingLayer=new LinesBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
7855
7854
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
7856
7855
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
7857
|
-
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize});break;case"points":vboBatchingLayer=new PointsBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
7856
|
+
origin:origin,maxGeometryBatchSize:this._maxGeometryBatchSize});break;case"points":console.log("[SceneModel ".concat(this.id,"]: creating PointsBatchingLayer"));vboBatchingLayer=new PointsBatchingLayer({model:model,layerIndex:0,// This is set in #finalize()
|
|
7858
7857
|
scratchMemory:this._vboBatchingLayerScratchMemory,positionsDecodeMatrix:cfg.positionsDecodeMatrix,// Can be undefined
|
|
7859
7858
|
uvDecodeMatrix:cfg.uvDecodeMatrix,// Can be undefined
|
|
7860
7859
|
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 _i301=0;_i301<matrixString.length;_i301++){var _char=matrixString.charCodeAt(_i301);hash=(hash<<5)-hash+_char;hash|=0;// Convert to 32-bit integer
|
|
7861
|
-
}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":vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"solid":vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:true});break;case"surface":vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"lines":vboInstancingLayer=new LinesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;case"points":vboInstancingLayer=new PointsInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;}// const lenPositions = geometry.positionsCompressed.length;
|
|
7860
|
+
}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.log("[SceneModel ".concat(this.id,"]: creating TrianglesInstancingLayer"));vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"solid":console.log("[SceneModel ".concat(this.id,"]: creating TrianglesInstancingLayer"));vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:true});break;case"surface":console.log("[SceneModel ".concat(this.id,"]: creating TrianglesInstancingLayer"));vboInstancingLayer=new TrianglesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0,solid:false});break;case"lines":console.log("[SceneModel ".concat(this.id,"]: creating LinesInstancingLayer"));vboInstancingLayer=new LinesInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;case"points":console.log("[SceneModel ".concat(this.id,"]: creating PointsInstancingLayer"));vboInstancingLayer=new PointsInstancingLayer({model:model,textureSet:textureSet,geometry:geometry,origin:origin,layerIndex:0});break;}// const lenPositions = geometry.positionsCompressed.length;
|
|
7862
7861
|
// if (!vboInstancingLayer.canCreatePortion(lenPositions, geometry.indices.length)) { // FIXME: indices should be optional
|
|
7863
7862
|
// vboInstancingLayer.finalize();
|
|
7864
7863
|
// delete this._vboInstancingLayers[layerId];
|
|
@@ -21716,6 +21715,10 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
21716
21715
|
* @param {Boolean} [cfg.colorTextureEnabled=true] Whether to enable base color texture rendering.
|
|
21717
21716
|
* @param {Boolean} [cfg.pbrEnabled=false] Whether to enable physically-based rendering.
|
|
21718
21717
|
* @param {LocaleService} [cfg.localeService=null] Optional locale-based translation service.
|
|
21718
|
+
* @param {Boolean} [cfg.dtxEnabled=false] Whether to enable data texture-based (DTX) scene representation within the Viewer. When this is true, the Viewer will use data textures to
|
|
21719
|
+
* store geometry on the GPU for triangle meshes that don't have textures. This gives a much lower memory footprint for these types of model element. This mode may not perform well on low-end GPUs that are optimized
|
|
21720
|
+
* to use textures to hold geometry data. Works great on most medium/high-end GPUs found in desktop computers, including the nVIDIA and Intel HD chipsets. Set this false to use the default vertex buffer object (VBO)
|
|
21721
|
+
* mode for storing geometry, which is the standard technique used in most graphics engines, and will work adequately on most low-end GPUs.
|
|
21719
21722
|
*/function Viewer(cfg){_classCallCheck(this,Viewer);/**
|
|
21720
21723
|
* The Viewer's current language setting.
|
|
21721
21724
|
* @property language
|
|
@@ -21736,7 +21739,7 @@ var documentBackgroundColor=ownerDocument.documentElement?parseColor(context,get
|
|
|
21736
21739
|
* The Viewer's {@link Scene}.
|
|
21737
21740
|
* @property scene
|
|
21738
21741
|
* @type {Scene}
|
|
21739
|
-
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false});/**
|
|
21742
|
+
*/this.scene=new Scene(this,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,keyboardEventsElement:cfg.keyboardEventsElement,contextAttr:{preserveDrawingBuffer:cfg.preserveDrawingBuffer!==false,premultipliedAlpha:!!cfg.premultipliedAlpha,antialias:cfg.antialias!==false},spinnerElementId:cfg.spinnerElementId,transparent:cfg.transparent!==false,gammaInput:true,gammaOutput:false,backgroundColor:cfg.backgroundColor,backgroundColorFromAmbientLight:cfg.backgroundColorFromAmbientLight,ticksPerRender:1,ticksPerOcclusionTest:20,units:cfg.units,scale:cfg.scale,origin:cfg.origin,saoEnabled:cfg.saoEnabled,alphaDepthMask:cfg.alphaDepthMask!==false,entityOffsetsEnabled:!!cfg.entityOffsetsEnabled,pickSurfacePrecisionEnabled:!!cfg.pickSurfacePrecisionEnabled,logarithmicDepthBufferEnabled:!!cfg.logarithmicDepthBufferEnabled,pbrEnabled:!!cfg.pbrEnabled,lodEnabled:!!cfg.lodEnabled,vfcCulling:!!cfg.vfcEnabled,colorTextureEnabled:cfg.colorTextureEnabled!==false,dtxEnabled:!!cfg.dtxEnabled});/**
|
|
21740
21743
|
* Metadata about the {@link Scene} and the models and objects within it.
|
|
21741
21744
|
* @property metaScene
|
|
21742
21745
|
* @type {MetaScene}
|