Browse Source

Merge remote-tracking branch 'upstream/master' into feature.SPS

Conflicts:
	src/Particles/babylon.solidParticleSystem.ts
jbousquie 9 years ago
parent
commit
1fca3d067b

File diff suppressed because it is too large
+ 1162 - 1065
dist/preview release/babylon.d.ts


File diff suppressed because it is too large
+ 23 - 25
dist/preview release/babylon.js


File diff suppressed because it is too large
+ 442 - 35
dist/preview release/babylon.max.js


File diff suppressed because it is too large
+ 22 - 24
dist/preview release/babylon.noworker.js


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

@@ -438,11 +438,11 @@
             return new Vector2(0, 0);
         }
 
-        public static FromArray(array: number[], offset: number = 0): Vector2 {
+        public static FromArray(array: number[] | Float32Array, offset: number = 0): Vector2 {
             return new Vector2(array[offset], array[offset + 1]);
         }
 
-        public static FromArrayToRef(array: number[], offset: number, result: Vector2): void {
+        public static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector2): void {
             result.x = array[offset];
             result.y = array[offset + 1];
         }
@@ -557,7 +557,7 @@
             return result;
         }
 
-        public toArray(array: number[], index: number = 0): Vector3 {
+        public toArray(array: number[] | Float32Array, index: number = 0): Vector3 {
             array[index] = this.x;
             array[index + 1] = this.y;
             array[index + 2] = this.z;
@@ -775,7 +775,7 @@
             return s;
         }
 
-        public static FromArray(array: number[], offset?: number): Vector3 {
+        public static FromArray(array: number[] | Float32Array, offset?: number): Vector3 {
             if (!offset) {
                 offset = 0;
             }
@@ -791,7 +791,7 @@
             return new Vector3(array[offset], array[offset + 1], array[offset + 2]);
         }
 
-        public static FromArrayToRef(array: number[], offset: number, result: Vector3): void {
+        public static FromArrayToRef(array: number[] | Float32Array, offset: number, result: Vector3): void {
             result.x = array[offset];
             result.y = array[offset + 1];
             result.z = array[offset + 2];

+ 1 - 1
src/Mesh/babylon.abstractMesh.ts

@@ -162,7 +162,7 @@
             return null;
         }
 
-        public getVerticesData(kind: string): number[] {
+        public getVerticesData(kind: string): number[] | Float32Array {
             return null;
         }
 

+ 9 - 2
src/Mesh/babylon.geometry.js

@@ -148,8 +148,9 @@ var BABYLON;
         };
         Geometry.prototype.getVerticesDataKinds = function () {
             var result = [];
+            var kind;
             if (!this._vertexBuffers && this._delayInfo) {
-                for (var kind in this._delayInfo) {
+                for (kind in this._delayInfo) {
                     result.push(kind);
                 }
             }
@@ -344,7 +345,13 @@ var BABYLON;
             var kind;
             for (kind in this._vertexBuffers) {
                 // using slice() to make a copy of the array and not just reference it
-                vertexData.set(this.getVerticesData(kind).slice(0), kind);
+                var data = this.getVerticesData(kind);
+                if (data instanceof Float32Array) {
+                    vertexData.set(new Float32Array(data), kind);
+                }
+                else {
+                    vertexData.set(data.slice(0), kind);
+                }
                 if (!stopChecking) {
                     updatable = this.getVertexBuffer(kind).isUpdatable();
                     stopChecking = !updatable;

+ 11 - 5
src/Mesh/babylon.geometry.ts

@@ -58,7 +58,7 @@
             this.notifyUpdate();
         }
 
-        public setVerticesData(kind: string, data: number[], updatable?: boolean, stride?: number): void {
+        public setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void {
             this._vertexBuffers = this._vertexBuffers || {};
 
             if (this._vertexBuffers[kind]) {
@@ -99,7 +99,7 @@
             this.notifyUpdate(kind);
         }
 
-        public updateVerticesData(kind: string, data: number[], updateExtends?: boolean): void {
+        public updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean): void {
             var vertexBuffer = this.getVertexBuffer(kind);
 
             if (!vertexBuffer) {
@@ -147,7 +147,7 @@
             return this._totalVertices;
         }
 
-        public getVerticesData(kind: string, copyWhenShared?: boolean): number[] {
+        public getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array {
             var vertexBuffer = this.getVertexBuffer(kind);
             if (!vertexBuffer) {
                 return null;
@@ -191,8 +191,9 @@
 
         public getVerticesDataKinds(): string[] {
             var result = [];
+            var kind;
             if (!this._vertexBuffers && this._delayInfo) {
-                for (var kind in this._delayInfo) {
+                for (kind in this._delayInfo) {
                     result.push(kind);
                 }
             } else {
@@ -434,8 +435,13 @@
             var kind;
             for (kind in this._vertexBuffers) {
                 // using slice() to make a copy of the array and not just reference it
-                vertexData.set(this.getVerticesData(kind).slice(0), kind);
+                var data = this.getVerticesData(kind);
 
+                if (data instanceof Float32Array) {
+                    vertexData.set(new Float32Array(<Float32Array>data), kind);
+                } else {
+                    vertexData.set((<number[]>data).slice(0), kind);
+                }
                 if (!stopChecking) {
                     updatable = this.getVertexBuffer(kind).isUpdatable();
                     stopChecking = !updatable;

+ 1 - 1
src/Mesh/babylon.instancedMesh.ts

@@ -55,7 +55,7 @@
             return this._sourceMesh;
         }
 
-        public getVerticesData(kind: string): number[] {
+        public getVerticesData(kind: string): number[] | Float32Array {
             return this._sourceMesh.getVerticesData(kind);
         }
 

+ 39 - 17
src/Mesh/babylon.mesh.js

@@ -387,12 +387,6 @@ var BABYLON;
             this.synchronizeInstances();
         };
         Mesh.prototype.setVerticesData = function (kind, data, updatable, stride) {
-            if (kind instanceof Array) {
-                var temp = data;
-                data = kind;
-                kind = temp;
-                BABYLON.Tools.Warn("Deprecated usage of setVerticesData detected (since v1.12). Current signature is setVerticesData(kind, data, updatable).");
-            }
             if (!this._geometry) {
                 var vertexData = new BABYLON.VertexData();
                 vertexData.set(data, kind);
@@ -416,6 +410,7 @@ var BABYLON;
             }
         };
         Mesh.prototype.updateVerticesDataDirectly = function (kind, data, offset, makeItUnique) {
+            BABYLON.Tools.Warn("Mesh.updateVerticesDataDirectly deprecated since 2.3.");
             if (!this._geometry) {
                 return;
             }
@@ -1979,6 +1974,34 @@ var BABYLON;
         };
         // Skeletons
         /**
+         * @returns original positions used for CPU skinning.  Useful for integrating Morphing with skeletons in same mesh.
+         */
+        Mesh.prototype.setPositionsForCPUSkinning = function () {
+            var source;
+            if (!this._sourcePositions) {
+                source = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+                this._sourcePositions = new Float32Array(source);
+                if (!this.getVertexBuffer(BABYLON.VertexBuffer.PositionKind).isUpdatable()) {
+                    this.setVerticesData(BABYLON.VertexBuffer.PositionKind, source, true);
+                }
+            }
+            return this._sourcePositions;
+        };
+        /**
+         * @returns original normals used for CPU skinning.  Useful for integrating Morphing with skeletons in same mesh.
+         */
+        Mesh.prototype.setNormalsForCPUSkinning = function () {
+            var source;
+            if (!this._sourceNormals) {
+                source = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
+                this._sourceNormals = new Float32Array(source);
+                if (!this.getVertexBuffer(BABYLON.VertexBuffer.NormalKind).isUpdatable()) {
+                    this.setVerticesData(BABYLON.VertexBuffer.NormalKind, source, true);
+                }
+            }
+            return this._sourceNormals;
+        };
+        /**
          * Update the vertex buffers by applying transformation from the bones
          * @param {skeleton} skeleton to apply
          */
@@ -1995,23 +2018,22 @@ var BABYLON;
             if (!this.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
                 return this;
             }
-            var source;
             if (!this._sourcePositions) {
-                source = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
-                this._sourcePositions = new Float32Array(source);
-                if (!this.getVertexBuffer(BABYLON.VertexBuffer.PositionKind).isUpdatable()) {
-                    this.setVerticesData(BABYLON.VertexBuffer.PositionKind, source, true);
-                }
+                this.setPositionsForCPUSkinning();
             }
             if (!this._sourceNormals) {
-                source = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
-                this._sourceNormals = new Float32Array(source);
-                if (!this.getVertexBuffer(BABYLON.VertexBuffer.NormalKind).isUpdatable()) {
-                    this.setVerticesData(BABYLON.VertexBuffer.NormalKind, source, true);
-                }
+                this.setNormalsForCPUSkinning();
             }
+            // positionsData checks for not being Float32Array will only pass at most once
             var positionsData = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+            if (!(positionsData instanceof Float32Array)) {
+                positionsData = new Float32Array(positionsData);
+            }
+            // normalsData checks for not being Float32Array will only pass at most once
             var normalsData = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
+            if (!(normalsData instanceof Float32Array)) {
+                normalsData = new Float32Array(normalsData);
+            }
             var matricesIndicesData = this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind);
             var matricesWeightsData = this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind);
             var skeletonMatrices = skeleton.getTransformMatrices();

+ 55 - 27
src/Mesh/babylon.mesh.ts

@@ -249,7 +249,7 @@
             return this._geometry.getTotalVertices();
         }
 
-        public getVerticesData(kind: string, copyWhenShared?: boolean): number[] {
+        public getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array {
             if (!this._geometry) {
                 return null;
             }
@@ -418,15 +418,7 @@
             this.synchronizeInstances();
         }
 
-        public setVerticesData(kind: any, data: any, updatable?: boolean, stride?: number): void {
-            if (kind instanceof Array) {
-                var temp = data;
-                data = kind;
-                kind = temp;
-
-                Tools.Warn("Deprecated usage of setVerticesData detected (since v1.12). Current signature is setVerticesData(kind, data, updatable).");
-            }
-
+        public setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean, stride?: number): void {
             if (!this._geometry) {
                 var vertexData = new VertexData();
                 vertexData.set(data, kind);
@@ -440,7 +432,7 @@
             }
         }
 
-        public updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void {
+        public updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void {
             if (!this._geometry) {
                 return;
             }
@@ -454,6 +446,8 @@
         }
 
         public updateVerticesDataDirectly(kind: string, data: Float32Array, offset?: number, makeItUnique?: boolean): void {
+            Tools.Warn("Mesh.updateVerticesDataDirectly deprecated since 2.3.");
+
             if (!this._geometry) {
                 return;
             }
@@ -2282,8 +2276,8 @@
                     vertexData.indices.push(currentVertexDataIndex);
                     vertex.position.toArray(vertexData.positions, currentVertexDataIndex * 3);
                     vertex.normal.toArray(vertexData.normals, currentVertexDataIndex * 3);
-                    vertexData.uvs.push(0.5 + vertex.position.x / size.x);
-                    vertexData.uvs.push(0.5 + vertex.position.y / size.y);
+                    (<number[]>vertexData.uvs).push(0.5 + vertex.position.x / size.x);
+                    (<number[]>vertexData.uvs).push(0.5 + vertex.position.y / size.y);
 
                     currentVertexDataIndex++;
                 }
@@ -2300,6 +2294,39 @@
         }
 
         // Skeletons
+        /**
+         * @returns original positions used for CPU skinning.  Useful for integrating Morphing with skeletons in same mesh.
+         */
+        public setPositionsForCPUSkinning(): Float32Array {
+            var source: number[] | Float32Array;
+            if (!this._sourcePositions) {
+                source = this.getVerticesData(VertexBuffer.PositionKind);
+
+                this._sourcePositions = new Float32Array(<any>source);
+
+                if (!this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable()) {
+                    this.setVerticesData(VertexBuffer.PositionKind, source, true);
+                }
+            }
+            return this._sourcePositions;
+        }
+
+        /**
+         * @returns original normals used for CPU skinning.  Useful for integrating Morphing with skeletons in same mesh.
+         */
+        public setNormalsForCPUSkinning(): Float32Array {
+            var source: number[] | Float32Array;
+            if (!this._sourceNormals) {
+                source = this.getVerticesData(VertexBuffer.NormalKind);
+
+                this._sourceNormals = new Float32Array(<any>source);
+
+                if (!this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable()) {
+                    this.setVerticesData(VertexBuffer.NormalKind, source, true);
+                }
+            }
+            return this._sourceNormals;
+        }
 
         /**
          * Update the vertex buffers by applying transformation from the bones
@@ -2318,27 +2345,26 @@
             if (!this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {
                 return this;
             }
-            var source: number[];
-            if (!this._sourcePositions) {
-                source = this.getVerticesData(VertexBuffer.PositionKind);
-                this._sourcePositions = new Float32Array(source);
 
-                if (!this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable()) {
-                    this.setVerticesData(VertexBuffer.PositionKind, source, true);
-                }
+            if (!this._sourcePositions) {
+                this.setPositionsForCPUSkinning();
             }
 
             if (!this._sourceNormals) {
-                source = this.getVerticesData(VertexBuffer.NormalKind);
-                this._sourceNormals = new Float32Array(source);
-
-                if (!this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable()) {
-                    this.setVerticesData(VertexBuffer.NormalKind, source, true);
-                }
+                this.setNormalsForCPUSkinning();
             }
 
+            // positionsData checks for not being Float32Array will only pass at most once
             var positionsData = this.getVerticesData(VertexBuffer.PositionKind);
+            if (!(positionsData instanceof Float32Array)) {
+                positionsData = new Float32Array(positionsData);
+            }
+            
+            // normalsData checks for not being Float32Array will only pass at most once
             var normalsData = this.getVerticesData(VertexBuffer.NormalKind);
+            if (!(normalsData instanceof Float32Array)) {
+                normalsData = new Float32Array(normalsData);
+            }
 
             var matricesIndicesData = this.getVerticesData(VertexBuffer.MatricesIndicesKind);
             var matricesWeightsData = this.getVerticesData(VertexBuffer.MatricesWeightsKind);
@@ -2390,7 +2416,7 @@
 
             return this;
         }
-
+        
         // Tools
         public static MinMax(meshes: AbstractMesh[]): { min: Vector3; max: Vector3 } {
             var minVector: Vector3 = null;
@@ -2487,3 +2513,5 @@
 }
 
 
+
+

+ 30 - 30
src/Mesh/babylon.mesh.vertexData.ts

@@ -1,28 +1,28 @@
 module BABYLON {
     export interface IGetSetVerticesData {
         isVerticesDataPresent(kind: string): boolean;
-        getVerticesData(kind: string, copyWhenShared?: boolean): number[];
+        getVerticesData(kind: string, copyWhenShared?: boolean): number[] | Float32Array;
         getIndices(copyWhenShared?: boolean): number[];
-        setVerticesData(kind: string, data: number[], updatable?: boolean): void;
-        updateVerticesData(kind: string, data: number[], updateExtends?: boolean, makeItUnique?: boolean): void;
-        setIndices(indices: number[]): void;
+        setVerticesData(kind: string, data: number[] | Float32Array, updatable?: boolean): void;
+        updateVerticesData(kind: string, data: number[] | Float32Array, updateExtends?: boolean, makeItUnique?: boolean): void;
+        setIndices(indices: number[] | Float32Array): void;
     }
 
     export class VertexData {
-        public positions: number[];
-        public normals: number[];
-        public uvs: number[];
-        public uvs2: number[];
-        public uvs3: number[];
-        public uvs4: number[];
-        public uvs5: number[];
-        public uvs6: number[];
-        public colors: number[];
-        public matricesIndices: number[];
-        public matricesWeights: number[];
+        public positions: number[] | Float32Array;
+        public normals: number[] | Float32Array;
+        public uvs: number[] | Float32Array;
+        public uvs2: number[] | Float32Array;
+        public uvs3: number[] | Float32Array;
+        public uvs4: number[] | Float32Array;
+        public uvs5: number[] | Float32Array;
+        public uvs6: number[] | Float32Array;
+        public colors: number[] | Float32Array;
+        public matricesIndices: number[] | Float32Array;
+        public matricesWeights: number[] | Float32Array;
         public indices: number[];
 
-        public set(data: number[], kind: string) {
+        public set(data: number[] | Float32Array, kind: string) {
             switch (kind) {
                 case VertexBuffer.PositionKind:
                     this.positions = data;
@@ -225,7 +225,7 @@
                 }
 
                 for (index = 0; index < other.positions.length; index++) {
-                    this.positions.push(other.positions[index]);
+                    (<number[]>this.positions).push(other.positions[index]);
                 }
             }
 
@@ -234,7 +234,7 @@
                     this.normals = [];
                 }
                 for (index = 0; index < other.normals.length; index++) {
-                    this.normals.push(other.normals[index]);
+                    (<number[]>this.normals).push(other.normals[index]);
                 }
             }
 
@@ -243,7 +243,7 @@
                     this.uvs = [];
                 }
                 for (index = 0; index < other.uvs.length; index++) {
-                    this.uvs.push(other.uvs[index]);
+                    (<number[]>this.uvs).push(other.uvs[index]);
                 }
             }
 
@@ -252,7 +252,7 @@
                     this.uvs2 = [];
                 }
                 for (index = 0; index < other.uvs2.length; index++) {
-                    this.uvs2.push(other.uvs2[index]);
+                    (<number[]>this.uvs2).push(other.uvs2[index]);
                 }
             }
 
@@ -261,7 +261,7 @@
                     this.uvs3 = [];
                 }
                 for (index = 0; index < other.uvs3.length; index++) {
-                    this.uvs3.push(other.uvs3[index]);
+                    (<number[]>this.uvs3).push(other.uvs3[index]);
                 }
             }
 
@@ -270,7 +270,7 @@
                     this.uvs4 = [];
                 }
                 for (index = 0; index < other.uvs4.length; index++) {
-                    this.uvs4.push(other.uvs4[index]);
+                    (<number[]>this.uvs4).push(other.uvs4[index]);
                 }
             }
 
@@ -279,7 +279,7 @@
                     this.uvs5 = [];
                 }
                 for (index = 0; index < other.uvs5.length; index++) {
-                    this.uvs5.push(other.uvs5[index]);
+                    (<number[]>this.uvs5).push(other.uvs5[index]);
                 }
             }
 
@@ -288,7 +288,7 @@
                     this.uvs6 = [];
                 }
                 for (index = 0; index < other.uvs6.length; index++) {
-                    this.uvs6.push(other.uvs6[index]);
+                    (<number[]>this.uvs6).push(other.uvs6[index]);
                 }
             }
 
@@ -297,7 +297,7 @@
                     this.matricesIndices = [];
                 }
                 for (index = 0; index < other.matricesIndices.length; index++) {
-                    this.matricesIndices.push(other.matricesIndices[index]);
+                    (<number[]>this.matricesIndices).push(other.matricesIndices[index]);
                 }
             }
 
@@ -306,7 +306,7 @@
                     this.matricesWeights = [];
                 }
                 for (index = 0; index < other.matricesWeights.length; index++) {
-                    this.matricesWeights.push(other.matricesWeights[index]);
+                    (<number[]>this.matricesWeights).push(other.matricesWeights[index]);
                 }
             }
 
@@ -315,7 +315,7 @@
                     this.colors = [];
                 }
                 for (index = 0; index < other.colors.length; index++) {
-                    this.colors.push(other.colors[index]);
+                    (<number[]>this.colors).push(other.colors[index]);
                 }
             }
         }
@@ -1391,10 +1391,10 @@
             // default face colors and UV if undefined
             for (f = 0; f < nbfaces; f++) {
                 if (faceColors && faceColors[f] === undefined) {
-                    faceColors[f] = new BABYLON.Color4(1, 1, 1, 1);
+                    faceColors[f] = new Color4(1, 1, 1, 1);
                 }
                 if (faceUV && faceUV[f] === undefined) {
-                    faceUV[f] = new BABYLON.Vector4(0, 0, 1, 1);
+                    faceUV[f] = new Vector4(0, 0, 1, 1);
                 }
             }
 
@@ -1595,7 +1595,7 @@
             }
         }
 
-        private static _ComputeSides(sideOrientation: number, positions: number[], indices: number[], normals: number[], uvs: number[]) {
+        private static _ComputeSides(sideOrientation: number, positions: number[] | Float32Array, indices: number[] | Float32Array, normals: number[] | Float32Array, uvs: number[] | Float32Array) {
             var li: number = indices.length;
             var ln: number = normals.length;
             var i: number;

+ 9 - 10
src/Mesh/babylon.meshSimplification.js

@@ -208,9 +208,9 @@ var BABYLON;
                 var bbox = _this._mesh.getBoundingInfo().boundingBox;
                 if (bbox.maximum.x - vPos.x < _this.boundingBoxEpsilon || vPos.x - bbox.minimum.x > _this.boundingBoxEpsilon)
                     ++count;
-                if (bbox.maximum.y == vPos.y || vPos.y == bbox.minimum.y)
+                if (bbox.maximum.y === vPos.y || vPos.y === bbox.minimum.y)
                     ++count;
-                if (bbox.maximum.z == vPos.z || vPos.z == bbox.minimum.z)
+                if (bbox.maximum.z === vPos.z || vPos.z === bbox.minimum.z)
                     ++count;
                 if (count > 1) {
                     ++gCount;
@@ -271,7 +271,7 @@ var BABYLON;
                                         uniqueArray.push(deletedT);
                                     }
                                 });
-                                if (uniqueArray.length % 2 != 0) {
+                                if (uniqueArray.length % 2 !== 0) {
                                     continue;
                                 }
                                 v0.q = v1.q.add(v0.q);
@@ -337,7 +337,7 @@ var BABYLON;
                 var position = BABYLON.Vector3.FromArray(positionData, offset * 3);
                 var vertex = findInVertices(position) || new DecimationVertex(position, _this.vertices.length);
                 vertex.originalOffsets.push(offset);
-                if (vertex.id == _this.vertices.length) {
+                if (vertex.id === _this.vertices.length) {
                     _this.vertices.push(vertex);
                 }
                 vertexReferences.push(vertex.id);
@@ -403,10 +403,10 @@ var BABYLON;
                     newTriangles.push(t);
                 }
             }
-            var newPositionData = this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind) || [];
-            var newNormalData = this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind) || [];
-            var newUVsData = this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.UVKind) || [];
-            var newColorsData = this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.ColorKind) || [];
+            var newPositionData = (this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.PositionKind) || []);
+            var newNormalData = (this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.NormalKind) || []);
+            var newUVsData = (this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.UVKind) || []);
+            var newColorsData = (this._reconstructedMesh.getVerticesData(BABYLON.VertexBuffer.ColorKind) || []);
             var normalData = this._mesh.getVerticesData(BABYLON.VertexBuffer.NormalKind);
             var uvs = this._mesh.getVerticesData(BABYLON.VertexBuffer.UVKind);
             var colorsData = this._mesh.getVerticesData(BABYLON.VertexBuffer.ColorKind);
@@ -443,8 +443,7 @@ var BABYLON;
             var newIndicesArray = this._reconstructedMesh.getIndices(); //[];
             var originalIndices = this._mesh.getIndices();
             for (i = 0; i < newTriangles.length; ++i) {
-                var t = newTriangles[i];
-                //now get the new referencing point for each vertex
+                t = newTriangles[i]; //now get the new referencing point for each vertex
                 [0, 1, 2].forEach(function (idx) {
                     var id = originalIndices[t.originalOffset + idx];
                     var offset = t.vertices[idx].originalOffsets.indexOf(id);

+ 13 - 14
src/Mesh/babylon.meshSimplification.ts

@@ -272,10 +272,10 @@
                 if (bbox.maximum.x - vPos.x < this.boundingBoxEpsilon || vPos.x - bbox.minimum.x > this.boundingBoxEpsilon)
                     ++count;
 
-                if (bbox.maximum.y == vPos.y || vPos.y == bbox.minimum.y)
+                if (bbox.maximum.y === vPos.y || vPos.y === bbox.minimum.y)
                     ++count;
 
-                if (bbox.maximum.z == vPos.z || vPos.z == bbox.minimum.z)
+                if (bbox.maximum.z === vPos.z || vPos.z === bbox.minimum.z)
                     ++count;
 
                 if (count > 1) {
@@ -338,14 +338,14 @@
                                     continue;
 
                                 var uniqueArray = [];
-                                delTr.forEach(function (deletedT) {
+                                delTr.forEach(deletedT => {
                                     if (uniqueArray.indexOf(deletedT) === -1) {
                                         deletedT.deletePending = true;
                                         uniqueArray.push(deletedT);
                                     }
                                 });
 
-                                if (uniqueArray.length % 2 != 0) {
+                                if (uniqueArray.length % 2 !== 0) {
                                     continue;
                                 }
 
@@ -424,7 +424,7 @@
 
                 var vertex = findInVertices(position) || new DecimationVertex(position, this.vertices.length);
                 vertex.originalOffsets.push(offset);
-                if (vertex.id == this.vertices.length) {
+                if (vertex.id === this.vertices.length) {
                     this.vertices.push(vertex);
                 }
                 vertexReferences.push(vertex.id);
@@ -495,10 +495,10 @@
                 }
             }
 
-            var newPositionData = this._reconstructedMesh.getVerticesData(VertexBuffer.PositionKind) || [];
-            var newNormalData = this._reconstructedMesh.getVerticesData(VertexBuffer.NormalKind) || [];
-            var newUVsData = this._reconstructedMesh.getVerticesData(VertexBuffer.UVKind) || [];
-            var newColorsData = this._reconstructedMesh.getVerticesData(VertexBuffer.ColorKind) || [];
+            var newPositionData = <number[]>(this._reconstructedMesh.getVerticesData(VertexBuffer.PositionKind) || []);
+            var newNormalData = <number[]>(this._reconstructedMesh.getVerticesData(VertexBuffer.NormalKind) || []);
+            var newUVsData = <number[]>(this._reconstructedMesh.getVerticesData(VertexBuffer.UVKind) || []);
+            var newColorsData = <number[]>(this._reconstructedMesh.getVerticesData(VertexBuffer.ColorKind) || []);
 
             var normalData = this._mesh.getVerticesData(VertexBuffer.NormalKind);
             var uvs = this._mesh.getVerticesData(VertexBuffer.UVKind);
@@ -509,7 +509,7 @@
                 var vertex = this.vertices[i];
                 vertex.id = vertexCount;
                 if (vertex.triangleCount) {
-                    vertex.originalOffsets.forEach(function (originalOffset) {
+                    vertex.originalOffsets.forEach(originalOffset => {
                         newPositionData.push(vertex.position.x);
                         newPositionData.push(vertex.position.y);
                         newPositionData.push(vertex.position.z);
@@ -539,9 +539,8 @@
             var newIndicesArray: Array<number> = this._reconstructedMesh.getIndices(); //[];
             var originalIndices = this._mesh.getIndices();
             for (i = 0; i < newTriangles.length; ++i) {
-                var t = newTriangles[i];
-                //now get the new referencing point for each vertex
-                [0, 1, 2].forEach(function (idx) {
+                t = newTriangles[i]; //now get the new referencing point for each vertex
+                [0, 1, 2].forEach(idx => {
                     var id = originalIndices[t.originalOffset + idx]
                     var offset = t.vertices[idx].originalOffsets.indexOf(id);
                     if (offset < 0) offset = 0;
@@ -563,7 +562,7 @@
             var originalSubmesh = this._mesh.subMeshes[submeshIndex];
             if (submeshIndex > 0) {
                 this._reconstructedMesh.subMeshes = [];
-                submeshesArray.forEach(function (submesh) {
+                submeshesArray.forEach(submesh => {
                     new SubMesh(submesh.materialIndex, submesh.verticesStart, submesh.verticesCount,/* 0, newPositionData.length/3, */submesh.indexStart, submesh.indexCount, submesh.getMesh());
                 });
                 var newSubmesh = new SubMesh(originalSubmesh.materialIndex, startingVertex, vertexCount,/* 0, newPositionData.length / 3, */startingIndex, newTriangles.length * 3, this._reconstructedMesh);

+ 5 - 5
src/Mesh/babylon.vertexBuffer.ts

@@ -3,12 +3,12 @@
         private _mesh: Mesh;
         private _engine: Engine;
         private _buffer: WebGLBuffer;
-        private _data: number[];
+        private _data: number[] | Float32Array;
         private _updatable: boolean;
         private _kind: string;
         private _strideSize: number;
 
-        constructor(engine: any, data: number[], kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number) {
+        constructor(engine: any, data: number[] | Float32Array, kind: string, updatable: boolean, postponeInternalCreation?: boolean, stride?: number) {
             if (engine instanceof Mesh) { // old versions of BABYLON.VertexBuffer accepted 'mesh' instead of 'engine'
                 this._engine = engine.getScene().getEngine();
             }
@@ -64,7 +64,7 @@
             return this._updatable;
         }
 
-        public getData(): number[] {
+        public getData(): number[] | Float32Array {
             return this._data;
         }
 
@@ -77,7 +77,7 @@
         }
 
         // Methods
-        public create(data?: number[]): void {
+        public create(data?: number[] | Float32Array): void {
             if (!data && this._buffer) {
                 return; // nothing to do
             }
@@ -98,7 +98,7 @@
             }
         }
 
-        public update(data: number[]): void {
+        public update(data: number[] | Float32Array): void {
             this.create(data);
         }
 

+ 21 - 0
src/Particles/babylon.solidParticle.js

@@ -0,0 +1,21 @@
+var BABYLON;
+(function (BABYLON) {
+    var SolidParticle = (function () {
+        function SolidParticle(particleIndex, positionIndex, shape, shapeUV, shapeId) {
+            this.shapeId = shapeId;
+            this.color = new BABYLON.Color4(1, 1, 1, 1);
+            this.position = BABYLON.Vector3.Zero();
+            this.rotation = BABYLON.Vector3.Zero();
+            this.scale = new BABYLON.Vector3(1, 1, 1);
+            this.uvs = new BABYLON.Vector4(0, 0, 1, 1);
+            this.velocity = BABYLON.Vector3.Zero();
+            this.alive = true;
+            this.idx = particleIndex;
+            this._pos = positionIndex;
+            this._shape = shape;
+            this._shapeUV = shapeUV;
+        }
+        return SolidParticle;
+    })();
+    BABYLON.SolidParticle = SolidParticle;
+})(BABYLON || (BABYLON = {}));

+ 8 - 9
src/Particles/babylon.solidParticle.ts

@@ -2,22 +2,21 @@ module BABYLON {
 
     export class SolidParticle {
         public idx: number; 
-        public shapeId: number;
-        public color: Color4 = new Color4(1, 1, 1, 1);
-        public position: Vector3 = Vector3.Zero();
-        public rotation: Vector3 = Vector3.Zero();
+        public color = new Color4(1, 1, 1, 1);
+        public position = Vector3.Zero();
+        public rotation = Vector3.Zero();
         public quaternion: Vector4;
-        public scale: Vector3 = new Vector3(1 ,1, 1);
-        public uvs: Vector4 = new Vector4(0,0, 1,1);
-        public velocity: Vector3 = Vector3.Zero();
-        public alive: boolean = true;
+        public scale = new Vector3(1 ,1, 1);
+        public uvs = new Vector4(0,0, 1,1);
+        public velocity = Vector3.Zero();
+        public alive = true;
         public _pos: number;
         public _shape: Vector3[]; 
         public _shapeUV : number[];   
         public previous: SolidParticle;
         public next: SolidParticle;
 
-        constructor(particleIndex: number, positionIndex: number, shape: Vector3[], shapeUV: number[], shapeID: number) {
+        constructor(particleIndex: number, positionIndex: number, shape: Vector3[], shapeUV: number[], public shapeId: number) {
             this.idx = particleIndex;
             this._pos = positionIndex;
             this._shape = shape;

+ 46 - 47
src/Particles/babylon.solidParticleSystem.ts

@@ -2,32 +2,32 @@ module BABYLON {
 
     export class SolidParticleSystem implements IDisposable {
         // public members  
-        public particles: SolidParticle[] = [];
-        public nbParticles:number = 0;
-        public billboard: boolean = false;
-        public counter: number = 0;
+        public particles = new Array<SolidParticle>();
+        public nbParticles = 0;
+        public billboard = false;
+        public counter = 0;
         public name: string;
         public mesh: Mesh;
         
         // private members
         private _scene: Scene;
-        private _positions: number[] = [];
-        private _indices: number[] = [];
-        private _normals: number[] = [];
-        private _colors: number[] = [];
-        private _uvs: number[] = [];
-        private _index: number = 0;  // indices index
-        private _shapeCounter: number = 0;
-        private _useParticleColor: boolean = true;
-        private _useParticleTexture: boolean = true;
-        private _useParticleRotation: boolean = true;
-        private _useParticleVertex: boolean = false;
-        private _cam_axisZ: Vector3 = Vector3.Zero();
-        private _cam_axisY: Vector3 = Vector3.Zero();
-        private _cam_axisX: Vector3 = Vector3.Zero();
-        private _axisX: Vector3 = Axis.X;
-        private _axisY: Vector3 = Axis.Y;
-        private _axisZ: Vector3 = Axis.Z;
+        private _positions = new Array<number>();
+        private _indices = new Array<number>();
+        private _normals = new Array<number>();
+        private _colors = new Array<number>();
+        private _uvs = new Array<number>();
+        private _index = 0;  // indices index
+        private _shapeCounter = 0;
+        private _useParticleColor = true;
+        private _useParticleTexture = true;
+        private _useParticleRotation = true;
+        private _useParticleVertex = false;
+        private _cam_axisZ = Vector3.Zero();
+        private _cam_axisY = Vector3.Zero();
+        private _cam_axisX = Vector3.Zero();
+        private _axisX = Axis.X;
+        private _axisY = Axis.Y;
+        private _axisZ = Axis.Z;
         private _camera: Camera;
         private _particle: SolidParticle;
         private _previousParticle: SolidParticle;
@@ -50,6 +50,7 @@ module BABYLON {
         private _sinYaw: number = 0.0;
         private _cosYaw: number = 0.0;
 
+
         constructor(name: string, scene: Scene) {
             this.name = name;
             this._scene = scene;
@@ -58,8 +59,8 @@ module BABYLON {
 
         // build the SPS mesh : returns the mesh
         public buildMesh(): Mesh {
-            if (this.nbParticles == 0) {
-                //this.addTriangles(1, 1);
+            if (this.nbParticles === 0) {
+                return null;
             }
             VertexData.ComputeNormals(this._positions, this._indices, this._normals);
             var vertexData = new VertexData();
@@ -79,7 +80,7 @@ module BABYLON {
         }
 
         // _meshBuilder : inserts the shape model in the global SPS mesh
-        private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors): void  { 
+        private _meshBuilder(p, shape, positions, meshInd, indices, meshUV, uvs, meshCol, colors): void {
             var i;
             var u = 0;
             var c = 0;
@@ -93,7 +94,7 @@ module BABYLON {
                     colors.push(meshCol[c], meshCol[c + 1], meshCol[c + 2], meshCol[c + 3]);
                     c += 4;
                 } else {
-                    colors.push(1,1,1,1);
+                    colors.push(1, 1, 1, 1);
                 }
             }
             for (i = 0; i < meshInd.length; i++) {
@@ -105,7 +106,7 @@ module BABYLON {
         private _posToShape(positions): Vector3[] {
             var shape = [];
             for (var i = 0; i < positions.length; i += 3) {
-                shape.push(new BABYLON.Vector3(positions[i], positions[i + 1], positions[i + 2]));
+                shape.push(new Vector3(positions[i], positions[i + 1], positions[i + 2]));
             }
             return shape;
         }
@@ -148,14 +149,14 @@ module BABYLON {
                 this._index += shape.length;
             }
             this.nbParticles += nb;
-            this._shapeCounter ++;
+            this._shapeCounter++;
             return this._shapeCounter;
         }
 
         // resets a particle back to its just built status
         public resetParticle(particle: SolidParticle): void {
             for (var pt = 0; pt < particle._shape.length; pt++) {
-                this._positions[particle._pos + pt * 3] = particle._shape[pt].x;      
+                this._positions[particle._pos + pt * 3] = particle._shape[pt].x;
                 this._positions[particle._pos + pt * 3 + 1] = particle._shape[pt].y;
                 this._positions[particle._pos + pt * 3 + 2] = particle._shape[pt].z;
             }
@@ -179,13 +180,13 @@ module BABYLON {
             this._cam_axisZ.z = 1;
 
             // if the particles will always face the camera
-            if (this.billboard)  {    
+            if (this.billboard) {    
                 // compute a fake camera position : un-rotate the camera position by the current mesh rotation
                 this._yaw = this.mesh.rotation.y;
                 this._pitch = this.mesh.rotation.x;
                 this._roll = this.mesh.rotation.z;
                 this._quaternionRotationYPR();
-                this._quaternionToRotationMatrix();    
+                this._quaternionToRotationMatrix();
                 this._rotMatrix.invertToRef(this._invertedMatrix);
                 Vector3.TransformCoordinatesToRef(this._camera.globalPosition, this._invertedMatrix, this._fakeCamPos);
 
@@ -197,7 +198,6 @@ module BABYLON {
                 this._cam_axisX.normalize();
                 this._cam_axisZ.normalize();
             }
-          
 
             Matrix.IdentityToRef(this._rotMatrix);
             var idx = 0;
@@ -231,7 +231,7 @@ module BABYLON {
                         this._roll = this._particle.rotation.z;
                         this._quaternionRotationYPR();
                     }
-                this._quaternionToRotationMatrix();
+                    this._quaternionToRotationMatrix();
                 }
 
                 for (var pt = 0; pt < this._particle._shape.length; pt++) {
@@ -249,9 +249,9 @@ module BABYLON {
 
                     Vector3.TransformCoordinatesToRef(this._vertex, this._rotMatrix, this._rotated);
 
-                    this._positions[idx]     = this._particle.position.x + this._cam_axisX.x * this._rotated.x * this._particle.scale.x + this._cam_axisY.x * this._rotated.y * this._particle.scale.y + this._cam_axisZ.x * this._rotated.z * this._particle.scale.z;      
-                    this._positions[idx + 1] = this._particle.position.y + this._cam_axisX.y * this._rotated.x * this._particle.scale.x + this._cam_axisY.y * this._rotated.y * this._particle.scale.y + this._cam_axisZ.y * this._rotated.z * this._particle.scale.z; 
-                    this._positions[idx + 2] = this._particle.position.z + this._cam_axisX.z * this._rotated.x * this._particle.scale.x + this._cam_axisY.z * this._rotated.y * this._particle.scale.y + this._cam_axisZ.z * this._rotated.z * this._particle.scale.z; 
+                    this._positions[idx] = this._particle.position.x + this._cam_axisX.x * this._rotated.x * this._particle.scale.x + this._cam_axisY.x * this._rotated.y * this._particle.scale.y + this._cam_axisZ.x * this._rotated.z * this._particle.scale.z;
+                    this._positions[idx + 1] = this._particle.position.y + this._cam_axisX.y * this._rotated.x * this._particle.scale.x + this._cam_axisY.y * this._rotated.y * this._particle.scale.y + this._cam_axisZ.y * this._rotated.z * this._particle.scale.z;
+                    this._positions[idx + 2] = this._particle.position.z + this._cam_axisX.z * this._rotated.x * this._particle.scale.x + this._cam_axisY.z * this._rotated.y * this._particle.scale.y + this._cam_axisZ.z * this._rotated.z * this._particle.scale.z;
 
                     if (this._useParticleColor) {
                         this._colors[colidx] = this._particle.color.r;
@@ -285,7 +285,7 @@ module BABYLON {
             }
             this.afterUpdateParticles(start, end, update);
         }
-        // internal implementation of BJS Quaternion.RotationYawPitchRollToRef() with memory reuse
+        
         private _quaternionRotationYPR(): void {
             this._halfroll = this._roll * 0.5;
             this._halfpitch = this._pitch * 0.5;
@@ -301,8 +301,7 @@ module BABYLON {
             this._quaternion.z = (this._cosYaw * this._cosPitch * this._sinRoll) - (this._sinYaw * this._sinPitch * this._cosRoll);
             this._quaternion.w = (this._cosYaw * this._cosPitch * this._cosRoll) + (this._sinYaw * this._sinPitch * this._sinRoll);
         }
-
-        // internal implemenation of BJS toRotationMatric() with memory reuse
+        
         private _quaternionToRotationMatrix(): void {
             this._rotMatrix.m[0] = 1.0 - (2.0 * (this._quaternion.y * this._quaternion.y + this._quaternion.z * this._quaternion.z));
             this._rotMatrix.m[1] = 2.0 * (this._quaternion.x * this._quaternion.y + this._quaternion.z * this._quaternion.w);
@@ -319,7 +318,7 @@ module BABYLON {
             this._rotMatrix.m[12] = 0;
             this._rotMatrix.m[13] = 0;
             this._rotMatrix.m[14] = 0;
-            this._rotMatrix.m[15] = 1.0
+            this._rotMatrix.m[15] = 1.0;
         }
 
         // dispose the SPS
@@ -338,26 +337,26 @@ module BABYLON {
 
         public set useParticleTexture(val: boolean) {
             this._useParticleTexture = val;
-        } 
+        }
 
         public set useParticleVertex(val: boolean) {
             this._useParticleVertex = val;
         } 
 
         // getters
-         public get useParticleRotation() {
+        public get useParticleRotation(): boolean {
             return this._useParticleRotation;
         }
 
-        public get useParticleColor() {
+        public get useParticleColor(): boolean {
             return this._useParticleColor;
         }
 
-        public get useParticleTexture() {
+        public get useParticleTexture(): boolean {
             return this._useParticleTexture;
-        } 
+        }
 
-        public get useParticleVertex() {
+        public get useParticleVertex(): boolean {
             return this._useParticleVertex;
         } 
        
@@ -369,7 +368,7 @@ module BABYLON {
 
         // init : sets all particles first values and calls updateParticle to set them in space
         // can be overwritten by the user
-        public initParticles(): void {    
+        public initParticles(): void {
         }
 
         // recycles a particle : can by overwritten by the user
@@ -380,7 +379,7 @@ module BABYLON {
         // updates a particle : can be overwritten by the user
         // will be called on each particle by setParticles() :
         // ex : just set a particle position or velocity and recycle conditions
-        public updateParticle (particle: SolidParticle): SolidParticle {
+        public updateParticle(particle: SolidParticle): SolidParticle {
             return particle;
         }
 

+ 1 - 1
src/Physics/Plugins/babylon.cannonJSPlugin.ts

@@ -121,7 +121,7 @@
             return this._createRigidBodyFromShape(shape, mesh, options.mass, options.friction, options.restitution);
         }
 
-        private _createConvexPolyhedron(rawVerts: number[], rawFaces: number[], mesh: AbstractMesh, options?: PhysicsBodyCreationOptions): any {
+        private _createConvexPolyhedron(rawVerts: number[] | Float32Array, rawFaces: number[], mesh: AbstractMesh, options?: PhysicsBodyCreationOptions): any {
             var verts = [], faces = [];
 
             mesh.computeWorldMatrix(true);

+ 0 - 5
src/Tools/babylon.tools.js

@@ -733,11 +733,6 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
-        // Deprecated
-        Tools.GetFps = function () {
-            Tools.Warn("Tools.GetFps() is deprecated. Please use engine.getFps() instead");
-            return 0;
-        };
         Tools.BaseUrl = "";
         // Logs
         Tools._NoneLogLevel = 0;

+ 2 - 11
src/Tools/babylon.tools.ts

@@ -101,7 +101,7 @@
             return angle * Math.PI / 180;
         }
 
-        public static ExtractMinAndMaxIndexed(positions: number[], indices: number[], indexStart: number, indexCount: number): { minimum: Vector3; maximum: Vector3 } {
+        public static ExtractMinAndMaxIndexed(positions: number[] | Float32Array, indices: number[], indexStart: number, indexCount: number): { minimum: Vector3; maximum: Vector3 } {
             var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
             var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
 
@@ -118,7 +118,7 @@
             };
         }
 
-        public static ExtractMinAndMax(positions: number[], start: number, count: number): { minimum: Vector3; maximum: Vector3 } {
+        public static ExtractMinAndMax(positions: number[] | Float32Array, start: number, count: number): { minimum: Vector3; maximum: Vector3 } {
             var minimum = new Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
             var maximum = new Vector3(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
 
@@ -847,15 +847,6 @@
 
             return new Date().getTime();
         }
-
-        // Deprecated
-
-        public static GetFps(): number {
-            Tools.Warn("Tools.GetFps() is deprecated. Please use engine.getFps() instead");
-            return 0;
-        }
-
-
     }
 
     /**

+ 6 - 1
src/babylon.engine.js

@@ -884,7 +884,12 @@ var BABYLON;
         Engine.prototype.createVertexBuffer = function (vertices) {
             var vbo = this._gl.createBuffer();
             this._gl.bindBuffer(this._gl.ARRAY_BUFFER, vbo);
-            this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(vertices), this._gl.STATIC_DRAW);
+            if (vertices instanceof Float32Array) {
+                this._gl.bufferData(this._gl.ARRAY_BUFFER, vertices, this._gl.STATIC_DRAW);
+            }
+            else {
+                this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(vertices), this._gl.STATIC_DRAW);
+            }
             this._resetVertexBufferBinding();
             vbo.references = 1;
             return vbo;

+ 11 - 5
src/babylon.engine.ts

@@ -562,7 +562,7 @@
          * @param {boolean} [antialias] - enable antialias
          * @param options - further options to be sent to the getContext function
          */
-        constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: { antialias?: boolean, preserveDrawingBuffer?: boolean}, adaptToDeviceRatio = true) {
+        constructor(canvas: HTMLCanvasElement, antialias?: boolean, options?: { antialias?: boolean, preserveDrawingBuffer?: boolean }, adaptToDeviceRatio = true) {
             this._renderingCanvas = canvas;
 
             options = options || {};
@@ -1008,10 +1008,16 @@
             this._cachedVertexBuffers = null;
         }
 
-        public createVertexBuffer(vertices: number[]): WebGLBuffer {
+        public createVertexBuffer(vertices: number[] | Float32Array): WebGLBuffer {
             var vbo = this._gl.createBuffer();
             this._gl.bindBuffer(this._gl.ARRAY_BUFFER, vbo);
-            this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(vertices), this._gl.STATIC_DRAW);
+
+            if (vertices instanceof Float32Array) {
+                this._gl.bufferData(this._gl.ARRAY_BUFFER, vertices, this._gl.STATIC_DRAW);
+            } else {
+                this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(vertices), this._gl.STATIC_DRAW);
+            }
+
             this._resetVertexBufferBinding();
             vbo.references = 1;
             return vbo;
@@ -1026,7 +1032,7 @@
             return vbo;
         }
 
-        public updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: any, offset?: number): void {
+        public updateDynamicVertexBuffer(vertexBuffer: WebGLBuffer, vertices: number[] | Float32Array, offset?: number): void {
             this._gl.bindBuffer(this._gl.ARRAY_BUFFER, vertexBuffer);
 
             if (offset === undefined) {
@@ -1963,7 +1969,7 @@
             var filters = getSamplingParameters(samplingMode, generateMipMaps, gl);
 
             gl.bindTexture(gl.TEXTURE_CUBE_MAP, texture);
-            
+
             for (var face = 0; face < 6; face++) {
                 gl.texImage2D((gl.TEXTURE_CUBE_MAP_POSITIVE_X + face), 0, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
             }