@combeenation/3d-viewer 13.0.1 → 14.0.1-rc1

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 (72) 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 +62 -63
  5. package/dist/lib-cjs/index.js +94 -95
  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/cloning-helper.d.ts +19 -19
  10. package/dist/lib-cjs/internal/cloning-helper.js +163 -163
  11. package/dist/lib-cjs/internal/device-helper.d.ts +9 -9
  12. package/dist/lib-cjs/internal/device-helper.js +24 -24
  13. package/dist/lib-cjs/internal/geometry-helper.d.ts +21 -21
  14. package/dist/lib-cjs/internal/geometry-helper.js +145 -145
  15. package/dist/lib-cjs/internal/metadata-helper.d.ts +26 -26
  16. package/dist/lib-cjs/internal/metadata-helper.js +50 -50
  17. package/dist/lib-cjs/internal/paintable-helper.d.ts +40 -40
  18. package/dist/lib-cjs/internal/paintable-helper.js +286 -286
  19. package/dist/lib-cjs/internal/tags-helper.d.ts +12 -12
  20. package/dist/lib-cjs/internal/tags-helper.js +37 -37
  21. package/dist/lib-cjs/manager/camera-manager.d.ts +110 -51
  22. package/dist/lib-cjs/manager/camera-manager.js +206 -153
  23. package/dist/lib-cjs/manager/camera-manager.js.map +1 -1
  24. package/dist/lib-cjs/manager/debug-manager.d.ts +60 -60
  25. package/dist/lib-cjs/manager/debug-manager.js +217 -217
  26. package/dist/lib-cjs/manager/event-manager.d.ts +52 -52
  27. package/dist/lib-cjs/manager/event-manager.js +71 -71
  28. package/dist/lib-cjs/manager/gltf-export-manager.d.ts +84 -75
  29. package/dist/lib-cjs/manager/gltf-export-manager.js +290 -278
  30. package/dist/lib-cjs/manager/gltf-export-manager.js.map +1 -1
  31. package/dist/lib-cjs/manager/material-manager.d.ts +35 -35
  32. package/dist/lib-cjs/manager/material-manager.js +125 -125
  33. package/dist/lib-cjs/manager/model-manager.d.ts +145 -145
  34. package/dist/lib-cjs/manager/model-manager.js +382 -382
  35. package/dist/lib-cjs/manager/parameter-manager.d.ts +210 -210
  36. package/dist/lib-cjs/manager/parameter-manager.js +514 -514
  37. package/dist/lib-cjs/manager/scene-manager.d.ts +45 -45
  38. package/dist/lib-cjs/manager/scene-manager.js +64 -64
  39. package/dist/lib-cjs/manager/texture-manager.d.ts +12 -12
  40. package/dist/lib-cjs/manager/texture-manager.js +43 -43
  41. package/dist/lib-cjs/viewer-error.d.ts +48 -48
  42. package/dist/lib-cjs/viewer-error.js +60 -60
  43. package/dist/lib-cjs/viewer.d.ts +115 -117
  44. package/dist/lib-cjs/viewer.js +217 -221
  45. package/dist/lib-cjs/viewer.js.map +1 -1
  46. package/package.json +91 -91
  47. package/src/buildinfo.json +3 -3
  48. package/src/dev.ts +47 -47
  49. package/src/global-types.d.ts +39 -39
  50. package/src/index.ts +81 -82
  51. package/src/internal/cbn-custom-babylon-loader-plugin.ts +159 -159
  52. package/src/internal/cloning-helper.ts +225 -225
  53. package/src/internal/device-helper.ts +25 -25
  54. package/src/internal/geometry-helper.ts +181 -181
  55. package/src/internal/metadata-helper.ts +63 -63
  56. package/src/internal/paintable-helper.ts +310 -310
  57. package/src/internal/tags-helper.ts +41 -41
  58. package/src/manager/camera-manager.ts +365 -236
  59. package/src/manager/debug-manager.ts +245 -245
  60. package/src/manager/event-manager.ts +72 -72
  61. package/src/manager/gltf-export-manager.ts +357 -341
  62. package/src/manager/material-manager.ts +135 -135
  63. package/src/manager/model-manager.ts +458 -458
  64. package/src/manager/parameter-manager.ts +652 -652
  65. package/src/manager/scene-manager.ts +101 -101
  66. package/src/manager/texture-manager.ts +32 -32
  67. package/src/viewer-error.ts +68 -68
  68. package/src/viewer.ts +290 -296
  69. package/dist/lib-cjs/manager/screenshot-manager.d.ts +0 -36
  70. package/dist/lib-cjs/manager/screenshot-manager.js +0 -40
  71. package/dist/lib-cjs/manager/screenshot-manager.js.map +0 -1
  72. package/src/manager/screenshot-manager.ts +0 -59
@@ -1,52 +1,52 @@
1
- import { Viewer } from '../index';
2
- import EventEmitter from 'eventemitter3';
3
- /**
4
- * Events that are fired by the viewer
5
- */
6
- export declare enum ViewerEvent {
7
- /**
8
- * Requested material is not available in the scene yet and is about to be created
9
- * @param materialId
10
- */
11
- MaterialCreationStart = "MaterialCreationStart",
12
- /**
13
- * Material creation has been finished, that includes:
14
- * - Load definition from Combeenation server
15
- * - Load all textures
16
- * - Compile shader
17
- * @param materialId
18
- * @param allMaterialsCreated signalizes that no more materials are currently being created
19
- */
20
- MaterialCreationEnd = "MaterialCreationEnd",
21
- /**
22
- * Bounding sphere for autofocusing camera has been calculated.
23
- * This is used internally for debugging purposes.
24
- * @param boundingSphere
25
- */
26
- AutofocusStart = "AutofocusStart"
27
- }
28
- /**
29
- * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
30
- */
31
- export declare class EventManager {
32
- protected viewer: Viewer;
33
- protected _eventEmitter: EventEmitter;
34
- /** @internal */
35
- constructor(viewer: Viewer);
36
- /**
37
- * Used @internal to fire a viewer event
38
- */
39
- fireEvent(event: ViewerEvent, ...args: any[]): void;
40
- /**
41
- * Add listener to certain viewer event
42
- */
43
- addListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
44
- /**
45
- * Remove listener to viewer event
46
- */
47
- removeListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
48
- /**
49
- * Used @internal to clean eventing sytem before viewer destruction
50
- */
51
- removeAllListeners(event?: ViewerEvent): void;
52
- }
1
+ import { Viewer } from '../index';
2
+ import EventEmitter from 'eventemitter3';
3
+ /**
4
+ * Events that are fired by the viewer
5
+ */
6
+ export declare enum ViewerEvent {
7
+ /**
8
+ * Requested material is not available in the scene yet and is about to be created
9
+ * @param materialId
10
+ */
11
+ MaterialCreationStart = "MaterialCreationStart",
12
+ /**
13
+ * Material creation has been finished, that includes:
14
+ * - Load definition from Combeenation server
15
+ * - Load all textures
16
+ * - Compile shader
17
+ * @param materialId
18
+ * @param allMaterialsCreated signalizes that no more materials are currently being created
19
+ */
20
+ MaterialCreationEnd = "MaterialCreationEnd",
21
+ /**
22
+ * Bounding sphere for autofocusing camera has been calculated.
23
+ * This is used internally for debugging purposes.
24
+ * @param boundingSphere
25
+ */
26
+ AutofocusStart = "AutofocusStart"
27
+ }
28
+ /**
29
+ * Manager for eventing system, which ATM is only a slim wrapper about the "eventemitter3" library
30
+ */
31
+ export declare class EventManager {
32
+ protected viewer: Viewer;
33
+ protected _eventEmitter: EventEmitter;
34
+ /** @internal */
35
+ constructor(viewer: Viewer);
36
+ /**
37
+ * Used @internal to fire a viewer event
38
+ */
39
+ fireEvent(event: ViewerEvent, ...args: any[]): void;
40
+ /**
41
+ * Add listener to certain viewer event
42
+ */
43
+ addListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
44
+ /**
45
+ * Remove listener to viewer event
46
+ */
47
+ removeListener(event: ViewerEvent, fn: EventEmitter.ListenerFn): void;
48
+ /**
49
+ * Used @internal to clean eventing sytem before viewer destruction
50
+ */
51
+ removeAllListeners(event?: ViewerEvent): void;
52
+ }
@@ -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,75 +1,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
- }
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
+ }