소스 검색

rename quality to blurlevel

Trevor Baron 7 년 전
부모
커밋
1b31e9187f

+ 8 - 8
src/PostProcess/RenderPipeline/Pipelines/babylon.defaultRenderingPipeline.ts

@@ -85,7 +85,7 @@
         // Values       
         private _bloomEnabled: boolean = false;
         private _depthOfFieldEnabled: boolean = false;
-        private _depthOfFieldQuality = DepthOfFieldEffectQuality.Low;
+        private _depthOfFieldBlurLevel = DepthOfFieldEffectBlurLevel.Low;
         private _fxaaEnabled: boolean = false;
         private _imageProcessingEnabled: boolean = true;
         private _defaultPipelineTextureType: number;
@@ -179,18 +179,18 @@
         }
 
         /**
-         * Quality of the depth of field effect. (Higher quality will effect performance)
+         * Blur level of the depth of field effect. (Higher blur will effect performance)
          */
         @serialize()
-        public get depthOfFieldQuality(): DepthOfFieldEffectQuality {
-            return this._depthOfFieldQuality;
+        public get depthOfFieldBlurLevel(): DepthOfFieldEffectBlurLevel {
+            return this._depthOfFieldBlurLevel;
         }   
         
-        public set depthOfFieldQuality(value: DepthOfFieldEffectQuality) {
-            if (this._depthOfFieldQuality === value) {
+        public set depthOfFieldBlurLevel(value: DepthOfFieldEffectBlurLevel) {
+            if (this._depthOfFieldBlurLevel === value) {
                 return;
             }
-            this._depthOfFieldQuality = value;
+            this._depthOfFieldBlurLevel = value;
             this._buildPipeline();
         }
 
@@ -286,7 +286,7 @@
             this._reset();
 
             if(this.depthOfFieldEnabled){
-                this.depthOfField = new DepthOfFieldEffect(this._scene, this._depthOfFieldQuality, this._defaultPipelineTextureType);
+                this.depthOfField = new DepthOfFieldEffect(this._scene, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType);
                 this.addEffect(this.depthOfField);
             }
 

+ 5 - 5
src/PostProcess/babylon.depthOfFieldEffect.ts

@@ -1,5 +1,5 @@
 module BABYLON {
-    export enum DepthOfFieldEffectQuality {
+    export enum DepthOfFieldEffectBlurLevel {
         Low,
         Medium,
         High
@@ -56,7 +56,7 @@ module BABYLON {
          * @param scene The scene the effect belongs to.
          * @param pipelineTextureType The type of texture to be used when performing the post processing.
          */
-        constructor(scene: Scene, quality: DepthOfFieldEffectQuality = DepthOfFieldEffectQuality.Low, pipelineTextureType = 0) {
+        constructor(scene: Scene, blurLevel: DepthOfFieldEffectBlurLevel = DepthOfFieldEffectBlurLevel.Low, pipelineTextureType = 0) {
             super(scene.getEngine(), "depth of field", ()=>{
                 // Enable and get current depth map
                 var depthMap = scene.enableDepthRenderer().getDepthMap();
@@ -73,13 +73,13 @@ module BABYLON {
                 this._depthOfFieldBlurX = []
                 var blurCount = 1;
                 var kernelSize = 15;
-                switch(quality){
-                    case DepthOfFieldEffectQuality.High: {
+                switch(blurLevel){
+                    case DepthOfFieldEffectBlurLevel.High: {
                         blurCount = 3;
                         kernelSize = 51;
                         break;
                     }
-                    case DepthOfFieldEffectQuality.Medium: {
+                    case DepthOfFieldEffectBlurLevel.Medium: {
                         blurCount = 2;
                         kernelSize = 31;
                         break;

+ 1 - 1
src/PostProcess/babylon.depthOfFieldMergePostProcess.ts

@@ -17,7 +17,7 @@ module BABYLON {
          * @param textureType Type of textures used when performing the post process. (default: 0)
          */
         constructor(name: string, original: PostProcess, circleOfConfusion: PostProcess, blurSteps: Array<PostProcess>, options: number | PostProcessOptions, camera: Nullable<Camera>, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
-            super(name, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "originalSampler", "blurStep1", "blurStep2"], options, camera, samplingMode, engine, reusable, "#define QUALITY "+blurSteps.length+"\n", textureType);
+            super(name, "depthOfFieldMerge", [], ["circleOfConfusionSampler", "originalSampler", "blurStep1", "blurStep2"], options, camera, samplingMode, engine, reusable, "#define BLUR_LEVEL "+blurSteps.length+"\n", textureType);
             this.onApplyObservable.add((effect: Effect) => {
                 effect.setTextureFromPostProcess("circleOfConfusionSampler", circleOfConfusion);
                 effect.setTextureFromPostProcess("originalSampler", original);

+ 5 - 5
src/Shaders/depthOfFieldMerge.fragment.fx

@@ -3,10 +3,10 @@ uniform sampler2D textureSampler;
 uniform sampler2D originalSampler;
 uniform sampler2D circleOfConfusionSampler;
 
-#if QUALITY > 0
+#if BLUR_LEVEL > 0
 uniform sampler2D blurStep1;
 #endif
-#if QUALITY > 1
+#if BLUR_LEVEL > 1
 uniform sampler2D blurStep2;
 #endif
 // varyings
@@ -16,11 +16,11 @@ void main(void)
 {
     float coc = texture2D(circleOfConfusionSampler, vUV).r;
     vec4 original = texture2D(originalSampler, vUV);
-#if QUALITY == 0
+#if BLUR_LEVEL == 0
     vec4 blurred1 = texture2D(textureSampler, vUV);
     gl_FragColor = mix(original, blurred1, coc);
 #endif
-#if QUALITY == 1
+#if BLUR_LEVEL == 1
     vec4 blurred1 = texture2D(blurStep1, vUV);
     vec4 blurred2 = texture2D(textureSampler, vUV);    
     if(coc < 0.5){
@@ -29,7 +29,7 @@ void main(void)
         gl_FragColor = mix(blurred1, blurred2, (coc-0.5)/0.5);
     }
 #endif
-#if QUALITY == 2
+#if BLUR_LEVEL == 2
     vec4 blurred1 = texture2D(blurStep1, vUV);
     vec4 blurred2 = texture2D(blurStep2, vUV);
     vec4 blurred3 = texture2D(textureSampler, vUV);