@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.
- package/configuration/configuration.d.ts +107 -107
- package/configuration/configuration.js +15 -15
- package/configuration/configurationCompatibility.d.ts +8 -8
- package/configuration/configurationCompatibility.js +65 -65
- package/configuration/configurationContainer.d.ts +10 -10
- package/configuration/configurationContainer.js +9 -9
- package/configuration/globals.d.ts +6 -6
- package/configuration/globals.js +17 -17
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +3 -3
- package/configuration/interfaces/cameraConfiguration.d.ts +31 -31
- package/configuration/interfaces/cameraConfiguration.js +1 -1
- package/configuration/interfaces/colorGradingConfiguration.d.ts +81 -81
- package/configuration/interfaces/colorGradingConfiguration.js +1 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +20 -20
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js +1 -1
- package/configuration/interfaces/environmentMapConfiguration.d.ts +22 -22
- package/configuration/interfaces/environmentMapConfiguration.js +1 -1
- package/configuration/interfaces/groundConfiguration.d.ts +24 -24
- package/configuration/interfaces/groundConfiguration.js +1 -1
- package/configuration/interfaces/imageProcessingConfiguration.d.ts +43 -43
- package/configuration/interfaces/imageProcessingConfiguration.js +1 -1
- package/configuration/interfaces/index.d.ts +15 -15
- package/configuration/interfaces/index.js +15 -15
- package/configuration/interfaces/lightConfiguration.d.ts +60 -60
- package/configuration/interfaces/lightConfiguration.js +1 -1
- package/configuration/interfaces/modelAnimationConfiguration.d.ts +26 -26
- package/configuration/interfaces/modelAnimationConfiguration.js +1 -1
- package/configuration/interfaces/modelConfiguration.d.ts +65 -65
- package/configuration/interfaces/modelConfiguration.js +1 -1
- package/configuration/interfaces/observersConfiguration.d.ts +5 -5
- package/configuration/interfaces/observersConfiguration.js +1 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +48 -48
- package/configuration/interfaces/sceneConfiguration.js +1 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.d.ts +23 -23
- package/configuration/interfaces/sceneOptimizerConfiguration.js +1 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +21 -21
- package/configuration/interfaces/skyboxConfiguration.js +1 -1
- package/configuration/interfaces/templateConfiguration.d.ts +67 -67
- package/configuration/interfaces/templateConfiguration.js +1 -1
- package/configuration/interfaces/vrConfiguration.d.ts +16 -16
- package/configuration/interfaces/vrConfiguration.js +1 -1
- package/configuration/loader.d.ts +4 -4
- package/configuration/loader.js +16 -16
- package/configuration/mappers.d.ts +42 -42
- package/configuration/mappers.js +190 -190
- package/configuration/renderOnlyLoader.d.ts +33 -33
- package/configuration/renderOnlyLoader.js +161 -161
- package/configuration/types/default.d.ts +6 -6
- package/configuration/types/default.js +120 -120
- package/configuration/types/environmentMap.d.ts +5 -5
- package/configuration/types/environmentMap.js +13 -13
- package/configuration/types/extended.d.ts +6 -6
- package/configuration/types/extended.js +316 -316
- package/configuration/types/index.d.ts +13 -13
- package/configuration/types/index.js +49 -49
- package/configuration/types/minimal.d.ts +6 -6
- package/configuration/types/minimal.js +42 -42
- package/configuration/types/renderOnlyDefault.d.ts +30 -30
- package/configuration/types/renderOnlyDefault.js +30 -30
- package/configuration/types/shadowLight.d.ts +9 -9
- package/configuration/types/shadowLight.js +63 -63
- package/helper/index.d.ts +26 -26
- package/helper/index.js +62 -62
- package/index.d.ts +30 -30
- package/index.js +45 -45
- package/initializer.d.ts +11 -11
- package/initializer.js +34 -34
- package/interfaces.d.ts +5 -5
- package/interfaces.js +1 -1
- package/labs/environmentSerializer.d.ts +126 -126
- package/labs/environmentSerializer.js +190 -190
- package/labs/texture.d.ts +183 -183
- package/labs/texture.js +300 -300
- package/labs/viewerLabs.d.ts +51 -51
- package/labs/viewerLabs.js +133 -133
- package/loader/modelLoader.d.ts +47 -47
- package/loader/modelLoader.js +189 -189
- package/loader/plugins/applyMaterialConfig.d.ts +12 -12
- package/loader/plugins/applyMaterialConfig.js +15 -15
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +9 -9
- package/loader/plugins/extendedMaterialLoaderPlugin.js +15 -15
- package/loader/plugins/index.d.ts +18 -18
- package/loader/plugins/index.js +42 -42
- package/loader/plugins/loaderPlugin.d.ts +24 -24
- package/loader/plugins/loaderPlugin.js +1 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +12 -12
- package/loader/plugins/msftLodLoaderPlugin.js +20 -20
- package/loader/plugins/telemetryLoaderPlugin.d.ts +12 -12
- package/loader/plugins/telemetryLoaderPlugin.js +35 -35
- package/managers/observablesManager.d.ts +66 -66
- package/managers/observablesManager.js +34 -34
- package/managers/sceneManager.d.ts +243 -243
- package/managers/sceneManager.js +1388 -1388
- package/managers/telemetryManager.d.ts +57 -57
- package/managers/telemetryManager.js +113 -113
- package/model/modelAnimation.d.ts +215 -215
- package/model/modelAnimation.js +232 -232
- package/model/viewerModel.d.ts +228 -228
- package/model/viewerModel.js +669 -669
- package/optimizer/custom/extended.d.ts +11 -11
- package/optimizer/custom/extended.js +98 -98
- package/optimizer/custom/index.d.ts +8 -8
- package/optimizer/custom/index.js +24 -24
- package/package.json +5 -5
- package/renderOnlyIndex.d.ts +11 -11
- package/renderOnlyIndex.js +17 -17
- package/templating/eventManager.d.ts +35 -35
- package/templating/eventManager.js +65 -65
- package/templating/plugins/hdButtonPlugin.d.ts +9 -9
- package/templating/plugins/hdButtonPlugin.js +21 -21
- package/templating/plugins/printButton.d.ts +9 -9
- package/templating/plugins/printButton.js +40 -40
- package/templating/templateManager.d.ts +190 -190
- package/templating/templateManager.js +553 -553
- package/templating/viewerTemplatePlugin.d.ts +21 -21
- package/templating/viewerTemplatePlugin.js +68 -68
- package/viewer/defaultViewer.d.ts +122 -122
- package/viewer/defaultViewer.js +665 -665
- package/viewer/renderOnlyViewer.d.ts +8 -8
- package/viewer/renderOnlyViewer.js +43 -43
- package/viewer/viewer.d.ts +254 -254
- package/viewer/viewer.js +777 -777
- package/viewer/viewerManager.d.ts +55 -55
- package/viewer/viewerManager.js +87 -87
- package/viewer/viewerWithTemplate.d.ts +9 -9
- package/viewer/viewerWithTemplate.js +19 -19
|
@@ -1,243 +1,243 @@
|
|
|
1
|
-
import type { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ICameraConfiguration, ISkyboxConfiguration, IGroundConfiguration, IModelConfiguration, IVRConfiguration } from "../configuration/interfaces/index";
|
|
2
|
-
import type { ViewerConfiguration } from "../configuration/configuration";
|
|
3
|
-
import type { ViewerModel } from "../model/viewerModel";
|
|
4
|
-
import { ViewerLabs } from "../labs/viewerLabs";
|
|
5
|
-
import type { ObservablesManager } from "../managers/observablesManager";
|
|
6
|
-
import type { ConfigurationContainer } from "../configuration/configurationContainer";
|
|
7
|
-
import type { IEnvironmentMapConfiguration } from "../configuration/interfaces/environmentMapConfiguration";
|
|
8
|
-
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
9
|
-
import { SceneOptimizer } from "@babylonjs/core/Misc/sceneOptimizer.js";
|
|
10
|
-
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera.js";
|
|
11
|
-
import { Light } from "@babylonjs/core/Lights/light.js";
|
|
12
|
-
import { EnvironmentHelper } from "@babylonjs/core/Helpers/environmentHelper.js";
|
|
13
|
-
import type { VRExperienceHelper } from "@babylonjs/core/Cameras/VR/vrExperienceHelper.js";
|
|
14
|
-
import { Color3 } from "@babylonjs/core/Maths/math.js";
|
|
15
|
-
import type { Nullable } from "@babylonjs/core/types.js";
|
|
16
|
-
import { DefaultRenderingPipeline } from "@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js";
|
|
17
|
-
import type { Engine } from "@babylonjs/core/Engines/engine.js";
|
|
18
|
-
import type { IShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
|
|
19
|
-
import { Scene } from "@babylonjs/core/scene.js";
|
|
20
|
-
import "@babylonjs/core/Audio/audioSceneComponent.js";
|
|
21
|
-
import "@babylonjs/core/Helpers/sceneHelpers.js";
|
|
22
|
-
/**
|
|
23
|
-
* This interface describes the structure of the variable sent with the configuration observables of the scene manager.
|
|
24
|
-
* O - the type of object we are dealing with (Light, ArcRotateCamera, Scene, etc')
|
|
25
|
-
* T - the configuration type
|
|
26
|
-
*/
|
|
27
|
-
export interface IPostConfigurationCallback<OBJ, CONF> {
|
|
28
|
-
newConfiguration: CONF;
|
|
29
|
-
sceneManager: SceneManager;
|
|
30
|
-
object: OBJ;
|
|
31
|
-
model?: ViewerModel;
|
|
32
|
-
}
|
|
33
|
-
export declare class SceneManager {
|
|
34
|
-
private _engine;
|
|
35
|
-
private _configurationContainer;
|
|
36
|
-
private _observablesManager?;
|
|
37
|
-
/**
|
|
38
|
-
* Will notify when the scene was initialized
|
|
39
|
-
*/
|
|
40
|
-
onSceneInitObservable: Observable<Scene>;
|
|
41
|
-
/**
|
|
42
|
-
* Will notify after the scene was configured. Can be used to further configure the scene
|
|
43
|
-
*/
|
|
44
|
-
onSceneConfiguredObservable: Observable<IPostConfigurationCallback<Scene, ISceneConfiguration>>;
|
|
45
|
-
/**
|
|
46
|
-
* Will notify after the scene optimized was configured. Can be used to further configure the scene optimizer
|
|
47
|
-
*/
|
|
48
|
-
onSceneOptimizerConfiguredObservable: Observable<IPostConfigurationCallback<SceneOptimizer, ISceneOptimizerConfiguration | boolean>>;
|
|
49
|
-
/**
|
|
50
|
-
* Will notify after the camera was configured. Can be used to further configure the camera
|
|
51
|
-
*/
|
|
52
|
-
onCameraConfiguredObservable: Observable<IPostConfigurationCallback<ArcRotateCamera, ICameraConfiguration>>;
|
|
53
|
-
/**
|
|
54
|
-
* Will notify after the lights were configured. Can be used to further configure lights
|
|
55
|
-
*/
|
|
56
|
-
onLightsConfiguredObservable: Observable<IPostConfigurationCallback<Array<Light>, {
|
|
57
|
-
[name: string]: ILightConfiguration | boolean | number;
|
|
58
|
-
}>>;
|
|
59
|
-
/**
|
|
60
|
-
* Will notify after the model(s) were configured. Can be used to further configure models
|
|
61
|
-
*/
|
|
62
|
-
onModelsConfiguredObservable: Observable<IPostConfigurationCallback<Array<ViewerModel>, IModelConfiguration>>;
|
|
63
|
-
/**
|
|
64
|
-
* Will notify after the environment was configured. Can be used to further configure the environment
|
|
65
|
-
*/
|
|
66
|
-
onEnvironmentConfiguredObservable: Observable<IPostConfigurationCallback<EnvironmentHelper, {
|
|
67
|
-
skybox?: ISkyboxConfiguration | boolean;
|
|
68
|
-
ground?: IGroundConfiguration | boolean;
|
|
69
|
-
}>>;
|
|
70
|
-
/**
|
|
71
|
-
* Will notify after the model(s) were configured. Can be used to further configure models
|
|
72
|
-
*/
|
|
73
|
-
onVRConfiguredObservable: Observable<IPostConfigurationCallback<VRExperienceHelper, IVRConfiguration>>;
|
|
74
|
-
/**
|
|
75
|
-
* The Babylon Scene of this viewer
|
|
76
|
-
*/
|
|
77
|
-
scene: Scene;
|
|
78
|
-
/**
|
|
79
|
-
* The camera used in this viewer
|
|
80
|
-
*/
|
|
81
|
-
camera: ArcRotateCamera;
|
|
82
|
-
/**
|
|
83
|
-
* Babylon's scene optimizer
|
|
84
|
-
*/
|
|
85
|
-
sceneOptimizer?: SceneOptimizer;
|
|
86
|
-
/**
|
|
87
|
-
* Models displayed in this viewer.
|
|
88
|
-
*/
|
|
89
|
-
models: Array<ViewerModel>;
|
|
90
|
-
/**
|
|
91
|
-
* Babylon's environment helper of this viewer
|
|
92
|
-
*/
|
|
93
|
-
environmentHelper?: EnvironmentHelper;
|
|
94
|
-
protected _defaultHighpTextureType: number;
|
|
95
|
-
protected _shadowGeneratorBias: number;
|
|
96
|
-
protected _defaultPipelineTextureType: number;
|
|
97
|
-
/**
|
|
98
|
-
* The maximum number of shadows supported by the current viewer
|
|
99
|
-
*/
|
|
100
|
-
protected _maxShadows: number;
|
|
101
|
-
/**
|
|
102
|
-
* is HDR supported?
|
|
103
|
-
*/
|
|
104
|
-
private _hdrSupport;
|
|
105
|
-
private readonly _white;
|
|
106
|
-
private _forceShadowUpdate;
|
|
107
|
-
/**
|
|
108
|
-
* The labs variable consists of objects that will have their API change.
|
|
109
|
-
* Please be careful when using labs in production.
|
|
110
|
-
*/
|
|
111
|
-
labs: ViewerLabs;
|
|
112
|
-
private _defaultRenderingPipeline;
|
|
113
|
-
private _assetsRootURL;
|
|
114
|
-
get defaultRenderingPipeline(): Nullable<DefaultRenderingPipeline>;
|
|
115
|
-
protected _vrHelper?: VRExperienceHelper;
|
|
116
|
-
get vrHelper(): VRExperienceHelper | undefined;
|
|
117
|
-
constructor(_engine: Engine, _configurationContainer: ConfigurationContainer, _observablesManager?: ObservablesManager | undefined);
|
|
118
|
-
/**
|
|
119
|
-
* Returns a boolean representing HDR support
|
|
120
|
-
*/
|
|
121
|
-
get isHdrSupported(): boolean;
|
|
122
|
-
/**
|
|
123
|
-
* Return the main color defined in the configuration.
|
|
124
|
-
*/
|
|
125
|
-
get mainColor(): Color3;
|
|
126
|
-
get reflectionColor(): Color3;
|
|
127
|
-
get animationBlendingEnabled(): boolean;
|
|
128
|
-
set animationBlendingEnabled(value: boolean);
|
|
129
|
-
get observablesManager(): ObservablesManager | undefined;
|
|
130
|
-
private _processShadows;
|
|
131
|
-
/**
|
|
132
|
-
* The flag defining whether shadows are rendered constantly or once.
|
|
133
|
-
*/
|
|
134
|
-
get processShadows(): boolean;
|
|
135
|
-
/**
|
|
136
|
-
* Should shadows be rendered every frame, or only once and stop.
|
|
137
|
-
* This can be used to optimize a scene.
|
|
138
|
-
*
|
|
139
|
-
* Not that the shadows will NOT disapear but will remain in place.
|
|
140
|
-
* @param process if true shadows will be updated once every frame. if false they will stop being updated.
|
|
141
|
-
*/
|
|
142
|
-
set processShadows(process: boolean);
|
|
143
|
-
private _groundEnabled;
|
|
144
|
-
get groundEnabled(): boolean;
|
|
145
|
-
set groundEnabled(newValue: boolean);
|
|
146
|
-
private _groundMirrorEnabled;
|
|
147
|
-
/**
|
|
148
|
-
* gets whether the reflection is disabled.
|
|
149
|
-
*/
|
|
150
|
-
get groundMirrorEnabled(): boolean;
|
|
151
|
-
/**
|
|
152
|
-
* sets whether the reflection is disabled.
|
|
153
|
-
*/
|
|
154
|
-
set groundMirrorEnabled(value: boolean);
|
|
155
|
-
private _defaultRenderingPipelineEnabled;
|
|
156
|
-
get defaultRenderingPipelineEnabled(): boolean;
|
|
157
|
-
set defaultRenderingPipelineEnabled(value: boolean);
|
|
158
|
-
/**
|
|
159
|
-
* Sets the engine flags to unlock all babylon features.
|
|
160
|
-
* Can also be configured using the scene.flags configuration object
|
|
161
|
-
*/
|
|
162
|
-
unlockBabylonFeatures(): void;
|
|
163
|
-
/**
|
|
164
|
-
* initialize the scene. Calling this function again will dispose the old scene, if exists.
|
|
165
|
-
* @param sceneConfiguration
|
|
166
|
-
*/
|
|
167
|
-
initScene(sceneConfiguration?: ISceneConfiguration): Promise<Scene>;
|
|
168
|
-
clearScene(clearModels?: boolean, clearLights?: boolean): void;
|
|
169
|
-
private _globalConfiguration;
|
|
170
|
-
/**
|
|
171
|
-
* This will update the scene's configuration, including camera, lights, environment.
|
|
172
|
-
* @param newConfiguration the delta that should be configured. This includes only the changes
|
|
173
|
-
*/
|
|
174
|
-
updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
|
|
175
|
-
private _defaultRenderingPipelineShouldBuild;
|
|
176
|
-
private _rebuildPostprocesses;
|
|
177
|
-
private _bloomEnabled;
|
|
178
|
-
get bloomEnabled(): boolean;
|
|
179
|
-
set bloomEnabled(value: boolean);
|
|
180
|
-
private _fxaaEnabled;
|
|
181
|
-
get fxaaEnabled(): boolean;
|
|
182
|
-
set fxaaEnabled(value: boolean);
|
|
183
|
-
setDefaultMaterial(sceneConfig: ISceneConfiguration): void;
|
|
184
|
-
/**
|
|
185
|
-
* internally configure the scene using the provided configuration.
|
|
186
|
-
* The scene will not be recreated, but just updated.
|
|
187
|
-
* @param sceneConfig the (new) scene configuration
|
|
188
|
-
*/
|
|
189
|
-
protected _configureScene(sceneConfig: ISceneConfiguration): void;
|
|
190
|
-
/**
|
|
191
|
-
* Configure the scene optimizer.
|
|
192
|
-
* The existing scene optimizer will be disposed and a new one will be created.
|
|
193
|
-
* @param optimizerConfig the (new) optimizer configuration
|
|
194
|
-
*/
|
|
195
|
-
protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
|
|
196
|
-
/**
|
|
197
|
-
* configure all models using the configuration.
|
|
198
|
-
* @param modelConfiguration the configuration to use to reconfigure the models
|
|
199
|
-
*/
|
|
200
|
-
protected _configureVR(vrConfig: IVRConfiguration): void;
|
|
201
|
-
protected _configureEnvironmentMap(environmentMapConfiguration: IEnvironmentMapConfiguration): any;
|
|
202
|
-
/**
|
|
203
|
-
* (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
|
|
204
|
-
* @param cameraConfig the new camera configuration
|
|
205
|
-
*/
|
|
206
|
-
protected _configureCamera(cameraConfig?: ICameraConfiguration): void;
|
|
207
|
-
private _focusOnModel;
|
|
208
|
-
protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
|
|
209
|
-
/**
|
|
210
|
-
* configure the lights.
|
|
211
|
-
* @param lightsConfiguration the (new) light(s) configuration
|
|
212
|
-
*/
|
|
213
|
-
protected _configureLights(lightsConfiguration?: {
|
|
214
|
-
[name: string]: ILightConfiguration | boolean | number;
|
|
215
|
-
}): void;
|
|
216
|
-
private _shadowGroundPlane;
|
|
217
|
-
private _updateShadowRenderList;
|
|
218
|
-
private _updateGroundMirrorRenderList;
|
|
219
|
-
/**
|
|
220
|
-
* Gets the shadow map blur kernel according to the light configuration.
|
|
221
|
-
* @param light The light used to generate the shadows
|
|
222
|
-
* @param bufferSize The size of the shadow map
|
|
223
|
-
* @return the kernel blur size
|
|
224
|
-
*/
|
|
225
|
-
getBlurKernel(light: IShadowLight, bufferSize: number): number;
|
|
226
|
-
/**
|
|
227
|
-
* Alters render settings to reduce features based on hardware feature limitations
|
|
228
|
-
* @param enableHDR Allows the viewer to run in HDR mode.
|
|
229
|
-
*/
|
|
230
|
-
protected _handleHardwareLimitations(enableHDR?: boolean): void;
|
|
231
|
-
/**
|
|
232
|
-
* Dispose the entire viewer including the scene and the engine
|
|
233
|
-
*/
|
|
234
|
-
dispose(): void;
|
|
235
|
-
/**
|
|
236
|
-
* Get an environment asset url by using the configuration if the path is not absolute.
|
|
237
|
-
* @param url Asset url
|
|
238
|
-
* @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
|
|
239
|
-
*/
|
|
240
|
-
private _getAssetUrl;
|
|
241
|
-
private _cameraBehaviorMapping;
|
|
242
|
-
private _setCameraBehavior;
|
|
243
|
-
}
|
|
1
|
+
import type { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ICameraConfiguration, ISkyboxConfiguration, IGroundConfiguration, IModelConfiguration, IVRConfiguration } from "../configuration/interfaces/index";
|
|
2
|
+
import type { ViewerConfiguration } from "../configuration/configuration";
|
|
3
|
+
import type { ViewerModel } from "../model/viewerModel";
|
|
4
|
+
import { ViewerLabs } from "../labs/viewerLabs";
|
|
5
|
+
import type { ObservablesManager } from "../managers/observablesManager";
|
|
6
|
+
import type { ConfigurationContainer } from "../configuration/configurationContainer";
|
|
7
|
+
import type { IEnvironmentMapConfiguration } from "../configuration/interfaces/environmentMapConfiguration";
|
|
8
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
9
|
+
import { SceneOptimizer } from "@babylonjs/core/Misc/sceneOptimizer.js";
|
|
10
|
+
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera.js";
|
|
11
|
+
import { Light } from "@babylonjs/core/Lights/light.js";
|
|
12
|
+
import { EnvironmentHelper } from "@babylonjs/core/Helpers/environmentHelper.js";
|
|
13
|
+
import type { VRExperienceHelper } from "@babylonjs/core/Cameras/VR/vrExperienceHelper.js";
|
|
14
|
+
import { Color3 } from "@babylonjs/core/Maths/math.js";
|
|
15
|
+
import type { Nullable } from "@babylonjs/core/types.js";
|
|
16
|
+
import { DefaultRenderingPipeline } from "@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js";
|
|
17
|
+
import type { Engine } from "@babylonjs/core/Engines/engine.js";
|
|
18
|
+
import type { IShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
|
|
19
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
20
|
+
import "@babylonjs/core/Audio/audioSceneComponent.js";
|
|
21
|
+
import "@babylonjs/core/Helpers/sceneHelpers.js";
|
|
22
|
+
/**
|
|
23
|
+
* This interface describes the structure of the variable sent with the configuration observables of the scene manager.
|
|
24
|
+
* O - the type of object we are dealing with (Light, ArcRotateCamera, Scene, etc')
|
|
25
|
+
* T - the configuration type
|
|
26
|
+
*/
|
|
27
|
+
export interface IPostConfigurationCallback<OBJ, CONF> {
|
|
28
|
+
newConfiguration: CONF;
|
|
29
|
+
sceneManager: SceneManager;
|
|
30
|
+
object: OBJ;
|
|
31
|
+
model?: ViewerModel;
|
|
32
|
+
}
|
|
33
|
+
export declare class SceneManager {
|
|
34
|
+
private _engine;
|
|
35
|
+
private _configurationContainer;
|
|
36
|
+
private _observablesManager?;
|
|
37
|
+
/**
|
|
38
|
+
* Will notify when the scene was initialized
|
|
39
|
+
*/
|
|
40
|
+
onSceneInitObservable: Observable<Scene>;
|
|
41
|
+
/**
|
|
42
|
+
* Will notify after the scene was configured. Can be used to further configure the scene
|
|
43
|
+
*/
|
|
44
|
+
onSceneConfiguredObservable: Observable<IPostConfigurationCallback<Scene, ISceneConfiguration>>;
|
|
45
|
+
/**
|
|
46
|
+
* Will notify after the scene optimized was configured. Can be used to further configure the scene optimizer
|
|
47
|
+
*/
|
|
48
|
+
onSceneOptimizerConfiguredObservable: Observable<IPostConfigurationCallback<SceneOptimizer, ISceneOptimizerConfiguration | boolean>>;
|
|
49
|
+
/**
|
|
50
|
+
* Will notify after the camera was configured. Can be used to further configure the camera
|
|
51
|
+
*/
|
|
52
|
+
onCameraConfiguredObservable: Observable<IPostConfigurationCallback<ArcRotateCamera, ICameraConfiguration>>;
|
|
53
|
+
/**
|
|
54
|
+
* Will notify after the lights were configured. Can be used to further configure lights
|
|
55
|
+
*/
|
|
56
|
+
onLightsConfiguredObservable: Observable<IPostConfigurationCallback<Array<Light>, {
|
|
57
|
+
[name: string]: ILightConfiguration | boolean | number;
|
|
58
|
+
}>>;
|
|
59
|
+
/**
|
|
60
|
+
* Will notify after the model(s) were configured. Can be used to further configure models
|
|
61
|
+
*/
|
|
62
|
+
onModelsConfiguredObservable: Observable<IPostConfigurationCallback<Array<ViewerModel>, IModelConfiguration>>;
|
|
63
|
+
/**
|
|
64
|
+
* Will notify after the environment was configured. Can be used to further configure the environment
|
|
65
|
+
*/
|
|
66
|
+
onEnvironmentConfiguredObservable: Observable<IPostConfigurationCallback<EnvironmentHelper, {
|
|
67
|
+
skybox?: ISkyboxConfiguration | boolean;
|
|
68
|
+
ground?: IGroundConfiguration | boolean;
|
|
69
|
+
}>>;
|
|
70
|
+
/**
|
|
71
|
+
* Will notify after the model(s) were configured. Can be used to further configure models
|
|
72
|
+
*/
|
|
73
|
+
onVRConfiguredObservable: Observable<IPostConfigurationCallback<VRExperienceHelper, IVRConfiguration>>;
|
|
74
|
+
/**
|
|
75
|
+
* The Babylon Scene of this viewer
|
|
76
|
+
*/
|
|
77
|
+
scene: Scene;
|
|
78
|
+
/**
|
|
79
|
+
* The camera used in this viewer
|
|
80
|
+
*/
|
|
81
|
+
camera: ArcRotateCamera;
|
|
82
|
+
/**
|
|
83
|
+
* Babylon's scene optimizer
|
|
84
|
+
*/
|
|
85
|
+
sceneOptimizer?: SceneOptimizer;
|
|
86
|
+
/**
|
|
87
|
+
* Models displayed in this viewer.
|
|
88
|
+
*/
|
|
89
|
+
models: Array<ViewerModel>;
|
|
90
|
+
/**
|
|
91
|
+
* Babylon's environment helper of this viewer
|
|
92
|
+
*/
|
|
93
|
+
environmentHelper?: EnvironmentHelper;
|
|
94
|
+
protected _defaultHighpTextureType: number;
|
|
95
|
+
protected _shadowGeneratorBias: number;
|
|
96
|
+
protected _defaultPipelineTextureType: number;
|
|
97
|
+
/**
|
|
98
|
+
* The maximum number of shadows supported by the current viewer
|
|
99
|
+
*/
|
|
100
|
+
protected _maxShadows: number;
|
|
101
|
+
/**
|
|
102
|
+
* is HDR supported?
|
|
103
|
+
*/
|
|
104
|
+
private _hdrSupport;
|
|
105
|
+
private readonly _white;
|
|
106
|
+
private _forceShadowUpdate;
|
|
107
|
+
/**
|
|
108
|
+
* The labs variable consists of objects that will have their API change.
|
|
109
|
+
* Please be careful when using labs in production.
|
|
110
|
+
*/
|
|
111
|
+
labs: ViewerLabs;
|
|
112
|
+
private _defaultRenderingPipeline;
|
|
113
|
+
private _assetsRootURL;
|
|
114
|
+
get defaultRenderingPipeline(): Nullable<DefaultRenderingPipeline>;
|
|
115
|
+
protected _vrHelper?: VRExperienceHelper;
|
|
116
|
+
get vrHelper(): VRExperienceHelper | undefined;
|
|
117
|
+
constructor(_engine: Engine, _configurationContainer: ConfigurationContainer, _observablesManager?: ObservablesManager | undefined);
|
|
118
|
+
/**
|
|
119
|
+
* Returns a boolean representing HDR support
|
|
120
|
+
*/
|
|
121
|
+
get isHdrSupported(): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Return the main color defined in the configuration.
|
|
124
|
+
*/
|
|
125
|
+
get mainColor(): Color3;
|
|
126
|
+
get reflectionColor(): Color3;
|
|
127
|
+
get animationBlendingEnabled(): boolean;
|
|
128
|
+
set animationBlendingEnabled(value: boolean);
|
|
129
|
+
get observablesManager(): ObservablesManager | undefined;
|
|
130
|
+
private _processShadows;
|
|
131
|
+
/**
|
|
132
|
+
* The flag defining whether shadows are rendered constantly or once.
|
|
133
|
+
*/
|
|
134
|
+
get processShadows(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Should shadows be rendered every frame, or only once and stop.
|
|
137
|
+
* This can be used to optimize a scene.
|
|
138
|
+
*
|
|
139
|
+
* Not that the shadows will NOT disapear but will remain in place.
|
|
140
|
+
* @param process if true shadows will be updated once every frame. if false they will stop being updated.
|
|
141
|
+
*/
|
|
142
|
+
set processShadows(process: boolean);
|
|
143
|
+
private _groundEnabled;
|
|
144
|
+
get groundEnabled(): boolean;
|
|
145
|
+
set groundEnabled(newValue: boolean);
|
|
146
|
+
private _groundMirrorEnabled;
|
|
147
|
+
/**
|
|
148
|
+
* gets whether the reflection is disabled.
|
|
149
|
+
*/
|
|
150
|
+
get groundMirrorEnabled(): boolean;
|
|
151
|
+
/**
|
|
152
|
+
* sets whether the reflection is disabled.
|
|
153
|
+
*/
|
|
154
|
+
set groundMirrorEnabled(value: boolean);
|
|
155
|
+
private _defaultRenderingPipelineEnabled;
|
|
156
|
+
get defaultRenderingPipelineEnabled(): boolean;
|
|
157
|
+
set defaultRenderingPipelineEnabled(value: boolean);
|
|
158
|
+
/**
|
|
159
|
+
* Sets the engine flags to unlock all babylon features.
|
|
160
|
+
* Can also be configured using the scene.flags configuration object
|
|
161
|
+
*/
|
|
162
|
+
unlockBabylonFeatures(): void;
|
|
163
|
+
/**
|
|
164
|
+
* initialize the scene. Calling this function again will dispose the old scene, if exists.
|
|
165
|
+
* @param sceneConfiguration
|
|
166
|
+
*/
|
|
167
|
+
initScene(sceneConfiguration?: ISceneConfiguration): Promise<Scene>;
|
|
168
|
+
clearScene(clearModels?: boolean, clearLights?: boolean): void;
|
|
169
|
+
private _globalConfiguration;
|
|
170
|
+
/**
|
|
171
|
+
* This will update the scene's configuration, including camera, lights, environment.
|
|
172
|
+
* @param newConfiguration the delta that should be configured. This includes only the changes
|
|
173
|
+
*/
|
|
174
|
+
updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
|
|
175
|
+
private _defaultRenderingPipelineShouldBuild;
|
|
176
|
+
private _rebuildPostprocesses;
|
|
177
|
+
private _bloomEnabled;
|
|
178
|
+
get bloomEnabled(): boolean;
|
|
179
|
+
set bloomEnabled(value: boolean);
|
|
180
|
+
private _fxaaEnabled;
|
|
181
|
+
get fxaaEnabled(): boolean;
|
|
182
|
+
set fxaaEnabled(value: boolean);
|
|
183
|
+
setDefaultMaterial(sceneConfig: ISceneConfiguration): void;
|
|
184
|
+
/**
|
|
185
|
+
* internally configure the scene using the provided configuration.
|
|
186
|
+
* The scene will not be recreated, but just updated.
|
|
187
|
+
* @param sceneConfig the (new) scene configuration
|
|
188
|
+
*/
|
|
189
|
+
protected _configureScene(sceneConfig: ISceneConfiguration): void;
|
|
190
|
+
/**
|
|
191
|
+
* Configure the scene optimizer.
|
|
192
|
+
* The existing scene optimizer will be disposed and a new one will be created.
|
|
193
|
+
* @param optimizerConfig the (new) optimizer configuration
|
|
194
|
+
*/
|
|
195
|
+
protected _configureOptimizer(optimizerConfig: ISceneOptimizerConfiguration | boolean): void;
|
|
196
|
+
/**
|
|
197
|
+
* configure all models using the configuration.
|
|
198
|
+
* @param modelConfiguration the configuration to use to reconfigure the models
|
|
199
|
+
*/
|
|
200
|
+
protected _configureVR(vrConfig: IVRConfiguration): void;
|
|
201
|
+
protected _configureEnvironmentMap(environmentMapConfiguration: IEnvironmentMapConfiguration): any;
|
|
202
|
+
/**
|
|
203
|
+
* (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
|
|
204
|
+
* @param cameraConfig the new camera configuration
|
|
205
|
+
*/
|
|
206
|
+
protected _configureCamera(cameraConfig?: ICameraConfiguration): void;
|
|
207
|
+
private _focusOnModel;
|
|
208
|
+
protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
|
|
209
|
+
/**
|
|
210
|
+
* configure the lights.
|
|
211
|
+
* @param lightsConfiguration the (new) light(s) configuration
|
|
212
|
+
*/
|
|
213
|
+
protected _configureLights(lightsConfiguration?: {
|
|
214
|
+
[name: string]: ILightConfiguration | boolean | number;
|
|
215
|
+
}): void;
|
|
216
|
+
private _shadowGroundPlane;
|
|
217
|
+
private _updateShadowRenderList;
|
|
218
|
+
private _updateGroundMirrorRenderList;
|
|
219
|
+
/**
|
|
220
|
+
* Gets the shadow map blur kernel according to the light configuration.
|
|
221
|
+
* @param light The light used to generate the shadows
|
|
222
|
+
* @param bufferSize The size of the shadow map
|
|
223
|
+
* @return the kernel blur size
|
|
224
|
+
*/
|
|
225
|
+
getBlurKernel(light: IShadowLight, bufferSize: number): number;
|
|
226
|
+
/**
|
|
227
|
+
* Alters render settings to reduce features based on hardware feature limitations
|
|
228
|
+
* @param enableHDR Allows the viewer to run in HDR mode.
|
|
229
|
+
*/
|
|
230
|
+
protected _handleHardwareLimitations(enableHDR?: boolean): void;
|
|
231
|
+
/**
|
|
232
|
+
* Dispose the entire viewer including the scene and the engine
|
|
233
|
+
*/
|
|
234
|
+
dispose(): void;
|
|
235
|
+
/**
|
|
236
|
+
* Get an environment asset url by using the configuration if the path is not absolute.
|
|
237
|
+
* @param url Asset url
|
|
238
|
+
* @returns The Asset url using the `environmentAssetsRootURL` if the url is not an absolute path.
|
|
239
|
+
*/
|
|
240
|
+
private _getAssetUrl;
|
|
241
|
+
private _cameraBehaviorMapping;
|
|
242
|
+
private _setCameraBehavior;
|
|
243
|
+
}
|