@xeokit/xeokit-sdk 2.4.2-beta-8 → 2.4.2-beta-10
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 +83 -23
- package/dist/xeokit-sdk.es.js +83 -23
- package/dist/xeokit-sdk.es5.js +93 -69
- 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/BCFViewpointsPlugin/BCFViewpointsPlugin.js +36 -5
- package/src/viewer/metadata/MetaModel.js +17 -2
- package/src/viewer/scene/model/vbo/linesInstancing/LinesInstancingLayer.js +5 -0
- package/src/viewer/scene/model/vbo/pointsInstancing/PointsInstancingLayer.js +4 -0
- package/src/viewer/scene/model/vbo/trianglesInstancing/TrianglesInstancingLayer.js +21 -16
- package/types/viewer/scene/mesh/Mesh.d.ts +7 -0
- package/types/viewer/scene/models/PerformanceModel/PerformanceModel.d.ts +3 -609
- package/types/viewer/scene/models/SceneModel.d.ts +708 -0
- package/types/viewer/scene/models/SceneModelEntity.d.ts +418 -0
- package/types/viewer/scene/models/SceneModelMesh.d.ts +68 -0
- package/types/viewer/scene/models/SceneModelTexture.d.ts +16 -0
- package/types/viewer/scene/models/SceneModelTextureSet.d.ts +51 -0
- package/types/viewer/scene/models/SceneModelTransform.d.ts +197 -0
- package/types/viewer/scene/models/VBOSceneModel/VBOSceneModel.d.ts +2 -610
- package/types/viewer/scene/models/index.d.ts +8 -1
package/package.json
CHANGED
|
@@ -316,11 +316,29 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
316
316
|
* @param {String} [cfg.id="BCFViewpoints"] Optional ID for this plugin, so that we can find it within {@link Viewer#plugins}.
|
|
317
317
|
* @param {String} [cfg.originatingSystem] Identifies the originating system for BCF records.
|
|
318
318
|
* @param {String} [cfg.authoringTool] Identifies the authoring tool for BCF records.
|
|
319
|
+
* @param {Boolean} [cfg.xrayAsZeroAlpha=false] Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints. See {@link BCFViewpointsPlugin#xrayAsZeroAlpha} for details.
|
|
319
320
|
*/
|
|
320
321
|
constructor(viewer, cfg = {}) {
|
|
321
322
|
|
|
322
323
|
super("BCFViewpoints", viewer, cfg);
|
|
323
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Specifies how xeokit's X-ray emphasis effect is handled in BCF viewpoints.
|
|
327
|
+
*
|
|
328
|
+
* When `xrayAsZeroAlpha` is `true`:
|
|
329
|
+
*
|
|
330
|
+
* * when saving a viewpoint, set the `A` channel of each `coloring` component to `0` for each X-rayed object, and
|
|
331
|
+
* * when loading a viewpoint saved from a xeokit application (i.e. when the viewpoint's `originating_system == "xeokit.io"`), set an object X-rayed if the `A` channel of its corresponding `coloring` component equals `0`
|
|
332
|
+
*
|
|
333
|
+
* When `xrayAsZeroAlpha` is `false`:
|
|
334
|
+
*
|
|
335
|
+
* * don't save any X-ray information in viewpoints, and
|
|
336
|
+
* * reset all objects as not X-rayed whenever loading a viewpoint.
|
|
337
|
+
*
|
|
338
|
+
* @type {boolean}
|
|
339
|
+
*/
|
|
340
|
+
this.xrayAsZeroAlpha = !!cfg.xrayAsZeroAlpha;
|
|
341
|
+
|
|
324
342
|
/**
|
|
325
343
|
* Identifies the originating system to include in BCF viewpoints saved by this plugin.
|
|
326
344
|
* @property originatingSystem
|
|
@@ -509,11 +527,15 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
509
527
|
let alpha;
|
|
510
528
|
|
|
511
529
|
if (entity.xrayed) {
|
|
512
|
-
if (
|
|
513
|
-
|
|
514
|
-
alpha = 0.1;
|
|
530
|
+
if (this.xrayAsZeroAlpha) {
|
|
531
|
+
alpha = 0;
|
|
515
532
|
} else {
|
|
516
|
-
|
|
533
|
+
if (scene.xrayMaterial.fillAlpha === 0.0 && scene.xrayMaterial.edgeAlpha !== 0.0) {
|
|
534
|
+
// BCF can't deal with edges. If xRay is implemented only with edges, set an arbitrary opacity
|
|
535
|
+
alpha = 0.1;
|
|
536
|
+
} else {
|
|
537
|
+
alpha = scene.xrayMaterial.fillAlpha;
|
|
538
|
+
}
|
|
517
539
|
}
|
|
518
540
|
alpha = Math.round(alpha * 255).toString(16).padStart(2, "0");
|
|
519
541
|
color = alpha + color;
|
|
@@ -792,7 +814,16 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
792
814
|
this._withBCFComponent(options, component, entity => {
|
|
793
815
|
entity.colorize = colorize;
|
|
794
816
|
if (alphaDefined) {
|
|
795
|
-
|
|
817
|
+
if (alpha === 0 && this.xrayAsZeroAlpha) {
|
|
818
|
+
const savedFromXeokit = (component.originating_system === this.originatingSystem);
|
|
819
|
+
if (savedFromXeokit) {
|
|
820
|
+
entity.xrayed = true;
|
|
821
|
+
} else {
|
|
822
|
+
entity.opacity = alpha;
|
|
823
|
+
}
|
|
824
|
+
} else {
|
|
825
|
+
entity.opacity = alpha;
|
|
826
|
+
}
|
|
796
827
|
}
|
|
797
828
|
}));
|
|
798
829
|
});
|
|
@@ -151,8 +151,7 @@ class MetaModel {
|
|
|
151
151
|
* @property rootMetaObject
|
|
152
152
|
* @type {MetaObject|null}
|
|
153
153
|
*/
|
|
154
|
-
get rootMetaObject()
|
|
155
|
-
{
|
|
154
|
+
get rootMetaObject() {
|
|
156
155
|
if (this.rootMetaObjects.length == 1) {
|
|
157
156
|
return this.rootMetaObjects[0];
|
|
158
157
|
}
|
|
@@ -172,6 +171,7 @@ class MetaModel {
|
|
|
172
171
|
this._globalizeIDs(metaModelData, options)
|
|
173
172
|
|
|
174
173
|
const metaScene = this.metaScene;
|
|
174
|
+
const propertyLookup = metaModelData.properties;
|
|
175
175
|
|
|
176
176
|
// Create global Property Sets
|
|
177
177
|
|
|
@@ -180,6 +180,9 @@ class MetaModel {
|
|
|
180
180
|
const propertySetData = metaModelData.propertySets[i];
|
|
181
181
|
let propertySet = metaScene.propertySets[propertySetData.id];
|
|
182
182
|
if (!propertySet) {
|
|
183
|
+
if (propertyLookup) {
|
|
184
|
+
this._decompressProperties(propertyLookup, propertySetData.properties);
|
|
185
|
+
}
|
|
183
186
|
propertySet = new PropertySet({
|
|
184
187
|
id: propertySetData.id,
|
|
185
188
|
originalSystemId: propertySetData.originalSystemId || propertySetData.id,
|
|
@@ -225,6 +228,18 @@ class MetaModel {
|
|
|
225
228
|
}
|
|
226
229
|
}
|
|
227
230
|
|
|
231
|
+
_decompressProperties(propertyLookup, properties) {
|
|
232
|
+
for (let i = 0, len = properties.length; i < len; i++) {
|
|
233
|
+
const property = properties[i];
|
|
234
|
+
if (Number.isInteger(property)) {
|
|
235
|
+
const lookupProperty = propertyLookup[property];
|
|
236
|
+
if (lookupProperty) {
|
|
237
|
+
properties[i] = lookupProperty;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
228
243
|
finalize() {
|
|
229
244
|
|
|
230
245
|
if (this.finalized) {
|
|
@@ -522,6 +522,11 @@ class LinesInstancingLayer {
|
|
|
522
522
|
}
|
|
523
523
|
|
|
524
524
|
setMatrix(portionId, matrix) {
|
|
525
|
+
|
|
526
|
+
////////////////////////////////////////
|
|
527
|
+
// TODO: Update portion matrix
|
|
528
|
+
////////////////////////////////////////
|
|
529
|
+
|
|
525
530
|
if (!this._finalized) {
|
|
526
531
|
throw "Not finalized";
|
|
527
532
|
}
|
|
@@ -427,6 +427,10 @@ class PointsInstancingLayer {
|
|
|
427
427
|
}
|
|
428
428
|
|
|
429
429
|
// setMatrix(portionId, matrix) {
|
|
430
|
+
|
|
431
|
+
////////////////////////////////////////
|
|
432
|
+
// TODO: Update portion matrix
|
|
433
|
+
////////////////////////////////////////
|
|
430
434
|
//
|
|
431
435
|
// if (!this._finalized) {
|
|
432
436
|
// throw "Not finalized";
|
|
@@ -752,28 +752,33 @@ class TrianglesInstancingLayer {
|
|
|
752
752
|
if (!this._finalized) {
|
|
753
753
|
throw "Not finalized";
|
|
754
754
|
}
|
|
755
|
-
var offset = portionId * 4;
|
|
756
755
|
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
tempFloat32Vec4[3] = matrix[12];
|
|
756
|
+
////////////////////////////////////////
|
|
757
|
+
// TODO: Update portion matrix
|
|
758
|
+
////////////////////////////////////////
|
|
761
759
|
|
|
762
|
-
|
|
760
|
+
var offset = portionId * 4;
|
|
763
761
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
762
|
+
tempFloat32Vec4[0] = matrix[0];
|
|
763
|
+
tempFloat32Vec4[1] = matrix[4];
|
|
764
|
+
tempFloat32Vec4[2] = matrix[8];
|
|
765
|
+
tempFloat32Vec4[3] = matrix[12];
|
|
768
766
|
|
|
769
|
-
|
|
767
|
+
this._state.modelMatrixCol0Buf.setData(tempFloat32Vec4, offset);
|
|
770
768
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
769
|
+
tempFloat32Vec4[0] = matrix[1];
|
|
770
|
+
tempFloat32Vec4[1] = matrix[5];
|
|
771
|
+
tempFloat32Vec4[2] = matrix[9];
|
|
772
|
+
tempFloat32Vec4[3] = matrix[13];
|
|
775
773
|
|
|
776
|
-
|
|
774
|
+
this._state.modelMatrixCol1Buf.setData(tempFloat32Vec4, offset);
|
|
775
|
+
|
|
776
|
+
tempFloat32Vec4[0] = matrix[2];
|
|
777
|
+
tempFloat32Vec4[1] = matrix[6];
|
|
778
|
+
tempFloat32Vec4[2] = matrix[10];
|
|
779
|
+
tempFloat32Vec4[3] = matrix[14];
|
|
780
|
+
|
|
781
|
+
this._state.modelMatrixCol2Buf.setData(tempFloat32Vec4, offset);
|
|
777
782
|
}
|
|
778
783
|
|
|
779
784
|
// ---------------------- COLOR RENDERING -----------------------------------
|
|
@@ -783,4 +783,11 @@ export declare class Mesh extends Component implements Omit<Entity, 'parent'> {
|
|
|
783
783
|
* @returns {number}
|
|
784
784
|
*/
|
|
785
785
|
stateSortCompare(mesh1: Mesh, mesh2: Mesh): number;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Gets the World, View and Canvas-space positions of each vertex in a callback.
|
|
789
|
+
*
|
|
790
|
+
* @param callback
|
|
791
|
+
*/
|
|
792
|
+
getEachVertex(callback: any): void;
|
|
786
793
|
}
|