Bladeren bron

Cleaning things up
Moving to Release candidate

David Catuhe 10 jaren geleden
bovenliggende
commit
b9f1ba0c88

+ 2 - 1
Babylon/Mesh/babylon.csg.js

@@ -258,7 +258,7 @@ var BABYLON;
         }
         // Convert BABYLON.Mesh to BABYLON.CSG
         CSG.FromMesh = function (mesh) {
-            var vertex, normal, uv, position, polygon, polygons = [], vertices;
+            var vertex, normal, uv, position, polygon, polygons = new Array(), vertices;
             var matrix, meshPosition, meshRotation, meshRotationQuaternion, meshScaling;
             if (mesh instanceof BABYLON.Mesh) {
                 mesh.computeWorldMatrix(true);
@@ -506,3 +506,4 @@ var BABYLON;
     })();
     BABYLON.CSG = CSG;
 })(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.csg.js.map

+ 9 - 9
Babylon/Mesh/babylon.csg.ts

@@ -280,16 +280,16 @@
         public scaling: Vector3;
 
         // Convert BABYLON.Mesh to BABYLON.CSG
-        public static FromMesh(mesh: Mesh) {
-            var vertex, normal, uv, position,
-                polygon,
-                polygons = [],
+        public static FromMesh(mesh: Mesh): CSG {
+            var vertex: Vertex, normal: Vector3, uv: Vector2, position: Vector3,
+                polygon: Polygon,
+                polygons = new Array<Polygon>(),
                 vertices;
-			var matrix, 
-				meshPosition,
-				meshRotation,
-				meshRotationQuaternion,
-				meshScaling;
+			var matrix : Matrix, 
+				meshPosition : Vector3,
+				meshRotation : Vector3,
+				meshRotationQuaternion: Quaternion,
+				meshScaling: Vector3;
 				
             if (mesh instanceof BABYLON.Mesh) {
                 mesh.computeWorldMatrix(true);

+ 1 - 0
Babylon/Mesh/babylon.mesh.js

@@ -1659,3 +1659,4 @@ var BABYLON;
     })(BABYLON.AbstractMesh);
     BABYLON.Mesh = Mesh;
 })(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.mesh.js.map

+ 1 - 0
Babylon/Mesh/babylon.mesh.vertexData.js

@@ -1073,3 +1073,4 @@ var BABYLON;
     })();
     BABYLON.VertexData = VertexData;
 })(BABYLON || (BABYLON = {}));
+//# sourceMappingURL=babylon.mesh.vertexData.js.map

+ 22 - 21
babylon.2.1-beta.debug.js

@@ -15121,19 +15121,15 @@ var BABYLON;
         Mesh.CreateLines = function (name, points, scene, updatable, linesInstance) {
             if (linesInstance === void 0) { linesInstance = null; }
             if (linesInstance) {
-                var positionsOfLines = function (points) {
-                    var positionFunction = function (positions) {
-                        var i = 0;
-                        for (var p = 0; p < points.length; p++) {
-                            positions[i] = points[p].x;
-                            positions[i + 1] = points[p].y;
-                            positions[i + 2] = points[p].z;
-                            i += 3;
-                        }
-                    };
-                    return positionFunction;
+                var positionFunction = function (positions) {
+                    var i = 0;
+                    for (var p = 0; p < points.length; p++) {
+                        positions[i] = points[p].x;
+                        positions[i + 1] = points[p].y;
+                        positions[i + 2] = points[p].z;
+                        i += 3;
+                    }
                 };
-                var positionFunction = positionsOfLines(points);
                 linesInstance.updateMeshPositions(positionFunction, false);
                 return linesInstance;
             }
@@ -15166,8 +15162,8 @@ var BABYLON;
                     dashshft = linesInstance.dashSize * shft / (linesInstance.dashSize + linesInstance.gapSize);
                     for (i = 0; i < points.length - 1; i++) {
                         points[i + 1].subtractToRef(points[i], curvect);
-                        curvect.normalize();
                         nb = Math.floor(curvect.length() / shft);
+                        curvect.normalize();
                         j = 0;
                         while (j < nb && p < positions.length) {
                             curshft = shft * j;
@@ -23930,14 +23926,17 @@ var BABYLON;
         }
         // Convert BABYLON.Mesh to BABYLON.CSG
         CSG.FromMesh = function (mesh) {
-            var vertex, normal, uv, position, polygon, polygons = [], vertices;
+            var vertex, normal, uv, position, polygon, polygons = new Array(), vertices;
+            var matrix, meshPosition, meshRotation, meshRotationQuaternion, meshScaling;
             if (mesh instanceof BABYLON.Mesh) {
                 mesh.computeWorldMatrix(true);
-                var matrix = mesh.getWorldMatrix();
-                var meshPosition = mesh.position.clone();
-                var meshRotation = mesh.rotation.clone();
-                var meshRotationQuaternion = mesh.rotationQuaternion.clone();
-                var meshScaling = mesh.scaling.clone();
+                matrix = mesh.getWorldMatrix();
+                meshPosition = mesh.position.clone();
+                meshRotation = mesh.rotation.clone();
+                if (mesh.rotationQuaternion) {
+                    meshRotationQuaternion = mesh.rotationQuaternion.clone();
+                }
+                meshScaling = mesh.scaling.clone();
             }
             else {
                 throw 'BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh';
@@ -24164,7 +24163,9 @@ var BABYLON;
             mesh.material = material;
             mesh.position.copyFrom(this.position);
             mesh.rotation.copyFrom(this.rotation);
-            mesh.rotationQuaternion.copyFrom(this.rotationQuaternion);
+            if (this.rotationQuaternion) {
+                mesh.rotationQuaternion = this.rotationQuaternion.clone();
+            }
             mesh.scaling.copyFrom(this.scaling);
             mesh.computeWorldMatrix(true);
             return mesh;
@@ -25373,8 +25374,8 @@ var BABYLON;
             dashshft = dashSize * shft / (dashSize + gapSize);
             for (i = 0; i < points.length - 1; i++) {
                 points[i + 1].subtractToRef(points[i], curvect);
-                curvect.normalize();
                 nb = Math.floor(curvect.length() / shft);
+                curvect.normalize();
                 for (var j = 0; j < nb; j++) {
                     curshft = shft * j;
                     positions.push(points[i].x + curshft * curvect.x, points[i].y + curshft * curvect.y, points[i].z + curshft * curvect.z);

File diff suppressed because it is too large
+ 10 - 10
babylon.2.1-beta.js


File diff suppressed because it is too large
+ 10 - 10
babylon.2.1-beta.noworker.js