@combeenation/3d-viewer 14.0.1-rc1 → 14.1.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 (67) 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/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 -110
  22. package/dist/lib-cjs/manager/camera-manager.js +209 -206
  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 +75 -84
  29. package/dist/lib-cjs/manager/gltf-export-manager.js +286 -290
  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 -115
  44. package/dist/lib-cjs/viewer.js +217 -217
  45. package/package.json +91 -91
  46. package/src/buildinfo.json +3 -3
  47. package/src/dev.ts +47 -47
  48. package/src/global-types.d.ts +39 -39
  49. package/src/index.ts +71 -81
  50. package/src/internal/cbn-custom-babylon-loader-plugin.ts +159 -159
  51. package/src/internal/cloning-helper.ts +225 -225
  52. package/src/internal/device-helper.ts +25 -25
  53. package/src/internal/geometry-helper.ts +181 -181
  54. package/src/internal/metadata-helper.ts +63 -63
  55. package/src/internal/paintable-helper.ts +310 -310
  56. package/src/internal/tags-helper.ts +41 -41
  57. package/src/manager/camera-manager.ts +368 -365
  58. package/src/manager/debug-manager.ts +245 -245
  59. package/src/manager/event-manager.ts +72 -72
  60. package/src/manager/gltf-export-manager.ts +356 -357
  61. package/src/manager/material-manager.ts +135 -135
  62. package/src/manager/model-manager.ts +458 -458
  63. package/src/manager/parameter-manager.ts +652 -652
  64. package/src/manager/scene-manager.ts +101 -101
  65. package/src/manager/texture-manager.ts +32 -32
  66. package/src/viewer-error.ts +68 -68
  67. package/src/viewer.ts +290 -290
@@ -1,38 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.cloneTags = exports.setTagsAsString = exports.deleteAllTags = exports.setTags = exports.getTags = exports.hasTag = void 0;
4
- const tags_1 = require("@babylonjs/core/Misc/tags");
5
- function hasTag(object, tag) {
6
- return tags_1.Tags.MatchesQuery(object, tag);
7
- }
8
- exports.hasTag = hasTag;
9
- function getTags(object) {
10
- var _a;
11
- const tagsObject = (_a = tags_1.Tags.GetTags(object, false)) !== null && _a !== void 0 ? _a : {};
12
- const tags = Object.keys(tagsObject);
13
- return tags;
14
- }
15
- exports.getTags = getTags;
16
- function setTags(object, tags) {
17
- const tagsString = tags.join(' ');
18
- tags_1.Tags.AddTagsTo(object, tagsString);
19
- }
20
- exports.setTags = setTags;
21
- function deleteAllTags(object) {
22
- const curTags = tags_1.Tags.GetTags(object);
23
- if (curTags) {
24
- tags_1.Tags.RemoveTagsFrom(object, curTags);
25
- }
26
- }
27
- exports.deleteAllTags = deleteAllTags;
28
- function setTagsAsString(object, tagsString) {
29
- tags_1.Tags.AddTagsTo(object, tagsString);
30
- }
31
- exports.setTagsAsString = setTagsAsString;
32
- function cloneTags(sourceObject, destinationObject) {
33
- if (tags_1.Tags.HasTags(sourceObject)) {
34
- tags_1.Tags.AddTagsTo(destinationObject, tags_1.Tags.GetTags(sourceObject, true));
35
- }
36
- }
37
- exports.cloneTags = cloneTags;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.cloneTags = exports.setTagsAsString = exports.deleteAllTags = exports.setTags = exports.getTags = exports.hasTag = void 0;
4
+ const tags_1 = require("@babylonjs/core/Misc/tags");
5
+ function hasTag(object, tag) {
6
+ return tags_1.Tags.MatchesQuery(object, tag);
7
+ }
8
+ exports.hasTag = hasTag;
9
+ function getTags(object) {
10
+ var _a;
11
+ const tagsObject = (_a = tags_1.Tags.GetTags(object, false)) !== null && _a !== void 0 ? _a : {};
12
+ const tags = Object.keys(tagsObject);
13
+ return tags;
14
+ }
15
+ exports.getTags = getTags;
16
+ function setTags(object, tags) {
17
+ const tagsString = tags.join(' ');
18
+ tags_1.Tags.AddTagsTo(object, tagsString);
19
+ }
20
+ exports.setTags = setTags;
21
+ function deleteAllTags(object) {
22
+ const curTags = tags_1.Tags.GetTags(object);
23
+ if (curTags) {
24
+ tags_1.Tags.RemoveTagsFrom(object, curTags);
25
+ }
26
+ }
27
+ exports.deleteAllTags = deleteAllTags;
28
+ function setTagsAsString(object, tagsString) {
29
+ tags_1.Tags.AddTagsTo(object, tagsString);
30
+ }
31
+ exports.setTagsAsString = setTagsAsString;
32
+ function cloneTags(sourceObject, destinationObject) {
33
+ if (tags_1.Tags.HasTags(sourceObject)) {
34
+ tags_1.Tags.AddTagsTo(destinationObject, tags_1.Tags.GetTags(sourceObject, true));
35
+ }
36
+ }
37
+ exports.cloneTags = cloneTags;
38
38
  //# sourceMappingURL=tags-helper.js.map
@@ -1,110 +1,110 @@
1
- import { AnimationGroup, ArcRotateCamera, BoundingSphere, ExcludedGeometryList, Vector3, Viewer } from '../index';
2
- export declare type CameraPosition = {
3
- alpha: number;
4
- beta: number;
5
- radius: number;
6
- target: Vector3;
7
- };
8
- export declare type AutofocusSettings = {
9
- /** Can be used to customize the margins shown around the 3d model. Defaults to 1. */
10
- radiusFactor?: number;
11
- adjustWheelPrecision?: boolean;
12
- adjustPanningSensibility?: boolean;
13
- adjustPinchPrecision?: boolean;
14
- /** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
15
- alpha?: number;
16
- /** Desired vertical camera angle, this won't be overwritten by the autofocus function */
17
- beta?: number;
18
- /** Optional list of geometry to be excluded from consideration */
19
- exclude?: ExcludedGeometryList;
20
- durationMs?: number;
21
- };
22
- export declare type ScreenshotSettings = {
23
- /** Width of the final screenshot image, defaults to canvas width */
24
- width?: number;
25
- /** Height of the final screenshot image, defaults to canvas height */
26
- height?: number;
27
- /** Camera alpha angle used for the screenshot, defaults to alpha angle of currently active camera */
28
- alpha?: number;
29
- /** Camera beta angle used for the screenshot, defaults to beta angle of currently active camera */
30
- beta?: number;
31
- /**
32
- * Camera radius used for the screenshot, default value depends on `autofocusScene` flag:
33
- * - `true`: radius is calculated automatically so that the whole current scene content is visible
34
- * - `false`: radius of currently active camera is used
35
- */
36
- radius?: number;
37
- /**
38
- * Camera target used for the screenshot, default value depends on `autofocusScene` flag:
39
- * - `true`: center of the current scene content is set as camera target
40
- * - `false`: target of currently active camera is used
41
- */
42
- target?: Vector3;
43
- /** Used to scale the calculated radius if `radius` property is not set and `autofocusScene` mode is active */
44
- radiusFactor?: number;
45
- /** Can be used to automatically calculate camera `radius` and `target`, if these 2 settings are not defined
46
- * explicitely */
47
- autofocusScene?: boolean;
48
- /** Optional list of geometry to be excluded from consideration */
49
- exclude?: ExcludedGeometryList;
50
- /**
51
- * "MIME type" of the returned screenshot image, defaults to `image/png`
52
- *
53
- * **Info regarding JPEG:** \
54
- * Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
55
- * Also ensure that the viewer scenes `clearColor` has an alpha value of `1` as jpeg's don't
56
- * support transparency. Otherwise background will always be black for jpeg's.
57
- */
58
- mimeType?: string;
59
- /** If file name is given, the screenshot image will be downloaded and the base64 string will NOT be returned! */
60
- fileName?: string;
61
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
62
- samples?: number;
63
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
64
- antialiasing?: boolean;
65
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
66
- renderSprites?: boolean;
67
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
68
- enableStencilBuffer?: boolean;
69
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
70
- useLayerMask?: boolean;
71
- /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
72
- quality?: number;
73
- };
74
- /**
75
- * Manager for camera related tasks
76
- */
77
- export declare class CameraManager {
78
- protected viewer: Viewer;
79
- static readonly CAMERA_ANIMATION_NAME = "__cameraAnimation__";
80
- /** @internal */
81
- static readonly DEFAULT_CAMERA_POSITION: CameraPosition;
82
- protected static readonly _AUTOFOCUS_CONSTANTS: {
83
- minZ: number;
84
- wheelPrecision: number;
85
- panningSensibility: number;
86
- pinchPrecision: number;
87
- };
88
- protected static readonly _DEFAULT_AUTOFOCUS_RADIUS_FACTOR = 1;
89
- protected static readonly _DEFAULT_CAM_SPEED_MS = 250;
90
- protected static readonly _SCREENSHOT_CAMERA_NAME = "__screenshotCamera__";
91
- /** @internal */
92
- constructor(viewer: Viewer);
93
- /**
94
- * Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
95
- */
96
- autofocusActiveCamera(settings?: AutofocusSettings): Promise<void>;
97
- /**
98
- * Moves the active camera smoothly to certain position
99
- *
100
- * @param durationMs defaults to 250ms if unset, use 0 for instant movement
101
- */
102
- moveActiveCameraTo(position: CameraPosition, durationMs?: number): Promise<void>;
103
- /**
104
- * Takes a sceenshot the the current scene.\
105
- * The result is a string containing a base64 encoded image.
106
- */
107
- createScreenshot(settings?: ScreenshotSettings): Promise<string>;
108
- protected static _addCameraAnimationToGroup(targetProperty: string, from: number | Vector3, to: number | Vector3, framesPerSec: number, dataType: number, animationGroup: AnimationGroup, activeCamera: ArcRotateCamera): void;
109
- protected _getAutofocusZoomingDistance(boundingSphere: BoundingSphere, camera: ArcRotateCamera): number;
110
- }
1
+ import { AnimationGroup, ArcRotateCamera, BoundingSphere, ExcludedGeometryList, Vector3, Viewer } from '../index';
2
+ export declare type CameraPosition = {
3
+ alpha: number;
4
+ beta: number;
5
+ radius: number;
6
+ target: Vector3;
7
+ };
8
+ export declare type AutofocusSettings = {
9
+ /** Can be used to customize the margins shown around the 3d model. Defaults to 1. */
10
+ radiusFactor?: number;
11
+ adjustWheelPrecision?: boolean;
12
+ adjustPanningSensibility?: boolean;
13
+ adjustPinchPrecision?: boolean;
14
+ /** Desired horizontal camera angle, this won't be overwritten by the autofocus function */
15
+ alpha?: number;
16
+ /** Desired vertical camera angle, this won't be overwritten by the autofocus function */
17
+ beta?: number;
18
+ /** Optional list of geometry to be excluded from consideration */
19
+ exclude?: ExcludedGeometryList;
20
+ durationMs?: number;
21
+ };
22
+ export declare type ScreenshotSettings = {
23
+ /** Width of the final screenshot image, defaults to canvas width */
24
+ width?: number;
25
+ /** Height of the final screenshot image, defaults to canvas height */
26
+ height?: number;
27
+ /** Camera alpha angle used for the screenshot, defaults to alpha angle of currently active camera */
28
+ alpha?: number;
29
+ /** Camera beta angle used for the screenshot, defaults to beta angle of currently active camera */
30
+ beta?: number;
31
+ /**
32
+ * Camera radius used for the screenshot, default value depends on `autofocusScene` flag:
33
+ * - `true`: radius is calculated automatically so that the whole current scene content is visible
34
+ * - `false`: radius of currently active camera is used
35
+ */
36
+ radius?: number;
37
+ /**
38
+ * Camera target used for the screenshot, default value depends on `autofocusScene` flag:
39
+ * - `true`: center of the current scene content is set as camera target
40
+ * - `false`: target of currently active camera is used
41
+ */
42
+ target?: Vector3;
43
+ /** Used to scale the calculated radius if `radius` property is not set and `autofocusScene` mode is active */
44
+ radiusFactor?: number;
45
+ /** Can be used to automatically calculate camera `radius` and `target`, if these 2 settings are not defined
46
+ * explicitely */
47
+ autofocusScene?: boolean;
48
+ /** Optional list of geometry to be excluded from consideration */
49
+ exclude?: ExcludedGeometryList;
50
+ /**
51
+ * "MIME type" of the returned screenshot image, defaults to `image/png`
52
+ *
53
+ * **Info regarding JPEG:** \
54
+ * Use mimeType `image/jpeg` (**not** `image/jpg`) when creating jpeg's. \
55
+ * Also ensure that the viewer scenes `clearColor` has an alpha value of `1` as jpeg's don't
56
+ * support transparency. Otherwise background will always be black for jpeg's.
57
+ */
58
+ mimeType?: string;
59
+ /** If file name is given, the screenshot image will be downloaded and the base64 string will NOT be returned! */
60
+ fileName?: string;
61
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
62
+ samples?: number;
63
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
64
+ antialiasing?: boolean;
65
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
66
+ renderSprites?: boolean;
67
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
68
+ enableStencilBuffer?: boolean;
69
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
70
+ useLayerMask?: boolean;
71
+ /** Expert settings to tweak the screenshot image, see [Babylon.js](https://doc.babylonjs.com/typedoc/functions/BABYLON.CreateScreenshotUsingRenderTarget) docs for further information */
72
+ quality?: number;
73
+ };
74
+ /**
75
+ * Manager for camera related tasks
76
+ */
77
+ export declare class CameraManager {
78
+ protected viewer: Viewer;
79
+ static readonly CAMERA_ANIMATION_NAME = "__cameraAnimation__";
80
+ /** @internal */
81
+ static readonly DEFAULT_CAMERA_POSITION: CameraPosition;
82
+ protected static readonly _AUTOFOCUS_CONSTANTS: {
83
+ minZ: number;
84
+ wheelPrecision: number;
85
+ panningSensibility: number;
86
+ pinchPrecision: number;
87
+ };
88
+ protected static readonly _DEFAULT_AUTOFOCUS_RADIUS_FACTOR = 1;
89
+ protected static readonly _DEFAULT_CAM_SPEED_MS = 250;
90
+ protected static readonly _SCREENSHOT_CAMERA_NAME = "__screenshotCamera__";
91
+ /** @internal */
92
+ constructor(viewer: Viewer);
93
+ /**
94
+ * Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
95
+ */
96
+ autofocusActiveCamera(settings?: AutofocusSettings): Promise<void>;
97
+ /**
98
+ * Moves the active camera smoothly to certain position
99
+ *
100
+ * @param durationMs defaults to 250ms if unset, use 0 for instant movement
101
+ */
102
+ moveActiveCameraTo(position: CameraPosition, durationMs?: number): Promise<void>;
103
+ /**
104
+ * Takes a sceenshot the the current scene.\
105
+ * The result is a string containing a base64 encoded image.
106
+ */
107
+ createScreenshot(settings?: ScreenshotSettings): Promise<string>;
108
+ protected static _addCameraAnimationToGroup(targetProperty: string, from: number | Vector3, to: number | Vector3, framesPerSec: number, dataType: number, animationGroup: AnimationGroup, activeCamera: ArcRotateCamera): void;
109
+ protected _getAutofocusZoomingDistance(boundingSphere: BoundingSphere, camera: ArcRotateCamera): number;
110
+ }