瀏覽代碼

Fix Naming

Sebastien Vandenberghe 8 年之前
父節點
當前提交
6b22e6a495

+ 1 - 3
src/Materials/PBR/babylon.pbrBaseMaterial.ts

@@ -1194,9 +1194,7 @@
                 }
 
                 // image processing
-                if (this._imageProcessingConfiguration) {
-                    this._imageProcessingConfiguration.bind(this._activeEffect);
-                }
+                this._imageProcessingConfiguration.bind(this._activeEffect);
 
                 // Log. depth
                 MaterialHelper.BindLogDepth(defines, this._activeEffect, scene);

+ 4 - 4
src/Materials/PBR/babylon.pbrMaterial.ts

@@ -439,7 +439,7 @@
          * This corresponds to a photographic exposure.
          */
         public get cameraExposure(): number {
-            return this._imageProcessingConfiguration.cameraExposure;
+            return this._imageProcessingConfiguration.exposure;
         };
         /**
          * The camera exposure used on this material.
@@ -447,21 +447,21 @@
          * This corresponds to a photographic exposure.
          */
         public set cameraExposure(value: number) {
-            this._imageProcessingConfiguration.cameraExposure = value;
+            this._imageProcessingConfiguration.exposure = value;
         };
         
         /**
          * Gets The camera contrast used on this material.
          */
         public get cameraContrast(): number {
-            return this._imageProcessingConfiguration.cameraContrast;
+            return this._imageProcessingConfiguration.contrast;
         }
 
         /**
          * Sets The camera contrast used on this material.
          */
         public set cameraContrast(value: number) {
-            this._imageProcessingConfiguration.cameraContrast = value;
+            this._imageProcessingConfiguration.contrast = value;
         }
         
         /**

+ 17 - 19
src/Materials/babylon.imageProcessingConfiguration.ts

@@ -39,7 +39,7 @@ module BABYLON {
             return this._colorCurvesEnabled;
         }
         /**
-         * Gets wether the color curves effect is enabled.
+         * Sets wether the color curves effect is enabled.
          */
         public set colorCurvesEnabled(value: boolean) {
             if (this._colorCurvesEnabled === value) {
@@ -117,10 +117,10 @@ module BABYLON {
         }
 
         /**
-         * Camera exposure used in the effect.
+         * Exposure used in the effect.
          */
         @serialize()
-        public cameraExposure = Math.log(Math.PI) * Math.LOG2E;
+        public exposure = Math.log(Math.PI) * Math.LOG2E;
 
         @serialize()
         private _toneMappingEnabled = false;
@@ -143,22 +143,22 @@ module BABYLON {
         }
 
         @serialize()
-        protected _cameraContrast = 1.0;
+        protected _contrast = 1.0;
         /**
-         * Gets Camera contrast used in the effect.
+         * Gets the contrast used in the effect.
          */
-        public get cameraContrast(): number {
-            return this._cameraContrast;
+        public get contrast(): number {
+            return this._contrast;
         }
         /**
-         * Gets Camera contrast used in the effect.
+         * Sets the contrast used in the effect.
          */
-        public set cameraContrast(value: number) {
-            if (this._cameraContrast === value) {
+        public set contrast(value: number) {
+            if (this._contrast === value) {
                 return;
             }
 
-            this._cameraContrast = value;
+            this._contrast = value;
             this._updateParameters();
         }
 
@@ -197,7 +197,7 @@ module BABYLON {
          * Camera field of view used by the Vignette effect.
          */
         @serialize()
-        public cameraFov = 0.5;
+        public vignetteCameraFov = 0.5;
 
         @serialize()
         private _vignetteBlendMode = ImageProcessingConfiguration.VIGNETTEMODE_MULTIPLY;
@@ -278,12 +278,10 @@ module BABYLON {
          * @param defines the list of defines currently in use
          */
         public static PrepareUniforms(uniforms: string[], defines: IImageProcessingConfigurationDefines): void {
+            uniforms.push("exposureLinear");
             if (defines.CONTRAST) {
                 uniforms.push("contrast");
             }
-            if (defines.TONEMAPPING) {
-                uniforms.push("cameraExposureLinear");
-            }
             if (defines.COLORGRADING) {
                 uniforms.push("colorTransformSettings");
             }
@@ -317,7 +315,7 @@ module BABYLON {
             defines.VIGNETTEBLENDMODEMULTIPLY = (this.vignetteBlendMode === ImageProcessingConfiguration._VIGNETTEMODE_MULTIPLY);
             defines.VIGNETTEBLENDMODEOPAQUE = !defines.VIGNETTEBLENDMODEMULTIPLY;
             defines.TONEMAPPING = this.toneMappingEnabled;
-            defines.CONTRAST = (this.cameraContrast !== 1.0);
+            defines.CONTRAST = (this.contrast !== 1.0);
             defines.COLORCURVES = (this.colorCurvesEnabled && !!this.colorCurves);
             defines.COLORGRADING = (this.colorGradingEnabled && !!this.colorGradingTexture);
             defines.SAMPLER3DGREENDEPTH = this.colorGradingWithGreenDepth;
@@ -350,7 +348,7 @@ module BABYLON {
                 var inverseHeight = 1 / effect.getEngine().getRenderHeight();
                 effect.setFloat2("vInverseScreenSize", inverseWidth, inverseHeight);
 
-                let vignetteScaleY = Math.tan(this.cameraFov * 0.5);
+                let vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);
                 let vignetteScaleX = vignetteScaleY * aspectRatio;
 
                 let vignetteScaleGeometricMean = Math.sqrt(vignetteScaleX * vignetteScaleY);
@@ -364,10 +362,10 @@ module BABYLON {
             }
 
             // Exposure
-            effect.setFloat("cameraExposureLinear", Math.pow(2.0, -this.cameraExposure) * Math.PI);
+            effect.setFloat("exposureLinear", Math.pow(2.0, -this.exposure) * Math.PI);
             
             // Contrast
-            effect.setFloat("contrast", this.cameraContrast);
+            effect.setFloat("contrast", this.contrast);
             
             // Color transform settings
             if (this.colorGradingTexture) {

+ 5 - 7
src/Materials/babylon.standardMaterial.ts

@@ -382,7 +382,7 @@ module BABYLON {
          * This corresponds to a photographic exposure.
          */
         public get cameraExposure(): number {
-            return this._imageProcessingConfiguration.cameraExposure;
+            return this._imageProcessingConfiguration.exposure;
         };
         /**
          * The camera exposure used on this material.
@@ -390,21 +390,21 @@ module BABYLON {
          * This corresponds to a photographic exposure.
          */
         public set cameraExposure(value: number) {
-            this._imageProcessingConfiguration.cameraExposure = value;
+            this._imageProcessingConfiguration.exposure = value;
         };
         
         /**
          * Gets The camera contrast used on this material.
          */
         public get cameraContrast(): number {
-            return this._imageProcessingConfiguration.cameraContrast;
+            return this._imageProcessingConfiguration.contrast;
         }
 
         /**
          * Sets The camera contrast used on this material.
          */
         public set cameraContrast(value: number) {
-            this._imageProcessingConfiguration.cameraContrast = value;
+            this._imageProcessingConfiguration.contrast = value;
         }
         
         /**
@@ -1127,9 +1127,7 @@ module BABYLON {
                 MaterialHelper.BindLogDepth(defines, effect, scene);
 
                 // image processing
-                if (this.imageProcessingConfiguration) {
-                    this.imageProcessingConfiguration.bind(this._activeEffect);
-                }
+                this._imageProcessingConfiguration.bind(this._activeEffect);
             }
 
             this._uniformBuffer.update();

+ 6 - 6
src/PostProcess/babylon.imageProcessingPostProcess.ts

@@ -116,13 +116,13 @@
          * Gets Camera exposure used in the effect.
          */
         public get cameraExposure(): number {
-            return this.imageProcessingConfiguration.cameraExposure;
+            return this.imageProcessingConfiguration.exposure;
         }
         /**
          * Sets Camera exposure used in the effect.
          */
         public set cameraExposure(value: number) {
-            this.imageProcessingConfiguration.cameraExposure = value;
+            this.imageProcessingConfiguration.exposure = value;
         }
 
         /**
@@ -142,13 +142,13 @@
          * Gets Camera contrast used in the effect.
          */
         public get cameraContrast(): number {
-            return this.imageProcessingConfiguration.cameraContrast;
+            return this.imageProcessingConfiguration.contrast;
         }
         /**
          * Sets Camera contrast used in the effect.
          */
         public set cameraContrast(value: number) {
-            this.imageProcessingConfiguration.cameraContrast = value;
+            this.imageProcessingConfiguration.contrast = value;
         }
 
         /**
@@ -222,13 +222,13 @@
          * Gets Camera field of view used by the Vignette effect.
          */
         public get cameraFov(): number {
-            return this.imageProcessingConfiguration.cameraFov;
+            return this.imageProcessingConfiguration.vignetteCameraFov;
         }
         /**
          * Sets Camera field of view used by the Vignette effect.
          */
         public set cameraFov(value: number) {
-            this.imageProcessingConfiguration.cameraFov = value;
+            this.imageProcessingConfiguration.vignetteCameraFov = value;
         }
 
         /**

+ 1 - 1
src/Shaders/ShadersInclude/imageProcessingDeclaration.fx

@@ -1,4 +1,4 @@
-uniform float cameraExposureLinear;
+uniform float exposureLinear;
 
 #ifdef CONTRAST
 	uniform float contrast;

+ 1 - 1
src/Shaders/ShadersInclude/imageProcessingFunctions.fx

@@ -51,7 +51,7 @@ vec3 sampleTexture3D(sampler2D colorTransform, vec3 color, vec2 sampler3dSetting
 
 vec4 applyImageProcessing(vec4 result) {
 
-	result.rgb *= cameraExposureLinear;
+	result.rgb *= exposureLinear;
 
 #ifdef VIGNETTE
 		//vignette