Browse Source

Improved toMesh signature for CSG

David Catuhe 7 năm trước cách đây
mục cha
commit
b16dd465ed
2 tập tin đã thay đổi với 5272 bổ sung5272 xóa
  1. 5258 5258
      dist/preview release/babylon.d.ts
  2. 14 14
      src/Mesh/babylon.csg.ts

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 5258 - 5258
dist/preview release/babylon.d.ts


+ 14 - 14
src/Mesh/babylon.csg.ts

@@ -33,7 +33,7 @@
             return new Vertex(Vector3.Lerp(this.pos, other.pos, t),
                 Vector3.Lerp(this.normal, other.normal, t),
                 Vector2.Lerp(this.uv, other.uv, t)
-                );
+            );
         }
     }
 
@@ -287,20 +287,20 @@
                 polygon: Polygon,
                 polygons = new Array<Polygon>(),
                 vertices;
-			var matrix : Matrix, 
-				meshPosition : Vector3,
-				meshRotation : Vector3,
-				meshRotationQuaternion: Nullable<Quaternion> = null,
-				meshScaling: Vector3;
-				
+            var matrix: Matrix,
+                meshPosition: Vector3,
+                meshRotation: Vector3,
+                meshRotationQuaternion: Nullable<Quaternion> = null,
+                meshScaling: Vector3;
+
             if (mesh instanceof Mesh) {
                 mesh.computeWorldMatrix(true);
                 matrix = mesh.getWorldMatrix();
                 meshPosition = mesh.position.clone();
                 meshRotation = mesh.rotation.clone();
-				if(mesh.rotationQuaternion) {
-					meshRotationQuaternion = mesh.rotationQuaternion.clone();
-				}
+                if (mesh.rotationQuaternion) {
+                    meshRotationQuaternion = mesh.rotationQuaternion.clone();
+                }
                 meshScaling = mesh.scaling.clone();
             } else {
                 throw 'BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh';
@@ -587,16 +587,16 @@
         }
 
         // Build Mesh from CSG taking material and transforms into account
-        public toMesh(name: string, material: Material, scene: Scene, keepSubMeshes: boolean): Mesh {
+        public toMesh(name: string, material: Nullable<Material>, scene: Scene, keepSubMeshes: boolean): Mesh {
             var mesh = this.buildMeshGeometry(name, scene, keepSubMeshes);
 
             mesh.material = material;
 
             mesh.position.copyFrom(this.position);
             mesh.rotation.copyFrom(this.rotation);
-			if(this.rotationQuaternion) {
-				mesh.rotationQuaternion = this.rotationQuaternion.clone();
-			}
+            if (this.rotationQuaternion) {
+                mesh.rotationQuaternion = this.rotationQuaternion.clone();
+            }
             mesh.scaling.copyFrom(this.scaling);
             mesh.computeWorldMatrix(true);