浏览代码

Merging last changes

David catuhe 10 年之前
父节点
当前提交
3637c98b49

文件差异内容过多而无法显示
+ 987 - 939
dist/preview release/babylon.d.ts


文件差异内容过多而无法显示
+ 22 - 20
dist/preview release/babylon.js


文件差异内容过多而无法显示
+ 120 - 49
dist/preview release/babylon.max.js


文件差异内容过多而无法显示
+ 21 - 19
dist/preview release/babylon.noworker.js


+ 2 - 1
dist/preview release/what's new.md

@@ -27,4 +27,5 @@
     - `VertexData.CreateLines()` now supports only the single _options_ parameter ([jerome](https://github.com/jbousquie))
     - `VertexData.CreateDashedLines()` now supports only the single _options_ parameter ([jerome](https://github.com/jbousquie))
     - `VertexData.CreateGround()` now supports only the single _options_ parameter ([jerome](https://github.com/jbousquie))
-    -`VertexData.CreateTiledGround()` now supports only the single _options_ parameter ([jerome](https://github.com/jbousquie))
+    - `VertexData.CreateTiledGround()` now supports only the single _options_ parameter ([jerome](https://github.com/jbousquie))
+    - `VertexData.CreateGroundFromHeightMap()` now supports only the single _options_ parameter ([deltakosh](https://github.com/deltakosh))

+ 9 - 9
src/Materials/Textures/babylon.renderTargetTexture.js

@@ -35,23 +35,23 @@ var BABYLON;
             // Rendering groups
             this._renderingManager = new BABYLON.RenderingManager(scene);
         }
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONCE", {
+        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDERONCE", {
             get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONCE;
+                return RenderTargetTexture._REFRESHRATE_RENDERONCE;
             },
             enumerable: true,
             configurable: true
         });
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONEVERYFRAME", {
+        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDERONEVERYFRAME", {
             get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME;
+                return RenderTargetTexture._REFRESHRATE_RENDERONEVERYFRAME;
             },
             enumerable: true,
             configurable: true
         });
-        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDER_ONEVERYTWOFRAMES", {
+        Object.defineProperty(RenderTargetTexture, "REFRESHRATE_RENDERONEVERYTWOFRAME", {
             get: function () {
-                return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES;
+                return RenderTargetTexture._REFRESHRATE_RENDERONEVERYTWOFRAME;
             },
             enumerable: true,
             configurable: true
@@ -226,9 +226,9 @@ var BABYLON;
             newTexture.renderList = this.renderList.slice(0);
             return newTexture;
         };
-        RenderTargetTexture._REFRESHRATE_RENDER_ONCE = 0;
-        RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
-        RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES = 2;
+        RenderTargetTexture._REFRESHRATE_RENDERONCE = 0;
+        RenderTargetTexture._REFRESHRATE_RENDERONEVERYFRAME = 1;
+        RenderTargetTexture._REFRESHRATE_RENDERONEVERYTWOFRAME = 2;
         return RenderTargetTexture;
     })(BABYLON.Texture);
     BABYLON.RenderTargetTexture = RenderTargetTexture;

+ 9 - 9
src/Materials/Textures/babylon.renderTargetTexture.ts

@@ -1,19 +1,19 @@
 module BABYLON {
     export class RenderTargetTexture extends Texture {
-        public static _REFRESHRATE_RENDER_ONCE: number = 0;
-        public static _REFRESHRATE_RENDER_ONEVERYFRAME: number = 1;
-        public static _REFRESHRATE_RENDER_ONEVERYTWOFRAMES: number = 2;
+        public static _REFRESHRATE_RENDERONCE: number = 0;
+        public static _REFRESHRATE_RENDERONEVERYFRAME: number = 1;
+        public static _REFRESHRATE_RENDERONEVERYTWOFRAME: number = 2;
 
-        public static get REFRESHRATE_RENDER_ONCE(): number {
-            return RenderTargetTexture._REFRESHRATE_RENDER_ONCE;
+        public static get REFRESHRATE_RENDERONCE(): number {
+            return RenderTargetTexture._REFRESHRATE_RENDERONCE;
         }
 
-        public static get REFRESHRATE_RENDER_ONEVERYFRAME(): number {
-            return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME;
+        public static get REFRESHRATE_RENDERONEVERYFRAME(): number {
+            return RenderTargetTexture._REFRESHRATE_RENDERONEVERYFRAME;
         }
 
-        public static get REFRESHRATE_RENDER_ONEVERYTWOFRAMES(): number {
-            return RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYTWOFRAMES;
+        public static get REFRESHRATE_RENDERONEVERYTWOFRAME(): number {
+            return RenderTargetTexture._REFRESHRATE_RENDERONEVERYTWOFRAME;
         }
 
         public renderList = new Array<AbstractMesh>();

+ 5 - 2
src/Math/babylon.math.js

@@ -1979,11 +1979,15 @@ var BABYLON;
             result.m[14] = 0;
         };
         Matrix.RotationAxis = function (axis, angle) {
+            var result = Matrix.Zero();
+            Matrix.RotationAxisToRef(axis, angle, result);
+            return result;
+        };
+        Matrix.RotationAxisToRef = function (axis, angle, result) {
             var s = Math.sin(-angle);
             var c = Math.cos(-angle);
             var c1 = 1 - c;
             axis.normalize();
-            var result = Matrix.Zero();
             result.m[0] = (axis.x * axis.x) * c1 + c;
             result.m[1] = (axis.x * axis.y) * c1 - (axis.z * s);
             result.m[2] = (axis.x * axis.z) * c1 + (axis.y * s);
@@ -1997,7 +2001,6 @@ var BABYLON;
             result.m[10] = (axis.z * axis.z) * c1 + c;
             result.m[11] = 0.0;
             result.m[15] = 1.0;
-            return result;
         };
         Matrix.RotationYawPitchRoll = function (yaw, pitch, roll) {
             var result = new Matrix();

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

@@ -1722,7 +1722,7 @@
             var result = new Quaternion();
             var sin = Math.sin(angle / 2);
 
-            axis.normalize(); 
+            axis.normalize();
 
             result.w = Math.cos(angle / 2);
             result.x = axis.x * sin;
@@ -2484,7 +2484,7 @@
         }
 
         public static RotationAxis(axis: Vector3, angle: number): Matrix {
-            var result = new Matrix;
+            var result = Matrix.Zero();
             Matrix.RotationAxisToRef(axis, angle, result);
             return result;
         }
@@ -3331,7 +3331,7 @@
             this.centerPoint = new Vector2(
                 (startToMid * (midPoint.y - endPoint.y) - midToEnd * (startPoint.y - midPoint.y)) / det,
                 ((startPoint.x - midPoint.x) * midToEnd - (midPoint.x - endPoint.x) * startToMid) / det
-                );
+            );
 
             this.radius = this.centerPoint.subtract(this.startPoint).length();
 
@@ -3514,7 +3514,7 @@
                     return new Vector2(
                         a.x + (dir.x * localOffset),
                         a.y + (dir.y * localOffset)
-                        );
+                    );
                 }
                 previousOffset = nextOffset;
             }
@@ -3854,3 +3854,4 @@
     }
 }
 
+

+ 1 - 1
src/Mesh/babylon.geometry.js

@@ -577,7 +577,7 @@ var BABYLON;
                     _super.call(this, id, scene, this._regenerateVertexData(), canBeRegenerated, mesh);
                 }
                 TiledGround.prototype._regenerateVertexData = function () {
-                    return BABYLON.VertexData.CreateTiledGround(this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision);
+                    return BABYLON.VertexData.CreateTiledGround({ xmin: this.xmin, zmin: this.zmin, xmax: this.xmax, zmax: this.zmax, subdivisions: this.subdivisions, precision: this.precision });
                 };
                 TiledGround.prototype.copy = function (id) {
                     return new TiledGround(id, this.getScene(), this.xmin, this.zmin, this.xmax, this.zmax, this.subdivisions, this.precision, this.canBeRegenerated(), null);

+ 2 - 1
src/Mesh/babylon.geometry.ts

@@ -733,7 +733,7 @@
             }
 
             public _regenerateVertexData(): VertexData {
-                return VertexData.CreateTiledGround({xmin: this.xmin, zmin: this.zmin, xmax: this.xmax, zmax: this.zmax, subdivisions: this.subdivisions, precision: this.precision});
+                return VertexData.CreateTiledGround({ xmin: this.xmin, zmin: this.zmin, xmax: this.xmax, zmax: this.zmax, subdivisions: this.subdivisions, precision: this.precision });
             }
 
             public copy(id: string): Geometry {
@@ -795,3 +795,4 @@
     }
 }
 
+

+ 76 - 13
src/Mesh/babylon.mesh.js

@@ -1531,9 +1531,23 @@ var BABYLON;
             extrudedGeneric.cap = cap;
             return extrudedGeneric;
         };
-        // Lathe
-        Mesh.CreateLathe = function (name, shape, radius, tessellation, scene, updatable, sideOrientation) {
+        Mesh.CreateLathe = function (name, options, radiusOrScene, tessellation, scene, updatable, sideOrientation) {
             if (sideOrientation === void 0) { sideOrientation = Mesh.DEFAULTSIDE; }
+            var shape;
+            var radius;
+            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;
@@ -1600,13 +1614,48 @@ var BABYLON;
             ground._setReady(true);
             return ground;
         };
-        Mesh.CreateTiledGround = function (name, xmin, zmin, xmax, zmax, subdivisions, precision, scene, updatable) {
+        Mesh.CreateTiledGround = function (name, options, zminOrScene, xmax, zmax, subdivisions, precision, scene, updatable) {
+            var xmin;
+            var zmin;
+            if (typeof options === 'number') {
+                xmin = options || -1;
+                zmin = zminOrScene || -1;
+                xmax = xmax || 1;
+                zmax = zmax || 1;
+                subdivisions = subdivisions || { w: 6, h: 6 };
+                precision = precision || { w: 2, h: 2 };
+            }
+            else {
+                scene = zminOrScene;
+                xmin = options.xmin || -1;
+                zmin = options.zmin || -1;
+                xmax = options.xmax || 1;
+                zmax = options.zmax || 1;
+                subdivisions = options.subdivisions || { w: 6, h: 6 };
+                precision = options.precision || { w: 2, h: 2 };
+            }
             var tiledGround = new Mesh(name, scene);
-            var vertexData = BABYLON.VertexData.CreateTiledGround(xmin, zmin, xmax, zmax, subdivisions, precision);
+            var vertexData = BABYLON.VertexData.CreateTiledGround({ xmin: xmin, zmin: zmin, xmax: xmax, zmax: zmax, subdivisions: subdivisions, precision: precision });
             vertexData.applyToMesh(tiledGround, updatable);
             return tiledGround;
         };
-        Mesh.CreateGroundFromHeightMap = function (name, url, width, height, subdivisions, minHeight, maxHeight, scene, updatable, onReady) {
+        Mesh.CreateGroundFromHeightMap = function (name, url, widthOrOptions, heightorScene, subdivisions, minHeight, maxHeight, scene, updatable, onReady) {
+            var width;
+            var height;
+            if (typeof widthOrOptions === "number") {
+                width = widthOrOptions;
+                height = heightorScene;
+            }
+            else {
+                width = widthOrOptions.width || 10;
+                height = widthOrOptions.height || 10;
+                subdivisions = widthOrOptions.subdivisions || 1;
+                minHeight = widthOrOptions.minHeight;
+                maxHeight = widthOrOptions.maxHeight || 10;
+                updatable = widthOrOptions.updatable;
+                onReady = widthOrOptions.onReady;
+                scene = heightorScene;
+            }
             var ground = new BABYLON.GroundMesh(name, scene);
             ground._subdivisions = subdivisions;
             ground._setReady(false);
@@ -1614,15 +1663,20 @@ var BABYLON;
                 // Getting height map data
                 var canvas = document.createElement("canvas");
                 var context = canvas.getContext("2d");
-                var heightMapWidth = img.width;
-                var heightMapHeight = img.height;
-                canvas.width = heightMapWidth;
-                canvas.height = heightMapHeight;
+                var bufferWidth = img.width;
+                var bufferHeight = img.height;
+                canvas.width = bufferWidth;
+                canvas.height = bufferHeight;
                 context.drawImage(img, 0, 0);
                 // Create VertexData from map data
                 // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949
-                var buffer = context.getImageData(0, 0, heightMapWidth, heightMapHeight).data;
-                var vertexData = BABYLON.VertexData.CreateGroundFromHeightMap(width, height, subdivisions, minHeight, maxHeight, buffer, heightMapWidth, heightMapHeight);
+                var buffer = context.getImageData(0, 0, bufferWidth, bufferHeight).data;
+                var vertexData = BABYLON.VertexData.CreateGroundFromHeightMap({
+                    width: width, height: height,
+                    subdivisions: subdivisions,
+                    minHeight: minHeight, maxHeight: maxHeight,
+                    buffer: buffer, bufferWidth: bufferWidth, bufferHeight: bufferHeight
+                });
                 vertexData.applyToMesh(ground, updatable);
                 ground._setReady(true);
                 //execute ready callback, if set
@@ -1728,12 +1782,21 @@ var BABYLON;
             tube.cap = cap;
             return tube;
         };
-        // Decals
-        Mesh.CreateDecal = function (name, sourceMesh, position, normal, size, angle) {
+        Mesh.CreateDecal = function (name, sourceMesh, positionOrOptions, normal, size, angle) {
             if (angle === void 0) { angle = 0; }
             var indices = sourceMesh.getIndices();
             var positions = sourceMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind);
             var normals = sourceMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
+            var position;
+            if (positionOrOptions instanceof BABYLON.Vector3) {
+                position = positionOrOptions;
+            }
+            else {
+                position = positionOrOptions.position || BABYLON.Vector3.Zero();
+                normal = positionOrOptions.normal || BABYLON.Vector3.Up();
+                size = positionOrOptions.size || new BABYLON.Vector3(1, 1, 1);
+                angle = positionOrOptions.angle;
+            }
             // Getting correct rotation
             if (!normal) {
                 var target = new BABYLON.Vector3(0, 0, 1);

+ 50 - 13
src/Mesh/babylon.mesh.ts

@@ -1770,7 +1770,7 @@
 
         // Lathe
         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: { 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;
@@ -1871,7 +1871,7 @@
         }
 
         public static CreateTiledGround(name: string, xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: { w: number; h: number; }, precision: { w: number; h: number; }, scene: Scene, updatable?: boolean): Mesh;
-        public static CreateTiledGround(name: string, options: {xmin?: number, zmin?: number, xmax?: number, zmax?: number, subdivisions?: { w: number; h: number; }, precision?: { w: number; h: number; }, updatable?: boolean}, scene: Scene): Mesh;
+        public static CreateTiledGround(name: string, options: { xmin?: number, zmin?: number, xmax?: number, zmax?: number, subdivisions?: { w: number; h: number; }, precision?: { w: number; h: number; }, updatable?: boolean }, scene: Scene): Mesh;
         public static CreateTiledGround(name: string, options: any, zminOrScene: any, xmax?: number, zmax?: number, subdivisions?: { w: number; h: number; }, precision?: { w: number; h: number; }, scene?: Scene, updatable?: boolean): Mesh {
             var xmin: number;
             var zmin: number;
@@ -1881,7 +1881,7 @@
                 xmax = xmax || 1;
                 zmax = zmax || 1;
                 subdivisions = subdivisions || { w: 6, h: 6 };
-                precision = precision || { w: 2, h: 2};
+                precision = precision || { w: 2, h: 2 };
             } else {
                 scene = zminOrScene;
                 xmin = options.xmin || -1;
@@ -1889,18 +1889,37 @@
                 xmax = options.xmax || 1;
                 zmax = options.zmax || 1;
                 subdivisions = options.subdivisions || { w: 6, h: 6 };
-                precision = options.precision || { w: 2, h: 2};
+                precision = options.precision || { w: 2, h: 2 };
             }
             var tiledGround = new Mesh(name, scene);
 
-            var vertexData = VertexData.CreateTiledGround({xmin: xmin, zmin: zmin, xmax: xmax, zmax: zmax, subdivisions: subdivisions, precision: precision});
+            var vertexData = VertexData.CreateTiledGround({ xmin: xmin, zmin: zmin, xmax: xmax, zmax: zmax, subdivisions: subdivisions, precision: precision });
 
             vertexData.applyToMesh(tiledGround, updatable);
 
             return tiledGround;
         }
 
-        public static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh {
+        public static CreateGroundFromHeightMap(name: string, url: string, options: { width?: number, height?: number, subdivisions?: number, minHeight?: number, maxHeight?: number, updatable?: boolean, onReady?: (mesh: GroundMesh) => void}, scene: Scene);
+        public static CreateGroundFromHeightMap(name: string, url: string, width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, scene: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void);
+        public static CreateGroundFromHeightMap(name: string, url: string, widthOrOptions?: any, heightorScene?: any, subdivisions?: number, minHeight?: number, maxHeight?: number, scene?: Scene, updatable?: boolean, onReady?: (mesh: GroundMesh) => void): GroundMesh {
+            var width: number;
+            var height: number;
+
+            if (typeof widthOrOptions === "number") {
+                width = widthOrOptions;
+                height = heightorScene;
+            } else {
+                width = widthOrOptions.width || 10;
+                height = widthOrOptions.height || 10;
+                subdivisions = widthOrOptions.subdivisions || 1;
+                minHeight = widthOrOptions.minHeight;
+                maxHeight = widthOrOptions.maxHeight || 10;
+                updatable = widthOrOptions.updatable;
+                onReady = widthOrOptions.onReady;
+                scene = heightorScene;
+            }
+
             var ground = new GroundMesh(name, scene);
             ground._subdivisions = subdivisions;
 
@@ -1910,17 +1929,22 @@
                 // Getting height map data
                 var canvas = document.createElement("canvas");
                 var context = canvas.getContext("2d");
-                var heightMapWidth = img.width;
-                var heightMapHeight = img.height;
-                canvas.width = heightMapWidth;
-                canvas.height = heightMapHeight;
+                var bufferWidth = img.width;
+                var bufferHeight = img.height;
+                canvas.width = bufferWidth;
+                canvas.height = bufferHeight;
 
                 context.drawImage(img, 0, 0);
 
                 // Create VertexData from map data
                 // Cast is due to wrong definition in lib.d.ts from ts 1.3 - https://github.com/Microsoft/TypeScript/issues/949
-                var buffer = <Uint8Array>(<any>context.getImageData(0, 0, heightMapWidth, heightMapHeight).data);
-                var vertexData = VertexData.CreateGroundFromHeightMap(width, height, subdivisions, minHeight, maxHeight, buffer, heightMapWidth, heightMapHeight);
+                var buffer = <Uint8Array>(<any>context.getImageData(0, 0, bufferWidth, bufferHeight).data);
+                var vertexData = VertexData.CreateGroundFromHeightMap({
+                    width, height,
+                    subdivisions,
+                    minHeight, maxHeight,
+                    buffer, bufferWidth, bufferHeight
+                });
 
                 vertexData.applyToMesh(ground, updatable);
 
@@ -2037,10 +2061,22 @@
         }
 
         // Decals
-        public static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number = 0) {
+        public static CreateDecal(name: string, sourceMesh: AbstractMesh, options: {position?: Vector3, normal?: Vector3, size?: Vector3, angle?: number});
+        public static CreateDecal(name: string, sourceMesh: AbstractMesh, position: Vector3, normal: Vector3, size: Vector3, angle: number);
+        public static CreateDecal(name: string, sourceMesh: AbstractMesh, positionOrOptions: any, normal?: Vector3, size?: Vector3, angle: number = 0) {
             var indices = sourceMesh.getIndices();
             var positions = sourceMesh.getVerticesData(VertexBuffer.PositionKind);
             var normals = sourceMesh.getVerticesData(VertexBuffer.NormalKind);
+            var position: Vector3;
+
+            if (positionOrOptions instanceof Vector3) {
+                position = <Vector3>positionOrOptions;
+            } else {
+                position = positionOrOptions.position || Vector3.Zero();
+                normal = positionOrOptions.normal || Vector3.Up();
+                size = positionOrOptions.size || new Vector3(1, 1, 1);
+                angle = positionOrOptions.angle;
+            }
 
             // Getting correct rotation
             if (!normal) {
@@ -2429,3 +2465,4 @@
 
 
 
+

+ 27 - 23
src/Mesh/babylon.mesh.vertexData.js

@@ -863,9 +863,13 @@ var BABYLON;
             vertexData.uvs = uvs;
             return vertexData;
         };
-        VertexData.CreateTiledGround = function (xmin, zmin, xmax, zmax, subdivisions, precision) {
-            if (subdivisions === void 0) { subdivisions = { w: 1, h: 1 }; }
-            if (precision === void 0) { precision = { w: 1, h: 1 }; }
+        VertexData.CreateTiledGround = function (options) {
+            var xmin = options.xmin;
+            var zmin = options.zmin;
+            var xmax = options.xmax;
+            var zmax = options.zmax;
+            var subdivisions = options.subdivisions || { w: 1, h: 1 };
+            var precision = options.precision || { w: 1, h: 1 };
             var indices = [];
             var positions = [];
             var normals = [];
@@ -926,40 +930,40 @@ var BABYLON;
             vertexData.uvs = uvs;
             return vertexData;
         };
-        VertexData.CreateGroundFromHeightMap = function (width, height, subdivisions, minHeight, maxHeight, buffer, bufferWidth, bufferHeight) {
+        VertexData.CreateGroundFromHeightMap = function (options) {
             var indices = [];
             var positions = [];
             var normals = [];
             var uvs = [];
             var row, col;
             // Vertices
-            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));
+            for (row = 0; row <= options.subdivisions; row++) {
+                for (col = 0; col <= options.subdivisions; col++) {
+                    var position = new BABYLON.Vector3((col * options.width) / options.subdivisions - (options.width / 2.0), 0, ((options.subdivisions - row) * options.height) / options.subdivisions - (options.height / 2.0));
                     // Compute height
-                    var heightMapX = (((position.x + width / 2) / width) * (bufferWidth - 1)) | 0;
-                    var heightMapY = ((1.0 - (position.z + height / 2) / height) * (bufferHeight - 1)) | 0;
-                    var pos = (heightMapX + heightMapY * bufferWidth) * 4;
-                    var r = buffer[pos] / 255.0;
-                    var g = buffer[pos + 1] / 255.0;
-                    var b = buffer[pos + 2] / 255.0;
+                    var heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;
+                    var heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;
+                    var pos = (heightMapX + heightMapY * options.bufferWidth) * 4;
+                    var r = options.buffer[pos] / 255.0;
+                    var g = options.buffer[pos + 1] / 255.0;
+                    var b = options.buffer[pos + 2] / 255.0;
                     var gradient = r * 0.3 + g * 0.59 + b * 0.11;
-                    position.y = minHeight + (maxHeight - minHeight) * gradient;
+                    position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
                     // Add  vertex
                     positions.push(position.x, position.y, position.z);
                     normals.push(0, 0, 0);
-                    uvs.push(col / subdivisions, 1.0 - row / subdivisions);
+                    uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);
                 }
             }
             // Indices
-            for (row = 0; row < subdivisions; row++) {
-                for (col = 0; col < subdivisions; col++) {
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + row * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
-                    indices.push(col + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
+            for (row = 0; row < options.subdivisions; row++) {
+                for (col = 0; col < options.subdivisions; col++) {
+                    indices.push(col + 1 + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + 1 + row * (options.subdivisions + 1));
+                    indices.push(col + row * (options.subdivisions + 1));
+                    indices.push(col + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + 1 + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + row * (options.subdivisions + 1));
                 }
             }
             // Normals

+ 26 - 25
src/Mesh/babylon.mesh.vertexData.ts

@@ -1052,14 +1052,14 @@
             return vertexData;
         }
 
-        public static CreateTiledGround(options: {xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: any, precision: any}): VertexData {
+        public static CreateTiledGround(options: { xmin: number, zmin: number, xmax: number, zmax: number, subdivisions: any, precision: any }): VertexData {
             var xmin = options.xmin;
             var zmin = options.zmin;
             var xmax = options.xmax;
             var zmax = options.zmax;
-            var subdivisions = options.subdivisions || {w: 1, h: 1};
-            var precision = options.precision || {w: 1, h: 1};
-            
+            var subdivisions = options.subdivisions || { w: 1, h: 1 };
+            var precision = options.precision || { w: 1, h: 1 };
+
             var indices = [];
             var positions = [];
             var normals = [];
@@ -1136,7 +1136,7 @@
             return vertexData;
         }
 
-        public static CreateGroundFromHeightMap(width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number): VertexData {
+        public static CreateGroundFromHeightMap(options: { width: number, height: number, subdivisions: number, minHeight: number, maxHeight: number, buffer: Uint8Array, bufferWidth: number, bufferHeight: number}): VertexData {
             var indices = [];
             var positions = [];
             var normals = [];
@@ -1144,40 +1144,40 @@
             var row, col;
 
             // Vertices
-            for (row = 0; row <= subdivisions; row++) {
-                for (col = 0; col <= subdivisions; col++) {
-                    var position = new Vector3((col * width) / subdivisions - (width / 2.0), 0, ((subdivisions - row) * height) / subdivisions - (height / 2.0));
+            for (row = 0; row <= options.subdivisions; row++) {
+                for (col = 0; col <= options.subdivisions; col++) {
+                    var position = new Vector3((col * options.width) / options.subdivisions - (options.width / 2.0), 0, ((options.subdivisions - row) * options.height) / options.subdivisions - (options.height / 2.0));
 
                     // Compute height
-                    var heightMapX = (((position.x + width / 2) / width) * (bufferWidth - 1)) | 0;
-                    var heightMapY = ((1.0 - (position.z + height / 2) / height) * (bufferHeight - 1)) | 0;
+                    var heightMapX = (((position.x + options.width / 2) / options.width) * (options.bufferWidth - 1)) | 0;
+                    var heightMapY = ((1.0 - (position.z + options.height / 2) / options.height) * (options.bufferHeight - 1)) | 0;
 
-                    var pos = (heightMapX + heightMapY * bufferWidth) * 4;
-                    var r = buffer[pos] / 255.0;
-                    var g = buffer[pos + 1] / 255.0;
-                    var b = buffer[pos + 2] / 255.0;
+                    var pos = (heightMapX + heightMapY * options.bufferWidth) * 4;
+                    var r = options.buffer[pos] / 255.0;
+                    var g = options.buffer[pos + 1] / 255.0;
+                    var b = options.buffer[pos + 2] / 255.0;
 
                     var gradient = r * 0.3 + g * 0.59 + b * 0.11;
 
-                    position.y = minHeight + (maxHeight - minHeight) * gradient;
+                    position.y = options.minHeight + (options.maxHeight - options.minHeight) * gradient;
 
                     // Add  vertex
                     positions.push(position.x, position.y, position.z);
                     normals.push(0, 0, 0);
-                    uvs.push(col / subdivisions, 1.0 - row / subdivisions);
+                    uvs.push(col / options.subdivisions, 1.0 - row / options.subdivisions);
                 }
             }
 
             // Indices
-            for (row = 0; row < subdivisions; row++) {
-                for (col = 0; col < subdivisions; col++) {
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + row * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
-
-                    indices.push(col + (row + 1) * (subdivisions + 1));
-                    indices.push(col + 1 + (row + 1) * (subdivisions + 1));
-                    indices.push(col + row * (subdivisions + 1));
+            for (row = 0; row < options.subdivisions; row++) {
+                for (col = 0; col < options.subdivisions; col++) {
+                    indices.push(col + 1 + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + 1 + row * (options.subdivisions + 1));
+                    indices.push(col + row * (options.subdivisions + 1));
+
+                    indices.push(col + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + 1 + (row + 1) * (options.subdivisions + 1));
+                    indices.push(col + row * (options.subdivisions + 1));
                 }
             }
 
@@ -1511,3 +1511,4 @@
 
 
 
+

+ 1 - 0
src/Probes/babylon.reflectionProbe.js

@@ -1,6 +1,7 @@
 var BABYLON;
 (function (BABYLON) {
     var ReflectionProbe = (function () {
+        //http://localhost:61437/Playground/index%20-%20debug.html#KA93U#7
         function ReflectionProbe(name, size, scene, generateMipMaps) {
             var _this = this;
             if (generateMipMaps === void 0) { generateMipMaps = true; }

+ 1 - 0
src/Probes/babylon.reflectionProbe.ts

@@ -10,6 +10,7 @@
 
         public position = Vector3.Zero();
           
+        //http://localhost:61437/Playground/index%20-%20debug.html#KA93U#7
         constructor(public name: string, size: number, scene: Scene, generateMipMaps = true) {
             this._scene = scene;