Skip to content

Commit

Permalink
Rebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
xeolabs committed Dec 5, 2024
1 parent 7c59521 commit 6361df4
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 91 deletions.
21 changes: 15 additions & 6 deletions dist/xeokit-sdk.cjs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11571,6 +11571,7 @@ const tmpVec4a = math.vec4();
const tmpVec4b = math.vec4();
const tmpVec4c = math.vec4();
const tmpVec4d = math.vec4();
const tmpMat4 = math.mat4();

const nop = () => { };

Expand All @@ -11581,6 +11582,15 @@ function transformToNode(from, to, vec) {
vec[1] += fromRec.top - toRec.top;
}
const toClipSpace = (camera, worldPos, p) => {
// The reason the projMatrix is explicitely fetched as below is a complex callback chain
// leading from a boundary update to a viewMatrix and projMatrix updates, which change their values
// in the mid of the toClipSpace, leading to incorrect values.
// The fetch ensures that matrix values are stabilized before used to transform worldPos to p.
// Better solution would be to ensure that no mutually-triggered callbacks
// (like boundary => view/projMatrix in this situation) ever happen, so user code can rely
// on a callback running in a stable context.
tmpMat4.set(camera.viewMatrix);
tmpMat4.set(camera.projMatrix);
// to homogeneous coords
p.set(worldPos);
p[3] = 1;
Expand Down Expand Up @@ -101437,7 +101447,7 @@ class MetaModel {
this.metaScene.metaObjects[id] = metaObject;
metaObject.metaModels = [];
}
this.metaObjects[id] =metaObject;
this.metaObjects[id] = metaObject;
if (!metaObjectData.parent) {
this.rootMetaObjects.push(metaObject);
metaScene.rootMetaObjects[id] = metaObject;
Expand Down Expand Up @@ -101846,13 +101856,12 @@ class MetaScene {
// Remove MetaObjects

if (metaModel.metaObjects) {
for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
const metaObject = metaModel.metaObjects[i];
const id = metaObject.id;
for (let objectId in metaModel.metaObjects) {
const metaObject = metaModel.metaObjects[objectId];
if (metaObject.metaModels.length === 1 && metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete
delete this.metaObjects[id];
delete this.metaObjects[objectId];
if (!metaObject.parent) {
delete this.rootMetaObjects[id];
delete this.rootMetaObjects[objectId];
}
} else {
metaObject.metaModels = metaObject.metaModels.filter(metaModel => metaModel.id !== metaModelId);
Expand Down
21 changes: 15 additions & 6 deletions dist/xeokit-sdk.es.js
Original file line number Diff line number Diff line change
Expand Up @@ -11567,6 +11567,7 @@ const tmpVec4a = math.vec4();
const tmpVec4b = math.vec4();
const tmpVec4c = math.vec4();
const tmpVec4d = math.vec4();
const tmpMat4 = math.mat4();

const nop = () => { };

Expand All @@ -11577,6 +11578,15 @@ function transformToNode(from, to, vec) {
vec[1] += fromRec.top - toRec.top;
}
const toClipSpace = (camera, worldPos, p) => {
// The reason the projMatrix is explicitely fetched as below is a complex callback chain
// leading from a boundary update to a viewMatrix and projMatrix updates, which change their values
// in the mid of the toClipSpace, leading to incorrect values.
// The fetch ensures that matrix values are stabilized before used to transform worldPos to p.
// Better solution would be to ensure that no mutually-triggered callbacks
// (like boundary => view/projMatrix in this situation) ever happen, so user code can rely
// on a callback running in a stable context.
tmpMat4.set(camera.viewMatrix);
tmpMat4.set(camera.projMatrix);
// to homogeneous coords
p.set(worldPos);
p[3] = 1;
Expand Down Expand Up @@ -101433,7 +101443,7 @@ class MetaModel {
this.metaScene.metaObjects[id] = metaObject;
metaObject.metaModels = [];
}
this.metaObjects[id] =metaObject;
this.metaObjects[id] = metaObject;
if (!metaObjectData.parent) {
this.rootMetaObjects.push(metaObject);
metaScene.rootMetaObjects[id] = metaObject;
Expand Down Expand Up @@ -101842,13 +101852,12 @@ class MetaScene {
// Remove MetaObjects

if (metaModel.metaObjects) {
for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
const metaObject = metaModel.metaObjects[i];
const id = metaObject.id;
for (let objectId in metaModel.metaObjects) {
const metaObject = metaModel.metaObjects[objectId];
if (metaObject.metaModels.length === 1 && metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete
delete this.metaObjects[id];
delete this.metaObjects[objectId];
if (!metaObject.parent) {
delete this.rootMetaObjects[id];
delete this.rootMetaObjects[objectId];
}
} else {
metaObject.metaModels = metaObject.metaModels.filter(metaModel => metaModel.id !== metaModelId);
Expand Down
Loading

0 comments on commit 6361df4

Please sign in to comment.