Переглянути джерело

Merge https://github.com/BabylonJS/Babylon.js into postProcessCausingFlicker

Trevor Baron 7 роки тому
батько
коміт
9a1d708140
63 змінених файлів з 38040 додано та 37879 видалено
  1. 13458 13447
      Playground/babylon.d.txt
  2. 1 1
      Tools/Gulp/gulp-addDtsExport.js
  3. 7 7
      Tools/Gulp/package.json
  4. 3 1
      Tools/Publisher/index.js
  5. 13862 13851
      dist/preview release/babylon.d.ts
  6. 49 49
      dist/preview release/babylon.js
  7. 37 12
      dist/preview release/babylon.max.js
  8. 50 50
      dist/preview release/babylon.worker.js
  9. 10150 10139
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  10. 50 50
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  11. 20 10
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  12. 18 6
      dist/preview release/customConfigurations/minimalGLTFViewer/es6.js
  13. 35 8
      dist/preview release/es6.js
  14. 1 1
      dist/preview release/gltf2Interface/package.json
  15. 5 7
      dist/preview release/gui/babylon.gui.js
  16. 3 3
      dist/preview release/gui/babylon.gui.min.js
  17. 1 1
      dist/preview release/gui/package.json
  18. 4 4
      dist/preview release/inspector/babylon.inspector.bundle.js
  19. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  20. 1 1
      dist/preview release/inspector/package.json
  21. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  22. 2 2
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  23. 3 3
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  24. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  25. 3 5
      dist/preview release/loaders/babylonjs.loaders.js
  26. 3 3
      dist/preview release/loaders/babylonjs.loaders.min.js
  27. 2 2
      dist/preview release/loaders/package.json
  28. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  29. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  30. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  31. 3 5
      dist/preview release/materialsLibrary/babylonjs.materials.js
  32. 3 3
      dist/preview release/materialsLibrary/babylonjs.materials.min.js
  33. 1 1
      dist/preview release/materialsLibrary/package.json
  34. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  35. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  36. 3 5
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.js
  37. 1 1
      dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js
  38. 1 1
      dist/preview release/postProcessesLibrary/package.json
  39. 3 5
      dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.js
  40. 1 1
      dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js
  41. 1 1
      dist/preview release/proceduralTexturesLibrary/package.json
  42. 1 1
      dist/preview release/serializers/babylon.glTF2Serializer.min.js
  43. 3 5
      dist/preview release/serializers/babylonjs.serializers.js
  44. 1 1
      dist/preview release/serializers/babylonjs.serializers.min.js
  45. 2 2
      dist/preview release/serializers/package.json
  46. 67 67
      dist/preview release/viewer/babylon.viewer.js
  47. 46 25
      dist/preview release/viewer/babylon.viewer.max.js
  48. 1 1
      dist/preview release/viewer/package.json
  49. 1 1
      package.json
  50. 3 3
      src/Debug/babylon.debugModules.ts
  51. 2 1
      src/Engine/babylon.engine.ts
  52. 19 7
      src/Helpers/babylon.videoDome.ts
  53. 5 5
      src/Materials/Textures/babylon.cubeTexture.ts
  54. 3 3
      src/Materials/Textures/babylon.hdrCubeTexture.ts
  55. 2 1
      src/Materials/Textures/babylon.videoTexture.ts
  56. 35 35
      src/Math/babylon.math.ts
  57. 2 1
      src/Particles/babylon.IParticleSystem.ts
  58. 8 2
      src/Particles/babylon.gpuParticleSystem.ts
  59. 4 3
      src/Particles/babylon.particleSystem.ts
  60. 3 3
      src/Probes/babylon.reflectionProbe.ts
  61. 14 9
      src/Shaders/ShadersInclude/reflectionFunction.fx
  62. 22 6
      src/babylon.scene.ts
  63. BIN
      tests/validation/ReferenceImages/refprobe.png

Різницю між файлами не показано, бо вона завелика
+ 13458 - 13447
Playground/babylon.d.txt


+ 1 - 1
Tools/Gulp/gulp-addDtsExport.js

@@ -6,7 +6,7 @@ module.exports = function (varName, moduleName, subModule, extendsRoot, dependen
 
         let exportText = "BABYLON";
         if (subModule && !extendsRoot) {
-            exportText += '.' + varName;
+            exportText += '.' + varName.name;
         }
 
         let referenceText = '';

+ 7 - 7
Tools/Gulp/package.json

@@ -9,21 +9,21 @@
     "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
     "license": "(Apache-2.0)",
     "devDependencies": {
-        "@types/node": "^8.5.0",
+        "@types/node": "^8.9.4",
         "base64-image-loader": "^1.2.1",
         "chai": "^4.1.2",
         "color-support": "^1.1.3",
         "css-loader": "^0.25.0",
         "deepmerge": "^2.0.1",
         "del": "2.2.2",
-        "es6-promise": "^4.1.1",
+        "es6-promise": "^4.2.4",
         "exports-loader": "^0.6.4",
         "gulp": "^3.8.11",
         "gulp-changed-in-place": "2.0.3",
         "gulp-clean-ts-extends": "~0.1.1",
         "gulp-concat": "~2.5.2",
         "gulp-content-to-variable": "^0.1.0",
-        "gulp-debug": "^3.0.0",
+        "gulp-debug": "^3.2.0",
         "gulp-expect-file": "^0.0.7",
         "gulp-optimize-js": "^1.0.2",
         "gulp-rename": "~1.2.2",
@@ -31,12 +31,12 @@
         "gulp-sass": "3.1.0",
         "gulp-sourcemaps": "~1.9.1",
         "gulp-typedoc": "^2.1.2",
-        "gulp-typescript": "^3.2.3",
+        "gulp-typescript": "^3.2.4",
         "gulp-uglify": "^2.1.2",
         "gulp-util": "~3.0.4",
         "gulp-webserver": "^0.9.1",
         "handlebars": "^4.0.11",
-        "html-loader": "^0.5.1",
+        "html-loader": "^0.5.5",
         "imports-loader": "^0.7.1",
         "json-loader": "^0.5.7",
         "karma": "^2.0.0",
@@ -52,13 +52,13 @@
         "mocha": "^4.0.1",
         "phantomjs": "^2.1.7",
         "run-sequence": "~1.1.0",
-        "sinon": "^4.1.3",
+        "sinon": "^4.3.0",
         "style-loader": "^0.13.2",
         "through2": "~0.6.5",
         "ts-loader": "^2.3.7",
         "typedoc": "^0.9.0",
         "typescript": "~2.6.2",
-        "webpack-stream": "^4.0.0"
+        "webpack-stream": "^4.0.1"
     },
     "scripts": {
         "install": "npm --prefix ../../Playground/ install ../../Playground/ && npm --prefix ../../tests/unit/ install ../../tests/unit/ && gulp deployLocalDev"

+ 3 - 1
Tools/Publisher/index.js

@@ -100,7 +100,9 @@ if (loginCheck.code === 0) {
     prompt.get(['version'], function (err, result) {
         let version = result.version;
         updateEngineVersion(version);
-        runGulp();
+        if (process.argv.indexOf('--no-build') === -1) {
+            runGulp();
+        }
         processPackages(version);
 
         console.log("done, please tag git with " + version);

Різницю між файлами не показано, бо вона завелика
+ 13862 - 13851
dist/preview release/babylon.d.ts


Різницю між файлами не показано, бо вона завелика
+ 49 - 49
dist/preview release/babylon.js


Різницю між файлами не показано, бо вона завелика
+ 37 - 12
dist/preview release/babylon.max.js


Різницю між файлами не показано, бо вона завелика
+ 50 - 50
dist/preview release/babylon.worker.js


Різницю між файлами не показано, бо вона завелика
+ 10150 - 10139
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Різницю між файлами не показано, бо вона завелика
+ 50 - 50
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


Різницю між файлами не показано, бо вона завелика
+ 20 - 10
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js


Різницю між файлами не показано, бо вона завелика
+ 18 - 6
dist/preview release/customConfigurations/minimalGLTFViewer/es6.js


Різницю між файлами не показано, бо вона завелика
+ 35 - 8
dist/preview release/es6.js


+ 1 - 1
dist/preview release/gltf2Interface/package.json

@@ -1,7 +1,7 @@
 {
     "name": "babylonjs-gltf2interface",
     "description": "A typescript declaration of babylon's gltf2 inteface.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 5 - 7
dist/preview release/gui/babylon.gui.js

@@ -5005,19 +5005,17 @@ var BABYLON;
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["GUI"], factory);
+        define("babylonjs-gui", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["GUI"] = f;
+        exports["babylonjs-gui"] = f;
     else {
-        root["BABYLON"]["GUI"] = f;
+        root["BABYLON"]["[object Object]"] = f;
     }
 })(this, function() {
-    return BABYLON.GUI;
+    return BABYLON.undefined;
 });

Різницю між файлами не показано, бо вона завелика
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


+ 1 - 1
dist/preview release/gui/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-gui",
     "description": "The Babylon.js GUI library is an extension you can use to generate interactive user interface. It is build on top of the DynamicTexture.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

Різницю між файлами не показано, бо вона завелика
+ 4 - 4
dist/preview release/inspector/babylon.inspector.bundle.js


Різницю між файлами не показано, бо вона завелика
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


+ 1 - 1
dist/preview release/inspector/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-inspector",
     "description": "The Babylon.js inspector.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

Різницю між файлами не показано, бо вона завелика
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Різницю між файлами не показано, бо вона завелика
+ 2 - 2
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Різницю між файлами не показано, бо вона завелика
+ 3 - 3
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 3 - 5
dist/preview release/loaders/babylonjs.loaders.js

@@ -5460,16 +5460,14 @@ var BABYLON;
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["BJSLoaders"], factory);
+        define("babylonjs-loaders", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["BJSLoaders"] = f;
+        exports["babylonjs-loaders"] = f;
     else {
         root["BABYLON"] = f;
     }

Різницю між файлами не показано, бо вона завелика
+ 3 - 3
dist/preview release/loaders/babylonjs.loaders.min.js


+ 2 - 2
dist/preview release/loaders/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-loaders",
     "description": "The Babylon.js file loaders library is an extension you can use to load different 3D file types into a Babylon scene.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -27,7 +27,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs-gltf2interface": "^3.2.0-alpha8"
+        "babylonjs-gltf2interface": "3.2.0-alpha10"
     },
     "peerDependencies": {
         "babylonjs": ">=3.2.0-alpha"

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


+ 3 - 5
dist/preview release/materialsLibrary/babylonjs.materials.js

@@ -6348,16 +6348,14 @@ BABYLON.Effect.ShadersStore['cellPixelShader'] = "precision highp float;\n\nunif
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["BJSMaterials"], factory);
+        define("babylonjs-materials", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["BJSMaterials"] = f;
+        exports["babylonjs-materials"] = f;
     else {
         root["BABYLON"] = f;
     }

Різницю між файлами не показано, бо вона завелика
+ 3 - 3
dist/preview release/materialsLibrary/babylonjs.materials.min.js


+ 1 - 1
dist/preview release/materialsLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-materials",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


+ 3 - 5
dist/preview release/postProcessesLibrary/babylonjs.postProcess.js

@@ -447,16 +447,14 @@ BABYLON.Effect.ShadersStore['digitalrainPixelShader'] = "\nvarying vec2 vUV;\nun
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["BJSPostProcess"], factory);
+        define("babylonjs-post-process", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["BJSPostProcess"] = f;
+        exports["babylonjs-post-process"] = f;
     else {
         root["BABYLON"] = f;
     }

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/postProcessesLibrary/babylonjs.postProcess.min.js


+ 1 - 1
dist/preview release/postProcessesLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-post-process",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 3 - 5
dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.js

@@ -748,16 +748,14 @@ BABYLON.Effect.ShadersStore['perlinNoiseProceduralTexturePixelShader'] = "\nprec
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["BJSProceduralTextures"], factory);
+        define("babylonjs-procedural-textures", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["BJSProceduralTextures"] = f;
+        exports["babylonjs-procedural-textures"] = f;
     else {
         root["BABYLON"] = f;
     }

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/proceduralTexturesLibrary/babylonjs.proceduralTextures.min.js


+ 1 - 1
dist/preview release/proceduralTexturesLibrary/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-procedural-textures",
     "description": "The Babylon.js materials library is a collection of advanced materials to be used in a Babylon.js scene.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/serializers/babylon.glTF2Serializer.min.js


+ 3 - 5
dist/preview release/serializers/babylonjs.serializers.js

@@ -1295,16 +1295,14 @@ var BABYLON;
 
 (function universalModuleDefinition(root, factory) {
                 var f = factory();
-                if (root && root["BABYLON"]) {
-                    return;
-                }
+                
                 
     if(typeof exports === 'object' && typeof module === 'object')
         module.exports = f;
     else if(typeof define === 'function' && define.amd)
-        define(["BJSSerializers"], factory);
+        define("babylonjs-serializers", ["BABYLON"], factory);
     else if(typeof exports === 'object')
-        exports["BJSSerializers"] = f;
+        exports["babylonjs-serializers"] = f;
     else {
         root["BABYLON"] = f;
     }

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/serializers/babylonjs.serializers.min.js


+ 2 - 2
dist/preview release/serializers/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-serializers",
     "description": "The Babylon.js serializers library is an extension you can use to serialize Babylon scenes.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"
@@ -27,7 +27,7 @@
     ],
     "license": "Apache-2.0",
     "dependencies": {
-        "babylonjs-gltf2interface": "^3.2.0-alpha8"
+        "babylonjs-gltf2interface": "3.2.0-alpha10"
     },
     "peerDependencies": {
         "babylonjs": ">=3.2.0-alpha"

Різницю між файлами не показано, бо вона завелика
+ 67 - 67
dist/preview release/viewer/babylon.viewer.js


Різницю між файлами не показано, бо вона завелика
+ 46 - 25
dist/preview release/viewer/babylon.viewer.max.js


+ 1 - 1
dist/preview release/viewer/package.json

@@ -4,7 +4,7 @@
     },
     "name": "babylonjs-viewer",
     "description": "A simple-to-use viewer based on BabylonJS to display 3D elements natively",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 1 - 1
package.json

@@ -9,7 +9,7 @@
     ],
     "name": "babylonjs",
     "description": "Babylon.js is a JavaScript 3D engine based on webgl.",
-    "version": "3.2.0-alpha8",
+    "version": "3.2.0-alpha10",
     "repository": {
         "type": "git",
         "url": "https://github.com/BabylonJS/Babylon.js.git"

+ 3 - 3
src/Debug/babylon.debugModules.ts

@@ -368,7 +368,7 @@ module BABYLON {
 
                 if (x !== 0 || y !== 0 || z !== 0) {
                     var tmat2 = Tmp.Matrix[1];
-                    BABYLON.Matrix.IdentityToRef(tmat2);
+                    Matrix.IdentityToRef(tmat2);
                     tmat2.m[12] = x;
                     tmat2.m[13] = y;
                     tmat2.m[14] = z;
@@ -438,10 +438,10 @@ module BABYLON {
                 }
 
                 if (!this._debugMesh) {
-                    this._debugMesh = BABYLON.MeshBuilder.CreateLineSystem("", { lines: this._debugLines, updatable: true, instance: null }, this._scene);
+                    this._debugMesh = MeshBuilder.CreateLineSystem("", { lines: this._debugLines, updatable: true, instance: null }, this._scene);
                     this._debugMesh.renderingGroupId = this.renderingGroupId;
                 } else {
-                    BABYLON.MeshBuilder.CreateLineSystem("", { lines: this._debugLines, updatable: true, instance: this._debugMesh }, this._scene);
+                    MeshBuilder.CreateLineSystem("", { lines: this._debugLines, updatable: true, instance: this._debugMesh }, this._scene);
                 }
                 this._debugMesh.position.copyFrom(this.mesh.position);
                 this._debugMesh.color = this.color;

+ 2 - 1
src/Engine/babylon.engine.ts

@@ -297,6 +297,7 @@
             { key: "Firefox/59", capture: null, captureConstraint: null, targets: ["uniformBuffer"] },
             { key: "Macintosh", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] },
             { key: "iPhone", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] },
+            { key: "iPad", capture: null, captureConstraint: null, targets: ["textureBindingOptimization"] }
         ];
 
         public static Instances = new Array<Engine>();
@@ -585,7 +586,7 @@
         }
 
         public static get Version(): string {
-            return "3.2.0-alpha8";
+            return "3.2.0-alpha10";
         }
 
         // Updatable statics so stick with vars here

+ 19 - 7
src/Helpers/babylon.videoDome.ts

@@ -62,18 +62,18 @@ module BABYLON {
             options.size = Math.abs(options.size as any) || (scene.activeCamera ? scene.activeCamera.maxZ * 0.48 : 1000);
 
             // create
-            let tempOptions:VideoTextureSettings = {loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true};
-            let material = this._material = new BABYLON.BackgroundMaterial(name+"_material", scene);
-            let texture = this._videoTexture = new BABYLON.VideoTexture(name+"_texture", urlsOrVideo, scene, false, false, Texture.TRILINEAR_SAMPLINGMODE, tempOptions);
-            this._mesh = BABYLON.MeshBuilder.CreateIcoSphere(name+"_mesh", {
+            let tempOptions: VideoTextureSettings = { loop: options.loop, autoPlay: options.autoPlay, autoUpdateTexture: true };
+            let material = this._material = new BackgroundMaterial(name + "_material", scene);
+            let texture = this._videoTexture = new VideoTexture(name + "_texture", urlsOrVideo, scene, false, false, Texture.TRILINEAR_SAMPLINGMODE, tempOptions);
+            this._mesh = MeshBuilder.CreateIcoSphere(name + "_mesh", {
                 flat: false, // saves on vertex data
                 radius: options.size,
                 subdivisions: options.resolution,
-                sideOrientation: BABYLON.Mesh.BACKSIDE // needs to be inside out
+                sideOrientation: Mesh.BACKSIDE // needs to be inside out
             }, scene);
 
             // configure material
-            texture.coordinatesMode = BABYLON.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
+            texture.coordinatesMode = Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE; // matches orientation
             texture.wrapV = Texture.CLAMP_ADDRESSMODE; // always clamp the up/down
             material.reflectionTexture = this._videoTexture;
             material.useEquirectangularFOV = true;
@@ -84,11 +84,23 @@ module BABYLON {
             this._mesh.parent = this;
 
             // optional configuration
-            if(options.clickToPlay) {
+            if (options.clickToPlay) {
                 scene.onPointerUp = () => {
                     this._videoTexture.video.play();
                 }
             }
         }
+
+        /**
+         * Releases all associated resources
+         */
+        public dispose(): void {
+            super.dispose();
+
+            this._videoTexture.dispose();
+            this._mesh.dispose();
+            this._material.dispose();
+
+        }
     }
 }

+ 5 - 5
src/Materials/Textures/babylon.cubeTexture.ts

@@ -40,7 +40,7 @@
 
         public static CreateFromImages(files: string[], scene: Scene, noMipmap?: boolean) {
             let rootUrlKey = "";
-            
+
             files.forEach(url => rootUrlKey += url);
 
             return new CubeTexture(rootUrlKey, scene, null, noMipmap, files);
@@ -144,18 +144,18 @@
         public setReflectionTextureMatrix(value: Matrix): void {
             this._textureMatrix = value;
         }
-        
+
         public static Parse(parsedTexture: any, scene: Scene, rootUrl: string): CubeTexture {
             var texture = SerializationHelper.Parse(() => {
                 return new CubeTexture(rootUrl + parsedTexture.name, scene, parsedTexture.extensions);
             }, parsedTexture, scene);
-            
+
             // Local Cubemaps
             if (parsedTexture.boundingBoxPosition) {
-                texture.boundingBoxPosition = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxPosition);
+                texture.boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);
             }
             if (parsedTexture.boundingBoxSize) {
-                texture.boundingBoxSize = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxSize);
+                texture.boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);
             }
 
             // Animations

+ 3 - 3
src/Materials/Textures/babylon.hdrCubeTexture.ts

@@ -84,7 +84,7 @@ module BABYLON {
         public get boundingBoxSize(): Vector3 {
             return this._boundingBoxSize;
         }
-        
+
         /**
          * Instantiates an HDRTexture from the following parameters.
          * 
@@ -472,10 +472,10 @@ module BABYLON {
             }
             if (texture) {
                 if (parsedTexture.boundingBoxPosition) {
-                    (<any>texture).boundingBoxPosition = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxPosition);
+                    (<any>texture).boundingBoxPosition = Vector3.FromArray(parsedTexture.boundingBoxPosition);
                 }
                 if (parsedTexture.boundingBoxSize) {
-                    (<any>texture).boundingBoxSize = BABYLON.Vector3.FromArray(parsedTexture.boundingBoxSize);
+                    (<any>texture).boundingBoxSize = Vector3.FromArray(parsedTexture.boundingBoxSize);
                 }
             }
             return texture;

+ 2 - 1
src/Materials/Textures/babylon.videoTexture.ts

@@ -205,11 +205,12 @@
         }
 
         public dispose(): void {
-            super.dispose();
+            super.dispose();            
             this.video.removeEventListener("canplay", this._createInternalTexture);
             this.video.removeEventListener("paused", this._updateInternalTexture);
             this.video.removeEventListener("seeked", this._updateInternalTexture);
             this.video.removeEventListener("emptied", this.reset);
+            this.video.pause();
         }
 
         public static CreateFromWebCam(

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

@@ -18,11 +18,11 @@
             /**
              * Defines the red component (between 0 and 1, default is 0)
              */
-            public r: number = 0, 
+            public r: number = 0,
             /**
              * Defines the green component (between 0 and 1, default is 0) 
              */
-            public g: number = 0, 
+            public g: number = 0,
             /**
              * Defines the blue component (between 0 and 1, default is 0)
              */
@@ -175,9 +175,9 @@
          * @returns the original Color3
          */
         public clampToRef(min: number = 0, max: number = 1, result: Color3): Color3 {
-            result.r = BABYLON.Scalar.Clamp(this.r, min, max);
-            result.g = BABYLON.Scalar.Clamp(this.g, min, max);
-            result.b = BABYLON.Scalar.Clamp(this.b, min, max);
+            result.r = Scalar.Clamp(this.r, min, max);
+            result.g = Scalar.Clamp(this.g, min, max);
+            result.b = Scalar.Clamp(this.b, min, max);
             return this;
         }
 
@@ -387,58 +387,58 @@
         /**
          * Returns a Color3 value containing a green color
          * @returns a new Color3 object
-         */        
+         */
         public static Green(): Color3 { return new Color3(0, 1, 0); }
         /**
          * Returns a Color3 value containing a blue color
          * @returns a new Color3 object
-         */        
+         */
         public static Blue(): Color3 { return new Color3(0, 0, 1); }
         /**
          * Returns a Color3 value containing a black color
          * @returns a new Color3 object
-         */        
+         */
         public static Black(): Color3 { return new Color3(0, 0, 0); }
         /**
          * Returns a Color3 value containing a white color
          * @returns a new Color3 object
-         */        
+         */
         public static White(): Color3 { return new Color3(1, 1, 1); }
         /**
          * Returns a Color3 value containing a purple color
          * @returns a new Color3 object
-         */        
+         */
         public static Purple(): Color3 { return new Color3(0.5, 0, 0.5); }
         /**
          * Returns a Color3 value containing a magenta color
          * @returns a new Color3 object
-         */        
+         */
         public static Magenta(): Color3 { return new Color3(1, 0, 1); }
         /**
          * Returns a Color3 value containing a yellow color
          * @returns a new Color3 object
-         */        
+         */
         public static Yellow(): Color3 { return new Color3(1, 1, 0); }
         /**
          * Returns a Color3 value containing a gray color
          * @returns a new Color3 object
-         */        
+         */
         public static Gray(): Color3 { return new Color3(0.5, 0.5, 0.5); }
         /**
          * Returns a Color3 value containing a teal color
          * @returns a new Color3 object
-         */        
+         */
         public static Teal(): Color3 { return new Color3(0, 1.0, 1.0); }
         /**
          * Returns a Color3 value containing a random color
          * @returns a new Color3 object
-         */     
+         */
         public static Random(): Color3 { return new Color3(Math.random(), Math.random(), Math.random()); }
     }
 
     /**
      * Class used to hold a RBGA color
-     */    
+     */
     export class Color4 {
         /**
          * Creates a new Color4 object from red, green, blue values, all between 0 and 1
@@ -451,15 +451,15 @@
             /**
              * Defines the red component (between 0 and 1, default is 0)
              */
-            public r: number = 0, 
+            public r: number = 0,
             /**
              * Defines the green component (between 0 and 1, default is 0) 
              */
-            public g: number = 0, 
+            public g: number = 0,
             /**
              * Defines the blue component (between 0 and 1, default is 0)
              */
-            public b: number = 0, 
+            public b: number = 0,
             /**
              * Defines the alpha component (between 0 and 1, default is 1)
              */
@@ -571,10 +571,10 @@
          * @returns the cuurent Color4
          */
         public clampToRef(min: number = 0, max: number = 1, result: Color4): Color4 {
-            result.r = BABYLON.Scalar.Clamp(this.r, min, max);
-            result.g = BABYLON.Scalar.Clamp(this.g, min, max);
-            result.b = BABYLON.Scalar.Clamp(this.b, min, max);
-            result.a = BABYLON.Scalar.Clamp(this.a, min, max);
+            result.r = Scalar.Clamp(this.r, min, max);
+            result.g = Scalar.Clamp(this.g, min, max);
+            result.b = Scalar.Clamp(this.b, min, max);
+            result.a = Scalar.Clamp(this.a, min, max);
             return this;
         }
 
@@ -1294,11 +1294,11 @@
             /**
              * Defines the first coordinates (on X axis)
              */
-            public x: number, 
+            public x: number,
             /**
              * Defines the second coordinates (on Y axis)
              */
-            public y: number, 
+            public y: number,
             /**
              * Defines the third coordinates (on Z axis)
              */
@@ -1798,10 +1798,10 @@
          * @param normal direction of the normal
          * @return the angle between vector0 and vector1
          */
-        public static GetAngleBetweenVectors(vector0: Vector3, vector1: Vector3, normal: Vector3):number {
-            var v0:Vector3 = vector0.clone().normalize();
-            var v1:Vector3 = vector1.clone().normalize();
-            var dot:number = Vector3.Dot(v0, v1);
+        public static GetAngleBetweenVectors(vector0: Vector3, vector1: Vector3, normal: Vector3): number {
+            var v0: Vector3 = vector0.clone().normalize();
+            var v1: Vector3 = vector1.clone().normalize();
+            var dot: number = Vector3.Dot(v0, v1);
             var n = Vector3.Cross(v0, v1);
             if (Vector3.Dot(n, normal) > 0) {
                 return Math.acos(dot);
@@ -2301,7 +2301,7 @@
          * @param left defines the first operand
          * @param right defines the second operand
          * @returns the new Vector3
-         */        
+         */
         public static Maximize(left: Vector3, right: Vector3): Vector3 {
             var max = left.clone();
             max.maximizeInPlace(right);
@@ -3897,15 +3897,15 @@
          * Writes to the given matrix a normal matrix, computed from this one (using values from identity matrix for fourth row and column).  
          * @param ref matrix to store the result
          */
-        public toNormalMatrix(ref : Matrix): void {            
+        public toNormalMatrix(ref: Matrix): void {
             this.invertToRef(ref)
             ref.transpose();
             var m = ref.m;
             Matrix.FromValuesToRef(
-                m[0], m[1], m[2],  0,
-                m[4], m[5], m[6],  0,
+                m[0], m[1], m[2], 0,
+                m[4], m[5], m[6], 0,
                 m[8], m[9], m[10], 0,
-                0,    0,    0,     1, ref);
+                0, 0, 0, 1, ref);
         }
 
         /**
@@ -3916,7 +3916,7 @@
             this.getRotationMatrixToRef(result);
             return result;
         }
-       
+
         /**
          * Extracts the rotation matrix from the current one and sets it as the passed "result".  
          * Returns the current Matrix.  

+ 2 - 1
src/Particles/babylon.IParticleSystem.ts

@@ -131,8 +131,9 @@ module BABYLON {
         render(): number;
         /**
          * Dispose the particle system and frees its associated resources.
+         * @param disposeTexture defines if the particule texture must be disposed as well (true by default)
          */
-        dispose(): void;
+        dispose(disposeTexture?: boolean): void;
         /**
          * Clones the particle system.
          * @param name The name of the cloned object

+ 8 - 2
src/Particles/babylon.gpuParticleSystem.ts

@@ -638,9 +638,10 @@
         }
 
         /**
-         * Disposes the particle system and free the associated resources.
+         * Disposes the particle system and free the associated resources
+         * @param disposeTexture defines if the particule texture must be disposed as well (true by default)
          */
-        public dispose(): void {
+        public dispose(disposeTexture = true): void {
             var index = this._scene.particleSystems.indexOf(this);
             if (index > -1) {
                 this._scene.particleSystems.splice(index, 1);
@@ -655,6 +656,11 @@
                 (<any>this._randomTexture) = null;
             }
 
+            if (disposeTexture && this.particleTexture) {
+                this.particleTexture.dispose();
+                this.particleTexture = null;
+            }            
+
             // Callback
             this.onDisposeObservable.notifyObservers(this);
             this.onDisposeObservable.clear();

+ 4 - 3
src/Particles/babylon.particleSystem.ts

@@ -831,9 +831,10 @@
         }
 
         /**
-         * Disposes the particle system and free the associated resources.
+         * Disposes the particle system and free the associated resources
+         * @param disposeTexture defines if the particule texture must be disposed as well (true by default)
          */
-        public dispose(): void {
+        public dispose(disposeTexture = true): void {
             if (this._vertexBuffer) {
                 this._vertexBuffer.dispose();
                 this._vertexBuffer = null;
@@ -844,7 +845,7 @@
                 this._indexBuffer = null;
             }
 
-            if (this.particleTexture) {
+            if (disposeTexture && this.particleTexture) {
                 this.particleTexture.dispose();
                 this.particleTexture = null;
             }

+ 3 - 3
src/Probes/babylon.reflectionProbe.ts

@@ -8,7 +8,7 @@
         private _add = Vector3.Zero();
         private _attachedMesh: AbstractMesh;
 
-        public invertYAxis = false;
+        private _invertYAxis = false;
         public position = Vector3.Zero();
           
         constructor(public name: string, size: number, scene: Scene, generateMipMaps = true) {
@@ -27,10 +27,10 @@
                         this._add.copyFromFloats(-1, 0, 0);
                         break;
                     case 2:
-                        this._add.copyFromFloats(0, this.invertYAxis ? 1 : -1, 0);
+                        this._add.copyFromFloats(0, this._invertYAxis ? 1 : -1, 0);
                         break;
                     case 3:
-                        this._add.copyFromFloats(0, this.invertYAxis ? -1 : 1, 0);
+                        this._add.copyFromFloats(0, this._invertYAxis ? -1 : 1, 0);
                         break;
                     case 4:
                         this._add.copyFromFloats(0, 0, 1);

+ 14 - 9
src/Shaders/ShadersInclude/reflectionFunction.fx

@@ -61,20 +61,25 @@ vec3 computeReflectionCoords(vec4 worldPos, vec3 worldNormal)
 #endif
 
 #ifdef REFLECTIONMAP_CUBIC
-	vec3 viewDir = worldPos.xyz - vEyePosition.xyz;
-	vec3 coords = reflect(viewDir, worldNormal);
-#ifdef INVERTCUBICMAP
-	coords.y = 1.0 - coords.y;
-#endif
+    vec3 viewDir = normalize(worldPos.xyz - vEyePosition.xyz);
 
-#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC
-	coords = parallaxCorrectNormal(worldPos.xyz, coords, vReflectionSize, vReflectionPosition );
-#endif
+    // worldNormal has already been normalized.
+    vec3 coords = reflect(viewDir, worldNormal);
 
+    #ifdef USE_LOCAL_REFLECTIONMAP_CUBIC
+        coords = parallaxCorrectNormal(worldPos.xyz, coords, vReflectionSize, vReflectionPosition);
+    #endif
 
-	return vec3(reflectionMatrix * vec4(coords, 0));
+    coords = vec3(reflectionMatrix * vec4(coords, 0));
+    
+    #ifdef INVERTCUBICMAP
+        coords.y *= -1.0;
+    #endif
+
+    return coords;
 #endif
 
+
 #ifdef REFLECTIONMAP_PROJECTION
 	return vec3(reflectionMatrix * (view * worldPos));
 #endif

+ 22 - 6
src/babylon.scene.ts

@@ -3389,7 +3389,6 @@
             // Camera
             this.resetCachedMaterial();
             this._renderId++;
-            this.activeCamera.update();
             this.updateTransformMatrix();
 
             if (camera._alternateCamera) {
@@ -3568,11 +3567,6 @@
                 return;
             }
 
-            // Update camera
-            if (this.activeCamera) {
-                this.activeCamera.update();
-            }
-
             // rig cameras
             for (var index = 0; index < camera._rigCameras.length; index++) {
                 this._renderForCamera(camera._rigCameras[index], camera);
@@ -3715,6 +3709,28 @@
             // Before render
             this.onBeforeRenderObservable.notifyObservers(this);
 
+            // Update Cameras
+            if (this.activeCameras.length > 0) {
+                for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
+                    let camera = this.activeCameras[cameraIndex];
+                    camera.update();
+                    if (camera.cameraRigMode !== Camera.RIG_MODE_NONE) {
+                        // rig cameras
+                        for (var index = 0; index < camera._rigCameras.length; index++) {
+                            camera._rigCameras[index].update();
+                        }
+                    }
+                }
+            } else if (this.activeCamera) {
+                this.activeCamera.update();
+                if (this.activeCamera.cameraRigMode !== Camera.RIG_MODE_NONE) {
+                    // rig cameras
+                    for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
+                        this.activeCamera._rigCameras[index].update();
+                    }
+                }
+            }
+
             // Customs render targets
             this.OnBeforeRenderTargetsRenderObservable.notifyObservers(this);
             var engine = this.getEngine();

BIN
tests/validation/ReferenceImages/refprobe.png