@xeokit/xeokit-sdk 2.6.0-beta-2 → 2.6.0-beta-4
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 +29 -25
- package/dist/xeokit-sdk.es.js +29 -25
- package/dist/xeokit-sdk.es5.js +107 -111
- 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/plugins/lib/html/Dot.js +1 -2
- package/src/viewer/scene/model/SceneModel.js +28 -23
package/package.json
CHANGED
|
@@ -8,14 +8,13 @@ class Dot {
|
|
|
8
8
|
this._x = 0;
|
|
9
9
|
this._y = 0;
|
|
10
10
|
|
|
11
|
-
this._visible = true;
|
|
12
11
|
this._dot = document.createElement('div');
|
|
13
12
|
this._dot.className += this._dot.className ? ' viewer-ruler-dot' : 'viewer-ruler-dot';
|
|
14
13
|
|
|
15
14
|
this._dotClickable = document.createElement('div');
|
|
16
15
|
this._dotClickable.className += this._dotClickable.className ? ' viewer-ruler-dot-clickable' : 'viewer-ruler-dot-clickable';
|
|
17
16
|
|
|
18
|
-
this._visible =
|
|
17
|
+
this._visible = !!cfg.visible;
|
|
19
18
|
this._culled = false;
|
|
20
19
|
|
|
21
20
|
var dot = this._dot;
|
|
@@ -1146,6 +1146,8 @@ export class SceneModel extends Component {
|
|
|
1146
1146
|
this._vboBatchingLayers = {};
|
|
1147
1147
|
this._dtxLayers = {};
|
|
1148
1148
|
|
|
1149
|
+
this._meshList = [];
|
|
1150
|
+
|
|
1149
1151
|
this.layerList = []; // For GL state efficiency when drawing, InstancingLayers are in first part, BatchingLayers are in second
|
|
1150
1152
|
this._entityList = [];
|
|
1151
1153
|
|
|
@@ -1155,11 +1157,9 @@ export class SceneModel extends Component {
|
|
|
1155
1157
|
this._textureSets = {};
|
|
1156
1158
|
this._transforms = {};
|
|
1157
1159
|
this._meshes = {};
|
|
1160
|
+
this._unusedMeshes = {};
|
|
1158
1161
|
this._entities = {};
|
|
1159
1162
|
|
|
1160
|
-
this._scheduledMeshes = {};
|
|
1161
|
-
this._meshesCfgsBeforeMeshCreation = {};
|
|
1162
|
-
|
|
1163
1163
|
/** @private **/
|
|
1164
1164
|
this.renderFlags = new RenderFlags();
|
|
1165
1165
|
|
|
@@ -2728,7 +2728,7 @@ export class SceneModel extends Component {
|
|
|
2728
2728
|
* @param {Number} [cfg.opacity=1] Opacity in range ````[0..1]````. Overridden by texture set ````colorTexture````.
|
|
2729
2729
|
* @param {Number} [cfg.metallic=0] Metallic factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
2730
2730
|
* @param {Number} [cfg.roughness=1] Roughness factor in range ````[0..1]````. Overridden by texture set ````metallicRoughnessTexture````.
|
|
2731
|
-
* @returns {
|
|
2731
|
+
* @returns {SceneModelMesh} The new mesh.
|
|
2732
2732
|
*/
|
|
2733
2733
|
createMesh(cfg) {
|
|
2734
2734
|
|
|
@@ -2737,7 +2737,7 @@ export class SceneModel extends Component {
|
|
|
2737
2737
|
return false;
|
|
2738
2738
|
}
|
|
2739
2739
|
|
|
2740
|
-
if (this.
|
|
2740
|
+
if (this._meshes[cfg.id]) {
|
|
2741
2741
|
this.error(`[createMesh] SceneModel already has a mesh with this ID: ${cfg.id}`);
|
|
2742
2742
|
return false;
|
|
2743
2743
|
}
|
|
@@ -3057,17 +3057,7 @@ export class SceneModel extends Component {
|
|
|
3057
3057
|
|
|
3058
3058
|
cfg.numPrimitives = this._getNumPrimitives(cfg);
|
|
3059
3059
|
|
|
3060
|
-
this.
|
|
3061
|
-
|
|
3062
|
-
return true;
|
|
3063
|
-
}
|
|
3064
|
-
|
|
3065
|
-
_createDefaultIndices(numIndices) {
|
|
3066
|
-
const indices = [];
|
|
3067
|
-
for (let i = 0; i < numIndices; i++) {
|
|
3068
|
-
indices.push(i);
|
|
3069
|
-
}
|
|
3070
|
-
return indices;
|
|
3060
|
+
return this._createMesh(cfg);
|
|
3071
3061
|
}
|
|
3072
3062
|
|
|
3073
3063
|
_createMesh(cfg) {
|
|
@@ -3099,6 +3089,9 @@ export class SceneModel extends Component {
|
|
|
3099
3089
|
cfg.meshMatrix = cfg.transform.worldMatrix;
|
|
3100
3090
|
}
|
|
3101
3091
|
mesh.portionId = mesh.layer.createPortion(mesh, cfg);
|
|
3092
|
+
this._meshes[cfg.id] = mesh;
|
|
3093
|
+
this._unusedMeshes[cfg.id] = mesh;
|
|
3094
|
+
this._meshList.push(mesh);
|
|
3102
3095
|
return mesh;
|
|
3103
3096
|
}
|
|
3104
3097
|
|
|
@@ -3459,19 +3452,15 @@ export class SceneModel extends Component {
|
|
|
3459
3452
|
const meshId = cfg.meshIds[i];
|
|
3460
3453
|
let mesh = this._meshes[meshId]; // Trying to get already created mesh
|
|
3461
3454
|
if (!mesh) { // Checks if there is already created mesh for this meshId
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
this.error(`Mesh with this ID not found: "${meshId}" - ignoring this mesh`); // There is no such cfg
|
|
3465
|
-
continue;
|
|
3466
|
-
}
|
|
3467
|
-
mesh = this._createMesh(meshCfg) // There is no such mesh yet, but there is already created cfg, so it creates this mesh
|
|
3468
|
-
this._meshes[cfg.id] = mesh; // Now it will also add this mesh to dictionary of created meshes
|
|
3455
|
+
this.error(`Mesh with this ID not found: "${meshId}" - ignoring this mesh`); // There is no such cfg
|
|
3456
|
+
continue;
|
|
3469
3457
|
}
|
|
3470
3458
|
if (mesh.parent) {
|
|
3471
3459
|
this.error(`Mesh with ID "${meshId}" already belongs to object with ID "${mesh.parent.id}" - ignoring this mesh`);
|
|
3472
3460
|
continue;
|
|
3473
3461
|
}
|
|
3474
3462
|
meshes.push(mesh);
|
|
3463
|
+
delete this._unusedMeshes[meshId];
|
|
3475
3464
|
}
|
|
3476
3465
|
const lodCullable = true;
|
|
3477
3466
|
const entity = new SceneModelEntity(
|
|
@@ -3495,6 +3484,7 @@ export class SceneModel extends Component {
|
|
|
3495
3484
|
if (this.destroyed) {
|
|
3496
3485
|
return;
|
|
3497
3486
|
}
|
|
3487
|
+
this._createDummyEntityForUnusedMeshes();
|
|
3498
3488
|
for (let i = 0, len = this.layerList.length; i < len; i++) {
|
|
3499
3489
|
const layer = this.layerList[i];
|
|
3500
3490
|
layer.finalize();
|
|
@@ -3571,6 +3561,21 @@ export class SceneModel extends Component {
|
|
|
3571
3561
|
}
|
|
3572
3562
|
}
|
|
3573
3563
|
|
|
3564
|
+
/** @private */
|
|
3565
|
+
_createDummyEntityForUnusedMeshes() {
|
|
3566
|
+
const unusedMeshIds = Object.keys(this._unusedMeshes);
|
|
3567
|
+
if (unusedMeshIds.length > 0) {
|
|
3568
|
+
const entityId = `${this.id}-dummyEntityForUnusedMeshes`;
|
|
3569
|
+
this.warn(`Creating dummy SceneModelEntity "${entityId}" for unused SceneMeshes: [${unusedMeshIds.join(",")}]`)
|
|
3570
|
+
this.createEntity({
|
|
3571
|
+
id: entityId,
|
|
3572
|
+
meshIds: unusedMeshIds,
|
|
3573
|
+
isObject: true
|
|
3574
|
+
});
|
|
3575
|
+
}
|
|
3576
|
+
this._unusedMeshes = {};
|
|
3577
|
+
}
|
|
3578
|
+
|
|
3574
3579
|
_getActiveSectionPlanesForLayer(layer) {
|
|
3575
3580
|
const renderFlags = this.renderFlags;
|
|
3576
3581
|
const sectionPlanes = this.scene._sectionPlanesState.sectionPlanes;
|