Browse Source

adding warning message when parent/children order is not respected when adding physics impostors
Fixes #2069

David Catuhe 8 years ago
parent
commit
08faf23dd8

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


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


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

@@ -7521,6 +7521,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(Engine, "ALPHA_PREMULTIPLIED_PORTERDUFF", {
+            get: function () {
+                return Engine._ALPHA_PREMULTIPLIED_PORTERDUFF;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(Engine, "DELAYLOADSTATE_NONE", {
             get: function () {
                 return Engine._DELAYLOADSTATE_NONE;
@@ -8755,6 +8762,10 @@ var BABYLON;
                     this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
                     this._alphaState.alphaBlend = true;
                     break;
+                case Engine.ALPHA_PREMULTIPLIED_PORTERDUFF:
+                    this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE_MINUS_SRC_ALPHA);
+                    this._alphaState.alphaBlend = true;
+                    break;
                 case Engine.ALPHA_COMBINE:
                     this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA, this._gl.ONE_MINUS_SRC_ALPHA, this._gl.ONE, this._gl.ONE);
                     this._alphaState.alphaBlend = true;
@@ -10058,6 +10069,7 @@ var BABYLON;
     Engine._ALPHA_MAXIMIZED = 5;
     Engine._ALPHA_ONEONE = 6;
     Engine._ALPHA_PREMULTIPLIED = 7;
+    Engine._ALPHA_PREMULTIPLIED_PORTERDUFF = 8;
     Engine._DELAYLOADSTATE_NONE = 0;
     Engine._DELAYLOADSTATE_LOADED = 1;
     Engine._DELAYLOADSTATE_LOADING = 2;
@@ -55208,6 +55220,9 @@ var BABYLON;
                 if (!this.object.parent) {
                     this._init();
                 }
+                else if (this.object.parent.physicsImpostor) {
+                    BABYLON.Tools.Warn("You must affect impostors to children before affecting impostor to parent.");
+                }
             }
         }
         /**

File diff suppressed because it is too large
+ 3384 - 3382
dist/preview release/babylon.module.d.ts


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


+ 29 - 27
dist/preview release/canvas2D/babylon.canvas2d.js

@@ -6140,36 +6140,38 @@ var BABYLON;
          */
         PrimitiveAlignment.prototype.fromString = function (value) {
             var m = value.trim().split(",");
-            if (m.length === 1) {
+            var hset = false;
+            var vset = false;
+            for (var _i = 0, m_1 = m; _i < m_1.length; _i++) {
+                var v = m_1[_i];
+                v = v.toLocaleLowerCase().trim();
+                // Horizontal
+                var i = v.indexOf("h:");
+                if (i === -1) {
+                    i = v.indexOf("horizontal:");
+                }
+                if (i !== -1) {
+                    v = v.substr(v.indexOf(":") + 1);
+                    this.setHorizontal(v);
+                    hset = true;
+                    continue;
+                }
+                // Vertical
+                i = v.indexOf("v:");
+                if (i === -1) {
+                    i = v.indexOf("vertical:");
+                }
+                if (i !== -1) {
+                    v = v.substr(v.indexOf(":") + 1);
+                    this.setVertical(v);
+                    vset = true;
+                    continue;
+                }
+            }
+            if (!hset && !vset && m.length === 1) {
                 this.setHorizontal(m[0]);
                 this.setVertical(m[0]);
             }
-            else {
-                for (var _i = 0, m_1 = m; _i < m_1.length; _i++) {
-                    var v = m_1[_i];
-                    v = v.toLocaleLowerCase().trim();
-                    // Horizontal
-                    var i = v.indexOf("h:");
-                    if (i === -1) {
-                        i = v.indexOf("horizontal:");
-                    }
-                    if (i !== -1) {
-                        v = v.substr(v.indexOf(":") + 1);
-                        this.setHorizontal(v);
-                        continue;
-                    }
-                    // Vertical
-                    i = v.indexOf("v:");
-                    if (i === -1) {
-                        i = v.indexOf("vertical:");
-                    }
-                    if (i !== -1) {
-                        v = v.substr(v.indexOf(":") + 1);
-                        this.setVertical(v);
-                        continue;
-                    }
-                }
-            }
         };
         PrimitiveAlignment.prototype.copyFrom = function (pa) {
             this._horizontal = pa._horizontal;

File diff suppressed because it is too large
+ 2 - 2
dist/preview release/canvas2D/babylon.canvas2d.min.js


+ 2 - 0
src/Physics/babylon.physicsImpostor.ts

@@ -86,6 +86,8 @@ module BABYLON {
                 //If the mesh has a parent, don't initialize the physicsBody. Instead wait for the parent to do that.
                 if (!this.object.parent) {
                     this._init();
+                } else if (this.object.parent.physicsImpostor) {
+                    Tools.Warn("You must affect impostors to children before affecting impostor to parent.");
                 }
             }
         }