Procházet zdrojové kódy

updated Mesh.CreatePlane : added support for size optional parameter in options + blank options

jbousquie před 10 roky
rodič
revize
741f6418a2
1 změnil soubory, kde provedl 11 přidání a 2 odebrání
  1. 11 2
      src/Mesh/babylon.mesh.ts

+ 11 - 2
src/Mesh/babylon.mesh.ts

@@ -1703,11 +1703,20 @@
 
         // Plane & ground
         public static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
-        public static CreatePlane(name: string, options: { width?: number, height?: number, sideOrientation?: number, updatable?: boolean }, scene: Scene): Mesh;
+        public static CreatePlane(name: string, options: { size?: number, width?: number, height?: number, sideOrientation?: number, updatable?: boolean }, scene: Scene): Mesh;
         public static CreatePlane(name: string, options: any, scene: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
+            if (typeof options === 'number') {
+                var size = options;
+                options = {
+                    size: size,
+                    width: size,
+                    height: size,
+                    sideOrientation: sideOrientation
+                }
+            }
             var plane = new Mesh(name, scene);
 
-            var vertexData = VertexData.CreatePlane(options, sideOrientation);
+            var vertexData = VertexData.CreatePlane(options);
 
             vertexData.applyToMesh(plane, updatable || options.updatable);