David Catuhe 8 éve
szülő
commit
3bb824e711
60 módosított fájl, 10117 hozzáadás és 17802 törlés
  1. 40 0
      canvas2D/config.json
  2. 48 0
      canvas2D/gulp-addModuleExports.js
  3. 97 0
      canvas2D/gulp-removeShaderComments.js
  4. 132 0
      canvas2D/gulpfile.js
  5. 28 0
      canvas2D/package.json
  6. 73 0
      canvas2D/readme.md
  7. 0 0
      canvas2D/src/babylon.bounding2d.js
  8. 0 0
      canvas2D/src/babylon.bounding2d.ts
  9. 0 0
      canvas2D/src/babylon.brushes2d.js
  10. 0 0
      canvas2D/src/babylon.brushes2d.ts
  11. 0 0
      canvas2D/src/babylon.canvas2d.js
  12. 0 0
      canvas2D/src/babylon.canvas2d.ts
  13. 0 0
      canvas2D/src/babylon.canvas2dLayoutEngine.js
  14. 0 0
      canvas2D/src/babylon.canvas2dLayoutEngine.ts
  15. 0 0
      canvas2D/src/babylon.ellipse2d.js
  16. 0 0
      canvas2D/src/babylon.ellipse2d.ts
  17. 0 0
      canvas2D/src/babylon.group2d.js
  18. 0 0
      canvas2D/src/babylon.group2d.ts
  19. 0 0
      canvas2D/src/babylon.lines2d.js
  20. 0 0
      canvas2D/src/babylon.lines2d.ts
  21. 0 0
      canvas2D/src/babylon.modelRenderCache.js
  22. 0 0
      canvas2D/src/babylon.modelRenderCache.ts
  23. 0 0
      canvas2D/src/babylon.prim2dBase.js
  24. 0 0
      canvas2D/src/babylon.prim2dBase.ts
  25. 0 0
      canvas2D/src/babylon.rectangle2d.js
  26. 0 0
      canvas2D/src/babylon.rectangle2d.ts
  27. 0 0
      canvas2D/src/babylon.renderablePrim2d.js
  28. 0 0
      canvas2D/src/babylon.renderablePrim2d.ts
  29. 0 0
      canvas2D/src/babylon.shape2d.js
  30. 0 0
      canvas2D/src/babylon.shape2d.ts
  31. 0 0
      canvas2D/src/babylon.smartPropertyPrim.js
  32. 0 0
      canvas2D/src/babylon.smartPropertyPrim.ts
  33. 0 0
      canvas2D/src/babylon.sprite2d.js
  34. 0 0
      canvas2D/src/babylon.sprite2d.ts
  35. 0 0
      canvas2D/src/babylon.text2d.js
  36. 0 0
      canvas2D/src/babylon.text2d.ts
  37. 0 0
      canvas2D/src/babylon.worldSpaceCanvas2dNode.js
  38. 0 0
      canvas2D/src/babylon.worldSpaceCanvas2dNode.ts
  39. 0 0
      canvas2D/src/shaders/ellipse2d.fragment.fx
  40. 0 0
      canvas2D/src/shaders/ellipse2d.vertex.fx
  41. 0 0
      canvas2D/src/shaders/lines2d.fragment.fx
  42. 0 0
      canvas2D/src/shaders/lines2d.vertex.fx
  43. 0 0
      canvas2D/src/shaders/rect2d.fragment.fx
  44. 0 0
      canvas2D/src/shaders/rect2d.vertex.fx
  45. 0 0
      canvas2D/src/shaders/sprite2d.fragment.fx
  46. 0 0
      canvas2D/src/shaders/sprite2d.vertex.fx
  47. 0 0
      canvas2D/src/shaders/text2d.fragment.fx
  48. 0 0
      canvas2D/src/shaders/text2d.vertex.fx
  49. 3032 0
      dist/preview release/babylon.canvas.d.ts
  50. 9 9
      dist/preview release/babylon.core.js
  51. 6524 6524
      dist/preview release/babylon.d.ts
  52. 37 43
      dist/preview release/babylon.js
  53. 27 11169
      dist/preview release/babylon.max.js
  54. 37 43
      dist/preview release/babylon.noworker.js
  55. 1 0
      dist/preview release/what's new.md
  56. 13 5
      src/Animations/babylon.animatable.js
  57. 7 7
      src/Mesh/babylon.mesh.js
  58. 4 0
      src/babylon.engine.js
  59. 5 0
      src/babylon.engine.ts
  60. 3 2
      src/babylon.scene.js

+ 40 - 0
canvas2D/config.json

@@ -0,0 +1,40 @@
+{
+  "build": {
+    "filename": "babylon.canvas2d.max.js",
+    "minFilename": "babylon.canvas2d.js",
+    "declarationFilename": "babylon.canvas.d.ts",
+    "outputDirectory": "../dist/preview release",
+    "srcOutputDirectory": "src/"
+  },
+  "core": {
+    "typescript": [
+      "src/**/*.ts",
+      "../dist/preview release/babylon.d.ts", 
+      "!src/**/*.d.ts"
+    ],
+    "files": [   
+      "src/babylon.bounding2d.js",
+      "src/babylon.canvas2dLayoutEngine.js",
+      "src/babylon.brushes2d.js",
+      "src/babylon.smartPropertyPrim.js",
+      "src/babylon.prim2dBase.js",
+      "src/babylon.modelRenderCache.js",
+      "src/babylon.renderablePrim2d.js",
+      "src/babylon.shape2d.js",
+      "src/babylon.group2d.js",
+      "src/babylon.rectangle2d.js",
+      "src/babylon.ellipse2d.js",
+      "src/babylon.sprite2d.js",
+      "src/babylon.text2d.js",
+      "src/babylon.lines2d.js",
+      "src/babylon.canvas2d.js",
+      "src/babylon.worldSpaceCanvas2dNode.js"
+    ]
+  },
+  "shadersDirectories": [
+    {
+      "variable": "BABYLON.Effect.ShadersStore",
+      "files": "Shaders/*.fx"
+    }
+  ]
+}

+ 48 - 0
canvas2D/gulp-addModuleExports.js

@@ -0,0 +1,48 @@
+var gutil = require('gulp-util');
+var through = require('through2');
+
+module.exports = function (varName) {
+    return through.obj(function (file, enc, cb) {
+
+        var moduleExportsAddition =
+          '\nif (((typeof window != "undefined" && window.module) || (typeof module != "undefined")) && typeof module.exports != "undefined") {\n' +
+          '    module.exports = ' + varName + ';\n' +
+          '};\n';
+
+        var extendsAddition =
+        'var __extends = (this && this.__extends) || function (d, b) {\n' +
+          'for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n' +
+          'function __() { this.constructor = d; }\n' +
+          '__.prototype = b.prototype;\n' +
+          'd.prototype = new __();\n' +
+        '};\n';
+
+        var decorateAddition =
+        'var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {\n' +
+            'var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\n' +
+            'if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);\n' +
+            'else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\n' +
+            'return c > 3 && r && Object.defineProperty(target, key, r), r;\n' +
+        '};\n';
+
+        if (file.isNull()) {
+            cb(null, file);
+            return;
+        }
+
+        if (file.isStream()) {
+            //streams not supported, no need for now.
+            return;
+        }
+
+        try {
+            file.contents = new Buffer(decorateAddition.concat(new Buffer(extendsAddition.concat(String(file.contents)).concat(moduleExportsAddition))));
+            this.push(file);
+
+        } catch (err) {
+            this.emit('error', new gutil.PluginError('gulp-add-module-exports', err, { fileName: file.path }));
+        }
+        cb();
+    });
+};
+

+ 97 - 0
canvas2D/gulp-removeShaderComments.js

@@ -0,0 +1,97 @@
+'use strict';
+
+var through = require('through2');
+var PluginError = require('gulp-util').PluginError;
+var singleComment = 1;
+var multiComment = 2;
+
+function uncomment(str, opts) {
+    opts = opts || {};
+
+	var currentChar;
+	var nextChar;
+	var insideString = false;
+	var insideComment = 0;
+	var offset = 0;
+	var ret = '';
+
+    str = str.replace(/\r\n/g, '\n');
+    str = str.replace(/[ \f\t\v]+/g, ' ');
+    str = str.replace(/^\s*\n/gm, '');
+    str = str.replace(/ \+ /g, '+');
+    str = str.replace(/ \- /g, '-');
+    str = str.replace(/ \/ /g, '/');
+    str = str.replace(/ \* /g, '*');
+    str = str.replace(/ > /g, '>');
+    str = str.replace(/ < /g, '<');
+    str = str.replace(/ >= /g, '>=');
+    str = str.replace(/ <= /g, '<=');
+    str = str.replace(/ \+= /g, '+=');
+    str = str.replace(/ \-= /g, '-=');
+    str = str.replace(/ \/= /g, '/=');
+    str = str.replace(/ \*= /g, '*=');
+    str = str.replace(/ = /g, '=');
+    str = str.replace(/, /g, ',');
+    str = str.replace(/\n\n/g, '\n');
+    str = str.replace(/\n /g, '\n');
+    
+	for (var i = 0; i < str.length; i++) {
+		currentChar = str[i];
+		nextChar = str[i + 1];
+
+		if (!insideComment && currentChar === '"') {
+			var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
+			if (!escaped) {
+				insideString = !insideString;
+			}
+		}
+
+		if (insideString) {
+			continue;
+		}
+
+		if (!insideComment && currentChar + nextChar === '//') {
+			ret += str.slice(offset, i);
+			offset = i;
+			insideComment = singleComment;
+			i++;
+		} else if (insideComment === singleComment && currentChar === '\n') {
+			insideComment = 0;
+			offset = i;
+		} else if (!insideComment && currentChar + nextChar === '/*') {
+			ret += str.slice(offset, i);
+			offset = i;
+			insideComment = multiComment;
+			i++;
+			continue;
+		} else if (insideComment === multiComment && currentChar + nextChar === '*/') {
+			i++;
+			insideComment = 0;
+			offset = i + 1;
+			continue;
+		}
+	}
+
+	return ret + (insideComment ? '' : str.substr(offset));
+}
+
+function gulpUncomment(options) {
+    return main(options, uncomment);
+}
+
+function main(options, func) {
+    return through.obj(function (file, enc, cb) {
+        if (file.isNull()) {
+            cb(null, file);
+            return;
+        }
+        if (file.isStream()) {
+            cb(new PluginError("Remove Shader Comments", "Streaming not supported."));
+        }
+        file.contents = new Buffer(func(file.contents.toString(), options));
+        this.push(file);
+        return cb();
+    });
+}
+
+module.exports = gulpUncomment;

+ 132 - 0
canvas2D/gulpfile.js

@@ -0,0 +1,132 @@
+var gulp = require("gulp");
+var uglify = require("gulp-uglify");
+var typescript = require("gulp-typescript");
+var sourcemaps = require("gulp-sourcemaps");
+var srcToVariable = require("gulp-content-to-variable");
+var addModuleExports = require("./gulp-addModuleExports");
+var merge2 = require("merge2");
+var concat = require("gulp-concat");
+var rename = require("gulp-rename");
+var cleants = require('gulp-clean-ts-extends');
+var changed = require('gulp-changed');
+var runSequence = require('run-sequence');
+var replace = require("gulp-replace");
+var uncommentShader = require("./gulp-removeShaderComments");
+var expect = require('gulp-expect-file');
+var optimisejs = require('gulp-optimize-js');
+
+var config = require("./config.json");
+
+var includeShadersStream;
+var shadersStream;
+var workersStream;
+
+var extendsSearchRegex = /var\s__extends[\s\S]+?\};/g;
+var decorateSearchRegex = /var\s__decorate[\s\S]+?\};/g;
+
+//function to convert the shaders' filenames to variable names.
+function shadersName(filename) {
+    return filename.replace('.fragment', 'Pixel')
+        .replace('.vertex', 'Vertex')
+        .replace('.fx', 'Shader');
+}
+
+gulp.task("shaders", function (cb) {
+    shadersStream = config.shadersDirectories.map(function (shadersDef) {
+        return gulp.src(shadersDef.files).
+            pipe(expect.real({ errorOnFailure: true }, shadersDef.files)).
+            pipe(uncommentShader()).
+            pipe(srcToVariable({
+            variableName: shadersDef.variable, asMap: true, namingCallback: shadersName
+        }));
+    });
+    cb();
+});
+
+/*
+Compiles all typescript files and creating a declaration file.
+*/
+gulp.task('typescript-compile', function () {
+    var tsResult = gulp.src(config.core.typescript).
+        pipe(typescript({
+            noExternalResolve: true,
+            target: 'ES5',
+            declarationFiles: true,
+            typescript: require('typescript'),
+            experimentalDecorators: true
+        }));
+    //If this gulp task is running on travis, file the build!
+    if (process.env.TRAVIS) {
+        var error = false;
+        tsResult.on('error', function () {
+            error = true;
+        }).on('end', function () {
+            if (error) {
+                console.log('Typescript compile failed');
+                process.exit(1);
+            }
+        });
+    }
+    return merge2([
+        tsResult.dts
+            .pipe(concat(config.build.declarationFilename))
+            .pipe(gulp.dest(config.build.outputDirectory)),
+        tsResult.js
+            .pipe(gulp.dest(config.build.srcOutputDirectory))
+    ])
+});
+
+gulp.task('typescript-sourcemaps', function () {
+    var tsResult = gulp.src(config.core.typescript)
+        .pipe(sourcemaps.init()) // sourcemaps init. currently redundant directory def, waiting for this - https://github.com/floridoo/gulp-sourcemaps/issues/111
+        .pipe(typescript({
+            noExternalResolve: true,
+            target: 'ES5',
+            declarationFiles: true,
+            typescript: require('typescript'),
+            experimentalDecorators: true
+        }));
+    return tsResult.js
+        .pipe(sourcemaps.write("./")) // sourcemaps are written.
+        .pipe(gulp.dest(config.build.srcOutputDirectory));
+});
+
+gulp.task("default", ["shaders"], function () {
+    return merge2(
+        gulp.src(config.core.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.core.files)),
+        gulp.src(config.extras.files).        
+            pipe(expect.real({ errorOnFailure: true }, config.extras.files)),   
+        shadersStream,
+        includeShadersStream,
+        workersStream
+        )
+        .pipe(concat(config.build.filename))
+        .pipe(cleants())
+        .pipe(replace(extendsSearchRegex, ""))
+        .pipe(replace(decorateSearchRegex, ""))
+        .pipe(addModuleExports("BABYLON"))
+        .pipe(gulp.dest(config.build.outputDirectory))
+        .pipe(rename(config.build.minFilename))
+        .pipe(uglify())
+        .pipe(optimisejs())
+        .pipe(gulp.dest(config.build.outputDirectory));
+});
+
+gulp.task("typescript", function (cb) {
+    runSequence("typescript-compile", "default", cb);
+});
+
+/**
+ * Watch task, will call the default task if a js file is updated.
+ */
+gulp.task('watch', function () {
+    gulp.watch(config.core.typescript, ['default']);
+});
+
+/**
+ * Watch typescript task, will call the default typescript task if a typescript file is updated.
+ */
+gulp.task('watch-typescript', function () {
+    gulp.watch(config.core.typescript, ["typescript-compile", "build"]);
+});

+ 28 - 0
canvas2D/package.json

@@ -0,0 +1,28 @@
+{
+  "name": "BabylonJS",
+  "version": "2.4.0",
+  "description": "Babylon.js is a 3D engine based on webgl and javascript",
+  "main": "",
+  "repository": { "url": "https://github.com/BabylonJS/Babylon.js/" },
+  "readme": "https://github.com/BabylonJS/Babylon.js/edit/master/readme.md",
+  "license": "(Apache-2.0)",
+  "devDependencies": {
+    "gulp": "^3.8.11",
+    "gulp-uglify": "~1.5.3",
+    "gulp-sourcemaps": "~1.5.2",
+    "typescript": "^1.7.5",
+    "gulp-typescript": "~2.13.0",
+    "through2": "~0.6.5",
+    "gulp-util": "~3.0.4",
+    "gulp-concat": "~2.5.2",
+    "merge2": "~0.3.5",
+    "gulp-rename": "~1.2.2",
+    "gulp-clean-ts-extends": "~0.1.1",
+    "gulp-changed": "~1.2.1",
+    "run-sequence": "~1.1.0",
+    "gulp-replace": "~0.5.3",
+    "gulp-content-to-variable": "^0.1.0",
+    "gulp-expect-file": "^0.0.7",
+    "gulp-optimize-js": "^1.0.2"
+  }
+}

+ 73 - 0
canvas2D/readme.md

@@ -0,0 +1,73 @@
+Build Babylon.js with Gulp
+====================
+
+Build Babylon.js with [gulp](http://gulpjs.com/ "gulp") and npm ([nodejs](http://nodejs.org/ "nodejs")), easy and cross-platform
+
+(Paths in this file are relative to this file location.)
+
+# How to use it
+
+### First install gulp :
+```
+npm install -g gulp
+```
+
+### Install some dependencies :
+```
+npm install
+```
+
+### Update dependencies if necessary :
+```
+npm update
+```
+
+### Update config.json if you want to add your own files:
+```
+"extras" : {
+    "files": [
+        "file1.js", "file2.js"
+    ]
+}
+```
+## From the javascript source
+### Build Babylon.js from the javascript files:
+
+```
+gulp
+```
+Will be generated :
+- babylon.js
+- babylon.noworker.js (minified version without collisions workers)
+- babylon.max.js (unminified)
+
+### Build Babylon.js when you save a javascript file:
+```
+gulp watch
+```
+
+## From the typescript source
+### Build Babylon.js from the typescript files:
+
+```
+gulp typescript
+```
+Will be generated :
+- babylon.js
+- babylon.d.ts
+- babylon.noworker.js (minified version without collisions workers)
+- babylon.max.js (unminified)
+
+Be aware that all js files content will be overwrite.
+
+### Build Babylon.js when you save a typescript file:
+```
+gulp watch-typescript
+```
+
+### Compile all the typscript files to their javascript respective files including declaration file
+```
+gulp typescript-compile
+```
+
+Be aware that all js files content will be overwritten.

src/Canvas2d/babylon.bounding2d.js → canvas2D/src/babylon.bounding2d.js


src/Canvas2d/babylon.bounding2d.ts → canvas2D/src/babylon.bounding2d.ts


src/Canvas2d/babylon.brushes2d.js → canvas2D/src/babylon.brushes2d.js


src/Canvas2d/babylon.brushes2d.ts → canvas2D/src/babylon.brushes2d.ts


src/Canvas2d/babylon.canvas2d.js → canvas2D/src/babylon.canvas2d.js


src/Canvas2d/babylon.canvas2d.ts → canvas2D/src/babylon.canvas2d.ts


src/Canvas2d/babylon.canvas2dLayoutEngine.js → canvas2D/src/babylon.canvas2dLayoutEngine.js


src/Canvas2d/babylon.canvas2dLayoutEngine.ts → canvas2D/src/babylon.canvas2dLayoutEngine.ts


src/Canvas2d/babylon.ellipse2d.js → canvas2D/src/babylon.ellipse2d.js


src/Canvas2d/babylon.ellipse2d.ts → canvas2D/src/babylon.ellipse2d.ts


src/Canvas2d/babylon.group2d.js → canvas2D/src/babylon.group2d.js


src/Canvas2d/babylon.group2d.ts → canvas2D/src/babylon.group2d.ts


src/Canvas2d/babylon.lines2d.js → canvas2D/src/babylon.lines2d.js


src/Canvas2d/babylon.lines2d.ts → canvas2D/src/babylon.lines2d.ts


src/Canvas2d/babylon.modelRenderCache.js → canvas2D/src/babylon.modelRenderCache.js


src/Canvas2d/babylon.modelRenderCache.ts → canvas2D/src/babylon.modelRenderCache.ts


src/Canvas2d/babylon.prim2dBase.js → canvas2D/src/babylon.prim2dBase.js


src/Canvas2d/babylon.prim2dBase.ts → canvas2D/src/babylon.prim2dBase.ts


src/Canvas2d/babylon.rectangle2d.js → canvas2D/src/babylon.rectangle2d.js


src/Canvas2d/babylon.rectangle2d.ts → canvas2D/src/babylon.rectangle2d.ts


src/Canvas2d/babylon.renderablePrim2d.js → canvas2D/src/babylon.renderablePrim2d.js


src/Canvas2d/babylon.renderablePrim2d.ts → canvas2D/src/babylon.renderablePrim2d.ts


src/Canvas2d/babylon.shape2d.js → canvas2D/src/babylon.shape2d.js


src/Canvas2d/babylon.shape2d.ts → canvas2D/src/babylon.shape2d.ts


src/Canvas2d/babylon.smartPropertyPrim.js → canvas2D/src/babylon.smartPropertyPrim.js


src/Canvas2d/babylon.smartPropertyPrim.ts → canvas2D/src/babylon.smartPropertyPrim.ts


src/Canvas2d/babylon.sprite2d.js → canvas2D/src/babylon.sprite2d.js


src/Canvas2d/babylon.sprite2d.ts → canvas2D/src/babylon.sprite2d.ts


src/Canvas2d/babylon.text2d.js → canvas2D/src/babylon.text2d.js


src/Canvas2d/babylon.text2d.ts → canvas2D/src/babylon.text2d.ts


src/Canvas2d/babylon.worldSpaceCanvas2dNode.js → canvas2D/src/babylon.worldSpaceCanvas2dNode.js


src/Canvas2d/babylon.worldSpaceCanvas2dNode.ts → canvas2D/src/babylon.worldSpaceCanvas2dNode.ts


src/Shaders/ellipse2d.fragment.fx → canvas2D/src/shaders/ellipse2d.fragment.fx


src/Shaders/ellipse2d.vertex.fx → canvas2D/src/shaders/ellipse2d.vertex.fx


src/Shaders/lines2d.fragment.fx → canvas2D/src/shaders/lines2d.fragment.fx


src/Shaders/lines2d.vertex.fx → canvas2D/src/shaders/lines2d.vertex.fx


src/Shaders/rect2d.fragment.fx → canvas2D/src/shaders/rect2d.fragment.fx


src/Shaders/rect2d.vertex.fx → canvas2D/src/shaders/rect2d.vertex.fx


src/Shaders/sprite2d.fragment.fx → canvas2D/src/shaders/sprite2d.fragment.fx


src/Shaders/sprite2d.vertex.fx → canvas2D/src/shaders/sprite2d.vertex.fx


src/Shaders/text2d.fragment.fx → canvas2D/src/shaders/text2d.fragment.fx


src/Shaders/text2d.vertex.fx → canvas2D/src/shaders/text2d.vertex.fx


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 3032 - 0
dist/preview release/babylon.canvas.d.ts


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 9 - 9
dist/preview release/babylon.core.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 6524 - 6524
dist/preview release/babylon.d.ts


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 37 - 43
dist/preview release/babylon.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 27 - 11169
dist/preview release/babylon.max.js


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 37 - 43
dist/preview release/babylon.noworker.js


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

@@ -5,6 +5,7 @@
 - New `HighlightLayer` object to enable highlights rendering. [Demo](http://www.babylonjs.com/Demos/Highlights/) - ([sebavan](https://github.com/sebavan))
 - Babylon.js now supports right handed system with ```scene.useRightHandedSystem = true``` ([deltakosh](https://github.com/deltakosh))
 - Babylon.js is now compiled with [optimize-js](https://github.com/nolanlawson/optimize-js) to get faster initial load ([deltakosh](https://github.com/deltakosh))
+- Canvas2D moved to a separate folder in main repo. Now you need to also include babylon.cavans2d.js to get Canvas@D feature ([deltakosh](https://github.com/deltakosh))
 
 ### Updates
 - New ```Tools.CreateScreenshot``` function will capture all canvas data. Previous implementation is now called `CreateScreenshotUsingRenderTarget` ([deltakosh](https://github.com/deltakosh)) 

+ 13 - 5
src/Animations/babylon.animatable.js

@@ -77,16 +77,24 @@ var BABYLON;
         Animatable.prototype.restart = function () {
             this._paused = false;
         };
-        Animatable.prototype.stop = function () {
+        Animatable.prototype.stop = function (animationName) {
             var index = this._scene._activeAnimatables.indexOf(this);
             if (index > -1) {
-                this._scene._activeAnimatables.splice(index, 1);
                 var animations = this._animations;
-                for (var index = 0; index < animations.length; index++) {
+                var numberOfAnimationsStopped = 0;
+                for (var index = animations.length - 1; index >= 0; index--) {
+                    if (typeof animationName === "string" && animations[index].name != animationName) {
+                        continue;
+                    }
                     animations[index].reset();
+                    animations.splice(index, 1);
+                    numberOfAnimationsStopped++;
                 }
-                if (this.onAnimationEnd) {
-                    this.onAnimationEnd();
+                if (animations.length == numberOfAnimationsStopped) {
+                    this._scene._activeAnimatables.splice(index, 1);
+                    if (this.onAnimationEnd) {
+                        this.onAnimationEnd();
+                    }
                 }
             }
         };

+ 7 - 7
src/Mesh/babylon.mesh.js

@@ -2294,17 +2294,17 @@ var BABYLON;
         Mesh.MinMax = function (meshes) {
             var minVector = null;
             var maxVector = null;
-            for (var i in meshes) {
-                var mesh = meshes[i];
+            meshes.forEach(function (mesh, index, array) {
                 var boundingBox = mesh.getBoundingInfo().boundingBox;
                 if (!minVector) {
                     minVector = boundingBox.minimumWorld;
                     maxVector = boundingBox.maximumWorld;
-                    continue;
                 }
-                minVector.MinimizeInPlace(boundingBox.minimumWorld);
-                maxVector.MaximizeInPlace(boundingBox.maximumWorld);
-            }
+                else {
+                    minVector.MinimizeInPlace(boundingBox.minimumWorld);
+                    maxVector.MaximizeInPlace(boundingBox.maximumWorld);
+                }
+            });
             return {
                 min: minVector,
                 max: maxVector
@@ -2314,7 +2314,7 @@ var BABYLON;
          * Returns a Vector3, the center of the `{min:` Vector3`, max:` Vector3`}` or the center of MinMax vector3 computed from a mesh array.
          */
         Mesh.Center = function (meshesOrMinMaxVector) {
-            var minMaxVector = meshesOrMinMaxVector.min !== undefined ? meshesOrMinMaxVector : Mesh.MinMax(meshesOrMinMaxVector);
+            var minMaxVector = (meshesOrMinMaxVector instanceof Array) ? BABYLON.Mesh.MinMax(meshesOrMinMaxVector) : meshesOrMinMaxVector;
             return BABYLON.Vector3.Center(minMaxVector.min, minMaxVector.max);
         };
         /**

+ 4 - 0
src/babylon.engine.js

@@ -2034,6 +2034,7 @@ var BABYLON;
             texture.isCube = true;
             texture.url = rootUrl;
             texture.references = 1;
+            texture.onLoadedCallbacks = [];
             var extension = rootUrl.substr(rootUrl.length - 4, 4).toLowerCase();
             var isDDS = this.getCaps().s3tc && (extension === ".dds");
             if (isDDS) {
@@ -2086,6 +2087,9 @@ var BABYLON;
                     texture._width = width;
                     texture._height = height;
                     texture.isReady = true;
+                    texture.onLoadedCallbacks.forEach(function (callback) {
+                        callback();
+                    });
                     if (onLoad) {
                         onLoad();
                     }

+ 5 - 0
src/babylon.engine.ts

@@ -2424,6 +2424,7 @@
             texture.isCube = true;
             texture.url = rootUrl;
             texture.references = 1;
+            texture.onLoadedCallbacks = [];
 
             var extension = rootUrl.substr(rootUrl.length - 4, 4).toLowerCase();
             var isDDS = this.getCaps().s3tc && (extension === ".dds");
@@ -2495,6 +2496,10 @@
                     texture._height = height;
                     texture.isReady = true;
 
+                    texture.onLoadedCallbacks.forEach(callback => {
+                        callback();
+                    });
+
                     if (onLoad) {
                         onLoad();
                     }

+ 3 - 2
src/babylon.scene.js

@@ -1022,12 +1022,13 @@ var BABYLON;
         /**
          * Will stop the animation of the given target
          * @param target - the target
+         * @param animationName - the name of the animation to stop (all animations will be stopped is empty)
          * @see beginAnimation
          */
-        Scene.prototype.stopAnimation = function (target) {
+        Scene.prototype.stopAnimation = function (target, animationName) {
             var animatable = this.getAnimatableByTarget(target);
             if (animatable) {
-                animatable.stop();
+                animatable.stop(animationName);
             }
         };
         Scene.prototype._animate = function () {