Explorar o código

Updated Mesh.CreateLathe() : supports now the parameter "options"

jbousquie %!s(int64=10) %!d(string=hai) anos
pai
achega
c83454e74a
Modificáronse 1 ficheiros con 18 adicións e 1 borrados
  1. 18 1
      src/Mesh/babylon.mesh.ts

+ 18 - 1
src/Mesh/babylon.mesh.ts

@@ -1769,7 +1769,24 @@
         }
 
         // Lathe
-        public static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
+        public static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
+        public static CreateLathe(name: string, options: {shape: Vector3[], radius?: number, tessellation?: number, updatable?: boolean, sideOrientation?: number}, scene: Scene): Mesh;
+        public static CreateLathe(name: string, options: any, radiusOrScene: any, tessellation?: number, scene?: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
+            var shape: Vector3[];
+            var radius: number;
+            if (Array.isArray(options)) {
+                shape = options;
+                radius = radiusOrScene || 1;
+                tessellation = tessellation || 64;
+
+            } else {
+                scene = radiusOrScene;
+                shape = options.shape;
+                radius = options.radius || 1;
+                tessellation = options.tessellation || 64;
+                updatable = options.updatable;
+                sideOrientation = (options.sideOrientation === 0) ? 0 : options.sideOrientation || Mesh.DEFAULTSIDE;
+            }
             radius = radius || 1;
             tessellation = tessellation || radius * 60;
             var pi2 = Math.PI * 2;