Sfoglia il codice sorgente

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

David Catuhe 8 anni fa
parent
commit
8aad6df288

+ 8 - 0
Tools/Gulp/gulpfile.js

@@ -26,6 +26,8 @@ var zip = require('gulp-zip');
 var config = require("./config.json");
 var customConfig = require("./custom.config.json");
 
+var del = require('del');
+
 var debug = require('gulp-debug');
 var includeShadersStream;
 var shadersStream;
@@ -393,3 +395,9 @@ gulp.task("zip-blender" , function() {
     .pipe(zip('Blender2Babylon-5.2.zip'))
     .pipe(gulp.dest('../../Exporters/Blender'));
 });
+
+gulp.task('clean-JS-MAP', function () {
+	  return del([
+		  '../../src/**/*.js.map','../../src/**/*.js'
+	  ], {force: true});
+	});

+ 2 - 1
Tools/Gulp/package.json

@@ -32,7 +32,8 @@
     "style-loader": "^0.13.1",
     "exports-loader": "^0.6.3",
     "imports-loader": "^0.7.0",
-    "gulp-zip": "~3.2.0"
+    "gulp-zip": "~3.2.0",
+    "del": "2.2.2"
   },
   "scripts": {
     "install": "npm --prefix ../../Playground/ install ../../Playground/ && gulp typescript-compile && gulp typescript-libraries && gulp deployLocalDev"

+ 1 - 1
Tools/Gulp/profiling.html

@@ -75,7 +75,7 @@ On this page:
                         	var name = fileNames[i].match(reg)[0].substring(8);  // remove the babylon.
                         	files[i] = [false, fileNames[i], name];
                         }
-						appendSecondarySearches("math.js", "mathtools|color3|color4|vector2|vector3|vector4|size|quaternion|matrix|plane|viewport|frustum|bezierCurve"); // got tired
+						appendSecondarySearches("math.js", "mathtools|color3|color4|vector2|vector3|vector4|size|quaternion|matrix|plane|viewport|frustum|space|axis|bezierCurve|orientation|angle|arc2|path2|path3d|curve3|sphericalHarmonics|mathTmp");
 
 						// force stuff to always be added
 						appendSecondarySearches("decorators.js", "engine"); //needed for Serialize

+ 0 - 1
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -338,7 +338,6 @@
             object.computeWorldMatrix && object.computeWorldMatrix(true);
             // The delta between the mesh position and the mesh bounding box center
             var center = impostor.getObjectCenter();
-            var extendSize = impostor.getObjectExtendSize();
             this._tmpDeltaPosition.copyFrom(object.position.subtract(center));
             this._tmpPosition.copyFrom(center);
             var quaternion = object.rotationQuaternion;

+ 14 - 1
src/Physics/babylon.physicsImpostor.ts

@@ -15,6 +15,7 @@ module BABYLON {
         parent?: any;
         getBoundingInfo?(): BoundingInfo;
         computeWorldMatrix?(force: boolean): void;
+        getWorldMatrix?(): Matrix;
         getChildMeshes?(): Array<AbstractMesh>;
         getVerticesData?(kind: string): Array<number> | Float32Array;
         getIndices?(): IndicesArray;
@@ -25,6 +26,8 @@ module BABYLON {
 
         public static DEFAULT_OBJECT_SIZE: Vector3 = new BABYLON.Vector3(1, 1, 1);
 
+        public static IDENTITY_QUATERNION = Quaternion.Identity();
+
         private _physicsEngine: PhysicsEngine;
         //The native cannon/oimo/energy physics body object.
         private _physicsBody: any;
@@ -168,8 +171,18 @@ module BABYLON {
 
         public getObjectExtendSize(): Vector3 {
             if (this.object.getBoundingInfo) {
+                let q = this.object.rotationQuaternion;
+                //reset rotation
+                this.object.rotationQuaternion = PhysicsImpostor.IDENTITY_QUATERNION;
+                //calculate the world matrix with no rotation
+                this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);
+                let size = this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2)
+                //bring back the rotation
+                this.object.rotationQuaternion = q;
+                //calculate the world matrix with the new rotation
                 this.object.computeWorldMatrix && this.object.computeWorldMatrix(true);
-                return this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2).multiply(this.object.scaling)
+
+                return size;
             } else {
                 return PhysicsImpostor.DEFAULT_OBJECT_SIZE;
             }