瀏覽代碼

Merge remote-tracking branch 'BabylonJS/master'

MackeyK24 8 年之前
父節點
當前提交
5e158afce4
共有 100 個文件被更改,包括 23683 次插入22740 次删除
  1. 1 0
      Tools/Gulp/config.json
  2. 6045 5987
      dist/preview release/babylon.d.ts
  3. 42 42
      dist/preview release/babylon.js
  4. 342 154
      dist/preview release/babylon.max.js
  5. 6045 5987
      dist/preview release/babylon.module.d.ts
  6. 43 43
      dist/preview release/babylon.worker.js
  7. 5086 5028
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  8. 30 30
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  9. 332 144
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  10. 5086 5028
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  11. 25 0
      dist/preview release/gui/babylon.gui.d.ts
  12. 186 9
      dist/preview release/gui/babylon.gui.js
  13. 3 3
      dist/preview release/gui/babylon.gui.min.js
  14. 1 1
      dist/preview release/inspector/babylon.inspector.bundle.js
  15. 1 1
      dist/preview release/inspector/babylon.inspector.js
  16. 1 1
      dist/preview release/inspector/babylon.inspector.min.js
  17. 1 0
      dist/preview release/materialsLibrary/babylon.cellMaterial.d.ts
  18. 3 0
      dist/preview release/materialsLibrary/babylon.cellMaterial.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.cellMaterial.min.js
  20. 1 0
      dist/preview release/materialsLibrary/babylon.fireMaterial.d.ts
  21. 3 0
      dist/preview release/materialsLibrary/babylon.fireMaterial.js
  22. 1 1
      dist/preview release/materialsLibrary/babylon.fireMaterial.min.js
  23. 1 0
      dist/preview release/materialsLibrary/babylon.furMaterial.d.ts
  24. 3 0
      dist/preview release/materialsLibrary/babylon.furMaterial.js
  25. 1 1
      dist/preview release/materialsLibrary/babylon.furMaterial.min.js
  26. 1 0
      dist/preview release/materialsLibrary/babylon.gradientMaterial.d.ts
  27. 3 0
      dist/preview release/materialsLibrary/babylon.gradientMaterial.js
  28. 1 1
      dist/preview release/materialsLibrary/babylon.gradientMaterial.min.js
  29. 1 0
      dist/preview release/materialsLibrary/babylon.gridMaterial.d.ts
  30. 3 0
      dist/preview release/materialsLibrary/babylon.gridMaterial.js
  31. 1 1
      dist/preview release/materialsLibrary/babylon.gridMaterial.min.js
  32. 1 0
      dist/preview release/materialsLibrary/babylon.lavaMaterial.d.ts
  33. 3 0
      dist/preview release/materialsLibrary/babylon.lavaMaterial.js
  34. 1 1
      dist/preview release/materialsLibrary/babylon.lavaMaterial.min.js
  35. 1 0
      dist/preview release/materialsLibrary/babylon.normalMaterial.d.ts
  36. 3 0
      dist/preview release/materialsLibrary/babylon.normalMaterial.js
  37. 1 1
      dist/preview release/materialsLibrary/babylon.normalMaterial.min.js
  38. 1 0
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.d.ts
  39. 3 0
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.js
  40. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  41. 1 0
      dist/preview release/materialsLibrary/babylon.simpleMaterial.d.ts
  42. 3 0
      dist/preview release/materialsLibrary/babylon.simpleMaterial.js
  43. 1 1
      dist/preview release/materialsLibrary/babylon.simpleMaterial.min.js
  44. 1 0
      dist/preview release/materialsLibrary/babylon.skyMaterial.d.ts
  45. 3 0
      dist/preview release/materialsLibrary/babylon.skyMaterial.js
  46. 1 1
      dist/preview release/materialsLibrary/babylon.skyMaterial.min.js
  47. 1 0
      dist/preview release/materialsLibrary/babylon.terrainMaterial.d.ts
  48. 3 0
      dist/preview release/materialsLibrary/babylon.terrainMaterial.js
  49. 1 1
      dist/preview release/materialsLibrary/babylon.terrainMaterial.min.js
  50. 1 0
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.d.ts
  51. 3 0
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.js
  52. 1 1
      dist/preview release/materialsLibrary/babylon.triPlanarMaterial.min.js
  53. 1 0
      dist/preview release/materialsLibrary/babylon.waterMaterial.d.ts
  54. 3 0
      dist/preview release/materialsLibrary/babylon.waterMaterial.js
  55. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  56. 1 0
      dist/preview release/what's new.md
  57. 2 2
      gui/src/advancedDynamicTexture.ts
  58. 1 1
      gui/src/controls/button.ts
  59. 3 3
      gui/src/controls/container.ts
  60. 17 3
      gui/src/controls/control.ts
  61. 1 1
      inspector/src/helpers/Helpers.ts
  62. 4 0
      materialsLibrary/src/cell/babylon.cellMaterial.ts
  63. 4 0
      materialsLibrary/src/fire/babylon.fireMaterial.ts
  64. 4 0
      materialsLibrary/src/fur/babylon.furMaterial.ts
  65. 4 0
      materialsLibrary/src/gradient/babylon.gradientMaterial.ts
  66. 4 0
      materialsLibrary/src/grid/babylon.gridmaterial.ts
  67. 4 0
      materialsLibrary/src/lava/babylon.lavaMaterial.ts
  68. 4 0
      materialsLibrary/src/normal/babylon.normalMaterial.ts
  69. 4 0
      materialsLibrary/src/shadowOnly/babylon.shadowOnlyMaterial.ts
  70. 4 0
      materialsLibrary/src/simple/babylon.simpleMaterial.ts
  71. 4 0
      materialsLibrary/src/sky/babylon.skyMaterial.ts
  72. 4 0
      materialsLibrary/src/terrain/babylon.terrainMaterial.ts
  73. 4 0
      materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts
  74. 4 0
      materialsLibrary/src/water/babylon.waterMaterial.ts
  75. 2 2
      src/Cameras/Inputs/babylon.arcRotateCameraGamepadInput.ts
  76. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraKeyboardMoveInput.ts
  77. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraMouseWheelInput.ts
  78. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts
  79. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraVRDeviceOrientationInput.ts
  80. 1 1
      src/Cameras/Inputs/babylon.freeCameraDeviceOrientationInput.ts
  81. 1 1
      src/Cameras/Inputs/babylon.freeCameraGamepadInput.ts
  82. 1 1
      src/Cameras/Inputs/babylon.freeCameraKeyboardMoveInput.ts
  83. 3 3
      src/Cameras/Inputs/babylon.freeCameraMouseInput.ts
  84. 1 1
      src/Cameras/Inputs/babylon.freeCameraTouchInput.ts
  85. 1 1
      src/Cameras/Inputs/babylon.freeCameraVirtualJoystickInput.ts
  86. 4 4
      src/Cameras/babylon.cameraInputsManager.ts
  87. 3 1
      src/Materials/PBR/babylon.pbrBaseMaterial.ts
  88. 4 0
      src/Materials/PBR/babylon.pbrBaseSimpleMaterial.ts
  89. 4 0
      src/Materials/Textures/babylon.baseTexture.ts
  90. 4 0
      src/Materials/Textures/babylon.texture.ts
  91. 4 0
      src/Materials/babylon.colorCurves.ts
  92. 4 0
      src/Materials/babylon.imageProcessingConfiguration.ts
  93. 193 0
      src/Math/babylon.math.scalar.ts
  94. 13 223
      src/Math/babylon.math.ts
  95. 3 3
      src/Mesh/babylon.geometry.ts
  96. 13 9
      src/Mesh/babylon.mesh.ts
  97. 4 4
      src/Mesh/babylon.mesh.vertexData.ts
  98. 1 1
      src/PostProcess/RenderPipeline/Pipelines/babylon.standardRenderingPipeline.ts
  99. 4 0
      src/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.ts
  100. 0 0
      src/PostProcess/babylon.imageProcessingPostProcess.ts

+ 1 - 0
Tools/Gulp/config.json

@@ -46,6 +46,7 @@
         {
             "files":[
                 "../../src/Math/babylon.math.js",
+                "../../src/Math/babylon.math.scalar.js",
                 "../../src/babylon.mixins.js",
                 "../../src/Tools/babylon.decorators.js",
                 "../../src/Tools/babylon.observable.js",

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


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


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


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


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


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


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


+ 332 - 144
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -19,91 +19,6 @@ var __extends = (this && this.__extends) || (function () {
     BABYLON.ToGammaSpace = 1 / 2.2;
     BABYLON.ToLinearSpace = 2.2;
     BABYLON.Epsilon = 0.001;
-    var MathTools = (function () {
-        function MathTools() {
-        }
-        /**
-         * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
-         */
-        MathTools.WithinEpsilon = function (a, b, epsilon) {
-            if (epsilon === void 0) { epsilon = 1.401298E-45; }
-            var num = a - b;
-            return -epsilon <= num && num <= epsilon;
-        };
-        /**
-         * Returns a string : the upper case translation of the number i to hexadecimal.
-         */
-        MathTools.ToHex = function (i) {
-            var str = i.toString(16);
-            if (i <= 15) {
-                return ("0" + str).toUpperCase();
-            }
-            return str.toUpperCase();
-        };
-        /**
-         * Returns -1 if value is negative and +1 is value is positive.
-         * Returns the value itself if it's equal to zero.
-         */
-        MathTools.Sign = function (value) {
-            value = +value; // convert to a number
-            if (value === 0 || isNaN(value))
-                return value;
-            return value > 0 ? 1 : -1;
-        };
-        /**
-         * Returns the value itself if it's between min and max.
-         * Returns min if the value is lower than min.
-         * Returns max if the value is greater than max.
-         */
-        MathTools.Clamp = function (value, min, max) {
-            if (min === void 0) { min = 0; }
-            if (max === void 0) { max = 1; }
-            return Math.min(max, Math.max(min, value));
-        };
-        /**
-         * Returns the log2 of value.
-         */
-        MathTools.Log2 = function (value) {
-            return Math.log(value) * Math.LOG2E;
-        };
-        /**
-         * Loops the value, so that it is never larger than length and never smaller than 0.
-         *
-         * This is similar to the modulo operator but it works with floating point numbers.
-         * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
-         * With t = 5 and length = 2.5, the result would be 0.0.
-         * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
-         */
-        MathTools.Repeat = function (value, length) {
-            return value - Math.floor(value / length) * length;
-        };
-        return MathTools;
-    }());
-    BABYLON.MathTools = MathTools;
-    var Scalar = (function () {
-        function Scalar() {
-        }
-        /**
-         * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
-         */
-        Scalar.Lerp = function (start, end, amount) {
-            return start + ((end - start) * amount);
-        };
-        /**
-         * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
-         */
-        Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {
-            var squared = amount * amount;
-            var cubed = amount * squared;
-            var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
-            var part2 = (-2.0 * cubed) + (3.0 * squared);
-            var part3 = (cubed - (2.0 * squared)) + amount;
-            var part4 = cubed - squared;
-            return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
-        };
-        return Scalar;
-    }());
-    BABYLON.Scalar = Scalar;
     var Color3 = (function () {
         /**
          * Creates a new Color3 object from red, green, blue values, all between 0 and 1.
@@ -290,7 +205,7 @@ var __extends = (this && this.__extends) || (function () {
             var intR = (this.r * 255) | 0;
             var intG = (this.g * 255) | 0;
             var intB = (this.b * 255) | 0;
-            return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB);
+            return "#" + BABYLON.Scalar.ToHex(intR) + BABYLON.Scalar.ToHex(intG) + BABYLON.Scalar.ToHex(intB);
         };
         /**
          * Returns a new Color3 converted to linear space.
@@ -552,7 +467,7 @@ var __extends = (this && this.__extends) || (function () {
             var intG = (this.g * 255) | 0;
             var intB = (this.b * 255) | 0;
             var intA = (this.a * 255) | 0;
-            return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB) + MathTools.ToHex(intA);
+            return "#" + BABYLON.Scalar.ToHex(intR) + BABYLON.Scalar.ToHex(intG) + BABYLON.Scalar.ToHex(intB) + BABYLON.Scalar.ToHex(intA);
         };
         /**
          * Returns a new Color4 converted to linear space.
@@ -858,7 +773,7 @@ var __extends = (this && this.__extends) || (function () {
          */
         Vector2.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
-            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon);
+            return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
         };
         // Properties
         /**
@@ -1245,7 +1160,7 @@ var __extends = (this && this.__extends) || (function () {
          */
         Vector3.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
-            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon) && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon);
+            return otherVector && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon) && BABYLON.Scalar.WithinEpsilon(this.z, otherVector.z, epsilon);
         };
         /**
          * Boolean : True if the current Vector3 coordinate equal the passed floats.
@@ -1663,7 +1578,7 @@ var __extends = (this && this.__extends) || (function () {
             source.y = -(source.y / viewportHeight * 2 - 1);
             var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
-            if (MathTools.WithinEpsilon(num, 1.0)) {
+            if (BABYLON.Scalar.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
             return vector;
@@ -1676,7 +1591,7 @@ var __extends = (this && this.__extends) || (function () {
             var screenSource = new Vector3(source.x / viewportWidth * 2 - 1, -(source.y / viewportHeight * 2 - 1), 2 * source.z - 1.0);
             var vector = Vector3.TransformCoordinates(screenSource, matrix);
             var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
-            if (MathTools.WithinEpsilon(num, 1.0)) {
+            if (BABYLON.Scalar.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
             return vector;
@@ -1912,10 +1827,10 @@ var __extends = (this && this.__extends) || (function () {
         Vector4.prototype.equalsWithEpsilon = function (otherVector, epsilon) {
             if (epsilon === void 0) { epsilon = BABYLON.Epsilon; }
             return otherVector
-                && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon)
-                && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon)
-                && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon)
-                && MathTools.WithinEpsilon(this.w, otherVector.w, epsilon);
+                && BABYLON.Scalar.WithinEpsilon(this.x, otherVector.x, epsilon)
+                && BABYLON.Scalar.WithinEpsilon(this.y, otherVector.y, epsilon)
+                && BABYLON.Scalar.WithinEpsilon(this.z, otherVector.z, epsilon)
+                && BABYLON.Scalar.WithinEpsilon(this.w, otherVector.w, epsilon);
         };
         /**
          * Boolean : True if the passed floats are strictly equal to the current Vector4 coordinates.
@@ -4542,13 +4457,13 @@ var __extends = (this && this.__extends) || (function () {
             }
             if (va === undefined || va === null) {
                 var point;
-                if (!MathTools.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, BABYLON.Epsilon)) {
+                if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, BABYLON.Epsilon)) {
                     point = new Vector3(0.0, -1.0, 0.0);
                 }
-                else if (!MathTools.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, BABYLON.Epsilon)) {
+                else if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, BABYLON.Epsilon)) {
                     point = new Vector3(1.0, 0.0, 0.0);
                 }
-                else if (!MathTools.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, BABYLON.Epsilon)) {
+                else if (!BABYLON.Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, BABYLON.Epsilon)) {
                     point = new Vector3(0.0, 0.0, 1.0);
                 }
                 normal0 = Vector3.Cross(vt, point);
@@ -4751,19 +4666,250 @@ var __extends = (this && this.__extends) || (function () {
 
 //# sourceMappingURL=babylon.math.js.map
 
+var BABYLON;
+(function (BABYLON) {
+    var Scalar = (function () {
+        function Scalar() {
+        }
+        /**
+         * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
+         */
+        Scalar.WithinEpsilon = function (a, b, epsilon) {
+            if (epsilon === void 0) { epsilon = 1.401298E-45; }
+            var num = a - b;
+            return -epsilon <= num && num <= epsilon;
+        };
+        /**
+         * Returns a string : the upper case translation of the number i to hexadecimal.
+         */
+        Scalar.ToHex = function (i) {
+            var str = i.toString(16);
+            if (i <= 15) {
+                return ("0" + str).toUpperCase();
+            }
+            return str.toUpperCase();
+        };
+        /**
+         * Returns -1 if value is negative and +1 is value is positive.
+         * Returns the value itself if it's equal to zero.
+         */
+        Scalar.Sign = function (value) {
+            value = +value; // convert to a number
+            if (value === 0 || isNaN(value))
+                return value;
+            return value > 0 ? 1 : -1;
+        };
+        /**
+         * Returns the value itself if it's between min and max.
+         * Returns min if the value is lower than min.
+         * Returns max if the value is greater than max.
+         */
+        Scalar.Clamp = function (value, min, max) {
+            if (min === void 0) { min = 0; }
+            if (max === void 0) { max = 1; }
+            return Math.min(max, Math.max(min, value));
+        };
+        /**
+         * Returns the log2 of value.
+         */
+        Scalar.Log2 = function (value) {
+            return Math.log(value) * Math.LOG2E;
+        };
+        /**
+        * Loops the value, so that it is never larger than length and never smaller than 0.
+        *
+        * This is similar to the modulo operator but it works with floating point numbers.
+        * For example, using 3.0 for t and 2.5 for length, the result would be 0.5.
+        * With t = 5 and length = 2.5, the result would be 0.0.
+        * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
+        */
+        Scalar.Repeat = function (value, length) {
+            return value - Math.floor(value / length) * length;
+        };
+        /**
+        * Normalize the value between 0.0 and 1.0 using min and max values
+        */
+        Scalar.Normalize = function (value, min, max) {
+            return (value - min) / (max - min);
+        };
+        /**
+        * Denormalize the value from 0.0 and 1.0 using min and max values
+        */
+        Scalar.Denormalize = function (normalized, min, max) {
+            return (normalized * (max - min) + min);
+        };
+        /**
+        * Calculates the shortest difference between two given angles given in degrees.
+        */
+        Scalar.DeltaAngle = function (current, target) {
+            var num = Scalar.Repeat(target - current, 360.0);
+            if (num > 180.0) {
+                num -= 360.0;
+            }
+            return num;
+        };
+        /**
+        * PingPongs the value t, so that it is never larger than length and never smaller than 0.
+        *
+        * The returned value will move back and forth between 0 and length
+        */
+        Scalar.PingPong = function (tx, length) {
+            var t = Scalar.Repeat(tx, length * 2.0);
+            return length - Math.abs(t - length);
+        };
+        /**
+        * Interpolates between min and max with smoothing at the limits.
+        *
+        * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
+        * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
+        */
+        Scalar.SmoothStep = function (from, to, tx) {
+            var t = Scalar.Clamp(tx);
+            t = -2.0 * t * t * t + 3.0 * t * t;
+            return to * t + from * (1.0 - t);
+        };
+        /**
+        * Moves a value current towards target.
+        *
+        * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
+        * Negative values of maxDelta pushes the value away from target.
+        */
+        Scalar.MoveTowards = function (current, target, maxDelta) {
+            var result = 0;
+            if (Math.abs(target - current) <= maxDelta) {
+                result = target;
+            }
+            else {
+                result = current + Scalar.Sign(target - current) * maxDelta;
+            }
+            return result;
+        };
+        /**
+        * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
+        *
+        * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
+        *  are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
+        */
+        Scalar.MoveTowardsAngle = function (current, target, maxDelta) {
+            var num = Scalar.DeltaAngle(current, target);
+            var result = 0;
+            if (-maxDelta < num && num < maxDelta) {
+                result = target;
+            }
+            else {
+                target = current + num;
+                result = Scalar.MoveTowards(current, target, maxDelta);
+            }
+            return result;
+        };
+        /**
+            * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
+            */
+        Scalar.Lerp = function (start, end, amount) {
+            return start + ((end - start) * amount);
+        };
+        /**
+        * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
+        * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
+        */
+        Scalar.LerpAngle = function (start, end, amount) {
+            var num = Scalar.Repeat(end - start, 360.0);
+            if (num > 180.0) {
+                num -= 360.0;
+            }
+            return start + num * Scalar.Clamp(amount);
+        };
+        /**
+        * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
+        */
+        Scalar.InverseLerp = function (a, b, value) {
+            var result = 0;
+            if (a != b) {
+                result = Scalar.Clamp((value - a) / (b - a));
+            }
+            else {
+                result = 0.0;
+            }
+            return result;
+        };
+        /**
+         * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
+         */
+        Scalar.Hermite = function (value1, tangent1, value2, tangent2, amount) {
+            var squared = amount * amount;
+            var cubed = amount * squared;
+            var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
+            var part2 = (-2.0 * cubed) + (3.0 * squared);
+            var part3 = (cubed - (2.0 * squared)) + amount;
+            var part4 = cubed - squared;
+            return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
+        };
+        return Scalar;
+    }());
+    BABYLON.Scalar = Scalar;
+})(BABYLON || (BABYLON = {}));
+
+//# sourceMappingURL=babylon.math.scalar.js.map
+
 
 
 //# sourceMappingURL=babylon.mixins.js.map
 
 var BABYLON;
 (function (BABYLON) {
+    var __decoratorInitialStore = {};
+    var __mergedStore = {};
+    function getDirectStore(target) {
+        var classKey = target.getClassName();
+        if (!__decoratorInitialStore[classKey]) {
+            __decoratorInitialStore[classKey] = {};
+        }
+        return __decoratorInitialStore[classKey];
+    }
+    /**
+     * Return the list of properties flagged as serializable
+     * @param target: host object
+     */
+    function getMergedStore(target) {
+        var classKey = target.getClassName();
+        if (__mergedStore[classKey]) {
+            return __mergedStore[classKey];
+        }
+        __mergedStore[classKey] = {};
+        var store = __mergedStore[classKey];
+        var currentTarget = target;
+        var currentKey = classKey;
+        while (currentKey) {
+            var initialStore = __decoratorInitialStore[currentKey];
+            for (var property in initialStore) {
+                store[property] = initialStore[property];
+            }
+            var parent_1 = void 0;
+            var done = false;
+            do {
+                parent_1 = Object.getPrototypeOf(currentTarget);
+                if (!parent_1.getClassName) {
+                    done = true;
+                    break;
+                }
+                if (parent_1.getClassName() !== currentKey) {
+                    break;
+                }
+                currentTarget = parent_1;
+            } while (parent_1);
+            if (done) {
+                break;
+            }
+            currentKey = parent_1.getClassName();
+            currentTarget = parent_1;
+        }
+        return store;
+    }
     function generateSerializableMember(type, sourceName) {
         return function (target, propertyKey) {
-            if (!target.__serializableMembers) {
-                target.__serializableMembers = {};
-            }
-            if (!target.__serializableMembers[propertyKey]) {
-                target.__serializableMembers[propertyKey] = { type: type, sourceName: sourceName };
+            var classStore = getDirectStore(target);
+            if (!classStore[propertyKey]) {
+                classStore[propertyKey] = { type: type, sourceName: sourceName };
             }
         };
     }
@@ -4841,9 +4987,10 @@ var BABYLON;
             if (BABYLON.Tags) {
                 serializationObject.tags = BABYLON.Tags.GetTags(entity);
             }
+            var serializedProperties = getMergedStore(entity);
             // Properties
-            for (var property in entity.__serializableMembers) {
-                var propertyDescriptor = entity.__serializableMembers[property];
+            for (var property in serializedProperties) {
+                var propertyDescriptor = serializedProperties[property];
                 var targetPropertyName = propertyDescriptor.sourceName || property;
                 var propertyType = propertyDescriptor.type;
                 var sourceProperty = entity[property];
@@ -4890,9 +5037,10 @@ var BABYLON;
             if (BABYLON.Tags) {
                 BABYLON.Tags.AddTagsTo(destination, source.tags);
             }
+            var classStore = getMergedStore(destination);
             // Properties
-            for (var property in destination.__serializableMembers) {
-                var propertyDescriptor = destination.__serializableMembers[property];
+            for (var property in classStore) {
+                var propertyDescriptor = classStore[property];
                 var sourceProperty = source[propertyDescriptor.sourceName || property];
                 var propertyType = propertyDescriptor.type;
                 if (sourceProperty !== undefined && sourceProperty !== null) {
@@ -4938,9 +5086,10 @@ var BABYLON;
             if (BABYLON.Tags) {
                 BABYLON.Tags.AddTagsTo(destination, source.tags);
             }
+            var classStore = getMergedStore(destination);
             // Properties
-            for (var property in destination.__serializableMembers) {
-                var propertyDescriptor = destination.__serializableMembers[property];
+            for (var property in classStore) {
+                var propertyDescriptor = classStore[property];
                 var sourceProperty = source[property];
                 var propertyType = propertyDescriptor.type;
                 if (sourceProperty !== undefined && sourceProperty !== null) {
@@ -6209,7 +6358,7 @@ var BABYLON;
          * @param object the object to get the class name from
          * @return the name of the class, will be "object" for a custom data type not using the @className decorator
          */
-        Tools.getClassName = function (object, isType) {
+        Tools.GetClassName = function (object, isType) {
             if (isType === void 0) { isType = false; }
             var name = null;
             if (!isType && object.getClassName) {
@@ -7926,6 +8075,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Engine.prototype, "performanceMonitor", {
+            get: function () {
+                return this._performanceMonitor;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Engine.prototype, "texturesSupported", {
             get: function () {
                 return this._texturesSupported;
@@ -9855,7 +10011,7 @@ var BABYLON;
                     var smoothness = i / (mipSlices - 1);
                     var roughness = 1 - smoothness;
                     var minLODIndex = offset; // roughness = 0
-                    var maxLODIndex = BABYLON.MathTools.Log2(width) * scale + offset; // roughness = 1
+                    var maxLODIndex = BABYLON.Scalar.Log2(width) * scale + offset; // roughness = 1
                     var lodIndex = minLODIndex + (maxLODIndex - minLODIndex) * roughness;
                     var mipmapIndex = Math.min(Math.max(Math.round(lodIndex), 0), maxLODIndex);
                     var glTextureFromLod = gl.createTexture();
@@ -19239,6 +19395,9 @@ var BABYLON;
         BaseTexture.prototype.toString = function () {
             return this.name;
         };
+        BaseTexture.prototype.getClassName = function () {
+            return "BaseTexture";
+        };
         Object.defineProperty(BaseTexture.prototype, "onDispose", {
             set: function (callback) {
                 if (this._onDisposeObserver) {
@@ -19791,6 +19950,9 @@ var BABYLON;
             }
             return serializationObject;
         };
+        Texture.prototype.getClassName = function () {
+            return "Texture";
+        };
         // Statics
         Texture.CreateFromBase64String = function (data, name, scene, noMipmap, invertY, samplingMode, onLoad, onError, format) {
             if (samplingMode === void 0) { samplingMode = Texture.TRILINEAR_SAMPLINGMODE; }
@@ -20545,7 +20707,7 @@ var BABYLON;
             this._updateBoundingInfo();
             return this;
         };
-        Mesh.prototype._createGlobalSubMesh = function () {
+        Mesh.prototype._createGlobalSubMesh = function (force) {
             var totalVertices = this.getTotalVertices();
             if (!totalVertices || !this.getIndices()) {
                 return null;
@@ -20554,15 +20716,20 @@ var BABYLON;
             if (this.subMeshes && this.subMeshes.length > 0) {
                 var totalIndices = this.getIndices().length;
                 var needToRecreate = false;
-                for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
-                    var submesh = _a[_i];
-                    if (submesh.indexStart + submesh.indexCount >= totalIndices) {
-                        needToRecreate = true;
-                        break;
-                    }
-                    if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
-                        needToRecreate = true;
-                        break;
+                if (force) {
+                    needToRecreate = true;
+                }
+                else {
+                    for (var _i = 0, _a = this.subMeshes; _i < _a.length; _i++) {
+                        var submesh = _a[_i];
+                        if (submesh.indexStart + submesh.indexCount >= totalIndices) {
+                            needToRecreate = true;
+                            break;
+                        }
+                        if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
+                            needToRecreate = true;
+                            break;
+                        }
                     }
                 }
                 if (!needToRecreate) {
@@ -26760,15 +26927,15 @@ var BABYLON;
             var face = 0;
             for (var index = 0; index < normals.length; index += 3) {
                 //Edge Face  no. 1
-                if (Math.abs(normals[index + 1]) == 0) {
+                if (Math.abs(normals[index + 1]) < 0.001) {
                     face = 1;
                 }
                 //Top Face  no. 0
-                if (normals[index + 1] == 1) {
+                if (Math.abs(normals[index + 1] - 1) < 0.001) {
                     face = 0;
                 }
                 //Bottom Face  no. 2
-                if (normals[index + 1] == -1) {
+                if (Math.abs(normals[index + 1] + 1) < 0.001) {
                     face = 2;
                 }
                 idx = index / 3;
@@ -27660,7 +27827,7 @@ var BABYLON;
                 for (var index = 0; index < numOfMeshes; index++) {
                     var mesh = meshes[index];
                     mesh._boundingInfo = new BABYLON.BoundingInfo(this._extend.minimum, this._extend.maximum);
-                    mesh._createGlobalSubMesh();
+                    mesh._createGlobalSubMesh(false);
                     mesh.computeWorldMatrix(true);
                 }
             }
@@ -27799,7 +27966,7 @@ var BABYLON;
             var meshes = this._meshes;
             var numOfMeshes = meshes.length;
             for (var index = 0; index < numOfMeshes; index++) {
-                meshes[index]._createGlobalSubMesh();
+                meshes[index]._createGlobalSubMesh(true);
             }
             this.notifyUpdate();
         };
@@ -27895,7 +28062,7 @@ var BABYLON;
                         this.updateExtend(this._vertexBuffers[kind].getData());
                     }
                     mesh._boundingInfo = new BABYLON.BoundingInfo(this._extend.minimum, this._extend.maximum);
-                    mesh._createGlobalSubMesh();
+                    mesh._createGlobalSubMesh(false);
                     //bounding info was just created again, world matrix should be applied again.
                     mesh._updateBoundingInfo();
                 }
@@ -30357,7 +30524,7 @@ var BABYLON;
         CameraInputsManager.prototype.removeByType = function (inputType) {
             for (var cam in this.attached) {
                 var input = this.attached[cam];
-                if (input.getTypeName() === inputType) {
+                if (input.getClassName() === inputType) {
                     input.detachControl(this.attachedElement);
                     delete this.attached[cam];
                     this.rebuildInputCheck();
@@ -30418,7 +30585,7 @@ var BABYLON;
             for (var cam in this.attached) {
                 var input = this.attached[cam];
                 var res = BABYLON.SerializationHelper.Serialize(input);
-                inputs[input.getTypeName()] = res;
+                inputs[input.getClassName()] = res;
             }
             serializedCamera.inputsmgr = inputs;
         };
@@ -30438,7 +30605,7 @@ var BABYLON;
             else {
                 //2016-03-08 this part is for managing backward compatibility
                 for (var n in this.attached) {
-                    var construct = BABYLON.CameraInputTypes[this.attached[n].getTypeName()];
+                    var construct = BABYLON.CameraInputTypes[this.attached[n].getClassName()];
                     if (construct) {
                         var input = BABYLON.SerializationHelper.Parse(function () { return new construct(); }, parsedCamera, null);
                         this.remove(this.attached[n]);
@@ -30834,7 +31001,7 @@ var BABYLON;
                 }
             }
         };
-        ArcRotateCameraKeyboardMoveInput.prototype.getTypeName = function () {
+        ArcRotateCameraKeyboardMoveInput.prototype.getClassName = function () {
             return "ArcRotateCameraKeyboardMoveInput";
         };
         ArcRotateCameraKeyboardMoveInput.prototype.getSimpleName = function () {
@@ -30898,7 +31065,7 @@ var BABYLON;
                 this._wheel = null;
             }
         };
-        ArcRotateCameraMouseWheelInput.prototype.getTypeName = function () {
+        ArcRotateCameraMouseWheelInput.prototype.getClassName = function () {
             return "ArcRotateCameraMouseWheelInput";
         };
         ArcRotateCameraMouseWheelInput.prototype.getSimpleName = function () {
@@ -31099,7 +31266,7 @@ var BABYLON;
                 { name: "blur", handler: this._onLostFocus }
             ]);
         };
-        ArcRotateCameraPointersInput.prototype.getTypeName = function () {
+        ArcRotateCameraPointersInput.prototype.getClassName = function () {
             return "ArcRotateCameraPointersInput";
         };
         ArcRotateCameraPointersInput.prototype.getSimpleName = function () {
@@ -33445,14 +33612,14 @@ var BABYLON;
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                         var srcPos = (x + y * width) * 4;
-                        destArray[index] = BABYLON.MathTools.Clamp(srcData[srcPos]) * 255;
-                        destArray[index + 1] = BABYLON.MathTools.Clamp(srcData[srcPos + 1]) * 255;
-                        destArray[index + 2] = BABYLON.MathTools.Clamp(srcData[srcPos + 2]) * 255;
+                        destArray[index] = BABYLON.Scalar.Clamp(srcData[srcPos]) * 255;
+                        destArray[index + 1] = BABYLON.Scalar.Clamp(srcData[srcPos + 1]) * 255;
+                        destArray[index + 2] = BABYLON.Scalar.Clamp(srcData[srcPos + 2]) * 255;
                         if (DDSTools.StoreLODInAlphaChannel) {
                             destArray[index + 3] = lod;
                         }
                         else {
-                            destArray[index + 3] = BABYLON.MathTools.Clamp(srcData[srcPos + 3]) * 255;
+                            destArray[index + 3] = BABYLON.Scalar.Clamp(srcData[srcPos + 3]) * 255;
                         }
                         index += 4;
                     }
@@ -33466,14 +33633,14 @@ var BABYLON;
                 for (var y = 0; y < height; y++) {
                     for (var x = 0; x < width; x++) {
                         var srcPos = (x + y * width) * 4;
-                        destArray[index] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;
-                        destArray[index + 1] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;
-                        destArray[index + 2] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;
+                        destArray[index] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos])) * 255;
+                        destArray[index + 1] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 1])) * 255;
+                        destArray[index + 2] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 2])) * 255;
                         if (DDSTools.StoreLODInAlphaChannel) {
                             destArray[index + 3] = lod;
                         }
                         else {
-                            destArray[index + 3] = BABYLON.MathTools.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;
+                            destArray[index + 3] = BABYLON.Scalar.Clamp(DDSTools._FromHalfFloat(srcData[srcPos + 3])) * 255;
                         }
                         index += 4;
                     }
@@ -36006,6 +36173,9 @@ var BABYLON;
                 _this._markAllSubMeshesAsImageProcessingDirty();
             });
         };
+        PBRBaseMaterial.prototype.getClassName = function () {
+            return "PBRBaseMaterial";
+        };
         Object.defineProperty(PBRBaseMaterial.prototype, "useLogarithmicDepth", {
             get: function () {
                 return this._useLogarithmicDepth;
@@ -36924,6 +37094,9 @@ var BABYLON;
                 }
                 return activeTextures;
             };
+            PBRBaseSimpleMaterial.prototype.getClassName = function () {
+                return "PBRBaseSimpleMaterial";
+            };
             return PBRBaseSimpleMaterial;
         }(BABYLON.PBRBaseMaterial));
         __decorate([
@@ -40236,6 +40409,9 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        ImageProcessingPostProcess.prototype.getClassName = function () {
+            return "ImageProcessingPostProcess";
+        };
         ImageProcessingPostProcess.prototype._updateParameters = function () {
             this._defines.FROMLINEARSPACE = this._fromLinearSpace;
             this.imageProcessingConfiguration.prepareDefines(this._defines);
@@ -40784,6 +40960,9 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        ColorCurves.prototype.getClassName = function () {
+            return "ColorCurves";
+        };
         /**
          * Binds the color curves to the shader.
          * @param colorCurves The color curve to bind
@@ -41284,6 +41463,9 @@ var BABYLON;
             this._renderEffectsForIsolatedPass = new Array();
             this._cameras = [];
         }
+        PostProcessRenderPipeline.prototype.getClassName = function () {
+            return "PostProcessRenderPipeline";
+        };
         Object.defineProperty(PostProcessRenderPipeline.prototype, "isSupported", {
             get: function () {
                 for (var renderEffectName in this._renderEffects) {
@@ -41980,6 +42162,9 @@ var BABYLON;
         ImageProcessingConfiguration.prototype._updateParameters = function () {
             this.onUpdateParameters.notifyObservers(this);
         };
+        ImageProcessingConfiguration.prototype.getClassName = function () {
+            return "ImageProcessingConfiguration";
+        };
         /**
          * Prepare the list of uniforms associated with the Image Processing effects.
          * @param uniformsList The list of uniforms used in the effect
@@ -46965,9 +47150,9 @@ var BABYLON;
                             }
                             // Handle Gamma space textures.
                             if (cubeInfo.gammaSpace) {
-                                r = Math.pow(BABYLON.MathTools.Clamp(r), BABYLON.ToLinearSpace);
-                                g = Math.pow(BABYLON.MathTools.Clamp(g), BABYLON.ToLinearSpace);
-                                b = Math.pow(BABYLON.MathTools.Clamp(b), BABYLON.ToLinearSpace);
+                                r = Math.pow(BABYLON.Scalar.Clamp(r), BABYLON.ToLinearSpace);
+                                g = Math.pow(BABYLON.Scalar.Clamp(g), BABYLON.ToLinearSpace);
+                                b = Math.pow(BABYLON.Scalar.Clamp(b), BABYLON.ToLinearSpace);
                             }
                             var color = new BABYLON.Color3(r, g, b);
                             sphericalHarmonics.addLight(worldDirection, color, deltaSolidAngle);
@@ -49012,6 +49197,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.GridMaterial";
             return serializationObject;
         };
+        GridMaterial.prototype.getClassName = function () {
+            return "GridMaterial";
+        };
         GridMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new GridMaterial(source.name, scene); }, source, scene, rootUrl);
         };

文件差異過大導致無法顯示
+ 5086 - 5028
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 25 - 0
dist/preview release/gui/babylon.gui.d.ts

@@ -94,6 +94,7 @@ declare module BABYLON.GUI {
         readonly isPercentage: boolean;
         readonly isPixel: boolean;
         readonly internalValue: number;
+        getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
         getValue(host: AdvancedDynamicTexture): number;
         toString(host: AdvancedDynamicTexture): string;
         fromString(source: string | number): boolean;
@@ -154,6 +155,7 @@ declare module BABYLON.GUI {
         private _dummyVector2;
         private _downCount;
         private _enterCount;
+        private _doNotRender;
         isHitTestVisible: boolean;
         isPointerBlocker: boolean;
         protected _linkOffsetX: ValueAndUnit;
@@ -203,6 +205,7 @@ declare module BABYLON.GUI {
         fontSize: string | number;
         color: string;
         zIndex: number;
+        notRenderable: boolean;
         isVisible: boolean;
         readonly isDirty: boolean;
         paddingLeft: string | number;
@@ -577,3 +580,25 @@ declare module BABYLON.GUI {
         protected _onPointerUp(coordinates: Vector2): void;
     }
 }
+
+
+declare module BABYLON.GUI {
+    class InputText extends Control {
+        name: string;
+        private _text;
+        private _background;
+        private _thickness;
+        private _margin;
+        private _autoStretchWidth;
+        private _maxWidth;
+        maxWidth: string | number;
+        margin: string;
+        autoStretchWidth: boolean;
+        thickness: number;
+        background: string;
+        text: string;
+        constructor(name?: string, text?: string);
+        protected _getTypeName(): string;
+        _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
+    }
+}

+ 186 - 9
dist/preview release/gui/babylon.gui.js

@@ -201,10 +201,10 @@ var BABYLON;
                         var position = mesh.getBoundingInfo().boundingSphere.center;
                         var projectedPosition = BABYLON.Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
                         if (projectedPosition.z < 0 || projectedPosition.z > 1) {
-                            control.isVisible = false;
+                            control.notRenderable = true;
                             continue;
                         }
-                        control.isVisible = true;
+                        control.notRenderable = false;
                         control._moveToProjectedPosition(projectedPosition);
                     }
                 }
@@ -551,6 +551,12 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
+            ValueAndUnit.prototype.getValueInPixel = function (host, refValue) {
+                if (this.isPixel) {
+                    return this.getValue(host);
+                }
+                return this.getValue(host) * refValue;
+            };
             ValueAndUnit.prototype.getValue = function (host) {
                 if (host && !this.ignoreAdaptiveScaling && this.unit !== ValueAndUnit.UNITMODE_PERCENTAGE) {
                     if (host.idealWidth) {
@@ -669,6 +675,7 @@ var BABYLON;
                 this._dummyVector2 = BABYLON.Vector2.Zero();
                 this._downCount = 0;
                 this._enterCount = 0;
+                this._doNotRender = false;
                 this.isHitTestVisible = true;
                 this.isPointerBlocker = false;
                 this._linkOffsetX = new GUI.ValueAndUnit(0);
@@ -920,6 +927,20 @@ var BABYLON;
                 enumerable: true,
                 configurable: true
             });
+            Object.defineProperty(Control.prototype, "notRenderable", {
+                get: function () {
+                    return this._doNotRender;
+                },
+                set: function (value) {
+                    if (this._doNotRender === value) {
+                        return;
+                    }
+                    this._doNotRender = value;
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
             Object.defineProperty(Control.prototype, "isVisible", {
                 get: function () {
                     return this._isVisible;
@@ -1076,10 +1097,10 @@ var BABYLON;
                 var projectedPosition = BABYLON.Vector3.Project(position, BABYLON.Matrix.Identity(), scene.getTransformMatrix(), globalViewport);
                 this._moveToProjectedPosition(projectedPosition);
                 if (projectedPosition.z < 0 || projectedPosition.z > 1) {
-                    this.isVisible = false;
+                    this.notRenderable = true;
                     return;
                 }
-                this.isVisible = true;
+                this.notRenderable = false;
             };
             Control.prototype.linkWithMesh = function (mesh) {
                 if (!this._host || this._root !== this._host._rootContainer) {
@@ -1328,7 +1349,7 @@ var BABYLON;
                 return true;
             };
             Control.prototype._processPicking = function (x, y, type) {
-                if (!this.isHitTestVisible || !this.isVisible) {
+                if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
                     return false;
                 }
                 if (!this.contains(x, y)) {
@@ -1660,7 +1681,7 @@ var BABYLON;
                 }
             };
             Container.prototype._draw = function (parentMeasure, context) {
-                if (!this.isVisible) {
+                if (!this.isVisible || this.notRenderable) {
                     return;
                 }
                 context.save();
@@ -1670,7 +1691,7 @@ var BABYLON;
                     this._clipForChildren(context);
                     for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
                         var child = _a[_i];
-                        if (child.isVisible) {
+                        if (child.isVisible && !child.notRenderable) {
                             child._draw(this._measureForChildren, context);
                         }
                     }
@@ -1678,7 +1699,7 @@ var BABYLON;
                 context.restore();
             };
             Container.prototype._processPicking = function (x, y, type) {
-                if (!this.isHitTestVisible || !this.isVisible) {
+                if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
                     return false;
                 }
                 if (!_super.prototype.contains.call(this, x, y)) {
@@ -3171,7 +3192,7 @@ var BABYLON;
             };
             // While being a container, the button behaves like a control.
             Button.prototype._processPicking = function (x, y, type) {
-                if (!this.isHitTestVisible || !this.isVisible) {
+                if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
                     return false;
                 }
                 if (!_super.prototype.contains.call(this, x, y)) {
@@ -3608,3 +3629,159 @@ var BABYLON;
         GUI.ColorPicker = ColorPicker;
     })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
 })(BABYLON || (BABYLON = {}));
+
+/// <reference path="../../../dist/preview release/babylon.d.ts"/>
+var __extends = (this && this.__extends) || (function () {
+    var extendStatics = Object.setPrototypeOf ||
+        ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+        function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+    return function (d, b) {
+        extendStatics(d, b);
+        function __() { this.constructor = d; }
+        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+    };
+})();
+var BABYLON;
+(function (BABYLON) {
+    var GUI;
+    (function (GUI) {
+        var InputText = (function (_super) {
+            __extends(InputText, _super);
+            function InputText(name, text) {
+                if (text === void 0) { text = ""; }
+                var _this = _super.call(this, name) || this;
+                _this.name = name;
+                _this._text = "";
+                _this._background = "black";
+                _this._thickness = 1;
+                _this._margin = new GUI.ValueAndUnit(10, GUI.ValueAndUnit.UNITMODE_PIXEL);
+                _this._autoStretchWidth = true;
+                _this._maxWidth = new GUI.ValueAndUnit(1, GUI.ValueAndUnit.UNITMODE_PERCENTAGE, false);
+                _this.text = text;
+                return _this;
+            }
+            Object.defineProperty(InputText.prototype, "maxWidth", {
+                get: function () {
+                    return this._maxWidth.toString(this._host);
+                },
+                set: function (value) {
+                    if (this._maxWidth.toString(this._host) === value) {
+                        return;
+                    }
+                    if (this._maxWidth.fromString(value)) {
+                        this._markAsDirty();
+                    }
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(InputText.prototype, "margin", {
+                get: function () {
+                    return this._margin.toString(this._host);
+                },
+                set: function (value) {
+                    if (this._margin.toString(this._host) === value) {
+                        return;
+                    }
+                    if (this._margin.fromString(value)) {
+                        this._markAsDirty();
+                    }
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(InputText.prototype, "autoStretchWidth", {
+                get: function () {
+                    return this._autoStretchWidth;
+                },
+                set: function (value) {
+                    if (this._autoStretchWidth === value) {
+                        return;
+                    }
+                    this._autoStretchWidth = value;
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(InputText.prototype, "thickness", {
+                get: function () {
+                    return this._thickness;
+                },
+                set: function (value) {
+                    if (this._thickness === value) {
+                        return;
+                    }
+                    this._thickness = value;
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(InputText.prototype, "background", {
+                get: function () {
+                    return this._background;
+                },
+                set: function (value) {
+                    if (this._background === value) {
+                        return;
+                    }
+                    this._background = value;
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
+            Object.defineProperty(InputText.prototype, "text", {
+                get: function () {
+                    return this._text;
+                },
+                set: function (value) {
+                    if (this._text === value) {
+                        return;
+                    }
+                    this._text = value;
+                    this._markAsDirty();
+                },
+                enumerable: true,
+                configurable: true
+            });
+            InputText.prototype._getTypeName = function () {
+                return "InputText";
+            };
+            InputText.prototype._draw = function (parentMeasure, context) {
+                context.save();
+                this._applyStates(context);
+                if (this._processMeasures(parentMeasure, context)) {
+                    // Background
+                    if (this._background) {
+                        context.fillStyle = this._background;
+                        context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
+                    }
+                    // Text
+                    if (this._text) {
+                        if (this.color) {
+                            context.fillStyle = this.color;
+                        }
+                        var rootY = this._fontOffset.ascent + (this._currentMeasure.height - this._fontOffset.height) / 2;
+                        context.fillText(this._text, this._currentMeasure.left + this._margin.getValueInPixel(this._host, parentMeasure.width), this._currentMeasure.top + rootY);
+                        if (this._autoStretchWidth) {
+                            this.width = Math.min(this._maxWidth.getValueInPixel(this._host, parentMeasure.width), context.measureText(this._text).width + this._margin.getValueInPixel(this._host, parentMeasure.width) * 2) + "px";
+                        }
+                    }
+                    // Border
+                    if (this._thickness) {
+                        if (this.color) {
+                            context.strokeStyle = this.color;
+                        }
+                        context.lineWidth = this._thickness;
+                        context.strokeRect(this._currentMeasure.left + this._thickness / 2, this._currentMeasure.top + this._thickness / 2, this._currentMeasure.width - this._thickness, this._currentMeasure.height - this._thickness);
+                    }
+                }
+                context.restore();
+            };
+            return InputText;
+        }(GUI.Control));
+        GUI.InputText = InputText;
+    })(GUI = BABYLON.GUI || (BABYLON.GUI = {}));
+})(BABYLON || (BABYLON = {}));

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


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


+ 1 - 1
dist/preview release/inspector/babylon.inspector.js

@@ -2479,7 +2479,7 @@ var INSPECTOR;
          */
         Helpers.GET_TYPE = function (obj) {
             if (obj != null && obj != undefined) {
-                var classname = BABYLON.Tools.getClassName(obj);
+                var classname = BABYLON.Tools.GetClassName(obj);
                 if (!classname || classname === 'object') {
                     classname = obj.constructor.name;
                     // classname is undefined in IE11

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.cellMaterial.d.ts

@@ -23,6 +23,7 @@ declare module BABYLON {
         getActiveTextures(): BaseTexture[];
         hasTexture(texture: BaseTexture): boolean;
         dispose(forceDisposeEffect?: boolean): void;
+        getClassName(): string;
         clone(name: string): CellMaterial;
         serialize(): any;
         static Parse(source: any, scene: Scene, rootUrl: string): CellMaterial;

+ 3 - 0
dist/preview release/materialsLibrary/babylon.cellMaterial.js

@@ -239,6 +239,9 @@ var BABYLON;
             }
             _super.prototype.dispose.call(this, forceDisposeEffect);
         };
+        CellMaterial.prototype.getClassName = function () {
+            return "CellMaterial";
+        };
         CellMaterial.prototype.clone = function (name) {
             var _this = this;
             return BABYLON.SerializationHelper.Clone(function () { return new CellMaterial(name, _this.getScene()); }, this);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.fireMaterial.d.ts

@@ -21,6 +21,7 @@ declare module BABYLON {
         getAnimatables(): IAnimatable[];
         getActiveTextures(): BaseTexture[];
         hasTexture(texture: BaseTexture): boolean;
+        getClassName(): string;
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): FireMaterial;
         serialize(): any;

+ 3 - 0
dist/preview release/materialsLibrary/babylon.fireMaterial.js

@@ -237,6 +237,9 @@ var BABYLON;
             }
             return false;
         };
+        FireMaterial.prototype.getClassName = function () {
+            return "FireMaterial";
+        };
         FireMaterial.prototype.dispose = function (forceDisposeEffect) {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.furMaterial.d.ts

@@ -38,6 +38,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): FurMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial;
         static GenerateTexture(name: string, scene: Scene): DynamicTexture;
         static FurifyMesh(sourceMesh: Mesh, quality: number): Mesh[];

+ 3 - 0
dist/preview release/materialsLibrary/babylon.furMaterial.js

@@ -332,6 +332,9 @@ var BABYLON;
             }
             return serializationObject;
         };
+        FurMaterial.prototype.getClassName = function () {
+            return "FurMaterial";
+        };
         // Statics
         FurMaterial.Parse = function (source, scene, rootUrl) {
             var material = BABYLON.SerializationHelper.Parse(function () { return new FurMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.gradientMaterial.d.ts

@@ -23,6 +23,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): GradientMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.gradientMaterial.js

@@ -244,6 +244,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.GradientMaterial";
             return serializationObject;
         };
+        GradientMaterial.prototype.getClassName = function () {
+            return "GradientMaterial";
+        };
         // Statics
         GradientMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new GradientMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.gridMaterial.d.ts

@@ -50,6 +50,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): GridMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.gridMaterial.js

@@ -161,6 +161,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.GridMaterial";
             return serializationObject;
         };
+        GridMaterial.prototype.getClassName = function () {
+            return "GridMaterial";
+        };
         GridMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new GridMaterial(source.name, scene); }, source, scene, rootUrl);
         };

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.lavaMaterial.d.ts

@@ -30,6 +30,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): LavaMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.lavaMaterial.js

@@ -305,6 +305,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.LavaMaterial";
             return serializationObject;
         };
+        LavaMaterial.prototype.getClassName = function () {
+            return "LavaMaterial";
+        };
         // Statics
         LavaMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new LavaMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.normalMaterial.d.ts

@@ -23,6 +23,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): NormalMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.normalMaterial.js

@@ -278,6 +278,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.NormalMaterial";
             return serializationObject;
         };
+        NormalMaterial.prototype.getClassName = function () {
+            return "NormalMaterial";
+        };
         // Statics
         NormalMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new NormalMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.d.ts

@@ -12,6 +12,7 @@ declare module BABYLON {
         bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
         clone(name: string): ShadowOnlyMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.js

@@ -172,6 +172,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.ShadowOnlyMaterial";
             return serializationObject;
         };
+        ShadowOnlyMaterial.prototype.getClassName = function () {
+            return "ShadowOnlyMaterial";
+        };
         // Statics
         ShadowOnlyMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new ShadowOnlyMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.simpleMaterial.d.ts

@@ -23,6 +23,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): SimpleMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.simpleMaterial.js

@@ -245,6 +245,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.SimpleMaterial";
             return serializationObject;
         };
+        SimpleMaterial.prototype.getClassName = function () {
+            return "SimpleMaterial";
+        };
         // Statics
         SimpleMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new SimpleMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.skyMaterial.d.ts

@@ -23,6 +23,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): SkyMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.skyMaterial.js

@@ -179,6 +179,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.SkyMaterial";
             return serializationObject;
         };
+        SkyMaterial.prototype.getClassName = function () {
+            return "SkyMaterial";
+        };
         // Statics
         SkyMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new SkyMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.terrainMaterial.d.ts

@@ -36,6 +36,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): TerrainMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.terrainMaterial.js

@@ -317,6 +317,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.TerrainMaterial";
             return serializationObject;
         };
+        TerrainMaterial.prototype.getClassName = function () {
+            return "TerrainMaterial";
+        };
         // Statics
         TerrainMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new TerrainMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.d.ts

@@ -36,6 +36,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): TriPlanarMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial;
     }
 }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.triPlanarMaterial.js

@@ -312,6 +312,9 @@ var BABYLON;
             serializationObject.customType = "BABYLON.TriPlanarMaterial";
             return serializationObject;
         };
+        TriPlanarMaterial.prototype.getClassName = function () {
+            return "TriPlanarMaterial";
+        };
         // Statics
         TriPlanarMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new TriPlanarMaterial(source.name, scene); }, source, scene, rootUrl);

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


+ 1 - 0
dist/preview release/materialsLibrary/babylon.waterMaterial.d.ts

@@ -98,6 +98,7 @@ declare module BABYLON {
         dispose(forceDisposeEffect?: boolean): void;
         clone(name: string): WaterMaterial;
         serialize(): any;
+        getClassName(): string;
         static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial;
         static CreateDefaultMesh(name: string, scene: Scene): Mesh;
     }

+ 3 - 0
dist/preview release/materialsLibrary/babylon.waterMaterial.js

@@ -498,6 +498,9 @@ var BABYLON;
             serializationObject.refractionTexture.isRenderTarget = true;
             return serializationObject;
         };
+        WaterMaterial.prototype.getClassName = function () {
+            return "WaterMaterial";
+        };
         // Statics
         WaterMaterial.Parse = function (source, scene, rootUrl) {
             return BABYLON.SerializationHelper.Parse(function () { return new WaterMaterial(source.name, scene); }, source, scene, rootUrl);

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


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

@@ -5,6 +5,7 @@
 - Engine can now be initialized with an existing webgl context ([deltakosh](https://github.com/deltakosh))
 
 ## Updates
+- Better serialization support ([deltakosh](https://github.com/deltakosh))
 - Introduced `performanceMonitor` class to get better FPS analysis ([deltakosh](https://github.com/deltakosh))
 - GUI: Added support for pointer move events on projected UI ([deltakosh](https://github.com/deltakosh))
 - Normals are generated automatically by StandardMaterial if meshes do not have normals ([deltakosh](https://github.com/deltakosh))

+ 2 - 2
gui/src/advancedDynamicTexture.ts

@@ -217,10 +217,10 @@ module BABYLON.GUI {
                     var projectedPosition = Vector3.Project(position, mesh.getWorldMatrix(), scene.getTransformMatrix(), globalViewport);
 
                     if (projectedPosition.z < 0 || projectedPosition.z > 1) {
-                        control.isVisible = false;
+                        control.notRenderable = true;
                         continue;
                     }
-                    control.isVisible = true;
+                    control.notRenderable = false;
                     control._moveToProjectedPosition(projectedPosition);
                 }
             }

+ 1 - 1
gui/src/controls/button.ts

@@ -38,7 +38,7 @@ module BABYLON.GUI {
 
         // While being a container, the button behaves like a control.
         public _processPicking(x: number, y: number, type: number): boolean {
-            if (!this.isHitTestVisible || !this.isVisible) {
+            if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
                 return false;
             }
 

+ 3 - 3
gui/src/controls/container.ts

@@ -127,7 +127,7 @@ module BABYLON.GUI {
         }
 
         public _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void {      
-            if (!this.isVisible) {
+            if (!this.isVisible || this.notRenderable) {
                 return;
             }
             context.save();
@@ -139,7 +139,7 @@ module BABYLON.GUI {
 
                 this._clipForChildren(context);
                 for (var child of this._children) {
-                    if (child.isVisible) {
+                    if (child.isVisible && !child.notRenderable) {
                         child._draw(this._measureForChildren, context);
                     }
                 }
@@ -148,7 +148,7 @@ module BABYLON.GUI {
         }
 
         public _processPicking(x: number, y: number, type: number): boolean {
-            if (!this.isHitTestVisible || !this.isVisible) {
+            if (!this.isHitTestVisible || !this.isVisible || this.notRenderable) {
                 return false;
             }
 

+ 17 - 3
gui/src/controls/control.ts

@@ -43,6 +43,7 @@ module BABYLON.GUI {
         private _dummyVector2 = Vector2.Zero();
         private _downCount = 0;
         private _enterCount = 0;
+        private _doNotRender = false;
 
         public isHitTestVisible = true;
         public isPointerBlocker = false;
@@ -286,6 +287,19 @@ module BABYLON.GUI {
             }
         }
 
+        public get notRenderable(): boolean {
+            return this._doNotRender;
+        }
+
+        public set notRenderable(value: boolean) {
+            if (this._doNotRender === value) {
+                return;
+            }
+
+            this._doNotRender = value;
+            this._markAsDirty();
+        }
+
         public get isVisible(): boolean {
             return this._isVisible;
         }
@@ -429,10 +443,10 @@ module BABYLON.GUI {
             this._moveToProjectedPosition(projectedPosition);
 
             if (projectedPosition.z < 0 || projectedPosition.z > 1) {
-                this.isVisible = false;
+                this.notRenderable = true;
                 return;
             }
-            this.isVisible = true;
+            this.notRenderable = false;
         }
 
         public linkWithMesh(mesh: AbstractMesh): void {
@@ -736,7 +750,7 @@ module BABYLON.GUI {
         }
 
         public _processPicking(x: number, y: number, type: number): boolean {
-            if (!this.isHitTestVisible || !this.isVisible) {
+            if (!this.isHitTestVisible || !this.isVisible || this._doNotRender) {
                 return false;
             }
 

+ 1 - 1
inspector/src/helpers/Helpers.ts

@@ -8,7 +8,7 @@ module INSPECTOR {
          */
         public static GET_TYPE(obj: any): string {
             if (obj != null && obj != undefined) {
-                let classname = BABYLON.Tools.getClassName(obj);
+                let classname = BABYLON.Tools.GetClassName(obj);
                 if (!classname || classname === 'object') {
                     classname = obj.constructor.name;
                     // classname is undefined in IE11

+ 4 - 0
materialsLibrary/src/cell/babylon.cellMaterial.ts

@@ -296,6 +296,10 @@ module BABYLON {
             super.dispose(forceDisposeEffect);
         }
 
+        public getClassName(): string {
+            return "CellMaterial";
+        }
+
         public clone(name: string): CellMaterial {
             return SerializationHelper.Clone<CellMaterial>(() => new CellMaterial(name, this.getScene()), this);
         }

+ 4 - 0
materialsLibrary/src/fire/babylon.fireMaterial.ts

@@ -296,6 +296,10 @@ module BABYLON {
             return false;    
         }         
 
+        public getClassName(): string {
+            return "FireMaterial";
+        }        
+
         public dispose(forceDisposeEffect?: boolean): void {
             if (this._diffuseTexture) {
                 this._diffuseTexture.dispose();

+ 4 - 0
materialsLibrary/src/fur/babylon.furMaterial.ts

@@ -430,6 +430,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "FurMaterial";
+        }          
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): FurMaterial {
             var material = SerializationHelper.Parse(() => new FurMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/gradient/babylon.gradientMaterial.ts

@@ -296,6 +296,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "GradientMaterial";
+        }              
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): GradientMaterial {
             return SerializationHelper.Parse(() => new GradientMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/grid/babylon.gridmaterial.ts

@@ -192,6 +192,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "GridMaterial";
+        }             
+
         public static Parse(source: any, scene: Scene, rootUrl: string): GridMaterial {
             return SerializationHelper.Parse(() => new GridMaterial(source.name, scene), source, scene, rootUrl);
         }

+ 4 - 0
materialsLibrary/src/lava/babylon.lavaMaterial.ts

@@ -382,6 +382,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "LavaMaterial";
+        }
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): LavaMaterial {
             return SerializationHelper.Parse(() => new LavaMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/normal/babylon.normalMaterial.ts

@@ -333,6 +333,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "NormalMaterial";
+        }        
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): NormalMaterial {
             return SerializationHelper.Parse(() => new NormalMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/shadowOnly/babylon.shadowOnlyMaterial.ts

@@ -198,6 +198,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "ShadowOnlyMaterial";
+        }               
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): ShadowOnlyMaterial {
             return SerializationHelper.Parse(() => new ShadowOnlyMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/simple/babylon.simpleMaterial.ts

@@ -299,6 +299,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "SimpleMaterial";
+        }               
+        
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): SimpleMaterial {
             return SerializationHelper.Parse(() => new SimpleMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/sky/babylon.skyMaterial.ts

@@ -226,6 +226,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "SkyMaterial";
+        }            
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): SkyMaterial {
             return SerializationHelper.Parse(() => new SkyMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/terrain/babylon.terrainMaterial.ts

@@ -420,6 +420,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "TerrainMaterial";
+        }
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): TerrainMaterial {
             return SerializationHelper.Parse(() => new TerrainMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/triPlanar/babylon.triPlanarMaterial.ts

@@ -411,6 +411,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "TriPlanarMaterial";
+        }
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): TriPlanarMaterial {
             return SerializationHelper.Parse(() => new TriPlanarMaterial(source.name, scene), source, scene, rootUrl);

+ 4 - 0
materialsLibrary/src/water/babylon.waterMaterial.ts

@@ -614,6 +614,10 @@ module BABYLON {
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "WaterMaterial";
+        }        
+
         // Statics
         public static Parse(source: any, scene: Scene, rootUrl: string): WaterMaterial {
             return SerializationHelper.Parse(() => new WaterMaterial(source.name, scene), source, scene, rootUrl);

+ 2 - 2
src/Cameras/Inputs/babylon.arcRotateCameraGamepadInput.ts

@@ -63,13 +63,13 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "ArcRotateCameraGamepadInput";
         }
 
         getSimpleName() {
             return "gamepad";
-        }
+        }        
     }
 
     CameraInputTypes["ArcRotateCameraGamepadInput"] = ArcRotateCameraGamepadInput;

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraKeyboardMoveInput.ts

@@ -108,7 +108,7 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "ArcRotateCameraKeyboardMoveInput";
         }
         

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraMouseWheelInput.ts

@@ -41,7 +41,7 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "ArcRotateCameraMouseWheelInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -231,7 +231,7 @@ module BABYLON {
             ]);
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "ArcRotateCameraPointersInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraVRDeviceOrientationInput.ts

@@ -48,7 +48,7 @@ module BABYLON {
             window.removeEventListener("deviceorientation", this._deviceOrientationHandler);
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "ArcRotateCameraVRDeviceOrientationInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.freeCameraDeviceOrientationInput.ts

@@ -62,7 +62,7 @@ module BABYLON {
             this._camera.rotationQuaternion.w *= -1;
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraDeviceOrientationInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.freeCameraGamepadInput.ts

@@ -74,7 +74,7 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraGamepadInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.freeCameraKeyboardMoveInput.ts

@@ -105,7 +105,7 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraKeyboardMoveInput";
         }
 

+ 3 - 3
src/Cameras/Inputs/babylon.freeCameraMouseInput.ts

@@ -15,7 +15,7 @@ module BABYLON {
         private previousPosition: { x: number, y: number };
 
         constructor(public touchEnabled = true) {
-        }
+        }           
 
         attachControl(element: HTMLElement, noPreventDefault?: boolean) {
             var engine = this.camera.getEngine();
@@ -129,13 +129,13 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraMouseInput";
         }
 
         getSimpleName() {
             return "mouse";
-        }
+        }      
     }
 
     CameraInputTypes["FreeCameraMouseInput"] = FreeCameraMouseInput;

+ 1 - 1
src/Cameras/Inputs/babylon.freeCameraTouchInput.ts

@@ -128,7 +128,7 @@ module BABYLON {
             }
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraTouchInput";
         }
 

+ 1 - 1
src/Cameras/Inputs/babylon.freeCameraVirtualJoystickInput.ts

@@ -49,7 +49,7 @@ module BABYLON {
             this._rightjoystick.releaseCanvas();
         }
 
-        getTypeName(): string {
+        getClassName(): string {
             return "FreeCameraVirtualJoystickInput";
         }
         

+ 4 - 4
src/Cameras/babylon.cameraInputsManager.ts

@@ -3,7 +3,7 @@ module BABYLON {
 
     export interface ICameraInput<TCamera extends BABYLON.Camera> {
         camera: TCamera;
-        getTypeName(): string;
+        getClassName(): string;
         getSimpleName(): string;
         attachControl: (element: HTMLElement, noPreventDefault?: boolean) => void;
         detachControl: (element: HTMLElement) => void;
@@ -64,7 +64,7 @@ module BABYLON {
         public removeByType(inputType: string) {
             for (var cam in this.attached) {
                 var input = this.attached[cam];
-                if (input.getTypeName() === inputType) {
+                if (input.getClassName() === inputType) {
                     input.detachControl(this.attachedElement);
                     delete this.attached[cam];
                     this.rebuildInputCheck();
@@ -137,7 +137,7 @@ module BABYLON {
             for (var cam in this.attached) {
                 var input = this.attached[cam];
                 var res = SerializationHelper.Serialize(input);
-                inputs[input.getTypeName()] = res;
+                inputs[input.getClassName()] = res;
             }
 
             serializedCamera.inputsmgr = inputs;
@@ -159,7 +159,7 @@ module BABYLON {
             } else { 
                 //2016-03-08 this part is for managing backward compatibility
                 for (var n in this.attached) {
-                    var construct = CameraInputTypes[this.attached[n].getTypeName()];
+                    var construct = CameraInputTypes[this.attached[n].getClassName()];
                     if (construct) {
                         var input = SerializationHelper.Parse(() => { return new construct() }, parsedCamera, null);
                         this.remove(this.attached[n]);

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

@@ -474,7 +474,9 @@
             this._environmentBRDFTexture = TextureTools.GetEnvironmentBRDFTexture(scene);
         }
 
-        public abstract getClassName(): string;
+        public getClassName(): string {
+            return "PBRBaseMaterial";
+        }  
 
         @serialize()
         public get useLogarithmicDepth(): boolean {

+ 4 - 0
src/Materials/PBR/babylon.pbrBaseSimpleMaterial.ts

@@ -198,5 +198,9 @@
 
             this._useAmbientInGrayScale = true;
         }
+
+        public getClassName(): string {
+            return "PBRBaseSimpleMaterial";
+        }        
     }
 }

+ 4 - 0
src/Materials/Textures/babylon.baseTexture.ts

@@ -81,6 +81,10 @@
             return this.name;
         }
 
+        public getClassName(): string {
+            return "BaseTexture";
+        }             
+
         public animations = new Array<Animation>();
 
         /**

+ 4 - 0
src/Materials/Textures/babylon.texture.ts

@@ -337,6 +337,10 @@
             return serializationObject;
         }
 
+        public getClassName(): string {
+            return "Texture";
+        }     
+
         // Statics
         public static CreateFromBase64String(data: string, name: string, scene: Scene, noMipmap?: boolean, invertY?: boolean, samplingMode: number = Texture.TRILINEAR_SAMPLINGMODE, onLoad: () => void = null, onError: () => void = null, format: number = Engine.TEXTUREFORMAT_RGBA): Texture {
             return new Texture("data:" + name, scene, noMipmap, invertY, samplingMode, onLoad, onError, data, false, format);

+ 4 - 0
src/Materials/babylon.colorCurves.ts

@@ -297,6 +297,10 @@
             this._shadowsExposure = value;
             this._dirty = true;
         }
+
+        public getClassName(): string {
+            return "ColorCurves";
+        }          
         
         /**
          * Binds the color curves to the shader.

+ 4 - 0
src/Materials/babylon.imageProcessingConfiguration.ts

@@ -287,6 +287,10 @@ module BABYLON {
             this.onUpdateParameters.notifyObservers(this);
         }
 
+        public getClassName(): string {
+            return "ImageProcessingConfiguration";
+        }                 
+
         /**
          * Prepare the list of uniforms associated with the Image Processing effects.
          * @param uniformsList The list of uniforms used in the effect

+ 193 - 0
src/Math/babylon.math.scalar.ts

@@ -0,0 +1,193 @@
+module BABYLON {
+
+    export class Scalar {
+        /**
+         * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
+         */
+        public static WithinEpsilon(a: number, b: number, epsilon: number = 1.401298E-45): boolean {
+            var num = a - b;
+            return -epsilon <= num && num <= epsilon;
+        }
+
+        /**
+         * Returns a string : the upper case translation of the number i to hexadecimal.  
+         */
+        public static ToHex(i: number): string {
+            var str = i.toString(16);
+
+            if (i <= 15) {
+                return ("0" + str).toUpperCase();
+            }
+
+            return str.toUpperCase();
+        }
+
+        /**
+         * Returns -1 if value is negative and +1 is value is positive.  
+         * Returns the value itself if it's equal to zero.  
+         */
+        public static Sign(value: number): number {
+            value = +value; // convert to a number
+
+            if (value === 0 || isNaN(value))
+                return value;
+
+            return value > 0 ? 1 : -1;
+        }
+
+        /**
+         * Returns the value itself if it's between min and max.  
+         * Returns min if the value is lower than min.
+         * Returns max if the value is greater than max.  
+         */
+        public static Clamp(value: number, min = 0, max = 1): number {
+            return Math.min(max, Math.max(min, value));
+        }
+
+        /**
+         * Returns the log2 of value.
+         */
+        public static Log2(value: number): number {
+            return Math.log(value) * Math.LOG2E;
+        }
+
+        /**
+        * Loops the value, so that it is never larger than length and never smaller than 0.
+        * 
+        * This is similar to the modulo operator but it works with floating point numbers. 
+        * For example, using 3.0 for t and 2.5 for length, the result would be 0.5. 
+        * With t = 5 and length = 2.5, the result would be 0.0. 
+        * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
+        */
+        public static Repeat(value: number, length: number): number {
+            return value - Math.floor(value / length) * length;
+        }
+
+        /**
+        * Normalize the value between 0.0 and 1.0 using min and max values
+        */
+        public static Normalize(value: number, min: number, max: number): number {
+            return (value - min) / (max - min);
+        }
+
+        /**
+        * Denormalize the value from 0.0 and 1.0 using min and max values
+        */
+        public static Denormalize(normalized: number, min: number, max: number): number {
+            return (normalized * (max - min) + min);
+        }
+
+        /**
+        * Calculates the shortest difference between two given angles given in degrees.
+        */
+        public static DeltaAngle(current: number, target: number): number {
+            var num: number = Scalar.Repeat(target - current, 360.0);
+            if (num > 180.0) {
+                num -= 360.0;
+            }
+            return num;
+        }
+
+        /**
+        * PingPongs the value t, so that it is never larger than length and never smaller than 0.
+        * 
+        * The returned value will move back and forth between 0 and length
+        */
+        public static PingPong(tx: number, length: number): number {
+            var t: number = Scalar.Repeat(tx, length * 2.0);
+            return length - Math.abs(t - length);
+        }
+
+        /**
+        * Interpolates between min and max with smoothing at the limits.
+        *
+        * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
+        * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
+        */
+        public static SmoothStep(from: number, to: number, tx: number): number {
+            var t: number = Scalar.Clamp(tx);
+            t = -2.0 * t * t * t + 3.0 * t * t;
+            return to * t + from * (1.0 - t);
+        }
+
+        /**
+        * Moves a value current towards target.
+        * 
+        * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
+        * Negative values of maxDelta pushes the value away from target.
+        */
+        public static MoveTowards(current: number, target: number, maxDelta: number): number {
+            var result: number = 0;
+            if (Math.abs(target - current) <= maxDelta) {
+                result = target;
+            } else {
+                result = current + Scalar.Sign(target - current) * maxDelta;
+            }
+            return result;
+        }
+
+        /**
+        * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
+        *
+        * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
+        *  are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
+        */
+        public static MoveTowardsAngle(current: number, target: number, maxDelta: number): number {
+            var num: number = Scalar.DeltaAngle(current, target);
+            var result: number = 0;
+            if (-maxDelta < num && num < maxDelta) {
+                result = target;
+            } else {
+                target = current + num;
+                result = Scalar.MoveTowards(current, target, maxDelta);
+            }
+            return result;
+        }
+
+     /**
+         * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
+         */
+        public static Lerp(start: number, end: number, amount: number): number {
+            return start + ((end - start) * amount);
+        }
+
+        /**
+        * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
+        * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
+        */
+        public static LerpAngle(start: number, end: number, amount: number): number {
+            var num: number = Scalar.Repeat(end - start, 360.0);
+            if (num > 180.0) {
+                num -= 360.0;
+            }
+            return start + num * Scalar.Clamp(amount);
+        }
+
+        /**
+        * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
+        */
+        public static InverseLerp(a: number, b: number, value: number): number {
+            var result: number = 0;
+            if (a != b) {
+                result = Scalar.Clamp((value - a) / (b - a));
+            } else {
+                result = 0.0;
+            }
+            return result;
+        }
+
+        /**
+         * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
+         */
+        public static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number {
+            var squared = amount * amount;
+            var cubed = amount * squared;
+            var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
+            var part2 = (-2.0 * cubed) + (3.0 * squared);
+            var part3 = (cubed - (2.0 * squared)) + amount;
+            var part4 = cubed - squared;
+
+            return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
+        }        
+    }
+}

+ 13 - 223
src/Math/babylon.math.ts

@@ -6,216 +6,6 @@
     export const ToLinearSpace = 2.2;
     export const Epsilon = 0.001;
 
-    export class MathTools {
-        /**
-         * Boolean : true if the absolute difference between a and b is lower than epsilon (default = 1.401298E-45)
-         */
-        public static WithinEpsilon(a: number, b: number, epsilon: number = 1.401298E-45): boolean {
-            var num = a - b;
-            return -epsilon <= num && num <= epsilon;
-        }
-
-        /**
-         * Returns a string : the upper case translation of the number i to hexadecimal.  
-         */
-        public static ToHex(i: number): string {
-            var str = i.toString(16);
-
-            if (i <= 15) {
-                return ("0" + str).toUpperCase();
-            }
-
-            return str.toUpperCase();
-        }
-
-        /**
-         * Returns -1 if value is negative and +1 is value is positive.  
-         * Returns the value itself if it's equal to zero.  
-         */
-        public static Sign(value: number): number {
-            value = +value; // convert to a number
-
-            if (value === 0 || isNaN(value))
-                return value;
-
-            return value > 0 ? 1 : -1;
-        }
-
-        /**
-         * Returns the value itself if it's between min and max.  
-         * Returns min if the value is lower than min.
-         * Returns max if the value is greater than max.  
-         */
-        public static Clamp(value: number, min = 0, max = 1): number {
-            return Math.min(max, Math.max(min, value));
-        }
-
-        /**
-         * Returns the log2 of value.
-         */
-        public static Log2(value: number): number {
-            return Math.log(value) * Math.LOG2E;
-        }
-
-        /**
-        * Loops the value, so that it is never larger than length and never smaller than 0.
-        * 
-        * This is similar to the modulo operator but it works with floating point numbers. 
-        * For example, using 3.0 for t and 2.5 for length, the result would be 0.5. 
-        * With t = 5 and length = 2.5, the result would be 0.0. 
-        * Note, however, that the behaviour is not defined for negative numbers as it is for the modulo operator
-        */
-        public static Repeat(value: number, length: number): number {
-            return value - Math.floor(value / length) * length;
-        }
-
-        /**
-        * Normalize the value between 0.0 and 1.0 using min and max values
-        */
-        public static Normalize(value: number, min: number, max: number): number {
-            return (value - min) / (max - min);
-        }
-
-        /**
-        * Denormalize the value from 0.0 and 1.0 using min and max values
-        */
-        public static Denormalize(normalized: number, min: number, max: number): number {
-            return (normalized * (max - min) + min);
-        }
-
-        /**
-        * Clamps value between 0 and 1 and returns value.
-        */
-        public static ClampValue(value: number): number {
-            var result: number = 0;
-            if (value < 0.0) {
-                result = 0.0;
-            } else if (value > 1.0) {
-                result = 1.0;
-            } else {
-                result = value;
-            }
-            return result;
-        }
-
-        /**
-        * Calculates the shortest difference between two given angles given in degrees.
-        */
-        public static DeltaAngle(current: number, target: number): number {
-            var num: number = MathTools.Repeat(target - current, 360.0);
-            if (num > 180.0) {
-                num -= 360.0;
-            }
-            return num;
-        }
-
-        /**
-        * PingPongs the value t, so that it is never larger than length and never smaller than 0.
-        * 
-        * The returned value will move back and forth between 0 and length
-        */
-        public static PingPong(tx: number, length: number): number {
-            var t: number = MathTools.Repeat(tx, length * 2.0);
-            return length - Math.abs(t - length);
-        }
-
-        /**
-        * Interpolates between min and max with smoothing at the limits.
-        *
-        * This function interpolates between min and max in a similar way to Lerp. However, the interpolation will gradually speed up
-        * from the start and slow down toward the end. This is useful for creating natural-looking animation, fading and other transitions.
-        */
-        public static SmoothStep(from: number, to: number, tx: number): number {
-            var t: number = MathTools.ClampValue(tx);
-            t = -2.0 * t * t * t + 3.0 * t * t;
-            return to * t + from * (1.0 - t);
-        }
-
-        /**
-        * Moves a value current towards target.
-        * 
-        * This is essentially the same as Mathf.Lerp but instead the function will ensure that the speed never exceeds maxDelta.
-        * Negative values of maxDelta pushes the value away from target.
-        */
-        public static MoveTowards(current: number, target: number, maxDelta: number): number {
-            var result: number = 0;
-            if (Math.abs(target - current) <= maxDelta) {
-                result = target;
-            } else {
-                result = current + MathTools.Sign(target - current) * maxDelta;
-            }
-            return result;
-        }
-
-        /**
-        * Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.
-        *
-        * Variables current and target are assumed to be in degrees. For optimization reasons, negative values of maxDelta
-        *  are not supported and may cause oscillation. To push current away from a target angle, add 180 to that angle instead.
-        */
-        public static MoveTowardsAngle(current: number, target: number, maxDelta: number): number {
-            var num: number = MathTools.DeltaAngle(current, target);
-            var result: number = 0;
-            if (-maxDelta < num && num < maxDelta) {
-                result = target;
-            } else {
-                target = current + num;
-                result = MathTools.MoveTowards(current, target, maxDelta);
-            }
-            return result;
-        }
-    }
-
-
-    export class Scalar {
-        /**
-         * Creates a new scalar with values linearly interpolated of "amount" between the start scalar and the end scalar.
-         */
-        public static Lerp(start: number, end: number, amount: number): number {
-            return start + ((end - start) * amount);
-        }
-
-        /**
-        * Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
-        * The parameter t is clamped to the range [0, 1]. Variables a and b are assumed to be in degrees.
-        */
-        public static LerpAngle(start: number, end: number, amount: number): number {
-            var num: number = MathTools.Repeat(end - start, 360.0);
-            if (num > 180.0) {
-                num -= 360.0;
-            }
-            return start + num * MathTools.ClampValue(amount);
-        }
-
-        /**
-        * Calculates the linear parameter t that produces the interpolant value within the range [a, b].
-        */
-        public static InverseLerp(a: number, b: number, value: number): number {
-            var result: number = 0;
-            if (a != b) {
-                result = MathTools.ClampValue((value - a) / (b - a));
-            } else {
-                result = 0.0;
-            }
-            return result;
-        }
-
-        /**
-         * Returns a new scalar located for "amount" (float) on the Hermite spline defined by the scalars "value1", "value3", "tangent1", "tangent2".
-         */
-        public static Hermite(value1: number, tangent1: number, value2: number, tangent2: number, amount: number): number {
-            var squared = amount * amount;
-            var cubed = amount * squared;
-            var part1 = ((2.0 * cubed) - (3.0 * squared)) + 1.0;
-            var part2 = (-2.0 * cubed) + (3.0 * squared);
-            var part3 = (cubed - (2.0 * squared)) + amount;
-            var part4 = cubed - squared;
-
-            return (((value1 * part1) + (value2 * part2)) + (tangent1 * part3)) + (tangent2 * part4);
-        }
-    }
-
-
     export class Color3 {
         /**
          * Creates a new Color3 object from red, green, blue values, all between 0 and 1.  
@@ -417,7 +207,7 @@
             var intR = (this.r * 255) | 0;
             var intG = (this.g * 255) | 0;
             var intB = (this.b * 255) | 0;
-            return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB);
+            return "#" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB);
         }
 
         /**
@@ -690,7 +480,7 @@
             var intG = (this.g * 255) | 0;
             var intB = (this.b * 255) | 0;
             var intA = (this.a * 255) | 0;
-            return "#" + MathTools.ToHex(intR) + MathTools.ToHex(intG) + MathTools.ToHex(intB) + MathTools.ToHex(intA);
+            return "#" + Scalar.ToHex(intR) + Scalar.ToHex(intG) + Scalar.ToHex(intB) + Scalar.ToHex(intA);
         }
 
         /**
@@ -1006,7 +796,7 @@
          * Boolean : True if the passed vector coordinates are close to the current ones by a distance of epsilon.  
          */
         public equalsWithEpsilon(otherVector: Vector2, epsilon: number = Epsilon): boolean {
-            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon);
+            return otherVector && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon);
         }
 
         // Properties
@@ -1438,7 +1228,7 @@
          * Boolean : True if the current Vector3 and the passed vector coordinates are distant less than epsilon.
          */
         public equalsWithEpsilon(otherVector: Vector3, epsilon: number = Epsilon): boolean {
-            return otherVector && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon) && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon) && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon);
+            return otherVector && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon) && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon) && Scalar.WithinEpsilon(this.z, otherVector.z, epsilon);
         }
 
         /**
@@ -1914,7 +1704,7 @@
             var vector = Vector3.TransformCoordinates(source, matrix);
             var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
 
-            if (MathTools.WithinEpsilon(num, 1.0)) {
+            if (Scalar.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
 
@@ -1930,7 +1720,7 @@
             var vector = Vector3.TransformCoordinates(screenSource, matrix);
             var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
 
-            if (MathTools.WithinEpsilon(num, 1.0)) {
+            if (Scalar.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }
 
@@ -2188,10 +1978,10 @@
          */
         public equalsWithEpsilon(otherVector: Vector4, epsilon: number = Epsilon): boolean {
             return otherVector
-                && MathTools.WithinEpsilon(this.x, otherVector.x, epsilon)
-                && MathTools.WithinEpsilon(this.y, otherVector.y, epsilon)
-                && MathTools.WithinEpsilon(this.z, otherVector.z, epsilon)
-                && MathTools.WithinEpsilon(this.w, otherVector.w, epsilon);
+                && Scalar.WithinEpsilon(this.x, otherVector.x, epsilon)
+                && Scalar.WithinEpsilon(this.y, otherVector.y, epsilon)
+                && Scalar.WithinEpsilon(this.z, otherVector.z, epsilon)
+                && Scalar.WithinEpsilon(this.w, otherVector.w, epsilon);
         }
 
         /**
@@ -5105,13 +4895,13 @@
 
             if (va === undefined || va === null) {
                 var point: Vector3;
-                if (!MathTools.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {     // search for a point in the plane
+                if (!Scalar.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, Epsilon)) {     // search for a point in the plane
                     point = new Vector3(0.0, -1.0, 0.0);
                 }
-                else if (!MathTools.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {
+                else if (!Scalar.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, Epsilon)) {
                     point = new Vector3(1.0, 0.0, 0.0);
                 }
-                else if (!MathTools.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {
+                else if (!Scalar.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, Epsilon)) {
                     point = new Vector3(0.0, 0.0, 1.0);
                 }
                 normal0 = Vector3.Cross(vt, point);

+ 3 - 3
src/Mesh/babylon.geometry.ts

@@ -145,7 +145,7 @@
                 for (var index = 0; index < numOfMeshes; index++) {
                     var mesh = meshes[index];
                     mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);
-                    mesh._createGlobalSubMesh();
+                    mesh._createGlobalSubMesh(false);
                     mesh.computeWorldMatrix(true);
                 }
             }
@@ -315,7 +315,7 @@
             var numOfMeshes = meshes.length;
 
             for (var index = 0; index < numOfMeshes; index++) {
-                meshes[index]._createGlobalSubMesh();
+                meshes[index]._createGlobalSubMesh(true);
             }
             this.notifyUpdate();
         }
@@ -432,7 +432,7 @@
                     }
                     mesh._boundingInfo = new BoundingInfo(this._extend.minimum, this._extend.maximum);
 
-                    mesh._createGlobalSubMesh();
+                    mesh._createGlobalSubMesh(false);
 
                     //bounding info was just created again, world matrix should be applied again.
                     mesh._updateBoundingInfo();

+ 13 - 9
src/Mesh/babylon.mesh.ts

@@ -638,7 +638,7 @@
             return this;
         }
 
-        public _createGlobalSubMesh(): SubMesh {
+        public _createGlobalSubMesh(force: boolean): SubMesh {
             var totalVertices = this.getTotalVertices();
             if (!totalVertices || !this.getIndices()) {
                 return null;
@@ -649,15 +649,19 @@
                 var totalIndices = this.getIndices().length;
                 let needToRecreate = false;
     
-                for (var submesh of this.subMeshes) {
-                    if (submesh.indexStart + submesh.indexCount >= totalIndices) {
-                        needToRecreate = true;
-                        break;
-                    }
+                if (force) {
+                    needToRecreate = true;
+                } else {
+                    for (var submesh of this.subMeshes) {
+                        if (submesh.indexStart + submesh.indexCount >= totalIndices) {
+                            needToRecreate = true;
+                            break;
+                        }
 
-                    if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
-                        needToRecreate = true;
-                        break;
+                        if (submesh.verticesStart + submesh.verticesCount >= totalVertices) {
+                            needToRecreate = true;
+                            break;
+                        }
                     }
                 }
 

+ 4 - 4
src/Mesh/babylon.mesh.vertexData.ts

@@ -1646,15 +1646,15 @@
             var face: number = 0;
             for (var index = 0; index < normals.length; index += 3) { 
                 //Edge Face  no. 1
-                if(Math.abs(normals[index + 1]) == 0) {
+                if(Math.abs(normals[index + 1]) < 0.001) {
                    face = 1; 
                 }
                 //Top Face  no. 0
-                if(normals[index + 1] == 1) {
+                if(Math.abs(normals[index + 1] - 1) < 0.001 ) {
                    face = 0; 
                 }
                 //Bottom Face  no. 2
-                if(normals[index + 1] == -1) {
+                if(Math.abs(normals[index + 1] + 1) < 0.001 ) {
                    face = 2; 
                 }
                 idx = index / 3;
@@ -2526,4 +2526,4 @@
             geometry.setAllVerticesData(vertexData, parsedVertexData.updatable);
         }
     }
-}
+}

+ 1 - 1
src/PostProcess/RenderPipeline/Pipelines/babylon.standardRenderingPipeline.ts

@@ -594,7 +594,7 @@
                     }
                 }
 
-                outputLiminance = MathTools.Clamp(outputLiminance, this.hdrMinimumLuminance, 1e20);
+                outputLiminance = Scalar.Clamp(outputLiminance, this.hdrMinimumLuminance, 1e20);
 
                 effect.setFloat("averageLuminance", outputLiminance);
 

+ 4 - 0
src/PostProcess/RenderPipeline/babylon.postProcessRenderPipeline.ts

@@ -24,6 +24,10 @@ module BABYLON {
             this._cameras = [];
         }
 
+        public getClassName(): string {
+            return "PostProcessRenderPipeline";
+        }        
+
         public get isSupported(): boolean {
             for (var renderEffectName in this._renderEffects) {
                 if (!this._renderEffects[renderEffectName].isSupported) {

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


部分文件因文件數量過多而無法顯示