@crystaldesign/real-time-viewer 25.15.0-beta.1 → 25.15.0-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/build/esm/index.js +81 -47
- package/build/types/real-time-viewer/src/parser/findAssets/index.d.ts.map +1 -1
- package/build/types/real-time-viewer/src/parser/findMaterials/index.d.ts.map +1 -1
- package/build/umd/real-time-viewer.umd.min.js +1 -1
- package/build/umd/real-time-viewer.umd.min.js.LICENSE.txt +0 -2
- package/build/umd/report.html +1 -1
- package/package.json +2 -2
package/build/esm/index.js
CHANGED
|
@@ -3261,7 +3261,7 @@ function _findAssets() {
|
|
|
3261
3261
|
case 0:
|
|
3262
3262
|
_importGeo = function _importGeo3() {
|
|
3263
3263
|
_importGeo = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(geo, path) {
|
|
3264
|
-
var geoCached, size, result, mesh, _sceneStore$onMissing;
|
|
3264
|
+
var geoCached, cachedGeos, unusedGeos, geoCountToDelete, nextToDelete, size, result, mesh, _sceneStore$onMissing;
|
|
3265
3265
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
3266
3266
|
while (1) switch (_context2.prev = _context2.next) {
|
|
3267
3267
|
case 0:
|
|
@@ -3270,16 +3270,39 @@ function _findAssets() {
|
|
|
3270
3270
|
return g.name == geo.name;
|
|
3271
3271
|
});
|
|
3272
3272
|
if (!geoCached) {
|
|
3273
|
-
_context2.next =
|
|
3273
|
+
_context2.next = 4;
|
|
3274
3274
|
break;
|
|
3275
3275
|
}
|
|
3276
|
+
geoCached.metadata = {
|
|
3277
|
+
lastUsed: Date.now()
|
|
3278
|
+
};
|
|
3276
3279
|
return _context2.abrupt("return", geoCached);
|
|
3277
|
-
case
|
|
3280
|
+
case 4:
|
|
3281
|
+
// cache max size otherwise some devices crash (ram to high)
|
|
3282
|
+
cachedGeos = cacheGroup.getChildren(undefined, true);
|
|
3283
|
+
if (cachedGeos.length > 10) {
|
|
3284
|
+
// find unused geos
|
|
3285
|
+
unusedGeos = cachedGeos.filter(function (g) {
|
|
3286
|
+
return !cache.find(function (c) {
|
|
3287
|
+
var _c$geo;
|
|
3288
|
+
return ((_c$geo = c.geo) === null || _c$geo === void 0 ? void 0 : _c$geo.geometry.uniqueId) == g.uniqueId;
|
|
3289
|
+
});
|
|
3290
|
+
});
|
|
3291
|
+
geoCountToDelete = cachedGeos.length - 10;
|
|
3292
|
+
while (geoCountToDelete > 0 && unusedGeos.length > 0) {
|
|
3293
|
+
nextToDelete = unusedGeos.reduce(function (oIdx, cur, curIdx, ar) {
|
|
3294
|
+
return cur.metadata.lastUsed < ar[oIdx].metadata.lastUsed ? curIdx : oIdx;
|
|
3295
|
+
}, 0);
|
|
3296
|
+
unusedGeos[nextToDelete].dispose();
|
|
3297
|
+
unusedGeos.splice(nextToDelete, 1);
|
|
3298
|
+
geoCountToDelete--;
|
|
3299
|
+
}
|
|
3300
|
+
}
|
|
3278
3301
|
size = 0;
|
|
3279
|
-
_context2.prev =
|
|
3280
|
-
_context2.next =
|
|
3302
|
+
_context2.prev = 7;
|
|
3303
|
+
_context2.next = 10;
|
|
3281
3304
|
return loadAssetContainerAsync(path + geo.name + '.glb', sceneStore.scene);
|
|
3282
|
-
case
|
|
3305
|
+
case 10:
|
|
3283
3306
|
result = _context2.sent;
|
|
3284
3307
|
utilStore.setAnalyzeDataRow({
|
|
3285
3308
|
name: geo.name,
|
|
@@ -3297,10 +3320,13 @@ function _findAssets() {
|
|
|
3297
3320
|
result.meshes[0].dispose();
|
|
3298
3321
|
mesh.name = geo.name;
|
|
3299
3322
|
mesh.parent = cacheGroup;
|
|
3323
|
+
mesh.metadata = {
|
|
3324
|
+
lastUsed: Date.now()
|
|
3325
|
+
};
|
|
3300
3326
|
return _context2.abrupt("return", mesh);
|
|
3301
|
-
case
|
|
3302
|
-
_context2.prev =
|
|
3303
|
-
_context2.t0 = _context2["catch"](
|
|
3327
|
+
case 24:
|
|
3328
|
+
_context2.prev = 24;
|
|
3329
|
+
_context2.t0 = _context2["catch"](7);
|
|
3304
3330
|
(_sceneStore$onMissing = sceneStore.onMissingGeo) === null || _sceneStore$onMissing === void 0 || _sceneStore$onMissing.call(sceneStore);
|
|
3305
3331
|
utilStore.setAnalyzeDataRow({
|
|
3306
3332
|
name: geo.name,
|
|
@@ -3311,11 +3337,11 @@ function _findAssets() {
|
|
|
3311
3337
|
found: false
|
|
3312
3338
|
});
|
|
3313
3339
|
return _context2.abrupt("return", undefined);
|
|
3314
|
-
case
|
|
3340
|
+
case 29:
|
|
3315
3341
|
case "end":
|
|
3316
3342
|
return _context2.stop();
|
|
3317
3343
|
}
|
|
3318
|
-
}, _callee2, null, [[
|
|
3344
|
+
}, _callee2, null, [[7, 24]]);
|
|
3319
3345
|
}));
|
|
3320
3346
|
return _importGeo.apply(this, arguments);
|
|
3321
3347
|
};
|
|
@@ -3732,7 +3758,7 @@ var buildScene = function buildScene(_ref) {
|
|
|
3732
3758
|
var geo = mesh.clone('geo_' + mesh.name, parentNode);
|
|
3733
3759
|
geo.position = new Vector3(curGeo.pos.x / 100, curGeo.pos.y / 100, curGeo.pos.z / 100);
|
|
3734
3760
|
geo.rotation = utilStore.degreesToRadians({
|
|
3735
|
-
x: hqsGeo.isIDM3D ? 90 - curGeo.rot.x : -curGeo.rot.x,
|
|
3761
|
+
x: hqsGeo.isIDM3D && curGeo.rot.x != 0 ? 90 - curGeo.rot.x : -curGeo.rot.x,
|
|
3736
3762
|
y: 360 - curGeo.rot.y,
|
|
3737
3763
|
z: 360 - curGeo.rot.z
|
|
3738
3764
|
});
|
|
@@ -3871,16 +3897,41 @@ function _createForOfIteratorHelper$1(r, e) { var t = "undefined" != typeof Symb
|
|
|
3871
3897
|
function _unsupportedIterableToArray$1(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray$1(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0; } }
|
|
3872
3898
|
function _arrayLikeToArray$1(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
3873
3899
|
function findMaterials(cache) {
|
|
3900
|
+
var matsOnMeshes = {};
|
|
3874
3901
|
//! parent = the parent from which on every child should receive the Material
|
|
3875
3902
|
//! id = the id which points to the material that should be assigned
|
|
3876
3903
|
var setMaterials = function setMaterials(onNode, mat) {
|
|
3877
|
-
if (onNode !== null && onNode !== void 0 && onNode._isMesh)
|
|
3904
|
+
if (onNode !== null && onNode !== void 0 && onNode._isMesh) {
|
|
3905
|
+
matsOnMeshes[onNode.uniqueId] = {
|
|
3906
|
+
mat: mat,
|
|
3907
|
+
onNode: onNode
|
|
3908
|
+
};
|
|
3909
|
+
onNode.material = mat;
|
|
3910
|
+
}
|
|
3878
3911
|
var _iterator = _createForOfIteratorHelper$1(onNode.getChildMeshes()),
|
|
3879
3912
|
_step;
|
|
3880
3913
|
try {
|
|
3914
|
+
var _loop = function _loop() {
|
|
3915
|
+
var mesh = _step.value;
|
|
3916
|
+
var existing = Object.keys(matsOnMeshes).find(function (key) {
|
|
3917
|
+
return key == mesh.uniqueId.toString();
|
|
3918
|
+
});
|
|
3919
|
+
if (existing) {
|
|
3920
|
+
if (onNode.uniqueId.toString() == existing) return 0; // continue
|
|
3921
|
+
if (onNode.getChildren().find(function (node) {
|
|
3922
|
+
return node.uniqueId.toString() == existing;
|
|
3923
|
+
})) return 0; // continue
|
|
3924
|
+
}
|
|
3925
|
+
matsOnMeshes[mesh.uniqueId] = {
|
|
3926
|
+
mat: mat,
|
|
3927
|
+
onNode: onNode
|
|
3928
|
+
};
|
|
3929
|
+
mesh.material = mat;
|
|
3930
|
+
},
|
|
3931
|
+
_ret;
|
|
3881
3932
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
3882
|
-
|
|
3883
|
-
|
|
3933
|
+
_ret = _loop();
|
|
3934
|
+
if (_ret === 0) continue;
|
|
3884
3935
|
}
|
|
3885
3936
|
} catch (err) {
|
|
3886
3937
|
_iterator.e(err);
|
|
@@ -3890,7 +3941,7 @@ function findMaterials(cache) {
|
|
|
3890
3941
|
};
|
|
3891
3942
|
|
|
3892
3943
|
//! find On Node from json to scene and then call setMaterials to apply it to all Children
|
|
3893
|
-
var findOnNode = function findOnNode(mat, parent) {
|
|
3944
|
+
var findOnNode = function findOnNode(mat, parent, onNode) {
|
|
3894
3945
|
if (!mat.onNodes) return;
|
|
3895
3946
|
var children = parent.getChildTransformNodes(false);
|
|
3896
3947
|
var _iterator2 = _createForOfIteratorHelper$1(children),
|
|
@@ -3898,20 +3949,10 @@ function findMaterials(cache) {
|
|
|
3898
3949
|
try {
|
|
3899
3950
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3900
3951
|
var child = _step2.value;
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
3905
|
-
var onNode = _step3.value;
|
|
3906
|
-
if (onNode == "" || onNode == "ALL") setMaterials(child, mat.mat);
|
|
3907
|
-
if (child.name.startsWith(onNode) || child.name.startsWith('geo_') && child.name.includes(onNode)) {
|
|
3908
|
-
setMaterials(child, mat.mat);
|
|
3909
|
-
}
|
|
3910
|
-
}
|
|
3911
|
-
} catch (err) {
|
|
3912
|
-
_iterator3.e(err);
|
|
3913
|
-
} finally {
|
|
3914
|
-
_iterator3.f();
|
|
3952
|
+
if (onNode == "" || onNode == "ALL") setMaterials(child, mat.mat);
|
|
3953
|
+
if (child.name.startsWith(onNode) || child.name.startsWith('geo_') && child.name.includes(onNode)) {
|
|
3954
|
+
if (child.getChildren(undefined, true)) {}
|
|
3955
|
+
setMaterials(child, mat.mat);
|
|
3915
3956
|
}
|
|
3916
3957
|
}
|
|
3917
3958
|
} catch (err) {
|
|
@@ -3920,29 +3961,22 @@ function findMaterials(cache) {
|
|
|
3920
3961
|
_iterator2.f();
|
|
3921
3962
|
}
|
|
3922
3963
|
};
|
|
3923
|
-
var
|
|
3924
|
-
|
|
3964
|
+
var _iterator3 = _createForOfIteratorHelper$1(cache),
|
|
3965
|
+
_step3;
|
|
3925
3966
|
try {
|
|
3926
|
-
for (
|
|
3927
|
-
var element =
|
|
3967
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
3968
|
+
var element = _step3.value;
|
|
3928
3969
|
if (!element.material || !element.material.parents) continue;
|
|
3929
|
-
var
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
var parent = _step5.value;
|
|
3934
|
-
findOnNode(element.material, parent);
|
|
3935
|
-
}
|
|
3936
|
-
} catch (err) {
|
|
3937
|
-
_iterator5.e(err);
|
|
3938
|
-
} finally {
|
|
3939
|
-
_iterator5.f();
|
|
3970
|
+
for (var idx = 0; idx < element.material.parents.length; idx++) {
|
|
3971
|
+
var parent = element.material.parents[idx];
|
|
3972
|
+
var onNode = element.material.onNodes[idx];
|
|
3973
|
+
findOnNode(element.material, parent, onNode);
|
|
3940
3974
|
}
|
|
3941
3975
|
}
|
|
3942
3976
|
} catch (err) {
|
|
3943
|
-
|
|
3977
|
+
_iterator3.e(err);
|
|
3944
3978
|
} finally {
|
|
3945
|
-
|
|
3979
|
+
_iterator3.f();
|
|
3946
3980
|
}
|
|
3947
3981
|
return findMaterials;
|
|
3948
3982
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findAssets/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAW,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,wBAA8B,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findAssets/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAGrE,OAAO,EAAE,UAAU,EAAW,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAKpC,wBAA8B,UAAU,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE;;;GAoK1E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findMaterials/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAY,MAAM,aAAa,CAAC;AAG9C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/parser/findMaterials/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAY,MAAM,aAAa,CAAC;AAG9C,MAAM,CAAC,OAAO,UAAU,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,wBA6CnD"}
|