@combeenation/3d-viewer 16.0.0 → 17.0.0
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/README.md +2 -2
- package/dist/lib-cjs/buildinfo.json +1 -1
- package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
- package/dist/lib-cjs/helper/decals-helper.d.ts +0 -8
- package/dist/lib-cjs/helper/decals-helper.js +20 -17
- package/dist/lib-cjs/helper/decals-helper.js.map +1 -1
- package/dist/lib-cjs/index.d.ts +3 -0
- package/dist/lib-cjs/index.js +3 -0
- package/dist/lib-cjs/index.js.map +1 -1
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js +9 -1
- package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js.map +1 -1
- package/dist/lib-cjs/internal/cloning-helper.d.ts +3 -2
- package/dist/lib-cjs/internal/cloning-helper.js +66 -43
- package/dist/lib-cjs/internal/cloning-helper.js.map +1 -1
- package/dist/lib-cjs/internal/metadata-helper.d.ts +15 -13
- package/dist/lib-cjs/internal/metadata-helper.js +11 -17
- package/dist/lib-cjs/internal/metadata-helper.js.map +1 -1
- package/dist/lib-cjs/internal/tags-helper.js +9 -9
- package/dist/lib-cjs/internal/tags-helper.js.map +1 -1
- package/dist/lib-cjs/manager/debug-manager.d.ts +11 -19
- package/dist/lib-cjs/manager/debug-manager.js +67 -50
- package/dist/lib-cjs/manager/debug-manager.js.map +1 -1
- package/dist/lib-cjs/manager/gltf-export-manager.js +2 -7
- package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
- package/dist/lib-cjs/manager/material-manager.js +0 -1
- package/dist/lib-cjs/manager/material-manager.js.map +1 -1
- package/dist/lib-cjs/manager/model-manager.d.ts +9 -0
- package/dist/lib-cjs/manager/model-manager.js +19 -8
- package/dist/lib-cjs/manager/model-manager.js.map +1 -1
- package/dist/lib-cjs/manager/parameter-manager.d.ts +0 -14
- package/dist/lib-cjs/manager/parameter-manager.js +0 -19
- package/dist/lib-cjs/manager/parameter-manager.js.map +1 -1
- package/dist/lib-cjs/manager/texture-manager.js +1 -1
- package/dist/lib-cjs/manager/texture-manager.js.map +1 -1
- package/dist/lib-cjs/viewer.d.ts +1 -0
- package/dist/lib-cjs/viewer.js +10 -1
- package/dist/lib-cjs/viewer.js.map +1 -1
- package/package.json +12 -13
- package/src/helper/decals-helper.ts +27 -23
- package/src/index.ts +3 -0
- package/src/internal/cbn-custom-babylon-loader-plugin.ts +9 -1
- package/src/internal/cloning-helper.ts +83 -55
- package/src/internal/metadata-helper.ts +31 -28
- package/src/internal/tags-helper.ts +1 -2
- package/src/manager/debug-manager.ts +83 -81
- package/src/manager/gltf-export-manager.ts +4 -9
- package/src/manager/material-manager.ts +0 -2
- package/src/manager/model-manager.ts +31 -14
- package/src/manager/parameter-manager.ts +0 -24
- package/src/manager/texture-manager.ts +1 -1
- package/src/viewer.ts +13 -1
|
@@ -3,7 +3,6 @@ export declare const DEFAULT_DECAL_CONFIG: {
|
|
|
3
3
|
normal: number[];
|
|
4
4
|
angle: number;
|
|
5
5
|
offset: number;
|
|
6
|
-
scaling: number[];
|
|
7
6
|
captureUVS: boolean;
|
|
8
7
|
cullBackFaces: boolean;
|
|
9
8
|
localMode: boolean;
|
|
@@ -24,13 +23,6 @@ export declare type DecalConfiguration = {
|
|
|
24
23
|
* Default `0.001` (1mm)
|
|
25
24
|
*/
|
|
26
25
|
offset?: number;
|
|
27
|
-
/**
|
|
28
|
-
* Can be used for shifting the decal away from the source mesh as alternative to `offset`.\
|
|
29
|
-
* Use this setting when the offset should be applied in radial direction (e.g. cylinders)
|
|
30
|
-
*
|
|
31
|
-
* Default `[1, 1, 1]` (no offset through scaling)
|
|
32
|
-
*/
|
|
33
|
-
scaling?: Tuple<number, 3>;
|
|
34
26
|
/**
|
|
35
27
|
* `true`: Use UV mapping from source mesh\
|
|
36
28
|
* `false`: Use default box mapping from the decal
|
|
@@ -6,7 +6,6 @@ exports.DEFAULT_DECAL_CONFIG = {
|
|
|
6
6
|
normal: [0, 0, 1],
|
|
7
7
|
angle: 0,
|
|
8
8
|
offset: 0.001,
|
|
9
|
-
scaling: [1, 1, 1],
|
|
10
9
|
captureUVS: false,
|
|
11
10
|
cullBackFaces: true,
|
|
12
11
|
localMode: true,
|
|
@@ -20,7 +19,7 @@ exports.DEFAULT_DECAL_CONFIG = {
|
|
|
20
19
|
* - move decal along the "normal" to avoid clipping
|
|
21
20
|
*/
|
|
22
21
|
function createDecalMesh(config, assetContainer, addToScene = true) {
|
|
23
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
22
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
24
23
|
const sourceMesh = assetContainer.meshes.find(mesh => mesh.name === config.sourceMeshName);
|
|
25
24
|
if (!sourceMesh) {
|
|
26
25
|
throw new __1.ViewerError({
|
|
@@ -28,18 +27,14 @@ function createDecalMesh(config, assetContainer, addToScene = true) {
|
|
|
28
27
|
message: `Source mesh for decal "${config.name}" couldn't be found`,
|
|
29
28
|
});
|
|
30
29
|
}
|
|
31
|
-
const position = __1.Vector3.FromArray(config.position);
|
|
32
|
-
const normal = __1.Vector3.FromArray((_a = config.normal) !== null && _a !== void 0 ? _a : exports.DEFAULT_DECAL_CONFIG.normal).normalizeToNew();
|
|
33
|
-
const localMode = (_b = config.localMode) !== null && _b !== void 0 ? _b : exports.DEFAULT_DECAL_CONFIG.localMode;
|
|
34
|
-
const worldNormal = localMode ? __1.Vector3.TransformNormal(normal, sourceMesh.getWorldMatrix()) : normal;
|
|
35
30
|
const decalMesh = __1.MeshBuilder.CreateDecal(config.name, sourceMesh, {
|
|
36
|
-
position: position,
|
|
37
|
-
normal: normal,
|
|
31
|
+
position: __1.Vector3.FromArray(config.position),
|
|
32
|
+
normal: __1.Vector3.FromArray((_a = config.normal) !== null && _a !== void 0 ? _a : exports.DEFAULT_DECAL_CONFIG.normal).normalizeToNew(),
|
|
38
33
|
size: __1.Vector3.FromArray(config.size),
|
|
39
|
-
angle: (
|
|
40
|
-
captureUVS: (
|
|
41
|
-
cullBackFaces: (
|
|
42
|
-
localMode: (
|
|
34
|
+
angle: (_b = config.angle) !== null && _b !== void 0 ? _b : exports.DEFAULT_DECAL_CONFIG.angle,
|
|
35
|
+
captureUVS: (_c = config.captureUVS) !== null && _c !== void 0 ? _c : exports.DEFAULT_DECAL_CONFIG.captureUVS,
|
|
36
|
+
cullBackFaces: (_d = config.cullBackFaces) !== null && _d !== void 0 ? _d : exports.DEFAULT_DECAL_CONFIG.cullBackFaces,
|
|
37
|
+
localMode: (_e = config.localMode) !== null && _e !== void 0 ? _e : exports.DEFAULT_DECAL_CONFIG.localMode,
|
|
43
38
|
});
|
|
44
39
|
if (!addToScene) {
|
|
45
40
|
const scene = sourceMesh.getScene();
|
|
@@ -48,13 +43,21 @@ function createDecalMesh(config, assetContainer, addToScene = true) {
|
|
|
48
43
|
// make sure that the decal is part of the source mesh asset container
|
|
49
44
|
decalMesh._parentContainer = assetContainer;
|
|
50
45
|
assetContainer.meshes.push(decalMesh);
|
|
51
|
-
decalMesh.sideOrientation = (
|
|
46
|
+
decalMesh.sideOrientation = (_f = config.sideOrientation) !== null && _f !== void 0 ? _f : exports.DEFAULT_DECAL_CONFIG.sideOrientation;
|
|
52
47
|
// move decal away from mesh to avoid clipping
|
|
53
48
|
// NOTE: zOffset of material can't be used, since it's not supported in glTF and therefore not usable in AR
|
|
54
|
-
const
|
|
55
|
-
decalMesh.
|
|
56
|
-
|
|
57
|
-
|
|
49
|
+
const positions = decalMesh.getVerticesData(__1.VertexBuffer.PositionKind);
|
|
50
|
+
const normals = decalMesh.getVerticesData(__1.VertexBuffer.NormalKind);
|
|
51
|
+
if (positions && normals) {
|
|
52
|
+
const offset = (_g = config.offset) !== null && _g !== void 0 ? _g : exports.DEFAULT_DECAL_CONFIG.offset;
|
|
53
|
+
// move each vertice individually along it's dedicated normal
|
|
54
|
+
for (let i = 0; i < positions.length; i += 3) {
|
|
55
|
+
positions[i] += normals[i] * offset;
|
|
56
|
+
positions[i + 1] += normals[i + 1] * offset;
|
|
57
|
+
positions[i + 2] += normals[i + 2] * offset;
|
|
58
|
+
}
|
|
59
|
+
decalMesh.setVerticesData(__1.VertexBuffer.PositionKind, positions);
|
|
60
|
+
}
|
|
58
61
|
return decalMesh;
|
|
59
62
|
}
|
|
60
63
|
exports.createDecalMesh = createDecalMesh;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decals-helper.js","sourceRoot":"","sources":["../../../src/helper/decals-helper.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"decals-helper.js","sourceRoot":"","sources":["../../../src/helper/decals-helper.ts"],"names":[],"mappings":";;;AAAA,0BAUY;AAEC,QAAA,oBAAoB,GAAG;IAClC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACjB,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,KAAK;IACb,UAAU,EAAE,KAAK;IACjB,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,IAAI;IACf,eAAe,EAAE,YAAQ,CAAC,wBAAwB;CACnD,CAAC;AAqDF;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,MAA0B,EAAE,cAA+B,EAAE,UAAU,GAAG,IAAI;;IAC5G,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC;IAC3F,IAAI,CAAC,UAAU,EAAE;QACf,MAAM,IAAI,eAAW,CAAC;YACpB,EAAE,EAAE,kBAAc,CAAC,yBAAyB;YAC5C,OAAO,EAAE,0BAA0B,MAAM,CAAC,IAAI,qBAAqB;SACpE,CAAC,CAAC;KACJ;IAED,MAAM,SAAS,GAAG,eAAW,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,EAAE,UAAU,EAAE;QACjE,QAAQ,EAAE,WAAO,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CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE;YAC5C,SAAS,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;YACpC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;YAC5C,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC;SAC7C;QAED,SAAS,CAAC,eAAe,CAAC,gBAAY,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC;KACjE;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAhDD,0CAgDC"}
|
package/dist/lib-cjs/index.d.ts
CHANGED
|
@@ -27,11 +27,14 @@ export * from '@babylonjs/core/Meshes/meshBuilder';
|
|
|
27
27
|
export * from '@babylonjs/core/Meshes/transformNode';
|
|
28
28
|
export * from '@babylonjs/core/Misc/interfaces/screenshotSize';
|
|
29
29
|
export * from '@babylonjs/core/Misc/screenshotTools';
|
|
30
|
+
export * from '@babylonjs/core/Misc/tags';
|
|
30
31
|
export * from '@babylonjs/core/Morph';
|
|
31
32
|
export * from '@babylonjs/core/node';
|
|
32
33
|
export * from '@babylonjs/core/Rendering/utilityLayerRenderer';
|
|
33
34
|
export * from '@babylonjs/core/scene';
|
|
34
35
|
export * from '@babylonjs/core/types';
|
|
36
|
+
export * from '@babylonjs/gui/2D/advancedDynamicTexture';
|
|
37
|
+
export * from '@babylonjs/gui/2D/controls/textBlock';
|
|
35
38
|
export * from '@babylonjs/loaders/glTF/2.0/glTFLoader';
|
|
36
39
|
export * from '@babylonjs/serializers/glTF/2.0/glTFSerializer';
|
|
37
40
|
export * from '@babylonjs/core/Collisions';
|
package/dist/lib-cjs/index.js
CHANGED
|
@@ -51,11 +51,14 @@ __exportStar(require("@babylonjs/core/Meshes/meshBuilder"), exports);
|
|
|
51
51
|
__exportStar(require("@babylonjs/core/Meshes/transformNode"), exports);
|
|
52
52
|
__exportStar(require("@babylonjs/core/Misc/interfaces/screenshotSize"), exports);
|
|
53
53
|
__exportStar(require("@babylonjs/core/Misc/screenshotTools"), exports);
|
|
54
|
+
__exportStar(require("@babylonjs/core/Misc/tags"), exports);
|
|
54
55
|
__exportStar(require("@babylonjs/core/Morph"), exports);
|
|
55
56
|
__exportStar(require("@babylonjs/core/node"), exports);
|
|
56
57
|
__exportStar(require("@babylonjs/core/Rendering/utilityLayerRenderer"), exports);
|
|
57
58
|
__exportStar(require("@babylonjs/core/scene"), exports);
|
|
58
59
|
__exportStar(require("@babylonjs/core/types"), exports);
|
|
60
|
+
__exportStar(require("@babylonjs/gui/2D/advancedDynamicTexture"), exports);
|
|
61
|
+
__exportStar(require("@babylonjs/gui/2D/controls/textBlock"), exports);
|
|
59
62
|
__exportStar(require("@babylonjs/loaders/glTF/2.0/glTFLoader"), exports);
|
|
60
63
|
__exportStar(require("@babylonjs/serializers/glTF/2.0/glTFSerializer"), exports);
|
|
61
64
|
// Additional Babylon.js modules
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAA0C;AAC1C,wBAAwB;AACxB,qDAAqD;AACrD,kDAAgD;AAChD,sDAAoD;AAEpD,qBAAqB;AACrB,2DAA2D;AAC3D,wHAAwH;AACxH,+CAA+C;AAC/C,yGAAyG;AACzG,iEAAiE;AACjE,6DAA2C;AAC3C,iEAA+C;AAC/C,kEAAgD;AAChD,0DAAwC;AACxC,0EAAwD;AACxD,iEAA+C;AAC/C,0DAAwC;AACxC,mEAAiD;AACjD,mEAAiD;AACjD,iEAA+C;AAC/C,qEAAmD;AACnD,yDAAuC;AACvC,0DAAwC;AACxC,qEAAmD;AACnD,gEAA8C;AAC9C,6EAA2D;AAC3D,qEAAmD;AACnD,wDAAsC;AACtC,sEAAoD;AACpD,kEAAgD;AAChD,uEAAqD;AACrD,8DAA4C;AAC5C,qEAAmD;AACnD,uEAAqD;AACrD,iFAA+D;AAC/D,uEAAqD;AACrD,wDAAsC;AACtC,uDAAqC;AACrC,iFAA+D;AAC/D,wDAAsC;AACtC,wDAAsC;AACtC,yEAAuD;AACvD,iFAA+D;AAE/D,gCAAgC;AAChC,sHAAsH;AACtH,UAAU;AACV,2DAA2D;AAC3D,6DAA2C;AAC3C,qCAAqC;AACrC,uEAAqD;AACrD,sDAAsD;AACtD,uEAAqD;AACrD,gDAAgD;AAChD,iEAA+C;AAE/C,iBAAiB;AACjB,qFAAqF;AACrF,2CAAyB;AACzB,iDAA+B;AAC/B,2DAAyC;AACzC,0DAAwC;AACxC,0DAAwC;AACxC,gEAA8C;AAC9C,6DAA2C;AAC3C,0DAAwC;AACxC,8DAA4C;AAC5C,0DAAwC;AACxC,4DAA0C;AAC1C,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAA0C;AAC1C,wBAAwB;AACxB,qDAAqD;AACrD,kDAAgD;AAChD,sDAAoD;AAEpD,qBAAqB;AACrB,2DAA2D;AAC3D,wHAAwH;AACxH,+CAA+C;AAC/C,yGAAyG;AACzG,iEAAiE;AACjE,6DAA2C;AAC3C,iEAA+C;AAC/C,kEAAgD;AAChD,0DAAwC;AACxC,0EAAwD;AACxD,iEAA+C;AAC/C,0DAAwC;AACxC,mEAAiD;AACjD,mEAAiD;AACjD,iEAA+C;AAC/C,qEAAmD;AACnD,yDAAuC;AACvC,0DAAwC;AACxC,qEAAmD;AACnD,gEAA8C;AAC9C,6EAA2D;AAC3D,qEAAmD;AACnD,wDAAsC;AACtC,sEAAoD;AACpD,kEAAgD;AAChD,uEAAqD;AACrD,8DAA4C;AAC5C,qEAAmD;AACnD,uEAAqD;AACrD,iFAA+D;AAC/D,uEAAqD;AACrD,4DAA0C;AAC1C,wDAAsC;AACtC,uDAAqC;AACrC,iFAA+D;AAC/D,wDAAsC;AACtC,wDAAsC;AACtC,2EAAyD;AACzD,uEAAqD;AACrD,yEAAuD;AACvD,iFAA+D;AAE/D,gCAAgC;AAChC,sHAAsH;AACtH,UAAU;AACV,2DAA2D;AAC3D,6DAA2C;AAC3C,qCAAqC;AACrC,uEAAqD;AACrD,sDAAsD;AACtD,uEAAqD;AACrD,gDAAgD;AAChD,iEAA+C;AAE/C,iBAAiB;AACjB,qFAAqF;AACrF,2CAAyB;AACzB,iDAA+B;AAC/B,2DAAyC;AACzC,0DAAwC;AACxC,0DAAwC;AACxC,gEAA8C;AAC9C,6DAA2C;AAC3C,0DAAwC;AACxC,8DAA4C;AAC5C,0DAAwC;AACxC,4DAA0C;AAC1C,yDAAuC"}
|
|
@@ -48,7 +48,15 @@ function registerCustomCbnBabylonLoaderPlugin() {
|
|
|
48
48
|
const importedContainer = previousLoaderPlugin.loadAssetContainer(scene, data, rootUrl);
|
|
49
49
|
_addMissingMaterialMetadata(dataParsed, importedContainer);
|
|
50
50
|
_reconstructTagsForInstancedMeshes(dataParsed, importedContainer);
|
|
51
|
-
|
|
51
|
+
try {
|
|
52
|
+
_createDecals(dataParsed, importedContainer);
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
// Errors are generally swallowed by the Babylon.js `loadAssetContainer` implementation, resulting in generic
|
|
56
|
+
// error message and losing the information about the original error
|
|
57
|
+
// When forwarding the message in the `onError` callback at least the message can be preserved
|
|
58
|
+
onError === null || onError === void 0 ? void 0 : onError(e.message);
|
|
59
|
+
}
|
|
52
60
|
// add `cbnData` to output asset container, so that this information can be store as metadata for the model
|
|
53
61
|
const extendedContainer = importedContainer;
|
|
54
62
|
extendedContainer.cbnData = dataParsed.cbnData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cbn-custom-babylon-loader-plugin.js","sourceRoot":"","sources":["../../../src/internal/cbn-custom-babylon-loader-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oCAUkB;AAClB,uDAA6D;AAC7D,+CAAwE;AACxE,yCAA8C;AAgB9C,IAAI,YAAgC,CAAC;AAErC;;;;;;;;;;GAUG;AACH,SAAgB,oCAAoC;IAClD,IAAI,YAAY,EAAE;QAChB,8GAA8G;QAC9G,iGAAiG;QACjG,OAAO;KACR;IAED,wCAAwC;IACxC,4FAA4F;IAC5F,oGAAoG;IACpG,MAAM,oBAAoB,GAAG,mBAAW,CAAC,qBAAqB,CAAC,UAAU,CAAuB,CAAC;IAEjG,YAAY,GAAG;QACb,IAAI,EAAE,wBAAwB;QAC9B,UAAU,EAAE,UAAU;QACtB,UAAU,EAAE,oBAAoB,CAAC,UAAU;QAC3C,IAAI,EAAE,oBAAoB,CAAC,IAAI;QAC/B,kBAAkB,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAA0B,EAAE;YAC5E,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,IAAc,CAAC,CAAC;YAC9C,MAAM,iBAAiB,GAAG,oBAAoB,CAAC,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;YAExF,2BAA2B,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;YAC3D,kCAAkC,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"cbn-custom-babylon-loader-plugin.js","sourceRoot":"","sources":["../../../src/internal/cbn-custom-babylon-loader-plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oCAUkB;AAClB,uDAA6D;AAC7D,+CAAwE;AACxE,yCAA8C;AAgB9C,IAAI,YAAgC,CAAC;AAErC;;;;;;;;;;GAUG;AACH,SAAgB,oCAAoC;IAClD,IAAI,YAAY,EAAE;QAChB,8GAA8G;QAC9G,iGAAiG;QACjG,OAAO;KACR;IAED,wCAAwC;IACxC,4FA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I,EAAE;YACR,IAAA,6BAAe,EAAC,SAAS,EAAE,IAAI,CAAC,CAAC;SAClC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -8,10 +8,11 @@ import { AssetContainer, Material, NodeNamingStrategy, Scene, TagNamingStrategy
|
|
|
8
8
|
* - reassigns source meshes in cloned asset container
|
|
9
9
|
* Furthermore there is the possibility to adjust naming of nodes and tags in the cloned asset container
|
|
10
10
|
*/
|
|
11
|
-
export declare function cloneModelAssetContainer(sourceAssetContainer: AssetContainer, newModelName: string,
|
|
11
|
+
export declare function cloneModelAssetContainer(sourceAssetContainer: AssetContainer, newModelName: string, scene: Scene, options?: {
|
|
12
|
+
createInstance?: boolean;
|
|
12
13
|
nodeNamingStrategy?: NodeNamingStrategy;
|
|
13
14
|
tagNamingStrategy?: TagNamingStrategy;
|
|
14
|
-
}
|
|
15
|
+
}): AssetContainer;
|
|
15
16
|
/**
|
|
16
17
|
* Clones the desired material.\
|
|
17
18
|
* This basically just calls the default `clone` function of Babylon.js and applies the tag mapping
|
|
@@ -20,30 +20,30 @@ const _defaultTagNamingStrategy = (tag, clonedObjectId) => {
|
|
|
20
20
|
* - reassigns source meshes in cloned asset container
|
|
21
21
|
* Furthermore there is the possibility to adjust naming of nodes and tags in the cloned asset container
|
|
22
22
|
*/
|
|
23
|
-
function cloneModelAssetContainer(sourceAssetContainer, newModelName,
|
|
23
|
+
function cloneModelAssetContainer(sourceAssetContainer, newModelName, scene, options) {
|
|
24
|
+
const createInstance = !!(options === null || options === void 0 ? void 0 : options.createInstance);
|
|
24
25
|
const targetAssetContainer = new index_1.AssetContainer(scene);
|
|
25
26
|
sourceAssetContainer.rootNodes.forEach(node => {
|
|
26
27
|
if (node instanceof index_1.TransformNode) {
|
|
27
28
|
// this is the actual node tree cloning procedure
|
|
28
|
-
_cloneNode(node, newModelName, null, targetAssetContainer,
|
|
29
|
-
nodeNamingStrategy: renaming === null || renaming === void 0 ? void 0 : renaming.nodeNamingStrategy,
|
|
30
|
-
tagNamingStrategy: renaming === null || renaming === void 0 ? void 0 : renaming.tagNamingStrategy,
|
|
31
|
-
});
|
|
29
|
+
_cloneNode(node, newModelName, null, targetAssetContainer, options);
|
|
32
30
|
}
|
|
33
31
|
});
|
|
34
32
|
targetAssetContainer.populateRootNodes();
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
if (!createInstance) {
|
|
34
|
+
targetAssetContainer.rootNodes.forEach(node => {
|
|
35
|
+
if (node instanceof index_1.TransformNode) {
|
|
36
|
+
// reassigning instanced meshes can only be done after the model has been fully cloned, as we can't be sure if
|
|
37
|
+
// the source or instanced mesh is handled prior
|
|
38
|
+
_reAssignSourceMesh(node, sourceAssetContainer.meshes, targetAssetContainer.meshes);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
// morph target manager is not cloned per default, therefore morph targets would affect original and cloned model at
|
|
42
|
+
// the same time, which we don't want
|
|
43
|
+
sourceAssetContainer.morphTargetManagers.forEach(sourceMTM => {
|
|
44
|
+
_cloneMorphTargetManager(sourceMTM, targetAssetContainer);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
47
|
_clearCloningMetadata(sourceAssetContainer);
|
|
48
48
|
_clearCloningMetadata(targetAssetContainer);
|
|
49
49
|
// hide immediately, so that show model code can do it's thing (scene preparation) before finally showing the model
|
|
@@ -87,39 +87,60 @@ function _cloneMorphTargetManager(sourceMTM, targetAssetContainer) {
|
|
|
87
87
|
* Calls "clone" function of dedicated Node type and recourses into children to clone the whole node tree.
|
|
88
88
|
* Adds temporary metadata for special treatment of certain node types (e.g. InstancedMesh).
|
|
89
89
|
*/
|
|
90
|
-
function _cloneNode(node, newModelName, newParent, assetContainer,
|
|
90
|
+
function _cloneNode(node, newModelName, newParent, assetContainer, options) {
|
|
91
91
|
var _a, _b;
|
|
92
|
-
const nodeNamingStrategy = (_a =
|
|
93
|
-
const tagNamingStrategy = (_b =
|
|
92
|
+
const nodeNamingStrategy = (_a = options === null || options === void 0 ? void 0 : options.nodeNamingStrategy) !== null && _a !== void 0 ? _a : _defaultNodeNamingStrategy;
|
|
93
|
+
const tagNamingStrategy = (_b = options === null || options === void 0 ? void 0 : options.tagNamingStrategy) !== null && _b !== void 0 ? _b : _defaultTagNamingStrategy;
|
|
94
94
|
const cloneName = nodeNamingStrategy(node, newModelName);
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
const createInstance = (options === null || options === void 0 ? void 0 : options.createInstance) && node instanceof index_1.Mesh && !!node.getTotalVertices();
|
|
96
|
+
let resultNode;
|
|
97
|
+
if (createInstance) {
|
|
98
|
+
const instance = node.createInstance(cloneName);
|
|
99
|
+
_cloneInstancedMeshData(node, instance);
|
|
100
|
+
instance.parent = newParent;
|
|
101
|
+
instance.position = node.position.clone();
|
|
102
|
+
instance.rotation = node.rotation.clone();
|
|
103
|
+
instance.scaling = node.scaling.clone();
|
|
104
|
+
if (node.rotationQuaternion) {
|
|
105
|
+
instance.rotationQuaternion = node.rotationQuaternion.clone();
|
|
106
|
+
}
|
|
107
|
+
resultNode = instance;
|
|
98
108
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
+
else {
|
|
110
|
+
const clone = node.clone(cloneName, newParent, true);
|
|
111
|
+
if (!clone) {
|
|
112
|
+
throw new Error(`Cloning node "${node.name}" failed`);
|
|
113
|
+
}
|
|
114
|
+
if (node instanceof index_1.InstancedMesh) {
|
|
115
|
+
_cloneInstancedMeshData(node, clone);
|
|
116
|
+
}
|
|
117
|
+
// create a shallow clone for internal metadata, as the default clone function just assignes the sources internal
|
|
118
|
+
// metadata
|
|
119
|
+
(0, metadata_helper_1.cloneInternalMetadata)(node, clone);
|
|
120
|
+
// NOTE: "public" metadata are not cloned by default, we rely on the Babylon.js default behaviour:
|
|
121
|
+
// - execute metadata.clone function if there is one
|
|
122
|
+
// - assign the metadata of the original node to the clone other wise
|
|
123
|
+
// making deep copies of the node metadata might be an optional flag in the cloning functions in the future
|
|
124
|
+
// ATM the assignment from clone to source is needed for reassigning instanced meshes after cloning
|
|
125
|
+
// may be usefull for other node types in the future as well
|
|
126
|
+
(0, metadata_helper_1.setInternalMetadataValue)(clone, 'cloneSource', node.uniqueId);
|
|
127
|
+
(0, metadata_helper_1.setInternalMetadataValue)(node, 'cloneTarget', clone.uniqueId);
|
|
128
|
+
resultNode = clone;
|
|
109
129
|
}
|
|
130
|
+
resultNode.id = cloneName;
|
|
110
131
|
const sourceTags = (0, tags_helper_1.getTags)(node);
|
|
111
132
|
const mappedTags = sourceTags.map(tag => tagNamingStrategy(tag, newModelName));
|
|
112
|
-
(0, tags_helper_1.setTags)(
|
|
113
|
-
|
|
133
|
+
(0, tags_helper_1.setTags)(resultNode, mappedTags);
|
|
134
|
+
resultNode._parentContainer = assetContainer;
|
|
114
135
|
// TODO WTT: create global helper function for distinguishing between transform nodes and meshes
|
|
115
|
-
if (
|
|
116
|
-
assetContainer.meshes.push(
|
|
136
|
+
if (resultNode instanceof index_1.AbstractMesh) {
|
|
137
|
+
assetContainer.meshes.push(resultNode);
|
|
117
138
|
}
|
|
118
139
|
else {
|
|
119
|
-
assetContainer.transformNodes.push(
|
|
140
|
+
assetContainer.transformNodes.push(resultNode);
|
|
120
141
|
}
|
|
121
142
|
const children = node.getChildTransformNodes(true);
|
|
122
|
-
children.forEach(child => _cloneNode(child, newModelName,
|
|
143
|
+
children.forEach(child => _cloneNode(child, newModelName, resultNode, assetContainer, options));
|
|
123
144
|
}
|
|
124
145
|
/**
|
|
125
146
|
* Cloned instanced meshes are having the same source mesh as their cloning source.
|
|
@@ -168,10 +189,12 @@ function _clearCloningMetadata(assetContainer) {
|
|
|
168
189
|
* correctly.
|
|
169
190
|
* This function adjusts the behaviour to fulfill our expectations.
|
|
170
191
|
*/
|
|
171
|
-
function _cloneInstancedMeshData(
|
|
172
|
-
|
|
173
|
-
(
|
|
174
|
-
|
|
192
|
+
function _cloneInstancedMeshData(sourceMesh, targetInstancedMesh) {
|
|
193
|
+
var _a, _b, _c;
|
|
194
|
+
targetInstancedMesh.setEnabled(sourceMesh.isEnabled(false));
|
|
195
|
+
// handling of tags and metadata is exactly the same as in the original Babylon.js code
|
|
196
|
+
(0, tags_helper_1.cloneTags)(sourceMesh, targetInstancedMesh);
|
|
197
|
+
targetInstancedMesh.metadata = (_c = (_b = (_a = sourceMesh.metadata) === null || _a === void 0 ? void 0 : _a.clone) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : sourceMesh.metadata;
|
|
175
198
|
}
|
|
176
199
|
function _findByUniqueId(nodes, uniqueId) {
|
|
177
200
|
return nodes.find(node => node.uniqueId === uniqueId);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloning-helper.js","sourceRoot":"","sources":["../../../src/internal/cloning-helper.ts"],"names":[],"mappings":";;;AAAA,oCAWkB;AAClB,
|
|
1
|
+
{"version":3,"file":"cloning-helper.js","sourceRoot":"","sources":["../../../src/internal/cloning-helper.ts"],"names":[],"mappings":";;;AAAA,oCAWkB;AAClB,uDAK2B;AAC3B,+CAA4D;AAE5D,MAAM,0BAA0B,GAAuB,CAAC,IAAmB,EAAE,cAAsB,EAAU,EAAE;IAC7G,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,cAAc,EAAE,CAAC;AAC1C,CAAC,CAAC;AACF,MAAM,yBAAyB,GAAsB,CAAC,GAAW,EAAE,cAAsB,EAAU,EAAE;IACnG,+BAA+B;IAC/B,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACH,SAAgB,wBAAwB,CACtC,oBAAoC,EACpC,YAAoB,EACpB,KAAY,EACZ,OAI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AAE;QAC1E,IAAA,4CAA0B,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAChD,IAAA,4CAA0B,EAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,SAAS,uBAAuB,CAAC,UAAwB,EAAE,mBAAkC;;IAC3F,mBAAmB,CAAC,UAAU,CAAC,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;IAE5D,uFAAuF;IACvF,IAAA,uBAAS,EAAC,UAAU,EAAE,mBAAmB,CAAC,CAAC;IAC3C,mBAAmB,CAAC,QAAQ,GAAG,MAAA,MAAA,MAAA,UAAU,CAAC,QAAQ,0CAAE,KAAK,kDAAI,mCAAI,UAAU,CAAC,QAAQ,CAAC;AACvF,CAAC;AAED,SAAS,eAAe,CAAC,KAAsB,EAAE,QAAgB;IAC/D,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,26 +1,28 @@
|
|
|
1
1
|
import { BaseTexture, Material, Node } from '../index';
|
|
2
|
-
declare type MetadataValue = string | number | boolean | object | undefined;
|
|
3
2
|
declare type MetadataTarget = Node | Material | BaseTexture;
|
|
4
|
-
declare type
|
|
3
|
+
declare type MetadataValueMap = {
|
|
4
|
+
deferredMaterial: string;
|
|
5
|
+
materialToBeSet: string;
|
|
6
|
+
exportNode: boolean;
|
|
7
|
+
deleteAfterExport: boolean;
|
|
8
|
+
exchangeMaterialWith: number;
|
|
9
|
+
cloneSource: number;
|
|
10
|
+
cloneTarget: number;
|
|
11
|
+
};
|
|
12
|
+
declare type MetadataKeys = keyof MetadataValueMap;
|
|
5
13
|
/**
|
|
6
14
|
* Sets certain metadata on the objects INTERNAL metadata storage.
|
|
7
15
|
* "object._internalMetadata.cbn" is reserved for CBN specific metadata information.
|
|
8
16
|
* The objects public metadata ("object.metadata") is not affected and should therefore not interfere with metadata
|
|
9
17
|
* that is used in consumer projects.
|
|
10
18
|
*/
|
|
11
|
-
export declare function setInternalMetadataValue(object: MetadataTarget, key:
|
|
19
|
+
export declare function setInternalMetadataValue<K extends MetadataKeys>(object: MetadataTarget, key: K, value: MetadataValueMap[K]): void;
|
|
12
20
|
export declare function clearInternalMetadataValue(object: MetadataTarget, key: MetadataKeys): void;
|
|
13
|
-
export declare function getInternalMetadataValue(object: MetadataTarget, key:
|
|
21
|
+
export declare function getInternalMetadataValue<K extends MetadataKeys>(object: MetadataTarget, key: K): MetadataValueMap[K];
|
|
14
22
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
23
|
+
* This only creates a (shallow) clone of the CBN internal metadata, as we need to have individual metadata for our
|
|
24
|
+
* viewer state handling in each node.
|
|
25
|
+
* The rest, which is coming from Babylon.js directly, is left untouched as we don't interfere with this data anyway.
|
|
18
26
|
*/
|
|
19
27
|
export declare function cloneInternalMetadata(sourceObject: MetadataTarget, targetObject: MetadataTarget): void;
|
|
20
|
-
/**
|
|
21
|
-
* Clones the metadata from one object to another.
|
|
22
|
-
* CAUTION: this is now the public available "object.metadata" object.
|
|
23
|
-
* We need this function internally when cloning instanced meshes.
|
|
24
|
-
*/
|
|
25
|
-
export declare function cloneMetadata(sourceObject: MetadataTarget, targetObject: MetadataTarget): void;
|
|
26
28
|
export {};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const lodash_es_1 = require("lodash-es");
|
|
5
|
-
// TODO WTT: use generics or some kind of logic that is able to type the metadata according to their key
|
|
3
|
+
exports.cloneInternalMetadata = exports.getInternalMetadataValue = exports.clearInternalMetadataValue = exports.setInternalMetadataValue = void 0;
|
|
6
4
|
/**
|
|
7
5
|
* Sets certain metadata on the objects INTERNAL metadata storage.
|
|
8
6
|
* "object._internalMetadata.cbn" is reserved for CBN specific metadata information.
|
|
@@ -30,22 +28,18 @@ function getInternalMetadataValue(object, key) {
|
|
|
30
28
|
}
|
|
31
29
|
exports.getInternalMetadataValue = getInternalMetadataValue;
|
|
32
30
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* This only creates a (shallow) clone of the CBN internal metadata, as we need to have individual metadata for our
|
|
32
|
+
* viewer state handling in each node.
|
|
33
|
+
* The rest, which is coming from Babylon.js directly, is left untouched as we don't interfere with this data anyway.
|
|
36
34
|
*/
|
|
37
35
|
function cloneInternalMetadata(sourceObject, targetObject) {
|
|
38
|
-
|
|
36
|
+
var _a;
|
|
37
|
+
if (!((_a = sourceObject._internalMetadata) === null || _a === void 0 ? void 0 : _a.cbn)) {
|
|
38
|
+
targetObject._internalMetadata = sourceObject._internalMetadata;
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
targetObject._internalMetadata = Object.assign(Object.assign({}, sourceObject._internalMetadata), { cbn: Object.assign({}, sourceObject._internalMetadata.cbn) });
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
exports.cloneInternalMetadata = cloneInternalMetadata;
|
|
41
|
-
/**
|
|
42
|
-
* Clones the metadata from one object to another.
|
|
43
|
-
* CAUTION: this is now the public available "object.metadata" object.
|
|
44
|
-
* We need this function internally when cloning instanced meshes.
|
|
45
|
-
*/
|
|
46
|
-
function cloneMetadata(sourceObject, targetObject) {
|
|
47
|
-
const clonedMetadata = (0, lodash_es_1.cloneDeep)(sourceObject.metadata);
|
|
48
|
-
targetObject.metadata = clonedMetadata;
|
|
49
|
-
}
|
|
50
|
-
exports.cloneMetadata = cloneMetadata;
|
|
51
45
|
//# sourceMappingURL=metadata-helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata-helper.js","sourceRoot":"","sources":["../../../src/internal/metadata-helper.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"metadata-helper.js","sourceRoot":"","sources":["../../../src/internal/metadata-helper.ts"],"names":[],"mappings":";;;AAsBA;;;;;GAKG;AACH,SAAgB,wBAAwB,CACtC,MAAsB,EACtB,GAAM,EACN,KAA0B;IAE1B,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE;QAC7B,MAAM,CAAC,iBAAiB,GAAG,EAAE,CAAC;KAC/B;IACD,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,GAAG,EAAE;QACjC,MAAM,CAAC,iBAAiB,CAAC,GAAG,GAAG,EAAE,CAAC;KACnC;IAED,MAAM,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAC5C,CAAC;AAbD,4DAaC;AAED,SAAgB,0BAA0B,CAAC,MAAsB,EAAE,GAAiB;;IAC3E,MAAA,MAAA,MAAM,CAAC,iBAAiB,0CAAE,GAAG,+CAAG,GAAG,CAAC,CAAC;AAC9C,CAAC;AAFD,gEAEC;AAED,SAAgB,wBAAwB,CAAyB,MAAsB,EAAE,GAAM;;IAC7F,OAAO,MAAA,MAAA,MAAM,CAAC,iBAAiB,0CAAE,GAAG,0CAAG,GAAG,CAAC,CAAC;AAC9C,CAAC;AAFD,4DAEC;AAED;;;;GAIG;AACH,SAAgB,qBAAqB,CAAC,YAA4B,EAAE,YAA4B;;IAC9F,IAAI,CAAC,CAAA,MAAA,YAAY,CAAC,iBAAiB,0CAAE,GAAG,CAAA,EAAE;QACxC,YAAY,CAAC,iBAAiB,GAAG,YAAY,CAAC,iBAAiB,CAAC;KACjE;SAAM;QACL,YAAY,CAAC,iBAAiB,mCACzB,YAAY,CAAC,iBAAiB,KACjC,GAAG,oBAAO,YAAY,CAAC,iBAAiB,CAAC,GAAG,IAC7C,CAAC;KACH;AACH,CAAC;AATD,sDASC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.deleteAllTags = exports.cloneTags = exports.setTagsAsString = exports.setTags = exports.getTags = exports.hasTag = void 0;
|
|
4
|
-
const
|
|
4
|
+
const index_1 = require("../index");
|
|
5
5
|
function hasTag(object, tag) {
|
|
6
|
-
return
|
|
6
|
+
return index_1.Tags.MatchesQuery(object, tag);
|
|
7
7
|
}
|
|
8
8
|
exports.hasTag = hasTag;
|
|
9
9
|
function getTags(object) {
|
|
10
10
|
var _a;
|
|
11
|
-
const tagsObject = (_a =
|
|
11
|
+
const tagsObject = (_a = index_1.Tags.GetTags(object, false)) !== null && _a !== void 0 ? _a : {};
|
|
12
12
|
const tags = Object.keys(tagsObject);
|
|
13
13
|
return tags;
|
|
14
14
|
}
|
|
@@ -16,24 +16,24 @@ exports.getTags = getTags;
|
|
|
16
16
|
function setTags(object, tags) {
|
|
17
17
|
deleteAllTags(object);
|
|
18
18
|
const tagsString = tags.join(' ');
|
|
19
|
-
|
|
19
|
+
index_1.Tags.AddTagsTo(object, tagsString);
|
|
20
20
|
}
|
|
21
21
|
exports.setTags = setTags;
|
|
22
22
|
function setTagsAsString(object, tagsString) {
|
|
23
23
|
deleteAllTags(object);
|
|
24
|
-
|
|
24
|
+
index_1.Tags.AddTagsTo(object, tagsString);
|
|
25
25
|
}
|
|
26
26
|
exports.setTagsAsString = setTagsAsString;
|
|
27
27
|
function cloneTags(sourceObject, destinationObject) {
|
|
28
|
-
if (
|
|
29
|
-
|
|
28
|
+
if (index_1.Tags.HasTags(sourceObject)) {
|
|
29
|
+
index_1.Tags.AddTagsTo(destinationObject, index_1.Tags.GetTags(sourceObject, true));
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
exports.cloneTags = cloneTags;
|
|
33
33
|
function deleteAllTags(object) {
|
|
34
|
-
const curTags =
|
|
34
|
+
const curTags = index_1.Tags.GetTags(object);
|
|
35
35
|
if (curTags) {
|
|
36
|
-
|
|
36
|
+
index_1.Tags.RemoveTagsFrom(object, curTags);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.deleteAllTags = deleteAllTags;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tags-helper.js","sourceRoot":"","sources":["../../../src/internal/tags-helper.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"tags-helper.js","sourceRoot":"","sources":["../../../src/internal/tags-helper.ts"],"names":[],"mappings":";;;AAAA,oCAAgD;AAQhD,SAAgB,MAAM,CAAC,MAAiB,EAAE,GAAW;IACnD,OAAO,YAAI,CAAC,YAAY,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACxC,CAAC;AAFD,wBAEC;AAED,SAAgB,OAAO,CAAC,MAAiB;;IACvC,MAAM,UAAU,GAAG,MAAA,YAAI,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,mCAAI,EAAE,CAAC;IACrD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAErC,OAAO,IAAI,CAAC;AACd,CAAC;AALD,0BAKC;AAED,SAAgB,OAAO,CAAC,MAAiB,EAAE,IAAc;IACvD,aAAa,CAAC,MAAM,CAAC,CAAC;IACtB,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClC,YAAI,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC;AAJD,0BAIC;AAED,SAAgB,eAAe,CAAC,MAAiB,EAAE,UAAkB;IACnE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtB,YAAI,CAAC,SAAS,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACrC,CAAC;AAHD,0CAGC;AAED,SAAgB,SAAS,CAAC,YAAuB,EAAE,iBAA4B;IAC7E,IAAI,YAAI,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;QAC9B,YAAI,CAAC,SAAS,CAAC,iBAAiB,EAAE,YAAI,CAAC,OAAO,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC,CAAC;KACrE;AACH,CAAC;AAJD,8BAIC;AAED,SAAgB,aAAa,CAAC,MAAiB;IAC7C,MAAM,OAAO,GAAG,YAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,OAAO,EAAE;QACX,YAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC;AACH,CAAC;AALD,sCAKC"}
|
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { AxesViewer, BoundingSphere,
|
|
2
|
-
declare type DebugAxisKeys = 'X' | 'Y' | 'Z';
|
|
3
|
-
declare type DebugAxisConfig = {
|
|
4
|
-
color: Color3;
|
|
5
|
-
position: Vector3;
|
|
6
|
-
};
|
|
1
|
+
import { AxesViewer, BoundingSphere, IInspectorOptions, TransformNode, Viewer } from '../index';
|
|
7
2
|
/**
|
|
8
3
|
* Manager for debugging functionalities
|
|
9
4
|
*/
|
|
10
5
|
export declare class DebugManager {
|
|
11
6
|
protected viewer: Viewer;
|
|
12
|
-
protected static _DEBUG_AXIS_MAP: Record<DebugAxisKeys, DebugAxisConfig>;
|
|
13
|
-
protected static _WORLD_COORD_ROOT_KEY: string;
|
|
14
7
|
protected static _BOUNDING_SPHERE_KEY: string;
|
|
15
8
|
protected _axesViewer: AxesViewer | null;
|
|
16
9
|
protected _showBoundingSphereForAutofocus: boolean;
|
|
@@ -30,31 +23,30 @@ export declare class DebugManager {
|
|
|
30
23
|
showInspector(options?: IInspectorOptions): Promise<boolean>;
|
|
31
24
|
hideInspector(): void;
|
|
32
25
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
26
|
+
* Displays the coordinate system.\
|
|
27
|
+
* Shows the local coordinate system of a specified node or the world coordinate system if no node is provided.\
|
|
28
|
+
* The size defaults to one-third of the scene's bounding sphere radius but can be set manually.
|
|
35
29
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
showCoordinateSystem(node?: TransformNode, size?: number): void;
|
|
31
|
+
hideCoordinateSystem(): void;
|
|
38
32
|
/**
|
|
39
33
|
* Draws a wireframe bounding sphere on the next call of {@link CameraManager.autofocusActiveCamera}.\
|
|
40
34
|
* This is usefull for checking which parts of the scene get centered.
|
|
41
35
|
*/
|
|
42
36
|
showBoundingSphereForAutofocus(): void;
|
|
43
37
|
hideBoundingSphereForAutofocus(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Adjust and enhance coordinate axes to fulfill our needs.
|
|
46
|
-
* - moves nodes into common root
|
|
47
|
-
* - adds text node
|
|
48
|
-
*/
|
|
49
|
-
protected static _prepareWorldCoordinateAxis(text: 'X' | 'Y' | 'Z', axis: TransformNode, root: TransformNode, dimension: number, utilityLayerScene: Scene): void;
|
|
50
38
|
/**
|
|
51
39
|
* Calculate factor for creating world coordinate axes with exactly one unit in length
|
|
52
40
|
*/
|
|
53
41
|
protected static _getWorldCoordinatesAxesUnifyFactor(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Creates and adds a label with a direction letter at the tip of each axis arrow.\
|
|
44
|
+
* Also adjust the brightness of the arrow and created label.
|
|
45
|
+
*/
|
|
46
|
+
protected static _prepareAxisVisual(labelText: string, axisNode: TransformNode): void;
|
|
54
47
|
/**
|
|
55
48
|
* Visualize bounding sphere which is used to zoom in via `autofocusActiveCamera` function
|
|
56
49
|
*/
|
|
57
50
|
protected _drawBoundingSphereForAutofocus(boundingSphere: BoundingSphere): void;
|
|
58
51
|
protected _removeBoundingSphereForAutofocus(): void;
|
|
59
52
|
}
|
|
60
|
-
export {};
|