Kaynağa Gözat

Merge remote-tracking branch 'BabylonJS/master' into viewer-tests

Raanan Weber 7 yıl önce
ebeveyn
işleme
9a47cb14a4

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

@@ -4,7 +4,7 @@ import { EngineOptions, IGlowLayerOptions, DepthOfFieldEffectBlurLevel } from 'b
 export function getConfigurationKey(key: string, configObject: any) {
 export function getConfigurationKey(key: string, configObject: any) {
     let splits = key.split('.');
     let splits = key.split('.');
 
 
-    if (splits.length === 0 || !configObject) return false;
+    if (splits.length === 0 || !configObject) return;
     else if (splits.length === 1) {
     else if (splits.length === 1) {
         if (configObject[key] !== undefined) {
         if (configObject[key] !== undefined) {
             return configObject[key];
             return configObject[key];
@@ -160,6 +160,7 @@ export interface IDefaultRenderingPipelineConfiguration {
     bllomThreshold?: number;
     bllomThreshold?: number;
     hdr?: boolean;
     hdr?: boolean;
     samples?: number;
     samples?: number;
+    glowLayerEnabled?: boolean;
 }
 }
 
 
 export interface IModelConfiguration {
 export interface IModelConfiguration {
@@ -271,6 +272,9 @@ export interface ISceneConfiguration {
     environmentTexture?: string;
     environmentTexture?: string;
     colorGrading?: IColorGradingConfiguration;
     colorGrading?: IColorGradingConfiguration;
     environmentRotationY?: number;
     environmentRotationY?: number;
+    /**
+     * Deprecated, please use default rendering pipeline
+     */
     glow?: boolean | IGlowLayerOptions;
     glow?: boolean | IGlowLayerOptions;
     disableHdr?: boolean;
     disableHdr?: boolean;
     renderInBackground?: boolean;
     renderInBackground?: boolean;

+ 48 - 0
Viewer/src/configuration/configurationCompatibility.ts

@@ -0,0 +1,48 @@
+import { ViewerConfiguration, getConfigurationKey } from './'
+/**
+ * This function will make sure the configuration file is taking deprecated fields into account
+ * and is setting them to the correct keys and values.
+ * 
+ * @param configuration The configuration to process. Mutable!
+ */
+export function processConfigurationCompatibility(configuration: ViewerConfiguration) {
+
+
+
+    if (configuration.camera) {
+        // camera contrast -> image processing contrast
+        if (configuration.camera.contrast !== undefined) {
+            setKeyInObject(configuration, "scene.imageProcessingConfiguration.contrast", configuration.camera.contrast);
+        }
+
+        // camera exposure -> image processing exposure
+        if (configuration.camera.exposure !== undefined) {
+            setKeyInObject(configuration, "scene.imageProcessingConfiguration.exposure", configuration.camera.exposure);
+        }
+    }
+
+    if (configuration.scene) {
+        //glow
+        if (configuration.scene.glow) {
+            setKeyInObject(configuration, "lab.defaultRenderingPipelines.glowLayerEnabled", true);
+            let enabledProcessing = getConfigurationKey("scene.imageProcessingConfiguration.isEnabled", configuration);
+            if (enabledProcessing !== false) {
+                setKeyInObject(configuration, "scene.imageProcessingConfiguration.isEnabled", true);
+            }
+        }
+    }
+}
+
+function setKeyInObject(object: any, keys: string, value: any, shouldOverwrite?: boolean) {
+    let keySplit = keys.split(".");
+    if (keySplit.length === 0) return;
+    let lastKey = keySplit.pop();
+    if (!lastKey) return;
+    let curObj = object;
+    keySplit.forEach(key => {
+        curObj[key] = curObj[key] || {};
+        curObj = curObj[key];
+    });
+    if (curObj[lastKey] !== undefined && !shouldOverwrite) return;
+    curObj[lastKey] = value;
+}

+ 3 - 0
Viewer/src/configuration/loader.ts

@@ -1,6 +1,7 @@
 import { mapperManager } from './mappers';
 import { mapperManager } from './mappers';
 import { ViewerConfiguration } from './configuration';
 import { ViewerConfiguration } from './configuration';
 import { getConfigurationType } from './types';
 import { getConfigurationType } from './types';
+import { processConfigurationCompatibility } from './configurationCompatibility';
 
 
 import * as deepmerge from '../../assets/deepmerge.min.js';
 import * as deepmerge from '../../assets/deepmerge.min.js';
 import { Tools, IFileRequest } from 'babylonjs';
 import { Tools, IFileRequest } from 'babylonjs';
@@ -73,10 +74,12 @@ export class ConfigurationLoader {
                 let mapper = mapperManager.getMapper(mapperType);
                 let mapper = mapperManager.getMapper(mapperType);
                 let parsed = mapper.map(data);
                 let parsed = mapper.map(data);
                 let merged = deepmerge(loadedConfig, parsed);
                 let merged = deepmerge(loadedConfig, parsed);
+                processConfigurationCompatibility(merged);
                 if (callback) callback(merged);
                 if (callback) callback(merged);
                 return merged;
                 return merged;
             });
             });
         } else {
         } else {
+            processConfigurationCompatibility(loadedConfig);
             if (callback) callback(loadedConfig);
             if (callback) callback(loadedConfig);
             return Promise.resolve(loadedConfig);
             return Promise.resolve(loadedConfig);
         }
         }

+ 10 - 22
Viewer/src/viewer/sceneManager.ts

@@ -331,7 +331,7 @@ export class SceneManager {
 
 
         this._mainColor = Color3.White();
         this._mainColor = Color3.White();
 
 
-        if (sceneConfiguration.glow) {
+        /*if (sceneConfiguration.glow) {
             let options: Partial<IGlowLayerOptions> = {
             let options: Partial<IGlowLayerOptions> = {
                 mainTextureFixedSize: 512
                 mainTextureFixedSize: 512
             };
             };
@@ -339,7 +339,7 @@ export class SceneManager {
                 options = sceneConfiguration.glow
                 options = sceneConfiguration.glow
             }
             }
             var gl = new BABYLON.GlowLayer("glow", this.scene, options);
             var gl = new BABYLON.GlowLayer("glow", this.scene, options);
-        }
+        }*/
 
 
         return this.onSceneInitObservable.notifyObserversWithPromise(this.scene);
         return this.onSceneInitObservable.notifyObserversWithPromise(this.scene);
     }
     }
@@ -603,22 +603,14 @@ export class SceneManager {
 
 
             this._reflectionColor.copyFrom(this.mainColor);
             this._reflectionColor.copyFrom(this.mainColor);
 
 
-            if (this._viewer.configuration.camera && this._viewer.configuration.camera.exposure) {
 
 
-                let environmentTint = getConfigurationKey("lab.environmentMap.tintLevel", this._viewer.configuration) || 0;
+            let environmentTint = getConfigurationKey("lab.environmentMap.tintLevel", this._viewer.configuration) || 0;
 
 
-                /*this._mainColor.toLinearSpaceToRef(this._mainColor);
-                let exposure = Math.pow(2.0, -(this._viewer.configuration.camera.exposure) * Math.PI);
-                this._mainColor.scaleToRef(1 / exposure, this._mainColor);
-                let tmpColor = Color3.Lerp(this._white, this._mainColor, environmentTint);
-                this._mainColor.copyFrom(tmpColor);*/
-
-                // reflection color
-                this._reflectionColor.toLinearSpaceToRef(this._reflectionColor);
-                this._reflectionColor.scaleToRef(1 / this._viewer.configuration.camera.exposure, this._reflectionColor);
-                let tmpColor3 = Color3.Lerp(this._white, this._reflectionColor, environmentTint);
-                this._reflectionColor.copyFrom(tmpColor3);
-            }
+            // reflection color
+            this._reflectionColor.toLinearSpaceToRef(this._reflectionColor);
+            this._reflectionColor.scaleToRef(1 / this.scene.imageProcessingConfiguration.exposure, this._reflectionColor);
+            let tmpColor3 = Color3.Lerp(this._white, this._reflectionColor, environmentTint);
+            this._reflectionColor.copyFrom(tmpColor3);
 
 
             //update the environment, if exists
             //update the environment, if exists
             if (this.environmentHelper) {
             if (this.environmentHelper) {
@@ -786,10 +778,6 @@ export class SceneManager {
         if (this.scene.imageProcessingConfiguration) {
         if (this.scene.imageProcessingConfiguration) {
             this.scene.imageProcessingConfiguration.colorCurvesEnabled = true;
             this.scene.imageProcessingConfiguration.colorCurvesEnabled = true;
             this.scene.imageProcessingConfiguration.vignetteEnabled = true;
             this.scene.imageProcessingConfiguration.vignetteEnabled = true;
-            if (cameraConfig.contrast !== undefined)
-                this.scene.imageProcessingConfiguration.contrast = cameraConfig.contrast;
-            if (cameraConfig.exposure !== undefined)
-                this.scene.imageProcessingConfiguration.exposure = cameraConfig.exposure;
             this.scene.imageProcessingConfiguration.toneMappingEnabled = !!cameraConfig.toneMappingEnabled;
             this.scene.imageProcessingConfiguration.toneMappingEnabled = !!cameraConfig.toneMappingEnabled;
         }
         }
 
 
@@ -942,8 +930,8 @@ export class SceneManager {
             if (this.environmentHelper.groundMirror) {
             if (this.environmentHelper.groundMirror) {
                 const mirrorClearColor = this.environmentHelper.groundMaterial._perceptualColor.toLinearSpace();
                 const mirrorClearColor = this.environmentHelper.groundMaterial._perceptualColor.toLinearSpace();
                 // TODO user camera exposure value to set the mirror clear color
                 // TODO user camera exposure value to set the mirror clear color
-                //let exposure = Math.pow(2.0, -this.configuration.camera.exposure) * Math.PI;
-                //mirrorClearColor.scaleToRef(1 / exposure, mirrorClearColor);
+                let exposure = Math.pow(2.0, -this.scene.imageProcessingConfiguration.exposure) * Math.PI;
+                mirrorClearColor.scaleToRef(1 / exposure, mirrorClearColor);
 
 
                 this.environmentHelper.groundMirror.clearColor.r = Scalar.Clamp(mirrorClearColor.r);
                 this.environmentHelper.groundMirror.clearColor.r = Scalar.Clamp(mirrorClearColor.r);
                 this.environmentHelper.groundMirror.clearColor.g = Scalar.Clamp(mirrorClearColor.g);
                 this.environmentHelper.groundMirror.clearColor.g = Scalar.Clamp(mirrorClearColor.g);

+ 2 - 0
dist/preview release/what's new.md

@@ -18,6 +18,7 @@
 
 
 - No fullscreen button on small devices ([RaananW](https://github.com/RaananW))
 - No fullscreen button on small devices ([RaananW](https://github.com/RaananW))
 - Nav-Bar is now disaplayed on fullscreen per default  ([RaananW](https://github.com/RaananW))
 - Nav-Bar is now disaplayed on fullscreen per default  ([RaananW](https://github.com/RaananW))
+- Viewer configuration supports deprecated values using the new configurationCompatibility processor  ([RaananW](https://github.com/RaananW))
 
 
 ## Bug fixes
 ## Bug fixes
 
 
@@ -25,6 +26,7 @@
 
 
 - Fix ```shadowEnabled``` property on lights. Shadows are not visble anymore when disabled ([sebavan](http://www.github.com/sebavan))
 - Fix ```shadowEnabled``` property on lights. Shadows are not visble anymore when disabled ([sebavan](http://www.github.com/sebavan))
 - Physics `unregisterOnPhysicsCollide` didn't remove callback correctly [#4291](https://github.com/BabylonJS/Babylon.js/issues/4291) ([RaananW](https://github.com/RaananW))
 - Physics `unregisterOnPhysicsCollide` didn't remove callback correctly [#4291](https://github.com/BabylonJS/Babylon.js/issues/4291) ([RaananW](https://github.com/RaananW))
+- Added missing getter and setter for global exposure in ColorCurves ([RaananW](https://github.com/RaananW))
 
 
 ### Viewer
 ### Viewer
 
 

+ 62 - 46
src/Materials/babylon.colorCurves.ts

@@ -1,5 +1,5 @@
 module BABYLON {
 module BABYLON {
-    
+
     /**
     /**
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT). 
      * The color grading curves provide additional color adjustmnent that is applied after any color grading transform (3D LUT). 
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
      * They allow basic adjustment of saturation and small exposure adjustments, along with color filter tinting to provide white balance adjustment or more stylistic effects.
@@ -7,31 +7,31 @@
      * corresponding to low luminance, medium luminance, and high luminance areas respectively.
      * corresponding to low luminance, medium luminance, and high luminance areas respectively.
      */
      */
     export class ColorCurves {
     export class ColorCurves {
-        
+
         private _dirty = true;
         private _dirty = true;
-        
+
         private _tempColor = new Color4(0, 0, 0, 0);
         private _tempColor = new Color4(0, 0, 0, 0);
-        
+
         private _globalCurve = new Color4(0, 0, 0, 0);
         private _globalCurve = new Color4(0, 0, 0, 0);
         private _highlightsCurve = new Color4(0, 0, 0, 0);
         private _highlightsCurve = new Color4(0, 0, 0, 0);
         private _midtonesCurve = new Color4(0, 0, 0, 0);
         private _midtonesCurve = new Color4(0, 0, 0, 0);
         private _shadowsCurve = new Color4(0, 0, 0, 0);
         private _shadowsCurve = new Color4(0, 0, 0, 0);
-        
+
         private _positiveCurve = new Color4(0, 0, 0, 0);
         private _positiveCurve = new Color4(0, 0, 0, 0);
         private _negativeCurve = new Color4(0, 0, 0, 0);
         private _negativeCurve = new Color4(0, 0, 0, 0);
-        
+
         @serialize()
         @serialize()
         private _globalHue = 30;
         private _globalHue = 30;
-        
+
         @serialize()
         @serialize()
         private _globalDensity = 0;
         private _globalDensity = 0;
-        
+
         @serialize()
         @serialize()
         private _globalSaturation = 0;
         private _globalSaturation = 0;
-        
+
         @serialize()
         @serialize()
         private _globalExposure = 0;
         private _globalExposure = 0;
-        
+
         /**
         /**
          * Gets the global Hue value.
          * Gets the global Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
@@ -79,19 +79,35 @@
             this._globalSaturation = value;
             this._globalSaturation = value;
             this._dirty = true;
             this._dirty = true;
         }
         }
-        
+
+        /**
+         * Gets the global Exposure value.
+         * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+         */
+        public get globalExposure(): number {
+            return this._globalExposure;
+        }
+        /**
+         * Sets the global Exposure value.
+         * This is an adjustment value in the range [-100,+100], where the default value of 0.0 makes no adjustment, positive values increase exposure and negative values decrease exposure.
+         */
+        public set globalExposure(value: number) {
+            this._globalExposure = value;
+            this._dirty = true;
+        }
+
         @serialize()
         @serialize()
         private _highlightsHue = 30;
         private _highlightsHue = 30;
-        
+
         @serialize()
         @serialize()
         private _highlightsDensity = 0;
         private _highlightsDensity = 0;
-        
+
         @serialize()
         @serialize()
         private _highlightsSaturation = 0;
         private _highlightsSaturation = 0;
-        
+
         @serialize()
         @serialize()
         private _highlightsExposure = 0;
         private _highlightsExposure = 0;
-        
+
         /**
         /**
          * Gets the highlights Hue value.
          * Gets the highlights Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
@@ -154,19 +170,19 @@
             this._highlightsExposure = value;
             this._highlightsExposure = value;
             this._dirty = true;
             this._dirty = true;
         }
         }
-        
+
         @serialize()
         @serialize()
         private _midtonesHue = 30;
         private _midtonesHue = 30;
-        
+
         @serialize()
         @serialize()
         private _midtonesDensity = 0;
         private _midtonesDensity = 0;
-        
+
         @serialize()
         @serialize()
         private _midtonesSaturation = 0;
         private _midtonesSaturation = 0;
-        
+
         @serialize()
         @serialize()
         private _midtonesExposure = 0;
         private _midtonesExposure = 0;
-        
+
         /**
         /**
          * Gets the midtones Hue value.
          * Gets the midtones Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
@@ -229,12 +245,12 @@
             this._midtonesExposure = value;
             this._midtonesExposure = value;
             this._dirty = true;
             this._dirty = true;
         }
         }
-        
+
         private _shadowsHue = 30;
         private _shadowsHue = 30;
         private _shadowsDensity = 0;
         private _shadowsDensity = 0;
         private _shadowsSaturation = 0;
         private _shadowsSaturation = 0;
         private _shadowsExposure = 0;
         private _shadowsExposure = 0;
-        
+
         /**
         /**
          * Gets the shadows Hue value.
          * Gets the shadows Hue value.
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
          * The hue value is a standard HSB hue in the range [0,360] where 0=red, 120=green and 240=blue. The default value is 30 degrees (orange).
@@ -300,17 +316,17 @@
 
 
         public getClassName(): string {
         public getClassName(): string {
             return "ColorCurves";
             return "ColorCurves";
-        }          
-        
+        }
+
         /**
         /**
          * Binds the color curves to the shader.
          * Binds the color curves to the shader.
          * @param colorCurves The color curve to bind
          * @param colorCurves The color curve to bind
          * @param effect The effect to bind to
          * @param effect The effect to bind to
          */
          */
-        public static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform = "vCameraColorCurvePositive", neutralUniform = "vCameraColorCurveNeutral", negativeUniform = "vCameraColorCurveNegative") : void {
+        public static Bind(colorCurves: ColorCurves, effect: Effect, positiveUniform = "vCameraColorCurvePositive", neutralUniform = "vCameraColorCurveNeutral", negativeUniform = "vCameraColorCurveNegative"): void {
             if (colorCurves._dirty) {
             if (colorCurves._dirty) {
                 colorCurves._dirty = false;
                 colorCurves._dirty = false;
-                            
+
                 // Fill in global info.
                 // Fill in global info.
                 colorCurves.getColorGradingDataToRef(
                 colorCurves.getColorGradingDataToRef(
                     colorCurves._globalHue,
                     colorCurves._globalHue,
@@ -336,7 +352,7 @@
                     colorCurves._midtonesExposure,
                     colorCurves._midtonesExposure,
                     colorCurves._tempColor);
                     colorCurves._tempColor);
                 colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);
                 colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._midtonesCurve);
-                
+
                 // Compute shadows info.
                 // Compute shadows info.
                 colorCurves.getColorGradingDataToRef(
                 colorCurves.getColorGradingDataToRef(
                     colorCurves._shadowsHue,
                     colorCurves._shadowsHue,
@@ -345,43 +361,43 @@
                     colorCurves._shadowsExposure,
                     colorCurves._shadowsExposure,
                     colorCurves._tempColor);
                     colorCurves._tempColor);
                 colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);
                 colorCurves._tempColor.multiplyToRef(colorCurves._globalCurve, colorCurves._shadowsCurve);
-                
+
                 // Compute deltas (neutral is midtones).
                 // Compute deltas (neutral is midtones).
                 colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);
                 colorCurves._highlightsCurve.subtractToRef(colorCurves._midtonesCurve, colorCurves._positiveCurve);
-                colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);            
+                colorCurves._midtonesCurve.subtractToRef(colorCurves._shadowsCurve, colorCurves._negativeCurve);
             }
             }
-            
+
             if (effect) {
             if (effect) {
-                effect.setFloat4(positiveUniform, 
+                effect.setFloat4(positiveUniform,
                     colorCurves._positiveCurve.r,
                     colorCurves._positiveCurve.r,
                     colorCurves._positiveCurve.g,
                     colorCurves._positiveCurve.g,
                     colorCurves._positiveCurve.b,
                     colorCurves._positiveCurve.b,
                     colorCurves._positiveCurve.a);
                     colorCurves._positiveCurve.a);
-                effect.setFloat4(neutralUniform, 
+                effect.setFloat4(neutralUniform,
                     colorCurves._midtonesCurve.r,
                     colorCurves._midtonesCurve.r,
                     colorCurves._midtonesCurve.g,
                     colorCurves._midtonesCurve.g,
                     colorCurves._midtonesCurve.b,
                     colorCurves._midtonesCurve.b,
                     colorCurves._midtonesCurve.a);
                     colorCurves._midtonesCurve.a);
-                effect.setFloat4(negativeUniform, 
+                effect.setFloat4(negativeUniform,
                     colorCurves._negativeCurve.r,
                     colorCurves._negativeCurve.r,
                     colorCurves._negativeCurve.g,
                     colorCurves._negativeCurve.g,
                     colorCurves._negativeCurve.b,
                     colorCurves._negativeCurve.b,
                     colorCurves._negativeCurve.a);
                     colorCurves._negativeCurve.a);
             }
             }
         }
         }
-        
+
         /**
         /**
          * Prepare the list of uniforms associated with the ColorCurves effects.
          * Prepare the list of uniforms associated with the ColorCurves effects.
          * @param uniformsList The list of uniforms used in the effect
          * @param uniformsList The list of uniforms used in the effect
          */
          */
         public static PrepareUniforms(uniformsList: string[]): void {
         public static PrepareUniforms(uniformsList: string[]): void {
             uniformsList.push(
             uniformsList.push(
-                "vCameraColorCurveNeutral", 
-                "vCameraColorCurvePositive", 
+                "vCameraColorCurveNeutral",
+                "vCameraColorCurvePositive",
                 "vCameraColorCurveNegative"
                 "vCameraColorCurveNegative"
             );
             );
         }
         }
-        
+
         /**
         /**
          * Returns color grading data based on a hue, density, saturation and exposure value.
          * Returns color grading data based on a hue, density, saturation and exposure value.
          * @param filterHue The hue of the color filter.
          * @param filterHue The hue of the color filter.
@@ -390,7 +406,7 @@
          * @param exposure The exposure.
          * @param exposure The exposure.
          * @param result The result data container.
          * @param result The result data container.
          */
          */
-        private getColorGradingDataToRef(hue: number, density: number, saturation: number, exposure: number, result: Color4) : void {
+        private getColorGradingDataToRef(hue: number, density: number, saturation: number, exposure: number, result: Color4): void {
             if (hue == null) {
             if (hue == null) {
                 return;
                 return;
             }
             }
@@ -399,7 +415,7 @@
             density = ColorCurves.clamp(density, -100, 100);
             density = ColorCurves.clamp(density, -100, 100);
             saturation = ColorCurves.clamp(saturation, -100, 100);
             saturation = ColorCurves.clamp(saturation, -100, 100);
             exposure = ColorCurves.clamp(exposure, -100, 100);
             exposure = ColorCurves.clamp(exposure, -100, 100);
-                
+
             // Remap the slider/config filter density with non-linear mapping and also scale by half
             // Remap the slider/config filter density with non-linear mapping and also scale by half
             // so that the maximum filter density is only 50% control. This provides fine control 
             // so that the maximum filter density is only 50% control. This provides fine control 
             // for small values and reasonable range.
             // for small values and reasonable range.
@@ -412,12 +428,12 @@
                 density *= -1;
                 density *= -1;
                 hue = (hue + 180) % 360;
                 hue = (hue + 180) % 360;
             }
             }
-            
-            ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);            
+
+            ColorCurves.fromHSBToRef(hue, density, 50 + 0.25 * exposure, result);
             result.scaleToRef(2, result);
             result.scaleToRef(2, result);
             result.a = 1 + 0.01 * saturation;
             result.a = 1 + 0.01 * saturation;
         }
         }
-        
+
         /**
         /**
          * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
          * Takes an input slider value and returns an adjusted value that provides extra control near the centre.
          * @param value The input slider value in range [-100,100].
          * @param value The input slider value in range [-100,100].
@@ -437,7 +453,7 @@
 
 
             return x;
             return x;
         }
         }
-        
+
         /**
         /**
          * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
          * Returns an RGBA Color4 based on Hue, Saturation and Brightness (also referred to as value, HSV).
          * @param hue The hue (H) input.
          * @param hue The hue (H) input.
@@ -501,7 +517,7 @@
 
 
             result.a = 1;
             result.a = 1;
         }
         }
-        
+
         /**
         /**
          * Returns a value clamped between min and max
          * Returns a value clamped between min and max
          * @param value The value to clamp
          * @param value The value to clamp
@@ -533,8 +549,8 @@
          * Parses the color curve from a json representation.
          * Parses the color curve from a json representation.
          * @param source the JSON source to parse
          * @param source the JSON source to parse
          * @return The parsed curves
          * @return The parsed curves
-         */      
-        public static Parse(source: any) : ColorCurves {
+         */
+        public static Parse(source: any): ColorCurves {
             return SerializationHelper.Parse(() => new ColorCurves(), source, null, null);
             return SerializationHelper.Parse(() => new ColorCurves(), source, null, null);
         }
         }
     }
     }