@combeenation/3d-viewer 18.2.0 → 18.3.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.
Files changed (33) hide show
  1. package/dist/lib-cjs/buildinfo.json +1 -1
  2. package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
  3. package/dist/lib-cjs/index.d.ts +1 -0
  4. package/dist/lib-cjs/index.js +1 -0
  5. package/dist/lib-cjs/index.js.map +1 -1
  6. package/dist/lib-cjs/internal/export-helper.d.ts +34 -0
  7. package/dist/lib-cjs/internal/export-helper.js +306 -0
  8. package/dist/lib-cjs/internal/export-helper.js.map +1 -0
  9. package/dist/lib-cjs/internal/node-helper.js +2 -2
  10. package/dist/lib-cjs/internal/node-helper.js.map +1 -1
  11. package/dist/lib-cjs/manager/camera-manager.js +2 -6
  12. package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
  13. package/dist/lib-cjs/manager/dxf-export-manager.d.ts +39 -0
  14. package/dist/lib-cjs/manager/dxf-export-manager.js +116 -0
  15. package/dist/lib-cjs/manager/dxf-export-manager.js.map +1 -0
  16. package/dist/lib-cjs/manager/gltf-export-manager.d.ts +19 -39
  17. package/dist/lib-cjs/manager/gltf-export-manager.js +38 -179
  18. package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
  19. package/dist/lib-cjs/viewer.d.ts +3 -1
  20. package/dist/lib-cjs/viewer.js +4 -0
  21. package/dist/lib-cjs/viewer.js.map +1 -1
  22. package/package.json +3 -2
  23. package/src/index.ts +1 -0
  24. package/src/internal/export-helper.ts +378 -0
  25. package/src/internal/node-helper.ts +2 -2
  26. package/src/manager/camera-manager.ts +2 -6
  27. package/src/manager/dxf-export-manager.ts +123 -0
  28. package/src/manager/gltf-export-manager.ts +38 -231
  29. package/src/viewer.ts +6 -0
  30. package/dist/lib-cjs/internal/geometry-helper.d.ts +0 -14
  31. package/dist/lib-cjs/internal/geometry-helper.js +0 -114
  32. package/dist/lib-cjs/internal/geometry-helper.js.map +0 -1
  33. package/src/internal/geometry-helper.ts +0 -144
@@ -52,6 +52,7 @@ export * from './viewer-error';
52
52
  export * from './manager/camera-manager';
53
53
  export * from './manager/dimension-line-manager';
54
54
  export * from './manager/debug-manager';
55
+ export * from './manager/dxf-export-manager';
55
56
  export * from './manager/event-manager';
56
57
  export * from './manager/gltf-export-manager';
57
58
  export * from './manager/html-anchor-manager';
@@ -85,6 +85,7 @@ __exportStar(require("./viewer-error"), exports);
85
85
  __exportStar(require("./manager/camera-manager"), exports);
86
86
  __exportStar(require("./manager/dimension-line-manager"), exports);
87
87
  __exportStar(require("./manager/debug-manager"), exports);
88
+ __exportStar(require("./manager/dxf-export-manager"), exports);
88
89
  __exportStar(require("./manager/event-manager"), exports);
89
90
  __exportStar(require("./manager/gltf-export-manager"), exports);
90
91
  __exportStar(require("./manager/html-anchor-manager"), exports);
@@ -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,yEAAuD;AACvD,iEAA+C;AAC/C,kFAAgE;AAChE,qEAAmD;AACnD,qEAAmD;AACnD,yDAAuC;AACvC,0DAAwC;AACxC,qEAAmD;AACnD,gEAA8C;AAC9C,6EAA2D;AAC3D,qEAAmD;AACnD,wDAAsC;AACtC,sEAAoD;AACpD,kEAAgD;AAChD,uEAAqD;AACrD,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,uEAAqD;AACrD,kEAAgD;AAChD,iFAA+D;AAC/D,uEAAqD;AACrD,4DAA0C;AAC1C,wDAAsC;AACtC,uDAAqC;AACrC,gFAA8D;AAC9D,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,mEAAiD;AACjD,0DAAwC;AACxC,0DAAwC;AACxC,gEAA8C;AAC9C,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,yEAAuD;AACvD,iEAA+C;AAC/C,kFAAgE;AAChE,qEAAmD;AACnD,qEAAmD;AACnD,yDAAuC;AACvC,0DAAwC;AACxC,qEAAmD;AACnD,gEAA8C;AAC9C,6EAA2D;AAC3D,qEAAmD;AACnD,wDAAsC;AACtC,sEAAoD;AACpD,kEAAgD;AAChD,uEAAqD;AACrD,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,uEAAqD;AACrD,kEAAgD;AAChD,iFAA+D;AAC/D,uEAAqD;AACrD,4DAA0C;AAC1C,wDAAsC;AACtC,uDAAqC;AACrC,gFAA8D;AAC9D,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,mEAAiD;AACjD,0DAAwC;AACxC,+DAA6C;AAC7C,0DAAwC;AACxC,gEAA8C;AAC9C,gEAA8C;AAC9C,6DAA2C;AAC3C,0DAAwC;AACxC,8DAA4C;AAC5C,0DAAwC;AACxC,4DAA0C;AAC1C,yDAAuC"}
@@ -0,0 +1,34 @@
1
+ import { Node, NodeDescription, TransformNode, Viewer } from '../index';
2
+ declare type ExportPreProcessSettings = {
3
+ excludeNodes?: NodeDescription[];
4
+ scaleDownTextures?: boolean;
5
+ };
6
+ declare type ExportPostProcessSettings = {
7
+ initialTextureSize?: number;
8
+ };
9
+ /**
10
+ * Prepares scene for exports.
11
+ * The main task is to bake the transformation data into the vertices, as our current exports (GLB for AR and DXF) don't
12
+ * work conveniently without it:
13
+ * - negative signs in scaling values in GLBs lead to erroneous appearance in converted .usdz file
14
+ * - DXF faces calculation only takes vertices into account
15
+ */
16
+ export declare function exportPreProcess(viewer: Viewer, settings?: ExportPreProcessSettings): Promise<void>;
17
+ /**
18
+ * Cleans up scene after export
19
+ */
20
+ export declare function exportPostProcess(viewer: Viewer, settings?: ExportPostProcessSettings): Promise<void>;
21
+ /**
22
+ * Checks if a node should be available in the export
23
+ */
24
+ export declare function isExportableTransformNode(node: Node, excludeNodes?: NodeDescription[]): node is TransformNode;
25
+ /**
26
+ * Triggers a browser download from a given object URL or data URI./
27
+ * The file will be saved with the specified file name.
28
+ */
29
+ export declare function downloadFile(url: string, fileName: string): void;
30
+ /**
31
+ * Add extension if not already set
32
+ */
33
+ export declare function normalizeFileName(fileName: string | undefined, extension: string, defaultFileName?: string): string;
34
+ export {};
@@ -0,0 +1,306 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.normalizeFileName = exports.downloadFile = exports.isExportableTransformNode = exports.exportPostProcess = exports.exportPreProcess = void 0;
13
+ const index_1 = require("../index");
14
+ const device_helper_1 = require("./device-helper");
15
+ const metadata_helper_1 = require("./metadata-helper");
16
+ const node_helper_1 = require("./node-helper");
17
+ /**
18
+ * Prepares scene for exports.
19
+ * The main task is to bake the transformation data into the vertices, as our current exports (GLB for AR and DXF) don't
20
+ * work conveniently without it:
21
+ * - negative signs in scaling values in GLBs lead to erroneous appearance in converted .usdz file
22
+ * - DXF faces calculation only takes vertices into account
23
+ */
24
+ function exportPreProcess(viewer, settings) {
25
+ return __awaiter(this, void 0, void 0, function* () {
26
+ const { excludeNodes, scaleDownTextures } = settings !== null && settings !== void 0 ? settings : {};
27
+ // pause rendering, since we are altering the active scene, which should not be visible to the user
28
+ viewer.pauseRendering();
29
+ // exchange textures with scaled down versions (1024 px) if desired
30
+ // Example AR (GLB) export:
31
+ // - iOS devices will crash most likely when trying to access AR endpoints with such files
32
+ // - file size will be reduced, which leads to faster loading times
33
+ // - textures > 1024 px shouldn't make a difference on mobiles anyway
34
+ // we don't have to rescale anything if are already on a downscaled device, since the textures are already <= 1024
35
+ // also we have to be very cautios with copying textures on these devices, since we are potentially very limited
36
+ // with the available memory
37
+ const isScaledDownDevice = (0, device_helper_1.getIsScaledDownDevice)(viewer.viewerSettings.limitTextureSize);
38
+ if (scaleDownTextures && !isScaledDownDevice) {
39
+ // the idea is to re-create all textures with a smaller texture size
40
+ // we have to exchange all materials for this to work
41
+ viewer.engine.clearInternalTexturesCache();
42
+ viewer.engine.getCaps().maxTextureSize = 1024;
43
+ viewer.scene.materials.forEach(material => _exchangePBRMaterial(material));
44
+ }
45
+ // create clones of each node (recursively), optionally exchange with cloned materials and mark these nodes for the
46
+ // export
47
+ viewer.scene.rootNodes.forEach(rootNode => _prepareNodeForExport(viewer, rootNode, null, excludeNodes));
48
+ const nodesForExport = _getNodesMarkedForExport(viewer);
49
+ // bake transformation of all meshes, so that no negative scalings are left
50
+ // it's important that this is done AFTER instanced meshes have been converted (`_prepareNodeForExport`)
51
+ nodesForExport.forEach(node => {
52
+ if (node instanceof index_1.Mesh)
53
+ _bakeGeometryOfMesh(node);
54
+ });
55
+ // reset transformation of all "TransformNodes", as transform nodes are not considered by the `_bakeGeometryOfMesh`
56
+ // function, still their transformation data has to be reset to eliminated negative scalings and to make the baking of
57
+ // child meshes work
58
+ // it's important that this is done AFTER all geometries have been baked
59
+ nodesForExport.forEach(node => {
60
+ _resetTransformation(node);
61
+ // recompute world matrix immediately after adapting transformation
62
+ node.computeWorldMatrix(true);
63
+ });
64
+ });
65
+ }
66
+ exports.exportPreProcess = exportPreProcess;
67
+ /**
68
+ * Cleans up scene after export
69
+ */
70
+ function exportPostProcess(viewer, settings) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ const { initialTextureSize } = settings !== null && settings !== void 0 ? settings : {};
73
+ // dispose all nodes, materials and textures that have only been created for the export
74
+ viewer.scene.rootNodes
75
+ .filter(rootNode => (0, metadata_helper_1.getInternalMetadataValue)(rootNode, 'deleteAfterExport'))
76
+ .forEach(rootNode => rootNode.dispose());
77
+ viewer.scene.materials
78
+ .filter(material => (0, metadata_helper_1.getInternalMetadataValue)(material, 'deleteAfterExport'))
79
+ .forEach(material => material.dispose(false, false));
80
+ // clean up temporary material exchange key for the rest of materials
81
+ viewer.scene.materials.forEach(material => (0, metadata_helper_1.clearInternalMetadataValue)(material, 'exchangeMaterialWith'));
82
+ viewer.scene.textures
83
+ .filter(texture => (0, metadata_helper_1.getInternalMetadataValue)(texture, 'deleteAfterExport'))
84
+ .forEach(texture => texture.dispose());
85
+ if (initialTextureSize) {
86
+ // reset texture size, only required if `scaleDownTextures` had been set in pre process
87
+ viewer.engine.getCaps().maxTextureSize = initialTextureSize;
88
+ }
89
+ viewer.resumeRendering();
90
+ });
91
+ }
92
+ exports.exportPostProcess = exportPostProcess;
93
+ /**
94
+ * Checks if a node should be available in the export
95
+ */
96
+ function isExportableTransformNode(node, excludeNodes) {
97
+ if (!(node instanceof index_1.TransformNode)) {
98
+ return false;
99
+ }
100
+ // maybe add some other criterias like "hasInfiniteDistance" and "isGeneratedBackgroundMesh" here as well
101
+ const isExcluded = (0, node_helper_1.nodeMatchesAnyCriteria)(node, {
102
+ isInList: excludeNodes,
103
+ isDisabled: true,
104
+ isHtmlAnchorMesh: true,
105
+ });
106
+ return !isExcluded;
107
+ }
108
+ exports.isExportableTransformNode = isExportableTransformNode;
109
+ /**
110
+ * Triggers a browser download from a given object URL or data URI./
111
+ * The file will be saved with the specified file name.
112
+ */
113
+ function downloadFile(url, fileName) {
114
+ const link = document.createElement('a');
115
+ link.href = url;
116
+ link.download = fileName;
117
+ document.body.appendChild(link);
118
+ link.click();
119
+ document.body.removeChild(link);
120
+ }
121
+ exports.downloadFile = downloadFile;
122
+ /**
123
+ * Add extension if not already set
124
+ */
125
+ function normalizeFileName(fileName, extension, defaultFileName) {
126
+ var _a;
127
+ const extensionWithDot = '.' + extension;
128
+ const resFileName = (_a = fileName !== null && fileName !== void 0 ? fileName : defaultFileName) !== null && _a !== void 0 ? _a : 'default';
129
+ return resFileName.endsWith(extensionWithDot) ? resFileName : resFileName + extensionWithDot;
130
+ }
131
+ exports.normalizeFileName = normalizeFileName;
132
+ /**
133
+ * Creates a clone of the material which should be used for the export.
134
+ * This is mostly required for recreating textures with lower sizes.
135
+ * CAUTION: Material exchanging is not supported for materials that contain certain texture types:
136
+ * - Dynamic textures (Paintables): Cloning dynamic textures doesn't clone the canvas context
137
+ * => so the clone is just empty
138
+ * - Render target textures: Disposing the clone will leave the scene in a "not ready" state
139
+ * => this scenario is not fully analyzed yet, but it's not really worth the effort right now, since this kind of
140
+ * of texture is not really used ATM
141
+ */
142
+ function _exchangePBRMaterial(material) {
143
+ const baseTextures = material.getActiveTextures();
144
+ const hasDynamicTextures = baseTextures.some(texture => texture instanceof index_1.DynamicTexture);
145
+ const hasRenderTargetTextures = baseTextures.some(texture => texture instanceof index_1.RenderTargetTexture);
146
+ if (hasDynamicTextures || hasRenderTargetTextures) {
147
+ const textureTypesString = [
148
+ hasDynamicTextures ? 'Dynamic Textures' : '',
149
+ hasRenderTargetTextures ? 'Render Target Textures' : '',
150
+ ]
151
+ .filter(Boolean)
152
+ .join();
153
+ console.warn(`Couldn't exchange material "${material.name}" in export, as it contains unsupported texture type(s) (${textureTypesString}). The export will still work, but the textures of this material will keep their original size.`);
154
+ return;
155
+ }
156
+ const newName = `${material.name}_clone`;
157
+ const clonedMaterial = material.clone(newName);
158
+ (0, metadata_helper_1.cloneInternalMetadata)(material, clonedMaterial);
159
+ const clonedTextures = clonedMaterial.getActiveTextures();
160
+ // mark all exported textures, so that they will be deleted after the export
161
+ clonedTextures.forEach(texture => (0, metadata_helper_1.setInternalMetadataValue)(texture, 'deleteAfterExport', true));
162
+ (0, metadata_helper_1.setInternalMetadataValue)(material, 'exchangeMaterialWith', clonedMaterial.uniqueId);
163
+ (0, metadata_helper_1.setInternalMetadataValue)(clonedMaterial, 'deleteAfterExport', true);
164
+ }
165
+ /**
166
+ * Creates a clone of the node which should be used for the export.
167
+ * Also switches to the cloned material if required.
168
+ */
169
+ function _prepareNodeForExport(viewer, node, clonedParent, excludeNodes) {
170
+ if (!isExportableTransformNode(node, excludeNodes)) {
171
+ return;
172
+ }
173
+ // clone original node and create unique name (via uniqueId) for the export
174
+ const clonedNodeName = `${node.name}_${node.uniqueId}`;
175
+ const clonedNode = node instanceof index_1.InstancedMesh
176
+ ? _createMeshFromInstancedMesh(node, clonedNodeName, clonedParent)
177
+ : node.clone(clonedNodeName, clonedParent, true);
178
+ (0, metadata_helper_1.cloneInternalMetadata)(node, clonedNode);
179
+ // exchange material
180
+ if (clonedNode instanceof index_1.Mesh) {
181
+ const exchangeWithMaterial = clonedNode.material && (0, metadata_helper_1.getInternalMetadataValue)(clonedNode.material, 'exchangeMaterialWith');
182
+ if (exchangeWithMaterial) {
183
+ clonedNode.material = viewer.scene.getMaterialByUniqueID(exchangeWithMaterial);
184
+ }
185
+ }
186
+ // signalize that this is a cloned node
187
+ (0, metadata_helper_1.setInternalMetadataValue)(clonedNode, 'exportNode', true);
188
+ (0, metadata_helper_1.setInternalMetadataValue)(clonedNode, 'deleteAfterExport', true);
189
+ // handle children
190
+ const childs = node.getChildTransformNodes(true);
191
+ childs.forEach(child => _prepareNodeForExport(viewer, child, clonedNode, excludeNodes));
192
+ }
193
+ /**
194
+ * Help function for receiving all nodes that are marked for the export
195
+ */
196
+ function _getNodesMarkedForExport(viewer) {
197
+ const nodes = [...viewer.scene.meshes, ...viewer.scene.transformNodes];
198
+ const filteredNodes = nodes.filter(node => (0, metadata_helper_1.getInternalMetadataValue)(node, 'exportNode'));
199
+ return filteredNodes;
200
+ }
201
+ /**
202
+ * Creates a "standard" mesh from an instanced mesh, by cloning the source mesh and applying transformation data
203
+ */
204
+ function _createMeshFromInstancedMesh(instancedMesh, newName, clonedParent) {
205
+ // first create a clone of the source mesh
206
+ const newMesh = instancedMesh.sourceMesh.clone(newName, clonedParent, true);
207
+ (0, metadata_helper_1.cloneInternalMetadata)(instancedMesh.sourceMesh, newMesh);
208
+ // apply the transformation data, it's important to create clones of the transformations to not touch the original
209
+ // transformation when applying changes (eg: geometry baking)
210
+ newMesh.position = instancedMesh.position.clone();
211
+ newMesh.rotation = instancedMesh.rotation.clone();
212
+ newMesh.scaling = instancedMesh.scaling.clone();
213
+ // rotation quaternion is optional
214
+ if (instancedMesh.rotationQuaternion) {
215
+ newMesh.rotationQuaternion = instancedMesh.rotationQuaternion.clone();
216
+ }
217
+ // also sync the enabled state from the original instanced mesh
218
+ newMesh.setEnabled(instancedMesh.isEnabled(false));
219
+ return newMesh;
220
+ }
221
+ /**
222
+ * Removes transformation data from the mesh and stores it in the geometry, which is called "baking".
223
+ * Also considers the geometry change from morph targets.
224
+ */
225
+ function _bakeGeometryOfMesh(mesh) {
226
+ if (!mesh.geometry) {
227
+ // no geometry available, nothing to do
228
+ return;
229
+ }
230
+ // geometries can be shared across multiple meshes, first make them unique to avoid side-effects
231
+ mesh.makeGeometryUnique();
232
+ // Babylon.js already provides a function for baking the current skeleton changes into the geometry
233
+ if (mesh.skeleton) {
234
+ mesh.applySkeleton(mesh.skeleton);
235
+ mesh.skeleton = null;
236
+ }
237
+ // NOTE: in difference to skeletons and transformations there is no baking function for morph targets (yet)
238
+ // however another approach could be to re-apply the position and normals data, as there are nice functions for it
239
+ // - `getPositionData(applySkeleton: boolean = false, applyMorph: boolean = false)`
240
+ // - `getNormalsData(applySkeleton: boolean = false, applyMorph: boolean = false)`
241
+ // you can decide if skeletons and morph targets can be added, which is exactly what we want
242
+ // I'm still hesitant to use it because "tangent" and "UV" kinds are not supported, whereas I'm not sure if it's
243
+ // required
244
+ // => try it out when there is enough time for detailed regression tests!
245
+ const morphTargetManager = mesh.morphTargetManager;
246
+ const geometry = mesh.geometry;
247
+ if (morphTargetManager === null || morphTargetManager === void 0 ? void 0 : morphTargetManager.numTargets) {
248
+ // apply morph target vertices data to mesh geometry
249
+ // mostly only the "PositionKind" is implemented
250
+ _bakeMorphTargetManagerIntoVertices(index_1.VertexBuffer.PositionKind, morphTargetManager, geometry);
251
+ _bakeMorphTargetManagerIntoVertices(index_1.VertexBuffer.NormalKind, morphTargetManager, geometry);
252
+ _bakeMorphTargetManagerIntoVertices(index_1.VertexBuffer.TangentKind, morphTargetManager, geometry);
253
+ _bakeMorphTargetManagerIntoVertices(index_1.VertexBuffer.UVKind, morphTargetManager, geometry);
254
+ // remove morph target manager with all it's morph targets
255
+ mesh.morphTargetManager = null;
256
+ }
257
+ // bake the transformation data in the mesh geometry, fortunately there is already a help function from Babylon.js
258
+ mesh.bakeCurrentTransformIntoVertices();
259
+ }
260
+ /**
261
+ * Resets transformation to initial state
262
+ */
263
+ function _resetTransformation(node) {
264
+ node.position = new index_1.Vector3(0, 0, 0);
265
+ node.rotation = new index_1.Vector3(0, 0, 0);
266
+ node.rotationQuaternion = null;
267
+ node.scaling = new index_1.Vector3(1, 1, 1);
268
+ }
269
+ /**
270
+ * @param kind morph targets can affect various vertices kinds, whereas "position" is the most common one
271
+ * still other kinds (like normals or tangents) can be affected as well and can be provided on this input
272
+ */
273
+ function _bakeMorphTargetManagerIntoVertices(kind, morphTargetManager, geometry) {
274
+ const origVerticesData = geometry.getVerticesData(kind);
275
+ if (!origVerticesData) {
276
+ // no vertices data for this kind availabe on the mesh geometry
277
+ return;
278
+ }
279
+ let verticesData = [...origVerticesData];
280
+ for (let i = 0; i < morphTargetManager.numTargets; i++) {
281
+ const target = morphTargetManager.getTarget(i);
282
+ const targetVerticesData = _getVerticesDataFromMorphTarget(kind, target);
283
+ if (targetVerticesData) {
284
+ // vertices data of this kind are implemented on the morph target
285
+ // add the influence of this morph target to the vertices data
286
+ // formula is taken from: https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets#basics
287
+ verticesData = verticesData.map((oldVal, idx) => oldVal + (targetVerticesData[idx] - origVerticesData[idx]) * target.influence);
288
+ }
289
+ }
290
+ // apply the updated vertices data
291
+ geometry.setVerticesData(kind, verticesData);
292
+ }
293
+ function _getVerticesDataFromMorphTarget(kind, morphTarget) {
294
+ switch (kind) {
295
+ case index_1.VertexBuffer.PositionKind:
296
+ return morphTarget.getPositions();
297
+ case index_1.VertexBuffer.NormalKind:
298
+ return morphTarget.getNormals();
299
+ case index_1.VertexBuffer.TangentKind:
300
+ return morphTarget.getTangents();
301
+ case index_1.VertexBuffer.UVKind:
302
+ return morphTarget.getUVs();
303
+ }
304
+ return null;
305
+ }
306
+ //# sourceMappingURL=export-helper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"export-helper.js","sourceRoot":"","sources":["../../../src/internal/export-helper.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAgBkB;AAClB,mDAAwD;AACxD,uDAK2B;AAC3B,+CAAuD;AAUvD;;;;;;GAMG;AACH,SAAsB,gBAAgB,CAAC,MAAc,EAAE,QAAmC;;QACxF,MAAM,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,EAAE,CAAC;QAE3D,mGAAmG;QACnG,MAAM,CAAC,cAAc,EAAE,CAAC;QAExB,mEAAmE;QACnE,2BAA2B;QAC3B,0FAA0F;QAC1F,mEAAmE;QACnE,qEAAqE;QACrE,kHAAkH;QAClH,gHAAgH;QAChH,4BAA4B;QAC5B,MAAM,kBAAkB,GAAG,IAAA,qCAAqB,EAAC,MAAM,CAAC,cAAc,CAAC,gBAAgB,CAAC,CAAC;QACzF,IAAI,iBAAiB,IAAI,CAAC,kBAAkB,EAAE;YAC5C,oEAAoE;YACpE,qDAAqD;YACrD,MAAM,CAAC,MAAM,CAAC,0BAA0B,EAAE,CAAC;YAC3C,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,cAAc,GAAG,IAAI,CAAC;YAE9C,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ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,8DAA8D;YAC9D,sGAAsG;YACtG,YAAY,GAAG,YAAY,CAAC,GAAG,CAC7B,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC,MAAM,GAAG,CAAC,kBAAkB,CAAC,GAAG,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,SAAS,CAC/F,CAAC;SACH;KACF;IAED,kCAAkC;IAClC,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,+BAA+B,CAAC,IAAY,EAAE,WAAwB;IAC7E,QAAQ,IAAI,EAAE;QACZ,KAAK,oBAAY,CAAC,YAAY;YAC5B,OAAO,WAAW,CAAC,YAAY,EAAE,CAAC;QACpC,KAAK,oBAAY,CAAC,UAAU;YAC1B,OAAO,WAAW,CAAC,UAAU,EAAE,CAAC;QAClC,KAAK,oBAAY,CAAC,WAAW;YAC3B,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC;QACnC,KAAK,oBAAY,CAAC,MAAM;YACtB,OAAO,WAAW,CAAC,MAAM,EAAE,CAAC;KAC/B;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -36,8 +36,8 @@ function nodeMatchesAnyCriteria(nodeToCheck, criteria) {
36
36
  matchesIsGeneratedBackgroundMesh ||
37
37
  matchesIsHtmlAnchorMesh ||
38
38
  matchesIsDimensionLine;
39
- // consider parent as well, BUT ONLY for list and disabled state, as the other criterias have nothing to do with a
40
- // child-parent relation
39
+ // consider parent as well, BUT ONLY for list, disabled state and background mesh, as the other criterias have nothing
40
+ // to do with a child-parent relation
41
41
  if (!matchesAnyCriteria && nodeToCheck.parent instanceof __1.TransformNode) {
42
42
  matchesAnyCriteria = nodeMatchesAnyCriteria(nodeToCheck.parent, {
43
43
  isInList,
@@ -1 +1 @@
1
- {"version":3,"file":"node-helper.js","sourceRoot":"","sources":["../../../src/internal/node-helper.ts"],"names":[],"mappings":";;;AAAA,0BAAkH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;QACjB,6BAA6B;QAC7B,0BAA0B;QAC1B,gCAAgC;QAChC,uBAAuB;QACvB,sBAAsB,CAAC;IACzB,sHAAsH;IACtH,qCAAqC;IACrC,IAAI,CAAC,kBAAkB,IAAI,WAAW,CAAC,MAAM,YAAY,iBAAa,EAAE;QACtE,kBAAkB,GAAG,sBAAsB,CAAC,WAAW,CAAC,MAAM,EAAE;YAC9D,QAAQ;YACR,UAAU;YACV,yBAAyB;SAC1B,CAAC,CAAC;KACJ;IAED,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAvDD,wDAuDC"}
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.CameraManager = void 0;
13
13
  const index_1 = require("../index");
14
+ const export_helper_1 = require("../internal/export-helper");
14
15
  const node_helper_1 = require("../internal/node-helper");
15
16
  const screenshot_helper_1 = require("../internal/screenshot-helper");
16
17
  /**
@@ -192,12 +193,7 @@ class CameraManager {
192
193
  if (fileName) {
193
194
  // rebuild Babylon.js default behaviour: if a file name is given, download the screenshot instead of returning the
194
195
  // data string
195
- const link = document.createElement('a');
196
- link.href = imageStr;
197
- link.download = fileName;
198
- document.body.appendChild(link);
199
- link.click();
200
- document.body.removeChild(link);
196
+ (0, export_helper_1.downloadFile)(imageStr3d, fileName);
201
197
  return '';
202
198
  }
203
199
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"camera-manager.js","sourceRoot":"","sources":["../../../src/manager/camera-manager.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oCAYkB;AAClB,yDAAiE;AACjE,qEAAmF;AA0GnF;;GAEG;AACH,MAAa,aAAa;IAsBxB,gBAAgB;IAChB,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C;;OAEG;IACU,qBAAqB,CAAC,QAA4B;;;YAC7D,MAAM,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,KA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c,EAAE,GAAG;CACpB,CAAC;AAEwB,8CAAgC,GAAG,CAAC,CAAC;AACrC,mCAAqB,GAAG,GAAG,CAAC;AAC5B,qCAAuB,GAAG,mBAAmB,CAAC"}
@@ -0,0 +1,39 @@
1
+ import { NodeDescription, Viewer } from '../index';
2
+ import { Unit } from 'dxf-writer';
3
+ export declare type DxfUnit = Unit;
4
+ export declare type DxfExportSettings = {
5
+ fileName?: string;
6
+ /** List of nodes that should be excluded from the DXF export */
7
+ excludeNodes?: NodeDescription[];
8
+ /**
9
+ * Unit of the 3d model.\
10
+ * If a unit is set, CAD tools are able to convert the values from the DXF into the configured unit of the CAD tool.
11
+ */
12
+ unit?: DxfUnit;
13
+ };
14
+ /**
15
+ * Manager for creating DXF exports of the current viewer scene
16
+ */
17
+ export declare class DxfExportManager {
18
+ protected viewer: Viewer;
19
+ /** @internal */
20
+ constructor(viewer: Viewer);
21
+ /**
22
+ * Returns DXF export as `File` for further processing. (e.g upload as Cfgn file)
23
+ */
24
+ createDxf(settings?: DxfExportSettings): Promise<File>;
25
+ /**
26
+ * Creates DXF export and downloads the resulting file right away
27
+ */
28
+ downloadDxf(settings?: DxfExportSettings): Promise<void>;
29
+ /**
30
+ * Help function for creating a blob with the DXF string, as this is needed for both public interface functions
31
+ * (`exportDxf` & `exportDxfToFile`)
32
+ */
33
+ protected _createDxfBlob(settings?: DxfExportSettings): Promise<Blob>;
34
+ /**
35
+ * DXF creation process.\
36
+ * We go through all vertices of all meshes and create DXF 3d faces accordingly.
37
+ */
38
+ protected _createDxf(unit?: DxfUnit): string;
39
+ }
@@ -0,0 +1,116 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DxfExportManager = void 0;
16
+ const index_1 = require("../index");
17
+ const export_helper_1 = require("../internal/export-helper");
18
+ const metadata_helper_1 = require("../internal/metadata-helper");
19
+ const node_helper_1 = require("../internal/node-helper");
20
+ const dxf_writer_1 = __importDefault(require("dxf-writer"));
21
+ /**
22
+ * Manager for creating DXF exports of the current viewer scene
23
+ */
24
+ class DxfExportManager {
25
+ /** @internal */
26
+ constructor(viewer) {
27
+ this.viewer = viewer;
28
+ }
29
+ /**
30
+ * Returns DXF export as `File` for further processing. (e.g upload as Cfgn file)
31
+ */
32
+ createDxf(settings) {
33
+ return __awaiter(this, void 0, void 0, function* () {
34
+ const normalizedFileName = (0, export_helper_1.normalizeFileName)(settings === null || settings === void 0 ? void 0 : settings.fileName, 'dxf', 'dxf-export');
35
+ const dxfBlob = yield this._createDxfBlob(settings);
36
+ const dxfFile = new File([dxfBlob], normalizedFileName, { type: 'application/dxf' });
37
+ return dxfFile;
38
+ });
39
+ }
40
+ /**
41
+ * Creates DXF export and downloads the resulting file right away
42
+ */
43
+ downloadDxf(settings) {
44
+ return __awaiter(this, void 0, void 0, function* () {
45
+ const normalizedFileName = (0, export_helper_1.normalizeFileName)(settings === null || settings === void 0 ? void 0 : settings.fileName, 'dxf', 'dxf-export');
46
+ const dxfBlob = yield this._createDxfBlob(settings);
47
+ const url = URL.createObjectURL(dxfBlob);
48
+ (0, export_helper_1.downloadFile)(url, normalizedFileName);
49
+ URL.revokeObjectURL(url);
50
+ });
51
+ }
52
+ /**
53
+ * Help function for creating a blob with the DXF string, as this is needed for both public interface functions
54
+ * (`exportDxf` & `exportDxfToFile`)
55
+ */
56
+ _createDxfBlob(settings) {
57
+ return __awaiter(this, void 0, void 0, function* () {
58
+ // Transformation baking pre process is required for DXF exports, as we take the plain vertex information for the
59
+ // DXF conversion, therefore the vertices need to be located in world already
60
+ yield (0, export_helper_1.exportPreProcess)(this.viewer, { excludeNodes: settings === null || settings === void 0 ? void 0 : settings.excludeNodes });
61
+ const dxfString = this._createDxf(settings === null || settings === void 0 ? void 0 : settings.unit);
62
+ yield (0, export_helper_1.exportPostProcess)(this.viewer);
63
+ const dxfBlob = new Blob([dxfString], { type: 'application/dxf' });
64
+ return dxfBlob;
65
+ });
66
+ }
67
+ /**
68
+ * DXF creation process.\
69
+ * We go through all vertices of all meshes and create DXF 3d faces accordingly.
70
+ */
71
+ _createDxf(unit) {
72
+ const DXF = new dxf_writer_1.default();
73
+ if (unit) {
74
+ DXF.setUnits(unit);
75
+ }
76
+ const meshesToExport = this.viewer.scene.meshes.filter(mesh => (0, metadata_helper_1.getInternalMetadataValue)(mesh, 'exportNode') &&
77
+ // NOTE: can't add this criteria in pre export process, as pre export process works recursively and childs of
78
+ // transforms nodes or meshes without geometry can still have geometries and therefore be valid for the export
79
+ !(0, node_helper_1.nodeMatchesAnyCriteria)(mesh, { hasInvalidBoundingInfo: true }));
80
+ meshesToExport.forEach(mesh => {
81
+ const positions = mesh.getVerticesData(index_1.VertexBuffer.PositionKind);
82
+ const indices = mesh.getIndices();
83
+ if (!positions || !indices) {
84
+ console.warn(`Can't create DXF export of mesh "${mesh.name}", as there is no vertex data available`);
85
+ return;
86
+ }
87
+ for (let i = 0; i < indices.length; i += 3) {
88
+ // A face always consists of 3 vertices.
89
+ // First we need to get the indizes of the vertices.
90
+ const idx1 = indices[i];
91
+ const idx2 = indices[i + 1];
92
+ const idx3 = indices[i + 2];
93
+ // Now get the x, y, z data of the associated index.
94
+ // One index stores 3 vertices, thats why the index is multiplied with 3 before accessing the actual vertex
95
+ // position.
96
+ // > and z components have dedicated offsets 1 and 2.
97
+ // ===============
98
+ // Important NOTE:
99
+ // ===============
100
+ // DXF is right-handed, according to tests in AutoDesk it seems like y and z components are just switched.
101
+ // So we use offset 2 for y and offset 1 for z.
102
+ const p1 = new index_1.Vector3(positions[idx1 * 3], positions[idx1 * 3 + 2], positions[idx1 * 3 + 1]);
103
+ const p2 = new index_1.Vector3(positions[idx2 * 3], positions[idx2 * 3 + 2], positions[idx2 * 3 + 1]);
104
+ const p3 = new index_1.Vector3(positions[idx3 * 3], positions[idx3 * 3 + 2], positions[idx3 * 3 + 1]);
105
+ // Add a 3D face to the DXF (3DFACE entity).
106
+ // The library works with 4 points per face, but we only have 3.
107
+ // Using the last point 3 times is fine though.
108
+ DXF.drawFace(p1.x, p1.y, p1.z, p2.x, p2.y, p2.z, p3.x, p3.y, p3.z, p3.x, p3.y, p3.z);
109
+ }
110
+ });
111
+ const dxfString = DXF.toDxfString();
112
+ return dxfString;
113
+ }
114
+ }
115
+ exports.DxfExportManager = DxfExportManager;
116
+ //# sourceMappingURL=dxf-export-manager.js.map