瀏覽代碼

Better gradient support when there is only one gradient

David Catuhe 7 年之前
父節點
當前提交
ddd10e14fa

文件差異過大導致無法顯示
+ 9291 - 9291
dist/preview release/babylon.d.ts


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.js


+ 4 - 0
dist/preview release/babylon.max.js

@@ -10113,6 +10113,10 @@ var BABYLON;
          * @param updateFunc defines the callback function used to get the final value from the selected gradients
          */
         Tools.GetCurrentGradient = function (ratio, gradients, updateFunc) {
+            if (gradients.length === 1) {
+                updateFunc(gradients[0], gradients[0], 0);
+                return;
+            }
             for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {
                 var currentGradient = gradients[gradientIndex];
                 var nextGradient = gradients[gradientIndex + 1];

+ 4 - 0
dist/preview release/babylon.no-module.max.js

@@ -10080,6 +10080,10 @@ var BABYLON;
          * @param updateFunc defines the callback function used to get the final value from the selected gradients
          */
         Tools.GetCurrentGradient = function (ratio, gradients, updateFunc) {
+            if (gradients.length === 1) {
+                updateFunc(gradients[0], gradients[0], 0);
+                return;
+            }
             for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {
                 var currentGradient = gradients[gradientIndex];
                 var nextGradient = gradients[gradientIndex + 1];

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/babylon.worker.js


+ 4 - 0
dist/preview release/es6.js

@@ -10080,6 +10080,10 @@ var BABYLON;
          * @param updateFunc defines the callback function used to get the final value from the selected gradients
          */
         Tools.GetCurrentGradient = function (ratio, gradients, updateFunc) {
+            if (gradients.length === 1) {
+                updateFunc(gradients[0], gradients[0], 0);
+                return;
+            }
             for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {
                 var currentGradient = gradients[gradientIndex];
                 var nextGradient = gradients[gradientIndex + 1];

文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.js


文件差異過大導致無法顯示
+ 1 - 1
dist/preview release/viewer/babylon.viewer.max.js


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

@@ -35,6 +35,7 @@
   - Added support for velocty gradients. [Doc](https://doc.babylonjs.com/babylon101/particles#velocity-over-time)
   - Added support for limit velocty gradients. [Doc](https://doc.babylonjs.com/babylon101/particles#limit-velocity-over-time)
   - Added support for noise textures. [Doc](http://doc.babylonjs.com/babylon101/particles#noise-texture)
+  - Added support for emit rate gradients. [Doc](http://doc.babylonjs.com/babylon101/particles#emit-rate-over-time)
 - Added SceneComponent to help decoupling Scene from its components. ([sebavan](http://www.github.com/sebavan))
 - Added [Environment Texture Tools](https://doc.babylonjs.com/how_to/physically_based_rendering#creating-a-compressed-environment-texture) to reduce the size of the usual .DDS file ([sebavan](http://www.github.com/sebavan))
 - Playground can now be used with TypeScript directly!. [Demo](https://www.babylonjs-playground.com/ts.html) ([Deltakosh](https://github.com/deltakosh), [NasimiAsl](https://github.com/NasimiAsl))

+ 5 - 0
src/Tools/babylon.tools.ts

@@ -1744,6 +1744,11 @@
          * @param updateFunc defines the callback function used to get the final value from the selected gradients
          */
         public static GetCurrentGradient(ratio: number, gradients: IValueGradient[], updateFunc: (current: IValueGradient, next: IValueGradient, scale: number) => void) {
+            if (gradients.length === 1) {
+                updateFunc(gradients[0], gradients[0], 0);
+                return;
+            }
+
             for (var gradientIndex = 0; gradientIndex < gradients.length - 1; gradientIndex++) {
                 let currentGradient = gradients[gradientIndex];
                 let nextGradient = gradients[gradientIndex + 1];