@babylonjs/viewer 5.0.0-rc.4 → 5.0.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.
- package/configuration/configuration.d.ts +13 -13
- package/configuration/configuration.js +1 -1
- package/configuration/configuration.js.map +1 -1
- package/configuration/configurationCompatibility.d.ts +1 -1
- package/configuration/configurationCompatibility.js +2 -2
- package/configuration/configurationCompatibility.js.map +1 -1
- package/configuration/configurationContainer.d.ts +3 -3
- package/configuration/configurationContainer.js +1 -1
- package/configuration/configurationContainer.js.map +1 -1
- package/configuration/globals.d.ts +1 -1
- package/configuration/globals.js.map +1 -1
- package/configuration/index.d.ts +2 -2
- package/configuration/index.js +3 -2
- package/configuration/index.js.map +1 -1
- package/configuration/interfaces/cameraConfiguration.js.map +1 -1
- package/configuration/interfaces/colorGradingConfiguration.js.map +1 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.d.ts +1 -1
- package/configuration/interfaces/defaultRenderingPipelineConfiguration.js.map +1 -1
- package/configuration/interfaces/environmentMapConfiguration.js.map +1 -1
- package/configuration/interfaces/groundConfiguration.js.map +1 -1
- package/configuration/interfaces/imageProcessingConfiguration.js.map +1 -1
- package/configuration/interfaces/index.d.ts +15 -15
- package/configuration/interfaces/index.js +15 -15
- package/configuration/interfaces/index.js.map +1 -1
- package/configuration/interfaces/lightConfiguration.js.map +1 -1
- package/configuration/interfaces/modelAnimationConfiguration.js.map +1 -1
- package/configuration/interfaces/modelConfiguration.d.ts +1 -1
- package/configuration/interfaces/modelConfiguration.js.map +1 -1
- package/configuration/interfaces/observersConfiguration.js.map +1 -1
- package/configuration/interfaces/sceneConfiguration.d.ts +3 -3
- package/configuration/interfaces/sceneConfiguration.js.map +1 -1
- package/configuration/interfaces/sceneOptimizerConfiguration.js.map +1 -1
- package/configuration/interfaces/skyboxConfiguration.d.ts +1 -1
- package/configuration/interfaces/skyboxConfiguration.js.map +1 -1
- package/configuration/interfaces/templateConfiguration.js.map +1 -1
- package/configuration/interfaces/vrConfiguration.d.ts +1 -1
- package/configuration/interfaces/vrConfiguration.js.map +1 -1
- package/configuration/loader.js +3 -15
- package/configuration/loader.js.map +1 -1
- package/configuration/mappers.d.ts +3 -3
- package/configuration/mappers.js +13 -12
- package/configuration/mappers.js.map +1 -1
- package/configuration/renderOnlyLoader.d.ts +1 -1
- package/configuration/renderOnlyLoader.js +18 -15
- package/configuration/renderOnlyLoader.js.map +1 -1
- package/configuration/types/default.d.ts +2 -2
- package/configuration/types/default.js +37 -36
- package/configuration/types/default.js.map +1 -1
- package/configuration/types/environmentMap.d.ts +1 -1
- package/configuration/types/environmentMap.js +5 -5
- package/configuration/types/environmentMap.js.map +1 -1
- package/configuration/types/extended.d.ts +2 -2
- package/configuration/types/extended.js +49 -49
- package/configuration/types/extended.js.map +1 -1
- package/configuration/types/index.d.ts +4 -4
- package/configuration/types/index.js +14 -13
- package/configuration/types/index.js.map +1 -1
- package/configuration/types/minimal.d.ts +2 -2
- package/configuration/types/minimal.js +12 -12
- package/configuration/types/minimal.js.map +1 -1
- package/configuration/types/renderOnlyDefault.d.ts +1 -1
- package/configuration/types/renderOnlyDefault.js +8 -8
- package/configuration/types/renderOnlyDefault.js.map +1 -1
- package/configuration/types/shadowLight.d.ts +1 -1
- package/configuration/types/shadowLight.js +12 -12
- package/configuration/types/shadowLight.js.map +1 -1
- package/helper/index.d.ts +3 -3
- package/helper/index.js +14 -8
- package/helper/index.js.map +1 -1
- package/index.d.ts +20 -20
- package/index.js +22 -18
- package/index.js.map +1 -1
- package/initializer.js +8 -7
- package/initializer.js.map +1 -1
- package/interfaces.js.map +1 -1
- package/labs/environmentSerializer.d.ts +6 -6
- package/labs/environmentSerializer.js +18 -14
- package/labs/environmentSerializer.js.map +1 -1
- package/labs/texture.d.ts +7 -8
- package/labs/texture.js +30 -27
- package/labs/texture.js.map +1 -1
- package/labs/viewerLabs.d.ts +11 -11
- package/labs/viewerLabs.js +9 -7
- package/labs/viewerLabs.js.map +1 -1
- package/license.md +71 -0
- package/loader/modelLoader.d.ts +10 -7
- package/loader/modelLoader.js +26 -19
- package/loader/modelLoader.js.map +1 -1
- package/loader/plugins/applyMaterialConfig.d.ts +4 -4
- package/loader/plugins/applyMaterialConfig.js.map +1 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.d.ts +2 -2
- package/loader/plugins/extendedMaterialLoaderPlugin.js +1 -1
- package/loader/plugins/extendedMaterialLoaderPlugin.js.map +1 -1
- package/loader/plugins/index.d.ts +5 -4
- package/loader/plugins/index.js +9 -8
- package/loader/plugins/index.js.map +1 -1
- package/loader/plugins/loaderPlugin.d.ts +7 -7
- package/loader/plugins/loaderPlugin.js.map +1 -1
- package/loader/plugins/msftLodLoaderPlugin.d.ts +5 -5
- package/loader/plugins/msftLodLoaderPlugin.js +2 -1
- package/loader/plugins/msftLodLoaderPlugin.js.map +1 -1
- package/loader/plugins/telemetryLoaderPlugin.d.ts +4 -4
- package/loader/plugins/telemetryLoaderPlugin.js +4 -4
- package/loader/plugins/telemetryLoaderPlugin.js.map +1 -1
- package/managers/observablesManager.d.ts +6 -6
- package/managers/observablesManager.js +1 -1
- package/managers/observablesManager.js.map +1 -1
- package/managers/sceneManager.d.ts +28 -30
- package/managers/sceneManager.js +96 -95
- package/managers/sceneManager.js.map +1 -1
- package/managers/telemetryManager.d.ts +6 -6
- package/managers/telemetryManager.js +6 -6
- package/managers/telemetryManager.js.map +1 -1
- package/model/modelAnimation.d.ts +14 -14
- package/model/modelAnimation.js +3 -3
- package/model/modelAnimation.js.map +1 -1
- package/model/viewerModel.d.ts +23 -31
- package/model/viewerModel.js +51 -46
- package/model/viewerModel.js.map +1 -1
- package/optimizer/custom/extended.d.ts +3 -5
- package/optimizer/custom/extended.js +3 -5
- package/optimizer/custom/extended.js.map +1 -1
- package/optimizer/custom/index.d.ts +1 -1
- package/optimizer/custom/index.js +1 -1
- package/optimizer/custom/index.js.map +1 -1
- package/package.json +41 -215
- package/readme.md +12 -8
- package/renderOnlyIndex.d.ts +10 -10
- package/renderOnlyIndex.js +6 -4
- package/renderOnlyIndex.js.map +1 -1
- package/templating/eventManager.d.ts +1 -1
- package/templating/eventManager.js +4 -2
- package/templating/eventManager.js.map +1 -1
- package/templating/plugins/hdButtonPlugin.d.ts +2 -2
- package/templating/plugins/hdButtonPlugin.js +2 -15
- package/templating/plugins/hdButtonPlugin.js.map +1 -1
- package/templating/plugins/printButton.d.ts +2 -3
- package/templating/plugins/printButton.js +3 -16
- package/templating/plugins/printButton.js.map +1 -1
- package/templating/templateManager.d.ts +8 -7
- package/templating/templateManager.js +72 -62
- package/templating/templateManager.js.map +1 -1
- package/templating/viewerTemplatePlugin.d.ts +1 -1
- package/templating/viewerTemplatePlugin.js +4 -4
- package/templating/viewerTemplatePlugin.js.map +1 -1
- package/viewer/defaultViewer.d.ts +17 -11
- package/viewer/defaultViewer.js +116 -121
- package/viewer/defaultViewer.js.map +1 -1
- package/viewer/renderOnlyViewer.d.ts +2 -2
- package/viewer/renderOnlyViewer.js +17 -24
- package/viewer/renderOnlyViewer.js.map +1 -1
- package/viewer/viewer.d.ts +19 -18
- package/viewer/viewer.js +63 -49
- package/viewer/viewer.js.map +1 -1
- package/viewer/viewerManager.d.ts +5 -5
- package/viewer/viewerManager.js +4 -3
- package/viewer/viewerManager.js.map +1 -1
- package/viewer/viewerWithTemplate.js +2 -15
- package/viewer/viewerWithTemplate.js.map +1 -1
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration, ICameraConfiguration, ISkyboxConfiguration, IGroundConfiguration, IModelConfiguration, IVRConfiguration } from
|
|
2
|
-
import { ViewerConfiguration } from
|
|
3
|
-
import { ViewerModel } from
|
|
4
|
-
import { ViewerLabs } from
|
|
5
|
-
import { ObservablesManager } from
|
|
6
|
-
import { ConfigurationContainer } from
|
|
7
|
-
import { IEnvironmentMapConfiguration } from
|
|
8
|
-
import { Observable } from
|
|
9
|
-
import { SceneOptimizer } from
|
|
10
|
-
import { ArcRotateCamera } from
|
|
11
|
-
import { Light } from
|
|
12
|
-
import { EnvironmentHelper } from
|
|
13
|
-
import { VRExperienceHelper } from
|
|
14
|
-
import { Color3 } from
|
|
15
|
-
import { Nullable } from
|
|
16
|
-
import { DefaultRenderingPipeline } from
|
|
17
|
-
import { Engine } from
|
|
18
|
-
import { IShadowLight } from
|
|
19
|
-
import { Scene } from
|
|
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";
|
|
20
22
|
/**
|
|
21
23
|
* This interface describes the structure of the variable sent with the configuration observables of the scene manager.
|
|
22
24
|
* O - the type of object we are dealing with (Light, ArcRotateCamera, Scene, etc')
|
|
@@ -59,7 +61,7 @@ export declare class SceneManager {
|
|
|
59
61
|
*/
|
|
60
62
|
onModelsConfiguredObservable: Observable<IPostConfigurationCallback<Array<ViewerModel>, IModelConfiguration>>;
|
|
61
63
|
/**
|
|
62
|
-
* Will notify after the
|
|
64
|
+
* Will notify after the environment was configured. Can be used to further configure the environment
|
|
63
65
|
*/
|
|
64
66
|
onEnvironmentConfiguredObservable: Observable<IPostConfigurationCallback<EnvironmentHelper, {
|
|
65
67
|
skybox?: ISkyboxConfiguration | boolean;
|
|
@@ -89,12 +91,11 @@ export declare class SceneManager {
|
|
|
89
91
|
* Babylon's environment helper of this viewer
|
|
90
92
|
*/
|
|
91
93
|
environmentHelper?: EnvironmentHelper;
|
|
92
|
-
private _animationBlendingEnabled;
|
|
93
94
|
protected _defaultHighpTextureType: number;
|
|
94
95
|
protected _shadowGeneratorBias: number;
|
|
95
96
|
protected _defaultPipelineTextureType: number;
|
|
96
97
|
/**
|
|
97
|
-
* The maximum number of shadows supported by the
|
|
98
|
+
* The maximum number of shadows supported by the current viewer
|
|
98
99
|
*/
|
|
99
100
|
protected _maxShadows: number;
|
|
100
101
|
/**
|
|
@@ -144,11 +145,11 @@ export declare class SceneManager {
|
|
|
144
145
|
set groundEnabled(newValue: boolean);
|
|
145
146
|
private _groundMirrorEnabled;
|
|
146
147
|
/**
|
|
147
|
-
* gets
|
|
148
|
+
* gets whether the reflection is disabled.
|
|
148
149
|
*/
|
|
149
150
|
get groundMirrorEnabled(): boolean;
|
|
150
151
|
/**
|
|
151
|
-
* sets
|
|
152
|
+
* sets whether the reflection is disabled.
|
|
152
153
|
*/
|
|
153
154
|
set groundMirrorEnabled(value: boolean);
|
|
154
155
|
private _defaultRenderingPipelineEnabled;
|
|
@@ -161,14 +162,14 @@ export declare class SceneManager {
|
|
|
161
162
|
unlockBabylonFeatures(): void;
|
|
162
163
|
/**
|
|
163
164
|
* initialize the scene. Calling this function again will dispose the old scene, if exists.
|
|
165
|
+
* @param sceneConfiguration
|
|
164
166
|
*/
|
|
165
|
-
initScene(sceneConfiguration?: ISceneConfiguration
|
|
167
|
+
initScene(sceneConfiguration?: ISceneConfiguration): Promise<Scene>;
|
|
166
168
|
clearScene(clearModels?: boolean, clearLights?: boolean): void;
|
|
167
169
|
private _globalConfiguration;
|
|
168
170
|
/**
|
|
169
171
|
* This will update the scene's configuration, including camera, lights, environment.
|
|
170
172
|
* @param newConfiguration the delta that should be configured. This includes only the changes
|
|
171
|
-
* @param globalConfiguration The global configuration object, after the new configuration was merged into it
|
|
172
173
|
*/
|
|
173
174
|
updateConfiguration(newConfiguration: Partial<ViewerConfiguration>): void;
|
|
174
175
|
private _defaultRenderingPipelineShouldBuild;
|
|
@@ -201,16 +202,13 @@ export declare class SceneManager {
|
|
|
201
202
|
/**
|
|
202
203
|
* (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
|
|
203
204
|
* @param cameraConfig the new camera configuration
|
|
204
|
-
* @param model optionally use the model to configure the camera.
|
|
205
205
|
*/
|
|
206
206
|
protected _configureCamera(cameraConfig?: ICameraConfiguration): void;
|
|
207
207
|
private _focusOnModel;
|
|
208
208
|
protected _configureEnvironment(skyboxConifguration?: ISkyboxConfiguration | boolean, groundConfiguration?: IGroundConfiguration | boolean): void;
|
|
209
209
|
/**
|
|
210
210
|
* configure the lights.
|
|
211
|
-
*
|
|
212
211
|
* @param lightsConfiguration the (new) light(s) configuration
|
|
213
|
-
* @param model optionally use the model to configure the camera.
|
|
214
212
|
*/
|
|
215
213
|
protected _configureLights(lightsConfiguration?: {
|
|
216
214
|
[name: string]: ILightConfiguration | boolean | number;
|
|
@@ -231,7 +229,7 @@ export declare class SceneManager {
|
|
|
231
229
|
*/
|
|
232
230
|
protected _handleHardwareLimitations(enableHDR?: boolean): void;
|
|
233
231
|
/**
|
|
234
|
-
*
|
|
232
|
+
* Dispose the entire viewer including the scene and the engine
|
|
235
233
|
*/
|
|
236
234
|
dispose(): void;
|
|
237
235
|
/**
|
package/managers/sceneManager.js
CHANGED
|
@@ -1,35 +1,36 @@
|
|
|
1
|
-
import { getConfigurationKey } from
|
|
2
|
-
import { ModelState } from
|
|
3
|
-
import { extendClassWithConfig, deepmerge } from
|
|
4
|
-
import { ViewerLabs } from
|
|
5
|
-
import { getCustomOptimizerByName } from
|
|
6
|
-
import { Observable } from
|
|
7
|
-
import { SceneOptimizer, SceneOptimizerOptions } from
|
|
8
|
-
import { ArcRotateCamera } from
|
|
9
|
-
import { Light } from
|
|
10
|
-
import { EnvironmentHelper } from
|
|
11
|
-
import { Color3, Quaternion, Vector3, Axis, Matrix } from
|
|
12
|
-
import { DefaultRenderingPipeline } from
|
|
13
|
-
import { Animation } from
|
|
14
|
-
import { AnimationPropertiesOverride } from
|
|
15
|
-
import { RenderTargetTexture } from
|
|
16
|
-
import { PBRMaterial } from
|
|
17
|
-
import { ShadowLight } from
|
|
18
|
-
import { CubeTexture } from
|
|
19
|
-
import { HemisphericLight } from
|
|
20
|
-
import { Scalar } from
|
|
1
|
+
import { getConfigurationKey } from "../configuration/configuration.js";
|
|
2
|
+
import { ModelState } from "../model/viewerModel.js";
|
|
3
|
+
import { extendClassWithConfig, deepmerge } from "../helper/index.js";
|
|
4
|
+
import { ViewerLabs } from "../labs/viewerLabs.js";
|
|
5
|
+
import { getCustomOptimizerByName } from "../optimizer/custom/index.js";
|
|
6
|
+
import { Observable } from "@babylonjs/core/Misc/observable.js";
|
|
7
|
+
import { SceneOptimizer, SceneOptimizerOptions } from "@babylonjs/core/Misc/sceneOptimizer.js";
|
|
8
|
+
import { ArcRotateCamera } from "@babylonjs/core/Cameras/arcRotateCamera.js";
|
|
9
|
+
import { Light } from "@babylonjs/core/Lights/light.js";
|
|
10
|
+
import { EnvironmentHelper } from "@babylonjs/core/Helpers/environmentHelper.js";
|
|
11
|
+
import { Color3, Quaternion, Vector3, Axis, Matrix } from "@babylonjs/core/Maths/math.js";
|
|
12
|
+
import { DefaultRenderingPipeline } from "@babylonjs/core/PostProcesses/RenderPipeline/Pipelines/defaultRenderingPipeline.js";
|
|
13
|
+
import { Animation } from "@babylonjs/core/Animations/index.js";
|
|
14
|
+
import { AnimationPropertiesOverride } from "@babylonjs/core/Animations/animationPropertiesOverride.js";
|
|
15
|
+
import { RenderTargetTexture } from "@babylonjs/core/Materials/Textures/renderTargetTexture.js";
|
|
16
|
+
import { PBRMaterial } from "@babylonjs/core/Materials/PBR/pbrMaterial.js";
|
|
17
|
+
import { ShadowLight } from "@babylonjs/core/Lights/shadowLight.js";
|
|
18
|
+
import { CubeTexture } from "@babylonjs/core/Materials/Textures/cubeTexture.js";
|
|
19
|
+
import { HemisphericLight } from "@babylonjs/core/Lights/hemisphericLight.js";
|
|
20
|
+
import { Scalar } from "@babylonjs/core/Maths/math.scalar.js";
|
|
21
21
|
import { CreatePlane } from "@babylonjs/core/Meshes/Builders/planeBuilder.js";
|
|
22
|
-
import { Tags } from
|
|
23
|
-
import { Scene } from
|
|
24
|
-
import { ShadowGenerator } from
|
|
25
|
-
import { Constants } from
|
|
22
|
+
import { Tags } from "@babylonjs/core/Misc/tags.js";
|
|
23
|
+
import { Scene } from "@babylonjs/core/scene.js";
|
|
24
|
+
import { ShadowGenerator } from "@babylonjs/core/Lights/Shadows/shadowGenerator.js";
|
|
25
|
+
import { Constants } from "@babylonjs/core/Engines/constants.js";
|
|
26
|
+
import "@babylonjs/core/Audio/audioSceneComponent.js";
|
|
27
|
+
import "@babylonjs/core/Helpers/sceneHelpers.js";
|
|
26
28
|
var SceneManager = /** @class */ (function () {
|
|
27
29
|
function SceneManager(_engine, _configurationContainer, _observablesManager) {
|
|
28
30
|
var _this = this;
|
|
29
31
|
this._engine = _engine;
|
|
30
32
|
this._configurationContainer = _configurationContainer;
|
|
31
33
|
this._observablesManager = _observablesManager;
|
|
32
|
-
this._animationBlendingEnabled = true;
|
|
33
34
|
this._white = Color3.White();
|
|
34
35
|
this._forceShadowUpdate = false;
|
|
35
36
|
this._processShadows = true;
|
|
@@ -98,13 +99,13 @@ var SceneManager = /** @class */ (function () {
|
|
|
98
99
|
updateShadows();
|
|
99
100
|
_this._forceShadowUpdate = false;
|
|
100
101
|
}
|
|
101
|
-
else if (!
|
|
102
|
+
else if (!_this.models.every(function (model) {
|
|
102
103
|
if (!model.shadowsRenderedAfterLoad) {
|
|
103
104
|
model.shadowsRenderedAfterLoad = true;
|
|
104
105
|
return false;
|
|
105
106
|
}
|
|
106
107
|
return model.state === ModelState.COMPLETE && !model.currentAnimation;
|
|
107
|
-
}))
|
|
108
|
+
})) {
|
|
108
109
|
updateShadows();
|
|
109
110
|
}
|
|
110
111
|
});
|
|
@@ -240,13 +241,13 @@ var SceneManager = /** @class */ (function () {
|
|
|
240
241
|
});
|
|
241
242
|
Object.defineProperty(SceneManager.prototype, "groundMirrorEnabled", {
|
|
242
243
|
/**
|
|
243
|
-
* gets
|
|
244
|
+
* gets whether the reflection is disabled.
|
|
244
245
|
*/
|
|
245
246
|
get: function () {
|
|
246
247
|
return this._groundMirrorEnabled;
|
|
247
248
|
},
|
|
248
249
|
/**
|
|
249
|
-
* sets
|
|
250
|
+
* sets whether the reflection is disabled.
|
|
250
251
|
*/
|
|
251
252
|
set: function (value) {
|
|
252
253
|
if (this._groundMirrorEnabled === value) {
|
|
@@ -304,10 +305,11 @@ var SceneManager = /** @class */ (function () {
|
|
|
304
305
|
};
|
|
305
306
|
/**
|
|
306
307
|
* initialize the scene. Calling this function again will dispose the old scene, if exists.
|
|
308
|
+
* @param sceneConfiguration
|
|
307
309
|
*/
|
|
308
|
-
SceneManager.prototype.initScene = function (sceneConfiguration
|
|
310
|
+
SceneManager.prototype.initScene = function (sceneConfiguration) {
|
|
309
311
|
if (sceneConfiguration === void 0) { sceneConfiguration = {}; }
|
|
310
|
-
// if the
|
|
312
|
+
// if the scene exists, dispose it.
|
|
311
313
|
if (this.scene) {
|
|
312
314
|
this.scene.dispose();
|
|
313
315
|
}
|
|
@@ -316,7 +318,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
316
318
|
this._configurationContainer.scene = this.scene;
|
|
317
319
|
// set a default PBR material
|
|
318
320
|
if (!sceneConfiguration.defaultMaterial) {
|
|
319
|
-
var defaultMaterial = new PBRMaterial(
|
|
321
|
+
var defaultMaterial = new PBRMaterial("defaultMaterial", this.scene);
|
|
320
322
|
defaultMaterial.reflectivityColor = new Color3(0.1, 0.1, 0.1);
|
|
321
323
|
defaultMaterial.microSurface = 0.6;
|
|
322
324
|
if (this.scene.defaultMaterial) {
|
|
@@ -351,7 +353,6 @@ var SceneManager = /** @class */ (function () {
|
|
|
351
353
|
/**
|
|
352
354
|
* This will update the scene's configuration, including camera, lights, environment.
|
|
353
355
|
* @param newConfiguration the delta that should be configured. This includes only the changes
|
|
354
|
-
* @param globalConfiguration The global configuration object, after the new configuration was merged into it
|
|
355
356
|
*/
|
|
356
357
|
SceneManager.prototype.updateConfiguration = function (newConfiguration) {
|
|
357
358
|
var _this = this;
|
|
@@ -388,10 +389,10 @@ var SceneManager = /** @class */ (function () {
|
|
|
388
389
|
this._configureVR(newConfiguration.vr);
|
|
389
390
|
}
|
|
390
391
|
if (newConfiguration.lab) {
|
|
391
|
-
// rendering
|
|
392
|
+
// rendering pipelines
|
|
392
393
|
if (newConfiguration.lab.defaultRenderingPipelines) {
|
|
393
394
|
var pipelineConfig = newConfiguration.lab.defaultRenderingPipelines;
|
|
394
|
-
if (typeof pipelineConfig ===
|
|
395
|
+
if (typeof pipelineConfig === "boolean") {
|
|
395
396
|
this.defaultRenderingPipelineEnabled = pipelineConfig;
|
|
396
397
|
}
|
|
397
398
|
else {
|
|
@@ -404,7 +405,9 @@ var SceneManager = /** @class */ (function () {
|
|
|
404
405
|
}
|
|
405
406
|
if (newConfiguration.lab.globalLightRotation !== undefined) {
|
|
406
407
|
// rotate all lights that are shadow lights
|
|
407
|
-
this.scene.lights
|
|
408
|
+
this.scene.lights
|
|
409
|
+
.filter(function (light) { return light instanceof ShadowLight; })
|
|
410
|
+
.forEach(function (light) {
|
|
408
411
|
// casting and '!' are safe, due to the constraints tested before
|
|
409
412
|
_this.labs.rotateShadowLight(light, newConfiguration.lab.globalLightRotation);
|
|
410
413
|
});
|
|
@@ -440,12 +443,12 @@ var SceneManager = /** @class */ (function () {
|
|
|
440
443
|
this.scene.autoClearDepthAndStencil = false;
|
|
441
444
|
this._defaultRenderingPipelineShouldBuild = true;
|
|
442
445
|
var bloomEnabled = this._bloomEnabled;
|
|
443
|
-
if (typeof pipelineConfig !==
|
|
446
|
+
if (typeof pipelineConfig !== "boolean") {
|
|
444
447
|
extendClassWithConfig(this._defaultRenderingPipeline, pipelineConfig);
|
|
445
448
|
this._bloomEnabled = !!pipelineConfig.bloomEnabled;
|
|
446
449
|
this._fxaaEnabled = !!pipelineConfig.fxaaEnabled;
|
|
447
450
|
bloomEnabled = this._bloomEnabled && pipelineConfig.bloomWeight !== undefined && pipelineConfig.bloomWeight > 0;
|
|
448
|
-
this._defaultRenderingPipeline.bloomWeight = (pipelineConfig.bloomWeight !== undefined && pipelineConfig.bloomWeight) ||
|
|
451
|
+
this._defaultRenderingPipeline.bloomWeight = (pipelineConfig.bloomWeight !== undefined && pipelineConfig.bloomWeight) || this._defaultRenderingPipeline.bloomWeight;
|
|
449
452
|
}
|
|
450
453
|
this._defaultRenderingPipeline.bloomEnabled = bloomEnabled;
|
|
451
454
|
this._defaultRenderingPipeline.fxaaEnabled = this.fxaaEnabled;
|
|
@@ -489,8 +492,8 @@ var SceneManager = /** @class */ (function () {
|
|
|
489
492
|
enumerable: false,
|
|
490
493
|
configurable: true
|
|
491
494
|
});
|
|
492
|
-
|
|
493
|
-
};
|
|
495
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
496
|
+
SceneManager.prototype.setDefaultMaterial = function (sceneConfig) { };
|
|
494
497
|
/**
|
|
495
498
|
* internally configure the scene using the provided configuration.
|
|
496
499
|
* The scene will not be recreated, but just updated.
|
|
@@ -570,7 +573,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
570
573
|
this.onSceneConfiguredObservable.notifyObservers({
|
|
571
574
|
sceneManager: this,
|
|
572
575
|
object: this.scene,
|
|
573
|
-
newConfiguration: sceneConfig
|
|
576
|
+
newConfiguration: sceneConfig,
|
|
574
577
|
});
|
|
575
578
|
};
|
|
576
579
|
/**
|
|
@@ -580,7 +583,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
580
583
|
*/
|
|
581
584
|
SceneManager.prototype._configureOptimizer = function (optimizerConfig) {
|
|
582
585
|
var _this = this;
|
|
583
|
-
if (typeof optimizerConfig ===
|
|
586
|
+
if (typeof optimizerConfig === "boolean") {
|
|
584
587
|
if (this.sceneOptimizer) {
|
|
585
588
|
this.sceneOptimizer.stop();
|
|
586
589
|
this.sceneOptimizer.dispose();
|
|
@@ -627,7 +630,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
627
630
|
this.onSceneOptimizerConfiguredObservable.notifyObservers({
|
|
628
631
|
sceneManager: this,
|
|
629
632
|
object: this.sceneOptimizer,
|
|
630
|
-
newConfiguration: optimizerConfig
|
|
633
|
+
newConfiguration: optimizerConfig,
|
|
631
634
|
});
|
|
632
635
|
};
|
|
633
636
|
/**
|
|
@@ -660,7 +663,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
660
663
|
var vrOptions = deepmerge({
|
|
661
664
|
useCustomVRButton: true,
|
|
662
665
|
createDeviceOrientationCamera: false,
|
|
663
|
-
trackPosition: true
|
|
666
|
+
trackPosition: true,
|
|
664
667
|
}, vrConfig.vrOptions || {});
|
|
665
668
|
this._vrHelper = this.scene.createDefaultVRExperience(vrOptions);
|
|
666
669
|
if (!vrConfig.disableInteractions) {
|
|
@@ -669,7 +672,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
669
672
|
if (!vrConfig.disableTeleportation) {
|
|
670
673
|
var floorMeshName = vrConfig.overrideFloorMeshName || "BackgroundPlane";
|
|
671
674
|
this._vrHelper.enableTeleportation({
|
|
672
|
-
floorMeshName: floorMeshName
|
|
675
|
+
floorMeshName: floorMeshName,
|
|
673
676
|
});
|
|
674
677
|
}
|
|
675
678
|
if (vrConfig.rotateUsingControllers) {
|
|
@@ -713,7 +716,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
713
716
|
this.onVRConfiguredObservable.notifyObservers({
|
|
714
717
|
sceneManager: this,
|
|
715
718
|
object: this._vrHelper,
|
|
716
|
-
newConfiguration: vrConfig
|
|
719
|
+
newConfiguration: vrConfig,
|
|
717
720
|
});
|
|
718
721
|
};
|
|
719
722
|
SceneManager.prototype._configureEnvironmentMap = function (environmentMapConfiguration) {
|
|
@@ -759,16 +762,11 @@ var SceneManager = /** @class */ (function () {
|
|
|
759
762
|
/**
|
|
760
763
|
* (Re) configure the camera. The camera will only be created once and from this point will only be reconfigured.
|
|
761
764
|
* @param cameraConfig the new camera configuration
|
|
762
|
-
* @param model optionally use the model to configure the camera.
|
|
763
765
|
*/
|
|
764
766
|
SceneManager.prototype._configureCamera = function (cameraConfig) {
|
|
765
767
|
var _this = this;
|
|
766
768
|
if (cameraConfig === void 0) { cameraConfig = {}; }
|
|
767
769
|
if (!this.scene.activeCamera) {
|
|
768
|
-
var attachControl = true;
|
|
769
|
-
if (this._globalConfiguration.scene && this._globalConfiguration.scene.disableCameraControl) {
|
|
770
|
-
attachControl = false;
|
|
771
|
-
}
|
|
772
770
|
// Inline scene.createDefaultCamera to reduce file size
|
|
773
771
|
// Dispose existing camera in replace mode.
|
|
774
772
|
if (this.scene.activeCamera) {
|
|
@@ -780,7 +778,6 @@ var SceneManager = /** @class */ (function () {
|
|
|
780
778
|
var worldExtends = this.scene.getWorldExtends();
|
|
781
779
|
var worldSize = worldExtends.max.subtract(worldExtends.min);
|
|
782
780
|
var worldCenter = worldExtends.min.add(worldSize.scale(0.5));
|
|
783
|
-
var camera;
|
|
784
781
|
var radius = worldSize.length() * 1.5;
|
|
785
782
|
// empty scene scenario!
|
|
786
783
|
if (!isFinite(radius)) {
|
|
@@ -790,7 +787,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
790
787
|
var arcRotateCamera = new ArcRotateCamera("default camera", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this.scene);
|
|
791
788
|
arcRotateCamera.lowerRadiusLimit = radius * 0.01;
|
|
792
789
|
arcRotateCamera.wheelPrecision = 100 / radius;
|
|
793
|
-
camera = arcRotateCamera;
|
|
790
|
+
var camera = arcRotateCamera;
|
|
794
791
|
camera.minZ = radius * 0.01;
|
|
795
792
|
camera.maxZ = radius * 1000;
|
|
796
793
|
camera.speed = radius * 0.2;
|
|
@@ -846,7 +843,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
846
843
|
this.onCameraConfiguredObservable.notifyObservers({
|
|
847
844
|
sceneManager: this,
|
|
848
845
|
object: this.camera,
|
|
849
|
-
newConfiguration: cameraConfig
|
|
846
|
+
newConfiguration: cameraConfig,
|
|
850
847
|
});
|
|
851
848
|
};
|
|
852
849
|
SceneManager.prototype._configureEnvironment = function (skyboxConifguration, groundConfiguration) {
|
|
@@ -872,8 +869,8 @@ var SceneManager = /** @class */ (function () {
|
|
|
872
869
|
options.groundYBias = -center.y;
|
|
873
870
|
}*/
|
|
874
871
|
if (groundConfiguration) {
|
|
875
|
-
var groundConfig_1 =
|
|
876
|
-
var groundSize = groundConfig_1.size || (typeof skyboxConifguration ===
|
|
872
|
+
var groundConfig_1 = typeof groundConfiguration === "boolean" ? {} : groundConfiguration;
|
|
873
|
+
var groundSize = groundConfig_1.size || (typeof skyboxConifguration === "object" && skyboxConifguration.scale);
|
|
877
874
|
if (groundSize) {
|
|
878
875
|
options.groundSize = groundSize;
|
|
879
876
|
}
|
|
@@ -974,7 +971,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
974
971
|
if (this.environmentHelper.rootMesh && this._globalConfiguration.scene && this._globalConfiguration.scene.environmentRotationY !== undefined) {
|
|
975
972
|
this.environmentHelper.rootMesh.rotation.y = this._globalConfiguration.scene.environmentRotationY;
|
|
976
973
|
}
|
|
977
|
-
var groundConfig =
|
|
974
|
+
var groundConfig = typeof groundConfiguration === "boolean" ? {} : groundConfiguration;
|
|
978
975
|
if (this.environmentHelper.groundMaterial && groundConfig) {
|
|
979
976
|
this.environmentHelper.groundMaterial._perceptualColor = this.mainColor;
|
|
980
977
|
if (groundConfig.material) {
|
|
@@ -998,35 +995,34 @@ var SceneManager = /** @class */ (function () {
|
|
|
998
995
|
if (skyboxMaterial) {
|
|
999
996
|
skyboxMaterial._perceptualColor = this.mainColor;
|
|
1000
997
|
if (postInitSkyboxMaterial) {
|
|
1001
|
-
if (typeof skyboxConifguration ===
|
|
998
|
+
if (typeof skyboxConifguration === "object" && skyboxConifguration.material) {
|
|
1002
999
|
extendClassWithConfig(skyboxMaterial, skyboxConifguration.material);
|
|
1003
1000
|
}
|
|
1004
1001
|
}
|
|
1005
1002
|
}
|
|
1006
1003
|
}
|
|
1007
|
-
this._observablesManager &&
|
|
1008
|
-
|
|
1009
|
-
|
|
1004
|
+
this._observablesManager &&
|
|
1005
|
+
this._observablesManager.onModelLoadedObservable.add(function (model) {
|
|
1006
|
+
_this._updateGroundMirrorRenderList(model);
|
|
1007
|
+
});
|
|
1010
1008
|
this.onEnvironmentConfiguredObservable.notifyObservers({
|
|
1011
1009
|
sceneManager: this,
|
|
1012
1010
|
object: this.environmentHelper,
|
|
1013
1011
|
newConfiguration: {
|
|
1014
1012
|
skybox: skyboxConifguration,
|
|
1015
|
-
ground: groundConfiguration
|
|
1016
|
-
}
|
|
1013
|
+
ground: groundConfiguration,
|
|
1014
|
+
},
|
|
1017
1015
|
});
|
|
1018
1016
|
};
|
|
1019
1017
|
/**
|
|
1020
1018
|
* configure the lights.
|
|
1021
|
-
*
|
|
1022
1019
|
* @param lightsConfiguration the (new) light(s) configuration
|
|
1023
|
-
* @param model optionally use the model to configure the camera.
|
|
1024
1020
|
*/
|
|
1025
1021
|
SceneManager.prototype._configureLights = function (lightsConfiguration) {
|
|
1026
1022
|
var _this = this;
|
|
1027
1023
|
if (lightsConfiguration === void 0) { lightsConfiguration = {}; }
|
|
1028
1024
|
// sanity check!
|
|
1029
|
-
var lightKeys = Object.keys(lightsConfiguration).filter(function (name) { return name !==
|
|
1025
|
+
var lightKeys = Object.keys(lightsConfiguration).filter(function (name) { return name !== "globalRotation"; });
|
|
1030
1026
|
if (!lightKeys.length) {
|
|
1031
1027
|
if (!this.scene.lights.length) {
|
|
1032
1028
|
new HemisphericLight("default light", Vector3.Up(), this.scene);
|
|
@@ -1043,12 +1039,12 @@ var SceneManager = /** @class */ (function () {
|
|
|
1043
1039
|
}
|
|
1044
1040
|
});
|
|
1045
1041
|
}
|
|
1046
|
-
lightKeys.forEach(function (name
|
|
1042
|
+
lightKeys.forEach(function (name) {
|
|
1047
1043
|
var lightConfig = { type: 0 };
|
|
1048
|
-
if (typeof lightsConfiguration[name] ===
|
|
1044
|
+
if (typeof lightsConfiguration[name] === "object") {
|
|
1049
1045
|
lightConfig = lightsConfiguration[name];
|
|
1050
1046
|
}
|
|
1051
|
-
if (typeof lightsConfiguration[name] ===
|
|
1047
|
+
if (typeof lightsConfiguration[name] === "number") {
|
|
1052
1048
|
lightConfig.type = lightsConfiguration[name];
|
|
1053
1049
|
}
|
|
1054
1050
|
lightConfig.name = name;
|
|
@@ -1064,7 +1060,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1064
1060
|
else {
|
|
1065
1061
|
// available? get it from the scene
|
|
1066
1062
|
light = _this.scene.getLightByName(name);
|
|
1067
|
-
if (typeof lightsConfiguration[name] ===
|
|
1063
|
+
if (typeof lightsConfiguration[name] === "boolean") {
|
|
1068
1064
|
lightConfig.type = light.getTypeID();
|
|
1069
1065
|
}
|
|
1070
1066
|
lightsAvailable_1 = lightsAvailable_1.filter(function (ln) { return ln !== name; });
|
|
@@ -1109,7 +1105,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1109
1105
|
else if (light.getTypeID() === Light.LIGHTTYPEID_SPOTLIGHT) {
|
|
1110
1106
|
var spotLight = light;
|
|
1111
1107
|
if (lightConfig.spotAngle !== undefined) {
|
|
1112
|
-
spotLight.angle = lightConfig.spotAngle * Math.PI / 180;
|
|
1108
|
+
spotLight.angle = (lightConfig.spotAngle * Math.PI) / 180;
|
|
1113
1109
|
}
|
|
1114
1110
|
if (spotLight.angle && lightConfig.shadowFieldOfView) {
|
|
1115
1111
|
spotLight.shadowAngleScale = lightConfig.shadowFieldOfView / spotLight.angle;
|
|
@@ -1118,7 +1114,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1118
1114
|
}
|
|
1119
1115
|
else if (light.getTypeID() === Light.LIGHTTYPEID_POINTLIGHT) {
|
|
1120
1116
|
if (lightConfig.shadowFieldOfView) {
|
|
1121
|
-
light.shadowAngle = lightConfig.shadowFieldOfView * Math.PI / 180;
|
|
1117
|
+
light.shadowAngle = (lightConfig.shadowFieldOfView * Math.PI) / 180;
|
|
1122
1118
|
}
|
|
1123
1119
|
isShadowEnabled = true;
|
|
1124
1120
|
}
|
|
@@ -1133,10 +1129,11 @@ var SceneManager = /** @class */ (function () {
|
|
|
1133
1129
|
shadowGenerator_1.blurKernel = blurKernel;
|
|
1134
1130
|
//override defaults
|
|
1135
1131
|
extendClassWithConfig(shadowGenerator_1, lightConfig.shadowConfig || {});
|
|
1136
|
-
// add the
|
|
1137
|
-
_this._observablesManager &&
|
|
1138
|
-
_this.
|
|
1139
|
-
|
|
1132
|
+
// add the focus meshes to the shadow list
|
|
1133
|
+
_this._observablesManager &&
|
|
1134
|
+
_this._observablesManager.onModelLoadedObservable.add(function (model) {
|
|
1135
|
+
_this._updateShadowRenderList(shadowGenerator_1, model);
|
|
1136
|
+
});
|
|
1140
1137
|
//if (model) {
|
|
1141
1138
|
_this._updateShadowRenderList(shadowGenerator_1);
|
|
1142
1139
|
//}
|
|
@@ -1147,9 +1144,12 @@ var SceneManager = /** @class */ (function () {
|
|
|
1147
1144
|
}
|
|
1148
1145
|
});
|
|
1149
1146
|
// render priority
|
|
1150
|
-
var
|
|
1151
|
-
Object.keys(
|
|
1152
|
-
|
|
1147
|
+
var globalLightsConfiguration = this._globalConfiguration.lights || {};
|
|
1148
|
+
Object.keys(globalLightsConfiguration)
|
|
1149
|
+
.sort()
|
|
1150
|
+
.forEach(function (name, idx) {
|
|
1151
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1152
|
+
// const configuration = globalLightsConfiguration[name];
|
|
1153
1153
|
var light = _this.scene.getLightByName(name);
|
|
1154
1154
|
// sanity check
|
|
1155
1155
|
if (!light) {
|
|
@@ -1161,12 +1161,12 @@ var SceneManager = /** @class */ (function () {
|
|
|
1161
1161
|
this.onLightsConfiguredObservable.notifyObservers({
|
|
1162
1162
|
sceneManager: this,
|
|
1163
1163
|
object: this.scene.lights,
|
|
1164
|
-
newConfiguration: lightsConfiguration
|
|
1164
|
+
newConfiguration: lightsConfiguration,
|
|
1165
1165
|
});
|
|
1166
1166
|
};
|
|
1167
1167
|
SceneManager.prototype._updateShadowRenderList = function (shadowGenerator, model, resetList) {
|
|
1168
1168
|
var focusMeshes = model ? model.meshes : this.scene.meshes;
|
|
1169
|
-
// add the
|
|
1169
|
+
// add the focus meshes to the shadow list
|
|
1170
1170
|
var shadownMap = shadowGenerator.getShadowMap();
|
|
1171
1171
|
if (!shadownMap) {
|
|
1172
1172
|
return;
|
|
@@ -1179,7 +1179,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1179
1179
|
}
|
|
1180
1180
|
for (var index = 0; index < focusMeshes.length; index++) {
|
|
1181
1181
|
var mesh = focusMeshes[index];
|
|
1182
|
-
if (Tags.MatchesQuery(mesh,
|
|
1182
|
+
if (Tags.MatchesQuery(mesh, "castShadow") && shadownMap.renderList.indexOf(mesh) === -1) {
|
|
1183
1183
|
shadownMap.renderList.push(mesh);
|
|
1184
1184
|
}
|
|
1185
1185
|
}
|
|
@@ -1188,7 +1188,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1188
1188
|
var shadowGroundPlane = CreatePlane("shadowGroundPlane", { size: 100 }, this.scene);
|
|
1189
1189
|
shadowGroundPlane.useVertexColors = false;
|
|
1190
1190
|
//material isn't ever used in rendering, just used to set back face culling
|
|
1191
|
-
shadowGroundPlane.material = new PBRMaterial(
|
|
1191
|
+
shadowGroundPlane.material = new PBRMaterial("shadowGroundPlaneMaterial", this.scene);
|
|
1192
1192
|
shadowGroundPlane.material.backFaceCulling = false;
|
|
1193
1193
|
shadowGroundPlane.rotation.x = Math.PI * 0.5;
|
|
1194
1194
|
shadowGroundPlane.freezeWorldMatrix();
|
|
@@ -1252,7 +1252,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1252
1252
|
var maxVaryingRows = this._engine.getCaps().maxVaryingVectors;
|
|
1253
1253
|
var maxFragmentSamplers = this._engine.getCaps().maxTexturesImageUnits;
|
|
1254
1254
|
//shadows are disabled if there's not enough varyings for a single shadow
|
|
1255
|
-
if (
|
|
1255
|
+
if (maxVaryingRows < 8 || maxFragmentSamplers < 8) {
|
|
1256
1256
|
this._maxShadows = 0;
|
|
1257
1257
|
}
|
|
1258
1258
|
else {
|
|
@@ -1278,7 +1278,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
1278
1278
|
this._defaultPipelineTextureType = this._hdrSupport ? this._defaultHighpTextureType : Constants.TEXTURETYPE_UNSIGNED_INT;
|
|
1279
1279
|
};
|
|
1280
1280
|
/**
|
|
1281
|
-
*
|
|
1281
|
+
* Dispose the entire viewer including the scene and the engine
|
|
1282
1282
|
*/
|
|
1283
1283
|
SceneManager.prototype.dispose = function () {
|
|
1284
1284
|
// this.onCameraConfiguredObservable.clear();
|
|
@@ -1323,13 +1323,13 @@ var SceneManager = /** @class */ (function () {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
return returnUrl;
|
|
1325
1325
|
};
|
|
1326
|
-
SceneManager.prototype._setCameraBehavior = function (name, behaviorConfig
|
|
1326
|
+
SceneManager.prototype._setCameraBehavior = function (name, behaviorConfig) {
|
|
1327
1327
|
var behavior;
|
|
1328
1328
|
var type;
|
|
1329
|
-
if (typeof behaviorConfig ===
|
|
1329
|
+
if (typeof behaviorConfig === "object") {
|
|
1330
1330
|
type = behaviorConfig.type;
|
|
1331
1331
|
}
|
|
1332
|
-
else if (typeof behaviorConfig ===
|
|
1332
|
+
else if (typeof behaviorConfig === "number") {
|
|
1333
1333
|
type = behaviorConfig;
|
|
1334
1334
|
}
|
|
1335
1335
|
else {
|
|
@@ -1338,9 +1338,9 @@ var SceneManager = /** @class */ (function () {
|
|
|
1338
1338
|
if (type === undefined) {
|
|
1339
1339
|
return;
|
|
1340
1340
|
}
|
|
1341
|
-
var config =
|
|
1341
|
+
var config = typeof behaviorConfig === "object" ? behaviorConfig : {};
|
|
1342
1342
|
var enabled = true;
|
|
1343
|
-
if (typeof behaviorConfig ===
|
|
1343
|
+
if (typeof behaviorConfig === "boolean") {
|
|
1344
1344
|
enabled = behaviorConfig;
|
|
1345
1345
|
}
|
|
1346
1346
|
// constructing behavior
|
|
@@ -1374,11 +1374,12 @@ var SceneManager = /** @class */ (function () {
|
|
|
1374
1374
|
case 1 /* BOUNCING */:
|
|
1375
1375
|
break;
|
|
1376
1376
|
case 2 /* FRAMING */:
|
|
1377
|
-
this._observablesManager &&
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1377
|
+
this._observablesManager &&
|
|
1378
|
+
this._observablesManager.onModelLoadedObservable.add(function (model) {
|
|
1379
|
+
if (config.zoomOnBoundingInfo) {
|
|
1380
|
+
behavior.zoomOnMeshHierarchy(model.rootMesh);
|
|
1381
|
+
}
|
|
1382
|
+
});
|
|
1382
1383
|
break;
|
|
1383
1384
|
}
|
|
1384
1385
|
};
|