浏览代码

adding labs to sceneManager

Raanan Weber 7 年之前
父节点
当前提交
2fa2e8559b
共有 1 个文件被更改,包括 17 次插入1 次删除
  1. 17 1
      Viewer/src/viewer/sceneManager.ts

+ 17 - 1
Viewer/src/viewer/sceneManager.ts

@@ -4,6 +4,7 @@ import { ILightConfiguration, ISceneConfiguration, ISceneOptimizerConfiguration,
 import { ViewerModel } from '../model/viewerModel';
 import { ViewerModel } from '../model/viewerModel';
 import { extendClassWithConfig } from '../helper';
 import { extendClassWithConfig } from '../helper';
 import { CameraBehavior } from '../interfaces';
 import { CameraBehavior } from '../interfaces';
+import { ViewerLabs } from '../labs/viewerLabs';
 
 
 /**
 /**
  * This interface describes the structure of the variable sent with the configuration observables of the scene manager.
  * This interface describes the structure of the variable sent with the configuration observables of the scene manager.
@@ -66,6 +67,9 @@ export class SceneManager {
 
 
     private _mainColor: Color3;
     private _mainColor: Color3;
 
 
+    //Labs!
+    public labs: ViewerLabs;
+
     constructor(private _viewer: AbstractViewer) {
     constructor(private _viewer: AbstractViewer) {
         this.models = [];
         this.models = [];
 
 
@@ -88,7 +92,9 @@ export class SceneManager {
                 this._configureCamera(this._viewer.configuration.camera || {}, model);
                 this._configureCamera(this._viewer.configuration.camera || {}, model);
             }
             }
             return this._initEnvironment(model);
             return this._initEnvironment(model);
-        })
+        });
+
+        this.labs = new ViewerLabs();
     }
     }
 
 
     /**
     /**
@@ -179,6 +185,16 @@ export class SceneManager {
      */
      */
     public updateConfiguration(newConfiguration: Partial<ViewerConfiguration>, globalConfiguration: ViewerConfiguration) {
     public updateConfiguration(newConfiguration: Partial<ViewerConfiguration>, globalConfiguration: ViewerConfiguration) {
 
 
+        if (globalConfiguration.lab) {
+            if (globalConfiguration.lab.environmentAssetsRootURL) {
+                this.labs.environmentAssetsRootURL = globalConfiguration.lab.environmentAssetsRootURL;
+            }
+
+            if (globalConfiguration.lab.environmentMap) {
+                this.labs.loadEnvironment(this, globalConfiguration.lab.environmentMap);
+            }
+        }
+
         // update scene configuration
         // update scene configuration
         if (newConfiguration.scene) {
         if (newConfiguration.scene) {
             this._configureScene(newConfiguration.scene);
             this._configureScene(newConfiguration.scene);