Browse Source

scene flags and model enabling

Raanan Weber 7 years ago
parent
commit
324cbabbbe

+ 14 - 0
Viewer/src/configuration/configuration.ts

@@ -224,6 +224,19 @@ export interface ISceneConfiguration {
     defaultMaterial?: {
         materialType: "standard" | "pbr";
         [propName: string]: any;
+    };
+    flags?: {
+        shadowsEnabled?: boolean;
+        particlesEnabled?: boolean;
+        collisionsEnabled?: boolean;
+        lightsEnabled?: boolean;
+        texturesEnabled?: boolean;
+        lensFlaresEnabled?: boolean;
+        proceduralTexturesEnabled?: boolean;
+        renderTargetsEnabled?: boolean;
+        spritesEnabled?: boolean;
+        skeletonsEnabled?: boolean;
+        audioEnabled?: boolean;
     }
 }
 
@@ -362,6 +375,7 @@ export interface ICameraConfiguration {
     maxZ?: number;
     inertia?: number;
     exposure?: number;
+    pinchPrecision?: number;
     behaviors?: {
         [name: string]: number | {
             type: number;

+ 14 - 0
Viewer/src/model/viewerModel.ts

@@ -106,6 +106,20 @@ export class ViewerModel implements IDisposable {
     }
 
     /**
+     * Is this model enabled?
+     */
+    public get enabled() {
+        return this.rootMesh.isEnabled();
+    }
+
+    /**
+     * Set whether this model is enabled or not.
+     */
+    public set enabled(enable: boolean) {
+        this.rootMesh.setEnabled(enable);
+    }
+
+    /**
      * Get the viewer showing this model
      */
     public getViewer() {

+ 6 - 3
Viewer/src/viewer/sceneManager.ts

@@ -165,6 +165,7 @@ export class SceneManager {
 
     /**
      * Sets the engine flags to unlock all babylon features.
+     * Can also be configured using the scene.flags configuration object
      */
     public unlockBabylonFeatures() {
         this.scene.shadowsEnabled = true;
@@ -209,9 +210,7 @@ export class SceneManager {
         // TODO - is this needed, now that Babylon is integrated? 
         // set a default PBR material
         if (!sceneConfiguration.defaultMaterial) {
-            var defaultMaterial = new BABYLON.PBRMaterial('default-material', this.scene);
-            defaultMaterial.environmentBRDFTexture = null;
-            defaultMaterial.usePhysicalLightFalloff = true;
+            var defaultMaterial = new BABYLON.PBRMaterial('defaultMaterial', this.scene);
             defaultMaterial.reflectivityColor = new BABYLON.Color3(0.1, 0.1, 0.1);
             defaultMaterial.microSurface = 0.6;
 
@@ -442,6 +441,10 @@ export class SceneManager {
             extendClassWithConfig(this.scene.defaultMaterial, conf);
         }
 
+        if (sceneConfig.flags) {
+            extendClassWithConfig(this.scene, sceneConfig.flags);
+        }
+
         this.onSceneConfiguredObservable.notifyObservers({
             sceneManager: this,
             object: this.scene,