Explorar o código

moved main color for the environment to the labs

Raanan Weber %!s(int64=7) %!d(string=hai) anos
pai
achega
ffcefd172b

+ 3 - 1
Viewer/dist/ufoExample.html

@@ -20,8 +20,10 @@
     <body>
         <babylon extends="default, shadowDirectionalLight, environmentMap" templates.nav-bar.params.disable-on-fullscreen="true">
             <scene glow="true">
-                <environment-main-color r="0.5" g="0.2" b="0.2"></environment-main-color>
             </scene>
+            <lab>
+                <environment-main-color r="0.5" g="0.2" b="0.2"></environment-main-color>
+            </lab>
             <model url="https://models.babylonjs.com/ufo.glb">
                 <animation auto-start="true"></animation>
             </model>

+ 1 - 1
Viewer/src/configuration/configuration.ts

@@ -89,6 +89,7 @@ export interface ViewerConfiguration {
         }
         hideLoadingDelay?: number;
         assetsRootURL?: string;
+        environmentMainColor?: { r: number, g: number, b: number };
         environmentMap?: {
             /**
              * Environment map texture path in relative to the asset folder.
@@ -265,7 +266,6 @@ export interface ISceneConfiguration {
     debug?: boolean;
     clearColor?: { r: number, g: number, b: number, a: number };
     mainColor?: { r: number, g: number, b: number };
-    environmentMainColor?: { r: number, g: number, b: number };
     imageProcessingConfiguration?: IImageProcessingConfiguration;
     environmentTexture?: string;
     colorGrading?: IColorGradingConfiguration;

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

@@ -416,6 +416,11 @@ export class SceneManager {
                     this.defaultRenderingPipelineEnabled = true;
                 }
             }
+
+            if (newConfiguration.lab.environmentMainColor) {
+                let mainColor = new Color3().copyFrom(newConfiguration.lab.environmentMainColor as Color3);
+                this.environmentHelper.setMainColor(mainColor);
+            }
         }
 
         if (this._defaultRenderingPipeline && this._defaultRenderingPipeline.imageProcessing) {
@@ -929,12 +934,6 @@ export class SceneManager {
             this.environmentHelper.rootMesh.rotation.y = this._viewer.configuration.scene.environmentRotationY;
         }
 
-        if (this._viewer.configuration.scene && this._viewer.configuration.scene.environmentMainColor) {
-            let mainColor = new Color3().copyFrom(this._viewer.configuration.scene.environmentMainColor as Color3);
-            this.environmentHelper.setMainColor(mainColor);
-        }
-
-
         let groundConfig = (typeof groundConfiguration === 'boolean') ? {} : groundConfiguration;
         if (this.environmentHelper.groundMaterial && groundConfig && groundConfig.material) {
             //if (!this.environmentHelper.groundMaterial._perceptualColor) {