瀏覽代碼

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

# Conflicts:
#	dist/preview release/babylon.d.ts
#	dist/preview release/babylon.js
#	dist/preview release/babylon.module.d.ts
#	dist/preview release/babylon.worker.js
davrous 8 年之前
父節點
當前提交
c39094ecac

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


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


+ 114 - 35
dist/preview release/babylon.max.js

@@ -841,6 +841,12 @@ var __extends = (this && this.__extends) || (function () {
             return new Vector2(0, 0);
         };
         /**
+         * Returns a new Vector2(1, 1)
+         */
+        Vector2.One = function () {
+            return new Vector2(1, 1);
+        };
+        /**
          * Returns a new Vector2 set from the passed index element of the passed array.
          */
         Vector2.FromArray = function (array, offset) {
@@ -1378,6 +1384,12 @@ var __extends = (this && this.__extends) || (function () {
             return new Vector3(0.0, 0.0, 0.0);
         };
         /**
+         * Returns a new Vector3 set to (1.0, 1.0, 1.0).
+         */
+        Vector3.One = function () {
+            return new Vector3(1.0, 1.0, 1.0);
+        };
+        /**
          * Returns a new Vector3 set to (0.0, 1.0, 0.0)
          */
         Vector3.Up = function () {
@@ -2041,6 +2053,12 @@ var __extends = (this && this.__extends) || (function () {
             return new Vector4(0.0, 0.0, 0.0, 0.0);
         };
         /**
+         * Returns a new Vector4 set to (1.0, 1.0, 1.0, 1.0)
+         */
+        Vector4.One = function () {
+            return new Vector4(1.0, 1.0, 1.0, 1.0);
+        };
+        /**
          * Returns a new normalized Vector4 from the passed one.
          */
         Vector4.Normalize = function (vector) {
@@ -11187,9 +11205,9 @@ var BABYLON;
             _this.onAfterWorldMatrixUpdateObservable = new BABYLON.Observable();
             // Properties
             _this.definedFacingForward = true; // orientation for POV movement & rotation
-            _this.position = new BABYLON.Vector3(0.0, 0.0, 0.0);
-            _this._rotation = new BABYLON.Vector3(0.0, 0.0, 0.0);
-            _this._scaling = new BABYLON.Vector3(1.0, 1.0, 1.0);
+            _this.position = BABYLON.Vector3.Zero();
+            _this._rotation = BABYLON.Vector3.Zero();
+            _this._scaling = BABYLON.Vector3.One();
             _this.billboardMode = AbstractMesh.BILLBOARDMODE_NONE;
             _this.visibility = 1.0;
             _this.alphaIndex = Number.MAX_VALUE;
@@ -19088,10 +19106,6 @@ var BABYLON;
             _this._deleteBuffer = deleteBuffer;
             _this._format = format;
             scene = _this.getScene();
-            if (!url) {
-                return _this;
-            }
-            _this._texture = _this._getFromCache(url, noMipmap, samplingMode);
             var load = function () {
                 if (_this._onLoadObservarble && _this._onLoadObservarble.hasObservers()) {
                     _this.onLoadObservable.notifyObservers(true);
@@ -19103,6 +19117,12 @@ var BABYLON;
                     scene.resetCachedMaterial();
                 }
             };
+            if (!url) {
+                _this._delayedOnLoad = load;
+                _this._delayedOnError = onError;
+                return _this;
+            }
+            _this._texture = _this._getFromCache(url, noMipmap, samplingMode);
             if (!_this._texture) {
                 if (!scene.useDelayedTextureLoading) {
                     _this._texture = scene.getEngine().createTexture(url, noMipmap, invertY, scene, _this._samplingMode, load, onError, _this._buffer, null, _this._format);
@@ -19143,7 +19163,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Texture.prototype.updateURL = function (url) {
+            this.url = url;
+            this.delayLoadState = BABYLON.Engine.DELAYLOADSTATE_NOTLOADED;
+            this.delayLoad();
+        };
         Texture.prototype.delayLoad = function () {
+            var _this = this;
             if (this.delayLoadState !== BABYLON.Engine.DELAYLOADSTATE_NOTLOADED) {
                 return;
             }
@@ -19155,6 +19181,14 @@ var BABYLON;
                     delete this._buffer;
                 }
             }
+            else {
+                if (this._texture.isReady) {
+                    BABYLON.Tools.SetImmediate(function () { return _this._delayedOnLoad(); });
+                }
+                else {
+                    this._texture.onLoadedCallbacks.push(this._delayedOnLoad);
+                }
+            }
         };
         Texture.prototype.updateSamplingMode = function (samplingMode) {
             if (!this._texture) {
@@ -37373,7 +37407,7 @@ var BABYLON;
     })();
     var Collider = (function () {
         function Collider() {
-            this.radius = new BABYLON.Vector3(1, 1, 1);
+            this.radius = BABYLON.Vector3.One();
             this.retry = 0;
             this.basePointWorld = BABYLON.Vector3.Zero();
             this.velocityWorld = BABYLON.Vector3.Zero();
@@ -38426,7 +38460,7 @@ var BABYLON;
             this.color = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0); // color
             this.position = BABYLON.Vector3.Zero(); // position
             this.rotation = BABYLON.Vector3.Zero(); // rotation
-            this.scaling = new BABYLON.Vector3(1.0, 1.0, 1.0); // scaling
+            this.scaling = BABYLON.Vector3.One(); // scaling
             this.uvs = new BABYLON.Vector4(0.0, 0.0, 1.0, 1.0); // uvs
             this.velocity = BABYLON.Vector3.Zero(); // velocity
             this.alive = true; // alive
@@ -41501,7 +41535,7 @@ var BABYLON;
             var normals = sourceMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
             var position = options.position || BABYLON.Vector3.Zero();
             var normal = options.normal || BABYLON.Vector3.Up();
-            var size = options.size || new BABYLON.Vector3(1, 1, 1);
+            var size = options.size || BABYLON.Vector3.One();
             var angle = options.angle || 0;
             // Getting correct rotation
             if (!normal) {
@@ -43450,8 +43484,9 @@ var BABYLON;
             _this.mirrorPlane = new BABYLON.Plane(0, 1, 0, 1);
             _this._transformMatrix = BABYLON.Matrix.Zero();
             _this._mirrorMatrix = BABYLON.Matrix.Zero();
-            _this._blurKernel = 0;
-            _this._blurRatio = 0.6;
+            _this._blurKernelX = 0;
+            _this._blurKernelY = 0;
+            _this._blurRatio = 1.0;
             _this.onBeforeRenderObservable.add(function () {
                 BABYLON.Matrix.ReflectionToRef(_this.mirrorPlane, _this._mirrorMatrix);
                 _this._savedViewMatrix = scene.getViewMatrix();
@@ -43484,14 +43519,36 @@ var BABYLON;
             configurable: true
         });
         Object.defineProperty(MirrorTexture.prototype, "blurKernel", {
+            set: function (value) {
+                this.blurKernelX = value;
+                this.blurKernelY = value;
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(MirrorTexture.prototype, "blurKernelX", {
             get: function () {
-                return this._blurKernel;
+                return this._blurKernelX;
             },
             set: function (value) {
-                if (this._blurKernel === value) {
+                if (this._blurKernelX === value) {
                     return;
                 }
-                this._blurKernel = value;
+                this._blurKernelX = value;
+                this._preparePostProcesses();
+            },
+            enumerable: true,
+            configurable: true
+        });
+        Object.defineProperty(MirrorTexture.prototype, "blurKernelY", {
+            get: function () {
+                return this._blurKernelY;
+            },
+            set: function (value) {
+                if (this._blurKernelY === value) {
+                    return;
+                }
+                this._blurKernelY = value;
                 this._preparePostProcesses();
             },
             enumerable: true,
@@ -43499,15 +43556,20 @@ var BABYLON;
         });
         MirrorTexture.prototype._preparePostProcesses = function () {
             this.clearPostProcesses(true);
-            if (this._blurKernel) {
+            if (this._blurKernelX && this._blurKernelY) {
                 var engine = this.getScene().getEngine();
                 var textureType = engine.getCaps().textureFloatRender ? BABYLON.Engine.TEXTURETYPE_FLOAT : BABYLON.Engine.TEXTURETYPE_HALF_FLOAT;
-                this._blurX = new BABYLON.BlurPostProcess("horizontal blur", new BABYLON.Vector2(1.0, 0), this._blurKernel, this._blurRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false, textureType);
+                this._blurX = new BABYLON.BlurPostProcess("horizontal blur", new BABYLON.Vector2(1.0, 0), this._blurKernelX, this._blurRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false, textureType);
                 this._blurX.autoClear = false;
-                this._blurX.alwaysForcePOT = false;
-                this._blurY = new BABYLON.BlurPostProcess("vertical blur", new BABYLON.Vector2(0, 1.0), this._blurKernel, this._blurRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false, textureType);
+                if (this._blurRatio === 1) {
+                    this._blurX.outputTexture = this._texture;
+                }
+                else {
+                    this._blurX.alwaysForcePOT = true;
+                }
+                this._blurY = new BABYLON.BlurPostProcess("vertical blur", new BABYLON.Vector2(0, 1.0), this._blurKernelY, this._blurRatio, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, engine, false, textureType);
                 this._blurY.autoClear = false;
-                this._blurY.alwaysForcePOT = true;
+                this._blurY.alwaysForcePOT = this._blurRatio !== 1;
                 this.addPostProcess(this._blurX);
                 this.addPostProcess(this._blurY);
             }
@@ -44110,6 +44172,8 @@ var BABYLON;
             }
             else if (this._forcedOutputTexture) {
                 target = this._forcedOutputTexture;
+                this.width = this._forcedOutputTexture._width;
+                this.height = this._forcedOutputTexture._height;
             }
             else {
                 target = this.outputTexture;
@@ -52308,6 +52372,7 @@ var BABYLON;
     var Bone = (function (_super) {
         __extends(Bone, _super);
         function Bone(name, skeleton, parentBone, matrix, restPose) {
+            if (parentBone === void 0) { parentBone = null; }
             var _this = _super.call(this, name, skeleton.getScene()) || this;
             _this.name = name;
             _this.children = new Array();
@@ -52316,25 +52381,16 @@ var BABYLON;
             _this._absoluteTransform = new BABYLON.Matrix();
             _this._invertedAbsoluteTransform = new BABYLON.Matrix();
             _this._scaleMatrix = BABYLON.Matrix.Identity();
-            _this._scaleVector = new BABYLON.Vector3(1, 1, 1);
-            _this._negateScaleChildren = new BABYLON.Vector3(1, 1, 1);
+            _this._scaleVector = BABYLON.Vector3.One();
+            _this._negateScaleChildren = BABYLON.Vector3.One();
             _this._scalingDeterminant = 1;
             _this._skeleton = skeleton;
-            _this._localMatrix = matrix;
-            _this._baseMatrix = matrix.clone();
-            _this._restPose = restPose ? restPose : matrix.clone();
+            _this._localMatrix = matrix ? matrix : BABYLON.Matrix.Identity();
+            _this._baseMatrix = _this._localMatrix.clone();
+            _this._restPose = restPose ? restPose : _this._localMatrix.clone();
             skeleton.bones.push(_this);
-            if (parentBone) {
-                _this._parent = parentBone;
-                parentBone.children.push(_this);
-            }
-            else {
-                _this._parent = null;
-            }
+            _this.setParent(parentBone, false);
             _this._updateDifferenceMatrix();
-            if (_this.getAbsoluteTransform().determinant() < 0) {
-                _this._scalingDeterminant *= -1;
-            }
             return _this;
         }
         Object.defineProperty(Bone.prototype, "_matrix", {
@@ -52353,9 +52409,31 @@ var BABYLON;
             configurable: true
         });
         // Members
+        Bone.prototype.getSkeleton = function () {
+            return this._skeleton;
+        };
         Bone.prototype.getParent = function () {
             return this._parent;
         };
+        Bone.prototype.setParent = function (parent, updateDifferenceMatrix) {
+            if (updateDifferenceMatrix === void 0) { updateDifferenceMatrix = true; }
+            if (this._parent === parent) {
+                return;
+            }
+            if (this._parent) {
+                var index = this._parent.children.indexOf(this);
+                if (index !== -1) {
+                    this._parent.children.splice(index);
+                }
+            }
+            this._parent = parent;
+            if (this._parent) {
+                this._parent.children.push(this);
+            }
+            if (updateDifferenceMatrix) {
+                this._updateDifferenceMatrix();
+            }
+        };
         Bone.prototype.getLocalMatrix = function () {
             return this._localMatrix;
         };
@@ -52442,6 +52520,7 @@ var BABYLON;
             for (var index = 0; index < this.children.length; index++) {
                 this.children[index]._updateDifferenceMatrix();
             }
+            this._scalingDeterminant = (this._absoluteTransform.determinant() < 0 ? -1 : 1);
         };
         Bone.prototype.markAsDirty = function () {
             this._currentRenderId++;

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


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