@babylonjs/viewer 5.0.0 → 5.0.3

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 (127) hide show
  1. package/configuration/configuration.d.ts +107 -107
  2. package/configuration/configuration.js +15 -15
  3. package/configuration/configurationCompatibility.d.ts +8 -8
  4. package/configuration/configurationCompatibility.js +65 -65
  5. package/configuration/configurationContainer.d.ts +10 -10
  6. package/configuration/configurationContainer.js +9 -9
  7. package/configuration/globals.d.ts +6 -6
  8. package/configuration/globals.js +17 -17
  9. package/configuration/index.d.ts +2 -2
  10. package/configuration/index.js +3 -3
  11. package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
  12. package/configuration/interfaces/cameraConfiguration.js +1 -1
  13. package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
  14. package/configuration/interfaces/colorGradingConfiguration.js +1 -1
  15. package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
  16. package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
  17. package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
  18. package/configuration/interfaces/environmentMapConfiguration.js +1 -1
  19. package/configuration/interfaces/groundConfiguration.d.ts +24 -24
  20. package/configuration/interfaces/groundConfiguration.js +1 -1
  21. package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
  22. package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
  23. package/configuration/interfaces/index.d.ts +15 -15
  24. package/configuration/interfaces/index.js +15 -15
  25. package/configuration/interfaces/lightConfiguration.d.ts +60 -60
  26. package/configuration/interfaces/lightConfiguration.js +1 -1
  27. package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
  28. package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
  29. package/configuration/interfaces/modelConfiguration.d.ts +65 -65
  30. package/configuration/interfaces/modelConfiguration.js +1 -1
  31. package/configuration/interfaces/observersConfiguration.d.ts +5 -5
  32. package/configuration/interfaces/observersConfiguration.js +1 -1
  33. package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
  34. package/configuration/interfaces/sceneConfiguration.js +1 -1
  35. package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
  36. package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
  37. package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
  38. package/configuration/interfaces/skyboxConfiguration.js +1 -1
  39. package/configuration/interfaces/templateConfiguration.d.ts +67 -67
  40. package/configuration/interfaces/templateConfiguration.js +1 -1
  41. package/configuration/interfaces/vrConfiguration.d.ts +16 -16
  42. package/configuration/interfaces/vrConfiguration.js +1 -1
  43. package/configuration/loader.d.ts +4 -4
  44. package/configuration/loader.js +16 -16
  45. package/configuration/mappers.d.ts +42 -42
  46. package/configuration/mappers.js +190 -190
  47. package/configuration/renderOnlyLoader.d.ts +33 -33
  48. package/configuration/renderOnlyLoader.js +161 -161
  49. package/configuration/types/default.d.ts +6 -6
  50. package/configuration/types/default.js +120 -120
  51. package/configuration/types/environmentMap.d.ts +5 -5
  52. package/configuration/types/environmentMap.js +13 -13
  53. package/configuration/types/extended.d.ts +6 -6
  54. package/configuration/types/extended.js +316 -316
  55. package/configuration/types/index.d.ts +13 -13
  56. package/configuration/types/index.js +49 -49
  57. package/configuration/types/minimal.d.ts +6 -6
  58. package/configuration/types/minimal.js +42 -42
  59. package/configuration/types/renderOnlyDefault.d.ts +30 -30
  60. package/configuration/types/renderOnlyDefault.js +30 -30
  61. package/configuration/types/shadowLight.d.ts +9 -9
  62. package/configuration/types/shadowLight.js +63 -63
  63. package/helper/index.d.ts +26 -26
  64. package/helper/index.js +62 -62
  65. package/index.d.ts +30 -30
  66. package/index.js +45 -45
  67. package/initializer.d.ts +11 -11
  68. package/initializer.js +34 -34
  69. package/interfaces.d.ts +5 -5
  70. package/interfaces.js +1 -1
  71. package/labs/environmentSerializer.d.ts +126 -126
  72. package/labs/environmentSerializer.js +190 -190
  73. package/labs/texture.d.ts +183 -183
  74. package/labs/texture.js +300 -300
  75. package/labs/viewerLabs.d.ts +51 -51
  76. package/labs/viewerLabs.js +133 -133
  77. package/loader/modelLoader.d.ts +47 -47
  78. package/loader/modelLoader.js +189 -189
  79. package/loader/plugins/applyMaterialConfig.d.ts +12 -12
  80. package/loader/plugins/applyMaterialConfig.js +15 -15
  81. package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
  82. package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
  83. package/loader/plugins/index.d.ts +18 -18
  84. package/loader/plugins/index.js +42 -42
  85. package/loader/plugins/loaderPlugin.d.ts +24 -24
  86. package/loader/plugins/loaderPlugin.js +1 -1
  87. package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
  88. package/loader/plugins/msftLodLoaderPlugin.js +20 -20
  89. package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
  90. package/loader/plugins/telemetryLoaderPlugin.js +35 -35
  91. package/managers/observablesManager.d.ts +66 -66
  92. package/managers/observablesManager.js +34 -34
  93. package/managers/sceneManager.d.ts +243 -243
  94. package/managers/sceneManager.js +1388 -1388
  95. package/managers/telemetryManager.d.ts +57 -57
  96. package/managers/telemetryManager.js +113 -113
  97. package/model/modelAnimation.d.ts +215 -215
  98. package/model/modelAnimation.js +232 -232
  99. package/model/viewerModel.d.ts +228 -228
  100. package/model/viewerModel.js +669 -669
  101. package/optimizer/custom/extended.d.ts +11 -11
  102. package/optimizer/custom/extended.js +98 -98
  103. package/optimizer/custom/index.d.ts +8 -8
  104. package/optimizer/custom/index.js +24 -24
  105. package/package.json +5 -5
  106. package/renderOnlyIndex.d.ts +11 -11
  107. package/renderOnlyIndex.js +17 -17
  108. package/templating/eventManager.d.ts +35 -35
  109. package/templating/eventManager.js +65 -65
  110. package/templating/plugins/hdButtonPlugin.d.ts +9 -9
  111. package/templating/plugins/hdButtonPlugin.js +21 -21
  112. package/templating/plugins/printButton.d.ts +9 -9
  113. package/templating/plugins/printButton.js +40 -40
  114. package/templating/templateManager.d.ts +190 -190
  115. package/templating/templateManager.js +553 -553
  116. package/templating/viewerTemplatePlugin.d.ts +21 -21
  117. package/templating/viewerTemplatePlugin.js +68 -68
  118. package/viewer/defaultViewer.d.ts +122 -122
  119. package/viewer/defaultViewer.js +665 -665
  120. package/viewer/renderOnlyViewer.d.ts +8 -8
  121. package/viewer/renderOnlyViewer.js +43 -43
  122. package/viewer/viewer.d.ts +254 -254
  123. package/viewer/viewer.js +777 -777
  124. package/viewer/viewerManager.d.ts +55 -55
  125. package/viewer/viewerManager.js +87 -87
  126. package/viewer/viewerWithTemplate.d.ts +9 -9
  127. package/viewer/viewerWithTemplate.js +19 -19
@@ -1,8 +1,8 @@
1
- import type { ViewerConfiguration } from "../configuration/configuration";
2
- import { AbstractViewer } from "./viewer";
3
- export declare class RenderOnlyViewer extends AbstractViewer {
4
- containerElement: Element;
5
- constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
6
- initialize(): Promise<AbstractViewer | this>;
7
- protected _prepareContainerElement(): void;
8
- }
1
+ import type { ViewerConfiguration } from "../configuration/configuration";
2
+ import { AbstractViewer } from "./viewer";
3
+ export declare class RenderOnlyViewer extends AbstractViewer {
4
+ containerElement: Element;
5
+ constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
6
+ initialize(): Promise<AbstractViewer | this>;
7
+ protected _prepareContainerElement(): void;
8
+ }
@@ -1,44 +1,44 @@
1
- import { __extends } from "tslib";
2
- import { AbstractViewer } from "./viewer.js";
3
- var RenderOnlyViewer = /** @class */ (function (_super) {
4
- __extends(RenderOnlyViewer, _super);
5
- function RenderOnlyViewer(containerElement, initialConfiguration) {
6
- if (initialConfiguration === void 0) { initialConfiguration = {}; }
7
- var _this = _super.call(this, containerElement, initialConfiguration) || this;
8
- _this.containerElement = containerElement;
9
- _this._canvas = containerElement;
10
- return _this;
11
- }
12
- RenderOnlyViewer.prototype.initialize = function () {
13
- var _this = this;
14
- var autoLoad = typeof this.configuration.model === "string" || (this.configuration.model && this.configuration.model.url);
15
- return this._initEngine()
16
- .then(function (engine) {
17
- return _this.onEngineInitObservable.notifyObserversWithPromise(engine);
18
- })
19
- .then(function () {
20
- _this._initTelemetryEvents();
21
- if (autoLoad) {
22
- return _this.loadModel(_this.configuration.model)
23
- .catch(function () { })
24
- .then(function () {
25
- return _this.sceneManager.scene;
26
- });
27
- }
28
- else {
29
- return _this.sceneManager.scene || _this.sceneManager.initScene(_this.configuration.scene);
30
- }
31
- })
32
- .then(function () {
33
- return _this.onInitDoneObservable.notifyObserversWithPromise(_this);
34
- })
35
- .catch(function (e) {
36
- console.log(e.toString());
37
- return _this;
38
- });
39
- };
40
- RenderOnlyViewer.prototype._prepareContainerElement = function () { };
41
- return RenderOnlyViewer;
42
- }(AbstractViewer));
43
- export { RenderOnlyViewer };
1
+ import { __extends } from "tslib";
2
+ import { AbstractViewer } from "./viewer.js";
3
+ var RenderOnlyViewer = /** @class */ (function (_super) {
4
+ __extends(RenderOnlyViewer, _super);
5
+ function RenderOnlyViewer(containerElement, initialConfiguration) {
6
+ if (initialConfiguration === void 0) { initialConfiguration = {}; }
7
+ var _this = _super.call(this, containerElement, initialConfiguration) || this;
8
+ _this.containerElement = containerElement;
9
+ _this._canvas = containerElement;
10
+ return _this;
11
+ }
12
+ RenderOnlyViewer.prototype.initialize = function () {
13
+ var _this = this;
14
+ var autoLoad = typeof this.configuration.model === "string" || (this.configuration.model && this.configuration.model.url);
15
+ return this._initEngine()
16
+ .then(function (engine) {
17
+ return _this.onEngineInitObservable.notifyObserversWithPromise(engine);
18
+ })
19
+ .then(function () {
20
+ _this._initTelemetryEvents();
21
+ if (autoLoad) {
22
+ return _this.loadModel(_this.configuration.model)
23
+ .catch(function () { })
24
+ .then(function () {
25
+ return _this.sceneManager.scene;
26
+ });
27
+ }
28
+ else {
29
+ return _this.sceneManager.scene || _this.sceneManager.initScene(_this.configuration.scene);
30
+ }
31
+ })
32
+ .then(function () {
33
+ return _this.onInitDoneObservable.notifyObserversWithPromise(_this);
34
+ })
35
+ .catch(function (e) {
36
+ console.log(e.toString());
37
+ return _this;
38
+ });
39
+ };
40
+ RenderOnlyViewer.prototype._prepareContainerElement = function () { };
41
+ return RenderOnlyViewer;
42
+ }(AbstractViewer));
43
+ export { RenderOnlyViewer };
44
44
  //# sourceMappingURL=renderOnlyViewer.js.map
@@ -1,254 +1,254 @@
1
- import { Engine } from "@babylonjs/core/Engines/engine.js";
2
- import type { ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
3
- import type { Observable } from "@babylonjs/core/Misc/observable.js";
4
- import type { Scene } from "@babylonjs/core/scene.js";
5
- import { ConfigurationContainer } from "../configuration/configurationContainer";
6
- import { RenderOnlyConfigurationLoader } from "../configuration/renderOnlyLoader";
7
- import { ModelLoader } from "../loader/modelLoader";
8
- import { ObservablesManager } from "../managers/observablesManager";
9
- import { SceneManager } from "../managers/sceneManager";
10
- import type { ViewerModel } from "../model/viewerModel";
11
- import type { ViewerConfiguration } from "../configuration/configuration";
12
- import type { IObserversConfiguration } from "../configuration/interfaces/observersConfiguration";
13
- import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
14
- /**
15
- * The AbstractViewer is the center of Babylon's viewer.
16
- * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
17
- */
18
- export declare abstract class AbstractViewer {
19
- containerElement: Element;
20
- /**
21
- * Babylon Engine corresponding with this viewer
22
- */
23
- engine: Engine;
24
- /**
25
- * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
26
- */
27
- readonly baseId: string;
28
- /**
29
- * The last loader used to load a model.
30
- * @deprecated
31
- */
32
- lastUsedLoader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
33
- /**
34
- * The ModelLoader instance connected with this viewer.
35
- */
36
- modelLoader: ModelLoader;
37
- /**
38
- * A flag that controls whether or not the render loop should be executed
39
- */
40
- runRenderLoop: boolean;
41
- /**
42
- * The scene manager connected with this viewer instance
43
- */
44
- sceneManager: SceneManager;
45
- /**
46
- * Will notify when the scene was initialized
47
- */
48
- get onSceneInitObservable(): Observable<Scene>;
49
- /**
50
- * will notify when the engine was initialized
51
- */
52
- get onEngineInitObservable(): Observable<Engine>;
53
- /**
54
- * Will notify when a new model was added to the scene.
55
- * Note that added does not necessarily mean loaded!
56
- */
57
- get onModelAddedObservable(): Observable<ViewerModel>;
58
- /**
59
- * will notify after every model load
60
- */
61
- get onModelLoadedObservable(): Observable<ViewerModel>;
62
- /**
63
- * will notify when any model notify of progress
64
- */
65
- get onModelLoadProgressObservable(): Observable<ISceneLoaderProgressEvent>;
66
- /**
67
- * will notify when any model load failed.
68
- */
69
- get onModelLoadErrorObservable(): Observable<{
70
- message: string;
71
- exception: any;
72
- }>;
73
- /**
74
- * Will notify when a model was removed from the scene;
75
- */
76
- get onModelRemovedObservable(): Observable<ViewerModel>;
77
- /**
78
- * will notify when a new loader was initialized.
79
- * Used mainly to know when a model starts loading.
80
- */
81
- get onLoaderInitObservable(): Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
82
- /**
83
- * Observers registered here will be executed when the entire load process has finished.
84
- */
85
- get onInitDoneObservable(): Observable<AbstractViewer>;
86
- /**
87
- * Functions added to this observable will be executed on each frame rendered.
88
- */
89
- get onFrameRenderedObservable(): Observable<AbstractViewer>;
90
- /**
91
- * Observers registered here will be executed when VR more is entered.
92
- */
93
- get onEnteringVRObservable(): Observable<AbstractViewer>;
94
- /**
95
- * Observers registered here will be executed when VR mode is exited.
96
- */
97
- get onExitingVRObservable(): Observable<AbstractViewer>;
98
- observablesManager: ObservablesManager;
99
- /**
100
- * The canvas associated with this viewer
101
- */
102
- protected _canvas: HTMLCanvasElement;
103
- /**
104
- * The (single) canvas of this viewer
105
- */
106
- get canvas(): HTMLCanvasElement;
107
- /**
108
- * is this viewer disposed?
109
- */
110
- protected _isDisposed: boolean;
111
- /**
112
- * registered onBeforeRender functions.
113
- * This functions are also registered at the native scene. The reference can be used to unregister them.
114
- */
115
- protected _registeredOnBeforeRenderFunctions: Array<() => void>;
116
- /**
117
- * The configuration loader of this viewer
118
- */
119
- protected _configurationLoader: RenderOnlyConfigurationLoader;
120
- /**
121
- * Is the viewer already initialized. for internal use.
122
- */
123
- protected _isInit: boolean;
124
- protected _configurationContainer: ConfigurationContainer;
125
- get configurationContainer(): ConfigurationContainer;
126
- protected getConfigurationLoader(): RenderOnlyConfigurationLoader;
127
- constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
128
- /**
129
- * get the baseId of this viewer
130
- */
131
- getBaseId(): string;
132
- /**
133
- * Do we have a canvas to render on, and is it a part of the scene
134
- */
135
- isCanvasInDOM(): boolean;
136
- /**
137
- * Is the engine currently set to render even when the page is in background
138
- */
139
- get renderInBackground(): boolean;
140
- /**
141
- * Set the viewer's background rendering flag.
142
- */
143
- set renderInBackground(value: boolean);
144
- /**
145
- * Get the configuration object. This is a reference only.
146
- * The configuration can ONLY be updated using the updateConfiguration function.
147
- * changing this object will have no direct effect on the scene.
148
- */
149
- get configuration(): ViewerConfiguration;
150
- /**
151
- * force resizing the engine.
152
- */
153
- forceResize(): void;
154
- protected _hdToggled: boolean;
155
- toggleHD(): void;
156
- protected _vrToggled: boolean;
157
- private _vrModelRepositioning;
158
- protected _vrScale: number;
159
- protected _vrInit: boolean;
160
- toggleVR(): void;
161
- protected _initVR(): void;
162
- /**
163
- * The resize function that will be registered with the window object
164
- */
165
- protected _resize: () => void;
166
- protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
167
- /**
168
- * Force a single render loop execution.
169
- */
170
- forceRender(): void;
171
- /**
172
- * render loop that will be executed by the engine
173
- * @param force
174
- */
175
- protected _render: (force?: boolean) => void;
176
- /**
177
- * Takes a screenshot of the scene and returns it as a base64 encoded png.
178
- * @param callback optional callback that will be triggered when screenshot is done.
179
- * @param width Optional screenshot width (default to 512).
180
- * @param height Optional screenshot height (default to 512).
181
- * @returns a promise with the screenshot data
182
- */
183
- takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
184
- /**
185
- * Update the current viewer configuration with new values.
186
- * Only provided information will be updated, old configuration values will be kept.
187
- * If this.configuration was manually changed, you can trigger this function with no parameters,
188
- * and the entire configuration will be updated.
189
- * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
190
- *
191
- */
192
- updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
193
- /**
194
- * this is used to register native functions using the configuration object.
195
- * This will configure the observers.
196
- * @param observersConfiguration observers configuration
197
- */
198
- protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
199
- /**
200
- * Dispose the entire viewer including the scene and the engine
201
- */
202
- dispose(): void;
203
- /**
204
- * This will prepare the container element for the viewer
205
- */
206
- protected abstract _prepareContainerElement(): void;
207
- /**
208
- * This function will execute when the HTML templates finished initializing.
209
- * It should initialize the engine and continue execution.
210
- *
211
- * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
212
- */
213
- protected _onTemplatesLoaded(): Promise<AbstractViewer>;
214
- /**
215
- * This will force the creation of an engine and a scene.
216
- * It will also load a model if preconfigured.
217
- * But first - it will load the extendible onTemplateLoaded()!
218
- */
219
- protected _onTemplateLoaded(): Promise<AbstractViewer>;
220
- /**
221
- * Initialize the engine. Returns a promise in case async calls are needed.
222
- *
223
- * @protected
224
- * @returns {Promise<Engine>}
225
- * @memberof Viewer
226
- */
227
- protected _initEngine(): Promise<Engine>;
228
- private _isLoading;
229
- /**
230
- * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
231
- * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
232
- *
233
- * @param modelConfig model configuration to use when loading the model.
234
- * @param clearScene should the scene be cleared before loading this model
235
- * @returns a ViewerModel object that is not yet fully loaded.
236
- */
237
- initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
238
- /**
239
- * load a model using the provided configuration.
240
- * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
241
- * If you want to attach to the observables of the model, use initModel instead.
242
- *
243
- * @param modelConfig the model configuration or URL to load.
244
- * @param clearScene Should the scene be cleared before loading the model
245
- * @returns a Promise the fulfills when the model finished loading successfully.
246
- */
247
- loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
248
- private _fpsTimeoutInterval;
249
- protected _initTelemetryEvents(): void;
250
- /**
251
- * Injects all the spectre shader in the babylon shader store
252
- */
253
- protected _injectCustomShaders(): void;
254
- }
1
+ import { Engine } from "@babylonjs/core/Engines/engine.js";
2
+ import type { ISceneLoaderPlugin, ISceneLoaderPluginAsync, ISceneLoaderProgressEvent } from "@babylonjs/core/Loading/sceneLoader.js";
3
+ import type { Observable } from "@babylonjs/core/Misc/observable.js";
4
+ import type { Scene } from "@babylonjs/core/scene.js";
5
+ import { ConfigurationContainer } from "../configuration/configurationContainer";
6
+ import { RenderOnlyConfigurationLoader } from "../configuration/renderOnlyLoader";
7
+ import { ModelLoader } from "../loader/modelLoader";
8
+ import { ObservablesManager } from "../managers/observablesManager";
9
+ import { SceneManager } from "../managers/sceneManager";
10
+ import type { ViewerModel } from "../model/viewerModel";
11
+ import type { ViewerConfiguration } from "../configuration/configuration";
12
+ import type { IObserversConfiguration } from "../configuration/interfaces/observersConfiguration";
13
+ import type { IModelConfiguration } from "../configuration/interfaces/modelConfiguration";
14
+ /**
15
+ * The AbstractViewer is the center of Babylon's viewer.
16
+ * It is the basic implementation of the default viewer and is responsible of loading and showing the model and the templates
17
+ */
18
+ export declare abstract class AbstractViewer {
19
+ containerElement: Element;
20
+ /**
21
+ * Babylon Engine corresponding with this viewer
22
+ */
23
+ engine: Engine;
24
+ /**
25
+ * The ID of this viewer. it will be generated randomly or use the HTML Element's ID.
26
+ */
27
+ readonly baseId: string;
28
+ /**
29
+ * The last loader used to load a model.
30
+ * @deprecated
31
+ */
32
+ lastUsedLoader: ISceneLoaderPlugin | ISceneLoaderPluginAsync;
33
+ /**
34
+ * The ModelLoader instance connected with this viewer.
35
+ */
36
+ modelLoader: ModelLoader;
37
+ /**
38
+ * A flag that controls whether or not the render loop should be executed
39
+ */
40
+ runRenderLoop: boolean;
41
+ /**
42
+ * The scene manager connected with this viewer instance
43
+ */
44
+ sceneManager: SceneManager;
45
+ /**
46
+ * Will notify when the scene was initialized
47
+ */
48
+ get onSceneInitObservable(): Observable<Scene>;
49
+ /**
50
+ * will notify when the engine was initialized
51
+ */
52
+ get onEngineInitObservable(): Observable<Engine>;
53
+ /**
54
+ * Will notify when a new model was added to the scene.
55
+ * Note that added does not necessarily mean loaded!
56
+ */
57
+ get onModelAddedObservable(): Observable<ViewerModel>;
58
+ /**
59
+ * will notify after every model load
60
+ */
61
+ get onModelLoadedObservable(): Observable<ViewerModel>;
62
+ /**
63
+ * will notify when any model notify of progress
64
+ */
65
+ get onModelLoadProgressObservable(): Observable<ISceneLoaderProgressEvent>;
66
+ /**
67
+ * will notify when any model load failed.
68
+ */
69
+ get onModelLoadErrorObservable(): Observable<{
70
+ message: string;
71
+ exception: any;
72
+ }>;
73
+ /**
74
+ * Will notify when a model was removed from the scene;
75
+ */
76
+ get onModelRemovedObservable(): Observable<ViewerModel>;
77
+ /**
78
+ * will notify when a new loader was initialized.
79
+ * Used mainly to know when a model starts loading.
80
+ */
81
+ get onLoaderInitObservable(): Observable<ISceneLoaderPlugin | ISceneLoaderPluginAsync>;
82
+ /**
83
+ * Observers registered here will be executed when the entire load process has finished.
84
+ */
85
+ get onInitDoneObservable(): Observable<AbstractViewer>;
86
+ /**
87
+ * Functions added to this observable will be executed on each frame rendered.
88
+ */
89
+ get onFrameRenderedObservable(): Observable<AbstractViewer>;
90
+ /**
91
+ * Observers registered here will be executed when VR more is entered.
92
+ */
93
+ get onEnteringVRObservable(): Observable<AbstractViewer>;
94
+ /**
95
+ * Observers registered here will be executed when VR mode is exited.
96
+ */
97
+ get onExitingVRObservable(): Observable<AbstractViewer>;
98
+ observablesManager: ObservablesManager;
99
+ /**
100
+ * The canvas associated with this viewer
101
+ */
102
+ protected _canvas: HTMLCanvasElement;
103
+ /**
104
+ * The (single) canvas of this viewer
105
+ */
106
+ get canvas(): HTMLCanvasElement;
107
+ /**
108
+ * is this viewer disposed?
109
+ */
110
+ protected _isDisposed: boolean;
111
+ /**
112
+ * registered onBeforeRender functions.
113
+ * This functions are also registered at the native scene. The reference can be used to unregister them.
114
+ */
115
+ protected _registeredOnBeforeRenderFunctions: Array<() => void>;
116
+ /**
117
+ * The configuration loader of this viewer
118
+ */
119
+ protected _configurationLoader: RenderOnlyConfigurationLoader;
120
+ /**
121
+ * Is the viewer already initialized. for internal use.
122
+ */
123
+ protected _isInit: boolean;
124
+ protected _configurationContainer: ConfigurationContainer;
125
+ get configurationContainer(): ConfigurationContainer;
126
+ protected getConfigurationLoader(): RenderOnlyConfigurationLoader;
127
+ constructor(containerElement: Element, initialConfiguration?: ViewerConfiguration);
128
+ /**
129
+ * get the baseId of this viewer
130
+ */
131
+ getBaseId(): string;
132
+ /**
133
+ * Do we have a canvas to render on, and is it a part of the scene
134
+ */
135
+ isCanvasInDOM(): boolean;
136
+ /**
137
+ * Is the engine currently set to render even when the page is in background
138
+ */
139
+ get renderInBackground(): boolean;
140
+ /**
141
+ * Set the viewer's background rendering flag.
142
+ */
143
+ set renderInBackground(value: boolean);
144
+ /**
145
+ * Get the configuration object. This is a reference only.
146
+ * The configuration can ONLY be updated using the updateConfiguration function.
147
+ * changing this object will have no direct effect on the scene.
148
+ */
149
+ get configuration(): ViewerConfiguration;
150
+ /**
151
+ * force resizing the engine.
152
+ */
153
+ forceResize(): void;
154
+ protected _hdToggled: boolean;
155
+ toggleHD(): void;
156
+ protected _vrToggled: boolean;
157
+ private _vrModelRepositioning;
158
+ protected _vrScale: number;
159
+ protected _vrInit: boolean;
160
+ toggleVR(): void;
161
+ protected _initVR(): void;
162
+ /**
163
+ * The resize function that will be registered with the window object
164
+ */
165
+ protected _resize: () => void;
166
+ protected _onConfigurationLoaded(configuration: ViewerConfiguration): void;
167
+ /**
168
+ * Force a single render loop execution.
169
+ */
170
+ forceRender(): void;
171
+ /**
172
+ * render loop that will be executed by the engine
173
+ * @param force
174
+ */
175
+ protected _render: (force?: boolean) => void;
176
+ /**
177
+ * Takes a screenshot of the scene and returns it as a base64 encoded png.
178
+ * @param callback optional callback that will be triggered when screenshot is done.
179
+ * @param width Optional screenshot width (default to 512).
180
+ * @param height Optional screenshot height (default to 512).
181
+ * @returns a promise with the screenshot data
182
+ */
183
+ takeScreenshot(callback?: (data: string) => void, width?: number, height?: number): Promise<string>;
184
+ /**
185
+ * Update the current viewer configuration with new values.
186
+ * Only provided information will be updated, old configuration values will be kept.
187
+ * If this.configuration was manually changed, you can trigger this function with no parameters,
188
+ * and the entire configuration will be updated.
189
+ * @param newConfiguration the partial configuration to update or a URL to a JSON holding the updated configuration
190
+ *
191
+ */
192
+ updateConfiguration(newConfiguration?: Partial<ViewerConfiguration> | string): void;
193
+ /**
194
+ * this is used to register native functions using the configuration object.
195
+ * This will configure the observers.
196
+ * @param observersConfiguration observers configuration
197
+ */
198
+ protected _configureObservers(observersConfiguration: IObserversConfiguration): void;
199
+ /**
200
+ * Dispose the entire viewer including the scene and the engine
201
+ */
202
+ dispose(): void;
203
+ /**
204
+ * This will prepare the container element for the viewer
205
+ */
206
+ protected abstract _prepareContainerElement(): void;
207
+ /**
208
+ * This function will execute when the HTML templates finished initializing.
209
+ * It should initialize the engine and continue execution.
210
+ *
211
+ * @returns {Promise<AbstractViewer>} The viewer object will be returned after the object was loaded.
212
+ */
213
+ protected _onTemplatesLoaded(): Promise<AbstractViewer>;
214
+ /**
215
+ * This will force the creation of an engine and a scene.
216
+ * It will also load a model if preconfigured.
217
+ * But first - it will load the extendible onTemplateLoaded()!
218
+ */
219
+ protected _onTemplateLoaded(): Promise<AbstractViewer>;
220
+ /**
221
+ * Initialize the engine. Returns a promise in case async calls are needed.
222
+ *
223
+ * @protected
224
+ * @returns {Promise<Engine>}
225
+ * @memberof Viewer
226
+ */
227
+ protected _initEngine(): Promise<Engine>;
228
+ private _isLoading;
229
+ /**
230
+ * Initialize a model loading. The returned object (a ViewerModel object) will be loaded in the background.
231
+ * The difference between this and loadModel is that loadModel will fulfill the promise when the model finished loading.
232
+ *
233
+ * @param modelConfig model configuration to use when loading the model.
234
+ * @param clearScene should the scene be cleared before loading this model
235
+ * @returns a ViewerModel object that is not yet fully loaded.
236
+ */
237
+ initModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): ViewerModel;
238
+ /**
239
+ * load a model using the provided configuration.
240
+ * This function, as opposed to initModel, will return a promise that resolves when the model is loaded, and rejects with error.
241
+ * If you want to attach to the observables of the model, use initModel instead.
242
+ *
243
+ * @param modelConfig the model configuration or URL to load.
244
+ * @param clearScene Should the scene be cleared before loading the model
245
+ * @returns a Promise the fulfills when the model finished loading successfully.
246
+ */
247
+ loadModel(modelConfig: string | File | IModelConfiguration, clearScene?: boolean): Promise<ViewerModel>;
248
+ private _fpsTimeoutInterval;
249
+ protected _initTelemetryEvents(): void;
250
+ /**
251
+ * Injects all the spectre shader in the babylon shader store
252
+ */
253
+ protected _injectCustomShaders(): void;
254
+ }