@combeenation/3d-viewer 14.0.1-rc1 → 15.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.
Files changed (81) hide show
  1. package/README.md +9 -9
  2. package/dist/lib-cjs/buildinfo.json +3 -3
  3. package/dist/lib-cjs/commonjs.tsconfig.tsbuildinfo +1 -1
  4. package/dist/lib-cjs/index.d.ts +51 -62
  5. package/dist/lib-cjs/index.js +84 -94
  6. package/dist/lib-cjs/index.js.map +1 -1
  7. package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.d.ts +10 -10
  8. package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js +131 -131
  9. package/dist/lib-cjs/internal/cbn-custom-babylon-loader-plugin.js.map +1 -1
  10. package/dist/lib-cjs/internal/cloning-helper.d.ts +19 -19
  11. package/dist/lib-cjs/internal/cloning-helper.js +163 -163
  12. package/dist/lib-cjs/internal/device-helper.d.ts +9 -9
  13. package/dist/lib-cjs/internal/device-helper.js +24 -24
  14. package/dist/lib-cjs/internal/geometry-helper.d.ts +21 -21
  15. package/dist/lib-cjs/internal/geometry-helper.js +145 -145
  16. package/dist/lib-cjs/internal/metadata-helper.d.ts +26 -26
  17. package/dist/lib-cjs/internal/metadata-helper.js +50 -50
  18. package/dist/lib-cjs/internal/paintable-helper.d.ts +40 -40
  19. package/dist/lib-cjs/internal/paintable-helper.js +234 -286
  20. package/dist/lib-cjs/internal/paintable-helper.js.map +1 -1
  21. package/dist/lib-cjs/internal/svg-helper.d.ts +4 -0
  22. package/dist/lib-cjs/internal/svg-helper.js +67 -0
  23. package/dist/lib-cjs/internal/svg-helper.js.map +1 -0
  24. package/dist/lib-cjs/internal/tags-helper.d.ts +12 -12
  25. package/dist/lib-cjs/internal/tags-helper.js +39 -37
  26. package/dist/lib-cjs/internal/tags-helper.js.map +1 -1
  27. package/dist/lib-cjs/internal/texture-parameter-helper.d.ts +37 -0
  28. package/dist/lib-cjs/internal/texture-parameter-helper.js +287 -0
  29. package/dist/lib-cjs/internal/texture-parameter-helper.js.map +1 -0
  30. package/dist/lib-cjs/manager/camera-manager.d.ts +110 -110
  31. package/dist/lib-cjs/manager/camera-manager.js +209 -206
  32. package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
  33. package/dist/lib-cjs/manager/debug-manager.d.ts +60 -60
  34. package/dist/lib-cjs/manager/debug-manager.js +217 -217
  35. package/dist/lib-cjs/manager/event-manager.d.ts +52 -52
  36. package/dist/lib-cjs/manager/event-manager.js +71 -71
  37. package/dist/lib-cjs/manager/gltf-export-manager.d.ts +75 -84
  38. package/dist/lib-cjs/manager/gltf-export-manager.js +286 -290
  39. package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
  40. package/dist/lib-cjs/manager/material-manager.d.ts +35 -35
  41. package/dist/lib-cjs/manager/material-manager.js +125 -125
  42. package/dist/lib-cjs/manager/model-manager.d.ts +145 -145
  43. package/dist/lib-cjs/manager/model-manager.js +382 -382
  44. package/dist/lib-cjs/manager/parameter-manager.d.ts +228 -210
  45. package/dist/lib-cjs/manager/parameter-manager.js +573 -514
  46. package/dist/lib-cjs/manager/parameter-manager.js.map +1 -1
  47. package/dist/lib-cjs/manager/scene-manager.d.ts +45 -45
  48. package/dist/lib-cjs/manager/scene-manager.js +64 -64
  49. package/dist/lib-cjs/manager/texture-manager.d.ts +12 -12
  50. package/dist/lib-cjs/manager/texture-manager.js +43 -43
  51. package/dist/lib-cjs/viewer-error.d.ts +49 -48
  52. package/dist/lib-cjs/viewer-error.js +61 -60
  53. package/dist/lib-cjs/viewer-error.js.map +1 -1
  54. package/dist/lib-cjs/viewer.d.ts +115 -115
  55. package/dist/lib-cjs/viewer.js +217 -217
  56. package/dist/lib-cjs/viewer.js.map +1 -1
  57. package/package.json +94 -91
  58. package/src/buildinfo.json +3 -3
  59. package/src/dev.ts +47 -47
  60. package/src/global-types.d.ts +39 -39
  61. package/src/index.ts +71 -81
  62. package/src/internal/cbn-custom-babylon-loader-plugin.ts +159 -159
  63. package/src/internal/cloning-helper.ts +225 -225
  64. package/src/internal/device-helper.ts +25 -25
  65. package/src/internal/geometry-helper.ts +181 -181
  66. package/src/internal/metadata-helper.ts +63 -63
  67. package/src/internal/paintable-helper.ts +258 -310
  68. package/src/internal/svg-helper.ts +52 -0
  69. package/src/internal/tags-helper.ts +43 -41
  70. package/src/internal/texture-parameter-helper.ts +353 -0
  71. package/src/manager/camera-manager.ts +368 -365
  72. package/src/manager/debug-manager.ts +245 -245
  73. package/src/manager/event-manager.ts +72 -72
  74. package/src/manager/gltf-export-manager.ts +356 -357
  75. package/src/manager/material-manager.ts +135 -135
  76. package/src/manager/model-manager.ts +458 -458
  77. package/src/manager/parameter-manager.ts +730 -652
  78. package/src/manager/scene-manager.ts +101 -101
  79. package/src/manager/texture-manager.ts +32 -32
  80. package/src/viewer-error.ts +69 -68
  81. package/src/viewer.ts +290 -290
@@ -1,72 +1,72 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.EventManager = exports.ViewerEvent = void 0;
7
- const eventemitter3_1 = __importDefault(require("eventemitter3"));
8
- // NOTE: ATM we expose only very few events, due to the following reasons:
9
- // - Code is generally asynchronous and can be awaited by consumer
10
- // - We don't want to bloat the code with events that are never used
11
- /**
12
- * Events that are fired by the viewer
13
- */
14
- var ViewerEvent;
15
- (function (ViewerEvent) {
16
- /**
17
- * Requested material is not available in the scene yet and is about to be created
18
- * @param materialId
19
- */
20
- ViewerEvent["MaterialCreationStart"] = "MaterialCreationStart";
21
- /**
22
- * Material creation has been finished, that includes:
23
- * - Load definition from Combeenation server
24
- * - Load all textures
25
- * - Compile shader
26
- * @param materialId
27
- * @param allMaterialsCreated signalizes that no more materials are currently being created
28
- */
29
- ViewerEvent["MaterialCreationEnd"] = "MaterialCreationEnd";
30
- /**
31
- * Bounding sphere for autofocusing camera has been calculated.
32
- * This is used internally for debugging purposes.
33
- * @param boundingSphere
34
- */
35
- ViewerEvent["AutofocusStart"] = "AutofocusStart";
36
- })(ViewerEvent = exports.ViewerEvent || (exports.ViewerEvent = {}));
37
- /**
38
- * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
39
- */
40
- class EventManager {
41
- /** @internal */
42
- constructor(viewer) {
43
- this.viewer = viewer;
44
- this._eventEmitter = new eventemitter3_1.default();
45
- }
46
- /**
47
- * Used @internal to fire a viewer event
48
- */
49
- fireEvent(event, ...args) {
50
- this._eventEmitter.emit(event, ...args);
51
- }
52
- /**
53
- * Add listener to certain viewer event
54
- */
55
- addListener(event, fn) {
56
- this._eventEmitter.addListener(event, fn);
57
- }
58
- /**
59
- * Remove listener to viewer event
60
- */
61
- removeListener(event, fn) {
62
- this._eventEmitter.removeListener(event, fn);
63
- }
64
- /**
65
- * Used @internal to clean eventing sytem before viewer destruction
66
- */
67
- removeAllListeners(event) {
68
- this._eventEmitter.removeAllListeners(event);
69
- }
70
- }
71
- exports.EventManager = EventManager;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.EventManager = exports.ViewerEvent = void 0;
7
+ const eventemitter3_1 = __importDefault(require("eventemitter3"));
8
+ // NOTE: ATM we expose only very few events, due to the following reasons:
9
+ // - Code is generally asynchronous and can be awaited by consumer
10
+ // - We don't want to bloat the code with events that are never used
11
+ /**
12
+ * Events that are fired by the viewer
13
+ */
14
+ var ViewerEvent;
15
+ (function (ViewerEvent) {
16
+ /**
17
+ * Requested material is not available in the scene yet and is about to be created
18
+ * @param materialId
19
+ */
20
+ ViewerEvent["MaterialCreationStart"] = "MaterialCreationStart";
21
+ /**
22
+ * Material creation has been finished, that includes:
23
+ * - Load definition from Combeenation server
24
+ * - Load all textures
25
+ * - Compile shader
26
+ * @param materialId
27
+ * @param allMaterialsCreated signalizes that no more materials are currently being created
28
+ */
29
+ ViewerEvent["MaterialCreationEnd"] = "MaterialCreationEnd";
30
+ /**
31
+ * Bounding sphere for autofocusing camera has been calculated.
32
+ * This is used internally for debugging purposes.
33
+ * @param boundingSphere
34
+ */
35
+ ViewerEvent["AutofocusStart"] = "AutofocusStart";
36
+ })(ViewerEvent = exports.ViewerEvent || (exports.ViewerEvent = {}));
37
+ /**
38
+ * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
39
+ */
40
+ class EventManager {
41
+ /** @internal */
42
+ constructor(viewer) {
43
+ this.viewer = viewer;
44
+ this._eventEmitter = new eventemitter3_1.default();
45
+ }
46
+ /**
47
+ * Used @internal to fire a viewer event
48
+ */
49
+ fireEvent(event, ...args) {
50
+ this._eventEmitter.emit(event, ...args);
51
+ }
52
+ /**
53
+ * Add listener to certain viewer event
54
+ */
55
+ addListener(event, fn) {
56
+ this._eventEmitter.addListener(event, fn);
57
+ }
58
+ /**
59
+ * Remove listener to viewer event
60
+ */
61
+ removeListener(event, fn) {
62
+ this._eventEmitter.removeListener(event, fn);
63
+ }
64
+ /**
65
+ * Used @internal to clean eventing sytem before viewer destruction
66
+ */
67
+ removeAllListeners(event) {
68
+ this._eventEmitter.removeAllListeners(event);
69
+ }
70
+ }
71
+ exports.EventManager = EventManager;
72
72
  //# sourceMappingURL=event-manager.js.map
@@ -1,84 +1,75 @@
1
- import { ExcludedGeometryList, IExportOptions, Material, Node, TransformNode, Viewer } from '../index';
2
- import type { AnimationGroup } from '@babylonjs/core/Animations/animationGroup';
3
- /**
4
- * Manager for gltf export and augmented reality features
5
- */
6
- export declare class GltfExportManager {
7
- protected viewer: Viewer;
8
- protected static readonly _EXPORT_ROOT_NAME = "__export_root__";
9
- protected _maxTextureSize: number;
10
- /**
11
- * Animation groups which have been removed from the scene before export for AR and which need to be re-added
12
- * afterwards.
13
- *
14
- * AR does not work on Android (i.e. the modelviewer) when animation groups are present in the scene.
15
- * See CB-10055 for more details.
16
- */
17
- protected _animationGroupsToRestore: AnimationGroup[];
18
- /**
19
- * Defines options for the export.
20
- * We don't allow the user to overwrite certain settings, since we rely on properties like `removeNoopRootNodes` to
21
- * stay `true` in order to make the AR export work.
22
- * We could theoretically allow it if AR optimization is not desired, but this may confuse the user.
23
- */
24
- protected static _gltfExportOptions(optimizeForAR: boolean, excluded?: ExcludedGeometryList): IExportOptions;
25
- /**
26
- * Checks if a node should be available in the export
27
- */
28
- protected static _shouldExportNode(node: Node, excluded?: ExcludedGeometryList): boolean;
29
- /**
30
- * Creates a clone of the material which should be used for the export.
31
- * This is mostly required for recreating textures with lower sizes.
32
- * CAUTION: Material exchanging is not supported for materials that contain certain texture types:
33
- * - Dynamic textures (Paintables): Cloning dynamic textures doesn't clone the canvas context
34
- * => so the clone is just empty
35
- * - Render target textures: Disposing the clone will leave the scene in a "not ready" state
36
- * => this scenario is not fully analyzed yet, but it's not really worth the effort right now, since this kind of
37
- * of texture is not really used ATM
38
- */
39
- protected static _exchangeMaterial(material: Material): void;
40
- /** @internal */
41
- constructor(viewer: Viewer);
42
- /**
43
- * Exports selected nodes to a file.
44
- * @param filename Optional name of the exported .GLB file.
45
- * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
46
- * is mostly targeting Apples .usdz format.
47
- * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
48
- */
49
- exportGlb(filename?: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<File | undefined>;
50
- /**
51
- * Exports selected nodes to GLTF. This may result in more than one file, since textures are exported seperately.
52
- * @param filename Name of the main (text-based) .GLTF file referring to separate texture files.
53
- * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
54
- * is mostly targeting Apples .usdz format.
55
- * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
56
- */
57
- exportGltfToFile(filename: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<void>;
58
- /**
59
- * Exports selected nodes to GLB. This results in one binary file.
60
- * @param filename Name of the main (text-based) .GLTF file referring to seperate texture files.
61
- * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
62
- * is mostly targeting Apples .usdz format.
63
- * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
64
- */
65
- exportGlbToFile(filename: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<void>;
66
- /**
67
- * Prepares scene for GLB export.
68
- * This is very important for AR exports, since we have to do a lot of conversions to satisfy Apples .usdz format.
69
- */
70
- protected _exportPreProcess(optimizeForAR: boolean, excluded?: ExcludedGeometryList): Promise<void>;
71
- /**
72
- * Cleans up scene after export
73
- */
74
- protected _exportPostProcess(optimizeForAR: boolean): Promise<void>;
75
- /**
76
- * Creates a clone of the node which should be used for the export.
77
- * Also switches to the cloned material if required.
78
- */
79
- protected _prepareNodeForExport(node: Node, clonedParent: TransformNode, excluded?: ExcludedGeometryList): void;
80
- /**
81
- * Help function for receiving all nodes that are marked for the export
82
- */
83
- protected _getNodesMarkedForExport(meshesOnly?: boolean): TransformNode[];
84
- }
1
+ import { ExcludedGeometryList, IExportOptions, Material, Node, TransformNode, Viewer } from '../index';
2
+ /**
3
+ * Manager for gltf export and augmented reality features
4
+ */
5
+ export declare class GltfExportManager {
6
+ protected viewer: Viewer;
7
+ protected static readonly _EXPORT_ROOT_NAME = "__export_root__";
8
+ protected _maxTextureSize: number;
9
+ /**
10
+ * Defines options for the export.
11
+ * We don't allow the user to overwrite certain settings, since we rely on properties like `removeNoopRootNodes` to
12
+ * stay `true` in order to make the AR export work.
13
+ * We could theoretically allow it if AR optimization is not desired, but this may confuse the user.
14
+ */
15
+ protected static _gltfExportOptions(optimizeForAR: boolean, excluded?: ExcludedGeometryList): IExportOptions;
16
+ /**
17
+ * Checks if a node should be available in the export
18
+ */
19
+ protected static _shouldExportNode(node: Node, excluded?: ExcludedGeometryList): boolean;
20
+ /**
21
+ * Creates a clone of the material which should be used for the export.
22
+ * This is mostly required for recreating textures with lower sizes.
23
+ * CAUTION: Material exchanging is not supported for materials that contain certain texture types:
24
+ * - Dynamic textures (Paintables): Cloning dynamic textures doesn't clone the canvas context
25
+ * => so the clone is just empty
26
+ * - Render target textures: Disposing the clone will leave the scene in a "not ready" state
27
+ * => this scenario is not fully analyzed yet, but it's not really worth the effort right now, since this kind of
28
+ * of texture is not really used ATM
29
+ */
30
+ protected static _exchangeMaterial(material: Material): void;
31
+ /** @internal */
32
+ constructor(viewer: Viewer);
33
+ /**
34
+ * Exports selected nodes to a file.
35
+ * @param filename Optional name of the exported .GLB file.
36
+ * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
37
+ * is mostly targeting Apples .usdz format.
38
+ * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
39
+ */
40
+ exportGlb(filename?: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<File | undefined>;
41
+ /**
42
+ * Exports selected nodes to GLTF. This may result in more than one file, since textures are exported seperately.
43
+ * @param filename Name of the main (text-based) .GLTF file referring to separate texture files.
44
+ * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
45
+ * is mostly targeting Apples .usdz format.
46
+ * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
47
+ */
48
+ exportGltfToFile(filename: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<void>;
49
+ /**
50
+ * Exports selected nodes to GLB. This results in one binary file.
51
+ * @param filename Name of the main (text-based) .GLTF file referring to seperate texture files.
52
+ * @param optimizeForAR Adjusts the exported GLB so that known issues get automatically fixed, this
53
+ * is mostly targeting Apples .usdz format.
54
+ * @param excluded Optional list of geometry (meshes, elements, variants,...) to be excluded from the export.
55
+ */
56
+ exportGlbToFile(filename: string, optimizeForAR?: boolean, excluded?: ExcludedGeometryList): Promise<void>;
57
+ /**
58
+ * Prepares scene for GLB export.
59
+ * This is very important for AR exports, since we have to do a lot of conversions to satisfy Apples .usdz format.
60
+ */
61
+ protected _exportPreProcess(optimizeForAR: boolean, excluded?: ExcludedGeometryList): Promise<void>;
62
+ /**
63
+ * Cleans up scene after export
64
+ */
65
+ protected _exportPostProcess(optimizeForAR: boolean): Promise<void>;
66
+ /**
67
+ * Creates a clone of the node which should be used for the export.
68
+ * Also switches to the cloned material if required.
69
+ */
70
+ protected _prepareNodeForExport(node: Node, clonedParent: TransformNode, excluded?: ExcludedGeometryList): void;
71
+ /**
72
+ * Help function for receiving all nodes that are marked for the export
73
+ */
74
+ protected _getNodesMarkedForExport(meshesOnly?: boolean): TransformNode[];
75
+ }