Browse Source

Upgrading Plane and Ground to new model

David catuhe 10 năm trước cách đây
mục cha
commit
8b8238b567

+ 115 - 115
dist/preview release - beta/babylon.2.2.d.ts

@@ -1763,6 +1763,25 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
+    class Layer {
+        name: string;
+        texture: Texture;
+        isBackground: boolean;
+        color: Color4;
+        onDispose: () => void;
+        private _scene;
+        private _vertexDeclaration;
+        private _vertexStrideSize;
+        private _vertexBuffer;
+        private _indexBuffer;
+        private _effect;
+        constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
+        render(): void;
+        dispose(): void;
+    }
+}
+
+declare module BABYLON {
     class ArcRotateCamera extends TargetCamera {
         alpha: number;
         beta: number;
@@ -2269,25 +2288,6 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
-    class Layer {
-        name: string;
-        texture: Texture;
-        isBackground: boolean;
-        color: Color4;
-        onDispose: () => void;
-        private _scene;
-        private _vertexDeclaration;
-        private _vertexStrideSize;
-        private _vertexBuffer;
-        private _indexBuffer;
-        private _effect;
-        constructor(name: string, imgUrl: string, scene: Scene, isBackground?: boolean, color?: Color4);
-        render(): void;
-        dispose(): void;
-    }
-}
-
-declare module BABYLON {
     class LensFlare {
         size: number;
         position: number;
@@ -3200,6 +3200,98 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
+    class Particle {
+        position: Vector3;
+        direction: Vector3;
+        color: Color4;
+        colorStep: Color4;
+        lifeTime: number;
+        age: number;
+        size: number;
+        angle: number;
+        angularSpeed: number;
+        copyTo(other: Particle): void;
+    }
+}
+
+declare module BABYLON {
+    class ParticleSystem implements IDisposable {
+        name: string;
+        static BLENDMODE_ONEONE: number;
+        static BLENDMODE_STANDARD: number;
+        id: string;
+        renderingGroupId: number;
+        emitter: any;
+        emitRate: number;
+        manualEmitCount: number;
+        updateSpeed: number;
+        targetStopDuration: number;
+        disposeOnStop: boolean;
+        minEmitPower: number;
+        maxEmitPower: number;
+        minLifeTime: number;
+        maxLifeTime: number;
+        minSize: number;
+        maxSize: number;
+        minAngularSpeed: number;
+        maxAngularSpeed: number;
+        particleTexture: Texture;
+        onDispose: () => void;
+        updateFunction: (particles: Particle[]) => void;
+        blendMode: number;
+        forceDepthWrite: boolean;
+        gravity: Vector3;
+        direction1: Vector3;
+        direction2: Vector3;
+        minEmitBox: Vector3;
+        maxEmitBox: Vector3;
+        color1: Color4;
+        color2: Color4;
+        colorDead: Color4;
+        textureMask: Color4;
+        startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void;
+        startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void;
+        private particles;
+        private _capacity;
+        private _scene;
+        private _vertexDeclaration;
+        private _vertexStrideSize;
+        private _stockParticles;
+        private _newPartsExcess;
+        private _vertexBuffer;
+        private _indexBuffer;
+        private _vertices;
+        private _effect;
+        private _customEffect;
+        private _cachedDefines;
+        private _scaledColorStep;
+        private _colorDiff;
+        private _scaledDirection;
+        private _scaledGravity;
+        private _currentRenderId;
+        private _alive;
+        private _started;
+        private _stopped;
+        private _actualFrame;
+        private _scaledUpdateSpeed;
+        constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
+        recycleParticle(particle: Particle): void;
+        getCapacity(): number;
+        isAlive(): boolean;
+        isStarted(): boolean;
+        start(): void;
+        stop(): void;
+        _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
+        private _update(newParticles);
+        private _getEffect();
+        animate(): void;
+        render(): number;
+        dispose(): void;
+        clone(name: string, newEmitter: any): ParticleSystem;
+    }
+}
+
+declare module BABYLON {
     class AbstractMesh extends Node implements IDisposable {
         private static _BILLBOARDMODE_NONE;
         private static _BILLBOARDMODE_X;
@@ -3802,8 +3894,8 @@ declare module BABYLON {
         static ExtrudeShapeCustom(name: string, shape: Vector3[], path: Vector3[], scaleFunction: any, rotationFunction: any, ribbonCloseArray: boolean, ribbonClosePath: boolean, cap: number, scene: Scene, updatable?: boolean, sideOrientation?: number, extrudedInstance?: Mesh): Mesh;
         private static _ExtrudeShapeGeneric(name, shape, curve, scale, rotation, scaleFunction, rotateFunction, rbCA, rbCP, cap, custom, scene, updtbl, side, instance);
         static CreateLathe(name: string, shape: Vector3[], radius: number, tessellation: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
-        static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
-        static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
+        static CreatePlane(name: string, options: any, scene: Scene, updatable?: boolean, sideOrientation?: number): Mesh;
+        static CreateGround(name: string, options: any, heightOrScene: any, subdivisions: number, scene: Scene, updatable?: boolean): Mesh;
         static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: {
             w: number;
             h: number;
@@ -3878,7 +3970,7 @@ declare module BABYLON {
         static CreateTorus(diameter: any, thickness: any, tessellation: any, sideOrientation?: number): VertexData;
         static CreateLines(points: Vector3[]): VertexData;
         static CreateDashedLines(points: Vector3[], dashSize: number, gapSize: number, dashNb: number): VertexData;
-        static CreateGround(width: number, height: number, subdivisions: number): VertexData;
+        static CreateGround(options: any, height?: number, subdivisions?: number): VertexData;
         static CreateTiledGround(xmin: number, zmin: number, xmax: number, zmax: number, subdivisions?: {
             w: number;
             h: number;
@@ -3887,7 +3979,7 @@ declare module BABYLON {
             h: number;
         }): VertexData;
         static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData;
-        static CreatePlane(size: number, sideOrientation?: number): VertexData;
+        static CreatePlane(options: any, sideOrientation?: number): VertexData;
         static CreateDisc(radius: number, tessellation: number, sideOrientation?: number): VertexData;
         static CreateTorusKnot(radius: number, tube: number, radialSegments: number, tubularSegments: number, p: number, q: number, sideOrientation?: number): VertexData;
         /**
@@ -4135,98 +4227,6 @@ declare module BABYLON {
 }
 
 declare module BABYLON {
-    class Particle {
-        position: Vector3;
-        direction: Vector3;
-        color: Color4;
-        colorStep: Color4;
-        lifeTime: number;
-        age: number;
-        size: number;
-        angle: number;
-        angularSpeed: number;
-        copyTo(other: Particle): void;
-    }
-}
-
-declare module BABYLON {
-    class ParticleSystem implements IDisposable {
-        name: string;
-        static BLENDMODE_ONEONE: number;
-        static BLENDMODE_STANDARD: number;
-        id: string;
-        renderingGroupId: number;
-        emitter: any;
-        emitRate: number;
-        manualEmitCount: number;
-        updateSpeed: number;
-        targetStopDuration: number;
-        disposeOnStop: boolean;
-        minEmitPower: number;
-        maxEmitPower: number;
-        minLifeTime: number;
-        maxLifeTime: number;
-        minSize: number;
-        maxSize: number;
-        minAngularSpeed: number;
-        maxAngularSpeed: number;
-        particleTexture: Texture;
-        onDispose: () => void;
-        updateFunction: (particles: Particle[]) => void;
-        blendMode: number;
-        forceDepthWrite: boolean;
-        gravity: Vector3;
-        direction1: Vector3;
-        direction2: Vector3;
-        minEmitBox: Vector3;
-        maxEmitBox: Vector3;
-        color1: Color4;
-        color2: Color4;
-        colorDead: Color4;
-        textureMask: Color4;
-        startDirectionFunction: (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3) => void;
-        startPositionFunction: (worldMatrix: Matrix, positionToUpdate: Vector3) => void;
-        private particles;
-        private _capacity;
-        private _scene;
-        private _vertexDeclaration;
-        private _vertexStrideSize;
-        private _stockParticles;
-        private _newPartsExcess;
-        private _vertexBuffer;
-        private _indexBuffer;
-        private _vertices;
-        private _effect;
-        private _customEffect;
-        private _cachedDefines;
-        private _scaledColorStep;
-        private _colorDiff;
-        private _scaledDirection;
-        private _scaledGravity;
-        private _currentRenderId;
-        private _alive;
-        private _started;
-        private _stopped;
-        private _actualFrame;
-        private _scaledUpdateSpeed;
-        constructor(name: string, capacity: number, scene: Scene, customEffect?: Effect);
-        recycleParticle(particle: Particle): void;
-        getCapacity(): number;
-        isAlive(): boolean;
-        isStarted(): boolean;
-        start(): void;
-        stop(): void;
-        _appendParticleVertex(index: number, particle: Particle, offsetX: number, offsetY: number): void;
-        private _update(newParticles);
-        private _getEffect();
-        animate(): void;
-        render(): number;
-        dispose(): void;
-        clone(name: string, newEmitter: any): ParticleSystem;
-    }
-}
-
-declare module BABYLON {
     interface IPhysicsEnginePlugin {
         initialize(iterations?: number): any;
         setGravity(gravity: Vector3): void;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 15 - 20
dist/preview release - beta/babylon.2.2.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 55 - 25
dist/preview release - beta/babylon.2.2.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 14 - 19
dist/preview release - beta/babylon.2.2.noworker.js


+ 3 - 3
dist/preview release - beta/what's new.md

@@ -5,14 +5,14 @@
     - HDR Rendering pipeline. See [demo here]() [julien-moreau](https://github.com/julien-moreau)
     - New rewored StandardMaterial.isReady for better memory usage and performance [deltakosh](https://github.com/deltakosh)
     - Revamping of FBX exporter. Now supports animations and bones [simonferquel](http://www.github.com/simonferquel), [deltakosh](https://github.com/deltakosh)
-    - StandardMaterial.useGlossinessFromSpecularMapAlpha to use specular map alpha as glossiness level [deltakosh](https://github.com/deltakosh)
+    - StandardMaterial.useGlossinessFromSpecularMapAlpha to use specular map alpha as glossiness level [deltakosh](https://github.com/deltakosh)    
+    - Added support for StandardMaterial.roughness. See [demo here](http://www.babylonjs-playground.com/#RNBKQ#8) [deltakosh](https://github.com/deltakosh)
     - OBJ loader. See [demo here](http://www.babylonjs-playground.com/#28YUR5) [Temechon](https://github.com/Temechon)
     - EdgesRenderer. See [demo here](http://www.babylonjs-playground.com/#TYAHX#10) [deltakosh](https://github.com/deltakosh)
   - **Updates**
-    - Added support for StandardMaterial.roughness. See [demo here](http://www.babylonjs-playground.com/#RNBKQ#8) [deltakosh](https://github.com/deltakosh)
     - Compression supported for raw textures [deltakosh](https://github.com/deltakosh)
     - New TonemapPostProcess. See [demo here](http://www.babylonjs-playground.com/#ELTGD) [deltakosh](https://github.com/deltakosh)
-    - New options parameters for Box and Sphere. See [demo here](http://www.html5gamedevs.com/topic/17044-evolution-for-out-of-the-box-meshes-creation/) [deltakosh](https://github.com/deltakosh)
+    - New options parameters for Box, Sphere, Plane and Ground. See [demo here](http://www.html5gamedevs.com/topic/17044-evolution-for-out-of-the-box-meshes-creation/) [deltakosh](https://github.com/deltakosh)
     - Added darkness support for soft shadows [deltakosh](https://github.com/deltakosh)
     - Added scene.getLensFlareSystemByName() [deltakosh](https://github.com/deltakosh)
     - Added LensFlareSystem.setEmitter() [deltakosh](https://github.com/deltakosh)

+ 3 - 4
src/Math/babylon.math.js

@@ -797,10 +797,9 @@ var BABYLON;
         Vector3.Unproject = function (source, viewportWidth, viewportHeight, world, view, projection) {
             var matrix = world.multiply(view).multiply(projection);
             matrix.invert();
-            source.x = source.x / viewportWidth * 2 - 1;
-            source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = Vector3.TransformCoordinates(source, matrix);
-            var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
+            var screenSource = new Vector3(source.x / viewportWidth * 2 - 1, -(source.y / viewportHeight * 2 - 1), source.z);
+            var vector = Vector3.TransformCoordinates(screenSource, matrix);
+            var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
             if (BABYLON.Tools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);
             }

+ 3 - 4
src/Math/babylon.math.ts

@@ -1013,10 +1013,9 @@
         public static Unproject(source: Vector3, viewportWidth: number, viewportHeight: number, world: Matrix, view: Matrix, projection: Matrix): Vector3 {
             var matrix = world.multiply(view).multiply(projection);
             matrix.invert();
-            source.x = source.x / viewportWidth * 2 - 1;
-            source.y = -(source.y / viewportHeight * 2 - 1);
-            var vector = Vector3.TransformCoordinates(source, matrix);
-            var num = source.x * matrix.m[3] + source.y * matrix.m[7] + source.z * matrix.m[11] + matrix.m[15];
+            var screenSource = new Vector3(source.x / viewportWidth * 2 - 1, -(source.y / viewportHeight * 2 - 1), source.z);
+            var vector = Vector3.TransformCoordinates(screenSource, matrix);
+            var num = screenSource.x * matrix.m[3] + screenSource.y * matrix.m[7] + screenSource.z * matrix.m[11] + matrix.m[15];
 
             if (Tools.WithinEpsilon(num, 1.0)) {
                 vector = vector.scale(1.0 / num);

+ 19 - 8
src/Mesh/babylon.mesh.js

@@ -1142,7 +1142,6 @@ var BABYLON;
             if (sideOrientation === void 0) { sideOrientation = Mesh.DEFAULTSIDE; }
             // Check parameters
             updatable = updatable || options.updatable;
-            sideOrientation = sideOrientation || options.sideOrientation;
             var box = new Mesh(name, scene);
             var vertexData = BABYLON.VertexData.CreateBox(options, sideOrientation);
             vertexData.applyToMesh(box, updatable);
@@ -1405,19 +1404,31 @@ var BABYLON;
             return lathe;
         };
         // Plane & ground
-        Mesh.CreatePlane = function (name, size, scene, updatable, sideOrientation) {
+        Mesh.CreatePlane = function (name, options, scene, updatable, sideOrientation) {
             if (sideOrientation === void 0) { sideOrientation = Mesh.DEFAULTSIDE; }
             var plane = new Mesh(name, scene);
-            var vertexData = BABYLON.VertexData.CreatePlane(size, sideOrientation);
-            vertexData.applyToMesh(plane, updatable);
+            var vertexData = BABYLON.VertexData.CreatePlane(options, sideOrientation);
+            vertexData.applyToMesh(plane, updatable || options.updatable);
             return plane;
         };
-        Mesh.CreateGround = function (name, width, height, subdivisions, scene, updatable) {
+        Mesh.CreateGround = function (name, options, heightOrScene, subdivisions, scene, updatable) {
+            if (heightOrScene instanceof BABYLON.Scene) {
+                scene = heightOrScene;
+                updatable = options.updatable;
+            }
+            else {
+                var width = options;
+                options = {
+                    width: width,
+                    height: heightOrScene,
+                    subdivisions: subdivisions
+                };
+            }
             var ground = new BABYLON.GroundMesh(name, scene);
             ground._setReady(false);
-            ground._subdivisions = subdivisions;
-            var vertexData = BABYLON.VertexData.CreateGround(width, height, subdivisions);
-            vertexData.applyToMesh(ground, updatable);
+            ground._subdivisions = options.subdivisions || 1;
+            var vertexData = BABYLON.VertexData.CreateGround(options);
+            vertexData.applyToMesh(ground, updatable || options.updatable);
             ground._setReady(true);
             return ground;
         };

+ 21 - 8
src/Mesh/babylon.mesh.ts

@@ -1333,7 +1333,6 @@
         public static CreateBox(name: string, options: any, scene: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
             // Check parameters
             updatable = updatable || options.updatable;
-            sideOrientation = sideOrientation || options.sideOrientation;
 
             var box = new Mesh(name, scene);
             var vertexData = VertexData.CreateBox(options, sideOrientation);
@@ -1617,23 +1616,37 @@
         }
 
         // Plane & ground
-        public static CreatePlane(name: string, size: number, scene: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
+        public static CreatePlane(name: string, options: any, scene: Scene, updatable?: boolean, sideOrientation: number = Mesh.DEFAULTSIDE): Mesh {
             var plane = new Mesh(name, scene);
-            var vertexData = VertexData.CreatePlane(size, sideOrientation);
 
-            vertexData.applyToMesh(plane, updatable);
+            var vertexData = VertexData.CreatePlane(options, sideOrientation);
+
+            vertexData.applyToMesh(plane, updatable || options.updatable);
 
             return plane;
         }
 
-        public static CreateGround(name: string, width: number, height: number, subdivisions: number, scene: Scene, updatable?: boolean): Mesh {
+        public static CreateGround(name: string, options: any, heightOrScene: any, subdivisions: number, scene: Scene, updatable?: boolean): Mesh {
+            if (heightOrScene instanceof Scene) {
+                scene = heightOrScene;
+                updatable = options.updatable;
+            } else {
+                var width = options;
+
+                options = {
+                    width: width,
+                    height: heightOrScene,
+                    subdivisions: subdivisions
+                }
+            }
+
             var ground = new GroundMesh(name, scene);
             ground._setReady(false);
-            ground._subdivisions = subdivisions;
+            ground._subdivisions = options.subdivisions || 1;
 
-            var vertexData = VertexData.CreateGround(width, height, subdivisions);
+            var vertexData = VertexData.CreateGround(options);
 
-            vertexData.applyToMesh(ground, updatable);
+            vertexData.applyToMesh(ground, updatable || options.updatable);
 
             ground._setReady(true);
 

+ 32 - 12
src/Mesh/babylon.mesh.vertexData.js

@@ -497,6 +497,7 @@ var BABYLON;
                 height = options || 1;
                 depth = options || 1;
             }
+            sideOrientation = sideOrientation || options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
             var scaleVector = new BABYLON.Vector3(width / 2, height / 2, depth / 2);
             // Create each face in turn.
             for (var index = 0; index < normalsSource.length; index++) {
@@ -558,7 +559,7 @@ var BABYLON;
                 diameterY = diameterX;
                 diameterZ = diameterX;
             }
-            sideOrientation = sideOrientation || options.sideOrientation;
+            sideOrientation = sideOrientation || options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
             var radius = new BABYLON.Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);
             var totalZRotationSteps = 2 + segments;
             var totalYRotationSteps = 2 * totalZRotationSteps;
@@ -809,15 +810,23 @@ var BABYLON;
             vertexData.indices = indices;
             return vertexData;
         };
-        VertexData.CreateGround = function (width, height, subdivisions) {
+        VertexData.CreateGround = function (options, height, subdivisions) {
             var indices = [];
             var positions = [];
             var normals = [];
             var uvs = [];
             var row, col;
-            width = width || 1;
-            height = height || 1;
-            subdivisions = subdivisions || 1;
+            var width;
+            if (options.width) {
+                width = options.width || 1;
+                height = options.height || 1;
+                subdivisions = options.subdivisions || 1;
+            }
+            else {
+                width = options || 1;
+                height = height || 1;
+                subdivisions = subdivisions || 1;
+            }
             for (row = 0; row <= subdivisions; row++) {
                 for (col = 0; col <= subdivisions; col++) {
                     var position = new BABYLON.Vector3((col * width) / subdivisions - (width / 2.0), 0, ((subdivisions - row) * height) / subdivisions - (height / 2.0));
@@ -954,25 +963,36 @@ var BABYLON;
             vertexData.uvs = uvs;
             return vertexData;
         };
-        VertexData.CreatePlane = function (size, sideOrientation) {
+        VertexData.CreatePlane = function (options, sideOrientation) {
             if (sideOrientation === void 0) { sideOrientation = BABYLON.Mesh.DEFAULTSIDE; }
             var indices = [];
             var positions = [];
             var normals = [];
             var uvs = [];
-            size = size || 1;
+            var width;
+            var height;
+            if (options.width) {
+                width = options.width || 1;
+                height = options.height || 1;
+                sideOrientation = options.sideOrientation || BABYLON.Mesh.DEFAULTSIDE;
+            }
+            else {
+                width = options || 1;
+                height = options || 1;
+            }
             // Vertices
-            var halfSize = size / 2.0;
-            positions.push(-halfSize, -halfSize, 0);
+            var halfWidth = width / 2.0;
+            var halfHeight = height / 2.0;
+            positions.push(-halfWidth, -halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(0.0, 0.0);
-            positions.push(halfSize, -halfSize, 0);
+            positions.push(halfWidth, -halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(1.0, 0.0);
-            positions.push(halfSize, halfSize, 0);
+            positions.push(halfWidth, halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(1.0, 1.0);
-            positions.push(-halfSize, halfSize, 0);
+            positions.push(-halfWidth, halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(0.0, 1.0);
             // Indices

+ 34 - 12
src/Mesh/babylon.mesh.vertexData.ts

@@ -603,6 +603,8 @@
                 depth = options || 1;
             }
 
+            sideOrientation = sideOrientation || options.sideOrientation || Mesh.DEFAULTSIDE;
+
             var scaleVector = new Vector3(width / 2, height / 2, depth / 2);
 
             // Create each face in turn.
@@ -677,7 +679,7 @@
                 diameterZ = diameterX;
             }
 
-            sideOrientation = sideOrientation || options.sideOrientation;
+            sideOrientation = sideOrientation || options.sideOrientation || Mesh.DEFAULTSIDE;
 
             var radius = new Vector3(diameterX / 2, diameterY / 2, diameterZ / 2);
 
@@ -982,16 +984,24 @@
             return vertexData;
         }
 
-        public static CreateGround(width: number, height: number, subdivisions: number): VertexData {
+        public static CreateGround(options: any, height?: number, subdivisions?: number): VertexData {
             var indices = [];
             var positions = [];
             var normals = [];
             var uvs = [];
             var row: number, col: number;
 
-            width = width || 1;
-            height = height || 1;
-            subdivisions = subdivisions || 1;
+            var width: number;
+
+            if (options.width) {
+                width = options.width || 1;
+                height = options.height || 1;
+                subdivisions = options.subdivisions || 1;
+            } else {
+                width = options || 1;
+                height = height || 1;
+                subdivisions = subdivisions || 1;
+            }
 
             for (row = 0; row <= subdivisions; row++) {
                 for (col = 0; col <= subdivisions; col++) {
@@ -1163,29 +1173,41 @@
             return vertexData;
         }
 
-        public static CreatePlane(size: number, sideOrientation: number = Mesh.DEFAULTSIDE): VertexData {
+        public static CreatePlane(options: any, sideOrientation: number = Mesh.DEFAULTSIDE): VertexData {
             var indices = [];
             var positions = [];
             var normals = [];
             var uvs = [];
 
-            size = size || 1;
+            var width: number;
+            var height: number;
+
+            if (options.width) {
+                width = options.width || 1;
+                height = options.height || 1;
+                sideOrientation = options.sideOrientation || Mesh.DEFAULTSIDE;
+            } else {
+                width = options || 1;
+                height = options || 1;
+            }
 
             // Vertices
-            var halfSize = size / 2.0;
-            positions.push(-halfSize, -halfSize, 0);
+            var halfWidth = width / 2.0;
+            var halfHeight = height / 2.0;
+
+            positions.push(-halfWidth, -halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(0.0, 0.0);
 
-            positions.push(halfSize, -halfSize, 0);
+            positions.push(halfWidth, -halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(1.0, 0.0);
 
-            positions.push(halfSize, halfSize, 0);
+            positions.push(halfWidth, halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(1.0, 1.0);
 
-            positions.push(-halfSize, halfSize, 0);
+            positions.push(-halfWidth, halfHeight, 0);
             normals.push(0, 0, -1.0);
             uvs.push(0.0, 1.0);