Browse Source

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

David Catuhe 5 years ago
parent
commit
140d6beaa5

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

@@ -192,6 +192,7 @@
 - Fixed `TextureLinkLineComponent` to no longer invert inspector-loaded textures ([Drigax](https://github.com/drigax))
 - Fixed `TextureLinkLineComponent` to no longer invert inspector-loaded textures ([Drigax](https://github.com/drigax))
 - Fixed a single frame drop after leaving webxr on some devices ([RaananW](https://github.com/RaananW/))
 - Fixed a single frame drop after leaving webxr on some devices ([RaananW](https://github.com/RaananW/))
 - Fixed bug where vignette aspect ratio would be wrong when rendering direct to canvas
 - Fixed bug where vignette aspect ratio would be wrong when rendering direct to canvas
+- Fixed Path2 length computation ([Poolminer](https://github.com/Poolminer/))
 
 
 ## Breaking changes
 ## Breaking changes
 
 

+ 1 - 0
src/Materials/Node/Blocks/Dual/reflectionTextureBlock.ts

@@ -430,6 +430,7 @@ export class ReflectionTextureBlock extends NodeMaterialBlock {
         super._deserialize(serializationObject, scene, rootUrl);
         super._deserialize(serializationObject, scene, rootUrl);
 
 
         if (serializationObject.texture) {
         if (serializationObject.texture) {
+            rootUrl = serializationObject.texture.url.indexOf("data:") === 0 ? rootUrl : "";
             if (serializationObject.texture.isCube) {
             if (serializationObject.texture.isCube) {
                 this.texture = CubeTexture.Parse(serializationObject.texture, scene, rootUrl);
                 this.texture = CubeTexture.Parse(serializationObject.texture, scene, rootUrl);
             } else {
             } else {

+ 1 - 0
src/Materials/Node/Blocks/Dual/textureBlock.ts

@@ -375,6 +375,7 @@ export class TextureBlock extends NodeMaterialBlock {
         super._deserialize(serializationObject, scene, rootUrl);
         super._deserialize(serializationObject, scene, rootUrl);
 
 
         if (serializationObject.texture) {
         if (serializationObject.texture) {
+            rootUrl = serializationObject.texture.url.indexOf("data:") === 0 ? rootUrl : "";
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
             this.texture = Texture.Parse(serializationObject.texture, scene, rootUrl) as Texture;
         }
         }
     }
     }

+ 1 - 1
src/Maths/math.path.ts

@@ -265,7 +265,7 @@ export class Path2 {
     public length(): number {
     public length(): number {
         var result = this._length;
         var result = this._length;
 
 
-        if (!this.closed) {
+        if (this.closed) {
             var lastPoint = this._points[this._points.length - 1];
             var lastPoint = this._points[this._points.length - 1];
             var firstPoint = this._points[0];
             var firstPoint = this._points[0];
             result += (firstPoint.subtract(lastPoint).length());
             result += (firstPoint.subtract(lastPoint).length());

+ 2 - 4
src/Maths/math.vector.ts

@@ -368,10 +368,8 @@ export class Vector2 {
             return this;
             return this;
         }
         }
 
 
-        var num = 1.0 / len;
-
-        this.x *= num;
-        this.y *= num;
+        this.x /= len;
+        this.y /= len;
 
 
         return this;
         return this;
     }
     }