浏览代码

Fix 3dl ColorGrading Texture

sebastien 7 年之前
父节点
当前提交
3afba78dac

文件差异内容过多而无法显示
+ 4099 - 0
Playground/textures/invert.3dl


+ 17 - 6
src/Materials/Textures/babylon.colorGradingTexture.ts

@@ -135,13 +135,24 @@ module BABYLON {
                             tempData[pixelStorageIndex + 2] = b;
                             tempData[pixelStorageIndex + 2] = b;
                         }
                         }
 
 
-                        pixelIndexSlice++;
-                        if (pixelIndexSlice % size == 0) {
-                            pixelIndexH++;
-                            pixelIndexSlice = 0;
-                            if (pixelIndexH % size == 0) {
+                        // Keep for reference in case of back compat problems.
+                        // pixelIndexSlice++;
+                        // if (pixelIndexSlice % size == 0) {
+                        //     pixelIndexH++;
+                        //     pixelIndexSlice = 0;
+                        //     if (pixelIndexH % size == 0) {
+                        //         pixelIndexW++;
+                        //         pixelIndexH = 0;
+                        //     }
+                        // }
+
+                        pixelIndexH++
+                        if (pixelIndexH % size == 0) {
+                            pixelIndexSlice++;
+                            pixelIndexH = 0;
+                            if (pixelIndexSlice % size == 0) {
                                 pixelIndexW++;
                                 pixelIndexW++;
-                                pixelIndexH = 0;
+                                pixelIndexSlice = 0;
                             }
                             }
                         }
                         }
                     }
                     }

+ 16 - 2
src/Materials/babylon.imageProcessingConfiguration.ts

@@ -90,11 +90,25 @@ module BABYLON {
             this._updateParameters();
             this._updateParameters();
         }
         }
 
 
+        @serializeAsTexture("colorGradingTexture")
+        private _colorGradingTexture: Nullable<BaseTexture>;
         /**
         /**
          * Color grading LUT texture used in the effect if colorGradingEnabled is set to true 
          * Color grading LUT texture used in the effect if colorGradingEnabled is set to true 
          */
          */
-        @serializeAsTexture()
-        public colorGradingTexture: Nullable<BaseTexture>;
+        public get colorGradingTexture(): Nullable<BaseTexture> {
+            return this._colorGradingTexture;
+        }
+        /**
+         * Color grading LUT texture used in the effect if colorGradingEnabled is set to true 
+         */
+        public set colorGradingTexture(value: Nullable<BaseTexture>) {
+            if (this._colorGradingTexture === value) {
+                return;
+            }
+
+            this._colorGradingTexture = value;
+            this._updateParameters();
+        }
 
 
         @serialize()
         @serialize()
         private _colorGradingEnabled = false;
         private _colorGradingEnabled = false;

二进制
tests/validation/ReferenceImages/colorGrading.png


+ 5 - 0
tests/validation/config.json

@@ -2,6 +2,11 @@
   "root": "https://rawgit.com/BabylonJS/Website/master",
   "root": "https://rawgit.com/BabylonJS/Website/master",
   "tests": [
   "tests": [
     {
     {
+      "title": "Color Grading",
+      "playgroundId": "#8EDB5N#2",
+      "referenceImage": "colorGrading.png"
+    },
+    {
       "title": "Ribbon morphing",
       "title": "Ribbon morphing",
       "playgroundId": "#ACKC2#1",
       "playgroundId": "#ACKC2#1",
       "renderCount": 50,
       "renderCount": 50,