Browse Source

Fixing CreateCylinder

David Catuhe 11 năm trước cách đây
mục cha
commit
4dad4c53a0

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

@@ -750,6 +750,15 @@ var BABYLON;
 
         // Cylinder and cone (Code inspired by SharpDX.org)
         Mesh.CreateCylinder = function (name, height, diameterTop, diameterBottom, tessellation, subdivisions, scene, updatable) {
+            // subdivisions is a new parameter, we need to support old signature
+            if (scene === undefined || !(scene instanceof BABYLON.Scene)) {
+                if (scene !== undefined) {
+                    updatable = scene;
+                }
+                scene = subdivisions;
+                subdivisions = 1;
+            }
+
             var cylinder = new BABYLON.Mesh(name, scene);
             var vertexData = BABYLON.VertexData.CreateCylinder(height, diameterTop, diameterBottom, tessellation, subdivisions);
 

+ 10 - 1
Babylon/Mesh/babylon.mesh.ts

@@ -759,7 +759,16 @@
         }
 
         // Cylinder and cone (Code inspired by SharpDX.org)
-        public static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh {
+        public static CreateCylinder(name: string, height: number, diameterTop: number, diameterBottom: number, tessellation: number, subdivisions: any, scene: Scene, updatable?: any): Mesh {
+            // subdivisions is a new parameter, we need to support old signature
+            if (scene === undefined || !(scene instanceof Scene)) {
+                if (scene !== undefined) {
+                    updatable = scene;
+                }
+                scene = <Scene>subdivisions;
+                subdivisions = 1;
+            }
+
             var cylinder = new BABYLON.Mesh(name, scene);
             var vertexData = BABYLON.VertexData.CreateCylinder(height, diameterTop, diameterBottom, tessellation, subdivisions);
 

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1 - 1
babylon.1.13-beta-debug.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 3 - 3
babylon.1.13-beta.js