Преглед на файлове

Review Comments: Move ImageProcessingConfiguration to the bas class

sebastien преди 7 години
родител
ревизия
1a0ba15a3b
променени са 3 файла, в които са добавени 51 реда и са изтрити 86 реда
  1. 50 1
      src/Particles/babylon.baseParticleSystem.ts
  2. 1 43
      src/Particles/babylon.gpuParticleSystem.ts
  3. 0 42
      src/Particles/babylon.particleSystem.ts

+ 50 - 1
src/Particles/babylon.baseParticleSystem.ts

@@ -415,7 +415,56 @@ module BABYLON {
 
             this._isBillboardBased = value;
             this._reset();
-        }     
+        }
+
+        /**
+         * The scene the particle system belongs to.
+         */
+        protected _scene: Scene;
+
+        /**
+         * Local cache of defines for image processing.
+         */
+        protected _imageProcessingConfigurationDefines = new ImageProcessingConfigurationDefines();
+
+        /**
+         * Default configuration related to image processing available in the standard Material.
+         */
+        protected _imageProcessingConfiguration: ImageProcessingConfiguration;
+
+        /**
+         * Gets the image processing configuration used either in this material.
+         */
+        public get imageProcessingConfiguration(): ImageProcessingConfiguration {
+            return this._imageProcessingConfiguration;
+        }
+
+        /**
+         * Sets the Default image processing configuration used either in the this material.
+         * 
+         * If sets to null, the scene one is in use.
+         */
+        public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {
+            this._attachImageProcessingConfiguration(value);
+        }
+
+        /**
+         * Attaches a new image processing configuration to the Standard Material.
+         * @param configuration 
+         */
+        protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void {
+            if (configuration === this._imageProcessingConfiguration) {
+                return;
+            }
+
+            // Pick the scene configuration if needed.
+            if (!configuration) {
+                this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;
+            }
+            else {
+                this._imageProcessingConfiguration = configuration;
+            }
+        }
 
         /** @hidden */
         protected _reset() {

+ 1 - 43
src/Particles/babylon.gpuParticleSystem.ts

@@ -27,7 +27,6 @@
         private _sourceBuffer: Buffer;
         private _targetBuffer: Buffer;
 
-        private _scene: Scene;
         private _engine: Engine;
 
         private _currentRenderId = -1;    
@@ -392,48 +391,7 @@
             this._removeGradient(gradient, this._limitVelocityGradients, this._limitVelocityGradientsTexture);
             (<any>this._limitVelocityGradientsTexture) = null;
 
-            return this;           
-        }
-
-        private _imageProcessingConfigurationDefines = new ImageProcessingConfigurationDefines();
-
-        /**
-         * Default configuration related to image processing available in the standard Material.
-         */
-        protected _imageProcessingConfiguration: ImageProcessingConfiguration;
-
-        /**
-         * Gets the image processing configuration used either in this material.
-         */
-        public get imageProcessingConfiguration(): ImageProcessingConfiguration {
-            return this._imageProcessingConfiguration;
-        }
-
-        /**
-         * Sets the Default image processing configuration used either in the this material.
-         * 
-         * If sets to null, the scene one is in use.
-         */
-        public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {
-            this._attachImageProcessingConfiguration(value);
-        }
-
-        /**
-         * Attaches a new image processing configuration to the Standard Material.
-         * @param configuration 
-         */
-        protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void {
-            if (configuration === this._imageProcessingConfiguration) {
-                return;
-            }
-
-            // Pick the scene configuration if needed.
-            if (!configuration) {
-                this._imageProcessingConfiguration = this._scene.imageProcessingConfiguration;
-            }
-            else {
-                this._imageProcessingConfiguration = configuration;
-            }
+            return this;
         }
 
         /**

+ 0 - 42
src/Particles/babylon.particleSystem.ts

@@ -56,7 +56,6 @@
         private _particles = new Array<Particle>();
         private _epsilon: number;
         private _capacity: number;
-        private _scene: Scene;
         private _stockParticles = new Array<Particle>();
         private _newPartsExcess = 0;
         private _vertexData: Float32Array;
@@ -111,47 +110,6 @@
             return "ParticleSystem";
         }
 
-        private _imageProcessingConfigurationDefines = new ImageProcessingConfigurationDefines();
-
-        /**
-         * Default configuration related to image processing available in the standard Material.
-         */
-        protected _imageProcessingConfiguration: ImageProcessingConfiguration;
-
-        /**
-         * Gets the image processing configuration used either in this material.
-         */
-        public get imageProcessingConfiguration(): ImageProcessingConfiguration {
-            return this._imageProcessingConfiguration;
-        }
-
-        /**
-         * Sets the Default image processing configuration used either in the this material.
-         * 
-         * If sets to null, the scene one is in use.
-         */
-        public set imageProcessingConfiguration(value: ImageProcessingConfiguration) {
-            this._attachImageProcessingConfiguration(value);
-        }
-
-        /**
-         * Attaches a new image processing configuration to the Standard Material.
-         * @param configuration 
-         */
-        protected _attachImageProcessingConfiguration(configuration: Nullable<ImageProcessingConfiguration>): void {
-            if (configuration === this._imageProcessingConfiguration) {
-                return;
-            }
-
-            // Pick the scene configuration if needed.
-            if (!configuration) {
-                this._imageProcessingConfiguration = this.getScene().imageProcessingConfiguration;
-            }
-            else {
-                this._imageProcessingConfiguration = configuration;
-            }
-        }
-
         /**
          * Instantiates a particle system.
          * Particles are often small sprites used to simulate hard-to-reproduce phenomena like fire, smoke, water, or abstract visual effects like magic glitter and faery dust.