@xeokit/xeokit-sdk 2.6.57 → 2.6.59
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 +19 -8
- package/dist/xeokit-sdk.es.js +19 -8
- package/dist/xeokit-sdk.es5.js +73 -66
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/lib/ui/index.js +10 -0
- package/src/viewer/metadata/MetaModel.js +2 -1
- package/src/viewer/metadata/MetaScene.js +7 -8
package/package.json
CHANGED
|
@@ -14,6 +14,7 @@ const tmpVec4a = math.vec4();
|
|
|
14
14
|
const tmpVec4b = math.vec4();
|
|
15
15
|
const tmpVec4c = math.vec4();
|
|
16
16
|
const tmpVec4d = math.vec4();
|
|
17
|
+
const tmpMat4 = math.mat4();
|
|
17
18
|
|
|
18
19
|
const nop = () => { };
|
|
19
20
|
|
|
@@ -25,6 +26,15 @@ export function transformToNode(from, to, vec) {
|
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const toClipSpace = (camera, worldPos, p) => {
|
|
29
|
+
// The reason the projMatrix is explicitely fetched as below is a complex callback chain
|
|
30
|
+
// leading from a boundary update to a viewMatrix and projMatrix updates, which change their values
|
|
31
|
+
// in the mid of the toClipSpace, leading to incorrect values.
|
|
32
|
+
// The fetch ensures that matrix values are stabilized before used to transform worldPos to p.
|
|
33
|
+
// Better solution would be to ensure that no mutually-triggered callbacks
|
|
34
|
+
// (like boundary => view/projMatrix in this situation) ever happen, so user code can rely
|
|
35
|
+
// on a callback running in a stable context.
|
|
36
|
+
tmpMat4.set(camera.viewMatrix);
|
|
37
|
+
tmpMat4.set(camera.projMatrix);
|
|
28
38
|
// to homogeneous coords
|
|
29
39
|
p.set(worldPos);
|
|
30
40
|
p[3] = 1;
|
|
@@ -227,11 +227,12 @@ class MetaModel {
|
|
|
227
227
|
this.metaScene.metaObjects[id] = metaObject;
|
|
228
228
|
metaObject.metaModels = [];
|
|
229
229
|
}
|
|
230
|
-
this.metaObjects[id] =metaObject;
|
|
230
|
+
this.metaObjects[id] = metaObject;
|
|
231
231
|
if (!metaObjectData.parent) {
|
|
232
232
|
this.rootMetaObjects.push(metaObject);
|
|
233
233
|
metaScene.rootMetaObjects[id] = metaObject;
|
|
234
234
|
}
|
|
235
|
+
metaObject.metaModels.push(this);
|
|
235
236
|
}
|
|
236
237
|
}
|
|
237
238
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {MetaModel} from "./MetaModel.js";
|
|
2
2
|
import {MetaObject} from "./MetaObject.js";
|
|
3
3
|
import {PropertySet} from "./PropertySet.js";
|
|
4
|
-
import {math} from "../scene/math/math.js";
|
|
5
4
|
|
|
6
5
|
/**
|
|
7
6
|
* @desc Metadata corresponding to a {@link Scene}.
|
|
@@ -186,15 +185,15 @@ class MetaScene {
|
|
|
186
185
|
// Remove MetaObjects
|
|
187
186
|
|
|
188
187
|
if (metaModel.metaObjects) {
|
|
189
|
-
for (let
|
|
190
|
-
const metaObject = metaModel.metaObjects[
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
if (metaObject.metaModels.length === 1&& metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete
|
|
194
|
-
delete this.metaObjects[id];
|
|
188
|
+
for (let objectId in metaModel.metaObjects) {
|
|
189
|
+
const metaObject = metaModel.metaObjects[objectId];
|
|
190
|
+
if (metaObject.metaModels.length === 1 && metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete
|
|
191
|
+
delete this.metaObjects[objectId];
|
|
195
192
|
if (!metaObject.parent) {
|
|
196
|
-
delete this.rootMetaObjects[
|
|
193
|
+
delete this.rootMetaObjects[objectId];
|
|
197
194
|
}
|
|
195
|
+
} else {
|
|
196
|
+
metaObject.metaModels = metaObject.metaModels.filter(metaModel => metaModel.id !== metaModelId);
|
|
198
197
|
}
|
|
199
198
|
}
|
|
200
199
|
}
|