@combeenation/3d-viewer 5.0.1 → 5.0.3-beta2

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 (109) hide show
  1. package/README.md +111 -114
  2. package/dist/lib-cjs/api/classes/animationInterface.d.ts +8 -8
  3. package/dist/lib-cjs/api/classes/animationInterface.js +1 -1
  4. package/dist/lib-cjs/api/classes/dottedPath.d.ts +79 -79
  5. package/dist/lib-cjs/api/classes/dottedPath.js +187 -187
  6. package/dist/lib-cjs/api/classes/element.d.ts +139 -139
  7. package/dist/lib-cjs/api/classes/element.js +794 -794
  8. package/dist/lib-cjs/api/classes/element.js.map +1 -1
  9. package/dist/lib-cjs/api/classes/elementParameterizable.d.ts +14 -0
  10. package/dist/lib-cjs/api/classes/elementParameterizable.js +135 -0
  11. package/dist/lib-cjs/api/classes/elementParameterizable.js.map +1 -0
  12. package/dist/lib-cjs/api/classes/event.d.ts +326 -326
  13. package/dist/lib-cjs/api/classes/event.js +371 -371
  14. package/dist/lib-cjs/api/classes/eventBroadcaster.d.ts +26 -26
  15. package/dist/lib-cjs/api/classes/eventBroadcaster.js +53 -53
  16. package/dist/lib-cjs/api/classes/parameter.d.ts +316 -259
  17. package/dist/lib-cjs/api/classes/parameter.js +451 -388
  18. package/dist/lib-cjs/api/classes/parameter.js.map +1 -1
  19. package/dist/lib-cjs/api/classes/parameterObservable.d.ts +36 -36
  20. package/dist/lib-cjs/api/classes/parameterObservable.js +101 -101
  21. package/dist/lib-cjs/api/classes/parameterizable.d.ts +15 -15
  22. package/dist/lib-cjs/api/classes/parameterizable.js +149 -149
  23. package/dist/lib-cjs/api/classes/placementAnimation.d.ts +44 -44
  24. package/dist/lib-cjs/api/classes/placementAnimation.js +163 -163
  25. package/dist/lib-cjs/api/classes/variant.d.ts +234 -234
  26. package/dist/lib-cjs/api/classes/variant.js +1154 -1154
  27. package/dist/lib-cjs/api/classes/variantInstance.d.ts +45 -45
  28. package/dist/lib-cjs/api/classes/variantInstance.js +108 -108
  29. package/dist/lib-cjs/api/classes/variantParameterizable.d.ts +17 -17
  30. package/dist/lib-cjs/api/classes/variantParameterizable.js +99 -99
  31. package/dist/lib-cjs/api/classes/viewer.d.ts +177 -175
  32. package/dist/lib-cjs/api/classes/viewer.js +717 -701
  33. package/dist/lib-cjs/api/classes/viewer.js.map +1 -1
  34. package/dist/lib-cjs/api/classes/viewerLight.d.ts +66 -66
  35. package/dist/lib-cjs/api/classes/viewerLight.js +392 -392
  36. package/dist/lib-cjs/api/internal/debugViewer.d.ts +13 -13
  37. package/dist/lib-cjs/api/internal/debugViewer.js +86 -86
  38. package/dist/lib-cjs/api/internal/lensRendering.d.ts +8 -8
  39. package/dist/lib-cjs/api/internal/lensRendering.js +11 -11
  40. package/dist/lib-cjs/api/internal/sceneSetup.d.ts +13 -10
  41. package/dist/lib-cjs/api/internal/sceneSetup.js +238 -234
  42. package/dist/lib-cjs/api/internal/sceneSetup.js.map +1 -1
  43. package/dist/lib-cjs/api/manager/animationManager.d.ts +29 -29
  44. package/dist/lib-cjs/api/manager/animationManager.js +130 -130
  45. package/dist/lib-cjs/api/manager/gltfExportManager.d.ts +65 -65
  46. package/dist/lib-cjs/api/manager/gltfExportManager.js +223 -222
  47. package/dist/lib-cjs/api/manager/gltfExportManager.js.map +1 -1
  48. package/dist/lib-cjs/api/manager/sceneManager.d.ts +31 -32
  49. package/dist/lib-cjs/api/manager/sceneManager.js +153 -132
  50. package/dist/lib-cjs/api/manager/sceneManager.js.map +1 -1
  51. package/dist/lib-cjs/api/manager/variantInstanceManager.d.ts +92 -92
  52. package/dist/lib-cjs/api/manager/variantInstanceManager.js +335 -335
  53. package/dist/lib-cjs/api/store/specStorage.d.ts +24 -24
  54. package/dist/lib-cjs/api/store/specStorage.js +51 -51
  55. package/dist/lib-cjs/api/util/babylonHelper.d.ts +174 -166
  56. package/dist/lib-cjs/api/util/babylonHelper.js +575 -497
  57. package/dist/lib-cjs/api/util/babylonHelper.js.map +1 -1
  58. package/dist/lib-cjs/api/util/globalTypes.d.ts +366 -356
  59. package/dist/lib-cjs/api/util/globalTypes.js +1 -1
  60. package/dist/lib-cjs/api/util/resourceHelper.d.ts +58 -53
  61. package/dist/lib-cjs/api/util/resourceHelper.js +257 -242
  62. package/dist/lib-cjs/api/util/resourceHelper.js.map +1 -1
  63. package/dist/lib-cjs/api/util/stringHelper.d.ts +9 -9
  64. package/dist/lib-cjs/api/util/stringHelper.js +25 -25
  65. package/dist/lib-cjs/api/util/structureHelper.d.ts +9 -9
  66. package/dist/lib-cjs/api/util/structureHelper.js +48 -44
  67. package/dist/lib-cjs/api/util/structureHelper.js.map +1 -1
  68. package/dist/lib-cjs/buildinfo.json +3 -3
  69. package/dist/lib-cjs/index.d.ts +49 -49
  70. package/dist/lib-cjs/index.js +89 -89
  71. package/dist/webpack-stats.json +0 -0
  72. package/package.json +87 -87
  73. package/src/api/classes/animationInterface.ts +10 -10
  74. package/src/api/classes/dottedPath.ts +181 -181
  75. package/src/api/classes/element.ts +690 -692
  76. package/src/api/classes/event.ts +367 -367
  77. package/src/api/classes/eventBroadcaster.ts +52 -52
  78. package/src/api/classes/parameter.ts +474 -405
  79. package/src/api/classes/parameterObservable.ts +100 -100
  80. package/src/api/classes/parameterizable.ts +87 -87
  81. package/src/api/classes/placementAnimation.ts +160 -160
  82. package/src/api/classes/variant.ts +845 -845
  83. package/src/api/classes/variantInstance.ts +97 -97
  84. package/src/api/classes/variantParameterizable.ts +85 -85
  85. package/src/api/classes/viewer.ts +650 -624
  86. package/src/api/classes/viewerLight.ts +334 -334
  87. package/src/api/internal/debugViewer.ts +90 -90
  88. package/src/api/internal/lensRendering.ts +10 -10
  89. package/src/api/internal/sceneSetup.ts +204 -201
  90. package/src/api/manager/animationManager.ts +142 -142
  91. package/src/api/manager/gltfExportManager.ts +191 -191
  92. package/src/api/manager/sceneManager.ts +128 -102
  93. package/src/api/manager/variantInstanceManager.ts +265 -265
  94. package/src/api/store/specStorage.ts +51 -51
  95. package/src/api/util/babylonHelper.ts +628 -538
  96. package/src/api/util/globalTypes.ts +413 -402
  97. package/src/api/util/resourceHelper.ts +189 -173
  98. package/src/api/util/stringHelper.ts +23 -23
  99. package/src/api/util/structureHelper.ts +49 -43
  100. package/src/buildinfo.json +3 -3
  101. package/src/commonjs.tsconfig.json +10 -10
  102. package/src/declaration.tsconfig.json +8 -8
  103. package/src/dev.ts +42 -42
  104. package/src/es6.tsconfig.json +10 -10
  105. package/src/index.ts +94 -94
  106. package/src/pagesconfig.json +77 -73
  107. package/src/tsconfig.json +32 -32
  108. package/src/tsconfig.types.json +9 -9
  109. package/src/types.d.ts +3 -3
@@ -1,175 +1,177 @@
1
- import { Engine } from '@babylonjs/core/Engines/engine';
2
- import { Mesh } from '@babylonjs/core/Meshes/mesh';
3
- import { Scene } from '@babylonjs/core/scene';
4
- import { AnimationManager } from '../manager/animationManager';
5
- import { GltfExportManager } from '../manager/gltfExportManager';
6
- import { SceneManager } from '../manager/sceneManager';
7
- import { VariantInstanceManager } from '../manager/variantInstanceManager';
8
- import { EventBroadcaster } from './eventBroadcaster';
9
- import { VariantInstance } from './variantInstance';
10
- /**
11
- * The main exposed object. This is the entry point into the application
12
- *
13
- * ```js
14
- * const canvas = document.getElementById( 'babylon-canvas' );
15
- * const viewer = Viewer( canvas, '/path/to/index.json' );
16
- * ```
17
- * The class does nothing on its own and needs to {@link bootstrap}
18
- */
19
- export declare class Viewer extends EventBroadcaster {
20
- readonly canvas: HTMLCanvasElement;
21
- protected structureJson: string | StructureJson;
22
- protected _scene: Scene | null;
23
- protected _animationManager: AnimationManager | null;
24
- protected _sceneManager: SceneManager | null;
25
- protected _gltfExportManager: GltfExportManager | null;
26
- protected _variantInstances: VariantInstanceManager | null;
27
- protected _cloneMaterialsOnMutation: boolean;
28
- protected _isRenderLoopPaused: boolean;
29
- static version: string;
30
- /**
31
- * Constructor
32
- */
33
- constructor(canvas: HTMLCanvasElement, structureJson: string | StructureJson);
34
- /**
35
- * Gets the BabylonJS Scene that is attached to the instance.
36
- *
37
- * @throws Error if the `scene` has not been initialized.
38
- */
39
- get scene(): Scene;
40
- /**
41
- * Gets the {@link SceneManager} attached to the viewer.
42
- *
43
- * @throws Error if the {@link SceneManager} has not been initialized.
44
- */
45
- get sceneManager(): SceneManager;
46
- /**
47
- * Gets the {@link GltfExportManager} attached to the viewer.
48
- *
49
- * @throws Error if the {@link GltfExportManager} has not been initialized.
50
- */
51
- get gltfExportManager(): GltfExportManager;
52
- /**
53
- * Gets the BabylonJS Engine that is attached to the viewer.
54
- */
55
- get engine(): Engine;
56
- /**
57
- * Gets the {@link VariantInstanceManager} attached to the viewer.
58
- *
59
- * @throws Error if the {@link VariantInstanceManager} has not been initialized.
60
- */
61
- get variantInstances(): VariantInstanceManager;
62
- /**
63
- * Gets the {@link AnimationManager} attached to the viewer.
64
- *
65
- * @throws Error if the {@link AnimationManager} has not been initialized.
66
- */
67
- get animationManager(): AnimationManager;
68
- /**
69
- * Gets the `cloneMaterialsOnMutation` flag, as defined in the spec
70
- */
71
- get cloneMaterialsOnMutation(): boolean;
72
- /**
73
- * Starts the application. This will
74
- * * load the given "index" JSON file
75
- * * setup the scene with the "scene" JSON file
76
- * * create an (optional) default setup with different variant settings
77
- * * sets up resizing by attaching a debounced version of {@link resize}
78
- *
79
- * @throws Error if any of the files is not found/valid
80
- *
81
- * @emits {@link Event.BOOTSTRAP_START}
82
- * @emits {@link Event.BOOTSTRAP_END}
83
- */
84
- bootstrap(): Promise<Viewer>;
85
- /**
86
- * Enables the BabylonJS [Inspector](https://doc.babylonjs.com/toolsAndResources/tools/inspector).\
87
- * Due to the enormous additional package size of the inspector, this feature is only available in development builds.
88
- */
89
- enableDebugLayer(options?: IInspectorOptions): Promise<void>;
90
- /**
91
- * Destroys all registered {@link VariantInstance}s that are registered
92
- */
93
- destroyVariantInstances(): Viewer;
94
- /**
95
- * Trigger a resize event for the `Engine`
96
- */
97
- resize(): Viewer;
98
- /**
99
- * A convenience method for directly getting a Node from a {@link VariantInstance} and an {@link Element} by its
100
- * {@link DottedPath}s.
101
- */
102
- getNode(variantInstanceName: string, elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
103
- /**
104
- * A convenience method for directly getting a Node from a {@link VariantInstance} and an {@link Element} by its
105
- * {@link DottedPath}s.
106
- */
107
- getMesh(variantInstanceName: string, elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
108
- /**
109
- * Switches the camera
110
- *
111
- * @emits {@link Event.CAMERA_SWITCHED}
112
- */
113
- switchCamera(newCamera: string, reset?: boolean): Viewer;
114
- /**
115
- * Moves or animates the active camera to given `placement`.
116
- */
117
- moveActiveCameraTo(placement: string | PlacementDefinition, animation?: string | AnimationDefinition): Promise<AnimationInterface>;
118
- /**
119
- * Takes a sceenshot the the current scene. The result is a string containing a base64 encoded image
120
- */
121
- screenshot(settings?: ScreenshotSettings): Promise<string>;
122
- /**
123
- * Checks whether the browser is capable of handling XR.
124
- */
125
- isBrowserARCapable(): Promise<boolean>;
126
- /**
127
- * Calculates the bounding box from all visible meshes on the scene.
128
- */
129
- calculateBoundingBox(excludeGeometry?: ExcludedGeometry): Promise<Mesh>;
130
- /**
131
- * Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
132
- */
133
- autofocusActiveCamera(settings?: AutofocusSettings): Promise<void>;
134
- /**
135
- * Resets everything by calling {@link destroy} to clear all references and {@link bootstrap} to setup a clean
136
- * environment
137
- */
138
- reset(): Promise<Viewer>;
139
- /**
140
- * Destroys
141
- *
142
- * * all {@link VariantInstance}s using {@link destroyVariantInstances}
143
- * * calling `dispose` on the `Engine` and `Scene`
144
- */
145
- destroy(): Viewer;
146
- /**
147
- * Show coordinate system with given dimension (for debugging purpose).
148
- */
149
- showWorldCoordinates(dimension: number): void;
150
- /**
151
- * Pause render loop.
152
- */
153
- pauseRendering(): void;
154
- /**
155
- * Resume render loop when paused.
156
- */
157
- resumeRendering(): void;
158
- /**
159
- * @emits {@link Event.SCENE_PROCESSING_START}
160
- * @emits {@link Event.SCENE_PROCESSING_END}
161
- */
162
- protected initScene(): Promise<Scene>;
163
- /**
164
- * Batch creation of multiple {@link VariantInstance} objects with a {@link SetupJson} object passed
165
- */
166
- protected createVariantInstances(): Promise<VariantInstance[]>;
167
- /**
168
- * Help function for focusing a helper camera exactly onto the given bounding box
169
- */
170
- private getFocusedHelperCamera;
171
- /**
172
- * Help function for applying the relevant data of the focused helper camera to the real camera
173
- */
174
- private applyFocusedHelperCameraData;
175
- }
1
+ import { Engine } from '@babylonjs/core/Engines/engine';
2
+ import { Mesh } from '@babylonjs/core/Meshes/mesh';
3
+ import { Scene } from '@babylonjs/core/scene';
4
+ import { AnimationManager } from '../manager/animationManager';
5
+ import { GltfExportManager } from '../manager/gltfExportManager';
6
+ import { SceneManager } from '../manager/sceneManager';
7
+ import { VariantInstanceManager } from '../manager/variantInstanceManager';
8
+ import { EventBroadcaster } from './eventBroadcaster';
9
+ import { VariantInstance } from './variantInstance';
10
+ /**
11
+ * The main exposed object. This is the entry point into the application
12
+ *
13
+ * ```js
14
+ * const canvas = document.getElementById( 'babylon-canvas' );
15
+ * const viewer = Viewer( canvas, '/path/to/index.json' );
16
+ * ```
17
+ * The class does nothing on its own and needs to {@link bootstrap}
18
+ */
19
+ export declare class Viewer extends EventBroadcaster {
20
+ readonly canvas: HTMLCanvasElement;
21
+ protected structureJson: string | StructureJson;
22
+ protected _scene: Scene | null;
23
+ protected _animationManager: AnimationManager | null;
24
+ protected _sceneManager: SceneManager | null;
25
+ protected _gltfExportManager: GltfExportManager | null;
26
+ protected _variantInstances: VariantInstanceManager | null;
27
+ protected _cloneMaterialsOnMutation: boolean;
28
+ protected _isRenderLoopPaused: boolean;
29
+ protected _inspectorLoaded: boolean;
30
+ static version: string;
31
+ /**
32
+ * Constructor
33
+ */
34
+ constructor(canvas: HTMLCanvasElement, structureJson: string | StructureJson);
35
+ /**
36
+ * Gets the BabylonJS Scene that is attached to the instance.
37
+ *
38
+ * @throws Error if the `scene` has not been initialized.
39
+ */
40
+ get scene(): Scene;
41
+ /**
42
+ * Gets the {@link SceneManager} attached to the viewer.
43
+ *
44
+ * @throws Error if the {@link SceneManager} has not been initialized.
45
+ */
46
+ get sceneManager(): SceneManager;
47
+ /**
48
+ * Gets the {@link GltfExportManager} attached to the viewer.
49
+ *
50
+ * @throws Error if the {@link GltfExportManager} has not been initialized.
51
+ */
52
+ get gltfExportManager(): GltfExportManager;
53
+ /**
54
+ * Gets the BabylonJS Engine that is attached to the viewer.
55
+ */
56
+ get engine(): Engine;
57
+ /**
58
+ * Gets the {@link VariantInstanceManager} attached to the viewer.
59
+ *
60
+ * @throws Error if the {@link VariantInstanceManager} has not been initialized.
61
+ */
62
+ get variantInstances(): VariantInstanceManager;
63
+ /**
64
+ * Gets the {@link AnimationManager} attached to the viewer.
65
+ *
66
+ * @throws Error if the {@link AnimationManager} has not been initialized.
67
+ */
68
+ get animationManager(): AnimationManager;
69
+ /**
70
+ * Gets the `cloneMaterialsOnMutation` flag, as defined in the spec
71
+ */
72
+ get cloneMaterialsOnMutation(): boolean;
73
+ /**
74
+ * Starts the application. This will
75
+ * * load the given "index" JSON file
76
+ * * setup the scene with the "scene" JSON file
77
+ * * create an (optional) default setup with different variant settings
78
+ * * sets up resizing by attaching a debounced version of {@link resize}
79
+ *
80
+ * @throws Error if any of the files is not found/valid
81
+ *
82
+ * @emits {@link Event.BOOTSTRAP_START}
83
+ * @emits {@link Event.BOOTSTRAP_END}
84
+ */
85
+ bootstrap(): Promise<Viewer>;
86
+ /**
87
+ * Enables the BabylonJS [Inspector](https://doc.babylonjs.com/toolsAndResources/tools/inspector).\
88
+ * Due to the additional size of the inspector, the CDN version is used instead of shipping the required code with the viewer.\
89
+ * This means that the code will be downloaded only when needed and calling `enableDebugLayer` can take a little while depending on your internet connection etc.
90
+ */
91
+ enableDebugLayer(options?: IInspectorOptions): Promise<void>;
92
+ /**
93
+ * Destroys all registered {@link VariantInstance}s that are registered
94
+ */
95
+ destroyVariantInstances(): Viewer;
96
+ /**
97
+ * Trigger a resize event for the `Engine`
98
+ */
99
+ resize(): Viewer;
100
+ /**
101
+ * A convenience method for directly getting a Node from a {@link VariantInstance} and an {@link Element} by its
102
+ * {@link DottedPath}s.
103
+ */
104
+ getNode(variantInstanceName: string, elementDottedPath: DottedPathArgument, nodeDottedPath: DottedPathArgument): Promise<TransformNode>;
105
+ /**
106
+ * A convenience method for directly getting a Node from a {@link VariantInstance} and an {@link Element} by its
107
+ * {@link DottedPath}s.
108
+ */
109
+ getMesh(variantInstanceName: string, elementDottedPath: DottedPathArgument, meshDottedPath: DottedPathArgument): Promise<Mesh | null>;
110
+ /**
111
+ * Switches the camera
112
+ *
113
+ * @emits {@link Event.CAMERA_SWITCHED}
114
+ */
115
+ switchCamera(newCamera: string, reset?: boolean): Viewer;
116
+ /**
117
+ * Moves or animates the active camera to given `placement`.
118
+ */
119
+ moveActiveCameraTo(placement: string | PlacementDefinition, animation?: string | AnimationDefinition): Promise<AnimationInterface>;
120
+ /**
121
+ * Takes a sceenshot the the current scene. The result is a string containing a base64 encoded image
122
+ */
123
+ screenshot(settings?: ScreenshotSettings): Promise<string>;
124
+ /**
125
+ * Checks whether the browser is capable of handling XR.
126
+ */
127
+ isBrowserARCapable(): Promise<boolean>;
128
+ /**
129
+ * Calculates the bounding box from all visible meshes on the scene.
130
+ */
131
+ calculateBoundingBox(excludeGeometry?: ExcludedGeometryList): Promise<Mesh>;
132
+ /**
133
+ * Focuses the camera to see every visible mesh in scene and tries to optimize wheel precision and panning
134
+ */
135
+ autofocusActiveCamera(settings?: AutofocusSettings): Promise<void>;
136
+ /**
137
+ * Resets everything by calling {@link destroy} to clear all references and {@link bootstrap} to setup a clean
138
+ * environment
139
+ */
140
+ reset(): Promise<Viewer>;
141
+ /**
142
+ * Destroys
143
+ *
144
+ * * all {@link VariantInstance}s using {@link destroyVariantInstances}
145
+ * * calling `dispose` on the `Engine` and `Scene`
146
+ */
147
+ destroy(): Viewer;
148
+ /**
149
+ * Show coordinate system with given dimension (for debugging purpose).
150
+ */
151
+ showWorldCoordinates(dimension: number): void;
152
+ /**
153
+ * Pause render loop.
154
+ */
155
+ pauseRendering(): void;
156
+ /**
157
+ * Resume render loop when paused.
158
+ */
159
+ resumeRendering(): void;
160
+ /**
161
+ * @emits {@link Event.SCENE_PROCESSING_START}
162
+ * @emits {@link Event.SCENE_PROCESSING_END}
163
+ */
164
+ protected initScene(): Promise<Scene>;
165
+ /**
166
+ * Batch creation of multiple {@link VariantInstance} objects with a {@link SetupJson} object passed
167
+ */
168
+ protected createVariantInstances(): Promise<VariantInstance[]>;
169
+ /**
170
+ * Help function for focusing a helper camera exactly onto the given bounding box
171
+ */
172
+ private getFocusedHelperCamera;
173
+ /**
174
+ * Help function for applying the relevant data of the focused helper camera to the real camera
175
+ */
176
+ private applyFocusedHelperCameraData;
177
+ }