David Catuhe 9 years ago
parent
commit
29214d7d02

File diff suppressed because it is too large
+ 21 - 21
dist/preview release/babylon.core.js


File diff suppressed because it is too large
+ 4541 - 4540
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 35 - 35
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 46 - 33
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 34 - 34
dist/preview release/babylon.noworker.js


+ 1 - 4
src/Canvas2d/babylon.canvas2d.js

@@ -441,7 +441,7 @@ var BABYLON;
             ii.pickPosition.y = mouseLocalPos.y;
             ii.pickPosition.y = mouseLocalPos.y;
             ii.findFirstOnly = false;
             ii.findFirstOnly = false;
             // Fast rejection: test if the mouse pointer is outside the canvas's bounding Info
             // Fast rejection: test if the mouse pointer is outside the canvas's bounding Info
-            if (!isCapture && !this.boundingInfo.doesIntersect(ii.pickPosition)) {
+            if (!isCapture && !this.levelBoundingInfo.doesIntersect(ii.pickPosition)) {
                 this._previousIntersectionList = this._actualIntersectionList;
                 this._previousIntersectionList = this._actualIntersectionList;
                 this._actualIntersectionList = null;
                 this._actualIntersectionList = null;
                 this._previousOverPrimitive = this._actualOverPrimitive;
                 this._previousOverPrimitive = this._actualOverPrimitive;
@@ -960,9 +960,6 @@ var BABYLON;
         Canvas2D.prototype.addUpdateGlobalTransformCounter = function (count) {
         Canvas2D.prototype.addUpdateGlobalTransformCounter = function (count) {
             this._updateGlobalTransformCounter.addCount(count, false);
             this._updateGlobalTransformCounter.addCount(count, false);
         };
         };
-        Canvas2D.prototype.onPrimBecomesDirty = function () {
-            this._addPrimToDirtyList(this);
-        };
         Canvas2D.prototype._updateTrackedNodes = function () {
         Canvas2D.prototype._updateTrackedNodes = function () {
             var cam = this.scene.cameraToUseForPointers || this.scene.activeCamera;
             var cam = this.scene.cameraToUseForPointers || this.scene.activeCamera;
             cam.getViewMatrix().multiplyToRef(cam.getProjectionMatrix(), Canvas2D._m);
             cam.getViewMatrix().multiplyToRef(cam.getProjectionMatrix(), Canvas2D._m);

+ 3 - 0
src/Canvas2d/babylon.group2d.js

@@ -445,6 +445,9 @@ var BABYLON;
                 engine.setDepthWrite(curDepthWrite);
                 engine.setDepthWrite(curDepthWrite);
             }
             }
         };
         };
+        Group2D.prototype._setCacheGroupDirty = function () {
+            this._cacheGroupDirty = true;
+        };
         Group2D.prototype._updateTransparentData = function () {
         Group2D.prototype._updateTransparentData = function () {
             this.owner._addUpdateTransparentDataCount(1);
             this.owner._addUpdateTransparentDataCount(1);
             var rd = this._renderableData;
             var rd = this._renderableData;

+ 4 - 2
src/Canvas2d/babylon.prim2dBase.js

@@ -2526,8 +2526,10 @@ var BABYLON;
                 this._paddingOffset.copyFrom(Prim2DBase._icPos);
                 this._paddingOffset.copyFrom(Prim2DBase._icPos);
                 this._contentArea.copyFrom(Prim2DBase._icArea);
                 this._contentArea.copyFrom(Prim2DBase._icArea);
             }
             }
-            var aPos = new BABYLON.Vector2(this._layoutAreaPos.x + this._marginOffset.x, this._layoutAreaPos.y + this._marginOffset.y);
-            this.actualPosition = aPos;
+            if (!this._position) {
+                var aPos = new BABYLON.Vector2(this._layoutAreaPos.x + this._marginOffset.x, this._layoutAreaPos.y + this._marginOffset.y);
+                this.actualPosition = aPos;
+            }
             if (isSizeAuto) {
             if (isSizeAuto) {
                 this._lastAutoSizeArea = this.size;
                 this._lastAutoSizeArea = this.size;
             }
             }

+ 4 - 1
src/Canvas2d/babylon.renderablePrim2d.js

@@ -374,6 +374,9 @@ var BABYLON;
             if (!_super.prototype.dispose.call(this)) {
             if (!_super.prototype.dispose.call(this)) {
                 return false;
                 return false;
             }
             }
+            if (this.renderGroup) {
+                this.renderGroup._setCacheGroupDirty();
+            }
             if (this._transparentPrimitiveInfo) {
             if (this._transparentPrimitiveInfo) {
                 this.renderGroup._renderableData.removeTransparentPrimitiveInfo(this._transparentPrimitiveInfo);
                 this.renderGroup._renderableData.removeTransparentPrimitiveInfo(this._transparentPrimitiveInfo);
                 this._transparentPrimitiveInfo = null;
                 this._transparentPrimitiveInfo = null;
@@ -630,7 +633,7 @@ var BABYLON;
                 var part = _a[_i];
                 var part = _a[_i];
                 var justAllocated = false;
                 var justAllocated = false;
                 // Check if we need to allocate data elements (hidden prim which becomes visible again)
                 // Check if we need to allocate data elements (hidden prim which becomes visible again)
-                if (!part.dataElements && (visChanged || rmChanged)) {
+                if (!part.dataElements && (visChanged || rmChanged || this.isVisible)) {
                     part.allocElements();
                     part.allocElements();
                     justAllocated = true;
                     justAllocated = true;
                 }
                 }

+ 15 - 11
src/Math/babylon.math.js

@@ -2833,7 +2833,7 @@ var BABYLON;
             if (!this._raw) {
             if (!this._raw) {
                 this._binormals[0].normalize();
                 this._binormals[0].normalize();
             }
             }
-            this._distances[0] = 0;
+            this._distances[0] = 0.0;
             // normals and binormals : next points
             // normals and binormals : next points
             var prev; // previous vector (segment)
             var prev; // previous vector (segment)
             var cur; // current vector (segment)
             var cur; // current vector (segment)
@@ -2890,16 +2890,20 @@ var BABYLON;
         // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0
         // if va is passed, it returns the va projection on the plane orthogonal to vt at the point v0
         Path3D.prototype._normalVector = function (v0, vt, va) {
         Path3D.prototype._normalVector = function (v0, vt, va) {
             var normal0;
             var normal0;
+            var tgl = vt.length();
+            if (tgl === 0.0) {
+                tgl = 1.0;
+            }
             if (va === undefined || va === null) {
             if (va === undefined || va === null) {
                 var point;
                 var point;
-                if (!MathTools.WithinEpsilon(vt.y, 1, BABYLON.Epsilon)) {
-                    point = new Vector3(0, -1, 0);
+                if (!MathTools.WithinEpsilon(Math.abs(vt.y) / tgl, 1.0, BABYLON.Epsilon)) {
+                    point = new Vector3(0.0, -1.0, 0.0);
                 }
                 }
-                else if (!MathTools.WithinEpsilon(vt.x, 1, BABYLON.Epsilon)) {
-                    point = new Vector3(1, 0, 0);
+                else if (!MathTools.WithinEpsilon(Math.abs(vt.x) / tgl, 1.0, BABYLON.Epsilon)) {
+                    point = new Vector3(1.0, 0.0, 0.0);
                 }
                 }
-                else if (!MathTools.WithinEpsilon(vt.z, 1, BABYLON.Epsilon)) {
-                    point = new Vector3(0, 0, 1);
+                else if (!MathTools.WithinEpsilon(Math.abs(vt.z) / tgl, 1.0, BABYLON.Epsilon)) {
+                    point = new Vector3(0.0, 0.0, 1.0);
                 }
                 }
                 normal0 = Vector3.Cross(vt, point);
                 normal0 = Vector3.Cross(vt, point);
             }
             }
@@ -2920,7 +2924,7 @@ var BABYLON;
          * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
          * Tuto : http://doc.babylonjs.com/tutorials/How_to_use_Curve3#curve3-object
          */
          */
         function Curve3(points) {
         function Curve3(points) {
-            this._length = 0;
+            this._length = 0.0;
             this._points = points;
             this._points = points;
             this._length = this._computeLength(points);
             this._length = this._computeLength(points);
         }
         }
@@ -2935,7 +2939,7 @@ var BABYLON;
             nbPoints = nbPoints > 2 ? nbPoints : 3;
             nbPoints = nbPoints > 2 ? nbPoints : 3;
             var bez = new Array();
             var bez = new Array();
             var equation = function (t, val0, val1, val2) {
             var equation = function (t, val0, val1, val2) {
-                var res = (1 - t) * (1 - t) * val0 + 2 * t * (1 - t) * val1 + t * t * val2;
+                var res = (1.0 - t) * (1.0 - t) * val0 + 2.0 * t * (1.0 - t) * val1 + t * t * val2;
                 return res;
                 return res;
             };
             };
             for (var i = 0; i <= nbPoints; i++) {
             for (var i = 0; i <= nbPoints; i++) {
@@ -2955,7 +2959,7 @@ var BABYLON;
             nbPoints = nbPoints > 3 ? nbPoints : 4;
             nbPoints = nbPoints > 3 ? nbPoints : 4;
             var bez = new Array();
             var bez = new Array();
             var equation = function (t, val0, val1, val2, val3) {
             var equation = function (t, val0, val1, val2, val3) {
-                var res = (1 - t) * (1 - t) * (1 - t) * val0 + 3 * t * (1 - t) * (1 - t) * val1 + 3 * t * t * (1 - t) * val2 + t * t * t * val3;
+                var res = (1.0 - t) * (1.0 - t) * (1.0 - t) * val0 + 3.0 * t * (1.0 - t) * (1.0 - t) * val1 + 3.0 * t * t * (1.0 - t) * val2 + t * t * t * val3;
                 return res;
                 return res;
             };
             };
             for (var i = 0; i <= nbPoints; i++) {
             for (var i = 0; i <= nbPoints; i++) {
@@ -2973,7 +2977,7 @@ var BABYLON;
          */
          */
         Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {
         Curve3.CreateHermiteSpline = function (p1, t1, p2, t2, nbPoints) {
             var hermite = new Array();
             var hermite = new Array();
-            var step = 1 / nbPoints;
+            var step = 1.0 / nbPoints;
             for (var i = 0; i <= nbPoints; i++) {
             for (var i = 0; i <= nbPoints; i++) {
                 hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));
                 hermite.push(Vector3.Hermite(p1, t1, p2, t2, i * step));
             }
             }

+ 1 - 0
src/Tools/babylon.assetsManager.js

@@ -88,6 +88,7 @@ var BABYLON;
         ImageAssetTask.prototype.run = function (scene, onSuccess, onError) {
         ImageAssetTask.prototype.run = function (scene, onSuccess, onError) {
             var _this = this;
             var _this = this;
             var img = new Image();
             var img = new Image();
+            BABYLON.Tools.SetCorsBehavior(this.url, img);
             img.onload = function () {
             img.onload = function () {
                 _this.image = img;
                 _this.image = img;
                 _this.isCompleted = true;
                 _this.isCompleted = true;

+ 17 - 14
src/Tools/babylon.tools.js

@@ -235,6 +235,22 @@ var BABYLON;
                 document.msCancelFullScreen();
                 document.msCancelFullScreen();
             }
             }
         };
         };
+        Tools.SetCorsBehavior = function (url, img) {
+            if (Tools.CorsBehavior) {
+                switch (typeof (Tools.CorsBehavior)) {
+                    case "function":
+                        var result = Tools.CorsBehavior(url);
+                        if (result) {
+                            return result;
+                        }
+                        break;
+                    case "string":
+                    default:
+                        img.crossOrigin = Tools.CorsBehavior;
+                        break;
+                }
+            }
+        };
         // External files
         // External files
         Tools.CleanUrl = function (url) {
         Tools.CleanUrl = function (url) {
             url = url.replace(/#/mg, "%23");
             url = url.replace(/#/mg, "%23");
@@ -247,20 +263,7 @@ var BABYLON;
             url = Tools.CleanUrl(url);
             url = Tools.CleanUrl(url);
             var img = new Image();
             var img = new Image();
             if (url.substr(0, 5) !== "data:") {
             if (url.substr(0, 5) !== "data:") {
-                if (Tools.CorsBehavior) {
-                    switch (typeof (Tools.CorsBehavior)) {
-                        case "function":
-                            var result = Tools.CorsBehavior(url);
-                            if (result) {
-                                img.crossOrigin = result;
-                            }
-                            break;
-                        case "string":
-                        default:
-                            img.crossOrigin = Tools.CorsBehavior;
-                            break;
-                    }
-                }
+                Tools.SetCorsBehavior(url, img);
             }
             }
             img.onload = function () {
             img.onload = function () {
                 onload(img);
                 onload(img);