Browse Source

adding labs to sceneManager

Raanan Weber 7 years ago
parent
commit
2fa2e8559b
1 changed files with 17 additions and 1 deletions
  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 { extendClassWithConfig } from '../helper';
 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.
@@ -66,6 +67,9 @@ export class SceneManager {
 
     private _mainColor: Color3;
 
+    //Labs!
+    public labs: ViewerLabs;
+
     constructor(private _viewer: AbstractViewer) {
         this.models = [];
 
@@ -88,7 +92,9 @@ export class SceneManager {
                 this._configureCamera(this._viewer.configuration.camera || {}, model);
             }
             return this._initEnvironment(model);
-        })
+        });
+
+        this.labs = new ViewerLabs();
     }
 
     /**
@@ -179,6 +185,16 @@ export class SceneManager {
      */
     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
         if (newConfiguration.scene) {
             this._configureScene(newConfiguration.scene);