浏览代码

Merge branch 'master' of https://github.com/BabylonJS/Babylon.js

David Catuhe 8 年之前
父节点
当前提交
8b390e9931
共有 31 个文件被更改,包括 6646 次插入6614 次删除
  1. 2 1
      .vscode/settings.json
  2. 3047 3048
      dist/preview release/babylon.d.ts
  3. 37 37
      dist/preview release/babylon.js
  4. 50 33
      dist/preview release/babylon.max.js
  5. 3047 3048
      dist/preview release/babylon.module.d.ts
  6. 38 38
      dist/preview release/babylon.worker.js
  7. 11 11
      dist/preview release/canvas2D/babylon.canvas2d.min.js
  8. 1 1
      dist/preview release/gui/babylon.gui.min.js
  9. 251 251
      dist/preview release/inspector/babylon.inspector.bundle.js
  10. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  11. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  12. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  13. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  14. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  15. 11 11
      dist/preview release/materialsLibrary/babylon.customMaterial.d.ts
  16. 35 35
      dist/preview release/materialsLibrary/babylon.customMaterial.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  19. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  20. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  21. 2 0
      dist/preview release/what's new.md
  22. 42 42
      materialsLibrary/src/custom/babylon.customMaterial.ts
  23. 3 3
      materialsLibrary/src/custom/readme.md
  24. 14 4
      src/Audio/babylon.audioEngine.ts
  25. 0 10
      src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts
  26. 8 2
      src/Lights/babylon.light.ts
  27. 5 5
      src/Materials/babylon.material.ts
  28. 2 2
      src/Materials/babylon.pbrMaterial.ts
  29. 2 2
      src/Materials/babylon.standardMaterial.ts
  30. 24 16
      src/Mesh/babylon.geometry.ts
  31. 1 1
      src/Mesh/babylon.mesh.ts

+ 2 - 1
.vscode/settings.json

@@ -32,7 +32,8 @@
         "**/*.js": { 
              "when":"$(basename).ts"
          },
-        "**/*.d.ts": true
+        "**/*.d.ts": true,
+        "assets":true
     },
     "typescript.check.workspaceVersion": false
 }

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


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


+ 50 - 33
dist/preview release/babylon.max.js

@@ -12948,10 +12948,10 @@ var BABYLON;
             if (!mesh) {
                 return true;
             }
-            if (this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
+            if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
                 return false;
             }
-            if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
+            if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
                 return false;
             }
             if (this.includeOnlyWithLayerMask !== 0 && (this.includeOnlyWithLayerMask & mesh.layerMask) === 0) {
@@ -13109,6 +13109,10 @@ var BABYLON;
                 }
                 return deleted;
             };
+            for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
+                var item = array_1[_i];
+                item._resyncLighSource(this);
+            }
         };
         Light.prototype._hookArrayForIncludedOnly = function (array) {
             var _this = this;
@@ -13128,6 +13132,7 @@ var BABYLON;
                 _this._resyncMeshes();
                 return deleted;
             };
+            this._resyncMeshes();
         };
         Light.prototype._resyncMeshes = function () {
             for (var _i = 0, _a = this.getScene().meshes; _i < _a.length; _i++) {
@@ -23273,11 +23278,11 @@ var BABYLON;
     Material._PointFillMode = 2;
     Material._ClockWiseSideOrientation = 0;
     Material._CounterClockWiseSideOrientation = 1;
-    Material._TextureDirtyFlag = 0;
-    Material._LightDirtyFlag = 1;
-    Material._FresnelDirtyFlag = 2;
-    Material._AttributesDirtyFlag = 4;
-    Material._MiscDirtyFlag = 8;
+    Material._TextureDirtyFlag = 1;
+    Material._LightDirtyFlag = 2;
+    Material._FresnelDirtyFlag = 4;
+    Material._AttributesDirtyFlag = 8;
+    Material._MiscDirtyFlag = 16;
     __decorate([
         BABYLON.serialize()
     ], Material.prototype, "id", void 0);
@@ -26494,76 +26499,84 @@ var BABYLON;
             }
             return serializationObject;
         };
+        Geometry.prototype.toNumberArray = function (origin) {
+            if (Array.isArray(origin)) {
+                return origin;
+            }
+            else {
+                return Array.prototype.slice.call(origin);
+            }
+        };
         Geometry.prototype.serializeVerticeData = function () {
             var serializationObject = this.serialize();
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.PositionKind)) {
-                serializationObject.positions = this.getVerticesData(BABYLON.VertexBuffer.PositionKind);
+                serializationObject.positions = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.PositionKind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.PositionKind).isUpdatable) {
                     serializationObject.positions._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.NormalKind)) {
-                serializationObject.normals = this.getVerticesData(BABYLON.VertexBuffer.NormalKind);
+                serializationObject.normals = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.NormalKind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.NormalKind).isUpdatable) {
                     serializationObject.normals._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UVKind)) {
-                serializationObject.uvs = this.getVerticesData(BABYLON.VertexBuffer.UVKind);
+                serializationObject.uvs = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UVKind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UVKind).isUpdatable) {
                     serializationObject.uvs._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UV2Kind)) {
-                serializationObject.uv2s = this.getVerticesData(BABYLON.VertexBuffer.UV2Kind);
+                serializationObject.uv2s = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UV2Kind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UV2Kind).isUpdatable) {
                     serializationObject.uv2s._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UV3Kind)) {
-                serializationObject.uv3s = this.getVerticesData(BABYLON.VertexBuffer.UV3Kind);
+                serializationObject.uv3s = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UV3Kind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UV3Kind).isUpdatable) {
                     serializationObject.uv3s._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UV4Kind)) {
-                serializationObject.uv4s = this.getVerticesData(BABYLON.VertexBuffer.UV4Kind);
+                serializationObject.uv4s = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UV4Kind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UV4Kind).isUpdatable) {
                     serializationObject.uv4s._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UV5Kind)) {
-                serializationObject.uv5s = this.getVerticesData(BABYLON.VertexBuffer.UV5Kind);
+                serializationObject.uv5s = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UV5Kind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UV5Kind).isUpdatable) {
                     serializationObject.uv5s._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.UV6Kind)) {
-                serializationObject.uv6s = this.getVerticesData(BABYLON.VertexBuffer.UV6Kind);
+                serializationObject.uv6s = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.UV6Kind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.UV6Kind).isUpdatable) {
                     serializationObject.uv6s._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.ColorKind)) {
-                serializationObject.colors = this.getVerticesData(BABYLON.VertexBuffer.ColorKind);
+                serializationObject.colors = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.ColorKind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.ColorKind).isUpdatable) {
                     serializationObject.colors._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesIndicesKind)) {
-                serializationObject.matricesIndices = this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind);
+                serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.MatricesIndicesKind));
                 serializationObject.matricesIndices._isExpanded = true;
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.MatricesIndicesKind).isUpdatable) {
                     serializationObject.matricesIndices._updatable = true;
                 }
             }
             if (this.isVerticesDataPresent(BABYLON.VertexBuffer.MatricesWeightsKind)) {
-                serializationObject.matricesWeights = this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind);
+                serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(BABYLON.VertexBuffer.MatricesWeightsKind));
                 if (this.getVertexBuffer(BABYLON.VertexBuffer.MatricesWeightsKind).isUpdatable) {
                     serializationObject.matricesWeights._updatable = true;
                 }
             }
-            serializationObject.indices = this.getIndices();
+            serializationObject.indices = this.toNumberArray(this.getIndices());
             return serializationObject;
         };
         // Statics
@@ -27434,10 +27447,10 @@ var BABYLON;
             _this._globalAmbientColor = new BABYLON.Color3(0, 0, 0);
             _this.getRenderTargetTextures = function () {
                 _this._renderTargets.reset();
-                if (_this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {
+                if (StandardMaterial.ReflectionTextureEnabled && _this._reflectionTexture && _this._reflectionTexture.isRenderTarget) {
                     _this._renderTargets.push(_this._reflectionTexture);
                 }
-                if (_this._refractionTexture && _this._refractionTexture.isRenderTarget) {
+                if (StandardMaterial.RefractionTextureEnabled && _this._refractionTexture && _this._refractionTexture.isRenderTarget) {
                     _this._renderTargets.push(_this._refractionTexture);
                 }
                 return _this._renderTargets;
@@ -28887,10 +28900,10 @@ var BABYLON;
             _this._cachedDefines.BonesPerMesh = -1;
             _this.getRenderTargetTextures = function () {
                 _this._renderTargets.reset();
-                if (_this.reflectionTexture && _this.reflectionTexture.isRenderTarget) {
+                if (BABYLON.StandardMaterial.ReflectionTextureEnabled && _this.reflectionTexture && _this.reflectionTexture.isRenderTarget) {
                     _this._renderTargets.push(_this.reflectionTexture);
                 }
-                if (_this.refractionTexture && _this.refractionTexture.isRenderTarget) {
+                if (BABYLON.StandardMaterial.RefractionTextureEnabled && _this.refractionTexture && _this.refractionTexture.isRenderTarget) {
                     _this._renderTargets.push(_this.refractionTexture);
                 }
                 return _this._renderTargets;
@@ -31249,8 +31262,6 @@ var BABYLON;
             element.addEventListener("mousemove", this._onMouseMove, false);
             element.addEventListener("MSPointerDown", this._onGestureStart, false);
             element.addEventListener("MSGestureChange", this._onGesture, false);
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
             BABYLON.Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
@@ -31263,12 +31274,8 @@ var BABYLON;
                 element.removeEventListener("mousemove", this._onMouseMove);
                 element.removeEventListener("MSPointerDown", this._onGestureStart);
                 element.removeEventListener("MSGestureChange", this._onGesture);
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
                 this._isPanClick = false;
                 this.pinchInwards = true;
-                this._onKeyDown = null;
-                this._onKeyUp = null;
                 this._onMouseMove = null;
                 this._onGestureStart = null;
                 this._onGesture = null;
@@ -40145,11 +40152,21 @@ var BABYLON;
                 this.canUseWebAudio = true;
             }
             var audioElem = document.createElement('audio');
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
-                this.isMP3supported = true;
+            try {
+                if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
+                    this.isMP3supported = true;
+                }
             }
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
-                this.isOGGsupported = true;
+            catch (e) {
+                // protect error during capability check.
+            }
+            try {
+                if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
+                    this.isOGGsupported = true;
+                }
+            }
+            catch (e) {
+                // protect error during capability check.
             }
             if (/iPad|iPhone|iPod/.test(navigator.platform)) {
                 this._unlockiOSaudio();

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


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


文件差异内容过多而无法显示
+ 11 - 11
dist/preview release/canvas2D/babylon.canvas2d.min.js


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


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


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


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


文件差异内容过多而无法显示
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 11 - 11
dist/preview release/materialsLibrary/babylon.customMaterial.d.ts

@@ -8,16 +8,16 @@ declare module BABYLON {
     class ShaderSpecialParts {
         constructor();
         Fragment_Begin: string;
-        Fragment_Definations: string;
+        Fragment_Definitions: string;
         Fragment_MainBegin: string;
         Fragment_Custom_Diffuse: string;
         Fragment_Custom_Alpha: string;
         Fragment_Before_FragColor: string;
         Vertex_Begin: string;
-        Vertex_Definations: string;
+        Vertex_Definitions: string;
         Vertex_MainBegin: string;
-        Vertex_Befor_PositionUpdated: string;
-        Vertex_Befor_NormalUpdated: string;
+        Vertex_Before_PositionUpdated: string;
+        Vertex_Before_NormalUpdated: string;
     }
     class ShaderForVer3_0 extends CustomShaderStructure {
         constructor();
@@ -29,9 +29,9 @@ declare module BABYLON {
         static ShaderIndexer: number;
         CustomParts: ShaderSpecialParts;
         ShaderVersion: CustomShaderStructure;
-        _customUnifrom: string[];
-        _newUnifroms: string[];
-        _newUnifromInstances: any[];
+        _customUniform: string[];
+        _newUniforms: string[];
+        _newUniformInstances: any[];
         _newSamplerInstances: Texture[];
         AttachAfterBind(mesh: Mesh, effect: Effect): void;
         ReviewUniform(name: string, arr: string[]): string[];
@@ -40,15 +40,15 @@ declare module BABYLON {
         constructor(name: string, scene: Scene);
         AddUniform(name: string, kind: string, param: any): CustomMaterial;
         Fragment_Begin(shaderPart: string): CustomMaterial;
-        Fragment_Definations(shaderPart: string): CustomMaterial;
+        Fragment_Definitions(shaderPart: string): CustomMaterial;
         Fragment_MainBegin(shaderPart: string): CustomMaterial;
         Fragment_Custom_Diffuse(shaderPart: string): CustomMaterial;
         Fragment_Custom_Alpha(shaderPart: string): CustomMaterial;
         Fragment_Before_FragColor(shaderPart: string): CustomMaterial;
         Vertex_Begin(shaderPart: string): CustomMaterial;
-        Vertex_Definations(shaderPart: string): CustomMaterial;
+        Vertex_Definitions(shaderPart: string): CustomMaterial;
         Vertex_MainBegin(shaderPart: string): CustomMaterial;
-        Vertex_Befor_PositionUpdated(shaderPart: string): CustomMaterial;
-        Vertex_Befor_NormalUpdated(shaderPart: string): CustomMaterial;
+        Vertex_Before_PositionUpdated(shaderPart: string): CustomMaterial;
+        Vertex_Before_NormalUpdated(shaderPart: string): CustomMaterial;
     }
 }

+ 35 - 35
dist/preview release/materialsLibrary/babylon.customMaterial.js

@@ -117,7 +117,7 @@ varying vec3 vDirectionW;\n\
 #include<logDepthDeclaration>\n\
 #include<fogFragmentDeclaration>\n\
 \n\
-#[Fragment_Definations]\n\
+#[Fragment_Definitions]\n\
 \n\
 void main(void) {\n\
 \n\
@@ -390,7 +390,7 @@ varying vec3 vDirectionW;\n\
 #endif\n\
 #include<logDepthDeclaration>\n\
 \n\
-#[Vertex_Definations]\n\
+#[Vertex_Definitions]\n\
 \n\
 void main(void) {\n\
     \n\
@@ -410,14 +410,14 @@ vPositionUVW=positionUpdated;\n\
 #include<instancesVertex>\n\
 #include<bonesVertex>\n\
 \n\
-#[Vertex_Befor_PositionUpdated]\n\
+#[Vertex_Before_PositionUpdated]\n\
 \n\
 gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n\
 vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\
 vPositionW=vec3(worldPos);\n\
 #ifdef NORMAL\n\
 \n\
-#[Vertex_Befor_NormalUpdated]\n\
+#[Vertex_Before_NormalUpdated]\n\
 \n\
 vNormalW=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n\
 #endif\n\
@@ -533,18 +533,18 @@ vColor=color;\n\
             return _this;
         }
         CustomMaterial.prototype.AttachAfterBind = function (mesh, effect) {
-            for (var el in this._newUnifromInstances) {
+            for (var el in this._newUniformInstances) {
                 var ea = el.toString().split('-');
                 if (ea[0] == 'vec2')
-                    effect.setVector2(ea[1], this._newUnifromInstances[el]);
+                    effect.setVector2(ea[1], this._newUniformInstances[el]);
                 else if (ea[0] == 'vec3')
-                    effect.setVector3(ea[1], this._newUnifromInstances[el]);
+                    effect.setVector3(ea[1], this._newUniformInstances[el]);
                 else if (ea[0] == 'vec4')
-                    effect.setVector4(ea[1], this._newUnifromInstances[el]);
+                    effect.setVector4(ea[1], this._newUniformInstances[el]);
                 else if (ea[0] == 'mat4')
-                    effect.setMatrix(ea[1], this._newUnifromInstances[el]);
+                    effect.setMatrix(ea[1], this._newUniformInstances[el]);
                 else if (ea[0] == 'float')
-                    effect.setFloat(ea[1], this._newUnifromInstances[el]);
+                    effect.setFloat(ea[1], this._newUniformInstances[el]);
             }
             for (var el in this._newSamplerInstances) {
                 var ea = el.toString().split('-');
@@ -554,14 +554,14 @@ vColor=color;\n\
         };
         CustomMaterial.prototype.ReviewUniform = function (name, arr) {
             if (name == "uniform") {
-                for (var ind in this._newUnifroms)
-                    if (this._customUnifrom[ind].indexOf('sampler') == -1)
-                        arr.push(this._newUnifroms[ind]);
+                for (var ind in this._newUniforms)
+                    if (this._customUniform[ind].indexOf('sampler') == -1)
+                        arr.push(this._newUniforms[ind]);
             }
             if (name == "sampler") {
-                for (var ind in this._newUnifroms)
-                    if (this._customUnifrom[ind].indexOf('sampler') != -1)
-                        arr.push(this._newUnifroms[ind]);
+                for (var ind in this._newUniforms)
+                    if (this._customUniform[ind].indexOf('sampler') != -1)
+                        arr.push(this._newUniforms[ind]);
             }
             return arr;
         };
@@ -581,14 +581,14 @@ vColor=color;\n\
             };
             BABYLON.Effect.ShadersStore[name + "VertexShader"] = this.ShaderVersion.VertexStore
                 .replace('#[Vertex_Begin]', (this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : ""))
-                .replace('#[Vertex_Definations]', (this._customUnifrom ? this._customUnifrom.join("\n") : "") + (this.CustomParts.Vertex_Definations ? this.CustomParts.Vertex_Definations : ""))
+                .replace('#[Vertex_Definitions]', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
                 .replace('#[Vertex_MainBegin]', (this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
-                .replace('#[Vertex_Befor_PositionUpdated]', (this.CustomParts.Vertex_Befor_PositionUpdated ? this.CustomParts.Vertex_Befor_PositionUpdated : ""))
-                .replace('#[Vertex_Befor_NormalUpdated]', (this.CustomParts.Vertex_Befor_NormalUpdated ? this.CustomParts.Vertex_Befor_NormalUpdated : ""));
+                .replace('#[Vertex_Before_PositionUpdated]', (this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
+                .replace('#[Vertex_Before_NormalUpdated]', (this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : ""));
             BABYLON.Effect.ShadersStore[name + "PixelShader"] = this.ShaderVersion.FragmentStore
                 .replace('#[Fragment_Begin]', (this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
                 .replace('#[Fragment_MainBegin]', (this.CustomParts.Fragment_MainBegin ? this.CustomParts.Fragment_MainBegin : ""))
-                .replace('#[Fragment_Definations]', (this._customUnifrom ? this._customUnifrom.join("\n") : "") + (this.CustomParts.Fragment_Definations ? this.CustomParts.Fragment_Definations : ""))
+                .replace('#[Fragment_Definitions]', (this._customUniform ? this._customUniform.join("\n") : "") + (this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
                 .replace('#[Fragment_Custom_Diffuse]', (this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : ""))
                 .replace('#[Fragment_Custom_Alpha]', (this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
                 .replace('#[Fragment_Before_FragColor]', (this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : ""));
@@ -602,30 +602,30 @@ vColor=color;\n\
             }
         };
         CustomMaterial.prototype.AddUniform = function (name, kind, param) {
-            if (!this._customUnifrom) {
-                this._customUnifrom = new Array();
-                this._newUnifroms = new Array();
+            if (!this._customUniform) {
+                this._customUniform = new Array();
+                this._newUniforms = new Array();
                 this._newSamplerInstances = new Array();
-                this._newUnifromInstances = new Array();
+                this._newUniformInstances = new Array();
             }
             if (param) {
                 if (kind.indexOf("sampler") == -1) {
-                    this._newUnifromInstances[kind + "-" + name] = param;
+                    this._newUniformInstances[kind + "-" + name] = param;
                 }
                 else {
                     this._newSamplerInstances[kind + "-" + name] = param;
                 }
             }
-            this._customUnifrom.push("uniform " + kind + " " + name + ";");
-            this._newUnifroms.push(name);
+            this._customUniform.push("uniform " + kind + " " + name + ";");
+            this._newUniforms.push(name);
             return this;
         };
         CustomMaterial.prototype.Fragment_Begin = function (shaderPart) {
             this.CustomParts.Fragment_Begin = shaderPart;
             return this;
         };
-        CustomMaterial.prototype.Fragment_Definations = function (shaderPart) {
-            this.CustomParts.Fragment_Definations = shaderPart;
+        CustomMaterial.prototype.Fragment_Definitions = function (shaderPart) {
+            this.CustomParts.Fragment_Definitions = shaderPart;
             return this;
         };
         CustomMaterial.prototype.Fragment_MainBegin = function (shaderPart) {
@@ -648,20 +648,20 @@ vColor=color;\n\
             this.CustomParts.Vertex_Begin = shaderPart;
             return this;
         };
-        CustomMaterial.prototype.Vertex_Definations = function (shaderPart) {
-            this.CustomParts.Vertex_Definations = shaderPart;
+        CustomMaterial.prototype.Vertex_Definitions = function (shaderPart) {
+            this.CustomParts.Vertex_Definitions = shaderPart;
             return this;
         };
         CustomMaterial.prototype.Vertex_MainBegin = function (shaderPart) {
             this.CustomParts.Vertex_MainBegin = shaderPart;
             return this;
         };
-        CustomMaterial.prototype.Vertex_Befor_PositionUpdated = function (shaderPart) {
-            this.CustomParts.Vertex_Befor_PositionUpdated = shaderPart.replace("result", "positionUpdated");
+        CustomMaterial.prototype.Vertex_Before_PositionUpdated = function (shaderPart) {
+            this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result", "positionUpdated");
             return this;
         };
-        CustomMaterial.prototype.Vertex_Befor_NormalUpdated = function (shaderPart) {
-            this.CustomParts.Vertex_Befor_NormalUpdated = shaderPart.replace("result", "normalUpdated");
+        CustomMaterial.prototype.Vertex_Before_NormalUpdated = function (shaderPart) {
+            this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result", "normalUpdated");
             return this;
         };
         return CustomMaterial;

文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


文件差异内容过多而无法显示
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


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

@@ -18,6 +18,7 @@
  - Multi-platform Compressed Textures for Desktops & Mobile Devices with fall back.  Batch (dos) scripts to convert entire directories of .jpg's & .png's [Doc](http://doc.babylonjs.com/tutorials/multi-platform_compressed_textures) ([jcpalmer](https://github.com/Palmer-JC))
  - All deprecated functions and properties were removed ([deltakosh](https://github.com/deltakosh))
  - New build system based on workloads. [More info here](http://doc.babylonjs.com/generals/how_to_start#custom-builds) ([deltakosh](https://github.com/deltakosh))
+ - New `Cell Shading` material added into `Materials Library` [Demo](http://www.babylonjs.com/Demos/CellShading/) - ([Julien Moreau-Mathis](https://github.com/julien-moreau))
 
 ### Updates
 - Added `FIXED_EQUIRECTANGULAR_MIRRORED_MODE` mode for reflection texture. [Demo here](http://www.babylonjs-playground.com/#11GAIH#22) ([deltakosh](https://github.com/deltakosh))
@@ -51,6 +52,7 @@
 - Added `material.twoSidedLighting` to PBRMaterial and StandardMaterial to enable flipping normals when backfaceCulling is false ([BeardedGnome](https://github.com/BeardedGnome), [bghgary](https://github.com/bghgary))
 - Added a [HTML page](https://github.com/BabylonJS/Babylon.js/blob/master/Tools/Gulp/profiling.html) with embedded directions to improve the custom build process. ([jcpalmer](https://github.com/Palmer-JC))
 - Added glTF 2.0 loader with versioning support ([bghgary](https://github.com/bghgary), thanks to [BeardedGnome](https://github.com/BeardedGnome) for animation updates)
+- New `Motion Blur` effect added into `StandardRenderingPipeline` [Demo](http://www.babylonjs.com/Demos/MotionBlur/) - ([Julien Moreau-Mathis](https://github.com/julien-moreau))
  
 ### Bug fixes
 - Fixed a bug with spotlight direction ([deltakosh](https://github.com/deltakosh)) 

+ 42 - 42
materialsLibrary/src/custom/babylon.customMaterial.ts

@@ -20,7 +20,7 @@ module BABYLON {
     constructor(){}
 
     public Fragment_Begin:string;
-    public Fragment_Definations:string;
+    public Fragment_Definitions:string;
     public Fragment_MainBegin: string;
     
     // diffuseColor
@@ -32,14 +32,14 @@ module BABYLON {
     public Fragment_Before_FragColor: string;
 
     public Vertex_Begin:string;
-    public Vertex_Definations:string;
+    public Vertex_Definitions:string;
     public Vertex_MainBegin: string;
     
     // positionUpdated
-    public Vertex_Befor_PositionUpdated:string;
+    public Vertex_Before_PositionUpdated:string;
 
     // normalUpdated
-    public Vertex_Befor_NormalUpdated : string;
+    public Vertex_Before_NormalUpdated : string;
   }
 
   export class ShaderForVer3_0 extends CustomShaderStructure {
@@ -138,7 +138,7 @@ varying vec3 vDirectionW;\n\
 #include<logDepthDeclaration>\n\
 #include<fogFragmentDeclaration>\n\
 \n\
-#[Fragment_Definations]\n\
+#[Fragment_Definitions]\n\
 \n\
 void main(void) {\n\
 \n\
@@ -413,7 +413,7 @@ varying vec3 vDirectionW;\n\
 #endif\n\
 #include<logDepthDeclaration>\n\
 \n\
-#[Vertex_Definations]\n\
+#[Vertex_Definitions]\n\
 \n\
 void main(void) {\n\
     \n\
@@ -433,14 +433,14 @@ vPositionUVW=positionUpdated;\n\
 #include<instancesVertex>\n\
 #include<bonesVertex>\n\
 \n\
-#[Vertex_Befor_PositionUpdated]\n\
+#[Vertex_Before_PositionUpdated]\n\
 \n\
 gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\n\
 vec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\
 vPositionW=vec3(worldPos);\n\
 #ifdef NORMAL\n\
 \n\
-#[Vertex_Befor_NormalUpdated]\n\
+#[Vertex_Before_NormalUpdated]\n\
 \n\
 vNormalW=normalize(vec3(finalWorld*vec4(normalUpdated,0.0)));\n\
 #endif\n\
@@ -552,19 +552,19 @@ vColor=color;\n\
          public static ShaderIndexer = 1;
          public CustomParts :  ShaderSpecialParts;
          public ShaderVersion : CustomShaderStructure ;
-         _customUnifrom : string[];
-         _newUnifroms : string[];
-         _newUnifromInstances : any[];
+         _customUniform : string[];
+         _newUniforms : string[];
+         _newUniformInstances : any[];
          _newSamplerInstances : Texture[];
 
          public AttachAfterBind(mesh:Mesh,effect:Effect){ 
-             for(var el in this._newUnifromInstances){
+             for(var el in this._newUniformInstances){
                  var ea = el.toString().split('-');
-                 if(ea[0] == 'vec2') effect.setVector2(ea[1],this._newUnifromInstances[el]);
-                 else if(ea[0] == 'vec3') effect.setVector3(ea[1],this._newUnifromInstances[el]);
-                 else if(ea[0] == 'vec4') effect.setVector4(ea[1],this._newUnifromInstances[el]);
-                 else if(ea[0] == 'mat4') effect.setMatrix(ea[1],this._newUnifromInstances[el]);
-                 else if(ea[0] == 'float') effect.setFloat(ea[1],this._newUnifromInstances[el]); 
+                 if(ea[0] == 'vec2') effect.setVector2(ea[1],this._newUniformInstances[el]);
+                 else if(ea[0] == 'vec3') effect.setVector3(ea[1],this._newUniformInstances[el]);
+                 else if(ea[0] == 'vec4') effect.setVector4(ea[1],this._newUniformInstances[el]);
+                 else if(ea[0] == 'mat4') effect.setMatrix(ea[1],this._newUniformInstances[el]);
+                 else if(ea[0] == 'float') effect.setFloat(ea[1],this._newUniformInstances[el]); 
              }
 
               for(var el in this._newSamplerInstances){ 
@@ -577,16 +577,16 @@ vColor=color;\n\
          public ReviewUniform(name:string, arr : string[] ) : string[]{
              if(name == "uniform")
               {
-                  for(var ind in this._newUnifroms)
-                    if(this._customUnifrom[ind].indexOf('sampler')== -1) 
-                        arr.push(this._newUnifroms[ind]);
+                  for(var ind in this._newUniforms)
+                    if(this._customUniform[ind].indexOf('sampler')== -1) 
+                        arr.push(this._newUniforms[ind]);
               }
 
                  if(name == "sampler")
               {
-                   for(var ind in this._newUnifroms)
-                    if(this._customUnifrom[ind].indexOf('sampler')!= -1) 
-                        arr.push(this._newUnifroms[ind]);
+                   for(var ind in this._newUniforms)
+                    if(this._customUniform[ind].indexOf('sampler')!= -1) 
+                        arr.push(this._newUniforms[ind]);
               }
 
              return arr;
@@ -608,15 +608,15 @@ vColor=color;\n\
 
             BABYLON.Effect.ShadersStore[name+"VertexShader"] = this.ShaderVersion.VertexStore
             .replace('#[Vertex_Begin]',(this.CustomParts.Vertex_Begin ? this.CustomParts.Vertex_Begin : ""))
-            .replace('#[Vertex_Definations]',(this._customUnifrom? this._customUnifrom.join("\n"):"")+ (this.CustomParts.Vertex_Definations ? this.CustomParts.Vertex_Definations : ""))
+            .replace('#[Vertex_Definitions]',(this._customUniform? this._customUniform.join("\n"):"")+ (this.CustomParts.Vertex_Definitions ? this.CustomParts.Vertex_Definitions : ""))
             .replace('#[Vertex_MainBegin]',(this.CustomParts.Vertex_MainBegin ? this.CustomParts.Vertex_MainBegin : ""))
-            .replace('#[Vertex_Befor_PositionUpdated]',(this.CustomParts.Vertex_Befor_PositionUpdated ? this.CustomParts.Vertex_Befor_PositionUpdated : ""))
-            .replace('#[Vertex_Befor_NormalUpdated]',(this.CustomParts.Vertex_Befor_NormalUpdated ? this.CustomParts.Vertex_Befor_NormalUpdated : "")) ;
+            .replace('#[Vertex_Before_PositionUpdated]',(this.CustomParts.Vertex_Before_PositionUpdated ? this.CustomParts.Vertex_Before_PositionUpdated : ""))
+            .replace('#[Vertex_Before_NormalUpdated]',(this.CustomParts.Vertex_Before_NormalUpdated ? this.CustomParts.Vertex_Before_NormalUpdated : "")) ;
 
             BABYLON.Effect.ShadersStore[name+"PixelShader"] = this.ShaderVersion.FragmentStore
             .replace('#[Fragment_Begin]',(this.CustomParts.Fragment_Begin ? this.CustomParts.Fragment_Begin : ""))
             .replace('#[Fragment_MainBegin]',(this.CustomParts.Fragment_MainBegin  ? this.CustomParts.Fragment_MainBegin : ""))
-            .replace('#[Fragment_Definations]',(this._customUnifrom? this._customUnifrom.join("\n"):"")+(this.CustomParts.Fragment_Definations ? this.CustomParts.Fragment_Definations : ""))
+            .replace('#[Fragment_Definitions]',(this._customUniform? this._customUniform.join("\n"):"")+(this.CustomParts.Fragment_Definitions ? this.CustomParts.Fragment_Definitions : ""))
             .replace('#[Fragment_Custom_Diffuse]',(this.CustomParts.Fragment_Custom_Diffuse ? this.CustomParts.Fragment_Custom_Diffuse : ""))
             .replace('#[Fragment_Custom_Alpha]',(this.CustomParts.Fragment_Custom_Alpha ? this.CustomParts.Fragment_Custom_Alpha : ""))
             .replace('#[Fragment_Before_FragColor]',(this.CustomParts.Fragment_Before_FragColor ? this.CustomParts.Fragment_Before_FragColor : "")) ;
@@ -639,24 +639,24 @@ vColor=color;\n\
             this.SelectVersion("3.0.0"); 
          } 
          public AddUniform(name:string,kind:string,param:any):CustomMaterial{
-             if(!this._customUnifrom)
+             if(!this._customUniform)
               {  
-                  this._customUnifrom = new Array();
-                  this._newUnifroms = new Array();
+                  this._customUniform = new Array();
+                  this._newUniforms = new Array();
                   this._newSamplerInstances = new Array();
-                  this._newUnifromInstances = new Array();
+                  this._newUniformInstances = new Array();
               }
               if(param){
               if(kind.indexOf("sampler") == -1) {
-                    this._newUnifromInstances[kind+"-"+name] = param;
+                    this._newUniformInstances[kind+"-"+name] = param;
               }
               else{
                   this._newSamplerInstances[kind+"-"+name] = param;
               }
              }
 
-            this._customUnifrom.push("uniform "+kind+" "+name+";");
-            this._newUnifroms.push(name);
+            this._customUniform.push("uniform "+kind+" "+name+";");
+            this._newUniforms.push(name);
              
             return this;
          }
@@ -665,8 +665,8 @@ vColor=color;\n\
             return this;
          }
 
-         public Fragment_Definations(shaderPart:string):CustomMaterial{            
-            this.CustomParts.Fragment_Definations = shaderPart;
+         public Fragment_Definitions(shaderPart:string):CustomMaterial{            
+            this.CustomParts.Fragment_Definitions = shaderPart;
             return this;
          }
 
@@ -690,21 +690,21 @@ vColor=color;\n\
             this.CustomParts.Vertex_Begin = shaderPart;
             return this;
          }
-         public Vertex_Definations(shaderPart:string):CustomMaterial{            
-            this.CustomParts.Vertex_Definations = shaderPart;
+         public Vertex_Definitions(shaderPart:string):CustomMaterial{            
+            this.CustomParts.Vertex_Definitions = shaderPart;
             return this;
          }
          public Vertex_MainBegin(shaderPart:string):CustomMaterial{            
             this.CustomParts.Vertex_MainBegin = shaderPart;
             return this;
          }
-         public Vertex_Befor_PositionUpdated(shaderPart:string):CustomMaterial{            
-            this.CustomParts.Vertex_Befor_PositionUpdated = shaderPart.replace("result","positionUpdated");
+         public Vertex_Before_PositionUpdated(shaderPart:string):CustomMaterial{            
+            this.CustomParts.Vertex_Before_PositionUpdated = shaderPart.replace("result","positionUpdated");
             return this;
          } 
          
-          public Vertex_Befor_NormalUpdated(shaderPart:string):CustomMaterial{            
-            this.CustomParts.Vertex_Befor_NormalUpdated = shaderPart.replace("result","normalUpdated");
+          public Vertex_Before_NormalUpdated(shaderPart:string):CustomMaterial{            
+            this.CustomParts.Vertex_Before_NormalUpdated = shaderPart.replace("result","normalUpdated");
             return this;
          } 
           

+ 3 - 3
materialsLibrary/src/custom/readme.md

@@ -56,10 +56,10 @@ method : Fragment_MainBegin(shaderPart:string):CustomMaterial
 > shaderPart is Shader Structure append in start place of the main function in fragment shader 
 
 
-method : Fragment_Custom_Deffiuse(shaderPart:string):CustomMaterial 
+method : Fragment_Custom_Diffuse(shaderPart:string):CustomMaterial 
 > shaderPart is Shader Structure append after diffuseColor is defined of the main function in fragment shader </br>
-> usage : new CustomMaterial(...).Fragment_Custom_Deffiuse('diffuseColor = vec3(sin(vPositionW.x));')  </br>
->       : new CustomMaterial(...).Fragment_Custom_Deffiuse('result = vec3(sin(vPositionW.x));')  </br>
+> usage : new CustomMaterial(...).Fragment_Custom_Diffuse('diffuseColor = vec3(sin(vPositionW.x));')  </br>
+>       : new CustomMaterial(...).Fragment_Custom_Diffuse('result = vec3(sin(vPositionW.x));')  </br>
 > * diffuseColor is vec3 variable </br>
 > * you can use result (vec3) too that replaced by diffuseColor
 

+ 14 - 4
src/Audio/babylon.audioEngine.ts

@@ -28,12 +28,22 @@
 
             var audioElem = document.createElement('audio');
 
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
-                this.isMP3supported = true;
+            try {
+                if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/, '')) {
+                    this.isMP3supported = true;
+                }
+            }
+            catch (e) {
+                // protect error during capability check.
             }
 
-            if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
-                this.isOGGsupported = true;
+            try {
+                if (audioElem && !!audioElem.canPlayType && audioElem.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, '')) {
+                    this.isOGGsupported = true;
+                }
+            }
+            catch (e) {
+                // protect error during capability check.
             }
 
             if (/iPad|iPhone|iPod/.test(navigator.platform)) {

+ 0 - 10
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -24,8 +24,6 @@ module BABYLON {
 
         private _pointerInput: (p: PointerInfo, s: EventState) => void;
         private _observer: Observer<PointerInfo>;
-        private _onKeyDown: (e: KeyboardEvent) => any;
-        private _onKeyUp: (e: KeyboardEvent) => any;
         private _onMouseMove: (e: MouseEvent) => any;
         private _onGestureStart: (e: PointerEvent) => void;
         private _onGesture: (e: MSGestureEvent) => void;
@@ -202,9 +200,6 @@ module BABYLON {
             element.addEventListener("MSPointerDown", this._onGestureStart, false);
             element.addEventListener("MSGestureChange", this._onGesture, false);
 
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
-
             Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
@@ -220,14 +215,9 @@ module BABYLON {
                 element.removeEventListener("MSPointerDown", this._onGestureStart);
                 element.removeEventListener("MSGestureChange", this._onGesture);
 
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
-
                 this._isPanClick = false;
                 this.pinchInwards = true;
 
-                this._onKeyDown = null;
-                this._onKeyUp = null;
                 this._onMouseMove = null;
                 this._onGestureStart = null;
                 this._onGesture = null;

+ 8 - 2
src/Lights/babylon.light.ts

@@ -222,11 +222,11 @@
                 return true;
             }
 
-            if (this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
+            if (this.includedOnlyMeshes && this.includedOnlyMeshes.length > 0 && this.includedOnlyMeshes.indexOf(mesh) === -1) {
                 return false;
             }
 
-            if (this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
+            if (this.excludedMeshes && this.excludedMeshes.length > 0 && this.excludedMeshes.indexOf(mesh) !== -1) {
                 return false;
             }
 
@@ -414,6 +414,10 @@
 
                 return deleted;
             }
+
+            for (var item of array) {
+                item._resyncLighSource(this);
+            }
         }
 
         private _hookArrayForIncludedOnly(array: AbstractMesh[]): void {
@@ -434,6 +438,8 @@
 
                 return deleted;
             }
+
+            this._resyncMeshes();
         }
 
         private _resyncMeshes() {

+ 5 - 5
src/Materials/babylon.material.ts

@@ -170,11 +170,11 @@
             return Material._CounterClockWiseSideOrientation;
         }
 
-        private static _TextureDirtyFlag = 0;
-        private static _LightDirtyFlag = 1;
-        private static _FresnelDirtyFlag = 2;
-        private static _AttributesDirtyFlag = 4;
-        private static _MiscDirtyFlag = 8;
+        private static _TextureDirtyFlag = 1;
+        private static _LightDirtyFlag = 2;
+        private static _FresnelDirtyFlag = 4;
+        private static _AttributesDirtyFlag = 8;
+        private static _MiscDirtyFlag = 16;
 
         public static get TextureDirtyFlag(): number {
             return Material._TextureDirtyFlag;

+ 2 - 2
src/Materials/babylon.pbrMaterial.ts

@@ -554,11 +554,11 @@
             this.getRenderTargetTextures = (): SmartArray<RenderTargetTexture> => {
                 this._renderTargets.reset();
 
-                if (this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
+                if (StandardMaterial.ReflectionTextureEnabled && this.reflectionTexture && this.reflectionTexture.isRenderTarget) {
                     this._renderTargets.push(this.reflectionTexture);
                 }
 
-                if (this.refractionTexture && this.refractionTexture.isRenderTarget) {
+                if (StandardMaterial.RefractionTextureEnabled && this.refractionTexture && this.refractionTexture.isRenderTarget) {
                     this._renderTargets.push(this.refractionTexture);
                 }
 

+ 2 - 2
src/Materials/babylon.standardMaterial.ts

@@ -303,11 +303,11 @@ module BABYLON {
             this.getRenderTargetTextures = (): SmartArray<RenderTargetTexture> => {
                 this._renderTargets.reset();
 
-                if (this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
+                if (StandardMaterial.ReflectionTextureEnabled && this._reflectionTexture && this._reflectionTexture.isRenderTarget) {
                     this._renderTargets.push(this._reflectionTexture);
                 }
 
-                if (this._refractionTexture && this._refractionTexture.isRenderTarget) {
+                if (StandardMaterial.RefractionTextureEnabled && this._refractionTexture && this._refractionTexture.isRenderTarget) {
                     this._renderTargets.push(this._refractionTexture);
                 }
 

+ 24 - 16
src/Mesh/babylon.geometry.ts

@@ -24,8 +24,8 @@
         private _vertexArrayObjects: { [key: string]: WebGLVertexArrayObject; };
 
         /**
-         *  The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y 
-         * @returns The Bias Vector 
+         *  The Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
+         * @returns The Bias Vector
          */
         public get boundingBias(): Vector2 {
             return this._boundingBias;
@@ -208,7 +208,7 @@
             }
         }
 
-        public _bind(effect: Effect, indexToBind: WebGLBuffer = undefined): void {  
+        public _bind(effect: Effect, indexToBind: WebGLBuffer = undefined): void {
             if (indexToBind === undefined) {
                 indexToBind = this._indexBuffer;
             }
@@ -352,7 +352,7 @@
             if (!effect || !this._vertexArrayObjects) {
                 return;
             }
-            
+
             if (this._vertexArrayObjects[effect.key]) {
                 this._engine.releaseVertexArrayObject(this._vertexArrayObjects[effect.key]);
                 delete this._vertexArrayObjects[effect.key];
@@ -635,74 +635,82 @@
             return serializationObject;
         }
 
+        private toNumberArray(origin: Float32Array | IndicesArray) : number[] {
+            if (Array.isArray(origin)) {
+                return origin;
+            } else {
+                return Array.prototype.slice.call(origin);
+            }
+        }
+
         public serializeVerticeData(): any {
             var serializationObject = this.serialize();
 
             if (this.isVerticesDataPresent(VertexBuffer.PositionKind)) {
-                serializationObject.positions = this.getVerticesData(VertexBuffer.PositionKind);
+                serializationObject.positions = this.toNumberArray(this.getVerticesData(VertexBuffer.PositionKind));
                 if (this.getVertexBuffer(VertexBuffer.PositionKind).isUpdatable) {
                     serializationObject.positions._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.NormalKind)) {
-                serializationObject.normals = this.getVerticesData(VertexBuffer.NormalKind);
+                serializationObject.normals = this.toNumberArray(this.getVerticesData(VertexBuffer.NormalKind));
                 if (this.getVertexBuffer(VertexBuffer.NormalKind).isUpdatable) {
                     serializationObject.normals._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UVKind)) {
-                serializationObject.uvs = this.getVerticesData(VertexBuffer.UVKind);
+                serializationObject.uvs = this.toNumberArray(this.getVerticesData(VertexBuffer.UVKind));
                 if (this.getVertexBuffer(VertexBuffer.UVKind).isUpdatable) {
                     serializationObject.uvs._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UV2Kind)) {
-                serializationObject.uv2s = this.getVerticesData(VertexBuffer.UV2Kind);
+                serializationObject.uv2s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV2Kind));
                 if (this.getVertexBuffer(VertexBuffer.UV2Kind).isUpdatable) {
                     serializationObject.uv2s._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UV3Kind)) {
-                serializationObject.uv3s = this.getVerticesData(VertexBuffer.UV3Kind);
+                serializationObject.uv3s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV3Kind));
                 if (this.getVertexBuffer(VertexBuffer.UV3Kind).isUpdatable) {
                     serializationObject.uv3s._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UV4Kind)) {
-                serializationObject.uv4s = this.getVerticesData(VertexBuffer.UV4Kind);
+                serializationObject.uv4s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV4Kind));
                 if (this.getVertexBuffer(VertexBuffer.UV4Kind).isUpdatable) {
                     serializationObject.uv4s._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UV5Kind)) {
-                serializationObject.uv5s = this.getVerticesData(VertexBuffer.UV5Kind);
+                serializationObject.uv5s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV5Kind));
                 if (this.getVertexBuffer(VertexBuffer.UV5Kind).isUpdatable) {
                     serializationObject.uv5s._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.UV6Kind)) {
-                serializationObject.uv6s = this.getVerticesData(VertexBuffer.UV6Kind);
+                serializationObject.uv6s = this.toNumberArray(this.getVerticesData(VertexBuffer.UV6Kind));
                 if (this.getVertexBuffer(VertexBuffer.UV6Kind).isUpdatable) {
                     serializationObject.uv6s._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.ColorKind)) {
-                serializationObject.colors = this.getVerticesData(VertexBuffer.ColorKind);
+                serializationObject.colors = this.toNumberArray(this.getVerticesData(VertexBuffer.ColorKind));
                 if (this.getVertexBuffer(VertexBuffer.ColorKind).isUpdatable) {
                     serializationObject.colors._updatable = true;
                 }
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.MatricesIndicesKind)) {
-                serializationObject.matricesIndices = this.getVerticesData(VertexBuffer.MatricesIndicesKind);
+                serializationObject.matricesIndices = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesIndicesKind));
                 serializationObject.matricesIndices._isExpanded = true;
                 if (this.getVertexBuffer(VertexBuffer.MatricesIndicesKind).isUpdatable) {
                     serializationObject.matricesIndices._updatable = true;
@@ -710,13 +718,13 @@
             }
 
             if (this.isVerticesDataPresent(VertexBuffer.MatricesWeightsKind)) {
-                serializationObject.matricesWeights = this.getVerticesData(VertexBuffer.MatricesWeightsKind);
+                serializationObject.matricesWeights = this.toNumberArray(this.getVerticesData(VertexBuffer.MatricesWeightsKind));
                 if (this.getVertexBuffer(VertexBuffer.MatricesWeightsKind).isUpdatable) {
                     serializationObject.matricesWeights._updatable = true;
                 }
             }
 
-            serializationObject.indices = this.getIndices();
+            serializationObject.indices = this.toNumberArray(this.getIndices());
 
             return serializationObject;
         }

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

@@ -2998,7 +2998,7 @@
             for (index = 0; index < meshes.length; index++) {
                 if (meshes[index]) {
                     meshes[index].computeWorldMatrix(true);
-                    otherVertexData = VertexData.ExtractFromMesh(meshes[index], false, true);
+                    otherVertexData = VertexData.ExtractFromMesh(meshes[index], true);
                     otherVertexData.transform(meshes[index].getWorldMatrix());
 
                     if (vertexData) {